From 61e8942a6b98dd9a2d5d384cb0b6d9cc75461975 Mon Sep 17 00:00:00 2001 From: KirCute <951206789@qq.com> Date: Sat, 6 Dec 2025 16:14:45 +0800 Subject: [PATCH] feat(archive): auto-locate destination to current path --- src/components/FolderTree.tsx | 11 ++++++++-- src/pages/home/toolbar/CopyMove.tsx | 8 ++++++-- src/pages/home/toolbar/Decompress.tsx | 26 +++++++++++++----------- src/pages/home/toolbar/RecursiveMove.tsx | 2 ++ 4 files changed, 31 insertions(+), 16 deletions(-) diff --git a/src/components/FolderTree.tsx b/src/components/FolderTree.tsx index ecb30cbc3..915605e65 100644 --- a/src/components/FolderTree.tsx +++ b/src/components/FolderTree.tsx @@ -340,7 +340,7 @@ export type ModalFolderChooseProps = { onClose: () => void onSubmit?: (text: string) => void type?: string - defaultValue?: string + defaultValue?: string | (() => string) loading?: boolean footerSlot?: JSXElement headerSlot?: (handler: FolderTreeHandler | undefined) => JSXElement @@ -349,12 +349,19 @@ export type ModalFolderChooseProps = { } export const ModalFolderChoose = (props: ModalFolderChooseProps) => { const t = useT() - const [value, setValue] = createSignal(props.defaultValue ?? "/") + const [value, setValue] = createSignal("/") const [handler, setHandler] = createSignal() createEffect(() => { if (!props.opened) return handler()?.setPath(value()) }) + if (typeof props.defaultValue === "function") { + createEffect(() => { + setValue((props.defaultValue as () => string)()) + }) + } else if (typeof props.defaultValue === "string") { + setValue(props.defaultValue) + } return ( { +export const CreateFolderButton = (props: { handler?: FolderTreeHandler }) => { + if (!UserMethods.can(me(), UserPermissions.indexOf("write"))) { + return null + } const t = useT() return (