diff --git a/apps/files/js/dist/sidebar.js b/apps/files/js/dist/sidebar.js index ca27e1e896..c7e6e08b50 100644 Binary files a/apps/files/js/dist/sidebar.js and b/apps/files/js/dist/sidebar.js differ diff --git a/apps/files/js/dist/sidebar.js.map b/apps/files/js/dist/sidebar.js.map index c15c259d60..a595a32aba 100644 Binary files a/apps/files/js/dist/sidebar.js.map and b/apps/files/js/dist/sidebar.js.map differ diff --git a/apps/files/js/fileactions.js b/apps/files/js/fileactions.js index 571cdcf6c3..24f8279116 100644 --- a/apps/files/js/fileactions.js +++ b/apps/files/js/fileactions.js @@ -708,7 +708,7 @@ // close sidebar on delete const path = context.dir + '/' + fileName if (OCA.Files.Sidebar && OCA.Files.Sidebar.file === path) { - OCA.Files.Sidebar.file = undefined + OCA.Files.Sidebar.close() } } }); diff --git a/apps/files/js/filelist.js b/apps/files/js/filelist.js index 0424ba2006..d2a23283f1 100644 --- a/apps/files/js/filelist.js +++ b/apps/files/js/filelist.js @@ -613,7 +613,7 @@ console.warn('showDetailsView is deprecated! Use OCA.Files.Sidebar.activeTab. It will be removed in nextcloud 20.'); this._updateDetailsView(fileName); if (tabId) { - OCA.Files.Sidebar.activeTab = tabId; + OCA.Files.Sidebar.setActiveTab(tabId); } }, @@ -630,7 +630,7 @@ } if (!fileName) { - OCA.Files.Sidebar.file = null + OCA.Files.Sidebar.close() return } else if (typeof fileName !== 'string') { fileName = '' @@ -644,7 +644,7 @@ var path = model.attributes.path + '/' + model.attributes.name // open sidebar and set file - OCA.Files.Sidebar.file = path.replace('//', '/') + OCA.Files.Sidebar.open(path.replace('//', '/')) }, /** diff --git a/apps/files/src/services/Sidebar.js b/apps/files/src/services/Sidebar.js index 2bb836272f..f2a1f8f212 100644 --- a/apps/files/src/services/Sidebar.js +++ b/apps/files/src/services/Sidebar.js @@ -49,11 +49,10 @@ export default class Sidebar { } /** - * @memberof Sidebar * Register a new tab view * - * @param {Object} tab a new unregistered tab * @memberof Sidebar + * @param {Object} tab a new unregistered tab * @returns {Boolean} */ registerTab(tab) { @@ -77,32 +76,41 @@ export default class Sidebar { } /** - * Set the current sidebar file data + * Open the sidebar for the given file * - * @param {string} path the file path to load * @memberof Sidebar + * @param {string} path the file path to load */ - set file(path) { + open(path) { this.#state.file = path } /** - * Set the current sidebar file data + * Close the sidebar * - * @returns {String} the current opened file * @memberof Sidebar */ + close() { + this.#state.file = '' + } + + /** + * Return current opened file + * + * @memberof Sidebar + * @returns {String} the current opened file + */ get file() { return this.#state.file } /** - * Set the current sidebar tab + * Set the current visible sidebar tab * - * @param {string} id the tab unique id * @memberof Sidebar + * @param {string} id the tab unique id */ - set activeTab(id) { + setActiveTab(id) { this.#state.activeTab = id } diff --git a/apps/files/src/views/Sidebar.vue b/apps/files/src/views/Sidebar.vue index 02913d3687..47a2174b8c 100644 --- a/apps/files/src/views/Sidebar.vue +++ b/apps/files/src/views/Sidebar.vue @@ -261,7 +261,7 @@ export default { }, onClose() { this.resetData() - OCA.Files.Sidebar.file = '' + OCA.Files.Sidebar.close() }, resetData() { this.error = null @@ -297,7 +297,7 @@ export default { * @param {string} id tab unique id */ setActiveTab(id) { - OCA.Files.Sidebar.activeTab = id + OCA.Files.Sidebar.setActiveTab(id) }, /**