Bladeren bron

Get rid of tooltip remove command and shortcuts.

Afshin Darian 8 jaren geleden
bovenliggende
commit
b701f034d7
3 gewijzigde bestanden met toevoegingen van 7 en 30 verwijderingen
  1. 0 10
      src/shortcuts/plugin.ts
  2. 0 3
      src/tooltip/index.ts
  3. 7 17
      src/tooltip/plugin.ts

+ 0 - 10
src/shortcuts/plugin.ts

@@ -337,16 +337,6 @@ const SHORTCUTS = [
     selector: '.jp-ConsolePanel',
     keys: ['Shift Tab'],
     args: { notebook: false }
-  },
-  {
-    command: TooltipCommandIDs.remove,
-    selector: '.jp-Notebook.jp-Tooltip-anchor',
-    keys: ['Escape']
-  },
-  {
-    command: TooltipCommandIDs.remove,
-    selector: '.jp-CodeConsole.jp-Tooltip-anchor',
-    keys: ['Escape']
   }
 ];
 

+ 0 - 3
src/tooltip/index.ts

@@ -12,7 +12,4 @@ export
 namespace CommandIDs {
   export
   const launch = 'tooltip:launch';
-
-  export
-  const remove = 'tooltip:remove';
 };

+ 7 - 17
src/tooltip/plugin.ts

@@ -61,11 +61,6 @@ function activate(app: JupyterLab, consoles: IConsoleTracker, notebooks: INotebo
   // Add tooltip launch command.
   registry.addCommand(CommandIDs.launch, {
     execute: args => {
-      // If a tooltip is open, remove it and return.
-      if (tooltip) {
-        return app.commands.execute(CommandIDs.remove, void 0);
-      }
-
       const notebook = args['notebook'] as boolean;
       let anchor: Widget | null = null;
       let editor: CodeEditor.IEditor | null = null;
@@ -73,6 +68,13 @@ function activate(app: JupyterLab, consoles: IConsoleTracker, notebooks: INotebo
       let rendermime: IRenderMime | null = null;
       let parent: NotebookPanel | ConsolePanel | null = null;
 
+      // If a tooltip is open, remove it.
+      if (tooltip) {
+        tooltip.model.dispose();
+        tooltip.dispose();
+        tooltip = null;
+      }
+
       if (notebook) {
         parent = notebooks.currentWidget;
         if (parent) {
@@ -108,16 +110,4 @@ function activate(app: JupyterLab, consoles: IConsoleTracker, notebooks: INotebo
     }
   });
 
-  // Add tooltip remove command.
-  registry.addCommand(CommandIDs.remove, {
-    execute: () => {
-      if (!tooltip) {
-        return;
-      }
-
-      tooltip.model.dispose();
-      tooltip.dispose();
-      tooltip = null;
-    }
-  });
 }