autumnnote 2.1.0 → 2.3.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 +74 -6
- package/dist/autumnnote.cjs +27 -22
- package/dist/autumnnote.es.js +474 -591
- package/dist/autumnnote.es.js.map +1 -1
- package/dist/autumnnote.min.js +27 -22
- package/dist/autumnnote.umd.js +27 -22
- 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,
|
|
@@ -1886,18 +1888,38 @@ function gn(e, t, n = {}) {
|
|
|
1886
1888
|
//#endregion
|
|
1887
1889
|
//#region src/js/core/markdown.js
|
|
1888
1890
|
function _n(e) {
|
|
1889
|
-
return
|
|
1891
|
+
return wn(new DOMParser().parseFromString(`<body>${e || ""}</body>`, "text/html").body).replace(/\n{3,}/g, "\n\n").trim();
|
|
1890
1892
|
}
|
|
1891
1893
|
function vn(e, t) {
|
|
1892
1894
|
return Array.from(e.children).filter((e) => e.tagName === t.toUpperCase());
|
|
1893
1895
|
}
|
|
1894
|
-
function yn(e
|
|
1895
|
-
|
|
1896
|
+
function yn(e) {
|
|
1897
|
+
return e.replaceAll("\\", "\\\\").replace(/&(?=#\d+;|#[xX][0-9a-fA-F]+;|[a-zA-Z][a-zA-Z0-9]*;)/g, "&").replace(/!(?=\[)/g, String.raw`\!`).replace(/([`*[\]])/g, String.raw`\$1`).replace(/(?<!\w)_|_(?!\w)/g, String.raw`\_`).replace(/~(?=~)|(?<=~)~/g, String.raw`\~`);
|
|
1898
|
+
}
|
|
1899
|
+
function bn(e) {
|
|
1900
|
+
return /^\s*(?:-{2,}|={2,}|\*{3,}|_{3,}|(?:[-*_] +){2,}[-*_])\s*$/.test(e) ? e.replace(/[-=*_]/, (e) => `\\${e}`) : e.replace(/^(\s*)(#{1,6})(?=\s|$)/, (e, t, n) => `${t}\\${n}`).replace(/^(\s*)>/, (e, t) => `${t}\\>`).replace(/^(\s*)([-*+])(?=\s)/, (e, t, n) => `${t}\\${n}`).replace(/^(\s*)(\d+)([.)])(?=\s)/, (e, t, n, r) => `${t}${n}\\${r}`);
|
|
1901
|
+
}
|
|
1902
|
+
function xn(e) {
|
|
1903
|
+
return e.split("\n").map(bn).join("\n");
|
|
1904
|
+
}
|
|
1905
|
+
function Sn(e, t) {
|
|
1906
|
+
let n = " ".repeat(t + 1);
|
|
1907
|
+
return wn(e, t + 1).trim().split("\n").map((e, t) => t === 0 || e.trim() === "" || e.startsWith(n) ? e : n + e).join("\n");
|
|
1908
|
+
}
|
|
1909
|
+
function Cn(e, t) {
|
|
1910
|
+
let n = e.getAttribute(t) || "", r = /[\s()]/.test(n) ? `<${n}>` : n, i = e.getAttribute("title");
|
|
1911
|
+
return i ? `${r} "${i.replaceAll("\"", String.raw`\"`)}"` : r;
|
|
1912
|
+
}
|
|
1913
|
+
function wn(e, t = 0) {
|
|
1914
|
+
if (e.nodeType === 3) {
|
|
1915
|
+
let t = e.textContent.replace(/\s+/g, " ");
|
|
1916
|
+
return e.parentElement?.closest("pre, code") ? t : yn(t);
|
|
1917
|
+
}
|
|
1896
1918
|
if (e.nodeType !== 1) return "";
|
|
1897
|
-
let n = e, r = n.nodeName.toLowerCase(), i = () => Array.from(n.childNodes).map((e) =>
|
|
1919
|
+
let n = e, r = n.nodeName.toLowerCase(), i = () => Array.from(n.childNodes).map((e) => wn(e, t)).join("");
|
|
1898
1920
|
switch (r) {
|
|
1899
1921
|
case "p":
|
|
1900
|
-
case "div": return `\n\n${i()}\n\n`;
|
|
1922
|
+
case "div": return `\n\n${xn(i())}\n\n`;
|
|
1901
1923
|
case "br": return " \n";
|
|
1902
1924
|
case "h1": return `\n\n# ${i()}\n\n`;
|
|
1903
1925
|
case "h2": return `\n\n## ${i()}\n\n`;
|
|
@@ -1919,7 +1941,11 @@ function yn(e, t = 0) {
|
|
|
1919
1941
|
let e = n.getAttribute("style") || "";
|
|
1920
1942
|
return /\b(color|background-color|font-size)\s*:/.test(e) ? `<span style="${R(e)}">${i()}</span>` : i();
|
|
1921
1943
|
}
|
|
1922
|
-
case "code":
|
|
1944
|
+
case "code": {
|
|
1945
|
+
if (n.closest("pre")) return i();
|
|
1946
|
+
let e = i(), t = Math.max(0, ...Array.from(e.matchAll(/`+/g), (e) => e[0].length)), r = "`".repeat(t + 1), a = /^`|`$/.test(e) ? " " : "";
|
|
1947
|
+
return `${r}${a}${e}${a}${r}`;
|
|
1948
|
+
}
|
|
1923
1949
|
case "pre": {
|
|
1924
1950
|
let e = n.querySelector("code"), t = /language-(\S+)/.exec(e?.className || "");
|
|
1925
1951
|
return `\n\n\`\`\`${t ? t[1] : ""}\n${(e || n).textContent || ""}\n\`\`\`\n\n`;
|
|
@@ -1928,68 +1954,113 @@ function yn(e, t = 0) {
|
|
|
1928
1954
|
let e = i().trim().split("\n");
|
|
1929
1955
|
return `\n\n${e.filter((t, n) => t.trim() !== "" || (e[n - 1] ?? "").trim() !== "").map((e) => e.trim() === "" ? ">" : `> ${e}`).join("\n")}\n\n`;
|
|
1930
1956
|
}
|
|
1931
|
-
case "a": {
|
|
1932
|
-
|
|
1933
|
-
return `[${i()}](${e})`;
|
|
1934
|
-
}
|
|
1935
|
-
case "img": {
|
|
1936
|
-
let e = n.getAttribute("src") || "";
|
|
1937
|
-
return ``;
|
|
1938
|
-
}
|
|
1957
|
+
case "a": return `[${i()}](${Cn(n, "href")})`;
|
|
1958
|
+
case "img": return `})`;
|
|
1939
1959
|
case "ul": {
|
|
1940
1960
|
let e = vn(n, "li");
|
|
1941
1961
|
if (!e.length) return i();
|
|
1942
1962
|
let r = " ".repeat(t), a = n.classList.contains("an-checklist"), o = e.map((e) => {
|
|
1943
1963
|
let n = vn(e, "input").find((e) => e.getAttribute("type") === "checkbox"), i = "- ";
|
|
1944
|
-
return (a || n) && (i = n && n.checked ? "- [x] " : "- [ ] "), `${r}${i}${
|
|
1964
|
+
return (a || n) && (i = n && n.checked ? "- [x] " : "- [ ] "), `${r}${i}${Sn(e, t)}`;
|
|
1945
1965
|
}).join("\n");
|
|
1946
1966
|
return t === 0 ? `\n\n${o}\n\n` : `\n${o}`;
|
|
1947
1967
|
}
|
|
1948
1968
|
case "ol": {
|
|
1949
1969
|
let e = vn(n, "li");
|
|
1950
1970
|
if (!e.length) return i();
|
|
1951
|
-
let r = " ".repeat(t), a = e.map((e, n) => `${r}${
|
|
1952
|
-
return t === 0 ? `\n\n${
|
|
1971
|
+
let r = " ".repeat(t), a = Number.parseInt(n.getAttribute("start") || "1", 10), o = Number.isFinite(a) ? a : 1, s = e.map((e, n) => `${r}${o + n}. ${Sn(e, t)}`).join("\n");
|
|
1972
|
+
return t === 0 ? `\n\n${s}\n\n` : `\n${s}`;
|
|
1953
1973
|
}
|
|
1954
1974
|
case "li": return i();
|
|
1955
1975
|
case "hr": return "\n\n---\n\n";
|
|
1956
1976
|
case "table": {
|
|
1957
1977
|
let e = Array.from(n.querySelectorAll("tr"));
|
|
1958
1978
|
if (!e.length) return i();
|
|
1959
|
-
let t = !!vn(n, "thead")[0] || e[0].children.length > 0 && Array.from(e[0].children).every((e) => e.tagName === "TH"), r = e.map((e) => Array.from(e.querySelectorAll("th, td")).map((e) => e.textContent.trim().replaceAll("|", String.raw`\|`))), a = Math.max(...r.map((e) => e.length)), o = (e) => {
|
|
1979
|
+
let t = !!vn(n, "thead")[0] || e[0].children.length > 0 && Array.from(e[0].children).every((e) => e.tagName === "TH"), r = e.map((e) => Array.from(e.querySelectorAll("th, td")).map((e) => yn(e.textContent.trim()).replaceAll("|", String.raw`\|`))), a = Math.max(...r.map((e) => e.length)), o = (e) => {
|
|
1960
1980
|
let t = [...e];
|
|
1961
1981
|
for (; t.length < a;) t.push("");
|
|
1962
1982
|
return t;
|
|
1963
|
-
}, s = +!!t, c = t ? o(r[0]) : Array(a).fill(""), l =
|
|
1964
|
-
|
|
1965
|
-
|
|
1966
|
-
|
|
1983
|
+
}, s = +!!t, c = t ? o(r[0]) : Array(a).fill(""), l = Array.from({ length: a }, (t, n) => {
|
|
1984
|
+
let r = e[0]?.children[n], i = /text-align:\s*(left|center|right)/.exec(r?.getAttribute("style") || "")?.[1];
|
|
1985
|
+
return i === "center" ? ":---:" : i === "right" ? "---:" : i === "left" ? ":---" : "---";
|
|
1986
|
+
}), u = "\n\n";
|
|
1987
|
+
u += `| ${c.join(" | ")} |\n`, u += `| ${l.join(" | ")} |\n`;
|
|
1988
|
+
for (let e = s; e < r.length; e++) u += `| ${o(r[e]).join(" | ")} |\n`;
|
|
1989
|
+
return u + "\n";
|
|
1967
1990
|
}
|
|
1968
1991
|
default: return i();
|
|
1969
1992
|
}
|
|
1970
1993
|
}
|
|
1971
|
-
function
|
|
1972
|
-
return
|
|
1994
|
+
function Tn(e) {
|
|
1995
|
+
return String(e ?? "").replace(/^/, "");
|
|
1973
1996
|
}
|
|
1974
|
-
|
|
1975
|
-
|
|
1976
|
-
|
|
1977
|
-
t = On(t);
|
|
1978
|
-
let n = kn(t);
|
|
1979
|
-
return t = n.clean, En = n.linkDefs, Dn = n.footnoteIds, Tn(t);
|
|
1997
|
+
function En(e) {
|
|
1998
|
+
let t = Tn(e);
|
|
1999
|
+
return /^#{1,6} [^\s]|^[ \t]*[-*+] [^\s]|^[ \t]*\d+[.)] [^\s]|^> ?[^\s]|^ {0,3}(?:`{3,}|~{3,})|^\*{2}[^*\n]+\*{2}/m.test(t) || /^.+\n=+\s*$/m.test(t) || /^.+\n-{2,}\s*$/m.test(t) || /^---\s*\n(?:[\s\S]*?\n)?(?:---|\.\.\.)\s*(?:\n|$)/.test(t) || /^\|.+\|[ \t]*\n\|[ \t:|-]+\|/m.test(t) || /^[^\n|]*\|[^\n]*\n[ \t]*:?-+:?[ \t]*(?:\|[ \t]*:?-+:?[ \t]*)+$/m.test(t) || /!?\[[^\]\n]*\]\([^)\n]*\)/.test(t) && /`[^`\n]+`|\*\*[^*\n]+\*\*|^#{1,6} |^[-*+] /m.test(t);
|
|
1980
2000
|
}
|
|
1981
|
-
|
|
2001
|
+
var Dn = /^ {0,3}>( ?)(.*)$/, On = /^(?: {4}|\t)\s*\S/, kn = /^( {0,3})(`{3,}|~{3,})[ \t]*(.*)$/;
|
|
2002
|
+
function An(e) {
|
|
2003
|
+
let t = kn.exec(e);
|
|
2004
|
+
if (!t) return null;
|
|
2005
|
+
let [, n, r, i] = t;
|
|
2006
|
+
return r[0] === "`" && i.includes("`") ? null : {
|
|
2007
|
+
marker: r[0],
|
|
2008
|
+
length: r.length,
|
|
2009
|
+
indent: n.length,
|
|
2010
|
+
lang: i.trim().split(/\s+/)[0] || ""
|
|
2011
|
+
};
|
|
2012
|
+
}
|
|
2013
|
+
function jn(e, t) {
|
|
2014
|
+
let n = 0, r = 0;
|
|
2015
|
+
for (; r < e.length && n < t;) {
|
|
2016
|
+
if (e[r] === " ") {
|
|
2017
|
+
n += 1, r += 1;
|
|
2018
|
+
continue;
|
|
2019
|
+
}
|
|
2020
|
+
if (e[r] === " ") {
|
|
2021
|
+
let e = 4 - n % 4;
|
|
2022
|
+
if (n + e > t) break;
|
|
2023
|
+
n += e, r += 1;
|
|
2024
|
+
continue;
|
|
2025
|
+
}
|
|
2026
|
+
break;
|
|
2027
|
+
}
|
|
2028
|
+
return e.slice(r);
|
|
2029
|
+
}
|
|
2030
|
+
var Mn = /^ {0,3}([-*_])( *\1){2,}\s*$/, Nn = "";
|
|
2031
|
+
function Pn(e) {
|
|
2032
|
+
let t = Tn(e).replaceAll("\r\n", "\n").replaceAll("\r", "\n").split("\n");
|
|
2033
|
+
t = Rn(t);
|
|
2034
|
+
let n = zn(t);
|
|
2035
|
+
return t = n.clean, In = n.linkDefs, Ln = n.footnoteIds, Fn(t);
|
|
2036
|
+
}
|
|
2037
|
+
function Fn(e) {
|
|
1982
2038
|
let t = [], n = 0;
|
|
1983
2039
|
for (; n < e.length;) {
|
|
1984
|
-
let r = e[n], i =
|
|
2040
|
+
let r = e[n], i = An(r);
|
|
1985
2041
|
if (i) {
|
|
1986
|
-
let r = i[
|
|
1987
|
-
for (n++; n < e.length && !e[n]
|
|
1988
|
-
let o =
|
|
2042
|
+
let r = RegExp(`^ {0,3}\\${i.marker}{${i.length},}[ \t]*$`), a = [];
|
|
2043
|
+
for (n++; n < e.length && !r.test(e[n]);) a.push(rr(jn(e[n], i.indent))), n++;
|
|
2044
|
+
let o = i.lang ? ` class="language-${R(i.lang)}"` : "";
|
|
1989
2045
|
t.push(`<pre><code${o}>${a.join("\n")}</code></pre>`), n++;
|
|
1990
2046
|
continue;
|
|
1991
2047
|
}
|
|
1992
|
-
if (
|
|
2048
|
+
if (On.test(r)) {
|
|
2049
|
+
let r = [];
|
|
2050
|
+
for (; n < e.length && (On.test(e[n]) || e[n].trim() === "");) {
|
|
2051
|
+
if (e[n].trim() === "") {
|
|
2052
|
+
let t = n;
|
|
2053
|
+
for (; t < e.length && e[t].trim() === "";) t++;
|
|
2054
|
+
if (t >= e.length || !On.test(e[t])) break;
|
|
2055
|
+
for (; n < t; n++) r.push("");
|
|
2056
|
+
continue;
|
|
2057
|
+
}
|
|
2058
|
+
r.push(rr(jn(e[n], 4))), n++;
|
|
2059
|
+
}
|
|
2060
|
+
t.push(`<pre><code>${r.join("\n")}</code></pre>`);
|
|
2061
|
+
continue;
|
|
2062
|
+
}
|
|
2063
|
+
if (r.trim() && !Mn.test(r) && !/^#{1,6} /.test(r) && n + 1 < e.length) {
|
|
1993
2064
|
if (/^=+\s*$/.test(e[n + 1])) {
|
|
1994
2065
|
t.push(`<h1>${L(r.trim())}</h1>`), n += 2;
|
|
1995
2066
|
continue;
|
|
@@ -1999,7 +2070,7 @@ function Tn(e) {
|
|
|
1999
2070
|
continue;
|
|
2000
2071
|
}
|
|
2001
2072
|
}
|
|
2002
|
-
if (
|
|
2073
|
+
if (Mn.test(r)) {
|
|
2003
2074
|
t.push("<hr>"), n++;
|
|
2004
2075
|
continue;
|
|
2005
2076
|
}
|
|
@@ -2009,19 +2080,19 @@ function Tn(e) {
|
|
|
2009
2080
|
t.push(`<h${e}>${L(r)}</h${e}>`), n++;
|
|
2010
2081
|
continue;
|
|
2011
2082
|
}
|
|
2012
|
-
if (
|
|
2083
|
+
if (Dn.test(r)) {
|
|
2013
2084
|
let r = [];
|
|
2014
|
-
for (; n < e.length &&
|
|
2015
|
-
t.push(`<blockquote>${
|
|
2085
|
+
for (; n < e.length && Dn.test(e[n]);) r.push(Dn.exec(e[n])[2]), n++;
|
|
2086
|
+
t.push(`<blockquote>${Fn(r)}</blockquote>`);
|
|
2016
2087
|
continue;
|
|
2017
2088
|
}
|
|
2018
2089
|
if (/^[-*+] /.test(r)) {
|
|
2019
|
-
let { html: r, endIdx: i } =
|
|
2090
|
+
let { html: r, endIdx: i } = Wn(e, n);
|
|
2020
2091
|
t.push(r), n = i;
|
|
2021
2092
|
continue;
|
|
2022
2093
|
}
|
|
2023
|
-
if (/^\d
|
|
2024
|
-
let { html: r, endIdx: i } =
|
|
2094
|
+
if (/^\d+[.)] /.test(r)) {
|
|
2095
|
+
let { html: r, endIdx: i } = Wn(e, n);
|
|
2025
2096
|
t.push(r), n = i;
|
|
2026
2097
|
continue;
|
|
2027
2098
|
}
|
|
@@ -2029,23 +2100,23 @@ function Tn(e) {
|
|
|
2029
2100
|
n++;
|
|
2030
2101
|
continue;
|
|
2031
2102
|
}
|
|
2032
|
-
if (
|
|
2033
|
-
let i =
|
|
2103
|
+
if (Hn(e, n)) {
|
|
2104
|
+
let i = Un(r), a = Un(e[n + 1]).map((e) => e.startsWith(":") && e.endsWith(":") ? "center" : e.endsWith(":") ? "right" : e.startsWith(":") ? "left" : null);
|
|
2034
2105
|
n += 2;
|
|
2035
2106
|
let o = [];
|
|
2036
|
-
for (; n < e.length &&
|
|
2107
|
+
for (; n < e.length && e[n].trim() !== "" && Vn(e[n]) > 1;) o.push(Un(e[n])), n++;
|
|
2037
2108
|
let s = (e, t, n) => `<${e}${n ? ` style="text-align:${n}"` : ""}>${L(t)}</${e}>`, c = `<thead><tr>${i.map((e, t) => s("th", e, a[t])).join("")}</tr></thead>`, l = o.length ? `<tbody>${o.map((e) => `<tr>${e.map((e, t) => s("td", e, a[t])).join("")}</tr>`).join("")}</tbody>` : "";
|
|
2038
2109
|
t.push(`<table>${c}${l}</table>`);
|
|
2039
2110
|
continue;
|
|
2040
2111
|
}
|
|
2041
2112
|
let o = [];
|
|
2042
|
-
for (; n < e.length && e[n].trim() !== "" && !/^(#{1,6} |[-*+] |\d
|
|
2043
|
-
o.length && t.push(`<p>${L(
|
|
2113
|
+
for (; n < e.length && e[n].trim() !== "" && !/^(#{1,6} |[-*+] |\d+[.)] )/.test(e[n]) && !An(e[n]) && !Dn.test(e[n]) && !Mn.test(e[n]) && !Hn(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++;
|
|
2114
|
+
o.length && t.push(`<p>${L(Bn(o)).replaceAll(Nn, "<br>")}</p>`);
|
|
2044
2115
|
}
|
|
2045
2116
|
return t.join("");
|
|
2046
2117
|
}
|
|
2047
|
-
var
|
|
2048
|
-
function
|
|
2118
|
+
var In = /* @__PURE__ */ new Map(), Ln = /* @__PURE__ */ new Set();
|
|
2119
|
+
function Rn(e) {
|
|
2049
2120
|
if ((e[0] || "").trim() !== "---") return e;
|
|
2050
2121
|
let t = -1;
|
|
2051
2122
|
for (let n = 1; n < e.length; n++) {
|
|
@@ -2059,14 +2130,18 @@ function On(e) {
|
|
|
2059
2130
|
let n = t + 1;
|
|
2060
2131
|
return e[n] !== void 0 && e[n].trim() === "" && n++, e.slice(n);
|
|
2061
2132
|
}
|
|
2062
|
-
function
|
|
2133
|
+
function zn(e) {
|
|
2063
2134
|
let t = /* @__PURE__ */ new Map(), n = /* @__PURE__ */ new Set(), r = [], i = !1, a = /^\[([^\]]+)\]:\s*(\S+)(?:\s+"([^"]*)")?\s*$/, o = /^\[\^([^\]]+)\]:\s*(.+)$/;
|
|
2064
2135
|
for (let s of e) {
|
|
2065
|
-
if (
|
|
2066
|
-
i = !
|
|
2136
|
+
if (i) {
|
|
2137
|
+
/^ {0,3}(?:`{3,}|~{3,})[ \t]*$/.test(s) && (i = !1), r.push(s);
|
|
2067
2138
|
continue;
|
|
2068
2139
|
}
|
|
2069
|
-
if (
|
|
2140
|
+
if (An(s)) {
|
|
2141
|
+
i = !0, r.push(s);
|
|
2142
|
+
continue;
|
|
2143
|
+
}
|
|
2144
|
+
{
|
|
2070
2145
|
let e = o.exec(s);
|
|
2071
2146
|
if (e) {
|
|
2072
2147
|
n.add(e[1]);
|
|
@@ -2089,23 +2164,33 @@ function kn(e) {
|
|
|
2089
2164
|
footnoteIds: n
|
|
2090
2165
|
};
|
|
2091
2166
|
}
|
|
2092
|
-
function
|
|
2167
|
+
function Bn(e) {
|
|
2093
2168
|
let t = "";
|
|
2094
2169
|
for (let n = 0; n < e.length; n++) {
|
|
2095
|
-
let r = n === e.length - 1, i = e[n];
|
|
2170
|
+
let r = n === e.length - 1, i = e[n].replace(/^[ \t]+/, "");
|
|
2096
2171
|
if (!r && /\\$/.test(i)) {
|
|
2097
|
-
t += i.replace(/\\$/, "") +
|
|
2172
|
+
t += i.replace(/\\$/, "") + Nn;
|
|
2098
2173
|
continue;
|
|
2099
2174
|
}
|
|
2100
2175
|
if (!r && / {2,}$/.test(i)) {
|
|
2101
|
-
t += i.replace(/ {2,}$/, "") +
|
|
2176
|
+
t += i.replace(/ {2,}$/, "") + Nn;
|
|
2102
2177
|
continue;
|
|
2103
2178
|
}
|
|
2104
2179
|
t += i + (r ? "" : " ");
|
|
2105
2180
|
}
|
|
2106
2181
|
return t;
|
|
2107
2182
|
}
|
|
2108
|
-
function
|
|
2183
|
+
function Vn(e) {
|
|
2184
|
+
return Un(e).length;
|
|
2185
|
+
}
|
|
2186
|
+
function Hn(e, t) {
|
|
2187
|
+
let n = e[t], r = e[t + 1];
|
|
2188
|
+
if (r === void 0 || !n.includes("|")) return !1;
|
|
2189
|
+
if (/^\|.+\|/.test(n)) return /^\|[\s|:-]+\|/.test(r);
|
|
2190
|
+
let i = Un(r);
|
|
2191
|
+
return i.length < 2 || !i.every((e) => /^:?-+:?$/.test(e)) ? !1 : Vn(n) === i.length;
|
|
2192
|
+
}
|
|
2193
|
+
function Un(e) {
|
|
2109
2194
|
let t = e.replace(/^\|/, "").replace(/\|$/, ""), n = [], r = "";
|
|
2110
2195
|
for (let e = 0; e < t.length; e++) {
|
|
2111
2196
|
if (t[e] === "\\" && t[e + 1] === "|") {
|
|
@@ -2120,12 +2205,12 @@ function jn(e) {
|
|
|
2120
2205
|
}
|
|
2121
2206
|
return n.push(r), n.map((e) => e.trim());
|
|
2122
2207
|
}
|
|
2123
|
-
function
|
|
2124
|
-
let n = e[t].match(/^(\s*)/)[1].length, r = /^\s*\d
|
|
2208
|
+
function Wn(e, t) {
|
|
2209
|
+
let n = e[t].match(/^(\s*)/)[1].length, r = /^\s*\d+[.)] /.test(e[t]), i = [], a = null, o = !1, s = !1, c = t;
|
|
2125
2210
|
for (; c < e.length;) {
|
|
2126
2211
|
let t = e[c];
|
|
2127
2212
|
if (t.trim() === "") {
|
|
2128
|
-
let t = e[c + 1], a = t === void 0 ? -1 : t.match(/^(\s*)/)[1].length, l = t !== void 0 && /^\s*(?:[-*+]|\d
|
|
2213
|
+
let t = e[c + 1], a = t === void 0 ? -1 : t.match(/^(\s*)/)[1].length, l = t !== void 0 && /^\s*(?:[-*+]|\d+[.)]) /.test(t) && /^\s*\d+[.)] /.test(t) === r && a === n, u = t !== void 0 && t.trim() !== "" && a > n;
|
|
2129
2214
|
if (!i.length || !l && !u) break;
|
|
2130
2215
|
o = !0, s = !0, c++;
|
|
2131
2216
|
continue;
|
|
@@ -2133,8 +2218,8 @@ function Mn(e, t) {
|
|
|
2133
2218
|
let l = t.match(/^(\s*)/)[1].length;
|
|
2134
2219
|
if (l < n) break;
|
|
2135
2220
|
if (l === n) {
|
|
2136
|
-
if (!/^\s*(?:[-*+]|\d
|
|
2137
|
-
let e = r ? t.replace(/^\s*\d
|
|
2221
|
+
if (!/^\s*(?:[-*+]|\d+[.)]) /.test(t) || /^\s*\d+[.)] /.test(t) !== r) break;
|
|
2222
|
+
let e = r ? t.replace(/^\s*\d+[.)] /, "") : t.replace(/^\s*[-*+] /, ""), n = !r && /^\[[ xX]\]\s+/.test(e);
|
|
2138
2223
|
if (a === null && (a = n), n !== a) break;
|
|
2139
2224
|
let o = n && e[1].toLowerCase() === "x", l = n ? e.replace(/^\[[ xX]\]\s+/, "") : e;
|
|
2140
2225
|
i.push({
|
|
@@ -2148,8 +2233,8 @@ function Mn(e, t) {
|
|
|
2148
2233
|
c++;
|
|
2149
2234
|
continue;
|
|
2150
2235
|
}
|
|
2151
|
-
if (/^\s*(?:[-*+]|\d
|
|
2152
|
-
let t =
|
|
2236
|
+
if (/^\s*(?:[-*+]|\d+[.)]) /.test(t)) {
|
|
2237
|
+
let t = Wn(e, c);
|
|
2153
2238
|
i[i.length - 1].sub += t.html, c = t.endIdx, s = !1;
|
|
2154
2239
|
} else if (s) i[i.length - 1].paras.push(t.trim()), s = !1, c++;
|
|
2155
2240
|
else {
|
|
@@ -2158,7 +2243,7 @@ function Mn(e, t) {
|
|
|
2158
2243
|
}
|
|
2159
2244
|
}
|
|
2160
2245
|
}
|
|
2161
|
-
let l = !r && a === !0, u = r ? /^\s*(\d+)
|
|
2246
|
+
let l = !r && a === !0, u = r ? /^\s*(\d+)[.)] /.exec(e[t]) : null, d = u ? Number.parseInt(u[1], 10) : 1, f = r ? d === 1 ? "<ol>" : `<ol start="${d}">` : l ? "<ul class=\"an-checklist\">" : "<ul>", p = r ? "</ol>" : "</ul>";
|
|
2162
2247
|
return {
|
|
2163
2248
|
html: `${f}${i.map(({ paras: e, isCB: t, checked: n, sub: r }) => {
|
|
2164
2249
|
let i = t ? `<input type="checkbox" contenteditable="false"${n ? " checked" : ""}>` : "";
|
|
@@ -2167,67 +2252,90 @@ function Mn(e, t) {
|
|
|
2167
2252
|
endIdx: c
|
|
2168
2253
|
};
|
|
2169
2254
|
}
|
|
2170
|
-
var
|
|
2171
|
-
function
|
|
2255
|
+
var Gn = /\\([!"#$%&'()*+,\-./:;<=>?@[\\\]^_`{|}~])/g, Kn = "\0";
|
|
2256
|
+
function qn(e) {
|
|
2172
2257
|
let t = [];
|
|
2173
2258
|
return {
|
|
2174
|
-
text: e.replace(
|
|
2259
|
+
text: e.replace(Gn, (e, n) => (t.push(n), `${Kn}${t.length - 1}${Kn}`)),
|
|
2175
2260
|
literals: t
|
|
2176
2261
|
};
|
|
2177
2262
|
}
|
|
2178
|
-
function
|
|
2179
|
-
return e.replace(RegExp(`${
|
|
2263
|
+
function Jn(e, t) {
|
|
2264
|
+
return e.replace(RegExp(`${Kn}(\\d+)${Kn}`, "g"), (e, n) => rr(t[Number(n)]));
|
|
2265
|
+
}
|
|
2266
|
+
var Yn = String.raw`(<.*?>(?:\s+(?:"[^"]*"|'[^']*'))?|[^)]*)`, Xn = new RegExp(String.raw`!\[([^\]]*)\]\(${Yn}\)`, "g"), Zn = new RegExp(String.raw`\[([^\]]+)\]\(${Yn}\)`, "g");
|
|
2267
|
+
function Qn(e) {
|
|
2268
|
+
let t = e.trim(), n = /^<([^]*?)>\s*(?:"([^"]*)"|'([^']*)')?\s*$/.exec(t);
|
|
2269
|
+
if (n) return {
|
|
2270
|
+
href: n[1],
|
|
2271
|
+
title: n[2] ?? n[3] ?? ""
|
|
2272
|
+
};
|
|
2273
|
+
let r = /^(\S+)\s+(?:"([^"]*)"|'([^']*)')\s*$/.exec(t);
|
|
2274
|
+
return r ? {
|
|
2275
|
+
href: r[1],
|
|
2276
|
+
title: r[2] ?? r[3] ?? ""
|
|
2277
|
+
} : {
|
|
2278
|
+
href: t,
|
|
2279
|
+
title: ""
|
|
2280
|
+
};
|
|
2180
2281
|
}
|
|
2181
|
-
function
|
|
2182
|
-
return e = e.replace(
|
|
2183
|
-
let r =
|
|
2282
|
+
function $n(e) {
|
|
2283
|
+
return e = e.replace(Xn, (e, t, n) => {
|
|
2284
|
+
let { href: r, title: i } = Qn(n), a = i ? ` title="${z(i)}"` : "";
|
|
2285
|
+
return `<img src="${z(r)}" alt="${z(t)}"${a} class="an-image">`;
|
|
2286
|
+
}), e = e.replace(Zn, (e, t, n) => {
|
|
2287
|
+
let { href: r, title: i } = Qn(n), a = i ? ` title="${z(i)}"` : "";
|
|
2288
|
+
return `<a href="${z(r)}"${a}>${t}</a>`;
|
|
2289
|
+
}), e = e.replace(/\[([^\]]+)\]\[([^\]]*)\]/g, (e, t, n) => {
|
|
2290
|
+
let r = In.get(ir(n || t).trim().toLowerCase());
|
|
2184
2291
|
if (!r) return e;
|
|
2185
2292
|
let i = r.title ? ` title="${R(r.title)}"` : "";
|
|
2186
2293
|
return `<a href="${R(r.href)}"${i}>${t}</a>`;
|
|
2187
2294
|
}), e = e.replace(/\[([^\]]+)\]/g, (e, t) => {
|
|
2188
|
-
let n =
|
|
2295
|
+
let n = In.get(ir(t).trim().toLowerCase());
|
|
2189
2296
|
if (!n) return e;
|
|
2190
2297
|
let r = n.title ? ` title="${R(n.title)}"` : "";
|
|
2191
2298
|
return `<a href="${R(n.href)}"${r}>${t}</a>`;
|
|
2192
|
-
}), e = e.replace(/\[\^([^\]]+)\]/g, (e, t) =>
|
|
2299
|
+
}), e = e.replace(/\[\^([^\]]+)\]/g, (e, t) => Ln.has(ir(t)) ? `<sup>[${t}]</sup>` : e), e;
|
|
2193
2300
|
}
|
|
2194
|
-
function
|
|
2195
|
-
return e = e.replace(/<(https?:\/\/[^\s&]+?)>/g, (e, t) => `<a href="${
|
|
2301
|
+
function er(e) {
|
|
2302
|
+
return e = e.replace(/<(https?:\/\/[^\s&]+?)>/g, (e, t) => `<a href="${z(t)}">${t}</a>`), e = e.replace(/<([\w.!#$%&'*+/=?^`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+)>/g, (e, t) => `<a href="mailto:${z(t)}">${t}</a>`), e = e.replace(/(^|[\s(])(https?:\/\/[^\s()]+)/g, (e, t, n) => {
|
|
2196
2303
|
let r = /[.,;:!?)]+$/.exec(n), i = r ? n.slice(0, -r[0].length) : n;
|
|
2197
2304
|
if (!i) return e;
|
|
2198
2305
|
let a = r ? r[0] : "";
|
|
2199
|
-
return `${t}<a href="${
|
|
2306
|
+
return `${t}<a href="${z(i)}">${i}</a>${a}`;
|
|
2200
2307
|
}), e;
|
|
2201
2308
|
}
|
|
2202
|
-
function
|
|
2309
|
+
function tr(e) {
|
|
2203
2310
|
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
2311
|
}
|
|
2205
2312
|
function L(e) {
|
|
2206
|
-
let { text: t, literals: n } =
|
|
2207
|
-
return r =
|
|
2313
|
+
let { text: t, literals: n } = qn(e), r = rr(t);
|
|
2314
|
+
return r = $n(r), r = er(r), r = tr(r), Jn(r, n);
|
|
2208
2315
|
}
|
|
2209
|
-
|
|
2210
|
-
|
|
2316
|
+
var nr = /&(?!#\d+;|#[xX][0-9a-fA-F]+;|[a-zA-Z][a-zA-Z0-9]*;)/g;
|
|
2317
|
+
function rr(e) {
|
|
2318
|
+
return String(e).replace(nr, "&").replaceAll("<", "<").replaceAll(">", ">");
|
|
2211
2319
|
}
|
|
2212
2320
|
function R(e) {
|
|
2213
2321
|
return String(e).replaceAll("&", "&").replaceAll("\"", """).replaceAll("'", "'").replaceAll("<", "<").replaceAll(">", ">");
|
|
2214
2322
|
}
|
|
2215
|
-
function
|
|
2323
|
+
function z(e) {
|
|
2216
2324
|
return String(e).replaceAll("\"", """).replaceAll("'", "'");
|
|
2217
2325
|
}
|
|
2218
|
-
function
|
|
2326
|
+
function ir(e) {
|
|
2219
2327
|
return String(e).replaceAll("<", "<").replaceAll(">", ">").replaceAll("&", "&");
|
|
2220
2328
|
}
|
|
2221
2329
|
//#endregion
|
|
2222
2330
|
//#region src/js/core/detectLang.js
|
|
2223
|
-
function
|
|
2331
|
+
function ar(e) {
|
|
2224
2332
|
if (!e?.trim()) return null;
|
|
2225
2333
|
let t = e.trim();
|
|
2226
2334
|
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
2335
|
}
|
|
2228
2336
|
//#endregion
|
|
2229
2337
|
//#region src/js/module/Editor.js
|
|
2230
|
-
var
|
|
2338
|
+
var or = class {
|
|
2231
2339
|
constructor(e) {
|
|
2232
2340
|
this.context = e, this.options = e.options, this._history = null, this._disposers = [], this._snapshotTimer = null;
|
|
2233
2341
|
}
|
|
@@ -2425,7 +2533,7 @@ var Wn = class {
|
|
|
2425
2533
|
e && (D("insertText", e), this.afterCommand());
|
|
2426
2534
|
}
|
|
2427
2535
|
setMarkdown(e) {
|
|
2428
|
-
this.setHTML(
|
|
2536
|
+
this.setHTML(Pn(e || ""));
|
|
2429
2537
|
}
|
|
2430
2538
|
getMarkdown() {
|
|
2431
2539
|
return _n(this.getHTML());
|
|
@@ -2514,7 +2622,7 @@ var Wn = class {
|
|
|
2514
2622
|
if (e?.rangeCount > 0) {
|
|
2515
2623
|
let t = e.getRangeAt(0).commonAncestorContainer, n = t.nodeType === 1 ? t.closest("pre") : t.parentElement?.closest("pre");
|
|
2516
2624
|
if (n && !n.dataset.language) {
|
|
2517
|
-
let e =
|
|
2625
|
+
let e = ar(n.textContent || "");
|
|
2518
2626
|
if (e) {
|
|
2519
2627
|
this.context.invoke("codeTooltip.applyLanguage", n, e);
|
|
2520
2628
|
return;
|
|
@@ -2588,44 +2696,44 @@ var Wn = class {
|
|
|
2588
2696
|
_escapeAttr(e) {
|
|
2589
2697
|
return String(e ?? "").replaceAll("&", "&").replaceAll("\"", """).replaceAll("<", "<").replaceAll(">", ">");
|
|
2590
2698
|
}
|
|
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
|
-
]),
|
|
2699
|
+
}, sr = (e) => typeof e == "string" ? et(e) : e, B = null, cr = "stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"", V = (e) => `<svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="none" ${cr} style="display:block">${e}</svg>`, H = /* @__PURE__ */ new Map([
|
|
2700
|
+
["bold", V("<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\"/>")],
|
|
2701
|
+
["italic", V("<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\"/>")],
|
|
2702
|
+
["underline", V("<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\"/>")],
|
|
2703
|
+
["strikethrough", V("<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\"/>")],
|
|
2704
|
+
["superscript", V("<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\"/>")],
|
|
2705
|
+
["subscript", V("<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\"/>")],
|
|
2706
|
+
["align-left", V("<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\"/>")],
|
|
2707
|
+
["align-center", V("<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\"/>")],
|
|
2708
|
+
["align-right", V("<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\"/>")],
|
|
2709
|
+
["align-justify", V("<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\"/>")],
|
|
2710
|
+
["list-ul", V("<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\"/>")],
|
|
2711
|
+
["list-ol", V("<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\"/>")],
|
|
2712
|
+
["indent", V("<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\"/>")],
|
|
2713
|
+
["outdent", V("<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\"/>")],
|
|
2714
|
+
["undo", V("<path d=\"M3 7v6h6\"/><path d=\"M21 17a9 9 0 0 0-9-9 9 9 0 0 0-6 2.3L3 13\"/>")],
|
|
2715
|
+
["redo", V("<path d=\"M21 7v6h-6\"/><path d=\"M3 17a9 9 0 0 1 9-9 9 9 0 0 1 6 2.3L21 13\"/>")],
|
|
2716
|
+
["minus", V("<line x1=\"5\" y1=\"12\" x2=\"19\" y2=\"12\"/>")],
|
|
2717
|
+
["link", V("<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\"/>")],
|
|
2718
|
+
["image", V("<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\"/>")],
|
|
2719
|
+
["video", V("<polygon points=\"23 7 16 12 23 17 23 7\"/><rect x=\"1\" y=\"5\" width=\"15\" height=\"14\" rx=\"2\"/>")],
|
|
2720
|
+
["table", V("<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\"/>")],
|
|
2721
|
+
["emoji", V("<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\"/>")],
|
|
2722
|
+
["icon", V("<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\"/>")],
|
|
2723
|
+
["code", V("<polyline points=\"16 18 22 12 16 6\"/><polyline points=\"8 6 2 12 8 18\"/>")],
|
|
2724
|
+
["expand", V("<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\"/>")],
|
|
2725
|
+
["foreColor", V("<path d=\"M4 20L12 4L20 20\"/><line x1=\"7.5\" y1=\"14\" x2=\"16.5\" y2=\"14\"/>")],
|
|
2726
|
+
["backColor", V("<path d=\"M3 21v-4l9-9 4 4-9 9z\"/><path d=\"M12 8l4 4\"/>")],
|
|
2727
|
+
["keyboard", V("<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\"/>")],
|
|
2728
|
+
["caption", V("<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\"/>")],
|
|
2729
|
+
["remove-format", V("<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\"/>")],
|
|
2730
|
+
["direction", V("<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\"/>")],
|
|
2731
|
+
["search", V("<circle cx=\"11\" cy=\"11\" r=\"7\"/><line x1=\"21\" y1=\"21\" x2=\"16.65\" y2=\"16.65\"/>")],
|
|
2732
|
+
["find-replace", V("<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\"/>")],
|
|
2733
|
+
["inline-code", V("<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\"/>")],
|
|
2734
|
+
["checklist", V("<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\"/>")],
|
|
2735
|
+
["print", V("<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\"/>")]
|
|
2736
|
+
]), lr = /* @__PURE__ */ new Map([
|
|
2629
2737
|
["bold", "fa-bold"],
|
|
2630
2738
|
["italic", "fa-italic"],
|
|
2631
2739
|
["underline", "fa-underline"],
|
|
@@ -2659,7 +2767,7 @@ var Wn = class {
|
|
|
2659
2767
|
["inline-code", "fa-code"],
|
|
2660
2768
|
["checklist", "fa-list-check"],
|
|
2661
2769
|
["print", "fa-print"]
|
|
2662
|
-
]),
|
|
2770
|
+
]), ur = class {
|
|
2663
2771
|
constructor(e) {
|
|
2664
2772
|
this.context = e, this.options = e.options, this.el = null, this._disposers = [], this._colorPickerClosers = [], this._refreshRaf = null;
|
|
2665
2773
|
}
|
|
@@ -2669,7 +2777,7 @@ var Wn = class {
|
|
|
2669
2777
|
role: "toolbar",
|
|
2670
2778
|
"aria-orientation": "horizontal",
|
|
2671
2779
|
"aria-label": "Editor toolbar"
|
|
2672
|
-
}), this._faReady = this._detectFontAwesome(), this._buildButtons(), this._initRovingFocus(), this._btnMap = new Map((this.options.toolbar || []).flat().map(
|
|
2780
|
+
}), this._faReady = this._detectFontAwesome(), this._buildButtons(), this._initRovingFocus(), this._btnMap = new Map((this.options.toolbar || []).flat().map(sr).filter(Boolean).map((e) => [e.name, e])), this;
|
|
2673
2781
|
}
|
|
2674
2782
|
destroy() {
|
|
2675
2783
|
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 +2787,7 @@ var Wn = class {
|
|
|
2679
2787
|
e.forEach((e) => {
|
|
2680
2788
|
let n = w("div", { class: "an-btn-group" });
|
|
2681
2789
|
e.forEach((e) => {
|
|
2682
|
-
let t =
|
|
2790
|
+
let t = sr(e);
|
|
2683
2791
|
if (!t) {
|
|
2684
2792
|
console.warn(`[AutumnNote] Toolbar: button "${e}" not found in registry. Skipped.`);
|
|
2685
2793
|
return;
|
|
@@ -2898,9 +3006,9 @@ var Wn = class {
|
|
|
2898
3006
|
...typeof e.isActive == "function" ? { "aria-pressed": "false" } : {}
|
|
2899
3007
|
}), n = this.options.fontAwesomeClass || "fas";
|
|
2900
3008
|
if (this._faReady) {
|
|
2901
|
-
let r =
|
|
2902
|
-
r ? t.innerHTML = `<i class="${n} ${r}" aria-hidden="true"></i>` :
|
|
2903
|
-
} else
|
|
3009
|
+
let r = lr.get(e.icon) || lr.get(e.name) || null;
|
|
3010
|
+
r ? t.innerHTML = `<i class="${n} ${r}" aria-hidden="true"></i>` : H.has(e.icon) ? t.innerHTML = H.get(e.icon) : t.textContent = e.icon || e.name;
|
|
3011
|
+
} else H.has(e.icon) ? t.innerHTML = H.get(e.icon) : H.has(e.name) ? t.innerHTML = H.get(e.name) : t.textContent = e.icon || e.name;
|
|
2904
3012
|
let r = E(t, "click", (t) => {
|
|
2905
3013
|
t.preventDefault(), this.context.invoke("editor.focus"), e.action(this.context), this.context.invoke("editor.afterCommand"), this.refresh();
|
|
2906
3014
|
});
|
|
@@ -2944,10 +3052,10 @@ var Wn = class {
|
|
|
2944
3052
|
}
|
|
2945
3053
|
_detectFontAwesome() {
|
|
2946
3054
|
if (!this.options.useFontAwesome) return !1;
|
|
2947
|
-
if (
|
|
2948
|
-
if (document.querySelector(".fa, .fas, .far, .fal, .fab, .fa-solid")) return
|
|
3055
|
+
if (B !== null) return B;
|
|
3056
|
+
if (document.querySelector(".fa, .fas, .far, .fal, .fab, .fa-solid")) return B = !0, !0;
|
|
2949
3057
|
let e = Array.from(document.querySelectorAll("link[rel=\"stylesheet\"]")).filter((e) => e.id !== "an-fontawesome-css").map((e) => e.href || "").join(" ");
|
|
2950
|
-
return
|
|
3058
|
+
return B = /fontawesome|font-awesome|use\.fontawesome|all\.css/.test(e), B;
|
|
2951
3059
|
}
|
|
2952
3060
|
refresh() {
|
|
2953
3061
|
this._refreshRaf && cancelAnimationFrame(this._refreshRaf), this._refreshRaf = requestAnimationFrame(() => {
|
|
@@ -2980,27 +3088,27 @@ var Wn = class {
|
|
|
2980
3088
|
this.el && (this.el.style.display = "none");
|
|
2981
3089
|
}
|
|
2982
3090
|
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(
|
|
3091
|
+
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(sr).filter(Boolean).map((e) => [e.name, e])), this.refresh();
|
|
2984
3092
|
}
|
|
2985
|
-
},
|
|
2986
|
-
function
|
|
3093
|
+
}, dr = typeof Intl < "u" && typeof Intl.Segmenter == "function" ? new Intl.Segmenter(void 0, { granularity: "word" }) : null;
|
|
3094
|
+
function fr(e) {
|
|
2987
3095
|
let t = e.trim();
|
|
2988
3096
|
if (!t) return 0;
|
|
2989
|
-
if (
|
|
3097
|
+
if (dr) {
|
|
2990
3098
|
let e = 0;
|
|
2991
|
-
for (let n of
|
|
3099
|
+
for (let n of dr.segment(t)) n.isWordLike && e++;
|
|
2992
3100
|
return e;
|
|
2993
3101
|
}
|
|
2994
3102
|
return t.split(/\s+/).length;
|
|
2995
3103
|
}
|
|
2996
|
-
function
|
|
3104
|
+
function pr(e, t, n) {
|
|
2997
3105
|
if (!n) {
|
|
2998
3106
|
e.classList.remove("an-count-warn", "an-count-exceeded");
|
|
2999
3107
|
return;
|
|
3000
3108
|
}
|
|
3001
3109
|
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
3110
|
}
|
|
3003
|
-
var
|
|
3111
|
+
var mr = class {
|
|
3004
3112
|
constructor(e) {
|
|
3005
3113
|
this.context = e, this.options = e.options, this.el = null, this._disposers = [], this._wordCountEl = null, this._charCountEl = null;
|
|
3006
3114
|
}
|
|
@@ -3053,17 +3161,17 @@ var $n = class {
|
|
|
3053
3161
|
}
|
|
3054
3162
|
update() {
|
|
3055
3163
|
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),
|
|
3164
|
+
let e = this.context.layoutInfo.editable.textContent || "", t = fr(e), n = e.replaceAll("\n", "").length, r = this.options.maxWords || 0, i = this.options.maxChars || 0, a = this.context.locale.statusbar;
|
|
3165
|
+
this._wordCountEl.textContent = r ? a.wordsLimit(t, r) : a.words(t), this._charCountEl.textContent = i ? a.charsLimit(n, i) : a.chars(n), pr(this._wordCountEl, t, r), pr(this._charCountEl, n, i);
|
|
3058
3166
|
}
|
|
3059
3167
|
getWordCount() {
|
|
3060
3168
|
let e = this.context.layoutInfo.editable;
|
|
3061
|
-
return
|
|
3169
|
+
return fr(e.innerText || "");
|
|
3062
3170
|
}
|
|
3063
3171
|
getCharCount() {
|
|
3064
3172
|
return (this.context.layoutInfo.editable.innerText || "").replaceAll("\n", "").length;
|
|
3065
3173
|
}
|
|
3066
|
-
},
|
|
3174
|
+
}, hr = class {
|
|
3067
3175
|
constructor(e) {
|
|
3068
3176
|
this.context = e, this.options = e.options, this._disposers = [];
|
|
3069
3177
|
}
|
|
@@ -3180,8 +3288,8 @@ var $n = class {
|
|
|
3180
3288
|
}
|
|
3181
3289
|
if (this.options.markdownPaste !== !1) {
|
|
3182
3290
|
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(
|
|
3291
|
+
if (a && i && En(a)) {
|
|
3292
|
+
e.preventDefault(), D("insertHTML", M(Pn(a))), this.context.invoke("editor.afterCommand");
|
|
3185
3293
|
return;
|
|
3186
3294
|
}
|
|
3187
3295
|
}
|
|
@@ -3220,7 +3328,7 @@ var $n = class {
|
|
|
3220
3328
|
}
|
|
3221
3329
|
let n = new FileReader();
|
|
3222
3330
|
n.onload = (e) => {
|
|
3223
|
-
D("insertHTML", M(
|
|
3331
|
+
D("insertHTML", M(Pn(e.target.result || ""))), this.context.invoke("editor.afterCommand");
|
|
3224
3332
|
}, n.onerror = () => {
|
|
3225
3333
|
let t = `Failed to read dropped markdown file "${e.name}".`;
|
|
3226
3334
|
console.warn(`[AutumnNote] ${t}`), this.context.triggerEvent("pasteError", { message: t });
|
|
@@ -3322,7 +3430,7 @@ var $n = class {
|
|
|
3322
3430
|
_escapeHTML(e) {
|
|
3323
3431
|
return e.replaceAll("&", "&").replaceAll("<", "<").replaceAll(">", ">").replaceAll("\"", """).replaceAll("'", "'");
|
|
3324
3432
|
}
|
|
3325
|
-
},
|
|
3433
|
+
}, gr = class {
|
|
3326
3434
|
constructor(e) {
|
|
3327
3435
|
this.context = e, this.options = e.options, this._disposers = [];
|
|
3328
3436
|
}
|
|
@@ -3339,7 +3447,7 @@ var $n = class {
|
|
|
3339
3447
|
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
3448
|
e.classList.toggle("an-placeholder", n && !t);
|
|
3341
3449
|
}
|
|
3342
|
-
},
|
|
3450
|
+
}, _r = class {
|
|
3343
3451
|
constructor(e) {
|
|
3344
3452
|
this.context = e, this.options = e.options, this._active = !1, this._textarea = null, this._disposers = [];
|
|
3345
3453
|
}
|
|
@@ -3384,7 +3492,7 @@ var $n = class {
|
|
|
3384
3492
|
return /^<[^/!][^>]*[^/]>/.test(r) && !t.test(r) && !/^<(br|hr|img|input|link|meta)/.test(r) && n++, i;
|
|
3385
3493
|
}).filter(Boolean).join("\n");
|
|
3386
3494
|
}
|
|
3387
|
-
},
|
|
3495
|
+
}, vr = class {
|
|
3388
3496
|
constructor(e) {
|
|
3389
3497
|
this.context = e, this._active = !1, this._disposers = [], this._prevHeight = "";
|
|
3390
3498
|
}
|
|
@@ -3413,7 +3521,7 @@ var $n = class {
|
|
|
3413
3521
|
let e = this.context.layoutInfo.container;
|
|
3414
3522
|
e.classList.remove("an-fullscreen"), e.style.height = this._prevHeight, document.body.style.overflow = "", this._active = !1, this.context.invoke("toolbar.refresh");
|
|
3415
3523
|
}
|
|
3416
|
-
},
|
|
3524
|
+
}, U = class {
|
|
3417
3525
|
constructor(e) {
|
|
3418
3526
|
this.context = e, this.options = e.options, this._dialog = null, this._disposers = [], this._savedRange = null, this._firstInput = null, this._removeTrap = null;
|
|
3419
3527
|
}
|
|
@@ -3469,12 +3577,12 @@ var $n = class {
|
|
|
3469
3577
|
let o = E(i, "click", n), s = E(a, "click", () => this._close());
|
|
3470
3578
|
return this._disposers.push(o, s), r;
|
|
3471
3579
|
}
|
|
3472
|
-
},
|
|
3580
|
+
}, yr = "<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>", br = class extends U {
|
|
3473
3581
|
show() {
|
|
3474
3582
|
this._saveRange(), this._prefill(), this._open();
|
|
3475
3583
|
}
|
|
3476
3584
|
_buildDialog() {
|
|
3477
|
-
let e = this.context.locale.linkDialog, { overlay: t, box: n } = this._buildDialogShell(e.ariaLabel,
|
|
3585
|
+
let e = this.context.locale.linkDialog, { overlay: t, box: n } = this._buildDialogShell(e.ariaLabel, yr, e.title), r = w("label", { class: "an-label" });
|
|
3478
3586
|
r.textContent = e.url;
|
|
3479
3587
|
let i = w("input", {
|
|
3480
3588
|
type: "url",
|
|
@@ -3544,12 +3652,12 @@ var $n = class {
|
|
|
3544
3652
|
}
|
|
3545
3653
|
this._savedRange && this._savedRange.select(), this.context.invoke("editor.insertLink", e, t, n), this._close();
|
|
3546
3654
|
}
|
|
3547
|
-
},
|
|
3655
|
+
}, xr = "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"20\" height=\"20\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><rect x=\"3\" y=\"3\" width=\"18\" height=\"18\" rx=\"2\"/><circle cx=\"8.5\" cy=\"8.5\" r=\"1.5\"/><polyline points=\"21 15 16 10 5 21\"/></svg>", Sr = class extends U {
|
|
3548
3656
|
show({ beforeInsert: e } = {}) {
|
|
3549
3657
|
this._beforeInsert = typeof e == "function" ? e : null, this._saveRange(), this._urlInput.value = "", this._altInput.value = "", this._fileInput && (this._fileInput.value = ""), this._open();
|
|
3550
3658
|
}
|
|
3551
3659
|
_buildDialog() {
|
|
3552
|
-
let e = this.context.locale.imageDialog, { overlay: t, box: n } = this._buildDialogShell(e.ariaLabel,
|
|
3660
|
+
let e = this.context.locale.imageDialog, { overlay: t, box: n } = this._buildDialogShell(e.ariaLabel, xr, e.title), r = w("label", { class: "an-label" });
|
|
3553
3661
|
r.textContent = e.imageUrl;
|
|
3554
3662
|
let i = w("input", {
|
|
3555
3663
|
type: "url",
|
|
@@ -3676,12 +3784,12 @@ var $n = class {
|
|
|
3676
3784
|
_close() {
|
|
3677
3785
|
this._beforeInsert = null, super._close();
|
|
3678
3786
|
}
|
|
3679
|
-
},
|
|
3787
|
+
}, Cr = "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"20\" height=\"20\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><polygon points=\"23 7 16 12 23 17 23 7\"/><rect x=\"1\" y=\"5\" width=\"15\" height=\"14\" rx=\"2\"/></svg>", wr = class extends U {
|
|
3680
3788
|
show() {
|
|
3681
3789
|
this._saveRange(), this._urlInput.value = "", this._widthInput.value = "560", this._hintEl.textContent = "", this._open();
|
|
3682
3790
|
}
|
|
3683
3791
|
_buildDialog() {
|
|
3684
|
-
let e = this.context.locale.videoDialog, { overlay: t, box: n } = this._buildDialogShell(e.ariaLabel,
|
|
3792
|
+
let e = this.context.locale.videoDialog, { overlay: t, box: n } = this._buildDialogShell(e.ariaLabel, Cr, e.title), r = w("label", { class: "an-label" });
|
|
3685
3793
|
r.textContent = e.videoUrl;
|
|
3686
3794
|
let i = w("input", {
|
|
3687
3795
|
type: "url",
|
|
@@ -3762,7 +3870,7 @@ var $n = class {
|
|
|
3762
3870
|
let i = sn(e, { media: !0 });
|
|
3763
3871
|
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
3872
|
}
|
|
3765
|
-
},
|
|
3873
|
+
}, Tr = [
|
|
3766
3874
|
{
|
|
3767
3875
|
pos: "nw",
|
|
3768
3876
|
cursor: "nw-resize"
|
|
@@ -3795,7 +3903,7 @@ var $n = class {
|
|
|
3795
3903
|
pos: "w",
|
|
3796
3904
|
cursor: "w-resize"
|
|
3797
3905
|
}
|
|
3798
|
-
],
|
|
3906
|
+
], Er = class {
|
|
3799
3907
|
constructor(e) {
|
|
3800
3908
|
this.context = e, this._active = null, this._overlay = null, this._disposers = [], this._positionRaf = null, this._lastOverlayPos = null;
|
|
3801
3909
|
}
|
|
@@ -3848,7 +3956,7 @@ var $n = class {
|
|
|
3848
3956
|
}
|
|
3849
3957
|
_buildOverlay() {
|
|
3850
3958
|
let e = document.createElement("div");
|
|
3851
|
-
return e.className = this._overlayClass, e.style.display = "none",
|
|
3959
|
+
return e.className = this._overlayClass, e.style.display = "none", Tr.forEach(({ pos: t }) => {
|
|
3852
3960
|
let n = document.createElement("div");
|
|
3853
3961
|
n.className = `an-resize-handle an-resize-${t}`, n.dataset.handle = t, this._disposers.push(E(n, "pointerdown", (e) => {
|
|
3854
3962
|
e.preventDefault(), e.stopPropagation(), this._startResize(e, t);
|
|
@@ -3905,7 +4013,7 @@ var $n = class {
|
|
|
3905
4013
|
};
|
|
3906
4014
|
document.addEventListener("pointermove", p), document.addEventListener("pointerup", h), document.addEventListener("pointercancel", h), this._dragDisposers = [m];
|
|
3907
4015
|
}
|
|
3908
|
-
},
|
|
4016
|
+
}, Dr = class extends Er {
|
|
3909
4017
|
get _overlayClass() {
|
|
3910
4018
|
return "an-image-resizer";
|
|
3911
4019
|
}
|
|
@@ -3934,7 +4042,7 @@ var $n = class {
|
|
|
3934
4042
|
getActiveImage() {
|
|
3935
4043
|
return this._active;
|
|
3936
4044
|
}
|
|
3937
|
-
},
|
|
4045
|
+
}, Or = class extends Er {
|
|
3938
4046
|
get _overlayClass() {
|
|
3939
4047
|
return "an-video-resizer";
|
|
3940
4048
|
}
|
|
@@ -3970,12 +4078,12 @@ var $n = class {
|
|
|
3970
4078
|
getActiveWrapper() {
|
|
3971
4079
|
return this._active;
|
|
3972
4080
|
}
|
|
3973
|
-
},
|
|
4081
|
+
}, kr = {
|
|
3974
4082
|
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
4083
|
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
4084
|
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
4085
|
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
|
-
},
|
|
4086
|
+
}, Ar = 120, jr = 200, Mr = class {
|
|
3979
4087
|
constructor(e) {
|
|
3980
4088
|
this.context = e, this._el = null, this._activeAnchor = null, this._showTimer = null, this._hideTimer = null, this._disposers = [];
|
|
3981
4089
|
}
|
|
@@ -3999,7 +4107,7 @@ var $n = class {
|
|
|
3999
4107
|
role: "toolbar",
|
|
4000
4108
|
"aria-label": e.ariaLabel
|
|
4001
4109
|
});
|
|
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(
|
|
4110
|
+
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(kr.open, e.openLink, () => this._openLink()), this._copyBtn = this._makeBtn(kr.copy, e.copyUrl, () => this._copyLink()), this._editBtn = this._makeBtn(kr.edit, e.editLink, () => this._editLink()), this._unlinkBtn = this._makeBtn(kr.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
4111
|
}
|
|
4004
4112
|
_makeBtn(e, t, n) {
|
|
4005
4113
|
let r = w("button", {
|
|
@@ -4014,12 +4122,12 @@ var $n = class {
|
|
|
4014
4122
|
_scheduleShow(e) {
|
|
4015
4123
|
this._activeAnchor === e && this._el.style.display !== "none" || (clearTimeout(this._hideTimer), this._hideTimer = null, clearTimeout(this._showTimer), this._showTimer = setTimeout(() => {
|
|
4016
4124
|
this._activeAnchor = e, this._show(e);
|
|
4017
|
-
},
|
|
4125
|
+
}, Ar));
|
|
4018
4126
|
}
|
|
4019
4127
|
_scheduleHide() {
|
|
4020
4128
|
clearTimeout(this._showTimer), this._showTimer = null, !this._hideTimer && (this._hideTimer = setTimeout(() => {
|
|
4021
4129
|
this._hide();
|
|
4022
|
-
},
|
|
4130
|
+
}, jr));
|
|
4023
4131
|
}
|
|
4024
4132
|
_show(e) {
|
|
4025
4133
|
let t = this.context.layoutInfo.container.classList.contains("an-disabled"), n = e.getAttribute("href") || "";
|
|
@@ -4068,7 +4176,7 @@ var $n = class {
|
|
|
4068
4176
|
let t = globalThis.getSelection(), n = document.createRange();
|
|
4069
4177
|
n.selectNode(e), t.removeAllRanges(), t.addRange(n), document.execCommand("unlink"), this.context.invoke("editor.afterCommand");
|
|
4070
4178
|
}
|
|
4071
|
-
},
|
|
4179
|
+
}, Nr = class {
|
|
4072
4180
|
constructor(e) {
|
|
4073
4181
|
this.context = e, this.options = e.options, this._el = null, this._active = null, this._showTimer = null, this._hideTimer = null, this._disposers = [];
|
|
4074
4182
|
}
|
|
@@ -4109,7 +4217,7 @@ var $n = class {
|
|
|
4109
4217
|
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
4218
|
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
4219
|
}
|
|
4112
|
-
},
|
|
4220
|
+
}, W = {
|
|
4113
4221
|
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
4222
|
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
4223
|
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 +4228,7 @@ var $n = class {
|
|
|
4120
4228
|
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
4229
|
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
4230
|
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
|
-
},
|
|
4231
|
+
}, Pr = class extends Nr {
|
|
4124
4232
|
initialize() {
|
|
4125
4233
|
this._el = this._buildTooltip(), document.body.appendChild(this._el);
|
|
4126
4234
|
let e = this.context.layoutInfo.editable;
|
|
@@ -4145,7 +4253,7 @@ var $n = class {
|
|
|
4145
4253
|
role: "toolbar",
|
|
4146
4254
|
"aria-label": e.ariaLabel
|
|
4147
4255
|
});
|
|
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(
|
|
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" })), t.appendChild(this._makeBtn(W.rotateLeft, e.rotateLeft, () => this._rotate(-90))), t.appendChild(this._makeBtn(W.rotateRight, e.rotateRight, () => this._rotate(90))), t.appendChild(w("div", { class: "an-link-tooltip-sep" })), this._cropBtn = this._makeBtn(W.crop, e.cropImage, () => this._crop()), t.appendChild(this._cropBtn), t.appendChild(w("div", { class: "an-link-tooltip-sep" })), this._captionBtn = this._makeBtn(W.caption, e.addCaption, () => this._toggleCaption()), t.appendChild(this._captionBtn), t.appendChild(w("div", { class: "an-link-tooltip-sep" })), this._deleteBtn = this._makeBtn(W.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
4257
|
}
|
|
4150
4258
|
_setFloat(e) {
|
|
4151
4259
|
let t = this._active;
|
|
@@ -4212,7 +4320,7 @@ var $n = class {
|
|
|
4212
4320
|
let a = globalThis.getSelection();
|
|
4213
4321
|
a && (a.removeAllRanges(), a.addRange(i)), this.context.invoke("editor.afterCommand"), this.context.invoke("imageResizer.updateOverlay"), this._hide();
|
|
4214
4322
|
}
|
|
4215
|
-
},
|
|
4323
|
+
}, G = {
|
|
4216
4324
|
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
4325
|
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
4326
|
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 +4328,7 @@ var $n = class {
|
|
|
4220
4328
|
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
4329
|
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
4330
|
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
|
-
},
|
|
4331
|
+
}, Fr = class extends Nr {
|
|
4224
4332
|
initialize() {
|
|
4225
4333
|
this._el = this._buildTooltip(), document.body.appendChild(this._el);
|
|
4226
4334
|
let e = this.context.layoutInfo.editable;
|
|
@@ -4251,7 +4359,7 @@ var $n = class {
|
|
|
4251
4359
|
role: "toolbar",
|
|
4252
4360
|
"aria-label": e.ariaLabel
|
|
4253
4361
|
});
|
|
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(
|
|
4362
|
+
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(G.floatLeft, e.floatLeft, () => this._setFloat("left")), this._floatNoneBtn = this._makeBtn(G.floatNone, e.noFloat, () => this._setFloat("")), this._alignCenterBtn = this._makeBtn(G.alignCenter, e.alignCenter, () => this._setCenter()), this._floatRightBtn = this._makeBtn(G.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(G.originalSize, e.originalSize, () => this._resetSize()), t.appendChild(this._originalBtn), t.appendChild(w("div", { class: "an-link-tooltip-sep" })), this._previewBtn = this._makeBtn(G.preview, e.previewVideo, () => this._togglePreview()), t.appendChild(this._previewBtn), t.appendChild(w("div", { class: "an-link-tooltip-sep" })), this._deleteBtn = this._makeBtn(G.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
4363
|
}
|
|
4256
4364
|
_setFloat(e) {
|
|
4257
4365
|
let t = this._active;
|
|
@@ -4298,7 +4406,7 @@ var $n = class {
|
|
|
4298
4406
|
}
|
|
4299
4407
|
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
4408
|
}
|
|
4301
|
-
},
|
|
4409
|
+
}, K = {
|
|
4302
4410
|
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
4411
|
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
4412
|
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 +4434,7 @@ var $n = class {
|
|
|
4326
4434
|
};
|
|
4327
4435
|
//#endregion
|
|
4328
4436
|
//#region src/js/module/table-grid.js
|
|
4329
|
-
function
|
|
4437
|
+
function Ir(e) {
|
|
4330
4438
|
let t = e.closest("tr");
|
|
4331
4439
|
if (!t) return -1;
|
|
4332
4440
|
let n = 0;
|
|
@@ -4336,7 +4444,7 @@ function xr(e) {
|
|
|
4336
4444
|
}
|
|
4337
4445
|
return -1;
|
|
4338
4446
|
}
|
|
4339
|
-
function
|
|
4447
|
+
function q(e, t) {
|
|
4340
4448
|
let n = 0;
|
|
4341
4449
|
for (let r of e.cells) {
|
|
4342
4450
|
if (n === t) return r;
|
|
@@ -4345,7 +4453,7 @@ function G(e, t) {
|
|
|
4345
4453
|
}
|
|
4346
4454
|
return null;
|
|
4347
4455
|
}
|
|
4348
|
-
function
|
|
4456
|
+
function Lr(e, t) {
|
|
4349
4457
|
let n = 0;
|
|
4350
4458
|
for (let r of e.cells) if (n += r.colSpan || 1, n > t) {
|
|
4351
4459
|
let e = r.nextElementSibling;
|
|
@@ -4353,7 +4461,7 @@ function Sr(e, t) {
|
|
|
4353
4461
|
}
|
|
4354
4462
|
return null;
|
|
4355
4463
|
}
|
|
4356
|
-
function
|
|
4464
|
+
function Rr(e) {
|
|
4357
4465
|
let t = Array.from(e.rows), n = {}, r = /* @__PURE__ */ new WeakMap();
|
|
4358
4466
|
return t.forEach((e, t) => {
|
|
4359
4467
|
n[t] || (n[t] = {});
|
|
@@ -4380,7 +4488,7 @@ function Cr(e) {
|
|
|
4380
4488
|
}
|
|
4381
4489
|
//#endregion
|
|
4382
4490
|
//#region src/js/module/TableTooltip.js
|
|
4383
|
-
var
|
|
4491
|
+
var zr = 120, Br = 200, Vr = [
|
|
4384
4492
|
"#000000",
|
|
4385
4493
|
"#434343",
|
|
4386
4494
|
"#666666",
|
|
@@ -4405,7 +4513,7 @@ var wr = 120, Tr = 200, Er = [
|
|
|
4405
4513
|
"#c9daf8",
|
|
4406
4514
|
"#d9d2e9",
|
|
4407
4515
|
"#ead1dc"
|
|
4408
|
-
],
|
|
4516
|
+
], Hr = class {
|
|
4409
4517
|
constructor(e) {
|
|
4410
4518
|
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
4519
|
}
|
|
@@ -4463,7 +4571,7 @@ var wr = 120, Tr = 200, Er = [
|
|
|
4463
4571
|
});
|
|
4464
4572
|
}), E(e, "mousedown", (e) => {
|
|
4465
4573
|
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 =
|
|
4574
|
+
if (r = !0, i = n, a = e.clientX, o = e.clientY, f = t.closest("table"), i === "col") l = Ir(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
4575
|
else {
|
|
4468
4576
|
let e = t.closest("tr"), n = (e ? Array.from(f.rows).indexOf(e) : 0) + (t.rowSpan || 1) - 1;
|
|
4469
4577
|
d = f.rows[n] || e, c = d ? d.offsetHeight : 40, document.body.style.cursor = "row-resize";
|
|
@@ -4495,27 +4603,27 @@ var wr = 120, Tr = 200, Er = [
|
|
|
4495
4603
|
role: "toolbar",
|
|
4496
4604
|
"aria-label": e.ariaLabel
|
|
4497
4605
|
});
|
|
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(
|
|
4606
|
+
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(K.selectCells, e.selectCells, () => this._toggleSelectMode()), t.appendChild(this._selectBtn), t.appendChild(this._sep()), t.appendChild(this._makeBtn(K.rowAbove, e.addRowAbove, () => this._addRow("above"))), t.appendChild(this._makeBtn(K.rowBelow, e.addRowBelow, () => this._addRow("below"))), t.appendChild(this._makeBtn(K.deleteRow, e.deleteRow, () => this._deleteRow())), t.appendChild(this._sep()), t.appendChild(this._makeBtn(K.colLeft, e.addColumnLeft, () => this._addColumn("left"))), t.appendChild(this._makeBtn(K.colRight, e.addColumnRight, () => this._addColumn("right"))), t.appendChild(this._makeBtn(K.deleteCol, e.deleteColumn, () => this._deleteColumn())), t.appendChild(this._makeBtn(K.sortAsc, e.sortAsc, () => this._sortColumn("asc"))), t.appendChild(this._makeBtn(K.sortDesc, e.sortDesc, () => this._sortColumn("desc"))), t.appendChild(this._sep()), t.appendChild(this._makeBtn(K.mergeCells, e.mergeCells, () => this._mergeCells())), t.appendChild(this._makeBtn(K.unmergeCells, e.unmergeCells, () => this._unmergeCells())), t.appendChild(this._sep()), t.appendChild(this._makeBtn(K.alignLeft, e.cellAlignLeft, () => this._applyCellAlign("left"))), t.appendChild(this._makeBtn(K.alignCenter, e.cellAlignCenter, () => this._applyCellAlign("center"))), t.appendChild(this._makeBtn(K.alignRight, e.cellAlignRight, () => this._applyCellAlign("right"))), t.appendChild(this._makeBtn(K.alignJustify, e.cellAlignJustify, () => this._applyCellAlign("justify"))), t.appendChild(this._makeBtn(K.headerRow, e.toggleHeaderRow, () => this._toggleHeaderRow())), t.appendChild(this._sep());
|
|
4499
4607
|
let n = w("button", {
|
|
4500
4608
|
type: "button",
|
|
4501
4609
|
class: "an-link-tooltip-btn an-link-tooltip-btn--shade",
|
|
4502
4610
|
title: e.cellBackground
|
|
4503
4611
|
}), r = w("span", { class: "an-bubble-btn-svg" });
|
|
4504
|
-
r.innerHTML =
|
|
4612
|
+
r.innerHTML = K.cellShade;
|
|
4505
4613
|
let i = w("span", { class: "an-link-tooltip-color-strip" });
|
|
4506
4614
|
n.appendChild(r), n.appendChild(i), this._shadeColorStrip = i, this._disposers.push(E(n, "click", (e) => {
|
|
4507
4615
|
e.preventDefault(), e.stopPropagation(), this._openCellShadePopover();
|
|
4508
|
-
})), t.appendChild(n), t.appendChild(this._sep()), t.appendChild(this._makeBtn(
|
|
4616
|
+
})), t.appendChild(n), t.appendChild(this._sep()), t.appendChild(this._makeBtn(K.colWidth, e.columnWidth, () => this._openSizePopover("col"))), t.appendChild(this._makeBtn(K.rowHeight, e.rowHeight, () => this._openSizePopover("row"))), t.appendChild(this._makeBtn(K.tableBorder, e.tableBorderWidth, () => this._openSizePopover("border"))), t.appendChild(this._makeBtn(K.cellPadding, e.cellPadding, () => this._openSizePopover("cellPadding")));
|
|
4509
4617
|
let a = w("button", {
|
|
4510
4618
|
type: "button",
|
|
4511
4619
|
class: "an-link-tooltip-btn an-link-tooltip-btn--shade",
|
|
4512
4620
|
title: e.tableBorderColor
|
|
4513
4621
|
}), o = w("span", { class: "an-bubble-btn-svg" });
|
|
4514
|
-
o.innerHTML =
|
|
4622
|
+
o.innerHTML = K.borderColor;
|
|
4515
4623
|
let s = w("span", { class: "an-link-tooltip-color-strip" });
|
|
4516
4624
|
return a.appendChild(o), a.appendChild(s), this._borderColorStrip = s, this._disposers.push(E(a, "click", (e) => {
|
|
4517
4625
|
e.preventDefault(), e.stopPropagation(), this._openBorderColorPopover();
|
|
4518
|
-
})), t.appendChild(a), t.appendChild(this._sep()), t.appendChild(this._makeBtn(
|
|
4626
|
+
})), t.appendChild(a), t.appendChild(this._sep()), t.appendChild(this._makeBtn(K.deleteTable, e.deleteTable, () => this._deleteTable(), !0)), t.appendChild(this._sep()), t.appendChild(this._makeBtn(K.exportCSV, e.exportCSV, () => this._exportTableCSV())), this._disposers.push(E(t, "mouseenter", () => this._clearTimers()), E(t, "mouseleave", () => {
|
|
4519
4627
|
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
4628
|
})), t;
|
|
4521
4629
|
}
|
|
@@ -4535,10 +4643,10 @@ var wr = 120, Tr = 200, Er = [
|
|
|
4535
4643
|
_scheduleShow(e) {
|
|
4536
4644
|
this._activeTable === e && this._el.style.display !== "none" || (clearTimeout(this._hideTimer), this._hideTimer = null, clearTimeout(this._showTimer), this._showTimer = setTimeout(() => {
|
|
4537
4645
|
this._activeTable = e, this._show();
|
|
4538
|
-
},
|
|
4646
|
+
}, zr));
|
|
4539
4647
|
}
|
|
4540
4648
|
_scheduleHide() {
|
|
4541
|
-
clearTimeout(this._showTimer), this._showTimer = null, !this._hideTimer && (this._hideTimer = setTimeout(() => this._hide(),
|
|
4649
|
+
clearTimeout(this._showTimer), this._showTimer = null, !this._hideTimer && (this._hideTimer = setTimeout(() => this._hide(), Br));
|
|
4542
4650
|
}
|
|
4543
4651
|
_show() {
|
|
4544
4652
|
this._activeTable && (this._el.style.display = "flex", this._syncShadeStrip(), this._syncBorderColorStrip(), requestAnimationFrame(() => {
|
|
@@ -4587,7 +4695,7 @@ var wr = 120, Tr = 200, Er = [
|
|
|
4587
4695
|
if (!t || e === t) return [e];
|
|
4588
4696
|
let n = e.closest("table");
|
|
4589
4697
|
if (!n?.contains(t)) return [e];
|
|
4590
|
-
let { gridMap: r, cellPos: i } =
|
|
4698
|
+
let { gridMap: r, cellPos: i } = Rr(n), a = i.get(e), o = i.get(t);
|
|
4591
4699
|
if (!a || !o) return [e];
|
|
4592
4700
|
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
4701
|
for (; d;) {
|
|
@@ -4635,7 +4743,7 @@ var wr = 120, Tr = 200, Er = [
|
|
|
4635
4743
|
if (!t.length) return;
|
|
4636
4744
|
let n = t[0].closest("table");
|
|
4637
4745
|
if (!n) return;
|
|
4638
|
-
let r = t.map((e) =>
|
|
4746
|
+
let r = t.map((e) => Ir(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) : Lr(t, i)), s = a.map((e) => e.closest("thead") !== null);
|
|
4639
4747
|
a.forEach((e, t) => {
|
|
4640
4748
|
e.insertBefore(w(s[t] ? "th" : "td", {}, ["\xA0"]), o[t]);
|
|
4641
4749
|
}), requestAnimationFrame(() => this._positionNear(this._activeTable)), this.context.invoke("editor.afterCommand");
|
|
@@ -4655,12 +4763,12 @@ var wr = 120, Tr = 200, Er = [
|
|
|
4655
4763
|
if (!t) return;
|
|
4656
4764
|
let n = Array.from(t.querySelectorAll("tr"));
|
|
4657
4765
|
if (n[0] && n[0].cells.length <= 1) return;
|
|
4658
|
-
let r = [...new Set(e.map((e) =>
|
|
4766
|
+
let r = [...new Set(e.map((e) => Ir(e)))];
|
|
4659
4767
|
if (r.length >= (n[0]?.cells.length ?? 1)) return;
|
|
4660
4768
|
let i = [];
|
|
4661
4769
|
r.forEach((e) => {
|
|
4662
4770
|
n.forEach((t) => {
|
|
4663
|
-
let n =
|
|
4771
|
+
let n = q(t, e);
|
|
4664
4772
|
n && i.push(n);
|
|
4665
4773
|
});
|
|
4666
4774
|
}), this._activeCell = null, this._clearSelection(), i.forEach((e) => e.remove()), requestAnimationFrame(() => this._positionNear(this._activeTable)), this.context.invoke("editor.afterCommand");
|
|
@@ -4683,7 +4791,7 @@ var wr = 120, Tr = 200, Er = [
|
|
|
4683
4791
|
}
|
|
4684
4792
|
}), n.length < 2) return;
|
|
4685
4793
|
}
|
|
4686
|
-
let { gridMap: r, cellPos: i } =
|
|
4794
|
+
let { gridMap: r, cellPos: i } = Rr(t), a = Infinity, o = -Infinity, s = Infinity, c = -Infinity;
|
|
4687
4795
|
if (n.forEach((e) => {
|
|
4688
4796
|
let t = i.get(e);
|
|
4689
4797
|
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 +4830,7 @@ var wr = 120, Tr = 200, Er = [
|
|
|
4722
4830
|
_unmergeOne(e, t) {
|
|
4723
4831
|
let n = e.colSpan || 1, r = e.rowSpan || 1;
|
|
4724
4832
|
if (n === 1 && r === 1) return;
|
|
4725
|
-
let { cellPos: i } =
|
|
4833
|
+
let { cellPos: i } = Rr(t), a = i.get(e);
|
|
4726
4834
|
if (!a) return;
|
|
4727
4835
|
let { r: o, c: s } = a, c = Array.from(t.rows), l = e.tagName.toLowerCase();
|
|
4728
4836
|
if (e.rowSpan = 1, e.colSpan = 1, e.style.verticalAlign = "", n > 1) {
|
|
@@ -4809,10 +4917,10 @@ var wr = 120, Tr = 200, Er = [
|
|
|
4809
4917
|
let i = t.closest("table");
|
|
4810
4918
|
if (i) {
|
|
4811
4919
|
if (n) {
|
|
4812
|
-
let t = [...new Set(r.map((e) =>
|
|
4920
|
+
let t = [...new Set(r.map((e) => Ir(e)))], n = Array.from(i.querySelectorAll("tr"));
|
|
4813
4921
|
t.forEach((t) => {
|
|
4814
4922
|
n.forEach((n) => {
|
|
4815
|
-
let r =
|
|
4923
|
+
let r = q(n, t);
|
|
4816
4924
|
r && (r.colSpan || 1) === 1 && (r.style.width = `${e}px`, r.style.minWidth = `${e}px`);
|
|
4817
4925
|
});
|
|
4818
4926
|
});
|
|
@@ -4839,7 +4947,7 @@ var wr = 120, Tr = 200, Er = [
|
|
|
4839
4947
|
let a = w("div", { class: "an-size-popover-title" });
|
|
4840
4948
|
i.appendChild(a);
|
|
4841
4949
|
let o = w("div", { class: "an-context-color-palette" });
|
|
4842
|
-
|
|
4950
|
+
Vr.forEach((e) => {
|
|
4843
4951
|
let n = w("div", {
|
|
4844
4952
|
class: "an-context-color-swatch",
|
|
4845
4953
|
title: e
|
|
@@ -4959,11 +5067,11 @@ var wr = 120, Tr = 200, Er = [
|
|
|
4959
5067
|
if (!t) return;
|
|
4960
5068
|
let n = this._getCell();
|
|
4961
5069
|
if (!n) return;
|
|
4962
|
-
let r =
|
|
5070
|
+
let r = Ir(n);
|
|
4963
5071
|
if (r === -1) return;
|
|
4964
5072
|
let i = t.querySelector("tbody") || t, a = Array.from(i.querySelectorAll(":scope > tr"));
|
|
4965
5073
|
a.length < 2 || (a.sort((t, n) => {
|
|
4966
|
-
let i =
|
|
5074
|
+
let i = q(t, r), a = q(n, r), o = (i?.textContent || "").trim(), s = (a?.textContent || "").trim(), c = parseFloat(o), l = parseFloat(s);
|
|
4967
5075
|
return !isNaN(c) && !isNaN(l) ? e === "asc" ? c - l : l - c : e === "asc" ? o.localeCompare(s) : s.localeCompare(o);
|
|
4968
5076
|
}), a.forEach((e) => i.appendChild(e)), this._markSortIndicator(t, r, e), this.context.invoke("editor.afterCommand"));
|
|
4969
5077
|
}
|
|
@@ -4975,7 +5083,7 @@ var wr = 120, Tr = 200, Er = [
|
|
|
4975
5083
|
});
|
|
4976
5084
|
let i = r.querySelector("tr");
|
|
4977
5085
|
if (!i) return;
|
|
4978
|
-
let a =
|
|
5086
|
+
let a = q(i, t);
|
|
4979
5087
|
a && a.classList.add(n === "asc" ? "an-sort-asc" : "an-sort-desc");
|
|
4980
5088
|
}
|
|
4981
5089
|
_exportTableCSV() {
|
|
@@ -4984,13 +5092,13 @@ var wr = 120, Tr = 200, Er = [
|
|
|
4984
5092
|
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
5093
|
i.href = r, i.download = "table.csv", i.style.display = "none", document.body.appendChild(i), i.click(), i.remove(), URL.revokeObjectURL(r);
|
|
4986
5094
|
}
|
|
4987
|
-
},
|
|
5095
|
+
}, Ur = 100, Wr = 180, Gr = /language-(\S+)/, Kr = {
|
|
4988
5096
|
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
5097
|
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
5098
|
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
5099
|
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
5100
|
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
|
-
},
|
|
5101
|
+
}, qr = class {
|
|
4994
5102
|
constructor(e) {
|
|
4995
5103
|
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
5104
|
}
|
|
@@ -5047,7 +5155,7 @@ var wr = 120, Tr = 200, Er = [
|
|
|
5047
5155
|
].forEach(([e, t]) => {
|
|
5048
5156
|
let n = w("option", { value: e });
|
|
5049
5157
|
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(
|
|
5158
|
+
}), 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
5159
|
}
|
|
5052
5160
|
_sep() {
|
|
5053
5161
|
return w("div", { class: "an-link-tooltip-sep" });
|
|
@@ -5065,10 +5173,10 @@ var wr = 120, Tr = 200, Er = [
|
|
|
5065
5173
|
_scheduleShow(e) {
|
|
5066
5174
|
this._activePre === e && this._el.style.display !== "none" || (clearTimeout(this._hideTimer), this._hideTimer = null, clearTimeout(this._showTimer), this._showTimer = setTimeout(() => {
|
|
5067
5175
|
this._activePre = e, this._syncWrapBtn(), this._syncLineNumbersBtn(), this._syncLangSelect(), this._show(e);
|
|
5068
|
-
},
|
|
5176
|
+
}, Ur));
|
|
5069
5177
|
}
|
|
5070
5178
|
_scheduleHide() {
|
|
5071
|
-
clearTimeout(this._showTimer), this._showTimer = null, clearTimeout(this._hideTimer), this._hideTimer = setTimeout(() => this._hide(),
|
|
5179
|
+
clearTimeout(this._showTimer), this._showTimer = null, clearTimeout(this._hideTimer), this._hideTimer = setTimeout(() => this._hide(), Wr);
|
|
5072
5180
|
}
|
|
5073
5181
|
_show(e) {
|
|
5074
5182
|
this._el.style.display = "flex", this._positionNear(e);
|
|
@@ -5095,7 +5203,7 @@ var wr = 120, Tr = 200, Er = [
|
|
|
5095
5203
|
}
|
|
5096
5204
|
_syncLangSelect() {
|
|
5097
5205
|
if (!this._activePre || !this._langSelect) return;
|
|
5098
|
-
let e = this._activePre.querySelector("code"), t = this._activePre.dataset.language || "", n = e && (
|
|
5206
|
+
let e = this._activePre.querySelector("code"), t = this._activePre.dataset.language || "", n = e && (Gr.exec(e.className) || [])[1] || "";
|
|
5099
5207
|
this._langSelect.value = t || n || "";
|
|
5100
5208
|
}
|
|
5101
5209
|
_copyCode() {
|
|
@@ -5201,21 +5309,21 @@ var wr = 120, Tr = 200, Er = [
|
|
|
5201
5309
|
let e = this._activePre;
|
|
5202
5310
|
e && (this._hide(), e.remove(), this.context.invoke("editor.afterCommand"));
|
|
5203
5311
|
}
|
|
5204
|
-
},
|
|
5205
|
-
function
|
|
5206
|
-
return
|
|
5312
|
+
}, Jr = null, Yr = null;
|
|
5313
|
+
function Xr() {
|
|
5314
|
+
return Jr ? Promise.resolve(Jr) : (Yr ??= import("./emoji-data-BDQX5kh-.js").then((e) => (Jr = {
|
|
5207
5315
|
EMOJI_CATS: e.EMOJI_CATS,
|
|
5208
5316
|
EMOJI_LIST: e.EMOJI_LIST
|
|
5209
|
-
},
|
|
5317
|
+
}, Jr)), Yr);
|
|
5210
5318
|
}
|
|
5211
|
-
var
|
|
5319
|
+
var Zr = class extends U {
|
|
5212
5320
|
_activeCat = "all";
|
|
5213
5321
|
initialize() {
|
|
5214
5322
|
return this;
|
|
5215
5323
|
}
|
|
5216
5324
|
async show() {
|
|
5217
5325
|
if (this._saveRange(), !this._dialog) {
|
|
5218
|
-
let { EMOJI_CATS: e, EMOJI_LIST: t } = await
|
|
5326
|
+
let { EMOJI_CATS: e, EMOJI_LIST: t } = await Xr();
|
|
5219
5327
|
this._dialog || (this._cats = e, this._list = t, this._dialog = this._buildDialog(), document.body.appendChild(this._dialog));
|
|
5220
5328
|
}
|
|
5221
5329
|
this._activeCat = "all", this._searchInput.value = "", this._updateCatTabs(), this._filterEmojis("", "all"), this._open();
|
|
@@ -5308,270 +5416,34 @@ var Fr = class extends V {
|
|
|
5308
5416
|
let s = document.createTextNode(e);
|
|
5309
5417
|
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
5418
|
}
|
|
5311
|
-
},
|
|
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 {
|
|
5419
|
+
}, Qr = "https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.2/css/all.min.css", $r = null, ei = null;
|
|
5420
|
+
function ti() {
|
|
5421
|
+
return $r ? Promise.resolve($r) : (ei ??= import("./icon-data-V0Xqv-wX.js").then((e) => ($r = {
|
|
5422
|
+
ICON_CATEGORIES: e.ICON_CATEGORIES,
|
|
5423
|
+
ICON_LIST: e.ICON_LIST
|
|
5424
|
+
}, $r)), ei);
|
|
5425
|
+
}
|
|
5426
|
+
var ni = class extends U {
|
|
5561
5427
|
_selectedIcon = null;
|
|
5562
5428
|
_activeCat = "all";
|
|
5563
5429
|
initialize() {
|
|
5564
|
-
return this
|
|
5430
|
+
return this;
|
|
5565
5431
|
}
|
|
5566
5432
|
_ensureFontAwesome() {
|
|
5567
|
-
if (
|
|
5568
|
-
let e =
|
|
5569
|
-
if (
|
|
5570
|
-
let t = document.
|
|
5571
|
-
|
|
5433
|
+
if (this.context.options.fontAwesomeAutoInject === !1) return;
|
|
5434
|
+
let e = this.context.options.fontAwesomeCDN || Qr;
|
|
5435
|
+
if (!e || document.getElementById("an-fontawesome-css")) return;
|
|
5436
|
+
let t = Array.from(document.querySelectorAll("link[rel=\"stylesheet\"]")).map((e) => e.href || "").join(" ");
|
|
5437
|
+
if (/fontawesome|font-awesome/.test(t) || document.querySelector(".fa-solid, .fas, .far, .fab")) return;
|
|
5438
|
+
let n = document.createElement("link");
|
|
5439
|
+
n.id = "an-fontawesome-css", n.rel = "stylesheet", n.href = e, n.crossOrigin = "anonymous", n.referrerPolicy = "no-referrer", document.head.appendChild(n);
|
|
5572
5440
|
}
|
|
5573
|
-
show() {
|
|
5574
|
-
|
|
5441
|
+
async show() {
|
|
5442
|
+
if (this._saveRange(), this._ensureFontAwesome(), !this._dialog) {
|
|
5443
|
+
let { ICON_CATEGORIES: e, ICON_LIST: t } = await ti();
|
|
5444
|
+
this._dialog || (this._cats = e, this._list = t, this._dialog = this._buildDialog(), document.body.appendChild(this._dialog));
|
|
5445
|
+
}
|
|
5446
|
+
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
5447
|
}
|
|
5576
5448
|
_buildDialog() {
|
|
5577
5449
|
let e = this.context.locale.iconDialog, t = w("div", {
|
|
@@ -5601,7 +5473,7 @@ var Fr = class extends V {
|
|
|
5601
5473
|
class: "an-icon-cat active",
|
|
5602
5474
|
"data-cat": "all"
|
|
5603
5475
|
});
|
|
5604
|
-
u.textContent = e.all, l.appendChild(u),
|
|
5476
|
+
u.textContent = e.all, l.appendChild(u), this._cats.forEach(({ id: t, label: n }) => {
|
|
5605
5477
|
let r = w("button", {
|
|
5606
5478
|
type: "button",
|
|
5607
5479
|
class: "an-icon-cat",
|
|
@@ -5610,7 +5482,7 @@ var Fr = class extends V {
|
|
|
5610
5482
|
r.textContent = e.categories?.[t] || n, l.appendChild(r);
|
|
5611
5483
|
}), this._catBar = l;
|
|
5612
5484
|
let d = w("div", { class: "an-icon-grid" });
|
|
5613
|
-
|
|
5485
|
+
this._list.forEach(([e, t]) => {
|
|
5614
5486
|
let n = w("button", {
|
|
5615
5487
|
type: "button",
|
|
5616
5488
|
class: "an-icon-cell",
|
|
@@ -5732,7 +5604,7 @@ var Fr = class extends V {
|
|
|
5732
5604
|
_close() {
|
|
5733
5605
|
this._selectedIcon = null, super._close();
|
|
5734
5606
|
}
|
|
5735
|
-
},
|
|
5607
|
+
}, J = {
|
|
5736
5608
|
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
5609
|
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
5610
|
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 +5631,7 @@ var Fr = class extends V {
|
|
|
5759
5631
|
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
5632
|
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
5633
|
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
|
-
},
|
|
5634
|
+
}, ri = [
|
|
5763
5635
|
"#000000",
|
|
5764
5636
|
"#434343",
|
|
5765
5637
|
"#666666",
|
|
@@ -5785,35 +5657,35 @@ var Fr = class extends V {
|
|
|
5785
5657
|
"#d9d2e9",
|
|
5786
5658
|
"#ead1dc"
|
|
5787
5659
|
];
|
|
5788
|
-
function
|
|
5660
|
+
function ii(e) {
|
|
5789
5661
|
let t = e === "foreColor" ? "Text Color" : "Highlight Color", n = e === "foreColor" ? "textColor" : "highlightColor";
|
|
5790
5662
|
return () => [{
|
|
5791
5663
|
back: !0,
|
|
5792
5664
|
label: t,
|
|
5793
5665
|
localeKey: n,
|
|
5794
|
-
navigate: () =>
|
|
5666
|
+
navigate: () => ai
|
|
5795
5667
|
}, {
|
|
5796
5668
|
colorPalette: !0,
|
|
5797
5669
|
colorType: e
|
|
5798
5670
|
}];
|
|
5799
5671
|
}
|
|
5800
|
-
var
|
|
5672
|
+
var ai = [
|
|
5801
5673
|
{
|
|
5802
5674
|
name: "cut",
|
|
5803
5675
|
label: "Cut",
|
|
5804
|
-
icon:
|
|
5676
|
+
icon: J.cut,
|
|
5805
5677
|
action: () => document.execCommand("cut")
|
|
5806
5678
|
},
|
|
5807
5679
|
{
|
|
5808
5680
|
name: "copy",
|
|
5809
5681
|
label: "Copy",
|
|
5810
|
-
icon:
|
|
5682
|
+
icon: J.copy,
|
|
5811
5683
|
action: () => document.execCommand("copy")
|
|
5812
5684
|
},
|
|
5813
5685
|
{
|
|
5814
5686
|
name: "paste",
|
|
5815
5687
|
label: "Paste",
|
|
5816
|
-
icon:
|
|
5688
|
+
icon: J.paste,
|
|
5817
5689
|
action: (e) => {
|
|
5818
5690
|
if (!navigator.clipboard) return;
|
|
5819
5691
|
let t = e.layoutInfo?.editable;
|
|
@@ -5840,84 +5712,84 @@ var Vr = [
|
|
|
5840
5712
|
{
|
|
5841
5713
|
name: "bold",
|
|
5842
5714
|
label: "Bold",
|
|
5843
|
-
icon:
|
|
5715
|
+
icon: J.bold,
|
|
5844
5716
|
action: (e) => e.invoke("editor.bold")
|
|
5845
5717
|
},
|
|
5846
5718
|
{
|
|
5847
5719
|
name: "italic",
|
|
5848
5720
|
label: "Italic",
|
|
5849
|
-
icon:
|
|
5721
|
+
icon: J.italic,
|
|
5850
5722
|
action: (e) => e.invoke("editor.italic")
|
|
5851
5723
|
},
|
|
5852
5724
|
{
|
|
5853
5725
|
name: "underline",
|
|
5854
5726
|
label: "Underline",
|
|
5855
|
-
icon:
|
|
5727
|
+
icon: J.underline,
|
|
5856
5728
|
action: (e) => e.invoke("editor.underline")
|
|
5857
5729
|
},
|
|
5858
5730
|
{ separator: !0 },
|
|
5859
5731
|
{
|
|
5860
5732
|
name: "textColor",
|
|
5861
5733
|
label: "Text Color",
|
|
5862
|
-
icon:
|
|
5734
|
+
icon: J.textColor,
|
|
5863
5735
|
colorStrip: "foreColor",
|
|
5864
|
-
navigate:
|
|
5736
|
+
navigate: ii("foreColor")
|
|
5865
5737
|
},
|
|
5866
5738
|
{
|
|
5867
5739
|
name: "highlightColor",
|
|
5868
5740
|
label: "Highlight Color",
|
|
5869
|
-
icon:
|
|
5741
|
+
icon: J.highlightColor,
|
|
5870
5742
|
colorStrip: "hiliteColor",
|
|
5871
|
-
navigate:
|
|
5743
|
+
navigate: ii("hiliteColor")
|
|
5872
5744
|
},
|
|
5873
5745
|
{ separator: !0 },
|
|
5874
5746
|
{
|
|
5875
5747
|
name: "copyFormat",
|
|
5876
5748
|
label: "Copy Format",
|
|
5877
|
-
icon:
|
|
5749
|
+
icon: J.copyFormat,
|
|
5878
5750
|
action: (e) => e.invoke("contextMenu.copyFormat")
|
|
5879
5751
|
},
|
|
5880
5752
|
{
|
|
5881
5753
|
name: "pasteFormat",
|
|
5882
5754
|
label: "Paste Format",
|
|
5883
|
-
icon:
|
|
5755
|
+
icon: J.pasteFormat,
|
|
5884
5756
|
action: (e) => e.invoke("contextMenu.pasteFormat"),
|
|
5885
5757
|
disabled: (e) => !e.invoke("contextMenu.hasCopiedFormat")
|
|
5886
5758
|
},
|
|
5887
5759
|
{
|
|
5888
5760
|
name: "removeFormat",
|
|
5889
5761
|
label: "Remove Format",
|
|
5890
|
-
icon:
|
|
5762
|
+
icon: J.removeFormat,
|
|
5891
5763
|
action: (e) => e.invoke("contextMenu.removeFormat")
|
|
5892
5764
|
},
|
|
5893
5765
|
{ separator: !0 },
|
|
5894
5766
|
{
|
|
5895
5767
|
name: "link",
|
|
5896
5768
|
label: "Insert Link",
|
|
5897
|
-
icon:
|
|
5769
|
+
icon: J.link,
|
|
5898
5770
|
action: (e) => e.invoke("linkDialog.show")
|
|
5899
5771
|
},
|
|
5900
5772
|
{
|
|
5901
5773
|
name: "image",
|
|
5902
5774
|
label: "Insert Image",
|
|
5903
|
-
icon:
|
|
5775
|
+
icon: J.image,
|
|
5904
5776
|
action: (e) => e.invoke("imageDialog.show")
|
|
5905
5777
|
},
|
|
5906
5778
|
{
|
|
5907
5779
|
name: "video",
|
|
5908
5780
|
label: "Insert Video",
|
|
5909
|
-
icon:
|
|
5781
|
+
icon: J.video,
|
|
5910
5782
|
action: (e) => e.invoke("videoDialog.show")
|
|
5911
5783
|
},
|
|
5912
5784
|
{
|
|
5913
5785
|
name: "table",
|
|
5914
5786
|
label: "Insert Table",
|
|
5915
|
-
icon:
|
|
5787
|
+
icon: J.table,
|
|
5916
5788
|
tableGrid: !0
|
|
5917
5789
|
}
|
|
5918
|
-
],
|
|
5790
|
+
], oi = class {
|
|
5919
5791
|
constructor(e) {
|
|
5920
|
-
this.context = e, this.options = e.options || {}, this._items = this.options.contextMenu?.items ||
|
|
5792
|
+
this.context = e, this.options = e.options || {}, this._items = this.options.contextMenu?.items || ai, this.el = null, this._disposers = [], this._menuDisposers = [], this._lastX = 0, this._lastY = 0, this._copiedFormat = null, this._savedRange = null;
|
|
5921
5793
|
}
|
|
5922
5794
|
initialize() {
|
|
5923
5795
|
this.el = w("div", {
|
|
@@ -5955,7 +5827,7 @@ var Vr = [
|
|
|
5955
5827
|
class: "an-context-icon",
|
|
5956
5828
|
"aria-hidden": "true"
|
|
5957
5829
|
});
|
|
5958
|
-
n.innerHTML =
|
|
5830
|
+
n.innerHTML = J.back, t.appendChild(n);
|
|
5959
5831
|
let r = e.localeKey && this.context.locale.contextMenu[e.localeKey] || e.label || this.context.locale.contextMenu.back || "Back";
|
|
5960
5832
|
t.appendChild(w("span", { class: "an-context-label" }, [r]));
|
|
5961
5833
|
let i = E(t, "click", (t) => {
|
|
@@ -6003,7 +5875,7 @@ var Vr = [
|
|
|
6003
5875
|
}
|
|
6004
5876
|
if (e.colorPalette) {
|
|
6005
5877
|
let t = w("div", { class: "an-context-color-palette" });
|
|
6006
|
-
if (
|
|
5878
|
+
if (ri.forEach((n) => {
|
|
6007
5879
|
let r = w("div", {
|
|
6008
5880
|
class: "an-context-color-swatch",
|
|
6009
5881
|
title: n,
|
|
@@ -6022,7 +5894,7 @@ var Vr = [
|
|
|
6022
5894
|
role: "button",
|
|
6023
5895
|
"aria-label": this.context.locale.contextMenu.noHighlight || "No highlight"
|
|
6024
5896
|
});
|
|
6025
|
-
e.innerHTML =
|
|
5897
|
+
e.innerHTML = J.noColor;
|
|
6026
5898
|
let n = E(e, "click", (e) => {
|
|
6027
5899
|
e.stopPropagation(), this._applyColor("hiliteColor", "transparent");
|
|
6028
5900
|
});
|
|
@@ -6233,7 +6105,7 @@ var Vr = [
|
|
|
6233
6105
|
} catch {}
|
|
6234
6106
|
this.context.invoke("editor.afterCommand");
|
|
6235
6107
|
}
|
|
6236
|
-
},
|
|
6108
|
+
}, si = [
|
|
6237
6109
|
{
|
|
6238
6110
|
category: "Text Formatting",
|
|
6239
6111
|
items: [
|
|
@@ -6306,12 +6178,12 @@ var Vr = [
|
|
|
6306
6178
|
action: "Show this keyboard shortcuts dialog"
|
|
6307
6179
|
}]
|
|
6308
6180
|
}
|
|
6309
|
-
],
|
|
6181
|
+
], ci = "<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>", li = class extends U {
|
|
6310
6182
|
show() {
|
|
6311
6183
|
this._open();
|
|
6312
6184
|
}
|
|
6313
6185
|
_buildDialog() {
|
|
6314
|
-
let e = this.context.locale.shortcutsDialog, { overlay: t, box: n } = this._buildDialogShell(e.ariaLabel,
|
|
6186
|
+
let e = this.context.locale.shortcutsDialog, { overlay: t, box: n } = this._buildDialogShell(e.ariaLabel, ci, e.title);
|
|
6315
6187
|
n.classList.add("an-shortcuts-box");
|
|
6316
6188
|
let r = w("button", {
|
|
6317
6189
|
type: "button",
|
|
@@ -6319,7 +6191,7 @@ var Vr = [
|
|
|
6319
6191
|
"aria-label": e.close,
|
|
6320
6192
|
style: "margin-left:auto"
|
|
6321
6193
|
});
|
|
6322
|
-
r.textContent = "×", this._closeBtn = r, this._firstInput = r, n.querySelector(".an-dialog-header").appendChild(r), (this.context.locale.shortcutsDialog.shortcuts ||
|
|
6194
|
+
r.textContent = "×", this._closeBtn = r, this._firstInput = r, n.querySelector(".an-dialog-header").appendChild(r), (this.context.locale.shortcutsDialog.shortcuts || si).forEach(({ category: e, items: t }) => {
|
|
6323
6195
|
let r = w("div", { class: "an-shortcuts-cat" });
|
|
6324
6196
|
r.textContent = e, n.appendChild(r);
|
|
6325
6197
|
let i = w("div", { class: "an-shortcuts-table" });
|
|
@@ -6333,7 +6205,7 @@ var Vr = [
|
|
|
6333
6205
|
let i = E(r, "click", () => this._close());
|
|
6334
6206
|
return this._disposers.push(i), t;
|
|
6335
6207
|
}
|
|
6336
|
-
},
|
|
6208
|
+
}, ui = class extends U {
|
|
6337
6209
|
constructor(e) {
|
|
6338
6210
|
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
6211
|
}
|
|
@@ -6576,8 +6448,8 @@ var Vr = [
|
|
|
6576
6448
|
this._counterEl.textContent = e ? this.context.locale.findReplace.noResults : "";
|
|
6577
6449
|
} else this._counterEl.textContent = `${this._currentIndex + 1} / ${e}`;
|
|
6578
6450
|
}
|
|
6579
|
-
},
|
|
6580
|
-
function
|
|
6451
|
+
}, Y = 20, di = "#3b82f6", X = (e, t, n) => Math.min(Math.max(e, t), n);
|
|
6452
|
+
function fi(e, t, n, r) {
|
|
6581
6453
|
return new Promise((i) => {
|
|
6582
6454
|
let a = (e) => {
|
|
6583
6455
|
let a = document.createElement("canvas");
|
|
@@ -6601,7 +6473,7 @@ function Jr(e, t, n, r) {
|
|
|
6601
6473
|
o.crossOrigin = "anonymous", o.onload = () => a(o), o.onerror = () => i(null), o.src = e.src + (e.src.includes("?") ? "&" : "?") + "_an=" + Date.now();
|
|
6602
6474
|
});
|
|
6603
6475
|
}
|
|
6604
|
-
var
|
|
6476
|
+
var pi = class {
|
|
6605
6477
|
constructor(e) {
|
|
6606
6478
|
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
6479
|
}
|
|
@@ -6632,7 +6504,7 @@ var Yr = class {
|
|
|
6632
6504
|
t.className = "an-crop-box", t.style.cssText = `
|
|
6633
6505
|
position:fixed; z-index:10101;
|
|
6634
6506
|
box-sizing:border-box;
|
|
6635
|
-
border:2px solid ${
|
|
6507
|
+
border:2px solid ${di};
|
|
6636
6508
|
cursor:move;
|
|
6637
6509
|
outline: none;
|
|
6638
6510
|
`;
|
|
@@ -6697,7 +6569,7 @@ var Yr = class {
|
|
|
6697
6569
|
"position:absolute",
|
|
6698
6570
|
"width:10px",
|
|
6699
6571
|
"height:10px",
|
|
6700
|
-
`background:${
|
|
6572
|
+
`background:${di}`,
|
|
6701
6573
|
"border:2px solid #fff",
|
|
6702
6574
|
"border-radius:2px",
|
|
6703
6575
|
"box-sizing:border-box",
|
|
@@ -6731,7 +6603,7 @@ var Yr = class {
|
|
|
6731
6603
|
let a = this._makeToolbarBtn("✓ Crop", "#22c55e", () => this._confirm()), o = this._makeToolbarBtn("✕ Cancel", "#94a3b8", () => this._close(!1)), s = document.createElement("label");
|
|
6732
6604
|
s.style.cssText = "color:#94a3b8;font-size:11px;cursor:pointer;display:flex;align-items:center;gap:4px;";
|
|
6733
6605
|
let c = document.createElement("input");
|
|
6734
|
-
c.type = "checkbox", c.style.accentColor =
|
|
6606
|
+
c.type = "checkbox", c.style.accentColor = di, 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
6607
|
}
|
|
6736
6608
|
_makeToolbarBtn(e, t, n) {
|
|
6737
6609
|
let r = document.createElement("button");
|
|
@@ -6761,7 +6633,7 @@ var Yr = class {
|
|
|
6761
6633
|
let i = this._img.naturalWidth || 0, a = this._img.naturalHeight || 0, o = this._imgRect.width || 1, s = this._imgRect.height || 1, c = {
|
|
6762
6634
|
x: i / o,
|
|
6763
6635
|
y: a / s
|
|
6764
|
-
}, l =
|
|
6636
|
+
}, 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
6637
|
this._infoEl.textContent = `${Math.round(d * c.x)} × ${Math.round(f * c.y)} px`;
|
|
6766
6638
|
}
|
|
6767
6639
|
let o = t + r + 8;
|
|
@@ -6770,14 +6642,14 @@ var Yr = class {
|
|
|
6770
6642
|
_startBoxMove(e) {
|
|
6771
6643
|
let t = e.clientX - this._box.x, n = e.clientY - this._box.y, r = this._imgRect;
|
|
6772
6644
|
this._attachDocDrag((e) => {
|
|
6773
|
-
this._box.x =
|
|
6645
|
+
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
6646
|
});
|
|
6775
6647
|
}
|
|
6776
6648
|
_startHandleDrag(e, t) {
|
|
6777
6649
|
let n = e.clientX, r = e.clientY, i = { ...this._box }, a = this._imgRect, o = this._arCheck?.checked, s = i.w / (i.h || 1);
|
|
6778
6650
|
this._attachDocDrag((e) => {
|
|
6779
6651
|
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(
|
|
6652
|
+
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
6653
|
x: u,
|
|
6782
6654
|
y: d,
|
|
6783
6655
|
w: f,
|
|
@@ -6811,12 +6683,12 @@ var Yr = class {
|
|
|
6811
6683
|
this._close(!1);
|
|
6812
6684
|
return;
|
|
6813
6685
|
}
|
|
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(
|
|
6686
|
+
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
6687
|
if (u <= 0 || d <= 0) {
|
|
6816
6688
|
this._close(!1);
|
|
6817
6689
|
return;
|
|
6818
6690
|
}
|
|
6819
|
-
let f = await
|
|
6691
|
+
let f = await fi(e, {
|
|
6820
6692
|
x: c,
|
|
6821
6693
|
y: l,
|
|
6822
6694
|
width: u,
|
|
@@ -6860,7 +6732,7 @@ var Yr = class {
|
|
|
6860
6732
|
e?.remove();
|
|
6861
6733
|
}), 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
6734
|
}
|
|
6863
|
-
},
|
|
6735
|
+
}, mi = class {
|
|
6864
6736
|
constructor(e) {
|
|
6865
6737
|
this.context = e, this.options = e.options, this._banner = null;
|
|
6866
6738
|
}
|
|
@@ -6913,7 +6785,7 @@ var Yr = class {
|
|
|
6913
6785
|
_removeBanner() {
|
|
6914
6786
|
this._banner?.remove(), this._banner = null;
|
|
6915
6787
|
}
|
|
6916
|
-
},
|
|
6788
|
+
}, hi = class {
|
|
6917
6789
|
constructor(e) {
|
|
6918
6790
|
this.context = e, this.options = e.options, this._disposers = [];
|
|
6919
6791
|
}
|
|
@@ -6926,7 +6798,13 @@ var Yr = class {
|
|
|
6926
6798
|
this._disposers.forEach((e) => e()), this._disposers = [];
|
|
6927
6799
|
}
|
|
6928
6800
|
_onKeydown(e) {
|
|
6929
|
-
e.key === " " ? this._applyBlockRule() && e.preventDefault() : e.key === "Enter" && this._applyEnterRule() && e.preventDefault();
|
|
6801
|
+
this._inCodeContext() || (e.key === " " ? this._applyBlockRule() && e.preventDefault() : e.key === "Enter" && this._applyEnterRule() && e.preventDefault());
|
|
6802
|
+
}
|
|
6803
|
+
_inCodeContext() {
|
|
6804
|
+
let e = globalThis.getSelection();
|
|
6805
|
+
if (!e?.rangeCount) return !1;
|
|
6806
|
+
let t = e.getRangeAt(0).startContainer;
|
|
6807
|
+
return !!(t.nodeType === Node.ELEMENT_NODE ? t : t.parentElement)?.closest("pre, code");
|
|
6930
6808
|
}
|
|
6931
6809
|
_getLineContext() {
|
|
6932
6810
|
let e = globalThis.getSelection();
|
|
@@ -6955,7 +6833,7 @@ var Yr = class {
|
|
|
6955
6833
|
if (!e) return !1;
|
|
6956
6834
|
let { text: t } = e, n = [
|
|
6957
6835
|
{
|
|
6958
|
-
re: /^(#{1,
|
|
6836
|
+
re: /^(#{1,6})$/,
|
|
6959
6837
|
handler: (e) => this._convertToHeading(e[1].length)
|
|
6960
6838
|
},
|
|
6961
6839
|
{
|
|
@@ -6963,16 +6841,16 @@ var Yr = class {
|
|
|
6963
6841
|
handler: () => this._convertToBlockquote()
|
|
6964
6842
|
},
|
|
6965
6843
|
{
|
|
6966
|
-
re: /^[
|
|
6844
|
+
re: /^[-*+]$/,
|
|
6967
6845
|
handler: () => this._convertToList("ul")
|
|
6968
6846
|
},
|
|
6969
6847
|
{
|
|
6970
|
-
re: /^1
|
|
6848
|
+
re: /^1[.)]$/,
|
|
6971
6849
|
handler: () => this._convertToList("ol")
|
|
6972
6850
|
},
|
|
6973
6851
|
{
|
|
6974
|
-
re: /^\[ \]$/,
|
|
6975
|
-
handler: () => this._convertToChecklist()
|
|
6852
|
+
re: /^\[([ xX])\]$/,
|
|
6853
|
+
handler: (e) => this._convertToChecklist(e[1].toLowerCase() === "x")
|
|
6976
6854
|
}
|
|
6977
6855
|
];
|
|
6978
6856
|
for (let { re: e, handler: r } of n) {
|
|
@@ -6985,7 +6863,7 @@ var Yr = class {
|
|
|
6985
6863
|
let e = this._getLineContext();
|
|
6986
6864
|
if (!e) return !1;
|
|
6987
6865
|
let { text: t } = e;
|
|
6988
|
-
return
|
|
6866
|
+
return /^(?:-{3,}|\*{3,}|_{3,})$/.test(t) ? (this._convertToHr(), !0) : /^(?:`{3}|~{3})/.test(t) ? (this._convertToCodeBlock(), !0) : !1;
|
|
6989
6867
|
}
|
|
6990
6868
|
_selectLineAndDelete() {
|
|
6991
6869
|
let e = globalThis.getSelection();
|
|
@@ -7002,8 +6880,12 @@ var Yr = class {
|
|
|
7002
6880
|
_convertToList(e) {
|
|
7003
6881
|
this._selectLineAndDelete(), document.execCommand(e === "ul" ? "insertUnorderedList" : "insertOrderedList"), this.context.triggerEvent("change", this.context.getHTML());
|
|
7004
6882
|
}
|
|
7005
|
-
_convertToChecklist() {
|
|
7006
|
-
this._selectLineAndDelete(), this.context.invoke("editor.toggleChecklist"),
|
|
6883
|
+
_convertToChecklist(e = !1) {
|
|
6884
|
+
if (this._selectLineAndDelete(), this.context.invoke("editor.toggleChecklist"), e) {
|
|
6885
|
+
let e = globalThis.getSelection(), t = e?.rangeCount ? e.getRangeAt(0).startContainer : null, n = (t?.nodeType === Node.ELEMENT_NODE ? t : t?.parentElement ?? null)?.closest("li")?.querySelector("input[type=\"checkbox\"]") ?? null;
|
|
6886
|
+
n && (n.checked = !0);
|
|
6887
|
+
}
|
|
6888
|
+
this.context.triggerEvent("change", this.context.getHTML());
|
|
7007
6889
|
}
|
|
7008
6890
|
_convertToHr() {
|
|
7009
6891
|
this._selectLineAndDelete(), this.context.invoke("editor.insertHr"), this.context.triggerEvent("change", this.context.getHTML());
|
|
@@ -7012,6 +6894,7 @@ var Yr = class {
|
|
|
7012
6894
|
this._selectLineAndDelete(), document.execCommand("formatBlock", !1, "pre"), this.context.triggerEvent("change", this.context.getHTML());
|
|
7013
6895
|
}
|
|
7014
6896
|
_onInput() {
|
|
6897
|
+
if (this._inCodeContext()) return;
|
|
7015
6898
|
let e = globalThis.getSelection();
|
|
7016
6899
|
if (!e?.rangeCount) return;
|
|
7017
6900
|
let t = e.getRangeAt(0);
|
|
@@ -7048,7 +6931,7 @@ var Yr = class {
|
|
|
7048
6931
|
break;
|
|
7049
6932
|
}
|
|
7050
6933
|
}
|
|
7051
|
-
},
|
|
6934
|
+
}, gi = [
|
|
7052
6935
|
"#000000",
|
|
7053
6936
|
"#434343",
|
|
7054
6937
|
"#666666",
|
|
@@ -7073,17 +6956,17 @@ var Yr = class {
|
|
|
7073
6956
|
"#c9daf8",
|
|
7074
6957
|
"#d9d2e9",
|
|
7075
6958
|
"#ead1dc"
|
|
7076
|
-
],
|
|
7077
|
-
bold:
|
|
7078
|
-
italic:
|
|
7079
|
-
underline:
|
|
7080
|
-
strikethrough:
|
|
7081
|
-
link:
|
|
7082
|
-
foreColor:
|
|
7083
|
-
hiliteColor:
|
|
7084
|
-
removeFormat:
|
|
7085
|
-
inlineCode:
|
|
7086
|
-
},
|
|
6959
|
+
], _i = "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" ${_i} style="display:block">${e}</svg>`, vi = {
|
|
6960
|
+
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\"/>"),
|
|
6961
|
+
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\"/>"),
|
|
6962
|
+
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\"/>"),
|
|
6963
|
+
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\"/>"),
|
|
6964
|
+
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\"/>"),
|
|
6965
|
+
foreColor: Z("<path d=\"M4 20L12 4L20 20\"/><line x1=\"7.5\" y1=\"14\" x2=\"16.5\" y2=\"14\"/>"),
|
|
6966
|
+
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\"/>"),
|
|
6967
|
+
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\"/>"),
|
|
6968
|
+
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\"/>")
|
|
6969
|
+
}, yi = {
|
|
7087
6970
|
bold: (e) => e.invoke("editor.bold"),
|
|
7088
6971
|
italic: (e) => e.invoke("editor.italic"),
|
|
7089
6972
|
underline: (e) => e.invoke("editor.underline"),
|
|
@@ -7104,15 +6987,15 @@ var Yr = class {
|
|
|
7104
6987
|
e.invoke("editor.afterCommand");
|
|
7105
6988
|
},
|
|
7106
6989
|
inlineCode: (e) => e.invoke("editor.inlineCode")
|
|
7107
|
-
},
|
|
6990
|
+
}, bi = {
|
|
7108
6991
|
bold: () => document.queryCommandState("bold"),
|
|
7109
6992
|
italic: () => document.queryCommandState("italic"),
|
|
7110
6993
|
underline: () => document.queryCommandState("underline"),
|
|
7111
6994
|
strikethrough: () => document.queryCommandState("strikeThrough")
|
|
7112
|
-
},
|
|
6995
|
+
}, xi = {
|
|
7113
6996
|
foreColor: !0,
|
|
7114
6997
|
hiliteColor: !0
|
|
7115
|
-
},
|
|
6998
|
+
}, Si = class {
|
|
7116
6999
|
constructor(e) {
|
|
7117
7000
|
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
7001
|
}
|
|
@@ -7142,23 +7025,23 @@ var Yr = class {
|
|
|
7142
7025
|
"removeFormat"
|
|
7143
7026
|
];
|
|
7144
7027
|
for (let n of t) {
|
|
7145
|
-
if (!
|
|
7028
|
+
if (!vi[n]) continue;
|
|
7146
7029
|
let t = document.createElement("button");
|
|
7147
|
-
if (t.type = "button", t.dataset.name = n, t.setAttribute("aria-label", n),
|
|
7030
|
+
if (t.type = "button", t.dataset.name = n, t.setAttribute("aria-label", n), xi[n]) {
|
|
7148
7031
|
t.className = "an-bubble-btn an-bubble-btn--color";
|
|
7149
7032
|
let e = document.createElement("span");
|
|
7150
|
-
e.className = "an-bubble-btn-svg", e.innerHTML =
|
|
7033
|
+
e.className = "an-bubble-btn-svg", e.innerHTML = vi[n];
|
|
7151
7034
|
let r = document.createElement("span");
|
|
7152
7035
|
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 =
|
|
7036
|
+
} else t.className = "an-bubble-btn", t.innerHTML = vi[n];
|
|
7154
7037
|
t.addEventListener("mousedown", (e) => {
|
|
7155
7038
|
e.preventDefault();
|
|
7156
7039
|
}), t.addEventListener("click", (e) => {
|
|
7157
|
-
if (e.preventDefault(), e.stopPropagation(),
|
|
7040
|
+
if (e.preventDefault(), e.stopPropagation(), xi[n]) {
|
|
7158
7041
|
this._openColorPicker(n, t);
|
|
7159
7042
|
return;
|
|
7160
7043
|
}
|
|
7161
|
-
this.context.invoke("editor.focus"),
|
|
7044
|
+
this.context.invoke("editor.focus"), yi[n] && yi[n](this.context), this._syncActive();
|
|
7162
7045
|
}), e.appendChild(t);
|
|
7163
7046
|
}
|
|
7164
7047
|
document.body.appendChild(e), this._el = e, this._btnCache = Array.from(e.querySelectorAll(".an-bubble-btn"));
|
|
@@ -7167,7 +7050,7 @@ var Yr = class {
|
|
|
7167
7050
|
let e = document.createElement("div");
|
|
7168
7051
|
e.className = "an-bubble-color-picker", e.style.display = "none", e.addEventListener("mousedown", (e) => e.preventDefault());
|
|
7169
7052
|
let t = document.createElement("div");
|
|
7170
|
-
t.className = "an-context-color-palette",
|
|
7053
|
+
t.className = "an-context-color-palette", gi.forEach((e) => {
|
|
7171
7054
|
let n = document.createElement("div");
|
|
7172
7055
|
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
7056
|
t.stopPropagation(), this._applyColor(this._pickerType, e);
|
|
@@ -7235,7 +7118,7 @@ var Yr = class {
|
|
|
7235
7118
|
}
|
|
7236
7119
|
_syncActive() {
|
|
7237
7120
|
this._btnCache && this._btnCache.forEach((e) => {
|
|
7238
|
-
let t =
|
|
7121
|
+
let t = bi[e.dataset.name];
|
|
7239
7122
|
e.classList.toggle("an-active", !!t?.());
|
|
7240
7123
|
});
|
|
7241
7124
|
}
|
|
@@ -7286,7 +7169,7 @@ var Yr = class {
|
|
|
7286
7169
|
_onContextMenu() {
|
|
7287
7170
|
this._hide();
|
|
7288
7171
|
}
|
|
7289
|
-
},
|
|
7172
|
+
}, Ci = class {
|
|
7290
7173
|
constructor(e) {
|
|
7291
7174
|
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
7175
|
}
|
|
@@ -7431,7 +7314,7 @@ var Yr = class {
|
|
|
7431
7314
|
let n;
|
|
7432
7315
|
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
7316
|
}
|
|
7434
|
-
},
|
|
7317
|
+
}, wi = class {
|
|
7435
7318
|
constructor(e) {
|
|
7436
7319
|
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
7320
|
}
|
|
@@ -7658,33 +7541,33 @@ var Yr = class {
|
|
|
7658
7541
|
this._deleteTriggerText(), this._close(), t.run();
|
|
7659
7542
|
}
|
|
7660
7543
|
}
|
|
7661
|
-
},
|
|
7544
|
+
}, Ti = /* @__PURE__ */ new Map(), Ei = [
|
|
7662
7545
|
{
|
|
7663
7546
|
name: "autoSaveRestore",
|
|
7664
|
-
Class:
|
|
7547
|
+
Class: mi,
|
|
7665
7548
|
enabled: (e) => !!e.autoSaveRestore
|
|
7666
7549
|
},
|
|
7667
7550
|
{
|
|
7668
7551
|
name: "markdownShortcuts",
|
|
7669
|
-
Class:
|
|
7552
|
+
Class: hi,
|
|
7670
7553
|
enabled: (e) => e.markdownShortcuts !== !1
|
|
7671
7554
|
},
|
|
7672
7555
|
{
|
|
7673
7556
|
name: "bubbleToolbar",
|
|
7674
|
-
Class:
|
|
7557
|
+
Class: Si,
|
|
7675
7558
|
enabled: (e) => !!e.bubbleToolbar
|
|
7676
7559
|
},
|
|
7677
7560
|
{
|
|
7678
7561
|
name: "mention",
|
|
7679
|
-
Class:
|
|
7562
|
+
Class: Ci,
|
|
7680
7563
|
enabled: (e) => !!e.mention
|
|
7681
7564
|
},
|
|
7682
7565
|
{
|
|
7683
7566
|
name: "slashMenu",
|
|
7684
|
-
Class:
|
|
7567
|
+
Class: wi,
|
|
7685
7568
|
enabled: (e) => e.slashMenu !== !1
|
|
7686
7569
|
}
|
|
7687
|
-
],
|
|
7570
|
+
], Di = /* @__PURE__ */ new Map(), Oi = class {
|
|
7688
7571
|
constructor(e, t = {}) {
|
|
7689
7572
|
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
7573
|
}
|
|
@@ -7701,12 +7584,12 @@ var Yr = class {
|
|
|
7701
7584
|
let n = new t(this);
|
|
7702
7585
|
this._modules.set(e, n), n.initialize();
|
|
7703
7586
|
};
|
|
7704
|
-
e("editor",
|
|
7705
|
-
for (let { name: t, Class: n, enabled: r } of
|
|
7706
|
-
if (
|
|
7587
|
+
e("editor", or), e("toolbar", ur), e("statusbar", mr), e("clipboard", hr), e("contextMenu", oi), e("placeholder", gr), e("codeview", _r), e("fullscreen", vr), e("linkDialog", br), e("imageDialog", Sr), e("videoDialog", wr), e("imageResizer", Dr), e("videoResizer", Or), e("linkTooltip", Mr), e("imageTooltip", Pr), e("videoTooltip", Fr), e("tableTooltip", Hr), e("codeTooltip", qr), e("emojiDialog", Zr), e("iconDialog", ni), e("shortcutsDialog", li), e("findReplace", ui), e("imageCropOverlay", pi);
|
|
7588
|
+
for (let { name: t, Class: n, enabled: r } of Ei) r(this.options) && e(t, n);
|
|
7589
|
+
if (Ti.size > 0) for (let [t, n] of Ti) e(t, n);
|
|
7707
7590
|
}
|
|
7708
7591
|
_syncOptionalModules() {
|
|
7709
|
-
for (let { name: e, Class: t, enabled: n } of
|
|
7592
|
+
for (let { name: e, Class: t, enabled: n } of Ei) {
|
|
7710
7593
|
let r = n(this.options);
|
|
7711
7594
|
if (r !== this._modules.has(e)) if (r) {
|
|
7712
7595
|
let n = new t(this);
|
|
@@ -7750,7 +7633,7 @@ var Yr = class {
|
|
|
7750
7633
|
});
|
|
7751
7634
|
}
|
|
7752
7635
|
_applyGlobalPlugins() {
|
|
7753
|
-
if (
|
|
7636
|
+
if (Di.size !== 0) for (let { plugin: e, options: t } of Di.values()) this._installPlugin(e, t);
|
|
7754
7637
|
}
|
|
7755
7638
|
_bindEditorEvents(e) {
|
|
7756
7639
|
let t = E(e, "input", () => this._syncToTarget()), n = E(e, "focus", () => {
|
|
@@ -8006,39 +7889,39 @@ var Yr = class {
|
|
|
8006
7889
|
};
|
|
8007
7890
|
//#endregion
|
|
8008
7891
|
//#region src/js/core/lists.js
|
|
8009
|
-
function
|
|
7892
|
+
function ki(e) {
|
|
8010
7893
|
return e[e.length - 1];
|
|
8011
7894
|
}
|
|
8012
|
-
function
|
|
7895
|
+
function Ai(e) {
|
|
8013
7896
|
return e[0];
|
|
8014
7897
|
}
|
|
8015
|
-
function
|
|
7898
|
+
function ji(e, t = 1) {
|
|
8016
7899
|
return e.slice(0, e.length - t);
|
|
8017
7900
|
}
|
|
8018
|
-
function
|
|
7901
|
+
function Mi(e, t = 1) {
|
|
8019
7902
|
return e.slice(t);
|
|
8020
7903
|
}
|
|
8021
|
-
function
|
|
7904
|
+
function Ni(e) {
|
|
8022
7905
|
return e.flat();
|
|
8023
7906
|
}
|
|
8024
|
-
function
|
|
7907
|
+
function Pi(e) {
|
|
8025
7908
|
return [...new Set(e)];
|
|
8026
7909
|
}
|
|
8027
|
-
function
|
|
7910
|
+
function Fi(e, t) {
|
|
8028
7911
|
let n = [];
|
|
8029
7912
|
for (let r = 0; r < e.length; r += t) n.push(e.slice(r, r + t));
|
|
8030
7913
|
return n;
|
|
8031
7914
|
}
|
|
8032
|
-
function
|
|
7915
|
+
function Ii(e, t) {
|
|
8033
7916
|
return e.reduce((e, n) => {
|
|
8034
7917
|
let r = t(n);
|
|
8035
7918
|
return e[r] || (e[r] = []), e[r].push(n), e;
|
|
8036
7919
|
}, {});
|
|
8037
7920
|
}
|
|
8038
|
-
function
|
|
7921
|
+
function Li(e, t) {
|
|
8039
7922
|
return e.every(t);
|
|
8040
7923
|
}
|
|
8041
|
-
function
|
|
7924
|
+
function Ri(e, t) {
|
|
8042
7925
|
return e.some(t);
|
|
8043
7926
|
}
|
|
8044
7927
|
//#endregion
|
|
@@ -8046,7 +7929,7 @@ function yi(e, t) {
|
|
|
8046
7929
|
function Q() {
|
|
8047
7930
|
return globalThis.navigator?.userAgent ?? "";
|
|
8048
7931
|
}
|
|
8049
|
-
var
|
|
7932
|
+
var zi = {
|
|
8050
7933
|
get isChrome() {
|
|
8051
7934
|
return /Chrome\//.test(Q()) && !/Edg\//.test(Q());
|
|
8052
7935
|
},
|
|
@@ -8071,17 +7954,17 @@ var bi = {
|
|
|
8071
7954
|
get modifierKey() {
|
|
8072
7955
|
return /Macintosh/.test(Q()) ? "metaKey" : "ctrlKey";
|
|
8073
7956
|
}
|
|
8074
|
-
},
|
|
7957
|
+
}, Bi = { ...A }, $ = /* @__PURE__ */ new WeakMap(), Vi = {
|
|
8075
7958
|
create(e, t = {}) {
|
|
8076
|
-
let n =
|
|
7959
|
+
let n = Hi(e).map((e) => {
|
|
8077
7960
|
if ($.has(e)) return $.get(e);
|
|
8078
|
-
let n = new
|
|
7961
|
+
let n = new Oi(e, t);
|
|
8079
7962
|
return n.initialize(), $.set(e, n), n;
|
|
8080
7963
|
});
|
|
8081
7964
|
return n.length === 1 ? n[0] : n;
|
|
8082
7965
|
},
|
|
8083
7966
|
destroy(e) {
|
|
8084
|
-
|
|
7967
|
+
Hi(e).forEach((e) => {
|
|
8085
7968
|
let t = $.get(e);
|
|
8086
7969
|
t && (t.destroy(), $.delete(e));
|
|
8087
7970
|
});
|
|
@@ -8097,20 +7980,20 @@ var bi = {
|
|
|
8097
7980
|
Object.assign(A, e);
|
|
8098
7981
|
},
|
|
8099
7982
|
resetDefaults() {
|
|
8100
|
-
Object.keys(A).forEach((e) => delete A[e]), Object.assign(A,
|
|
7983
|
+
Object.keys(A).forEach((e) => delete A[e]), Object.assign(A, Bi);
|
|
8101
7984
|
},
|
|
8102
7985
|
registerModule(e, t) {
|
|
8103
|
-
|
|
7986
|
+
Ti.set(e, t);
|
|
8104
7987
|
},
|
|
8105
7988
|
use(e, t = {}) {
|
|
8106
7989
|
if (!e || typeof e.name != "string") throw TypeError("[AutumnNote] AutumnNote.use: plugin must have a string `name` property.");
|
|
8107
|
-
return
|
|
7990
|
+
return Di.has(e.name) ? (console.warn(`[AutumnNote] Plugin "${e.name}" already registered globally. Skipping.`), this) : (Array.isArray(e.buttons) && e.buttons.forEach((e) => $e(e)), Di.set(e.name, {
|
|
8108
7991
|
plugin: e,
|
|
8109
7992
|
options: t
|
|
8110
7993
|
}), this);
|
|
8111
7994
|
},
|
|
8112
7995
|
hasPlugin(e) {
|
|
8113
|
-
return
|
|
7996
|
+
return Di.has(e);
|
|
8114
7997
|
},
|
|
8115
7998
|
registerButton(e) {
|
|
8116
7999
|
return $e(e), this;
|
|
@@ -8124,12 +8007,12 @@ var bi = {
|
|
|
8124
8007
|
return n >= 0 ? t[n] = e : t.push(e), this;
|
|
8125
8008
|
},
|
|
8126
8009
|
buttons: Vt,
|
|
8127
|
-
version: "2.
|
|
8010
|
+
version: "2.3.0"
|
|
8128
8011
|
};
|
|
8129
|
-
function
|
|
8012
|
+
function Hi(e) {
|
|
8130
8013
|
return typeof e == "string" ? Array.from(document.querySelectorAll(e)) : e instanceof Element ? [e] : e instanceof NodeList || Array.isArray(e) ? Array.from(e) : [];
|
|
8131
8014
|
}
|
|
8132
8015
|
//#endregion
|
|
8133
|
-
export {
|
|
8016
|
+
export { Oi 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, Li as all, ne as ancestors, Ri as any, zt as backColorBtn, tt as boldBtn, Vt as buttons, It as checklistBtn, re as children, Fi 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, Vi as default, A as defaultOptions, Bt as defaultToolbar, Et as directionBtn, xt as emojiBtn, zi as env, Nt as findBtn, Pt as findReplaceBtn, Ai as first, Ni as flatten, Dt as fontFamilyBtn, wt as fontSizeBtn, Rt as foreColorBtn, _e as fromNativeRange, jt as fullscreenBtn, et as getButton, Ii as groupBy, _t as hrBtn, St as iconBtn, i as identity, yt as imageBtn, pt as indentBtn, ji as initial, Ft as inlineCodeBtn, ce as insertAfter, ee as isAnchor, x as isEditable, p as isElement, ue as isEmpty, s as isFunction, te as isImage, b as isInline, pe as isInsideEditable, P as isKey, _ as isLi, v as isList, F as isModifier, a as isNil, g as isPara, l as isPlainObject, xe as isSelectionInside, o as isString, y as isTable, m as isText, h as isVoid, nt as italicBtn, N as key, ki as last, kt as lineHeightBtn, vt as linkBtn, Ht as locales, he as makeDraggable, c as mergeDeep, ae as nextElement, le as nodeValue, ft as olBtn, E as on, mt as outdentBtn, de as outerHtml, Ot as paragraphStyleBtn, fe as placeCaret, ie as prevElement, Lt as printBtn, ye as rangeFromElement, u as rect2bnd, gt as redoBtn, $e as registerButton, Ut as registerLocale, T as remove, Tt as removeFormatBtn, Wt as resolveLocale, M as sanitiseHTML, sn as sanitiseUrl, Mt as shortcutsBtn, Ce as splitText, it as strikeBtn, ot as subscriptBtn, at as superscriptBtn, Ct as tableBtn, Mi as tail, n as throttle, me as trapFocus, dt as ulBtn, rt as underlineBtn, ht as undoBtn, Pi as unique, oe as unwrap, bt as videoBtn, Se as withSavedRange, se as wrap };
|
|
8134
8017
|
|
|
8135
8018
|
//# sourceMappingURL=autumnnote.es.js.map
|