diff --git a/src/app.js b/src/app.js index becf571a04..8ec8f06f92 100644 --- a/src/app.js +++ b/src/app.js @@ -172,7 +172,7 @@ var run = function () { var FilePanelAPI = { createName: createNonClashingName, switchToFile: switchToFile, - ui: ui.event + event: this.event } var el = new FilePanel(FilePanelAPI, files) filepanel.appendChild(el) @@ -352,6 +352,7 @@ var run = function () { } else { editor.open(file, files.get(file)) } + self.event.trigger('currentFileChanged', [file]) } function switchToNextFile () { diff --git a/src/app/file-explorer.js b/src/app/file-explorer.js index 925de52f2a..1d0c88a8c5 100755 --- a/src/app/file-explorer.js +++ b/src/app/file-explorer.js @@ -37,7 +37,6 @@ module.exports = fileExplorer function fileExplorer (appAPI, files) { var fileEvents = files.event - var appUI = appAPI.ui var tv = new Treeview({ extractData: function (value, tree, key) { var newValue = {} @@ -76,10 +75,8 @@ function fileExplorer (appAPI, files) { ` - appUI.register('fileChanged', (changedFiles) => { - if (changedFiles[0] === 'currentFile') { - fileFocus(files.get('currentFile')) - } + appAPI.event.register('currentFileChanged', (newFile) => { + fileFocus(newFile) }) fileEvents.register('fileRemoved', fileRemoved) fileEvents.register('fileRenamed', fileRenamed)