autumnnote 2.1.0 → 2.2.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/README.md +72 -5
- package/dist/autumnnote.cjs +20 -20
- package/dist/autumnnote.es.js +385 -619
- 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/dist/icon-data-V0Xqv-wX.js +255 -0
- package/dist/icon-data-V0Xqv-wX.js.map +1 -0
- package/package.json +12 -3
- package/types/index.d.ts +8 -0
- package/src/js/Context.js +0 -854
- package/src/js/core/detectLang.js +0 -98
- package/src/js/core/dom.js +0 -372
- package/src/js/core/env.js +0 -38
- package/src/js/core/key.js +0 -66
- package/src/js/core/lists.js +0 -121
- package/src/js/core/markdown.js +0 -695
- package/src/js/core/range.js +0 -194
- package/src/js/core/sanitise.js +0 -304
- package/src/js/editing/History.js +0 -266
- package/src/js/editing/Style.js +0 -812
- package/src/js/editing/Table.js +0 -105
- package/src/js/editing/Typing.js +0 -397
- package/src/js/index.js +0 -193
- package/src/js/index.umd.js +0 -17
- package/src/js/module/AutoSaveRestore.js +0 -125
- package/src/js/module/BaseDialog.js +0 -133
- package/src/js/module/BaseMediaTooltip.js +0 -142
- package/src/js/module/BaseResizer.js +0 -322
- package/src/js/module/BubbleToolbar.js +0 -483
- package/src/js/module/Buttons.js +0 -399
- package/src/js/module/Clipboard.js +0 -579
- package/src/js/module/CodeTooltip.js +0 -493
- package/src/js/module/Codeview.js +0 -125
- package/src/js/module/ContextMenu.js +0 -621
- package/src/js/module/Editor.js +0 -747
- package/src/js/module/EmojiDialog.js +0 -254
- package/src/js/module/FindReplace.js +0 -512
- package/src/js/module/Fullscreen.js +0 -80
- package/src/js/module/IconDialog.js +0 -618
- package/src/js/module/ImageCropOverlay.js +0 -586
- package/src/js/module/ImageDialog.js +0 -193
- package/src/js/module/ImageResizer.js +0 -42
- package/src/js/module/ImageTooltip.js +0 -285
- package/src/js/module/LinkDialog.js +0 -145
- package/src/js/module/LinkTooltip.js +0 -250
- package/src/js/module/MarkdownShortcuts.js +0 -250
- package/src/js/module/Mention.js +0 -365
- package/src/js/module/Placeholder.js +0 -51
- package/src/js/module/ShortcutsDialog.js +0 -111
- package/src/js/module/SlashMenu.js +0 -376
- package/src/js/module/Statusbar.js +0 -246
- package/src/js/module/TableTooltip.js +0 -1392
- package/src/js/module/Toolbar.js +0 -855
- package/src/js/module/VideoDialog.js +0 -193
- package/src/js/module/VideoResizer.js +0 -66
- package/src/js/module/VideoTooltip.js +0 -248
- package/src/js/module/emoji-data.js +0 -496
- package/src/js/module/table-grid.js +0 -102
- package/src/js/module/table-icons.js +0 -33
- package/src/js/renderer.js +0 -120
- package/src/js/settings.js +0 -214
- package/src/styles/_variables.scss +0 -48
- package/src/styles/autumnnote.scss +0 -2877
package/dist/autumnnote.es.js
CHANGED
|
@@ -835,6 +835,8 @@ var tt = k("bold", "bold", "Bold (Ctrl+B)", () => we(), () => document.queryComm
|
|
|
835
835
|
toolbarButtonClass: "btn btn-sm btn-light",
|
|
836
836
|
useFontAwesome: !0,
|
|
837
837
|
fontAwesomeClass: "fas",
|
|
838
|
+
fontAwesomeAutoInject: !0,
|
|
839
|
+
fontAwesomeCDN: "https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.2/css/all.min.css",
|
|
838
840
|
pasteAsPlainText: !1,
|
|
839
841
|
pasteCleanHTML: !0,
|
|
840
842
|
pasteStripAttributes: !1,
|
|
@@ -1403,7 +1405,7 @@ function M(e, { allowIframes: t = !1 } = {}) {
|
|
|
1403
1405
|
"AUDIO",
|
|
1404
1406
|
"SOURCE"
|
|
1405
1407
|
].includes(e.tagName), i = e.tagName === "IMG";
|
|
1406
|
-
if (!(t.name === "srcset" ? an(n, { allowData: i }) :
|
|
1408
|
+
if (!(t.name === "srcset" ? an(n, { allowData: i }) : sn(n, {
|
|
1407
1409
|
media: r,
|
|
1408
1410
|
allowData: i
|
|
1409
1411
|
}))) {
|
|
@@ -1443,7 +1445,7 @@ function an(e, { allowData: t = !1 } = {}) {
|
|
|
1443
1445
|
for (let e of n) {
|
|
1444
1446
|
if (/^[\d.]+[xw],?$/i.test(e)) continue;
|
|
1445
1447
|
let n = e.replace(/,+$/, "");
|
|
1446
|
-
if (n && !
|
|
1448
|
+
if (n && !sn(n, {
|
|
1447
1449
|
media: !0,
|
|
1448
1450
|
allowData: t
|
|
1449
1451
|
})) return !1;
|
|
@@ -1460,14 +1462,14 @@ function on(e) {
|
|
|
1460
1462
|
return !1;
|
|
1461
1463
|
}
|
|
1462
1464
|
}
|
|
1463
|
-
function
|
|
1465
|
+
function N(e, { allowData: t = !1, media: n = t } = {}) {
|
|
1464
1466
|
let r = (e || "").trim();
|
|
1465
|
-
return !r && e == null ? null :
|
|
1467
|
+
return !r && e == null ? null : sn(r, {
|
|
1466
1468
|
media: n,
|
|
1467
1469
|
allowData: t
|
|
1468
1470
|
}) ? e : null;
|
|
1469
1471
|
}
|
|
1470
|
-
function
|
|
1472
|
+
function sn(e, { media: t = !1, allowData: n = !1 } = {}) {
|
|
1471
1473
|
let r = (e || "").trim();
|
|
1472
1474
|
if (!r || n && tn.test(r)) return !0;
|
|
1473
1475
|
try {
|
|
@@ -1479,7 +1481,7 @@ function cn(e, { media: t = !1, allowData: n = !1 } = {}) {
|
|
|
1479
1481
|
}
|
|
1480
1482
|
//#endregion
|
|
1481
1483
|
//#region src/js/renderer.js
|
|
1482
|
-
function
|
|
1484
|
+
function cn(e, t) {
|
|
1483
1485
|
let n = w("div", { class: "an-container" }), r = w("div", {
|
|
1484
1486
|
class: "an-editable",
|
|
1485
1487
|
contenteditable: t.readOnly ? "false" : "true",
|
|
@@ -1502,7 +1504,7 @@ function ln(e, t) {
|
|
|
1502
1504
|
}
|
|
1503
1505
|
//#endregion
|
|
1504
1506
|
//#region src/js/editing/History.js
|
|
1505
|
-
var
|
|
1507
|
+
var ln = class {
|
|
1506
1508
|
constructor(e, t = 100, n = 10 * 1024 * 1024) {
|
|
1507
1509
|
this.editable = e, this._limit = t, this._maxBytes = n, this._bytes = 0, this.stack = [], this.stackOffset = -1, this._savePoint();
|
|
1508
1510
|
}
|
|
@@ -1623,7 +1625,7 @@ var un = class {
|
|
|
1623
1625
|
};
|
|
1624
1626
|
//#endregion
|
|
1625
1627
|
//#region src/js/editing/Table.js
|
|
1626
|
-
function
|
|
1628
|
+
function un(e, t, n = {}) {
|
|
1627
1629
|
let { headerRow: r = !1 } = n, i = w("table", { class: "an-table" });
|
|
1628
1630
|
if (r && t > 0) {
|
|
1629
1631
|
let t = w("thead"), n = w("tr");
|
|
@@ -1645,9 +1647,9 @@ function dn(e, t, n = {}) {
|
|
|
1645
1647
|
}
|
|
1646
1648
|
return i;
|
|
1647
1649
|
}
|
|
1648
|
-
function
|
|
1650
|
+
function dn(e, t, n = {}) {
|
|
1649
1651
|
if (e <= 0 || t <= 0) return;
|
|
1650
|
-
let r =
|
|
1652
|
+
let r = un(e, t, n), i = globalThis.getSelection();
|
|
1651
1653
|
if (!i || i.rangeCount === 0) return;
|
|
1652
1654
|
let a = i.getRangeAt(0);
|
|
1653
1655
|
try {
|
|
@@ -1688,7 +1690,7 @@ function fn(e, t, n = {}) {
|
|
|
1688
1690
|
}
|
|
1689
1691
|
//#endregion
|
|
1690
1692
|
//#region src/js/core/key.js
|
|
1691
|
-
var
|
|
1693
|
+
var P = {
|
|
1692
1694
|
BACKSPACE: "Backspace",
|
|
1693
1695
|
TAB: "Tab",
|
|
1694
1696
|
ENTER: "Enter",
|
|
@@ -1727,16 +1729,16 @@ var N = {
|
|
|
1727
1729
|
SLASH: "/",
|
|
1728
1730
|
PERIOD: "."
|
|
1729
1731
|
};
|
|
1730
|
-
function
|
|
1732
|
+
function F(e, t) {
|
|
1731
1733
|
return e.key === t || e.key === t.toUpperCase();
|
|
1732
1734
|
}
|
|
1733
|
-
function
|
|
1734
|
-
return (e.ctrlKey || e.metaKey) &&
|
|
1735
|
+
function I(e, t) {
|
|
1736
|
+
return (e.ctrlKey || e.metaKey) && F(e, t);
|
|
1735
1737
|
}
|
|
1736
1738
|
//#endregion
|
|
1737
1739
|
//#region src/js/editing/Typing.js
|
|
1738
|
-
var
|
|
1739
|
-
function
|
|
1740
|
+
var fn = /\bfa-/, L = (e) => !!(e?.nodeName === "I" && fn.test(e.className || "")), pn = (e) => e?.nodeType === Node.TEXT_NODE && (e.textContent === "" || e.textContent === "");
|
|
1741
|
+
function mn(e, t) {
|
|
1740
1742
|
try {
|
|
1741
1743
|
let n = document.createRange();
|
|
1742
1744
|
return n.setStart(e.startContainer, e.startOffset), n.setEnd(t, t.childNodes.length), n.extractContents();
|
|
@@ -1744,21 +1746,21 @@ function hn(e, t) {
|
|
|
1744
1746
|
return document.createDocumentFragment();
|
|
1745
1747
|
}
|
|
1746
1748
|
}
|
|
1747
|
-
function
|
|
1749
|
+
function hn(e, t, n = {}) {
|
|
1748
1750
|
let r = (e) => {
|
|
1749
1751
|
let t = globalThis.getSelection();
|
|
1750
1752
|
if (!t) return !1;
|
|
1751
1753
|
let n = document.createRange();
|
|
1752
1754
|
return e(n), n.collapse(!0), t.removeAllRanges(), t.addRange(n), !0;
|
|
1753
1755
|
};
|
|
1754
|
-
if (
|
|
1756
|
+
if (F(e, P.BACKSPACE)) {
|
|
1755
1757
|
let t = globalThis.getSelection();
|
|
1756
1758
|
if (t?.rangeCount > 0) {
|
|
1757
1759
|
let n = t.getRangeAt(0);
|
|
1758
1760
|
if (n.collapsed && n.startContainer.nodeType === Node.TEXT_NODE) {
|
|
1759
1761
|
let r = n.startContainer;
|
|
1760
|
-
if (n.startOffset === 0 &&
|
|
1761
|
-
if (n.startOffset === 1 && r.textContent === "" &&
|
|
1762
|
+
if (n.startOffset === 0 && L(r.previousSibling)) return e.preventDefault(), r.previousSibling.remove(), !0;
|
|
1763
|
+
if (n.startOffset === 1 && r.textContent === "" && L(r.previousSibling)) {
|
|
1762
1764
|
e.preventDefault();
|
|
1763
1765
|
let n = r.parentNode, i = r.previousSibling, a = i.previousSibling;
|
|
1764
1766
|
i.remove(), r.remove();
|
|
@@ -1769,17 +1771,17 @@ function gn(e, t, n = {}) {
|
|
|
1769
1771
|
}
|
|
1770
1772
|
return !1;
|
|
1771
1773
|
}
|
|
1772
|
-
if (
|
|
1774
|
+
if (F(e, P.LEFT) || F(e, P.RIGHT)) {
|
|
1773
1775
|
let t = globalThis.getSelection();
|
|
1774
1776
|
if (!t || t.rangeCount === 0) return !1;
|
|
1775
1777
|
let n = t.getRangeAt(0);
|
|
1776
1778
|
if (!n.collapsed) return !1;
|
|
1777
|
-
let i = n.startContainer, a =
|
|
1779
|
+
let i = n.startContainer, a = F(e, P.LEFT);
|
|
1778
1780
|
if (i.nodeType === Node.TEXT_NODE) {
|
|
1779
1781
|
let t = i;
|
|
1780
|
-
if (a && n.startOffset === 1 && t.textContent === "" &&
|
|
1781
|
-
if (a && n.startOffset === 0 &&
|
|
1782
|
-
if (!a && n.startOffset === t.textContent.length &&
|
|
1782
|
+
if (a && n.startOffset === 1 && t.textContent === "" && L(t.previousSibling) || a && n.startOffset === 0 && L(t.previousSibling)) return e.preventDefault(), r((e) => e.setStartBefore(t.previousSibling));
|
|
1783
|
+
if (a && n.startOffset === 0 && pn(t.previousSibling) && L(t.previousSibling.previousSibling)) return e.preventDefault(), r((e) => e.setStartBefore(t.previousSibling.previousSibling));
|
|
1784
|
+
if (!a && n.startOffset === t.textContent.length && L(t.nextSibling)) {
|
|
1783
1785
|
let n = t.nextSibling, i = n.nextSibling;
|
|
1784
1786
|
if (e.preventDefault(), i?.nodeType === Node.TEXT_NODE) {
|
|
1785
1787
|
let e = +!!(i.textContent || "").startsWith("");
|
|
@@ -1787,7 +1789,7 @@ function gn(e, t, n = {}) {
|
|
|
1787
1789
|
}
|
|
1788
1790
|
return r((e) => e.setStartAfter(n));
|
|
1789
1791
|
}
|
|
1790
|
-
if (!a && n.startOffset === t.textContent.length &&
|
|
1792
|
+
if (!a && n.startOffset === t.textContent.length && pn(t.nextSibling) && L(t.nextSibling.nextSibling)) {
|
|
1791
1793
|
let n = t.nextSibling.nextSibling, i = n.nextSibling;
|
|
1792
1794
|
if (e.preventDefault(), i?.nodeType === Node.TEXT_NODE) {
|
|
1793
1795
|
let e = +!!(i.textContent || "").startsWith("");
|
|
@@ -1800,12 +1802,12 @@ function gn(e, t, n = {}) {
|
|
|
1800
1802
|
let t = i;
|
|
1801
1803
|
if (a && n.startOffset > 0) {
|
|
1802
1804
|
let i = t.childNodes[n.startOffset - 1];
|
|
1803
|
-
if (
|
|
1804
|
-
if (
|
|
1805
|
+
if (L(i)) return e.preventDefault(), r((e) => e.setStartBefore(i));
|
|
1806
|
+
if (pn(i) && L(i.previousSibling)) return e.preventDefault(), r((e) => e.setStartBefore(i.previousSibling));
|
|
1805
1807
|
}
|
|
1806
1808
|
if (!a && n.startOffset < t.childNodes.length) {
|
|
1807
1809
|
let i = t.childNodes[n.startOffset];
|
|
1808
|
-
if (
|
|
1810
|
+
if (L(i)) {
|
|
1809
1811
|
let t = i.nextSibling;
|
|
1810
1812
|
if (e.preventDefault(), t?.nodeType === Node.TEXT_NODE) {
|
|
1811
1813
|
let e = +!!(t.textContent || "").startsWith("");
|
|
@@ -1813,7 +1815,7 @@ function gn(e, t, n = {}) {
|
|
|
1813
1815
|
}
|
|
1814
1816
|
return r((e) => e.setStartAfter(i));
|
|
1815
1817
|
}
|
|
1816
|
-
if (
|
|
1818
|
+
if (pn(i) && L(i.nextSibling)) {
|
|
1817
1819
|
let t = i.nextSibling, n = t.nextSibling;
|
|
1818
1820
|
if (e.preventDefault(), n?.nodeType === Node.TEXT_NODE) {
|
|
1819
1821
|
let e = +!!(n.textContent || "").startsWith("");
|
|
@@ -1824,7 +1826,7 @@ function gn(e, t, n = {}) {
|
|
|
1824
1826
|
}
|
|
1825
1827
|
}
|
|
1826
1828
|
}
|
|
1827
|
-
if (
|
|
1829
|
+
if (F(e, P.TAB)) {
|
|
1828
1830
|
let r = ve(t);
|
|
1829
1831
|
if (!r) return !1;
|
|
1830
1832
|
let i = C(r.sc, t);
|
|
@@ -1832,8 +1834,8 @@ function gn(e, t, n = {}) {
|
|
|
1832
1834
|
if (i?.nodeName.toUpperCase() === "PRE") return e.shiftKey ? !1 : (e.preventDefault(), D("insertText", " ".repeat(n.tabSize || 4)), !0);
|
|
1833
1835
|
if (n.tabSize) return e.shiftKey ? !1 : (e.preventDefault(), D("insertText", " ".repeat(n.tabSize)), !0);
|
|
1834
1836
|
}
|
|
1835
|
-
if (
|
|
1836
|
-
if (
|
|
1837
|
+
if (F(e, P.ENTER) && e.shiftKey) return e.preventDefault(), D("insertLineBreak"), !0;
|
|
1838
|
+
if (F(e, P.ENTER) && !e.shiftKey) {
|
|
1837
1839
|
let n = ve(t);
|
|
1838
1840
|
if (!n) return !1;
|
|
1839
1841
|
let r = n.sc, i = r.nodeType === 3 ? r.parentElement : r;
|
|
@@ -1867,7 +1869,7 @@ function gn(e, t, n = {}) {
|
|
|
1867
1869
|
if (r.deleteContents(), n.rangeCount === 0 || !o.isConnected) return !0;
|
|
1868
1870
|
r = n.getRangeAt(0);
|
|
1869
1871
|
}
|
|
1870
|
-
let i =
|
|
1872
|
+
let i = mn(r, o), a = document.createElement("li"), s = document.createElement("input");
|
|
1871
1873
|
s.type = "checkbox", s.setAttribute("contenteditable", "false"), a.appendChild(s), i.textContent.replace(/[\u00a0\u200B]/g, "").length > 0 && a.appendChild(i);
|
|
1872
1874
|
let c = a.childNodes[1];
|
|
1873
1875
|
c?.nodeType !== Node.TEXT_NODE && (c = document.createTextNode(""), a.appendChild(c)), o.after(a);
|
|
@@ -1885,16 +1887,16 @@ function gn(e, t, n = {}) {
|
|
|
1885
1887
|
}
|
|
1886
1888
|
//#endregion
|
|
1887
1889
|
//#region src/js/core/markdown.js
|
|
1888
|
-
function
|
|
1889
|
-
return
|
|
1890
|
+
function gn(e) {
|
|
1891
|
+
return vn(new DOMParser().parseFromString(`<body>${e || ""}</body>`, "text/html").body).replace(/\n{3,}/g, "\n\n").trim();
|
|
1890
1892
|
}
|
|
1891
|
-
function
|
|
1893
|
+
function _n(e, t) {
|
|
1892
1894
|
return Array.from(e.children).filter((e) => e.tagName === t.toUpperCase());
|
|
1893
1895
|
}
|
|
1894
|
-
function
|
|
1896
|
+
function vn(e, t = 0) {
|
|
1895
1897
|
if (e.nodeType === 3) return e.textContent.replace(/\s+/g, " ");
|
|
1896
1898
|
if (e.nodeType !== 1) return "";
|
|
1897
|
-
let n = e, r = n.nodeName.toLowerCase(), i = () => Array.from(n.childNodes).map((e) =>
|
|
1899
|
+
let n = e, r = n.nodeName.toLowerCase(), i = () => Array.from(n.childNodes).map((e) => vn(e, t)).join("");
|
|
1898
1900
|
switch (r) {
|
|
1899
1901
|
case "p":
|
|
1900
1902
|
case "div": return `\n\n${i()}\n\n`;
|
|
@@ -1917,7 +1919,7 @@ function yn(e, t = 0) {
|
|
|
1917
1919
|
case "u": return `<u>${i()}</u>`;
|
|
1918
1920
|
case "span": {
|
|
1919
1921
|
let e = n.getAttribute("style") || "";
|
|
1920
|
-
return /\b(color|background-color|font-size)\s*:/.test(e) ? `<span style="${
|
|
1922
|
+
return /\b(color|background-color|font-size)\s*:/.test(e) ? `<span style="${z(e)}">${i()}</span>` : i();
|
|
1921
1923
|
}
|
|
1922
1924
|
case "code": return n.closest("pre") ? i() : `\`${i()}\``;
|
|
1923
1925
|
case "pre": {
|
|
@@ -1937,18 +1939,18 @@ function yn(e, t = 0) {
|
|
|
1937
1939
|
return ``;
|
|
1938
1940
|
}
|
|
1939
1941
|
case "ul": {
|
|
1940
|
-
let e =
|
|
1942
|
+
let e = _n(n, "li");
|
|
1941
1943
|
if (!e.length) return i();
|
|
1942
1944
|
let r = " ".repeat(t), a = n.classList.contains("an-checklist"), o = e.map((e) => {
|
|
1943
|
-
let n =
|
|
1944
|
-
return (a || n) && (i = n && n.checked ? "- [x] " : "- [ ] "), `${r}${i}${
|
|
1945
|
+
let n = _n(e, "input").find((e) => e.getAttribute("type") === "checkbox"), i = "- ";
|
|
1946
|
+
return (a || n) && (i = n && n.checked ? "- [x] " : "- [ ] "), `${r}${i}${vn(e, t + 1).trim()}`;
|
|
1945
1947
|
}).join("\n");
|
|
1946
1948
|
return t === 0 ? `\n\n${o}\n\n` : `\n${o}`;
|
|
1947
1949
|
}
|
|
1948
1950
|
case "ol": {
|
|
1949
|
-
let e =
|
|
1951
|
+
let e = _n(n, "li");
|
|
1950
1952
|
if (!e.length) return i();
|
|
1951
|
-
let r = " ".repeat(t), a = e.map((e, n) => `${r}${n + 1}. ${
|
|
1953
|
+
let r = " ".repeat(t), a = e.map((e, n) => `${r}${n + 1}. ${vn(e, t + 1).trim()}`).join("\n");
|
|
1952
1954
|
return t === 0 ? `\n\n${a}\n\n` : `\n${a}`;
|
|
1953
1955
|
}
|
|
1954
1956
|
case "li": return i();
|
|
@@ -1956,7 +1958,7 @@ function yn(e, t = 0) {
|
|
|
1956
1958
|
case "table": {
|
|
1957
1959
|
let e = Array.from(n.querySelectorAll("tr"));
|
|
1958
1960
|
if (!e.length) return i();
|
|
1959
|
-
let t = !!
|
|
1961
|
+
let t = !!_n(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) => {
|
|
1960
1962
|
let t = [...e];
|
|
1961
1963
|
for (; t.length < a;) t.push("");
|
|
1962
1964
|
return t;
|
|
@@ -1968,60 +1970,60 @@ function yn(e, t = 0) {
|
|
|
1968
1970
|
default: return i();
|
|
1969
1971
|
}
|
|
1970
1972
|
}
|
|
1971
|
-
function
|
|
1973
|
+
function yn(e) {
|
|
1972
1974
|
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);
|
|
1973
1975
|
}
|
|
1974
|
-
var
|
|
1975
|
-
function
|
|
1976
|
+
var bn = /^ {0,3}>( ?)(.*)$/, xn = /^ {0,3}([-*_])( *\1){2,}\s*$/, Sn = "";
|
|
1977
|
+
function Cn(e) {
|
|
1976
1978
|
let t = e.replaceAll("\r\n", "\n").replaceAll("\r", "\n").split("\n");
|
|
1977
|
-
t =
|
|
1978
|
-
let n =
|
|
1979
|
-
return t = n.clean,
|
|
1979
|
+
t = Dn(t);
|
|
1980
|
+
let n = On(t);
|
|
1981
|
+
return t = n.clean, Tn = n.linkDefs, En = n.footnoteIds, wn(t);
|
|
1980
1982
|
}
|
|
1981
|
-
function
|
|
1983
|
+
function wn(e) {
|
|
1982
1984
|
let t = [], n = 0;
|
|
1983
1985
|
for (; n < e.length;) {
|
|
1984
1986
|
let r = e[n], i = /^```(\S*)$/.exec(r);
|
|
1985
1987
|
if (i) {
|
|
1986
1988
|
let r = i[1], a = [];
|
|
1987
|
-
for (n++; n < e.length && !e[n].startsWith("```");) a.push(
|
|
1988
|
-
let o = r ? ` class="language-${
|
|
1989
|
+
for (n++; n < e.length && !e[n].startsWith("```");) a.push(zn(e[n])), n++;
|
|
1990
|
+
let o = r ? ` class="language-${z(r)}"` : "";
|
|
1989
1991
|
t.push(`<pre><code${o}>${a.join("\n")}</code></pre>`), n++;
|
|
1990
1992
|
continue;
|
|
1991
1993
|
}
|
|
1992
|
-
if (r.trim() && !
|
|
1994
|
+
if (r.trim() && !xn.test(r) && !/^#{1,6} /.test(r) && n + 1 < e.length) {
|
|
1993
1995
|
if (/^=+\s*$/.test(e[n + 1])) {
|
|
1994
|
-
t.push(`<h1>${
|
|
1996
|
+
t.push(`<h1>${R(r.trim())}</h1>`), n += 2;
|
|
1995
1997
|
continue;
|
|
1996
1998
|
}
|
|
1997
1999
|
if (/^-{2,}\s*$/.test(e[n + 1])) {
|
|
1998
|
-
t.push(`<h2>${
|
|
2000
|
+
t.push(`<h2>${R(r.trim())}</h2>`), n += 2;
|
|
1999
2001
|
continue;
|
|
2000
2002
|
}
|
|
2001
2003
|
}
|
|
2002
|
-
if (
|
|
2004
|
+
if (xn.test(r)) {
|
|
2003
2005
|
t.push("<hr>"), n++;
|
|
2004
2006
|
continue;
|
|
2005
2007
|
}
|
|
2006
2008
|
let a = /^(#{1,6})\s+(.+)$/.exec(r);
|
|
2007
2009
|
if (a) {
|
|
2008
2010
|
let e = a[1].length, r = a[2].replace(/(?:^|\s)#+\s*$/, "");
|
|
2009
|
-
t.push(`<h${e}>${
|
|
2011
|
+
t.push(`<h${e}>${R(r)}</h${e}>`), n++;
|
|
2010
2012
|
continue;
|
|
2011
2013
|
}
|
|
2012
|
-
if (
|
|
2014
|
+
if (bn.test(r)) {
|
|
2013
2015
|
let r = [];
|
|
2014
|
-
for (; n < e.length &&
|
|
2015
|
-
t.push(`<blockquote>${
|
|
2016
|
+
for (; n < e.length && bn.test(e[n]);) r.push(bn.exec(e[n])[2]), n++;
|
|
2017
|
+
t.push(`<blockquote>${wn(r)}</blockquote>`);
|
|
2016
2018
|
continue;
|
|
2017
2019
|
}
|
|
2018
2020
|
if (/^[-*+] /.test(r)) {
|
|
2019
|
-
let { html: r, endIdx: i } =
|
|
2021
|
+
let { html: r, endIdx: i } = jn(e, n);
|
|
2020
2022
|
t.push(r), n = i;
|
|
2021
2023
|
continue;
|
|
2022
2024
|
}
|
|
2023
2025
|
if (/^\d+\. /.test(r)) {
|
|
2024
|
-
let { html: r, endIdx: i } =
|
|
2026
|
+
let { html: r, endIdx: i } = jn(e, n);
|
|
2025
2027
|
t.push(r), n = i;
|
|
2026
2028
|
continue;
|
|
2027
2029
|
}
|
|
@@ -2030,22 +2032,22 @@ function Tn(e) {
|
|
|
2030
2032
|
continue;
|
|
2031
2033
|
}
|
|
2032
2034
|
if (/^\|.+\|/.test(r) && n + 1 < e.length && /^\|[\s|:-]+\|/.test(e[n + 1])) {
|
|
2033
|
-
let i =
|
|
2035
|
+
let i = An(r), a = An(e[n + 1]).map((e) => e.startsWith(":") && e.endsWith(":") ? "center" : e.endsWith(":") ? "right" : e.startsWith(":") ? "left" : null);
|
|
2034
2036
|
n += 2;
|
|
2035
2037
|
let o = [];
|
|
2036
|
-
for (; n < e.length && /^\|.+\|/.test(e[n]);) o.push(
|
|
2037
|
-
let s = (e, t, n) => `<${e}${n ? ` style="text-align:${n}"` : ""}>${
|
|
2038
|
+
for (; n < e.length && /^\|.+\|/.test(e[n]);) o.push(An(e[n])), n++;
|
|
2039
|
+
let s = (e, t, n) => `<${e}${n ? ` style="text-align:${n}"` : ""}>${R(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>` : "";
|
|
2038
2040
|
t.push(`<table>${c}${l}</table>`);
|
|
2039
2041
|
continue;
|
|
2040
2042
|
}
|
|
2041
2043
|
let o = [];
|
|
2042
|
-
for (; n < e.length && e[n].trim() !== "" && !/^(#{1,6} |[-*+] |\d+\. |```)/.test(e[n]) && !
|
|
2043
|
-
o.length && t.push(`<p>${
|
|
2044
|
+
for (; n < e.length && e[n].trim() !== "" && !/^(#{1,6} |[-*+] |\d+\. |```)/.test(e[n]) && !bn.test(e[n]) && !xn.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++;
|
|
2045
|
+
o.length && t.push(`<p>${R(kn(o)).replaceAll(Sn, "<br>")}</p>`);
|
|
2044
2046
|
}
|
|
2045
2047
|
return t.join("");
|
|
2046
2048
|
}
|
|
2047
|
-
var
|
|
2048
|
-
function
|
|
2049
|
+
var Tn = /* @__PURE__ */ new Map(), En = /* @__PURE__ */ new Set();
|
|
2050
|
+
function Dn(e) {
|
|
2049
2051
|
if ((e[0] || "").trim() !== "---") return e;
|
|
2050
2052
|
let t = -1;
|
|
2051
2053
|
for (let n = 1; n < e.length; n++) {
|
|
@@ -2059,7 +2061,7 @@ function On(e) {
|
|
|
2059
2061
|
let n = t + 1;
|
|
2060
2062
|
return e[n] !== void 0 && e[n].trim() === "" && n++, e.slice(n);
|
|
2061
2063
|
}
|
|
2062
|
-
function
|
|
2064
|
+
function On(e) {
|
|
2063
2065
|
let t = /* @__PURE__ */ new Map(), n = /* @__PURE__ */ new Set(), r = [], i = !1, a = /^\[([^\]]+)\]:\s*(\S+)(?:\s+"([^"]*)")?\s*$/, o = /^\[\^([^\]]+)\]:\s*(.+)$/;
|
|
2064
2066
|
for (let s of e) {
|
|
2065
2067
|
if (/^```/.test(s)) {
|
|
@@ -2089,23 +2091,23 @@ function kn(e) {
|
|
|
2089
2091
|
footnoteIds: n
|
|
2090
2092
|
};
|
|
2091
2093
|
}
|
|
2092
|
-
function
|
|
2094
|
+
function kn(e) {
|
|
2093
2095
|
let t = "";
|
|
2094
2096
|
for (let n = 0; n < e.length; n++) {
|
|
2095
2097
|
let r = n === e.length - 1, i = e[n];
|
|
2096
2098
|
if (!r && /\\$/.test(i)) {
|
|
2097
|
-
t += i.replace(/\\$/, "") +
|
|
2099
|
+
t += i.replace(/\\$/, "") + Sn;
|
|
2098
2100
|
continue;
|
|
2099
2101
|
}
|
|
2100
2102
|
if (!r && / {2,}$/.test(i)) {
|
|
2101
|
-
t += i.replace(/ {2,}$/, "") +
|
|
2103
|
+
t += i.replace(/ {2,}$/, "") + Sn;
|
|
2102
2104
|
continue;
|
|
2103
2105
|
}
|
|
2104
2106
|
t += i + (r ? "" : " ");
|
|
2105
2107
|
}
|
|
2106
2108
|
return t;
|
|
2107
2109
|
}
|
|
2108
|
-
function
|
|
2110
|
+
function An(e) {
|
|
2109
2111
|
let t = e.replace(/^\|/, "").replace(/\|$/, ""), n = [], r = "";
|
|
2110
2112
|
for (let e = 0; e < t.length; e++) {
|
|
2111
2113
|
if (t[e] === "\\" && t[e + 1] === "|") {
|
|
@@ -2120,7 +2122,7 @@ function jn(e) {
|
|
|
2120
2122
|
}
|
|
2121
2123
|
return n.push(r), n.map((e) => e.trim());
|
|
2122
2124
|
}
|
|
2123
|
-
function
|
|
2125
|
+
function jn(e, t) {
|
|
2124
2126
|
let n = e[t].match(/^(\s*)/)[1].length, r = /^\s*\d+\. /.test(e[t]), i = [], a = null, o = !1, s = !1, c = t;
|
|
2125
2127
|
for (; c < e.length;) {
|
|
2126
2128
|
let t = e[c];
|
|
@@ -2149,7 +2151,7 @@ function Mn(e, t) {
|
|
|
2149
2151
|
continue;
|
|
2150
2152
|
}
|
|
2151
2153
|
if (/^\s*(?:[-*+]|\d+\.) /.test(t)) {
|
|
2152
|
-
let t =
|
|
2154
|
+
let t = jn(e, c);
|
|
2153
2155
|
i[i.length - 1].sub += t.html, c = t.endIdx, s = !1;
|
|
2154
2156
|
} else if (s) i[i.length - 1].paras.push(t.trim()), s = !1, c++;
|
|
2155
2157
|
else {
|
|
@@ -2162,78 +2164,78 @@ function Mn(e, t) {
|
|
|
2162
2164
|
return {
|
|
2163
2165
|
html: `${f}${i.map(({ paras: e, isCB: t, checked: n, sub: r }) => {
|
|
2164
2166
|
let i = t ? `<input type="checkbox" contenteditable="false"${n ? " checked" : ""}>` : "";
|
|
2165
|
-
return `<li>${o ? e.map((e, t) => `<p>${t === 0 ? i : ""}${
|
|
2167
|
+
return `<li>${o ? e.map((e, t) => `<p>${t === 0 ? i : ""}${R(e)}</p>`).join("") : `${i}${R(e[0])}`}${r}</li>`;
|
|
2166
2168
|
}).join("")}${p}`,
|
|
2167
2169
|
endIdx: c
|
|
2168
2170
|
};
|
|
2169
2171
|
}
|
|
2170
|
-
var
|
|
2171
|
-
function
|
|
2172
|
+
var Mn = /\\([*_`#[\]()>\\~|])/g, Nn = "\0";
|
|
2173
|
+
function Pn(e) {
|
|
2172
2174
|
let t = [];
|
|
2173
2175
|
return {
|
|
2174
|
-
text: e.replace(
|
|
2176
|
+
text: e.replace(Mn, (e, n) => (t.push(n), `${Nn}${t.length - 1}${Nn}`)),
|
|
2175
2177
|
literals: t
|
|
2176
2178
|
};
|
|
2177
2179
|
}
|
|
2178
|
-
function
|
|
2179
|
-
return e.replace(RegExp(`${
|
|
2180
|
+
function Fn(e, t) {
|
|
2181
|
+
return e.replace(RegExp(`${Nn}(\\d+)${Nn}`, "g"), (e, n) => zn(t[Number(n)]));
|
|
2180
2182
|
}
|
|
2181
|
-
function
|
|
2182
|
-
return e = e.replace(/!\[([^\]]*)\]\(([^)]+)\)/g, (e, t, n) => `<img src="${
|
|
2183
|
-
let r =
|
|
2183
|
+
function In(e) {
|
|
2184
|
+
return e = e.replace(/!\[([^\]]*)\]\(([^)]+)\)/g, (e, t, n) => `<img src="${Bn(n)}" alt="${Bn(t)}" class="an-image">`), e = e.replace(/\[([^\]]+)\]\(([^)]+)\)/g, (e, t, n) => `<a href="${Bn(n)}">${t}</a>`), e = e.replace(/\[([^\]]+)\]\[([^\]]*)\]/g, (e, t, n) => {
|
|
2185
|
+
let r = Tn.get(Vn(n || t).trim().toLowerCase());
|
|
2184
2186
|
if (!r) return e;
|
|
2185
|
-
let i = r.title ? ` title="${
|
|
2186
|
-
return `<a href="${
|
|
2187
|
+
let i = r.title ? ` title="${z(r.title)}"` : "";
|
|
2188
|
+
return `<a href="${z(r.href)}"${i}>${t}</a>`;
|
|
2187
2189
|
}), e = e.replace(/\[([^\]]+)\]/g, (e, t) => {
|
|
2188
|
-
let n =
|
|
2190
|
+
let n = Tn.get(Vn(t).trim().toLowerCase());
|
|
2189
2191
|
if (!n) return e;
|
|
2190
|
-
let r = n.title ? ` title="${
|
|
2191
|
-
return `<a href="${
|
|
2192
|
-
}), e = e.replace(/\[\^([^\]]+)\]/g, (e, t) =>
|
|
2192
|
+
let r = n.title ? ` title="${z(n.title)}"` : "";
|
|
2193
|
+
return `<a href="${z(n.href)}"${r}>${t}</a>`;
|
|
2194
|
+
}), e = e.replace(/\[\^([^\]]+)\]/g, (e, t) => En.has(Vn(t)) ? `<sup>[${t}]</sup>` : e), e;
|
|
2193
2195
|
}
|
|
2194
|
-
function
|
|
2195
|
-
return e = e.replace(/<(https?:\/\/[^\s&]+?)>/g, (e, t) => `<a href="${
|
|
2196
|
+
function Ln(e) {
|
|
2197
|
+
return e = e.replace(/<(https?:\/\/[^\s&]+?)>/g, (e, t) => `<a href="${Bn(t)}">${t}</a>`), e = e.replace(/(^|[\s(])(https?:\/\/[^\s()]+)/g, (e, t, n) => {
|
|
2196
2198
|
let r = /[.,;:!?)]+$/.exec(n), i = r ? n.slice(0, -r[0].length) : n;
|
|
2197
2199
|
if (!i) return e;
|
|
2198
2200
|
let a = r ? r[0] : "";
|
|
2199
|
-
return `${t}<a href="${
|
|
2201
|
+
return `${t}<a href="${Bn(i)}">${i}</a>${a}`;
|
|
2200
2202
|
}), e;
|
|
2201
2203
|
}
|
|
2202
|
-
function
|
|
2204
|
+
function Rn(e) {
|
|
2203
2205
|
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;
|
|
2204
2206
|
}
|
|
2205
|
-
function
|
|
2206
|
-
let { text: t, literals: n } =
|
|
2207
|
-
return r =
|
|
2207
|
+
function R(e) {
|
|
2208
|
+
let { text: t, literals: n } = Pn(e), r = zn(t);
|
|
2209
|
+
return r = In(r), r = Ln(r), r = Rn(r), Fn(r, n);
|
|
2208
2210
|
}
|
|
2209
|
-
function
|
|
2211
|
+
function zn(e) {
|
|
2210
2212
|
return String(e).replaceAll("&", "&").replaceAll("<", "<").replaceAll(">", ">");
|
|
2211
2213
|
}
|
|
2212
|
-
function
|
|
2214
|
+
function z(e) {
|
|
2213
2215
|
return String(e).replaceAll("&", "&").replaceAll("\"", """).replaceAll("'", "'").replaceAll("<", "<").replaceAll(">", ">");
|
|
2214
2216
|
}
|
|
2215
|
-
function
|
|
2217
|
+
function Bn(e) {
|
|
2216
2218
|
return String(e).replaceAll("\"", """).replaceAll("'", "'");
|
|
2217
2219
|
}
|
|
2218
|
-
function
|
|
2220
|
+
function Vn(e) {
|
|
2219
2221
|
return String(e).replaceAll("<", "<").replaceAll(">", ">").replaceAll("&", "&");
|
|
2220
2222
|
}
|
|
2221
2223
|
//#endregion
|
|
2222
2224
|
//#region src/js/core/detectLang.js
|
|
2223
|
-
function
|
|
2225
|
+
function Hn(e) {
|
|
2224
2226
|
if (!e?.trim()) return null;
|
|
2225
2227
|
let t = e.trim();
|
|
2226
2228
|
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;
|
|
2227
2229
|
}
|
|
2228
2230
|
//#endregion
|
|
2229
2231
|
//#region src/js/module/Editor.js
|
|
2230
|
-
var
|
|
2232
|
+
var Un = class {
|
|
2231
2233
|
constructor(e) {
|
|
2232
2234
|
this.context = e, this.options = e.options, this._history = null, this._disposers = [], this._snapshotTimer = null;
|
|
2233
2235
|
}
|
|
2234
2236
|
initialize() {
|
|
2235
2237
|
let e = this.context.layoutInfo.editable;
|
|
2236
|
-
return this._history = new
|
|
2238
|
+
return this._history = new ln(e, this.options.historyLimit || 100, this.options.historyMaxBytes || 10 * 1024 * 1024), this._bindEvents(e), this;
|
|
2237
2239
|
}
|
|
2238
2240
|
destroy() {
|
|
2239
2241
|
this._disposers.forEach((e) => e()), this._disposers = [], this._history = null, clearTimeout(this._snapshotTimer), this._snapshotTimer = null;
|
|
@@ -2310,32 +2312,32 @@ var Wn = class {
|
|
|
2310
2312
|
}
|
|
2311
2313
|
_onKeydown(e) {
|
|
2312
2314
|
let t = this.context.layoutInfo.editable;
|
|
2313
|
-
if (!
|
|
2314
|
-
if (
|
|
2315
|
+
if (!hn(e, t, this.options)) {
|
|
2316
|
+
if (I(e, "z") && !e.shiftKey) {
|
|
2315
2317
|
e.preventDefault(), this.undo();
|
|
2316
2318
|
return;
|
|
2317
2319
|
}
|
|
2318
|
-
if (
|
|
2320
|
+
if (I(e, "z") && e.shiftKey || I(e, "y")) {
|
|
2319
2321
|
e.preventDefault(), this.redo();
|
|
2320
2322
|
return;
|
|
2321
2323
|
}
|
|
2322
|
-
if (
|
|
2324
|
+
if (I(e, "b")) {
|
|
2323
2325
|
e.preventDefault(), this.bold();
|
|
2324
2326
|
return;
|
|
2325
2327
|
}
|
|
2326
|
-
if (
|
|
2328
|
+
if (I(e, "i")) {
|
|
2327
2329
|
e.preventDefault(), this.italic();
|
|
2328
2330
|
return;
|
|
2329
2331
|
}
|
|
2330
|
-
if (
|
|
2332
|
+
if (I(e, "u")) {
|
|
2331
2333
|
e.preventDefault(), this.underline();
|
|
2332
2334
|
return;
|
|
2333
2335
|
}
|
|
2334
|
-
if (
|
|
2336
|
+
if (I(e, "k")) {
|
|
2335
2337
|
e.preventDefault(), this.context.invoke("linkDialog.show");
|
|
2336
2338
|
return;
|
|
2337
2339
|
}
|
|
2338
|
-
if (
|
|
2340
|
+
if (I(e, "v") && e.shiftKey) {
|
|
2339
2341
|
this.context.invoke("clipboard.setForcePlain", !0);
|
|
2340
2342
|
return;
|
|
2341
2343
|
}
|
|
@@ -2343,11 +2345,11 @@ var Wn = class {
|
|
|
2343
2345
|
e.preventDefault(), this.context.invoke("shortcutsDialog.show");
|
|
2344
2346
|
return;
|
|
2345
2347
|
}
|
|
2346
|
-
if (
|
|
2348
|
+
if (I(e, "f")) {
|
|
2347
2349
|
e.preventDefault(), this.context.invoke("findReplace.show", "find");
|
|
2348
2350
|
return;
|
|
2349
2351
|
}
|
|
2350
|
-
|
|
2352
|
+
I(e, "h") && (e.preventDefault(), this.context.invoke("findReplace.show", "replace")), I(e, "`") && (e.preventDefault(), this.inlineCode());
|
|
2351
2353
|
}
|
|
2352
2354
|
}
|
|
2353
2355
|
_enforceLimit(e) {
|
|
@@ -2425,10 +2427,10 @@ var Wn = class {
|
|
|
2425
2427
|
e && (D("insertText", e), this.afterCommand());
|
|
2426
2428
|
}
|
|
2427
2429
|
setMarkdown(e) {
|
|
2428
|
-
this.setHTML(
|
|
2430
|
+
this.setHTML(Cn(e || ""));
|
|
2429
2431
|
}
|
|
2430
2432
|
getMarkdown() {
|
|
2431
|
-
return
|
|
2433
|
+
return gn(this.getHTML());
|
|
2432
2434
|
}
|
|
2433
2435
|
undo() {
|
|
2434
2436
|
this._history && (this._flushPendingSnapshot(), this._history.undo(), this.context.invoke("toolbar.refresh"), this.context.invoke("statusbar.update"), this.context.triggerEvent("change", this.getHTML()));
|
|
@@ -2514,7 +2516,7 @@ var Wn = class {
|
|
|
2514
2516
|
if (e?.rangeCount > 0) {
|
|
2515
2517
|
let t = e.getRangeAt(0).commonAncestorContainer, n = t.nodeType === 1 ? t.closest("pre") : t.parentElement?.closest("pre");
|
|
2516
2518
|
if (n && !n.dataset.language) {
|
|
2517
|
-
let e =
|
|
2519
|
+
let e = Hn(n.textContent || "");
|
|
2518
2520
|
if (e) {
|
|
2519
2521
|
this.context.invoke("codeTooltip.applyLanguage", n, e);
|
|
2520
2522
|
return;
|
|
@@ -2542,7 +2544,7 @@ var Wn = class {
|
|
|
2542
2544
|
insertLink(e, t, n = !1) {
|
|
2543
2545
|
let r = globalThis.getSelection();
|
|
2544
2546
|
if (!r || r.rangeCount === 0) return;
|
|
2545
|
-
let i =
|
|
2547
|
+
let i = N(e);
|
|
2546
2548
|
if (i) {
|
|
2547
2549
|
if (r.toString().trim().length > 0) {
|
|
2548
2550
|
if (D("createLink", i), n) {
|
|
@@ -2560,7 +2562,7 @@ var Wn = class {
|
|
|
2560
2562
|
D("unlink"), this.afterCommand();
|
|
2561
2563
|
}
|
|
2562
2564
|
insertImage(e, t = "", n = "") {
|
|
2563
|
-
let r =
|
|
2565
|
+
let r = N(e, { allowData: !0 });
|
|
2564
2566
|
if (!r) return;
|
|
2565
2567
|
let i = {
|
|
2566
2568
|
left: "float:left;margin:0 1em 1em 0",
|
|
@@ -2573,7 +2575,7 @@ var Wn = class {
|
|
|
2573
2575
|
e && (D("insertHTML", e), this.afterCommand());
|
|
2574
2576
|
}
|
|
2575
2577
|
insertTable(e, t) {
|
|
2576
|
-
|
|
2578
|
+
dn(e, t, { headerRow: this.context.options.tableHeaderRow }), this.afterCommand();
|
|
2577
2579
|
}
|
|
2578
2580
|
_getClosestAnchor() {
|
|
2579
2581
|
let e = globalThis.getSelection();
|
|
@@ -2588,44 +2590,44 @@ var Wn = class {
|
|
|
2588
2590
|
_escapeAttr(e) {
|
|
2589
2591
|
return String(e ?? "").replaceAll("&", "&").replaceAll("\"", """).replaceAll("<", "<").replaceAll(">", ">");
|
|
2590
2592
|
}
|
|
2591
|
-
},
|
|
2592
|
-
["bold",
|
|
2593
|
-
["italic",
|
|
2594
|
-
["underline",
|
|
2595
|
-
["strikethrough",
|
|
2596
|
-
["superscript",
|
|
2597
|
-
["subscript",
|
|
2598
|
-
["align-left",
|
|
2599
|
-
["align-center",
|
|
2600
|
-
["align-right",
|
|
2601
|
-
["align-justify",
|
|
2602
|
-
["list-ul",
|
|
2603
|
-
["list-ol",
|
|
2604
|
-
["indent",
|
|
2605
|
-
["outdent",
|
|
2606
|
-
["undo",
|
|
2607
|
-
["redo",
|
|
2608
|
-
["minus",
|
|
2609
|
-
["link",
|
|
2610
|
-
["image",
|
|
2611
|
-
["video",
|
|
2612
|
-
["table",
|
|
2613
|
-
["emoji",
|
|
2614
|
-
["icon",
|
|
2615
|
-
["code",
|
|
2616
|
-
["expand",
|
|
2617
|
-
["foreColor",
|
|
2618
|
-
["backColor",
|
|
2619
|
-
["keyboard",
|
|
2620
|
-
["caption",
|
|
2621
|
-
["remove-format",
|
|
2622
|
-
["direction",
|
|
2623
|
-
["search",
|
|
2624
|
-
["find-replace",
|
|
2625
|
-
["inline-code",
|
|
2626
|
-
["checklist",
|
|
2627
|
-
["print",
|
|
2628
|
-
]),
|
|
2593
|
+
}, Wn = (e) => typeof e == "string" ? et(e) : e, Gn = null, Kn = "stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"", B = (e) => `<svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="none" ${Kn} style="display:block">${e}</svg>`, V = /* @__PURE__ */ new Map([
|
|
2594
|
+
["bold", B("<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\"/>")],
|
|
2595
|
+
["italic", B("<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\"/>")],
|
|
2596
|
+
["underline", B("<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\"/>")],
|
|
2597
|
+
["strikethrough", B("<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\"/>")],
|
|
2598
|
+
["superscript", B("<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\"/>")],
|
|
2599
|
+
["subscript", B("<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\"/>")],
|
|
2600
|
+
["align-left", B("<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\"/>")],
|
|
2601
|
+
["align-center", B("<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\"/>")],
|
|
2602
|
+
["align-right", B("<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\"/>")],
|
|
2603
|
+
["align-justify", B("<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\"/>")],
|
|
2604
|
+
["list-ul", B("<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\"/>")],
|
|
2605
|
+
["list-ol", B("<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\"/>")],
|
|
2606
|
+
["indent", B("<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\"/>")],
|
|
2607
|
+
["outdent", B("<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\"/>")],
|
|
2608
|
+
["undo", B("<path d=\"M3 7v6h6\"/><path d=\"M21 17a9 9 0 0 0-9-9 9 9 0 0 0-6 2.3L3 13\"/>")],
|
|
2609
|
+
["redo", B("<path d=\"M21 7v6h-6\"/><path d=\"M3 17a9 9 0 0 1 9-9 9 9 0 0 1 6 2.3L21 13\"/>")],
|
|
2610
|
+
["minus", B("<line x1=\"5\" y1=\"12\" x2=\"19\" y2=\"12\"/>")],
|
|
2611
|
+
["link", B("<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\"/>")],
|
|
2612
|
+
["image", B("<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\"/>")],
|
|
2613
|
+
["video", B("<polygon points=\"23 7 16 12 23 17 23 7\"/><rect x=\"1\" y=\"5\" width=\"15\" height=\"14\" rx=\"2\"/>")],
|
|
2614
|
+
["table", B("<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\"/>")],
|
|
2615
|
+
["emoji", B("<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\"/>")],
|
|
2616
|
+
["icon", B("<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\"/>")],
|
|
2617
|
+
["code", B("<polyline points=\"16 18 22 12 16 6\"/><polyline points=\"8 6 2 12 8 18\"/>")],
|
|
2618
|
+
["expand", B("<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\"/>")],
|
|
2619
|
+
["foreColor", B("<path d=\"M4 20L12 4L20 20\"/><line x1=\"7.5\" y1=\"14\" x2=\"16.5\" y2=\"14\"/>")],
|
|
2620
|
+
["backColor", B("<path d=\"M3 21v-4l9-9 4 4-9 9z\"/><path d=\"M12 8l4 4\"/>")],
|
|
2621
|
+
["keyboard", B("<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\"/>")],
|
|
2622
|
+
["caption", B("<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\"/>")],
|
|
2623
|
+
["remove-format", B("<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\"/>")],
|
|
2624
|
+
["direction", B("<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\"/>")],
|
|
2625
|
+
["search", B("<circle cx=\"11\" cy=\"11\" r=\"7\"/><line x1=\"21\" y1=\"21\" x2=\"16.65\" y2=\"16.65\"/>")],
|
|
2626
|
+
["find-replace", B("<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\"/>")],
|
|
2627
|
+
["inline-code", B("<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\"/>")],
|
|
2628
|
+
["checklist", B("<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\"/>")],
|
|
2629
|
+
["print", B("<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\"/>")]
|
|
2630
|
+
]), qn = /* @__PURE__ */ new Map([
|
|
2629
2631
|
["bold", "fa-bold"],
|
|
2630
2632
|
["italic", "fa-italic"],
|
|
2631
2633
|
["underline", "fa-underline"],
|
|
@@ -2659,7 +2661,7 @@ var Wn = class {
|
|
|
2659
2661
|
["inline-code", "fa-code"],
|
|
2660
2662
|
["checklist", "fa-list-check"],
|
|
2661
2663
|
["print", "fa-print"]
|
|
2662
|
-
]),
|
|
2664
|
+
]), Jn = class {
|
|
2663
2665
|
constructor(e) {
|
|
2664
2666
|
this.context = e, this.options = e.options, this.el = null, this._disposers = [], this._colorPickerClosers = [], this._refreshRaf = null;
|
|
2665
2667
|
}
|
|
@@ -2669,7 +2671,7 @@ var Wn = class {
|
|
|
2669
2671
|
role: "toolbar",
|
|
2670
2672
|
"aria-orientation": "horizontal",
|
|
2671
2673
|
"aria-label": "Editor toolbar"
|
|
2672
|
-
}), this._faReady = this._detectFontAwesome(), this._buildButtons(), this._initRovingFocus(), this._btnMap = new Map((this.options.toolbar || []).flat().map(
|
|
2674
|
+
}), this._faReady = this._detectFontAwesome(), this._buildButtons(), this._initRovingFocus(), this._btnMap = new Map((this.options.toolbar || []).flat().map(Wn).filter(Boolean).map((e) => [e.name, e])), this;
|
|
2673
2675
|
}
|
|
2674
2676
|
destroy() {
|
|
2675
2677
|
this._refreshRaf && cancelAnimationFrame(this._refreshRaf), this._refreshRaf = null, this._disposers.forEach((e) => e()), this._disposers = [], this.el?.parentNode && this.el.remove(), this.el = null;
|
|
@@ -2679,7 +2681,7 @@ var Wn = class {
|
|
|
2679
2681
|
e.forEach((e) => {
|
|
2680
2682
|
let n = w("div", { class: "an-btn-group" });
|
|
2681
2683
|
e.forEach((e) => {
|
|
2682
|
-
let t =
|
|
2684
|
+
let t = Wn(e);
|
|
2683
2685
|
if (!t) {
|
|
2684
2686
|
console.warn(`[AutumnNote] Toolbar: button "${e}" not found in registry. Skipped.`);
|
|
2685
2687
|
return;
|
|
@@ -2898,9 +2900,9 @@ var Wn = class {
|
|
|
2898
2900
|
...typeof e.isActive == "function" ? { "aria-pressed": "false" } : {}
|
|
2899
2901
|
}), n = this.options.fontAwesomeClass || "fas";
|
|
2900
2902
|
if (this._faReady) {
|
|
2901
|
-
let r =
|
|
2902
|
-
r ? t.innerHTML = `<i class="${n} ${r}" aria-hidden="true"></i>` :
|
|
2903
|
-
} else
|
|
2903
|
+
let r = qn.get(e.icon) || qn.get(e.name) || null;
|
|
2904
|
+
r ? t.innerHTML = `<i class="${n} ${r}" aria-hidden="true"></i>` : V.has(e.icon) ? t.innerHTML = V.get(e.icon) : t.textContent = e.icon || e.name;
|
|
2905
|
+
} else V.has(e.icon) ? t.innerHTML = V.get(e.icon) : V.has(e.name) ? t.innerHTML = V.get(e.name) : t.textContent = e.icon || e.name;
|
|
2904
2906
|
let r = E(t, "click", (t) => {
|
|
2905
2907
|
t.preventDefault(), this.context.invoke("editor.focus"), e.action(this.context), this.context.invoke("editor.afterCommand"), this.refresh();
|
|
2906
2908
|
});
|
|
@@ -2944,10 +2946,10 @@ var Wn = class {
|
|
|
2944
2946
|
}
|
|
2945
2947
|
_detectFontAwesome() {
|
|
2946
2948
|
if (!this.options.useFontAwesome) return !1;
|
|
2947
|
-
if (
|
|
2948
|
-
if (document.querySelector(".fa, .fas, .far, .fal, .fab, .fa-solid")) return
|
|
2949
|
+
if (Gn !== null) return Gn;
|
|
2950
|
+
if (document.querySelector(".fa, .fas, .far, .fal, .fab, .fa-solid")) return Gn = !0, !0;
|
|
2949
2951
|
let e = Array.from(document.querySelectorAll("link[rel=\"stylesheet\"]")).filter((e) => e.id !== "an-fontawesome-css").map((e) => e.href || "").join(" ");
|
|
2950
|
-
return
|
|
2952
|
+
return Gn = /fontawesome|font-awesome|use\.fontawesome|all\.css/.test(e), Gn;
|
|
2951
2953
|
}
|
|
2952
2954
|
refresh() {
|
|
2953
2955
|
this._refreshRaf && cancelAnimationFrame(this._refreshRaf), this._refreshRaf = requestAnimationFrame(() => {
|
|
@@ -2980,27 +2982,27 @@ var Wn = class {
|
|
|
2980
2982
|
this.el && (this.el.style.display = "none");
|
|
2981
2983
|
}
|
|
2982
2984
|
rebuild() {
|
|
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(
|
|
2985
|
+
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(Wn).filter(Boolean).map((e) => [e.name, e])), this.refresh();
|
|
2984
2986
|
}
|
|
2985
|
-
},
|
|
2986
|
-
function
|
|
2987
|
+
}, Yn = typeof Intl < "u" && typeof Intl.Segmenter == "function" ? new Intl.Segmenter(void 0, { granularity: "word" }) : null;
|
|
2988
|
+
function Xn(e) {
|
|
2987
2989
|
let t = e.trim();
|
|
2988
2990
|
if (!t) return 0;
|
|
2989
|
-
if (
|
|
2991
|
+
if (Yn) {
|
|
2990
2992
|
let e = 0;
|
|
2991
|
-
for (let n of
|
|
2993
|
+
for (let n of Yn.segment(t)) n.isWordLike && e++;
|
|
2992
2994
|
return e;
|
|
2993
2995
|
}
|
|
2994
2996
|
return t.split(/\s+/).length;
|
|
2995
2997
|
}
|
|
2996
|
-
function
|
|
2998
|
+
function Zn(e, t, n) {
|
|
2997
2999
|
if (!n) {
|
|
2998
3000
|
e.classList.remove("an-count-warn", "an-count-exceeded");
|
|
2999
3001
|
return;
|
|
3000
3002
|
}
|
|
3001
3003
|
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");
|
|
3002
3004
|
}
|
|
3003
|
-
var
|
|
3005
|
+
var Qn = class {
|
|
3004
3006
|
constructor(e) {
|
|
3005
3007
|
this.context = e, this.options = e.options, this.el = null, this._disposers = [], this._wordCountEl = null, this._charCountEl = null;
|
|
3006
3008
|
}
|
|
@@ -3053,17 +3055,17 @@ var $n = class {
|
|
|
3053
3055
|
}
|
|
3054
3056
|
update() {
|
|
3055
3057
|
if (!this._wordCountEl || !this._charCountEl) return;
|
|
3056
|
-
let e = this.context.layoutInfo.editable.textContent || "", t =
|
|
3057
|
-
this._wordCountEl.textContent = r ? a.wordsLimit(t, r) : a.words(t), this._charCountEl.textContent = i ? a.charsLimit(n, i) : a.chars(n),
|
|
3058
|
+
let e = this.context.layoutInfo.editable.textContent || "", t = Xn(e), n = e.replaceAll("\n", "").length, r = this.options.maxWords || 0, i = this.options.maxChars || 0, a = this.context.locale.statusbar;
|
|
3059
|
+
this._wordCountEl.textContent = r ? a.wordsLimit(t, r) : a.words(t), this._charCountEl.textContent = i ? a.charsLimit(n, i) : a.chars(n), Zn(this._wordCountEl, t, r), Zn(this._charCountEl, n, i);
|
|
3058
3060
|
}
|
|
3059
3061
|
getWordCount() {
|
|
3060
3062
|
let e = this.context.layoutInfo.editable;
|
|
3061
|
-
return
|
|
3063
|
+
return Xn(e.innerText || "");
|
|
3062
3064
|
}
|
|
3063
3065
|
getCharCount() {
|
|
3064
3066
|
return (this.context.layoutInfo.editable.innerText || "").replaceAll("\n", "").length;
|
|
3065
3067
|
}
|
|
3066
|
-
},
|
|
3068
|
+
}, $n = class {
|
|
3067
3069
|
constructor(e) {
|
|
3068
3070
|
this.context = e, this.options = e.options, this._disposers = [];
|
|
3069
3071
|
}
|
|
@@ -3180,8 +3182,8 @@ var $n = class {
|
|
|
3180
3182
|
}
|
|
3181
3183
|
if (this.options.markdownPaste !== !1) {
|
|
3182
3184
|
let n = t.types.includes("text/html"), r = n ? t.getData("text/html") : "", i = !n || this._isTriviallyPlainHtml(r), a = t.getData("text/plain");
|
|
3183
|
-
if (a && i &&
|
|
3184
|
-
e.preventDefault(), D("insertHTML", M(
|
|
3185
|
+
if (a && i && yn(a)) {
|
|
3186
|
+
e.preventDefault(), D("insertHTML", M(Cn(a))), this.context.invoke("editor.afterCommand");
|
|
3185
3187
|
return;
|
|
3186
3188
|
}
|
|
3187
3189
|
}
|
|
@@ -3220,7 +3222,7 @@ var $n = class {
|
|
|
3220
3222
|
}
|
|
3221
3223
|
let n = new FileReader();
|
|
3222
3224
|
n.onload = (e) => {
|
|
3223
|
-
D("insertHTML", M(
|
|
3225
|
+
D("insertHTML", M(Cn(e.target.result || ""))), this.context.invoke("editor.afterCommand");
|
|
3224
3226
|
}, n.onerror = () => {
|
|
3225
3227
|
let t = `Failed to read dropped markdown file "${e.name}".`;
|
|
3226
3228
|
console.warn(`[AutumnNote] ${t}`), this.context.triggerEvent("pasteError", { message: t });
|
|
@@ -3322,7 +3324,7 @@ var $n = class {
|
|
|
3322
3324
|
_escapeHTML(e) {
|
|
3323
3325
|
return e.replaceAll("&", "&").replaceAll("<", "<").replaceAll(">", ">").replaceAll("\"", """).replaceAll("'", "'");
|
|
3324
3326
|
}
|
|
3325
|
-
},
|
|
3327
|
+
}, er = class {
|
|
3326
3328
|
constructor(e) {
|
|
3327
3329
|
this.context = e, this.options = e.options, this._disposers = [];
|
|
3328
3330
|
}
|
|
@@ -3339,7 +3341,7 @@ var $n = class {
|
|
|
3339
3341
|
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");
|
|
3340
3342
|
e.classList.toggle("an-placeholder", n && !t);
|
|
3341
3343
|
}
|
|
3342
|
-
},
|
|
3344
|
+
}, tr = class {
|
|
3343
3345
|
constructor(e) {
|
|
3344
3346
|
this.context = e, this.options = e.options, this._active = !1, this._textarea = null, this._disposers = [];
|
|
3345
3347
|
}
|
|
@@ -3384,13 +3386,13 @@ var $n = class {
|
|
|
3384
3386
|
return /^<[^/!][^>]*[^/]>/.test(r) && !t.test(r) && !/^<(br|hr|img|input|link|meta)/.test(r) && n++, i;
|
|
3385
3387
|
}).filter(Boolean).join("\n");
|
|
3386
3388
|
}
|
|
3387
|
-
},
|
|
3389
|
+
}, nr = class {
|
|
3388
3390
|
constructor(e) {
|
|
3389
3391
|
this.context = e, this._active = !1, this._disposers = [], this._prevHeight = "";
|
|
3390
3392
|
}
|
|
3391
3393
|
initialize() {
|
|
3392
3394
|
let e = E(document, "keydown", (e) => {
|
|
3393
|
-
this._active &&
|
|
3395
|
+
this._active && F(e, P.ESCAPE) && this.deactivate();
|
|
3394
3396
|
});
|
|
3395
3397
|
return this._disposers.push(e), this;
|
|
3396
3398
|
}
|
|
@@ -3413,7 +3415,7 @@ var $n = class {
|
|
|
3413
3415
|
let e = this.context.layoutInfo.container;
|
|
3414
3416
|
e.classList.remove("an-fullscreen"), e.style.height = this._prevHeight, document.body.style.overflow = "", this._active = !1, this.context.invoke("toolbar.refresh");
|
|
3415
3417
|
}
|
|
3416
|
-
},
|
|
3418
|
+
}, H = class {
|
|
3417
3419
|
constructor(e) {
|
|
3418
3420
|
this.context = e, this.options = e.options, this._dialog = null, this._disposers = [], this._savedRange = null, this._firstInput = null, this._removeTrap = null;
|
|
3419
3421
|
}
|
|
@@ -3469,12 +3471,12 @@ var $n = class {
|
|
|
3469
3471
|
let o = E(i, "click", n), s = E(a, "click", () => this._close());
|
|
3470
3472
|
return this._disposers.push(o, s), r;
|
|
3471
3473
|
}
|
|
3472
|
-
},
|
|
3474
|
+
}, rr = "<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>", ir = class extends H {
|
|
3473
3475
|
show() {
|
|
3474
3476
|
this._saveRange(), this._prefill(), this._open();
|
|
3475
3477
|
}
|
|
3476
3478
|
_buildDialog() {
|
|
3477
|
-
let e = this.context.locale.linkDialog, { overlay: t, box: n } = this._buildDialogShell(e.ariaLabel,
|
|
3479
|
+
let e = this.context.locale.linkDialog, { overlay: t, box: n } = this._buildDialogShell(e.ariaLabel, rr, e.title), r = w("label", { class: "an-label" });
|
|
3478
3480
|
r.textContent = e.url;
|
|
3479
3481
|
let i = w("input", {
|
|
3480
3482
|
type: "url",
|
|
@@ -3544,12 +3546,12 @@ var $n = class {
|
|
|
3544
3546
|
}
|
|
3545
3547
|
this._savedRange && this._savedRange.select(), this.context.invoke("editor.insertLink", e, t, n), this._close();
|
|
3546
3548
|
}
|
|
3547
|
-
},
|
|
3549
|
+
}, ar = "<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>", or = class extends H {
|
|
3548
3550
|
show({ beforeInsert: e } = {}) {
|
|
3549
3551
|
this._beforeInsert = typeof e == "function" ? e : null, this._saveRange(), this._urlInput.value = "", this._altInput.value = "", this._fileInput && (this._fileInput.value = ""), this._open();
|
|
3550
3552
|
}
|
|
3551
3553
|
_buildDialog() {
|
|
3552
|
-
let e = this.context.locale.imageDialog, { overlay: t, box: n } = this._buildDialogShell(e.ariaLabel,
|
|
3554
|
+
let e = this.context.locale.imageDialog, { overlay: t, box: n } = this._buildDialogShell(e.ariaLabel, ar, e.title), r = w("label", { class: "an-label" });
|
|
3553
3555
|
r.textContent = e.imageUrl;
|
|
3554
3556
|
let i = w("input", {
|
|
3555
3557
|
type: "url",
|
|
@@ -3676,12 +3678,12 @@ var $n = class {
|
|
|
3676
3678
|
_close() {
|
|
3677
3679
|
this._beforeInsert = null, super._close();
|
|
3678
3680
|
}
|
|
3679
|
-
},
|
|
3681
|
+
}, sr = "<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>", cr = class extends H {
|
|
3680
3682
|
show() {
|
|
3681
3683
|
this._saveRange(), this._urlInput.value = "", this._widthInput.value = "560", this._hintEl.textContent = "", this._open();
|
|
3682
3684
|
}
|
|
3683
3685
|
_buildDialog() {
|
|
3684
|
-
let e = this.context.locale.videoDialog, { overlay: t, box: n } = this._buildDialogShell(e.ariaLabel,
|
|
3686
|
+
let e = this.context.locale.videoDialog, { overlay: t, box: n } = this._buildDialogShell(e.ariaLabel, sr, e.title), r = w("label", { class: "an-label" });
|
|
3685
3687
|
r.textContent = e.videoUrl;
|
|
3686
3688
|
let i = w("input", {
|
|
3687
3689
|
type: "url",
|
|
@@ -3727,7 +3729,7 @@ var $n = class {
|
|
|
3727
3729
|
this._savedRange && this._savedRange.select(), this.context.invoke("editor.insertVideo", n), this._close();
|
|
3728
3730
|
}
|
|
3729
3731
|
_parseVideoUrl(e) {
|
|
3730
|
-
if (!e || !
|
|
3732
|
+
if (!e || !N(e, { media: !0 })) return null;
|
|
3731
3733
|
let t = /(?:youtube\.com\/watch\?(?:.*&)?v=|youtube\.com\/embed\/)([a-zA-Z0-9_-]{11})/.exec(e);
|
|
3732
3734
|
if (t) return {
|
|
3733
3735
|
type: "YouTube",
|
|
@@ -3759,10 +3761,10 @@ var $n = class {
|
|
|
3759
3761
|
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>`;
|
|
3760
3762
|
}
|
|
3761
3763
|
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>`;
|
|
3762
|
-
let i =
|
|
3764
|
+
let i = N(e, { media: !0 });
|
|
3763
3765
|
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;
|
|
3764
3766
|
}
|
|
3765
|
-
},
|
|
3767
|
+
}, lr = [
|
|
3766
3768
|
{
|
|
3767
3769
|
pos: "nw",
|
|
3768
3770
|
cursor: "nw-resize"
|
|
@@ -3795,7 +3797,7 @@ var $n = class {
|
|
|
3795
3797
|
pos: "w",
|
|
3796
3798
|
cursor: "w-resize"
|
|
3797
3799
|
}
|
|
3798
|
-
],
|
|
3800
|
+
], ur = class {
|
|
3799
3801
|
constructor(e) {
|
|
3800
3802
|
this.context = e, this._active = null, this._overlay = null, this._disposers = [], this._positionRaf = null, this._lastOverlayPos = null;
|
|
3801
3803
|
}
|
|
@@ -3848,7 +3850,7 @@ var $n = class {
|
|
|
3848
3850
|
}
|
|
3849
3851
|
_buildOverlay() {
|
|
3850
3852
|
let e = document.createElement("div");
|
|
3851
|
-
return e.className = this._overlayClass, e.style.display = "none",
|
|
3853
|
+
return e.className = this._overlayClass, e.style.display = "none", lr.forEach(({ pos: t }) => {
|
|
3852
3854
|
let n = document.createElement("div");
|
|
3853
3855
|
n.className = `an-resize-handle an-resize-${t}`, n.dataset.handle = t, this._disposers.push(E(n, "pointerdown", (e) => {
|
|
3854
3856
|
e.preventDefault(), e.stopPropagation(), this._startResize(e, t);
|
|
@@ -3905,7 +3907,7 @@ var $n = class {
|
|
|
3905
3907
|
};
|
|
3906
3908
|
document.addEventListener("pointermove", p), document.addEventListener("pointerup", h), document.addEventListener("pointercancel", h), this._dragDisposers = [m];
|
|
3907
3909
|
}
|
|
3908
|
-
},
|
|
3910
|
+
}, dr = class extends ur {
|
|
3909
3911
|
get _overlayClass() {
|
|
3910
3912
|
return "an-image-resizer";
|
|
3911
3913
|
}
|
|
@@ -3934,7 +3936,7 @@ var $n = class {
|
|
|
3934
3936
|
getActiveImage() {
|
|
3935
3937
|
return this._active;
|
|
3936
3938
|
}
|
|
3937
|
-
},
|
|
3939
|
+
}, fr = class extends ur {
|
|
3938
3940
|
get _overlayClass() {
|
|
3939
3941
|
return "an-video-resizer";
|
|
3940
3942
|
}
|
|
@@ -3970,12 +3972,12 @@ var $n = class {
|
|
|
3970
3972
|
getActiveWrapper() {
|
|
3971
3973
|
return this._active;
|
|
3972
3974
|
}
|
|
3973
|
-
},
|
|
3975
|
+
}, pr = {
|
|
3974
3976
|
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>",
|
|
3975
3977
|
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>",
|
|
3976
3978
|
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>",
|
|
3977
3979
|
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>"
|
|
3978
|
-
},
|
|
3980
|
+
}, mr = 120, hr = 200, gr = class {
|
|
3979
3981
|
constructor(e) {
|
|
3980
3982
|
this.context = e, this._el = null, this._activeAnchor = null, this._showTimer = null, this._hideTimer = null, this._disposers = [];
|
|
3981
3983
|
}
|
|
@@ -3999,7 +4001,7 @@ var $n = class {
|
|
|
3999
4001
|
role: "toolbar",
|
|
4000
4002
|
"aria-label": e.ariaLabel
|
|
4001
4003
|
});
|
|
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(
|
|
4004
|
+
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(pr.open, e.openLink, () => this._openLink()), this._copyBtn = this._makeBtn(pr.copy, e.copyUrl, () => this._copyLink()), this._editBtn = this._makeBtn(pr.edit, e.editLink, () => this._editLink()), this._unlinkBtn = this._makeBtn(pr.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;
|
|
4003
4005
|
}
|
|
4004
4006
|
_makeBtn(e, t, n) {
|
|
4005
4007
|
let r = w("button", {
|
|
@@ -4014,12 +4016,12 @@ var $n = class {
|
|
|
4014
4016
|
_scheduleShow(e) {
|
|
4015
4017
|
this._activeAnchor === e && this._el.style.display !== "none" || (clearTimeout(this._hideTimer), this._hideTimer = null, clearTimeout(this._showTimer), this._showTimer = setTimeout(() => {
|
|
4016
4018
|
this._activeAnchor = e, this._show(e);
|
|
4017
|
-
},
|
|
4019
|
+
}, mr));
|
|
4018
4020
|
}
|
|
4019
4021
|
_scheduleHide() {
|
|
4020
4022
|
clearTimeout(this._showTimer), this._showTimer = null, !this._hideTimer && (this._hideTimer = setTimeout(() => {
|
|
4021
4023
|
this._hide();
|
|
4022
|
-
},
|
|
4024
|
+
}, hr));
|
|
4023
4025
|
}
|
|
4024
4026
|
_show(e) {
|
|
4025
4027
|
let t = this.context.layoutInfo.container.classList.contains("an-disabled"), n = e.getAttribute("href") || "";
|
|
@@ -4068,7 +4070,7 @@ var $n = class {
|
|
|
4068
4070
|
let t = globalThis.getSelection(), n = document.createRange();
|
|
4069
4071
|
n.selectNode(e), t.removeAllRanges(), t.addRange(n), document.execCommand("unlink"), this.context.invoke("editor.afterCommand");
|
|
4070
4072
|
}
|
|
4071
|
-
},
|
|
4073
|
+
}, _r = class {
|
|
4072
4074
|
constructor(e) {
|
|
4073
4075
|
this.context = e, this.options = e.options, this._el = null, this._active = null, this._showTimer = null, this._hideTimer = null, this._disposers = [];
|
|
4074
4076
|
}
|
|
@@ -4109,7 +4111,7 @@ var $n = class {
|
|
|
4109
4111
|
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;
|
|
4110
4112
|
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`;
|
|
4111
4113
|
}
|
|
4112
|
-
},
|
|
4114
|
+
}, U = {
|
|
4113
4115
|
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>",
|
|
4114
4116
|
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>",
|
|
4115
4117
|
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>",
|
|
@@ -4120,7 +4122,7 @@ var $n = class {
|
|
|
4120
4122
|
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>",
|
|
4121
4123
|
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>",
|
|
4122
4124
|
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>"
|
|
4123
|
-
},
|
|
4125
|
+
}, vr = class extends _r {
|
|
4124
4126
|
initialize() {
|
|
4125
4127
|
this._el = this._buildTooltip(), document.body.appendChild(this._el);
|
|
4126
4128
|
let e = this.context.layoutInfo.editable;
|
|
@@ -4145,7 +4147,7 @@ var $n = class {
|
|
|
4145
4147
|
role: "toolbar",
|
|
4146
4148
|
"aria-label": e.ariaLabel
|
|
4147
4149
|
});
|
|
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(
|
|
4150
|
+
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" })), t.appendChild(this._makeBtn(U.rotateLeft, e.rotateLeft, () => this._rotate(-90))), t.appendChild(this._makeBtn(U.rotateRight, e.rotateRight, () => this._rotate(90))), t.appendChild(w("div", { class: "an-link-tooltip-sep" })), this._cropBtn = this._makeBtn(U.crop, e.cropImage, () => this._crop()), t.appendChild(this._cropBtn), t.appendChild(w("div", { class: "an-link-tooltip-sep" })), this._captionBtn = this._makeBtn(U.caption, e.addCaption, () => this._toggleCaption()), t.appendChild(this._captionBtn), t.appendChild(w("div", { class: "an-link-tooltip-sep" })), this._deleteBtn = this._makeBtn(U.deleteImg, e.deleteImage, () => this._delete(), !0), t.appendChild(this._deleteBtn), this._disposers.push(E(t, "mouseenter", () => this._clearTimers()), E(t, "mouseleave", () => this._scheduleHide())), t;
|
|
4149
4151
|
}
|
|
4150
4152
|
_setFloat(e) {
|
|
4151
4153
|
let t = this._active;
|
|
@@ -4212,7 +4214,7 @@ var $n = class {
|
|
|
4212
4214
|
let a = globalThis.getSelection();
|
|
4213
4215
|
a && (a.removeAllRanges(), a.addRange(i)), this.context.invoke("editor.afterCommand"), this.context.invoke("imageResizer.updateOverlay"), this._hide();
|
|
4214
4216
|
}
|
|
4215
|
-
},
|
|
4217
|
+
}, W = {
|
|
4216
4218
|
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>",
|
|
4217
4219
|
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>",
|
|
4218
4220
|
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>",
|
|
@@ -4220,7 +4222,7 @@ var $n = class {
|
|
|
4220
4222
|
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>",
|
|
4221
4223
|
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>",
|
|
4222
4224
|
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>"
|
|
4223
|
-
},
|
|
4225
|
+
}, yr = class extends _r {
|
|
4224
4226
|
initialize() {
|
|
4225
4227
|
this._el = this._buildTooltip(), document.body.appendChild(this._el);
|
|
4226
4228
|
let e = this.context.layoutInfo.editable;
|
|
@@ -4251,7 +4253,7 @@ var $n = class {
|
|
|
4251
4253
|
role: "toolbar",
|
|
4252
4254
|
"aria-label": e.ariaLabel
|
|
4253
4255
|
});
|
|
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(
|
|
4256
|
+
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(W.floatLeft, e.floatLeft, () => this._setFloat("left")), this._floatNoneBtn = this._makeBtn(W.floatNone, e.noFloat, () => this._setFloat("")), this._alignCenterBtn = this._makeBtn(W.alignCenter, e.alignCenter, () => this._setCenter()), this._floatRightBtn = this._makeBtn(W.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(W.originalSize, e.originalSize, () => this._resetSize()), t.appendChild(this._originalBtn), t.appendChild(w("div", { class: "an-link-tooltip-sep" })), this._previewBtn = this._makeBtn(W.preview, e.previewVideo, () => this._togglePreview()), t.appendChild(this._previewBtn), t.appendChild(w("div", { class: "an-link-tooltip-sep" })), this._deleteBtn = this._makeBtn(W.deleteVideo, e.deleteVideo, () => this._delete(), !0), t.appendChild(this._deleteBtn), this._disposers.push(E(t, "mouseenter", () => this._clearTimers()), E(t, "mouseleave", () => this._scheduleHide())), t;
|
|
4255
4257
|
}
|
|
4256
4258
|
_setFloat(e) {
|
|
4257
4259
|
let t = this._active;
|
|
@@ -4298,7 +4300,7 @@ var $n = class {
|
|
|
4298
4300
|
}
|
|
4299
4301
|
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);
|
|
4300
4302
|
}
|
|
4301
|
-
},
|
|
4303
|
+
}, G = {
|
|
4302
4304
|
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
4305
|
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
4306
|
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>",
|
|
@@ -4326,7 +4328,7 @@ var $n = class {
|
|
|
4326
4328
|
};
|
|
4327
4329
|
//#endregion
|
|
4328
4330
|
//#region src/js/module/table-grid.js
|
|
4329
|
-
function
|
|
4331
|
+
function K(e) {
|
|
4330
4332
|
let t = e.closest("tr");
|
|
4331
4333
|
if (!t) return -1;
|
|
4332
4334
|
let n = 0;
|
|
@@ -4336,7 +4338,7 @@ function xr(e) {
|
|
|
4336
4338
|
}
|
|
4337
4339
|
return -1;
|
|
4338
4340
|
}
|
|
4339
|
-
function
|
|
4341
|
+
function q(e, t) {
|
|
4340
4342
|
let n = 0;
|
|
4341
4343
|
for (let r of e.cells) {
|
|
4342
4344
|
if (n === t) return r;
|
|
@@ -4345,7 +4347,7 @@ function G(e, t) {
|
|
|
4345
4347
|
}
|
|
4346
4348
|
return null;
|
|
4347
4349
|
}
|
|
4348
|
-
function
|
|
4350
|
+
function br(e, t) {
|
|
4349
4351
|
let n = 0;
|
|
4350
4352
|
for (let r of e.cells) if (n += r.colSpan || 1, n > t) {
|
|
4351
4353
|
let e = r.nextElementSibling;
|
|
@@ -4353,7 +4355,7 @@ function Sr(e, t) {
|
|
|
4353
4355
|
}
|
|
4354
4356
|
return null;
|
|
4355
4357
|
}
|
|
4356
|
-
function
|
|
4358
|
+
function xr(e) {
|
|
4357
4359
|
let t = Array.from(e.rows), n = {}, r = /* @__PURE__ */ new WeakMap();
|
|
4358
4360
|
return t.forEach((e, t) => {
|
|
4359
4361
|
n[t] || (n[t] = {});
|
|
@@ -4380,7 +4382,7 @@ function Cr(e) {
|
|
|
4380
4382
|
}
|
|
4381
4383
|
//#endregion
|
|
4382
4384
|
//#region src/js/module/TableTooltip.js
|
|
4383
|
-
var
|
|
4385
|
+
var Sr = 120, Cr = 200, wr = [
|
|
4384
4386
|
"#000000",
|
|
4385
4387
|
"#434343",
|
|
4386
4388
|
"#666666",
|
|
@@ -4405,7 +4407,7 @@ var wr = 120, Tr = 200, Er = [
|
|
|
4405
4407
|
"#c9daf8",
|
|
4406
4408
|
"#d9d2e9",
|
|
4407
4409
|
"#ead1dc"
|
|
4408
|
-
],
|
|
4410
|
+
], Tr = class {
|
|
4409
4411
|
constructor(e) {
|
|
4410
4412
|
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;
|
|
4411
4413
|
}
|
|
@@ -4463,7 +4465,7 @@ var wr = 120, Tr = 200, Er = [
|
|
|
4463
4465
|
});
|
|
4464
4466
|
}), E(e, "mousedown", (e) => {
|
|
4465
4467
|
if (!this.context.layoutInfo.container.classList.contains("an-disabled") && !(!t || !n)) {
|
|
4466
|
-
if (r = !0, i = n, a = e.clientX, o = e.clientY, f = t.closest("table"), i === "col") l =
|
|
4468
|
+
if (r = !0, i = n, a = e.clientX, o = e.clientY, f = t.closest("table"), i === "col") l = K(t) + (t.colSpan || 1) - 1, u = l >= 0 ? Array.from(f.querySelectorAll("tr")).map((e) => q(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";
|
|
4467
4469
|
else {
|
|
4468
4470
|
let e = t.closest("tr"), n = (e ? Array.from(f.rows).indexOf(e) : 0) + (t.rowSpan || 1) - 1;
|
|
4469
4471
|
d = f.rows[n] || e, c = d ? d.offsetHeight : 40, document.body.style.cursor = "row-resize";
|
|
@@ -4495,27 +4497,27 @@ var wr = 120, Tr = 200, Er = [
|
|
|
4495
4497
|
role: "toolbar",
|
|
4496
4498
|
"aria-label": e.ariaLabel
|
|
4497
4499
|
});
|
|
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(
|
|
4500
|
+
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(G.selectCells, e.selectCells, () => this._toggleSelectMode()), t.appendChild(this._selectBtn), t.appendChild(this._sep()), t.appendChild(this._makeBtn(G.rowAbove, e.addRowAbove, () => this._addRow("above"))), t.appendChild(this._makeBtn(G.rowBelow, e.addRowBelow, () => this._addRow("below"))), t.appendChild(this._makeBtn(G.deleteRow, e.deleteRow, () => this._deleteRow())), t.appendChild(this._sep()), t.appendChild(this._makeBtn(G.colLeft, e.addColumnLeft, () => this._addColumn("left"))), t.appendChild(this._makeBtn(G.colRight, e.addColumnRight, () => this._addColumn("right"))), t.appendChild(this._makeBtn(G.deleteCol, e.deleteColumn, () => this._deleteColumn())), t.appendChild(this._makeBtn(G.sortAsc, e.sortAsc, () => this._sortColumn("asc"))), t.appendChild(this._makeBtn(G.sortDesc, e.sortDesc, () => this._sortColumn("desc"))), t.appendChild(this._sep()), t.appendChild(this._makeBtn(G.mergeCells, e.mergeCells, () => this._mergeCells())), t.appendChild(this._makeBtn(G.unmergeCells, e.unmergeCells, () => this._unmergeCells())), t.appendChild(this._sep()), t.appendChild(this._makeBtn(G.alignLeft, e.cellAlignLeft, () => this._applyCellAlign("left"))), t.appendChild(this._makeBtn(G.alignCenter, e.cellAlignCenter, () => this._applyCellAlign("center"))), t.appendChild(this._makeBtn(G.alignRight, e.cellAlignRight, () => this._applyCellAlign("right"))), t.appendChild(this._makeBtn(G.alignJustify, e.cellAlignJustify, () => this._applyCellAlign("justify"))), t.appendChild(this._makeBtn(G.headerRow, e.toggleHeaderRow, () => this._toggleHeaderRow())), t.appendChild(this._sep());
|
|
4499
4501
|
let n = w("button", {
|
|
4500
4502
|
type: "button",
|
|
4501
4503
|
class: "an-link-tooltip-btn an-link-tooltip-btn--shade",
|
|
4502
4504
|
title: e.cellBackground
|
|
4503
4505
|
}), r = w("span", { class: "an-bubble-btn-svg" });
|
|
4504
|
-
r.innerHTML =
|
|
4506
|
+
r.innerHTML = G.cellShade;
|
|
4505
4507
|
let i = w("span", { class: "an-link-tooltip-color-strip" });
|
|
4506
4508
|
n.appendChild(r), n.appendChild(i), this._shadeColorStrip = i, this._disposers.push(E(n, "click", (e) => {
|
|
4507
4509
|
e.preventDefault(), e.stopPropagation(), this._openCellShadePopover();
|
|
4508
|
-
})), t.appendChild(n), t.appendChild(this._sep()), t.appendChild(this._makeBtn(
|
|
4510
|
+
})), t.appendChild(n), t.appendChild(this._sep()), t.appendChild(this._makeBtn(G.colWidth, e.columnWidth, () => this._openSizePopover("col"))), t.appendChild(this._makeBtn(G.rowHeight, e.rowHeight, () => this._openSizePopover("row"))), t.appendChild(this._makeBtn(G.tableBorder, e.tableBorderWidth, () => this._openSizePopover("border"))), t.appendChild(this._makeBtn(G.cellPadding, e.cellPadding, () => this._openSizePopover("cellPadding")));
|
|
4509
4511
|
let a = w("button", {
|
|
4510
4512
|
type: "button",
|
|
4511
4513
|
class: "an-link-tooltip-btn an-link-tooltip-btn--shade",
|
|
4512
4514
|
title: e.tableBorderColor
|
|
4513
4515
|
}), o = w("span", { class: "an-bubble-btn-svg" });
|
|
4514
|
-
o.innerHTML =
|
|
4516
|
+
o.innerHTML = G.borderColor;
|
|
4515
4517
|
let s = w("span", { class: "an-link-tooltip-color-strip" });
|
|
4516
4518
|
return a.appendChild(o), a.appendChild(s), this._borderColorStrip = s, this._disposers.push(E(a, "click", (e) => {
|
|
4517
4519
|
e.preventDefault(), e.stopPropagation(), this._openBorderColorPopover();
|
|
4518
|
-
})), t.appendChild(a), t.appendChild(this._sep()), t.appendChild(this._makeBtn(
|
|
4520
|
+
})), t.appendChild(a), t.appendChild(this._sep()), t.appendChild(this._makeBtn(G.deleteTable, e.deleteTable, () => this._deleteTable(), !0)), t.appendChild(this._sep()), t.appendChild(this._makeBtn(G.exportCSV, e.exportCSV, () => this._exportTableCSV())), this._disposers.push(E(t, "mouseenter", () => this._clearTimers()), E(t, "mouseleave", () => {
|
|
4519
4521
|
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();
|
|
4520
4522
|
})), t;
|
|
4521
4523
|
}
|
|
@@ -4535,10 +4537,10 @@ var wr = 120, Tr = 200, Er = [
|
|
|
4535
4537
|
_scheduleShow(e) {
|
|
4536
4538
|
this._activeTable === e && this._el.style.display !== "none" || (clearTimeout(this._hideTimer), this._hideTimer = null, clearTimeout(this._showTimer), this._showTimer = setTimeout(() => {
|
|
4537
4539
|
this._activeTable = e, this._show();
|
|
4538
|
-
},
|
|
4540
|
+
}, Sr));
|
|
4539
4541
|
}
|
|
4540
4542
|
_scheduleHide() {
|
|
4541
|
-
clearTimeout(this._showTimer), this._showTimer = null, !this._hideTimer && (this._hideTimer = setTimeout(() => this._hide(),
|
|
4543
|
+
clearTimeout(this._showTimer), this._showTimer = null, !this._hideTimer && (this._hideTimer = setTimeout(() => this._hide(), Cr));
|
|
4542
4544
|
}
|
|
4543
4545
|
_show() {
|
|
4544
4546
|
this._activeTable && (this._el.style.display = "flex", this._syncShadeStrip(), this._syncBorderColorStrip(), requestAnimationFrame(() => {
|
|
@@ -4587,7 +4589,7 @@ var wr = 120, Tr = 200, Er = [
|
|
|
4587
4589
|
if (!t || e === t) return [e];
|
|
4588
4590
|
let n = e.closest("table");
|
|
4589
4591
|
if (!n?.contains(t)) return [e];
|
|
4590
|
-
let { gridMap: r, cellPos: i } =
|
|
4592
|
+
let { gridMap: r, cellPos: i } = xr(n), a = i.get(e), o = i.get(t);
|
|
4591
4593
|
if (!a || !o) return [e];
|
|
4592
4594
|
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;
|
|
4593
4595
|
for (; d;) {
|
|
@@ -4635,7 +4637,7 @@ var wr = 120, Tr = 200, Er = [
|
|
|
4635
4637
|
if (!t.length) return;
|
|
4636
4638
|
let n = t[0].closest("table");
|
|
4637
4639
|
if (!n) return;
|
|
4638
|
-
let r = t.map((e) =>
|
|
4640
|
+
let r = t.map((e) => K(e)), i = e === "left" ? Math.min(...r) : Math.max(...r), a = Array.from(n.querySelectorAll("tr")), o = a.map((t) => e === "left" ? q(t, i) : br(t, i)), s = a.map((e) => e.closest("thead") !== null);
|
|
4639
4641
|
a.forEach((e, t) => {
|
|
4640
4642
|
e.insertBefore(w(s[t] ? "th" : "td", {}, ["\xA0"]), o[t]);
|
|
4641
4643
|
}), requestAnimationFrame(() => this._positionNear(this._activeTable)), this.context.invoke("editor.afterCommand");
|
|
@@ -4655,12 +4657,12 @@ var wr = 120, Tr = 200, Er = [
|
|
|
4655
4657
|
if (!t) return;
|
|
4656
4658
|
let n = Array.from(t.querySelectorAll("tr"));
|
|
4657
4659
|
if (n[0] && n[0].cells.length <= 1) return;
|
|
4658
|
-
let r = [...new Set(e.map((e) =>
|
|
4660
|
+
let r = [...new Set(e.map((e) => K(e)))];
|
|
4659
4661
|
if (r.length >= (n[0]?.cells.length ?? 1)) return;
|
|
4660
4662
|
let i = [];
|
|
4661
4663
|
r.forEach((e) => {
|
|
4662
4664
|
n.forEach((t) => {
|
|
4663
|
-
let n =
|
|
4665
|
+
let n = q(t, e);
|
|
4664
4666
|
n && i.push(n);
|
|
4665
4667
|
});
|
|
4666
4668
|
}), this._activeCell = null, this._clearSelection(), i.forEach((e) => e.remove()), requestAnimationFrame(() => this._positionNear(this._activeTable)), this.context.invoke("editor.afterCommand");
|
|
@@ -4683,7 +4685,7 @@ var wr = 120, Tr = 200, Er = [
|
|
|
4683
4685
|
}
|
|
4684
4686
|
}), n.length < 2) return;
|
|
4685
4687
|
}
|
|
4686
|
-
let { gridMap: r, cellPos: i } =
|
|
4688
|
+
let { gridMap: r, cellPos: i } = xr(t), a = Infinity, o = -Infinity, s = Infinity, c = -Infinity;
|
|
4687
4689
|
if (n.forEach((e) => {
|
|
4688
4690
|
let t = i.get(e);
|
|
4689
4691
|
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));
|
|
@@ -4722,7 +4724,7 @@ var wr = 120, Tr = 200, Er = [
|
|
|
4722
4724
|
_unmergeOne(e, t) {
|
|
4723
4725
|
let n = e.colSpan || 1, r = e.rowSpan || 1;
|
|
4724
4726
|
if (n === 1 && r === 1) return;
|
|
4725
|
-
let { cellPos: i } =
|
|
4727
|
+
let { cellPos: i } = xr(t), a = i.get(e);
|
|
4726
4728
|
if (!a) return;
|
|
4727
4729
|
let { r: o, c: s } = a, c = Array.from(t.rows), l = e.tagName.toLowerCase();
|
|
4728
4730
|
if (e.rowSpan = 1, e.colSpan = 1, e.style.verticalAlign = "", n > 1) {
|
|
@@ -4809,10 +4811,10 @@ var wr = 120, Tr = 200, Er = [
|
|
|
4809
4811
|
let i = t.closest("table");
|
|
4810
4812
|
if (i) {
|
|
4811
4813
|
if (n) {
|
|
4812
|
-
let t = [...new Set(r.map((e) =>
|
|
4814
|
+
let t = [...new Set(r.map((e) => K(e)))], n = Array.from(i.querySelectorAll("tr"));
|
|
4813
4815
|
t.forEach((t) => {
|
|
4814
4816
|
n.forEach((n) => {
|
|
4815
|
-
let r =
|
|
4817
|
+
let r = q(n, t);
|
|
4816
4818
|
r && (r.colSpan || 1) === 1 && (r.style.width = `${e}px`, r.style.minWidth = `${e}px`);
|
|
4817
4819
|
});
|
|
4818
4820
|
});
|
|
@@ -4839,7 +4841,7 @@ var wr = 120, Tr = 200, Er = [
|
|
|
4839
4841
|
let a = w("div", { class: "an-size-popover-title" });
|
|
4840
4842
|
i.appendChild(a);
|
|
4841
4843
|
let o = w("div", { class: "an-context-color-palette" });
|
|
4842
|
-
|
|
4844
|
+
wr.forEach((e) => {
|
|
4843
4845
|
let n = w("div", {
|
|
4844
4846
|
class: "an-context-color-swatch",
|
|
4845
4847
|
title: e
|
|
@@ -4959,11 +4961,11 @@ var wr = 120, Tr = 200, Er = [
|
|
|
4959
4961
|
if (!t) return;
|
|
4960
4962
|
let n = this._getCell();
|
|
4961
4963
|
if (!n) return;
|
|
4962
|
-
let r =
|
|
4964
|
+
let r = K(n);
|
|
4963
4965
|
if (r === -1) return;
|
|
4964
4966
|
let i = t.querySelector("tbody") || t, a = Array.from(i.querySelectorAll(":scope > tr"));
|
|
4965
4967
|
a.length < 2 || (a.sort((t, n) => {
|
|
4966
|
-
let i =
|
|
4968
|
+
let i = q(t, r), a = q(n, r), o = (i?.textContent || "").trim(), s = (a?.textContent || "").trim(), c = parseFloat(o), l = parseFloat(s);
|
|
4967
4969
|
return !isNaN(c) && !isNaN(l) ? e === "asc" ? c - l : l - c : e === "asc" ? o.localeCompare(s) : s.localeCompare(o);
|
|
4968
4970
|
}), a.forEach((e) => i.appendChild(e)), this._markSortIndicator(t, r, e), this.context.invoke("editor.afterCommand"));
|
|
4969
4971
|
}
|
|
@@ -4975,7 +4977,7 @@ var wr = 120, Tr = 200, Er = [
|
|
|
4975
4977
|
});
|
|
4976
4978
|
let i = r.querySelector("tr");
|
|
4977
4979
|
if (!i) return;
|
|
4978
|
-
let a =
|
|
4980
|
+
let a = q(i, t);
|
|
4979
4981
|
a && a.classList.add(n === "asc" ? "an-sort-asc" : "an-sort-desc");
|
|
4980
4982
|
}
|
|
4981
4983
|
_exportTableCSV() {
|
|
@@ -4984,13 +4986,13 @@ var wr = 120, Tr = 200, Er = [
|
|
|
4984
4986
|
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");
|
|
4985
4987
|
i.href = r, i.download = "table.csv", i.style.display = "none", document.body.appendChild(i), i.click(), i.remove(), URL.revokeObjectURL(r);
|
|
4986
4988
|
}
|
|
4987
|
-
},
|
|
4989
|
+
}, Er = 100, Dr = 180, Or = /language-(\S+)/, kr = {
|
|
4988
4990
|
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>",
|
|
4989
4991
|
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>",
|
|
4990
4992
|
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>",
|
|
4991
4993
|
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>",
|
|
4992
4994
|
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>"
|
|
4993
|
-
},
|
|
4995
|
+
}, Ar = class {
|
|
4994
4996
|
constructor(e) {
|
|
4995
4997
|
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;
|
|
4996
4998
|
}
|
|
@@ -5047,7 +5049,7 @@ var wr = 120, Tr = 200, Er = [
|
|
|
5047
5049
|
].forEach(([e, t]) => {
|
|
5048
5050
|
let n = w("option", { value: e });
|
|
5049
5051
|
n.textContent = t, this._langSelect.appendChild(n);
|
|
5050
|
-
}), this._disposers.push(E(this._langSelect, "change", () => this._onLangChange())), t.appendChild(this._langSelect), t.appendChild(this._sep()), this._copyBtn = this._makeBtn(
|
|
5052
|
+
}), this._disposers.push(E(this._langSelect, "change", () => this._onLangChange())), t.appendChild(this._langSelect), t.appendChild(this._sep()), this._copyBtn = this._makeBtn(kr.copy, e.copyCode, () => this._copyCode()), t.appendChild(this._copyBtn), t.appendChild(this._sep()), this._wrapBtn = this._makeBtn(kr.wrapOn, e.toggleWordWrap, () => this._toggleWrap()), t.appendChild(this._wrapBtn), this._lineNumbersBtn = this._makeBtn(kr.lineNumbers, e.lineNumbers, () => this._toggleLineNumbers()), t.appendChild(this._lineNumbersBtn), t.appendChild(this._sep()), t.appendChild(this._makeBtn(kr.toParagraph, e.convertToParagraph, () => this._toParagraph())), t.appendChild(this._sep()), t.appendChild(this._makeBtn(kr.deleteCode, e.deleteCodeBlock, () => this._delete(), !0)), this._disposers.push(E(t, "mouseenter", () => this._clearTimers()), E(t, "mouseleave", () => this._scheduleHide())), t;
|
|
5051
5053
|
}
|
|
5052
5054
|
_sep() {
|
|
5053
5055
|
return w("div", { class: "an-link-tooltip-sep" });
|
|
@@ -5065,10 +5067,10 @@ var wr = 120, Tr = 200, Er = [
|
|
|
5065
5067
|
_scheduleShow(e) {
|
|
5066
5068
|
this._activePre === e && this._el.style.display !== "none" || (clearTimeout(this._hideTimer), this._hideTimer = null, clearTimeout(this._showTimer), this._showTimer = setTimeout(() => {
|
|
5067
5069
|
this._activePre = e, this._syncWrapBtn(), this._syncLineNumbersBtn(), this._syncLangSelect(), this._show(e);
|
|
5068
|
-
},
|
|
5070
|
+
}, Er));
|
|
5069
5071
|
}
|
|
5070
5072
|
_scheduleHide() {
|
|
5071
|
-
clearTimeout(this._showTimer), this._showTimer = null, clearTimeout(this._hideTimer), this._hideTimer = setTimeout(() => this._hide(),
|
|
5073
|
+
clearTimeout(this._showTimer), this._showTimer = null, clearTimeout(this._hideTimer), this._hideTimer = setTimeout(() => this._hide(), Dr);
|
|
5072
5074
|
}
|
|
5073
5075
|
_show(e) {
|
|
5074
5076
|
this._el.style.display = "flex", this._positionNear(e);
|
|
@@ -5095,7 +5097,7 @@ var wr = 120, Tr = 200, Er = [
|
|
|
5095
5097
|
}
|
|
5096
5098
|
_syncLangSelect() {
|
|
5097
5099
|
if (!this._activePre || !this._langSelect) return;
|
|
5098
|
-
let e = this._activePre.querySelector("code"), t = this._activePre.dataset.language || "", n = e && (
|
|
5100
|
+
let e = this._activePre.querySelector("code"), t = this._activePre.dataset.language || "", n = e && (Or.exec(e.className) || [])[1] || "";
|
|
5099
5101
|
this._langSelect.value = t || n || "";
|
|
5100
5102
|
}
|
|
5101
5103
|
_copyCode() {
|
|
@@ -5201,21 +5203,21 @@ var wr = 120, Tr = 200, Er = [
|
|
|
5201
5203
|
let e = this._activePre;
|
|
5202
5204
|
e && (this._hide(), e.remove(), this.context.invoke("editor.afterCommand"));
|
|
5203
5205
|
}
|
|
5204
|
-
},
|
|
5205
|
-
function
|
|
5206
|
-
return
|
|
5206
|
+
}, jr = null, Mr = null;
|
|
5207
|
+
function Nr() {
|
|
5208
|
+
return jr ? Promise.resolve(jr) : (Mr ??= import("./emoji-data-BDQX5kh-.js").then((e) => (jr = {
|
|
5207
5209
|
EMOJI_CATS: e.EMOJI_CATS,
|
|
5208
5210
|
EMOJI_LIST: e.EMOJI_LIST
|
|
5209
|
-
},
|
|
5211
|
+
}, jr)), Mr);
|
|
5210
5212
|
}
|
|
5211
|
-
var
|
|
5213
|
+
var Pr = class extends H {
|
|
5212
5214
|
_activeCat = "all";
|
|
5213
5215
|
initialize() {
|
|
5214
5216
|
return this;
|
|
5215
5217
|
}
|
|
5216
5218
|
async show() {
|
|
5217
5219
|
if (this._saveRange(), !this._dialog) {
|
|
5218
|
-
let { EMOJI_CATS: e, EMOJI_LIST: t } = await
|
|
5220
|
+
let { EMOJI_CATS: e, EMOJI_LIST: t } = await Nr();
|
|
5219
5221
|
this._dialog || (this._cats = e, this._list = t, this._dialog = this._buildDialog(), document.body.appendChild(this._dialog));
|
|
5220
5222
|
}
|
|
5221
5223
|
this._activeCat = "all", this._searchInput.value = "", this._updateCatTabs(), this._filterEmojis("", "all"), this._open();
|
|
@@ -5308,270 +5310,34 @@ var Fr = class extends V {
|
|
|
5308
5310
|
let s = document.createTextNode(e);
|
|
5309
5311
|
i.insertNode(s), i.setStartAfter(s), i.collapse(!0), r && (r.removeAllRanges(), r.addRange(i)), this._close(), n.focus(), this.context.invoke("editor.afterCommand");
|
|
5310
5312
|
}
|
|
5311
|
-
}, Ir =
|
|
5312
|
-
|
|
5313
|
-
|
|
5314
|
-
|
|
5315
|
-
|
|
5316
|
-
|
|
5317
|
-
|
|
5318
|
-
|
|
5319
|
-
},
|
|
5320
|
-
{
|
|
5321
|
-
id: "navigation",
|
|
5322
|
-
label: "Navigation"
|
|
5323
|
-
},
|
|
5324
|
-
{
|
|
5325
|
-
id: "media",
|
|
5326
|
-
label: "Media"
|
|
5327
|
-
},
|
|
5328
|
-
{
|
|
5329
|
-
id: "communication",
|
|
5330
|
-
label: "Communication"
|
|
5331
|
-
},
|
|
5332
|
-
{
|
|
5333
|
-
id: "files",
|
|
5334
|
-
label: "Files"
|
|
5335
|
-
},
|
|
5336
|
-
{
|
|
5337
|
-
id: "people",
|
|
5338
|
-
label: "People"
|
|
5339
|
-
},
|
|
5340
|
-
{
|
|
5341
|
-
id: "objects",
|
|
5342
|
-
label: "Objects"
|
|
5343
|
-
}
|
|
5344
|
-
], Lr = [
|
|
5345
|
-
["house", "popular"],
|
|
5346
|
-
["star", "popular"],
|
|
5347
|
-
["heart", "popular"],
|
|
5348
|
-
["check", "popular"],
|
|
5349
|
-
["xmark", "popular"],
|
|
5350
|
-
["plus", "popular"],
|
|
5351
|
-
["minus", "popular"],
|
|
5352
|
-
["magnifying-glass", "popular"],
|
|
5353
|
-
["gear", "popular"],
|
|
5354
|
-
["bell", "popular"],
|
|
5355
|
-
["user", "popular"],
|
|
5356
|
-
["envelope", "popular"],
|
|
5357
|
-
["phone", "popular"],
|
|
5358
|
-
["calendar", "popular"],
|
|
5359
|
-
["clock", "popular"],
|
|
5360
|
-
["lock", "popular"],
|
|
5361
|
-
["eye", "popular"],
|
|
5362
|
-
["eye-slash", "popular"],
|
|
5363
|
-
["trash", "popular"],
|
|
5364
|
-
["pen", "popular"],
|
|
5365
|
-
["bookmark", "popular"],
|
|
5366
|
-
["flag", "popular"],
|
|
5367
|
-
["thumbs-up", "popular"],
|
|
5368
|
-
["thumbs-down", "popular"],
|
|
5369
|
-
["circle-info", "popular"],
|
|
5370
|
-
["triangle-exclamation", "popular"],
|
|
5371
|
-
["circle-check", "popular"],
|
|
5372
|
-
["circle-xmark", "popular"],
|
|
5373
|
-
["share", "popular"],
|
|
5374
|
-
["download", "popular"],
|
|
5375
|
-
["upload", "popular"],
|
|
5376
|
-
["tag", "popular"],
|
|
5377
|
-
["bars", "interface"],
|
|
5378
|
-
["ellipsis", "interface"],
|
|
5379
|
-
["ellipsis-vertical", "interface"],
|
|
5380
|
-
["list", "interface"],
|
|
5381
|
-
["table-cells", "interface"],
|
|
5382
|
-
["table-list", "interface"],
|
|
5383
|
-
["grip", "interface"],
|
|
5384
|
-
["filter", "interface"],
|
|
5385
|
-
["sort", "interface"],
|
|
5386
|
-
["arrows-rotate", "interface"],
|
|
5387
|
-
["rotate", "interface"],
|
|
5388
|
-
["rotate-left", "interface"],
|
|
5389
|
-
["rotate-right", "interface"],
|
|
5390
|
-
["copy", "interface"],
|
|
5391
|
-
["floppy-disk", "interface"],
|
|
5392
|
-
["print", "interface"],
|
|
5393
|
-
["link", "interface"],
|
|
5394
|
-
["code", "interface"],
|
|
5395
|
-
["expand", "interface"],
|
|
5396
|
-
["compress", "interface"],
|
|
5397
|
-
["cloud", "interface"],
|
|
5398
|
-
["lock-open", "interface"],
|
|
5399
|
-
["key", "interface"],
|
|
5400
|
-
["shield", "interface"],
|
|
5401
|
-
["shield-halved", "interface"],
|
|
5402
|
-
["sliders", "interface"],
|
|
5403
|
-
["toggle-on", "interface"],
|
|
5404
|
-
["square-check", "interface"],
|
|
5405
|
-
["circle-plus", "interface"],
|
|
5406
|
-
["circle-minus", "interface"],
|
|
5407
|
-
["arrow-right", "navigation"],
|
|
5408
|
-
["arrow-left", "navigation"],
|
|
5409
|
-
["arrow-up", "navigation"],
|
|
5410
|
-
["arrow-down", "navigation"],
|
|
5411
|
-
["chevron-right", "navigation"],
|
|
5412
|
-
["chevron-left", "navigation"],
|
|
5413
|
-
["chevron-up", "navigation"],
|
|
5414
|
-
["chevron-down", "navigation"],
|
|
5415
|
-
["angle-right", "navigation"],
|
|
5416
|
-
["angle-left", "navigation"],
|
|
5417
|
-
["angle-up", "navigation"],
|
|
5418
|
-
["angle-down", "navigation"],
|
|
5419
|
-
["angles-right", "navigation"],
|
|
5420
|
-
["angles-left", "navigation"],
|
|
5421
|
-
["location-dot", "navigation"],
|
|
5422
|
-
["compass", "navigation"],
|
|
5423
|
-
["map", "navigation"],
|
|
5424
|
-
["map-pin", "navigation"],
|
|
5425
|
-
["route", "navigation"],
|
|
5426
|
-
["circle-arrow-right", "navigation"],
|
|
5427
|
-
["circle-arrow-left", "navigation"],
|
|
5428
|
-
["arrow-trend-up", "navigation"],
|
|
5429
|
-
["arrow-trend-down", "navigation"],
|
|
5430
|
-
["right-from-bracket", "navigation"],
|
|
5431
|
-
["right-to-bracket", "navigation"],
|
|
5432
|
-
["play", "media"],
|
|
5433
|
-
["pause", "media"],
|
|
5434
|
-
["stop", "media"],
|
|
5435
|
-
["forward", "media"],
|
|
5436
|
-
["backward", "media"],
|
|
5437
|
-
["forward-step", "media"],
|
|
5438
|
-
["backward-step", "media"],
|
|
5439
|
-
["volume-high", "media"],
|
|
5440
|
-
["volume-low", "media"],
|
|
5441
|
-
["volume-xmark", "media"],
|
|
5442
|
-
["volume-off", "media"],
|
|
5443
|
-
["music", "media"],
|
|
5444
|
-
["headphones", "media"],
|
|
5445
|
-
["microphone", "media"],
|
|
5446
|
-
["microphone-slash", "media"],
|
|
5447
|
-
["film", "media"],
|
|
5448
|
-
["camera", "media"],
|
|
5449
|
-
["camera-rotate", "media"],
|
|
5450
|
-
["video", "media"],
|
|
5451
|
-
["image", "media"],
|
|
5452
|
-
["images", "media"],
|
|
5453
|
-
["photo-film", "media"],
|
|
5454
|
-
["podcast", "media"],
|
|
5455
|
-
["radio", "media"],
|
|
5456
|
-
["comment", "communication"],
|
|
5457
|
-
["comments", "communication"],
|
|
5458
|
-
["comment-dots", "communication"],
|
|
5459
|
-
["message", "communication"],
|
|
5460
|
-
["paper-plane", "communication"],
|
|
5461
|
-
["reply", "communication"],
|
|
5462
|
-
["reply-all", "communication"],
|
|
5463
|
-
["at", "communication"],
|
|
5464
|
-
["hashtag", "communication"],
|
|
5465
|
-
["wifi", "communication"],
|
|
5466
|
-
["signal", "communication"],
|
|
5467
|
-
["rss", "communication"],
|
|
5468
|
-
["share-nodes", "communication"],
|
|
5469
|
-
["inbox", "communication"],
|
|
5470
|
-
["phone-volume", "communication"],
|
|
5471
|
-
["mobile", "communication"],
|
|
5472
|
-
["mobile-screen", "communication"],
|
|
5473
|
-
["laptop", "communication"],
|
|
5474
|
-
["desktop", "communication"],
|
|
5475
|
-
["tower-broadcast", "communication"],
|
|
5476
|
-
["file", "files"],
|
|
5477
|
-
["file-lines", "files"],
|
|
5478
|
-
["folder", "files"],
|
|
5479
|
-
["folder-open", "files"],
|
|
5480
|
-
["folder-plus", "files"],
|
|
5481
|
-
["folder-minus", "files"],
|
|
5482
|
-
["file-image", "files"],
|
|
5483
|
-
["file-pdf", "files"],
|
|
5484
|
-
["file-code", "files"],
|
|
5485
|
-
["file-zipper", "files"],
|
|
5486
|
-
["file-audio", "files"],
|
|
5487
|
-
["file-video", "files"],
|
|
5488
|
-
["file-arrow-up", "files"],
|
|
5489
|
-
["file-arrow-down", "files"],
|
|
5490
|
-
["database", "files"],
|
|
5491
|
-
["box", "files"],
|
|
5492
|
-
["box-open", "files"],
|
|
5493
|
-
["hard-drive", "files"],
|
|
5494
|
-
["server", "files"],
|
|
5495
|
-
["user", "people"],
|
|
5496
|
-
["users", "people"],
|
|
5497
|
-
["user-group", "people"],
|
|
5498
|
-
["user-plus", "people"],
|
|
5499
|
-
["user-minus", "people"],
|
|
5500
|
-
["user-check", "people"],
|
|
5501
|
-
["user-xmark", "people"],
|
|
5502
|
-
["user-tie", "people"],
|
|
5503
|
-
["user-shield", "people"],
|
|
5504
|
-
["user-secret", "people"],
|
|
5505
|
-
["person", "people"],
|
|
5506
|
-
["person-running", "people"],
|
|
5507
|
-
["person-walking", "people"],
|
|
5508
|
-
["child", "people"],
|
|
5509
|
-
["handshake", "people"],
|
|
5510
|
-
["hand", "people"],
|
|
5511
|
-
["hands-holding", "people"],
|
|
5512
|
-
["people-group", "people"],
|
|
5513
|
-
["pencil", "objects"],
|
|
5514
|
-
["paintbrush", "objects"],
|
|
5515
|
-
["eraser", "objects"],
|
|
5516
|
-
["scissors", "objects"],
|
|
5517
|
-
["wrench", "objects"],
|
|
5518
|
-
["screwdriver", "objects"],
|
|
5519
|
-
["hammer", "objects"],
|
|
5520
|
-
["toolbox", "objects"],
|
|
5521
|
-
["graduation-cap", "objects"],
|
|
5522
|
-
["book", "objects"],
|
|
5523
|
-
["book-open", "objects"],
|
|
5524
|
-
["glasses", "objects"],
|
|
5525
|
-
["microscope", "objects"],
|
|
5526
|
-
["flask", "objects"],
|
|
5527
|
-
["stethoscope", "objects"],
|
|
5528
|
-
["hospital", "objects"],
|
|
5529
|
-
["building", "objects"],
|
|
5530
|
-
["city", "objects"],
|
|
5531
|
-
["car", "objects"],
|
|
5532
|
-
["truck", "objects"],
|
|
5533
|
-
["plane", "objects"],
|
|
5534
|
-
["train", "objects"],
|
|
5535
|
-
["bicycle", "objects"],
|
|
5536
|
-
["bus", "objects"],
|
|
5537
|
-
["rocket", "objects"],
|
|
5538
|
-
["briefcase", "objects"],
|
|
5539
|
-
["cart-shopping", "objects"],
|
|
5540
|
-
["bag-shopping", "objects"],
|
|
5541
|
-
["credit-card", "objects"],
|
|
5542
|
-
["money-bill", "objects"],
|
|
5543
|
-
["chart-bar", "objects"],
|
|
5544
|
-
["chart-line", "objects"],
|
|
5545
|
-
["chart-pie", "objects"],
|
|
5546
|
-
["bolt", "objects"],
|
|
5547
|
-
["sun", "objects"],
|
|
5548
|
-
["moon", "objects"],
|
|
5549
|
-
["snowflake", "objects"],
|
|
5550
|
-
["fire", "objects"],
|
|
5551
|
-
["droplet", "objects"],
|
|
5552
|
-
["leaf", "objects"],
|
|
5553
|
-
["tree", "objects"],
|
|
5554
|
-
["earth-americas", "objects"],
|
|
5555
|
-
["globe", "objects"],
|
|
5556
|
-
["award", "objects"],
|
|
5557
|
-
["trophy", "objects"],
|
|
5558
|
-
["gift", "objects"],
|
|
5559
|
-
["puzzle-piece", "objects"]
|
|
5560
|
-
], Rr = class extends V {
|
|
5313
|
+
}, Fr = "https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.2/css/all.min.css", Ir = null, Lr = null;
|
|
5314
|
+
function Rr() {
|
|
5315
|
+
return Ir ? Promise.resolve(Ir) : (Lr ??= import("./icon-data-V0Xqv-wX.js").then((e) => (Ir = {
|
|
5316
|
+
ICON_CATEGORIES: e.ICON_CATEGORIES,
|
|
5317
|
+
ICON_LIST: e.ICON_LIST
|
|
5318
|
+
}, Ir)), Lr);
|
|
5319
|
+
}
|
|
5320
|
+
var zr = class extends H {
|
|
5561
5321
|
_selectedIcon = null;
|
|
5562
5322
|
_activeCat = "all";
|
|
5563
5323
|
initialize() {
|
|
5564
|
-
return this
|
|
5324
|
+
return this;
|
|
5565
5325
|
}
|
|
5566
5326
|
_ensureFontAwesome() {
|
|
5567
|
-
if (
|
|
5568
|
-
let e =
|
|
5569
|
-
if (
|
|
5570
|
-
let t = document.
|
|
5571
|
-
|
|
5327
|
+
if (this.context.options.fontAwesomeAutoInject === !1) return;
|
|
5328
|
+
let e = this.context.options.fontAwesomeCDN || Fr;
|
|
5329
|
+
if (!e || document.getElementById("an-fontawesome-css")) return;
|
|
5330
|
+
let t = Array.from(document.querySelectorAll("link[rel=\"stylesheet\"]")).map((e) => e.href || "").join(" ");
|
|
5331
|
+
if (/fontawesome|font-awesome/.test(t) || document.querySelector(".fa-solid, .fas, .far, .fab")) return;
|
|
5332
|
+
let n = document.createElement("link");
|
|
5333
|
+
n.id = "an-fontawesome-css", n.rel = "stylesheet", n.href = e, n.crossOrigin = "anonymous", n.referrerPolicy = "no-referrer", document.head.appendChild(n);
|
|
5572
5334
|
}
|
|
5573
|
-
show() {
|
|
5574
|
-
|
|
5335
|
+
async show() {
|
|
5336
|
+
if (this._saveRange(), this._ensureFontAwesome(), !this._dialog) {
|
|
5337
|
+
let { ICON_CATEGORIES: e, ICON_LIST: t } = await Rr();
|
|
5338
|
+
this._dialog || (this._cats = e, this._list = t, this._dialog = this._buildDialog(), document.body.appendChild(this._dialog));
|
|
5339
|
+
}
|
|
5340
|
+
this._selectedIcon = null, this._activeCat = "all", this._searchInput.value = "", this._grid.querySelectorAll(".an-icon-cell.active").forEach((e) => e.classList.remove("active")), this._insertBtn.setAttribute("disabled", ""), this._updateCatTabs(), this._filterIcons("", "all"), this._updatePreview(null), this._open();
|
|
5575
5341
|
}
|
|
5576
5342
|
_buildDialog() {
|
|
5577
5343
|
let e = this.context.locale.iconDialog, t = w("div", {
|
|
@@ -5601,7 +5367,7 @@ var Fr = class extends V {
|
|
|
5601
5367
|
class: "an-icon-cat active",
|
|
5602
5368
|
"data-cat": "all"
|
|
5603
5369
|
});
|
|
5604
|
-
u.textContent = e.all, l.appendChild(u),
|
|
5370
|
+
u.textContent = e.all, l.appendChild(u), this._cats.forEach(({ id: t, label: n }) => {
|
|
5605
5371
|
let r = w("button", {
|
|
5606
5372
|
type: "button",
|
|
5607
5373
|
class: "an-icon-cat",
|
|
@@ -5610,7 +5376,7 @@ var Fr = class extends V {
|
|
|
5610
5376
|
r.textContent = e.categories?.[t] || n, l.appendChild(r);
|
|
5611
5377
|
}), this._catBar = l;
|
|
5612
5378
|
let d = w("div", { class: "an-icon-grid" });
|
|
5613
|
-
|
|
5379
|
+
this._list.forEach(([e, t]) => {
|
|
5614
5380
|
let n = w("button", {
|
|
5615
5381
|
type: "button",
|
|
5616
5382
|
class: "an-icon-cell",
|
|
@@ -5732,7 +5498,7 @@ var Fr = class extends V {
|
|
|
5732
5498
|
_close() {
|
|
5733
5499
|
this._selectedIcon = null, super._close();
|
|
5734
5500
|
}
|
|
5735
|
-
},
|
|
5501
|
+
}, J = {
|
|
5736
5502
|
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>",
|
|
5737
5503
|
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>",
|
|
5738
5504
|
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>",
|
|
@@ -5759,7 +5525,7 @@ var Fr = class extends V {
|
|
|
5759
5525
|
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>",
|
|
5760
5526
|
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>",
|
|
5761
5527
|
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>"
|
|
5762
|
-
},
|
|
5528
|
+
}, Br = [
|
|
5763
5529
|
"#000000",
|
|
5764
5530
|
"#434343",
|
|
5765
5531
|
"#666666",
|
|
@@ -5785,35 +5551,35 @@ var Fr = class extends V {
|
|
|
5785
5551
|
"#d9d2e9",
|
|
5786
5552
|
"#ead1dc"
|
|
5787
5553
|
];
|
|
5788
|
-
function
|
|
5554
|
+
function Vr(e) {
|
|
5789
5555
|
let t = e === "foreColor" ? "Text Color" : "Highlight Color", n = e === "foreColor" ? "textColor" : "highlightColor";
|
|
5790
5556
|
return () => [{
|
|
5791
5557
|
back: !0,
|
|
5792
5558
|
label: t,
|
|
5793
5559
|
localeKey: n,
|
|
5794
|
-
navigate: () =>
|
|
5560
|
+
navigate: () => Hr
|
|
5795
5561
|
}, {
|
|
5796
5562
|
colorPalette: !0,
|
|
5797
5563
|
colorType: e
|
|
5798
5564
|
}];
|
|
5799
5565
|
}
|
|
5800
|
-
var
|
|
5566
|
+
var Hr = [
|
|
5801
5567
|
{
|
|
5802
5568
|
name: "cut",
|
|
5803
5569
|
label: "Cut",
|
|
5804
|
-
icon:
|
|
5570
|
+
icon: J.cut,
|
|
5805
5571
|
action: () => document.execCommand("cut")
|
|
5806
5572
|
},
|
|
5807
5573
|
{
|
|
5808
5574
|
name: "copy",
|
|
5809
5575
|
label: "Copy",
|
|
5810
|
-
icon:
|
|
5576
|
+
icon: J.copy,
|
|
5811
5577
|
action: () => document.execCommand("copy")
|
|
5812
5578
|
},
|
|
5813
5579
|
{
|
|
5814
5580
|
name: "paste",
|
|
5815
5581
|
label: "Paste",
|
|
5816
|
-
icon:
|
|
5582
|
+
icon: J.paste,
|
|
5817
5583
|
action: (e) => {
|
|
5818
5584
|
if (!navigator.clipboard) return;
|
|
5819
5585
|
let t = e.layoutInfo?.editable;
|
|
@@ -5840,84 +5606,84 @@ var Vr = [
|
|
|
5840
5606
|
{
|
|
5841
5607
|
name: "bold",
|
|
5842
5608
|
label: "Bold",
|
|
5843
|
-
icon:
|
|
5609
|
+
icon: J.bold,
|
|
5844
5610
|
action: (e) => e.invoke("editor.bold")
|
|
5845
5611
|
},
|
|
5846
5612
|
{
|
|
5847
5613
|
name: "italic",
|
|
5848
5614
|
label: "Italic",
|
|
5849
|
-
icon:
|
|
5615
|
+
icon: J.italic,
|
|
5850
5616
|
action: (e) => e.invoke("editor.italic")
|
|
5851
5617
|
},
|
|
5852
5618
|
{
|
|
5853
5619
|
name: "underline",
|
|
5854
5620
|
label: "Underline",
|
|
5855
|
-
icon:
|
|
5621
|
+
icon: J.underline,
|
|
5856
5622
|
action: (e) => e.invoke("editor.underline")
|
|
5857
5623
|
},
|
|
5858
5624
|
{ separator: !0 },
|
|
5859
5625
|
{
|
|
5860
5626
|
name: "textColor",
|
|
5861
5627
|
label: "Text Color",
|
|
5862
|
-
icon:
|
|
5628
|
+
icon: J.textColor,
|
|
5863
5629
|
colorStrip: "foreColor",
|
|
5864
|
-
navigate:
|
|
5630
|
+
navigate: Vr("foreColor")
|
|
5865
5631
|
},
|
|
5866
5632
|
{
|
|
5867
5633
|
name: "highlightColor",
|
|
5868
5634
|
label: "Highlight Color",
|
|
5869
|
-
icon:
|
|
5635
|
+
icon: J.highlightColor,
|
|
5870
5636
|
colorStrip: "hiliteColor",
|
|
5871
|
-
navigate:
|
|
5637
|
+
navigate: Vr("hiliteColor")
|
|
5872
5638
|
},
|
|
5873
5639
|
{ separator: !0 },
|
|
5874
5640
|
{
|
|
5875
5641
|
name: "copyFormat",
|
|
5876
5642
|
label: "Copy Format",
|
|
5877
|
-
icon:
|
|
5643
|
+
icon: J.copyFormat,
|
|
5878
5644
|
action: (e) => e.invoke("contextMenu.copyFormat")
|
|
5879
5645
|
},
|
|
5880
5646
|
{
|
|
5881
5647
|
name: "pasteFormat",
|
|
5882
5648
|
label: "Paste Format",
|
|
5883
|
-
icon:
|
|
5649
|
+
icon: J.pasteFormat,
|
|
5884
5650
|
action: (e) => e.invoke("contextMenu.pasteFormat"),
|
|
5885
5651
|
disabled: (e) => !e.invoke("contextMenu.hasCopiedFormat")
|
|
5886
5652
|
},
|
|
5887
5653
|
{
|
|
5888
5654
|
name: "removeFormat",
|
|
5889
5655
|
label: "Remove Format",
|
|
5890
|
-
icon:
|
|
5656
|
+
icon: J.removeFormat,
|
|
5891
5657
|
action: (e) => e.invoke("contextMenu.removeFormat")
|
|
5892
5658
|
},
|
|
5893
5659
|
{ separator: !0 },
|
|
5894
5660
|
{
|
|
5895
5661
|
name: "link",
|
|
5896
5662
|
label: "Insert Link",
|
|
5897
|
-
icon:
|
|
5663
|
+
icon: J.link,
|
|
5898
5664
|
action: (e) => e.invoke("linkDialog.show")
|
|
5899
5665
|
},
|
|
5900
5666
|
{
|
|
5901
5667
|
name: "image",
|
|
5902
5668
|
label: "Insert Image",
|
|
5903
|
-
icon:
|
|
5669
|
+
icon: J.image,
|
|
5904
5670
|
action: (e) => e.invoke("imageDialog.show")
|
|
5905
5671
|
},
|
|
5906
5672
|
{
|
|
5907
5673
|
name: "video",
|
|
5908
5674
|
label: "Insert Video",
|
|
5909
|
-
icon:
|
|
5675
|
+
icon: J.video,
|
|
5910
5676
|
action: (e) => e.invoke("videoDialog.show")
|
|
5911
5677
|
},
|
|
5912
5678
|
{
|
|
5913
5679
|
name: "table",
|
|
5914
5680
|
label: "Insert Table",
|
|
5915
|
-
icon:
|
|
5681
|
+
icon: J.table,
|
|
5916
5682
|
tableGrid: !0
|
|
5917
5683
|
}
|
|
5918
|
-
],
|
|
5684
|
+
], Ur = class {
|
|
5919
5685
|
constructor(e) {
|
|
5920
|
-
this.context = e, this.options = e.options || {}, this._items = this.options.contextMenu?.items ||
|
|
5686
|
+
this.context = e, this.options = e.options || {}, this._items = this.options.contextMenu?.items || Hr, this.el = null, this._disposers = [], this._menuDisposers = [], this._lastX = 0, this._lastY = 0, this._copiedFormat = null, this._savedRange = null;
|
|
5921
5687
|
}
|
|
5922
5688
|
initialize() {
|
|
5923
5689
|
this.el = w("div", {
|
|
@@ -5955,7 +5721,7 @@ var Vr = [
|
|
|
5955
5721
|
class: "an-context-icon",
|
|
5956
5722
|
"aria-hidden": "true"
|
|
5957
5723
|
});
|
|
5958
|
-
n.innerHTML =
|
|
5724
|
+
n.innerHTML = J.back, t.appendChild(n);
|
|
5959
5725
|
let r = e.localeKey && this.context.locale.contextMenu[e.localeKey] || e.label || this.context.locale.contextMenu.back || "Back";
|
|
5960
5726
|
t.appendChild(w("span", { class: "an-context-label" }, [r]));
|
|
5961
5727
|
let i = E(t, "click", (t) => {
|
|
@@ -6003,7 +5769,7 @@ var Vr = [
|
|
|
6003
5769
|
}
|
|
6004
5770
|
if (e.colorPalette) {
|
|
6005
5771
|
let t = w("div", { class: "an-context-color-palette" });
|
|
6006
|
-
if (
|
|
5772
|
+
if (Br.forEach((n) => {
|
|
6007
5773
|
let r = w("div", {
|
|
6008
5774
|
class: "an-context-color-swatch",
|
|
6009
5775
|
title: n,
|
|
@@ -6022,7 +5788,7 @@ var Vr = [
|
|
|
6022
5788
|
role: "button",
|
|
6023
5789
|
"aria-label": this.context.locale.contextMenu.noHighlight || "No highlight"
|
|
6024
5790
|
});
|
|
6025
|
-
e.innerHTML =
|
|
5791
|
+
e.innerHTML = J.noColor;
|
|
6026
5792
|
let n = E(e, "click", (e) => {
|
|
6027
5793
|
e.stopPropagation(), this._applyColor("hiliteColor", "transparent");
|
|
6028
5794
|
});
|
|
@@ -6233,7 +5999,7 @@ var Vr = [
|
|
|
6233
5999
|
} catch {}
|
|
6234
6000
|
this.context.invoke("editor.afterCommand");
|
|
6235
6001
|
}
|
|
6236
|
-
},
|
|
6002
|
+
}, Wr = [
|
|
6237
6003
|
{
|
|
6238
6004
|
category: "Text Formatting",
|
|
6239
6005
|
items: [
|
|
@@ -6306,12 +6072,12 @@ var Vr = [
|
|
|
6306
6072
|
action: "Show this keyboard shortcuts dialog"
|
|
6307
6073
|
}]
|
|
6308
6074
|
}
|
|
6309
|
-
],
|
|
6075
|
+
], Gr = "<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>", Kr = class extends H {
|
|
6310
6076
|
show() {
|
|
6311
6077
|
this._open();
|
|
6312
6078
|
}
|
|
6313
6079
|
_buildDialog() {
|
|
6314
|
-
let e = this.context.locale.shortcutsDialog, { overlay: t, box: n } = this._buildDialogShell(e.ariaLabel,
|
|
6080
|
+
let e = this.context.locale.shortcutsDialog, { overlay: t, box: n } = this._buildDialogShell(e.ariaLabel, Gr, e.title);
|
|
6315
6081
|
n.classList.add("an-shortcuts-box");
|
|
6316
6082
|
let r = w("button", {
|
|
6317
6083
|
type: "button",
|
|
@@ -6319,7 +6085,7 @@ var Vr = [
|
|
|
6319
6085
|
"aria-label": e.close,
|
|
6320
6086
|
style: "margin-left:auto"
|
|
6321
6087
|
});
|
|
6322
|
-
r.textContent = "×", this._closeBtn = r, this._firstInput = r, n.querySelector(".an-dialog-header").appendChild(r), (this.context.locale.shortcutsDialog.shortcuts ||
|
|
6088
|
+
r.textContent = "×", this._closeBtn = r, this._firstInput = r, n.querySelector(".an-dialog-header").appendChild(r), (this.context.locale.shortcutsDialog.shortcuts || Wr).forEach(({ category: e, items: t }) => {
|
|
6323
6089
|
let r = w("div", { class: "an-shortcuts-cat" });
|
|
6324
6090
|
r.textContent = e, n.appendChild(r);
|
|
6325
6091
|
let i = w("div", { class: "an-shortcuts-table" });
|
|
@@ -6333,7 +6099,7 @@ var Vr = [
|
|
|
6333
6099
|
let i = E(r, "click", () => this._close());
|
|
6334
6100
|
return this._disposers.push(i), t;
|
|
6335
6101
|
}
|
|
6336
|
-
},
|
|
6102
|
+
}, qr = class extends H {
|
|
6337
6103
|
constructor(e) {
|
|
6338
6104
|
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;
|
|
6339
6105
|
}
|
|
@@ -6576,8 +6342,8 @@ var Vr = [
|
|
|
6576
6342
|
this._counterEl.textContent = e ? this.context.locale.findReplace.noResults : "";
|
|
6577
6343
|
} else this._counterEl.textContent = `${this._currentIndex + 1} / ${e}`;
|
|
6578
6344
|
}
|
|
6579
|
-
},
|
|
6580
|
-
function
|
|
6345
|
+
}, Y = 20, Jr = "#3b82f6", X = (e, t, n) => Math.min(Math.max(e, t), n);
|
|
6346
|
+
function Yr(e, t, n, r) {
|
|
6581
6347
|
return new Promise((i) => {
|
|
6582
6348
|
let a = (e) => {
|
|
6583
6349
|
let a = document.createElement("canvas");
|
|
@@ -6601,7 +6367,7 @@ function Jr(e, t, n, r) {
|
|
|
6601
6367
|
o.crossOrigin = "anonymous", o.onload = () => a(o), o.onerror = () => i(null), o.src = e.src + (e.src.includes("?") ? "&" : "?") + "_an=" + Date.now();
|
|
6602
6368
|
});
|
|
6603
6369
|
}
|
|
6604
|
-
var
|
|
6370
|
+
var Xr = class {
|
|
6605
6371
|
constructor(e) {
|
|
6606
6372
|
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 = [];
|
|
6607
6373
|
}
|
|
@@ -6632,7 +6398,7 @@ var Yr = class {
|
|
|
6632
6398
|
t.className = "an-crop-box", t.style.cssText = `
|
|
6633
6399
|
position:fixed; z-index:10101;
|
|
6634
6400
|
box-sizing:border-box;
|
|
6635
|
-
border:2px solid ${
|
|
6401
|
+
border:2px solid ${Jr};
|
|
6636
6402
|
cursor:move;
|
|
6637
6403
|
outline: none;
|
|
6638
6404
|
`;
|
|
@@ -6697,7 +6463,7 @@ var Yr = class {
|
|
|
6697
6463
|
"position:absolute",
|
|
6698
6464
|
"width:10px",
|
|
6699
6465
|
"height:10px",
|
|
6700
|
-
`background:${
|
|
6466
|
+
`background:${Jr}`,
|
|
6701
6467
|
"border:2px solid #fff",
|
|
6702
6468
|
"border-radius:2px",
|
|
6703
6469
|
"box-sizing:border-box",
|
|
@@ -6731,7 +6497,7 @@ var Yr = class {
|
|
|
6731
6497
|
let a = this._makeToolbarBtn("✓ Crop", "#22c55e", () => this._confirm()), o = this._makeToolbarBtn("✕ Cancel", "#94a3b8", () => this._close(!1)), s = document.createElement("label");
|
|
6732
6498
|
s.style.cssText = "color:#94a3b8;font-size:11px;cursor:pointer;display:flex;align-items:center;gap:4px;";
|
|
6733
6499
|
let c = document.createElement("input");
|
|
6734
|
-
c.type = "checkbox", c.style.accentColor =
|
|
6500
|
+
c.type = "checkbox", c.style.accentColor = Jr, 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;
|
|
6735
6501
|
}
|
|
6736
6502
|
_makeToolbarBtn(e, t, n) {
|
|
6737
6503
|
let r = document.createElement("button");
|
|
@@ -6761,7 +6527,7 @@ var Yr = class {
|
|
|
6761
6527
|
let i = this._img.naturalWidth || 0, a = this._img.naturalHeight || 0, o = this._imgRect.width || 1, s = this._imgRect.height || 1, c = {
|
|
6762
6528
|
x: i / o,
|
|
6763
6529
|
y: a / s
|
|
6764
|
-
}, l =
|
|
6530
|
+
}, l = X(e - this._imgRect.left, 0, o), u = X(t - this._imgRect.top, 0, s), d = X(n, 0, o - l), f = X(r, 0, s - u);
|
|
6765
6531
|
this._infoEl.textContent = `${Math.round(d * c.x)} × ${Math.round(f * c.y)} px`;
|
|
6766
6532
|
}
|
|
6767
6533
|
let o = t + r + 8;
|
|
@@ -6770,14 +6536,14 @@ var Yr = class {
|
|
|
6770
6536
|
_startBoxMove(e) {
|
|
6771
6537
|
let t = e.clientX - this._box.x, n = e.clientY - this._box.y, r = this._imgRect;
|
|
6772
6538
|
this._attachDocDrag((e) => {
|
|
6773
|
-
this._box.x =
|
|
6539
|
+
this._box.x = X(e.clientX - t, r.left, r.right - this._box.w), this._box.y = X(e.clientY - n, r.top, r.bottom - this._box.h), this._updateDOM();
|
|
6774
6540
|
});
|
|
6775
6541
|
}
|
|
6776
6542
|
_startHandleDrag(e, t) {
|
|
6777
6543
|
let n = e.clientX, r = e.clientY, i = { ...this._box }, a = this._imgRect, o = this._arCheck?.checked, s = i.w / (i.h || 1);
|
|
6778
6544
|
this._attachDocDrag((e) => {
|
|
6779
6545
|
let c = e.clientX - n, l = e.clientY - r, { x: u, y: d, w: f, h: p } = i;
|
|
6780
|
-
t.includes("e") && (f = Math.max(
|
|
6546
|
+
t.includes("e") && (f = Math.max(Y, i.w + c)), t.includes("s") && (p = Math.max(Y, i.h + l)), t.includes("w") && (u = Math.min(i.x + i.w - Y, i.x + c), f = i.x + i.w - u), t.includes("n") && (d = Math.min(i.y + i.h - Y, 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 = X(u, a.left, a.right - Y), d = X(d, a.top, a.bottom - Y), f = X(f, Y, a.right - u), p = X(p, Y, a.bottom - d), this._box = {
|
|
6781
6547
|
x: u,
|
|
6782
6548
|
y: d,
|
|
6783
6549
|
w: f,
|
|
@@ -6811,12 +6577,12 @@ var Yr = class {
|
|
|
6811
6577
|
this._close(!1);
|
|
6812
6578
|
return;
|
|
6813
6579
|
}
|
|
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(
|
|
6580
|
+
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(X(n - t.left, 0, t.width) * o), l = Math.round(X(r - t.top, 0, t.height) * s), u = Math.round(X(i, 0, t.width - (n - t.left)) * o), d = Math.round(X(a, 0, t.height - (r - t.top)) * s);
|
|
6815
6581
|
if (u <= 0 || d <= 0) {
|
|
6816
6582
|
this._close(!1);
|
|
6817
6583
|
return;
|
|
6818
6584
|
}
|
|
6819
|
-
let f = await
|
|
6585
|
+
let f = await Yr(e, {
|
|
6820
6586
|
x: c,
|
|
6821
6587
|
y: l,
|
|
6822
6588
|
width: u,
|
|
@@ -6860,7 +6626,7 @@ var Yr = class {
|
|
|
6860
6626
|
e?.remove();
|
|
6861
6627
|
}), 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;
|
|
6862
6628
|
}
|
|
6863
|
-
},
|
|
6629
|
+
}, Zr = class {
|
|
6864
6630
|
constructor(e) {
|
|
6865
6631
|
this.context = e, this.options = e.options, this._banner = null;
|
|
6866
6632
|
}
|
|
@@ -6913,7 +6679,7 @@ var Yr = class {
|
|
|
6913
6679
|
_removeBanner() {
|
|
6914
6680
|
this._banner?.remove(), this._banner = null;
|
|
6915
6681
|
}
|
|
6916
|
-
},
|
|
6682
|
+
}, Qr = class {
|
|
6917
6683
|
constructor(e) {
|
|
6918
6684
|
this.context = e, this.options = e.options, this._disposers = [];
|
|
6919
6685
|
}
|
|
@@ -7048,7 +6814,7 @@ var Yr = class {
|
|
|
7048
6814
|
break;
|
|
7049
6815
|
}
|
|
7050
6816
|
}
|
|
7051
|
-
},
|
|
6817
|
+
}, $r = [
|
|
7052
6818
|
"#000000",
|
|
7053
6819
|
"#434343",
|
|
7054
6820
|
"#666666",
|
|
@@ -7073,17 +6839,17 @@ var Yr = class {
|
|
|
7073
6839
|
"#c9daf8",
|
|
7074
6840
|
"#d9d2e9",
|
|
7075
6841
|
"#ead1dc"
|
|
7076
|
-
],
|
|
7077
|
-
bold:
|
|
7078
|
-
italic:
|
|
7079
|
-
underline:
|
|
7080
|
-
strikethrough:
|
|
7081
|
-
link:
|
|
7082
|
-
foreColor:
|
|
7083
|
-
hiliteColor:
|
|
7084
|
-
removeFormat:
|
|
7085
|
-
inlineCode:
|
|
7086
|
-
},
|
|
6842
|
+
], ei = "stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"", Z = (e) => `<svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" ${ei} style="display:block">${e}</svg>`, ti = {
|
|
6843
|
+
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\"/>"),
|
|
6844
|
+
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\"/>"),
|
|
6845
|
+
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\"/>"),
|
|
6846
|
+
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\"/>"),
|
|
6847
|
+
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\"/>"),
|
|
6848
|
+
foreColor: Z("<path d=\"M4 20L12 4L20 20\"/><line x1=\"7.5\" y1=\"14\" x2=\"16.5\" y2=\"14\"/>"),
|
|
6849
|
+
hiliteColor: Z("<path d=\"M3 21v-4l9-9 4 4-9 9z\"/><path d=\"M12 8l4 4\"/><line x1=\"3\" y1=\"21\" x2=\"21\" y2=\"21\"/>"),
|
|
6850
|
+
removeFormat: 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\"/>"),
|
|
6851
|
+
inlineCode: 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\"/>")
|
|
6852
|
+
}, ni = {
|
|
7087
6853
|
bold: (e) => e.invoke("editor.bold"),
|
|
7088
6854
|
italic: (e) => e.invoke("editor.italic"),
|
|
7089
6855
|
underline: (e) => e.invoke("editor.underline"),
|
|
@@ -7104,15 +6870,15 @@ var Yr = class {
|
|
|
7104
6870
|
e.invoke("editor.afterCommand");
|
|
7105
6871
|
},
|
|
7106
6872
|
inlineCode: (e) => e.invoke("editor.inlineCode")
|
|
7107
|
-
},
|
|
6873
|
+
}, ri = {
|
|
7108
6874
|
bold: () => document.queryCommandState("bold"),
|
|
7109
6875
|
italic: () => document.queryCommandState("italic"),
|
|
7110
6876
|
underline: () => document.queryCommandState("underline"),
|
|
7111
6877
|
strikethrough: () => document.queryCommandState("strikeThrough")
|
|
7112
|
-
},
|
|
6878
|
+
}, ii = {
|
|
7113
6879
|
foreColor: !0,
|
|
7114
6880
|
hiliteColor: !0
|
|
7115
|
-
},
|
|
6881
|
+
}, ai = class {
|
|
7116
6882
|
constructor(e) {
|
|
7117
6883
|
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);
|
|
7118
6884
|
}
|
|
@@ -7142,23 +6908,23 @@ var Yr = class {
|
|
|
7142
6908
|
"removeFormat"
|
|
7143
6909
|
];
|
|
7144
6910
|
for (let n of t) {
|
|
7145
|
-
if (!
|
|
6911
|
+
if (!ti[n]) continue;
|
|
7146
6912
|
let t = document.createElement("button");
|
|
7147
|
-
if (t.type = "button", t.dataset.name = n, t.setAttribute("aria-label", n),
|
|
6913
|
+
if (t.type = "button", t.dataset.name = n, t.setAttribute("aria-label", n), ii[n]) {
|
|
7148
6914
|
t.className = "an-bubble-btn an-bubble-btn--color";
|
|
7149
6915
|
let e = document.createElement("span");
|
|
7150
|
-
e.className = "an-bubble-btn-svg", e.innerHTML =
|
|
6916
|
+
e.className = "an-bubble-btn-svg", e.innerHTML = ti[n];
|
|
7151
6917
|
let r = document.createElement("span");
|
|
7152
6918
|
r.className = "an-bubble-color-strip", r.style.background = n === "foreColor" ? "#000000" : "transparent", t.appendChild(e), t.appendChild(r);
|
|
7153
|
-
} else t.className = "an-bubble-btn", t.innerHTML =
|
|
6919
|
+
} else t.className = "an-bubble-btn", t.innerHTML = ti[n];
|
|
7154
6920
|
t.addEventListener("mousedown", (e) => {
|
|
7155
6921
|
e.preventDefault();
|
|
7156
6922
|
}), t.addEventListener("click", (e) => {
|
|
7157
|
-
if (e.preventDefault(), e.stopPropagation(),
|
|
6923
|
+
if (e.preventDefault(), e.stopPropagation(), ii[n]) {
|
|
7158
6924
|
this._openColorPicker(n, t);
|
|
7159
6925
|
return;
|
|
7160
6926
|
}
|
|
7161
|
-
this.context.invoke("editor.focus"),
|
|
6927
|
+
this.context.invoke("editor.focus"), ni[n] && ni[n](this.context), this._syncActive();
|
|
7162
6928
|
}), e.appendChild(t);
|
|
7163
6929
|
}
|
|
7164
6930
|
document.body.appendChild(e), this._el = e, this._btnCache = Array.from(e.querySelectorAll(".an-bubble-btn"));
|
|
@@ -7167,7 +6933,7 @@ var Yr = class {
|
|
|
7167
6933
|
let e = document.createElement("div");
|
|
7168
6934
|
e.className = "an-bubble-color-picker", e.style.display = "none", e.addEventListener("mousedown", (e) => e.preventDefault());
|
|
7169
6935
|
let t = document.createElement("div");
|
|
7170
|
-
t.className = "an-context-color-palette",
|
|
6936
|
+
t.className = "an-context-color-palette", $r.forEach((e) => {
|
|
7171
6937
|
let n = document.createElement("div");
|
|
7172
6938
|
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) => {
|
|
7173
6939
|
t.stopPropagation(), this._applyColor(this._pickerType, e);
|
|
@@ -7235,7 +7001,7 @@ var Yr = class {
|
|
|
7235
7001
|
}
|
|
7236
7002
|
_syncActive() {
|
|
7237
7003
|
this._btnCache && this._btnCache.forEach((e) => {
|
|
7238
|
-
let t =
|
|
7004
|
+
let t = ri[e.dataset.name];
|
|
7239
7005
|
e.classList.toggle("an-active", !!t?.());
|
|
7240
7006
|
});
|
|
7241
7007
|
}
|
|
@@ -7286,7 +7052,7 @@ var Yr = class {
|
|
|
7286
7052
|
_onContextMenu() {
|
|
7287
7053
|
this._hide();
|
|
7288
7054
|
}
|
|
7289
|
-
},
|
|
7055
|
+
}, oi = class {
|
|
7290
7056
|
constructor(e) {
|
|
7291
7057
|
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 = [];
|
|
7292
7058
|
}
|
|
@@ -7431,7 +7197,7 @@ var Yr = class {
|
|
|
7431
7197
|
let n;
|
|
7432
7198
|
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());
|
|
7433
7199
|
}
|
|
7434
|
-
},
|
|
7200
|
+
}, si = class {
|
|
7435
7201
|
constructor(e) {
|
|
7436
7202
|
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;
|
|
7437
7203
|
}
|
|
@@ -7658,38 +7424,38 @@ var Yr = class {
|
|
|
7658
7424
|
this._deleteTriggerText(), this._close(), t.run();
|
|
7659
7425
|
}
|
|
7660
7426
|
}
|
|
7661
|
-
},
|
|
7427
|
+
}, ci = /* @__PURE__ */ new Map(), li = [
|
|
7662
7428
|
{
|
|
7663
7429
|
name: "autoSaveRestore",
|
|
7664
|
-
Class:
|
|
7430
|
+
Class: Zr,
|
|
7665
7431
|
enabled: (e) => !!e.autoSaveRestore
|
|
7666
7432
|
},
|
|
7667
7433
|
{
|
|
7668
7434
|
name: "markdownShortcuts",
|
|
7669
|
-
Class:
|
|
7435
|
+
Class: Qr,
|
|
7670
7436
|
enabled: (e) => e.markdownShortcuts !== !1
|
|
7671
7437
|
},
|
|
7672
7438
|
{
|
|
7673
7439
|
name: "bubbleToolbar",
|
|
7674
|
-
Class:
|
|
7440
|
+
Class: ai,
|
|
7675
7441
|
enabled: (e) => !!e.bubbleToolbar
|
|
7676
7442
|
},
|
|
7677
7443
|
{
|
|
7678
7444
|
name: "mention",
|
|
7679
|
-
Class:
|
|
7445
|
+
Class: oi,
|
|
7680
7446
|
enabled: (e) => !!e.mention
|
|
7681
7447
|
},
|
|
7682
7448
|
{
|
|
7683
7449
|
name: "slashMenu",
|
|
7684
|
-
Class:
|
|
7450
|
+
Class: si,
|
|
7685
7451
|
enabled: (e) => e.slashMenu !== !1
|
|
7686
7452
|
}
|
|
7687
|
-
],
|
|
7453
|
+
], ui = /* @__PURE__ */ new Map(), di = class {
|
|
7688
7454
|
constructor(e, t = {}) {
|
|
7689
7455
|
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;
|
|
7690
7456
|
}
|
|
7691
7457
|
initialize() {
|
|
7692
|
-
let { container: e, editable: t } =
|
|
7458
|
+
let { container: e, editable: t } = cn(this.targetEl, this.options);
|
|
7693
7459
|
this.layoutInfo.container = e, this.layoutInfo.editable = t, this._registerModules();
|
|
7694
7460
|
let n = this._modules.get("toolbar");
|
|
7695
7461
|
n?.el && (e.insertBefore(n.el, t), this.layoutInfo.toolbar = n.el);
|
|
@@ -7701,12 +7467,12 @@ var Yr = class {
|
|
|
7701
7467
|
let n = new t(this);
|
|
7702
7468
|
this._modules.set(e, n), n.initialize();
|
|
7703
7469
|
};
|
|
7704
|
-
e("editor",
|
|
7705
|
-
for (let { name: t, Class: n, enabled: r } of
|
|
7706
|
-
if (
|
|
7470
|
+
e("editor", Un), e("toolbar", Jn), e("statusbar", Qn), e("clipboard", $n), e("contextMenu", Ur), e("placeholder", er), e("codeview", tr), e("fullscreen", nr), e("linkDialog", ir), e("imageDialog", or), e("videoDialog", cr), e("imageResizer", dr), e("videoResizer", fr), e("linkTooltip", gr), e("imageTooltip", vr), e("videoTooltip", yr), e("tableTooltip", Tr), e("codeTooltip", Ar), e("emojiDialog", Pr), e("iconDialog", zr), e("shortcutsDialog", Kr), e("findReplace", qr), e("imageCropOverlay", Xr);
|
|
7471
|
+
for (let { name: t, Class: n, enabled: r } of li) r(this.options) && e(t, n);
|
|
7472
|
+
if (ci.size > 0) for (let [t, n] of ci) e(t, n);
|
|
7707
7473
|
}
|
|
7708
7474
|
_syncOptionalModules() {
|
|
7709
|
-
for (let { name: e, Class: t, enabled: n } of
|
|
7475
|
+
for (let { name: e, Class: t, enabled: n } of li) {
|
|
7710
7476
|
let r = n(this.options);
|
|
7711
7477
|
if (r !== this._modules.has(e)) if (r) {
|
|
7712
7478
|
let n = new t(this);
|
|
@@ -7750,7 +7516,7 @@ var Yr = class {
|
|
|
7750
7516
|
});
|
|
7751
7517
|
}
|
|
7752
7518
|
_applyGlobalPlugins() {
|
|
7753
|
-
if (
|
|
7519
|
+
if (ui.size !== 0) for (let { plugin: e, options: t } of ui.values()) this._installPlugin(e, t);
|
|
7754
7520
|
}
|
|
7755
7521
|
_bindEditorEvents(e) {
|
|
7756
7522
|
let t = E(e, "input", () => this._syncToTarget()), n = E(e, "focus", () => {
|
|
@@ -8006,39 +7772,39 @@ var Yr = class {
|
|
|
8006
7772
|
};
|
|
8007
7773
|
//#endregion
|
|
8008
7774
|
//#region src/js/core/lists.js
|
|
8009
|
-
function
|
|
7775
|
+
function fi(e) {
|
|
8010
7776
|
return e[e.length - 1];
|
|
8011
7777
|
}
|
|
8012
|
-
function
|
|
7778
|
+
function pi(e) {
|
|
8013
7779
|
return e[0];
|
|
8014
7780
|
}
|
|
8015
|
-
function
|
|
7781
|
+
function mi(e, t = 1) {
|
|
8016
7782
|
return e.slice(0, e.length - t);
|
|
8017
7783
|
}
|
|
8018
|
-
function
|
|
7784
|
+
function hi(e, t = 1) {
|
|
8019
7785
|
return e.slice(t);
|
|
8020
7786
|
}
|
|
8021
|
-
function
|
|
7787
|
+
function gi(e) {
|
|
8022
7788
|
return e.flat();
|
|
8023
7789
|
}
|
|
8024
|
-
function
|
|
7790
|
+
function _i(e) {
|
|
8025
7791
|
return [...new Set(e)];
|
|
8026
7792
|
}
|
|
8027
|
-
function
|
|
7793
|
+
function vi(e, t) {
|
|
8028
7794
|
let n = [];
|
|
8029
7795
|
for (let r = 0; r < e.length; r += t) n.push(e.slice(r, r + t));
|
|
8030
7796
|
return n;
|
|
8031
7797
|
}
|
|
8032
|
-
function
|
|
7798
|
+
function yi(e, t) {
|
|
8033
7799
|
return e.reduce((e, n) => {
|
|
8034
7800
|
let r = t(n);
|
|
8035
7801
|
return e[r] || (e[r] = []), e[r].push(n), e;
|
|
8036
7802
|
}, {});
|
|
8037
7803
|
}
|
|
8038
|
-
function
|
|
7804
|
+
function bi(e, t) {
|
|
8039
7805
|
return e.every(t);
|
|
8040
7806
|
}
|
|
8041
|
-
function
|
|
7807
|
+
function xi(e, t) {
|
|
8042
7808
|
return e.some(t);
|
|
8043
7809
|
}
|
|
8044
7810
|
//#endregion
|
|
@@ -8046,7 +7812,7 @@ function yi(e, t) {
|
|
|
8046
7812
|
function Q() {
|
|
8047
7813
|
return globalThis.navigator?.userAgent ?? "";
|
|
8048
7814
|
}
|
|
8049
|
-
var
|
|
7815
|
+
var Si = {
|
|
8050
7816
|
get isChrome() {
|
|
8051
7817
|
return /Chrome\//.test(Q()) && !/Edg\//.test(Q());
|
|
8052
7818
|
},
|
|
@@ -8071,17 +7837,17 @@ var bi = {
|
|
|
8071
7837
|
get modifierKey() {
|
|
8072
7838
|
return /Macintosh/.test(Q()) ? "metaKey" : "ctrlKey";
|
|
8073
7839
|
}
|
|
8074
|
-
},
|
|
7840
|
+
}, Ci = { ...A }, $ = /* @__PURE__ */ new WeakMap(), wi = {
|
|
8075
7841
|
create(e, t = {}) {
|
|
8076
|
-
let n =
|
|
7842
|
+
let n = Ti(e).map((e) => {
|
|
8077
7843
|
if ($.has(e)) return $.get(e);
|
|
8078
|
-
let n = new
|
|
7844
|
+
let n = new di(e, t);
|
|
8079
7845
|
return n.initialize(), $.set(e, n), n;
|
|
8080
7846
|
});
|
|
8081
7847
|
return n.length === 1 ? n[0] : n;
|
|
8082
7848
|
},
|
|
8083
7849
|
destroy(e) {
|
|
8084
|
-
|
|
7850
|
+
Ti(e).forEach((e) => {
|
|
8085
7851
|
let t = $.get(e);
|
|
8086
7852
|
t && (t.destroy(), $.delete(e));
|
|
8087
7853
|
});
|
|
@@ -8097,20 +7863,20 @@ var bi = {
|
|
|
8097
7863
|
Object.assign(A, e);
|
|
8098
7864
|
},
|
|
8099
7865
|
resetDefaults() {
|
|
8100
|
-
Object.keys(A).forEach((e) => delete A[e]), Object.assign(A,
|
|
7866
|
+
Object.keys(A).forEach((e) => delete A[e]), Object.assign(A, Ci);
|
|
8101
7867
|
},
|
|
8102
7868
|
registerModule(e, t) {
|
|
8103
|
-
|
|
7869
|
+
ci.set(e, t);
|
|
8104
7870
|
},
|
|
8105
7871
|
use(e, t = {}) {
|
|
8106
7872
|
if (!e || typeof e.name != "string") throw TypeError("[AutumnNote] AutumnNote.use: plugin must have a string `name` property.");
|
|
8107
|
-
return
|
|
7873
|
+
return ui.has(e.name) ? (console.warn(`[AutumnNote] Plugin "${e.name}" already registered globally. Skipping.`), this) : (Array.isArray(e.buttons) && e.buttons.forEach((e) => $e(e)), ui.set(e.name, {
|
|
8108
7874
|
plugin: e,
|
|
8109
7875
|
options: t
|
|
8110
7876
|
}), this);
|
|
8111
7877
|
},
|
|
8112
7878
|
hasPlugin(e) {
|
|
8113
|
-
return
|
|
7879
|
+
return ui.has(e);
|
|
8114
7880
|
},
|
|
8115
7881
|
registerButton(e) {
|
|
8116
7882
|
return $e(e), this;
|
|
@@ -8124,12 +7890,12 @@ var bi = {
|
|
|
8124
7890
|
return n >= 0 ? t[n] = e : t.push(e), this;
|
|
8125
7891
|
},
|
|
8126
7892
|
buttons: Vt,
|
|
8127
|
-
version: "2.
|
|
7893
|
+
version: "2.2.0"
|
|
8128
7894
|
};
|
|
8129
|
-
function
|
|
7895
|
+
function Ti(e) {
|
|
8130
7896
|
return typeof e == "string" ? Array.from(document.querySelectorAll(e)) : e instanceof Element ? [e] : e instanceof NodeList || Array.isArray(e) ? Array.from(e) : [];
|
|
8131
7897
|
}
|
|
8132
7898
|
//#endregion
|
|
8133
|
-
export {
|
|
7899
|
+
export { di 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, bi as all, ne as ancestors, xi as any, zt as backColorBtn, tt as boldBtn, Vt as buttons, It as checklistBtn, re as children, vi 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, wi as default, A as defaultOptions, Bt as defaultToolbar, Et as directionBtn, xt as emojiBtn, Si as env, Nt as findBtn, Pt as findReplaceBtn, pi as first, gi as flatten, Dt as fontFamilyBtn, wt as fontSizeBtn, Rt as foreColorBtn, _e as fromNativeRange, jt as fullscreenBtn, et as getButton, yi as groupBy, _t as hrBtn, St as iconBtn, i as identity, yt as imageBtn, pt as indentBtn, mi 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, F as isKey, _ as isLi, v as isList, I 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, P as key, fi 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, N as sanitiseUrl, Mt as shortcutsBtn, Ce as splitText, it as strikeBtn, ot as subscriptBtn, at as superscriptBtn, Ct as tableBtn, hi as tail, n as throttle, me as trapFocus, dt as ulBtn, rt as underlineBtn, ht as undoBtn, _i as unique, oe as unwrap, bt as videoBtn, Se as withSavedRange, se as wrap };
|
|
8134
7900
|
|
|
8135
7901
|
//# sourceMappingURL=autumnnote.es.js.map
|