aboutsummaryrefslogtreecommitdiff
path: root/src/client/goldenLayout.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/client/goldenLayout.js')
-rw-r--r--src/client/goldenLayout.js35
1 files changed, 27 insertions, 8 deletions
diff --git a/src/client/goldenLayout.js b/src/client/goldenLayout.js
index 012ee163c..e5cd50de2 100644
--- a/src/client/goldenLayout.js
+++ b/src/client/goldenLayout.js
@@ -3264,7 +3264,6 @@
if (canDelete) {
rowOrCol.removeChild(stack);
if (rowOrCol.contentItems.length === 1 && parRowOrCol.contentItems.length === 1 && !parRowOrCol.isRoot) {
-
saveScrollTops(rowOrCol.contentItems[0].element);
parRowOrCol.replaceChild(rowOrCol, rowOrCol.contentItems[0]);
restoreScrollTops(rowOrCol.contentItems[0].element);
@@ -4724,15 +4723,35 @@
*/
} else {
type = isVertical ? 'column' : 'row';
- rowOrColumn = this.layoutManager.createContentItem({ type: type }, this);
- this.parent.replaceChild(this, rowOrColumn);
+ if (this.parent.contentItems.length === 1) {
+ let grandparent = this.parent.parent;
+ let correctRowOrCol = this.layoutManager.createContentItem({ type: type }, this);
+ grandparent.replaceChild(this.parent, correctRowOrCol);
+ correctRowOrCol.addChild(contentItem, 0, true);
+ let newstack = this.contentItems[0];
+ if (newstack.isComponent) {
+ newstack = this.layoutManager.createContentItem({
+ type: 'stack',
+ header: contentItem.config.header || {}
+ }, this);
+ newstack._$init();
+ newstack.addChild(this.contentItems[0]);
+ }
+ correctRowOrCol.addChild(newstack, insertBefore ? 0 : undefined, true);
+ newstack.config[dimension] = 50;
+ contentItem.config[dimension] = 50;
+ correctRowOrCol.callDownwards('setSize');
+ } else {
+ rowOrColumn = this.layoutManager.createContentItem({ type: type }, this);
+ this.parent.replaceChild(this, rowOrColumn);
- rowOrColumn.addChild(contentItem, insertBefore ? 0 : undefined, true);
- rowOrColumn.addChild(this, insertBefore ? undefined : 0, true);
+ rowOrColumn.addChild(contentItem, insertBefore ? 0 : undefined, true);
+ rowOrColumn.addChild(this, insertBefore ? undefined : 0, true);
- this.config[dimension] = 50;
- contentItem.config[dimension] = 50;
- rowOrColumn.callDownwards('setSize');
+ this.config[dimension] = 50;
+ contentItem.config[dimension] = 50;
+ rowOrColumn.callDownwards('setSize');
+ }
}
},