Explorar el Código

Merge pull request #1581 from blink1073/fix-rename

Fix File Rename
Afshin Darian hace 8 años
padre
commit
d1c23340a4
Se han modificado 3 ficheros con 7 adiciones y 6 borrados
  1. 1 1
      package.json
  2. 5 5
      src/docregistry/context.ts
  3. 1 0
      src/filebrowser/model.ts

+ 1 - 1
package.json

@@ -7,7 +7,7 @@
   },
   "typings": "lib/index.d.ts",
   "dependencies": {
-    "@jupyterlab/services": "^0.36.0",
+    "@jupyterlab/services": "^0.36.1",
     "ansi_up": "^1.3.0",
     "backbone": "^1.2.0",
     "codemirror": "^5.20.2",

+ 5 - 5
src/docregistry/context.ts

@@ -415,11 +415,12 @@ class Context<T extends DocumentRegistry.IModel> implements DocumentRegistry.ICo
       return;
     }
     if (change.oldValue.path === this._path) {
-      let path = this._path = change.newValue.path;
       if (this._session) {
-        this._session.rename(path);
+        this._session.rename(change.newValue.path);
+      } else {
+        this._path = change.newValue.path;
+        this.pathChanged.emit(this._path);
       }
-      this.pathChanged.emit(path);
     }
   }
 
@@ -455,8 +456,7 @@ class Context<T extends DocumentRegistry.IModel> implements DocumentRegistry.ICo
   /**
    * Handle a change to a session path.
    */
-  private _onSessionPathChanged(sender: Session.ISession) {
-    let path = sender.path;
+  private _onSessionPathChanged(sender: Session.ISession, path: string) {
     if (path !== this._path) {
       this._path = path;
       this.pathChanged.emit(path);

+ 1 - 0
src/filebrowser/model.ts

@@ -465,6 +465,7 @@ class FileBrowserModel implements IDisposable, IPathTracker {
       if (this._requested && this._blackoutId !== -1) {
         this._requested = false;
         clearTimeout(this._blackoutId);
+        this._blackoutId = -1;
         this._timeoutId = setTimeout(() => {
           this._scheduleUpdate();
         }, MIN_REFRESH);