@editora/core 1.0.3 → 1.0.4

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 (131) hide show
  1. package/README.md +34 -0
  2. package/dist/{A11yCheckerPlugin.native-CZKpi3uF.mjs → A11yCheckerPlugin.native-BRdGYMju.mjs} +225 -173
  3. package/dist/AnchorPlugin.native-C1Rw5m04.mjs +404 -0
  4. package/dist/BackgroundColorPlugin.native-BE-p9DRd.mjs +489 -0
  5. package/dist/ChecklistPlugin.native-nuSSEFNI.mjs +309 -0
  6. package/dist/ClearFormattingPlugin.native-Bq_XcTh2.mjs +140 -0
  7. package/dist/{CodePlugin.native-CK9d8rmt.mjs → CodePlugin.native-0Zari_zp.mjs} +329 -310
  8. package/dist/CodeSamplePlugin.native-B-KS1pOl.mjs +384 -0
  9. package/dist/CommentsPlugin.native-tMnWn8a2.mjs +723 -0
  10. package/dist/DirectionPlugin.native-CDnbdNyl.mjs +130 -0
  11. package/dist/{EmbedIframePlugin.native-ifr9KLdN.mjs → EmbedIframePlugin.native-CSWIB1jm.mjs} +154 -50
  12. package/dist/{EmojisPlugin.native-D6mJSnSR.mjs → EmojisPlugin.native-DxTm_DL-.mjs} +156 -103
  13. package/dist/FontFamilyPlugin.native-j8hMTbg4.mjs +158 -0
  14. package/dist/FontSizePlugin.native-B_jCh7dY.mjs +286 -0
  15. package/dist/FootnotePlugin.native-D730OGRm.mjs +425 -0
  16. package/dist/HistoryPlugin.native-DCrPdeSW.mjs +257 -0
  17. package/dist/IndentPlugin.native-BHixp8sP.mjs +150 -0
  18. package/dist/LineHeightPlugin.native-CM7iXdQj.mjs +151 -0
  19. package/dist/{LinkPlugin.native-BdAOV-iu.mjs → LinkPlugin.native-CS2g-G18.mjs} +128 -53
  20. package/dist/{ListPlugin.native-CLFU5AUQ.mjs → ListPlugin.native-V7EZC1lM.mjs} +59 -12
  21. package/dist/MathPlugin.native-KUxz0o8C.mjs +251 -0
  22. package/dist/MediaManagerPlugin.native-CgP5iInD.mjs +970 -0
  23. package/dist/MergeTagPlugin.native-CU9LtsfD.mjs +416 -0
  24. package/dist/PageBreakPlugin.native-CGiQxXqR.mjs +297 -0
  25. package/dist/{PrintPlugin.native-BUpm52VJ.mjs → PrintPlugin.native-7qt5v7L5.mjs} +10 -10
  26. package/dist/{SpecialCharactersPlugin.native-x7a2SWXc.mjs → SpecialCharactersPlugin.native-DANrbExJ.mjs} +143 -97
  27. package/dist/SpellCheckPlugin.native-C8bPvRHy.mjs +1019 -0
  28. package/dist/StrikethroughPlugin.native-0Be7j49s.mjs +73 -0
  29. package/dist/{TablePlugin.native-EEWXn1-s.mjs → TablePlugin.native-DrHX-efe.mjs} +149 -145
  30. package/dist/TemplatePlugin.native-4lKEm-WY.mjs +578 -0
  31. package/dist/TextAlignmentPlugin.native-sM_1s00t.mjs +108 -0
  32. package/dist/{TextColorPlugin.native-D6SmTglm.mjs → TextColorPlugin.native-Clgtb50j.mjs} +173 -92
  33. package/dist/colorSelectionApply-CK1My9N2.mjs +67 -0
  34. package/dist/core.css +1 -1
  35. package/dist/editora.min.js +31 -29
  36. package/dist/editora.umd.js +31 -29
  37. package/dist/index-CqWQFb3D.js +10 -0
  38. package/dist/index-OwnkG39N.mjs +2227 -0
  39. package/dist/index.cjs.js +14 -18
  40. package/dist/index.esm.js +204 -521
  41. package/dist/plugin-loader.js +26 -26
  42. package/dist/webcomponent-core.js +1286 -295
  43. package/dist/webcomponent-core.min.css +1 -1
  44. package/dist/webcomponent-core.min.js +100 -75
  45. package/dist/webcomponent.cjs.js +1 -1
  46. package/dist/webcomponent.esm.js +1 -1
  47. package/dist/webcomponent.js +1252 -261
  48. package/dist/webcomponent.min.css +1 -1
  49. package/dist/webcomponent.min.js +3616 -2109
  50. package/index.d.ts +355 -0
  51. package/package.json +19 -17
  52. package/dist/A11yCheckerPlugin.native-CZKpi3uF.mjs.map +0 -1
  53. package/dist/AnchorPlugin.native-7es9PVZ9.mjs +0 -340
  54. package/dist/AnchorPlugin.native-7es9PVZ9.mjs.map +0 -1
  55. package/dist/BackgroundColorPlugin.native-Dip5uqTg.mjs +0 -449
  56. package/dist/BackgroundColorPlugin.native-Dip5uqTg.mjs.map +0 -1
  57. package/dist/BlockquotePlugin.native-JFmOLsxN.mjs.map +0 -1
  58. package/dist/BoldPlugin.native-BAzzoqU5.mjs.map +0 -1
  59. package/dist/CapitalizationPlugin.native-DOMsh5R7.mjs.map +0 -1
  60. package/dist/ChecklistPlugin.native-Dccs3nLe.mjs +0 -153
  61. package/dist/ChecklistPlugin.native-Dccs3nLe.mjs.map +0 -1
  62. package/dist/ClearFormattingPlugin.native-BZPDHswo.mjs +0 -27
  63. package/dist/ClearFormattingPlugin.native-BZPDHswo.mjs.map +0 -1
  64. package/dist/CodePlugin.native-CK9d8rmt.mjs.map +0 -1
  65. package/dist/CodeSamplePlugin.native-DMbEdO9j.mjs +0 -326
  66. package/dist/CodeSamplePlugin.native-DMbEdO9j.mjs.map +0 -1
  67. package/dist/CommentsPlugin.native-2zQV8Ia4.mjs +0 -473
  68. package/dist/CommentsPlugin.native-2zQV8Ia4.mjs.map +0 -1
  69. package/dist/DirectionPlugin.native-Be7wCzkI.mjs +0 -59
  70. package/dist/DirectionPlugin.native-Be7wCzkI.mjs.map +0 -1
  71. package/dist/DocumentManagerPlugin.native-BvZL5CSG.mjs.map +0 -1
  72. package/dist/EmbedIframePlugin.native-ifr9KLdN.mjs.map +0 -1
  73. package/dist/EmojisPlugin.native-D6mJSnSR.mjs.map +0 -1
  74. package/dist/FontFamilyPlugin.native-BzS_9qbM.mjs +0 -106
  75. package/dist/FontFamilyPlugin.native-BzS_9qbM.mjs.map +0 -1
  76. package/dist/FontSizePlugin.native-DkLMLPue.mjs +0 -186
  77. package/dist/FontSizePlugin.native-DkLMLPue.mjs.map +0 -1
  78. package/dist/FootnotePlugin.native-BciVc9W6.mjs +0 -128
  79. package/dist/FootnotePlugin.native-BciVc9W6.mjs.map +0 -1
  80. package/dist/FullscreenPlugin.native-ChXyxeNw.mjs.map +0 -1
  81. package/dist/HeadingPlugin.native-DrLYwQnQ.mjs.map +0 -1
  82. package/dist/HistoryPlugin.native-DoDRifCf.mjs +0 -89
  83. package/dist/HistoryPlugin.native-DoDRifCf.mjs.map +0 -1
  84. package/dist/IndentPlugin.native-CbFugPoi.mjs +0 -133
  85. package/dist/IndentPlugin.native-CbFugPoi.mjs.map +0 -1
  86. package/dist/ItalicPlugin.native-CQjjDyUL.mjs.map +0 -1
  87. package/dist/LineHeightPlugin.native-CWQT2FIa.mjs +0 -73
  88. package/dist/LineHeightPlugin.native-CWQT2FIa.mjs.map +0 -1
  89. package/dist/LinkPlugin.native-BdAOV-iu.mjs.map +0 -1
  90. package/dist/ListPlugin.native-CLFU5AUQ.mjs.map +0 -1
  91. package/dist/MathPlugin.native-DE_ii-LA.mjs +0 -182
  92. package/dist/MathPlugin.native-DE_ii-LA.mjs.map +0 -1
  93. package/dist/MediaManagerPlugin.native-DaYFDzNM.mjs +0 -533
  94. package/dist/MediaManagerPlugin.native-DaYFDzNM.mjs.map +0 -1
  95. package/dist/MergeTagPlugin.native-CrxyThyn.mjs +0 -178
  96. package/dist/MergeTagPlugin.native-CrxyThyn.mjs.map +0 -1
  97. package/dist/PageBreakPlugin.native-DDjcDyRW.mjs +0 -172
  98. package/dist/PageBreakPlugin.native-DDjcDyRW.mjs.map +0 -1
  99. package/dist/PreviewPlugin.native-DBvfpmIv.mjs.map +0 -1
  100. package/dist/PrintPlugin.native-BUpm52VJ.mjs.map +0 -1
  101. package/dist/SpecialCharactersPlugin.native-x7a2SWXc.mjs.map +0 -1
  102. package/dist/SpellCheckPlugin.native-B7yTh0iE.mjs +0 -465
  103. package/dist/SpellCheckPlugin.native-B7yTh0iE.mjs.map +0 -1
  104. package/dist/StrikethroughPlugin.native-ChaZLaXw.mjs +0 -43
  105. package/dist/StrikethroughPlugin.native-ChaZLaXw.mjs.map +0 -1
  106. package/dist/TablePlugin.native-EEWXn1-s.mjs.map +0 -1
  107. package/dist/TemplatePlugin.native-BlSn1c9h.mjs +0 -564
  108. package/dist/TemplatePlugin.native-BlSn1c9h.mjs.map +0 -1
  109. package/dist/TextAlignmentPlugin.native-CQIs1m7R.mjs +0 -97
  110. package/dist/TextAlignmentPlugin.native-CQIs1m7R.mjs.map +0 -1
  111. package/dist/TextColorPlugin.native-D6SmTglm.mjs.map +0 -1
  112. package/dist/UnderlinePlugin.native-QpIcK4L2.mjs.map +0 -1
  113. package/dist/documentManager-irzj9n3V.mjs.map +0 -1
  114. package/dist/editorContainerHelpers-C7kdWnS0.mjs.map +0 -1
  115. package/dist/editora.min.js.map +0 -1
  116. package/dist/editora.umd.js.map +0 -1
  117. package/dist/index-BF5RBhL9.js +0 -4
  118. package/dist/index-BF5RBhL9.js.map +0 -1
  119. package/dist/index-BPsf460l.mjs +0 -1243
  120. package/dist/index-BPsf460l.mjs.map +0 -1
  121. package/dist/index.cjs.js.map +0 -1
  122. package/dist/index.es-CuicffkQ.mjs.map +0 -1
  123. package/dist/index.esm.js.map +0 -1
  124. package/dist/plugin-loader.js.map +0 -1
  125. package/dist/purify.es-CKpwg8Tk.mjs.map +0 -1
  126. package/dist/webcomponent-core.js.map +0 -1
  127. package/dist/webcomponent-core.min.js.map +0 -1
  128. package/dist/webcomponent.cjs.js.map +0 -1
  129. package/dist/webcomponent.esm.js.map +0 -1
  130. package/dist/webcomponent.js.map +0 -1
  131. package/dist/webcomponent.min.js.map +0 -1
@@ -1,7 +1,9 @@
1
- import { f as N, g as q } from "./editorContainerHelpers-C7kdWnS0.mjs";
2
- let h = null, m = null, T = null, R = null, x = null, I = null, V = null, w = !1, v = null, S = 0, M = 0, C = !1, L = 0, k = 0, A = 0, B = 0;
3
- const X = () => {
4
- const e = N(), t = q(e);
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 C = '[data-theme="dark"], .dark, .editora-theme-dark';
4
+ let w = !1, v = null, V = 0, L = 0, E = !1, k = 0, A = 0, B = 0, D = 0;
5
+ const _ = () => {
6
+ const e = q(), t = X(e);
5
7
  if (!t)
6
8
  return alert("Please place your cursor in the editor before inserting a table"), !1;
7
9
  const n = window.getSelection();
@@ -14,44 +16,44 @@ const X = () => {
14
16
  u.appendChild(document.createElement("br")), c.appendChild(u), a.appendChild(c);
15
17
  }
16
18
  o.appendChild(a);
17
- const i = document.createElement("tbody");
19
+ const s = document.createElement("tbody");
18
20
  for (let d = 0; d < 2; d++) {
19
21
  const c = document.createElement("tr");
20
22
  for (let u = 0; u < 3; u++) {
21
23
  const b = document.createElement("td"), f = document.createElement("p");
22
24
  f.appendChild(document.createElement("br")), b.appendChild(f), c.appendChild(b);
23
25
  }
24
- i.appendChild(c);
26
+ s.appendChild(c);
25
27
  }
26
- r.appendChild(o), r.appendChild(i), l.deleteContents(), l.insertNode(r);
27
- const s = r.querySelector("th p");
28
- if (s) {
28
+ r.appendChild(o), r.appendChild(s), l.deleteContents(), l.insertNode(r);
29
+ const i = r.querySelector("th p");
30
+ if (i) {
29
31
  const d = document.createRange();
30
- d.setStart(s, 0), d.collapse(!0), n.removeAllRanges(), n.addRange(d);
32
+ d.setStart(i, 0), d.collapse(!0), n.removeAllRanges(), n.addRange(d);
31
33
  }
32
34
  t.focus();
33
- }, _ = () => {
35
+ }, P = () => {
34
36
  var a;
35
37
  const e = p();
36
38
  if (!e) return;
37
39
  const { table: t, rowIndex: n } = e, l = document.createElement("tr"), r = ((a = t.rows[0]) == null ? void 0 : a.cells.length) || 0;
38
- for (let i = 0; i < r; i++) {
39
- const s = document.createElement("td"), d = document.createElement("p");
40
- d.innerHTML = "<br>", s.appendChild(d), l.appendChild(s);
40
+ for (let s = 0; s < r; s++) {
41
+ const i = document.createElement("td"), d = document.createElement("p");
42
+ d.innerHTML = "<br>", i.appendChild(d), l.appendChild(i);
41
43
  }
42
44
  const o = t.rows[n];
43
45
  o && o.parentElement ? o.parentElement.insertBefore(l, o) : t.appendChild(l), g();
44
- }, H = () => {
46
+ }, z = () => {
45
47
  var o;
46
48
  const e = p();
47
49
  if (!e) return;
48
50
  const { table: t, rowIndex: n } = e, l = document.createElement("tr"), r = ((o = t.rows[0]) == null ? void 0 : o.cells.length) || 0;
49
51
  for (let a = 0; a < r; a++) {
50
- const i = document.createElement("td"), s = document.createElement("p");
51
- s.innerHTML = "<br>", i.appendChild(s), l.appendChild(i);
52
+ const s = document.createElement("td"), i = document.createElement("p");
53
+ i.innerHTML = "<br>", s.appendChild(i), l.appendChild(s);
52
54
  }
53
55
  n >= t.rows.length - 1 ? t.appendChild(l) : t.insertBefore(l, t.rows[n + 1]), g();
54
- }, P = () => {
56
+ }, W = () => {
55
57
  const e = p();
56
58
  if (!e) return;
57
59
  const { table: t, colIndex: n } = e;
@@ -60,7 +62,7 @@ const X = () => {
60
62
  a.innerHTML = "<br>", o.appendChild(a), n === 0 ? r.insertBefore(o, r.cells[0]) : r.insertBefore(o, r.cells[n]);
61
63
  }
62
64
  g();
63
- }, z = () => {
65
+ }, T = () => {
64
66
  const e = p();
65
67
  if (!e) return;
66
68
  const { table: t, colIndex: n } = e;
@@ -69,12 +71,12 @@ const X = () => {
69
71
  a.innerHTML = "<br>", o.appendChild(a), n >= r.cells.length - 1 ? r.appendChild(o) : r.insertBefore(o, r.cells[n + 1]);
70
72
  }
71
73
  g();
72
- }, W = () => {
74
+ }, O = () => {
73
75
  const e = p();
74
76
  if (!e || e.rowCount <= 1) return;
75
77
  const { table: t, rowIndex: n } = e;
76
78
  t.deleteRow(n), g();
77
- }, O = () => {
79
+ }, K = () => {
78
80
  const e = p();
79
81
  if (!e || e.cellCount <= 1) return;
80
82
  const { table: t, colIndex: n } = e;
@@ -83,20 +85,20 @@ const X = () => {
83
85
  r.cells[n] && r.deleteCell(n);
84
86
  }
85
87
  g();
86
- }, K = () => {
88
+ }, Y = () => {
87
89
  var o;
88
90
  const e = p();
89
91
  if (!e) return;
90
92
  const { table: t, rowIndex: n } = e, l = t.rows[n];
91
93
  if (((o = l.parentElement) == null ? void 0 : o.tagName.toLowerCase()) === "thead") {
92
- const a = t.querySelector("tbody") || t.appendChild(document.createElement("tbody")), i = t.querySelector("thead");
93
- i && (a.insertBefore(l, a.firstChild), i.rows.length === 0 && i.remove());
94
+ const a = t.querySelector("tbody") || t.appendChild(document.createElement("tbody")), s = t.querySelector("thead");
95
+ s && (a.insertBefore(l, a.firstChild), s.rows.length === 0 && s.remove());
94
96
  } else {
95
97
  let a = t.querySelector("thead");
96
98
  a || (a = document.createElement("thead"), t.insertBefore(a, t.firstChild)), a.appendChild(l);
97
99
  }
98
100
  g();
99
- }, Y = () => {
101
+ }, F = () => {
100
102
  var l;
101
103
  const e = p();
102
104
  if (!e) return;
@@ -104,21 +106,21 @@ const X = () => {
104
106
  for (let r = 0; r < t.rows.length; r++) {
105
107
  const o = t.rows[r].cells[n];
106
108
  if (o) {
107
- const a = o.tagName.toLowerCase() === "th" ? "td" : "th", i = document.createElement(a);
108
- i.innerHTML = o.innerHTML;
109
- for (let s = 0; s < o.attributes.length; s++) {
110
- const d = o.attributes[s];
111
- i.setAttribute(d.name, d.value);
109
+ const a = o.tagName.toLowerCase() === "th" ? "td" : "th", s = document.createElement(a);
110
+ s.innerHTML = o.innerHTML;
111
+ for (let i = 0; i < o.attributes.length; i++) {
112
+ const d = o.attributes[i];
113
+ s.setAttribute(d.name, d.value);
112
114
  }
113
- (l = o.parentNode) == null || l.replaceChild(i, o);
115
+ (l = o.parentNode) == null || l.replaceChild(s, o);
114
116
  }
115
117
  }
116
118
  g();
117
- }, F = () => {
119
+ }, U = () => {
118
120
  const e = p();
119
121
  if (!e) return;
120
122
  e.table.remove(), document.dispatchEvent(new CustomEvent("tableDeleted"));
121
- }, G = () => {
123
+ }, j = () => {
122
124
  var u, b;
123
125
  const e = window.getSelection();
124
126
  if (!e || e.rangeCount === 0) return;
@@ -135,31 +137,31 @@ const X = () => {
135
137
  break;
136
138
  }
137
139
  if (a === -1 || a === o.cells.length - 1) return;
138
- const i = o.cells[a + 1];
139
- if (!i) return;
140
- const s = parseInt(r.getAttribute("colspan") || "1"), d = parseInt(i.getAttribute("colspan") || "1");
141
- r.setAttribute("colspan", String(s + d)), Array.from(i.childNodes).forEach((f) => {
140
+ const s = o.cells[a + 1];
141
+ if (!s) return;
142
+ const i = parseInt(r.getAttribute("colspan") || "1"), d = parseInt(s.getAttribute("colspan") || "1");
143
+ r.setAttribute("colspan", String(i + d)), Array.from(s.childNodes).forEach((f) => {
142
144
  r.appendChild(f);
143
- }), i.remove(), g();
145
+ }), s.remove(), g();
144
146
  };
145
147
  function p() {
146
- var s, d, c;
148
+ var i, d, c;
147
149
  const e = window.getSelection();
148
150
  if (!e || e.rangeCount === 0) return null;
149
151
  const n = e.getRangeAt(0).startContainer;
150
- let l = n.nodeType === Node.TEXT_NODE ? (s = n.parentElement) == null ? void 0 : s.closest("table") : n.closest("table");
152
+ let l = n.nodeType === Node.TEXT_NODE ? (i = n.parentElement) == null ? void 0 : i.closest("table") : n.closest("table");
151
153
  if (!l) return null;
152
154
  const r = l;
153
155
  let o = 0, a = 0;
154
- const i = n.nodeType === Node.TEXT_NODE ? (d = n.parentElement) == null ? void 0 : d.closest("td, th") : n.closest("td, th");
155
- if (i) {
156
- let u = i.parentElement;
156
+ const s = n.nodeType === Node.TEXT_NODE ? (d = n.parentElement) == null ? void 0 : d.closest("td, th") : n.closest("td, th");
157
+ if (s) {
158
+ let u = s.parentElement;
157
159
  for (; u && u !== r.rows[o] && (o++, !(o >= r.rows.length)); )
158
160
  ;
159
161
  const b = u;
160
162
  if (b) {
161
163
  for (let f = 0; f < b.cells.length; f++)
162
- if (b.cells[f] === i) {
164
+ if (b.cells[f] === s) {
163
165
  a = f;
164
166
  break;
165
167
  }
@@ -178,39 +180,41 @@ function g() {
178
180
  const e = p();
179
181
  if (!e) return;
180
182
  const t = e.rowCount > 1, n = e.cellCount > 1;
181
- D(t, n);
183
+ N(t, n);
182
184
  }
183
- function j() {
184
- T = () => {
185
+ function G() {
186
+ R = () => {
185
187
  const e = p();
186
- e ? U(e.table) : y();
187
- }, R = (e) => {
188
+ e ? J(e.table) : y();
189
+ }, x = (e) => {
188
190
  const t = e.target, n = t.closest("table"), l = t.closest(".table-toolbar");
189
191
  !n && !l && y();
190
- }, x = () => {
191
- y();
192
192
  }, I = () => {
193
- m && h && h.style.display !== "none" && E(m);
194
- }, V = () => {
195
- m && h && h.style.display !== "none" && E(m);
196
- }, document.addEventListener("selectionchange", T), document.addEventListener("mousedown", R), document.addEventListener("tableDeleted", x), window.addEventListener("scroll", I, !0), window.addEventListener("resize", V);
193
+ y();
194
+ }, M = () => {
195
+ m && h && h.style.display !== "none" && H(m);
196
+ }, S = () => {
197
+ m && h && h.style.display !== "none" && H(m);
198
+ }, document.addEventListener("selectionchange", R), document.addEventListener("mousedown", x), document.addEventListener("tableDeleted", I), window.addEventListener("scroll", M, !0), window.addEventListener("resize", S);
197
199
  }
198
- function E(e) {
200
+ function H(e) {
199
201
  if (!h) return;
200
202
  const t = e.getBoundingClientRect(), n = h.getBoundingClientRect(), l = n.height || 40, r = n.width || 280, o = 10;
201
- let a = t.top - l - o, i = t.left + t.width / 2 - r / 2;
202
- a < o && (a = t.bottom + o), i < o && (i = o);
203
- const s = window.innerWidth;
204
- i + r > s - o && (i = s - r - o);
203
+ let a = t.top - l - o, s = t.left + t.width / 2 - r / 2;
204
+ a < o && (a = t.bottom + o), s < o && (s = o);
205
+ const i = window.innerWidth;
206
+ s + r > i - o && (s = i - r - o);
205
207
  const d = window.innerHeight;
206
- a + l > d - o && (a = d - l - o), h.style.top = a + "px", h.style.left = i + "px";
208
+ a + l > d - o && (a = d - l - o), h.style.top = a + "px", h.style.left = s + "px";
207
209
  }
208
- function U(e) {
209
- m = e, h || (h = Z(), document.body.appendChild(h)), h.style.display = "flex", h.style.visibility = "hidden", requestAnimationFrame(() => {
210
- E(e), h && (h.style.visibility = "visible");
210
+ function J(e) {
211
+ m = e, h || (h = Q(), document.body.appendChild(h));
212
+ const t = !!e.closest(C) || document.body.matches(C) || document.documentElement.matches(C);
213
+ h.classList.toggle("rte-theme-dark", t), h.style.display = "flex", h.style.visibility = "hidden", requestAnimationFrame(() => {
214
+ H(e), h && (h.style.visibility = "visible");
211
215
  });
212
- const t = p();
213
- t && D(t.rowCount > 1, t.cellCount > 1), Q(e);
216
+ const n = p();
217
+ n && N(n.rowCount > 1, n.cellCount > 1), $(e);
214
218
  }
215
219
  function y() {
216
220
  if (h && (h.style.display = "none"), m) {
@@ -220,12 +224,12 @@ function y() {
220
224
  }
221
225
  m = null;
222
226
  }
223
- function D(e, t) {
227
+ function N(e, t) {
224
228
  if (!h) return;
225
229
  const n = h.querySelector('[data-action="deleteRow"]'), l = h.querySelector('[data-action="deleteColumn"]');
226
230
  n && (n.disabled = !e), l && (l.disabled = !t);
227
231
  }
228
- function Z() {
232
+ function Q() {
229
233
  const e = document.createElement("div");
230
234
  e.className = "table-toolbar", e.style.cssText = `
231
235
  position: fixed;
@@ -234,7 +238,7 @@ function Z() {
234
238
  `, e.setAttribute("role", "toolbar"), e.setAttribute("aria-label", "Table editing toolbar");
235
239
  const t = (c) => {
236
240
  const u = document.createElement("button");
237
- return u.className = "toolbar-icon-btn", c.danger && u.classList.add("toolbar-icon-btn-danger"), c.delete && u.classList.add("toolbar-icon-btn-delete"), u.innerHTML = c.icon, u.title = c.title, u.setAttribute("aria-label", c.title), u.setAttribute("type", "button"), u.setAttribute("data-action", c.action), u.onclick = () => J(c.action), u;
241
+ return u.className = "toolbar-icon-btn", c.danger && u.classList.add("toolbar-icon-btn-danger"), c.delete && u.classList.add("toolbar-icon-btn-delete"), u.innerHTML = c.icon, u.title = c.title, u.setAttribute("aria-label", c.title), u.setAttribute("type", "button"), u.setAttribute("data-action", c.action), u.onclick = () => Z(c.action), u;
238
242
  }, n = () => {
239
243
  const c = document.createElement("div");
240
244
  return c.className = "toolbar-divider", c;
@@ -243,34 +247,34 @@ function Z() {
243
247
  return u.className = "toolbar-section", c.forEach((b) => u.appendChild(b)), u;
244
248
  }, r = l(
245
249
  t({
246
- icon: te(),
250
+ icon: ne(),
247
251
  title: "Add row above (Ctrl+Shift+R)",
248
252
  action: "addRowAbove"
249
253
  }),
250
254
  t({
251
- icon: ne(),
255
+ icon: oe(),
252
256
  title: "Add row below",
253
257
  action: "addRowBelow"
254
258
  }),
255
259
  t({
256
- icon: oe(),
260
+ icon: le(),
257
261
  title: "Delete row",
258
262
  action: "deleteRow",
259
263
  danger: !0
260
264
  })
261
265
  ), o = l(
262
266
  t({
263
- icon: le(),
267
+ icon: re(),
264
268
  title: "Add column left",
265
269
  action: "addColumnLeft"
266
270
  }),
267
271
  t({
268
- icon: re(),
272
+ icon: ae(),
269
273
  title: "Add column right (Ctrl+Shift+C)",
270
274
  action: "addColumnRight"
271
275
  }),
272
276
  t({
273
- icon: ae(),
277
+ icon: se(),
274
278
  title: "Delete column",
275
279
  action: "deleteColumn",
276
280
  danger: !0
@@ -282,75 +286,75 @@ function Z() {
282
286
  action: "toggleHeaderRow"
283
287
  }),
284
288
  t({
285
- icon: se(),
289
+ icon: de(),
286
290
  title: "Toggle header column",
287
291
  action: "toggleHeaderColumn"
288
292
  })
289
- ), i = l(
293
+ ), s = l(
290
294
  t({
291
- icon: ce(),
295
+ icon: ue(),
292
296
  title: "Merge cells (horizontally)",
293
297
  action: "mergeCells"
294
298
  })
295
- ), s = l(
299
+ ), i = l(
296
300
  t({
297
- icon: de(),
301
+ icon: ce(),
298
302
  title: "Delete table",
299
303
  action: "deleteTable",
300
304
  delete: !0
301
305
  })
302
306
  );
303
- e.appendChild(r), e.appendChild(n()), e.appendChild(o), e.appendChild(n()), e.appendChild(a), e.appendChild(n()), e.appendChild(i), e.appendChild(n()), e.appendChild(s);
307
+ e.appendChild(r), e.appendChild(n()), e.appendChild(o), e.appendChild(n()), e.appendChild(a), e.appendChild(n()), e.appendChild(s), e.appendChild(n()), e.appendChild(i);
304
308
  const d = (c) => {
305
- !h || h.style.display === "none" || (c.ctrlKey || c.metaKey) && c.shiftKey && (c.key === "r" || c.key === "R" ? (c.preventDefault(), H()) : (c.key === "c" || c.key === "C") && (c.preventDefault(), z()));
309
+ !h || h.style.display === "none" || (c.ctrlKey || c.metaKey) && c.shiftKey && (c.key === "r" || c.key === "R" ? (c.preventDefault(), z()) : (c.key === "c" || c.key === "C") && (c.preventDefault(), T()));
306
310
  };
307
311
  return window.addEventListener("keydown", d), e;
308
312
  }
309
- function J(e) {
313
+ function Z(e) {
310
314
  switch (e) {
311
315
  case "addRowAbove":
312
- _();
316
+ P();
313
317
  break;
314
318
  case "addRowBelow":
315
- H();
319
+ z();
316
320
  break;
317
321
  case "addColumnLeft":
318
- P();
322
+ W();
319
323
  break;
320
324
  case "addColumnRight":
321
- z();
325
+ T();
322
326
  break;
323
327
  case "deleteRow":
324
- W();
328
+ O();
325
329
  break;
326
330
  case "deleteColumn":
327
- O();
331
+ K();
328
332
  break;
329
333
  case "toggleHeaderRow":
330
- K();
334
+ Y();
331
335
  break;
332
336
  case "toggleHeaderColumn":
333
- Y();
337
+ F();
334
338
  break;
335
339
  case "deleteTable":
336
- F();
340
+ U();
337
341
  break;
338
342
  case "mergeCells":
339
- G();
343
+ j();
340
344
  break;
341
345
  }
342
346
  }
343
- function Q(e) {
347
+ function $(e) {
344
348
  e.querySelectorAll(".resize-handle").forEach((a) => a.remove());
345
349
  const n = e.querySelector(".table-resize-handle");
346
350
  n && n.remove();
347
351
  const l = e.querySelector("thead tr, tbody tr:first-child");
348
352
  if (!l) return;
349
353
  const r = l.querySelectorAll("td, th");
350
- r.forEach((a, i) => {
351
- if (i === r.length - 1) return;
352
- const s = document.createElement("div");
353
- s.className = "resize-handle", s.style.cssText = `
354
+ r.forEach((a, s) => {
355
+ if (s === r.length - 1) return;
356
+ const i = document.createElement("div");
357
+ i.className = "resize-handle", i.style.cssText = `
354
358
  position: absolute;
355
359
  right: -4px;
356
360
  top: 0;
@@ -360,72 +364,72 @@ function Q(e) {
360
364
  cursor: col-resize;
361
365
  z-index: 10;
362
366
  transition: background 0.15s ease;
363
- `, s.addEventListener("mouseenter", () => {
364
- w || (s.style.background = "rgba(0, 102, 204, 0.3)");
365
- }), s.addEventListener("mouseleave", () => {
366
- w || (s.style.background = "transparent");
367
- }), s.addEventListener("mousedown", (d) => {
368
- d.preventDefault(), d.stopPropagation(), $(d, i);
369
- }), a.style.position = "relative", a.appendChild(s);
367
+ `, i.addEventListener("mouseenter", () => {
368
+ w || (i.style.background = "rgba(0, 102, 204, 0.3)");
369
+ }), i.addEventListener("mouseleave", () => {
370
+ w || (i.style.background = "transparent");
371
+ }), i.addEventListener("mousedown", (d) => {
372
+ d.preventDefault(), d.stopPropagation(), ee(d, s);
373
+ }), a.style.position = "relative", a.appendChild(i);
370
374
  });
371
375
  const o = document.createElement("div");
372
376
  o.className = "table-resize-handle", o.addEventListener("mousedown", (a) => {
373
- a.preventDefault(), a.stopPropagation(), ee(a);
377
+ a.preventDefault(), a.stopPropagation(), te(a);
374
378
  }), e.appendChild(o);
375
379
  }
376
- function $(e, t) {
377
- if (w = !0, v = t, S = e.clientX, !m) return;
380
+ function ee(e, t) {
381
+ if (w = !0, v = t, V = e.clientX, !m) return;
378
382
  const n = m.querySelector("thead tr, tbody tr:first-child");
379
- n && n.cells[t] && (M = n.cells[t].offsetWidth), document.body.style.cursor = "col-resize", document.body.style.userSelect = "none";
383
+ n && n.cells[t] && (L = n.cells[t].offsetWidth), document.body.style.cursor = "col-resize", document.body.style.userSelect = "none";
380
384
  const l = (o) => {
381
385
  if (!w || v === null || !m) return;
382
- const a = o.clientX - S, i = Math.max(50, M + a);
386
+ const a = o.clientX - V, s = Math.max(50, L + a);
383
387
  m.querySelectorAll("tr").forEach((d) => {
384
- d.cells[v] && (d.cells[v].style.width = i + "px");
388
+ d.cells[v] && (d.cells[v].style.width = s + "px");
385
389
  });
386
390
  }, r = () => {
387
391
  w = !1, v = null, document.body.style.cursor = "", document.body.style.userSelect = "", document.removeEventListener("mousemove", l), document.removeEventListener("mouseup", r);
388
392
  };
389
393
  document.addEventListener("mousemove", l), document.addEventListener("mouseup", r);
390
394
  }
391
- function ee(e) {
395
+ function te(e) {
392
396
  if (!m) return;
393
- C = !0, L = e.clientX, k = e.clientY, A = m.offsetWidth, B = m.offsetHeight, document.body.style.cursor = "nwse-resize", document.body.style.userSelect = "none";
397
+ E = !0, k = e.clientX, A = e.clientY, B = m.offsetWidth, D = m.offsetHeight, document.body.style.cursor = "nwse-resize", document.body.style.userSelect = "none";
394
398
  const t = (l) => {
395
- if (!C || !m) return;
396
- const r = l.clientX - L, o = l.clientY - k, a = Math.max(200, A + r), i = Math.max(100, B + o);
397
- m.style.width = a + "px", m.style.height = i + "px";
399
+ if (!E || !m) return;
400
+ const r = l.clientX - k, o = l.clientY - A, a = Math.max(200, B + r), s = Math.max(100, D + o);
401
+ m.style.width = a + "px", m.style.height = s + "px";
398
402
  }, n = () => {
399
- C = !1, document.body.style.cursor = "", document.body.style.userSelect = "", document.removeEventListener("mousemove", t), document.removeEventListener("mouseup", n);
403
+ E = !1, document.body.style.cursor = "", document.body.style.userSelect = "", document.removeEventListener("mousemove", t), document.removeEventListener("mouseup", n);
400
404
  };
401
405
  document.addEventListener("mousemove", t), document.addEventListener("mouseup", n);
402
406
  }
403
- function te() {
407
+ function ne() {
404
408
  return `<svg width="16" height="16" viewBox="0 0 16 16" fill="currentColor">
405
409
  <path d="M2 7h12V5H2v2zm0 4h12V9H2v2zM8 1v3H5v2h3v3h2V6h3V4h-3V1H8z"/>
406
410
  </svg>`;
407
411
  }
408
- function ne() {
412
+ function oe() {
409
413
  return `<svg width="16" height="16" viewBox="0 0 16 16" fill="currentColor">
410
414
  <path d="M2 3h12V1H2v2zm0 4h12V5H2v2zm6 4v3h3v-2h2v-2h-2v-3h-2v3H5v2h3z"/>
411
415
  </svg>`;
412
416
  }
413
- function oe() {
417
+ function le() {
414
418
  return `<svg width="16" height="16" viewBox="0 0 16 16" fill="currentColor">
415
419
  <path d="M2 5h12v2H2V5zm0 4h12v2H2V9zm4-6v2H4v2h2v2h2V7h2V5H8V3H6z"/>
416
420
  </svg>`;
417
421
  }
418
- function le() {
422
+ function re() {
419
423
  return `<svg width="16" height="16" viewBox="0 0 16 16" fill="currentColor">
420
424
  <path d="M7 2v12h2V2H7zm4 0v12h2V2h-2zM1 8h3v-3H1v3zm3 2H1v3h3v-3z"/>
421
425
  </svg>`;
422
426
  }
423
- function re() {
427
+ function ae() {
424
428
  return `<svg width="16" height="16" viewBox="0 0 16 16" fill="currentColor">
425
429
  <path d="M2 2v12h2V2H2zm4 0v12h2V2H6zM12 8h3v-3h-3v3zm0 2h3v3h-3v-3z"/>
426
430
  </svg>`;
427
431
  }
428
- function ae() {
432
+ function se() {
429
433
  return `<svg width="16" height="16" viewBox="0 0 16 16" fill="currentColor">
430
434
  <path d="M5 2v12h2V2H5zm4 0v12h2V2H9zm3 2h3V1h-3v3zm3 2h-3v3h3V6zm0 4h-3v3h3v-3z"/>
431
435
  </svg>`;
@@ -435,17 +439,17 @@ function ie() {
435
439
  <path d="M2 2h12v3H2V2zm0 5h12v8H2V7zm2 2v4h2V9H4zm4 0v4h2V9H8zm4 0v4h2V9h-2z"/>
436
440
  </svg>`;
437
441
  }
438
- function se() {
442
+ function de() {
439
443
  return `<svg width="16" height="16" viewBox="0 0 16 16" fill="currentColor">
440
444
  <path d="M2 2v12h3V2H2zm5 0v12h8V2H7zm2 2h4v2H9V4zm0 4h4v2H9V8zm0 4h4v2H9v-2z"/>
441
445
  </svg>`;
442
446
  }
443
- function de() {
447
+ function ce() {
444
448
  return `<svg width="16" height="16" viewBox="0 0 16 16" fill="currentColor">
445
449
  <path d="M3 1h10v1H3V1zm1 2v11h8V3H4zM6 5h1v6H6V5zm3 0h1v6H9V5z"/>
446
450
  </svg>`;
447
451
  }
448
- function ce() {
452
+ function ue() {
449
453
  return `<svg width="16" height="16" viewBox="0 0 16 16" fill="currentColor">
450
454
  <path d="M2 2h4v3H2V2zm5 0h4v3H7V2zm5 0h2v3h-2V2zm-10 4h4v3H2V6zm5 0h4v3H7V6zm5 0h2v3h-2V6zm-10 4h4v3H2v-3zm5 0h4v3H7v-3zm5 0h2v3h-2v-3z"/>
451
455
  </svg>`;
@@ -453,39 +457,39 @@ function ce() {
453
457
  if (typeof window != "undefined" && !window.__tablePluginInitialized) {
454
458
  window.__tablePluginInitialized = !0;
455
459
  const e = () => {
456
- j();
460
+ G();
457
461
  };
458
462
  document.readyState === "loading" ? document.addEventListener("DOMContentLoaded", e) : setTimeout(e, 100);
459
463
  }
460
- const he = () => ({
464
+ const me = () => ({
461
465
  name: "table",
462
466
  toolbar: [
463
467
  {
464
468
  label: "Insert Table",
465
469
  command: "insertTable",
466
- icon: '<svg width="24px" height="24px" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><g id="SVGRepo_bgCarrier" stroke-width="0"></g><g id="SVGRepo_tracerCarrier" stroke-linecap="round" stroke-linejoin="round"></g><g id="SVGRepo_iconCarrier"> <path d="M12 10V20M3 15L21 15M3 10H21M6.2 20H17.8C18.9201 20 19.4802 20 19.908 19.782C20.2843 19.5903 20.5903 19.2843 20.782 18.908C21 18.4802 21 17.9201 21 16.8V7.2C21 6.0799 21 5.51984 20.782 5.09202C20.5903 4.71569 20.2843 4.40973 19.908 4.21799C19.4802 4 18.9201 4 17.8 4H6.2C5.0799 4 4.51984 4 4.09202 4.21799C3.71569 4.40973 3.40973 4.71569 3.21799 5.09202C3 5.51984 3 6.07989 3 7.2V16.8C3 17.9201 3 18.4802 3.21799 18.908C3.40973 19.2843 3.71569 19.5903 4.09202 19.782C4.51984 20 5.07989 20 6.2 20Z" stroke="#000000" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"></path> </g></svg>'
470
+ 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>'
467
471
  }
468
472
  ],
469
473
  commands: {
470
- insertTable: () => (X(), !0)
474
+ insertTable: () => (_(), !0)
471
475
  },
472
476
  keymap: {
473
- "Mod-Shift-r": () => (H(), !0),
474
- "Mod-Shift-c": () => (z(), !0)
477
+ "Mod-Shift-r": () => (z(), !0),
478
+ "Mod-Shift-c": () => (T(), !0)
475
479
  }
476
480
  });
477
481
  export {
478
- he as TablePlugin,
479
- P as addColumnLeftCommand,
480
- z as addColumnRightCommand,
481
- _ as addRowAboveCommand,
482
- H as addRowBelowCommand,
483
- O as deleteColumnCommand,
484
- W as deleteRowCommand,
485
- F as deleteTableCommand,
486
- X as insertTableCommand,
487
- G as mergeCellsCommand,
488
- Y as toggleHeaderColumnCommand,
489
- K as toggleHeaderRowCommand
482
+ me as TablePlugin,
483
+ W as addColumnLeftCommand,
484
+ T as addColumnRightCommand,
485
+ P as addRowAboveCommand,
486
+ z as addRowBelowCommand,
487
+ K as deleteColumnCommand,
488
+ O as deleteRowCommand,
489
+ U as deleteTableCommand,
490
+ _ as insertTableCommand,
491
+ j as mergeCellsCommand,
492
+ F as toggleHeaderColumnCommand,
493
+ Y as toggleHeaderRowCommand
490
494
  };
491
- //# sourceMappingURL=TablePlugin.native-EEWXn1-s.mjs.map
495
+ //# sourceMappingURL=TablePlugin.native-DrHX-efe.mjs.map