Przeglądaj źródła

Add default handler to list of handlers

Steven Silvester 9 lat temu
rodzic
commit
6030c0c897
1 zmienionych plików z 2 dodań i 1 usunięć
  1. 2 1
      src/fileopener/plugin.ts

+ 2 - 1
src/fileopener/plugin.ts

@@ -154,6 +154,7 @@ class FileOpener implements IFileOpener {
     if (this._defaultHandler !== null) {
       throw Error('Default handler already registered');
     }
+    this._handlers.push(handler);
     this._defaultHandler = handler;
   }
 
@@ -161,7 +162,7 @@ class FileOpener implements IFileOpener {
    * Open a file and add it to the application shell.
    */
   open(path: string): Widget {
-    if (this._handlers.length === 0 && this._defaultHandler === null) {
+    if (this._handlers.length === 0) {
       return;
     }
     let ext = '.' + path.split('.').pop();