1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
//! [`Decoration`]s — visual overlays applied on top of the rendered DOM
//! without changing the document. The DOM bridge applies/removes them
//! against the matching descriptors.
//!
//! Two kinds ship today:
//!
//! * **Node decorations** add a CSS class to the block (or nested) element
//! whose start position is `pos` — used for selection highlights,
//! collaboration cursors on a block, slash-menu targets, table cell
//! highlighting, etc.
//! * **Inline (range-level) decorations** highlight an arbitrary inline range
//! `[from, to)`. They are drawn as an **overlay** — absolutely-positioned
//! boxes layered above the text — rather than by wrapping the text in a
//! `<span>`. Wrapping would split the editable text nodes, which the
//! diff/patch read-back ([`EditorView::read_dom_changes`]) reads by
//! `text.data()`; the overlay leaves the editable DOM untouched, so typing
//! and reconciliation are unaffected. This is exactly what third-party UI
//! needs: search highlights, comment ranges, collaborative remote
//! selections.
//!
//! [`EditorView::read_dom_changes`]: crate::EditorView::read_dom_changes
/// A decoration applied on top of the rendered DOM.