Ver código fonte

first pass at a fix for the icons in "Open With..."

telamonian 6 anos atrás
pai
commit
5672e5ae0b
1 arquivos alterados com 16 adições e 1 exclusões
  1. 16 1
      packages/filebrowser-extension/src/index.ts

+ 16 - 1
packages/filebrowser-extension/src/index.ts

@@ -366,7 +366,22 @@ function addCommands(
         )
       );
     },
-    iconClass: 'jp-MaterialIcon jp-OpenFolderIcon',
+    iconClass: args => {
+      const factory = (args['factory'] as string) || void 0;
+      if (factory) {
+        // if an explicit factory is passed...
+        const ft = registry.getFileType(factory);
+        if (ft) {
+          // ...set an icon if the factory name corresponds to a file type name...
+          return ft.iconClass;
+        } else {
+          // ...or leave the icon blank
+          return '';
+        }
+      } else {
+        return 'jp-MaterialIcon jp-OpenFolderIcon';
+      }
+    },
     label: args => (args['label'] || args['factory'] || 'Open') as string,
     mnemonic: 0
   });