autumnnote 2.0.0 → 2.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/autumnnote.cjs +20 -20
- package/dist/autumnnote.css +1 -1
- package/dist/autumnnote.es.js +633 -536
- package/dist/autumnnote.es.js.map +1 -1
- package/dist/autumnnote.min.js +20 -20
- package/dist/autumnnote.umd.js +20 -20
- package/dist/autumnnote.umd.js.map +1 -1
- package/package.json +2 -2
- package/src/js/core/env.js +23 -10
- package/src/js/core/sanitise.js +81 -8
- package/src/js/index.js +1 -1
- package/src/js/module/BaseResizer.js +19 -9
- package/src/js/module/TableTooltip.js +91 -220
- package/src/js/module/Toolbar.js +107 -2
- package/src/js/module/table-grid.js +102 -0
- package/src/js/module/table-icons.js +33 -0
- package/src/styles/autumnnote.scss +11 -0
package/dist/autumnnote.es.js
CHANGED
|
@@ -141,7 +141,7 @@ function me(e, t) {
|
|
|
141
141
|
};
|
|
142
142
|
return document.addEventListener("keydown", r), () => document.removeEventListener("keydown", r);
|
|
143
143
|
}
|
|
144
|
-
function
|
|
144
|
+
function he(e, t) {
|
|
145
145
|
e.style.cursor = "grab";
|
|
146
146
|
let n = (n) => {
|
|
147
147
|
if (n.button !== 0 || n.target.closest("button, input, select, textarea, a")) return;
|
|
@@ -163,7 +163,7 @@ function D(e, t) {
|
|
|
163
163
|
}
|
|
164
164
|
//#endregion
|
|
165
165
|
//#region src/js/core/range.js
|
|
166
|
-
var
|
|
166
|
+
var ge = class {
|
|
167
167
|
constructor(e, t, n, r) {
|
|
168
168
|
this.sc = e, this.so = t, this.ec = n, this.eo = r;
|
|
169
169
|
}
|
|
@@ -199,44 +199,44 @@ var he = class {
|
|
|
199
199
|
this.toNativeRange().insertNode(e);
|
|
200
200
|
}
|
|
201
201
|
};
|
|
202
|
-
function ge(e) {
|
|
203
|
-
return new he(e.startContainer, e.startOffset, e.endContainer, e.endOffset);
|
|
204
|
-
}
|
|
205
202
|
function _e(e) {
|
|
203
|
+
return new ge(e.startContainer, e.startOffset, e.endContainer, e.endOffset);
|
|
204
|
+
}
|
|
205
|
+
function ve(e) {
|
|
206
206
|
let t = globalThis.getSelection();
|
|
207
207
|
if (!t || t.rangeCount === 0) return null;
|
|
208
208
|
let n = t.getRangeAt(0);
|
|
209
|
-
return e && !e.contains(n.commonAncestorContainer) ? null :
|
|
209
|
+
return e && !e.contains(n.commonAncestorContainer) ? null : _e(n);
|
|
210
210
|
}
|
|
211
|
-
function
|
|
212
|
-
return new
|
|
211
|
+
function ye(e) {
|
|
212
|
+
return new ge(e, 0, e, e.childNodes.length);
|
|
213
213
|
}
|
|
214
|
-
function
|
|
215
|
-
return new
|
|
214
|
+
function be(e, t = 0) {
|
|
215
|
+
return new ge(e, t, e, t);
|
|
216
216
|
}
|
|
217
|
-
function
|
|
217
|
+
function xe(e) {
|
|
218
218
|
let t = globalThis.getSelection();
|
|
219
219
|
return !t || t.rangeCount === 0 ? !1 : e.contains(t.getRangeAt(0).commonAncestorContainer);
|
|
220
220
|
}
|
|
221
|
-
function
|
|
221
|
+
function Se(e) {
|
|
222
222
|
let t = globalThis.getSelection();
|
|
223
223
|
if (!t || t.rangeCount === 0) {
|
|
224
224
|
e(null);
|
|
225
225
|
return;
|
|
226
226
|
}
|
|
227
227
|
let n = t.getRangeAt(0).cloneRange();
|
|
228
|
-
e(
|
|
228
|
+
e(_e(n)), t.removeAllRanges(), t.addRange(n);
|
|
229
229
|
}
|
|
230
|
-
function
|
|
230
|
+
function Ce(e, t) {
|
|
231
231
|
return [e, e.splitText(t)];
|
|
232
232
|
}
|
|
233
233
|
//#endregion
|
|
234
234
|
//#region src/js/editing/Style.js
|
|
235
|
-
function
|
|
235
|
+
function D(e, t = null) {
|
|
236
236
|
return document.execCommand(e, !1, t);
|
|
237
237
|
}
|
|
238
|
-
var
|
|
239
|
-
function
|
|
238
|
+
var we = () => D("bold"), Te = () => D("italic");
|
|
239
|
+
function Ee() {
|
|
240
240
|
let e = globalThis.getSelection();
|
|
241
241
|
if (!e?.rangeCount) return;
|
|
242
242
|
let t = e.getRangeAt(0).commonAncestorContainer;
|
|
@@ -248,9 +248,9 @@ function Te() {
|
|
|
248
248
|
n.remove();
|
|
249
249
|
return;
|
|
250
250
|
}
|
|
251
|
-
|
|
251
|
+
D("underline");
|
|
252
252
|
}
|
|
253
|
-
function
|
|
253
|
+
function De() {
|
|
254
254
|
let e = globalThis.getSelection();
|
|
255
255
|
if (!e?.rangeCount) return;
|
|
256
256
|
let t = e.getRangeAt(0).startContainer;
|
|
@@ -262,10 +262,10 @@ function Ee() {
|
|
|
262
262
|
n.remove();
|
|
263
263
|
return;
|
|
264
264
|
}
|
|
265
|
-
|
|
265
|
+
D("strikeThrough");
|
|
266
266
|
}
|
|
267
|
-
var
|
|
268
|
-
function
|
|
267
|
+
var Oe = () => D("superscript"), ke = () => D("subscript"), Ae = (e) => D("foreColor", e), je = (e) => D("hiliteColor", e), Me = (e) => D("fontName", e);
|
|
268
|
+
function Ne(e, t = document) {
|
|
269
269
|
let n = globalThis.getSelection(), r = !n?.rangeCount || n.getRangeAt(0).collapsed;
|
|
270
270
|
if (r && n?.rangeCount > 0) {
|
|
271
271
|
try {
|
|
@@ -278,7 +278,7 @@ function Me(e, t = document) {
|
|
|
278
278
|
} catch {}
|
|
279
279
|
return;
|
|
280
280
|
}
|
|
281
|
-
|
|
281
|
+
D("fontSize", "7");
|
|
282
282
|
let i = t instanceof HTMLElement ? t : document, a = [];
|
|
283
283
|
if (i.querySelectorAll("font[size=\"7\"]").forEach((t) => {
|
|
284
284
|
let n = document.createElement("span");
|
|
@@ -292,21 +292,21 @@ function Me(e, t = document) {
|
|
|
292
292
|
} catch {}
|
|
293
293
|
}
|
|
294
294
|
}
|
|
295
|
-
var
|
|
296
|
-
function
|
|
295
|
+
var Pe = (e) => D("formatBlock", `<${e}>`), Fe = () => D("justifyLeft"), Ie = () => D("justifyCenter"), Le = () => D("justifyRight"), Re = () => D("justifyFull"), ze = () => D("indent");
|
|
296
|
+
function Be() {
|
|
297
297
|
let e = globalThis.getSelection();
|
|
298
298
|
if (e?.rangeCount) {
|
|
299
299
|
let t = e.getRangeAt(0).commonAncestorContainer;
|
|
300
300
|
t.nodeType === 3 && (t = t.parentElement);
|
|
301
301
|
let n = t?.closest(".an-checklist li");
|
|
302
302
|
if (n) {
|
|
303
|
-
|
|
303
|
+
Ve(n);
|
|
304
304
|
return;
|
|
305
305
|
}
|
|
306
306
|
}
|
|
307
|
-
|
|
307
|
+
D("outdent");
|
|
308
308
|
}
|
|
309
|
-
function
|
|
309
|
+
function Ve(e) {
|
|
310
310
|
let t = e.closest(".an-checklist");
|
|
311
311
|
if (!t) return;
|
|
312
312
|
let n = Array.from(t.children), r = n.indexOf(e), i = n.slice(r + 1), a = document.createElement("p");
|
|
@@ -323,24 +323,24 @@ function Be(e) {
|
|
|
323
323
|
n && (n.removeAllRanges(), n.addRange(e));
|
|
324
324
|
} catch {}
|
|
325
325
|
}
|
|
326
|
-
function
|
|
326
|
+
function He() {
|
|
327
327
|
let e = globalThis.getSelection();
|
|
328
328
|
if (!e?.rangeCount) return null;
|
|
329
329
|
let t = e.getRangeAt(0).commonAncestorContainer;
|
|
330
330
|
return t.nodeType === 3 && (t = t.parentElement), t?.closest("ul, ol") || null;
|
|
331
331
|
}
|
|
332
|
-
function
|
|
332
|
+
function Ue(e) {
|
|
333
333
|
e.classList.remove("an-checklist"), e.querySelectorAll("input[type=\"checkbox\"]").forEach((e) => e.remove());
|
|
334
334
|
}
|
|
335
|
-
function Ue() {
|
|
336
|
-
let e = Ve();
|
|
337
|
-
e ? e.classList.contains("an-checklist") ? (He(e), e.tagName === "OL" && Je(e, "ul")) : e.tagName === "OL" ? Je(e, "ul") : O("insertUnorderedList") : O("insertUnorderedList");
|
|
338
|
-
}
|
|
339
335
|
function We() {
|
|
340
|
-
let e =
|
|
341
|
-
e ? e.classList.contains("an-checklist") ? (
|
|
336
|
+
let e = He();
|
|
337
|
+
e ? e.classList.contains("an-checklist") ? (Ue(e), e.tagName === "OL" && O(e, "ul")) : e.tagName === "OL" ? O(e, "ul") : D("insertUnorderedList") : D("insertUnorderedList");
|
|
342
338
|
}
|
|
343
|
-
function Ge(
|
|
339
|
+
function Ge() {
|
|
340
|
+
let e = He();
|
|
341
|
+
e ? e.classList.contains("an-checklist") ? (Ue(e), O(e, "ol")) : e.tagName === "UL" ? O(e, "ol") : D("insertOrderedList") : D("insertOrderedList");
|
|
342
|
+
}
|
|
343
|
+
function Ke(e) {
|
|
344
344
|
let t = globalThis.getSelection();
|
|
345
345
|
if (!t || t.rangeCount === 0) return;
|
|
346
346
|
let n = t.getRangeAt(0), r = /* @__PURE__ */ new Set([
|
|
@@ -383,7 +383,7 @@ function Ge(e) {
|
|
|
383
383
|
t.style.lineHeight = e;
|
|
384
384
|
});
|
|
385
385
|
}
|
|
386
|
-
function
|
|
386
|
+
function qe(e) {
|
|
387
387
|
let t = globalThis.getSelection();
|
|
388
388
|
if (!t?.rangeCount) return;
|
|
389
389
|
let n = t.getRangeAt(0), r = n.commonAncestorContainer;
|
|
@@ -415,7 +415,7 @@ function Ke(e) {
|
|
|
415
415
|
}
|
|
416
416
|
}
|
|
417
417
|
}
|
|
418
|
-
function
|
|
418
|
+
function Je() {
|
|
419
419
|
let e = globalThis.getSelection();
|
|
420
420
|
if (!e?.rangeCount) return !1;
|
|
421
421
|
let t = e.getRangeAt(0).startContainer;
|
|
@@ -423,7 +423,7 @@ function qe() {
|
|
|
423
423
|
let n = t?.closest("code");
|
|
424
424
|
return !!(n && !n.closest("pre"));
|
|
425
425
|
}
|
|
426
|
-
function
|
|
426
|
+
function O(e, t) {
|
|
427
427
|
let n = document.createElement(t);
|
|
428
428
|
for (let t of e.attributes) n.setAttribute(t.name, t.value);
|
|
429
429
|
for (; e.firstChild;) n.appendChild(e.firstChild);
|
|
@@ -456,7 +456,7 @@ function Xe() {
|
|
|
456
456
|
}
|
|
457
457
|
}
|
|
458
458
|
} else {
|
|
459
|
-
let t =
|
|
459
|
+
let t = O(r, "ul");
|
|
460
460
|
t.classList.add("an-checklist"), Ye(t);
|
|
461
461
|
let n = t.querySelector("li");
|
|
462
462
|
if (n) {
|
|
@@ -559,13 +559,13 @@ function $e(e) {
|
|
|
559
559
|
function et(e) {
|
|
560
560
|
return Qe.get(e);
|
|
561
561
|
}
|
|
562
|
-
var tt = k("bold", "bold", "Bold (Ctrl+B)", () =>
|
|
562
|
+
var tt = k("bold", "bold", "Bold (Ctrl+B)", () => we(), () => document.queryCommandState("bold")), nt = k("italic", "italic", "Italic (Ctrl+I)", () => Te(), () => document.queryCommandState("italic")), rt = k("underline", "underline", "Underline (Ctrl+U)", () => Ee(), () => {
|
|
563
563
|
if (document.queryCommandState("underline")) return !0;
|
|
564
564
|
let e = globalThis.getSelection();
|
|
565
565
|
if (!e?.rangeCount) return !1;
|
|
566
566
|
let t = e.getRangeAt(0).startContainer;
|
|
567
567
|
return t.nodeType === 3 && (t = t.parentElement), !!t?.closest("u");
|
|
568
|
-
}), it = k("strikethrough", "strikethrough", "Strikethrough", () =>
|
|
568
|
+
}), it = k("strikethrough", "strikethrough", "Strikethrough", () => De(), () => document.queryCommandState("strikeThrough")), at = k("superscript", "superscript", "Superscript", () => Oe(), () => document.queryCommandState("superscript")), ot = k("subscript", "subscript", "Subscript", () => ke(), () => document.queryCommandState("subscript")), st = k("alignLeft", "align-left", "Align Left", () => Fe()), ct = k("alignCenter", "align-center", "Align Center", () => Ie()), lt = k("alignRight", "align-right", "Align Right", () => Le()), ut = k("alignJustify", "align-justify", "Justify", () => Re()), dt = k("ul", "list-ul", "Unordered List", () => We()), ft = k("ol", "list-ol", "Ordered List", () => Ge()), pt = k("indent", "indent", "Indent", () => ze()), mt = k("outdent", "outdent", "Outdent", () => Be()), ht = k("undo", "undo", "Undo (Ctrl+Z)", (e) => e.invoke("editor.undo"), void 0, (e) => !e.invoke("editor.canUndo")), gt = k("redo", "redo", "Redo (Ctrl+Y)", (e) => e.invoke("editor.redo"), void 0, (e) => !e.invoke("editor.canRedo")), _t = k("hr", "minus", "Horizontal Rule", () => D("insertHorizontalRule")), vt = k("link", "link", "Insert Link", (e) => e.invoke("linkDialog.show")), yt = k("image", "image", "Insert Image", (e) => e.invoke("imageDialog.show")), bt = k("video", "video", "Insert Video", (e) => e.invoke("videoDialog.show")), xt = k("emoji", "emoji", "Insert Emoji", (e) => e.invoke("emojiDialog.show")), St = k("icon", "icon", "Insert FA Icon", (e) => e.invoke("iconDialog.show")), Ct = {
|
|
569
569
|
name: "table",
|
|
570
570
|
type: "grid",
|
|
571
571
|
icon: "table",
|
|
@@ -596,7 +596,7 @@ var tt = k("bold", "bold", "Bold (Ctrl+B)", () => Ce(), () => document.queryComm
|
|
|
596
596
|
"48px",
|
|
597
597
|
"72px"
|
|
598
598
|
],
|
|
599
|
-
action: (e, t) =>
|
|
599
|
+
action: (e, t) => Ne(t, e.layoutInfo.editable),
|
|
600
600
|
getValue: (e) => {
|
|
601
601
|
try {
|
|
602
602
|
let t = globalThis.getSelection();
|
|
@@ -612,14 +612,14 @@ var tt = k("bold", "bold", "Bold (Ctrl+B)", () => Ce(), () => document.queryComm
|
|
|
612
612
|
return "";
|
|
613
613
|
}
|
|
614
614
|
}
|
|
615
|
-
}, Tt = k("removeFormat", "remove-format", "Remove Format", () =>
|
|
615
|
+
}, Tt = k("removeFormat", "remove-format", "Remove Format", () => D("removeFormat")), Et = k("direction", "direction", "Toggle Text Direction (LTR / RTL)", (e) => {
|
|
616
616
|
let t = e.layoutInfo.editable, n = (t.getAttribute("dir") || "ltr") === "ltr" ? "rtl" : "ltr";
|
|
617
617
|
t.setAttribute("dir", n), t.style.textAlign = n === "rtl" ? "right" : "left", e.invoke("editor.afterCommand");
|
|
618
618
|
}), Dt = {
|
|
619
619
|
name: "fontFamily",
|
|
620
620
|
type: "select",
|
|
621
621
|
tooltip: "Font Family",
|
|
622
|
-
action: (e, t) =>
|
|
622
|
+
action: (e, t) => Me(t),
|
|
623
623
|
getValue: () => {
|
|
624
624
|
try {
|
|
625
625
|
return document.queryCommandValue("fontName") || "";
|
|
@@ -671,7 +671,7 @@ var tt = k("bold", "bold", "Bold (Ctrl+B)", () => Ce(), () => document.queryComm
|
|
|
671
671
|
label: "Code"
|
|
672
672
|
}
|
|
673
673
|
],
|
|
674
|
-
action: (e, t) =>
|
|
674
|
+
action: (e, t) => Pe(t),
|
|
675
675
|
getValue: () => {
|
|
676
676
|
try {
|
|
677
677
|
let e = document.queryCommandValue("formatBlock").toLowerCase().replace(/[<>]/g, "");
|
|
@@ -695,7 +695,7 @@ var tt = k("bold", "bold", "Bold (Ctrl+B)", () => Ce(), () => document.queryComm
|
|
|
695
695
|
"2.5",
|
|
696
696
|
"3.0"
|
|
697
697
|
],
|
|
698
|
-
action: (e, t) =>
|
|
698
|
+
action: (e, t) => Ke(t),
|
|
699
699
|
getValue: () => {
|
|
700
700
|
try {
|
|
701
701
|
let e = globalThis.getSelection();
|
|
@@ -721,20 +721,20 @@ var tt = k("bold", "bold", "Bold (Ctrl+B)", () => Ce(), () => document.queryComm
|
|
|
721
721
|
return "";
|
|
722
722
|
}
|
|
723
723
|
}
|
|
724
|
-
}, At = k("codeview", "code", "HTML Code View", (e) => e.invoke("codeview.toggle"), (e) => e.invoke("codeview.isActive")), jt = k("fullscreen", "expand", "Fullscreen", (e) => e.invoke("fullscreen.toggle"), (e) => e.invoke("fullscreen.isActive")), Mt = k("shortcuts", "keyboard", "Keyboard Shortcuts (Ctrl+Shift+/)", (e) => e.invoke("shortcutsDialog.show")), Nt = k("find", "search", "Find (Ctrl+F)", (e) => e.invoke("findReplace.show", "find")), Pt = k("findReplace", "find-replace", "Find & Replace (Ctrl+H)", (e) => e.invoke("findReplace.show", "replace")), Ft = k("inlineCode", "inline-code", "Inline Code (Ctrl+`)", (e) => e.invoke("editor.inlineCode"), () =>
|
|
724
|
+
}, At = k("codeview", "code", "HTML Code View", (e) => e.invoke("codeview.toggle"), (e) => e.invoke("codeview.isActive")), jt = k("fullscreen", "expand", "Fullscreen", (e) => e.invoke("fullscreen.toggle"), (e) => e.invoke("fullscreen.isActive")), Mt = k("shortcuts", "keyboard", "Keyboard Shortcuts (Ctrl+Shift+/)", (e) => e.invoke("shortcutsDialog.show")), Nt = k("find", "search", "Find (Ctrl+F)", (e) => e.invoke("findReplace.show", "find")), Pt = k("findReplace", "find-replace", "Find & Replace (Ctrl+H)", (e) => e.invoke("findReplace.show", "replace")), Ft = k("inlineCode", "inline-code", "Inline Code (Ctrl+`)", (e) => e.invoke("editor.inlineCode"), () => Je()), It = k("checklist", "checklist", "Checklist", (e) => e.invoke("editor.toggleChecklist"), () => Ze()), Lt = k("print", "print", "Print", (e) => e.invoke("editor.print")), Rt = {
|
|
725
725
|
name: "foreColor",
|
|
726
726
|
type: "colorpicker",
|
|
727
727
|
icon: "foreColor",
|
|
728
728
|
tooltip: "Text Color",
|
|
729
729
|
defaultColor: "#e11d48",
|
|
730
|
-
action: (e, t) =>
|
|
730
|
+
action: (e, t) => Ae(t)
|
|
731
731
|
}, zt = {
|
|
732
732
|
name: "backColor",
|
|
733
733
|
type: "colorpicker",
|
|
734
734
|
icon: "backColor",
|
|
735
735
|
tooltip: "Highlight Color",
|
|
736
736
|
defaultColor: "#fbbf24",
|
|
737
|
-
action: (e, t) =>
|
|
737
|
+
action: (e, t) => je(t)
|
|
738
738
|
}, Bt = [
|
|
739
739
|
[
|
|
740
740
|
Ot,
|
|
@@ -1310,14 +1310,28 @@ var Gt = [
|
|
|
1310
1310
|
"portal",
|
|
1311
1311
|
"frame",
|
|
1312
1312
|
"frameset",
|
|
1313
|
-
"applet"
|
|
1313
|
+
"applet",
|
|
1314
|
+
"animate",
|
|
1315
|
+
"set",
|
|
1316
|
+
"animatetransform",
|
|
1317
|
+
"animatemotion",
|
|
1318
|
+
"mglyph",
|
|
1319
|
+
"malignmark",
|
|
1320
|
+
"annotation-xml"
|
|
1314
1321
|
], Kt = /* @__PURE__ */ new Set(["button"]), qt = [
|
|
1315
1322
|
"href",
|
|
1316
1323
|
"src",
|
|
1317
1324
|
"action",
|
|
1318
1325
|
"formaction",
|
|
1319
|
-
"xlink:href"
|
|
1326
|
+
"xlink:href",
|
|
1327
|
+
"poster",
|
|
1328
|
+
"background",
|
|
1329
|
+
"srcset"
|
|
1320
1330
|
], Jt = /* @__PURE__ */ new Set([
|
|
1331
|
+
"poster",
|
|
1332
|
+
"background",
|
|
1333
|
+
"srcset"
|
|
1334
|
+
]), Yt = /* @__PURE__ */ new Set(["ping"]), Xt = /* @__PURE__ */ new Set([
|
|
1321
1335
|
"color",
|
|
1322
1336
|
"background-color",
|
|
1323
1337
|
"font-size",
|
|
@@ -1332,23 +1346,23 @@ var Gt = [
|
|
|
1332
1346
|
"border-style",
|
|
1333
1347
|
"border-color",
|
|
1334
1348
|
"padding"
|
|
1335
|
-
]),
|
|
1349
|
+
]), Zt = /url\s*\(|image-set\s*\(|src\s*\(|expression\s*\(|@import|javascript:|vbscript:|behavior\s*:|-moz-binding/i, Qt = /* @__PURE__ */ new Set([
|
|
1336
1350
|
"www.youtube.com",
|
|
1337
1351
|
"youtube.com",
|
|
1338
1352
|
"m.youtube.com",
|
|
1339
1353
|
"www.youtube-nocookie.com",
|
|
1340
1354
|
"youtube-nocookie.com",
|
|
1341
1355
|
"player.vimeo.com"
|
|
1342
|
-
]),
|
|
1356
|
+
]), $t = /* @__PURE__ */ new Set([
|
|
1343
1357
|
"http:",
|
|
1344
1358
|
"https:",
|
|
1345
1359
|
"mailto:",
|
|
1346
1360
|
"tel:"
|
|
1347
|
-
]),
|
|
1361
|
+
]), en = /* @__PURE__ */ new Set([
|
|
1348
1362
|
"http:",
|
|
1349
1363
|
"https:",
|
|
1350
1364
|
"blob:"
|
|
1351
|
-
]),
|
|
1365
|
+
]), tn = /^data:image\/(?:png|jpe?g|gif|webp|avif|bmp);base64,[a-z0-9+/=\s]+$/i, nn = "https://autumnnote.invalid/";
|
|
1352
1366
|
function M(e, { allowIframes: t = !1 } = {}) {
|
|
1353
1367
|
let n = new DOMParser().parseFromString(`<body>${e || ""}</body>`, "text/html"), r = Array.from(n.querySelectorAll("*")), i = new Set(t ? Gt.filter((e) => e !== "iframe") : Gt);
|
|
1354
1368
|
for (let e of r) {
|
|
@@ -1363,7 +1377,7 @@ function M(e, { allowIframes: t = !1 } = {}) {
|
|
|
1363
1377
|
}
|
|
1364
1378
|
if (t === "iframe") {
|
|
1365
1379
|
let t = e.getAttribute("src");
|
|
1366
|
-
if (!t || !
|
|
1380
|
+
if (!t || !on(t)) {
|
|
1367
1381
|
e.remove();
|
|
1368
1382
|
continue;
|
|
1369
1383
|
}
|
|
@@ -1374,28 +1388,35 @@ function M(e, { allowIframes: t = !1 } = {}) {
|
|
|
1374
1388
|
continue;
|
|
1375
1389
|
}
|
|
1376
1390
|
if (t.name === "style") {
|
|
1377
|
-
let n =
|
|
1391
|
+
let n = rn(t.value);
|
|
1378
1392
|
n ? e.setAttribute("style", n) : e.removeAttribute("style");
|
|
1379
1393
|
continue;
|
|
1380
1394
|
}
|
|
1381
|
-
if (
|
|
1382
|
-
|
|
1395
|
+
if (Yt.has(t.name)) {
|
|
1396
|
+
e.removeAttribute(t.name);
|
|
1397
|
+
continue;
|
|
1398
|
+
}
|
|
1399
|
+
if (qt.includes(t.name)) {
|
|
1400
|
+
let n = t.value.trim(), r = Jt.has(t.name) || t.name === "src" && [
|
|
1383
1401
|
"IMG",
|
|
1384
1402
|
"VIDEO",
|
|
1385
1403
|
"AUDIO",
|
|
1386
1404
|
"SOURCE"
|
|
1387
|
-
].includes(e.tagName),
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
|
|
1405
|
+
].includes(e.tagName), i = e.tagName === "IMG";
|
|
1406
|
+
if (!(t.name === "srcset" ? an(n, { allowData: i }) : cn(n, {
|
|
1407
|
+
media: r,
|
|
1408
|
+
allowData: i
|
|
1409
|
+
}))) {
|
|
1410
|
+
e.removeAttribute(t.name);
|
|
1411
|
+
continue;
|
|
1412
|
+
}
|
|
1392
1413
|
}
|
|
1393
1414
|
if (e.tagName === "IFRAME") {
|
|
1394
1415
|
if (t.name === "srcdoc") {
|
|
1395
1416
|
e.removeAttribute(t.name);
|
|
1396
1417
|
continue;
|
|
1397
1418
|
}
|
|
1398
|
-
t.name === "src" && !
|
|
1419
|
+
t.name === "src" && !on(t.value) && e.removeAttribute(t.name);
|
|
1399
1420
|
}
|
|
1400
1421
|
}
|
|
1401
1422
|
if (t === "a" && e.getAttribute("target") === "_blank" && e.setAttribute("rel", "noopener noreferrer"), t === "input") if (!(e.closest("ul.an-checklist") !== null && e.closest("li") !== null) || e.getAttribute("type") !== "checkbox") e.remove();
|
|
@@ -1407,46 +1428,58 @@ function M(e, { allowIframes: t = !1 } = {}) {
|
|
|
1407
1428
|
}
|
|
1408
1429
|
return n.body.innerHTML;
|
|
1409
1430
|
}
|
|
1410
|
-
function
|
|
1431
|
+
function rn(e) {
|
|
1411
1432
|
let t = [];
|
|
1412
1433
|
for (let n of (e || "").split(";")) {
|
|
1413
1434
|
let e = n.indexOf(":");
|
|
1414
1435
|
if (e === -1) continue;
|
|
1415
1436
|
let r = n.slice(0, e).trim().toLowerCase(), i = n.slice(e + 1).trim();
|
|
1416
|
-
!r || !i ||
|
|
1437
|
+
!r || !i || Xt.has(r) && (Zt.test(i) || t.push(`${r}: ${i}`));
|
|
1417
1438
|
}
|
|
1418
1439
|
return t.join("; ");
|
|
1419
1440
|
}
|
|
1420
|
-
function
|
|
1441
|
+
function an(e, { allowData: t = !1 } = {}) {
|
|
1442
|
+
let n = (e || "").trim().split(/\s+/).filter(Boolean);
|
|
1443
|
+
for (let e of n) {
|
|
1444
|
+
if (/^[\d.]+[xw],?$/i.test(e)) continue;
|
|
1445
|
+
let n = e.replace(/,+$/, "");
|
|
1446
|
+
if (n && !cn(n, {
|
|
1447
|
+
media: !0,
|
|
1448
|
+
allowData: t
|
|
1449
|
+
})) return !1;
|
|
1450
|
+
}
|
|
1451
|
+
return !0;
|
|
1452
|
+
}
|
|
1453
|
+
function on(e) {
|
|
1421
1454
|
let t = (e || "").trim();
|
|
1422
1455
|
if (!t || t.startsWith("//") || t.startsWith("/")) return !1;
|
|
1423
1456
|
try {
|
|
1424
1457
|
let e = new URL(t);
|
|
1425
|
-
return e.protocol === "https:" &&
|
|
1458
|
+
return e.protocol === "https:" && Qt.has(e.hostname.toLowerCase());
|
|
1426
1459
|
} catch {
|
|
1427
1460
|
return !1;
|
|
1428
1461
|
}
|
|
1429
1462
|
}
|
|
1430
|
-
function
|
|
1463
|
+
function sn(e, { allowData: t = !1, media: n = t } = {}) {
|
|
1431
1464
|
let r = (e || "").trim();
|
|
1432
|
-
return !r && e == null ? null :
|
|
1465
|
+
return !r && e == null ? null : cn(r, {
|
|
1433
1466
|
media: n,
|
|
1434
1467
|
allowData: t
|
|
1435
1468
|
}) ? e : null;
|
|
1436
1469
|
}
|
|
1437
|
-
function
|
|
1470
|
+
function cn(e, { media: t = !1, allowData: n = !1 } = {}) {
|
|
1438
1471
|
let r = (e || "").trim();
|
|
1439
|
-
if (!r || n &&
|
|
1472
|
+
if (!r || n && tn.test(r)) return !0;
|
|
1440
1473
|
try {
|
|
1441
|
-
let e = new URL(r,
|
|
1442
|
-
return (t ?
|
|
1474
|
+
let e = new URL(r, nn);
|
|
1475
|
+
return (t ? en : $t).has(e.protocol);
|
|
1443
1476
|
} catch {
|
|
1444
1477
|
return !1;
|
|
1445
1478
|
}
|
|
1446
1479
|
}
|
|
1447
1480
|
//#endregion
|
|
1448
1481
|
//#region src/js/renderer.js
|
|
1449
|
-
function
|
|
1482
|
+
function ln(e, t) {
|
|
1450
1483
|
let n = w("div", { class: "an-container" }), r = w("div", {
|
|
1451
1484
|
class: "an-editable",
|
|
1452
1485
|
contenteditable: t.readOnly ? "false" : "true",
|
|
@@ -1469,7 +1502,7 @@ function on(e, t) {
|
|
|
1469
1502
|
}
|
|
1470
1503
|
//#endregion
|
|
1471
1504
|
//#region src/js/editing/History.js
|
|
1472
|
-
var
|
|
1505
|
+
var un = class {
|
|
1473
1506
|
constructor(e, t = 100, n = 10 * 1024 * 1024) {
|
|
1474
1507
|
this.editable = e, this._limit = t, this._maxBytes = n, this._bytes = 0, this.stack = [], this.stackOffset = -1, this._savePoint();
|
|
1475
1508
|
}
|
|
@@ -1590,7 +1623,7 @@ var sn = class {
|
|
|
1590
1623
|
};
|
|
1591
1624
|
//#endregion
|
|
1592
1625
|
//#region src/js/editing/Table.js
|
|
1593
|
-
function
|
|
1626
|
+
function dn(e, t, n = {}) {
|
|
1594
1627
|
let { headerRow: r = !1 } = n, i = w("table", { class: "an-table" });
|
|
1595
1628
|
if (r && t > 0) {
|
|
1596
1629
|
let t = w("thead"), n = w("tr");
|
|
@@ -1612,9 +1645,9 @@ function cn(e, t, n = {}) {
|
|
|
1612
1645
|
}
|
|
1613
1646
|
return i;
|
|
1614
1647
|
}
|
|
1615
|
-
function
|
|
1648
|
+
function fn(e, t, n = {}) {
|
|
1616
1649
|
if (e <= 0 || t <= 0) return;
|
|
1617
|
-
let r =
|
|
1650
|
+
let r = dn(e, t, n), i = globalThis.getSelection();
|
|
1618
1651
|
if (!i || i.rangeCount === 0) return;
|
|
1619
1652
|
let a = i.getRangeAt(0);
|
|
1620
1653
|
try {
|
|
@@ -1702,8 +1735,8 @@ function F(e, t) {
|
|
|
1702
1735
|
}
|
|
1703
1736
|
//#endregion
|
|
1704
1737
|
//#region src/js/editing/Typing.js
|
|
1705
|
-
var
|
|
1706
|
-
function
|
|
1738
|
+
var pn = /\bfa-/, I = (e) => !!(e?.nodeName === "I" && pn.test(e.className || "")), mn = (e) => e?.nodeType === Node.TEXT_NODE && (e.textContent === "" || e.textContent === "");
|
|
1739
|
+
function hn(e, t) {
|
|
1707
1740
|
try {
|
|
1708
1741
|
let n = document.createRange();
|
|
1709
1742
|
return n.setStart(e.startContainer, e.startOffset), n.setEnd(t, t.childNodes.length), n.extractContents();
|
|
@@ -1711,7 +1744,7 @@ function fn(e, t) {
|
|
|
1711
1744
|
return document.createDocumentFragment();
|
|
1712
1745
|
}
|
|
1713
1746
|
}
|
|
1714
|
-
function
|
|
1747
|
+
function gn(e, t, n = {}) {
|
|
1715
1748
|
let r = (e) => {
|
|
1716
1749
|
let t = globalThis.getSelection();
|
|
1717
1750
|
if (!t) return !1;
|
|
@@ -1745,7 +1778,7 @@ function pn(e, t, n = {}) {
|
|
|
1745
1778
|
if (i.nodeType === Node.TEXT_NODE) {
|
|
1746
1779
|
let t = i;
|
|
1747
1780
|
if (a && n.startOffset === 1 && t.textContent === "" && I(t.previousSibling) || a && n.startOffset === 0 && I(t.previousSibling)) return e.preventDefault(), r((e) => e.setStartBefore(t.previousSibling));
|
|
1748
|
-
if (a && n.startOffset === 0 &&
|
|
1781
|
+
if (a && n.startOffset === 0 && mn(t.previousSibling) && I(t.previousSibling.previousSibling)) return e.preventDefault(), r((e) => e.setStartBefore(t.previousSibling.previousSibling));
|
|
1749
1782
|
if (!a && n.startOffset === t.textContent.length && I(t.nextSibling)) {
|
|
1750
1783
|
let n = t.nextSibling, i = n.nextSibling;
|
|
1751
1784
|
if (e.preventDefault(), i?.nodeType === Node.TEXT_NODE) {
|
|
@@ -1754,7 +1787,7 @@ function pn(e, t, n = {}) {
|
|
|
1754
1787
|
}
|
|
1755
1788
|
return r((e) => e.setStartAfter(n));
|
|
1756
1789
|
}
|
|
1757
|
-
if (!a && n.startOffset === t.textContent.length &&
|
|
1790
|
+
if (!a && n.startOffset === t.textContent.length && mn(t.nextSibling) && I(t.nextSibling.nextSibling)) {
|
|
1758
1791
|
let n = t.nextSibling.nextSibling, i = n.nextSibling;
|
|
1759
1792
|
if (e.preventDefault(), i?.nodeType === Node.TEXT_NODE) {
|
|
1760
1793
|
let e = +!!(i.textContent || "").startsWith("");
|
|
@@ -1768,7 +1801,7 @@ function pn(e, t, n = {}) {
|
|
|
1768
1801
|
if (a && n.startOffset > 0) {
|
|
1769
1802
|
let i = t.childNodes[n.startOffset - 1];
|
|
1770
1803
|
if (I(i)) return e.preventDefault(), r((e) => e.setStartBefore(i));
|
|
1771
|
-
if (
|
|
1804
|
+
if (mn(i) && I(i.previousSibling)) return e.preventDefault(), r((e) => e.setStartBefore(i.previousSibling));
|
|
1772
1805
|
}
|
|
1773
1806
|
if (!a && n.startOffset < t.childNodes.length) {
|
|
1774
1807
|
let i = t.childNodes[n.startOffset];
|
|
@@ -1780,7 +1813,7 @@ function pn(e, t, n = {}) {
|
|
|
1780
1813
|
}
|
|
1781
1814
|
return r((e) => e.setStartAfter(i));
|
|
1782
1815
|
}
|
|
1783
|
-
if (
|
|
1816
|
+
if (mn(i) && I(i.nextSibling)) {
|
|
1784
1817
|
let t = i.nextSibling, n = t.nextSibling;
|
|
1785
1818
|
if (e.preventDefault(), n?.nodeType === Node.TEXT_NODE) {
|
|
1786
1819
|
let e = +!!(n.textContent || "").startsWith("");
|
|
@@ -1792,16 +1825,16 @@ function pn(e, t, n = {}) {
|
|
|
1792
1825
|
}
|
|
1793
1826
|
}
|
|
1794
1827
|
if (P(e, N.TAB)) {
|
|
1795
|
-
let r =
|
|
1828
|
+
let r = ve(t);
|
|
1796
1829
|
if (!r) return !1;
|
|
1797
1830
|
let i = C(r.sc, t);
|
|
1798
|
-
if (i && _(i)) return e.preventDefault(), e.shiftKey ?
|
|
1799
|
-
if (i?.nodeName.toUpperCase() === "PRE") return e.shiftKey ? !1 : (e.preventDefault(),
|
|
1800
|
-
if (n.tabSize) return e.shiftKey ? !1 : (e.preventDefault(),
|
|
1831
|
+
if (i && _(i)) return e.preventDefault(), e.shiftKey ? Be() : D("indent"), !0;
|
|
1832
|
+
if (i?.nodeName.toUpperCase() === "PRE") return e.shiftKey ? !1 : (e.preventDefault(), D("insertText", " ".repeat(n.tabSize || 4)), !0);
|
|
1833
|
+
if (n.tabSize) return e.shiftKey ? !1 : (e.preventDefault(), D("insertText", " ".repeat(n.tabSize)), !0);
|
|
1801
1834
|
}
|
|
1802
|
-
if (P(e, N.ENTER) && e.shiftKey) return e.preventDefault(),
|
|
1835
|
+
if (P(e, N.ENTER) && e.shiftKey) return e.preventDefault(), D("insertLineBreak"), !0;
|
|
1803
1836
|
if (P(e, N.ENTER) && !e.shiftKey) {
|
|
1804
|
-
let n =
|
|
1837
|
+
let n = ve(t);
|
|
1805
1838
|
if (!n) return !1;
|
|
1806
1839
|
let r = n.sc, i = r.nodeType === 3 ? r.parentElement : r;
|
|
1807
1840
|
if (i?.nodeName === "I" && /\bfa-/.test(i.className || "")) {
|
|
@@ -1834,7 +1867,7 @@ function pn(e, t, n = {}) {
|
|
|
1834
1867
|
if (r.deleteContents(), n.rangeCount === 0 || !o.isConnected) return !0;
|
|
1835
1868
|
r = n.getRangeAt(0);
|
|
1836
1869
|
}
|
|
1837
|
-
let i =
|
|
1870
|
+
let i = hn(r, o), a = document.createElement("li"), s = document.createElement("input");
|
|
1838
1871
|
s.type = "checkbox", s.setAttribute("contenteditable", "false"), a.appendChild(s), i.textContent.replace(/[\u00a0\u200B]/g, "").length > 0 && a.appendChild(i);
|
|
1839
1872
|
let c = a.childNodes[1];
|
|
1840
1873
|
c?.nodeType !== Node.TEXT_NODE && (c = document.createTextNode(""), a.appendChild(c)), o.after(a);
|
|
@@ -1842,26 +1875,26 @@ function pn(e, t, n = {}) {
|
|
|
1842
1875
|
return l.setStart(c, 0), l.collapse(!0), n.removeAllRanges(), n.addRange(l), !0;
|
|
1843
1876
|
}
|
|
1844
1877
|
let s = C(n.sc, t);
|
|
1845
|
-
if (s?.nodeName.toUpperCase() === "PRE") return e.preventDefault(),
|
|
1878
|
+
if (s?.nodeName.toUpperCase() === "PRE") return e.preventDefault(), D("insertText", "\n"), !0;
|
|
1846
1879
|
if (s?.nodeName.toUpperCase() === "BLOCKQUOTE") {
|
|
1847
1880
|
let t = n.toNativeRange();
|
|
1848
|
-
if (t.setEnd(s, s.childNodes.length), t.toString() === "" && n.isCollapsed()) return e.preventDefault(),
|
|
1881
|
+
if (t.setEnd(s, s.childNodes.length), t.toString() === "" && n.isCollapsed()) return e.preventDefault(), D("formatBlock", "<p>"), !0;
|
|
1849
1882
|
}
|
|
1850
1883
|
}
|
|
1851
1884
|
return !1;
|
|
1852
1885
|
}
|
|
1853
1886
|
//#endregion
|
|
1854
1887
|
//#region src/js/core/markdown.js
|
|
1855
|
-
function
|
|
1856
|
-
return
|
|
1888
|
+
function _n(e) {
|
|
1889
|
+
return yn(new DOMParser().parseFromString(`<body>${e || ""}</body>`, "text/html").body).replace(/\n{3,}/g, "\n\n").trim();
|
|
1857
1890
|
}
|
|
1858
|
-
function
|
|
1891
|
+
function vn(e, t) {
|
|
1859
1892
|
return Array.from(e.children).filter((e) => e.tagName === t.toUpperCase());
|
|
1860
1893
|
}
|
|
1861
|
-
function
|
|
1894
|
+
function yn(e, t = 0) {
|
|
1862
1895
|
if (e.nodeType === 3) return e.textContent.replace(/\s+/g, " ");
|
|
1863
1896
|
if (e.nodeType !== 1) return "";
|
|
1864
|
-
let n = e, r = n.nodeName.toLowerCase(), i = () => Array.from(n.childNodes).map((e) =>
|
|
1897
|
+
let n = e, r = n.nodeName.toLowerCase(), i = () => Array.from(n.childNodes).map((e) => yn(e, t)).join("");
|
|
1865
1898
|
switch (r) {
|
|
1866
1899
|
case "p":
|
|
1867
1900
|
case "div": return `\n\n${i()}\n\n`;
|
|
@@ -1904,18 +1937,18 @@ function gn(e, t = 0) {
|
|
|
1904
1937
|
return ``;
|
|
1905
1938
|
}
|
|
1906
1939
|
case "ul": {
|
|
1907
|
-
let e =
|
|
1940
|
+
let e = vn(n, "li");
|
|
1908
1941
|
if (!e.length) return i();
|
|
1909
1942
|
let r = " ".repeat(t), a = n.classList.contains("an-checklist"), o = e.map((e) => {
|
|
1910
|
-
let n =
|
|
1911
|
-
return (a || n) && (i = n && n.checked ? "- [x] " : "- [ ] "), `${r}${i}${
|
|
1943
|
+
let n = vn(e, "input").find((e) => e.getAttribute("type") === "checkbox"), i = "- ";
|
|
1944
|
+
return (a || n) && (i = n && n.checked ? "- [x] " : "- [ ] "), `${r}${i}${yn(e, t + 1).trim()}`;
|
|
1912
1945
|
}).join("\n");
|
|
1913
1946
|
return t === 0 ? `\n\n${o}\n\n` : `\n${o}`;
|
|
1914
1947
|
}
|
|
1915
1948
|
case "ol": {
|
|
1916
|
-
let e =
|
|
1949
|
+
let e = vn(n, "li");
|
|
1917
1950
|
if (!e.length) return i();
|
|
1918
|
-
let r = " ".repeat(t), a = e.map((e, n) => `${r}${n + 1}. ${
|
|
1951
|
+
let r = " ".repeat(t), a = e.map((e, n) => `${r}${n + 1}. ${yn(e, t + 1).trim()}`).join("\n");
|
|
1919
1952
|
return t === 0 ? `\n\n${a}\n\n` : `\n${a}`;
|
|
1920
1953
|
}
|
|
1921
1954
|
case "li": return i();
|
|
@@ -1923,7 +1956,7 @@ function gn(e, t = 0) {
|
|
|
1923
1956
|
case "table": {
|
|
1924
1957
|
let e = Array.from(n.querySelectorAll("tr"));
|
|
1925
1958
|
if (!e.length) return i();
|
|
1926
|
-
let t = !!
|
|
1959
|
+
let t = !!vn(n, "thead")[0] || e[0].children.length > 0 && Array.from(e[0].children).every((e) => e.tagName === "TH"), r = e.map((e) => Array.from(e.querySelectorAll("th, td")).map((e) => e.textContent.trim().replaceAll("|", String.raw`\|`))), a = Math.max(...r.map((e) => e.length)), o = (e) => {
|
|
1927
1960
|
let t = [...e];
|
|
1928
1961
|
for (; t.length < a;) t.push("");
|
|
1929
1962
|
return t;
|
|
@@ -1935,28 +1968,28 @@ function gn(e, t = 0) {
|
|
|
1935
1968
|
default: return i();
|
|
1936
1969
|
}
|
|
1937
1970
|
}
|
|
1938
|
-
function
|
|
1971
|
+
function bn(e) {
|
|
1939
1972
|
return /^#{1,6} [^\s]|^[ \t]*[-*+] [^\s]|^[ \t]*\d+\. [^\s]|^> ?[^\s]|^```|^\*{2}[^*\n]+\*{2}/m.test(e) || /^.+\n=+\s*$/m.test(e) || /^.+\n-{2,}\s*$/m.test(e) || /^---\s*\n(?:[\s\S]*?\n)?(?:---|\.\.\.)\s*(?:\n|$)/.test(e) || /^\|.+\|[ \t]*\n\|[ \t:|-]+\|/m.test(e);
|
|
1940
1973
|
}
|
|
1941
|
-
var
|
|
1942
|
-
function
|
|
1974
|
+
var xn = /^ {0,3}>( ?)(.*)$/, Sn = /^ {0,3}([-*_])( *\1){2,}\s*$/, Cn = "";
|
|
1975
|
+
function wn(e) {
|
|
1943
1976
|
let t = e.replaceAll("\r\n", "\n").replaceAll("\r", "\n").split("\n");
|
|
1944
|
-
t =
|
|
1945
|
-
let n =
|
|
1946
|
-
return t = n.clean,
|
|
1977
|
+
t = On(t);
|
|
1978
|
+
let n = kn(t);
|
|
1979
|
+
return t = n.clean, En = n.linkDefs, Dn = n.footnoteIds, Tn(t);
|
|
1947
1980
|
}
|
|
1948
|
-
function
|
|
1981
|
+
function Tn(e) {
|
|
1949
1982
|
let t = [], n = 0;
|
|
1950
1983
|
for (; n < e.length;) {
|
|
1951
1984
|
let r = e[n], i = /^```(\S*)$/.exec(r);
|
|
1952
1985
|
if (i) {
|
|
1953
1986
|
let r = i[1], a = [];
|
|
1954
|
-
for (n++; n < e.length && !e[n].startsWith("```");) a.push(
|
|
1987
|
+
for (n++; n < e.length && !e[n].startsWith("```");) a.push(Bn(e[n])), n++;
|
|
1955
1988
|
let o = r ? ` class="language-${R(r)}"` : "";
|
|
1956
1989
|
t.push(`<pre><code${o}>${a.join("\n")}</code></pre>`), n++;
|
|
1957
1990
|
continue;
|
|
1958
1991
|
}
|
|
1959
|
-
if (r.trim() && !
|
|
1992
|
+
if (r.trim() && !Sn.test(r) && !/^#{1,6} /.test(r) && n + 1 < e.length) {
|
|
1960
1993
|
if (/^=+\s*$/.test(e[n + 1])) {
|
|
1961
1994
|
t.push(`<h1>${L(r.trim())}</h1>`), n += 2;
|
|
1962
1995
|
continue;
|
|
@@ -1966,7 +1999,7 @@ function Sn(e) {
|
|
|
1966
1999
|
continue;
|
|
1967
2000
|
}
|
|
1968
2001
|
}
|
|
1969
|
-
if (
|
|
2002
|
+
if (Sn.test(r)) {
|
|
1970
2003
|
t.push("<hr>"), n++;
|
|
1971
2004
|
continue;
|
|
1972
2005
|
}
|
|
@@ -1976,19 +2009,19 @@ function Sn(e) {
|
|
|
1976
2009
|
t.push(`<h${e}>${L(r)}</h${e}>`), n++;
|
|
1977
2010
|
continue;
|
|
1978
2011
|
}
|
|
1979
|
-
if (
|
|
2012
|
+
if (xn.test(r)) {
|
|
1980
2013
|
let r = [];
|
|
1981
|
-
for (; n < e.length &&
|
|
1982
|
-
t.push(`<blockquote>${
|
|
2014
|
+
for (; n < e.length && xn.test(e[n]);) r.push(xn.exec(e[n])[2]), n++;
|
|
2015
|
+
t.push(`<blockquote>${Tn(r)}</blockquote>`);
|
|
1983
2016
|
continue;
|
|
1984
2017
|
}
|
|
1985
2018
|
if (/^[-*+] /.test(r)) {
|
|
1986
|
-
let { html: r, endIdx: i } =
|
|
2019
|
+
let { html: r, endIdx: i } = Mn(e, n);
|
|
1987
2020
|
t.push(r), n = i;
|
|
1988
2021
|
continue;
|
|
1989
2022
|
}
|
|
1990
2023
|
if (/^\d+\. /.test(r)) {
|
|
1991
|
-
let { html: r, endIdx: i } =
|
|
2024
|
+
let { html: r, endIdx: i } = Mn(e, n);
|
|
1992
2025
|
t.push(r), n = i;
|
|
1993
2026
|
continue;
|
|
1994
2027
|
}
|
|
@@ -1997,22 +2030,22 @@ function Sn(e) {
|
|
|
1997
2030
|
continue;
|
|
1998
2031
|
}
|
|
1999
2032
|
if (/^\|.+\|/.test(r) && n + 1 < e.length && /^\|[\s|:-]+\|/.test(e[n + 1])) {
|
|
2000
|
-
let i =
|
|
2033
|
+
let i = jn(r), a = jn(e[n + 1]).map((e) => e.startsWith(":") && e.endsWith(":") ? "center" : e.endsWith(":") ? "right" : e.startsWith(":") ? "left" : null);
|
|
2001
2034
|
n += 2;
|
|
2002
2035
|
let o = [];
|
|
2003
|
-
for (; n < e.length && /^\|.+\|/.test(e[n]);) o.push(
|
|
2036
|
+
for (; n < e.length && /^\|.+\|/.test(e[n]);) o.push(jn(e[n])), n++;
|
|
2004
2037
|
let s = (e, t, n) => `<${e}${n ? ` style="text-align:${n}"` : ""}>${L(t)}</${e}>`, c = `<thead><tr>${i.map((e, t) => s("th", e, a[t])).join("")}</tr></thead>`, l = o.length ? `<tbody>${o.map((e) => `<tr>${e.map((e, t) => s("td", e, a[t])).join("")}</tr>`).join("")}</tbody>` : "";
|
|
2005
2038
|
t.push(`<table>${c}${l}</table>`);
|
|
2006
2039
|
continue;
|
|
2007
2040
|
}
|
|
2008
2041
|
let o = [];
|
|
2009
|
-
for (; n < e.length && e[n].trim() !== "" && !/^(#{1,6} |[-*+] |\d+\. |```)/.test(e[n]) && !
|
|
2010
|
-
o.length && t.push(`<p>${L(
|
|
2042
|
+
for (; n < e.length && e[n].trim() !== "" && !/^(#{1,6} |[-*+] |\d+\. |```)/.test(e[n]) && !xn.test(e[n]) && !Sn.test(e[n]) && !/^\|.+\|/.test(e[n]) && !(n + 1 < e.length && /^=+\s*$/.test(e[n + 1])) && !(n + 1 < e.length && /^-{2,}\s*$/.test(e[n + 1]));) o.push(e[n]), n++;
|
|
2043
|
+
o.length && t.push(`<p>${L(An(o)).replaceAll(Cn, "<br>")}</p>`);
|
|
2011
2044
|
}
|
|
2012
2045
|
return t.join("");
|
|
2013
2046
|
}
|
|
2014
|
-
var
|
|
2015
|
-
function
|
|
2047
|
+
var En = /* @__PURE__ */ new Map(), Dn = /* @__PURE__ */ new Set();
|
|
2048
|
+
function On(e) {
|
|
2016
2049
|
if ((e[0] || "").trim() !== "---") return e;
|
|
2017
2050
|
let t = -1;
|
|
2018
2051
|
for (let n = 1; n < e.length; n++) {
|
|
@@ -2026,7 +2059,7 @@ function Tn(e) {
|
|
|
2026
2059
|
let n = t + 1;
|
|
2027
2060
|
return e[n] !== void 0 && e[n].trim() === "" && n++, e.slice(n);
|
|
2028
2061
|
}
|
|
2029
|
-
function
|
|
2062
|
+
function kn(e) {
|
|
2030
2063
|
let t = /* @__PURE__ */ new Map(), n = /* @__PURE__ */ new Set(), r = [], i = !1, a = /^\[([^\]]+)\]:\s*(\S+)(?:\s+"([^"]*)")?\s*$/, o = /^\[\^([^\]]+)\]:\s*(.+)$/;
|
|
2031
2064
|
for (let s of e) {
|
|
2032
2065
|
if (/^```/.test(s)) {
|
|
@@ -2056,23 +2089,23 @@ function En(e) {
|
|
|
2056
2089
|
footnoteIds: n
|
|
2057
2090
|
};
|
|
2058
2091
|
}
|
|
2059
|
-
function
|
|
2092
|
+
function An(e) {
|
|
2060
2093
|
let t = "";
|
|
2061
2094
|
for (let n = 0; n < e.length; n++) {
|
|
2062
2095
|
let r = n === e.length - 1, i = e[n];
|
|
2063
2096
|
if (!r && /\\$/.test(i)) {
|
|
2064
|
-
t += i.replace(/\\$/, "") +
|
|
2097
|
+
t += i.replace(/\\$/, "") + Cn;
|
|
2065
2098
|
continue;
|
|
2066
2099
|
}
|
|
2067
2100
|
if (!r && / {2,}$/.test(i)) {
|
|
2068
|
-
t += i.replace(/ {2,}$/, "") +
|
|
2101
|
+
t += i.replace(/ {2,}$/, "") + Cn;
|
|
2069
2102
|
continue;
|
|
2070
2103
|
}
|
|
2071
2104
|
t += i + (r ? "" : " ");
|
|
2072
2105
|
}
|
|
2073
2106
|
return t;
|
|
2074
2107
|
}
|
|
2075
|
-
function
|
|
2108
|
+
function jn(e) {
|
|
2076
2109
|
let t = e.replace(/^\|/, "").replace(/\|$/, ""), n = [], r = "";
|
|
2077
2110
|
for (let e = 0; e < t.length; e++) {
|
|
2078
2111
|
if (t[e] === "\\" && t[e + 1] === "|") {
|
|
@@ -2087,7 +2120,7 @@ function On(e) {
|
|
|
2087
2120
|
}
|
|
2088
2121
|
return n.push(r), n.map((e) => e.trim());
|
|
2089
2122
|
}
|
|
2090
|
-
function
|
|
2123
|
+
function Mn(e, t) {
|
|
2091
2124
|
let n = e[t].match(/^(\s*)/)[1].length, r = /^\s*\d+\. /.test(e[t]), i = [], a = null, o = !1, s = !1, c = t;
|
|
2092
2125
|
for (; c < e.length;) {
|
|
2093
2126
|
let t = e[c];
|
|
@@ -2116,7 +2149,7 @@ function kn(e, t) {
|
|
|
2116
2149
|
continue;
|
|
2117
2150
|
}
|
|
2118
2151
|
if (/^\s*(?:[-*+]|\d+\.) /.test(t)) {
|
|
2119
|
-
let t =
|
|
2152
|
+
let t = Mn(e, c);
|
|
2120
2153
|
i[i.length - 1].sub += t.html, c = t.endIdx, s = !1;
|
|
2121
2154
|
} else if (s) i[i.length - 1].paras.push(t.trim()), s = !1, c++;
|
|
2122
2155
|
else {
|
|
@@ -2134,73 +2167,73 @@ function kn(e, t) {
|
|
|
2134
2167
|
endIdx: c
|
|
2135
2168
|
};
|
|
2136
2169
|
}
|
|
2137
|
-
var
|
|
2138
|
-
function
|
|
2170
|
+
var Nn = /\\([*_`#[\]()>\\~|])/g, Pn = "\0";
|
|
2171
|
+
function Fn(e) {
|
|
2139
2172
|
let t = [];
|
|
2140
2173
|
return {
|
|
2141
|
-
text: e.replace(
|
|
2174
|
+
text: e.replace(Nn, (e, n) => (t.push(n), `${Pn}${t.length - 1}${Pn}`)),
|
|
2142
2175
|
literals: t
|
|
2143
2176
|
};
|
|
2144
2177
|
}
|
|
2145
|
-
function
|
|
2146
|
-
return e.replace(RegExp(`${
|
|
2178
|
+
function In(e, t) {
|
|
2179
|
+
return e.replace(RegExp(`${Pn}(\\d+)${Pn}`, "g"), (e, n) => Bn(t[Number(n)]));
|
|
2147
2180
|
}
|
|
2148
|
-
function
|
|
2149
|
-
return e = e.replace(/!\[([^\]]*)\]\(([^)]+)\)/g, (e, t, n) => `<img src="${
|
|
2150
|
-
let r =
|
|
2181
|
+
function Ln(e) {
|
|
2182
|
+
return e = e.replace(/!\[([^\]]*)\]\(([^)]+)\)/g, (e, t, n) => `<img src="${Vn(n)}" alt="${Vn(t)}" class="an-image">`), e = e.replace(/\[([^\]]+)\]\(([^)]+)\)/g, (e, t, n) => `<a href="${Vn(n)}">${t}</a>`), e = e.replace(/\[([^\]]+)\]\[([^\]]*)\]/g, (e, t, n) => {
|
|
2183
|
+
let r = En.get(Hn(n || t).trim().toLowerCase());
|
|
2151
2184
|
if (!r) return e;
|
|
2152
2185
|
let i = r.title ? ` title="${R(r.title)}"` : "";
|
|
2153
2186
|
return `<a href="${R(r.href)}"${i}>${t}</a>`;
|
|
2154
2187
|
}), e = e.replace(/\[([^\]]+)\]/g, (e, t) => {
|
|
2155
|
-
let n =
|
|
2188
|
+
let n = En.get(Hn(t).trim().toLowerCase());
|
|
2156
2189
|
if (!n) return e;
|
|
2157
2190
|
let r = n.title ? ` title="${R(n.title)}"` : "";
|
|
2158
2191
|
return `<a href="${R(n.href)}"${r}>${t}</a>`;
|
|
2159
|
-
}), e = e.replace(/\[\^([^\]]+)\]/g, (e, t) =>
|
|
2192
|
+
}), e = e.replace(/\[\^([^\]]+)\]/g, (e, t) => Dn.has(Hn(t)) ? `<sup>[${t}]</sup>` : e), e;
|
|
2160
2193
|
}
|
|
2161
|
-
function
|
|
2162
|
-
return e = e.replace(/<(https?:\/\/[^\s&]+?)>/g, (e, t) => `<a href="${
|
|
2194
|
+
function Rn(e) {
|
|
2195
|
+
return e = e.replace(/<(https?:\/\/[^\s&]+?)>/g, (e, t) => `<a href="${Vn(t)}">${t}</a>`), e = e.replace(/(^|[\s(])(https?:\/\/[^\s()]+)/g, (e, t, n) => {
|
|
2163
2196
|
let r = /[.,;:!?)]+$/.exec(n), i = r ? n.slice(0, -r[0].length) : n;
|
|
2164
2197
|
if (!i) return e;
|
|
2165
2198
|
let a = r ? r[0] : "";
|
|
2166
|
-
return `${t}<a href="${
|
|
2199
|
+
return `${t}<a href="${Vn(i)}">${i}</a>${a}`;
|
|
2167
2200
|
}), e;
|
|
2168
2201
|
}
|
|
2169
|
-
function
|
|
2202
|
+
function zn(e) {
|
|
2170
2203
|
return e = e.replace(/\*{3}([^*\n]+?)\*{3}/g, (e, t) => `<strong><em>${t}</em></strong>`), e = e.replace(/(?<!\w)_{3}([^_\n]+?)_{3}(?!\w)/g, (e, t) => `<strong><em>${t}</em></strong>`), e = e.replace(/\*{2}([^*\n]+?)\*{2}/g, (e, t) => `<strong>${t}</strong>`), e = e.replace(/(?<!\w)_{2}([^_\n]+?)_{2}(?!\w)/g, (e, t) => `<strong>${t}</strong>`), e = e.replace(/\*([^*\n]+?)\*/g, (e, t) => `<em>${t}</em>`), e = e.replace(/(?<!\w)_([^_\n]+?)_(?!\w)/g, (e, t) => `<em>${t}</em>`), e = e.replace(/~~([^~\n]+?)~~/g, (e, t) => `<del>${t}</del>`), e = e.replace(/``([\s\S]*?)``/g, (e, t) => `<code>${t}</code>`), e = e.replace(/`([^`]+)`/g, (e, t) => `<code>${t}</code>`), e;
|
|
2171
2204
|
}
|
|
2172
2205
|
function L(e) {
|
|
2173
|
-
let { text: t, literals: n } =
|
|
2174
|
-
return r =
|
|
2206
|
+
let { text: t, literals: n } = Fn(e), r = Bn(t);
|
|
2207
|
+
return r = Ln(r), r = Rn(r), r = zn(r), In(r, n);
|
|
2175
2208
|
}
|
|
2176
|
-
function
|
|
2209
|
+
function Bn(e) {
|
|
2177
2210
|
return String(e).replaceAll("&", "&").replaceAll("<", "<").replaceAll(">", ">");
|
|
2178
2211
|
}
|
|
2179
2212
|
function R(e) {
|
|
2180
2213
|
return String(e).replaceAll("&", "&").replaceAll("\"", """).replaceAll("'", "'").replaceAll("<", "<").replaceAll(">", ">");
|
|
2181
2214
|
}
|
|
2182
|
-
function
|
|
2215
|
+
function Vn(e) {
|
|
2183
2216
|
return String(e).replaceAll("\"", """).replaceAll("'", "'");
|
|
2184
2217
|
}
|
|
2185
|
-
function
|
|
2218
|
+
function Hn(e) {
|
|
2186
2219
|
return String(e).replaceAll("<", "<").replaceAll(">", ">").replaceAll("&", "&");
|
|
2187
2220
|
}
|
|
2188
2221
|
//#endregion
|
|
2189
2222
|
//#region src/js/core/detectLang.js
|
|
2190
|
-
function
|
|
2223
|
+
function Un(e) {
|
|
2191
2224
|
if (!e?.trim()) return null;
|
|
2192
2225
|
let t = e.trim();
|
|
2193
2226
|
return /(:\s*(string|number|boolean|void|never|any|unknown)\b|interface\s+\w+\s*\{|type\s+\w+\s*[=<(]|<\w+>\s*[;,)]|readonly\s+\w|enum\s+\w+\s*\{|\?\s*:\s*\w|as\s+\w+\s*[;,)\]])/.test(t) ? "typescript" : /\bprintln!\s*\(|\bprint!\s*\(|\bfn\s+\w+\s*(<[^>]*>)?\s*\(|\blet\s+mut\s|\bpub\s+fn\s|\buse\s+std::|\bimpl\s+\w+|\bOption<|\bResult<\w+/.test(t) ? "rust" : /(<\?php\b|<\?=|\becho\s+.*\$\w|\$this->|\$\w+\s*=\s*\w|\bforeach\s*\(\s*\$|Illuminate\\)/.test(t) ? "php" : /\bpublic\s+(class|static|void|int|String)\s+\w|System\.out\.(print|println)\s*\(|@(Override|Autowired|Component|Service|Controller)\b|import\s+java\.(util|io|lang|net)\.|throws\s+\w+Exception/.test(t) ? "java" : /\bfun\s+\w+\s*\(|\bdata\s+class\s+\w+|\bcompanion\s+object\b|\bval\s+\w+\s*:\s*\w|\bprintln\s*\(/.test(t) ? "kotlin" : /\bguard\s+(let|var)\b|\bprotocol\s+\w+\s*\{|\bextension\s+\w+|\bfunc\s+\w+[^(]*\([^)]*\)\s*->\s*\w|\blet\s+\w+\s*:\s*[A-Z]\w*|\bSwiftUI\b/.test(t) ? "swift" : /\bpackage\s+\w+\b|\bfmt\.(Print|Println|Sprintf|Errorf|Fprintf)\s*\(|:=\s*\w|\bgoroutine\b|\bchan\s+\w|\bgo\s+func\b/.test(t) ? "go" : /\b(const\s+\w|let\s+\w+\s*=|var\s+\w+\s*=|function\s+\w|\=>\s*[{(]|import\s+.*\bfrom\b\s*['"]|require\s*\(|console\.(log|error|warn|info)|document\.\w|window\.\w|async\s+function|\bPromise\b|React\.|useState\s*\(|\.then\s*\()/.test(t) ? "javascript" : /^<!DOCTYPE html/i.test(t) || /<(html|head|body|div|section|article|nav|p|a|img|ul|ol|li|table|form|input|button|script|style)\b[^>]*>/i.test(t) ? "html" : /(^|\n)\s*(\/\/\s+\S|&[:.[\w]|\$\w+\s*:|@(mixin|include|extend|each|if|for|use|forward)\b|#\{)/.test(t) && /[\w#.*&[\]:(),>+~ -]+\s*\{/.test(t) ? "scss" : /(^|\n)\s*[\w#.*:[\]&, +-]+\s*\{[^}]*[\w-]+\s*:[^{}:;]+[;}\n]/m.test(t) && !/<\w|function\s|def\s|:\s*(string|number)/.test(t) ? "css" : /^\s*[{[]/.test(t) && /"\w[\w\s-]*"\s*:/.test(t) && !/\bfunction\b|\bdef\b/.test(t) ? "json" : /(^|\n)\s*(SELECT\s|INSERT\s+INTO|UPDATE\s+\w|DELETE\s+FROM|CREATE\s+(TABLE|DATABASE|INDEX|VIEW)|DROP\s+(TABLE|DATABASE)|ALTER\s+TABLE|WITH\s+\w+\s+AS\s*\()/im.test(t) ? "sql" : /\bdef\s+\w+\s*\([^)]*\)\s*:|(^|\n)\s*class\s+\w+.*:\s*$|(^|\n)\s*import\s+\w|(^|\n)\s*from\s+\w+\s+import\s+|\bprint\s*\(|if\s+__name__\s*==\s*['"]__main__['"]/m.test(t) ? "python" : /\bputs\s+\S|\battr_(accessor|reader|writer)\s|\.each\s+do\s*\|\w+\s*\||\bdo\s*\|\w+\s*\|.*\bend\b|\bdef\s+\w+[^:]*\n[\s\S]*?\bend\b/.test(t) ? "ruby" : /^#!.*\/(ba|z|da|fi|k)?sh\b/m.test(t) || /\b(echo\s+["']|grep\s+|awk\s+|sed\s+['"\\/-]|chmod\s+|sudo\s+|apt(-get)?\s+install|brew\s+install|npm\s+(install|run|start|build)|pip\s+(install|3\s)|docker\s+(run|build|compose)|kubectl\s+|git\s+(clone|add|commit|push|pull|checkout))\b/.test(t) ? "bash" : /\bcout\s*<<|\bcin\s*>>|using\s+namespace\s+std\b|std::\w|\btemplate\s*<\w|\b#include\s*<(iostream|vector|map|set|algorithm|string|memory)>/.test(t) ? "cpp" : /\busing\s+System\b|Console\.(Write|WriteLine)\s*\(|\bget;\s*set;|\basync\s+Task[<\s]|IEnumerable<|\bLINQ\b|\.Select\s*\(|\.Where\s*\(/.test(t) ? "csharp" : /\b#include\s*<(stdio|stdlib|string|math|time|ctype)\.h>|\bprintf\s*\(|\bscanf\s*\(|int\s+main\s*\(\s*(void|int\s+argc)|\bmalloc\s*\(|\bfree\s*\(/.test(t) && !/namespace|cout|cin|std::/.test(t) ? "c" : /^<\?xml\s/i.test(t) || /xmlns:|<\/[\w:]+>/.test(t) ? "xml" : null;
|
|
2194
2227
|
}
|
|
2195
2228
|
//#endregion
|
|
2196
2229
|
//#region src/js/module/Editor.js
|
|
2197
|
-
var
|
|
2230
|
+
var Wn = class {
|
|
2198
2231
|
constructor(e) {
|
|
2199
2232
|
this.context = e, this.options = e.options, this._history = null, this._disposers = [], this._snapshotTimer = null;
|
|
2200
2233
|
}
|
|
2201
2234
|
initialize() {
|
|
2202
2235
|
let e = this.context.layoutInfo.editable;
|
|
2203
|
-
return this._history = new
|
|
2236
|
+
return this._history = new un(e, this.options.historyLimit || 100, this.options.historyMaxBytes || 10 * 1024 * 1024), this._bindEvents(e), this;
|
|
2204
2237
|
}
|
|
2205
2238
|
destroy() {
|
|
2206
2239
|
this._disposers.forEach((e) => e()), this._disposers = [], this._history = null, clearTimeout(this._snapshotTimer), this._snapshotTimer = null;
|
|
@@ -2277,7 +2310,7 @@ var Bn = class {
|
|
|
2277
2310
|
}
|
|
2278
2311
|
_onKeydown(e) {
|
|
2279
2312
|
let t = this.context.layoutInfo.editable;
|
|
2280
|
-
if (!
|
|
2313
|
+
if (!gn(e, t, this.options)) {
|
|
2281
2314
|
if (F(e, "z") && !e.shiftKey) {
|
|
2282
2315
|
e.preventDefault(), this.undo();
|
|
2283
2316
|
return;
|
|
@@ -2386,16 +2419,16 @@ var Bn = class {
|
|
|
2386
2419
|
return !e && !t;
|
|
2387
2420
|
}
|
|
2388
2421
|
insertHTML(e) {
|
|
2389
|
-
e && (
|
|
2422
|
+
e && (D("insertHTML", M(e)), this.afterCommand());
|
|
2390
2423
|
}
|
|
2391
2424
|
insertText(e) {
|
|
2392
|
-
e && (
|
|
2425
|
+
e && (D("insertText", e), this.afterCommand());
|
|
2393
2426
|
}
|
|
2394
2427
|
setMarkdown(e) {
|
|
2395
|
-
this.setHTML(
|
|
2428
|
+
this.setHTML(wn(e || ""));
|
|
2396
2429
|
}
|
|
2397
2430
|
getMarkdown() {
|
|
2398
|
-
return
|
|
2431
|
+
return _n(this.getHTML());
|
|
2399
2432
|
}
|
|
2400
2433
|
undo() {
|
|
2401
2434
|
this._history && (this._flushPendingSnapshot(), this._history.undo(), this.context.invoke("toolbar.refresh"), this.context.invoke("statusbar.update"), this.context.triggerEvent("change", this.getHTML()));
|
|
@@ -2425,49 +2458,49 @@ var Bn = class {
|
|
|
2425
2458
|
return !e || !this._history ? !1 : (this._history._restoreSelection(e), !0);
|
|
2426
2459
|
}
|
|
2427
2460
|
bold() {
|
|
2428
|
-
|
|
2461
|
+
we(), this.afterCommand();
|
|
2429
2462
|
}
|
|
2430
2463
|
italic() {
|
|
2431
|
-
|
|
2464
|
+
Te(), this.afterCommand();
|
|
2432
2465
|
}
|
|
2433
2466
|
underline() {
|
|
2434
|
-
|
|
2467
|
+
Ee(), this.afterCommand();
|
|
2435
2468
|
}
|
|
2436
2469
|
strikethrough() {
|
|
2437
|
-
|
|
2470
|
+
De(), this.afterCommand();
|
|
2438
2471
|
}
|
|
2439
2472
|
superscript() {
|
|
2440
|
-
|
|
2473
|
+
Oe(), this.afterCommand();
|
|
2441
2474
|
}
|
|
2442
2475
|
subscript() {
|
|
2443
|
-
|
|
2476
|
+
ke(), this.afterCommand();
|
|
2444
2477
|
}
|
|
2445
2478
|
justifyLeft() {
|
|
2446
|
-
|
|
2479
|
+
Fe(), this.afterCommand();
|
|
2447
2480
|
}
|
|
2448
2481
|
justifyCenter() {
|
|
2449
|
-
|
|
2482
|
+
Ie(), this.afterCommand();
|
|
2450
2483
|
}
|
|
2451
2484
|
justifyRight() {
|
|
2452
|
-
|
|
2485
|
+
Le(), this.afterCommand();
|
|
2453
2486
|
}
|
|
2454
2487
|
justifyFull() {
|
|
2455
|
-
|
|
2488
|
+
Re(), this.afterCommand();
|
|
2456
2489
|
}
|
|
2457
2490
|
indent() {
|
|
2458
|
-
|
|
2491
|
+
ze(), this.afterCommand();
|
|
2459
2492
|
}
|
|
2460
2493
|
outdent() {
|
|
2461
|
-
|
|
2494
|
+
Be(), this.afterCommand();
|
|
2462
2495
|
}
|
|
2463
2496
|
insertUL() {
|
|
2464
|
-
|
|
2497
|
+
We(), this.afterCommand();
|
|
2465
2498
|
}
|
|
2466
2499
|
insertOL() {
|
|
2467
|
-
|
|
2500
|
+
Ge(), this.afterCommand();
|
|
2468
2501
|
}
|
|
2469
2502
|
inlineCode() {
|
|
2470
|
-
|
|
2503
|
+
qe(this.context.layoutInfo.editable), this.afterCommand();
|
|
2471
2504
|
}
|
|
2472
2505
|
toggleChecklist() {
|
|
2473
2506
|
Xe(), this.afterCommand();
|
|
@@ -2476,12 +2509,12 @@ var Bn = class {
|
|
|
2476
2509
|
this.context.print();
|
|
2477
2510
|
}
|
|
2478
2511
|
formatBlock(e) {
|
|
2479
|
-
if (
|
|
2512
|
+
if (Pe(e), e === "pre") {
|
|
2480
2513
|
let e = globalThis.getSelection();
|
|
2481
2514
|
if (e?.rangeCount > 0) {
|
|
2482
2515
|
let t = e.getRangeAt(0).commonAncestorContainer, n = t.nodeType === 1 ? t.closest("pre") : t.parentElement?.closest("pre");
|
|
2483
2516
|
if (n && !n.dataset.language) {
|
|
2484
|
-
let e =
|
|
2517
|
+
let e = Un(n.textContent || "");
|
|
2485
2518
|
if (e) {
|
|
2486
2519
|
this.context.invoke("codeTooltip.applyLanguage", n, e);
|
|
2487
2520
|
return;
|
|
@@ -2492,55 +2525,55 @@ var Bn = class {
|
|
|
2492
2525
|
this.afterCommand();
|
|
2493
2526
|
}
|
|
2494
2527
|
foreColor(e) {
|
|
2495
|
-
|
|
2528
|
+
Ae(e), this.afterCommand();
|
|
2496
2529
|
}
|
|
2497
2530
|
backColor(e) {
|
|
2498
|
-
|
|
2531
|
+
je(e), this.afterCommand();
|
|
2499
2532
|
}
|
|
2500
2533
|
fontName(e) {
|
|
2501
|
-
|
|
2534
|
+
Me(e), this.afterCommand();
|
|
2502
2535
|
}
|
|
2503
2536
|
fontSize(e) {
|
|
2504
|
-
|
|
2537
|
+
Ne(e, this.context.layoutInfo.editable), this.afterCommand();
|
|
2505
2538
|
}
|
|
2506
2539
|
insertHr() {
|
|
2507
|
-
|
|
2540
|
+
D("insertHorizontalRule"), this.afterCommand();
|
|
2508
2541
|
}
|
|
2509
2542
|
insertLink(e, t, n = !1) {
|
|
2510
2543
|
let r = globalThis.getSelection();
|
|
2511
2544
|
if (!r || r.rangeCount === 0) return;
|
|
2512
|
-
let i =
|
|
2545
|
+
let i = sn(e);
|
|
2513
2546
|
if (i) {
|
|
2514
2547
|
if (r.toString().trim().length > 0) {
|
|
2515
|
-
if (
|
|
2548
|
+
if (D("createLink", i), n) {
|
|
2516
2549
|
let e = this._getClosestAnchor();
|
|
2517
2550
|
e && (e.setAttribute("target", "_blank"), e.setAttribute("rel", "noopener noreferrer"));
|
|
2518
2551
|
}
|
|
2519
2552
|
} else {
|
|
2520
2553
|
let e = this._escapeAttr(t || i);
|
|
2521
|
-
|
|
2554
|
+
D("insertHTML", `<a href="${this._escapeAttr(i)}"${n ? " target=\"_blank\" rel=\"noopener noreferrer\"" : ""}>${e}</a>`);
|
|
2522
2555
|
}
|
|
2523
2556
|
this.afterCommand();
|
|
2524
2557
|
}
|
|
2525
2558
|
}
|
|
2526
2559
|
unlink() {
|
|
2527
|
-
|
|
2560
|
+
D("unlink"), this.afterCommand();
|
|
2528
2561
|
}
|
|
2529
2562
|
insertImage(e, t = "", n = "") {
|
|
2530
|
-
let r =
|
|
2563
|
+
let r = sn(e, { allowData: !0 });
|
|
2531
2564
|
if (!r) return;
|
|
2532
2565
|
let i = {
|
|
2533
2566
|
left: "float:left;margin:0 1em 1em 0",
|
|
2534
2567
|
center: "display:block;margin:0 auto",
|
|
2535
2568
|
right: "float:right;margin:0 0 1em 1em"
|
|
2536
2569
|
}[n] || "", a = i ? ` style="${i}"` : "";
|
|
2537
|
-
|
|
2570
|
+
D("insertHTML", `<img src="${this._escapeAttr(r)}" alt="${this._escapeAttr(t)}" class="an-image"${a}>`), this.afterCommand();
|
|
2538
2571
|
}
|
|
2539
2572
|
insertVideo(e) {
|
|
2540
|
-
e && (
|
|
2573
|
+
e && (D("insertHTML", e), this.afterCommand());
|
|
2541
2574
|
}
|
|
2542
2575
|
insertTable(e, t) {
|
|
2543
|
-
|
|
2576
|
+
fn(e, t, { headerRow: this.context.options.tableHeaderRow }), this.afterCommand();
|
|
2544
2577
|
}
|
|
2545
2578
|
_getClosestAnchor() {
|
|
2546
2579
|
let e = globalThis.getSelection();
|
|
@@ -2555,44 +2588,44 @@ var Bn = class {
|
|
|
2555
2588
|
_escapeAttr(e) {
|
|
2556
2589
|
return String(e ?? "").replaceAll("&", "&").replaceAll("\"", """).replaceAll("<", "<").replaceAll(">", ">");
|
|
2557
2590
|
}
|
|
2558
|
-
},
|
|
2559
|
-
["bold",
|
|
2560
|
-
["italic",
|
|
2561
|
-
["underline",
|
|
2562
|
-
["strikethrough",
|
|
2563
|
-
["superscript",
|
|
2564
|
-
["subscript",
|
|
2565
|
-
["align-left",
|
|
2566
|
-
["align-center",
|
|
2567
|
-
["align-right",
|
|
2568
|
-
["align-justify",
|
|
2569
|
-
["list-ul",
|
|
2570
|
-
["list-ol",
|
|
2571
|
-
["indent",
|
|
2572
|
-
["outdent",
|
|
2573
|
-
["undo",
|
|
2574
|
-
["redo",
|
|
2575
|
-
["minus",
|
|
2576
|
-
["link",
|
|
2577
|
-
["image",
|
|
2578
|
-
["video",
|
|
2579
|
-
["table",
|
|
2580
|
-
["emoji",
|
|
2581
|
-
["icon",
|
|
2582
|
-
["code",
|
|
2583
|
-
["expand",
|
|
2584
|
-
["foreColor",
|
|
2585
|
-
["backColor",
|
|
2586
|
-
["keyboard",
|
|
2587
|
-
["caption",
|
|
2588
|
-
["remove-format",
|
|
2589
|
-
["direction",
|
|
2590
|
-
["search",
|
|
2591
|
-
["find-replace",
|
|
2592
|
-
["inline-code",
|
|
2593
|
-
["checklist",
|
|
2594
|
-
["print",
|
|
2595
|
-
]),
|
|
2591
|
+
}, Gn = (e) => typeof e == "string" ? et(e) : e, Kn = null, qn = "stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"", z = (e) => `<svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="none" ${qn} style="display:block">${e}</svg>`, B = /* @__PURE__ */ new Map([
|
|
2592
|
+
["bold", z("<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\"/>")],
|
|
2593
|
+
["italic", z("<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\"/>")],
|
|
2594
|
+
["underline", z("<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\"/>")],
|
|
2595
|
+
["strikethrough", z("<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\"/>")],
|
|
2596
|
+
["superscript", z("<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\"/>")],
|
|
2597
|
+
["subscript", z("<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\"/>")],
|
|
2598
|
+
["align-left", z("<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\"/>")],
|
|
2599
|
+
["align-center", z("<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\"/>")],
|
|
2600
|
+
["align-right", z("<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\"/>")],
|
|
2601
|
+
["align-justify", z("<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\"/>")],
|
|
2602
|
+
["list-ul", z("<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\"/>")],
|
|
2603
|
+
["list-ol", z("<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\"/>")],
|
|
2604
|
+
["indent", z("<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\"/>")],
|
|
2605
|
+
["outdent", z("<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\"/>")],
|
|
2606
|
+
["undo", z("<path d=\"M3 7v6h6\"/><path d=\"M21 17a9 9 0 0 0-9-9 9 9 0 0 0-6 2.3L3 13\"/>")],
|
|
2607
|
+
["redo", z("<path d=\"M21 7v6h-6\"/><path d=\"M3 17a9 9 0 0 1 9-9 9 9 0 0 1 6 2.3L21 13\"/>")],
|
|
2608
|
+
["minus", z("<line x1=\"5\" y1=\"12\" x2=\"19\" y2=\"12\"/>")],
|
|
2609
|
+
["link", z("<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\"/>")],
|
|
2610
|
+
["image", z("<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\"/>")],
|
|
2611
|
+
["video", z("<polygon points=\"23 7 16 12 23 17 23 7\"/><rect x=\"1\" y=\"5\" width=\"15\" height=\"14\" rx=\"2\"/>")],
|
|
2612
|
+
["table", z("<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\"/>")],
|
|
2613
|
+
["emoji", z("<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\"/>")],
|
|
2614
|
+
["icon", z("<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\"/>")],
|
|
2615
|
+
["code", z("<polyline points=\"16 18 22 12 16 6\"/><polyline points=\"8 6 2 12 8 18\"/>")],
|
|
2616
|
+
["expand", z("<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\"/>")],
|
|
2617
|
+
["foreColor", z("<path d=\"M4 20L12 4L20 20\"/><line x1=\"7.5\" y1=\"14\" x2=\"16.5\" y2=\"14\"/>")],
|
|
2618
|
+
["backColor", z("<path d=\"M3 21v-4l9-9 4 4-9 9z\"/><path d=\"M12 8l4 4\"/>")],
|
|
2619
|
+
["keyboard", z("<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\"/>")],
|
|
2620
|
+
["caption", z("<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\"/>")],
|
|
2621
|
+
["remove-format", z("<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\"/>")],
|
|
2622
|
+
["direction", z("<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\"/>")],
|
|
2623
|
+
["search", z("<circle cx=\"11\" cy=\"11\" r=\"7\"/><line x1=\"21\" y1=\"21\" x2=\"16.65\" y2=\"16.65\"/>")],
|
|
2624
|
+
["find-replace", z("<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\"/>")],
|
|
2625
|
+
["inline-code", z("<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\"/>")],
|
|
2626
|
+
["checklist", z("<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\"/>")],
|
|
2627
|
+
["print", z("<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\"/>")]
|
|
2628
|
+
]), Jn = /* @__PURE__ */ new Map([
|
|
2596
2629
|
["bold", "fa-bold"],
|
|
2597
2630
|
["italic", "fa-italic"],
|
|
2598
2631
|
["underline", "fa-underline"],
|
|
@@ -2626,12 +2659,17 @@ var Bn = class {
|
|
|
2626
2659
|
["inline-code", "fa-code"],
|
|
2627
2660
|
["checklist", "fa-list-check"],
|
|
2628
2661
|
["print", "fa-print"]
|
|
2629
|
-
]),
|
|
2662
|
+
]), Yn = class {
|
|
2630
2663
|
constructor(e) {
|
|
2631
2664
|
this.context = e, this.options = e.options, this.el = null, this._disposers = [], this._colorPickerClosers = [], this._refreshRaf = null;
|
|
2632
2665
|
}
|
|
2633
2666
|
initialize() {
|
|
2634
|
-
return this.el = w("div", {
|
|
2667
|
+
return this.el = w("div", {
|
|
2668
|
+
class: "an-toolbar",
|
|
2669
|
+
role: "toolbar",
|
|
2670
|
+
"aria-orientation": "horizontal",
|
|
2671
|
+
"aria-label": "Editor toolbar"
|
|
2672
|
+
}), this._faReady = this._detectFontAwesome(), this._buildButtons(), this._initRovingFocus(), this._btnMap = new Map((this.options.toolbar || []).flat().map(Gn).filter(Boolean).map((e) => [e.name, e])), this;
|
|
2635
2673
|
}
|
|
2636
2674
|
destroy() {
|
|
2637
2675
|
this._refreshRaf && cancelAnimationFrame(this._refreshRaf), this._refreshRaf = null, this._disposers.forEach((e) => e()), this._disposers = [], this.el?.parentNode && this.el.remove(), this.el = null;
|
|
@@ -2641,7 +2679,7 @@ var Bn = class {
|
|
|
2641
2679
|
e.forEach((e) => {
|
|
2642
2680
|
let n = w("div", { class: "an-btn-group" });
|
|
2643
2681
|
e.forEach((e) => {
|
|
2644
|
-
let t =
|
|
2682
|
+
let t = Gn(e);
|
|
2645
2683
|
if (!t) {
|
|
2646
2684
|
console.warn(`[AutumnNote] Toolbar: button "${e}" not found in registry. Skipped.`);
|
|
2647
2685
|
return;
|
|
@@ -2856,23 +2894,60 @@ var Bn = class {
|
|
|
2856
2894
|
class: `${this.options.useBootstrap ? this.options.toolbarButtonClass || "btn btn-sm btn-light" : "an-btn"}${e.className ? ` ${e.className}` : ""}`,
|
|
2857
2895
|
title: this.context.locale.toolbar[e.name] || e.tooltip || "",
|
|
2858
2896
|
"data-btn": e.name,
|
|
2859
|
-
"aria-label": this.context.locale.toolbar[e.name] || e.tooltip || e.name
|
|
2897
|
+
"aria-label": this.context.locale.toolbar[e.name] || e.tooltip || e.name,
|
|
2898
|
+
...typeof e.isActive == "function" ? { "aria-pressed": "false" } : {}
|
|
2860
2899
|
}), n = this.options.fontAwesomeClass || "fas";
|
|
2861
2900
|
if (this._faReady) {
|
|
2862
|
-
let r =
|
|
2863
|
-
r ? t.innerHTML = `<i class="${n} ${r}" aria-hidden="true"></i>` :
|
|
2864
|
-
} else
|
|
2901
|
+
let r = Jn.get(e.icon) || Jn.get(e.name) || null;
|
|
2902
|
+
r ? t.innerHTML = `<i class="${n} ${r}" aria-hidden="true"></i>` : B.has(e.icon) ? t.innerHTML = B.get(e.icon) : t.textContent = e.icon || e.name;
|
|
2903
|
+
} else B.has(e.icon) ? t.innerHTML = B.get(e.icon) : B.has(e.name) ? t.innerHTML = B.get(e.name) : t.textContent = e.icon || e.name;
|
|
2865
2904
|
let r = E(t, "click", (t) => {
|
|
2866
2905
|
t.preventDefault(), this.context.invoke("editor.focus"), e.action(this.context), this.context.invoke("editor.afterCommand"), this.refresh();
|
|
2867
2906
|
});
|
|
2868
2907
|
return this._disposers.push(r), t;
|
|
2869
2908
|
}
|
|
2909
|
+
_controls() {
|
|
2910
|
+
return this.el ? Array.from(this.el.querySelectorAll("button, select")) : [];
|
|
2911
|
+
}
|
|
2912
|
+
_navigable() {
|
|
2913
|
+
return this._controls().filter((e) => !e.disabled);
|
|
2914
|
+
}
|
|
2915
|
+
_syncRovingTabindex(e) {
|
|
2916
|
+
let t = this._controls(), n = this._navigable();
|
|
2917
|
+
if (!n.length) return;
|
|
2918
|
+
let r = e && n.includes(e) ? e : n.find((e) => e.getAttribute("tabindex") === "0") || n[0];
|
|
2919
|
+
t.forEach((e) => e.setAttribute("tabindex", e === r ? "0" : "-1"));
|
|
2920
|
+
}
|
|
2921
|
+
_initRovingFocus() {
|
|
2922
|
+
this.el && (this._syncRovingTabindex(), this._disposers.push(E(this.el, "keydown", (e) => this._onToolbarKeydown(e)), E(this.el, "focusin", (e) => {
|
|
2923
|
+
let t = e.target?.closest?.("button, select");
|
|
2924
|
+
t && this._syncRovingTabindex(t);
|
|
2925
|
+
})));
|
|
2926
|
+
}
|
|
2927
|
+
_onToolbarKeydown(e) {
|
|
2928
|
+
if (![
|
|
2929
|
+
"ArrowRight",
|
|
2930
|
+
"ArrowLeft",
|
|
2931
|
+
"Home",
|
|
2932
|
+
"End"
|
|
2933
|
+
].includes(e.key)) return;
|
|
2934
|
+
let t = this._navigable(), n = e.target?.closest?.("button, select"), r = n ? t.indexOf(n) : -1;
|
|
2935
|
+
if (r === -1) return;
|
|
2936
|
+
let i;
|
|
2937
|
+
if (e.key === "Home") i = t[0];
|
|
2938
|
+
else if (e.key === "End") i = t.at(-1);
|
|
2939
|
+
else {
|
|
2940
|
+
let n = this.options.direction === "rtl";
|
|
2941
|
+
i = t[(r + (e.key === "ArrowRight" === n ? -1 : 1) + t.length) % t.length];
|
|
2942
|
+
}
|
|
2943
|
+
i && (e.preventDefault(), this._syncRovingTabindex(i), i.focus());
|
|
2944
|
+
}
|
|
2870
2945
|
_detectFontAwesome() {
|
|
2871
2946
|
if (!this.options.useFontAwesome) return !1;
|
|
2872
|
-
if (
|
|
2873
|
-
if (document.querySelector(".fa, .fas, .far, .fal, .fab, .fa-solid")) return
|
|
2947
|
+
if (Kn !== null) return Kn;
|
|
2948
|
+
if (document.querySelector(".fa, .fas, .far, .fal, .fab, .fa-solid")) return Kn = !0, !0;
|
|
2874
2949
|
let e = Array.from(document.querySelectorAll("link[rel=\"stylesheet\"]")).filter((e) => e.id !== "an-fontawesome-css").map((e) => e.href || "").join(" ");
|
|
2875
|
-
return
|
|
2950
|
+
return Kn = /fontawesome|font-awesome|use\.fontawesome|all\.css/.test(e), Kn;
|
|
2876
2951
|
}
|
|
2877
2952
|
refresh() {
|
|
2878
2953
|
this._refreshRaf && cancelAnimationFrame(this._refreshRaf), this._refreshRaf = requestAnimationFrame(() => {
|
|
@@ -2884,8 +2959,12 @@ var Bn = class {
|
|
|
2884
2959
|
let e = this._btnMap || /* @__PURE__ */ new Map();
|
|
2885
2960
|
this.el.querySelectorAll("button[data-btn]").forEach((t) => {
|
|
2886
2961
|
let n = e.get(t.dataset.btn);
|
|
2887
|
-
n && typeof n.isActive == "function"
|
|
2888
|
-
|
|
2962
|
+
if (n && typeof n.isActive == "function") {
|
|
2963
|
+
let e = !!n.isActive(this.context);
|
|
2964
|
+
t.classList.toggle("active", e), t.setAttribute("aria-pressed", String(e));
|
|
2965
|
+
}
|
|
2966
|
+
n && typeof n.isDisabled == "function" && (t.disabled = !!n.isDisabled(this.context));
|
|
2967
|
+
}), this._syncRovingTabindex(), this.el.querySelectorAll("select[data-btn]").forEach((t) => {
|
|
2889
2968
|
let n = e.get(t.dataset.btn);
|
|
2890
2969
|
if (!n || typeof n.getValue != "function") return;
|
|
2891
2970
|
let r = (n.getValue(this.context) || "").replace(/["']/g, "").trim();
|
|
@@ -2901,27 +2980,27 @@ var Bn = class {
|
|
|
2901
2980
|
this.el && (this.el.style.display = "none");
|
|
2902
2981
|
}
|
|
2903
2982
|
rebuild() {
|
|
2904
|
-
this._refreshRaf &&= (cancelAnimationFrame(this._refreshRaf), null), this._disposers.forEach((e) => e()), this._disposers = [], this.el && (this.el.innerHTML = ""), this._faReady = this._detectFontAwesome(), this._buildButtons(), this._btnMap = new Map((this.options.toolbar || []).flat().map(
|
|
2983
|
+
this._refreshRaf &&= (cancelAnimationFrame(this._refreshRaf), null), this._disposers.forEach((e) => e()), this._disposers = [], this.el && (this.el.innerHTML = ""), this._faReady = this._detectFontAwesome(), this._buildButtons(), this._initRovingFocus(), this._btnMap = new Map((this.options.toolbar || []).flat().map(Gn).filter(Boolean).map((e) => [e.name, e])), this.refresh();
|
|
2905
2984
|
}
|
|
2906
|
-
},
|
|
2907
|
-
function
|
|
2985
|
+
}, Xn = typeof Intl < "u" && typeof Intl.Segmenter == "function" ? new Intl.Segmenter(void 0, { granularity: "word" }) : null;
|
|
2986
|
+
function Zn(e) {
|
|
2908
2987
|
let t = e.trim();
|
|
2909
2988
|
if (!t) return 0;
|
|
2910
|
-
if (
|
|
2989
|
+
if (Xn) {
|
|
2911
2990
|
let e = 0;
|
|
2912
|
-
for (let n of
|
|
2991
|
+
for (let n of Xn.segment(t)) n.isWordLike && e++;
|
|
2913
2992
|
return e;
|
|
2914
2993
|
}
|
|
2915
2994
|
return t.split(/\s+/).length;
|
|
2916
2995
|
}
|
|
2917
|
-
function
|
|
2996
|
+
function Qn(e, t, n) {
|
|
2918
2997
|
if (!n) {
|
|
2919
2998
|
e.classList.remove("an-count-warn", "an-count-exceeded");
|
|
2920
2999
|
return;
|
|
2921
3000
|
}
|
|
2922
3001
|
t > n ? (e.classList.add("an-count-exceeded"), e.classList.remove("an-count-warn")) : t >= n * .9 ? (e.classList.add("an-count-warn"), e.classList.remove("an-count-exceeded")) : e.classList.remove("an-count-warn", "an-count-exceeded");
|
|
2923
3002
|
}
|
|
2924
|
-
var
|
|
3003
|
+
var $n = class {
|
|
2925
3004
|
constructor(e) {
|
|
2926
3005
|
this.context = e, this.options = e.options, this.el = null, this._disposers = [], this._wordCountEl = null, this._charCountEl = null;
|
|
2927
3006
|
}
|
|
@@ -2974,17 +3053,17 @@ var Jn = class {
|
|
|
2974
3053
|
}
|
|
2975
3054
|
update() {
|
|
2976
3055
|
if (!this._wordCountEl || !this._charCountEl) return;
|
|
2977
|
-
let e = this.context.layoutInfo.editable.textContent || "", t =
|
|
2978
|
-
this._wordCountEl.textContent = r ? a.wordsLimit(t, r) : a.words(t), this._charCountEl.textContent = i ? a.charsLimit(n, i) : a.chars(n),
|
|
3056
|
+
let e = this.context.layoutInfo.editable.textContent || "", t = Zn(e), n = e.replaceAll("\n", "").length, r = this.options.maxWords || 0, i = this.options.maxChars || 0, a = this.context.locale.statusbar;
|
|
3057
|
+
this._wordCountEl.textContent = r ? a.wordsLimit(t, r) : a.words(t), this._charCountEl.textContent = i ? a.charsLimit(n, i) : a.chars(n), Qn(this._wordCountEl, t, r), Qn(this._charCountEl, n, i);
|
|
2979
3058
|
}
|
|
2980
3059
|
getWordCount() {
|
|
2981
3060
|
let e = this.context.layoutInfo.editable;
|
|
2982
|
-
return
|
|
3061
|
+
return Zn(e.innerText || "");
|
|
2983
3062
|
}
|
|
2984
3063
|
getCharCount() {
|
|
2985
3064
|
return (this.context.layoutInfo.editable.innerText || "").replaceAll("\n", "").length;
|
|
2986
3065
|
}
|
|
2987
|
-
},
|
|
3066
|
+
}, er = class {
|
|
2988
3067
|
constructor(e) {
|
|
2989
3068
|
this.context = e, this.options = e.options, this._disposers = [];
|
|
2990
3069
|
}
|
|
@@ -3096,20 +3175,20 @@ var Jn = class {
|
|
|
3096
3175
|
text: t.getData("text/plain") || "",
|
|
3097
3176
|
html: t.types.includes("text/html") ? t.getData("text/html") : null
|
|
3098
3177
|
}), n || this.options.pasteAsPlainText) {
|
|
3099
|
-
e.preventDefault(),
|
|
3178
|
+
e.preventDefault(), D("insertHTML", t.getData("text/plain").split(/\r?\n/).map((e) => `<p>${this._escapeHTML(e) || "<br>"}</p>`).join("")), this.context.invoke("editor.afterCommand");
|
|
3100
3179
|
return;
|
|
3101
3180
|
}
|
|
3102
3181
|
if (this.options.markdownPaste !== !1) {
|
|
3103
3182
|
let n = t.types.includes("text/html"), r = n ? t.getData("text/html") : "", i = !n || this._isTriviallyPlainHtml(r), a = t.getData("text/plain");
|
|
3104
|
-
if (a && i &&
|
|
3105
|
-
e.preventDefault(),
|
|
3183
|
+
if (a && i && bn(a)) {
|
|
3184
|
+
e.preventDefault(), D("insertHTML", M(wn(a))), this.context.invoke("editor.afterCommand");
|
|
3106
3185
|
return;
|
|
3107
3186
|
}
|
|
3108
3187
|
}
|
|
3109
3188
|
if (this.options.pasteCleanHTML !== !1 && t.types.includes("text/html")) {
|
|
3110
3189
|
e.preventDefault();
|
|
3111
3190
|
let n = t.getData("text/html"), r = /<[a-z]+:[a-z]/i.test(n) || /class="Mso/i.test(n) || /\bmso-/i.test(n), i = /class="[^"]*\b(?:x[a-z0-9]{6,}|r-[a-z0-9]{3,})\b/.test(n), a = n;
|
|
3112
|
-
r ? a = this._cleanWordHtml(a) : i && (a = this._cleanSocialHtml(a)), a = this._normalizeExternalTaskLists(a), a = M(a), this.options.pasteStripAttributes && (a = this._stripAttributes(a)),
|
|
3191
|
+
r ? a = this._cleanWordHtml(a) : i && (a = this._cleanSocialHtml(a)), a = this._normalizeExternalTaskLists(a), a = M(a), this.options.pasteStripAttributes && (a = this._stripAttributes(a)), D("insertHTML", a), this.context.invoke("editor.afterCommand");
|
|
3113
3192
|
}
|
|
3114
3193
|
}
|
|
3115
3194
|
_onDragover(e) {
|
|
@@ -3141,7 +3220,7 @@ var Jn = class {
|
|
|
3141
3220
|
}
|
|
3142
3221
|
let n = new FileReader();
|
|
3143
3222
|
n.onload = (e) => {
|
|
3144
|
-
|
|
3223
|
+
D("insertHTML", M(wn(e.target.result || ""))), this.context.invoke("editor.afterCommand");
|
|
3145
3224
|
}, n.onerror = () => {
|
|
3146
3225
|
let t = `Failed to read dropped markdown file "${e.name}".`;
|
|
3147
3226
|
console.warn(`[AutumnNote] ${t}`), this.context.triggerEvent("pasteError", { message: t });
|
|
@@ -3243,7 +3322,7 @@ var Jn = class {
|
|
|
3243
3322
|
_escapeHTML(e) {
|
|
3244
3323
|
return e.replaceAll("&", "&").replaceAll("<", "<").replaceAll(">", ">").replaceAll("\"", """).replaceAll("'", "'");
|
|
3245
3324
|
}
|
|
3246
|
-
},
|
|
3325
|
+
}, tr = class {
|
|
3247
3326
|
constructor(e) {
|
|
3248
3327
|
this.context = e, this.options = e.options, this._disposers = [];
|
|
3249
3328
|
}
|
|
@@ -3260,7 +3339,7 @@ var Jn = class {
|
|
|
3260
3339
|
let e = this.context.layoutInfo.editable, t = document.activeElement === e, n = !(e.textContent.replaceAll("", "").trim().length > 0) && !e.querySelector("img, table, hr, .an-video-wrapper");
|
|
3261
3340
|
e.classList.toggle("an-placeholder", n && !t);
|
|
3262
3341
|
}
|
|
3263
|
-
},
|
|
3342
|
+
}, nr = class {
|
|
3264
3343
|
constructor(e) {
|
|
3265
3344
|
this.context = e, this.options = e.options, this._active = !1, this._textarea = null, this._disposers = [];
|
|
3266
3345
|
}
|
|
@@ -3305,7 +3384,7 @@ var Jn = class {
|
|
|
3305
3384
|
return /^<[^/!][^>]*[^/]>/.test(r) && !t.test(r) && !/^<(br|hr|img|input|link|meta)/.test(r) && n++, i;
|
|
3306
3385
|
}).filter(Boolean).join("\n");
|
|
3307
3386
|
}
|
|
3308
|
-
},
|
|
3387
|
+
}, rr = class {
|
|
3309
3388
|
constructor(e) {
|
|
3310
3389
|
this.context = e, this._active = !1, this._disposers = [], this._prevHeight = "";
|
|
3311
3390
|
}
|
|
@@ -3334,7 +3413,7 @@ var Jn = class {
|
|
|
3334
3413
|
let e = this.context.layoutInfo.container;
|
|
3335
3414
|
e.classList.remove("an-fullscreen"), e.style.height = this._prevHeight, document.body.style.overflow = "", this._active = !1, this.context.invoke("toolbar.refresh");
|
|
3336
3415
|
}
|
|
3337
|
-
},
|
|
3416
|
+
}, V = class {
|
|
3338
3417
|
constructor(e) {
|
|
3339
3418
|
this.context = e, this.options = e.options, this._dialog = null, this._disposers = [], this._savedRange = null, this._firstInput = null, this._removeTrap = null;
|
|
3340
3419
|
}
|
|
@@ -3348,7 +3427,7 @@ var Jn = class {
|
|
|
3348
3427
|
this._disposers.forEach((e) => e()), this._disposers = [], this._dialog?.parentNode && this._dialog.remove(), this._dialog = null;
|
|
3349
3428
|
}
|
|
3350
3429
|
_saveRange() {
|
|
3351
|
-
|
|
3430
|
+
Se((e) => {
|
|
3352
3431
|
this._savedRange = e;
|
|
3353
3432
|
});
|
|
3354
3433
|
}
|
|
@@ -3367,7 +3446,7 @@ var Jn = class {
|
|
|
3367
3446
|
}), i = w("div", { class: "an-dialog-box" }), a = w("div", { class: "an-dialog-header" }), o = w("span", { class: "an-dialog-icon" });
|
|
3368
3447
|
o.innerHTML = t;
|
|
3369
3448
|
let s = w("h3", { class: "an-dialog-title" });
|
|
3370
|
-
s.textContent = n, a.appendChild(o), a.appendChild(s), i.appendChild(a), r.appendChild(i),
|
|
3449
|
+
s.textContent = n, a.appendChild(o), a.appendChild(s), i.appendChild(a), r.appendChild(i), he(a, i);
|
|
3371
3450
|
let c = E(r, "click", (e) => {
|
|
3372
3451
|
e.target === r && this._close();
|
|
3373
3452
|
});
|
|
@@ -3390,12 +3469,12 @@ var Jn = class {
|
|
|
3390
3469
|
let o = E(i, "click", n), s = E(a, "click", () => this._close());
|
|
3391
3470
|
return this._disposers.push(o, s), r;
|
|
3392
3471
|
}
|
|
3393
|
-
},
|
|
3472
|
+
}, ir = "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"20\" height=\"20\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><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\"/></svg>", ar = class extends V {
|
|
3394
3473
|
show() {
|
|
3395
3474
|
this._saveRange(), this._prefill(), this._open();
|
|
3396
3475
|
}
|
|
3397
3476
|
_buildDialog() {
|
|
3398
|
-
let e = this.context.locale.linkDialog, { overlay: t, box: n } = this._buildDialogShell(e.ariaLabel,
|
|
3477
|
+
let e = this.context.locale.linkDialog, { overlay: t, box: n } = this._buildDialogShell(e.ariaLabel, ir, e.title), r = w("label", { class: "an-label" });
|
|
3399
3478
|
r.textContent = e.url;
|
|
3400
3479
|
let i = w("input", {
|
|
3401
3480
|
type: "url",
|
|
@@ -3465,12 +3544,12 @@ var Jn = class {
|
|
|
3465
3544
|
}
|
|
3466
3545
|
this._savedRange && this._savedRange.select(), this.context.invoke("editor.insertLink", e, t, n), this._close();
|
|
3467
3546
|
}
|
|
3468
|
-
},
|
|
3547
|
+
}, or = "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"20\" height=\"20\" 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=\"2\"/><circle cx=\"8.5\" cy=\"8.5\" r=\"1.5\"/><polyline points=\"21 15 16 10 5 21\"/></svg>", sr = class extends V {
|
|
3469
3548
|
show({ beforeInsert: e } = {}) {
|
|
3470
3549
|
this._beforeInsert = typeof e == "function" ? e : null, this._saveRange(), this._urlInput.value = "", this._altInput.value = "", this._fileInput && (this._fileInput.value = ""), this._open();
|
|
3471
3550
|
}
|
|
3472
3551
|
_buildDialog() {
|
|
3473
|
-
let e = this.context.locale.imageDialog, { overlay: t, box: n } = this._buildDialogShell(e.ariaLabel,
|
|
3552
|
+
let e = this.context.locale.imageDialog, { overlay: t, box: n } = this._buildDialogShell(e.ariaLabel, or, e.title), r = w("label", { class: "an-label" });
|
|
3474
3553
|
r.textContent = e.imageUrl;
|
|
3475
3554
|
let i = w("input", {
|
|
3476
3555
|
type: "url",
|
|
@@ -3597,12 +3676,12 @@ var Jn = class {
|
|
|
3597
3676
|
_close() {
|
|
3598
3677
|
this._beforeInsert = null, super._close();
|
|
3599
3678
|
}
|
|
3600
|
-
},
|
|
3679
|
+
}, cr = "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"20\" height=\"20\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><polygon points=\"23 7 16 12 23 17 23 7\"/><rect x=\"1\" y=\"5\" width=\"15\" height=\"14\" rx=\"2\"/></svg>", lr = class extends V {
|
|
3601
3680
|
show() {
|
|
3602
3681
|
this._saveRange(), this._urlInput.value = "", this._widthInput.value = "560", this._hintEl.textContent = "", this._open();
|
|
3603
3682
|
}
|
|
3604
3683
|
_buildDialog() {
|
|
3605
|
-
let e = this.context.locale.videoDialog, { overlay: t, box: n } = this._buildDialogShell(e.ariaLabel,
|
|
3684
|
+
let e = this.context.locale.videoDialog, { overlay: t, box: n } = this._buildDialogShell(e.ariaLabel, cr, e.title), r = w("label", { class: "an-label" });
|
|
3606
3685
|
r.textContent = e.videoUrl;
|
|
3607
3686
|
let i = w("input", {
|
|
3608
3687
|
type: "url",
|
|
@@ -3648,7 +3727,7 @@ var Jn = class {
|
|
|
3648
3727
|
this._savedRange && this._savedRange.select(), this.context.invoke("editor.insertVideo", n), this._close();
|
|
3649
3728
|
}
|
|
3650
3729
|
_parseVideoUrl(e) {
|
|
3651
|
-
if (!e || !
|
|
3730
|
+
if (!e || !sn(e, { media: !0 })) return null;
|
|
3652
3731
|
let t = /(?:youtube\.com\/watch\?(?:.*&)?v=|youtube\.com\/embed\/)([a-zA-Z0-9_-]{11})/.exec(e);
|
|
3653
3732
|
if (t) return {
|
|
3654
3733
|
type: "YouTube",
|
|
@@ -3680,10 +3759,10 @@ var Jn = class {
|
|
|
3680
3759
|
return `<div class="an-video-wrapper" style="position:relative;display:block;width:${t}px;max-width:100%"><iframe src="${n.embedUrl}" width="${t}" height="${r}" title="${e}" 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>`;
|
|
3681
3760
|
}
|
|
3682
3761
|
if (n?.type === "Direct video") return `<div class="an-video-wrapper" style="position:relative;display:block;width:${t}px;max-width:100%"><video src="${n.embedUrl.replaceAll("\"", "%22")}" width="${t}" height="${r}" controls style="display:block;max-width:100%"></video><div class="an-video-shield"></div></div>`;
|
|
3683
|
-
let i =
|
|
3762
|
+
let i = sn(e, { media: !0 });
|
|
3684
3763
|
return i ? `<div class="an-video-wrapper" style="position:relative;display:block;width:${t}px;max-width:100%"><video src="${i.replaceAll("\"", "%22")}" width="${t}" height="${r}" controls style="display:block;max-width:100%"></video><div class="an-video-shield"></div></div>` : null;
|
|
3685
3764
|
}
|
|
3686
|
-
},
|
|
3765
|
+
}, ur = [
|
|
3687
3766
|
{
|
|
3688
3767
|
pos: "nw",
|
|
3689
3768
|
cursor: "nw-resize"
|
|
@@ -3716,7 +3795,7 @@ var Jn = class {
|
|
|
3716
3795
|
pos: "w",
|
|
3717
3796
|
cursor: "w-resize"
|
|
3718
3797
|
}
|
|
3719
|
-
],
|
|
3798
|
+
], dr = class {
|
|
3720
3799
|
constructor(e) {
|
|
3721
3800
|
this.context = e, this._active = null, this._overlay = null, this._disposers = [], this._positionRaf = null, this._lastOverlayPos = null;
|
|
3722
3801
|
}
|
|
@@ -3769,9 +3848,9 @@ var Jn = class {
|
|
|
3769
3848
|
}
|
|
3770
3849
|
_buildOverlay() {
|
|
3771
3850
|
let e = document.createElement("div");
|
|
3772
|
-
return e.className = this._overlayClass, e.style.display = "none",
|
|
3851
|
+
return e.className = this._overlayClass, e.style.display = "none", ur.forEach(({ pos: t }) => {
|
|
3773
3852
|
let n = document.createElement("div");
|
|
3774
|
-
n.className = `an-resize-handle an-resize-${t}`, n.dataset.handle = t, this._disposers.push(E(n, "
|
|
3853
|
+
n.className = `an-resize-handle an-resize-${t}`, n.dataset.handle = t, this._disposers.push(E(n, "pointerdown", (e) => {
|
|
3775
3854
|
e.preventDefault(), e.stopPropagation(), this._startResize(e, t);
|
|
3776
3855
|
})), e.appendChild(n);
|
|
3777
3856
|
}), e;
|
|
@@ -3820,11 +3899,13 @@ var Jn = class {
|
|
|
3820
3899
|
t.includes("e") && (_ = Math.max(s, a + e)), t.includes("w") && (_ = Math.max(s, a - e)), t.includes("s") && (v = Math.max(c, o + h)), t.includes("n") && (v = Math.max(c, o - h)), _ = Math.min(_, g), u && (Math.abs(e) >= Math.abs(h) || (_ = Math.min(Math.max(s, Math.round(v * l)), g)), v = Math.max(c, Math.round(_ / l))), this._applySize(n, _, v), this._updateOverlayPosition();
|
|
3821
3900
|
});
|
|
3822
3901
|
}, m = () => {
|
|
3823
|
-
|
|
3902
|
+
document.removeEventListener("pointermove", p), document.removeEventListener("pointerup", h), document.removeEventListener("pointercancel", h);
|
|
3903
|
+
}, h = () => {
|
|
3904
|
+
f !== null && (cancelAnimationFrame(f), f = null), m(), this._dragDisposers = null, this.context.invoke("editor.afterCommand");
|
|
3824
3905
|
};
|
|
3825
|
-
document.addEventListener("
|
|
3906
|
+
document.addEventListener("pointermove", p), document.addEventListener("pointerup", h), document.addEventListener("pointercancel", h), this._dragDisposers = [m];
|
|
3826
3907
|
}
|
|
3827
|
-
},
|
|
3908
|
+
}, fr = class extends dr {
|
|
3828
3909
|
get _overlayClass() {
|
|
3829
3910
|
return "an-image-resizer";
|
|
3830
3911
|
}
|
|
@@ -3853,7 +3934,7 @@ var Jn = class {
|
|
|
3853
3934
|
getActiveImage() {
|
|
3854
3935
|
return this._active;
|
|
3855
3936
|
}
|
|
3856
|
-
},
|
|
3937
|
+
}, pr = class extends dr {
|
|
3857
3938
|
get _overlayClass() {
|
|
3858
3939
|
return "an-video-resizer";
|
|
3859
3940
|
}
|
|
@@ -3889,12 +3970,12 @@ var Jn = class {
|
|
|
3889
3970
|
getActiveWrapper() {
|
|
3890
3971
|
return this._active;
|
|
3891
3972
|
}
|
|
3892
|
-
},
|
|
3973
|
+
}, mr = {
|
|
3893
3974
|
open: "<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 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6\"/><polyline points=\"15 3 21 3 21 9\"/><line x1=\"10\" y1=\"14\" x2=\"21\" y2=\"3\"/></svg>",
|
|
3894
3975
|
edit: "<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=\"M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7\"/><path d=\"M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z\"/></svg>",
|
|
3895
3976
|
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>",
|
|
3896
3977
|
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>"
|
|
3897
|
-
},
|
|
3978
|
+
}, hr = 120, gr = 200, _r = class {
|
|
3898
3979
|
constructor(e) {
|
|
3899
3980
|
this.context = e, this._el = null, this._activeAnchor = null, this._showTimer = null, this._hideTimer = null, this._disposers = [];
|
|
3900
3981
|
}
|
|
@@ -3918,7 +3999,7 @@ var Jn = class {
|
|
|
3918
3999
|
role: "toolbar",
|
|
3919
4000
|
"aria-label": e.ariaLabel
|
|
3920
4001
|
});
|
|
3921
|
-
return t.style.display = "none", this._urlLabel = w("span", { class: "an-link-tooltip-url" }), t.appendChild(this._urlLabel), t.appendChild(w("div", { class: "an-link-tooltip-sep" })), this._openBtn = this._makeBtn(
|
|
4002
|
+
return t.style.display = "none", this._urlLabel = w("span", { class: "an-link-tooltip-url" }), t.appendChild(this._urlLabel), t.appendChild(w("div", { class: "an-link-tooltip-sep" })), this._openBtn = this._makeBtn(mr.open, e.openLink, () => this._openLink()), this._copyBtn = this._makeBtn(mr.copy, e.copyUrl, () => this._copyLink()), this._editBtn = this._makeBtn(mr.edit, e.editLink, () => this._editLink()), this._unlinkBtn = this._makeBtn(mr.unlink, e.removeLink, () => this._unlink()), t.appendChild(this._openBtn), t.appendChild(this._copyBtn), t.appendChild(this._editBtn), t.appendChild(this._unlinkBtn), this._disposers.push(E(t, "mouseenter", () => this._clearTimers()), E(t, "mouseleave", () => this._scheduleHide())), t;
|
|
3922
4003
|
}
|
|
3923
4004
|
_makeBtn(e, t, n) {
|
|
3924
4005
|
let r = w("button", {
|
|
@@ -3933,12 +4014,12 @@ var Jn = class {
|
|
|
3933
4014
|
_scheduleShow(e) {
|
|
3934
4015
|
this._activeAnchor === e && this._el.style.display !== "none" || (clearTimeout(this._hideTimer), this._hideTimer = null, clearTimeout(this._showTimer), this._showTimer = setTimeout(() => {
|
|
3935
4016
|
this._activeAnchor = e, this._show(e);
|
|
3936
|
-
},
|
|
4017
|
+
}, hr));
|
|
3937
4018
|
}
|
|
3938
4019
|
_scheduleHide() {
|
|
3939
4020
|
clearTimeout(this._showTimer), this._showTimer = null, !this._hideTimer && (this._hideTimer = setTimeout(() => {
|
|
3940
4021
|
this._hide();
|
|
3941
|
-
},
|
|
4022
|
+
}, gr));
|
|
3942
4023
|
}
|
|
3943
4024
|
_show(e) {
|
|
3944
4025
|
let t = this.context.layoutInfo.container.classList.contains("an-disabled"), n = e.getAttribute("href") || "";
|
|
@@ -3987,7 +4068,7 @@ var Jn = class {
|
|
|
3987
4068
|
let t = globalThis.getSelection(), n = document.createRange();
|
|
3988
4069
|
n.selectNode(e), t.removeAllRanges(), t.addRange(n), document.execCommand("unlink"), this.context.invoke("editor.afterCommand");
|
|
3989
4070
|
}
|
|
3990
|
-
},
|
|
4071
|
+
}, vr = class {
|
|
3991
4072
|
constructor(e) {
|
|
3992
4073
|
this.context = e, this.options = e.options, this._el = null, this._active = null, this._showTimer = null, this._hideTimer = null, this._disposers = [];
|
|
3993
4074
|
}
|
|
@@ -4028,7 +4109,7 @@ var Jn = class {
|
|
|
4028
4109
|
let t = e.getBoundingClientRect(), n = this._el.offsetWidth || 220, r = this._el.offsetHeight || 32, i = t.bottom + 6, a = t.left + (t.width - n) / 2;
|
|
4029
4110
|
i + r > globalThis.innerHeight - 6 && (i = t.top - r - 6), a + n > globalThis.innerWidth - 6 && (a = globalThis.innerWidth - n - 6), a < 6 && (a = 6), this._el.style.top = `${i}px`, this._el.style.left = `${a}px`;
|
|
4030
4111
|
}
|
|
4031
|
-
},
|
|
4112
|
+
}, H = {
|
|
4032
4113
|
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>",
|
|
4033
4114
|
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>",
|
|
4034
4115
|
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>",
|
|
@@ -4039,7 +4120,7 @@ var Jn = class {
|
|
|
4039
4120
|
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>",
|
|
4040
4121
|
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>",
|
|
4041
4122
|
crop: "<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=\"6 2 6 18 22 18\"/><polyline points=\"2 6 18 6 18 22\"/></svg>"
|
|
4042
|
-
},
|
|
4123
|
+
}, yr = class extends vr {
|
|
4043
4124
|
initialize() {
|
|
4044
4125
|
this._el = this._buildTooltip(), document.body.appendChild(this._el);
|
|
4045
4126
|
let e = this.context.layoutInfo.editable;
|
|
@@ -4064,7 +4145,7 @@ var Jn = class {
|
|
|
4064
4145
|
role: "toolbar",
|
|
4065
4146
|
"aria-label": e.ariaLabel
|
|
4066
4147
|
});
|
|
4067
|
-
return t.style.display = "none", this._label = w("span", { class: "an-link-tooltip-url" }), this._label.textContent = e.label, t.appendChild(this._label), t.appendChild(w("div", { class: "an-link-tooltip-sep" })), this._floatLeftBtn = this._makeBtn(
|
|
4148
|
+
return t.style.display = "none", this._label = w("span", { class: "an-link-tooltip-url" }), this._label.textContent = e.label, t.appendChild(this._label), t.appendChild(w("div", { class: "an-link-tooltip-sep" })), this._floatLeftBtn = this._makeBtn(H.floatLeft, e.floatLeft, () => this._setFloat("left")), this._floatNoneBtn = this._makeBtn(H.floatNone, e.noFloat, () => this._setFloat("")), this._alignCenterBtn = this._makeBtn(H.alignCenter, e.alignCenter, () => this._setCenter()), this._floatRightBtn = this._makeBtn(H.floatRight, e.floatRight, () => this._setFloat("right")), t.appendChild(this._floatLeftBtn), t.appendChild(this._floatNoneBtn), t.appendChild(this._alignCenterBtn), t.appendChild(this._floatRightBtn), t.appendChild(w("div", { class: "an-link-tooltip-sep" })), this._originalBtn = this._makeBtn(H.originalSize, e.originalSize, () => this._resetSize()), t.appendChild(this._originalBtn), t.appendChild(w("div", { class: "an-link-tooltip-sep" })), t.appendChild(this._makeBtn(H.rotateLeft, e.rotateLeft, () => this._rotate(-90))), t.appendChild(this._makeBtn(H.rotateRight, e.rotateRight, () => this._rotate(90))), t.appendChild(w("div", { class: "an-link-tooltip-sep" })), this._cropBtn = this._makeBtn(H.crop, e.cropImage, () => this._crop()), t.appendChild(this._cropBtn), t.appendChild(w("div", { class: "an-link-tooltip-sep" })), this._captionBtn = this._makeBtn(H.caption, e.addCaption, () => this._toggleCaption()), t.appendChild(this._captionBtn), t.appendChild(w("div", { class: "an-link-tooltip-sep" })), this._deleteBtn = this._makeBtn(H.deleteImg, e.deleteImage, () => this._delete(), !0), t.appendChild(this._deleteBtn), this._disposers.push(E(t, "mouseenter", () => this._clearTimers()), E(t, "mouseleave", () => this._scheduleHide())), t;
|
|
4068
4149
|
}
|
|
4069
4150
|
_setFloat(e) {
|
|
4070
4151
|
let t = this._active;
|
|
@@ -4131,7 +4212,7 @@ var Jn = class {
|
|
|
4131
4212
|
let a = globalThis.getSelection();
|
|
4132
4213
|
a && (a.removeAllRanges(), a.addRange(i)), this.context.invoke("editor.afterCommand"), this.context.invoke("imageResizer.updateOverlay"), this._hide();
|
|
4133
4214
|
}
|
|
4134
|
-
},
|
|
4215
|
+
}, U = {
|
|
4135
4216
|
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>",
|
|
4136
4217
|
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>",
|
|
4137
4218
|
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>",
|
|
@@ -4139,7 +4220,7 @@ var Jn = class {
|
|
|
4139
4220
|
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>",
|
|
4140
4221
|
deleteVideo: "<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>",
|
|
4141
4222
|
preview: "<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\"><polygon points=\"5 3 19 12 5 21 5 3\"/></svg>"
|
|
4142
|
-
},
|
|
4223
|
+
}, br = class extends vr {
|
|
4143
4224
|
initialize() {
|
|
4144
4225
|
this._el = this._buildTooltip(), document.body.appendChild(this._el);
|
|
4145
4226
|
let e = this.context.layoutInfo.editable;
|
|
@@ -4170,7 +4251,7 @@ var Jn = class {
|
|
|
4170
4251
|
role: "toolbar",
|
|
4171
4252
|
"aria-label": e.ariaLabel
|
|
4172
4253
|
});
|
|
4173
|
-
return t.style.display = "none", this._label = w("span", { class: "an-link-tooltip-url" }), this._label.textContent = e.label, t.appendChild(this._label), t.appendChild(w("div", { class: "an-link-tooltip-sep" })), this._floatLeftBtn = this._makeBtn(
|
|
4254
|
+
return t.style.display = "none", this._label = w("span", { class: "an-link-tooltip-url" }), this._label.textContent = e.label, t.appendChild(this._label), t.appendChild(w("div", { class: "an-link-tooltip-sep" })), this._floatLeftBtn = this._makeBtn(U.floatLeft, e.floatLeft, () => this._setFloat("left")), this._floatNoneBtn = this._makeBtn(U.floatNone, e.noFloat, () => this._setFloat("")), this._alignCenterBtn = this._makeBtn(U.alignCenter, e.alignCenter, () => this._setCenter()), this._floatRightBtn = this._makeBtn(U.floatRight, e.floatRight, () => this._setFloat("right")), t.appendChild(this._floatLeftBtn), t.appendChild(this._floatNoneBtn), t.appendChild(this._alignCenterBtn), t.appendChild(this._floatRightBtn), t.appendChild(w("div", { class: "an-link-tooltip-sep" })), this._originalBtn = this._makeBtn(U.originalSize, e.originalSize, () => this._resetSize()), t.appendChild(this._originalBtn), t.appendChild(w("div", { class: "an-link-tooltip-sep" })), this._previewBtn = this._makeBtn(U.preview, e.previewVideo, () => this._togglePreview()), t.appendChild(this._previewBtn), t.appendChild(w("div", { class: "an-link-tooltip-sep" })), this._deleteBtn = this._makeBtn(U.deleteVideo, e.deleteVideo, () => this._delete(), !0), t.appendChild(this._deleteBtn), this._disposers.push(E(t, "mouseenter", () => this._clearTimers()), E(t, "mouseleave", () => this._scheduleHide())), t;
|
|
4174
4255
|
}
|
|
4175
4256
|
_setFloat(e) {
|
|
4176
4257
|
let t = this._active;
|
|
@@ -4217,8 +4298,35 @@ var Jn = class {
|
|
|
4217
4298
|
}
|
|
4218
4299
|
this._previewBtn.classList.remove("an-link-tooltip-btn--copied"), this._previewBtn.title = this.context.locale.tooltips.video.previewVideo, this._previewClickOff &&= (document.removeEventListener("mousedown", this._previewClickOff, !0), null);
|
|
4219
4300
|
}
|
|
4220
|
-
},
|
|
4221
|
-
|
|
4301
|
+
}, W = {
|
|
4302
|
+
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>",
|
|
4303
|
+
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>",
|
|
4304
|
+
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>",
|
|
4305
|
+
colLeft: "<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=\"12\" y1=\"3\" x2=\"12\" y2=\"21\"/><path d=\"M3 12h7\"/><path d=\"M7 8l-4 4 4 4\"/></svg>",
|
|
4306
|
+
colRight: "<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=\"12\" y1=\"3\" x2=\"12\" y2=\"21\"/><path d=\"M12 12h9\"/><path d=\"M17 8l4 4-4 4\"/></svg>",
|
|
4307
|
+
deleteCol: "<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=\"12\" y1=\"3\" x2=\"12\" y2=\"21\"/><line x1=\"15\" y1=\"6\" x2=\"21\" y2=\"12\"/><line x1=\"21\" y1=\"6\" x2=\"15\" y2=\"12\"/></svg>",
|
|
4308
|
+
mergeCells: "<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=\"7\" width=\"8\" height=\"10\" rx=\"1\"/><rect x=\"14\" y=\"7\" width=\"8\" height=\"10\" rx=\"1\"/><path d=\"M10 12h4\"/><path d=\"M12 10l2 2-2 2\"/></svg>",
|
|
4309
|
+
unmergeCells: "<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=\"5\" width=\"20\" height=\"14\" rx=\"1\"/><line x1=\"12\" y1=\"5\" x2=\"12\" y2=\"19\" stroke-dasharray=\"2.5 2\"/><line x1=\"2\" y1=\"12\" x2=\"22\" y2=\"12\" stroke-dasharray=\"2.5 2\"/><path d=\"M9 9 L6 12 L9 15\"/><path d=\"M15 9 L18 12 L15 15\"/></svg>",
|
|
4310
|
+
colWidth: "<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=\"7\" y1=\"4\" x2=\"7\" y2=\"20\"/><line x1=\"17\" y1=\"4\" x2=\"17\" y2=\"20\"/><line x1=\"7\" y1=\"12\" x2=\"17\" y2=\"12\"/><path d=\"M10 9l-3 3 3 3\"/><path d=\"M14 9l3 3-3 3\"/></svg>",
|
|
4311
|
+
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>",
|
|
4312
|
+
tableBorder: "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"13\" height=\"13\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"round\"><line x1=\"3\" y1=\"6\" x2=\"21\" y2=\"6\" stroke-width=\"1\"/><line x1=\"3\" y1=\"13\" x2=\"21\" y2=\"13\" stroke-width=\"2\"/><line x1=\"3\" y1=\"20\" x2=\"21\" y2=\"20\" stroke-width=\"3\"/></svg>",
|
|
4313
|
+
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>",
|
|
4314
|
+
selectCells: "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"13\" height=\"13\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.8\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M4 4 L4 20 L9 15 L12 21 L14 20 L11 14 L17 14 Z\" fill=\"currentColor\" opacity=\"0.15\"/><path d=\"M4 4 L4 20 L9 15 L12 21 L14 20 L11 14 L17 14 Z\"/></svg>",
|
|
4315
|
+
cellShade: "<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=\"M19 11L8.93 3.36a1 1 0 0 0-1.29.08L3.22 7.8a1 1 0 0 0-.07 1.29L11 20\"/><path d=\"m5 14 5-5\"/><path d=\"M22 22a2 2 0 0 1-2 2h-3a2 2 0 0 1-2-2c0-1.5 2.5-5 3.5-5s3.5 3.5 3.5 5z\"/></svg>",
|
|
4316
|
+
borderColor: "<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=\"14\" rx=\"1\"/><line x1=\"3\" y1=\"10\" x2=\"21\" y2=\"10\" stroke-width=\"1.5\"/><line x1=\"12\" y1=\"3\" x2=\"12\" y2=\"17\" stroke-width=\"1.5\"/><path d=\"M3 21h18\" stroke-width=\"3\"/></svg>",
|
|
4317
|
+
alignLeft: "<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=\"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\"/></svg>",
|
|
4318
|
+
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\"><line x1=\"21\" y1=\"6\" x2=\"3\" y2=\"6\"/><line x1=\"17\" y1=\"12\" x2=\"7\" y2=\"12\"/><line x1=\"19\" y1=\"18\" x2=\"5\" y2=\"18\"/></svg>",
|
|
4319
|
+
alignRight: "<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=\"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\"/></svg>",
|
|
4320
|
+
alignJustify: "<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=\"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\"/></svg>",
|
|
4321
|
+
headerRow: "<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\"/><rect x=\"3\" y=\"3\" width=\"18\" height=\"8\" rx=\"1\" fill=\"currentColor\" opacity=\"0.2\"/><line x1=\"3\" y1=\"11\" x2=\"21\" y2=\"11\"/><line x1=\"3\" y1=\"16\" x2=\"21\" y2=\"16\"/><line x1=\"9\" y1=\"11\" x2=\"9\" y2=\"21\"/><line x1=\"15\" y1=\"11\" x2=\"15\" y2=\"21\"/></svg>",
|
|
4322
|
+
sortAsc: "<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=\"6\" x2=\"11\" y2=\"6\"/><line x1=\"4\" y1=\"12\" x2=\"11\" y2=\"12\"/><line x1=\"4\" y1=\"18\" x2=\"13\" y2=\"18\"/><path d=\"M15 9l3-3 3 3\"/><line x1=\"18\" y1=\"6\" x2=\"18\" y2=\"18\"/></svg>",
|
|
4323
|
+
sortDesc: "<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=\"6\" x2=\"13\" y2=\"6\"/><line x1=\"4\" y1=\"12\" x2=\"11\" y2=\"12\"/><line x1=\"4\" y1=\"18\" x2=\"11\" y2=\"18\"/><path d=\"M15 15l3 3 3-3\"/><line x1=\"18\" y1=\"6\" x2=\"18\" y2=\"18\"/></svg>",
|
|
4324
|
+
exportCSV: "<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 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4\"/><polyline points=\"7 10 12 15 17 10\"/><line x1=\"12\" y1=\"15\" x2=\"12\" y2=\"3\"/></svg>",
|
|
4325
|
+
cellPadding: "<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\"/><rect x=\"7\" y=\"7\" width=\"10\" height=\"10\" rx=\"0.5\" stroke-dasharray=\"2 1.5\"/></svg>"
|
|
4326
|
+
};
|
|
4327
|
+
//#endregion
|
|
4328
|
+
//#region src/js/module/table-grid.js
|
|
4329
|
+
function xr(e) {
|
|
4222
4330
|
let t = e.closest("tr");
|
|
4223
4331
|
if (!t) return -1;
|
|
4224
4332
|
let n = 0;
|
|
@@ -4228,7 +4336,7 @@ function vr(e) {
|
|
|
4228
4336
|
}
|
|
4229
4337
|
return -1;
|
|
4230
4338
|
}
|
|
4231
|
-
function
|
|
4339
|
+
function G(e, t) {
|
|
4232
4340
|
let n = 0;
|
|
4233
4341
|
for (let r of e.cells) {
|
|
4234
4342
|
if (n === t) return r;
|
|
@@ -4237,7 +4345,7 @@ function K(e, t) {
|
|
|
4237
4345
|
}
|
|
4238
4346
|
return null;
|
|
4239
4347
|
}
|
|
4240
|
-
function
|
|
4348
|
+
function Sr(e, t) {
|
|
4241
4349
|
let n = 0;
|
|
4242
4350
|
for (let r of e.cells) if (n += r.colSpan || 1, n > t) {
|
|
4243
4351
|
let e = r.nextElementSibling;
|
|
@@ -4245,7 +4353,7 @@ function yr(e, t) {
|
|
|
4245
4353
|
}
|
|
4246
4354
|
return null;
|
|
4247
4355
|
}
|
|
4248
|
-
function
|
|
4356
|
+
function Cr(e) {
|
|
4249
4357
|
let t = Array.from(e.rows), n = {}, r = /* @__PURE__ */ new WeakMap();
|
|
4250
4358
|
return t.forEach((e, t) => {
|
|
4251
4359
|
n[t] || (n[t] = {});
|
|
@@ -4270,32 +4378,9 @@ function br(e) {
|
|
|
4270
4378
|
cellPos: r
|
|
4271
4379
|
};
|
|
4272
4380
|
}
|
|
4273
|
-
|
|
4274
|
-
|
|
4275
|
-
|
|
4276
|
-
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>",
|
|
4277
|
-
colLeft: "<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=\"12\" y1=\"3\" x2=\"12\" y2=\"21\"/><path d=\"M3 12h7\"/><path d=\"M7 8l-4 4 4 4\"/></svg>",
|
|
4278
|
-
colRight: "<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=\"12\" y1=\"3\" x2=\"12\" y2=\"21\"/><path d=\"M12 12h9\"/><path d=\"M17 8l4 4-4 4\"/></svg>",
|
|
4279
|
-
deleteCol: "<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=\"12\" y1=\"3\" x2=\"12\" y2=\"21\"/><line x1=\"15\" y1=\"6\" x2=\"21\" y2=\"12\"/><line x1=\"21\" y1=\"6\" x2=\"15\" y2=\"12\"/></svg>",
|
|
4280
|
-
mergeCells: "<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=\"7\" width=\"8\" height=\"10\" rx=\"1\"/><rect x=\"14\" y=\"7\" width=\"8\" height=\"10\" rx=\"1\"/><path d=\"M10 12h4\"/><path d=\"M12 10l2 2-2 2\"/></svg>",
|
|
4281
|
-
unmergeCells: "<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=\"5\" width=\"20\" height=\"14\" rx=\"1\"/><line x1=\"12\" y1=\"5\" x2=\"12\" y2=\"19\" stroke-dasharray=\"2.5 2\"/><line x1=\"2\" y1=\"12\" x2=\"22\" y2=\"12\" stroke-dasharray=\"2.5 2\"/><path d=\"M9 9 L6 12 L9 15\"/><path d=\"M15 9 L18 12 L15 15\"/></svg>",
|
|
4282
|
-
colWidth: "<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=\"7\" y1=\"4\" x2=\"7\" y2=\"20\"/><line x1=\"17\" y1=\"4\" x2=\"17\" y2=\"20\"/><line x1=\"7\" y1=\"12\" x2=\"17\" y2=\"12\"/><path d=\"M10 9l-3 3 3 3\"/><path d=\"M14 9l3 3-3 3\"/></svg>",
|
|
4283
|
-
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>",
|
|
4284
|
-
tableBorder: "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"13\" height=\"13\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"round\"><line x1=\"3\" y1=\"6\" x2=\"21\" y2=\"6\" stroke-width=\"1\"/><line x1=\"3\" y1=\"13\" x2=\"21\" y2=\"13\" stroke-width=\"2\"/><line x1=\"3\" y1=\"20\" x2=\"21\" y2=\"20\" stroke-width=\"3\"/></svg>",
|
|
4285
|
-
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>",
|
|
4286
|
-
selectCells: "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"13\" height=\"13\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.8\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M4 4 L4 20 L9 15 L12 21 L14 20 L11 14 L17 14 Z\" fill=\"currentColor\" opacity=\"0.15\"/><path d=\"M4 4 L4 20 L9 15 L12 21 L14 20 L11 14 L17 14 Z\"/></svg>",
|
|
4287
|
-
cellShade: "<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=\"M19 11L8.93 3.36a1 1 0 0 0-1.29.08L3.22 7.8a1 1 0 0 0-.07 1.29L11 20\"/><path d=\"m5 14 5-5\"/><path d=\"M22 22a2 2 0 0 1-2 2h-3a2 2 0 0 1-2-2c0-1.5 2.5-5 3.5-5s3.5 3.5 3.5 5z\"/></svg>",
|
|
4288
|
-
borderColor: "<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=\"14\" rx=\"1\"/><line x1=\"3\" y1=\"10\" x2=\"21\" y2=\"10\" stroke-width=\"1.5\"/><line x1=\"12\" y1=\"3\" x2=\"12\" y2=\"17\" stroke-width=\"1.5\"/><path d=\"M3 21h18\" stroke-width=\"3\"/></svg>",
|
|
4289
|
-
alignLeft: "<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=\"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\"/></svg>",
|
|
4290
|
-
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\"><line x1=\"21\" y1=\"6\" x2=\"3\" y2=\"6\"/><line x1=\"17\" y1=\"12\" x2=\"7\" y2=\"12\"/><line x1=\"19\" y1=\"18\" x2=\"5\" y2=\"18\"/></svg>",
|
|
4291
|
-
alignRight: "<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=\"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\"/></svg>",
|
|
4292
|
-
alignJustify: "<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=\"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\"/></svg>",
|
|
4293
|
-
headerRow: "<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\"/><rect x=\"3\" y=\"3\" width=\"18\" height=\"8\" rx=\"1\" fill=\"currentColor\" opacity=\"0.2\"/><line x1=\"3\" y1=\"11\" x2=\"21\" y2=\"11\"/><line x1=\"3\" y1=\"16\" x2=\"21\" y2=\"16\"/><line x1=\"9\" y1=\"11\" x2=\"9\" y2=\"21\"/><line x1=\"15\" y1=\"11\" x2=\"15\" y2=\"21\"/></svg>",
|
|
4294
|
-
sortAsc: "<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=\"6\" x2=\"11\" y2=\"6\"/><line x1=\"4\" y1=\"12\" x2=\"11\" y2=\"12\"/><line x1=\"4\" y1=\"18\" x2=\"13\" y2=\"18\"/><path d=\"M15 9l3-3 3 3\"/><line x1=\"18\" y1=\"6\" x2=\"18\" y2=\"18\"/></svg>",
|
|
4295
|
-
sortDesc: "<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=\"6\" x2=\"13\" y2=\"6\"/><line x1=\"4\" y1=\"12\" x2=\"11\" y2=\"12\"/><line x1=\"4\" y1=\"18\" x2=\"11\" y2=\"18\"/><path d=\"M15 15l3 3 3-3\"/><line x1=\"18\" y1=\"6\" x2=\"18\" y2=\"18\"/></svg>",
|
|
4296
|
-
exportCSV: "<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 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4\"/><polyline points=\"7 10 12 15 17 10\"/><line x1=\"12\" y1=\"15\" x2=\"12\" y2=\"3\"/></svg>",
|
|
4297
|
-
cellPadding: "<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\"/><rect x=\"7\" y=\"7\" width=\"10\" height=\"10\" rx=\"0.5\" stroke-dasharray=\"2 1.5\"/></svg>"
|
|
4298
|
-
}, xr = [
|
|
4381
|
+
//#endregion
|
|
4382
|
+
//#region src/js/module/TableTooltip.js
|
|
4383
|
+
var wr = 120, Tr = 200, Er = [
|
|
4299
4384
|
"#000000",
|
|
4300
4385
|
"#434343",
|
|
4301
4386
|
"#666666",
|
|
@@ -4320,7 +4405,7 @@ var q = {
|
|
|
4320
4405
|
"#c9daf8",
|
|
4321
4406
|
"#d9d2e9",
|
|
4322
4407
|
"#ead1dc"
|
|
4323
|
-
],
|
|
4408
|
+
], Dr = class {
|
|
4324
4409
|
constructor(e) {
|
|
4325
4410
|
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, this._shadePopover = null, this._shadeTitleEl = null, this._shadeColorStrip = null, this._borderColorPopover = null, this._borderColorTitleEl = null, this._borderColorStrip = null, this._borderColorNoBtn = null, this._selectMode = !1, this._selectedCells = [], this._selectStart = null, this._selectDragging = !1, this._selectBtn = null, this._editable = null;
|
|
4326
4411
|
}
|
|
@@ -4378,7 +4463,7 @@ var q = {
|
|
|
4378
4463
|
});
|
|
4379
4464
|
}), E(e, "mousedown", (e) => {
|
|
4380
4465
|
if (!this.context.layoutInfo.container.classList.contains("an-disabled") && !(!t || !n)) {
|
|
4381
|
-
if (r = !0, i = n, a = e.clientX, o = e.clientY, f = t.closest("table"), i === "col") l =
|
|
4466
|
+
if (r = !0, i = n, a = e.clientX, o = e.clientY, f = t.closest("table"), i === "col") l = xr(t) + (t.colSpan || 1) - 1, u = l >= 0 ? Array.from(f.querySelectorAll("tr")).map((e) => G(e, l)).filter(Boolean).filter((e) => (e.colSpan || 1) === 1) : [], s = u.length > 0 ? u[0].offsetWidth : Math.max(30, Math.round(t.offsetWidth / (t.colSpan || 1))), document.body.style.cursor = "col-resize";
|
|
4382
4467
|
else {
|
|
4383
4468
|
let e = t.closest("tr"), n = (e ? Array.from(f.rows).indexOf(e) : 0) + (t.rowSpan || 1) - 1;
|
|
4384
4469
|
d = f.rows[n] || e, c = d ? d.offsetHeight : 40, document.body.style.cursor = "row-resize";
|
|
@@ -4410,27 +4495,27 @@ var q = {
|
|
|
4410
4495
|
role: "toolbar",
|
|
4411
4496
|
"aria-label": e.ariaLabel
|
|
4412
4497
|
});
|
|
4413
|
-
t.style.display = "none", this._label = w("span", { class: "an-link-tooltip-url" }), this._label.textContent = e.label, t.appendChild(this._label), t.appendChild(this._sep()), this._selectBtn = this._makeBtn(
|
|
4498
|
+
t.style.display = "none", this._label = w("span", { class: "an-link-tooltip-url" }), this._label.textContent = e.label, t.appendChild(this._label), t.appendChild(this._sep()), this._selectBtn = this._makeBtn(W.selectCells, e.selectCells, () => this._toggleSelectMode()), t.appendChild(this._selectBtn), t.appendChild(this._sep()), t.appendChild(this._makeBtn(W.rowAbove, e.addRowAbove, () => this._addRow("above"))), t.appendChild(this._makeBtn(W.rowBelow, e.addRowBelow, () => this._addRow("below"))), t.appendChild(this._makeBtn(W.deleteRow, e.deleteRow, () => this._deleteRow())), t.appendChild(this._sep()), t.appendChild(this._makeBtn(W.colLeft, e.addColumnLeft, () => this._addColumn("left"))), t.appendChild(this._makeBtn(W.colRight, e.addColumnRight, () => this._addColumn("right"))), t.appendChild(this._makeBtn(W.deleteCol, e.deleteColumn, () => this._deleteColumn())), t.appendChild(this._makeBtn(W.sortAsc, e.sortAsc, () => this._sortColumn("asc"))), t.appendChild(this._makeBtn(W.sortDesc, e.sortDesc, () => this._sortColumn("desc"))), t.appendChild(this._sep()), t.appendChild(this._makeBtn(W.mergeCells, e.mergeCells, () => this._mergeCells())), t.appendChild(this._makeBtn(W.unmergeCells, e.unmergeCells, () => this._unmergeCells())), t.appendChild(this._sep()), t.appendChild(this._makeBtn(W.alignLeft, e.cellAlignLeft, () => this._applyCellAlign("left"))), t.appendChild(this._makeBtn(W.alignCenter, e.cellAlignCenter, () => this._applyCellAlign("center"))), t.appendChild(this._makeBtn(W.alignRight, e.cellAlignRight, () => this._applyCellAlign("right"))), t.appendChild(this._makeBtn(W.alignJustify, e.cellAlignJustify, () => this._applyCellAlign("justify"))), t.appendChild(this._makeBtn(W.headerRow, e.toggleHeaderRow, () => this._toggleHeaderRow())), t.appendChild(this._sep());
|
|
4414
4499
|
let n = w("button", {
|
|
4415
4500
|
type: "button",
|
|
4416
4501
|
class: "an-link-tooltip-btn an-link-tooltip-btn--shade",
|
|
4417
4502
|
title: e.cellBackground
|
|
4418
4503
|
}), r = w("span", { class: "an-bubble-btn-svg" });
|
|
4419
|
-
r.innerHTML =
|
|
4504
|
+
r.innerHTML = W.cellShade;
|
|
4420
4505
|
let i = w("span", { class: "an-link-tooltip-color-strip" });
|
|
4421
4506
|
n.appendChild(r), n.appendChild(i), this._shadeColorStrip = i, this._disposers.push(E(n, "click", (e) => {
|
|
4422
4507
|
e.preventDefault(), e.stopPropagation(), this._openCellShadePopover();
|
|
4423
|
-
})), t.appendChild(n), t.appendChild(this._sep()), t.appendChild(this._makeBtn(
|
|
4508
|
+
})), t.appendChild(n), t.appendChild(this._sep()), t.appendChild(this._makeBtn(W.colWidth, e.columnWidth, () => this._openSizePopover("col"))), t.appendChild(this._makeBtn(W.rowHeight, e.rowHeight, () => this._openSizePopover("row"))), t.appendChild(this._makeBtn(W.tableBorder, e.tableBorderWidth, () => this._openSizePopover("border"))), t.appendChild(this._makeBtn(W.cellPadding, e.cellPadding, () => this._openSizePopover("cellPadding")));
|
|
4424
4509
|
let a = w("button", {
|
|
4425
4510
|
type: "button",
|
|
4426
4511
|
class: "an-link-tooltip-btn an-link-tooltip-btn--shade",
|
|
4427
4512
|
title: e.tableBorderColor
|
|
4428
4513
|
}), o = w("span", { class: "an-bubble-btn-svg" });
|
|
4429
|
-
o.innerHTML =
|
|
4514
|
+
o.innerHTML = W.borderColor;
|
|
4430
4515
|
let s = w("span", { class: "an-link-tooltip-color-strip" });
|
|
4431
4516
|
return a.appendChild(o), a.appendChild(s), this._borderColorStrip = s, this._disposers.push(E(a, "click", (e) => {
|
|
4432
4517
|
e.preventDefault(), e.stopPropagation(), this._openBorderColorPopover();
|
|
4433
|
-
})), t.appendChild(a), t.appendChild(this._sep()), t.appendChild(this._makeBtn(
|
|
4518
|
+
})), t.appendChild(a), t.appendChild(this._sep()), t.appendChild(this._makeBtn(W.deleteTable, e.deleteTable, () => this._deleteTable(), !0)), t.appendChild(this._sep()), t.appendChild(this._makeBtn(W.exportCSV, e.exportCSV, () => this._exportTableCSV())), this._disposers.push(E(t, "mouseenter", () => this._clearTimers()), E(t, "mouseleave", () => {
|
|
4434
4519
|
this._selectMode || this._sizePopover && this._sizePopover.style.display !== "none" || this._shadePopover && this._shadePopover.style.display !== "none" || this._borderColorPopover && this._borderColorPopover.style.display !== "none" || this._scheduleHide();
|
|
4435
4520
|
})), t;
|
|
4436
4521
|
}
|
|
@@ -4450,10 +4535,10 @@ var q = {
|
|
|
4450
4535
|
_scheduleShow(e) {
|
|
4451
4536
|
this._activeTable === e && this._el.style.display !== "none" || (clearTimeout(this._hideTimer), this._hideTimer = null, clearTimeout(this._showTimer), this._showTimer = setTimeout(() => {
|
|
4452
4537
|
this._activeTable = e, this._show();
|
|
4453
|
-
},
|
|
4538
|
+
}, wr));
|
|
4454
4539
|
}
|
|
4455
4540
|
_scheduleHide() {
|
|
4456
|
-
clearTimeout(this._showTimer), this._showTimer = null, !this._hideTimer && (this._hideTimer = setTimeout(() => this._hide(),
|
|
4541
|
+
clearTimeout(this._showTimer), this._showTimer = null, !this._hideTimer && (this._hideTimer = setTimeout(() => this._hide(), Tr));
|
|
4457
4542
|
}
|
|
4458
4543
|
_show() {
|
|
4459
4544
|
this._activeTable && (this._el.style.display = "flex", this._syncShadeStrip(), this._syncBorderColorStrip(), requestAnimationFrame(() => {
|
|
@@ -4502,7 +4587,7 @@ var q = {
|
|
|
4502
4587
|
if (!t || e === t) return [e];
|
|
4503
4588
|
let n = e.closest("table");
|
|
4504
4589
|
if (!n?.contains(t)) return [e];
|
|
4505
|
-
let { gridMap: r, cellPos: i } =
|
|
4590
|
+
let { gridMap: r, cellPos: i } = Cr(n), a = i.get(e), o = i.get(t);
|
|
4506
4591
|
if (!a || !o) return [e];
|
|
4507
4592
|
let s = Math.min(a.r, o.r), c = Math.max(a.r + a.rs - 1, o.r + o.rs - 1), l = Math.min(a.c, o.c), u = Math.max(a.c + a.cs - 1, o.c + o.cs - 1), d = !0;
|
|
4508
4593
|
for (; d;) {
|
|
@@ -4550,7 +4635,7 @@ var q = {
|
|
|
4550
4635
|
if (!t.length) return;
|
|
4551
4636
|
let n = t[0].closest("table");
|
|
4552
4637
|
if (!n) return;
|
|
4553
|
-
let r = t.map((e) =>
|
|
4638
|
+
let r = t.map((e) => xr(e)), i = e === "left" ? Math.min(...r) : Math.max(...r), a = Array.from(n.querySelectorAll("tr")), o = a.map((t) => e === "left" ? G(t, i) : Sr(t, i)), s = a.map((e) => e.closest("thead") !== null);
|
|
4554
4639
|
a.forEach((e, t) => {
|
|
4555
4640
|
e.insertBefore(w(s[t] ? "th" : "td", {}, ["\xA0"]), o[t]);
|
|
4556
4641
|
}), requestAnimationFrame(() => this._positionNear(this._activeTable)), this.context.invoke("editor.afterCommand");
|
|
@@ -4570,12 +4655,12 @@ var q = {
|
|
|
4570
4655
|
if (!t) return;
|
|
4571
4656
|
let n = Array.from(t.querySelectorAll("tr"));
|
|
4572
4657
|
if (n[0] && n[0].cells.length <= 1) return;
|
|
4573
|
-
let r = [...new Set(e.map((e) =>
|
|
4658
|
+
let r = [...new Set(e.map((e) => xr(e)))];
|
|
4574
4659
|
if (r.length >= (n[0]?.cells.length ?? 1)) return;
|
|
4575
4660
|
let i = [];
|
|
4576
4661
|
r.forEach((e) => {
|
|
4577
4662
|
n.forEach((t) => {
|
|
4578
|
-
let n =
|
|
4663
|
+
let n = G(t, e);
|
|
4579
4664
|
n && i.push(n);
|
|
4580
4665
|
});
|
|
4581
4666
|
}), this._activeCell = null, this._clearSelection(), i.forEach((e) => e.remove()), requestAnimationFrame(() => this._positionNear(this._activeTable)), this.context.invoke("editor.afterCommand");
|
|
@@ -4598,7 +4683,7 @@ var q = {
|
|
|
4598
4683
|
}
|
|
4599
4684
|
}), n.length < 2) return;
|
|
4600
4685
|
}
|
|
4601
|
-
let { gridMap: r, cellPos: i } =
|
|
4686
|
+
let { gridMap: r, cellPos: i } = Cr(t), a = Infinity, o = -Infinity, s = Infinity, c = -Infinity;
|
|
4602
4687
|
if (n.forEach((e) => {
|
|
4603
4688
|
let t = i.get(e);
|
|
4604
4689
|
t && (t.r < a && (a = t.r), t.r + t.rs - 1 > o && (o = t.r + t.rs - 1), t.c < s && (s = t.c), t.c + t.cs - 1 > c && (c = t.c + t.cs - 1));
|
|
@@ -4637,7 +4722,7 @@ var q = {
|
|
|
4637
4722
|
_unmergeOne(e, t) {
|
|
4638
4723
|
let n = e.colSpan || 1, r = e.rowSpan || 1;
|
|
4639
4724
|
if (n === 1 && r === 1) return;
|
|
4640
|
-
let { cellPos: i } =
|
|
4725
|
+
let { cellPos: i } = Cr(t), a = i.get(e);
|
|
4641
4726
|
if (!a) return;
|
|
4642
4727
|
let { r: o, c: s } = a, c = Array.from(t.rows), l = e.tagName.toLowerCase();
|
|
4643
4728
|
if (e.rowSpan = 1, e.colSpan = 1, e.style.verticalAlign = "", n > 1) {
|
|
@@ -4724,10 +4809,10 @@ var q = {
|
|
|
4724
4809
|
let i = t.closest("table");
|
|
4725
4810
|
if (i) {
|
|
4726
4811
|
if (n) {
|
|
4727
|
-
let t = [...new Set(r.map((e) =>
|
|
4812
|
+
let t = [...new Set(r.map((e) => xr(e)))], n = Array.from(i.querySelectorAll("tr"));
|
|
4728
4813
|
t.forEach((t) => {
|
|
4729
4814
|
n.forEach((n) => {
|
|
4730
|
-
let r =
|
|
4815
|
+
let r = G(n, t);
|
|
4731
4816
|
r && (r.colSpan || 1) === 1 && (r.style.width = `${e}px`, r.style.minWidth = `${e}px`);
|
|
4732
4817
|
});
|
|
4733
4818
|
});
|
|
@@ -4748,44 +4833,62 @@ var q = {
|
|
|
4748
4833
|
_hideSizePopover() {
|
|
4749
4834
|
this._sizePopover && (this._sizePopover.style.display = "none"), this._sizeApply = null;
|
|
4750
4835
|
}
|
|
4751
|
-
|
|
4752
|
-
let
|
|
4753
|
-
|
|
4754
|
-
let
|
|
4755
|
-
|
|
4756
|
-
let
|
|
4757
|
-
|
|
4758
|
-
let
|
|
4836
|
+
_buildColorPopover({ defaultColor: e, apply: t, getPopover: n, hide: r }) {
|
|
4837
|
+
let i = w("div", { class: "an-cell-shade-popover" });
|
|
4838
|
+
i.style.display = "none";
|
|
4839
|
+
let a = w("div", { class: "an-size-popover-title" });
|
|
4840
|
+
i.appendChild(a);
|
|
4841
|
+
let o = w("div", { class: "an-context-color-palette" });
|
|
4842
|
+
Er.forEach((e) => {
|
|
4843
|
+
let n = w("div", {
|
|
4759
4844
|
class: "an-context-color-swatch",
|
|
4760
4845
|
title: e
|
|
4761
4846
|
});
|
|
4762
|
-
|
|
4763
|
-
|
|
4764
|
-
})),
|
|
4765
|
-
}),
|
|
4766
|
-
let
|
|
4847
|
+
n.style.background = e, this._disposers.push(E(n, "click", (n) => {
|
|
4848
|
+
n.stopPropagation(), t(e);
|
|
4849
|
+
})), o.appendChild(n);
|
|
4850
|
+
}), i.appendChild(o);
|
|
4851
|
+
let s = w("div", { class: "an-context-color-custom" }), c = w("button", {
|
|
4767
4852
|
type: "button",
|
|
4768
4853
|
class: "an-shade-no-color"
|
|
4769
4854
|
});
|
|
4770
|
-
this._disposers.push(E(
|
|
4771
|
-
let
|
|
4855
|
+
this._disposers.push(E(c, "click", () => t(""))), s.appendChild(c), i.appendChild(s);
|
|
4856
|
+
let l = w("div", { class: "an-context-color-custom" }), u = w("input", {
|
|
4772
4857
|
type: "color",
|
|
4773
4858
|
class: "an-shade-color-input",
|
|
4774
|
-
value:
|
|
4775
|
-
}),
|
|
4776
|
-
return
|
|
4777
|
-
let t = e.target;
|
|
4778
|
-
|
|
4779
|
-
})),
|
|
4859
|
+
value: e
|
|
4860
|
+
}), d = w("span");
|
|
4861
|
+
return d.textContent = this.context.locale.contextMenu.customColorLabel, this._disposers.push(E(u, "change", () => t(u.value))), l.appendChild(u), l.appendChild(d), i.appendChild(l), this._disposers.push(E(i, "mousedown", (e) => e.preventDefault()), E(i, "mouseenter", () => this._clearTimers()), E(i, "mouseleave", () => this._scheduleHide()), E(document, "click", (e) => {
|
|
4862
|
+
let t = e.target, i = n();
|
|
4863
|
+
i && i.style.display !== "none" && !i.contains(t) && !this._el?.contains(t) && r();
|
|
4864
|
+
})), {
|
|
4865
|
+
el: i,
|
|
4866
|
+
titleEl: a,
|
|
4867
|
+
noColorBtn: c
|
|
4868
|
+
};
|
|
4869
|
+
}
|
|
4870
|
+
_showColorPopover(e) {
|
|
4871
|
+
let t = e();
|
|
4872
|
+
t && (t.style.display = "block", requestAnimationFrame(() => {
|
|
4873
|
+
let t = e();
|
|
4874
|
+
if (!t || !this._el) return;
|
|
4875
|
+
let n = t.offsetWidth || 170, r = t.offsetHeight || 120, i = this._el.getBoundingClientRect(), a = i.left, o = i.bottom + 6;
|
|
4876
|
+
a + n > globalThis.innerWidth - 8 && (a = globalThis.innerWidth - n - 8), o + r > globalThis.innerHeight - 8 && (o = i.top - r - 6), t.style.left = `${Math.max(8, a)}px`, t.style.top = `${Math.max(8, o)}px`;
|
|
4877
|
+
}));
|
|
4878
|
+
}
|
|
4879
|
+
_buildCellShadePopover() {
|
|
4880
|
+
let { el: e, titleEl: t, noColorBtn: n } = this._buildColorPopover({
|
|
4881
|
+
defaultColor: "#ffffff",
|
|
4882
|
+
apply: (e) => this._applyCellShade(e),
|
|
4883
|
+
getPopover: () => this._shadePopover,
|
|
4884
|
+
hide: () => this._hideCellShadePopover()
|
|
4885
|
+
});
|
|
4886
|
+
return this._shadeTitleEl = t, this._shadeNoBtn = n, e;
|
|
4780
4887
|
}
|
|
4781
4888
|
_openCellShadePopover() {
|
|
4782
4889
|
if (!this._shadePopover) return;
|
|
4783
4890
|
let e = this.context.locale.tooltips.table;
|
|
4784
|
-
this._shadeTitleEl && (this._shadeTitleEl.textContent = e.cellBackground), this._shadeNoBtn && (this._shadeNoBtn.textContent = e.noShading), this.
|
|
4785
|
-
if (!this._shadePopover || !this._el) return;
|
|
4786
|
-
let e = this._shadePopover.offsetWidth || 170, t = this._shadePopover.offsetHeight || 120, n = this._el.getBoundingClientRect(), r = n.left, i = n.bottom + 6;
|
|
4787
|
-
r + e > globalThis.innerWidth - 8 && (r = globalThis.innerWidth - e - 8), i + t > globalThis.innerHeight - 8 && (i = n.top - t - 6), this._shadePopover.style.left = `${Math.max(8, r)}px`, this._shadePopover.style.top = `${Math.max(8, i)}px`;
|
|
4788
|
-
});
|
|
4891
|
+
this._shadeTitleEl && (this._shadeTitleEl.textContent = e.cellBackground), this._shadeNoBtn && (this._shadeNoBtn.textContent = e.noShading), this._showColorPopover(() => this._shadePopover);
|
|
4789
4892
|
}
|
|
4790
4893
|
_hideCellShadePopover() {
|
|
4791
4894
|
this._shadePopover && (this._shadePopover.style.display = "none");
|
|
@@ -4796,43 +4899,18 @@ var q = {
|
|
|
4796
4899
|
}), this._shadeColorStrip && (this._shadeColorStrip.style.background = e || "transparent"), this._hideCellShadePopover(), this.context.invoke("editor.afterCommand");
|
|
4797
4900
|
}
|
|
4798
4901
|
_buildBorderColorPopover() {
|
|
4799
|
-
let e
|
|
4800
|
-
|
|
4801
|
-
|
|
4802
|
-
|
|
4803
|
-
|
|
4804
|
-
xr.forEach((e) => {
|
|
4805
|
-
let t = w("div", {
|
|
4806
|
-
class: "an-context-color-swatch",
|
|
4807
|
-
title: e
|
|
4808
|
-
});
|
|
4809
|
-
t.style.background = e, this._disposers.push(E(t, "click", (t) => {
|
|
4810
|
-
t.stopPropagation(), this._applyBorderColor(e);
|
|
4811
|
-
})), n.appendChild(t);
|
|
4812
|
-
}), e.appendChild(n);
|
|
4813
|
-
let r = w("div", { class: "an-context-color-custom" }), i = w("button", {
|
|
4814
|
-
type: "button",
|
|
4815
|
-
class: "an-shade-no-color"
|
|
4902
|
+
let { el: e, titleEl: t, noColorBtn: n } = this._buildColorPopover({
|
|
4903
|
+
defaultColor: "#000000",
|
|
4904
|
+
apply: (e) => this._applyBorderColor(e),
|
|
4905
|
+
getPopover: () => this._borderColorPopover,
|
|
4906
|
+
hide: () => this._hideBorderColorPopover()
|
|
4816
4907
|
});
|
|
4817
|
-
|
|
4818
|
-
let a = w("div", { class: "an-context-color-custom" }), o = w("input", {
|
|
4819
|
-
type: "color",
|
|
4820
|
-
class: "an-shade-color-input",
|
|
4821
|
-
value: "#000000"
|
|
4822
|
-
}), s = w("span");
|
|
4823
|
-
return s.textContent = this.context.locale.contextMenu.customColorLabel, this._disposers.push(E(o, "change", () => this._applyBorderColor(o.value))), a.appendChild(o), a.appendChild(s), e.appendChild(a), this._disposers.push(E(e, "mousedown", (e) => e.preventDefault()), E(e, "mouseenter", () => this._clearTimers()), E(e, "mouseleave", () => this._scheduleHide()), E(document, "click", (e) => {
|
|
4824
|
-
let t = e.target;
|
|
4825
|
-
this._borderColorPopover && this._borderColorPopover.style.display !== "none" && !this._borderColorPopover.contains(t) && !this._el?.contains(t) && this._hideBorderColorPopover();
|
|
4826
|
-
})), e;
|
|
4908
|
+
return this._borderColorTitleEl = t, this._borderColorNoBtn = n, e;
|
|
4827
4909
|
}
|
|
4828
4910
|
_openBorderColorPopover() {
|
|
4829
4911
|
if (!this._borderColorPopover) return;
|
|
4830
4912
|
let e = this.context.locale.tooltips.table;
|
|
4831
|
-
this._borderColorTitleEl && (this._borderColorTitleEl.textContent = e.tableBorderColor), this._borderColorNoBtn && (this._borderColorNoBtn.textContent = e.noBorderColor), this.
|
|
4832
|
-
if (!this._borderColorPopover || !this._el) return;
|
|
4833
|
-
let e = this._borderColorPopover.offsetWidth || 170, t = this._borderColorPopover.offsetHeight || 120, n = this._el.getBoundingClientRect(), r = n.left, i = n.bottom + 6;
|
|
4834
|
-
r + e > globalThis.innerWidth - 8 && (r = globalThis.innerWidth - e - 8), i + t > globalThis.innerHeight - 8 && (i = n.top - t - 6), this._borderColorPopover.style.left = `${Math.max(8, r)}px`, this._borderColorPopover.style.top = `${Math.max(8, i)}px`;
|
|
4835
|
-
});
|
|
4913
|
+
this._borderColorTitleEl && (this._borderColorTitleEl.textContent = e.tableBorderColor), this._borderColorNoBtn && (this._borderColorNoBtn.textContent = e.noBorderColor), this._showColorPopover(() => this._borderColorPopover);
|
|
4836
4914
|
}
|
|
4837
4915
|
_hideBorderColorPopover() {
|
|
4838
4916
|
this._borderColorPopover && (this._borderColorPopover.style.display = "none");
|
|
@@ -4881,11 +4959,11 @@ var q = {
|
|
|
4881
4959
|
if (!t) return;
|
|
4882
4960
|
let n = this._getCell();
|
|
4883
4961
|
if (!n) return;
|
|
4884
|
-
let r =
|
|
4962
|
+
let r = xr(n);
|
|
4885
4963
|
if (r === -1) return;
|
|
4886
4964
|
let i = t.querySelector("tbody") || t, a = Array.from(i.querySelectorAll(":scope > tr"));
|
|
4887
4965
|
a.length < 2 || (a.sort((t, n) => {
|
|
4888
|
-
let i =
|
|
4966
|
+
let i = G(t, r), a = G(n, r), o = (i?.textContent || "").trim(), s = (a?.textContent || "").trim(), c = parseFloat(o), l = parseFloat(s);
|
|
4889
4967
|
return !isNaN(c) && !isNaN(l) ? e === "asc" ? c - l : l - c : e === "asc" ? o.localeCompare(s) : s.localeCompare(o);
|
|
4890
4968
|
}), a.forEach((e) => i.appendChild(e)), this._markSortIndicator(t, r, e), this.context.invoke("editor.afterCommand"));
|
|
4891
4969
|
}
|
|
@@ -4897,7 +4975,7 @@ var q = {
|
|
|
4897
4975
|
});
|
|
4898
4976
|
let i = r.querySelector("tr");
|
|
4899
4977
|
if (!i) return;
|
|
4900
|
-
let a =
|
|
4978
|
+
let a = G(i, t);
|
|
4901
4979
|
a && a.classList.add(n === "asc" ? "an-sort-asc" : "an-sort-desc");
|
|
4902
4980
|
}
|
|
4903
4981
|
_exportTableCSV() {
|
|
@@ -4906,13 +4984,13 @@ var q = {
|
|
|
4906
4984
|
let t = Array.from(e.querySelectorAll("tr")).map((e) => Array.from(e.querySelectorAll("td, th")).map((e) => `"${(e.textContent || "").trim().replace(/"/g, "\"\"")}"`).join(",")).join("\n"), n = new Blob(["" + t], { type: "text/csv;charset=utf-8;" }), r = URL.createObjectURL(n), i = document.createElement("a");
|
|
4907
4985
|
i.href = r, i.download = "table.csv", i.style.display = "none", document.body.appendChild(i), i.click(), i.remove(), URL.revokeObjectURL(r);
|
|
4908
4986
|
}
|
|
4909
|
-
},
|
|
4987
|
+
}, Or = 100, kr = 180, Ar = /language-(\S+)/, K = {
|
|
4910
4988
|
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>",
|
|
4911
4989
|
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>",
|
|
4912
4990
|
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>",
|
|
4913
4991
|
deleteCode: "<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>",
|
|
4914
4992
|
lineNumbers: "<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=\"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 6h1v4\"/><path d=\"M4 10h2\"/><path d=\"M6 18H4c0-1 2-2 2-3s-1-2-2-2\"/></svg>"
|
|
4915
|
-
},
|
|
4993
|
+
}, jr = class {
|
|
4916
4994
|
constructor(e) {
|
|
4917
4995
|
this.context = e, this._el = null, this._activePre = null, this._showTimer = null, this._hideTimer = null, this._disposers = [], this._copyBtn = null, this._wrapBtn = null, this._lineNumbersBtn = null, this._langSelect = null, this._prismScript = null;
|
|
4918
4996
|
}
|
|
@@ -4969,7 +5047,7 @@ var q = {
|
|
|
4969
5047
|
].forEach(([e, t]) => {
|
|
4970
5048
|
let n = w("option", { value: e });
|
|
4971
5049
|
n.textContent = t, this._langSelect.appendChild(n);
|
|
4972
|
-
}), this._disposers.push(E(this._langSelect, "change", () => this._onLangChange())), t.appendChild(this._langSelect), t.appendChild(this._sep()), this._copyBtn = this._makeBtn(
|
|
5050
|
+
}), this._disposers.push(E(this._langSelect, "change", () => this._onLangChange())), t.appendChild(this._langSelect), t.appendChild(this._sep()), this._copyBtn = this._makeBtn(K.copy, e.copyCode, () => this._copyCode()), t.appendChild(this._copyBtn), t.appendChild(this._sep()), this._wrapBtn = this._makeBtn(K.wrapOn, e.toggleWordWrap, () => this._toggleWrap()), t.appendChild(this._wrapBtn), this._lineNumbersBtn = this._makeBtn(K.lineNumbers, e.lineNumbers, () => this._toggleLineNumbers()), t.appendChild(this._lineNumbersBtn), t.appendChild(this._sep()), t.appendChild(this._makeBtn(K.toParagraph, e.convertToParagraph, () => this._toParagraph())), t.appendChild(this._sep()), t.appendChild(this._makeBtn(K.deleteCode, e.deleteCodeBlock, () => this._delete(), !0)), this._disposers.push(E(t, "mouseenter", () => this._clearTimers()), E(t, "mouseleave", () => this._scheduleHide())), t;
|
|
4973
5051
|
}
|
|
4974
5052
|
_sep() {
|
|
4975
5053
|
return w("div", { class: "an-link-tooltip-sep" });
|
|
@@ -4987,10 +5065,10 @@ var q = {
|
|
|
4987
5065
|
_scheduleShow(e) {
|
|
4988
5066
|
this._activePre === e && this._el.style.display !== "none" || (clearTimeout(this._hideTimer), this._hideTimer = null, clearTimeout(this._showTimer), this._showTimer = setTimeout(() => {
|
|
4989
5067
|
this._activePre = e, this._syncWrapBtn(), this._syncLineNumbersBtn(), this._syncLangSelect(), this._show(e);
|
|
4990
|
-
},
|
|
5068
|
+
}, Or));
|
|
4991
5069
|
}
|
|
4992
5070
|
_scheduleHide() {
|
|
4993
|
-
clearTimeout(this._showTimer), this._showTimer = null, clearTimeout(this._hideTimer), this._hideTimer = setTimeout(() => this._hide(),
|
|
5071
|
+
clearTimeout(this._showTimer), this._showTimer = null, clearTimeout(this._hideTimer), this._hideTimer = setTimeout(() => this._hide(), kr);
|
|
4994
5072
|
}
|
|
4995
5073
|
_show(e) {
|
|
4996
5074
|
this._el.style.display = "flex", this._positionNear(e);
|
|
@@ -5017,7 +5095,7 @@ var q = {
|
|
|
5017
5095
|
}
|
|
5018
5096
|
_syncLangSelect() {
|
|
5019
5097
|
if (!this._activePre || !this._langSelect) return;
|
|
5020
|
-
let e = this._activePre.querySelector("code"), t = this._activePre.dataset.language || "", n = e && (
|
|
5098
|
+
let e = this._activePre.querySelector("code"), t = this._activePre.dataset.language || "", n = e && (Ar.exec(e.className) || [])[1] || "";
|
|
5021
5099
|
this._langSelect.value = t || n || "";
|
|
5022
5100
|
}
|
|
5023
5101
|
_copyCode() {
|
|
@@ -5123,21 +5201,21 @@ var q = {
|
|
|
5123
5201
|
let e = this._activePre;
|
|
5124
5202
|
e && (this._hide(), e.remove(), this.context.invoke("editor.afterCommand"));
|
|
5125
5203
|
}
|
|
5126
|
-
},
|
|
5127
|
-
function
|
|
5128
|
-
return
|
|
5204
|
+
}, Mr = null, Nr = null;
|
|
5205
|
+
function Pr() {
|
|
5206
|
+
return Mr ? Promise.resolve(Mr) : (Nr ??= import("./emoji-data-BDQX5kh-.js").then((e) => (Mr = {
|
|
5129
5207
|
EMOJI_CATS: e.EMOJI_CATS,
|
|
5130
5208
|
EMOJI_LIST: e.EMOJI_LIST
|
|
5131
|
-
},
|
|
5209
|
+
}, Mr)), Nr);
|
|
5132
5210
|
}
|
|
5133
|
-
var
|
|
5211
|
+
var Fr = class extends V {
|
|
5134
5212
|
_activeCat = "all";
|
|
5135
5213
|
initialize() {
|
|
5136
5214
|
return this;
|
|
5137
5215
|
}
|
|
5138
5216
|
async show() {
|
|
5139
5217
|
if (this._saveRange(), !this._dialog) {
|
|
5140
|
-
let { EMOJI_CATS: e, EMOJI_LIST: t } = await
|
|
5218
|
+
let { EMOJI_CATS: e, EMOJI_LIST: t } = await Pr();
|
|
5141
5219
|
this._dialog || (this._cats = e, this._list = t, this._dialog = this._buildDialog(), document.body.appendChild(this._dialog));
|
|
5142
5220
|
}
|
|
5143
5221
|
this._activeCat = "all", this._searchInput.value = "", this._updateCatTabs(), this._filterEmojis("", "all"), this._open();
|
|
@@ -5194,7 +5272,7 @@ var jr = class extends U {
|
|
|
5194
5272
|
type: "button",
|
|
5195
5273
|
class: "an-btn"
|
|
5196
5274
|
});
|
|
5197
|
-
p.textContent = e.cancelBtn, f.appendChild(p), n.append(r, c, l, d, f), t.appendChild(n),
|
|
5275
|
+
p.textContent = e.cancelBtn, f.appendChild(p), n.append(r, c, l, d, f), t.appendChild(n), he(r, n);
|
|
5198
5276
|
let m = E(s, "click", () => this._close()), h = E(p, "click", () => this._close()), g = E(t, "click", (e) => {
|
|
5199
5277
|
e.target === t && this._close();
|
|
5200
5278
|
}), _ = E(c, "input", () => this._filterEmojis(c.value, this._activeCat)), v = E(l, "click", (e) => {
|
|
@@ -5230,7 +5308,7 @@ var jr = class extends U {
|
|
|
5230
5308
|
let s = document.createTextNode(e);
|
|
5231
5309
|
i.insertNode(s), i.setStartAfter(s), i.collapse(!0), r && (r.removeAllRanges(), r.addRange(i)), this._close(), n.focus(), this.context.invoke("editor.afterCommand");
|
|
5232
5310
|
}
|
|
5233
|
-
},
|
|
5311
|
+
}, Ir = [
|
|
5234
5312
|
{
|
|
5235
5313
|
id: "popular",
|
|
5236
5314
|
label: "Popular"
|
|
@@ -5263,7 +5341,7 @@ var jr = class extends U {
|
|
|
5263
5341
|
id: "objects",
|
|
5264
5342
|
label: "Objects"
|
|
5265
5343
|
}
|
|
5266
|
-
],
|
|
5344
|
+
], Lr = [
|
|
5267
5345
|
["house", "popular"],
|
|
5268
5346
|
["star", "popular"],
|
|
5269
5347
|
["heart", "popular"],
|
|
@@ -5479,7 +5557,7 @@ var jr = class extends U {
|
|
|
5479
5557
|
["trophy", "objects"],
|
|
5480
5558
|
["gift", "objects"],
|
|
5481
5559
|
["puzzle-piece", "objects"]
|
|
5482
|
-
],
|
|
5560
|
+
], Rr = class extends V {
|
|
5483
5561
|
_selectedIcon = null;
|
|
5484
5562
|
_activeCat = "all";
|
|
5485
5563
|
initialize() {
|
|
@@ -5523,7 +5601,7 @@ var jr = class extends U {
|
|
|
5523
5601
|
class: "an-icon-cat active",
|
|
5524
5602
|
"data-cat": "all"
|
|
5525
5603
|
});
|
|
5526
|
-
u.textContent = e.all, l.appendChild(u),
|
|
5604
|
+
u.textContent = e.all, l.appendChild(u), Ir.forEach(({ id: t, label: n }) => {
|
|
5527
5605
|
let r = w("button", {
|
|
5528
5606
|
type: "button",
|
|
5529
5607
|
class: "an-icon-cat",
|
|
@@ -5532,7 +5610,7 @@ var jr = class extends U {
|
|
|
5532
5610
|
r.textContent = e.categories?.[t] || n, l.appendChild(r);
|
|
5533
5611
|
}), this._catBar = l;
|
|
5534
5612
|
let d = w("div", { class: "an-icon-grid" });
|
|
5535
|
-
|
|
5613
|
+
Lr.forEach(([e, t]) => {
|
|
5536
5614
|
let n = w("button", {
|
|
5537
5615
|
type: "button",
|
|
5538
5616
|
class: "an-icon-cell",
|
|
@@ -5596,7 +5674,7 @@ var jr = class extends U {
|
|
|
5596
5674
|
type: "button",
|
|
5597
5675
|
class: "an-btn"
|
|
5598
5676
|
});
|
|
5599
|
-
C.textContent = e.cancelBtn, te.append(S, C), this._insertBtn = S, n.append(r, c, l, d, f, x, te), t.appendChild(n),
|
|
5677
|
+
C.textContent = e.cancelBtn, te.append(S, C), this._insertBtn = S, n.append(r, c, l, d, f, x, te), t.appendChild(n), he(r, n);
|
|
5600
5678
|
let ne = E(s, "click", () => this._close()), re = E(C, "click", () => this._close()), ie = E(S, "click", () => this._onInsert()), ae = E(t, "click", (e) => {
|
|
5601
5679
|
e.target === t && this._close();
|
|
5602
5680
|
}), T = E(c, "input", () => this._filterIcons(c.value, this._activeCat)), oe = E(l, "click", (e) => {
|
|
@@ -5654,7 +5732,7 @@ var jr = class extends U {
|
|
|
5654
5732
|
_close() {
|
|
5655
5733
|
this._selectedIcon = null, super._close();
|
|
5656
5734
|
}
|
|
5657
|
-
},
|
|
5735
|
+
}, q = {
|
|
5658
5736
|
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>",
|
|
5659
5737
|
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>",
|
|
5660
5738
|
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>",
|
|
@@ -5681,7 +5759,7 @@ var jr = class extends U {
|
|
|
5681
5759
|
highlightColor: "<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 21v-4l9-9 4 4-9 9z\"/><path d=\"M12 8l4 4\"/><line x1=\"3\" y1=\"21\" x2=\"21\" y2=\"21\"/></svg>",
|
|
5682
5760
|
noColor: "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"11\" height=\"11\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2.5\" stroke-linecap=\"round\"><line x1=\"4\" y1=\"4\" x2=\"20\" y2=\"20\"/><line x1=\"20\" y1=\"4\" x2=\"4\" y2=\"20\"/></svg>",
|
|
5683
5761
|
back: "<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\"><polyline points=\"15 18 9 12 15 6\"/></svg>"
|
|
5684
|
-
},
|
|
5762
|
+
}, zr = [
|
|
5685
5763
|
"#000000",
|
|
5686
5764
|
"#434343",
|
|
5687
5765
|
"#666666",
|
|
@@ -5707,35 +5785,35 @@ var jr = class extends U {
|
|
|
5707
5785
|
"#d9d2e9",
|
|
5708
5786
|
"#ead1dc"
|
|
5709
5787
|
];
|
|
5710
|
-
function
|
|
5788
|
+
function Br(e) {
|
|
5711
5789
|
let t = e === "foreColor" ? "Text Color" : "Highlight Color", n = e === "foreColor" ? "textColor" : "highlightColor";
|
|
5712
5790
|
return () => [{
|
|
5713
5791
|
back: !0,
|
|
5714
5792
|
label: t,
|
|
5715
5793
|
localeKey: n,
|
|
5716
|
-
navigate: () =>
|
|
5794
|
+
navigate: () => Vr
|
|
5717
5795
|
}, {
|
|
5718
5796
|
colorPalette: !0,
|
|
5719
5797
|
colorType: e
|
|
5720
5798
|
}];
|
|
5721
5799
|
}
|
|
5722
|
-
var
|
|
5800
|
+
var Vr = [
|
|
5723
5801
|
{
|
|
5724
5802
|
name: "cut",
|
|
5725
5803
|
label: "Cut",
|
|
5726
|
-
icon:
|
|
5804
|
+
icon: q.cut,
|
|
5727
5805
|
action: () => document.execCommand("cut")
|
|
5728
5806
|
},
|
|
5729
5807
|
{
|
|
5730
5808
|
name: "copy",
|
|
5731
5809
|
label: "Copy",
|
|
5732
|
-
icon:
|
|
5810
|
+
icon: q.copy,
|
|
5733
5811
|
action: () => document.execCommand("copy")
|
|
5734
5812
|
},
|
|
5735
5813
|
{
|
|
5736
5814
|
name: "paste",
|
|
5737
5815
|
label: "Paste",
|
|
5738
|
-
icon:
|
|
5816
|
+
icon: q.paste,
|
|
5739
5817
|
action: (e) => {
|
|
5740
5818
|
if (!navigator.clipboard) return;
|
|
5741
5819
|
let t = e.layoutInfo?.editable;
|
|
@@ -5762,84 +5840,84 @@ var Lr = [
|
|
|
5762
5840
|
{
|
|
5763
5841
|
name: "bold",
|
|
5764
5842
|
label: "Bold",
|
|
5765
|
-
icon:
|
|
5843
|
+
icon: q.bold,
|
|
5766
5844
|
action: (e) => e.invoke("editor.bold")
|
|
5767
5845
|
},
|
|
5768
5846
|
{
|
|
5769
5847
|
name: "italic",
|
|
5770
5848
|
label: "Italic",
|
|
5771
|
-
icon:
|
|
5849
|
+
icon: q.italic,
|
|
5772
5850
|
action: (e) => e.invoke("editor.italic")
|
|
5773
5851
|
},
|
|
5774
5852
|
{
|
|
5775
5853
|
name: "underline",
|
|
5776
5854
|
label: "Underline",
|
|
5777
|
-
icon:
|
|
5855
|
+
icon: q.underline,
|
|
5778
5856
|
action: (e) => e.invoke("editor.underline")
|
|
5779
5857
|
},
|
|
5780
5858
|
{ separator: !0 },
|
|
5781
5859
|
{
|
|
5782
5860
|
name: "textColor",
|
|
5783
5861
|
label: "Text Color",
|
|
5784
|
-
icon:
|
|
5862
|
+
icon: q.textColor,
|
|
5785
5863
|
colorStrip: "foreColor",
|
|
5786
|
-
navigate:
|
|
5864
|
+
navigate: Br("foreColor")
|
|
5787
5865
|
},
|
|
5788
5866
|
{
|
|
5789
5867
|
name: "highlightColor",
|
|
5790
5868
|
label: "Highlight Color",
|
|
5791
|
-
icon:
|
|
5869
|
+
icon: q.highlightColor,
|
|
5792
5870
|
colorStrip: "hiliteColor",
|
|
5793
|
-
navigate:
|
|
5871
|
+
navigate: Br("hiliteColor")
|
|
5794
5872
|
},
|
|
5795
5873
|
{ separator: !0 },
|
|
5796
5874
|
{
|
|
5797
5875
|
name: "copyFormat",
|
|
5798
5876
|
label: "Copy Format",
|
|
5799
|
-
icon:
|
|
5877
|
+
icon: q.copyFormat,
|
|
5800
5878
|
action: (e) => e.invoke("contextMenu.copyFormat")
|
|
5801
5879
|
},
|
|
5802
5880
|
{
|
|
5803
5881
|
name: "pasteFormat",
|
|
5804
5882
|
label: "Paste Format",
|
|
5805
|
-
icon:
|
|
5883
|
+
icon: q.pasteFormat,
|
|
5806
5884
|
action: (e) => e.invoke("contextMenu.pasteFormat"),
|
|
5807
5885
|
disabled: (e) => !e.invoke("contextMenu.hasCopiedFormat")
|
|
5808
5886
|
},
|
|
5809
5887
|
{
|
|
5810
5888
|
name: "removeFormat",
|
|
5811
5889
|
label: "Remove Format",
|
|
5812
|
-
icon:
|
|
5890
|
+
icon: q.removeFormat,
|
|
5813
5891
|
action: (e) => e.invoke("contextMenu.removeFormat")
|
|
5814
5892
|
},
|
|
5815
5893
|
{ separator: !0 },
|
|
5816
5894
|
{
|
|
5817
5895
|
name: "link",
|
|
5818
5896
|
label: "Insert Link",
|
|
5819
|
-
icon:
|
|
5897
|
+
icon: q.link,
|
|
5820
5898
|
action: (e) => e.invoke("linkDialog.show")
|
|
5821
5899
|
},
|
|
5822
5900
|
{
|
|
5823
5901
|
name: "image",
|
|
5824
5902
|
label: "Insert Image",
|
|
5825
|
-
icon:
|
|
5903
|
+
icon: q.image,
|
|
5826
5904
|
action: (e) => e.invoke("imageDialog.show")
|
|
5827
5905
|
},
|
|
5828
5906
|
{
|
|
5829
5907
|
name: "video",
|
|
5830
5908
|
label: "Insert Video",
|
|
5831
|
-
icon:
|
|
5909
|
+
icon: q.video,
|
|
5832
5910
|
action: (e) => e.invoke("videoDialog.show")
|
|
5833
5911
|
},
|
|
5834
5912
|
{
|
|
5835
5913
|
name: "table",
|
|
5836
5914
|
label: "Insert Table",
|
|
5837
|
-
icon:
|
|
5915
|
+
icon: q.table,
|
|
5838
5916
|
tableGrid: !0
|
|
5839
5917
|
}
|
|
5840
|
-
],
|
|
5918
|
+
], Hr = class {
|
|
5841
5919
|
constructor(e) {
|
|
5842
|
-
this.context = e, this.options = e.options || {}, this._items = this.options.contextMenu?.items ||
|
|
5920
|
+
this.context = e, this.options = e.options || {}, this._items = this.options.contextMenu?.items || Vr, this.el = null, this._disposers = [], this._menuDisposers = [], this._lastX = 0, this._lastY = 0, this._copiedFormat = null, this._savedRange = null;
|
|
5843
5921
|
}
|
|
5844
5922
|
initialize() {
|
|
5845
5923
|
this.el = w("div", {
|
|
@@ -5877,7 +5955,7 @@ var Lr = [
|
|
|
5877
5955
|
class: "an-context-icon",
|
|
5878
5956
|
"aria-hidden": "true"
|
|
5879
5957
|
});
|
|
5880
|
-
n.innerHTML =
|
|
5958
|
+
n.innerHTML = q.back, t.appendChild(n);
|
|
5881
5959
|
let r = e.localeKey && this.context.locale.contextMenu[e.localeKey] || e.label || this.context.locale.contextMenu.back || "Back";
|
|
5882
5960
|
t.appendChild(w("span", { class: "an-context-label" }, [r]));
|
|
5883
5961
|
let i = E(t, "click", (t) => {
|
|
@@ -5925,7 +6003,7 @@ var Lr = [
|
|
|
5925
6003
|
}
|
|
5926
6004
|
if (e.colorPalette) {
|
|
5927
6005
|
let t = w("div", { class: "an-context-color-palette" });
|
|
5928
|
-
if (
|
|
6006
|
+
if (zr.forEach((n) => {
|
|
5929
6007
|
let r = w("div", {
|
|
5930
6008
|
class: "an-context-color-swatch",
|
|
5931
6009
|
title: n,
|
|
@@ -5944,7 +6022,7 @@ var Lr = [
|
|
|
5944
6022
|
role: "button",
|
|
5945
6023
|
"aria-label": this.context.locale.contextMenu.noHighlight || "No highlight"
|
|
5946
6024
|
});
|
|
5947
|
-
e.innerHTML =
|
|
6025
|
+
e.innerHTML = q.noColor;
|
|
5948
6026
|
let n = E(e, "click", (e) => {
|
|
5949
6027
|
e.stopPropagation(), this._applyColor("hiliteColor", "transparent");
|
|
5950
6028
|
});
|
|
@@ -6155,7 +6233,7 @@ var Lr = [
|
|
|
6155
6233
|
} catch {}
|
|
6156
6234
|
this.context.invoke("editor.afterCommand");
|
|
6157
6235
|
}
|
|
6158
|
-
},
|
|
6236
|
+
}, Ur = [
|
|
6159
6237
|
{
|
|
6160
6238
|
category: "Text Formatting",
|
|
6161
6239
|
items: [
|
|
@@ -6228,12 +6306,12 @@ var Lr = [
|
|
|
6228
6306
|
action: "Show this keyboard shortcuts dialog"
|
|
6229
6307
|
}]
|
|
6230
6308
|
}
|
|
6231
|
-
],
|
|
6309
|
+
], Wr = "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"18\" height=\"18\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><rect x=\"2\" y=\"7\" width=\"20\" height=\"14\" rx=\"2\"/><path d=\"M6 11h.01M10 11h.01M14 11h.01M18 11h.01M6 15h.01M18 15h.01M10 15h4\"/><path d=\"M7 3l5 4 5-4\"/></svg>", Gr = class extends V {
|
|
6232
6310
|
show() {
|
|
6233
6311
|
this._open();
|
|
6234
6312
|
}
|
|
6235
6313
|
_buildDialog() {
|
|
6236
|
-
let e = this.context.locale.shortcutsDialog, { overlay: t, box: n } = this._buildDialogShell(e.ariaLabel,
|
|
6314
|
+
let e = this.context.locale.shortcutsDialog, { overlay: t, box: n } = this._buildDialogShell(e.ariaLabel, Wr, e.title);
|
|
6237
6315
|
n.classList.add("an-shortcuts-box");
|
|
6238
6316
|
let r = w("button", {
|
|
6239
6317
|
type: "button",
|
|
@@ -6241,7 +6319,7 @@ var Lr = [
|
|
|
6241
6319
|
"aria-label": e.close,
|
|
6242
6320
|
style: "margin-left:auto"
|
|
6243
6321
|
});
|
|
6244
|
-
r.textContent = "×", this._closeBtn = r, this._firstInput = r, n.querySelector(".an-dialog-header").appendChild(r), (this.context.locale.shortcutsDialog.shortcuts ||
|
|
6322
|
+
r.textContent = "×", this._closeBtn = r, this._firstInput = r, n.querySelector(".an-dialog-header").appendChild(r), (this.context.locale.shortcutsDialog.shortcuts || Ur).forEach(({ category: e, items: t }) => {
|
|
6245
6323
|
let r = w("div", { class: "an-shortcuts-cat" });
|
|
6246
6324
|
r.textContent = e, n.appendChild(r);
|
|
6247
6325
|
let i = w("div", { class: "an-shortcuts-table" });
|
|
@@ -6255,7 +6333,7 @@ var Lr = [
|
|
|
6255
6333
|
let i = E(r, "click", () => this._close());
|
|
6256
6334
|
return this._disposers.push(i), t;
|
|
6257
6335
|
}
|
|
6258
|
-
},
|
|
6336
|
+
}, Kr = class extends V {
|
|
6259
6337
|
constructor(e) {
|
|
6260
6338
|
super(e), this._findInput = null, this._replaceInput = null, this._caseCheckbox = null, this._counterEl = null, this._closeBtn = null, this._matches = [], this._currentIndex = -1, this._caseSensitive = !1, this._useRegex = !1, this._wholeWord = !1, this._mode = "find", this._queryRegex = null, this._lastQuery = null, this._lastCaseSensitive = null, this._lastUseRegex = null, this._lastWholeWord = null, this._focusTimer = null;
|
|
6261
6339
|
}
|
|
@@ -6371,7 +6449,7 @@ var Lr = [
|
|
|
6371
6449
|
});
|
|
6372
6450
|
b.textContent = e.replaceAllBtn, _.append(v, y, b), n.appendChild(_);
|
|
6373
6451
|
let x = w("div", { class: "an-fr-replace-actions" });
|
|
6374
|
-
x.style.display = "none", n.appendChild(x), t.appendChild(n),
|
|
6452
|
+
x.style.display = "none", n.appendChild(x), t.appendChild(n), he(r, n);
|
|
6375
6453
|
let ee = E(s, "click", () => this._close()), te = E(t, "click", (e) => {
|
|
6376
6454
|
e.target === t && this._close();
|
|
6377
6455
|
}), S = E(l, "input", () => this._onSearch()), C = E(d, "click", () => {
|
|
@@ -6498,8 +6576,8 @@ var Lr = [
|
|
|
6498
6576
|
this._counterEl.textContent = e ? this.context.locale.findReplace.noResults : "";
|
|
6499
6577
|
} else this._counterEl.textContent = `${this._currentIndex + 1} / ${e}`;
|
|
6500
6578
|
}
|
|
6501
|
-
},
|
|
6502
|
-
function
|
|
6579
|
+
}, J = 20, qr = "#3b82f6", Y = (e, t, n) => Math.min(Math.max(e, t), n);
|
|
6580
|
+
function Jr(e, t, n, r) {
|
|
6503
6581
|
return new Promise((i) => {
|
|
6504
6582
|
let a = (e) => {
|
|
6505
6583
|
let a = document.createElement("canvas");
|
|
@@ -6523,7 +6601,7 @@ function Wr(e, t, n, r) {
|
|
|
6523
6601
|
o.crossOrigin = "anonymous", o.onload = () => a(o), o.onerror = () => i(null), o.src = e.src + (e.src.includes("?") ? "&" : "?") + "_an=" + Date.now();
|
|
6524
6602
|
});
|
|
6525
6603
|
}
|
|
6526
|
-
var
|
|
6604
|
+
var Yr = class {
|
|
6527
6605
|
constructor(e) {
|
|
6528
6606
|
this.context = e, this._img = null, this._box = null, this._imgRect = null, this._scrim = null, this._cropBox = null, this._handles = {}, this._toolbar = null, this._infoEl = null, this._dragDisposers = null, this._disposers = [];
|
|
6529
6607
|
}
|
|
@@ -6554,7 +6632,7 @@ var Gr = class {
|
|
|
6554
6632
|
t.className = "an-crop-box", t.style.cssText = `
|
|
6555
6633
|
position:fixed; z-index:10101;
|
|
6556
6634
|
box-sizing:border-box;
|
|
6557
|
-
border:2px solid ${
|
|
6635
|
+
border:2px solid ${qr};
|
|
6558
6636
|
cursor:move;
|
|
6559
6637
|
outline: none;
|
|
6560
6638
|
`;
|
|
@@ -6619,7 +6697,7 @@ var Gr = class {
|
|
|
6619
6697
|
"position:absolute",
|
|
6620
6698
|
"width:10px",
|
|
6621
6699
|
"height:10px",
|
|
6622
|
-
`background:${
|
|
6700
|
+
`background:${qr}`,
|
|
6623
6701
|
"border:2px solid #fff",
|
|
6624
6702
|
"border-radius:2px",
|
|
6625
6703
|
"box-sizing:border-box",
|
|
@@ -6653,7 +6731,7 @@ var Gr = class {
|
|
|
6653
6731
|
let a = this._makeToolbarBtn("✓ Crop", "#22c55e", () => this._confirm()), o = this._makeToolbarBtn("✕ Cancel", "#94a3b8", () => this._close(!1)), s = document.createElement("label");
|
|
6654
6732
|
s.style.cssText = "color:#94a3b8;font-size:11px;cursor:pointer;display:flex;align-items:center;gap:4px;";
|
|
6655
6733
|
let c = document.createElement("input");
|
|
6656
|
-
c.type = "checkbox", c.style.accentColor =
|
|
6734
|
+
c.type = "checkbox", c.style.accentColor = qr, s.appendChild(c), s.appendChild(document.createTextNode("Lock ratio")), this._arCheck = c, i.appendChild(a), i.appendChild(o), i.appendChild(s), this._toolbar = i, this._disposers.push(E(i, "mousedown", (e) => e.stopPropagation())), document.body.appendChild(e), document.body.appendChild(t), document.body.appendChild(i), this._scrim = e, this._cropBox = t;
|
|
6657
6735
|
}
|
|
6658
6736
|
_makeToolbarBtn(e, t, n) {
|
|
6659
6737
|
let r = document.createElement("button");
|
|
@@ -6683,7 +6761,7 @@ var Gr = class {
|
|
|
6683
6761
|
let i = this._img.naturalWidth || 0, a = this._img.naturalHeight || 0, o = this._imgRect.width || 1, s = this._imgRect.height || 1, c = {
|
|
6684
6762
|
x: i / o,
|
|
6685
6763
|
y: a / s
|
|
6686
|
-
}, l =
|
|
6764
|
+
}, l = Y(e - this._imgRect.left, 0, o), u = Y(t - this._imgRect.top, 0, s), d = Y(n, 0, o - l), f = Y(r, 0, s - u);
|
|
6687
6765
|
this._infoEl.textContent = `${Math.round(d * c.x)} × ${Math.round(f * c.y)} px`;
|
|
6688
6766
|
}
|
|
6689
6767
|
let o = t + r + 8;
|
|
@@ -6692,14 +6770,14 @@ var Gr = class {
|
|
|
6692
6770
|
_startBoxMove(e) {
|
|
6693
6771
|
let t = e.clientX - this._box.x, n = e.clientY - this._box.y, r = this._imgRect;
|
|
6694
6772
|
this._attachDocDrag((e) => {
|
|
6695
|
-
this._box.x =
|
|
6773
|
+
this._box.x = Y(e.clientX - t, r.left, r.right - this._box.w), this._box.y = Y(e.clientY - n, r.top, r.bottom - this._box.h), this._updateDOM();
|
|
6696
6774
|
});
|
|
6697
6775
|
}
|
|
6698
6776
|
_startHandleDrag(e, t) {
|
|
6699
6777
|
let n = e.clientX, r = e.clientY, i = { ...this._box }, a = this._imgRect, o = this._arCheck?.checked, s = i.w / (i.h || 1);
|
|
6700
6778
|
this._attachDocDrag((e) => {
|
|
6701
6779
|
let c = e.clientX - n, l = e.clientY - r, { x: u, y: d, w: f, h: p } = i;
|
|
6702
|
-
t.includes("e") && (f = Math.max(
|
|
6780
|
+
t.includes("e") && (f = Math.max(J, i.w + c)), t.includes("s") && (p = Math.max(J, i.h + l)), t.includes("w") && (u = Math.min(i.x + i.w - J, i.x + c), f = i.x + i.w - u), t.includes("n") && (d = Math.min(i.y + i.h - J, i.y + l), p = i.y + i.h - d), o && t.length === 2 && (Math.abs(c) >= Math.abs(l) ? (p = f / s, t.includes("n") && (d = i.y + i.h - p)) : (f = p * s, t.includes("w") && (u = i.x + i.w - f))), u = Y(u, a.left, a.right - J), d = Y(d, a.top, a.bottom - J), f = Y(f, J, a.right - u), p = Y(p, J, a.bottom - d), this._box = {
|
|
6703
6781
|
x: u,
|
|
6704
6782
|
y: d,
|
|
6705
6783
|
w: f,
|
|
@@ -6733,12 +6811,12 @@ var Gr = class {
|
|
|
6733
6811
|
this._close(!1);
|
|
6734
6812
|
return;
|
|
6735
6813
|
}
|
|
6736
|
-
let t = this._imgRect, { x: n, y: r, w: i, h: a } = this._box, o = (e.naturalWidth || e.width || 1) / (t.width || 1), s = (e.naturalHeight || e.height || 1) / (t.height || 1), c = Math.round(
|
|
6814
|
+
let t = this._imgRect, { x: n, y: r, w: i, h: a } = this._box, o = (e.naturalWidth || e.width || 1) / (t.width || 1), s = (e.naturalHeight || e.height || 1) / (t.height || 1), c = Math.round(Y(n - t.left, 0, t.width) * o), l = Math.round(Y(r - t.top, 0, t.height) * s), u = Math.round(Y(i, 0, t.width - (n - t.left)) * o), d = Math.round(Y(a, 0, t.height - (r - t.top)) * s);
|
|
6737
6815
|
if (u <= 0 || d <= 0) {
|
|
6738
6816
|
this._close(!1);
|
|
6739
6817
|
return;
|
|
6740
6818
|
}
|
|
6741
|
-
let f = await
|
|
6819
|
+
let f = await Jr(e, {
|
|
6742
6820
|
x: c,
|
|
6743
6821
|
y: l,
|
|
6744
6822
|
width: u,
|
|
@@ -6782,7 +6860,7 @@ var Gr = class {
|
|
|
6782
6860
|
e?.remove();
|
|
6783
6861
|
}), this._scrim = null, this._cropBox = null, this._toolbar = null, this._infoEl = null, this._handles = {}, this._img = null, this._box = null, this._imgRect = null, this._arCheck = null;
|
|
6784
6862
|
}
|
|
6785
|
-
},
|
|
6863
|
+
}, Xr = class {
|
|
6786
6864
|
constructor(e) {
|
|
6787
6865
|
this.context = e, this.options = e.options, this._banner = null;
|
|
6788
6866
|
}
|
|
@@ -6835,7 +6913,7 @@ var Gr = class {
|
|
|
6835
6913
|
_removeBanner() {
|
|
6836
6914
|
this._banner?.remove(), this._banner = null;
|
|
6837
6915
|
}
|
|
6838
|
-
},
|
|
6916
|
+
}, Zr = class {
|
|
6839
6917
|
constructor(e) {
|
|
6840
6918
|
this.context = e, this.options = e.options, this._disposers = [];
|
|
6841
6919
|
}
|
|
@@ -6970,7 +7048,7 @@ var Gr = class {
|
|
|
6970
7048
|
break;
|
|
6971
7049
|
}
|
|
6972
7050
|
}
|
|
6973
|
-
},
|
|
7051
|
+
}, Qr = [
|
|
6974
7052
|
"#000000",
|
|
6975
7053
|
"#434343",
|
|
6976
7054
|
"#666666",
|
|
@@ -6995,17 +7073,17 @@ var Gr = class {
|
|
|
6995
7073
|
"#c9daf8",
|
|
6996
7074
|
"#d9d2e9",
|
|
6997
7075
|
"#ead1dc"
|
|
6998
|
-
],
|
|
6999
|
-
bold:
|
|
7000
|
-
italic:
|
|
7001
|
-
underline:
|
|
7002
|
-
strikethrough:
|
|
7003
|
-
link:
|
|
7004
|
-
foreColor:
|
|
7005
|
-
hiliteColor:
|
|
7006
|
-
removeFormat:
|
|
7007
|
-
inlineCode:
|
|
7008
|
-
},
|
|
7076
|
+
], $r = "stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"", X = (e) => `<svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" ${$r} style="display:block">${e}</svg>`, ei = {
|
|
7077
|
+
bold: X("<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\"/>"),
|
|
7078
|
+
italic: X("<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\"/>"),
|
|
7079
|
+
underline: X("<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\"/>"),
|
|
7080
|
+
strikethrough: X("<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\"/>"),
|
|
7081
|
+
link: X("<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\"/>"),
|
|
7082
|
+
foreColor: X("<path d=\"M4 20L12 4L20 20\"/><line x1=\"7.5\" y1=\"14\" x2=\"16.5\" y2=\"14\"/>"),
|
|
7083
|
+
hiliteColor: X("<path d=\"M3 21v-4l9-9 4 4-9 9z\"/><path d=\"M12 8l4 4\"/><line x1=\"3\" y1=\"21\" x2=\"21\" y2=\"21\"/>"),
|
|
7084
|
+
removeFormat: X("<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\"/>"),
|
|
7085
|
+
inlineCode: X("<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\"/>")
|
|
7086
|
+
}, ti = {
|
|
7009
7087
|
bold: (e) => e.invoke("editor.bold"),
|
|
7010
7088
|
italic: (e) => e.invoke("editor.italic"),
|
|
7011
7089
|
underline: (e) => e.invoke("editor.underline"),
|
|
@@ -7026,15 +7104,15 @@ var Gr = class {
|
|
|
7026
7104
|
e.invoke("editor.afterCommand");
|
|
7027
7105
|
},
|
|
7028
7106
|
inlineCode: (e) => e.invoke("editor.inlineCode")
|
|
7029
|
-
},
|
|
7107
|
+
}, ni = {
|
|
7030
7108
|
bold: () => document.queryCommandState("bold"),
|
|
7031
7109
|
italic: () => document.queryCommandState("italic"),
|
|
7032
7110
|
underline: () => document.queryCommandState("underline"),
|
|
7033
7111
|
strikethrough: () => document.queryCommandState("strikeThrough")
|
|
7034
|
-
},
|
|
7112
|
+
}, ri = {
|
|
7035
7113
|
foreColor: !0,
|
|
7036
7114
|
hiliteColor: !0
|
|
7037
|
-
},
|
|
7115
|
+
}, ii = class {
|
|
7038
7116
|
constructor(e) {
|
|
7039
7117
|
this.context = e, this.options = e.options, this._el = null, this._picker = null, this._pickerType = null, this._savedRange = null, this._visible = !1, this._rafId = null, this._contextMenuOpen = !1, this._disposers = [], this._onSelectionChange = this._onSelectionChange.bind(this), this._onMousedown = this._onMousedown.bind(this), this._onKeydown = this._onKeydown.bind(this), this._onContextMenu = this._onContextMenu.bind(this);
|
|
7040
7118
|
}
|
|
@@ -7064,23 +7142,23 @@ var Gr = class {
|
|
|
7064
7142
|
"removeFormat"
|
|
7065
7143
|
];
|
|
7066
7144
|
for (let n of t) {
|
|
7067
|
-
if (!
|
|
7145
|
+
if (!ei[n]) continue;
|
|
7068
7146
|
let t = document.createElement("button");
|
|
7069
|
-
if (t.type = "button", t.dataset.name = n, t.setAttribute("aria-label", n),
|
|
7147
|
+
if (t.type = "button", t.dataset.name = n, t.setAttribute("aria-label", n), ri[n]) {
|
|
7070
7148
|
t.className = "an-bubble-btn an-bubble-btn--color";
|
|
7071
7149
|
let e = document.createElement("span");
|
|
7072
|
-
e.className = "an-bubble-btn-svg", e.innerHTML =
|
|
7150
|
+
e.className = "an-bubble-btn-svg", e.innerHTML = ei[n];
|
|
7073
7151
|
let r = document.createElement("span");
|
|
7074
7152
|
r.className = "an-bubble-color-strip", r.style.background = n === "foreColor" ? "#000000" : "transparent", t.appendChild(e), t.appendChild(r);
|
|
7075
|
-
} else t.className = "an-bubble-btn", t.innerHTML =
|
|
7153
|
+
} else t.className = "an-bubble-btn", t.innerHTML = ei[n];
|
|
7076
7154
|
t.addEventListener("mousedown", (e) => {
|
|
7077
7155
|
e.preventDefault();
|
|
7078
7156
|
}), t.addEventListener("click", (e) => {
|
|
7079
|
-
if (e.preventDefault(), e.stopPropagation(),
|
|
7157
|
+
if (e.preventDefault(), e.stopPropagation(), ri[n]) {
|
|
7080
7158
|
this._openColorPicker(n, t);
|
|
7081
7159
|
return;
|
|
7082
7160
|
}
|
|
7083
|
-
this.context.invoke("editor.focus"),
|
|
7161
|
+
this.context.invoke("editor.focus"), ti[n] && ti[n](this.context), this._syncActive();
|
|
7084
7162
|
}), e.appendChild(t);
|
|
7085
7163
|
}
|
|
7086
7164
|
document.body.appendChild(e), this._el = e, this._btnCache = Array.from(e.querySelectorAll(".an-bubble-btn"));
|
|
@@ -7089,7 +7167,7 @@ var Gr = class {
|
|
|
7089
7167
|
let e = document.createElement("div");
|
|
7090
7168
|
e.className = "an-bubble-color-picker", e.style.display = "none", e.addEventListener("mousedown", (e) => e.preventDefault());
|
|
7091
7169
|
let t = document.createElement("div");
|
|
7092
|
-
t.className = "an-context-color-palette",
|
|
7170
|
+
t.className = "an-context-color-palette", Qr.forEach((e) => {
|
|
7093
7171
|
let n = document.createElement("div");
|
|
7094
7172
|
n.className = "an-context-color-swatch", n.title = e, n.style.background = e, n.setAttribute("role", "button"), n.setAttribute("aria-label", e), n.addEventListener("click", (t) => {
|
|
7095
7173
|
t.stopPropagation(), this._applyColor(this._pickerType, e);
|
|
@@ -7157,7 +7235,7 @@ var Gr = class {
|
|
|
7157
7235
|
}
|
|
7158
7236
|
_syncActive() {
|
|
7159
7237
|
this._btnCache && this._btnCache.forEach((e) => {
|
|
7160
|
-
let t =
|
|
7238
|
+
let t = ni[e.dataset.name];
|
|
7161
7239
|
e.classList.toggle("an-active", !!t?.());
|
|
7162
7240
|
});
|
|
7163
7241
|
}
|
|
@@ -7208,7 +7286,7 @@ var Gr = class {
|
|
|
7208
7286
|
_onContextMenu() {
|
|
7209
7287
|
this._hide();
|
|
7210
7288
|
}
|
|
7211
|
-
},
|
|
7289
|
+
}, ai = class {
|
|
7212
7290
|
constructor(e) {
|
|
7213
7291
|
this.context = e, this._dropdown = null, this._query = "", this._debounceTimer = null, this._activeIndex = -1, this._items = [], this._open = !1, this._triggerNode = null, this._triggerOffset = 0, this._caretRect = null, this._disposers = [];
|
|
7214
7292
|
}
|
|
@@ -7353,7 +7431,7 @@ var Gr = class {
|
|
|
7353
7431
|
let n;
|
|
7354
7432
|
typeof this._cfg.onInsert == "function" && (n = this._cfg.onInsert(t)), n ||= `<span class="${this._cfg.mentionClass}" data-mention-id="${t.id}" contenteditable="false">@${t.label}</span>`, this.context.invoke("editor.insertHTML", n + "​"), this._hideDropdown(), this.context.triggerEvent("change", this.context.getHTML());
|
|
7355
7433
|
}
|
|
7356
|
-
},
|
|
7434
|
+
}, oi = class {
|
|
7357
7435
|
constructor(e) {
|
|
7358
7436
|
this.context = e, this.options = e.options, this._disposers = [], this._menu = null, this._filtered = [], this._activeIndex = -1, this._open = !1, this._query = "", this._textNode = null, this._triggerOffset = 0, this._caretRect = null;
|
|
7359
7437
|
}
|
|
@@ -7580,38 +7658,38 @@ var Gr = class {
|
|
|
7580
7658
|
this._deleteTriggerText(), this._close(), t.run();
|
|
7581
7659
|
}
|
|
7582
7660
|
}
|
|
7583
|
-
},
|
|
7661
|
+
}, si = /* @__PURE__ */ new Map(), ci = [
|
|
7584
7662
|
{
|
|
7585
7663
|
name: "autoSaveRestore",
|
|
7586
|
-
Class:
|
|
7664
|
+
Class: Xr,
|
|
7587
7665
|
enabled: (e) => !!e.autoSaveRestore
|
|
7588
7666
|
},
|
|
7589
7667
|
{
|
|
7590
7668
|
name: "markdownShortcuts",
|
|
7591
|
-
Class:
|
|
7669
|
+
Class: Zr,
|
|
7592
7670
|
enabled: (e) => e.markdownShortcuts !== !1
|
|
7593
7671
|
},
|
|
7594
7672
|
{
|
|
7595
7673
|
name: "bubbleToolbar",
|
|
7596
|
-
Class:
|
|
7674
|
+
Class: ii,
|
|
7597
7675
|
enabled: (e) => !!e.bubbleToolbar
|
|
7598
7676
|
},
|
|
7599
7677
|
{
|
|
7600
7678
|
name: "mention",
|
|
7601
|
-
Class:
|
|
7679
|
+
Class: ai,
|
|
7602
7680
|
enabled: (e) => !!e.mention
|
|
7603
7681
|
},
|
|
7604
7682
|
{
|
|
7605
7683
|
name: "slashMenu",
|
|
7606
|
-
Class:
|
|
7684
|
+
Class: oi,
|
|
7607
7685
|
enabled: (e) => e.slashMenu !== !1
|
|
7608
7686
|
}
|
|
7609
|
-
],
|
|
7687
|
+
], Z = /* @__PURE__ */ new Map(), li = class {
|
|
7610
7688
|
constructor(e, t = {}) {
|
|
7611
7689
|
this.targetEl = e, this.options = c(A, t), this.locale = Wt(this.options.lang), this.layoutInfo = {}, this._listeners = /* @__PURE__ */ new Map(), this._modules = /* @__PURE__ */ new Map(), this._plugins = /* @__PURE__ */ new Map(), this._disposers = [], this._alive = !1, this._autoSaveTimer = null, this._pendingAutoSave = null, this._suppressedRemoteHTML = null, this._destroyPromise = null;
|
|
7612
7690
|
}
|
|
7613
7691
|
initialize() {
|
|
7614
|
-
let { container: e, editable: t } =
|
|
7692
|
+
let { container: e, editable: t } = ln(this.targetEl, this.options);
|
|
7615
7693
|
this.layoutInfo.container = e, this.layoutInfo.editable = t, this._registerModules();
|
|
7616
7694
|
let n = this._modules.get("toolbar");
|
|
7617
7695
|
n?.el && (e.insertBefore(n.el, t), this.layoutInfo.toolbar = n.el);
|
|
@@ -7623,12 +7701,12 @@ var Gr = class {
|
|
|
7623
7701
|
let n = new t(this);
|
|
7624
7702
|
this._modules.set(e, n), n.initialize();
|
|
7625
7703
|
};
|
|
7626
|
-
e("editor",
|
|
7627
|
-
for (let { name: t, Class: n, enabled: r } of
|
|
7628
|
-
if (
|
|
7704
|
+
e("editor", Wn), e("toolbar", Yn), e("statusbar", $n), e("clipboard", er), e("contextMenu", Hr), e("placeholder", tr), e("codeview", nr), e("fullscreen", rr), e("linkDialog", ar), e("imageDialog", sr), e("videoDialog", lr), e("imageResizer", fr), e("videoResizer", pr), e("linkTooltip", _r), e("imageTooltip", yr), e("videoTooltip", br), e("tableTooltip", Dr), e("codeTooltip", jr), e("emojiDialog", Fr), e("iconDialog", Rr), e("shortcutsDialog", Gr), e("findReplace", Kr), e("imageCropOverlay", Yr);
|
|
7705
|
+
for (let { name: t, Class: n, enabled: r } of ci) r(this.options) && e(t, n);
|
|
7706
|
+
if (si.size > 0) for (let [t, n] of si) e(t, n);
|
|
7629
7707
|
}
|
|
7630
7708
|
_syncOptionalModules() {
|
|
7631
|
-
for (let { name: e, Class: t, enabled: n } of
|
|
7709
|
+
for (let { name: e, Class: t, enabled: n } of ci) {
|
|
7632
7710
|
let r = n(this.options);
|
|
7633
7711
|
if (r !== this._modules.has(e)) if (r) {
|
|
7634
7712
|
let n = new t(this);
|
|
@@ -7672,7 +7750,7 @@ var Gr = class {
|
|
|
7672
7750
|
});
|
|
7673
7751
|
}
|
|
7674
7752
|
_applyGlobalPlugins() {
|
|
7675
|
-
if (
|
|
7753
|
+
if (Z.size !== 0) for (let { plugin: e, options: t } of Z.values()) this._installPlugin(e, t);
|
|
7676
7754
|
}
|
|
7677
7755
|
_bindEditorEvents(e) {
|
|
7678
7756
|
let t = E(e, "input", () => this._syncToTarget()), n = E(e, "focus", () => {
|
|
@@ -7928,63 +8006,82 @@ var Gr = class {
|
|
|
7928
8006
|
};
|
|
7929
8007
|
//#endregion
|
|
7930
8008
|
//#region src/js/core/lists.js
|
|
7931
|
-
function
|
|
8009
|
+
function ui(e) {
|
|
7932
8010
|
return e[e.length - 1];
|
|
7933
8011
|
}
|
|
7934
|
-
function
|
|
8012
|
+
function di(e) {
|
|
7935
8013
|
return e[0];
|
|
7936
8014
|
}
|
|
7937
|
-
function
|
|
8015
|
+
function fi(e, t = 1) {
|
|
7938
8016
|
return e.slice(0, e.length - t);
|
|
7939
8017
|
}
|
|
7940
|
-
function
|
|
8018
|
+
function pi(e, t = 1) {
|
|
7941
8019
|
return e.slice(t);
|
|
7942
8020
|
}
|
|
7943
|
-
function
|
|
8021
|
+
function mi(e) {
|
|
7944
8022
|
return e.flat();
|
|
7945
8023
|
}
|
|
7946
|
-
function
|
|
8024
|
+
function hi(e) {
|
|
7947
8025
|
return [...new Set(e)];
|
|
7948
8026
|
}
|
|
7949
|
-
function
|
|
8027
|
+
function gi(e, t) {
|
|
7950
8028
|
let n = [];
|
|
7951
8029
|
for (let r = 0; r < e.length; r += t) n.push(e.slice(r, r + t));
|
|
7952
8030
|
return n;
|
|
7953
8031
|
}
|
|
7954
|
-
function
|
|
8032
|
+
function _i(e, t) {
|
|
7955
8033
|
return e.reduce((e, n) => {
|
|
7956
8034
|
let r = t(n);
|
|
7957
8035
|
return e[r] || (e[r] = []), e[r].push(n), e;
|
|
7958
8036
|
}, {});
|
|
7959
8037
|
}
|
|
7960
|
-
function
|
|
8038
|
+
function vi(e, t) {
|
|
7961
8039
|
return e.every(t);
|
|
7962
8040
|
}
|
|
7963
|
-
function
|
|
8041
|
+
function yi(e, t) {
|
|
7964
8042
|
return e.some(t);
|
|
7965
8043
|
}
|
|
7966
8044
|
//#endregion
|
|
7967
8045
|
//#region src/js/core/env.js
|
|
7968
|
-
|
|
7969
|
-
|
|
7970
|
-
|
|
7971
|
-
|
|
7972
|
-
|
|
7973
|
-
|
|
7974
|
-
|
|
7975
|
-
|
|
7976
|
-
|
|
7977
|
-
},
|
|
8046
|
+
function Q() {
|
|
8047
|
+
return globalThis.navigator?.userAgent ?? "";
|
|
8048
|
+
}
|
|
8049
|
+
var bi = {
|
|
8050
|
+
get isChrome() {
|
|
8051
|
+
return /Chrome\//.test(Q()) && !/Edg\//.test(Q());
|
|
8052
|
+
},
|
|
8053
|
+
get isFF() {
|
|
8054
|
+
return /Firefox\//.test(Q());
|
|
8055
|
+
},
|
|
8056
|
+
get isSafari() {
|
|
8057
|
+
return /^((?!chrome|android).)*safari/i.test(Q());
|
|
8058
|
+
},
|
|
8059
|
+
get isEdge() {
|
|
8060
|
+
return /Edg\//.test(Q());
|
|
8061
|
+
},
|
|
8062
|
+
get isMac() {
|
|
8063
|
+
return /Macintosh/.test(Q());
|
|
8064
|
+
},
|
|
8065
|
+
get isMobile() {
|
|
8066
|
+
return /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(Q());
|
|
8067
|
+
},
|
|
8068
|
+
get isTouch() {
|
|
8069
|
+
return "ontouchstart" in globalThis || (globalThis.navigator?.maxTouchPoints ?? 0) > 0;
|
|
8070
|
+
},
|
|
8071
|
+
get modifierKey() {
|
|
8072
|
+
return /Macintosh/.test(Q()) ? "metaKey" : "ctrlKey";
|
|
8073
|
+
}
|
|
8074
|
+
}, xi = { ...A }, $ = /* @__PURE__ */ new WeakMap(), Si = {
|
|
7978
8075
|
create(e, t = {}) {
|
|
7979
|
-
let n =
|
|
8076
|
+
let n = Ci(e).map((e) => {
|
|
7980
8077
|
if ($.has(e)) return $.get(e);
|
|
7981
|
-
let n = new
|
|
8078
|
+
let n = new li(e, t);
|
|
7982
8079
|
return n.initialize(), $.set(e, n), n;
|
|
7983
8080
|
});
|
|
7984
8081
|
return n.length === 1 ? n[0] : n;
|
|
7985
8082
|
},
|
|
7986
8083
|
destroy(e) {
|
|
7987
|
-
|
|
8084
|
+
Ci(e).forEach((e) => {
|
|
7988
8085
|
let t = $.get(e);
|
|
7989
8086
|
t && (t.destroy(), $.delete(e));
|
|
7990
8087
|
});
|
|
@@ -8000,20 +8097,20 @@ var Q = navigator.userAgent, _i = {
|
|
|
8000
8097
|
Object.assign(A, e);
|
|
8001
8098
|
},
|
|
8002
8099
|
resetDefaults() {
|
|
8003
|
-
Object.keys(A).forEach((e) => delete A[e]), Object.assign(A,
|
|
8100
|
+
Object.keys(A).forEach((e) => delete A[e]), Object.assign(A, xi);
|
|
8004
8101
|
},
|
|
8005
8102
|
registerModule(e, t) {
|
|
8006
|
-
|
|
8103
|
+
si.set(e, t);
|
|
8007
8104
|
},
|
|
8008
8105
|
use(e, t = {}) {
|
|
8009
8106
|
if (!e || typeof e.name != "string") throw TypeError("[AutumnNote] AutumnNote.use: plugin must have a string `name` property.");
|
|
8010
|
-
return
|
|
8107
|
+
return Z.has(e.name) ? (console.warn(`[AutumnNote] Plugin "${e.name}" already registered globally. Skipping.`), this) : (Array.isArray(e.buttons) && e.buttons.forEach((e) => $e(e)), Z.set(e.name, {
|
|
8011
8108
|
plugin: e,
|
|
8012
8109
|
options: t
|
|
8013
8110
|
}), this);
|
|
8014
8111
|
},
|
|
8015
8112
|
hasPlugin(e) {
|
|
8016
|
-
return
|
|
8113
|
+
return Z.has(e);
|
|
8017
8114
|
},
|
|
8018
8115
|
registerButton(e) {
|
|
8019
8116
|
return $e(e), this;
|
|
@@ -8027,12 +8124,12 @@ var Q = navigator.userAgent, _i = {
|
|
|
8027
8124
|
return n >= 0 ? t[n] = e : t.push(e), this;
|
|
8028
8125
|
},
|
|
8029
8126
|
buttons: Vt,
|
|
8030
|
-
version: "2.
|
|
8127
|
+
version: "2.1.0"
|
|
8031
8128
|
};
|
|
8032
|
-
function
|
|
8129
|
+
function Ci(e) {
|
|
8033
8130
|
return typeof e == "string" ? Array.from(document.querySelectorAll(e)) : e instanceof Element ? [e] : e instanceof NodeList || Array.isArray(e) ? Array.from(e) : [];
|
|
8034
8131
|
}
|
|
8035
8132
|
//#endregion
|
|
8036
|
-
export {
|
|
8133
|
+
export { li as Context, d as ELEMENT_NODE, f as TEXT_NODE, ge as WrappedRange, Qe as _buttonRegistry, ct as alignCenterBtn, ut as alignJustifyBtn, st as alignLeftBtn, lt as alignRightBtn, vi as all, ne as ancestors, yi as any, zt as backColorBtn, tt as boldBtn, Vt as buttons, It as checklistBtn, re as children, gi as chunk, e as clamp, S as closest, C as closestPara, At as codeviewBtn, be as collapsedRange, r as compose, w as createElement, ve as currentRange, t as debounce, Si as default, A as defaultOptions, Bt as defaultToolbar, Et as directionBtn, xt as emojiBtn, bi as env, Nt as findBtn, Pt as findReplaceBtn, di as first, mi as flatten, Dt as fontFamilyBtn, wt as fontSizeBtn, Rt as foreColorBtn, _e as fromNativeRange, jt as fullscreenBtn, et as getButton, _i as groupBy, _t as hrBtn, St as iconBtn, i as identity, yt as imageBtn, pt as indentBtn, fi as initial, Ft as inlineCodeBtn, ce as insertAfter, ee as isAnchor, x as isEditable, p as isElement, ue as isEmpty, s as isFunction, te as isImage, b as isInline, pe as isInsideEditable, P as isKey, _ as isLi, v as isList, F as isModifier, a as isNil, g as isPara, l as isPlainObject, xe as isSelectionInside, o as isString, y as isTable, m as isText, h as isVoid, nt as italicBtn, N as key, ui as last, kt as lineHeightBtn, vt as linkBtn, Ht as locales, he as makeDraggable, c as mergeDeep, ae as nextElement, le as nodeValue, ft as olBtn, E as on, mt as outdentBtn, de as outerHtml, Ot as paragraphStyleBtn, fe as placeCaret, ie as prevElement, Lt as printBtn, ye as rangeFromElement, u as rect2bnd, gt as redoBtn, $e as registerButton, Ut as registerLocale, T as remove, Tt as removeFormatBtn, Wt as resolveLocale, M as sanitiseHTML, sn as sanitiseUrl, Mt as shortcutsBtn, Ce as splitText, it as strikeBtn, ot as subscriptBtn, at as superscriptBtn, Ct as tableBtn, pi as tail, n as throttle, me as trapFocus, dt as ulBtn, rt as underlineBtn, ht as undoBtn, hi as unique, oe as unwrap, bt as videoBtn, Se as withSavedRange, se as wrap };
|
|
8037
8134
|
|
|
8038
8135
|
//# sourceMappingURL=autumnnote.es.js.map
|