diff options
author | bobzel <zzzman@gmail.com> | 2020-09-15 20:41:15 -0400 |
---|---|---|
committer | bobzel <zzzman@gmail.com> | 2020-09-15 20:41:15 -0400 |
commit | 4913f4a75ea49463875a9398a20701bc1e4d4d37 (patch) | |
tree | 35348982f3978befede9316ebc8ff5816efeff9d /src | |
parent | 4923bc403a3661ba8d0a9009193e508c68e6af71 (diff) |
prevented last stack from being deleted in docking view.
Diffstat (limited to 'src')
-rw-r--r-- | src/client/goldenLayout.js | 2 | ||||
-rw-r--r-- | src/client/views/collections/CollectionDockingView.tsx | 8 |
2 files changed, 7 insertions, 3 deletions
diff --git a/src/client/goldenLayout.js b/src/client/goldenLayout.js index 2d4283b02..293762709 100644 --- a/src/client/goldenLayout.js +++ b/src/client/goldenLayout.js @@ -3204,7 +3204,7 @@ * If this was the last content item, remove this node as well */ } else if (!(this instanceof lm.items.Root) && this.config.isClosable === true) { - this.parent.removeChild(this); + if (!this.parent.parent.isRoot || this.parent.contentItems.length > 1) this.parent.removeChild(this); // bcz: added test for last stack } }, diff --git a/src/client/views/collections/CollectionDockingView.tsx b/src/client/views/collections/CollectionDockingView.tsx index d7a134eb3..306b9187e 100644 --- a/src/client/views/collections/CollectionDockingView.tsx +++ b/src/client/views/collections/CollectionDockingView.tsx @@ -375,8 +375,12 @@ export class CollectionDockingView extends CollectionSubView(doc => doc) { .off('click') //unbind the current click handler .click(action(() => { //if (confirm('really close this?')) { - stack.remove(); - stack.contentItems.forEach((contentItem: any) => Doc.AddDocToList(CurrentUserUtils.MyRecentlyClosed, "data", contentItem.tab.DashDoc, undefined, true, true)); + if (!stack.parent.parent.isRoot || stack.parent.contentItems.length > 1) { + stack.remove(); + stack.contentItems.forEach((contentItem: any) => Doc.AddDocToList(CurrentUserUtils.MyRecentlyClosed, "data", contentItem.tab.DashDoc, undefined, true, true)); + } else { + alert('cant delete the last stack'); + } })); stack.header?.controlsContainer.find('.lm_popout') //get the close icon .off('click') //unbind the current click handler |