feat(storage): PDF editor persists to per-file sidecar
Some checks failed
CI / Windows build (push) Has been cancelled

Phase 2 (core swap). The PDF editor and split-view scratchpad stop
writing SQLite and persist to a per-file sidecar
`<pdfPath>.badnote.json` (debounced, atomic temp+rename+.bak) — so
annotations travel with the file. The source path is the identity
(no more djb2 doc-id).

- SidecarRepository wraps the Phase-1 store with debounced autosave.
- pen_editor: per-page ink, scratch-links AND highlights now persist
  to the sidecar and restore on reopen (closes persist-highlights).
- New "un-highlight" tool: tap a stored highlight to remove it — the
  highlight could not be removed before.
- split_view: each anchor's scratchpad lives in the sidecar's
  scratchLinks[id].scratchpad, keyed by anchor id.

Note: pre-existing SQLite annotations are migrated later (Phase 5);
note/slide editors swap in Phase 4. analyze clean, tests green.
This commit is contained in:
2026-06-24 21:03:28 +08:00
parent 953c7b700f
commit 978111eeff
9 changed files with 647 additions and 112 deletions

View File

@@ -71,6 +71,7 @@
"nextPage": "Next page",
"toolSelectText": "Select text",
"actionHighlightSelection": "Highlight selection",
"toolRemoveHighlight": "Remove highlight (tap a highlight)",
"toolPlaceScratchLink": "Place scratch link",
"scratchLinkDeleteTitle": "Delete scratch link?",
"scratchLinkDeleteBody": "This removes the anchor and its private scratchpad.",

View File

@@ -470,6 +470,12 @@ abstract class AppLocalizations {
/// **'Highlight selection'**
String get actionHighlightSelection;
/// No description provided for @toolRemoveHighlight.
///
/// In en, this message translates to:
/// **'Remove highlight (tap a highlight)'**
String get toolRemoveHighlight;
/// No description provided for @toolPlaceScratchLink.
///
/// In en, this message translates to:

View File

@@ -200,6 +200,9 @@ class AppLocalizationsEn extends AppLocalizations {
@override
String get actionHighlightSelection => 'Highlight selection';
@override
String get toolRemoveHighlight => 'Remove highlight (tap a highlight)';
@override
String get toolPlaceScratchLink => 'Place scratch link';

View File

@@ -200,6 +200,9 @@ class AppLocalizationsZh extends AppLocalizations {
@override
String get actionHighlightSelection => '高亮所选';
@override
String get toolRemoveHighlight => '移除高亮(点按高亮处)';
@override
String get toolPlaceScratchLink => '放置便签链接';

View File

@@ -62,6 +62,7 @@
"nextPage": "下一页",
"toolSelectText": "选择文字",
"actionHighlightSelection": "高亮所选",
"toolRemoveHighlight": "移除高亮(点按高亮处)",
"toolPlaceScratchLink": "放置便签链接",
"scratchLinkDeleteTitle": "删除便签链接?",
"scratchLinkDeleteBody": "这会移除锚点及其专属草稿纸。",