Skip to content

Commit 32004e8

Browse files
committed
property for resolved element content
1 parent 6a3fa6c commit 32004e8

6 files changed

+38
-11
lines changed

lib/es5/dock-spawn-ts.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/js/PanelContainer.d.ts

+2
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ export declare class PanelContainer implements IDockContainerWithSize {
2626
resizeHandler?: any;
2727
_dockSpawnPanelContainer: PanelContainer;
2828
};
29+
private _resolvedElementContent;
2930
elementContentContainer: HTMLElement;
3031
elementContentWrapper: HTMLElement;
3132
dockManager: DockManager;
@@ -85,6 +86,7 @@ export declare class PanelContainer implements IDockContainerWithSize {
8586
set width(value: number);
8687
get height(): number;
8788
set height(value: number);
89+
get resolvedElementContent(): HTMLElement;
8890
private panelDocked;
8991
resize(width: number, height: number): void;
9092
_setPanelDimensions(width: number, height: number): void;

lib/js/PanelContainer.js

+16-4
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/js/PanelContainer.js.map

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "dock-spawn-ts",
3-
"version": "2.531.0",
3+
"version": "2.532.0",
44
"description": "DockSpawn Typescript Version",
55
"license": "MIT",
66
"author": "[email protected]",

src/PanelContainer.ts

+17-4
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ export class PanelContainer implements IDockContainerWithSize {
2929
name: string;
3030
state: ISize;
3131
elementContent: HTMLElement & { resizeHandler?: any, _dockSpawnPanelContainer: PanelContainer };
32+
private _resolvedElementContent: HTMLElement;
3233
elementContentContainer: HTMLElement;
3334
elementContentWrapper: HTMLElement;
3435
dockManager: DockManager;
@@ -252,6 +253,11 @@ export class PanelContainer implements IDockContainerWithSize {
252253

253254
this.mouseDownHandler = new EventHandler(this.elementPanel, 'mousedown', this.onMouseDown.bind(this));
254255
this.touchDownHandler = new EventHandler(this.elementPanel, 'touchstart', this.onMouseDown.bind(this), { passive: true });
256+
257+
this._resolvedElementContent = this.elementContent;
258+
if (this.elementContent instanceof HTMLSlotElement) {
259+
this._resolvedElementContent = <HTMLElement>this.elementContent.assignedElements()?.[0];
260+
}
255261
}
256262

257263
onMouseDown() {
@@ -348,6 +354,16 @@ export class PanelContainer implements IDockContainerWithSize {
348354
}
349355
}
350356

357+
get resolvedElementContent(): HTMLElement {
358+
if (this._resolvedElementContent)
359+
return this._resolvedElementContent;
360+
this._resolvedElementContent = this.elementContent;
361+
if (this.elementContent instanceof HTMLSlotElement) {
362+
this._resolvedElementContent = <HTMLElement>this.elementContent.assignedElements()?.[0];
363+
}
364+
return this._resolvedElementContent;
365+
}
366+
351367
private panelDocked() {
352368
if (this.elementContent.hidden)
353369
this.elementContent.hidden = false;
@@ -457,10 +473,7 @@ export class PanelContainer implements IDockContainerWithSize {
457473
}
458474

459475
undockToBrowserDialog() {
460-
let el: HTMLElement = this.elementContent;
461-
if (el instanceof HTMLSlotElement)
462-
el = <HTMLElement>el.assignedElements()[0]
463-
moveElementToNewBrowserWindow(el, {
476+
moveElementToNewBrowserWindow(this.resolvedElementContent, {
464477
title: '',
465478
closeCallback: () => { },
466479
newWindowClosedCallback: () => { },

0 commit comments

Comments
 (0)