@uva-glass/component-library 3.52.5 → 3.52.6
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/{Lexical.prod-BAE-wnll.js → Lexical.prod-sd_e2sqT.js} +648 -627
- package/dist/Lexical.prod-sd_e2sqT.js.map +1 -0
- package/dist/{LexicalClipboard.prod-BS4qAkmJ.js → LexicalClipboard.prod-Co2PF1UJ.js} +44 -42
- package/dist/LexicalClipboard.prod-Co2PF1UJ.js.map +1 -0
- package/dist/{LexicalLink.prod-C6Or2Yo6.js → LexicalLink.prod-BCE6Bg2N.js} +354 -334
- package/dist/LexicalLink.prod-BCE6Bg2N.js.map +1 -0
- package/dist/{LexicalList.prod-rTq41CO0.js → LexicalList.prod-CIB0K0ja.js} +141 -138
- package/dist/LexicalList.prod-CIB0K0ja.js.map +1 -0
- package/dist/{LexicalSelection.prod-fLzEGOT_.js → LexicalSelection.prod-CCmcTP6S.js} +41 -41
- package/dist/{LexicalSelection.prod-fLzEGOT_.js.map → LexicalSelection.prod-CCmcTP6S.js.map} +1 -1
- package/dist/{LexicalTable.prod-BBI7yaOy.js → LexicalTable.prod-Oa2YPHLl.js} +359 -359
- package/dist/LexicalTable.prod-Oa2YPHLl.js.map +1 -0
- package/dist/{LexicalUtils.prod-D8DAKg7O.js → LexicalUtils.prod-CjKjgnmx.js} +43 -43
- package/dist/{LexicalUtils.prod-D8DAKg7O.js.map → LexicalUtils.prod-CjKjgnmx.js.map} +1 -1
- package/dist/{TableCellResizerPlugin-HPo4ZkHo.js → TableCellResizerPlugin-DATbSzfg.js} +51 -51
- package/dist/{TableCellResizerPlugin-HPo4ZkHo.js.map → TableCellResizerPlugin-DATbSzfg.js.map} +1 -1
- package/dist/{TablePlugin-BLbsvcuu.js → TablePlugin-CqCjNBW_.js} +83 -83
- package/dist/{TablePlugin-BLbsvcuu.js.map → TablePlugin-CqCjNBW_.js.map} +1 -1
- package/dist/components/CheckboxTree/CheckboxTree.js +1 -1
- package/dist/components/FormInput/FormInput.js +1 -1
- package/dist/components/InputField/InputField.stories.js +1 -1
- package/dist/components/MultiSelect/MultiSelect.js +1 -1
- package/dist/components/MultiSelect/MultiSelect.stories.js +1 -1
- package/dist/components/MultiSelect/components/MultiSelectHeader.js +1 -1
- package/dist/components/MultiSelect/index.js +1 -1
- package/dist/components/PeriodSelector/PeriodSelector.js +1 -1
- package/dist/components/ProgrammeCard/ProgrammeCard.stories.js +1 -1
- package/dist/components/RadioTabSelector/RadioTabSelector.js +1 -1
- package/dist/components/RteEditor/EditorHeader/EditorHeader.js +1 -1
- package/dist/components/RteEditor/Plugins/BlockFormatPlugin/BlockFormatPlugin.js +7 -7
- package/dist/components/RteEditor/Plugins/HistoryPlugin/HistoryPlugin.js +2 -2
- package/dist/components/RteEditor/Plugins/LinkPlugin/AddLinkForm/AddLinkFrom.js +1 -1
- package/dist/components/RteEditor/Plugins/LinkPlugin/LinkPlugin.js +52 -52
- package/dist/components/RteEditor/Plugins/LinkPlugin/helpers.js +1 -1
- package/dist/components/RteEditor/Plugins/ListPlugin/ListPlugin.js +25 -25
- package/dist/components/RteEditor/Plugins/PasteHandlerPlugin/PasteHandlerPlugin.js +7 -7
- package/dist/components/RteEditor/Plugins/TableCellResizerPlugin/TableCellResizerPlugin.js +4 -4
- package/dist/components/RteEditor/Plugins/TableCellResizerPlugin/index.js +1 -1
- package/dist/components/RteEditor/Plugins/TablePlugin/AddTableFrom.js +1 -1
- package/dist/components/RteEditor/Plugins/TablePlugin/TablePlugin.js +4 -4
- package/dist/components/RteEditor/Plugins/TablePlugin/helpers.js +27 -27
- package/dist/components/RteEditor/Plugins/TablePlugin/index.js +1 -1
- package/dist/components/RteEditor/Plugins/ToolbarPlugin/ToolbarPlugin.js +16 -16
- package/dist/components/RteEditor/Plugins/index.js +2 -2
- package/dist/components/RteEditor/RteEditor.js +185 -185
- package/dist/components/RteEditor/RteEditor.js.map +1 -1
- package/dist/components/RteEditor/helpers.js +8 -8
- package/dist/components/RteEditor/nodes/TableWrapperNode/TableWrapperNode.js +11 -11
- package/dist/components/index.js +1 -1
- package/dist/index.js +1 -1
- package/package.json +6 -6
- package/dist/Lexical.prod-BAE-wnll.js.map +0 -1
- package/dist/LexicalClipboard.prod-BS4qAkmJ.js.map +0 -1
- package/dist/LexicalLink.prod-C6Or2Yo6.js.map +0 -1
- package/dist/LexicalList.prod-rTq41CO0.js.map +0 -1
- package/dist/LexicalTable.prod-BBI7yaOy.js.map +0 -1
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
import { jsx as f, jsxs as
|
|
2
|
-
import { t as
|
|
3
|
-
import { aK as
|
|
1
|
+
import { jsx as f, jsxs as A, Fragment as ke } from "react/jsx-runtime";
|
|
2
|
+
import { t as Ge, r as Xe, o as k } from "../../LexicalComposerContext.prod-DOyoZx0P.js";
|
|
3
|
+
import { aK as De, ah as F, L as Ye, b as g, aS as ne, aM as oe, an as U, S as ae, I as Qe, l as R, y as h, Y as Ve, K as c, aW as Ze, ad as et, r as tt, u as rt, aX as nt, aY as ot, U as at, aV as P, aG as st, aZ as it, a_ as lt, a$ as ut, v as te, b0 as dt, b1 as ct, a3 as ft, o as mt, a0 as Pe, J as pt, b2 as gt, b3 as ue, c as de, Q as ht, O as Q, P as vt, a4 as $e, b4 as ce, G as yt, F as Ct, T as bt, b5 as fe, B as Et, b6 as wt, b7 as St, b8 as Te, aF as xt, V as Nt, d as Be, _ as _t, b9 as Lt, W as kt, N as Dt, M as Pt, p as $t, au as W, at as J, ba as Tt, bb as Bt, aw as It, bc as re, av as Rt, bd as Mt, be as At, aQ as Ft } from "../../Lexical.prod-sd_e2sqT.js";
|
|
4
4
|
import * as Kt from "react";
|
|
5
|
-
import { useMemo as
|
|
6
|
-
import { a as
|
|
7
|
-
import {
|
|
8
|
-
import { flushSync as
|
|
9
|
-
import { U as H, L as z, x as tr } from "../../LexicalUtils.prod-
|
|
10
|
-
import { R as pe, F as ge, m as rr, g as nr } from "../../LexicalClipboard.prod-
|
|
11
|
-
import { A as he, Z as ve, n as ye } from "../../LexicalSelection.prod-
|
|
12
|
-
import { l as Fe, n as Ke, L as or, b as ar } from "../../LexicalList.prod-
|
|
13
|
-
import {
|
|
5
|
+
import { useMemo as X, useLayoutEffect as O, useEffect as b, useState as M, Suspense as zt, forwardRef as Ie, useCallback as Ut, Component as Ot, createElement as me, createContext as Ht, useId as jt } from "react";
|
|
6
|
+
import { a as Wt, T as Jt } from "../../TableCellResizerPlugin-DATbSzfg.js";
|
|
7
|
+
import { B as qt, y as Re, F as Gt, a as se, A as Me, l as Xt, z as Yt, G as Qt, d as Ae, b as Vt } from "../../LexicalLink.prod-BCE6Bg2N.js";
|
|
8
|
+
import { flushSync as Zt, createPortal as er } from "react-dom";
|
|
9
|
+
import { U as H, L as z, x as tr } from "../../LexicalUtils.prod-CjKjgnmx.js";
|
|
10
|
+
import { R as pe, F as ge, m as rr, g as nr } from "../../LexicalClipboard.prod-Co2PF1UJ.js";
|
|
11
|
+
import { A as he, Z as ve, n as ye } from "../../LexicalSelection.prod-CCmcTP6S.js";
|
|
12
|
+
import { l as Fe, n as Ke, L as or, b as ar } from "../../LexicalList.prod-CIB0K0ja.js";
|
|
13
|
+
import { b as sr, u as ir, h as ze, N as lr, y as ur, c as dr, x as Ue, E as cr } from "../../LexicalTable.prod-Oa2YPHLl.js";
|
|
14
14
|
import { c as Ce } from "../../clsx-OuTLNxxd.js";
|
|
15
15
|
import { exportMap as fr, mergeBoldStrongTags as mr, cleanUpTable as pr } from "./helpers.js";
|
|
16
16
|
import { validateUrl as gr, MATCHERS as hr } from "./Plugins/LinkPlugin/helpers.js";
|
|
17
|
-
import { s as
|
|
17
|
+
import { s as $ } from "../../RteEditor.module-CUi7Vqe8.js";
|
|
18
18
|
import { ToolBarPlugin as vr } from "./Plugins/ToolbarPlugin/ToolbarPlugin.js";
|
|
19
19
|
import { useTranslation as yr } from "./hooks/useTranslation.js";
|
|
20
|
-
import "../../TablePlugin-
|
|
20
|
+
import "../../TablePlugin-CqCjNBW_.js";
|
|
21
21
|
import "./Plugins/LinkPlugin/LinkContextMenu/LinkContextMenu.js";
|
|
22
22
|
import "./hooks/components/Flyout.js";
|
|
23
23
|
import "../Accordion/Accordion.js";
|
|
@@ -45,11 +45,11 @@ import { PasteHandlerPlugin as br } from "./Plugins/PasteHandlerPlugin/PasteHand
|
|
|
45
45
|
import { UvaTheme as Er } from "./UvaTheme/UvaTheme.js";
|
|
46
46
|
import { EditorHeader as wr } from "./EditorHeader/EditorHeader.js";
|
|
47
47
|
import { LanguageProvider as Sr, useLanguage as xr } from "./Providers/LanguageProvider.js";
|
|
48
|
-
import { TableWrapperNode as
|
|
49
|
-
const
|
|
50
|
-
function
|
|
51
|
-
const t =
|
|
52
|
-
const { theme: n, namespace: o, nodes: a, onError: s, editorState: i, html: l } = r, d =
|
|
48
|
+
import { TableWrapperNode as Nr } from "./nodes/TableWrapperNode/TableWrapperNode.js";
|
|
49
|
+
const Oe = typeof window < "u" && window.document !== void 0 && window.document.createElement !== void 0, _r = Oe ? O : b, q = { tag: ne };
|
|
50
|
+
function Lr({ initialConfig: r, children: e }) {
|
|
51
|
+
const t = X(() => {
|
|
52
|
+
const { theme: n, namespace: o, nodes: a, onError: s, editorState: i, html: l } = r, d = Ge(null, n), u = De({ editable: r.editable, html: l, namespace: o, nodes: a, onError: (m) => s(m, u), theme: n });
|
|
53
53
|
return (function(m, v) {
|
|
54
54
|
if (v !== null) {
|
|
55
55
|
if (v === void 0) m.update(() => {
|
|
@@ -57,7 +57,7 @@ function kr({ initialConfig: r, children: e }) {
|
|
|
57
57
|
if (S.isEmpty()) {
|
|
58
58
|
const C = Ye();
|
|
59
59
|
S.append(C);
|
|
60
|
-
const x =
|
|
60
|
+
const x = Oe ? document.activeElement : null;
|
|
61
61
|
(g() !== null || x !== null && x === m.getRootElement()) && C.select();
|
|
62
62
|
}
|
|
63
63
|
}, q);
|
|
@@ -78,42 +78,42 @@ function kr({ initialConfig: r, children: e }) {
|
|
|
78
78
|
}
|
|
79
79
|
})(u, i), [u, d];
|
|
80
80
|
}, []);
|
|
81
|
-
return
|
|
81
|
+
return _r(() => {
|
|
82
82
|
const n = r.editable, [o] = t;
|
|
83
83
|
o.setEditable(n === void 0 || n);
|
|
84
|
-
}, []), f(
|
|
84
|
+
}, []), f(Xe.Provider, { value: t, children: e });
|
|
85
85
|
}
|
|
86
|
-
const
|
|
87
|
-
function
|
|
86
|
+
const kr = oe({ name: "@lexical/react/ReactProvider" });
|
|
87
|
+
function Dr() {
|
|
88
88
|
return F().getTextContent();
|
|
89
89
|
}
|
|
90
|
-
function
|
|
90
|
+
function Pr(r, e = !0) {
|
|
91
91
|
if (r) return !1;
|
|
92
|
-
let t =
|
|
92
|
+
let t = Dr();
|
|
93
93
|
return e && (t = t.trim()), t === "";
|
|
94
94
|
}
|
|
95
|
-
function
|
|
96
|
-
if (!
|
|
95
|
+
function $r(r) {
|
|
96
|
+
if (!Pr(r, !1)) return !1;
|
|
97
97
|
const e = F().getChildren(), t = e.length;
|
|
98
98
|
if (t > 1) return !1;
|
|
99
99
|
for (let n = 0; n < t; n++) {
|
|
100
100
|
const o = e[n];
|
|
101
|
-
if (
|
|
101
|
+
if (U(o)) return !1;
|
|
102
102
|
if (ae(o)) {
|
|
103
|
-
if (!
|
|
103
|
+
if (!Qe(o) || o.__indent !== 0) return !1;
|
|
104
104
|
const a = o.getChildren(), s = a.length;
|
|
105
105
|
for (let i = 0; i < s; i++) {
|
|
106
106
|
const l = a[n];
|
|
107
|
-
if (!
|
|
107
|
+
if (!R(l)) return !1;
|
|
108
108
|
}
|
|
109
109
|
}
|
|
110
110
|
}
|
|
111
111
|
return !0;
|
|
112
112
|
}
|
|
113
113
|
function He(r) {
|
|
114
|
-
return () =>
|
|
114
|
+
return () => $r(r);
|
|
115
115
|
}
|
|
116
|
-
function
|
|
116
|
+
function Tr(r) {
|
|
117
117
|
const e = window.location.origin, t = (n) => {
|
|
118
118
|
if (n.origin !== e) return;
|
|
119
119
|
const o = r.getRootElement();
|
|
@@ -137,10 +137,10 @@ function $r(r) {
|
|
|
137
137
|
if (h(C)) {
|
|
138
138
|
const x = C.anchor;
|
|
139
139
|
let E = x.getNode(), w = 0, y = 0;
|
|
140
|
-
if (
|
|
140
|
+
if (R(E) && d >= 0 && u >= 0 && (w = d, y = d + u, C.setTextNodeRange(E, w, E, y)), w === y && m === "" || (C.insertRawText(m), E = x.getNode()), R(E)) {
|
|
141
141
|
w = v, y = v + S;
|
|
142
|
-
const
|
|
143
|
-
w = w >
|
|
142
|
+
const N = E.getTextContentSize();
|
|
143
|
+
w = w > N ? N : w, y = y > N ? N : y, C.setTextNodeRange(E, w, E, y);
|
|
144
144
|
}
|
|
145
145
|
n.stopImmediatePropagation();
|
|
146
146
|
}
|
|
@@ -165,8 +165,8 @@ function be(r, e) {
|
|
|
165
165
|
}
|
|
166
166
|
return null;
|
|
167
167
|
}
|
|
168
|
-
const K = typeof window < "u" && window.document !== void 0 && window.document.createElement !== void 0, Br = K && "documentMode" in document ? document.documentMode : null,
|
|
169
|
-
function
|
|
168
|
+
const K = typeof window < "u" && window.document !== void 0 && window.document.createElement !== void 0, Br = K && "documentMode" in document ? document.documentMode : null, Ir = K && /Mac|iPod|iPhone|iPad/.test(navigator.platform), Rr = !(!K || !("InputEvent" in window) || Br) && "getTargetRanges" in new window.InputEvent("input"), Mr = K && /Version\/[\d.]+.*Safari/.test(navigator.userAgent), Ee = K && /iPad|iPhone|iPod/.test(navigator.userAgent) && !window.MSStream, Ar = K && /^(?=.*Chrome).*/i.test(navigator.userAgent), Fr = K && /AppleWebKit\/[\d.]+/.test(navigator.userAgent) && Ir && !Ar, we = tt("DRAG_DROP_PASTE_FILE");
|
|
169
|
+
function G(r) {
|
|
170
170
|
let e = null;
|
|
171
171
|
if (z(r, DragEvent) ? e = r.dataTransfer : z(r, ClipboardEvent) && (e = r.clipboardData), e === null) return [!1, [], !1];
|
|
172
172
|
const t = e.types, n = t.includes("Files"), o = t.includes("text/html") || t.includes("text/plain");
|
|
@@ -188,25 +188,25 @@ function Se(r) {
|
|
|
188
188
|
}
|
|
189
189
|
function xe(r) {
|
|
190
190
|
const e = te(r);
|
|
191
|
-
return
|
|
191
|
+
return U(e);
|
|
192
192
|
}
|
|
193
193
|
function V(r) {
|
|
194
194
|
for (const e of ["lowercase", "uppercase", "capitalize"]) r.hasFormat(e) && r.toggleFormat(e);
|
|
195
195
|
}
|
|
196
196
|
function Kr(r) {
|
|
197
|
-
return H(r.registerCommand(
|
|
197
|
+
return H(r.registerCommand($t, (e) => {
|
|
198
198
|
const t = g();
|
|
199
|
-
return !!
|
|
200
|
-
}, c), r.registerCommand(
|
|
199
|
+
return !!P(t) && (t.clear(), !0);
|
|
200
|
+
}, c), r.registerCommand(Q, (e) => {
|
|
201
201
|
const t = g();
|
|
202
|
-
return h(t) ? (t.deleteCharacter(e), !0) : !!
|
|
203
|
-
}, c), r.registerCommand(
|
|
202
|
+
return h(t) ? (t.deleteCharacter(e), !0) : !!P(t) && (t.deleteNodes(), !0);
|
|
203
|
+
}, c), r.registerCommand(Pt, (e) => {
|
|
204
204
|
const t = g();
|
|
205
205
|
return !!h(t) && (t.deleteWord(e), !0);
|
|
206
|
-
}, c), r.registerCommand(
|
|
206
|
+
}, c), r.registerCommand(Dt, (e) => {
|
|
207
207
|
const t = g();
|
|
208
208
|
return !!h(t) && (t.deleteLine(e), !0);
|
|
209
|
-
}, c), r.registerCommand(
|
|
209
|
+
}, c), r.registerCommand(kt, (e) => {
|
|
210
210
|
const t = g();
|
|
211
211
|
if (typeof e == "string") t !== null && t.insertText(e);
|
|
212
212
|
else {
|
|
@@ -219,15 +219,15 @@ function Kr(r) {
|
|
|
219
219
|
}
|
|
220
220
|
}
|
|
221
221
|
return !0;
|
|
222
|
-
}, c), r.registerCommand(
|
|
222
|
+
}, c), r.registerCommand(Lt, () => {
|
|
223
223
|
const e = g();
|
|
224
224
|
return !!h(e) && (e.removeText(), !0);
|
|
225
|
-
}, c), r.registerCommand(
|
|
225
|
+
}, c), r.registerCommand(_t, (e) => {
|
|
226
226
|
const t = g();
|
|
227
227
|
return !!h(t) && (t.formatText(e), !0);
|
|
228
|
-
}, c), r.registerCommand(
|
|
228
|
+
}, c), r.registerCommand(Nt, (e) => {
|
|
229
229
|
const t = g();
|
|
230
|
-
if (!h(t) && !
|
|
230
|
+
if (!h(t) && !P(t)) return !1;
|
|
231
231
|
const n = t.getNodes();
|
|
232
232
|
for (const o of n) {
|
|
233
233
|
const a = Be(o, (s) => ae(s) && !s.isInline());
|
|
@@ -240,7 +240,7 @@ function Kr(r) {
|
|
|
240
240
|
}, c), r.registerCommand(de, () => {
|
|
241
241
|
const e = g();
|
|
242
242
|
return !!h(e) && (e.insertParagraph(), !0);
|
|
243
|
-
}, c), r.registerCommand(St, () => (
|
|
243
|
+
}, c), r.registerCommand(St, () => (Te([xt()]), !0), c), r.registerCommand(wt, () => Se((e) => {
|
|
244
244
|
const t = e.getIndent();
|
|
245
245
|
e.setIndent(t + 1);
|
|
246
246
|
}), c), r.registerCommand(ce, () => Se((e) => {
|
|
@@ -248,17 +248,17 @@ function Kr(r) {
|
|
|
248
248
|
t > 0 && e.setIndent(Math.max(0, t - 1));
|
|
249
249
|
}), c), r.registerCommand(Et, (e) => {
|
|
250
250
|
const t = g();
|
|
251
|
-
if (
|
|
251
|
+
if (P(t)) {
|
|
252
252
|
const n = t.getNodes();
|
|
253
253
|
if (n.length > 0) return e.preventDefault(), n[0].selectPrevious(), !0;
|
|
254
254
|
} else if (h(t)) {
|
|
255
255
|
const n = fe(t.focus, !0);
|
|
256
|
-
if (!e.shiftKey &&
|
|
256
|
+
if (!e.shiftKey && U(n) && !n.isIsolated() && !n.isInline()) return n.selectPrevious(), e.preventDefault(), !0;
|
|
257
257
|
}
|
|
258
258
|
return !1;
|
|
259
259
|
}, c), r.registerCommand(bt, (e) => {
|
|
260
260
|
const t = g();
|
|
261
|
-
if (
|
|
261
|
+
if (P(t)) {
|
|
262
262
|
const n = t.getNodes();
|
|
263
263
|
if (n.length > 0) return e.preventDefault(), n[0].selectNext(0, 0), !0;
|
|
264
264
|
} else if (h(t)) {
|
|
@@ -267,12 +267,12 @@ function Kr(r) {
|
|
|
267
267
|
return a.key === "root" && a.offset === F().getChildrenSize();
|
|
268
268
|
})(t)) return e.preventDefault(), !0;
|
|
269
269
|
const n = fe(t.focus, !1);
|
|
270
|
-
if (!e.shiftKey &&
|
|
270
|
+
if (!e.shiftKey && U(n) && !n.isIsolated() && !n.isInline()) return n.selectNext(), e.preventDefault(), !0;
|
|
271
271
|
}
|
|
272
272
|
return !1;
|
|
273
273
|
}, c), r.registerCommand(Ct, (e) => {
|
|
274
274
|
const t = g();
|
|
275
|
-
if (
|
|
275
|
+
if (P(t)) {
|
|
276
276
|
const n = t.getNodes();
|
|
277
277
|
if (n.length > 0) return e.preventDefault(), he(n[0]) ? n[0].selectNext(0, 0) : n[0].selectPrevious(), !0;
|
|
278
278
|
}
|
|
@@ -284,7 +284,7 @@ function Kr(r) {
|
|
|
284
284
|
return !1;
|
|
285
285
|
}, c), r.registerCommand(yt, (e) => {
|
|
286
286
|
const t = g();
|
|
287
|
-
if (
|
|
287
|
+
if (P(t)) {
|
|
288
288
|
const o = t.getNodes();
|
|
289
289
|
if (o.length > 0) return e.preventDefault(), he(o[0]) ? o[0].selectPrevious() : o[0].selectNext(0, 0), !0;
|
|
290
290
|
}
|
|
@@ -300,22 +300,22 @@ function Kr(r) {
|
|
|
300
300
|
const { anchor: o } = n;
|
|
301
301
|
if (o.offset !== 0) return !1;
|
|
302
302
|
const a = o.getNode();
|
|
303
|
-
if (
|
|
303
|
+
if ($e(a)) return !1;
|
|
304
304
|
const s = tr(a);
|
|
305
305
|
return s.getIndent() > 0 && (s.is(a) || a.is(s.getFirstDescendant()));
|
|
306
306
|
})(t)) return e.preventDefault(), r.dispatchCommand(ce, void 0);
|
|
307
307
|
if (Ee && navigator.language === "ko-KR") return !1;
|
|
308
|
-
} else if (!
|
|
309
|
-
return e.preventDefault(), r.dispatchCommand(
|
|
308
|
+
} else if (!P(t)) return !1;
|
|
309
|
+
return e.preventDefault(), r.dispatchCommand(Q, !0);
|
|
310
310
|
}, c), r.registerCommand(ht, (e) => {
|
|
311
311
|
if (xe(e.target)) return !1;
|
|
312
312
|
const t = g();
|
|
313
|
-
return !(!h(t) && !
|
|
313
|
+
return !(!h(t) && !P(t)) && (e.preventDefault(), r.dispatchCommand(Q, !1));
|
|
314
314
|
}, c), r.registerCommand(gt, (e) => {
|
|
315
315
|
const t = g();
|
|
316
316
|
if (!h(t)) return !1;
|
|
317
317
|
if (V(t), e !== null) {
|
|
318
|
-
if ((Ee ||
|
|
318
|
+
if ((Ee || Mr || Fr) && Rr) return !1;
|
|
319
319
|
if (e.preventDefault(), e.shiftKey) return r.dispatchCommand(ue, !1);
|
|
320
320
|
}
|
|
321
321
|
return r.dispatchCommand(de, void 0);
|
|
@@ -323,20 +323,20 @@ function Kr(r) {
|
|
|
323
323
|
const e = g();
|
|
324
324
|
return !!h(e) && (r.blur(), !0);
|
|
325
325
|
}, c), r.registerCommand(ct, (e) => {
|
|
326
|
-
const [, t] =
|
|
326
|
+
const [, t] = G(e);
|
|
327
327
|
if (t.length > 0) {
|
|
328
328
|
const o = be(e.clientX, e.clientY);
|
|
329
329
|
if (o !== null) {
|
|
330
330
|
const { offset: a, node: s } = o, i = te(s);
|
|
331
331
|
if (i !== null) {
|
|
332
332
|
const l = ft();
|
|
333
|
-
if (
|
|
333
|
+
if (R(i)) l.anchor.set(i.getKey(), a, "text"), l.focus.set(i.getKey(), a, "text");
|
|
334
334
|
else {
|
|
335
335
|
const u = i.getParentOrThrow().getKey(), m = i.getIndexWithinParent() + 1;
|
|
336
336
|
l.anchor.set(u, m, "element"), l.focus.set(u, m, "element");
|
|
337
337
|
}
|
|
338
338
|
const d = mt(l);
|
|
339
|
-
|
|
339
|
+
Pe(d);
|
|
340
340
|
}
|
|
341
341
|
r.dispatchCommand(we, t);
|
|
342
342
|
}
|
|
@@ -345,31 +345,31 @@ function Kr(r) {
|
|
|
345
345
|
const n = g();
|
|
346
346
|
return !!h(n);
|
|
347
347
|
}, c), r.registerCommand(dt, (e) => {
|
|
348
|
-
const [t] =
|
|
348
|
+
const [t] = G(e), n = g();
|
|
349
349
|
return !(t && !h(n));
|
|
350
350
|
}, c), r.registerCommand(ut, (e) => {
|
|
351
|
-
const [t] =
|
|
351
|
+
const [t] = G(e), n = g();
|
|
352
352
|
if (t && !h(n)) return !1;
|
|
353
353
|
const o = be(e.clientX, e.clientY);
|
|
354
354
|
if (o !== null) {
|
|
355
355
|
const a = te(o.node);
|
|
356
|
-
|
|
356
|
+
U(a) && e.preventDefault();
|
|
357
357
|
}
|
|
358
358
|
return !0;
|
|
359
359
|
}, c), r.registerCommand(it, () => (lt(), !0), c), r.registerCommand(st, (e) => (ge(r, z(e, ClipboardEvent) ? e : null), !0), c), r.registerCommand(at, (e) => ((async function(t, n) {
|
|
360
360
|
await ge(n, z(t, ClipboardEvent) ? t : null), n.update(() => {
|
|
361
361
|
const o = g();
|
|
362
|
-
h(o) ? o.removeText() :
|
|
362
|
+
h(o) ? o.removeText() : P(o) && o.getNodes().forEach((a) => a.remove());
|
|
363
363
|
});
|
|
364
364
|
})(e, r), !0), c), r.registerCommand(et, (e) => {
|
|
365
|
-
const [, t, n] =
|
|
365
|
+
const [, t, n] = G(e);
|
|
366
366
|
return t.length > 0 && !n ? (r.dispatchCommand(we, t), !0) : rt(e.target) && nt(e.target) ? !1 : g() !== null && ((function(o, a) {
|
|
367
367
|
o.preventDefault(), a.update(() => {
|
|
368
368
|
const s = g(), i = z(o, InputEvent) || z(o, KeyboardEvent) ? null : o.clipboardData;
|
|
369
369
|
i != null && s !== null && pe(i, s, a);
|
|
370
370
|
}, { tag: ot });
|
|
371
371
|
})(e, r), !0);
|
|
372
|
-
}, c), r.registerCommand(
|
|
372
|
+
}, c), r.registerCommand(Ze, (e) => {
|
|
373
373
|
const t = g();
|
|
374
374
|
return h(t) && V(t), !1;
|
|
375
375
|
}, c), r.registerCommand(Ve, (e) => {
|
|
@@ -383,17 +383,17 @@ function zr(r, ...e) {
|
|
|
383
383
|
for (const o of e) n.append("v", o);
|
|
384
384
|
throw t.search = n.toString(), Error(`Minified Lexical error #${r}; visit ${t.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`);
|
|
385
385
|
}
|
|
386
|
-
const ie = typeof window < "u" && window.document !== void 0 && window.document.createElement !== void 0 ?
|
|
387
|
-
function
|
|
386
|
+
const ie = typeof window < "u" && window.document !== void 0 && window.document.createElement !== void 0 ? O : b;
|
|
387
|
+
function Ur({ editor: r, ErrorBoundary: e }) {
|
|
388
388
|
return (function(t, n) {
|
|
389
|
-
const [o, a] =
|
|
389
|
+
const [o, a] = M(() => t.getDecorators());
|
|
390
390
|
return ie(() => t.registerDecoratorListener((s) => {
|
|
391
|
-
|
|
391
|
+
Zt(() => {
|
|
392
392
|
a(s);
|
|
393
393
|
});
|
|
394
394
|
}), [t]), b(() => {
|
|
395
395
|
a(t.getDecorators());
|
|
396
|
-
}, [t]),
|
|
396
|
+
}, [t]), X(() => {
|
|
397
397
|
const s = [], i = Object.keys(o);
|
|
398
398
|
for (let l = 0; l < i.length; l++) {
|
|
399
399
|
const d = i[l], u = f(n, { onError: (v) => t._onError(v), children: f(zt, { fallback: null, children: o[d] }) }), m = t.getElementByKey(d);
|
|
@@ -403,31 +403,31 @@ function Or({ editor: r, ErrorBoundary: e }) {
|
|
|
403
403
|
}, [n, o, t]);
|
|
404
404
|
})(r, e);
|
|
405
405
|
}
|
|
406
|
-
function
|
|
406
|
+
function Or({ editor: r, ErrorBoundary: e }) {
|
|
407
407
|
return (function(t) {
|
|
408
408
|
const n = qt.maybeFromEditor(t);
|
|
409
|
-
if (n && n.hasExtensionByName(
|
|
409
|
+
if (n && n.hasExtensionByName(kr.name)) {
|
|
410
410
|
for (const o of ["@lexical/plain-text", "@lexical/rich-text"]) n.hasExtensionByName(o) && zr(320, o);
|
|
411
411
|
return !0;
|
|
412
412
|
}
|
|
413
413
|
return !1;
|
|
414
|
-
})(r) ? null : f(
|
|
414
|
+
})(r) ? null : f(Ur, { editor: r, ErrorBoundary: e });
|
|
415
415
|
}
|
|
416
|
-
function
|
|
416
|
+
function Ne(r) {
|
|
417
417
|
return r.getEditorState().read(He(r.isComposing()));
|
|
418
418
|
}
|
|
419
419
|
function Hr({ contentEditable: r, placeholder: e = null, ErrorBoundary: t }) {
|
|
420
|
-
const [n] =
|
|
420
|
+
const [n] = k();
|
|
421
421
|
return (function(o) {
|
|
422
|
-
ie(() => H(Kr(o),
|
|
423
|
-
})(n),
|
|
422
|
+
ie(() => H(Kr(o), Tr(o)), [o]);
|
|
423
|
+
})(n), A(ke, { children: [r, f(jr, { content: e }), f(Or, { editor: n, ErrorBoundary: t })] });
|
|
424
424
|
}
|
|
425
|
-
function
|
|
426
|
-
const [e] =
|
|
427
|
-
const [a, s] =
|
|
425
|
+
function jr({ content: r }) {
|
|
426
|
+
const [e] = k(), t = (function(o) {
|
|
427
|
+
const [a, s] = M(() => Ne(o));
|
|
428
428
|
return ie(() => {
|
|
429
429
|
function i() {
|
|
430
|
-
const l =
|
|
430
|
+
const l = Ne(o);
|
|
431
431
|
s(l);
|
|
432
432
|
}
|
|
433
433
|
return i(), H(o.registerUpdateListener(() => {
|
|
@@ -436,37 +436,37 @@ function Wr({ content: r }) {
|
|
|
436
436
|
i();
|
|
437
437
|
}));
|
|
438
438
|
}, [o]), a;
|
|
439
|
-
})(e), n =
|
|
439
|
+
})(e), n = Wt();
|
|
440
440
|
return t ? typeof r == "function" ? r(n) : r : null;
|
|
441
441
|
}
|
|
442
|
-
const
|
|
443
|
-
function
|
|
444
|
-
const [p,
|
|
445
|
-
|
|
446
|
-
}, [r]), Y =
|
|
442
|
+
const je = typeof window < "u" && window.document !== void 0 && window.document.createElement !== void 0 ? O : b;
|
|
443
|
+
function Wr({ editor: r, ariaActiveDescendant: e, ariaAutoComplete: t, ariaControls: n, ariaDescribedBy: o, ariaErrorMessage: a, ariaExpanded: s, ariaInvalid: i, ariaLabel: l, ariaLabelledBy: d, ariaMultiline: u, ariaOwns: m, ariaRequired: v, autoCapitalize: S, className: C, id: x, role: E = "textbox", spellCheck: w = !0, style: y, tabIndex: N, "data-testid": D, ..._ }, L) {
|
|
444
|
+
const [p, T] = M(r.isEditable()), B = Ut((I) => {
|
|
445
|
+
I && I.ownerDocument && I.ownerDocument.defaultView ? r.setRootElement(I) : r.setRootElement(null);
|
|
446
|
+
}, [r]), Y = X(() => /* @__PURE__ */ (function(...I) {
|
|
447
447
|
return (le) => {
|
|
448
|
-
for (const
|
|
448
|
+
for (const j of I) typeof j == "function" ? j(le) : j != null && (j.current = le);
|
|
449
449
|
};
|
|
450
|
-
})(
|
|
451
|
-
return
|
|
452
|
-
|
|
453
|
-
})), [r]), f("div", { "aria-activedescendant": p ? e : void 0, "aria-autocomplete": p ? t : "none", "aria-controls": p ? n : void 0, "aria-describedby": o, ...a != null ? { "aria-errormessage": a } : {}, "aria-expanded": p && E === "combobox" ? !!s : void 0, ...i != null ? { "aria-invalid": i } : {}, "aria-label": l, "aria-labelledby": d, "aria-multiline": u, "aria-owns": p ? m : void 0, "aria-readonly": !p || void 0, "aria-required": v, autoCapitalize: S, className: C, contentEditable: p, "data-testid":
|
|
450
|
+
})(L, B), [B, L]);
|
|
451
|
+
return je(() => (T(r.isEditable()), r.registerEditableListener((I) => {
|
|
452
|
+
T(I);
|
|
453
|
+
})), [r]), f("div", { "aria-activedescendant": p ? e : void 0, "aria-autocomplete": p ? t : "none", "aria-controls": p ? n : void 0, "aria-describedby": o, ...a != null ? { "aria-errormessage": a } : {}, "aria-expanded": p && E === "combobox" ? !!s : void 0, ...i != null ? { "aria-invalid": i } : {}, "aria-label": l, "aria-labelledby": d, "aria-multiline": u, "aria-owns": p ? m : void 0, "aria-readonly": !p || void 0, "aria-required": v, autoCapitalize: S, className: C, contentEditable: p, "data-testid": D, id: x, ref: Y, role: E, spellCheck: w, style: y, tabIndex: N, ..._ });
|
|
454
454
|
}
|
|
455
|
-
const
|
|
456
|
-
function
|
|
455
|
+
const Jr = Ie(Wr);
|
|
456
|
+
function _e(r) {
|
|
457
457
|
return r.getEditorState().read(He(r.isComposing()));
|
|
458
458
|
}
|
|
459
|
-
const qr =
|
|
460
|
-
function
|
|
461
|
-
const { placeholder: t, ...n } = r, [o] =
|
|
462
|
-
return
|
|
459
|
+
const qr = Ie(Gr);
|
|
460
|
+
function Gr(r, e) {
|
|
461
|
+
const { placeholder: t, ...n } = r, [o] = k();
|
|
462
|
+
return A(ke, { children: [f(Jr, { editor: o, ...n, ref: e }), t != null && f(Xr, { editor: o, content: t })] });
|
|
463
463
|
}
|
|
464
|
-
function
|
|
464
|
+
function Xr({ content: r, editor: e }) {
|
|
465
465
|
const t = (function(s) {
|
|
466
|
-
const [i, l] =
|
|
467
|
-
return
|
|
466
|
+
const [i, l] = M(() => _e(s));
|
|
467
|
+
return je(() => {
|
|
468
468
|
function d() {
|
|
469
|
-
const u =
|
|
469
|
+
const u = _e(s);
|
|
470
470
|
l(u);
|
|
471
471
|
}
|
|
472
472
|
return d(), H(s.registerUpdateListener(() => {
|
|
@@ -475,20 +475,20 @@ function Zr({ content: r, editor: e }) {
|
|
|
475
475
|
d();
|
|
476
476
|
}));
|
|
477
477
|
}, [s]), i;
|
|
478
|
-
})(e), [n, o] =
|
|
479
|
-
if (
|
|
478
|
+
})(e), [n, o] = M(e.isEditable());
|
|
479
|
+
if (O(() => (o(e.isEditable()), e.registerEditableListener((s) => {
|
|
480
480
|
o(s);
|
|
481
481
|
})), [e]), !t) return null;
|
|
482
482
|
let a = null;
|
|
483
483
|
return typeof r == "function" ? a = r(n) : r !== null && (a = r), a === null ? null : f("div", { "aria-hidden": !0, children: a });
|
|
484
484
|
}
|
|
485
|
-
const Yr = Ht(null),
|
|
485
|
+
const Yr = Ht(null), Z = {
|
|
486
486
|
didCatch: !1,
|
|
487
487
|
error: null
|
|
488
488
|
};
|
|
489
|
-
class
|
|
489
|
+
class Qr extends Ot {
|
|
490
490
|
constructor(e) {
|
|
491
|
-
super(e), this.resetErrorBoundary = this.resetErrorBoundary.bind(this), this.state =
|
|
491
|
+
super(e), this.resetErrorBoundary = this.resetErrorBoundary.bind(this), this.state = Z;
|
|
492
492
|
}
|
|
493
493
|
static getDerivedStateFromError(e) {
|
|
494
494
|
return {
|
|
@@ -506,7 +506,7 @@ class Gr extends Ut {
|
|
|
506
506
|
(t = (n = this.props).onReset) === null || t === void 0 || t.call(n, {
|
|
507
507
|
args: a,
|
|
508
508
|
reason: "imperative-api"
|
|
509
|
-
}), this.setState(
|
|
509
|
+
}), this.setState(Z);
|
|
510
510
|
}
|
|
511
511
|
}
|
|
512
512
|
componentDidCatch(e, t) {
|
|
@@ -525,7 +525,7 @@ class Gr extends Ut {
|
|
|
525
525
|
next: o,
|
|
526
526
|
prev: e.resetKeys,
|
|
527
527
|
reason: "keys"
|
|
528
|
-
}), this.setState(
|
|
528
|
+
}), this.setState(Z);
|
|
529
529
|
}
|
|
530
530
|
}
|
|
531
531
|
render() {
|
|
@@ -566,12 +566,12 @@ function Vr() {
|
|
|
566
566
|
let r = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : [], e = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : [];
|
|
567
567
|
return r.length !== e.length || r.some((t, n) => !Object.is(t, e[n]));
|
|
568
568
|
}
|
|
569
|
-
function
|
|
570
|
-
return f(
|
|
569
|
+
function Zr({ children: r, onError: e }) {
|
|
570
|
+
return f(Qr, { fallback: f("div", { style: { border: "1px solid #f00", color: "#f00", padding: "8px" }, children: "An error was thrown." }), onError: e, children: r });
|
|
571
571
|
}
|
|
572
|
-
const en = typeof window < "u" && window.document !== void 0 && window.document.createElement !== void 0 ?
|
|
572
|
+
const en = typeof window < "u" && window.document !== void 0 && window.document.createElement !== void 0 ? O : b;
|
|
573
573
|
function tn({ ignoreHistoryMergeTagChange: r = !0, ignoreSelectionChange: e = !1, onChange: t }) {
|
|
574
|
-
const [n] =
|
|
574
|
+
const [n] = k();
|
|
575
575
|
return en(() => {
|
|
576
576
|
if (t) return n.registerUpdateListener(({ editorState: o, dirtyElements: a, dirtyLeaves: s, prevEditorState: i, tags: l }) => {
|
|
577
577
|
e && a.size === 0 && s.size === 0 || r && l.has(ne) || i.isEmpty() || t(o, n, l);
|
|
@@ -579,7 +579,7 @@ function tn({ ignoreHistoryMergeTagChange: r = !0, ignoreSelectionChange: e = !1
|
|
|
579
579
|
}, [n, r, e, t]), null;
|
|
580
580
|
}
|
|
581
581
|
function rn({ hasStrictIndent: r = !1 }) {
|
|
582
|
-
const [e] =
|
|
582
|
+
const [e] = k();
|
|
583
583
|
return b(() => {
|
|
584
584
|
if (!e.hasNodes([Fe, Ke])) throw new Error("ListPlugin: ListNode and/or ListItemNode not registered on editor");
|
|
585
585
|
}, [e]), b(() => {
|
|
@@ -589,27 +589,27 @@ function rn({ hasStrictIndent: r = !1 }) {
|
|
|
589
589
|
})(e), null;
|
|
590
590
|
}
|
|
591
591
|
function nn({ validateUrl: r, attributes: e }) {
|
|
592
|
-
const [t] =
|
|
592
|
+
const [t] = k();
|
|
593
593
|
return b(() => {
|
|
594
|
-
if (!t.hasNodes([
|
|
595
|
-
}), b(() =>
|
|
594
|
+
if (!t.hasNodes([Re])) throw new Error("LinkPlugin: LinkNode not registered on editor");
|
|
595
|
+
}), b(() => Gt(t, se({ attributes: e, validateUrl: r })), [t, r, e]), null;
|
|
596
596
|
}
|
|
597
597
|
function on(r, e, t) {
|
|
598
598
|
b(() => {
|
|
599
|
-
r.hasNodes([
|
|
599
|
+
r.hasNodes([Me]) || (function(n, ...o) {
|
|
600
600
|
const a = new URL("https://lexical.dev/docs/error"), s = new URLSearchParams();
|
|
601
601
|
s.append("code", n);
|
|
602
602
|
for (const i of o) s.append("v", i);
|
|
603
603
|
throw a.search = s.toString(), Error(`Minified Lexical error #${n}; visit ${a.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`);
|
|
604
604
|
})(77);
|
|
605
|
-
}), b(() =>
|
|
605
|
+
}), b(() => Xt(r, { changeHandlers: t ? [t] : [], matchers: e }), [r, e, t]);
|
|
606
606
|
}
|
|
607
607
|
function an({ matchers: r, onChange: e }) {
|
|
608
|
-
const [t] =
|
|
608
|
+
const [t] = k();
|
|
609
609
|
return on(t, r, e), null;
|
|
610
610
|
}
|
|
611
611
|
function sn({ newTab: r = !0, disabled: e = !1 }) {
|
|
612
|
-
const [t] =
|
|
612
|
+
const [t] = k();
|
|
613
613
|
return b(() => Yt(t, se({ disabled: e, newTab: r })), [t, r, e]), null;
|
|
614
614
|
}
|
|
615
615
|
function ln(r, e, t, n, o) {
|
|
@@ -617,26 +617,26 @@ function ln(r, e, t, n, o) {
|
|
|
617
617
|
const a = e._selection, s = r._selection;
|
|
618
618
|
if (o) return 1;
|
|
619
619
|
if (!(h(a) && h(s) && s.isCollapsed() && a.isCollapsed())) return 0;
|
|
620
|
-
const i = (function(w, y,
|
|
621
|
-
const
|
|
622
|
-
for (const
|
|
623
|
-
const p =
|
|
624
|
-
p !== void 0 &&
|
|
620
|
+
const i = (function(w, y, N) {
|
|
621
|
+
const D = w._nodeMap, _ = [];
|
|
622
|
+
for (const L of y) {
|
|
623
|
+
const p = D.get(L);
|
|
624
|
+
p !== void 0 && _.push(p);
|
|
625
625
|
}
|
|
626
|
-
for (const [
|
|
626
|
+
for (const [L, p] of N) {
|
|
627
627
|
if (!p) continue;
|
|
628
|
-
const
|
|
629
|
-
|
|
628
|
+
const T = D.get(L);
|
|
629
|
+
T === void 0 || $e(T) || _.push(T);
|
|
630
630
|
}
|
|
631
|
-
return
|
|
631
|
+
return _;
|
|
632
632
|
})(e, t, n);
|
|
633
633
|
if (i.length === 0) return 0;
|
|
634
634
|
if (i.length > 1) {
|
|
635
|
-
const w = e._nodeMap, y = w.get(a.anchor.key),
|
|
636
|
-
return y &&
|
|
635
|
+
const w = e._nodeMap, y = w.get(a.anchor.key), N = w.get(s.anchor.key);
|
|
636
|
+
return y && N && !r._nodeMap.has(y.__key) && R(y) && y.__text.length === 1 && a.anchor.offset === 1 ? 2 : 0;
|
|
637
637
|
}
|
|
638
638
|
const l = i[0], d = r._nodeMap.get(l.__key);
|
|
639
|
-
if (!
|
|
639
|
+
if (!R(d) || !R(l) || d.__mode !== l.__mode) return 0;
|
|
640
640
|
const u = d.__text, m = l.__text;
|
|
641
641
|
if (u === m) return 0;
|
|
642
642
|
const v = a.anchor, S = s.anchor;
|
|
@@ -650,90 +650,90 @@ function un(r, e) {
|
|
|
650
650
|
const u = Date.now();
|
|
651
651
|
if (d.has(re)) return n = 0, t = u, 2;
|
|
652
652
|
const m = ln(o, a, i, l, r.isComposing()), v = (() => {
|
|
653
|
-
const S = s === null || s.editor === r, C = d.has(
|
|
653
|
+
const S = s === null || s.editor === r, C = d.has(Mt);
|
|
654
654
|
if (!C && S && d.has(ne)) return 0;
|
|
655
655
|
if (o === null) return 1;
|
|
656
656
|
const x = a._selection;
|
|
657
657
|
if (!(i.size > 0 || l.size > 0)) return x !== null ? 0 : 2;
|
|
658
658
|
const E = typeof e == "number" ? e : e.peek();
|
|
659
|
-
return C === !1 && m !== 0 && m === n && u < t + E && S || i.size === 1 && (function(w, y,
|
|
660
|
-
const
|
|
661
|
-
return !(h(
|
|
659
|
+
return C === !1 && m !== 0 && m === n && u < t + E && S || i.size === 1 && (function(w, y, N) {
|
|
660
|
+
const D = y._nodeMap.get(w), _ = N._nodeMap.get(w), L = y._selection, p = N._selection;
|
|
661
|
+
return !(h(L) && h(p) && L.anchor.type === "element" && L.focus.type === "element" && p.anchor.type === "text" && p.focus.type === "text" || !R(D) || !R(_) || D.__parent !== _.__parent) && JSON.stringify(y.read(() => D.exportJSON())) === JSON.stringify(N.read(() => _.exportJSON()));
|
|
662
662
|
})(Array.from(i)[0], o, a) ? 0 : 1;
|
|
663
663
|
})();
|
|
664
664
|
return t = u, n = m, v;
|
|
665
665
|
};
|
|
666
666
|
}
|
|
667
|
-
function
|
|
667
|
+
function Le(r) {
|
|
668
668
|
r.undoStack = [], r.redoStack = [], r.current = null;
|
|
669
669
|
}
|
|
670
|
-
function
|
|
670
|
+
function We(r, e, t) {
|
|
671
671
|
const n = un(r, t);
|
|
672
|
-
return H(r.registerCommand(
|
|
672
|
+
return H(r.registerCommand(Rt, () => ((function(a, s) {
|
|
673
673
|
const i = s.redoStack, l = s.undoStack;
|
|
674
674
|
if (l.length !== 0) {
|
|
675
675
|
const d = s.current, u = l.pop();
|
|
676
|
-
d !== null && (i.push(d), a.dispatchCommand(
|
|
676
|
+
d !== null && (i.push(d), a.dispatchCommand(W, !0)), l.length === 0 && a.dispatchCommand(J, !1), s.current = u || null, u && u.editor.setEditorState(u.editorState, { tag: re });
|
|
677
677
|
}
|
|
678
|
-
})(r, e), !0), c), r.registerCommand(
|
|
678
|
+
})(r, e), !0), c), r.registerCommand(It, () => ((function(a, s) {
|
|
679
679
|
const i = s.redoStack, l = s.undoStack;
|
|
680
680
|
if (i.length !== 0) {
|
|
681
681
|
const d = s.current;
|
|
682
|
-
d !== null && (l.push(d), a.dispatchCommand(
|
|
682
|
+
d !== null && (l.push(d), a.dispatchCommand(J, !0));
|
|
683
683
|
const u = i.pop();
|
|
684
|
-
i.length === 0 && a.dispatchCommand(
|
|
684
|
+
i.length === 0 && a.dispatchCommand(W, !1), s.current = u || null, u && u.editor.setEditorState(u.editorState, { tag: re });
|
|
685
685
|
}
|
|
686
|
-
})(r, e), !0), c), r.registerCommand(Bt, () => (
|
|
686
|
+
})(r, e), !0), c), r.registerCommand(Bt, () => (Le(e), !1), c), r.registerCommand(Tt, () => (Le(e), r.dispatchCommand(W, !1), r.dispatchCommand(J, !1), !0), c), r.registerUpdateListener(({ editorState: a, prevEditorState: s, dirtyLeaves: i, dirtyElements: l, tags: d }) => {
|
|
687
687
|
const u = e.current, m = e.redoStack, v = e.undoStack, S = u === null ? null : u.editorState;
|
|
688
688
|
if (u !== null && a === S) return;
|
|
689
689
|
const C = n(s, a, u, i, l, d);
|
|
690
|
-
if (C === 1) m.length !== 0 && (e.redoStack = [], r.dispatchCommand(
|
|
690
|
+
if (C === 1) m.length !== 0 && (e.redoStack = [], r.dispatchCommand(W, !1)), u !== null && (v.push({ ...u }), r.dispatchCommand(J, !0));
|
|
691
691
|
else if (C === 2) return;
|
|
692
692
|
e.current = { editor: r, editorState: a };
|
|
693
693
|
}));
|
|
694
694
|
}
|
|
695
|
-
function
|
|
695
|
+
function Je() {
|
|
696
696
|
return { current: null, redoStack: [], undoStack: [] };
|
|
697
697
|
}
|
|
698
|
-
const ee = oe({ build: (r, { delay: e, createInitialHistoryState: t, disabled: n }) => se({ delay: e, disabled: n, historyState: t(r) }), config: Ft({ createInitialHistoryState:
|
|
698
|
+
const ee = oe({ build: (r, { delay: e, createInitialHistoryState: t, disabled: n }) => se({ delay: e, disabled: n, historyState: t(r) }), config: Ft({ createInitialHistoryState: Je, delay: 300, disabled: typeof window > "u" }), name: "@lexical/history/History", register: (r, e, t) => {
|
|
699
699
|
const n = t.getOutput();
|
|
700
|
-
return
|
|
700
|
+
return Ae(() => n.disabled.value ? void 0 : We(r, n.historyState.value, n.delay));
|
|
701
701
|
} });
|
|
702
|
-
oe({ dependencies: [
|
|
702
|
+
oe({ dependencies: [At(ee, { createInitialHistoryState: () => {
|
|
703
703
|
throw new Error("SharedHistory did not inherit parent history");
|
|
704
704
|
}, disabled: !0 })], name: "@lexical/history/SharedHistory", register(r, e, t) {
|
|
705
705
|
const { output: n } = t.getDependency(ee), o = (function(s) {
|
|
706
|
-
return s ?
|
|
706
|
+
return s ? Qt(s, ee.name) : null;
|
|
707
707
|
})(r._parentEditor);
|
|
708
708
|
if (!o) return () => {
|
|
709
709
|
};
|
|
710
710
|
const a = o.output;
|
|
711
|
-
return
|
|
711
|
+
return Ae(() => Vt(() => {
|
|
712
712
|
n.delay.value = a.delay.value, n.historyState.value = a.historyState.value, n.disabled.value = a.disabled.value;
|
|
713
713
|
}));
|
|
714
714
|
} });
|
|
715
715
|
function dn({ delay: r, externalHistoryState: e }) {
|
|
716
|
-
const [t] =
|
|
716
|
+
const [t] = k();
|
|
717
717
|
return (function(n, o, a = 1e3) {
|
|
718
|
-
const s =
|
|
719
|
-
b(() =>
|
|
718
|
+
const s = X(() => o || Je(), [o]);
|
|
719
|
+
b(() => We(n, s, a), [a, n, s]);
|
|
720
720
|
})(t, e, r), null;
|
|
721
721
|
}
|
|
722
722
|
function cn({ hasCellMerge: r = !0, hasCellBackgroundColor: e = !0, hasTabHandler: t = !0, hasHorizontalScroll: n = !1 }) {
|
|
723
|
-
const [o] =
|
|
723
|
+
const [o] = k();
|
|
724
724
|
return b(() => {
|
|
725
725
|
sr(o) !== n && (ir(o, n), o.registerNodeTransform(ze, () => {
|
|
726
726
|
})());
|
|
727
727
|
}, [o, n]), b(() => lr(o), [o]), b(() => ur(o, t), [o, t]), b(() => {
|
|
728
728
|
if (!r) return dr(o);
|
|
729
729
|
}, [o, r]), b(() => {
|
|
730
|
-
if (!e) return o.registerNodeTransform(
|
|
730
|
+
if (!e) return o.registerNodeTransform(Ue, (a) => {
|
|
731
731
|
a.getBackgroundColor() !== null && a.setBackgroundColor(null);
|
|
732
732
|
});
|
|
733
733
|
}, [o, e, r]), null;
|
|
734
734
|
}
|
|
735
735
|
function fn({ editorRef: r }) {
|
|
736
|
-
const [e] =
|
|
736
|
+
const [e] = k();
|
|
737
737
|
return Kt.useEffect(() => {
|
|
738
738
|
typeof r == "function" ? r(e) : typeof r == "object" && (r.current = e);
|
|
739
739
|
}, [e]), null;
|
|
@@ -752,7 +752,7 @@ const qe = 200, mn = ({
|
|
|
752
752
|
rteRef: u = null,
|
|
753
753
|
onChange: m
|
|
754
754
|
}) => {
|
|
755
|
-
const { switchLanguage: v } = xr(), S = yr(), [C] =
|
|
755
|
+
const { switchLanguage: v } = xr(), S = yr(), [C] = M(() => De()), [x, E] = M(0), [w, y] = M(0), N = jt(), D = {
|
|
756
756
|
html: {
|
|
757
757
|
export: fr
|
|
758
758
|
},
|
|
@@ -762,27 +762,27 @@ const qe = 200, mn = ({
|
|
|
762
762
|
onError(p) {
|
|
763
763
|
throw p;
|
|
764
764
|
},
|
|
765
|
-
nodes: [Fe, Ke,
|
|
765
|
+
nodes: [Fe, Ke, Re, Me, Ue, cr, ze, Nr],
|
|
766
766
|
editorState: (p) => {
|
|
767
767
|
const B = new DOMParser().parseFromString(e, "text/html"), Y = rr(p, B);
|
|
768
|
-
F().clear(),
|
|
768
|
+
F().clear(), Te(Y), Pe(null);
|
|
769
769
|
}
|
|
770
|
-
},
|
|
770
|
+
}, _ = (p) => p.trim().length === 0 ? 0 : p.split(" ").length, L = (p, T) => {
|
|
771
771
|
p.read(() => {
|
|
772
772
|
let B = "";
|
|
773
|
-
E(
|
|
773
|
+
E(_(F().getTextContent().replace(/\s+/g, " ").trim())), B = mr(nr(T)), B = pr(B), m(B);
|
|
774
774
|
});
|
|
775
775
|
};
|
|
776
776
|
return b(() => {
|
|
777
777
|
v(r.toLocaleLowerCase());
|
|
778
778
|
}, [r, v]), b(() => {
|
|
779
779
|
const p = e.replace(/<br\s*\/?>| /gi, " ").replace(/<\/?[^>]+(>|$)|&[a-z]+;/g, "").replace(/\s+/g, " ").trim();
|
|
780
|
-
E(
|
|
781
|
-
}, [e]), /* @__PURE__ */
|
|
782
|
-
/* @__PURE__ */
|
|
780
|
+
E(_(p));
|
|
781
|
+
}, [e]), /* @__PURE__ */ A("div", { className: $.editor__container, children: [
|
|
782
|
+
/* @__PURE__ */ A("div", { className: $.editor__header, children: [
|
|
783
783
|
/* @__PURE__ */ f(wr, { label: n, info: o, required: a }),
|
|
784
|
-
/* @__PURE__ */
|
|
785
|
-
/* @__PURE__ */ f("span", { className: Ce({ [
|
|
784
|
+
/* @__PURE__ */ A("div", { className: $["editor__header-word-count"], children: [
|
|
785
|
+
/* @__PURE__ */ f("span", { className: Ce({ [$["editor__header-word-count--alert"]]: x > d }), children: x }),
|
|
786
786
|
" / ",
|
|
787
787
|
d
|
|
788
788
|
] })
|
|
@@ -790,41 +790,41 @@ const qe = 200, mn = ({
|
|
|
790
790
|
/* @__PURE__ */ f(
|
|
791
791
|
"div",
|
|
792
792
|
{
|
|
793
|
-
className: Ce(
|
|
794
|
-
[
|
|
793
|
+
className: Ce($.editor, {
|
|
794
|
+
[$["not-valid"]]: s
|
|
795
795
|
}),
|
|
796
|
-
children: /* @__PURE__ */
|
|
796
|
+
children: /* @__PURE__ */ A(Lr, { initialConfig: D, children: [
|
|
797
797
|
/* @__PURE__ */ f(vr, { editorScrollPosition: w }),
|
|
798
|
-
/* @__PURE__ */
|
|
798
|
+
/* @__PURE__ */ A("div", { className: $["editor__field-wrapper"], children: [
|
|
799
799
|
/* @__PURE__ */ f(
|
|
800
800
|
Hr,
|
|
801
801
|
{
|
|
802
802
|
contentEditable: /* @__PURE__ */ f(
|
|
803
803
|
qr,
|
|
804
804
|
{
|
|
805
|
-
className:
|
|
805
|
+
className: $.editor__field,
|
|
806
806
|
"aria-label": S.common.rteAriaLabel,
|
|
807
807
|
"aria-placeholder": t,
|
|
808
808
|
title: S.common.rteTitle,
|
|
809
|
-
placeholder: /* @__PURE__ */ f("div", { className:
|
|
809
|
+
placeholder: /* @__PURE__ */ f("div", { className: $.editor__placeholder, children: t }),
|
|
810
810
|
spellCheck: !1,
|
|
811
|
-
id: `${
|
|
811
|
+
id: `${N}_rteEditor`,
|
|
812
812
|
style: { height: `${l}`, maxHeight: `${l}` },
|
|
813
813
|
onScroll: (p) => y(p.currentTarget.scrollTop)
|
|
814
814
|
}
|
|
815
815
|
),
|
|
816
|
-
placeholder: /* @__PURE__ */ f("div", { className:
|
|
817
|
-
ErrorBoundary:
|
|
816
|
+
placeholder: /* @__PURE__ */ f("div", { className: $.editor__placeholder, children: t }),
|
|
817
|
+
ErrorBoundary: Zr
|
|
818
818
|
}
|
|
819
819
|
),
|
|
820
820
|
/* @__PURE__ */ f(cn, {}),
|
|
821
|
-
/* @__PURE__ */ f(
|
|
821
|
+
/* @__PURE__ */ f(Jt, {}),
|
|
822
822
|
/* @__PURE__ */ f(dn, {}),
|
|
823
823
|
/* @__PURE__ */ f(rn, {}),
|
|
824
824
|
/* @__PURE__ */ f(nn, { validateUrl: gr }),
|
|
825
825
|
/* @__PURE__ */ f(an, { matchers: hr }),
|
|
826
826
|
/* @__PURE__ */ f(sn, {}),
|
|
827
|
-
/* @__PURE__ */ f(tn, { onChange:
|
|
827
|
+
/* @__PURE__ */ f(tn, { onChange: L }),
|
|
828
828
|
/* @__PURE__ */ f(br, {}),
|
|
829
829
|
u && /* @__PURE__ */ f(fn, { editorRef: u })
|
|
830
830
|
] })
|