laif-ds 0.1.76 → 0.1.80
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/_virtual/index.js +5 -3
- package/dist/_virtual/index2.js +5 -2
- package/dist/_virtual/index3.js +5 -5
- package/dist/_virtual/index4.js +2 -5
- package/dist/_virtual/index5.js +2 -5
- package/dist/_virtual/index7.js +3 -2
- package/dist/_virtual/prism-cpp.js +3 -0
- package/dist/_virtual/prism-cpp2.js +5 -0
- package/dist/_virtual/prism-java.js +3 -0
- package/dist/_virtual/prism-java2.js +5 -0
- package/dist/_virtual/prism-python.js +3 -0
- package/dist/_virtual/prism-python2.js +5 -0
- package/dist/_virtual/prism-rust.js +3 -0
- package/dist/_virtual/prism-rust2.js +5 -0
- package/dist/_virtual/prism-typescript.js +3 -0
- package/dist/_virtual/prism-typescript2.js +5 -0
- package/dist/_virtual/prism.js +3 -0
- package/dist/_virtual/prism2.js +5 -0
- package/dist/components/editor/context/toolbar-context.js +42 -0
- package/dist/components/editor/editor-hooks/use-modal.js +30 -0
- package/dist/components/editor/editor-hooks/use-update-toolbar.js +24 -0
- package/dist/components/editor/editor-ui/content-editable.js +26 -0
- package/dist/components/editor/plugins/actions/actions-plugin.js +7 -0
- package/dist/components/editor/plugins/actions/clear-editor-plugin.js +39 -0
- package/dist/components/editor/plugins/actions/counter-character-plugin.js +53 -0
- package/dist/components/editor/plugins/toolbar/block-format/block-format-data.js +52 -0
- package/dist/components/editor/plugins/toolbar/block-format/format-bulleted-list.js +26 -0
- package/dist/components/editor/plugins/toolbar/block-format/format-check-list.js +26 -0
- package/dist/components/editor/plugins/toolbar/block-format/format-heading.js +31 -0
- package/dist/components/editor/plugins/toolbar/block-format/format-numbered-list.js +26 -0
- package/dist/components/editor/plugins/toolbar/block-format/format-paragraph.js +23 -0
- package/dist/components/editor/plugins/toolbar/block-format/format-quote.js +24 -0
- package/dist/components/editor/plugins/toolbar/block-format-toolbar-plugin.js +56 -0
- package/dist/components/editor/plugins/toolbar/font-format-toolbar-plugin.js +50 -0
- package/dist/components/editor/plugins/toolbar/history-toolbar-plugin.js +69 -0
- package/dist/components/editor/plugins/toolbar/toolbar-plugin.js +34 -0
- package/dist/components/editor/themes/editor-theme.js +112 -0
- package/dist/components/ui/app-editor.js +150 -0
- package/dist/components/ui/app-multiple-select-dropdown.js +2 -2
- package/dist/components/ui/button.js +25 -24
- package/dist/components/ui/calendar.js +9 -9
- package/dist/components/ui/dialog.js +43 -37
- package/dist/components/ui/sidebar.js +20 -19
- package/dist/index.d.ts +23 -1
- package/dist/index.js +48 -44
- package/dist/laif-ds.css +1 -0
- package/dist/node_modules/@lexical/clipboard/LexicalClipboard.prod.js +159 -0
- package/dist/node_modules/@lexical/code/LexicalCode.prod.js +236 -0
- package/dist/node_modules/@lexical/dragon/LexicalDragon.prod.js +46 -0
- package/dist/node_modules/@lexical/history/LexicalHistory.prod.js +89 -0
- package/dist/node_modules/@lexical/html/LexicalHtml.prod.js +108 -0
- package/dist/node_modules/@lexical/link/LexicalLink.prod.js +187 -0
- package/dist/node_modules/@lexical/list/LexicalList.prod.js +729 -0
- package/dist/node_modules/@lexical/markdown/LexicalMarkdown.prod.js +367 -0
- package/dist/node_modules/@lexical/react/LexicalCheckListPlugin.prod.js +11 -0
- package/dist/node_modules/@lexical/react/LexicalClearEditorPlugin.prod.js +17 -0
- package/dist/node_modules/@lexical/react/LexicalComposer.prod.js +45 -0
- package/dist/node_modules/@lexical/react/LexicalComposerContext.prod.js +22 -0
- package/dist/node_modules/@lexical/react/LexicalContentEditable.prod.js +55 -0
- package/dist/node_modules/@lexical/react/LexicalErrorBoundary.prod.js +49 -0
- package/dist/node_modules/@lexical/react/LexicalHistoryPlugin.prod.js +15 -0
- package/dist/node_modules/@lexical/react/LexicalListPlugin.prod.js +17 -0
- package/dist/node_modules/@lexical/react/LexicalOnChangePlugin.prod.js +16 -0
- package/dist/node_modules/@lexical/react/LexicalRichTextPlugin.prod.js +56 -0
- package/dist/node_modules/@lexical/react/useLexicalEditable.prod.js +21 -0
- package/dist/node_modules/@lexical/rich-text/LexicalRichText.prod.js +376 -0
- package/dist/node_modules/@lexical/selection/LexicalSelection.prod.js +107 -0
- package/dist/node_modules/@lexical/table/LexicalTable.prod.js +661 -0
- package/dist/node_modules/@lexical/text/LexicalText.prod.js +37 -0
- package/dist/node_modules/@lexical/utils/LexicalUtils.prod.js +102 -0
- package/dist/node_modules/@radix-ui/react-use-is-hydrated/dist/index.js +1 -1
- package/dist/node_modules/eventemitter3/index.js +1 -1
- package/dist/node_modules/eventemitter3/index2.js +1 -1
- package/dist/node_modules/hast-util-to-jsx-runtime/lib/index.js +1 -1
- package/dist/node_modules/lexical/Lexical.prod.js +4901 -0
- package/dist/node_modules/prismjs/components/prism-c.js +77 -0
- package/dist/node_modules/prismjs/components/prism-clike.js +32 -0
- package/dist/node_modules/prismjs/components/prism-cpp.js +93 -0
- package/dist/node_modules/prismjs/components/prism-css.js +56 -0
- package/dist/node_modules/prismjs/components/prism-java.js +122 -0
- package/dist/node_modules/prismjs/components/prism-javascript.js +138 -0
- package/dist/node_modules/prismjs/components/prism-markdown.js +301 -0
- package/dist/node_modules/prismjs/components/prism-markup.js +174 -0
- package/dist/node_modules/prismjs/components/prism-objectivec.js +11 -0
- package/dist/node_modules/prismjs/components/prism-powershell.js +56 -0
- package/dist/node_modules/prismjs/components/prism-python.js +69 -0
- package/dist/node_modules/prismjs/components/prism-rust.js +124 -0
- package/dist/node_modules/prismjs/components/prism-sql.js +34 -0
- package/dist/node_modules/prismjs/components/prism-swift.js +114 -0
- package/dist/node_modules/prismjs/components/prism-typescript.js +53 -0
- package/dist/node_modules/prismjs/prism.js +1165 -0
- package/dist/node_modules/recharts/es6/util/Events.js +1 -1
- package/dist/node_modules/unified/lib/index.js +1 -1
- package/dist/node_modules/use-sync-external-store/shim/index.js +1 -1
- package/dist/styles.v3.css +1 -1
- package/package.json +12 -1
|
@@ -0,0 +1,367 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { $getRoot as O, $createLineBreakNode as D, $createTextNode as y, $isElementNode as I, $isDecoratorNode as B, $isParagraphNode as k, $isTextNode as N, $getSelection as J, $isLineBreakNode as V, $createParagraphNode as Y } from "../../lexical/Lexical.prod.js";
|
|
3
|
+
import { ListNode as w, ListItemNode as P, $isListNode as $, $createListItemNode as Z, $createListNode as tt, $isListItemNode as j } from "../list/LexicalList.prod.js";
|
|
4
|
+
import { HeadingNode as et, QuoteNode as nt, $isHeadingNode as ot, $isQuoteNode as L, $createQuoteNode as rt, $createHeadingNode as st } from "../rich-text/LexicalRichText.prod.js";
|
|
5
|
+
import { $findMatchingParent as it } from "../utils/LexicalUtils.prod.js";
|
|
6
|
+
import { CodeNode as at, $createCodeNode as R, $isCodeNode as lt } from "../code/LexicalCode.prod.js";
|
|
7
|
+
import { LinkNode as ct, $createLinkNode as ft, $isLinkNode as ut, $isAutoLinkNode as dt } from "../link/LexicalLink.prod.js";
|
|
8
|
+
function gt(t, e) {
|
|
9
|
+
const r = {};
|
|
10
|
+
for (const s of t) {
|
|
11
|
+
const n = e(s);
|
|
12
|
+
n && (r[n] ? r[n].push(s) : r[n] = [s]);
|
|
13
|
+
}
|
|
14
|
+
return r;
|
|
15
|
+
}
|
|
16
|
+
function H(t) {
|
|
17
|
+
const e = gt(t, (r) => r.type);
|
|
18
|
+
return { element: e.element || [], multilineElement: e["multiline-element"] || [], textFormat: e["text-format"] || [], textMatch: e["text-match"] || [] };
|
|
19
|
+
}
|
|
20
|
+
const v = /[!-/:-@[-`{-~\s]/, pt = /^\s{0,3}$/;
|
|
21
|
+
function b(t) {
|
|
22
|
+
if (!k(t)) return !1;
|
|
23
|
+
const e = t.getFirstChild();
|
|
24
|
+
return e == null || t.getChildrenSize() === 1 && N(e) && pt.test(e.getTextContent());
|
|
25
|
+
}
|
|
26
|
+
function mt(t, e, r, s) {
|
|
27
|
+
for (const n of e) {
|
|
28
|
+
if (!n.export) continue;
|
|
29
|
+
const f = n.export(t, (o) => C(o, r, s));
|
|
30
|
+
if (f != null) return f;
|
|
31
|
+
}
|
|
32
|
+
return I(t) ? C(t, r, s) : B(t) ? t.getTextContent() : null;
|
|
33
|
+
}
|
|
34
|
+
function C(t, e, r, s, n) {
|
|
35
|
+
const f = [], o = t.getChildren();
|
|
36
|
+
s || (s = []), n || (n = []);
|
|
37
|
+
t: for (const a of o) {
|
|
38
|
+
for (const u of r) {
|
|
39
|
+
if (!u.export) continue;
|
|
40
|
+
const c = u.export(a, (i) => C(i, e, r, s, [...n, ...s]), (i, g) => F(i, g, e, s, n));
|
|
41
|
+
if (c != null) {
|
|
42
|
+
f.push(c);
|
|
43
|
+
continue t;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
V(a) ? f.push(`
|
|
47
|
+
`) : N(a) ? f.push(F(a, a.getTextContent(), e, s, n)) : I(a) ? f.push(C(a, e, r, s, n)) : B(a) && f.push(a.getTextContent());
|
|
48
|
+
}
|
|
49
|
+
return f.join("");
|
|
50
|
+
}
|
|
51
|
+
function F(t, e, r, s, n) {
|
|
52
|
+
let f = t.getFormat() === 0 ? e : function(l) {
|
|
53
|
+
return l.replace(/^\s+|\s+$/g, (d) => [...d].map((p) => "&#" + p.codePointAt(0) + ";").join(""));
|
|
54
|
+
}(e);
|
|
55
|
+
t.hasFormat("code") || (f = f.replace(/([*_`~\\])/g, "\\$1"));
|
|
56
|
+
let o = "", a = "", u = "";
|
|
57
|
+
const c = M(t, !0), i = M(t, !1), g = /* @__PURE__ */ new Set();
|
|
58
|
+
for (const l of r) {
|
|
59
|
+
const d = l.format[0], p = l.tag;
|
|
60
|
+
S(t, d) && !g.has(d) && (g.add(d), S(c, d) && s.find((m) => m.tag === p) || (s.push({ format: d, tag: p }), o += p));
|
|
61
|
+
}
|
|
62
|
+
for (let l = 0; l < s.length; l++) {
|
|
63
|
+
const d = S(t, s[l].format), p = S(i, s[l].format);
|
|
64
|
+
if (d && p) continue;
|
|
65
|
+
const m = [...s];
|
|
66
|
+
for (; m.length > l; ) {
|
|
67
|
+
const h = m.pop();
|
|
68
|
+
n && h && n.find((T) => T.tag === h.tag) || (h && typeof h.tag == "string" && (d ? p || (u += h.tag) : a += h.tag), s.pop());
|
|
69
|
+
}
|
|
70
|
+
break;
|
|
71
|
+
}
|
|
72
|
+
return f = o + f + u, a + f;
|
|
73
|
+
}
|
|
74
|
+
function M(t, e) {
|
|
75
|
+
let r = e ? t.getPreviousSibling() : t.getNextSibling();
|
|
76
|
+
if (!r) {
|
|
77
|
+
const s = t.getParentOrThrow();
|
|
78
|
+
s.isInline() && (r = e ? s.getPreviousSibling() : s.getNextSibling());
|
|
79
|
+
}
|
|
80
|
+
for (; r; ) {
|
|
81
|
+
if (I(r)) {
|
|
82
|
+
if (!r.isInline()) break;
|
|
83
|
+
const s = e ? r.getLastDescendant() : r.getFirstDescendant();
|
|
84
|
+
if (N(s)) return s;
|
|
85
|
+
r = e ? r.getPreviousSibling() : r.getNextSibling();
|
|
86
|
+
}
|
|
87
|
+
if (N(r)) return r;
|
|
88
|
+
if (!I(r)) return null;
|
|
89
|
+
}
|
|
90
|
+
return null;
|
|
91
|
+
}
|
|
92
|
+
function S(t, e) {
|
|
93
|
+
return N(t) && t.hasFormat(e);
|
|
94
|
+
}
|
|
95
|
+
function ht(t, e) {
|
|
96
|
+
const r = function(n, f) {
|
|
97
|
+
const o = n.match(f.openTagsRegExp);
|
|
98
|
+
if (o == null) return null;
|
|
99
|
+
for (const a of o) {
|
|
100
|
+
const u = a.replace(/^\s/, ""), c = f.fullMatchRegExpByTag[u];
|
|
101
|
+
if (c == null) continue;
|
|
102
|
+
const i = n.match(c), g = f.transformersByTag[u];
|
|
103
|
+
if (i != null && g != null) {
|
|
104
|
+
if (g.intraword !== !1) return i;
|
|
105
|
+
const { index: l = 0 } = i, d = n[l - 1], p = n[l + i[0].length];
|
|
106
|
+
if ((!d || v.test(d)) && (!p || v.test(p))) return i;
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
return null;
|
|
110
|
+
}(t.getTextContent(), e);
|
|
111
|
+
if (!r) return null;
|
|
112
|
+
const s = r.index || 0;
|
|
113
|
+
return { endIndex: s + r[0].length, match: r, startIndex: s, transformer: e.transformersByTag[r[1]] };
|
|
114
|
+
}
|
|
115
|
+
function E(t) {
|
|
116
|
+
return N(t) && !t.hasFormat("code");
|
|
117
|
+
}
|
|
118
|
+
function x(t, e, r) {
|
|
119
|
+
let s = ht(t, e), n = function(o, a) {
|
|
120
|
+
const u = o;
|
|
121
|
+
let c, i, g, l;
|
|
122
|
+
for (const d of a) {
|
|
123
|
+
if (!d.replace || !d.importRegExp) continue;
|
|
124
|
+
const p = u.getTextContent().match(d.importRegExp);
|
|
125
|
+
if (!p) continue;
|
|
126
|
+
const m = p.index || 0, h = d.getEndIndex ? d.getEndIndex(u, p) : m + p[0].length;
|
|
127
|
+
h !== !1 && (c === void 0 || i === void 0 || m < c && h > i) && (c = m, i = h, g = d, l = p);
|
|
128
|
+
}
|
|
129
|
+
return c === void 0 || i === void 0 || g === void 0 || l === void 0 ? null : { endIndex: i, match: l, startIndex: c, transformer: g };
|
|
130
|
+
}(t, r);
|
|
131
|
+
if (s && n && (s.startIndex <= n.startIndex && s.endIndex >= n.endIndex ? n = null : s = null), s) {
|
|
132
|
+
const o = function(a, u, c, i, g) {
|
|
133
|
+
const l = a.getTextContent();
|
|
134
|
+
let d, p, m;
|
|
135
|
+
if (g[0] === l ? d = a : u === 0 ? [d, p] = a.splitText(c) : [m, d, p] = a.splitText(u, c), d.setTextContent(g[2]), i) for (const h of i.format) d.hasFormat(h) || d.toggleFormat(h);
|
|
136
|
+
return { nodeAfter: p, nodeBefore: m, transformedNode: d };
|
|
137
|
+
}(t, s.startIndex, s.endIndex, s.transformer, s.match);
|
|
138
|
+
E(o.nodeAfter) && x(o.nodeAfter, e, r), E(o.nodeBefore) && x(o.nodeBefore, e, r), E(o.transformedNode) && x(o.transformedNode, e, r);
|
|
139
|
+
} else if (n) {
|
|
140
|
+
const o = function(a, u, c, i, g) {
|
|
141
|
+
let l, d, p;
|
|
142
|
+
return u === 0 ? [l, d] = a.splitText(c) : [p, l, d] = a.splitText(u, c), i.replace ? { nodeAfter: d, nodeBefore: p, transformedNode: i.replace(l, g) || void 0 } : null;
|
|
143
|
+
}(t, n.startIndex, n.endIndex, n.transformer, n.match);
|
|
144
|
+
if (!o) return;
|
|
145
|
+
E(o.nodeAfter) && x(o.nodeAfter, e, r), E(o.nodeBefore) && x(o.nodeBefore, e, r), E(o.transformedNode) && x(o.transformedNode, e, r);
|
|
146
|
+
}
|
|
147
|
+
const f = t.getTextContent().replace(/\\([*_`~\\])/g, "$1").replace(/&#(\d+);/g, (o, a) => String.fromCodePoint(a));
|
|
148
|
+
t.setTextContent(f);
|
|
149
|
+
}
|
|
150
|
+
function xt(t, e = !1) {
|
|
151
|
+
const r = H(t), s = function(n) {
|
|
152
|
+
const f = {}, o = {}, a = [], u = "(?<![\\\\])";
|
|
153
|
+
for (const c of n) {
|
|
154
|
+
const { tag: i } = c;
|
|
155
|
+
f[i] = c;
|
|
156
|
+
const g = i.replace(/(\*|\^|\+)/g, "\\$1");
|
|
157
|
+
a.push(g), i.length === 1 ? o[i] = new RegExp(`(?<![\\\\${g}])(${g})((\\\\${g})?.*?[^${g}\\s](\\\\${g})?)((?<!\\\\)|(?<=\\\\\\\\))(${g})(?![\\\\${g}])`) : o[i] = new RegExp(`(?<!\\\\)(${g})((\\\\${g})?.*?[^\\s](\\\\${g})?)((?<!\\\\)|(?<=\\\\\\\\))(${g})(?!\\\\)`);
|
|
158
|
+
}
|
|
159
|
+
return { fullMatchRegExpByTag: o, openTagsRegExp: new RegExp(`${u}(${a.join("|")})`, "g"), transformersByTag: f };
|
|
160
|
+
}(r.textFormat);
|
|
161
|
+
return (n, f) => {
|
|
162
|
+
const o = n.split(`
|
|
163
|
+
`), a = o.length, u = f || O();
|
|
164
|
+
u.clear();
|
|
165
|
+
for (let i = 0; i < a; i++) {
|
|
166
|
+
const g = o[i], [l, d] = $t(o, i, r.multilineElement, u);
|
|
167
|
+
l ? i = d : Et(g, u, r.element, s, r.textMatch, e);
|
|
168
|
+
}
|
|
169
|
+
const c = u.getChildren();
|
|
170
|
+
for (const i of c) !e && b(i) && u.getChildrenSize() > 1 && i.remove();
|
|
171
|
+
J() !== null && u.selectStart();
|
|
172
|
+
};
|
|
173
|
+
}
|
|
174
|
+
function $t(t, e, r, s) {
|
|
175
|
+
for (const n of r) {
|
|
176
|
+
const { handleImportAfterStartMatch: f, regExpEnd: o, regExpStart: a, replace: u } = n, c = t[e].match(a);
|
|
177
|
+
if (!c) continue;
|
|
178
|
+
if (f) {
|
|
179
|
+
const p = f({ lines: t, rootNode: s, startLineIndex: e, startMatch: c, transformer: n });
|
|
180
|
+
if (p === null) continue;
|
|
181
|
+
if (p) return p;
|
|
182
|
+
}
|
|
183
|
+
const i = typeof o == "object" && "regExp" in o ? o.regExp : o, g = o && typeof o == "object" && "optional" in o ? o.optional : !o;
|
|
184
|
+
let l = e;
|
|
185
|
+
const d = t.length;
|
|
186
|
+
for (; l < d; ) {
|
|
187
|
+
const p = i ? t[l].match(i) : null;
|
|
188
|
+
if (!p && (!g || g && l < d - 1)) {
|
|
189
|
+
l++;
|
|
190
|
+
continue;
|
|
191
|
+
}
|
|
192
|
+
if (p && e === l && p.index === c.index) {
|
|
193
|
+
l++;
|
|
194
|
+
continue;
|
|
195
|
+
}
|
|
196
|
+
const m = [];
|
|
197
|
+
if (p && e === l) m.push(t[e].slice(c[0].length, -p[0].length));
|
|
198
|
+
else for (let h = e; h <= l; h++) if (h === e) {
|
|
199
|
+
const T = t[h].slice(c[0].length);
|
|
200
|
+
m.push(T);
|
|
201
|
+
} else if (h === l && p) {
|
|
202
|
+
const T = t[h].slice(0, -p[0].length);
|
|
203
|
+
m.push(T);
|
|
204
|
+
} else m.push(t[h]);
|
|
205
|
+
if (u(s, null, c, p, m, !0) !== !1) return [!0, l];
|
|
206
|
+
break;
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
return [!1, e];
|
|
210
|
+
}
|
|
211
|
+
function Et(t, e, r, s, n, f) {
|
|
212
|
+
const o = y(t), a = Y();
|
|
213
|
+
a.append(o), e.append(a);
|
|
214
|
+
for (const { regExp: u, replace: c } of r) {
|
|
215
|
+
const i = t.match(u);
|
|
216
|
+
if (i && (o.setTextContent(t.slice(i[0].length)), c(a, [o], i, !0) !== !1)) break;
|
|
217
|
+
}
|
|
218
|
+
if (x(o, s, n), a.isAttached() && t.length > 0) {
|
|
219
|
+
const u = a.getPreviousSibling();
|
|
220
|
+
if (!f && (k(u) || L(u) || $(u))) {
|
|
221
|
+
let c = u;
|
|
222
|
+
if ($(u)) {
|
|
223
|
+
const i = u.getLastDescendant();
|
|
224
|
+
c = i == null ? null : it(i, j);
|
|
225
|
+
}
|
|
226
|
+
c != null && c.getTextContentSize() > 0 && (c.splice(c.getChildrenSize(), 0, [D(), ...a.getChildren()]), a.remove());
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
const U = /^(\s*)(\d{1,})\.\s/, z = /^(\s*)[-*+]\s/, Nt = /^(\s*)(?:-\s)?\s?(\[(\s|x)?\])\s/i, _ = /^(#{1,6})\s/, Q = /^>\s/, G = /^[ \t]*```(\w+)?/, K = /[ \t]*```$/, Tt = /^[ \t]*```[^`]+(?:(?:`{1,2}|`{4,})[^`]+)*```(?:[^`]|$)/, Rt = /^(?:\|)(.+)(?:\|)\s?$/, St = /^(\| ?:?-*:? ?)+\|\s?$/, X = (t) => (e, r, s, n) => {
|
|
231
|
+
const f = t(s);
|
|
232
|
+
f.append(...r), e.replace(f), n || f.select(0, 0);
|
|
233
|
+
}, W = (t) => (e, r, s, n) => {
|
|
234
|
+
const f = e.getPreviousSibling(), o = e.getNextSibling(), a = Z(t === "check" ? s[3] === "x" : void 0);
|
|
235
|
+
if ($(o) && o.getListType() === t) {
|
|
236
|
+
const c = o.getFirstChild();
|
|
237
|
+
c !== null ? c.insertBefore(a) : o.append(a), e.remove();
|
|
238
|
+
} else if ($(f) && f.getListType() === t) f.append(a), e.remove();
|
|
239
|
+
else {
|
|
240
|
+
const c = tt(t, t === "number" ? Number(s[2]) : void 0);
|
|
241
|
+
c.append(a), e.replace(c);
|
|
242
|
+
}
|
|
243
|
+
a.append(...r), n || a.select(0, 0);
|
|
244
|
+
const u = function(c) {
|
|
245
|
+
const i = c.match(/\t/g), g = c.match(/ /g);
|
|
246
|
+
let l = 0;
|
|
247
|
+
return i && (l += i.length), g && (l += Math.floor(g.length / 4)), l;
|
|
248
|
+
}(s[1]);
|
|
249
|
+
u && a.setIndent(u);
|
|
250
|
+
}, A = (t, e, r) => {
|
|
251
|
+
const s = [], n = t.getChildren();
|
|
252
|
+
let f = 0;
|
|
253
|
+
for (const o of n) if (j(o)) {
|
|
254
|
+
if (o.getChildrenSize() === 1) {
|
|
255
|
+
const i = o.getFirstChild();
|
|
256
|
+
if ($(i)) {
|
|
257
|
+
s.push(A(i, e, r + 1));
|
|
258
|
+
continue;
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
const a = " ".repeat(4 * r), u = t.getListType(), c = u === "number" ? `${t.getStart() + f}. ` : u === "check" ? `- [${o.getChecked() ? "x" : " "}] ` : "- ";
|
|
262
|
+
s.push(a + c + e(o)), f++;
|
|
263
|
+
}
|
|
264
|
+
return s.join(`
|
|
265
|
+
`);
|
|
266
|
+
}, It = { dependencies: [et], export: (t, e) => {
|
|
267
|
+
if (!ot(t)) return null;
|
|
268
|
+
const r = Number(t.getTag().slice(1));
|
|
269
|
+
return "#".repeat(r) + " " + e(t);
|
|
270
|
+
}, regExp: _, replace: X((t) => {
|
|
271
|
+
const e = "h" + t[1].length;
|
|
272
|
+
return st(e);
|
|
273
|
+
}), type: "element" }, Ct = { dependencies: [nt], export: (t, e) => {
|
|
274
|
+
if (!L(t)) return null;
|
|
275
|
+
const r = e(t).split(`
|
|
276
|
+
`), s = [];
|
|
277
|
+
for (const n of r) s.push("> " + n);
|
|
278
|
+
return s.join(`
|
|
279
|
+
`);
|
|
280
|
+
}, regExp: Q, replace: (t, e, r, s) => {
|
|
281
|
+
if (s) {
|
|
282
|
+
const f = t.getPreviousSibling();
|
|
283
|
+
if (L(f)) return f.splice(f.getChildrenSize(), 0, [D(), ...e]), void t.remove();
|
|
284
|
+
}
|
|
285
|
+
const n = rt();
|
|
286
|
+
n.append(...e), t.replace(n), s || n.select(0, 0);
|
|
287
|
+
}, type: "element" }, Lt = { dependencies: [at], export: (t) => {
|
|
288
|
+
if (!lt(t)) return null;
|
|
289
|
+
const e = t.getTextContent();
|
|
290
|
+
return "```" + (t.getLanguage() || "") + (e ? `
|
|
291
|
+
` + e : "") + "\n```";
|
|
292
|
+
}, regExpEnd: { optional: !0, regExp: K }, regExpStart: G, replace: (t, e, r, s, n, f) => {
|
|
293
|
+
let o, a;
|
|
294
|
+
if (!e && n) {
|
|
295
|
+
if (n.length === 1) s ? (o = R(), a = r[1] + n[0]) : (o = R(r[1]), a = n[0].startsWith(" ") ? n[0].slice(1) : n[0]);
|
|
296
|
+
else {
|
|
297
|
+
if (o = R(r[1]), n[0].trim().length === 0) for (; n.length > 0 && !n[0].length; ) n.shift();
|
|
298
|
+
else n[0] = n[0].startsWith(" ") ? n[0].slice(1) : n[0];
|
|
299
|
+
for (; n.length > 0 && !n[n.length - 1].length; ) n.pop();
|
|
300
|
+
a = n.join(`
|
|
301
|
+
`);
|
|
302
|
+
}
|
|
303
|
+
const u = y(a);
|
|
304
|
+
o.append(u), t.append(o);
|
|
305
|
+
} else e && X((u) => R(u ? u[1] : void 0))(t, e, r, f);
|
|
306
|
+
}, type: "multiline-element" }, bt = { dependencies: [w, P], export: (t, e) => $(t) ? A(t, e, 0) : null, regExp: z, replace: W("bullet"), type: "element" }, _t = { dependencies: [w, P], export: (t, e) => $(t) ? A(t, e, 0) : null, regExp: U, replace: W("number"), type: "element" }, yt = { format: ["code"], tag: "`", type: "text-format" }, At = { format: ["highlight"], tag: "==", type: "text-format" }, vt = { format: ["bold", "italic"], tag: "***", type: "text-format" }, Ft = { format: ["bold", "italic"], intraword: !1, tag: "___", type: "text-format" }, Mt = { format: ["bold"], tag: "**", type: "text-format" }, Ot = { format: ["bold"], intraword: !1, tag: "__", type: "text-format" }, Dt = { format: ["strikethrough"], tag: "~~", type: "text-format" }, Bt = { format: ["italic"], tag: "*", type: "text-format" }, kt = { format: ["italic"], intraword: !1, tag: "_", type: "text-format" }, wt = { dependencies: [ct], export: (t, e, r) => {
|
|
307
|
+
if (!ut(t) || dt(t)) return null;
|
|
308
|
+
const s = t.getTitle(), n = e(t);
|
|
309
|
+
return s ? `[${n}](${t.getURL()} "${s}")` : `[${n}](${t.getURL()})`;
|
|
310
|
+
}, importRegExp: /(?:\[([^[]+)\])(?:\((?:([^()\s]+)(?:\s"((?:[^"]*\\")*[^"]*)"\s*)?)\))/, regExp: /(?:\[([^[]+)\])(?:\((?:([^()\s]+)(?:\s"((?:[^"]*\\")*[^"]*)"\s*)?)\))$/, replace: (t, e) => {
|
|
311
|
+
const [, r, s, n] = e, f = ft(s, { title: n }), o = y(r);
|
|
312
|
+
return o.setFormat(t.getFormat()), f.append(o), t.replace(f), o;
|
|
313
|
+
}, trigger: ")", type: "text-match" }, Pt = [It, Ct, bt, _t], jt = [Lt], Ht = [yt, vt, Ft, Mt, Ot, At, Bt, kt, Dt], Ut = [wt], q = [...Pt, ...jt, ...Ht, ...Ut];
|
|
314
|
+
function qt(t, e = q, r, s = !1, n = !1) {
|
|
315
|
+
const f = s ? t : function(o, a = !1) {
|
|
316
|
+
const u = o.split(`
|
|
317
|
+
`);
|
|
318
|
+
let c = !1;
|
|
319
|
+
const i = [];
|
|
320
|
+
for (let g = 0; g < u.length; g++) {
|
|
321
|
+
const l = u[g], d = i[i.length - 1];
|
|
322
|
+
Tt.test(l) ? i.push(l) : G.test(l) || K.test(l) ? (c = !c, i.push(l)) : c || l === "" || d === "" || !d || _.test(d) || _.test(l) || Q.test(l) || U.test(l) || z.test(l) || Nt.test(l) || Rt.test(l) || St.test(l) || !a ? i.push(l) : i[i.length - 1] = d + l;
|
|
323
|
+
}
|
|
324
|
+
return i.join(`
|
|
325
|
+
`);
|
|
326
|
+
}(t, n);
|
|
327
|
+
return xt(e, s)(f, r);
|
|
328
|
+
}
|
|
329
|
+
function Jt(t = q, e, r = !1) {
|
|
330
|
+
return function(n, f = !1) {
|
|
331
|
+
const o = H(n), a = [...o.multilineElement, ...o.element], u = !f, c = o.textFormat.filter((i) => i.format.length === 1).sort((i, g) => Number(i.format.includes("code")) - Number(g.format.includes("code")));
|
|
332
|
+
return (i) => {
|
|
333
|
+
const g = [], l = (i || O()).getChildren();
|
|
334
|
+
for (let d = 0; d < l.length; d++) {
|
|
335
|
+
const p = l[d], m = mt(p, a, c, o.textMatch);
|
|
336
|
+
m != null && g.push(u && d > 0 && !b(p) && !b(l[d - 1]) ? `
|
|
337
|
+
`.concat(m) : m);
|
|
338
|
+
}
|
|
339
|
+
return g.join(`
|
|
340
|
+
`);
|
|
341
|
+
};
|
|
342
|
+
}(t, r)(e);
|
|
343
|
+
}
|
|
344
|
+
export {
|
|
345
|
+
qt as $convertFromMarkdownString,
|
|
346
|
+
Jt as $convertToMarkdownString,
|
|
347
|
+
vt as BOLD_ITALIC_STAR,
|
|
348
|
+
Ft as BOLD_ITALIC_UNDERSCORE,
|
|
349
|
+
Mt as BOLD_STAR,
|
|
350
|
+
Ot as BOLD_UNDERSCORE,
|
|
351
|
+
Lt as CODE,
|
|
352
|
+
Pt as ELEMENT_TRANSFORMERS,
|
|
353
|
+
It as HEADING,
|
|
354
|
+
At as HIGHLIGHT,
|
|
355
|
+
yt as INLINE_CODE,
|
|
356
|
+
Bt as ITALIC_STAR,
|
|
357
|
+
kt as ITALIC_UNDERSCORE,
|
|
358
|
+
wt as LINK,
|
|
359
|
+
jt as MULTILINE_ELEMENT_TRANSFORMERS,
|
|
360
|
+
_t as ORDERED_LIST,
|
|
361
|
+
Ct as QUOTE,
|
|
362
|
+
Dt as STRIKETHROUGH,
|
|
363
|
+
Ht as TEXT_FORMAT_TRANSFORMERS,
|
|
364
|
+
Ut as TEXT_MATCH_TRANSFORMERS,
|
|
365
|
+
q as TRANSFORMERS,
|
|
366
|
+
bt as UNORDERED_LIST
|
|
367
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { registerCheckList as t } from "../list/LexicalList.prod.js";
|
|
3
|
+
import { useLexicalComposerContext as o } from "./LexicalComposerContext.prod.js";
|
|
4
|
+
import { useEffect as r } from "react";
|
|
5
|
+
function n() {
|
|
6
|
+
const [e] = o();
|
|
7
|
+
return r(() => t(e), [e]), null;
|
|
8
|
+
}
|
|
9
|
+
export {
|
|
10
|
+
n as CheckListPlugin
|
|
11
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useLexicalComposerContext as r } from "./LexicalComposerContext.prod.js";
|
|
3
|
+
import { CLEAR_EDITOR_COMMAND as i, $getRoot as s, $getSelection as l, $createParagraphNode as u, $isRangeSelection as c, COMMAND_PRIORITY_EDITOR as d } from "../../lexical/Lexical.prod.js";
|
|
4
|
+
import { useLayoutEffect as m, useEffect as f } from "react";
|
|
5
|
+
const p = typeof window < "u" && window.document !== void 0 && window.document.createElement !== void 0 ? m : f;
|
|
6
|
+
function w({ onClear: e }) {
|
|
7
|
+
const [o] = r();
|
|
8
|
+
return p(() => o.registerCommand(i, (C) => (o.update(() => {
|
|
9
|
+
if (e == null) {
|
|
10
|
+
const n = s(), t = l(), a = u();
|
|
11
|
+
n.clear(), n.append(a), t !== null && a.select(), c(t) && (t.format = 0);
|
|
12
|
+
} else e();
|
|
13
|
+
}), !0), d), [o, e]), null;
|
|
14
|
+
}
|
|
15
|
+
export {
|
|
16
|
+
w as ClearEditorPlugin
|
|
17
|
+
};
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { createLexicalComposerContext as v, LexicalComposerContext as w } from "./LexicalComposerContext.prod.js";
|
|
3
|
+
import { createEditor as x, $getRoot as m, $createParagraphNode as C, $getSelection as S, HISTORY_MERGE_TAG as y } from "../../lexical/Lexical.prod.js";
|
|
4
|
+
import { useMemo as L, useLayoutEffect as R, useEffect as $ } from "react";
|
|
5
|
+
import { jsx as P } from "react/jsx-runtime";
|
|
6
|
+
const u = typeof window < "u" && window.document !== void 0 && window.document.createElement !== void 0, T = u ? R : $, i = { tag: y };
|
|
7
|
+
function N({ initialConfig: r, children: p }) {
|
|
8
|
+
const c = L(() => {
|
|
9
|
+
const { theme: o, namespace: s, nodes: f, onError: E, editorState: h, html: b } = r, g = v(null, o), a = x({ editable: r.editable, html: b, namespace: s, nodes: f, onError: (e) => E(e, a), theme: o });
|
|
10
|
+
return function(e, t) {
|
|
11
|
+
if (t !== null) {
|
|
12
|
+
if (t === void 0) e.update(() => {
|
|
13
|
+
const n = m();
|
|
14
|
+
if (n.isEmpty()) {
|
|
15
|
+
const l = C();
|
|
16
|
+
n.append(l);
|
|
17
|
+
const d = u ? document.activeElement : null;
|
|
18
|
+
(S() !== null || d !== null && d === e.getRootElement()) && l.select();
|
|
19
|
+
}
|
|
20
|
+
}, i);
|
|
21
|
+
else if (t !== null) switch (typeof t) {
|
|
22
|
+
case "string": {
|
|
23
|
+
const n = e.parseEditorState(t);
|
|
24
|
+
e.setEditorState(n, i);
|
|
25
|
+
break;
|
|
26
|
+
}
|
|
27
|
+
case "object":
|
|
28
|
+
e.setEditorState(t, i);
|
|
29
|
+
break;
|
|
30
|
+
case "function":
|
|
31
|
+
e.update(() => {
|
|
32
|
+
m().isEmpty() && t(e);
|
|
33
|
+
}, i);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}(a, h), [a, g];
|
|
37
|
+
}, []);
|
|
38
|
+
return T(() => {
|
|
39
|
+
const o = r.editable, [s] = c;
|
|
40
|
+
s.setEditable(o === void 0 || o);
|
|
41
|
+
}, []), P(w.Provider, { value: c, children: p });
|
|
42
|
+
}
|
|
43
|
+
export {
|
|
44
|
+
N as LexicalComposer
|
|
45
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { createContext as s, useContext as l } from "react";
|
|
3
|
+
const a = s(null);
|
|
4
|
+
function u(n, e) {
|
|
5
|
+
return { getTheme: function() {
|
|
6
|
+
return e ?? null;
|
|
7
|
+
} };
|
|
8
|
+
}
|
|
9
|
+
function f() {
|
|
10
|
+
const n = l(a);
|
|
11
|
+
return n == null && function(e, ...r) {
|
|
12
|
+
const o = new URL("https://lexical.dev/docs/error"), t = new URLSearchParams();
|
|
13
|
+
t.append("code", e);
|
|
14
|
+
for (const i of r) t.append("v", i);
|
|
15
|
+
throw o.search = t.toString(), Error(`Minified Lexical error #${e}; visit ${o.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`);
|
|
16
|
+
}(8), n;
|
|
17
|
+
}
|
|
18
|
+
export {
|
|
19
|
+
a as LexicalComposerContext,
|
|
20
|
+
u as createLexicalComposerContext,
|
|
21
|
+
f as useLexicalComposerContext
|
|
22
|
+
};
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useLexicalComposerContext as N } from "./LexicalComposerContext.prod.js";
|
|
3
|
+
import { forwardRef as C, useState as p, useLayoutEffect as h, useEffect as F, useCallback as O, useMemo as P } from "react";
|
|
4
|
+
import { jsxs as U, Fragment as V, jsx as m } from "react/jsx-runtime";
|
|
5
|
+
import { $canShowPlaceholderCurry as $ } from "../text/LexicalText.prod.js";
|
|
6
|
+
import { mergeRegister as G } from "../utils/LexicalUtils.prod.js";
|
|
7
|
+
const L = typeof window < "u" && window.document !== void 0 && window.document.createElement !== void 0 ? h : F;
|
|
8
|
+
function H({ editor: e, ariaActiveDescendant: t, ariaAutoComplete: l, ariaControls: d, ariaDescribedBy: n, ariaErrorMessage: o, ariaExpanded: a, ariaInvalid: u, ariaLabel: f, ariaLabelledBy: s, ariaMultiline: b, ariaOwns: k, ariaRequired: D, autoCapitalize: R, className: j, id: q, role: E = "textbox", spellCheck: z = !0, style: A, tabIndex: I, "data-testid": M, ...S }, v) {
|
|
9
|
+
const [r, w] = p(e.isEditable()), x = O((i) => {
|
|
10
|
+
i && i.ownerDocument && i.ownerDocument.defaultView ? e.setRootElement(i) : e.setRootElement(null);
|
|
11
|
+
}, [e]), B = P(() => /* @__PURE__ */ function(...i) {
|
|
12
|
+
return (g) => {
|
|
13
|
+
i.forEach((c) => {
|
|
14
|
+
typeof c == "function" ? c(g) : c != null && (c.current = g);
|
|
15
|
+
});
|
|
16
|
+
};
|
|
17
|
+
}(v, x), [x, v]);
|
|
18
|
+
return L(() => (w(e.isEditable()), e.registerEditableListener((i) => {
|
|
19
|
+
w(i);
|
|
20
|
+
})), [e]), m("div", { "aria-activedescendant": r ? t : void 0, "aria-autocomplete": r ? l : "none", "aria-controls": r ? d : void 0, "aria-describedby": n, ...o != null ? { "aria-errormessage": o } : {}, "aria-expanded": r && E === "combobox" ? !!a : void 0, ...u != null ? { "aria-invalid": u } : {}, "aria-label": f, "aria-labelledby": s, "aria-multiline": b, "aria-owns": r ? k : void 0, "aria-readonly": !r || void 0, "aria-required": D, autoCapitalize: R, className: j, contentEditable: r, "data-testid": M, id: q, ref: B, role: r ? E : void 0, spellCheck: z, style: A, tabIndex: I, ...S });
|
|
21
|
+
}
|
|
22
|
+
const J = C(H);
|
|
23
|
+
function y(e) {
|
|
24
|
+
return e.getEditorState().read($(e.isComposing()));
|
|
25
|
+
}
|
|
26
|
+
const _ = C(K);
|
|
27
|
+
function K(e, t) {
|
|
28
|
+
const { placeholder: l, ...d } = e, [n] = N();
|
|
29
|
+
return U(V, { children: [m(J, { editor: n, ...d, ref: t }), l != null && m(Q, { editor: n, content: l })] });
|
|
30
|
+
}
|
|
31
|
+
function Q({ content: e, editor: t }) {
|
|
32
|
+
const l = function(a) {
|
|
33
|
+
const [u, f] = p(() => y(a));
|
|
34
|
+
return L(() => {
|
|
35
|
+
function s() {
|
|
36
|
+
const b = y(a);
|
|
37
|
+
f(b);
|
|
38
|
+
}
|
|
39
|
+
return s(), G(a.registerUpdateListener(() => {
|
|
40
|
+
s();
|
|
41
|
+
}), a.registerEditableListener(() => {
|
|
42
|
+
s();
|
|
43
|
+
}));
|
|
44
|
+
}, [a]), u;
|
|
45
|
+
}(t), [d, n] = p(t.isEditable());
|
|
46
|
+
if (h(() => (n(t.isEditable()), t.registerEditableListener((a) => {
|
|
47
|
+
n(a);
|
|
48
|
+
})), [t]), !l) return null;
|
|
49
|
+
let o = null;
|
|
50
|
+
return typeof e == "function" ? o = e(d) : e !== null && (o = e), o === null ? null : m("div", { "aria-hidden": !0, children: o });
|
|
51
|
+
}
|
|
52
|
+
export {
|
|
53
|
+
_ as ContentEditable,
|
|
54
|
+
J as ContentEditableElement
|
|
55
|
+
};
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import * as d from "react";
|
|
3
|
+
import { jsx as y } from "react/jsx-runtime";
|
|
4
|
+
function h(i, s) {
|
|
5
|
+
return h = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function(c, p) {
|
|
6
|
+
return c.__proto__ = p, c;
|
|
7
|
+
}, h(i, s);
|
|
8
|
+
}
|
|
9
|
+
var m = { error: null }, g = function(i) {
|
|
10
|
+
var s, c;
|
|
11
|
+
function p() {
|
|
12
|
+
for (var r, o = arguments.length, t = new Array(o), e = 0; e < o; e++) t[e] = arguments[e];
|
|
13
|
+
return (r = i.call.apply(i, [this].concat(t)) || this).state = m, r.resetErrorBoundary = function() {
|
|
14
|
+
for (var n, a = arguments.length, f = new Array(a), l = 0; l < a; l++) f[l] = arguments[l];
|
|
15
|
+
r.props.onReset == null || (n = r.props).onReset.apply(n, f), r.reset();
|
|
16
|
+
}, r;
|
|
17
|
+
}
|
|
18
|
+
c = i, (s = p).prototype = Object.create(c.prototype), s.prototype.constructor = s, h(s, c), p.getDerivedStateFromError = function(r) {
|
|
19
|
+
return { error: r };
|
|
20
|
+
};
|
|
21
|
+
var u = p.prototype;
|
|
22
|
+
return u.reset = function() {
|
|
23
|
+
this.setState(m);
|
|
24
|
+
}, u.componentDidCatch = function(r, o) {
|
|
25
|
+
var t, e;
|
|
26
|
+
(t = (e = this.props).onError) == null || t.call(e, r, o);
|
|
27
|
+
}, u.componentDidUpdate = function(r, o) {
|
|
28
|
+
var t, e, n, a, f = this.state.error, l = this.props.resetKeys;
|
|
29
|
+
f !== null && o.error !== null && ((n = r.resetKeys) === void 0 && (n = []), (a = l) === void 0 && (a = []), n.length !== a.length || n.some(function(b, v) {
|
|
30
|
+
return !Object.is(b, a[v]);
|
|
31
|
+
})) && ((t = (e = this.props).onResetKeysChange) == null || t.call(e, r.resetKeys, l), this.reset());
|
|
32
|
+
}, u.render = function() {
|
|
33
|
+
var r = this.state.error, o = this.props, t = o.fallbackRender, e = o.FallbackComponent, n = o.fallback;
|
|
34
|
+
if (r !== null) {
|
|
35
|
+
var a = { error: r, resetErrorBoundary: this.resetErrorBoundary };
|
|
36
|
+
if (d.isValidElement(n)) return n;
|
|
37
|
+
if (typeof t == "function") return t(a);
|
|
38
|
+
if (e) return d.createElement(e, a);
|
|
39
|
+
throw new Error("react-error-boundary requires either a fallback, fallbackRender, or FallbackComponent prop");
|
|
40
|
+
}
|
|
41
|
+
return this.props.children;
|
|
42
|
+
}, p;
|
|
43
|
+
}(d.Component);
|
|
44
|
+
function k({ children: i, onError: s }) {
|
|
45
|
+
return y(g, { fallback: y("div", { style: { border: "1px solid #f00", color: "#f00", padding: "8px" }, children: "An error was thrown." }), onError: s, children: i });
|
|
46
|
+
}
|
|
47
|
+
export {
|
|
48
|
+
k as LexicalErrorBoundary
|
|
49
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useLexicalComposerContext as n } from "./LexicalComposerContext.prod.js";
|
|
3
|
+
import { createEmptyHistoryState as m, registerHistory as l } from "../history/LexicalHistory.prod.js";
|
|
4
|
+
import { useMemo as u, useEffect as c } from "react";
|
|
5
|
+
function H({ delay: s, externalHistoryState: i }) {
|
|
6
|
+
const [a] = n();
|
|
7
|
+
return function(t, e, o = 1e3) {
|
|
8
|
+
const r = u(() => e || m(), [e]);
|
|
9
|
+
c(() => l(t, r, o), [o, t, r]);
|
|
10
|
+
}(a, i, s), null;
|
|
11
|
+
}
|
|
12
|
+
export {
|
|
13
|
+
H as HistoryPlugin,
|
|
14
|
+
m as createEmptyHistoryState
|
|
15
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { ListNode as o, ListItemNode as i, registerListStrictIndentTransform as n, registerList as a } from "../list/LexicalList.prod.js";
|
|
3
|
+
import { useLexicalComposerContext as f } from "./LexicalComposerContext.prod.js";
|
|
4
|
+
import { useEffect as e } from "react";
|
|
5
|
+
function c({ hasStrictIndent: r = !1 }) {
|
|
6
|
+
const [t] = f();
|
|
7
|
+
return e(() => {
|
|
8
|
+
if (!t.hasNodes([o, i])) throw new Error("ListPlugin: ListNode and/or ListItemNode not registered on editor");
|
|
9
|
+
}, [t]), e(() => {
|
|
10
|
+
if (r) return n(t);
|
|
11
|
+
}, [t, r]), function(s) {
|
|
12
|
+
e(() => a(s), [s]);
|
|
13
|
+
}(t), null;
|
|
14
|
+
}
|
|
15
|
+
export {
|
|
16
|
+
c as ListPlugin
|
|
17
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useLexicalComposerContext as u } from "./LexicalComposerContext.prod.js";
|
|
3
|
+
import { HISTORY_MERGE_TAG as f } from "../../lexical/Lexical.prod.js";
|
|
4
|
+
import { useLayoutEffect as m, useEffect as g } from "react";
|
|
5
|
+
const c = typeof window < "u" && window.document !== void 0 && window.document.createElement !== void 0 ? m : g;
|
|
6
|
+
function w({ ignoreHistoryMergeTagChange: o = !0, ignoreSelectionChange: n = !1, onChange: e }) {
|
|
7
|
+
const [t] = u();
|
|
8
|
+
return c(() => {
|
|
9
|
+
if (e) return t.registerUpdateListener(({ editorState: r, dirtyElements: s, dirtyLeaves: a, prevEditorState: d, tags: i }) => {
|
|
10
|
+
n && s.size === 0 && a.size === 0 || o && i.has(f) || d.isEmpty() || e(r, t, i);
|
|
11
|
+
});
|
|
12
|
+
}, [t, o, n, e]), null;
|
|
13
|
+
}
|
|
14
|
+
export {
|
|
15
|
+
w as OnChangePlugin
|
|
16
|
+
};
|