@editora/core 1.0.15 → 1.0.17

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 (68) 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-knhM8NNo.mjs → CodePlugin.native-BH-K4xmW.mjs} +474 -342
  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-D1YHQ2NN.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/editora.min.js +26 -24
  44. package/dist/editora.umd.js +26 -24
  45. package/dist/escapeHtml-CX8RelZ1.mjs +7 -0
  46. package/dist/historyHelpers-B0-4mq1E.mjs +15 -0
  47. package/dist/index-XsYC_KdJ.mjs +3923 -0
  48. package/dist/index-_eKRBZPq.js +12 -0
  49. package/dist/index.cjs.js +3 -3
  50. package/dist/index.esm.js +17 -14
  51. package/dist/plugin-loader.js +53 -52
  52. package/dist/webcomponent-core.js +2055 -476
  53. package/dist/webcomponent-core.min.css +1 -1
  54. package/dist/webcomponent-core.min.js +96 -66
  55. package/dist/webcomponent.cjs.js +1 -1
  56. package/dist/webcomponent.esm.js +1 -1
  57. package/dist/webcomponent.js +2223 -643
  58. package/dist/webcomponent.min.css +1 -1
  59. package/dist/webcomponent.min.js +1564 -1198
  60. package/index.d.ts +32 -0
  61. package/package.json +10 -3
  62. package/dist/CodeSamplePlugin.native-CgGoH-X4.mjs +0 -384
  63. package/dist/LinkPlugin.native-DYCIcdTm.mjs +0 -283
  64. package/dist/SpellCheckPlugin.native-BZB9AewP.mjs +0 -1039
  65. package/dist/TablePlugin.native-DrHX-efe.mjs +0 -495
  66. package/dist/anchoredPopover-Bxds0VoB.mjs +0 -110
  67. package/dist/index-BLm1MtzH.js +0 -10
  68. package/dist/index-Cd9jEuZP.mjs +0 -2341
@@ -0,0 +1,772 @@
1
+ import { f as Q, g as J } from "./editorContainerHelpers-C7kdWnS0.mjs";
2
+ let u = null, h = null, S = null, V = null, A = null, B = null, N = null;
3
+ const H = '[data-theme="dark"], .dark, .editora-theme-dark';
4
+ let y = !1, k = null, D = 0, q = 0, z = !1, O = 0, P = 0, W = 0, _ = 0;
5
+ const Z = /* @__PURE__ */ new Set([
6
+ "DIV",
7
+ "P",
8
+ "BLOCKQUOTE",
9
+ "PRE",
10
+ "H1",
11
+ "H2",
12
+ "H3",
13
+ "H4",
14
+ "H5",
15
+ "H6",
16
+ "LI",
17
+ "TD",
18
+ "TH"
19
+ ]);
20
+ function X(e, t) {
21
+ let n = e;
22
+ for (; n && n !== t; ) {
23
+ if (n.nodeType === Node.ELEMENT_NODE && Z.has(n.tagName))
24
+ return n;
25
+ n = n.parentNode;
26
+ }
27
+ return null;
28
+ }
29
+ function F(e) {
30
+ const t = e.parentElement;
31
+ if (t && t.classList.contains("rte-table-wrapper"))
32
+ return t;
33
+ const n = document.createElement("div");
34
+ return n.className = "rte-table-wrapper", t == null || t.insertBefore(n, e), n.appendChild(e), n;
35
+ }
36
+ const $ = () => {
37
+ const e = Q(), t = J(e);
38
+ if (!t)
39
+ return alert("Please place your cursor in the editor before inserting a table"), !1;
40
+ const n = window.getSelection();
41
+ if (!n || n.rangeCount === 0) return;
42
+ const o = n.getRangeAt(0), l = document.createElement("table");
43
+ l.className = "rte-table";
44
+ const r = document.createElement("thead"), i = document.createElement("tr");
45
+ for (let m = 0; m < 3; m++) {
46
+ const g = document.createElement("th"), w = document.createElement("p");
47
+ w.appendChild(document.createElement("br")), g.appendChild(w), i.appendChild(g);
48
+ }
49
+ r.appendChild(i);
50
+ const a = document.createElement("tbody");
51
+ for (let m = 0; m < 2; m++) {
52
+ const g = document.createElement("tr");
53
+ for (let w = 0; w < 3; w++) {
54
+ const x = document.createElement("td"), L = document.createElement("p");
55
+ L.appendChild(document.createElement("br")), x.appendChild(L), g.appendChild(x);
56
+ }
57
+ a.appendChild(g);
58
+ }
59
+ l.appendChild(r), l.appendChild(a);
60
+ const s = F(l), d = (m, g, w) => {
61
+ if (m !== t) return m;
62
+ const x = w ? g - 1 : g;
63
+ return t.childNodes[Math.min(Math.max(x, 0), t.childNodes.length - 1)] || null;
64
+ }, c = d(o.endContainer, o.endOffset, !0), b = d(o.startContainer, o.startOffset, !1), C = c && X(c, t) || b && X(b, t);
65
+ C && C.parentNode ? C.parentNode.insertBefore(s, C.nextSibling) : (o.collapse(!1), o.insertNode(s));
66
+ const I = l.querySelector("th p");
67
+ if (I) {
68
+ const m = document.createRange();
69
+ m.setStart(I, 0), m.collapse(!0), n.removeAllRanges(), n.addRange(m);
70
+ }
71
+ t.focus();
72
+ }, ee = () => {
73
+ var i;
74
+ const e = f();
75
+ if (!e) return;
76
+ const { table: t, rowIndex: n } = e, o = document.createElement("tr"), l = ((i = t.rows[0]) == null ? void 0 : i.cells.length) || 0;
77
+ for (let a = 0; a < l; a++) {
78
+ const s = document.createElement("td"), d = document.createElement("p");
79
+ d.innerHTML = "<br>", s.appendChild(d), o.appendChild(s);
80
+ }
81
+ const r = t.rows[n];
82
+ r && r.parentElement ? r.parentElement.insertBefore(o, r) : t.appendChild(o), p();
83
+ }, te = () => {
84
+ var r, i;
85
+ const e = f();
86
+ if (!e) return;
87
+ const { table: t, rowIndex: n } = e, o = document.createElement("tr"), l = ((r = t.rows[0]) == null ? void 0 : r.cells.length) || 0;
88
+ for (let a = 0; a < l; a++) {
89
+ const s = document.createElement("td"), d = document.createElement("p");
90
+ d.innerHTML = "<br>", s.appendChild(d), o.appendChild(s);
91
+ }
92
+ if (n >= t.rows.length - 1) {
93
+ const a = t.rows[t.rows.length - 1];
94
+ a && a.parentElement ? a.parentElement.appendChild(o) : t.appendChild(o);
95
+ } else {
96
+ const a = t.rows[n + 1];
97
+ (i = a.parentElement) == null || i.insertBefore(o, a);
98
+ }
99
+ p();
100
+ }, ne = () => {
101
+ const e = f();
102
+ if (!e) return;
103
+ const { table: t, colIndex: n } = e;
104
+ for (let o = 0; o < t.rows.length; o++) {
105
+ const l = t.rows[o], r = document.createElement("td"), i = document.createElement("p");
106
+ i.innerHTML = "<br>", r.appendChild(i), n === 0 ? l.insertBefore(r, l.cells[0]) : l.insertBefore(r, l.cells[n]);
107
+ }
108
+ p();
109
+ }, oe = () => {
110
+ const e = f();
111
+ if (!e) return;
112
+ const { table: t, colIndex: n } = e;
113
+ for (let o = 0; o < t.rows.length; o++) {
114
+ const l = t.rows[o], r = document.createElement("td"), i = document.createElement("p");
115
+ i.innerHTML = "<br>", r.appendChild(i), n >= l.cells.length - 1 ? l.appendChild(r) : l.insertBefore(r, l.cells[n + 1]);
116
+ }
117
+ p();
118
+ }, re = () => {
119
+ const e = f();
120
+ if (!e || e.rowCount <= 1) return;
121
+ const { table: t, rowIndex: n, colIndex: o } = e;
122
+ t.deleteRow(n), j(t, n, o), p();
123
+ }, le = () => {
124
+ const e = f();
125
+ if (!e || e.cellCount <= 1) return;
126
+ const { table: t, rowIndex: n, colIndex: o } = e;
127
+ for (let l = 0; l < t.rows.length; l++) {
128
+ const r = t.rows[l];
129
+ r.cells[o] && r.deleteCell(o);
130
+ }
131
+ j(t, n, o), p();
132
+ }, ae = () => {
133
+ var i, a;
134
+ const e = f();
135
+ if (!e) return;
136
+ const { table: t, rowIndex: n } = e, o = t.rows[n];
137
+ if (!o) return;
138
+ const l = ((i = o.parentElement) == null ? void 0 : i.tagName.toLowerCase()) === "thead", r = t.querySelector("thead");
139
+ if (l) {
140
+ const s = o.parentElement;
141
+ if (o === s.rows[s.rows.length - 1]) {
142
+ const d = t.querySelector("tbody") || t.appendChild(document.createElement("tbody"));
143
+ d.insertBefore(o, d.firstChild), s.rows.length === 0 && s.remove();
144
+ } else
145
+ K(o, "td");
146
+ } else if (!r || o === ((a = t.tBodies[0]) == null ? void 0 : a.rows[0])) {
147
+ let s = r;
148
+ s || (s = document.createElement("thead"), t.insertBefore(s, t.firstChild)), s.appendChild(o);
149
+ } else
150
+ K(o, "th");
151
+ p();
152
+ };
153
+ function K(e, t) {
154
+ Array.from(e.cells).forEach((n) => {
155
+ var l;
156
+ if (n.tagName.toLowerCase() === t) return;
157
+ const o = document.createElement(t);
158
+ o.innerHTML = n.innerHTML;
159
+ for (let r = 0; r < n.attributes.length; r++) {
160
+ const i = n.attributes[r];
161
+ o.setAttribute(i.name, i.value);
162
+ }
163
+ (l = n.parentNode) == null || l.replaceChild(o, n);
164
+ });
165
+ }
166
+ const ie = () => {
167
+ var o;
168
+ const e = f();
169
+ if (!e) return;
170
+ const { table: t, colIndex: n } = e;
171
+ for (let l = 0; l < t.rows.length; l++) {
172
+ const r = t.rows[l].cells[n];
173
+ if (r) {
174
+ const i = r.tagName.toLowerCase() === "th" ? "td" : "th", a = document.createElement(i);
175
+ a.innerHTML = r.innerHTML;
176
+ for (let s = 0; s < r.attributes.length; s++) {
177
+ const d = r.attributes[s];
178
+ a.setAttribute(d.name, d.value);
179
+ }
180
+ (o = r.parentNode) == null || o.replaceChild(a, r);
181
+ }
182
+ }
183
+ p();
184
+ }, de = () => {
185
+ const e = f();
186
+ if (!e) return;
187
+ const t = e.table, n = t.parentElement;
188
+ n && n.classList.contains("rte-table-wrapper") ? n.remove() : t.remove(), document.dispatchEvent(new CustomEvent("tableDeleted"));
189
+ };
190
+ function v(e, t) {
191
+ if (!e || !(e instanceof Node)) return null;
192
+ const n = e.nodeType === Node.ELEMENT_NODE ? e : e.parentElement;
193
+ return n ? n.closest(t) : null;
194
+ }
195
+ function U(e) {
196
+ if (!e) return !1;
197
+ const t = e.closest("[contenteditable]");
198
+ return !t || t.getAttribute("contenteditable") === "false" ? !1 : !t.closest('[data-readonly="true"]');
199
+ }
200
+ function se() {
201
+ const e = window.getSelection(), t = e && e.rangeCount > 0 ? e.getRangeAt(0).startContainer : null;
202
+ return v(t, ".rte-content") || (h ? h.closest(".rte-content") : null);
203
+ }
204
+ function ce(e, t, n) {
205
+ const o = window.execEditorCommand || window.executeEditorCommand;
206
+ if (typeof o == "function")
207
+ try {
208
+ o("recordDomTransaction", e, t, n);
209
+ } catch (l) {
210
+ }
211
+ }
212
+ function Y(e) {
213
+ const t = se();
214
+ if (t && !U(t)) return;
215
+ const n = t ? t.innerHTML : "";
216
+ if (e(), !t) return;
217
+ const o = t.innerHTML;
218
+ o !== n && (ce(t, n, o), t.dispatchEvent(new Event("input", { bubbles: !0 })));
219
+ }
220
+ function j(e, t, n) {
221
+ if (!e.isConnected || e.rows.length === 0) return;
222
+ const o = e.rows[Math.min(t, e.rows.length - 1)], l = o.cells[Math.min(n, o.cells.length - 1)];
223
+ if (!l) return;
224
+ const r = document.createRange(), i = l.querySelector("p, div, li") || l;
225
+ r.selectNodeContents(i), r.collapse(!0);
226
+ const a = window.getSelection();
227
+ a == null || a.removeAllRanges(), a == null || a.addRange(r);
228
+ }
229
+ const ue = () => {
230
+ const e = window.getSelection();
231
+ if (!e || e.rangeCount === 0) return;
232
+ const n = e.getRangeAt(0).startContainer;
233
+ if (!v(n, "table")) return;
234
+ const o = v(n, "td, th");
235
+ if (!o) return;
236
+ const l = o.parentElement;
237
+ if (!l) return;
238
+ let r = -1;
239
+ for (let d = 0; d < l.cells.length; d++)
240
+ if (l.cells[d] === o) {
241
+ r = d;
242
+ break;
243
+ }
244
+ if (r === -1 || r === l.cells.length - 1) return;
245
+ const i = l.cells[r + 1];
246
+ if (!i) return;
247
+ const a = (d, c) => {
248
+ const b = parseInt(d.getAttribute(c) || "1", 10);
249
+ return Number.isFinite(b) && b > 0 ? b : 1;
250
+ };
251
+ if (a(o, "rowspan") !== a(i, "rowspan")) return;
252
+ o.setAttribute("colspan", String(a(o, "colspan") + a(i, "colspan"))), Array.from(i.childNodes).forEach((d) => {
253
+ o.appendChild(d);
254
+ }), i.remove(), p();
255
+ };
256
+ function f() {
257
+ var a;
258
+ const e = window.getSelection();
259
+ if (!e || e.rangeCount === 0) return null;
260
+ const n = e.getRangeAt(0).startContainer, o = v(n, "table");
261
+ if (!o) return null;
262
+ let l = 0, r = 0;
263
+ const i = v(n, "td, th");
264
+ if (i) {
265
+ const s = i.parentElement;
266
+ for (; s && s !== o.rows[l] && (l++, !(l >= o.rows.length)); )
267
+ ;
268
+ const d = s;
269
+ if (d) {
270
+ for (let c = 0; c < d.cells.length; c++)
271
+ if (d.cells[c] === i) {
272
+ r = c;
273
+ break;
274
+ }
275
+ }
276
+ }
277
+ return {
278
+ table: o,
279
+ rowIndex: l,
280
+ colIndex: r,
281
+ rowCount: o.rows.length,
282
+ cellCount: ((a = o.rows[0]) == null ? void 0 : a.cells.length) || 0
283
+ };
284
+ }
285
+ function p() {
286
+ if (!u || !h) return;
287
+ const e = f();
288
+ if (!e) return;
289
+ const t = e.rowCount > 1, n = e.cellCount > 1;
290
+ G(t, n);
291
+ }
292
+ function he() {
293
+ S = () => {
294
+ const e = f();
295
+ e && U(e.table) ? be(e.table) : R();
296
+ }, V = (e) => {
297
+ const t = v(e.target, "table"), n = v(e.target, ".table-toolbar");
298
+ !t && !n && R();
299
+ }, A = () => {
300
+ R();
301
+ }, B = () => {
302
+ h && u && u.style.display !== "none" && M(h);
303
+ }, N = () => {
304
+ h && u && u.style.display !== "none" && M(h);
305
+ }, document.addEventListener("selectionchange", S), document.addEventListener("mousedown", V), document.addEventListener("tableDeleted", A), window.addEventListener("scroll", B, !0), window.addEventListener("resize", N);
306
+ }
307
+ function M(e) {
308
+ if (!u) return;
309
+ const t = e.getBoundingClientRect(), n = u.getBoundingClientRect(), o = n.height || 40, l = n.width || 280, r = 10;
310
+ let i = t.top - o - r, a = t.left + t.width / 2 - l / 2;
311
+ i < r && (i = t.bottom + r), a < r && (a = r);
312
+ const s = window.innerWidth;
313
+ a + l > s - r && (a = s - l - r);
314
+ const d = window.innerHeight;
315
+ i + o > d - r && (i = d - o - r), u.style.top = i + "px", u.style.left = a + "px";
316
+ }
317
+ function be(e) {
318
+ h = e, u || (u = fe(), document.body.appendChild(u));
319
+ const t = !!e.closest(H) || document.body.matches(H) || document.documentElement.matches(H);
320
+ u.classList.toggle("rte-theme-dark", t), u.style.display = "flex", u.style.visibility = "hidden", requestAnimationFrame(() => {
321
+ M(e), u && (u.style.visibility = "visible");
322
+ });
323
+ const n = f();
324
+ n && G(n.rowCount > 1, n.cellCount > 1), pe(e);
325
+ }
326
+ function R() {
327
+ if (u && (u.style.display = "none"), h) {
328
+ h.querySelectorAll(".resize-handle").forEach((o) => o.remove());
329
+ const t = h.parentElement, n = t != null && t.classList.contains("rte-table-wrapper") ? t.querySelector(".table-resize-handle") : h.querySelector(".table-resize-handle");
330
+ n && n.remove();
331
+ }
332
+ h = null;
333
+ }
334
+ function G(e, t) {
335
+ if (!u) return;
336
+ const n = u.querySelector('[data-action="deleteRow"]'), o = u.querySelector('[data-action="deleteColumn"]');
337
+ n && (n.disabled = !e), o && (o.disabled = !t);
338
+ }
339
+ let T = !1;
340
+ function me() {
341
+ if (T || typeof document == "undefined") return;
342
+ if (document.getElementById("rte-table-toolbar-styles")) {
343
+ T = !0;
344
+ return;
345
+ }
346
+ T = !0;
347
+ const e = document.createElement("style");
348
+ e.id = "rte-table-toolbar-styles", e.textContent = `
349
+ .table-toolbar {
350
+ background: white;
351
+ border: 1px solid #d0d0d0;
352
+ border-radius: 4px;
353
+ box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
354
+ padding: 4px;
355
+ display: flex;
356
+ align-items: center;
357
+ gap: 0;
358
+ font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
359
+ min-width: max-content;
360
+ }
361
+ .toolbar-section {
362
+ display: flex;
363
+ align-items: center;
364
+ gap: 2px;
365
+ }
366
+ .toolbar-divider {
367
+ width: 1px;
368
+ height: 20px;
369
+ background: #e0e0e0;
370
+ margin: 0 4px;
371
+ }
372
+ .toolbar-icon-btn {
373
+ display: flex;
374
+ align-items: center;
375
+ justify-content: center;
376
+ width: 28px;
377
+ height: 28px;
378
+ padding: 0;
379
+ border: 1px solid transparent;
380
+ background: transparent;
381
+ cursor: pointer;
382
+ color: #333;
383
+ border-radius: 3px;
384
+ transition: all 0.2s ease;
385
+ flex-shrink: 0;
386
+ font-size: 14px;
387
+ line-height: 1;
388
+ }
389
+ .toolbar-icon-btn svg {
390
+ width: 16px;
391
+ height: 16px;
392
+ }
393
+ .toolbar-icon-btn:hover:not(:disabled) {
394
+ background: #f0f0f0;
395
+ border-color: #d0d0d0;
396
+ color: #0066cc;
397
+ }
398
+ .toolbar-icon-btn:active:not(:disabled) {
399
+ background: #e8f0ff;
400
+ border-color: #0066cc;
401
+ transform: scale(0.95);
402
+ }
403
+ .toolbar-icon-btn:disabled {
404
+ opacity: 0.4;
405
+ cursor: not-allowed;
406
+ color: #ccc;
407
+ }
408
+ .toolbar-icon-btn-danger {
409
+ color: #d32f2f;
410
+ }
411
+ .toolbar-icon-btn-danger:hover:not(:disabled) {
412
+ background: #fff3f3;
413
+ border-color: #ffcccc;
414
+ color: #d32f2f;
415
+ }
416
+ .toolbar-icon-btn-danger:active:not(:disabled) {
417
+ background: #ffebee;
418
+ }
419
+ .toolbar-icon-btn-delete {
420
+ color: #d32f2f;
421
+ }
422
+ .toolbar-icon-btn-delete:hover:not(:disabled) {
423
+ background: #fff3f3;
424
+ border-color: #ffcccc;
425
+ color: #d32f2f;
426
+ }
427
+ .toolbar-icon-btn-delete:active:not(:disabled) {
428
+ background: #ffebee;
429
+ }
430
+ :is([data-theme="dark"], .dark, .editora-theme-dark) .table-toolbar,
431
+ .table-toolbar.rte-theme-dark {
432
+ background: linear-gradient(180deg, #2f3844 0%, #2a323c 100%);
433
+ border-color: #4d596b;
434
+ box-shadow: 0 8px 20px rgba(0, 0, 0, 0.45);
435
+ }
436
+ :is([data-theme="dark"], .dark, .editora-theme-dark) .toolbar-divider,
437
+ .table-toolbar.rte-theme-dark .toolbar-divider {
438
+ background: #4d596b;
439
+ }
440
+ :is([data-theme="dark"], .dark, .editora-theme-dark) .toolbar-icon-btn,
441
+ .table-toolbar.rte-theme-dark .toolbar-icon-btn {
442
+ color: #d7deea;
443
+ border-color: transparent;
444
+ }
445
+ :is([data-theme="dark"], .dark, .editora-theme-dark) .toolbar-icon-btn svg,
446
+ .table-toolbar.rte-theme-dark .toolbar-icon-btn svg {
447
+ color: currentColor;
448
+ }
449
+ :is([data-theme="dark"], .dark, .editora-theme-dark) .toolbar-icon-btn svg [stroke="#000" i],
450
+ :is([data-theme="dark"], .dark, .editora-theme-dark) .toolbar-icon-btn svg [stroke="#000000" i],
451
+ :is([data-theme="dark"], .dark, .editora-theme-dark) .toolbar-icon-btn svg [stroke="black" i],
452
+ .table-toolbar.rte-theme-dark .toolbar-icon-btn svg [stroke="#000" i],
453
+ .table-toolbar.rte-theme-dark .toolbar-icon-btn svg [stroke="#000000" i],
454
+ .table-toolbar.rte-theme-dark .toolbar-icon-btn svg [stroke="black" i] {
455
+ stroke: currentColor !important;
456
+ }
457
+ :is([data-theme="dark"], .dark, .editora-theme-dark) .toolbar-icon-btn svg [fill="#000" i],
458
+ :is([data-theme="dark"], .dark, .editora-theme-dark) .toolbar-icon-btn svg [fill="#000000" i],
459
+ :is([data-theme="dark"], .dark, .editora-theme-dark) .toolbar-icon-btn svg [fill="black" i],
460
+ .table-toolbar.rte-theme-dark .toolbar-icon-btn svg [fill="#000" i],
461
+ .table-toolbar.rte-theme-dark .toolbar-icon-btn svg [fill="#000000" i],
462
+ .table-toolbar.rte-theme-dark .toolbar-icon-btn svg [fill="black" i] {
463
+ fill: currentColor !important;
464
+ }
465
+ :is([data-theme="dark"], .dark, .editora-theme-dark) .toolbar-icon-btn:hover:not(:disabled),
466
+ .table-toolbar.rte-theme-dark .toolbar-icon-btn:hover:not(:disabled) {
467
+ background: #3a4554;
468
+ border-color: #607088;
469
+ color: #f3f8ff;
470
+ }
471
+ :is([data-theme="dark"], .dark, .editora-theme-dark) .toolbar-icon-btn:active:not(:disabled),
472
+ .table-toolbar.rte-theme-dark .toolbar-icon-btn:active:not(:disabled) {
473
+ background: #4a95de;
474
+ border-color: #67adf4;
475
+ color: #0f1b2a;
476
+ }
477
+ :is([data-theme="dark"], .dark, .editora-theme-dark) .toolbar-icon-btn:disabled,
478
+ .table-toolbar.rte-theme-dark .toolbar-icon-btn:disabled {
479
+ color: #7f8ca1;
480
+ }
481
+ @media (max-width: 768px) {
482
+ .table-toolbar {
483
+ padding: 3px;
484
+ gap: 0;
485
+ max-width: 90vw;
486
+ overflow-x: auto;
487
+ }
488
+ .toolbar-icon-btn {
489
+ width: 26px;
490
+ height: 26px;
491
+ }
492
+ .toolbar-divider {
493
+ height: 18px;
494
+ }
495
+ }
496
+ @media print {
497
+ .table-toolbar {
498
+ display: none;
499
+ }
500
+ }
501
+ `, document.head.appendChild(e);
502
+ }
503
+ function fe() {
504
+ me();
505
+ const e = document.createElement("div");
506
+ e.className = "table-toolbar", e.style.cssText = `
507
+ position: fixed;
508
+ z-index: 1000;
509
+ display: none;
510
+ `, e.setAttribute("role", "toolbar"), e.setAttribute("aria-label", "Table editing toolbar");
511
+ const t = (c) => {
512
+ const b = document.createElement("button");
513
+ return b.className = "toolbar-icon-btn", c.danger && b.classList.add("toolbar-icon-btn-danger"), c.delete && b.classList.add("toolbar-icon-btn-delete"), b.innerHTML = c.icon, b.title = c.title, b.setAttribute("aria-label", c.title), b.setAttribute("type", "button"), b.setAttribute("data-action", c.action), b.onclick = () => E(c.action), b;
514
+ }, n = () => {
515
+ const c = document.createElement("div");
516
+ return c.className = "toolbar-divider", c;
517
+ }, o = (...c) => {
518
+ const b = document.createElement("div");
519
+ return b.className = "toolbar-section", c.forEach((C) => b.appendChild(C)), b;
520
+ }, l = o(
521
+ t({
522
+ icon: ve(),
523
+ title: "Add row above (Ctrl+Shift+R)",
524
+ action: "addRowAbove"
525
+ }),
526
+ t({
527
+ icon: Ce(),
528
+ title: "Add row below",
529
+ action: "addRowBelow"
530
+ }),
531
+ t({
532
+ icon: ke(),
533
+ title: "Delete row",
534
+ action: "deleteRow",
535
+ danger: !0
536
+ })
537
+ ), r = o(
538
+ t({
539
+ icon: ye(),
540
+ title: "Add column left",
541
+ action: "addColumnLeft"
542
+ }),
543
+ t({
544
+ icon: Ee(),
545
+ title: "Add column right (Ctrl+Shift+C)",
546
+ action: "addColumnRight"
547
+ }),
548
+ t({
549
+ icon: xe(),
550
+ title: "Delete column",
551
+ action: "deleteColumn",
552
+ danger: !0
553
+ })
554
+ ), i = o(
555
+ t({
556
+ icon: He(),
557
+ title: "Toggle header row",
558
+ action: "toggleHeaderRow"
559
+ }),
560
+ t({
561
+ icon: ze(),
562
+ title: "Toggle header column",
563
+ action: "toggleHeaderColumn"
564
+ })
565
+ ), a = o(
566
+ t({
567
+ icon: Te(),
568
+ title: "Merge cells (horizontally)",
569
+ action: "mergeCells"
570
+ })
571
+ ), s = o(
572
+ t({
573
+ icon: Re(),
574
+ title: "Delete table",
575
+ action: "deleteTable",
576
+ delete: !0
577
+ })
578
+ );
579
+ e.appendChild(l), e.appendChild(n()), e.appendChild(r), e.appendChild(n()), e.appendChild(i), e.appendChild(n()), e.appendChild(a), e.appendChild(n()), e.appendChild(s);
580
+ const d = (c) => {
581
+ !u || u.style.display === "none" || (c.ctrlKey || c.metaKey) && c.shiftKey && (c.key === "r" || c.key === "R" ? (c.preventDefault(), E("addRowBelow")) : (c.key === "c" || c.key === "C") && (c.preventDefault(), E("addColumnRight")));
582
+ };
583
+ return window.addEventListener("keydown", d), e;
584
+ }
585
+ function E(e) {
586
+ Y(() => {
587
+ switch (e) {
588
+ case "addRowAbove":
589
+ ee();
590
+ break;
591
+ case "addRowBelow":
592
+ te();
593
+ break;
594
+ case "addColumnLeft":
595
+ ne();
596
+ break;
597
+ case "addColumnRight":
598
+ oe();
599
+ break;
600
+ case "deleteRow":
601
+ re();
602
+ break;
603
+ case "deleteColumn":
604
+ le();
605
+ break;
606
+ case "toggleHeaderRow":
607
+ ae();
608
+ break;
609
+ case "toggleHeaderColumn":
610
+ ie();
611
+ break;
612
+ case "deleteTable":
613
+ de();
614
+ break;
615
+ case "mergeCells":
616
+ ue();
617
+ break;
618
+ }
619
+ });
620
+ }
621
+ function pe(e) {
622
+ const t = F(e);
623
+ e.querySelectorAll(".resize-handle").forEach((a) => a.remove());
624
+ const o = t.querySelector(".table-resize-handle");
625
+ o && o.remove();
626
+ const l = e.querySelector("thead tr, tbody tr:first-child");
627
+ if (!l) return;
628
+ const r = l.querySelectorAll("td, th");
629
+ r.forEach((a, s) => {
630
+ if (s === r.length - 1) return;
631
+ const d = document.createElement("div");
632
+ d.className = "resize-handle", d.style.cssText = `
633
+ position: absolute;
634
+ right: -4px;
635
+ top: 0;
636
+ bottom: 0;
637
+ width: 8px;
638
+ background: transparent;
639
+ cursor: col-resize;
640
+ z-index: 10;
641
+ transition: background 0.15s ease;
642
+ `, d.addEventListener("mouseenter", () => {
643
+ y || (d.style.background = "rgba(0, 102, 204, 0.3)");
644
+ }), d.addEventListener("mouseleave", () => {
645
+ y || (d.style.background = "transparent");
646
+ }), d.addEventListener("mousedown", (c) => {
647
+ c.preventDefault(), c.stopPropagation(), ge(c, s);
648
+ }), a.style.position = "relative", a.appendChild(d);
649
+ });
650
+ const i = document.createElement("div");
651
+ i.className = "table-resize-handle", i.addEventListener("mousedown", (a) => {
652
+ a.preventDefault(), a.stopPropagation(), we(a);
653
+ }), t.appendChild(i);
654
+ }
655
+ function ge(e, t) {
656
+ if (y = !0, k = t, D = e.clientX, !h) return;
657
+ const n = h.querySelector("thead tr, tbody tr:first-child");
658
+ n && n.cells[t] && (q = n.cells[t].offsetWidth), document.body.style.cursor = "col-resize", document.body.style.userSelect = "none";
659
+ const o = (r) => {
660
+ if (!y || k === null || !h) return;
661
+ const i = r.clientX - D, a = Math.max(50, q + i);
662
+ h.querySelectorAll("tr").forEach((d) => {
663
+ d.cells[k] && (d.cells[k].style.width = a + "px");
664
+ });
665
+ }, l = () => {
666
+ y = !1, k = null, document.body.style.cursor = "", document.body.style.userSelect = "", document.removeEventListener("mousemove", o), document.removeEventListener("mouseup", l);
667
+ };
668
+ document.addEventListener("mousemove", o), document.addEventListener("mouseup", l);
669
+ }
670
+ function we(e) {
671
+ if (!h) return;
672
+ z = !0, O = e.clientX, P = e.clientY, W = h.offsetWidth, _ = h.offsetHeight, document.body.style.cursor = "nwse-resize", document.body.style.userSelect = "none";
673
+ const t = (o) => {
674
+ if (!z || !h) return;
675
+ const l = o.clientX - O, r = o.clientY - P, i = Math.max(200, W + l), a = Math.max(100, _ + r);
676
+ h.style.width = i + "px", h.style.height = a + "px";
677
+ }, n = () => {
678
+ z = !1, document.body.style.cursor = "", document.body.style.userSelect = "", document.removeEventListener("mousemove", t), document.removeEventListener("mouseup", n);
679
+ };
680
+ document.addEventListener("mousemove", t), document.addEventListener("mouseup", n);
681
+ }
682
+ function ve() {
683
+ return `<svg width="16" height="16" viewBox="0 0 16 16" fill="currentColor">
684
+ <path d="M2 7h12V5H2v2zm0 4h12V9H2v2zM8 1v3H5v2h3v3h2V6h3V4h-3V1H8z"/>
685
+ </svg>`;
686
+ }
687
+ function Ce() {
688
+ return `<svg width="16" height="16" viewBox="0 0 16 16" fill="currentColor">
689
+ <path d="M2 3h12V1H2v2zm0 4h12V5H2v2zm6 4v3h3v-2h2v-2h-2v-3h-2v3H5v2h3z"/>
690
+ </svg>`;
691
+ }
692
+ function ke() {
693
+ return `<svg width="16" height="16" viewBox="0 0 16 16" fill="currentColor">
694
+ <path d="M2 5h12v2H2V5zm0 4h12v2H2V9zm4-6v2H4v2h2v2h2V7h2V5H8V3H6z"/>
695
+ </svg>`;
696
+ }
697
+ function ye() {
698
+ return `<svg width="16" height="16" viewBox="0 0 16 16" fill="currentColor">
699
+ <path d="M7 2v12h2V2H7zm4 0v12h2V2h-2zM1 8h3v-3H1v3zm3 2H1v3h3v-3z"/>
700
+ </svg>`;
701
+ }
702
+ function Ee() {
703
+ return `<svg width="16" height="16" viewBox="0 0 16 16" fill="currentColor">
704
+ <path d="M2 2v12h2V2H2zm4 0v12h2V2H6zM12 8h3v-3h-3v3zm0 2h3v3h-3v-3z"/>
705
+ </svg>`;
706
+ }
707
+ function xe() {
708
+ return `<svg width="16" height="16" viewBox="0 0 16 16" fill="currentColor">
709
+ <path d="M5 2v12h2V2H5zm4 0v12h2V2H9zm3 2h3V1h-3v3zm3 2h-3v3h3V6zm0 4h-3v3h3v-3z"/>
710
+ </svg>`;
711
+ }
712
+ function He() {
713
+ return `<svg width="16" height="16" viewBox="0 0 16 16" fill="currentColor">
714
+ <path d="M2 2h12v3H2V2zm0 5h12v8H2V7zm2 2v4h2V9H4zm4 0v4h2V9H8zm4 0v4h2V9h-2z"/>
715
+ </svg>`;
716
+ }
717
+ function ze() {
718
+ return `<svg width="16" height="16" viewBox="0 0 16 16" fill="currentColor">
719
+ <path d="M2 2v12h3V2H2zm5 0v12h8V2H7zm2 2h4v2H9V4zm0 4h4v2H9V8zm0 4h4v2H9v-2z"/>
720
+ </svg>`;
721
+ }
722
+ function Re() {
723
+ return `<svg width="16" height="16" viewBox="0 0 16 16" fill="currentColor">
724
+ <path d="M3 1h10v1H3V1zm1 2v11h8V3H4zM6 5h1v6H6V5zm3 0h1v6H9V5z"/>
725
+ </svg>`;
726
+ }
727
+ function Te() {
728
+ return `<svg width="16" height="16" viewBox="0 0 16 16" fill="currentColor">
729
+ <path d="M2 2h4v3H2V2zm5 0h4v3H7V2zm5 0h2v3h-2V2zm-10 4h4v3H2V6zm5 0h4v3H7V6zm5 0h2v3h-2V6zm-10 4h4v3H2v-3zm5 0h4v3H7v-3zm5 0h2v3h-2v-3z"/>
730
+ </svg>`;
731
+ }
732
+ if (typeof window != "undefined" && !window.__tablePluginInitialized) {
733
+ window.__tablePluginInitialized = !0;
734
+ const e = () => {
735
+ he();
736
+ };
737
+ document.readyState === "loading" ? document.addEventListener("DOMContentLoaded", e) : setTimeout(e, 100);
738
+ }
739
+ const Ie = () => ({
740
+ name: "table",
741
+ toolbar: [
742
+ {
743
+ label: "Insert Table",
744
+ command: "insertTable",
745
+ icon: '<svg width="24" height="24" viewBox="0 0 24 24" fill="none" focusable="false" aria-hidden="true"><rect x="3" y="4" width="18" height="16" rx="2" fill="none" stroke="currentColor" stroke-width="1.8"/><path d="M3 10h18M3 15h18M9 4v16M15 4v16" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round"/></svg>'
746
+ }
747
+ ],
748
+ commands: {
749
+ insertTable: () => (Y(() => {
750
+ $();
751
+ }), !0)
752
+ },
753
+ keymap: {
754
+ "Mod-Shift-r": () => (E("addRowBelow"), !0),
755
+ "Mod-Shift-c": () => (E("addColumnRight"), !0)
756
+ }
757
+ });
758
+ export {
759
+ Ie as TablePlugin,
760
+ ne as addColumnLeftCommand,
761
+ oe as addColumnRightCommand,
762
+ ee as addRowAboveCommand,
763
+ te as addRowBelowCommand,
764
+ le as deleteColumnCommand,
765
+ re as deleteRowCommand,
766
+ de as deleteTableCommand,
767
+ $ as insertTableCommand,
768
+ ue as mergeCellsCommand,
769
+ ie as toggleHeaderColumnCommand,
770
+ ae as toggleHeaderRowCommand
771
+ };
772
+ //# sourceMappingURL=TablePlugin.native-BjIxYZ2X.mjs.map