Skip to content

Commit

Permalink
fix: 修复重置后 Lock 状态不正确问题
Browse files Browse the repository at this point in the history
  • Loading branch information
ArgoZhang committed Oct 5, 2023
1 parent 8d7ad76 commit d116bcd
Showing 1 changed file with 21 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ export function reset(id, option, invoke) {
}
})
dispose(id)

init(id, option, invoke)
}
}
Expand Down Expand Up @@ -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 () {
Expand All @@ -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) {
Expand All @@ -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 }
})
Expand All @@ -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')
}
}
}

0 comments on commit d116bcd

Please sign in to comment.