fix: Fix issues with pasting files not loading and file retrieval path cursor

This commit is contained in:
lan-yonghui 2025-08-29 15:12:35 +08:00
parent dcb004e983
commit bd766278ef
3 changed files with 12 additions and 10 deletions

View file

@ -58,10 +58,12 @@ export function useMultipleSearchable(paths) {
const searchableStatus = ref(false);
const searchablePath = ref('');
const searchableInputRefs = ref<Record<string, HTMLInputElement | null>>({});
const setSearchableInputRef = (id: string, el: HTMLInputElement | null) => {
if (el) {
searchableInputRefs.value[id] = el;
nextTick(() => {
searchableInputRefs.value[id]?.focus();
});
} else {
delete searchableInputRefs.value[id];
}
@ -70,13 +72,6 @@ export function useMultipleSearchable(paths) {
watch(searchableStatus, (val) => {
if (val) {
searchablePath.value = paths.value.at(-1)?.url || '';
nextTick(() => {
const keys = Object.keys(searchableInputRefs.value);
if (keys.length > 0) {
const lastKey = keys[keys.length - 1];
searchableInputRefs.value[lastKey]?.focus();
}
});
}
});

View file

@ -626,7 +626,7 @@
<FileRename ref="renameRef" @close="search" />
<Upload ref="uploadRef" @close="search" />
<Wget ref="wgetRef" @close="closeWget" />
<Move ref="moveRef" @close="closeMovePage" />
<Move ref="moveRef" @close="closeMovePage" @loading="onLoading" />
<Download ref="downloadRef" @close="search" />
<Process ref="processRef" @close="closeProcess" />
<Owner ref="chownRef" @close="search"></Owner>
@ -1417,6 +1417,10 @@ const openPaste = () => {
moveRef.value.acceptParams(fileMove);
};
function onLoading(isLoading: boolean) {
loading.value = isLoading;
}
const openDownload = (file: File.File) => {
downloadFile(file.path, globalStore.currentNode);
};

View file

@ -121,7 +121,7 @@ const rules = reactive<FormRules>({
name: [Rules.requiredInput],
});
const em = defineEmits(['close']);
const em = defineEmits(['close', 'loading']);
const handleClose = (search: boolean) => {
open.value = false;
@ -169,6 +169,8 @@ const changeType = () => {
};
const mvFile = () => {
loading.value = true;
em('loading', true);
moveFile(addForm)
.then(() => {
if (type.value === 'cut') {
@ -180,6 +182,7 @@ const mvFile = () => {
})
.finally(() => {
loading.value = false;
em('loading', false);
});
};