@editora/core 1.0.17 → 1.0.19
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/dist/{CodePlugin.native-BH-K4xmW.mjs → CodePlugin.native-BcVqm5MS.mjs} +64 -65
- package/dist/{CodePlugin.native-hNgfXlfS.mjs → CodePlugin.native-Rgxx2Igx.mjs} +2708 -1225
- package/dist/{DocumentManagerPlugin.native-iFip6s4Q.mjs → DocumentManagerPlugin.native-B8K-Oqom.mjs} +12 -11
- package/dist/{PreviewPlugin.native-CiR51jql.mjs → PreviewPlugin.native-Dyht8mGi.mjs} +48 -51
- package/dist/{TablePlugin.native-BjIxYZ2X.mjs → TablePlugin.native-C1YZ372P.mjs} +156 -147
- package/dist/TemplatePlugin.native-BDV2eik2.mjs +628 -0
- package/dist/{documentManager-BcBIv5P-.mjs → documentManager-BWK_-KJp.mjs} +524 -526
- package/dist/editora.min.js +17 -17
- package/dist/editora.umd.js +22 -22
- package/dist/index-CclXYzUB.js +12 -0
- package/dist/{index-XsYC_KdJ.mjs → index-DeUjxpKd.mjs} +406 -386
- package/dist/index.cjs.js +10 -10
- package/dist/index.esm.js +78 -67
- package/dist/plugin-loader.js +4 -4
- package/dist/purify.es-BHa5gZB7.mjs +1481 -0
- package/dist/sanitizeHtml-DA0ajC6k.mjs +17 -0
- package/dist/webcomponent-core.js +376 -362
- package/dist/webcomponent-core.min.js +91 -89
- package/dist/webcomponent.cjs.js +1 -1
- package/dist/webcomponent.esm.js +2 -2
- package/dist/webcomponent.js +382 -368
- package/dist/webcomponent.min.js +968 -967
- package/index.d.ts +9 -0
- package/package.json +1 -1
- package/dist/TemplatePlugin.native-D6n5RUnC.mjs +0 -1176
- package/dist/index-_eKRBZPq.js +0 -12
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { f as
|
|
2
|
-
let
|
|
1
|
+
import { f as Z, g as $ } from "./editorContainerHelpers-C7kdWnS0.mjs";
|
|
2
|
+
let h = null, b = null, A = null, V = null, B = null, N = null, D = null;
|
|
3
3
|
const H = '[data-theme="dark"], .dark, .editora-theme-dark';
|
|
4
|
-
let
|
|
5
|
-
const
|
|
4
|
+
let k = !1, y = null, q = 0, O = 0, z = !1, P = 0, W = 0, _ = 0, X = 0;
|
|
5
|
+
const ee = /* @__PURE__ */ new Set([
|
|
6
6
|
"DIV",
|
|
7
7
|
"P",
|
|
8
8
|
"BLOCKQUOTE",
|
|
@@ -17,24 +17,24 @@ const Z = /* @__PURE__ */ new Set([
|
|
|
17
17
|
"TD",
|
|
18
18
|
"TH"
|
|
19
19
|
]);
|
|
20
|
-
function
|
|
20
|
+
function K(e, t) {
|
|
21
21
|
let n = e;
|
|
22
22
|
for (; n && n !== t; ) {
|
|
23
|
-
if (n.nodeType === Node.ELEMENT_NODE &&
|
|
23
|
+
if (n.nodeType === Node.ELEMENT_NODE && ee.has(n.tagName))
|
|
24
24
|
return n;
|
|
25
25
|
n = n.parentNode;
|
|
26
26
|
}
|
|
27
27
|
return null;
|
|
28
28
|
}
|
|
29
|
-
function
|
|
29
|
+
function U(e) {
|
|
30
30
|
const t = e.parentElement;
|
|
31
31
|
if (t && t.classList.contains("rte-table-wrapper"))
|
|
32
32
|
return t;
|
|
33
33
|
const n = document.createElement("div");
|
|
34
34
|
return n.className = "rte-table-wrapper", t == null || t.insertBefore(n, e), n.appendChild(e), n;
|
|
35
35
|
}
|
|
36
|
-
const
|
|
37
|
-
const e =
|
|
36
|
+
const te = () => {
|
|
37
|
+
const e = Z(), t = $(e);
|
|
38
38
|
if (!t)
|
|
39
39
|
return alert("Please place your cursor in the editor before inserting a table"), !1;
|
|
40
40
|
const n = window.getSelection();
|
|
@@ -51,25 +51,25 @@ const $ = () => {
|
|
|
51
51
|
for (let m = 0; m < 2; m++) {
|
|
52
52
|
const g = document.createElement("tr");
|
|
53
53
|
for (let w = 0; w < 3; w++) {
|
|
54
|
-
const x = document.createElement("td"),
|
|
55
|
-
|
|
54
|
+
const x = document.createElement("td"), S = document.createElement("p");
|
|
55
|
+
S.appendChild(document.createElement("br")), x.appendChild(S), g.appendChild(x);
|
|
56
56
|
}
|
|
57
57
|
a.appendChild(g);
|
|
58
58
|
}
|
|
59
59
|
l.appendChild(r), l.appendChild(a);
|
|
60
|
-
const s =
|
|
60
|
+
const s = U(l), d = (m, g, w) => {
|
|
61
61
|
if (m !== t) return m;
|
|
62
62
|
const x = w ? g - 1 : g;
|
|
63
63
|
return t.childNodes[Math.min(Math.max(x, 0), t.childNodes.length - 1)] || null;
|
|
64
|
-
}, c = d(o.endContainer, o.endOffset, !0),
|
|
64
|
+
}, c = d(o.endContainer, o.endOffset, !0), u = d(o.startContainer, o.startOffset, !1), C = c && K(c, t) || u && K(u, t);
|
|
65
65
|
C && C.parentNode ? C.parentNode.insertBefore(s, C.nextSibling) : (o.collapse(!1), o.insertNode(s));
|
|
66
|
-
const
|
|
67
|
-
if (
|
|
66
|
+
const L = l.querySelector("th p");
|
|
67
|
+
if (L) {
|
|
68
68
|
const m = document.createRange();
|
|
69
|
-
m.setStart(
|
|
69
|
+
m.setStart(L, 0), m.collapse(!0), n.removeAllRanges(), n.addRange(m);
|
|
70
70
|
}
|
|
71
71
|
t.focus();
|
|
72
|
-
},
|
|
72
|
+
}, ne = () => {
|
|
73
73
|
var i;
|
|
74
74
|
const e = f();
|
|
75
75
|
if (!e) return;
|
|
@@ -80,7 +80,7 @@ const $ = () => {
|
|
|
80
80
|
}
|
|
81
81
|
const r = t.rows[n];
|
|
82
82
|
r && r.parentElement ? r.parentElement.insertBefore(o, r) : t.appendChild(o), p();
|
|
83
|
-
},
|
|
83
|
+
}, oe = () => {
|
|
84
84
|
var r, i;
|
|
85
85
|
const e = f();
|
|
86
86
|
if (!e) return;
|
|
@@ -97,7 +97,7 @@ const $ = () => {
|
|
|
97
97
|
(i = a.parentElement) == null || i.insertBefore(o, a);
|
|
98
98
|
}
|
|
99
99
|
p();
|
|
100
|
-
},
|
|
100
|
+
}, re = () => {
|
|
101
101
|
const e = f();
|
|
102
102
|
if (!e) return;
|
|
103
103
|
const { table: t, colIndex: n } = e;
|
|
@@ -106,7 +106,7 @@ const $ = () => {
|
|
|
106
106
|
i.innerHTML = "<br>", r.appendChild(i), n === 0 ? l.insertBefore(r, l.cells[0]) : l.insertBefore(r, l.cells[n]);
|
|
107
107
|
}
|
|
108
108
|
p();
|
|
109
|
-
},
|
|
109
|
+
}, le = () => {
|
|
110
110
|
const e = f();
|
|
111
111
|
if (!e) return;
|
|
112
112
|
const { table: t, colIndex: n } = e;
|
|
@@ -115,12 +115,12 @@ const $ = () => {
|
|
|
115
115
|
i.innerHTML = "<br>", r.appendChild(i), n >= l.cells.length - 1 ? l.appendChild(r) : l.insertBefore(r, l.cells[n + 1]);
|
|
116
116
|
}
|
|
117
117
|
p();
|
|
118
|
-
},
|
|
118
|
+
}, ae = () => {
|
|
119
119
|
const e = f();
|
|
120
120
|
if (!e || e.rowCount <= 1) return;
|
|
121
121
|
const { table: t, rowIndex: n, colIndex: o } = e;
|
|
122
|
-
t.deleteRow(n),
|
|
123
|
-
},
|
|
122
|
+
t.deleteRow(n), G(t, n, o), p();
|
|
123
|
+
}, ie = () => {
|
|
124
124
|
const e = f();
|
|
125
125
|
if (!e || e.cellCount <= 1) return;
|
|
126
126
|
const { table: t, rowIndex: n, colIndex: o } = e;
|
|
@@ -128,8 +128,8 @@ const $ = () => {
|
|
|
128
128
|
const r = t.rows[l];
|
|
129
129
|
r.cells[o] && r.deleteCell(o);
|
|
130
130
|
}
|
|
131
|
-
|
|
132
|
-
},
|
|
131
|
+
G(t, n, o), p();
|
|
132
|
+
}, de = () => {
|
|
133
133
|
var i, a;
|
|
134
134
|
const e = f();
|
|
135
135
|
if (!e) return;
|
|
@@ -142,15 +142,15 @@ const $ = () => {
|
|
|
142
142
|
const d = t.querySelector("tbody") || t.appendChild(document.createElement("tbody"));
|
|
143
143
|
d.insertBefore(o, d.firstChild), s.rows.length === 0 && s.remove();
|
|
144
144
|
} else
|
|
145
|
-
|
|
145
|
+
F(o, "td");
|
|
146
146
|
} else if (!r || o === ((a = t.tBodies[0]) == null ? void 0 : a.rows[0])) {
|
|
147
147
|
let s = r;
|
|
148
148
|
s || (s = document.createElement("thead"), t.insertBefore(s, t.firstChild)), s.appendChild(o);
|
|
149
149
|
} else
|
|
150
|
-
|
|
150
|
+
F(o, "th");
|
|
151
151
|
p();
|
|
152
152
|
};
|
|
153
|
-
function
|
|
153
|
+
function F(e, t) {
|
|
154
154
|
Array.from(e.cells).forEach((n) => {
|
|
155
155
|
var l;
|
|
156
156
|
if (n.tagName.toLowerCase() === t) return;
|
|
@@ -163,7 +163,7 @@ function K(e, t) {
|
|
|
163
163
|
(l = n.parentNode) == null || l.replaceChild(o, n);
|
|
164
164
|
});
|
|
165
165
|
}
|
|
166
|
-
const
|
|
166
|
+
const se = () => {
|
|
167
167
|
var o;
|
|
168
168
|
const e = f();
|
|
169
169
|
if (!e) return;
|
|
@@ -181,7 +181,7 @@ const ie = () => {
|
|
|
181
181
|
}
|
|
182
182
|
}
|
|
183
183
|
p();
|
|
184
|
-
},
|
|
184
|
+
}, ce = () => {
|
|
185
185
|
const e = f();
|
|
186
186
|
if (!e) return;
|
|
187
187
|
const t = e.table, n = t.parentElement;
|
|
@@ -192,16 +192,16 @@ function v(e, t) {
|
|
|
192
192
|
const n = e.nodeType === Node.ELEMENT_NODE ? e : e.parentElement;
|
|
193
193
|
return n ? n.closest(t) : null;
|
|
194
194
|
}
|
|
195
|
-
function
|
|
195
|
+
function Y(e) {
|
|
196
196
|
if (!e) return !1;
|
|
197
197
|
const t = e.closest("[contenteditable]");
|
|
198
198
|
return !t || t.getAttribute("contenteditable") === "false" ? !1 : !t.closest('[data-readonly="true"]');
|
|
199
199
|
}
|
|
200
|
-
function
|
|
200
|
+
function ue() {
|
|
201
201
|
const e = window.getSelection(), t = e && e.rangeCount > 0 ? e.getRangeAt(0).startContainer : null;
|
|
202
|
-
return v(t, ".rte-content") || (
|
|
202
|
+
return v(t, ".rte-content") || (b ? b.closest(".rte-content") : null);
|
|
203
203
|
}
|
|
204
|
-
function
|
|
204
|
+
function he(e, t, n) {
|
|
205
205
|
const o = window.execEditorCommand || window.executeEditorCommand;
|
|
206
206
|
if (typeof o == "function")
|
|
207
207
|
try {
|
|
@@ -209,15 +209,15 @@ function ce(e, t, n) {
|
|
|
209
209
|
} catch (l) {
|
|
210
210
|
}
|
|
211
211
|
}
|
|
212
|
-
function
|
|
213
|
-
const t =
|
|
214
|
-
if (t && !
|
|
212
|
+
function j(e) {
|
|
213
|
+
const t = ue();
|
|
214
|
+
if (t && !Y(t)) return;
|
|
215
215
|
const n = t ? t.innerHTML : "";
|
|
216
216
|
if (e(), !t) return;
|
|
217
217
|
const o = t.innerHTML;
|
|
218
|
-
o !== n && (
|
|
218
|
+
o !== n && (he(t, n, o), t.dispatchEvent(new Event("input", { bubbles: !0 })));
|
|
219
219
|
}
|
|
220
|
-
function
|
|
220
|
+
function G(e, t, n) {
|
|
221
221
|
if (!e.isConnected || e.rows.length === 0) return;
|
|
222
222
|
const o = e.rows[Math.min(t, e.rows.length - 1)], l = o.cells[Math.min(n, o.cells.length - 1)];
|
|
223
223
|
if (!l) return;
|
|
@@ -226,7 +226,7 @@ function j(e, t, n) {
|
|
|
226
226
|
const a = window.getSelection();
|
|
227
227
|
a == null || a.removeAllRanges(), a == null || a.addRange(r);
|
|
228
228
|
}
|
|
229
|
-
const
|
|
229
|
+
const be = () => {
|
|
230
230
|
const e = window.getSelection();
|
|
231
231
|
if (!e || e.rangeCount === 0) return;
|
|
232
232
|
const n = e.getRangeAt(0).startContainer;
|
|
@@ -245,8 +245,8 @@ const ue = () => {
|
|
|
245
245
|
const i = l.cells[r + 1];
|
|
246
246
|
if (!i) return;
|
|
247
247
|
const a = (d, c) => {
|
|
248
|
-
const
|
|
249
|
-
return Number.isFinite(
|
|
248
|
+
const u = parseInt(d.getAttribute(c) || "1", 10);
|
|
249
|
+
return Number.isFinite(u) && u > 0 ? u : 1;
|
|
250
250
|
};
|
|
251
251
|
if (a(o, "rowspan") !== a(i, "rowspan")) return;
|
|
252
252
|
o.setAttribute("colspan", String(a(o, "colspan") + a(i, "colspan"))), Array.from(i.childNodes).forEach((d) => {
|
|
@@ -283,61 +283,68 @@ function f() {
|
|
|
283
283
|
};
|
|
284
284
|
}
|
|
285
285
|
function p() {
|
|
286
|
-
if (!
|
|
286
|
+
if (!h || !b) return;
|
|
287
287
|
const e = f();
|
|
288
288
|
if (!e) return;
|
|
289
289
|
const t = e.rowCount > 1, n = e.cellCount > 1;
|
|
290
|
-
|
|
290
|
+
J(t, n);
|
|
291
291
|
}
|
|
292
|
-
function
|
|
293
|
-
|
|
292
|
+
function me() {
|
|
293
|
+
A = () => {
|
|
294
294
|
const e = f();
|
|
295
|
-
e &&
|
|
295
|
+
e && Y(e.table) ? fe(e.table) : R();
|
|
296
296
|
}, V = (e) => {
|
|
297
297
|
const t = v(e.target, "table"), n = v(e.target, ".table-toolbar");
|
|
298
298
|
!t && !n && R();
|
|
299
|
-
}, A = () => {
|
|
300
|
-
R();
|
|
301
299
|
}, B = () => {
|
|
302
|
-
|
|
300
|
+
R();
|
|
303
301
|
}, N = () => {
|
|
304
|
-
|
|
305
|
-
},
|
|
302
|
+
b && h && h.style.display !== "none" && M(b);
|
|
303
|
+
}, D = () => {
|
|
304
|
+
b && h && h.style.display !== "none" && M(b);
|
|
305
|
+
}, document.addEventListener("selectionchange", A), document.addEventListener("mousedown", V), document.addEventListener("tableDeleted", B), window.addEventListener("scroll", N, !0), window.addEventListener("resize", D);
|
|
306
306
|
}
|
|
307
307
|
function M(e) {
|
|
308
|
-
if (!
|
|
309
|
-
const t = e.getBoundingClientRect(), n =
|
|
308
|
+
if (!h) return;
|
|
309
|
+
const t = e.getBoundingClientRect(), n = h.getBoundingClientRect(), o = n.height || 40, l = n.width || 280, r = 10;
|
|
310
310
|
let i = t.top - o - r, a = t.left + t.width / 2 - l / 2;
|
|
311
311
|
i < r && (i = t.bottom + r), a < r && (a = r);
|
|
312
312
|
const s = window.innerWidth;
|
|
313
313
|
a + l > s - r && (a = s - l - r);
|
|
314
314
|
const d = window.innerHeight;
|
|
315
|
-
i + o > d - r && (i = d - o - r),
|
|
315
|
+
i + o > d - r && (i = d - o - r), h.style.top = i + "px", h.style.left = a + "px";
|
|
316
316
|
}
|
|
317
|
-
function
|
|
318
|
-
|
|
317
|
+
function fe(e) {
|
|
318
|
+
b = e, h || (h = ge(), document.body.appendChild(h));
|
|
319
319
|
const t = !!e.closest(H) || document.body.matches(H) || document.documentElement.matches(H);
|
|
320
|
-
|
|
321
|
-
M(e),
|
|
320
|
+
h.classList.toggle("rte-theme-dark", t), h.style.display = "flex", h.style.visibility = "hidden", requestAnimationFrame(() => {
|
|
321
|
+
M(e), h && (h.style.visibility = "visible");
|
|
322
322
|
});
|
|
323
323
|
const n = f();
|
|
324
|
-
n &&
|
|
324
|
+
n && J(n.rowCount > 1, n.cellCount > 1), we(e);
|
|
325
|
+
}
|
|
326
|
+
const I = /* @__PURE__ */ new Set();
|
|
327
|
+
function Q() {
|
|
328
|
+
I.forEach((e) => {
|
|
329
|
+
var t;
|
|
330
|
+
e.style.position === "relative" && (e.style.removeProperty("position"), (t = e.getAttribute("style")) != null && t.trim() || e.removeAttribute("style"));
|
|
331
|
+
}), I.clear();
|
|
325
332
|
}
|
|
326
333
|
function R() {
|
|
327
|
-
if (
|
|
328
|
-
|
|
329
|
-
const t =
|
|
334
|
+
if (h && (h.style.display = "none"), b) {
|
|
335
|
+
b.querySelectorAll(".resize-handle").forEach((o) => o.remove());
|
|
336
|
+
const t = b.parentElement, n = t != null && t.classList.contains("rte-table-wrapper") ? t.querySelector(".table-resize-handle") : b.querySelector(".table-resize-handle");
|
|
330
337
|
n && n.remove();
|
|
331
338
|
}
|
|
332
|
-
|
|
339
|
+
Q(), b = null;
|
|
333
340
|
}
|
|
334
|
-
function
|
|
335
|
-
if (!
|
|
336
|
-
const n =
|
|
341
|
+
function J(e, t) {
|
|
342
|
+
if (!h) return;
|
|
343
|
+
const n = h.querySelector('[data-action="deleteRow"]'), o = h.querySelector('[data-action="deleteColumn"]');
|
|
337
344
|
n && (n.disabled = !e), o && (o.disabled = !t);
|
|
338
345
|
}
|
|
339
346
|
let T = !1;
|
|
340
|
-
function
|
|
347
|
+
function pe() {
|
|
341
348
|
if (T || typeof document == "undefined") return;
|
|
342
349
|
if (document.getElementById("rte-table-toolbar-styles")) {
|
|
343
350
|
T = !0;
|
|
@@ -500,8 +507,8 @@ function me() {
|
|
|
500
507
|
}
|
|
501
508
|
`, document.head.appendChild(e);
|
|
502
509
|
}
|
|
503
|
-
function
|
|
504
|
-
|
|
510
|
+
function ge() {
|
|
511
|
+
pe();
|
|
505
512
|
const e = document.createElement("div");
|
|
506
513
|
e.className = "table-toolbar", e.style.cssText = `
|
|
507
514
|
position: fixed;
|
|
@@ -509,68 +516,68 @@ function fe() {
|
|
|
509
516
|
display: none;
|
|
510
517
|
`, e.setAttribute("role", "toolbar"), e.setAttribute("aria-label", "Table editing toolbar");
|
|
511
518
|
const t = (c) => {
|
|
512
|
-
const
|
|
513
|
-
return
|
|
519
|
+
const u = document.createElement("button");
|
|
520
|
+
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 = () => E(c.action), u;
|
|
514
521
|
}, n = () => {
|
|
515
522
|
const c = document.createElement("div");
|
|
516
523
|
return c.className = "toolbar-divider", c;
|
|
517
524
|
}, o = (...c) => {
|
|
518
|
-
const
|
|
519
|
-
return
|
|
525
|
+
const u = document.createElement("div");
|
|
526
|
+
return u.className = "toolbar-section", c.forEach((C) => u.appendChild(C)), u;
|
|
520
527
|
}, l = o(
|
|
521
528
|
t({
|
|
522
|
-
icon:
|
|
529
|
+
icon: ye(),
|
|
523
530
|
title: "Add row above (Ctrl+Shift+R)",
|
|
524
531
|
action: "addRowAbove"
|
|
525
532
|
}),
|
|
526
533
|
t({
|
|
527
|
-
icon:
|
|
534
|
+
icon: ke(),
|
|
528
535
|
title: "Add row below",
|
|
529
536
|
action: "addRowBelow"
|
|
530
537
|
}),
|
|
531
538
|
t({
|
|
532
|
-
icon:
|
|
539
|
+
icon: Ee(),
|
|
533
540
|
title: "Delete row",
|
|
534
541
|
action: "deleteRow",
|
|
535
542
|
danger: !0
|
|
536
543
|
})
|
|
537
544
|
), r = o(
|
|
538
545
|
t({
|
|
539
|
-
icon:
|
|
546
|
+
icon: xe(),
|
|
540
547
|
title: "Add column left",
|
|
541
548
|
action: "addColumnLeft"
|
|
542
549
|
}),
|
|
543
550
|
t({
|
|
544
|
-
icon:
|
|
551
|
+
icon: He(),
|
|
545
552
|
title: "Add column right (Ctrl+Shift+C)",
|
|
546
553
|
action: "addColumnRight"
|
|
547
554
|
}),
|
|
548
555
|
t({
|
|
549
|
-
icon:
|
|
556
|
+
icon: ze(),
|
|
550
557
|
title: "Delete column",
|
|
551
558
|
action: "deleteColumn",
|
|
552
559
|
danger: !0
|
|
553
560
|
})
|
|
554
561
|
), i = o(
|
|
555
562
|
t({
|
|
556
|
-
icon:
|
|
563
|
+
icon: Re(),
|
|
557
564
|
title: "Toggle header row",
|
|
558
565
|
action: "toggleHeaderRow"
|
|
559
566
|
}),
|
|
560
567
|
t({
|
|
561
|
-
icon:
|
|
568
|
+
icon: Te(),
|
|
562
569
|
title: "Toggle header column",
|
|
563
570
|
action: "toggleHeaderColumn"
|
|
564
571
|
})
|
|
565
572
|
), a = o(
|
|
566
573
|
t({
|
|
567
|
-
icon:
|
|
574
|
+
icon: Ie(),
|
|
568
575
|
title: "Merge cells (horizontally)",
|
|
569
576
|
action: "mergeCells"
|
|
570
577
|
})
|
|
571
578
|
), s = o(
|
|
572
579
|
t({
|
|
573
|
-
icon:
|
|
580
|
+
icon: Me(),
|
|
574
581
|
title: "Delete table",
|
|
575
582
|
action: "deleteTable",
|
|
576
583
|
delete: !0
|
|
@@ -578,51 +585,51 @@ function fe() {
|
|
|
578
585
|
);
|
|
579
586
|
e.appendChild(l), e.appendChild(n()), e.appendChild(r), e.appendChild(n()), e.appendChild(i), e.appendChild(n()), e.appendChild(a), e.appendChild(n()), e.appendChild(s);
|
|
580
587
|
const d = (c) => {
|
|
581
|
-
!
|
|
588
|
+
!h || h.style.display === "none" || (c.ctrlKey || c.metaKey) && c.shiftKey && (c.key === "r" || c.key === "R" ? (c.preventDefault(), E("addRowBelow")) : (c.key === "c" || c.key === "C") && (c.preventDefault(), E("addColumnRight")));
|
|
582
589
|
};
|
|
583
590
|
return window.addEventListener("keydown", d), e;
|
|
584
591
|
}
|
|
585
592
|
function E(e) {
|
|
586
|
-
|
|
593
|
+
j(() => {
|
|
587
594
|
switch (e) {
|
|
588
595
|
case "addRowAbove":
|
|
589
|
-
|
|
596
|
+
ne();
|
|
590
597
|
break;
|
|
591
598
|
case "addRowBelow":
|
|
592
|
-
|
|
599
|
+
oe();
|
|
593
600
|
break;
|
|
594
601
|
case "addColumnLeft":
|
|
595
|
-
|
|
602
|
+
re();
|
|
596
603
|
break;
|
|
597
604
|
case "addColumnRight":
|
|
598
|
-
|
|
605
|
+
le();
|
|
599
606
|
break;
|
|
600
607
|
case "deleteRow":
|
|
601
|
-
|
|
608
|
+
ae();
|
|
602
609
|
break;
|
|
603
610
|
case "deleteColumn":
|
|
604
|
-
|
|
611
|
+
ie();
|
|
605
612
|
break;
|
|
606
613
|
case "toggleHeaderRow":
|
|
607
|
-
|
|
614
|
+
de();
|
|
608
615
|
break;
|
|
609
616
|
case "toggleHeaderColumn":
|
|
610
|
-
|
|
617
|
+
se();
|
|
611
618
|
break;
|
|
612
619
|
case "deleteTable":
|
|
613
|
-
|
|
620
|
+
ce();
|
|
614
621
|
break;
|
|
615
622
|
case "mergeCells":
|
|
616
|
-
|
|
623
|
+
be();
|
|
617
624
|
break;
|
|
618
625
|
}
|
|
619
626
|
});
|
|
620
627
|
}
|
|
621
|
-
function
|
|
622
|
-
const t =
|
|
628
|
+
function we(e) {
|
|
629
|
+
const t = U(e);
|
|
623
630
|
e.querySelectorAll(".resize-handle").forEach((a) => a.remove());
|
|
624
631
|
const o = t.querySelector(".table-resize-handle");
|
|
625
|
-
o && o.remove();
|
|
632
|
+
o && o.remove(), Q();
|
|
626
633
|
const l = e.querySelector("thead tr, tbody tr:first-child");
|
|
627
634
|
if (!l) return;
|
|
628
635
|
const r = l.querySelectorAll("td, th");
|
|
@@ -640,91 +647,93 @@ function pe(e) {
|
|
|
640
647
|
z-index: 10;
|
|
641
648
|
transition: background 0.15s ease;
|
|
642
649
|
`, d.addEventListener("mouseenter", () => {
|
|
643
|
-
|
|
650
|
+
k || (d.style.background = "rgba(0, 102, 204, 0.3)");
|
|
644
651
|
}), d.addEventListener("mouseleave", () => {
|
|
645
|
-
|
|
646
|
-
}), d.addEventListener("mousedown", (
|
|
647
|
-
|
|
648
|
-
})
|
|
652
|
+
k || (d.style.background = "transparent");
|
|
653
|
+
}), d.addEventListener("mousedown", (u) => {
|
|
654
|
+
u.preventDefault(), u.stopPropagation(), ve(u, s);
|
|
655
|
+
});
|
|
656
|
+
const c = a;
|
|
657
|
+
c.style.position || (c.style.position = "relative", I.add(c)), a.appendChild(d);
|
|
649
658
|
});
|
|
650
659
|
const i = document.createElement("div");
|
|
651
660
|
i.className = "table-resize-handle", i.addEventListener("mousedown", (a) => {
|
|
652
|
-
a.preventDefault(), a.stopPropagation(),
|
|
661
|
+
a.preventDefault(), a.stopPropagation(), Ce(a);
|
|
653
662
|
}), t.appendChild(i);
|
|
654
663
|
}
|
|
655
|
-
function
|
|
656
|
-
if (
|
|
657
|
-
const n =
|
|
658
|
-
n && n.cells[t] && (
|
|
664
|
+
function ve(e, t) {
|
|
665
|
+
if (k = !0, y = t, q = e.clientX, !b) return;
|
|
666
|
+
const n = b.querySelector("thead tr, tbody tr:first-child");
|
|
667
|
+
n && n.cells[t] && (O = n.cells[t].offsetWidth), document.body.style.cursor = "col-resize", document.body.style.userSelect = "none";
|
|
659
668
|
const o = (r) => {
|
|
660
|
-
if (!
|
|
661
|
-
const i = r.clientX -
|
|
662
|
-
|
|
663
|
-
d.cells[
|
|
669
|
+
if (!k || y === null || !b) return;
|
|
670
|
+
const i = r.clientX - q, a = Math.max(50, O + i);
|
|
671
|
+
b.querySelectorAll("tr").forEach((d) => {
|
|
672
|
+
d.cells[y] && (d.cells[y].style.width = a + "px");
|
|
664
673
|
});
|
|
665
674
|
}, l = () => {
|
|
666
|
-
|
|
675
|
+
k = !1, y = null, document.body.style.cursor = "", document.body.style.userSelect = "", document.removeEventListener("mousemove", o), document.removeEventListener("mouseup", l);
|
|
667
676
|
};
|
|
668
677
|
document.addEventListener("mousemove", o), document.addEventListener("mouseup", l);
|
|
669
678
|
}
|
|
670
|
-
function
|
|
671
|
-
if (!
|
|
672
|
-
z = !0,
|
|
679
|
+
function Ce(e) {
|
|
680
|
+
if (!b) return;
|
|
681
|
+
z = !0, P = e.clientX, W = e.clientY, _ = b.offsetWidth, X = b.offsetHeight, document.body.style.cursor = "nwse-resize", document.body.style.userSelect = "none";
|
|
673
682
|
const t = (o) => {
|
|
674
|
-
if (!z || !
|
|
675
|
-
const l = o.clientX -
|
|
676
|
-
|
|
683
|
+
if (!z || !b) return;
|
|
684
|
+
const l = o.clientX - P, r = o.clientY - W, i = Math.max(200, _ + l), a = Math.max(100, X + r);
|
|
685
|
+
b.style.width = i + "px", b.style.height = a + "px";
|
|
677
686
|
}, n = () => {
|
|
678
687
|
z = !1, document.body.style.cursor = "", document.body.style.userSelect = "", document.removeEventListener("mousemove", t), document.removeEventListener("mouseup", n);
|
|
679
688
|
};
|
|
680
689
|
document.addEventListener("mousemove", t), document.addEventListener("mouseup", n);
|
|
681
690
|
}
|
|
682
|
-
function
|
|
691
|
+
function ye() {
|
|
683
692
|
return `<svg width="16" height="16" viewBox="0 0 16 16" fill="currentColor">
|
|
684
693
|
<path d="M2 7h12V5H2v2zm0 4h12V9H2v2zM8 1v3H5v2h3v3h2V6h3V4h-3V1H8z"/>
|
|
685
694
|
</svg>`;
|
|
686
695
|
}
|
|
687
|
-
function
|
|
696
|
+
function ke() {
|
|
688
697
|
return `<svg width="16" height="16" viewBox="0 0 16 16" fill="currentColor">
|
|
689
698
|
<path d="M2 3h12V1H2v2zm0 4h12V5H2v2zm6 4v3h3v-2h2v-2h-2v-3h-2v3H5v2h3z"/>
|
|
690
699
|
</svg>`;
|
|
691
700
|
}
|
|
692
|
-
function
|
|
701
|
+
function Ee() {
|
|
693
702
|
return `<svg width="16" height="16" viewBox="0 0 16 16" fill="currentColor">
|
|
694
703
|
<path d="M2 5h12v2H2V5zm0 4h12v2H2V9zm4-6v2H4v2h2v2h2V7h2V5H8V3H6z"/>
|
|
695
704
|
</svg>`;
|
|
696
705
|
}
|
|
697
|
-
function
|
|
706
|
+
function xe() {
|
|
698
707
|
return `<svg width="16" height="16" viewBox="0 0 16 16" fill="currentColor">
|
|
699
708
|
<path d="M7 2v12h2V2H7zm4 0v12h2V2h-2zM1 8h3v-3H1v3zm3 2H1v3h3v-3z"/>
|
|
700
709
|
</svg>`;
|
|
701
710
|
}
|
|
702
|
-
function
|
|
711
|
+
function He() {
|
|
703
712
|
return `<svg width="16" height="16" viewBox="0 0 16 16" fill="currentColor">
|
|
704
713
|
<path d="M2 2v12h2V2H2zm4 0v12h2V2H6zM12 8h3v-3h-3v3zm0 2h3v3h-3v-3z"/>
|
|
705
714
|
</svg>`;
|
|
706
715
|
}
|
|
707
|
-
function
|
|
716
|
+
function ze() {
|
|
708
717
|
return `<svg width="16" height="16" viewBox="0 0 16 16" fill="currentColor">
|
|
709
718
|
<path d="M5 2v12h2V2H5zm4 0v12h2V2H9zm3 2h3V1h-3v3zm3 2h-3v3h3V6zm0 4h-3v3h3v-3z"/>
|
|
710
719
|
</svg>`;
|
|
711
720
|
}
|
|
712
|
-
function
|
|
721
|
+
function Re() {
|
|
713
722
|
return `<svg width="16" height="16" viewBox="0 0 16 16" fill="currentColor">
|
|
714
723
|
<path d="M2 2h12v3H2V2zm0 5h12v8H2V7zm2 2v4h2V9H4zm4 0v4h2V9H8zm4 0v4h2V9h-2z"/>
|
|
715
724
|
</svg>`;
|
|
716
725
|
}
|
|
717
|
-
function
|
|
726
|
+
function Te() {
|
|
718
727
|
return `<svg width="16" height="16" viewBox="0 0 16 16" fill="currentColor">
|
|
719
728
|
<path d="M2 2v12h3V2H2zm5 0v12h8V2H7zm2 2h4v2H9V4zm0 4h4v2H9V8zm0 4h4v2H9v-2z"/>
|
|
720
729
|
</svg>`;
|
|
721
730
|
}
|
|
722
|
-
function
|
|
731
|
+
function Me() {
|
|
723
732
|
return `<svg width="16" height="16" viewBox="0 0 16 16" fill="currentColor">
|
|
724
733
|
<path d="M3 1h10v1H3V1zm1 2v11h8V3H4zM6 5h1v6H6V5zm3 0h1v6H9V5z"/>
|
|
725
734
|
</svg>`;
|
|
726
735
|
}
|
|
727
|
-
function
|
|
736
|
+
function Ie() {
|
|
728
737
|
return `<svg width="16" height="16" viewBox="0 0 16 16" fill="currentColor">
|
|
729
738
|
<path d="M2 2h4v3H2V2zm5 0h4v3H7V2zm5 0h2v3h-2V2zm-10 4h4v3H2V6zm5 0h4v3H7V6zm5 0h2v3h-2V6zm-10 4h4v3H2v-3zm5 0h4v3H7v-3zm5 0h2v3h-2v-3z"/>
|
|
730
739
|
</svg>`;
|
|
@@ -732,11 +741,11 @@ function Te() {
|
|
|
732
741
|
if (typeof window != "undefined" && !window.__tablePluginInitialized) {
|
|
733
742
|
window.__tablePluginInitialized = !0;
|
|
734
743
|
const e = () => {
|
|
735
|
-
|
|
744
|
+
me();
|
|
736
745
|
};
|
|
737
746
|
document.readyState === "loading" ? document.addEventListener("DOMContentLoaded", e) : setTimeout(e, 100);
|
|
738
747
|
}
|
|
739
|
-
const
|
|
748
|
+
const Se = () => ({
|
|
740
749
|
name: "table",
|
|
741
750
|
toolbar: [
|
|
742
751
|
{
|
|
@@ -746,8 +755,8 @@ const Ie = () => ({
|
|
|
746
755
|
}
|
|
747
756
|
],
|
|
748
757
|
commands: {
|
|
749
|
-
insertTable: () => (
|
|
750
|
-
|
|
758
|
+
insertTable: () => (j(() => {
|
|
759
|
+
te();
|
|
751
760
|
}), !0)
|
|
752
761
|
},
|
|
753
762
|
keymap: {
|
|
@@ -756,17 +765,17 @@ const Ie = () => ({
|
|
|
756
765
|
}
|
|
757
766
|
});
|
|
758
767
|
export {
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
768
|
+
Se as TablePlugin,
|
|
769
|
+
re as addColumnLeftCommand,
|
|
770
|
+
le as addColumnRightCommand,
|
|
771
|
+
ne as addRowAboveCommand,
|
|
772
|
+
oe as addRowBelowCommand,
|
|
773
|
+
ie as deleteColumnCommand,
|
|
774
|
+
ae as deleteRowCommand,
|
|
775
|
+
ce as deleteTableCommand,
|
|
776
|
+
te as insertTableCommand,
|
|
777
|
+
be as mergeCellsCommand,
|
|
778
|
+
se as toggleHeaderColumnCommand,
|
|
779
|
+
de as toggleHeaderRowCommand
|
|
771
780
|
};
|
|
772
|
-
//# sourceMappingURL=TablePlugin.native-
|
|
781
|
+
//# sourceMappingURL=TablePlugin.native-C1YZ372P.mjs.map
|