Commit 21c0a8c
committed
fix(ui): resolve captured-selection rects against the routed editor (SD-2936)
The previous patch documented a body-only limitation; this is the
actual fix. getRects(capture) and getAnchorRect(options, capture) now
take both the host editor (for the presentation layer's getRangeRects)
and the routed editor (for resolveTextTarget against the captured
block ids).
For captures taken in a non-body story (header, footer, footnote,
endnote), the routed editor at call time owns the PM document those
block ids belong to. Resolving against it produces the right positions,
which then flow through presentationEditor.getRangeRects to land on
the right surface. The previous resolveHostEditor-only path resolved
non-body block ids against the body PM doc and silently returned [].
The remaining limitation: when focus has moved to a sidebar / composer
by call time, the routed editor falls back to the body and the
captured non-body block ids no longer resolve there. The function
returns [] gracefully in that case rather than misclassifying. Fully
cross-surface captures need a story-keyed editor lookup on
PresentationEditor that doesn't yet exist publicly — that's a
follow-up.1 parent 128495a commit 21c0a8c
4 files changed
Lines changed: 71 additions & 76 deletions
File tree
- packages/super-editor/src/ui
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1601 | 1601 | | |
1602 | 1602 | | |
1603 | 1603 | | |
1604 | | - | |
1605 | | - | |
1606 | | - | |
1607 | | - | |
1608 | | - | |
| 1604 | + | |
| 1605 | + | |
| 1606 | + | |
| 1607 | + | |
| 1608 | + | |
| 1609 | + | |
| 1610 | + | |
| 1611 | + | |
| 1612 | + | |
| 1613 | + | |
| 1614 | + | |
| 1615 | + | |
| 1616 | + | |
| 1617 | + | |
| 1618 | + | |
| 1619 | + | |
1609 | 1620 | | |
1610 | | - | |
1611 | | - | |
| 1621 | + | |
| 1622 | + | |
| 1623 | + | |
| 1624 | + | |
| 1625 | + | |
| 1626 | + | |
| 1627 | + | |
1612 | 1628 | | |
1613 | 1629 | | |
1614 | | - | |
| 1630 | + | |
| 1631 | + | |
1615 | 1632 | | |
1616 | | - | |
| 1633 | + | |
| 1634 | + | |
1617 | 1635 | | |
1618 | 1636 | | |
1619 | 1637 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
200 | 200 | | |
201 | 201 | | |
202 | 202 | | |
203 | | - | |
204 | | - | |
205 | | - | |
206 | | - | |
207 | | - | |
208 | | - | |
209 | | - | |
210 | | - | |
211 | | - | |
212 | | - | |
213 | | - | |
214 | | - | |
215 | | - | |
216 | | - | |
217 | | - | |
218 | | - | |
219 | | - | |
220 | | - | |
221 | | - | |
222 | | - | |
223 | | - | |
224 | | - | |
225 | | - | |
226 | | - | |
227 | 203 | | |
228 | 204 | | |
229 | 205 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
24 | | - | |
25 | | - | |
26 | | - | |
27 | | - | |
28 | | - | |
29 | | - | |
30 | | - | |
31 | | - | |
32 | | - | |
33 | | - | |
34 | | - | |
35 | | - | |
36 | | - | |
37 | | - | |
38 | | - | |
39 | | - | |
40 | | - | |
41 | | - | |
42 | | - | |
43 | | - | |
44 | | - | |
45 | | - | |
46 | 24 | | |
47 | 25 | | |
48 | 26 | | |
49 | 27 | | |
50 | 28 | | |
51 | 29 | | |
52 | | - | |
53 | | - | |
54 | | - | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
55 | 40 | | |
56 | | - | |
57 | | - | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
58 | 47 | | |
59 | 48 | | |
60 | 49 | | |
61 | | - | |
62 | | - | |
| 50 | + | |
63 | 51 | | |
64 | 52 | | |
65 | 53 | | |
| |||
76 | 64 | | |
77 | 65 | | |
78 | 66 | | |
79 | | - | |
| 67 | + | |
| 68 | + | |
80 | 69 | | |
81 | 70 | | |
82 | 71 | | |
83 | | - | |
| 72 | + | |
84 | 73 | | |
85 | 74 | | |
86 | 75 | | |
| |||
89 | 78 | | |
90 | 79 | | |
91 | 80 | | |
92 | | - | |
93 | | - | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
94 | 87 | | |
95 | 88 | | |
96 | 89 | | |
| |||
102 | 95 | | |
103 | 96 | | |
104 | 97 | | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
105 | 105 | | |
106 | 106 | | |
107 | 107 | | |
108 | | - | |
| 108 | + | |
109 | 109 | | |
110 | 110 | | |
111 | 111 | | |
112 | 112 | | |
113 | | - | |
| 113 | + | |
114 | 114 | | |
115 | 115 | | |
116 | 116 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
799 | 799 | | |
800 | 800 | | |
801 | 801 | | |
802 | | - | |
803 | | - | |
804 | | - | |
805 | | - | |
806 | | - | |
807 | | - | |
808 | | - | |
809 | | - | |
| 802 | + | |
| 803 | + | |
| 804 | + | |
| 805 | + | |
| 806 | + | |
| 807 | + | |
| 808 | + | |
| 809 | + | |
| 810 | + | |
810 | 811 | | |
811 | 812 | | |
812 | 813 | | |
| |||
0 commit comments