Selaa lähdekoodia

Clean up the editorwidget

Steven Silvester 8 vuotta sitten
vanhempi
commit
bb02c153ae
2 muutettua tiedostoa jossa 3 lisäystä ja 12 poistoa
  1. 1 9
      src/editorwidget/plugin.ts
  2. 2 3
      src/editorwidget/widget.ts

+ 1 - 9
src/editorwidget/plugin.ts

@@ -18,10 +18,6 @@ import {
   JupyterLab, JupyterLabPlugin
 } from '../application';
 
-import {
-  DEFAULT_CODEMIRROR_THEME
-} from '../codemirror/widget';
-
 import {
   ICommandPalette
 } from '../commandpalette';
@@ -50,10 +46,6 @@ import {
   IEditorTracker, EditorWidget, EditorWidgetFactory
 } from './widget';
 
-import {
-  CodeMirrorEditor, DEFAULT_CODEMIRROR_THEME
-} from '../codemirror/editor';
-
 import {
   IEditorServices
 } from '../codeeditor';
@@ -108,7 +100,7 @@ const plugin: JupyterLabPlugin<IEditorTracker> = {
  * Sets up the editor widget
  */
 function activateEditorHandler(app: JupyterLab, registry: IDocumentRegistry, mainMenu: IMainMenu, palette: ICommandPalette, state: IStateDB, layout: ILayoutRestorer, editorServices: IEditorServices): IEditorTracker {
-  const factory = new EditorWidgetFactory({
+  const factory = new EditorWidgetFactory(editorServices, {
     name: FACTORY,
     fileExtensions: ['*'],
     defaultFor: ['*']

+ 2 - 3
src/editorwidget/widget.ts

@@ -70,12 +70,11 @@ class EditorWidget extends CodeEditorWidget {
     let model = context.model;
     let editor = this.editor;
 
-    let doc = editor.getDoc();
 
     // Prevent the initial loading from disk from being in the editor history.
     context.ready.then( () => {
-      doc.setValue(model.toString());
-      doc.clearHistory();
+      editor.model.value = model.toString();
+      editor.model.clearHistory();
     });
 
     editor.model.value = model.toString();