Explorar o código

Remove temporary open command from context menu.

Afshin Darian %!s(int64=8) %!d(string=hai) anos
pai
achega
08ed45062c

+ 3 - 1
packages/docmanager-extension/src/index.ts

@@ -208,7 +208,9 @@ function addCommands(app: JupyterLab, docManager: IDocumentManager, registry: ID
       return docManager.services.contents.get(path)
         .then(() => docManager.openOrReveal(path, factory));
     },
-    label: args => (args['label'] || args['factory']) as string
+    icon: args => args['icon'] as string || '',
+    label: args => (args['label'] || args['factory']) as string,
+    mnemonic: args => args['mnemonic'] as number || -1
   });
 
   commands.addCommand(CommandIDs.restoreCheckpoint, {

+ 12 - 13
packages/filebrowser-extension/src/index.ts

@@ -115,11 +115,9 @@ function activateFactory(app: JupyterLab, docManager: IDocumentManager, state: I
         if (path && factories.length > 1) {
           openWith = new Menu({ commands });
           openWith.title.label = 'Open With...';
-
-          for (let factory of factories) {
-            const args = { factory, path };
-            openWith.addItem({ args, command });
-          }
+          factories.forEach(factory => {
+            openWith.addItem({ args: { factory, path }, command });
+          });
         }
 
         const menu = createContextMenu(widget, openWith);
@@ -215,14 +213,15 @@ function createContextMenu(fbWidget: FileBrowser, openWith: Menu):  Menu {
   // Remove all the commands associated with this menu upon disposal.
   menu.disposed.connect(() => { disposables.dispose(); });
 
-  command = `${prefix}:open`;
-  disposables.add(commands.addCommand(command, {
-    execute: () => { fbWidget.open(); },
-    icon: 'jp-MaterialIcon jp-OpenFolderIcon',
-    label: 'Open',
-    mnemonic: 0
-  }));
-  menu.addItem({ command });
+  command = 'file-operations:open';
+  menu.addItem({
+    command,
+    args: {
+      icon: 'jp-MaterialIcon jp-OpenFolderIcon',
+      label: 'Open',
+      mnemonic: 0
+    }
+  });
 
   if (openWith) {
     menu.addItem({ type: 'submenu', submenu: openWith });