Use function to open a sidebar file
Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
This commit is contained in:
parent
d9204f61ea
commit
16e0887ec6
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -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()
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
|
@ -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('//', '/'))
|
||||
},
|
||||
|
||||
/**
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
||||
|
|
|
@ -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)
|
||||
},
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue