fix:锁定文件只读

This commit is contained in:
xiaozhu
2026-08-13 10:26:01 +08:00
parent 7b10f08484
commit a2f515cf87
5 changed files with 389 additions and 52 deletions
@@ -83,6 +83,9 @@ type State = {
loadingChildrenPaths: Set<string>;
loadedChildPaths: Set<string>;
// 只读内容刷新版本号(用于触发已打开标签页的内容刷新)
readOnlyRefreshVersion: number;
// actions
setApiOnline: (online: boolean) => void;
setKeyword: (keyword: string) => void;
@@ -111,6 +114,7 @@ type State = {
toggleScriptLock: (script: ScriptItem) => Promise<void>;
openPublishDialog: (script: ScriptItem) => void;
submitPublish: (releaseNote: string, visibility: Visibility) => Promise<void>;
refreshReadOnlyContent: () => void; // 刷新只读内容
// 生命周期 tick(由 layout 层 useEditSessionLifecycle 周期性调用)
tickHeartbeats: () => Promise<void>;
@@ -175,8 +179,11 @@ export const useScriptWorkspaceStore = create<State>((set, get) => {
loadingChildrenPaths: new Set<string>(),
loadedChildPaths: new Set<string>(),
readOnlyRefreshVersion: 0,
setApiOnline: (online) => set({ apiOnline: online }),
setKeyword: (keyword) => set({ keyword }),
refreshReadOnlyContent: () => set((state) => ({ readOnlyRefreshVersion: state.readOnlyRefreshVersion + 1 })),
reset: () => {
if (_previewController) {