@editora/core 1.0.9 → 1.0.10

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 (99) hide show
  1. package/README.md +1 -1
  2. package/dist/{A11yCheckerPlugin.native-58d12bed.mjs → A11yCheckerPlugin.native-BRdGYMju.mjs} +12 -23
  3. package/dist/{AnchorPlugin.native-289a112a.mjs → AnchorPlugin.native-BcYGEtd9.mjs} +102 -112
  4. package/dist/{ApprovalWorkflowPlugin.native-449ce66c.mjs → ApprovalWorkflowPlugin.native-BZ6jO-Wj.mjs} +173 -209
  5. package/dist/{BackgroundColorPlugin.native-8aceb5cc.mjs → BackgroundColorPlugin.native-50iAT9xU.mjs} +9 -16
  6. package/dist/BlockquotePlugin.native-57_Xcjl1.mjs +212 -0
  7. package/dist/{BlocksLibraryPlugin.native-1cc51e63.mjs → BlocksLibraryPlugin.native-5sdsXsiE.mjs} +149 -205
  8. package/dist/{BoldPlugin.native-f9d7f8e4.mjs → BoldPlugin.native-CSh_LiIJ.mjs} +11 -7
  9. package/dist/CapitalizationPlugin.native-DLV4oPmB.mjs +159 -0
  10. package/dist/ChecklistPlugin.native-BS-kMz9O.mjs +371 -0
  11. package/dist/{CitationsPlugin.native-169fb1e8.mjs → CitationsPlugin.native-DQgoCd1B.mjs} +196 -261
  12. package/dist/ClearFormattingPlugin.native-DIS6AN2t.mjs +172 -0
  13. package/dist/CodePlugin.native-C5l1IeSS.mjs +4570 -0
  14. package/dist/{CodeSamplePlugin.native-6cc0148e.mjs → CodeSamplePlugin.native-CgGoH-X4.mjs} +10 -19
  15. package/dist/{CommentsPlugin.native-03659874.mjs → CommentsPlugin.native-DPSqTkiv.mjs} +28 -55
  16. package/dist/{ConditionalContentPlugin.native-4983143a.mjs → ConditionalContentPlugin.native-CfhY46rU.mjs} +51 -108
  17. package/dist/{ContentRulesPlugin.native-63ed405b.mjs → ContentRulesPlugin.native-vPx5nC73.mjs} +153 -200
  18. package/dist/{DataBindingPlugin.native-427e9d75.mjs → DataBindingPlugin.native-BoXwghTz.mjs} +88 -124
  19. package/dist/DirectionPlugin.native-Bl-QLFzO.mjs +153 -0
  20. package/dist/{DocSchemaPlugin.native-8e41eda0.mjs → DocSchemaPlugin.native-DUSVRHqT.mjs} +112 -166
  21. package/dist/{DocumentManagerPlugin.native-e69895ad.mjs → DocumentManagerPlugin.native-C2cs_1w4.mjs} +4 -4
  22. package/dist/EmbedIframePlugin.native-BF_-LjTq.mjs +740 -0
  23. package/dist/{EmojisPlugin.native-65c5ac47.mjs → EmojisPlugin.native-CitxxlWX.mjs} +6 -11
  24. package/dist/{FontFamilyPlugin.native-f9bc255a.mjs → FontFamilyPlugin.native-j8hMTbg4.mjs} +4 -7
  25. package/dist/{FontSizePlugin.native-f5647872.mjs → FontSizePlugin.native-B_jCh7dY.mjs} +10 -19
  26. package/dist/{FootnotePlugin.native-494657b3.mjs → FootnotePlugin.native-D730OGRm.mjs} +39 -77
  27. package/dist/{FullscreenPlugin.native-87ce92e9.mjs → FullscreenPlugin.native-ChXyxeNw.mjs} +1 -1
  28. package/dist/HeadingPlugin.native-DZdvubrQ.mjs +249 -0
  29. package/dist/{HistoryPlugin.native-92ed4be4.mjs → HistoryPlugin.native-D2wl32jV.mjs} +107 -143
  30. package/dist/{IndentPlugin.native-e4ee902b.mjs → IndentPlugin.native-BHixp8sP.mjs} +12 -23
  31. package/dist/{ItalicPlugin.native-7c95cfbc.mjs → ItalicPlugin.native-CmnlwFHB.mjs} +15 -11
  32. package/dist/{LineHeightPlugin.native-5668f78c.mjs → LineHeightPlugin.native-CM7iXdQj.mjs} +10 -19
  33. package/dist/{LinkPlugin.native-6df29111.mjs → LinkPlugin.native-DYCIcdTm.mjs} +5 -9
  34. package/dist/{ListPlugin.native-fe2e115a.mjs → ListPlugin.native-V7EZC1lM.mjs} +5 -9
  35. package/dist/MathPlugin.native-NwWPHVmj.mjs +369 -0
  36. package/dist/{MediaManagerPlugin.native-3cf48a00.mjs → MediaManagerPlugin.native-eOsTJFpw.mjs} +11 -21
  37. package/dist/{MentionPlugin.native-3b1e8c05.mjs → MentionPlugin.native-BMDlOqur.mjs} +45 -89
  38. package/dist/MergeTagPlugin.native-BzRVoD9-.mjs +580 -0
  39. package/dist/{PIIRedactionPlugin.native-7ab10b9f.mjs → PIIRedactionPlugin.native-g7j4jOmm.mjs} +210 -260
  40. package/dist/{PageBreakPlugin.native-1794c5fb.mjs → PageBreakPlugin.native-DijGuHJZ.mjs} +16 -31
  41. package/dist/{PreviewPlugin.native-f7b67cc0.mjs → PreviewPlugin.native-WuIwOAOR.mjs} +6 -11
  42. package/dist/{PrintPlugin.native-f6a168c2.mjs → PrintPlugin.native-7qt5v7L5.mjs} +3 -5
  43. package/dist/{SlashCommandsPlugin.native-8d45e511.mjs → SlashCommandsPlugin.native-BiN6ODw5.mjs} +36 -71
  44. package/dist/{SmartPastePlugin.native-a6c5efec.mjs → SmartPastePlugin.native-CZAEHkyt.mjs} +173 -219
  45. package/dist/{SpecialCharactersPlugin.native-7f06d4ba.mjs → SpecialCharactersPlugin.native-DaG4b19I.mjs} +101 -85
  46. package/dist/{SpellCheckPlugin.native-04e20834.mjs → SpellCheckPlugin.native-BZB9AewP.mjs} +21 -41
  47. package/dist/{StrikethroughPlugin.native-905e9501.mjs → StrikethroughPlugin.native-V0TL4F48.mjs} +12 -30
  48. package/dist/{TablePlugin.native-7d5458c1.mjs → TablePlugin.native-DrHX-efe.mjs} +30 -58
  49. package/dist/TemplatePlugin.native-DLjFUaPW.mjs +1150 -0
  50. package/dist/{TextAlignmentPlugin.native-9357b3ed.mjs → TextAlignmentPlugin.native-sM_1s00t.mjs} +6 -11
  51. package/dist/{TextColorPlugin.native-d53ed459.mjs → TextColorPlugin.native-Bwl_bSmc.mjs} +14 -26
  52. package/dist/{TrackChangesPlugin.native-e96da509.mjs → TrackChangesPlugin.native-Bghu2q4a.mjs} +58 -115
  53. package/dist/{TranslationWorkflowPlugin.native-4e711b1e.mjs → TranslationWorkflowPlugin.native-DdF16tgT.mjs} +191 -257
  54. package/dist/{UnderlinePlugin.native-8080c998.mjs → UnderlinePlugin.native-DZzg23rv.mjs} +8 -4
  55. package/dist/{VersionDiffPlugin.native-5bbeff85.mjs → VersionDiffPlugin.native-Bvxgy--t.mjs} +26 -51
  56. package/dist/_commonjsHelpers-DOllISpa.mjs +32 -0
  57. package/dist/{anchoredPopover-5cca53ba.mjs → anchoredPopover-Bxds0VoB.mjs} +1 -1
  58. package/dist/core.css +1 -0
  59. package/dist/documentManager-vQ1VkbUY.mjs +8418 -0
  60. package/dist/{editorContainerHelpers-69585c07.mjs → editorContainerHelpers-C7kdWnS0.mjs} +2 -3
  61. package/dist/editora.min.js +13 -14
  62. package/dist/editora.umd.js +13 -14
  63. package/dist/{html2canvas.esm-c51cb3b9.mjs → html2canvas.esm-AYkPY5LS.mjs} +894 -978
  64. package/dist/index-BslAFzmv.mjs +16544 -0
  65. package/dist/index-CPMGUZfB.js +10 -0
  66. package/dist/{index-7da30697.mjs → index-DBoj6QfW.mjs} +127 -164
  67. package/dist/index.cjs.js +1 -1
  68. package/dist/index.es-BYD2KEo6.mjs +6666 -0
  69. package/dist/index.esm.js +7 -12
  70. package/dist/inlineFormatting-DJ0-NZtx.mjs +97 -0
  71. package/dist/{jspdf.es.min-780c82db.mjs → jspdf.es.min-BJGtOnRT.mjs} +3784 -4808
  72. package/dist/plugin-loader.js +67 -67
  73. package/dist/{purify.es-3bdbcfc5.mjs → purify.es-CKpwg8Tk.mjs} +10 -20
  74. package/dist/webcomponent-core.js +131 -168
  75. package/dist/webcomponent-core.min.css +1 -1
  76. package/dist/webcomponent-core.min.js +139 -63
  77. package/dist/webcomponent.cjs.js +1 -1
  78. package/dist/webcomponent.esm.js +1 -1
  79. package/dist/webcomponent.js +191 -228
  80. package/dist/webcomponent.min.css +1 -1
  81. package/dist/webcomponent.min.js +1240 -1344
  82. package/package.json +1 -1
  83. package/dist/BlockquotePlugin.native-3541c714.mjs +0 -49
  84. package/dist/CapitalizationPlugin.native-42c135dc.mjs +0 -80
  85. package/dist/ChecklistPlugin.native-3b397ee9.mjs +0 -330
  86. package/dist/ClearFormattingPlugin.native-77baa514.mjs +0 -145
  87. package/dist/CodePlugin.native-989cf0aa.mjs +0 -2740
  88. package/dist/DirectionPlugin.native-4e742f42.mjs +0 -139
  89. package/dist/EmbedIframePlugin.native-55209c87.mjs +0 -568
  90. package/dist/HeadingPlugin.native-e38c4a16.mjs +0 -64
  91. package/dist/MathPlugin.native-735bbac2.mjs +0 -296
  92. package/dist/MergeTagPlugin.native-31cf7d48.mjs +0 -584
  93. package/dist/TemplatePlugin.native-580f0f63.mjs +0 -617
  94. package/dist/_commonjsHelpers-69d58be2.mjs +0 -31
  95. package/dist/documentManager-8327fb6e.mjs +0 -9166
  96. package/dist/index-072ef022.js +0 -11
  97. package/dist/index-49d31221.mjs +0 -16860
  98. package/dist/index.es-b47a189f.mjs +0 -5782
  99. package/dist/style.css +0 -1
@@ -0,0 +1,369 @@
1
+ const K = {
2
+ latex: [
3
+ { name: "Fraction", formula: "\\frac{a}{b}", description: "Simple fraction" },
4
+ { name: "Square Root", formula: "\\sqrt{x}", description: "Square root" },
5
+ { name: "Power", formula: "x^{2}", description: "Exponent/power" },
6
+ { name: "Subscript", formula: "x_{sub}", description: "Subscript" },
7
+ { name: "Integral", formula: "\\int_{a}^{b} f(x) \\, dx", description: "Definite integral" },
8
+ { name: "Summation", formula: "\\sum_{i=1}^{n} x_{i}", description: "Summation" },
9
+ { name: "Limit", formula: "\\lim_{x \\to 0} f(x)", description: "Limit" },
10
+ { name: "Derivative", formula: "\\frac{d}{dx} f(x)", description: "Derivative" },
11
+ { name: "Matrix 2x2", formula: "\\begin{pmatrix} a & b \\\\ c & d \\end{pmatrix}", description: "2x2 matrix" },
12
+ { name: "System", formula: "\\begin{cases} x + y = 1 \\\\ 2x - y = 0 \\end{cases}", description: "System of equations" }
13
+ ],
14
+ mathml: [
15
+ { name: "Fraction", formula: "<mfrac><mi>a</mi><mi>b</mi></mfrac>", description: "Simple fraction" },
16
+ { name: "Square Root", formula: "<msqrt><mi>x</mi></msqrt>", description: "Square root" },
17
+ { name: "Power", formula: "<msup><mi>x</mi><mn>2</mn></msup>", description: "Exponent/power" },
18
+ { name: "Subscript", formula: "<msub><mi>x</mi><mi>sub</mi></msub>", description: "Subscript" },
19
+ { name: "Parentheses", formula: '<mfenced open="(" close=")"><mi>a</mi><mo>+</mo><mi>b</mi></mfenced>', description: "Grouped expression" }
20
+ ]
21
+ };
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
+ if (window.katex) {
25
+ e(window.katex);
26
+ return;
27
+ }
28
+ if (R) {
29
+ const l = setInterval(() => {
30
+ window.katex && (clearInterval(l), e(window.katex));
31
+ }, 100);
32
+ return;
33
+ }
34
+ R = !0;
35
+ const r = document.createElement("link");
36
+ 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 = () => {
40
+ const e = window.getSelection();
41
+ if (!e || e.rangeCount === 0) return null;
42
+ const t = e.getRangeAt(0).startContainer, r = t.nodeType === Node.ELEMENT_NODE ? t : t.parentElement;
43
+ 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);
46
+ return (t == null ? void 0 : t.closest('.rte-content, .editora-content, [contenteditable="true"]')) || null;
47
+ }, G = (e, t, r) => {
48
+ if (t !== r) {
49
+ if (typeof window.execEditorCommand == "function") {
50
+ window.execEditorCommand("recordDomTransaction", e, t, r);
51
+ return;
52
+ }
53
+ if (typeof window.executeEditorCommand == "function")
54
+ try {
55
+ window.executeEditorCommand("recordDomTransaction", { editor: e, beforeHTML: t, afterHTML: r });
56
+ } catch (a) {
57
+ }
58
+ }
59
+ }, X = (e) => {
60
+ if (!(e instanceof Element)) return null;
61
+ const t = e.closest(".math-formula, .math-block");
62
+ return t instanceof HTMLElement ? t : null;
63
+ }, h = () => {
64
+ m && (m.classList.remove("math-object-selected"), m.removeAttribute("data-rte-selected-object"), m = null);
65
+ }, Z = (e) => {
66
+ if (m === e) return;
67
+ h(), m = e, e.classList.add("math-object-selected"), e.setAttribute("data-rte-selected-object", "true");
68
+ const t = window.getSelection();
69
+ if (!t) return;
70
+ const r = document.createRange();
71
+ r.selectNode(e), t.removeAllRanges(), t.addRange(r);
72
+ }, Q = (e, t) => {
73
+ const r = window.getSelection();
74
+ 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) => {
78
+ if (e.childNodes.length > 0) return;
79
+ const t = document.createElement("p");
80
+ t.appendChild(document.createElement("br")), e.appendChild(t);
81
+ }, V = () => {
82
+ if (!m || !m.isConnected)
83
+ return h(), !1;
84
+ const e = m, t = _(e);
85
+ if (!t)
86
+ 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 = () => {
92
+ if (document.getElementById("math-object-selection-styles")) return;
93
+ const e = document.createElement("style");
94
+ e.id = "math-object-selection-styles", e.textContent = `
95
+ .math-object-selected {
96
+ outline: 2px solid #2563eb !important;
97
+ outline-offset: 2px;
98
+ box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.18);
99
+ }
100
+ `, 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);
105
+ if (!t) {
106
+ const l = e.target;
107
+ (r = l == null ? void 0 : l.closest) != null && r.call(l, ".math-dialog-overlay") || h();
108
+ return;
109
+ }
110
+ e.preventDefault(), (a = _(t)) == null || a.focus(), Z(t);
111
+ }, !0), document.addEventListener("keydown", (e) => {
112
+ if (m) {
113
+ if (e.key === "Escape") {
114
+ h();
115
+ return;
116
+ }
117
+ e.key !== "Backspace" && e.key !== "Delete" || (e.preventDefault(), e.stopPropagation(), V());
118
+ }
119
+ }, !0));
120
+ }, te = (e) => {
121
+ const t = e || j();
122
+ if (t != null && t.closest($)) return !0;
123
+ const r = window.getSelection();
124
+ 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;
127
+ }
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;
132
+ 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;
137
+ }
138
+ await U();
139
+ const l = te(r), n = l ? {
140
+ overlay: "rgba(0, 0, 0, 0.62)",
141
+ dialogBg: "#1f2937",
142
+ border: "#3b4657",
143
+ panelBg: "#222d3a",
144
+ fieldBg: "#111827",
145
+ fieldBorder: "#4b5563",
146
+ text: "#e2e8f0",
147
+ muted: "#94a3b8",
148
+ templateBtnBg: "#273244",
149
+ templateBtnHover: "#334155",
150
+ templateBtnText: "#dbe7f7",
151
+ templateSubText: "#9fb0c6",
152
+ previewBg: "#111827",
153
+ previewText: "#cbd5e1",
154
+ cancelBg: "#334155",
155
+ cancelText: "#e2e8f0",
156
+ cancelBorder: "#4b5563",
157
+ insertBg: "#3b82f6",
158
+ insertHover: "#2563eb",
159
+ invalid: "#f87171"
160
+ } : {
161
+ overlay: "rgba(0, 0, 0, 0.5)",
162
+ dialogBg: "#ffffff",
163
+ border: "#e1e5e9",
164
+ panelBg: "#f8f9fa",
165
+ fieldBg: "#ffffff",
166
+ fieldBorder: "#ced4da",
167
+ text: "#1f2937",
168
+ muted: "#6c757d",
169
+ templateBtnBg: "#ffffff",
170
+ templateBtnHover: "#f8f9fa",
171
+ templateBtnText: "#1f2937",
172
+ templateSubText: "#6c757d",
173
+ previewBg: "#f8f9fa",
174
+ previewText: "#6c757d",
175
+ cancelBg: "#ffffff",
176
+ cancelText: "#1f2937",
177
+ cancelBorder: "#ced4da",
178
+ insertBg: "#007bff",
179
+ insertHover: "#0069d9",
180
+ 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 = `
187
+ <div style="display: flex; justify-content: space-between; align-items: center; padding: 16px 20px; border-bottom: 1px solid ${n.border}; background: ${n.panelBg};">
188
+ <h2 style="margin: 0; font-size: 18px; font-weight: 600; color: ${n.text};">${e ? "Edit" : "Insert"} Math Formula</h2>
189
+ <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>
190
+ </div>
191
+
192
+ <div style="padding: 20px; overflow-y: auto; flex: 1;">
193
+ <div style="margin-bottom: 20px;">
194
+ <label style="display: block; font-weight: 600; margin-bottom: 8px; font-size: 14px; color: ${n.text};">Format:</label>
195
+ <div style="display: flex; gap: 16px;">
196
+ <label style="cursor: pointer; color: ${n.text};"><input type="radio" name="format" value="latex" ${u === "latex" ? "checked" : ""} style="margin-right: 6px;"> LaTeX</label>
197
+ <label style="cursor: pointer; color: ${n.text};"><input type="radio" name="format" value="mathml" ${u === "mathml" ? "checked" : ""} style="margin-right: 6px;"> MathML</label>
198
+ </div>
199
+ </div>
200
+
201
+ <div style="margin-bottom: 20px;">
202
+ <label style="display: block; font-weight: 600; margin-bottom: 8px; font-size: 14px; color: ${n.text};">Quick Templates:</label>
203
+ <div id="templates-grid" style="display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; max-height: 200px; overflow-y: auto;"></div>
204
+ </div>
205
+
206
+ <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>
208
+ </div>
209
+
210
+ <div style="margin-bottom: 20px;">
211
+ <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>
213
+ </div>
214
+
215
+ <div style="margin-bottom: 20px;">
216
+ <label style="display: block; font-weight: 600; margin-bottom: 8px; font-size: 14px; color: ${n.text};">Preview:</label>
217
+ <div id="preview-area" style="min-height: 60px; padding: 15px; border: 1px solid ${n.fieldBorder}; border-radius: 4px; background: ${n.previewBg}; display: flex; align-items: center; justify-content: center; color: ${n.previewText};"></div>
218
+ </div>
219
+ </div>
220
+
221
+ <div style="display: flex; justify-content: flex-end; gap: 10px; padding: 16px 20px; border-top: 1px solid ${n.border}; background: ${n.panelBg};">
222
+ <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
+ <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
+ </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) => {
227
+ try {
228
+ return decodeURIComponent(o);
229
+ } catch (s) {
230
+ return o;
231
+ }
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;">
236
+ <div style="font-weight: 600; font-size: 12px; color: ${n.templateBtnText};">${s.name}</div>
237
+ <div style="font-size: 10px; color: ${n.templateSubText}; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;">${s.formula.substring(0, 20)}...</div>
238
+ </button>
239
+ `).join("");
240
+ }, O = () => {
241
+ const o = p.value.trim(), s = `${u}:${o}`;
242
+ if (s !== L) {
243
+ if (L = s, !o) {
244
+ w.innerHTML = `<span style="color: ${n.previewText};">Enter a formula to see preview</span>`, f.disabled = !0;
245
+ return;
246
+ }
247
+ f.disabled = !1;
248
+ try {
249
+ if (u === "latex") {
250
+ const i = window.katex;
251
+ w.innerHTML = i.renderToString(o, { displayMode: !1, throwOnError: !1 });
252
+ } 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) {
255
+ w.innerHTML = `<span style="color: ${n.invalid};">Invalid formula</span>`;
256
+ }
257
+ }
258
+ }, B = () => {
259
+ g !== null && cancelAnimationFrame(g), g = requestAnimationFrame(() => {
260
+ g = null, O();
261
+ });
262
+ }, H = (o) => {
263
+ o.key === "Escape" && (o.preventDefault(), o.stopPropagation(), k());
264
+ }, k = () => {
265
+ document.removeEventListener("keydown", H, !0), g !== null && (cancelAnimationFrame(g), g = null), d.parentNode && d.parentNode.removeChild(d);
266
+ };
267
+ b.onmouseover = () => {
268
+ b.style.color = "#f8fafc", b.style.background = l ? "#334155" : "#e5e7eb", b.style.borderRadius = "4px";
269
+ }, b.onmouseout = () => {
270
+ b.style.color = n.muted, b.style.background = "none";
271
+ }, E.onmouseover = () => {
272
+ E.style.background = l ? "#475569" : "#f3f4f6";
273
+ }, E.onmouseout = () => {
274
+ E.style.background = n.cancelBg;
275
+ }, f.onmouseover = () => {
276
+ f.disabled || (f.style.background = n.insertHover);
277
+ }, f.onmouseout = () => {
278
+ 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());
288
+ });
289
+ const N = () => {
290
+ const o = p.value.trim();
291
+ 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") {
294
+ const x = window.katex;
295
+ try {
296
+ i.innerHTML = x.renderToString(o, {
297
+ displayMode: !s.inline,
298
+ throwOnError: !1
299
+ });
300
+ } catch (ne) {
301
+ i.textContent = s.inline ? `$${o}$` : `$$${o}$$`;
302
+ }
303
+ } else if (o.trim().startsWith("<math"))
304
+ i.innerHTML = o;
305
+ else {
306
+ const x = `<math xmlns="http://www.w3.org/1998/Math/MathML" display="${s.inline ? "inline" : "block"}">${o}</math>`;
307
+ i.innerHTML = x;
308
+ }
309
+ if (v)
310
+ v.replaceWith(i);
311
+ else if (M)
312
+ M.deleteContents(), M.insertNode(i);
313
+ else if (y && y.isConnected) {
314
+ const x = document.createRange();
315
+ x.selectNodeContents(y), x.collapse(!1), x.insertNode(i);
316
+ }
317
+ const C = i.closest(".rte-content, .editora-content") || y;
318
+ C == null || C.dispatchEvent(new Event("input", { bubbles: !0 })), k();
319
+ };
320
+ b.addEventListener("click", k), E.addEventListener("click", k), f.addEventListener("click", N), d.addEventListener("click", (o) => {
321
+ o.target === d && k();
322
+ }), document.addEventListener("keydown", H, !0), P.forEach((o) => {
323
+ o.addEventListener("change", (s) => {
324
+ u = s.target.value, L = "", A(), B();
325
+ });
326
+ }), p.addEventListener("input", () => {
327
+ S = p.value, B();
328
+ }), p.addEventListener("keydown", (o) => {
329
+ (o.ctrlKey || o.metaKey) && o.key === "Enter" && (o.preventDefault(), N());
330
+ }), A(), B(), p.focus();
331
+ };
332
+ if (typeof window != "undefined" && !window.__mathPluginDoubleClickInitialized) {
333
+ window.__mathPluginDoubleClickInitialized = !0;
334
+ 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 });
340
+ }
341
+ }, t = () => {
342
+ document.addEventListener("dblclick", e, { capture: !0 });
343
+ };
344
+ document.readyState === "loading" ? document.addEventListener("DOMContentLoaded", t) : setTimeout(t, 100);
345
+ }
346
+ const oe = () => ({
347
+ name: "math",
348
+ init: ee,
349
+ toolbar: [
350
+ {
351
+ label: "Insert Math",
352
+ command: "insertMath",
353
+ icon: '<svg width="24" height="24" focusable="false"><path fill-rule="evenodd" clip-rule="evenodd" d="M9 4.8c.1-.5.5-.8 1-.8h10a1 1 0 1 1 0 2h-9.2L8.3 19.2a1 1 0 0 1-1.7.4l-3.4-4.2a1 1 0 0 1 1.6-1.2l2 2.5L9 4.8Zm9.7 5.5c.4.4.4 1 0 1.4L17 13.5l1.8 1.8a1 1 0 0 1-1.4 1.4L15.5 15l-1.8 1.8a1 1 0 0 1-1.4-1.4l1.8-1.8-1.8-1.8a1 1 0 0 1 1.4-1.4l1.8 1.8 1.8-1.8a1 1 0 0 1 1.4 0Z"></path></svg>'
354
+ }
355
+ ],
356
+ commands: {
357
+ insertMath: (e, t) => {
358
+ const r = (t == null ? void 0 : t.contentElement) instanceof HTMLElement ? t.contentElement : null;
359
+ return z(void 0, r), !0;
360
+ }
361
+ },
362
+ keymap: {
363
+ "Mod-Shift-m": "insertMath"
364
+ }
365
+ });
366
+ export {
367
+ oe as MathPlugin
368
+ };
369
+ //# sourceMappingURL=MathPlugin.native-NwWPHVmj.mjs.map
@@ -7,8 +7,7 @@ const F = '[data-theme="dark"], .dark, .editora-theme-dark', I = (t, e) => {
7
7
  document.removeEventListener("keydown", r, !0);
8
8
  };
9
9
  }, X = () => {
10
- if (typeof document == "undefined" || document.getElementById("rte-media-dialog-styles"))
11
- return;
10
+ if (typeof document == "undefined" || document.getElementById("rte-media-dialog-styles")) return;
12
11
  const t = document.createElement("style");
13
12
  t.id = "rte-media-dialog-styles", t.textContent = `
14
13
  .rte-media-overlay {
@@ -439,18 +438,14 @@ const F = '[data-theme="dark"], .dark, .editora-theme-dark', I = (t, e) => {
439
438
  `, document.head.appendChild(t);
440
439
  }, Y = () => {
441
440
  const t = window.getSelection();
442
- if (!t || t.rangeCount === 0)
443
- return null;
441
+ if (!t || t.rangeCount === 0) return null;
444
442
  const e = t.anchorNode, r = e instanceof HTMLElement ? e : e == null ? void 0 : e.parentElement;
445
443
  return (r == null ? void 0 : r.closest(".rte-content, .editora-content")) || null;
446
444
  }, Z = (t) => {
447
- if (t)
448
- return t;
445
+ if (t) return t;
449
446
  const e = Y();
450
- if (e)
451
- return e;
452
- if (R)
453
- return R;
447
+ if (e) return e;
448
+ if (R) return R;
454
449
  const r = document.activeElement;
455
450
  return r ? r.closest(".rte-content, .editora-content") || r : null;
456
451
  }, G = (t) => {
@@ -545,8 +540,7 @@ const F = '[data-theme="dark"], .dark, .editora-theme-dark', I = (t, e) => {
545
540
  };
546
541
  w = I(a, f);
547
542
  const y = () => {
548
- if (!d)
549
- return;
543
+ if (!d) return;
550
544
  const i = t === "image" ? document.createElement("img") : document.createElement("video");
551
545
  i.src = d, i.setAttribute("data-media-type", t), t === "image" && g && (i.alt = g), p && (i.style.width = `${p}px`, i.setAttribute("width", p)), c && (i.style.height = `${c}px`, i.setAttribute("height", c)), t === "video" && (i.controls = !0), !p && !c ? i.style.cssText = "max-width: 100%; height: auto; display: block; margin: 1em 0; cursor: pointer;" : i.style.cssText = `display: block; margin: 1em 0; cursor: pointer; ${p ? `width: ${p}px;` : "max-width: 100%;"} ${c ? `height: ${c}px;` : "height: auto;"}`, D && (D.deleteContents(), D.insertNode(i)), f();
552
546
  }, x = async (i) => {
@@ -835,8 +829,7 @@ const F = '[data-theme="dark"], .dark, .editora-theme-dark', I = (t, e) => {
835
829
  w.target === e && p();
836
830
  });
837
831
  }, C = () => {
838
- if (!s || !m)
839
- return;
832
+ if (!s || !m) return;
840
833
  const t = s.offsetHeight || 40, e = m.offsetTop, r = m.offsetLeft, a = m.offsetWidth, o = e - t - 8, n = r + a / 2 - (s.offsetWidth || 120) / 2;
841
834
  s.style.top = `${o}px`, s.style.left = `${n}px`, setTimeout(() => {
842
835
  s && (s.style.display = "flex");
@@ -850,8 +843,7 @@ const F = '[data-theme="dark"], .dark, .editora-theme-dark', I = (t, e) => {
850
843
  (!l || l === "static") && (e.style.position = "relative", e._originalPosition = l), s = document.createElement("div"), s.className = "media-floating-toolbar", G(t) && s.classList.add("rte-ui-theme-dark"), e.insertBefore(s, e.firstChild), C();
851
844
  }
852
845
  const r = s;
853
- if (!r)
854
- return;
846
+ if (!r) return;
855
847
  const a = t.tagName === "IMG", o = t.closest("a");
856
848
  r.innerHTML = `
857
849
  <button class="media-floating-toolbar-btn btn-align-left" title="Align Left" type="button">
@@ -934,15 +926,13 @@ const F = '[data-theme="dark"], .dark, .editora-theme-dark', I = (t, e) => {
934
926
  }
935
927
  }), _.forEach((e) => {
936
928
  e.addEventListener("mousedown", (r) => {
937
- if (!m)
938
- return;
929
+ if (!m) return;
939
930
  r.preventDefault(), r.stopPropagation(), H = !0, A = e.getAttribute("data-position"), U = r.clientX, j = r.clientY;
940
931
  const a = m.getBoundingClientRect();
941
932
  q = a.width, M = a.height, P = q / M, document.body.style.userSelect = "none", document.body.style.cursor = `${A}-resize`;
942
933
  });
943
934
  }), document.addEventListener("mousemove", (e) => {
944
- if (!H || !m || !A)
945
- return;
935
+ if (!H || !m || !A) return;
946
936
  const r = e.clientX - U, a = e.clientY - j;
947
937
  let o = q, n = M;
948
938
  switch (A) {
@@ -1000,4 +990,4 @@ const te = () => ({
1000
990
  export {
1001
991
  te as MediaManagerPlugin
1002
992
  };
1003
- //# sourceMappingURL=MediaManagerPlugin.native-3cf48a00.mjs.map
993
+ //# sourceMappingURL=MediaManagerPlugin.native-eOsTJFpw.mjs.map