mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-01-23 10:45:47 +00:00
feature(cloudcmd) add ability to remember position of current file on reload
This commit is contained in:
parent
63be7c8743
commit
98a9801644
1 changed files with 9 additions and 2 deletions
|
|
@ -249,14 +249,22 @@ function CloudCmdProto(DOM) {
|
|||
}
|
||||
};
|
||||
|
||||
async function saveCurrentName(currentName) {
|
||||
await Storage.set('current-name', currentName);
|
||||
}
|
||||
|
||||
async function baseInit() {
|
||||
const files = DOM.getFiles();
|
||||
|
||||
CloudCmd.on('current-file', DOM.updateCurrentInfo);
|
||||
CloudCmd.on('current-name', saveCurrentName);
|
||||
|
||||
const name = await Storage.get('current-name');
|
||||
const currentFile = name && DOM.getCurrentByName(name) || files[0];
|
||||
|
||||
/* выделяем строку с первым файлом */
|
||||
if (files)
|
||||
DOM.setCurrentFile(files[0], {
|
||||
DOM.setCurrentFile(currentFile, {
|
||||
// when hash is present
|
||||
// it should be handled with this.route
|
||||
// overwre otherwise
|
||||
|
|
@ -361,7 +369,6 @@ function CloudCmdProto(DOM) {
|
|||
if (!newObj)
|
||||
return;
|
||||
|
||||
/* eslint require-atomic-updates:0 */
|
||||
options.sort = sort;
|
||||
options.order = order;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue