fable-editor 1.2.5 → 1.2.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/angular/core/editor.d.ts +7 -2
- package/dist/angular/esm2022/core/editor.mjs +60 -3
- package/dist/angular/fesm2022/fable-editor.mjs +59 -2
- package/dist/angular/fesm2022/fable-editor.mjs.map +1 -1
- package/dist/core/editor.d.ts +7 -2
- package/dist/core/editor.d.ts.map +1 -1
- package/dist/core/index.cjs +3 -3
- package/dist/core/index.mjs +135 -102
- package/dist/react/index.cjs +9 -9
- package/dist/react/index.mjs +172 -139
- package/package.json +1 -1
package/dist/core/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const
|
|
1
|
+
const it = {
|
|
2
2
|
en: {
|
|
3
3
|
dir: "ltr",
|
|
4
4
|
file: "File",
|
|
@@ -385,9 +385,9 @@ const et = {
|
|
|
385
385
|
}
|
|
386
386
|
};
|
|
387
387
|
function R(p) {
|
|
388
|
-
return
|
|
388
|
+
return it[p];
|
|
389
389
|
}
|
|
390
|
-
const
|
|
390
|
+
const st = "undo redo | preview print | importword revhistory | fontfamily fontsize | fontsizeincrease fontsizedecrease | bold italic underline strikethrough | forecolor backcolor | alignleft aligncenter alignright alignjustify | bullist numlist | outdent indent | link blockquote code changecase lineheight wordspacing letterspacing | removeformat | blocks | ltr rtl | quickimage quickvideo quicktable codesample template charmap emoji | fullscreen sourcecode", lt = "file edit view insert format tools table help", ot = [
|
|
391
391
|
["Andale Mono", "andale mono,times"],
|
|
392
392
|
["Arial", "arial,helvetica,sans-serif"],
|
|
393
393
|
["Arial Black", "arial black,avant garde"],
|
|
@@ -407,7 +407,7 @@ const it = "undo redo | preview print | importword revhistory | fontfamily fonts
|
|
|
407
407
|
["Verdana", "verdana,geneva"],
|
|
408
408
|
["Webdings", "webdings"],
|
|
409
409
|
["Wingdings", "wingdings,zapf dingbats"]
|
|
410
|
-
],
|
|
410
|
+
], nt = ["8px", "9px", "10px", "11px", "12px", "14px", "16px", "18px", "20px", "24px", "28px", "32px", "36px", "48px", "72px", "96px"], rt = 1, at = 100, z = ["1", "1.15", "1.4", "1.5", "1.75", "2", "2.5", "3"], U = ["1px", "2px", "4px", "6px", "8px", "12px"], V = ["0.5px", "1px", "1.5px", "2px", "3px", "4px"], W = [
|
|
411
411
|
["plain", "Plain text"],
|
|
412
412
|
["html", "HTML/XML"],
|
|
413
413
|
["css", "CSS"],
|
|
@@ -433,7 +433,7 @@ const it = "undo redo | preview print | importword revhistory | fontfamily fonts
|
|
|
433
433
|
["h5", "heading5"],
|
|
434
434
|
["h6", "heading6"],
|
|
435
435
|
["pre", "pre"]
|
|
436
|
-
],
|
|
436
|
+
], ct = ["#F76707", "#4263EB", "#CC5DE8"], ht = [
|
|
437
437
|
"#FFFFFF",
|
|
438
438
|
"#F4F4F4",
|
|
439
439
|
"#E8EAED",
|
|
@@ -459,7 +459,7 @@ const it = "undo redo | preview print | importword revhistory | fontfamily fonts
|
|
|
459
459
|
"#8E24AA",
|
|
460
460
|
"#C2185B",
|
|
461
461
|
"#6D4C41"
|
|
462
|
-
],
|
|
462
|
+
], dt = [
|
|
463
463
|
{
|
|
464
464
|
key: "chcat_currency",
|
|
465
465
|
chars: [
|
|
@@ -799,7 +799,7 @@ const it = "undo redo | preview print | importword revhistory | fontfamily fonts
|
|
|
799
799
|
"ة"
|
|
800
800
|
]
|
|
801
801
|
}
|
|
802
|
-
],
|
|
802
|
+
], pt = [
|
|
803
803
|
{
|
|
804
804
|
key: "emcat_smileys",
|
|
805
805
|
chars: [
|
|
@@ -1524,7 +1524,7 @@ const it = "undo redo | preview print | importword revhistory | fontfamily fonts
|
|
|
1524
1524
|
"🇲🇦"
|
|
1525
1525
|
]
|
|
1526
1526
|
}
|
|
1527
|
-
],
|
|
1527
|
+
], Ft = [
|
|
1528
1528
|
"©",
|
|
1529
1529
|
"®",
|
|
1530
1530
|
"™",
|
|
@@ -1810,7 +1810,7 @@ const it = "undo redo | preview print | importword revhistory | fontfamily fonts
|
|
|
1810
1810
|
codesampleic: y(
|
|
1811
1811
|
'<rect x="3.5" y="4" width="17" height="16" rx="2"/><path d="M3.5 8.5h17"/><path d="M9.5 12 7 14.25l2.5 2.25M14.5 12l2.5 2.25-2.5 2.25"/>'
|
|
1812
1812
|
)
|
|
1813
|
-
},
|
|
1813
|
+
}, Ot = (p) => `<span class="txt">${p}</span>`, mt = /* @__PURE__ */ new Set([
|
|
1814
1814
|
"p",
|
|
1815
1815
|
"div",
|
|
1816
1816
|
"span",
|
|
@@ -1852,7 +1852,7 @@ const it = "undo redo | preview print | importword revhistory | fontfamily fonts
|
|
|
1852
1852
|
"figure",
|
|
1853
1853
|
"figcaption",
|
|
1854
1854
|
"mark"
|
|
1855
|
-
]),
|
|
1855
|
+
]), ut = /* @__PURE__ */ new Set([
|
|
1856
1856
|
"text-align",
|
|
1857
1857
|
"direction",
|
|
1858
1858
|
"unicode-bidi",
|
|
@@ -1917,20 +1917,20 @@ const it = "undo redo | preview print | importword revhistory | fontfamily fonts
|
|
|
1917
1917
|
th: ["width", "valign"],
|
|
1918
1918
|
table: ["width", "cellpadding", "cellspacing"]
|
|
1919
1919
|
};
|
|
1920
|
-
function
|
|
1920
|
+
function P(p) {
|
|
1921
1921
|
const t = {}, e = p.getAttribute && p.getAttribute("style");
|
|
1922
1922
|
return e && e.split(";").forEach((i) => {
|
|
1923
1923
|
const s = i.indexOf(":");
|
|
1924
1924
|
s < 1 || (t[i.slice(0, s).trim().toLowerCase()] = i.slice(s + 1).trim());
|
|
1925
1925
|
}), t;
|
|
1926
1926
|
}
|
|
1927
|
-
function
|
|
1927
|
+
function gt(p) {
|
|
1928
1928
|
return p.replace(/<!--\[if !supportLists\]-->([\s\S]*?)<!--\[endif\]-->/gi, "$1").replace(/<!--\[if !supportLists\]>([\s\S]*?)<!\[endif\]-->/gi, "$1").replace(/<!\[if !supportLists\]>([\s\S]*?)<!\[endif\]>/gi, "$1").replace(/<!--\[if [\s\S]*?<!\[endif\]-->/gi, "").replace(/<!--[\s\S]*?-->/g, "").replace(/<(script|style|xml|title)[\s\S]*?<\/\1>/gi, "").replace(/<\/?(meta|link)[^>]*>/gi, "").replace(/<\?xml[\s\S]*?\?>/gi, "").replace(/<\/?(o|v|w|m|st1):[^>]*>/gi, "");
|
|
1929
1929
|
}
|
|
1930
|
-
function
|
|
1930
|
+
function ft(p) {
|
|
1931
1931
|
return /^[0-9]+[\.\)،]/.test(p) ? { ordered: !0 } : /^[٠-٩۰-۹]+/.test(p) ? { ordered: !0, style: "arabic-indic" } : /^[ivxlc]{2,}[\.\)]/.test(p) ? { ordered: !0, style: "lower-roman" } : /^[IVXLC]{2,}[\.\)]/.test(p) ? { ordered: !0, style: "upper-roman" } : /^[a-z][\.\)]/.test(p) ? { ordered: !0, style: "lower-alpha" } : /^[A-Z][\.\)]/.test(p) ? { ordered: !0, style: "upper-alpha" } : /^[ء-ي][\.\)،-]/.test(p) ? { ordered: !0, style: "arabic-indic" } : { ordered: !1 };
|
|
1932
1932
|
}
|
|
1933
|
-
function
|
|
1933
|
+
function vt(p) {
|
|
1934
1934
|
const t = (s) => {
|
|
1935
1935
|
const l = (s.getAttribute("style") || "") + " " + (s.className || "");
|
|
1936
1936
|
return /mso-list\s*:(?!\s*ignore)/i.test(l) || /MsoListParagraph/i.test(l);
|
|
@@ -1949,7 +1949,7 @@ function ft(p) {
|
|
|
1949
1949
|
var x, C, M;
|
|
1950
1950
|
const c = +(((x = (n.getAttribute("style") || "").match(/level(\d+)/i)) == null ? void 0 : x[1]) || 1), h = Array.from(n.querySelectorAll("span")).find(
|
|
1951
1951
|
(w) => /mso-list\s*:\s*ignore/i.test(w.getAttribute("style") || "")
|
|
1952
|
-
), d = h ? ((C = h.textContent) == null ? void 0 : C.trim()) || "" : (((M = n.textContent) == null ? void 0 : M.trim().match(/^\S{1,4}/)) || [""])[0], { ordered: m, style: g } =
|
|
1952
|
+
), d = h ? ((C = h.textContent) == null ? void 0 : C.trim()) || "" : (((M = n.textContent) == null ? void 0 : M.trim().match(/^\S{1,4}/)) || [""])[0], { ordered: m, style: g } = ft(d);
|
|
1953
1953
|
for (h && h.remove(); l.length && l[l.length - 1].level > c; ) l.pop();
|
|
1954
1954
|
if (!l.length || l[l.length - 1].level < c) {
|
|
1955
1955
|
const w = p.createElement(m ? "ol" : "ul");
|
|
@@ -1960,22 +1960,22 @@ function ft(p) {
|
|
|
1960
1960
|
o.parentNode.insertBefore(w, o);
|
|
1961
1961
|
l.push({ list: w, level: c });
|
|
1962
1962
|
}
|
|
1963
|
-
const u = p.createElement("li"), v =
|
|
1963
|
+
const u = p.createElement("li"), v = P(n), b = ["text-align", "direction", "unicode-bidi", "color", "font-size", "font-family", "background-color"].filter((w) => v[w]).map((w) => w + ":" + v[w]).join(";");
|
|
1964
1964
|
for (b && u.setAttribute("style", b), n.getAttribute("dir") && u.setAttribute("dir", n.getAttribute("dir")); n.firstChild; ) u.appendChild(n.firstChild);
|
|
1965
1965
|
l[l.length - 1].list.appendChild(u), n.remove();
|
|
1966
1966
|
});
|
|
1967
1967
|
});
|
|
1968
1968
|
}
|
|
1969
|
-
function
|
|
1969
|
+
function bt(p) {
|
|
1970
1970
|
p.querySelectorAll('b[id^="docs-internal-guid"]').forEach((t) => {
|
|
1971
1971
|
for (; t.firstChild; ) t.parentNode.insertBefore(t.firstChild, t);
|
|
1972
1972
|
t.remove();
|
|
1973
1973
|
});
|
|
1974
1974
|
}
|
|
1975
|
-
function
|
|
1975
|
+
function yt(p) {
|
|
1976
1976
|
p.querySelectorAll("table").forEach((t) => {
|
|
1977
1977
|
const e = t;
|
|
1978
|
-
|
|
1978
|
+
P(e)["border-collapse"] || (e.style.borderCollapse = "collapse");
|
|
1979
1979
|
}), p.querySelectorAll("[align]").forEach((t) => {
|
|
1980
1980
|
const e = t, i = e.getAttribute("align").toLowerCase();
|
|
1981
1981
|
e.tagName.toLowerCase() === "table" ? i === "center" ? (e.style.marginLeft = e.style.marginLeft || "auto", e.style.marginRight = e.style.marginRight || "auto") : i === "right" ? e.style.marginLeft = e.style.marginLeft || "auto" : i === "left" && (e.style.marginRight = e.style.marginRight || "auto") : ["left", "right", "center", "justify"].includes(i) && (e.style.textAlign = e.style.textAlign || i, Array.from(e.children).forEach((s) => {
|
|
@@ -1999,7 +1999,7 @@ function Z(p, t) {
|
|
|
1999
1999
|
}
|
|
2000
2000
|
if (e.nodeType !== Node.ELEMENT_NODE) return;
|
|
2001
2001
|
const i = e, s = i.tagName.toLowerCase();
|
|
2002
|
-
if (!
|
|
2002
|
+
if (!mt.has(s)) {
|
|
2003
2003
|
if (s === "font") {
|
|
2004
2004
|
const r = t.createElement("span");
|
|
2005
2005
|
i.getAttribute("style") && r.setAttribute("style", i.getAttribute("style")), i.getAttribute("color") && (r.style.color = i.getAttribute("color")), i.getAttribute("face") && (r.style.fontFamily = i.getAttribute("face"));
|
|
@@ -2040,16 +2040,16 @@ function Z(p, t) {
|
|
|
2040
2040
|
return;
|
|
2041
2041
|
}
|
|
2042
2042
|
}
|
|
2043
|
-
const o =
|
|
2043
|
+
const o = P(i), n = [];
|
|
2044
2044
|
for (const [r, c] of Object.entries(o))
|
|
2045
|
-
|
|
2045
|
+
ut.has(r) && (/expression|javascript|url\s*\(\s*['"]?\s*file:/i.test(c) || r === "font-weight" && /^(400|normal)$/i.test(c) || r === "font-style" && /^normal$/i.test(c) || r === "text-decoration" && /^none$/i.test(c) || n.push(r + ":" + c));
|
|
2046
2046
|
if (n.length ? i.setAttribute("style", n.join(";")) : i.removeAttribute("style"), i.removeAttribute("class"), Z(i, t), s === "span" && !i.attributes.length) {
|
|
2047
2047
|
for (; i.firstChild; ) i.parentNode.insertBefore(i.firstChild, i);
|
|
2048
2048
|
i.remove();
|
|
2049
2049
|
}
|
|
2050
2050
|
});
|
|
2051
2051
|
}
|
|
2052
|
-
function
|
|
2052
|
+
function xt(p) {
|
|
2053
2053
|
const t = [], e = /<style[^>]*>([\s\S]*?)<\/style>/gi;
|
|
2054
2054
|
let i;
|
|
2055
2055
|
for (; i = e.exec(p); ) {
|
|
@@ -2067,7 +2067,7 @@ function yt(p) {
|
|
|
2067
2067
|
}
|
|
2068
2068
|
return t;
|
|
2069
2069
|
}
|
|
2070
|
-
function
|
|
2070
|
+
function Ct(p, t) {
|
|
2071
2071
|
if (!t.length) return;
|
|
2072
2072
|
const e = /* @__PURE__ */ new Map();
|
|
2073
2073
|
t.forEach(({ sel: i, decls: s }) => {
|
|
@@ -2084,7 +2084,7 @@ function xt(p, t) {
|
|
|
2084
2084
|
});
|
|
2085
2085
|
});
|
|
2086
2086
|
}), e.forEach((i, s) => {
|
|
2087
|
-
const l =
|
|
2087
|
+
const l = P(s), o = s.hasAttribute("dir"), n = s.hasAttribute("align"), r = Object.entries(i).filter(([d]) => !(d in l || (d === "direction" || d === "unicode-bidi") && o || d === "text-align" && (n || o) || (d === "background" || d === "background-color") && s.hasAttribute("bgcolor")));
|
|
2088
2088
|
if (!r.length) return;
|
|
2089
2089
|
const c = r.map(([d, m]) => d + ":" + m).join(";"), h = s.getAttribute("style");
|
|
2090
2090
|
s.setAttribute("style", h ? c + ";" + h : c);
|
|
@@ -2093,15 +2093,15 @@ function xt(p, t) {
|
|
|
2093
2093
|
function tt(p) {
|
|
2094
2094
|
return p.replace(/[ﭐ-﷿ﹰ-ﻼ]+/g, (t) => t.normalize("NFKC"));
|
|
2095
2095
|
}
|
|
2096
|
-
function
|
|
2096
|
+
function wt(p) {
|
|
2097
2097
|
const t = p.createTreeWalker(p.body, NodeFilter.SHOW_TEXT, null);
|
|
2098
2098
|
let e;
|
|
2099
2099
|
for (; e = t.nextNode(); )
|
|
2100
2100
|
/[ﭐ-﷿ﹰ-ﻼ]/.test(e.nodeValue || "") && (e.nodeValue = tt(e.nodeValue || ""));
|
|
2101
2101
|
}
|
|
2102
|
-
function
|
|
2103
|
-
const e =
|
|
2104
|
-
|
|
2102
|
+
function Tt(p, t = "ltr") {
|
|
2103
|
+
const e = xt(p), i = new DOMParser().parseFromString(gt(p), "text/html");
|
|
2104
|
+
Ct(i, e), /class="?Mso|mso-|urn:schemas-microsoft-com/i.test(i.body.innerHTML) && vt(i), bt(i), yt(i), Z(i.body, i), wt(i);
|
|
2105
2105
|
const s = (l) => {
|
|
2106
2106
|
var o;
|
|
2107
2107
|
return l && l.tagName === "P" && !((o = l.textContent) != null && o.trim()) && !l.querySelector("img,table");
|
|
@@ -2110,11 +2110,11 @@ function wt(p, t = "ltr") {
|
|
|
2110
2110
|
for (; s(i.body.lastElementChild); ) i.body.lastElementChild.remove();
|
|
2111
2111
|
return i.body.innerHTML.trim();
|
|
2112
2112
|
}
|
|
2113
|
-
function
|
|
2113
|
+
function Mt(p) {
|
|
2114
2114
|
const t = tt(p).replace(/\r/g, ""), e = (i) => i.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">");
|
|
2115
2115
|
return /\n/.test(t) ? t.split(/\n{2,}/).map((i) => `<p dir="auto">${e(i).replace(/\n/g, "<br>") || "<br>"}</p>`).join("") : e(t);
|
|
2116
2116
|
}
|
|
2117
|
-
function
|
|
2117
|
+
function Et(p) {
|
|
2118
2118
|
const t = new DataView(p), e = /* @__PURE__ */ new Map();
|
|
2119
2119
|
let i = -1;
|
|
2120
2120
|
for (let n = p.byteLength - 22; n >= Math.max(0, p.byteLength - 22 - 65535); n--)
|
|
@@ -2141,7 +2141,7 @@ async function Q(p, t) {
|
|
|
2141
2141
|
const n = new Blob([o]).stream().pipeThrough(new DecompressionStream("deflate-raw"));
|
|
2142
2142
|
return new Uint8Array(await new Response(n).arrayBuffer());
|
|
2143
2143
|
}
|
|
2144
|
-
const G = (p) => p.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """),
|
|
2144
|
+
const G = (p) => p.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """), D = (p, t) => Array.from(p.children).filter((e) => e.localName === t), E = (p, ...t) => {
|
|
2145
2145
|
let e = p;
|
|
2146
2146
|
for (const i of t) {
|
|
2147
2147
|
if (!e) return null;
|
|
@@ -2154,7 +2154,7 @@ const G = (p) => p.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, "&
|
|
|
2154
2154
|
if (e.localName === t) return e.value;
|
|
2155
2155
|
return "";
|
|
2156
2156
|
}, B = (p, t) => {
|
|
2157
|
-
const e = p ?
|
|
2157
|
+
const e = p ? E(p, t) : null;
|
|
2158
2158
|
if (!e) return !1;
|
|
2159
2159
|
const i = T(e);
|
|
2160
2160
|
return i !== "false" && i !== "0";
|
|
@@ -2183,13 +2183,13 @@ const G = (p) => p.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, "&
|
|
|
2183
2183
|
bmp: "image/bmp",
|
|
2184
2184
|
webp: "image/webp"
|
|
2185
2185
|
};
|
|
2186
|
-
function
|
|
2186
|
+
function Lt(p) {
|
|
2187
2187
|
let t = "";
|
|
2188
2188
|
for (let e = 0; e < p.length; e += 32768)
|
|
2189
2189
|
t += String.fromCharCode(...p.subarray(e, e + 32768));
|
|
2190
2190
|
return btoa(t);
|
|
2191
2191
|
}
|
|
2192
|
-
class
|
|
2192
|
+
class Ht {
|
|
2193
2193
|
constructor(t, e, i) {
|
|
2194
2194
|
this.rels = t, this.images = e, this.numFmt = i;
|
|
2195
2195
|
}
|
|
@@ -2214,20 +2214,20 @@ class Lt {
|
|
|
2214
2214
|
return s(0), e || "<p><br></p>";
|
|
2215
2215
|
}
|
|
2216
2216
|
paraList(t) {
|
|
2217
|
-
const e =
|
|
2217
|
+
const e = E(t, "pPr", "numPr");
|
|
2218
2218
|
if (!e) return null;
|
|
2219
|
-
const i = T(
|
|
2219
|
+
const i = T(E(e, "numId"));
|
|
2220
2220
|
if (!i || i === "0") return null;
|
|
2221
|
-
const s = parseInt(T(
|
|
2221
|
+
const s = parseInt(T(E(e, "ilvl")) || "0", 10) || 0;
|
|
2222
2222
|
return { type: this.numFmt.get(i) || "ul", ilvl: Math.min(s, 8) };
|
|
2223
2223
|
}
|
|
2224
2224
|
convertPara(t) {
|
|
2225
|
-
const e =
|
|
2225
|
+
const e = E(t, "pPr"), i = T(E(t, "pPr", "pStyle"));
|
|
2226
2226
|
let s = "p";
|
|
2227
2227
|
const l = /^Heading([1-6])$/i.exec(i);
|
|
2228
2228
|
l ? s = "h" + l[1] : /^Title$/i.test(i) && (s = "h1");
|
|
2229
|
-
const o = [], n = T(
|
|
2230
|
-
n === "center" ? o.push("text-align:center") : n === "right" || n === "end" ? o.push("text-align:right") : (n === "both" || n === "distribute") && o.push("text-align:justify"), e &&
|
|
2229
|
+
const o = [], n = T(E(t, "pPr", "jc"));
|
|
2230
|
+
n === "center" ? o.push("text-align:center") : n === "right" || n === "end" ? o.push("text-align:right") : (n === "both" || n === "distribute") && o.push("text-align:justify"), e && E(e, "bidi") && o.push("direction:rtl");
|
|
2231
2231
|
const r = this.runsOf(t), c = o.length ? ` style="${o.join(";")}"` : "";
|
|
2232
2232
|
return `<${s}${c}>${r || "<br>"}</${s}>`;
|
|
2233
2233
|
}
|
|
@@ -2245,20 +2245,20 @@ class Lt {
|
|
|
2245
2245
|
return e;
|
|
2246
2246
|
}
|
|
2247
2247
|
convertRun(t) {
|
|
2248
|
-
const e =
|
|
2248
|
+
const e = E(t, "rPr");
|
|
2249
2249
|
let i = "";
|
|
2250
2250
|
for (const d of Array.from(t.children))
|
|
2251
2251
|
d.localName === "t" ? i += G(d.textContent || "") : d.localName === "br" || d.localName === "cr" ? i += "<br>" : d.localName === "tab" ? i += " " : (d.localName === "drawing" || d.localName === "pict" || d.localName === "object") && (i += this.convertImage(d));
|
|
2252
2252
|
if (!i) return "";
|
|
2253
|
-
const s = [], l = T(e ?
|
|
2253
|
+
const s = [], l = T(e ? E(e, "color") : null);
|
|
2254
2254
|
l && l !== "auto" && s.push("color:#" + l);
|
|
2255
|
-
const o = T(e ?
|
|
2255
|
+
const o = T(e ? E(e, "highlight") : null);
|
|
2256
2256
|
o && Y[o] && s.push("background-color:" + Y[o]);
|
|
2257
|
-
const n = parseFloat(T(e ?
|
|
2257
|
+
const n = parseFloat(T(e ? E(e, "sz") : null));
|
|
2258
2258
|
n && s.push("font-size:" + Math.round(n / 2 * (4 / 3)) + "px");
|
|
2259
|
-
const r = e ?
|
|
2260
|
-
c && s.push(`font-family:'${c}'`), s.length && (i = `<span style="${s.join(";")}">${i}</span>`), B(e, "b") && (i = `<strong>${i}</strong>`), B(e, "i") && (i = `<em>${i}</em>`), B(e, "u") && T(
|
|
2261
|
-
const h = T(e ?
|
|
2259
|
+
const r = e ? E(e, "rFonts") : null, c = T(r, "ascii") || T(r, "cs");
|
|
2260
|
+
c && s.push(`font-family:'${c}'`), s.length && (i = `<span style="${s.join(";")}">${i}</span>`), B(e, "b") && (i = `<strong>${i}</strong>`), B(e, "i") && (i = `<em>${i}</em>`), B(e, "u") && T(E(e, "u")) !== "none" && (i = `<u>${i}</u>`), B(e, "strike") && (i = `<s>${i}</s>`);
|
|
2261
|
+
const h = T(e ? E(e, "vertAlign") : null);
|
|
2262
2262
|
return h === "superscript" ? i = `<sup>${i}</sup>` : h === "subscript" && (i = `<sub>${i}</sub>`), i;
|
|
2263
2263
|
}
|
|
2264
2264
|
convertImage(t) {
|
|
@@ -2278,10 +2278,10 @@ class Lt {
|
|
|
2278
2278
|
}
|
|
2279
2279
|
convertTable(t) {
|
|
2280
2280
|
let e = '<table style="border-collapse:collapse;width:100%"><tbody>';
|
|
2281
|
-
for (const i of
|
|
2281
|
+
for (const i of D(t, "tr")) {
|
|
2282
2282
|
e += "<tr>";
|
|
2283
|
-
for (const s of
|
|
2284
|
-
const l = parseInt(T(
|
|
2283
|
+
for (const s of D(i, "tc")) {
|
|
2284
|
+
const l = parseInt(T(E(s, "tcPr", "gridSpan")) || "1", 10) || 1, o = l > 1 ? ` colspan="${l}"` : "";
|
|
2285
2285
|
let n = "";
|
|
2286
2286
|
for (const r of Array.from(s.children))
|
|
2287
2287
|
r.localName === "p" ? n += this.convertPara(r) : r.localName === "tbl" && (n += this.convertTable(r));
|
|
@@ -2292,8 +2292,8 @@ class Lt {
|
|
|
2292
2292
|
return e + "</tbody></table>";
|
|
2293
2293
|
}
|
|
2294
2294
|
}
|
|
2295
|
-
async function
|
|
2296
|
-
const t = p instanceof ArrayBuffer ? p : await p.arrayBuffer(), e =
|
|
2295
|
+
async function kt(p) {
|
|
2296
|
+
const t = p instanceof ArrayBuffer ? p : await p.arrayBuffer(), e = Et(t), i = new TextDecoder(), s = async (u) => {
|
|
2297
2297
|
const v = e.get(u);
|
|
2298
2298
|
return v ? new DOMParser().parseFromString(i.decode(await Q(t, v)), "application/xml") : null;
|
|
2299
2299
|
}, l = await s("word/document.xml"), o = l == null ? void 0 : l.getElementsByTagName("*");
|
|
@@ -2320,7 +2320,7 @@ async function Ht(p) {
|
|
|
2320
2320
|
const C = (b.split(".").pop() || "").toLowerCase(), M = St[C];
|
|
2321
2321
|
if (M)
|
|
2322
2322
|
try {
|
|
2323
|
-
d.set(u, `data:${M};base64,${
|
|
2323
|
+
d.set(u, `data:${M};base64,${Lt(await Q(t, x))}`);
|
|
2324
2324
|
} catch {
|
|
2325
2325
|
}
|
|
2326
2326
|
}
|
|
@@ -2329,60 +2329,80 @@ async function Ht(p) {
|
|
|
2329
2329
|
const u = /* @__PURE__ */ new Map(), v = Array.from(g.getElementsByTagName("*"));
|
|
2330
2330
|
for (const b of v) {
|
|
2331
2331
|
if (b.localName !== "abstractNum") continue;
|
|
2332
|
-
const x = T(b, "abstractNumId"), C =
|
|
2332
|
+
const x = T(b, "abstractNumId"), C = D(b, "lvl").find((w) => T(w, "ilvl") === "0") || D(b, "lvl")[0], M = C ? T(E(C, "numFmt")) : "";
|
|
2333
2333
|
u.set(x, M === "bullet" ? "ul" : "ol");
|
|
2334
2334
|
}
|
|
2335
2335
|
for (const b of v) {
|
|
2336
2336
|
if (b.localName !== "num") continue;
|
|
2337
|
-
const x = T(b, "numId"), C = T(
|
|
2337
|
+
const x = T(b, "numId"), C = T(E(b, "abstractNumId"));
|
|
2338
2338
|
m.set(x, u.get(C) || "ul");
|
|
2339
2339
|
}
|
|
2340
2340
|
}
|
|
2341
|
-
return new
|
|
2341
|
+
return new Ht(r, d, m).convertBody(n);
|
|
2342
2342
|
}
|
|
2343
|
-
const
|
|
2343
|
+
const At = ["nw", "ne", "sw", "se"], F = ["img-left", "img-right", "img-top", "img-center"], O = {
|
|
2344
2344
|
"img-left": "tplimgleft",
|
|
2345
2345
|
"img-right": "tplimgright",
|
|
2346
2346
|
"img-top": "tplimgtop",
|
|
2347
2347
|
"img-center": "tplimgcenter"
|
|
2348
|
-
},
|
|
2348
|
+
}, It = {
|
|
2349
2349
|
"img-left": a.tplleft,
|
|
2350
2350
|
"img-right": a.tplright,
|
|
2351
2351
|
"img-top": a.tpltop,
|
|
2352
2352
|
"img-center": a.tplcenter
|
|
2353
|
-
},
|
|
2354
|
-
let
|
|
2353
|
+
}, qt = ".tox,.pop,.tblctx,.imgctx,.selctx,.dlg";
|
|
2354
|
+
let S = null, A = null, $ = 0, K = !1;
|
|
2355
2355
|
function N() {
|
|
2356
|
-
clearTimeout($), A = null,
|
|
2356
|
+
clearTimeout($), A = null, S && S.classList.remove("show");
|
|
2357
2357
|
}
|
|
2358
|
-
function
|
|
2358
|
+
function Bt(p) {
|
|
2359
2359
|
const t = p.dataset.tip;
|
|
2360
2360
|
if (!t) return;
|
|
2361
2361
|
A = p, clearTimeout($);
|
|
2362
|
-
const e =
|
|
2362
|
+
const e = S && S.classList.contains("show") ? 60 : 350;
|
|
2363
2363
|
$ = window.setTimeout(() => {
|
|
2364
2364
|
if (A !== p || !document.contains(p)) return;
|
|
2365
|
-
|
|
2366
|
-
const i = p.getBoundingClientRect(), s =
|
|
2365
|
+
S || (S = document.createElement("div"), S.className = "etip", document.body.appendChild(S)), S.textContent = t, S.classList.add("show");
|
|
2366
|
+
const i = p.getBoundingClientRect(), s = S.offsetWidth, l = S.offsetHeight;
|
|
2367
2367
|
let o = i.left + i.width / 2 - s / 2;
|
|
2368
2368
|
o = Math.max(6, Math.min(o, innerWidth - s - 6));
|
|
2369
2369
|
let n = i.bottom + 7;
|
|
2370
|
-
n + l > innerHeight - 6 && (n = i.top - l - 7),
|
|
2370
|
+
n + l > innerHeight - 6 && (n = i.top - l - 7), S.style.left = o + "px", S.style.top = n + "px";
|
|
2371
2371
|
}, e);
|
|
2372
2372
|
}
|
|
2373
|
-
function
|
|
2373
|
+
function Nt() {
|
|
2374
2374
|
K || (K = !0, document.addEventListener("mouseover", (p) => {
|
|
2375
2375
|
const t = p.target, e = t.closest ? t.closest("[title],[data-tip]") : null;
|
|
2376
|
-
if (!e || !e.closest(
|
|
2376
|
+
if (!e || !e.closest(qt) || e.closest(".earea")) {
|
|
2377
2377
|
e !== A && N();
|
|
2378
2378
|
return;
|
|
2379
2379
|
}
|
|
2380
2380
|
const i = e.getAttribute("title");
|
|
2381
|
-
i && (e.dataset.tip = i, e.removeAttribute("title"), e.getAttribute("aria-label") || e.setAttribute("aria-label", i)), e !== A &&
|
|
2381
|
+
i && (e.dataset.tip = i, e.removeAttribute("title"), e.getAttribute("aria-label") || e.setAttribute("aria-label", i)), e !== A && Bt(e);
|
|
2382
2382
|
}), document.addEventListener("mouseout", (p) => {
|
|
2383
2383
|
A && !A.contains(p.relatedTarget) && N();
|
|
2384
2384
|
}), document.addEventListener("mousedown", N, !0), addEventListener("scroll", N, !0));
|
|
2385
2385
|
}
|
|
2386
|
+
const Zt = /[\u0590-\u05FF\u0600-\u06FF\u0750-\u077F\u0780-\u07BF\u08A0-\u08FF\uFB1D-\uFB4F\uFB50-\uFDFF\uFE70-\uFEFF]/, Dt = new RegExp("\\p{L}", "u"), Pt = "p,div,li,td,th,blockquote,h1,h2,h3,h4,h5,h6,pre,figcaption";
|
|
2387
|
+
function Rt(p) {
|
|
2388
|
+
for (const t of p) {
|
|
2389
|
+
if (Zt.test(t)) return "rtl";
|
|
2390
|
+
if (Dt.test(t)) return "ltr";
|
|
2391
|
+
}
|
|
2392
|
+
return null;
|
|
2393
|
+
}
|
|
2394
|
+
function et(p) {
|
|
2395
|
+
let t = "";
|
|
2396
|
+
return p.childNodes.forEach((e) => {
|
|
2397
|
+
if (e.nodeType === Node.TEXT_NODE)
|
|
2398
|
+
t += e.nodeValue || "";
|
|
2399
|
+
else if (e.nodeType === Node.ELEMENT_NODE) {
|
|
2400
|
+
const i = e, s = (i.getAttribute("dir") || "").toLowerCase();
|
|
2401
|
+
if (s === "rtl" || s === "ltr") return;
|
|
2402
|
+
t += et(i);
|
|
2403
|
+
}
|
|
2404
|
+
}), t;
|
|
2405
|
+
}
|
|
2386
2406
|
const I = class I {
|
|
2387
2407
|
constructor(t) {
|
|
2388
2408
|
this.lang = "en", this.contentClass = "fable-content-" + I.instanceCounter++, this.contentStyleEl = null, this.savedRange = null, this.foreColor = "#000000", this.backColor = "#FACC15", this.openPop = null, this.openSubEl = null, this.popAnchor = null, this.dlgOvl = null, this.tblActive = null, this.tblCorner = null, this.tblColBars = [], this.tblCtx = null, this.tblCellMark = null, this.tblOpMark = null, this.tblOpMarkKind = null, this.imgActive = null, this.imgHandles = [], this.imgCtx = null, this.imgHideTimer = null, this.phActive = null, this.phCtx = null, this.phUploadTarget = null, this.vidActive = null, this.vidCtx = null, this.vidHideTimer = null, this.vphActive = null, this.vphCtx = null, this.vphUploadTarget = null, this.selCtx = null, this.tbrMore = null, this.tbrExpanded = !1, this.codeActive = null, this.codeCtx = null, this.tplActive = null, this.tplCtx = null, this.revisions = [], this.revTimer = null, this.draftTimer = null, this.draftStorageKey = "", this.listeners = [], this.isDestroyed = !1, this.options = {
|
|
@@ -2399,7 +2419,7 @@ const I = class I {
|
|
|
2399
2419
|
statusbar: t.statusbar ?? !0,
|
|
2400
2420
|
readonly: t.readonly ?? !1,
|
|
2401
2421
|
draftKey: t.draftKey ?? (typeof location < "u" ? location.pathname : "default"),
|
|
2402
|
-
fontFamilyFormats: t.fontFamilyFormats ??
|
|
2422
|
+
fontFamilyFormats: t.fontFamilyFormats ?? ot,
|
|
2403
2423
|
imageFileTypes: t.imageFileTypes ?? ["image/jpeg", "image/jpg", "image/png", "image/gif", "image/bmp", "image/webp"],
|
|
2404
2424
|
videoFileTypes: t.videoFileTypes ?? ["video/mp4", "video/webm", "video/ogg"]
|
|
2405
2425
|
}, this.imageUploadHandler = t.imageUploadHandler, this.onImageUploadError = t.onImageUploadError, this.videoUploadHandler = t.videoUploadHandler, this.onVideoUploadError = t.onVideoUploadError, this.contentStyle = t.contentStyle, this.applyTheme(t), this.lang = this.options.language, this.draftStorageKey = "tmclone-draft:" + this.options.draftKey, this.initDOM(), this.bindEvents(), this.initUI(), this.recordRevision(), this.options.onReady(this);
|
|
@@ -2425,7 +2445,7 @@ const I = class I {
|
|
|
2425
2445
|
</span>
|
|
2426
2446
|
`, this.sbHelp = this.statusbar.querySelector(".mid"), this.sbWords = this.statusbar.querySelector(".words");
|
|
2427
2447
|
const e = this.statusbar.querySelector(".grip");
|
|
2428
|
-
this.bindGrip(e), this.shell.appendChild(this.menubar), this.shell.appendChild(this.toolbar), this.shell.appendChild(this.ed), this.shell.appendChild(this.statusbar), this.contentStyle && (this.contentStyleEl = document.createElement("style"), this.contentStyleEl.textContent = this.scopeContentStyle(this.contentStyle), this.shell.appendChild(this.contentStyleEl)), t.appendChild(this.shell),
|
|
2448
|
+
this.bindGrip(e), this.shell.appendChild(this.menubar), this.shell.appendChild(this.toolbar), this.shell.appendChild(this.ed), this.shell.appendChild(this.statusbar), this.contentStyle && (this.contentStyleEl = document.createElement("style"), this.contentStyleEl.textContent = this.scopeContentStyle(this.contentStyle), this.shell.appendChild(this.contentStyleEl)), t.appendChild(this.shell), Nt(), this.options.statusbar || (this.statusbar.style.display = "none"), this.imgInput = document.createElement("input"), this.imgInput.type = "file", this.imgInput.accept = this.options.imageFileTypes.join(","), this.imgInput.style.display = "none", t.appendChild(this.imgInput), this.vidInput = document.createElement("input"), this.vidInput.type = "file", this.vidInput.accept = this.options.videoFileTypes.join(","), this.vidInput.style.display = "none", t.appendChild(this.vidInput), this.docInput = document.createElement("input"), this.docInput.type = "file", this.docInput.accept = ".docx,application/vnd.openxmlformats-officedocument.wordprocessingml.document", this.docInput.style.display = "none", t.appendChild(this.docInput);
|
|
2429
2449
|
}
|
|
2430
2450
|
/** Theme options land as CSS variables on the document root rather than the editor
|
|
2431
2451
|
* shell, because dialogs, popups and floating context toolbars are appended to
|
|
@@ -2583,8 +2603,13 @@ const I = class I {
|
|
|
2583
2603
|
* descendant that has no `text-align` of its own — even one with its own
|
|
2584
2604
|
* dir="rtl". Elements that already carry their own dir (preserved as-is by
|
|
2585
2605
|
* the paste engine) each get their own matching text-align only if they
|
|
2586
|
-
* don't already have one
|
|
2587
|
-
*
|
|
2606
|
+
* don't already have one. Blocks with no reliable explicit dir (missing, or
|
|
2607
|
+
* dir="auto" from plain-text paste) get their direction from a first-strong-
|
|
2608
|
+
* character scan of their own text instead of silently inheriting the
|
|
2609
|
+
* editor's configured UI language — mixed-direction content and any
|
|
2610
|
+
* alignment the user explicitly set are left untouched either way. Only
|
|
2611
|
+
* content with no strongly-directional character anywhere falls back to the
|
|
2612
|
+
* editor's current direction. */
|
|
2588
2613
|
getContentForEmail() {
|
|
2589
2614
|
const t = (o, n) => {
|
|
2590
2615
|
const r = (o.getAttribute("style") || "").trim();
|
|
@@ -2597,6 +2622,14 @@ const I = class I {
|
|
|
2597
2622
|
if (n !== "rtl" && n !== "ltr") return;
|
|
2598
2623
|
const r = n;
|
|
2599
2624
|
i || (i = r), /text-align\s*:/i.test(o.getAttribute("style") || "") || t(o, `text-align:${r === "rtl" ? "right" : "left"}`);
|
|
2625
|
+
}), e.querySelectorAll(Pt).forEach((o) => {
|
|
2626
|
+
const n = (o.getAttribute("dir") || "").toLowerCase();
|
|
2627
|
+
if (n === "rtl" || n === "ltr") return;
|
|
2628
|
+
const r = Rt(et(o));
|
|
2629
|
+
if (!r) return;
|
|
2630
|
+
i || (i = r), o.setAttribute("dir", r);
|
|
2631
|
+
const c = /text-align\s*:/i.test(o.getAttribute("style") || "");
|
|
2632
|
+
t(o, c ? `direction:${r}` : `direction:${r};text-align:${r === "rtl" ? "right" : "left"}`);
|
|
2600
2633
|
});
|
|
2601
2634
|
const s = i || this.ed.getAttribute("dir") || this.dir();
|
|
2602
2635
|
return e.querySelectorAll("table:not([dir])").forEach((o) => {
|
|
@@ -2616,7 +2649,7 @@ const I = class I {
|
|
|
2616
2649
|
this.ed.focus();
|
|
2617
2650
|
}
|
|
2618
2651
|
async importWordFile(t) {
|
|
2619
|
-
const e = await
|
|
2652
|
+
const e = await kt(t);
|
|
2620
2653
|
this.recordRevision(), this.setContent(e), this.recordRevision();
|
|
2621
2654
|
}
|
|
2622
2655
|
restoreDraft() {
|
|
@@ -2828,7 +2861,7 @@ const I = class I {
|
|
|
2828
2861
|
return l.type = "button", l.className = "cchip", l.title = s, l.addEventListener("mousedown", (o) => {
|
|
2829
2862
|
o.preventDefault(), this.saveSel();
|
|
2830
2863
|
}), l;
|
|
2831
|
-
}, e =
|
|
2864
|
+
}, e = ct.map((s) => {
|
|
2832
2865
|
const l = t(this.t("forecolor"));
|
|
2833
2866
|
return l.style.background = s, l.addEventListener("click", () => this.applyColor("fore", s)), l;
|
|
2834
2867
|
}), i = t(this.t("forecolor"));
|
|
@@ -2888,7 +2921,7 @@ const I = class I {
|
|
|
2888
2921
|
* table cell-background menu all show the identical popup. */
|
|
2889
2922
|
buildPaletteInto(t, e, i) {
|
|
2890
2923
|
const s = document.createElement("div");
|
|
2891
|
-
s.className = "cpal",
|
|
2924
|
+
s.className = "cpal", ht.forEach((d) => {
|
|
2892
2925
|
const m = document.createElement("button");
|
|
2893
2926
|
m.type = "button", m.style.background = d, m.title = d, m.addEventListener("click", () => {
|
|
2894
2927
|
this.closePop(), i(d);
|
|
@@ -2937,7 +2970,7 @@ const I = class I {
|
|
|
2937
2970
|
this.popup(t, (e) => this.menuItems(e, this.fontItems()));
|
|
2938
2971
|
}
|
|
2939
2972
|
sizeItems() {
|
|
2940
|
-
return
|
|
2973
|
+
return nt.map((t) => ({
|
|
2941
2974
|
label: t,
|
|
2942
2975
|
on: this.currentSize() === t,
|
|
2943
2976
|
action: () => this.applyFontSize(t)
|
|
@@ -2990,7 +3023,7 @@ const I = class I {
|
|
|
2990
3023
|
this.saveSel(), this.refreshState(), this.onChange();
|
|
2991
3024
|
}
|
|
2992
3025
|
stepFontSize(t) {
|
|
2993
|
-
const e = parseInt(this.currentSize(), 10) || 14, i = Math.min(
|
|
3026
|
+
const e = parseInt(this.currentSize(), 10) || 14, i = Math.min(at, Math.max(rt, e + t));
|
|
2994
3027
|
i !== e && this.applyFontSize(i + "px");
|
|
2995
3028
|
}
|
|
2996
3029
|
/* ------------------------------------------------ case / spacing / link */
|
|
@@ -3042,7 +3075,7 @@ const I = class I {
|
|
|
3042
3075
|
];
|
|
3043
3076
|
}
|
|
3044
3077
|
lineHeightMenu(t) {
|
|
3045
|
-
this.popup(t, (e) => this.menuItems(e, this.blockStyleItems("lineHeight",
|
|
3078
|
+
this.popup(t, (e) => this.menuItems(e, this.blockStyleItems("lineHeight", z)));
|
|
3046
3079
|
}
|
|
3047
3080
|
wordSpacingMenu(t) {
|
|
3048
3081
|
this.popup(t, (e) => this.menuItems(e, this.blockStyleItems("wordSpacing", U)));
|
|
@@ -3231,7 +3264,7 @@ const I = class I {
|
|
|
3231
3264
|
}
|
|
3232
3265
|
buildToolbar() {
|
|
3233
3266
|
this.toolbar.innerHTML = "";
|
|
3234
|
-
const t = this.options.toolbar === !0 ?
|
|
3267
|
+
const t = this.options.toolbar === !0 ? st : this.options.toolbar, e = this.buildToolbarRegistry();
|
|
3235
3268
|
this.parseToolbarString(t).forEach((i) => {
|
|
3236
3269
|
const s = [];
|
|
3237
3270
|
i.forEach((l) => {
|
|
@@ -3341,7 +3374,7 @@ const I = class I {
|
|
|
3341
3374
|
{ label: this.t("fontsize"), subBuild: (s) => this.menuItems(s, this.sizeItems()) },
|
|
3342
3375
|
{ label: this.t("blocks"), subBuild: (s) => this.menuItems(s, this.blockItems()) },
|
|
3343
3376
|
{ label: this.t("align"), subBuild: (s) => this.menuItems(s, this.alignItems()) },
|
|
3344
|
-
{ label: this.t("lineheight"), icon: a.lineheight, subBuild: (s) => this.menuItems(s, this.blockStyleItems("lineHeight",
|
|
3377
|
+
{ label: this.t("lineheight"), icon: a.lineheight, subBuild: (s) => this.menuItems(s, this.blockStyleItems("lineHeight", z)) },
|
|
3345
3378
|
{ label: this.t("wordspacing"), icon: a.wordspacing, subBuild: (s) => this.menuItems(s, this.blockStyleItems("wordSpacing", U)) },
|
|
3346
3379
|
{ label: this.t("letterspacing"), icon: a.letterspacing, subBuild: (s) => this.menuItems(s, this.blockStyleItems("letterSpacing", V)) },
|
|
3347
3380
|
"|",
|
|
@@ -3413,7 +3446,7 @@ const I = class I {
|
|
|
3413
3446
|
{ label: this.t("deltable"), icon: a.trash, action: () => this.tableOp("deltable") }
|
|
3414
3447
|
],
|
|
3415
3448
|
help: [this.mItem("helpttl", a.helpic, () => this.helpDlg(), "Alt+0")]
|
|
3416
|
-
}, e = this.options.menubar === !0 ?
|
|
3449
|
+
}, e = this.options.menubar === !0 ? lt : this.options.menubar, i = /* @__PURE__ */ new Set();
|
|
3417
3450
|
e.split(/\s+/).filter(Boolean).forEach((s) => {
|
|
3418
3451
|
if (i.has(s)) return;
|
|
3419
3452
|
if (i.add(s), !t[s]) {
|
|
@@ -3787,10 +3820,10 @@ const I = class I {
|
|
|
3787
3820
|
});
|
|
3788
3821
|
}
|
|
3789
3822
|
charMap() {
|
|
3790
|
-
this.glyphPickerDlg(this.t("charmap").replace("…", ""),
|
|
3823
|
+
this.glyphPickerDlg(this.t("charmap").replace("…", ""), dt, !1);
|
|
3791
3824
|
}
|
|
3792
3825
|
emojiMap() {
|
|
3793
|
-
this.glyphPickerDlg(this.t("emoji").replace("…", ""),
|
|
3826
|
+
this.glyphPickerDlg(this.t("emoji").replace("…", ""), pt, !0);
|
|
3794
3827
|
}
|
|
3795
3828
|
printDoc() {
|
|
3796
3829
|
const t = window.open("", "_blank");
|
|
@@ -4131,8 +4164,8 @@ const I = class I {
|
|
|
4131
4164
|
};
|
|
4132
4165
|
if (this.videoUploadHandler)
|
|
4133
4166
|
this.videoUploadHandler(w).then(k).catch((H) => {
|
|
4134
|
-
var
|
|
4135
|
-
x.disabled = !1, x.textContent = this.t("uploadfailed"), (
|
|
4167
|
+
var _;
|
|
4168
|
+
x.disabled = !1, x.textContent = this.t("uploadfailed"), (_ = this.onVideoUploadError) == null || _.call(this, H, w);
|
|
4136
4169
|
});
|
|
4137
4170
|
else {
|
|
4138
4171
|
const H = new FileReader();
|
|
@@ -4360,9 +4393,9 @@ const I = class I {
|
|
|
4360
4393
|
}
|
|
4361
4394
|
buildTemplatePickInto(t, e) {
|
|
4362
4395
|
const i = document.createElement("div");
|
|
4363
|
-
i.className = "tplpick",
|
|
4396
|
+
i.className = "tplpick", F.forEach((s) => {
|
|
4364
4397
|
const l = document.createElement("button");
|
|
4365
|
-
l.type = "button", l.className = "tpltile", l.title = this.t(
|
|
4398
|
+
l.type = "button", l.className = "tpltile", l.title = this.t(O[s]), l.innerHTML = this.tplPreviewHTML(s) + `<span class="tpllbl">${this.t(O[s])}</span>`, l.addEventListener("click", () => {
|
|
4366
4399
|
this.closePop(), this.insertTemplate(s), e == null || e();
|
|
4367
4400
|
}), i.appendChild(l);
|
|
4368
4401
|
}), t.appendChild(i);
|
|
@@ -4381,15 +4414,15 @@ const I = class I {
|
|
|
4381
4414
|
}
|
|
4382
4415
|
renderTplCtxButtons() {
|
|
4383
4416
|
const t = this.tplCtx, e = this.tplActive;
|
|
4384
|
-
!t || !e || (t.innerHTML = "",
|
|
4385
|
-
const s = this.ctxBtn(
|
|
4417
|
+
!t || !e || (t.innerHTML = "", F.forEach((i) => {
|
|
4418
|
+
const s = this.ctxBtn(It[i], this.t(O[i]), () => this.setTplLayout(i));
|
|
4386
4419
|
s.classList.toggle("on", e.classList.contains("tpl-" + i)), t.appendChild(s);
|
|
4387
4420
|
}), t.append(this.ctxSep(), this.ctxBtn(a.trash, this.t("deltemplate"), () => this.removeTemplate())), this.positionTplCtx());
|
|
4388
4421
|
}
|
|
4389
4422
|
setTplLayout(t) {
|
|
4390
4423
|
const e = this.tplActive;
|
|
4391
4424
|
if (!e) return;
|
|
4392
|
-
|
|
4425
|
+
F.forEach((l) => e.classList.remove("tpl-" + l)), e.classList.add("tpl-" + t);
|
|
4393
4426
|
const i = e.querySelector(":scope > .tpl-media"), s = e.querySelector(":scope > .tpl-text");
|
|
4394
4427
|
i && s && (t === "img-center" ? e.appendChild(i) : e.insertBefore(i, s)), this.renderTplCtxButtons(), this.positionImgPhCtx(), this.positionImageHandles(), this.onChange();
|
|
4395
4428
|
}
|
|
@@ -4565,7 +4598,7 @@ const I = class I {
|
|
|
4565
4598
|
this.cancelImgHide(), this.imgHandles.forEach((i) => i.remove()), this.imgHandles = [], (t = this.imgCtx) == null || t.remove(), this.imgCtx = null, (e = this.imgActive) == null || e.classList.remove("img-selected"), this.imgActive = null;
|
|
4566
4599
|
}
|
|
4567
4600
|
selectImage(t) {
|
|
4568
|
-
this.imgActive !== t && (this.clearImageHandles(), this.imgActive = t, t.classList.add("img-selected"), this.imgHandles =
|
|
4601
|
+
this.imgActive !== t && (this.clearImageHandles(), this.imgActive = t, t.classList.add("img-selected"), this.imgHandles = At.map((e) => {
|
|
4569
4602
|
const i = document.createElement("div");
|
|
4570
4603
|
return i.className = "img-handle img-handle-" + e, i.dataset.corner = e, i.addEventListener("mousedown", (s) => this.startImageResizeDrag(s, e)), i.addEventListener("mouseenter", () => this.cancelImgHide()), i.addEventListener("mouseleave", () => this.scheduleImgHide()), document.body.appendChild(i), i;
|
|
4571
4604
|
}), this.imgCtx = this.buildImageCtxToolbar(t), this.positionImageHandles());
|
|
@@ -4818,7 +4851,7 @@ const I = class I {
|
|
|
4818
4851
|
return;
|
|
4819
4852
|
}
|
|
4820
4853
|
}
|
|
4821
|
-
i ? document.execCommand("insertHTML", !1,
|
|
4854
|
+
i ? document.execCommand("insertHTML", !1, Tt(i, this.dir())) : document.execCommand("insertHTML", !1, Mt(e.getData("text/plain"))), this.onChange();
|
|
4822
4855
|
}
|
|
4823
4856
|
/* ---------------------------------------------------------- init */
|
|
4824
4857
|
initUI() {
|
|
@@ -4829,15 +4862,15 @@ I.instanceCounter = 0, I.TBR_COLLAPSE_MAX = 992;
|
|
|
4829
4862
|
let J = I;
|
|
4830
4863
|
export {
|
|
4831
4864
|
j as BLOCKS,
|
|
4832
|
-
|
|
4833
|
-
|
|
4834
|
-
|
|
4865
|
+
Ft as CHARS,
|
|
4866
|
+
ht as COLORS,
|
|
4867
|
+
ot as FONTS,
|
|
4835
4868
|
J as FableEditor,
|
|
4836
|
-
|
|
4869
|
+
it as I18N,
|
|
4837
4870
|
a as IC,
|
|
4838
|
-
|
|
4839
|
-
|
|
4840
|
-
|
|
4871
|
+
nt as SIZES,
|
|
4872
|
+
Ot as TXT,
|
|
4873
|
+
Tt as cleanPastedHTML,
|
|
4841
4874
|
R as getStrings,
|
|
4842
|
-
|
|
4875
|
+
Mt as normalizeTextPaste
|
|
4843
4876
|
};
|