fix: file lock

This commit is contained in:
tao.chen
2026-08-11 21:26:55 +08:00
parent d4013a07a9
commit dd6f176ca8
13 changed files with 345 additions and 97 deletions
@@ -13,6 +13,7 @@ type TreeContextMenuProps = {
contextMenu: ContextMenuState | null;
onOpenScript: (scriptId: string) => void;
onRemoveScript: (script: ScriptItem) => void;
onToggleLock: (script: ScriptItem) => void;
onOpenCreateDialog: (parentPath: string, scriptType: ScriptType) => void;
onOpenFolderDialog: (parentPath: string) => void;
onChooseUpload: (parentPath: string) => void;
@@ -24,6 +25,7 @@ export function TreeContextMenu({
contextMenu,
onOpenScript,
onRemoveScript,
onToggleLock,
onOpenCreateDialog,
onOpenFolderDialog,
onChooseUpload,
@@ -33,7 +35,7 @@ export function TreeContextMenu({
if (!contextMenu) return null;
const width = 188;
const height = contextMenu.kind === "file" ? 92 : 190;
const height = contextMenu.kind === "file" ? 124 : 190;
return (
<div
@@ -60,6 +62,17 @@ export function TreeContextMenu({
<Icon name="script" size={16} />
</button>
<button
type="button"
role="menuitem"
onClick={() => {
onToggleLock(contextMenu.script!);
onClose();
}}
>
<Icon name={contextMenu.script.is_locked ? "unlock" : "lock"} size={16} />
{contextMenu.script.is_locked ? "解锁文件" : "锁定文件"}
</button>
<button
className="is-danger"
type="button"