Bladeren bron

update filebrowser and notebook for TS 2.4

S. Chris Colbert 7 jaren geleden
bovenliggende
commit
de128cbf4a
2 gewijzigde bestanden met toevoegingen van 17 en 8 verwijderingen
  1. 11 5
      packages/filebrowser/src/listing.ts
  2. 6 3
      packages/notebook/src/actions.ts

+ 11 - 5
packages/filebrowser/src/listing.ts

@@ -149,7 +149,7 @@ const MATERIAL_ICON_CLASS = 'jp-MaterialIcon';
 const FOLDER_MATERIAL_ICON_CLASS = 'jp-OpenFolderIcon';
 
 /**
- * The class name added to a notebook file browser item. 
+ * The class name added to a notebook file browser item.
  */
 const NOTEBOOK_MATERIAL_ICON_CLASS = 'jp-NotebookIcon';
 
@@ -391,7 +391,7 @@ class DirListing extends Widget {
   paste(): Promise<void> {
     if (!this._clipboard.length) {
       this._isCut = false;
-      return;
+      return Promise.resolve(undefined);
     }
 
     const basePath = this._model.path;
@@ -416,7 +416,9 @@ class DirListing extends Widget {
     this._clipboard.length = 0;
     this._isCut = false;
     this.removeClass(CLIPBOARD_CLASS);
-    return Promise.all(promises).catch(error => {
+    return Promise.all(promises).then(() => {
+      return undefined;
+    }).catch(error => {
       utils.showErrorMessage('Paste Error', error);
     });
   }
@@ -466,7 +468,9 @@ class DirListing extends Widget {
         promises.push(this._model.manager.copy(oldPath, basePath));
       }
     });
-    return Promise.all(promises).catch(error => {
+    return Promise.all(promises).then(() => {
+      return undefined;
+    }).catch(error => {
       utils.showErrorMessage('Duplicate file', error);
     });
   }
@@ -498,7 +502,9 @@ class DirListing extends Widget {
         promises.push(model.manager.services.sessions.shutdown(session.id));
       }
     });
-    return Promise.all(promises).catch(error => {
+    return Promise.all(promises).then(() => {
+      return undefined;
+    }).catch(error => {
       utils.showErrorMessage('Shutdown kernel', error);
     });
   }

+ 6 - 3
packages/notebook/src/actions.ts

@@ -1097,11 +1097,14 @@ namespace Private {
   function cloneCell(model: INotebookModel, cell: ICellModel): ICellModel {
     switch (cell.type) {
     case 'code':
-      return model.contentFactory.createCodeCell(cell.toJSON());
+      // TODO why isnt modeldb or id passed here?
+      return model.contentFactory.createCodeCell({ cell: cell.toJSON() });
     case 'markdown':
-      return model.contentFactory.createMarkdownCell(cell.toJSON());
+      // TODO why isnt modeldb or id passed here?
+      return model.contentFactory.createMarkdownCell({ cell: cell.toJSON() });
     default:
-      return model.contentFactory.createRawCell(cell.toJSON());
+      // TODO why isnt modeldb or id passed here?
+      return model.contentFactory.createRawCell({ cell: cell.toJSON() });
     }
   }