@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.
- package/README.md +34 -0
- package/dist/{A11yCheckerPlugin.native-CZKpi3uF.mjs → A11yCheckerPlugin.native-BRdGYMju.mjs} +225 -173
- package/dist/AnchorPlugin.native-C1Rw5m04.mjs +404 -0
- package/dist/BackgroundColorPlugin.native-BE-p9DRd.mjs +489 -0
- package/dist/ChecklistPlugin.native-nuSSEFNI.mjs +309 -0
- package/dist/ClearFormattingPlugin.native-Bq_XcTh2.mjs +140 -0
- package/dist/{CodePlugin.native-CK9d8rmt.mjs → CodePlugin.native-0Zari_zp.mjs} +329 -310
- package/dist/CodeSamplePlugin.native-B-KS1pOl.mjs +384 -0
- package/dist/CommentsPlugin.native-tMnWn8a2.mjs +723 -0
- package/dist/DirectionPlugin.native-CDnbdNyl.mjs +130 -0
- package/dist/{EmbedIframePlugin.native-ifr9KLdN.mjs → EmbedIframePlugin.native-CSWIB1jm.mjs} +154 -50
- package/dist/{EmojisPlugin.native-D6mJSnSR.mjs → EmojisPlugin.native-DxTm_DL-.mjs} +156 -103
- package/dist/FontFamilyPlugin.native-j8hMTbg4.mjs +158 -0
- package/dist/FontSizePlugin.native-B_jCh7dY.mjs +286 -0
- package/dist/FootnotePlugin.native-D730OGRm.mjs +425 -0
- package/dist/HistoryPlugin.native-DCrPdeSW.mjs +257 -0
- package/dist/IndentPlugin.native-BHixp8sP.mjs +150 -0
- package/dist/LineHeightPlugin.native-CM7iXdQj.mjs +151 -0
- package/dist/{LinkPlugin.native-BdAOV-iu.mjs → LinkPlugin.native-CS2g-G18.mjs} +128 -53
- package/dist/{ListPlugin.native-CLFU5AUQ.mjs → ListPlugin.native-V7EZC1lM.mjs} +59 -12
- package/dist/MathPlugin.native-KUxz0o8C.mjs +251 -0
- package/dist/MediaManagerPlugin.native-CgP5iInD.mjs +970 -0
- package/dist/MergeTagPlugin.native-CU9LtsfD.mjs +416 -0
- package/dist/PageBreakPlugin.native-CGiQxXqR.mjs +297 -0
- package/dist/{PrintPlugin.native-BUpm52VJ.mjs → PrintPlugin.native-7qt5v7L5.mjs} +10 -10
- package/dist/{SpecialCharactersPlugin.native-x7a2SWXc.mjs → SpecialCharactersPlugin.native-DANrbExJ.mjs} +143 -97
- package/dist/SpellCheckPlugin.native-C8bPvRHy.mjs +1019 -0
- package/dist/StrikethroughPlugin.native-0Be7j49s.mjs +73 -0
- package/dist/{TablePlugin.native-EEWXn1-s.mjs → TablePlugin.native-DrHX-efe.mjs} +149 -145
- package/dist/TemplatePlugin.native-4lKEm-WY.mjs +578 -0
- package/dist/TextAlignmentPlugin.native-sM_1s00t.mjs +108 -0
- package/dist/{TextColorPlugin.native-D6SmTglm.mjs → TextColorPlugin.native-Clgtb50j.mjs} +173 -92
- package/dist/colorSelectionApply-CK1My9N2.mjs +67 -0
- package/dist/core.css +1 -1
- package/dist/editora.min.js +31 -29
- package/dist/editora.umd.js +31 -29
- package/dist/index-CqWQFb3D.js +10 -0
- package/dist/index-OwnkG39N.mjs +2227 -0
- package/dist/index.cjs.js +14 -18
- package/dist/index.esm.js +204 -521
- package/dist/plugin-loader.js +26 -26
- package/dist/webcomponent-core.js +1286 -295
- package/dist/webcomponent-core.min.css +1 -1
- package/dist/webcomponent-core.min.js +100 -75
- package/dist/webcomponent.cjs.js +1 -1
- package/dist/webcomponent.esm.js +1 -1
- package/dist/webcomponent.js +1252 -261
- package/dist/webcomponent.min.css +1 -1
- package/dist/webcomponent.min.js +3616 -2109
- package/index.d.ts +355 -0
- package/package.json +19 -17
- package/dist/A11yCheckerPlugin.native-CZKpi3uF.mjs.map +0 -1
- package/dist/AnchorPlugin.native-7es9PVZ9.mjs +0 -340
- package/dist/AnchorPlugin.native-7es9PVZ9.mjs.map +0 -1
- package/dist/BackgroundColorPlugin.native-Dip5uqTg.mjs +0 -449
- package/dist/BackgroundColorPlugin.native-Dip5uqTg.mjs.map +0 -1
- package/dist/BlockquotePlugin.native-JFmOLsxN.mjs.map +0 -1
- package/dist/BoldPlugin.native-BAzzoqU5.mjs.map +0 -1
- package/dist/CapitalizationPlugin.native-DOMsh5R7.mjs.map +0 -1
- package/dist/ChecklistPlugin.native-Dccs3nLe.mjs +0 -153
- package/dist/ChecklistPlugin.native-Dccs3nLe.mjs.map +0 -1
- package/dist/ClearFormattingPlugin.native-BZPDHswo.mjs +0 -27
- package/dist/ClearFormattingPlugin.native-BZPDHswo.mjs.map +0 -1
- package/dist/CodePlugin.native-CK9d8rmt.mjs.map +0 -1
- package/dist/CodeSamplePlugin.native-DMbEdO9j.mjs +0 -326
- package/dist/CodeSamplePlugin.native-DMbEdO9j.mjs.map +0 -1
- package/dist/CommentsPlugin.native-2zQV8Ia4.mjs +0 -473
- package/dist/CommentsPlugin.native-2zQV8Ia4.mjs.map +0 -1
- package/dist/DirectionPlugin.native-Be7wCzkI.mjs +0 -59
- package/dist/DirectionPlugin.native-Be7wCzkI.mjs.map +0 -1
- package/dist/DocumentManagerPlugin.native-BvZL5CSG.mjs.map +0 -1
- package/dist/EmbedIframePlugin.native-ifr9KLdN.mjs.map +0 -1
- package/dist/EmojisPlugin.native-D6mJSnSR.mjs.map +0 -1
- package/dist/FontFamilyPlugin.native-BzS_9qbM.mjs +0 -106
- package/dist/FontFamilyPlugin.native-BzS_9qbM.mjs.map +0 -1
- package/dist/FontSizePlugin.native-DkLMLPue.mjs +0 -186
- package/dist/FontSizePlugin.native-DkLMLPue.mjs.map +0 -1
- package/dist/FootnotePlugin.native-BciVc9W6.mjs +0 -128
- package/dist/FootnotePlugin.native-BciVc9W6.mjs.map +0 -1
- package/dist/FullscreenPlugin.native-ChXyxeNw.mjs.map +0 -1
- package/dist/HeadingPlugin.native-DrLYwQnQ.mjs.map +0 -1
- package/dist/HistoryPlugin.native-DoDRifCf.mjs +0 -89
- package/dist/HistoryPlugin.native-DoDRifCf.mjs.map +0 -1
- package/dist/IndentPlugin.native-CbFugPoi.mjs +0 -133
- package/dist/IndentPlugin.native-CbFugPoi.mjs.map +0 -1
- package/dist/ItalicPlugin.native-CQjjDyUL.mjs.map +0 -1
- package/dist/LineHeightPlugin.native-CWQT2FIa.mjs +0 -73
- package/dist/LineHeightPlugin.native-CWQT2FIa.mjs.map +0 -1
- package/dist/LinkPlugin.native-BdAOV-iu.mjs.map +0 -1
- package/dist/ListPlugin.native-CLFU5AUQ.mjs.map +0 -1
- package/dist/MathPlugin.native-DE_ii-LA.mjs +0 -182
- package/dist/MathPlugin.native-DE_ii-LA.mjs.map +0 -1
- package/dist/MediaManagerPlugin.native-DaYFDzNM.mjs +0 -533
- package/dist/MediaManagerPlugin.native-DaYFDzNM.mjs.map +0 -1
- package/dist/MergeTagPlugin.native-CrxyThyn.mjs +0 -178
- package/dist/MergeTagPlugin.native-CrxyThyn.mjs.map +0 -1
- package/dist/PageBreakPlugin.native-DDjcDyRW.mjs +0 -172
- package/dist/PageBreakPlugin.native-DDjcDyRW.mjs.map +0 -1
- package/dist/PreviewPlugin.native-DBvfpmIv.mjs.map +0 -1
- package/dist/PrintPlugin.native-BUpm52VJ.mjs.map +0 -1
- package/dist/SpecialCharactersPlugin.native-x7a2SWXc.mjs.map +0 -1
- package/dist/SpellCheckPlugin.native-B7yTh0iE.mjs +0 -465
- package/dist/SpellCheckPlugin.native-B7yTh0iE.mjs.map +0 -1
- package/dist/StrikethroughPlugin.native-ChaZLaXw.mjs +0 -43
- package/dist/StrikethroughPlugin.native-ChaZLaXw.mjs.map +0 -1
- package/dist/TablePlugin.native-EEWXn1-s.mjs.map +0 -1
- package/dist/TemplatePlugin.native-BlSn1c9h.mjs +0 -564
- package/dist/TemplatePlugin.native-BlSn1c9h.mjs.map +0 -1
- package/dist/TextAlignmentPlugin.native-CQIs1m7R.mjs +0 -97
- package/dist/TextAlignmentPlugin.native-CQIs1m7R.mjs.map +0 -1
- package/dist/TextColorPlugin.native-D6SmTglm.mjs.map +0 -1
- package/dist/UnderlinePlugin.native-QpIcK4L2.mjs.map +0 -1
- package/dist/documentManager-irzj9n3V.mjs.map +0 -1
- package/dist/editorContainerHelpers-C7kdWnS0.mjs.map +0 -1
- package/dist/editora.min.js.map +0 -1
- package/dist/editora.umd.js.map +0 -1
- package/dist/index-BF5RBhL9.js +0 -4
- package/dist/index-BF5RBhL9.js.map +0 -1
- package/dist/index-BPsf460l.mjs +0 -1243
- package/dist/index-BPsf460l.mjs.map +0 -1
- package/dist/index.cjs.js.map +0 -1
- package/dist/index.es-CuicffkQ.mjs.map +0 -1
- package/dist/index.esm.js.map +0 -1
- package/dist/plugin-loader.js.map +0 -1
- package/dist/purify.es-CKpwg8Tk.mjs.map +0 -1
- package/dist/webcomponent-core.js.map +0 -1
- package/dist/webcomponent-core.min.js.map +0 -1
- package/dist/webcomponent.cjs.js.map +0 -1
- package/dist/webcomponent.esm.js.map +0 -1
- package/dist/webcomponent.js.map +0 -1
- package/dist/webcomponent.min.js.map +0 -1
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
import { f as
|
|
2
|
-
let h = null, m = null,
|
|
3
|
-
const
|
|
4
|
-
|
|
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
|
|
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
|
-
|
|
26
|
+
s.appendChild(c);
|
|
25
27
|
}
|
|
26
|
-
r.appendChild(o), r.appendChild(
|
|
27
|
-
const
|
|
28
|
-
if (
|
|
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(
|
|
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
|
|
39
|
-
const
|
|
40
|
-
d.innerHTML = "<br>",
|
|
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
|
-
},
|
|
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
|
|
51
|
-
|
|
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
|
-
},
|
|
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
|
-
},
|
|
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
|
-
},
|
|
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
|
-
},
|
|
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
|
-
},
|
|
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")),
|
|
93
|
-
|
|
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
|
-
},
|
|
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",
|
|
108
|
-
|
|
109
|
-
for (let
|
|
110
|
-
const d = o.attributes[
|
|
111
|
-
|
|
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(
|
|
115
|
+
(l = o.parentNode) == null || l.replaceChild(s, o);
|
|
114
116
|
}
|
|
115
117
|
}
|
|
116
118
|
g();
|
|
117
|
-
},
|
|
119
|
+
}, U = () => {
|
|
118
120
|
const e = p();
|
|
119
121
|
if (!e) return;
|
|
120
122
|
e.table.remove(), document.dispatchEvent(new CustomEvent("tableDeleted"));
|
|
121
|
-
},
|
|
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
|
|
139
|
-
if (!
|
|
140
|
-
const
|
|
141
|
-
r.setAttribute("colspan", String(
|
|
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
|
-
}),
|
|
145
|
+
}), s.remove(), g();
|
|
144
146
|
};
|
|
145
147
|
function p() {
|
|
146
|
-
var
|
|
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 ? (
|
|
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
|
|
155
|
-
if (
|
|
156
|
-
let u =
|
|
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] ===
|
|
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
|
-
|
|
183
|
+
N(t, n);
|
|
182
184
|
}
|
|
183
|
-
function
|
|
184
|
-
|
|
185
|
+
function G() {
|
|
186
|
+
R = () => {
|
|
185
187
|
const e = p();
|
|
186
|
-
e ?
|
|
187
|
-
},
|
|
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
|
-
|
|
194
|
-
},
|
|
195
|
-
m && h && h.style.display !== "none" &&
|
|
196
|
-
},
|
|
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
|
|
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,
|
|
202
|
-
a < o && (a = t.bottom + o),
|
|
203
|
-
const
|
|
204
|
-
|
|
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 =
|
|
208
|
+
a + l > d - o && (a = d - l - o), h.style.top = a + "px", h.style.left = s + "px";
|
|
207
209
|
}
|
|
208
|
-
function
|
|
209
|
-
m = e, h || (h =
|
|
210
|
-
|
|
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
|
|
213
|
-
|
|
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
|
|
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
|
|
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 = () =>
|
|
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:
|
|
250
|
+
icon: ne(),
|
|
247
251
|
title: "Add row above (Ctrl+Shift+R)",
|
|
248
252
|
action: "addRowAbove"
|
|
249
253
|
}),
|
|
250
254
|
t({
|
|
251
|
-
icon:
|
|
255
|
+
icon: oe(),
|
|
252
256
|
title: "Add row below",
|
|
253
257
|
action: "addRowBelow"
|
|
254
258
|
}),
|
|
255
259
|
t({
|
|
256
|
-
icon:
|
|
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:
|
|
267
|
+
icon: re(),
|
|
264
268
|
title: "Add column left",
|
|
265
269
|
action: "addColumnLeft"
|
|
266
270
|
}),
|
|
267
271
|
t({
|
|
268
|
-
icon:
|
|
272
|
+
icon: ae(),
|
|
269
273
|
title: "Add column right (Ctrl+Shift+C)",
|
|
270
274
|
action: "addColumnRight"
|
|
271
275
|
}),
|
|
272
276
|
t({
|
|
273
|
-
icon:
|
|
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:
|
|
289
|
+
icon: de(),
|
|
286
290
|
title: "Toggle header column",
|
|
287
291
|
action: "toggleHeaderColumn"
|
|
288
292
|
})
|
|
289
|
-
),
|
|
293
|
+
), s = l(
|
|
290
294
|
t({
|
|
291
|
-
icon:
|
|
295
|
+
icon: ue(),
|
|
292
296
|
title: "Merge cells (horizontally)",
|
|
293
297
|
action: "mergeCells"
|
|
294
298
|
})
|
|
295
|
-
),
|
|
299
|
+
), i = l(
|
|
296
300
|
t({
|
|
297
|
-
icon:
|
|
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(
|
|
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(),
|
|
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
|
|
313
|
+
function Z(e) {
|
|
310
314
|
switch (e) {
|
|
311
315
|
case "addRowAbove":
|
|
312
|
-
|
|
316
|
+
P();
|
|
313
317
|
break;
|
|
314
318
|
case "addRowBelow":
|
|
315
|
-
|
|
319
|
+
z();
|
|
316
320
|
break;
|
|
317
321
|
case "addColumnLeft":
|
|
318
|
-
|
|
322
|
+
W();
|
|
319
323
|
break;
|
|
320
324
|
case "addColumnRight":
|
|
321
|
-
|
|
325
|
+
T();
|
|
322
326
|
break;
|
|
323
327
|
case "deleteRow":
|
|
324
|
-
|
|
328
|
+
O();
|
|
325
329
|
break;
|
|
326
330
|
case "deleteColumn":
|
|
327
|
-
|
|
331
|
+
K();
|
|
328
332
|
break;
|
|
329
333
|
case "toggleHeaderRow":
|
|
330
|
-
|
|
334
|
+
Y();
|
|
331
335
|
break;
|
|
332
336
|
case "toggleHeaderColumn":
|
|
333
|
-
|
|
337
|
+
F();
|
|
334
338
|
break;
|
|
335
339
|
case "deleteTable":
|
|
336
|
-
|
|
340
|
+
U();
|
|
337
341
|
break;
|
|
338
342
|
case "mergeCells":
|
|
339
|
-
|
|
343
|
+
j();
|
|
340
344
|
break;
|
|
341
345
|
}
|
|
342
346
|
}
|
|
343
|
-
function
|
|
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,
|
|
351
|
-
if (
|
|
352
|
-
const
|
|
353
|
-
|
|
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
|
-
`,
|
|
364
|
-
w || (
|
|
365
|
-
}),
|
|
366
|
-
w || (
|
|
367
|
-
}),
|
|
368
|
-
d.preventDefault(), d.stopPropagation(),
|
|
369
|
-
}), a.style.position = "relative", a.appendChild(
|
|
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(),
|
|
377
|
+
a.preventDefault(), a.stopPropagation(), te(a);
|
|
374
378
|
}), e.appendChild(o);
|
|
375
379
|
}
|
|
376
|
-
function
|
|
377
|
-
if (w = !0, v = t,
|
|
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] && (
|
|
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 -
|
|
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 =
|
|
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
|
|
395
|
+
function te(e) {
|
|
392
396
|
if (!m) return;
|
|
393
|
-
|
|
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 (!
|
|
396
|
-
const r = l.clientX -
|
|
397
|
-
m.style.width = a + "px", m.style.height =
|
|
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
|
-
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
-
|
|
460
|
+
G();
|
|
457
461
|
};
|
|
458
462
|
document.readyState === "loading" ? document.addEventListener("DOMContentLoaded", e) : setTimeout(e, 100);
|
|
459
463
|
}
|
|
460
|
-
const
|
|
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="
|
|
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: () => (
|
|
474
|
+
insertTable: () => (_(), !0)
|
|
471
475
|
},
|
|
472
476
|
keymap: {
|
|
473
|
-
"Mod-Shift-r": () => (
|
|
474
|
-
"Mod-Shift-c": () => (
|
|
477
|
+
"Mod-Shift-r": () => (z(), !0),
|
|
478
|
+
"Mod-Shift-c": () => (T(), !0)
|
|
475
479
|
}
|
|
476
480
|
});
|
|
477
481
|
export {
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
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-
|
|
495
|
+
//# sourceMappingURL=TablePlugin.native-DrHX-efe.mjs.map
|