Steven Silvester 8 роки тому
батько
коміт
aa085a3208
2 змінених файлів з 22 додано та 13 видалено
  1. 1 13
      src/editorwidget/plugin.ts
  2. 21 0
      src/editorwidget/widget.ts

+ 1 - 13
src/editorwidget/plugin.ts

@@ -1,10 +1,6 @@
 // Copyright (c) Jupyter Development Team.
 // Distributed under the terms of the Modified BSD License.
 
-import {
-  each
-} from 'phosphor/lib/algorithm/iteration';
-
 import {
   AttachedProperty
 } from 'phosphor/lib/core/properties';
@@ -109,15 +105,7 @@ function activateEditorHandler(app: JupyterLab, registry: IDocumentRegistry, mai
     widget.title.icon = `${PORTRAIT_ICON_CLASS} ${EDITOR_ICON_CLASS}`;
     tracker.add(widget);
   });
-  registry.addWidgetFactory(widgetFactory,
-  {
-    fileExtensions: ['*'],
-    displayName: 'Editor',
-    modelName: 'text',
-    defaultFor: ['*'],
-    preferKernel: false,
-    canStartKernel: false
-  });
+  registry.addWidgetFactory(widgetFactory);
 
   mainMenu.addMenu(createMenu(app), {rank: 30});
 

+ 21 - 0
src/editorwidget/widget.ts

@@ -128,6 +128,27 @@ class EditorWidget extends CodeMirrorWidget {
  */
 export
 class EditorWidgetFactory extends ABCWidgetFactory<EditorWidget, DocumentRegistry.IModel> {
+  /**
+   * The name of the widget to display in dialogs.
+   */
+  get name(): string {
+    return 'Editor';
+  }
+
+  /**
+   * The file extensions the widget can view.
+   */
+  get fileExtensions(): string[] {
+    return ['*'];
+  }
+
+  /**
+   * The file extensions for which the factory should be the default.
+   */
+  get defaultFor(): string[] {
+    return ['*'];
+  }
+
   /**
    * Create a new widget given a context.
    */