|
@@ -18,6 +18,10 @@ import {
|
|
|
Application
|
|
|
} from 'phosphide/lib/core/application';
|
|
|
|
|
|
+import {
|
|
|
+ IChangedArgs
|
|
|
+} from 'phosphor-properties';
|
|
|
+
|
|
|
import {
|
|
|
Menu, MenuBar, MenuItem
|
|
|
} from 'phosphor-menus';
|
|
@@ -61,6 +65,7 @@ function activateFileBrowser(app: Application, manager: DocumentManager, provide
|
|
|
menu.popup(x, y);
|
|
|
});
|
|
|
|
|
|
+ let id = 0;
|
|
|
let onOpenRequested = (model: IContentsModel) => {
|
|
|
let widget = manager.open(model);
|
|
|
if (!widget.id) widget.id = `document-manager-${++id}`;
|
|
@@ -75,6 +80,13 @@ function activateFileBrowser(app: Application, manager: DocumentManager, provide
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ let onFileChanged = (args: IChangedArgs<string>) => {
|
|
|
+ manager.rename(args.oldValue, args.newValue);
|
|
|
+ }
|
|
|
+
|
|
|
+ model.openRequested.connect((bModel, model) => onOpenRequested(model));
|
|
|
+ model.fileChanged.connect((mModel, args) => onFileChanged(args));
|
|
|
+
|
|
|
// Create a command to add a new empty text file.
|
|
|
// This requires an id and an instance of a command object.
|
|
|
let newTextFileId = 'file-operations:new-text-file';
|
|
@@ -218,9 +230,6 @@ function activateFileBrowser(app: Application, manager: DocumentManager, provide
|
|
|
return manager.open(model);
|
|
|
}
|
|
|
|
|
|
- let id = 0;
|
|
|
- model.openRequested.connect((bModel, model) => onOpenRequested(model));
|
|
|
-
|
|
|
widget.title.text = 'Files';
|
|
|
widget.id = 'file-browser';
|
|
|
app.shell.addToLeftArea(widget, { rank: 40 });
|