@editora/plugins 1.0.16 → 1.0.18

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