diff --git a/src/app/files/fileManager.js b/src/app/files/fileManager.js index b397cfde35d..b5ed19e75ee 100644 --- a/src/app/files/fileManager.js +++ b/src/app/files/fileManager.js @@ -272,7 +272,6 @@ class FileManager extends Plugin { if (fileList.length) { _switchFile(browserProvider.type + '/' + fileList[0]) } else { - this.editor.displayEmptyReadOnlySession() this.events.emit('noFileSelected') } }) diff --git a/src/app/panels/main-view.js b/src/app/panels/main-view.js index c57e8e8acdb..1640a0279e9 100644 --- a/src/app/panels/main-view.js +++ b/src/app/panels/main-view.js @@ -82,6 +82,9 @@ export class MainView { self._components.contextView.show() self._view.mainPanel.style.display = 'none' }) + self.tabProxy.event.on('tabCountChanged', (count) => { + if (!count) this.editor.displayEmptyReadOnlySession() + }) self.data = { _layout: { top: { diff --git a/src/app/panels/tab-proxy.js b/src/app/panels/tab-proxy.js index c58c73dc269..bc001102bd1 100644 --- a/src/app/panels/tab-proxy.js +++ b/src/app/panels/tab-proxy.js @@ -151,9 +151,11 @@ export class TabProxy { this._view.filetabs = yo`` this._view.filetabs.addEventListener('tabClosed', (event) => { if (this._handlers[event.detail]) this._handlers[event.detail].close() + this.event.emit('tabCountChanged', this._view.filetabs.tabs.length) }) this._view.filetabs.addEventListener('tabActivated', (event) => { if (this._handlers[event.detail]) this._handlers[event.detail].switchTo() + this.event.emit('tabCountChanged', this._view.filetabs.tabs.length) }) this._view.filetabs.canAdd = false