@editora/core 1.0.23 → 1.0.25
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/{A11yCheckerPlugin.native-qW_njhLY.mjs → A11yCheckerPlugin.native-BBCsR5Ur.mjs} +7 -5
- package/dist/{AnchorPlugin.native-Drmxhy98.mjs → AnchorPlugin.native-Dk9R26cF.mjs} +20 -19
- package/dist/{ApprovalWorkflowPlugin.native-ZsS_2xmn.mjs → ApprovalWorkflowPlugin.native-AeJsehXM.mjs} +56 -55
- package/dist/{BackgroundColorPlugin.native-H3XyYD7_.mjs → BackgroundColorPlugin.native-DCAd94kp.mjs} +103 -98
- package/dist/{BlocksLibraryPlugin.native-CownM6Rk.mjs → BlocksLibraryPlugin.native-D9OPcnQV.mjs} +42 -43
- package/dist/{CitationsPlugin.native-C_7wWQ-k.mjs → CitationsPlugin.native-BFChgCSV.mjs} +51 -51
- package/dist/{CodePlugin.native-DZgIez08.mjs → CodePlugin.native-CPfKDrkr.mjs} +1383 -1094
- package/dist/{CodePlugin.native-CAHk9ecG.mjs → CodePlugin.native-CRpX2G93.mjs} +167 -113
- package/dist/{CodeSamplePlugin.native-svbAFWh_.mjs → CodeSamplePlugin.native-Bai8bgl3.mjs} +5 -5
- package/dist/{CommentsPlugin.native-DncTHiEe.mjs → CommentsPlugin.native-DHCDUm9f.mjs} +161 -141
- package/dist/{ConditionalContentPlugin.native-Bf7XgRSW.mjs → ConditionalContentPlugin.native-B3R6xcqn.mjs} +3 -3
- package/dist/{ContentRulesPlugin.native-vPx5nC73.mjs → ContentRulesPlugin.native-BISqhQKJ.mjs} +52 -52
- package/dist/{DataBindingPlugin.native-B7lpI_0c.mjs → DataBindingPlugin.native-DbaDeXNp.mjs} +37 -37
- package/dist/{DocumentManagerPlugin.native-B8K-Oqom.mjs → DocumentManagerPlugin.native-CaBqCH-p.mjs} +21 -20
- package/dist/{EmbedIframePlugin.native-BfZ_HGlV.mjs → EmbedIframePlugin.native-qHMf1Jtg.mjs} +7 -7
- package/dist/{EmojisPlugin.native-D92aaOKi.mjs → EmojisPlugin.native-B64efKg5.mjs} +4 -4
- package/dist/{FormatPainterPlugin.native-BhjzsiVq.mjs → FormatPainterPlugin.native-CAc1N6xU.mjs} +183 -161
- package/dist/{HeadingPlugin.native-DZdvubrQ.mjs → HeadingPlugin.native-C3YiGERx.mjs} +85 -72
- package/dist/HistoryPlugin.native-C8GyxsgC.mjs +330 -0
- package/dist/{LinkPlugin.native-BsQXYsK6.mjs → LinkPlugin.native-Dt_p6Ukb.mjs} +4 -4
- package/dist/ListPlugin.native-UYaoRiub.mjs +239 -0
- package/dist/{MathPlugin.native-Byo3WL0f.mjs → MathPlugin.native-Cq9WQ7cq.mjs} +148 -130
- package/dist/MediaManagerPlugin.native-0YFHZfsb.mjs +4823 -0
- package/dist/MediaManagerPlugin.native-mXWWARRX.mjs +4908 -0
- package/dist/{MentionPlugin.native-S_lwGZQO.mjs → MentionPlugin.native-Zb1dwdxU.mjs} +304 -300
- package/dist/{MergeTagPlugin.native-7-6F3S1Y.mjs → MergeTagPlugin.native-BXkVPvCo.mjs} +6 -4
- package/dist/{PIIRedactionPlugin.native-g7j4jOmm.mjs → PIIRedactionPlugin.native-Cm0bpzQb.mjs} +2 -2
- package/dist/{PreviewPlugin.native-Dv5OsffK.mjs → PreviewPlugin.native-CrfiwP2J.mjs} +2 -2
- package/dist/{SlashCommandsPlugin.native-BDIIwGNs.mjs → SlashCommandsPlugin.native-BzGTRmMB.mjs} +264 -240
- package/dist/{SmartPastePlugin.native-BATLCds5.mjs → SmartPastePlugin.native-DnOJhDsf.mjs} +2 -2
- package/dist/{SpecialCharactersPlugin.native-CdZoc1GB.mjs → SpecialCharactersPlugin.native-B0XaCfjZ.mjs} +4 -4
- package/dist/{SpellCheckPlugin.native-BGm2qPfn.mjs → SpellCheckPlugin.native-BE7os1Xj.mjs} +302 -265
- package/dist/{TablePlugin.native-C1YZ372P.mjs → TablePlugin.native-CWxEFpV8.mjs} +159 -136
- package/dist/{TemplatePlugin.native-Dwk8TgxI.mjs → TemplatePlugin.native-OD8Wc1R7.mjs} +6 -4
- package/dist/{TextColorPlugin.native-KMZ2uzlq.mjs → TextColorPlugin.native-C2IjioNM.mjs} +75 -71
- package/dist/{TranslationWorkflowPlugin.native-CZtG--06.mjs → TranslationWorkflowPlugin.native-BGXVJD9f.mjs} +101 -98
- package/dist/{VersionDiffPlugin.native-Ca1fMWUJ.mjs → VersionDiffPlugin.native-DJZIzFSK.mjs} +11 -11
- package/dist/anchoredPopover-QN4jNbW1.mjs +134 -0
- package/dist/confirmDialog-CNqPHT5x.mjs +92 -0
- package/dist/dialogHelpers-Dzn8DHoF.mjs +194 -0
- package/dist/{documentManager-BWK_-KJp.mjs → documentManager-DHLCoWzw.mjs} +1963 -1969
- package/dist/editora.min.js +21 -21
- package/dist/editora.umd.js +10 -10
- package/dist/index-DHPPVQwx.js +12 -0
- package/dist/{index-DGMYWPLx.mjs → index-gI4djib2.mjs} +407 -327
- package/dist/index.cjs.js +1 -1
- package/dist/index.esm.js +2 -2
- package/dist/katex-DLIObQUm.mjs +11683 -0
- package/dist/katex.min--Ws3c9be.mjs +6 -0
- package/dist/notify-DCQGpmq-.mjs +60 -0
- package/dist/plugin-loader.js +54 -54
- package/dist/shared-config-DuA34Iii.mjs +26 -0
- package/dist/webcomponent-core.js +315 -235
- package/dist/webcomponent-core.min.css +1 -1
- package/dist/webcomponent-core.min.js +153 -80
- package/dist/webcomponent.cjs.js +1 -1
- package/dist/webcomponent.esm.js +1 -1
- package/dist/webcomponent.js +672 -592
- package/dist/webcomponent.min.css +1 -1
- package/dist/webcomponent.min.js +3099 -1532
- package/package.json +1 -1
- package/dist/HistoryPlugin.native-DPvhks6h.mjs +0 -246
- package/dist/ListPlugin.native-Bt0LANbO.mjs +0 -139
- package/dist/MediaManagerPlugin.native-BT1NZIJS.mjs +0 -998
- package/dist/anchoredPopover-DJFD2oAP.mjs +0 -116
- package/dist/dialogHelpers-DBf7WqYH.mjs +0 -40
- package/dist/index-C1sO7DAC.js +0 -12
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { n as Z } from "./notify-DCQGpmq-.mjs";
|
|
2
|
+
import { f as $, g as ee } from "./editorContainerHelpers-C7kdWnS0.mjs";
|
|
3
|
+
let h = null, b = null, V = null, B = null, N = null, D = null, q = null;
|
|
3
4
|
const H = '[data-theme="dark"], .dark, .editora-theme-dark';
|
|
4
|
-
let
|
|
5
|
-
const
|
|
5
|
+
let E = !1, k = null, O = 0, P = 0, R = !1, K = 0, W = 0, _ = 0, X = 0;
|
|
6
|
+
const te = /* @__PURE__ */ new Set([
|
|
6
7
|
"DIV",
|
|
7
8
|
"P",
|
|
8
9
|
"BLOCKQUOTE",
|
|
@@ -17,51 +18,51 @@ const ee = /* @__PURE__ */ new Set([
|
|
|
17
18
|
"TD",
|
|
18
19
|
"TH"
|
|
19
20
|
]);
|
|
20
|
-
function
|
|
21
|
+
function F(e, t) {
|
|
21
22
|
let n = e;
|
|
22
23
|
for (; n && n !== t; ) {
|
|
23
|
-
if (n.nodeType === Node.ELEMENT_NODE &&
|
|
24
|
+
if (n.nodeType === Node.ELEMENT_NODE && te.has(n.tagName))
|
|
24
25
|
return n;
|
|
25
26
|
n = n.parentNode;
|
|
26
27
|
}
|
|
27
28
|
return null;
|
|
28
29
|
}
|
|
29
|
-
function
|
|
30
|
+
function Y(e) {
|
|
30
31
|
const t = e.parentElement;
|
|
31
32
|
if (t && t.classList.contains("rte-table-wrapper"))
|
|
32
33
|
return t;
|
|
33
34
|
const n = document.createElement("div");
|
|
34
35
|
return n.className = "rte-table-wrapper", t == null || t.insertBefore(n, e), n.appendChild(e), n;
|
|
35
36
|
}
|
|
36
|
-
const
|
|
37
|
-
const e =
|
|
37
|
+
const ne = () => {
|
|
38
|
+
const e = $(), t = ee(e);
|
|
38
39
|
if (!t)
|
|
39
|
-
return
|
|
40
|
+
return Z("Please place your cursor in the editor before inserting a table"), !1;
|
|
40
41
|
const n = window.getSelection();
|
|
41
42
|
if (!n || n.rangeCount === 0) return;
|
|
42
43
|
const o = n.getRangeAt(0), l = document.createElement("table");
|
|
43
44
|
l.className = "rte-table";
|
|
44
45
|
const r = document.createElement("thead"), i = document.createElement("tr");
|
|
45
46
|
for (let m = 0; m < 3; m++) {
|
|
46
|
-
const g = document.createElement("th"),
|
|
47
|
-
|
|
47
|
+
const g = document.createElement("th"), v = document.createElement("p");
|
|
48
|
+
v.appendChild(document.createElement("br")), g.appendChild(v), i.appendChild(g);
|
|
48
49
|
}
|
|
49
50
|
r.appendChild(i);
|
|
50
51
|
const a = document.createElement("tbody");
|
|
51
52
|
for (let m = 0; m < 2; m++) {
|
|
52
53
|
const g = document.createElement("tr");
|
|
53
|
-
for (let
|
|
54
|
-
const x = document.createElement("td"),
|
|
55
|
-
|
|
54
|
+
for (let v = 0; v < 3; v++) {
|
|
55
|
+
const x = document.createElement("td"), A = document.createElement("p");
|
|
56
|
+
A.appendChild(document.createElement("br")), x.appendChild(A), g.appendChild(x);
|
|
56
57
|
}
|
|
57
58
|
a.appendChild(g);
|
|
58
59
|
}
|
|
59
60
|
l.appendChild(r), l.appendChild(a);
|
|
60
|
-
const s =
|
|
61
|
+
const s = Y(l), d = (m, g, v) => {
|
|
61
62
|
if (m !== t) return m;
|
|
62
|
-
const x =
|
|
63
|
+
const x = v ? g - 1 : g;
|
|
63
64
|
return t.childNodes[Math.min(Math.max(x, 0), t.childNodes.length - 1)] || null;
|
|
64
|
-
}, c = d(o.endContainer, o.endOffset, !0), u = d(o.startContainer, o.startOffset, !1), C = c &&
|
|
65
|
+
}, c = d(o.endContainer, o.endOffset, !0), u = d(o.startContainer, o.startOffset, !1), C = c && F(c, t) || u && F(u, t);
|
|
65
66
|
C && C.parentNode ? C.parentNode.insertBefore(s, C.nextSibling) : (o.collapse(!1), o.insertNode(s));
|
|
66
67
|
const L = l.querySelector("th p");
|
|
67
68
|
if (L) {
|
|
@@ -69,7 +70,7 @@ const te = () => {
|
|
|
69
70
|
m.setStart(L, 0), m.collapse(!0), n.removeAllRanges(), n.addRange(m);
|
|
70
71
|
}
|
|
71
72
|
t.focus();
|
|
72
|
-
},
|
|
73
|
+
}, oe = () => {
|
|
73
74
|
var i;
|
|
74
75
|
const e = f();
|
|
75
76
|
if (!e) return;
|
|
@@ -80,7 +81,7 @@ const te = () => {
|
|
|
80
81
|
}
|
|
81
82
|
const r = t.rows[n];
|
|
82
83
|
r && r.parentElement ? r.parentElement.insertBefore(o, r) : t.appendChild(o), p();
|
|
83
|
-
},
|
|
84
|
+
}, re = () => {
|
|
84
85
|
var r, i;
|
|
85
86
|
const e = f();
|
|
86
87
|
if (!e) return;
|
|
@@ -97,7 +98,7 @@ const te = () => {
|
|
|
97
98
|
(i = a.parentElement) == null || i.insertBefore(o, a);
|
|
98
99
|
}
|
|
99
100
|
p();
|
|
100
|
-
},
|
|
101
|
+
}, le = () => {
|
|
101
102
|
const e = f();
|
|
102
103
|
if (!e) return;
|
|
103
104
|
const { table: t, colIndex: n } = e;
|
|
@@ -106,7 +107,7 @@ const te = () => {
|
|
|
106
107
|
i.innerHTML = "<br>", r.appendChild(i), n === 0 ? l.insertBefore(r, l.cells[0]) : l.insertBefore(r, l.cells[n]);
|
|
107
108
|
}
|
|
108
109
|
p();
|
|
109
|
-
},
|
|
110
|
+
}, ae = () => {
|
|
110
111
|
const e = f();
|
|
111
112
|
if (!e) return;
|
|
112
113
|
const { table: t, colIndex: n } = e;
|
|
@@ -115,12 +116,12 @@ const te = () => {
|
|
|
115
116
|
i.innerHTML = "<br>", r.appendChild(i), n >= l.cells.length - 1 ? l.appendChild(r) : l.insertBefore(r, l.cells[n + 1]);
|
|
116
117
|
}
|
|
117
118
|
p();
|
|
118
|
-
},
|
|
119
|
+
}, ie = () => {
|
|
119
120
|
const e = f();
|
|
120
121
|
if (!e || e.rowCount <= 1) return;
|
|
121
122
|
const { table: t, rowIndex: n, colIndex: o } = e;
|
|
122
123
|
t.deleteRow(n), G(t, n, o), p();
|
|
123
|
-
},
|
|
124
|
+
}, de = () => {
|
|
124
125
|
const e = f();
|
|
125
126
|
if (!e || e.cellCount <= 1) return;
|
|
126
127
|
const { table: t, rowIndex: n, colIndex: o } = e;
|
|
@@ -129,7 +130,7 @@ const te = () => {
|
|
|
129
130
|
r.cells[o] && r.deleteCell(o);
|
|
130
131
|
}
|
|
131
132
|
G(t, n, o), p();
|
|
132
|
-
},
|
|
133
|
+
}, se = () => {
|
|
133
134
|
var i, a;
|
|
134
135
|
const e = f();
|
|
135
136
|
if (!e) return;
|
|
@@ -142,15 +143,15 @@ const te = () => {
|
|
|
142
143
|
const d = t.querySelector("tbody") || t.appendChild(document.createElement("tbody"));
|
|
143
144
|
d.insertBefore(o, d.firstChild), s.rows.length === 0 && s.remove();
|
|
144
145
|
} else
|
|
145
|
-
|
|
146
|
+
U(o, "td");
|
|
146
147
|
} else if (!r || o === ((a = t.tBodies[0]) == null ? void 0 : a.rows[0])) {
|
|
147
148
|
let s = r;
|
|
148
149
|
s || (s = document.createElement("thead"), t.insertBefore(s, t.firstChild)), s.appendChild(o);
|
|
149
150
|
} else
|
|
150
|
-
|
|
151
|
+
U(o, "th");
|
|
151
152
|
p();
|
|
152
153
|
};
|
|
153
|
-
function
|
|
154
|
+
function U(e, t) {
|
|
154
155
|
Array.from(e.cells).forEach((n) => {
|
|
155
156
|
var l;
|
|
156
157
|
if (n.tagName.toLowerCase() === t) return;
|
|
@@ -163,7 +164,7 @@ function F(e, t) {
|
|
|
163
164
|
(l = n.parentNode) == null || l.replaceChild(o, n);
|
|
164
165
|
});
|
|
165
166
|
}
|
|
166
|
-
const
|
|
167
|
+
const ce = () => {
|
|
167
168
|
var o;
|
|
168
169
|
const e = f();
|
|
169
170
|
if (!e) return;
|
|
@@ -181,27 +182,27 @@ const se = () => {
|
|
|
181
182
|
}
|
|
182
183
|
}
|
|
183
184
|
p();
|
|
184
|
-
},
|
|
185
|
+
}, ue = () => {
|
|
185
186
|
const e = f();
|
|
186
187
|
if (!e) return;
|
|
187
188
|
const t = e.table, n = t.parentElement;
|
|
188
189
|
n && n.classList.contains("rte-table-wrapper") ? n.remove() : t.remove(), document.dispatchEvent(new CustomEvent("tableDeleted"));
|
|
189
190
|
};
|
|
190
|
-
function
|
|
191
|
+
function w(e, t) {
|
|
191
192
|
if (!e || !(e instanceof Node)) return null;
|
|
192
193
|
const n = e.nodeType === Node.ELEMENT_NODE ? e : e.parentElement;
|
|
193
194
|
return n ? n.closest(t) : null;
|
|
194
195
|
}
|
|
195
|
-
function
|
|
196
|
+
function M(e) {
|
|
196
197
|
if (!e) return !1;
|
|
197
198
|
const t = e.closest("[contenteditable]");
|
|
198
199
|
return !t || t.getAttribute("contenteditable") === "false" ? !1 : !t.closest('[data-readonly="true"]');
|
|
199
200
|
}
|
|
200
|
-
function
|
|
201
|
+
function he() {
|
|
201
202
|
const e = window.getSelection(), t = e && e.rangeCount > 0 ? e.getRangeAt(0).startContainer : null;
|
|
202
|
-
return
|
|
203
|
+
return w(t, ".rte-content") || (b ? b.closest(".rte-content") : null);
|
|
203
204
|
}
|
|
204
|
-
function
|
|
205
|
+
function be(e, t, n) {
|
|
205
206
|
const o = window.execEditorCommand || window.executeEditorCommand;
|
|
206
207
|
if (typeof o == "function")
|
|
207
208
|
try {
|
|
@@ -210,12 +211,12 @@ function he(e, t, n) {
|
|
|
210
211
|
}
|
|
211
212
|
}
|
|
212
213
|
function j(e) {
|
|
213
|
-
const t =
|
|
214
|
-
if (t && !
|
|
214
|
+
const t = he();
|
|
215
|
+
if (t && !M(t)) return;
|
|
215
216
|
const n = t ? t.innerHTML : "";
|
|
216
217
|
if (e(), !t) return;
|
|
217
218
|
const o = t.innerHTML;
|
|
218
|
-
o !== n && (
|
|
219
|
+
o !== n && (be(t, n, o), t.dispatchEvent(new Event("input", { bubbles: !0 })));
|
|
219
220
|
}
|
|
220
221
|
function G(e, t, n) {
|
|
221
222
|
if (!e.isConnected || e.rows.length === 0) return;
|
|
@@ -226,12 +227,12 @@ function G(e, t, n) {
|
|
|
226
227
|
const a = window.getSelection();
|
|
227
228
|
a == null || a.removeAllRanges(), a == null || a.addRange(r);
|
|
228
229
|
}
|
|
229
|
-
const
|
|
230
|
+
const me = () => {
|
|
230
231
|
const e = window.getSelection();
|
|
231
232
|
if (!e || e.rangeCount === 0) return;
|
|
232
233
|
const n = e.getRangeAt(0).startContainer;
|
|
233
|
-
if (!
|
|
234
|
-
const o =
|
|
234
|
+
if (!w(n, "table")) return;
|
|
235
|
+
const o = w(n, "td, th");
|
|
235
236
|
if (!o) return;
|
|
236
237
|
const l = o.parentElement;
|
|
237
238
|
if (!l) return;
|
|
@@ -257,10 +258,10 @@ function f() {
|
|
|
257
258
|
var a;
|
|
258
259
|
const e = window.getSelection();
|
|
259
260
|
if (!e || e.rangeCount === 0) return null;
|
|
260
|
-
const n = e.getRangeAt(0).startContainer, o =
|
|
261
|
+
const n = e.getRangeAt(0).startContainer, o = w(n, "table");
|
|
261
262
|
if (!o) return null;
|
|
262
263
|
let l = 0, r = 0;
|
|
263
|
-
const i =
|
|
264
|
+
const i = w(n, "td, th");
|
|
264
265
|
if (i) {
|
|
265
266
|
const s = i.parentElement;
|
|
266
267
|
for (; s && s !== o.rows[l] && (l++, !(l >= o.rows.length)); )
|
|
@@ -289,22 +290,44 @@ function p() {
|
|
|
289
290
|
const t = e.rowCount > 1, n = e.cellCount > 1;
|
|
290
291
|
J(t, n);
|
|
291
292
|
}
|
|
292
|
-
function
|
|
293
|
-
|
|
293
|
+
function fe(e) {
|
|
294
|
+
var o;
|
|
295
|
+
const t = window.getSelection();
|
|
296
|
+
if (!t) return;
|
|
297
|
+
const n = document.createRange();
|
|
298
|
+
((o = e.textContent) != null ? o : "").trim() === "" ? (n.selectNodeContents(e.querySelector("p, div") || e), n.collapse(!0)) : n.selectNodeContents(e), t.removeAllRanges(), t.addRange(n);
|
|
299
|
+
}
|
|
300
|
+
function pe(e) {
|
|
301
|
+
var s, d;
|
|
302
|
+
if (e.key !== "Tab" || e.defaultPrevented || e.ctrlKey || e.metaKey || e.altKey) return;
|
|
303
|
+
const t = window.getSelection();
|
|
304
|
+
if (!t || t.rangeCount === 0) return;
|
|
305
|
+
const n = w(t.getRangeAt(0).startContainer, "td, th"), o = n == null ? void 0 : n.closest("table");
|
|
306
|
+
if (!n || !o || !M(o)) return;
|
|
307
|
+
const l = o.closest("[contenteditable]");
|
|
308
|
+
if (!l || !(e.target instanceof Node) || !l.contains(e.target)) return;
|
|
309
|
+
const r = Array.from(o.querySelectorAll("th, td")).filter(
|
|
310
|
+
(c) => c.closest("table") === o
|
|
311
|
+
), i = r.indexOf(n);
|
|
312
|
+
let a;
|
|
313
|
+
e.shiftKey ? a = r[i - 1] : i < r.length - 1 ? a = r[i + 1] : (y("addRowBelow"), a = (d = (s = n.parentElement) == null ? void 0 : s.nextElementSibling) == null ? void 0 : d.querySelector("th, td")), a && (e.preventDefault(), fe(a));
|
|
314
|
+
}
|
|
315
|
+
function ge() {
|
|
316
|
+
V = () => {
|
|
294
317
|
const e = f();
|
|
295
|
-
e &&
|
|
296
|
-
},
|
|
297
|
-
const t =
|
|
298
|
-
!t && !n &&
|
|
299
|
-
}, B = () => {
|
|
300
|
-
R();
|
|
318
|
+
e && M(e.table) ? we(e.table) : T();
|
|
319
|
+
}, B = (e) => {
|
|
320
|
+
const t = w(e.target, "table"), n = w(e.target, ".table-toolbar");
|
|
321
|
+
!t && !n && T();
|
|
301
322
|
}, N = () => {
|
|
302
|
-
|
|
323
|
+
T();
|
|
303
324
|
}, D = () => {
|
|
304
|
-
b && h && h.style.display !== "none" &&
|
|
305
|
-
},
|
|
325
|
+
b && h && h.style.display !== "none" && S(b);
|
|
326
|
+
}, q = () => {
|
|
327
|
+
b && h && h.style.display !== "none" && S(b);
|
|
328
|
+
}, document.addEventListener("selectionchange", V), document.addEventListener("keydown", pe), document.addEventListener("mousedown", B), document.addEventListener("tableDeleted", N), window.addEventListener("scroll", D, !0), window.addEventListener("resize", q);
|
|
306
329
|
}
|
|
307
|
-
function
|
|
330
|
+
function S(e) {
|
|
308
331
|
if (!h) return;
|
|
309
332
|
const t = e.getBoundingClientRect(), n = h.getBoundingClientRect(), o = n.height || 40, l = n.width || 280, r = 10;
|
|
310
333
|
let i = t.top - o - r, a = t.left + t.width / 2 - l / 2;
|
|
@@ -314,14 +337,14 @@ function M(e) {
|
|
|
314
337
|
const d = window.innerHeight;
|
|
315
338
|
i + o > d - r && (i = d - o - r), h.style.top = i + "px", h.style.left = a + "px";
|
|
316
339
|
}
|
|
317
|
-
function
|
|
318
|
-
b = e, h || (h =
|
|
340
|
+
function we(e) {
|
|
341
|
+
b = e, h || (h = Ce(), document.body.appendChild(h));
|
|
319
342
|
const t = !!e.closest(H) || document.body.matches(H) || document.documentElement.matches(H);
|
|
320
343
|
h.classList.toggle("rte-theme-dark", t), h.style.display = "flex", h.style.visibility = "hidden", requestAnimationFrame(() => {
|
|
321
|
-
|
|
344
|
+
S(e), h && (h.style.visibility = "visible");
|
|
322
345
|
});
|
|
323
346
|
const n = f();
|
|
324
|
-
n && J(n.rowCount > 1, n.cellCount > 1),
|
|
347
|
+
n && J(n.rowCount > 1, n.cellCount > 1), ye(e);
|
|
325
348
|
}
|
|
326
349
|
const I = /* @__PURE__ */ new Set();
|
|
327
350
|
function Q() {
|
|
@@ -330,7 +353,7 @@ function Q() {
|
|
|
330
353
|
e.style.position === "relative" && (e.style.removeProperty("position"), (t = e.getAttribute("style")) != null && t.trim() || e.removeAttribute("style"));
|
|
331
354
|
}), I.clear();
|
|
332
355
|
}
|
|
333
|
-
function
|
|
356
|
+
function T() {
|
|
334
357
|
if (h && (h.style.display = "none"), b) {
|
|
335
358
|
b.querySelectorAll(".resize-handle").forEach((o) => o.remove());
|
|
336
359
|
const t = b.parentElement, n = t != null && t.classList.contains("rte-table-wrapper") ? t.querySelector(".table-resize-handle") : b.querySelector(".table-resize-handle");
|
|
@@ -343,14 +366,14 @@ function J(e, t) {
|
|
|
343
366
|
const n = h.querySelector('[data-action="deleteRow"]'), o = h.querySelector('[data-action="deleteColumn"]');
|
|
344
367
|
n && (n.disabled = !e), o && (o.disabled = !t);
|
|
345
368
|
}
|
|
346
|
-
let
|
|
347
|
-
function
|
|
348
|
-
if (
|
|
369
|
+
let z = !1;
|
|
370
|
+
function ve() {
|
|
371
|
+
if (z || typeof document == "undefined") return;
|
|
349
372
|
if (document.getElementById("rte-table-toolbar-styles")) {
|
|
350
|
-
|
|
373
|
+
z = !0;
|
|
351
374
|
return;
|
|
352
375
|
}
|
|
353
|
-
|
|
376
|
+
z = !0;
|
|
354
377
|
const e = document.createElement("style");
|
|
355
378
|
e.id = "rte-table-toolbar-styles", e.textContent = `
|
|
356
379
|
.table-toolbar {
|
|
@@ -507,8 +530,8 @@ function pe() {
|
|
|
507
530
|
}
|
|
508
531
|
`, document.head.appendChild(e);
|
|
509
532
|
}
|
|
510
|
-
function
|
|
511
|
-
|
|
533
|
+
function Ce() {
|
|
534
|
+
ve();
|
|
512
535
|
const e = document.createElement("div");
|
|
513
536
|
e.className = "table-toolbar", e.style.cssText = `
|
|
514
537
|
position: fixed;
|
|
@@ -517,7 +540,7 @@ function ge() {
|
|
|
517
540
|
`, e.setAttribute("role", "toolbar"), e.setAttribute("aria-label", "Table editing toolbar");
|
|
518
541
|
const t = (c) => {
|
|
519
542
|
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 = () =>
|
|
543
|
+
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 = () => y(c.action), u;
|
|
521
544
|
}, n = () => {
|
|
522
545
|
const c = document.createElement("div");
|
|
523
546
|
return c.className = "toolbar-divider", c;
|
|
@@ -526,58 +549,58 @@ function ge() {
|
|
|
526
549
|
return u.className = "toolbar-section", c.forEach((C) => u.appendChild(C)), u;
|
|
527
550
|
}, l = o(
|
|
528
551
|
t({
|
|
529
|
-
icon:
|
|
552
|
+
icon: xe(),
|
|
530
553
|
title: "Add row above (Ctrl+Shift+R)",
|
|
531
554
|
action: "addRowAbove"
|
|
532
555
|
}),
|
|
533
556
|
t({
|
|
534
|
-
icon:
|
|
557
|
+
icon: He(),
|
|
535
558
|
title: "Add row below",
|
|
536
559
|
action: "addRowBelow"
|
|
537
560
|
}),
|
|
538
561
|
t({
|
|
539
|
-
icon:
|
|
562
|
+
icon: Re(),
|
|
540
563
|
title: "Delete row",
|
|
541
564
|
action: "deleteRow",
|
|
542
565
|
danger: !0
|
|
543
566
|
})
|
|
544
567
|
), r = o(
|
|
545
568
|
t({
|
|
546
|
-
icon:
|
|
569
|
+
icon: Te(),
|
|
547
570
|
title: "Add column left",
|
|
548
571
|
action: "addColumnLeft"
|
|
549
572
|
}),
|
|
550
573
|
t({
|
|
551
|
-
icon:
|
|
574
|
+
icon: ze(),
|
|
552
575
|
title: "Add column right (Ctrl+Shift+C)",
|
|
553
576
|
action: "addColumnRight"
|
|
554
577
|
}),
|
|
555
578
|
t({
|
|
556
|
-
icon:
|
|
579
|
+
icon: Se(),
|
|
557
580
|
title: "Delete column",
|
|
558
581
|
action: "deleteColumn",
|
|
559
582
|
danger: !0
|
|
560
583
|
})
|
|
561
584
|
), i = o(
|
|
562
585
|
t({
|
|
563
|
-
icon:
|
|
586
|
+
icon: Ie(),
|
|
564
587
|
title: "Toggle header row",
|
|
565
588
|
action: "toggleHeaderRow"
|
|
566
589
|
}),
|
|
567
590
|
t({
|
|
568
|
-
icon:
|
|
591
|
+
icon: Me(),
|
|
569
592
|
title: "Toggle header column",
|
|
570
593
|
action: "toggleHeaderColumn"
|
|
571
594
|
})
|
|
572
595
|
), a = o(
|
|
573
596
|
t({
|
|
574
|
-
icon:
|
|
597
|
+
icon: Ae(),
|
|
575
598
|
title: "Merge cells (horizontally)",
|
|
576
599
|
action: "mergeCells"
|
|
577
600
|
})
|
|
578
601
|
), s = o(
|
|
579
602
|
t({
|
|
580
|
-
icon:
|
|
603
|
+
icon: Le(),
|
|
581
604
|
title: "Delete table",
|
|
582
605
|
action: "deleteTable",
|
|
583
606
|
delete: !0
|
|
@@ -585,48 +608,48 @@ function ge() {
|
|
|
585
608
|
);
|
|
586
609
|
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);
|
|
587
610
|
const d = (c) => {
|
|
588
|
-
!h || h.style.display === "none" || (c.ctrlKey || c.metaKey) && c.shiftKey && (c.key === "r" || c.key === "R" ? (c.preventDefault(),
|
|
611
|
+
!h || h.style.display === "none" || (c.ctrlKey || c.metaKey) && c.shiftKey && (c.key === "r" || c.key === "R" ? (c.preventDefault(), y("addRowBelow")) : (c.key === "c" || c.key === "C") && (c.preventDefault(), y("addColumnRight")));
|
|
589
612
|
};
|
|
590
613
|
return window.addEventListener("keydown", d), e;
|
|
591
614
|
}
|
|
592
|
-
function
|
|
615
|
+
function y(e) {
|
|
593
616
|
j(() => {
|
|
594
617
|
switch (e) {
|
|
595
618
|
case "addRowAbove":
|
|
596
|
-
|
|
619
|
+
oe();
|
|
597
620
|
break;
|
|
598
621
|
case "addRowBelow":
|
|
599
|
-
|
|
622
|
+
re();
|
|
600
623
|
break;
|
|
601
624
|
case "addColumnLeft":
|
|
602
|
-
|
|
625
|
+
le();
|
|
603
626
|
break;
|
|
604
627
|
case "addColumnRight":
|
|
605
|
-
|
|
628
|
+
ae();
|
|
606
629
|
break;
|
|
607
630
|
case "deleteRow":
|
|
608
|
-
|
|
631
|
+
ie();
|
|
609
632
|
break;
|
|
610
633
|
case "deleteColumn":
|
|
611
|
-
|
|
634
|
+
de();
|
|
612
635
|
break;
|
|
613
636
|
case "toggleHeaderRow":
|
|
614
|
-
|
|
637
|
+
se();
|
|
615
638
|
break;
|
|
616
639
|
case "toggleHeaderColumn":
|
|
617
|
-
|
|
640
|
+
ce();
|
|
618
641
|
break;
|
|
619
642
|
case "deleteTable":
|
|
620
|
-
|
|
643
|
+
ue();
|
|
621
644
|
break;
|
|
622
645
|
case "mergeCells":
|
|
623
|
-
|
|
646
|
+
me();
|
|
624
647
|
break;
|
|
625
648
|
}
|
|
626
649
|
});
|
|
627
650
|
}
|
|
628
|
-
function
|
|
629
|
-
const t =
|
|
651
|
+
function ye(e) {
|
|
652
|
+
const t = Y(e);
|
|
630
653
|
e.querySelectorAll(".resize-handle").forEach((a) => a.remove());
|
|
631
654
|
const o = t.querySelector(".table-resize-handle");
|
|
632
655
|
o && o.remove(), Q();
|
|
@@ -647,93 +670,93 @@ function we(e) {
|
|
|
647
670
|
z-index: 10;
|
|
648
671
|
transition: background 0.15s ease;
|
|
649
672
|
`, d.addEventListener("mouseenter", () => {
|
|
650
|
-
|
|
673
|
+
E || (d.style.background = "rgba(0, 102, 204, 0.3)");
|
|
651
674
|
}), d.addEventListener("mouseleave", () => {
|
|
652
|
-
|
|
675
|
+
E || (d.style.background = "transparent");
|
|
653
676
|
}), d.addEventListener("mousedown", (u) => {
|
|
654
|
-
u.preventDefault(), u.stopPropagation(),
|
|
677
|
+
u.preventDefault(), u.stopPropagation(), ke(u, s);
|
|
655
678
|
});
|
|
656
679
|
const c = a;
|
|
657
680
|
c.style.position || (c.style.position = "relative", I.add(c)), a.appendChild(d);
|
|
658
681
|
});
|
|
659
682
|
const i = document.createElement("div");
|
|
660
683
|
i.className = "table-resize-handle", i.addEventListener("mousedown", (a) => {
|
|
661
|
-
a.preventDefault(), a.stopPropagation(),
|
|
684
|
+
a.preventDefault(), a.stopPropagation(), Ee(a);
|
|
662
685
|
}), t.appendChild(i);
|
|
663
686
|
}
|
|
664
|
-
function
|
|
665
|
-
if (
|
|
687
|
+
function ke(e, t) {
|
|
688
|
+
if (E = !0, k = t, O = e.clientX, !b) return;
|
|
666
689
|
const n = b.querySelector("thead tr, tbody tr:first-child");
|
|
667
|
-
n && n.cells[t] && (
|
|
690
|
+
n && n.cells[t] && (P = n.cells[t].offsetWidth), document.body.style.cursor = "col-resize", document.body.style.userSelect = "none";
|
|
668
691
|
const o = (r) => {
|
|
669
|
-
if (!
|
|
670
|
-
const i = r.clientX -
|
|
692
|
+
if (!E || k === null || !b) return;
|
|
693
|
+
const i = r.clientX - O, a = Math.max(50, P + i);
|
|
671
694
|
b.querySelectorAll("tr").forEach((d) => {
|
|
672
|
-
d.cells[
|
|
695
|
+
d.cells[k] && (d.cells[k].style.width = a + "px");
|
|
673
696
|
});
|
|
674
697
|
}, l = () => {
|
|
675
|
-
|
|
698
|
+
E = !1, k = null, document.body.style.cursor = "", document.body.style.userSelect = "", document.removeEventListener("mousemove", o), document.removeEventListener("mouseup", l);
|
|
676
699
|
};
|
|
677
700
|
document.addEventListener("mousemove", o), document.addEventListener("mouseup", l);
|
|
678
701
|
}
|
|
679
|
-
function
|
|
702
|
+
function Ee(e) {
|
|
680
703
|
if (!b) return;
|
|
681
|
-
|
|
704
|
+
R = !0, K = e.clientX, W = e.clientY, _ = b.offsetWidth, X = b.offsetHeight, document.body.style.cursor = "nwse-resize", document.body.style.userSelect = "none";
|
|
682
705
|
const t = (o) => {
|
|
683
|
-
if (!
|
|
684
|
-
const l = o.clientX -
|
|
706
|
+
if (!R || !b) return;
|
|
707
|
+
const l = o.clientX - K, r = o.clientY - W, i = Math.max(200, _ + l), a = Math.max(100, X + r);
|
|
685
708
|
b.style.width = i + "px", b.style.height = a + "px";
|
|
686
709
|
}, n = () => {
|
|
687
|
-
|
|
710
|
+
R = !1, document.body.style.cursor = "", document.body.style.userSelect = "", document.removeEventListener("mousemove", t), document.removeEventListener("mouseup", n);
|
|
688
711
|
};
|
|
689
712
|
document.addEventListener("mousemove", t), document.addEventListener("mouseup", n);
|
|
690
713
|
}
|
|
691
|
-
function
|
|
714
|
+
function xe() {
|
|
692
715
|
return `<svg width="16" height="16" viewBox="0 0 16 16" fill="currentColor">
|
|
693
716
|
<path d="M2 7h12V5H2v2zm0 4h12V9H2v2zM8 1v3H5v2h3v3h2V6h3V4h-3V1H8z"/>
|
|
694
717
|
</svg>`;
|
|
695
718
|
}
|
|
696
|
-
function
|
|
719
|
+
function He() {
|
|
697
720
|
return `<svg width="16" height="16" viewBox="0 0 16 16" fill="currentColor">
|
|
698
721
|
<path d="M2 3h12V1H2v2zm0 4h12V5H2v2zm6 4v3h3v-2h2v-2h-2v-3h-2v3H5v2h3z"/>
|
|
699
722
|
</svg>`;
|
|
700
723
|
}
|
|
701
|
-
function
|
|
724
|
+
function Re() {
|
|
702
725
|
return `<svg width="16" height="16" viewBox="0 0 16 16" fill="currentColor">
|
|
703
726
|
<path d="M2 5h12v2H2V5zm0 4h12v2H2V9zm4-6v2H4v2h2v2h2V7h2V5H8V3H6z"/>
|
|
704
727
|
</svg>`;
|
|
705
728
|
}
|
|
706
|
-
function
|
|
729
|
+
function Te() {
|
|
707
730
|
return `<svg width="16" height="16" viewBox="0 0 16 16" fill="currentColor">
|
|
708
731
|
<path d="M7 2v12h2V2H7zm4 0v12h2V2h-2zM1 8h3v-3H1v3zm3 2H1v3h3v-3z"/>
|
|
709
732
|
</svg>`;
|
|
710
733
|
}
|
|
711
|
-
function
|
|
734
|
+
function ze() {
|
|
712
735
|
return `<svg width="16" height="16" viewBox="0 0 16 16" fill="currentColor">
|
|
713
736
|
<path d="M2 2v12h2V2H2zm4 0v12h2V2H6zM12 8h3v-3h-3v3zm0 2h3v3h-3v-3z"/>
|
|
714
737
|
</svg>`;
|
|
715
738
|
}
|
|
716
|
-
function
|
|
739
|
+
function Se() {
|
|
717
740
|
return `<svg width="16" height="16" viewBox="0 0 16 16" fill="currentColor">
|
|
718
741
|
<path d="M5 2v12h2V2H5zm4 0v12h2V2H9zm3 2h3V1h-3v3zm3 2h-3v3h3V6zm0 4h-3v3h3v-3z"/>
|
|
719
742
|
</svg>`;
|
|
720
743
|
}
|
|
721
|
-
function
|
|
744
|
+
function Ie() {
|
|
722
745
|
return `<svg width="16" height="16" viewBox="0 0 16 16" fill="currentColor">
|
|
723
746
|
<path d="M2 2h12v3H2V2zm0 5h12v8H2V7zm2 2v4h2V9H4zm4 0v4h2V9H8zm4 0v4h2V9h-2z"/>
|
|
724
747
|
</svg>`;
|
|
725
748
|
}
|
|
726
|
-
function
|
|
749
|
+
function Me() {
|
|
727
750
|
return `<svg width="16" height="16" viewBox="0 0 16 16" fill="currentColor">
|
|
728
751
|
<path d="M2 2v12h3V2H2zm5 0v12h8V2H7zm2 2h4v2H9V4zm0 4h4v2H9V8zm0 4h4v2H9v-2z"/>
|
|
729
752
|
</svg>`;
|
|
730
753
|
}
|
|
731
|
-
function
|
|
754
|
+
function Le() {
|
|
732
755
|
return `<svg width="16" height="16" viewBox="0 0 16 16" fill="currentColor">
|
|
733
756
|
<path d="M3 1h10v1H3V1zm1 2v11h8V3H4zM6 5h1v6H6V5zm3 0h1v6H9V5z"/>
|
|
734
757
|
</svg>`;
|
|
735
758
|
}
|
|
736
|
-
function
|
|
759
|
+
function Ae() {
|
|
737
760
|
return `<svg width="16" height="16" viewBox="0 0 16 16" fill="currentColor">
|
|
738
761
|
<path d="M2 2h4v3H2V2zm5 0h4v3H7V2zm5 0h2v3h-2V2zm-10 4h4v3H2V6zm5 0h4v3H7V6zm5 0h2v3h-2V6zm-10 4h4v3H2v-3zm5 0h4v3H7v-3zm5 0h2v3h-2v-3z"/>
|
|
739
762
|
</svg>`;
|
|
@@ -741,11 +764,11 @@ function Ie() {
|
|
|
741
764
|
if (typeof window != "undefined" && !window.__tablePluginInitialized) {
|
|
742
765
|
window.__tablePluginInitialized = !0;
|
|
743
766
|
const e = () => {
|
|
744
|
-
|
|
767
|
+
ge();
|
|
745
768
|
};
|
|
746
769
|
document.readyState === "loading" ? document.addEventListener("DOMContentLoaded", e) : setTimeout(e, 100);
|
|
747
770
|
}
|
|
748
|
-
const
|
|
771
|
+
const Ne = () => ({
|
|
749
772
|
name: "table",
|
|
750
773
|
toolbar: [
|
|
751
774
|
{
|
|
@@ -756,26 +779,26 @@ const Se = () => ({
|
|
|
756
779
|
],
|
|
757
780
|
commands: {
|
|
758
781
|
insertTable: () => (j(() => {
|
|
759
|
-
|
|
782
|
+
ne();
|
|
760
783
|
}), !0)
|
|
761
784
|
},
|
|
762
785
|
keymap: {
|
|
763
|
-
"Mod-Shift-r": () => (
|
|
764
|
-
"Mod-Shift-c": () => (
|
|
786
|
+
"Mod-Shift-r": () => (y("addRowBelow"), !0),
|
|
787
|
+
"Mod-Shift-c": () => (y("addColumnRight"), !0)
|
|
765
788
|
}
|
|
766
789
|
});
|
|
767
790
|
export {
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
791
|
+
Ne as TablePlugin,
|
|
792
|
+
le as addColumnLeftCommand,
|
|
793
|
+
ae as addColumnRightCommand,
|
|
794
|
+
oe as addRowAboveCommand,
|
|
795
|
+
re as addRowBelowCommand,
|
|
796
|
+
de as deleteColumnCommand,
|
|
797
|
+
ie as deleteRowCommand,
|
|
798
|
+
ue as deleteTableCommand,
|
|
799
|
+
ne as insertTableCommand,
|
|
800
|
+
me as mergeCellsCommand,
|
|
801
|
+
ce as toggleHeaderColumnCommand,
|
|
802
|
+
se as toggleHeaderRowCommand
|
|
780
803
|
};
|
|
781
|
-
//# sourceMappingURL=TablePlugin.native-
|
|
804
|
+
//# sourceMappingURL=TablePlugin.native-CWxEFpV8.mjs.map
|