@uva-glass/component-library 3.0.0 → 3.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/RteEditor/RteEditor.js +113 -114
- package/dist/components/RteEditor/RteEditor.js.map +1 -1
- package/dist/{react-18-CT6mjea2.js → react-18-C9Y1Flwa.js} +23 -23
- package/dist/{react-18-CT6mjea2.js.map → react-18-C9Y1Flwa.js.map} +1 -1
- package/dist/storybook__react.d.js +4 -4
- package/dist/storybook__react.d.js.map +1 -1
- package/package.json +2 -2
- package/dist/index-BpZ8v2ye.js +0 -19125
- package/dist/index-BpZ8v2ye.js.map +0 -1
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
import { jsx as h, jsxs as K, Fragment as
|
|
2
|
-
import { l as
|
|
3
|
-
import { ap as
|
|
1
|
+
import { jsx as h, jsxs as K, Fragment as Pe } from "react/jsx-runtime";
|
|
2
|
+
import { l as We, o as Je, u as P } from "../../LexicalComposerContext.prod-DxxjdrXB.js";
|
|
3
|
+
import { ap as Te, a2 as A, V as Me, H as p, I as q, L as V, j as Xe, v as R, a as g, N as Ge, f as m, aq as Ye, a1 as Re, F as Ie, ar as Ze, B as Qe, ao as F, am as et, as as tt, at as nt, au as rt, d as ne, av as ot, aw as at, w as st, i as it, M as lt, k as ut, ax as ct, ay as fe, o as me, U as dt, R as re, T as ft, a6 as Oe, az as pe, D as mt, C as pt, S as gt, a5 as ge, z as ht, aA as Ct, aB as yt, aC as Et, ak as vt, m as wt, l as bt, aD as $t, p as St, K as _t, G as kt, a8 as xt, e as Nt, q as he, aE as Lt, E as Dt, aa as G, a9 as Y, aF as Pt, aG as Tt, ac as Mt, ab as Rt } from "../../Lexical.prod-CQl7J8uU.js";
|
|
4
4
|
import * as oe from "react";
|
|
5
|
-
import { useMemo as W, useLayoutEffect as j, useEffect as _, useState as I, useRef as
|
|
6
|
-
import { N as U, c as z, o as
|
|
7
|
-
import {
|
|
5
|
+
import { useMemo as W, useLayoutEffect as j, useEffect as _, useState as I, useRef as Fe, Suspense as It, forwardRef as Ke, useCallback as Ot } from "react";
|
|
6
|
+
import { N as U, c as z, o as Ft, r as de } from "../../LexicalUtils.prod-D9KKqgU7.js";
|
|
7
|
+
import { flushSync as Kt, createPortal as zt } from "react-dom";
|
|
8
8
|
import { N as Ce, O as ye, h as At, m as Bt } from "../../LexicalClipboard.prod-C48GDxiy.js";
|
|
9
9
|
import { M as Ee, j as ve } from "../../LexicalSelection.prod-BU3GAQB4.js";
|
|
10
|
-
import { V as
|
|
11
|
-
import { f as
|
|
12
|
-
import { a as
|
|
10
|
+
import { V as ze, I as Ae, Z as jt } from "../../LexicalList.prod-B4_DTbPB.js";
|
|
11
|
+
import { f as Be, N as we, x as ae, m as Ut, O as Ht } from "../../LexicalLink.prod-D8-zZW0o.js";
|
|
12
|
+
import { a as qt, j as Vt, X as Wt, q as Jt, u as je, S as Xt, P as Gt } from "../../LexicalTable.prod-BvJxbarH.js";
|
|
13
13
|
import { a as Yt, F as Zt, M as Qt } from "../../helpers-C_Mib4v3.js";
|
|
14
14
|
import { c as en } from "../../clsx-OuTLNxxd.js";
|
|
15
15
|
import { exportMap as tn, isStartingWithHtmlTag as nn, mergeBoldStrongTags as rn } from "./helpers.js";
|
|
16
|
-
import { s as
|
|
16
|
+
import { s as M } from "../../RteEditor.module-oFMKEW6f.js";
|
|
17
17
|
import { ToolBarPlugin as on } from "./Plugins/ToolbarPlugin/ToolbarPlugin.js";
|
|
18
18
|
import { useTranslation as an } from "./hooks/useTranslation.js";
|
|
19
19
|
import "../../TablePlugin-CPEwD-wi.js";
|
|
@@ -41,10 +41,10 @@ import { UvaTheme as ln } from "./UvaTheme/UvaTheme.js";
|
|
|
41
41
|
import { EditorHeader as un } from "./EditorHeader/EditorHeader.js";
|
|
42
42
|
import { useLanguage as cn, LanguageProvider as dn } from "./Providers/LanguageProvider.js";
|
|
43
43
|
import { PasteHandlerPlugin as fn } from "./Plugins/PasteHandlerPlugin/PasteHandlerPlugin.js";
|
|
44
|
-
const
|
|
44
|
+
const Ue = typeof window < "u" && window.document !== void 0 && window.document.createElement !== void 0, mn = Ue ? j : _, Z = { tag: "history-merge" };
|
|
45
45
|
function pn({ initialConfig: n, children: e }) {
|
|
46
46
|
const t = W(() => {
|
|
47
|
-
const { theme: o, namespace: a, nodes: r, onError: s, editorState: i, html: l } = n, u =
|
|
47
|
+
const { theme: o, namespace: a, nodes: r, onError: s, editorState: i, html: l } = n, u = Je(null, o), c = Te({ editable: n.editable, html: l, namespace: a, nodes: r, onError: (d) => s(d, c), theme: o });
|
|
48
48
|
return function(d, f) {
|
|
49
49
|
if (f !== null) {
|
|
50
50
|
if (f === void 0) d.update(() => {
|
|
@@ -52,7 +52,7 @@ function pn({ initialConfig: n, children: e }) {
|
|
|
52
52
|
if (C.isEmpty()) {
|
|
53
53
|
const y = Me();
|
|
54
54
|
C.append(y);
|
|
55
|
-
const w =
|
|
55
|
+
const w = Ue ? document.activeElement : null;
|
|
56
56
|
(p() !== null || w !== null && w === d.getRootElement()) && y.select();
|
|
57
57
|
}
|
|
58
58
|
}, Z);
|
|
@@ -76,7 +76,7 @@ function pn({ initialConfig: n, children: e }) {
|
|
|
76
76
|
return mn(() => {
|
|
77
77
|
const o = n.editable, [a] = t;
|
|
78
78
|
a.setEditable(o === void 0 || o);
|
|
79
|
-
}, []), h(
|
|
79
|
+
}, []), h(We.Provider, { value: t, children: e });
|
|
80
80
|
}
|
|
81
81
|
const gn = typeof window < "u" && window.document !== void 0 && window.document.createElement !== void 0 ? j : _;
|
|
82
82
|
function hn(n) {
|
|
@@ -84,7 +84,7 @@ function hn(n) {
|
|
|
84
84
|
}
|
|
85
85
|
function Cn() {
|
|
86
86
|
return function(n) {
|
|
87
|
-
const [e] = P(), t = W(() => n(e), [e, n]), [o, a] = I(() => t.initialValueFn()), r =
|
|
87
|
+
const [e] = P(), t = W(() => n(e), [e, n]), [o, a] = I(() => t.initialValueFn()), r = Fe(o);
|
|
88
88
|
return gn(() => {
|
|
89
89
|
const { initialValueFn: s, subscribe: i } = t, l = s();
|
|
90
90
|
return r.current !== l && (r.current = l, a(l)), i((u) => {
|
|
@@ -107,13 +107,13 @@ function vn(n) {
|
|
|
107
107
|
if (t > 1) return !1;
|
|
108
108
|
for (let o = 0; o < t; o++) {
|
|
109
109
|
const a = e[o];
|
|
110
|
-
if (
|
|
110
|
+
if (q(a)) return !1;
|
|
111
111
|
if (V(a)) {
|
|
112
|
-
if (!
|
|
112
|
+
if (!Xe(a) || a.__indent !== 0) return !1;
|
|
113
113
|
const r = a.getChildren(), s = r.length;
|
|
114
114
|
for (let i = 0; i < s; i++) {
|
|
115
115
|
const l = r[o];
|
|
116
|
-
if (!
|
|
116
|
+
if (!R(l)) return !1;
|
|
117
117
|
}
|
|
118
118
|
}
|
|
119
119
|
}
|
|
@@ -131,7 +131,6 @@ wn(function(n) {
|
|
|
131
131
|
for (let t = 1; t < arguments.length; t++) e.append("v", arguments[t]);
|
|
132
132
|
throw Error(`Minified Lexical error #${n}; visit https://lexical.dev/docs/error?${e} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`);
|
|
133
133
|
});
|
|
134
|
-
var be = zt();
|
|
135
134
|
function bn(n) {
|
|
136
135
|
const e = window.location.origin, t = (o) => {
|
|
137
136
|
if (o.origin !== e) return;
|
|
@@ -156,7 +155,7 @@ function bn(n) {
|
|
|
156
155
|
if (g(w)) {
|
|
157
156
|
const k = w.anchor;
|
|
158
157
|
let E = k.getNode(), v = 0, $ = 0;
|
|
159
|
-
if (
|
|
158
|
+
if (R(E) && u >= 0 && c >= 0 && (v = u, $ = u + c, w.setTextNodeRange(E, v, E, $)), v === $ && d === "" || (w.insertRawText(d), E = k.getNode()), R(E)) {
|
|
160
159
|
v = f, $ = f + C;
|
|
161
160
|
const x = E.getTextContentSize();
|
|
162
161
|
v = v > x ? x : v, $ = $ > x ? x : $, w.setTextNodeRange(E, v, E, $);
|
|
@@ -173,7 +172,7 @@ function bn(n) {
|
|
|
173
172
|
window.removeEventListener("message", t, !0);
|
|
174
173
|
};
|
|
175
174
|
}
|
|
176
|
-
function
|
|
175
|
+
function be(n, e) {
|
|
177
176
|
if (document.caretRangeFromPoint !== void 0) {
|
|
178
177
|
const t = document.caretRangeFromPoint(n, e);
|
|
179
178
|
return t === null ? null : { node: t.startContainer, offset: t.startOffset };
|
|
@@ -184,14 +183,14 @@ function $e(n, e) {
|
|
|
184
183
|
}
|
|
185
184
|
return null;
|
|
186
185
|
}
|
|
187
|
-
const
|
|
186
|
+
const H = typeof window < "u" && window.document !== void 0 && window.document.createElement !== void 0, $n = H && "documentMode" in document ? document.documentMode : null, Sn = !(!H || !("InputEvent" in window) || $n) && "getTargetRanges" in new window.InputEvent("input"), _n = H && /Version\/[\d.]+.*Safari/.test(navigator.userAgent), $e = H && /iPad|iPhone|iPod/.test(navigator.userAgent) && !window.MSStream, kn = H && /^(?=.*Chrome).*/i.test(navigator.userAgent), xn = H && /AppleWebKit\/[\d.]+/.test(navigator.userAgent) && !kn, Se = Nt();
|
|
188
187
|
function Q(n) {
|
|
189
188
|
let e = null;
|
|
190
189
|
if (z(n, DragEvent) ? e = n.dataTransfer : z(n, ClipboardEvent) && (e = n.clipboardData), e === null) return [!1, [], !1];
|
|
191
190
|
const t = e.types, o = t.includes("Files"), a = t.includes("text/html") || t.includes("text/plain");
|
|
192
191
|
return [o, Array.from(e.files), a];
|
|
193
192
|
}
|
|
194
|
-
function
|
|
193
|
+
function _e(n) {
|
|
195
194
|
const e = p();
|
|
196
195
|
if (!g(e)) return !1;
|
|
197
196
|
const t = /* @__PURE__ */ new Set(), o = e.getNodes();
|
|
@@ -207,25 +206,25 @@ function ke(n) {
|
|
|
207
206
|
}
|
|
208
207
|
function ee(n) {
|
|
209
208
|
const e = ne(n);
|
|
210
|
-
return
|
|
209
|
+
return q(e);
|
|
211
210
|
}
|
|
212
211
|
function se(n) {
|
|
213
212
|
for (const e of ["lowercase", "uppercase", "capitalize"]) n.hasFormat(e) && n.toggleFormat(e);
|
|
214
213
|
}
|
|
215
214
|
function Nn(n) {
|
|
216
|
-
return U(n.registerCommand(
|
|
215
|
+
return U(n.registerCommand(xt, (e) => {
|
|
217
216
|
const t = p();
|
|
218
217
|
return !!F(t) && (t.clear(), !0);
|
|
219
218
|
}, 0), n.registerCommand(re, (e) => {
|
|
220
219
|
const t = p();
|
|
221
220
|
return !!g(t) && (t.deleteCharacter(e), !0);
|
|
222
|
-
}, m), n.registerCommand(
|
|
221
|
+
}, m), n.registerCommand(kt, (e) => {
|
|
223
222
|
const t = p();
|
|
224
223
|
return !!g(t) && (t.deleteWord(e), !0);
|
|
225
|
-
}, m), n.registerCommand(
|
|
224
|
+
}, m), n.registerCommand(_t, (e) => {
|
|
226
225
|
const t = p();
|
|
227
226
|
return !!g(t) && (t.deleteLine(e), !0);
|
|
228
|
-
}, m), n.registerCommand(
|
|
227
|
+
}, m), n.registerCommand(St, (e) => {
|
|
229
228
|
const t = p();
|
|
230
229
|
if (typeof e == "string") t !== null && t.insertText(e);
|
|
231
230
|
else {
|
|
@@ -238,13 +237,13 @@ function Nn(n) {
|
|
|
238
237
|
}
|
|
239
238
|
}
|
|
240
239
|
return !0;
|
|
241
|
-
}, m), n.registerCommand(
|
|
240
|
+
}, m), n.registerCommand($t, () => {
|
|
242
241
|
const e = p();
|
|
243
242
|
return !!g(e) && (e.removeText(), !0);
|
|
244
|
-
}, m), n.registerCommand(
|
|
243
|
+
}, m), n.registerCommand(bt, (e) => {
|
|
245
244
|
const t = p();
|
|
246
245
|
return !!g(t) && (t.formatText(e), !0);
|
|
247
|
-
}, m), n.registerCommand(
|
|
246
|
+
}, m), n.registerCommand(wt, (e) => {
|
|
248
247
|
const t = p();
|
|
249
248
|
if (!g(t) && !F(t)) return !1;
|
|
250
249
|
const o = t.getNodes();
|
|
@@ -259,23 +258,23 @@ function Nn(n) {
|
|
|
259
258
|
}, m), n.registerCommand(me, () => {
|
|
260
259
|
const e = p();
|
|
261
260
|
return !!g(e) && (e.insertParagraph(), !0);
|
|
262
|
-
}, m), n.registerCommand(
|
|
261
|
+
}, m), n.registerCommand(yt, () => (Et([vt()]), !0), m), n.registerCommand(Ct, () => _e((e) => {
|
|
263
262
|
const t = e.getIndent();
|
|
264
263
|
e.setIndent(t + 1);
|
|
265
|
-
}), m), n.registerCommand(pe, () =>
|
|
264
|
+
}), m), n.registerCommand(pe, () => _e((e) => {
|
|
266
265
|
const t = e.getIndent();
|
|
267
266
|
t > 0 && e.setIndent(t - 1);
|
|
268
|
-
}), m), n.registerCommand(
|
|
267
|
+
}), m), n.registerCommand(ht, (e) => {
|
|
269
268
|
const t = p();
|
|
270
269
|
if (F(t) && !ee(e.target)) {
|
|
271
270
|
const o = t.getNodes();
|
|
272
271
|
if (o.length > 0) return o[0].selectPrevious(), !0;
|
|
273
272
|
} else if (g(t)) {
|
|
274
273
|
const o = ge(t.focus, !0);
|
|
275
|
-
if (!e.shiftKey &&
|
|
274
|
+
if (!e.shiftKey && q(o) && !o.isIsolated() && !o.isInline()) return o.selectPrevious(), e.preventDefault(), !0;
|
|
276
275
|
}
|
|
277
276
|
return !1;
|
|
278
|
-
}, m), n.registerCommand(
|
|
277
|
+
}, m), n.registerCommand(gt, (e) => {
|
|
279
278
|
const t = p();
|
|
280
279
|
if (F(t)) {
|
|
281
280
|
const o = t.getNodes();
|
|
@@ -286,10 +285,10 @@ function Nn(n) {
|
|
|
286
285
|
return r.key === "root" && r.offset === A().getChildrenSize();
|
|
287
286
|
}(t)) return e.preventDefault(), !0;
|
|
288
287
|
const o = ge(t.focus, !1);
|
|
289
|
-
if (!e.shiftKey &&
|
|
288
|
+
if (!e.shiftKey && q(o) && !o.isIsolated() && !o.isInline()) return o.selectNext(), e.preventDefault(), !0;
|
|
290
289
|
}
|
|
291
290
|
return !1;
|
|
292
|
-
}, m), n.registerCommand(
|
|
291
|
+
}, m), n.registerCommand(pt, (e) => {
|
|
293
292
|
const t = p();
|
|
294
293
|
if (F(t)) {
|
|
295
294
|
const o = t.getNodes();
|
|
@@ -301,7 +300,7 @@ function Nn(n) {
|
|
|
301
300
|
return e.preventDefault(), ve(t, o, !0), !0;
|
|
302
301
|
}
|
|
303
302
|
return !1;
|
|
304
|
-
}, m), n.registerCommand(
|
|
303
|
+
}, m), n.registerCommand(mt, (e) => {
|
|
305
304
|
const t = p();
|
|
306
305
|
if (F(t) && !ee(e.target)) {
|
|
307
306
|
const a = t.getNodes();
|
|
@@ -310,91 +309,91 @@ function Nn(n) {
|
|
|
310
309
|
if (!g(t)) return !1;
|
|
311
310
|
const o = e.shiftKey;
|
|
312
311
|
return !!Ee(t, !1) && (e.preventDefault(), ve(t, o, !1), !0);
|
|
313
|
-
}, m), n.registerCommand(
|
|
312
|
+
}, m), n.registerCommand(ft, (e) => {
|
|
314
313
|
if (ee(e.target)) return !1;
|
|
315
314
|
const t = p();
|
|
316
315
|
if (!g(t)) return !1;
|
|
317
316
|
const { anchor: o } = t, a = o.getNode();
|
|
318
|
-
return t.isCollapsed() && o.offset === 0 && !
|
|
319
|
-
}, m), n.registerCommand(
|
|
317
|
+
return t.isCollapsed() && o.offset === 0 && !Oe(a) && Ft(a).getIndent() > 0 ? (e.preventDefault(), n.dispatchCommand(pe, void 0)) : (!$e || navigator.language !== "ko-KR") && (e.preventDefault(), n.dispatchCommand(re, !0));
|
|
318
|
+
}, m), n.registerCommand(dt, (e) => {
|
|
320
319
|
if (ee(e.target)) return !1;
|
|
321
320
|
const t = p();
|
|
322
321
|
return !!g(t) && (e.preventDefault(), n.dispatchCommand(re, !1));
|
|
323
|
-
}, m), n.registerCommand(
|
|
322
|
+
}, m), n.registerCommand(ct, (e) => {
|
|
324
323
|
const t = p();
|
|
325
324
|
if (!g(t)) return !1;
|
|
326
325
|
if (se(t), e !== null) {
|
|
327
|
-
if ((
|
|
326
|
+
if (($e || _n || xn) && Sn) return !1;
|
|
328
327
|
if (e.preventDefault(), e.shiftKey) return n.dispatchCommand(fe, !1);
|
|
329
328
|
}
|
|
330
329
|
return n.dispatchCommand(me, void 0);
|
|
331
|
-
}, m), n.registerCommand(
|
|
330
|
+
}, m), n.registerCommand(ut, () => {
|
|
332
331
|
const e = p();
|
|
333
332
|
return !!g(e) && (n.blur(), !0);
|
|
334
|
-
}, m), n.registerCommand(
|
|
333
|
+
}, m), n.registerCommand(at, (e) => {
|
|
335
334
|
const [, t] = Q(e);
|
|
336
335
|
if (t.length > 0) {
|
|
337
|
-
const a =
|
|
336
|
+
const a = be(e.clientX, e.clientY);
|
|
338
337
|
if (a !== null) {
|
|
339
338
|
const { offset: r, node: s } = a, i = ne(s);
|
|
340
339
|
if (i !== null) {
|
|
341
|
-
const l =
|
|
342
|
-
if (
|
|
340
|
+
const l = st();
|
|
341
|
+
if (R(i)) l.anchor.set(i.getKey(), r, "text"), l.focus.set(i.getKey(), r, "text");
|
|
343
342
|
else {
|
|
344
343
|
const c = i.getParentOrThrow().getKey(), d = i.getIndexWithinParent() + 1;
|
|
345
344
|
l.anchor.set(c, d, "element"), l.focus.set(c, d, "element");
|
|
346
345
|
}
|
|
347
|
-
const u =
|
|
348
|
-
|
|
346
|
+
const u = it(l);
|
|
347
|
+
lt(u);
|
|
349
348
|
}
|
|
350
|
-
n.dispatchCommand(
|
|
349
|
+
n.dispatchCommand(Se, t);
|
|
351
350
|
}
|
|
352
351
|
return e.preventDefault(), !0;
|
|
353
352
|
}
|
|
354
353
|
const o = p();
|
|
355
354
|
return !!g(o);
|
|
356
|
-
}, m), n.registerCommand(
|
|
355
|
+
}, m), n.registerCommand(ot, (e) => {
|
|
357
356
|
const [t] = Q(e), o = p();
|
|
358
357
|
return !(t && !g(o));
|
|
359
|
-
}, m), n.registerCommand(
|
|
358
|
+
}, m), n.registerCommand(rt, (e) => {
|
|
360
359
|
const [t] = Q(e), o = p();
|
|
361
360
|
if (t && !g(o)) return !1;
|
|
362
|
-
const a =
|
|
361
|
+
const a = be(e.clientX, e.clientY);
|
|
363
362
|
if (a !== null) {
|
|
364
363
|
const r = ne(a.node);
|
|
365
|
-
|
|
364
|
+
q(r) && e.preventDefault();
|
|
366
365
|
}
|
|
367
366
|
return !0;
|
|
368
|
-
}, m), n.registerCommand(
|
|
367
|
+
}, m), n.registerCommand(tt, () => (nt(), !0), m), n.registerCommand(et, (e) => (ye(n, z(e, ClipboardEvent) ? e : null), !0), m), n.registerCommand(Qe, (e) => (async function(t, o) {
|
|
369
368
|
await ye(o, z(t, ClipboardEvent) ? t : null), o.update(() => {
|
|
370
369
|
const a = p();
|
|
371
370
|
g(a) ? a.removeText() : F(a) && a.getNodes().forEach((r) => r.remove());
|
|
372
371
|
});
|
|
373
|
-
}(e, n), !0), m), n.registerCommand(
|
|
372
|
+
}(e, n), !0), m), n.registerCommand(Re, (e) => {
|
|
374
373
|
const [, t, o] = Q(e);
|
|
375
|
-
return t.length > 0 && !o ? (n.dispatchCommand(
|
|
374
|
+
return t.length > 0 && !o ? (n.dispatchCommand(Se, t), !0) : Ie(e.target) && Ze(e.target) ? !1 : p() !== null && (function(a, r) {
|
|
376
375
|
a.preventDefault(), r.update(() => {
|
|
377
376
|
const s = p(), i = z(a, InputEvent) || z(a, KeyboardEvent) ? null : a.clipboardData;
|
|
378
377
|
i != null && s !== null && Ce(i, s, r);
|
|
379
378
|
}, { tag: "paste" });
|
|
380
379
|
}(e, n), !0);
|
|
381
|
-
}, m), n.registerCommand(
|
|
380
|
+
}, m), n.registerCommand(Ye, (e) => {
|
|
382
381
|
const t = p();
|
|
383
382
|
return g(t) && se(t), !1;
|
|
384
|
-
}, m), n.registerCommand(
|
|
383
|
+
}, m), n.registerCommand(Ge, (e) => {
|
|
385
384
|
const t = p();
|
|
386
385
|
return g(t) && se(t), !1;
|
|
387
386
|
}, m));
|
|
388
387
|
}
|
|
389
388
|
const ie = typeof window < "u" && window.document !== void 0 && window.document.createElement !== void 0 ? j : _;
|
|
390
|
-
function
|
|
389
|
+
function ke(n) {
|
|
391
390
|
return n.getEditorState().read(He(n.isComposing()));
|
|
392
391
|
}
|
|
393
392
|
function Ln({ contentEditable: n, placeholder: e = null, ErrorBoundary: t }) {
|
|
394
393
|
const [o] = P(), a = function(r, s) {
|
|
395
394
|
const [i, l] = I(() => r.getDecorators());
|
|
396
395
|
return ie(() => r.registerDecoratorListener((u) => {
|
|
397
|
-
|
|
396
|
+
Kt(() => {
|
|
398
397
|
l(u);
|
|
399
398
|
});
|
|
400
399
|
}), [r]), _(() => {
|
|
@@ -402,22 +401,22 @@ function Ln({ contentEditable: n, placeholder: e = null, ErrorBoundary: t }) {
|
|
|
402
401
|
}, [r]), W(() => {
|
|
403
402
|
const u = [], c = Object.keys(i);
|
|
404
403
|
for (let d = 0; d < c.length; d++) {
|
|
405
|
-
const f = c[d], C = h(s, { onError: (w) => r._onError(w), children: h(
|
|
406
|
-
y !== null && u.push(
|
|
404
|
+
const f = c[d], C = h(s, { onError: (w) => r._onError(w), children: h(It, { fallback: null, children: i[f] }) }), y = r.getElementByKey(f);
|
|
405
|
+
y !== null && u.push(zt(C, y, f));
|
|
407
406
|
}
|
|
408
407
|
return u;
|
|
409
408
|
}, [s, i, r]);
|
|
410
409
|
}(o, t);
|
|
411
410
|
return function(r) {
|
|
412
411
|
ie(() => U(Nn(r), bn(r)), [r]);
|
|
413
|
-
}(o), K(
|
|
412
|
+
}(o), K(Pe, { children: [n, h(Dn, { content: e }), a] });
|
|
414
413
|
}
|
|
415
414
|
function Dn({ content: n }) {
|
|
416
415
|
const [e] = P(), t = function(a) {
|
|
417
|
-
const [r, s] = I(() =>
|
|
416
|
+
const [r, s] = I(() => ke(a));
|
|
418
417
|
return ie(() => {
|
|
419
418
|
function i() {
|
|
420
|
-
const l =
|
|
419
|
+
const l = ke(a);
|
|
421
420
|
s(l);
|
|
422
421
|
}
|
|
423
422
|
return i(), U(a.registerUpdateListener(() => {
|
|
@@ -429,9 +428,9 @@ function Dn({ content: n }) {
|
|
|
429
428
|
}(e), o = Cn();
|
|
430
429
|
return t ? typeof n == "function" ? n(o) : n : null;
|
|
431
430
|
}
|
|
432
|
-
const
|
|
431
|
+
const qe = typeof window < "u" && window.document !== void 0 && window.document.createElement !== void 0 ? j : _;
|
|
433
432
|
function Pn({ editor: n, ariaActiveDescendant: e, ariaAutoComplete: t, ariaControls: o, ariaDescribedBy: a, ariaErrorMessage: r, ariaExpanded: s, ariaInvalid: i, ariaLabel: l, ariaLabelledBy: u, ariaMultiline: c, ariaOwns: d, ariaRequired: f, autoCapitalize: C, className: y, id: w, role: k = "textbox", spellCheck: E = !0, style: v, tabIndex: $, "data-testid": x, ...b }, N) {
|
|
434
|
-
const [S, T] = I(n.isEditable()), O =
|
|
433
|
+
const [S, T] = I(n.isEditable()), O = Ot((L) => {
|
|
435
434
|
L && L.ownerDocument && L.ownerDocument.defaultView ? n.setRootElement(L) : n.setRootElement(null);
|
|
436
435
|
}, [n]), B = W(() => /* @__PURE__ */ function(...L) {
|
|
437
436
|
return (J) => {
|
|
@@ -440,25 +439,25 @@ function Pn({ editor: n, ariaActiveDescendant: e, ariaAutoComplete: t, ariaContr
|
|
|
440
439
|
});
|
|
441
440
|
};
|
|
442
441
|
}(N, O), [O, N]);
|
|
443
|
-
return
|
|
442
|
+
return qe(() => (T(n.isEditable()), n.registerEditableListener((L) => {
|
|
444
443
|
T(L);
|
|
445
444
|
})), [n]), h("div", { "aria-activedescendant": S ? e : void 0, "aria-autocomplete": S ? t : "none", "aria-controls": S ? o : void 0, "aria-describedby": a, ...r != null ? { "aria-errormessage": r } : {}, "aria-expanded": S && k === "combobox" ? !!s : void 0, ...i != null ? { "aria-invalid": i } : {}, "aria-label": l, "aria-labelledby": u, "aria-multiline": c, "aria-owns": S ? d : void 0, "aria-readonly": !S || void 0, "aria-required": f, autoCapitalize: C, className: y, contentEditable: S, "data-testid": x, id: w, ref: B, role: S ? k : void 0, spellCheck: E, style: v, tabIndex: $, ...b });
|
|
446
445
|
}
|
|
447
|
-
const Tn =
|
|
448
|
-
function
|
|
446
|
+
const Tn = Ke(Pn);
|
|
447
|
+
function xe(n) {
|
|
449
448
|
return n.getEditorState().read(He(n.isComposing()));
|
|
450
449
|
}
|
|
451
|
-
const
|
|
452
|
-
function
|
|
450
|
+
const Mn = Ke(Rn);
|
|
451
|
+
function Rn(n, e) {
|
|
453
452
|
const { placeholder: t, ...o } = n, [a] = P();
|
|
454
|
-
return K(
|
|
453
|
+
return K(Pe, { children: [h(Tn, { editor: a, ...o, ref: e }), t != null && h(In, { editor: a, content: t })] });
|
|
455
454
|
}
|
|
456
455
|
function In({ content: n, editor: e }) {
|
|
457
456
|
const t = function(s) {
|
|
458
|
-
const [i, l] = I(() =>
|
|
459
|
-
return
|
|
457
|
+
const [i, l] = I(() => xe(s));
|
|
458
|
+
return qe(() => {
|
|
460
459
|
function u() {
|
|
461
|
-
const c =
|
|
460
|
+
const c = xe(s);
|
|
462
461
|
l(c);
|
|
463
462
|
}
|
|
464
463
|
return u(), U(s.registerUpdateListener(() => {
|
|
@@ -479,11 +478,11 @@ function le(n, e) {
|
|
|
479
478
|
return t.__proto__ = o, t;
|
|
480
479
|
}, le(n, e);
|
|
481
480
|
}
|
|
482
|
-
var
|
|
481
|
+
var Ne = { error: null }, On = function(n) {
|
|
483
482
|
var e, t;
|
|
484
483
|
function o() {
|
|
485
484
|
for (var r, s = arguments.length, i = new Array(s), l = 0; l < s; l++) i[l] = arguments[l];
|
|
486
|
-
return (r = n.call.apply(n, [this].concat(i)) || this).state =
|
|
485
|
+
return (r = n.call.apply(n, [this].concat(i)) || this).state = Ne, r.resetErrorBoundary = function() {
|
|
487
486
|
for (var u, c = arguments.length, d = new Array(c), f = 0; f < c; f++) d[f] = arguments[f];
|
|
488
487
|
r.props.onReset == null || (u = r.props).onReset.apply(u, d), r.reset();
|
|
489
488
|
}, r;
|
|
@@ -493,7 +492,7 @@ var Le = { error: null }, On = function(n) {
|
|
|
493
492
|
};
|
|
494
493
|
var a = o.prototype;
|
|
495
494
|
return a.reset = function() {
|
|
496
|
-
this.setState(
|
|
495
|
+
this.setState(Ne);
|
|
497
496
|
}, a.componentDidCatch = function(r, s) {
|
|
498
497
|
var i, l;
|
|
499
498
|
(i = (l = this.props).onError) == null || i.call(l, r, s);
|
|
@@ -529,7 +528,7 @@ function zn({ ignoreHistoryMergeTagChange: n = !0, ignoreSelectionChange: e = !1
|
|
|
529
528
|
function An() {
|
|
530
529
|
const [n] = P();
|
|
531
530
|
return _(() => {
|
|
532
|
-
if (!n.hasNodes([
|
|
531
|
+
if (!n.hasNodes([ze, Ae])) throw new Error("ListPlugin: ListNode and/or ListItemNode not registered on editor");
|
|
533
532
|
}, [n]), function(e) {
|
|
534
533
|
_(() => jt(e), [e]);
|
|
535
534
|
}(n), null;
|
|
@@ -537,7 +536,7 @@ function An() {
|
|
|
537
536
|
function Bn({ validateUrl: n, attributes: e }) {
|
|
538
537
|
const [t] = P();
|
|
539
538
|
return _(() => {
|
|
540
|
-
if (!t.hasNodes([
|
|
539
|
+
if (!t.hasNodes([Be])) throw new Error("LinkPlugin: LinkNode not registered on editor");
|
|
541
540
|
return U(t.registerCommand(we, (o) => {
|
|
542
541
|
if (o === null) return ae(o), !0;
|
|
543
542
|
if (typeof o == "string") return !(n !== void 0 && !n(o)) && (ae(o, e), !0);
|
|
@@ -545,7 +544,7 @@ function Bn({ validateUrl: n, attributes: e }) {
|
|
|
545
544
|
const { url: a, target: r, rel: s, title: i } = o;
|
|
546
545
|
return ae(a, { ...e, rel: s, target: r, title: i }), !0;
|
|
547
546
|
}
|
|
548
|
-
}, he), n !== void 0 ? t.registerCommand(
|
|
547
|
+
}, he), n !== void 0 ? t.registerCommand(Re, (o) => {
|
|
549
548
|
const a = p();
|
|
550
549
|
if (!g(a) || a.isCollapsed() || !z(o, ClipboardEvent)) return !1;
|
|
551
550
|
const r = o;
|
|
@@ -561,8 +560,8 @@ function jn({ newTab: n = !0, disabled: e = !1 }) {
|
|
|
561
560
|
return _(() => {
|
|
562
561
|
const o = (r) => {
|
|
563
562
|
const s = r.target;
|
|
564
|
-
if (!
|
|
565
|
-
const i =
|
|
563
|
+
if (!Ie(s)) return;
|
|
564
|
+
const i = Lt(s);
|
|
566
565
|
if (i === null) return;
|
|
567
566
|
let l = null, u = null;
|
|
568
567
|
if (i.update(() => {
|
|
@@ -578,7 +577,7 @@ function jn({ newTab: n = !0, disabled: e = !1 }) {
|
|
|
578
577
|
E = E.parentNode;
|
|
579
578
|
}
|
|
580
579
|
return null;
|
|
581
|
-
}(s,
|
|
580
|
+
}(s, Dt);
|
|
582
581
|
y !== null && (l = y.href, u = y.target);
|
|
583
582
|
}
|
|
584
583
|
}
|
|
@@ -595,7 +594,7 @@ function jn({ newTab: n = !0, disabled: e = !1 }) {
|
|
|
595
594
|
});
|
|
596
595
|
}, [t, n, e]), null;
|
|
597
596
|
}
|
|
598
|
-
const te = 0, ue = 1, ce = 2, D = 0, Un = 1,
|
|
597
|
+
const te = 0, ue = 1, ce = 2, D = 0, Un = 1, Le = 2, Hn = 3, qn = 4;
|
|
599
598
|
function Vn(n, e, t, o, a) {
|
|
600
599
|
if (n === null || t.size === 0 && o.size === 0 && !a) return D;
|
|
601
600
|
const r = e._selection, s = n._selection;
|
|
@@ -610,23 +609,23 @@ function Vn(n, e, t, o, a) {
|
|
|
610
609
|
for (const [N, S] of $) {
|
|
611
610
|
if (!S) continue;
|
|
612
611
|
const T = x.get(N);
|
|
613
|
-
T === void 0 ||
|
|
612
|
+
T === void 0 || Oe(T) || b.push(T);
|
|
614
613
|
}
|
|
615
614
|
return b;
|
|
616
615
|
}(e, t, o);
|
|
617
616
|
if (i.length === 0) return D;
|
|
618
617
|
if (i.length > 1) {
|
|
619
618
|
const E = e._nodeMap, v = E.get(r.anchor.key), $ = E.get(s.anchor.key);
|
|
620
|
-
return v && $ && !n._nodeMap.has(v.__key) &&
|
|
619
|
+
return v && $ && !n._nodeMap.has(v.__key) && R(v) && v.__text.length === 1 && r.anchor.offset === 1 ? Le : D;
|
|
621
620
|
}
|
|
622
621
|
const l = i[0], u = n._nodeMap.get(l.__key);
|
|
623
|
-
if (!
|
|
622
|
+
if (!R(u) || !R(l) || u.__mode !== l.__mode) return D;
|
|
624
623
|
const c = u.__text, d = l.__text;
|
|
625
624
|
if (c === d) return D;
|
|
626
625
|
const f = r.anchor, C = s.anchor;
|
|
627
626
|
if (f.key !== C.key || f.type !== "text") return D;
|
|
628
627
|
const y = f.offset, w = C.offset, k = d.length - c.length;
|
|
629
|
-
return k === 1 && w === y - 1 ?
|
|
628
|
+
return k === 1 && w === y - 1 ? Le : k === -1 && w === y + 1 ? Hn : k === -1 && w === y ? qn : D;
|
|
630
629
|
}
|
|
631
630
|
function Wn(n, e) {
|
|
632
631
|
let t = Date.now(), o = D;
|
|
@@ -640,18 +639,18 @@ function Wn(n, e) {
|
|
|
640
639
|
const w = r._selection;
|
|
641
640
|
return i.size > 0 || l.size > 0 ? y === !1 && d !== D && d === o && c < t + e && C || i.size === 1 && function(k, E, v) {
|
|
642
641
|
const $ = E._nodeMap.get(k), x = v._nodeMap.get(k), b = E._selection, N = v._selection;
|
|
643
|
-
return !(g(b) && g(N) && b.anchor.type === "element" && b.focus.type === "element" && N.anchor.type === "text" && N.focus.type === "text" || !
|
|
642
|
+
return !(g(b) && g(N) && b.anchor.type === "element" && b.focus.type === "element" && N.anchor.type === "text" && N.focus.type === "text" || !R($) || !R(x) || $.__parent !== x.__parent) && JSON.stringify(E.read(() => $.exportJSON())) === JSON.stringify(v.read(() => x.exportJSON()));
|
|
644
643
|
}(Array.from(i)[0], a, r) ? te : ue : w !== null ? te : ce;
|
|
645
644
|
})();
|
|
646
645
|
return t = c, o = d, f;
|
|
647
646
|
};
|
|
648
647
|
}
|
|
649
|
-
function
|
|
648
|
+
function De(n) {
|
|
650
649
|
n.undoStack = [], n.redoStack = [], n.current = null;
|
|
651
650
|
}
|
|
652
651
|
function Jn(n, e, t) {
|
|
653
652
|
const o = Wn(n, t);
|
|
654
|
-
return U(n.registerCommand(
|
|
653
|
+
return U(n.registerCommand(Rt, () => (function(r, s) {
|
|
655
654
|
const i = s.redoStack, l = s.undoStack;
|
|
656
655
|
if (l.length !== 0) {
|
|
657
656
|
const u = s.current, c = l.pop();
|
|
@@ -665,7 +664,7 @@ function Jn(n, e, t) {
|
|
|
665
664
|
const c = i.pop();
|
|
666
665
|
i.length === 0 && r.dispatchCommand(G, !1), s.current = c || null, c && c.editor.setEditorState(c.editorState, { tag: "historic" });
|
|
667
666
|
}
|
|
668
|
-
}(n, e), !0), m), n.registerCommand(
|
|
667
|
+
}(n, e), !0), m), n.registerCommand(Tt, () => (De(e), !1), m), n.registerCommand(Pt, () => (De(e), n.dispatchCommand(G, !1), n.dispatchCommand(Y, !1), !0), m), n.registerUpdateListener(({ editorState: r, prevEditorState: s, dirtyLeaves: i, dirtyElements: l, tags: u }) => {
|
|
669
668
|
const c = e.current, d = e.redoStack, f = e.undoStack, C = c === null ? null : c.editorState;
|
|
670
669
|
if (c !== null && r === C) return;
|
|
671
670
|
const y = o(s, r, c, i, l, u);
|
|
@@ -687,16 +686,16 @@ function Gn({ delay: n, externalHistoryState: e }) {
|
|
|
687
686
|
function Yn({ hasCellMerge: n = !0, hasCellBackgroundColor: e = !0, hasTabHandler: t = !0, hasHorizontalScroll: o = !1 }) {
|
|
688
687
|
const [a] = P();
|
|
689
688
|
return _(() => {
|
|
690
|
-
|
|
689
|
+
qt(a, o);
|
|
691
690
|
}, [a, o]), _(() => Vt(a), [a]), _(() => Wt(a, t), [a, t]), _(() => {
|
|
692
691
|
if (!n) return Jt(a);
|
|
693
692
|
}, [a, n]), _(() => {
|
|
694
|
-
if (!e) return a.registerNodeTransform(
|
|
693
|
+
if (!e) return a.registerNodeTransform(je, (r) => {
|
|
695
694
|
r.getBackgroundColor() !== null && r.setBackgroundColor(null);
|
|
696
695
|
});
|
|
697
696
|
}, [a, e, n]), null;
|
|
698
697
|
}
|
|
699
|
-
const
|
|
698
|
+
const Ve = 200, Zn = ({
|
|
700
699
|
currentLanguage: n = "NL",
|
|
701
700
|
initialValue: e = "",
|
|
702
701
|
placeholder: t = "",
|
|
@@ -705,10 +704,10 @@ const We = 200, Zn = ({
|
|
|
705
704
|
required: r = !1,
|
|
706
705
|
notValidatedText: s = "",
|
|
707
706
|
maxHeightInRem: i = "20rem",
|
|
708
|
-
maxWords: l =
|
|
707
|
+
maxWords: l = Ve,
|
|
709
708
|
onChange: u
|
|
710
709
|
}) => {
|
|
711
|
-
const { switchLanguage: c } = cn(), d = an(), [f] = I(() =>
|
|
710
|
+
const { switchLanguage: c } = cn(), d = an(), [f] = I(() => Te()), [C, y] = I(0), [w, k] = I(0), E = Fe(null), v = {
|
|
712
711
|
html: {
|
|
713
712
|
export: tn
|
|
714
713
|
},
|
|
@@ -718,7 +717,7 @@ const We = 200, Zn = ({
|
|
|
718
717
|
onError(b) {
|
|
719
718
|
throw b;
|
|
720
719
|
},
|
|
721
|
-
nodes: [Ae, Be,
|
|
720
|
+
nodes: [ze, Ae, Be, Ht, je, Xt, Gt],
|
|
722
721
|
editorState: (b) => {
|
|
723
722
|
const S = new DOMParser().parseFromString(e, "text/html"), T = At(b, S), O = A();
|
|
724
723
|
if (O.clear(), nn(e))
|
|
@@ -743,29 +742,29 @@ const We = 200, Zn = ({
|
|
|
743
742
|
}, [n, c]), _(() => {
|
|
744
743
|
const b = e.replace(/<br\s*\/?>| /gi, " ").replace(/<\/?[^>]+(>|$)|&[a-z]+;/g, "").replace(/\s+/g, " ").trim();
|
|
745
744
|
y($(b));
|
|
746
|
-
}, []), /* @__PURE__ */ K("div", { className:
|
|
747
|
-
/* @__PURE__ */ K("div", { className:
|
|
745
|
+
}, []), /* @__PURE__ */ K("div", { className: M.editor__container, children: [
|
|
746
|
+
/* @__PURE__ */ K("div", { className: M.editor__header, children: [
|
|
748
747
|
/* @__PURE__ */ h(un, { label: o, info: a, required: r }),
|
|
749
|
-
/* @__PURE__ */ K("div", { className:
|
|
750
|
-
/* @__PURE__ */ h("span", { className: en({ [
|
|
748
|
+
/* @__PURE__ */ K("div", { className: M["editor__header-word-count"], children: [
|
|
749
|
+
/* @__PURE__ */ h("span", { className: en({ [M["editor__header-word-count--alert"]]: C > l }), children: C }),
|
|
751
750
|
" / ",
|
|
752
751
|
l
|
|
753
752
|
] })
|
|
754
753
|
] }),
|
|
755
|
-
/* @__PURE__ */ h("div", { className:
|
|
754
|
+
/* @__PURE__ */ h("div", { className: M.editor, children: /* @__PURE__ */ K(pn, { initialConfig: v, children: [
|
|
756
755
|
/* @__PURE__ */ h(on, { editorScrollPosition: w }),
|
|
757
|
-
/* @__PURE__ */ K("div", { className:
|
|
756
|
+
/* @__PURE__ */ K("div", { className: M["editor__field-wrapper"], children: [
|
|
758
757
|
/* @__PURE__ */ h(
|
|
759
758
|
Ln,
|
|
760
759
|
{
|
|
761
760
|
contentEditable: /* @__PURE__ */ h(
|
|
762
|
-
|
|
761
|
+
Mn,
|
|
763
762
|
{
|
|
764
|
-
className:
|
|
763
|
+
className: M.editor__field,
|
|
765
764
|
"aria-label": d.common.rteAriaLabel,
|
|
766
765
|
"aria-placeholder": t,
|
|
767
766
|
title: d.common.rteTitle,
|
|
768
|
-
placeholder: /* @__PURE__ */ h("div", { className:
|
|
767
|
+
placeholder: /* @__PURE__ */ h("div", { className: M.editor__placeholder, children: t }),
|
|
769
768
|
spellCheck: !1,
|
|
770
769
|
id: "rteEditor",
|
|
771
770
|
style: { height: `${i}`, maxHeight: `${i}` },
|
|
@@ -773,7 +772,7 @@ const We = 200, Zn = ({
|
|
|
773
772
|
ref: E
|
|
774
773
|
}
|
|
775
774
|
),
|
|
776
|
-
placeholder: /* @__PURE__ */ h("div", { className:
|
|
775
|
+
placeholder: /* @__PURE__ */ h("div", { className: M.editor__placeholder, children: t }),
|
|
777
776
|
ErrorBoundary: Fn
|
|
778
777
|
}
|
|
779
778
|
),
|
|
@@ -797,7 +796,7 @@ const We = 200, Zn = ({
|
|
|
797
796
|
info: a = "",
|
|
798
797
|
required: r = !1,
|
|
799
798
|
notValidatedText: s = "",
|
|
800
|
-
maxWords: i =
|
|
799
|
+
maxWords: i = Ve,
|
|
801
800
|
onChange: l
|
|
802
801
|
}) => /* @__PURE__ */ h(dn, { children: /* @__PURE__ */ h(
|
|
803
802
|
Zn,
|