@editora/plugins 1.0.22 → 1.1.0

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 (103) hide show
  1. package/README.md +1 -1
  2. package/dist/{CodePlugin.native-CKJo7IFG.js → CodePlugin.native-BwhZsI5v.js} +11 -11
  3. package/dist/{CodePlugin.native-D8gGxB8i.mjs → CodePlugin.native-CojLCp6C.mjs} +61 -53
  4. package/dist/MediaManagerPlugin.native-CycfjOi4.js +1841 -0
  5. package/dist/MediaManagerPlugin.native-DZrmcmnm.mjs +4688 -0
  6. package/dist/a11y-checker.cjs.js +3 -3
  7. package/dist/a11y-checker.esm.js +6 -4
  8. package/dist/anchor.cjs.js +4 -4
  9. package/dist/anchor.esm.js +19 -18
  10. package/dist/anchoredPopover-BNJ8e7j-.mjs +128 -0
  11. package/dist/anchoredPopover-Cygmit_o.js +1 -0
  12. package/dist/approval-workflow.cjs.js +7 -7
  13. package/dist/approval-workflow.esm.js +55 -54
  14. package/dist/background-color.cjs.js +2 -2
  15. package/dist/background-color.esm.js +72 -67
  16. package/dist/blocks-library.cjs.js +18 -19
  17. package/dist/blocks-library.esm.js +41 -42
  18. package/dist/citations.cjs.js +4 -4
  19. package/dist/citations.esm.js +50 -50
  20. package/dist/code-sample.cjs.js +10 -10
  21. package/dist/code-sample.esm.js +4 -4
  22. package/dist/code.cjs.js +1 -1
  23. package/dist/code.esm.js +1 -1
  24. package/dist/comments.cjs.js +23 -11
  25. package/dist/comments.esm.js +167 -149
  26. package/dist/conditional-content.cjs.js +2 -2
  27. package/dist/conditional-content.esm.js +2 -2
  28. package/dist/confirmDialog-D3S8BhIM.js +42 -0
  29. package/dist/confirmDialog-DR4c8j6S.mjs +87 -0
  30. package/dist/content-rules.cjs.js +6 -6
  31. package/dist/content-rules.esm.js +51 -51
  32. package/dist/data-binding.cjs.js +2 -2
  33. package/dist/data-binding.esm.js +2 -2
  34. package/dist/dialogHelpers-BbwpIXD9.mjs +183 -0
  35. package/dist/dialogHelpers-BxSQ7A6M.js +12 -0
  36. package/dist/document-manager.cjs.js +1 -1
  37. package/dist/document-manager.esm.js +1 -1
  38. package/dist/{documentManager-BL98a7YZ.mjs → documentManager-BFjGIeI8.mjs} +793 -781
  39. package/dist/{documentManager-r8t7yZEd.js → documentManager-C9d17K5W.js} +10 -10
  40. package/dist/embed-iframe.cjs.js +6 -6
  41. package/dist/embed-iframe.esm.js +6 -6
  42. package/dist/emojis.cjs.js +5 -5
  43. package/dist/emojis.esm.js +3 -3
  44. package/dist/enterprise.cjs.js +1 -1
  45. package/dist/enterprise.esm.js +12 -12
  46. package/dist/format-painter.cjs.js +1 -1
  47. package/dist/format-painter.esm.js +172 -151
  48. package/dist/heading.cjs.js +1 -1
  49. package/dist/heading.esm.js +96 -83
  50. package/dist/history.cjs.js +1 -1
  51. package/dist/history.esm.js +176 -97
  52. package/dist/{index-D5xugkYA.js → index-CtR8olYy.js} +2 -2
  53. package/dist/{index-B-VitI3v.mjs → index-Du_Ljqfz.mjs} +36 -35
  54. package/dist/index.cjs.js +1 -1
  55. package/dist/index.esm.js +90 -83
  56. package/dist/katex-Cc3-mvOY.js +257 -0
  57. package/dist/katex-DoRnZ_sp.mjs +11682 -0
  58. package/dist/katex.min--Ws3c9be.mjs +5 -0
  59. package/dist/katex.min-Dk2VscxB.js +2 -0
  60. package/dist/link.cjs.js +3 -3
  61. package/dist/link.esm.js +3 -3
  62. package/dist/list.cjs.js +1 -1
  63. package/dist/list.esm.js +140 -52
  64. package/dist/math.cjs.js +14 -14
  65. package/dist/math.esm.js +149 -136
  66. package/dist/media-manager.cjs.js +1 -619
  67. package/dist/media-manager.esm.js +30 -1017
  68. package/dist/mentions.cjs.js +12 -12
  69. package/dist/mentions.esm.js +149 -143
  70. package/dist/merge-tag.cjs.js +5 -3
  71. package/dist/merge-tag.esm.js +5 -3
  72. package/dist/notify-BkbzMopb.js +32 -0
  73. package/dist/notify-zOp-mUOJ.mjs +59 -0
  74. package/dist/pii-redaction.cjs.js +1 -1
  75. package/dist/pii-redaction.esm.js +1 -1
  76. package/dist/preview.cjs.js +1 -1
  77. package/dist/preview.esm.js +1 -1
  78. package/dist/shared-config.cjs.js +1 -1
  79. package/dist/shared-config.esm.js +14 -14
  80. package/dist/slash-commands.cjs.js +5 -5
  81. package/dist/slash-commands.esm.js +259 -236
  82. package/dist/smart-paste.cjs.js +1 -1
  83. package/dist/smart-paste.esm.js +1 -1
  84. package/dist/special-characters.cjs.js +3 -3
  85. package/dist/special-characters.esm.js +3 -3
  86. package/dist/spell-check.cjs.js +9 -9
  87. package/dist/spell-check.esm.js +288 -251
  88. package/dist/table.cjs.js +14 -14
  89. package/dist/table.esm.js +175 -154
  90. package/dist/template.cjs.js +5 -3
  91. package/dist/template.esm.js +15 -13
  92. package/dist/text-color.cjs.js +4 -4
  93. package/dist/text-color.esm.js +38 -34
  94. package/dist/translation-workflow.cjs.js +9 -9
  95. package/dist/translation-workflow.esm.js +98 -95
  96. package/dist/version-diff.cjs.js +4 -4
  97. package/dist/version-diff.esm.js +36 -36
  98. package/index.d.ts +183 -2
  99. package/package.json +6 -5
  100. package/dist/anchoredPopover-Bg-ey7Yo.js +0 -1
  101. package/dist/anchoredPopover-D_JbjvdA.mjs +0 -111
  102. package/dist/dialogHelpers-5d5BuOCW.mjs +0 -39
  103. package/dist/dialogHelpers-zU6zpMIA.js +0 -12
package/dist/table.esm.js CHANGED
@@ -1,8 +1,9 @@
1
- import { f as Z, g as $ } from "./editorContainerHelpers-C7kdWnS0.mjs";
2
- let u = null, h = null, A = null, V = null, B = null, N = null, D = null;
1
+ import { n as Z } from "./notify-zOp-mUOJ.mjs";
2
+ import { f as $, g as ee } from "./editorContainerHelpers-C7kdWnS0.mjs";
3
+ let h = null, b = null, V = null, B = null, N = null, D = null, q = null;
3
4
  const H = '[data-theme="dark"], .dark, .editora-theme-dark';
4
- let k = !1, y = null, q = 0, O = 0, z = !1, P = 0, W = 0, _ = 0, X = 0;
5
- const ee = /* @__PURE__ */ new Set([
5
+ let E = !1, k = null, O = 0, P = 0, R = !1, K = 0, W = 0, _ = 0, X = 0;
6
+ const te = /* @__PURE__ */ new Set([
6
7
  "DIV",
7
8
  "P",
8
9
  "BLOCKQUOTE",
@@ -17,69 +18,69 @@ const ee = /* @__PURE__ */ new Set([
17
18
  "TD",
18
19
  "TH"
19
20
  ]);
20
- function K(e, t) {
21
+ function F(e, t) {
21
22
  let n = e;
22
23
  for (; n && n !== t; ) {
23
- if (n.nodeType === Node.ELEMENT_NODE && ee.has(n.tagName))
24
+ if (n.nodeType === Node.ELEMENT_NODE && te.has(n.tagName))
24
25
  return n;
25
26
  n = n.parentNode;
26
27
  }
27
28
  return null;
28
29
  }
29
- function U(e) {
30
+ function Y(e) {
30
31
  const t = e.parentElement;
31
32
  if (t && t.classList.contains("rte-table-wrapper"))
32
33
  return t;
33
34
  const n = document.createElement("div");
34
35
  return n.className = "rte-table-wrapper", t?.insertBefore(n, e), n.appendChild(e), n;
35
36
  }
36
- const te = () => {
37
- const e = Z(), t = $(e);
37
+ const ne = () => {
38
+ const e = $(), t = ee(e);
38
39
  if (!t)
39
- return alert("Please place your cursor in the editor before inserting a table"), !1;
40
+ return Z("Please place your cursor in the editor before inserting a table"), !1;
40
41
  const n = window.getSelection();
41
42
  if (!n || n.rangeCount === 0) return;
42
43
  const o = n.getRangeAt(0), l = document.createElement("table");
43
44
  l.className = "rte-table";
44
45
  const r = document.createElement("thead"), a = document.createElement("tr");
45
46
  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), a.appendChild(g);
47
+ const g = document.createElement("th"), v = document.createElement("p");
48
+ v.appendChild(document.createElement("br")), g.appendChild(v), a.appendChild(g);
48
49
  }
49
50
  r.appendChild(a);
50
51
  const i = document.createElement("tbody");
51
52
  for (let m = 0; m < 2; m++) {
52
53
  const g = document.createElement("tr");
53
- for (let w = 0; w < 3; w++) {
54
- const x = document.createElement("td"), S = document.createElement("p");
55
- S.appendChild(document.createElement("br")), x.appendChild(S), g.appendChild(x);
54
+ for (let v = 0; v < 3; v++) {
55
+ const x = document.createElement("td"), A = document.createElement("p");
56
+ A.appendChild(document.createElement("br")), x.appendChild(A), g.appendChild(x);
56
57
  }
57
58
  i.appendChild(g);
58
59
  }
59
60
  l.appendChild(r), l.appendChild(i);
60
- const b = U(l), d = (m, g, w) => {
61
+ const u = Y(l), d = (m, g, v) => {
61
62
  if (m !== t) return m;
62
- const x = w ? g - 1 : g;
63
+ const x = v ? g - 1 : g;
63
64
  return t.childNodes[Math.min(Math.max(x, 0), t.childNodes.length - 1)] || null;
64
- }, s = d(o.endContainer, o.endOffset, !0), c = d(o.startContainer, o.startOffset, !1), C = s && K(s, t) || c && K(c, t);
65
- C && C.parentNode ? C.parentNode.insertBefore(b, C.nextSibling) : (o.collapse(!1), o.insertNode(b));
65
+ }, s = d(o.endContainer, o.endOffset, !0), c = d(o.startContainer, o.startOffset, !1), C = s && F(s, t) || c && F(c, t);
66
+ C && C.parentNode ? C.parentNode.insertBefore(u, C.nextSibling) : (o.collapse(!1), o.insertNode(u));
66
67
  const L = l.querySelector("th p");
67
68
  if (L) {
68
69
  const m = document.createRange();
69
70
  m.setStart(L, 0), m.collapse(!0), n.removeAllRanges(), n.addRange(m);
70
71
  }
71
72
  t.focus();
72
- }, ne = () => {
73
+ }, oe = () => {
73
74
  const e = f();
74
75
  if (!e) return;
75
76
  const { table: t, rowIndex: n } = e, o = document.createElement("tr"), l = t.rows[0]?.cells.length || 0;
76
77
  for (let a = 0; a < l; a++) {
77
- const i = document.createElement("td"), b = document.createElement("p");
78
- b.innerHTML = "<br>", i.appendChild(b), o.appendChild(i);
78
+ const i = document.createElement("td"), u = document.createElement("p");
79
+ u.innerHTML = "<br>", i.appendChild(u), o.appendChild(i);
79
80
  }
80
81
  const r = t.rows[n];
81
82
  r && r.parentElement ? r.parentElement.insertBefore(o, r) : t.appendChild(o), p();
82
- }, oe = () => {
83
+ }, re = () => {
83
84
  const e = f();
84
85
  if (!e) return;
85
86
  const { table: t, rowIndex: n } = e, o = document.createElement("tr"), l = t.rows[0]?.cells.length || 0;
@@ -95,7 +96,7 @@ const te = () => {
95
96
  r.parentElement?.insertBefore(o, r);
96
97
  }
97
98
  p();
98
- }, re = () => {
99
+ }, le = () => {
99
100
  const e = f();
100
101
  if (!e) return;
101
102
  const { table: t, colIndex: n } = e;
@@ -104,7 +105,7 @@ const te = () => {
104
105
  a.innerHTML = "<br>", r.appendChild(a), n === 0 ? l.insertBefore(r, l.cells[0]) : l.insertBefore(r, l.cells[n]);
105
106
  }
106
107
  p();
107
- }, le = () => {
108
+ }, ae = () => {
108
109
  const e = f();
109
110
  if (!e) return;
110
111
  const { table: t, colIndex: n } = e;
@@ -113,12 +114,12 @@ const te = () => {
113
114
  a.innerHTML = "<br>", r.appendChild(a), n >= l.cells.length - 1 ? l.appendChild(r) : l.insertBefore(r, l.cells[n + 1]);
114
115
  }
115
116
  p();
116
- }, ae = () => {
117
+ }, ie = () => {
117
118
  const e = f();
118
119
  if (!e || e.rowCount <= 1) return;
119
120
  const { table: t, rowIndex: n, colIndex: o } = e;
120
121
  t.deleteRow(n), G(t, n, o), p();
121
- }, ie = () => {
122
+ }, de = () => {
122
123
  const e = f();
123
124
  if (!e || e.cellCount <= 1) return;
124
125
  const { table: t, rowIndex: n, colIndex: o } = e;
@@ -127,7 +128,7 @@ const te = () => {
127
128
  r.cells[o] && r.deleteCell(o);
128
129
  }
129
130
  G(t, n, o), p();
130
- }, de = () => {
131
+ }, se = () => {
131
132
  const e = f();
132
133
  if (!e) return;
133
134
  const { table: t, rowIndex: n } = e, o = t.rows[n];
@@ -139,15 +140,15 @@ const te = () => {
139
140
  const i = t.querySelector("tbody") || t.appendChild(document.createElement("tbody"));
140
141
  i.insertBefore(o, i.firstChild), a.rows.length === 0 && a.remove();
141
142
  } else
142
- F(o, "td");
143
+ U(o, "td");
143
144
  } else if (!r || o === t.tBodies[0]?.rows[0]) {
144
145
  let a = r;
145
146
  a || (a = document.createElement("thead"), t.insertBefore(a, t.firstChild)), a.appendChild(o);
146
147
  } else
147
- F(o, "th");
148
+ U(o, "th");
148
149
  p();
149
150
  };
150
- function F(e, t) {
151
+ function U(e, t) {
151
152
  Array.from(e.cells).forEach((n) => {
152
153
  if (n.tagName.toLowerCase() === t) return;
153
154
  const o = document.createElement(t);
@@ -159,7 +160,7 @@ function F(e, t) {
159
160
  n.parentNode?.replaceChild(o, n);
160
161
  });
161
162
  }
162
- const se = () => {
163
+ const ce = () => {
163
164
  const e = f();
164
165
  if (!e) return;
165
166
  const { table: t, colIndex: n } = e;
@@ -169,34 +170,34 @@ const se = () => {
169
170
  const r = l.tagName.toLowerCase() === "th" ? "td" : "th", a = document.createElement(r);
170
171
  a.innerHTML = l.innerHTML;
171
172
  for (let i = 0; i < l.attributes.length; i++) {
172
- const b = l.attributes[i];
173
- a.setAttribute(b.name, b.value);
173
+ const u = l.attributes[i];
174
+ a.setAttribute(u.name, u.value);
174
175
  }
175
176
  l.parentNode?.replaceChild(a, l);
176
177
  }
177
178
  }
178
179
  p();
179
- }, ce = () => {
180
+ }, ue = () => {
180
181
  const e = f();
181
182
  if (!e) return;
182
183
  const t = e.table, n = t.parentElement;
183
184
  n && n.classList.contains("rte-table-wrapper") ? n.remove() : t.remove(), document.dispatchEvent(new CustomEvent("tableDeleted"));
184
185
  };
185
- function v(e, t) {
186
+ function w(e, t) {
186
187
  if (!e || !(e instanceof Node)) return null;
187
188
  const n = e.nodeType === Node.ELEMENT_NODE ? e : e.parentElement;
188
189
  return n ? n.closest(t) : null;
189
190
  }
190
- function Y(e) {
191
+ function M(e) {
191
192
  if (!e) return !1;
192
193
  const t = e.closest("[contenteditable]");
193
194
  return !t || t.getAttribute("contenteditable") === "false" ? !1 : !t.closest('[data-readonly="true"]');
194
195
  }
195
- function ue() {
196
+ function he() {
196
197
  const e = window.getSelection(), t = e && e.rangeCount > 0 ? e.getRangeAt(0).startContainer : null;
197
- return v(t, ".rte-content") || (h ? h.closest(".rte-content") : null);
198
+ return w(t, ".rte-content") || (b ? b.closest(".rte-content") : null);
198
199
  }
199
- function he(e, t, n) {
200
+ function be(e, t, n) {
200
201
  const o = window.execEditorCommand || window.executeEditorCommand;
201
202
  if (typeof o == "function")
202
203
  try {
@@ -205,12 +206,12 @@ function he(e, t, n) {
205
206
  }
206
207
  }
207
208
  function j(e) {
208
- const t = ue();
209
- if (t && !Y(t)) return;
209
+ const t = he();
210
+ if (t && !M(t)) return;
210
211
  const n = t ? t.innerHTML : "";
211
212
  if (e(), !t) return;
212
213
  const o = t.innerHTML;
213
- o !== n && (he(t, n, o), t.dispatchEvent(new Event("input", { bubbles: !0 })));
214
+ o !== n && (be(t, n, o), t.dispatchEvent(new Event("input", { bubbles: !0 })));
214
215
  }
215
216
  function G(e, t, n) {
216
217
  if (!e.isConnected || e.rows.length === 0) return;
@@ -221,12 +222,12 @@ function G(e, t, n) {
221
222
  const i = window.getSelection();
222
223
  i?.removeAllRanges(), i?.addRange(r);
223
224
  }
224
- const be = () => {
225
+ const me = () => {
225
226
  const e = window.getSelection();
226
227
  if (!e || e.rangeCount === 0) return;
227
228
  const n = e.getRangeAt(0).startContainer;
228
- if (!v(n, "table")) return;
229
- const o = v(n, "td, th");
229
+ if (!w(n, "table")) return;
230
+ const o = w(n, "td, th");
230
231
  if (!o) return;
231
232
  const l = o.parentElement;
232
233
  if (!l) return;
@@ -251,18 +252,18 @@ const be = () => {
251
252
  function f() {
252
253
  const e = window.getSelection();
253
254
  if (!e || e.rangeCount === 0) return null;
254
- const n = e.getRangeAt(0).startContainer, o = v(n, "table");
255
+ const n = e.getRangeAt(0).startContainer, o = w(n, "table");
255
256
  if (!o) return null;
256
257
  let l = 0, r = 0;
257
- const a = v(n, "td, th");
258
+ const a = w(n, "td, th");
258
259
  if (a) {
259
260
  const i = a.parentElement;
260
261
  for (; i && i !== o.rows[l] && (l++, !(l >= o.rows.length)); )
261
262
  ;
262
- const b = i;
263
- if (b) {
264
- for (let d = 0; d < b.cells.length; d++)
265
- if (b.cells[d] === a) {
263
+ const u = i;
264
+ if (u) {
265
+ for (let d = 0; d < u.cells.length; d++)
266
+ if (u.cells[d] === a) {
266
267
  r = d;
267
268
  break;
268
269
  }
@@ -277,45 +278,65 @@ function f() {
277
278
  };
278
279
  }
279
280
  function p() {
280
- if (!u || !h) return;
281
+ if (!h || !b) return;
281
282
  const e = f();
282
283
  if (!e) return;
283
284
  const t = e.rowCount > 1, n = e.cellCount > 1;
284
285
  J(t, n);
285
286
  }
286
- function me() {
287
- A = () => {
287
+ function fe(e) {
288
+ const t = window.getSelection();
289
+ if (!t) return;
290
+ const n = document.createRange();
291
+ (e.textContent ?? "").trim() === "" ? (n.selectNodeContents(e.querySelector("p, div") || e), n.collapse(!0)) : n.selectNodeContents(e), t.removeAllRanges(), t.addRange(n);
292
+ }
293
+ function pe(e) {
294
+ if (e.key !== "Tab" || e.defaultPrevented || e.ctrlKey || e.metaKey || e.altKey) return;
295
+ const t = window.getSelection();
296
+ if (!t || t.rangeCount === 0) return;
297
+ const n = w(t.getRangeAt(0).startContainer, "td, th"), o = n?.closest("table");
298
+ if (!n || !o || !M(o)) return;
299
+ const l = o.closest("[contenteditable]");
300
+ if (!l || !(e.target instanceof Node) || !l.contains(e.target)) return;
301
+ const r = Array.from(o.querySelectorAll("th, td")).filter(
302
+ (u) => u.closest("table") === o
303
+ ), a = r.indexOf(n);
304
+ let i;
305
+ e.shiftKey ? i = r[a - 1] : a < r.length - 1 ? i = r[a + 1] : (y("addRowBelow"), i = n.parentElement?.nextElementSibling?.querySelector("th, td")), i && (e.preventDefault(), fe(i));
306
+ }
307
+ function ge() {
308
+ V = () => {
288
309
  const e = f();
289
- e && Y(e.table) ? fe(e.table) : R();
290
- }, V = (e) => {
291
- const t = v(e.target, "table"), n = v(e.target, ".table-toolbar");
292
- !t && !n && R();
293
- }, B = () => {
294
- R();
310
+ e && M(e.table) ? we(e.table) : T();
311
+ }, B = (e) => {
312
+ const t = w(e.target, "table"), n = w(e.target, ".table-toolbar");
313
+ !t && !n && T();
295
314
  }, N = () => {
296
- h && u && u.style.display !== "none" && M(h);
315
+ T();
297
316
  }, D = () => {
298
- h && u && u.style.display !== "none" && M(h);
299
- }, document.addEventListener("selectionchange", A), document.addEventListener("mousedown", V), document.addEventListener("tableDeleted", B), window.addEventListener("scroll", N, !0), window.addEventListener("resize", D);
317
+ b && h && h.style.display !== "none" && S(b);
318
+ }, q = () => {
319
+ b && h && h.style.display !== "none" && S(b);
320
+ }, document.addEventListener("selectionchange", V), document.addEventListener("keydown", pe), document.addEventListener("mousedown", B), document.addEventListener("tableDeleted", N), window.addEventListener("scroll", D, !0), window.addEventListener("resize", q);
300
321
  }
301
- function M(e) {
302
- if (!u) return;
303
- const t = e.getBoundingClientRect(), n = u.getBoundingClientRect(), o = n.height || 40, l = n.width || 280, r = 10;
322
+ function S(e) {
323
+ if (!h) return;
324
+ const t = e.getBoundingClientRect(), n = h.getBoundingClientRect(), o = n.height || 40, l = n.width || 280, r = 10;
304
325
  let a = t.top - o - r, i = t.left + t.width / 2 - l / 2;
305
326
  a < r && (a = t.bottom + r), i < r && (i = r);
306
- const b = window.innerWidth;
307
- i + l > b - r && (i = b - l - r);
327
+ const u = window.innerWidth;
328
+ i + l > u - r && (i = u - l - r);
308
329
  const d = window.innerHeight;
309
- a + o > d - r && (a = d - o - r), u.style.top = a + "px", u.style.left = i + "px";
330
+ a + o > d - r && (a = d - o - r), h.style.top = a + "px", h.style.left = i + "px";
310
331
  }
311
- function fe(e) {
312
- h = e, u || (u = ge(), document.body.appendChild(u));
332
+ function we(e) {
333
+ b = e, h || (h = Ce(), document.body.appendChild(h));
313
334
  const t = !!e.closest(H) || document.body.matches(H) || document.documentElement.matches(H);
314
- u.classList.toggle("rte-theme-dark", t), u.style.display = "flex", u.style.visibility = "hidden", requestAnimationFrame(() => {
315
- M(e), u && (u.style.visibility = "visible");
335
+ h.classList.toggle("rte-theme-dark", t), h.style.display = "flex", h.style.visibility = "hidden", requestAnimationFrame(() => {
336
+ S(e), h && (h.style.visibility = "visible");
316
337
  });
317
338
  const n = f();
318
- n && J(n.rowCount > 1, n.cellCount > 1), we(e);
339
+ n && J(n.rowCount > 1, n.cellCount > 1), ye(e);
319
340
  }
320
341
  const I = /* @__PURE__ */ new Set();
321
342
  function Q() {
@@ -323,27 +344,27 @@ function Q() {
323
344
  e.style.position === "relative" && (e.style.removeProperty("position"), e.getAttribute("style")?.trim() || e.removeAttribute("style"));
324
345
  }), I.clear();
325
346
  }
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?.classList.contains("rte-table-wrapper") ? t.querySelector(".table-resize-handle") : h.querySelector(".table-resize-handle");
347
+ function T() {
348
+ if (h && (h.style.display = "none"), b) {
349
+ b.querySelectorAll(".resize-handle").forEach((o) => o.remove());
350
+ const t = b.parentElement, n = t?.classList.contains("rte-table-wrapper") ? t.querySelector(".table-resize-handle") : b.querySelector(".table-resize-handle");
330
351
  n && n.remove();
331
352
  }
332
- Q(), h = null;
353
+ Q(), b = null;
333
354
  }
334
355
  function J(e, t) {
335
- if (!u) return;
336
- const n = u.querySelector('[data-action="deleteRow"]'), o = u.querySelector('[data-action="deleteColumn"]');
356
+ if (!h) return;
357
+ const n = h.querySelector('[data-action="deleteRow"]'), o = h.querySelector('[data-action="deleteColumn"]');
337
358
  n && (n.disabled = !e), o && (o.disabled = !t);
338
359
  }
339
- let T = !1;
340
- function pe() {
341
- if (T || typeof document > "u") return;
360
+ let z = !1;
361
+ function ve() {
362
+ if (z || typeof document > "u") return;
342
363
  if (document.getElementById("rte-table-toolbar-styles")) {
343
- T = !0;
364
+ z = !0;
344
365
  return;
345
366
  }
346
- T = !0;
367
+ z = !0;
347
368
  const e = document.createElement("style");
348
369
  e.id = "rte-table-toolbar-styles", e.textContent = `
349
370
  .table-toolbar {
@@ -500,8 +521,8 @@ function pe() {
500
521
  }
501
522
  `, document.head.appendChild(e);
502
523
  }
503
- function ge() {
504
- pe();
524
+ function Ce() {
525
+ ve();
505
526
  const e = document.createElement("div");
506
527
  e.className = "table-toolbar", e.style.cssText = `
507
528
  position: fixed;
@@ -510,7 +531,7 @@ function ge() {
510
531
  `, e.setAttribute("role", "toolbar"), e.setAttribute("aria-label", "Table editing toolbar");
511
532
  const t = (s) => {
512
533
  const c = document.createElement("button");
513
- return c.className = "toolbar-icon-btn", s.danger && c.classList.add("toolbar-icon-btn-danger"), s.delete && c.classList.add("toolbar-icon-btn-delete"), c.innerHTML = s.icon, c.title = s.title, c.setAttribute("aria-label", s.title), c.setAttribute("type", "button"), c.setAttribute("data-action", s.action), c.onclick = () => E(s.action), c;
534
+ return c.className = "toolbar-icon-btn", s.danger && c.classList.add("toolbar-icon-btn-danger"), s.delete && c.classList.add("toolbar-icon-btn-delete"), c.innerHTML = s.icon, c.title = s.title, c.setAttribute("aria-label", s.title), c.setAttribute("type", "button"), c.setAttribute("data-action", s.action), c.onclick = () => y(s.action), c;
514
535
  }, n = () => {
515
536
  const s = document.createElement("div");
516
537
  return s.className = "toolbar-divider", s;
@@ -519,115 +540,115 @@ function ge() {
519
540
  return c.className = "toolbar-section", s.forEach((C) => c.appendChild(C)), c;
520
541
  }, l = o(
521
542
  t({
522
- icon: ye(),
543
+ icon: xe(),
523
544
  title: "Add row above (Ctrl+Shift+R)",
524
545
  action: "addRowAbove"
525
546
  }),
526
547
  t({
527
- icon: ke(),
548
+ icon: He(),
528
549
  title: "Add row below",
529
550
  action: "addRowBelow"
530
551
  }),
531
552
  t({
532
- icon: Ee(),
553
+ icon: Re(),
533
554
  title: "Delete row",
534
555
  action: "deleteRow",
535
556
  danger: !0
536
557
  })
537
558
  ), r = o(
538
559
  t({
539
- icon: xe(),
560
+ icon: Te(),
540
561
  title: "Add column left",
541
562
  action: "addColumnLeft"
542
563
  }),
543
564
  t({
544
- icon: He(),
565
+ icon: ze(),
545
566
  title: "Add column right (Ctrl+Shift+C)",
546
567
  action: "addColumnRight"
547
568
  }),
548
569
  t({
549
- icon: ze(),
570
+ icon: Se(),
550
571
  title: "Delete column",
551
572
  action: "deleteColumn",
552
573
  danger: !0
553
574
  })
554
575
  ), a = o(
555
576
  t({
556
- icon: Re(),
577
+ icon: Ie(),
557
578
  title: "Toggle header row",
558
579
  action: "toggleHeaderRow"
559
580
  }),
560
581
  t({
561
- icon: Te(),
582
+ icon: Me(),
562
583
  title: "Toggle header column",
563
584
  action: "toggleHeaderColumn"
564
585
  })
565
586
  ), i = o(
566
587
  t({
567
- icon: Ie(),
588
+ icon: Ae(),
568
589
  title: "Merge cells (horizontally)",
569
590
  action: "mergeCells"
570
591
  })
571
- ), b = o(
592
+ ), u = o(
572
593
  t({
573
- icon: Me(),
594
+ icon: Le(),
574
595
  title: "Delete table",
575
596
  action: "deleteTable",
576
597
  delete: !0
577
598
  })
578
599
  );
579
- e.appendChild(l), e.appendChild(n()), e.appendChild(r), e.appendChild(n()), e.appendChild(a), e.appendChild(n()), e.appendChild(i), e.appendChild(n()), e.appendChild(b);
600
+ e.appendChild(l), e.appendChild(n()), e.appendChild(r), e.appendChild(n()), e.appendChild(a), e.appendChild(n()), e.appendChild(i), e.appendChild(n()), e.appendChild(u);
580
601
  const d = (s) => {
581
- !u || u.style.display === "none" || (s.ctrlKey || s.metaKey) && s.shiftKey && (s.key === "r" || s.key === "R" ? (s.preventDefault(), E("addRowBelow")) : (s.key === "c" || s.key === "C") && (s.preventDefault(), E("addColumnRight")));
602
+ !h || h.style.display === "none" || (s.ctrlKey || s.metaKey) && s.shiftKey && (s.key === "r" || s.key === "R" ? (s.preventDefault(), y("addRowBelow")) : (s.key === "c" || s.key === "C") && (s.preventDefault(), y("addColumnRight")));
582
603
  };
583
604
  return window.addEventListener("keydown", d), e;
584
605
  }
585
- function E(e) {
606
+ function y(e) {
586
607
  j(() => {
587
608
  switch (e) {
588
609
  case "addRowAbove":
589
- ne();
610
+ oe();
590
611
  break;
591
612
  case "addRowBelow":
592
- oe();
613
+ re();
593
614
  break;
594
615
  case "addColumnLeft":
595
- re();
616
+ le();
596
617
  break;
597
618
  case "addColumnRight":
598
- le();
619
+ ae();
599
620
  break;
600
621
  case "deleteRow":
601
- ae();
622
+ ie();
602
623
  break;
603
624
  case "deleteColumn":
604
- ie();
625
+ de();
605
626
  break;
606
627
  case "toggleHeaderRow":
607
- de();
628
+ se();
608
629
  break;
609
630
  case "toggleHeaderColumn":
610
- se();
631
+ ce();
611
632
  break;
612
633
  case "deleteTable":
613
- ce();
634
+ ue();
614
635
  break;
615
636
  case "mergeCells":
616
- be();
637
+ me();
617
638
  break;
618
639
  }
619
640
  });
620
641
  }
621
- function we(e) {
622
- const t = U(e);
642
+ function ye(e) {
643
+ const t = Y(e);
623
644
  e.querySelectorAll(".resize-handle").forEach((i) => i.remove());
624
645
  const o = t.querySelector(".table-resize-handle");
625
646
  o && o.remove(), Q();
626
647
  const l = e.querySelector("thead tr, tbody tr:first-child");
627
648
  if (!l) return;
628
649
  const r = l.querySelectorAll("td, th");
629
- r.forEach((i, b) => {
630
- if (b === r.length - 1) return;
650
+ r.forEach((i, u) => {
651
+ if (u === r.length - 1) return;
631
652
  const d = document.createElement("div");
632
653
  d.className = "resize-handle", d.style.cssText = `
633
654
  position: absolute;
@@ -640,93 +661,93 @@ function we(e) {
640
661
  z-index: 10;
641
662
  transition: background 0.15s ease;
642
663
  `, d.addEventListener("mouseenter", () => {
643
- k || (d.style.background = "rgba(0, 102, 204, 0.3)");
664
+ E || (d.style.background = "rgba(0, 102, 204, 0.3)");
644
665
  }), d.addEventListener("mouseleave", () => {
645
- k || (d.style.background = "transparent");
666
+ E || (d.style.background = "transparent");
646
667
  }), d.addEventListener("mousedown", (c) => {
647
- c.preventDefault(), c.stopPropagation(), ve(c, b);
668
+ c.preventDefault(), c.stopPropagation(), ke(c, u);
648
669
  });
649
670
  const s = i;
650
671
  s.style.position || (s.style.position = "relative", I.add(s)), i.appendChild(d);
651
672
  });
652
673
  const a = document.createElement("div");
653
674
  a.className = "table-resize-handle", a.addEventListener("mousedown", (i) => {
654
- i.preventDefault(), i.stopPropagation(), Ce(i);
675
+ i.preventDefault(), i.stopPropagation(), Ee(i);
655
676
  }), t.appendChild(a);
656
677
  }
657
- function ve(e, t) {
658
- if (k = !0, y = t, q = e.clientX, !h) return;
659
- const n = h.querySelector("thead tr, tbody tr:first-child");
660
- n && n.cells[t] && (O = n.cells[t].offsetWidth), document.body.style.cursor = "col-resize", document.body.style.userSelect = "none";
678
+ function ke(e, t) {
679
+ if (E = !0, k = t, O = e.clientX, !b) return;
680
+ const n = b.querySelector("thead tr, tbody tr:first-child");
681
+ n && n.cells[t] && (P = n.cells[t].offsetWidth), document.body.style.cursor = "col-resize", document.body.style.userSelect = "none";
661
682
  const o = (r) => {
662
- if (!k || y === null || !h) return;
663
- const a = r.clientX - q, i = Math.max(50, O + a);
664
- h.querySelectorAll("tr").forEach((d) => {
665
- d.cells[y] && (d.cells[y].style.width = i + "px");
683
+ if (!E || k === null || !b) return;
684
+ const a = r.clientX - O, i = Math.max(50, P + a);
685
+ b.querySelectorAll("tr").forEach((d) => {
686
+ d.cells[k] && (d.cells[k].style.width = i + "px");
666
687
  });
667
688
  }, l = () => {
668
- k = !1, y = null, document.body.style.cursor = "", document.body.style.userSelect = "", document.removeEventListener("mousemove", o), document.removeEventListener("mouseup", l);
689
+ E = !1, k = null, document.body.style.cursor = "", document.body.style.userSelect = "", document.removeEventListener("mousemove", o), document.removeEventListener("mouseup", l);
669
690
  };
670
691
  document.addEventListener("mousemove", o), document.addEventListener("mouseup", l);
671
692
  }
672
- function Ce(e) {
673
- if (!h) return;
674
- z = !0, P = e.clientX, W = e.clientY, _ = h.offsetWidth, X = h.offsetHeight, document.body.style.cursor = "nwse-resize", document.body.style.userSelect = "none";
693
+ function Ee(e) {
694
+ if (!b) return;
695
+ R = !0, K = e.clientX, W = e.clientY, _ = b.offsetWidth, X = b.offsetHeight, document.body.style.cursor = "nwse-resize", document.body.style.userSelect = "none";
675
696
  const t = (o) => {
676
- if (!z || !h) return;
677
- const l = o.clientX - P, r = o.clientY - W, a = Math.max(200, _ + l), i = Math.max(100, X + r);
678
- h.style.width = a + "px", h.style.height = i + "px";
697
+ if (!R || !b) return;
698
+ const l = o.clientX - K, r = o.clientY - W, a = Math.max(200, _ + l), i = Math.max(100, X + r);
699
+ b.style.width = a + "px", b.style.height = i + "px";
679
700
  }, n = () => {
680
- z = !1, document.body.style.cursor = "", document.body.style.userSelect = "", document.removeEventListener("mousemove", t), document.removeEventListener("mouseup", n);
701
+ R = !1, document.body.style.cursor = "", document.body.style.userSelect = "", document.removeEventListener("mousemove", t), document.removeEventListener("mouseup", n);
681
702
  };
682
703
  document.addEventListener("mousemove", t), document.addEventListener("mouseup", n);
683
704
  }
684
- function ye() {
705
+ function xe() {
685
706
  return `<svg width="16" height="16" viewBox="0 0 16 16" fill="currentColor">
686
707
  <path d="M2 7h12V5H2v2zm0 4h12V9H2v2zM8 1v3H5v2h3v3h2V6h3V4h-3V1H8z"/>
687
708
  </svg>`;
688
709
  }
689
- function ke() {
710
+ function He() {
690
711
  return `<svg width="16" height="16" viewBox="0 0 16 16" fill="currentColor">
691
712
  <path d="M2 3h12V1H2v2zm0 4h12V5H2v2zm6 4v3h3v-2h2v-2h-2v-3h-2v3H5v2h3z"/>
692
713
  </svg>`;
693
714
  }
694
- function Ee() {
715
+ function Re() {
695
716
  return `<svg width="16" height="16" viewBox="0 0 16 16" fill="currentColor">
696
717
  <path d="M2 5h12v2H2V5zm0 4h12v2H2V9zm4-6v2H4v2h2v2h2V7h2V5H8V3H6z"/>
697
718
  </svg>`;
698
719
  }
699
- function xe() {
720
+ function Te() {
700
721
  return `<svg width="16" height="16" viewBox="0 0 16 16" fill="currentColor">
701
722
  <path d="M7 2v12h2V2H7zm4 0v12h2V2h-2zM1 8h3v-3H1v3zm3 2H1v3h3v-3z"/>
702
723
  </svg>`;
703
724
  }
704
- function He() {
725
+ function ze() {
705
726
  return `<svg width="16" height="16" viewBox="0 0 16 16" fill="currentColor">
706
727
  <path d="M2 2v12h2V2H2zm4 0v12h2V2H6zM12 8h3v-3h-3v3zm0 2h3v3h-3v-3z"/>
707
728
  </svg>`;
708
729
  }
709
- function ze() {
730
+ function Se() {
710
731
  return `<svg width="16" height="16" viewBox="0 0 16 16" fill="currentColor">
711
732
  <path d="M5 2v12h2V2H5zm4 0v12h2V2H9zm3 2h3V1h-3v3zm3 2h-3v3h3V6zm0 4h-3v3h3v-3z"/>
712
733
  </svg>`;
713
734
  }
714
- function Re() {
735
+ function Ie() {
715
736
  return `<svg width="16" height="16" viewBox="0 0 16 16" fill="currentColor">
716
737
  <path d="M2 2h12v3H2V2zm0 5h12v8H2V7zm2 2v4h2V9H4zm4 0v4h2V9H8zm4 0v4h2V9h-2z"/>
717
738
  </svg>`;
718
739
  }
719
- function Te() {
740
+ function Me() {
720
741
  return `<svg width="16" height="16" viewBox="0 0 16 16" fill="currentColor">
721
742
  <path d="M2 2v12h3V2H2zm5 0v12h8V2H7zm2 2h4v2H9V4zm0 4h4v2H9V8zm0 4h4v2H9v-2z"/>
722
743
  </svg>`;
723
744
  }
724
- function Me() {
745
+ function Le() {
725
746
  return `<svg width="16" height="16" viewBox="0 0 16 16" fill="currentColor">
726
747
  <path d="M3 1h10v1H3V1zm1 2v11h8V3H4zM6 5h1v6H6V5zm3 0h1v6H9V5z"/>
727
748
  </svg>`;
728
749
  }
729
- function Ie() {
750
+ function Ae() {
730
751
  return `<svg width="16" height="16" viewBox="0 0 16 16" fill="currentColor">
731
752
  <path d="M2 2h4v3H2V2zm5 0h4v3H7V2zm5 0h2v3h-2V2zm-10 4h4v3H2V6zm5 0h4v3H7V6zm5 0h2v3h-2V6zm-10 4h4v3H2v-3zm5 0h4v3H7v-3zm5 0h2v3h-2v-3z"/>
732
753
  </svg>`;
@@ -734,11 +755,11 @@ function Ie() {
734
755
  if (typeof window < "u" && !window.__tablePluginInitialized) {
735
756
  window.__tablePluginInitialized = !0;
736
757
  const e = () => {
737
- me();
758
+ ge();
738
759
  };
739
760
  document.readyState === "loading" ? document.addEventListener("DOMContentLoaded", e) : setTimeout(e, 100);
740
761
  }
741
- const Se = () => ({
762
+ const Ne = () => ({
742
763
  name: "table",
743
764
  toolbar: [
744
765
  {
@@ -749,14 +770,14 @@ const Se = () => ({
749
770
  ],
750
771
  commands: {
751
772
  insertTable: () => (j(() => {
752
- te();
773
+ ne();
753
774
  }), !0)
754
775
  },
755
776
  keymap: {
756
- "Mod-Shift-r": () => (E("addRowBelow"), !0),
757
- "Mod-Shift-c": () => (E("addColumnRight"), !0)
777
+ "Mod-Shift-r": () => (y("addRowBelow"), !0),
778
+ "Mod-Shift-c": () => (y("addColumnRight"), !0)
758
779
  }
759
780
  });
760
781
  export {
761
- Se as TablePlugin
782
+ Ne as TablePlugin
762
783
  };