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