fix(operation) next current file after delete

This commit is contained in:
coderaiser 2018-07-01 22:23:01 +03:00
parent ae468b4de5
commit aacb1af6b5

View file

@ -263,20 +263,18 @@ function deleteSilent(files = DOM.getActiveFiles()) {
const removedNames = DOM.getFilenames(files);
const names = DOM.CurrentInfo.files.map(DOM.getCurrentName);
const prevCurrent = DOM.getCurrentName();
const currentName = getNextCurrentName(prevCurrent, names, removedNames);
const currentName = DOM.getCurrentName();
const nextCurrentName = getNextCurrentName(currentName, names, removedNames);
deleteFn(path + query, removedNames, (e) => {
const Storage = DOM.Storage;
const dirPath = Info.dirPath;
DOM.setCurrentByName(prevCurrent);
!e && CloudCmd.refresh({
currentName
deleteFn(path + query, removedNames, () => {
CloudCmd.refresh(() => {
const names = Info.files.map(DOM.getCurrentName);
const isCurrent = names.includes(currentName);
let name = isCurrent ? currentName : nextCurrentName;
DOM.setCurrentByName(name);
});
Storage.removeMatch(dirPath);
});
}