@uva-glass/component-library 1.52.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/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.stories.js +1 -1
- package/dist/components/HorizontalList/HorizontalList.stories.js.map +1 -1
- package/dist/components/Icon/Icon.d.ts +1 -1
- package/dist/components/Icon/Icon.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 +14 -14
- 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,643 +0,0 @@
|
|
|
1
|
-
import { jsx as x } from "react/jsx-runtime";
|
|
2
|
-
import { y as v, w as it, p as J, P as N, F as R, m as T, f as j, v as q, o as st, t as F, a as ot, L as k, I, b as A, _ as Y, u as ct } from "./Lexical.prod-DSsdOWxu.js";
|
|
3
|
-
import { useState as lt } from "react";
|
|
4
|
-
import { c as at } from "./clsx-OuTLNxxd.js";
|
|
5
|
-
import { Icon as ut } from "./components/Icon/Icon.js";
|
|
6
|
-
import { s as y } from "./RteEditor.module-RkKUrkOO.js";
|
|
7
|
-
function ht(n) {
|
|
8
|
-
return n && n.__esModule && Object.prototype.hasOwnProperty.call(n, "default") ? n.default : n;
|
|
9
|
-
}
|
|
10
|
-
var dt = ht(function(n) {
|
|
11
|
-
const t = new URLSearchParams();
|
|
12
|
-
t.append("code", n);
|
|
13
|
-
for (let e = 1; e < arguments.length; e++) t.append("v", arguments[e]);
|
|
14
|
-
throw Error(`Minified Lexical error #${n}; visit https://lexical.dev/docs/error?${t} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`);
|
|
15
|
-
});
|
|
16
|
-
const Z = typeof window < "u" && window.document !== void 0 && window.document.createElement !== void 0, gt = Z && "documentMode" in document ? document.documentMode : null;
|
|
17
|
-
!(!Z || !("InputEvent" in window) || gt) && "getTargetRanges" in new window.InputEvent("input");
|
|
18
|
-
function G(...n) {
|
|
19
|
-
const t = [];
|
|
20
|
-
for (const e of n) if (e && typeof e == "string") for (const [r] of e.matchAll(/\S+/g)) t.push(r);
|
|
21
|
-
return t;
|
|
22
|
-
}
|
|
23
|
-
function ft(...n) {
|
|
24
|
-
return () => {
|
|
25
|
-
for (let t = n.length - 1; t >= 0; t--) n[t]();
|
|
26
|
-
n.length = 0;
|
|
27
|
-
};
|
|
28
|
-
}
|
|
29
|
-
function H(n, ...t) {
|
|
30
|
-
const e = G(...t);
|
|
31
|
-
e.length > 0 && n.classList.add(...e);
|
|
32
|
-
}
|
|
33
|
-
function Q(n, ...t) {
|
|
34
|
-
const e = G(...t);
|
|
35
|
-
e.length > 0 && n.classList.remove(...e);
|
|
36
|
-
}
|
|
37
|
-
function pt(n, t) {
|
|
38
|
-
let e = n;
|
|
39
|
-
for (; e != null; ) {
|
|
40
|
-
if (e instanceof t) return e;
|
|
41
|
-
e = e.getParent();
|
|
42
|
-
}
|
|
43
|
-
return null;
|
|
44
|
-
}
|
|
45
|
-
function Et(n) {
|
|
46
|
-
const t = mt(n, (e) => v(e) && !e.isInline());
|
|
47
|
-
return v(t) || dt(4, n.__key), t;
|
|
48
|
-
}
|
|
49
|
-
const mt = (n, t) => {
|
|
50
|
-
let e = n;
|
|
51
|
-
for (; e !== it() && e != null; ) {
|
|
52
|
-
if (t(e)) return e;
|
|
53
|
-
e = e.getParent();
|
|
54
|
-
}
|
|
55
|
-
return null;
|
|
56
|
-
};
|
|
57
|
-
function Mt(n, t) {
|
|
58
|
-
return n !== null && Object.getPrototypeOf(n).constructor.name === t.name;
|
|
59
|
-
}
|
|
60
|
-
function _t(n) {
|
|
61
|
-
return n && n.__esModule && Object.prototype.hasOwnProperty.call(n, "default") ? n.default : n;
|
|
62
|
-
}
|
|
63
|
-
var p = _t(function(n) {
|
|
64
|
-
const t = new URLSearchParams();
|
|
65
|
-
t.append("code", n);
|
|
66
|
-
for (let e = 1; e < arguments.length; e++) t.append("v", arguments[e]);
|
|
67
|
-
throw Error(`Minified Lexical error #${n}; visit https://lexical.dev/docs/error?${t} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`);
|
|
68
|
-
});
|
|
69
|
-
function vt(n) {
|
|
70
|
-
let t = 1, e = n.getParent();
|
|
71
|
-
for (; e != null; ) {
|
|
72
|
-
if (h(e)) {
|
|
73
|
-
const r = e.getParent();
|
|
74
|
-
if (a(r)) {
|
|
75
|
-
t++, e = r.getParent();
|
|
76
|
-
continue;
|
|
77
|
-
}
|
|
78
|
-
p(40);
|
|
79
|
-
}
|
|
80
|
-
return t;
|
|
81
|
-
}
|
|
82
|
-
return t;
|
|
83
|
-
}
|
|
84
|
-
function O(n) {
|
|
85
|
-
let t = n.getParent();
|
|
86
|
-
a(t) || p(40);
|
|
87
|
-
let e = t;
|
|
88
|
-
for (; e !== null; ) e = e.getParent(), a(e) && (t = e);
|
|
89
|
-
return t;
|
|
90
|
-
}
|
|
91
|
-
function X(n) {
|
|
92
|
-
let t = [];
|
|
93
|
-
const e = n.getChildren().filter(h);
|
|
94
|
-
for (let r = 0; r < e.length; r++) {
|
|
95
|
-
const i = e[r], s = i.getFirstChild();
|
|
96
|
-
a(s) ? t = t.concat(X(s)) : t.push(i);
|
|
97
|
-
}
|
|
98
|
-
return t;
|
|
99
|
-
}
|
|
100
|
-
function m(n) {
|
|
101
|
-
return h(n) && a(n.getFirstChild());
|
|
102
|
-
}
|
|
103
|
-
function D(n) {
|
|
104
|
-
return f().append(n);
|
|
105
|
-
}
|
|
106
|
-
function tt(n, t) {
|
|
107
|
-
return h(n) && (t.length === 0 || t.length === 1 && n.is(t[0]) && n.getChildrenSize() === 0);
|
|
108
|
-
}
|
|
109
|
-
function $(n, t) {
|
|
110
|
-
n.update(() => {
|
|
111
|
-
const e = I();
|
|
112
|
-
if (e !== null) {
|
|
113
|
-
const r = e.getNodes();
|
|
114
|
-
if (T(e)) {
|
|
115
|
-
const s = e.getStartEndPoints();
|
|
116
|
-
s === null && p(143);
|
|
117
|
-
const [o] = s, c = o.getNode(), l = c.getParent();
|
|
118
|
-
if (tt(c, r)) {
|
|
119
|
-
const u = g(t);
|
|
120
|
-
if (A(l)) {
|
|
121
|
-
c.replace(u);
|
|
122
|
-
const d = f();
|
|
123
|
-
v(c) && (d.setFormat(c.getFormatType()), d.setIndent(c.getIndent())), u.append(d);
|
|
124
|
-
} else if (h(c)) {
|
|
125
|
-
const d = c.getParentOrThrow();
|
|
126
|
-
b(u, d.getChildren()), d.replace(u);
|
|
127
|
-
}
|
|
128
|
-
return;
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
const i = /* @__PURE__ */ new Set();
|
|
132
|
-
for (let s = 0; s < r.length; s++) {
|
|
133
|
-
const o = r[s];
|
|
134
|
-
if (!v(o) || !o.isEmpty() || h(o) || i.has(o.getKey())) {
|
|
135
|
-
if (Y(o)) {
|
|
136
|
-
let c = o.getParent();
|
|
137
|
-
for (; c != null; ) {
|
|
138
|
-
const l = c.getKey();
|
|
139
|
-
if (a(c)) {
|
|
140
|
-
if (!i.has(l)) {
|
|
141
|
-
const u = g(t);
|
|
142
|
-
b(u, c.getChildren()), c.replace(u), i.add(l);
|
|
143
|
-
}
|
|
144
|
-
break;
|
|
145
|
-
}
|
|
146
|
-
{
|
|
147
|
-
const u = c.getParent();
|
|
148
|
-
if (A(u) && !i.has(l)) {
|
|
149
|
-
i.add(l), B(c, t);
|
|
150
|
-
break;
|
|
151
|
-
}
|
|
152
|
-
c = u;
|
|
153
|
-
}
|
|
154
|
-
}
|
|
155
|
-
}
|
|
156
|
-
} else B(o, t);
|
|
157
|
-
}
|
|
158
|
-
}
|
|
159
|
-
});
|
|
160
|
-
}
|
|
161
|
-
function b(n, t) {
|
|
162
|
-
n.splice(n.getChildrenSize(), 0, t);
|
|
163
|
-
}
|
|
164
|
-
function B(n, t) {
|
|
165
|
-
if (a(n)) return n;
|
|
166
|
-
const e = n.getPreviousSibling(), r = n.getNextSibling(), i = f();
|
|
167
|
-
if (i.setFormat(n.getFormatType()), i.setIndent(n.getIndent()), b(i, n.getChildren()), a(e) && t === e.getListType()) return e.append(i), n.remove(), a(r) && t === r.getListType() && (b(e, r.getChildren()), r.remove()), e;
|
|
168
|
-
if (a(r) && t === r.getListType()) return r.getFirstChildOrThrow().insertBefore(i), n.remove(), r;
|
|
169
|
-
{
|
|
170
|
-
const s = g(t);
|
|
171
|
-
return s.append(i), n.replace(s), s;
|
|
172
|
-
}
|
|
173
|
-
}
|
|
174
|
-
function E(n, t) {
|
|
175
|
-
const e = n.getLastChild(), r = t.getFirstChild();
|
|
176
|
-
e && r && m(e) && m(r) && (E(e.getFirstChild(), r.getFirstChild()), r.remove());
|
|
177
|
-
const i = t.getChildren();
|
|
178
|
-
i.length > 0 && n.append(...i), t.remove();
|
|
179
|
-
}
|
|
180
|
-
function bt(n) {
|
|
181
|
-
n.update(() => {
|
|
182
|
-
const t = I();
|
|
183
|
-
if (T(t)) {
|
|
184
|
-
const e = /* @__PURE__ */ new Set(), r = t.getNodes(), i = t.anchor.getNode();
|
|
185
|
-
if (tt(i, r)) e.add(O(i));
|
|
186
|
-
else for (let s = 0; s < r.length; s++) {
|
|
187
|
-
const o = r[s];
|
|
188
|
-
if (Y(o)) {
|
|
189
|
-
const c = pt(o, C);
|
|
190
|
-
c != null && e.add(O(c));
|
|
191
|
-
}
|
|
192
|
-
}
|
|
193
|
-
for (const s of e) {
|
|
194
|
-
let o = s;
|
|
195
|
-
const c = X(s);
|
|
196
|
-
for (const l of c) {
|
|
197
|
-
const u = N();
|
|
198
|
-
b(u, l.getChildren()), o.insertAfter(u), o = u, l.__key === t.anchor.key && t.anchor.set(u.getKey(), 0, "element"), l.__key === t.focus.key && t.focus.set(u.getKey(), 0, "element"), l.remove();
|
|
199
|
-
}
|
|
200
|
-
s.remove();
|
|
201
|
-
}
|
|
202
|
-
}
|
|
203
|
-
});
|
|
204
|
-
}
|
|
205
|
-
function yt(n) {
|
|
206
|
-
const t = /* @__PURE__ */ new Set();
|
|
207
|
-
if (m(n) || t.has(n.getKey())) return;
|
|
208
|
-
const e = n.getParent(), r = n.getNextSibling(), i = n.getPreviousSibling();
|
|
209
|
-
if (m(r) && m(i)) {
|
|
210
|
-
const s = i.getFirstChild();
|
|
211
|
-
if (a(s)) {
|
|
212
|
-
s.append(n);
|
|
213
|
-
const o = r.getFirstChild();
|
|
214
|
-
a(o) && (b(s, o.getChildren()), r.remove(), t.add(r.getKey()));
|
|
215
|
-
}
|
|
216
|
-
} else if (m(r)) {
|
|
217
|
-
const s = r.getFirstChild();
|
|
218
|
-
if (a(s)) {
|
|
219
|
-
const o = s.getFirstChild();
|
|
220
|
-
o !== null && o.insertBefore(n);
|
|
221
|
-
}
|
|
222
|
-
} else if (m(i)) {
|
|
223
|
-
const s = i.getFirstChild();
|
|
224
|
-
a(s) && s.append(n);
|
|
225
|
-
} else if (a(e)) {
|
|
226
|
-
const s = f(), o = g(e.getListType());
|
|
227
|
-
s.append(o), o.append(n), i ? i.insertAfter(s) : r ? r.insertBefore(s) : e.append(s);
|
|
228
|
-
}
|
|
229
|
-
}
|
|
230
|
-
function Ct(n) {
|
|
231
|
-
if (m(n)) return;
|
|
232
|
-
const t = n.getParent(), e = t ? t.getParent() : void 0;
|
|
233
|
-
if (a(e ? e.getParent() : void 0) && h(e) && a(t)) {
|
|
234
|
-
const r = t ? t.getFirstChild() : void 0, i = t ? t.getLastChild() : void 0;
|
|
235
|
-
if (n.is(r)) e.insertBefore(n), t.isEmpty() && e.remove();
|
|
236
|
-
else if (n.is(i)) e.insertAfter(n), t.isEmpty() && e.remove();
|
|
237
|
-
else {
|
|
238
|
-
const s = t.getListType(), o = f(), c = g(s);
|
|
239
|
-
o.append(c), n.getPreviousSiblings().forEach((d) => c.append(d));
|
|
240
|
-
const l = f(), u = g(s);
|
|
241
|
-
l.append(u), b(u, n.getNextSiblings()), e.insertBefore(o), e.insertAfter(l), e.replace(n);
|
|
242
|
-
}
|
|
243
|
-
}
|
|
244
|
-
}
|
|
245
|
-
function kt() {
|
|
246
|
-
const n = I();
|
|
247
|
-
if (!T(n) || !n.isCollapsed()) return !1;
|
|
248
|
-
const t = n.anchor.getNode();
|
|
249
|
-
if (!h(t) || t.getChildrenSize() !== 0) return !1;
|
|
250
|
-
const e = O(t), r = t.getParent();
|
|
251
|
-
a(r) || p(40);
|
|
252
|
-
const i = r.getParent();
|
|
253
|
-
let s;
|
|
254
|
-
if (A(i)) s = N(), e.insertAfter(s);
|
|
255
|
-
else {
|
|
256
|
-
if (!h(i)) return !1;
|
|
257
|
-
s = f(), i.insertAfter(s);
|
|
258
|
-
}
|
|
259
|
-
s.select();
|
|
260
|
-
const o = t.getNextSiblings();
|
|
261
|
-
if (o.length > 0) {
|
|
262
|
-
const c = g(r.getListType());
|
|
263
|
-
if (R(s)) s.insertAfter(c);
|
|
264
|
-
else {
|
|
265
|
-
const l = f();
|
|
266
|
-
l.append(c), s.insertAfter(l);
|
|
267
|
-
}
|
|
268
|
-
o.forEach((l) => {
|
|
269
|
-
l.remove(), c.append(l);
|
|
270
|
-
});
|
|
271
|
-
}
|
|
272
|
-
return function(c) {
|
|
273
|
-
let l = c;
|
|
274
|
-
for (; l.getNextSibling() == null && l.getPreviousSibling() == null; ) {
|
|
275
|
-
const u = l.getParent();
|
|
276
|
-
if (u == null || !h(l) && !a(l)) break;
|
|
277
|
-
l = u;
|
|
278
|
-
}
|
|
279
|
-
l.remove();
|
|
280
|
-
}(t), !0;
|
|
281
|
-
}
|
|
282
|
-
function P(...n) {
|
|
283
|
-
const t = [];
|
|
284
|
-
for (const e of n) if (e && typeof e == "string") for (const [r] of e.matchAll(/\S+/g)) t.push(r);
|
|
285
|
-
return t;
|
|
286
|
-
}
|
|
287
|
-
class C extends J {
|
|
288
|
-
static getType() {
|
|
289
|
-
return "listitem";
|
|
290
|
-
}
|
|
291
|
-
static clone(t) {
|
|
292
|
-
return new C(t.__value, t.__checked, t.__key);
|
|
293
|
-
}
|
|
294
|
-
constructor(t, e, r) {
|
|
295
|
-
super(r), this.__value = t === void 0 ? 1 : t, this.__checked = e;
|
|
296
|
-
}
|
|
297
|
-
createDOM(t) {
|
|
298
|
-
const e = document.createElement("li"), r = this.getParent();
|
|
299
|
-
return a(r) && r.getListType() === "check" && W(e, this, null), e.value = this.__value, K(e, t.theme, this), e;
|
|
300
|
-
}
|
|
301
|
-
updateDOM(t, e, r) {
|
|
302
|
-
const i = this.getParent();
|
|
303
|
-
return a(i) && i.getListType() === "check" && W(e, this, t), e.value = this.__value, K(e, r.theme, this), !1;
|
|
304
|
-
}
|
|
305
|
-
static transform() {
|
|
306
|
-
return (t) => {
|
|
307
|
-
if (h(t) || p(144), t.__checked == null) return;
|
|
308
|
-
const e = t.getParent();
|
|
309
|
-
a(e) && e.getListType() !== "check" && t.getChecked() != null && t.setChecked(void 0);
|
|
310
|
-
};
|
|
311
|
-
}
|
|
312
|
-
static importDOM() {
|
|
313
|
-
return { li: () => ({ conversion: Pt, priority: 0 }) };
|
|
314
|
-
}
|
|
315
|
-
static importJSON(t) {
|
|
316
|
-
const e = f();
|
|
317
|
-
return e.setChecked(t.checked), e.setValue(t.value), e.setFormat(t.format), e.setDirection(t.direction), e;
|
|
318
|
-
}
|
|
319
|
-
exportDOM(t) {
|
|
320
|
-
const e = this.createDOM(t._config);
|
|
321
|
-
return e.style.textAlign = this.getFormatType(), { element: e };
|
|
322
|
-
}
|
|
323
|
-
exportJSON() {
|
|
324
|
-
return { ...super.exportJSON(), checked: this.getChecked(), type: "listitem", value: this.getValue(), version: 1 };
|
|
325
|
-
}
|
|
326
|
-
append(...t) {
|
|
327
|
-
for (let e = 0; e < t.length; e++) {
|
|
328
|
-
const r = t[e];
|
|
329
|
-
if (v(r) && this.canMergeWith(r)) {
|
|
330
|
-
const i = r.getChildren();
|
|
331
|
-
this.append(...i), r.remove();
|
|
332
|
-
} else super.append(r);
|
|
333
|
-
}
|
|
334
|
-
return this;
|
|
335
|
-
}
|
|
336
|
-
replace(t, e) {
|
|
337
|
-
if (h(t)) return super.replace(t);
|
|
338
|
-
this.setIndent(0);
|
|
339
|
-
const r = this.getParentOrThrow();
|
|
340
|
-
if (!a(r)) return t;
|
|
341
|
-
if (r.__first === this.getKey()) r.insertBefore(t);
|
|
342
|
-
else if (r.__last === this.getKey()) r.insertAfter(t);
|
|
343
|
-
else {
|
|
344
|
-
const i = g(r.getListType());
|
|
345
|
-
let s = this.getNextSibling();
|
|
346
|
-
for (; s; ) {
|
|
347
|
-
const o = s;
|
|
348
|
-
s = s.getNextSibling(), i.append(o);
|
|
349
|
-
}
|
|
350
|
-
r.insertAfter(t), t.insertAfter(i);
|
|
351
|
-
}
|
|
352
|
-
return e && (v(t) || p(139), this.getChildren().forEach((i) => {
|
|
353
|
-
t.append(i);
|
|
354
|
-
})), this.remove(), r.getChildrenSize() === 0 && r.remove(), t;
|
|
355
|
-
}
|
|
356
|
-
insertAfter(t, e = !0) {
|
|
357
|
-
const r = this.getParentOrThrow();
|
|
358
|
-
if (a(r) || p(39), h(t)) return super.insertAfter(t, e);
|
|
359
|
-
const i = this.getNextSiblings();
|
|
360
|
-
if (r.insertAfter(t, e), i.length !== 0) {
|
|
361
|
-
const s = g(r.getListType());
|
|
362
|
-
i.forEach((o) => s.append(o)), t.insertAfter(s, e);
|
|
363
|
-
}
|
|
364
|
-
return t;
|
|
365
|
-
}
|
|
366
|
-
remove(t) {
|
|
367
|
-
const e = this.getPreviousSibling(), r = this.getNextSibling();
|
|
368
|
-
super.remove(t), e && r && m(e) && m(r) && (E(e.getFirstChild(), r.getFirstChild()), r.remove());
|
|
369
|
-
}
|
|
370
|
-
insertNewAfter(t, e = !0) {
|
|
371
|
-
const r = f(this.__checked == null && void 0);
|
|
372
|
-
return this.insertAfter(r, e), r;
|
|
373
|
-
}
|
|
374
|
-
collapseAtStart(t) {
|
|
375
|
-
const e = N();
|
|
376
|
-
this.getChildren().forEach((o) => e.append(o));
|
|
377
|
-
const r = this.getParentOrThrow(), i = r.getParentOrThrow(), s = h(i);
|
|
378
|
-
if (r.getChildrenSize() === 1) if (s) r.remove(), i.select();
|
|
379
|
-
else {
|
|
380
|
-
r.insertBefore(e), r.remove();
|
|
381
|
-
const o = t.anchor, c = t.focus, l = e.getKey();
|
|
382
|
-
o.type === "element" && o.getNode().is(this) && o.set(l, o.offset, "element"), c.type === "element" && c.getNode().is(this) && c.set(l, c.offset, "element");
|
|
383
|
-
}
|
|
384
|
-
else r.insertBefore(e), this.remove();
|
|
385
|
-
return !0;
|
|
386
|
-
}
|
|
387
|
-
getValue() {
|
|
388
|
-
return this.getLatest().__value;
|
|
389
|
-
}
|
|
390
|
-
setValue(t) {
|
|
391
|
-
this.getWritable().__value = t;
|
|
392
|
-
}
|
|
393
|
-
getChecked() {
|
|
394
|
-
const t = this.getLatest();
|
|
395
|
-
let e;
|
|
396
|
-
const r = this.getParent();
|
|
397
|
-
return a(r) && (e = r.getListType()), e === "check" ? !!t.__checked : void 0;
|
|
398
|
-
}
|
|
399
|
-
setChecked(t) {
|
|
400
|
-
this.getWritable().__checked = t;
|
|
401
|
-
}
|
|
402
|
-
toggleChecked() {
|
|
403
|
-
this.setChecked(!this.__checked);
|
|
404
|
-
}
|
|
405
|
-
getIndent() {
|
|
406
|
-
const t = this.getParent();
|
|
407
|
-
if (t === null) return this.getLatest().__indent;
|
|
408
|
-
let e = t.getParentOrThrow(), r = 0;
|
|
409
|
-
for (; h(e); ) e = e.getParentOrThrow().getParentOrThrow(), r++;
|
|
410
|
-
return r;
|
|
411
|
-
}
|
|
412
|
-
setIndent(t) {
|
|
413
|
-
typeof t != "number" && p(117), (t = Math.floor(t)) >= 0 || p(199);
|
|
414
|
-
let e = this.getIndent();
|
|
415
|
-
for (; e !== t; ) e < t ? (yt(this), e++) : (Ct(this), e--);
|
|
416
|
-
return this;
|
|
417
|
-
}
|
|
418
|
-
canInsertAfter(t) {
|
|
419
|
-
return h(t);
|
|
420
|
-
}
|
|
421
|
-
canReplaceWith(t) {
|
|
422
|
-
return h(t);
|
|
423
|
-
}
|
|
424
|
-
canMergeWith(t) {
|
|
425
|
-
return R(t) || h(t);
|
|
426
|
-
}
|
|
427
|
-
extractWithChild(t, e) {
|
|
428
|
-
if (!T(e)) return !1;
|
|
429
|
-
const r = e.anchor.getNode(), i = e.focus.getNode();
|
|
430
|
-
return this.isParentOf(r) && this.isParentOf(i) && this.getTextContent().length === e.getTextContent().length;
|
|
431
|
-
}
|
|
432
|
-
isParentRequired() {
|
|
433
|
-
return !0;
|
|
434
|
-
}
|
|
435
|
-
createParentElementNode() {
|
|
436
|
-
return g("bullet");
|
|
437
|
-
}
|
|
438
|
-
canMergeWhenEmpty() {
|
|
439
|
-
return !0;
|
|
440
|
-
}
|
|
441
|
-
}
|
|
442
|
-
function K(n, t, e) {
|
|
443
|
-
const r = [], i = [], s = t.list, o = s ? s.listitem : void 0;
|
|
444
|
-
let c;
|
|
445
|
-
if (s && s.nested && (c = s.nested.listitem), o !== void 0 && r.push(...P(o)), s) {
|
|
446
|
-
const l = e.getParent(), u = a(l) && l.getListType() === "check", d = e.getChecked();
|
|
447
|
-
u && !d || i.push(s.listitemUnchecked), u && d || i.push(s.listitemChecked), u && r.push(d ? s.listitemChecked : s.listitemUnchecked);
|
|
448
|
-
}
|
|
449
|
-
if (c !== void 0) {
|
|
450
|
-
const l = P(c);
|
|
451
|
-
e.getChildren().some((u) => a(u)) ? r.push(...l) : i.push(...l);
|
|
452
|
-
}
|
|
453
|
-
i.length > 0 && Q(n, ...i), r.length > 0 && H(n, ...r);
|
|
454
|
-
}
|
|
455
|
-
function W(n, t, e, r) {
|
|
456
|
-
a(t.getFirstChild()) ? (n.removeAttribute("role"), n.removeAttribute("tabIndex"), n.removeAttribute("aria-checked")) : (n.setAttribute("role", "checkbox"), n.setAttribute("tabIndex", "-1"), e && t.__checked === e.__checked || n.setAttribute("aria-checked", t.getChecked() ? "true" : "false"));
|
|
457
|
-
}
|
|
458
|
-
function Pt(n) {
|
|
459
|
-
if (n.classList.contains("task-list-item")) {
|
|
460
|
-
for (const e of n.children) if (e.tagName === "INPUT") return Tt(e);
|
|
461
|
-
}
|
|
462
|
-
const t = n.getAttribute("aria-checked");
|
|
463
|
-
return { node: f(t === "true" || t !== "false" && void 0) };
|
|
464
|
-
}
|
|
465
|
-
function Tt(n) {
|
|
466
|
-
return n.getAttribute("type") !== "checkbox" ? { node: null } : { node: f(n.hasAttribute("checked")) };
|
|
467
|
-
}
|
|
468
|
-
function f(n) {
|
|
469
|
-
return j(new C(void 0, n));
|
|
470
|
-
}
|
|
471
|
-
function h(n) {
|
|
472
|
-
return n instanceof C;
|
|
473
|
-
}
|
|
474
|
-
class L extends J {
|
|
475
|
-
static getType() {
|
|
476
|
-
return "list";
|
|
477
|
-
}
|
|
478
|
-
static clone(t) {
|
|
479
|
-
const e = t.__listType || V[t.__tag];
|
|
480
|
-
return new L(e, t.__start, t.__key);
|
|
481
|
-
}
|
|
482
|
-
constructor(t, e, r) {
|
|
483
|
-
super(r);
|
|
484
|
-
const i = V[t] || t;
|
|
485
|
-
this.__listType = i, this.__tag = i === "number" ? "ol" : "ul", this.__start = e;
|
|
486
|
-
}
|
|
487
|
-
getTag() {
|
|
488
|
-
return this.__tag;
|
|
489
|
-
}
|
|
490
|
-
setListType(t) {
|
|
491
|
-
const e = this.getWritable();
|
|
492
|
-
e.__listType = t, e.__tag = t === "number" ? "ol" : "ul";
|
|
493
|
-
}
|
|
494
|
-
getListType() {
|
|
495
|
-
return this.__listType;
|
|
496
|
-
}
|
|
497
|
-
getStart() {
|
|
498
|
-
return this.__start;
|
|
499
|
-
}
|
|
500
|
-
createDOM(t, e) {
|
|
501
|
-
const r = this.__tag, i = document.createElement(r);
|
|
502
|
-
return this.__start !== 1 && i.setAttribute("start", String(this.__start)), i.__lexicalListType = this.__listType, U(i, t.theme, this), i;
|
|
503
|
-
}
|
|
504
|
-
updateDOM(t, e, r) {
|
|
505
|
-
return t.__tag !== this.__tag || (U(e, r.theme, this), !1);
|
|
506
|
-
}
|
|
507
|
-
static transform() {
|
|
508
|
-
return (t) => {
|
|
509
|
-
a(t) || p(163), function(e) {
|
|
510
|
-
const r = e.getNextSibling();
|
|
511
|
-
a(r) && e.getListType() === r.getListType() && E(e, r);
|
|
512
|
-
}(t), function(e) {
|
|
513
|
-
const r = e.getListType() !== "check";
|
|
514
|
-
let i = e.getStart();
|
|
515
|
-
for (const s of e.getChildren()) h(s) && (s.getValue() !== i && s.setValue(i), r && s.getLatest().__checked != null && s.setChecked(void 0), a(s.getFirstChild()) || i++);
|
|
516
|
-
}(t);
|
|
517
|
-
};
|
|
518
|
-
}
|
|
519
|
-
static importDOM() {
|
|
520
|
-
return { ol: () => ({ conversion: z, priority: 0 }), ul: () => ({ conversion: z, priority: 0 }) };
|
|
521
|
-
}
|
|
522
|
-
static importJSON(t) {
|
|
523
|
-
const e = g(t.listType, t.start);
|
|
524
|
-
return e.setFormat(t.format), e.setIndent(t.indent), e.setDirection(t.direction), e;
|
|
525
|
-
}
|
|
526
|
-
exportDOM(t) {
|
|
527
|
-
const { element: e } = super.exportDOM(t);
|
|
528
|
-
return e && q(e) && (this.__start !== 1 && e.setAttribute("start", String(this.__start)), this.__listType === "check" && e.setAttribute("__lexicalListType", "check")), { element: e };
|
|
529
|
-
}
|
|
530
|
-
exportJSON() {
|
|
531
|
-
return { ...super.exportJSON(), listType: this.getListType(), start: this.getStart(), tag: this.getTag(), type: "list", version: 1 };
|
|
532
|
-
}
|
|
533
|
-
canBeEmpty() {
|
|
534
|
-
return !1;
|
|
535
|
-
}
|
|
536
|
-
canIndent() {
|
|
537
|
-
return !1;
|
|
538
|
-
}
|
|
539
|
-
append(...t) {
|
|
540
|
-
for (let e = 0; e < t.length; e++) {
|
|
541
|
-
const r = t[e];
|
|
542
|
-
if (h(r)) super.append(r);
|
|
543
|
-
else {
|
|
544
|
-
const i = f();
|
|
545
|
-
if (a(r)) i.append(r);
|
|
546
|
-
else if (v(r)) {
|
|
547
|
-
const s = st(r.getTextContent());
|
|
548
|
-
i.append(s);
|
|
549
|
-
} else i.append(r);
|
|
550
|
-
super.append(i);
|
|
551
|
-
}
|
|
552
|
-
}
|
|
553
|
-
return this;
|
|
554
|
-
}
|
|
555
|
-
extractWithChild(t) {
|
|
556
|
-
return h(t);
|
|
557
|
-
}
|
|
558
|
-
}
|
|
559
|
-
function U(n, t, e) {
|
|
560
|
-
const r = [], i = [], s = t.list;
|
|
561
|
-
if (s !== void 0) {
|
|
562
|
-
const o = s[`${e.__tag}Depth`] || [], c = vt(e) - 1, l = c % o.length, u = o[l], d = s[e.__tag];
|
|
563
|
-
let S;
|
|
564
|
-
const w = s.nested, M = s.checklist;
|
|
565
|
-
if (w !== void 0 && w.list && (S = w.list), d !== void 0 && r.push(d), M !== void 0 && e.__listType === "check" && r.push(M), u !== void 0) {
|
|
566
|
-
r.push(...P(u));
|
|
567
|
-
for (let _ = 0; _ < o.length; _++) _ !== l && i.push(e.__tag + _);
|
|
568
|
-
}
|
|
569
|
-
if (S !== void 0) {
|
|
570
|
-
const _ = P(S);
|
|
571
|
-
c > 1 ? r.push(..._) : i.push(..._);
|
|
572
|
-
}
|
|
573
|
-
}
|
|
574
|
-
i.length > 0 && Q(n, ...i), r.length > 0 && H(n, ...r);
|
|
575
|
-
}
|
|
576
|
-
function Lt(n) {
|
|
577
|
-
const t = [];
|
|
578
|
-
for (let e = 0; e < n.length; e++) {
|
|
579
|
-
const r = n[e];
|
|
580
|
-
if (h(r)) {
|
|
581
|
-
t.push(r);
|
|
582
|
-
const i = r.getChildren();
|
|
583
|
-
i.length > 1 && i.forEach((s) => {
|
|
584
|
-
a(s) && t.push(D(s));
|
|
585
|
-
});
|
|
586
|
-
} else t.push(D(r));
|
|
587
|
-
}
|
|
588
|
-
return t;
|
|
589
|
-
}
|
|
590
|
-
function z(n) {
|
|
591
|
-
const t = n.nodeName.toLowerCase();
|
|
592
|
-
let e = null;
|
|
593
|
-
return t === "ol" ? e = g("number", n.start) : t === "ul" && (e = function(r) {
|
|
594
|
-
if (r.getAttribute("__lexicallisttype") === "check" || r.classList.contains("contains-task-list")) return !0;
|
|
595
|
-
for (const i of r.childNodes) if (q(i) && i.hasAttribute("aria-checked")) return !0;
|
|
596
|
-
return !1;
|
|
597
|
-
}(n) ? g("check") : g("bullet")), { after: Lt, node: e };
|
|
598
|
-
}
|
|
599
|
-
const V = { ol: "number", ul: "bullet" };
|
|
600
|
-
function g(n, t = 1) {
|
|
601
|
-
return j(new L(n, t));
|
|
602
|
-
}
|
|
603
|
-
function a(n) {
|
|
604
|
-
return n instanceof L;
|
|
605
|
-
}
|
|
606
|
-
const et = F(), nt = F(), rt = F();
|
|
607
|
-
function Dt(n) {
|
|
608
|
-
return ft(n.registerCommand(nt, () => ($(n, "number"), !0), k), n.registerCommand(et, () => ($(n, "bullet"), !0), k), n.registerCommand(rt, () => (bt(n), !0), k), n.registerCommand(ot, () => !!kt(), k));
|
|
609
|
-
}
|
|
610
|
-
const St = {
|
|
611
|
-
bullet: "FormatUnorderedList",
|
|
612
|
-
number: "FormatOrderedLists"
|
|
613
|
-
}, wt = ["bullet", "number"], $t = ({ isOList: n = !1, isUList: t = !1 }) => {
|
|
614
|
-
const [e] = ct(), [r, i] = lt("paragraph"), s = (o) => {
|
|
615
|
-
o === "number" && r !== "number" ? (e.dispatchCommand(nt, void 0), i("number")) : o === "bullet" && r !== "bullet" ? (e.dispatchCommand(et, void 0), i("bullet")) : (e.dispatchCommand(rt, void 0), i("paragraph"));
|
|
616
|
-
};
|
|
617
|
-
return /* @__PURE__ */ x("div", { className: y["editor__toolbar-button-group"], children: wt.map((o) => /* @__PURE__ */ x(
|
|
618
|
-
"button",
|
|
619
|
-
{
|
|
620
|
-
onClick: () => s(o),
|
|
621
|
-
className: at(
|
|
622
|
-
y["editor__toolbar-button"],
|
|
623
|
-
y[`editor__toolbar-button--${o}`],
|
|
624
|
-
o === "bullet" && t && y["editor__toolbar-button--active"],
|
|
625
|
-
o === "number" && n && y["editor__toolbar-button--active"]
|
|
626
|
-
),
|
|
627
|
-
children: /* @__PURE__ */ x(ut, { name: St[o], size: 20 })
|
|
628
|
-
},
|
|
629
|
-
o
|
|
630
|
-
)) });
|
|
631
|
-
};
|
|
632
|
-
export {
|
|
633
|
-
C as D,
|
|
634
|
-
a as H,
|
|
635
|
-
L as J,
|
|
636
|
-
$t as L,
|
|
637
|
-
Dt as Z,
|
|
638
|
-
ft as a,
|
|
639
|
-
Et as e,
|
|
640
|
-
Mt as i,
|
|
641
|
-
mt as t
|
|
642
|
-
};
|
|
643
|
-
//# sourceMappingURL=ListPlugin-Bu2AbCDB.js.map
|