diff --git a/src/Extensions/Components/BootstrapBlazor.Dock/Components/DockView/DockView.razor.js b/src/Extensions/Components/BootstrapBlazor.Dock/Components/DockView/DockView.razor.js index 8513b356ded..9c938c052bd 100644 --- a/src/Extensions/Components/BootstrapBlazor.Dock/Components/DockView/DockView.razor.js +++ b/src/Extensions/Components/BootstrapBlazor.Dock/Components/DockView/DockView.razor.js @@ -107,6 +107,7 @@ export function reset(id, option, invoke) { } }) dispose(id) + init(id, option, invoke) } } @@ -415,9 +416,13 @@ const removeContent = (content, item) => { } const hackGoldenLayout = dock => { + if (goldenLayout.bb_docks === void 0) { + goldenLayout.bb_docks = []; + } + goldenLayout.bb_docks.push(dock); + if (!goldenLayout.isHack) { goldenLayout.isHack = true - const eventsData = dock.eventsData // hack Tab goldenLayout.Tab.prototype.onCloseClick = function () { @@ -437,8 +442,19 @@ const hackGoldenLayout = dock => { } } + // hack RowOrColumn + const originSplitterDragStop = goldenLayout.RowOrColumn.prototype.onSplitterDragStop + goldenLayout.RowOrColumn.prototype.onSplitterDragStop = function (splitter) { + originSplitterDragStop.call(this, splitter) + this.layoutManager.emit('splitterDragStop') + } + // hack Header goldenLayout.Header.prototype.handleButtonPopoutEvent = function () { + // find own dock + const dock = goldenLayout.bb_docks.find(i => i.layout === this.layoutManager); + const eventsData = dock.eventsData + const stack = this.parent const lock = eventsData.has(stack) if (lock) { @@ -457,6 +473,10 @@ const hackGoldenLayout = dock => { originprocessTabDropdownActiveChanged.call(this) this._closeButton.onClick = function (ev) { + // find own dock + const dock = goldenLayout.bb_docks.find(i => i.layout === this.layoutManager); + const eventsData = dock.eventsData + const tabs = this._header.tabs.map(tab => { return { element: tab.componentItem.element, title: tab.componentItem.title } }) @@ -472,12 +492,5 @@ const hackGoldenLayout = dock => { } } } - - // hack RowOrColumn - const originSplitterDragStop = goldenLayout.RowOrColumn.prototype.onSplitterDragStop - goldenLayout.RowOrColumn.prototype.onSplitterDragStop = function (splitter) { - originSplitterDragStop.call(this, splitter) - this.layoutManager.emit('splitterDragStop') - } } }