@liminis/editor 0.1.0-rc.1
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/LICENSE +34 -0
- package/README.md +376 -0
- package/dist/annotations/anchor-align.d.ts +50 -0
- package/dist/annotations/anchor-align.js +74 -0
- package/dist/annotations/anchor-model.d.ts +81 -0
- package/dist/annotations/anchor-model.js +80 -0
- package/dist/annotations/anchor-resolver.d.ts +92 -0
- package/dist/annotations/anchor-resolver.js +231 -0
- package/dist/annotations/block-structure.d.ts +65 -0
- package/dist/annotations/block-structure.js +113 -0
- package/dist/annotations/types.d.ts +159 -0
- package/dist/annotations/types.js +50 -0
- package/dist/annotations.d.ts +25 -0
- package/dist/annotations.js +27 -0
- package/dist/app/App.d.ts +64 -0
- package/dist/app/App.js +180 -0
- package/dist/app/editor/AmbientCorrectionPlugin.d.ts +18 -0
- package/dist/app/editor/AmbientCorrectionPlugin.js +185 -0
- package/dist/app/editor/AnchorScrollPlugin.d.ts +16 -0
- package/dist/app/editor/AnchorScrollPlugin.js +134 -0
- package/dist/app/editor/AnnotationMarkerPlugin.d.ts +24 -0
- package/dist/app/editor/AnnotationMarkerPlugin.js +224 -0
- package/dist/app/editor/AnnotationPlugin.d.ts +42 -0
- package/dist/app/editor/AnnotationPlugin.js +135 -0
- package/dist/app/editor/AnnotationSurface.d.ts +34 -0
- package/dist/app/editor/AnnotationSurface.js +115 -0
- package/dist/app/editor/AssetContext.d.ts +20 -0
- package/dist/app/editor/AssetContext.js +81 -0
- package/dist/app/editor/BlockClickPlugin.d.ts +8 -0
- package/dist/app/editor/BlockClickPlugin.js +126 -0
- package/dist/app/editor/CodeBlockPlugin.d.ts +1 -0
- package/dist/app/editor/CodeBlockPlugin.js +219 -0
- package/dist/app/editor/CorrectionPanelPlugin.d.ts +14 -0
- package/dist/app/editor/CorrectionPanelPlugin.js +333 -0
- package/dist/app/editor/DragHandlePlugin.d.ts +1 -0
- package/dist/app/editor/DragHandlePlugin.js +300 -0
- package/dist/app/editor/Editor.d.ts +84 -0
- package/dist/app/editor/Editor.js +539 -0
- package/dist/app/editor/FrontmatterPlugin.d.ts +19 -0
- package/dist/app/editor/FrontmatterPlugin.js +301 -0
- package/dist/app/editor/ImageModal.d.ts +13 -0
- package/dist/app/editor/ImageModal.js +267 -0
- package/dist/app/editor/ImagePlugin.d.ts +3 -0
- package/dist/app/editor/ImagePlugin.js +187 -0
- package/dist/app/editor/LinkClickPlugin.d.ts +23 -0
- package/dist/app/editor/LinkClickPlugin.js +90 -0
- package/dist/app/editor/MarkdownShortcutsPlugin.d.ts +49 -0
- package/dist/app/editor/MarkdownShortcutsPlugin.js +373 -0
- package/dist/app/editor/OrderedTaskListPlugin.d.ts +21 -0
- package/dist/app/editor/OrderedTaskListPlugin.js +78 -0
- package/dist/app/editor/SearchPlugin.d.ts +1 -0
- package/dist/app/editor/SearchPlugin.js +379 -0
- package/dist/app/editor/SelectionContextMenuPlugin.d.ts +29 -0
- package/dist/app/editor/SelectionContextMenuPlugin.js +160 -0
- package/dist/app/editor/SlashMenu.d.ts +11 -0
- package/dist/app/editor/SlashMenu.js +494 -0
- package/dist/app/editor/SlashMenuPlugin.d.ts +1 -0
- package/dist/app/editor/SlashMenuPlugin.js +168 -0
- package/dist/app/editor/TableActionsPlugin.d.ts +1 -0
- package/dist/app/editor/TableActionsPlugin.js +398 -0
- package/dist/app/editor/TogglePlugin.d.ts +1 -0
- package/dist/app/editor/TogglePlugin.js +159 -0
- package/dist/app/editor/Toolbar.d.ts +10 -0
- package/dist/app/editor/Toolbar.js +263 -0
- package/dist/app/editor/WikiLinkExistencePlugin.d.ts +17 -0
- package/dist/app/editor/WikiLinkExistencePlugin.js +104 -0
- package/dist/app/editor/WikiLinkFormatPlugin.d.ts +17 -0
- package/dist/app/editor/WikiLinkFormatPlugin.js +203 -0
- package/dist/app/editor/annotation-marks.d.ts +177 -0
- package/dist/app/editor/annotation-marks.js +750 -0
- package/dist/app/editor/annotationCommands.d.ts +13 -0
- package/dist/app/editor/annotationCommands.js +11 -0
- package/dist/app/editor/c4/C4InteractiveRenderer.d.ts +35 -0
- package/dist/app/editor/c4/C4InteractiveRenderer.js +299 -0
- package/dist/app/editor/c4/edge-clipping.d.ts +24 -0
- package/dist/app/editor/c4/edge-clipping.js +139 -0
- package/dist/app/editor/c4/hooks/useC4DiagramDrag.d.ts +38 -0
- package/dist/app/editor/c4/hooks/useC4DiagramDrag.js +112 -0
- package/dist/app/editor/c4/layout.d.ts +25 -0
- package/dist/app/editor/c4/layout.js +839 -0
- package/dist/app/editor/c4/parser.d.ts +19 -0
- package/dist/app/editor/c4/parser.js +410 -0
- package/dist/app/editor/c4/render-to-string.d.ts +24 -0
- package/dist/app/editor/c4/render-to-string.js +34 -0
- package/dist/app/editor/c4/renderer.d.ts +64 -0
- package/dist/app/editor/c4/renderer.js +569 -0
- package/dist/app/editor/c4/types.d.ts +203 -0
- package/dist/app/editor/c4/types.js +43 -0
- package/dist/app/editor/correction-yaml.d.ts +10 -0
- package/dist/app/editor/correction-yaml.js +40 -0
- package/dist/app/editor/editorNodes.d.ts +9 -0
- package/dist/app/editor/editorNodes.js +36 -0
- package/dist/app/editor/index.d.ts +1 -0
- package/dist/app/editor/index.js +1 -0
- package/dist/app/editor/mark-overlap-resolver.d.ts +6 -0
- package/dist/app/editor/mark-overlap-resolver.js +45 -0
- package/dist/app/editor/nodes/C4Component.d.ts +14 -0
- package/dist/app/editor/nodes/C4Component.js +284 -0
- package/dist/app/editor/nodes/C4Node.d.ts +32 -0
- package/dist/app/editor/nodes/C4Node.js +112 -0
- package/dist/app/editor/nodes/CalloutNode.d.ts +23 -0
- package/dist/app/editor/nodes/CalloutNode.js +94 -0
- package/dist/app/editor/nodes/CustomLinkNode.d.ts +57 -0
- package/dist/app/editor/nodes/CustomLinkNode.js +209 -0
- package/dist/app/editor/nodes/CustomListItemNode.d.ts +46 -0
- package/dist/app/editor/nodes/CustomListItemNode.js +120 -0
- package/dist/app/editor/nodes/CustomListNode.d.ts +27 -0
- package/dist/app/editor/nodes/CustomListNode.js +54 -0
- package/dist/app/editor/nodes/DefinitionListNode.d.ts +44 -0
- package/dist/app/editor/nodes/DefinitionListNode.js +151 -0
- package/dist/app/editor/nodes/DiagramContextMenu.d.ts +45 -0
- package/dist/app/editor/nodes/DiagramContextMenu.js +116 -0
- package/dist/app/editor/nodes/EquationComponent.d.ts +17 -0
- package/dist/app/editor/nodes/EquationComponent.js +130 -0
- package/dist/app/editor/nodes/EquationNode.d.ts +43 -0
- package/dist/app/editor/nodes/EquationNode.js +179 -0
- package/dist/app/editor/nodes/FootnoteNode.d.ts +40 -0
- package/dist/app/editor/nodes/FootnoteNode.js +151 -0
- package/dist/app/editor/nodes/FrontmatterNode.d.ts +24 -0
- package/dist/app/editor/nodes/FrontmatterNode.js +88 -0
- package/dist/app/editor/nodes/HorizontalRuleNode.d.ts +17 -0
- package/dist/app/editor/nodes/HorizontalRuleNode.js +57 -0
- package/dist/app/editor/nodes/HtmlNode.d.ts +32 -0
- package/dist/app/editor/nodes/HtmlNode.js +121 -0
- package/dist/app/editor/nodes/ImageComponent.d.ts +11 -0
- package/dist/app/editor/nodes/ImageComponent.js +228 -0
- package/dist/app/editor/nodes/ImageNode.d.ts +53 -0
- package/dist/app/editor/nodes/ImageNode.js +183 -0
- package/dist/app/editor/nodes/ListItemParagraphBreakNode.d.ts +42 -0
- package/dist/app/editor/nodes/ListItemParagraphBreakNode.js +95 -0
- package/dist/app/editor/nodes/MermaidComponent.d.ts +11 -0
- package/dist/app/editor/nodes/MermaidComponent.js +216 -0
- package/dist/app/editor/nodes/MermaidNode.d.ts +27 -0
- package/dist/app/editor/nodes/MermaidNode.js +96 -0
- package/dist/app/editor/nodes/ToggleNode.d.ts +56 -0
- package/dist/app/editor/nodes/ToggleNode.js +237 -0
- package/dist/app/editor/nodes/diagram-context-menu.d.ts +11 -0
- package/dist/app/editor/nodes/diagram-context-menu.js +70 -0
- package/dist/app/editor/nodes/diagram-utils.d.ts +13 -0
- package/dist/app/editor/nodes/diagram-utils.js +29 -0
- package/dist/app/editor/nodes/index.d.ts +30 -0
- package/dist/app/editor/nodes/index.js +17 -0
- package/dist/app/editor/utils.d.ts +2 -0
- package/dist/app/editor/utils.js +17 -0
- package/dist/app/mapper/index.d.ts +3 -0
- package/dist/app/mapper/index.js +2 -0
- package/dist/app/mapper/lexicalToMdast.d.ts +62 -0
- package/dist/app/mapper/lexicalToMdast.js +1937 -0
- package/dist/app/mapper/mdastToLexical.d.ts +31 -0
- package/dist/app/mapper/mdastToLexical.js +1075 -0
- package/dist/contract.d.ts +8 -0
- package/dist/contract.js +8 -0
- package/dist/headless.d.ts +40 -0
- package/dist/headless.js +45 -0
- package/dist/host/context.d.ts +20 -0
- package/dist/host/context.js +24 -0
- package/dist/host/defaults.d.ts +21 -0
- package/dist/host/defaults.js +47 -0
- package/dist/host/messages.d.ts +26 -0
- package/dist/host/messages.js +47 -0
- package/dist/host/types.d.ts +75 -0
- package/dist/host/types.js +13 -0
- package/dist/index.d.ts +35 -0
- package/dist/index.js +51 -0
- package/dist/markdown/annotate-sentinels.d.ts +42 -0
- package/dist/markdown/annotate-sentinels.js +86 -0
- package/dist/markdown/parse.d.ts +56 -0
- package/dist/markdown/parse.js +516 -0
- package/dist/markdown/stringify.d.ts +7 -0
- package/dist/markdown/stringify.js +439 -0
- package/dist/markdown/vendor/mdast-util-wiki-link/LICENSE +21 -0
- package/dist/markdown/vendor/mdast-util-wiki-link/README.md +41 -0
- package/dist/markdown/vendor/mdast-util-wiki-link/from-markdown.d.ts +72 -0
- package/dist/markdown/vendor/mdast-util-wiki-link/from-markdown.js +127 -0
- package/dist/markdown/vendor/mdast-util-wiki-link/index.d.ts +8 -0
- package/dist/markdown/vendor/mdast-util-wiki-link/index.js +6 -0
- package/dist/markdown/vendor/mdast-util-wiki-link/to-markdown.d.ts +17 -0
- package/dist/markdown/vendor/mdast-util-wiki-link/to-markdown.js +33 -0
- package/dist/markdown.d.ts +28 -0
- package/dist/markdown.js +44 -0
- package/dist/mathjax-config.d.ts +89 -0
- package/dist/mathjax-config.js +133 -0
- package/dist/nodes.d.ts +34 -0
- package/dist/nodes.js +34 -0
- package/dist/stores/correctionStore.d.ts +15 -0
- package/dist/stores/correctionStore.js +12 -0
- package/dist/stores/editorStore.d.ts +16 -0
- package/dist/stores/editorStore.js +27 -0
- package/dist/styles.css +2477 -0
- package/dist/types.d.ts +296 -0
- package/dist/types.js +91 -0
- package/dist/utils/file-types.d.ts +10 -0
- package/dist/utils/file-types.js +46 -0
- package/docs/annotations.md +134 -0
- package/docs/decisions/README.md +72 -0
- package/docs/decisions/adr-002.md +27 -0
- package/docs/decisions/adr-007.md +27 -0
- package/docs/decisions/adr-010.md +26 -0
- package/docs/decisions/adr-024.md +124 -0
- package/docs/decisions/adr-024b.md +0 -0
- package/docs/decisions/adr-025.md +103 -0
- package/docs/decisions/adr-027.md +66 -0
- package/docs/decisions/adr-057.md +67 -0
- package/docs/decisions/adr-070.md +131 -0
- package/docs/decisions/adr-075.md +410 -0
- package/docs/decisions/adr-076.md +183 -0
- package/docs/decisions/adr-077.md +410 -0
- package/docs/decisions/adr-078.md +243 -0
- package/docs/decisions/adr-079.md +167 -0
- package/docs/decisions/adr-080.md +325 -0
- package/docs/decisions/adr-081.md +108 -0
- package/docs/decisions/adr-082.md +123 -0
- package/docs/decisions/adr-083.md +204 -0
- package/docs/decisions/adr-084.md +179 -0
- package/docs/editor-api.md +106 -0
- package/docs/markdown-pipeline.md +282 -0
- package/docs/provenance.md +106 -0
- package/docs/zusammen-editor-capability-map.md +232 -0
- package/package.json +175 -0
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* PROVENANCE — ported from Zusammen (`verveguy/zusammen`) for Liminis #939.
|
|
3
|
+
*
|
|
4
|
+
* The doc comments below are the original author's and are kept verbatim so
|
|
5
|
+
* this module stays diffable against its source. Their `FR-NNN`/`SC-NNN`
|
|
6
|
+
* identifiers, `#NN` issue references and `adrs/` paths therefore name
|
|
7
|
+
* **Zusammen's** spec, issues and ADRs — not this repository's, where the same
|
|
8
|
+
* identifiers mean something else entirely. For the Liminis-side design see
|
|
9
|
+
* `docs/decisions/adr-077.md` and
|
|
10
|
+
* `docs/zusammen-editor-capability-map.md`.
|
|
11
|
+
*
|
|
12
|
+
* "Comment"/"thread" in these comments should be read as "annotation": this
|
|
13
|
+
* module now serves both annotation kinds, not comments alone.
|
|
14
|
+
*/
|
|
15
|
+
/**
|
|
16
|
+
* Comment Anchor Marks (#43)
|
|
17
|
+
*
|
|
18
|
+
* Replaces `comment-anchor-mapping.ts`'s ordinal-block-index glue with a live
|
|
19
|
+
* `@lexical/mark` `MarkNode` per annotation id — the anchor moves with
|
|
20
|
+
* its text across in-app edits for free (Lexical splits/merges nodes around
|
|
21
|
+
* it), and serializes to nothing (see `lexicalToMdast.ts`'s
|
|
22
|
+
* `effectiveChildren`), so it never touches document content — an annotation is
|
|
23
|
+
* editor state, never bytes on disk.
|
|
24
|
+
*
|
|
25
|
+
* Two directions, both content-based rather than block-ordinal-based:
|
|
26
|
+
*
|
|
27
|
+
* - **Write** (capture, FR-006 re-anchor): a mark's own live plain text is
|
|
28
|
+
* *not* generally a verbatim substring of the document's current raw
|
|
29
|
+
* markdown — once the target contains or abuts bold/italic/inline-code/
|
|
30
|
+
* link syntax, the rendered text and the markdown diverge (#47 fixes the
|
|
31
|
+
* defect this caused: comments on formatted text spuriously flagging as
|
|
32
|
+
* changed on a completely unchanged document; see the corrected premise
|
|
33
|
+
* noted in `adrs/012-comment-anchor-as-live-mark.md`). Instead, a mark's
|
|
34
|
+
* raw-markdown range is recovered via {@link locateLiveMarkdownRange}'s
|
|
35
|
+
* annotated-serialize mechanism. A multi-block annotation shares one id
|
|
36
|
+
* across several sibling `MarkNode`s (the Lexical playground's own
|
|
37
|
+
* pattern); each is independently located, and the comment's overall
|
|
38
|
+
* range is the span from the first mark's start to the last mark's end —
|
|
39
|
+
* recovering exactly what
|
|
40
|
+
* {@link import('../../../shared/anchor-model').captureAnchor} would slice
|
|
41
|
+
* for a single-block annotation, and the same *kind* of raw-markdown slice
|
|
42
|
+
* (including whatever lies between the marks) for a multi-block one.
|
|
43
|
+
* - **Read** (load-time placement): an anchor's `targetText` is already the
|
|
44
|
+
* resolver's exact/resolved current text (main-process
|
|
45
|
+
* `resolveAnchorsForDocument` runs before marker targets ever reach the
|
|
46
|
+
* editor) — locate it once in the raw markdown via `locateInSpan`, map
|
|
47
|
+
* that offset range onto Lexical nodes via the parse-time `OffsetSpan[]`
|
|
48
|
+
* (boundary-snapping past any formatting-delimiter gap the target's edge
|
|
49
|
+
* falls on, #47), and wrap. No client-side fuzzy matching.
|
|
50
|
+
*/
|
|
51
|
+
import { type LexicalEditor } from 'lexical';
|
|
52
|
+
import { type Anchor, type AnchorFields, type AnchorRange } from '../../annotations/anchor-model.js';
|
|
53
|
+
import type { OffsetSpan } from '../mapper/mdastToLexical.js';
|
|
54
|
+
import { type ExportOptions } from '../mapper/lexicalToMdast.js';
|
|
55
|
+
/**
|
|
56
|
+
* Wrap a native DOM Range in a `MarkNode` keyed by `id`. Fire-and-forget: the
|
|
57
|
+
* Lexical update runs the wrap, but its commit isn't observable synchronously
|
|
58
|
+
* (in controlled mode the callback runs on a later tick), so callers must NOT
|
|
59
|
+
* gate anything on a return value here — the anchor is read back from the live
|
|
60
|
+
* mark later via {@link readAnchorFields}.
|
|
61
|
+
*/
|
|
62
|
+
export declare function wrapNativeRangeInMark(editor: LexicalEditor, range: Range, id: string): void;
|
|
63
|
+
/**
|
|
64
|
+
* Read an annotation's anchor fields directly from its live `MarkNode`(s) in the
|
|
65
|
+
* Lexical tree — targetText, surrounding context, block type, and an
|
|
66
|
+
* occurrence hint. The mark *is* the anchor; its position is known precisely
|
|
67
|
+
* from the node structure, so capture never depends on a (possibly stale)
|
|
68
|
+
* serialized-markdown string held elsewhere (`currentContentRef`) — this
|
|
69
|
+
* function derives its own current markdown export fresh, every call. The
|
|
70
|
+
* store stamps `docVersion`; the resolver (#25) still re-locates by content
|
|
71
|
+
* on future document versions.
|
|
72
|
+
*
|
|
73
|
+
* #47: targetText (and the context/blockType/occurrenceIndex derived from
|
|
74
|
+
* it) is a raw-*markdown* slice, not the mark's rendered plain text — see
|
|
75
|
+
* {@link locateLiveMarkdownRange}. Once the mark's exact raw-markdown range
|
|
76
|
+
* is known, {@link captureAnchor} (already markdown-domain-correct, and
|
|
77
|
+
* already used by the FR-006 re-anchor path) does the rest.
|
|
78
|
+
*/
|
|
79
|
+
export declare function readAnchorFields(editor: LexicalEditor, id: string, exportOptions?: ExportOptions): AnchorFields | null;
|
|
80
|
+
/**
|
|
81
|
+
* Read pathway: places a `MarkNode` for `anchor` by locating its (already
|
|
82
|
+
* resolved/current) `targetText` in `markdownText` and mapping the located
|
|
83
|
+
* offset range onto Lexical nodes via `offsetSpans` (the parse-time
|
|
84
|
+
* offset->node table from `importMarkdownToLexicalWithOffsets`). Idempotent:
|
|
85
|
+
* a no-op if `id` already has a live mark. Returns whether a mark now
|
|
86
|
+
* exists for `id` (already present, or just placed) — false only when the
|
|
87
|
+
* anchor's target can't be located or mapped, in which case the comment
|
|
88
|
+
* stays panel-only (FR-008), never placed on unrelated text.
|
|
89
|
+
*/
|
|
90
|
+
export declare function placeMarkForAnchor(editor: LexicalEditor, offsetSpans: readonly OffsetSpan[], markdownText: string, anchor: Anchor, id: string): boolean;
|
|
91
|
+
/**
|
|
92
|
+
* Places many anchors inside a *single* `editor.update()`.
|
|
93
|
+
*
|
|
94
|
+
* Same per-anchor logic as {@link placeMarkForAnchor}, but one Lexical
|
|
95
|
+
* reconciliation for the whole batch instead of one per annotation — a
|
|
96
|
+
* document with dozens of live annotations otherwise pays a synchronous
|
|
97
|
+
* reconcile each, every time a re-parse invalidates the offset table (review
|
|
98
|
+
* finding, @handarbeit-pruefer). Returns the ids that now have a live mark, in
|
|
99
|
+
* the caller's own order.
|
|
100
|
+
*
|
|
101
|
+
* **Two phases, because `offsetSpans` describes only the pristine parse.**
|
|
102
|
+
* Placing a mark splits the `TextNode` it lands in, and Lexical's `splitText`
|
|
103
|
+
* keeps the original key on the *first* segment — so after one placement the
|
|
104
|
+
* table's `(nodeKey, offset)` pairs can point past the end of what that key now
|
|
105
|
+
* holds, and the guards below decline. An earlier fix ordered the batch back to
|
|
106
|
+
* front, which keeps every *disjoint* entry's span valid but does nothing for
|
|
107
|
+
* ranges that overlap, nest or coincide: there the later placement splits a node
|
|
108
|
+
* an *earlier* entry still needs, and that entry silently declines (Liminis
|
|
109
|
+
* #970 — an ordinary pair of overlapping annotations placed only one mark).
|
|
110
|
+
*
|
|
111
|
+
* The fix is to stop depending on the table surviving at all. Marking changes
|
|
112
|
+
* no text, so a point's *absolute* character offset across every text node in
|
|
113
|
+
* the document is invariant under placement — the same invariant
|
|
114
|
+
* {@link $withPreservedSelection} already relies on to put the caret back.
|
|
115
|
+
* So:
|
|
116
|
+
*
|
|
117
|
+
* 1. **Resolve**, against the pristine tree, before anything is mutated: run
|
|
118
|
+
* every entry through the offset table and today's decline guards, and
|
|
119
|
+
* convert each surviving endpoint to an absolute text offset.
|
|
120
|
+
* 2. **Place**, in the caller's order: re-resolve each absolute offset against
|
|
121
|
+
* the *current* tree and wrap.
|
|
122
|
+
*
|
|
123
|
+
* Every entry is therefore independent of every other, so the set of ids placed
|
|
124
|
+
* no longer depends on the order they were supplied in and the back-to-front
|
|
125
|
+
* sort is gone. Both phases run inside the one `editor.update()`.
|
|
126
|
+
*/
|
|
127
|
+
export declare function placeMarksForAnchors(editor: LexicalEditor, offsetSpans: readonly OffsetSpan[], markdownText: string, entries: readonly {
|
|
128
|
+
anchor: Anchor;
|
|
129
|
+
id: string;
|
|
130
|
+
}[]): string[];
|
|
131
|
+
/**
|
|
132
|
+
* FR-006: the current live range of every comment with a mark in the
|
|
133
|
+
* document, keyed by comment id — used at checkpoint time to decide which
|
|
134
|
+
* comments' anchors actually need re-recording (only those whose current
|
|
135
|
+
* range's text differs from their last durable `anchor.targetText`).
|
|
136
|
+
* Comments with no live mark (orphaned, flagged, or not yet resolved into
|
|
137
|
+
* the open document) are simply absent from the returned map.
|
|
138
|
+
*/
|
|
139
|
+
export declare function collectLiveAnchorSnapshots(editor: LexicalEditor, markdownText: string, exportOptions?: ExportOptions): Map<string, AnchorRange>;
|
|
140
|
+
/** Whether `id` currently has a live mark anywhere in the document. */
|
|
141
|
+
export declare function hasLiveMark(editor: LexicalEditor, id: string): boolean;
|
|
142
|
+
/**
|
|
143
|
+
* The real, rendered DOM elements for every live `MarkNode` wrapping `id`,
|
|
144
|
+
* in document order — for `CommentMarkerPlugin` to decorate directly
|
|
145
|
+
* (outcome/active class, click/keydown navigation) instead of computing a
|
|
146
|
+
* synthetic overlay. Empty when `id` has no live mark (e.g. a `flagged`
|
|
147
|
+
* target, which never gets one placed — see `placeMarkForAnchor` callers).
|
|
148
|
+
*/
|
|
149
|
+
export declare function markElementsForId(editor: LexicalEditor, id: string): HTMLElement[];
|
|
150
|
+
/**
|
|
151
|
+
* {@link markElementsForId} for many ids at once, in one tree walk.
|
|
152
|
+
*
|
|
153
|
+
* The marker plugin re-decorates on every editor update, and calling the
|
|
154
|
+
* single-id form per annotation makes that O(annotations x nodes) on a path
|
|
155
|
+
* that runs after each edit (review finding, @handarbeit-pruefer). One walk
|
|
156
|
+
* makes it O(nodes) regardless of how many annotations are live. Element lists
|
|
157
|
+
* are in document order, and ids with no live mark are simply absent.
|
|
158
|
+
*/
|
|
159
|
+
export declare function markElementsByAnnotationId(editor: LexicalEditor, ids: ReadonlySet<string>): Map<string, HTMLElement[]>;
|
|
160
|
+
/**
|
|
161
|
+
* Removes every `MarkNode` wrapping `id` (annotation deleted, or composer
|
|
162
|
+
* cancelled before submit). A mark shared with other annotation ids
|
|
163
|
+
* (overlapping annotations) keeps its other ids and stays in the tree; a mark
|
|
164
|
+
* left with none is unwrapped back to plain content.
|
|
165
|
+
*/
|
|
166
|
+
export declare function removeMarksForAnnotation(editor: LexicalEditor, id: string): void;
|
|
167
|
+
/**
|
|
168
|
+
* Removes many annotations' marks inside a *single* `editor.update()`.
|
|
169
|
+
*
|
|
170
|
+
* The batched counterpart to {@link removeMarksForAnnotation}, for the same
|
|
171
|
+
* reason {@link placeMarksForAnchors} exists: a host that drops a set of live
|
|
172
|
+
* annotations at once — "resolve all comments", or an `offsetsVersion` bump
|
|
173
|
+
* that takes a batch of ids out of the marker targets — would otherwise force
|
|
174
|
+
* one synchronous Lexical reconciliation per id (review finding,
|
|
175
|
+
* @handarbeit-pruefer). One tree walk covers the whole set.
|
|
176
|
+
*/
|
|
177
|
+
export declare function removeMarksForAnnotations(editor: LexicalEditor, ids: readonly string[]): void;
|