Ver código fonte

Backport PR #11203: Properly reset layout when toggling simple mode. (#11211)

Co-authored-by: Jason Grout <jasongrout@users.noreply.github.com>
MeeseeksMachine 3 anos atrás
pai
commit
277a156dd7
1 arquivos alterados com 5 adições e 4 exclusões
  1. 5 4
      packages/application/src/shell.ts

+ 5 - 4
packages/application/src/shell.ts

@@ -519,11 +519,10 @@ export class LabShell extends Widget implements JupyterFrontEnd.IShell {
 
     const applicationCurrentWidget = this.currentWidget;
 
-    // Toggle back to multiple document mode.
-    dock.mode = mode;
-
     if (mode === 'single-document') {
+      // Cache the current multi-document layout before changing the mode.
       this._cachedLayout = dock.saveLayout();
+      dock.mode = mode;
 
       // In case the active widget in the dock panel is *not* the active widget
       // of the application, defer to the application.
@@ -536,8 +535,10 @@ export class LabShell extends Widget implements JupyterFrontEnd.IShell {
       this._titleHandler.show();
       this._updateTitlePanelTitle();
     } else {
-      // Cache a reference to every widget currently in the dock panel.
+      // Cache a reference to every widget currently in the dock panel before
+      // changing its mode.
       const widgets = toArray(dock.widgets());
+      dock.mode = mode;
 
       // Restore the original layout.
       if (this._cachedLayout) {