@danxbot/ui 6.4.4 → 6.4.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +1725 -1695
- package/dist/index.js.map +1 -1
- package/dist/types/lib/markdown/caret-map.d.ts +21 -0
- package/dist/types/lib/markdown/surface.d.ts +12 -0
- package/package.json +1 -1
|
@@ -46,3 +46,24 @@ export declare function graphemeBefore(map: CaretMap, offset: number): Span | nu
|
|
|
46
46
|
export declare function graphemeAfter(map: CaretMap, offset: number): Span | null;
|
|
47
47
|
/** The first legal offset on the line holding `offset` — where Home goes. */
|
|
48
48
|
export declare function lineStartStop(map: CaretMap, offset: number): number;
|
|
49
|
+
/**
|
|
50
|
+
* The last legal offset on the line holding `offset` — where End goes.
|
|
51
|
+
*
|
|
52
|
+
* SG-799 — NOT SAFE TO LEAVE TO THE BROWSER, the way `input.ts` leaves
|
|
53
|
+
* vertical movement and word-wise movement to it. A block's own leading
|
|
54
|
+
* markup (`# `, `- `, `> `) renders as `display: inline-block; width: 0`
|
|
55
|
+
* (`styles/markdown.css`'s "markup is collapsed at all times" rule) so it can
|
|
56
|
+
* be reached at all without ever having visible geometry — but a zero-size
|
|
57
|
+
* `inline-block` is an ATOMIC box for Chromium's own line-navigation, and a
|
|
58
|
+
* real Chromium probe caught it landing End's selection INSIDE that leading
|
|
59
|
+
* box (`("# ", offset 2)`, the same on-screen point as where the caret
|
|
60
|
+
* already stood) instead of at the true end of the visible text — every time,
|
|
61
|
+
* on every block with a leading marker, regardless of heading level and
|
|
62
|
+
* regardless of whether the line was the document's last one. Home already
|
|
63
|
+
* had the model-side half of this fix (`lineStartStop`, above) sitting
|
|
64
|
+
* unused — nothing in `input.ts` ever called it, so Home had the identical
|
|
65
|
+
* exposure and simply hadn't been caught yet. Both are now computed here and
|
|
66
|
+
* written directly, the same way `moveCaret` already computes ArrowLeft/Right
|
|
67
|
+
* instead of trusting the browser.
|
|
68
|
+
*/
|
|
69
|
+
export declare function lineEndStop(map: CaretMap, offset: number): number;
|
|
@@ -130,6 +130,18 @@ export declare class MarkdownSurface {
|
|
|
130
130
|
* source characters makes the caret appear to stall.
|
|
131
131
|
*/
|
|
132
132
|
moveCaret(direction: 1 | -1, extend: boolean): boolean;
|
|
133
|
+
/**
|
|
134
|
+
* Moves the caret to the start or end of its current line, in the model,
|
|
135
|
+
* and writes the result. Home and End both have to be computed here rather
|
|
136
|
+
* than left to the browser — SG-799 — because a block's leading markup
|
|
137
|
+
* renders as a zero-size `inline-block` (`styles/markdown.css`), which
|
|
138
|
+
* Chromium treats as an atomic box for its own native line navigation, and
|
|
139
|
+
* a real Chromium probe caught End landing the browser's OWN selection
|
|
140
|
+
* inside that leading box instead of at the true end of the line.
|
|
141
|
+
*
|
|
142
|
+
* Returns false when there is no selection to move, matching `moveCaret`.
|
|
143
|
+
*/
|
|
144
|
+
moveToLineEdge(edge: "start" | "end", extend: boolean): boolean;
|
|
133
145
|
/**
|
|
134
146
|
* Detects the third caret rule's failure: our own write left the browser's
|
|
135
147
|
* selection somewhere that is no longer a position in this document.
|