gbrichtext 0.1.0 → 0.1.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.
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import { getCurrentInstance as
|
|
2
|
-
import { gbToast as Kt, FONT_SIZES as Je, GbImageViewer as
|
|
1
|
+
import { getCurrentInstance as xi, getCurrentScope as Li, onScopeDispose as Mi, computed as j, openBlock as N, createElementBlock as D, createBlock as J, unref as q, normalizeProps as ro, guardReactiveProps as io, ref as S, reactive as Ni, watch as Ie, onBeforeUnmount as Rt, shallowRef as Ri, onMounted as lr, normalizeStyle as Z, normalizeClass as be, renderSlot as de, createElementVNode as I, createCommentVNode as U, withModifiers as te, toDisplayString as pe, createVNode as B, Fragment as nt, renderList as xt, nextTick as rt, withCtx as re, withDirectives as sr, withKeys as et, vModelText as ar, createTextVNode as wo, Teleport as Oi, Transition as Bi, markRaw as Ii, h as Hi, defineAsyncComponent as zi, createSlots as Di } from "vue";
|
|
2
|
+
import { gbToast as Kt, FONT_SIZES as Je, GbImageViewer as $i, GbPopover as _i, RECENT_STYLE_LIMIT as Pi, FONT_FAMILIES as xo, GbAppearancePanel as cr, ALIGN_OPTIONS as Fi, GbTableSizePicker as qi, GbButton as Lo, GbContextMenu as Ui, TEXT_COLORS as Vi, GbFindBar as Gi } from "guabiui";
|
|
3
3
|
const ge = {
|
|
4
4
|
info: (e, t) => Kt.info(e, t),
|
|
5
5
|
success: (e, t) => Kt.success(e, t),
|
|
6
6
|
warning: (e, t) => Kt.warning(e, t),
|
|
7
7
|
error: (e, t) => Kt.error(e, t)
|
|
8
|
-
}, Mo = 50 * 1024 * 1024,
|
|
8
|
+
}, Mo = 50 * 1024 * 1024, Ki = (e) => {
|
|
9
9
|
if (!e || !/<img\s/i.test(e)) return e || "";
|
|
10
10
|
const t = new DOMParser().parseFromString(e, "text/html");
|
|
11
11
|
return t.querySelectorAll("img:not([loading])").forEach((n) => n.setAttribute("loading", "lazy")), t.body.innerHTML;
|
|
12
|
-
},
|
|
12
|
+
}, Xi = (e) => new Promise((t, n) => {
|
|
13
13
|
const o = new FileReader();
|
|
14
14
|
o.onload = (r) => t(r.target.result), o.onerror = (r) => n(r), o.readAsDataURL(e);
|
|
15
|
-
}),
|
|
15
|
+
}), ur = (e) => {
|
|
16
16
|
const t = [];
|
|
17
17
|
if (!e) return t;
|
|
18
18
|
if (e.items?.length) {
|
|
@@ -24,7 +24,7 @@ const ge = {
|
|
|
24
24
|
} else e.files?.length && t.push(...Array.from(e.files).filter((n) => n.type.startsWith("image/")));
|
|
25
25
|
return t;
|
|
26
26
|
};
|
|
27
|
-
async function
|
|
27
|
+
async function ji(e) {
|
|
28
28
|
const t = [];
|
|
29
29
|
for (const n of e || []) {
|
|
30
30
|
if (n.size > Mo) {
|
|
@@ -32,15 +32,15 @@ async function Xi(e) {
|
|
|
32
32
|
continue;
|
|
33
33
|
}
|
|
34
34
|
try {
|
|
35
|
-
t.push({ file: n, src: await
|
|
35
|
+
t.push({ file: n, src: await Xi(n) });
|
|
36
36
|
} catch {
|
|
37
37
|
ge.error("图片读取失败");
|
|
38
38
|
}
|
|
39
39
|
}
|
|
40
40
|
return t;
|
|
41
41
|
}
|
|
42
|
-
const
|
|
43
|
-
function
|
|
42
|
+
const Wi = /* @__PURE__ */ new Set(["P", "H1", "H2", "H3", "H4", "H5", "H6", "TD", "TH"]), Yi = /* @__PURE__ */ new Set(["BLOCKQUOTE", "UL", "OL", "PRE", "TABLE", "HR", "IMG", "LI"]), Qi = /* @__PURE__ */ new Set(["P", "H1", "H2", "H3", "H4", "H5", "H6", "TD", "TH", "LI", "BLOCKQUOTE"]), He = "data-callout", fe = "data-super", ye = "data-col", Ot = (e) => !!e && e.nodeType === Node.ELEMENT_NODE && (e.hasAttribute(He) || e.hasAttribute(fe)), mn = (e) => !!e && e.nodeType === Node.ELEMENT_NODE && e.hasAttribute(ye), Fn = "is-selected-node", At = "is-block-dragging", dr = "re-cell-dragging", Zi = "is-catalog-hit", Tt = "is-block-selected", qn = "is-block-hover", tn = [Fn, At, dr, Zi, Tt, qn], Ji = ["data-attach", "data-ref-doc"], el = "[data-attach],[data-ref-doc]", nn = ".wd-page-gap, .wd-col-sep", tl = ".wd-col", Zt = "data-wd-split", it = (e) => e?.nodeType === Node.ELEMENT_NODE && (e.matches(nn) || e.hasAttribute(Zt));
|
|
43
|
+
function fr(e) {
|
|
44
44
|
if (!e?.querySelector) return;
|
|
45
45
|
const t = /* @__PURE__ */ new Map();
|
|
46
46
|
e.querySelectorAll(`[${Zt}]`).forEach((n) => {
|
|
@@ -56,26 +56,26 @@ function dr(e) {
|
|
|
56
56
|
}
|
|
57
57
|
Ce(r, o), r.remove();
|
|
58
58
|
}), o.removeAttribute(Zt);
|
|
59
|
-
}), e.querySelectorAll(
|
|
59
|
+
}), e.querySelectorAll(tl).forEach((n) => Ht(n)), e.querySelectorAll(nn).forEach((n) => n.remove());
|
|
60
60
|
}
|
|
61
|
-
const
|
|
61
|
+
const nl = tn.map((e) => `.${e}`).join(",");
|
|
62
62
|
function pn(e) {
|
|
63
63
|
if (!e?.classList?.length || !tn.some((n) => e.classList.contains(n))) return;
|
|
64
64
|
const t = Array.from(e.classList).filter((n) => !tn.includes(n));
|
|
65
65
|
t.length ? e.setAttribute("class", t.join(" ")) : e.removeAttribute("class");
|
|
66
66
|
}
|
|
67
|
-
const we = (e) => !!e && e.tagName === "LI" && e.hasAttribute("data-checked"), lo = (e) => !!e && e.tagName === "DIV" && we(e.parentElement),
|
|
68
|
-
function
|
|
69
|
-
return !e || e.nodeType !== Node.ELEMENT_NODE ? !1 :
|
|
67
|
+
const we = (e) => !!e && e.tagName === "LI" && e.hasAttribute("data-checked"), lo = (e) => !!e && e.tagName === "DIV" && we(e.parentElement), hr = (e) => !!e && e.tagName === "CODE" && e.parentElement?.tagName === "PRE";
|
|
68
|
+
function mr(e) {
|
|
69
|
+
return !e || e.nodeType !== Node.ELEMENT_NODE ? !1 : Wi.has(e.tagName) ? !0 : e.tagName === "LI" ? !we(e) : lo(e) || hr(e);
|
|
70
70
|
}
|
|
71
71
|
function Re(e, t) {
|
|
72
|
-
return
|
|
72
|
+
return mr(e) && !!t && e !== t && t.contains(e);
|
|
73
73
|
}
|
|
74
|
-
function
|
|
75
|
-
return !e || e === t || !t.contains(e) ? !1 :
|
|
74
|
+
function ol(e, t) {
|
|
75
|
+
return !e || e === t || !t.contains(e) ? !1 : Yi.has(e.tagName) || Re(e, t) || Ot(e) || mn(e);
|
|
76
76
|
}
|
|
77
77
|
function on(e) {
|
|
78
|
-
return !!e && (
|
|
78
|
+
return !!e && (Qi.has(e.tagName) || mr(e) && e.tagName !== "CODE");
|
|
79
79
|
}
|
|
80
80
|
function X(e, t) {
|
|
81
81
|
let n = e?.nodeType === Node.TEXT_NODE ? e.parentElement : e;
|
|
@@ -85,15 +85,15 @@ function X(e, t) {
|
|
|
85
85
|
}
|
|
86
86
|
return null;
|
|
87
87
|
}
|
|
88
|
-
function
|
|
88
|
+
function pr(e, t, n) {
|
|
89
89
|
const o = [];
|
|
90
90
|
let r = e?.nodeType === Node.TEXT_NODE ? e.parentElement : e;
|
|
91
91
|
for (; r && r !== t; )
|
|
92
92
|
o.unshift(r), r = r.parentElement;
|
|
93
93
|
return o.find(n) || null;
|
|
94
94
|
}
|
|
95
|
-
const Ke = (e, t) =>
|
|
96
|
-
function
|
|
95
|
+
const Ke = (e, t) => pr(e, t, (n) => ol(n, t)), rl = (e, t) => pr(e, t, (n) => on(n) || lo(n));
|
|
96
|
+
function il(e) {
|
|
97
97
|
return lo(e) ? e.parentElement : e;
|
|
98
98
|
}
|
|
99
99
|
function Bt(e) {
|
|
@@ -107,7 +107,7 @@ function It(e) {
|
|
|
107
107
|
for (const n of Array.from(e.childNodes)) t += It(n);
|
|
108
108
|
return t;
|
|
109
109
|
}
|
|
110
|
-
function
|
|
110
|
+
function ll(e, t) {
|
|
111
111
|
let n = 0;
|
|
112
112
|
const o = (i) => i.tagName === "BR" || i.tagName === "IMG" || i.getAttribute("contenteditable") === "false" || !i.childNodes.length, r = (i) => {
|
|
113
113
|
for (const l of Array.from(i.childNodes)) {
|
|
@@ -125,7 +125,7 @@ function il(e, t) {
|
|
|
125
125
|
function ae(e, t, n) {
|
|
126
126
|
if (!e || !t) return 0;
|
|
127
127
|
if (t === e) return No(e, n);
|
|
128
|
-
const o =
|
|
128
|
+
const o = ll(e, (r) => r === t);
|
|
129
129
|
return o < 0 ? Ae(e) : t.nodeType === Node.TEXT_NODE ? o + Math.min(n, t.data.length) : o + No(t, n);
|
|
130
130
|
}
|
|
131
131
|
function No(e, t) {
|
|
@@ -144,7 +144,7 @@ function so(e) {
|
|
|
144
144
|
let t = "";
|
|
145
145
|
const n = (o) => {
|
|
146
146
|
for (const r of Array.from(o.childNodes))
|
|
147
|
-
r.nodeType === Node.TEXT_NODE ? t += r.data : r.tagName === "IMG" || r.nodeType === Node.ELEMENT_NODE &&
|
|
147
|
+
r.nodeType === Node.TEXT_NODE ? t += r.data : r.tagName === "IMG" || r.nodeType === Node.ELEMENT_NODE && Ji.some((i) => r.hasAttribute(i)) ? t += "" : Bt(r) && n(r);
|
|
148
148
|
};
|
|
149
149
|
return e && n(e), t;
|
|
150
150
|
}
|
|
@@ -192,14 +192,14 @@ function ao(e, t) {
|
|
|
192
192
|
const n = V(e);
|
|
193
193
|
if (!n) return [];
|
|
194
194
|
const o = X(n.commonAncestorContainer, e), r = (l, s) => l === s || s.contains(l), i = [];
|
|
195
|
-
for (const l of
|
|
195
|
+
for (const l of gr(e)) {
|
|
196
196
|
if (l !== o && !n.intersectsNode(l)) continue;
|
|
197
197
|
const s = Ae(l), a = r(n.startContainer, l) ? ae(l, n.startContainer, n.startOffset) : 0, c = r(n.endContainer, l) ? ae(l, n.endContainer, n.endOffset) : s;
|
|
198
198
|
c < a || c === a && l !== X(n.startContainer, e) || i.push({ block: l, start: Math.min(Math.max(a, 0), s), end: Math.min(Math.max(c, 0), s) });
|
|
199
199
|
}
|
|
200
200
|
return i;
|
|
201
201
|
}
|
|
202
|
-
function
|
|
202
|
+
function gr(e) {
|
|
203
203
|
const t = [], n = (o) => {
|
|
204
204
|
for (const r of Array.from(o.children))
|
|
205
205
|
if (Bt(r)) {
|
|
@@ -249,20 +249,20 @@ function Xt(e) {
|
|
|
249
249
|
function Ce(e, t) {
|
|
250
250
|
for (; e.firstChild; ) t.appendChild(e.firstChild);
|
|
251
251
|
}
|
|
252
|
-
function
|
|
252
|
+
function vr(e) {
|
|
253
253
|
const t = e?.parentNode;
|
|
254
254
|
if (t)
|
|
255
255
|
for (; e.firstChild; ) t.insertBefore(e.firstChild, e);
|
|
256
256
|
}
|
|
257
257
|
function Ht(e) {
|
|
258
|
-
e?.parentNode && (
|
|
258
|
+
e?.parentNode && (vr(e), e.remove());
|
|
259
259
|
}
|
|
260
260
|
function Te(e, t) {
|
|
261
261
|
if (e.tagName.toLowerCase() === t) return e;
|
|
262
262
|
const n = document.createElement(t);
|
|
263
|
-
return
|
|
263
|
+
return sl(e, n), Ce(e, n), e.replaceWith(n), n;
|
|
264
264
|
}
|
|
265
|
-
function
|
|
265
|
+
function sl(e, t) {
|
|
266
266
|
for (const n of Array.from(e.attributes))
|
|
267
267
|
n.name !== "contenteditable" && t.setAttribute(n.name, n.value);
|
|
268
268
|
pn(t);
|
|
@@ -274,12 +274,12 @@ function co(e, t) {
|
|
|
274
274
|
return t;
|
|
275
275
|
}
|
|
276
276
|
function ze(e) {
|
|
277
|
-
return e ? e.querySelector("img") || e.querySelector(
|
|
277
|
+
return e ? e.querySelector("img") || e.querySelector(el) ? !1 : !so(e).replace(/[\n]/g, "").length : !0;
|
|
278
278
|
}
|
|
279
279
|
function Lt(e) {
|
|
280
280
|
return !!e && (!!e.textContent?.trim() || !!e.querySelector("img,input,br,[data-attach],[data-ref-doc]"));
|
|
281
281
|
}
|
|
282
|
-
function
|
|
282
|
+
function br(e, t, n) {
|
|
283
283
|
const o = e.ownerDocument, r = o.caretPositionFromPoint?.(t, n) || null;
|
|
284
284
|
if (r && e.contains(r.offsetNode)) return { node: r.offsetNode, offset: r.offset };
|
|
285
285
|
const i = o.caretRangeFromPoint?.(t, n) || null;
|
|
@@ -287,15 +287,15 @@ function vr(e, t, n) {
|
|
|
287
287
|
const l = o.elementFromPoint(t, n);
|
|
288
288
|
return l && e.contains(l) ? { node: l, offset: 0 } : null;
|
|
289
289
|
}
|
|
290
|
-
function
|
|
291
|
-
const o =
|
|
290
|
+
function al(e, t, n) {
|
|
291
|
+
const o = br(e, t, n);
|
|
292
292
|
if (!o) return null;
|
|
293
293
|
const r = o.node.nodeType === Node.TEXT_NODE ? o.node.parentElement : o.node;
|
|
294
294
|
if ($e(r, e)) return null;
|
|
295
|
-
const l = Ke(r, e) ||
|
|
295
|
+
const l = Ke(r, e) || yr(e, n);
|
|
296
296
|
return it(l) ? null : l;
|
|
297
297
|
}
|
|
298
|
-
function
|
|
298
|
+
function yr(e, t) {
|
|
299
299
|
let n = null, o = 1 / 0;
|
|
300
300
|
for (const r of Array.from(e.children)) {
|
|
301
301
|
const i = r.getBoundingClientRect();
|
|
@@ -314,7 +314,7 @@ function Xe(e, t, n) {
|
|
|
314
314
|
return null;
|
|
315
315
|
}
|
|
316
316
|
const zt = (e) => !!e && (e.tagName === "TD" || e.tagName === "TH"), De = (e, t) => Xe(e, zt, t), $e = (e, t) => Xe(e, (n) => n.tagName === "TABLE", t);
|
|
317
|
-
function
|
|
317
|
+
function cl(e) {
|
|
318
318
|
if (!e) return null;
|
|
319
319
|
const t = e.getBoundingClientRect();
|
|
320
320
|
if (t.height) return t;
|
|
@@ -327,7 +327,7 @@ function ke(e, t) {
|
|
|
327
327
|
function Mt(e, t, n) {
|
|
328
328
|
e && (n == null || n === "" ? e.style.removeProperty(t) : e.style.setProperty(t, String(n)), e.getAttribute("style") === "" && e.removeAttribute("style"));
|
|
329
329
|
}
|
|
330
|
-
function
|
|
330
|
+
function kr(e, t, n) {
|
|
331
331
|
const o = Ve(e, t), r = Ve(e, n), i = document.createRange();
|
|
332
332
|
return i.setStart(o.node, o.offset), i.setEnd(r.node, r.offset), i;
|
|
333
333
|
}
|
|
@@ -342,14 +342,14 @@ function he(e, t) {
|
|
|
342
342
|
}
|
|
343
343
|
return null;
|
|
344
344
|
}
|
|
345
|
-
function
|
|
345
|
+
function ul(e, t) {
|
|
346
346
|
const n = [];
|
|
347
347
|
let o = e;
|
|
348
348
|
for (; o && o !== t && o.parentElement; )
|
|
349
349
|
n.unshift(Array.prototype.indexOf.call(o.parentElement.childNodes, o)), o = o.parentElement;
|
|
350
350
|
return o === t ? n : null;
|
|
351
351
|
}
|
|
352
|
-
function
|
|
352
|
+
function dl(e, t) {
|
|
353
353
|
if (!t?.length) return null;
|
|
354
354
|
let n = e;
|
|
355
355
|
for (const o of t)
|
|
@@ -357,16 +357,16 @@ function ul(e, t) {
|
|
|
357
357
|
return n.nodeType === Node.ELEMENT_NODE ? n : null;
|
|
358
358
|
}
|
|
359
359
|
const zn = "richtext-search", Dn = "richtext-search-current", Oo = () => typeof Highlight < "u" && typeof CSS < "u" && CSS.highlights;
|
|
360
|
-
function
|
|
360
|
+
function fl(e) {
|
|
361
361
|
let t = "", n = !1, o = -1, r = [];
|
|
362
362
|
const i = () => {
|
|
363
363
|
if (r = [], !t) return;
|
|
364
364
|
const h = n ? t : t.toLowerCase();
|
|
365
|
-
for (const g of
|
|
365
|
+
for (const g of gr(e)) {
|
|
366
366
|
const A = so(g), M = n ? A : A.toLowerCase();
|
|
367
367
|
let L = M.indexOf(h);
|
|
368
368
|
for (; L !== -1; )
|
|
369
|
-
r.push(
|
|
369
|
+
r.push(kr(g, L, L + h.length)), L = M.indexOf(h, L + h.length);
|
|
370
370
|
}
|
|
371
371
|
o = r.length ? Math.min(Math.max(o, 0), r.length - 1) : -1;
|
|
372
372
|
}, l = () => {
|
|
@@ -392,10 +392,10 @@ function dl(e) {
|
|
|
392
392
|
}
|
|
393
393
|
return { refresh: s, setKeyword: a, clear: c, snapshot: u, next: () => f(1), prev: () => f(-1), replaceCurrent: y, replaceAll: E, scrollToActive: m };
|
|
394
394
|
}
|
|
395
|
-
const
|
|
395
|
+
const hl = /^(?:https?:|mailto:|tel:|ftp:|#|\/)/i, Cr = /^(?:https?:|data:image\/|blob:|\/)/i, Er = (e) => {
|
|
396
396
|
const t = String(e ?? "").replace(/[\t\n\r]/g, "").trim();
|
|
397
|
-
return t === "" ? !1 : /^[a-z][a-z0-9+.-]*:/i.test(t) ?
|
|
398
|
-
}, uo = (e) => String(e ?? "").replace(/[\u0000-\u001f\u007f;{}()\\'"!<>]/g, "").replace(/\s+/g, " ").trim().slice(0, 120),
|
|
397
|
+
return t === "" ? !1 : /^[a-z][a-z0-9+.-]*:/i.test(t) ? hl.test(t) : !0;
|
|
398
|
+
}, uo = (e) => String(e ?? "").replace(/[\u0000-\u001f\u007f;{}()\\'"!<>]/g, "").replace(/\s+/g, " ").trim().slice(0, 120), ml = /* @__PURE__ */ new Set(["script", "style", "link", "meta", "title", "head", "iframe", "object", "embed", "form", "button", "select", "textarea"]), H = {
|
|
399
399
|
INS: "doc-ins",
|
|
400
400
|
DEL: "doc-del",
|
|
401
401
|
COMMENT: "doc-comment",
|
|
@@ -408,14 +408,14 @@ const fl = /^(?:https?:|mailto:|tel:|ftp:|#|\/)/i, kr = /^(?:https?:|data:image\
|
|
|
408
408
|
ATTACH: "doc-attach",
|
|
409
409
|
REF: "doc-ref",
|
|
410
410
|
EMBED: "doc-embed"
|
|
411
|
-
}, fo = "data-cmt", vn = "data-fn", lt = "data-attach", le = "data-ref-doc", Ge = "data-ref-block", Dt = "data-ref-sub",
|
|
411
|
+
}, fo = "data-cmt", vn = "data-fn", lt = "data-attach", le = "data-ref-doc", Ge = "data-ref-block", Dt = "data-ref-sub", Ar = "data-color-theme", Tr = "data-color-theme-tint", Sr = "data-color-theme-shade", wr = ["data-re-runtime", "spellcheck", "autocorrect"], pl = ["x-small", "small", "medium", "large", "x-large", "xx-large", "xxx-large"];
|
|
412
412
|
function bn(e, { editable: t = !1 } = {}) {
|
|
413
|
-
if (
|
|
413
|
+
if (fr(e), vl(e), gl(e), El(e), kl(e), Al(e), Tl(e), Sl(e), xl(e), Ll(e), Ml(e), Nl(e), Rl(e), wl(e), t && !e.querySelector("p,h1,h2,h3,h4,h5,h6,ul,ol,blockquote,pre,table,hr,img")) {
|
|
414
414
|
const n = document.createElement("p");
|
|
415
415
|
n.appendChild(document.createElement("br")), e.appendChild(n);
|
|
416
416
|
}
|
|
417
417
|
}
|
|
418
|
-
function
|
|
418
|
+
function gl(e) {
|
|
419
419
|
for (let t = 0; t < 12; t += 1) {
|
|
420
420
|
const n = Array.from(e.querySelectorAll("span")).filter((o) => !o.hasAttributes());
|
|
421
421
|
if (!n.length) return;
|
|
@@ -423,43 +423,43 @@ function pl(e) {
|
|
|
423
423
|
Ht(o);
|
|
424
424
|
}
|
|
425
425
|
}
|
|
426
|
-
function
|
|
426
|
+
function vl(e) {
|
|
427
427
|
const t = document.createTreeWalker(e, NodeFilter.SHOW_COMMENT | NodeFilter.SHOW_ELEMENT), n = [];
|
|
428
428
|
let o = t.currentNode;
|
|
429
429
|
for (o.nodeType === Node.COMMENT_NODE && n.push(o); t.nextNode(); ) {
|
|
430
430
|
const r = t.currentNode;
|
|
431
|
-
(r.nodeType === Node.COMMENT_NODE ||
|
|
431
|
+
(r.nodeType === Node.COMMENT_NODE || ml.has(r.tagName.toLowerCase())) && n.push(r);
|
|
432
432
|
}
|
|
433
433
|
n.forEach((r) => r.remove());
|
|
434
434
|
for (const r of Array.from(e.querySelectorAll("*")))
|
|
435
435
|
if (r.nodeType === Node.ELEMENT_NODE) {
|
|
436
|
-
for (const i of
|
|
437
|
-
pn(r), r.getAttribute("contenteditable") === "false" && r.tagName !== "INPUT" && r.removeAttribute("contenteditable"),
|
|
436
|
+
for (const i of wr) r.removeAttribute(i);
|
|
437
|
+
pn(r), r.getAttribute("contenteditable") === "false" && r.tagName !== "INPUT" && r.removeAttribute("contenteditable"), bl(r), yl(r);
|
|
438
438
|
}
|
|
439
439
|
}
|
|
440
|
-
function
|
|
440
|
+
function bl(e) {
|
|
441
441
|
if (e.tagName === "A") {
|
|
442
442
|
const t = e.getAttribute("href") || "";
|
|
443
|
-
|
|
443
|
+
Er(t) ? (e.setAttribute("target", "_blank"), e.setAttribute("rel", "noopener noreferrer nofollow")) : e.removeAttribute("href");
|
|
444
444
|
}
|
|
445
445
|
if (e.tagName === "IMG") {
|
|
446
446
|
const t = (e.getAttribute("src") || "").trim();
|
|
447
447
|
if (!t) return;
|
|
448
|
-
|
|
448
|
+
Cr.test(t) || e.remove();
|
|
449
449
|
}
|
|
450
450
|
}
|
|
451
|
-
function
|
|
451
|
+
function yl(e) {
|
|
452
452
|
if (e.tagName !== "FONT") return;
|
|
453
453
|
const t = [];
|
|
454
454
|
e.getAttribute("color") && t.push(`color: ${e.getAttribute("color")}`);
|
|
455
455
|
const n = uo(e.getAttribute("face"));
|
|
456
456
|
n && t.push(`font-family: ${n}`);
|
|
457
457
|
const o = Number(e.getAttribute("size"));
|
|
458
|
-
o && t.push(`font-size: ${
|
|
458
|
+
o && t.push(`font-size: ${pl[Math.min(Math.max(o, 1), 7) - 1]}`);
|
|
459
459
|
const r = document.createElement("span");
|
|
460
460
|
t.length && r.setAttribute("style", t.join("; ")), Ce(e, r), e.replaceWith(r);
|
|
461
461
|
}
|
|
462
|
-
function
|
|
462
|
+
function kl(e) {
|
|
463
463
|
const t = [e, ...Array.from(e.querySelectorAll("blockquote, [data-callout], [data-super], [data-col]"))];
|
|
464
464
|
for (const n of t) {
|
|
465
465
|
let o = null;
|
|
@@ -468,7 +468,7 @@ function yl(e) {
|
|
|
468
468
|
r.remove();
|
|
469
469
|
continue;
|
|
470
470
|
}
|
|
471
|
-
if (!(r.nodeType === Node.TEXT_NODE || r.nodeType === Node.ELEMENT_NODE && !
|
|
471
|
+
if (!(r.nodeType === Node.TEXT_NODE || r.nodeType === Node.ELEMENT_NODE && !Cl(r))) {
|
|
472
472
|
o = null;
|
|
473
473
|
continue;
|
|
474
474
|
}
|
|
@@ -476,14 +476,14 @@ function yl(e) {
|
|
|
476
476
|
}
|
|
477
477
|
}
|
|
478
478
|
}
|
|
479
|
-
function
|
|
479
|
+
function Cl(e) {
|
|
480
480
|
return /^(P|H[1-6]|UL|OL|BLOCKQUOTE|PRE|TABLE|HR|DIV|LI|TBODY|THEAD|TFOOT|TR|TD|TH|COLGROUP|CAPTION|IMG)$/.test(e.tagName);
|
|
481
481
|
}
|
|
482
|
-
function
|
|
482
|
+
function El(e) {
|
|
483
483
|
for (const t of Array.from(e.querySelectorAll("div")))
|
|
484
484
|
we(t.parentElement) || zt(t.parentElement) || t.classList.contains(H.PAGEBREAK) || t.classList.contains(H.SECTIONBREAK) || t.classList.contains(H.TOC) || t.hasAttribute(le) || Ot(t) || mn(t) || t.replaceWith(Te(t, "p"));
|
|
485
485
|
}
|
|
486
|
-
function
|
|
486
|
+
function Al(e) {
|
|
487
487
|
const t = Array.from(e.querySelectorAll("li,td,th"));
|
|
488
488
|
for (const n of t) {
|
|
489
489
|
const o = Array.from(n.children).filter((i) => /^(P|H[1-6])$/.test(i.tagName));
|
|
@@ -494,7 +494,7 @@ function El(e) {
|
|
|
494
494
|
}), o[0].before(r), o.forEach((i) => i.remove()), we(n.parentElement) && n.parentElement.replaceWith(n);
|
|
495
495
|
}
|
|
496
496
|
}
|
|
497
|
-
function
|
|
497
|
+
function Tl(e) {
|
|
498
498
|
for (const t of Array.from(e.querySelectorAll('ul[data-type="taskList"], ol[data-type="taskList"]')))
|
|
499
499
|
for (const n of Array.from(t.children)) {
|
|
500
500
|
const o = n.tagName === "LI" ? n : null;
|
|
@@ -525,10 +525,10 @@ function Al(e) {
|
|
|
525
525
|
if (t.parentElement?.getAttribute("data-type") === "taskList") continue;
|
|
526
526
|
t.removeAttribute("data-checked");
|
|
527
527
|
const n = t.querySelector(":scope > label"), o = t.querySelector(":scope > div");
|
|
528
|
-
n?.remove(), o &&
|
|
528
|
+
n?.remove(), o && vr(o);
|
|
529
529
|
}
|
|
530
530
|
}
|
|
531
|
-
function
|
|
531
|
+
function Sl(e) {
|
|
532
532
|
for (const t of Array.from(e.querySelectorAll("pre"))) {
|
|
533
533
|
const o = (t.querySelector("code") || t).textContent || "";
|
|
534
534
|
t.replaceChildren();
|
|
@@ -536,41 +536,41 @@ function Tl(e) {
|
|
|
536
536
|
r.textContent = o, t.appendChild(r);
|
|
537
537
|
}
|
|
538
538
|
}
|
|
539
|
-
function
|
|
539
|
+
function wl(e) {
|
|
540
540
|
for (const t of Array.from(e.querySelectorAll("p,h1,h2,h3,h4,h5,h6,li,td,th,div")))
|
|
541
541
|
we(t) || t.classList.contains(H.PAGEBREAK) || t.classList.contains(H.SECTIONBREAK) || t.classList.contains(H.TOC) || t.hasAttribute(le) || Ot(t) || mn(t) || Lt(t) || t.replaceChildren(document.createElement("br"));
|
|
542
542
|
}
|
|
543
|
-
function
|
|
543
|
+
function xl(e) {
|
|
544
544
|
for (const t of Array.from(e.querySelectorAll(`.${H.PAGEBREAK}`))) {
|
|
545
545
|
const n = t.tagName === "DIV" ? t : Te(t, "div");
|
|
546
546
|
n.replaceChildren(), n.setAttribute("contenteditable", "false");
|
|
547
547
|
}
|
|
548
548
|
}
|
|
549
|
-
function
|
|
549
|
+
function Ll(e) {
|
|
550
550
|
for (const t of Array.from(e.querySelectorAll(`.${H.SECTIONBREAK}`))) {
|
|
551
551
|
const n = t.tagName === "DIV" ? t : Te(t, "div");
|
|
552
552
|
n.replaceChildren(), n.setAttribute("contenteditable", "false");
|
|
553
553
|
}
|
|
554
554
|
}
|
|
555
|
-
function
|
|
555
|
+
function Ml(e) {
|
|
556
556
|
for (const t of Array.from(e.querySelectorAll(`.${H.TOC}`)))
|
|
557
557
|
(t.tagName === "DIV" ? t : Te(t, "div")).setAttribute("contenteditable", "false");
|
|
558
558
|
}
|
|
559
|
-
function
|
|
559
|
+
function Nl(e) {
|
|
560
560
|
for (const t of Array.from(e.querySelectorAll("span")))
|
|
561
561
|
t.hasAttribute(lt) ? (t.classList.add(H.ATTACH), t.setAttribute("contenteditable", "false")) : t.hasAttribute(le) && (t.classList.add(H.REF), t.setAttribute("contenteditable", "false"));
|
|
562
562
|
}
|
|
563
|
-
function
|
|
563
|
+
function Rl(e) {
|
|
564
564
|
for (const t of Array.from(e.querySelectorAll("[data-ref-doc]")))
|
|
565
565
|
t.tagName === "DIV" && (t.classList.add(H.EMBED), t.setAttribute("contenteditable", "false"));
|
|
566
566
|
}
|
|
567
|
-
function
|
|
567
|
+
function Ol(e) {
|
|
568
568
|
const t = e.cloneNode(!0);
|
|
569
|
-
return
|
|
569
|
+
return fr(t), t.querySelectorAll(nl).forEach((n) => pn(n)), t.querySelectorAll('input[type="checkbox"]').forEach((n) => {
|
|
570
570
|
n.checked ? n.setAttribute("checked", "") : n.removeAttribute("checked");
|
|
571
571
|
}), t.querySelectorAll("[contenteditable]").forEach((n) => n.removeAttribute("contenteditable")), t.innerHTML;
|
|
572
572
|
}
|
|
573
|
-
function
|
|
573
|
+
function xr(e) {
|
|
574
574
|
const t = document.createElement("template");
|
|
575
575
|
return t.innerHTML = String(e || ""), bn(t.content), t.content;
|
|
576
576
|
}
|
|
@@ -578,27 +578,27 @@ function ho(e) {
|
|
|
578
578
|
return typeof e?.key == "string" ? e.key.toLowerCase() : "";
|
|
579
579
|
}
|
|
580
580
|
const Un = "data-key-scope", Bo = "data-key-active";
|
|
581
|
-
function
|
|
581
|
+
function Lr(e) {
|
|
582
582
|
return e?.closest?.(`[${Un}]`) ?? null;
|
|
583
583
|
}
|
|
584
584
|
let tt = null;
|
|
585
|
-
const
|
|
585
|
+
const Mr = (e) => {
|
|
586
586
|
tt = e.target instanceof Element ? e.target : null;
|
|
587
587
|
};
|
|
588
|
-
function Ol() {
|
|
589
|
-
document.addEventListener("pointerdown", Lr, !0);
|
|
590
|
-
}
|
|
591
588
|
function Bl() {
|
|
592
|
-
document.
|
|
589
|
+
document.addEventListener("pointerdown", Mr, !0);
|
|
590
|
+
}
|
|
591
|
+
function Il() {
|
|
592
|
+
document.removeEventListener("pointerdown", Mr, !0), tt = null;
|
|
593
593
|
}
|
|
594
|
-
const
|
|
595
|
-
function
|
|
594
|
+
const Hl = (e) => !e || e === document || e === document.documentElement || e === document.body;
|
|
595
|
+
function zl(e) {
|
|
596
596
|
const t = e?.target;
|
|
597
|
-
return
|
|
597
|
+
return Hl(t) ? (tt && !tt.isConnected && (tt = null), tt) : t;
|
|
598
598
|
}
|
|
599
|
-
function
|
|
599
|
+
function Dl(e, t) {
|
|
600
600
|
if (!t) return !0;
|
|
601
|
-
const n = t.getAttribute(Un), o = t.getAttribute(Bo) === "true", r =
|
|
601
|
+
const n = t.getAttribute(Un), o = t.getAttribute(Bo) === "true", r = zl(e), i = Lr(r);
|
|
602
602
|
return i ? i.getAttribute(Un) === n ? !0 : o && i.getAttribute(Bo) !== "true" : r ? !1 : o;
|
|
603
603
|
}
|
|
604
604
|
const yn = {
|
|
@@ -612,7 +612,7 @@ const yn = {
|
|
|
612
612
|
keydown: { capture: [], bubble: [] },
|
|
613
613
|
keyup: { capture: [], bubble: [] }
|
|
614
614
|
}, Nt = /* @__PURE__ */ new Set();
|
|
615
|
-
function
|
|
615
|
+
function Nr(e) {
|
|
616
616
|
for (const t of [...Nt])
|
|
617
617
|
if (Nt.has(t))
|
|
618
618
|
try {
|
|
@@ -621,90 +621,90 @@ function Mr(e) {
|
|
|
621
621
|
console.error("[KeyboardBus] release failed:", n);
|
|
622
622
|
}
|
|
623
623
|
}
|
|
624
|
-
const mo = () =>
|
|
624
|
+
const mo = () => Nr(null), Rr = () => {
|
|
625
625
|
document.hidden && mo();
|
|
626
626
|
};
|
|
627
|
-
function
|
|
627
|
+
function $l(e) {
|
|
628
628
|
return typeof e != "function" ? () => {
|
|
629
629
|
} : (Nt.add(e), ln(), () => {
|
|
630
630
|
Nt.delete(e), ln();
|
|
631
631
|
});
|
|
632
632
|
}
|
|
633
|
-
let po = !0, rn = !1,
|
|
634
|
-
function
|
|
633
|
+
let po = !0, rn = !1, _l = 0;
|
|
634
|
+
function Pl() {
|
|
635
635
|
for (const e of ["keydown", "keyup"])
|
|
636
636
|
for (const t of ["capture", "bubble"])
|
|
637
637
|
qe[e][t].sort((n, o) => o.priority - n.priority || n.seq - o.seq);
|
|
638
638
|
po = !0;
|
|
639
639
|
}
|
|
640
|
-
const
|
|
641
|
-
ho(e) && (
|
|
642
|
-
},
|
|
640
|
+
const Or = (e) => kn("keydown", "capture", e), Br = (e) => kn("keydown", "bubble", e), Ir = (e) => {
|
|
641
|
+
ho(e) && (Nr(e), kn("keyup", "capture", e));
|
|
642
|
+
}, Hr = (e) => kn("keyup", "bubble", e);
|
|
643
643
|
function kn(e, t, n) {
|
|
644
644
|
const o = qe[e][t];
|
|
645
645
|
if (o.length && ho(n)) {
|
|
646
|
-
po ||
|
|
646
|
+
po || Pl();
|
|
647
647
|
for (const r of o.slice()) {
|
|
648
648
|
if (r.active && !r.active(n)) continue;
|
|
649
649
|
if (r.handler(n) === !0 || n.cancelBubble === !0) return;
|
|
650
650
|
}
|
|
651
651
|
}
|
|
652
652
|
}
|
|
653
|
-
function Pl() {
|
|
654
|
-
document.addEventListener("keydown", Rr, !0), document.addEventListener("keydown", Or), document.addEventListener("keyup", Br, !0), document.addEventListener("keyup", Ir), window.addEventListener("blur", mo), document.addEventListener("visibilitychange", Nr), Ol(), rn = !0;
|
|
655
|
-
}
|
|
656
653
|
function Fl() {
|
|
657
|
-
document.
|
|
654
|
+
document.addEventListener("keydown", Or, !0), document.addEventListener("keydown", Br), document.addEventListener("keyup", Ir, !0), document.addEventListener("keyup", Hr), window.addEventListener("blur", mo), document.addEventListener("visibilitychange", Rr), Bl(), rn = !0;
|
|
655
|
+
}
|
|
656
|
+
function ql() {
|
|
657
|
+
document.removeEventListener("keydown", Or, !0), document.removeEventListener("keydown", Br), document.removeEventListener("keyup", Ir, !0), document.removeEventListener("keyup", Hr), window.removeEventListener("blur", mo), document.removeEventListener("visibilitychange", Rr), Il(), rn = !1;
|
|
658
658
|
}
|
|
659
659
|
function ln() {
|
|
660
660
|
const e = qe.keydown.capture.length || qe.keydown.bubble.length || qe.keyup.capture.length || qe.keyup.bubble.length || Nt.size;
|
|
661
|
-
e && !rn ?
|
|
662
|
-
}
|
|
663
|
-
function ql(e, t) {
|
|
664
|
-
return Hr("keydown", e, t);
|
|
661
|
+
e && !rn ? Fl() : !e && rn && ql();
|
|
665
662
|
}
|
|
666
663
|
function Ul(e, t) {
|
|
667
|
-
return
|
|
664
|
+
return zr("keydown", e, t);
|
|
665
|
+
}
|
|
666
|
+
function Vl(e, t) {
|
|
667
|
+
return zr("keyup", e, t);
|
|
668
668
|
}
|
|
669
|
-
function
|
|
669
|
+
function zr(e, t, { priority: n = yn.GLOBAL, phase: o = "capture", active: r } = {}) {
|
|
670
670
|
if (typeof t != "function") return () => {
|
|
671
671
|
};
|
|
672
|
-
const i = { seq:
|
|
672
|
+
const i = { seq: ++_l, priority: n, active: r, handler: t }, l = qe[e][o === "bubble" ? "bubble" : "capture"];
|
|
673
673
|
return l.push(i), po = !1, ln(), () => {
|
|
674
674
|
const s = l.indexOf(i);
|
|
675
675
|
s >= 0 && l.splice(s, 1), ln();
|
|
676
676
|
};
|
|
677
677
|
}
|
|
678
678
|
function go(e, t = {}) {
|
|
679
|
-
const n =
|
|
679
|
+
const n = xi(), o = (s) => {
|
|
680
680
|
let a = n?.proxy?.$el ?? n?.vnode?.el ?? null;
|
|
681
681
|
for (; a && a.nodeType !== 1; ) a = a.parentElement;
|
|
682
|
-
return a?.closest?.("[inert]") || !
|
|
682
|
+
return a?.closest?.("[inert]") || !Dl(s, Lr(a)) ? !1 : !t.active || t.active();
|
|
683
683
|
}, r = [], i = { ...t, active: o };
|
|
684
|
-
typeof e?.keydown == "function" && r.push(
|
|
684
|
+
typeof e?.keydown == "function" && r.push(Ul(e.keydown, i)), typeof e?.keyup == "function" && r.push(Vl(e.keyup, i)), typeof e?.release == "function" && r.push($l(e.release));
|
|
685
685
|
const l = () => {
|
|
686
686
|
for (; r.length; ) r.pop()();
|
|
687
687
|
};
|
|
688
|
-
return
|
|
688
|
+
return Li() && Mi(l), l;
|
|
689
689
|
}
|
|
690
|
-
function
|
|
690
|
+
function Gl() {
|
|
691
691
|
return typeof navigator > "u" ? !1 : /Mac|iP(hone|ad|od)/.test(`${navigator.userAgent || ""} ${navigator.platform || ""}`);
|
|
692
692
|
}
|
|
693
|
-
const
|
|
694
|
-
const t =
|
|
693
|
+
const Kl = (e) => {
|
|
694
|
+
const t = jl(e?.code);
|
|
695
695
|
return /^digit\d$/.test(t) ? t.slice(5) : ho(e) || (t.length === 1 ? t : "");
|
|
696
696
|
};
|
|
697
|
-
function
|
|
698
|
-
const t =
|
|
697
|
+
function Xl(e) {
|
|
698
|
+
const t = Kl(e);
|
|
699
699
|
if (!t) return "";
|
|
700
700
|
const n = [];
|
|
701
|
-
return (
|
|
701
|
+
return (Gl() ? e?.metaKey : e?.ctrlKey) && n.push("Mod"), e?.altKey && n.push("Alt"), e?.shiftKey && n.push("Shift"), n.push(t), n.join("-");
|
|
702
702
|
}
|
|
703
|
-
function
|
|
703
|
+
function jl(e) {
|
|
704
704
|
const t = String(e || "");
|
|
705
705
|
return /^Digit[0-9]$/.test(t) ? `digit${t.slice(5)}` : /^Numpad[0-9]$/.test(t) ? t.toLowerCase() : /^Key[A-Z]$/.test(t) ? t.slice(3).toLowerCase() : t.toLowerCase();
|
|
706
706
|
}
|
|
707
|
-
const Vn = ["0.25", "0.5", "0.75", "1", "1.15", "1.25", "1.5", "2", "2.5", "3"], Cn = 8, Gn = 2,
|
|
707
|
+
const Vn = ["0.25", "0.5", "0.75", "1", "1.15", "1.25", "1.5", "2", "2.5", "3"], Cn = 8, Gn = 2, Wl = /* @__PURE__ */ new Set(["style", "script", "meta", "link", "title", "base", "xml"]), Yl = /* @__PURE__ */ new Set([
|
|
708
708
|
"text-align",
|
|
709
709
|
"font-weight",
|
|
710
710
|
"font-style",
|
|
@@ -716,8 +716,8 @@ const Vn = ["0.25", "0.5", "0.75", "1", "1.15", "1.25", "1.5", "2", "2.5", "3"],
|
|
|
716
716
|
"line-height",
|
|
717
717
|
"width",
|
|
718
718
|
"min-width"
|
|
719
|
-
]),
|
|
720
|
-
function
|
|
719
|
+
]), Ql = /<o:p|mso-|urn:schemas-microsoft-com|<!--\[if/i, Zl = 1, Jl = 4;
|
|
720
|
+
function es(e) {
|
|
721
721
|
const t = String(e).trim().match(/^([\d.]+)\s*(pt|px)$/i);
|
|
722
722
|
if (!t) return "";
|
|
723
723
|
const n = Number(t[1]);
|
|
@@ -725,7 +725,7 @@ function Jl(e) {
|
|
|
725
725
|
const o = Math.round(t[2].toLowerCase() === "pt" ? n * (4 / 3) : n);
|
|
726
726
|
return o < Je[0] || o > Je[Je.length - 1] ? "" : `${Je.reduce((r, i) => Math.abs(i - o) < Math.abs(r - o) ? i : r, Je[0])}px`;
|
|
727
727
|
}
|
|
728
|
-
function
|
|
728
|
+
function ts(e) {
|
|
729
729
|
const t = String(e).trim();
|
|
730
730
|
let n = null;
|
|
731
731
|
const o = t.match(/^([\d.]+)%$/);
|
|
@@ -734,27 +734,27 @@ function es(e) {
|
|
|
734
734
|
const r = t.match(/^([\d.]+)$/);
|
|
735
735
|
r && (n = Number(r[1]));
|
|
736
736
|
}
|
|
737
|
-
return !n || !Number.isFinite(n) || n <
|
|
737
|
+
return !n || !Number.isFinite(n) || n < Zl || n > Jl ? "" : Vn.reduce(
|
|
738
738
|
(r, i) => Math.abs(Number(i) - n) < Math.abs(Number(r) - n) ? i : r,
|
|
739
739
|
Vn[0]
|
|
740
740
|
);
|
|
741
741
|
}
|
|
742
|
-
function
|
|
742
|
+
function ns(e, t) {
|
|
743
743
|
const n = [];
|
|
744
744
|
return String(e).split(";").forEach((o) => {
|
|
745
745
|
const r = o.indexOf(":");
|
|
746
746
|
if (r < 0) return;
|
|
747
747
|
const i = o.slice(0, r).trim().toLowerCase();
|
|
748
748
|
let l = o.slice(r + 1).trim();
|
|
749
|
-
!i || !l || !
|
|
749
|
+
!i || !l || !Yl.has(i) || t && (i === "font-family" || (i === "font-size" && (l = es(l)), i === "line-height" && (l = ts(l)), !l)) || n.push(`${i}: ${l}`);
|
|
750
750
|
}), n.join("; ");
|
|
751
751
|
}
|
|
752
|
-
function
|
|
752
|
+
function os(e) {
|
|
753
753
|
const t = document.createTreeWalker(e, NodeFilter.SHOW_COMMENT), n = [];
|
|
754
754
|
for (; t.nextNode(); ) n.push(t.currentNode);
|
|
755
755
|
n.forEach((o) => o.remove());
|
|
756
756
|
}
|
|
757
|
-
const
|
|
757
|
+
const rs = (e) => {
|
|
758
758
|
for (const t of String(e).split(";")) {
|
|
759
759
|
const n = t.indexOf(":");
|
|
760
760
|
if (n < 0 || t.slice(0, n).trim().toLowerCase() !== "vertical-align") continue;
|
|
@@ -764,17 +764,17 @@ const os = (e) => {
|
|
|
764
764
|
}
|
|
765
765
|
return "";
|
|
766
766
|
};
|
|
767
|
-
function
|
|
767
|
+
function Dr(e) {
|
|
768
768
|
if (!e || typeof e != "string" || typeof DOMParser > "u") return e;
|
|
769
|
-
const t =
|
|
769
|
+
const t = Ql.test(e), o = new DOMParser().parseFromString(e, "text/html").body;
|
|
770
770
|
return o.querySelectorAll("*").forEach((r) => {
|
|
771
771
|
const i = r.tagName.toLowerCase();
|
|
772
|
-
if (
|
|
772
|
+
if (Wl.has(i) || i.includes(":")) {
|
|
773
773
|
r.remove();
|
|
774
774
|
return;
|
|
775
775
|
}
|
|
776
776
|
if (r.removeAttribute("class"), r.removeAttribute("id"), r.removeAttribute("dir"), r.removeAttribute("lang"), r.removeAttribute("align"), r.hasAttribute("style")) {
|
|
777
|
-
const l = r.getAttribute("style"), s =
|
|
777
|
+
const l = r.getAttribute("style"), s = rs(l), a = ns(l, t);
|
|
778
778
|
if (a ? r.setAttribute("style", a) : r.removeAttribute("style"), s && i === "span") {
|
|
779
779
|
const c = document.createElement(s === "super" ? "sup" : "sub");
|
|
780
780
|
r.hasAttribute("style") ? (r.replaceWith(c), c.appendChild(r)) : (Ce(r, c), r.replaceWith(c));
|
|
@@ -782,18 +782,18 @@ function zr(e) {
|
|
|
782
782
|
}
|
|
783
783
|
if (i === "img") {
|
|
784
784
|
const l = r.getAttribute("src") || "";
|
|
785
|
-
(!l || !
|
|
785
|
+
(!l || !Cr.test(l)) && r.remove();
|
|
786
786
|
}
|
|
787
|
-
}),
|
|
787
|
+
}), os(o), o.innerHTML;
|
|
788
788
|
}
|
|
789
|
-
const
|
|
789
|
+
const is = `.${H.INS}, .${H.DEL}`;
|
|
790
790
|
function Kn(e) {
|
|
791
791
|
const t = document.createRange();
|
|
792
792
|
t.setStartAfter(e), t.collapse(!0);
|
|
793
793
|
const n = window.getSelection();
|
|
794
794
|
n.removeAllRanges(), n.addRange(t);
|
|
795
795
|
}
|
|
796
|
-
function
|
|
796
|
+
function ls(e, t) {
|
|
797
797
|
let n = e.startContainer;
|
|
798
798
|
if (n.nodeType === Node.TEXT_NODE) {
|
|
799
799
|
if (e.startOffset !== 0) return null;
|
|
@@ -811,13 +811,13 @@ function Xn(e, t) {
|
|
|
811
811
|
const r = t.extractContents(), i = document.createElement("del");
|
|
812
812
|
i.className = H.DEL, i.appendChild(r), t.insertNode(i), Kn(i);
|
|
813
813
|
}
|
|
814
|
-
function
|
|
814
|
+
function ss(e, t) {
|
|
815
815
|
const n = window.getSelection();
|
|
816
816
|
if (!n?.rangeCount || !e) return !1;
|
|
817
817
|
let o = n.getRangeAt(0);
|
|
818
818
|
if (!e.contains(o.startContainer)) return !1;
|
|
819
819
|
o.collapsed || (Xn(e, o), o = n.getRangeAt(0));
|
|
820
|
-
const r =
|
|
820
|
+
const r = ls(o, H.INS);
|
|
821
821
|
if (r)
|
|
822
822
|
return r.appendChild(document.createTextNode(t)), Kn(r.lastChild), !0;
|
|
823
823
|
const i = document.createElement("ins");
|
|
@@ -837,18 +837,18 @@ function Io(e, t) {
|
|
|
837
837
|
const s = o.cloneRange();
|
|
838
838
|
return s.setStart(r, Math.min(i, l)), s.setEnd(r, Math.max(i, l)), Xn(e, s), !0;
|
|
839
839
|
}
|
|
840
|
-
function ss(e, t) {
|
|
841
|
-
return t.inputType === "insertText" && t.data ? ls(e, t.data) : t.inputType === "deleteContentBackward" ? Io(e, !1) : t.inputType === "deleteContentForward" ? Io(e, !0) : !1;
|
|
842
|
-
}
|
|
843
840
|
function as(e, t) {
|
|
841
|
+
return t.inputType === "insertText" && t.data ? ss(e, t.data) : t.inputType === "deleteContentBackward" ? Io(e, !1) : t.inputType === "deleteContentForward" ? Io(e, !0) : !1;
|
|
842
|
+
}
|
|
843
|
+
function cs(e, t) {
|
|
844
844
|
let n = 0;
|
|
845
|
-
for (const o of Array.from(e?.querySelectorAll(
|
|
845
|
+
for (const o of Array.from(e?.querySelectorAll(is) || [])) {
|
|
846
846
|
if (!o.isConnected) continue;
|
|
847
847
|
o.classList.contains(H.INS) === !!t && Ht(o), o.remove(), n += 1;
|
|
848
848
|
}
|
|
849
849
|
return e?.normalize(), n;
|
|
850
850
|
}
|
|
851
|
-
function
|
|
851
|
+
function us(e, t) {
|
|
852
852
|
return e?.isConnected ? (e.classList.contains(H.INS) === !!t && Ht(e), e.remove(), e.parentElement?.normalize(), !0) : !1;
|
|
853
853
|
}
|
|
854
854
|
function St(e) {
|
|
@@ -859,13 +859,13 @@ function St(e) {
|
|
|
859
859
|
const o = n[1];
|
|
860
860
|
return `#${(o.length === 3 ? o.split("").map((i) => i + i).join("") : o).toUpperCase()}`;
|
|
861
861
|
}
|
|
862
|
-
function
|
|
862
|
+
function ds(e) {
|
|
863
863
|
const t = String(e ?? "").trim();
|
|
864
864
|
if (!t) return "";
|
|
865
865
|
const n = t.match(/^rgba?\(\s*(\d+)[,\s]+(\d+)[,\s]+(\d+)/i);
|
|
866
866
|
return n ? `#${[1, 2, 3].map((o) => Number(n[o]).toString(16).padStart(2, "0")).join("").toUpperCase()}` : St(t) || t;
|
|
867
867
|
}
|
|
868
|
-
const
|
|
868
|
+
const fs = {
|
|
869
869
|
STRONG: "bold",
|
|
870
870
|
B: "bold",
|
|
871
871
|
EM: "italic",
|
|
@@ -877,14 +877,14 @@ const ds = {
|
|
|
877
877
|
TT: "code",
|
|
878
878
|
SUP: "superscript",
|
|
879
879
|
SUB: "subscript"
|
|
880
|
-
},
|
|
880
|
+
}, hs = { INS: "ins", DEL: "del" }, ms = { bold: "strong", italic: "em", underline: "u", strike: "s", code: "code", superscript: "sup", subscript: "sub" }, ps = [
|
|
881
881
|
["color", "color"],
|
|
882
882
|
["background-color", "backgroundColor"],
|
|
883
883
|
["font-size", "fontSize"],
|
|
884
884
|
["font-family", "fontFamily"],
|
|
885
885
|
["-webkit-text-stroke", "textStroke"],
|
|
886
886
|
["text-shadow", "textShadow"]
|
|
887
|
-
],
|
|
887
|
+
], gs = { color: "color", backgroundColor: "background-color", fontSize: "font-size", fontFamily: "font-family", textStroke: "-webkit-text-stroke", textShadow: "text-shadow" }, $t = ["color", "backgroundColor", "fontSize", "fontFamily", "textStroke", "textShadow"], vs = /* @__PURE__ */ new Set(["color", "backgroundColor"]), En = ["bold", "italic", "underline", "strike", "code", "superscript", "subscript"];
|
|
888
888
|
function sn() {
|
|
889
889
|
return {
|
|
890
890
|
bold: !1,
|
|
@@ -908,7 +908,7 @@ function sn() {
|
|
|
908
908
|
textShadow: ""
|
|
909
909
|
};
|
|
910
910
|
}
|
|
911
|
-
function
|
|
911
|
+
function $r(e, t) {
|
|
912
912
|
return En.every((n) => !!e[n] == !!t[n]) && $t.every((n) => jt(e[n]) === jt(t[n])) && jt(e.link) === jt(t.link) && e.rev === t.rev && e.cmt === t.cmt && e.colorTheme === t.colorTheme && e.colorThemeTint === t.colorThemeTint && e.colorThemeShade === t.colorThemeShade;
|
|
913
913
|
}
|
|
914
914
|
function jt(e) {
|
|
@@ -970,21 +970,21 @@ function Wn(e, t, n) {
|
|
|
970
970
|
continue;
|
|
971
971
|
}
|
|
972
972
|
let r = t;
|
|
973
|
-
const i =
|
|
973
|
+
const i = fs[o.tagName];
|
|
974
974
|
i && (r = { ...r, [i]: !0 });
|
|
975
|
-
const l =
|
|
975
|
+
const l = hs[o.tagName];
|
|
976
976
|
l && (r = { ...r, rev: l }), o.tagName === "SPAN" && o.classList?.contains(H.COMMENT) && (r = { ...r, cmt: o.getAttribute(fo) || "" });
|
|
977
|
-
for (const [a, c] of
|
|
977
|
+
for (const [a, c] of ps) {
|
|
978
978
|
const f = o.style?.getPropertyValue(a)?.trim();
|
|
979
|
-
f && (r = { ...r, [c]:
|
|
979
|
+
f && (r = { ...r, [c]: vs.has(c) ? ds(f) : f });
|
|
980
980
|
}
|
|
981
981
|
o.tagName === "A" && (r = { ...r, link: o.getAttribute("href") || "" });
|
|
982
|
-
const s = o.getAttribute(
|
|
982
|
+
const s = o.getAttribute(Ar);
|
|
983
983
|
s && (r = {
|
|
984
984
|
...r,
|
|
985
985
|
colorTheme: s,
|
|
986
|
-
colorThemeTint: o.getAttribute(
|
|
987
|
-
colorThemeShade: o.getAttribute(
|
|
986
|
+
colorThemeTint: o.getAttribute(Tr) || "",
|
|
987
|
+
colorThemeShade: o.getAttribute(Sr) || ""
|
|
988
988
|
}), Wn(o, r, n);
|
|
989
989
|
}
|
|
990
990
|
}
|
|
@@ -992,33 +992,33 @@ function vo(e) {
|
|
|
992
992
|
const t = [];
|
|
993
993
|
return e && Wn(e, sn(), t), t;
|
|
994
994
|
}
|
|
995
|
-
function
|
|
995
|
+
function bs(e) {
|
|
996
996
|
if (e.text) return document.createTextNode(e.text);
|
|
997
997
|
if (e.br) return document.createElement("br");
|
|
998
998
|
if (e.note) {
|
|
999
999
|
const n = document.createElement("sup");
|
|
1000
1000
|
return n.className = e.note.end ? H.ENDNOTE : H.FOOTNOTE, n.setAttribute(vn, e.note.id), n.textContent = e.note.ord || "", n;
|
|
1001
1001
|
}
|
|
1002
|
-
if (e.attach || e.ref) return
|
|
1002
|
+
if (e.attach || e.ref) return ys(e);
|
|
1003
1003
|
const t = document.createElement("img");
|
|
1004
1004
|
e.img.src && t.setAttribute("src", e.img.src), t.setAttribute("alt", e.img.alt || "");
|
|
1005
1005
|
for (const n of ["width", "height"]) e.img[n] && t.setAttribute(n, e.img[n]);
|
|
1006
1006
|
return t;
|
|
1007
1007
|
}
|
|
1008
|
-
function
|
|
1008
|
+
function ys(e) {
|
|
1009
1009
|
const t = document.createElement("span");
|
|
1010
1010
|
return e.attach ? (t.className = H.ATTACH, t.setAttribute(lt, e.attach.id), t.textContent = e.attach.name || "") : (t.className = H.REF, t.setAttribute(le, e.ref.docId), e.ref.blockId && t.setAttribute(Ge, e.ref.blockId), t.setAttribute(Dt, e.ref.sub === "s" ? "s" : "d"), t.textContent = e.ref.text || ""), t.setAttribute("contenteditable", "false"), t;
|
|
1011
1011
|
}
|
|
1012
|
-
function
|
|
1012
|
+
function ks(e, t) {
|
|
1013
1013
|
for (const o of ["code", "strike", "underline", "italic", "superscript", "subscript", "bold"]) {
|
|
1014
1014
|
if (!e[o]) continue;
|
|
1015
|
-
const r = document.createElement(
|
|
1015
|
+
const r = document.createElement(ms[o]);
|
|
1016
1016
|
r.appendChild(t), t = r;
|
|
1017
1017
|
}
|
|
1018
|
-
const n = $t.filter((o) => e[o]).map((o) => `${
|
|
1018
|
+
const n = $t.filter((o) => e[o]).map((o) => `${gs[o]}: ${e[o]}`);
|
|
1019
1019
|
if (n.length || e.colorTheme) {
|
|
1020
1020
|
const o = document.createElement("span");
|
|
1021
|
-
n.length && o.setAttribute("style", n.join("; ")), e.colorTheme && (o.setAttribute(
|
|
1021
|
+
n.length && o.setAttribute("style", n.join("; ")), e.colorTheme && (o.setAttribute(Ar, e.colorTheme), e.colorThemeTint && o.setAttribute(Tr, e.colorThemeTint), e.colorThemeShade && o.setAttribute(Sr, e.colorThemeShade)), o.appendChild(t), t = o;
|
|
1022
1022
|
}
|
|
1023
1023
|
if (e.rev) {
|
|
1024
1024
|
const o = document.createElement(e.rev === "del" ? "del" : "ins");
|
|
@@ -1034,17 +1034,17 @@ function ys(e, t) {
|
|
|
1034
1034
|
}
|
|
1035
1035
|
return t;
|
|
1036
1036
|
}
|
|
1037
|
-
function
|
|
1037
|
+
function _r(e) {
|
|
1038
1038
|
const t = document.createDocumentFragment();
|
|
1039
1039
|
let n = [], o = null;
|
|
1040
1040
|
const r = () => {
|
|
1041
1041
|
if (!n.length) return;
|
|
1042
1042
|
const i = document.createDocumentFragment();
|
|
1043
|
-
for (const l of n) i.appendChild(
|
|
1044
|
-
t.appendChild(
|
|
1043
|
+
for (const l of n) i.appendChild(bs(l));
|
|
1044
|
+
t.appendChild(ks(o, i)), n = [], o = null;
|
|
1045
1045
|
};
|
|
1046
1046
|
for (const i of e) {
|
|
1047
|
-
if (o &&
|
|
1047
|
+
if (o && $r(o, i.m)) {
|
|
1048
1048
|
n.push(i);
|
|
1049
1049
|
continue;
|
|
1050
1050
|
}
|
|
@@ -1052,7 +1052,7 @@ function $r(e) {
|
|
|
1052
1052
|
}
|
|
1053
1053
|
return r(), t;
|
|
1054
1054
|
}
|
|
1055
|
-
function
|
|
1055
|
+
function Cs(e, t, n) {
|
|
1056
1056
|
const o = [], r = [], i = [];
|
|
1057
1057
|
let l = 0;
|
|
1058
1058
|
for (const s of e) {
|
|
@@ -1074,8 +1074,8 @@ function ks(e, t, n) {
|
|
|
1074
1074
|
}
|
|
1075
1075
|
return { before: o, inside: r, after: i };
|
|
1076
1076
|
}
|
|
1077
|
-
function
|
|
1078
|
-
const r = vo(e), { before: i, inside: l, after: s } =
|
|
1077
|
+
function Pr(e, t, n, o) {
|
|
1078
|
+
const r = vo(e), { before: i, inside: l, after: s } = Cs(r, t, n);
|
|
1079
1079
|
if (!l.length) return !1;
|
|
1080
1080
|
const a = l.map((c) => {
|
|
1081
1081
|
const f = { ...c.m };
|
|
@@ -1084,15 +1084,15 @@ function _r(e, t, n, o) {
|
|
|
1084
1084
|
for (const [u, p] of Object.entries(o.style || {})) f[u] = p || "";
|
|
1085
1085
|
return o.link !== void 0 && (f.link = o.link || ""), { ...c, m: f };
|
|
1086
1086
|
});
|
|
1087
|
-
return a.some((c, f) =>
|
|
1087
|
+
return a.some((c, f) => !$r(c.m, l[f].m)) ? (e.replaceChildren(_r([...i, ...a, ...s])), !0) : !1;
|
|
1088
1088
|
}
|
|
1089
|
-
function
|
|
1090
|
-
e?.isConnected && e.replaceChildren(
|
|
1089
|
+
function Es(e) {
|
|
1090
|
+
e?.isConnected && e.replaceChildren(_r(vo(e)));
|
|
1091
1091
|
}
|
|
1092
1092
|
function ct(e, t, n) {
|
|
1093
1093
|
let o = !1;
|
|
1094
1094
|
for (const { block: r, start: i, end: l } of t)
|
|
1095
|
-
|
|
1095
|
+
Pr(r, i, l, n) && (o = !0);
|
|
1096
1096
|
return o;
|
|
1097
1097
|
}
|
|
1098
1098
|
function Pe(e, t) {
|
|
@@ -1103,7 +1103,7 @@ function ce(e, t, n) {
|
|
|
1103
1103
|
const o = t === "fontFamily" ? uo(n) : n || "", r = t === "color" ? { color: o, colorTheme: "", colorThemeTint: "", colorThemeShade: "" } : { [t]: o };
|
|
1104
1104
|
return e.pending ? (Object.assign(e.pending, r), !0) : ct(e.root, e.ranges, { style: r });
|
|
1105
1105
|
}
|
|
1106
|
-
function
|
|
1106
|
+
function As(e, t) {
|
|
1107
1107
|
const n = {};
|
|
1108
1108
|
for (const [o, r] of Object.entries(t || {}))
|
|
1109
1109
|
n[o] = o === "fontFamily" ? uo(r) : r || "";
|
|
@@ -1111,26 +1111,26 @@ function Es(e, t) {
|
|
|
1111
1111
|
}
|
|
1112
1112
|
function Ho(e, t) {
|
|
1113
1113
|
const n = String(t || "").trim();
|
|
1114
|
-
return n !== "" && !
|
|
1114
|
+
return n !== "" && !Er(n) ? !1 : e.pending ? (e.pending.link = n, !0) : ct(e.root, e.ranges, { link: n || null });
|
|
1115
1115
|
}
|
|
1116
|
-
function
|
|
1116
|
+
function Ts(e, t) {
|
|
1117
1117
|
const n = String(t || "");
|
|
1118
1118
|
return e.pending ? (e.pending.cmt = n, !0) : ct(e.root, e.ranges, { style: { cmt: n } });
|
|
1119
1119
|
}
|
|
1120
|
-
function
|
|
1120
|
+
function Ss(e, t) {
|
|
1121
1121
|
const n = String(t || "");
|
|
1122
1122
|
let o = 0;
|
|
1123
1123
|
for (const r of Array.from(e?.querySelectorAll(`.${H.COMMENT}`) || []))
|
|
1124
1124
|
r.getAttribute(fo) === n && (Ht(r), o += 1);
|
|
1125
1125
|
return o && e.normalize(), o;
|
|
1126
1126
|
}
|
|
1127
|
-
function
|
|
1127
|
+
function ws(e, t) {
|
|
1128
1128
|
const n = V(e);
|
|
1129
1129
|
if (!n || !n.collapsed) return !1;
|
|
1130
1130
|
const o = document.createElement("sup");
|
|
1131
1131
|
return o.className = t?.end ? H.ENDNOTE : H.FOOTNOTE, o.setAttribute(vn, String(t?.id ?? "")), o.textContent = String(t?.ord ?? ""), n.insertNode(o), !0;
|
|
1132
1132
|
}
|
|
1133
|
-
function
|
|
1133
|
+
function xs(e, t) {
|
|
1134
1134
|
const n = String(t ?? "");
|
|
1135
1135
|
let o = 0;
|
|
1136
1136
|
for (const r of Array.from(e?.querySelectorAll(`sup.${H.FOOTNOTE}, sup.${H.ENDNOTE}`) || []))
|
|
@@ -1147,7 +1147,7 @@ function zo(e, t, n) {
|
|
|
1147
1147
|
const l = window.getSelection();
|
|
1148
1148
|
return l.removeAllRanges(), l.addRange(i), !0;
|
|
1149
1149
|
}
|
|
1150
|
-
function
|
|
1150
|
+
function Ls(e, t, n) {
|
|
1151
1151
|
const o = String(t), r = String(n ?? "");
|
|
1152
1152
|
if (!o) return !1;
|
|
1153
1153
|
let i = 0;
|
|
@@ -1155,40 +1155,40 @@ function xs(e, t, n) {
|
|
|
1155
1155
|
l.getAttribute(o) === r && (l.remove(), i += 1);
|
|
1156
1156
|
return i > 0;
|
|
1157
1157
|
}
|
|
1158
|
-
function
|
|
1158
|
+
function Ms(e, t) {
|
|
1159
1159
|
let n = t;
|
|
1160
1160
|
for (; n && n.parentElement && n.parentElement !== e; ) n = n.parentElement;
|
|
1161
1161
|
return n && n.parentElement === e ? n : null;
|
|
1162
1162
|
}
|
|
1163
|
-
function
|
|
1163
|
+
function Ns(e, t, n = "") {
|
|
1164
1164
|
if (!t || !t.hasAttribute(le) || !t.isConnected) return !1;
|
|
1165
|
-
const o = t.getAttribute(le) || "", r = t.getAttribute(Ge) || "", i =
|
|
1165
|
+
const o = t.getAttribute(le) || "", r = t.getAttribute(Ge) || "", i = Ms(e, t);
|
|
1166
1166
|
t.remove();
|
|
1167
1167
|
const l = document.createElement("div");
|
|
1168
1168
|
return l.className = H.EMBED, l.setAttribute(le, o), r && l.setAttribute(Ge, r), l.setAttribute("contenteditable", "false"), n && (l.innerHTML = n), i ? i.after(l) : e.appendChild(l), !0;
|
|
1169
1169
|
}
|
|
1170
|
-
function
|
|
1170
|
+
function Rs(e) {
|
|
1171
1171
|
if (!e || e.tagName !== "DIV" || !e.hasAttribute(le) || !e.isConnected) return !1;
|
|
1172
1172
|
const t = document.createElement("p"), n = document.createElement("span");
|
|
1173
1173
|
n.className = H.REF, n.setAttribute(le, e.getAttribute(le) || "");
|
|
1174
1174
|
const o = e.getAttribute(Ge) || "";
|
|
1175
1175
|
return o && n.setAttribute(Ge, o), n.setAttribute(Dt, "d"), n.setAttribute("contenteditable", "false"), t.appendChild(n), t.appendChild(document.createElement("br")), e.replaceWith(t), !0;
|
|
1176
1176
|
}
|
|
1177
|
-
function
|
|
1177
|
+
function Os(e, t) {
|
|
1178
1178
|
return !e || !e.hasAttribute(le) ? !1 : (e.setAttribute(Dt, t === "s" ? "s" : "d"), !0);
|
|
1179
1179
|
}
|
|
1180
|
-
function
|
|
1180
|
+
function Bs(e) {
|
|
1181
1181
|
return !e || !e.isConnected ? !1 : (e.remove(), !0);
|
|
1182
1182
|
}
|
|
1183
|
-
function
|
|
1183
|
+
function Is(e) {
|
|
1184
1184
|
return e.ranges.length ? ct(e.root, e.ranges, { clear: !0 }) : !1;
|
|
1185
1185
|
}
|
|
1186
1186
|
function bo(e, t, n, o, r) {
|
|
1187
1187
|
if (!t?.isConnected) return !1;
|
|
1188
1188
|
const i = {};
|
|
1189
|
-
return r.rev && (i.rev = r.rev), r.cmt && (i.cmt = r.cmt),
|
|
1189
|
+
return r.rev && (i.rev = r.rev), r.cmt && (i.cmt = r.cmt), Pr(t, n, o, { set: Hs(r), style: { ...zs(r), ...i }, link: r.link || void 0 });
|
|
1190
1190
|
}
|
|
1191
|
-
const
|
|
1191
|
+
const Hs = (e) => Object.fromEntries(En.filter((t) => e[t]).map((t) => [t, !0])), zs = (e) => Object.fromEntries($t.filter((t) => e[t]).map((t) => [t, e[t]]));
|
|
1192
1192
|
function Yn(e, t) {
|
|
1193
1193
|
const n = [];
|
|
1194
1194
|
for (const { block: i, start: l, end: s } of t) {
|
|
@@ -1227,25 +1227,25 @@ function An(e) {
|
|
|
1227
1227
|
const t = X(V(e)?.startContainer || e, e);
|
|
1228
1228
|
return t ? Ke(t, e) || t : e.lastElementChild || _t(e);
|
|
1229
1229
|
}
|
|
1230
|
-
function
|
|
1230
|
+
function Fr(e) {
|
|
1231
1231
|
const t = An(e), n = document.createElement("hr");
|
|
1232
1232
|
t.after(n);
|
|
1233
1233
|
const o = document.createElement("p");
|
|
1234
1234
|
return o.appendChild(document.createElement("br")), n.after(o), P(o, 0), !0;
|
|
1235
1235
|
}
|
|
1236
|
-
function
|
|
1236
|
+
function Ds(e) {
|
|
1237
1237
|
const t = An(e), n = document.createElement("div");
|
|
1238
1238
|
n.className = H.PAGEBREAK, n.setAttribute("contenteditable", "false"), t.after(n);
|
|
1239
1239
|
const o = document.createElement("p");
|
|
1240
1240
|
return o.appendChild(document.createElement("br")), n.after(o), P(o, 0), !0;
|
|
1241
1241
|
}
|
|
1242
|
-
function
|
|
1242
|
+
function $s(e, t = "info") {
|
|
1243
1243
|
const n = An(e), o = document.createElement("div");
|
|
1244
1244
|
o.setAttribute(He, t);
|
|
1245
1245
|
const r = ut();
|
|
1246
1246
|
return o.appendChild(r), n.after(o), P(r, 0), !0;
|
|
1247
1247
|
}
|
|
1248
|
-
function
|
|
1248
|
+
function _s(e, t = 2) {
|
|
1249
1249
|
const n = An(e), o = document.createElement("div");
|
|
1250
1250
|
o.setAttribute(fe, "");
|
|
1251
1251
|
let r = null;
|
|
@@ -1258,27 +1258,27 @@ function $s(e, t = 2) {
|
|
|
1258
1258
|
}
|
|
1259
1259
|
return n.after(o), P(r, 0), !0;
|
|
1260
1260
|
}
|
|
1261
|
-
function
|
|
1261
|
+
function qr(e, t) {
|
|
1262
1262
|
const n = Oe(e, t);
|
|
1263
1263
|
return n ? n.hasAttribute(fe) ? n : n.hasAttribute(ye) && n.parentElement?.hasAttribute(fe) ? n.parentElement : null : null;
|
|
1264
1264
|
}
|
|
1265
|
-
function
|
|
1266
|
-
const n =
|
|
1265
|
+
function Ps(e, t) {
|
|
1266
|
+
const n = qr(e, t);
|
|
1267
1267
|
if (!n) return !1;
|
|
1268
1268
|
const o = document.createElement("div");
|
|
1269
1269
|
o.setAttribute(ye, "");
|
|
1270
1270
|
const r = ut();
|
|
1271
1271
|
return o.appendChild(r), n.appendChild(o), P(r, 0), !0;
|
|
1272
1272
|
}
|
|
1273
|
-
function
|
|
1274
|
-
const n =
|
|
1273
|
+
function Fs(e, t) {
|
|
1274
|
+
const n = qr(e, t);
|
|
1275
1275
|
if (!n) return !1;
|
|
1276
1276
|
const o = Array.from(n.children).filter((i) => i.hasAttribute(ye));
|
|
1277
1277
|
if (o.length <= 1) return !1;
|
|
1278
1278
|
const r = he(o[o.length - 2], e) || he(n, e);
|
|
1279
1279
|
return o[o.length - 1].remove(), r?.isConnected && P(r, 0), !0;
|
|
1280
1280
|
}
|
|
1281
|
-
function
|
|
1281
|
+
function qs(e, t, n, o) {
|
|
1282
1282
|
const r = Oe(e, t), i = Oe(e, n);
|
|
1283
1283
|
if (!r || !i || r === i || r.contains(i) || i.contains(r) || r.parentElement !== i.parentElement) return !1;
|
|
1284
1284
|
const l = o === "right" ? i : r, s = o === "right" ? r : i, a = document.createElement("div");
|
|
@@ -1289,7 +1289,7 @@ function Fs(e, t, n, o) {
|
|
|
1289
1289
|
}
|
|
1290
1290
|
return !0;
|
|
1291
1291
|
}
|
|
1292
|
-
function
|
|
1292
|
+
function Us(e, t) {
|
|
1293
1293
|
const n = String(t ?? "");
|
|
1294
1294
|
if (!n) return !1;
|
|
1295
1295
|
const o = V(e), r = o && X(o.startContainer, e) || _t(e);
|
|
@@ -1305,7 +1305,7 @@ function qs(e, t) {
|
|
|
1305
1305
|
r.appendChild(document.createTextNode(n));
|
|
1306
1306
|
return !0;
|
|
1307
1307
|
}
|
|
1308
|
-
function
|
|
1308
|
+
function Vs(e, { src: t, alt: n = "" }) {
|
|
1309
1309
|
const o = V(e), r = o && X(o.startContainer, e) || _t(e), i = document.createElement("img");
|
|
1310
1310
|
if (i.setAttribute("src", t), i.setAttribute("alt", n), o && o.collapsed && r.contains(o.startContainer)) {
|
|
1311
1311
|
o.insertNode(i);
|
|
@@ -1315,7 +1315,7 @@ function Us(e, { src: t, alt: n = "" }) {
|
|
|
1315
1315
|
r.appendChild(i);
|
|
1316
1316
|
return !0;
|
|
1317
1317
|
}
|
|
1318
|
-
function
|
|
1318
|
+
function Gs(e, { id: t, src: n = "", alt: o = "" }) {
|
|
1319
1319
|
const r = V(e), i = r && X(r.startContainer, e) || _t(e), l = document.createElement("img");
|
|
1320
1320
|
if (t && l.setAttribute("data-gbBlk-asset", String(t)), n && l.setAttribute("src", n), o && l.setAttribute("alt", o), r && r.collapsed && i.contains(r.startContainer)) {
|
|
1321
1321
|
r.insertNode(l);
|
|
@@ -1325,7 +1325,7 @@ function Vs(e, { id: t, src: n = "", alt: o = "" }) {
|
|
|
1325
1325
|
i.appendChild(l);
|
|
1326
1326
|
return !0;
|
|
1327
1327
|
}
|
|
1328
|
-
function
|
|
1328
|
+
function Ks(e) {
|
|
1329
1329
|
const t = document.createElement("li");
|
|
1330
1330
|
if (Ft(e) !== "taskList")
|
|
1331
1331
|
return t.appendChild(document.createElement("br")), { el: t, caret: t };
|
|
@@ -1333,12 +1333,12 @@ function Gs(e) {
|
|
|
1333
1333
|
const { label: n } = Co(), o = document.createElement("div");
|
|
1334
1334
|
return o.appendChild(document.createElement("br")), t.append(n, o), { el: t, caret: o };
|
|
1335
1335
|
}
|
|
1336
|
-
function
|
|
1336
|
+
function Xs(e, t, n = null) {
|
|
1337
1337
|
const o = n && Oe(e, n) || X(V(e)?.startContainer || e, e);
|
|
1338
1338
|
if (!o) return !1;
|
|
1339
1339
|
const r = Ke(o, e) || o, i = t === "after";
|
|
1340
1340
|
if (r.tagName === "UL" || r.tagName === "OL") {
|
|
1341
|
-
const { el: s, caret: a } =
|
|
1341
|
+
const { el: s, caret: a } = Ks(r);
|
|
1342
1342
|
return i ? r.appendChild(s) : r.insertBefore(s, r.firstElementChild), P(a, 0), !0;
|
|
1343
1343
|
}
|
|
1344
1344
|
const l = ut();
|
|
@@ -1352,7 +1352,7 @@ function Do(e) {
|
|
|
1352
1352
|
const o = window.getSelection(), r = document.createRange();
|
|
1353
1353
|
return r.setStart(n, 0), r.collapse(!0), o.removeAllRanges(), o.addRange(r), !0;
|
|
1354
1354
|
}
|
|
1355
|
-
function
|
|
1355
|
+
function js(e, t) {
|
|
1356
1356
|
const n = t.startContainer;
|
|
1357
1357
|
if (n.nodeType !== Node.TEXT_NODE) {
|
|
1358
1358
|
e.appendChild(document.createTextNode(`
|
|
@@ -1366,7 +1366,7 @@ function Xs(e, t) {
|
|
|
1366
1366
|
const r = window.getSelection(), i = document.createRange();
|
|
1367
1367
|
return i.setStart(o, 0), i.collapse(!0), r.removeAllRanges(), r.addRange(i), !0;
|
|
1368
1368
|
}
|
|
1369
|
-
function
|
|
1369
|
+
function Ws(e, t) {
|
|
1370
1370
|
if (zt(e)) return null;
|
|
1371
1371
|
const n = e.previousElementSibling;
|
|
1372
1372
|
if (!n) return null;
|
|
@@ -1382,7 +1382,7 @@ function js(e, t) {
|
|
|
1382
1382
|
e.remove(), P(o, 0);
|
|
1383
1383
|
} : null;
|
|
1384
1384
|
}
|
|
1385
|
-
function
|
|
1385
|
+
function Ys(e) {
|
|
1386
1386
|
const t = V(e);
|
|
1387
1387
|
if (!t || !t.collapsed) return null;
|
|
1388
1388
|
const n = X(t.startContainer, e);
|
|
@@ -1394,19 +1394,19 @@ function Ws(e) {
|
|
|
1394
1394
|
const s = ft(o);
|
|
1395
1395
|
l && Ue(l), P(s, 0);
|
|
1396
1396
|
} : o.parentElement?.parentElement?.tagName === "LI" ? () => {
|
|
1397
|
-
|
|
1397
|
+
Ur(o), P(n, 0);
|
|
1398
1398
|
} : null;
|
|
1399
1399
|
}
|
|
1400
|
-
const r =
|
|
1400
|
+
const r = Kr(n, e);
|
|
1401
1401
|
if (r) return () => {
|
|
1402
1402
|
un(r, n), Ue(r), P(n, 0);
|
|
1403
1403
|
};
|
|
1404
1404
|
const i = Zn(n, e);
|
|
1405
1405
|
return i ? () => {
|
|
1406
1406
|
un(i, n), Ue(i), P(n, 0);
|
|
1407
|
-
} :
|
|
1407
|
+
} : Ws(n, e);
|
|
1408
1408
|
}
|
|
1409
|
-
function
|
|
1409
|
+
function Qs(e, t) {
|
|
1410
1410
|
const n = Oe(e, t) || xn(e)[0];
|
|
1411
1411
|
if (!n) return !1;
|
|
1412
1412
|
const o = n.cloneNode(!0);
|
|
@@ -1414,7 +1414,7 @@ function Ys(e, t) {
|
|
|
1414
1414
|
r.checked ? r.setAttribute("checked", "") : r.removeAttribute("checked");
|
|
1415
1415
|
}), n.after(o), !0;
|
|
1416
1416
|
}
|
|
1417
|
-
function
|
|
1417
|
+
function Zs(e, t) {
|
|
1418
1418
|
const n = Oe(e, t) || xn(e)[0];
|
|
1419
1419
|
if (!n) return !1;
|
|
1420
1420
|
if (e.children.length <= 1) {
|
|
@@ -1434,16 +1434,16 @@ function $o(e, t, n) {
|
|
|
1434
1434
|
const r = Array.from(o.parentElement.children).filter((l) => !it(l)), i = r[r.indexOf(o) + n];
|
|
1435
1435
|
return i ? (n < 0 ? i.before(o) : i.after(o), !0) : !1;
|
|
1436
1436
|
}
|
|
1437
|
-
function
|
|
1437
|
+
function Js(e, t, n) {
|
|
1438
1438
|
return !e || !t || e === t || e.contains(t) || t.contains(e) ? !1 : (n ? t.before(e) : t.after(e), !0);
|
|
1439
1439
|
}
|
|
1440
|
-
function
|
|
1440
|
+
function ea(e) {
|
|
1441
1441
|
const t = e.parentElement, n = e.previousElementSibling;
|
|
1442
1442
|
if (!t || !n) return !1;
|
|
1443
1443
|
let o = Array.from(n.children).find((r) => r.tagName === t.tagName && r.getAttribute("data-type") === t.getAttribute("data-type"));
|
|
1444
1444
|
return o || (o = document.createElement(t.tagName), t.hasAttribute("data-type") && o.setAttribute("data-type", t.getAttribute("data-type")), (we(n) ? ko(n) : n).appendChild(o)), o.appendChild(e), !0;
|
|
1445
1445
|
}
|
|
1446
|
-
function
|
|
1446
|
+
function Ur(e) {
|
|
1447
1447
|
const t = e.parentElement;
|
|
1448
1448
|
if (!t || t.tagName !== "UL" && t.tagName !== "OL") return !1;
|
|
1449
1449
|
const n = t.parentElement;
|
|
@@ -1456,24 +1456,24 @@ function qr(e) {
|
|
|
1456
1456
|
n.after(e);
|
|
1457
1457
|
return Ue(t), !0;
|
|
1458
1458
|
}
|
|
1459
|
-
function
|
|
1459
|
+
function ta(e, t = !1) {
|
|
1460
1460
|
const n = V(e);
|
|
1461
1461
|
if (!n || !n.collapsed) return !1;
|
|
1462
1462
|
const o = X(n.startContainer, e);
|
|
1463
1463
|
if (!o) return !1;
|
|
1464
1464
|
if (t) return Do(n);
|
|
1465
|
-
if (
|
|
1465
|
+
if (hr(o)) return js(o, n);
|
|
1466
1466
|
if (zt(o)) return Do(n);
|
|
1467
1467
|
const r = yo(o, e);
|
|
1468
1468
|
if (r && ze(o))
|
|
1469
1469
|
return ft(r), P(r.nextElementSibling || r, 0), !0;
|
|
1470
|
-
const i =
|
|
1470
|
+
const i = Kr(o, e);
|
|
1471
1471
|
if (i && ze(o))
|
|
1472
1472
|
return un(i, o), Ue(i), P(o, 0), !0;
|
|
1473
1473
|
const l = Zn(o, e);
|
|
1474
1474
|
if (l && ze(o))
|
|
1475
1475
|
return un(l, o), Ue(l), P(o, 0), !0;
|
|
1476
|
-
if (l && o ===
|
|
1476
|
+
if (l && o === va(l) && ae(o, n.startContainer, n.startOffset) >= Ae(o)) {
|
|
1477
1477
|
const u = document.createElement("p");
|
|
1478
1478
|
return u.appendChild(document.createElement("br")), l.after(u), P(u, 0), !0;
|
|
1479
1479
|
}
|
|
@@ -1502,13 +1502,13 @@ function wt(e) {
|
|
|
1502
1502
|
Lt(e) || e.replaceChildren(document.createElement("br"));
|
|
1503
1503
|
}
|
|
1504
1504
|
}
|
|
1505
|
-
const Tn = "line-height", Sn = "text-align", wn = "padding-left", an = "text-indent",
|
|
1505
|
+
const Tn = "line-height", Sn = "text-align", wn = "padding-left", an = "text-indent", na = "margin-top", oa = "margin-bottom", Vr = [Tn, Sn, wn, an, na, oa], Jt = "data-battrs", _o = (e) => Math.min(Math.max(Math.round(Number(e) || 0), 0), Cn);
|
|
1506
1506
|
function dt(e, t = null, n = null) {
|
|
1507
1507
|
const o = [], r = (n || (t || ao(e)).map((i) => i.block)).filter((i) => i?.isConnected);
|
|
1508
1508
|
for (const i of r) {
|
|
1509
|
-
const l =
|
|
1509
|
+
const l = rl(i, e);
|
|
1510
1510
|
if (!l) continue;
|
|
1511
|
-
const s =
|
|
1511
|
+
const s = il(l);
|
|
1512
1512
|
s && !o.includes(s) && o.push(s);
|
|
1513
1513
|
}
|
|
1514
1514
|
return o;
|
|
@@ -1530,7 +1530,7 @@ function cn(e) {
|
|
|
1530
1530
|
const n = Number.parseFloat(t);
|
|
1531
1531
|
return Number.isNaN(n) || n <= 0 ? 0 : t.endsWith("em") ? _o(n / Gn) : _o(n / (Gn * 16));
|
|
1532
1532
|
}
|
|
1533
|
-
function
|
|
1533
|
+
function ra(e) {
|
|
1534
1534
|
return {
|
|
1535
1535
|
lineHeight: ke(e, Tn),
|
|
1536
1536
|
textAlign: ke(e, Sn) || null,
|
|
@@ -1548,27 +1548,27 @@ function Pt(e, t) {
|
|
|
1548
1548
|
}
|
|
1549
1549
|
return n;
|
|
1550
1550
|
}
|
|
1551
|
-
const
|
|
1551
|
+
const ia = (e) => e > 0 ? `${e * Gn}em` : "", la = (e, t, n) => Pt(dt(e, n), () => ({ [Tn]: t || "" })), sa = (e, t, n) => Pt(dt(e, n), () => ({ [Sn]: t || "" }));
|
|
1552
1552
|
function Po(e, t, n) {
|
|
1553
1553
|
return Pt(dt(e, n), (o) => {
|
|
1554
1554
|
const r = cn(o), i = t > 0 ? r >= Cn ? null : r + 1 : r > 0 ? r - 1 : null;
|
|
1555
|
-
return i === null ? null : { [wn]:
|
|
1555
|
+
return i === null ? null : { [wn]: ia(i) };
|
|
1556
1556
|
});
|
|
1557
1557
|
}
|
|
1558
|
-
function
|
|
1558
|
+
function aa(e, t) {
|
|
1559
1559
|
return Pt(dt(e, t), (n) => ({
|
|
1560
1560
|
[an]: ke(n, an) ? "" : "2em"
|
|
1561
1561
|
}));
|
|
1562
1562
|
}
|
|
1563
|
-
function
|
|
1564
|
-
return Pt(dt(e, t), (n) =>
|
|
1563
|
+
function ca(e, t) {
|
|
1564
|
+
return Pt(dt(e, t), (n) => Vr.some((r) => ke(n, r)) ? { [Tn]: "", [Sn]: "", [wn]: "" } : null);
|
|
1565
1565
|
}
|
|
1566
1566
|
function Ft(e) {
|
|
1567
1567
|
if (!e) return "";
|
|
1568
1568
|
const t = e.tagName;
|
|
1569
1569
|
return t === "H1" && e.classList.contains(H.TITLE) ? "title" : /^H[1-6]$/.test(t) ? `heading${t[1]}` : t === "P" ? "paragraph" : t === "BLOCKQUOTE" ? "blockquote" : t === "PRE" ? "codeBlock" : t === "HR" ? "divider" : t === "IMG" ? "image" : t === "TABLE" ? "table" : t === "UL" ? e.getAttribute("data-type") === "taskList" ? "taskList" : "bulletList" : t === "OL" ? "orderedList" : t === "LI" ? we(e) ? "taskItem" : "listItem" : e.hasAttribute(He) ? "callout" : e.hasAttribute(fe) ? "superBlock" : e.hasAttribute(ye) ? "column" : "";
|
|
1570
1570
|
}
|
|
1571
|
-
const
|
|
1571
|
+
const Gr = (e, t) => Ft(ua(e, t));
|
|
1572
1572
|
function qt(e, t) {
|
|
1573
1573
|
!e || !t?.contains(e) || t.before(e);
|
|
1574
1574
|
}
|
|
@@ -1592,7 +1592,7 @@ function Ue(e) {
|
|
|
1592
1592
|
t.remove(), t = o;
|
|
1593
1593
|
}
|
|
1594
1594
|
}
|
|
1595
|
-
const yo = (e, t) => Xe(e, (n) => n.tagName === "LI", t),
|
|
1595
|
+
const yo = (e, t) => Xe(e, (n) => n.tagName === "LI", t), ua = (e, t) => Xe(e, (n) => n.tagName === "UL" || n.tagName === "OL", t), Kr = (e, t) => Xe(e, (n) => n.tagName === "BLOCKQUOTE", t);
|
|
1596
1596
|
function ko(e) {
|
|
1597
1597
|
let t = Array.from(e.children).find((n) => n.tagName === "DIV");
|
|
1598
1598
|
if (!t) {
|
|
@@ -1610,14 +1610,14 @@ function Co() {
|
|
|
1610
1610
|
return t.type = "checkbox", e.appendChild(t), { label: e, input: t };
|
|
1611
1611
|
}
|
|
1612
1612
|
function dn(e, t) {
|
|
1613
|
-
for (const n of
|
|
1613
|
+
for (const n of Vr) {
|
|
1614
1614
|
const o = ke(e, n);
|
|
1615
1615
|
o && Mt(t, n, o);
|
|
1616
1616
|
}
|
|
1617
1617
|
for (const n of Array.from(e.attributes))
|
|
1618
|
-
n.name.startsWith("data-") && !
|
|
1618
|
+
n.name.startsWith("data-") && !wr.includes(n.name) && t.setAttribute(n.name, n.value);
|
|
1619
1619
|
}
|
|
1620
|
-
function
|
|
1620
|
+
function da(e, t) {
|
|
1621
1621
|
const n = document.createElement("li");
|
|
1622
1622
|
dn(e, n);
|
|
1623
1623
|
const o = document.createDocumentFragment();
|
|
@@ -1629,11 +1629,11 @@ function ua(e, t) {
|
|
|
1629
1629
|
n.appendChild(o);
|
|
1630
1630
|
return n;
|
|
1631
1631
|
}
|
|
1632
|
-
function
|
|
1632
|
+
function fa(e, t) {
|
|
1633
1633
|
const n = document.createElement(t === "orderedList" ? "ol" : "ul");
|
|
1634
1634
|
t === "taskList" && n.setAttribute("data-type", "taskList"), co(e, n);
|
|
1635
1635
|
for (const o of e)
|
|
1636
|
-
n.appendChild(
|
|
1636
|
+
n.appendChild(da(o, t)), o.remove();
|
|
1637
1637
|
return n;
|
|
1638
1638
|
}
|
|
1639
1639
|
function ft(e) {
|
|
@@ -1660,17 +1660,17 @@ function Ne(e, t, n = null) {
|
|
|
1660
1660
|
if (t === "title" || t === "paragraph" || r) {
|
|
1661
1661
|
const i = t === "title" ? "H1" : r ? `H${r[1]}` : "P", l = t === "title";
|
|
1662
1662
|
let s = !1;
|
|
1663
|
-
for (const a of [...o]) s =
|
|
1663
|
+
for (const a of [...o]) s = ha(a, i, l) || s;
|
|
1664
1664
|
return s;
|
|
1665
1665
|
}
|
|
1666
|
-
return t === "blockquote" ?
|
|
1666
|
+
return t === "blockquote" ? ma(e, o) : t === "codeBlock" ? pa(e, o) : t === "bulletList" || t === "orderedList" || t === "taskList" ? ga(e, o, t) : t === "callout" ? ba(o) : t === "superBlock" ? ya(o) : !1;
|
|
1667
1667
|
}
|
|
1668
1668
|
function Fo(e, t) {
|
|
1669
1669
|
if (!e || t === null) return !1;
|
|
1670
1670
|
const n = e.classList.contains(H.TITLE);
|
|
1671
1671
|
return t === n ? !1 : (t ? e.classList.add(H.TITLE) : e.classList.remove(H.TITLE), !0);
|
|
1672
1672
|
}
|
|
1673
|
-
function
|
|
1673
|
+
function ha(e, t, n = null) {
|
|
1674
1674
|
if (!e.isConnected || e.tagName === "HR" || e.tagName === "IMG" || e.tagName === "TABLE") return !1;
|
|
1675
1675
|
let o = null;
|
|
1676
1676
|
if (e.tagName === "PRE") {
|
|
@@ -1696,7 +1696,7 @@ function fa(e, t, n = null) {
|
|
|
1696
1696
|
}
|
|
1697
1697
|
return o && Fo(o, n), !0;
|
|
1698
1698
|
}
|
|
1699
|
-
function
|
|
1699
|
+
function ma(e, t) {
|
|
1700
1700
|
if (t.every((r) => r.tagName === "BLOCKQUOTE")) {
|
|
1701
1701
|
for (const r of t)
|
|
1702
1702
|
Array.from(r.children).forEach((i) => qt(i, r)), r.remove();
|
|
@@ -1709,7 +1709,7 @@ function ha(e, t) {
|
|
|
1709
1709
|
const o = document.createElement("blockquote");
|
|
1710
1710
|
return co(n, o), !0;
|
|
1711
1711
|
}
|
|
1712
|
-
function
|
|
1712
|
+
function pa(e, t) {
|
|
1713
1713
|
const n = t.filter((l) => l.tagName === "PRE");
|
|
1714
1714
|
if (n.length)
|
|
1715
1715
|
return n.forEach(Ln), !0;
|
|
@@ -1717,7 +1717,7 @@ function ma(e, t) {
|
|
|
1717
1717
|
return i.textContent = o.join(`
|
|
1718
1718
|
`), r.appendChild(i), t[0].before(r), t.forEach((l) => l.remove()), !0;
|
|
1719
1719
|
}
|
|
1720
|
-
function
|
|
1720
|
+
function ga(e, t, n) {
|
|
1721
1721
|
const o = /* @__PURE__ */ new Set(), r = [];
|
|
1722
1722
|
for (const c of t)
|
|
1723
1723
|
c.tagName === "UL" || c.tagName === "OL" ? o.add(c) : c.tagName === "LI" ? o.add(c.parentElement) : r.push(c);
|
|
@@ -1735,7 +1735,7 @@ function pa(e, t, n) {
|
|
|
1735
1735
|
if (!l.length) return !1;
|
|
1736
1736
|
let s = [];
|
|
1737
1737
|
const a = () => {
|
|
1738
|
-
s.length &&
|
|
1738
|
+
s.length && fa(s, n), s = [];
|
|
1739
1739
|
};
|
|
1740
1740
|
for (const c of l)
|
|
1741
1741
|
s.length && c.previousElementSibling !== s[s.length - 1] && a(), s.push(c);
|
|
@@ -1747,7 +1747,7 @@ function Zn(e, t) {
|
|
|
1747
1747
|
Ot(o) && (n = o), o = o.parentElement;
|
|
1748
1748
|
return n;
|
|
1749
1749
|
}
|
|
1750
|
-
function
|
|
1750
|
+
function va(e) {
|
|
1751
1751
|
if (!e) return null;
|
|
1752
1752
|
if (e.hasAttribute(fe)) {
|
|
1753
1753
|
const t = e.lastElementChild;
|
|
@@ -1755,7 +1755,7 @@ function ga(e) {
|
|
|
1755
1755
|
}
|
|
1756
1756
|
return e.lastElementChild;
|
|
1757
1757
|
}
|
|
1758
|
-
function
|
|
1758
|
+
function ba(e) {
|
|
1759
1759
|
if (e.every((o) => o.hasAttribute(He))) {
|
|
1760
1760
|
for (const o of e)
|
|
1761
1761
|
Array.from(o.children).forEach((r) => qt(r, o)), o.remove();
|
|
@@ -1766,7 +1766,7 @@ function va(e) {
|
|
|
1766
1766
|
const n = document.createElement("div");
|
|
1767
1767
|
return n.setAttribute(He, "info"), co(t, n), !0;
|
|
1768
1768
|
}
|
|
1769
|
-
function
|
|
1769
|
+
function ya(e) {
|
|
1770
1770
|
if (e.every((o) => o.hasAttribute(fe))) {
|
|
1771
1771
|
for (const o of e) {
|
|
1772
1772
|
for (const r of Array.from(o.children))
|
|
@@ -1788,7 +1788,7 @@ function ba(e) {
|
|
|
1788
1788
|
}
|
|
1789
1789
|
return !0;
|
|
1790
1790
|
}
|
|
1791
|
-
function
|
|
1791
|
+
function ka(e) {
|
|
1792
1792
|
const t = e?.getAttribute?.(Jt);
|
|
1793
1793
|
if (!t) return {};
|
|
1794
1794
|
try {
|
|
@@ -1798,7 +1798,7 @@ function ya(e) {
|
|
|
1798
1798
|
return {};
|
|
1799
1799
|
}
|
|
1800
1800
|
}
|
|
1801
|
-
function
|
|
1801
|
+
function Ca(e, t) {
|
|
1802
1802
|
if (!e?.setAttribute) return !1;
|
|
1803
1803
|
const n = {};
|
|
1804
1804
|
for (const [l, s] of Object.entries(t || {})) {
|
|
@@ -1808,13 +1808,13 @@ function ka(e, t) {
|
|
|
1808
1808
|
const o = Object.keys(n).sort(), r = o.length ? JSON.stringify(n, o) : "", i = e.getAttribute(Jt) || "";
|
|
1809
1809
|
return r === i ? !1 : (r ? e.setAttribute(Jt, r) : e.removeAttribute(Jt), !0);
|
|
1810
1810
|
}
|
|
1811
|
-
function
|
|
1811
|
+
function Xr(e) {
|
|
1812
1812
|
const t = V(e);
|
|
1813
1813
|
if (!t) return null;
|
|
1814
1814
|
const n = X(t.startContainer, e);
|
|
1815
1815
|
return n ? Ke(n, e) || n : null;
|
|
1816
1816
|
}
|
|
1817
|
-
const
|
|
1817
|
+
const Ea = [
|
|
1818
1818
|
{ re: /^#\s$/, kind: "heading1" },
|
|
1819
1819
|
{ re: /^##\s$/, kind: "heading2" },
|
|
1820
1820
|
{ re: /^###\s$/, kind: "heading3" },
|
|
@@ -1827,12 +1827,12 @@ const Ca = [
|
|
|
1827
1827
|
{ re: /^(?:\[[ xX]?\]|\(\s?\))\s$/, kind: "taskList" },
|
|
1828
1828
|
{ re: /^```$/, kind: "codeBlock" },
|
|
1829
1829
|
{ re: /^---$/, kind: "divider" }
|
|
1830
|
-
],
|
|
1830
|
+
], Aa = [
|
|
1831
1831
|
{ re: /\*\*([^*]+)\*\*$/, key: "bold", open: 2, close: 2 },
|
|
1832
1832
|
{ re: /(?:^|\s)\*([^*\s][^*]*)\*$/, key: "italic", open: 1, close: 1 },
|
|
1833
1833
|
{ re: /~~([^~]+)~~$/, key: "strike", open: 2, close: 2 },
|
|
1834
1834
|
{ re: /`([^`]+)`$/, key: "code", open: 1, close: 1 }
|
|
1835
|
-
],
|
|
1835
|
+
], Ta = {
|
|
1836
1836
|
"Mod-z": ["undo"],
|
|
1837
1837
|
"Mod-Shift-z": ["redo"],
|
|
1838
1838
|
"Mod-y": ["redo"],
|
|
@@ -1860,7 +1860,7 @@ const Ca = [
|
|
|
1860
1860
|
"Mod-Shift-b": ["insertBlockNear", null, "before"],
|
|
1861
1861
|
"Mod-Shift-a": ["insertBlockNear", null, "after"]
|
|
1862
1862
|
};
|
|
1863
|
-
function
|
|
1863
|
+
function Sa(e, t) {
|
|
1864
1864
|
const n = V(e), o = n && De(n.startContainer, e);
|
|
1865
1865
|
if (!o) return !1;
|
|
1866
1866
|
const r = $e(o, e), i = Array.from(r.querySelectorAll("td,th")), l = i[i.indexOf(o) + (t ? -1 : 1)];
|
|
@@ -1874,7 +1874,7 @@ function Ta(e, t) {
|
|
|
1874
1874
|
}
|
|
1875
1875
|
return s.after(a), P(he(a.firstElementChild, e) || a.firstElementChild, 0), !0;
|
|
1876
1876
|
}
|
|
1877
|
-
function
|
|
1877
|
+
function wa(e) {
|
|
1878
1878
|
const t = e.parentElement;
|
|
1879
1879
|
return { parent: t, index: Array.from(t.children).indexOf(e) };
|
|
1880
1880
|
}
|
|
@@ -1883,24 +1883,24 @@ function qo(e) {
|
|
|
1883
1883
|
if (!n || !n.collapsed) return !1;
|
|
1884
1884
|
const o = X(n.startContainer, t);
|
|
1885
1885
|
if (!o) return !1;
|
|
1886
|
-
const r =
|
|
1886
|
+
const r = Ea.find((i) => i.re.test(o.textContent || ""));
|
|
1887
1887
|
return r ? (e.run(() => {
|
|
1888
1888
|
if (r.kind === "divider") {
|
|
1889
|
-
|
|
1889
|
+
Fr(t);
|
|
1890
1890
|
return;
|
|
1891
1891
|
}
|
|
1892
|
-
const i =
|
|
1892
|
+
const i = wa(o);
|
|
1893
1893
|
Ne(t, r.kind, [o]);
|
|
1894
1894
|
const l = i.parent?.children[i.index] || o, s = he(l, t) || l;
|
|
1895
1895
|
s.textContent = "", s.appendChild(document.createElement("br")), P(s, 0);
|
|
1896
1896
|
}, { merge: !0 }), !0) : !1;
|
|
1897
1897
|
}
|
|
1898
|
-
function
|
|
1898
|
+
function xa(e) {
|
|
1899
1899
|
const t = e.root, n = V(t);
|
|
1900
1900
|
if (!n || !n.collapsed) return !1;
|
|
1901
1901
|
const o = X(n.startContainer, t);
|
|
1902
1902
|
if (!o) return !1;
|
|
1903
|
-
const r = ae(o, n.startContainer, n.startOffset), i = (o.textContent || "").slice(0, r), l =
|
|
1903
|
+
const r = ae(o, n.startContainer, n.startOffset), i = (o.textContent || "").slice(0, r), l = Aa.map((p) => ({ rule: p, match: i.match(p.re) })).find((p) => p.match);
|
|
1904
1904
|
if (!l) return !1;
|
|
1905
1905
|
const { rule: s, match: a } = l, c = r - a[0].length, f = c + s.open, u = f + a[1].length;
|
|
1906
1906
|
return e.run(() => {
|
|
@@ -1989,12 +1989,12 @@ function Eo(e, t) {
|
|
|
1989
1989
|
p.appendChild(u), r.after(p);
|
|
1990
1990
|
for (const m of l) p.before(m);
|
|
1991
1991
|
r !== p && ze(r) && r.remove();
|
|
1992
|
-
for (const m of l) Re(m, n) &&
|
|
1992
|
+
for (const m of l) Re(m, n) && Es(m);
|
|
1993
1993
|
Wt(p);
|
|
1994
1994
|
const y = p.previousElementSibling, E = he(y, n) || y || r;
|
|
1995
1995
|
P(E, Ae(E));
|
|
1996
1996
|
}
|
|
1997
|
-
function
|
|
1997
|
+
function La(e, t) {
|
|
1998
1998
|
const n = String(t).split(/\r?\n/);
|
|
1999
1999
|
if (n.length === 1) {
|
|
2000
2000
|
e.run(() => {
|
|
@@ -2016,28 +2016,28 @@ function xa(e, t) {
|
|
|
2016
2016
|
}
|
|
2017
2017
|
e.run(() => Eo(e, o));
|
|
2018
2018
|
}
|
|
2019
|
-
const
|
|
2020
|
-
function
|
|
2019
|
+
const Ma = (e, t) => /<table[\s>]/i.test(t || "") || /\t/.test(e || "");
|
|
2020
|
+
function Na(e, t) {
|
|
2021
2021
|
const n = t.clipboardData;
|
|
2022
2022
|
if (!n) return;
|
|
2023
|
-
const o =
|
|
2023
|
+
const o = ur(n);
|
|
2024
2024
|
if (o.length) {
|
|
2025
2025
|
t.preventDefault(), e.insertImageFiles(o);
|
|
2026
2026
|
return;
|
|
2027
2027
|
}
|
|
2028
2028
|
const r = n.getData("text/html"), i = n.getData("text/plain"), l = V(e.root);
|
|
2029
|
-
if (
|
|
2029
|
+
if (Ma(i, r) && l && De(l.startContainer, e.root)) {
|
|
2030
2030
|
t.preventDefault(), e.pasteTableData({ text: i, html: r });
|
|
2031
2031
|
return;
|
|
2032
2032
|
}
|
|
2033
2033
|
if (r) {
|
|
2034
|
-
t.preventDefault(), e.run(() => Eo(e,
|
|
2034
|
+
t.preventDefault(), e.run(() => Eo(e, xr(Dr(r))));
|
|
2035
2035
|
return;
|
|
2036
2036
|
}
|
|
2037
|
-
i && (t.preventDefault(),
|
|
2037
|
+
i && (t.preventDefault(), La(e, i));
|
|
2038
2038
|
}
|
|
2039
|
-
function
|
|
2040
|
-
const n =
|
|
2039
|
+
function Ra(e, t) {
|
|
2040
|
+
const n = ur(t.dataTransfer);
|
|
2041
2041
|
if (!n.length) return;
|
|
2042
2042
|
t.preventDefault();
|
|
2043
2043
|
const o = e.root.ownerDocument.caretRangeFromPoint?.(t.clientX, t.clientY);
|
|
@@ -2047,28 +2047,28 @@ function Na(e, t) {
|
|
|
2047
2047
|
}
|
|
2048
2048
|
e.insertImageFiles(n);
|
|
2049
2049
|
}
|
|
2050
|
-
function
|
|
2050
|
+
function Oa(e) {
|
|
2051
2051
|
if (!e.hasPendingMarks()) return;
|
|
2052
2052
|
const t = e.root, n = V(t), o = n && X(n.startContainer, t);
|
|
2053
2053
|
if (!o) return;
|
|
2054
2054
|
const r = ae(o, n.startContainer, n.startOffset), i = e.pending;
|
|
2055
2055
|
e.run(() => bo(t, o, 0, r, i));
|
|
2056
2056
|
}
|
|
2057
|
-
function
|
|
2057
|
+
function Ba(e) {
|
|
2058
2058
|
const t = e.root, o = go({ keydown: (u) => {
|
|
2059
2059
|
if (!e.isFocused() || u.defaultPrevented) return !1;
|
|
2060
|
-
const p =
|
|
2060
|
+
const p = Ta[Xl(u) || ""];
|
|
2061
2061
|
if (p)
|
|
2062
2062
|
return u.preventDefault(), u.stopPropagation(), p[0] === "requestLink" ? e.emit("request-link") : p[0] === "requestFind" ? e.emit("open-find") : e.exec(p[0], ...p.slice(1)), !0;
|
|
2063
2063
|
if (u.key === "Enter")
|
|
2064
|
-
return e.isMenuOpen() ? !1 : (u.preventDefault(), u.stopPropagation(), e.run(() =>
|
|
2064
|
+
return e.isMenuOpen() ? !1 : (u.preventDefault(), u.stopPropagation(), e.run(() => ta(t, u.shiftKey)), !0);
|
|
2065
2065
|
if (u.key === "Backspace") {
|
|
2066
|
-
const y =
|
|
2066
|
+
const y = Ys(t);
|
|
2067
2067
|
return y ? (u.preventDefault(), u.stopPropagation(), e.run(y), !0) : !1;
|
|
2068
2068
|
}
|
|
2069
|
-
return u.key === "Tab" || u.key === "Shift-Tab" ? (u.preventDefault(), u.stopPropagation(), e.run(() =>
|
|
2069
|
+
return u.key === "Tab" || u.key === "Shift-Tab" ? (u.preventDefault(), u.stopPropagation(), e.run(() => Ia(e, u.shiftKey)), !0) : !1;
|
|
2070
2070
|
} }, { priority: yn.APPLET, active: () => e.isFocused() }), r = (u) => {
|
|
2071
|
-
if (e.suggesting &&
|
|
2071
|
+
if (e.suggesting && as(t, u)) {
|
|
2072
2072
|
u.preventDefault();
|
|
2073
2073
|
return;
|
|
2074
2074
|
}
|
|
@@ -2090,7 +2090,7 @@ function Oa(e) {
|
|
|
2090
2090
|
});
|
|
2091
2091
|
}, i = (u) => {
|
|
2092
2092
|
if ((u.inputType === "deleteContentBackward" || u.inputType === "deleteContentForward") && e.clearPendingMarks(), u.inputType === "insertText" || u.inputType === "insertCompositionText") {
|
|
2093
|
-
if (
|
|
2093
|
+
if (xa(e)) return;
|
|
2094
2094
|
qo(e);
|
|
2095
2095
|
return;
|
|
2096
2096
|
}
|
|
@@ -2098,26 +2098,26 @@ function Oa(e) {
|
|
|
2098
2098
|
}, l = () => {
|
|
2099
2099
|
e.composing = !0;
|
|
2100
2100
|
}, s = () => {
|
|
2101
|
-
e.composing = !1,
|
|
2102
|
-
}, a = (u) =>
|
|
2101
|
+
e.composing = !1, Oa(e), e.emit("update");
|
|
2102
|
+
}, a = (u) => Na(e, u), c = (u) => Ra(e, u), f = (u) => {
|
|
2103
2103
|
u.dataTransfer?.types?.includes("Files") && u.preventDefault();
|
|
2104
2104
|
};
|
|
2105
2105
|
return t.addEventListener("beforeinput", r), t.addEventListener("input", i), t.addEventListener("compositionstart", l), t.addEventListener("compositionend", s), t.addEventListener("paste", a), t.addEventListener("drop", c), t.addEventListener("dragover", f), () => {
|
|
2106
2106
|
o(), t.removeEventListener("beforeinput", r), t.removeEventListener("input", i), t.removeEventListener("compositionstart", l), t.removeEventListener("compositionend", s), t.removeEventListener("paste", a), t.removeEventListener("drop", c), t.removeEventListener("dragover", f);
|
|
2107
2107
|
};
|
|
2108
2108
|
}
|
|
2109
|
-
function
|
|
2109
|
+
function Ia(e, t) {
|
|
2110
2110
|
const n = e.root;
|
|
2111
|
-
if (
|
|
2111
|
+
if (Sa(n, t)) return;
|
|
2112
2112
|
const o = V(n), r = o && X(o.startContainer, n), i = r ? yo(r, n) : null;
|
|
2113
2113
|
if (i) {
|
|
2114
2114
|
if (t) {
|
|
2115
|
-
if (
|
|
2116
|
-
} else if (
|
|
2115
|
+
if (Ur(i)) return;
|
|
2116
|
+
} else if (ea(i)) return;
|
|
2117
2117
|
}
|
|
2118
2118
|
e.exec(t ? "decreaseBlockIndent" : "increaseBlockIndent");
|
|
2119
2119
|
}
|
|
2120
|
-
function
|
|
2120
|
+
function Ha(e, t, n) {
|
|
2121
2121
|
if (!t || !n) return null;
|
|
2122
2122
|
let o = Math.min(t.r, n.r), r = Math.max(t.r + t.rowspan - 1, n.r + n.rowspan - 1), i = Math.min(t.c, n.c), l = Math.max(t.c + t.colspan - 1, n.c + n.colspan - 1), s = !0;
|
|
2123
2123
|
for (; s; ) {
|
|
@@ -2127,14 +2127,14 @@ function Ia(e, t, n) {
|
|
|
2127
2127
|
}
|
|
2128
2128
|
return { r1: o, c1: i, r2: r, c2: l };
|
|
2129
2129
|
}
|
|
2130
|
-
function
|
|
2130
|
+
function za(e) {
|
|
2131
2131
|
for (const t of e) {
|
|
2132
2132
|
const n = t.c, o = t.r, r = t.colspan, i = t.rowspan;
|
|
2133
2133
|
t.r = n, t.c = o, t.rowspan = r, t.colspan = i;
|
|
2134
2134
|
}
|
|
2135
2135
|
return e;
|
|
2136
2136
|
}
|
|
2137
|
-
const Ao = 50, en = "data-pin-head", ot = (e, t) => `${e},${t}`,
|
|
2137
|
+
const Ao = 50, en = "data-pin-head", ot = (e, t) => `${e},${t}`, jr = (e) => !e.textContent?.trim() && !e.querySelector("img");
|
|
2138
2138
|
function ue(e) {
|
|
2139
2139
|
const t = [], n = /* @__PURE__ */ new Map();
|
|
2140
2140
|
let o = 0;
|
|
@@ -2188,28 +2188,28 @@ function Mn(e) {
|
|
|
2188
2188
|
const t = document.createElement(e ? "th" : "td");
|
|
2189
2189
|
return t.appendChild(document.createElement("br")), t;
|
|
2190
2190
|
}
|
|
2191
|
-
function
|
|
2191
|
+
function Da(e) {
|
|
2192
2192
|
const t = e.matrix[0];
|
|
2193
2193
|
return !!t && t.every((n) => n && n.el.tagName === "TH");
|
|
2194
2194
|
}
|
|
2195
|
-
function
|
|
2195
|
+
function $a(e) {
|
|
2196
2196
|
const t = e.cells.filter((n) => n.c === 0);
|
|
2197
2197
|
return !!t.length && t.every((n) => n.el.tagName === "TH");
|
|
2198
2198
|
}
|
|
2199
|
-
function
|
|
2200
|
-
return !!(t === 0 &&
|
|
2199
|
+
function Wr(e, t, n) {
|
|
2200
|
+
return !!(t === 0 && Da(e) || n === 0 && $a(e));
|
|
2201
2201
|
}
|
|
2202
2202
|
function st(e, t) {
|
|
2203
2203
|
return e.cells.find((n) => n.el === t) || null;
|
|
2204
2204
|
}
|
|
2205
|
-
function
|
|
2205
|
+
function _a(e, t, n) {
|
|
2206
2206
|
const o = document.elementFromPoint(t, n);
|
|
2207
2207
|
if (!o || !e.contains(o)) return null;
|
|
2208
2208
|
const r = De(o, e);
|
|
2209
2209
|
return r && $e(r, e) ? r : null;
|
|
2210
2210
|
}
|
|
2211
|
-
function
|
|
2212
|
-
const o = t ||
|
|
2211
|
+
function Pa(e, t = null, n = null) {
|
|
2212
|
+
const o = t || Fa(e), r = o ? $e(o, e) : null;
|
|
2213
2213
|
if (!r) return null;
|
|
2214
2214
|
const i = ue(r);
|
|
2215
2215
|
if (!i.height || !i.width) return null;
|
|
@@ -2225,7 +2225,7 @@ function _a(e, t = null, n = null) {
|
|
|
2225
2225
|
rect: s
|
|
2226
2226
|
};
|
|
2227
2227
|
}
|
|
2228
|
-
function
|
|
2228
|
+
function Fa(e) {
|
|
2229
2229
|
const t = window.getSelection();
|
|
2230
2230
|
if (!t || !t.rangeCount) return null;
|
|
2231
2231
|
const n = t.getRangeAt(0);
|
|
@@ -2240,12 +2240,12 @@ function eo(e, t, n) {
|
|
|
2240
2240
|
l.r + l.rowspan > i && l.r <= i - 1 ? l.rowspan += 1 : l.r >= i && (l.r += 1);
|
|
2241
2241
|
}), me(o);
|
|
2242
2242
|
for (let l = 0; l < o.width; l += 1)
|
|
2243
|
-
o.matrix[i]?.[l] || o.cells.push({ el: Mn(
|
|
2243
|
+
o.matrix[i]?.[l] || o.cells.push({ el: Mn(Wr(o, i, l)), r: i, c: l, rowspan: 1, colspan: 1 });
|
|
2244
2244
|
me(o), t = i;
|
|
2245
2245
|
}
|
|
2246
2246
|
return Se(o), !0;
|
|
2247
2247
|
}
|
|
2248
|
-
function
|
|
2248
|
+
function qa(e, t, n) {
|
|
2249
2249
|
const { grid: o } = e;
|
|
2250
2250
|
for (let r = t; r <= n; r += 1)
|
|
2251
2251
|
o.cells.forEach((i) => {
|
|
@@ -2261,12 +2261,12 @@ function to(e, t, n) {
|
|
|
2261
2261
|
l.c + l.colspan > i && l.c <= i - 1 ? l.colspan += 1 : l.c >= i && (l.c += 1);
|
|
2262
2262
|
}), me(o);
|
|
2263
2263
|
for (let l = 0; l < o.height; l += 1)
|
|
2264
|
-
o.matrix[l]?.[i] || o.matrix[l]?.[i - 1] && o.matrix[l][i - 1].c === i - 1 && o.matrix[l][i - 1].c + o.matrix[l][i - 1].colspan > i || o.cells.push({ el: Mn(
|
|
2264
|
+
o.matrix[l]?.[i] || o.matrix[l]?.[i - 1] && o.matrix[l][i - 1].c === i - 1 && o.matrix[l][i - 1].c + o.matrix[l][i - 1].colspan > i || o.cells.push({ el: Mn(Wr(o, l, i)), r: l, c: i, rowspan: 1, colspan: 1 });
|
|
2265
2265
|
me(o), t = i;
|
|
2266
2266
|
}
|
|
2267
2267
|
return Se(o), ht(o), !0;
|
|
2268
2268
|
}
|
|
2269
|
-
function
|
|
2269
|
+
function Ua(e, t, n) {
|
|
2270
2270
|
const { grid: o } = e;
|
|
2271
2271
|
for (let r = t; r <= n; r += 1)
|
|
2272
2272
|
o.cells.forEach((i) => {
|
|
@@ -2274,15 +2274,15 @@ function qa(e, t, n) {
|
|
|
2274
2274
|
}), o.cells = o.cells.filter((i) => i.el.isConnected), me(o);
|
|
2275
2275
|
return o.cells.length ? (Se(o), ht(o), !0) : (e.table.remove(), !0);
|
|
2276
2276
|
}
|
|
2277
|
-
function
|
|
2277
|
+
function Yr(e, t) {
|
|
2278
2278
|
return e.cells.some(
|
|
2279
|
-
(n) => n.r >= t.r1 && n.r + n.rowspan - 1 <= t.r2 && n.c >= t.c1 && n.c + n.colspan - 1 <= t.c2 ? !1 :
|
|
2279
|
+
(n) => n.r >= t.r1 && n.r + n.rowspan - 1 <= t.r2 && n.c >= t.c1 && n.c + n.colspan - 1 <= t.c2 ? !1 : Va(n, t)
|
|
2280
2280
|
);
|
|
2281
2281
|
}
|
|
2282
|
-
function
|
|
2282
|
+
function Va(e, t) {
|
|
2283
2283
|
return e.r <= t.r2 && e.r + e.rowspan - 1 >= t.r1 && e.c <= t.c2 && e.c + e.colspan - 1 >= t.c1 ? !(e.r >= t.r1 && e.c >= t.c1 && e.r + e.rowspan - 1 <= t.r2 && e.c + e.colspan - 1 <= t.c2) : !1;
|
|
2284
2284
|
}
|
|
2285
|
-
function
|
|
2285
|
+
function Ga(e) {
|
|
2286
2286
|
const { grid: t, rect: n } = e, o = t.matrix[n.r1]?.[n.c1];
|
|
2287
2287
|
if (!o) return !1;
|
|
2288
2288
|
if (o.rowspan > 1 || o.colspan > 1) {
|
|
@@ -2296,7 +2296,7 @@ function Va(e) {
|
|
|
2296
2296
|
}
|
|
2297
2297
|
return me(t), Se(t), !0;
|
|
2298
2298
|
}
|
|
2299
|
-
if (n.r1 === n.r2 && n.c1 === n.c2 ||
|
|
2299
|
+
if (n.r1 === n.r2 && n.c1 === n.c2 || Yr(t, n)) return !1;
|
|
2300
2300
|
const i = t.cells.filter((s) => s.r >= n.r1 && s.c >= n.c1 && s.r + s.rowspan - 1 <= n.r2 && s.c + s.colspan - 1 <= n.c2), l = o.el;
|
|
2301
2301
|
return i.filter((s) => s !== o).forEach((s) => {
|
|
2302
2302
|
const a = (s.el.textContent || "").trim();
|
|
@@ -2324,7 +2324,7 @@ function Ko(e, t) {
|
|
|
2324
2324
|
r.c === e.colIndex ? r.c = o : r.c === o && (r.c = e.colIndex);
|
|
2325
2325
|
}), Se(me(n)), ht(n), !0);
|
|
2326
2326
|
}
|
|
2327
|
-
const Xo = 4,
|
|
2327
|
+
const Xo = 4, Ka = 60;
|
|
2328
2328
|
function fn(e) {
|
|
2329
2329
|
return Array.from(e.children).find((t) => t.tagName === "COLGROUP") || null;
|
|
2330
2330
|
}
|
|
@@ -2344,7 +2344,7 @@ function ht(e) {
|
|
|
2344
2344
|
return l.style.width = `${Math.round((i || 0) / o * 1e3) / 10}%`, l;
|
|
2345
2345
|
}));
|
|
2346
2346
|
}
|
|
2347
|
-
function
|
|
2347
|
+
function Xa(e, t, n) {
|
|
2348
2348
|
const o = ue(e);
|
|
2349
2349
|
if (t < 0 || t >= o.width - 1) return !1;
|
|
2350
2350
|
const r = Math.round(e.getBoundingClientRect().width);
|
|
@@ -2352,52 +2352,52 @@ function Ka(e, t, n) {
|
|
|
2352
2352
|
const i = To(o), l = i[t] + i[t + 1], s = i[t] + n / r * 100;
|
|
2353
2353
|
return i[t] = Math.max(Xo, Math.min(s, l - Xo)), i[t + 1] = l - i[t], o._widths = i, ht(o), !0;
|
|
2354
2354
|
}
|
|
2355
|
-
function
|
|
2355
|
+
function ja(e, t) {
|
|
2356
2356
|
const n = e.getBoundingClientRect().width;
|
|
2357
2357
|
if (!(n > 0)) return null;
|
|
2358
2358
|
const o = parseFloat(getComputedStyle(e).width) || n, r = To(ue(e));
|
|
2359
2359
|
return { colIndex: t, widths: r.map((i) => i / 100 * o), total: o, scale: o / n };
|
|
2360
2360
|
}
|
|
2361
|
-
function
|
|
2361
|
+
function Wa(e, t, n) {
|
|
2362
2362
|
if (!t) return !1;
|
|
2363
2363
|
const o = ue(e), { colIndex: r, widths: i, total: l, scale: s } = t;
|
|
2364
2364
|
if (r !== o.width - 1 || i.length !== o.width) return !1;
|
|
2365
2365
|
const a = i[r], c = a + n * s;
|
|
2366
|
-
if (!Number.isFinite(c) || c < Math.min(
|
|
2366
|
+
if (!Number.isFinite(c) || c < Math.min(Ka, a)) return !1;
|
|
2367
2367
|
const f = l + (c - a);
|
|
2368
2368
|
return o._widths = i.map((u, p) => (p === r ? c : u) / f * 100), e.style.width = `${Math.round(f * 100) / 100}px`, ht(o), !0;
|
|
2369
2369
|
}
|
|
2370
|
-
function
|
|
2370
|
+
function Ya(e) {
|
|
2371
2371
|
const { table: t, grid: n } = e, o = fn(t);
|
|
2372
2372
|
return !o && !n.cells.some((r) => r.el.style.width) ? !1 : (o?.remove(), n.cells.forEach((r) => Mt(r.el, "width", "")), Mt(t, "width", "100%"), n._widths = null, !0);
|
|
2373
2373
|
}
|
|
2374
|
-
function
|
|
2374
|
+
function Qr(e) {
|
|
2375
2375
|
const { grid: t, rect: n } = e;
|
|
2376
2376
|
return t.cells.filter((o) => o.r <= n.r2 && o.r + o.rowspan - 1 >= n.r1 && o.c <= n.c2 && o.c + o.colspan - 1 >= n.c1);
|
|
2377
2377
|
}
|
|
2378
2378
|
function Me(e, t, n) {
|
|
2379
|
-
const o =
|
|
2379
|
+
const o = Qr(e);
|
|
2380
2380
|
if (!o.length) return !1;
|
|
2381
2381
|
let r = !1;
|
|
2382
2382
|
for (const i of o)
|
|
2383
2383
|
ke(i.el, t) !== (n || "") && (Mt(i.el, t, n || ""), r = !0);
|
|
2384
2384
|
return r;
|
|
2385
2385
|
}
|
|
2386
|
-
function
|
|
2386
|
+
function Qa(e) {
|
|
2387
2387
|
let t = !1;
|
|
2388
|
-
for (const n of
|
|
2389
|
-
|
|
2388
|
+
for (const n of Qr(e))
|
|
2389
|
+
jr(n.el) || (n.el.replaceChildren(document.createElement("br")), t = !0);
|
|
2390
2390
|
return t;
|
|
2391
2391
|
}
|
|
2392
|
-
function
|
|
2392
|
+
function Za(e) {
|
|
2393
2393
|
const { grid: t } = e;
|
|
2394
|
-
return t.cells.length ? (
|
|
2394
|
+
return t.cells.length ? (za(t.cells), Se(me(t)), ht(t), !0) : !1;
|
|
2395
2395
|
}
|
|
2396
|
-
function
|
|
2396
|
+
function Ja(e, t, n) {
|
|
2397
2397
|
const { grid: o, rect: r } = e, i = r.r1 + t - o.height, l = r.c1 + n - o.width;
|
|
2398
2398
|
return i > 0 && eo(e, o.height - 1, i), l > 0 && to(e, o.width - 1, l), i > 0 || l > 0;
|
|
2399
2399
|
}
|
|
2400
|
-
function
|
|
2400
|
+
function ec(e, { rows: t = 2, cols: n = 2, headerRow: o = !0 } = {}, r = null) {
|
|
2401
2401
|
const i = document.createElement("table");
|
|
2402
2402
|
i.style.width = "100%";
|
|
2403
2403
|
const l = document.createElement("tbody");
|
|
@@ -2412,19 +2412,19 @@ function Ja(e, { rows: t = 2, cols: n = 2, headerRow: o = !0 } = {}, r = null) {
|
|
|
2412
2412
|
const a = l.querySelector("td,th");
|
|
2413
2413
|
return a && P(a, 0), i;
|
|
2414
2414
|
}
|
|
2415
|
-
const
|
|
2415
|
+
const tc = {
|
|
2416
2416
|
selectAll: (e) => (e.rect = { r1: 0, c1: 0, r2: e.grid.height - 1, c2: e.grid.width - 1 }, !0),
|
|
2417
2417
|
insertRowBefore: (e, t) => eo(e, e.rect.r1 - 1, Yt(t.rows)),
|
|
2418
2418
|
insertRowAfter: (e, t) => eo(e, e.rect.r2, Yt(t.rows)),
|
|
2419
2419
|
insertColumnBefore: (e, t) => to(e, e.rect.c1 - 1, Yt(t.cols)),
|
|
2420
2420
|
insertColumnAfter: (e, t) => to(e, e.rect.c2, Yt(t.cols)),
|
|
2421
|
-
deleteRow: (e) =>
|
|
2422
|
-
deleteColumn: (e) =>
|
|
2423
|
-
mergeOrSplit: (e) =>
|
|
2421
|
+
deleteRow: (e) => qa(e, e.rect.r1, e.rect.r2),
|
|
2422
|
+
deleteColumn: (e) => Ua(e, e.rect.c1, e.rect.c2),
|
|
2423
|
+
mergeOrSplit: (e) => Ga(e),
|
|
2424
2424
|
toggleHeaderRow: (e) => Vo(e, "row"),
|
|
2425
2425
|
toggleHeaderColumn: (e) => Vo(e, "column"),
|
|
2426
2426
|
pinHeader: (e) => (e.table.hasAttribute(en) ? e.table.removeAttribute(en) : e.table.setAttribute(en, "true"), !0),
|
|
2427
|
-
resetColumnWidth: (e) =>
|
|
2427
|
+
resetColumnWidth: (e) => Ya(e),
|
|
2428
2428
|
cellShade: (e, t) => Me(e, "background-color", t.value || ""),
|
|
2429
2429
|
alignLeft: (e) => Me(e, "text-align", "left"),
|
|
2430
2430
|
alignCenter: (e) => Me(e, "text-align", "center"),
|
|
@@ -2434,19 +2434,19 @@ const ec = {
|
|
|
2434
2434
|
valignMiddle: (e) => Me(e, "vertical-align", "middle"),
|
|
2435
2435
|
valignBottom: (e) => Me(e, "vertical-align", "bottom"),
|
|
2436
2436
|
valignDefault: (e) => Me(e, "vertical-align", ""),
|
|
2437
|
-
clearCell: (e) =>
|
|
2438
|
-
transpose: (e) =>
|
|
2437
|
+
clearCell: (e) => Qa(e),
|
|
2438
|
+
transpose: (e) => Za(e),
|
|
2439
2439
|
moveRowUp: (e) => Go(e, -1),
|
|
2440
2440
|
moveRowDown: (e) => Go(e, 1),
|
|
2441
2441
|
moveColumnLeft: (e) => Ko(e, -1),
|
|
2442
2442
|
moveColumnRight: (e) => Ko(e, 1),
|
|
2443
2443
|
deleteTable: (e) => (e.table.remove(), !0)
|
|
2444
|
-
},
|
|
2444
|
+
}, nc = {
|
|
2445
2445
|
deleteRow: (e) => e.grid.height > e.rect.r2 - e.rect.r1 + 1,
|
|
2446
2446
|
deleteColumn: (e) => e.grid.width > e.rect.c2 - e.rect.c1 + 1,
|
|
2447
2447
|
mergeOrSplit: (e) => {
|
|
2448
2448
|
const t = e.grid.matrix[e.rect.r1]?.[e.rect.c1];
|
|
2449
|
-
return t ? t.rowspan > 1 || t.colspan > 1 ? !0 : !(e.rect.r1 === e.rect.r2 && e.rect.c1 === e.rect.c2) && !
|
|
2449
|
+
return t ? t.rowspan > 1 || t.colspan > 1 ? !0 : !(e.rect.r1 === e.rect.r2 && e.rect.c1 === e.rect.c2) && !Yr(e.grid, e.rect) : !1;
|
|
2450
2450
|
},
|
|
2451
2451
|
resetColumnWidth: (e) => !!e.table.querySelector("colgroup") || e.grid.cells.some((t) => t.el.style.width),
|
|
2452
2452
|
pinHeader: (e) => e.grid.height > 1,
|
|
@@ -2456,9 +2456,9 @@ const ec = {
|
|
|
2456
2456
|
moveColumnRight: (e) => e.colIndex < e.grid.width - 1 && !oo(e.grid),
|
|
2457
2457
|
toggleHeaderColumn: (e) => e.grid.width > 1
|
|
2458
2458
|
};
|
|
2459
|
-
function
|
|
2459
|
+
function oc(e, t) {
|
|
2460
2460
|
if (!e) return !1;
|
|
2461
|
-
const n =
|
|
2461
|
+
const n = nc[t];
|
|
2462
2462
|
if (!n) return !0;
|
|
2463
2463
|
try {
|
|
2464
2464
|
return !!n(e);
|
|
@@ -2466,7 +2466,7 @@ function nc(e, t) {
|
|
|
2466
2466
|
return !1;
|
|
2467
2467
|
}
|
|
2468
2468
|
}
|
|
2469
|
-
function
|
|
2469
|
+
function rc(e, t) {
|
|
2470
2470
|
if (!e) return !1;
|
|
2471
2471
|
const n = e.grid.cells.filter((l) => l.r === 0), o = e.grid.cells.filter((l) => l.c === 0);
|
|
2472
2472
|
if (t === "toggleHeaderRow") return n.length > 0 && n.every((l) => l.el.tagName === "TH");
|
|
@@ -2480,8 +2480,8 @@ function oc(e, t) {
|
|
|
2480
2480
|
const i = e.cell ? ke(e.cell, "vertical-align") : "";
|
|
2481
2481
|
return t === "valignTop" ? i === "top" : t === "valignMiddle" ? i === "middle" : t === "valignBottom" ? i === "bottom" : t === "valignDefault" ? !i : !1;
|
|
2482
2482
|
}
|
|
2483
|
-
function
|
|
2484
|
-
const o =
|
|
2483
|
+
function Zr(e, t, n = { rows: 1, cols: 1 }) {
|
|
2484
|
+
const o = tc[t];
|
|
2485
2485
|
if (!e || !o) return !1;
|
|
2486
2486
|
try {
|
|
2487
2487
|
return !!o(e, n);
|
|
@@ -2489,7 +2489,7 @@ function Qr(e, t, n = { rows: 1, cols: 1 }) {
|
|
|
2489
2489
|
return !1;
|
|
2490
2490
|
}
|
|
2491
2491
|
}
|
|
2492
|
-
function
|
|
2492
|
+
function ic(e, t) {
|
|
2493
2493
|
if (!e?.isConnected || !t) return null;
|
|
2494
2494
|
const n = ue(e);
|
|
2495
2495
|
let o = 1 / 0, r = 1 / 0, i = -1 / 0, l = -1 / 0;
|
|
@@ -2500,8 +2500,8 @@ function rc(e, t) {
|
|
|
2500
2500
|
}
|
|
2501
2501
|
return o === 1 / 0 ? null : { left: o, top: r, right: i, bottom: l, width: i - o, height: l - r };
|
|
2502
2502
|
}
|
|
2503
|
-
function
|
|
2504
|
-
return
|
|
2503
|
+
function lc(e, t, n) {
|
|
2504
|
+
return Ha(e.cells, st(e, t), st(e, n));
|
|
2505
2505
|
}
|
|
2506
2506
|
const jo = {
|
|
2507
2507
|
// [坑] 撤销/重做自带历史栈,不能再被 exec 的 run() 包一层入栈(否则 undo 会弹到自己刚推进去的那条)
|
|
@@ -2529,13 +2529,13 @@ const jo = {
|
|
|
2529
2529
|
unsetTextShadow: { run: (e) => ce(G(e), "textShadow", "") },
|
|
2530
2530
|
// 组合色(前景 + 背景一体):一次落两个标记(拆两次会因块 DOM 重建丢选区,见 setStyleMarks 的 [坑])
|
|
2531
2531
|
setComboStyle: {
|
|
2532
|
-
run: (e, t, n) =>
|
|
2532
|
+
run: (e, t, n) => As(G(e), { color: St(t), backgroundColor: St(n) })
|
|
2533
2533
|
},
|
|
2534
2534
|
setLink: { run: (e, t) => Ho(G(e), t) },
|
|
2535
2535
|
unsetLink: { run: (e) => Ho(G(e), "") },
|
|
2536
2536
|
clearFormat: {
|
|
2537
2537
|
run: (e) => {
|
|
2538
|
-
const t = G(e), n =
|
|
2538
|
+
const t = G(e), n = Is(t), o = ca(e.root, t.ranges);
|
|
2539
2539
|
return n || o;
|
|
2540
2540
|
}
|
|
2541
2541
|
},
|
|
@@ -2546,63 +2546,63 @@ const jo = {
|
|
|
2546
2546
|
toggleBulletList: { run: (e) => Ne(e.root, "bulletList") },
|
|
2547
2547
|
toggleOrderedList: { run: (e) => Ne(e.root, "orderedList") },
|
|
2548
2548
|
toggleTaskList: { run: (e) => Ne(e.root, "taskList") },
|
|
2549
|
-
setHorizontalRule: { run: (e) =>
|
|
2550
|
-
insertPageBreak: { run: (e) =>
|
|
2551
|
-
insertCallout: { run: (e, t) =>
|
|
2552
|
-
insertSuperBlock: { run: (e, t) =>
|
|
2549
|
+
setHorizontalRule: { run: (e) => Fr(e.root) },
|
|
2550
|
+
insertPageBreak: { run: (e) => Ds(e.root) },
|
|
2551
|
+
insertCallout: { run: (e, t) => $s(e.root, t) },
|
|
2552
|
+
insertSuperBlock: { run: (e, t) => _s(e.root, t) },
|
|
2553
2553
|
// 超级块列增删(el 可为超级块或其内的列;block 档块菜单消费)
|
|
2554
|
-
addColumn: { run: (e, t) =>
|
|
2555
|
-
removeColumn: { run: (e, t) =>
|
|
2554
|
+
addColumn: { run: (e, t) => Ps(e.root, t) },
|
|
2555
|
+
removeColumn: { run: (e, t) => Fs(e.root, t) },
|
|
2556
2556
|
// 拖块并排:把拖拽块与目标块合成 2 列超级块(块标拖拽到目标左/右边缘放下)
|
|
2557
|
-
wrapInSuper: { run: (e, t, n, o) =>
|
|
2558
|
-
insertImage: { run: (e, t) =>
|
|
2557
|
+
wrapInSuper: { run: (e, t, n, o) => qs(e.root, t, n, o) },
|
|
2558
|
+
insertImage: { run: (e, t) => Vs(e.root, t) },
|
|
2559
2559
|
// 笔记资产图片(<img data-gbBlk-asset> + 直链 src;与 .gbRtx 的 insertImage 各归各)
|
|
2560
|
-
insertAssetImage: { run: (e, t) =>
|
|
2561
|
-
insertText: { run: (e, t) =>
|
|
2560
|
+
insertAssetImage: { run: (e, t) => Gs(e.root, t) },
|
|
2561
|
+
insertText: { run: (e, t) => Us(e.root, t) },
|
|
2562
2562
|
// 受控 HTML 片段插入(宿主生成的复杂块,如 docx 目录块)
|
|
2563
2563
|
// [约束] 只允许应用代码生成的受控 HTML:不走粘贴清洗(它面向外来内容,会剥 class 等编解码标记)
|
|
2564
2564
|
insertHtml: {
|
|
2565
2565
|
run: (e, t) => {
|
|
2566
|
-
const n =
|
|
2566
|
+
const n = xr(String(t || ""));
|
|
2567
2567
|
return n.childNodes.length ? (Eo(e, n), !0) : !1;
|
|
2568
2568
|
}
|
|
2569
2569
|
},
|
|
2570
2570
|
// 批注锚点(span.doc-comment):选区打键 / 按宿主数据删除某键的全部锚点
|
|
2571
|
-
setComment: { run: (e, t) =>
|
|
2572
|
-
removeComment: { run: (e, t) =>
|
|
2571
|
+
setComment: { run: (e, t) => Ts(G(e), t) },
|
|
2572
|
+
removeComment: { run: (e, t) => Ss(e.root, t) > 0 },
|
|
2573
2573
|
// 脚注/尾注锚点(sup.doc-footnote/endnote[data-fn];Word 应用消费)
|
|
2574
|
-
insertNote: { run: (e, t) =>
|
|
2575
|
-
removeNote: { run: (e, t) =>
|
|
2574
|
+
insertNote: { run: (e, t) => ws(e.root, t) },
|
|
2575
|
+
removeNote: { run: (e, t) => xs(e.root, t) },
|
|
2576
2576
|
// 笔记行内锚(span.doc-attach 附件引用 / span.doc-ref 块·文档引用;笔记域专用,.gbRtx 侧不产生)
|
|
2577
2577
|
insertAttach: { run: (e, t) => zo(e.root, "attach", t) },
|
|
2578
|
-
removeAttach: { run: (e, t) =>
|
|
2578
|
+
removeAttach: { run: (e, t) => Ls(e.root, lt, t) },
|
|
2579
2579
|
insertRef: { run: (e, t) => zo(e.root, "ref", t) },
|
|
2580
2580
|
// 笔记引用节点转换(宿主右键菜单入口):行内引用 ↔ 嵌入块 / 锚文本类型 / 删除
|
|
2581
|
-
convertRefToEmbed: { run: (e, t, n) =>
|
|
2582
|
-
convertEmbedToRef: { run: (e, t) =>
|
|
2583
|
-
setRefSub: { run: (e, t, n) =>
|
|
2584
|
-
removeAnchor: { run: (e, t) =>
|
|
2581
|
+
convertRefToEmbed: { run: (e, t, n) => Ns(e.root, t, n) },
|
|
2582
|
+
convertEmbedToRef: { run: (e, t) => Rs(t) },
|
|
2583
|
+
setRefSub: { run: (e, t, n) => Os(t, n) },
|
|
2584
|
+
removeAnchor: { run: (e, t) => Bs(t) },
|
|
2585
2585
|
// 修订接受/拒绝(Word 应用;普通富文本不暴露入口)
|
|
2586
|
-
resolveRevisions: { run: (e, t) =>
|
|
2587
|
-
resolveRevisionAt: { run: (e, t, n) =>
|
|
2586
|
+
resolveRevisions: { run: (e, t) => cs(e.root, t) > 0 },
|
|
2587
|
+
resolveRevisionAt: { run: (e, t, n) => us(t, n) },
|
|
2588
2588
|
increaseBlockIndent: { run: (e) => Po(e.root, 1), can: (e) => e.state().canIndent },
|
|
2589
2589
|
decreaseBlockIndent: { run: (e) => Po(e.root, -1), can: (e) => e.state().canOutdent },
|
|
2590
|
-
toggleFirstLineIndent: { run: (e) =>
|
|
2591
|
-
setBlockLineHeight: { run: (e, t) =>
|
|
2592
|
-
setBlockAlign: { run: (e, t) =>
|
|
2593
|
-
duplicateBlock: { run: (e, t) =>
|
|
2594
|
-
deleteBlock: { run: (e, t) =>
|
|
2595
|
-
insertBlockNear: { run: (e, t, n) =>
|
|
2590
|
+
toggleFirstLineIndent: { run: (e) => aa(e.root) },
|
|
2591
|
+
setBlockLineHeight: { run: (e, t) => la(e.root, t) },
|
|
2592
|
+
setBlockAlign: { run: (e, t) => sa(e.root, t) },
|
|
2593
|
+
duplicateBlock: { run: (e, t) => Qs(e.root, t) },
|
|
2594
|
+
deleteBlock: { run: (e, t) => Zs(e.root, t) },
|
|
2595
|
+
insertBlockNear: { run: (e, t, n) => Xs(e.root, n, t) },
|
|
2596
2596
|
moveBlockUp: { run: (e, t) => $o(e.root, t, -1) },
|
|
2597
2597
|
moveBlockDown: { run: (e, t) => $o(e.root, t, 1) },
|
|
2598
|
-
moveBlockTo: { run: (e, t, n, o) =>
|
|
2598
|
+
moveBlockTo: { run: (e, t, n, o) => Js(t, n, o) },
|
|
2599
2599
|
deleteRange: {
|
|
2600
|
-
run: (e, { block: t, from: n, to: o }) => t?.isConnected ? (
|
|
2600
|
+
run: (e, { block: t, from: n, to: o }) => t?.isConnected ? (kr(t, n, o).deleteContents(), gn(e.root, { block: t, offset: n }, { block: t, offset: n }), !0) : !1
|
|
2601
2601
|
},
|
|
2602
2602
|
insertTable: {
|
|
2603
2603
|
run: (e, { rows: t = 2, cols: n = 2, withHeaderRow: o = !0 } = {}) => {
|
|
2604
2604
|
const i = e.selectionRanges()[0]?.block, l = i ? Ke(i, e.root) : e.root.lastElementChild;
|
|
2605
|
-
return !!
|
|
2605
|
+
return !!ec(e.root, { rows: t, cols: n, headerRow: o }, l);
|
|
2606
2606
|
}
|
|
2607
2607
|
},
|
|
2608
2608
|
tableAction: { run: (e, t, n) => e.runTableAction(t, n) },
|
|
@@ -2611,8 +2611,8 @@ const jo = {
|
|
|
2611
2611
|
// [坑] 显式给了 el 就必须写它:元素已失效(不在编辑面内)时返回 false,禁退回「光标所在块」——
|
|
2612
2612
|
// 否则「给这个块加属性」会静默写到另一个块上,用户看到的是属性跑到了别处
|
|
2613
2613
|
setBlockAttrs: { run: (e, t, n = null) => {
|
|
2614
|
-
const o = n ? Oe(e.root, n) :
|
|
2615
|
-
return o ?
|
|
2614
|
+
const o = n ? Oe(e.root, n) : Xr(e.root);
|
|
2615
|
+
return o ? Ca(o, t) : !1;
|
|
2616
2616
|
} },
|
|
2617
2617
|
focusBlock: {
|
|
2618
2618
|
run: (e, t) => {
|
|
@@ -2625,9 +2625,9 @@ function G(e) {
|
|
|
2625
2625
|
const t = e.selectionRanges(), n = Yn(e.root, t).marks, o = t.length > 0 && t.every((r) => r.end <= r.start);
|
|
2626
2626
|
return { root: e.root, ranges: t, marks: n, pending: o ? e.pending ||= { ...n } : null };
|
|
2627
2627
|
}
|
|
2628
|
-
const
|
|
2628
|
+
const sc = {
|
|
2629
2629
|
getHTML() {
|
|
2630
|
-
return
|
|
2630
|
+
return Ol(this.root);
|
|
2631
2631
|
},
|
|
2632
2632
|
/** 程序化装载(切档 / 外部写入):重置历史与选区 */
|
|
2633
2633
|
setHTML(e) {
|
|
@@ -2657,7 +2657,7 @@ const lc = {
|
|
|
2657
2657
|
return !e || !this.root.contains(e) ? null : X(e, this.root) || this.textBlockAt(e.nodeType === Node.ELEMENT_NODE ? e : e.parentElement);
|
|
2658
2658
|
},
|
|
2659
2659
|
pathBlock(e) {
|
|
2660
|
-
return this.textBlockAt(
|
|
2660
|
+
return this.textBlockAt(dl(this.root, e));
|
|
2661
2661
|
},
|
|
2662
2662
|
offsetIn(e, t, n, o) {
|
|
2663
2663
|
return t && this.root.contains(t) && (e === t || e.contains(t)) ? ae(e, t, n) : o ?? 0;
|
|
@@ -2699,16 +2699,16 @@ const lc = {
|
|
|
2699
2699
|
};
|
|
2700
2700
|
function Wo(e, t, n) {
|
|
2701
2701
|
const o = X(t, e);
|
|
2702
|
-
return o ? { path:
|
|
2702
|
+
return o ? { path: ul(o, e), offset: ae(o, t, n) } : null;
|
|
2703
2703
|
}
|
|
2704
|
-
const
|
|
2704
|
+
const ac = 120, cc = 600, uc = {
|
|
2705
2705
|
snapshot() {
|
|
2706
2706
|
return { html: this.root.innerHTML, sel: this.captureSelection() };
|
|
2707
2707
|
},
|
|
2708
2708
|
pushHistory() {
|
|
2709
2709
|
if (!this.baseline) return;
|
|
2710
2710
|
const e = this.undoStack[this.undoStack.length - 1];
|
|
2711
|
-
e && e.html === this.baseline.html || (this.undoStack.push(this.baseline), this.undoStack.length >
|
|
2711
|
+
e && e.html === this.baseline.html || (this.undoStack.push(this.baseline), this.undoStack.length > ac && this.undoStack.shift(), this.redoStack = []);
|
|
2712
2712
|
},
|
|
2713
2713
|
/**
|
|
2714
2714
|
* 执行一次 DOM 改写:入历史 + 上报变更
|
|
@@ -2761,7 +2761,7 @@ const sc = 120, ac = 600, cc = {
|
|
|
2761
2761
|
onDomMutated() {
|
|
2762
2762
|
this.applying || this.destroyed || (this.typing || (this.pushHistory(), this.typing = !0), clearTimeout(this.idleTimer), this.idleTimer = setTimeout(() => {
|
|
2763
2763
|
this.typing = !1, this.baseline = this.snapshot(), this.afterChange();
|
|
2764
|
-
},
|
|
2764
|
+
}, cc), this.emit("update"), this.syncState());
|
|
2765
2765
|
},
|
|
2766
2766
|
undo() {
|
|
2767
2767
|
return this.undoStack.length ? (this.typing && (this.typing = !1, clearTimeout(this.idleTimer)), this.redoStack.push(this.snapshot()), this.restore(this.undoStack.pop()), !0) : !1;
|
|
@@ -2779,7 +2779,7 @@ const sc = 120, ac = 600, cc = {
|
|
|
2779
2779
|
afterChange() {
|
|
2780
2780
|
this.search.refresh(), this.emit("update"), this.emit("transaction"), this.syncState();
|
|
2781
2781
|
}
|
|
2782
|
-
},
|
|
2782
|
+
}, dc = ["onFocus", "onBlur", "onSelectionChange", "onPointerState", "onClick", "onCheckboxChange"], fc = {
|
|
2783
2783
|
onFocus() {
|
|
2784
2784
|
this.emit("focus");
|
|
2785
2785
|
},
|
|
@@ -2842,7 +2842,7 @@ const sc = 120, ac = 600, cc = {
|
|
|
2842
2842
|
e.preventDefault();
|
|
2843
2843
|
return;
|
|
2844
2844
|
}
|
|
2845
|
-
const n =
|
|
2845
|
+
const n = hc(this.root, t);
|
|
2846
2846
|
n && this.isEditable() ? this.selectAtom(n) : this.clearAtom();
|
|
2847
2847
|
},
|
|
2848
2848
|
/** 待办条目复选框:change 同步 data-checked(序列化口径) */
|
|
@@ -2862,12 +2862,12 @@ const sc = 120, ac = 600, cc = {
|
|
|
2862
2862
|
this.selectedAtom && this.selectedAtom.classList.remove(Fn), this.selectedAtom = null, this.emit("atom", null);
|
|
2863
2863
|
}
|
|
2864
2864
|
};
|
|
2865
|
-
function
|
|
2865
|
+
function hc(e, t) {
|
|
2866
2866
|
if (!t) return null;
|
|
2867
2867
|
const n = t.nodeType === Node.TEXT_NODE ? t.parentElement : t;
|
|
2868
2868
|
return Xe(n, (o) => o.tagName === "IMG" || o.tagName === "HR", e);
|
|
2869
2869
|
}
|
|
2870
|
-
const Yo = 6, Qo =
|
|
2870
|
+
const Yo = 6, Qo = dr, mc = ["onMouseDown", "onHoverColumn", "onLeaveColumn"], pc = {
|
|
2871
2871
|
/**
|
|
2872
2872
|
* 拖列边设列宽:落点在「格右边界 ± COL_RESIZE_HIT/2」的命中带内即接管
|
|
2873
2873
|
* 中间列的右边界 = 与右邻列的共享线(两列守恒转移,表宽不变);最后一列的右边界 = 表右边界
|
|
@@ -2885,13 +2885,13 @@ const Yo = 6, Qo = ur, hc = ["onMouseDown", "onHoverColumn", "onLeaveColumn"], m
|
|
|
2885
2885
|
this.root.classList.add("resize-cursor"), this.colResizing = !0, this.hoverColumn = { table: n, colIndex: i.c }, this.emit("column-hover"), this.pushHistory();
|
|
2886
2886
|
const s = e.clientX;
|
|
2887
2887
|
let a = 0;
|
|
2888
|
-
const c = l ?
|
|
2888
|
+
const c = l ? ja(n, i.c) : null, f = (y) => {
|
|
2889
2889
|
Xt();
|
|
2890
2890
|
const E = y.clientX - s;
|
|
2891
2891
|
if (E === a) return;
|
|
2892
2892
|
const m = E - a;
|
|
2893
2893
|
a = E, this.run(
|
|
2894
|
-
() => c ?
|
|
2894
|
+
() => c ? Wa(n, c, E) : Xa(n, i.c, m),
|
|
2895
2895
|
{ coalesce: !0 }
|
|
2896
2896
|
), this.emit("column-hover");
|
|
2897
2897
|
}, u = () => {
|
|
@@ -2932,7 +2932,7 @@ const Yo = 6, Qo = ur, hc = ["onMouseDown", "onHoverColumn", "onLeaveColumn"], m
|
|
|
2932
2932
|
colIndex: -1,
|
|
2933
2933
|
rect: g ? { r1: m - 1, c1: 0, r2: m - 1, c2: E.width - 1 } : { r1: m + h, c1: 0, r2: m - 1, c2: E.width - 1 }
|
|
2934
2934
|
}, M = g ? o ? "insertColumnAfter" : "insertRowAfter" : o ? "deleteColumn" : "deleteRow";
|
|
2935
|
-
this.run(() =>
|
|
2935
|
+
this.run(() => Zr(A, M, { rows: Math.abs(h), cols: Math.abs(h) }), { coalesce: !0 });
|
|
2936
2936
|
};
|
|
2937
2937
|
c(i + 1);
|
|
2938
2938
|
const f = (y) => {
|
|
@@ -2981,7 +2981,7 @@ const Yo = 6, Qo = ur, hc = ["onMouseDown", "onHoverColumn", "onLeaveColumn"], m
|
|
|
2981
2981
|
*/
|
|
2982
2982
|
cellSelectionBox() {
|
|
2983
2983
|
const e = this.cellRect;
|
|
2984
|
-
return e?.table?.isConnected ?
|
|
2984
|
+
return e?.table?.isConnected ? ic(e.table, e.rect) : null;
|
|
2985
2985
|
},
|
|
2986
2986
|
/**
|
|
2987
2987
|
* 取「表 → 逻辑网格」的短期缓存
|
|
@@ -3052,7 +3052,7 @@ const Yo = 6, Qo = ur, hc = ["onMouseDown", "onHoverColumn", "onLeaveColumn"], m
|
|
|
3052
3052
|
l = 0;
|
|
3053
3053
|
const y = i;
|
|
3054
3054
|
if (i = null, !y || !y.isConnected) return;
|
|
3055
|
-
const E = ue(n), m =
|
|
3055
|
+
const E = ue(n), m = lc(E, o, y);
|
|
3056
3056
|
if (!m) return;
|
|
3057
3057
|
const h = this.cellRect?.rect;
|
|
3058
3058
|
this.cellRect?.table === n && h && h.r1 === m.r1 && h.c1 === m.c1 && h.r2 === m.r2 && h.c2 === m.c2 || (this.cellRect = { table: n, rect: m }, this.notifyCellSelection());
|
|
@@ -3073,14 +3073,14 @@ const Yo = 6, Qo = ur, hc = ["onMouseDown", "onHoverColumn", "onLeaveColumn"], m
|
|
|
3073
3073
|
clearCellSelection() {
|
|
3074
3074
|
this.cellRect && (this.cellRect = null, this.notifyCellSelection());
|
|
3075
3075
|
}
|
|
3076
|
-
},
|
|
3076
|
+
}, gc = {
|
|
3077
3077
|
inlineSnapshot() {
|
|
3078
3078
|
const e = this.selectionRanges();
|
|
3079
3079
|
return Yn(this.root, e).marks;
|
|
3080
3080
|
},
|
|
3081
3081
|
/** 工具栏 / 气泡菜单 / 块菜单共用的状态快照(单一口径) */
|
|
3082
3082
|
state() {
|
|
3083
|
-
const e = this.root, t = this.selectionRanges(), n = t.length && this.pending || Yn(e, t).marks, r = dt(e, t)[0] || null, i = r ?
|
|
3083
|
+
const e = this.root, t = this.selectionRanges(), n = t.length && this.pending || Yn(e, t).marks, r = dt(e, t)[0] || null, i = r ? ra(r) : { lineHeight: "", textAlign: null, indentLevel: 0, firstLineIndent: !1 }, l = t[0]?.block || null, s = l ? Ke(l, e) : null, a = Ft(s), c = l ? Gr(l, e) : "", f = !!$e(l || e, e), u = Number(/^heading([1-6])$/.exec(a)?.[1]) || 0, p = e.textContent.replace(/[\n]/g, "");
|
|
3084
3084
|
return {
|
|
3085
3085
|
ready: !0,
|
|
3086
3086
|
canUndo: this.undoStack.length > 0,
|
|
@@ -3156,22 +3156,22 @@ const Yo = 6, Qo = ur, hc = ["onMouseDown", "onHoverColumn", "onLeaveColumn"], m
|
|
|
3156
3156
|
},
|
|
3157
3157
|
/** 块自定义属性(el 缺省=光标所在最外层结构块,与 setBlockAttrs 命令同口径;元素已不在编辑面内返回 null) */
|
|
3158
3158
|
blockAttrsOf(e = null) {
|
|
3159
|
-
const t = e && Oe(this.root, e) ||
|
|
3160
|
-
return t ?
|
|
3159
|
+
const t = e && Oe(this.root, e) || Xr(this.root);
|
|
3160
|
+
return t ? ka(t) : null;
|
|
3161
3161
|
}
|
|
3162
|
-
},
|
|
3162
|
+
}, vc = {
|
|
3163
3163
|
blockAt(e, t) {
|
|
3164
|
-
return
|
|
3164
|
+
return al(this.root, e, t);
|
|
3165
3165
|
},
|
|
3166
3166
|
/** 点到留白:把光标落到该坐标最近的可编辑位置 */
|
|
3167
3167
|
focusAt(e, t) {
|
|
3168
|
-
const n =
|
|
3168
|
+
const n = br(this.root, e, t);
|
|
3169
3169
|
if (this.root.focus({ preventScroll: !0 }), n) {
|
|
3170
3170
|
const i = X(n.node, this.root);
|
|
3171
3171
|
if (i)
|
|
3172
3172
|
return gn(this.root, { block: i, offset: ae(i, n.node, n.offset) }, { block: i, offset: ae(i, n.node, n.offset) }), !0;
|
|
3173
3173
|
}
|
|
3174
|
-
const o =
|
|
3174
|
+
const o = yr(this.root, t), r = o ? he(o, this.root) || o : _t(this.root);
|
|
3175
3175
|
return P(r, 0), !0;
|
|
3176
3176
|
},
|
|
3177
3177
|
/** 当前选区(或光标)的可视矩形:斜杠菜单/气泡菜单定位基准 */
|
|
@@ -3182,23 +3182,23 @@ const Yo = 6, Qo = ur, hc = ["onMouseDown", "onHoverColumn", "onLeaveColumn"], m
|
|
|
3182
3182
|
if (o && (o.height || o.width)) return o;
|
|
3183
3183
|
}
|
|
3184
3184
|
const t = this.selectionRanges()[0]?.block;
|
|
3185
|
-
return
|
|
3185
|
+
return cl(t);
|
|
3186
3186
|
}
|
|
3187
3187
|
};
|
|
3188
|
-
async function
|
|
3188
|
+
async function bc(e, t = "已复制", n = ge) {
|
|
3189
3189
|
if (!e)
|
|
3190
3190
|
return n.error("没有可复制的内容"), !1;
|
|
3191
3191
|
try {
|
|
3192
|
-
return await
|
|
3192
|
+
return await Jr(e), n.success(t), !0;
|
|
3193
3193
|
} catch (o) {
|
|
3194
3194
|
return n.error(`复制失败:${o?.message || o}`), !1;
|
|
3195
3195
|
}
|
|
3196
3196
|
}
|
|
3197
|
-
async function
|
|
3197
|
+
async function yc() {
|
|
3198
3198
|
if (!navigator.clipboard?.readText) throw new Error("当前访问方式不支持读取剪贴板,请手动粘贴");
|
|
3199
3199
|
return navigator.clipboard.readText();
|
|
3200
3200
|
}
|
|
3201
|
-
async function
|
|
3201
|
+
async function kc(e, t, n = "已复制", o = ge) {
|
|
3202
3202
|
if (!e && !t)
|
|
3203
3203
|
return o.error("没有可复制的内容"), !1;
|
|
3204
3204
|
try {
|
|
@@ -3210,13 +3210,13 @@ async function yc(e, t, n = "已复制", o = ge) {
|
|
|
3210
3210
|
]), o.success(n), !0;
|
|
3211
3211
|
} catch {
|
|
3212
3212
|
try {
|
|
3213
|
-
return await
|
|
3213
|
+
return await Jr(e || ""), o.success(n), !0;
|
|
3214
3214
|
} catch (r) {
|
|
3215
3215
|
return o.error(`复制失败:${r?.message || r}`), !1;
|
|
3216
3216
|
}
|
|
3217
3217
|
}
|
|
3218
3218
|
}
|
|
3219
|
-
async function
|
|
3219
|
+
async function Cc() {
|
|
3220
3220
|
if (!navigator.clipboard?.read) throw new Error("当前访问方式不支持读取剪贴板,请手动粘贴");
|
|
3221
3221
|
const e = await navigator.clipboard.read();
|
|
3222
3222
|
let t = "", n = "";
|
|
@@ -3225,14 +3225,14 @@ async function kc() {
|
|
|
3225
3225
|
if (!t && !n) throw new Error("剪贴板没有可粘贴的内容");
|
|
3226
3226
|
return { text: t, html: n };
|
|
3227
3227
|
}
|
|
3228
|
-
async function
|
|
3228
|
+
async function Jr(e) {
|
|
3229
3229
|
if (navigator.clipboard?.writeText) return navigator.clipboard.writeText(e);
|
|
3230
3230
|
const t = document.createElement("textarea");
|
|
3231
3231
|
t.value = e, t.readOnly = !0, t.style.cssText = "position:fixed;top:0;left:0;opacity:0", document.body.appendChild(t), t.select();
|
|
3232
3232
|
const n = document.execCommand("copy");
|
|
3233
3233
|
if (t.remove(), !n) throw new Error("当前浏览器不支持自动复制,请手动选取复制");
|
|
3234
3234
|
}
|
|
3235
|
-
function
|
|
3235
|
+
function Ec(e) {
|
|
3236
3236
|
let t = "";
|
|
3237
3237
|
const n = (o) => {
|
|
3238
3238
|
for (const r of Array.from(o.childNodes))
|
|
@@ -3241,17 +3241,17 @@ function Cc(e) {
|
|
|
3241
3241
|
};
|
|
3242
3242
|
return n(e), t;
|
|
3243
3243
|
}
|
|
3244
|
-
function
|
|
3244
|
+
function Ac(e) {
|
|
3245
3245
|
const t = document.createElement("span");
|
|
3246
3246
|
return t.textContent = e, t.innerHTML;
|
|
3247
3247
|
}
|
|
3248
|
-
function
|
|
3248
|
+
function Tc(e) {
|
|
3249
3249
|
const { grid: t, rect: n } = e, o = n.r2 - n.r1 + 1, r = n.c2 - n.c1 + 1, i = Array.from({ length: o }, () => new Array(r).fill(null));
|
|
3250
3250
|
for (const a of t.cells) {
|
|
3251
3251
|
const c = Math.max(a.r, n.r1), f = Math.min(a.r + a.rowspan - 1, n.r2), u = Math.max(a.c, n.c1), p = Math.min(a.c + a.colspan - 1, n.c2);
|
|
3252
3252
|
c > f || u > p || (i[c - n.r1][u - n.c1] = { el: a.el, rowspan: f - c + 1, colspan: p - u + 1 });
|
|
3253
3253
|
}
|
|
3254
|
-
const l = i.map((a) => a.map((c) => c ?
|
|
3254
|
+
const l = i.map((a) => a.map((c) => c ? Ec(c.el) : "").join(" ")).join(`
|
|
3255
3255
|
`), s = document.createElement("table");
|
|
3256
3256
|
for (let a = 0; a < o; a += 1) {
|
|
3257
3257
|
const c = document.createElement("tr");
|
|
@@ -3265,7 +3265,7 @@ function Ac(e) {
|
|
|
3265
3265
|
}
|
|
3266
3266
|
return { text: l, html: s.outerHTML };
|
|
3267
3267
|
}
|
|
3268
|
-
function
|
|
3268
|
+
function Sc(e) {
|
|
3269
3269
|
const t = [], n = (o) => (t[o] || (t[o] = []), t[o]);
|
|
3270
3270
|
return Array.from(e.querySelectorAll("tr")).forEach((o, r) => {
|
|
3271
3271
|
const i = n(r);
|
|
@@ -3280,24 +3280,24 @@ function Tc(e) {
|
|
|
3280
3280
|
});
|
|
3281
3281
|
}), t.map((o) => (o || []).map((r) => r ?? ""));
|
|
3282
3282
|
}
|
|
3283
|
-
function
|
|
3283
|
+
function wc(e = {}) {
|
|
3284
3284
|
const t = String(e.html || ""), n = String(e.text || "");
|
|
3285
3285
|
if (t) {
|
|
3286
3286
|
const o = document.createElement("div");
|
|
3287
3287
|
o.innerHTML = t;
|
|
3288
3288
|
const r = o.querySelector("table");
|
|
3289
|
-
if (r) return
|
|
3289
|
+
if (r) return Sc(r);
|
|
3290
3290
|
}
|
|
3291
3291
|
return n ? n.replace(/\r\n?/g, `
|
|
3292
3292
|
`).replace(/\n$/, "").split(`
|
|
3293
|
-
`).map((o) => (o.includes(" ") ? o.split(" ") : [o]).map(
|
|
3293
|
+
`).map((o) => (o.includes(" ") ? o.split(" ") : [o]).map(Ac)) : null;
|
|
3294
3294
|
}
|
|
3295
|
-
function
|
|
3295
|
+
function xc(e, t) {
|
|
3296
3296
|
if (!e || !t?.length) return !1;
|
|
3297
3297
|
const n = t.reduce((s, a) => Math.max(s, a.length), 0);
|
|
3298
3298
|
if (!n) return !1;
|
|
3299
3299
|
const { table: o, rect: r } = e;
|
|
3300
|
-
|
|
3300
|
+
Ja(e, t.length, n);
|
|
3301
3301
|
const i = ue(o);
|
|
3302
3302
|
let l = !1;
|
|
3303
3303
|
for (let s = 0; s < t.length; s += 1)
|
|
@@ -3309,9 +3309,9 @@ function wc(e, t) {
|
|
|
3309
3309
|
}
|
|
3310
3310
|
return l;
|
|
3311
3311
|
}
|
|
3312
|
-
const
|
|
3312
|
+
const Lc = {
|
|
3313
3313
|
cellAt(e, t) {
|
|
3314
|
-
const n =
|
|
3314
|
+
const n = _a(this.root, e, t);
|
|
3315
3315
|
return this.contextCell = n, n;
|
|
3316
3316
|
},
|
|
3317
3317
|
/** 右键落在表格里 */
|
|
@@ -3321,13 +3321,13 @@ const xc = {
|
|
|
3321
3321
|
/** 表格动作上下文:框选区域优先,其次右键命中的单元格,最后光标 */
|
|
3322
3322
|
tableContext() {
|
|
3323
3323
|
const e = this.cellRect?.rect || null;
|
|
3324
|
-
return
|
|
3324
|
+
return Pa(this.root, this.contextCell, e);
|
|
3325
3325
|
},
|
|
3326
3326
|
canTableAction(e) {
|
|
3327
|
-
return
|
|
3327
|
+
return oc(this.tableContext(), e);
|
|
3328
3328
|
},
|
|
3329
3329
|
isTableActionActive(e) {
|
|
3330
|
-
return
|
|
3330
|
+
return rc(this.tableContext(), e);
|
|
3331
3331
|
},
|
|
3332
3332
|
/**
|
|
3333
3333
|
* 表格动作:DOM 改动即命令本体,历史与上报由 exec 统一负责
|
|
@@ -3337,7 +3337,7 @@ const xc = {
|
|
|
3337
3337
|
runTableAction(e, t) {
|
|
3338
3338
|
const n = this.tableContext();
|
|
3339
3339
|
if (!n) return !1;
|
|
3340
|
-
const o =
|
|
3340
|
+
const o = Zr(n, e, t);
|
|
3341
3341
|
return o && this.repaintCellSelection(), o;
|
|
3342
3342
|
},
|
|
3343
3343
|
/**
|
|
@@ -3378,7 +3378,7 @@ const xc = {
|
|
|
3378
3378
|
/** 命中格 / 框选区的复制数据(TSV 文本 + `<table>` HTML);不在表格内返回 null */
|
|
3379
3379
|
tableClipData() {
|
|
3380
3380
|
const e = this.tableContext();
|
|
3381
|
-
return e ?
|
|
3381
|
+
return e ? Tc(e) : null;
|
|
3382
3382
|
},
|
|
3383
3383
|
/**
|
|
3384
3384
|
* 复制(kind:copy=格内文字选区优先、否则整片区域 / copyRich=区域富文本 / copyText=区域纯文本)
|
|
@@ -3396,7 +3396,7 @@ const xc = {
|
|
|
3396
3396
|
}
|
|
3397
3397
|
}
|
|
3398
3398
|
const t = this.tableClipData();
|
|
3399
|
-
return t ? e === "copyText" ?
|
|
3399
|
+
return t ? e === "copyText" ? bc(t.text) : kc(t.text, t.html) : !1;
|
|
3400
3400
|
},
|
|
3401
3401
|
/** 剪切 = 复制 + 清空选区(清空走 exec 提交一次可撤销历史) */
|
|
3402
3402
|
async cutTable() {
|
|
@@ -3412,7 +3412,7 @@ const xc = {
|
|
|
3412
3412
|
if (!this.tableContext()) return !1;
|
|
3413
3413
|
let t;
|
|
3414
3414
|
try {
|
|
3415
|
-
t = e === "pasteText" ? { text: await
|
|
3415
|
+
t = e === "pasteText" ? { text: await yc() } : await Cc();
|
|
3416
3416
|
} catch (n) {
|
|
3417
3417
|
return ge.error(n?.message || "无法读取剪贴板"), !1;
|
|
3418
3418
|
}
|
|
@@ -3422,9 +3422,9 @@ const xc = {
|
|
|
3422
3422
|
pasteTableData(e, t = "paste") {
|
|
3423
3423
|
const n = this.tableContext();
|
|
3424
3424
|
if (!n) return !1;
|
|
3425
|
-
const o = t === "pasteKeepFormat" ? e?.html :
|
|
3425
|
+
const o = t === "pasteKeepFormat" ? e?.html : Dr(e?.html || ""), r = wc({ text: e?.text || "", html: o || "" });
|
|
3426
3426
|
if (!r?.length) return !1;
|
|
3427
|
-
const i = this.run(() =>
|
|
3427
|
+
const i = this.run(() => xc(n, r));
|
|
3428
3428
|
return i && this.repaintCellSelection(), i;
|
|
3429
3429
|
},
|
|
3430
3430
|
/**
|
|
@@ -3435,10 +3435,10 @@ const xc = {
|
|
|
3435
3435
|
notifyCellSelection() {
|
|
3436
3436
|
this.emit("cell-selection");
|
|
3437
3437
|
}
|
|
3438
|
-
},
|
|
3439
|
-
class
|
|
3438
|
+
}, Mc = [...dc, ...mc];
|
|
3439
|
+
class ei {
|
|
3440
3440
|
constructor(t = {}) {
|
|
3441
|
-
this.root = t.root, this.placeholder = t.placeholder || "", this.handlers = t.handlers || {}, this.undoStack = [], this.redoStack = [], this.pending = null, this.savedRange = null, this.cellRect = null, this.contextCell = null, this.selectedAtom = null, this.cellDragFrom = null, this.colResizing = !1, this.hoverColumn = null, this._gridCache = null, this._gridCachePending = !1, this.dragCleanups = /* @__PURE__ */ new Set(), this.modal = !1, this.applying = !1, this.typing = !1, this.blockMarqueeActive = !1, this.composing = !1, this.destroyed = !1, this.suggesting = !1, this.listeners = /* @__PURE__ */ new Map(), this.search =
|
|
3441
|
+
this.root = t.root, this.placeholder = t.placeholder || "", this.handlers = t.handlers || {}, this.undoStack = [], this.redoStack = [], this.pending = null, this.savedRange = null, this.cellRect = null, this.contextCell = null, this.selectedAtom = null, this.cellDragFrom = null, this.colResizing = !1, this.hoverColumn = null, this._gridCache = null, this._gridCachePending = !1, this.dragCleanups = /* @__PURE__ */ new Set(), this.modal = !1, this.applying = !1, this.typing = !1, this.blockMarqueeActive = !1, this.composing = !1, this.destroyed = !1, this.suggesting = !1, this.listeners = /* @__PURE__ */ new Map(), this.search = fl(this.root), this.unbindInput = null, this.observer = null, this.idleTimer = 0, Mc.forEach((n) => {
|
|
3442
3442
|
this[n] = this[n].bind(this);
|
|
3443
3443
|
});
|
|
3444
3444
|
}
|
|
@@ -3451,7 +3451,7 @@ class Jr {
|
|
|
3451
3451
|
const t = this.root;
|
|
3452
3452
|
this.observer = new MutationObserver((n) => {
|
|
3453
3453
|
n.every((r) => r.target instanceof Element && r.target.matches?.(nn) ? !0 : [...r.addedNodes, ...r.removedNodes].every((i) => i.nodeType === Node.ELEMENT_NODE && i.matches?.(nn))) || this.onDomMutated();
|
|
3454
|
-
}), this.observer.observe(t, { childList: !0, subtree: !0, characterData: !0 }), t.addEventListener("focus", this.onFocus), t.addEventListener("blur", this.onBlur), t.addEventListener("mousedown", this.onMouseDown), t.addEventListener("mousemove", this.onHoverColumn), t.addEventListener("mouseleave", this.onLeaveColumn), t.addEventListener("click", this.onClick), t.addEventListener("change", this.onCheckboxChange), t.addEventListener("keyup", this.onPointerState), t.addEventListener("mouseup", this.onPointerState), document.addEventListener("selectionchange", this.onSelectionChange), this.unbindInput =
|
|
3454
|
+
}), this.observer.observe(t, { childList: !0, subtree: !0, characterData: !0 }), t.addEventListener("focus", this.onFocus), t.addEventListener("blur", this.onBlur), t.addEventListener("mousedown", this.onMouseDown), t.addEventListener("mousemove", this.onHoverColumn), t.addEventListener("mouseleave", this.onLeaveColumn), t.addEventListener("click", this.onClick), t.addEventListener("change", this.onCheckboxChange), t.addEventListener("keyup", this.onPointerState), t.addEventListener("mouseup", this.onPointerState), document.addEventListener("selectionchange", this.onSelectionChange), this.unbindInput = Ba(this);
|
|
3455
3455
|
}
|
|
3456
3456
|
destroy() {
|
|
3457
3457
|
if (this.destroyed) return;
|
|
@@ -3488,7 +3488,7 @@ class Jr {
|
|
|
3488
3488
|
/* ===================== 图片 ===================== */
|
|
3489
3489
|
/** 图片转 base64 后按当前光标处逐张内嵌 */
|
|
3490
3490
|
async insertImageFiles(t) {
|
|
3491
|
-
for (const { file: n, src: o } of await
|
|
3491
|
+
for (const { file: n, src: o } of await ji(t))
|
|
3492
3492
|
this.exec("insertImage", { src: o, alt: n.name || "image" });
|
|
3493
3493
|
}
|
|
3494
3494
|
isMenuOpen() {
|
|
@@ -3496,16 +3496,16 @@ class Jr {
|
|
|
3496
3496
|
}
|
|
3497
3497
|
}
|
|
3498
3498
|
Object.assign(
|
|
3499
|
-
|
|
3500
|
-
|
|
3501
|
-
|
|
3502
|
-
|
|
3503
|
-
mc,
|
|
3499
|
+
ei.prototype,
|
|
3500
|
+
sc,
|
|
3501
|
+
uc,
|
|
3502
|
+
fc,
|
|
3504
3503
|
pc,
|
|
3505
3504
|
gc,
|
|
3506
|
-
|
|
3505
|
+
vc,
|
|
3506
|
+
Lc
|
|
3507
3507
|
);
|
|
3508
|
-
const
|
|
3508
|
+
const Zo = {
|
|
3509
3509
|
"rte-undo": '<path d="M10 5.4 4.4 11l5.6 5.6 1.5-1.5-3-3H14a4.6 4.6 0 0 1 0 9.2h-1.4V23H14a6.6 6.6 0 0 0 0-13.2h-5.5l3-3L10 5.4z"/>',
|
|
3510
3510
|
"rte-redo": '<path d="M14 5.4 19.6 11 14 16.6l-1.5-1.5 3-3H10a4.6 4.6 0 0 0 0 9.2h1.4V23H10a6.6 6.6 0 0 1 0-13.2h5.5l-3-3L14 5.4z"/>',
|
|
3511
3511
|
"rte-text": '<path d="M4 5h16v2.2H4zM4 10.9h16v2.2H4zM4 16.8h9v2.2H4z"/>',
|
|
@@ -3600,8 +3600,11 @@ const Mc = {
|
|
|
3600
3600
|
strokeLinejoin: { type: String, default: "round" }
|
|
3601
3601
|
},
|
|
3602
3602
|
setup(e) {
|
|
3603
|
-
const t = e, n =
|
|
3604
|
-
|
|
3603
|
+
const t = e, n = (r) => {
|
|
3604
|
+
const i = r.indexOf("-");
|
|
3605
|
+
return i < 0 ? r : r.slice(0, i + 1) + r.slice(i + 1).replace(/-([a-z0-9])/g, (l, s) => s.toUpperCase());
|
|
3606
|
+
}, o = j(() => Zo[t.name] || Zo[n(t.name)] || "");
|
|
3607
|
+
return (r, i) => (N(), D("svg", {
|
|
3605
3608
|
width: e.size,
|
|
3606
3609
|
height: e.size,
|
|
3607
3610
|
viewBox: `0 0 ${e.viewBox || 24} ${e.viewBox || 24}`,
|
|
@@ -3610,16 +3613,16 @@ const Mc = {
|
|
|
3610
3613
|
"stroke-width": e.strokeWidth,
|
|
3611
3614
|
"stroke-linecap": e.strokeLinecap,
|
|
3612
3615
|
"stroke-linejoin": e.strokeLinejoin,
|
|
3613
|
-
innerHTML:
|
|
3616
|
+
innerHTML: o.value
|
|
3614
3617
|
}, null, 8, Nc));
|
|
3615
3618
|
}
|
|
3616
|
-
},
|
|
3619
|
+
}, ti = /* @__PURE__ */ Object.assign({ inheritAttrs: !1 }, {
|
|
3617
3620
|
__name: "ImageViewer",
|
|
3618
3621
|
setup(e) {
|
|
3619
|
-
return (t, n) => (N(), J(q(
|
|
3622
|
+
return (t, n) => (N(), J(q($i), ro(io(t.$attrs)), null, 16));
|
|
3620
3623
|
}
|
|
3621
3624
|
});
|
|
3622
|
-
function
|
|
3625
|
+
function ni() {
|
|
3623
3626
|
const e = S([]), t = S(0), n = (i, l = 0) => {
|
|
3624
3627
|
e.value = i.filter(Boolean), t.value = l;
|
|
3625
3628
|
};
|
|
@@ -3630,12 +3633,12 @@ function ti() {
|
|
|
3630
3633
|
e.value = [];
|
|
3631
3634
|
} };
|
|
3632
3635
|
}
|
|
3633
|
-
const
|
|
3636
|
+
const oi = 100;
|
|
3634
3637
|
function Fe(e) {
|
|
3635
3638
|
const t = e?.getBoundingClientRect?.();
|
|
3636
|
-
return t ? { x: t.left, y: t.top, z: t.width > 0 ? t.width /
|
|
3639
|
+
return t ? { x: t.left, y: t.top, z: t.width > 0 ? t.width / oi : 1 } : { x: 0, y: 0, z: 1 };
|
|
3637
3640
|
}
|
|
3638
|
-
const
|
|
3641
|
+
const Jo = {
|
|
3639
3642
|
ready: !1,
|
|
3640
3643
|
canUndo: !1,
|
|
3641
3644
|
canRedo: !1,
|
|
@@ -3677,11 +3680,11 @@ const Zo = {
|
|
|
3677
3680
|
isEmpty: !0
|
|
3678
3681
|
};
|
|
3679
3682
|
function Rc(e) {
|
|
3680
|
-
const t =
|
|
3683
|
+
const t = Ni({ ...Jo }), n = S(null), o = () => {
|
|
3681
3684
|
const l = n.value;
|
|
3682
3685
|
!l || l.destroyed || Object.assign(t, l.state());
|
|
3683
3686
|
}, r = () => {
|
|
3684
|
-
n.value && (n.value.off("state", o), n.value.off("selection", o), n.value = null, Object.assign(t,
|
|
3687
|
+
n.value && (n.value.off("state", o), n.value.off("selection", o), n.value = null, Object.assign(t, Jo));
|
|
3685
3688
|
};
|
|
3686
3689
|
return Ie(e, (l) => {
|
|
3687
3690
|
r(), l && (n.value = l, l.on("state", o), l.on("selection", o), o());
|
|
@@ -3718,7 +3721,7 @@ const je = (e, t) => {
|
|
|
3718
3721
|
},
|
|
3719
3722
|
emits: ["update:modelValue"],
|
|
3720
3723
|
setup(e, { expose: t, emit: n }) {
|
|
3721
|
-
const o = e, r = n, i = S(null), l = S(null), s = S(null), a =
|
|
3724
|
+
const o = e, r = n, i = S(null), l = S(null), s = S(null), a = Ri(null), c = Rc(a), f = S(null), u = ["top-left", "top-right", "bottom-left", "bottom-right"], p = S(null), y = j(() => p.value ? { left: `${p.value.left}px`, top: `${p.value.top}px`, width: `${p.value.width}px`, height: `${p.value.height}px` } : {});
|
|
3722
3725
|
let E = null, m = !1;
|
|
3723
3726
|
const h = S(null), g = j(
|
|
3724
3727
|
() => h.value ? { left: `${h.value.left}px`, top: `${h.value.top}px`, width: `${h.value.width}px`, height: `${h.value.height}px` } : {}
|
|
@@ -3835,7 +3838,7 @@ const je = (e, t) => {
|
|
|
3835
3838
|
index: Ut,
|
|
3836
3839
|
openAt: gt,
|
|
3837
3840
|
close: Rn
|
|
3838
|
-
} =
|
|
3841
|
+
} = ni(), vt = (v) => v.target.closest?.("img"), On = () => {
|
|
3839
3842
|
f.value && gt(l.value, f.value);
|
|
3840
3843
|
};
|
|
3841
3844
|
function Bn(v) {
|
|
@@ -3858,7 +3861,7 @@ const je = (e, t) => {
|
|
|
3858
3861
|
}
|
|
3859
3862
|
);
|
|
3860
3863
|
function Gt() {
|
|
3861
|
-
const v = o.handlers || {}, k = new
|
|
3864
|
+
const v = o.handlers || {}, k = new ei({
|
|
3862
3865
|
root: l.value,
|
|
3863
3866
|
placeholder: o.placeholder,
|
|
3864
3867
|
handlers: {
|
|
@@ -3924,7 +3927,7 @@ const je = (e, t) => {
|
|
|
3924
3927
|
const k = a.value;
|
|
3925
3928
|
k && v !== L && v !== k.getHTML() && (A && (clearTimeout(A), A = 0), M = !1, k.setHTML(v || ""), L = k.getHTML());
|
|
3926
3929
|
}
|
|
3927
|
-
),
|
|
3930
|
+
), lr(() => {
|
|
3928
3931
|
Gt(), a.value?.on("column-hover", We), a.value?.on("cell-selection", mt), i.value?.addEventListener("scroll", d), i.value?.addEventListener("mousemove", Ee), i.value?.addEventListener("mouseleave", Y), i.value?.addEventListener("mousedown", kt, !0), window.addEventListener("resize", d);
|
|
3929
3932
|
}), Rt(() => {
|
|
3930
3933
|
R(), a.value?.off("column-hover", We), a.value?.off("cell-selection", mt), i.value?.removeEventListener("scroll", d), i.value?.removeEventListener("mousemove", Ee), i.value?.removeEventListener("mouseleave", Y), i.value?.removeEventListener("mousedown", kt, !0), document.removeEventListener("mousemove", _e), document.removeEventListener("mouseup", yt), a.value?.blockMarqueeActive && (a.value.blockMarqueeActive = !1, a.value.clearBlockSelection()), window.removeEventListener("resize", d), C && cancelAnimationFrame(C), a.value?.destroy(), a.value = null;
|
|
@@ -3964,7 +3967,7 @@ const je = (e, t) => {
|
|
|
3964
3967
|
ref_key: "probeRef",
|
|
3965
3968
|
ref: s,
|
|
3966
3969
|
class: "re-overlay-probe",
|
|
3967
|
-
style: Z({ width: `${q(
|
|
3970
|
+
style: Z({ width: `${q(oi)}px` }),
|
|
3968
3971
|
"aria-hidden": "true"
|
|
3969
3972
|
}, null, 4),
|
|
3970
3973
|
I("div", {
|
|
@@ -4043,7 +4046,7 @@ const je = (e, t) => {
|
|
|
4043
4046
|
editor: a.value,
|
|
4044
4047
|
state: q(c)
|
|
4045
4048
|
}, void 0, !0),
|
|
4046
|
-
q(pt).length ? (N(), J(
|
|
4049
|
+
q(pt).length ? (N(), J(ti, {
|
|
4047
4050
|
key: 0,
|
|
4048
4051
|
images: q(pt),
|
|
4049
4052
|
"initial-index": q(Ut),
|
|
@@ -4091,7 +4094,7 @@ const je = (e, t) => {
|
|
|
4091
4094
|
openAt: (o) => n.value?.openAt?.(o),
|
|
4092
4095
|
close: () => n.value?.close?.(),
|
|
4093
4096
|
isOpen: () => !!n.value?.isOpen?.()
|
|
4094
|
-
}), (o, r) => (N(), J(q(
|
|
4097
|
+
}), (o, r) => (N(), J(q(_i), {
|
|
4095
4098
|
ref_key: "inner",
|
|
4096
4099
|
ref: n
|
|
4097
4100
|
}, {
|
|
@@ -4183,7 +4186,7 @@ const je = (e, t) => {
|
|
|
4183
4186
|
size: 13,
|
|
4184
4187
|
"aria-hidden": "true"
|
|
4185
4188
|
}),
|
|
4186
|
-
|
|
4189
|
+
sr(I("input", {
|
|
4187
4190
|
ref_key: "searchRef",
|
|
4188
4191
|
ref: s,
|
|
4189
4192
|
"onUpdate:modelValue": L[1] || (L[1] = (R) => c.value = R),
|
|
@@ -4198,7 +4201,7 @@ const je = (e, t) => {
|
|
|
4198
4201
|
et(te(m, ["stop", "prevent"]), ["esc"])
|
|
4199
4202
|
]
|
|
4200
4203
|
}, null, 40, Xc), [
|
|
4201
|
-
[
|
|
4204
|
+
[ar, c.value]
|
|
4202
4205
|
])
|
|
4203
4206
|
])) : U("", !0),
|
|
4204
4207
|
I("div", {
|
|
@@ -4257,7 +4260,7 @@ const je = (e, t) => {
|
|
|
4257
4260
|
_: 1
|
|
4258
4261
|
}, 8, ["placement", "z-index"]));
|
|
4259
4262
|
}
|
|
4260
|
-
}, Qt = /* @__PURE__ */ je(Zc, [["__scopeId", "data-v-b00865fb"]]),
|
|
4263
|
+
}, Qt = /* @__PURE__ */ je(Zc, [["__scopeId", "data-v-b00865fb"]]), ri = [
|
|
4261
4264
|
{ key: "paragraph", title: "正文", icon: "text", shortcut: "Ctrl/Cmd + Alt + 0" },
|
|
4262
4265
|
{ key: "heading1", title: "标题 1", icon: "h1", shortcut: "Ctrl/Cmd + Alt + 1" },
|
|
4263
4266
|
{ key: "heading2", title: "标题 2", icon: "h2", shortcut: "Ctrl/Cmd + Alt + 2" },
|
|
@@ -4265,8 +4268,8 @@ const je = (e, t) => {
|
|
|
4265
4268
|
{ key: "heading4", title: "标题 4", icon: "h4", shortcut: "Ctrl/Cmd + Alt + 4" },
|
|
4266
4269
|
{ key: "heading5", title: "标题 5", icon: "h5", shortcut: "Ctrl/Cmd + Alt + 5" },
|
|
4267
4270
|
{ key: "heading6", title: "标题 6", icon: "h6", shortcut: "Ctrl/Cmd + Alt + 6" }
|
|
4268
|
-
],
|
|
4269
|
-
...
|
|
4271
|
+
], ii = [
|
|
4272
|
+
...ri,
|
|
4270
4273
|
{ key: "blockquote", title: "引用", icon: "quote" },
|
|
4271
4274
|
{ key: "codeBlock", title: "代码块", icon: "code" },
|
|
4272
4275
|
{ key: "bulletList", title: "无序列表", icon: "bullet", shortcut: "Ctrl/Cmd + Shift + 7" },
|
|
@@ -4340,7 +4343,7 @@ const je = (e, t) => {
|
|
|
4340
4343
|
{ key: "increaseIndent", title: "增加缩进", icon: "indentAdd", shortcut: "Tab" },
|
|
4341
4344
|
{ key: "decreaseIndent", title: "减少缩进", icon: "indentReduce", shortcut: "Shift + Tab" }
|
|
4342
4345
|
]
|
|
4343
|
-
],
|
|
4346
|
+
], er = {
|
|
4344
4347
|
title: { icon: "h1", name: "标题" },
|
|
4345
4348
|
heading1: { icon: "h1", name: "一级标题" },
|
|
4346
4349
|
heading2: { icon: "h2", name: "二级标题" },
|
|
@@ -4362,7 +4365,7 @@ const je = (e, t) => {
|
|
|
4362
4365
|
};
|
|
4363
4366
|
function tu(e, t) {
|
|
4364
4367
|
let n = Ft(e);
|
|
4365
|
-
return (n === "listItem" || n === "taskItem") && (n =
|
|
4368
|
+
return (n === "listItem" || n === "taskItem") && (n = Gr(e, t) || "bulletList"), er[n] || er.paragraph;
|
|
4366
4369
|
}
|
|
4367
4370
|
const nu = /(?:^|\s)([/、])([^\s/、]*)$/;
|
|
4368
4371
|
function ou(e) {
|
|
@@ -4419,7 +4422,7 @@ function ru(e, t, n = {}) {
|
|
|
4419
4422
|
return !1;
|
|
4420
4423
|
}
|
|
4421
4424
|
}
|
|
4422
|
-
function
|
|
4425
|
+
function li(e, t, n = null) {
|
|
4423
4426
|
if (!e) return !1;
|
|
4424
4427
|
const o = t.startsWith("heading") ? Number(t.slice(7)) : 0, i = o ? `heading${o}` : {
|
|
4425
4428
|
paragraph: "paragraph",
|
|
@@ -4450,10 +4453,10 @@ function lu(e, t) {
|
|
|
4450
4453
|
const n = String(t || "").trim();
|
|
4451
4454
|
return e ? e.exec(n ? "setLink" : "unsetLink", n) : !1;
|
|
4452
4455
|
}
|
|
4453
|
-
const
|
|
4454
|
-
function
|
|
4456
|
+
const si = "gbrichtext:recent-styles", hn = "";
|
|
4457
|
+
function ai() {
|
|
4455
4458
|
try {
|
|
4456
|
-
const e = JSON.parse(localStorage.getItem(
|
|
4459
|
+
const e = JSON.parse(localStorage.getItem(si) || "[]");
|
|
4457
4460
|
return Array.isArray(e) ? e.filter((t) => typeof t == "string") : [];
|
|
4458
4461
|
} catch {
|
|
4459
4462
|
return [];
|
|
@@ -4461,27 +4464,27 @@ function si() {
|
|
|
4461
4464
|
}
|
|
4462
4465
|
function su(e) {
|
|
4463
4466
|
try {
|
|
4464
|
-
localStorage.setItem(
|
|
4467
|
+
localStorage.setItem(si, JSON.stringify(e));
|
|
4465
4468
|
} catch {
|
|
4466
4469
|
}
|
|
4467
4470
|
}
|
|
4468
|
-
function
|
|
4471
|
+
function tr(e) {
|
|
4469
4472
|
return `${e.kind}${hn}${e.value}`;
|
|
4470
4473
|
}
|
|
4471
|
-
function
|
|
4474
|
+
function ci(e) {
|
|
4472
4475
|
if (typeof e != "string" || !e) return null;
|
|
4473
4476
|
const [t, ...n] = e.split(hn);
|
|
4474
4477
|
return t ? { kind: t, value: n.join(hn) } : null;
|
|
4475
4478
|
}
|
|
4476
|
-
function
|
|
4477
|
-
return
|
|
4479
|
+
function ui() {
|
|
4480
|
+
return ai().map(ci).filter(Boolean);
|
|
4478
4481
|
}
|
|
4479
|
-
function
|
|
4480
|
-
const n = { kind: e, value: String(t ?? "") }, o =
|
|
4481
|
-
const l =
|
|
4482
|
-
return l &&
|
|
4482
|
+
function di(e, t) {
|
|
4483
|
+
const n = { kind: e, value: String(t ?? "") }, o = tr(n), r = ai().filter((i) => {
|
|
4484
|
+
const l = ci(i);
|
|
4485
|
+
return l && tr(l) !== o;
|
|
4483
4486
|
});
|
|
4484
|
-
su([`${n.kind}${hn}${n.value}`, ...r].slice(0,
|
|
4487
|
+
su([`${n.kind}${hn}${n.value}`, ...r].slice(0, Pi));
|
|
4485
4488
|
}
|
|
4486
4489
|
const au = { class: "re-toolbar" }, cu = { class: "re-group" }, uu = { class: "re-group" }, du = { class: "re-group" }, fu = { class: "re-group" }, hu = { class: "re-group" }, mu = { class: "re-group" }, pu = {
|
|
4487
4490
|
__name: "FormatToolbar",
|
|
@@ -4491,14 +4494,14 @@ const au = { class: "re-toolbar" }, cu = { class: "re-group" }, uu = { class: "r
|
|
|
4491
4494
|
state: { type: Object, required: !0 }
|
|
4492
4495
|
},
|
|
4493
4496
|
setup(e) {
|
|
4494
|
-
const t = e, n = S(""), o = S(null), r = S(0), i = j(() => (r.value,
|
|
4497
|
+
const t = e, n = S(""), o = S(null), r = S(0), i = j(() => (r.value, ui()));
|
|
4495
4498
|
function l(C, d) {
|
|
4496
|
-
|
|
4499
|
+
di(C, d), r.value += 1;
|
|
4497
4500
|
}
|
|
4498
4501
|
function s(C, ...d) {
|
|
4499
4502
|
t.editor && (t.editor.focus(), t.editor.exec(C, ...d));
|
|
4500
4503
|
}
|
|
4501
|
-
const a =
|
|
4504
|
+
const a = ri.map((C) => ({ value: C.key, label: C.title, icon: C.icon, hint: C.shortcut })), c = j(() => ii.find((C) => C.key === t.state.blockType)?.title || "正文"), f = (C) => li(t.editor, C), u = { value: "", label: "默认", clear: !0 }, p = [u, ...Je.map((C) => ({ value: `${C}px`, label: `${C}px` }))], y = j(() => t.state.fontSize || "字号"), E = (C) => s(C ? "setFontSize" : "unsetFontSize", C), m = j(() => [
|
|
4502
4505
|
u,
|
|
4503
4506
|
...xo.map((C) => ({ value: C.value, label: C.label, style: { fontFamily: C.value } }))
|
|
4504
4507
|
]), h = j(() => t.state.fontFamily ? xo.find((d) => d.value === t.state.fontFamily)?.label || t.state.fontFamily.split(",")[0].replace(/"/g, "") : "字体"), g = (C) => s(C ? "setFontFamily" : "unsetFontFamily", C), A = [u, ...Vn.map((C) => ({ value: C, label: C }))], M = j(() => t.state.lineHeight || "行高"), L = (C) => s("setBlockLineHeight", C || null);
|
|
@@ -4630,7 +4633,7 @@ const au = { class: "re-toolbar" }, cu = { class: "re-group" }, uu = { class: "r
|
|
|
4630
4633
|
}, null, 4)) : U("", !0)
|
|
4631
4634
|
], 512)
|
|
4632
4635
|
]),
|
|
4633
|
-
n.value === "appearance" ? (N(), J(q(
|
|
4636
|
+
n.value === "appearance" ? (N(), J(q(cr), {
|
|
4634
4637
|
key: 0,
|
|
4635
4638
|
anchor: o.value,
|
|
4636
4639
|
state: e.state,
|
|
@@ -4641,7 +4644,7 @@ const au = { class: "re-toolbar" }, cu = { class: "re-group" }, uu = { class: "r
|
|
|
4641
4644
|
}, null, 8, ["anchor", "state", "recent-styles", "z-index"])) : U("", !0),
|
|
4642
4645
|
d[18] || (d[18] = I("span", { class: "re-sep" }, null, -1)),
|
|
4643
4646
|
I("div", fu, [
|
|
4644
|
-
(N(!0), D(nt, null, xt(q(
|
|
4647
|
+
(N(!0), D(nt, null, xt(q(Fi), (b) => (N(), J(K, {
|
|
4645
4648
|
key: b.value,
|
|
4646
4649
|
icon: b.icon,
|
|
4647
4650
|
title: b.title,
|
|
@@ -4698,7 +4701,7 @@ const au = { class: "re-toolbar" }, cu = { class: "re-group" }, uu = { class: "r
|
|
|
4698
4701
|
}, null, 8, ["active"])
|
|
4699
4702
|
]),
|
|
4700
4703
|
d[21] || (d[21] = I("span", { class: "re-sep" }, null, -1)),
|
|
4701
|
-
B(q(
|
|
4704
|
+
B(q(qi), {
|
|
4702
4705
|
"z-index": q(at).RICHTEXT_FLOAT,
|
|
4703
4706
|
onSelect: ee
|
|
4704
4707
|
}, {
|
|
@@ -4931,7 +4934,7 @@ const au = { class: "re-toolbar" }, cu = { class: "re-group" }, uu = { class: "r
|
|
|
4931
4934
|
content: re(({ close: A }) => [
|
|
4932
4935
|
I("div", wu, [
|
|
4933
4936
|
r.value ? (N(), D("div", xu, pe(r.value), 1)) : U("", !0),
|
|
4934
|
-
|
|
4937
|
+
sr(I("input", {
|
|
4935
4938
|
ref_key: "inputRef",
|
|
4936
4939
|
ref: o,
|
|
4937
4940
|
"onUpdate:modelValue": g[0] || (g[0] = (M) => l.value = M),
|
|
@@ -4946,7 +4949,7 @@ const au = { class: "re-toolbar" }, cu = { class: "re-group" }, uu = { class: "r
|
|
|
4946
4949
|
et(te(A, ["prevent"]), ["esc"])
|
|
4947
4950
|
]
|
|
4948
4951
|
}, null, 40, Lu), [
|
|
4949
|
-
[
|
|
4952
|
+
[ar, l.value]
|
|
4950
4953
|
]),
|
|
4951
4954
|
I("div", Mu, [
|
|
4952
4955
|
B(q(Lo), {
|
|
@@ -5033,7 +5036,7 @@ function $u(e, t, n = {}) {
|
|
|
5033
5036
|
});
|
|
5034
5037
|
return { left: Math.round(i), top: Math.round(l), maxHeight: Math.round(s) };
|
|
5035
5038
|
}
|
|
5036
|
-
function
|
|
5039
|
+
function nr(e) {
|
|
5037
5040
|
return !e || typeof e.getBoundingClientRect != "function" ? null : e.getBoundingClientRect();
|
|
5038
5041
|
}
|
|
5039
5042
|
function _u(e, t = {}) {
|
|
@@ -5052,9 +5055,9 @@ const Pu = {
|
|
|
5052
5055
|
state: { type: Object, required: !0 }
|
|
5053
5056
|
},
|
|
5054
5057
|
setup(e, { expose: t }) {
|
|
5055
|
-
const n = e, o = S(!1), r = S(""), i = S(null), l = S(null), s = S(null), a = S(null), c = S({ left: 0, top: 0 }), f = S(0), u = j(() => (f.value,
|
|
5058
|
+
const n = e, o = S(!1), r = S(""), i = S(null), l = S(null), s = S(null), a = S(null), c = S({ left: 0, top: 0 }), f = S(0), u = j(() => (f.value, ui()));
|
|
5056
5059
|
function p(C, d) {
|
|
5057
|
-
|
|
5060
|
+
di(C, d), f.value += 1;
|
|
5058
5061
|
}
|
|
5059
5062
|
const y = j(() => _u(c.value));
|
|
5060
5063
|
function E(C, ...d) {
|
|
@@ -5074,7 +5077,7 @@ const Pu = {
|
|
|
5074
5077
|
}
|
|
5075
5078
|
async function h() {
|
|
5076
5079
|
await rt();
|
|
5077
|
-
const C = m(), d =
|
|
5080
|
+
const C = m(), d = nr(i.value);
|
|
5078
5081
|
!C || !d || (c.value = $u(C, d, { placement: "top", gap: 8 }));
|
|
5079
5082
|
}
|
|
5080
5083
|
function g() {
|
|
@@ -5090,7 +5093,7 @@ const Pu = {
|
|
|
5090
5093
|
}
|
|
5091
5094
|
function L() {
|
|
5092
5095
|
const C = n.editor;
|
|
5093
|
-
C && (C.focus(), l.value?.openAt(
|
|
5096
|
+
C && (C.focus(), l.value?.openAt(nr(a.value), {
|
|
5094
5097
|
title: "链接地址",
|
|
5095
5098
|
placeholder: "https://…(留空取消链接)",
|
|
5096
5099
|
initial: n.state.linkHref || "",
|
|
@@ -5135,12 +5138,12 @@ const Pu = {
|
|
|
5135
5138
|
d && d !== C && (d.off("selectionUpdate", g), d.off("transaction", g), d.off("focus", g), d.off("blur", A)), ee(C);
|
|
5136
5139
|
},
|
|
5137
5140
|
{ immediate: !0 }
|
|
5138
|
-
),
|
|
5141
|
+
), lr(() => {
|
|
5139
5142
|
window.addEventListener("scroll", $, !0), window.addEventListener("resize", $);
|
|
5140
5143
|
}), Rt(() => {
|
|
5141
5144
|
W(), window.removeEventListener("scroll", $, !0), window.removeEventListener("resize", $);
|
|
5142
|
-
}), t({ refresh: g, openLink: L }), (C, d) => (N(), J(
|
|
5143
|
-
B(
|
|
5145
|
+
}), t({ refresh: g, openLink: L }), (C, d) => (N(), J(Oi, { to: "body" }, [
|
|
5146
|
+
B(Bi, { name: "re-bubble" }, {
|
|
5144
5147
|
default: re(() => [
|
|
5145
5148
|
o.value ? (N(), D("div", {
|
|
5146
5149
|
key: 0,
|
|
@@ -5212,7 +5215,7 @@ const Pu = {
|
|
|
5212
5215
|
trigger: "manual",
|
|
5213
5216
|
"z-index": q(at).RICHTEXT_FLOAT
|
|
5214
5217
|
}, null, 8, ["z-index"]),
|
|
5215
|
-
r.value === "appearance" ? (N(), J(q(
|
|
5218
|
+
r.value === "appearance" ? (N(), J(q(cr), {
|
|
5216
5219
|
key: 0,
|
|
5217
5220
|
anchor: s.value,
|
|
5218
5221
|
state: e.state,
|
|
@@ -5227,7 +5230,7 @@ const Pu = {
|
|
|
5227
5230
|
})
|
|
5228
5231
|
]));
|
|
5229
5232
|
}
|
|
5230
|
-
}, Fu = { class: "re-gutter" }, qu = ["title"], Uu = ["title", "aria-label"], $n = 22, _n = 24, Vu = 4,
|
|
5233
|
+
}, Fu = { class: "re-gutter" }, qu = ["title"], Uu = ["title", "aria-label"], $n = 22, _n = 24, Vu = 4, or = 10, Pn = 16, Gu = 22, Ku = 4, rr = 48, ir = 10, Xu = 16, ju = {
|
|
5231
5234
|
__name: "BlockHandle",
|
|
5232
5235
|
props: {
|
|
5233
5236
|
editor: { type: Object, default: null },
|
|
@@ -5246,9 +5249,9 @@ const Pu = {
|
|
|
5246
5249
|
return Fe(n.probe);
|
|
5247
5250
|
}
|
|
5248
5251
|
const C = (w) => ({
|
|
5249
|
-
left: `${l.value.left + ($n -
|
|
5252
|
+
left: `${l.value.left + ($n - or) / 2}px`,
|
|
5250
5253
|
top: `${Math.max(0, l.value.top + (w === "before" ? -4 : _n + 2))}px`,
|
|
5251
|
-
width: `${
|
|
5254
|
+
width: `${or}px`
|
|
5252
5255
|
}), d = j(() => ({
|
|
5253
5256
|
left: `${l.value.left + ($n - Pn) / 2}px`,
|
|
5254
5257
|
top: `${Math.max(0, l.value.top + (f.value === "before" ? -12 : _n - 4))}px`,
|
|
@@ -5354,7 +5357,7 @@ const Pu = {
|
|
|
5354
5357
|
const w = n.scrollEl;
|
|
5355
5358
|
if (!w) return;
|
|
5356
5359
|
const _ = w.getBoundingClientRect();
|
|
5357
|
-
y.y < _.top +
|
|
5360
|
+
y.y < _.top + rr ? w.scrollTop -= ir : y.y > _.bottom - rr && (w.scrollTop += ir);
|
|
5358
5361
|
}
|
|
5359
5362
|
function Bn() {
|
|
5360
5363
|
const w = n.scrollEl;
|
|
@@ -5489,12 +5492,12 @@ const Pu = {
|
|
|
5489
5492
|
}, null, 6)) : U("", !0)
|
|
5490
5493
|
]));
|
|
5491
5494
|
}
|
|
5492
|
-
}, Wu = /* @__PURE__ */ je(ju, [["__scopeId", "data-v-002b9bfb"]]),
|
|
5495
|
+
}, Wu = /* @__PURE__ */ je(ju, [["__scopeId", "data-v-002b9bfb"]]), fi = /* @__PURE__ */ Object.assign({ inheritAttrs: !1 }, {
|
|
5493
5496
|
__name: "ContextMenu",
|
|
5494
5497
|
setup(e) {
|
|
5495
|
-
return (t, n) => (N(), J(q(
|
|
5498
|
+
return (t, n) => (N(), J(q(Ui), ro(io(t.$attrs)), null, 16));
|
|
5496
5499
|
}
|
|
5497
|
-
}), F = (e) =>
|
|
5500
|
+
}), F = (e) => Ii(() => Hi(ve, { name: e, size: 15 })), Yu = {
|
|
5498
5501
|
__name: "BlockMenu",
|
|
5499
5502
|
props: {
|
|
5500
5503
|
editor: { type: Object, default: null },
|
|
@@ -5526,7 +5529,7 @@ const Pu = {
|
|
|
5526
5529
|
M && g.exec(M, A);
|
|
5527
5530
|
}
|
|
5528
5531
|
function E(h) {
|
|
5529
|
-
o.editor &&
|
|
5532
|
+
o.editor && li(o.editor, h, a.value);
|
|
5530
5533
|
}
|
|
5531
5534
|
function m({ x: h, y: g, block: A }) {
|
|
5532
5535
|
if (!A) return;
|
|
@@ -5546,7 +5549,7 @@ const Pu = {
|
|
|
5546
5549
|
{
|
|
5547
5550
|
label: "转换为",
|
|
5548
5551
|
// blockOnly 项(高亮块/超级块)只在 block 档出现:Word/docx 等 basic 档不暴露
|
|
5549
|
-
children:
|
|
5552
|
+
children: ii.filter((L) => !L.blockOnly || o.domain === "block").map((L) => ({
|
|
5550
5553
|
label: L.title,
|
|
5551
5554
|
icon: F(`rte-${L.icon}`),
|
|
5552
5555
|
shortcut: L.shortcut,
|
|
@@ -5568,7 +5571,7 @@ const Pu = {
|
|
|
5568
5571
|
}
|
|
5569
5572
|
return t({ open: m, close: () => {
|
|
5570
5573
|
i.value = !1;
|
|
5571
|
-
} }), (h, g) => (N(), J(
|
|
5574
|
+
} }), (h, g) => (N(), J(fi, {
|
|
5572
5575
|
visible: i.value,
|
|
5573
5576
|
position: l.value,
|
|
5574
5577
|
items: s.value,
|
|
@@ -5612,7 +5615,7 @@ const Pu = {
|
|
|
5612
5615
|
{ divided: !0, group: 2 },
|
|
5613
5616
|
{ op: "inline", command: "unsetColor", title: "默认颜色", group: 2 },
|
|
5614
5617
|
// [设计] 调色板取 core/constants/textStyles 的唯一一张表,不在表格域另建第二份
|
|
5615
|
-
...
|
|
5618
|
+
...Vi.map((e) => ({ op: "inline", command: "setColor", args: [e], title: e, colorDot: e, group: 2 }))
|
|
5616
5619
|
], td = Qu.map((e, t) => ({
|
|
5617
5620
|
op: "table",
|
|
5618
5621
|
key: "cellShade",
|
|
@@ -5633,19 +5636,19 @@ const Pu = {
|
|
|
5633
5636
|
// [设计] 合并/拆分只在「更多」里出现(对应思源把 cancelMerged 收进 otherMenus):单格态没有框选,
|
|
5634
5637
|
// 顶层挂一个合并项多半是禁用死项,收进「更多」既保留「拆分已合并格」能力又不占主面。
|
|
5635
5638
|
{ op: "table", key: "mergeOrSplit", title: "合并 / 拆分单元格", group: 4, icon: F("rte-mergeCells") }
|
|
5636
|
-
],
|
|
5639
|
+
], hi = (e) => ({ op: "menu", title: "字体效果", group: e, children: ed, icon: F("rte-colorIcon") }), mi = (e) => ({ op: "menu", title: "背景颜色", group: e, children: td, icon: F("rte-bgIcon") }), pi = (e) => ({ op: "menu", title: "对齐方式", group: e, children: Ju, icon: F("rte-alignLeft") }), gi = (e) => ({ op: "menu", title: "更多", group: e, children: nd, icon: "MoreFilled" }), vi = (e) => [
|
|
5637
5640
|
{ op: "clip", key: "paste", title: "粘贴", shortcut: "Ctrl+V", group: e, icon: F("rte-copy") },
|
|
5638
5641
|
{ op: "clip", key: "pasteKeepFormat", title: "粘贴并保留源格式", group: e },
|
|
5639
5642
|
{ op: "clip", key: "pasteText", title: "粘贴为纯文本", shortcut: "Ctrl+Shift+V", group: e }
|
|
5640
|
-
],
|
|
5643
|
+
], bi = (e) => ({ op: "table", key: "selectAll", title: "全选", shortcut: "Ctrl+A", group: e, icon: F("rte-table") }), yi = (e) => [
|
|
5641
5644
|
{ op: "table", key: "insertRowBefore", title: "在上方插入", unit: "行", input: "rows", group: e, icon: F("rte-rowAbove") },
|
|
5642
5645
|
{ op: "table", key: "insertRowAfter", title: "在下方插入", unit: "行", input: "rows", group: e, icon: F("rte-rowBelow") },
|
|
5643
5646
|
{ op: "table", key: "insertColumnBefore", title: "在左侧插入", unit: "列", input: "cols", group: e, icon: F("rte-colLeft") },
|
|
5644
5647
|
{ op: "table", key: "insertColumnAfter", title: "在右侧插入", unit: "列", input: "cols", group: e, icon: F("rte-colRight") }
|
|
5645
|
-
],
|
|
5648
|
+
], ki = (e) => [
|
|
5646
5649
|
{ op: "table", key: "deleteRow", title: "删除行", shortcut: "Ctrl+-", group: e, icon: "Delete" },
|
|
5647
5650
|
{ op: "table", key: "deleteColumn", title: "删除列", shortcut: "Ctrl+Shift+-", group: e, icon: "Delete" }
|
|
5648
|
-
],
|
|
5651
|
+
], Ci = (e) => ({ op: "table", key: "deleteTable", title: "删除表格", group: e, danger: !0, icon: "DeleteFilled" });
|
|
5649
5652
|
function od(e) {
|
|
5650
5653
|
return e ? rd(e.rect) ? sd() : ad(e) ? ld() : id() : [];
|
|
5651
5654
|
}
|
|
@@ -5654,56 +5657,56 @@ function rd(e) {
|
|
|
5654
5657
|
}
|
|
5655
5658
|
function id() {
|
|
5656
5659
|
return [
|
|
5657
|
-
...
|
|
5658
|
-
|
|
5659
|
-
...
|
|
5660
|
-
...
|
|
5661
|
-
|
|
5662
|
-
|
|
5660
|
+
...vi(0),
|
|
5661
|
+
bi(1),
|
|
5662
|
+
...yi(2),
|
|
5663
|
+
...ki(3),
|
|
5664
|
+
gi(4),
|
|
5665
|
+
Ci(5)
|
|
5663
5666
|
];
|
|
5664
5667
|
}
|
|
5665
5668
|
function ld() {
|
|
5666
5669
|
return [
|
|
5667
|
-
Ci(0),
|
|
5668
5670
|
Ei(0),
|
|
5669
5671
|
Ai(0),
|
|
5672
|
+
Ti(0),
|
|
5670
5673
|
{ op: "clip", key: "cut", title: "剪切", shortcut: "Ctrl+X", group: 0 },
|
|
5671
5674
|
{ op: "table", key: "clearCell", title: "删除", group: 0, icon: F("rte-clear") },
|
|
5672
|
-
...
|
|
5673
|
-
|
|
5674
|
-
fi(3),
|
|
5675
|
+
...vi(1),
|
|
5676
|
+
bi(2),
|
|
5675
5677
|
hi(3),
|
|
5676
|
-
mi(
|
|
5677
|
-
|
|
5678
|
-
...yi(
|
|
5679
|
-
|
|
5680
|
-
|
|
5678
|
+
mi(3),
|
|
5679
|
+
pi(4),
|
|
5680
|
+
...yi(5),
|
|
5681
|
+
...ki(6),
|
|
5682
|
+
gi(7),
|
|
5683
|
+
Ci(8)
|
|
5681
5684
|
];
|
|
5682
5685
|
}
|
|
5683
5686
|
function sd() {
|
|
5684
5687
|
return [
|
|
5685
|
-
Ci(0),
|
|
5686
5688
|
Ei(0),
|
|
5687
5689
|
Ai(0),
|
|
5690
|
+
Ti(0),
|
|
5688
5691
|
{ op: "clip", key: "cut", title: "剪切", shortcut: "Ctrl+X", group: 0 },
|
|
5689
5692
|
{ op: "clip", key: "paste", title: "粘贴", shortcut: "Ctrl+V", group: 0 },
|
|
5690
5693
|
{ op: "table", key: "clearCell", title: "清空", group: 0, danger: !0, icon: F("rte-clear") },
|
|
5691
|
-
fi(1),
|
|
5692
5694
|
hi(1),
|
|
5693
|
-
mi(
|
|
5695
|
+
mi(1),
|
|
5696
|
+
pi(2),
|
|
5694
5697
|
{ op: "table", key: "deleteRow", title: "删除行", group: 3, icon: "Delete" },
|
|
5695
5698
|
{ op: "table", key: "deleteColumn", title: "删除列", group: 3, icon: "Delete" },
|
|
5696
5699
|
{ op: "table", key: "mergeOrSplit", title: "合并单元格", group: 4, icon: F("rte-mergeCells") }
|
|
5697
5700
|
];
|
|
5698
5701
|
}
|
|
5699
|
-
const
|
|
5702
|
+
const Ei = (e) => ({ op: "clip", key: "copy", title: "复制", shortcut: "Ctrl+C", group: e, icon: F("rte-copy") }), Ai = (e) => ({ op: "clip", key: "copyRich", title: "复制富文本/HTML", group: e }), Ti = (e) => ({ op: "clip", key: "copyText", title: "复制纯文本", group: e });
|
|
5700
5703
|
function ad(e) {
|
|
5701
5704
|
const { rect: t, grid: n } = e;
|
|
5702
5705
|
if (t.r1 !== t.r2 || t.c1 !== t.c2) return !0;
|
|
5703
5706
|
const o = e.cell || n.matrix[t.r1]?.[t.c1]?.el;
|
|
5704
|
-
return !!o && !
|
|
5707
|
+
return !!o && !jr(o);
|
|
5705
5708
|
}
|
|
5706
|
-
function
|
|
5709
|
+
function Si(e, t = {}) {
|
|
5707
5710
|
const { state: n = null, can: o = () => !0, active: r = () => !1, run: i = () => {
|
|
5708
5711
|
} } = t, l = [];
|
|
5709
5712
|
let s = null;
|
|
@@ -5713,7 +5716,7 @@ function Ti(e, t = {}) {
|
|
|
5713
5716
|
continue;
|
|
5714
5717
|
}
|
|
5715
5718
|
const c = { label: a.title, danger: a.danger || void 0, disabled: !o(a) };
|
|
5716
|
-
a.icon && (c.icon = a.icon), a.colorDot && (c.colorDot = a.colorDot), a.shortcut && (c.shortcut = a.shortcut), s !== null && a.group !== s && (c.divided = !0), s = a.group, a.children ? c.children =
|
|
5719
|
+
a.icon && (c.icon = a.icon), a.colorDot && (c.colorDot = a.colorDot), a.shortcut && (c.shortcut = a.shortcut), s !== null && a.group !== s && (c.divided = !0), s = a.group, a.children ? c.children = Si(a.children, t) : (a.input ? c.input = { min: 1, max: Ao, defaultValue: 1, unit: a.unit || "" } : a.toggle && (c.checked = a.command ? !!n?.[Zu[a.command]] : r(a)), c.onClick = (f, u) => i(a, c, u)), l.push(c);
|
|
5717
5720
|
}
|
|
5718
5721
|
return l;
|
|
5719
5722
|
}
|
|
@@ -5736,7 +5739,7 @@ const cd = {
|
|
|
5736
5739
|
}
|
|
5737
5740
|
function c({ x: f, y: u, cell: p = null }) {
|
|
5738
5741
|
const y = n.editor;
|
|
5739
|
-
y && (p && !y.cellRect && y.exec("focusBlock", p), y.contextCell = p, i.value =
|
|
5742
|
+
y && (p && !y.cellRect && y.exec("focusBlock", p), y.contextCell = p, i.value = Si(od(y.tableContext()), {
|
|
5740
5743
|
state: y.state(),
|
|
5741
5744
|
can: l,
|
|
5742
5745
|
active: s,
|
|
@@ -5745,7 +5748,7 @@ const cd = {
|
|
|
5745
5748
|
}
|
|
5746
5749
|
return t({ open: c, close: () => {
|
|
5747
5750
|
o.value = !1;
|
|
5748
|
-
} }), (f, u) => (N(), J(
|
|
5751
|
+
} }), (f, u) => (N(), J(fi, {
|
|
5749
5752
|
visible: o.value,
|
|
5750
5753
|
position: r.value,
|
|
5751
5754
|
items: i.value,
|
|
@@ -5753,7 +5756,7 @@ const cd = {
|
|
|
5753
5756
|
"onUpdate:visible": u[0] || (u[0] = (p) => o.value = p)
|
|
5754
5757
|
}, null, 8, ["visible", "position", "items"]));
|
|
5755
5758
|
}
|
|
5756
|
-
},
|
|
5759
|
+
}, wi = {
|
|
5757
5760
|
__name: "RichEditorCore",
|
|
5758
5761
|
props: {
|
|
5759
5762
|
/** HTML 正文(v-model) */
|
|
@@ -5872,7 +5875,7 @@ const cd = {
|
|
|
5872
5875
|
}, null, 8, ["editor", "scroll-el", "probe", "domain"])
|
|
5873
5876
|
]),
|
|
5874
5877
|
floaters: re(({ editor: g, state: A }) => [
|
|
5875
|
-
B(q(
|
|
5878
|
+
B(q(Gi), {
|
|
5876
5879
|
ref_key: "findBarRef",
|
|
5877
5880
|
ref: s,
|
|
5878
5881
|
engine: g
|
|
@@ -5923,7 +5926,7 @@ const cd = {
|
|
|
5923
5926
|
},
|
|
5924
5927
|
emits: ["update:modelValue"],
|
|
5925
5928
|
setup(e, { expose: t, emit: n }) {
|
|
5926
|
-
const o =
|
|
5929
|
+
const o = zi(() => import("./AttrDialog-FcEyQaFP.js")), r = e, i = n, l = S(null), s = S(null), a = j(() => r.height ? `${r.height}px` : "100%"), c = j(() => Ki(r.modelValue || "")), { images: f, index: u, openAt: p, close: y } = ni(), E = (b) => {
|
|
5927
5930
|
const T = b.target.closest?.("img");
|
|
5928
5931
|
T && p(s.value, T);
|
|
5929
5932
|
}, m = S(!1), h = S({}), g = S("");
|
|
@@ -5964,7 +5967,7 @@ const cd = {
|
|
|
5964
5967
|
}), (b, T) => (N(), D("div", {
|
|
5965
5968
|
class: be(["gb-rte", { "is-fill": !e.height }])
|
|
5966
5969
|
}, [
|
|
5967
|
-
e.mode === "edit" ? (N(), J(
|
|
5970
|
+
e.mode === "edit" ? (N(), J(wi, {
|
|
5968
5971
|
key: 0,
|
|
5969
5972
|
ref_key: "coreRef",
|
|
5970
5973
|
ref: l,
|
|
@@ -5975,7 +5978,7 @@ const cd = {
|
|
|
5975
5978
|
domain: e.domain,
|
|
5976
5979
|
"onUpdate:modelValue": T[0] || (T[0] = (O) => i("update:modelValue", O)),
|
|
5977
5980
|
onBlockAttr: M
|
|
5978
|
-
},
|
|
5981
|
+
}, Di({ _: 2 }, [
|
|
5979
5982
|
b.$slots["toolbar-extra"] ? {
|
|
5980
5983
|
name: "toolbar-extra",
|
|
5981
5984
|
fn: re(() => [
|
|
@@ -6002,7 +6005,7 @@ const cd = {
|
|
|
6002
6005
|
innerHTML: c.value,
|
|
6003
6006
|
onClick: E
|
|
6004
6007
|
}, null, 12, ud)),
|
|
6005
|
-
q(f).length ? (N(), J(
|
|
6008
|
+
q(f).length ? (N(), J(ti, {
|
|
6006
6009
|
key: 2,
|
|
6007
6010
|
images: q(f),
|
|
6008
6011
|
"initial-index": q(u),
|
|
@@ -6021,12 +6024,12 @@ const cd = {
|
|
|
6021
6024
|
], 2));
|
|
6022
6025
|
}
|
|
6023
6026
|
}, fd = /* @__PURE__ */ je(dd, [["__scopeId", "data-v-2d725fe4"]]), hd = (e) => {
|
|
6024
|
-
e.component("GbRichTextEditor", fd), e.component("GbRichEditorCore",
|
|
6025
|
-
}, gd = { install: hd, version: "0.1.
|
|
6027
|
+
e.component("GbRichTextEditor", fd), e.component("GbRichEditorCore", wi);
|
|
6028
|
+
}, gd = { install: hd, version: "0.1.1" };
|
|
6026
6029
|
export {
|
|
6027
6030
|
fd as G,
|
|
6028
6031
|
je as _,
|
|
6029
6032
|
ve as a,
|
|
6030
|
-
|
|
6033
|
+
wi as b,
|
|
6031
6034
|
gd as i
|
|
6032
6035
|
};
|