laif-ds 0.2.85 → 0.2.87
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/README.md +11 -81
- package/dist/CHANGELOG.md +13 -0
- package/dist/_virtual/index6.js +2 -2
- package/dist/_virtual/index7.js +2 -2
- package/dist/agent-docs/adoption-report.json +2 -2
- package/dist/agent-docs/manifest.json +3 -3
- package/dist/components/editor/editor-hooks/use-update-toolbar.js +6 -6
- package/dist/components/editor/editor-ui/content-editable.js +1 -1
- package/dist/components/editor/nodes/mention-node.js +2 -2
- package/dist/components/editor/plugins/actions/clear-editor-plugin.js +2 -2
- package/dist/components/editor/plugins/actions/counter-character-plugin.js +2 -2
- package/dist/components/editor/plugins/mention-plugin.js +21 -21
- package/dist/components/editor/plugins/toolbar/block-format/format-bulleted-list.js +10 -10
- package/dist/components/editor/plugins/toolbar/block-format/format-check-list.js +5 -5
- package/dist/components/editor/plugins/toolbar/block-format/format-heading.js +5 -5
- package/dist/components/editor/plugins/toolbar/block-format/format-numbered-list.js +5 -5
- package/dist/components/editor/plugins/toolbar/block-format/format-paragraph.js +9 -9
- package/dist/components/editor/plugins/toolbar/block-format/format-quote.js +3 -3
- package/dist/components/editor/plugins/toolbar/block-format-toolbar-plugin.js +13 -13
- package/dist/components/editor/plugins/toolbar/font-format-toolbar-plugin.js +2 -2
- package/dist/components/editor/plugins/toolbar/history-toolbar-plugin.js +18 -19
- package/dist/components/editor/plugins/toolbar/mention-insert-toolbar-plugin.js +1 -1
- package/dist/components/editor/plugins/toolbar/toolbar-plugin.js +3 -3
- package/dist/components/ui/app-editor.js +51 -51
- package/dist/components/ui/markdown-renderer.js +33 -32
- package/dist/lib/utils.js +35 -34
- package/dist/node_modules/@floating-ui/core/dist/floating-ui.core.js +1 -1
- package/dist/node_modules/@floating-ui/{utils → core/node_modules/@floating-ui/utils}/dist/floating-ui.utils.js +33 -39
- package/dist/node_modules/@floating-ui/dom/dist/floating-ui.dom.js +20 -19
- package/dist/node_modules/@floating-ui/dom/node_modules/@floating-ui/utils/dist/floating-ui.utils.js +12 -0
- package/dist/node_modules/@lexical/clipboard/dist/LexicalClipboard.prod.js +354 -0
- package/dist/node_modules/@lexical/code-core/dist/LexicalCodeCore.prod.js +298 -0
- package/dist/node_modules/@lexical/dragon/dist/LexicalDragon.prod.js +89 -0
- package/dist/node_modules/@lexical/extension/dist/LexicalExtension.prod.js +611 -0
- package/dist/node_modules/@lexical/history/dist/LexicalHistory.prod.js +96 -0
- package/dist/node_modules/@lexical/html/dist/LexicalHtml.prod.js +604 -0
- package/dist/node_modules/@lexical/link/dist/LexicalLink.prod.js +201 -0
- package/dist/node_modules/@lexical/list/dist/LexicalList.prod.js +843 -0
- package/dist/node_modules/@lexical/markdown/dist/LexicalMarkdown.prod.js +555 -0
- package/dist/node_modules/@lexical/react/dist/LexicalCheckListPlugin.prod.js +11 -0
- package/dist/node_modules/@lexical/react/dist/LexicalClearEditorPlugin.prod.js +13 -0
- package/dist/node_modules/@lexical/react/dist/LexicalComposer.prod.js +45 -0
- package/dist/node_modules/@lexical/react/{LexicalComposerContext.prod.js → dist/LexicalComposerContext.prod.js} +1 -1
- package/dist/node_modules/@lexical/react/dist/LexicalContentEditable.prod.js +53 -0
- package/dist/node_modules/@lexical/react/dist/LexicalErrorBoundary.prod.js +21 -0
- package/dist/node_modules/@lexical/react/{LexicalHistoryPlugin.prod.js → dist/LexicalHistoryPlugin.prod.js} +3 -3
- package/dist/node_modules/@lexical/react/dist/LexicalListPlugin.prod.js +17 -0
- package/dist/node_modules/@lexical/react/dist/LexicalOnChangePlugin.prod.js +16 -0
- package/dist/node_modules/@lexical/react/dist/LexicalReactProviderExtension.prod.js +6 -0
- package/dist/node_modules/@lexical/react/dist/LexicalRichTextPlugin.prod.js +77 -0
- package/dist/node_modules/@lexical/react/dist/LexicalTypeaheadMenuPlugin.prod.js +245 -0
- package/dist/node_modules/@lexical/react/dist/useLexicalEditable.prod.js +22 -0
- package/dist/node_modules/@lexical/rich-text/dist/LexicalRichText.prod.js +567 -0
- package/dist/node_modules/@lexical/selection/dist/LexicalSelection.prod.js +123 -0
- package/dist/node_modules/@lexical/table/dist/LexicalTable.prod.js +929 -0
- package/dist/node_modules/@lexical/text/{LexicalText.prod.js → dist/LexicalText.prod.js} +6 -6
- package/dist/node_modules/@lexical/utils/dist/LexicalUtils.prod.js +111 -0
- package/dist/node_modules/eventemitter3/index2.js +1 -1
- package/dist/node_modules/lexical/dist/Lexical.prod.js +6731 -0
- package/dist/node_modules/style-to-object/cjs/index.js +1 -1
- package/package.json +17 -15
- package/dist/_virtual/prism-cpp.js +0 -3
- package/dist/_virtual/prism-cpp2.js +0 -5
- package/dist/_virtual/prism-java.js +0 -3
- package/dist/_virtual/prism-java2.js +0 -5
- package/dist/_virtual/prism-python.js +0 -3
- package/dist/_virtual/prism-python2.js +0 -5
- package/dist/_virtual/prism-rust.js +0 -3
- package/dist/_virtual/prism-rust2.js +0 -5
- package/dist/_virtual/prism-typescript.js +0 -3
- package/dist/_virtual/prism-typescript2.js +0 -5
- package/dist/_virtual/prism.js +0 -3
- package/dist/_virtual/prism2.js +0 -5
- package/dist/node_modules/@lexical/clipboard/LexicalClipboard.prod.js +0 -159
- package/dist/node_modules/@lexical/code/LexicalCode.prod.js +0 -236
- package/dist/node_modules/@lexical/dragon/LexicalDragon.prod.js +0 -46
- package/dist/node_modules/@lexical/history/LexicalHistory.prod.js +0 -89
- package/dist/node_modules/@lexical/html/LexicalHtml.prod.js +0 -108
- package/dist/node_modules/@lexical/link/LexicalLink.prod.js +0 -187
- package/dist/node_modules/@lexical/list/LexicalList.prod.js +0 -729
- package/dist/node_modules/@lexical/markdown/LexicalMarkdown.prod.js +0 -367
- package/dist/node_modules/@lexical/react/LexicalCheckListPlugin.prod.js +0 -11
- package/dist/node_modules/@lexical/react/LexicalClearEditorPlugin.prod.js +0 -17
- package/dist/node_modules/@lexical/react/LexicalComposer.prod.js +0 -45
- package/dist/node_modules/@lexical/react/LexicalContentEditable.prod.js +0 -55
- package/dist/node_modules/@lexical/react/LexicalErrorBoundary.prod.js +0 -49
- package/dist/node_modules/@lexical/react/LexicalListPlugin.prod.js +0 -17
- package/dist/node_modules/@lexical/react/LexicalOnChangePlugin.prod.js +0 -16
- package/dist/node_modules/@lexical/react/LexicalRichTextPlugin.prod.js +0 -56
- package/dist/node_modules/@lexical/react/LexicalTypeaheadMenuPlugin.prod.js +0 -220
- package/dist/node_modules/@lexical/react/useLexicalEditable.prod.js +0 -21
- package/dist/node_modules/@lexical/rich-text/LexicalRichText.prod.js +0 -376
- package/dist/node_modules/@lexical/selection/LexicalSelection.prod.js +0 -107
- package/dist/node_modules/@lexical/table/LexicalTable.prod.js +0 -661
- package/dist/node_modules/@lexical/utils/LexicalUtils.prod.js +0 -102
- package/dist/node_modules/lexical/Lexical.prod.js +0 -4912
- package/dist/node_modules/prismjs/components/prism-c.js +0 -77
- package/dist/node_modules/prismjs/components/prism-clike.js +0 -32
- package/dist/node_modules/prismjs/components/prism-cpp.js +0 -93
- package/dist/node_modules/prismjs/components/prism-css.js +0 -56
- package/dist/node_modules/prismjs/components/prism-java.js +0 -122
- package/dist/node_modules/prismjs/components/prism-javascript.js +0 -138
- package/dist/node_modules/prismjs/components/prism-markdown.js +0 -301
- package/dist/node_modules/prismjs/components/prism-markup.js +0 -174
- package/dist/node_modules/prismjs/components/prism-objectivec.js +0 -11
- package/dist/node_modules/prismjs/components/prism-powershell.js +0 -56
- package/dist/node_modules/prismjs/components/prism-python.js +0 -69
- package/dist/node_modules/prismjs/components/prism-rust.js +0 -124
- package/dist/node_modules/prismjs/components/prism-sql.js +0 -34
- package/dist/node_modules/prismjs/components/prism-swift.js +0 -114
- package/dist/node_modules/prismjs/components/prism-typescript.js +0 -53
- package/dist/node_modules/prismjs/prism.js +0 -1165
- /package/dist/node_modules/@floating-ui/{utils → dom/node_modules/@floating-ui/utils}/dist/floating-ui.utils.dom.js +0 -0
|
@@ -0,0 +1,843 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { $getNearestNodeOfType as Ot, calculateZoomLevel as At } from "../../utils/dist/LexicalUtils.prod.js";
|
|
3
|
+
import { ElementNode as R, buildImportMap as ft, $getDocument as dt, isHTMLElement as y, $createTextNode as Pt, $isElementNode as L, $getSiblingCaret as Q, $isRootOrShadowRoot as E, $insertNodeToNearestRootAtCaret as Et, $rewindSiblingCaret as Ft, normalizeClassNames as F, removeClassNamesFromElement as pt, addClassNamesToElement as mt, setDOMStyleFromCSS as Mt, getStyleObjectFromCSS as tt, $copyNode as m, $getSelection as x, $isRangeSelection as k, $createParagraphNode as M, $isParagraphNode as Y, $applyNodeReplacement as _t, createCommand as D, mergeRegister as W, TextNode as Dt, $isTextNode as U, KEY_BACKSPACE_COMMAND as It, $findMatchingParent as q, $isDecoratorNode as $t, COMMAND_PRIORITY_BEFORE_EDITOR as Rt, INSERT_PARAGRAPH_COMMAND as wt, COMMAND_PRIORITY_LOW as _, $getNodeByKey as Kt, registerEventListeners as et, registerEventListener as Bt, KEY_ARROW_LEFT_COMMAND as Wt, getActiveElement as Ct, KEY_SPACE_COMMAND as Ut, $getNearestNodeFromDOMNode as X, KEY_ESCAPE_COMMAND as Vt, KEY_ARROW_UP_COMMAND as zt, KEY_ARROW_DOWN_COMMAND as Jt, $setDirectionFromDOM as I, $setFormatFromDOM as j, $isLeafNode as yt, $setPointFromCaret as rt, $normalizeCaret as nt, $getChildCaret as st, $createLineBreakNode as Ht, getNearestEditorFromDOMNode as Yt, $addUpdateTag as it, SKIP_SELECTION_FOCUS_TAG as qt, SKIP_DOM_SELECTION_TAG as Xt } from "../../../lexical/dist/Lexical.prod.js";
|
|
4
|
+
import { defineImportRule as w, sel as K, isElementOfTag as Tt, $propagateTextAlignToBlockChildren as jt, $isBlockLevel as Gt } from "../../html/dist/LexicalHtml.prod.js";
|
|
5
|
+
function b(n, ...e) {
|
|
6
|
+
const t = new URL("https://lexical.dev/docs/error"), r = new URLSearchParams();
|
|
7
|
+
r.append("code", n);
|
|
8
|
+
for (const i of e) r.append("v", i);
|
|
9
|
+
throw t.search = r.toString(), Error(`Minified Lexical error #${n}; visit ${t.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`);
|
|
10
|
+
}
|
|
11
|
+
function V(n) {
|
|
12
|
+
let e = 1, t = n.getParent();
|
|
13
|
+
for (; t != null; ) {
|
|
14
|
+
if (h(t)) {
|
|
15
|
+
const r = t.getParent();
|
|
16
|
+
if (g(r)) {
|
|
17
|
+
e++, t = r.getParent();
|
|
18
|
+
continue;
|
|
19
|
+
}
|
|
20
|
+
b(40);
|
|
21
|
+
}
|
|
22
|
+
return e;
|
|
23
|
+
}
|
|
24
|
+
return e;
|
|
25
|
+
}
|
|
26
|
+
function z(n) {
|
|
27
|
+
const e = n.getParent();
|
|
28
|
+
g(e) || b(40);
|
|
29
|
+
let t = e, r = e;
|
|
30
|
+
for (; r !== null; ) r = r.getParent(), g(r) && (t = r);
|
|
31
|
+
return t;
|
|
32
|
+
}
|
|
33
|
+
function St(n) {
|
|
34
|
+
let e = [];
|
|
35
|
+
const t = n.getChildren().filter(h);
|
|
36
|
+
for (let r = 0; r < t.length; r++) {
|
|
37
|
+
const i = t[r], s = i.getFirstChild();
|
|
38
|
+
g(s) ? e = e.concat(St(s)) : e.push(i);
|
|
39
|
+
}
|
|
40
|
+
return e;
|
|
41
|
+
}
|
|
42
|
+
function C(n) {
|
|
43
|
+
return h(n) && g(n.getFirstChild());
|
|
44
|
+
}
|
|
45
|
+
function Nt(n, e) {
|
|
46
|
+
return h(n) && (e.length === 0 || e.length === 1 && n.is(e[0]) && n.getChildrenSize() === 0);
|
|
47
|
+
}
|
|
48
|
+
function J(n) {
|
|
49
|
+
const e = x();
|
|
50
|
+
if (e !== null) {
|
|
51
|
+
let t = e.getNodes();
|
|
52
|
+
if (k(e)) {
|
|
53
|
+
const [i] = e.getStartEndPoints(), s = i.getNode(), o = s.getParent();
|
|
54
|
+
if (E(s)) {
|
|
55
|
+
const l = s.getFirstChild();
|
|
56
|
+
if (l) t = l.selectStart().getNodes();
|
|
57
|
+
else {
|
|
58
|
+
const c = M();
|
|
59
|
+
s.append(c), t = c.select().getNodes();
|
|
60
|
+
}
|
|
61
|
+
} else if (Nt(s, t)) {
|
|
62
|
+
const l = N(n);
|
|
63
|
+
if (E(o)) {
|
|
64
|
+
s.replace(l);
|
|
65
|
+
const c = v();
|
|
66
|
+
L(s) && (c.setFormat(s.getFormatType()), c.setIndent(s.getIndent())), l.append(c);
|
|
67
|
+
} else if (h(s)) {
|
|
68
|
+
const c = s.getParentOrThrow();
|
|
69
|
+
A(l, c.getChildren()), c.replace(l);
|
|
70
|
+
}
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
const r = /* @__PURE__ */ new Set();
|
|
75
|
+
for (let i = 0; i < t.length; i++) {
|
|
76
|
+
const s = t[i];
|
|
77
|
+
if (L(s) && s.isEmpty() && !h(s) && !r.has(s.getKey())) {
|
|
78
|
+
ot(s, n);
|
|
79
|
+
continue;
|
|
80
|
+
}
|
|
81
|
+
let o = yt(s) ? s.getParent() : h(s) && s.isEmpty() ? s : null;
|
|
82
|
+
for (; o != null; ) {
|
|
83
|
+
const l = o.getKey();
|
|
84
|
+
if (g(o)) {
|
|
85
|
+
if (!r.has(l)) {
|
|
86
|
+
const c = N(n);
|
|
87
|
+
A(c, o.getChildren()), o.replace(c), r.add(l);
|
|
88
|
+
}
|
|
89
|
+
break;
|
|
90
|
+
}
|
|
91
|
+
{
|
|
92
|
+
const c = o.getParent();
|
|
93
|
+
if (E(c) && !r.has(l)) {
|
|
94
|
+
r.add(l), ot(o, n);
|
|
95
|
+
break;
|
|
96
|
+
}
|
|
97
|
+
o = c;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
function A(n, e) {
|
|
104
|
+
n.splice(n.getChildrenSize(), 0, e);
|
|
105
|
+
}
|
|
106
|
+
function ot(n, e) {
|
|
107
|
+
if (g(n)) return n;
|
|
108
|
+
const t = n.getPreviousSibling(), r = n.getNextSibling(), i = v();
|
|
109
|
+
let s;
|
|
110
|
+
if (A(i, n.getChildren()), g(t) && e === t.getListType()) t.append(i), g(r) && e === r.getListType() && (A(t, r.getChildren()), r.remove()), s = t;
|
|
111
|
+
else if (g(r) && e === r.getListType()) r.getFirstChildOrThrow().insertBefore(i), s = r;
|
|
112
|
+
else {
|
|
113
|
+
const l = N(e);
|
|
114
|
+
l.append(i), n.replace(l), s = l;
|
|
115
|
+
}
|
|
116
|
+
i.setFormat(n.getFormatType()), i.setIndent(n.getIndent());
|
|
117
|
+
const o = x();
|
|
118
|
+
return k(o) && (s.getKey() === o.anchor.key && o.anchor.set(i.getKey(), o.anchor.offset, "element"), s.getKey() === o.focus.key && o.focus.set(i.getKey(), o.focus.offset, "element")), n.remove(), s;
|
|
119
|
+
}
|
|
120
|
+
function G(n, e) {
|
|
121
|
+
const t = n.getLastChild(), r = e.getFirstChild();
|
|
122
|
+
t && r && C(t) && C(r) && (G(t.getFirstChild(), r.getFirstChild()), r.remove());
|
|
123
|
+
const i = e.getChildren();
|
|
124
|
+
i.length > 0 && n.append(...i), e.remove();
|
|
125
|
+
}
|
|
126
|
+
function Zt() {
|
|
127
|
+
const n = x();
|
|
128
|
+
if (k(n)) {
|
|
129
|
+
const e = /* @__PURE__ */ new Set(), t = n.getNodes(), r = n.anchor.getNode();
|
|
130
|
+
if (Nt(r, t)) e.add(z(r));
|
|
131
|
+
else for (let i = 0; i < t.length; i++) {
|
|
132
|
+
const s = t[i];
|
|
133
|
+
if (yt(s)) {
|
|
134
|
+
const o = Ot(s, B);
|
|
135
|
+
o != null && e.add(z(o));
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
for (const i of e) {
|
|
139
|
+
let s = i;
|
|
140
|
+
const o = St(i);
|
|
141
|
+
for (const l of o) {
|
|
142
|
+
const c = M().setTextStyle(n.style).setTextFormat(n.format);
|
|
143
|
+
A(c, l.getChildren()), s.insertAfter(c), s = c, l.__key === n.anchor.key && rt(n.anchor, nt(st(c, "next"))), l.__key === n.focus.key && rt(n.focus, nt(st(c, "next"))), l.remove();
|
|
144
|
+
}
|
|
145
|
+
i.remove();
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
function kt(n) {
|
|
150
|
+
const e = n.getListType() !== "check";
|
|
151
|
+
let t = n.getStart();
|
|
152
|
+
for (const r of n.getChildren()) h(r) && (r.getValue() !== t && r.setValue(t), e && r.getLatest().__checked != null && r.setChecked(void 0), g(r.getFirstChild()) || t++);
|
|
153
|
+
}
|
|
154
|
+
function Qt(n) {
|
|
155
|
+
const e = /* @__PURE__ */ new Set();
|
|
156
|
+
if (C(n) || e.has(n.getKey())) return;
|
|
157
|
+
const t = n.getParent(), r = n.getNextSibling(), i = n.getPreviousSibling();
|
|
158
|
+
if (C(r) && C(i)) {
|
|
159
|
+
const s = i.getFirstChild();
|
|
160
|
+
if (g(s)) {
|
|
161
|
+
s.append(n);
|
|
162
|
+
const o = r.getFirstChild();
|
|
163
|
+
g(o) && (A(s, o.getChildren()), r.remove(), e.add(r.getKey()));
|
|
164
|
+
}
|
|
165
|
+
} else if (C(r)) {
|
|
166
|
+
const s = r.getFirstChild();
|
|
167
|
+
if (g(s)) {
|
|
168
|
+
const o = s.getFirstChild();
|
|
169
|
+
o !== null && o.insertBefore(n);
|
|
170
|
+
}
|
|
171
|
+
} else if (C(i)) {
|
|
172
|
+
const s = i.getFirstChild();
|
|
173
|
+
g(s) && s.append(n);
|
|
174
|
+
} else if (g(t)) {
|
|
175
|
+
const s = m(n), o = m(t);
|
|
176
|
+
s.append(o), o.append(n), i ? i.insertAfter(s) : r ? r.insertBefore(s) : t.append(s);
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
function te(n) {
|
|
180
|
+
if (C(n)) return;
|
|
181
|
+
const e = n.getParent(), t = e ? e.getParent() : void 0;
|
|
182
|
+
if (g(t ? t.getParent() : void 0) && h(t) && g(e)) {
|
|
183
|
+
const r = e ? e.getFirstChild() : void 0, i = e ? e.getLastChild() : void 0;
|
|
184
|
+
if (n.is(r)) t.insertBefore(n), e.isEmpty() && t.remove();
|
|
185
|
+
else if (n.is(i)) t.insertAfter(n), e.isEmpty() && t.remove();
|
|
186
|
+
else {
|
|
187
|
+
const s = m(n), o = m(e);
|
|
188
|
+
s.append(o), n.getPreviousSiblings().forEach((a) => o.append(a));
|
|
189
|
+
const l = m(n), c = m(e);
|
|
190
|
+
l.append(c), A(c, n.getNextSiblings()), t.insertBefore(s), t.insertAfter(l), t.replace(n);
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
function ee(n = !1) {
|
|
195
|
+
const e = x();
|
|
196
|
+
if (!k(e) || !e.isCollapsed()) return !1;
|
|
197
|
+
const t = e.anchor.getNode();
|
|
198
|
+
let r = null;
|
|
199
|
+
if (h(t) && t.getChildrenSize() === 0) r = t;
|
|
200
|
+
else if (U(t)) {
|
|
201
|
+
const a = t.getParent();
|
|
202
|
+
h(a) && a.getChildren().every((u) => U(u) && u.getTextContent().trim() === "") && (r = a);
|
|
203
|
+
}
|
|
204
|
+
if (r === null) return !1;
|
|
205
|
+
const i = z(r), s = r.getParent();
|
|
206
|
+
g(s) || b(40);
|
|
207
|
+
const o = s.getParent();
|
|
208
|
+
let l;
|
|
209
|
+
if (E(o)) l = M(), i.insertAfter(l);
|
|
210
|
+
else {
|
|
211
|
+
if (!h(o)) return !1;
|
|
212
|
+
l = m(o), o.insertAfter(l);
|
|
213
|
+
}
|
|
214
|
+
l.setTextStyle(e.style).setTextFormat(e.format).select();
|
|
215
|
+
const c = r.getNextSiblings();
|
|
216
|
+
if (c.length > 0) {
|
|
217
|
+
const a = n ? (function(f, d) {
|
|
218
|
+
return f.getStart() + d.getIndexWithinParent();
|
|
219
|
+
})(s, r) : 1, u = m(s).setStart(a);
|
|
220
|
+
if (h(l)) {
|
|
221
|
+
const f = m(l);
|
|
222
|
+
f.append(u), l.insertAfter(f);
|
|
223
|
+
} else l.insertAfter(u);
|
|
224
|
+
u.append(...c);
|
|
225
|
+
}
|
|
226
|
+
return (function(a) {
|
|
227
|
+
let u = a;
|
|
228
|
+
for (; u.getNextSibling() == null && u.getPreviousSibling() == null; ) {
|
|
229
|
+
const f = u.getParent();
|
|
230
|
+
if (f == null || !h(f) && !g(f)) break;
|
|
231
|
+
u = f;
|
|
232
|
+
}
|
|
233
|
+
u.remove();
|
|
234
|
+
})(r), !0;
|
|
235
|
+
}
|
|
236
|
+
class B extends R {
|
|
237
|
+
__value;
|
|
238
|
+
__checked;
|
|
239
|
+
$config() {
|
|
240
|
+
return this.config("listitem", { $transform: (e) => {
|
|
241
|
+
const t = e.getParent();
|
|
242
|
+
if (g(t)) t.getListType() !== "check" && e.getChecked() != null && e.setChecked(void 0);
|
|
243
|
+
else if (t) {
|
|
244
|
+
const r = e.createParentElementNode();
|
|
245
|
+
g(r) || b(340);
|
|
246
|
+
const i = [e];
|
|
247
|
+
for (const s of ["previous", "next"]) {
|
|
248
|
+
i.reverse();
|
|
249
|
+
for (const { origin: o } of Q(e, s)) {
|
|
250
|
+
if (!h(o)) break;
|
|
251
|
+
i.push(o);
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
e.insertBefore(r), r.splice(0, 0, i), E(t) || (Et(r, Ft(Q(r, "next")), { $shouldSplit: () => !1, removeEmptyDestination: !0 }), t.isEmpty() && t.isAttached() && t.remove());
|
|
255
|
+
}
|
|
256
|
+
}, extends: R, importDOM: ft({ li: () => ({ conversion: re, priority: 0 }) }) });
|
|
257
|
+
}
|
|
258
|
+
constructor(e = 1, t = void 0, r) {
|
|
259
|
+
super(r), this.__value = e === void 0 ? 1 : e, this.__checked = t;
|
|
260
|
+
}
|
|
261
|
+
afterCloneFrom(e) {
|
|
262
|
+
super.afterCloneFrom(e), this.__value = e.__value, this.__checked = e.__checked;
|
|
263
|
+
}
|
|
264
|
+
createDOM(e) {
|
|
265
|
+
const t = dt().createElement("li");
|
|
266
|
+
return this.updateListItemDOM(null, t, e), t;
|
|
267
|
+
}
|
|
268
|
+
updateListItemDOM(e, t, r) {
|
|
269
|
+
(function(o, l) {
|
|
270
|
+
const c = l.getParent();
|
|
271
|
+
!g(c) || c.getListType() !== "check" || g(l.getFirstChild()) ? (o.removeAttribute("role"), o.removeAttribute("tabIndex"), o.removeAttribute("aria-checked")) : (o.setAttribute("role", "checkbox"), o.setAttribute("tabIndex", "-1"), o.setAttribute("aria-checked", l.getChecked() ? "true" : "false"));
|
|
272
|
+
})(t, this), t.value = this.__value, (function(o, l, c) {
|
|
273
|
+
const a = l.list;
|
|
274
|
+
if (!a) return;
|
|
275
|
+
const u = a.listitem, f = a.nested && a.nested.listitem, d = c.getParent(), T = g(d) && d.getListType() === "check", p = c.getChecked(), O = c.getChildren().some(($) => g($)), S = [];
|
|
276
|
+
a.listitemChecked !== void 0 && S.push(a.listitemChecked), a.listitemUnchecked !== void 0 && S.push(a.listitemUnchecked), f !== void 0 && S.push(...F(f)), S.length > 0 && pt(o, ...S);
|
|
277
|
+
const P = [];
|
|
278
|
+
if (u !== void 0 && P.push(...F(u)), T) {
|
|
279
|
+
const $ = p ? a.listitemChecked : a.listitemUnchecked;
|
|
280
|
+
$ !== void 0 && P.push($);
|
|
281
|
+
}
|
|
282
|
+
f !== void 0 && O && P.push(...F(f)), P.length > 0 && mt(o, ...P);
|
|
283
|
+
})(t, r.theme, this);
|
|
284
|
+
const i = e ? e.__style : "", s = this.__style;
|
|
285
|
+
i !== s && Mt(t.style, s, i), (function(o, l, c) {
|
|
286
|
+
const a = l.__textStyle, u = c ? c.__textStyle : "";
|
|
287
|
+
if (c !== null && u === a) return;
|
|
288
|
+
const f = tt(a);
|
|
289
|
+
for (const d in f) o.style.setProperty(`--listitem-marker-${d}`, f[d]);
|
|
290
|
+
if (u !== "") for (const d in tt(u)) d in f || o.style.removeProperty(`--listitem-marker-${d}`);
|
|
291
|
+
})(t, this, e);
|
|
292
|
+
}
|
|
293
|
+
updateDOM(e, t, r) {
|
|
294
|
+
const i = t;
|
|
295
|
+
return this.updateListItemDOM(e, i, r), !1;
|
|
296
|
+
}
|
|
297
|
+
updateFromJSON(e) {
|
|
298
|
+
return super.updateFromJSON(e).setValue(e.value).setChecked(e.checked);
|
|
299
|
+
}
|
|
300
|
+
exportDOM(e) {
|
|
301
|
+
const t = this.createDOM(e._config), r = this.getFormatType();
|
|
302
|
+
r && (t.style.textAlign = r);
|
|
303
|
+
const i = this.getDirection();
|
|
304
|
+
return i && (t.dir = i), C(this) ? { after(s) {
|
|
305
|
+
if (y(s)) {
|
|
306
|
+
const o = s.previousElementSibling;
|
|
307
|
+
if (y(o) && o.nodeName === "LI") {
|
|
308
|
+
for (; s.firstChild; ) o.append(s.firstChild);
|
|
309
|
+
s.remove();
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
return s;
|
|
313
|
+
}, element: t } : { element: t };
|
|
314
|
+
}
|
|
315
|
+
exportJSON() {
|
|
316
|
+
return { ...super.exportJSON(), checked: this.getChecked(), value: this.getValue() };
|
|
317
|
+
}
|
|
318
|
+
append(...e) {
|
|
319
|
+
for (let t = 0; t < e.length; t++) {
|
|
320
|
+
const r = e[t];
|
|
321
|
+
if (L(r) && this.canMergeWith(r)) {
|
|
322
|
+
const i = r.getChildren();
|
|
323
|
+
this.append(...i), r.remove();
|
|
324
|
+
} else super.append(r);
|
|
325
|
+
}
|
|
326
|
+
return this;
|
|
327
|
+
}
|
|
328
|
+
replace(e, t) {
|
|
329
|
+
if (h(e)) return super.replace(e);
|
|
330
|
+
this.setIndent(0);
|
|
331
|
+
const r = this.getParentOrThrow();
|
|
332
|
+
if (!g(r)) return e;
|
|
333
|
+
if (r.__first === this.getKey()) r.insertBefore(e);
|
|
334
|
+
else if (r.__last === this.getKey()) r.insertAfter(e);
|
|
335
|
+
else {
|
|
336
|
+
const o = m(r);
|
|
337
|
+
let l = this.getNextSibling();
|
|
338
|
+
for (; l; ) {
|
|
339
|
+
const c = l;
|
|
340
|
+
l = l.getNextSibling(), o.append(c);
|
|
341
|
+
}
|
|
342
|
+
r.insertAfter(e), e.insertAfter(o);
|
|
343
|
+
}
|
|
344
|
+
const i = this.__key;
|
|
345
|
+
let s = 0;
|
|
346
|
+
if (t && (L(e) || b(139), s = e.getChildrenSize(), e.splice(s, 0, this.getChildren())), t && L(e)) {
|
|
347
|
+
const o = x();
|
|
348
|
+
if (k(o)) for (const l of o.getStartEndPoints()) l.key === i && l.type === "element" && l.set(e.getKey(), s + l.offset, "element");
|
|
349
|
+
}
|
|
350
|
+
return this.remove(), r.getChildrenSize() === 0 && r.remove(), e;
|
|
351
|
+
}
|
|
352
|
+
insertAfter(e, t = !0) {
|
|
353
|
+
const r = this.getParentOrThrow();
|
|
354
|
+
if (g(r) || b(39), h(e)) return super.insertAfter(e, t);
|
|
355
|
+
const i = this.getNextSiblings();
|
|
356
|
+
if (r.insertAfter(e, t), i.length !== 0) {
|
|
357
|
+
const s = m(r);
|
|
358
|
+
i.forEach((o) => s.append(o)), e.insertAfter(s, t);
|
|
359
|
+
}
|
|
360
|
+
return e;
|
|
361
|
+
}
|
|
362
|
+
remove(e) {
|
|
363
|
+
const t = this.getPreviousSibling(), r = this.getNextSibling();
|
|
364
|
+
super.remove(e), t && r && C(t) && C(r) && (G(t.getFirstChild(), r.getFirstChild()), r.remove());
|
|
365
|
+
}
|
|
366
|
+
resetOnCopyNodeFrom(e) {
|
|
367
|
+
super.resetOnCopyNodeFrom(e), e.getChecked() && this.setChecked(!1);
|
|
368
|
+
}
|
|
369
|
+
insertNewAfter(e, t = !0) {
|
|
370
|
+
const r = m(this);
|
|
371
|
+
return this.insertAfter(r, t), r;
|
|
372
|
+
}
|
|
373
|
+
collapseAtStart(e) {
|
|
374
|
+
const t = M();
|
|
375
|
+
this.getChildren().forEach((o) => t.append(o));
|
|
376
|
+
const r = this.getParentOrThrow(), i = r.getParentOrThrow(), s = h(i);
|
|
377
|
+
if (r.getChildrenSize() === 1) if (s) r.remove(), i.select();
|
|
378
|
+
else {
|
|
379
|
+
r.insertBefore(t), r.remove();
|
|
380
|
+
const o = e.anchor, l = e.focus, c = t.getKey();
|
|
381
|
+
o.type === "element" && o.getNode().is(this) && o.set(c, o.offset, "element"), l.type === "element" && l.getNode().is(this) && l.set(c, l.offset, "element");
|
|
382
|
+
}
|
|
383
|
+
else r.insertBefore(t), this.remove();
|
|
384
|
+
return !0;
|
|
385
|
+
}
|
|
386
|
+
getValue() {
|
|
387
|
+
return this.getLatest().__value;
|
|
388
|
+
}
|
|
389
|
+
setValue(e) {
|
|
390
|
+
const t = this.getWritable();
|
|
391
|
+
return t.__value = e, t;
|
|
392
|
+
}
|
|
393
|
+
getChecked() {
|
|
394
|
+
const e = this.getLatest();
|
|
395
|
+
let t;
|
|
396
|
+
const r = this.getParent();
|
|
397
|
+
return g(r) && (t = r.getListType()), t === "check" ? !!e.__checked : void 0;
|
|
398
|
+
}
|
|
399
|
+
setChecked(e) {
|
|
400
|
+
const t = this.getWritable();
|
|
401
|
+
return t.__checked = e, t;
|
|
402
|
+
}
|
|
403
|
+
toggleChecked() {
|
|
404
|
+
const e = this.getWritable();
|
|
405
|
+
return e.setChecked(!e.__checked);
|
|
406
|
+
}
|
|
407
|
+
getIndent() {
|
|
408
|
+
const e = this.getParent();
|
|
409
|
+
if (e === null || !this.isAttached()) return this.getLatest().__indent;
|
|
410
|
+
let t = e.getParentOrThrow(), r = 0;
|
|
411
|
+
for (; h(t); ) t = t.getParentOrThrow().getParentOrThrow(), r++;
|
|
412
|
+
return r;
|
|
413
|
+
}
|
|
414
|
+
setIndent(e) {
|
|
415
|
+
typeof e != "number" && b(117), (e = Math.floor(e)) >= 0 || b(199);
|
|
416
|
+
let t = this.getIndent();
|
|
417
|
+
for (; t !== e; ) t < e ? (Qt(this), t++) : (te(this), t--);
|
|
418
|
+
return this;
|
|
419
|
+
}
|
|
420
|
+
canInsertAfter(e) {
|
|
421
|
+
return h(e);
|
|
422
|
+
}
|
|
423
|
+
canReplaceWith(e) {
|
|
424
|
+
return h(e);
|
|
425
|
+
}
|
|
426
|
+
canMergeWith(e) {
|
|
427
|
+
return h(e) || Y(e);
|
|
428
|
+
}
|
|
429
|
+
extractWithChild(e, t) {
|
|
430
|
+
if (!k(t)) return !1;
|
|
431
|
+
const r = t.anchor.getNode(), i = t.focus.getNode();
|
|
432
|
+
return this.isParentOf(r) && this.isParentOf(i) && this.getTextContent().length === t.getTextContent().length;
|
|
433
|
+
}
|
|
434
|
+
isParentRequired() {
|
|
435
|
+
return !0;
|
|
436
|
+
}
|
|
437
|
+
createParentElementNode() {
|
|
438
|
+
return N("bullet");
|
|
439
|
+
}
|
|
440
|
+
canMergeWhenEmpty() {
|
|
441
|
+
return !0;
|
|
442
|
+
}
|
|
443
|
+
}
|
|
444
|
+
function re(n) {
|
|
445
|
+
if (n.classList.contains("task-list-item")) {
|
|
446
|
+
for (const r of n.children) if (r.tagName === "INPUT") return lt(r);
|
|
447
|
+
}
|
|
448
|
+
if (n.classList.contains("joplin-checkbox")) {
|
|
449
|
+
for (const r of n.children) if (r.classList.contains("checkbox-wrapper") && r.children.length > 0 && r.children[0].tagName === "INPUT") return lt(r.children[0]);
|
|
450
|
+
}
|
|
451
|
+
const e = n.getAttribute("aria-checked"), t = v(e === "true" || e !== "false" && void 0);
|
|
452
|
+
return j(t, n), { after: vt.bind(null, t), node: I(t, n) };
|
|
453
|
+
}
|
|
454
|
+
function lt(n) {
|
|
455
|
+
if (n.getAttribute("type") !== "checkbox") return { node: null };
|
|
456
|
+
const e = v(n.hasAttribute("checked"));
|
|
457
|
+
return { after: vt.bind(null, e), node: e };
|
|
458
|
+
}
|
|
459
|
+
function vt(n, e) {
|
|
460
|
+
const t = e[0];
|
|
461
|
+
return e.length === 1 && Y(t) && !n.getFormatType() && t.getFormatType() ? (n.setFormat(t.getFormatType()), t.getChildren()) : e;
|
|
462
|
+
}
|
|
463
|
+
function v(n) {
|
|
464
|
+
return _t(new B(void 0, n));
|
|
465
|
+
}
|
|
466
|
+
function h(n) {
|
|
467
|
+
return n instanceof B;
|
|
468
|
+
}
|
|
469
|
+
class Z extends R {
|
|
470
|
+
__tag;
|
|
471
|
+
__start;
|
|
472
|
+
__listType;
|
|
473
|
+
$config() {
|
|
474
|
+
return this.config("list", { $transform: (e) => {
|
|
475
|
+
(function(t) {
|
|
476
|
+
const r = t.getNextSibling();
|
|
477
|
+
g(r) && t.getListType() === r.getListType() && G(t, r);
|
|
478
|
+
})(e), kt(e);
|
|
479
|
+
}, extends: R, importDOM: ft({ ol: () => ({ conversion: ct, priority: 0 }), ul: () => ({ conversion: ct, priority: 0 }) }) });
|
|
480
|
+
}
|
|
481
|
+
constructor(e = "number", t = 1, r) {
|
|
482
|
+
super(r);
|
|
483
|
+
const i = ne[e] || e;
|
|
484
|
+
this.__listType = i, this.__tag = i === "number" ? "ol" : "ul", this.__start = t;
|
|
485
|
+
}
|
|
486
|
+
afterCloneFrom(e) {
|
|
487
|
+
super.afterCloneFrom(e), this.__listType = e.__listType, this.__tag = e.__tag, this.__start = e.__start;
|
|
488
|
+
}
|
|
489
|
+
getTag() {
|
|
490
|
+
return this.getLatest().__tag;
|
|
491
|
+
}
|
|
492
|
+
setListType(e) {
|
|
493
|
+
const t = this.getWritable();
|
|
494
|
+
return t.__listType = e, t.__tag = e === "number" ? "ol" : "ul", t;
|
|
495
|
+
}
|
|
496
|
+
getListType() {
|
|
497
|
+
return this.getLatest().__listType;
|
|
498
|
+
}
|
|
499
|
+
getStart() {
|
|
500
|
+
return this.getLatest().__start;
|
|
501
|
+
}
|
|
502
|
+
setStart(e) {
|
|
503
|
+
const t = this.getWritable();
|
|
504
|
+
return t.__start = e, t;
|
|
505
|
+
}
|
|
506
|
+
createDOM(e, t) {
|
|
507
|
+
const r = this.__tag, i = dt().createElement(r);
|
|
508
|
+
return this.__start !== 1 && i.setAttribute("start", String(this.__start)), i.__lexicalListType = this.__listType, at(i, e.theme, this), i;
|
|
509
|
+
}
|
|
510
|
+
updateDOM(e, t, r) {
|
|
511
|
+
return e.__tag !== this.__tag || e.__listType !== this.__listType || (at(t, r.theme, this), e.__start !== this.__start && t.setAttribute("start", String(this.__start)), !1);
|
|
512
|
+
}
|
|
513
|
+
updateFromJSON(e) {
|
|
514
|
+
return super.updateFromJSON(e).setListType(e.listType).setStart(e.start);
|
|
515
|
+
}
|
|
516
|
+
exportDOM(e) {
|
|
517
|
+
const t = this.createDOM(e._config, e);
|
|
518
|
+
return y(t) && (this.__start !== 1 && t.setAttribute("start", String(this.__start)), this.__listType === "check" && t.setAttribute("__lexicalListType", "check")), { element: t };
|
|
519
|
+
}
|
|
520
|
+
exportJSON() {
|
|
521
|
+
return { ...super.exportJSON(), listType: this.getListType(), start: this.getStart(), tag: this.getTag() };
|
|
522
|
+
}
|
|
523
|
+
canBeEmpty() {
|
|
524
|
+
return !1;
|
|
525
|
+
}
|
|
526
|
+
canIndent() {
|
|
527
|
+
return !1;
|
|
528
|
+
}
|
|
529
|
+
splice(e, t, r) {
|
|
530
|
+
let i = r;
|
|
531
|
+
for (let s = 0; s < r.length; s++) {
|
|
532
|
+
const o = r[s];
|
|
533
|
+
h(o) || (i === r && (i = [...r]), i[s] = this.createListItemNode().append(!L(o) || g(o) || o.isInline() ? o : Pt(o.getTextContent())));
|
|
534
|
+
}
|
|
535
|
+
return super.splice(e, t, i);
|
|
536
|
+
}
|
|
537
|
+
extractWithChild(e) {
|
|
538
|
+
return h(e);
|
|
539
|
+
}
|
|
540
|
+
createListItemNode() {
|
|
541
|
+
return v();
|
|
542
|
+
}
|
|
543
|
+
}
|
|
544
|
+
function at(n, e, t) {
|
|
545
|
+
const r = [], i = [], s = e.list;
|
|
546
|
+
if (s !== void 0) {
|
|
547
|
+
const o = s[`${t.__tag}Depth`] || [], l = V(t) - 1, c = l % o.length, a = o[c], u = s[t.__tag];
|
|
548
|
+
let f;
|
|
549
|
+
const d = s.nested, T = s.checklist;
|
|
550
|
+
if (d !== void 0 && d.list && (f = d.list), u !== void 0 && r.push(u), T !== void 0 && t.__listType === "check" && r.push(T), a !== void 0) {
|
|
551
|
+
r.push(...F(a));
|
|
552
|
+
for (let p = 0; p < o.length; p++) p !== c && i.push(t.__tag + p);
|
|
553
|
+
}
|
|
554
|
+
if (f !== void 0) {
|
|
555
|
+
const p = F(f);
|
|
556
|
+
l > 1 ? r.push(...p) : i.push(...p);
|
|
557
|
+
}
|
|
558
|
+
}
|
|
559
|
+
i.length > 0 && pt(n, ...i), r.length > 0 && mt(n, ...r);
|
|
560
|
+
}
|
|
561
|
+
function ct(n) {
|
|
562
|
+
let e;
|
|
563
|
+
if ((function(t) {
|
|
564
|
+
return y(t) && t.nodeName.toLowerCase() === "ol";
|
|
565
|
+
})(n)) {
|
|
566
|
+
const t = n.start;
|
|
567
|
+
e = N("number", t);
|
|
568
|
+
} else e = (function(t) {
|
|
569
|
+
if (t.getAttribute("__lexicallisttype") === "check" || t.classList.contains("contains-task-list") || t.getAttribute("data-is-checklist") === "1") return !0;
|
|
570
|
+
for (const r of t.childNodes) if (y(r) && r.hasAttribute("aria-checked")) return !0;
|
|
571
|
+
return !1;
|
|
572
|
+
})(n) ? N("check") : N("bullet");
|
|
573
|
+
return I(e, n), { after: (t) => (function(r, i) {
|
|
574
|
+
const s = i.createListItemNode.bind(i), o = [];
|
|
575
|
+
for (let l = 0; l < r.length; l++) {
|
|
576
|
+
const c = r[l];
|
|
577
|
+
if (h(c)) {
|
|
578
|
+
o.push(c);
|
|
579
|
+
const a = c.getChildren();
|
|
580
|
+
a.length > 1 && a.forEach((u) => {
|
|
581
|
+
g(u) && o.push(s().append(u));
|
|
582
|
+
});
|
|
583
|
+
} else o.push(s().append(c));
|
|
584
|
+
}
|
|
585
|
+
return o;
|
|
586
|
+
})(t, e), node: e };
|
|
587
|
+
}
|
|
588
|
+
const ne = { ol: "number", ul: "bullet" };
|
|
589
|
+
function N(n = "number", e = 1) {
|
|
590
|
+
return _t(new Z(n, e));
|
|
591
|
+
}
|
|
592
|
+
function g(n) {
|
|
593
|
+
return n instanceof Z;
|
|
594
|
+
}
|
|
595
|
+
const se = /* @__PURE__ */ D("INSERT_CHECK_LIST_COMMAND");
|
|
596
|
+
function pe(n, e) {
|
|
597
|
+
const t = e && e.disableTakeFocusOnClick || !1, r = typeof t == "boolean" ? () => t : t.peek.bind(t), i = (a) => {
|
|
598
|
+
const u = a.target;
|
|
599
|
+
if (!y(u)) return !1;
|
|
600
|
+
const f = u.__lexicalCheckListLastHandled;
|
|
601
|
+
return f !== void 0 && a.timeStamp - f < 500;
|
|
602
|
+
}, s = (a) => {
|
|
603
|
+
const u = a.target;
|
|
604
|
+
y(u) && (u.__lexicalCheckListLastHandled = a.timeStamp);
|
|
605
|
+
}, o = (a) => {
|
|
606
|
+
i(a) || (s(a), ut(a, r()));
|
|
607
|
+
}, l = (a) => {
|
|
608
|
+
a.pointerType === "touch" && (i(a) || (s(a), ut(a, r())));
|
|
609
|
+
}, c = (a) => {
|
|
610
|
+
(function(u, f) {
|
|
611
|
+
bt(u, () => {
|
|
612
|
+
u.preventDefault(), f && u.stopPropagation();
|
|
613
|
+
});
|
|
614
|
+
})(a, r());
|
|
615
|
+
};
|
|
616
|
+
return W(n.registerCommand(se, () => (J("check"), !0), _), n.registerCommand(Jt, (a) => gt(a, n, !1), _), n.registerCommand(zt, (a) => gt(a, n, !0), _), n.registerCommand(Vt, () => {
|
|
617
|
+
if (H(n) != null) {
|
|
618
|
+
const a = n.getRootElement();
|
|
619
|
+
return a?.focus(), !0;
|
|
620
|
+
}
|
|
621
|
+
return !1;
|
|
622
|
+
}, _), n.registerCommand(Ut, (a) => {
|
|
623
|
+
const u = H(n);
|
|
624
|
+
return !(u == null || !n.isEditable()) && (n.update(() => {
|
|
625
|
+
const f = X(u);
|
|
626
|
+
h(f) && (a.preventDefault(), f.toggleChecked());
|
|
627
|
+
}), !0);
|
|
628
|
+
}, _), n.registerCommand(Wt, (a) => n.read("latest", () => {
|
|
629
|
+
const u = x();
|
|
630
|
+
if (k(u) && u.isCollapsed()) {
|
|
631
|
+
const { anchor: f } = u, d = f.type === "element";
|
|
632
|
+
if (d || f.offset === 0) {
|
|
633
|
+
const T = f.getNode(), p = q(T, (O) => L(O) && !O.isInline());
|
|
634
|
+
if (h(p)) {
|
|
635
|
+
const O = p.getParent();
|
|
636
|
+
if (g(O) && O.getListType() === "check" && (d || p.getFirstDescendant() === T)) {
|
|
637
|
+
const S = n.getElementByKey(p.__key);
|
|
638
|
+
if (S != null && Ct(S) !== S) return S.focus(), a.preventDefault(), !0;
|
|
639
|
+
}
|
|
640
|
+
}
|
|
641
|
+
}
|
|
642
|
+
}
|
|
643
|
+
return !1;
|
|
644
|
+
}), _), n.registerRootListener((a) => {
|
|
645
|
+
if (a !== null) return W(et(a, { click: o, pointerup: l }), et(a, { mousedown: c, pointerdown: c }, { capture: !0 }), Bt(a, "touchstart", c, { capture: !0, passive: !1 }));
|
|
646
|
+
}));
|
|
647
|
+
}
|
|
648
|
+
function bt(n, e) {
|
|
649
|
+
const t = n.target;
|
|
650
|
+
if (!y(t)) return;
|
|
651
|
+
const r = t.firstChild;
|
|
652
|
+
if (y(r) && (r.tagName === "UL" || r.tagName === "OL")) return;
|
|
653
|
+
const i = t.parentNode;
|
|
654
|
+
if (!i || i.__lexicalListType !== "check") return;
|
|
655
|
+
let s = null, o = null;
|
|
656
|
+
if ("clientX" in n) s = n.clientX;
|
|
657
|
+
else if ("touches" in n) {
|
|
658
|
+
const T = n.touches;
|
|
659
|
+
T.length > 0 && (s = T[0].clientX, o = "touch");
|
|
660
|
+
}
|
|
661
|
+
if (s == null) return;
|
|
662
|
+
const l = t.getBoundingClientRect(), c = s / At(t), a = t.ownerDocument.defaultView, u = a ? a.getComputedStyle(t, "::before") : { width: "0px" }, f = parseFloat(u.width), d = o === "touch" || "pointerType" in n && n.pointerType === "touch" ? 32 : 0;
|
|
663
|
+
(t.dir === "rtl" ? c < l.right + d && c > l.right - f - d : c > l.left - d && c < l.left + f + d) && e();
|
|
664
|
+
}
|
|
665
|
+
function ut(n, e) {
|
|
666
|
+
bt(n, () => {
|
|
667
|
+
if (y(n.target)) {
|
|
668
|
+
const t = n.target, r = Yt(t);
|
|
669
|
+
r != null && r.isEditable() && r.update(() => {
|
|
670
|
+
const i = X(t);
|
|
671
|
+
h(i) && (e ? (it(qt), it(Xt)) : t.focus(), i.toggleChecked());
|
|
672
|
+
});
|
|
673
|
+
}
|
|
674
|
+
});
|
|
675
|
+
}
|
|
676
|
+
function H(n) {
|
|
677
|
+
const e = n.getRootElement(), t = e ? Ct(e) : null;
|
|
678
|
+
return y(t) && t.tagName === "LI" && t.parentNode != null && t.parentNode.__lexicalListType === "check" ? t : null;
|
|
679
|
+
}
|
|
680
|
+
function gt(n, e, t) {
|
|
681
|
+
const r = H(e);
|
|
682
|
+
return r != null && e.update(() => {
|
|
683
|
+
const i = X(r);
|
|
684
|
+
if (!h(i)) return;
|
|
685
|
+
const s = (function(o, l) {
|
|
686
|
+
let c = l ? o.getPreviousSibling() : o.getNextSibling(), a = o;
|
|
687
|
+
for (; c == null && h(a); ) a = a.getParentOrThrow().getParent(), a != null && (c = l ? a.getPreviousSibling() : a.getNextSibling());
|
|
688
|
+
for (; h(c); ) {
|
|
689
|
+
const u = l ? c.getLastChild() : c.getFirstChild();
|
|
690
|
+
if (!g(u)) return c;
|
|
691
|
+
c = l ? u.getLastChild() : u.getFirstChild();
|
|
692
|
+
}
|
|
693
|
+
return null;
|
|
694
|
+
})(i, t);
|
|
695
|
+
if (s != null) {
|
|
696
|
+
s.selectStart();
|
|
697
|
+
const o = e.getElementByKey(s.__key);
|
|
698
|
+
o != null && (n.preventDefault(), setTimeout(() => {
|
|
699
|
+
o.focus();
|
|
700
|
+
}, 0));
|
|
701
|
+
}
|
|
702
|
+
}), !1;
|
|
703
|
+
}
|
|
704
|
+
function ie(n) {
|
|
705
|
+
const e = [];
|
|
706
|
+
for (const t of n) if (h(t)) {
|
|
707
|
+
e.push(t);
|
|
708
|
+
const r = t.getChildren();
|
|
709
|
+
if (r.length > 1) for (const i of r) g(i) && e.push(v().append(i));
|
|
710
|
+
} else e.push(v().append(t));
|
|
711
|
+
return e;
|
|
712
|
+
}
|
|
713
|
+
const oe = /* @__PURE__ */ w({ $import: (n, e) => {
|
|
714
|
+
let t;
|
|
715
|
+
var r;
|
|
716
|
+
return Tt(e, "ol") ? t = N("number", e.start) : t = (r = e).matches('[__lexicallisttype="check"], .contains-task-list, [data-is-checklist="1"]') || r.querySelector(":scope > [aria-checked]") !== null ? N("check") : N("bullet"), I(t, e), [t.splice(0, 0, jt(ie(n.$importChildren(e)), e))];
|
|
717
|
+
}, match: K.tag("ol", "ul"), name: "@lexical/list/list" });
|
|
718
|
+
function Lt(n, e) {
|
|
719
|
+
if (e.length !== 1) return e;
|
|
720
|
+
const t = e[0];
|
|
721
|
+
return Y(t) && !n.getFormatType() && t.getFormatType() ? (n.setFormat(t.getFormatType()), t.getChildren()) : e;
|
|
722
|
+
}
|
|
723
|
+
function xt(n) {
|
|
724
|
+
const e = (o) => Gt(o) && !g(o);
|
|
725
|
+
if (!n.some(e)) return n;
|
|
726
|
+
const t = [];
|
|
727
|
+
let r = [];
|
|
728
|
+
const i = () => {
|
|
729
|
+
r.length > 0 && (t.push(r), r = []);
|
|
730
|
+
};
|
|
731
|
+
for (const o of n) e(o) ? (i(), t.push(L(o) ? o.getChildren() : [o])) : r.push(o);
|
|
732
|
+
i();
|
|
733
|
+
const s = [];
|
|
734
|
+
for (const o of t) s.length > 0 && s.push(Ht()), s.push(...o);
|
|
735
|
+
return s;
|
|
736
|
+
}
|
|
737
|
+
const le = /* @__PURE__ */ w({ $import: (n, e) => {
|
|
738
|
+
const t = e.getAttribute("aria-checked"), r = v(t === "true" || t !== "false" && void 0);
|
|
739
|
+
return j(r, e), I(r, e), [r.splice(0, 0, xt(Lt(r, n.$importChildren(e))))];
|
|
740
|
+
}, match: K.tag("li"), name: "@lexical/list/li" });
|
|
741
|
+
function ht(n, e, t) {
|
|
742
|
+
const r = Tt(t, "input") ? t : t.querySelector('input[type="checkbox"]');
|
|
743
|
+
if (!r || r.getAttribute("type") !== "checkbox") return [];
|
|
744
|
+
const i = v(r.hasAttribute("checked"));
|
|
745
|
+
return j(i, e), I(i, e), [i.splice(0, 0, xt(Lt(i, n.$importChildren(e))))];
|
|
746
|
+
}
|
|
747
|
+
K.tag("li").classAll("task-list-item"), K.tag("li").classAll("joplin-checkbox");
|
|
748
|
+
const ae = /* @__PURE__ */ D("UPDATE_LIST_START_COMMAND"), ce = /* @__PURE__ */ D("INSERT_UNORDERED_LIST_COMMAND"), ue = /* @__PURE__ */ D("INSERT_ORDERED_LIST_COMMAND"), ge = /* @__PURE__ */ D("REMOVE_LIST_COMMAND");
|
|
749
|
+
function me(n, e) {
|
|
750
|
+
return W(n.registerCommand(ue, () => (J("number"), !0), _), n.registerCommand(ae, (t) => {
|
|
751
|
+
const { listNodeKey: r, newStart: i } = t, s = Kt(r);
|
|
752
|
+
return !!g(s) && (s.getListType() === "number" && (s.setStart(i), kt(s)), !0);
|
|
753
|
+
}, _), n.registerCommand(ce, () => (J("bullet"), !0), _), n.registerCommand(ge, () => (Zt(), !0), _), n.registerCommand(wt, () => ee(!!(e && e.restoreNumbering)), _), n.registerCommand(It, (t) => !!(function() {
|
|
754
|
+
const r = x();
|
|
755
|
+
if (!k(r) || !r.isCollapsed() || r.anchor.offset !== 0) return !1;
|
|
756
|
+
const i = r.anchor.getNode(), s = q(i, h);
|
|
757
|
+
if (!h(s)) return !1;
|
|
758
|
+
const o = s.getFirstDescendant();
|
|
759
|
+
if (o === null || !s.is(i) && !o.is(i)) return !1;
|
|
760
|
+
const l = s.getParent();
|
|
761
|
+
if (!g(l) || !s.is(l.getFirstChild())) return !1;
|
|
762
|
+
const c = l.getPreviousSibling();
|
|
763
|
+
if (!$t(c) || c.isIsolated() || !c.isKeyboardSelectable() && c.isInline()) return !1;
|
|
764
|
+
const a = M().append(...s.getChildren());
|
|
765
|
+
return l.insertBefore(a), s.remove(), l.isEmpty() && l.remove(), a.selectStart(), !0;
|
|
766
|
+
})() && (t.preventDefault(), !0), Rt), n.registerNodeTransform(B, (t) => {
|
|
767
|
+
const r = t.getFirstChild();
|
|
768
|
+
if (r) {
|
|
769
|
+
if (U(r)) {
|
|
770
|
+
const i = r.getStyle(), s = r.getFormat();
|
|
771
|
+
t.getTextStyle() !== i && t.setTextStyle(i), t.getTextFormat() !== s && t.setTextFormat(s);
|
|
772
|
+
}
|
|
773
|
+
} else {
|
|
774
|
+
const i = x();
|
|
775
|
+
k(i) && (i.style !== t.getTextStyle() || i.format !== t.getTextFormat()) && i.isCollapsed() && t.is(i.anchor.getNode()) && t.setTextStyle(i.style).setTextFormat(i.format);
|
|
776
|
+
}
|
|
777
|
+
}), n.registerNodeTransform(Dt, (t) => {
|
|
778
|
+
const r = t.getParent();
|
|
779
|
+
if (h(r) && t.is(r.getFirstChild())) {
|
|
780
|
+
const i = t.getStyle(), s = t.getFormat();
|
|
781
|
+
i === r.getTextStyle() && s === r.getTextFormat() || r.setTextStyle(i).setTextFormat(s);
|
|
782
|
+
}
|
|
783
|
+
}));
|
|
784
|
+
}
|
|
785
|
+
function _e(n) {
|
|
786
|
+
const e = (t) => {
|
|
787
|
+
const r = t.getParent();
|
|
788
|
+
if (g(t.getFirstChild()) || !g(r)) return;
|
|
789
|
+
const i = q(t, (s) => h(s) && g(s.getParent()) && h(s.getPreviousSibling()));
|
|
790
|
+
if (i === null && t.getIndent() > 0) t.setIndent(0);
|
|
791
|
+
else if (h(i)) {
|
|
792
|
+
const s = i.getPreviousSibling();
|
|
793
|
+
if (h(s)) {
|
|
794
|
+
const o = (function(c) {
|
|
795
|
+
let a = c, u = a.getFirstChild();
|
|
796
|
+
for (; g(u); ) {
|
|
797
|
+
const f = u.getLastChild();
|
|
798
|
+
if (!h(f)) break;
|
|
799
|
+
a = f, u = a.getFirstChild();
|
|
800
|
+
}
|
|
801
|
+
return a;
|
|
802
|
+
})(s), l = o.getParent();
|
|
803
|
+
if (g(l)) {
|
|
804
|
+
const c = V(l);
|
|
805
|
+
c + 1 < V(r) && t.setIndent(c);
|
|
806
|
+
}
|
|
807
|
+
}
|
|
808
|
+
}
|
|
809
|
+
};
|
|
810
|
+
return n.registerNodeTransform(Z, (t) => {
|
|
811
|
+
const r = [t];
|
|
812
|
+
for (; r.length > 0; ) {
|
|
813
|
+
const i = r.shift();
|
|
814
|
+
if (g(i)) {
|
|
815
|
+
for (const s of i.getChildren()) if (h(s)) {
|
|
816
|
+
e(s);
|
|
817
|
+
const o = s.getFirstChild();
|
|
818
|
+
g(o) && r.push(o);
|
|
819
|
+
}
|
|
820
|
+
}
|
|
821
|
+
}
|
|
822
|
+
});
|
|
823
|
+
}
|
|
824
|
+
export {
|
|
825
|
+
v as $createListItemNode,
|
|
826
|
+
N as $createListNode,
|
|
827
|
+
V as $getListDepth,
|
|
828
|
+
ee as $handleListInsertParagraph,
|
|
829
|
+
J as $insertList,
|
|
830
|
+
h as $isListItemNode,
|
|
831
|
+
g as $isListNode,
|
|
832
|
+
Zt as $removeList,
|
|
833
|
+
se as INSERT_CHECK_LIST_COMMAND,
|
|
834
|
+
ue as INSERT_ORDERED_LIST_COMMAND,
|
|
835
|
+
ce as INSERT_UNORDERED_LIST_COMMAND,
|
|
836
|
+
B as ListItemNode,
|
|
837
|
+
Z as ListNode,
|
|
838
|
+
ge as REMOVE_LIST_COMMAND,
|
|
839
|
+
ae as UPDATE_LIST_START_COMMAND,
|
|
840
|
+
pe as registerCheckList,
|
|
841
|
+
me as registerList,
|
|
842
|
+
_e as registerListStrictIndentTransform
|
|
843
|
+
};
|