瀏覽代碼

Reconcile editor widget plugin to new pattern.

Afshin Darian 8 年之前
父節點
當前提交
387c67d514
共有 1 個文件被更改,包括 5 次插入5 次删除
  1. 5 5
      src/editorwidget/plugin.ts

+ 5 - 5
src/editorwidget/plugin.ts

@@ -118,14 +118,14 @@ function activateEditorHandler(app: JupyterLab, registry: IDocumentRegistry, mai
     widget.title.icon = `${PORTRAIT_ICON_CLASS} ${EDITOR_ICON_CLASS}`;
     // Add the file path to the state database.
     let key = `${NAMESPACE}:${widget.context.path}`;
-    state.save(key, widget.context.path);
+    state.save(key, { path: widget.context.path });
     // Remove the file path from the state database on disposal.
     widget.disposed.connect(() => { state.remove(key); });
     // Keep track of path changes in the state database.
     widget.context.pathChanged.connect((sender, path) => {
       state.remove(key);
       key = `${NAMESPACE}:${path}`;
-      state.save(key, path);
+      state.save(key, { path });
     });
     tracker.add(widget);
   });
@@ -211,10 +211,10 @@ function activateEditorHandler(app: JupyterLab, registry: IDocumentRegistry, mai
   ].forEach(command => palette.addItem({ command, category: 'Editor' }));
 
   // Reload any editor widgets whose state has been stored.
-  Promise.all([state.fetchNamespace(NAMESPACE), app.started])
-    .then(([paths]) => {
+  Promise.all([state.fetchNamespace(NAMESPACE), app.started]).then(([coll]) => {
+      let { values } = coll;
       let open = 'file-operations:open';
-      paths.forEach(path => { app.commands.execute(open, { path }); });
+      values.forEach(args => { app.commands.execute(open, args); });
     });
 
   return tracker;