Browse Source

Refactor help plugin

Steven Silvester 8 years ago
parent
commit
75b5e51f34

+ 1 - 1
examples/lab/index.js

@@ -24,7 +24,7 @@ var mods = [
   require('jupyterlab/lib/editorwidget/plugin'),
   require('jupyterlab/lib/plugin-faq'),
   require('jupyterlab/lib/filebrowser/plugin'),
-  require('jupyterlab/lib/help/plugin'),
+  require('jupyterlab/lib/plugin-help'),
   require('jupyterlab/lib/imagewidget/plugin'),
   require('jupyterlab/lib/inspector/plugin'),
   require('jupyterlab/lib/landing/plugin'),

+ 1 - 1
jupyterlab/src/main.ts

@@ -31,7 +31,7 @@ const mods: JupyterLab.IPluginModule[] = [
   require('../../lib/editorwidget/plugin'),
   require('../../lib/plugin-faq'),
   require('../../lib/filebrowser/plugin'),
-  require('../../lib/help/plugin'),
+  require('../../lib/plugin-help'),
   require('../../lib/imagewidget/plugin'),
   require('../../lib/inspector/plugin'),
   require('../../lib/landing/plugin'),

+ 0 - 30
src/help/index.ts

@@ -1,30 +0,0 @@
-// Copyright (c) Jupyter Development Team.
-// Distributed under the terms of the Modified BSD License.
-
-
-/**
- * The command IDs used by the help plugin.
- */
-export
-namespace CommandIDs {
-  export
-  const open: string = 'help-jupyterlab:open';
-
-  export
-  const activate: string = 'help-jupyterlab:activate';
-
-  export
-  const close: string = 'help-jupyterlab:close';
-
-  export
-  const show: string = 'help-jupyterlab:show';
-
-  export
-  const hide: string = 'help-jupyterlab:hide';
-
-  export
-  const toggle: string = 'help-jupyterlab:toggle';
-
-  export
-  const launchClassic: string = 'classic-notebook:launchClassic';
-};

+ 0 - 0
src/help/index.css → src/plugin-help/index.css


+ 31 - 4
src/help/plugin.ts → src/plugin-help/index.ts

@@ -21,6 +21,10 @@ import {
   IFrameWidget
 } from '../apputils';
 
+import {
+  URLExt
+} from '../coreutils';
+
 import {
   ICommandPalette
 } from '../commandpalette';
@@ -37,9 +41,32 @@ import {
   CommandIDs as StateDBCommandIDs
 } from '../statedb';
 
-import {
-  CommandIDs
-} from './';
+
+/**
+ * The command IDs used by the help plugin.
+ */
+namespace CommandIDs {
+  export
+  const open: string = 'help-jupyterlab:open';
+
+  export
+  const activate: string = 'help-jupyterlab:activate';
+
+  export
+  const close: string = 'help-jupyterlab:close';
+
+  export
+  const show: string = 'help-jupyterlab:show';
+
+  export
+  const hide: string = 'help-jupyterlab:hide';
+
+  export
+  const toggle: string = 'help-jupyterlab:toggle';
+
+  export
+  const launchClassic: string = 'classic-notebook:launchClassic';
+};
 
 
 /**
@@ -201,7 +228,7 @@ function activate(app: JupyterLab, mainMenu: IMainMenu, palette: ICommandPalette
       const text = args['text'] as string;
 
       // If help resource will generate a mixed content error, load externally.
-      if (LAB_IS_SECURE && utils.urlParse(url).protocol !== 'https:') {
+      if (LAB_IS_SECURE && URLExt.parse(url).protocol !== 'https:') {
         window.open(url);
         return;
       }

+ 1 - 5
src/shortcuts/plugin.ts

@@ -25,10 +25,6 @@ import {
   CommandIDs as FileBrowserCommandIDs
 } from '../filebrowser';
 
-import {
-  CommandIDs as HelpCommandIDs
-} from '../help';
-
 import {
   CommandIDs as ImageWidgetCommandIDs
 } from '../imagewidget';
@@ -146,7 +142,7 @@ const SHORTCUTS = [
     keys: ['Ctrl Shift Q']
   },
   {
-    command: HelpCommandIDs.toggle,
+    command: 'help-jupyterlab:toggle',
     selector: 'body',
     keys: ['Accel Shift H']
   },