mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-07-18 00:47:01 +00:00
33 lines
799 B
JavaScript
33 lines
799 B
JavaScript
/* global DOM */
|
|
export function selectFileNotParent(current, {getCurrentName, selectFile} = DOM) {
|
|
const name = getCurrentName(current);
|
|
|
|
if (name === '..')
|
|
return;
|
|
|
|
selectFile(current);
|
|
}
|
|
|
|
export const setCurrent = (sibling, {count, isVisual, isDelete}, {Info, setCurrentFile, unselectFiles, Operation}) => {
|
|
let current = Info.element;
|
|
const select = isVisual ? selectFileNotParent : unselectFiles;
|
|
|
|
select(current);
|
|
|
|
const position = `${sibling}Sibling`;
|
|
|
|
for (let i = 0; i < count; i++) {
|
|
const next = current[position];
|
|
|
|
if (!next)
|
|
break;
|
|
|
|
current = next;
|
|
select(current);
|
|
}
|
|
|
|
setCurrentFile(current);
|
|
|
|
if (isDelete)
|
|
Operation.show('delete');
|
|
};
|