Commit 6cc8247
authored
feat: story-aware bookmark addressing (SD-2358) (#2971)
* feat(document-api): add story-aware bookmark contract
* feat(super-editor): add cross-story bookmark discovery helpers
* feat(super-editor): add story-aware bookmark wrappers
* feat(super-editor): support bookmark targets in navigateTo
* feat: export navigation address types from public APIs
* feat: expose SuperDoc navigateTo wrapper for presentation navigation
* test(behavior): cover bookmark navigation and header roundtrip flows
* fix(super-editor): use live note session editors for bookmark discovery
* fix(super-editor): normalize default header slot bookmark navigation
* fix(super-editor): use story revisions for story-scoped bookmark flows
* fix(super-editor): scope bookmark rename duplicate check by story key
The bookmarkExistsAnywhere exclusion previously matched on bookmarkId
alone, so renaming a bookmark could silently collide with a same-named
bookmark in another story whose id happened to match. Scope the
exclusion to (storyKey, bookmarkId) so cross-story id collisions no
longer mask real duplicate names.
* fix(super-editor): skip unresolved stories during bookmark listing
Document-wide bookmarksList iterates story keys discovered from the
bookmark index; if a story (e.g. a header/footer part) can't be
resolved at list time, resolveStoryRuntime throws STORY_NOT_FOUND and
the whole list call fails. Catch that specific error per-story and
return no items for it so a stale or missing part doesn't break
listing the rest of the document.
* fix(super-editor): prefer live header/footer sessions in bookmark discovery
* docs(document-api): clarify story-aware navigateTo support
* docs(document-api): clarify bookmark story resolution semantics
* fix(super-editor): align bookmark header activation with session API
* fix(super-editor): resolve unqualified bookmark mutations document-wide
* docs(document-api): narrow unqualified bookmark lookup semantics
* fix(super-editor): use aggregate revisions for document-wide bookmark reads
* fix(document-api): allow story on text target schema
* fix(super-editor): reject ambiguous unqualified bookmark mutations
When a bookmark rename or remove target omits `story` but the name exists
in multiple stories, throw INVALID_INPUT asking the caller to disambiguate
instead of silently picking the first match.
* fix(super-editor): reject ambiguous unqualified bookmark mutations
When a bookmark rename or remove target omits `story` but the name exists
in multiple stories, throw INVALID_INPUT asking the caller to disambiguate
instead of silently picking the first match.
* refactor(super-editor): extract header/footer variant normalization
Move normalizeVariant out of the doc-api adapter helper into a dedicated
module under presentation-editor/header-footer/, where its sole non-adapter
caller (HeaderFooterSessionManager) lives. The slot-materialization helper
re-exports it for existing import sites.
* test(super-editor): assert navigateTo returns false for missing bookmarks
* fix(super-editor): exit header surface when navigating to body bookmark
Calling navigateTo for a body-story bookmark while a header/footer surface
is active left the header editor focused, so the selection update was
applied to the wrong editor. Exit the active story surface before delegating
to goToAnchor so navigation lands on the body editor.
* fix(super-editor): scope bookmark discovery IDs by story key
Document-wide bookmark listings collide when the same name exists in
multiple stories (e.g. body and a header part). buildBookmarkDiscoveryItem
now accepts an optional idScope and URL-encodes each segment so each
story's bookmarks get distinct, stable IDs. bookmarksListWrapper passes
the story key through when iterating snapshots.
* fix(document-api): harden bookmark mutation revisions and id allocation1 parent 018ffb1 commit 6cc8247
28 files changed
Lines changed: 3532 additions & 164 deletions
File tree
- packages
- document-api/src
- bookmarks
- contract
- types
- super-editor/src
- editors/v1
- core/presentation-editor
- tests
- utils
- document-api-adapters
- __conformance__
- helpers
- plan-engine
- superdoc/src
- core
- types
- tests
- consumer-typecheck/src
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
| 23 | + | |
23 | 24 | | |
24 | 25 | | |
25 | 26 | | |
| |||
65 | 66 | | |
66 | 67 | | |
67 | 68 | | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
68 | 78 | | |
69 | 79 | | |
70 | 80 | | |
| |||
136 | 146 | | |
137 | 147 | | |
138 | 148 | | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
139 | 161 | | |
140 | 162 | | |
141 | 163 | | |
| |||
150 | 172 | | |
151 | 173 | | |
152 | 174 | | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
153 | 182 | | |
154 | 183 | | |
155 | 184 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| 5 | + | |
5 | 6 | | |
6 | 7 | | |
7 | 8 | | |
| |||
43 | 44 | | |
44 | 45 | | |
45 | 46 | | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
46 | 50 | | |
47 | 51 | | |
48 | 52 | | |
49 | 53 | | |
50 | 54 | | |
51 | 55 | | |
52 | 56 | | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
53 | 60 | | |
54 | 61 | | |
55 | 62 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
| 3 | + | |
3 | 4 | | |
4 | 5 | | |
5 | 6 | | |
| |||
11 | 12 | | |
12 | 13 | | |
13 | 14 | | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
14 | 27 | | |
15 | 28 | | |
16 | 29 | | |
| |||
20 | 33 | | |
21 | 34 | | |
22 | 35 | | |
| 36 | + | |
| 37 | + | |
23 | 38 | | |
24 | 39 | | |
25 | 40 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
145 | 145 | | |
146 | 146 | | |
147 | 147 | | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
148 | 168 | | |
149 | 169 | | |
150 | 170 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
231 | 231 | | |
232 | 232 | | |
233 | 233 | | |
| 234 | + | |
234 | 235 | | |
235 | 236 | | |
236 | 237 | | |
| |||
2520 | 2521 | | |
2521 | 2522 | | |
2522 | 2523 | | |
2523 | | - | |
| 2524 | + | |
2524 | 2525 | | |
2525 | 2526 | | |
2526 | | - | |
| 2527 | + | |
| 2528 | + | |
| 2529 | + | |
2527 | 2530 | | |
2528 | 2531 | | |
2529 | 2532 | | |
| |||
2567 | 2570 | | |
2568 | 2571 | | |
2569 | 2572 | | |
2570 | | - | |
| 2573 | + | |
| 2574 | + | |
| 2575 | + | |
| 2576 | + | |
| 2577 | + | |
| 2578 | + | |
2571 | 2579 | | |
2572 | 2580 | | |
2573 | 2581 | | |
| |||
6993 | 7001 | | |
6994 | 7002 | | |
6995 | 7003 | | |
6996 | | - | |
| 7004 | + | |
| 7005 | + | |
| 7006 | + | |
| 7007 | + | |
6997 | 7008 | | |
6998 | 7009 | | |
6999 | 7010 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
| 3 | + | |
3 | 4 | | |
4 | 5 | | |
5 | 6 | | |
| |||
118 | 119 | | |
119 | 120 | | |
120 | 121 | | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
121 | 128 | | |
122 | 129 | | |
123 | 130 | | |
| |||
145 | 152 | | |
146 | 153 | | |
147 | 154 | | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
148 | 159 | | |
149 | 160 | | |
150 | 161 | | |
| |||
156 | 167 | | |
157 | 168 | | |
158 | 169 | | |
159 | | - | |
160 | | - | |
161 | | - | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
162 | 178 | | |
163 | | - | |
| 179 | + | |
0 commit comments