@arkitektbedriftene/fe-lib 0.3.6 → 0.3.8
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/{Popover-e50ca73e.js → Popover-2318823a.js} +75 -83
- package/dist/lib/rich-text/Editor.d.ts +2 -3
- package/dist/lib/rich-text/editorContext.d.ts +18 -0
- package/dist/lib/rich-text/rich-text.d.ts +1 -0
- package/dist/lib/ui/components/Spinner.d.ts +1 -1
- package/dist/rich-text.es.js +135 -1661
- package/dist/ui.es.js +2 -2
- package/package.json +10 -10
- package/src/lib/rich-text/Editor.tsx +7 -8
- package/src/lib/rich-text/{editorFocus.ts → editorContext.ts} +6 -4
- package/src/lib/rich-text/rich-text.ts +2 -1
- package/vite.config.ts +1 -7
- package/dist/lib/rich-text/editorFocus.d.ts +0 -12
package/dist/rich-text.es.js
CHANGED
|
@@ -1,1652 +1,124 @@
|
|
|
1
|
-
import { createHeadlessEditor as
|
|
2
|
-
import { $generateHtmlFromNodes as
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import { AutoLinkNode as
|
|
6
|
-
import { ListNode as
|
|
7
|
-
import
|
|
8
|
-
import { TableNode as
|
|
9
|
-
import { j } from "./jsx-runtime-d0aa4c5b.js";
|
|
10
|
-
import {
|
|
11
|
-
import
|
|
12
|
-
import
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
1
|
+
import { createHeadlessEditor as C } from "@lexical/headless";
|
|
2
|
+
import { $generateHtmlFromNodes as N } from "@lexical/html";
|
|
3
|
+
import { $getRoot as p, ParagraphNode as T, $createParagraphNode as y, $createTextNode as $ } from "lexical";
|
|
4
|
+
import { trimTextContentFromAnchor as S } from "@lexical/selection";
|
|
5
|
+
import { AutoLinkNode as E, LinkNode as v } from "@lexical/link";
|
|
6
|
+
import { ListNode as w, ListItemNode as j } from "@lexical/list";
|
|
7
|
+
import { HeadingNode as F, QuoteNode as L } from "@lexical/rich-text";
|
|
8
|
+
import { TableNode as R, TableRowNode as H, TableCellNode as k } from "@lexical/table";
|
|
9
|
+
import { j as i } from "./jsx-runtime-d0aa4c5b.js";
|
|
10
|
+
import { createContext as P, useState as B, useRef as h, useCallback as u, useContext as I, useMemo as M } from "react";
|
|
11
|
+
import { c as m, s as f, B as x, S as z } from "./Popover-2318823a.js";
|
|
12
|
+
import { LexicalComposer as q } from "@lexical/react/LexicalComposer";
|
|
13
|
+
import { RichTextPlugin as A } from "@lexical/react/LexicalRichTextPlugin";
|
|
14
|
+
import { ContentEditable as D } from "@lexical/react/LexicalContentEditable";
|
|
15
|
+
import V from "@lexical/react/LexicalErrorBoundary";
|
|
16
|
+
import "react-dom";
|
|
17
|
+
const W = ({
|
|
18
|
+
text: e,
|
|
19
|
+
maxChars: a,
|
|
20
|
+
maxLines: n
|
|
17
21
|
}) => {
|
|
18
|
-
if (
|
|
22
|
+
if (e.length === 0)
|
|
19
23
|
return 0;
|
|
20
|
-
const
|
|
21
|
-
if (!
|
|
22
|
-
return
|
|
23
|
-
let
|
|
24
|
-
for (;
|
|
25
|
-
|
|
26
|
-
` &&
|
|
27
|
-
return
|
|
28
|
-
},
|
|
29
|
-
editor:
|
|
30
|
-
maxChars:
|
|
31
|
-
maxLines:
|
|
24
|
+
const r = typeof n == "number", o = typeof a == "number";
|
|
25
|
+
if (!r && !o)
|
|
26
|
+
return e.length;
|
|
27
|
+
let s = 0, t = 0;
|
|
28
|
+
for (; t < e.length && (!r || s < n) && (!o || t < a); )
|
|
29
|
+
e[t] === `
|
|
30
|
+
` && s++, t++;
|
|
31
|
+
return e.slice(0, t).length;
|
|
32
|
+
}, J = ({
|
|
33
|
+
editor: e,
|
|
34
|
+
maxChars: a,
|
|
35
|
+
maxLines: n
|
|
32
36
|
}) => {
|
|
33
|
-
const
|
|
34
|
-
|
|
35
|
-
const
|
|
36
|
-
return
|
|
37
|
-
},
|
|
38
|
-
let
|
|
39
|
-
const
|
|
40
|
-
nodes:
|
|
37
|
+
const r = p(), o = r.getTextContent(), s = W({ text: o, maxChars: a, maxLines: n }), t = o.length - s, l = r.select().anchor;
|
|
38
|
+
S(e, l, t);
|
|
39
|
+
const d = r.getLastChild();
|
|
40
|
+
return d instanceof T && d.getChildrenSize() === 0 && d.remove(), t;
|
|
41
|
+
}, O = (e) => e[0] === "{", ge = (e, a, n) => {
|
|
42
|
+
let r = 0;
|
|
43
|
+
const o = C({
|
|
44
|
+
nodes: a,
|
|
41
45
|
editable: !1
|
|
42
46
|
});
|
|
43
|
-
if (
|
|
47
|
+
if (e)
|
|
44
48
|
try {
|
|
45
|
-
if (typeof
|
|
46
|
-
|
|
47
|
-
const
|
|
48
|
-
|
|
49
|
+
if (typeof e == "string" && !O(e))
|
|
50
|
+
o.update(() => {
|
|
51
|
+
const t = p(), c = y();
|
|
52
|
+
c.append($(e.trim())), t.append(c);
|
|
49
53
|
});
|
|
50
54
|
else {
|
|
51
|
-
const
|
|
52
|
-
|
|
53
|
-
editor:
|
|
54
|
-
maxLines:
|
|
55
|
+
const t = o.parseEditorState(e, () => {
|
|
56
|
+
r = J({
|
|
57
|
+
editor: o,
|
|
58
|
+
maxLines: n == null ? void 0 : n.maxLines
|
|
55
59
|
});
|
|
56
60
|
});
|
|
57
|
-
|
|
61
|
+
t.isEmpty() || o.setEditorState(t);
|
|
58
62
|
}
|
|
59
|
-
} catch (
|
|
60
|
-
console.error(
|
|
63
|
+
} catch (t) {
|
|
64
|
+
console.error(t);
|
|
61
65
|
}
|
|
62
|
-
let
|
|
63
|
-
return
|
|
64
|
-
|
|
65
|
-
}), { html:
|
|
66
|
-
},
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
]
|
|
77
|
-
var ue = {}, ne = {}, Oe;
|
|
78
|
-
function Ft() {
|
|
79
|
-
if (Oe)
|
|
80
|
-
return ne;
|
|
81
|
-
Oe = 1;
|
|
82
|
-
var c = U;
|
|
83
|
-
const i = /* @__PURE__ */ c.createContext(null);
|
|
84
|
-
function h(p, m) {
|
|
85
|
-
let a = null;
|
|
86
|
-
p != null && (a = p[1]);
|
|
87
|
-
function u() {
|
|
88
|
-
return m ?? (a != null ? a.getTheme() : null);
|
|
89
|
-
}
|
|
90
|
-
return {
|
|
91
|
-
getTheme: u
|
|
92
|
-
};
|
|
93
|
-
}
|
|
94
|
-
function L() {
|
|
95
|
-
const p = c.useContext(i);
|
|
96
|
-
if (p == null)
|
|
97
|
-
throw Error("LexicalComposerContext.useLexicalComposerContext: cannot find a LexicalComposerContext");
|
|
98
|
-
return p;
|
|
99
|
-
}
|
|
100
|
-
return ne.LexicalComposerContext = i, ne.createLexicalComposerContext = h, ne.useLexicalComposerContext = L, ne;
|
|
101
|
-
}
|
|
102
|
-
var re = {}, Pe;
|
|
103
|
-
function Mt() {
|
|
104
|
-
if (Pe)
|
|
105
|
-
return re;
|
|
106
|
-
Pe = 1;
|
|
107
|
-
var c = U;
|
|
108
|
-
function i(L) {
|
|
109
|
-
let p = new URLSearchParams();
|
|
110
|
-
p.append("code", L);
|
|
111
|
-
for (let m = 1; m < arguments.length; m++)
|
|
112
|
-
p.append("v", arguments[m]);
|
|
113
|
-
throw Error(`Minified Lexical error #${L}; visit https://lexical.dev/docs/error?${p} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`);
|
|
114
|
-
}
|
|
115
|
-
let h = c.createContext(null);
|
|
116
|
-
return re.LexicalComposerContext = h, re.createLexicalComposerContext = function(L, p) {
|
|
117
|
-
let m = null;
|
|
118
|
-
return L != null && (m = L[1]), { getTheme: function() {
|
|
119
|
-
return p ?? (m != null ? m.getTheme() : null);
|
|
120
|
-
} };
|
|
121
|
-
}, re.useLexicalComposerContext = function() {
|
|
122
|
-
let L = c.useContext(h);
|
|
123
|
-
return L == null && i(8), L;
|
|
124
|
-
}, re;
|
|
125
|
-
}
|
|
126
|
-
var de, De;
|
|
127
|
-
function Q() {
|
|
128
|
-
return De || (De = 1, de = process.env.NODE_ENV === "development" ? Ft() : Mt()), de;
|
|
129
|
-
}
|
|
130
|
-
var Fe;
|
|
131
|
-
function qt() {
|
|
132
|
-
if (Fe)
|
|
133
|
-
return ue;
|
|
134
|
-
Fe = 1;
|
|
135
|
-
var c = Q(), i = Y, h = U;
|
|
136
|
-
const L = typeof window < "u" && typeof window.document < "u" && typeof window.document.createElement < "u";
|
|
137
|
-
var m = L ? h.useLayoutEffect : h.useEffect;
|
|
138
|
-
const a = {
|
|
139
|
-
tag: "history-merge"
|
|
140
|
-
};
|
|
141
|
-
function u({
|
|
142
|
-
initialConfig: t,
|
|
143
|
-
children: n
|
|
144
|
-
}) {
|
|
145
|
-
const r = h.useMemo(
|
|
146
|
-
() => {
|
|
147
|
-
const {
|
|
148
|
-
theme: s,
|
|
149
|
-
namespace: l,
|
|
150
|
-
editor__DEPRECATED: o,
|
|
151
|
-
nodes: x,
|
|
152
|
-
onError: v,
|
|
153
|
-
editorState: g,
|
|
154
|
-
html: S
|
|
155
|
-
} = t, T = c.createLexicalComposerContext(null, s);
|
|
156
|
-
let y = o || null;
|
|
157
|
-
if (y === null) {
|
|
158
|
-
const w = i.createEditor({
|
|
159
|
-
editable: t.editable,
|
|
160
|
-
html: S,
|
|
161
|
-
namespace: l,
|
|
162
|
-
nodes: x,
|
|
163
|
-
onError: (R) => v(R, w),
|
|
164
|
-
theme: s
|
|
165
|
-
});
|
|
166
|
-
e(w, g), y = w;
|
|
167
|
-
}
|
|
168
|
-
return [y, T];
|
|
169
|
-
},
|
|
170
|
-
// We only do this for init
|
|
171
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
172
|
-
[]
|
|
173
|
-
);
|
|
174
|
-
return m(() => {
|
|
175
|
-
const s = t.editable, [l] = r;
|
|
176
|
-
l.setEditable(s !== void 0 ? s : !0);
|
|
177
|
-
}, []), /* @__PURE__ */ h.createElement(c.LexicalComposerContext.Provider, {
|
|
178
|
-
value: r
|
|
179
|
-
}, n);
|
|
180
|
-
}
|
|
181
|
-
function e(t, n) {
|
|
182
|
-
if (n !== null) {
|
|
183
|
-
if (n === void 0)
|
|
184
|
-
t.update(() => {
|
|
185
|
-
const r = i.$getRoot();
|
|
186
|
-
if (r.isEmpty()) {
|
|
187
|
-
const s = i.$createParagraphNode();
|
|
188
|
-
r.append(s);
|
|
189
|
-
const l = L ? document.activeElement : null;
|
|
190
|
-
(i.$getSelection() !== null || l !== null && l === t.getRootElement()) && s.select();
|
|
191
|
-
}
|
|
192
|
-
}, a);
|
|
193
|
-
else if (n !== null)
|
|
194
|
-
switch (typeof n) {
|
|
195
|
-
case "string": {
|
|
196
|
-
const r = t.parseEditorState(n);
|
|
197
|
-
t.setEditorState(r, a);
|
|
198
|
-
break;
|
|
199
|
-
}
|
|
200
|
-
case "object": {
|
|
201
|
-
t.setEditorState(n, a);
|
|
202
|
-
break;
|
|
203
|
-
}
|
|
204
|
-
case "function": {
|
|
205
|
-
t.update(() => {
|
|
206
|
-
i.$getRoot().isEmpty() && n(t);
|
|
207
|
-
}, a);
|
|
208
|
-
break;
|
|
209
|
-
}
|
|
210
|
-
}
|
|
211
|
-
}
|
|
212
|
-
}
|
|
213
|
-
return ue.LexicalComposer = u, ue;
|
|
214
|
-
}
|
|
215
|
-
var fe = {}, Me;
|
|
216
|
-
function Bt() {
|
|
217
|
-
if (Me)
|
|
218
|
-
return fe;
|
|
219
|
-
Me = 1;
|
|
220
|
-
var c = Q(), i = Y, h = U;
|
|
221
|
-
let L = typeof window < "u" && typeof window.document < "u" && typeof window.document.createElement < "u";
|
|
222
|
-
var p = L ? h.useLayoutEffect : h.useEffect;
|
|
223
|
-
let m = { tag: "history-merge" };
|
|
224
|
-
function a(u, e) {
|
|
225
|
-
if (e !== null) {
|
|
226
|
-
if (e === void 0)
|
|
227
|
-
u.update(() => {
|
|
228
|
-
var t = i.$getRoot();
|
|
229
|
-
if (t.isEmpty()) {
|
|
230
|
-
let n = i.$createParagraphNode();
|
|
231
|
-
t.append(n), t = L ? document.activeElement : null, (i.$getSelection() !== null || t !== null && t === u.getRootElement()) && n.select();
|
|
232
|
-
}
|
|
233
|
-
}, m);
|
|
234
|
-
else if (e !== null)
|
|
235
|
-
switch (typeof e) {
|
|
236
|
-
case "string":
|
|
237
|
-
let t = u.parseEditorState(e);
|
|
238
|
-
u.setEditorState(t, m);
|
|
239
|
-
break;
|
|
240
|
-
case "object":
|
|
241
|
-
u.setEditorState(e, m);
|
|
242
|
-
break;
|
|
243
|
-
case "function":
|
|
244
|
-
u.update(() => {
|
|
245
|
-
i.$getRoot().isEmpty() && e(u);
|
|
246
|
-
}, m);
|
|
247
|
-
}
|
|
248
|
-
}
|
|
249
|
-
}
|
|
250
|
-
return fe.LexicalComposer = function({ initialConfig: u, children: e }) {
|
|
251
|
-
let t = h.useMemo(() => {
|
|
252
|
-
const { theme: n, namespace: r, editor__DEPRECATED: s, nodes: l, onError: o, editorState: x, html: v } = u, g = c.createLexicalComposerContext(null, n);
|
|
253
|
-
let S = s || null;
|
|
254
|
-
if (S === null) {
|
|
255
|
-
const T = i.createEditor({ editable: u.editable, html: v, namespace: r, nodes: l, onError: (y) => o(y, T), theme: n });
|
|
256
|
-
a(T, x), S = T;
|
|
257
|
-
}
|
|
258
|
-
return [S, g];
|
|
259
|
-
}, []);
|
|
260
|
-
return p(() => {
|
|
261
|
-
let n = u.editable, [r] = t;
|
|
262
|
-
r.setEditable(n !== void 0 ? n : !0);
|
|
263
|
-
}, []), h.createElement(
|
|
264
|
-
c.LexicalComposerContext.Provider,
|
|
265
|
-
{ value: t },
|
|
266
|
-
e
|
|
267
|
-
);
|
|
268
|
-
}, fe;
|
|
269
|
-
}
|
|
270
|
-
const kt = process.env.NODE_ENV === "development" ? qt() : Bt();
|
|
271
|
-
var At = kt, pe = {}, ge, qe;
|
|
272
|
-
function It() {
|
|
273
|
-
if (qe)
|
|
274
|
-
return ge;
|
|
275
|
-
qe = 1;
|
|
276
|
-
var c = Q(), i = U, p = typeof window < "u" && typeof window.document < "u" && typeof window.document.createElement < "u" ? i.useLayoutEffect : i.useEffect;
|
|
277
|
-
function m(e) {
|
|
278
|
-
const [t] = c.useLexicalComposerContext(), n = i.useMemo(() => e(t), [t, e]), r = i.useRef(n.initialValueFn()), [s, l] = i.useState(r.current);
|
|
279
|
-
return p(() => {
|
|
280
|
-
const {
|
|
281
|
-
initialValueFn: o,
|
|
282
|
-
subscribe: x
|
|
283
|
-
} = n, v = o();
|
|
284
|
-
return r.current !== v && (r.current = v, l(v)), x((g) => {
|
|
285
|
-
r.current = g, l(g);
|
|
286
|
-
});
|
|
287
|
-
}, [n, e]), s;
|
|
288
|
-
}
|
|
289
|
-
function a(e) {
|
|
290
|
-
return {
|
|
291
|
-
initialValueFn: () => e.isEditable(),
|
|
292
|
-
subscribe: (t) => e.registerEditableListener(t)
|
|
293
|
-
};
|
|
294
|
-
}
|
|
295
|
-
function u() {
|
|
296
|
-
return m(a);
|
|
297
|
-
}
|
|
298
|
-
return ge = u, ge;
|
|
299
|
-
}
|
|
300
|
-
var me, Be;
|
|
301
|
-
function Ut() {
|
|
302
|
-
if (Be)
|
|
303
|
-
return me;
|
|
304
|
-
Be = 1;
|
|
305
|
-
var c = Q(), i = U, h = typeof window < "u" && typeof window.document < "u" && typeof window.document.createElement < "u" ? i.useLayoutEffect : i.useEffect;
|
|
306
|
-
function L(m) {
|
|
307
|
-
let [a] = c.useLexicalComposerContext(), u = i.useMemo(() => m(a), [a, m]), e = i.useRef(u.initialValueFn()), [t, n] = i.useState(e.current);
|
|
308
|
-
return h(() => {
|
|
309
|
-
let { initialValueFn: r, subscribe: s } = u, l = r();
|
|
310
|
-
return e.current !== l && (e.current = l, n(l)), s((o) => {
|
|
311
|
-
e.current = o, n(o);
|
|
312
|
-
});
|
|
313
|
-
}, [u, m]), t;
|
|
314
|
-
}
|
|
315
|
-
function p(m) {
|
|
316
|
-
return { initialValueFn: () => m.isEditable(), subscribe: (a) => m.registerEditableListener(a) };
|
|
317
|
-
}
|
|
318
|
-
return me = function() {
|
|
319
|
-
return L(p);
|
|
320
|
-
}, me;
|
|
321
|
-
}
|
|
322
|
-
var xe, ke;
|
|
323
|
-
function lt() {
|
|
324
|
-
return ke || (ke = 1, xe = process.env.NODE_ENV === "development" ? It() : Ut()), xe;
|
|
325
|
-
}
|
|
326
|
-
var J = {}, Ae;
|
|
327
|
-
function Kt() {
|
|
328
|
-
if (Ae)
|
|
329
|
-
return J;
|
|
330
|
-
Ae = 1;
|
|
331
|
-
var c = Y;
|
|
332
|
-
function i(e, t) {
|
|
333
|
-
let n = e.getFirstChild(), r = 0;
|
|
334
|
-
e:
|
|
335
|
-
for (; n !== null; ) {
|
|
336
|
-
if (c.$isElementNode(n)) {
|
|
337
|
-
const o = n.getFirstChild();
|
|
338
|
-
if (o !== null) {
|
|
339
|
-
n = o;
|
|
340
|
-
continue;
|
|
341
|
-
}
|
|
342
|
-
} else if (c.$isTextNode(n)) {
|
|
343
|
-
const o = n.getTextContentSize();
|
|
344
|
-
if (r + o > t)
|
|
345
|
-
return {
|
|
346
|
-
node: n,
|
|
347
|
-
offset: t - r
|
|
348
|
-
};
|
|
349
|
-
r += o;
|
|
350
|
-
}
|
|
351
|
-
const s = n.getNextSibling();
|
|
352
|
-
if (s !== null) {
|
|
353
|
-
n = s;
|
|
354
|
-
continue;
|
|
355
|
-
}
|
|
356
|
-
let l = n.getParent();
|
|
357
|
-
for (; l !== null; ) {
|
|
358
|
-
const o = l.getNextSibling();
|
|
359
|
-
if (o !== null) {
|
|
360
|
-
n = o;
|
|
361
|
-
continue e;
|
|
362
|
-
}
|
|
363
|
-
l = l.getParent();
|
|
364
|
-
}
|
|
365
|
-
break;
|
|
366
|
-
}
|
|
367
|
-
return null;
|
|
368
|
-
}
|
|
369
|
-
function h(e, t = !0) {
|
|
370
|
-
if (e)
|
|
371
|
-
return !1;
|
|
372
|
-
let n = p();
|
|
373
|
-
return t && (n = n.trim()), n === "";
|
|
374
|
-
}
|
|
375
|
-
function L(e, t) {
|
|
376
|
-
return () => h(e, t);
|
|
377
|
-
}
|
|
378
|
-
function p() {
|
|
379
|
-
return c.$getRoot().getTextContent();
|
|
380
|
-
}
|
|
381
|
-
function m(e) {
|
|
382
|
-
if (!h(e, !1))
|
|
383
|
-
return !1;
|
|
384
|
-
const n = c.$getRoot().getChildren(), r = n.length;
|
|
385
|
-
if (r > 1)
|
|
386
|
-
return !1;
|
|
387
|
-
for (let s = 0; s < r; s++) {
|
|
388
|
-
const l = n[s];
|
|
389
|
-
if (c.$isDecoratorNode(l))
|
|
390
|
-
return !1;
|
|
391
|
-
if (c.$isElementNode(l)) {
|
|
392
|
-
if (!c.$isParagraphNode(l) || l.__indent !== 0)
|
|
393
|
-
return !1;
|
|
394
|
-
const o = l.getChildren(), x = o.length;
|
|
395
|
-
for (let v = 0; v < x; v++) {
|
|
396
|
-
const g = o[s];
|
|
397
|
-
if (!c.$isTextNode(g))
|
|
398
|
-
return !1;
|
|
399
|
-
}
|
|
400
|
-
}
|
|
401
|
-
}
|
|
402
|
-
return !0;
|
|
403
|
-
}
|
|
404
|
-
function a(e) {
|
|
405
|
-
return () => m(e);
|
|
406
|
-
}
|
|
407
|
-
function u(e, t, n, r) {
|
|
408
|
-
const s = (T) => T instanceof n, l = (T) => {
|
|
409
|
-
const y = c.$createTextNode(T.getTextContent());
|
|
410
|
-
y.setFormat(T.getFormat()), T.replace(y);
|
|
411
|
-
}, o = (T) => T.getLatest().__mode, x = (T) => {
|
|
412
|
-
if (!T.isSimpleText())
|
|
413
|
-
return;
|
|
414
|
-
const y = T.getPreviousSibling();
|
|
415
|
-
let w = T.getTextContent(), R = T, d;
|
|
416
|
-
if (c.$isTextNode(y)) {
|
|
417
|
-
const E = y.getTextContent(), f = E + w, N = t(f);
|
|
418
|
-
if (s(y))
|
|
419
|
-
if (N === null || o(y) !== 0) {
|
|
420
|
-
l(y);
|
|
421
|
-
return;
|
|
422
|
-
} else {
|
|
423
|
-
const C = N.end - E.length;
|
|
424
|
-
if (C > 0) {
|
|
425
|
-
const b = w.slice(0, C), _ = E + b;
|
|
426
|
-
if (y.select(), y.setTextContent(_), C === w.length)
|
|
427
|
-
T.remove();
|
|
428
|
-
else {
|
|
429
|
-
const $ = w.slice(C);
|
|
430
|
-
T.setTextContent($);
|
|
431
|
-
}
|
|
432
|
-
return;
|
|
433
|
-
}
|
|
434
|
-
}
|
|
435
|
-
else if (N === null || N.start < E.length)
|
|
436
|
-
return;
|
|
437
|
-
}
|
|
438
|
-
for (; ; ) {
|
|
439
|
-
d = t(w);
|
|
440
|
-
let E = d === null ? "" : w.slice(d.end);
|
|
441
|
-
if (w = E, E === "") {
|
|
442
|
-
const C = R.getNextSibling();
|
|
443
|
-
if (c.$isTextNode(C)) {
|
|
444
|
-
E = R.getTextContent() + C.getTextContent();
|
|
445
|
-
const b = t(E);
|
|
446
|
-
if (b === null) {
|
|
447
|
-
s(C) ? l(C) : C.markDirty();
|
|
448
|
-
return;
|
|
449
|
-
} else if (b.start !== 0)
|
|
450
|
-
return;
|
|
451
|
-
}
|
|
452
|
-
} else {
|
|
453
|
-
const C = t(E);
|
|
454
|
-
if (C !== null && C.start === 0)
|
|
455
|
-
return;
|
|
456
|
-
}
|
|
457
|
-
if (d === null)
|
|
458
|
-
return;
|
|
459
|
-
if (d.start === 0 && c.$isTextNode(y) && y.isTextEntity())
|
|
460
|
-
continue;
|
|
461
|
-
let f;
|
|
462
|
-
d.start === 0 ? [f, R] = R.splitText(d.end) : [, f, R] = R.splitText(d.start, d.end);
|
|
463
|
-
const N = r(f);
|
|
464
|
-
if (N.setFormat(f.getFormat()), f.replace(N), R == null)
|
|
465
|
-
return;
|
|
466
|
-
}
|
|
467
|
-
}, v = (T) => {
|
|
468
|
-
const y = T.getTextContent(), w = t(y);
|
|
469
|
-
if (w === null || w.start !== 0) {
|
|
470
|
-
l(T);
|
|
471
|
-
return;
|
|
472
|
-
}
|
|
473
|
-
if (y.length > w.end) {
|
|
474
|
-
T.splitText(w.end);
|
|
475
|
-
return;
|
|
476
|
-
}
|
|
477
|
-
const R = T.getPreviousSibling();
|
|
478
|
-
c.$isTextNode(R) && R.isTextEntity() && (l(R), l(T));
|
|
479
|
-
const d = T.getNextSibling();
|
|
480
|
-
c.$isTextNode(d) && d.isTextEntity() && (l(d), s(T) && l(T));
|
|
481
|
-
}, g = e.registerNodeTransform(c.TextNode, x), S = e.registerNodeTransform(n, v);
|
|
482
|
-
return [g, S];
|
|
483
|
-
}
|
|
484
|
-
return J.$canShowPlaceholder = m, J.$canShowPlaceholderCurry = a, J.$findTextIntersectionFromCharacters = i, J.$isRootTextContentEmpty = h, J.$isRootTextContentEmptyCurry = L, J.$rootTextContent = p, J.registerLexicalTextEntity = u, J;
|
|
485
|
-
}
|
|
486
|
-
var G = {}, Ie;
|
|
487
|
-
function jt() {
|
|
488
|
-
if (Ie)
|
|
489
|
-
return G;
|
|
490
|
-
Ie = 1;
|
|
491
|
-
var c = Y;
|
|
492
|
-
function i(p, m = !0) {
|
|
493
|
-
return p ? !1 : (p = h(), m && (p = p.trim()), p === "");
|
|
494
|
-
}
|
|
495
|
-
function h() {
|
|
496
|
-
return c.$getRoot().getTextContent();
|
|
497
|
-
}
|
|
498
|
-
function L(p) {
|
|
499
|
-
if (!i(p, !1))
|
|
500
|
-
return !1;
|
|
501
|
-
p = c.$getRoot().getChildren();
|
|
502
|
-
let m = p.length;
|
|
503
|
-
if (1 < m)
|
|
504
|
-
return !1;
|
|
505
|
-
for (let u = 0; u < m; u++) {
|
|
506
|
-
var a = p[u];
|
|
507
|
-
if (c.$isDecoratorNode(a))
|
|
508
|
-
return !1;
|
|
509
|
-
if (c.$isElementNode(a)) {
|
|
510
|
-
if (!c.$isParagraphNode(a) || a.__indent !== 0)
|
|
511
|
-
return !1;
|
|
512
|
-
a = a.getChildren();
|
|
513
|
-
let e = a.length;
|
|
514
|
-
for (let t = 0; t < e; t++)
|
|
515
|
-
if (!c.$isTextNode(a[u]))
|
|
516
|
-
return !1;
|
|
517
|
-
}
|
|
518
|
-
}
|
|
519
|
-
return !0;
|
|
520
|
-
}
|
|
521
|
-
return G.$canShowPlaceholder = L, G.$canShowPlaceholderCurry = function(p) {
|
|
522
|
-
return () => L(p);
|
|
523
|
-
}, G.$findTextIntersectionFromCharacters = function(p, m) {
|
|
524
|
-
var a = p.getFirstChild();
|
|
525
|
-
p = 0;
|
|
526
|
-
e:
|
|
527
|
-
for (; a !== null; ) {
|
|
528
|
-
if (c.$isElementNode(a)) {
|
|
529
|
-
var u = a.getFirstChild();
|
|
530
|
-
if (u !== null) {
|
|
531
|
-
a = u;
|
|
532
|
-
continue;
|
|
533
|
-
}
|
|
534
|
-
} else if (c.$isTextNode(a)) {
|
|
535
|
-
if (u = a.getTextContentSize(), p + u > m)
|
|
536
|
-
return { node: a, offset: m - p };
|
|
537
|
-
p += u;
|
|
538
|
-
}
|
|
539
|
-
if (u = a.getNextSibling(), u !== null)
|
|
540
|
-
a = u;
|
|
541
|
-
else {
|
|
542
|
-
for (a = a.getParent(); a !== null; ) {
|
|
543
|
-
if (u = a.getNextSibling(), u !== null) {
|
|
544
|
-
a = u;
|
|
545
|
-
continue e;
|
|
546
|
-
}
|
|
547
|
-
a = a.getParent();
|
|
548
|
-
}
|
|
549
|
-
break;
|
|
550
|
-
}
|
|
551
|
-
}
|
|
552
|
-
return null;
|
|
553
|
-
}, G.$isRootTextContentEmpty = i, G.$isRootTextContentEmptyCurry = function(p, m) {
|
|
554
|
-
return () => i(p, m);
|
|
555
|
-
}, G.$rootTextContent = h, G.registerLexicalTextEntity = function(p, m, a, u) {
|
|
556
|
-
let e = (n) => {
|
|
557
|
-
const r = c.$createTextNode(n.getTextContent());
|
|
558
|
-
r.setFormat(n.getFormat()), n.replace(r);
|
|
559
|
-
}, t = p.registerNodeTransform(c.TextNode, (n) => {
|
|
560
|
-
if (n.isSimpleText()) {
|
|
561
|
-
var r = n.getPreviousSibling(), s = n.getTextContent(), l = n;
|
|
562
|
-
if (c.$isTextNode(r)) {
|
|
563
|
-
var o = r.getTextContent(), x = m(o + s);
|
|
564
|
-
if (r instanceof a) {
|
|
565
|
-
if (x === null || r.getLatest().__mode !== 0) {
|
|
566
|
-
e(r);
|
|
567
|
-
return;
|
|
568
|
-
}
|
|
569
|
-
if (x = x.end - o.length, 0 < x) {
|
|
570
|
-
l = s.slice(0, x), l = o + l, r.select(), r.setTextContent(l), x === s.length ? n.remove() : (r = s.slice(x), n.setTextContent(r));
|
|
571
|
-
return;
|
|
572
|
-
}
|
|
573
|
-
} else if (x === null || x.start < o.length)
|
|
574
|
-
return;
|
|
575
|
-
}
|
|
576
|
-
for (; ; ) {
|
|
577
|
-
if (n = m(s), s = x = n === null ? "" : s.slice(n.end), x === "") {
|
|
578
|
-
if (o = l.getNextSibling(), c.$isTextNode(o)) {
|
|
579
|
-
if (x = l.getTextContent() + o.getTextContent(), x = m(x), x === null) {
|
|
580
|
-
o instanceof a ? e(o) : o.markDirty();
|
|
581
|
-
break;
|
|
582
|
-
} else if (x.start !== 0)
|
|
583
|
-
break;
|
|
584
|
-
}
|
|
585
|
-
} else if (o = m(x), o !== null && o.start === 0)
|
|
586
|
-
break;
|
|
587
|
-
if (n === null)
|
|
588
|
-
break;
|
|
589
|
-
if (n.start === 0 && c.$isTextNode(r) && r.isTextEntity())
|
|
590
|
-
continue;
|
|
591
|
-
let v;
|
|
592
|
-
if (n.start === 0 ? [v, l] = l.splitText(n.end) : [, v, l] = l.splitText(n.start, n.end), n = u(v), n.setFormat(v.getFormat()), v.replace(n), l == null)
|
|
593
|
-
break;
|
|
594
|
-
}
|
|
595
|
-
}
|
|
596
|
-
});
|
|
597
|
-
return p = p.registerNodeTransform(a, (n) => {
|
|
598
|
-
var r = n.getTextContent();
|
|
599
|
-
const s = m(r);
|
|
600
|
-
s === null || s.start !== 0 ? e(n) : r.length > s.end ? n.splitText(s.end) : (r = n.getPreviousSibling(), c.$isTextNode(r) && r.isTextEntity() && (e(r), e(n)), r = n.getNextSibling(), c.$isTextNode(r) && r.isTextEntity() && (e(r), n instanceof a && e(n)));
|
|
601
|
-
}), [t, p];
|
|
602
|
-
}, G;
|
|
603
|
-
}
|
|
604
|
-
var he, Ue;
|
|
605
|
-
function st() {
|
|
606
|
-
return Ue || (Ue = 1, he = process.env.NODE_ENV === "development" ? Kt() : jt()), he;
|
|
607
|
-
}
|
|
608
|
-
var P = {}, Ke;
|
|
609
|
-
function Ht() {
|
|
610
|
-
if (Ke)
|
|
611
|
-
return P;
|
|
612
|
-
Ke = 1;
|
|
613
|
-
var c = tt, i = Y;
|
|
614
|
-
function h(...d) {
|
|
615
|
-
return () => {
|
|
616
|
-
d.forEach((E) => E());
|
|
617
|
-
};
|
|
618
|
-
}
|
|
619
|
-
function L(d) {
|
|
620
|
-
return `${d}px`;
|
|
621
|
-
}
|
|
622
|
-
const p = {
|
|
623
|
-
attributes: !0,
|
|
624
|
-
characterData: !0,
|
|
625
|
-
childList: !0,
|
|
626
|
-
subtree: !0
|
|
627
|
-
};
|
|
628
|
-
function m(d, E, f) {
|
|
629
|
-
let N = null, C = null, b = null, _ = [];
|
|
630
|
-
const $ = document.createElement("div");
|
|
631
|
-
function M() {
|
|
632
|
-
if (N === null)
|
|
633
|
-
throw Error("Unexpected null rootDOMNode");
|
|
634
|
-
if (C === null)
|
|
635
|
-
throw Error("Unexpected null parentDOMNode");
|
|
636
|
-
const {
|
|
637
|
-
left: q,
|
|
638
|
-
top: K
|
|
639
|
-
} = N.getBoundingClientRect(), H = C, A = c.createRectsFromDOMRange(d, E);
|
|
640
|
-
$.isConnected || H.append($);
|
|
641
|
-
let I = !1;
|
|
642
|
-
for (let z = 0; z < A.length; z++) {
|
|
643
|
-
const X = A[z], V = _[z] || document.createElement("div"), W = V.style;
|
|
644
|
-
W.position !== "absolute" && (W.position = "absolute", I = !0);
|
|
645
|
-
const ie = L(X.left - q);
|
|
646
|
-
W.left !== ie && (W.left = ie, I = !0);
|
|
647
|
-
const Z = L(X.top - K);
|
|
648
|
-
W.top !== Z && (V.style.top = Z, I = !0);
|
|
649
|
-
const ee = L(X.width);
|
|
650
|
-
W.width !== ee && (V.style.width = ee, I = !0);
|
|
651
|
-
const te = L(X.height);
|
|
652
|
-
W.height !== te && (V.style.height = te, I = !0), V.parentNode !== $ && ($.append(V), I = !0), _[z] = V;
|
|
653
|
-
}
|
|
654
|
-
for (; _.length > A.length; )
|
|
655
|
-
_.pop();
|
|
656
|
-
I && f(_);
|
|
657
|
-
}
|
|
658
|
-
function O() {
|
|
659
|
-
C = null, N = null, b !== null && b.disconnect(), b = null, $.remove();
|
|
660
|
-
for (const q of _)
|
|
661
|
-
q.remove();
|
|
662
|
-
_ = [];
|
|
663
|
-
}
|
|
664
|
-
function F() {
|
|
665
|
-
const q = d.getRootElement();
|
|
666
|
-
if (q === null)
|
|
667
|
-
return O();
|
|
668
|
-
const K = q.parentElement;
|
|
669
|
-
if (!(K instanceof HTMLElement))
|
|
670
|
-
return O();
|
|
671
|
-
O(), N = q, C = K, b = new MutationObserver((H) => {
|
|
672
|
-
const A = d.getRootElement(), I = A && A.parentElement;
|
|
673
|
-
if (A !== N || I !== C)
|
|
674
|
-
return F();
|
|
675
|
-
for (const z of H)
|
|
676
|
-
if (!$.contains(z.target))
|
|
677
|
-
return M();
|
|
678
|
-
}), b.observe(K, p), M();
|
|
679
|
-
}
|
|
680
|
-
const B = d.registerRootListener(F);
|
|
681
|
-
return () => {
|
|
682
|
-
B(), O();
|
|
683
|
-
};
|
|
684
|
-
}
|
|
685
|
-
function a(d, E) {
|
|
686
|
-
let f = null, N = null, C = null, b = null, _ = () => {
|
|
687
|
-
};
|
|
688
|
-
function $(M) {
|
|
689
|
-
M.read(() => {
|
|
690
|
-
const O = i.$getSelection();
|
|
691
|
-
if (!i.$isRangeSelection(O)) {
|
|
692
|
-
f = null, N = null, C = null, b = null, _(), _ = () => {
|
|
693
|
-
};
|
|
694
|
-
return;
|
|
695
|
-
}
|
|
696
|
-
const {
|
|
697
|
-
anchor: F,
|
|
698
|
-
focus: B
|
|
699
|
-
} = O, q = F.getNode(), K = q.getKey(), H = F.offset, A = B.getNode(), I = A.getKey(), z = B.offset, X = d.getElementByKey(K), V = d.getElementByKey(I), W = f === null || X === null || H !== N || K !== f.getKey() || q !== f && (!(f instanceof i.TextNode) || q.updateDOM(f, X, d._config)), ie = C === null || V === null || z !== b || I !== C.getKey() || A !== C && (!(C instanceof i.TextNode) || A.updateDOM(C, V, d._config));
|
|
700
|
-
if (W || ie) {
|
|
701
|
-
const Z = d.getElementByKey(F.getNode().getKey()), ee = d.getElementByKey(B.getNode().getKey());
|
|
702
|
-
if (Z !== null && ee !== null && Z.tagName === "SPAN" && ee.tagName === "SPAN") {
|
|
703
|
-
const te = document.createRange();
|
|
704
|
-
let le, se, ae, ce;
|
|
705
|
-
B.isBefore(F) ? (le = ee, se = B.offset, ae = Z, ce = F.offset) : (le = Z, se = F.offset, ae = ee, ce = B.offset);
|
|
706
|
-
const we = le.firstChild;
|
|
707
|
-
if (we === null)
|
|
708
|
-
throw Error("Expected text node to be first child of span");
|
|
709
|
-
const Se = ae.firstChild;
|
|
710
|
-
if (Se === null)
|
|
711
|
-
throw Error("Expected text node to be first child of span");
|
|
712
|
-
te.setStart(we, se), te.setEnd(Se, ce), _(), _ = m(d, te, (Re) => {
|
|
713
|
-
for (const ut of Re) {
|
|
714
|
-
const k = ut.style;
|
|
715
|
-
k.background !== "Highlight" && (k.background = "Highlight"), k.color !== "HighlightText" && (k.color = "HighlightText"), k.zIndex !== "-1" && (k.zIndex = "-1"), k.pointerEvents !== "none" && (k.pointerEvents = "none"), k.marginTop !== L(-1.5) && (k.marginTop = L(-1.5)), k.paddingTop !== L(4) && (k.paddingTop = L(4)), k.paddingBottom !== L(0) && (k.paddingBottom = L(0));
|
|
716
|
-
}
|
|
717
|
-
E !== void 0 && E(Re);
|
|
718
|
-
});
|
|
719
|
-
}
|
|
720
|
-
}
|
|
721
|
-
f = q, N = H, C = A, b = z;
|
|
722
|
-
});
|
|
723
|
-
}
|
|
724
|
-
return $(d.getEditorState()), h(d.registerUpdateListener(({
|
|
725
|
-
editorState: M
|
|
726
|
-
}) => $(M)), _, () => {
|
|
727
|
-
_();
|
|
728
|
-
});
|
|
729
|
-
}
|
|
730
|
-
function u(d, ...E) {
|
|
731
|
-
E.forEach((f) => {
|
|
732
|
-
if (typeof f == "string") {
|
|
733
|
-
const N = f.split(" ").filter((C) => C !== "");
|
|
734
|
-
d.classList.add(...N);
|
|
735
|
-
}
|
|
736
|
-
});
|
|
737
|
-
}
|
|
738
|
-
function e(d, ...E) {
|
|
739
|
-
E.forEach((f) => {
|
|
740
|
-
typeof f == "string" && d.classList.remove(...f.split(" "));
|
|
741
|
-
});
|
|
742
|
-
}
|
|
743
|
-
function t(d, E) {
|
|
744
|
-
for (const f of E)
|
|
745
|
-
if (d.type.startsWith(f))
|
|
746
|
-
return !0;
|
|
747
|
-
return !1;
|
|
748
|
-
}
|
|
749
|
-
function n(d, E) {
|
|
750
|
-
const f = d[Symbol.iterator]();
|
|
751
|
-
return new Promise((N, C) => {
|
|
752
|
-
const b = [], _ = () => {
|
|
753
|
-
const {
|
|
754
|
-
done: $,
|
|
755
|
-
value: M
|
|
756
|
-
} = f.next();
|
|
757
|
-
if ($)
|
|
758
|
-
return N(b);
|
|
759
|
-
const O = new FileReader();
|
|
760
|
-
O.addEventListener("error", C), O.addEventListener("load", () => {
|
|
761
|
-
const F = O.result;
|
|
762
|
-
typeof F == "string" && b.push({
|
|
763
|
-
file: M,
|
|
764
|
-
result: F
|
|
765
|
-
}), _();
|
|
766
|
-
}), t(M, E) ? O.readAsDataURL(M) : _();
|
|
767
|
-
};
|
|
768
|
-
_();
|
|
769
|
-
});
|
|
770
|
-
}
|
|
771
|
-
function r(d, E) {
|
|
772
|
-
const f = [], N = (d || i.$getRoot()).getLatest(), C = E || (i.$isElementNode(N) ? N.getLastDescendant() : N);
|
|
773
|
-
let b = N, _ = s(b);
|
|
774
|
-
for (; b !== null && !b.is(C); )
|
|
775
|
-
if (f.push({
|
|
776
|
-
depth: _,
|
|
777
|
-
node: b
|
|
778
|
-
}), i.$isElementNode(b) && b.getChildrenSize() > 0)
|
|
779
|
-
b = b.getFirstChild(), _++;
|
|
780
|
-
else {
|
|
781
|
-
let $ = null;
|
|
782
|
-
for (; $ === null && b !== null; )
|
|
783
|
-
$ = b.getNextSibling(), $ === null ? (b = b.getParent(), _--) : b = $;
|
|
784
|
-
}
|
|
785
|
-
return b !== null && b.is(C) && f.push({
|
|
786
|
-
depth: _,
|
|
787
|
-
node: b
|
|
788
|
-
}), f;
|
|
789
|
-
}
|
|
790
|
-
function s(d) {
|
|
791
|
-
let E = d, f = 0;
|
|
792
|
-
for (; (E = E.getParent()) !== null; )
|
|
793
|
-
f++;
|
|
794
|
-
return f;
|
|
795
|
-
}
|
|
796
|
-
function l(d, E) {
|
|
797
|
-
let f = d;
|
|
798
|
-
for (; f != null; ) {
|
|
799
|
-
if (f instanceof E)
|
|
800
|
-
return f;
|
|
801
|
-
f = f.getParent();
|
|
802
|
-
}
|
|
803
|
-
return null;
|
|
804
|
-
}
|
|
805
|
-
function o(d) {
|
|
806
|
-
const E = x(d, (f) => i.$isElementNode(f) && !f.isInline());
|
|
807
|
-
if (!i.$isElementNode(E))
|
|
808
|
-
throw Error(`Expected node ${d.__key} to have closest block element node.`);
|
|
809
|
-
return E;
|
|
810
|
-
}
|
|
811
|
-
const x = (d, E) => {
|
|
812
|
-
let f = d;
|
|
813
|
-
for (; f !== i.$getRoot() && f != null; ) {
|
|
814
|
-
if (E(f))
|
|
815
|
-
return f;
|
|
816
|
-
f = f.getParent();
|
|
817
|
-
}
|
|
818
|
-
return null;
|
|
819
|
-
};
|
|
820
|
-
function v(d, E, f, N) {
|
|
821
|
-
const C = ($) => $ instanceof E, b = ($) => {
|
|
822
|
-
const M = $.getChildren();
|
|
823
|
-
for (let B = 0; B < M.length; B++) {
|
|
824
|
-
const q = M[B];
|
|
825
|
-
if (C(q))
|
|
826
|
-
return null;
|
|
827
|
-
}
|
|
828
|
-
let O = $, F = $;
|
|
829
|
-
for (; O !== null; )
|
|
830
|
-
if (F = O, O = O.getParent(), C(O))
|
|
831
|
-
return {
|
|
832
|
-
child: F,
|
|
833
|
-
parent: O
|
|
834
|
-
};
|
|
835
|
-
return null;
|
|
836
|
-
}, _ = ($) => {
|
|
837
|
-
const M = b($);
|
|
838
|
-
if (M !== null) {
|
|
839
|
-
const {
|
|
840
|
-
child: O,
|
|
841
|
-
parent: F
|
|
842
|
-
} = M;
|
|
843
|
-
if (O.is($)) {
|
|
844
|
-
N(F, $);
|
|
845
|
-
const B = O.getNextSiblings(), q = B.length;
|
|
846
|
-
if (F.insertAfter(O), q !== 0) {
|
|
847
|
-
const K = f(F);
|
|
848
|
-
O.insertAfter(K);
|
|
849
|
-
for (let H = 0; H < q; H++)
|
|
850
|
-
K.append(B[H]);
|
|
851
|
-
}
|
|
852
|
-
!F.canBeEmpty() && F.getChildrenSize() === 0 && F.remove();
|
|
853
|
-
}
|
|
854
|
-
}
|
|
855
|
-
};
|
|
856
|
-
return d.registerNodeTransform(E, _);
|
|
857
|
-
}
|
|
858
|
-
function g(d, E) {
|
|
859
|
-
const N = /* @__PURE__ */ new Map(), C = d._pendingEditorState;
|
|
860
|
-
for (const [_, $] of E._nodeMap) {
|
|
861
|
-
const M = c.$cloneWithProperties($);
|
|
862
|
-
if (i.$isTextNode(M)) {
|
|
863
|
-
if (!i.$isTextNode($))
|
|
864
|
-
throw Error("Expected node be a TextNode");
|
|
865
|
-
M.__text = $.__text;
|
|
866
|
-
}
|
|
867
|
-
N.set(_, M);
|
|
868
|
-
}
|
|
869
|
-
C && (C._nodeMap = N), d._dirtyType = 2;
|
|
870
|
-
const b = E._selection;
|
|
871
|
-
i.$setSelection(b === null ? null : b.clone());
|
|
872
|
-
}
|
|
873
|
-
function S(d) {
|
|
874
|
-
const E = i.$getSelection() || i.$getPreviousSelection();
|
|
875
|
-
if (i.$isRangeSelection(E)) {
|
|
876
|
-
const {
|
|
877
|
-
focus: f
|
|
878
|
-
} = E, N = f.getNode(), C = f.offset;
|
|
879
|
-
if (i.$isRootOrShadowRoot(N)) {
|
|
880
|
-
const b = N.getChildAtIndex(C);
|
|
881
|
-
b == null ? N.append(d) : b.insertBefore(d), d.selectNext();
|
|
882
|
-
} else {
|
|
883
|
-
let b, _;
|
|
884
|
-
i.$isTextNode(N) ? (b = N.getParentOrThrow(), _ = N.getIndexWithinParent(), C > 0 && (_ += 1, N.splitText(C))) : (b = N, _ = C);
|
|
885
|
-
const [, $] = i.$splitNode(b, _);
|
|
886
|
-
$.insertBefore(d), $.selectStart();
|
|
887
|
-
}
|
|
888
|
-
} else {
|
|
889
|
-
if (E != null) {
|
|
890
|
-
const N = E.getNodes();
|
|
891
|
-
N[N.length - 1].getTopLevelElementOrThrow().insertAfter(d);
|
|
892
|
-
} else
|
|
893
|
-
i.$getRoot().append(d);
|
|
894
|
-
const f = i.$createParagraphNode();
|
|
895
|
-
d.insertAfter(f), f.select();
|
|
896
|
-
}
|
|
897
|
-
return d.getLatest();
|
|
898
|
-
}
|
|
899
|
-
function T(d, E) {
|
|
900
|
-
const f = E();
|
|
901
|
-
return d.replace(f), f.append(d), f;
|
|
902
|
-
}
|
|
903
|
-
function y(d, E) {
|
|
904
|
-
return d !== null ? Object.getPrototypeOf(d).constructor.name === E.name : !1;
|
|
905
|
-
}
|
|
906
|
-
function w(d, E) {
|
|
907
|
-
const f = [];
|
|
908
|
-
for (let N = 0; N < d.length; N++) {
|
|
909
|
-
const C = E(d[N]);
|
|
910
|
-
C !== null && f.push(C);
|
|
911
|
-
}
|
|
912
|
-
return f;
|
|
913
|
-
}
|
|
914
|
-
function R(d, E) {
|
|
915
|
-
const f = d.getFirstChild();
|
|
916
|
-
f !== null ? f.insertBefore(E) : d.append(E);
|
|
917
|
-
}
|
|
918
|
-
return P.$splitNode = i.$splitNode, P.isHTMLAnchorElement = i.isHTMLAnchorElement, P.isHTMLElement = i.isHTMLElement, P.$dfs = r, P.$filter = w, P.$findMatchingParent = x, P.$getNearestBlockElementAncestorOrThrow = o, P.$getNearestNodeOfType = l, P.$insertFirst = R, P.$insertNodeToNearestRoot = S, P.$restoreEditorState = g, P.$wrapNodeInElement = T, P.addClassNamesToElement = u, P.isMimeType = t, P.markSelection = a, P.mediaFileReader = n, P.mergeRegister = h, P.objectKlassEquals = y, P.positionNodeOnRange = m, P.registerNestedElementResolver = v, P.removeClassNamesFromElement = e, P;
|
|
919
|
-
}
|
|
920
|
-
var D = {}, je;
|
|
921
|
-
function zt() {
|
|
922
|
-
if (je)
|
|
923
|
-
return D;
|
|
924
|
-
je = 1;
|
|
925
|
-
var c = tt, i = Y;
|
|
926
|
-
function h(e) {
|
|
927
|
-
let t = new URLSearchParams();
|
|
928
|
-
t.append("code", e);
|
|
929
|
-
for (let n = 1; n < arguments.length; n++)
|
|
930
|
-
t.append("v", arguments[n]);
|
|
931
|
-
throw Error(`Minified Lexical error #${e}; visit https://lexical.dev/docs/error?${t} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`);
|
|
932
|
-
}
|
|
933
|
-
function L(...e) {
|
|
934
|
-
return () => {
|
|
935
|
-
e.forEach((t) => t());
|
|
936
|
-
};
|
|
937
|
-
}
|
|
938
|
-
let p = { attributes: !0, characterData: !0, childList: !0, subtree: !0 };
|
|
939
|
-
function m(e, t, n) {
|
|
940
|
-
function r() {
|
|
941
|
-
if (o === null)
|
|
942
|
-
throw Error("Unexpected null rootDOMNode");
|
|
943
|
-
if (x === null)
|
|
944
|
-
throw Error("Unexpected null parentDOMNode");
|
|
945
|
-
let { left: y, top: w } = o.getBoundingClientRect();
|
|
946
|
-
var R = x;
|
|
947
|
-
let d = c.createRectsFromDOMRange(e, t);
|
|
948
|
-
S.isConnected || R.append(S), R = !1;
|
|
949
|
-
for (let N = 0; N < d.length; N++) {
|
|
950
|
-
var E = d[N];
|
|
951
|
-
let C = g[N] || document.createElement("div"), b = C.style;
|
|
952
|
-
b.position !== "absolute" && (b.position = "absolute", R = !0);
|
|
953
|
-
var f = `${E.left - y}px`;
|
|
954
|
-
b.left !== f && (b.left = f, R = !0), f = `${E.top - w}px`, b.top !== f && (C.style.top = f, R = !0), f = `${E.width}px`, b.width !== f && (C.style.width = f, R = !0), E = `${E.height}px`, b.height !== E && (C.style.height = E, R = !0), C.parentNode !== S && (S.append(C), R = !0), g[N] = C;
|
|
955
|
-
}
|
|
956
|
-
for (; g.length > d.length; )
|
|
957
|
-
g.pop();
|
|
958
|
-
R && n(g);
|
|
959
|
-
}
|
|
960
|
-
function s() {
|
|
961
|
-
o = x = null, v !== null && v.disconnect(), v = null, S.remove();
|
|
962
|
-
for (let y of g)
|
|
963
|
-
y.remove();
|
|
964
|
-
g = [];
|
|
965
|
-
}
|
|
966
|
-
function l() {
|
|
967
|
-
let y = e.getRootElement();
|
|
968
|
-
if (y === null)
|
|
969
|
-
return s();
|
|
970
|
-
let w = y.parentElement;
|
|
971
|
-
if (!(w instanceof HTMLElement))
|
|
972
|
-
return s();
|
|
973
|
-
s(), o = y, x = w, v = new MutationObserver((R) => {
|
|
974
|
-
let d = e.getRootElement(), E = d && d.parentElement;
|
|
975
|
-
if (d !== o || E !== x)
|
|
976
|
-
return l();
|
|
977
|
-
for (let f of R)
|
|
978
|
-
if (!S.contains(f.target))
|
|
979
|
-
return r();
|
|
980
|
-
}), v.observe(w, p), r();
|
|
981
|
-
}
|
|
982
|
-
let o = null, x = null, v = null, g = [], S = document.createElement("div"), T = e.registerRootListener(l);
|
|
983
|
-
return () => {
|
|
984
|
-
T(), s();
|
|
985
|
-
};
|
|
986
|
-
}
|
|
987
|
-
function a(e, t) {
|
|
988
|
-
for (let n of t)
|
|
989
|
-
if (e.type.startsWith(n))
|
|
990
|
-
return !0;
|
|
991
|
-
return !1;
|
|
992
|
-
}
|
|
993
|
-
let u = (e, t) => {
|
|
994
|
-
for (; e !== i.$getRoot() && e != null; ) {
|
|
995
|
-
if (t(e))
|
|
996
|
-
return e;
|
|
997
|
-
e = e.getParent();
|
|
998
|
-
}
|
|
999
|
-
return null;
|
|
1000
|
-
};
|
|
1001
|
-
return D.$splitNode = i.$splitNode, D.isHTMLAnchorElement = i.isHTMLAnchorElement, D.isHTMLElement = i.isHTMLElement, D.$dfs = function(e, t) {
|
|
1002
|
-
let n = [];
|
|
1003
|
-
e = (e || i.$getRoot()).getLatest(), t = t || (i.$isElementNode(e) ? e.getLastDescendant() : e);
|
|
1004
|
-
for (var r = e, s = 0; (r = r.getParent()) !== null; )
|
|
1005
|
-
s++;
|
|
1006
|
-
for (r = s; e !== null && !e.is(t); )
|
|
1007
|
-
if (n.push({ depth: r, node: e }), i.$isElementNode(e) && 0 < e.getChildrenSize())
|
|
1008
|
-
e = e.getFirstChild(), r++;
|
|
1009
|
-
else
|
|
1010
|
-
for (s = null; s === null && e !== null; )
|
|
1011
|
-
s = e.getNextSibling(), s === null ? (e = e.getParent(), r--) : e = s;
|
|
1012
|
-
return e !== null && e.is(t) && n.push({ depth: r, node: e }), n;
|
|
1013
|
-
}, D.$filter = function(e, t) {
|
|
1014
|
-
let n = [];
|
|
1015
|
-
for (let r = 0; r < e.length; r++) {
|
|
1016
|
-
let s = t(e[r]);
|
|
1017
|
-
s !== null && n.push(s);
|
|
1018
|
-
}
|
|
1019
|
-
return n;
|
|
1020
|
-
}, D.$findMatchingParent = u, D.$getNearestBlockElementAncestorOrThrow = function(e) {
|
|
1021
|
-
let t = u(e, (n) => i.$isElementNode(n) && !n.isInline());
|
|
1022
|
-
return i.$isElementNode(t) || h(4, e.__key), t;
|
|
1023
|
-
}, D.$getNearestNodeOfType = function(e, t) {
|
|
1024
|
-
for (; e != null; ) {
|
|
1025
|
-
if (e instanceof t)
|
|
1026
|
-
return e;
|
|
1027
|
-
e = e.getParent();
|
|
1028
|
-
}
|
|
1029
|
-
return null;
|
|
1030
|
-
}, D.$insertFirst = function(e, t) {
|
|
1031
|
-
let n = e.getFirstChild();
|
|
1032
|
-
n !== null ? n.insertBefore(t) : e.append(t);
|
|
1033
|
-
}, D.$insertNodeToNearestRoot = function(e) {
|
|
1034
|
-
var t = i.$getSelection() || i.$getPreviousSelection();
|
|
1035
|
-
if (i.$isRangeSelection(t)) {
|
|
1036
|
-
var { focus: n } = t;
|
|
1037
|
-
if (t = n.getNode(), n = n.offset, i.$isRootOrShadowRoot(t))
|
|
1038
|
-
n = t.getChildAtIndex(n), n == null ? t.append(e) : n.insertBefore(e), e.selectNext();
|
|
1039
|
-
else {
|
|
1040
|
-
let r, s;
|
|
1041
|
-
i.$isTextNode(t) ? (r = t.getParentOrThrow(), s = t.getIndexWithinParent(), 0 < n && (s += 1, t.splitText(n))) : (r = t, s = n), [, t] = i.$splitNode(r, s), t.insertBefore(e), t.selectStart();
|
|
1042
|
-
}
|
|
1043
|
-
} else
|
|
1044
|
-
t != null ? (t = t.getNodes(), t[t.length - 1].getTopLevelElementOrThrow().insertAfter(e)) : i.$getRoot().append(e), t = i.$createParagraphNode(), e.insertAfter(t), t.select();
|
|
1045
|
-
return e.getLatest();
|
|
1046
|
-
}, D.$restoreEditorState = function(e, t) {
|
|
1047
|
-
let n = /* @__PURE__ */ new Map(), r = e._pendingEditorState;
|
|
1048
|
-
for (let [s, l] of t._nodeMap) {
|
|
1049
|
-
let o = c.$cloneWithProperties(l);
|
|
1050
|
-
if (i.$isTextNode(o)) {
|
|
1051
|
-
if (!i.$isTextNode(l))
|
|
1052
|
-
throw Error("Expected node be a TextNode");
|
|
1053
|
-
o.__text = l.__text;
|
|
1054
|
-
}
|
|
1055
|
-
n.set(s, o);
|
|
1056
|
-
}
|
|
1057
|
-
r && (r._nodeMap = n), e._dirtyType = 2, e = t._selection, i.$setSelection(e === null ? null : e.clone());
|
|
1058
|
-
}, D.$wrapNodeInElement = function(e, t) {
|
|
1059
|
-
return t = t(), e.replace(t), t.append(e), t;
|
|
1060
|
-
}, D.addClassNamesToElement = function(e, ...t) {
|
|
1061
|
-
t.forEach((n) => {
|
|
1062
|
-
typeof n == "string" && (n = n.split(" ").filter((r) => r !== ""), e.classList.add(...n));
|
|
1063
|
-
});
|
|
1064
|
-
}, D.isMimeType = a, D.markSelection = function(e, t) {
|
|
1065
|
-
function n(v) {
|
|
1066
|
-
v.read(() => {
|
|
1067
|
-
var g = i.$getSelection();
|
|
1068
|
-
if (i.$isRangeSelection(g)) {
|
|
1069
|
-
var { anchor: S, focus: T } = g;
|
|
1070
|
-
g = S.getNode();
|
|
1071
|
-
var y = g.getKey(), w = S.offset, R = T.getNode(), d = R.getKey(), E = T.offset, f = e.getElementByKey(y), N = e.getElementByKey(d);
|
|
1072
|
-
if (y = r === null || f === null || w !== s || y !== r.getKey() || g !== r && (!(r instanceof i.TextNode) || g.updateDOM(r, f, e._config)), d = l === null || N === null || E !== o || d !== l.getKey() || R !== l && (!(l instanceof i.TextNode) || R.updateDOM(l, N, e._config)), y || d) {
|
|
1073
|
-
f = e.getElementByKey(S.getNode().getKey());
|
|
1074
|
-
var C = e.getElementByKey(T.getNode().getKey());
|
|
1075
|
-
if (f !== null && C !== null && f.tagName === "SPAN" && C.tagName === "SPAN") {
|
|
1076
|
-
if (d = document.createRange(), T.isBefore(S) ? (y = C, N = T.offset, C = f, f = S.offset) : (y = f, N = S.offset, f = T.offset), y = y.firstChild, y === null || (C = C.firstChild, C === null))
|
|
1077
|
-
throw Error("Expected text node to be first child of span");
|
|
1078
|
-
d.setStart(y, N), d.setEnd(C, f), x(), x = m(e, d, (b) => {
|
|
1079
|
-
for (let _ of b) {
|
|
1080
|
-
let $ = _.style;
|
|
1081
|
-
$.background !== "Highlight" && ($.background = "Highlight"), $.color !== "HighlightText" && ($.color = "HighlightText"), $.zIndex !== "-1" && ($.zIndex = "-1"), $.pointerEvents !== "none" && ($.pointerEvents = "none"), $.marginTop !== "-1.5px" && ($.marginTop = "-1.5px"), $.paddingTop !== "4px" && ($.paddingTop = "4px"), $.paddingBottom !== "0px" && ($.paddingBottom = "0px");
|
|
1082
|
-
}
|
|
1083
|
-
t !== void 0 && t(b);
|
|
1084
|
-
});
|
|
1085
|
-
}
|
|
1086
|
-
}
|
|
1087
|
-
r = g, s = w, l = R, o = E;
|
|
1088
|
-
} else
|
|
1089
|
-
o = l = s = r = null, x(), x = () => {
|
|
1090
|
-
};
|
|
1091
|
-
});
|
|
1092
|
-
}
|
|
1093
|
-
let r = null, s = null, l = null, o = null, x = () => {
|
|
1094
|
-
};
|
|
1095
|
-
return n(e.getEditorState()), L(e.registerUpdateListener(({ editorState: v }) => n(v)), x, () => {
|
|
1096
|
-
x();
|
|
1097
|
-
});
|
|
1098
|
-
}, D.mediaFileReader = function(e, t) {
|
|
1099
|
-
let n = e[Symbol.iterator]();
|
|
1100
|
-
return new Promise((r, s) => {
|
|
1101
|
-
let l = [], o = () => {
|
|
1102
|
-
const { done: x, value: v } = n.next();
|
|
1103
|
-
if (x)
|
|
1104
|
-
return r(l);
|
|
1105
|
-
const g = new FileReader();
|
|
1106
|
-
g.addEventListener("error", s), g.addEventListener("load", () => {
|
|
1107
|
-
const S = g.result;
|
|
1108
|
-
typeof S == "string" && l.push({ file: v, result: S }), o();
|
|
1109
|
-
}), a(v, t) ? g.readAsDataURL(v) : o();
|
|
1110
|
-
};
|
|
1111
|
-
o();
|
|
1112
|
-
});
|
|
1113
|
-
}, D.mergeRegister = L, D.objectKlassEquals = function(e, t) {
|
|
1114
|
-
return e !== null ? Object.getPrototypeOf(e).constructor.name === t.name : !1;
|
|
1115
|
-
}, D.positionNodeOnRange = m, D.registerNestedElementResolver = function(e, t, n, r) {
|
|
1116
|
-
return e.registerNodeTransform(t, (s) => {
|
|
1117
|
-
e: {
|
|
1118
|
-
for (var l = s.getChildren(), o = 0; o < l.length; o++)
|
|
1119
|
-
if (l[o] instanceof t) {
|
|
1120
|
-
l = null;
|
|
1121
|
-
break e;
|
|
1122
|
-
}
|
|
1123
|
-
for (l = s; l !== null; )
|
|
1124
|
-
if (o = l, l = l.getParent(), l instanceof t) {
|
|
1125
|
-
l = { child: o, parent: l };
|
|
1126
|
-
break e;
|
|
1127
|
-
}
|
|
1128
|
-
l = null;
|
|
1129
|
-
}
|
|
1130
|
-
if (l !== null) {
|
|
1131
|
-
const { child: x, parent: v } = l;
|
|
1132
|
-
if (x.is(s)) {
|
|
1133
|
-
if (r(v, s), s = x.getNextSiblings(), l = s.length, v.insertAfter(x), l !== 0) {
|
|
1134
|
-
o = n(v), x.insertAfter(o);
|
|
1135
|
-
for (let g = 0; g < l; g++)
|
|
1136
|
-
o.append(s[g]);
|
|
1137
|
-
}
|
|
1138
|
-
v.canBeEmpty() || v.getChildrenSize() !== 0 || v.remove();
|
|
1139
|
-
}
|
|
1140
|
-
}
|
|
1141
|
-
});
|
|
1142
|
-
}, D.removeClassNamesFromElement = function(e, ...t) {
|
|
1143
|
-
t.forEach((n) => {
|
|
1144
|
-
typeof n == "string" && e.classList.remove(...n.split(" "));
|
|
1145
|
-
});
|
|
1146
|
-
}, D;
|
|
1147
|
-
}
|
|
1148
|
-
var Ee, He;
|
|
1149
|
-
function at() {
|
|
1150
|
-
return He || (He = 1, Ee = process.env.NODE_ENV === "development" ? Ht() : zt()), Ee;
|
|
1151
|
-
}
|
|
1152
|
-
var ve = {}, ze;
|
|
1153
|
-
function Vt() {
|
|
1154
|
-
if (ze)
|
|
1155
|
-
return ve;
|
|
1156
|
-
ze = 1;
|
|
1157
|
-
var c = Y;
|
|
1158
|
-
function i(h) {
|
|
1159
|
-
const L = window.location.origin, p = (m) => {
|
|
1160
|
-
if (m.origin !== L)
|
|
1161
|
-
return;
|
|
1162
|
-
const a = h.getRootElement();
|
|
1163
|
-
if (document.activeElement !== a)
|
|
1164
|
-
return;
|
|
1165
|
-
const u = m.data;
|
|
1166
|
-
if (typeof u == "string") {
|
|
1167
|
-
let e;
|
|
1168
|
-
try {
|
|
1169
|
-
e = JSON.parse(u);
|
|
1170
|
-
} catch {
|
|
1171
|
-
return;
|
|
1172
|
-
}
|
|
1173
|
-
if (e && e.protocol === "nuanria_messaging" && e.type === "request") {
|
|
1174
|
-
const t = e.payload;
|
|
1175
|
-
if (t && t.functionId === "makeChanges") {
|
|
1176
|
-
const n = t.args;
|
|
1177
|
-
if (n) {
|
|
1178
|
-
const [r, s, l, o, x, v] = n;
|
|
1179
|
-
h.update(() => {
|
|
1180
|
-
const g = c.$getSelection();
|
|
1181
|
-
if (c.$isRangeSelection(g)) {
|
|
1182
|
-
const S = g.anchor;
|
|
1183
|
-
let T = S.getNode(), y = 0, w = 0;
|
|
1184
|
-
if (c.$isTextNode(T) && r >= 0 && s >= 0 && (y = r, w = r + s, g.setTextNodeRange(T, y, T, w)), (y !== w || l !== "") && (g.insertRawText(l), T = S.getNode()), c.$isTextNode(T)) {
|
|
1185
|
-
y = o, w = o + x;
|
|
1186
|
-
const R = T.getTextContentSize();
|
|
1187
|
-
y = y > R ? R : y, w = w > R ? R : w, g.setTextNodeRange(T, y, T, w);
|
|
1188
|
-
}
|
|
1189
|
-
m.stopImmediatePropagation();
|
|
1190
|
-
}
|
|
1191
|
-
});
|
|
1192
|
-
}
|
|
1193
|
-
}
|
|
1194
|
-
}
|
|
1195
|
-
}
|
|
1196
|
-
};
|
|
1197
|
-
return window.addEventListener("message", p, !0), () => {
|
|
1198
|
-
window.removeEventListener("message", p, !0);
|
|
1199
|
-
};
|
|
1200
|
-
}
|
|
1201
|
-
return ve.registerDragonSupport = i, ve;
|
|
1202
|
-
}
|
|
1203
|
-
var Ce = {}, Ve;
|
|
1204
|
-
function Wt() {
|
|
1205
|
-
if (Ve)
|
|
1206
|
-
return Ce;
|
|
1207
|
-
Ve = 1;
|
|
1208
|
-
var c = Y;
|
|
1209
|
-
return Ce.registerDragonSupport = function(i) {
|
|
1210
|
-
let h = window.location.origin, L = (p) => {
|
|
1211
|
-
if (p.origin === h) {
|
|
1212
|
-
var m = i.getRootElement();
|
|
1213
|
-
if (document.activeElement === m && (m = p.data, typeof m == "string")) {
|
|
1214
|
-
try {
|
|
1215
|
-
var a = JSON.parse(m);
|
|
1216
|
-
} catch {
|
|
1217
|
-
return;
|
|
1218
|
-
}
|
|
1219
|
-
if (a && a.protocol === "nuanria_messaging" && a.type === "request" && (a = a.payload) && a.functionId === "makeChanges" && (a = a.args)) {
|
|
1220
|
-
const [u, e, t, n, r] = a;
|
|
1221
|
-
i.update(() => {
|
|
1222
|
-
const s = c.$getSelection();
|
|
1223
|
-
if (c.$isRangeSelection(s)) {
|
|
1224
|
-
var l = s.anchor;
|
|
1225
|
-
let o = l.getNode(), x = 0, v = 0;
|
|
1226
|
-
c.$isTextNode(o) && 0 <= u && 0 <= e && (x = u, v = u + e, s.setTextNodeRange(o, x, o, v)), (x !== v || t !== "") && (s.insertRawText(t), o = l.getNode()), c.$isTextNode(o) && (x = n, v = n + r, l = o.getTextContentSize(), x = x > l ? l : x, v = v > l ? l : v, s.setTextNodeRange(o, x, o, v)), p.stopImmediatePropagation();
|
|
1227
|
-
}
|
|
1228
|
-
});
|
|
1229
|
-
}
|
|
1230
|
-
}
|
|
1231
|
-
}
|
|
1232
|
-
};
|
|
1233
|
-
return window.addEventListener("message", L, !0), () => {
|
|
1234
|
-
window.removeEventListener("message", L, !0);
|
|
1235
|
-
};
|
|
1236
|
-
}, Ce;
|
|
1237
|
-
}
|
|
1238
|
-
var ye, We;
|
|
1239
|
-
function ct() {
|
|
1240
|
-
return We || (We = 1, ye = process.env.NODE_ENV === "development" ? Vt() : Wt()), ye;
|
|
1241
|
-
}
|
|
1242
|
-
var Je;
|
|
1243
|
-
function Jt() {
|
|
1244
|
-
if (Je)
|
|
1245
|
-
return pe;
|
|
1246
|
-
Je = 1;
|
|
1247
|
-
var c = Q(), i = lt(), h = U, L = st(), p = at(), m = it, a = ct(), u = nt, n = typeof window < "u" && typeof window.document < "u" && typeof window.document.createElement < "u" ? h.useLayoutEffect : h.useEffect;
|
|
1248
|
-
function r(g) {
|
|
1249
|
-
return g.getEditorState().read(L.$canShowPlaceholderCurry(g.isComposing()));
|
|
1250
|
-
}
|
|
1251
|
-
function s(g) {
|
|
1252
|
-
const [S, T] = h.useState(() => r(g));
|
|
1253
|
-
return n(() => {
|
|
1254
|
-
function y() {
|
|
1255
|
-
const w = r(g);
|
|
1256
|
-
T(w);
|
|
1257
|
-
}
|
|
1258
|
-
return y(), p.mergeRegister(g.registerUpdateListener(() => {
|
|
1259
|
-
y();
|
|
1260
|
-
}), g.registerEditableListener(() => {
|
|
1261
|
-
y();
|
|
1262
|
-
}));
|
|
1263
|
-
}, [g]), S;
|
|
1264
|
-
}
|
|
1265
|
-
function l(g, S) {
|
|
1266
|
-
const [T, y] = h.useState(() => g.getDecorators());
|
|
1267
|
-
return n(() => g.registerDecoratorListener((w) => {
|
|
1268
|
-
m.flushSync(() => {
|
|
1269
|
-
y(w);
|
|
1270
|
-
});
|
|
1271
|
-
}), [g]), h.useEffect(() => {
|
|
1272
|
-
y(g.getDecorators());
|
|
1273
|
-
}, [g]), h.useMemo(() => {
|
|
1274
|
-
const w = [], R = Object.keys(T);
|
|
1275
|
-
for (let d = 0; d < R.length; d++) {
|
|
1276
|
-
const E = R[d], f = /* @__PURE__ */ h.createElement(S, {
|
|
1277
|
-
onError: (C) => g._onError(C)
|
|
1278
|
-
}, /* @__PURE__ */ h.createElement(h.Suspense, {
|
|
1279
|
-
fallback: null
|
|
1280
|
-
}, T[E])), N = g.getElementByKey(E);
|
|
1281
|
-
N !== null && w.push(/* @__PURE__ */ m.createPortal(f, N, E));
|
|
1282
|
-
}
|
|
1283
|
-
return w;
|
|
1284
|
-
}, [S, T, g]);
|
|
1285
|
-
}
|
|
1286
|
-
function o(g) {
|
|
1287
|
-
n(() => p.mergeRegister(u.registerRichText(g), a.registerDragonSupport(g)), [g]);
|
|
1288
|
-
}
|
|
1289
|
-
function x({
|
|
1290
|
-
contentEditable: g,
|
|
1291
|
-
placeholder: S,
|
|
1292
|
-
ErrorBoundary: T
|
|
1293
|
-
}) {
|
|
1294
|
-
const [y] = c.useLexicalComposerContext(), w = l(y, T);
|
|
1295
|
-
return o(y), /* @__PURE__ */ h.createElement(h.Fragment, null, g, /* @__PURE__ */ h.createElement(v, {
|
|
1296
|
-
content: S
|
|
1297
|
-
}), w);
|
|
1298
|
-
}
|
|
1299
|
-
function v({
|
|
1300
|
-
content: g
|
|
1301
|
-
}) {
|
|
1302
|
-
const [S] = c.useLexicalComposerContext(), T = s(S), y = i();
|
|
1303
|
-
return T ? typeof g == "function" ? g(y) : g : null;
|
|
1304
|
-
}
|
|
1305
|
-
return pe.RichTextPlugin = x, pe;
|
|
1306
|
-
}
|
|
1307
|
-
var Ne = {}, Ge;
|
|
1308
|
-
function Gt() {
|
|
1309
|
-
if (Ge)
|
|
1310
|
-
return Ne;
|
|
1311
|
-
Ge = 1;
|
|
1312
|
-
var c = Q(), i = lt(), h = U, L = st(), p = at(), m = it, a = ct(), u = nt, e = typeof window < "u" && typeof window.document < "u" && typeof window.document.createElement < "u" ? h.useLayoutEffect : h.useEffect;
|
|
1313
|
-
function t(o) {
|
|
1314
|
-
return o.getEditorState().read(L.$canShowPlaceholderCurry(o.isComposing()));
|
|
1315
|
-
}
|
|
1316
|
-
function n(o) {
|
|
1317
|
-
let [x, v] = h.useState(() => t(o));
|
|
1318
|
-
return e(() => {
|
|
1319
|
-
function g() {
|
|
1320
|
-
let S = t(o);
|
|
1321
|
-
v(S);
|
|
1322
|
-
}
|
|
1323
|
-
return g(), p.mergeRegister(o.registerUpdateListener(() => {
|
|
1324
|
-
g();
|
|
1325
|
-
}), o.registerEditableListener(() => {
|
|
1326
|
-
g();
|
|
1327
|
-
}));
|
|
1328
|
-
}, [o]), x;
|
|
1329
|
-
}
|
|
1330
|
-
function r(o, x) {
|
|
1331
|
-
let [v, g] = h.useState(() => o.getDecorators());
|
|
1332
|
-
return e(() => o.registerDecoratorListener((S) => {
|
|
1333
|
-
m.flushSync(() => {
|
|
1334
|
-
g(S);
|
|
1335
|
-
});
|
|
1336
|
-
}), [o]), h.useEffect(() => {
|
|
1337
|
-
g(o.getDecorators());
|
|
1338
|
-
}, [o]), h.useMemo(() => {
|
|
1339
|
-
let S = [], T = Object.keys(v);
|
|
1340
|
-
for (let y = 0; y < T.length; y++) {
|
|
1341
|
-
let w = T[y], R = h.createElement(x, { onError: (E) => o._onError(E) }, h.createElement(h.Suspense, { fallback: null }, v[w])), d = o.getElementByKey(w);
|
|
1342
|
-
d !== null && S.push(m.createPortal(R, d, w));
|
|
1343
|
-
}
|
|
1344
|
-
return S;
|
|
1345
|
-
}, [x, v, o]);
|
|
1346
|
-
}
|
|
1347
|
-
function s(o) {
|
|
1348
|
-
e(() => p.mergeRegister(u.registerRichText(o), a.registerDragonSupport(o)), [o]);
|
|
1349
|
-
}
|
|
1350
|
-
function l({ content: o }) {
|
|
1351
|
-
var [x] = c.useLexicalComposerContext();
|
|
1352
|
-
x = n(x);
|
|
1353
|
-
let v = i();
|
|
1354
|
-
return x ? typeof o == "function" ? o(v) : o : null;
|
|
1355
|
-
}
|
|
1356
|
-
return Ne.RichTextPlugin = function({ contentEditable: o, placeholder: x, ErrorBoundary: v }) {
|
|
1357
|
-
let [g] = c.useLexicalComposerContext();
|
|
1358
|
-
return v = r(g, v), s(g), h.createElement(h.Fragment, null, o, h.createElement(l, { content: x }), v);
|
|
1359
|
-
}, Ne;
|
|
1360
|
-
}
|
|
1361
|
-
const Yt = process.env.NODE_ENV === "development" ? Jt() : Gt();
|
|
1362
|
-
var Qt = Yt, Le = {}, Ye;
|
|
1363
|
-
function Xt() {
|
|
1364
|
-
if (Ye)
|
|
1365
|
-
return Le;
|
|
1366
|
-
Ye = 1;
|
|
1367
|
-
var c = Q(), i = U;
|
|
1368
|
-
function h() {
|
|
1369
|
-
return h = Object.assign ? Object.assign.bind() : function(u) {
|
|
1370
|
-
for (var e = 1; e < arguments.length; e++) {
|
|
1371
|
-
var t = arguments[e];
|
|
1372
|
-
for (var n in t)
|
|
1373
|
-
Object.prototype.hasOwnProperty.call(t, n) && (u[n] = t[n]);
|
|
1374
|
-
}
|
|
1375
|
-
return u;
|
|
1376
|
-
}, h.apply(this, arguments);
|
|
1377
|
-
}
|
|
1378
|
-
var m = typeof window < "u" && typeof window.document < "u" && typeof window.document.createElement < "u" ? i.useLayoutEffect : i.useEffect;
|
|
1379
|
-
function a({
|
|
1380
|
-
ariaActiveDescendant: u,
|
|
1381
|
-
ariaAutoComplete: e,
|
|
1382
|
-
ariaControls: t,
|
|
1383
|
-
ariaDescribedBy: n,
|
|
1384
|
-
ariaExpanded: r,
|
|
1385
|
-
ariaLabel: s,
|
|
1386
|
-
ariaLabelledBy: l,
|
|
1387
|
-
ariaMultiline: o,
|
|
1388
|
-
ariaOwns: x,
|
|
1389
|
-
ariaRequired: v,
|
|
1390
|
-
autoCapitalize: g,
|
|
1391
|
-
className: S,
|
|
1392
|
-
id: T,
|
|
1393
|
-
role: y = "textbox",
|
|
1394
|
-
spellCheck: w = !0,
|
|
1395
|
-
style: R,
|
|
1396
|
-
tabIndex: d,
|
|
1397
|
-
"data-testid": E,
|
|
1398
|
-
...f
|
|
1399
|
-
}) {
|
|
1400
|
-
const [N] = c.useLexicalComposerContext(), [C, b] = i.useState(!1), _ = i.useCallback(($) => {
|
|
1401
|
-
N.setRootElement($);
|
|
1402
|
-
}, [N]);
|
|
1403
|
-
return m(() => (b(N.isEditable()), N.registerEditableListener(($) => {
|
|
1404
|
-
b($);
|
|
1405
|
-
})), [N]), /* @__PURE__ */ i.createElement("div", h({}, f, {
|
|
1406
|
-
"aria-activedescendant": C ? u : void 0,
|
|
1407
|
-
"aria-autocomplete": C ? e : "none",
|
|
1408
|
-
"aria-controls": C ? t : void 0,
|
|
1409
|
-
"aria-describedby": n,
|
|
1410
|
-
"aria-expanded": C && y === "combobox" ? !!r : void 0,
|
|
1411
|
-
"aria-label": s,
|
|
1412
|
-
"aria-labelledby": l,
|
|
1413
|
-
"aria-multiline": o,
|
|
1414
|
-
"aria-owns": C ? x : void 0,
|
|
1415
|
-
"aria-readonly": C ? void 0 : !0,
|
|
1416
|
-
"aria-required": v,
|
|
1417
|
-
autoCapitalize: g,
|
|
1418
|
-
className: S,
|
|
1419
|
-
contentEditable: C,
|
|
1420
|
-
"data-testid": E,
|
|
1421
|
-
id: T,
|
|
1422
|
-
ref: _,
|
|
1423
|
-
role: y,
|
|
1424
|
-
spellCheck: w,
|
|
1425
|
-
style: R,
|
|
1426
|
-
tabIndex: d
|
|
1427
|
-
}));
|
|
1428
|
-
}
|
|
1429
|
-
return Le.ContentEditable = a, Le;
|
|
1430
|
-
}
|
|
1431
|
-
var Te = {}, Qe;
|
|
1432
|
-
function Zt() {
|
|
1433
|
-
if (Qe)
|
|
1434
|
-
return Te;
|
|
1435
|
-
Qe = 1;
|
|
1436
|
-
var c = Q(), i = U;
|
|
1437
|
-
function h() {
|
|
1438
|
-
return h = Object.assign ? Object.assign.bind() : function(p) {
|
|
1439
|
-
for (var m = 1; m < arguments.length; m++) {
|
|
1440
|
-
var a = arguments[m], u;
|
|
1441
|
-
for (u in a)
|
|
1442
|
-
Object.prototype.hasOwnProperty.call(a, u) && (p[u] = a[u]);
|
|
1443
|
-
}
|
|
1444
|
-
return p;
|
|
1445
|
-
}, h.apply(this, arguments);
|
|
1446
|
-
}
|
|
1447
|
-
var L = typeof window < "u" && typeof window.document < "u" && typeof window.document.createElement < "u" ? i.useLayoutEffect : i.useEffect;
|
|
1448
|
-
return Te.ContentEditable = function({ ariaActiveDescendant: p, ariaAutoComplete: m, ariaControls: a, ariaDescribedBy: u, ariaExpanded: e, ariaLabel: t, ariaLabelledBy: n, ariaMultiline: r, ariaOwns: s, ariaRequired: l, autoCapitalize: o, className: x, id: v, role: g = "textbox", spellCheck: S = !0, style: T, tabIndex: y, "data-testid": w, ...R }) {
|
|
1449
|
-
let [d] = c.useLexicalComposerContext(), [E, f] = i.useState(!1), N = i.useCallback((C) => {
|
|
1450
|
-
d.setRootElement(C);
|
|
1451
|
-
}, [d]);
|
|
1452
|
-
return L(() => (f(d.isEditable()), d.registerEditableListener((C) => {
|
|
1453
|
-
f(C);
|
|
1454
|
-
})), [d]), i.createElement(
|
|
1455
|
-
"div",
|
|
1456
|
-
h({}, R, { "aria-activedescendant": E ? p : void 0, "aria-autocomplete": E ? m : "none", "aria-controls": E ? a : void 0, "aria-describedby": u, "aria-expanded": E && g === "combobox" ? !!e : void 0, "aria-label": t, "aria-labelledby": n, "aria-multiline": r, "aria-owns": E ? s : void 0, "aria-readonly": E ? void 0 : !0, "aria-required": l, autoCapitalize: o, className: x, contentEditable: E, "data-testid": w, id: v, ref: N, role: g, spellCheck: S, style: T, tabIndex: y })
|
|
1457
|
-
);
|
|
1458
|
-
}, Te;
|
|
1459
|
-
}
|
|
1460
|
-
const en = process.env.NODE_ENV === "development" ? Xt() : Zt();
|
|
1461
|
-
var tn = en, be, Xe;
|
|
1462
|
-
function nn() {
|
|
1463
|
-
if (Xe)
|
|
1464
|
-
return be;
|
|
1465
|
-
Xe = 1;
|
|
1466
|
-
var c = U;
|
|
1467
|
-
function i(u, e) {
|
|
1468
|
-
return i = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function(n, r) {
|
|
1469
|
-
return n.__proto__ = r, n;
|
|
1470
|
-
}, i(u, e);
|
|
1471
|
-
}
|
|
1472
|
-
function h(u, e) {
|
|
1473
|
-
u.prototype = Object.create(e.prototype), u.prototype.constructor = u, i(u, e);
|
|
1474
|
-
}
|
|
1475
|
-
var L = function(e, t) {
|
|
1476
|
-
return e === void 0 && (e = []), t === void 0 && (t = []), e.length !== t.length || e.some(function(n, r) {
|
|
1477
|
-
return !Object.is(n, t[r]);
|
|
1478
|
-
});
|
|
1479
|
-
}, p = {
|
|
1480
|
-
error: null
|
|
1481
|
-
}, m = /* @__PURE__ */ function(u) {
|
|
1482
|
-
h(e, u);
|
|
1483
|
-
function e() {
|
|
1484
|
-
for (var n, r = arguments.length, s = new Array(r), l = 0; l < r; l++)
|
|
1485
|
-
s[l] = arguments[l];
|
|
1486
|
-
return n = u.call.apply(u, [this].concat(s)) || this, n.state = p, n.resetErrorBoundary = function() {
|
|
1487
|
-
for (var o, x = arguments.length, v = new Array(x), g = 0; g < x; g++)
|
|
1488
|
-
v[g] = arguments[g];
|
|
1489
|
-
n.props.onReset == null || (o = n.props).onReset.apply(o, v), n.reset();
|
|
1490
|
-
}, n;
|
|
1491
|
-
}
|
|
1492
|
-
e.getDerivedStateFromError = function(r) {
|
|
1493
|
-
return {
|
|
1494
|
-
error: r
|
|
1495
|
-
};
|
|
1496
|
-
};
|
|
1497
|
-
var t = e.prototype;
|
|
1498
|
-
return t.reset = function() {
|
|
1499
|
-
this.setState(p);
|
|
1500
|
-
}, t.componentDidCatch = function(r, s) {
|
|
1501
|
-
var l, o;
|
|
1502
|
-
(l = (o = this.props).onError) == null || l.call(o, r, s);
|
|
1503
|
-
}, t.componentDidUpdate = function(r, s) {
|
|
1504
|
-
var l = this.state.error, o = this.props.resetKeys;
|
|
1505
|
-
if (l !== null && s.error !== null && L(r.resetKeys, o)) {
|
|
1506
|
-
var x, v;
|
|
1507
|
-
(x = (v = this.props).onResetKeysChange) == null || x.call(v, r.resetKeys, o), this.reset();
|
|
1508
|
-
}
|
|
1509
|
-
}, t.render = function() {
|
|
1510
|
-
var r = this.state.error, s = this.props, l = s.fallbackRender, o = s.FallbackComponent, x = s.fallback;
|
|
1511
|
-
if (r !== null) {
|
|
1512
|
-
var v = {
|
|
1513
|
-
error: r,
|
|
1514
|
-
resetErrorBoundary: this.resetErrorBoundary
|
|
1515
|
-
};
|
|
1516
|
-
if (/* @__PURE__ */ c.isValidElement(x))
|
|
1517
|
-
return x;
|
|
1518
|
-
if (typeof l == "function")
|
|
1519
|
-
return l(v);
|
|
1520
|
-
if (o)
|
|
1521
|
-
return /* @__PURE__ */ c.createElement(o, v);
|
|
1522
|
-
throw new Error("react-error-boundary requires either a fallback, fallbackRender, or FallbackComponent prop");
|
|
1523
|
-
}
|
|
1524
|
-
return this.props.children;
|
|
1525
|
-
}, e;
|
|
1526
|
-
}(c.Component);
|
|
1527
|
-
function a({
|
|
1528
|
-
children: u,
|
|
1529
|
-
onError: e
|
|
1530
|
-
}) {
|
|
1531
|
-
return /* @__PURE__ */ c.createElement(m, {
|
|
1532
|
-
fallback: /* @__PURE__ */ c.createElement("div", {
|
|
1533
|
-
style: {
|
|
1534
|
-
border: "1px solid #f00",
|
|
1535
|
-
color: "#f00",
|
|
1536
|
-
padding: "8px"
|
|
1537
|
-
}
|
|
1538
|
-
}, "An error was thrown."),
|
|
1539
|
-
onError: e
|
|
1540
|
-
}, u);
|
|
1541
|
-
}
|
|
1542
|
-
return be = a, be;
|
|
1543
|
-
}
|
|
1544
|
-
var $e, Ze;
|
|
1545
|
-
function rn() {
|
|
1546
|
-
if (Ze)
|
|
1547
|
-
return $e;
|
|
1548
|
-
Ze = 1;
|
|
1549
|
-
var c = U;
|
|
1550
|
-
function i(a, u) {
|
|
1551
|
-
return i = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function(e, t) {
|
|
1552
|
-
return e.__proto__ = t, e;
|
|
1553
|
-
}, i(a, u);
|
|
1554
|
-
}
|
|
1555
|
-
function h(a, u) {
|
|
1556
|
-
a.prototype = Object.create(u.prototype), a.prototype.constructor = a, i(a, u);
|
|
1557
|
-
}
|
|
1558
|
-
function L(a, u) {
|
|
1559
|
-
return a === void 0 && (a = []), u === void 0 && (u = []), a.length !== u.length || a.some(function(e, t) {
|
|
1560
|
-
return !Object.is(e, u[t]);
|
|
1561
|
-
});
|
|
1562
|
-
}
|
|
1563
|
-
var p = { error: null }, m = function(a) {
|
|
1564
|
-
function u() {
|
|
1565
|
-
for (var t, n = arguments.length, r = Array(n), s = 0; s < n; s++)
|
|
1566
|
-
r[s] = arguments[s];
|
|
1567
|
-
return t = a.call.apply(a, [this].concat(r)) || this, t.state = p, t.resetErrorBoundary = function() {
|
|
1568
|
-
for (var l, o = arguments.length, x = Array(o), v = 0; v < o; v++)
|
|
1569
|
-
x[v] = arguments[v];
|
|
1570
|
-
t.props.onReset == null || (l = t.props).onReset.apply(l, x), t.reset();
|
|
1571
|
-
}, t;
|
|
1572
|
-
}
|
|
1573
|
-
h(u, a), u.getDerivedStateFromError = function(t) {
|
|
1574
|
-
return { error: t };
|
|
1575
|
-
};
|
|
1576
|
-
var e = u.prototype;
|
|
1577
|
-
return e.reset = function() {
|
|
1578
|
-
this.setState(p);
|
|
1579
|
-
}, e.componentDidCatch = function(t, n) {
|
|
1580
|
-
var r, s;
|
|
1581
|
-
(r = (s = this.props).onError) == null || r.call(s, t, n);
|
|
1582
|
-
}, e.componentDidUpdate = function(t, n) {
|
|
1583
|
-
var r = this.props.resetKeys;
|
|
1584
|
-
if (this.state.error !== null && n.error !== null && L(t.resetKeys, r)) {
|
|
1585
|
-
var s, l;
|
|
1586
|
-
(s = (l = this.props).onResetKeysChange) == null || s.call(l, t.resetKeys, r), this.reset();
|
|
1587
|
-
}
|
|
1588
|
-
}, e.render = function() {
|
|
1589
|
-
var t = this.state.error, n = this.props, r = n.fallbackRender, s = n.FallbackComponent;
|
|
1590
|
-
if (n = n.fallback, t !== null) {
|
|
1591
|
-
if (t = { error: t, resetErrorBoundary: this.resetErrorBoundary }, c.isValidElement(n))
|
|
1592
|
-
return n;
|
|
1593
|
-
if (typeof r == "function")
|
|
1594
|
-
return r(t);
|
|
1595
|
-
if (s)
|
|
1596
|
-
return c.createElement(s, t);
|
|
1597
|
-
throw Error("react-error-boundary requires either a fallback, fallbackRender, or FallbackComponent prop");
|
|
1598
|
-
}
|
|
1599
|
-
return this.props.children;
|
|
1600
|
-
}, u;
|
|
1601
|
-
}(c.Component);
|
|
1602
|
-
return $e = function({ children: a, onError: u }) {
|
|
1603
|
-
return c.createElement(m, { fallback: c.createElement("div", { style: { border: "1px solid #f00", color: "#f00", padding: "8px" } }, "An error was thrown."), onError: u }, a);
|
|
1604
|
-
}, $e;
|
|
1605
|
-
}
|
|
1606
|
-
const on = process.env.NODE_ENV === "development" ? nn() : rn();
|
|
1607
|
-
var ln = on;
|
|
1608
|
-
const sn = oe({
|
|
66
|
+
let s = "";
|
|
67
|
+
return o.update(() => {
|
|
68
|
+
s = N(o);
|
|
69
|
+
}), { html: s, trimCount: r };
|
|
70
|
+
}, Ce = [
|
|
71
|
+
F,
|
|
72
|
+
L,
|
|
73
|
+
w,
|
|
74
|
+
j,
|
|
75
|
+
E,
|
|
76
|
+
v,
|
|
77
|
+
R,
|
|
78
|
+
H,
|
|
79
|
+
k
|
|
80
|
+
], Q = m({
|
|
1609
81
|
fontWeight: "bold"
|
|
1610
|
-
}),
|
|
82
|
+
}), Y = m({
|
|
1611
83
|
fontStyle: "italic"
|
|
1612
|
-
}),
|
|
84
|
+
}), G = m({
|
|
1613
85
|
textDecoration: "underline"
|
|
1614
|
-
}),
|
|
86
|
+
}), K = m({
|
|
1615
87
|
listStyleType: "none"
|
|
1616
|
-
}),
|
|
88
|
+
}), U = m({
|
|
1617
89
|
borderLeft: "4px solid #ccc",
|
|
1618
90
|
color: "#666",
|
|
1619
91
|
fontStyle: "italic",
|
|
1620
92
|
margin: "1.5em 10px",
|
|
1621
93
|
padding: "0.5em 10px"
|
|
1622
|
-
}),
|
|
1623
|
-
quote:
|
|
94
|
+
}), X = {
|
|
95
|
+
quote: U().className,
|
|
1624
96
|
text: {
|
|
1625
|
-
bold:
|
|
1626
|
-
italic:
|
|
1627
|
-
underline:
|
|
97
|
+
bold: Q().className,
|
|
98
|
+
italic: Y().className,
|
|
99
|
+
underline: G().className
|
|
1628
100
|
},
|
|
1629
101
|
list: {
|
|
1630
102
|
nested: {
|
|
1631
|
-
listitem:
|
|
103
|
+
listitem: K().className
|
|
1632
104
|
}
|
|
1633
105
|
}
|
|
1634
|
-
},
|
|
1635
|
-
const [
|
|
1636
|
-
|
|
1637
|
-
}, []),
|
|
1638
|
-
|
|
1639
|
-
|
|
106
|
+
}, b = P({ hasFocus: !1, editorRef: { current: null } }), Z = ({ onBlur: e }) => {
|
|
107
|
+
const [a, n] = B(!1), r = h(null), o = u(() => {
|
|
108
|
+
n(!0), r.current && window.clearTimeout(r.current);
|
|
109
|
+
}, []), s = u(() => {
|
|
110
|
+
r.current = window.setTimeout(() => {
|
|
111
|
+
n(!1), e == null || e();
|
|
1640
112
|
}, 0);
|
|
1641
|
-
}, [
|
|
113
|
+
}, [e]);
|
|
1642
114
|
return {
|
|
1643
|
-
hasFocus:
|
|
115
|
+
hasFocus: a,
|
|
1644
116
|
attributes: {
|
|
1645
|
-
onFocus:
|
|
1646
|
-
onBlur:
|
|
117
|
+
onFocus: o,
|
|
118
|
+
onBlur: s
|
|
1647
119
|
}
|
|
1648
120
|
};
|
|
1649
|
-
},
|
|
121
|
+
}, Ne = () => I(b), _ = f("div", {
|
|
1650
122
|
border: "1px solid $borderDarker",
|
|
1651
123
|
borderRadius: "$md",
|
|
1652
124
|
position: "relative",
|
|
@@ -1676,7 +148,7 @@ const sn = oe({
|
|
|
1676
148
|
}
|
|
1677
149
|
}
|
|
1678
150
|
]
|
|
1679
|
-
}),
|
|
151
|
+
}), ee = f(D, {}, {
|
|
1680
152
|
padding: "0 $4",
|
|
1681
153
|
overflowY: "auto",
|
|
1682
154
|
maxHeight: "30rem",
|
|
@@ -1700,55 +172,54 @@ const sn = oe({
|
|
|
1700
172
|
color: "$gray500"
|
|
1701
173
|
}
|
|
1702
174
|
}
|
|
1703
|
-
}),
|
|
1704
|
-
isLoading:
|
|
1705
|
-
}) => /* @__PURE__ */
|
|
1706
|
-
|
|
175
|
+
}), te = ({
|
|
176
|
+
isLoading: e
|
|
177
|
+
}) => /* @__PURE__ */ i.jsx(
|
|
178
|
+
x,
|
|
1707
179
|
{
|
|
1708
180
|
css: {
|
|
1709
|
-
visibility:
|
|
181
|
+
visibility: e ? "visible" : "hidden",
|
|
1710
182
|
position: "absolute",
|
|
1711
183
|
bottom: "1rem",
|
|
1712
184
|
right: "1rem",
|
|
1713
185
|
display: "flex"
|
|
1714
186
|
},
|
|
1715
|
-
children: /* @__PURE__ */
|
|
1716
|
-
}
|
|
1717
|
-
),
|
|
1718
|
-
isLoading:
|
|
1719
|
-
children:
|
|
1720
|
-
placeholderText:
|
|
1721
|
-
nodes:
|
|
1722
|
-
plugins:
|
|
1723
|
-
toolbar:
|
|
1724
|
-
refs: a
|
|
187
|
+
children: /* @__PURE__ */ i.jsx(z, {})
|
|
188
|
+
}
|
|
189
|
+
), Te = ({
|
|
190
|
+
isLoading: e,
|
|
191
|
+
children: a,
|
|
192
|
+
placeholderText: n,
|
|
193
|
+
nodes: r,
|
|
194
|
+
plugins: o,
|
|
195
|
+
toolbar: s
|
|
1725
196
|
}) => {
|
|
1726
|
-
const { hasFocus:
|
|
1727
|
-
return /* @__PURE__ */
|
|
1728
|
-
|
|
197
|
+
const { hasFocus: t, attributes: c } = Z({}), l = h(null), d = M(() => ({ hasFocus: t, editorRef: l }), [t]);
|
|
198
|
+
return /* @__PURE__ */ i.jsx(b.Provider, { value: d, children: /* @__PURE__ */ i.jsxs(
|
|
199
|
+
q,
|
|
1729
200
|
{
|
|
1730
201
|
initialConfig: {
|
|
1731
202
|
namespace: "CommentEditor",
|
|
1732
|
-
onError: (
|
|
1733
|
-
console.error(
|
|
203
|
+
onError: (g) => {
|
|
204
|
+
console.error(g);
|
|
1734
205
|
},
|
|
1735
|
-
theme:
|
|
1736
|
-
nodes:
|
|
206
|
+
theme: X,
|
|
207
|
+
nodes: r,
|
|
1737
208
|
editable: !0
|
|
1738
209
|
},
|
|
1739
210
|
children: [
|
|
1740
|
-
/* @__PURE__ */
|
|
1741
|
-
|
|
211
|
+
/* @__PURE__ */ i.jsxs(
|
|
212
|
+
_,
|
|
1742
213
|
{
|
|
1743
|
-
ref:
|
|
1744
|
-
hasFocus:
|
|
1745
|
-
...
|
|
214
|
+
ref: l,
|
|
215
|
+
hasFocus: t,
|
|
216
|
+
...c,
|
|
1746
217
|
children: [
|
|
1747
|
-
/* @__PURE__ */
|
|
1748
|
-
|
|
218
|
+
/* @__PURE__ */ i.jsx(
|
|
219
|
+
A,
|
|
1749
220
|
{
|
|
1750
|
-
contentEditable: /* @__PURE__ */
|
|
1751
|
-
|
|
221
|
+
contentEditable: /* @__PURE__ */ i.jsx(
|
|
222
|
+
ee,
|
|
1752
223
|
{
|
|
1753
224
|
css: {
|
|
1754
225
|
paddingTop: 16,
|
|
@@ -1756,8 +227,8 @@ const sn = oe({
|
|
|
1756
227
|
}
|
|
1757
228
|
}
|
|
1758
229
|
),
|
|
1759
|
-
placeholder:
|
|
1760
|
-
|
|
230
|
+
placeholder: n ? /* @__PURE__ */ i.jsx(
|
|
231
|
+
x,
|
|
1761
232
|
{
|
|
1762
233
|
css: {
|
|
1763
234
|
position: "absolute",
|
|
@@ -1767,26 +238,29 @@ const sn = oe({
|
|
|
1767
238
|
pointerEvents: "none",
|
|
1768
239
|
fontSize: "$sm"
|
|
1769
240
|
},
|
|
1770
|
-
children:
|
|
241
|
+
children: n
|
|
1771
242
|
}
|
|
1772
243
|
) : null,
|
|
1773
|
-
ErrorBoundary:
|
|
244
|
+
ErrorBoundary: V
|
|
1774
245
|
}
|
|
1775
246
|
),
|
|
1776
|
-
|
|
1777
|
-
/* @__PURE__ */
|
|
1778
|
-
|
|
247
|
+
o,
|
|
248
|
+
/* @__PURE__ */ i.jsx(te, { isLoading: e }),
|
|
249
|
+
s
|
|
1779
250
|
]
|
|
1780
251
|
}
|
|
1781
252
|
),
|
|
1782
|
-
/* @__PURE__ */
|
|
253
|
+
/* @__PURE__ */ i.jsx(i.Fragment, { children: a })
|
|
1783
254
|
]
|
|
1784
255
|
}
|
|
1785
256
|
) });
|
|
1786
257
|
};
|
|
1787
258
|
export {
|
|
1788
|
-
|
|
1789
|
-
|
|
1790
|
-
|
|
1791
|
-
|
|
259
|
+
Te as RichTextEditor,
|
|
260
|
+
Ce as defaultNodes,
|
|
261
|
+
O as isJSON,
|
|
262
|
+
b as richTextContext,
|
|
263
|
+
ge as stateToHTML,
|
|
264
|
+
Z as useHasFocusWithin,
|
|
265
|
+
Ne as useRichTextContext
|
|
1792
266
|
};
|