@editora/core 1.0.14 → 1.0.16

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.
Files changed (73) hide show
  1. package/dist/{A11yCheckerPlugin.native-BRdGYMju.mjs → A11yCheckerPlugin.native-DIKuCeFw.mjs} +82 -79
  2. package/dist/{AnchorPlugin.native-BcYGEtd9.mjs → AnchorPlugin.native-DXZdK3zr.mjs} +72 -71
  3. package/dist/{ApprovalWorkflowPlugin.native-BZ6jO-Wj.mjs → ApprovalWorkflowPlugin.native-ZsS_2xmn.mjs} +239 -238
  4. package/dist/{BackgroundColorPlugin.native-50iAT9xU.mjs → BackgroundColorPlugin.native-H3XyYD7_.mjs} +2 -2
  5. package/dist/{BlocksLibraryPlugin.native-5sdsXsiE.mjs → BlocksLibraryPlugin.native-CownM6Rk.mjs} +140 -116
  6. package/dist/{CapitalizationPlugin.native-DLV4oPmB.mjs → CapitalizationPlugin.native-C-HRbXGh.mjs} +10 -5
  7. package/dist/{ChecklistPlugin.native-BS-kMz9O.mjs → ChecklistPlugin.native-NVrBUkaL.mjs} +141 -103
  8. package/dist/{CitationsPlugin.native-DQgoCd1B.mjs → CitationsPlugin.native-C_7wWQ-k.mjs} +441 -422
  9. package/dist/{ClearFormattingPlugin.native-B6ro3a1h.mjs → ClearFormattingPlugin.native-Pp0O-SBf.mjs} +24 -23
  10. package/dist/{CodePlugin.native-veDC_kx5.mjs → CodePlugin.native-BH-K4xmW.mjs} +1049 -917
  11. package/dist/CodePlugin.native-hNgfXlfS.mjs +4767 -0
  12. package/dist/CodeSamplePlugin.native-svbAFWh_.mjs +501 -0
  13. package/dist/CollaborationPlugin.native-oSybCGPW.mjs +7468 -0
  14. package/dist/{CommentsPlugin.native-DPSqTkiv.mjs → CommentsPlugin.native-CLip9wAO.mjs} +233 -185
  15. package/dist/{ConditionalContentPlugin.native-CfhY46rU.mjs → ConditionalContentPlugin.native-Bf7XgRSW.mjs} +401 -351
  16. package/dist/{DataBindingPlugin.native-BoXwghTz.mjs → DataBindingPlugin.native-B7lpI_0c.mjs} +29 -28
  17. package/dist/{DocumentManagerPlugin.native-C2cs_1w4.mjs → DocumentManagerPlugin.native-iFip6s4Q.mjs} +94 -45
  18. package/dist/{EmbedIframePlugin.native-BF_-LjTq.mjs → EmbedIframePlugin.native-BfZ_HGlV.mjs} +231 -186
  19. package/dist/{EmojisPlugin.native-CitxxlWX.mjs → EmojisPlugin.native-D92aaOKi.mjs} +288 -76
  20. package/dist/{FontFamilyPlugin.native-j8hMTbg4.mjs → FontFamilyPlugin.native-M3cNQ0KA.mjs} +57 -50
  21. package/dist/{FontSizePlugin.native-B_jCh7dY.mjs → FontSizePlugin.native-DsLrH8eq.mjs} +41 -34
  22. package/dist/{FormatPainterPlugin.native-CsMrKfFU.mjs → FormatPainterPlugin.native-BhjzsiVq.mjs} +3 -2
  23. package/dist/{HistoryPlugin.native-D2wl32jV.mjs → HistoryPlugin.native-DPvhks6h.mjs} +36 -32
  24. package/dist/LinkPlugin.native-BsQXYsK6.mjs +352 -0
  25. package/dist/{ListPlugin.native-V7EZC1lM.mjs → ListPlugin.native-Bt0LANbO.mjs} +68 -35
  26. package/dist/{MathPlugin.native-NwWPHVmj.mjs → MathPlugin.native-Byo3WL0f.mjs} +211 -115
  27. package/dist/{MediaManagerPlugin.native-eOsTJFpw.mjs → MediaManagerPlugin.native-BT1NZIJS.mjs} +139 -134
  28. package/dist/{MentionPlugin.native-BMDlOqur.mjs → MentionPlugin.native-S_lwGZQO.mjs} +23 -18
  29. package/dist/{MergeTagPlugin.native-BzRVoD9-.mjs → MergeTagPlugin.native-7-6F3S1Y.mjs} +44 -43
  30. package/dist/{PreviewPlugin.native-WuIwOAOR.mjs → PreviewPlugin.native-CiR51jql.mjs} +31 -28
  31. package/dist/{SlashCommandsPlugin.native-BiN6ODw5.mjs → SlashCommandsPlugin.native-BDIIwGNs.mjs} +90 -79
  32. package/dist/{SmartPastePlugin.native-CZAEHkyt.mjs → SmartPastePlugin.native-BATLCds5.mjs} +89 -85
  33. package/dist/{SpecialCharactersPlugin.native-DaG4b19I.mjs → SpecialCharactersPlugin.native-CdZoc1GB.mjs} +73 -26
  34. package/dist/SpellCheckPlugin.native-Bef2oTLB.mjs +10935 -0
  35. package/dist/TablePlugin.native-BjIxYZ2X.mjs +772 -0
  36. package/dist/{TemplatePlugin.native-DLjFUaPW.mjs → TemplatePlugin.native-D6n5RUnC.mjs} +288 -262
  37. package/dist/{TextColorPlugin.native-Bwl_bSmc.mjs → TextColorPlugin.native-KMZ2uzlq.mjs} +2 -2
  38. package/dist/{TranslationWorkflowPlugin.native-DdF16tgT.mjs → TranslationWorkflowPlugin.native-CZtG--06.mjs} +67 -65
  39. package/dist/{VersionDiffPlugin.native-Bvxgy--t.mjs → VersionDiffPlugin.native-Ca1fMWUJ.mjs} +42 -42
  40. package/dist/anchoredPopover-DJFD2oAP.mjs +116 -0
  41. package/dist/core.css +1 -1
  42. package/dist/dialogHelpers-DBf7WqYH.mjs +40 -0
  43. package/dist/{documentManager-vQ1VkbUY.mjs → documentManager-BcBIv5P-.mjs} +3 -3
  44. package/dist/editora.min.js +26 -24
  45. package/dist/editora.umd.js +26 -24
  46. package/dist/escapeHtml-CX8RelZ1.mjs +7 -0
  47. package/dist/historyHelpers-B0-4mq1E.mjs +15 -0
  48. package/dist/index-B1_vtXRz.mjs +3910 -0
  49. package/dist/index-C6BoNR2t.js +12 -0
  50. package/dist/{index-BslAFzmv.mjs → index-CavM-mEM.mjs} +6391 -6203
  51. package/dist/index.cjs.js +3 -3
  52. package/dist/{index.es-BYD2KEo6.mjs → index.es-BK-4TPv8.mjs} +1562 -1546
  53. package/dist/index.esm.js +17 -14
  54. package/dist/{jspdf.es.min-BJGtOnRT.mjs → jspdf.es.min-BsnKYYHL.mjs} +4 -3
  55. package/dist/plugin-loader.js +53 -52
  56. package/dist/{purify.es-CKpwg8Tk.mjs → purify.es-DhWKBjsL.mjs} +3 -3
  57. package/dist/webcomponent-core.js +2039 -473
  58. package/dist/webcomponent-core.min.css +1 -1
  59. package/dist/webcomponent-core.min.js +100 -70
  60. package/dist/webcomponent.cjs.js +1 -1
  61. package/dist/webcomponent.esm.js +1 -1
  62. package/dist/webcomponent.js +2208 -641
  63. package/dist/webcomponent.min.css +1 -1
  64. package/dist/webcomponent.min.js +1575 -1209
  65. package/index.d.ts +32 -0
  66. package/package.json +10 -3
  67. package/dist/CodeSamplePlugin.native-CgGoH-X4.mjs +0 -384
  68. package/dist/LinkPlugin.native-DYCIcdTm.mjs +0 -283
  69. package/dist/SpellCheckPlugin.native-BZB9AewP.mjs +0 -1039
  70. package/dist/TablePlugin.native-DrHX-efe.mjs +0 -495
  71. package/dist/anchoredPopover-Bxds0VoB.mjs +0 -110
  72. package/dist/index-B9MPiUAR.mjs +0 -2341
  73. package/dist/index-BLm1MtzH.js +0 -10
@@ -1,4 +1,6 @@
1
- const K = {
1
+ import { e as U } from "./escapeHtml-CX8RelZ1.mjs";
2
+ import { i as W } from "./dialogHelpers-DBf7WqYH.mjs";
3
+ const X = {
2
4
  latex: [
3
5
  { name: "Fraction", formula: "\\frac{a}{b}", description: "Simple fraction" },
4
6
  { name: "Square Root", formula: "\\sqrt{x}", description: "Square root" },
@@ -19,32 +21,123 @@ const K = {
19
21
  { name: "Parentheses", formula: '<mfenced open="(" close=")"><mi>a</mi><mo>+</mo><mi>b</mi></mfenced>', description: "Grouped expression" }
20
22
  ]
21
23
  };
22
- let M = null, v = null, R = !1, y = null, m = null;
23
- const $ = '[data-theme="dark"], .dark, .editora-theme-dark', U = () => new Promise((e, t) => {
24
+ let L = null, v = null, z = !1, y = null, m = null;
25
+ const T = '[data-theme="dark"], .dark, .editora-theme-dark', G = /* @__PURE__ */ new Set([
26
+ "math",
27
+ "mrow",
28
+ "mi",
29
+ "mn",
30
+ "mo",
31
+ "ms",
32
+ "mtext",
33
+ "mspace",
34
+ "msup",
35
+ "msub",
36
+ "msubsup",
37
+ "mfrac",
38
+ "msqrt",
39
+ "mroot",
40
+ "mfenced",
41
+ "mstyle",
42
+ "mpadded",
43
+ "mphantom",
44
+ "menclose",
45
+ "mtable",
46
+ "mtr",
47
+ "mtd",
48
+ "mlabeledtr",
49
+ "munder",
50
+ "mover",
51
+ "munderover",
52
+ "mmultiscripts",
53
+ "mprescripts",
54
+ "none",
55
+ "semantics",
56
+ "annotation"
57
+ ]), Z = /* @__PURE__ */ new Set([
58
+ "display",
59
+ "displaystyle",
60
+ "mathvariant",
61
+ "mathsize",
62
+ "mathcolor",
63
+ "mathbackground",
64
+ "scriptlevel",
65
+ "fence",
66
+ "separator",
67
+ "stretchy",
68
+ "symmetric",
69
+ "lspace",
70
+ "rspace",
71
+ "largeop",
72
+ "movablelimits",
73
+ "accent",
74
+ "accentunder",
75
+ "open",
76
+ "close",
77
+ "separators",
78
+ "linethickness",
79
+ "columnalign",
80
+ "rowalign",
81
+ "columnspacing",
82
+ "rowspacing",
83
+ "columnlines",
84
+ "rowlines",
85
+ "frame",
86
+ "notation",
87
+ "width",
88
+ "height",
89
+ "depth",
90
+ "voffset",
91
+ "minsize",
92
+ "maxsize",
93
+ "form",
94
+ "encoding",
95
+ "xmlns",
96
+ "dir",
97
+ "class",
98
+ "id"
99
+ ]), S = (e) => {
100
+ const t = new DOMParser().parseFromString(`<body>${e}</body>`, "text/html"), r = (i) => {
101
+ Array.from(i.childNodes).forEach((a) => {
102
+ var n;
103
+ if (a.nodeType === Node.ELEMENT_NODE) {
104
+ const c = a;
105
+ if (!G.has(c.localName.toLowerCase())) {
106
+ c.remove();
107
+ return;
108
+ }
109
+ Array.from(c.attributes).forEach((d) => {
110
+ Z.has(d.name.toLowerCase()) || c.removeAttribute(d.name);
111
+ }), r(c);
112
+ } else a.nodeType !== Node.TEXT_NODE && ((n = a.parentNode) == null || n.removeChild(a));
113
+ });
114
+ };
115
+ return r(t.body), t.body.innerHTML;
116
+ }, Q = () => new Promise((e, t) => {
24
117
  if (window.katex) {
25
118
  e(window.katex);
26
119
  return;
27
120
  }
28
- if (R) {
29
- const l = setInterval(() => {
30
- window.katex && (clearInterval(l), e(window.katex));
121
+ if (z) {
122
+ const a = setInterval(() => {
123
+ window.katex && (clearInterval(a), e(window.katex));
31
124
  }, 100);
32
125
  return;
33
126
  }
34
- R = !0;
127
+ z = !0;
35
128
  const r = document.createElement("link");
36
129
  r.rel = "stylesheet", r.href = "https://cdn.jsdelivr.net/npm/katex@0.16.9/dist/katex.min.css", document.head.appendChild(r);
37
- const a = document.createElement("script");
38
- a.src = "https://cdn.jsdelivr.net/npm/katex@0.16.9/dist/katex.min.js", a.onload = () => e(window.katex), a.onerror = t, document.head.appendChild(a);
39
- }), j = () => {
130
+ const i = document.createElement("script");
131
+ i.src = "https://cdn.jsdelivr.net/npm/katex@0.16.9/dist/katex.min.js", i.onload = () => e(window.katex), i.onerror = t, document.head.appendChild(i);
132
+ }), R = () => {
40
133
  const e = window.getSelection();
41
134
  if (!e || e.rangeCount === 0) return null;
42
135
  const t = e.getRangeAt(0).startContainer, r = t.nodeType === Node.ELEMENT_NODE ? t : t.parentElement;
43
136
  return (r == null ? void 0 : r.closest(".rte-content, .editora-content")) || null;
44
- }, W = (e) => e ? e.nodeType === Node.ELEMENT_NODE ? e : e.parentElement : null, _ = (e) => {
45
- const t = W(e);
137
+ }, J = (e) => e ? e.nodeType === Node.ELEMENT_NODE ? e : e.parentElement : null, j = (e) => {
138
+ const t = J(e);
46
139
  return (t == null ? void 0 : t.closest('.rte-content, .editora-content, [contenteditable="true"]')) || null;
47
- }, G = (e, t, r) => {
140
+ }, V = (e, t, r) => {
48
141
  if (t !== r) {
49
142
  if (typeof window.execEditorCommand == "function") {
50
143
  window.execEditorCommand("recordDomTransaction", e, t, r);
@@ -53,42 +146,42 @@ const $ = '[data-theme="dark"], .dark, .editora-theme-dark', U = () => new Promi
53
146
  if (typeof window.executeEditorCommand == "function")
54
147
  try {
55
148
  window.executeEditorCommand("recordDomTransaction", { editor: e, beforeHTML: t, afterHTML: r });
56
- } catch (a) {
149
+ } catch (i) {
57
150
  }
58
151
  }
59
- }, X = (e) => {
152
+ }, Y = (e) => {
60
153
  if (!(e instanceof Element)) return null;
61
154
  const t = e.closest(".math-formula, .math-block");
62
155
  return t instanceof HTMLElement ? t : null;
63
156
  }, h = () => {
64
157
  m && (m.classList.remove("math-object-selected"), m.removeAttribute("data-rte-selected-object"), m = null);
65
- }, Z = (e) => {
158
+ }, ee = (e) => {
66
159
  if (m === e) return;
67
160
  h(), m = e, e.classList.add("math-object-selected"), e.setAttribute("data-rte-selected-object", "true");
68
161
  const t = window.getSelection();
69
162
  if (!t) return;
70
163
  const r = document.createRange();
71
164
  r.selectNode(e), t.removeAllRanges(), t.addRange(r);
72
- }, Q = (e, t) => {
165
+ }, te = (e, t) => {
73
166
  const r = window.getSelection();
74
167
  if (!r) return;
75
- const a = document.createRange();
76
- t && t.parentNode === e ? a.setStartBefore(t) : (a.selectNodeContents(e), a.collapse(!1)), a.collapse(!0), r.removeAllRanges(), r.addRange(a);
77
- }, J = (e) => {
168
+ const i = document.createRange();
169
+ t && t.parentNode === e ? i.setStartBefore(t) : (i.selectNodeContents(e), i.collapse(!1)), i.collapse(!0), r.removeAllRanges(), r.addRange(i);
170
+ }, ne = (e) => {
78
171
  if (e.childNodes.length > 0) return;
79
172
  const t = document.createElement("p");
80
173
  t.appendChild(document.createElement("br")), e.appendChild(t);
81
- }, V = () => {
174
+ }, oe = () => {
82
175
  if (!m || !m.isConnected)
83
176
  return h(), !1;
84
- const e = m, t = _(e);
177
+ const e = m, t = j(e);
85
178
  if (!t)
86
179
  return h(), !1;
87
- const r = t.innerHTML, a = e.nextSibling;
88
- e.remove(), J(t), h(), Q(t, a);
89
- const l = t.innerHTML;
90
- return G(t, r, l), t.dispatchEvent(new window.Event("input", { bubbles: !0 })), r !== l;
91
- }, Y = () => {
180
+ const r = t.innerHTML, i = e.nextSibling;
181
+ e.remove(), ne(t), h(), te(t, i);
182
+ const a = t.innerHTML;
183
+ return V(t, r, a), t.dispatchEvent(new window.Event("input", { bubbles: !0 })), r !== a;
184
+ }, re = () => {
92
185
  if (document.getElementById("math-object-selection-styles")) return;
93
186
  const e = document.createElement("style");
94
187
  e.id = "math-object-selection-styles", e.textContent = `
@@ -98,45 +191,46 @@ const $ = '[data-theme="dark"], .dark, .editora-theme-dark', U = () => new Promi
98
191
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.18);
99
192
  }
100
193
  `, document.head.appendChild(e);
101
- }, ee = () => {
102
- typeof window == "undefined" || window.__mathPluginObjectSelectionInitialized || (window.__mathPluginObjectSelectionInitialized = !0, Y(), document.addEventListener("pointerdown", (e) => {
103
- var r, a;
104
- const t = X(e.target);
194
+ }, ae = () => {
195
+ typeof window == "undefined" || window.__mathPluginObjectSelectionInitialized || (window.__mathPluginObjectSelectionInitialized = !0, re(), document.addEventListener("pointerdown", (e) => {
196
+ var r, i;
197
+ const t = Y(e.target);
105
198
  if (!t) {
106
- const l = e.target;
107
- (r = l == null ? void 0 : l.closest) != null && r.call(l, ".math-dialog-overlay") || h();
199
+ const a = e.target;
200
+ (r = a == null ? void 0 : a.closest) != null && r.call(a, ".math-dialog-overlay") || h();
108
201
  return;
109
202
  }
110
- e.preventDefault(), (a = _(t)) == null || a.focus(), Z(t);
203
+ e.preventDefault(), (i = j(t)) == null || i.focus(), ee(t);
111
204
  }, !0), document.addEventListener("keydown", (e) => {
112
205
  if (m) {
113
206
  if (e.key === "Escape") {
114
207
  h();
115
208
  return;
116
209
  }
117
- e.key !== "Backspace" && e.key !== "Delete" || (e.preventDefault(), e.stopPropagation(), V());
210
+ e.key !== "Backspace" && e.key !== "Delete" || (e.preventDefault(), e.stopPropagation(), oe());
118
211
  }
119
212
  }, !0));
120
- }, te = (e) => {
121
- const t = e || j();
122
- if (t != null && t.closest($)) return !0;
213
+ }, ie = (e) => {
214
+ const t = e || R();
215
+ if (t != null && t.closest(T)) return !0;
123
216
  const r = window.getSelection();
124
217
  if (r && r.rangeCount > 0) {
125
- const l = r.getRangeAt(0).startContainer, n = l.nodeType === Node.ELEMENT_NODE ? l : l.parentElement;
126
- if (n != null && n.closest($)) return !0;
218
+ const a = r.getRangeAt(0).startContainer, n = a.nodeType === Node.ELEMENT_NODE ? a : a.parentElement;
219
+ if (n != null && n.closest(T)) return !0;
127
220
  }
128
- const a = document.activeElement;
129
- return a != null && a.closest($) ? !0 : document.body.matches($) || document.documentElement.matches($);
130
- }, z = async (e, t) => {
131
- const r = t || (v == null ? void 0 : v.closest(".rte-content, .editora-content")) || j() || y;
221
+ const i = document.activeElement;
222
+ return i != null && i.closest(T) ? !0 : document.body.matches(T) || document.documentElement.matches(T);
223
+ }, I = async (e, t) => {
224
+ document.querySelectorAll(".math-dialog-overlay").forEach((o) => o.remove());
225
+ const r = t || (v == null ? void 0 : v.closest(".rte-content, .editora-content")) || R() || y;
132
226
  y = r || null;
133
- const a = window.getSelection();
134
- if (a && a.rangeCount > 0) {
135
- const o = a.getRangeAt(0);
136
- M = r && r.contains(o.commonAncestorContainer) ? o.cloneRange() : null;
227
+ const i = window.getSelection();
228
+ if (i && i.rangeCount > 0) {
229
+ const o = i.getRangeAt(0);
230
+ L = r && r.contains(o.commonAncestorContainer) ? o.cloneRange() : null;
137
231
  }
138
- await U();
139
- const l = te(r), n = l ? {
232
+ await Q();
233
+ const a = ie(r), n = a ? {
140
234
  overlay: "rgba(0, 0, 0, 0.62)",
141
235
  dialogBg: "#1f2937",
142
236
  border: "#3b4657",
@@ -178,12 +272,14 @@ const $ = '[data-theme="dark"], .dark, .editora-theme-dark', U = () => new Promi
178
272
  insertBg: "#007bff",
179
273
  insertHover: "#0069d9",
180
274
  invalid: "#cc0000"
181
- }, d = document.createElement("div");
182
- d.className = "math-dialog-overlay", d.style.cssText = `position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: ${n.overlay}; display: flex; align-items: center; justify-content: center; z-index: 99999;`;
183
- const c = document.createElement("div");
184
- c.style.cssText = `background: ${n.dialogBg}; border: 1px solid ${n.border}; border-radius: 8px; width: 90%; max-width: 600px; max-height: 90vh; overflow: hidden; display: flex; flex-direction: column; box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2); color: ${n.text};`;
185
- let u = (e == null ? void 0 : e.format) || "latex", S = (e == null ? void 0 : e.formula) || "", I = (e == null ? void 0 : e.inline) !== !1, g = null, L = "";
186
- c.innerHTML = `
275
+ }, c = document.createElement("div");
276
+ W(c), c.className = "math-dialog-overlay", c.style.cssText = `position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: ${n.overlay}; display: flex; align-items: center; justify-content: center; z-index: 99999;`;
277
+ const d = document.createElement("div");
278
+ d.style.cssText = `background: ${n.dialogBg}; border: 1px solid ${n.border}; border-radius: 8px; width: 90%; max-width: 600px; max-height: 90vh; overflow: hidden; display: flex; flex-direction: column; box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2); color: ${n.text};`;
279
+ let u = (e == null ? void 0 : e.format) || "latex", B = (e == null ? void 0 : e.formula) || "";
280
+ const q = (e == null ? void 0 : e.inline) !== !1;
281
+ let g = null, C = "";
282
+ d.innerHTML = `
187
283
  <div style="display: flex; justify-content: space-between; align-items: center; padding: 16px 20px; border-bottom: 1px solid ${n.border}; background: ${n.panelBg};">
188
284
  <h2 style="margin: 0; font-size: 18px; font-weight: 600; color: ${n.text};">${e ? "Edit" : "Insert"} Math Formula</h2>
189
285
  <button class="close-btn" style="background: none; border: none; font-size: 28px; cursor: pointer; color: ${n.muted}; padding: 0; width: 30px; height: 30px; line-height: 1;">×</button>
@@ -204,12 +300,12 @@ const $ = '[data-theme="dark"], .dark, .editora-theme-dark', U = () => new Promi
204
300
  </div>
205
301
 
206
302
  <div style="margin-bottom: 20px;">
207
- <label style="cursor: pointer; color: ${n.text};"><input type="checkbox" id="inline-cb" ${I ? "checked" : ""} style="margin-right: 8px;"> Inline math</label>
303
+ <label style="cursor: pointer; color: ${n.text};"><input type="checkbox" id="inline-cb" ${q ? "checked" : ""} style="margin-right: 8px;"> Inline math</label>
208
304
  </div>
209
305
 
210
306
  <div style="margin-bottom: 20px;">
211
307
  <label style="display: block; font-weight: 600; margin-bottom: 8px; font-size: 14px; color: ${n.text};">Formula:</label>
212
- <textarea id="formula-input" rows="4" style="width: 100%; min-height: 112px; padding: 10px 12px; border: 1px solid ${n.fieldBorder}; border-radius: 6px; font-family: 'Courier New', monospace; font-size: 14px; line-height: 1.45; background: ${n.fieldBg}; color: ${n.text}; box-sizing: border-box; overflow-x: hidden; overflow-y: auto; resize: vertical;">${S}</textarea>
308
+ <textarea id="formula-input" rows="4" style="width: 100%; min-height: 112px; padding: 10px 12px; border: 1px solid ${n.fieldBorder}; border-radius: 6px; font-family: 'Courier New', monospace; font-size: 14px; line-height: 1.45; background: ${n.fieldBg}; color: ${n.text}; box-sizing: border-box; overflow-x: hidden; overflow-y: auto; resize: vertical;">${U(B)}</textarea>
213
309
  </div>
214
310
 
215
311
  <div style="margin-bottom: 20px;">
@@ -222,130 +318,130 @@ const $ = '[data-theme="dark"], .dark, .editora-theme-dark', U = () => new Promi
222
318
  <button class="cancel-btn" style="padding: 10px 20px; background: ${n.cancelBg}; color: ${n.cancelText}; border: 1px solid ${n.cancelBorder}; border-radius: 4px; cursor: pointer; font-size: 14px;">Cancel</button>
223
319
  <button id="insert-btn" style="padding: 10px 20px; background: ${n.insertBg}; color: white; border: none; border-radius: 4px; cursor: pointer; font-size: 14px;" disabled>${e ? "Update" : "Insert"}</button>
224
320
  </div>
225
- `, d.appendChild(c), document.body.appendChild(d);
226
- const p = c.querySelector("#formula-input"), w = c.querySelector("#preview-area"), T = c.querySelector("#templates-grid"), P = c.querySelectorAll('input[name="format"]'), q = c.querySelector("#inline-cb"), f = c.querySelector("#insert-btn"), b = c.querySelector(".close-btn"), E = c.querySelector(".cancel-btn"), F = (o) => encodeURIComponent(o), D = (o) => {
321
+ `, c.appendChild(d), document.body.appendChild(c);
322
+ const p = d.querySelector("#formula-input"), w = d.querySelector("#preview-area"), M = d.querySelector("#templates-grid"), P = d.querySelectorAll('input[name="format"]'), F = d.querySelector("#inline-cb"), f = d.querySelector("#insert-btn"), b = d.querySelector(".close-btn"), E = d.querySelector(".cancel-btn"), D = (o) => encodeURIComponent(o), O = (o) => {
227
323
  try {
228
324
  return decodeURIComponent(o);
229
325
  } catch (s) {
230
326
  return o;
231
327
  }
232
- }, A = () => {
233
- const o = K[u];
234
- T.innerHTML = o.map((s) => `
235
- <button type="button" data-formula="${F(s.formula)}" title="${s.description}" style="padding: 8px; border: 1px solid ${n.fieldBorder}; border-radius: 4px; background: ${n.templateBtnBg}; cursor: pointer; text-align: left; transition: background-color 0.16s ease;">
328
+ }, N = () => {
329
+ const o = X[u];
330
+ M.innerHTML = o.map((s) => `
331
+ <button type="button" data-formula="${D(s.formula)}" title="${s.description}" style="padding: 8px; border: 1px solid ${n.fieldBorder}; border-radius: 4px; background: ${n.templateBtnBg}; cursor: pointer; text-align: left; transition: background-color 0.16s ease;">
236
332
  <div style="font-weight: 600; font-size: 12px; color: ${n.templateBtnText};">${s.name}</div>
237
333
  <div style="font-size: 10px; color: ${n.templateSubText}; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;">${s.formula.substring(0, 20)}...</div>
238
334
  </button>
239
335
  `).join("");
240
- }, O = () => {
336
+ }, K = () => {
241
337
  const o = p.value.trim(), s = `${u}:${o}`;
242
- if (s !== L) {
243
- if (L = s, !o) {
338
+ if (s !== C) {
339
+ if (C = s, !o) {
244
340
  w.innerHTML = `<span style="color: ${n.previewText};">Enter a formula to see preview</span>`, f.disabled = !0;
245
341
  return;
246
342
  }
247
343
  f.disabled = !1;
248
344
  try {
249
345
  if (u === "latex") {
250
- const i = window.katex;
251
- w.innerHTML = i.renderToString(o, { displayMode: !1, throwOnError: !1 });
346
+ const l = window.katex;
347
+ w.innerHTML = l.renderToString(o, { displayMode: !1, throwOnError: !1 });
252
348
  } else
253
- o.trim().startsWith("<math") ? w.innerHTML = o : w.innerHTML = `<math xmlns="http://www.w3.org/1998/Math/MathML" display="inline">${o}</math>`;
254
- } catch (i) {
349
+ o.trim().startsWith("<math") ? w.innerHTML = S(o) : w.innerHTML = S(`<math xmlns="http://www.w3.org/1998/Math/MathML" display="inline">${o}</math>`);
350
+ } catch (l) {
255
351
  w.innerHTML = `<span style="color: ${n.invalid};">Invalid formula</span>`;
256
352
  }
257
353
  }
258
- }, B = () => {
354
+ }, $ = () => {
259
355
  g !== null && cancelAnimationFrame(g), g = requestAnimationFrame(() => {
260
- g = null, O();
356
+ g = null, K();
261
357
  });
262
358
  }, H = (o) => {
263
359
  o.key === "Escape" && (o.preventDefault(), o.stopPropagation(), k());
264
360
  }, k = () => {
265
- document.removeEventListener("keydown", H, !0), g !== null && (cancelAnimationFrame(g), g = null), d.parentNode && d.parentNode.removeChild(d);
361
+ document.removeEventListener("keydown", H, !0), g !== null && (cancelAnimationFrame(g), g = null), c.parentNode && c.parentNode.removeChild(c);
266
362
  };
267
363
  b.onmouseover = () => {
268
- b.style.color = "#f8fafc", b.style.background = l ? "#334155" : "#e5e7eb", b.style.borderRadius = "4px";
364
+ b.style.color = "#f8fafc", b.style.background = a ? "#334155" : "#e5e7eb", b.style.borderRadius = "4px";
269
365
  }, b.onmouseout = () => {
270
366
  b.style.color = n.muted, b.style.background = "none";
271
367
  }, E.onmouseover = () => {
272
- E.style.background = l ? "#475569" : "#f3f4f6";
368
+ E.style.background = a ? "#475569" : "#f3f4f6";
273
369
  }, E.onmouseout = () => {
274
370
  E.style.background = n.cancelBg;
275
371
  }, f.onmouseover = () => {
276
372
  f.disabled || (f.style.background = n.insertHover);
277
373
  }, f.onmouseout = () => {
278
374
  f.style.background = n.insertBg;
279
- }, T.addEventListener("mouseover", (o) => {
280
- const i = o.target.closest("button[data-formula]");
281
- i && (i.style.background = n.templateBtnHover);
282
- }), T.addEventListener("mouseout", (o) => {
283
- const i = o.target.closest("button[data-formula]");
284
- i && (i.style.background = n.templateBtnBg);
285
- }), T.addEventListener("click", (o) => {
286
- const i = o.target.closest("button[data-formula]");
287
- i && (p.value = D(i.getAttribute("data-formula") || ""), S = p.value, B());
375
+ }, M.addEventListener("mouseover", (o) => {
376
+ const l = o.target.closest("button[data-formula]");
377
+ l && (l.style.background = n.templateBtnHover);
378
+ }), M.addEventListener("mouseout", (o) => {
379
+ const l = o.target.closest("button[data-formula]");
380
+ l && (l.style.background = n.templateBtnBg);
381
+ }), M.addEventListener("click", (o) => {
382
+ const l = o.target.closest("button[data-formula]");
383
+ l && (p.value = O(l.getAttribute("data-formula") || ""), B = p.value, $());
288
384
  });
289
- const N = () => {
385
+ const _ = () => {
290
386
  const o = p.value.trim();
291
387
  if (!o) return;
292
- const s = { formula: o, format: u, inline: q.checked }, i = s.inline ? document.createElement("span") : document.createElement("div");
293
- if (i.className = s.inline ? "math-formula" : "math-block", i.setAttribute("data-math-formula", o), i.setAttribute("data-math-format", u), i.contentEditable = "false", i.style.cssText = s.inline ? "background: #f0f8ff; border: 1px solid #b8daff; border-radius: 4px; padding: 2px 6px; margin: 0 2px; color: #004085; display: inline-block; cursor: pointer;" : "background: #f8f9fa; border: 1px solid #dee2e6; border-radius: 4px; padding: 12px; margin: 8px 0; text-align: center; display: block; cursor: pointer;", u === "latex") {
388
+ const s = { formula: o, format: u, inline: F.checked }, l = s.inline ? document.createElement("span") : document.createElement("div");
389
+ if (l.className = s.inline ? "math-formula" : "math-block", l.setAttribute("data-math-formula", o), l.setAttribute("data-math-format", u), l.contentEditable = "false", l.style.cssText = s.inline ? "background: #f0f8ff; border: 1px solid #b8daff; border-radius: 4px; padding: 2px 6px; margin: 0 2px; color: #004085; display: inline-block; cursor: pointer;" : "background: #f8f9fa; border: 1px solid #dee2e6; border-radius: 4px; padding: 12px; margin: 8px 0; text-align: center; display: block; cursor: pointer;", u === "latex") {
294
390
  const x = window.katex;
295
391
  try {
296
- i.innerHTML = x.renderToString(o, {
392
+ l.innerHTML = x.renderToString(o, {
297
393
  displayMode: !s.inline,
298
394
  throwOnError: !1
299
395
  });
300
- } catch (ne) {
301
- i.textContent = s.inline ? `$${o}$` : `$$${o}$$`;
396
+ } catch (le) {
397
+ l.textContent = s.inline ? `$${o}$` : `$$${o}$$`;
302
398
  }
303
399
  } else if (o.trim().startsWith("<math"))
304
- i.innerHTML = o;
400
+ l.innerHTML = S(o);
305
401
  else {
306
402
  const x = `<math xmlns="http://www.w3.org/1998/Math/MathML" display="${s.inline ? "inline" : "block"}">${o}</math>`;
307
- i.innerHTML = x;
403
+ l.innerHTML = S(x);
308
404
  }
309
405
  if (v)
310
- v.replaceWith(i);
311
- else if (M)
312
- M.deleteContents(), M.insertNode(i);
406
+ v.replaceWith(l);
407
+ else if (L)
408
+ L.deleteContents(), L.insertNode(l);
313
409
  else if (y && y.isConnected) {
314
410
  const x = document.createRange();
315
- x.selectNodeContents(y), x.collapse(!1), x.insertNode(i);
411
+ x.selectNodeContents(y), x.collapse(!1), x.insertNode(l);
316
412
  }
317
- const C = i.closest(".rte-content, .editora-content") || y;
318
- C == null || C.dispatchEvent(new Event("input", { bubbles: !0 })), k();
413
+ const A = l.closest(".rte-content, .editora-content") || y;
414
+ A == null || A.dispatchEvent(new Event("input", { bubbles: !0 })), k();
319
415
  };
320
- b.addEventListener("click", k), E.addEventListener("click", k), f.addEventListener("click", N), d.addEventListener("click", (o) => {
321
- o.target === d && k();
416
+ b.addEventListener("click", k), E.addEventListener("click", k), f.addEventListener("click", _), c.addEventListener("click", (o) => {
417
+ o.target === c && k();
322
418
  }), document.addEventListener("keydown", H, !0), P.forEach((o) => {
323
419
  o.addEventListener("change", (s) => {
324
- u = s.target.value, L = "", A(), B();
420
+ u = s.target.value, C = "", N(), $();
325
421
  });
326
422
  }), p.addEventListener("input", () => {
327
- S = p.value, B();
423
+ B = p.value, $();
328
424
  }), p.addEventListener("keydown", (o) => {
329
- (o.ctrlKey || o.metaKey) && o.key === "Enter" && (o.preventDefault(), N());
330
- }), A(), B(), p.focus();
425
+ (o.ctrlKey || o.metaKey) && o.key === "Enter" && (o.preventDefault(), _());
426
+ }), N(), $(), p.focus();
331
427
  };
332
428
  if (typeof window != "undefined" && !window.__mathPluginDoubleClickInitialized) {
333
429
  window.__mathPluginDoubleClickInitialized = !0;
334
430
  const e = (r) => {
335
- const l = r.target.closest(".math-formula, .math-block");
336
- if (l) {
337
- r.preventDefault(), r.stopPropagation(), r.stopImmediatePropagation(), h(), v = l;
338
- const n = l.getAttribute("data-math-formula") || "", d = l.getAttribute("data-math-format") || "latex", c = l.classList.contains("math-formula");
339
- z({ formula: n, format: d, inline: c });
431
+ const a = r.target.closest(".math-formula, .math-block");
432
+ if (a) {
433
+ r.preventDefault(), r.stopPropagation(), r.stopImmediatePropagation(), h(), v = a;
434
+ const n = a.getAttribute("data-math-formula") || "", c = a.getAttribute("data-math-format") || "latex", d = a.classList.contains("math-formula");
435
+ I({ formula: n, format: c, inline: d });
340
436
  }
341
437
  }, t = () => {
342
438
  document.addEventListener("dblclick", e, { capture: !0 });
343
439
  };
344
440
  document.readyState === "loading" ? document.addEventListener("DOMContentLoaded", t) : setTimeout(t, 100);
345
441
  }
346
- const oe = () => ({
442
+ const de = () => ({
347
443
  name: "math",
348
- init: ee,
444
+ init: ae,
349
445
  toolbar: [
350
446
  {
351
447
  label: "Insert Math",
@@ -356,7 +452,7 @@ const oe = () => ({
356
452
  commands: {
357
453
  insertMath: (e, t) => {
358
454
  const r = (t == null ? void 0 : t.contentElement) instanceof HTMLElement ? t.contentElement : null;
359
- return z(void 0, r), !0;
455
+ return I(void 0, r), !0;
360
456
  }
361
457
  },
362
458
  keymap: {
@@ -364,6 +460,6 @@ const oe = () => ({
364
460
  }
365
461
  });
366
462
  export {
367
- oe as MathPlugin
463
+ de as MathPlugin
368
464
  };
369
- //# sourceMappingURL=MathPlugin.native-NwWPHVmj.mjs.map
465
+ //# sourceMappingURL=MathPlugin.native-Byo3WL0f.mjs.map