@uva-glass/component-library 1.54.0 → 1.55.0
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/AddTableFrom-CwnPli3F.js +162 -0
- package/dist/AddTableFrom-CwnPli3F.js.map +1 -0
- package/dist/{Lexical.prod-DNRTKPfN.js → Lexical.prod-BiuZHlIm.js} +927 -897
- package/dist/Lexical.prod-BiuZHlIm.js.map +1 -0
- package/dist/LexicalUtils.prod-BZOm66mY.js +94 -0
- package/dist/{LexicalUtils.prod-D_BPEjfg.js.map → LexicalUtils.prod-BZOm66mY.js.map} +1 -1
- package/dist/{ListPlugin-CgNBzfIl.js → ListPlugin-DFFbKLaN.js} +4 -4
- package/dist/{ListPlugin-CgNBzfIl.js.map → ListPlugin-DFFbKLaN.js.map} +1 -1
- package/dist/RteEditor.module-BBbfV1rk.js +24 -0
- package/dist/RteEditor.module-BBbfV1rk.js.map +1 -0
- package/dist/TablePlugin-CKJQiwra.js +1506 -0
- package/dist/TablePlugin-CKJQiwra.js.map +1 -0
- package/dist/assets/AddTableFrom.css +1 -0
- package/dist/assets/PageOverlay.css +1 -0
- package/dist/assets/RteEditor.css +1 -1
- package/dist/assets/useFlyout.css +1 -1
- package/dist/components/CheckboxTree/CheckboxTree.js +1 -1
- package/dist/components/Icon/icons/index.d.ts +3 -0
- package/dist/components/Icon/icons/index.js +18 -13
- package/dist/components/Icon/icons/index.js.map +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/PageOverlay/PageOverlay.d.ts +25 -0
- package/dist/components/PageOverlay/PageOverlay.js +100 -0
- package/dist/components/PageOverlay/PageOverlay.js.map +1 -0
- package/dist/components/PageOverlay/PageOverlay.stories.d.ts +7 -0
- package/dist/components/PageOverlay/PageOverlay.stories.js +167 -0
- package/dist/components/PageOverlay/PageOverlay.stories.js.map +1 -0
- package/dist/components/PageOverlay/index.d.ts +1 -0
- package/dist/components/PageOverlay/index.js +5 -0
- package/dist/components/PageOverlay/index.js.map +1 -0
- package/dist/components/ProgrammeCard/ProgrammeCard.stories.js +1 -1
- package/dist/components/RteEditor/Plugins/BlockFormatPlugin/BlockFormatPlugin.js +2 -2
- package/dist/components/RteEditor/Plugins/HistoryPlugin/HistoryPlugin.js +3 -3
- package/dist/components/RteEditor/Plugins/LinkPlugin/AddLinkFrom.d.ts +12 -0
- package/dist/components/RteEditor/Plugins/LinkPlugin/AddLinkFrom.js +28 -0
- package/dist/components/RteEditor/Plugins/LinkPlugin/AddLinkFrom.js.map +1 -0
- package/dist/components/RteEditor/Plugins/LinkPlugin/LinkPlugin.js +47 -68
- package/dist/components/RteEditor/Plugins/LinkPlugin/LinkPlugin.js.map +1 -1
- package/dist/components/RteEditor/Plugins/LinkPlugin/helpers.js +1 -1
- package/dist/components/RteEditor/Plugins/ListPlugin/ListPlugin.js +3 -3
- package/dist/components/RteEditor/Plugins/ListPlugin/index.js +1 -1
- package/dist/components/RteEditor/Plugins/TablePlugin/AddTableFrom.d.ts +10 -0
- package/dist/components/RteEditor/Plugins/TablePlugin/AddTableFrom.js +25 -0
- package/dist/components/RteEditor/Plugins/TablePlugin/AddTableFrom.js.map +1 -0
- package/dist/components/RteEditor/Plugins/TablePlugin/TablePlugin.d.ts +1 -0
- package/dist/components/RteEditor/Plugins/TablePlugin/TablePlugin.js +29 -0
- package/dist/components/RteEditor/Plugins/TablePlugin/TablePlugin.js.map +1 -0
- package/dist/components/RteEditor/Plugins/TablePlugin/index.d.ts +1 -0
- package/dist/components/RteEditor/Plugins/TablePlugin/index.js +5 -0
- package/dist/components/RteEditor/Plugins/TablePlugin/index.js.map +1 -0
- package/dist/components/RteEditor/Plugins/ToolbarPlugin/ToolbarPlugin.js +26 -24
- package/dist/components/RteEditor/Plugins/ToolbarPlugin/ToolbarPlugin.js.map +1 -1
- package/dist/components/RteEditor/Plugins/index.d.ts +1 -0
- package/dist/components/RteEditor/Plugins/index.js +6 -4
- package/dist/components/RteEditor/Plugins/index.js.map +1 -1
- package/dist/components/RteEditor/RteEditor.js +557 -774
- package/dist/components/RteEditor/RteEditor.js.map +1 -1
- package/dist/components/RteEditor/UvaTheme/UvaTheme.d.ts +1 -0
- package/dist/components/RteEditor/UvaTheme/UvaTheme.js +5 -4
- package/dist/components/RteEditor/UvaTheme/UvaTheme.js.map +1 -1
- package/dist/components/RteEditor/hooks/useFlyout.d.ts +1 -0
- package/dist/components/RteEditor/hooks/useFlyout.js +18 -38
- package/dist/components/RteEditor/hooks/useFlyout.js.map +1 -1
- package/dist/components/hooks/useOnClickOuside.d.ts +4 -0
- package/dist/components/hooks/useOnClickOuside.js +15 -0
- package/dist/components/hooks/useOnClickOuside.js.map +1 -0
- package/dist/components/index.d.ts +1 -0
- package/dist/components/index.js +40 -38
- package/dist/components/index.js.map +1 -1
- package/dist/{helpers-TSjo3aAv.js → helpers-CJF7fErD.js} +3 -3
- package/dist/{helpers-TSjo3aAv.js.map → helpers-CJF7fErD.js.map} +1 -1
- package/dist/index.js +40 -38
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
- package/dist/Lexical.prod-DNRTKPfN.js.map +0 -1
- package/dist/LexicalUtils.prod-D_BPEjfg.js +0 -64
- package/dist/MultiSelect-DQaqItEH.js +0 -55
- package/dist/MultiSelect-DQaqItEH.js.map +0 -1
- package/dist/RteEditor.module-BjGyWKhW.js +0 -26
- package/dist/RteEditor.module-BjGyWKhW.js.map +0 -1
|
@@ -1,13 +1,15 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import {
|
|
3
|
-
import * as
|
|
4
|
-
import { useMemo as
|
|
5
|
-
import {
|
|
6
|
-
import { r as
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
1
|
+
import { jsx as w, jsxs as te, Fragment as Me } from "react/jsx-runtime";
|
|
2
|
+
import { ah as qe, w as F, P as ue, I as h, ai as Je, aj as We, u as D, i as U, y as j, F as He, l as L, m as v, ak as Te, al as Xe, am as m, a4 as Ze, e as I, M as Ye, an as Ge, ao as Qe, ap as et, N as ne, aq as tt, ar as nt, ad as rt, ae as ot, aa as it, W as st, as as at, at as me, c as pe, a3 as lt, a1 as re, a2 as ct, j as Fe, au as ge, V as ut, U as dt, O as ft, X as he, R as mt, av as pt, aw as gt, ax as ht, s as vt, a5 as yt, d as Ct, ay as wt, a6 as Et, a0 as bt, Z as $t, az as St, t as xt, L as ve, aA as _t, x as kt, K as J, $ as W, aB as Nt, aC as Lt, g as Dt, h as Rt, ac as Pt } from "../../Lexical.prod-BiuZHlIm.js";
|
|
3
|
+
import * as oe from "react";
|
|
4
|
+
import { useMemo as V, useLayoutEffect as O, useEffect as x, useRef as It, useState as K, Suspense as Mt, forwardRef as Ke, useCallback as Tt } from "react";
|
|
5
|
+
import { L as T, i as M, e as Ft, t as de, r as Kt, u as Ot } from "../../LexicalUtils.prod-BZOm66mY.js";
|
|
6
|
+
import { r as ye } from "../../index-DsprzSCj.js";
|
|
7
|
+
import { a as Ce, P as we, L as Ee, $ as be, b as Q, Z as ee, i as Oe, K as zt, t as $e, o as Bt, h as At, g as Ut, F as jt, M as Vt, u as Se, n as qt, I as Jt, c as Wt, m as Ht } from "../../TablePlugin-CKJQiwra.js";
|
|
8
|
+
import { J as ze, D as Be, Z as Xt } from "../../ListPlugin-DFFbKLaN.js";
|
|
9
|
+
import { a as Ae, U as xe, m as ie, g as Zt, b as Yt, F as Gt, M as Qt, f as en } from "../../helpers-CJF7fErD.js";
|
|
10
|
+
import { s as A } from "../../RteEditor.module-BBbfV1rk.js";
|
|
11
|
+
import { ToolBarPlugin as tn } from "./Plugins/ToolbarPlugin/ToolbarPlugin.js";
|
|
12
|
+
import "../../AddTableFrom-CwnPli3F.js";
|
|
11
13
|
import "../Buttons/Button.js";
|
|
12
14
|
import "../Buttons/LinkButton.js";
|
|
13
15
|
import "@react-aria/button";
|
|
@@ -20,179 +22,129 @@ import "../IconButton/IconButton.js";
|
|
|
20
22
|
import "../Input/Input.js";
|
|
21
23
|
import "../InputField/InputField.js";
|
|
22
24
|
import "react-router-dom";
|
|
23
|
-
import "../../MultiSelect-DQaqItEH.js";
|
|
24
25
|
import "../SelectListbox/SelectListbox.js";
|
|
25
26
|
import "../SelectListbox/SelectProvider.js";
|
|
26
27
|
import "../Sortable/components/SortableItem.js";
|
|
27
28
|
import "../../SortableProvider-Z0e0qeQT.js";
|
|
28
|
-
import { UvaTheme as
|
|
29
|
-
const
|
|
30
|
-
function
|
|
31
|
-
const n =
|
|
32
|
-
const { theme: r, namespace:
|
|
29
|
+
import { UvaTheme as nn } from "./UvaTheme/UvaTheme.js";
|
|
30
|
+
const Ue = typeof window < "u" && window.document !== void 0 && window.document.createElement !== void 0, rn = Ue ? O : x, H = { tag: "history-merge" };
|
|
31
|
+
function on({ initialConfig: t, children: e }) {
|
|
32
|
+
const n = V(() => {
|
|
33
|
+
const { theme: r, namespace: i, nodes: o, onError: s, editorState: l, html: a } = t, c = We(null, r), u = qe({ editable: t.editable, html: a, namespace: i, nodes: o, onError: (d) => s(d, u), theme: r });
|
|
33
34
|
return function(d, f) {
|
|
34
35
|
if (f !== null) {
|
|
35
36
|
if (f === void 0) d.update(() => {
|
|
36
|
-
const p =
|
|
37
|
+
const p = F();
|
|
37
38
|
if (p.isEmpty()) {
|
|
38
|
-
const
|
|
39
|
-
p.append(
|
|
40
|
-
const
|
|
41
|
-
(
|
|
39
|
+
const g = ue();
|
|
40
|
+
p.append(g);
|
|
41
|
+
const y = Ue ? document.activeElement : null;
|
|
42
|
+
(h() !== null || y !== null && y === d.getRootElement()) && g.select();
|
|
42
43
|
}
|
|
43
|
-
},
|
|
44
|
+
}, H);
|
|
44
45
|
else if (f !== null) switch (typeof f) {
|
|
45
46
|
case "string": {
|
|
46
47
|
const p = d.parseEditorState(f);
|
|
47
|
-
d.setEditorState(p,
|
|
48
|
+
d.setEditorState(p, H);
|
|
48
49
|
break;
|
|
49
50
|
}
|
|
50
51
|
case "object":
|
|
51
|
-
d.setEditorState(f,
|
|
52
|
+
d.setEditorState(f, H);
|
|
52
53
|
break;
|
|
53
54
|
case "function":
|
|
54
55
|
d.update(() => {
|
|
55
|
-
|
|
56
|
-
},
|
|
56
|
+
F().isEmpty() && f(d);
|
|
57
|
+
}, H);
|
|
57
58
|
}
|
|
58
59
|
}
|
|
59
|
-
}(u,
|
|
60
|
+
}(u, l), [u, c];
|
|
60
61
|
}, []);
|
|
61
|
-
return
|
|
62
|
-
const r = t.editable, [
|
|
63
|
-
|
|
64
|
-
}, []),
|
|
62
|
+
return rn(() => {
|
|
63
|
+
const r = t.editable, [i] = n;
|
|
64
|
+
i.setEditable(r === void 0 || r);
|
|
65
|
+
}, []), w(Je.Provider, { value: n, children: e });
|
|
65
66
|
}
|
|
66
|
-
const
|
|
67
|
-
function
|
|
67
|
+
const sn = typeof window < "u" && window.document !== void 0 && window.document.createElement !== void 0 ? O : x;
|
|
68
|
+
function an(t) {
|
|
68
69
|
return { initialValueFn: () => t.isEditable(), subscribe: (e) => t.registerEditableListener(e) };
|
|
69
70
|
}
|
|
70
|
-
function
|
|
71
|
+
function ln() {
|
|
71
72
|
return function(t) {
|
|
72
|
-
const [e] =
|
|
73
|
-
return
|
|
74
|
-
const { initialValueFn:
|
|
75
|
-
return r.current !==
|
|
76
|
-
r.current = c,
|
|
73
|
+
const [e] = D(), n = V(() => t(e), [e, t]), r = It(n.initialValueFn()), [i, o] = K(r.current);
|
|
74
|
+
return sn(() => {
|
|
75
|
+
const { initialValueFn: s, subscribe: l } = n, a = s();
|
|
76
|
+
return r.current !== a && (r.current = a, o(a)), l((c) => {
|
|
77
|
+
r.current = c, o(c);
|
|
77
78
|
});
|
|
78
|
-
}, [n, t]),
|
|
79
|
-
}(
|
|
79
|
+
}, [n, t]), i;
|
|
80
|
+
}(an);
|
|
80
81
|
}
|
|
81
|
-
function
|
|
82
|
-
return
|
|
82
|
+
function cn() {
|
|
83
|
+
return F().getTextContent();
|
|
83
84
|
}
|
|
84
|
-
function
|
|
85
|
+
function un(t, e = !0) {
|
|
85
86
|
if (t) return !1;
|
|
86
|
-
let n =
|
|
87
|
+
let n = cn();
|
|
87
88
|
return e && (n = n.trim()), n === "";
|
|
88
89
|
}
|
|
89
|
-
function
|
|
90
|
-
if (!
|
|
91
|
-
const e =
|
|
90
|
+
function dn(t) {
|
|
91
|
+
if (!un(t, !1)) return !1;
|
|
92
|
+
const e = F().getChildren(), n = e.length;
|
|
92
93
|
if (n > 1) return !1;
|
|
93
94
|
for (let r = 0; r < n; r++) {
|
|
94
|
-
const
|
|
95
|
-
if (
|
|
96
|
-
if (
|
|
97
|
-
if (!
|
|
98
|
-
const
|
|
99
|
-
for (let
|
|
100
|
-
const
|
|
101
|
-
if (!
|
|
95
|
+
const i = e[r];
|
|
96
|
+
if (U(i)) return !1;
|
|
97
|
+
if (j(i)) {
|
|
98
|
+
if (!He(i) || i.__indent !== 0) return !1;
|
|
99
|
+
const o = i.getChildren(), s = o.length;
|
|
100
|
+
for (let l = 0; l < s; l++) {
|
|
101
|
+
const a = o[r];
|
|
102
|
+
if (!L(a)) return !1;
|
|
102
103
|
}
|
|
103
104
|
}
|
|
104
105
|
}
|
|
105
106
|
return !0;
|
|
106
107
|
}
|
|
107
|
-
function
|
|
108
|
-
return () =>
|
|
108
|
+
function je(t) {
|
|
109
|
+
return () => dn(t);
|
|
109
110
|
}
|
|
110
|
-
function
|
|
111
|
+
function fn(t) {
|
|
111
112
|
return t && t.__esModule && Object.prototype.hasOwnProperty.call(t, "default") ? t.default : t;
|
|
112
113
|
}
|
|
113
|
-
|
|
114
|
+
fn(function(t) {
|
|
114
115
|
const e = new URLSearchParams();
|
|
115
116
|
e.append("code", t);
|
|
116
117
|
for (let n = 1; n < arguments.length; n++) e.append("v", arguments[n]);
|
|
117
118
|
throw Error(`Minified Lexical error #${t}; 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.`);
|
|
118
119
|
});
|
|
119
|
-
function
|
|
120
|
-
return t && t.__esModule && Object.prototype.hasOwnProperty.call(t, "default") ? t.default : t;
|
|
121
|
-
}
|
|
122
|
-
En(function(t) {
|
|
123
|
-
const e = new URLSearchParams();
|
|
124
|
-
e.append("code", t);
|
|
125
|
-
for (let n = 1; n < arguments.length; n++) e.append("v", arguments[n]);
|
|
126
|
-
throw Error(`Minified Lexical error #${t}; 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.`);
|
|
127
|
-
});
|
|
128
|
-
const bn = /* @__PURE__ */ new Map();
|
|
129
|
-
function xn(t) {
|
|
130
|
-
const e = {}, n = t.split(";");
|
|
131
|
-
for (const r of n) if (r !== "") {
|
|
132
|
-
const [s, i] = r.split(/:([^]+)/);
|
|
133
|
-
s && i && (e[s.trim()] = i.trim());
|
|
134
|
-
}
|
|
135
|
-
return e;
|
|
136
|
-
}
|
|
137
|
-
function Ze(t, e) {
|
|
138
|
-
const n = t.getStartEndPoints();
|
|
139
|
-
if (e.isSelected(t) && !e.isSegmented() && !e.isToken() && n !== null) {
|
|
140
|
-
const [r, s] = n, i = t.isBackward(), o = r.getNode(), a = s.getNode(), l = e.is(o), c = e.is(a);
|
|
141
|
-
if (l || c) {
|
|
142
|
-
const [u, d] = ut(t), f = o.is(a), p = e.is(i ? a : o), m = e.is(i ? o : a);
|
|
143
|
-
let v, b = 0;
|
|
144
|
-
return f ? (b = u > d ? d : u, v = u > d ? u : d) : p ? (b = i ? d : u, v = void 0) : m && (b = 0, v = i ? u : d), e.__text = e.__text.slice(b, v), e;
|
|
145
|
-
}
|
|
146
|
-
}
|
|
147
|
-
return e;
|
|
148
|
-
}
|
|
149
|
-
function $n(t) {
|
|
150
|
-
const e = t.getStyle(), n = xn(e);
|
|
151
|
-
bn.set(e, n);
|
|
152
|
-
}
|
|
153
|
-
function $e(t, e) {
|
|
154
|
-
const n = ie(t.focus, e);
|
|
155
|
-
return I(n) && !n.isIsolated() || _(n) && !n.isInline() && !n.canBeEmpty();
|
|
156
|
-
}
|
|
157
|
-
function Sn(t, e, n, r) {
|
|
158
|
-
t.modify(e ? "extend" : "move", n, r);
|
|
159
|
-
}
|
|
160
|
-
function _n(t) {
|
|
161
|
-
const e = t.anchor.getNode();
|
|
162
|
-
return (fe(e) ? e : e.getParentOrThrow()).getDirection() === "rtl";
|
|
163
|
-
}
|
|
164
|
-
function Se(t, e, n) {
|
|
165
|
-
const r = _n(t);
|
|
166
|
-
Sn(t, e, n ? !r : r, "character");
|
|
167
|
-
}
|
|
168
|
-
function Nn(t) {
|
|
120
|
+
function mn(t) {
|
|
169
121
|
const e = window.location.origin, n = (r) => {
|
|
170
122
|
if (r.origin !== e) return;
|
|
171
|
-
const
|
|
172
|
-
if (document.activeElement !==
|
|
173
|
-
const
|
|
174
|
-
if (typeof
|
|
175
|
-
let
|
|
123
|
+
const i = t.getRootElement();
|
|
124
|
+
if (document.activeElement !== i) return;
|
|
125
|
+
const o = r.data;
|
|
126
|
+
if (typeof o == "string") {
|
|
127
|
+
let s;
|
|
176
128
|
try {
|
|
177
|
-
|
|
129
|
+
s = JSON.parse(o);
|
|
178
130
|
} catch {
|
|
179
131
|
return;
|
|
180
132
|
}
|
|
181
|
-
if (
|
|
182
|
-
const
|
|
183
|
-
if (
|
|
184
|
-
const
|
|
185
|
-
if (
|
|
186
|
-
const [c, u, d, f, p,
|
|
133
|
+
if (s && s.protocol === "nuanria_messaging" && s.type === "request") {
|
|
134
|
+
const l = s.payload;
|
|
135
|
+
if (l && l.functionId === "makeChanges") {
|
|
136
|
+
const a = l.args;
|
|
137
|
+
if (a) {
|
|
138
|
+
const [c, u, d, f, p, g] = a;
|
|
187
139
|
t.update(() => {
|
|
188
|
-
const
|
|
189
|
-
if (
|
|
190
|
-
const
|
|
191
|
-
let
|
|
192
|
-
if (
|
|
193
|
-
|
|
194
|
-
const
|
|
195
|
-
|
|
140
|
+
const y = h();
|
|
141
|
+
if (v(y)) {
|
|
142
|
+
const $ = y.anchor;
|
|
143
|
+
let C = $.getNode(), E = 0, b = 0;
|
|
144
|
+
if (L(C) && c >= 0 && u >= 0 && (E = c, b = c + u, y.setTextNodeRange(C, E, C, b)), E === b && d === "" || (y.insertRawText(d), C = $.getNode()), L(C)) {
|
|
145
|
+
E = f, b = f + p;
|
|
146
|
+
const _ = C.getTextContentSize();
|
|
147
|
+
E = E > _ ? _ : E, b = b > _ ? _ : b, y.setTextNodeRange(C, E, C, b);
|
|
196
148
|
}
|
|
197
149
|
r.stopImmediatePropagation();
|
|
198
150
|
}
|
|
@@ -206,253 +158,7 @@ function Nn(t) {
|
|
|
206
158
|
window.removeEventListener("message", n, !0);
|
|
207
159
|
};
|
|
208
160
|
}
|
|
209
|
-
function
|
|
210
|
-
const n = e.body ? e.body.childNodes : [];
|
|
211
|
-
let r = [];
|
|
212
|
-
const s = [];
|
|
213
|
-
for (let i = 0; i < n.length; i++) {
|
|
214
|
-
const o = n[i];
|
|
215
|
-
if (!tt.has(o.nodeName)) {
|
|
216
|
-
const a = nt(o, t, s, !1);
|
|
217
|
-
a !== null && (r = r.concat(a));
|
|
218
|
-
}
|
|
219
|
-
}
|
|
220
|
-
return function(i) {
|
|
221
|
-
for (const o of i) o.getNextSibling() instanceof Ke && o.insertAfter(ze());
|
|
222
|
-
for (const o of i) {
|
|
223
|
-
const a = o.getChildren();
|
|
224
|
-
for (const l of a) o.insertBefore(l);
|
|
225
|
-
o.remove();
|
|
226
|
-
}
|
|
227
|
-
}(s), r;
|
|
228
|
-
}
|
|
229
|
-
function Qe(t, e) {
|
|
230
|
-
if (typeof document > "u" || typeof window > "u" && global.window === void 0) throw new Error("To use $generateHtmlFromNodes in headless mode please initialize a headless browser implementation such as JSDom before calling this function.");
|
|
231
|
-
const n = document.createElement("div"), r = O().getChildren();
|
|
232
|
-
for (let s = 0; s < r.length; s++)
|
|
233
|
-
et(t, r[s], n, e);
|
|
234
|
-
return n.innerHTML;
|
|
235
|
-
}
|
|
236
|
-
function et(t, e, n, r = null) {
|
|
237
|
-
let s = r === null || e.isSelected(r);
|
|
238
|
-
const i = _(e) && e.excludeFromCopy("html");
|
|
239
|
-
let o = e;
|
|
240
|
-
if (r !== null) {
|
|
241
|
-
let p = Ue(e);
|
|
242
|
-
p = N(p) && r !== null ? Ze(r, p) : p, o = p;
|
|
243
|
-
}
|
|
244
|
-
const a = _(o) ? o.getChildren() : [], l = t._nodes.get(o.getType());
|
|
245
|
-
let c;
|
|
246
|
-
c = l && l.exportDOM !== void 0 ? l.exportDOM(t, o) : o.exportDOM(t);
|
|
247
|
-
const { element: u, after: d } = c;
|
|
248
|
-
if (!u) return !1;
|
|
249
|
-
const f = document.createDocumentFragment();
|
|
250
|
-
for (let p = 0; p < a.length; p++) {
|
|
251
|
-
const m = a[p], v = et(t, m, f, r);
|
|
252
|
-
!s && _(e) && v && e.extractWithChild(m, r, "html") && (s = !0);
|
|
253
|
-
}
|
|
254
|
-
if (s && !i) {
|
|
255
|
-
if ((dt(u) || ge(u)) && u.append(f), n.append(u), d) {
|
|
256
|
-
const p = d.call(o, u);
|
|
257
|
-
p && (ge(u) ? u.replaceChildren(p) : u.replaceWith(p));
|
|
258
|
-
}
|
|
259
|
-
} else n.append(f);
|
|
260
|
-
return s;
|
|
261
|
-
}
|
|
262
|
-
const tt = /* @__PURE__ */ new Set(["STYLE", "SCRIPT"]);
|
|
263
|
-
function nt(t, e, n, r, s = /* @__PURE__ */ new Map(), i) {
|
|
264
|
-
let o = [];
|
|
265
|
-
if (tt.has(t.nodeName)) return o;
|
|
266
|
-
let a = null;
|
|
267
|
-
const l = function(m, v) {
|
|
268
|
-
const { nodeName: b } = m, w = v._htmlConversions.get(b.toLowerCase());
|
|
269
|
-
let C = null;
|
|
270
|
-
if (w !== void 0) for (const x of w) {
|
|
271
|
-
const $ = x(m);
|
|
272
|
-
$ !== null && (C === null || (C.priority || 0) < ($.priority || 0)) && (C = $);
|
|
273
|
-
}
|
|
274
|
-
return C !== null ? C.conversion : null;
|
|
275
|
-
}(t, e), c = l ? l(t) : null;
|
|
276
|
-
let u = null;
|
|
277
|
-
if (c !== null) {
|
|
278
|
-
u = c.after;
|
|
279
|
-
const m = c.node;
|
|
280
|
-
if (a = Array.isArray(m) ? m[m.length - 1] : m, a !== null) {
|
|
281
|
-
for (const [, v] of s) if (a = v(a, i), !a) break;
|
|
282
|
-
a && o.push(...Array.isArray(m) ? m : [a]);
|
|
283
|
-
}
|
|
284
|
-
c.forChild != null && s.set(t.nodeName, c.forChild);
|
|
285
|
-
}
|
|
286
|
-
const d = t.childNodes;
|
|
287
|
-
let f = [];
|
|
288
|
-
const p = (a == null || !ft(a)) && (a != null && se(a) || r);
|
|
289
|
-
for (let m = 0; m < d.length; m++) f.push(...nt(d[m], e, n, p, new Map(s), a));
|
|
290
|
-
return u != null && (f = u(f)), he(t) && (f = Dn(t, f, p ? () => {
|
|
291
|
-
const m = new Ke();
|
|
292
|
-
return n.push(m), m;
|
|
293
|
-
} : de)), a == null ? f.length > 0 ? o = o.concat(f) : he(t) && function(m) {
|
|
294
|
-
return m.nextSibling == null || m.previousSibling == null ? !1 : ve(m.nextSibling) && ve(m.previousSibling);
|
|
295
|
-
}(t) && (o = o.concat(ze())) : _(a) && a.append(...f), o;
|
|
296
|
-
}
|
|
297
|
-
function Dn(t, e, n) {
|
|
298
|
-
const r = t.style.textAlign, s = [];
|
|
299
|
-
let i = [];
|
|
300
|
-
for (let o = 0; o < e.length; o++) {
|
|
301
|
-
const a = e[o];
|
|
302
|
-
if (se(a)) r && !a.getFormat() && a.setFormat(r), s.push(a);
|
|
303
|
-
else if (i.push(a), o === e.length - 1 || o < e.length - 1 && se(e[o + 1])) {
|
|
304
|
-
const l = n();
|
|
305
|
-
l.setFormat(r), l.append(...i), s.push(l), i = [];
|
|
306
|
-
}
|
|
307
|
-
}
|
|
308
|
-
return s;
|
|
309
|
-
}
|
|
310
|
-
function kn(t) {
|
|
311
|
-
return t && t.__esModule && Object.prototype.hasOwnProperty.call(t, "default") ? t.default : t;
|
|
312
|
-
}
|
|
313
|
-
var te = kn(function(t) {
|
|
314
|
-
const e = new URLSearchParams();
|
|
315
|
-
e.append("code", t);
|
|
316
|
-
for (let n = 1; n < arguments.length; n++) e.append("v", arguments[n]);
|
|
317
|
-
throw Error(`Minified Lexical error #${t}; 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.`);
|
|
318
|
-
});
|
|
319
|
-
const Ln = typeof window < "u" && window.document !== void 0 && window.document.createElement !== void 0, rt = (t) => Ln ? (t || window).getSelection() : null;
|
|
320
|
-
function Tn(t, e = g()) {
|
|
321
|
-
return e == null && te(166), h(e) && e.isCollapsed() || e.getNodes().length === 0 ? "" : Qe(t, e);
|
|
322
|
-
}
|
|
323
|
-
function Pn(t, e = g()) {
|
|
324
|
-
return e == null && te(166), h(e) && e.isCollapsed() || e.getNodes().length === 0 ? null : JSON.stringify(Rn(t, e));
|
|
325
|
-
}
|
|
326
|
-
function _e(t, e, n) {
|
|
327
|
-
const r = t.getData("application/x-lexical-editor");
|
|
328
|
-
if (r) try {
|
|
329
|
-
const o = JSON.parse(r);
|
|
330
|
-
if (o.namespace === n._config.namespace && Array.isArray(o.nodes))
|
|
331
|
-
return Ne(n, On(o.nodes), e);
|
|
332
|
-
} catch {
|
|
333
|
-
}
|
|
334
|
-
const s = t.getData("text/html");
|
|
335
|
-
if (s) try {
|
|
336
|
-
const o = new DOMParser().parseFromString(s, "text/html");
|
|
337
|
-
return Ne(n, Ge(n, o), e);
|
|
338
|
-
} catch {
|
|
339
|
-
}
|
|
340
|
-
const i = t.getData("text/plain") || t.getData("text/uri-list");
|
|
341
|
-
if (i != null) if (h(e)) {
|
|
342
|
-
const o = i.split(/(\r?\n|\t)/);
|
|
343
|
-
o[o.length - 1] === "" && o.pop();
|
|
344
|
-
for (let a = 0; a < o.length; a++) {
|
|
345
|
-
const l = g();
|
|
346
|
-
if (h(l)) {
|
|
347
|
-
const c = o[a];
|
|
348
|
-
c === `
|
|
349
|
-
` || c === `\r
|
|
350
|
-
` ? l.insertParagraph() : c === " " ? l.insertNodes([Be()]) : l.insertText(c);
|
|
351
|
-
}
|
|
352
|
-
}
|
|
353
|
-
} else e.insertRawText(i);
|
|
354
|
-
}
|
|
355
|
-
function Ne(t, e, n) {
|
|
356
|
-
t.dispatchCommand(mt, { nodes: e, selection: n }) || n.insertNodes(e);
|
|
357
|
-
}
|
|
358
|
-
function ot(t, e, n, r = []) {
|
|
359
|
-
let s = e === null || n.isSelected(e);
|
|
360
|
-
const i = _(n) && n.excludeFromCopy("html");
|
|
361
|
-
let o = n;
|
|
362
|
-
if (e !== null) {
|
|
363
|
-
let c = Ue(n);
|
|
364
|
-
c = N(c) && e !== null ? Ze(e, c) : c, o = c;
|
|
365
|
-
}
|
|
366
|
-
const a = _(o) ? o.getChildren() : [], l = function(c) {
|
|
367
|
-
const u = c.exportJSON(), d = c.constructor;
|
|
368
|
-
if (u.type !== d.getType() && te(58, d.name), _(c)) {
|
|
369
|
-
const f = u.children;
|
|
370
|
-
Array.isArray(f) || te(59, d.name);
|
|
371
|
-
}
|
|
372
|
-
return u;
|
|
373
|
-
}(o);
|
|
374
|
-
if (N(o)) {
|
|
375
|
-
const c = o.__text;
|
|
376
|
-
c.length > 0 ? l.text = c : s = !1;
|
|
377
|
-
}
|
|
378
|
-
for (let c = 0; c < a.length; c++) {
|
|
379
|
-
const u = a[c], d = ot(t, e, u, l.children);
|
|
380
|
-
!s && _(n) && d && n.extractWithChild(u, e, "clone") && (s = !0);
|
|
381
|
-
}
|
|
382
|
-
if (s && !i) r.push(l);
|
|
383
|
-
else if (Array.isArray(l.children)) for (let c = 0; c < l.children.length; c++) {
|
|
384
|
-
const u = l.children[c];
|
|
385
|
-
r.push(u);
|
|
386
|
-
}
|
|
387
|
-
return s;
|
|
388
|
-
}
|
|
389
|
-
function Rn(t, e) {
|
|
390
|
-
const n = [], r = O().getChildren();
|
|
391
|
-
for (let s = 0; s < r.length; s++)
|
|
392
|
-
ot(t, e, r[s], n);
|
|
393
|
-
return { namespace: t._config.namespace, nodes: n };
|
|
394
|
-
}
|
|
395
|
-
function On(t) {
|
|
396
|
-
const e = [];
|
|
397
|
-
for (let n = 0; n < t.length; n++) {
|
|
398
|
-
const r = t[n], s = pt(r);
|
|
399
|
-
N(s) && $n(s), e.push(s);
|
|
400
|
-
}
|
|
401
|
-
return e;
|
|
402
|
-
}
|
|
403
|
-
let A = null;
|
|
404
|
-
async function De(t, e, n) {
|
|
405
|
-
if (A !== null) return !1;
|
|
406
|
-
if (e !== null) return new Promise((l, c) => {
|
|
407
|
-
t.update(() => {
|
|
408
|
-
l(ke(t, e, n));
|
|
409
|
-
});
|
|
410
|
-
});
|
|
411
|
-
const r = t.getRootElement(), s = t._window == null ? window.document : t._window.document, i = rt(t._window);
|
|
412
|
-
if (r === null || i === null) return !1;
|
|
413
|
-
const o = s.createElement("span");
|
|
414
|
-
o.style.cssText = "position: fixed; top: -1000px;", o.append(s.createTextNode("#")), r.append(o);
|
|
415
|
-
const a = new Range();
|
|
416
|
-
return a.setStart(o, 0), a.setEnd(o, 1), i.removeAllRanges(), i.addRange(a), new Promise((l, c) => {
|
|
417
|
-
const u = t.registerCommand(je, (d) => (R(d, ClipboardEvent) && (u(), A !== null && (window.clearTimeout(A), A = null), l(ke(t, d, n))), !0), gt);
|
|
418
|
-
A = window.setTimeout(() => {
|
|
419
|
-
u(), A = null, l(!1);
|
|
420
|
-
}, 50), s.execCommand("copy"), o.remove();
|
|
421
|
-
});
|
|
422
|
-
}
|
|
423
|
-
function ke(t, e, n) {
|
|
424
|
-
if (n === void 0) {
|
|
425
|
-
const s = rt(t._window);
|
|
426
|
-
if (!s) return !1;
|
|
427
|
-
const i = s.anchorNode, o = s.focusNode;
|
|
428
|
-
if (i !== null && o !== null && !ht(t, i, o)) return !1;
|
|
429
|
-
const a = g();
|
|
430
|
-
if (a === null) return !1;
|
|
431
|
-
n = Fn(a);
|
|
432
|
-
}
|
|
433
|
-
e.preventDefault();
|
|
434
|
-
const r = e.clipboardData;
|
|
435
|
-
return r !== null && (An(r, n), !0);
|
|
436
|
-
}
|
|
437
|
-
const Mn = [["text/html", Tn], ["application/x-lexical-editor", Pn]];
|
|
438
|
-
function Fn(t = g()) {
|
|
439
|
-
const e = { "text/plain": t ? t.getTextContent() : "" };
|
|
440
|
-
if (t) {
|
|
441
|
-
const n = vt();
|
|
442
|
-
for (const [r, s] of Mn) {
|
|
443
|
-
const i = s(n, t);
|
|
444
|
-
i !== null && (e[r] = i);
|
|
445
|
-
}
|
|
446
|
-
}
|
|
447
|
-
return e;
|
|
448
|
-
}
|
|
449
|
-
function An(t, e) {
|
|
450
|
-
for (const n in e) {
|
|
451
|
-
const r = e[n];
|
|
452
|
-
r !== void 0 && t.setData(n, r);
|
|
453
|
-
}
|
|
454
|
-
}
|
|
455
|
-
function Le(t, e) {
|
|
161
|
+
function _e(t, e) {
|
|
456
162
|
if (document.caretRangeFromPoint !== void 0) {
|
|
457
163
|
const n = document.caretRangeFromPoint(t, e);
|
|
458
164
|
return n === null ? null : { node: n.startContainer, offset: n.startOffset };
|
|
@@ -463,553 +169,630 @@ function Le(t, e) {
|
|
|
463
169
|
}
|
|
464
170
|
return null;
|
|
465
171
|
}
|
|
466
|
-
const
|
|
467
|
-
function
|
|
172
|
+
const z = typeof window < "u" && window.document !== void 0 && window.document.createElement !== void 0, pn = z && "documentMode" in document ? document.documentMode : null, gn = !(!z || !("InputEvent" in window) || pn) && "getTargetRanges" in new window.InputEvent("input"), hn = z && /Version\/[\d.]+.*Safari/.test(navigator.userAgent), vn = z && /iPad|iPhone|iPod/.test(navigator.userAgent) && !window.MSStream, yn = z && /^(?=.*Chrome).*/i.test(navigator.userAgent), Cn = z && /AppleWebKit\/[\d.]+/.test(navigator.userAgent) && !yn, ke = xt();
|
|
173
|
+
function X(t) {
|
|
468
174
|
let e = null;
|
|
469
|
-
if (
|
|
470
|
-
const n = e.types, r = n.includes("Files"),
|
|
471
|
-
return [r, Array.from(e.files),
|
|
175
|
+
if (M(t, DragEvent) ? e = t.dataTransfer : M(t, ClipboardEvent) && (e = t.clipboardData), e === null) return [!1, [], !1];
|
|
176
|
+
const n = e.types, r = n.includes("Files"), i = n.includes("text/html") || n.includes("text/plain");
|
|
177
|
+
return [r, Array.from(e.files), i];
|
|
472
178
|
}
|
|
473
|
-
function
|
|
474
|
-
const e =
|
|
475
|
-
if (!
|
|
179
|
+
function Ne(t) {
|
|
180
|
+
const e = h();
|
|
181
|
+
if (!v(e)) return !1;
|
|
476
182
|
const n = /* @__PURE__ */ new Set(), r = e.getNodes();
|
|
477
|
-
for (let
|
|
478
|
-
const
|
|
479
|
-
if (n.has(
|
|
480
|
-
const
|
|
481
|
-
if (
|
|
482
|
-
const
|
|
483
|
-
|
|
183
|
+
for (let i = 0; i < r.length; i++) {
|
|
184
|
+
const o = r[i], s = o.getKey();
|
|
185
|
+
if (n.has(s)) continue;
|
|
186
|
+
const l = de(o, (c) => j(c) && !c.isInline());
|
|
187
|
+
if (l === null) continue;
|
|
188
|
+
const a = l.getKey();
|
|
189
|
+
l.canIndent() && !n.has(a) && (n.add(a), t(l));
|
|
484
190
|
}
|
|
485
191
|
return n.size > 0;
|
|
486
192
|
}
|
|
487
193
|
function Z(t) {
|
|
488
|
-
const e =
|
|
489
|
-
return
|
|
490
|
-
}
|
|
491
|
-
function
|
|
492
|
-
return
|
|
493
|
-
const n =
|
|
494
|
-
return !!
|
|
495
|
-
}, 0), t.registerCommand(
|
|
496
|
-
const n =
|
|
497
|
-
return !!
|
|
498
|
-
},
|
|
499
|
-
const n =
|
|
500
|
-
return !!
|
|
501
|
-
},
|
|
502
|
-
const n =
|
|
503
|
-
return !!
|
|
504
|
-
},
|
|
505
|
-
const n =
|
|
194
|
+
const e = ne(t);
|
|
195
|
+
return U(e);
|
|
196
|
+
}
|
|
197
|
+
function wn(t) {
|
|
198
|
+
return T(t.registerCommand(St, (e) => {
|
|
199
|
+
const n = h();
|
|
200
|
+
return !!I(n) && (n.clear(), !0);
|
|
201
|
+
}, 0), t.registerCommand(re, (e) => {
|
|
202
|
+
const n = h();
|
|
203
|
+
return !!v(n) && (n.deleteCharacter(e), !0);
|
|
204
|
+
}, m), t.registerCommand($t, (e) => {
|
|
205
|
+
const n = h();
|
|
206
|
+
return !!v(n) && (n.deleteWord(e), !0);
|
|
207
|
+
}, m), t.registerCommand(bt, (e) => {
|
|
208
|
+
const n = h();
|
|
209
|
+
return !!v(n) && (n.deleteLine(e), !0);
|
|
210
|
+
}, m), t.registerCommand(Et, (e) => {
|
|
211
|
+
const n = h();
|
|
506
212
|
if (typeof e == "string") n !== null && n.insertText(e);
|
|
507
213
|
else {
|
|
508
214
|
if (n === null) return !1;
|
|
509
215
|
const r = e.dataTransfer;
|
|
510
|
-
if (r != null)
|
|
511
|
-
else if (
|
|
512
|
-
const
|
|
513
|
-
return
|
|
216
|
+
if (r != null) Ce(r, n, t);
|
|
217
|
+
else if (v(n)) {
|
|
218
|
+
const i = e.data;
|
|
219
|
+
return i && n.insertText(i), !0;
|
|
514
220
|
}
|
|
515
221
|
}
|
|
516
222
|
return !0;
|
|
517
|
-
},
|
|
518
|
-
const e =
|
|
519
|
-
return !!
|
|
520
|
-
},
|
|
521
|
-
const n =
|
|
522
|
-
return !!
|
|
523
|
-
},
|
|
524
|
-
const n =
|
|
525
|
-
if (!
|
|
223
|
+
}, m), t.registerCommand(wt, () => {
|
|
224
|
+
const e = h();
|
|
225
|
+
return !!v(e) && (e.removeText(), !0);
|
|
226
|
+
}, m), t.registerCommand(Ct, (e) => {
|
|
227
|
+
const n = h();
|
|
228
|
+
return !!v(n) && (n.formatText(e), !0);
|
|
229
|
+
}, m), t.registerCommand(yt, (e) => {
|
|
230
|
+
const n = h();
|
|
231
|
+
if (!v(n) && !I(n)) return !1;
|
|
526
232
|
const r = n.getNodes();
|
|
527
|
-
for (const
|
|
528
|
-
const
|
|
529
|
-
|
|
233
|
+
for (const i of r) {
|
|
234
|
+
const o = de(i, (s) => j(s) && !s.isInline());
|
|
235
|
+
o !== null && o.setFormat(e);
|
|
530
236
|
}
|
|
531
237
|
return !0;
|
|
532
|
-
},
|
|
533
|
-
const n =
|
|
534
|
-
return !!
|
|
535
|
-
},
|
|
536
|
-
const e =
|
|
537
|
-
return !!
|
|
538
|
-
},
|
|
238
|
+
}, m), t.registerCommand(me, (e) => {
|
|
239
|
+
const n = h();
|
|
240
|
+
return !!v(n) && (n.insertLineBreak(e), !0);
|
|
241
|
+
}, m), t.registerCommand(pe, () => {
|
|
242
|
+
const e = h();
|
|
243
|
+
return !!v(e) && (e.insertParagraph(), !0);
|
|
244
|
+
}, m), t.registerCommand(gt, () => (ht([vt()]), !0), m), t.registerCommand(pt, () => Ne((e) => {
|
|
539
245
|
const n = e.getIndent();
|
|
540
246
|
e.setIndent(n + 1);
|
|
541
|
-
}),
|
|
247
|
+
}), m), t.registerCommand(ge, () => Ne((e) => {
|
|
542
248
|
const n = e.getIndent();
|
|
543
249
|
n > 0 && e.setIndent(n - 1);
|
|
544
|
-
}),
|
|
545
|
-
const n =
|
|
546
|
-
if (
|
|
250
|
+
}), m), t.registerCommand(mt, (e) => {
|
|
251
|
+
const n = h();
|
|
252
|
+
if (I(n) && !Z(e.target)) {
|
|
547
253
|
const r = n.getNodes();
|
|
548
254
|
if (r.length > 0) return r[0].selectPrevious(), !0;
|
|
549
|
-
} else if (
|
|
550
|
-
const r =
|
|
551
|
-
if (!e.shiftKey &&
|
|
255
|
+
} else if (v(n)) {
|
|
256
|
+
const r = he(n.focus, !0);
|
|
257
|
+
if (!e.shiftKey && U(r) && !r.isIsolated() && !r.isInline()) return r.selectPrevious(), e.preventDefault(), !0;
|
|
552
258
|
}
|
|
553
259
|
return !1;
|
|
554
|
-
},
|
|
555
|
-
const n =
|
|
556
|
-
if (
|
|
260
|
+
}, m), t.registerCommand(ft, (e) => {
|
|
261
|
+
const n = h();
|
|
262
|
+
if (I(n)) {
|
|
557
263
|
const r = n.getNodes();
|
|
558
264
|
if (r.length > 0) return r[0].selectNext(0, 0), !0;
|
|
559
|
-
} else if (
|
|
560
|
-
if (function(
|
|
561
|
-
const
|
|
562
|
-
return
|
|
265
|
+
} else if (v(n)) {
|
|
266
|
+
if (function(i) {
|
|
267
|
+
const o = i.focus;
|
|
268
|
+
return o.key === "root" && o.offset === F().getChildrenSize();
|
|
563
269
|
}(n)) return e.preventDefault(), !0;
|
|
564
|
-
const r =
|
|
565
|
-
if (!e.shiftKey &&
|
|
270
|
+
const r = he(n.focus, !1);
|
|
271
|
+
if (!e.shiftKey && U(r) && !r.isIsolated() && !r.isInline()) return r.selectNext(), e.preventDefault(), !0;
|
|
566
272
|
}
|
|
567
273
|
return !1;
|
|
568
|
-
},
|
|
569
|
-
const n =
|
|
570
|
-
if (
|
|
274
|
+
}, m), t.registerCommand(dt, (e) => {
|
|
275
|
+
const n = h();
|
|
276
|
+
if (I(n)) {
|
|
571
277
|
const r = n.getNodes();
|
|
572
278
|
if (r.length > 0) return e.preventDefault(), r[0].selectPrevious(), !0;
|
|
573
279
|
}
|
|
574
|
-
if (!
|
|
575
|
-
if (
|
|
280
|
+
if (!v(n)) return !1;
|
|
281
|
+
if (Ee(n, !0)) {
|
|
576
282
|
const r = e.shiftKey;
|
|
577
|
-
return e.preventDefault(),
|
|
283
|
+
return e.preventDefault(), be(n, r, !0), !0;
|
|
578
284
|
}
|
|
579
285
|
return !1;
|
|
580
|
-
},
|
|
581
|
-
const n =
|
|
582
|
-
if (
|
|
583
|
-
const
|
|
584
|
-
if (
|
|
286
|
+
}, m), t.registerCommand(ut, (e) => {
|
|
287
|
+
const n = h();
|
|
288
|
+
if (I(n) && !Z(e.target)) {
|
|
289
|
+
const i = n.getNodes();
|
|
290
|
+
if (i.length > 0) return e.preventDefault(), i[0].selectNext(0, 0), !0;
|
|
585
291
|
}
|
|
586
|
-
if (!
|
|
292
|
+
if (!v(n)) return !1;
|
|
587
293
|
const r = e.shiftKey;
|
|
588
|
-
return
|
|
589
|
-
},
|
|
294
|
+
return !!Ee(n, !1) && (e.preventDefault(), be(n, r, !1), !0);
|
|
295
|
+
}, m), t.registerCommand(ct, (e) => {
|
|
590
296
|
if (Z(e.target)) return !1;
|
|
591
|
-
const n =
|
|
592
|
-
if (!
|
|
297
|
+
const n = h();
|
|
298
|
+
if (!v(n)) return !1;
|
|
593
299
|
e.preventDefault();
|
|
594
|
-
const { anchor: r } = n,
|
|
595
|
-
return n.isCollapsed() && r.offset === 0 && !
|
|
596
|
-
},
|
|
300
|
+
const { anchor: r } = n, i = r.getNode();
|
|
301
|
+
return n.isCollapsed() && r.offset === 0 && !Fe(i) && Ft(i).getIndent() > 0 ? t.dispatchCommand(ge, void 0) : t.dispatchCommand(re, !0);
|
|
302
|
+
}, m), t.registerCommand(lt, (e) => {
|
|
597
303
|
if (Z(e.target)) return !1;
|
|
598
|
-
const n =
|
|
599
|
-
return !!
|
|
600
|
-
},
|
|
601
|
-
const n =
|
|
602
|
-
if (!
|
|
304
|
+
const n = h();
|
|
305
|
+
return !!v(n) && (e.preventDefault(), t.dispatchCommand(re, !1));
|
|
306
|
+
}, m), t.registerCommand(at, (e) => {
|
|
307
|
+
const n = h();
|
|
308
|
+
if (!v(n)) return !1;
|
|
603
309
|
if (e !== null) {
|
|
604
|
-
if ((
|
|
605
|
-
if (e.preventDefault(), e.shiftKey) return t.dispatchCommand(
|
|
310
|
+
if ((vn || hn || Cn) && gn) return !1;
|
|
311
|
+
if (e.preventDefault(), e.shiftKey) return t.dispatchCommand(me, !1);
|
|
606
312
|
}
|
|
607
|
-
return t.dispatchCommand(
|
|
608
|
-
},
|
|
609
|
-
const e =
|
|
610
|
-
return !!
|
|
611
|
-
},
|
|
612
|
-
const [, n] =
|
|
313
|
+
return t.dispatchCommand(pe, void 0);
|
|
314
|
+
}, m), t.registerCommand(st, () => {
|
|
315
|
+
const e = h();
|
|
316
|
+
return !!v(e) && (t.blur(), !0);
|
|
317
|
+
}, m), t.registerCommand(nt, (e) => {
|
|
318
|
+
const [, n] = X(e);
|
|
613
319
|
if (n.length > 0) {
|
|
614
|
-
const
|
|
615
|
-
if (
|
|
616
|
-
const { offset:
|
|
617
|
-
if (
|
|
618
|
-
const
|
|
619
|
-
if (
|
|
320
|
+
const i = _e(e.clientX, e.clientY);
|
|
321
|
+
if (i !== null) {
|
|
322
|
+
const { offset: o, node: s } = i, l = ne(s);
|
|
323
|
+
if (l !== null) {
|
|
324
|
+
const a = rt();
|
|
325
|
+
if (L(l)) a.anchor.set(l.getKey(), o, "text"), a.focus.set(l.getKey(), o, "text");
|
|
620
326
|
else {
|
|
621
|
-
const u =
|
|
622
|
-
|
|
327
|
+
const u = l.getParentOrThrow().getKey(), d = l.getIndexWithinParent() + 1;
|
|
328
|
+
a.anchor.set(u, d, "element"), a.focus.set(u, d, "element");
|
|
623
329
|
}
|
|
624
|
-
const c =
|
|
625
|
-
|
|
330
|
+
const c = ot(a);
|
|
331
|
+
it(c);
|
|
626
332
|
}
|
|
627
|
-
t.dispatchCommand(
|
|
333
|
+
t.dispatchCommand(ke, n);
|
|
628
334
|
}
|
|
629
335
|
return e.preventDefault(), !0;
|
|
630
336
|
}
|
|
631
|
-
const r =
|
|
632
|
-
return !!
|
|
633
|
-
},
|
|
634
|
-
const [n] =
|
|
635
|
-
return !(n && !
|
|
636
|
-
},
|
|
637
|
-
const [n] =
|
|
638
|
-
if (n && !
|
|
639
|
-
const
|
|
640
|
-
if (
|
|
641
|
-
const
|
|
642
|
-
|
|
337
|
+
const r = h();
|
|
338
|
+
return !!v(r);
|
|
339
|
+
}, m), t.registerCommand(tt, (e) => {
|
|
340
|
+
const [n] = X(e), r = h();
|
|
341
|
+
return !(n && !v(r));
|
|
342
|
+
}, m), t.registerCommand(et, (e) => {
|
|
343
|
+
const [n] = X(e), r = h();
|
|
344
|
+
if (n && !v(r)) return !1;
|
|
345
|
+
const i = _e(e.clientX, e.clientY);
|
|
346
|
+
if (i !== null) {
|
|
347
|
+
const o = ne(i.node);
|
|
348
|
+
U(o) && e.preventDefault();
|
|
643
349
|
}
|
|
644
350
|
return !0;
|
|
645
|
-
},
|
|
646
|
-
await
|
|
647
|
-
const
|
|
648
|
-
|
|
351
|
+
}, m), t.registerCommand(Ge, () => (Qe(), !0), m), t.registerCommand(Ye, (e) => (we(t, M(e, ClipboardEvent) ? e : null), !0), m), t.registerCommand(Ze, (e) => (async function(n, r) {
|
|
352
|
+
await we(r, M(n, ClipboardEvent) ? n : null), r.update(() => {
|
|
353
|
+
const i = h();
|
|
354
|
+
v(i) ? i.removeText() : I(i) && i.getNodes().forEach((o) => o.remove());
|
|
649
355
|
});
|
|
650
|
-
}(e, t), !0),
|
|
651
|
-
const [, n, r] =
|
|
652
|
-
return n.length > 0 && !r ? (t.dispatchCommand(
|
|
653
|
-
|
|
654
|
-
const
|
|
655
|
-
|
|
356
|
+
}(e, t), !0), m), t.registerCommand(Te, (e) => {
|
|
357
|
+
const [, n, r] = X(e);
|
|
358
|
+
return n.length > 0 && !r ? (t.dispatchCommand(ke, n), !0) : Xe(e.target) ? !1 : h() !== null && (function(i, o) {
|
|
359
|
+
i.preventDefault(), o.update(() => {
|
|
360
|
+
const s = h(), l = M(i, InputEvent) || M(i, KeyboardEvent) ? null : i.clipboardData;
|
|
361
|
+
l != null && s !== null && Ce(l, s, o);
|
|
656
362
|
}, { tag: "paste" });
|
|
657
363
|
}(e, t), !0);
|
|
658
|
-
},
|
|
659
|
-
}
|
|
660
|
-
const
|
|
661
|
-
function
|
|
662
|
-
return t.getEditorState().read(
|
|
663
|
-
}
|
|
664
|
-
function
|
|
665
|
-
const [r] =
|
|
666
|
-
const [
|
|
667
|
-
return
|
|
668
|
-
|
|
669
|
-
|
|
364
|
+
}, m));
|
|
365
|
+
}
|
|
366
|
+
const se = typeof window < "u" && window.document !== void 0 && window.document.createElement !== void 0 ? O : x;
|
|
367
|
+
function Le(t) {
|
|
368
|
+
return t.getEditorState().read(je(t.isComposing()));
|
|
369
|
+
}
|
|
370
|
+
function En({ contentEditable: t, placeholder: e = null, ErrorBoundary: n }) {
|
|
371
|
+
const [r] = D(), i = function(o, s) {
|
|
372
|
+
const [l, a] = K(() => o.getDecorators());
|
|
373
|
+
return se(() => o.registerDecoratorListener((c) => {
|
|
374
|
+
ye.flushSync(() => {
|
|
375
|
+
a(c);
|
|
670
376
|
});
|
|
671
|
-
}), [
|
|
672
|
-
|
|
673
|
-
}, [
|
|
674
|
-
const c = [], u = Object.keys(
|
|
377
|
+
}), [o]), x(() => {
|
|
378
|
+
a(o.getDecorators());
|
|
379
|
+
}, [o]), V(() => {
|
|
380
|
+
const c = [], u = Object.keys(l);
|
|
675
381
|
for (let d = 0; d < u.length; d++) {
|
|
676
|
-
const f = u[d], p =
|
|
677
|
-
|
|
382
|
+
const f = u[d], p = w(s, { onError: (y) => o._onError(y), children: w(Mt, { fallback: null, children: l[f] }) }), g = o.getElementByKey(f);
|
|
383
|
+
g !== null && c.push(ye.createPortal(p, g, f));
|
|
678
384
|
}
|
|
679
385
|
return c;
|
|
680
|
-
}, [
|
|
386
|
+
}, [s, l, o]);
|
|
681
387
|
}(r, n);
|
|
682
|
-
return function(
|
|
683
|
-
|
|
684
|
-
}(r),
|
|
685
|
-
}
|
|
686
|
-
function
|
|
687
|
-
const [e] =
|
|
688
|
-
const [
|
|
689
|
-
return
|
|
690
|
-
function
|
|
691
|
-
const
|
|
692
|
-
|
|
388
|
+
return function(o) {
|
|
389
|
+
se(() => T(wn(o), mn(o)), [o]);
|
|
390
|
+
}(r), te(Me, { children: [t, w(bn, { content: e }), i] });
|
|
391
|
+
}
|
|
392
|
+
function bn({ content: t }) {
|
|
393
|
+
const [e] = D(), n = function(i) {
|
|
394
|
+
const [o, s] = K(() => Le(i));
|
|
395
|
+
return se(() => {
|
|
396
|
+
function l() {
|
|
397
|
+
const a = Le(i);
|
|
398
|
+
s(a);
|
|
693
399
|
}
|
|
694
|
-
return
|
|
695
|
-
|
|
696
|
-
}),
|
|
697
|
-
|
|
400
|
+
return l(), T(i.registerUpdateListener(() => {
|
|
401
|
+
l();
|
|
402
|
+
}), i.registerEditableListener(() => {
|
|
403
|
+
l();
|
|
698
404
|
}));
|
|
699
|
-
}, [
|
|
700
|
-
}(e), r =
|
|
405
|
+
}, [i]), o;
|
|
406
|
+
}(e), r = ln();
|
|
701
407
|
return n ? typeof t == "function" ? t(r) : t : null;
|
|
702
408
|
}
|
|
703
|
-
const
|
|
704
|
-
function
|
|
705
|
-
const [S,
|
|
706
|
-
|
|
707
|
-
}, [t]),
|
|
708
|
-
return (
|
|
709
|
-
|
|
710
|
-
typeof
|
|
409
|
+
const Ve = typeof window < "u" && window.document !== void 0 && window.document.createElement !== void 0 ? O : x;
|
|
410
|
+
function $n({ editor: t, ariaActiveDescendant: e, ariaAutoComplete: n, ariaControls: r, ariaDescribedBy: i, ariaExpanded: o, ariaLabel: s, ariaLabelledBy: l, ariaMultiline: a, ariaOwns: c, ariaRequired: u, autoCapitalize: d, className: f, id: p, role: g = "textbox", spellCheck: y = !0, style: $, tabIndex: C, "data-testid": E, ...b }, _) {
|
|
411
|
+
const [S, N] = K(t.isEditable()), P = Tt((R) => {
|
|
412
|
+
R && R.ownerDocument && R.ownerDocument.defaultView ? t.setRootElement(R) : t.setRootElement(null);
|
|
413
|
+
}, [t]), B = V(() => /* @__PURE__ */ function(...R) {
|
|
414
|
+
return (fe) => {
|
|
415
|
+
R.forEach((q) => {
|
|
416
|
+
typeof q == "function" ? q(fe) : q != null && (q.current = fe);
|
|
711
417
|
});
|
|
712
418
|
};
|
|
713
|
-
}(
|
|
714
|
-
return
|
|
715
|
-
|
|
716
|
-
})), [t]),
|
|
717
|
-
}
|
|
718
|
-
const
|
|
719
|
-
function
|
|
720
|
-
return t.getEditorState().read(
|
|
721
|
-
}
|
|
722
|
-
const
|
|
723
|
-
function
|
|
724
|
-
const { placeholder: n, ...r } = t, [
|
|
725
|
-
return
|
|
726
|
-
}
|
|
727
|
-
function
|
|
728
|
-
const n = function(
|
|
729
|
-
const [
|
|
730
|
-
return
|
|
419
|
+
}(_, P), [P, _]);
|
|
420
|
+
return Ve(() => (N(t.isEditable()), t.registerEditableListener((R) => {
|
|
421
|
+
N(R);
|
|
422
|
+
})), [t]), w("div", { ...b, "aria-activedescendant": S ? e : void 0, "aria-autocomplete": S ? n : "none", "aria-controls": S ? r : void 0, "aria-describedby": i, "aria-expanded": S && g === "combobox" ? !!o : void 0, "aria-label": s, "aria-labelledby": l, "aria-multiline": a, "aria-owns": S ? c : void 0, "aria-readonly": !S || void 0, "aria-required": u, autoCapitalize: d, className: f, contentEditable: S, "data-testid": E, id: p, ref: B, role: S ? g : void 0, spellCheck: y, style: $, tabIndex: C });
|
|
423
|
+
}
|
|
424
|
+
const Sn = Ke($n);
|
|
425
|
+
function De(t) {
|
|
426
|
+
return t.getEditorState().read(je(t.isComposing()));
|
|
427
|
+
}
|
|
428
|
+
const xn = Ke(_n);
|
|
429
|
+
function _n(t, e) {
|
|
430
|
+
const { placeholder: n, ...r } = t, [i] = D();
|
|
431
|
+
return te(Me, { children: [w(Sn, { editor: i, ...r, ref: e }), n != null && w(kn, { editor: i, content: n })] });
|
|
432
|
+
}
|
|
433
|
+
function kn({ content: t, editor: e }) {
|
|
434
|
+
const n = function(s) {
|
|
435
|
+
const [l, a] = K(() => De(s));
|
|
436
|
+
return Ve(() => {
|
|
731
437
|
function c() {
|
|
732
|
-
const u =
|
|
733
|
-
|
|
438
|
+
const u = De(s);
|
|
439
|
+
a(u);
|
|
734
440
|
}
|
|
735
|
-
return c(),
|
|
441
|
+
return c(), T(s.registerUpdateListener(() => {
|
|
736
442
|
c();
|
|
737
|
-
}),
|
|
443
|
+
}), s.registerEditableListener(() => {
|
|
738
444
|
c();
|
|
739
445
|
}));
|
|
740
|
-
}, [
|
|
741
|
-
}(e), [r,
|
|
742
|
-
if (
|
|
743
|
-
s
|
|
446
|
+
}, [s]), l;
|
|
447
|
+
}(e), [r, i] = K(e.isEditable());
|
|
448
|
+
if (O(() => (i(e.isEditable()), e.registerEditableListener((s) => {
|
|
449
|
+
i(s);
|
|
744
450
|
})), [e]), !n) return null;
|
|
745
|
-
let
|
|
746
|
-
return typeof t == "function" ?
|
|
451
|
+
let o = null;
|
|
452
|
+
return typeof t == "function" ? o = t(r) : t !== null && (o = t), o === null ? null : w("div", { "aria-hidden": !0, children: o });
|
|
747
453
|
}
|
|
748
|
-
function
|
|
749
|
-
return
|
|
454
|
+
function ae(t, e) {
|
|
455
|
+
return ae = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function(n, r) {
|
|
750
456
|
return n.__proto__ = r, n;
|
|
751
|
-
},
|
|
457
|
+
}, ae(t, e);
|
|
752
458
|
}
|
|
753
|
-
var
|
|
459
|
+
var Re = { error: null }, Nn = function(t) {
|
|
754
460
|
var e, n;
|
|
755
461
|
function r() {
|
|
756
|
-
for (var
|
|
757
|
-
return (
|
|
462
|
+
for (var o, s = arguments.length, l = new Array(s), a = 0; a < s; a++) l[a] = arguments[a];
|
|
463
|
+
return (o = t.call.apply(t, [this].concat(l)) || this).state = Re, o.resetErrorBoundary = function() {
|
|
758
464
|
for (var c, u = arguments.length, d = new Array(u), f = 0; f < u; f++) d[f] = arguments[f];
|
|
759
|
-
|
|
760
|
-
},
|
|
465
|
+
o.props.onReset == null || (c = o.props).onReset.apply(c, d), o.reset();
|
|
466
|
+
}, o;
|
|
761
467
|
}
|
|
762
|
-
n = t, (e = r).prototype = Object.create(n.prototype), e.prototype.constructor = e,
|
|
763
|
-
return { error:
|
|
468
|
+
n = t, (e = r).prototype = Object.create(n.prototype), e.prototype.constructor = e, ae(e, n), r.getDerivedStateFromError = function(o) {
|
|
469
|
+
return { error: o };
|
|
764
470
|
};
|
|
765
|
-
var
|
|
766
|
-
return
|
|
767
|
-
this.setState(
|
|
768
|
-
},
|
|
769
|
-
var
|
|
770
|
-
(
|
|
771
|
-
},
|
|
772
|
-
var
|
|
773
|
-
d !== null &&
|
|
774
|
-
return !Object.is(p, u[
|
|
775
|
-
})) && ((
|
|
776
|
-
},
|
|
777
|
-
var
|
|
778
|
-
if (
|
|
779
|
-
var u = { error:
|
|
780
|
-
if (
|
|
781
|
-
if (typeof
|
|
782
|
-
if (
|
|
471
|
+
var i = r.prototype;
|
|
472
|
+
return i.reset = function() {
|
|
473
|
+
this.setState(Re);
|
|
474
|
+
}, i.componentDidCatch = function(o, s) {
|
|
475
|
+
var l, a;
|
|
476
|
+
(l = (a = this.props).onError) == null || l.call(a, o, s);
|
|
477
|
+
}, i.componentDidUpdate = function(o, s) {
|
|
478
|
+
var l, a, c, u, d = this.state.error, f = this.props.resetKeys;
|
|
479
|
+
d !== null && s.error !== null && ((c = o.resetKeys) === void 0 && (c = []), (u = f) === void 0 && (u = []), c.length !== u.length || c.some(function(p, g) {
|
|
480
|
+
return !Object.is(p, u[g]);
|
|
481
|
+
})) && ((l = (a = this.props).onResetKeysChange) == null || l.call(a, o.resetKeys, f), this.reset());
|
|
482
|
+
}, i.render = function() {
|
|
483
|
+
var o = this.state.error, s = this.props, l = s.fallbackRender, a = s.FallbackComponent, c = s.fallback;
|
|
484
|
+
if (o !== null) {
|
|
485
|
+
var u = { error: o, resetErrorBoundary: this.resetErrorBoundary };
|
|
486
|
+
if (oe.isValidElement(c)) return c;
|
|
487
|
+
if (typeof l == "function") return l(u);
|
|
488
|
+
if (a) return oe.createElement(a, u);
|
|
783
489
|
throw new Error("react-error-boundary requires either a fallback, fallbackRender, or FallbackComponent prop");
|
|
784
490
|
}
|
|
785
491
|
return this.props.children;
|
|
786
492
|
}, r;
|
|
787
|
-
}(
|
|
788
|
-
function
|
|
789
|
-
return
|
|
790
|
-
}
|
|
791
|
-
const
|
|
792
|
-
function
|
|
793
|
-
const [r] =
|
|
794
|
-
return
|
|
795
|
-
if (n) return r.registerUpdateListener(({ editorState:
|
|
796
|
-
e &&
|
|
493
|
+
}(oe.Component);
|
|
494
|
+
function Ln({ children: t, onError: e }) {
|
|
495
|
+
return w(Nn, { fallback: w("div", { style: { border: "1px solid #f00", color: "#f00", padding: "8px" }, children: "An error was thrown." }), onError: e, children: t });
|
|
496
|
+
}
|
|
497
|
+
const Dn = typeof window < "u" && window.document !== void 0 && window.document.createElement !== void 0 ? O : x;
|
|
498
|
+
function Rn({ ignoreHistoryMergeTagChange: t = !0, ignoreSelectionChange: e = !1, onChange: n }) {
|
|
499
|
+
const [r] = D();
|
|
500
|
+
return Dn(() => {
|
|
501
|
+
if (n) return r.registerUpdateListener(({ editorState: i, dirtyElements: o, dirtyLeaves: s, prevEditorState: l, tags: a }) => {
|
|
502
|
+
e && o.size === 0 && s.size === 0 || t && a.has("history-merge") || l.isEmpty() || n(i, r, a);
|
|
797
503
|
});
|
|
798
504
|
}, [r, t, e, n]), null;
|
|
799
505
|
}
|
|
800
|
-
function
|
|
801
|
-
const [t] =
|
|
802
|
-
return
|
|
803
|
-
if (!t.hasNodes([
|
|
506
|
+
function Pn() {
|
|
507
|
+
const [t] = D();
|
|
508
|
+
return x(() => {
|
|
509
|
+
if (!t.hasNodes([ze, Be])) throw new Error("ListPlugin: ListNode and/or ListItemNode not registered on editor");
|
|
804
510
|
}, [t]), function(e) {
|
|
805
|
-
|
|
511
|
+
x(() => Xt(e), [e]);
|
|
806
512
|
}(t), null;
|
|
807
513
|
}
|
|
808
|
-
function
|
|
809
|
-
const [e] =
|
|
810
|
-
return
|
|
811
|
-
if (!e.hasNodes([
|
|
812
|
-
return
|
|
813
|
-
if (n === null) return
|
|
814
|
-
if (typeof n == "string") return !(t !== void 0 && !t(n)) && (
|
|
514
|
+
function In({ validateUrl: t }) {
|
|
515
|
+
const [e] = D();
|
|
516
|
+
return x(() => {
|
|
517
|
+
if (!e.hasNodes([Ae])) throw new Error("LinkPlugin: LinkNode not registered on editor");
|
|
518
|
+
return T(e.registerCommand(xe, (n) => {
|
|
519
|
+
if (n === null) return ie(n), !0;
|
|
520
|
+
if (typeof n == "string") return !(t !== void 0 && !t(n)) && (ie(n), !0);
|
|
815
521
|
{
|
|
816
|
-
const { url: r, target:
|
|
817
|
-
return
|
|
522
|
+
const { url: r, target: i, rel: o, title: s } = n;
|
|
523
|
+
return ie(r, { rel: o, target: i, title: s }), !0;
|
|
818
524
|
}
|
|
819
|
-
},
|
|
820
|
-
const r =
|
|
821
|
-
if (!
|
|
822
|
-
const
|
|
823
|
-
if (
|
|
824
|
-
const
|
|
825
|
-
return !!t(
|
|
826
|
-
},
|
|
525
|
+
}, ve), t !== void 0 ? e.registerCommand(Te, (n) => {
|
|
526
|
+
const r = h();
|
|
527
|
+
if (!v(r) || r.isCollapsed() || !M(n, ClipboardEvent)) return !1;
|
|
528
|
+
const i = n;
|
|
529
|
+
if (i.clipboardData === null) return !1;
|
|
530
|
+
const o = i.clipboardData.getData("text");
|
|
531
|
+
return !!t(o) && !r.getNodes().some((s) => j(s)) && (e.dispatchCommand(xe, o), n.preventDefault(), !0);
|
|
532
|
+
}, ve) : () => {
|
|
827
533
|
});
|
|
828
534
|
}, [e, t]), null;
|
|
829
535
|
}
|
|
830
|
-
function
|
|
831
|
-
const [n] =
|
|
832
|
-
return
|
|
833
|
-
const r = (
|
|
834
|
-
const
|
|
835
|
-
if (!(
|
|
836
|
-
const
|
|
837
|
-
if (
|
|
838
|
-
let
|
|
839
|
-
if (
|
|
840
|
-
const f =
|
|
536
|
+
function Mn({ newTab: t = !0, disabled: e = !1 }) {
|
|
537
|
+
const [n] = D();
|
|
538
|
+
return x(() => {
|
|
539
|
+
const r = (o) => {
|
|
540
|
+
const s = o.target;
|
|
541
|
+
if (!(s instanceof Node)) return;
|
|
542
|
+
const l = _t(s);
|
|
543
|
+
if (l === null) return;
|
|
544
|
+
let a = null, c = null;
|
|
545
|
+
if (l.update(() => {
|
|
546
|
+
const f = ne(s);
|
|
841
547
|
if (f !== null) {
|
|
842
|
-
const p =
|
|
843
|
-
if (!e) if (
|
|
548
|
+
const p = de(f, j);
|
|
549
|
+
if (!e) if (Zt(p)) a = p.sanitizeUrl(p.getURL()), c = p.getTarget();
|
|
844
550
|
else {
|
|
845
|
-
const
|
|
846
|
-
let
|
|
847
|
-
for (;
|
|
848
|
-
if (
|
|
849
|
-
|
|
551
|
+
const g = function(y, $) {
|
|
552
|
+
let C = y;
|
|
553
|
+
for (; C != null; ) {
|
|
554
|
+
if ($(C)) return C;
|
|
555
|
+
C = C.parentNode;
|
|
850
556
|
}
|
|
851
557
|
return null;
|
|
852
|
-
}(
|
|
853
|
-
|
|
558
|
+
}(s, kt);
|
|
559
|
+
g !== null && (a = g.href, c = g.target);
|
|
854
560
|
}
|
|
855
561
|
}
|
|
856
|
-
}),
|
|
857
|
-
const u = n.getEditorState().read(
|
|
858
|
-
if (
|
|
859
|
-
const d =
|
|
860
|
-
window.open(
|
|
861
|
-
},
|
|
862
|
-
|
|
562
|
+
}), a === null || a === "") return;
|
|
563
|
+
const u = n.getEditorState().read(h);
|
|
564
|
+
if (v(u) && !u.isCollapsed()) return void o.preventDefault();
|
|
565
|
+
const d = o.type === "auxclick" && o.button === 1;
|
|
566
|
+
window.open(a, t || d || o.metaKey || o.ctrlKey || c === "_blank" ? "_blank" : "_self"), o.preventDefault();
|
|
567
|
+
}, i = (o) => {
|
|
568
|
+
o.button === 1 && r(o);
|
|
863
569
|
};
|
|
864
|
-
return n.registerRootListener((
|
|
865
|
-
|
|
570
|
+
return n.registerRootListener((o, s) => {
|
|
571
|
+
s !== null && (s.removeEventListener("click", r), s.removeEventListener("mouseup", i)), o !== null && (o.addEventListener("click", r), o.addEventListener("mouseup", i));
|
|
866
572
|
});
|
|
867
573
|
}, [n, t, e]), null;
|
|
868
574
|
}
|
|
869
|
-
const
|
|
870
|
-
function
|
|
871
|
-
if (t === null || n.size === 0 && r.size === 0 && !
|
|
872
|
-
const
|
|
873
|
-
if (
|
|
874
|
-
if (!(
|
|
875
|
-
const
|
|
876
|
-
const
|
|
877
|
-
for (const
|
|
878
|
-
const
|
|
879
|
-
|
|
575
|
+
const Y = 0, le = 1, ce = 2, k = 0, Tn = 1, Pe = 2, Fn = 3, Kn = 4;
|
|
576
|
+
function On(t, e, n, r, i) {
|
|
577
|
+
if (t === null || n.size === 0 && r.size === 0 && !i) return k;
|
|
578
|
+
const o = e._selection, s = t._selection;
|
|
579
|
+
if (i) return Tn;
|
|
580
|
+
if (!(v(o) && v(s) && s.isCollapsed() && o.isCollapsed())) return k;
|
|
581
|
+
const l = function(C, E, b) {
|
|
582
|
+
const _ = C._nodeMap, S = [];
|
|
583
|
+
for (const N of E) {
|
|
584
|
+
const P = _.get(N);
|
|
585
|
+
P !== void 0 && S.push(P);
|
|
880
586
|
}
|
|
881
|
-
for (const [
|
|
882
|
-
if (!
|
|
883
|
-
const
|
|
884
|
-
|
|
587
|
+
for (const [N, P] of b) {
|
|
588
|
+
if (!P) continue;
|
|
589
|
+
const B = _.get(N);
|
|
590
|
+
B === void 0 || Fe(B) || S.push(B);
|
|
885
591
|
}
|
|
886
592
|
return S;
|
|
887
593
|
}(e, n, r);
|
|
888
|
-
if (
|
|
889
|
-
if (
|
|
890
|
-
const
|
|
891
|
-
return
|
|
594
|
+
if (l.length === 0) return k;
|
|
595
|
+
if (l.length > 1) {
|
|
596
|
+
const C = e._nodeMap, E = C.get(o.anchor.key), b = C.get(s.anchor.key);
|
|
597
|
+
return E && b && !t._nodeMap.has(E.__key) && L(E) && E.__text.length === 1 && o.anchor.offset === 1 ? Pe : k;
|
|
892
598
|
}
|
|
893
|
-
const
|
|
894
|
-
if (!
|
|
895
|
-
const u = c.__text, d =
|
|
896
|
-
if (u === d) return
|
|
897
|
-
const f =
|
|
898
|
-
if (f.key !== p.key || f.type !== "text") return
|
|
899
|
-
const
|
|
900
|
-
return
|
|
901
|
-
}
|
|
902
|
-
function
|
|
903
|
-
let n = Date.now(), r =
|
|
904
|
-
return (
|
|
599
|
+
const a = l[0], c = t._nodeMap.get(a.__key);
|
|
600
|
+
if (!L(c) || !L(a) || c.__mode !== a.__mode) return k;
|
|
601
|
+
const u = c.__text, d = a.__text;
|
|
602
|
+
if (u === d) return k;
|
|
603
|
+
const f = o.anchor, p = s.anchor;
|
|
604
|
+
if (f.key !== p.key || f.type !== "text") return k;
|
|
605
|
+
const g = f.offset, y = p.offset, $ = d.length - u.length;
|
|
606
|
+
return $ === 1 && y === g - 1 ? Pe : $ === -1 && y === g + 1 ? Fn : $ === -1 && y === g ? Kn : k;
|
|
607
|
+
}
|
|
608
|
+
function zn(t, e) {
|
|
609
|
+
let n = Date.now(), r = k;
|
|
610
|
+
return (i, o, s, l, a, c) => {
|
|
905
611
|
const u = Date.now();
|
|
906
|
-
if (c.has("historic")) return r =
|
|
907
|
-
const d =
|
|
908
|
-
const p =
|
|
909
|
-
if (!
|
|
910
|
-
if (
|
|
911
|
-
const
|
|
912
|
-
return
|
|
913
|
-
const
|
|
914
|
-
return !(
|
|
915
|
-
}(Array.from(
|
|
612
|
+
if (c.has("historic")) return r = k, n = u, ce;
|
|
613
|
+
const d = On(i, o, l, a, t.isComposing()), f = (() => {
|
|
614
|
+
const p = s === null || s.editor === t, g = c.has("history-push");
|
|
615
|
+
if (!g && p && c.has("history-merge")) return Y;
|
|
616
|
+
if (i === null) return le;
|
|
617
|
+
const y = o._selection;
|
|
618
|
+
return l.size > 0 || a.size > 0 ? g === !1 && d !== k && d === r && u < n + e && p || l.size === 1 && function($, C, E) {
|
|
619
|
+
const b = C._nodeMap.get($), _ = E._nodeMap.get($), S = C._selection, N = E._selection;
|
|
620
|
+
return !(v(S) && v(N) && S.anchor.type === "element" && S.focus.type === "element" && N.anchor.type === "text" && N.focus.type === "text" || !L(b) || !L(_) || b.__parent !== _.__parent) && JSON.stringify(C.read(() => b.exportJSON())) === JSON.stringify(E.read(() => _.exportJSON()));
|
|
621
|
+
}(Array.from(l)[0], i, o) ? Y : le : y !== null ? Y : ce;
|
|
916
622
|
})();
|
|
917
623
|
return n = u, r = d, f;
|
|
918
624
|
};
|
|
919
625
|
}
|
|
920
|
-
function
|
|
626
|
+
function Ie(t) {
|
|
921
627
|
t.undoStack = [], t.redoStack = [], t.current = null;
|
|
922
628
|
}
|
|
923
|
-
function
|
|
924
|
-
const r =
|
|
925
|
-
return
|
|
926
|
-
const
|
|
927
|
-
if (l.length !== 0) {
|
|
928
|
-
const c = o.current, u = l.pop();
|
|
929
|
-
c !== null && (a.push(c), i.dispatchCommand(q, !0)), l.length === 0 && i.dispatchCommand(H, !1), o.current = u || null, u && u.editor.setEditorState(u.editorState, { tag: "historic" });
|
|
930
|
-
}
|
|
931
|
-
}(t, e), !0), y), t.registerCommand(Zt, () => (function(i, o) {
|
|
932
|
-
const a = o.redoStack, l = o.undoStack;
|
|
629
|
+
function Bn(t, e, n) {
|
|
630
|
+
const r = zn(t, n);
|
|
631
|
+
return T(t.registerCommand(Rt, () => (function(o, s) {
|
|
632
|
+
const l = s.redoStack, a = s.undoStack;
|
|
933
633
|
if (a.length !== 0) {
|
|
934
|
-
const c =
|
|
935
|
-
c !== null && (l.push(c),
|
|
936
|
-
const u = a.pop();
|
|
937
|
-
a.length === 0 && i.dispatchCommand(q, !1), o.current = u || null, u && u.editor.setEditorState(u.editorState, { tag: "historic" });
|
|
634
|
+
const c = s.current, u = a.pop();
|
|
635
|
+
c !== null && (l.push(c), o.dispatchCommand(J, !0)), a.length === 0 && o.dispatchCommand(W, !1), s.current = u || null, u && u.editor.setEditorState(u.editorState, { tag: "historic" });
|
|
938
636
|
}
|
|
939
|
-
}(t, e), !0),
|
|
637
|
+
}(t, e), !0), m), t.registerCommand(Dt, () => (function(o, s) {
|
|
638
|
+
const l = s.redoStack, a = s.undoStack;
|
|
639
|
+
if (l.length !== 0) {
|
|
640
|
+
const c = s.current;
|
|
641
|
+
c !== null && (a.push(c), o.dispatchCommand(W, !0));
|
|
642
|
+
const u = l.pop();
|
|
643
|
+
l.length === 0 && o.dispatchCommand(J, !1), s.current = u || null, u && u.editor.setEditorState(u.editorState, { tag: "historic" });
|
|
644
|
+
}
|
|
645
|
+
}(t, e), !0), m), t.registerCommand(Lt, () => (Ie(e), !1), m), t.registerCommand(Nt, () => (Ie(e), t.dispatchCommand(J, !1), t.dispatchCommand(W, !1), !0), m), t.registerUpdateListener(({ editorState: o, prevEditorState: s, dirtyLeaves: l, dirtyElements: a, tags: c }) => {
|
|
940
646
|
const u = e.current, d = e.redoStack, f = e.undoStack, p = u === null ? null : u.editorState;
|
|
941
|
-
if (u !== null &&
|
|
942
|
-
const
|
|
943
|
-
if (
|
|
944
|
-
else if (
|
|
945
|
-
e.current = { editor: t, editorState:
|
|
647
|
+
if (u !== null && o === p) return;
|
|
648
|
+
const g = r(s, o, u, l, a, c);
|
|
649
|
+
if (g === le) d.length !== 0 && (e.redoStack = [], t.dispatchCommand(J, !1)), u !== null && (f.push({ ...u }), t.dispatchCommand(W, !0));
|
|
650
|
+
else if (g === ce) return;
|
|
651
|
+
e.current = { editor: t, editorState: o };
|
|
946
652
|
}));
|
|
947
653
|
}
|
|
948
|
-
function
|
|
654
|
+
function An() {
|
|
949
655
|
return { current: null, redoStack: [], undoStack: [] };
|
|
950
656
|
}
|
|
951
|
-
function
|
|
952
|
-
const [n] =
|
|
953
|
-
return function(r,
|
|
954
|
-
const
|
|
955
|
-
|
|
657
|
+
function Un({ delay: t, externalHistoryState: e }) {
|
|
658
|
+
const [n] = D();
|
|
659
|
+
return function(r, i, o = 1e3) {
|
|
660
|
+
const s = V(() => i || An(), [i]);
|
|
661
|
+
x(() => Bn(r, s, o), [o, r, s]);
|
|
956
662
|
}(n, e, t), null;
|
|
957
663
|
}
|
|
958
|
-
|
|
664
|
+
function jn(t) {
|
|
665
|
+
return t && t.__esModule && Object.prototype.hasOwnProperty.call(t, "default") ? t.default : t;
|
|
666
|
+
}
|
|
667
|
+
var G = jn(function(t) {
|
|
668
|
+
const e = new URLSearchParams();
|
|
669
|
+
e.append("code", t);
|
|
670
|
+
for (let n = 1; n < arguments.length; n++) e.append("v", arguments[n]);
|
|
671
|
+
throw Error(`Minified Lexical error #${t}; 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.`);
|
|
672
|
+
});
|
|
673
|
+
function Vn({ hasCellMerge: t = !0, hasCellBackgroundColor: e = !0, hasTabHandler: n = !0 }) {
|
|
674
|
+
const [r] = D();
|
|
675
|
+
return x(() => (r.hasNodes([Q, ee, Oe]) || G(10), T(r.registerCommand(Bt, ({ columns: i, rows: o, includeHeaders: s }) => {
|
|
676
|
+
const l = At(Number(o), Number(i), s);
|
|
677
|
+
Kt(l);
|
|
678
|
+
const a = l.getFirstDescendant();
|
|
679
|
+
return L(a) && a.select(), !0;
|
|
680
|
+
}, m), r.registerNodeTransform(Q, (i) => {
|
|
681
|
+
const [o] = zt(i, null, null), s = o.reduce((a, c) => Math.max(a, c.length), 0), l = i.getChildren();
|
|
682
|
+
for (let a = 0; a < o.length; ++a) {
|
|
683
|
+
const c = l[a];
|
|
684
|
+
if (!c) continue;
|
|
685
|
+
const u = o[a].reduce((d, f) => f ? 1 + d : d, 0);
|
|
686
|
+
if (u !== s) for (let d = u; d < s; ++d) {
|
|
687
|
+
const f = $e(0);
|
|
688
|
+
f.append(ue()), c.append(f);
|
|
689
|
+
}
|
|
690
|
+
}
|
|
691
|
+
}))), [r]), x(() => {
|
|
692
|
+
const i = /* @__PURE__ */ new Map(), o = (l, a, c) => {
|
|
693
|
+
const u = c, d = Jt(l, u, r, n);
|
|
694
|
+
i.set(a, [d, u]);
|
|
695
|
+
}, s = r.registerMutationListener(Q, (l) => {
|
|
696
|
+
for (const [a, c] of l) if (c === "created" || c === "updated") {
|
|
697
|
+
const u = i.get(a), d = r.getElementByKey(a);
|
|
698
|
+
u && d === u[1] || (u && (u[0].removeListeners(), i.delete(a)), d !== null && r.getEditorState().read(() => {
|
|
699
|
+
const f = Pt(a);
|
|
700
|
+
Ut(f) && o(f, a, d);
|
|
701
|
+
}));
|
|
702
|
+
} else if (c === "destroyed") {
|
|
703
|
+
const u = i.get(a);
|
|
704
|
+
u !== void 0 && (u[0].removeListeners(), i.delete(a));
|
|
705
|
+
}
|
|
706
|
+
}, { skipInitialization: !1 });
|
|
707
|
+
return () => {
|
|
708
|
+
s();
|
|
709
|
+
for (const [, [l]] of i) l.removeListeners();
|
|
710
|
+
};
|
|
711
|
+
}, [r, n]), x(() => {
|
|
712
|
+
if (!t) return r.registerNodeTransform(ee, (i) => {
|
|
713
|
+
if (i.getColSpan() > 1 || i.getRowSpan() > 1) {
|
|
714
|
+
const [, , o] = jt(i), [s] = Vt(o, i, i), l = s.length, a = s[0].length;
|
|
715
|
+
let c = o.getFirstChild();
|
|
716
|
+
Se(c) || G(175);
|
|
717
|
+
const u = [];
|
|
718
|
+
for (let d = 0; d < l; d++) {
|
|
719
|
+
d !== 0 && (c = c.getNextSibling(), Se(c) || G(175));
|
|
720
|
+
let f = null;
|
|
721
|
+
for (let p = 0; p < a; p++) {
|
|
722
|
+
const g = s[d][p], y = g.cell;
|
|
723
|
+
if (g.startRow === d && g.startColumn === p) f = y, u.push(y);
|
|
724
|
+
else if (y.getColSpan() > 1 || y.getRowSpan() > 1) {
|
|
725
|
+
qt(y) || G(176);
|
|
726
|
+
const $ = $e(y.__headerState);
|
|
727
|
+
f !== null ? f.insertAfter($) : Ot(c, $);
|
|
728
|
+
}
|
|
729
|
+
}
|
|
730
|
+
}
|
|
731
|
+
for (const d of u) d.setColSpan(1), d.setRowSpan(1);
|
|
732
|
+
}
|
|
733
|
+
});
|
|
734
|
+
}, [r, t]), x(() => {
|
|
735
|
+
if (!e) return r.registerNodeTransform(ee, (i) => {
|
|
736
|
+
i.getBackgroundColor() !== null && i.setBackgroundColor(null);
|
|
737
|
+
});
|
|
738
|
+
}, [r, e, t]), null;
|
|
739
|
+
}
|
|
740
|
+
const Cr = ({
|
|
959
741
|
namespace: t = "UvaEditor",
|
|
960
742
|
initialValue: e = "",
|
|
961
743
|
placeholder: n = "",
|
|
962
744
|
onChange: r
|
|
963
745
|
}) => {
|
|
964
|
-
const
|
|
746
|
+
const i = {
|
|
965
747
|
namespace: t,
|
|
966
|
-
theme:
|
|
967
|
-
onError(
|
|
968
|
-
throw
|
|
748
|
+
theme: nn,
|
|
749
|
+
onError(s) {
|
|
750
|
+
throw s;
|
|
969
751
|
},
|
|
970
|
-
nodes: [
|
|
971
|
-
editorState: (
|
|
972
|
-
const
|
|
752
|
+
nodes: [ze, Be, Ae, en, ee, Oe, Q],
|
|
753
|
+
editorState: (s) => {
|
|
754
|
+
const a = new DOMParser().parseFromString(e, "text/html"), c = Wt(s, a), u = F();
|
|
973
755
|
u.clear();
|
|
974
|
-
const d =
|
|
756
|
+
const d = ue();
|
|
975
757
|
c.forEach((f) => d.append(f)), u.append(d);
|
|
976
758
|
}
|
|
977
|
-
},
|
|
978
|
-
|
|
979
|
-
const
|
|
980
|
-
r(
|
|
759
|
+
}, o = (s, l) => {
|
|
760
|
+
s.read(() => {
|
|
761
|
+
const a = Ht(l);
|
|
762
|
+
r(a);
|
|
981
763
|
});
|
|
982
764
|
};
|
|
983
|
-
return /* @__PURE__ */
|
|
984
|
-
/* @__PURE__ */
|
|
985
|
-
/* @__PURE__ */
|
|
986
|
-
/* @__PURE__ */
|
|
987
|
-
|
|
765
|
+
return /* @__PURE__ */ w("div", { className: A.editor__wrapper, children: /* @__PURE__ */ te(on, { initialConfig: i, children: [
|
|
766
|
+
/* @__PURE__ */ w(tn, {}),
|
|
767
|
+
/* @__PURE__ */ te("div", { className: A["editor__field-wrapper"], children: [
|
|
768
|
+
/* @__PURE__ */ w(
|
|
769
|
+
En,
|
|
988
770
|
{
|
|
989
|
-
contentEditable: /* @__PURE__ */
|
|
990
|
-
|
|
771
|
+
contentEditable: /* @__PURE__ */ w(
|
|
772
|
+
xn,
|
|
991
773
|
{
|
|
992
|
-
className:
|
|
774
|
+
className: A.editor__field,
|
|
993
775
|
"aria-label": "Rich text editor content",
|
|
994
776
|
"aria-placeholder": n,
|
|
995
777
|
title: "Rich text editor content",
|
|
996
|
-
placeholder: /* @__PURE__ */
|
|
778
|
+
placeholder: /* @__PURE__ */ w("div", { className: A.editor__placeholder, children: n })
|
|
997
779
|
}
|
|
998
780
|
),
|
|
999
|
-
placeholder: /* @__PURE__ */
|
|
1000
|
-
ErrorBoundary:
|
|
781
|
+
placeholder: /* @__PURE__ */ w("div", { className: A.editor__placeholder, children: n }),
|
|
782
|
+
ErrorBoundary: Ln
|
|
1001
783
|
}
|
|
1002
784
|
),
|
|
1003
|
-
/* @__PURE__ */
|
|
1004
|
-
/* @__PURE__ */
|
|
1005
|
-
/* @__PURE__ */
|
|
1006
|
-
/* @__PURE__ */
|
|
1007
|
-
/* @__PURE__ */
|
|
1008
|
-
/* @__PURE__ */
|
|
785
|
+
/* @__PURE__ */ w(Vn, {}),
|
|
786
|
+
/* @__PURE__ */ w(Un, {}),
|
|
787
|
+
/* @__PURE__ */ w(Pn, {}),
|
|
788
|
+
/* @__PURE__ */ w(In, { validateUrl: Yt }),
|
|
789
|
+
/* @__PURE__ */ w(Gt, { matchers: Qt }),
|
|
790
|
+
/* @__PURE__ */ w(Mn, {}),
|
|
791
|
+
/* @__PURE__ */ w(Rn, { onChange: o })
|
|
1009
792
|
] })
|
|
1010
793
|
] }) });
|
|
1011
794
|
};
|
|
1012
795
|
export {
|
|
1013
|
-
|
|
796
|
+
Cr as RteEditor
|
|
1014
797
|
};
|
|
1015
798
|
//# sourceMappingURL=RteEditor.js.map
|