From 99ec0311607cb9275811571df186147e8fe9c65a Mon Sep 17 00:00:00 2001 From: yann300 Date: Wed, 8 May 2019 15:43:51 +0200 Subject: [PATCH] unselect current file when switch to an app tab --- src/app/files/fileManager.js | 6 ++++++ src/app/panels/editor-panel.js | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/app/files/fileManager.js b/src/app/files/fileManager.js index 342f9d85f2..19d64c8608 100644 --- a/src/app/files/fileManager.js +++ b/src/app/files/fileManager.js @@ -189,6 +189,12 @@ class FileManager extends FileSystemApi { this.switchFile() } + unselectCurrentFile () { + this.saveCurrentFile() + this._deps.config.set('currentFile', '') + this.events.emit('noFileSelected') + } + switchFile (file) { const _switchFile = (file) => { this.saveCurrentFile() diff --git a/src/app/panels/editor-panel.js b/src/app/panels/editor-panel.js index f6eccd3a7f..9a4d0a3814 100644 --- a/src/app/panels/editor-panel.js +++ b/src/app/panels/editor-panel.js @@ -51,11 +51,11 @@ class EditorPanel { } self.tabProxy = new TabProxy(self._deps.fileManager, self._components.editor, self.appStore, self.appManager) let showApp = function (name) { + self._deps.fileManager.unselectCurrentFile() self.mainPanelComponent.showContent(name) self._view.editor.style.display = 'none' self._components.contextView.hide() self._view.mainPanel.style.display = 'block' - self.tabProxy.sh } self.appManager.event.on('ensureActivated', (name) => { if (name === 'home') {