File changed callback.

pull/1/head
chriseth 8 years ago
parent 0e9930f94f
commit 2c3591a795
  1. 3
      src/app.js
  2. 7
      src/app/file-explorer.js

@ -172,7 +172,7 @@ var run = function () {
var FilePanelAPI = { var FilePanelAPI = {
createName: createNonClashingName, createName: createNonClashingName,
switchToFile: switchToFile, switchToFile: switchToFile,
ui: ui.event event: this.event
} }
var el = new FilePanel(FilePanelAPI, files) var el = new FilePanel(FilePanelAPI, files)
filepanel.appendChild(el) filepanel.appendChild(el)
@ -352,6 +352,7 @@ var run = function () {
} else { } else {
editor.open(file, files.get(file)) editor.open(file, files.get(file))
} }
self.event.trigger('currentFileChanged', [file])
} }
function switchToNextFile () { function switchToNextFile () {

@ -37,7 +37,6 @@ module.exports = fileExplorer
function fileExplorer (appAPI, files) { function fileExplorer (appAPI, files) {
var fileEvents = files.event var fileEvents = files.event
var appUI = appAPI.ui
var tv = new Treeview({ var tv = new Treeview({
extractData: function (value, tree, key) { extractData: function (value, tree, key) {
var newValue = {} var newValue = {}
@ -76,10 +75,8 @@ function fileExplorer (appAPI, files) {
</span> </span>
` `
appUI.register('fileChanged', (changedFiles) => { appAPI.event.register('currentFileChanged', (newFile) => {
if (changedFiles[0] === 'currentFile') { fileFocus(newFile)
fileFocus(files.get('currentFile'))
}
}) })
fileEvents.register('fileRemoved', fileRemoved) fileEvents.register('fileRemoved', fileRemoved)
fileEvents.register('fileRenamed', fileRenamed) fileEvents.register('fileRenamed', fileRenamed)

Loading…
Cancel
Save