fix: S1 安全冲刺——切库清空标签页+冲刷(FR-V6)、重命名/移动同步标签页路径(FR-T7)、默认库路径设置页(FR-V5);vaultBrowse IPC+pickDirectory;tab-store closeAll/renamePath;store resetEditor/syncCurrentPath;safety E2E 2 项
This commit is contained in:
@@ -27,6 +27,8 @@ interface EditorState {
|
||||
addLink: (link: string) => void;
|
||||
removeLink: (link: string) => void;
|
||||
saveNow: () => Promise<void>;
|
||||
resetEditor: () => void; // FR-V6: 切库时重置编辑区
|
||||
syncCurrentPath: (oldPath: string, newPath: string) => void; // FR-T7: 重命名/移动后同步当前文档路径
|
||||
}
|
||||
|
||||
// 简单的每文档保存队列(M1 单文档编辑)
|
||||
@@ -111,4 +113,13 @@ export const useStore = create<EditorState>((set, get) => ({
|
||||
console.error('save failed', e);
|
||||
}
|
||||
},
|
||||
|
||||
resetEditor: () => { set({ currentPath: null, title: '', body: '', meta: {}, saveState: 'saved' }); },
|
||||
|
||||
syncCurrentPath: (oldPath, newPath) => {
|
||||
const { currentPath } = get();
|
||||
if (!currentPath) return;
|
||||
if (currentPath === oldPath) { set({ currentPath: newPath }); return; }
|
||||
if (oldPath && currentPath.startsWith(oldPath + '/')) set({ currentPath: newPath + currentPath.slice(oldPath.length) });
|
||||
},
|
||||
}));
|
||||
Reference in New Issue
Block a user