ソースを参照

Remove the auto-switch to “mobile” mode, and behavior switches associated with mobile mode

Fixes #9567

Reverts part of #8456

See https://github.com/jupyterlab/jupyterlab/issues/9567 for an extensive discussion about this. In short, the existing auto-switching behavior was disruptive to desktop users, and conflated issues of responsive layout, mobile platform, and simple interface. The plan is to take a step back and design an approach that disentangles each of these concerns better.
Jason Grout 4 年 前
コミット
91ec5a4369
2 ファイル変更1 行追加63 行削除
  1. 0 48
      packages/application/src/lab.ts
  2. 1 15
      packages/statusbar-extension/src/index.ts

+ 0 - 48
packages/application/src/lab.ts

@@ -9,8 +9,6 @@ import { IRenderMime } from '@jupyterlab/rendermime-interfaces';
 
 import { Token } from '@lumino/coreutils';
 
-import { Throttler } from '@lumino/polling';
-
 import { JupyterFrontEnd, JupyterFrontEndPlugin } from './frontend';
 
 import { createRendermimePlugins } from './mimerenderers';
@@ -85,18 +83,6 @@ export class JupyterLab extends JupyterFrontEnd<ILabShell> {
         this.registerPlugin(plugin);
       }
     }
-
-    void this.restored.then(() => {
-      this.formatChanged.connect((_, format) => {
-        if (format === 'mobile') {
-          this.shell.mode = 'single-document';
-          this.shell.collapseLeft();
-          this.shell.collapseRight();
-          return;
-        }
-      }, this);
-      Private.setFormat(this);
-    });
   }
 
   /**
@@ -144,18 +130,6 @@ export class JupyterLab extends JupyterFrontEnd<ILabShell> {
     return this._paths;
   }
 
-  /**
-   * Handle the DOM events for the application.
-   *
-   * @param event - The DOM event sent to the application.
-   */
-  handleEvent(event: Event): void {
-    super.handleEvent(event);
-    if (event.type === 'resize') {
-      void this._formatter.invoke();
-    }
-  }
-
   /**
    * Register plugins from a plugin module.
    *
@@ -190,9 +164,6 @@ export class JupyterLab extends JupyterFrontEnd<ILabShell> {
     });
   }
 
-  private _formatter = new Throttler(() => {
-    Private.setFormat(this);
-  }, 250);
   private _info: JupyterLab.IInfo;
   private _paths: JupyterFrontEnd.IPaths;
 }
@@ -299,22 +270,3 @@ export namespace JupyterLab {
       | JupyterFrontEndPlugin<any, any, any>[];
   }
 }
-
-/**
- * A namespace for module-private functionality.
- */
-namespace Private {
-  /**
-   * Media query for mobile devices.
-   */
-  const MOBILE_QUERY = 'only screen and (max-width: 760px)';
-
-  /**
-   * Sets the `format` of a Jupyter front-end application.
-   *
-   * @param app The front-end application whose format is set.
-   */
-  export function setFormat(app: JupyterLab): void {
-    app.format = window.matchMedia(MOBILE_QUERY).matches ? 'mobile' : 'desktop';
-  }
-}

+ 1 - 15
packages/statusbar-extension/src/index.ts

@@ -111,7 +111,6 @@ const statusBar: JupyterFrontEndPlugin<IStatusBar> = {
       mainMenu.viewMenu.addGroup([{ command }], 1);
     }
 
-    let ready = app.restored;
     if (settingRegistry) {
       const loadSettings = settingRegistry.load(STATUSBAR_PLUGIN_ID);
       const updateSettings = (settings: ISettingRegistry.ISettings): void => {
@@ -119,7 +118,7 @@ const statusBar: JupyterFrontEndPlugin<IStatusBar> = {
         statusBar.setHidden(!visible);
       };
 
-      ready = Promise.all([loadSettings, app.restored])
+      Promise.all([loadSettings, app.restored])
         .then(([settings]) => {
           updateSettings(settings);
           settings.changed.connect(settings => {
@@ -131,19 +130,6 @@ const statusBar: JupyterFrontEndPlugin<IStatusBar> = {
         });
     }
 
-    // Hide the status bar in the mobile format.
-    void ready.then(() => {
-      const handleFormat = () => {
-        if (app.format === 'mobile') {
-          statusBar.setHidden(true);
-        } else {
-          statusBar.setHidden(false);
-        }
-      };
-      app.formatChanged.connect(handleFormat);
-      handleFormat();
-    });
-
     return statusBar;
   },
   optional: [ILabShell, ISettingRegistry, IMainMenu, ICommandPalette]