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 searchableStatus = ref(false);
const searchablePath = ref(''); const searchablePath = ref('');
const searchableInputRefs = ref<Record<string, HTMLInputElement | null>>({}); const searchableInputRefs = ref<Record<string, HTMLInputElement | null>>({});
const setSearchableInputRef = (id: string, el: HTMLInputElement | null) => { const setSearchableInputRef = (id: string, el: HTMLInputElement | null) => {
if (el) { if (el) {
searchableInputRefs.value[id] = el; searchableInputRefs.value[id] = el;
nextTick(() => {
searchableInputRefs.value[id]?.focus();
});
} else { } else {
delete searchableInputRefs.value[id]; delete searchableInputRefs.value[id];
} }
@ -70,13 +72,6 @@ export function useMultipleSearchable(paths) {
watch(searchableStatus, (val) => { watch(searchableStatus, (val) => {
if (val) { if (val) {
searchablePath.value = paths.value.at(-1)?.url || ''; 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" /> <FileRename ref="renameRef" @close="search" />
<Upload ref="uploadRef" @close="search" /> <Upload ref="uploadRef" @close="search" />
<Wget ref="wgetRef" @close="closeWget" /> <Wget ref="wgetRef" @close="closeWget" />
<Move ref="moveRef" @close="closeMovePage" /> <Move ref="moveRef" @close="closeMovePage" @loading="onLoading" />
<Download ref="downloadRef" @close="search" /> <Download ref="downloadRef" @close="search" />
<Process ref="processRef" @close="closeProcess" /> <Process ref="processRef" @close="closeProcess" />
<Owner ref="chownRef" @close="search"></Owner> <Owner ref="chownRef" @close="search"></Owner>
@ -1417,6 +1417,10 @@ const openPaste = () => {
moveRef.value.acceptParams(fileMove); moveRef.value.acceptParams(fileMove);
}; };
function onLoading(isLoading: boolean) {
loading.value = isLoading;
}
const openDownload = (file: File.File) => { const openDownload = (file: File.File) => {
downloadFile(file.path, globalStore.currentNode); downloadFile(file.path, globalStore.currentNode);
}; };

View file

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