fix(editor): recover missing files and synchronize section toggle

This commit is contained in:
2026-09-06 13:29:19 +08:00
parent d4ba08b944
commit 750e17212e
8 changed files with 138 additions and 11 deletions
+8 -1
View File
@@ -161,7 +161,13 @@ export const useEditorStore = defineStore('editor', () => {
content.value = latest; diskContent = latest; saveStatus.value = 'saved'; contentRevision.value++
}
// TODO(editor): 桌面文件监听接入后提供冲突对比/合并界面,而非只阻止切换。
async function discardExternalChanges(path: string, snapshot: string): Promise<boolean> {
if (pendingSave) await pendingSave
if (currentFilePath.value !== path || content.value !== snapshot) return false
closeFile()
return true
}
function closeFile() {
loadVersion++
@@ -189,6 +195,7 @@ export const useEditorStore = defineStore('editor', () => {
contentRevision,
checkExternalFile,
reloadExternalFile,
discardExternalChanges,
saveStatus,
lastSavedAt,
currentNoteId,