autumnnote 1.0.3 → 1.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/autumnnote.es.js +923 -869
- package/dist/autumnnote.es.js.map +1 -1
- package/dist/autumnnote.umd.js +11 -11
- package/dist/autumnnote.umd.js.map +1 -1
- package/package.json +1 -1
- package/src/js/index.umd.js +12 -12
- package/src/js/module/ImageResizer.js +41 -26
- package/src/js/module/ImageTooltip.js +40 -6
- package/src/js/module/TableTooltip.js +93 -68
- package/src/js/module/VideoResizer.js +45 -33
- package/src/js/module/VideoTooltip.js +9 -6
package/dist/autumnnote.es.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
function
|
|
1
|
+
function qi(o, e, t) {
|
|
2
2
|
return Math.min(Math.max(o, e), t);
|
|
3
3
|
}
|
|
4
4
|
function Ke(o, e) {
|
|
@@ -7,7 +7,7 @@ function Ke(o, e) {
|
|
|
7
7
|
clearTimeout(t), t = setTimeout(() => o.apply(this, i), e);
|
|
8
8
|
};
|
|
9
9
|
}
|
|
10
|
-
function
|
|
10
|
+
function Ui(o, e) {
|
|
11
11
|
let t = 0;
|
|
12
12
|
return function(...i) {
|
|
13
13
|
const s = Date.now();
|
|
@@ -52,7 +52,7 @@ function Qi(o) {
|
|
|
52
52
|
right: Math.round(o.right)
|
|
53
53
|
} : null;
|
|
54
54
|
}
|
|
55
|
-
const Ge = 1, Qe = 3,
|
|
55
|
+
const Ge = 1, Qe = 3, j = (o) => o && o.nodeType === Ge, Se = (o) => o && o.nodeType === Qe, Ze = (o) => j(o) && /^(area|base|br|col|embed|hr|img|input|link|meta|param|source|track|wbr)$/i.test(o.nodeName), Je = (o) => j(o) && /^(p|div|li|h[1-6]|blockquote|td|th|pre)$/i.test(o.nodeName), et = (o) => j(o) && /^(li)$/i.test(o.nodeName), Zi = (o) => j(o) && /^(ul|ol)$/i.test(o.nodeName), Ji = (o) => j(o) && o.nodeName.toUpperCase() === "TABLE", es = (o) => j(o) && /^(a|abbr|acronym|b|bdo|big|br|button|cite|code|dfn|em|i|img|input|kbd|label|map|object|output|q|s|samp|select|small|span|strong|sub|sup|textarea|time|tt|u|var)$/i.test(o.nodeName), tt = (o) => j(o) && o.isContentEditable, ts = (o) => j(o) && o.nodeName.toUpperCase() === "A", is = (o) => j(o) && o.nodeName.toUpperCase() === "IMG";
|
|
56
56
|
function me(o, e, t) {
|
|
57
57
|
let i = o;
|
|
58
58
|
for (; i && i !== t; ) {
|
|
@@ -61,7 +61,7 @@ function me(o, e, t) {
|
|
|
61
61
|
}
|
|
62
62
|
return null;
|
|
63
63
|
}
|
|
64
|
-
function
|
|
64
|
+
function _e(o, e) {
|
|
65
65
|
return me(o, Je, e);
|
|
66
66
|
}
|
|
67
67
|
function ss(o, e) {
|
|
@@ -76,13 +76,13 @@ function os(o) {
|
|
|
76
76
|
}
|
|
77
77
|
function ns(o) {
|
|
78
78
|
let e = o.previousSibling;
|
|
79
|
-
for (; e && !
|
|
79
|
+
for (; e && !j(e); )
|
|
80
80
|
e = e.previousSibling;
|
|
81
81
|
return e;
|
|
82
82
|
}
|
|
83
83
|
function as(o) {
|
|
84
84
|
let e = o.nextSibling;
|
|
85
|
-
for (; e && !
|
|
85
|
+
for (; e && !j(e); )
|
|
86
86
|
e = e.nextSibling;
|
|
87
87
|
return e;
|
|
88
88
|
}
|
|
@@ -132,7 +132,7 @@ function fs(o) {
|
|
|
132
132
|
function d(o, e, t, i) {
|
|
133
133
|
return o.addEventListener(e, t, i), () => o.removeEventListener(e, t, i);
|
|
134
134
|
}
|
|
135
|
-
function
|
|
135
|
+
function Q(o, e) {
|
|
136
136
|
const t = 'a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])', i = () => Array.from(o.querySelectorAll(t)).filter(
|
|
137
137
|
(n) => !n.closest('[style*="display: none"]') && !n.closest('[style*="display:none"]')
|
|
138
138
|
), s = (n) => {
|
|
@@ -143,8 +143,8 @@ function X(o, e) {
|
|
|
143
143
|
if (n.key !== "Tab") return;
|
|
144
144
|
const a = i();
|
|
145
145
|
if (!a.length) return;
|
|
146
|
-
const
|
|
147
|
-
n.shiftKey ? document.activeElement ===
|
|
146
|
+
const l = a[0], r = a[a.length - 1];
|
|
147
|
+
n.shiftKey ? document.activeElement === l && (n.preventDefault(), r.focus()) : document.activeElement === r && (n.preventDefault(), l.focus());
|
|
148
148
|
};
|
|
149
149
|
return document.addEventListener("keydown", s), () => document.removeEventListener("keydown", s);
|
|
150
150
|
}
|
|
@@ -184,7 +184,7 @@ class fe {
|
|
|
184
184
|
*/
|
|
185
185
|
commonAncestor() {
|
|
186
186
|
const t = this.toNativeRange().commonAncestorContainer;
|
|
187
|
-
return
|
|
187
|
+
return j(t) ? t : t.parentElement;
|
|
188
188
|
}
|
|
189
189
|
/**
|
|
190
190
|
* Returns the nearest paragraph/block ancestor within the editable area.
|
|
@@ -192,7 +192,7 @@ class fe {
|
|
|
192
192
|
* @returns {Element|null}
|
|
193
193
|
*/
|
|
194
194
|
blockNode(e) {
|
|
195
|
-
return me(this.sc, (t) =>
|
|
195
|
+
return me(this.sc, (t) => j(t) && t !== e, e);
|
|
196
196
|
}
|
|
197
197
|
/**
|
|
198
198
|
* Returns either the selected text string or empty string.
|
|
@@ -217,7 +217,7 @@ class fe {
|
|
|
217
217
|
this.toNativeRange().insertNode(e);
|
|
218
218
|
}
|
|
219
219
|
}
|
|
220
|
-
function
|
|
220
|
+
function Ie(o) {
|
|
221
221
|
return new fe(
|
|
222
222
|
o.startContainer,
|
|
223
223
|
o.startOffset,
|
|
@@ -225,19 +225,19 @@ function Ee(o) {
|
|
|
225
225
|
o.endOffset
|
|
226
226
|
);
|
|
227
227
|
}
|
|
228
|
-
function
|
|
228
|
+
function ye(o) {
|
|
229
229
|
const e = window.getSelection();
|
|
230
230
|
if (!e || e.rangeCount === 0) return null;
|
|
231
231
|
const t = e.getRangeAt(0);
|
|
232
|
-
return o && !o.contains(t.commonAncestorContainer) ? null :
|
|
232
|
+
return o && !o.contains(t.commonAncestorContainer) ? null : Ie(t);
|
|
233
233
|
}
|
|
234
234
|
function gs(o) {
|
|
235
235
|
return new fe(o, 0, o, o.childNodes.length);
|
|
236
236
|
}
|
|
237
|
-
function
|
|
237
|
+
function _s(o, e = 0) {
|
|
238
238
|
return new fe(o, e, o, e);
|
|
239
239
|
}
|
|
240
|
-
function
|
|
240
|
+
function ys(o) {
|
|
241
241
|
const e = window.getSelection();
|
|
242
242
|
return !e || e.rangeCount === 0 ? !1 : o.contains(e.getRangeAt(0).commonAncestorContainer);
|
|
243
243
|
}
|
|
@@ -248,16 +248,16 @@ function ie(o) {
|
|
|
248
248
|
return;
|
|
249
249
|
}
|
|
250
250
|
const t = e.getRangeAt(0).cloneRange();
|
|
251
|
-
o(
|
|
251
|
+
o(Ie(t)), e.removeAllRanges(), e.addRange(t);
|
|
252
252
|
}
|
|
253
|
-
function
|
|
253
|
+
function vs(o, e) {
|
|
254
254
|
const t = o.splitText(e);
|
|
255
255
|
return [o, t];
|
|
256
256
|
}
|
|
257
257
|
function S(o, e = null) {
|
|
258
258
|
return document.execCommand(o, !1, e);
|
|
259
259
|
}
|
|
260
|
-
const
|
|
260
|
+
const Ee = () => S("bold"), Re = () => S("italic");
|
|
261
261
|
function Ae() {
|
|
262
262
|
const o = window.getSelection();
|
|
263
263
|
if (!o || !o.rangeCount) return;
|
|
@@ -280,12 +280,12 @@ function He(o, e = document) {
|
|
|
280
280
|
t.parentNode.removeChild(t);
|
|
281
281
|
});
|
|
282
282
|
}
|
|
283
|
-
const
|
|
283
|
+
const De = (o) => S("formatBlock", `<${o}>`), Pe = () => S("justifyLeft"), $e = () => S("justifyCenter"), Oe = () => S("justifyRight"), Fe = () => S("justifyFull"), We = () => S("indent"), qe = () => S("outdent"), Ue = () => S("insertUnorderedList"), Ve = () => S("insertOrderedList");
|
|
284
284
|
function it(o) {
|
|
285
285
|
const e = window.getSelection();
|
|
286
286
|
if (!e || e.rangeCount === 0) return;
|
|
287
|
-
const t = e.getRangeAt(0), i = /* @__PURE__ */ new Set(["P", "DIV", "H1", "H2", "H3", "H4", "H5", "H6", "LI", "BLOCKQUOTE", "PRE", "TD", "TH"]), s = (
|
|
288
|
-
let h =
|
|
287
|
+
const t = e.getRangeAt(0), i = /* @__PURE__ */ new Set(["P", "DIV", "H1", "H2", "H3", "H4", "H5", "H6", "LI", "BLOCKQUOTE", "PRE", "TD", "TH"]), s = (r) => {
|
|
288
|
+
let h = r instanceof Element ? r : r.parentElement;
|
|
289
289
|
for (; h; ) {
|
|
290
290
|
if (i.has(h.tagName)) return h;
|
|
291
291
|
h = h.parentElement;
|
|
@@ -293,23 +293,23 @@ function it(o) {
|
|
|
293
293
|
return null;
|
|
294
294
|
};
|
|
295
295
|
if (t.collapsed) {
|
|
296
|
-
const
|
|
297
|
-
|
|
296
|
+
const r = s(t.startContainer);
|
|
297
|
+
r && (r.style.lineHeight = o);
|
|
298
298
|
return;
|
|
299
299
|
}
|
|
300
300
|
const n = /* @__PURE__ */ new Set(), a = document.createNodeIterator(t.commonAncestorContainer, NodeFilter.SHOW_TEXT, null);
|
|
301
|
-
let
|
|
302
|
-
for (;
|
|
303
|
-
if (t.intersectsNode(
|
|
304
|
-
const
|
|
305
|
-
|
|
301
|
+
let l;
|
|
302
|
+
for (; l = a.nextNode(); )
|
|
303
|
+
if (t.intersectsNode(l)) {
|
|
304
|
+
const r = s(l);
|
|
305
|
+
r && n.add(r);
|
|
306
306
|
}
|
|
307
307
|
if (n.size === 0) {
|
|
308
|
-
const
|
|
309
|
-
|
|
308
|
+
const r = s(t.commonAncestorContainer);
|
|
309
|
+
r && n.add(r);
|
|
310
310
|
}
|
|
311
|
-
n.forEach((
|
|
312
|
-
|
|
311
|
+
n.forEach((r) => {
|
|
312
|
+
r.style.lineHeight = o;
|
|
313
313
|
});
|
|
314
314
|
}
|
|
315
315
|
function st(o) {
|
|
@@ -333,8 +333,8 @@ function st(o) {
|
|
|
333
333
|
} catch {
|
|
334
334
|
const n = t.extractContents(), a = document.createElement("code");
|
|
335
335
|
a.appendChild(n), t.insertNode(a);
|
|
336
|
-
const
|
|
337
|
-
|
|
336
|
+
const l = document.createRange();
|
|
337
|
+
l.selectNodeContents(a), e.removeAllRanges(), e.addRange(l);
|
|
338
338
|
}
|
|
339
339
|
}
|
|
340
340
|
}
|
|
@@ -355,8 +355,8 @@ function nt() {
|
|
|
355
355
|
if (i) {
|
|
356
356
|
const s = i.closest(".an-checklist"), n = Array.from(i.childNodes).filter((h) => !(h.nodeType === 1 && h.tagName === "INPUT")).map((h) => h.textContent).join("").replace(/\u00a0/g, " ").trim(), a = document.createElement("p");
|
|
357
357
|
a.textContent = n || " ", s.parentNode.insertBefore(a, s.nextSibling), s.removeChild(i), s.children.length === 0 && s.remove();
|
|
358
|
-
const
|
|
359
|
-
|
|
358
|
+
const l = document.createRange(), r = a.firstChild || a;
|
|
359
|
+
l.setStart(r, 0), l.collapse(!0), o.removeAllRanges(), o.addRange(l);
|
|
360
360
|
} else {
|
|
361
361
|
const s = "data-an-new-cli";
|
|
362
362
|
S(
|
|
@@ -368,10 +368,10 @@ function nt() {
|
|
|
368
368
|
n.removeAttribute(s);
|
|
369
369
|
const a = n.querySelector('input[type="checkbox"]');
|
|
370
370
|
if (a) {
|
|
371
|
-
let
|
|
372
|
-
!
|
|
373
|
-
const
|
|
374
|
-
|
|
371
|
+
let l = a.nextSibling;
|
|
372
|
+
!l || l.nodeType !== Node.TEXT_NODE ? (l = document.createTextNode(""), n.appendChild(l)) : l.textContent || (l.textContent = "");
|
|
373
|
+
const r = document.createRange();
|
|
374
|
+
r.setStart(l, 0), r.collapse(!0), o.removeAllRanges(), o.addRange(r);
|
|
375
375
|
}
|
|
376
376
|
}
|
|
377
377
|
}
|
|
@@ -382,16 +382,16 @@ function at() {
|
|
|
382
382
|
let e = o.getRangeAt(0).commonAncestorContainer;
|
|
383
383
|
return e.nodeType === 3 && (e = e.parentElement), !!(e && e.closest && e.closest(".an-checklist li"));
|
|
384
384
|
}
|
|
385
|
-
function
|
|
385
|
+
function E(o, e, t, i, s, n) {
|
|
386
386
|
return { name: o, icon: e, tooltip: t, action: i, isActive: s, isDisabled: n };
|
|
387
387
|
}
|
|
388
|
-
const lt =
|
|
388
|
+
const lt = E("bold", "bold", "Bold (Ctrl+B)", () => Ee(), () => document.queryCommandState("bold")), rt = E("italic", "italic", "Italic (Ctrl+I)", () => Re(), () => document.queryCommandState("italic")), ct = E("underline", "underline", "Underline (Ctrl+U)", () => Ae(), () => {
|
|
389
389
|
if (document.queryCommandState("underline")) return !0;
|
|
390
390
|
const o = window.getSelection();
|
|
391
391
|
if (!o || !o.rangeCount) return !1;
|
|
392
392
|
let e = o.getRangeAt(0).commonAncestorContainer;
|
|
393
393
|
return e.nodeType === 3 && (e = e.parentElement), !!(e && e.closest && e.closest("u"));
|
|
394
|
-
}), ht =
|
|
394
|
+
}), ht = E("strikethrough", "strikethrough", "Strikethrough", () => Le(), () => document.queryCommandState("strikeThrough")), dt = E("superscript", "superscript", "Superscript", () => Be(), () => document.queryCommandState("superscript")), pt = E("subscript", "subscript", "Subscript", () => Me(), () => document.queryCommandState("subscript")), ut = E("alignLeft", "align-left", "Align Left", () => Pe()), mt = E("alignCenter", "align-center", "Align Center", () => $e()), ft = E("alignRight", "align-right", "Align Right", () => Oe()), gt = E("alignJustify", "align-justify", "Justify", () => Fe()), _t = E("ul", "list-ul", "Unordered List", () => Ue()), yt = E("ol", "list-ol", "Ordered List", () => Ve()), vt = E("indent", "indent", "Indent", () => We()), bt = E("outdent", "outdent", "Outdent", () => qe()), wt = E("undo", "undo", "Undo (Ctrl+Z)", (o) => o.invoke("editor.undo"), void 0, (o) => !o.invoke("editor.canUndo")), xt = E("redo", "redo", "Redo (Ctrl+Y)", (o) => o.invoke("editor.redo"), void 0, (o) => !o.invoke("editor.canRedo")), Ct = E("hr", "minus", "Horizontal Rule", () => S("insertHorizontalRule")), kt = E("link", "link", "Insert Link", (o) => o.invoke("linkDialog.show")), Tt = E("image", "image", "Insert Image", (o) => o.invoke("imageDialog.show")), St = E("video", "video", "Insert Video", (o) => o.invoke("videoDialog.show")), It = E("emoji", "emoji", "Insert Emoji", (o) => o.invoke("emojiDialog.show")), Et = E("icon", "icon", "Insert FA Icon", (o) => o.invoke("iconDialog.show")), Rt = {
|
|
395
395
|
name: "table",
|
|
396
396
|
type: "grid",
|
|
397
397
|
icon: "table",
|
|
@@ -422,7 +422,7 @@ const lt = I("bold", "bold", "Bold (Ctrl+B)", () => Ie(), () => document.queryCo
|
|
|
422
422
|
return "";
|
|
423
423
|
}
|
|
424
424
|
}
|
|
425
|
-
}, Lt =
|
|
425
|
+
}, Lt = E("removeFormat", "remove-format", "Remove Format", () => S("removeFormat")), bs = E(
|
|
426
426
|
"direction",
|
|
427
427
|
"direction",
|
|
428
428
|
"Toggle Text Direction (LTR / RTL)",
|
|
@@ -459,7 +459,7 @@ const lt = I("bold", "bold", "Bold (Ctrl+B)", () => Ie(), () => document.queryCo
|
|
|
459
459
|
{ value: "blockquote", label: "Quote" },
|
|
460
460
|
{ value: "pre", label: "Code" }
|
|
461
461
|
],
|
|
462
|
-
action: (o, e) =>
|
|
462
|
+
action: (o, e) => De(e),
|
|
463
463
|
getValue: () => {
|
|
464
464
|
try {
|
|
465
465
|
const o = document.queryCommandValue("formatBlock").toLowerCase().replace(/[<>]/g, "");
|
|
@@ -488,7 +488,7 @@ const lt = I("bold", "bold", "Bold (Ctrl+B)", () => Ie(), () => document.queryCo
|
|
|
488
488
|
return "";
|
|
489
489
|
}
|
|
490
490
|
}
|
|
491
|
-
}, jt =
|
|
491
|
+
}, jt = E("codeview", "code", "HTML Code View", (o) => o.invoke("codeview.toggle"), (o) => o.invoke("codeview.isActive")), zt = E("fullscreen", "expand", "Fullscreen", (o) => o.invoke("fullscreen.toggle"), (o) => o.invoke("fullscreen.isActive")), Ht = E("shortcuts", "keyboard", "Keyboard Shortcuts (Ctrl+Shift+/)", (o) => o.invoke("shortcutsDialog.show")), Dt = E("find", "search", "Find (Ctrl+F)", (o) => o.invoke("findReplace.show", "find")), ws = E("findReplace", "find-replace", "Find & Replace (Ctrl+H)", (o) => o.invoke("findReplace.show", "replace")), Pt = E("inlineCode", "inline-code", "Inline Code (Ctrl+`)", (o) => o.invoke("editor.inlineCode"), () => ot()), $t = E("checklist", "checklist", "Checklist", (o) => o.invoke("editor.toggleChecklist"), () => at()), Ot = E("print", "print", "Print", (o) => o.invoke("editor.print")), Ft = {
|
|
492
492
|
name: "foreColor",
|
|
493
493
|
type: "colorpicker",
|
|
494
494
|
icon: "foreColor",
|
|
@@ -502,24 +502,24 @@ const lt = I("bold", "bold", "Bold (Ctrl+B)", () => Ie(), () => document.queryCo
|
|
|
502
502
|
tooltip: "Highlight Color",
|
|
503
503
|
defaultColor: "#fbbf24",
|
|
504
504
|
action: (o, e) => je(e)
|
|
505
|
-
},
|
|
505
|
+
}, qt = [
|
|
506
506
|
[Mt, Bt, At, Nt],
|
|
507
507
|
[wt, xt],
|
|
508
|
-
[lt, rt, ct, ht,
|
|
508
|
+
[lt, rt, ct, ht, Pt],
|
|
509
509
|
[dt, pt],
|
|
510
510
|
[Ft, Wt],
|
|
511
511
|
[ut, mt, ft, gt],
|
|
512
|
-
[
|
|
513
|
-
[Ct, kt, Tt, St, Rt,
|
|
514
|
-
[Lt, jt, zt,
|
|
515
|
-
],
|
|
512
|
+
[_t, yt, $t, vt, bt],
|
|
513
|
+
[Ct, kt, Tt, St, Rt, It, Et],
|
|
514
|
+
[Lt, jt, zt, Dt, Ot, Ht]
|
|
515
|
+
], K = {
|
|
516
516
|
placeholder: "",
|
|
517
517
|
height: 200,
|
|
518
518
|
minHeight: 100,
|
|
519
519
|
maxHeight: 0,
|
|
520
520
|
focus: !1,
|
|
521
521
|
resizable: !0,
|
|
522
|
-
toolbar:
|
|
522
|
+
toolbar: qt,
|
|
523
523
|
// UI integration options
|
|
524
524
|
// If `useBootstrap` is true, toolbar buttons will use the Bootstrap button classes
|
|
525
525
|
// (set `toolbarButtonClass` to customize). Works with Bootstrap 4 and 5.
|
|
@@ -598,7 +598,7 @@ const lt = I("bold", "bold", "Bold (Ctrl+B)", () => Ie(), () => document.queryCo
|
|
|
598
598
|
// Custom focus ring colour — overrides the default blue when set.
|
|
599
599
|
// Accepts any valid CSS colour string, e.g. '#f97316', 'hsl(25,90%,55%)'.
|
|
600
600
|
focusColor: null
|
|
601
|
-
},
|
|
601
|
+
}, ve = ["script", "style", "iframe", "object", "embed", "form", "input", "button"], Ut = ["href", "src", "action", "formaction"], Vt = /* @__PURE__ */ new Set([
|
|
602
602
|
"www.youtube.com",
|
|
603
603
|
"youtube.com",
|
|
604
604
|
"m.youtube.com",
|
|
@@ -606,9 +606,9 @@ const lt = I("bold", "bold", "Bold (Ctrl+B)", () => Ie(), () => document.queryCo
|
|
|
606
606
|
"youtube-nocookie.com",
|
|
607
607
|
"player.vimeo.com"
|
|
608
608
|
]);
|
|
609
|
-
function
|
|
609
|
+
function G(o, { allowIframes: e = !1 } = {}) {
|
|
610
610
|
const t = new DOMParser().parseFromString(`<body>${o || ""}</body>`, "text/html");
|
|
611
|
-
return (e ?
|
|
611
|
+
return (e ? ve.filter((s) => s !== "iframe") : ve).forEach((s) => {
|
|
612
612
|
t.querySelectorAll(s).forEach((n) => n.remove());
|
|
613
613
|
}), t.querySelectorAll("*").forEach((s) => {
|
|
614
614
|
Array.from(s.attributes).forEach((n) => {
|
|
@@ -616,7 +616,7 @@ function V(o, { allowIframes: e = !1 } = {}) {
|
|
|
616
616
|
s.removeAttribute(n.name);
|
|
617
617
|
return;
|
|
618
618
|
}
|
|
619
|
-
if (
|
|
619
|
+
if (Ut.includes(n.name)) {
|
|
620
620
|
const a = n.value.trim();
|
|
621
621
|
if (/^(javascript|vbscript):/i.test(a)) {
|
|
622
622
|
s.removeAttribute(n.name);
|
|
@@ -647,7 +647,7 @@ function Xt(o) {
|
|
|
647
647
|
return !1;
|
|
648
648
|
}
|
|
649
649
|
}
|
|
650
|
-
function
|
|
650
|
+
function be(o, { allowData: e = !1 } = {}) {
|
|
651
651
|
const t = (o || "").trim();
|
|
652
652
|
return /^(javascript|vbscript):/i.test(t) || !e && /^data:/i.test(t) ? null : o;
|
|
653
653
|
}
|
|
@@ -666,7 +666,7 @@ function Yt(o, e) {
|
|
|
666
666
|
s = localStorage.getItem(e.autoSaveKey) || "";
|
|
667
667
|
} catch {
|
|
668
668
|
}
|
|
669
|
-
s || (s = o.tagName === "TEXTAREA" ? (o.value || "").trim() : (o.innerHTML || "").trim()), i.innerHTML =
|
|
669
|
+
s || (s = o.tagName === "TEXTAREA" ? (o.value || "").trim() : (o.innerHTML || "").trim()), i.innerHTML = G(s, { allowIframes: !0 });
|
|
670
670
|
const n = e.defaultFontFamily || e.fontFamilies && e.fontFamilies[0];
|
|
671
671
|
return n && (i.style.fontFamily = n), e.defaultFontSize && (i.style.fontSize = e.defaultFontSize), e.height ? i.style.minHeight = `${e.height}px` : e.minHeight && (i.style.minHeight = `${e.minHeight}px`), e.maxHeight && (i.style.maxHeight = `${e.maxHeight}px`), t.appendChild(i), e.theme === "dark" && t.classList.add("an-theme-dark"), e.readOnly && t.classList.add("an-disabled"), e.direction === "rtl" && (i.setAttribute("dir", "rtl"), t.classList.add("an-dir-rtl")), e.toolbarOverflow === "scroll" && t.classList.add("an-toolbar-overflow-scroll"), e.stickyToolbar && (t.classList.add("an-sticky-toolbar"), e.stickyToolbarOffset && t.style.setProperty("--an-sticky-top", `${e.stickyToolbarOffset}px`)), e.focusColor && t.style.setProperty("--an-focus-color", e.focusColor), o.style.display = "none", o.insertAdjacentElement("afterend", t), { container: t, editable: i };
|
|
672
672
|
}
|
|
@@ -722,12 +722,12 @@ class Kt {
|
|
|
722
722
|
_restoreSelection(e) {
|
|
723
723
|
if (!e) return;
|
|
724
724
|
let t = null, i = 0, s = null, n = 0, a = 0;
|
|
725
|
-
const
|
|
726
|
-
let
|
|
727
|
-
for (;
|
|
728
|
-
const h =
|
|
729
|
-
if (!t && a + h >= e.start && (t =
|
|
730
|
-
s =
|
|
725
|
+
const l = document.createTreeWalker(this.editable, NodeFilter.SHOW_TEXT, null);
|
|
726
|
+
let r;
|
|
727
|
+
for (; r = l.nextNode(); ) {
|
|
728
|
+
const h = r.length;
|
|
729
|
+
if (!t && a + h >= e.start && (t = r, i = e.start - a), !s && a + h >= e.end) {
|
|
730
|
+
s = r, n = e.end - a;
|
|
731
731
|
break;
|
|
732
732
|
}
|
|
733
733
|
a += h;
|
|
@@ -824,22 +824,22 @@ class Kt {
|
|
|
824
824
|
function Gt(o, e, t = {}) {
|
|
825
825
|
const { headerRow: i = !1 } = t, s = c("table", { class: "an-table" });
|
|
826
826
|
if (i && e > 0) {
|
|
827
|
-
const
|
|
827
|
+
const l = c("thead"), r = c("tr");
|
|
828
828
|
for (let h = 0; h < o; h++) {
|
|
829
829
|
const p = c("th", {}, [" "]);
|
|
830
|
-
|
|
830
|
+
r.appendChild(p);
|
|
831
831
|
}
|
|
832
|
-
|
|
832
|
+
l.appendChild(r), s.appendChild(l);
|
|
833
833
|
}
|
|
834
834
|
const n = i ? Math.max(e - 1, 1) : e, a = c("tbody");
|
|
835
835
|
s.appendChild(a);
|
|
836
|
-
for (let
|
|
837
|
-
const
|
|
836
|
+
for (let l = 0; l < n; l++) {
|
|
837
|
+
const r = c("tr");
|
|
838
838
|
for (let h = 0; h < o; h++) {
|
|
839
839
|
const p = c("td", {}, [" "]);
|
|
840
|
-
|
|
840
|
+
r.appendChild(p);
|
|
841
841
|
}
|
|
842
|
-
a.appendChild(
|
|
842
|
+
a.appendChild(r);
|
|
843
843
|
}
|
|
844
844
|
return s;
|
|
845
845
|
}
|
|
@@ -847,7 +847,7 @@ function Qt(o, e, t = {}) {
|
|
|
847
847
|
const i = Gt(o, e, t);
|
|
848
848
|
S("insertHTML", i.outerHTML);
|
|
849
849
|
}
|
|
850
|
-
const
|
|
850
|
+
const W = {
|
|
851
851
|
BACKSPACE: "Backspace",
|
|
852
852
|
TAB: "Tab",
|
|
853
853
|
ENTER: "Enter",
|
|
@@ -888,152 +888,152 @@ const $ = {
|
|
|
888
888
|
SLASH: "/",
|
|
889
889
|
PERIOD: "."
|
|
890
890
|
};
|
|
891
|
-
function
|
|
891
|
+
function O(o, e) {
|
|
892
892
|
return o.key === e || o.key === e.toUpperCase();
|
|
893
893
|
}
|
|
894
|
-
function
|
|
895
|
-
return (o.ctrlKey || o.metaKey) &&
|
|
894
|
+
function H(o, e) {
|
|
895
|
+
return (o.ctrlKey || o.metaKey) && O(o, e);
|
|
896
896
|
}
|
|
897
897
|
function Zt(o, e, t = {}) {
|
|
898
898
|
const i = (a) => !!(a && a.nodeName === "I" && /\bfa-/.test(a.className || "")), s = (a) => !!(a && a.nodeType === Node.TEXT_NODE && (a.textContent === "" || a.textContent === "")), n = (a) => {
|
|
899
|
-
const
|
|
900
|
-
if (!
|
|
901
|
-
const
|
|
902
|
-
return a(
|
|
899
|
+
const l = window.getSelection();
|
|
900
|
+
if (!l) return !1;
|
|
901
|
+
const r = document.createRange();
|
|
902
|
+
return a(r), r.collapse(!0), l.removeAllRanges(), l.addRange(r), !0;
|
|
903
903
|
};
|
|
904
|
-
if (
|
|
904
|
+
if (O(o, W.BACKSPACE)) {
|
|
905
905
|
const a = window.getSelection();
|
|
906
906
|
if (a && a.rangeCount > 0) {
|
|
907
|
-
const
|
|
908
|
-
if (
|
|
909
|
-
const
|
|
910
|
-
if (
|
|
911
|
-
return o.preventDefault(),
|
|
912
|
-
if (
|
|
913
|
-
return o.preventDefault(),
|
|
907
|
+
const l = a.getRangeAt(0);
|
|
908
|
+
if (l.collapsed && l.startContainer.nodeType === Node.TEXT_NODE) {
|
|
909
|
+
const r = l.startContainer;
|
|
910
|
+
if (l.startOffset === 0 && i(r.previousSibling))
|
|
911
|
+
return o.preventDefault(), r.previousSibling.remove(), !0;
|
|
912
|
+
if (l.startOffset === 1 && r.textContent === "" && i(r.previousSibling))
|
|
913
|
+
return o.preventDefault(), r.previousSibling.remove(), r.remove(), !0;
|
|
914
914
|
}
|
|
915
915
|
}
|
|
916
916
|
return !1;
|
|
917
917
|
}
|
|
918
|
-
if (
|
|
918
|
+
if (O(o, W.LEFT) || O(o, W.RIGHT)) {
|
|
919
919
|
const a = window.getSelection();
|
|
920
920
|
if (!a || a.rangeCount === 0) return !1;
|
|
921
|
-
const
|
|
922
|
-
if (!
|
|
923
|
-
const
|
|
924
|
-
if (
|
|
925
|
-
const p =
|
|
926
|
-
if (h &&
|
|
927
|
-
return o.preventDefault(), n((
|
|
928
|
-
if (h &&
|
|
929
|
-
return o.preventDefault(), n((
|
|
930
|
-
if (h &&
|
|
931
|
-
return o.preventDefault(), n((
|
|
932
|
-
if (!h &&
|
|
933
|
-
const
|
|
934
|
-
if (o.preventDefault(),
|
|
935
|
-
const f = (
|
|
936
|
-
return n((g) => g.setStart(
|
|
921
|
+
const l = a.getRangeAt(0);
|
|
922
|
+
if (!l.collapsed) return !1;
|
|
923
|
+
const r = l.startContainer, h = O(o, W.LEFT);
|
|
924
|
+
if (r.nodeType === Node.TEXT_NODE) {
|
|
925
|
+
const p = r;
|
|
926
|
+
if (h && l.startOffset === 1 && p.textContent === "" && i(p.previousSibling))
|
|
927
|
+
return o.preventDefault(), n((u) => u.setStartBefore(p.previousSibling));
|
|
928
|
+
if (h && l.startOffset === 0 && i(p.previousSibling))
|
|
929
|
+
return o.preventDefault(), n((u) => u.setStartBefore(p.previousSibling));
|
|
930
|
+
if (h && l.startOffset === 0 && s(p.previousSibling) && i(p.previousSibling.previousSibling))
|
|
931
|
+
return o.preventDefault(), n((u) => u.setStartBefore(p.previousSibling.previousSibling));
|
|
932
|
+
if (!h && l.startOffset === p.textContent.length && i(p.nextSibling)) {
|
|
933
|
+
const u = p.nextSibling, m = u.nextSibling;
|
|
934
|
+
if (o.preventDefault(), m && m.nodeType === Node.TEXT_NODE) {
|
|
935
|
+
const f = (m.textContent || "").startsWith("") ? 1 : 0;
|
|
936
|
+
return n((g) => g.setStart(m, Math.min(f, m.textContent.length)));
|
|
937
937
|
}
|
|
938
|
-
return n((f) => f.setStartAfter(
|
|
938
|
+
return n((f) => f.setStartAfter(u));
|
|
939
939
|
}
|
|
940
|
-
if (!h &&
|
|
941
|
-
const
|
|
942
|
-
if (o.preventDefault(),
|
|
943
|
-
const f = (
|
|
944
|
-
return n((g) => g.setStart(
|
|
940
|
+
if (!h && l.startOffset === p.textContent.length && s(p.nextSibling) && i(p.nextSibling.nextSibling)) {
|
|
941
|
+
const u = p.nextSibling.nextSibling, m = u.nextSibling;
|
|
942
|
+
if (o.preventDefault(), m && m.nodeType === Node.TEXT_NODE) {
|
|
943
|
+
const f = (m.textContent || "").startsWith("") ? 1 : 0;
|
|
944
|
+
return n((g) => g.setStart(m, Math.min(f, m.textContent.length)));
|
|
945
945
|
}
|
|
946
|
-
return n((f) => f.setStartAfter(
|
|
946
|
+
return n((f) => f.setStartAfter(u));
|
|
947
947
|
}
|
|
948
948
|
}
|
|
949
|
-
if (
|
|
950
|
-
const p =
|
|
951
|
-
if (h &&
|
|
952
|
-
const
|
|
953
|
-
if (i(
|
|
954
|
-
return o.preventDefault(), n((
|
|
955
|
-
if (s(
|
|
956
|
-
return o.preventDefault(), n((
|
|
949
|
+
if (r.nodeType === Node.ELEMENT_NODE) {
|
|
950
|
+
const p = r;
|
|
951
|
+
if (h && l.startOffset > 0) {
|
|
952
|
+
const u = p.childNodes[l.startOffset - 1];
|
|
953
|
+
if (i(u))
|
|
954
|
+
return o.preventDefault(), n((m) => m.setStartBefore(u));
|
|
955
|
+
if (s(u) && i(u.previousSibling))
|
|
956
|
+
return o.preventDefault(), n((m) => m.setStartBefore(u.previousSibling));
|
|
957
957
|
}
|
|
958
|
-
if (!h &&
|
|
959
|
-
const
|
|
960
|
-
if (i(
|
|
961
|
-
const
|
|
962
|
-
if (o.preventDefault(),
|
|
963
|
-
const f = (
|
|
964
|
-
return n((g) => g.setStart(
|
|
958
|
+
if (!h && l.startOffset < p.childNodes.length) {
|
|
959
|
+
const u = p.childNodes[l.startOffset];
|
|
960
|
+
if (i(u)) {
|
|
961
|
+
const m = u.nextSibling;
|
|
962
|
+
if (o.preventDefault(), m && m.nodeType === Node.TEXT_NODE) {
|
|
963
|
+
const f = (m.textContent || "").startsWith("") ? 1 : 0;
|
|
964
|
+
return n((g) => g.setStart(m, Math.min(f, m.textContent.length)));
|
|
965
965
|
}
|
|
966
|
-
return n((f) => f.setStartAfter(
|
|
966
|
+
return n((f) => f.setStartAfter(u));
|
|
967
967
|
}
|
|
968
|
-
if (s(
|
|
969
|
-
const
|
|
968
|
+
if (s(u) && i(u.nextSibling)) {
|
|
969
|
+
const m = u.nextSibling, f = m.nextSibling;
|
|
970
970
|
if (o.preventDefault(), f && f.nodeType === Node.TEXT_NODE) {
|
|
971
971
|
const g = (f.textContent || "").startsWith("") ? 1 : 0;
|
|
972
|
-
return n((
|
|
972
|
+
return n((v) => v.setStart(f, Math.min(g, f.textContent.length)));
|
|
973
973
|
}
|
|
974
|
-
return n((g) => g.setStartAfter(
|
|
974
|
+
return n((g) => g.setStartAfter(m));
|
|
975
975
|
}
|
|
976
976
|
}
|
|
977
977
|
}
|
|
978
978
|
}
|
|
979
|
-
if (
|
|
980
|
-
const a =
|
|
979
|
+
if (O(o, W.TAB)) {
|
|
980
|
+
const a = ye(e);
|
|
981
981
|
if (!a) return !1;
|
|
982
|
-
const
|
|
983
|
-
if (
|
|
982
|
+
const l = _e(a.sc, e);
|
|
983
|
+
if (l && et(l))
|
|
984
984
|
return o.preventDefault(), o.shiftKey ? S("outdent") : S("indent"), !0;
|
|
985
|
-
if (
|
|
985
|
+
if (l && l.nodeName.toUpperCase() === "PRE")
|
|
986
986
|
return o.shiftKey ? !1 : (o.preventDefault(), S("insertText", " "), !0);
|
|
987
987
|
if (t.tabSize)
|
|
988
988
|
return o.shiftKey ? !1 : (o.preventDefault(), S("insertText", " ".repeat(t.tabSize)), !0);
|
|
989
989
|
}
|
|
990
|
-
if (
|
|
990
|
+
if (O(o, W.ENTER) && o.shiftKey)
|
|
991
991
|
return o.preventDefault(), S("insertLineBreak"), !0;
|
|
992
|
-
if (
|
|
993
|
-
const a =
|
|
992
|
+
if (O(o, W.ENTER) && !o.shiftKey) {
|
|
993
|
+
const a = ye(e);
|
|
994
994
|
if (!a) return !1;
|
|
995
|
-
const
|
|
996
|
-
if (
|
|
997
|
-
const
|
|
998
|
-
|
|
995
|
+
const l = a.sc, r = l.nodeType === 3 ? l.parentElement : l;
|
|
996
|
+
if (r && r.nodeName === "I" && /\bfa-/.test(r.className || "")) {
|
|
997
|
+
const m = document.createRange();
|
|
998
|
+
m.setStartAfter(r), m.collapse(!0);
|
|
999
999
|
const f = window.getSelection();
|
|
1000
|
-
return f && (f.removeAllRanges(), f.addRange(
|
|
1000
|
+
return f && (f.removeAllRanges(), f.addRange(m)), !1;
|
|
1001
1001
|
}
|
|
1002
|
-
const h =
|
|
1002
|
+
const h = r && r.closest && r.closest(".an-video-wrapper");
|
|
1003
1003
|
if (h) {
|
|
1004
1004
|
o.preventDefault();
|
|
1005
|
-
const
|
|
1006
|
-
|
|
1005
|
+
const m = document.createElement("p");
|
|
1006
|
+
m.innerHTML = " ", h.parentNode.insertBefore(m, h.nextSibling);
|
|
1007
1007
|
const f = document.createRange();
|
|
1008
|
-
f.setStart(
|
|
1008
|
+
f.setStart(m, 0), f.collapse(!0);
|
|
1009
1009
|
const g = window.getSelection();
|
|
1010
1010
|
return g.removeAllRanges(), g.addRange(f), !0;
|
|
1011
1011
|
}
|
|
1012
|
-
const p =
|
|
1012
|
+
const p = r && r.closest && r.closest(".an-checklist li");
|
|
1013
1013
|
if (p) {
|
|
1014
1014
|
o.preventDefault();
|
|
1015
|
-
const
|
|
1015
|
+
const m = p.closest(".an-checklist"), f = window.getSelection();
|
|
1016
1016
|
let g = f.getRangeAt(0);
|
|
1017
|
-
if (!((
|
|
1018
|
-
const
|
|
1019
|
-
|
|
1020
|
-
const
|
|
1021
|
-
return
|
|
1017
|
+
if (!((y) => Array.from(y.childNodes).filter((I) => !(I.nodeType === 1 && I.tagName === "INPUT")).map((I) => I.textContent).join("").replace(/[\u00a0\u200B]/g, " ").trim())(p)) {
|
|
1018
|
+
const y = document.createElement("p");
|
|
1019
|
+
y.innerHTML = " ", m.parentNode.insertBefore(y, m.nextSibling), p.remove(), m.children.length === 0 && m.remove();
|
|
1020
|
+
const I = document.createRange();
|
|
1021
|
+
return I.setStart(y.firstChild, 0), I.collapse(!0), f.removeAllRanges(), f.addRange(I), !0;
|
|
1022
1022
|
}
|
|
1023
1023
|
g.collapsed || (g.deleteContents(), g = f.getRangeAt(0));
|
|
1024
1024
|
const C = document.createRange();
|
|
1025
1025
|
C.setStart(g.startContainer, g.startOffset), C.setEnd(p, p.childNodes.length);
|
|
1026
|
-
const T = C.extractContents(),
|
|
1027
|
-
|
|
1028
|
-
let
|
|
1029
|
-
(!
|
|
1030
|
-
const
|
|
1031
|
-
return
|
|
1026
|
+
const T = C.extractContents(), k = document.createElement("li"), b = document.createElement("input");
|
|
1027
|
+
b.type = "checkbox", b.setAttribute("contenteditable", "false"), k.appendChild(b), T.textContent.replace(/[\u00a0\u200B]/g, "").length > 0 && k.appendChild(T);
|
|
1028
|
+
let w = k.childNodes[1];
|
|
1029
|
+
(!w || w.nodeType !== Node.TEXT_NODE) && (w = document.createTextNode(""), k.appendChild(w)), p.insertAdjacentElement("afterend", k);
|
|
1030
|
+
const _ = document.createRange();
|
|
1031
|
+
return _.setStart(w, 0), _.collapse(!0), f.removeAllRanges(), f.addRange(_), !0;
|
|
1032
1032
|
}
|
|
1033
|
-
const
|
|
1034
|
-
if (
|
|
1035
|
-
const
|
|
1036
|
-
if (
|
|
1033
|
+
const u = _e(a.sc, e);
|
|
1034
|
+
if (u && u.nodeName.toUpperCase() === "BLOCKQUOTE") {
|
|
1035
|
+
const m = a.toNativeRange();
|
|
1036
|
+
if (m.setEnd(u, u.childNodes.length), m.toString() === "" && a.isCollapsed())
|
|
1037
1037
|
return o.preventDefault(), S("formatBlock", "<p>"), !0;
|
|
1038
1038
|
}
|
|
1039
1039
|
}
|
|
@@ -1169,22 +1169,22 @@ ${i.map((s, n) => `${n + 1}. ${le(s).trim()}`).join(`
|
|
|
1169
1169
|
const i = Array.from(o.querySelectorAll("tr"));
|
|
1170
1170
|
if (!i.length) return t();
|
|
1171
1171
|
const s = i.map(
|
|
1172
|
-
(
|
|
1173
|
-
), n = Math.max(...s.map((
|
|
1174
|
-
const h = [...
|
|
1172
|
+
(r) => Array.from(r.querySelectorAll("th, td")).map((h) => h.textContent.trim().replace(/\|/g, "\\|"))
|
|
1173
|
+
), n = Math.max(...s.map((r) => r.length)), a = (r) => {
|
|
1174
|
+
const h = [...r];
|
|
1175
1175
|
for (; h.length < n; ) h.push("");
|
|
1176
1176
|
return h;
|
|
1177
1177
|
};
|
|
1178
|
-
let
|
|
1178
|
+
let l = `
|
|
1179
1179
|
|
|
1180
1180
|
`;
|
|
1181
|
-
|
|
1182
|
-
`,
|
|
1181
|
+
l += `| ${a(s[0]).join(" | ")} |
|
|
1182
|
+
`, l += `| ${Array(n).fill("---").join(" | ")} |
|
|
1183
1183
|
`;
|
|
1184
|
-
for (let
|
|
1185
|
-
|
|
1184
|
+
for (let r = 1; r < s.length; r++)
|
|
1185
|
+
l += `| ${a(s[r]).join(" | ")} |
|
|
1186
1186
|
`;
|
|
1187
|
-
return
|
|
1187
|
+
return l + `
|
|
1188
1188
|
`;
|
|
1189
1189
|
}
|
|
1190
1190
|
default:
|
|
@@ -1203,10 +1203,10 @@ function Xe(o) {
|
|
|
1203
1203
|
for (; i < e.length; ) {
|
|
1204
1204
|
const s = e[i], n = s.match(/^```(\S*)$/);
|
|
1205
1205
|
if (n) {
|
|
1206
|
-
const
|
|
1206
|
+
const r = n[1], h = [];
|
|
1207
1207
|
for (i++; i < e.length && !e[i].startsWith("```"); )
|
|
1208
1208
|
h.push(P(e[i])), i++;
|
|
1209
|
-
const p =
|
|
1209
|
+
const p = r ? ` class="language-${re(r)}"` : "";
|
|
1210
1210
|
t.push(`<pre><code${p}>${h.join(`
|
|
1211
1211
|
`)}</code></pre>`), i++;
|
|
1212
1212
|
continue;
|
|
@@ -1217,29 +1217,29 @@ function Xe(o) {
|
|
|
1217
1217
|
}
|
|
1218
1218
|
const a = s.match(/^(#{1,6})\s+(.+)$/);
|
|
1219
1219
|
if (a) {
|
|
1220
|
-
const
|
|
1221
|
-
t.push(`<h${
|
|
1220
|
+
const r = a[1].length;
|
|
1221
|
+
t.push(`<h${r}>${V(a[2])}</h${r}>`), i++;
|
|
1222
1222
|
continue;
|
|
1223
1223
|
}
|
|
1224
1224
|
if (s.startsWith("> ")) {
|
|
1225
|
-
const
|
|
1225
|
+
const r = [];
|
|
1226
1226
|
for (; i < e.length && e[i].startsWith("> "); )
|
|
1227
|
-
|
|
1228
|
-
t.push(`<blockquote>${
|
|
1227
|
+
r.push(e[i].slice(2)), i++;
|
|
1228
|
+
t.push(`<blockquote>${r.map(V).join("<br>")}</blockquote>`);
|
|
1229
1229
|
continue;
|
|
1230
1230
|
}
|
|
1231
1231
|
if (/^[-*+] /.test(s)) {
|
|
1232
|
-
const
|
|
1232
|
+
const r = [];
|
|
1233
1233
|
for (; i < e.length && /^[-*+] /.test(e[i]); )
|
|
1234
|
-
|
|
1235
|
-
t.push(`<ul>${
|
|
1234
|
+
r.push(`<li>${V(e[i].slice(2))}</li>`), i++;
|
|
1235
|
+
t.push(`<ul>${r.join("")}</ul>`);
|
|
1236
1236
|
continue;
|
|
1237
1237
|
}
|
|
1238
1238
|
if (/^\d+\. /.test(s)) {
|
|
1239
|
-
const
|
|
1239
|
+
const r = [];
|
|
1240
1240
|
for (; i < e.length && /^\d+\. /.test(e[i]); )
|
|
1241
|
-
|
|
1242
|
-
t.push(`<ol>${
|
|
1241
|
+
r.push(`<li>${V(e[i].replace(/^\d+\. /, ""))}</li>`), i++;
|
|
1242
|
+
t.push(`<ol>${r.join("")}</ol>`);
|
|
1243
1243
|
continue;
|
|
1244
1244
|
}
|
|
1245
1245
|
if (s.trim() === "") {
|
|
@@ -1247,26 +1247,26 @@ function Xe(o) {
|
|
|
1247
1247
|
continue;
|
|
1248
1248
|
}
|
|
1249
1249
|
if (/^\|.+\|/.test(s) && i + 1 < e.length && /^\|[\s|:-]+\|/.test(e[i + 1])) {
|
|
1250
|
-
const
|
|
1250
|
+
const r = we(s);
|
|
1251
1251
|
i += 2;
|
|
1252
1252
|
const h = [];
|
|
1253
1253
|
for (; i < e.length && /^\|.+\|/.test(e[i]); )
|
|
1254
1254
|
h.push(we(e[i])), i++;
|
|
1255
|
-
const p = `<thead><tr>${
|
|
1256
|
-
t.push(`<table>${p}${
|
|
1255
|
+
const p = `<thead><tr>${r.map((m) => `<th>${V(m)}</th>`).join("")}</tr></thead>`, u = h.length ? `<tbody>${h.map((m) => `<tr>${m.map((f) => `<td>${V(f)}</td>`).join("")}</tr>`).join("")}</tbody>` : "";
|
|
1256
|
+
t.push(`<table>${p}${u}</table>`);
|
|
1257
1257
|
continue;
|
|
1258
1258
|
}
|
|
1259
|
-
const
|
|
1259
|
+
const l = [];
|
|
1260
1260
|
for (; i < e.length && e[i].trim() !== "" && !/^(#{1,6} |> |[-*+] |\d+\. |```|---\s*$|\*{3}\s*$|_{3}\s*$)/.test(e[i]) && !/^\|.+\|/.test(e[i]); )
|
|
1261
|
-
|
|
1262
|
-
|
|
1261
|
+
l.push(e[i]), i++;
|
|
1262
|
+
l.length && t.push(`<p>${V(l.join(" "))}</p>`);
|
|
1263
1263
|
}
|
|
1264
1264
|
return t.join("");
|
|
1265
1265
|
}
|
|
1266
1266
|
function we(o) {
|
|
1267
1267
|
return o.replace(/^\|/, "").replace(/\|$/, "").split("|").map((e) => e.trim());
|
|
1268
1268
|
}
|
|
1269
|
-
function
|
|
1269
|
+
function V(o) {
|
|
1270
1270
|
return o = o.replace(/!\[([^\]]*)\]\(([^)]+)\)/g, (e, t, i) => `<img src="${re(i)}" alt="${re(t)}" class="an-image">`), o = o.replace(/\[([^\]]+)\]\(([^)]+)\)/g, (e, t, i) => `<a href="${re(i)}">${P(t)}</a>`), o = o.replace(/\*{3}(.+?)\*{3}/g, (e, t) => `<strong><em>${P(t)}</em></strong>`), o = o.replace(/_{3}(.+?)_{3}/g, (e, t) => `<strong><em>${P(t)}</em></strong>`), o = o.replace(/\*{2}(.+?)\*{2}/g, (e, t) => `<strong>${P(t)}</strong>`), o = o.replace(/_{2}(.+?)_{2}/g, (e, t) => `<strong>${P(t)}</strong>`), o = o.replace(/\*([^*\n]+?)\*/g, (e, t) => `<em>${P(t)}</em>`), o = o.replace(/_([^_\n]+?)_/g, (e, t) => `<em>${P(t)}</em>`), o = o.replace(/~~(.+?)~~/g, (e, t) => `<del>${P(t)}</del>`), o = o.replace(/`([^`]+)`/g, (e, t) => `<code>${P(t)}</code>`), o;
|
|
1271
1271
|
}
|
|
1272
1272
|
function P(o) {
|
|
@@ -1296,44 +1296,44 @@ class ti {
|
|
|
1296
1296
|
// Event binding
|
|
1297
1297
|
// ---------------------------------------------------------------------------
|
|
1298
1298
|
_bindEvents(e) {
|
|
1299
|
-
const t = (
|
|
1299
|
+
const t = (r) => this._onKeydown(r), i = () => this.afterCommand(), s = (r) => this._enforceLimit(r), n = () => {
|
|
1300
1300
|
if (!this.context._alive) return;
|
|
1301
|
-
const
|
|
1302
|
-
|
|
1303
|
-
}, a = (
|
|
1304
|
-
|
|
1305
|
-
},
|
|
1301
|
+
const r = window.getSelection();
|
|
1302
|
+
r && r.rangeCount > 0 && e.contains(r.anchorNode) && (this.context.invoke("toolbar.refresh"), typeof this.options.onSelectionChange == "function" && this.options.onSelectionChange(this.context));
|
|
1303
|
+
}, a = (r) => {
|
|
1304
|
+
r.target.type === "checkbox" && r.target.closest(".an-checklist") && this.afterCommand();
|
|
1305
|
+
}, l = (r) => {
|
|
1306
1306
|
const h = window.getSelection();
|
|
1307
1307
|
if (!h || !h.rangeCount) return;
|
|
1308
1308
|
const p = h.getRangeAt(0);
|
|
1309
1309
|
if (!p.collapsed) return;
|
|
1310
|
-
const
|
|
1311
|
-
if (
|
|
1312
|
-
const
|
|
1313
|
-
if (!
|
|
1314
|
-
const f =
|
|
1310
|
+
const u = p.startContainer;
|
|
1311
|
+
if (u.nodeType !== Node.ELEMENT_NODE) return;
|
|
1312
|
+
const m = u.matches && u.matches(".an-checklist li") ? u : null;
|
|
1313
|
+
if (!m) return;
|
|
1314
|
+
const f = m.querySelector('input[type="checkbox"]');
|
|
1315
1315
|
if (!f) return;
|
|
1316
|
-
if (
|
|
1316
|
+
if (r && r.type === "mouseup") {
|
|
1317
1317
|
let C = null;
|
|
1318
1318
|
if (document.caretRangeFromPoint)
|
|
1319
|
-
C = document.caretRangeFromPoint(
|
|
1319
|
+
C = document.caretRangeFromPoint(r.clientX, r.clientY);
|
|
1320
1320
|
else if (document.caretPositionFromPoint) {
|
|
1321
|
-
const T = document.caretPositionFromPoint(
|
|
1321
|
+
const T = document.caretPositionFromPoint(r.clientX, r.clientY);
|
|
1322
1322
|
T && (C = document.createRange(), C.setStart(T.offsetNode, T.offset));
|
|
1323
1323
|
}
|
|
1324
|
-
if (C && e.contains(C.startContainer) && C.startContainer !==
|
|
1324
|
+
if (C && e.contains(C.startContainer) && C.startContainer !== m) {
|
|
1325
1325
|
C.collapse(!0), h.removeAllRanges(), h.addRange(C);
|
|
1326
1326
|
return;
|
|
1327
1327
|
}
|
|
1328
1328
|
}
|
|
1329
1329
|
const g = document.createRange();
|
|
1330
|
-
let
|
|
1331
|
-
for (const C of
|
|
1330
|
+
let v = null;
|
|
1331
|
+
for (const C of m.childNodes)
|
|
1332
1332
|
if (C !== f && C.nodeType === Node.TEXT_NODE) {
|
|
1333
|
-
|
|
1333
|
+
v = C;
|
|
1334
1334
|
break;
|
|
1335
1335
|
}
|
|
1336
|
-
|
|
1336
|
+
v ? g.setStart(v, 0) : g.setStartAfter(f), g.collapse(!0), h.removeAllRanges(), h.addRange(g);
|
|
1337
1337
|
};
|
|
1338
1338
|
this._disposers.push(
|
|
1339
1339
|
d(e, "keydown", t),
|
|
@@ -1341,38 +1341,38 @@ class ti {
|
|
|
1341
1341
|
d(e, "input", i),
|
|
1342
1342
|
d(document, "selectionchange", n),
|
|
1343
1343
|
d(e, "click", a),
|
|
1344
|
-
d(e, "mouseup",
|
|
1345
|
-
d(e, "keyup",
|
|
1344
|
+
d(e, "mouseup", l),
|
|
1345
|
+
d(e, "keyup", l)
|
|
1346
1346
|
);
|
|
1347
1347
|
}
|
|
1348
1348
|
_onKeydown(e) {
|
|
1349
1349
|
const t = this.context.layoutInfo.editable;
|
|
1350
1350
|
if (!Zt(e, t, this.options)) {
|
|
1351
|
-
if (
|
|
1351
|
+
if (H(e, "z") && !e.shiftKey) {
|
|
1352
1352
|
e.preventDefault(), this.undo();
|
|
1353
1353
|
return;
|
|
1354
1354
|
}
|
|
1355
|
-
if (
|
|
1355
|
+
if (H(e, "z") && e.shiftKey || H(e, "y")) {
|
|
1356
1356
|
e.preventDefault(), this.redo();
|
|
1357
1357
|
return;
|
|
1358
1358
|
}
|
|
1359
|
-
if (
|
|
1359
|
+
if (H(e, "b")) {
|
|
1360
1360
|
e.preventDefault(), this.bold();
|
|
1361
1361
|
return;
|
|
1362
1362
|
}
|
|
1363
|
-
if (
|
|
1363
|
+
if (H(e, "i")) {
|
|
1364
1364
|
e.preventDefault(), this.italic();
|
|
1365
1365
|
return;
|
|
1366
1366
|
}
|
|
1367
|
-
if (
|
|
1367
|
+
if (H(e, "u")) {
|
|
1368
1368
|
e.preventDefault(), this.underline();
|
|
1369
1369
|
return;
|
|
1370
1370
|
}
|
|
1371
|
-
if (
|
|
1371
|
+
if (H(e, "k")) {
|
|
1372
1372
|
e.preventDefault(), this.context.invoke("linkDialog.show");
|
|
1373
1373
|
return;
|
|
1374
1374
|
}
|
|
1375
|
-
if (
|
|
1375
|
+
if (H(e, "v") && e.shiftKey) {
|
|
1376
1376
|
this.context.invoke("clipboard.setForcePlain", !0);
|
|
1377
1377
|
return;
|
|
1378
1378
|
}
|
|
@@ -1380,11 +1380,11 @@ class ti {
|
|
|
1380
1380
|
e.preventDefault(), this.context.invoke("shortcutsDialog.show");
|
|
1381
1381
|
return;
|
|
1382
1382
|
}
|
|
1383
|
-
if (
|
|
1383
|
+
if (H(e, "f")) {
|
|
1384
1384
|
e.preventDefault(), this.context.invoke("findReplace.show", "find");
|
|
1385
1385
|
return;
|
|
1386
1386
|
}
|
|
1387
|
-
|
|
1387
|
+
H(e, "h") && (e.preventDefault(), this.context.invoke("findReplace.show", "replace")), H(e, "`") && (e.preventDefault(), this.inlineCode());
|
|
1388
1388
|
}
|
|
1389
1389
|
}
|
|
1390
1390
|
// ---------------------------------------------------------------------------
|
|
@@ -1444,7 +1444,7 @@ class ti {
|
|
|
1444
1444
|
* @param {string} html - HTML string (will be sanitised)
|
|
1445
1445
|
*/
|
|
1446
1446
|
setHTML(e) {
|
|
1447
|
-
this.context.layoutInfo.editable.innerHTML =
|
|
1447
|
+
this.context.layoutInfo.editable.innerHTML = G(e), this._history && this._history.reset(), this.afterCommand();
|
|
1448
1448
|
}
|
|
1449
1449
|
/**
|
|
1450
1450
|
* Returns the editor plain text content.
|
|
@@ -1485,7 +1485,7 @@ class ti {
|
|
|
1485
1485
|
* @param {string} html
|
|
1486
1486
|
*/
|
|
1487
1487
|
insertHTML(e) {
|
|
1488
|
-
e && (S("insertHTML",
|
|
1488
|
+
e && (S("insertHTML", G(e)), this.afterCommand());
|
|
1489
1489
|
}
|
|
1490
1490
|
/**
|
|
1491
1491
|
* Inserts plain text at the current cursor position.
|
|
@@ -1527,7 +1527,7 @@ class ti {
|
|
|
1527
1527
|
// Style commands (delegated to Style module)
|
|
1528
1528
|
// ---------------------------------------------------------------------------
|
|
1529
1529
|
bold() {
|
|
1530
|
-
|
|
1530
|
+
Ee(), this.afterCommand();
|
|
1531
1531
|
}
|
|
1532
1532
|
italic() {
|
|
1533
1533
|
Re(), this.afterCommand();
|
|
@@ -1545,7 +1545,7 @@ class ti {
|
|
|
1545
1545
|
Me(), this.afterCommand();
|
|
1546
1546
|
}
|
|
1547
1547
|
justifyLeft() {
|
|
1548
|
-
|
|
1548
|
+
Pe(), this.afterCommand();
|
|
1549
1549
|
}
|
|
1550
1550
|
justifyCenter() {
|
|
1551
1551
|
$e(), this.afterCommand();
|
|
@@ -1560,10 +1560,10 @@ class ti {
|
|
|
1560
1560
|
We(), this.afterCommand();
|
|
1561
1561
|
}
|
|
1562
1562
|
outdent() {
|
|
1563
|
-
|
|
1563
|
+
qe(), this.afterCommand();
|
|
1564
1564
|
}
|
|
1565
1565
|
insertUL() {
|
|
1566
|
-
|
|
1566
|
+
Ue(), this.afterCommand();
|
|
1567
1567
|
}
|
|
1568
1568
|
insertOL() {
|
|
1569
1569
|
Ve(), this.afterCommand();
|
|
@@ -1581,7 +1581,7 @@ class ti {
|
|
|
1581
1581
|
* @param {string} tagName - e.g. 'h1', 'p', 'blockquote'
|
|
1582
1582
|
*/
|
|
1583
1583
|
formatBlock(e) {
|
|
1584
|
-
|
|
1584
|
+
De(e), this.afterCommand();
|
|
1585
1585
|
}
|
|
1586
1586
|
/**
|
|
1587
1587
|
* @param {string} color
|
|
@@ -1625,16 +1625,16 @@ class ti {
|
|
|
1625
1625
|
insertLink(e, t, i = !1) {
|
|
1626
1626
|
const s = window.getSelection();
|
|
1627
1627
|
if (!s || s.rangeCount === 0) return;
|
|
1628
|
-
const n =
|
|
1628
|
+
const n = be(e);
|
|
1629
1629
|
if (!n) return;
|
|
1630
1630
|
if (s.toString().trim().length > 0) {
|
|
1631
1631
|
if (S("createLink", n), i) {
|
|
1632
|
-
const
|
|
1633
|
-
|
|
1632
|
+
const l = this._getClosestAnchor();
|
|
1633
|
+
l && (l.setAttribute("target", "_blank"), l.setAttribute("rel", "noopener noreferrer"));
|
|
1634
1634
|
}
|
|
1635
1635
|
} else {
|
|
1636
|
-
const
|
|
1637
|
-
S("insertHTML", `<a href="${this._escapeAttr(n)}"${i ? ' target="_blank" rel="noopener noreferrer"' : ""}>${
|
|
1636
|
+
const l = this._escapeAttr(t || n);
|
|
1637
|
+
S("insertHTML", `<a href="${this._escapeAttr(n)}"${i ? ' target="_blank" rel="noopener noreferrer"' : ""}>${l}</a>`);
|
|
1638
1638
|
}
|
|
1639
1639
|
this.afterCommand();
|
|
1640
1640
|
}
|
|
@@ -1650,14 +1650,14 @@ class ti {
|
|
|
1650
1650
|
* @param {string} [alt]
|
|
1651
1651
|
*/
|
|
1652
1652
|
insertImage(e, t = "", i = "") {
|
|
1653
|
-
const s =
|
|
1653
|
+
const s = be(e, { allowData: !0 });
|
|
1654
1654
|
if (!s) return;
|
|
1655
1655
|
const a = {
|
|
1656
1656
|
left: "float:left;margin:0 1em 1em 0",
|
|
1657
1657
|
center: "display:block;margin:0 auto",
|
|
1658
1658
|
right: "float:right;margin:0 0 1em 1em"
|
|
1659
|
-
}[i] || "",
|
|
1660
|
-
S("insertHTML", `<img src="${this._escapeAttr(s)}" alt="${this._escapeAttr(t)}" class="an-image"${
|
|
1659
|
+
}[i] || "", l = a ? ` style="${a}"` : "";
|
|
1660
|
+
S("insertHTML", `<img src="${this._escapeAttr(s)}" alt="${this._escapeAttr(t)}" class="an-image"${l}>`), this.afterCommand();
|
|
1661
1661
|
}
|
|
1662
1662
|
/**
|
|
1663
1663
|
* Inserts a video embed (iframe or <video> element).
|
|
@@ -1733,7 +1733,7 @@ class ii {
|
|
|
1733
1733
|
* @returns {HTMLDivElement}
|
|
1734
1734
|
*/
|
|
1735
1735
|
_createGridPicker(e) {
|
|
1736
|
-
const s = c("div", { class: "an-table-picker-wrap" }), a = !!this.options.useBootstrap ? this.options.toolbarButtonClass || "btn btn-sm btn-light" : "an-btn",
|
|
1736
|
+
const s = c("div", { class: "an-table-picker-wrap" }), a = !!this.options.useBootstrap ? this.options.toolbarButtonClass || "btn btn-sm btn-light" : "an-btn", l = c("button", {
|
|
1737
1737
|
type: "button",
|
|
1738
1738
|
class: a,
|
|
1739
1739
|
title: e.tooltip || "",
|
|
@@ -1743,53 +1743,53 @@ class ii {
|
|
|
1743
1743
|
"aria-expanded": "false"
|
|
1744
1744
|
});
|
|
1745
1745
|
if (this._faReady) {
|
|
1746
|
-
const
|
|
1747
|
-
|
|
1746
|
+
const _ = this.options.fontAwesomeClass || "fas";
|
|
1747
|
+
l.innerHTML = `<i class="${_} fa-table" aria-hidden="true"></i>`;
|
|
1748
1748
|
} else {
|
|
1749
|
-
const
|
|
1750
|
-
|
|
1749
|
+
const _ = 'stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"';
|
|
1750
|
+
l.innerHTML = `<svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="none" ${_} style="display:block"><rect x="3" y="3" width="18" height="18" rx="1"/><line x1="3" y1="9" x2="21" y2="9"/><line x1="3" y1="15" x2="21" y2="15"/><line x1="9" y1="3" x2="9" y2="21"/><line x1="15" y1="3" x2="15" y2="21"/></svg>`;
|
|
1751
1751
|
}
|
|
1752
|
-
const
|
|
1752
|
+
const r = c("div", {
|
|
1753
1753
|
class: "an-table-picker-popup",
|
|
1754
1754
|
role: "dialog",
|
|
1755
1755
|
"aria-label": "Select table size"
|
|
1756
1756
|
}), h = c("div", { class: "an-table-grid" }), p = c("div", { class: "an-table-label" });
|
|
1757
1757
|
p.textContent = "Insert Table";
|
|
1758
|
-
const
|
|
1759
|
-
for (let
|
|
1760
|
-
for (let
|
|
1761
|
-
const
|
|
1758
|
+
const u = [];
|
|
1759
|
+
for (let _ = 1; _ <= 10; _++)
|
|
1760
|
+
for (let y = 1; y <= 10; y++) {
|
|
1761
|
+
const I = c("div", {
|
|
1762
1762
|
class: "an-table-cell",
|
|
1763
|
-
"data-row": String(
|
|
1764
|
-
"data-col": String(
|
|
1763
|
+
"data-row": String(_),
|
|
1764
|
+
"data-col": String(y)
|
|
1765
1765
|
});
|
|
1766
|
-
|
|
1766
|
+
u.push(I), h.appendChild(I);
|
|
1767
1767
|
}
|
|
1768
|
-
|
|
1769
|
-
let
|
|
1770
|
-
const f = (
|
|
1771
|
-
|
|
1772
|
-
const
|
|
1773
|
-
|
|
1774
|
-
}), p.textContent =
|
|
1768
|
+
r.appendChild(h), r.appendChild(p);
|
|
1769
|
+
let m = !1;
|
|
1770
|
+
const f = (_, y) => {
|
|
1771
|
+
u.forEach((I) => {
|
|
1772
|
+
const R = +I.getAttribute("data-row"), B = +I.getAttribute("data-col");
|
|
1773
|
+
I.classList.toggle("active", R <= _ && B <= y);
|
|
1774
|
+
}), p.textContent = _ && y ? `${_} × ${y}` : "Insert Table";
|
|
1775
1775
|
}, g = () => {
|
|
1776
|
-
|
|
1777
|
-
},
|
|
1778
|
-
|
|
1779
|
-
}, C = d(
|
|
1780
|
-
|
|
1781
|
-
}), T = d(h, "mouseover", (
|
|
1782
|
-
const
|
|
1783
|
-
|
|
1784
|
-
}),
|
|
1785
|
-
const
|
|
1786
|
-
if (!
|
|
1787
|
-
const
|
|
1788
|
-
|
|
1789
|
-
}),
|
|
1790
|
-
|
|
1776
|
+
m = !0, r.style.display = "block", l.setAttribute("aria-expanded", "true");
|
|
1777
|
+
}, v = () => {
|
|
1778
|
+
m = !1, r.style.display = "none", l.setAttribute("aria-expanded", "false"), f(0, 0);
|
|
1779
|
+
}, C = d(l, "click", (_) => {
|
|
1780
|
+
_.stopPropagation(), m ? v() : g();
|
|
1781
|
+
}), T = d(h, "mouseover", (_) => {
|
|
1782
|
+
const y = _.target.closest(".an-table-cell");
|
|
1783
|
+
y && f(+y.getAttribute("data-row"), +y.getAttribute("data-col"));
|
|
1784
|
+
}), k = d(h, "mouseleave", () => f(0, 0)), b = d(h, "click", (_) => {
|
|
1785
|
+
const y = _.target.closest(".an-table-cell");
|
|
1786
|
+
if (!y) return;
|
|
1787
|
+
const I = +y.getAttribute("data-row"), R = +y.getAttribute("data-col");
|
|
1788
|
+
v(), this.context.invoke("editor.focus"), e.action(this.context, I, R);
|
|
1789
|
+
}), w = d(document, "click", () => {
|
|
1790
|
+
m && v();
|
|
1791
1791
|
});
|
|
1792
|
-
return this._disposers.push(C, T,
|
|
1792
|
+
return this._disposers.push(C, T, k, b, w), s.appendChild(l), s.appendChild(r), s;
|
|
1793
1793
|
}
|
|
1794
1794
|
/**
|
|
1795
1795
|
* Creates a split color-picker widget:
|
|
@@ -1828,89 +1828,89 @@ class ii {
|
|
|
1828
1828
|
"#ead1dc"
|
|
1829
1829
|
];
|
|
1830
1830
|
let i = e.defaultColor || "#000000";
|
|
1831
|
-
const s = c("div", { class: "an-color-picker-wrap" }), a = !!this.options.useBootstrap ? this.options.toolbarButtonClass || "btn btn-sm btn-light" : "an-btn",
|
|
1831
|
+
const s = c("div", { class: "an-color-picker-wrap" }), a = !!this.options.useBootstrap ? this.options.toolbarButtonClass || "btn btn-sm btn-light" : "an-btn", l = c("button", {
|
|
1832
1832
|
type: "button",
|
|
1833
1833
|
class: `${a} an-color-btn`,
|
|
1834
1834
|
title: e.tooltip || "",
|
|
1835
1835
|
"data-btn": e.name,
|
|
1836
1836
|
"aria-label": e.tooltip || e.name
|
|
1837
|
-
}),
|
|
1838
|
-
|
|
1837
|
+
}), r = 'stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"', h = e.name === "foreColor" ? `<svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="none" ${r} style="display:block"><path d="M4 20L12 4L20 20"/><line x1="7.5" y1="14" x2="16.5" y2="14"/></svg>` : `<svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="none" ${r} style="display:block"><path d="M3 21v-4l9-9 4 4-9 9z"/><path d="M12 8l4 4"/></svg>`;
|
|
1838
|
+
l.innerHTML = h;
|
|
1839
1839
|
const p = c("span", { class: "an-color-strip" });
|
|
1840
|
-
p.style.background = i,
|
|
1841
|
-
const
|
|
1840
|
+
p.style.background = i, l.appendChild(p);
|
|
1841
|
+
const u = c("button", {
|
|
1842
1842
|
type: "button",
|
|
1843
1843
|
class: `${a} an-color-arrow`,
|
|
1844
1844
|
title: `Choose ${e.name === "foreColor" ? "text" : "highlight"} color`,
|
|
1845
1845
|
"aria-haspopup": "true",
|
|
1846
1846
|
"aria-expanded": "false"
|
|
1847
1847
|
});
|
|
1848
|
-
|
|
1849
|
-
const
|
|
1850
|
-
|
|
1848
|
+
u.innerHTML = '<svg xmlns="http://www.w3.org/2000/svg" width="8" height="8" viewBox="0 0 24 24" fill="currentColor" stroke="none" style="display:block"><path d="M7 10l5 5 5-5H7z"/></svg>';
|
|
1849
|
+
const m = c("div", { class: "an-color-popup" });
|
|
1850
|
+
m.style.display = "none";
|
|
1851
1851
|
const f = c("div", { class: "an-color-swatches" }), g = Array.isArray(this.options.colorSwatches) ? this.options.colorSwatches : [];
|
|
1852
1852
|
[.../* @__PURE__ */ new Set([...g, ...t])].forEach((x) => {
|
|
1853
|
-
const
|
|
1854
|
-
|
|
1853
|
+
const A = c("div", { class: "an-color-swatch", title: x, "data-color": x });
|
|
1854
|
+
A.style.background = x, f.appendChild(A);
|
|
1855
1855
|
});
|
|
1856
|
-
const C = c("div", { class: "an-color-custom" }), T = c("input", { type: "color", value: i, title: "Custom color" }),
|
|
1857
|
-
C.appendChild(T), C.appendChild(
|
|
1858
|
-
let
|
|
1859
|
-
const
|
|
1856
|
+
const C = c("div", { class: "an-color-custom" }), T = c("input", { type: "color", value: i, title: "Custom color" }), k = c("span", {}, ["Custom color"]);
|
|
1857
|
+
C.appendChild(T), C.appendChild(k), m.appendChild(f), m.appendChild(C);
|
|
1858
|
+
let b = !1, w = null;
|
|
1859
|
+
const _ = () => {
|
|
1860
1860
|
const x = window.getSelection();
|
|
1861
|
-
|
|
1862
|
-
},
|
|
1863
|
-
if (!
|
|
1861
|
+
w = x && x.rangeCount ? x.getRangeAt(0).cloneRange() : null;
|
|
1862
|
+
}, y = () => {
|
|
1863
|
+
if (!w) return;
|
|
1864
1864
|
const x = window.getSelection();
|
|
1865
|
-
x && (x.removeAllRanges(), x.addRange(
|
|
1866
|
-
},
|
|
1865
|
+
x && (x.removeAllRanges(), x.addRange(w));
|
|
1866
|
+
}, I = () => {
|
|
1867
1867
|
this._colorPickerClosers.forEach((se) => {
|
|
1868
|
-
se !==
|
|
1869
|
-
}),
|
|
1870
|
-
const x =
|
|
1871
|
-
let
|
|
1872
|
-
|
|
1873
|
-
},
|
|
1874
|
-
|
|
1875
|
-
},
|
|
1876
|
-
i = x, p.style.background = x, T.value = x,
|
|
1877
|
-
},
|
|
1878
|
-
x.preventDefault(),
|
|
1879
|
-
}),
|
|
1868
|
+
se !== R && se();
|
|
1869
|
+
}), _(), b = !0;
|
|
1870
|
+
const x = u.getBoundingClientRect(), A = 184;
|
|
1871
|
+
let M = x.left;
|
|
1872
|
+
M + A > window.innerWidth && (M = x.right - A), m.style.top = `${x.bottom + 4}px`, m.style.left = `${Math.max(4, M)}px`, m.style.display = "block", u.setAttribute("aria-expanded", "true");
|
|
1873
|
+
}, R = () => {
|
|
1874
|
+
b = !1, m.style.display = "none", m.style.top = "", m.style.left = "", u.setAttribute("aria-expanded", "false");
|
|
1875
|
+
}, B = (x) => {
|
|
1876
|
+
i = x, p.style.background = x, T.value = x, y(), e.action(this.context, x), this.context.invoke("editor.afterCommand"), R();
|
|
1877
|
+
}, L = d(l, "click", (x) => {
|
|
1878
|
+
x.preventDefault(), y(), e.action(this.context, i), this.context.invoke("editor.afterCommand");
|
|
1879
|
+
}), F = d(u, "mousedown", (x) => {
|
|
1880
1880
|
x.preventDefault();
|
|
1881
|
-
}),
|
|
1882
|
-
x.stopPropagation(),
|
|
1883
|
-
}),
|
|
1881
|
+
}), q = d(u, "click", (x) => {
|
|
1882
|
+
x.stopPropagation(), b ? R() : I();
|
|
1883
|
+
}), U = d(f, "mousedown", (x) => {
|
|
1884
1884
|
x.preventDefault();
|
|
1885
|
-
}),
|
|
1886
|
-
const
|
|
1887
|
-
|
|
1885
|
+
}), z = d(f, "click", (x) => {
|
|
1886
|
+
const A = x.target.closest(".an-color-swatch");
|
|
1887
|
+
A && B(A.dataset.color);
|
|
1888
1888
|
}), ce = d(T, "change", (x) => {
|
|
1889
|
-
|
|
1889
|
+
B(x.target.value);
|
|
1890
1890
|
}), he = d(document, "click", (x) => {
|
|
1891
|
-
|
|
1892
|
-
}), de = d(
|
|
1893
|
-
|
|
1891
|
+
b && !s.contains(x.target) && !m.contains(x.target) && R();
|
|
1892
|
+
}), de = d(m, "click", (x) => x.stopPropagation()), Z = () => {
|
|
1893
|
+
b && R();
|
|
1894
1894
|
};
|
|
1895
|
-
return document.addEventListener("scroll",
|
|
1896
|
-
|
|
1897
|
-
|
|
1898
|
-
|
|
1899
|
-
|
|
1900
|
-
|
|
1895
|
+
return document.addEventListener("scroll", Z, { passive: !0, capture: !0 }), window.addEventListener("resize", Z, { passive: !0 }), this._disposers.push(
|
|
1896
|
+
L,
|
|
1897
|
+
F,
|
|
1898
|
+
q,
|
|
1899
|
+
U,
|
|
1900
|
+
z,
|
|
1901
1901
|
ce,
|
|
1902
1902
|
he,
|
|
1903
1903
|
de,
|
|
1904
|
-
() => document.removeEventListener("scroll",
|
|
1905
|
-
() => window.removeEventListener("resize",
|
|
1904
|
+
() => document.removeEventListener("scroll", Z, { capture: !0 }),
|
|
1905
|
+
() => window.removeEventListener("resize", Z),
|
|
1906
1906
|
// Remove popup from body on editor destroy
|
|
1907
1907
|
() => {
|
|
1908
|
-
|
|
1908
|
+
m.parentNode && m.parentNode.removeChild(m);
|
|
1909
1909
|
}
|
|
1910
|
-
), this._colorPickerClosers.push(
|
|
1911
|
-
const x = this._colorPickerClosers.indexOf(
|
|
1910
|
+
), this._colorPickerClosers.push(R), this._disposers.push(() => {
|
|
1911
|
+
const x = this._colorPickerClosers.indexOf(R);
|
|
1912
1912
|
x !== -1 && this._colorPickerClosers.splice(x, 1);
|
|
1913
|
-
}), s.appendChild(
|
|
1913
|
+
}), s.appendChild(l), s.appendChild(u), document.body.appendChild(m), s;
|
|
1914
1914
|
}
|
|
1915
1915
|
/**
|
|
1916
1916
|
* Creates a <select> dropdown for font-family (or similar) options.
|
|
@@ -1924,17 +1924,17 @@ class ii {
|
|
|
1924
1924
|
"data-btn": e.name,
|
|
1925
1925
|
"aria-label": e.tooltip || e.name
|
|
1926
1926
|
}), n = e.placeholder || "Font", a = c("option", { value: "", disabled: "", hidden: "" }, [n]);
|
|
1927
|
-
s.appendChild(a), t.forEach((
|
|
1928
|
-
const h = typeof
|
|
1929
|
-
|
|
1930
|
-
const f = c("option",
|
|
1931
|
-
e.name === "fontFamily" && !
|
|
1927
|
+
s.appendChild(a), t.forEach((r) => {
|
|
1928
|
+
const h = typeof r == "object" ? r.value : r, p = typeof r == "object" ? r.label : r, u = typeof r == "object" && !!r.disabled, m = { value: h };
|
|
1929
|
+
u && (m.disabled = "");
|
|
1930
|
+
const f = c("option", m, [p]);
|
|
1931
|
+
e.name === "fontFamily" && !u && (f.style.fontFamily = h), s.appendChild(f);
|
|
1932
1932
|
});
|
|
1933
|
-
const
|
|
1934
|
-
const h =
|
|
1933
|
+
const l = d(s, "change", (r) => {
|
|
1934
|
+
const h = r.target.value, p = r.target.options[r.target.selectedIndex];
|
|
1935
1935
|
!h || p.disabled || (this.context.invoke("editor.focus"), e.action(this.context, h), this.context.invoke("editor.afterCommand"));
|
|
1936
1936
|
});
|
|
1937
|
-
return this._disposers.push(
|
|
1937
|
+
return this._disposers.push(l), s;
|
|
1938
1938
|
}
|
|
1939
1939
|
/**
|
|
1940
1940
|
* @param {import('./Buttons.js').ButtonDef} btnDef
|
|
@@ -1947,51 +1947,51 @@ class ii {
|
|
|
1947
1947
|
title: e.tooltip || "",
|
|
1948
1948
|
"data-btn": e.name,
|
|
1949
1949
|
"aria-label": e.tooltip || e.name
|
|
1950
|
-
}),
|
|
1950
|
+
}), l = 'stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"', r = (g) => `<svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="none" ${l} style="display:block">${g}</svg>`, h = /* @__PURE__ */ new Map([
|
|
1951
1951
|
// Format
|
|
1952
|
-
["bold",
|
|
1953
|
-
["italic",
|
|
1954
|
-
["underline",
|
|
1955
|
-
["strikethrough",
|
|
1956
|
-
["superscript",
|
|
1957
|
-
["subscript",
|
|
1952
|
+
["bold", r('<path d="M6 4h8a4 4 0 0 1 4 4 4 4 0 0 1-4 4H6z"/><path d="M6 12h9a4 4 0 0 1 4 4 4 4 0 0 1-4 4H6z"/>')],
|
|
1953
|
+
["italic", r('<line x1="19" y1="4" x2="10" y2="4"/><line x1="14" y1="20" x2="5" y2="20"/><line x1="15" y1="4" x2="9" y2="20"/>')],
|
|
1954
|
+
["underline", r('<path d="M6 3v7a6 6 0 0 0 6 6 6 6 0 0 0 6-6V3"/><line x1="4" y1="21" x2="20" y2="21"/>')],
|
|
1955
|
+
["strikethrough", r('<path d="M17.3 12H6.7"/><path d="M10 6.5C10 5.1 11.1 4 12.5 4c1.4 0 2.5 1.1 2.5 2.5 0 .8-.4 1.5-1 2"/><path d="M14 17.5C14 19 12.9 20 11.5 20 10.1 20 9 18.9 9 17.5c0-.8.4-1.5 1-2"/>')],
|
|
1956
|
+
["superscript", r('<path d="m4 19 8-8"/><path d="m12 19-8-8"/><path d="M20 12h-4c0-1.5.44-2 1.5-2.5S20 8.33 20 7.25C20 6 19 5 17.5 5S15 6 15 7"/>')],
|
|
1957
|
+
["subscript", r('<path d="m4 5 8 8"/><path d="m12 5-8 8"/><path d="M20 21h-4c0-1.5.44-2 1.5-2.5S20 17.33 20 16.25C20 15 19 14 17.5 14S15 15 15 16"/>')],
|
|
1958
1958
|
// Alignment
|
|
1959
|
-
["align-left",
|
|
1960
|
-
["align-center",
|
|
1961
|
-
["align-right",
|
|
1962
|
-
["align-justify",
|
|
1959
|
+
["align-left", r('<line x1="21" y1="6" x2="3" y2="6"/><line x1="15" y1="12" x2="3" y2="12"/><line x1="17" y1="18" x2="3" y2="18"/>')],
|
|
1960
|
+
["align-center", r('<line x1="21" y1="6" x2="3" y2="6"/><line x1="18" y1="12" x2="6" y2="12"/><line x1="21" y1="18" x2="3" y2="18"/>')],
|
|
1961
|
+
["align-right", r('<line x1="21" y1="6" x2="3" y2="6"/><line x1="21" y1="12" x2="9" y2="12"/><line x1="21" y1="18" x2="7" y2="18"/>')],
|
|
1962
|
+
["align-justify", r('<line x1="21" y1="6" x2="3" y2="6"/><line x1="21" y1="12" x2="3" y2="12"/><line x1="21" y1="18" x2="3" y2="18"/>')],
|
|
1963
1963
|
// Lists
|
|
1964
|
-
["list-ul",
|
|
1965
|
-
["list-ol",
|
|
1966
|
-
["indent",
|
|
1967
|
-
["outdent",
|
|
1964
|
+
["list-ul", r('<line x1="9" y1="6" x2="20" y2="6"/><line x1="9" y1="12" x2="20" y2="12"/><line x1="9" y1="18" x2="20" y2="18"/><circle cx="4" cy="6" r="1" fill="currentColor" stroke="none"/><circle cx="4" cy="12" r="1" fill="currentColor" stroke="none"/><circle cx="4" cy="18" r="1" fill="currentColor" stroke="none"/>')],
|
|
1965
|
+
["list-ol", r('<line x1="10" y1="6" x2="21" y2="6"/><line x1="10" y1="12" x2="21" y2="12"/><line x1="10" y1="18" x2="21" y2="18"/><path d="M4 6h1V3"/><path d="M4 10h2l-2 2h2"/><path d="M4 16.5A1.5 1.5 0 0 1 5.5 15a1.5 1.5 0 0 1 0 3H4"/>')],
|
|
1966
|
+
["indent", r('<polyline points="3 8 7 12 3 16"/><line x1="21" y1="12" x2="11" y2="12"/><line x1="21" y1="6" x2="11" y2="6"/><line x1="21" y1="18" x2="11" y2="18"/>')],
|
|
1967
|
+
["outdent", r('<polyline points="7 8 3 12 7 16"/><line x1="21" y1="12" x2="11" y2="12"/><line x1="21" y1="6" x2="11" y2="6"/><line x1="21" y1="18" x2="11" y2="18"/>')],
|
|
1968
1968
|
// History
|
|
1969
|
-
["undo",
|
|
1970
|
-
["redo",
|
|
1969
|
+
["undo", r('<path d="M3 7v6h6"/><path d="M21 17a9 9 0 0 0-9-9 9 9 0 0 0-6 2.3L3 13"/>')],
|
|
1970
|
+
["redo", r('<path d="M21 7v6h-6"/><path d="M3 17a9 9 0 0 1 9-9 9 9 0 0 1 6 2.3L21 13"/>')],
|
|
1971
1971
|
// Insert
|
|
1972
|
-
["minus",
|
|
1973
|
-
["link",
|
|
1974
|
-
["image",
|
|
1975
|
-
["video",
|
|
1976
|
-
["table",
|
|
1977
|
-
["emoji",
|
|
1978
|
-
["icon",
|
|
1972
|
+
["minus", r('<line x1="5" y1="12" x2="19" y2="12"/>')],
|
|
1973
|
+
["link", r('<path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"/><path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"/>')],
|
|
1974
|
+
["image", r('<rect x="3" y="3" width="18" height="18" rx="2"/><circle cx="8.5" cy="8.5" r="1.5"/><polyline points="21 15 16 10 5 21"/>')],
|
|
1975
|
+
["video", r('<polygon points="23 7 16 12 23 17 23 7"/><rect x="1" y="5" width="15" height="14" rx="2"/>')],
|
|
1976
|
+
["table", r('<rect x="3" y="3" width="18" height="18" rx="1"/><line x1="3" y1="9" x2="21" y2="9"/><line x1="3" y1="15" x2="21" y2="15"/><line x1="9" y1="3" x2="9" y2="21"/><line x1="15" y1="3" x2="15" y2="21"/>')],
|
|
1977
|
+
["emoji", r('<circle cx="12" cy="12" r="10"/><path d="M8.5 14.5s1.5 2.5 3.5 2.5 3.5-2.5 3.5-2.5"/><circle cx="9" cy="9" r="1.5" fill="currentColor" stroke="none"/><circle cx="15" cy="9" r="1.5" fill="currentColor" stroke="none"/>')],
|
|
1978
|
+
["icon", r('<circle cx="8" cy="8" r="3"/><circle cx="16" cy="8" r="3"/><rect x="5" y="13" width="6" height="6" rx="1"/><rect x="13" y="13" width="6" height="6" rx="1"/>')],
|
|
1979
1979
|
// View
|
|
1980
|
-
["code",
|
|
1981
|
-
["expand",
|
|
1980
|
+
["code", r('<polyline points="16 18 22 12 16 6"/><polyline points="8 6 2 12 8 18"/>')],
|
|
1981
|
+
["expand", r('<polyline points="15 3 21 3 21 9"/><polyline points="9 21 3 21 3 15"/><line x1="21" y1="3" x2="14" y2="10"/><line x1="3" y1="21" x2="10" y2="14"/>')],
|
|
1982
1982
|
// Color pickers
|
|
1983
|
-
["foreColor",
|
|
1984
|
-
["backColor",
|
|
1985
|
-
["keyboard",
|
|
1986
|
-
["caption",
|
|
1987
|
-
["remove-format",
|
|
1988
|
-
["direction",
|
|
1989
|
-
["search",
|
|
1990
|
-
["find-replace",
|
|
1991
|
-
["inline-code",
|
|
1992
|
-
["checklist",
|
|
1993
|
-
["print",
|
|
1994
|
-
]), p = this.options.fontAwesomeClass || "fas",
|
|
1983
|
+
["foreColor", r('<path d="M4 20L12 4L20 20"/><line x1="7.5" y1="14" x2="16.5" y2="14"/>')],
|
|
1984
|
+
["backColor", r('<path d="M3 21v-4l9-9 4 4-9 9z"/><path d="M12 8l4 4"/>')],
|
|
1985
|
+
["keyboard", r('<rect x="2" y="6" width="20" height="12" rx="2"/><line x1="6" y1="10" x2="6" y2="10" stroke-width="2.5"/><line x1="10" y1="10" x2="10" y2="10" stroke-width="2.5"/><line x1="14" y1="10" x2="14" y2="10" stroke-width="2.5"/><line x1="18" y1="10" x2="18" y2="10" stroke-width="2.5"/><line x1="8" y1="14" x2="16" y2="14" stroke-width="2"/>')],
|
|
1986
|
+
["caption", r('<rect x="3" y="3" width="18" height="11" rx="2"/><line x1="6" y1="18" x2="18" y2="18"/><line x1="9" y1="21" x2="15" y2="21"/>')],
|
|
1987
|
+
["remove-format", r('<path d="m7 21-4.3-4.3c-1-1-1-2.5 0-3.4l9.6-9.6c1-1 2.5-1 3.4 0l5.6 5.6c1 1 1 2.5 0 3.4L13 21"/><path d="M22 21H7"/><path d="m5 11 9 9"/>')],
|
|
1988
|
+
["direction", r('<path d="M12 20V4"/><path d="m9 7-3 3 3 3"/><path d="M4 10h8"/><path d="m15 7 3 3-3 3"/><path d="M20 10h-8"/>')],
|
|
1989
|
+
["search", r('<circle cx="11" cy="11" r="7"/><line x1="21" y1="21" x2="16.65" y2="16.65"/>')],
|
|
1990
|
+
["find-replace", r('<circle cx="10" cy="10" r="6"/><line x1="18" y1="18" x2="14.35" y2="14.35"/><path d="M16 19h6"/><path d="M19 16v6"/>')],
|
|
1991
|
+
["inline-code", r('<path d="M8 3H7a2 2 0 0 0-2 2v5a2 2 0 0 1-2 2 2 2 0 0 1 2 2v5c0 1.1.9 2 2 2h1"/><path d="M16 3h1a2 2 0 0 1 2 2v5c0 1.1.9 2 2 2a2 2 0 0 1-2 2v5a2 2 0 0 1-2 2h-1"/>')],
|
|
1992
|
+
["checklist", r('<rect x="3" y="4" width="5" height="5" rx="1"/><path d="m4 6.5 1 1 2-2"/><rect x="3" y="13" width="5" height="5" rx="1"/><line x1="10" y1="6.5" x2="21" y2="6.5"/><line x1="10" y1="15.5" x2="21" y2="15.5"/>')],
|
|
1993
|
+
["print", r('<path d="M6 9V2h12v7"/><path d="M6 18H4a2 2 0 0 1-2-2v-5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v5a2 2 0 0 1-2 2h-2"/><rect x="6" y="14" width="12" height="8"/>')]
|
|
1994
|
+
]), p = this.options.fontAwesomeClass || "fas", u = /* @__PURE__ */ new Map([
|
|
1995
1995
|
["bold", "fa-bold"],
|
|
1996
1996
|
["italic", "fa-italic"],
|
|
1997
1997
|
["underline", "fa-underline"],
|
|
@@ -2027,7 +2027,7 @@ class ii {
|
|
|
2027
2027
|
["print", "fa-print"]
|
|
2028
2028
|
]);
|
|
2029
2029
|
if (this._faReady) {
|
|
2030
|
-
const g =
|
|
2030
|
+
const g = u.get(e.icon) || u.get(e.name) || null;
|
|
2031
2031
|
g ? a.innerHTML = `<i class="${p} ${g}" aria-hidden="true"></i>` : h.has(e.icon) ? a.innerHTML = h.get(e.icon) : a.textContent = e.icon || e.name;
|
|
2032
2032
|
} else
|
|
2033
2033
|
h.has(e.icon) ? a.innerHTML = h.get(e.icon) : h.has(e.name) ? a.innerHTML = h.get(e.name) : a.textContent = e.icon || e.name;
|
|
@@ -2131,28 +2131,28 @@ class si {
|
|
|
2131
2131
|
_bindResize(e) {
|
|
2132
2132
|
let t = 0, i = 0;
|
|
2133
2133
|
const s = this.context.layoutInfo.container, n = (g) => {
|
|
2134
|
-
const
|
|
2135
|
-
s.style.height = `${Math.max(
|
|
2136
|
-
}, a = (g) => n(g.clientY),
|
|
2137
|
-
document.removeEventListener("mousemove", a), document.removeEventListener("mouseup",
|
|
2138
|
-
},
|
|
2139
|
-
t = g.clientY, i = s.offsetHeight, this.context.layoutInfo.editable.style.minHeight = "", document.addEventListener("mousemove", a), document.addEventListener("mouseup",
|
|
2134
|
+
const v = g - t, C = 40, T = Array.from(s.children).filter((b) => !b.classList.contains("an-editable")).reduce((b, w) => b + w.offsetHeight, 0), k = Math.max(this.options.minHeight || 100, T + C);
|
|
2135
|
+
s.style.height = `${Math.max(k, i + v)}px`;
|
|
2136
|
+
}, a = (g) => n(g.clientY), l = () => {
|
|
2137
|
+
document.removeEventListener("mousemove", a), document.removeEventListener("mouseup", l), this._dragDisposers = null;
|
|
2138
|
+
}, r = (g) => {
|
|
2139
|
+
t = g.clientY, i = s.offsetHeight, this.context.layoutInfo.editable.style.minHeight = "", document.addEventListener("mousemove", a), document.addEventListener("mouseup", l), this._dragDisposers = [
|
|
2140
2140
|
() => document.removeEventListener("mousemove", a),
|
|
2141
|
-
() => document.removeEventListener("mouseup",
|
|
2141
|
+
() => document.removeEventListener("mouseup", l)
|
|
2142
2142
|
], g.preventDefault();
|
|
2143
2143
|
}, h = (g) => {
|
|
2144
|
-
const
|
|
2145
|
-
|
|
2144
|
+
const v = g.touches[0];
|
|
2145
|
+
v && (g.preventDefault(), n(v.clientY));
|
|
2146
2146
|
}, p = () => {
|
|
2147
2147
|
document.removeEventListener("touchmove", h), document.removeEventListener("touchend", p), this._dragDisposers = null;
|
|
2148
|
-
},
|
|
2149
|
-
const
|
|
2150
|
-
|
|
2148
|
+
}, u = (g) => {
|
|
2149
|
+
const v = g.touches[0];
|
|
2150
|
+
v && (t = v.clientY, i = s.offsetHeight, this.context.layoutInfo.editable.style.minHeight = "", document.addEventListener("touchmove", h, { passive: !1 }), document.addEventListener("touchend", p), this._dragDisposers = [
|
|
2151
2151
|
() => document.removeEventListener("touchmove", h),
|
|
2152
2152
|
() => document.removeEventListener("touchend", p)
|
|
2153
2153
|
]);
|
|
2154
|
-
},
|
|
2155
|
-
this._disposers.push(
|
|
2154
|
+
}, m = d(e, "mousedown", r), f = d(e, "touchstart", u);
|
|
2155
|
+
this._disposers.push(m, f);
|
|
2156
2156
|
}
|
|
2157
2157
|
// ---------------------------------------------------------------------------
|
|
2158
2158
|
// Counter update
|
|
@@ -2305,7 +2305,7 @@ class oi {
|
|
|
2305
2305
|
const s = t.getData("text/plain");
|
|
2306
2306
|
if (s && ei(s)) {
|
|
2307
2307
|
e.preventDefault();
|
|
2308
|
-
const n =
|
|
2308
|
+
const n = G(Xe(s));
|
|
2309
2309
|
S("insertHTML", n), this.context.invoke("editor.afterCommand");
|
|
2310
2310
|
return;
|
|
2311
2311
|
}
|
|
@@ -2313,8 +2313,8 @@ class oi {
|
|
|
2313
2313
|
if (this.options.pasteCleanHTML !== !1 && t.types.includes("text/html")) {
|
|
2314
2314
|
e.preventDefault();
|
|
2315
2315
|
const s = t.getData("text/html"), n = /<[a-z]+:[a-z]/i.test(s) || /class="Mso/i.test(s) || /\bmso-/i.test(s), a = /\bdata-testid\b/.test(s) || /class="[^"]*\b(?:x[a-z0-9]{6,}|r-[a-z0-9]{3,})\b/.test(s);
|
|
2316
|
-
let
|
|
2317
|
-
n ?
|
|
2316
|
+
let l = s;
|
|
2317
|
+
n ? l = this._cleanWordHtml(l) : a && (l = this._cleanSocialHtml(l)), l = G(l), this.options.pasteStripAttributes && (l = this._stripAttributes(l)), S("insertHTML", l), this.context.invoke("editor.afterCommand");
|
|
2318
2318
|
return;
|
|
2319
2319
|
}
|
|
2320
2320
|
}
|
|
@@ -2356,12 +2356,12 @@ class oi {
|
|
|
2356
2356
|
}
|
|
2357
2357
|
const s = i.name.replace(/\.[^.]+$/, "");
|
|
2358
2358
|
this._compressImage(i).then((n) => {
|
|
2359
|
-
const a = this._dataUrlToBlob(n),
|
|
2360
|
-
this._blobRegistry.set(
|
|
2359
|
+
const a = this._dataUrlToBlob(n), l = URL.createObjectURL(a);
|
|
2360
|
+
this._blobRegistry.set(l, n), this.context.invoke("editor.insertImage", l, s);
|
|
2361
2361
|
}).catch((n) => {
|
|
2362
|
-
var
|
|
2362
|
+
var l;
|
|
2363
2363
|
const a = `Image "${i.name}" could not be processed.`;
|
|
2364
|
-
this.context.triggerEvent("imageError", { file: i, message: a, error: n }), (typeof process > "u" || ((
|
|
2364
|
+
this.context.triggerEvent("imageError", { file: i, message: a, error: n }), (typeof process > "u" || ((l = process.env) == null ? void 0 : l.NODE_ENV) !== "production") && console.warn("[AutumnNote]", a, n);
|
|
2365
2365
|
});
|
|
2366
2366
|
});
|
|
2367
2367
|
}
|
|
@@ -2381,7 +2381,7 @@ class oi {
|
|
|
2381
2381
|
*/
|
|
2382
2382
|
_dataUrlToBlob(e) {
|
|
2383
2383
|
const [t, i] = e.split(","), s = t.match(/:(.*?);/)[1], n = atob(i), a = new Uint8Array(n.length);
|
|
2384
|
-
for (let
|
|
2384
|
+
for (let l = 0; l < n.length; l++) a[l] = n.charCodeAt(l);
|
|
2385
2385
|
return new Blob([a], { type: s });
|
|
2386
2386
|
}
|
|
2387
2387
|
/**
|
|
@@ -2397,29 +2397,29 @@ class oi {
|
|
|
2397
2397
|
const n = URL.createObjectURL(e), a = new Image();
|
|
2398
2398
|
a.onload = () => {
|
|
2399
2399
|
URL.revokeObjectURL(n);
|
|
2400
|
-
let { width:
|
|
2401
|
-
(
|
|
2400
|
+
let { width: l, height: r } = a;
|
|
2401
|
+
(l > 1920 || r > 1920) && (l >= r ? (r = Math.round(r * 1920 / l), l = 1920) : (l = Math.round(l * 1920 / r), r = 1920));
|
|
2402
2402
|
const h = document.createElement("canvas");
|
|
2403
|
-
h.width =
|
|
2403
|
+
h.width = l, h.height = r;
|
|
2404
2404
|
const p = h.getContext("2d");
|
|
2405
2405
|
if (!p) {
|
|
2406
|
-
const
|
|
2407
|
-
|
|
2406
|
+
const m = new FileReader();
|
|
2407
|
+
m.onload = (f) => s(
|
|
2408
2408
|
/** @type {string} */
|
|
2409
2409
|
f.target.result
|
|
2410
|
-
),
|
|
2410
|
+
), m.readAsDataURL(e);
|
|
2411
2411
|
return;
|
|
2412
2412
|
}
|
|
2413
|
-
p.drawImage(a, 0, 0,
|
|
2414
|
-
const
|
|
2415
|
-
s(
|
|
2413
|
+
p.drawImage(a, 0, 0, l, r);
|
|
2414
|
+
const u = h.toDataURL("image/webp", 0.85);
|
|
2415
|
+
s(u.startsWith("data:image/webp") ? u : h.toDataURL("image/jpeg", 0.85));
|
|
2416
2416
|
}, a.onerror = () => {
|
|
2417
2417
|
URL.revokeObjectURL(n);
|
|
2418
|
-
const
|
|
2419
|
-
|
|
2418
|
+
const l = new FileReader();
|
|
2419
|
+
l.onload = (r) => s(
|
|
2420
2420
|
/** @type {string} */
|
|
2421
|
-
|
|
2422
|
-
),
|
|
2421
|
+
r.target.result
|
|
2422
|
+
), l.readAsDataURL(e);
|
|
2423
2423
|
}, a.src = n;
|
|
2424
2424
|
});
|
|
2425
2425
|
}
|
|
@@ -2510,7 +2510,7 @@ class ai {
|
|
|
2510
2510
|
deactivate() {
|
|
2511
2511
|
if (!this._active || !this._textarea) return;
|
|
2512
2512
|
const { editable: e } = this.context.layoutInfo;
|
|
2513
|
-
e.innerHTML =
|
|
2513
|
+
e.innerHTML = G(this._textarea.value, { allowIframes: !0 }), this._textarea.parentNode.removeChild(this._textarea), this._textarea = null, e.style.display = "", this._active = !1, this.context.invoke("toolbar.refresh"), this.context.invoke("editor.afterCommand");
|
|
2514
2514
|
}
|
|
2515
2515
|
// ---------------------------------------------------------------------------
|
|
2516
2516
|
// Helpers
|
|
@@ -2526,8 +2526,8 @@ class ai {
|
|
|
2526
2526
|
const t = /^<(a|abbr|b|bdo|br|button|cite|code|dfn|em|i|img|input|kbd|label|output|q|samp|select|small|span|strong|sub|sup|textarea|time|tt|u|var)([\s>/])/i;
|
|
2527
2527
|
let i = 0;
|
|
2528
2528
|
return e.replace(/>\s*</g, (s, n, a) => {
|
|
2529
|
-
const
|
|
2530
|
-
return t.test(
|
|
2529
|
+
const l = a.slice(n + 1);
|
|
2530
|
+
return t.test(l.trimStart()) ? "><" : `>
|
|
2531
2531
|
<`;
|
|
2532
2532
|
}).split(`
|
|
2533
2533
|
`).map((s) => {
|
|
@@ -2549,7 +2549,7 @@ class li {
|
|
|
2549
2549
|
}
|
|
2550
2550
|
initialize() {
|
|
2551
2551
|
const e = d(document, "keydown", (t) => {
|
|
2552
|
-
this._active &&
|
|
2552
|
+
this._active && O(t, W.ESCAPE) && this.deactivate();
|
|
2553
2553
|
});
|
|
2554
2554
|
return this._disposers.push(e), this;
|
|
2555
2555
|
}
|
|
@@ -2623,7 +2623,7 @@ class ri {
|
|
|
2623
2623
|
this._urlInput = n;
|
|
2624
2624
|
const a = c("label", { class: "an-label" });
|
|
2625
2625
|
a.textContent = "Display Text";
|
|
2626
|
-
const
|
|
2626
|
+
const l = c("input", {
|
|
2627
2627
|
type: "text",
|
|
2628
2628
|
class: "an-input",
|
|
2629
2629
|
placeholder: "Link text",
|
|
@@ -2631,25 +2631,25 @@ class ri {
|
|
|
2631
2631
|
name: "linkText",
|
|
2632
2632
|
autocomplete: "off"
|
|
2633
2633
|
});
|
|
2634
|
-
this._textInput =
|
|
2635
|
-
const
|
|
2634
|
+
this._textInput = l;
|
|
2635
|
+
const r = c("label", { class: "an-label an-label-inline" }), h = c("input", {
|
|
2636
2636
|
type: "checkbox",
|
|
2637
2637
|
id: "an-link-newtab",
|
|
2638
2638
|
name: "openInNewTab"
|
|
2639
2639
|
});
|
|
2640
|
-
this._tabCheckbox = h,
|
|
2641
|
-
const p = c("div", { class: "an-dialog-actions" }),
|
|
2642
|
-
|
|
2643
|
-
const
|
|
2644
|
-
|
|
2645
|
-
const f = d(
|
|
2646
|
-
|
|
2647
|
-
}), C = d(n, "keydown", (
|
|
2648
|
-
|
|
2649
|
-
}), T = d(
|
|
2650
|
-
|
|
2640
|
+
this._tabCheckbox = h, r.appendChild(h), r.appendChild(document.createTextNode(" Open in new tab"));
|
|
2641
|
+
const p = c("div", { class: "an-dialog-actions" }), u = c("button", { type: "button", class: "an-btn an-btn-primary" });
|
|
2642
|
+
u.textContent = "Insert";
|
|
2643
|
+
const m = c("button", { type: "button", class: "an-btn" });
|
|
2644
|
+
m.textContent = "Cancel", p.appendChild(u), p.appendChild(m), t.append(i, s, n, a, l, r, p), e.appendChild(t);
|
|
2645
|
+
const f = d(u, "click", () => this._onInsert()), g = d(m, "click", () => this._close()), v = d(e, "click", (k) => {
|
|
2646
|
+
k.target === e && this._close();
|
|
2647
|
+
}), C = d(n, "keydown", (k) => {
|
|
2648
|
+
k.key === "Enter" && (k.preventDefault(), this._onInsert());
|
|
2649
|
+
}), T = d(l, "keydown", (k) => {
|
|
2650
|
+
k.key === "Enter" && (k.preventDefault(), this._onInsert());
|
|
2651
2651
|
});
|
|
2652
|
-
return this._disposers.push(f, g,
|
|
2652
|
+
return this._disposers.push(f, g, v, C, T), e;
|
|
2653
2653
|
}
|
|
2654
2654
|
// ---------------------------------------------------------------------------
|
|
2655
2655
|
// Actions
|
|
@@ -2690,7 +2690,7 @@ class ri {
|
|
|
2690
2690
|
this._savedRange && this._savedRange.select(), this.context.invoke("editor.insertLink", e, t, i), this._close();
|
|
2691
2691
|
}
|
|
2692
2692
|
_open() {
|
|
2693
|
-
this._dialog && (this._dialog.style.display = "flex", this._removeTrap =
|
|
2693
|
+
this._dialog && (this._dialog.style.display = "flex", this._removeTrap = Q(this._dialog, () => this._close()), setTimeout(() => this._urlInput && this._urlInput.focus(), 50));
|
|
2694
2694
|
}
|
|
2695
2695
|
_close() {
|
|
2696
2696
|
this._dialog && (this._dialog.style.display = "none"), this._removeTrap && (this._removeTrap(), this._removeTrap = null), this._savedRange = null;
|
|
@@ -2742,50 +2742,50 @@ class ci {
|
|
|
2742
2742
|
this._urlInput = n;
|
|
2743
2743
|
const a = c("label", { class: "an-label" });
|
|
2744
2744
|
a.textContent = "Alt Text";
|
|
2745
|
-
const
|
|
2745
|
+
const l = c("input", {
|
|
2746
2746
|
type: "text",
|
|
2747
2747
|
class: "an-input",
|
|
2748
2748
|
placeholder: "Describe the image",
|
|
2749
2749
|
autocomplete: "off"
|
|
2750
2750
|
});
|
|
2751
|
-
this._altInput =
|
|
2752
|
-
const
|
|
2753
|
-
|
|
2751
|
+
this._altInput = l, t.append(i, s, n, a, l);
|
|
2752
|
+
const r = c("label", { class: "an-label" });
|
|
2753
|
+
r.textContent = "Alignment";
|
|
2754
2754
|
const h = c("div", { class: "an-align-row" });
|
|
2755
2755
|
if ([
|
|
2756
2756
|
{ value: "", label: "None" },
|
|
2757
2757
|
{ value: "left", label: "Left" },
|
|
2758
2758
|
{ value: "center", label: "Center" },
|
|
2759
2759
|
{ value: "right", label: "Right" }
|
|
2760
|
-
].forEach(({ value:
|
|
2761
|
-
const
|
|
2762
|
-
|
|
2763
|
-
const
|
|
2764
|
-
|
|
2765
|
-
}), this._alignRow = h, t.append(
|
|
2766
|
-
const
|
|
2767
|
-
|
|
2768
|
-
const
|
|
2760
|
+
].forEach(({ value: b, label: w }) => {
|
|
2761
|
+
const _ = `an-align-${b || "none"}`, y = c("input", { type: "radio", name: "an-img-align", id: _, value: b });
|
|
2762
|
+
b === "" && (y.checked = !0);
|
|
2763
|
+
const I = c("label", { for: _, class: "an-align-label" });
|
|
2764
|
+
I.textContent = w, h.append(y, I);
|
|
2765
|
+
}), this._alignRow = h, t.append(r, h), this.options.allowImageUpload !== !1) {
|
|
2766
|
+
const b = c("label", { class: "an-label" });
|
|
2767
|
+
b.textContent = "Or upload a file";
|
|
2768
|
+
const w = c("input", {
|
|
2769
2769
|
type: "file",
|
|
2770
2770
|
class: "an-input",
|
|
2771
2771
|
accept: "image/*"
|
|
2772
2772
|
});
|
|
2773
|
-
this._fileInput =
|
|
2774
|
-
const
|
|
2775
|
-
this._disposers.push(
|
|
2773
|
+
this._fileInput = w;
|
|
2774
|
+
const _ = d(w, "change", () => this._onFileChange());
|
|
2775
|
+
this._disposers.push(_), t.append(b, w);
|
|
2776
2776
|
}
|
|
2777
|
-
const
|
|
2778
|
-
|
|
2777
|
+
const u = c("div", { class: "an-dialog-actions" }), m = c("button", { type: "button", class: "an-btn an-btn-primary" });
|
|
2778
|
+
m.textContent = "Insert";
|
|
2779
2779
|
const f = c("button", { type: "button", class: "an-btn" });
|
|
2780
|
-
f.textContent = "Cancel",
|
|
2781
|
-
const g = d(
|
|
2782
|
-
|
|
2783
|
-
}), T = d(n, "keydown", (
|
|
2784
|
-
|
|
2785
|
-
}),
|
|
2786
|
-
|
|
2780
|
+
f.textContent = "Cancel", u.appendChild(m), u.appendChild(f), t.append(u), e.appendChild(t);
|
|
2781
|
+
const g = d(m, "click", () => this._onInsert()), v = d(f, "click", () => this._close()), C = d(e, "click", (b) => {
|
|
2782
|
+
b.target === e && this._close();
|
|
2783
|
+
}), T = d(n, "keydown", (b) => {
|
|
2784
|
+
b.key === "Enter" && (b.preventDefault(), this._onInsert());
|
|
2785
|
+
}), k = d(l, "keydown", (b) => {
|
|
2786
|
+
b.key === "Enter" && (b.preventDefault(), this._onInsert());
|
|
2787
2787
|
});
|
|
2788
|
-
return this._disposers.push(g,
|
|
2788
|
+
return this._disposers.push(g, v, C, T, k), e;
|
|
2789
2789
|
}
|
|
2790
2790
|
// ---------------------------------------------------------------------------
|
|
2791
2791
|
// Actions
|
|
@@ -2813,7 +2813,7 @@ class ci {
|
|
|
2813
2813
|
this._savedRange && this._savedRange.select(), this.context.invoke("editor.insertImage", e, t, s), this._close();
|
|
2814
2814
|
}
|
|
2815
2815
|
_open() {
|
|
2816
|
-
this._dialog && (this._dialog.style.display = "flex", this._removeTrap =
|
|
2816
|
+
this._dialog && (this._dialog.style.display = "flex", this._removeTrap = Q(this._dialog, () => this._close()), setTimeout(() => this._urlInput && this._urlInput.focus(), 50));
|
|
2817
2817
|
}
|
|
2818
2818
|
_close() {
|
|
2819
2819
|
this._dialog && (this._dialog.style.display = "none"), this._removeTrap && (this._removeTrap(), this._removeTrap = null), this._savedRange = null;
|
|
@@ -2863,9 +2863,9 @@ class hi {
|
|
|
2863
2863
|
this._urlInput = n;
|
|
2864
2864
|
const a = c("p", { class: "an-dialog-hint" });
|
|
2865
2865
|
this._hintEl = a;
|
|
2866
|
-
const
|
|
2867
|
-
|
|
2868
|
-
const
|
|
2866
|
+
const l = c("label", { class: "an-label" });
|
|
2867
|
+
l.textContent = "Width (px)";
|
|
2868
|
+
const r = c("input", {
|
|
2869
2869
|
type: "number",
|
|
2870
2870
|
class: "an-input",
|
|
2871
2871
|
placeholder: "560",
|
|
@@ -2873,20 +2873,20 @@ class hi {
|
|
|
2873
2873
|
max: "1920",
|
|
2874
2874
|
value: "560"
|
|
2875
2875
|
});
|
|
2876
|
-
this._widthInput =
|
|
2876
|
+
this._widthInput = r;
|
|
2877
2877
|
const h = c("div", { class: "an-dialog-actions" }), p = c("button", { type: "button", class: "an-btn an-btn-primary" });
|
|
2878
2878
|
p.textContent = "Insert";
|
|
2879
|
-
const
|
|
2880
|
-
|
|
2881
|
-
const
|
|
2879
|
+
const u = c("button", { type: "button", class: "an-btn" });
|
|
2880
|
+
u.textContent = "Cancel", h.appendChild(p), h.appendChild(u), t.append(i, s, n, a, l, r, h), e.appendChild(t);
|
|
2881
|
+
const m = d(n, "input", () => {
|
|
2882
2882
|
const T = this._parseVideoUrl(n.value.trim());
|
|
2883
2883
|
a.textContent = T ? `Detected: ${T.type}` : n.value ? "Unknown format — will try direct video embed" : "";
|
|
2884
|
-
}), f = d(p, "click", () => this._onInsert()), g = d(
|
|
2884
|
+
}), f = d(p, "click", () => this._onInsert()), g = d(u, "click", () => this._close()), v = d(e, "click", (T) => {
|
|
2885
2885
|
T.target === e && this._close();
|
|
2886
2886
|
}), C = d(n, "keydown", (T) => {
|
|
2887
2887
|
T.key === "Enter" && (T.preventDefault(), this._onInsert());
|
|
2888
2888
|
});
|
|
2889
|
-
return this._disposers.push(
|
|
2889
|
+
return this._disposers.push(m, f, g, v, C), e;
|
|
2890
2890
|
}
|
|
2891
2891
|
// ---------------------------------------------------------------------------
|
|
2892
2892
|
// Actions
|
|
@@ -2905,7 +2905,7 @@ class hi {
|
|
|
2905
2905
|
this._savedRange && this._savedRange.select(), this.context.invoke("editor.insertVideo", i), this._close();
|
|
2906
2906
|
}
|
|
2907
2907
|
_open() {
|
|
2908
|
-
this._dialog && (this._dialog.style.display = "flex", this._removeTrap =
|
|
2908
|
+
this._dialog && (this._dialog.style.display = "flex", this._removeTrap = Q(this._dialog, () => this._close()), setTimeout(() => this._urlInput && this._urlInput.focus(), 50));
|
|
2909
2909
|
}
|
|
2910
2910
|
_close() {
|
|
2911
2911
|
this._dialog && (this._dialog.style.display = "none"), this._removeTrap && (this._removeTrap(), this._removeTrap = null), this._savedRange = null;
|
|
@@ -2944,17 +2944,17 @@ class hi {
|
|
|
2944
2944
|
_buildEmbedHtml(e, t) {
|
|
2945
2945
|
const i = this._parseVideoUrl(e), s = Math.round(t * 9 / 16);
|
|
2946
2946
|
if (i && (i.type === "YouTube" || i.type === "YouTube Shorts" || i.type === "Vimeo")) {
|
|
2947
|
-
const
|
|
2948
|
-
return `<div class="an-video-wrapper" style="position:relative;display:block;width:${t}px;max-width:100%"><iframe src="${i.embedUrl}" width="${t}" height="${s}" title="${
|
|
2947
|
+
const l = `${i.type} video player`;
|
|
2948
|
+
return `<div class="an-video-wrapper" style="position:relative;display:block;width:${t}px;max-width:100%"><iframe src="${i.embedUrl}" width="${t}" height="${s}" title="${l}" frameborder="0" allowfullscreen allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" style="display:block;max-width:100%"></iframe><div class="an-video-shield"></div></div>`;
|
|
2949
2949
|
}
|
|
2950
2950
|
if (i && i.type === "Direct video") {
|
|
2951
|
-
const
|
|
2952
|
-
return `<div class="an-video-wrapper" style="position:relative;display:block;width:${t}px;max-width:100%"><video src="${
|
|
2951
|
+
const l = i.embedUrl.replace(/"/g, "%22");
|
|
2952
|
+
return `<div class="an-video-wrapper" style="position:relative;display:block;width:${t}px;max-width:100%"><video src="${l}" width="${t}" height="${s}" controls style="display:block;max-width:100%"></video><div class="an-video-shield"></div></div>`;
|
|
2953
2953
|
}
|
|
2954
2954
|
const n = (() => {
|
|
2955
2955
|
try {
|
|
2956
|
-
const
|
|
2957
|
-
return /^javascript:/i.test(
|
|
2956
|
+
const l = new URL(e);
|
|
2957
|
+
return /^javascript:/i.test(l.protocol) || /^vbscript:/i.test(l.protocol) ? null : e;
|
|
2958
2958
|
} catch {
|
|
2959
2959
|
return null;
|
|
2960
2960
|
}
|
|
@@ -2984,16 +2984,20 @@ class pi {
|
|
|
2984
2984
|
const e = this.context.layoutInfo.editable.closest(".an-container") || document.body;
|
|
2985
2985
|
e.appendChild(this._overlay), this._container = e;
|
|
2986
2986
|
const t = this.context.layoutInfo.editable;
|
|
2987
|
+
let i = null;
|
|
2988
|
+
const s = () => {
|
|
2989
|
+
clearTimeout(i), i = setTimeout(() => this._updateOverlayPosition(), 100);
|
|
2990
|
+
};
|
|
2987
2991
|
return this._disposers.push(
|
|
2988
|
-
d(t, "click", (
|
|
2992
|
+
d(t, "click", (n) => this._onEditorClick(n)),
|
|
2989
2993
|
// Also select on right-click so the highlight shows before the context menu
|
|
2990
|
-
d(t, "contextmenu", (
|
|
2991
|
-
const
|
|
2992
|
-
|
|
2994
|
+
d(t, "contextmenu", (n) => {
|
|
2995
|
+
const a = n.target.closest("img");
|
|
2996
|
+
a && this._select(a);
|
|
2993
2997
|
}),
|
|
2994
|
-
d(document, "click", (
|
|
2998
|
+
d(document, "click", (n) => this._onDocClick(n)),
|
|
2995
2999
|
d(window, "scroll", () => this._updateOverlayPosition(), { passive: !0 }),
|
|
2996
|
-
d(window, "resize",
|
|
3000
|
+
d(window, "resize", s),
|
|
2997
3001
|
d(t, "scroll", () => this._updateOverlayPosition(), { passive: !0 })
|
|
2998
3002
|
), this;
|
|
2999
3003
|
}
|
|
@@ -3055,16 +3059,23 @@ class pi {
|
|
|
3055
3059
|
_startResize(e, t) {
|
|
3056
3060
|
const i = this._activeImg;
|
|
3057
3061
|
if (!i) return;
|
|
3058
|
-
const s = e.clientX, n = e.clientY, a = i.offsetWidth || i.naturalWidth || 100,
|
|
3059
|
-
|
|
3060
|
-
|
|
3061
|
-
|
|
3062
|
-
|
|
3063
|
-
|
|
3062
|
+
const s = e.clientX, n = e.clientY, a = i.offsetWidth || i.naturalWidth || 100, l = i.offsetHeight || i.naturalHeight || 100, r = a / l, h = t.length === 2, p = this.context.layoutInfo.editable;
|
|
3063
|
+
let u = null;
|
|
3064
|
+
const m = (g) => {
|
|
3065
|
+
if (u !== null) return;
|
|
3066
|
+
const v = g.clientX, C = g.clientY;
|
|
3067
|
+
u = requestAnimationFrame(() => {
|
|
3068
|
+
u = null;
|
|
3069
|
+
const T = v - s, k = C - n, b = p.clientWidth || 1 / 0;
|
|
3070
|
+
let w = a, _ = l;
|
|
3071
|
+
t.includes("e") && (w = Math.max(20, a + T)), t.includes("w") && (w = Math.max(20, a - T)), t.includes("s") && (_ = Math.max(20, l + k)), t.includes("n") && (_ = Math.max(20, l - k)), w = Math.min(w, b), h && (Math.abs(T) >= Math.abs(k) || (w = Math.min(Math.max(20, Math.round(_ * r)), b)), _ = Math.max(20, Math.round(w / r))), i.style.width = `${w}px`, i.style.height = `${_}px`, this._updateOverlayPosition();
|
|
3072
|
+
});
|
|
3073
|
+
}, f = () => {
|
|
3074
|
+
u !== null && (cancelAnimationFrame(u), u = null), document.removeEventListener("mousemove", m), document.removeEventListener("mouseup", f), this._dragDisposers = null, this.context.invoke("editor.afterCommand");
|
|
3064
3075
|
};
|
|
3065
|
-
document.addEventListener("mousemove", m), document.addEventListener("mouseup",
|
|
3076
|
+
document.addEventListener("mousemove", m), document.addEventListener("mouseup", f), this._dragDisposers = [
|
|
3066
3077
|
() => document.removeEventListener("mousemove", m),
|
|
3067
|
-
() => document.removeEventListener("mouseup",
|
|
3078
|
+
() => document.removeEventListener("mouseup", f)
|
|
3068
3079
|
];
|
|
3069
3080
|
}
|
|
3070
3081
|
}
|
|
@@ -3088,15 +3099,19 @@ class mi {
|
|
|
3088
3099
|
const e = this.context.layoutInfo.editable.closest(".an-container") || document.body;
|
|
3089
3100
|
e.appendChild(this._overlay), this._container = e;
|
|
3090
3101
|
const t = this.context.layoutInfo.editable;
|
|
3102
|
+
let i = null;
|
|
3103
|
+
const s = () => {
|
|
3104
|
+
clearTimeout(i), i = setTimeout(() => this._updateOverlayPosition(), 100);
|
|
3105
|
+
};
|
|
3091
3106
|
return this._disposers.push(
|
|
3092
|
-
d(t, "click", (
|
|
3093
|
-
d(t, "contextmenu", (
|
|
3094
|
-
const
|
|
3095
|
-
|
|
3107
|
+
d(t, "click", (n) => this._onEditorClick(n)),
|
|
3108
|
+
d(t, "contextmenu", (n) => {
|
|
3109
|
+
const a = this._findWrapper(n.target);
|
|
3110
|
+
a && this._select(a);
|
|
3096
3111
|
}),
|
|
3097
|
-
d(document, "click", (
|
|
3112
|
+
d(document, "click", (n) => this._onDocClick(n)),
|
|
3098
3113
|
d(window, "scroll", () => this._updateOverlayPosition(), { passive: !0 }),
|
|
3099
|
-
d(window, "resize",
|
|
3114
|
+
d(window, "resize", s),
|
|
3100
3115
|
d(t, "scroll", () => this._updateOverlayPosition(), { passive: !0 })
|
|
3101
3116
|
), this;
|
|
3102
3117
|
}
|
|
@@ -3168,16 +3183,23 @@ class mi {
|
|
|
3168
3183
|
_startResize(e, t) {
|
|
3169
3184
|
const i = this._activeWrapper;
|
|
3170
3185
|
if (!i) return;
|
|
3171
|
-
const s = i.querySelector("iframe, video"), n = e.clientX, a = e.clientY,
|
|
3172
|
-
|
|
3173
|
-
|
|
3174
|
-
|
|
3175
|
-
|
|
3176
|
-
|
|
3186
|
+
const s = i.querySelector("iframe, video"), n = e.clientX, a = e.clientY, l = i.offsetWidth || 560, r = i.offsetHeight || 315, h = l / r, p = t.length === 2, u = this.context.layoutInfo.editable;
|
|
3187
|
+
let m = null;
|
|
3188
|
+
const f = (v) => {
|
|
3189
|
+
if (m !== null) return;
|
|
3190
|
+
const C = v.clientX, T = v.clientY;
|
|
3191
|
+
m = requestAnimationFrame(() => {
|
|
3192
|
+
m = null;
|
|
3193
|
+
const k = C - n, b = T - a, w = u.clientWidth || 1 / 0;
|
|
3194
|
+
let _ = l, y = r;
|
|
3195
|
+
t.includes("e") && (_ = Math.max(80, l + k)), t.includes("w") && (_ = Math.max(80, l - k)), t.includes("s") && (y = Math.max(45, r + b)), t.includes("n") && (y = Math.max(45, r - b)), _ = Math.min(_, w), p && (Math.abs(k) >= Math.abs(b) || (_ = Math.min(Math.max(80, Math.round(y * h)), w)), y = Math.max(45, Math.round(_ / h))), i.style.width = `${_}px`, i.style.height = `${y}px`, s && (s.style.width = `${_}px`, s.style.height = `${y}px`), this._updateOverlayPosition();
|
|
3196
|
+
});
|
|
3197
|
+
}, g = () => {
|
|
3198
|
+
m !== null && (cancelAnimationFrame(m), m = null), document.removeEventListener("mousemove", f), document.removeEventListener("mouseup", g), this._dragDisposers = null, this.context.invoke("editor.afterCommand");
|
|
3177
3199
|
};
|
|
3178
|
-
document.addEventListener("mousemove",
|
|
3179
|
-
() => document.removeEventListener("mousemove",
|
|
3180
|
-
() => document.removeEventListener("mouseup",
|
|
3200
|
+
document.addEventListener("mousemove", f), document.addEventListener("mouseup", g), this._dragDisposers = [
|
|
3201
|
+
() => document.removeEventListener("mousemove", f),
|
|
3202
|
+
() => document.removeEventListener("mouseup", g)
|
|
3181
3203
|
];
|
|
3182
3204
|
}
|
|
3183
3205
|
}
|
|
@@ -3187,7 +3209,7 @@ const oe = {
|
|
|
3187
3209
|
unlink: '<svg xmlns="http://www.w3.org/2000/svg" width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M18.84 12.25l1.72-1.71h-.02a5.004 5.004 0 0 0-.12-7.07 5.006 5.006 0 0 0-6.95 0l-1.72 1.71"/><path d="M5.17 11.75l-1.71 1.71a5.004 5.004 0 0 0 .12 7.07 5.006 5.006 0 0 0 6.95 0l1.71-1.71"/><line x1="8" y1="2" x2="8" y2="5"/><line x1="2" y1="8" x2="5" y2="8"/><line x1="16" y1="19" x2="16" y2="22"/><line x1="19" y1="16" x2="22" y2="16"/></svg>',
|
|
3188
3210
|
copy: '<svg xmlns="http://www.w3.org/2000/svg" width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="9" y="9" width="13" height="13" rx="2"/><path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"/></svg>'
|
|
3189
3211
|
}, fi = 120, gi = 200;
|
|
3190
|
-
class
|
|
3212
|
+
class _i {
|
|
3191
3213
|
/** @param {import('../Context.js').Context} context */
|
|
3192
3214
|
constructor(e) {
|
|
3193
3215
|
this.context = e, this._el = null, this._activeAnchor = null, this._showTimer = null, this._hideTimer = null, this._disposers = [];
|
|
@@ -3252,8 +3274,8 @@ class yi {
|
|
|
3252
3274
|
}
|
|
3253
3275
|
_positionNear(e) {
|
|
3254
3276
|
const t = e.getBoundingClientRect(), i = this._el.offsetWidth || 260, s = this._el.offsetHeight || 34, n = 6;
|
|
3255
|
-
let a = t.bottom + n,
|
|
3256
|
-
a + s > window.innerHeight - n && (a = t.top - s - n),
|
|
3277
|
+
let a = t.bottom + n, l = t.left;
|
|
3278
|
+
a + s > window.innerHeight - n && (a = t.top - s - n), l + i > window.innerWidth - n && (l = window.innerWidth - i - n), l < n && (l = n), this._el.style.top = `${a}px`, this._el.style.left = `${l}px`;
|
|
3257
3279
|
}
|
|
3258
3280
|
_truncateUrl(e) {
|
|
3259
3281
|
try {
|
|
@@ -3292,16 +3314,18 @@ class yi {
|
|
|
3292
3314
|
i.selectNode(e), t.removeAllRanges(), t.addRange(i), document.execCommand("unlink"), this.context.invoke("editor.afterCommand");
|
|
3293
3315
|
}
|
|
3294
3316
|
}
|
|
3295
|
-
const
|
|
3317
|
+
const $ = {
|
|
3296
3318
|
floatLeft: '<svg xmlns="http://www.w3.org/2000/svg" width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="2" y="4" width="8" height="8" rx="1"/><line x1="12" y1="6" x2="22" y2="6"/><line x1="12" y1="9" x2="22" y2="9"/><line x1="12" y1="12" x2="22" y2="12"/><line x1="2" y1="16" x2="22" y2="16"/><line x1="2" y1="20" x2="18" y2="20"/></svg>',
|
|
3297
3319
|
floatRight: '<svg xmlns="http://www.w3.org/2000/svg" width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="14" y="4" width="8" height="8" rx="1"/><line x1="2" y1="6" x2="12" y2="6"/><line x1="2" y1="9" x2="12" y2="9"/><line x1="2" y1="12" x2="12" y2="12"/><line x1="2" y1="16" x2="22" y2="16"/><line x1="2" y1="20" x2="18" y2="20"/></svg>',
|
|
3298
3320
|
floatNone: '<svg xmlns="http://www.w3.org/2000/svg" width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="3" y="3" width="8" height="8" rx="1"/><line x1="3" y1="15" x2="21" y2="15"/><line x1="3" y1="19" x2="17" y2="19"/></svg>',
|
|
3299
3321
|
alignCenter: '<svg xmlns="http://www.w3.org/2000/svg" width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="7" y="4" width="10" height="8" rx="1"/><line x1="3" y1="16" x2="21" y2="16"/><line x1="6" y1="20" x2="18" y2="20"/></svg>',
|
|
3300
3322
|
originalSize: '<svg xmlns="http://www.w3.org/2000/svg" width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="15 3 21 3 21 9"/><polyline points="9 21 3 21 3 15"/><line x1="21" y1="3" x2="14" y2="10"/><line x1="3" y1="21" x2="10" y2="14"/></svg>',
|
|
3301
3323
|
deleteImg: '<svg xmlns="http://www.w3.org/2000/svg" width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="3 6 5 6 21 6"/><path d="M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v2"/></svg>',
|
|
3302
|
-
caption: '<svg xmlns="http://www.w3.org/2000/svg" width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="3" y="3" width="18" height="11" rx="2"/><line x1="6" y1="18" x2="18" y2="18"/><line x1="9" y1="21" x2="15" y2="21"/></svg>'
|
|
3303
|
-
|
|
3304
|
-
|
|
3324
|
+
caption: '<svg xmlns="http://www.w3.org/2000/svg" width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="3" y="3" width="18" height="11" rx="2"/><line x1="6" y1="18" x2="18" y2="18"/><line x1="9" y1="21" x2="15" y2="21"/></svg>',
|
|
3325
|
+
rotateLeft: '<svg xmlns="http://www.w3.org/2000/svg" width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8"/><polyline points="3 3 3 8 8 8"/></svg>',
|
|
3326
|
+
rotateRight: '<svg xmlns="http://www.w3.org/2000/svg" width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M21 12a9 9 0 1 1-9-9 9.75 9.75 0 0 1 6.74 2.74L21 8"/><polyline points="21 3 21 8 16 8"/></svg>'
|
|
3327
|
+
}, yi = 100, vi = 180;
|
|
3328
|
+
class bi {
|
|
3305
3329
|
/** @param {import('../Context.js').Context} context */
|
|
3306
3330
|
constructor(e) {
|
|
3307
3331
|
this.context = e, this._el = null, this._activeImg = null, this._showTimer = null, this._hideTimer = null, this._disposers = [];
|
|
@@ -3313,11 +3337,11 @@ class vi {
|
|
|
3313
3337
|
d(e, "mouseover", (t) => {
|
|
3314
3338
|
const i = t.target.closest("img");
|
|
3315
3339
|
i && e.contains(i) && !i.closest("a[href]") && this._scheduleShow(i);
|
|
3316
|
-
}),
|
|
3340
|
+
}, { passive: !0 }),
|
|
3317
3341
|
d(e, "mouseout", (t) => {
|
|
3318
3342
|
const i = t.relatedTarget;
|
|
3319
3343
|
(!i || !e.contains(i) && !this._el.contains(i)) && this._scheduleHide();
|
|
3320
|
-
}),
|
|
3344
|
+
}, { passive: !0 }),
|
|
3321
3345
|
// Hide when image is deselected by clicking elsewhere
|
|
3322
3346
|
d(document, "click", (t) => {
|
|
3323
3347
|
this._activeImg && !this._activeImg.contains(t.target) && !this._el.contains(t.target) && this._hide();
|
|
@@ -3336,7 +3360,7 @@ class vi {
|
|
|
3336
3360
|
role: "toolbar",
|
|
3337
3361
|
"aria-label": "Image actions"
|
|
3338
3362
|
});
|
|
3339
|
-
return e.style.display = "none", this._label = c("span", { class: "an-link-tooltip-url" }), this._label.textContent = "Image", e.appendChild(this._label), e.appendChild(c("div", { class: "an-link-tooltip-sep" })), this._floatLeftBtn = this._makeBtn(
|
|
3363
|
+
return e.style.display = "none", this._label = c("span", { class: "an-link-tooltip-url" }), this._label.textContent = "Image", e.appendChild(this._label), e.appendChild(c("div", { class: "an-link-tooltip-sep" })), this._floatLeftBtn = this._makeBtn($.floatLeft, "Float Left", () => this._setFloat("left")), this._floatNoneBtn = this._makeBtn($.floatNone, "No Float", () => this._setFloat("")), this._alignCenterBtn = this._makeBtn($.alignCenter, "Align Center", () => this._setCenter()), this._floatRightBtn = this._makeBtn($.floatRight, "Float Right", () => this._setFloat("right")), e.appendChild(this._floatLeftBtn), e.appendChild(this._floatNoneBtn), e.appendChild(this._alignCenterBtn), e.appendChild(this._floatRightBtn), e.appendChild(c("div", { class: "an-link-tooltip-sep" })), this._originalBtn = this._makeBtn($.originalSize, "Original Size", () => this._resetSize()), e.appendChild(this._originalBtn), e.appendChild(c("div", { class: "an-link-tooltip-sep" })), e.appendChild(this._makeBtn($.rotateLeft, "Rotate Left", () => this._rotate(-90))), e.appendChild(this._makeBtn($.rotateRight, "Rotate Right", () => this._rotate(90))), e.appendChild(c("div", { class: "an-link-tooltip-sep" })), this._captionBtn = this._makeBtn($.caption, "Add / Edit Caption", () => this._toggleCaption()), e.appendChild(this._captionBtn), e.appendChild(c("div", { class: "an-link-tooltip-sep" })), this._deleteBtn = this._makeBtn($.deleteImg, "Delete Image", () => this._delete(), !0), e.appendChild(this._deleteBtn), this._disposers.push(
|
|
3340
3364
|
d(e, "mouseenter", () => this._clearTimers()),
|
|
3341
3365
|
d(e, "mouseleave", () => this._scheduleHide())
|
|
3342
3366
|
), e;
|
|
@@ -3363,13 +3387,15 @@ class vi {
|
|
|
3363
3387
|
_scheduleShow(e) {
|
|
3364
3388
|
this._activeImg === e && this._el.style.display !== "none" || (clearTimeout(this._hideTimer), this._hideTimer = null, clearTimeout(this._showTimer), this._showTimer = setTimeout(() => {
|
|
3365
3389
|
this._activeImg = e, this._show(e);
|
|
3366
|
-
},
|
|
3390
|
+
}, yi));
|
|
3367
3391
|
}
|
|
3368
3392
|
_scheduleHide() {
|
|
3369
|
-
clearTimeout(this._showTimer), this._showTimer = null, !this._hideTimer && (this._hideTimer = setTimeout(() => this._hide(),
|
|
3393
|
+
clearTimeout(this._showTimer), this._showTimer = null, !this._hideTimer && (this._hideTimer = setTimeout(() => this._hide(), vi));
|
|
3370
3394
|
}
|
|
3371
3395
|
_show(e) {
|
|
3372
|
-
this._el.style.display = "flex",
|
|
3396
|
+
this._el.style.display = "flex", requestAnimationFrame(() => {
|
|
3397
|
+
this._activeImg && this._positionNear(this._activeImg);
|
|
3398
|
+
});
|
|
3373
3399
|
}
|
|
3374
3400
|
_hide() {
|
|
3375
3401
|
this._el.style.display = "none", this._activeImg = null, this._clearTimers();
|
|
@@ -3379,8 +3405,8 @@ class vi {
|
|
|
3379
3405
|
}
|
|
3380
3406
|
_positionNear(e) {
|
|
3381
3407
|
const t = e.getBoundingClientRect(), i = this._el.offsetWidth || 220, s = this._el.offsetHeight || 32, n = 6;
|
|
3382
|
-
let a = t.bottom + n,
|
|
3383
|
-
a + s > window.innerHeight - n && (a = t.top - s - n),
|
|
3408
|
+
let a = t.bottom + n, l = t.left + (t.width - i) / 2;
|
|
3409
|
+
a + s > window.innerHeight - n && (a = t.top - s - n), l + i > window.innerWidth - n && (l = window.innerWidth - i - n), l < n && (l = n), this._el.style.top = `${a}px`, this._el.style.left = `${l}px`;
|
|
3384
3410
|
}
|
|
3385
3411
|
// ---------------------------------------------------------------------------
|
|
3386
3412
|
// Actions
|
|
@@ -3389,17 +3415,37 @@ class vi {
|
|
|
3389
3415
|
const t = this._activeImg;
|
|
3390
3416
|
if (!t) return;
|
|
3391
3417
|
const i = t.closest("figure.an-figure") || t;
|
|
3392
|
-
i.style.float = e, i.style.display = "", i.style.marginLeft = e === "right" ? "12px" : "", i.style.marginRight = e === "left" ? "12px" : "", this.context.invoke("editor.afterCommand"), this.context.invoke("imageResizer.updateOverlay"),
|
|
3418
|
+
i.style.float = e, i.style.display = "", i.style.marginLeft = e === "right" ? "12px" : "", i.style.marginRight = e === "left" ? "12px" : "", this.context.invoke("editor.afterCommand"), this.context.invoke("imageResizer.updateOverlay"), requestAnimationFrame(() => {
|
|
3419
|
+
this._activeImg && this._positionNear(this._activeImg);
|
|
3420
|
+
});
|
|
3393
3421
|
}
|
|
3394
3422
|
_setCenter() {
|
|
3395
3423
|
const e = this._activeImg;
|
|
3396
3424
|
if (!e) return;
|
|
3397
3425
|
const t = e.closest("figure.an-figure") || e;
|
|
3398
|
-
t.style.float = "", t.style.display = "block", t.style.marginLeft = "auto", t.style.marginRight = "auto", this.context.invoke("editor.afterCommand"), this.context.invoke("imageResizer.updateOverlay"),
|
|
3426
|
+
t.style.float = "", t.style.display = "block", t.style.marginLeft = "auto", t.style.marginRight = "auto", this.context.invoke("editor.afterCommand"), this.context.invoke("imageResizer.updateOverlay"), requestAnimationFrame(() => {
|
|
3427
|
+
this._activeImg && this._positionNear(this._activeImg);
|
|
3428
|
+
});
|
|
3399
3429
|
}
|
|
3400
3430
|
_resetSize() {
|
|
3401
3431
|
const e = this._activeImg;
|
|
3402
|
-
e && (e.style.width = "", e.style.height = "", this.context.invoke("editor.afterCommand"), this.context.invoke("imageResizer.updateOverlay"),
|
|
3432
|
+
e && (e.style.width = "", e.style.height = "", this.context.invoke("editor.afterCommand"), this.context.invoke("imageResizer.updateOverlay"), requestAnimationFrame(() => {
|
|
3433
|
+
this._activeImg && this._positionNear(this._activeImg);
|
|
3434
|
+
}));
|
|
3435
|
+
}
|
|
3436
|
+
/**
|
|
3437
|
+
* Rotate the active image by `delta` degrees (±90).
|
|
3438
|
+
* Reads the existing rotate() value from the transform style so
|
|
3439
|
+
* repeated clicks accumulate correctly.
|
|
3440
|
+
* @param {number} delta
|
|
3441
|
+
*/
|
|
3442
|
+
_rotate(e) {
|
|
3443
|
+
const t = this._activeImg;
|
|
3444
|
+
if (!t) return;
|
|
3445
|
+
const i = t.style.transform || "", s = i.match(/rotate\((-?[\d.]+)deg\)/), a = ((s ? parseFloat(s[1]) : 0) + e + 360) % 360, l = i.replace(/rotate\(-?[\d.]+deg\)/, "").trim();
|
|
3446
|
+
t.style.transform = l ? `${l} rotate(${a}deg)` : a === 0 ? "" : `rotate(${a}deg)`, this.context.invoke("editor.afterCommand"), this.context.invoke("imageResizer.updateOverlay"), requestAnimationFrame(() => {
|
|
3447
|
+
this._activeImg && this._positionNear(this._activeImg);
|
|
3448
|
+
});
|
|
3403
3449
|
}
|
|
3404
3450
|
_delete() {
|
|
3405
3451
|
const e = this._activeImg;
|
|
@@ -3413,13 +3459,13 @@ class vi {
|
|
|
3413
3459
|
if (!e) return;
|
|
3414
3460
|
const t = e.closest("figure.an-figure");
|
|
3415
3461
|
if (t) {
|
|
3416
|
-
const
|
|
3417
|
-
if (
|
|
3462
|
+
const l = t.querySelector("figcaption.an-figcaption");
|
|
3463
|
+
if (l) {
|
|
3418
3464
|
this._hide();
|
|
3419
|
-
const
|
|
3420
|
-
|
|
3465
|
+
const r = document.createRange();
|
|
3466
|
+
r.selectNodeContents(l);
|
|
3421
3467
|
const h = window.getSelection();
|
|
3422
|
-
h && (h.removeAllRanges(), h.addRange(
|
|
3468
|
+
h && (h.removeAllRanges(), h.addRange(r));
|
|
3423
3469
|
}
|
|
3424
3470
|
return;
|
|
3425
3471
|
}
|
|
@@ -3433,7 +3479,7 @@ class vi {
|
|
|
3433
3479
|
a && (a.removeAllRanges(), a.addRange(n)), this.context.invoke("editor.afterCommand"), this.context.invoke("imageResizer.updateOverlay"), this._hide();
|
|
3434
3480
|
}
|
|
3435
3481
|
}
|
|
3436
|
-
const
|
|
3482
|
+
const X = {
|
|
3437
3483
|
floatLeft: '<svg xmlns="http://www.w3.org/2000/svg" width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="2" y="4" width="8" height="8" rx="1"/><line x1="12" y1="6" x2="22" y2="6"/><line x1="12" y1="9" x2="22" y2="9"/><line x1="12" y1="12" x2="22" y2="12"/><line x1="2" y1="16" x2="22" y2="16"/><line x1="2" y1="20" x2="18" y2="20"/></svg>',
|
|
3438
3484
|
floatRight: '<svg xmlns="http://www.w3.org/2000/svg" width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="14" y="4" width="8" height="8" rx="1"/><line x1="2" y1="6" x2="12" y2="6"/><line x1="2" y1="9" x2="12" y2="9"/><line x1="2" y1="12" x2="12" y2="12"/><line x1="2" y1="16" x2="22" y2="16"/><line x1="2" y1="20" x2="18" y2="20"/></svg>',
|
|
3439
3485
|
floatNone: '<svg xmlns="http://www.w3.org/2000/svg" width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="3" y="3" width="8" height="8" rx="1"/><line x1="3" y1="15" x2="21" y2="15"/><line x1="3" y1="19" x2="17" y2="19"/></svg>',
|
|
@@ -3454,11 +3500,11 @@ class Ci {
|
|
|
3454
3500
|
d(e, "mouseover", (t) => {
|
|
3455
3501
|
const i = t.target.closest(".an-video-wrapper");
|
|
3456
3502
|
i && e.contains(i) && this._scheduleShow(i);
|
|
3457
|
-
}),
|
|
3503
|
+
}, { passive: !0 }),
|
|
3458
3504
|
d(e, "mouseout", (t) => {
|
|
3459
3505
|
const i = t.relatedTarget;
|
|
3460
3506
|
(!i || !e.contains(i) && !this._el.contains(i)) && this._scheduleHide();
|
|
3461
|
-
}),
|
|
3507
|
+
}, { passive: !0 }),
|
|
3462
3508
|
d(document, "click", (t) => {
|
|
3463
3509
|
this._activeWrapper && !this._activeWrapper.contains(t.target) && !this._el.contains(t.target) && this._hide();
|
|
3464
3510
|
})
|
|
@@ -3476,7 +3522,7 @@ class Ci {
|
|
|
3476
3522
|
role: "toolbar",
|
|
3477
3523
|
"aria-label": "Video actions"
|
|
3478
3524
|
});
|
|
3479
|
-
return e.style.display = "none", this._label = c("span", { class: "an-link-tooltip-url" }), this._label.textContent = "Video", e.appendChild(this._label), e.appendChild(c("div", { class: "an-link-tooltip-sep" })), this._floatLeftBtn = this._makeBtn(
|
|
3525
|
+
return e.style.display = "none", this._label = c("span", { class: "an-link-tooltip-url" }), this._label.textContent = "Video", e.appendChild(this._label), e.appendChild(c("div", { class: "an-link-tooltip-sep" })), this._floatLeftBtn = this._makeBtn(X.floatLeft, "Float Left", () => this._setFloat("left")), this._floatNoneBtn = this._makeBtn(X.floatNone, "No Float", () => this._setFloat("")), this._alignCenterBtn = this._makeBtn(X.alignCenter, "Align Center", () => this._setCenter()), this._floatRightBtn = this._makeBtn(X.floatRight, "Float Right", () => this._setFloat("right")), e.appendChild(this._floatLeftBtn), e.appendChild(this._floatNoneBtn), e.appendChild(this._alignCenterBtn), e.appendChild(this._floatRightBtn), e.appendChild(c("div", { class: "an-link-tooltip-sep" })), this._originalBtn = this._makeBtn(X.originalSize, "Original Size", () => this._resetSize()), e.appendChild(this._originalBtn), e.appendChild(c("div", { class: "an-link-tooltip-sep" })), this._previewBtn = this._makeBtn(X.preview, "Preview Video", () => this._togglePreview()), e.appendChild(this._previewBtn), e.appendChild(c("div", { class: "an-link-tooltip-sep" })), this._deleteBtn = this._makeBtn(X.deleteVideo, "Delete Video", () => this._delete(), !0), e.appendChild(this._deleteBtn), this._disposers.push(
|
|
3480
3526
|
d(e, "mouseenter", () => this._clearTimers()),
|
|
3481
3527
|
d(e, "mouseleave", () => this._scheduleHide())
|
|
3482
3528
|
), e;
|
|
@@ -3509,7 +3555,9 @@ class Ci {
|
|
|
3509
3555
|
this._previewMode || (clearTimeout(this._showTimer), this._showTimer = null, !this._hideTimer && (this._hideTimer = setTimeout(() => this._hide(), xi)));
|
|
3510
3556
|
}
|
|
3511
3557
|
_show(e) {
|
|
3512
|
-
this._el.style.display = "flex",
|
|
3558
|
+
this._el.style.display = "flex", requestAnimationFrame(() => {
|
|
3559
|
+
this._activeWrapper && this._positionNear(this._activeWrapper);
|
|
3560
|
+
});
|
|
3513
3561
|
}
|
|
3514
3562
|
_hide() {
|
|
3515
3563
|
this._previewMode && this._exitPreview(), this._el.style.display = "none", this._activeWrapper = null, this._clearTimers();
|
|
@@ -3519,25 +3567,31 @@ class Ci {
|
|
|
3519
3567
|
}
|
|
3520
3568
|
_positionNear(e) {
|
|
3521
3569
|
const t = e.getBoundingClientRect(), i = this._el.offsetWidth || 220, s = this._el.offsetHeight || 32, n = 6;
|
|
3522
|
-
let a = t.bottom + n,
|
|
3523
|
-
a + s > window.innerHeight - n && (a = t.top - s - n),
|
|
3570
|
+
let a = t.bottom + n, l = t.left + (t.width - i) / 2;
|
|
3571
|
+
a + s > window.innerHeight - n && (a = t.top - s - n), l + i > window.innerWidth - n && (l = window.innerWidth - i - n), l < n && (l = n), this._el.style.top = `${a}px`, this._el.style.left = `${l}px`;
|
|
3524
3572
|
}
|
|
3525
3573
|
// ---------------------------------------------------------------------------
|
|
3526
3574
|
// Actions
|
|
3527
3575
|
// ---------------------------------------------------------------------------
|
|
3528
3576
|
_setFloat(e) {
|
|
3529
3577
|
const t = this._activeWrapper;
|
|
3530
|
-
t && (t.style.float = e, t.style.display = e ? "inline-block" : "", t.style.marginLeft = e === "right" ? "12px" : "", t.style.marginRight = e === "left" ? "12px" : "", this.context.invoke("editor.afterCommand"), this.context.invoke("videoResizer.updateOverlay"),
|
|
3578
|
+
t && (t.style.float = e, t.style.display = e ? "inline-block" : "", t.style.marginLeft = e === "right" ? "12px" : "", t.style.marginRight = e === "left" ? "12px" : "", this.context.invoke("editor.afterCommand"), this.context.invoke("videoResizer.updateOverlay"), requestAnimationFrame(() => {
|
|
3579
|
+
this._activeWrapper && this._positionNear(this._activeWrapper);
|
|
3580
|
+
}));
|
|
3531
3581
|
}
|
|
3532
3582
|
_setCenter() {
|
|
3533
3583
|
const e = this._activeWrapper;
|
|
3534
|
-
e && (e.style.float = "", e.style.display = "block", e.style.marginLeft = "auto", e.style.marginRight = "auto", this.context.invoke("editor.afterCommand"), this.context.invoke("videoResizer.updateOverlay"),
|
|
3584
|
+
e && (e.style.float = "", e.style.display = "block", e.style.marginLeft = "auto", e.style.marginRight = "auto", this.context.invoke("editor.afterCommand"), this.context.invoke("videoResizer.updateOverlay"), requestAnimationFrame(() => {
|
|
3585
|
+
this._activeWrapper && this._positionNear(this._activeWrapper);
|
|
3586
|
+
}));
|
|
3535
3587
|
}
|
|
3536
3588
|
_resetSize() {
|
|
3537
3589
|
const e = this._activeWrapper;
|
|
3538
3590
|
if (!e) return;
|
|
3539
3591
|
const t = e.querySelector("iframe, video");
|
|
3540
|
-
e.style.width = "", e.style.height = "", t && (t.removeAttribute("width"), t.removeAttribute("height"), t.style.width = "", t.style.height = ""), this.context.invoke("editor.afterCommand"), this.context.invoke("videoResizer.updateOverlay"),
|
|
3592
|
+
e.style.width = "", e.style.height = "", t && (t.removeAttribute("width"), t.removeAttribute("height"), t.style.width = "", t.style.height = ""), this.context.invoke("editor.afterCommand"), this.context.invoke("videoResizer.updateOverlay"), requestAnimationFrame(() => {
|
|
3593
|
+
this._activeWrapper && this._positionNear(this._activeWrapper);
|
|
3594
|
+
});
|
|
3541
3595
|
}
|
|
3542
3596
|
_delete() {
|
|
3543
3597
|
const e = this._activeWrapper;
|
|
@@ -3597,7 +3651,7 @@ function Si(o, e) {
|
|
|
3597
3651
|
}
|
|
3598
3652
|
return null;
|
|
3599
3653
|
}
|
|
3600
|
-
const
|
|
3654
|
+
const D = {
|
|
3601
3655
|
rowAbove: '<svg xmlns="http://www.w3.org/2000/svg" width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="3" y="3" width="18" height="18" rx="1"/><line x1="3" y1="12" x2="21" y2="12"/><path d="M12 3v7"/><path d="M9 7l3-4 3 4"/></svg>',
|
|
3602
3656
|
rowBelow: '<svg xmlns="http://www.w3.org/2000/svg" width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="3" y="3" width="18" height="18" rx="1"/><line x1="3" y1="12" x2="21" y2="12"/><path d="M12 12v7"/><path d="M9 17l3 4 3-4"/></svg>',
|
|
3603
3657
|
deleteRow: '<svg xmlns="http://www.w3.org/2000/svg" width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="3" y="3" width="18" height="18" rx="1"/><line x1="3" y1="12" x2="21" y2="12"/><line x1="15" y1="15" x2="21" y2="21"/><line x1="21" y1="15" x2="15" y2="21"/></svg>',
|
|
@@ -3609,7 +3663,7 @@ const H = {
|
|
|
3609
3663
|
rowHeight: '<svg xmlns="http://www.w3.org/2000/svg" width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><line x1="4" y1="7" x2="20" y2="7"/><line x1="4" y1="17" x2="20" y2="17"/><line x1="12" y1="7" x2="12" y2="17"/><path d="M9 10l3-3 3 3"/><path d="M9 14l3 3 3-3"/></svg>',
|
|
3610
3664
|
deleteTable: '<svg xmlns="http://www.w3.org/2000/svg" width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="3" y="3" width="18" height="18" rx="1"/><line x1="3" y1="9" x2="21" y2="9"/><line x1="3" y1="15" x2="21" y2="15"/><line x1="9" y1="3" x2="9" y2="21"/><line x1="15" y1="3" x2="15" y2="21"/><line x1="16" y1="16" x2="22" y2="22" stroke="#ef4444"/><line x1="22" y1="16" x2="16" y2="22" stroke="#ef4444"/></svg>'
|
|
3611
3665
|
};
|
|
3612
|
-
class
|
|
3666
|
+
class Ii {
|
|
3613
3667
|
/** @param {import('../Context.js').Context} context */
|
|
3614
3668
|
constructor(e) {
|
|
3615
3669
|
this.context = e, this._el = null, this._activeTable = null, this._activeCell = null, this._showTimer = null, this._hideTimer = null, this._disposers = [], this._sizePopover = null, this._sizeApply = null, this._sizeTitleEl = null, this._sizeInputEl = null;
|
|
@@ -3624,11 +3678,11 @@ class Ei {
|
|
|
3624
3678
|
const s = t.target.closest("td, th");
|
|
3625
3679
|
s && (this._activeCell = s), this._scheduleShow(i);
|
|
3626
3680
|
}
|
|
3627
|
-
}),
|
|
3681
|
+
}, { passive: !0 }),
|
|
3628
3682
|
d(e, "mouseout", (t) => {
|
|
3629
3683
|
const i = t.relatedTarget;
|
|
3630
3684
|
(!i || !e.contains(i) && !this._el.contains(i) && !(this._sizePopover && this._sizePopover.contains(i))) && this._scheduleHide();
|
|
3631
|
-
}),
|
|
3685
|
+
}, { passive: !0 }),
|
|
3632
3686
|
d(document, "click", (t) => {
|
|
3633
3687
|
this._activeTable && !this._activeTable.contains(t.target) && !this._el.contains(t.target) && !(this._sizePopover && this._sizePopover.contains(t.target)) && this._hide();
|
|
3634
3688
|
})
|
|
@@ -3639,43 +3693,48 @@ class Ei {
|
|
|
3639
3693
|
// ---------------------------------------------------------------------------
|
|
3640
3694
|
_initResize() {
|
|
3641
3695
|
const e = this.context.layoutInfo.editable, t = 6;
|
|
3642
|
-
let i = null, s = null, n = !1, a = null,
|
|
3643
|
-
const
|
|
3696
|
+
let i = null, s = null, n = !1, a = null, l = 0, r = 0, h = 0, p = 0, u = -1, m = null, f = null, g = null, v = null, C = null;
|
|
3697
|
+
const T = () => {
|
|
3644
3698
|
i && (i.style.cursor = "", i = null), s = null;
|
|
3699
|
+
}, k = (y) => {
|
|
3700
|
+
if (n || C !== null) return;
|
|
3701
|
+
const I = y.target, R = y.clientX, B = y.clientY;
|
|
3702
|
+
C = requestAnimationFrame(() => {
|
|
3703
|
+
C = null;
|
|
3704
|
+
const L = I.closest("td, th");
|
|
3705
|
+
if (!L || !e.contains(L)) {
|
|
3706
|
+
T();
|
|
3707
|
+
return;
|
|
3708
|
+
}
|
|
3709
|
+
i && i !== L && (i.style.cursor = "");
|
|
3710
|
+
const F = L.getBoundingClientRect(), q = Math.abs(R - F.right) < t, U = Math.abs(B - F.bottom) < t;
|
|
3711
|
+
q ? (L.style.cursor = "col-resize", i = L, s = "col") : U ? (L.style.cursor = "row-resize", i = L, s = "row") : T();
|
|
3712
|
+
});
|
|
3645
3713
|
}, b = (y) => {
|
|
3646
|
-
|
|
3647
|
-
|
|
3648
|
-
if (!
|
|
3649
|
-
|
|
3650
|
-
|
|
3651
|
-
|
|
3652
|
-
|
|
3653
|
-
|
|
3654
|
-
|
|
3655
|
-
}, C = (y) => {
|
|
3656
|
-
!i || !s || (n = !0, a = s, r = y.clientX, l = y.clientY, f = i.closest("table"), a === "col" ? (h = i.offsetWidth, m = te(i), document.body.style.cursor = "col-resize") : (u = i.closest("tr"), p = u ? u.offsetHeight : 40, document.body.style.cursor = "row-resize"), document.body.style.userSelect = "none", y.preventDefault(), y.stopPropagation());
|
|
3657
|
-
}, T = (y) => {
|
|
3658
|
-
if (n)
|
|
3659
|
-
if (a === "col") {
|
|
3660
|
-
const _ = Math.max(30, h + (y.clientX - r));
|
|
3661
|
-
f && m >= 0 && Array.from(f.querySelectorAll("tr")).forEach((w) => {
|
|
3662
|
-
const k = ne(w, m);
|
|
3663
|
-
k && (k.style.width = `${_}px`, k.style.minWidth = `${_}px`);
|
|
3664
|
-
});
|
|
3714
|
+
!i || !s || (n = !0, a = s, l = y.clientX, r = y.clientY, g = i.closest("table"), a === "col" ? (h = i.offsetWidth, u = te(i), m = u >= 0 ? Array.from(g.querySelectorAll("tr")).map((I) => ne(I, u)).filter(Boolean) : [], document.body.style.cursor = "col-resize") : (f = i.closest("tr"), p = f ? f.offsetHeight : 40, document.body.style.cursor = "row-resize"), document.body.style.userSelect = "none", y.preventDefault(), y.stopPropagation());
|
|
3715
|
+
}, w = (y) => {
|
|
3716
|
+
if (!n || v !== null) return;
|
|
3717
|
+
const I = y.clientX, R = y.clientY;
|
|
3718
|
+
v = requestAnimationFrame(() => {
|
|
3719
|
+
if (v = null, a === "col") {
|
|
3720
|
+
const B = Math.max(30, h + (I - l));
|
|
3721
|
+
for (const L of m)
|
|
3722
|
+
L.style.width = `${B}px`, L.style.minWidth = `${B}px`;
|
|
3665
3723
|
} else {
|
|
3666
|
-
const
|
|
3667
|
-
|
|
3668
|
-
|
|
3669
|
-
|
|
3724
|
+
const B = Math.max(20, p + (R - r));
|
|
3725
|
+
if (f)
|
|
3726
|
+
for (const L of f.cells)
|
|
3727
|
+
L.style.height = `${B}px`, L.style.minHeight = `${B}px`;
|
|
3670
3728
|
}
|
|
3671
|
-
|
|
3672
|
-
|
|
3729
|
+
});
|
|
3730
|
+
}, _ = () => {
|
|
3731
|
+
n && (v !== null && (cancelAnimationFrame(v), v = null), n = !1, document.body.style.userSelect = "", document.body.style.cursor = "", a = null, g = null, f = null, u = -1, m = null, this.context.invoke("editor.afterCommand"));
|
|
3673
3732
|
};
|
|
3674
3733
|
this._disposers.push(
|
|
3675
|
-
d(e, "mousemove",
|
|
3676
|
-
d(e, "mousedown",
|
|
3677
|
-
d(document, "mousemove",
|
|
3678
|
-
d(document, "mouseup",
|
|
3734
|
+
d(e, "mousemove", k),
|
|
3735
|
+
d(e, "mousedown", b),
|
|
3736
|
+
d(document, "mousemove", w),
|
|
3737
|
+
d(document, "mouseup", _)
|
|
3679
3738
|
);
|
|
3680
3739
|
}
|
|
3681
3740
|
destroy() {
|
|
@@ -3690,7 +3749,7 @@ class Ei {
|
|
|
3690
3749
|
role: "toolbar",
|
|
3691
3750
|
"aria-label": "Table actions"
|
|
3692
3751
|
});
|
|
3693
|
-
return e.style.display = "none", this._label = c("span", { class: "an-link-tooltip-url" }), this._label.textContent = "Table", e.appendChild(this._label), e.appendChild(this._sep()), e.appendChild(this._makeBtn(
|
|
3752
|
+
return e.style.display = "none", this._label = c("span", { class: "an-link-tooltip-url" }), this._label.textContent = "Table", e.appendChild(this._label), e.appendChild(this._sep()), e.appendChild(this._makeBtn(D.rowAbove, "Add Row Above", () => this._addRow("above"))), e.appendChild(this._makeBtn(D.rowBelow, "Add Row Below", () => this._addRow("below"))), e.appendChild(this._makeBtn(D.deleteRow, "Delete Row", () => this._deleteRow())), e.appendChild(this._sep()), e.appendChild(this._makeBtn(D.colLeft, "Add Column Left", () => this._addColumn("left"))), e.appendChild(this._makeBtn(D.colRight, "Add Column Right", () => this._addColumn("right"))), e.appendChild(this._makeBtn(D.deleteCol, "Delete Column", () => this._deleteColumn())), e.appendChild(this._sep()), e.appendChild(this._makeBtn(D.mergeCells, "Merge Cells", () => this._mergeCells())), e.appendChild(this._sep()), e.appendChild(this._makeBtn(D.colWidth, "Column Width", () => this._openSizePopover("col"))), e.appendChild(this._makeBtn(D.rowHeight, "Row Height", () => this._openSizePopover("row"))), e.appendChild(this._sep()), e.appendChild(this._makeBtn(D.deleteTable, "Delete Table", () => this._deleteTable(), !0)), this._disposers.push(
|
|
3694
3753
|
d(e, "mouseenter", () => this._clearTimers()),
|
|
3695
3754
|
d(e, "mouseleave", () => {
|
|
3696
3755
|
this._sizePopover && this._sizePopover.style.display !== "none" || this._scheduleHide();
|
|
@@ -3728,7 +3787,9 @@ class Ei {
|
|
|
3728
3787
|
clearTimeout(this._showTimer), this._showTimer = null, !this._hideTimer && (this._hideTimer = setTimeout(() => this._hide(), Ti));
|
|
3729
3788
|
}
|
|
3730
3789
|
_show() {
|
|
3731
|
-
this._activeTable && (this._el.style.display = "flex",
|
|
3790
|
+
this._activeTable && (this._el.style.display = "flex", requestAnimationFrame(() => {
|
|
3791
|
+
this._activeTable && this._positionNear(this._activeTable);
|
|
3792
|
+
}));
|
|
3732
3793
|
}
|
|
3733
3794
|
_hide() {
|
|
3734
3795
|
this._el.style.display = "none", this._activeTable = null, this._activeCell = null, this._clearTimers(), this._hideSizePopover();
|
|
@@ -3739,8 +3800,8 @@ class Ei {
|
|
|
3739
3800
|
_positionNear(e) {
|
|
3740
3801
|
if (!e) return;
|
|
3741
3802
|
const t = e.getBoundingClientRect(), i = this._el.offsetWidth || 400, s = this._el.offsetHeight || 30, n = 6;
|
|
3742
|
-
let a = t.left + (t.width - i) / 2,
|
|
3743
|
-
|
|
3803
|
+
let a = t.left + (t.width - i) / 2, l = t.top - s - n;
|
|
3804
|
+
l < n && (l = t.bottom + n), a + i > window.innerWidth - n && (a = window.innerWidth - i - n), a < n && (a = n), this._el.style.left = `${a}px`, this._el.style.top = `${l}px`;
|
|
3744
3805
|
}
|
|
3745
3806
|
// ---------------------------------------------------------------------------
|
|
3746
3807
|
// Helper: get active cell (fallback to first td/th in table)
|
|
@@ -3760,34 +3821,27 @@ class Ei {
|
|
|
3760
3821
|
// Table operations
|
|
3761
3822
|
// ---------------------------------------------------------------------------
|
|
3762
3823
|
_addRow(e) {
|
|
3763
|
-
var
|
|
3824
|
+
var l;
|
|
3764
3825
|
const t = this._getCell();
|
|
3765
3826
|
if (!t) return;
|
|
3766
3827
|
const i = t.closest("tr");
|
|
3767
3828
|
if (!i) return;
|
|
3768
|
-
const s = Array.from(i.cells).reduce((
|
|
3769
|
-
for (let
|
|
3770
|
-
const h = c("td", {}, [" "]), p = a[
|
|
3829
|
+
const s = Array.from(i.cells).reduce((r, h) => r + (h.colSpan || 1), 0), n = document.createElement("tr"), a = Array.from(i.cells);
|
|
3830
|
+
for (let r = 0; r < s; r++) {
|
|
3831
|
+
const h = c("td", {}, [" "]), p = a[r];
|
|
3771
3832
|
p && p.style.width && (h.style.width = p.style.width), p && p.style.minWidth && (h.style.minWidth = p.style.minWidth), n.appendChild(h);
|
|
3772
3833
|
}
|
|
3773
|
-
e === "above" ? (
|
|
3834
|
+
e === "above" ? (l = i.parentElement) == null || l.insertBefore(n, i) : i.insertAdjacentElement("afterend", n), requestAnimationFrame(() => this._positionNear(this._activeTable)), this.context.invoke("editor.afterCommand");
|
|
3774
3835
|
}
|
|
3775
3836
|
_addColumn(e) {
|
|
3776
3837
|
const t = this._getCell();
|
|
3777
3838
|
if (!t) return;
|
|
3778
3839
|
const i = t.closest("table");
|
|
3779
3840
|
if (!i) return;
|
|
3780
|
-
const s = te(t);
|
|
3781
|
-
|
|
3782
|
-
|
|
3783
|
-
|
|
3784
|
-
const l = ne(n, s);
|
|
3785
|
-
n.insertBefore(r, l);
|
|
3786
|
-
} else {
|
|
3787
|
-
const l = Si(n, s);
|
|
3788
|
-
n.insertBefore(r, l);
|
|
3789
|
-
}
|
|
3790
|
-
}), this._positionNear(this._activeTable), this.context.invoke("editor.afterCommand");
|
|
3841
|
+
const s = te(t), n = Array.from(i.querySelectorAll("tr")), a = n.map((r) => e === "left" ? ne(r, s) : Si(r, s)), l = n.map((r) => r.closest("thead") !== null);
|
|
3842
|
+
n.forEach((r, h) => {
|
|
3843
|
+
r.insertBefore(c(l[h] ? "th" : "td", {}, [" "]), a[h]);
|
|
3844
|
+
}), requestAnimationFrame(() => this._positionNear(this._activeTable)), this.context.invoke("editor.afterCommand");
|
|
3791
3845
|
}
|
|
3792
3846
|
_deleteRow() {
|
|
3793
3847
|
var a;
|
|
@@ -3796,7 +3850,7 @@ class Ei {
|
|
|
3796
3850
|
const t = e.closest("tr"), i = e.closest("table");
|
|
3797
3851
|
if (!t || !i) return;
|
|
3798
3852
|
const s = i.querySelector("tbody");
|
|
3799
|
-
(s ? s.querySelectorAll("tr").length : i.querySelectorAll("tr").length) <= 1 && t.closest("tbody") || (this._activeCell = null, (a = t.parentElement) == null || a.removeChild(t), this._positionNear(this._activeTable), this.context.invoke("editor.afterCommand"));
|
|
3853
|
+
(s ? s.querySelectorAll("tr").length : i.querySelectorAll("tr").length) <= 1 && t.closest("tbody") || (this._activeCell = null, (a = t.parentElement) == null || a.removeChild(t), requestAnimationFrame(() => this._positionNear(this._activeTable)), this.context.invoke("editor.afterCommand"));
|
|
3800
3854
|
}
|
|
3801
3855
|
_deleteColumn() {
|
|
3802
3856
|
const e = this._getCell();
|
|
@@ -3806,10 +3860,11 @@ class Ei {
|
|
|
3806
3860
|
const i = e.closest("tr");
|
|
3807
3861
|
if (i && i.cells.length <= 1) return;
|
|
3808
3862
|
const s = te(e);
|
|
3809
|
-
this._activeCell = null
|
|
3810
|
-
|
|
3811
|
-
|
|
3812
|
-
|
|
3863
|
+
this._activeCell = null;
|
|
3864
|
+
const n = Array.from(t.querySelectorAll("tr"));
|
|
3865
|
+
n.map((l) => ne(l, s)).forEach((l, r) => {
|
|
3866
|
+
l && n[r].removeChild(l);
|
|
3867
|
+
}), requestAnimationFrame(() => this._positionNear(this._activeTable)), this.context.invoke("editor.afterCommand");
|
|
3813
3868
|
}
|
|
3814
3869
|
_mergeCells() {
|
|
3815
3870
|
const e = this._getCell();
|
|
@@ -3818,24 +3873,24 @@ class Ei {
|
|
|
3818
3873
|
if (!t || t.rangeCount === 0) return;
|
|
3819
3874
|
const i = t.getRangeAt(0), s = e.closest("table");
|
|
3820
3875
|
if (!s) return;
|
|
3821
|
-
const a = Array.from(s.querySelectorAll("td, th")).filter((
|
|
3876
|
+
const a = Array.from(s.querySelectorAll("td, th")).filter((r) => {
|
|
3822
3877
|
try {
|
|
3823
|
-
return i.intersectsNode(
|
|
3878
|
+
return i.intersectsNode(r);
|
|
3824
3879
|
} catch {
|
|
3825
3880
|
return !1;
|
|
3826
3881
|
}
|
|
3827
3882
|
});
|
|
3828
3883
|
if (a.length < 2) return;
|
|
3829
|
-
const
|
|
3830
|
-
if (
|
|
3831
|
-
const
|
|
3884
|
+
const l = [...new Set(a.map((r) => r.closest("tr")))];
|
|
3885
|
+
if (l.length === 1) {
|
|
3886
|
+
const r = l[0], h = Array.from(r.cells).filter((u) => a.includes(u));
|
|
3832
3887
|
if (h.length < 2) return;
|
|
3833
3888
|
const p = h[0];
|
|
3834
|
-
p.colSpan = h.reduce((
|
|
3889
|
+
p.colSpan = h.reduce((u, m) => u + (m.colSpan || 1), 0), p.innerHTML = h.map((u) => u.innerHTML).join(""), h.slice(1).forEach((u) => r.removeChild(u));
|
|
3835
3890
|
} else {
|
|
3836
3891
|
if ([...new Set(a.map((p) => te(p)))].length !== 1) return;
|
|
3837
3892
|
const h = a[0];
|
|
3838
|
-
h.rowSpan = a.reduce((p,
|
|
3893
|
+
h.rowSpan = a.reduce((p, u) => p + (u.rowSpan || 1), 0), h.innerHTML = a.map((p) => p.innerHTML).join(""), a.slice(1).forEach((p) => {
|
|
3839
3894
|
p.closest("tr") && p.closest("tr").removeChild(p);
|
|
3840
3895
|
});
|
|
3841
3896
|
}
|
|
@@ -3859,19 +3914,19 @@ class Ei {
|
|
|
3859
3914
|
step: "1"
|
|
3860
3915
|
}), n = c("span", { class: "an-size-unit" }, ["px"]);
|
|
3861
3916
|
i.appendChild(s), i.appendChild(n);
|
|
3862
|
-
const a = c("div", { class: "an-size-popover-actions" }),
|
|
3863
|
-
|
|
3864
|
-
const
|
|
3865
|
-
|
|
3866
|
-
const h = d(
|
|
3867
|
-
const
|
|
3868
|
-
|
|
3869
|
-
}), p = d(
|
|
3870
|
-
|
|
3871
|
-
}),
|
|
3872
|
-
this._sizePopover && this._sizePopover.style.display !== "none" && !this._sizePopover.contains(
|
|
3917
|
+
const a = c("div", { class: "an-size-popover-actions" }), l = c("button", { type: "button", class: "an-btn" });
|
|
3918
|
+
l.textContent = "Cancel";
|
|
3919
|
+
const r = c("button", { type: "button", class: "an-btn an-btn-primary" });
|
|
3920
|
+
r.textContent = "Apply", a.appendChild(l), a.appendChild(r), e.appendChild(t), e.appendChild(i), e.appendChild(a), this._sizeTitleEl = t, this._sizeInputEl = s, this._sizeApply = null;
|
|
3921
|
+
const h = d(r, "click", () => {
|
|
3922
|
+
const v = parseInt(this._sizeInputEl.value, 10);
|
|
3923
|
+
v > 0 && typeof this._sizeApply == "function" && this._sizeApply(v), this._hideSizePopover();
|
|
3924
|
+
}), p = d(l, "click", () => this._hideSizePopover()), u = d(s, "keydown", (v) => {
|
|
3925
|
+
v.key === "Enter" && (v.preventDefault(), r.click()), v.key === "Escape" && this._hideSizePopover();
|
|
3926
|
+
}), m = d(document, "click", (v) => {
|
|
3927
|
+
this._sizePopover && this._sizePopover.style.display !== "none" && !this._sizePopover.contains(v.target) && !this._el.contains(v.target) && this._hideSizePopover();
|
|
3873
3928
|
}), f = d(e, "mouseenter", () => this._clearTimers()), g = d(e, "mouseleave", () => this._scheduleHide());
|
|
3874
|
-
return this._disposers.push(h, p,
|
|
3929
|
+
return this._disposers.push(h, p, u, m, f, g), e;
|
|
3875
3930
|
}
|
|
3876
3931
|
_openSizePopover(e) {
|
|
3877
3932
|
const t = this._getCell();
|
|
@@ -3880,29 +3935,28 @@ class Ei {
|
|
|
3880
3935
|
this._sizeTitleEl.textContent = i ? "Column Width (px)" : "Row Height (px)", this._sizeInputEl.value = i ? t.offsetWidth || 120 : t.closest("tr") && t.closest("tr").offsetHeight || 40, this._sizeApply = (s) => {
|
|
3881
3936
|
if (i) {
|
|
3882
3937
|
const n = t.closest("table"), a = te(t);
|
|
3883
|
-
Array.from(n.querySelectorAll("tr")).forEach((
|
|
3884
|
-
|
|
3885
|
-
l && (l.style.width = `${s}px`, l.style.minWidth = `${s}px`);
|
|
3938
|
+
Array.from(n.querySelectorAll("tr")).map((h) => ne(h, a)).forEach((h) => {
|
|
3939
|
+
h && (h.style.width = `${s}px`, h.style.minWidth = `${s}px`);
|
|
3886
3940
|
});
|
|
3887
3941
|
} else {
|
|
3888
3942
|
const n = t.closest("tr");
|
|
3889
|
-
|
|
3890
|
-
|
|
3891
|
-
|
|
3943
|
+
if (n)
|
|
3944
|
+
for (const a of n.cells)
|
|
3945
|
+
a.style.height = `${s}px`, a.style.minHeight = `${s}px`;
|
|
3892
3946
|
}
|
|
3893
3947
|
this.context.invoke("editor.afterCommand");
|
|
3894
3948
|
}, this._sizePopover.style.display = "block", requestAnimationFrame(() => {
|
|
3895
3949
|
if (!this._sizePopover || !this._el) return;
|
|
3896
3950
|
const s = this._el.getBoundingClientRect(), n = this._sizePopover.offsetWidth || 220, a = this._sizePopover.offsetHeight || 110;
|
|
3897
|
-
let
|
|
3898
|
-
|
|
3951
|
+
let l = s.left, r = s.bottom + 6;
|
|
3952
|
+
l + n > window.innerWidth - 8 && (l = window.innerWidth - n - 8), r + a > window.innerHeight - 8 && (r = s.top - a - 6), this._sizePopover.style.left = `${l}px`, this._sizePopover.style.top = `${r}px`, this._sizeInputEl && (this._sizeInputEl.focus(), this._sizeInputEl.select());
|
|
3899
3953
|
});
|
|
3900
3954
|
}
|
|
3901
3955
|
_hideSizePopover() {
|
|
3902
3956
|
this._sizePopover && (this._sizePopover.style.display = "none"), this._sizeApply = null;
|
|
3903
3957
|
}
|
|
3904
3958
|
}
|
|
3905
|
-
const
|
|
3959
|
+
const Ei = 100, Ri = 180, ae = {
|
|
3906
3960
|
copy: '<svg xmlns="http://www.w3.org/2000/svg" width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="9" y="9" width="13" height="13" rx="2"/><path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"/></svg>',
|
|
3907
3961
|
wrapOn: '<svg xmlns="http://www.w3.org/2000/svg" width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><line x1="3" y1="6" x2="21" y2="6"/><path d="M3 12h15a3 3 0 0 1 0 6H3"/><polyline points="6 15 3 18 6 21"/></svg>',
|
|
3908
3962
|
toParagraph: '<svg xmlns="http://www.w3.org/2000/svg" width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M13 4v16"/><path d="M17 4v16"/><path d="M9 4h8a4 4 0 0 1 0 8H9V4z"/></svg>',
|
|
@@ -4000,7 +4054,7 @@ class Ai {
|
|
|
4000
4054
|
_scheduleShow(e) {
|
|
4001
4055
|
this._activePre === e && this._el.style.display !== "none" || (clearTimeout(this._hideTimer), this._hideTimer = null, clearTimeout(this._showTimer), this._showTimer = setTimeout(() => {
|
|
4002
4056
|
this._activePre = e, this._syncWrapBtn(), this._syncLangSelect(), this._show(e);
|
|
4003
|
-
},
|
|
4057
|
+
}, Ei));
|
|
4004
4058
|
}
|
|
4005
4059
|
_scheduleHide() {
|
|
4006
4060
|
clearTimeout(this._showTimer), this._showTimer = null, !this._hideTimer && (this._hideTimer = setTimeout(() => this._hide(), Ri));
|
|
@@ -4016,8 +4070,8 @@ class Ai {
|
|
|
4016
4070
|
}
|
|
4017
4071
|
_positionNear(e) {
|
|
4018
4072
|
const t = e.getBoundingClientRect(), i = this._el.offsetWidth || 260, s = this._el.offsetHeight || 32, n = 6;
|
|
4019
|
-
let a = t.top - s - n,
|
|
4020
|
-
a < n && (a = t.bottom + n),
|
|
4073
|
+
let a = t.top - s - n, l = t.left + (t.width - i) / 2;
|
|
4074
|
+
a < n && (a = t.bottom + n), l + i > window.innerWidth - n && (l = window.innerWidth - i - n), l < n && (l = n), this._el.style.top = `${a}px`, this._el.style.left = `${l}px`;
|
|
4021
4075
|
}
|
|
4022
4076
|
// ---------------------------------------------------------------------------
|
|
4023
4077
|
// Sync wrap-button active state
|
|
@@ -4666,35 +4720,35 @@ class Mi {
|
|
|
4666
4720
|
autocomplete: "off"
|
|
4667
4721
|
});
|
|
4668
4722
|
this._searchInput = a;
|
|
4669
|
-
const
|
|
4670
|
-
|
|
4671
|
-
const
|
|
4672
|
-
|
|
4673
|
-
}), this._catBar =
|
|
4723
|
+
const l = c("div", { class: "an-icon-cats" }), r = c("button", { type: "button", class: "an-icon-cat active", "data-cat": "all" });
|
|
4724
|
+
r.textContent = "All", l.appendChild(r), Li.forEach(({ id: k, label: b }) => {
|
|
4725
|
+
const w = c("button", { type: "button", class: "an-icon-cat", "data-cat": k });
|
|
4726
|
+
w.textContent = b, l.appendChild(w);
|
|
4727
|
+
}), this._catBar = l;
|
|
4674
4728
|
const h = c("div", { class: "an-emoji-grid" });
|
|
4675
|
-
Bi.forEach(([
|
|
4676
|
-
const
|
|
4729
|
+
Bi.forEach(([k, b, w]) => {
|
|
4730
|
+
const _ = c("button", {
|
|
4677
4731
|
type: "button",
|
|
4678
4732
|
class: "an-emoji-cell",
|
|
4679
|
-
"data-char":
|
|
4680
|
-
"data-keywords":
|
|
4681
|
-
"data-cat":
|
|
4682
|
-
title:
|
|
4733
|
+
"data-char": k,
|
|
4734
|
+
"data-keywords": b,
|
|
4735
|
+
"data-cat": w,
|
|
4736
|
+
title: b.split(" ").slice(0, 2).join(" ")
|
|
4683
4737
|
});
|
|
4684
|
-
|
|
4738
|
+
_.textContent = k, h.appendChild(_);
|
|
4685
4739
|
}), this._grid = h;
|
|
4686
|
-
const p = c("div", { class: "an-dialog-actions" }),
|
|
4687
|
-
|
|
4688
|
-
const
|
|
4689
|
-
|
|
4690
|
-
}),
|
|
4691
|
-
const
|
|
4692
|
-
|
|
4693
|
-
}), T = d(h, "click", (
|
|
4694
|
-
const
|
|
4695
|
-
|
|
4740
|
+
const p = c("div", { class: "an-dialog-actions" }), u = c("button", { type: "button", class: "an-btn" });
|
|
4741
|
+
u.textContent = "Cancel", p.appendChild(u), t.append(i, a, l, h, p), e.appendChild(t);
|
|
4742
|
+
const m = d(n, "click", () => this._close()), f = d(u, "click", () => this._close()), g = d(e, "click", (k) => {
|
|
4743
|
+
k.target === e && this._close();
|
|
4744
|
+
}), v = d(a, "input", () => this._filterEmojis(a.value, this._activeCat)), C = d(l, "click", (k) => {
|
|
4745
|
+
const b = k.target.closest("[data-cat]");
|
|
4746
|
+
b && (this._activeCat = b.dataset.cat, this._updateCatTabs(), this._filterEmojis(this._searchInput.value, this._activeCat));
|
|
4747
|
+
}), T = d(h, "click", (k) => {
|
|
4748
|
+
const b = k.target.closest(".an-emoji-cell");
|
|
4749
|
+
b && this._onEmojiClick(b.dataset.char);
|
|
4696
4750
|
});
|
|
4697
|
-
return this._disposers.push(
|
|
4751
|
+
return this._disposers.push(m, f, g, v, C, T), e;
|
|
4698
4752
|
}
|
|
4699
4753
|
// ---------------------------------------------------------------------------
|
|
4700
4754
|
// Filter
|
|
@@ -4708,7 +4762,7 @@ class Mi {
|
|
|
4708
4762
|
const i = (e || "").trim().toLowerCase();
|
|
4709
4763
|
let s = 0;
|
|
4710
4764
|
this._grid.querySelectorAll(".an-emoji-cell").forEach((a) => {
|
|
4711
|
-
const
|
|
4765
|
+
const l = !t || t === "all" || a.dataset.cat === t, r = !i || a.dataset.keywords.includes(i) || a.dataset.char === i, h = l && r;
|
|
4712
4766
|
a.style.display = h ? "" : "none", h && s++;
|
|
4713
4767
|
});
|
|
4714
4768
|
let n = this._grid.querySelector(".an-icon-empty");
|
|
@@ -4730,7 +4784,7 @@ class Mi {
|
|
|
4730
4784
|
// Open / Close
|
|
4731
4785
|
// ---------------------------------------------------------------------------
|
|
4732
4786
|
_open() {
|
|
4733
|
-
this._dialog && (this._dialog.style.display = "flex", this._removeTrap =
|
|
4787
|
+
this._dialog && (this._dialog.style.display = "flex", this._removeTrap = Q(this._dialog, () => this._close()), setTimeout(() => this._searchInput && this._searchInput.focus(), 50));
|
|
4734
4788
|
}
|
|
4735
4789
|
_close() {
|
|
4736
4790
|
this._dialog && (this._dialog.style.display = "none"), this._removeTrap && (this._removeTrap(), this._removeTrap = null), this._savedRange = null;
|
|
@@ -5027,52 +5081,52 @@ class zi {
|
|
|
5027
5081
|
autocomplete: "off"
|
|
5028
5082
|
});
|
|
5029
5083
|
this._searchInput = a;
|
|
5030
|
-
const
|
|
5031
|
-
|
|
5032
|
-
const
|
|
5033
|
-
|
|
5034
|
-
}), this._catBar =
|
|
5084
|
+
const l = c("div", { class: "an-icon-cats" }), r = c("button", { type: "button", class: "an-icon-cat active", "data-cat": "all" });
|
|
5085
|
+
r.textContent = "All", l.appendChild(r), Ni.forEach(({ id: x, label: A }) => {
|
|
5086
|
+
const M = c("button", { type: "button", class: "an-icon-cat", "data-cat": x });
|
|
5087
|
+
M.textContent = A, l.appendChild(M);
|
|
5088
|
+
}), this._catBar = l;
|
|
5035
5089
|
const h = c("div", { class: "an-icon-grid" });
|
|
5036
|
-
ji.forEach(([x,
|
|
5037
|
-
const
|
|
5038
|
-
ge.textContent = x,
|
|
5090
|
+
ji.forEach(([x, A]) => {
|
|
5091
|
+
const M = c("button", { type: "button", class: "an-icon-cell", "data-name": x, "data-cat": A, title: x }), se = c("i", { class: "fa-solid fa-" + x, "aria-hidden": "true" }), ge = c("span");
|
|
5092
|
+
ge.textContent = x, M.append(se, ge), h.appendChild(M);
|
|
5039
5093
|
}), this._grid = h;
|
|
5040
|
-
const p = c("div", { class: "an-icon-options" }),
|
|
5041
|
-
|
|
5042
|
-
const
|
|
5043
|
-
[["fa-solid", "Solid"], ["fa-regular", "Regular"], ["fa-light", "Light (Pro)"]].forEach(([x,
|
|
5044
|
-
const
|
|
5045
|
-
|
|
5046
|
-
}),
|
|
5094
|
+
const p = c("div", { class: "an-icon-options" }), u = c("label", { class: "an-label" });
|
|
5095
|
+
u.textContent = "Style";
|
|
5096
|
+
const m = c("select", { class: "an-input an-icon-option-select" });
|
|
5097
|
+
[["fa-solid", "Solid"], ["fa-regular", "Regular"], ["fa-light", "Light (Pro)"]].forEach(([x, A]) => {
|
|
5098
|
+
const M = c("option", { value: x });
|
|
5099
|
+
M.textContent = A, m.appendChild(M);
|
|
5100
|
+
}), m.value = "fa-solid", this._styleSelect = m;
|
|
5047
5101
|
const f = c("label", { class: "an-label" });
|
|
5048
5102
|
f.textContent = "Size";
|
|
5049
5103
|
const g = c("select", { class: "an-input an-icon-option-select" });
|
|
5050
|
-
[["", "Inherit"], ["0.75em", "0.75em"], ["1em", "1em"], ["1.25em", "1.25em"], ["1.5em", "1.5em"], ["2em", "2em"], ["3em", "3em"]].forEach(([x,
|
|
5051
|
-
const
|
|
5052
|
-
x === "1em" && (
|
|
5104
|
+
[["", "Inherit"], ["0.75em", "0.75em"], ["1em", "1em"], ["1.25em", "1.25em"], ["1.5em", "1.5em"], ["2em", "2em"], ["3em", "3em"]].forEach(([x, A]) => {
|
|
5105
|
+
const M = c("option", { value: x });
|
|
5106
|
+
x === "1em" && (M.selected = !0), M.textContent = A, g.appendChild(M);
|
|
5053
5107
|
}), this._sizeSelect = g;
|
|
5054
|
-
const
|
|
5055
|
-
|
|
5108
|
+
const v = c("label", { class: "an-label" });
|
|
5109
|
+
v.textContent = "Color";
|
|
5056
5110
|
const C = c("input", { type: "color", class: "an-icon-color", value: "#000000" });
|
|
5057
5111
|
this._colorInput = C;
|
|
5058
|
-
const T = c("label", { class: "an-label an-label-inline an-icon-use-color" }),
|
|
5059
|
-
this._useColorCb =
|
|
5060
|
-
const
|
|
5061
|
-
|
|
5062
|
-
const
|
|
5063
|
-
|
|
5064
|
-
const
|
|
5065
|
-
|
|
5066
|
-
const
|
|
5112
|
+
const T = c("label", { class: "an-label an-label-inline an-icon-use-color" }), k = c("input", { type: "checkbox", checked: "" });
|
|
5113
|
+
this._useColorCb = k, T.append(k, document.createTextNode(" Use color")), p.append(u, m, f, g, v, C, T);
|
|
5114
|
+
const b = c("div", { class: "an-icon-preview" }), w = c("span", { class: "an-icon-preview-hint" });
|
|
5115
|
+
w.textContent = "Select an icon", b.appendChild(w), this._preview = b;
|
|
5116
|
+
const _ = c("div", { class: "an-dialog-actions" }), y = c("button", { type: "button", class: "an-btn an-btn-primary", disabled: "" });
|
|
5117
|
+
y.textContent = "Insert FA Icon";
|
|
5118
|
+
const I = c("button", { type: "button", class: "an-btn" });
|
|
5119
|
+
I.textContent = "Cancel", _.append(y, I), this._insertBtn = y, t.append(i, a, l, h, p, b, _), e.appendChild(t);
|
|
5120
|
+
const R = d(n, "click", () => this._close()), B = d(I, "click", () => this._close()), L = d(y, "click", () => this._onInsert()), F = d(e, "click", (x) => {
|
|
5067
5121
|
x.target === e && this._close();
|
|
5068
|
-
}),
|
|
5069
|
-
const
|
|
5070
|
-
|
|
5071
|
-
}),
|
|
5072
|
-
const
|
|
5073
|
-
|
|
5074
|
-
}), ce = d(
|
|
5075
|
-
return this._disposers.push(
|
|
5122
|
+
}), q = d(a, "input", () => this._filterIcons(a.value, this._activeCat)), U = d(l, "click", (x) => {
|
|
5123
|
+
const A = x.target.closest("[data-cat]");
|
|
5124
|
+
A && (this._activeCat = A.dataset.cat, this._updateCatTabs(), this._filterIcons(this._searchInput.value, this._activeCat));
|
|
5125
|
+
}), z = d(h, "click", (x) => {
|
|
5126
|
+
const A = x.target.closest(".an-icon-cell");
|
|
5127
|
+
A && this._selectIcon(A.dataset.name);
|
|
5128
|
+
}), ce = d(m, "change", () => this._updatePreview(this._selectedIcon)), he = d(g, "change", () => this._updatePreview(this._selectedIcon)), de = d(C, "input", () => this._updatePreview(this._selectedIcon)), Z = d(k, "change", () => this._updatePreview(this._selectedIcon));
|
|
5129
|
+
return this._disposers.push(R, B, L, F, q, U, z, ce, he, de, Z), e;
|
|
5076
5130
|
}
|
|
5077
5131
|
// ---------------------------------------------------------------------------
|
|
5078
5132
|
// Filter / select
|
|
@@ -5086,8 +5140,8 @@ class zi {
|
|
|
5086
5140
|
const i = (e || "").trim().toLowerCase();
|
|
5087
5141
|
let s = 0;
|
|
5088
5142
|
this._grid.querySelectorAll(".an-icon-cell").forEach((a) => {
|
|
5089
|
-
const
|
|
5090
|
-
a.style.display =
|
|
5143
|
+
const l = a.dataset.name, r = a.dataset.cat, h = !t || t === "all" || r === t, p = !i || l.includes(i), u = h && p;
|
|
5144
|
+
a.style.display = u ? "" : "none", u && s++;
|
|
5091
5145
|
});
|
|
5092
5146
|
let n = this._grid.querySelector(".an-icon-empty");
|
|
5093
5147
|
n || (n = c("div", { class: "an-icon-empty" }), n.textContent = "No icons found", this._grid.appendChild(n)), n.style.display = s > 0 ? "none" : "";
|
|
@@ -5119,27 +5173,27 @@ class zi {
|
|
|
5119
5173
|
s ? `color:${s}` : ""
|
|
5120
5174
|
].filter(Boolean), a = document.createElement("i");
|
|
5121
5175
|
a.className = `${e} fa-${this._selectedIcon}`, a.setAttribute("aria-hidden", "true"), a.setAttribute("contenteditable", "false"), n.length && a.setAttribute("style", n.join(";"));
|
|
5122
|
-
const
|
|
5123
|
-
|
|
5176
|
+
const l = this._savedRange, r = this.context.layoutInfo.editable;
|
|
5177
|
+
l && l.select();
|
|
5124
5178
|
const h = window.getSelection();
|
|
5125
5179
|
let p = h && h.rangeCount > 0 ? h.getRangeAt(0) : null;
|
|
5126
|
-
p || (p = document.createRange(), p.selectNodeContents(
|
|
5127
|
-
let
|
|
5128
|
-
!
|
|
5129
|
-
const
|
|
5130
|
-
f.setStart(
|
|
5180
|
+
p || (p = document.createRange(), p.selectNodeContents(r), p.collapse(!1)), p.deleteContents(), p.insertNode(a);
|
|
5181
|
+
let u = a.nextSibling;
|
|
5182
|
+
!u || u.nodeType !== Node.TEXT_NODE ? (u = document.createTextNode(""), a.parentNode.insertBefore(u, a.nextSibling)) : u.textContent || (u.textContent = "");
|
|
5183
|
+
const m = (u.textContent || "").startsWith("") ? 1 : 0, f = document.createRange();
|
|
5184
|
+
f.setStart(u, Math.min(m, u.textContent.length)), f.collapse(!0), h && (h.removeAllRanges(), h.addRange(f)), this._close(), r.focus(), h && (h.removeAllRanges(), h.addRange(f)), this.context.invoke("editor.afterCommand");
|
|
5131
5185
|
}
|
|
5132
5186
|
// ---------------------------------------------------------------------------
|
|
5133
5187
|
// Open / Close
|
|
5134
5188
|
// ---------------------------------------------------------------------------
|
|
5135
5189
|
_open() {
|
|
5136
|
-
this._dialog && (this._dialog.style.display = "flex", this._removeTrap =
|
|
5190
|
+
this._dialog && (this._dialog.style.display = "flex", this._removeTrap = Q(this._dialog, () => this._close()), setTimeout(() => this._searchInput && this._searchInput.focus(), 50));
|
|
5137
5191
|
}
|
|
5138
5192
|
_close() {
|
|
5139
5193
|
this._dialog && (this._dialog.style.display = "none"), this._removeTrap && (this._removeTrap(), this._removeTrap = null), this._savedRange = null, this._selectedIcon = null;
|
|
5140
5194
|
}
|
|
5141
5195
|
}
|
|
5142
|
-
const
|
|
5196
|
+
const N = {
|
|
5143
5197
|
undo: '<svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M3 7v6h6"/><path d="M21 17a9 9 0 0 0-9-9 9 9 0 0 0-6 2.3L3 13"/></svg>',
|
|
5144
5198
|
redo: '<svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M21 7v6h-6"/><path d="M3 17a9 9 0 0 1 9-9 9 9 0 0 1 6 2.3L21 13"/></svg>',
|
|
5145
5199
|
cut: '<svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="6" cy="20" r="3"/><circle cx="6" cy="4" r="3"/><line x1="19" y1="5" x2="6" y2="19"/><line x1="19" y1="19" x2="13.5" y2="13.5"/></svg>',
|
|
@@ -5158,18 +5212,18 @@ const B = {
|
|
|
5158
5212
|
// Table
|
|
5159
5213
|
table: '<svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="3" y="3" width="18" height="18" rx="1"/><line x1="3" y1="9" x2="21" y2="9"/><line x1="3" y1="15" x2="21" y2="15"/><line x1="9" y1="3" x2="9" y2="21"/><line x1="15" y1="3" x2="15" y2="21"/></svg>'
|
|
5160
5214
|
}, Hi = [
|
|
5161
|
-
{ name: "undo", label: "Undo", icon:
|
|
5162
|
-
{ name: "redo", label: "Redo", icon:
|
|
5215
|
+
{ name: "undo", label: "Undo", icon: N.undo, action: (o) => o.invoke("editor.undo") },
|
|
5216
|
+
{ name: "redo", label: "Redo", icon: N.redo, action: (o) => o.invoke("editor.redo") },
|
|
5163
5217
|
{ separator: !0 },
|
|
5164
|
-
{ name: "cut", label: "Cut", icon:
|
|
5165
|
-
{ name: "copy", label: "Copy", icon:
|
|
5166
|
-
{ name: "paste", label: "Paste", icon:
|
|
5218
|
+
{ name: "cut", label: "Cut", icon: N.cut, action: () => document.execCommand("cut") },
|
|
5219
|
+
{ name: "copy", label: "Copy", icon: N.copy, action: () => document.execCommand("copy") },
|
|
5220
|
+
{ name: "paste", label: "Paste", icon: N.paste, action: (o) => {
|
|
5167
5221
|
if (!navigator.clipboard) return;
|
|
5168
5222
|
const e = o.layoutInfo && o.layoutInfo.editable;
|
|
5169
5223
|
if (!e) return;
|
|
5170
5224
|
const t = (i, s) => {
|
|
5171
5225
|
if (e.focus(), i) {
|
|
5172
|
-
const n =
|
|
5226
|
+
const n = G(i);
|
|
5173
5227
|
document.execCommand("insertHTML", !1, n);
|
|
5174
5228
|
} else s && document.execCommand("insertText", !1, s);
|
|
5175
5229
|
o.invoke("editor.afterCommand");
|
|
@@ -5189,20 +5243,20 @@ const B = {
|
|
|
5189
5243
|
});
|
|
5190
5244
|
} },
|
|
5191
5245
|
{ separator: !0 },
|
|
5192
|
-
{ name: "bold", label: "Bold", icon:
|
|
5193
|
-
{ name: "italic", label: "Italic", icon:
|
|
5194
|
-
{ name: "underline", label: "Underline", icon:
|
|
5246
|
+
{ name: "bold", label: "Bold", icon: N.bold, action: (o) => o.invoke("editor.bold") },
|
|
5247
|
+
{ name: "italic", label: "Italic", icon: N.italic, action: (o) => o.invoke("editor.italic") },
|
|
5248
|
+
{ name: "underline", label: "Underline", icon: N.underline, action: (o) => o.invoke("editor.underline") },
|
|
5195
5249
|
{ separator: !0 },
|
|
5196
|
-
{ name: "copyFormat", label: "Copy Format", icon:
|
|
5197
|
-
{ name: "pasteFormat", label: "Paste Format", icon:
|
|
5198
|
-
{ name: "removeFormat", label: "Remove Format", icon:
|
|
5250
|
+
{ name: "copyFormat", label: "Copy Format", icon: N.copyFormat, action: (o) => o.invoke("contextMenu.copyFormat") },
|
|
5251
|
+
{ name: "pasteFormat", label: "Paste Format", icon: N.pasteFormat, action: (o) => o.invoke("contextMenu.pasteFormat"), disabled: (o) => !o.invoke("contextMenu.hasCopiedFormat") },
|
|
5252
|
+
{ name: "removeFormat", label: "Remove Format", icon: N.removeFormat, action: (o) => o.invoke("contextMenu.removeFormat") },
|
|
5199
5253
|
{ separator: !0 },
|
|
5200
|
-
{ name: "link", label: "Insert Link", icon:
|
|
5201
|
-
{ name: "image", label: "Insert Image", icon:
|
|
5202
|
-
{ name: "video", label: "Insert Video", icon:
|
|
5203
|
-
{ name: "table", label: "Insert Table", icon:
|
|
5254
|
+
{ name: "link", label: "Insert Link", icon: N.link, action: (o) => o.invoke("linkDialog.show") },
|
|
5255
|
+
{ name: "image", label: "Insert Image", icon: N.image, action: (o) => o.invoke("imageDialog.show") },
|
|
5256
|
+
{ name: "video", label: "Insert Video", icon: N.video, action: (o) => o.invoke("videoDialog.show") },
|
|
5257
|
+
{ name: "table", label: "Insert Table", icon: N.table, tableGrid: !0 }
|
|
5204
5258
|
];
|
|
5205
|
-
class
|
|
5259
|
+
class Di {
|
|
5206
5260
|
/** @param {import('../Context.js').Context} context */
|
|
5207
5261
|
constructor(e) {
|
|
5208
5262
|
this.context = e, this.options = e.options || {}, this._items = this.options.contextMenu && this.options.contextMenu.items || Hi, this.el = null, this._disposers = [], this._menuDisposers = [], this._lastX = 0, this._lastY = 0, this._copiedFormat = null, this._savedRange = null;
|
|
@@ -5235,75 +5289,75 @@ class Pi {
|
|
|
5235
5289
|
}
|
|
5236
5290
|
if (t.back) {
|
|
5237
5291
|
const n = c("button", { type: "button", class: "an-context-back" }), a = c("span", { class: "an-context-icon", "aria-hidden": "true" });
|
|
5238
|
-
a.innerHTML =
|
|
5239
|
-
const
|
|
5240
|
-
|
|
5292
|
+
a.innerHTML = N.back, n.appendChild(a), n.appendChild(c("span", { class: "an-context-label" }, [t.label || "Back"]));
|
|
5293
|
+
const l = d(n, "click", (r) => {
|
|
5294
|
+
r.stopPropagation(), this._renderItems(t.navigate()), this._reposition();
|
|
5241
5295
|
});
|
|
5242
|
-
this._menuDisposers.push(
|
|
5296
|
+
this._menuDisposers.push(l), this.el.appendChild(n);
|
|
5243
5297
|
return;
|
|
5244
5298
|
}
|
|
5245
5299
|
if (t.navigate) {
|
|
5246
5300
|
const n = c("button", { type: "button", class: "an-context-item an-context-submenu", "data-name": t.name || "" });
|
|
5247
5301
|
if (t.icon) {
|
|
5248
|
-
const
|
|
5249
|
-
|
|
5302
|
+
const r = c("span", { class: "an-context-icon", "aria-hidden": "true" });
|
|
5303
|
+
r.innerHTML = t.icon, n.appendChild(r);
|
|
5250
5304
|
}
|
|
5251
5305
|
n.appendChild(c("span", { class: "an-context-label" }, [t.label || t.name]));
|
|
5252
5306
|
const a = c("span", { class: "an-context-chevron", "aria-hidden": "true" });
|
|
5253
5307
|
a.innerHTML = '<svg xmlns="http://www.w3.org/2000/svg" width="10" height="10" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"><polyline points="9 18 15 12 9 6"/></svg>', n.appendChild(a);
|
|
5254
|
-
const
|
|
5255
|
-
|
|
5308
|
+
const l = d(n, "click", (r) => {
|
|
5309
|
+
r.stopPropagation(), this._renderItems(t.navigate()), this._reposition();
|
|
5256
5310
|
});
|
|
5257
|
-
this._menuDisposers.push(
|
|
5311
|
+
this._menuDisposers.push(l), this.el.appendChild(n);
|
|
5258
5312
|
return;
|
|
5259
5313
|
}
|
|
5260
5314
|
if (t.tableGrid) {
|
|
5261
|
-
const
|
|
5315
|
+
const l = c("div", { class: "an-context-table-wrap" }), r = c("button", { type: "button", class: "an-context-item an-context-submenu", "data-name": t.name || "table" });
|
|
5262
5316
|
if (t.icon) {
|
|
5263
|
-
const
|
|
5264
|
-
|
|
5317
|
+
const w = c("span", { class: "an-context-icon", "aria-hidden": "true" });
|
|
5318
|
+
w.innerHTML = t.icon, r.appendChild(w);
|
|
5265
5319
|
}
|
|
5266
|
-
|
|
5320
|
+
r.appendChild(c("span", { class: "an-context-label" }, [t.label || "Insert Table"]));
|
|
5267
5321
|
const h = c("span", { class: "an-context-chevron", "aria-hidden": "true" });
|
|
5268
|
-
h.innerHTML = '<svg xmlns="http://www.w3.org/2000/svg" width="10" height="10" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"><polyline points="9 18 15 12 9 6"/></svg>',
|
|
5322
|
+
h.innerHTML = '<svg xmlns="http://www.w3.org/2000/svg" width="10" height="10" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"><polyline points="9 18 15 12 9 6"/></svg>', r.appendChild(h);
|
|
5269
5323
|
const p = c("div", { class: "an-context-table-grid-panel" });
|
|
5270
5324
|
p.style.display = "none";
|
|
5271
|
-
const
|
|
5272
|
-
|
|
5273
|
-
const
|
|
5274
|
-
|
|
5325
|
+
const u = c("div", { class: "an-table-grid" });
|
|
5326
|
+
u.style.gridTemplateColumns = "repeat(8, 16px)";
|
|
5327
|
+
const m = c("div", { class: "an-table-label" });
|
|
5328
|
+
m.textContent = "Insert Table";
|
|
5275
5329
|
const f = [];
|
|
5276
|
-
for (let
|
|
5277
|
-
for (let
|
|
5278
|
-
const
|
|
5279
|
-
|
|
5330
|
+
for (let w = 1; w <= 8; w++)
|
|
5331
|
+
for (let _ = 1; _ <= 8; _++) {
|
|
5332
|
+
const y = c("div", { class: "an-table-cell", "data-row": String(w), "data-col": String(_) });
|
|
5333
|
+
y.style.width = "16px", y.style.height = "16px", f.push(y), u.appendChild(y);
|
|
5280
5334
|
}
|
|
5281
|
-
const g = (
|
|
5282
|
-
f.forEach((
|
|
5283
|
-
|
|
5284
|
-
}),
|
|
5335
|
+
const g = (w, _) => {
|
|
5336
|
+
f.forEach((y) => {
|
|
5337
|
+
y.classList.toggle("active", +y.dataset.row <= w && +y.dataset.col <= _);
|
|
5338
|
+
}), m.textContent = w && _ ? `${_} × ${w}` : "Insert Table";
|
|
5285
5339
|
};
|
|
5286
|
-
p.appendChild(
|
|
5287
|
-
let
|
|
5288
|
-
const C = d(
|
|
5289
|
-
|
|
5340
|
+
p.appendChild(u), p.appendChild(m);
|
|
5341
|
+
let v = !1;
|
|
5342
|
+
const C = d(r, "click", (w) => {
|
|
5343
|
+
w.stopPropagation(), v = !v, p.style.display = v ? "" : "none", h.style.transform = v ? "rotate(90deg)" : "", this._reposition();
|
|
5290
5344
|
});
|
|
5291
5345
|
this._menuDisposers.push(C);
|
|
5292
|
-
const T = d(
|
|
5293
|
-
const
|
|
5294
|
-
|
|
5295
|
-
}),
|
|
5296
|
-
const
|
|
5297
|
-
if (!
|
|
5298
|
-
const
|
|
5299
|
-
if (
|
|
5300
|
-
|
|
5301
|
-
const
|
|
5302
|
-
|
|
5346
|
+
const T = d(u, "mousemove", (w) => {
|
|
5347
|
+
const _ = w.target.closest("[data-row]");
|
|
5348
|
+
_ && g(+_.dataset.row, +_.dataset.col);
|
|
5349
|
+
}), k = d(u, "mouseleave", () => g(0, 0)), b = d(u, "click", (w) => {
|
|
5350
|
+
const _ = w.target.closest("[data-row]");
|
|
5351
|
+
if (!_) return;
|
|
5352
|
+
const y = +_.dataset.row, I = +_.dataset.col, R = this.context.layoutInfo && this.context.layoutInfo.editable;
|
|
5353
|
+
if (R && this._savedRange) {
|
|
5354
|
+
R.focus();
|
|
5355
|
+
const B = window.getSelection();
|
|
5356
|
+
B.removeAllRanges(), B.addRange(this._savedRange.cloneRange());
|
|
5303
5357
|
}
|
|
5304
|
-
this.hide(), this.context.invoke("editor.insertTable",
|
|
5358
|
+
this.hide(), this.context.invoke("editor.insertTable", I, y);
|
|
5305
5359
|
});
|
|
5306
|
-
this._menuDisposers.push(T,
|
|
5360
|
+
this._menuDisposers.push(T, k, b), l.appendChild(r), l.appendChild(p), this.el.appendChild(l);
|
|
5307
5361
|
return;
|
|
5308
5362
|
}
|
|
5309
5363
|
const i = c("button", { type: "button", class: "an-context-item", "data-name": t.name || "" });
|
|
@@ -5339,8 +5393,8 @@ class Pi {
|
|
|
5339
5393
|
_reposition(e, t) {
|
|
5340
5394
|
if (!this.el) return;
|
|
5341
5395
|
const i = e !== void 0 ? e : this._lastX, s = t !== void 0 ? t : this._lastY, n = this.el.getBoundingClientRect();
|
|
5342
|
-
let a = i,
|
|
5343
|
-
a + n.width > window.innerWidth && (a = window.innerWidth - n.width - 8),
|
|
5396
|
+
let a = i, l = s;
|
|
5397
|
+
a + n.width > window.innerWidth && (a = window.innerWidth - n.width - 8), l + n.height > window.innerHeight && (l = window.innerHeight - n.height - 8), this.el.style.left = `${a}px`, this.el.style.top = `${l}px`;
|
|
5344
5398
|
}
|
|
5345
5399
|
hide() {
|
|
5346
5400
|
this.el && (this.el.style.display = "none", this.el.setAttribute("aria-hidden", "true"));
|
|
@@ -5398,12 +5452,12 @@ class Pi {
|
|
|
5398
5452
|
const i = window.getSelection();
|
|
5399
5453
|
if (i.removeAllRanges(), i.addRange(this._savedRange.cloneRange()), document.execCommand("removeFormat"), e.bold && document.execCommand("bold"), e.italic && document.execCommand("italic"), e.underline && document.execCommand("underline"), e.strikethrough && document.execCommand("strikeThrough"), e.color && document.execCommand("foreColor", !1, e.color), ((n) => !n || n === "rgba(0, 0, 0, 0)" || n === "transparent")(e.backgroundColor) || document.execCommand("hiliteColor", !1, e.backgroundColor), e.fontFamily && document.execCommand("fontName", !1, e.fontFamily), e.fontSize) {
|
|
5400
5454
|
const n = `fs-${Date.now()}`, a = new Set(t.querySelectorAll('font[size="7"]'));
|
|
5401
|
-
document.execCommand("fontSize", !1, "7"), t.querySelectorAll('font[size="7"]').forEach((
|
|
5402
|
-
a.has(
|
|
5403
|
-
}), t.querySelectorAll(`[data-an-tmp="${n}"]`).forEach((
|
|
5404
|
-
const
|
|
5405
|
-
for (
|
|
5406
|
-
|
|
5455
|
+
document.execCommand("fontSize", !1, "7"), t.querySelectorAll('font[size="7"]').forEach((l) => {
|
|
5456
|
+
a.has(l) || l.setAttribute("data-an-tmp", n);
|
|
5457
|
+
}), t.querySelectorAll(`[data-an-tmp="${n}"]`).forEach((l) => {
|
|
5458
|
+
const r = document.createElement("span");
|
|
5459
|
+
for (r.style.fontSize = e.fontSize, l.parentNode.insertBefore(r, l); l.firstChild; ) r.appendChild(l.firstChild);
|
|
5460
|
+
l.parentNode.removeChild(l);
|
|
5407
5461
|
});
|
|
5408
5462
|
}
|
|
5409
5463
|
this.context.invoke("editor.afterCommand");
|
|
@@ -5417,17 +5471,17 @@ class Pi {
|
|
|
5417
5471
|
const t = window.getSelection();
|
|
5418
5472
|
t.removeAllRanges(), t.addRange(this._savedRange.cloneRange()), document.execCommand("removeFormat");
|
|
5419
5473
|
const i = t.getRangeAt(0), s = i.commonAncestorContainer, n = s.nodeType === Node.TEXT_NODE ? s.parentElement : s, a = document.createNodeIterator(n, NodeFilter.SHOW_ELEMENT);
|
|
5420
|
-
let
|
|
5421
|
-
for (;
|
|
5422
|
-
if (!(!e.contains(
|
|
5474
|
+
let l;
|
|
5475
|
+
for (; l = a.nextNode(); )
|
|
5476
|
+
if (!(!e.contains(l) || l === e))
|
|
5423
5477
|
try {
|
|
5424
|
-
i.intersectsNode(
|
|
5478
|
+
i.intersectsNode(l) && l.removeAttribute("style");
|
|
5425
5479
|
} catch {
|
|
5426
5480
|
}
|
|
5427
5481
|
this.context.invoke("editor.afterCommand");
|
|
5428
5482
|
}
|
|
5429
5483
|
}
|
|
5430
|
-
const
|
|
5484
|
+
const Pi = [
|
|
5431
5485
|
{
|
|
5432
5486
|
category: "Text Formatting",
|
|
5433
5487
|
items: [
|
|
@@ -5484,7 +5538,7 @@ class $i {
|
|
|
5484
5538
|
this._disposers.forEach((e) => e()), this._disposers = [], this._dialog && this._dialog.parentNode && this._dialog.parentNode.removeChild(this._dialog), this._dialog = null;
|
|
5485
5539
|
}
|
|
5486
5540
|
show() {
|
|
5487
|
-
this._dialog && (this._dialog.style.display = "flex", this._removeTrap =
|
|
5541
|
+
this._dialog && (this._dialog.style.display = "flex", this._removeTrap = Q(this._dialog, () => this._close()), setTimeout(() => this._closeBtn && this._closeBtn.focus(), 50));
|
|
5488
5542
|
}
|
|
5489
5543
|
_close() {
|
|
5490
5544
|
this._dialog && (this._dialog.style.display = "none"), this._removeTrap && (this._removeTrap(), this._removeTrap = null);
|
|
@@ -5502,21 +5556,21 @@ class $i {
|
|
|
5502
5556
|
class: "an-icon-close",
|
|
5503
5557
|
"aria-label": "Close"
|
|
5504
5558
|
});
|
|
5505
|
-
n.textContent = "×", this._closeBtn = n, i.append(s, n), t.appendChild(i),
|
|
5559
|
+
n.textContent = "×", this._closeBtn = n, i.append(s, n), t.appendChild(i), Pi.forEach(({ category: r, items: h }) => {
|
|
5506
5560
|
const p = c("div", { class: "an-shortcuts-cat" });
|
|
5507
|
-
p.textContent =
|
|
5508
|
-
const
|
|
5509
|
-
h.forEach(({ keys:
|
|
5510
|
-
const g = c("div", { class: "an-shortcuts-row" }),
|
|
5511
|
-
|
|
5561
|
+
p.textContent = r, t.appendChild(p);
|
|
5562
|
+
const u = c("div", { class: "an-shortcuts-table" });
|
|
5563
|
+
h.forEach(({ keys: m, action: f }) => {
|
|
5564
|
+
const g = c("div", { class: "an-shortcuts-row" }), v = c("span", { class: "an-shortcuts-key" });
|
|
5565
|
+
v.textContent = m;
|
|
5512
5566
|
const C = c("span", { class: "an-shortcuts-action" });
|
|
5513
|
-
C.textContent = f, g.append(
|
|
5514
|
-
}), t.appendChild(
|
|
5567
|
+
C.textContent = f, g.append(v, C), u.appendChild(g);
|
|
5568
|
+
}), t.appendChild(u);
|
|
5515
5569
|
}), e.appendChild(t);
|
|
5516
|
-
const a = d(n, "click", () => this._close()),
|
|
5517
|
-
|
|
5570
|
+
const a = d(n, "click", () => this._close()), l = d(e, "click", (r) => {
|
|
5571
|
+
r.target === e && this._close();
|
|
5518
5572
|
});
|
|
5519
|
-
return this._disposers.push(a,
|
|
5573
|
+
return this._disposers.push(a, l), e;
|
|
5520
5574
|
}
|
|
5521
5575
|
}
|
|
5522
5576
|
class Oi {
|
|
@@ -5554,7 +5608,7 @@ class Oi {
|
|
|
5554
5608
|
this._findInput && this._findInput.focus();
|
|
5555
5609
|
return;
|
|
5556
5610
|
}
|
|
5557
|
-
this._dialog.style.display = "flex", this._removeTrap && (this._removeTrap(), this._removeTrap = null), this._removeTrap =
|
|
5611
|
+
this._dialog.style.display = "flex", this._removeTrap && (this._removeTrap(), this._removeTrap = null), this._removeTrap = Q(this._dialog, () => this._close());
|
|
5558
5612
|
}
|
|
5559
5613
|
}
|
|
5560
5614
|
_close() {
|
|
@@ -5582,49 +5636,49 @@ class Oi {
|
|
|
5582
5636
|
"aria-label": "Close"
|
|
5583
5637
|
});
|
|
5584
5638
|
n.textContent = "×", this._closeBtn = n, i.append(s, n), t.appendChild(i);
|
|
5585
|
-
const a = c("div", { class: "an-fr-find-row" }),
|
|
5639
|
+
const a = c("div", { class: "an-fr-find-row" }), l = c("input", {
|
|
5586
5640
|
type: "text",
|
|
5587
5641
|
class: "an-input",
|
|
5588
5642
|
placeholder: "Find…",
|
|
5589
5643
|
"aria-label": "Search text"
|
|
5590
5644
|
});
|
|
5591
|
-
this._findInput =
|
|
5592
|
-
const
|
|
5645
|
+
this._findInput = l, a.appendChild(l), t.appendChild(a);
|
|
5646
|
+
const r = c("div", { class: "an-fr-options-row" }), h = c("label", { class: "an-label an-label-inline" }), p = c("input", {
|
|
5593
5647
|
type: "checkbox",
|
|
5594
5648
|
"aria-label": "Case sensitive"
|
|
5595
5649
|
});
|
|
5596
5650
|
this._caseCheckbox = p, h.append(p, document.createTextNode(" Case sensitive"));
|
|
5597
|
-
const
|
|
5598
|
-
this._counterEl =
|
|
5599
|
-
const
|
|
5651
|
+
const u = c("span", { class: "an-fr-counter" });
|
|
5652
|
+
this._counterEl = u, r.append(h, u), t.appendChild(r);
|
|
5653
|
+
const m = c("div", { class: "an-dialog-actions an-fr-find-actions" }), f = c("button", { type: "button", class: "an-btn" });
|
|
5600
5654
|
f.textContent = "← Prev";
|
|
5601
5655
|
const g = c("button", { type: "button", class: "an-btn an-btn-primary" });
|
|
5602
|
-
g.textContent = "Next →",
|
|
5603
|
-
const
|
|
5604
|
-
|
|
5656
|
+
g.textContent = "Next →", m.append(f, g), t.appendChild(m);
|
|
5657
|
+
const v = c("div", { class: "an-fr-replace-row" });
|
|
5658
|
+
v.style.display = "none";
|
|
5605
5659
|
const C = c("input", {
|
|
5606
5660
|
type: "text",
|
|
5607
5661
|
class: "an-input",
|
|
5608
5662
|
placeholder: "Replace with…",
|
|
5609
5663
|
"aria-label": "Replace with"
|
|
5610
5664
|
});
|
|
5611
|
-
this._replaceInput = C,
|
|
5665
|
+
this._replaceInput = C, v.appendChild(C), t.appendChild(v);
|
|
5612
5666
|
const T = c("div", { class: "an-dialog-actions an-fr-replace-actions" });
|
|
5613
5667
|
T.style.display = "none";
|
|
5614
|
-
const
|
|
5615
|
-
|
|
5616
|
-
const
|
|
5617
|
-
|
|
5618
|
-
const
|
|
5619
|
-
|
|
5620
|
-
}),
|
|
5668
|
+
const k = c("button", { type: "button", class: "an-btn" });
|
|
5669
|
+
k.textContent = "Replace";
|
|
5670
|
+
const b = c("button", { type: "button", class: "an-btn an-btn-primary" });
|
|
5671
|
+
b.textContent = "Replace All", T.append(k, b), t.appendChild(T), e.appendChild(t);
|
|
5672
|
+
const w = d(n, "click", () => this._close()), _ = d(e, "click", (z) => {
|
|
5673
|
+
z.target === e && this._close();
|
|
5674
|
+
}), y = d(l, "input", () => this._onSearch()), I = d(p, "change", () => {
|
|
5621
5675
|
this._caseSensitive = p.checked, this._onSearch();
|
|
5622
|
-
}),
|
|
5623
|
-
|
|
5624
|
-
}),
|
|
5625
|
-
|
|
5676
|
+
}), R = d(g, "click", () => this._next()), B = d(f, "click", () => this._prev()), L = d(k, "click", () => this._replace()), F = d(b, "click", () => this._replaceAll()), q = d(l, "keydown", (z) => {
|
|
5677
|
+
z.key === "Enter" && (z.preventDefault(), z.shiftKey ? this._prev() : this._next());
|
|
5678
|
+
}), U = d(C, "keydown", (z) => {
|
|
5679
|
+
z.key === "Enter" && (z.preventDefault(), this._replace());
|
|
5626
5680
|
});
|
|
5627
|
-
return this._disposers.push(
|
|
5681
|
+
return this._disposers.push(w, _, y, I, R, B, L, F, q, U), e;
|
|
5628
5682
|
}
|
|
5629
5683
|
// ---------------------------------------------------------------------------
|
|
5630
5684
|
// Search logic
|
|
@@ -5651,12 +5705,12 @@ class Oi {
|
|
|
5651
5705
|
if (i.length !== 0) {
|
|
5652
5706
|
this._currentIndex = 0;
|
|
5653
5707
|
for (let s = i.length - 1; s >= 0; s--) {
|
|
5654
|
-
const { node: n, start: a, end:
|
|
5708
|
+
const { node: n, start: a, end: l } = i[s];
|
|
5655
5709
|
try {
|
|
5656
|
-
const
|
|
5657
|
-
|
|
5710
|
+
const r = document.createRange();
|
|
5711
|
+
r.setStart(n, a), r.setEnd(n, l);
|
|
5658
5712
|
const h = document.createElement("mark");
|
|
5659
|
-
h.className = "an-highlight",
|
|
5713
|
+
h.className = "an-highlight", r.surroundContents(h), this._matches.unshift({ mark: h });
|
|
5660
5714
|
} catch {
|
|
5661
5715
|
this._matches.unshift({ mark: null });
|
|
5662
5716
|
}
|
|
@@ -5671,17 +5725,17 @@ class Oi {
|
|
|
5671
5725
|
* @returns {{ node: Text, start: number, end: number }[]}
|
|
5672
5726
|
*/
|
|
5673
5727
|
_findRawMatches(e, t) {
|
|
5674
|
-
const i = [], s = this._caseSensitive ? "g" : "gi", n = e.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), a = new RegExp(n, s),
|
|
5728
|
+
const i = [], s = this._caseSensitive ? "g" : "gi", n = e.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), a = new RegExp(n, s), l = document.createTreeWalker(
|
|
5675
5729
|
t,
|
|
5676
5730
|
4
|
|
5677
5731
|
/* NodeFilter.SHOW_TEXT */
|
|
5678
5732
|
);
|
|
5679
|
-
let
|
|
5680
|
-
for (;
|
|
5733
|
+
let r;
|
|
5734
|
+
for (; r = l.nextNode(); ) {
|
|
5681
5735
|
a.lastIndex = 0;
|
|
5682
5736
|
let h;
|
|
5683
|
-
for (; (h = a.exec(
|
|
5684
|
-
i.push({ node:
|
|
5737
|
+
for (; (h = a.exec(r.textContent)) !== null; )
|
|
5738
|
+
i.push({ node: r, start: h.index, end: h.index + h[0].length });
|
|
5685
5739
|
}
|
|
5686
5740
|
return i;
|
|
5687
5741
|
}
|
|
@@ -5758,7 +5812,7 @@ class Fi {
|
|
|
5758
5812
|
* @param {import('./settings.js').AsnOptions} [userOptions]
|
|
5759
5813
|
*/
|
|
5760
5814
|
constructor(e, t = {}) {
|
|
5761
|
-
this.targetEl = e, this.options = ue(
|
|
5815
|
+
this.targetEl = e, this.options = ue(K, t), this.layoutInfo = {}, this._listeners = /* @__PURE__ */ new Map(), this._modules = /* @__PURE__ */ new Map(), this._disposers = [], this._alive = !1;
|
|
5762
5816
|
}
|
|
5763
5817
|
// ---------------------------------------------------------------------------
|
|
5764
5818
|
// Initialisation
|
|
@@ -5776,7 +5830,7 @@ class Fi {
|
|
|
5776
5830
|
const s = new i(this);
|
|
5777
5831
|
s.initialize(), this._modules.set(t, s);
|
|
5778
5832
|
};
|
|
5779
|
-
e("editor", ti), e("toolbar", ii), e("statusbar", si), e("clipboard", oi), e("contextMenu",
|
|
5833
|
+
e("editor", ti), e("toolbar", ii), e("statusbar", si), e("clipboard", oi), e("contextMenu", Di), e("placeholder", ni), e("codeview", ai), e("fullscreen", li), e("linkDialog", ri), e("imageDialog", ci), e("videoDialog", hi), e("imageResizer", pi), e("videoResizer", mi), e("linkTooltip", _i), e("imageTooltip", bi), e("videoTooltip", Ci), e("tableTooltip", Ii), e("codeTooltip", Ai), e("emojiDialog", Mi), e("iconDialog", zi), e("shortcutsDialog", $i), e("findReplace", Oi);
|
|
5780
5834
|
for (const [t, i] of Ye)
|
|
5781
5835
|
e(t, i);
|
|
5782
5836
|
}
|
|
@@ -5818,14 +5872,14 @@ class Fi {
|
|
|
5818
5872
|
* @returns {*}
|
|
5819
5873
|
*/
|
|
5820
5874
|
invoke(e, ...t) {
|
|
5821
|
-
var a,
|
|
5875
|
+
var a, l;
|
|
5822
5876
|
const [i, s] = e.split("."), n = this._modules.get(i);
|
|
5823
5877
|
if (!n) {
|
|
5824
5878
|
(typeof process > "u" || ((a = process.env) == null ? void 0 : a.NODE_ENV) !== "production") && console.warn(`[AutumnNote] invoke: module "${i}" not found (path: "${e}")`);
|
|
5825
5879
|
return;
|
|
5826
5880
|
}
|
|
5827
5881
|
if (typeof n[s] != "function") {
|
|
5828
|
-
(typeof process > "u" || ((
|
|
5882
|
+
(typeof process > "u" || ((l = process.env) == null ? void 0 : l.NODE_ENV) !== "production") && console.warn(`[AutumnNote] invoke: method "${s}" not found on module "${i}" (path: "${e}")`);
|
|
5829
5883
|
return;
|
|
5830
5884
|
}
|
|
5831
5885
|
return n[s](...t);
|
|
@@ -6047,10 +6101,10 @@ function Ts(o, e = 1) {
|
|
|
6047
6101
|
function Ss(o) {
|
|
6048
6102
|
return o.reduce((e, t) => e.concat(t), []);
|
|
6049
6103
|
}
|
|
6050
|
-
function
|
|
6104
|
+
function Is(o) {
|
|
6051
6105
|
return [...new Set(o)];
|
|
6052
6106
|
}
|
|
6053
|
-
function
|
|
6107
|
+
function Es(o, e) {
|
|
6054
6108
|
const t = [];
|
|
6055
6109
|
for (let i = 0; i < o.length; i += e)
|
|
6056
6110
|
t.push(o.slice(i, i + e));
|
|
@@ -6068,24 +6122,24 @@ function As(o, e) {
|
|
|
6068
6122
|
function Ls(o, e) {
|
|
6069
6123
|
return o.some(e);
|
|
6070
6124
|
}
|
|
6071
|
-
const
|
|
6125
|
+
const Y = navigator.userAgent, Bs = {
|
|
6072
6126
|
/** True if browser is Chrome */
|
|
6073
|
-
isChrome: /Chrome\//.test(
|
|
6127
|
+
isChrome: /Chrome\//.test(Y),
|
|
6074
6128
|
/** True if browser is Firefox */
|
|
6075
|
-
isFF: /Firefox\//.test(
|
|
6129
|
+
isFF: /Firefox\//.test(Y),
|
|
6076
6130
|
/** True if browser is Safari (not Chrome) */
|
|
6077
|
-
isSafari: /^((?!chrome|android).)*safari/i.test(
|
|
6131
|
+
isSafari: /^((?!chrome|android).)*safari/i.test(Y),
|
|
6078
6132
|
/** True if browser is Edge (Chromium) */
|
|
6079
|
-
isEdge: /Edg\//.test(
|
|
6133
|
+
isEdge: /Edg\//.test(Y),
|
|
6080
6134
|
/** True if running on macOS */
|
|
6081
|
-
isMac: /Macintosh/.test(
|
|
6135
|
+
isMac: /Macintosh/.test(Y),
|
|
6082
6136
|
/** True if running on mobile */
|
|
6083
|
-
isMobile: /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(
|
|
6137
|
+
isMobile: /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(Y),
|
|
6084
6138
|
/** True if touch is supported */
|
|
6085
6139
|
isTouch: "ontouchstart" in window || navigator.maxTouchPoints > 0,
|
|
6086
6140
|
/** Modifier key name depending on platform */
|
|
6087
|
-
modifierKey: /Macintosh/.test(
|
|
6088
|
-
}, Wi = { ...
|
|
6141
|
+
modifierKey: /Macintosh/.test(Y) ? "metaKey" : "ctrlKey"
|
|
6142
|
+
}, Wi = { ...K }, J = /* @__PURE__ */ new WeakMap(), Ms = {
|
|
6089
6143
|
/**
|
|
6090
6144
|
* Creates (or returns existing) editor instance on one or more elements.
|
|
6091
6145
|
*
|
|
@@ -6095,9 +6149,9 @@ const U = navigator.userAgent, Bs = {
|
|
|
6095
6149
|
*/
|
|
6096
6150
|
create(o, e = {}) {
|
|
6097
6151
|
const i = Te(o).map((s) => {
|
|
6098
|
-
if (
|
|
6152
|
+
if (J.has(s)) return J.get(s);
|
|
6099
6153
|
const n = new Fi(s, e);
|
|
6100
|
-
return n.initialize(),
|
|
6154
|
+
return n.initialize(), J.set(s, n), n;
|
|
6101
6155
|
});
|
|
6102
6156
|
return i.length === 1 ? i[0] : i;
|
|
6103
6157
|
},
|
|
@@ -6107,8 +6161,8 @@ const U = navigator.userAgent, Bs = {
|
|
|
6107
6161
|
*/
|
|
6108
6162
|
destroy(o) {
|
|
6109
6163
|
Te(o).forEach((e) => {
|
|
6110
|
-
const t =
|
|
6111
|
-
t && (t.destroy(),
|
|
6164
|
+
const t = J.get(e);
|
|
6165
|
+
t && (t.destroy(), J.delete(e));
|
|
6112
6166
|
});
|
|
6113
6167
|
},
|
|
6114
6168
|
/**
|
|
@@ -6118,19 +6172,19 @@ const U = navigator.userAgent, Bs = {
|
|
|
6118
6172
|
*/
|
|
6119
6173
|
getInstance(o) {
|
|
6120
6174
|
const e = typeof o == "string" ? document.querySelector(o) : o;
|
|
6121
|
-
return e &&
|
|
6175
|
+
return e && J.get(e) || null;
|
|
6122
6176
|
},
|
|
6123
6177
|
/** Returns a shallow copy of the default options (read-only snapshot). */
|
|
6124
6178
|
get defaults() {
|
|
6125
|
-
return { ...
|
|
6179
|
+
return { ...K };
|
|
6126
6180
|
},
|
|
6127
6181
|
/** Merges properties into the global defaults, applied to all future instances. */
|
|
6128
6182
|
setDefaults(o) {
|
|
6129
|
-
Object.assign(
|
|
6183
|
+
Object.assign(K, o);
|
|
6130
6184
|
},
|
|
6131
6185
|
/** Restores global defaults to their original factory values. */
|
|
6132
6186
|
resetDefaults() {
|
|
6133
|
-
Object.keys(
|
|
6187
|
+
Object.keys(K).forEach((o) => delete K[o]), Object.assign(K, Wi);
|
|
6134
6188
|
},
|
|
6135
6189
|
/**
|
|
6136
6190
|
* Registers a custom module to be included in every new editor instance.
|
|
@@ -6162,71 +6216,71 @@ export {
|
|
|
6162
6216
|
lt as boldBtn,
|
|
6163
6217
|
$t as checklistBtn,
|
|
6164
6218
|
os as children,
|
|
6165
|
-
|
|
6166
|
-
|
|
6219
|
+
Es as chunk,
|
|
6220
|
+
qi as clamp,
|
|
6167
6221
|
me as closest,
|
|
6168
|
-
|
|
6222
|
+
_e as closestPara,
|
|
6169
6223
|
jt as codeviewBtn,
|
|
6170
|
-
|
|
6224
|
+
_s as collapsedRange,
|
|
6171
6225
|
Vi as compose,
|
|
6172
6226
|
c as createElement,
|
|
6173
|
-
|
|
6227
|
+
ye as currentRange,
|
|
6174
6228
|
Ke as debounce,
|
|
6175
6229
|
Ms as default,
|
|
6176
|
-
|
|
6177
|
-
|
|
6178
|
-
|
|
6179
|
-
|
|
6230
|
+
K as defaultOptions,
|
|
6231
|
+
qt as defaultToolbar,
|
|
6232
|
+
bs as directionBtn,
|
|
6233
|
+
It as emojiBtn,
|
|
6180
6234
|
Bs as env,
|
|
6181
|
-
|
|
6235
|
+
Dt as findBtn,
|
|
6182
6236
|
ws as findReplaceBtn,
|
|
6183
6237
|
Cs as first,
|
|
6184
6238
|
Ss as flatten,
|
|
6185
6239
|
Bt as fontFamilyBtn,
|
|
6186
6240
|
At as fontSizeBtn,
|
|
6187
6241
|
Ft as foreColorBtn,
|
|
6188
|
-
|
|
6242
|
+
Ie as fromNativeRange,
|
|
6189
6243
|
zt as fullscreenBtn,
|
|
6190
6244
|
Rs as groupBy,
|
|
6191
6245
|
Ct as hrBtn,
|
|
6192
|
-
|
|
6246
|
+
Et as iconBtn,
|
|
6193
6247
|
Xi as identity,
|
|
6194
6248
|
Tt as imageBtn,
|
|
6195
|
-
|
|
6249
|
+
vt as indentBtn,
|
|
6196
6250
|
ks as initial,
|
|
6197
|
-
|
|
6251
|
+
Pt as inlineCodeBtn,
|
|
6198
6252
|
hs as insertAfter,
|
|
6199
6253
|
ts as isAnchor,
|
|
6200
6254
|
tt as isEditable,
|
|
6201
|
-
|
|
6255
|
+
j as isElement,
|
|
6202
6256
|
ps as isEmpty,
|
|
6203
6257
|
Gi as isFunction,
|
|
6204
6258
|
is as isImage,
|
|
6205
6259
|
es as isInline,
|
|
6206
6260
|
fs as isInsideEditable,
|
|
6207
|
-
|
|
6261
|
+
O as isKey,
|
|
6208
6262
|
et as isLi,
|
|
6209
6263
|
Zi as isList,
|
|
6210
|
-
|
|
6264
|
+
H as isModifier,
|
|
6211
6265
|
Yi as isNil,
|
|
6212
6266
|
Je as isPara,
|
|
6213
6267
|
pe as isPlainObject,
|
|
6214
|
-
|
|
6268
|
+
ys as isSelectionInside,
|
|
6215
6269
|
Ki as isString,
|
|
6216
6270
|
Ji as isTable,
|
|
6217
6271
|
Se as isText,
|
|
6218
6272
|
Ze as isVoid,
|
|
6219
6273
|
rt as italicBtn,
|
|
6220
|
-
|
|
6274
|
+
W as key,
|
|
6221
6275
|
xs as last,
|
|
6222
6276
|
Nt as lineHeightBtn,
|
|
6223
6277
|
kt as linkBtn,
|
|
6224
6278
|
ue as mergeDeep,
|
|
6225
6279
|
as as nextElement,
|
|
6226
6280
|
ds as nodeValue,
|
|
6227
|
-
|
|
6281
|
+
yt as olBtn,
|
|
6228
6282
|
d as on,
|
|
6229
|
-
|
|
6283
|
+
bt as outdentBtn,
|
|
6230
6284
|
us as outerHtml,
|
|
6231
6285
|
Mt as paragraphStyleBtn,
|
|
6232
6286
|
ms as placeCaret,
|
|
@@ -6237,21 +6291,21 @@ export {
|
|
|
6237
6291
|
xt as redoBtn,
|
|
6238
6292
|
ls as remove,
|
|
6239
6293
|
Lt as removeFormatBtn,
|
|
6240
|
-
|
|
6241
|
-
|
|
6294
|
+
G as sanitiseHTML,
|
|
6295
|
+
be as sanitiseUrl,
|
|
6242
6296
|
Ht as shortcutsBtn,
|
|
6243
|
-
|
|
6297
|
+
vs as splitText,
|
|
6244
6298
|
ht as strikeBtn,
|
|
6245
6299
|
pt as subscriptBtn,
|
|
6246
6300
|
dt as superscriptBtn,
|
|
6247
6301
|
Rt as tableBtn,
|
|
6248
6302
|
Ts as tail,
|
|
6249
|
-
|
|
6250
|
-
|
|
6251
|
-
|
|
6303
|
+
Ui as throttle,
|
|
6304
|
+
Q as trapFocus,
|
|
6305
|
+
_t as ulBtn,
|
|
6252
6306
|
ct as underlineBtn,
|
|
6253
6307
|
wt as undoBtn,
|
|
6254
|
-
|
|
6308
|
+
Is as unique,
|
|
6255
6309
|
rs as unwrap,
|
|
6256
6310
|
St as videoBtn,
|
|
6257
6311
|
ie as withSavedRange,
|