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