Browse Source

Remove left and right sidebar data attributes from the application DOM
structure alltogether.

Ian Rose 5 years ago
parent
commit
6f08b50263
2 changed files with 5 additions and 19 deletions
  1. 5 11
      packages/application-extension/src/index.tsx
  2. 0 8
      packages/application/src/shell.ts

+ 5 - 11
packages/application-extension/src/index.tsx

@@ -397,10 +397,8 @@ const sidebar: JupyterFrontEndPlugin<void> = {
     app.commands.addCommand(CommandIDs.switchSidebar, {
       label: 'Switch Sidebar Side',
       execute: () => {
-        // First, try to find the right panel based on the
-        // application context menu click,
-        // If we can't find it there, look for use the active
-        // left/right widgets.
+        // First, try to find the correct panel based on the
+        // application context menu click.
         const contextNode: HTMLElement = app.contextMenuHitTest(
           node => !!node.dataset.id
         );
@@ -415,14 +413,10 @@ const sidebar: JupyterFrontEndPlugin<void> = {
           } else {
             side = 'left';
           }
-        } else if (app.shell.dataset.leftSidebarWidget) {
-          id = app.shell.dataset.leftSidebarWidget;
-          side = 'right';
-        } else if (app.shell.dataset.rightSidebarWidget) {
-          id = app.shell.dataset.rightSidebarWidget;
-          side = 'left';
+        } else {
+          // Bail if we don't find a sidebar for the widget.
+          return;
         }
-
         // Move the panel to the other side.
         const newOverrides = { ...overrides };
         newOverrides[id] = side;

+ 0 - 8
packages/application/src/shell.ts

@@ -1028,7 +1028,6 @@ namespace Private {
      * Construct a new side bar handler.
      */
     constructor(side: string) {
-      // this._side = side;
       this._sideBar = new TabBar<Widget>({
         insertBehavior: 'none',
         removeBehavior: 'none',
@@ -1200,12 +1199,6 @@ namespace Private {
         newWidget.show();
       }
       this._lastCurrent = newWidget || oldWidget;
-      // if (newWidget) {
-      //   const id = newWidget.id;
-      //   this.node.setAttribute(`data-${this._side}-sidebar-widget`, id);
-      // } else {
-      //   this.node.removeAttribute(`data-${this._side}-sidebar-widget`);
-      // }
       this._refreshVisibility();
     }
 
@@ -1232,7 +1225,6 @@ namespace Private {
     }
 
     private _items = new Array<Private.IRankItem>();
-    // private _side: string;
     private _sideBar: TabBar<Widget>;
     private _stackedPanel: StackedPanel;
     private _lastCurrent: Widget | null;