fix: protect editor saves and clear failed restored tab state

This commit is contained in:
2026-11-05 21:38:35 +08:00
parent a3bef33988
commit 0e072eed3b
7 changed files with 192 additions and 22 deletions
+3 -3
View File
@@ -8,7 +8,7 @@ from enum import Enum
from pathlib import Path
from typing import Callable, Protocol
from .file_versions import VersionStore
from .file_versions import VersionStore, _UNCHECKED
FileSignature = tuple[int, int] | None
DRAFTS_KEY = "editor/drafts"
@@ -46,8 +46,8 @@ class DocumentStore:
return relocate_images(source, original, target)
@staticmethod
def save(path: Path, source: str) -> None:
VersionStore().save(path, source)
def save(path: Path, source: str, *, expected=_UNCHECKED) -> None:
VersionStore().save(path, source, expected=expected)
class DraftStore: