fable-editor 1.2.1 → 1.2.3

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.
@@ -1,4 +1,4 @@
1
- const K = {
1
+ const et = {
2
2
  en: {
3
3
  dir: "ltr",
4
4
  file: "File",
@@ -53,6 +53,7 @@ const K = {
53
53
  aligncenter: "Align center",
54
54
  alignright: "Align right",
55
55
  alignjustify: "Justify",
56
+ align: "Align",
56
57
  numlist: "Numbered list",
57
58
  bullist: "Bullet list",
58
59
  forecolor: "Text color",
@@ -244,6 +245,7 @@ const K = {
244
245
  aligncenter: "توسيط",
245
246
  alignright: "محاذاة لليمين",
246
247
  alignjustify: "ضبط",
248
+ align: "محاذاة",
247
249
  numlist: "قائمة رقمية",
248
250
  bullist: "قائمة نقطية",
249
251
  forecolor: "لون النص",
@@ -383,9 +385,9 @@ const K = {
383
385
  }
384
386
  };
385
387
  function R(p) {
386
- return K[p];
388
+ return et[p];
387
389
  }
388
- const J = "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", tt = "file edit view insert format tools table help", et = [
390
+ const it = "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", st = "file edit view insert format tools table help", lt = [
389
391
  ["Andale Mono", "andale mono,times"],
390
392
  ["Arial", "arial,helvetica,sans-serif"],
391
393
  ["Arial Black", "arial black,avant garde"],
@@ -405,7 +407,7 @@ const J = "undo redo | preview print | importword revhistory | fontfamily fontsi
405
407
  ["Verdana", "verdana,geneva"],
406
408
  ["Webdings", "webdings"],
407
409
  ["Wingdings", "wingdings,zapf dingbats"]
408
- ], it = ["8px", "9px", "10px", "11px", "12px", "14px", "16px", "18px", "20px", "24px", "28px", "32px", "36px", "48px", "72px", "96px"], st = 1, lt = 100, ot = ["1", "1.15", "1.4", "1.5", "1.75", "2", "2.5", "3"], nt = ["1px", "2px", "4px", "6px", "8px", "12px"], rt = ["0.5px", "1px", "1.5px", "2px", "3px", "4px"], _ = [
410
+ ], ot = ["8px", "9px", "10px", "11px", "12px", "14px", "16px", "18px", "20px", "24px", "28px", "32px", "36px", "48px", "72px", "96px"], nt = 1, rt = 100, _ = ["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 = [
409
411
  ["plain", "Plain text"],
410
412
  ["html", "HTML/XML"],
411
413
  ["css", "CSS"],
@@ -422,7 +424,7 @@ const J = "undo redo | preview print | importword revhistory | fontfamily fontsi
422
424
  ["rust", "Rust"],
423
425
  ["sql", "SQL"],
424
426
  ["bash", "Bash/Shell"]
425
- ], V = [
427
+ ], j = [
426
428
  ["p", "para"],
427
429
  ["h1", "heading1"],
428
430
  ["h2", "heading2"],
@@ -1522,7 +1524,7 @@ const J = "undo redo | preview print | importword revhistory | fontfamily fontsi
1522
1524
  "🇲🇦"
1523
1525
  ]
1524
1526
  }
1525
- ], Bt = [
1527
+ ], Nt = [
1526
1528
  "©",
1527
1529
  "®",
1528
1530
  "™",
@@ -1575,7 +1577,7 @@ const J = "undo redo | preview print | importword revhistory | fontfamily fontsi
1575
1577
  '<path d="M10 6h10M10 12h10M10 18h10"/>' + p.map(
1576
1578
  (e, i) => `<text x="2.5" y="${8.4 + i * 6}" font-size="${t}" stroke="none" fill="#222f3e" font-family="Arial">${e}</text>`
1577
1579
  ).join("")
1578
- ), c = {
1580
+ ), a = {
1579
1581
  bold: f(
1580
1582
  "M272-200v-560h221q65 0 120 40t55 111q0 51-23 78.5T602-491q25 11 55.5 41t30.5 90q0 89-65 124.5T501-200H272Zm121-112h104q48 0 58.5-24.5T566-372q0-11-10.5-35.5T494-432H393v120Zm0-228h93q33 0 48-17t15-38q0-24-17-39t-44-15h-95v109Z"
1581
1583
  ),
@@ -1808,7 +1810,7 @@ const J = "undo redo | preview print | importword revhistory | fontfamily fontsi
1808
1810
  codesampleic: y(
1809
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"/>'
1810
1812
  )
1811
- }, Nt = (p) => `<span class="txt">${p}</span>`, pt = /* @__PURE__ */ new Set([
1813
+ }, Zt = (p) => `<span class="txt">${p}</span>`, pt = /* @__PURE__ */ new Set([
1812
1814
  "p",
1813
1815
  "div",
1814
1816
  "span",
@@ -1906,7 +1908,7 @@ const J = "undo redo | preview print | importword revhistory | fontfamily fontsi
1906
1908
  "box-sizing",
1907
1909
  "list-style-type",
1908
1910
  "white-space"
1909
- ]), W = {
1911
+ ]), X = {
1910
1912
  "*": ["dir", "lang", "colspan", "rowspan"],
1911
1913
  a: ["href", "target", "rel", "title"],
1912
1914
  img: ["src", "alt", "width", "height", "title"],
@@ -1945,18 +1947,18 @@ function ft(p) {
1945
1947
  const l = [], o = s[0];
1946
1948
  s.forEach((n) => {
1947
1949
  var x, C, M;
1948
- const a = +(((x = (n.getAttribute("style") || "").match(/level(\d+)/i)) == null ? void 0 : x[1]) || 1), h = Array.from(n.querySelectorAll("span")).find(
1950
+ const c = +(((x = (n.getAttribute("style") || "").match(/level(\d+)/i)) == null ? void 0 : x[1]) || 1), h = Array.from(n.querySelectorAll("span")).find(
1949
1951
  (w) => /mso-list\s*:\s*ignore/i.test(w.getAttribute("style") || "")
1950
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 } = gt(d);
1951
- for (h && h.remove(); l.length && l[l.length - 1].level > a; ) l.pop();
1952
- if (!l.length || l[l.length - 1].level < a) {
1953
+ for (h && h.remove(); l.length && l[l.length - 1].level > c; ) l.pop();
1954
+ if (!l.length || l[l.length - 1].level < c) {
1953
1955
  const w = p.createElement(m ? "ol" : "ul");
1954
1956
  if (m && g && (w.style.listStyleType = g), l.length) {
1955
- const k = l[l.length - 1].list;
1956
- (k.lastElementChild || k).appendChild(w);
1957
+ const H = l[l.length - 1].list;
1958
+ (H.lastElementChild || H).appendChild(w);
1957
1959
  } else
1958
1960
  o.parentNode.insertBefore(w, o);
1959
- l.push({ list: w, level: a });
1961
+ l.push({ list: w, level: c });
1960
1962
  }
1961
1963
  const u = p.createElement("li"), v = D(n), b = ["text-align", "direction", "unicode-bidi", "color", "font-size", "font-family", "background-color"].filter((w) => v[w]).map((w) => w + ":" + v[w]).join(";");
1962
1964
  for (b && u.setAttribute("style", b), n.getAttribute("dir") && u.setAttribute("dir", n.getAttribute("dir")); n.firstChild; ) u.appendChild(n.firstChild);
@@ -1989,7 +1991,7 @@ function bt(p) {
1989
1991
  e.style.backgroundColor = e.style.backgroundColor || e.getAttribute("bgcolor"), e.removeAttribute("bgcolor");
1990
1992
  });
1991
1993
  }
1992
- function N(p, t) {
1994
+ function Z(p, t) {
1993
1995
  Array.from(p.childNodes).forEach((e) => {
1994
1996
  if (e.nodeType === Node.COMMENT_NODE) {
1995
1997
  e.remove();
@@ -2001,8 +2003,8 @@ function N(p, t) {
2001
2003
  if (s === "font") {
2002
2004
  const r = t.createElement("span");
2003
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"));
2004
- const a = i.getAttribute("size");
2005
- if (a && !r.style.fontSize) {
2006
+ const c = i.getAttribute("size");
2007
+ if (c && !r.style.fontSize) {
2006
2008
  const h = {
2007
2009
  1: "8pt",
2008
2010
  2: "10pt",
@@ -2012,20 +2014,20 @@ function N(p, t) {
2012
2014
  6: "24pt",
2013
2015
  7: "36pt"
2014
2016
  };
2015
- h[a] && (r.style.fontSize = h[a]);
2017
+ h[c] && (r.style.fontSize = h[c]);
2016
2018
  }
2017
2019
  for (; i.firstChild; ) r.appendChild(i.firstChild);
2018
- i.replaceWith(r), N(r, t);
2020
+ i.replaceWith(r), Z(r, t);
2019
2021
  return;
2020
2022
  }
2021
- for (N(i, t); i.firstChild; ) i.parentNode.insertBefore(i.firstChild, i);
2023
+ for (Z(i, t); i.firstChild; ) i.parentNode.insertBefore(i.firstChild, i);
2022
2024
  i.remove();
2023
2025
  return;
2024
2026
  }
2025
- const l = /* @__PURE__ */ new Set([...W["*"] || [], ...W[s] || []]);
2027
+ const l = /* @__PURE__ */ new Set([...X["*"] || [], ...X[s] || []]);
2026
2028
  if (Array.from(i.attributes).forEach((r) => {
2027
- const a = r.name.toLowerCase();
2028
- a !== "style" && !l.has(a) && i.removeAttribute(r.name);
2029
+ const c = r.name.toLowerCase();
2030
+ c !== "style" && !l.has(c) && i.removeAttribute(r.name);
2029
2031
  }), s === "a") {
2030
2032
  const r = i.getAttribute("href") || "";
2031
2033
  /^(https?:|mailto:|tel:|#)/i.test(r) || i.removeAttribute("href");
@@ -2033,15 +2035,15 @@ function N(p, t) {
2033
2035
  if (s === "img") {
2034
2036
  const r = i.getAttribute("src") || "";
2035
2037
  if (!/^(https?:|data:image\/|blob:)/i.test(r)) {
2036
- const a = t.createElement("span");
2037
- a.textContent = "[local image — paste it separately]", a.setAttribute("style", "color:#a33;font-style:italic;font-size:12px"), i.replaceWith(a);
2038
+ const c = t.createElement("span");
2039
+ c.textContent = "[local image — paste it separately]", c.setAttribute("style", "color:#a33;font-style:italic;font-size:12px"), i.replaceWith(c);
2038
2040
  return;
2039
2041
  }
2040
2042
  }
2041
2043
  const o = D(i), n = [];
2042
- for (const [r, a] of Object.entries(o))
2043
- mt.has(r) && (/expression|javascript|url\s*\(\s*['"]?\s*file:/i.test(a) || r === "font-weight" && /^(400|normal)$/i.test(a) || r === "font-style" && /^normal$/i.test(a) || r === "text-decoration" && /^none$/i.test(a) || n.push(r + ":" + a));
2044
- if (n.length ? i.setAttribute("style", n.join(";")) : i.removeAttribute("style"), i.removeAttribute("class"), N(i, t), s === "span" && !i.attributes.length) {
2044
+ for (const [r, c] of Object.entries(o))
2045
+ mt.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
+ if (n.length ? i.setAttribute("style", n.join(";")) : i.removeAttribute("style"), i.removeAttribute("class"), Z(i, t), s === "span" && !i.attributes.length) {
2045
2047
  for (; i.firstChild; ) i.parentNode.insertBefore(i.firstChild, i);
2046
2048
  i.remove();
2047
2049
  }
@@ -2057,8 +2059,8 @@ function yt(p) {
2057
2059
  const o = /([^{}]+)\{([^}]*)\}/g;
2058
2060
  for (; l = o.exec(s); ) {
2059
2061
  const n = l[2].split(";").map((r) => {
2060
- const a = r.indexOf(":");
2061
- return a < 1 ? null : [r.slice(0, a).trim().toLowerCase(), r.slice(a + 1).trim()];
2062
+ const c = r.indexOf(":");
2063
+ return c < 1 ? null : [r.slice(0, c).trim().toLowerCase(), r.slice(c + 1).trim()];
2062
2064
  }).filter((r) => !!r && !!r[1]);
2063
2065
  n.length && l[1].split(",").map((r) => r.trim()).filter((r) => r && !r.startsWith("@")).forEach((r) => t.push({ sel: r, decls: n }));
2064
2066
  }
@@ -2077,29 +2079,29 @@ function xt(p, t) {
2077
2079
  }
2078
2080
  l.forEach((o) => {
2079
2081
  let n = e.get(o);
2080
- n || (n = {}, e.set(o, n)), s.forEach(([r, a]) => {
2081
- n[r] = a;
2082
+ n || (n = {}, e.set(o, n)), s.forEach(([r, c]) => {
2083
+ n[r] = c;
2082
2084
  });
2083
2085
  });
2084
2086
  }), e.forEach((i, s) => {
2085
2087
  const l = D(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")));
2086
2088
  if (!r.length) return;
2087
- const a = r.map(([d, m]) => d + ":" + m).join(";"), h = s.getAttribute("style");
2088
- s.setAttribute("style", h ? a + ";" + h : a);
2089
+ const c = r.map(([d, m]) => d + ":" + m).join(";"), h = s.getAttribute("style");
2090
+ s.setAttribute("style", h ? c + ";" + h : c);
2089
2091
  });
2090
2092
  }
2091
- function Y(p) {
2093
+ function tt(p) {
2092
2094
  return p.replace(/[ﭐ-﷿ﹰ-ﻼ]+/g, (t) => t.normalize("NFKC"));
2093
2095
  }
2094
2096
  function Ct(p) {
2095
2097
  const t = p.createTreeWalker(p.body, NodeFilter.SHOW_TEXT, null);
2096
2098
  let e;
2097
2099
  for (; e = t.nextNode(); )
2098
- /[ﭐ-﷿ﹰ-ﻼ]/.test(e.nodeValue || "") && (e.nodeValue = Y(e.nodeValue || ""));
2100
+ /[ﭐ-﷿ﹰ-ﻼ]/.test(e.nodeValue || "") && (e.nodeValue = tt(e.nodeValue || ""));
2099
2101
  }
2100
2102
  function wt(p, t = "ltr") {
2101
2103
  const e = yt(p), i = new DOMParser().parseFromString(ut(p), "text/html");
2102
- xt(i, e), /class="?Mso|mso-|urn:schemas-microsoft-com/i.test(i.body.innerHTML) && ft(i), vt(i), bt(i), N(i.body, i), Ct(i);
2104
+ xt(i, e), /class="?Mso|mso-|urn:schemas-microsoft-com/i.test(i.body.innerHTML) && ft(i), vt(i), bt(i), Z(i.body, i), Ct(i);
2103
2105
  const s = (l) => {
2104
2106
  var o;
2105
2107
  return l && l.tagName === "P" && !((o = l.textContent) != null && o.trim()) && !l.querySelector("img,table");
@@ -2109,7 +2111,7 @@ function wt(p, t = "ltr") {
2109
2111
  return i.body.innerHTML.trim();
2110
2112
  }
2111
2113
  function Tt(p) {
2112
- const t = Y(p).replace(/\r/g, ""), e = (i) => i.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
2114
+ const t = tt(p).replace(/\r/g, ""), e = (i) => i.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
2113
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);
2114
2116
  }
2115
2117
  function Mt(p) {
@@ -2125,12 +2127,12 @@ function Mt(p) {
2125
2127
  let l = t.getUint32(i + 16, !0);
2126
2128
  const o = new TextDecoder();
2127
2129
  for (let n = 0; n < s && t.getUint32(l, !0) === 33639248; n++) {
2128
- const r = t.getUint16(l + 10, !0), a = t.getUint32(l + 20, !0), h = t.getUint16(l + 28, !0), d = t.getUint16(l + 30, !0), m = t.getUint16(l + 32, !0), g = t.getUint32(l + 42, !0), u = o.decode(new Uint8Array(p, l + 46, h));
2129
- e.set(u, { name: u, method: r, compSize: a, localOffset: g }), l += 46 + h + d + m;
2130
+ const r = t.getUint16(l + 10, !0), c = t.getUint32(l + 20, !0), h = t.getUint16(l + 28, !0), d = t.getUint16(l + 30, !0), m = t.getUint16(l + 32, !0), g = t.getUint32(l + 42, !0), u = o.decode(new Uint8Array(p, l + 46, h));
2131
+ e.set(u, { name: u, method: r, compSize: c, localOffset: g }), l += 46 + h + d + m;
2130
2132
  }
2131
2133
  return e;
2132
2134
  }
2133
- async function U(p, t) {
2135
+ async function Q(p, t) {
2134
2136
  const e = new DataView(p, t.localOffset);
2135
2137
  if (e.getUint32(0, !0) !== 67324752) throw new Error("Bad local header");
2136
2138
  const i = e.getUint16(26, !0), s = e.getUint16(28, !0), l = t.localOffset + 30 + i + s, o = new Uint8Array(p.slice(l, l + t.compSize));
@@ -2139,7 +2141,7 @@ async function U(p, t) {
2139
2141
  const n = new Blob([o]).stream().pipeThrough(new DecompressionStream("deflate-raw"));
2140
2142
  return new Uint8Array(await new Response(n).arrayBuffer());
2141
2143
  }
2142
- const j = (p) => p.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;"), P = (p, t) => Array.from(p.children).filter((e) => e.localName === t), S = (p, ...t) => {
2144
+ const G = (p) => p.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;"), P = (p, t) => Array.from(p.children).filter((e) => e.localName === t), S = (p, ...t) => {
2143
2145
  let e = p;
2144
2146
  for (const i of t) {
2145
2147
  if (!e) return null;
@@ -2151,12 +2153,12 @@ const j = (p) => p.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&
2151
2153
  for (const e of Array.from(p.attributes))
2152
2154
  if (e.localName === t) return e.value;
2153
2155
  return "";
2154
- }, Z = (p, t) => {
2156
+ }, B = (p, t) => {
2155
2157
  const e = p ? S(p, t) : null;
2156
2158
  if (!e) return !1;
2157
2159
  const i = T(e);
2158
2160
  return i !== "false" && i !== "0";
2159
- }, X = {
2161
+ }, Y = {
2160
2162
  yellow: "#FFFF00",
2161
2163
  green: "#00FF00",
2162
2164
  cyan: "#00FFFF",
@@ -2226,8 +2228,8 @@ class Lt {
2226
2228
  l ? s = "h" + l[1] : /^Title$/i.test(i) && (s = "h1");
2227
2229
  const o = [], n = T(S(t, "pPr", "jc"));
2228
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 && S(e, "bidi") && o.push("direction:rtl");
2229
- const r = this.runsOf(t), a = o.length ? ` style="${o.join(";")}"` : "";
2230
- return `<${s}${a}>${r || "<br>"}</${s}>`;
2231
+ const r = this.runsOf(t), c = o.length ? ` style="${o.join(";")}"` : "";
2232
+ return `<${s}${c}>${r || "<br>"}</${s}>`;
2231
2233
  }
2232
2234
  runsOf(t) {
2233
2235
  let e = "";
@@ -2238,7 +2240,7 @@ class Lt {
2238
2240
  const l = T(i, "anchor");
2239
2241
  !s && l && (s = "#" + l);
2240
2242
  const o = this.runsOf(i);
2241
- e += s ? `<a href="${j(s)}">${o}</a>` : o;
2243
+ e += s ? `<a href="${G(s)}">${o}</a>` : o;
2242
2244
  } else (i.localName === "smartTag" || i.localName === "ins") && (e += this.runsOf(i));
2243
2245
  return e;
2244
2246
  }
@@ -2246,16 +2248,16 @@ class Lt {
2246
2248
  const e = S(t, "rPr");
2247
2249
  let i = "";
2248
2250
  for (const d of Array.from(t.children))
2249
- d.localName === "t" ? i += j(d.textContent || "") : d.localName === "br" || d.localName === "cr" ? i += "<br>" : d.localName === "tab" ? i += "&emsp;" : (d.localName === "drawing" || d.localName === "pict" || d.localName === "object") && (i += this.convertImage(d));
2251
+ d.localName === "t" ? i += G(d.textContent || "") : d.localName === "br" || d.localName === "cr" ? i += "<br>" : d.localName === "tab" ? i += "&emsp;" : (d.localName === "drawing" || d.localName === "pict" || d.localName === "object") && (i += this.convertImage(d));
2250
2252
  if (!i) return "";
2251
2253
  const s = [], l = T(e ? S(e, "color") : null);
2252
2254
  l && l !== "auto" && s.push("color:#" + l);
2253
2255
  const o = T(e ? S(e, "highlight") : null);
2254
- o && X[o] && s.push("background-color:" + X[o]);
2256
+ o && Y[o] && s.push("background-color:" + Y[o]);
2255
2257
  const n = parseFloat(T(e ? S(e, "sz") : null));
2256
2258
  n && s.push("font-size:" + Math.round(n / 2 * (4 / 3)) + "px");
2257
- const r = e ? S(e, "rFonts") : null, a = T(r, "ascii") || T(r, "cs");
2258
- a && s.push(`font-family:'${a}'`), s.length && (i = `<span style="${s.join(";")}">${i}</span>`), Z(e, "b") && (i = `<strong>${i}</strong>`), Z(e, "i") && (i = `<em>${i}</em>`), Z(e, "u") && T(S(e, "u")) !== "none" && (i = `<u>${i}</u>`), Z(e, "strike") && (i = `<s>${i}</s>`);
2259
+ const r = e ? S(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(S(e, "u")) !== "none" && (i = `<u>${i}</u>`), B(e, "strike") && (i = `<s>${i}</s>`);
2259
2261
  const h = T(e ? S(e, "vertAlign") : null);
2260
2262
  return h === "superscript" ? i = `<sup>${i}</sup>` : h === "subscript" && (i = `<sub>${i}</sub>`), i;
2261
2263
  }
@@ -2290,10 +2292,10 @@ class Lt {
2290
2292
  return e + "</tbody></table>";
2291
2293
  }
2292
2294
  }
2293
- async function Ht(p) {
2295
+ async function kt(p) {
2294
2296
  const t = p instanceof ArrayBuffer ? p : await p.arrayBuffer(), e = Mt(t), i = new TextDecoder(), s = async (u) => {
2295
2297
  const v = e.get(u);
2296
- return v ? new DOMParser().parseFromString(i.decode(await U(t, v)), "application/xml") : null;
2298
+ return v ? new DOMParser().parseFromString(i.decode(await Q(t, v)), "application/xml") : null;
2297
2299
  }, l = await s("word/document.xml"), o = l == null ? void 0 : l.getElementsByTagName("*");
2298
2300
  let n = null;
2299
2301
  if (o) {
@@ -2304,21 +2306,21 @@ async function Ht(p) {
2304
2306
  }
2305
2307
  }
2306
2308
  if (!n) throw new Error("word/document.xml missing or invalid");
2307
- const r = /* @__PURE__ */ new Map(), a = /* @__PURE__ */ new Map(), h = await s("word/_rels/document.xml.rels");
2309
+ const r = /* @__PURE__ */ new Map(), c = /* @__PURE__ */ new Map(), h = await s("word/_rels/document.xml.rels");
2308
2310
  if (h)
2309
2311
  for (const u of Array.from(h.getElementsByTagName("*"))) {
2310
2312
  if (u.localName !== "Relationship") continue;
2311
2313
  const v = u.getAttribute("Id") || "", b = u.getAttribute("Target") || "", x = u.getAttribute("Type") || "";
2312
- /hyperlink/i.test(x) ? r.set(v, b) : /image/i.test(x) && a.set(v, b);
2314
+ /hyperlink/i.test(x) ? r.set(v, b) : /image/i.test(x) && c.set(v, b);
2313
2315
  }
2314
2316
  const d = /* @__PURE__ */ new Map();
2315
- for (const [u, v] of a) {
2317
+ for (const [u, v] of c) {
2316
2318
  const b = v.startsWith("/") ? v.slice(1) : "word/" + v.replace(/^\.\//, ""), x = e.get(b);
2317
2319
  if (!x) continue;
2318
2320
  const C = (b.split(".").pop() || "").toLowerCase(), M = St[C];
2319
2321
  if (M)
2320
2322
  try {
2321
- d.set(u, `data:${M};base64,${Et(await U(t, x))}`);
2323
+ d.set(u, `data:${M};base64,${Et(await Q(t, x))}`);
2322
2324
  } catch {
2323
2325
  }
2324
2326
  }
@@ -2338,28 +2340,28 @@ async function Ht(p) {
2338
2340
  }
2339
2341
  return new Lt(r, d, m).convertBody(n);
2340
2342
  }
2341
- const kt = ["nw", "ne", "sw", "se"], F = ["img-left", "img-right", "img-top", "img-center"], O = {
2343
+ const Ht = ["nw", "ne", "sw", "se"], O = ["img-left", "img-right", "img-top", "img-center"], F = {
2342
2344
  "img-left": "tplimgleft",
2343
2345
  "img-right": "tplimgright",
2344
2346
  "img-top": "tplimgtop",
2345
2347
  "img-center": "tplimgcenter"
2346
- }, At = {
2347
- "img-left": c.tplleft,
2348
- "img-right": c.tplright,
2349
- "img-top": c.tpltop,
2350
- "img-center": c.tplcenter
2351
- }, It = ".tox,.pop,.tblctx,.imgctx,.selctx,.dlg";
2352
- let E = null, A = null, $ = 0, Q = !1;
2353
- function B() {
2354
- clearTimeout($), A = null, E && E.classList.remove("show");
2348
+ }, It = {
2349
+ "img-left": a.tplleft,
2350
+ "img-right": a.tplright,
2351
+ "img-top": a.tpltop,
2352
+ "img-center": a.tplcenter
2353
+ }, At = ".tox,.pop,.tblctx,.imgctx,.selctx,.dlg";
2354
+ let E = null, I = null, $ = 0, K = !1;
2355
+ function N() {
2356
+ clearTimeout($), I = null, E && E.classList.remove("show");
2355
2357
  }
2356
2358
  function qt(p) {
2357
2359
  const t = p.dataset.tip;
2358
2360
  if (!t) return;
2359
- A = p, clearTimeout($);
2361
+ I = p, clearTimeout($);
2360
2362
  const e = E && E.classList.contains("show") ? 60 : 350;
2361
2363
  $ = window.setTimeout(() => {
2362
- if (A !== p || !document.contains(p)) return;
2364
+ if (I !== p || !document.contains(p)) return;
2363
2365
  E || (E = document.createElement("div"), E.className = "etip", document.body.appendChild(E)), E.textContent = t, E.classList.add("show");
2364
2366
  const i = p.getBoundingClientRect(), s = E.offsetWidth, l = E.offsetHeight;
2365
2367
  let o = i.left + i.width / 2 - s / 2;
@@ -2368,22 +2370,22 @@ function qt(p) {
2368
2370
  n + l > innerHeight - 6 && (n = i.top - l - 7), E.style.left = o + "px", E.style.top = n + "px";
2369
2371
  }, e);
2370
2372
  }
2371
- function Zt() {
2372
- Q || (Q = !0, document.addEventListener("mouseover", (p) => {
2373
+ function Bt() {
2374
+ K || (K = !0, document.addEventListener("mouseover", (p) => {
2373
2375
  const t = p.target, e = t.closest ? t.closest("[title],[data-tip]") : null;
2374
- if (!e || !e.closest(It) || e.closest(".earea")) {
2375
- e !== A && B();
2376
+ if (!e || !e.closest(At) || e.closest(".earea")) {
2377
+ e !== I && N();
2376
2378
  return;
2377
2379
  }
2378
2380
  const i = e.getAttribute("title");
2379
- i && (e.dataset.tip = i, e.removeAttribute("title"), e.getAttribute("aria-label") || e.setAttribute("aria-label", i)), e !== A && qt(e);
2381
+ i && (e.dataset.tip = i, e.removeAttribute("title"), e.getAttribute("aria-label") || e.setAttribute("aria-label", i)), e !== I && qt(e);
2380
2382
  }), document.addEventListener("mouseout", (p) => {
2381
- A && !A.contains(p.relatedTarget) && B();
2382
- }), document.addEventListener("mousedown", B, !0), addEventListener("scroll", B, !0));
2383
+ I && !I.contains(p.relatedTarget) && N();
2384
+ }), document.addEventListener("mousedown", N, !0), addEventListener("scroll", N, !0));
2383
2385
  }
2384
- const I = class I {
2386
+ const A = class A {
2385
2387
  constructor(t) {
2386
- 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 = {
2388
+ this.lang = "en", this.contentClass = "fable-content-" + A.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 = {
2387
2389
  target: t.target,
2388
2390
  language: t.language || "en",
2389
2391
  height: t.height ?? 302,
@@ -2397,7 +2399,7 @@ const I = class I {
2397
2399
  statusbar: t.statusbar ?? !0,
2398
2400
  readonly: t.readonly ?? !1,
2399
2401
  draftKey: t.draftKey ?? (typeof location < "u" ? location.pathname : "default"),
2400
- fontFamilyFormats: t.fontFamilyFormats ?? et,
2402
+ fontFamilyFormats: t.fontFamilyFormats ?? lt,
2401
2403
  imageFileTypes: t.imageFileTypes ?? ["image/jpeg", "image/jpg", "image/png", "image/gif", "image/bmp", "image/webp"],
2402
2404
  videoFileTypes: t.videoFileTypes ?? ["video/mp4", "video/webm", "video/ogg"]
2403
2405
  }, 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);
@@ -2423,7 +2425,7 @@ const I = class I {
2423
2425
  </span>
2424
2426
  `, this.sbHelp = this.statusbar.querySelector(".mid"), this.sbWords = this.statusbar.querySelector(".words");
2425
2427
  const e = this.statusbar.querySelector(".grip");
2426
- 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), Zt(), 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);
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), Bt(), 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);
2427
2429
  }
2428
2430
  /** Theme options land as CSS variables on the document root rather than the editor
2429
2431
  * shell, because dialogs, popups and floating context toolbars are appended to
@@ -2464,20 +2466,20 @@ const I = class I {
2464
2466
  }), this.on(this.ed, "input", () => {
2465
2467
  this.refreshState(), this.onChange(), this.positionTableHandles(), this.positionImageHandles(), this.positionImgPhCtx(), this.positionTplCtx(), this.positionVphCtx(), this.positionVidCtx(), this.positionCodeCtx();
2466
2468
  }), this.on(this.ed, "keydown", (t) => {
2467
- t.altKey && t.key === "0" && (t.preventDefault(), this.helpDlg()), (t.key === "Delete" || t.key === "Backspace") && this.phActive && (t.preventDefault(), this.removeImgPlaceholder()), (t.key === "Delete" || t.key === "Backspace") && this.vphActive && (t.preventDefault(), this.removeVphPlaceholder()), t.key === "`" && !t.ctrlKey && !t.metaKey && !t.altKey && this.tryCodeTyping(t);
2469
+ t.altKey && t.key === "0" && (t.preventDefault(), this.helpDlg()), (t.key === "Delete" || t.key === "Backspace") && this.phActive && (t.preventDefault(), this.removeImgPlaceholder()), (t.key === "Delete" || t.key === "Backspace") && this.vphActive && (t.preventDefault(), this.removeVphPlaceholder()), t.key === "`" && !t.ctrlKey && !t.metaKey && !t.altKey && this.tryCodeTyping(t), t.key === "Enter" && !t.shiftKey && !t.ctrlKey && !t.metaKey && !t.altKey && this.tryExitBlockquote(t);
2468
2470
  }), this.on(this.ed, "paste", (t) => this.handlePaste(t)), this.on(this.ed, "drop", (t) => {
2469
2471
  var l, o, n, r;
2470
2472
  t.preventDefault();
2471
2473
  const e = t.target, i = (l = e.closest) == null ? void 0 : l.call(e, ".img-ph:not(.vid-ph)");
2472
2474
  if (i && this.ed.contains(i) && !this.options.readonly) {
2473
- const a = Array.from(((o = t.dataTransfer) == null ? void 0 : o.files) || []).find((h) => h.type.startsWith("image/"));
2474
- a && this.readImageFileInto(a, i);
2475
+ const c = Array.from(((o = t.dataTransfer) == null ? void 0 : o.files) || []).find((h) => h.type.startsWith("image/"));
2476
+ c && this.readImageFileInto(c, i);
2475
2477
  return;
2476
2478
  }
2477
2479
  const s = (n = e.closest) == null ? void 0 : n.call(e, ".vid-ph");
2478
2480
  if (s && this.ed.contains(s) && !this.options.readonly) {
2479
- const a = Array.from(((r = t.dataTransfer) == null ? void 0 : r.files) || []).find((h) => h.type.startsWith("video/"));
2480
- a && this.readVideoFileInto(a, s);
2481
+ const c = Array.from(((r = t.dataTransfer) == null ? void 0 : r.files) || []).find((h) => h.type.startsWith("video/"));
2482
+ c && this.readVideoFileInto(c, s);
2481
2483
  }
2482
2484
  }), this.on(this.ed, "dragover", (t) => t.preventDefault()), this.on(this.ed, "mousedown", (t) => {
2483
2485
  var h, d, m, g, u, v, b;
@@ -2493,8 +2495,8 @@ const I = class I {
2493
2495
  n && this.ed.contains(n) && !this.options.readonly ? (t.preventDefault(), this.selectCodeEl(n)) : this.clearCodeSel();
2494
2496
  const r = (v = e.closest) == null ? void 0 : v.call(e, "img");
2495
2497
  r && this.ed.contains(r) && !this.options.readonly ? (t.preventDefault(), this.selectImage(r)) : this.clearImageHandles();
2496
- const a = (b = e.closest) == null ? void 0 : b.call(e, "video, .video-embed");
2497
- a && this.ed.contains(a) && !this.options.readonly ? (t.preventDefault(), this.selectVideo(a)) : this.clearVidHandles();
2498
+ const c = (b = e.closest) == null ? void 0 : b.call(e, "video, .video-embed");
2499
+ c && this.ed.contains(c) && !this.options.readonly ? (t.preventDefault(), this.selectVideo(c)) : this.clearVidHandles();
2498
2500
  }), this.on(this.ed, "mouseover", (t) => {
2499
2501
  var i, s;
2500
2502
  if (this.options.readonly) return;
@@ -2588,7 +2590,7 @@ const I = class I {
2588
2590
  this.ed.focus();
2589
2591
  }
2590
2592
  async importWordFile(t) {
2591
- const e = await Ht(t);
2593
+ const e = await kt(t);
2592
2594
  this.recordRevision(), this.setContent(e), this.recordRevision();
2593
2595
  }
2594
2596
  restoreDraft() {
@@ -2636,6 +2638,20 @@ const I = class I {
2636
2638
  }
2637
2639
  return null;
2638
2640
  }
2641
+ /** Enter on an empty last line inside a blockquote exits it into a plain paragraph, mirroring how lists exit on an empty item. */
2642
+ tryExitBlockquote(t) {
2643
+ const e = window.getSelection();
2644
+ if (!e || !e.isCollapsed || !e.anchorNode || !this.ed.contains(e.anchorNode)) return;
2645
+ const i = this.closestBlock(e.anchorNode);
2646
+ if (!i || i.tagName === "BLOCKQUOTE" || (i.textContent || "").trim() !== "") return;
2647
+ const s = i.closest("blockquote");
2648
+ if (!s || !this.ed.contains(s) || i !== s.lastElementChild) return;
2649
+ t.preventDefault();
2650
+ const l = document.createElement("p");
2651
+ l.appendChild(document.createElement("br")), s.after(l), i.remove(), s.firstElementChild || s.remove();
2652
+ const o = document.createRange();
2653
+ o.setStart(l, 0), o.collapse(!0), e.removeAllRanges(), e.addRange(o), this.saveSel(), this.onChange();
2654
+ }
2639
2655
  selectedBlocks() {
2640
2656
  const t = window.getSelection();
2641
2657
  if (!t || !t.rangeCount || !this.ed.contains(t.anchorNode)) return [];
@@ -2692,7 +2708,7 @@ const I = class I {
2692
2708
  hour: "2-digit",
2693
2709
  minute: "2-digit",
2694
2710
  second: "2-digit"
2695
- }), r = {}, a = (h) => {
2711
+ }), r = {}, c = (h) => {
2696
2712
  o = h, this.revisions.forEach((d, m) => {
2697
2713
  var g;
2698
2714
  return (g = r[m]) == null ? void 0 : g.classList.toggle("on", m === h);
@@ -2702,12 +2718,12 @@ const I = class I {
2702
2718
  const d = this.revisions[h], m = document.createElement("button");
2703
2719
  m.type = "button";
2704
2720
  const g = (new DOMParser().parseFromString(d.html, "text/html").body.textContent || "").trim(), u = g ? g.split(/\s+/).length : 0, v = h === this.revisions.length - 1;
2705
- m.innerHTML = `<span>${v ? this.t("currentver") : n.format(new Date(d.time))}</span><span class="wc">${u} ${this.t("words")}</span>`, m.addEventListener("click", () => a(h)), r[h] = m, i.appendChild(m);
2721
+ m.innerHTML = `<span>${v ? this.t("currentver") : n.format(new Date(d.time))}</span><span class="wc">${u} ${this.t("words")}</span>`, m.addEventListener("click", () => c(h)), r[h] = m, i.appendChild(m);
2706
2722
  }
2707
2723
  i.append(l), l.addEventListener("click", () => {
2708
2724
  const h = this.revisions[o];
2709
2725
  h && (this.recordRevision(), this.setContent(h.html), this.recordRevision(), this.closeDlg());
2710
- }), e.append(i, s), t.appendChild(e), a(o);
2726
+ }), e.append(i, s), t.appendChild(e), c(o);
2711
2727
  });
2712
2728
  }
2713
2729
  /* ---------------------------------------------------------- popups / menus */
@@ -2753,7 +2769,7 @@ const I = class I {
2753
2769
  return;
2754
2770
  }
2755
2771
  const s = !!(i.sub || i.subBuild), l = document.createElement("button");
2756
- l.className = "mi" + (i.on ? " on" : ""), l.innerHTML = `<span class="ic">${i.icon || ""}</span><span class="prev" ${i.previewStyle ? `style="${i.previewStyle}"` : ""}>${i.label}</span>${i.shortcut ? `<span class="sc">${i.shortcut}</span>` : ""}${s ? `<span class="subarrow">${c.chev}</span>` : ""}`, l.addEventListener("click", () => {
2772
+ l.className = "mi" + (i.on ? " on" : ""), l.innerHTML = `<span class="ic">${i.icon || ""}</span><span class="prev" ${i.previewStyle ? `style="${i.previewStyle}"` : ""}>${i.label}</span>${i.shortcut ? `<span class="sc">${i.shortcut}</span>` : ""}${s ? `<span class="subarrow">${a.chev}</span>` : ""}`, l.addEventListener("click", () => {
2757
2773
  i.action && (this.closePop(), i.action());
2758
2774
  }), l.addEventListener("mouseenter", () => {
2759
2775
  var o;
@@ -2771,13 +2787,13 @@ const I = class I {
2771
2787
  }
2772
2788
  /** Font-size increase / decrease step button. */
2773
2789
  stepBtn(t) {
2774
- const e = t > 0 ? "+" : "−", i = t > 0 ? c.fontsizeup : c.fontsizedown, s = this.tbtn(i, this.t("fontsize") + " " + e, () => this.stepFontSize(t));
2790
+ const e = t > 0 ? "+" : "−", i = t > 0 ? a.fontsizeup : a.fontsizedown, s = this.tbtn(i, this.t("fontsize") + " " + e, () => this.stepFontSize(t));
2775
2791
  return s.addEventListener("mousedown", () => this.saveSel()), s;
2776
2792
  }
2777
2793
  /** Toolbar icon button that opens a popup menu anchored to itself. */
2778
2794
  menuTbtn(t, e, i, s) {
2779
2795
  const l = this.tbtn(t, e, () => i(l), s);
2780
- return l.classList.add("hasmenu"), l.insertAdjacentHTML("beforeend", c.chev), l.addEventListener("mousedown", () => this.saveSel()), l;
2796
+ return l.classList.add("hasmenu"), l.insertAdjacentHTML("beforeend", a.chev), l.addEventListener("mousedown", () => this.saveSel()), l;
2781
2797
  }
2782
2798
  /** Quick text-color chips plus a "more" chip that opens the full palette. */
2783
2799
  colorChips() {
@@ -2790,7 +2806,7 @@ const I = class I {
2790
2806
  const l = t(this.t("forecolor"));
2791
2807
  return l.style.background = s, l.addEventListener("click", () => this.applyColor("fore", s)), l;
2792
2808
  }), i = t(this.t("forecolor"));
2793
- return i.classList.add("more"), i.dataset.cb = "fore", i.innerHTML = c.chev, i.addEventListener("click", () => this.colorMenu(i, "fore")), [...e, i];
2809
+ return i.classList.add("more"), i.dataset.cb = "fore", i.innerHTML = a.chev, i.addEventListener("click", () => this.colorMenu(i, "fore")), [...e, i];
2794
2810
  }
2795
2811
  group(...t) {
2796
2812
  const e = document.createElement("div");
@@ -2800,7 +2816,7 @@ const I = class I {
2800
2816
  }
2801
2817
  tsel(t, e, i, s) {
2802
2818
  const l = document.createElement("button");
2803
- return l.className = "tsel " + t, l.type = "button", l.dataset.id = e, l.innerHTML = `<span class="lbl empty">${i || ""}</span>${c.chev}`, l.addEventListener("mousedown", (o) => {
2819
+ return l.className = "tsel " + t, l.type = "button", l.dataset.id = e, l.innerHTML = `<span class="lbl empty">${i || ""}</span>${a.chev}`, l.addEventListener("mousedown", (o) => {
2804
2820
  o.preventDefault(), this.saveSel();
2805
2821
  }), l.addEventListener("click", () => s(l)), l;
2806
2822
  }
@@ -2813,21 +2829,21 @@ const I = class I {
2813
2829
  s || (this.exec(t === "ol" ? "insertOrderedList" : "insertUnorderedList"), s = (o = this.closestBlock(i.anchorNode)) == null ? void 0 : o.closest(t)), s && (s.style.listStyleType = e), this.saveSel(), this.onChange();
2814
2830
  }
2815
2831
  listMenu(t, e) {
2816
- var a;
2832
+ var c;
2817
2833
  const i = e === "ol" ? "insertOrderedList" : "insertUnorderedList", s = e === "ol" ? [
2818
- ["lower-alpha", c.ol_alpha],
2819
- ["lower-roman", c.ol_roman],
2820
- ["upper-alpha", c.ol_alphau],
2821
- ["upper-roman", c.ol_romanu]
2834
+ ["lower-alpha", a.ol_alpha],
2835
+ ["lower-roman", a.ol_roman],
2836
+ ["upper-alpha", a.ol_alphau],
2837
+ ["upper-roman", a.ol_romanu]
2822
2838
  ] : [
2823
- ["circle", c.ul_circle],
2824
- ["square", c.ul_square]
2825
- ], l = this.tArr(e === "ol" ? "liststyles_ol" : "liststyles_ul").slice(1), o = window.getSelection(), n = o ? (a = this.closestBlock(o.anchorNode)) == null ? void 0 : a.closest(e) : null, r = n ? n.style.listStyleType : "";
2839
+ ["circle", a.ul_circle],
2840
+ ["square", a.ul_square]
2841
+ ], l = this.tArr(e === "ol" ? "liststyles_ol" : "liststyles_ul").slice(1), o = window.getSelection(), n = o ? (c = this.closestBlock(o.anchorNode)) == null ? void 0 : c.closest(e) : null, r = n ? n.style.listStyleType : "";
2826
2842
  this.popup(t, (h) => {
2827
2843
  this.menuItems(h, [
2828
2844
  {
2829
2845
  label: this.t(e === "ol" ? "numlist" : "bullist"),
2830
- icon: e === "ol" ? c.numlist : c.bullist,
2846
+ icon: e === "ol" ? a.numlist : a.bullist,
2831
2847
  on: document.queryCommandState(i),
2832
2848
  action: () => this.exec(i)
2833
2849
  }
@@ -2855,17 +2871,17 @@ const I = class I {
2855
2871
  const l = document.createElement("div");
2856
2872
  l.className = "cfoot";
2857
2873
  const o = /^#[0-9a-f]{6}$/i.test(e) ? e : "#000000", n = document.createElement("div");
2858
- n.className = "cswatch cur", n.title = this.t("currentcolor"), n.style.background = o, n.innerHTML = c.check;
2874
+ n.className = "cswatch cur", n.title = this.t("currentcolor"), n.style.background = o, n.innerHTML = a.check;
2859
2875
  const r = document.createElement("button");
2860
2876
  r.type = "button", r.className = "cswatch nocolor", r.title = this.t("removecolor"), r.addEventListener("click", () => {
2861
2877
  this.closePop(), i(null);
2862
2878
  });
2863
- const a = document.createElement("label");
2864
- a.className = "cswatch cwheel", a.title = this.t("customcolor"), a.innerHTML = c.palette;
2879
+ const c = document.createElement("label");
2880
+ c.className = "cswatch cwheel", c.title = this.t("customcolor"), c.innerHTML = a.palette;
2865
2881
  const h = document.createElement("input");
2866
2882
  h.type = "color", h.value = o, h.addEventListener("change", () => {
2867
2883
  this.closePop(), i(h.value);
2868
- }), a.appendChild(h), l.append(n, r, a), t.appendChild(l);
2884
+ }), c.appendChild(h), l.append(n, r, c), t.appendChild(l);
2869
2885
  }
2870
2886
  colorMenu(t, e) {
2871
2887
  this.popup(
@@ -2883,30 +2899,26 @@ const I = class I {
2883
2899
  syncColorSwatches(t) {
2884
2900
  t.querySelectorAll("[data-cb=fore]").forEach((e) => e.style.background = this.foreColor), t.querySelectorAll("[data-cb=back]").forEach((e) => e.style.background = this.backColor);
2885
2901
  }
2902
+ fontItems() {
2903
+ return this.options.fontFamilyFormats.map(([t, e]) => ({
2904
+ label: t,
2905
+ previewStyle: `font-family:${e}`,
2906
+ on: this.currentFont() === t,
2907
+ action: () => this.exec("fontName", e)
2908
+ }));
2909
+ }
2886
2910
  fontMenu(t) {
2887
- this.popup(t, (e) => {
2888
- this.menuItems(
2889
- e,
2890
- this.options.fontFamilyFormats.map(([i, s]) => ({
2891
- label: i,
2892
- previewStyle: `font-family:${s}`,
2893
- on: this.currentFont() === i,
2894
- action: () => this.exec("fontName", s)
2895
- }))
2896
- );
2897
- });
2911
+ this.popup(t, (e) => this.menuItems(e, this.fontItems()));
2912
+ }
2913
+ sizeItems() {
2914
+ return ot.map((t) => ({
2915
+ label: t,
2916
+ on: this.currentSize() === t,
2917
+ action: () => this.applyFontSize(t)
2918
+ }));
2898
2919
  }
2899
2920
  sizeMenu(t) {
2900
- this.popup(t, (e) => {
2901
- this.menuItems(
2902
- e,
2903
- it.map((i) => ({
2904
- label: i,
2905
- on: this.currentSize() === i,
2906
- action: () => this.applyFontSize(i)
2907
- }))
2908
- );
2909
- });
2921
+ this.popup(t, (e) => this.menuItems(e, this.sizeItems()));
2910
2922
  }
2911
2923
  /** Font sizing needs a non-collapsed range. With a bare caret, grow the
2912
2924
  selection to the word under it; in an empty spot, select a zero-width
@@ -2926,8 +2938,8 @@ const I = class I {
2926
2938
  for (; n > 0 && /\S/.test(o[n - 1]); ) n--;
2927
2939
  for (; r < o.length && /\S/.test(o[r]); ) r++;
2928
2940
  if (r > n) {
2929
- const a = document.createRange();
2930
- a.setStart(i, n), a.setEnd(i, r), t.removeAllRanges(), t.addRange(a), this.savedRange = a.cloneRange();
2941
+ const c = document.createRange();
2942
+ c.setStart(i, n), c.setEnd(i, r), t.removeAllRanges(), t.addRange(c), this.savedRange = c.cloneRange();
2931
2943
  return;
2932
2944
  }
2933
2945
  }
@@ -2952,7 +2964,7 @@ const I = class I {
2952
2964
  this.saveSel(), this.refreshState(), this.onChange();
2953
2965
  }
2954
2966
  stepFontSize(t) {
2955
- const e = parseInt(this.currentSize(), 10) || 14, i = Math.min(lt, Math.max(st, e + t));
2967
+ const e = parseInt(this.currentSize(), 10) || 14, i = Math.min(rt, Math.max(nt, e + t));
2956
2968
  i !== e && this.applyFontSize(i + "px");
2957
2969
  }
2958
2970
  /* ------------------------------------------------ case / spacing / link */
@@ -2964,21 +2976,22 @@ const I = class I {
2964
2976
  let o;
2965
2977
  for (; o = s.nextNode(); ) i.intersectsNode(o) && l.push(o);
2966
2978
  l.forEach((n) => {
2967
- const r = n === i.startContainer ? i.startOffset : 0, a = n === i.endContainer ? i.endOffset : n.data.length;
2968
- if (a <= r) return;
2969
- const h = n.data.slice(r, a);
2979
+ const r = n === i.startContainer ? i.startOffset : 0, c = n === i.endContainer ? i.endOffset : n.data.length;
2980
+ if (c <= r) return;
2981
+ const h = n.data.slice(r, c);
2970
2982
  let d = h;
2971
- t === "lower" ? d = h.toLowerCase() : t === "upper" ? d = h.toUpperCase() : d = h.replace(/(^|\s)(\S)/g, (m, g, u) => g + u.toUpperCase()), n.replaceData(r, a - r, d);
2983
+ t === "lower" ? d = h.toLowerCase() : t === "upper" ? d = h.toUpperCase() : d = h.replace(/(^|\s)(\S)/g, (m, g, u) => g + u.toUpperCase()), n.replaceData(r, c - r, d);
2972
2984
  }), this.saveSel(), this.refreshState(), this.onChange();
2973
2985
  }
2986
+ caseItems() {
2987
+ return [
2988
+ { label: this.t("lowercase"), icon: a.lowercaseic, action: () => this.transformCase("lower") },
2989
+ { label: this.t("uppercase"), icon: a.uppercaseic, action: () => this.transformCase("upper") },
2990
+ { label: this.t("capitalize"), icon: a.capitalizeic, action: () => this.transformCase("capitalize") }
2991
+ ];
2992
+ }
2974
2993
  caseMenu(t) {
2975
- this.popup(t, (e) => {
2976
- this.menuItems(e, [
2977
- { label: this.t("lowercase"), icon: c.lowercaseic, action: () => this.transformCase("lower") },
2978
- { label: this.t("uppercase"), icon: c.uppercaseic, action: () => this.transformCase("upper") },
2979
- { label: this.t("capitalize"), icon: c.capitalizeic, action: () => this.transformCase("capitalize") }
2980
- ]);
2981
- });
2994
+ this.popup(t, (e) => this.menuItems(e, this.caseItems()));
2982
2995
  }
2983
2996
  applyBlockStyle(t, e) {
2984
2997
  this.restoreSel();
@@ -2991,44 +3004,25 @@ const I = class I {
2991
3004
  const e = window.getSelection(), i = e ? this.closestBlock(e.anchorNode) : null;
2992
3005
  return i && i.style[t] || "";
2993
3006
  }
3007
+ blockStyleItems(t, e) {
3008
+ const i = this.currentBlockStyle(t);
3009
+ return [
3010
+ { label: this.t("normal"), on: !i, action: () => this.applyBlockStyle(t, "") },
3011
+ ...e.map((s) => ({
3012
+ label: s,
3013
+ on: i === s,
3014
+ action: () => this.applyBlockStyle(t, s)
3015
+ }))
3016
+ ];
3017
+ }
2994
3018
  lineHeightMenu(t) {
2995
- const e = this.currentBlockStyle("lineHeight");
2996
- this.popup(t, (i) => {
2997
- this.menuItems(i, [
2998
- { label: this.t("normal"), on: !e, action: () => this.applyBlockStyle("lineHeight", "") },
2999
- ...ot.map((s) => ({
3000
- label: s,
3001
- on: e === s,
3002
- action: () => this.applyBlockStyle("lineHeight", s)
3003
- }))
3004
- ]);
3005
- });
3019
+ this.popup(t, (e) => this.menuItems(e, this.blockStyleItems("lineHeight", _)));
3006
3020
  }
3007
3021
  wordSpacingMenu(t) {
3008
- const e = this.currentBlockStyle("wordSpacing");
3009
- this.popup(t, (i) => {
3010
- this.menuItems(i, [
3011
- { label: this.t("normal"), on: !e, action: () => this.applyBlockStyle("wordSpacing", "") },
3012
- ...nt.map((s) => ({
3013
- label: s,
3014
- on: e === s,
3015
- action: () => this.applyBlockStyle("wordSpacing", s)
3016
- }))
3017
- ]);
3018
- });
3022
+ this.popup(t, (e) => this.menuItems(e, this.blockStyleItems("wordSpacing", U)));
3019
3023
  }
3020
3024
  letterSpacingMenu(t) {
3021
- const e = this.currentBlockStyle("letterSpacing");
3022
- this.popup(t, (i) => {
3023
- this.menuItems(i, [
3024
- { label: this.t("normal"), on: !e, action: () => this.applyBlockStyle("letterSpacing", "") },
3025
- ...rt.map((s) => ({
3026
- label: s,
3027
- on: e === s,
3028
- action: () => this.applyBlockStyle("letterSpacing", s)
3029
- }))
3030
- ]);
3031
- });
3025
+ this.popup(t, (e) => this.menuItems(e, this.blockStyleItems("letterSpacing", V)));
3032
3026
  }
3033
3027
  closestAnchor() {
3034
3028
  const t = window.getSelection();
@@ -3080,18 +3074,29 @@ const I = class I {
3080
3074
  i
3081
3075
  );
3082
3076
  }
3077
+ blockItems() {
3078
+ return j.map(([t]) => ({
3079
+ label: this.blockLabel(t),
3080
+ previewStyle: t.startsWith("h") ? `font-weight:700;font-size:${22 - 2 * +t[1]}px` : t === "pre" ? "font-family:monospace" : "",
3081
+ on: this.currentBlock() === t,
3082
+ action: () => this.exec("formatBlock", "<" + t + ">")
3083
+ }));
3084
+ }
3083
3085
  blocksMenu(t) {
3084
- this.popup(t, (e) => {
3085
- this.menuItems(
3086
- e,
3087
- V.map(([i, s]) => ({
3088
- label: this.blockLabel(i),
3089
- previewStyle: i.startsWith("h") ? `font-weight:700;font-size:${22 - 2 * +i[1]}px` : i === "pre" ? "font-family:monospace" : "",
3090
- on: this.currentBlock() === i,
3091
- action: () => this.exec("formatBlock", "<" + i + ">")
3092
- }))
3093
- );
3094
- });
3086
+ this.popup(t, (e) => this.menuItems(e, this.blockItems()));
3087
+ }
3088
+ alignItems() {
3089
+ return [
3090
+ ["justifyLeft", "alignleft", a.alignleft],
3091
+ ["justifyCenter", "aligncenter", a.aligncenter],
3092
+ ["justifyRight", "alignright", a.alignright],
3093
+ ["justifyFull", "alignjustify", a.alignjustify]
3094
+ ].map(([e, i, s]) => ({
3095
+ label: this.t(i),
3096
+ icon: s,
3097
+ on: document.queryCommandState(e),
3098
+ action: () => this.exec(e)
3099
+ }));
3095
3100
  }
3096
3101
  blockLabel(t) {
3097
3102
  return t === "p" ? this.t("para") : t === "pre" ? this.t("pre") : this.t("heading") + " " + t[1];
@@ -3110,12 +3115,12 @@ const I = class I {
3110
3115
  const o = [];
3111
3116
  for (let n = 0; n < 8; n++)
3112
3117
  for (let r = 0; r < 10; r++) {
3113
- const a = document.createElement("span");
3114
- a.dataset.r = String(n), a.dataset.c = String(r), a.addEventListener("mouseenter", () => {
3118
+ const c = document.createElement("span");
3119
+ c.dataset.r = String(n), c.dataset.c = String(r), c.addEventListener("mouseenter", () => {
3115
3120
  o.forEach((h) => h.classList.toggle("hot", +h.dataset.r <= n && +h.dataset.c <= r)), l.textContent = r + 1 + " × " + (n + 1);
3116
- }), a.addEventListener("click", () => {
3121
+ }), c.addEventListener("click", () => {
3117
3122
  this.closePop(), this.insertTable(n + 1, r + 1), e == null || e();
3118
- }), o.push(a), s.appendChild(a);
3123
+ }), o.push(c), s.appendChild(c);
3119
3124
  }
3120
3125
  i.append(s, l), t.appendChild(i);
3121
3126
  }
@@ -3146,61 +3151,61 @@ const I = class I {
3146
3151
  * behavior changes, just named lookup. Only `forecolor` yields multiple elements
3147
3152
  * (the quick color chips); everything else yields one. */
3148
3153
  buildToolbarRegistry() {
3149
- const t = this.tbtn(c.tableic, this.t("quicktable"), () => this.tableGrid(t)), e = {
3150
- undo: () => this.tbtn(c.undo, this.t("undo"), () => this.exec("undo")),
3151
- redo: () => this.tbtn(c.redo, this.t("redo"), () => this.exec("redo")),
3152
- preview: () => this.tbtn(c.prevw, this.t("preview"), () => this.previewDlg()),
3153
- print: () => this.tbtn(c.printic, this.t("print"), () => this.printDoc()),
3154
- importword: () => this.tbtn(c.wordic, this.t("importword"), () => this.pickWordDoc()),
3155
- revhistory: () => this.tbtn(c.historyic, this.t("revhistory"), () => this.revisionDlg()),
3154
+ const t = this.tbtn(a.tableic, this.t("quicktable"), () => this.tableGrid(t)), e = {
3155
+ undo: () => this.tbtn(a.undo, this.t("undo"), () => this.exec("undo")),
3156
+ redo: () => this.tbtn(a.redo, this.t("redo"), () => this.exec("redo")),
3157
+ preview: () => this.tbtn(a.prevw, this.t("preview"), () => this.previewDlg()),
3158
+ print: () => this.tbtn(a.printic, this.t("print"), () => this.printDoc()),
3159
+ importword: () => this.tbtn(a.wordic, this.t("importword"), () => this.pickWordDoc()),
3160
+ revhistory: () => this.tbtn(a.historyic, this.t("revhistory"), () => this.revisionDlg()),
3156
3161
  fontfamily: () => this.tsel("w-font", "fontsel", "", (i) => this.fontMenu(i)),
3157
3162
  fontsize: () => this.tsel("w-size", "sizesel", "", (i) => this.sizeMenu(i)),
3158
3163
  fontsizeincrease: () => this.stepBtn(1),
3159
3164
  fontsizedecrease: () => this.stepBtn(-1),
3160
- bold: () => this.tbtn(c.bold, this.t("bold"), () => this.exec("bold"), "bold"),
3161
- italic: () => this.tbtn(c.italic, this.t("italic"), () => this.exec("italic"), "italic"),
3162
- underline: () => this.tbtn(c.underline, this.t("underline"), () => this.exec("underline"), "underline"),
3163
- strikethrough: () => this.tbtn(c.strikethrough, this.t("strikethrough"), () => this.exec("strikeThrough"), "strikeThrough"),
3165
+ bold: () => this.tbtn(a.bold, this.t("bold"), () => this.exec("bold"), "bold"),
3166
+ italic: () => this.tbtn(a.italic, this.t("italic"), () => this.exec("italic"), "italic"),
3167
+ underline: () => this.tbtn(a.underline, this.t("underline"), () => this.exec("underline"), "underline"),
3168
+ strikethrough: () => this.tbtn(a.strikethrough, this.t("strikethrough"), () => this.exec("strikeThrough"), "strikeThrough"),
3164
3169
  forecolor: () => this.colorChips(),
3165
3170
  backcolor: () => this.menuTbtn(
3166
- c.backcolor + '<span class="colorbar" data-cb="back"></span>',
3171
+ a.backcolor + '<span class="colorbar" data-cb="back"></span>',
3167
3172
  this.t("backcolor"),
3168
3173
  (i) => this.colorMenu(i, "back")
3169
3174
  ),
3170
- alignleft: () => this.tbtn(c.alignleft, this.t("alignleft"), () => this.exec("justifyLeft"), "justifyLeft"),
3171
- aligncenter: () => this.tbtn(c.aligncenter, this.t("aligncenter"), () => this.exec("justifyCenter"), "justifyCenter"),
3172
- alignright: () => this.tbtn(c.alignright, this.t("alignright"), () => this.exec("justifyRight"), "justifyRight"),
3173
- alignjustify: () => this.tbtn(c.alignjustify, this.t("alignjustify"), () => this.exec("justifyFull"), "justifyFull"),
3174
- bullist: () => this.menuTbtn(c.bullist, this.t("bullist"), (i) => this.listMenu(i, "ul"), "insertUnorderedList"),
3175
- numlist: () => this.menuTbtn(c.numlist, this.t("numlist"), (i) => this.listMenu(i, "ol"), "insertOrderedList"),
3176
- outdent: () => this.tbtn(c.outdent, this.t("outdent"), () => this.exec("outdent")),
3177
- indent: () => this.tbtn(c.indent, this.t("indent"), () => this.exec("indent")),
3178
- link: () => this.tbtn(c.link, this.t("linkttl"), () => this.linkDlg()),
3179
- blockquote: () => this.tbtn(c.quote, this.t("quote"), () => this.toggleBlock("blockquote"), "blockquote"),
3180
- code: () => this.tbtn(c.inlinecodeic, this.t("code"), () => this.toggleInlineCode(), "code"),
3181
- codesample: () => this.tbtn(c.codesampleic, this.t("codesample"), () => this.codeDlg()),
3182
- changecase: () => this.menuTbtn(c.caseic, this.t("changecase"), (i) => this.caseMenu(i)),
3183
- lineheight: () => this.menuTbtn(c.lineheight, this.t("lineheight"), (i) => this.lineHeightMenu(i)),
3184
- wordspacing: () => this.menuTbtn(c.wordspacing, this.t("wordspacing"), (i) => this.wordSpacingMenu(i)),
3185
- letterspacing: () => this.menuTbtn(c.letterspacing, this.t("letterspacing"), (i) => this.letterSpacingMenu(i)),
3186
- removeformat: () => this.tbtn(c.clearformatic, this.t("removeformat"), () => this.exec("removeFormat")),
3175
+ alignleft: () => this.tbtn(a.alignleft, this.t("alignleft"), () => this.exec("justifyLeft"), "justifyLeft"),
3176
+ aligncenter: () => this.tbtn(a.aligncenter, this.t("aligncenter"), () => this.exec("justifyCenter"), "justifyCenter"),
3177
+ alignright: () => this.tbtn(a.alignright, this.t("alignright"), () => this.exec("justifyRight"), "justifyRight"),
3178
+ alignjustify: () => this.tbtn(a.alignjustify, this.t("alignjustify"), () => this.exec("justifyFull"), "justifyFull"),
3179
+ bullist: () => this.menuTbtn(a.bullist, this.t("bullist"), (i) => this.listMenu(i, "ul"), "insertUnorderedList"),
3180
+ numlist: () => this.menuTbtn(a.numlist, this.t("numlist"), (i) => this.listMenu(i, "ol"), "insertOrderedList"),
3181
+ outdent: () => this.tbtn(a.outdent, this.t("outdent"), () => this.exec("outdent")),
3182
+ indent: () => this.tbtn(a.indent, this.t("indent"), () => this.exec("indent")),
3183
+ link: () => this.tbtn(a.link, this.t("linkttl"), () => this.linkDlg()),
3184
+ blockquote: () => this.tbtn(a.quote, this.t("quote"), () => this.toggleBlock("blockquote"), "blockquote"),
3185
+ code: () => this.tbtn(a.inlinecodeic, this.t("code"), () => this.toggleInlineCode(), "code"),
3186
+ codesample: () => this.tbtn(a.codesampleic, this.t("codesample"), () => this.codeDlg()),
3187
+ changecase: () => this.menuTbtn(a.caseic, this.t("changecase"), (i) => this.caseMenu(i)),
3188
+ lineheight: () => this.menuTbtn(a.lineheight, this.t("lineheight"), (i) => this.lineHeightMenu(i)),
3189
+ wordspacing: () => this.menuTbtn(a.wordspacing, this.t("wordspacing"), (i) => this.wordSpacingMenu(i)),
3190
+ letterspacing: () => this.menuTbtn(a.letterspacing, this.t("letterspacing"), (i) => this.letterSpacingMenu(i)),
3191
+ removeformat: () => this.tbtn(a.clearformatic, this.t("removeformat"), () => this.exec("removeFormat")),
3187
3192
  blocks: () => this.tsel("w-block", "blocksel", this.t("para"), (i) => this.blocksMenu(i)),
3188
- ltr: () => this.tbtn(c.ltr, this.t("ltr"), () => this.setDir("ltr"), "ltr"),
3189
- rtl: () => this.tbtn(c.rtl, this.t("rtl"), () => this.setDir("rtl"), "rtl"),
3190
- quickimage: () => this.tbtn(c.image, this.t("quickimage"), () => this.insertImagePlaceholder()),
3191
- quickvideo: () => this.tbtn(c.video, this.t("quickvideo"), () => this.videoDlg()),
3193
+ ltr: () => this.tbtn(a.ltr, this.t("ltr"), () => this.setDir("ltr"), "ltr"),
3194
+ rtl: () => this.tbtn(a.rtl, this.t("rtl"), () => this.setDir("rtl"), "rtl"),
3195
+ quickimage: () => this.tbtn(a.image, this.t("quickimage"), () => this.insertImagePlaceholder()),
3196
+ quickvideo: () => this.tbtn(a.video, this.t("quickvideo"), () => this.videoDlg()),
3192
3197
  quicktable: () => t,
3193
- template: () => this.menuTbtn(c.templateic, this.t("template"), (i) => this.templateMenu(i)),
3194
- charmap: () => this.tbtn(c.charic, this.t("charmap"), () => this.charMap()),
3195
- emoji: () => this.tbtn(c.emojiic, this.t("emoji"), () => this.emojiMap()),
3196
- fullscreen: () => this.tbtn(c.fullscreen, this.t("fullscreen"), () => this.toggleFullscreen(), "fullscreen"),
3197
- sourcecode: () => this.tbtn(c.srcic, this.t("sourcecode"), () => this.sourceDlg())
3198
+ template: () => this.menuTbtn(a.templateic, this.t("template"), (i) => this.templateMenu(i)),
3199
+ charmap: () => this.tbtn(a.charic, this.t("charmap"), () => this.charMap()),
3200
+ emoji: () => this.tbtn(a.emojiic, this.t("emoji"), () => this.emojiMap()),
3201
+ fullscreen: () => this.tbtn(a.fullscreen, this.t("fullscreen"), () => this.toggleFullscreen(), "fullscreen"),
3202
+ sourcecode: () => this.tbtn(a.srcic, this.t("sourcecode"), () => this.sourceDlg())
3198
3203
  };
3199
3204
  return e.styles = e.blocks, e.image = e.quickimage, e.media = e.quickvideo, e.table = e.quicktable, e;
3200
3205
  }
3201
3206
  buildToolbar() {
3202
3207
  this.toolbar.innerHTML = "";
3203
- const t = this.options.toolbar === !0 ? J : this.options.toolbar, e = this.buildToolbarRegistry();
3208
+ const t = this.options.toolbar === !0 ? it : this.options.toolbar, e = this.buildToolbarRegistry();
3204
3209
  this.parseToolbarString(t).forEach((i) => {
3205
3210
  const s = [];
3206
3211
  i.forEach((l) => {
@@ -3212,7 +3217,7 @@ const I = class I {
3212
3217
  const n = o();
3213
3218
  Array.isArray(n) ? s.push(...n) : s.push(n);
3214
3219
  }), s.length && this.toolbar.appendChild(this.group(...s));
3215
- }), this.tbrMore = this.tbtn(c.more, this.t("more"), () => {
3220
+ }), this.tbrMore = this.tbtn(a.more, this.t("more"), () => {
3216
3221
  this.tbrExpanded = !this.tbrExpanded, this.updateToolbarOverflow();
3217
3222
  }), this.tbrMore.classList.add("tbr-more"), this.toolbar.appendChild(this.tbrMore), this.syncColorSwatches(this.toolbar), this.updateToolbarOverflow();
3218
3223
  }
@@ -3227,7 +3232,7 @@ const I = class I {
3227
3232
  t.classList.add("tbr-measure");
3228
3233
  const e = t.scrollWidth > t.clientWidth + 1;
3229
3234
  t.classList.remove("tbr-measure");
3230
- const i = this.shell.offsetWidth < I.TBR_COLLAPSE_MAX;
3235
+ const i = this.shell.offsetWidth < A.TBR_COLLAPSE_MAX;
3231
3236
  if (!e || !i) {
3232
3237
  this.tbrExpanded = !1, t.classList.remove("collapsible", "expanded"), this.tbrMore.classList.remove("on");
3233
3238
  return;
@@ -3242,116 +3247,134 @@ const I = class I {
3242
3247
  this.menubar.innerHTML = "";
3243
3248
  const t = {
3244
3249
  file: [
3245
- this.mItem("newdoc", c.newic, () => {
3250
+ this.mItem("newdoc", a.newic, () => {
3246
3251
  this.recordRevision(), this.ed.innerHTML = "<p><br></p>", this.onChange();
3247
3252
  }),
3248
3253
  "|",
3249
- this.mItem("importword", c.wordic, () => this.pickWordDoc()),
3250
- this.mItem("restoredraft", c.draftic, () => {
3254
+ this.mItem("importword", a.wordic, () => this.pickWordDoc()),
3255
+ this.mItem("restoredraft", a.draftic, () => {
3251
3256
  this.restoreDraft() || alert(this.t("draftempty"));
3252
3257
  }),
3253
- this.mItem("revhistory", c.historyic, () => this.revisionDlg()),
3258
+ this.mItem("revhistory", a.historyic, () => this.revisionDlg()),
3254
3259
  "|",
3255
- this.mItem("preview", c.prevw, () => this.previewDlg()),
3256
- this.mItem("print", c.printic, () => this.printDoc(), "Ctrl+P")
3260
+ this.mItem("preview", a.prevw, () => this.previewDlg()),
3261
+ this.mItem("print", a.printic, () => this.printDoc(), "Ctrl+P")
3257
3262
  ],
3258
3263
  edit: [
3259
- this.mItem("undo", c.undo, () => this.exec("undo"), "Ctrl+Z"),
3260
- this.mItem("redo", c.redo, () => this.exec("redo"), "Ctrl+Y"),
3264
+ this.mItem("undo", a.undo, () => this.exec("undo"), "Ctrl+Z"),
3265
+ this.mItem("redo", a.redo, () => this.exec("redo"), "Ctrl+Y"),
3261
3266
  "|",
3262
- this.mItem("cut", c.cutic, () => this.exec("cut"), "Ctrl+X"),
3263
- this.mItem("copy", c.copyic, () => this.exec("copy"), "Ctrl+C"),
3264
- this.mItem("paste", c.pasteic, () => alert(this.t("pastehint")), "Ctrl+V"),
3267
+ this.mItem("cut", a.cutic, () => this.exec("cut"), "Ctrl+X"),
3268
+ this.mItem("copy", a.copyic, () => this.exec("copy"), "Ctrl+C"),
3269
+ this.mItem("paste", a.pasteic, () => alert(this.t("pastehint")), "Ctrl+V"),
3265
3270
  "|",
3266
- this.mItem("selectall", c.selall, () => this.exec("selectAll"), "Ctrl+A")
3271
+ this.mItem("selectall", a.selall, () => this.exec("selectAll"), "Ctrl+A")
3267
3272
  ],
3268
3273
  view: [
3269
- this.mItem("fullscreen", c.fullscreen, () => this.toggleFullscreen()),
3270
- this.mItem("preview", c.prevw, () => this.previewDlg()),
3271
- this.mItem("sourcecode", c.srcic, () => this.sourceDlg())
3274
+ this.mItem("fullscreen", a.fullscreen, () => this.toggleFullscreen()),
3275
+ this.mItem("preview", a.prevw, () => this.previewDlg()),
3276
+ this.mItem("sourcecode", a.srcic, () => this.sourceDlg())
3272
3277
  ],
3273
3278
  insert: [
3274
- this.mItem("link", c.link, () => this.linkDlg()),
3275
- this.mItem("image", c.image, () => this.insertImagePlaceholder()),
3276
- this.mItem("video", c.video, () => this.videoDlg()),
3277
- { label: this.t("inserttable"), icon: c.tableic, action: () => this.tableGrid(this.menubar.querySelector('[data-menu-key="table"]') || this.menubar) },
3278
- this.mItem("codesample", c.codesampleic, () => this.codeDlg()),
3279
- { label: this.t("template"), icon: c.templateic, subBuild: (s) => this.buildTemplatePickInto(s) },
3280
- this.mItem("hr", c.hric, () => this.exec("insertHorizontalRule")),
3279
+ this.mItem("link", a.link, () => this.linkDlg()),
3280
+ this.mItem("image", a.image, () => this.insertImagePlaceholder()),
3281
+ this.mItem("video", a.video, () => this.videoDlg()),
3282
+ { label: this.t("inserttable"), icon: a.tableic, action: () => this.tableGrid(this.menubar.querySelector('[data-menu-key="table"]') || this.menubar) },
3283
+ this.mItem("codesample", a.codesampleic, () => this.codeDlg()),
3284
+ { label: this.t("template"), icon: a.templateic, subBuild: (s) => this.buildTemplatePickInto(s) },
3285
+ this.mItem("hr", a.hric, () => this.exec("insertHorizontalRule")),
3281
3286
  "|",
3282
- this.mItem("charmap", c.charic, () => this.charMap()),
3283
- this.mItem("emoji", c.emojiic, () => this.emojiMap()),
3287
+ this.mItem("charmap", a.charic, () => this.charMap()),
3288
+ this.mItem("emoji", a.emojiic, () => this.emojiMap()),
3284
3289
  this.mItem(
3285
3290
  "datetime",
3286
- c.dateic,
3291
+ a.dateic,
3287
3292
  () => this.exec("insertText", (/* @__PURE__ */ new Date()).toLocaleString(this.lang === "ar" ? "ar-AE" : "en-GB"))
3288
3293
  ),
3289
3294
  "|",
3290
3295
  {
3291
3296
  label: this.t("pagebreak"),
3292
- icon: c.pbic,
3297
+ icon: a.pbic,
3293
3298
  action: () => {
3294
3299
  this.restoreSel(), document.execCommand("insertHTML", !1, '<hr class="pagebreak"><p><br></p>'), this.onChange();
3295
3300
  }
3296
3301
  },
3297
- this.mItem("nbsp", c.nbspic, () => this.exec("insertText", " "))
3302
+ this.mItem("nbsp", a.nbspic, () => this.exec("insertText", " "))
3298
3303
  ],
3299
3304
  format: [
3300
- this.mItem("bold", c.bold, () => this.exec("bold"), "Ctrl+B"),
3301
- this.mItem("italic", c.italic, () => this.exec("italic"), "Ctrl+I"),
3302
- this.mItem("underline", c.underline, () => this.exec("underline"), "Ctrl+U"),
3303
- this.mItem("strikethrough", c.strikethrough, () => this.exec("strikeThrough")),
3304
- this.mItem("superscript", c.superscriptic, () => this.exec("superscript")),
3305
- this.mItem("subscript", c.subscriptic, () => this.exec("subscript")),
3306
- this.mItem("code", c.inlinecodeic, () => this.toggleInlineCode()),
3305
+ this.mItem("bold", a.bold, () => this.exec("bold"), "Ctrl+B"),
3306
+ this.mItem("italic", a.italic, () => this.exec("italic"), "Ctrl+I"),
3307
+ this.mItem("underline", a.underline, () => this.exec("underline"), "Ctrl+U"),
3308
+ this.mItem("strikethrough", a.strikethrough, () => this.exec("strikeThrough")),
3309
+ this.mItem("superscript", a.superscriptic, () => this.exec("superscript")),
3310
+ this.mItem("subscript", a.subscriptic, () => this.exec("subscript")),
3311
+ this.mItem("code", a.inlinecodeic, () => this.toggleInlineCode()),
3312
+ this.mItem("quote", a.quote, () => this.toggleBlock("blockquote")),
3307
3313
  "|",
3308
- this.mItem("lowercase", c.lowercaseic, () => this.transformCase("lower")),
3309
- this.mItem("uppercase", c.uppercaseic, () => this.transformCase("upper")),
3310
- this.mItem("capitalize", c.capitalizeic, () => this.transformCase("capitalize")),
3314
+ { label: this.t("fontfamily"), subBuild: (s) => this.menuItems(s, this.fontItems()) },
3315
+ { label: this.t("fontsize"), subBuild: (s) => this.menuItems(s, this.sizeItems()) },
3316
+ { label: this.t("blocks"), subBuild: (s) => this.menuItems(s, this.blockItems()) },
3317
+ { label: this.t("align"), subBuild: (s) => this.menuItems(s, this.alignItems()) },
3318
+ { label: this.t("lineheight"), icon: a.lineheight, subBuild: (s) => this.menuItems(s, this.blockStyleItems("lineHeight", _)) },
3319
+ { label: this.t("wordspacing"), icon: a.wordspacing, subBuild: (s) => this.menuItems(s, this.blockStyleItems("wordSpacing", U)) },
3320
+ { label: this.t("letterspacing"), icon: a.letterspacing, subBuild: (s) => this.menuItems(s, this.blockStyleItems("letterSpacing", V)) },
3311
3321
  "|",
3312
- this.mItem("clearformat", c.clearformatic, () => this.exec("removeFormat"))
3322
+ { label: this.t("forecolor"), icon: a.palette, subBuild: (s) => this.buildPaletteInto(s, this.foreColor, (l) => this.applyColor("fore", l)) },
3323
+ { label: this.t("backcolor"), icon: a.backcolor, subBuild: (s) => this.buildPaletteInto(s, this.backColor, (l) => this.applyColor("back", l)) },
3324
+ "|",
3325
+ this.mItem("bullist", a.bullist, () => this.exec("insertUnorderedList")),
3326
+ this.mItem("numlist", a.numlist, () => this.exec("insertOrderedList")),
3327
+ this.mItem("outdent", a.outdent, () => this.exec("outdent")),
3328
+ this.mItem("indent", a.indent, () => this.exec("indent")),
3329
+ "|",
3330
+ this.mItem("ltr", a.ltr, () => this.setDir("ltr")),
3331
+ this.mItem("rtl", a.rtl, () => this.setDir("rtl")),
3332
+ "|",
3333
+ { label: this.t("changecase"), icon: a.caseic, sub: this.caseItems() },
3334
+ "|",
3335
+ this.mItem("clearformat", a.clearformatic, () => this.exec("removeFormat"))
3313
3336
  ],
3314
- tools: [this.mItem("sourcecode", c.srcic, () => this.sourceDlg()), this.mItem("wordcount", c.wcic, () => this.wordCountDlg())],
3337
+ tools: [this.mItem("sourcecode", a.srcic, () => this.sourceDlg()), this.mItem("wordcount", a.wcic, () => this.wordCountDlg())],
3315
3338
  table: [
3316
- { label: this.t("inserttable"), icon: c.tableic, subBuild: (s) => this.buildTableGridInto(s) },
3339
+ { label: this.t("inserttable"), icon: a.tableic, subBuild: (s) => this.buildTableGridInto(s) },
3317
3340
  "|",
3318
3341
  {
3319
3342
  label: this.t("cell"),
3320
3343
  sub: [
3321
- { label: this.t("cellprops"), icon: c.tableic, action: () => this.cellPropsDlg() },
3322
- { label: this.t("cellbg"), icon: c.palette, subBuild: (s) => this.buildCellFillInto(s) }
3344
+ { label: this.t("cellprops"), icon: a.tableic, action: () => this.cellPropsDlg() },
3345
+ { label: this.t("cellbg"), icon: a.palette, subBuild: (s) => this.buildCellFillInto(s) }
3323
3346
  ]
3324
3347
  },
3325
3348
  {
3326
3349
  label: this.t("row"),
3327
3350
  sub: [
3328
- { label: this.t("rowabove"), icon: c.rowbefore, action: () => this.tableOp("rowabove"), hover: (s) => this.setOpTarget(s ? "row" : null) },
3329
- { label: this.t("rowbelow"), icon: c.rowafter, action: () => this.tableOp("rowbelow"), hover: (s) => this.setOpTarget(s ? "row" : null) },
3330
- { label: this.t("delrow"), icon: c.rowdelete, action: () => this.tableOp("delrow"), hover: (s) => this.setOpTarget(s ? "row" : null) },
3351
+ { label: this.t("rowabove"), icon: a.rowbefore, action: () => this.tableOp("rowabove"), hover: (s) => this.setOpTarget(s ? "row" : null) },
3352
+ { label: this.t("rowbelow"), icon: a.rowafter, action: () => this.tableOp("rowbelow"), hover: (s) => this.setOpTarget(s ? "row" : null) },
3353
+ { label: this.t("delrow"), icon: a.rowdelete, action: () => this.tableOp("delrow"), hover: (s) => this.setOpTarget(s ? "row" : null) },
3331
3354
  "|",
3332
- { label: this.t("moverowup"), icon: c.moverowup, action: () => this.tableMove("rowup"), hover: (s) => this.setOpTarget(s ? "row" : null) },
3333
- { label: this.t("moverowdown"), icon: c.moverowdown, action: () => this.tableMove("rowdown"), hover: (s) => this.setOpTarget(s ? "row" : null) },
3355
+ { label: this.t("moverowup"), icon: a.moverowup, action: () => this.tableMove("rowup"), hover: (s) => this.setOpTarget(s ? "row" : null) },
3356
+ { label: this.t("moverowdown"), icon: a.moverowdown, action: () => this.tableMove("rowdown"), hover: (s) => this.setOpTarget(s ? "row" : null) },
3334
3357
  "|",
3335
- { label: this.t("rowprops"), icon: c.tableic, action: () => this.rowPropsDlg(), hover: (s) => this.setOpTarget(s ? "row" : null) }
3358
+ { label: this.t("rowprops"), icon: a.tableic, action: () => this.rowPropsDlg(), hover: (s) => this.setOpTarget(s ? "row" : null) }
3336
3359
  ]
3337
3360
  },
3338
3361
  {
3339
3362
  label: this.t("column"),
3340
3363
  sub: [
3341
- { label: this.t("colbefore"), icon: c.colbefore, action: () => this.tableOp("colbefore"), hover: (s) => this.setOpTarget(s ? "col" : null) },
3342
- { label: this.t("colafter"), icon: c.colafter, action: () => this.tableOp("colafter"), hover: (s) => this.setOpTarget(s ? "col" : null) },
3343
- { label: this.t("delcol"), icon: c.coldelete, action: () => this.tableOp("delcol"), hover: (s) => this.setOpTarget(s ? "col" : null) },
3364
+ { label: this.t("colbefore"), icon: a.colbefore, action: () => this.tableOp("colbefore"), hover: (s) => this.setOpTarget(s ? "col" : null) },
3365
+ { label: this.t("colafter"), icon: a.colafter, action: () => this.tableOp("colafter"), hover: (s) => this.setOpTarget(s ? "col" : null) },
3366
+ { label: this.t("delcol"), icon: a.coldelete, action: () => this.tableOp("delcol"), hover: (s) => this.setOpTarget(s ? "col" : null) },
3344
3367
  "|",
3345
- { label: this.t("movecolleft"), icon: c.movecolleft, action: () => this.tableMove("colleft"), hover: (s) => this.setOpTarget(s ? "col" : null) },
3346
- { label: this.t("movecolright"), icon: c.movecolright, action: () => this.tableMove("colright"), hover: (s) => this.setOpTarget(s ? "col" : null) },
3368
+ { label: this.t("movecolleft"), icon: a.movecolleft, action: () => this.tableMove("colleft"), hover: (s) => this.setOpTarget(s ? "col" : null) },
3369
+ { label: this.t("movecolright"), icon: a.movecolright, action: () => this.tableMove("colright"), hover: (s) => this.setOpTarget(s ? "col" : null) },
3347
3370
  "|",
3348
- { label: this.t("colprops"), icon: c.tableic, action: () => this.colPropsDlg(), hover: (s) => this.setOpTarget(s ? "col" : null) }
3371
+ { label: this.t("colprops"), icon: a.tableic, action: () => this.colPropsDlg(), hover: (s) => this.setOpTarget(s ? "col" : null) }
3349
3372
  ]
3350
3373
  },
3351
3374
  "|",
3352
3375
  {
3353
3376
  label: this.t("tablepropsttl"),
3354
- icon: c.tableic,
3377
+ icon: a.tableic,
3355
3378
  action: () => {
3356
3379
  const s = this.currentCell();
3357
3380
  if (!s) {
@@ -3361,10 +3384,10 @@ const I = class I {
3361
3384
  this.tblActive = s.closest("table"), this.tablePropsDlg();
3362
3385
  }
3363
3386
  },
3364
- { label: this.t("deltable"), icon: c.trash, action: () => this.tableOp("deltable") }
3387
+ { label: this.t("deltable"), icon: a.trash, action: () => this.tableOp("deltable") }
3365
3388
  ],
3366
- help: [this.mItem("helpttl", c.helpic, () => this.helpDlg(), "Alt+0")]
3367
- }, e = this.options.menubar === !0 ? tt : this.options.menubar, i = /* @__PURE__ */ new Set();
3389
+ help: [this.mItem("helpttl", a.helpic, () => this.helpDlg(), "Alt+0")]
3390
+ }, e = this.options.menubar === !0 ? st : this.options.menubar, i = /* @__PURE__ */ new Set();
3368
3391
  e.split(/\s+/).filter(Boolean).forEach((s) => {
3369
3392
  if (i.has(s)) return;
3370
3393
  if (i.add(s), !t[s]) {
@@ -3379,11 +3402,11 @@ const I = class I {
3379
3402
  }
3380
3403
  /* ---------------------------------------------------------- table ops */
3381
3404
  tableOp(t) {
3382
- var r, a, h;
3405
+ var r, c, h;
3383
3406
  this.restoreSel();
3384
3407
  const e = window.getSelection();
3385
3408
  if (!e) return;
3386
- const i = ((r = this.closestBlock(e.anchorNode)) == null ? void 0 : r.closest("td,th")) || (e.anchorNode && e.anchorNode.nodeType === 1 ? (h = (a = e.anchorNode).closest) == null ? void 0 : h.call(a, "td,th") : null);
3409
+ const i = ((r = this.closestBlock(e.anchorNode)) == null ? void 0 : r.closest("td,th")) || (e.anchorNode && e.anchorNode.nodeType === 1 ? (h = (c = e.anchorNode).closest) == null ? void 0 : h.call(c, "td,th") : null);
3387
3410
  if (!i) return;
3388
3411
  const s = i.parentElement, l = i.closest("table"), o = Array.from(s.children).indexOf(i), n = () => {
3389
3412
  const d = s.cloneNode(!1);
@@ -3421,11 +3444,11 @@ const I = class I {
3421
3444
  r && r.after(i);
3422
3445
  }
3423
3446
  t === "colleft" && l > 0 && s.querySelectorAll("tr").forEach((r) => {
3424
- const a = r.children[l], h = r.children[l - 1];
3425
- a && h && h.before(a);
3447
+ const c = r.children[l], h = r.children[l - 1];
3448
+ c && h && h.before(c);
3426
3449
  }), t === "colright" && s.querySelectorAll("tr").forEach((r) => {
3427
- const a = r.children[l], h = r.children[l + 1];
3428
- a && h && h.after(a);
3450
+ const c = r.children[l], h = r.children[l + 1];
3451
+ c && h && h.after(c);
3429
3452
  });
3430
3453
  const o = document.createRange();
3431
3454
  o.selectNodeContents(e), o.collapse(!0);
@@ -3468,24 +3491,24 @@ const I = class I {
3468
3491
  const t = this.tblActive;
3469
3492
  if (!t) return;
3470
3493
  let e, i, s, l, o;
3471
- const n = "display:flex;align-items:center;gap:10px;margin:10px 0", r = "width:120px;color:#556;flex:none", a = "flex:1;border:1px solid #cfd6df;border-radius:6px;padding:7px 9px;font:14px inherit", h = t.querySelector("td,th"), d = t.style.width || "", m = h && h.style.padding ? parseFloat(h.style.padding) : "", g = t.style.borderSpacing ? parseFloat(t.style.borderSpacing) : "", u = t.style.borderWidth ? parseFloat(t.style.borderWidth) : "", v = t.style.marginLeft, b = t.style.marginRight, x = v === "auto" && b === "auto" ? "center" : v === "auto" ? "right" : b === "auto" && v === "0" ? "left" : "";
3494
+ const n = "display:flex;align-items:center;gap:10px;margin:10px 0", r = "width:120px;color:#556;flex:none", c = "flex:1;border:1px solid #cfd6df;border-radius:6px;padding:7px 9px;font:14px inherit", h = t.querySelector("td,th"), d = t.style.width || "", m = h && h.style.padding ? parseFloat(h.style.padding) : "", g = t.style.borderSpacing ? parseFloat(t.style.borderSpacing) : "", u = t.style.borderWidth ? parseFloat(t.style.borderWidth) : "", v = t.style.marginLeft, b = t.style.marginRight, x = v === "auto" && b === "auto" ? "center" : v === "auto" ? "right" : b === "auto" && v === "0" ? "left" : "";
3472
3495
  this.dialog(
3473
3496
  this.t("tablepropsttl"),
3474
3497
  (C) => {
3475
- const M = (w, k) => {
3498
+ const M = (w, H) => {
3476
3499
  const L = document.createElement("div");
3477
3500
  L.style.cssText = n;
3478
- const H = document.createElement("span");
3479
- H.style.cssText = r, H.textContent = this.t(w), L.append(H, k), C.appendChild(L);
3501
+ const k = document.createElement("span");
3502
+ k.style.cssText = r, k.textContent = this.t(w), L.append(k, H), C.appendChild(L);
3480
3503
  };
3481
- e = document.createElement("input"), e.type = "text", e.style.cssText = a, e.placeholder = "e.g. 600px or 100%", e.value = d, M("tblwidth", e), i = document.createElement("input"), i.type = "number", i.min = "0", i.style.cssText = a, i.value = String(m), M("tblcellpadding", i), s = document.createElement("input"), s.type = "number", s.min = "0", s.style.cssText = a, s.value = String(g), M("tblcellspacing", s), l = document.createElement("input"), l.type = "number", l.min = "0", l.style.cssText = a, l.value = String(u), M("tblborder", l), o = document.createElement("select"), o.style.cssText = a, [
3504
+ e = document.createElement("input"), e.type = "text", e.style.cssText = c, e.placeholder = "e.g. 600px or 100%", e.value = d, M("tblwidth", e), i = document.createElement("input"), i.type = "number", i.min = "0", i.style.cssText = c, i.value = String(m), M("tblcellpadding", i), s = document.createElement("input"), s.type = "number", s.min = "0", s.style.cssText = c, s.value = String(g), M("tblcellspacing", s), l = document.createElement("input"), l.type = "number", l.min = "0", l.style.cssText = c, l.value = String(u), M("tblborder", l), o = document.createElement("select"), o.style.cssText = c, [
3482
3505
  ["", "alignnone"],
3483
3506
  ["left", "alignleft"],
3484
3507
  ["center", "aligncenter"],
3485
3508
  ["right", "alignright"]
3486
- ].forEach(([w, k]) => {
3509
+ ].forEach(([w, H]) => {
3487
3510
  const L = document.createElement("option");
3488
- L.value = w, L.textContent = this.t(k), w === x && (L.selected = !0), o.appendChild(L);
3511
+ L.value = w, L.textContent = this.t(H), w === x && (L.selected = !0), o.appendChild(L);
3489
3512
  }), M("tblalign", o);
3490
3513
  },
3491
3514
  [
@@ -3723,7 +3746,7 @@ const I = class I {
3723
3746
  n.className = "chpanel";
3724
3747
  const r = document.createElement("div");
3725
3748
  r.className = "chgrid" + (i ? " emgrid" : ""), n.appendChild(r);
3726
- const a = (h) => {
3749
+ const c = (h) => {
3727
3750
  o.querySelectorAll("button").forEach((d, m) => d.classList.toggle("on", m === h)), r.innerHTML = "", e[h].chars.forEach((d) => {
3728
3751
  const m = document.createElement("button");
3729
3752
  m.type = "button", m.textContent = d, m.onclick = () => {
@@ -3733,8 +3756,8 @@ const I = class I {
3733
3756
  };
3734
3757
  e.forEach((h, d) => {
3735
3758
  const m = document.createElement("button");
3736
- m.type = "button", m.textContent = this.t(h.key), m.addEventListener("click", () => a(d)), o.appendChild(m);
3737
- }), l.append(o, n), s.appendChild(l), a(0);
3759
+ m.type = "button", m.textContent = this.t(h.key), m.addEventListener("click", () => c(d)), o.appendChild(m);
3760
+ }), l.append(o, n), s.appendChild(l), c(0);
3738
3761
  });
3739
3762
  }
3740
3763
  charMap() {
@@ -3754,7 +3777,7 @@ const I = class I {
3754
3777
  }
3755
3778
  /* ---------------------------------------------- image upload placeholder */
3756
3779
  imgPhHTML(t) {
3757
- return `<div class="img-ph"${t ? ` id="${t}"` : ""} contenteditable="false">${c.image}<span>${this.t("dropimage")}</span></div>`;
3780
+ return `<div class="img-ph"${t ? ` id="${t}"` : ""} contenteditable="false">${a.image}<span>${this.t("dropimage")}</span></div>`;
3758
3781
  }
3759
3782
  insertImagePlaceholder() {
3760
3783
  this.restoreSel();
@@ -3778,11 +3801,11 @@ const I = class I {
3778
3801
  var e;
3779
3802
  const t = this.phCtx;
3780
3803
  t && (t.innerHTML = "", t.append(
3781
- this.ctxBtn(c.uploadic, this.t("uploadimg"), () => {
3804
+ this.ctxBtn(a.uploadic, this.t("uploadimg"), () => {
3782
3805
  this.phUploadTarget = this.phActive, this.pickImage();
3783
3806
  }),
3784
- this.ctxBtn(c.link, this.t("imagelink"), () => this.renderPhCtxUrlInput())
3785
- ), (e = this.phActive) != null && e.closest(".tpl-media") && t.append(this.ctxBtn(c.video, this.t("quickvideo"), () => this.swapPlaceholderKind("video"))), t.append(this.ctxSep(), this.ctxBtn(c.trash, this.t("deleteimg"), () => this.removeImgPlaceholder())), this.positionImgPhCtx());
3807
+ this.ctxBtn(a.link, this.t("imagelink"), () => this.renderPhCtxUrlInput())
3808
+ ), (e = this.phActive) != null && e.closest(".tpl-media") && t.append(this.ctxBtn(a.video, this.t("quickvideo"), () => this.swapPlaceholderKind("video"))), t.append(this.ctxSep(), this.ctxBtn(a.trash, this.t("deleteimg"), () => this.removeImgPlaceholder())), this.positionImgPhCtx());
3786
3809
  }
3787
3810
  /** Swaps a template slot's placeholder between image and video kinds, so the
3788
3811
  * same media slot can be filled with either. */
@@ -3864,7 +3887,7 @@ const I = class I {
3864
3887
  this.vidInput.value = "", this.vidInput.click();
3865
3888
  }
3866
3889
  vidPhHTML(t) {
3867
- return `<div class="img-ph vid-ph"${t ? ` id="${t}"` : ""} contenteditable="false">${c.video}<span>${this.t("dropvideo")}</span></div>`;
3890
+ return `<div class="img-ph vid-ph"${t ? ` id="${t}"` : ""} contenteditable="false">${a.video}<span>${this.t("dropvideo")}</span></div>`;
3868
3891
  }
3869
3892
  insertVideoPlaceholder() {
3870
3893
  this.restoreSel();
@@ -3888,11 +3911,11 @@ const I = class I {
3888
3911
  var e;
3889
3912
  const t = this.vphCtx;
3890
3913
  t && (t.innerHTML = "", t.append(
3891
- this.ctxBtn(c.uploadic, this.t("uploadvideo"), () => {
3914
+ this.ctxBtn(a.uploadic, this.t("uploadvideo"), () => {
3892
3915
  this.vphUploadTarget = this.vphActive, this.pickVideo();
3893
3916
  }),
3894
- this.ctxBtn(c.link, this.t("videolink"), () => this.renderVphCtxUrlInput())
3895
- ), (e = this.vphActive) != null && e.closest(".tpl-media") && t.append(this.ctxBtn(c.image, this.t("quickimage"), () => this.swapPlaceholderKind("image"))), t.append(this.ctxSep(), this.ctxBtn(c.trash, this.t("deletevideo"), () => this.removeVphPlaceholder())), this.positionVphCtx());
3917
+ this.ctxBtn(a.link, this.t("videolink"), () => this.renderVphCtxUrlInput())
3918
+ ), (e = this.vphActive) != null && e.closest(".tpl-media") && t.append(this.ctxBtn(a.image, this.t("quickimage"), () => this.swapPlaceholderKind("image"))), t.append(this.ctxSep(), this.ctxBtn(a.trash, this.t("deletevideo"), () => this.removeVphPlaceholder())), this.positionVphCtx());
3896
3919
  }
3897
3920
  renderVphCtxUrlInput() {
3898
3921
  const t = this.vphCtx;
@@ -3985,23 +4008,23 @@ const I = class I {
3985
4008
  e.className = "imgctx", e.dir = this.dir();
3986
4009
  const i = () => {
3987
4010
  var h;
3988
- const a = this.buildVideoCtxToolbar(t);
3989
- (h = this.vidCtx) == null || h.replaceWith(a), this.vidCtx = a, this.positionVidCtx();
3990
- }, s = (a) => {
3991
- this.setVideoAlign(t, a), i();
3992
- }, l = t.style.float === "left", o = t.style.float === "right", n = !l && !o && t.style.marginLeft === "auto" && t.style.marginRight === "auto", r = (a, h, d, m) => {
3993
- const g = this.ctxBtn(a, h, m);
4011
+ const c = this.buildVideoCtxToolbar(t);
4012
+ (h = this.vidCtx) == null || h.replaceWith(c), this.vidCtx = c, this.positionVidCtx();
4013
+ }, s = (c) => {
4014
+ this.setVideoAlign(t, c), i();
4015
+ }, l = t.style.float === "left", o = t.style.float === "right", n = !l && !o && t.style.marginLeft === "auto" && t.style.marginRight === "auto", r = (c, h, d, m) => {
4016
+ const g = this.ctxBtn(c, h, m);
3994
4017
  return g.classList.toggle("on", d), g;
3995
4018
  };
3996
4019
  return e.append(
3997
- r(c.alignleft, this.t("alignleft"), l, () => s("left")),
3998
- r(c.aligncenter, this.t("aligncenter"), n, () => s("center")),
3999
- r(c.alignright, this.t("alignright"), o, () => s("right")),
4020
+ r(a.alignleft, this.t("alignleft"), l, () => s("left")),
4021
+ r(a.aligncenter, this.t("aligncenter"), n, () => s("center")),
4022
+ r(a.alignright, this.t("alignright"), o, () => s("right")),
4000
4023
  this.ctxSep(),
4001
- r(c.trash, this.t("deletevideo"), !1, () => {
4024
+ r(a.trash, this.t("deletevideo"), !1, () => {
4002
4025
  t.remove(), this.clearVidHandles(), this.onChange();
4003
4026
  })
4004
- ), e.addEventListener("mousedown", (a) => a.preventDefault()), e.addEventListener("mouseenter", () => this.cancelVidHide()), e.addEventListener("mouseleave", () => {
4027
+ ), e.addEventListener("mousedown", (c) => c.preventDefault()), e.addEventListener("mouseenter", () => this.cancelVidHide()), e.addEventListener("mouseleave", () => {
4005
4028
  this.cancelVidHide(), this.vidHideTimer = window.setTimeout(() => this.clearVidHandles(), 250);
4006
4029
  }), document.body.appendChild(e), e;
4007
4030
  }
@@ -4039,18 +4062,18 @@ const I = class I {
4039
4062
  videoDlg() {
4040
4063
  this.saveSel();
4041
4064
  let t, e, i, s, l, o;
4042
- const n = (a, h) => {
4065
+ const n = (c, h) => {
4043
4066
  const d = document.createElement("div");
4044
4067
  d.className = "dfield";
4045
4068
  const m = document.createElement("label");
4046
- return m.textContent = this.t(a), d.append(m, h), d;
4069
+ return m.textContent = this.t(c), d.append(m, h), d;
4047
4070
  }, r = () => {
4048
- const a = document.createElement("input");
4049
- return a.type = "url", a;
4071
+ const c = document.createElement("input");
4072
+ return c.type = "url", c;
4050
4073
  };
4051
4074
  this.dialog(
4052
4075
  this.t("videodlgttl"),
4053
- (a) => {
4076
+ (c) => {
4054
4077
  const h = document.createElement("div");
4055
4078
  h.className = "dtabs";
4056
4079
  const d = [], m = (v, b) => {
@@ -4077,17 +4100,17 @@ const I = class I {
4077
4100
  const w = (L = C.files) == null ? void 0 : L[0];
4078
4101
  if (!w) return;
4079
4102
  x.disabled = !0, x.textContent = this.t("uploading");
4080
- const k = (H) => {
4081
- t.value = H, x.disabled = !1, x.textContent = this.t("uploadvideo");
4103
+ const H = (k) => {
4104
+ t.value = k, x.disabled = !1, x.textContent = this.t("uploadvideo");
4082
4105
  };
4083
4106
  if (this.videoUploadHandler)
4084
- this.videoUploadHandler(w).then(k).catch((H) => {
4107
+ this.videoUploadHandler(w).then(H).catch((k) => {
4085
4108
  var z;
4086
- x.disabled = !1, x.textContent = this.t("uploadfailed"), (z = this.onVideoUploadError) == null || z.call(this, H, w);
4109
+ x.disabled = !1, x.textContent = this.t("uploadfailed"), (z = this.onVideoUploadError) == null || z.call(this, k, w);
4087
4110
  });
4088
4111
  else {
4089
- const H = new FileReader();
4090
- H.onload = () => k(H.result), H.readAsDataURL(w);
4112
+ const k = new FileReader();
4113
+ k.onload = () => H(k.result), k.readAsDataURL(w);
4091
4114
  }
4092
4115
  }), b.append(t, x, C), t.style.flex = "1", v.appendChild(n("vidsource", b));
4093
4116
  const M = document.createElement("div");
@@ -4099,7 +4122,7 @@ const I = class I {
4099
4122
  l = r(), o = r(), v.append(n("vidaltsource", l), n("vidposter", o));
4100
4123
  });
4101
4124
  const u = document.createElement("div");
4102
- u.className = "dtabbody", d.forEach((v) => u.appendChild(v)), a.append(h, u), g(0), setTimeout(() => t.focus(), 0);
4125
+ u.className = "dtabbody", d.forEach((v) => u.appendChild(v)), c.append(h, u), g(0), setTimeout(() => t.focus(), 0);
4103
4126
  },
4104
4127
  [
4105
4128
  { label: this.t("cancel"), action: () => this.closeDlg() },
@@ -4107,10 +4130,10 @@ const I = class I {
4107
4130
  label: this.t("save"),
4108
4131
  primary: !0,
4109
4132
  action: () => {
4110
- const a = s.value.trim(), h = t.value.trim(), d = parseInt(e.value, 10) || 560, m = parseInt(i.value, 10) || 314;
4111
- if (this.closeDlg(), !a && !h) return;
4112
- if (this.restoreSel(), a) {
4113
- document.execCommand("insertHTML", !1, `<span class="video-embed" contenteditable="false">${a}</span>`), this.onChange();
4133
+ const c = s.value.trim(), h = t.value.trim(), d = parseInt(e.value, 10) || 560, m = parseInt(i.value, 10) || 314;
4134
+ if (this.closeDlg(), !c && !h) return;
4135
+ if (this.restoreSel(), c) {
4136
+ document.execCommand("insertHTML", !1, `<span class="video-embed" contenteditable="false">${c}</span>`), this.onChange();
4114
4137
  return;
4115
4138
  }
4116
4139
  const g = this.videoEmbedUrl(h);
@@ -4186,8 +4209,8 @@ const I = class I {
4186
4209
  n.setStart(i, e.anchorOffset - o.length - 1), n.setEnd(i, e.anchorOffset), n.deleteContents();
4187
4210
  const r = document.createElement("code");
4188
4211
  r.textContent = o, n.insertNode(r);
4189
- const a = document.createRange();
4190
- a.setStartAfter(r), a.collapse(!0), e.removeAllRanges(), e.addRange(a), this.saveSel(), this.onChange();
4212
+ const c = document.createRange();
4213
+ c.setStartAfter(r), c.collapse(!0), e.removeAllRanges(), e.addRange(c), this.saveSel(), this.onChange();
4191
4214
  }
4192
4215
  /** Custom dropdown for dialog fields (a native <select> popup can't be styled):
4193
4216
  * a field-styled button showing the current choice that opens a floating,
@@ -4200,20 +4223,20 @@ const I = class I {
4200
4223
  const l = document.createElement("button");
4201
4224
  l.type = "button", l.className = "dsel-btn";
4202
4225
  const o = document.createElement("span");
4203
- o.className = "lbl", o.textContent = ((r = t.find(([a]) => a === e)) == null ? void 0 : r[1]) || "", l.append(o), l.insertAdjacentHTML("beforeend", c.chev);
4226
+ o.className = "lbl", o.textContent = ((r = t.find(([c]) => c === e)) == null ? void 0 : r[1]) || "", l.append(o), l.insertAdjacentHTML("beforeend", a.chev);
4204
4227
  const n = document.createElement("div");
4205
- return n.className = "dsel-list", t.forEach(([a, h]) => {
4228
+ return n.className = "dsel-list", t.forEach(([c, h]) => {
4206
4229
  const d = document.createElement("button");
4207
- d.type = "button", d.textContent = h, d.classList.toggle("on", a === i), d.addEventListener("click", () => {
4208
- i = a, o.textContent = h, n.querySelectorAll("button").forEach((m) => m.classList.toggle("on", m === d)), s.classList.remove("open"), l.focus();
4230
+ d.type = "button", d.textContent = h, d.classList.toggle("on", c === i), d.addEventListener("click", () => {
4231
+ i = c, o.textContent = h, n.querySelectorAll("button").forEach((m) => m.classList.toggle("on", m === d)), s.classList.remove("open"), l.focus();
4209
4232
  }), n.appendChild(d);
4210
4233
  }), l.addEventListener("click", () => {
4211
- var a;
4212
- s.classList.toggle("open"), s.classList.contains("open") && ((a = n.querySelector(".on")) == null || a.scrollIntoView({ block: "nearest" }));
4213
- }), s.addEventListener("focusout", (a) => {
4214
- s.contains(a.relatedTarget) || s.classList.remove("open");
4215
- }), s.addEventListener("keydown", (a) => {
4216
- a.key === "Escape" && s.classList.contains("open") && (a.stopPropagation(), s.classList.remove("open"), l.focus());
4234
+ var c;
4235
+ s.classList.toggle("open"), s.classList.contains("open") && ((c = n.querySelector(".on")) == null || c.scrollIntoView({ block: "nearest" }));
4236
+ }), s.addEventListener("focusout", (c) => {
4237
+ s.contains(c.relatedTarget) || s.classList.remove("open");
4238
+ }), s.addEventListener("keydown", (c) => {
4239
+ c.key === "Escape" && s.classList.contains("open") && (c.stopPropagation(), s.classList.remove("open"), l.focus());
4217
4240
  }), s.append(l, n), { el: s, value: () => i };
4218
4241
  }
4219
4242
  /** Insert/edit-code-sample dialog: language dropdown + monospace textarea to
@@ -4229,7 +4252,7 @@ const I = class I {
4229
4252
  const l = document.createElement("div");
4230
4253
  l.className = "dfield";
4231
4254
  const o = document.createElement("label");
4232
- o.textContent = this.t("codelang"), e = this.dlgSelect(_, (t == null ? void 0 : t.dataset.lang) || "plain"), l.append(o, e.el), i = document.createElement("textarea"), i.className = "code-input", i.spellcheck = !1, i.value = ((n = t == null ? void 0 : t.querySelector("code")) == null ? void 0 : n.textContent) || "", i.placeholder = "const answer = 42;", s.append(l, i), setTimeout(() => i.focus(), 0);
4255
+ o.textContent = this.t("codelang"), e = this.dlgSelect(W, (t == null ? void 0 : t.dataset.lang) || "plain"), l.append(o, e.el), i = document.createElement("textarea"), i.className = "code-input", i.spellcheck = !1, i.value = ((n = t == null ? void 0 : t.querySelector("code")) == null ? void 0 : n.textContent) || "", i.placeholder = "const answer = 42;", s.append(l, i), setTimeout(() => i.focus(), 0);
4233
4256
  },
4234
4257
  [
4235
4258
  { label: this.t("cancel"), action: () => this.closeDlg() },
@@ -4238,7 +4261,7 @@ const I = class I {
4238
4261
  primary: !0,
4239
4262
  action: () => {
4240
4263
  var n;
4241
- const s = i.value.replace(/\s+$/, ""), l = e.value(), o = ((n = _.find(([r]) => r === l)) == null ? void 0 : n[1]) || l;
4264
+ const s = i.value.replace(/\s+$/, ""), l = e.value(), o = ((n = W.find(([r]) => r === l)) == null ? void 0 : n[1]) || l;
4242
4265
  if (this.closeDlg(), !!s.trim()) {
4243
4266
  if (t) {
4244
4267
  t.dataset.lang = l, t.setAttribute("data-lang-label", o);
@@ -4267,10 +4290,10 @@ const I = class I {
4267
4290
  buildCodeCtxToolbar(t) {
4268
4291
  const e = document.createElement("div");
4269
4292
  return e.className = "imgctx", e.dir = this.dir(), e.append(
4270
- this.ctxBtn(c.editic, this.t("editcode"), () => this.codeDlg(t)),
4271
- this.ctxBtn(c.copyic, this.t("copycode"), () => this.copyCodeBlock(t)),
4293
+ this.ctxBtn(a.editic, this.t("editcode"), () => this.codeDlg(t)),
4294
+ this.ctxBtn(a.copyic, this.t("copycode"), () => this.copyCodeBlock(t)),
4272
4295
  this.ctxSep(),
4273
- this.ctxBtn(c.trash, this.t("deletecode"), () => {
4296
+ this.ctxBtn(a.trash, this.t("deletecode"), () => {
4274
4297
  t.remove(), this.clearCodeSel(), this.onChange();
4275
4298
  })
4276
4299
  ), e.addEventListener("mousedown", (i) => i.preventDefault()), document.body.appendChild(e), e;
@@ -4311,9 +4334,9 @@ const I = class I {
4311
4334
  }
4312
4335
  buildTemplatePickInto(t, e) {
4313
4336
  const i = document.createElement("div");
4314
- i.className = "tplpick", F.forEach((s) => {
4337
+ i.className = "tplpick", O.forEach((s) => {
4315
4338
  const l = document.createElement("button");
4316
- 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", () => {
4339
+ l.type = "button", l.className = "tpltile", l.title = this.t(F[s]), l.innerHTML = this.tplPreviewHTML(s) + `<span class="tpllbl">${this.t(F[s])}</span>`, l.addEventListener("click", () => {
4317
4340
  this.closePop(), this.insertTemplate(s), e == null || e();
4318
4341
  }), i.appendChild(l);
4319
4342
  }), t.appendChild(i);
@@ -4332,15 +4355,15 @@ const I = class I {
4332
4355
  }
4333
4356
  renderTplCtxButtons() {
4334
4357
  const t = this.tplCtx, e = this.tplActive;
4335
- !t || !e || (t.innerHTML = "", F.forEach((i) => {
4336
- const s = this.ctxBtn(At[i], this.t(O[i]), () => this.setTplLayout(i));
4358
+ !t || !e || (t.innerHTML = "", O.forEach((i) => {
4359
+ const s = this.ctxBtn(It[i], this.t(F[i]), () => this.setTplLayout(i));
4337
4360
  s.classList.toggle("on", e.classList.contains("tpl-" + i)), t.appendChild(s);
4338
- }), t.append(this.ctxSep(), this.ctxBtn(c.trash, this.t("deltemplate"), () => this.removeTemplate())), this.positionTplCtx());
4361
+ }), t.append(this.ctxSep(), this.ctxBtn(a.trash, this.t("deltemplate"), () => this.removeTemplate())), this.positionTplCtx());
4339
4362
  }
4340
4363
  setTplLayout(t) {
4341
4364
  const e = this.tplActive;
4342
4365
  if (!e) return;
4343
- F.forEach((l) => e.classList.remove("tpl-" + l)), e.classList.add("tpl-" + t);
4366
+ O.forEach((l) => e.classList.remove("tpl-" + l)), e.classList.add("tpl-" + t);
4344
4367
  const i = e.querySelector(":scope > .tpl-media"), s = e.querySelector(":scope > .tpl-text");
4345
4368
  i && s && (t === "img-center" ? e.appendChild(i) : e.insertBefore(i, s)), this.renderTplCtxButtons(), this.positionImgPhCtx(), this.positionImageHandles(), this.onChange();
4346
4369
  }
@@ -4399,8 +4422,8 @@ const I = class I {
4399
4422
  return;
4400
4423
  }
4401
4424
  this.tblOpMark || (this.tblOpMark = document.createElement("div"), this.tblOpMark.className = "tbl-opmark", document.body.appendChild(this.tblOpMark));
4402
- const i = this.tblActive.getBoundingClientRect(), s = e.getBoundingClientRect(), l = e.parentElement.getBoundingClientRect(), o = t === "row" ? l.left : s.left, n = t === "row" ? l.top : i.top, r = t === "row" ? l.width : s.width, a = t === "row" ? l.height : i.height;
4403
- this.tblOpMark.style.left = o + scrollX + "px", this.tblOpMark.style.top = n + scrollY + "px", this.tblOpMark.style.width = r + "px", this.tblOpMark.style.height = a + "px";
4425
+ const i = this.tblActive.getBoundingClientRect(), s = e.getBoundingClientRect(), l = e.parentElement.getBoundingClientRect(), o = t === "row" ? l.left : s.left, n = t === "row" ? l.top : i.top, r = t === "row" ? l.width : s.width, c = t === "row" ? l.height : i.height;
4426
+ this.tblOpMark.style.left = o + scrollX + "px", this.tblOpMark.style.top = n + scrollY + "px", this.tblOpMark.style.width = r + "px", this.tblOpMark.style.height = c + "px";
4404
4427
  }
4405
4428
  /** Lowest allowed top for floating context toolbars — keeps them from
4406
4429
  covering the editor menubar/toolbar when the target sits on the first line. */
@@ -4418,27 +4441,27 @@ const I = class I {
4418
4441
  buildTableCtxToolbar() {
4419
4442
  const t = document.createElement("div");
4420
4443
  t.className = "tblctx", t.dir = this.dir();
4421
- const e = (s, l) => (s.addEventListener("mouseenter", () => this.setOpTarget(l)), s.addEventListener("mouseleave", () => this.setOpTarget(null)), s), i = this.ctxBtn(c.palette, this.t("cellbg"), () => this.cellFillMenu(i));
4444
+ const e = (s, l) => (s.addEventListener("mouseenter", () => this.setOpTarget(l)), s.addEventListener("mouseleave", () => this.setOpTarget(null)), s), i = this.ctxBtn(a.palette, this.t("cellbg"), () => this.cellFillMenu(i));
4422
4445
  return t.append(
4423
- e(this.ctxBtn(c.rowbefore, this.t("rowabove"), () => this.tableOp("rowabove")), "row"),
4424
- e(this.ctxBtn(c.rowafter, this.t("rowbelow"), () => this.tableOp("rowbelow")), "row"),
4425
- e(this.ctxBtn(c.moverowup, this.t("moverowup"), () => this.tableMove("rowup")), "row"),
4426
- e(this.ctxBtn(c.moverowdown, this.t("moverowdown"), () => this.tableMove("rowdown")), "row"),
4427
- e(this.ctxBtn(c.rowdelete, this.t("delrow"), () => this.tableOp("delrow")), "row"),
4446
+ e(this.ctxBtn(a.rowbefore, this.t("rowabove"), () => this.tableOp("rowabove")), "row"),
4447
+ e(this.ctxBtn(a.rowafter, this.t("rowbelow"), () => this.tableOp("rowbelow")), "row"),
4448
+ e(this.ctxBtn(a.moverowup, this.t("moverowup"), () => this.tableMove("rowup")), "row"),
4449
+ e(this.ctxBtn(a.moverowdown, this.t("moverowdown"), () => this.tableMove("rowdown")), "row"),
4450
+ e(this.ctxBtn(a.rowdelete, this.t("delrow"), () => this.tableOp("delrow")), "row"),
4428
4451
  this.ctxSep(),
4429
- e(this.ctxBtn(c.colbefore, this.t("colbefore"), () => this.tableOp("colbefore")), "col"),
4430
- e(this.ctxBtn(c.colafter, this.t("colafter"), () => this.tableOp("colafter")), "col"),
4431
- e(this.ctxBtn(c.movecolleft, this.t("movecolleft"), () => this.tableMove("colleft")), "col"),
4432
- e(this.ctxBtn(c.movecolright, this.t("movecolright"), () => this.tableMove("colright")), "col"),
4433
- e(this.ctxBtn(c.coldelete, this.t("delcol"), () => this.tableOp("delcol")), "col"),
4452
+ e(this.ctxBtn(a.colbefore, this.t("colbefore"), () => this.tableOp("colbefore")), "col"),
4453
+ e(this.ctxBtn(a.colafter, this.t("colafter"), () => this.tableOp("colafter")), "col"),
4454
+ e(this.ctxBtn(a.movecolleft, this.t("movecolleft"), () => this.tableMove("colleft")), "col"),
4455
+ e(this.ctxBtn(a.movecolright, this.t("movecolright"), () => this.tableMove("colright")), "col"),
4456
+ e(this.ctxBtn(a.coldelete, this.t("delcol"), () => this.tableOp("delcol")), "col"),
4434
4457
  this.ctxSep(),
4435
- this.ctxBtn(c.alignleft, this.t("tblalignleft"), () => this.alignTable("left")),
4436
- this.ctxBtn(c.aligncenter, this.t("tblaligncenter"), () => this.alignTable("center")),
4437
- this.ctxBtn(c.alignright, this.t("tblalignright"), () => this.alignTable("right")),
4458
+ this.ctxBtn(a.alignleft, this.t("tblalignleft"), () => this.alignTable("left")),
4459
+ this.ctxBtn(a.aligncenter, this.t("tblaligncenter"), () => this.alignTable("center")),
4460
+ this.ctxBtn(a.alignright, this.t("tblalignright"), () => this.alignTable("right")),
4438
4461
  this.ctxSep(),
4439
4462
  i,
4440
- this.ctxBtn(c.trash, this.t("deltable"), () => this.tableOp("deltable")),
4441
- this.ctxBtn(c.tableic, this.t("tablepropsttl"), () => this.tablePropsDlg())
4463
+ this.ctxBtn(a.trash, this.t("deltable"), () => this.tableOp("deltable")),
4464
+ this.ctxBtn(a.tableic, this.t("tablepropsttl"), () => this.tablePropsDlg())
4442
4465
  ), document.body.appendChild(t), t;
4443
4466
  }
4444
4467
  positionTableHandles() {
@@ -4448,17 +4471,17 @@ const I = class I {
4448
4471
  }
4449
4472
  const t = this.ed.getAttribute("dir") === "rtl", e = this.tblActive.getBoundingClientRect(), i = e.top + scrollY, s = e.left + scrollX, l = e.right + scrollX, o = e.bottom + scrollY;
4450
4473
  if (this.tblCorner && (this.tblCorner.style.top = o - 5 + "px", this.tblCorner.style.left = (t ? s - 5 : l - 5) + "px", this.tblCorner.style.cursor = t ? "nesw-resize" : "nwse-resize"), this.tblCtx) {
4451
- const r = this.tblCtx.offsetWidth, a = this.tblCtx.offsetHeight;
4474
+ const r = this.tblCtx.offsetWidth, c = this.tblCtx.offsetHeight;
4452
4475
  let h = s + (l - s) / 2 - r / 2;
4453
4476
  h = Math.max(8 + scrollX, Math.min(h, scrollX + innerWidth - r - 8));
4454
- let d = i - a - 8;
4477
+ let d = i - c - 8;
4455
4478
  d < this.ctxMinTop() && (d = o + 8), this.tblCtx.style.left = h + "px", this.tblCtx.style.top = d + "px";
4456
4479
  }
4457
4480
  this.tblColBars.forEach((r) => r.remove()), this.tblColBars = [];
4458
4481
  const n = this.tblActive.rows[0];
4459
4482
  if (n)
4460
4483
  for (let r = 0; r < n.cells.length - 1; r++) {
4461
- const a = n.cells[r].getBoundingClientRect(), h = (t ? a.left : a.right) + scrollX, d = document.createElement("div");
4484
+ const c = n.cells[r].getBoundingClientRect(), h = (t ? c.left : c.right) + scrollX, d = document.createElement("div");
4462
4485
  d.className = "tbl-colbar", d.style.top = i + "px", d.style.left = h + "px", d.style.height = o - i + "px", document.body.appendChild(d), d.addEventListener("mousedown", (m) => this.startColBarDrag(m, r)), this.tblColBars.push(d);
4463
4486
  }
4464
4487
  this.positionCellMarker(), this.positionOpMark();
@@ -4478,8 +4501,8 @@ const I = class I {
4478
4501
  if (!e) return;
4479
4502
  const i = this.ed.getAttribute("dir") === "rtl", s = t.clientX, l = e.getBoundingClientRect().width;
4480
4503
  e.style.tableLayout = e.style.tableLayout || "fixed", this.withNoTextSelect((o) => {
4481
- const n = (a) => {
4482
- const h = i ? -(a.clientX - s) : a.clientX - s;
4504
+ const n = (c) => {
4505
+ const h = i ? -(c.clientX - s) : c.clientX - s;
4483
4506
  e.style.width = Math.max(60, Math.round(l + h)) + "px", this.positionTableHandles();
4484
4507
  }, r = () => {
4485
4508
  window.removeEventListener("mousemove", n), window.removeEventListener("mouseup", r), o(), this.onChange();
@@ -4493,11 +4516,11 @@ const I = class I {
4493
4516
  if (!i) return;
4494
4517
  const s = this.ed.getAttribute("dir") === "rtl", l = Array.from(i.rows), o = l.map((d) => d.cells[e]).filter(Boolean), n = l.map((d) => d.cells[e + 1]).filter(Boolean);
4495
4518
  if (!o.length || !n.length) return;
4496
- const r = t.clientX, a = o[0].getBoundingClientRect().width, h = n[0].getBoundingClientRect().width;
4519
+ const r = t.clientX, c = o[0].getBoundingClientRect().width, h = n[0].getBoundingClientRect().width;
4497
4520
  i.style.tableLayout = "fixed", this.withNoTextSelect((d) => {
4498
4521
  const m = (u) => {
4499
4522
  const v = (s ? -1 : 1) * (u.clientX - r);
4500
- o.forEach((b) => b.style.width = Math.max(24, Math.round(a + v)) + "px"), n.forEach((b) => b.style.width = Math.max(24, Math.round(h - v)) + "px"), this.positionTableHandles();
4523
+ o.forEach((b) => b.style.width = Math.max(24, Math.round(c + v)) + "px"), n.forEach((b) => b.style.width = Math.max(24, Math.round(h - v)) + "px"), this.positionTableHandles();
4501
4524
  }, g = () => {
4502
4525
  window.removeEventListener("mousemove", m), window.removeEventListener("mouseup", g), d(), this.onChange();
4503
4526
  };
@@ -4516,7 +4539,7 @@ const I = class I {
4516
4539
  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;
4517
4540
  }
4518
4541
  selectImage(t) {
4519
- this.imgActive !== t && (this.clearImageHandles(), this.imgActive = t, t.classList.add("img-selected"), this.imgHandles = kt.map((e) => {
4542
+ this.imgActive !== t && (this.clearImageHandles(), this.imgActive = t, t.classList.add("img-selected"), this.imgHandles = Ht.map((e) => {
4520
4543
  const i = document.createElement("div");
4521
4544
  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;
4522
4545
  }), this.imgCtx = this.buildImageCtxToolbar(t), this.positionImageHandles());
@@ -4526,38 +4549,38 @@ const I = class I {
4526
4549
  e.className = "imgctx", e.dir = this.dir();
4527
4550
  const i = () => {
4528
4551
  var h;
4529
- const a = this.buildImageCtxToolbar(t);
4530
- (h = this.imgCtx) == null || h.replaceWith(a), this.imgCtx = a, this.positionImageHandles();
4531
- }, s = (a) => {
4532
- this.setImageAlign(t, a), i();
4533
- }, l = t.style.float === "left", o = t.style.float === "right", n = !l && !o && t.style.marginLeft === "auto" && t.style.marginRight === "auto", r = (a, h, d, m) => {
4534
- const g = this.ctxBtn(a, h, m);
4552
+ const c = this.buildImageCtxToolbar(t);
4553
+ (h = this.imgCtx) == null || h.replaceWith(c), this.imgCtx = c, this.positionImageHandles();
4554
+ }, s = (c) => {
4555
+ this.setImageAlign(t, c), i();
4556
+ }, l = t.style.float === "left", o = t.style.float === "right", n = !l && !o && t.style.marginLeft === "auto" && t.style.marginRight === "auto", r = (c, h, d, m) => {
4557
+ const g = this.ctxBtn(c, h, m);
4535
4558
  return g.classList.toggle("on", d), g;
4536
4559
  };
4537
4560
  return e.append(
4538
- r(c.alignleft, this.t("alignleft"), l, () => s("left")),
4539
- r(c.aligncenter, this.t("aligncenter"), n, () => s("center")),
4540
- r(c.alignright, this.t("alignright"), o, () => s("right")),
4561
+ r(a.alignleft, this.t("alignleft"), l, () => s("left")),
4562
+ r(a.aligncenter, this.t("aligncenter"), n, () => s("center")),
4563
+ r(a.alignright, this.t("alignright"), o, () => s("right")),
4541
4564
  this.ctxSep(),
4542
- r(c.rotateleft, this.t("rotateleft"), !1, () => {
4565
+ r(a.rotateleft, this.t("rotateleft"), !1, () => {
4543
4566
  this.rotateImage(t, -90), i();
4544
4567
  }),
4545
- r(c.rotateright, this.t("rotateright"), !1, () => {
4568
+ r(a.rotateright, this.t("rotateright"), !1, () => {
4546
4569
  this.rotateImage(t, 90), i();
4547
4570
  }),
4548
4571
  this.ctxSep(),
4549
- r(c.fliphorizontal, this.t("fliphorizontal"), t.dataset.flipx === "1", () => {
4572
+ r(a.fliphorizontal, this.t("fliphorizontal"), t.dataset.flipx === "1", () => {
4550
4573
  this.flipImage(t, "x"), i();
4551
4574
  }),
4552
- r(c.flipvertical, this.t("flipvertical"), t.dataset.flipy === "1", () => {
4575
+ r(a.flipvertical, this.t("flipvertical"), t.dataset.flipy === "1", () => {
4553
4576
  this.flipImage(t, "y"), i();
4554
4577
  }),
4555
4578
  this.ctxSep(),
4556
- r(c.trash, this.t("deleteimg"), !1, () => {
4557
- const a = t.closest(".tpl-media");
4558
- a && this.ed.contains(a) ? t.outerHTML = this.imgPhHTML() : t.remove(), this.clearImageHandles(), this.onChange();
4579
+ r(a.trash, this.t("deleteimg"), !1, () => {
4580
+ const c = t.closest(".tpl-media");
4581
+ c && this.ed.contains(c) ? t.outerHTML = this.imgPhHTML() : t.remove(), this.clearImageHandles(), this.onChange();
4559
4582
  })
4560
- ), e.addEventListener("mousedown", (a) => a.preventDefault()), e.addEventListener("mouseenter", () => this.cancelImgHide()), e.addEventListener("mouseleave", () => this.scheduleImgHide()), document.body.appendChild(e), e;
4583
+ ), e.addEventListener("mousedown", (c) => c.preventDefault()), e.addEventListener("mouseenter", () => this.cancelImgHide()), e.addEventListener("mouseleave", () => this.scheduleImgHide()), document.body.appendChild(e), e;
4561
4584
  }
4562
4585
  setImageAlign(t, e) {
4563
4586
  t.style.float = "", t.style.display = "", t.style.marginLeft = "", t.style.marginRight = "", t.style.marginBottom = "", e === "left" ? (t.style.float = "left", t.style.marginInlineEnd = "1em", t.style.marginBottom = "0.5em") : e === "right" ? (t.style.float = "right", t.style.marginInlineStart = "1em", t.style.marginBottom = "0.5em") : (t.style.display = "block", t.style.marginLeft = "auto", t.style.marginRight = "auto"), this.onChange();
@@ -4586,14 +4609,14 @@ const I = class I {
4586
4609
  se: [s, l]
4587
4610
  };
4588
4611
  if (this.imgHandles.forEach((n) => {
4589
- const [r, a] = o[n.dataset.corner];
4590
- n.style.left = r - 5 + "px", n.style.top = a - 5 + "px";
4612
+ const [r, c] = o[n.dataset.corner];
4613
+ n.style.left = r - 5 + "px", n.style.top = c - 5 + "px";
4591
4614
  }), this.imgCtx) {
4592
4615
  const n = this.imgCtx.offsetWidth, r = this.imgCtx.offsetHeight;
4593
- let a = i + (s - i) / 2 - n / 2;
4594
- a = Math.max(8 + scrollX, Math.min(a, scrollX + innerWidth - n - 8));
4616
+ let c = i + (s - i) / 2 - n / 2;
4617
+ c = Math.max(8 + scrollX, Math.min(c, scrollX + innerWidth - n - 8));
4595
4618
  let h = e - r - 8;
4596
- h < this.ctxMinTop() && (h = l + 8), this.imgCtx.style.left = a + "px", this.imgCtx.style.top = h + "px";
4619
+ h < this.ctxMinTop() && (h = l + 8), this.imgCtx.style.left = c + "px", this.imgCtx.style.top = h + "px";
4597
4620
  }
4598
4621
  }
4599
4622
  startImageResizeDrag(t, e) {
@@ -4605,15 +4628,30 @@ const I = class I {
4605
4628
  this.withNoTextSelect((n) => {
4606
4629
  const r = (h) => {
4607
4630
  i.style.width = Math.max(24, Math.round(l + o * (h.clientX - s))) + "px", i.style.height = "auto", this.positionImageHandles();
4608
- }, a = () => {
4609
- window.removeEventListener("mousemove", r), window.removeEventListener("mouseup", a), n(), this.onChange();
4631
+ }, c = () => {
4632
+ window.removeEventListener("mousemove", r), window.removeEventListener("mouseup", c), n(), this.onChange();
4610
4633
  };
4611
- window.addEventListener("mousemove", r), window.addEventListener("mouseup", a);
4634
+ window.addEventListener("mousemove", r), window.addEventListener("mouseup", c);
4612
4635
  });
4613
4636
  }
4614
4637
  /* ---------------------------------------------------------- selection bubble toolbar */
4615
4638
  toggleBlock(t) {
4616
- this.exec("formatBlock", this.currentBlock() === t ? "<p>" : "<" + t + ">");
4639
+ const e = this.currentBlock() === t;
4640
+ this.exec("formatBlock", e ? "<p>" : "<" + t + ">"), t === "blockquote" && e && this.unwrapBlockquote();
4641
+ }
4642
+ /** Some browsers leave the <blockquote> wrapper in place after formatBlock('<p>'); strip it manually if so. */
4643
+ unwrapBlockquote() {
4644
+ const t = window.getSelection();
4645
+ let e = t && this.ed.contains(t.anchorNode) ? t.anchorNode : null;
4646
+ for (; e && e !== this.ed; ) {
4647
+ if (e.nodeType === 1 && e.tagName === "BLOCKQUOTE") {
4648
+ const i = e, s = i.parentNode;
4649
+ for (; i.firstChild; ) s.insertBefore(i.firstChild, i);
4650
+ s.removeChild(i), this.onChange();
4651
+ return;
4652
+ }
4653
+ e = e.parentNode;
4654
+ }
4617
4655
  }
4618
4656
  clearSelToolbar() {
4619
4657
  var t;
@@ -4639,21 +4677,21 @@ const I = class I {
4639
4677
  '<b style="font:600 15px/1 Georgia,serif">A</b><span class="colorbar" data-cb="fore"></span>',
4640
4678
  this.t("forecolor"),
4641
4679
  () => this.colorMenu(e, "fore")
4642
- ), i = this.ctxBtn(c.backcolor, this.t("backcolor"), () => this.colorMenu(i, "back"));
4680
+ ), i = this.ctxBtn(a.backcolor, this.t("backcolor"), () => this.colorMenu(i, "back"));
4643
4681
  (n = i.querySelector("svg")) == null || n.insertAdjacentHTML("afterend", '<span class="colorbar" data-cb="back"></span>');
4644
- const s = this.ctxBtn(c.caseic, this.t("changecase"), () => this.caseMenu(s)), l = this.ctxBtn(c.lineheight, this.t("lineheight"), () => this.lineHeightMenu(l)), o = this.ctxBtn(c.wordspacing, this.t("wordspacing"), () => this.wordSpacingMenu(o));
4682
+ const s = this.ctxBtn(a.caseic, this.t("changecase"), () => this.caseMenu(s)), l = this.ctxBtn(a.lineheight, this.t("lineheight"), () => this.lineHeightMenu(l)), o = this.ctxBtn(a.wordspacing, this.t("wordspacing"), () => this.wordSpacingMenu(o));
4645
4683
  return t.append(
4646
- this.ctxBtn(c.bold, this.t("bold"), () => this.exec("bold"), "bold"),
4647
- this.ctxBtn(c.italic, this.t("italic"), () => this.exec("italic"), "italic"),
4684
+ this.ctxBtn(a.bold, this.t("bold"), () => this.exec("bold"), "bold"),
4685
+ this.ctxBtn(a.italic, this.t("italic"), () => this.exec("italic"), "italic"),
4648
4686
  e,
4649
4687
  i,
4650
4688
  this.ctxSep(),
4651
- this.ctxBtn(c.quote, this.t("quote"), () => this.toggleBlock("blockquote"), "blockquote"),
4652
- this.ctxBtn(c.inlinecodeic, this.t("code"), () => this.toggleInlineCode(), "code"),
4689
+ this.ctxBtn(a.quote, this.t("quote"), () => this.toggleBlock("blockquote"), "blockquote"),
4690
+ this.ctxBtn(a.inlinecodeic, this.t("code"), () => this.toggleInlineCode(), "code"),
4653
4691
  this.ctxBtn('<b style="font:700 12px/1 Arial,sans-serif">H2</b>', this.blockLabel("h2"), () => this.toggleBlock("h2"), "h2"),
4654
4692
  this.ctxBtn('<b style="font:700 12px/1 Arial,sans-serif">H3</b>', this.blockLabel("h3"), () => this.toggleBlock("h3"), "h3"),
4655
4693
  this.ctxSep(),
4656
- this.ctxBtn(c.link, this.t("linkttl"), () => this.linkDlg()),
4694
+ this.ctxBtn(a.link, this.t("linkttl"), () => this.linkDlg()),
4657
4695
  s,
4658
4696
  l,
4659
4697
  o
@@ -4662,10 +4700,10 @@ const I = class I {
4662
4700
  positionSelToolbar(t) {
4663
4701
  if (!this.selCtx) return;
4664
4702
  const e = t.getBoundingClientRect(), i = e.top + scrollY, s = e.left + scrollX, l = e.right + scrollX, o = e.bottom + scrollY, n = this.selCtx.offsetWidth, r = this.selCtx.offsetHeight;
4665
- let a = s + (l - s) / 2 - n / 2;
4666
- a = Math.max(8 + scrollX, Math.min(a, scrollX + innerWidth - n - 8));
4703
+ let c = s + (l - s) / 2 - n / 2;
4704
+ c = Math.max(8 + scrollX, Math.min(c, scrollX + innerWidth - n - 8));
4667
4705
  let h = i - r - 8;
4668
- h < this.ctxMinTop() && (h = o + 8), this.selCtx.style.left = a + "px", this.selCtx.style.top = h + "px";
4706
+ h < this.ctxMinTop() && (h = o + 8), this.selCtx.style.left = c + "px", this.selCtx.style.top = h + "px";
4669
4707
  }
4670
4708
  repositionSelToolbar() {
4671
4709
  if (!this.selCtx) return;
@@ -4676,8 +4714,13 @@ const I = class I {
4676
4714
  currentBlock() {
4677
4715
  const t = window.getSelection();
4678
4716
  if (!t || !t.anchorNode || !this.ed.contains(t.anchorNode)) return "p";
4679
- const e = this.closestBlock(t.anchorNode);
4680
- return e ? e.tagName.toLowerCase().replace("div", "p") : "p";
4717
+ let e = t.anchorNode;
4718
+ for (; e && e !== this.ed; ) {
4719
+ if (e.nodeType === 1 && e.tagName === "BLOCKQUOTE") return "blockquote";
4720
+ e = e.parentNode;
4721
+ }
4722
+ const i = this.closestBlock(t.anchorNode);
4723
+ return i ? i.tagName.toLowerCase().replace("div", "p") : "p";
4681
4724
  }
4682
4725
  /** Element whose computed font reflects the current caret, falling back to the editor root before any selection lands inside it. */
4683
4726
  fontRefEl() {
@@ -4693,7 +4736,7 @@ const I = class I {
4693
4736
  return t > 0 ? t + "px" : "";
4694
4737
  }
4695
4738
  refreshState() {
4696
- var r, a, h;
4739
+ var r, c, h;
4697
4740
  const t = window.getSelection(), e = t ? this.ed.contains(t.anchorNode) : !1, i = this.currentBlock();
4698
4741
  [this.toolbar, this.selCtx].filter(Boolean).forEach((d) => {
4699
4742
  [
@@ -4718,12 +4761,12 @@ const I = class I {
4718
4761
  m && m.classList.toggle("on", e && !!this.closestInlineCode());
4719
4762
  });
4720
4763
  const l = t ? this.closestBlock(t.anchorNode) : null, o = ((r = l == null ? void 0 : l.closest("[dir]")) == null ? void 0 : r.getAttribute("dir")) || this.ed.getAttribute("dir") || this.dir();
4721
- (a = this.toolbar.querySelector("[data-id=ltr]")) == null || a.classList.toggle("on", e && o === "ltr"), (h = this.toolbar.querySelector("[data-id=rtl]")) == null || h.classList.toggle("on", e && o === "rtl");
4764
+ (c = this.toolbar.querySelector("[data-id=ltr]")) == null || c.classList.toggle("on", e && o === "ltr"), (h = this.toolbar.querySelector("[data-id=rtl]")) == null || h.classList.toggle("on", e && o === "rtl");
4722
4765
  const n = (d, m, g) => {
4723
4766
  const u = this.toolbar.querySelector(`[data-id=${d}] .lbl`);
4724
4767
  u && (u.textContent = m || g || "", u.classList.toggle("empty", !m));
4725
4768
  };
4726
- n("fontsel", this.currentFont()), n("sizesel", this.currentSize().replace("px", "")), e && n("blocksel", V.some((d) => d[0] === i) ? this.blockLabel(i) : this.t("para")), this.sbWords.textContent = this.countWords() + " " + this.t("words");
4769
+ n("fontsel", this.currentFont()), n("sizesel", this.currentSize().replace("px", "")), e && n("blocksel", j.some((d) => d[0] === i) ? this.blockLabel(i) : this.t("para")), this.sbWords.textContent = this.countWords() + " " + this.t("words");
4727
4770
  }
4728
4771
  countWords() {
4729
4772
  const t = (this.ed.textContent || "").trim();
@@ -4756,18 +4799,18 @@ const I = class I {
4756
4799
  this.closePop(), this.closeDlg(), this.clearTableHandles(), this.clearImgPlaceholderSel(), this.clearVphPlaceholderSel(), this.clearVidHandles(), this.clearCodeSel(), this.shell.dir = this.dir(), this.ed.dir = this.dir(), this.options.menubar ? this.buildMenubar() : this.menubar.style.display = "none", this.options.toolbar ? this.buildToolbar() : this.toolbar.style.display = "none", this.sbHelp.textContent = this.t("statushelp"), this.refreshState();
4757
4800
  }
4758
4801
  };
4759
- I.instanceCounter = 0, I.TBR_COLLAPSE_MAX = 992;
4760
- let G = I;
4802
+ A.instanceCounter = 0, A.TBR_COLLAPSE_MAX = 992;
4803
+ let J = A;
4761
4804
  export {
4762
- V as BLOCKS,
4763
- Bt as CHARS,
4805
+ j as BLOCKS,
4806
+ Nt as CHARS,
4764
4807
  ct as COLORS,
4765
- et as FONTS,
4766
- G as FableEditor,
4767
- K as I18N,
4768
- c as IC,
4769
- it as SIZES,
4770
- Nt as TXT,
4808
+ lt as FONTS,
4809
+ J as FableEditor,
4810
+ et as I18N,
4811
+ a as IC,
4812
+ ot as SIZES,
4813
+ Zt as TXT,
4771
4814
  wt as cleanPastedHTML,
4772
4815
  R as getStrings,
4773
4816
  Tt as normalizeTextPaste