@editora/core 1.0.15 → 1.0.17
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-BRdGYMju.mjs → A11yCheckerPlugin.native-DIKuCeFw.mjs} +82 -79
- package/dist/{AnchorPlugin.native-BcYGEtd9.mjs → AnchorPlugin.native-DXZdK3zr.mjs} +72 -71
- package/dist/{ApprovalWorkflowPlugin.native-BZ6jO-Wj.mjs → ApprovalWorkflowPlugin.native-ZsS_2xmn.mjs} +239 -238
- package/dist/{BackgroundColorPlugin.native-50iAT9xU.mjs → BackgroundColorPlugin.native-H3XyYD7_.mjs} +2 -2
- package/dist/{BlocksLibraryPlugin.native-5sdsXsiE.mjs → BlocksLibraryPlugin.native-CownM6Rk.mjs} +140 -116
- package/dist/{CapitalizationPlugin.native-DLV4oPmB.mjs → CapitalizationPlugin.native-C-HRbXGh.mjs} +10 -5
- package/dist/{ChecklistPlugin.native-BS-kMz9O.mjs → ChecklistPlugin.native-NVrBUkaL.mjs} +141 -103
- package/dist/{CitationsPlugin.native-DQgoCd1B.mjs → CitationsPlugin.native-C_7wWQ-k.mjs} +441 -422
- package/dist/{ClearFormattingPlugin.native-B6ro3a1h.mjs → ClearFormattingPlugin.native-Pp0O-SBf.mjs} +24 -23
- package/dist/{CodePlugin.native-knhM8NNo.mjs → CodePlugin.native-BH-K4xmW.mjs} +474 -342
- package/dist/CodePlugin.native-hNgfXlfS.mjs +4767 -0
- package/dist/CodeSamplePlugin.native-svbAFWh_.mjs +501 -0
- package/dist/CollaborationPlugin.native-oSybCGPW.mjs +7468 -0
- package/dist/{CommentsPlugin.native-DPSqTkiv.mjs → CommentsPlugin.native-CLip9wAO.mjs} +233 -185
- package/dist/{ConditionalContentPlugin.native-CfhY46rU.mjs → ConditionalContentPlugin.native-Bf7XgRSW.mjs} +401 -351
- package/dist/{DataBindingPlugin.native-BoXwghTz.mjs → DataBindingPlugin.native-B7lpI_0c.mjs} +29 -28
- package/dist/{DocumentManagerPlugin.native-D1YHQ2NN.mjs → DocumentManagerPlugin.native-iFip6s4Q.mjs} +94 -45
- package/dist/{EmbedIframePlugin.native-BF_-LjTq.mjs → EmbedIframePlugin.native-BfZ_HGlV.mjs} +231 -186
- package/dist/{EmojisPlugin.native-CitxxlWX.mjs → EmojisPlugin.native-D92aaOKi.mjs} +288 -76
- package/dist/{FontFamilyPlugin.native-j8hMTbg4.mjs → FontFamilyPlugin.native-M3cNQ0KA.mjs} +57 -50
- package/dist/{FontSizePlugin.native-B_jCh7dY.mjs → FontSizePlugin.native-DsLrH8eq.mjs} +41 -34
- package/dist/{FormatPainterPlugin.native-CsMrKfFU.mjs → FormatPainterPlugin.native-BhjzsiVq.mjs} +3 -2
- package/dist/{HistoryPlugin.native-D2wl32jV.mjs → HistoryPlugin.native-DPvhks6h.mjs} +36 -32
- package/dist/LinkPlugin.native-BsQXYsK6.mjs +352 -0
- package/dist/{ListPlugin.native-V7EZC1lM.mjs → ListPlugin.native-Bt0LANbO.mjs} +68 -35
- package/dist/{MathPlugin.native-NwWPHVmj.mjs → MathPlugin.native-Byo3WL0f.mjs} +211 -115
- package/dist/{MediaManagerPlugin.native-eOsTJFpw.mjs → MediaManagerPlugin.native-BT1NZIJS.mjs} +139 -134
- package/dist/{MentionPlugin.native-BMDlOqur.mjs → MentionPlugin.native-S_lwGZQO.mjs} +23 -18
- package/dist/{MergeTagPlugin.native-BzRVoD9-.mjs → MergeTagPlugin.native-7-6F3S1Y.mjs} +44 -43
- package/dist/{PreviewPlugin.native-WuIwOAOR.mjs → PreviewPlugin.native-CiR51jql.mjs} +31 -28
- package/dist/{SlashCommandsPlugin.native-BiN6ODw5.mjs → SlashCommandsPlugin.native-BDIIwGNs.mjs} +90 -79
- package/dist/{SmartPastePlugin.native-CZAEHkyt.mjs → SmartPastePlugin.native-BATLCds5.mjs} +89 -85
- package/dist/{SpecialCharactersPlugin.native-DaG4b19I.mjs → SpecialCharactersPlugin.native-CdZoc1GB.mjs} +73 -26
- package/dist/SpellCheckPlugin.native-Bef2oTLB.mjs +10935 -0
- package/dist/TablePlugin.native-BjIxYZ2X.mjs +772 -0
- package/dist/{TemplatePlugin.native-DLjFUaPW.mjs → TemplatePlugin.native-D6n5RUnC.mjs} +288 -262
- package/dist/{TextColorPlugin.native-Bwl_bSmc.mjs → TextColorPlugin.native-KMZ2uzlq.mjs} +2 -2
- package/dist/{TranslationWorkflowPlugin.native-DdF16tgT.mjs → TranslationWorkflowPlugin.native-CZtG--06.mjs} +67 -65
- package/dist/{VersionDiffPlugin.native-Bvxgy--t.mjs → VersionDiffPlugin.native-Ca1fMWUJ.mjs} +42 -42
- package/dist/anchoredPopover-DJFD2oAP.mjs +116 -0
- package/dist/core.css +1 -1
- package/dist/dialogHelpers-DBf7WqYH.mjs +40 -0
- package/dist/editora.min.js +26 -24
- package/dist/editora.umd.js +26 -24
- package/dist/escapeHtml-CX8RelZ1.mjs +7 -0
- package/dist/historyHelpers-B0-4mq1E.mjs +15 -0
- package/dist/index-XsYC_KdJ.mjs +3923 -0
- package/dist/index-_eKRBZPq.js +12 -0
- package/dist/index.cjs.js +3 -3
- package/dist/index.esm.js +17 -14
- package/dist/plugin-loader.js +53 -52
- package/dist/webcomponent-core.js +2055 -476
- package/dist/webcomponent-core.min.css +1 -1
- package/dist/webcomponent-core.min.js +96 -66
- package/dist/webcomponent.cjs.js +1 -1
- package/dist/webcomponent.esm.js +1 -1
- package/dist/webcomponent.js +2223 -643
- package/dist/webcomponent.min.css +1 -1
- package/dist/webcomponent.min.js +1564 -1198
- package/index.d.ts +32 -0
- package/package.json +10 -3
- package/dist/CodeSamplePlugin.native-CgGoH-X4.mjs +0 -384
- package/dist/LinkPlugin.native-DYCIcdTm.mjs +0 -283
- package/dist/SpellCheckPlugin.native-BZB9AewP.mjs +0 -1039
- package/dist/TablePlugin.native-DrHX-efe.mjs +0 -495
- package/dist/anchoredPopover-Bxds0VoB.mjs +0 -110
- package/dist/index-BLm1MtzH.js +0 -10
- package/dist/index-Cd9jEuZP.mjs +0 -2341
|
@@ -1,495 +0,0 @@
|
|
|
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);
|
|
7
|
-
if (!t)
|
|
8
|
-
return alert("Please place your cursor in the editor before inserting a table"), !1;
|
|
9
|
-
const n = window.getSelection();
|
|
10
|
-
if (!n || n.rangeCount === 0) return;
|
|
11
|
-
const l = n.getRangeAt(0), r = document.createElement("table");
|
|
12
|
-
r.className = "rte-table";
|
|
13
|
-
const o = document.createElement("thead"), a = document.createElement("tr");
|
|
14
|
-
for (let d = 0; d < 3; d++) {
|
|
15
|
-
const c = document.createElement("th"), u = document.createElement("p");
|
|
16
|
-
u.appendChild(document.createElement("br")), c.appendChild(u), a.appendChild(c);
|
|
17
|
-
}
|
|
18
|
-
o.appendChild(a);
|
|
19
|
-
const s = document.createElement("tbody");
|
|
20
|
-
for (let d = 0; d < 2; d++) {
|
|
21
|
-
const c = document.createElement("tr");
|
|
22
|
-
for (let u = 0; u < 3; u++) {
|
|
23
|
-
const b = document.createElement("td"), f = document.createElement("p");
|
|
24
|
-
f.appendChild(document.createElement("br")), b.appendChild(f), c.appendChild(b);
|
|
25
|
-
}
|
|
26
|
-
s.appendChild(c);
|
|
27
|
-
}
|
|
28
|
-
r.appendChild(o), r.appendChild(s), l.deleteContents(), l.insertNode(r);
|
|
29
|
-
const i = r.querySelector("th p");
|
|
30
|
-
if (i) {
|
|
31
|
-
const d = document.createRange();
|
|
32
|
-
d.setStart(i, 0), d.collapse(!0), n.removeAllRanges(), n.addRange(d);
|
|
33
|
-
}
|
|
34
|
-
t.focus();
|
|
35
|
-
}, P = () => {
|
|
36
|
-
var a;
|
|
37
|
-
const e = p();
|
|
38
|
-
if (!e) return;
|
|
39
|
-
const { table: t, rowIndex: n } = e, l = document.createElement("tr"), r = ((a = t.rows[0]) == null ? void 0 : a.cells.length) || 0;
|
|
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);
|
|
43
|
-
}
|
|
44
|
-
const o = t.rows[n];
|
|
45
|
-
o && o.parentElement ? o.parentElement.insertBefore(l, o) : t.appendChild(l), g();
|
|
46
|
-
}, z = () => {
|
|
47
|
-
var o;
|
|
48
|
-
const e = p();
|
|
49
|
-
if (!e) return;
|
|
50
|
-
const { table: t, rowIndex: n } = e, l = document.createElement("tr"), r = ((o = t.rows[0]) == null ? void 0 : o.cells.length) || 0;
|
|
51
|
-
for (let a = 0; a < r; a++) {
|
|
52
|
-
const s = document.createElement("td"), i = document.createElement("p");
|
|
53
|
-
i.innerHTML = "<br>", s.appendChild(i), l.appendChild(s);
|
|
54
|
-
}
|
|
55
|
-
n >= t.rows.length - 1 ? t.appendChild(l) : t.insertBefore(l, t.rows[n + 1]), g();
|
|
56
|
-
}, W = () => {
|
|
57
|
-
const e = p();
|
|
58
|
-
if (!e) return;
|
|
59
|
-
const { table: t, colIndex: n } = e;
|
|
60
|
-
for (let l = 0; l < t.rows.length; l++) {
|
|
61
|
-
const r = t.rows[l], o = document.createElement("td"), a = document.createElement("p");
|
|
62
|
-
a.innerHTML = "<br>", o.appendChild(a), n === 0 ? r.insertBefore(o, r.cells[0]) : r.insertBefore(o, r.cells[n]);
|
|
63
|
-
}
|
|
64
|
-
g();
|
|
65
|
-
}, T = () => {
|
|
66
|
-
const e = p();
|
|
67
|
-
if (!e) return;
|
|
68
|
-
const { table: t, colIndex: n } = e;
|
|
69
|
-
for (let l = 0; l < t.rows.length; l++) {
|
|
70
|
-
const r = t.rows[l], o = document.createElement("td"), a = document.createElement("p");
|
|
71
|
-
a.innerHTML = "<br>", o.appendChild(a), n >= r.cells.length - 1 ? r.appendChild(o) : r.insertBefore(o, r.cells[n + 1]);
|
|
72
|
-
}
|
|
73
|
-
g();
|
|
74
|
-
}, O = () => {
|
|
75
|
-
const e = p();
|
|
76
|
-
if (!e || e.rowCount <= 1) return;
|
|
77
|
-
const { table: t, rowIndex: n } = e;
|
|
78
|
-
t.deleteRow(n), g();
|
|
79
|
-
}, K = () => {
|
|
80
|
-
const e = p();
|
|
81
|
-
if (!e || e.cellCount <= 1) return;
|
|
82
|
-
const { table: t, colIndex: n } = e;
|
|
83
|
-
for (let l = 0; l < t.rows.length; l++) {
|
|
84
|
-
const r = t.rows[l];
|
|
85
|
-
r.cells[n] && r.deleteCell(n);
|
|
86
|
-
}
|
|
87
|
-
g();
|
|
88
|
-
}, Y = () => {
|
|
89
|
-
var o;
|
|
90
|
-
const e = p();
|
|
91
|
-
if (!e) return;
|
|
92
|
-
const { table: t, rowIndex: n } = e, l = t.rows[n];
|
|
93
|
-
if (((o = l.parentElement) == null ? void 0 : o.tagName.toLowerCase()) === "thead") {
|
|
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());
|
|
96
|
-
} else {
|
|
97
|
-
let a = t.querySelector("thead");
|
|
98
|
-
a || (a = document.createElement("thead"), t.insertBefore(a, t.firstChild)), a.appendChild(l);
|
|
99
|
-
}
|
|
100
|
-
g();
|
|
101
|
-
}, F = () => {
|
|
102
|
-
var l;
|
|
103
|
-
const e = p();
|
|
104
|
-
if (!e) return;
|
|
105
|
-
const { table: t, colIndex: n } = e;
|
|
106
|
-
for (let r = 0; r < t.rows.length; r++) {
|
|
107
|
-
const o = t.rows[r].cells[n];
|
|
108
|
-
if (o) {
|
|
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);
|
|
114
|
-
}
|
|
115
|
-
(l = o.parentNode) == null || l.replaceChild(s, o);
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
g();
|
|
119
|
-
}, U = () => {
|
|
120
|
-
const e = p();
|
|
121
|
-
if (!e) return;
|
|
122
|
-
e.table.remove(), document.dispatchEvent(new CustomEvent("tableDeleted"));
|
|
123
|
-
}, j = () => {
|
|
124
|
-
var u, b;
|
|
125
|
-
const e = window.getSelection();
|
|
126
|
-
if (!e || e.rangeCount === 0) return;
|
|
127
|
-
const n = e.getRangeAt(0).startContainer;
|
|
128
|
-
if (!(n.nodeType === Node.TEXT_NODE ? (u = n.parentElement) == null ? void 0 : u.closest("table") : n.closest("table"))) return;
|
|
129
|
-
let r = null;
|
|
130
|
-
if (n.nodeType === Node.TEXT_NODE ? r = (b = n.parentElement) == null ? void 0 : b.closest("td, th") : n.nodeType === Node.ELEMENT_NODE && (r = n.closest("td, th")), !r) return;
|
|
131
|
-
const o = r.parentElement;
|
|
132
|
-
if (!o) return;
|
|
133
|
-
let a = -1;
|
|
134
|
-
for (let f = 0; f < o.cells.length; f++)
|
|
135
|
-
if (o.cells[f] === r) {
|
|
136
|
-
a = f;
|
|
137
|
-
break;
|
|
138
|
-
}
|
|
139
|
-
if (a === -1 || a === o.cells.length - 1) return;
|
|
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) => {
|
|
144
|
-
r.appendChild(f);
|
|
145
|
-
}), s.remove(), g();
|
|
146
|
-
};
|
|
147
|
-
function p() {
|
|
148
|
-
var i, d, c;
|
|
149
|
-
const e = window.getSelection();
|
|
150
|
-
if (!e || e.rangeCount === 0) return null;
|
|
151
|
-
const n = e.getRangeAt(0).startContainer;
|
|
152
|
-
let l = n.nodeType === Node.TEXT_NODE ? (i = n.parentElement) == null ? void 0 : i.closest("table") : n.closest("table");
|
|
153
|
-
if (!l) return null;
|
|
154
|
-
const r = l;
|
|
155
|
-
let o = 0, a = 0;
|
|
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;
|
|
159
|
-
for (; u && u !== r.rows[o] && (o++, !(o >= r.rows.length)); )
|
|
160
|
-
;
|
|
161
|
-
const b = u;
|
|
162
|
-
if (b) {
|
|
163
|
-
for (let f = 0; f < b.cells.length; f++)
|
|
164
|
-
if (b.cells[f] === s) {
|
|
165
|
-
a = f;
|
|
166
|
-
break;
|
|
167
|
-
}
|
|
168
|
-
}
|
|
169
|
-
}
|
|
170
|
-
return {
|
|
171
|
-
table: r,
|
|
172
|
-
rowIndex: o,
|
|
173
|
-
colIndex: a,
|
|
174
|
-
rowCount: r.rows.length,
|
|
175
|
-
cellCount: ((c = r.rows[0]) == null ? void 0 : c.cells.length) || 0
|
|
176
|
-
};
|
|
177
|
-
}
|
|
178
|
-
function g() {
|
|
179
|
-
if (!h || !m) return;
|
|
180
|
-
const e = p();
|
|
181
|
-
if (!e) return;
|
|
182
|
-
const t = e.rowCount > 1, n = e.cellCount > 1;
|
|
183
|
-
N(t, n);
|
|
184
|
-
}
|
|
185
|
-
function G() {
|
|
186
|
-
R = () => {
|
|
187
|
-
const e = p();
|
|
188
|
-
e ? J(e.table) : y();
|
|
189
|
-
}, x = (e) => {
|
|
190
|
-
const t = e.target, n = t.closest("table"), l = t.closest(".table-toolbar");
|
|
191
|
-
!n && !l && y();
|
|
192
|
-
}, I = () => {
|
|
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);
|
|
199
|
-
}
|
|
200
|
-
function H(e) {
|
|
201
|
-
if (!h) return;
|
|
202
|
-
const t = e.getBoundingClientRect(), n = h.getBoundingClientRect(), l = n.height || 40, r = n.width || 280, o = 10;
|
|
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);
|
|
207
|
-
const d = window.innerHeight;
|
|
208
|
-
a + l > d - o && (a = d - l - o), h.style.top = a + "px", h.style.left = s + "px";
|
|
209
|
-
}
|
|
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");
|
|
215
|
-
});
|
|
216
|
-
const n = p();
|
|
217
|
-
n && N(n.rowCount > 1, n.cellCount > 1), $(e);
|
|
218
|
-
}
|
|
219
|
-
function y() {
|
|
220
|
-
if (h && (h.style.display = "none"), m) {
|
|
221
|
-
m.querySelectorAll(".resize-handle").forEach((n) => n.remove());
|
|
222
|
-
const t = m.querySelector(".table-resize-handle");
|
|
223
|
-
t && t.remove();
|
|
224
|
-
}
|
|
225
|
-
m = null;
|
|
226
|
-
}
|
|
227
|
-
function N(e, t) {
|
|
228
|
-
if (!h) return;
|
|
229
|
-
const n = h.querySelector('[data-action="deleteRow"]'), l = h.querySelector('[data-action="deleteColumn"]');
|
|
230
|
-
n && (n.disabled = !e), l && (l.disabled = !t);
|
|
231
|
-
}
|
|
232
|
-
function Q() {
|
|
233
|
-
const e = document.createElement("div");
|
|
234
|
-
e.className = "table-toolbar", e.style.cssText = `
|
|
235
|
-
position: fixed;
|
|
236
|
-
z-index: 1000;
|
|
237
|
-
display: none;
|
|
238
|
-
`, e.setAttribute("role", "toolbar"), e.setAttribute("aria-label", "Table editing toolbar");
|
|
239
|
-
const t = (c) => {
|
|
240
|
-
const u = document.createElement("button");
|
|
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;
|
|
242
|
-
}, n = () => {
|
|
243
|
-
const c = document.createElement("div");
|
|
244
|
-
return c.className = "toolbar-divider", c;
|
|
245
|
-
}, l = (...c) => {
|
|
246
|
-
const u = document.createElement("div");
|
|
247
|
-
return u.className = "toolbar-section", c.forEach((b) => u.appendChild(b)), u;
|
|
248
|
-
}, r = l(
|
|
249
|
-
t({
|
|
250
|
-
icon: ne(),
|
|
251
|
-
title: "Add row above (Ctrl+Shift+R)",
|
|
252
|
-
action: "addRowAbove"
|
|
253
|
-
}),
|
|
254
|
-
t({
|
|
255
|
-
icon: oe(),
|
|
256
|
-
title: "Add row below",
|
|
257
|
-
action: "addRowBelow"
|
|
258
|
-
}),
|
|
259
|
-
t({
|
|
260
|
-
icon: le(),
|
|
261
|
-
title: "Delete row",
|
|
262
|
-
action: "deleteRow",
|
|
263
|
-
danger: !0
|
|
264
|
-
})
|
|
265
|
-
), o = l(
|
|
266
|
-
t({
|
|
267
|
-
icon: re(),
|
|
268
|
-
title: "Add column left",
|
|
269
|
-
action: "addColumnLeft"
|
|
270
|
-
}),
|
|
271
|
-
t({
|
|
272
|
-
icon: ae(),
|
|
273
|
-
title: "Add column right (Ctrl+Shift+C)",
|
|
274
|
-
action: "addColumnRight"
|
|
275
|
-
}),
|
|
276
|
-
t({
|
|
277
|
-
icon: se(),
|
|
278
|
-
title: "Delete column",
|
|
279
|
-
action: "deleteColumn",
|
|
280
|
-
danger: !0
|
|
281
|
-
})
|
|
282
|
-
), a = l(
|
|
283
|
-
t({
|
|
284
|
-
icon: ie(),
|
|
285
|
-
title: "Toggle header row",
|
|
286
|
-
action: "toggleHeaderRow"
|
|
287
|
-
}),
|
|
288
|
-
t({
|
|
289
|
-
icon: de(),
|
|
290
|
-
title: "Toggle header column",
|
|
291
|
-
action: "toggleHeaderColumn"
|
|
292
|
-
})
|
|
293
|
-
), s = l(
|
|
294
|
-
t({
|
|
295
|
-
icon: ue(),
|
|
296
|
-
title: "Merge cells (horizontally)",
|
|
297
|
-
action: "mergeCells"
|
|
298
|
-
})
|
|
299
|
-
), i = l(
|
|
300
|
-
t({
|
|
301
|
-
icon: ce(),
|
|
302
|
-
title: "Delete table",
|
|
303
|
-
action: "deleteTable",
|
|
304
|
-
delete: !0
|
|
305
|
-
})
|
|
306
|
-
);
|
|
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);
|
|
308
|
-
const d = (c) => {
|
|
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()));
|
|
310
|
-
};
|
|
311
|
-
return window.addEventListener("keydown", d), e;
|
|
312
|
-
}
|
|
313
|
-
function Z(e) {
|
|
314
|
-
switch (e) {
|
|
315
|
-
case "addRowAbove":
|
|
316
|
-
P();
|
|
317
|
-
break;
|
|
318
|
-
case "addRowBelow":
|
|
319
|
-
z();
|
|
320
|
-
break;
|
|
321
|
-
case "addColumnLeft":
|
|
322
|
-
W();
|
|
323
|
-
break;
|
|
324
|
-
case "addColumnRight":
|
|
325
|
-
T();
|
|
326
|
-
break;
|
|
327
|
-
case "deleteRow":
|
|
328
|
-
O();
|
|
329
|
-
break;
|
|
330
|
-
case "deleteColumn":
|
|
331
|
-
K();
|
|
332
|
-
break;
|
|
333
|
-
case "toggleHeaderRow":
|
|
334
|
-
Y();
|
|
335
|
-
break;
|
|
336
|
-
case "toggleHeaderColumn":
|
|
337
|
-
F();
|
|
338
|
-
break;
|
|
339
|
-
case "deleteTable":
|
|
340
|
-
U();
|
|
341
|
-
break;
|
|
342
|
-
case "mergeCells":
|
|
343
|
-
j();
|
|
344
|
-
break;
|
|
345
|
-
}
|
|
346
|
-
}
|
|
347
|
-
function $(e) {
|
|
348
|
-
e.querySelectorAll(".resize-handle").forEach((a) => a.remove());
|
|
349
|
-
const n = e.querySelector(".table-resize-handle");
|
|
350
|
-
n && n.remove();
|
|
351
|
-
const l = e.querySelector("thead tr, tbody tr:first-child");
|
|
352
|
-
if (!l) return;
|
|
353
|
-
const r = l.querySelectorAll("td, th");
|
|
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 = `
|
|
358
|
-
position: absolute;
|
|
359
|
-
right: -4px;
|
|
360
|
-
top: 0;
|
|
361
|
-
bottom: 0;
|
|
362
|
-
width: 8px;
|
|
363
|
-
background: transparent;
|
|
364
|
-
cursor: col-resize;
|
|
365
|
-
z-index: 10;
|
|
366
|
-
transition: background 0.15s ease;
|
|
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);
|
|
374
|
-
});
|
|
375
|
-
const o = document.createElement("div");
|
|
376
|
-
o.className = "table-resize-handle", o.addEventListener("mousedown", (a) => {
|
|
377
|
-
a.preventDefault(), a.stopPropagation(), te(a);
|
|
378
|
-
}), e.appendChild(o);
|
|
379
|
-
}
|
|
380
|
-
function ee(e, t) {
|
|
381
|
-
if (w = !0, v = t, V = e.clientX, !m) return;
|
|
382
|
-
const n = m.querySelector("thead tr, tbody tr:first-child");
|
|
383
|
-
n && n.cells[t] && (L = n.cells[t].offsetWidth), document.body.style.cursor = "col-resize", document.body.style.userSelect = "none";
|
|
384
|
-
const l = (o) => {
|
|
385
|
-
if (!w || v === null || !m) return;
|
|
386
|
-
const a = o.clientX - V, s = Math.max(50, L + a);
|
|
387
|
-
m.querySelectorAll("tr").forEach((d) => {
|
|
388
|
-
d.cells[v] && (d.cells[v].style.width = s + "px");
|
|
389
|
-
});
|
|
390
|
-
}, r = () => {
|
|
391
|
-
w = !1, v = null, document.body.style.cursor = "", document.body.style.userSelect = "", document.removeEventListener("mousemove", l), document.removeEventListener("mouseup", r);
|
|
392
|
-
};
|
|
393
|
-
document.addEventListener("mousemove", l), document.addEventListener("mouseup", r);
|
|
394
|
-
}
|
|
395
|
-
function te(e) {
|
|
396
|
-
if (!m) return;
|
|
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";
|
|
398
|
-
const t = (l) => {
|
|
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";
|
|
402
|
-
}, n = () => {
|
|
403
|
-
E = !1, document.body.style.cursor = "", document.body.style.userSelect = "", document.removeEventListener("mousemove", t), document.removeEventListener("mouseup", n);
|
|
404
|
-
};
|
|
405
|
-
document.addEventListener("mousemove", t), document.addEventListener("mouseup", n);
|
|
406
|
-
}
|
|
407
|
-
function ne() {
|
|
408
|
-
return `<svg width="16" height="16" viewBox="0 0 16 16" fill="currentColor">
|
|
409
|
-
<path d="M2 7h12V5H2v2zm0 4h12V9H2v2zM8 1v3H5v2h3v3h2V6h3V4h-3V1H8z"/>
|
|
410
|
-
</svg>`;
|
|
411
|
-
}
|
|
412
|
-
function oe() {
|
|
413
|
-
return `<svg width="16" height="16" viewBox="0 0 16 16" fill="currentColor">
|
|
414
|
-
<path d="M2 3h12V1H2v2zm0 4h12V5H2v2zm6 4v3h3v-2h2v-2h-2v-3h-2v3H5v2h3z"/>
|
|
415
|
-
</svg>`;
|
|
416
|
-
}
|
|
417
|
-
function le() {
|
|
418
|
-
return `<svg width="16" height="16" viewBox="0 0 16 16" fill="currentColor">
|
|
419
|
-
<path d="M2 5h12v2H2V5zm0 4h12v2H2V9zm4-6v2H4v2h2v2h2V7h2V5H8V3H6z"/>
|
|
420
|
-
</svg>`;
|
|
421
|
-
}
|
|
422
|
-
function re() {
|
|
423
|
-
return `<svg width="16" height="16" viewBox="0 0 16 16" fill="currentColor">
|
|
424
|
-
<path d="M7 2v12h2V2H7zm4 0v12h2V2h-2zM1 8h3v-3H1v3zm3 2H1v3h3v-3z"/>
|
|
425
|
-
</svg>`;
|
|
426
|
-
}
|
|
427
|
-
function ae() {
|
|
428
|
-
return `<svg width="16" height="16" viewBox="0 0 16 16" fill="currentColor">
|
|
429
|
-
<path d="M2 2v12h2V2H2zm4 0v12h2V2H6zM12 8h3v-3h-3v3zm0 2h3v3h-3v-3z"/>
|
|
430
|
-
</svg>`;
|
|
431
|
-
}
|
|
432
|
-
function se() {
|
|
433
|
-
return `<svg width="16" height="16" viewBox="0 0 16 16" fill="currentColor">
|
|
434
|
-
<path d="M5 2v12h2V2H5zm4 0v12h2V2H9zm3 2h3V1h-3v3zm3 2h-3v3h3V6zm0 4h-3v3h3v-3z"/>
|
|
435
|
-
</svg>`;
|
|
436
|
-
}
|
|
437
|
-
function ie() {
|
|
438
|
-
return `<svg width="16" height="16" viewBox="0 0 16 16" fill="currentColor">
|
|
439
|
-
<path d="M2 2h12v3H2V2zm0 5h12v8H2V7zm2 2v4h2V9H4zm4 0v4h2V9H8zm4 0v4h2V9h-2z"/>
|
|
440
|
-
</svg>`;
|
|
441
|
-
}
|
|
442
|
-
function de() {
|
|
443
|
-
return `<svg width="16" height="16" viewBox="0 0 16 16" fill="currentColor">
|
|
444
|
-
<path d="M2 2v12h3V2H2zm5 0v12h8V2H7zm2 2h4v2H9V4zm0 4h4v2H9V8zm0 4h4v2H9v-2z"/>
|
|
445
|
-
</svg>`;
|
|
446
|
-
}
|
|
447
|
-
function ce() {
|
|
448
|
-
return `<svg width="16" height="16" viewBox="0 0 16 16" fill="currentColor">
|
|
449
|
-
<path d="M3 1h10v1H3V1zm1 2v11h8V3H4zM6 5h1v6H6V5zm3 0h1v6H9V5z"/>
|
|
450
|
-
</svg>`;
|
|
451
|
-
}
|
|
452
|
-
function ue() {
|
|
453
|
-
return `<svg width="16" height="16" viewBox="0 0 16 16" fill="currentColor">
|
|
454
|
-
<path d="M2 2h4v3H2V2zm5 0h4v3H7V2zm5 0h2v3h-2V2zm-10 4h4v3H2V6zm5 0h4v3H7V6zm5 0h2v3h-2V6zm-10 4h4v3H2v-3zm5 0h4v3H7v-3zm5 0h2v3h-2v-3z"/>
|
|
455
|
-
</svg>`;
|
|
456
|
-
}
|
|
457
|
-
if (typeof window != "undefined" && !window.__tablePluginInitialized) {
|
|
458
|
-
window.__tablePluginInitialized = !0;
|
|
459
|
-
const e = () => {
|
|
460
|
-
G();
|
|
461
|
-
};
|
|
462
|
-
document.readyState === "loading" ? document.addEventListener("DOMContentLoaded", e) : setTimeout(e, 100);
|
|
463
|
-
}
|
|
464
|
-
const me = () => ({
|
|
465
|
-
name: "table",
|
|
466
|
-
toolbar: [
|
|
467
|
-
{
|
|
468
|
-
label: "Insert Table",
|
|
469
|
-
command: "insertTable",
|
|
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>'
|
|
471
|
-
}
|
|
472
|
-
],
|
|
473
|
-
commands: {
|
|
474
|
-
insertTable: () => (_(), !0)
|
|
475
|
-
},
|
|
476
|
-
keymap: {
|
|
477
|
-
"Mod-Shift-r": () => (z(), !0),
|
|
478
|
-
"Mod-Shift-c": () => (T(), !0)
|
|
479
|
-
}
|
|
480
|
-
});
|
|
481
|
-
export {
|
|
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
|
|
494
|
-
};
|
|
495
|
-
//# sourceMappingURL=TablePlugin.native-DrHX-efe.mjs.map
|
|
@@ -1,110 +0,0 @@
|
|
|
1
|
-
const b = "p,div,li,ul,ol,table,thead,tbody,tfoot,tr,td,th,h1,h2,h3,h4,h5,h6,blockquote,pre";
|
|
2
|
-
function p(e) {
|
|
3
|
-
return !!e.cloneContents().querySelector(b);
|
|
4
|
-
}
|
|
5
|
-
function v(e, n) {
|
|
6
|
-
var r, o;
|
|
7
|
-
const t = (e == null ? void 0 : e.nodeType) === Node.ELEMENT_NODE ? e : (r = e == null ? void 0 : e.parentElement) != null ? r : null;
|
|
8
|
-
return (t == null ? void 0 : t.closest('[contenteditable="true"]')) || ((o = n()) == null ? void 0 : o.querySelector('[contenteditable="true"]')) || document.querySelector('[contenteditable="true"]');
|
|
9
|
-
}
|
|
10
|
-
function C(e, n) {
|
|
11
|
-
const t = v(e, n);
|
|
12
|
-
t && t.dispatchEvent(new Event("input", { bubbles: !0 }));
|
|
13
|
-
}
|
|
14
|
-
function A(e, n) {
|
|
15
|
-
let r = e.startContainer.nodeType === Node.TEXT_NODE ? e.startContainer.parentElement : e.startContainer;
|
|
16
|
-
for (; r && r !== document.body; ) {
|
|
17
|
-
if (r.classList.contains(n)) {
|
|
18
|
-
const o = document.createRange();
|
|
19
|
-
if (o.selectNodeContents(r), o.compareBoundaryPoints(Range.START_TO_START, e) <= 0 && o.compareBoundaryPoints(Range.END_TO_END, e) >= 0)
|
|
20
|
-
return r;
|
|
21
|
-
}
|
|
22
|
-
r = r.parentElement;
|
|
23
|
-
}
|
|
24
|
-
return null;
|
|
25
|
-
}
|
|
26
|
-
function N(e) {
|
|
27
|
-
try {
|
|
28
|
-
if (e.savedRange) {
|
|
29
|
-
const c = window.getSelection();
|
|
30
|
-
c && (c.removeAllRanges(), c.addRange(e.savedRange.cloneRange()));
|
|
31
|
-
}
|
|
32
|
-
const n = window.getSelection();
|
|
33
|
-
if (!n || n.rangeCount === 0 || n.isCollapsed)
|
|
34
|
-
return !1;
|
|
35
|
-
const t = n.getRangeAt(0);
|
|
36
|
-
if (t.collapsed)
|
|
37
|
-
return !1;
|
|
38
|
-
const r = A(t, e.className);
|
|
39
|
-
if (r)
|
|
40
|
-
return e.styleProperty === "backgroundColor" ? r.style.backgroundColor = e.color : r.style.color = e.color, C(r, e.getActiveEditorRoot), !0;
|
|
41
|
-
const o = v(
|
|
42
|
-
t.commonAncestorContainer,
|
|
43
|
-
e.getActiveEditorRoot
|
|
44
|
-
);
|
|
45
|
-
o == null || o.focus({ preventScroll: !0 });
|
|
46
|
-
try {
|
|
47
|
-
document.execCommand("styleWithCSS", !1, "true");
|
|
48
|
-
} catch (c) {
|
|
49
|
-
}
|
|
50
|
-
let l = !1;
|
|
51
|
-
if (e.commands.forEach((c) => {
|
|
52
|
-
l || (l = document.execCommand(c, !1, e.color));
|
|
53
|
-
}), !l && !p(t)) {
|
|
54
|
-
const c = document.createElement("span");
|
|
55
|
-
e.styleProperty === "backgroundColor" ? c.style.backgroundColor = e.color : c.style.color = e.color, c.className = e.className;
|
|
56
|
-
const a = t.extractContents();
|
|
57
|
-
c.appendChild(a), t.insertNode(c), t.setStartAfter(c), t.collapse(!0), n.removeAllRanges(), n.addRange(t), l = !0;
|
|
58
|
-
}
|
|
59
|
-
return l ? (C(t.commonAncestorContainer, e.getActiveEditorRoot), !0) : (e.warnMessage && console.warn(e.warnMessage), !1);
|
|
60
|
-
} catch (n) {
|
|
61
|
-
return e.warnMessage ? console.error(e.warnMessage, n) : console.error("[ColorApply] Failed to apply color", n), !1;
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
function T({
|
|
65
|
-
popover: e,
|
|
66
|
-
anchor: n,
|
|
67
|
-
onClose: t,
|
|
68
|
-
gap: r = 6,
|
|
69
|
-
margin: o = 8,
|
|
70
|
-
zIndex: l = 1e4
|
|
71
|
-
}) {
|
|
72
|
-
e.style.position = "fixed", e.style.zIndex = `${l}`, e.style.visibility = "hidden";
|
|
73
|
-
const c = () => {
|
|
74
|
-
if (!e.isConnected || !n.isConnected) {
|
|
75
|
-
t();
|
|
76
|
-
return;
|
|
77
|
-
}
|
|
78
|
-
const s = n.getBoundingClientRect();
|
|
79
|
-
if (s.width === 0 && s.height === 0) {
|
|
80
|
-
t();
|
|
81
|
-
return;
|
|
82
|
-
}
|
|
83
|
-
const i = e.getBoundingClientRect(), w = i.width || e.offsetWidth || 220, f = i.height || e.offsetHeight || 260, y = window.innerWidth, E = window.innerHeight;
|
|
84
|
-
let u = s.left, d = s.bottom + r;
|
|
85
|
-
if (u + w > y - o && (u = y - w - o), u = Math.max(o, u), d + f > E - o) {
|
|
86
|
-
const g = s.top - f - r;
|
|
87
|
-
g >= o ? d = g : d = Math.max(o, E - f - o);
|
|
88
|
-
}
|
|
89
|
-
d < o && (d = o), e.style.left = `${Math.round(u)}px`, e.style.top = `${Math.round(d)}px`, e.style.visibility = "visible";
|
|
90
|
-
}, a = () => {
|
|
91
|
-
c();
|
|
92
|
-
}, h = (s) => {
|
|
93
|
-
const i = s.target;
|
|
94
|
-
i && (e.contains(i) || n.contains(i) || t());
|
|
95
|
-
}, m = (s) => {
|
|
96
|
-
s.key === "Escape" && t();
|
|
97
|
-
};
|
|
98
|
-
window.addEventListener("resize", a), window.addEventListener("scroll", a, !0), document.addEventListener("keydown", m);
|
|
99
|
-
const R = window.requestAnimationFrame(() => {
|
|
100
|
-
document.addEventListener("mousedown", h, !0);
|
|
101
|
-
});
|
|
102
|
-
return c(), { reposition: c, destroy: () => {
|
|
103
|
-
window.cancelAnimationFrame(R), window.removeEventListener("resize", a), window.removeEventListener("scroll", a, !0), document.removeEventListener("keydown", m), document.removeEventListener("mousedown", h, !0);
|
|
104
|
-
} };
|
|
105
|
-
}
|
|
106
|
-
export {
|
|
107
|
-
N as a,
|
|
108
|
-
T as b
|
|
109
|
-
};
|
|
110
|
-
//# sourceMappingURL=anchoredPopover-Bxds0VoB.mjs.map
|