@jackuait/blok 0.10.0-beta.16 → 0.10.0-beta.18
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/blok.mjs +2 -2
- package/dist/chunks/{blok-CEVrVqlx.mjs → blok-DK7jJnLH.mjs} +1393 -1381
- package/dist/chunks/{constants-BURnHRy_.mjs → constants-B0Vnu9kC.mjs} +48 -48
- package/dist/chunks/{tools-Dt2I14vP.mjs → tools-QLa-0Rbm.mjs} +816 -786
- package/dist/full.mjs +3 -3
- package/dist/react.mjs +2 -2
- package/dist/tools.mjs +2 -2
- package/package.json +1 -1
- package/src/cli/commands/convert-gdocs/index.ts +3 -1
- package/src/cli/commands/convert-html/index.ts +3 -1
- package/src/components/icons/index.ts +16 -0
- package/src/components/modules/blockEvents/composers/keyboardNavigation.ts +18 -0
- package/src/components/modules/rectangleSelection.ts +25 -5
- package/src/components/modules/toolbar/index.ts +48 -7
- package/src/styles/main.css +16 -0
- package/src/tools/callout/constants.ts +2 -1
- package/src/tools/callout/dom-builder.ts +11 -1
- package/src/tools/callout/index.ts +6 -0
- package/src/tools/code/constants.ts +9 -1
- package/src/tools/code/dom-builder.ts +90 -54
- package/src/tools/code/index.ts +33 -19
- package/src/tools/table/table-cell-blocks.ts +3 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { $ as e, $
|
|
2
|
-
import { t as
|
|
3
|
-
import { n as
|
|
1
|
+
import { $ as e, $t as t, At as n, B as r, Bt as i, Ct as a, D as o, Dt as s, Et as c, F as l, Ft as u, G as d, Gt as f, H as p, Ht as m, I as h, It as g, J as ee, K as _, Kt as v, L as y, Lt as b, M as te, N as ne, Nt as re, O as ie, Ot as x, P as ae, Pt as oe, Q as S, R as C, Rt as se, St as ce, Tn as le, Tt as ue, U as de, Ut as fe, V as pe, Vt as me, W as he, Wt as ge, X as _e, Y as ve, Yn as ye, Yt as be, Z as xe, _t as Se, a as Ce, an as w, at as we, c as Te, ct as Ee, d as De, dt as Oe, en as T, et as ke, f as Ae, ft as je, g as Me, gt as Ne, h as Pe, ht as Fe, i as Ie, it as Le, j as Re, jt as ze, k as Be, kt as Ve, l as He, ln as Ue, lt as We, n as Ge, nn as Ke, nr as E, nt as qe, o as Je, on as Ye, ot as Xe, p as Ze, pt as Qe, q as $e, r as et, rt as tt, s as nt, st as rt, t as it, tn as at, tr as D, tt as ot, u as O, un as st, ut as ct, v as lt, vt as ut, wt as dt, xt as ft, yt as pt, z as mt, zt as ht } from "./constants-B0Vnu9kC.mjs";
|
|
2
|
+
import { t as k } from "./objectSpread2-CWwMYL_U.mjs";
|
|
3
|
+
import { n as A } from "./tw-CqxBf-1Y.mjs";
|
|
4
4
|
//#region src/components/utils/html.ts
|
|
5
5
|
var gt = (e) => {
|
|
6
6
|
if (!e || !e.includes("data-blok-fake-background")) return e;
|
|
@@ -12,7 +12,7 @@ var gt = (e) => {
|
|
|
12
12
|
t.removeChild(e);
|
|
13
13
|
}
|
|
14
14
|
}), t.innerHTML;
|
|
15
|
-
},
|
|
15
|
+
}, _t = [
|
|
16
16
|
"empty:before:pointer-events-none",
|
|
17
17
|
"empty:before:text-gray-text",
|
|
18
18
|
"empty:before:cursor-text",
|
|
@@ -21,7 +21,7 @@ var gt = (e) => {
|
|
|
21
21
|
"data-[blok-empty=true]:before:text-gray-text",
|
|
22
22
|
"data-[blok-empty=true]:before:cursor-text",
|
|
23
23
|
"data-[blok-empty=true]:before:content-[attr(data-placeholder)]"
|
|
24
|
-
],
|
|
24
|
+
], vt = [
|
|
25
25
|
"empty:before:pointer-events-none",
|
|
26
26
|
"empty:before:text-gray-text",
|
|
27
27
|
"empty:before:cursor-text",
|
|
@@ -30,7 +30,7 @@ var gt = (e) => {
|
|
|
30
30
|
"data-[empty=true]:before:text-gray-text",
|
|
31
31
|
"data-[empty=true]:before:cursor-text",
|
|
32
32
|
"data-[empty=true]:before:content-[attr(data-blok-placeholder-active)]"
|
|
33
|
-
],
|
|
33
|
+
], yt = [
|
|
34
34
|
"empty:focus:before:pointer-events-none",
|
|
35
35
|
"empty:focus:before:text-gray-text",
|
|
36
36
|
"empty:focus:before:cursor-text",
|
|
@@ -39,7 +39,7 @@ var gt = (e) => {
|
|
|
39
39
|
"[&[data-empty=true]:focus]:before:text-gray-text",
|
|
40
40
|
"[&[data-empty=true]:focus]:before:cursor-text",
|
|
41
41
|
"[&[data-empty=true]:focus]:before:content-[attr(data-blok-placeholder-active)]"
|
|
42
|
-
],
|
|
42
|
+
], bt = [
|
|
43
43
|
"empty:in-data-[blok-empty=true]:before:pointer-events-none",
|
|
44
44
|
"empty:in-data-[blok-empty=true]:before:text-gray-text",
|
|
45
45
|
"empty:in-data-[blok-empty=true]:before:cursor-text",
|
|
@@ -48,29 +48,29 @@ var gt = (e) => {
|
|
|
48
48
|
"[[data-blok-empty=true]_&[data-empty=true]]:before:text-gray-text",
|
|
49
49
|
"[[data-blok-empty=true]_&[data-empty=true]]:before:cursor-text",
|
|
50
50
|
"[[data-blok-empty=true]_&[data-empty=true]]:before:content-[attr(data-blok-placeholder-active)]"
|
|
51
|
-
],
|
|
51
|
+
], xt = (e) => {
|
|
52
52
|
let t = e.innerHTML.trim();
|
|
53
53
|
return t === "" || t === "<br>";
|
|
54
|
-
},
|
|
54
|
+
}, St = (e) => {
|
|
55
55
|
e.innerHTML === "<br>" && (e.innerHTML = "");
|
|
56
56
|
let t = window.getSelection();
|
|
57
57
|
if (!t) return;
|
|
58
58
|
let n = document.createRange();
|
|
59
59
|
n.selectNodeContents(e), n.collapse(!0), t.removeAllRanges(), t.addRange(n);
|
|
60
|
-
},
|
|
61
|
-
|
|
62
|
-
},
|
|
60
|
+
}, Ct = (e) => {
|
|
61
|
+
xt(e) && St(e);
|
|
62
|
+
}, j = (e, t, n = "data-placeholder") => {
|
|
63
63
|
e.setAttribute(n, t == null ? "" : t);
|
|
64
|
-
let r = () =>
|
|
64
|
+
let r = () => Ct(e);
|
|
65
65
|
return e.addEventListener("focus", r), () => {
|
|
66
66
|
e.removeEventListener("focus", r), e.removeAttribute(n);
|
|
67
67
|
};
|
|
68
|
-
},
|
|
68
|
+
}, wt, Tt = (e) => {
|
|
69
69
|
let t = document.createElement("div");
|
|
70
70
|
t.innerHTML = e.trim();
|
|
71
71
|
let n = document.createDocumentFragment();
|
|
72
72
|
return n.append(...Array.from(t.childNodes)), n;
|
|
73
|
-
},
|
|
73
|
+
}, Et = class e {
|
|
74
74
|
static get DEFAULT_PLACEHOLDER() {
|
|
75
75
|
return "tools.paragraph.placeholder";
|
|
76
76
|
}
|
|
@@ -88,21 +88,21 @@ var gt = (e) => {
|
|
|
88
88
|
return this._styles.size && (e.fontSize = this._styles.size), this._styles.lineHeight && (e.lineHeight = this._styles.lineHeight), this._styles.marginTop && (e.marginTop = this._styles.marginTop), this._styles.marginBottom && (e.marginBottom = this._styles.marginBottom), e;
|
|
89
89
|
}
|
|
90
90
|
drawView() {
|
|
91
|
-
let
|
|
92
|
-
|
|
93
|
-
let
|
|
94
|
-
return Object.keys(
|
|
91
|
+
let t = document.createElement("DIV");
|
|
92
|
+
t.className = A(this.api.styles.block, e.WRAPPER_CLASSES, yt, bt), t.setAttribute(D.tool, "paragraph"), t.contentEditable = "false";
|
|
93
|
+
let n = this.buildInlineStyles();
|
|
94
|
+
return Object.keys(n).length > 0 && Object.assign(t.style, n), this._data.text ? t.innerHTML = this._data.text : this.readOnly && (t.innerHTML = "<br>"), this.readOnly || (t.contentEditable = "true", t.addEventListener("keyup", this.onKeyUp), this.placeholderCleanup = j(t, this.api.i18n.t(this._placeholder), "data-blok-placeholder-active")), t;
|
|
95
95
|
}
|
|
96
96
|
render() {
|
|
97
97
|
return this._element || (this._element = this.drawView()), this._element;
|
|
98
98
|
}
|
|
99
99
|
setReadOnly(e) {
|
|
100
|
-
this._element && (this.readOnly = e, e ? (this._element.contentEditable = "false", this._element.removeEventListener("keyup", this.onKeyUp), this.placeholderCleanup && (this.placeholderCleanup(), this.placeholderCleanup = null),
|
|
100
|
+
this._element && (this.readOnly = e, e ? (this._element.contentEditable = "false", this._element.removeEventListener("keyup", this.onKeyUp), this.placeholderCleanup && (this.placeholderCleanup(), this.placeholderCleanup = null), xt(this._element) && (this._element.innerHTML = "<br>")) : (this._element.contentEditable = "true", this._element.addEventListener("keyup", this.onKeyUp), this.placeholderCleanup = j(this._element, this.api.i18n.t(this._placeholder), "data-blok-placeholder-active"), this._element.innerHTML === "<br>" && (this._element.innerHTML = "")));
|
|
101
101
|
}
|
|
102
102
|
merge(e) {
|
|
103
103
|
if (!this._element) return;
|
|
104
104
|
this._data.text += e.text;
|
|
105
|
-
let t =
|
|
105
|
+
let t = Tt(e.text);
|
|
106
106
|
this._element.appendChild(t), this._element.normalize();
|
|
107
107
|
}
|
|
108
108
|
validate(e) {
|
|
@@ -141,7 +141,7 @@ var gt = (e) => {
|
|
|
141
141
|
}
|
|
142
142
|
static get toolbox() {
|
|
143
143
|
return {
|
|
144
|
-
icon:
|
|
144
|
+
icon: ue,
|
|
145
145
|
title: "Text",
|
|
146
146
|
titleKey: "text",
|
|
147
147
|
searchTerms: [
|
|
@@ -153,7 +153,7 @@ var gt = (e) => {
|
|
|
153
153
|
};
|
|
154
154
|
}
|
|
155
155
|
};
|
|
156
|
-
|
|
156
|
+
wt = Et, wt.WRAPPER_CLASSES = [
|
|
157
157
|
"leading-[1.5]",
|
|
158
158
|
"outline-hidden",
|
|
159
159
|
"mt-px",
|
|
@@ -163,53 +163,53 @@ Ct = Tt, Ct.WRAPPER_CLASSES = [
|
|
|
163
163
|
];
|
|
164
164
|
//#endregion
|
|
165
165
|
//#region src/tools/toggle/dom-builder.ts
|
|
166
|
-
var
|
|
167
|
-
let { data:
|
|
168
|
-
|
|
169
|
-
let
|
|
170
|
-
|
|
171
|
-
let
|
|
172
|
-
|
|
173
|
-
let
|
|
174
|
-
return
|
|
175
|
-
wrapper:
|
|
176
|
-
arrowElement:
|
|
177
|
-
contentElement:
|
|
178
|
-
bodyPlaceholderElement:
|
|
179
|
-
childContainerElement:
|
|
166
|
+
var Dt = (e) => {
|
|
167
|
+
let { data: t, readOnly: n, isOpen: r, keydownHandler: i, onArrowClick: a, onBodyPlaceholderClick: o } = e, s = document.createElement("div");
|
|
168
|
+
s.className = Ce, s.setAttribute(D.tool, Ze), s.setAttribute(O.toggleOpen, String(r));
|
|
169
|
+
let c = document.createElement("div");
|
|
170
|
+
c.className = Ae;
|
|
171
|
+
let l = Ot(r, a, {}, e.ariaLabels), u = At(t, n, i);
|
|
172
|
+
c.appendChild(l), c.appendChild(u);
|
|
173
|
+
let d = kt(o, e.bodyPlaceholderText), f = document.createElement("div");
|
|
174
|
+
return f.className = De, f.setAttribute(O.toggleChildren, ""), f.setAttribute(D.nestedBlocks, ""), f.setAttribute("data-blok-mutation-free", "true"), f.id = `toggle-children-${Date.now()}-${Math.random().toString(36).slice(2)}`, l.setAttribute("aria-controls", f.id), s.appendChild(c), s.appendChild(d), s.appendChild(f), {
|
|
175
|
+
wrapper: s,
|
|
176
|
+
arrowElement: l,
|
|
177
|
+
contentElement: u,
|
|
178
|
+
bodyPlaceholderElement: d,
|
|
179
|
+
childContainerElement: f
|
|
180
180
|
};
|
|
181
|
-
},
|
|
181
|
+
}, Ot = (e, t, n = {}, r = {
|
|
182
182
|
collapse: "Collapse",
|
|
183
183
|
expand: "Expand"
|
|
184
184
|
}) => {
|
|
185
|
-
let
|
|
186
|
-
|
|
187
|
-
let
|
|
188
|
-
return
|
|
189
|
-
e.stopPropagation(),
|
|
190
|
-
}),
|
|
191
|
-
(e.key === "Enter" || e.key === " ") && (e.preventDefault(), e.stopPropagation(),
|
|
192
|
-
})),
|
|
193
|
-
},
|
|
185
|
+
let i = document.createElement("span");
|
|
186
|
+
i.className = Ie, i.setAttribute(O.toggleArrow, ""), i.setAttribute(D.mutationFree, "true"), i.setAttribute("role", "button"), i.setAttribute("tabindex", "0"), i.setAttribute("aria-label", e ? r.collapse : r.expand), i.setAttribute("aria-expanded", String(e)), n.contentEditableFalse === !0 && (i.contentEditable = "false"), i.innerHTML = et;
|
|
187
|
+
let a = i.querySelector("svg");
|
|
188
|
+
return a && (a.style.transition = "transform 200ms ease-in-out", e && (a.style.transform = "rotate(90deg)")), t && (i.addEventListener("click", (e) => {
|
|
189
|
+
e.stopPropagation(), t();
|
|
190
|
+
}), i.addEventListener("keydown", (e) => {
|
|
191
|
+
(e.key === "Enter" || e.key === " ") && (e.preventDefault(), e.stopPropagation(), t());
|
|
192
|
+
})), i;
|
|
193
|
+
}, kt = (e, t) => {
|
|
194
194
|
let n = document.createElement("div");
|
|
195
|
-
return n.className =
|
|
196
|
-
},
|
|
195
|
+
return n.className = nt, n.setAttribute(O.toggleBodyPlaceholder, ""), n.setAttribute("data-blok-mutation-free", "true"), n.textContent = t, e && n.addEventListener("click", e), n;
|
|
196
|
+
}, At = (e, t, n) => {
|
|
197
197
|
let r = document.createElement("div");
|
|
198
|
-
return r.className =
|
|
199
|
-
},
|
|
200
|
-
for (let
|
|
201
|
-
},
|
|
202
|
-
let t =
|
|
203
|
-
return t.contentElement &&
|
|
204
|
-
},
|
|
198
|
+
return r.className = A(Te, vt, bt), r.setAttribute(O.toggleContent, ""), r.contentEditable = t ? "false" : "true", r.innerHTML = e.text, n && r.addEventListener("keydown", n), r;
|
|
199
|
+
}, jt = (e, t) => {
|
|
200
|
+
for (let n of t) n.holder.parentElement !== e && (n.holder.closest(`[${D.nestedBlocks}]`) || e.appendChild(n.holder));
|
|
201
|
+
}, Mt = (e) => {
|
|
202
|
+
let t = Dt(e);
|
|
203
|
+
return t.contentElement && j(t.contentElement, e.placeholder, "data-blok-placeholder-active"), t;
|
|
204
|
+
}, M = (e, t, n, r = {
|
|
205
205
|
collapse: "Collapse",
|
|
206
206
|
expand: "Expand"
|
|
207
207
|
}) => {
|
|
208
208
|
let i = e.querySelector("svg");
|
|
209
|
-
i && (i.style.transform = n ? "rotate(90deg)" : ""), e.setAttribute("aria-label", n ? r.collapse : r.expand), e.setAttribute("aria-expanded", String(n)), t.setAttribute(
|
|
209
|
+
i && (i.style.transform = n ? "rotate(90deg)" : ""), e.setAttribute("aria-label", n ? r.collapse : r.expand), e.setAttribute("aria-expanded", String(n)), t.setAttribute(O.toggleOpen, String(n));
|
|
210
210
|
}, Nt = (e, t, n, r, i) => {
|
|
211
211
|
let a = e.blocks.getChildren(t);
|
|
212
|
-
!n && r && i && r.contains(document.activeElement) && i.focus(), r &&
|
|
212
|
+
!n && r && i && r.contains(document.activeElement) && i.focus(), r && jt(r, a);
|
|
213
213
|
for (let e of a) n ? e.holder.classList.remove("hidden") : e.holder.classList.add("hidden");
|
|
214
214
|
r && (n ? r.removeAttribute("aria-hidden") : r.setAttribute("aria-hidden", "true"));
|
|
215
215
|
}, Pt = (e, t, n, r, i) => {
|
|
@@ -237,7 +237,7 @@ var Et = (e) => {
|
|
|
237
237
|
let { api: n, blockId: r, data: i, getContentElement: a, syncContentFromDOM: o } = e;
|
|
238
238
|
if (o(), r === void 0) return;
|
|
239
239
|
let s = a();
|
|
240
|
-
if (!s || !
|
|
240
|
+
if (!s || !be(s)) return;
|
|
241
241
|
let c = i.text;
|
|
242
242
|
c === "" && (t.preventDefault(), await n.blocks.convert(r, "paragraph", { text: c }));
|
|
243
243
|
}, Lt = (e, t, n) => {
|
|
@@ -287,7 +287,7 @@ var Et = (e) => {
|
|
|
287
287
|
let { api: n, blockId: r, getText: i, getContentElement: a, syncContentFromDOM: o, currentLevel: s } = e;
|
|
288
288
|
if (o(), r === void 0) return;
|
|
289
289
|
let c = a();
|
|
290
|
-
if (!c || !
|
|
290
|
+
if (!c || !be(c)) return;
|
|
291
291
|
let l = i();
|
|
292
292
|
l === "" && (t.preventDefault(), await n.blocks.convert(r, "header", {
|
|
293
293
|
text: l,
|
|
@@ -327,7 +327,7 @@ var Et = (e) => {
|
|
|
327
327
|
if (e.isToggleable === !0 && (r.isToggleable = !0), typeof e.isOpen == "boolean" && (r.isOpen = e.isOpen), r.text) {
|
|
328
328
|
let e = document.createElement("div");
|
|
329
329
|
e.innerHTML = r.text;
|
|
330
|
-
let t = e.querySelector(`[${
|
|
330
|
+
let t = e.querySelector(`[${O.toggleArrow}]`);
|
|
331
331
|
t && (t.remove(), r.text = e.innerHTML);
|
|
332
332
|
}
|
|
333
333
|
return r;
|
|
@@ -346,17 +346,17 @@ var Et = (e) => {
|
|
|
346
346
|
else {
|
|
347
347
|
this._element.contentEditable = "true", this._data.isToggleable && this._element.addEventListener("keydown", this.handleKeyDown);
|
|
348
348
|
let e = this.api.i18n.t(this.currentLevel.nameKey), t = this.resolvePlaceholderText(e);
|
|
349
|
-
this.placeholderCleanup =
|
|
349
|
+
this.placeholderCleanup = j(this._element, t);
|
|
350
350
|
}
|
|
351
351
|
}
|
|
352
352
|
expand() {
|
|
353
|
-
!this._data.isToggleable || this._isOpen || (this._isOpen = !0, this._arrowElement && this._element &&
|
|
353
|
+
!this._data.isToggleable || this._isOpen || (this._isOpen = !0, this._arrowElement && this._element && M(this._arrowElement, this._element, this._isOpen, {
|
|
354
354
|
collapse: this.api.i18n.t("tools.toggle.ariaLabelCollapse"),
|
|
355
355
|
expand: this.api.i18n.t("tools.toggle.ariaLabelExpand")
|
|
356
356
|
}), this.updateChildrenVisibility(), this.updateBodyPlaceholderVisibility());
|
|
357
357
|
}
|
|
358
358
|
collapse() {
|
|
359
|
-
!this._data.isToggleable || !this._isOpen || (this._isOpen = !1, this._arrowElement && this._element &&
|
|
359
|
+
!this._data.isToggleable || !this._isOpen || (this._isOpen = !1, this._arrowElement && this._element && M(this._arrowElement, this._element, this._isOpen, {
|
|
360
360
|
collapse: this.api.i18n.t("tools.toggle.ariaLabelCollapse"),
|
|
361
361
|
expand: this.api.i18n.t("tools.toggle.ariaLabelExpand")
|
|
362
362
|
}), this.updateChildrenVisibility(), this.updateBodyPlaceholderVisibility());
|
|
@@ -384,14 +384,14 @@ var Et = (e) => {
|
|
|
384
384
|
merge(e) {
|
|
385
385
|
let t = document.createElement("div");
|
|
386
386
|
t.innerHTML = e.text;
|
|
387
|
-
let n = t.querySelector(`[${
|
|
387
|
+
let n = t.querySelector(`[${O.toggleArrow}]`);
|
|
388
388
|
n && n.remove(), this._element.insertAdjacentHTML("beforeend", t.innerHTML);
|
|
389
389
|
}
|
|
390
390
|
validate(e) {
|
|
391
391
|
return typeof e.text == "string";
|
|
392
392
|
}
|
|
393
393
|
setData(e) {
|
|
394
|
-
return this._data = this.normalizeData(e), typeof e.text == "string" && (this._element.innerHTML = e.text), this._data.isToggleable && typeof this._data.isOpen == "boolean" && (this._isOpen = this._data.isOpen, this._arrowElement && this._element &&
|
|
394
|
+
return this._data = this.normalizeData(e), typeof e.text == "string" && (this._element.innerHTML = e.text), this._data.isToggleable && typeof this._data.isOpen == "boolean" && (this._isOpen = this._data.isOpen, this._arrowElement && this._element && M(this._arrowElement, this._element, this._isOpen, {
|
|
395
395
|
collapse: this.api.i18n.t("tools.toggle.ariaLabelCollapse"),
|
|
396
396
|
expand: this.api.i18n.t("tools.toggle.ariaLabelExpand")
|
|
397
397
|
}), this.updateChildrenVisibility(), this.updateBodyPlaceholderVisibility()), !0;
|
|
@@ -430,13 +430,13 @@ var Et = (e) => {
|
|
|
430
430
|
e.innerHTML = this._element.innerHTML, this._element.parentNode.replaceChild(e, this._element), this._element = e;
|
|
431
431
|
}
|
|
432
432
|
if (t.text !== void 0 && (this._element.innerHTML = this._data.text || ""), this._data.isToggleable) {
|
|
433
|
-
if (this._element.setAttribute(
|
|
434
|
-
else if (!this._wrapper.querySelector(`[${
|
|
433
|
+
if (this._element.setAttribute(O.toggleOpen, String(this._isOpen)), this._element.className = A(e.BASE_STYLES, this.currentLevel.styles, _t, "pl-8"), !this._wrapper) this.createToggleWrapper();
|
|
434
|
+
else if (!this._wrapper.querySelector(`[${O.toggleArrow}]`)) {
|
|
435
435
|
var n;
|
|
436
436
|
let e = this.buildArrow();
|
|
437
437
|
this._arrowElement = e, ((n = this._headerRow) == null ? this._wrapper : n).prepend(e);
|
|
438
438
|
}
|
|
439
|
-
} else if (this._element.removeAttribute(
|
|
439
|
+
} else if (this._element.removeAttribute(O.toggleOpen), this._element.className = A(e.BASE_STYLES, this.currentLevel.styles, _t), this._arrowElement = null, this._wrapper) {
|
|
440
440
|
let e = this._wrapper.parentNode;
|
|
441
441
|
e && e.replaceChild(this._element, this._wrapper), this._wrapper = null, this._headerRow = null;
|
|
442
442
|
}
|
|
@@ -445,29 +445,29 @@ var Et = (e) => {
|
|
|
445
445
|
return this._settings.placeholder ? this.api.i18n.t(this._settings.placeholder) : e === this.currentLevel.nameKey ? this.currentLevel.name : e;
|
|
446
446
|
}
|
|
447
447
|
getTag() {
|
|
448
|
-
let
|
|
449
|
-
|
|
450
|
-
let { inlineStyles:
|
|
451
|
-
|
|
452
|
-
let
|
|
453
|
-
return this.readOnly ?
|
|
448
|
+
let t = document.createElement(this.currentLevel.tag);
|
|
449
|
+
t.innerHTML = this._data.text || "", t.className = A(e.BASE_STYLES, this.currentLevel.styles, _t, this._data.isToggleable ? "pl-8" : "");
|
|
450
|
+
let { inlineStyles: n } = this.currentLevel;
|
|
451
|
+
n && Object.assign(t.style, n), t.setAttribute(D.tool, "header"), t.contentEditable = this.readOnly ? "false" : "true", this._data.isToggleable && t.setAttribute(O.toggleOpen, String(this._isOpen));
|
|
452
|
+
let r = this.api.i18n.t(this.currentLevel.nameKey), i = this.resolvePlaceholderText(r);
|
|
453
|
+
return this.readOnly ? t.setAttribute("data-placeholder", i) : this.placeholderCleanup = j(t, i), !this.readOnly && this._data.isToggleable && t.addEventListener("keydown", this.handleKeyDown), t;
|
|
454
454
|
}
|
|
455
455
|
buildArrow() {
|
|
456
|
-
let e =
|
|
456
|
+
let e = Ot(this._isOpen, () => this.toggleOpen(), {}, {
|
|
457
457
|
collapse: this.api.i18n.t("tools.toggle.ariaLabelCollapse"),
|
|
458
458
|
expand: this.api.i18n.t("tools.toggle.ariaLabelExpand")
|
|
459
459
|
});
|
|
460
460
|
return e.classList.add("absolute", "left-0", "top-1/2", "-translate-y-1/2"), e;
|
|
461
461
|
}
|
|
462
462
|
buildWrapper() {
|
|
463
|
-
let e = document.createElement("div"),
|
|
464
|
-
|
|
465
|
-
let
|
|
466
|
-
this._arrowElement =
|
|
463
|
+
let e = document.createElement("div"), t = document.createElement("div");
|
|
464
|
+
t.className = "relative", this._headerRow = t;
|
|
465
|
+
let n = this.buildArrow();
|
|
466
|
+
this._arrowElement = n, t.appendChild(n), t.appendChild(this._element), e.appendChild(t);
|
|
467
|
+
let r = document.createElement("div");
|
|
468
|
+
r.className = A(nt, "pl-8"), r.setAttribute(O.toggleBodyPlaceholder, ""), r.setAttribute("data-blok-mutation-free", "true"), r.textContent = this.api.i18n.t("tools.toggle.bodyPlaceholder"), this.readOnly || r.addEventListener("click", () => this.handleBodyPlaceholderClick()), this._bodyPlaceholderElement = r, e.appendChild(r);
|
|
467
469
|
let i = document.createElement("div");
|
|
468
|
-
i.className =
|
|
469
|
-
let a = document.createElement("div");
|
|
470
|
-
return a.className = "pl-8", a.setAttribute(E.toggleChildren, ""), a.setAttribute(t.nestedBlocks, ""), a.setAttribute("data-blok-mutation-free", "true"), this._childContainerElement = a, e.appendChild(a), e;
|
|
470
|
+
return i.className = "pl-8", i.setAttribute(O.toggleChildren, ""), i.setAttribute(D.nestedBlocks, ""), i.setAttribute("data-blok-mutation-free", "true"), this._childContainerElement = i, e.appendChild(i), e;
|
|
471
471
|
}
|
|
472
472
|
createToggleWrapper() {
|
|
473
473
|
let e = this._element.parentNode;
|
|
@@ -495,7 +495,7 @@ var Et = (e) => {
|
|
|
495
495
|
await zt(e.createKeyboardContext()), e.updateChildrenVisibility(), e.updateBodyPlaceholderVisibility();
|
|
496
496
|
}
|
|
497
497
|
toggleOpen() {
|
|
498
|
-
this._isOpen = !this._isOpen, this._arrowElement && this._element &&
|
|
498
|
+
this._isOpen = !this._isOpen, this._arrowElement && this._element && M(this._arrowElement, this._element, this._isOpen, {
|
|
499
499
|
collapse: this.api.i18n.t("tools.toggle.ariaLabelCollapse"),
|
|
500
500
|
expand: this.api.i18n.t("tools.toggle.ariaLabelExpand")
|
|
501
501
|
}), this.updateChildrenVisibility(), this.updateBodyPlaceholderVisibility();
|
|
@@ -587,9 +587,9 @@ var Et = (e) => {
|
|
|
587
587
|
],
|
|
588
588
|
shortcut: "#".repeat(e.number)
|
|
589
589
|
})), n = {
|
|
590
|
-
1:
|
|
591
|
-
2:
|
|
592
|
-
3:
|
|
590
|
+
1: c,
|
|
591
|
+
2: s,
|
|
592
|
+
3: x
|
|
593
593
|
}, r = e.DEFAULT_LEVELS.filter((e) => e.number <= 3).map((e) => ({
|
|
594
594
|
icon: n[e.number],
|
|
595
595
|
title: `Toggle heading ${e.number}`,
|
|
@@ -621,7 +621,7 @@ Vt = Ht, Vt.BASE_STYLES = "py-[7px] px-[2px] m-0 leading-[1.3]! outline-hidden [
|
|
|
621
621
|
tag: "H1",
|
|
622
622
|
nameKey: "tools.header.heading1",
|
|
623
623
|
name: "Heading 1",
|
|
624
|
-
icon:
|
|
624
|
+
icon: $e,
|
|
625
625
|
styles: "text-3xl font-semibold mt-8 mb-px"
|
|
626
626
|
},
|
|
627
627
|
{
|
|
@@ -629,7 +629,7 @@ Vt = Ht, Vt.BASE_STYLES = "py-[7px] px-[2px] m-0 leading-[1.3]! outline-hidden [
|
|
|
629
629
|
tag: "H2",
|
|
630
630
|
nameKey: "tools.header.heading2",
|
|
631
631
|
name: "Heading 2",
|
|
632
|
-
icon:
|
|
632
|
+
icon: ee,
|
|
633
633
|
styles: "text-2xl font-semibold mt-[26px] mb-px"
|
|
634
634
|
},
|
|
635
635
|
{
|
|
@@ -637,7 +637,7 @@ Vt = Ht, Vt.BASE_STYLES = "py-[7px] px-[2px] m-0 leading-[1.3]! outline-hidden [
|
|
|
637
637
|
tag: "H3",
|
|
638
638
|
nameKey: "tools.header.heading3",
|
|
639
639
|
name: "Heading 3",
|
|
640
|
-
icon:
|
|
640
|
+
icon: ve,
|
|
641
641
|
styles: "text-xl font-semibold mt-5 mb-px"
|
|
642
642
|
},
|
|
643
643
|
{
|
|
@@ -645,7 +645,7 @@ Vt = Ht, Vt.BASE_STYLES = "py-[7px] px-[2px] m-0 leading-[1.3]! outline-hidden [
|
|
|
645
645
|
tag: "H4",
|
|
646
646
|
nameKey: "tools.header.heading4",
|
|
647
647
|
name: "Heading 4",
|
|
648
|
-
icon:
|
|
648
|
+
icon: _e,
|
|
649
649
|
styles: "text-lg font-semibold mt-3 mb-px"
|
|
650
650
|
},
|
|
651
651
|
{
|
|
@@ -653,7 +653,7 @@ Vt = Ht, Vt.BASE_STYLES = "py-[7px] px-[2px] m-0 leading-[1.3]! outline-hidden [
|
|
|
653
653
|
tag: "H5",
|
|
654
654
|
nameKey: "tools.header.heading5",
|
|
655
655
|
name: "Heading 5",
|
|
656
|
-
icon:
|
|
656
|
+
icon: xe,
|
|
657
657
|
styles: "text-base font-semibold mt-3 mb-px"
|
|
658
658
|
},
|
|
659
659
|
{
|
|
@@ -661,7 +661,7 @@ Vt = Ht, Vt.BASE_STYLES = "py-[7px] px-[2px] m-0 leading-[1.3]! outline-hidden [
|
|
|
661
661
|
tag: "H6",
|
|
662
662
|
nameKey: "tools.header.heading6",
|
|
663
663
|
name: "Heading 6",
|
|
664
|
-
icon:
|
|
664
|
+
icon: S,
|
|
665
665
|
styles: "text-sm font-semibold mt-3 mb-px"
|
|
666
666
|
}
|
|
667
667
|
];
|
|
@@ -689,13 +689,13 @@ var Ut = "outline-hidden py-[7px] mt-[2px] mb-px", Wt = "outline-hidden pl-0.5 l
|
|
|
689
689
|
checkboxElement: s
|
|
690
690
|
};
|
|
691
691
|
}, Qt = (e) => {
|
|
692
|
-
var
|
|
693
|
-
let { data:
|
|
694
|
-
return
|
|
692
|
+
var t;
|
|
693
|
+
let { data: n } = e, r = document.createElement("div");
|
|
694
|
+
return r.className = Ut, r.setAttribute(D.tool, Jt), r.setAttribute("data-list-style", n.style), r.setAttribute("data-list-depth", String((t = n.depth) == null ? 0 : t)), n.start !== void 0 && n.start !== 1 && r.setAttribute("data-list-start", String(n.start)), r;
|
|
695
695
|
}, $t = (e) => {
|
|
696
696
|
var t;
|
|
697
697
|
let { data: n, itemColor: r, itemSize: i, placeholder: a, markerDepth: o } = e, s = document.createElement("div");
|
|
698
|
-
s.setAttribute("role", "listitem"), s.className =
|
|
698
|
+
s.setAttribute("role", "listitem"), s.className = A(Wt, "flex", ..._t), r && (s.style.color = r), i && (s.style.fontSize = i);
|
|
699
699
|
let c = (t = n.depth) == null ? 0 : t;
|
|
700
700
|
if (c > 0) {
|
|
701
701
|
let e = n.style === "ordered" ? 26 : 27;
|
|
@@ -704,7 +704,7 @@ var Ut = "outline-hidden py-[7px] mt-[2px] mb-px", Wt = "outline-hidden pl-0.5 l
|
|
|
704
704
|
let l = tn(n.style, o == null ? c : o);
|
|
705
705
|
l.setAttribute("data-list-marker", "true"), l.setAttribute("data-blok-mutation-free", "true"), s.appendChild(l);
|
|
706
706
|
let u = document.createElement("div");
|
|
707
|
-
return u.className =
|
|
707
|
+
return u.className = A("flex-1 min-w-0 outline-hidden", ..._t), u.setAttribute("data-blok-testid", Yt.contentContainer), u.contentEditable = e.readOnly ? "false" : "true", u.innerHTML = n.text, Xt(u, a), s.appendChild(u), s;
|
|
708
708
|
}, en = (e) => {
|
|
709
709
|
var t;
|
|
710
710
|
let { data: n, itemColor: r, itemSize: i, placeholder: a, readOnly: o } = e, s = document.createElement("div");
|
|
@@ -714,10 +714,10 @@ var Ut = "outline-hidden py-[7px] mt-[2px] mb-px", Wt = "outline-hidden pl-0.5 l
|
|
|
714
714
|
let l = document.createElement("input");
|
|
715
715
|
l.type = "checkbox", l.className = Kt, l.checked = !!n.checked, l.disabled = o;
|
|
716
716
|
let u = document.createElement("div");
|
|
717
|
-
return u.className =
|
|
717
|
+
return u.className = A("flex-1 outline-hidden leading-[1.5]", n.checked ? "line-through opacity-60" : "", ..._t), u.setAttribute("data-blok-testid", Yt.checklistContent), u.setAttribute("data-checked", String(n.checked)), u.contentEditable = o ? "false" : "true", u.innerHTML = n.text, Xt(u, a), s.appendChild(l), s.appendChild(u), s;
|
|
718
718
|
}, tn = (e, t) => {
|
|
719
719
|
let n = document.createElement("span");
|
|
720
|
-
return n.className = "shrink-0 select-none", n.setAttribute("aria-hidden", "true"), n.contentEditable = "false", e === "ordered" ? (n.textContent = "1.", n.className =
|
|
720
|
+
return n.className = "shrink-0 select-none", n.setAttribute("aria-hidden", "true"), n.contentEditable = "false", e === "ordered" ? (n.textContent = "1.", n.className = A(n.className, "text-right"), n.style.paddingRight = "11px", n.style.minWidth = "fit-content") : (n.textContent = nn(t), n.className = A(n.className, "w-6 text-center flex justify-center"), n.style.paddingLeft = "1px", n.style.paddingRight = "13px", n.style.fontSize = "24px", n.style.fontFamily = "Arial", n.style.lineHeight = "1.5rem"), n;
|
|
721
721
|
}, nn = (e) => {
|
|
722
722
|
let t = [
|
|
723
723
|
"•",
|
|
@@ -748,7 +748,7 @@ var Ut = "outline-hidden py-[7px] mt-[2px] mb-px", Wt = "outline-hidden pl-0.5 l
|
|
|
748
748
|
return d.replaceChild(f.wrapper, s), f.wrapper;
|
|
749
749
|
}, an = (e, t, n) => {
|
|
750
750
|
if (!t) return e;
|
|
751
|
-
let r = n(), i =
|
|
751
|
+
let r = n(), i = k({
|
|
752
752
|
text: r ? gt(r.innerHTML) : e.text,
|
|
753
753
|
style: e.style
|
|
754
754
|
}, e.style === "checklist" ? { checked: !!e.checked } : {});
|
|
@@ -764,7 +764,7 @@ var Ut = "outline-hidden py-[7px] mt-[2px] mb-px", Wt = "outline-hidden pl-0.5 l
|
|
|
764
764
|
newData: e,
|
|
765
765
|
inPlace: !1
|
|
766
766
|
};
|
|
767
|
-
let d = "depth" in t ? t.depth : 0, f =
|
|
767
|
+
let d = "depth" in t ? t.depth : 0, f = k(k(k({}, e), t), {}, { depth: d }), p = r();
|
|
768
768
|
if (p && typeof t.text == "string" && (p.innerHTML = t.text), s !== c) return i.adjustDepthTo(c), i.updateMarkerForDepth(c, u), {
|
|
769
769
|
newData: f,
|
|
770
770
|
inPlace: !0
|
|
@@ -851,7 +851,7 @@ var Ut = "outline-hidden py-[7px] mt-[2px] mb-px", Wt = "outline-hidden pl-0.5 l
|
|
|
851
851
|
};
|
|
852
852
|
if (_n(e)) {
|
|
853
853
|
let t = e.items[0], r = (t == null ? void 0 : t.content) || "", i = (t == null ? void 0 : t.checked) || !1;
|
|
854
|
-
return
|
|
854
|
+
return k({
|
|
855
855
|
text: r,
|
|
856
856
|
style: e.style || n,
|
|
857
857
|
checked: !!i,
|
|
@@ -860,7 +860,7 @@ var Ut = "outline-hidden py-[7px] mt-[2px] mb-px", Wt = "outline-hidden pl-0.5 l
|
|
|
860
860
|
}
|
|
861
861
|
if (vn(e)) {
|
|
862
862
|
let t = yn(e.text), r = bn(e.style, n), i = xn(e.checked), a = Sn(e.depth, 0), o = e.start, s = typeof o == "number" && o !== void 0 && o !== 1 ? o : void 0;
|
|
863
|
-
return
|
|
863
|
+
return k({
|
|
864
864
|
text: t,
|
|
865
865
|
style: r,
|
|
866
866
|
checked: i,
|
|
@@ -995,13 +995,13 @@ var Ut = "outline-hidden py-[7px] mt-[2px] mb-px", Wt = "outline-hidden pl-0.5 l
|
|
|
995
995
|
}
|
|
996
996
|
let { beforeContent: d, afterContent: f } = fn(l, c.getRangeAt(0)), p = i ? (n = r.blocks.getBlockIndex(i)) == null ? r.blocks.getCurrentBlockIndex() : n : r.blocks.getCurrentBlockIndex();
|
|
997
997
|
if (!i) {
|
|
998
|
-
l.innerHTML = d, a.text = d, Ln(r, r.blocks.insert(Jt,
|
|
998
|
+
l.innerHTML = d, a.text = d, Ln(r, r.blocks.insert(Jt, k(k({
|
|
999
999
|
text: f,
|
|
1000
1000
|
style: a.style
|
|
1001
1001
|
}, a.style === "checklist" ? { checked: !!a.checked } : {}), {}, { depth: a.depth }), void 0, p + 1, !0), "start");
|
|
1002
1002
|
return;
|
|
1003
1003
|
}
|
|
1004
|
-
let m = r.blocks.splitBlock(i, { text: d }, Jt,
|
|
1004
|
+
let m = r.blocks.splitBlock(i, { text: d }, Jt, k(k({
|
|
1005
1005
|
text: f,
|
|
1006
1006
|
style: a.style
|
|
1007
1007
|
}, a.style === "checklist" ? { checked: !!a.checked } : {}), {}, { depth: a.depth }), p + 1);
|
|
@@ -1037,7 +1037,7 @@ var Ut = "outline-hidden py-[7px] mt-[2px] mb-px", Wt = "outline-hidden pl-0.5 l
|
|
|
1037
1037
|
if (c >= t.getMaxAllowedDepth(s)) return;
|
|
1038
1038
|
a();
|
|
1039
1039
|
let l = c + 1;
|
|
1040
|
-
i.depth = l, Ln(n, await n.blocks.update(r || "",
|
|
1040
|
+
i.depth = l, Ln(n, await n.blocks.update(r || "", k(k({}, i), {}, { depth: l })));
|
|
1041
1041
|
}, Hn = async (e, t, n, r) => {
|
|
1042
1042
|
var i;
|
|
1043
1043
|
let a = t ? (i = e.blocks.getBlockIndex(t)) == null ? e.blocks.getCurrentBlockIndex() : i : e.blocks.getCurrentBlockIndex(), o = e.blocks.getBlocksCount(), s = async (t) => {
|
|
@@ -1054,7 +1054,7 @@ var Ut = "outline-hidden py-[7px] mt-[2px] mb-px", Wt = "outline-hidden pl-0.5 l
|
|
|
1054
1054
|
a();
|
|
1055
1055
|
let c = s - 1;
|
|
1056
1056
|
i.depth = c;
|
|
1057
|
-
let l = await n.blocks.update(r || "",
|
|
1057
|
+
let l = await n.blocks.update(r || "", k(k({}, i), {}, { depth: c }));
|
|
1058
1058
|
t && await Hn(n, r, s, t), Ln(n, l);
|
|
1059
1059
|
}, Wn = (e) => {
|
|
1060
1060
|
let { data: t, readOnly: n, placeholder: r, itemColor: i, itemSize: a, markerDepth: o, setupItemPlaceholder: s, onCheckboxChange: c, keydownHandler: l } = e, u = Zt({
|
|
@@ -1317,23 +1317,23 @@ var Ut = "outline-hidden py-[7px] mt-[2px] mb-px", Wt = "outline-hidden pl-0.5 l
|
|
|
1317
1317
|
name: "bulletedList",
|
|
1318
1318
|
titleKey: "bulletedList",
|
|
1319
1319
|
style: "unordered",
|
|
1320
|
-
icon:
|
|
1320
|
+
icon: We
|
|
1321
1321
|
},
|
|
1322
1322
|
{
|
|
1323
1323
|
name: "numberedList",
|
|
1324
1324
|
titleKey: "numberedList",
|
|
1325
1325
|
style: "ordered",
|
|
1326
|
-
icon:
|
|
1326
|
+
icon: Oe
|
|
1327
1327
|
},
|
|
1328
1328
|
{
|
|
1329
1329
|
name: "todoList",
|
|
1330
1330
|
titleKey: "todoList",
|
|
1331
1331
|
style: "checklist",
|
|
1332
|
-
icon:
|
|
1332
|
+
icon: ct
|
|
1333
1333
|
}
|
|
1334
1334
|
], sr = () => [
|
|
1335
1335
|
{
|
|
1336
|
-
icon:
|
|
1336
|
+
icon: We,
|
|
1337
1337
|
title: "Bulleted list",
|
|
1338
1338
|
titleKey: "bulletedList",
|
|
1339
1339
|
data: { style: "unordered" },
|
|
@@ -1352,7 +1352,7 @@ var Ut = "outline-hidden py-[7px] mt-[2px] mb-px", Wt = "outline-hidden pl-0.5 l
|
|
|
1352
1352
|
shortcut: "-"
|
|
1353
1353
|
},
|
|
1354
1354
|
{
|
|
1355
|
-
icon:
|
|
1355
|
+
icon: Oe,
|
|
1356
1356
|
title: "Numbered list",
|
|
1357
1357
|
titleKey: "numberedList",
|
|
1358
1358
|
data: { style: "ordered" },
|
|
@@ -1371,7 +1371,7 @@ var Ut = "outline-hidden py-[7px] mt-[2px] mb-px", Wt = "outline-hidden pl-0.5 l
|
|
|
1371
1371
|
shortcut: "1."
|
|
1372
1372
|
},
|
|
1373
1373
|
{
|
|
1374
|
-
icon:
|
|
1374
|
+
icon: ct,
|
|
1375
1375
|
title: "To-do list",
|
|
1376
1376
|
titleKey: "todoList",
|
|
1377
1377
|
data: { style: "checklist" },
|
|
@@ -1421,7 +1421,7 @@ var Ut = "outline-hidden py-[7px] mt-[2px] mb-px", Wt = "outline-hidden pl-0.5 l
|
|
|
1421
1421
|
return this.api.i18n.t(qt);
|
|
1422
1422
|
}
|
|
1423
1423
|
setupItemPlaceholder(e) {
|
|
1424
|
-
this.readOnly || (this.placeholderCleanup =
|
|
1424
|
+
this.readOnly || (this.placeholderCleanup = j(e, this.placeholder));
|
|
1425
1425
|
}
|
|
1426
1426
|
render() {
|
|
1427
1427
|
var e, t;
|
|
@@ -1447,7 +1447,7 @@ var Ut = "outline-hidden py-[7px] mt-[2px] mb-px", Wt = "outline-hidden pl-0.5 l
|
|
|
1447
1447
|
let t = this.getContentElement();
|
|
1448
1448
|
t && (t.contentEditable = e ? "false" : "true");
|
|
1449
1449
|
let n = this._element.querySelector("input[type=\"checkbox\"]");
|
|
1450
|
-
n && (n.disabled = e), e ? (this.boundHandleKeyDown && this._element.removeEventListener("keydown", this.boundHandleKeyDown), this.placeholderCleanup && (this.placeholderCleanup(), this.placeholderCleanup = null)) : (this.boundHandleKeyDown && this._element.addEventListener("keydown", this.boundHandleKeyDown), t && (this.placeholderCleanup =
|
|
1450
|
+
n && (n.disabled = e), e ? (this.boundHandleKeyDown && this._element.removeEventListener("keydown", this.boundHandleKeyDown), this.placeholderCleanup && (this.placeholderCleanup(), this.placeholderCleanup = null)) : (this.boundHandleKeyDown && this._element.addEventListener("keydown", this.boundHandleKeyDown), t && (this.placeholderCleanup = j(t, this.placeholder)));
|
|
1451
1451
|
}
|
|
1452
1452
|
rendered() {
|
|
1453
1453
|
this.updateMarkersAfterPositionChange();
|
|
@@ -1733,11 +1733,11 @@ var Ut = "outline-hidden py-[7px] mt-[2px] mb-px", Wt = "outline-hidden pl-0.5 l
|
|
|
1733
1733
|
}
|
|
1734
1734
|
showDimensionTooltip() {
|
|
1735
1735
|
if (!this.dragState) return;
|
|
1736
|
-
let e = this.getTableSize(), t = this.dragState.axis === "row" ? this.addRowBtn : this.addColBtn,
|
|
1736
|
+
let e = this.getTableSize(), t = this.dragState.axis === "row" ? this.addRowBtn : this.addColBtn, n = this.dragState.axis === "row" ? {
|
|
1737
1737
|
placement: "bottom",
|
|
1738
1738
|
marginTop: -16
|
|
1739
1739
|
} : { placement: "bottom" };
|
|
1740
|
-
|
|
1740
|
+
at(t, `${e.cols}\u00D7${e.rows}`, n);
|
|
1741
1741
|
}
|
|
1742
1742
|
handlePointerDown(e, t) {
|
|
1743
1743
|
t.preventDefault();
|
|
@@ -1766,17 +1766,17 @@ var Ut = "outline-hidden py-[7px] mt-[2px] mb-px", Wt = "outline-hidden pl-0.5 l
|
|
|
1766
1766
|
}
|
|
1767
1767
|
handlePointerUp(e) {
|
|
1768
1768
|
if (!this.dragState) return;
|
|
1769
|
-
let { axis:
|
|
1770
|
-
if (
|
|
1771
|
-
(
|
|
1769
|
+
let { axis: n, pointerId: r, didDrag: i } = this.dragState, a = n === "row" ? this.addRowBtn : this.addColBtn;
|
|
1770
|
+
if (a.releasePointerCapture(r), a.removeEventListener("pointermove", this.boundPointerMove), a.removeEventListener("pointerup", this.boundPointerUp), a.removeEventListener("pointercancel", this.boundPointerCancel), document.body.style.cursor = "", t(), this.dragState = null, !i) {
|
|
1771
|
+
(n === "row" ? this.boundAddRowClick : this.boundAddColClick)();
|
|
1772
1772
|
return;
|
|
1773
1773
|
}
|
|
1774
1774
|
this.onDragEnd();
|
|
1775
1775
|
}
|
|
1776
1776
|
handlePointerCancel(e) {
|
|
1777
1777
|
if (!this.dragState) return;
|
|
1778
|
-
let { axis:
|
|
1779
|
-
|
|
1778
|
+
let { axis: n, didDrag: r } = this.dragState, i = n === "row" ? this.addRowBtn : this.addColBtn;
|
|
1779
|
+
i.removeEventListener("pointermove", this.boundPointerMove), i.removeEventListener("pointerup", this.boundPointerUp), i.removeEventListener("pointercancel", this.boundPointerCancel), document.body.style.cursor = "", t(), this.dragState = null, r && this.onDragEnd();
|
|
1780
1780
|
}
|
|
1781
1781
|
measureUnitSize(e) {
|
|
1782
1782
|
if (e === "row") {
|
|
@@ -1827,25 +1827,25 @@ var Ut = "outline-hidden py-[7px] mt-[2px] mb-px", Wt = "outline-hidden pl-0.5 l
|
|
|
1827
1827
|
}
|
|
1828
1828
|
createAddRowButton() {
|
|
1829
1829
|
let e = document.createElement("div");
|
|
1830
|
-
e.className =
|
|
1830
|
+
e.className = A(mr, "group/add", "items-start", "cursor-row-resize"), e.setAttribute(lr, ""), e.setAttribute("contenteditable", "false"), e.style.opacity = "0", e.style.pointerEvents = "none", e.style.position = "absolute", e.style.left = "0", e.style.bottom = "-36px", e.style.zIndex = "1", e.style.height = "32px";
|
|
1831
1831
|
let t = document.createElement("div");
|
|
1832
|
-
return t.className =
|
|
1832
|
+
return t.className = A(hr), t.style.width = "100%", t.style.height = "16px", this.appendIcon(t), e.appendChild(t), T(e, Pe([this.i18n.t("tools.table.clickToAddRow"), this.i18n.t("tools.table.dragToAddRemoveRows")]), {
|
|
1833
1833
|
placement: "bottom",
|
|
1834
1834
|
marginTop: -16
|
|
1835
1835
|
}), e;
|
|
1836
1836
|
}
|
|
1837
1837
|
createAddColumnButton() {
|
|
1838
1838
|
let e = document.createElement("div");
|
|
1839
|
-
e.className =
|
|
1839
|
+
e.className = A(mr, "group/add", "justify-start", "cursor-col-resize"), e.setAttribute(ur, ""), e.setAttribute("contenteditable", "false"), e.style.opacity = "0", e.style.pointerEvents = "none", e.style.position = "absolute", e.style.right = "-36px", e.style.top = "0px", e.style.bottom = "0px", e.style.width = "32px";
|
|
1840
1840
|
let t = document.createElement("div");
|
|
1841
|
-
return t.className =
|
|
1841
|
+
return t.className = A(hr), t.style.width = "16px", t.style.height = "100%", this.appendIcon(t), e.appendChild(t), T(e, Pe([this.i18n.t("tools.table.clickToAddColumn"), this.i18n.t("tools.table.dragToAddRemoveColumns")]), { placement: "bottom" }), e;
|
|
1842
1842
|
}
|
|
1843
1843
|
appendIcon(e) {
|
|
1844
|
-
e.insertAdjacentHTML("beforeend",
|
|
1844
|
+
e.insertAdjacentHTML("beforeend", ut);
|
|
1845
1845
|
let t = e.querySelector("svg");
|
|
1846
1846
|
t && (t.setAttribute("width", gr), t.setAttribute("height", gr), t.setAttribute("viewBox", "0 0 24 24"), t.classList.add("text-gray-500", "pointer-events-none"));
|
|
1847
1847
|
}
|
|
1848
|
-
},
|
|
1848
|
+
}, N = "data-blok-table-row", P = "data-blok-table-cell", vr = "data-blok-table-cell-row", F = "data-blok-table-cell-col", yr = "1px solid var(--blok-table-border)", br = [
|
|
1849
1849
|
"py-1",
|
|
1850
1850
|
"px-2",
|
|
1851
1851
|
"min-h-[2em]",
|
|
@@ -1882,7 +1882,7 @@ var Ut = "outline-hidden py-[7px] mt-[2px] mb-px", Wt = "outline-hidden pl-0.5 l
|
|
|
1882
1882
|
let i = document.createElement("tbody");
|
|
1883
1883
|
return Array.from({ length: e.rows }).forEach((t, n) => {
|
|
1884
1884
|
let r = document.createElement("tr");
|
|
1885
|
-
r.setAttribute(
|
|
1885
|
+
r.setAttribute(N, ""), Array.from({ length: e.cols }).forEach((t, i) => {
|
|
1886
1886
|
if (e.isSpannedCell(n, i)) return;
|
|
1887
1887
|
let a = this.createCell(n, i), o = e.getCellSpan(n, i);
|
|
1888
1888
|
o.colspan > 1 && (a.colSpan = o.colspan), o.rowspan > 1 && (a.rowSpan = o.rowspan), r.appendChild(a);
|
|
@@ -1891,11 +1891,11 @@ var Ut = "outline-hidden py-[7px] mt-[2px] mb-px", Wt = "outline-hidden pl-0.5 l
|
|
|
1891
1891
|
}
|
|
1892
1892
|
addRow(e, t) {
|
|
1893
1893
|
var n;
|
|
1894
|
-
let r = this.getColumnCount(e), i = this.createRow(r), a = (n = e.querySelector("tbody")) == null ? e : n, o = a.querySelectorAll(`[${
|
|
1894
|
+
let r = this.getColumnCount(e), i = this.createRow(r), a = (n = e.querySelector("tbody")) == null ? e : n, o = a.querySelectorAll(`[${N}]`);
|
|
1895
1895
|
return t !== void 0 && t < o.length ? a.insertBefore(i, o[t]) : a.appendChild(i), this.reindexCoordinates(e), i;
|
|
1896
1896
|
}
|
|
1897
1897
|
deleteRow(e, t) {
|
|
1898
|
-
let n = e.querySelectorAll(`[${
|
|
1898
|
+
let n = e.querySelectorAll(`[${N}]`);
|
|
1899
1899
|
t < n.length && n[t].remove(), this.reindexCoordinates(e);
|
|
1900
1900
|
}
|
|
1901
1901
|
addColumn(e, t, n, r) {
|
|
@@ -1933,8 +1933,8 @@ var Ut = "outline-hidden py-[7px] mt-[2px] mb-px", Wt = "outline-hidden pl-0.5 l
|
|
|
1933
1933
|
let i = r.querySelectorAll("col");
|
|
1934
1934
|
t === void 0 || t >= i.length ? r.appendChild(e) : r.insertBefore(e, i[t]);
|
|
1935
1935
|
}
|
|
1936
|
-
e.querySelectorAll(`[${
|
|
1937
|
-
let n = e.querySelectorAll(`[${
|
|
1936
|
+
e.querySelectorAll(`[${N}]`).forEach((e) => {
|
|
1937
|
+
let n = e.querySelectorAll(`[${P}]`), r = t === void 0 || t >= n.length, i = this.createCell();
|
|
1938
1938
|
r ? e.appendChild(i) : e.insertBefore(i, n[t]);
|
|
1939
1939
|
});
|
|
1940
1940
|
}
|
|
@@ -1944,53 +1944,53 @@ var Ut = "outline-hidden py-[7px] mt-[2px] mb-px", Wt = "outline-hidden pl-0.5 l
|
|
|
1944
1944
|
let e = n.querySelectorAll("col");
|
|
1945
1945
|
t < e.length && e[t].remove();
|
|
1946
1946
|
}
|
|
1947
|
-
e.querySelectorAll(`[${
|
|
1948
|
-
let n = e.querySelectorAll(`[${
|
|
1947
|
+
e.querySelectorAll(`[${N}]`).forEach((e) => {
|
|
1948
|
+
let n = e.querySelectorAll(`[${P}]`);
|
|
1949
1949
|
t >= n.length || n[t].remove();
|
|
1950
1950
|
}), this.reindexCoordinates(e);
|
|
1951
1951
|
}
|
|
1952
1952
|
moveRow(e, t, n) {
|
|
1953
1953
|
var r;
|
|
1954
1954
|
if (t === n) return;
|
|
1955
|
-
let i = (r = e.querySelector("tbody")) == null ? e : r, a = Array.from(i.querySelectorAll(`[${
|
|
1955
|
+
let i = (r = e.querySelector("tbody")) == null ? e : r, a = Array.from(i.querySelectorAll(`[${N}]`));
|
|
1956
1956
|
if (t >= a.length || n >= a.length) return;
|
|
1957
1957
|
let o = a[t];
|
|
1958
1958
|
o.remove();
|
|
1959
|
-
let s = Array.from(i.querySelectorAll(`[${
|
|
1959
|
+
let s = Array.from(i.querySelectorAll(`[${N}]`));
|
|
1960
1960
|
n >= s.length ? i.appendChild(o) : i.insertBefore(o, s[n]), this.reindexCoordinates(e);
|
|
1961
1961
|
}
|
|
1962
1962
|
moveColumn(e, t, n) {
|
|
1963
|
-
t !== n && (this.reorderColElement(e, t, n), e.querySelectorAll(`[${
|
|
1964
|
-
let r = Array.from(e.querySelectorAll(`[${
|
|
1963
|
+
t !== n && (this.reorderColElement(e, t, n), e.querySelectorAll(`[${N}]`).forEach((e) => {
|
|
1964
|
+
let r = Array.from(e.querySelectorAll(`[${P}]`));
|
|
1965
1965
|
if (t >= r.length || n >= r.length) return;
|
|
1966
1966
|
let i = r[t];
|
|
1967
1967
|
i.remove();
|
|
1968
|
-
let a = Array.from(e.querySelectorAll(`[${
|
|
1968
|
+
let a = Array.from(e.querySelectorAll(`[${P}]`));
|
|
1969
1969
|
n >= a.length ? e.appendChild(i) : e.insertBefore(i, a[n]);
|
|
1970
1970
|
}), this.reindexCoordinates(e));
|
|
1971
1971
|
}
|
|
1972
1972
|
reindexCoordinates(e) {
|
|
1973
|
-
e.querySelectorAll(`[${
|
|
1974
|
-
e.querySelectorAll(`[${
|
|
1975
|
-
e.setAttribute(vr, String(t)), e.setAttribute(
|
|
1973
|
+
e.querySelectorAll(`[${N}]`).forEach((e, t) => {
|
|
1974
|
+
e.querySelectorAll(`[${P}]`).forEach((e, n) => {
|
|
1975
|
+
e.setAttribute(vr, String(t)), e.setAttribute(F, String(n));
|
|
1976
1976
|
});
|
|
1977
1977
|
});
|
|
1978
1978
|
}
|
|
1979
1979
|
getRowCount(e) {
|
|
1980
|
-
return e.querySelectorAll(`[${
|
|
1980
|
+
return e.querySelectorAll(`[${N}]`).length;
|
|
1981
1981
|
}
|
|
1982
1982
|
getColumnCount(e) {
|
|
1983
1983
|
let t = e.querySelector("colgroup");
|
|
1984
1984
|
if (t) return t.querySelectorAll("col").length;
|
|
1985
|
-
let n = e.querySelector(`[${
|
|
1986
|
-
return n ? n.querySelectorAll(`[${
|
|
1985
|
+
let n = e.querySelector(`[${N}]`);
|
|
1986
|
+
return n ? n.querySelectorAll(`[${P}]`).length : 0;
|
|
1987
1987
|
}
|
|
1988
1988
|
getCell(e, t, n) {
|
|
1989
|
-
let r = e.querySelector(`[${vr}="${t}"][${
|
|
1989
|
+
let r = e.querySelector(`[${vr}="${t}"][${F}="${n}"]`);
|
|
1990
1990
|
if (r) return r;
|
|
1991
|
-
let i = e.querySelectorAll(`[${
|
|
1991
|
+
let i = e.querySelectorAll(`[${N}]`);
|
|
1992
1992
|
if (t >= i.length) return null;
|
|
1993
|
-
let a = i[t].querySelectorAll(`[${
|
|
1993
|
+
let a = i[t].querySelectorAll(`[${P}]`);
|
|
1994
1994
|
return n >= a.length ? null : a[n];
|
|
1995
1995
|
}
|
|
1996
1996
|
getColWidths(e) {
|
|
@@ -2035,17 +2035,17 @@ var Ut = "outline-hidden py-[7px] mt-[2px] mb-px", Wt = "outline-hidden pl-0.5 l
|
|
|
2035
2035
|
}
|
|
2036
2036
|
createRow(e, t) {
|
|
2037
2037
|
let n = document.createElement("tr");
|
|
2038
|
-
return n.setAttribute(
|
|
2038
|
+
return n.setAttribute(N, ""), Array.from({ length: e }).forEach((e, r) => {
|
|
2039
2039
|
n.appendChild(this.createCell(t, t === void 0 ? void 0 : r));
|
|
2040
2040
|
}), n;
|
|
2041
2041
|
}
|
|
2042
|
-
createCell(e,
|
|
2043
|
-
let
|
|
2044
|
-
|
|
2045
|
-
let
|
|
2046
|
-
return
|
|
2042
|
+
createCell(e, t) {
|
|
2043
|
+
let n = document.createElement("td");
|
|
2044
|
+
n.className = A(br), n.style.borderRight = yr, n.style.borderBottom = yr, n.style.overflow = "hidden", n.style.overflowWrap = "break-word", n.style.height = "0", n.setAttribute(P, ""), e !== void 0 && t !== void 0 && (n.setAttribute(vr, String(e)), n.setAttribute(F, String(t)));
|
|
2045
|
+
let r = document.createElement("div");
|
|
2046
|
+
return r.setAttribute(L, ""), r.setAttribute(D.nestedBlocks, ""), r.style.display = "flex", r.style.flexDirection = "column", r.style.minHeight = "100%", n.appendChild(r), n;
|
|
2047
2047
|
}
|
|
2048
|
-
},
|
|
2048
|
+
}, I = (e) => typeof e == "object" && !!e && "blocks" in e, L = "data-blok-table-cell-blocks", Cr = class {
|
|
2049
2049
|
constructor(e) {
|
|
2050
2050
|
var t;
|
|
2051
2051
|
this._activeCellWithBlocks = null, this.cellsPendingCheck = /* @__PURE__ */ new Set(), this.pendingCheckScheduled = !1, this.removedBlockCells = /* @__PURE__ */ new Map(), this.deferredEvents = [], this.isExitingTable = !1, this.handleBlockMutation = (e) => {
|
|
@@ -2071,9 +2071,9 @@ var Ut = "outline-hidden py-[7px] mt-[2px] mb-px", Wt = "outline-hidden pl-0.5 l
|
|
|
2071
2071
|
this.claimBlockForCell(i.cell, n.target.id), this.syncBlockToModel(i.cell, n.target.id), this.cellsPendingCheck.delete(i.cell);
|
|
2072
2072
|
return;
|
|
2073
2073
|
}
|
|
2074
|
-
let a = n.target.holder, o = a.closest(`[${
|
|
2074
|
+
let a = n.target.holder, o = a.closest(`[${L}]`);
|
|
2075
2075
|
o && this.stripPlaceholders(o);
|
|
2076
|
-
let s = o && !this.model.findCellForBlock(n.target.id) ? o.closest(`[${
|
|
2076
|
+
let s = o && !this.model.findCellForBlock(n.target.id) ? o.closest(`[${P}]`) : null;
|
|
2077
2077
|
if (s && this.syncBlockToModel(s, n.target.id), o) return;
|
|
2078
2078
|
if (!this.gridElement.contains(a)) {
|
|
2079
2079
|
let e = this.api.blocks.getBlockIndex(this.tableBlockId), t = e === void 0 ? null : this.api.blocks.getBlockByIndex(e);
|
|
@@ -2089,11 +2089,11 @@ var Ut = "outline-hidden py-[7px] mt-[2px] mb-px", Wt = "outline-hidden pl-0.5 l
|
|
|
2089
2089
|
}, this.handleCellBlankSpaceClick = (e) => {
|
|
2090
2090
|
let t = e.target;
|
|
2091
2091
|
if (!t) return;
|
|
2092
|
-
let n = t.hasAttribute(
|
|
2092
|
+
let n = t.hasAttribute(P), r = t.hasAttribute(L);
|
|
2093
2093
|
if (!n && !r) return;
|
|
2094
|
-
let i = n ? t : t.closest(`[${
|
|
2094
|
+
let i = n ? t : t.closest(`[${P}]`);
|
|
2095
2095
|
if (!i) return;
|
|
2096
|
-
let a = n ? i.querySelector(`[${
|
|
2096
|
+
let a = n ? i.querySelector(`[${L}]`) : t;
|
|
2097
2097
|
if (!a) return;
|
|
2098
2098
|
let o = a.querySelectorAll("[data-blok-id]"), s = o[o.length - 1];
|
|
2099
2099
|
if (!s) return;
|
|
@@ -2191,7 +2191,7 @@ var Ut = "outline-hidden py-[7px] mt-[2px] mb-px", Wt = "outline-hidden pl-0.5 l
|
|
|
2191
2191
|
this.clearActiveCellWithBlocks();
|
|
2192
2192
|
let r = this.getCell(e.row, e.col);
|
|
2193
2193
|
if (!r) return;
|
|
2194
|
-
let i = r.querySelector(`[${
|
|
2194
|
+
let i = r.querySelector(`[${L}]`);
|
|
2195
2195
|
if (!i) return;
|
|
2196
2196
|
let a = i.querySelectorAll("[contenteditable=\"true\"]");
|
|
2197
2197
|
a.length !== 0 && ((t ? a[a.length - 1] : a[0]).focus(), (n = this.onNavigateToCell) == null || n.call(this, e));
|
|
@@ -2212,26 +2212,26 @@ var Ut = "outline-hidden py-[7px] mt-[2px] mb-px", Wt = "outline-hidden pl-0.5 l
|
|
|
2212
2212
|
return r ? (n = r.querySelector(`[data-blok-table-cell-col="${t}"]`)) == null ? null : n : null;
|
|
2213
2213
|
}
|
|
2214
2214
|
initializeCells(e) {
|
|
2215
|
-
let t = this.gridElement.querySelectorAll(`[${
|
|
2215
|
+
let t = this.gridElement.querySelectorAll(`[${N}]`), n = [];
|
|
2216
2216
|
return e.forEach((e, r) => {
|
|
2217
2217
|
let i = t[r];
|
|
2218
2218
|
if (!i) return;
|
|
2219
2219
|
let a = [];
|
|
2220
2220
|
e.forEach((e, t) => {
|
|
2221
|
-
let n = i.querySelector(`[${
|
|
2221
|
+
let n = i.querySelector(`[${F}="${t}"]`);
|
|
2222
2222
|
if (!n) return;
|
|
2223
|
-
let r = n.querySelector(`[${
|
|
2223
|
+
let r = n.querySelector(`[${L}]`);
|
|
2224
2224
|
if (!r) return;
|
|
2225
|
-
let o =
|
|
2225
|
+
let o = I(e) && e.blocks.length > 0 ? [...e.blocks] : null, { mountedIds: s, replacements: c } = o ? this.mountBlocksInCell(r, o) : {
|
|
2226
2226
|
mountedIds: [],
|
|
2227
2227
|
replacements: /* @__PURE__ */ new Map()
|
|
2228
2228
|
}, l = {};
|
|
2229
|
-
if (
|
|
2229
|
+
if (I(e) && (e.color !== void 0 && (l.color = e.color), e.textColor !== void 0 && (l.textColor = e.textColor)), s.length > 0) {
|
|
2230
2230
|
let e = o == null ? s : o, t = c.size > 0 ? e.map((e) => {
|
|
2231
2231
|
var t;
|
|
2232
2232
|
return (t = c.get(e)) == null ? e : t;
|
|
2233
2233
|
}) : e;
|
|
2234
|
-
a.push(
|
|
2234
|
+
a.push(k({ blocks: t }, l));
|
|
2235
2235
|
} else {
|
|
2236
2236
|
var u;
|
|
2237
2237
|
let t = typeof e == "string" ? e : (u = e.text) == null ? "" : u, n = t.split(/<br\s*\/?>/i).map((e) => e.trim()).filter(Boolean), i = n.length > 0 ? n : [t], s = [];
|
|
@@ -2239,7 +2239,7 @@ var Ut = "outline-hidden py-[7px] mt-[2px] mb-px", Wt = "outline-hidden pl-0.5 l
|
|
|
2239
2239
|
let t = this.api.blocks.insert("paragraph", { text: e }, {}, this.api.blocks.getBlocksCount(), !1);
|
|
2240
2240
|
r.appendChild(t.holder), this.api.blocks.setBlockParent(t.id, this.tableBlockId), s.push(t.id);
|
|
2241
2241
|
}
|
|
2242
|
-
a.push(
|
|
2242
|
+
a.push(k({ blocks: o === null ? s : [...o, ...s] }, l));
|
|
2243
2243
|
}
|
|
2244
2244
|
this.stripPlaceholders(r);
|
|
2245
2245
|
}), n.push(a);
|
|
@@ -2252,48 +2252,48 @@ var Ut = "outline-hidden py-[7px] mt-[2px] mb-px", Wt = "outline-hidden pl-0.5 l
|
|
|
2252
2252
|
e.removeAttribute("data-placeholder");
|
|
2253
2253
|
});
|
|
2254
2254
|
}
|
|
2255
|
-
mountBlocksInCell(e,
|
|
2256
|
-
let
|
|
2257
|
-
for (let
|
|
2258
|
-
let
|
|
2259
|
-
if (
|
|
2260
|
-
let
|
|
2261
|
-
if (
|
|
2262
|
-
if (
|
|
2263
|
-
let t = this.api.blocks.insert(
|
|
2264
|
-
e.appendChild(t.holder), this.api.blocks.setBlockParent(t.id, this.tableBlockId),
|
|
2255
|
+
mountBlocksInCell(e, t) {
|
|
2256
|
+
let n = [], r = /* @__PURE__ */ new Map();
|
|
2257
|
+
for (let i of t) {
|
|
2258
|
+
let t = this.api.blocks.getBlockIndex(i);
|
|
2259
|
+
if (t === void 0) continue;
|
|
2260
|
+
let a = this.api.blocks.getBlockByIndex(t);
|
|
2261
|
+
if (a) {
|
|
2262
|
+
if (a.holder.closest(`[${D.nestedBlocks}]`)) {
|
|
2263
|
+
let t = this.api.blocks.insert(a.name, a.preservedData, {}, this.api.blocks.getBlocksCount(), !1);
|
|
2264
|
+
e.appendChild(t.holder), this.api.blocks.setBlockParent(t.id, this.tableBlockId), n.push(t.id), r.set(i, t.id);
|
|
2265
2265
|
continue;
|
|
2266
2266
|
}
|
|
2267
|
-
e.appendChild(
|
|
2267
|
+
e.appendChild(a.holder), this.api.blocks.setBlockParent(i, this.tableBlockId), n.push(i);
|
|
2268
2268
|
}
|
|
2269
2269
|
}
|
|
2270
2270
|
return {
|
|
2271
|
-
mountedIds:
|
|
2272
|
-
replacements:
|
|
2271
|
+
mountedIds: n,
|
|
2272
|
+
replacements: r
|
|
2273
2273
|
};
|
|
2274
2274
|
}
|
|
2275
|
-
claimBlockForCell(e,
|
|
2276
|
-
var
|
|
2277
|
-
let
|
|
2278
|
-
if (!
|
|
2279
|
-
let
|
|
2280
|
-
if (
|
|
2281
|
-
let
|
|
2282
|
-
if (!
|
|
2283
|
-
let
|
|
2284
|
-
|
|
2275
|
+
claimBlockForCell(e, t) {
|
|
2276
|
+
var n, r;
|
|
2277
|
+
let i = e.querySelector(`[${L}]`);
|
|
2278
|
+
if (!i) return;
|
|
2279
|
+
let a = this.api.blocks.getBlockIndex(t);
|
|
2280
|
+
if (a === void 0) return;
|
|
2281
|
+
let o = this.api.blocks.getBlockByIndex(a);
|
|
2282
|
+
if (!o || o.holder.contains(i) || o.holder.closest(`[${D.nestedBlocks}]`)) return;
|
|
2283
|
+
let s = this.api.blocks.getBlocksCount(), c = (n = (r = Array.from({ length: s - a - 1 }, (e, t) => this.api.blocks.getBlockByIndex(a + 1 + t)).find((e) => (e == null ? void 0 : e.holder.parentElement) === i)) == null ? void 0 : r.holder) == null ? null : n;
|
|
2284
|
+
i.insertBefore(o.holder, c), this.api.blocks.setBlockParent(t, this.tableBlockId), this.stripPlaceholders(i);
|
|
2285
2285
|
}
|
|
2286
2286
|
findCellForNewBlock(e) {
|
|
2287
2287
|
return this.findCellForAdjacentBlock(e - 1) || this.findCellForAdjacentBlock(e + 1);
|
|
2288
2288
|
}
|
|
2289
2289
|
findCellForAdjacentBlock(e) {
|
|
2290
2290
|
if (e < 0 || e >= this.api.blocks.getBlocksCount()) return null;
|
|
2291
|
-
let t = this.api.blocks.getBlockByIndex(e), n = t == null ? void 0 : t.holder.closest(`[${
|
|
2291
|
+
let t = this.api.blocks.getBlockByIndex(e), n = t == null ? void 0 : t.holder.closest(`[${P}]`);
|
|
2292
2292
|
return n && this.gridElement.contains(n) ? n : null;
|
|
2293
2293
|
}
|
|
2294
2294
|
ensureCellHasBlock(e) {
|
|
2295
2295
|
var t, n;
|
|
2296
|
-
let r = e.querySelector(`[${
|
|
2296
|
+
let r = e.querySelector(`[${L}]`);
|
|
2297
2297
|
r && r.querySelector("[data-blok-id]") === null && ((t = (n = this.api.blocks).transactWithoutCapture) == null || t.call(n, () => {
|
|
2298
2298
|
let t = this.api.blocks.insert("paragraph", { text: "" }, {}, this.api.blocks.getBlocksCount(), !0);
|
|
2299
2299
|
r.appendChild(t.holder), this.api.blocks.setBlockParent(t.id, this.tableBlockId), this.syncBlockToModel(e, t.id), this.stripPlaceholders(r);
|
|
@@ -2319,11 +2319,11 @@ var Ut = "outline-hidden py-[7px] mt-[2px] mb-px", Wt = "outline-hidden pl-0.5 l
|
|
|
2319
2319
|
n && this.model.addBlockToCell(n.row, n.col, t);
|
|
2320
2320
|
}
|
|
2321
2321
|
getCellPosition(e) {
|
|
2322
|
-
let t = e.closest(`[${
|
|
2322
|
+
let t = e.closest(`[${N}]`);
|
|
2323
2323
|
if (!t) return null;
|
|
2324
|
-
let n = Array.from(this.gridElement.querySelectorAll(`[${
|
|
2324
|
+
let n = Array.from(this.gridElement.querySelectorAll(`[${N}]`)).indexOf(t);
|
|
2325
2325
|
if (n < 0) return null;
|
|
2326
|
-
let r = Array.from(t.querySelectorAll(`[${
|
|
2326
|
+
let r = Array.from(t.querySelectorAll(`[${P}]`)).indexOf(e);
|
|
2327
2327
|
return r < 0 ? null : {
|
|
2328
2328
|
row: n,
|
|
2329
2329
|
col: r
|
|
@@ -2331,7 +2331,7 @@ var Ut = "outline-hidden py-[7px] mt-[2px] mb-px", Wt = "outline-hidden pl-0.5 l
|
|
|
2331
2331
|
}
|
|
2332
2332
|
recordRemovedBlockCell(e) {
|
|
2333
2333
|
if (e.index === void 0) return;
|
|
2334
|
-
let t = e.target.holder.closest(`[${
|
|
2334
|
+
let t = e.target.holder.closest(`[${P}]`);
|
|
2335
2335
|
t && this.gridElement.contains(t) && this.removedBlockCells.set(e.target.id, {
|
|
2336
2336
|
cell: t,
|
|
2337
2337
|
index: e.index
|
|
@@ -2379,7 +2379,7 @@ var Ut = "outline-hidden py-[7px] mt-[2px] mb-px", Wt = "outline-hidden pl-0.5 l
|
|
|
2379
2379
|
getBlockIdsFromCells(e) {
|
|
2380
2380
|
let t = [];
|
|
2381
2381
|
return Array.from(e).forEach((e) => {
|
|
2382
|
-
let n = e.querySelector(`[${
|
|
2382
|
+
let n = e.querySelector(`[${L}]`);
|
|
2383
2383
|
n && n.querySelectorAll("[data-blok-id]").forEach((e) => {
|
|
2384
2384
|
let n = e.getAttribute("data-blok-id");
|
|
2385
2385
|
n && t.push(n);
|
|
@@ -2393,7 +2393,7 @@ var Ut = "outline-hidden py-[7px] mt-[2px] mb-px", Wt = "outline-hidden pl-0.5 l
|
|
|
2393
2393
|
});
|
|
2394
2394
|
}
|
|
2395
2395
|
deleteAllBlocks() {
|
|
2396
|
-
let e = this.gridElement.querySelectorAll(`[${
|
|
2396
|
+
let e = this.gridElement.querySelectorAll(`[${P}]`), t = this.getBlockIdsFromCells(e);
|
|
2397
2397
|
this.deleteBlocks(t);
|
|
2398
2398
|
}
|
|
2399
2399
|
destroy() {
|
|
@@ -2413,11 +2413,11 @@ var Ut = "outline-hidden py-[7px] mt-[2px] mb-px", Wt = "outline-hidden pl-0.5 l
|
|
|
2413
2413
|
function wr() {
|
|
2414
2414
|
var e, t;
|
|
2415
2415
|
let n = document.documentElement.getAttribute("data-blok-theme");
|
|
2416
|
-
return n === "dark" ?
|
|
2416
|
+
return n === "dark" ? f : n === "light" ? ge : typeof window < "u" && (e = (t = window).matchMedia) != null && e.call(t, "(prefers-color-scheme: dark)").matches ? f : ge;
|
|
2417
2417
|
}
|
|
2418
2418
|
function Tr(e, t) {
|
|
2419
2419
|
if (e === t) return !0;
|
|
2420
|
-
let n =
|
|
2420
|
+
let n = fe(e), r = fe(t);
|
|
2421
2421
|
return n === null || r === null ? !1 : n[0] === r[0] && n[1] === r[1] && n[2] === r[2];
|
|
2422
2422
|
}
|
|
2423
2423
|
var Er = "var(--blok-swatch-neutral-bg)";
|
|
@@ -2436,19 +2436,19 @@ function Dr(e) {
|
|
|
2436
2436
|
let c = (e) => {
|
|
2437
2437
|
let o = s[e], c = n[e], l = wr();
|
|
2438
2438
|
o.innerHTML = "";
|
|
2439
|
-
let u = a.activeColors[c.key], d = document.createElement("button"),
|
|
2440
|
-
d.setAttribute("data-blok-testid", `${r}-swatch-${c.key}-default`), d.className =
|
|
2439
|
+
let u = a.activeColors[c.key], d = document.createElement("button"), p = u === null;
|
|
2440
|
+
d.setAttribute("data-blok-testid", `${r}-swatch-${c.key}-default`), d.className = A("w-9 h-9 rounded-md cursor-pointer border-none outline-hidden", "flex items-center justify-center text-sm font-semibold", "transition-[box-shadow,transform] ring-inset hover:ring-2 hover:ring-swatch-ring-hover active:scale-90", p && "ring-2 ring-swatch-ring-hover"), d.textContent = c.presetField === "text" ? "A" : "", c.presetField === "text" && (d.style.color = "var(--blok-text-primary)"), d.style.backgroundColor = Er, d.addEventListener("click", () => {
|
|
2441
2441
|
i(null, c.key);
|
|
2442
2442
|
});
|
|
2443
|
-
let
|
|
2444
|
-
|
|
2443
|
+
let m = t.t("tools.colorPicker.defaultSwatchLabel").replace("{default}", t.t("tools.marker.default")).replace("{mode}", t.t(c.labelKey).toLowerCase());
|
|
2444
|
+
T(d, m.charAt(0).toUpperCase() + m.slice(1), { placement: "top" }), o.appendChild(d);
|
|
2445
2445
|
for (let e of l) {
|
|
2446
2446
|
let n = document.createElement("button"), a = c.presetField === "text" ? e.text : e.bg, s = u !== null && Tr(a, u);
|
|
2447
|
-
n.setAttribute("data-blok-testid", `${r}-swatch-${c.key}-${e.name}`), n.className =
|
|
2447
|
+
n.setAttribute("data-blok-testid", `${r}-swatch-${c.key}-${e.name}`), n.className = A("w-9 h-9 rounded-md cursor-pointer border-none outline-hidden", "flex items-center justify-center text-sm font-semibold", "transition-[box-shadow,transform] ring-inset hover:ring-2 hover:ring-swatch-ring-hover active:scale-90", s && "ring-2 ring-swatch-ring-hover"), n.textContent = c.presetField === "text" ? "A" : "", c.presetField === "text" ? (n.style.color = e.text, n.style.backgroundColor = Er) : (n.style.color = l === f ? e.text : "#37352f", n.style.backgroundColor = e.bg), n.addEventListener("click", () => {
|
|
2448
2448
|
i(a, c.key);
|
|
2449
2449
|
});
|
|
2450
2450
|
let d = t.t("tools.colorPicker.colorSwatchLabel").replace("{color}", t.t("tools.colorPicker.color." + e.name)).replace("{mode}", t.t(c.labelKey).toLowerCase());
|
|
2451
|
-
|
|
2451
|
+
T(n, d.charAt(0).toUpperCase() + d.slice(1), { placement: "top" }), o.appendChild(n);
|
|
2452
2452
|
}
|
|
2453
2453
|
}, l = () => {
|
|
2454
2454
|
n.forEach((e, t) => c(t));
|
|
@@ -2597,7 +2597,7 @@ var Or = (e) => {
|
|
|
2597
2597
|
t !== 0 && this.showProgrammaticSelection(e, 0, e, t - 1);
|
|
2598
2598
|
}
|
|
2599
2599
|
selectColumn(e) {
|
|
2600
|
-
let t = this.grid.querySelectorAll(`[${
|
|
2600
|
+
let t = this.grid.querySelectorAll(`[${N}]`).length;
|
|
2601
2601
|
t !== 0 && this.showProgrammaticSelection(0, e, t - 1, e);
|
|
2602
2602
|
}
|
|
2603
2603
|
clearActiveSelection() {
|
|
@@ -2710,7 +2710,7 @@ var Or = (e) => {
|
|
|
2710
2710
|
minCol: n,
|
|
2711
2711
|
maxCol: r
|
|
2712
2712
|
};
|
|
2713
|
-
let i = this.grid.querySelectorAll(`[${
|
|
2713
|
+
let i = this.grid.querySelectorAll(`[${N}]`);
|
|
2714
2714
|
this.selectedCells = this.collectCellsInRange(i, e, t, n, r), this.selectedCells.forEach((e) => {
|
|
2715
2715
|
e.setAttribute(Br, "");
|
|
2716
2716
|
});
|
|
@@ -2722,7 +2722,7 @@ var Or = (e) => {
|
|
|
2722
2722
|
repositionOverlay() {
|
|
2723
2723
|
let e = this.lastPaintedRange;
|
|
2724
2724
|
if (!e || !this.overlay) return;
|
|
2725
|
-
let t = this.grid.querySelectorAll(`[${
|
|
2725
|
+
let t = this.grid.querySelectorAll(`[${N}]`), n = this.findCellByCoordOrIndex(t, e.minRow, e.minCol), r = this.findCellByCoordOrIndex(t, e.maxRow, e.maxCol);
|
|
2726
2726
|
if (!n || !r) return;
|
|
2727
2727
|
let i = this.grid.getBoundingClientRect(), a = n.getBoundingClientRect(), o = r.getBoundingClientRect(), s = getComputedStyle(this.grid), c = parseFloat(s.borderTopWidth) || 0, l = parseFloat(s.borderLeftWidth) || 0, u = o.right - a.left + 1, d = o.bottom - a.top + 1, f = a.top - i.top - c - 1, p = a.left - i.left - l - 1;
|
|
2728
2728
|
this.overlay.style.top = `${f}px`, this.overlay.style.left = `${p}px`, this.overlay.style.width = `${u}px`, this.overlay.style.height = `${d}px`, this.pill && (this.pill.style.left = `${p + u - 1}px`, this.pill.style.top = `${f + d / 2}px`);
|
|
@@ -2740,7 +2740,7 @@ var Or = (e) => {
|
|
|
2740
2740
|
}
|
|
2741
2741
|
createPill() {
|
|
2742
2742
|
let e = document.createElement("div");
|
|
2743
|
-
e.setAttribute(Hr, ""), e.setAttribute("contenteditable", "false"), e.className =
|
|
2743
|
+
e.setAttribute(Hr, ""), e.setAttribute("contenteditable", "false"), e.className = A(Kr), e.style.width = `${Gr}px`, e.style.height = `${Wr}px`, e.style.pointerEvents = "auto", e.style.transform = "translate(-50%, -50%)", e.style.outline = "2px solid var(--blok-table-grip-outline, transparent)";
|
|
2744
2744
|
let t = Lr("vertical");
|
|
2745
2745
|
return t.classList.remove("text-gray-400"), t.classList.add("text-white"), e.appendChild(t), e.addEventListener("mouseenter", () => {
|
|
2746
2746
|
this.pillPopover === null && this.expandPill();
|
|
@@ -2753,7 +2753,7 @@ var Or = (e) => {
|
|
|
2753
2753
|
openPillPopover() {
|
|
2754
2754
|
if (this.destroyPillPopover(), !this.pill) return;
|
|
2755
2755
|
this.expandPill();
|
|
2756
|
-
let e =
|
|
2756
|
+
let e = st === "Meta" ? "⌘C" : "Ctrl+C", t = [];
|
|
2757
2757
|
if (this.onColorChange !== void 0) {
|
|
2758
2758
|
let { element: e } = Or({
|
|
2759
2759
|
i18n: this.i18n,
|
|
@@ -2763,12 +2763,12 @@ var Or = (e) => {
|
|
|
2763
2763
|
}
|
|
2764
2764
|
});
|
|
2765
2765
|
t.push({
|
|
2766
|
-
icon:
|
|
2766
|
+
icon: Qe,
|
|
2767
2767
|
title: this.i18n.t("tools.table.cellColor"),
|
|
2768
2768
|
name: "cellColor",
|
|
2769
2769
|
children: {
|
|
2770
2770
|
items: [{
|
|
2771
|
-
type:
|
|
2771
|
+
type: w.Html,
|
|
2772
2772
|
element: e
|
|
2773
2773
|
}],
|
|
2774
2774
|
isFlippable: !1
|
|
@@ -2786,12 +2786,12 @@ var Or = (e) => {
|
|
|
2786
2786
|
}
|
|
2787
2787
|
});
|
|
2788
2788
|
n.push({
|
|
2789
|
-
icon:
|
|
2789
|
+
icon: Se,
|
|
2790
2790
|
title: this.i18n.t("tools.table.placement"),
|
|
2791
2791
|
name: "cellPlacement",
|
|
2792
2792
|
children: {
|
|
2793
2793
|
items: [{
|
|
2794
|
-
type:
|
|
2794
|
+
type: w.Html,
|
|
2795
2795
|
element: t
|
|
2796
2796
|
}],
|
|
2797
2797
|
isFlippable: !1
|
|
@@ -2803,7 +2803,7 @@ var Or = (e) => {
|
|
|
2803
2803
|
var i;
|
|
2804
2804
|
let e = this.lastPaintedRange;
|
|
2805
2805
|
(e.minRow !== e.maxRow || e.minCol !== e.maxCol) && (i = this.canMergeCells) != null && i.call(this, e) && r.push({
|
|
2806
|
-
icon:
|
|
2806
|
+
icon: Fe,
|
|
2807
2807
|
title: this.i18n.t("tools.table.mergeCells"),
|
|
2808
2808
|
closeOnActivate: !0,
|
|
2809
2809
|
onActivate: () => {
|
|
@@ -2816,7 +2816,7 @@ var Or = (e) => {
|
|
|
2816
2816
|
var a;
|
|
2817
2817
|
let e = this.lastPaintedRange;
|
|
2818
2818
|
e.minRow === e.maxRow && e.minCol === e.maxCol && (a = this.isMergedCell) != null && a.call(this, e.minRow, e.minCol) && r.push({
|
|
2819
|
-
icon:
|
|
2819
|
+
icon: ce,
|
|
2820
2820
|
title: this.i18n.t("tools.table.splitCell"),
|
|
2821
2821
|
closeOnActivate: !0,
|
|
2822
2822
|
onActivate: () => {
|
|
@@ -2825,13 +2825,13 @@ var Or = (e) => {
|
|
|
2825
2825
|
}
|
|
2826
2826
|
});
|
|
2827
2827
|
}
|
|
2828
|
-
this.pillPopover = new
|
|
2828
|
+
this.pillPopover = new Me({
|
|
2829
2829
|
items: [
|
|
2830
2830
|
...t,
|
|
2831
2831
|
...n,
|
|
2832
2832
|
...r,
|
|
2833
2833
|
{
|
|
2834
|
-
icon:
|
|
2834
|
+
icon: ne,
|
|
2835
2835
|
title: this.i18n.t("tools.table.copySelection"),
|
|
2836
2836
|
secondaryLabel: e,
|
|
2837
2837
|
closeOnActivate: !0,
|
|
@@ -2841,7 +2841,7 @@ var Or = (e) => {
|
|
|
2841
2841
|
}
|
|
2842
2842
|
},
|
|
2843
2843
|
{
|
|
2844
|
-
icon:
|
|
2844
|
+
icon: ae,
|
|
2845
2845
|
title: this.i18n.t("tools.table.clearSelection"),
|
|
2846
2846
|
secondaryLabel: "Del",
|
|
2847
2847
|
closeOnActivate: !0,
|
|
@@ -2853,7 +2853,7 @@ var Or = (e) => {
|
|
|
2853
2853
|
],
|
|
2854
2854
|
trigger: this.pill,
|
|
2855
2855
|
flippable: !0
|
|
2856
|
-
}), this.pillPopover.on(
|
|
2856
|
+
}), this.pillPopover.on(lt.Closed, () => {
|
|
2857
2857
|
this.pillPopover !== null && (this.destroyPillPopover(), this.collapsePill());
|
|
2858
2858
|
}), this.pillPopover.show();
|
|
2859
2859
|
}
|
|
@@ -2876,13 +2876,13 @@ var Or = (e) => {
|
|
|
2876
2876
|
}
|
|
2877
2877
|
}
|
|
2878
2878
|
resolveCellCoord(e) {
|
|
2879
|
-
let t = e.closest(`[${
|
|
2879
|
+
let t = e.closest(`[${P}]`);
|
|
2880
2880
|
if (!t) return null;
|
|
2881
|
-
let n = t.closest(`[${
|
|
2881
|
+
let n = t.closest(`[${N}]`);
|
|
2882
2882
|
if (!n || !this.grid.contains(n)) return null;
|
|
2883
|
-
let r = Array.from(this.grid.querySelectorAll(`[${
|
|
2883
|
+
let r = Array.from(this.grid.querySelectorAll(`[${N}]`)).indexOf(n);
|
|
2884
2884
|
if (r < 0) return null;
|
|
2885
|
-
let i = Array.from(n.querySelectorAll(`[${
|
|
2885
|
+
let i = Array.from(n.querySelectorAll(`[${P}]`)).indexOf(t);
|
|
2886
2886
|
return i < 0 ? null : {
|
|
2887
2887
|
row: r,
|
|
2888
2888
|
col: i
|
|
@@ -2891,7 +2891,7 @@ var Or = (e) => {
|
|
|
2891
2891
|
clampExtentToEdge(e) {
|
|
2892
2892
|
var t, n, r, i;
|
|
2893
2893
|
if (!this.anchorCell || !this.isSelecting) return;
|
|
2894
|
-
let a = this.grid.getBoundingClientRect(), o = this.grid.querySelectorAll(`[${
|
|
2894
|
+
let a = this.grid.getBoundingClientRect(), o = this.grid.querySelectorAll(`[${N}]`).length, s = this.getLogicalColumnCount();
|
|
2895
2895
|
if (o === 0 || s === 0) return;
|
|
2896
2896
|
let c = {
|
|
2897
2897
|
row: this.clampAxis(e.clientY, a.top, a.bottom, o, (t = (n = this.extentCell) == null ? void 0 : n.row) == null ? this.anchorCell.row : t),
|
|
@@ -2901,12 +2901,12 @@ var Or = (e) => {
|
|
|
2901
2901
|
}
|
|
2902
2902
|
collectCellsInRange(e, t, n, r, i) {
|
|
2903
2903
|
if (this.grid.querySelector("[data-blok-table-cell-row]") === null) return Array.from(e).slice(t, n + 1).flatMap((e) => {
|
|
2904
|
-
let t = e.querySelectorAll(`[${
|
|
2904
|
+
let t = e.querySelectorAll(`[${P}]`);
|
|
2905
2905
|
return Array.from(t).slice(r, i + 1).filter((e) => e instanceof HTMLElement);
|
|
2906
2906
|
});
|
|
2907
|
-
let a = this.grid.querySelectorAll(`[${
|
|
2907
|
+
let a = this.grid.querySelectorAll(`[${P}]`);
|
|
2908
2908
|
return Array.from(a).filter((e) => {
|
|
2909
|
-
let a = e.getAttribute(vr), o = e.getAttribute(
|
|
2909
|
+
let a = e.getAttribute(vr), o = e.getAttribute(F);
|
|
2910
2910
|
if (a === null || o === null) return !1;
|
|
2911
2911
|
let s = Number(a), c = Number(o), l = e, u = s + (l.rowSpan || 1) - 1, d = c + (l.colSpan || 1) - 1;
|
|
2912
2912
|
return s <= n && u >= t && c <= i && d >= r;
|
|
@@ -2914,28 +2914,28 @@ var Or = (e) => {
|
|
|
2914
2914
|
}
|
|
2915
2915
|
findCellByCoordOrIndex(e, t, n) {
|
|
2916
2916
|
var r;
|
|
2917
|
-
return this.grid.querySelector(`[${vr}="${t}"][${
|
|
2917
|
+
return this.grid.querySelector(`[${vr}="${t}"][${F}="${n}"]`) || ((r = e[t]) == null ? void 0 : r.querySelectorAll(`[${P}]`)[n]);
|
|
2918
2918
|
}
|
|
2919
2919
|
getLogicalColumnCount() {
|
|
2920
2920
|
var e, t;
|
|
2921
2921
|
let n = (e = this.grid.querySelector("colgroup")) == null ? void 0 : e.querySelectorAll("col").length;
|
|
2922
2922
|
if (n !== void 0 && n > 0) return n;
|
|
2923
|
-
let r = this.grid.querySelector(`[${
|
|
2923
|
+
let r = this.grid.querySelector(`[${N}]`);
|
|
2924
2924
|
return (t = r == null ? void 0 : r.querySelectorAll("[data-blok-table-cell]").length) == null ? 0 : t;
|
|
2925
2925
|
}
|
|
2926
2926
|
clampAxis(e, t, n, r, i) {
|
|
2927
2927
|
return e < t ? 0 : e > n ? r - 1 : i;
|
|
2928
2928
|
}
|
|
2929
|
-
},
|
|
2929
|
+
}, R = (e) => {
|
|
2930
2930
|
let t = e.querySelector("colgroup");
|
|
2931
2931
|
if (!t) return [];
|
|
2932
2932
|
let n = t.querySelectorAll("col"), r = n[0];
|
|
2933
2933
|
if (r && r.style.width.endsWith("%")) {
|
|
2934
|
-
let t = e.querySelector(`[${
|
|
2935
|
-
if (t) return Array.from(t.querySelectorAll(`[${
|
|
2934
|
+
let t = e.querySelector(`[${N}]`);
|
|
2935
|
+
if (t) return Array.from(t.querySelectorAll(`[${P}]`)).map((e) => Math.round(e.getBoundingClientRect().width));
|
|
2936
2936
|
}
|
|
2937
2937
|
return Array.from(n).map((e) => parseFloat(e.style.width) || 0);
|
|
2938
|
-
},
|
|
2938
|
+
}, z = (e, t) => {
|
|
2939
2939
|
let n = t.reduce((e, t) => e + t, 0), r = e;
|
|
2940
2940
|
r.style.width = `${n + 1}px`;
|
|
2941
2941
|
let i = e.querySelector("colgroup");
|
|
@@ -2945,24 +2945,24 @@ var Or = (e) => {
|
|
|
2945
2945
|
t < a.length && (a[t].style.width = `${e}px`);
|
|
2946
2946
|
});
|
|
2947
2947
|
}, Yr = (e, t) => {
|
|
2948
|
-
let n = Array.from(e.querySelectorAll(`[${
|
|
2948
|
+
let n = Array.from(e.querySelectorAll(`[${N}]`)), r = n.findIndex((e) => Array.from(e.querySelectorAll(`[${P}]`)).includes(t));
|
|
2949
2949
|
return r === -1 ? null : {
|
|
2950
2950
|
row: r,
|
|
2951
|
-
col: Array.from(n[r].querySelectorAll(`[${
|
|
2951
|
+
col: Array.from(n[r].querySelectorAll(`[${P}]`)).indexOf(t)
|
|
2952
2952
|
};
|
|
2953
2953
|
}, Xr = (e) => {
|
|
2954
2954
|
var t;
|
|
2955
|
-
let n = e.querySelector(`[${
|
|
2955
|
+
let n = e.querySelector(`[${L}]`);
|
|
2956
2956
|
return n ? ((t = n.textContent) == null ? "" : t).trim().length === 0 : !0;
|
|
2957
2957
|
}, Zr = (e, t) => {
|
|
2958
|
-
let n = e.querySelectorAll(`[${
|
|
2958
|
+
let n = e.querySelectorAll(`[${N}]`)[t];
|
|
2959
2959
|
if (!n) return !0;
|
|
2960
|
-
let r = n.querySelectorAll(`[${
|
|
2960
|
+
let r = n.querySelectorAll(`[${P}]`);
|
|
2961
2961
|
return Array.from(r).every((e) => Xr(e));
|
|
2962
2962
|
}, Qr = (e, t) => {
|
|
2963
|
-
let n = e.querySelectorAll(`[${
|
|
2963
|
+
let n = e.querySelectorAll(`[${N}]`);
|
|
2964
2964
|
return Array.from(n).every((e) => {
|
|
2965
|
-
let n = e.querySelector(`[${
|
|
2965
|
+
let n = e.querySelector(`[${F}="${t}"]`);
|
|
2966
2966
|
return !n || Xr(n);
|
|
2967
2967
|
});
|
|
2968
2968
|
}, $r = (e) => {
|
|
@@ -2984,60 +2984,60 @@ var Or = (e) => {
|
|
|
2984
2984
|
let n = [...e];
|
|
2985
2985
|
return n.splice(t, 1), n.length > 0 ? n : void 0;
|
|
2986
2986
|
}, ni = (e, t, n, r, i) => {
|
|
2987
|
-
let a = n == null ?
|
|
2987
|
+
let a = n == null ? R(e) : n, o = r === void 0 ? B(a) : Math.round(r / 2 * 100) / 100;
|
|
2988
2988
|
i.addColumn(e, t, a, o);
|
|
2989
2989
|
let s = [...a];
|
|
2990
2990
|
return s.splice(t, 0, o), s;
|
|
2991
|
-
},
|
|
2991
|
+
}, B = (e) => Math.round(e.reduce((e, t) => e + t, 0) / e.length / 2 * 100) / 100, ri = (e) => e.length === 0 ? 0 : Math.round(e.reduce((e, t) => e + t, 0) / e.length * 100) / 100, ii = (e, t, n) => {
|
|
2992
2992
|
var r;
|
|
2993
2993
|
if (!e) return [];
|
|
2994
|
-
let i = e.querySelectorAll(`[${
|
|
2994
|
+
let i = e.querySelectorAll(`[${N}]`)[n];
|
|
2995
2995
|
return i ? (r = t == null ? void 0 : t.getBlockIdsFromCells(i.querySelectorAll("[data-blok-table-cell]"))) == null ? [] : r : [];
|
|
2996
2996
|
}, ai = (e, t, n) => {
|
|
2997
2997
|
var r;
|
|
2998
2998
|
if (!e) return [];
|
|
2999
|
-
let i = e.querySelectorAll(`[${
|
|
2999
|
+
let i = e.querySelectorAll(`[${N}]`), a = [];
|
|
3000
3000
|
return i.forEach((e) => {
|
|
3001
|
-
let t = e.querySelector(`[${
|
|
3001
|
+
let t = e.querySelector(`[${F}="${n}"]`);
|
|
3002
3002
|
t && a.push(t);
|
|
3003
3003
|
}), (r = t == null ? void 0 : t.getBlockIdsFromCells(a)) == null ? [] : r;
|
|
3004
|
-
},
|
|
3005
|
-
e.querySelectorAll(`[${
|
|
3004
|
+
}, V = (e, t) => {
|
|
3005
|
+
e.querySelectorAll(`[${P}]`).forEach((e) => {
|
|
3006
3006
|
t == null || t.ensureCellHasBlock(e);
|
|
3007
3007
|
});
|
|
3008
|
-
}, oi = (e, n, r
|
|
3009
|
-
let
|
|
3010
|
-
|
|
3011
|
-
let
|
|
3012
|
-
|
|
3013
|
-
var
|
|
3014
|
-
let
|
|
3008
|
+
}, oi = (e, t, n, r) => {
|
|
3009
|
+
let i = e.querySelectorAll(`[${N}]`);
|
|
3010
|
+
t.forEach((e, t) => {
|
|
3011
|
+
let a = i[t];
|
|
3012
|
+
a && e.forEach((e, t) => {
|
|
3013
|
+
var i;
|
|
3014
|
+
let o = a.querySelector(`[${F}="${t}"]`);
|
|
3015
|
+
if (!o) return;
|
|
3016
|
+
let s = o.querySelector(`[${L}]`);
|
|
3015
3017
|
if (!s) return;
|
|
3016
|
-
let c = s.
|
|
3017
|
-
if (!c)
|
|
3018
|
-
|
|
3019
|
-
if (!(!P(e) && l)) {
|
|
3020
|
-
if (!P(e)) {
|
|
3018
|
+
let c = s.querySelectorAll("[data-blok-id]").length > 0;
|
|
3019
|
+
if (!(!I(e) && c)) {
|
|
3020
|
+
if (!I(e)) {
|
|
3021
3021
|
let t = document.createElement("div");
|
|
3022
|
-
t.className = "leading-[1.5]", t.innerHTML = e,
|
|
3022
|
+
t.className = "leading-[1.5]", t.innerHTML = e, s.replaceChildren(t);
|
|
3023
3023
|
return;
|
|
3024
3024
|
}
|
|
3025
|
-
(
|
|
3026
|
-
for (let
|
|
3027
|
-
let e =
|
|
3025
|
+
(c || ((i = s.textContent) == null ? "" : i).length > 0) && s.replaceChildren();
|
|
3026
|
+
for (let t of e.blocks) {
|
|
3027
|
+
let e = n.blocks.getBlockIndex(t);
|
|
3028
3028
|
if (e === void 0) continue;
|
|
3029
|
-
let
|
|
3030
|
-
if (
|
|
3031
|
-
if (
|
|
3032
|
-
|
|
3029
|
+
let i = n.blocks.getBlockByIndex(e);
|
|
3030
|
+
if (i && i.parentId === r) {
|
|
3031
|
+
if (i.holder.closest(`[${D.nestedBlocks}]`)) {
|
|
3032
|
+
s.appendChild(i.holder.cloneNode(!0));
|
|
3033
3033
|
continue;
|
|
3034
3034
|
}
|
|
3035
|
-
|
|
3035
|
+
s.appendChild(i.holder);
|
|
3036
3036
|
}
|
|
3037
3037
|
}
|
|
3038
|
-
|
|
3038
|
+
s.querySelectorAll("[data-blok-placeholder-active]").forEach((e) => {
|
|
3039
3039
|
e.removeAttribute("data-blok-placeholder-active");
|
|
3040
|
-
}),
|
|
3040
|
+
}), s.querySelectorAll("[data-placeholder]").forEach((e) => {
|
|
3041
3041
|
e.removeAttribute("data-placeholder");
|
|
3042
3042
|
});
|
|
3043
3043
|
}
|
|
@@ -3065,7 +3065,7 @@ var Or = (e) => {
|
|
|
3065
3065
|
};
|
|
3066
3066
|
}, ci = (e, t) => {
|
|
3067
3067
|
let n = (n) => {
|
|
3068
|
-
let r = n.target.closest(`[${
|
|
3068
|
+
let r = n.target.closest(`[${P}]`);
|
|
3069
3069
|
if (!r) return;
|
|
3070
3070
|
let i = Yr(e, r);
|
|
3071
3071
|
i && (t == null || t.handleKeyDown(n, i));
|
|
@@ -3075,35 +3075,35 @@ var Or = (e) => {
|
|
|
3075
3075
|
};
|
|
3076
3076
|
}, li = ["overflow-x-auto", "overflow-y-hidden"], ui = (e) => {
|
|
3077
3077
|
e == null || e.classList.add(...li);
|
|
3078
|
-
},
|
|
3078
|
+
}, H = (e, t) => {
|
|
3079
3079
|
if (!e) return;
|
|
3080
|
-
let n = e.querySelectorAll(`[${
|
|
3080
|
+
let n = e.querySelectorAll(`[${N}]`);
|
|
3081
3081
|
n.forEach((e) => {
|
|
3082
3082
|
e.removeAttribute("data-blok-table-heading");
|
|
3083
3083
|
}), t && n.length > 0 && n[0].setAttribute("data-blok-table-heading", "");
|
|
3084
3084
|
}, di = (e, t) => {
|
|
3085
|
-
let n = e.querySelectorAll(`[${
|
|
3085
|
+
let n = e.querySelectorAll(`[${N}]`);
|
|
3086
3086
|
t.forEach((e, t) => {
|
|
3087
3087
|
t >= n.length || e.forEach((e, r) => {
|
|
3088
|
-
let i = n[t].querySelector(`[${
|
|
3089
|
-
i && (
|
|
3088
|
+
let i = n[t].querySelector(`[${F}="${r}"]`);
|
|
3089
|
+
i && (I(e) && e.color ? i.style.backgroundColor = e.color : i.style.backgroundColor = "", I(e) && e.textColor ? i.style.color = e.textColor : i.style.color = "");
|
|
3090
3090
|
});
|
|
3091
3091
|
});
|
|
3092
3092
|
}, fi = (e, t) => {
|
|
3093
|
-
let n = e.querySelectorAll(`[${
|
|
3093
|
+
let n = e.querySelectorAll(`[${N}]`);
|
|
3094
3094
|
t.forEach((e, t) => {
|
|
3095
3095
|
t >= n.length || e.forEach((e, r) => {
|
|
3096
|
-
let i = n[t].querySelector(`[${
|
|
3096
|
+
let i = n[t].querySelector(`[${F}="${r}"]`);
|
|
3097
3097
|
if (!i) return;
|
|
3098
|
-
let a = i.querySelector(`[${
|
|
3099
|
-
a && (
|
|
3098
|
+
let a = i.querySelector(`[${L}]`);
|
|
3099
|
+
a && (I(e) && e.placement && e.placement !== "top-left" ? a.setAttribute("data-blok-cell-placement", e.placement) : a.removeAttribute("data-blok-cell-placement"));
|
|
3100
3100
|
});
|
|
3101
3101
|
});
|
|
3102
|
-
},
|
|
3103
|
-
e && (e.querySelectorAll(`[${
|
|
3102
|
+
}, U = (e, t) => {
|
|
3103
|
+
e && (e.querySelectorAll(`[${P}]`).forEach((e) => {
|
|
3104
3104
|
e.removeAttribute("data-blok-table-heading-col");
|
|
3105
|
-
}), t && e.querySelectorAll(`[${
|
|
3106
|
-
let t = e.querySelector(`[${
|
|
3105
|
+
}), t && e.querySelectorAll(`[${N}]`).forEach((e) => {
|
|
3106
|
+
let t = e.querySelector(`[${P}]`);
|
|
3107
3107
|
t && t.setAttribute("data-blok-table-heading-col", "");
|
|
3108
3108
|
}));
|
|
3109
3109
|
}, pi = (e) => !!(/^#[0-9a-f]{3,4}$/i.test(e) || /^#[0-9a-f]{6}([0-9a-f]{2})?$/i.test(e) || /^rgba?\(\s*[\d.]+\s*,\s*[\d.]+\s*,\s*[\d.]+\s*(,\s*[\d.]+\s*)?\)$/i.test(e) || /^hsla?\(\s*[\d.]+\s*,\s*[\d.]+%\s*,\s*[\d.]+%\s*(,\s*[\d.]+\s*)?\)$/i.test(e) || e === "transparent"), mi = class {
|
|
@@ -3633,7 +3633,7 @@ var Or = (e) => {
|
|
|
3633
3633
|
return !e || !Array.isArray(e) ? [] : e.map((e) => (e == null ? [] : e).map((e) => this.normalizeCell(e)));
|
|
3634
3634
|
}
|
|
3635
3635
|
normalizeCell(e) {
|
|
3636
|
-
if (
|
|
3636
|
+
if (I(e)) {
|
|
3637
3637
|
let t = { blocks: [...e.blocks] };
|
|
3638
3638
|
return e.color !== void 0 && pi(e.color) && (t.color = e.color), e.textColor !== void 0 && pi(e.textColor) && (t.textColor = e.textColor), e.placement !== void 0 && (t.placement = e.placement), e.colspan !== void 0 && e.colspan > 1 && (t.colspan = e.colspan), e.rowspan !== void 0 && e.rowspan > 1 && (t.rowspan = e.rowspan), e.mergedInto !== void 0 && (t.mergedInto = [...e.mergedInto]), t;
|
|
3639
3639
|
}
|
|
@@ -3744,7 +3744,7 @@ var Or = (e) => {
|
|
|
3744
3744
|
}
|
|
3745
3745
|
});
|
|
3746
3746
|
}
|
|
3747
|
-
}, yi = (e, t, n) => (n.grid.addRow(e, t),
|
|
3747
|
+
}, yi = (e, t, n) => (n.grid.addRow(e, t), V(e, n.cellBlocks), {
|
|
3748
3748
|
pendingHighlight: {
|
|
3749
3749
|
type: "row",
|
|
3750
3750
|
index: t
|
|
@@ -3755,7 +3755,7 @@ var Or = (e) => {
|
|
|
3755
3755
|
withHeadingColumn: n.data.withHeadingColumn
|
|
3756
3756
|
}), bi = (e, t, n) => {
|
|
3757
3757
|
let r = ni(e, t, n.data.colWidths, n.data.initialColWidth, n.grid);
|
|
3758
|
-
return
|
|
3758
|
+
return V(e, n.cellBlocks), {
|
|
3759
3759
|
pendingHighlight: {
|
|
3760
3760
|
type: "col",
|
|
3761
3761
|
index: t
|
|
@@ -3799,7 +3799,7 @@ var Or = (e) => {
|
|
|
3799
3799
|
var r, i;
|
|
3800
3800
|
(r = n.cellBlocks) == null || r.deleteBlocks((i = n.blocksToDelete) == null ? [] : i), n.grid.deleteColumn(e, t);
|
|
3801
3801
|
let a = ti(n.data.colWidths, t);
|
|
3802
|
-
return a ?
|
|
3802
|
+
return a ? z(e, a) : $r(e), {
|
|
3803
3803
|
pendingHighlight: {
|
|
3804
3804
|
type: "col",
|
|
3805
3805
|
index: t < n.grid.getColumnCount(e) ? t : t - 1
|
|
@@ -3846,8 +3846,8 @@ var Or = (e) => {
|
|
|
3846
3846
|
let n = e[e.length - 1], r = t.offsetWidth || parseFloat(t.style.width) || 0;
|
|
3847
3847
|
return [...e, n + r];
|
|
3848
3848
|
}, [0]);
|
|
3849
|
-
let n = e.querySelector(`[${
|
|
3850
|
-
return n ? Array.from(n.querySelectorAll(`[${
|
|
3849
|
+
let n = e.querySelector(`[${N}]`);
|
|
3850
|
+
return n ? Array.from(n.querySelectorAll(`[${P}]`)).reduce((e, t) => {
|
|
3851
3851
|
let n = e[e.length - 1];
|
|
3852
3852
|
return [...e, n + t.offsetWidth];
|
|
3853
3853
|
}, [0]) : [0];
|
|
@@ -3891,7 +3891,7 @@ var Or = (e) => {
|
|
|
3891
3891
|
this.grid.style.userSelect = "none", document.body.style.cursor = "grabbing", (e = this.onDragStateChange) == null || e.call(this, !0, this.dragType), this.highlightSourceCells(), this.createDropIndicator(), this.createGhost();
|
|
3892
3892
|
}
|
|
3893
3893
|
highlightSourceCells() {
|
|
3894
|
-
let e = this.grid.querySelectorAll(`[${
|
|
3894
|
+
let e = this.grid.querySelectorAll(`[${N}]`);
|
|
3895
3895
|
if (this.dragType === "row") {
|
|
3896
3896
|
this.highlightRowCells(e);
|
|
3897
3897
|
return;
|
|
@@ -3902,7 +3902,7 @@ var Or = (e) => {
|
|
|
3902
3902
|
let t = e[this.dragFromIndex];
|
|
3903
3903
|
if (!t) return;
|
|
3904
3904
|
let n = this.getDragSourceBg();
|
|
3905
|
-
t.querySelectorAll(`[${
|
|
3905
|
+
t.querySelectorAll(`[${P}]`).forEach((e) => {
|
|
3906
3906
|
let t = e;
|
|
3907
3907
|
t.style.backgroundColor = n, t.style.opacity = "0.7", this.dragOverlayCells.push(t);
|
|
3908
3908
|
});
|
|
@@ -3910,7 +3910,7 @@ var Or = (e) => {
|
|
|
3910
3910
|
highlightColumnCells(e) {
|
|
3911
3911
|
let t = this.getDragSourceBg();
|
|
3912
3912
|
e.forEach((e) => {
|
|
3913
|
-
let n = e.querySelector(`[${
|
|
3913
|
+
let n = e.querySelector(`[${F}="${this.dragFromIndex}"]`);
|
|
3914
3914
|
n && (n.style.backgroundColor = t, n.style.opacity = "0.7", this.dragOverlayCells.push(n));
|
|
3915
3915
|
});
|
|
3916
3916
|
}
|
|
@@ -3927,7 +3927,7 @@ var Or = (e) => {
|
|
|
3927
3927
|
let e = this.dropIndicator.style;
|
|
3928
3928
|
if (e.position = "absolute", e.backgroundColor = "#3b82f6", e.borderRadius = "1.5px", e.zIndex = "5", e.pointerEvents = "none", this.dropIndicator.setAttribute("contenteditable", "false"), this.dragType === "row") e.height = "3px", e.left = "-1px", e.right = "0", e.transition = "top 100ms ease";
|
|
3929
3929
|
else {
|
|
3930
|
-
let t = this.grid.querySelectorAll(`[${
|
|
3930
|
+
let t = this.grid.querySelectorAll(`[${N}]`), n = t[t.length - 1], r = n ? n.offsetTop + n.offsetHeight : 0;
|
|
3931
3931
|
e.width = "3px", e.top = "-1px", e.height = `${r + 1}px`, e.transition = "left 100ms ease";
|
|
3932
3932
|
}
|
|
3933
3933
|
this.grid.appendChild(this.dropIndicator);
|
|
@@ -3989,22 +3989,22 @@ var Or = (e) => {
|
|
|
3989
3989
|
}
|
|
3990
3990
|
getRowSourceRect() {
|
|
3991
3991
|
var e;
|
|
3992
|
-
let t = this.grid.querySelectorAll(`[${
|
|
3992
|
+
let t = this.grid.querySelectorAll(`[${N}]`)[this.dragFromIndex];
|
|
3993
3993
|
return (e = t == null ? void 0 : t.getBoundingClientRect()) == null ? null : e;
|
|
3994
3994
|
}
|
|
3995
3995
|
getColSourceRect() {
|
|
3996
|
-
let e = this.grid.querySelectorAll(`[${
|
|
3996
|
+
let e = this.grid.querySelectorAll(`[${N}]`), t = e[0], n = e[e.length - 1];
|
|
3997
3997
|
if (!t || !n) return null;
|
|
3998
|
-
let r = t.querySelector(`[${
|
|
3998
|
+
let r = t.querySelector(`[${F}="${this.dragFromIndex}"]`), i = n.querySelector(`[${F}="${this.dragFromIndex}"]`);
|
|
3999
3999
|
if (!r || !i) return null;
|
|
4000
4000
|
let a = r.getBoundingClientRect(), o = i.getBoundingClientRect();
|
|
4001
4001
|
return new DOMRect(a.left, a.top, a.width, o.bottom - a.top);
|
|
4002
4002
|
}
|
|
4003
4003
|
buildRowGhost() {
|
|
4004
|
-
let e = this.grid.querySelectorAll(`[${
|
|
4004
|
+
let e = this.grid.querySelectorAll(`[${N}]`)[this.dragFromIndex];
|
|
4005
4005
|
if (!e || !this.ghostEl) return;
|
|
4006
4006
|
let t = this.ghostEl.style;
|
|
4007
|
-
t.display = "flex", t.height = `${e.offsetHeight}px`, e.querySelectorAll(`[${
|
|
4007
|
+
t.display = "flex", t.height = `${e.offsetHeight}px`, e.querySelectorAll(`[${P}]`).forEach((e) => {
|
|
4008
4008
|
var t;
|
|
4009
4009
|
let n = e, r = n.cloneNode(!0);
|
|
4010
4010
|
r.style.width = `${n.offsetWidth}px`, r.style.flexShrink = "0", r.removeAttribute("contenteditable"), (t = this.ghostEl) == null || t.appendChild(r);
|
|
@@ -4012,10 +4012,10 @@ var Or = (e) => {
|
|
|
4012
4012
|
}
|
|
4013
4013
|
buildColumnGhost() {
|
|
4014
4014
|
if (!this.ghostEl) return;
|
|
4015
|
-
let e = this.grid.querySelectorAll(`[${
|
|
4015
|
+
let e = this.grid.querySelectorAll(`[${N}]`), t = this.ghostEl.style;
|
|
4016
4016
|
t.display = "flex", t.flexDirection = "column", e.forEach((e) => {
|
|
4017
4017
|
var t;
|
|
4018
|
-
let n = e.querySelector(`[${
|
|
4018
|
+
let n = e.querySelector(`[${F}="${this.dragFromIndex}"]`);
|
|
4019
4019
|
if (!n) return;
|
|
4020
4020
|
let r = n.cloneNode(!0);
|
|
4021
4021
|
r.style.width = `${n.offsetWidth}px`, r.style.height = `${n.offsetHeight}px`, r.removeAttribute("contenteditable"), (t = this.ghostEl) == null || t.appendChild(r);
|
|
@@ -4027,7 +4027,7 @@ var Or = (e) => {
|
|
|
4027
4027
|
this.dragType === "row" && (t.top = `${e.clientY - this.ghostOffsetY}px`), this.dragType === "col" && (t.left = `${e.clientX - this.ghostOffsetX}px`);
|
|
4028
4028
|
}
|
|
4029
4029
|
getRowDropIndex(e) {
|
|
4030
|
-
let t = Array.from(this.grid.querySelectorAll(`[${
|
|
4030
|
+
let t = Array.from(this.grid.querySelectorAll(`[${N}]`)), n = t.map((e) => e.offsetTop);
|
|
4031
4031
|
if (t.length > 0) {
|
|
4032
4032
|
let e = t[t.length - 1];
|
|
4033
4033
|
n.push(e.offsetTop + e.offsetHeight);
|
|
@@ -4036,7 +4036,7 @@ var Or = (e) => {
|
|
|
4036
4036
|
return r.indexOf(i);
|
|
4037
4037
|
}
|
|
4038
4038
|
getRowDropTopPx(e) {
|
|
4039
|
-
let t = this.grid.querySelectorAll(`[${
|
|
4039
|
+
let t = this.grid.querySelectorAll(`[${N}]`);
|
|
4040
4040
|
if (e < t.length) return t[e].offsetTop;
|
|
4041
4041
|
if (t.length > 0) {
|
|
4042
4042
|
let e = t[t.length - 1];
|
|
@@ -4097,15 +4097,15 @@ var Or = (e) => {
|
|
|
4097
4097
|
"[transition-timing-function:cubic-bezier(0.34,1.56,0.64,1)]"
|
|
4098
4098
|
], Fi = (e) => {
|
|
4099
4099
|
let { icon: t, label: n, isActive: r, onToggle: i } = e, a = { active: r }, o = document.createElement("div");
|
|
4100
|
-
o.className =
|
|
4100
|
+
o.className = A(Ai);
|
|
4101
4101
|
let s = document.createElement("div");
|
|
4102
|
-
s.className =
|
|
4102
|
+
s.className = A(ji), s.innerHTML = t, o.appendChild(s);
|
|
4103
4103
|
let c = document.createElement("span");
|
|
4104
|
-
c.className =
|
|
4104
|
+
c.className = A(Mi), c.textContent = n, o.appendChild(c);
|
|
4105
4105
|
let l = document.createElement("div");
|
|
4106
|
-
l.className =
|
|
4106
|
+
l.className = A(Ni);
|
|
4107
4107
|
let u = document.createElement("div");
|
|
4108
|
-
u.className =
|
|
4108
|
+
u.className = A(Pi), l.appendChild(u), o.appendChild(l);
|
|
4109
4109
|
let d = () => {
|
|
4110
4110
|
l.style.backgroundColor = a.active ? "var(--blok-toggle-on-bg)" : "var(--blok-toggle-off-bg)", u.style.left = a.active ? "14px" : "2px", u.style.backgroundColor = a.active ? "var(--blok-toggle-thumb-on-bg)" : "", u.style.boxShadow = a.active ? "0 1px 3px rgba(0,0,0,0.35), 0 0 0 1px rgba(0,0,0,0.04)" : "0 1px 3px rgba(0,0,0,0.25), 0 0 0 1px rgba(0,0,0,0.06)";
|
|
4111
4111
|
};
|
|
@@ -4113,18 +4113,18 @@ var Or = (e) => {
|
|
|
4113
4113
|
e.stopPropagation(), a.active = !a.active, d(), i(a.active);
|
|
4114
4114
|
}), o;
|
|
4115
4115
|
}, Ii = (e, t) => {
|
|
4116
|
-
let
|
|
4117
|
-
type:
|
|
4116
|
+
let r = e === 0 ? [{
|
|
4117
|
+
type: w.Html,
|
|
4118
4118
|
element: Fi({
|
|
4119
|
-
icon:
|
|
4119
|
+
icon: ke,
|
|
4120
4120
|
label: t.i18n.t("tools.table.headerColumn"),
|
|
4121
4121
|
isActive: t.isHeadingColumn(),
|
|
4122
4122
|
onToggle: () => {
|
|
4123
4123
|
t.onAction({ type: "toggle-heading-column" });
|
|
4124
4124
|
}
|
|
4125
4125
|
})
|
|
4126
|
-
}, { type:
|
|
4127
|
-
icon:
|
|
4126
|
+
}, { type: w.Separator }] : [], i = [{
|
|
4127
|
+
icon: Le,
|
|
4128
4128
|
title: t.i18n.t("tools.table.insertColumnLeft"),
|
|
4129
4129
|
closeOnActivate: !0,
|
|
4130
4130
|
onActivate: () => {
|
|
@@ -4134,7 +4134,7 @@ var Or = (e) => {
|
|
|
4134
4134
|
});
|
|
4135
4135
|
}
|
|
4136
4136
|
}, {
|
|
4137
|
-
icon:
|
|
4137
|
+
icon: we,
|
|
4138
4138
|
title: t.i18n.t("tools.table.insertColumnRight"),
|
|
4139
4139
|
closeOnActivate: !0,
|
|
4140
4140
|
onActivate: () => {
|
|
@@ -4143,11 +4143,11 @@ var Or = (e) => {
|
|
|
4143
4143
|
index: e
|
|
4144
4144
|
});
|
|
4145
4145
|
}
|
|
4146
|
-
}],
|
|
4147
|
-
icon:
|
|
4146
|
+
}], a = t.getColumnCount() > 1, o = [{ type: w.Separator }, {
|
|
4147
|
+
icon: n,
|
|
4148
4148
|
title: t.i18n.t("tools.table.deleteColumn"),
|
|
4149
4149
|
isDestructive: !0,
|
|
4150
|
-
isDisabled: !
|
|
4150
|
+
isDisabled: !a,
|
|
4151
4151
|
closeOnActivate: !0,
|
|
4152
4152
|
onActivate: () => {
|
|
4153
4153
|
t.onAction({
|
|
@@ -4157,51 +4157,51 @@ var Or = (e) => {
|
|
|
4157
4157
|
}
|
|
4158
4158
|
}];
|
|
4159
4159
|
return [
|
|
4160
|
-
...n,
|
|
4161
4160
|
...r,
|
|
4162
|
-
...
|
|
4161
|
+
...i,
|
|
4162
|
+
...o
|
|
4163
4163
|
];
|
|
4164
|
-
}, Li = (
|
|
4165
|
-
let r =
|
|
4166
|
-
type:
|
|
4164
|
+
}, Li = (e, t) => {
|
|
4165
|
+
let r = e === 0 ? [{
|
|
4166
|
+
type: w.Html,
|
|
4167
4167
|
element: Fi({
|
|
4168
|
-
icon:
|
|
4169
|
-
label:
|
|
4170
|
-
isActive:
|
|
4168
|
+
icon: ot,
|
|
4169
|
+
label: t.i18n.t("tools.table.headerRow"),
|
|
4170
|
+
isActive: t.isHeadingRow(),
|
|
4171
4171
|
onToggle: () => {
|
|
4172
|
-
|
|
4172
|
+
t.onAction({ type: "toggle-heading" });
|
|
4173
4173
|
}
|
|
4174
4174
|
})
|
|
4175
|
-
}, { type:
|
|
4176
|
-
icon:
|
|
4177
|
-
title:
|
|
4175
|
+
}, { type: w.Separator }] : [], i = [{
|
|
4176
|
+
icon: qe,
|
|
4177
|
+
title: t.i18n.t("tools.table.insertRowAbove"),
|
|
4178
4178
|
closeOnActivate: !0,
|
|
4179
4179
|
onActivate: () => {
|
|
4180
|
-
|
|
4180
|
+
t.onAction({
|
|
4181
4181
|
type: "insert-row-above",
|
|
4182
|
-
index:
|
|
4182
|
+
index: e
|
|
4183
4183
|
});
|
|
4184
4184
|
}
|
|
4185
4185
|
}, {
|
|
4186
|
-
icon:
|
|
4187
|
-
title:
|
|
4186
|
+
icon: tt,
|
|
4187
|
+
title: t.i18n.t("tools.table.insertRowBelow"),
|
|
4188
4188
|
closeOnActivate: !0,
|
|
4189
4189
|
onActivate: () => {
|
|
4190
|
-
|
|
4190
|
+
t.onAction({
|
|
4191
4191
|
type: "insert-row-below",
|
|
4192
|
-
index:
|
|
4192
|
+
index: e
|
|
4193
4193
|
});
|
|
4194
4194
|
}
|
|
4195
|
-
}], a =
|
|
4196
|
-
icon:
|
|
4197
|
-
title:
|
|
4195
|
+
}], a = t.getRowCount() > 1, o = [{ type: w.Separator }, {
|
|
4196
|
+
icon: n,
|
|
4197
|
+
title: t.i18n.t("tools.table.deleteRow"),
|
|
4198
4198
|
isDestructive: !0,
|
|
4199
4199
|
isDisabled: !a,
|
|
4200
4200
|
closeOnActivate: !0,
|
|
4201
4201
|
onActivate: () => {
|
|
4202
|
-
|
|
4202
|
+
t.onAction({
|
|
4203
4203
|
type: "delete-row",
|
|
4204
|
-
index:
|
|
4204
|
+
index: e
|
|
4205
4205
|
});
|
|
4206
4206
|
}
|
|
4207
4207
|
}];
|
|
@@ -4217,12 +4217,12 @@ var Or = (e) => {
|
|
|
4217
4217
|
popover: null,
|
|
4218
4218
|
grip: null
|
|
4219
4219
|
};
|
|
4220
|
-
let o = new
|
|
4220
|
+
let o = new Me({
|
|
4221
4221
|
items: e === "col" ? Ii(t, r) : Li(t, r),
|
|
4222
4222
|
trigger: a,
|
|
4223
4223
|
flippable: !0
|
|
4224
4224
|
});
|
|
4225
|
-
return o.on(
|
|
4225
|
+
return o.on(lt.Closed, () => {
|
|
4226
4226
|
var e;
|
|
4227
4227
|
i.destroyPopover(), i.applyVisibleClasses(a), i.scheduleHideAll(), (e = i.onGripPopoverClose) == null || e.call(i);
|
|
4228
4228
|
}), i.hideAllGripsExcept(a), i.applyActiveClasses(a), e === "col" ? a.style.height = "16px" : a.style.width = "16px", {
|
|
@@ -4281,7 +4281,7 @@ var Or = (e) => {
|
|
|
4281
4281
|
}
|
|
4282
4282
|
handleUnlockGrip(e) {
|
|
4283
4283
|
document.removeEventListener("pointerdown", this.boundUnlockGrip), this.lockedGrip && (this.applyIdleClasses(this.lockedGrip), this.lockedGrip = null);
|
|
4284
|
-
let t = e.target instanceof HTMLElement ? e.target : null, n = t == null ? void 0 : t.closest(`[${
|
|
4284
|
+
let t = e.target instanceof HTMLElement ? e.target : null, n = t == null ? void 0 : t.closest(`[${P}]`);
|
|
4285
4285
|
if (n) {
|
|
4286
4286
|
let e = this.getCellPosition(n);
|
|
4287
4287
|
e && (this.clearHideTimeout(), this.showColGrip(e.col), this.showRowGrip(e.row), this.isInsideTable = !0);
|
|
@@ -4328,7 +4328,7 @@ var Or = (e) => {
|
|
|
4328
4328
|
}
|
|
4329
4329
|
createGripElement(e, t) {
|
|
4330
4330
|
let n = document.createElement("div");
|
|
4331
|
-
n.className =
|
|
4331
|
+
n.className = A(qi, Ji), n.setAttribute(zi, ""), n.setAttribute(e === "col" ? Bi : Vi, String(t)), n.setAttribute("contenteditable", "false");
|
|
4332
4332
|
let r = e === "col" ? Ui : Gi, i = e === "col" ? Wi : Ki, a = e === "col" ? Wi : Gi;
|
|
4333
4333
|
return n.style.width = `${r}px`, n.style.height = `${i}px`, n.style.transform = "translate(-50%, -50%)", n.style.outline = "2px solid var(--blok-table-grip-outline, transparent)", n.appendChild(Lr(e === "col" ? "horizontal" : "vertical")), n.addEventListener("pointerdown", this.boundPointerDown), n.addEventListener("mouseenter", () => {
|
|
4334
4334
|
this.overlay && this.clearHideTimeout(), this.isGripInteractionLocked() || Rr(n, e);
|
|
@@ -4337,7 +4337,7 @@ var Or = (e) => {
|
|
|
4337
4337
|
}), n;
|
|
4338
4338
|
}
|
|
4339
4339
|
positionGrips() {
|
|
4340
|
-
let e = this.grid.querySelectorAll(`[${
|
|
4340
|
+
let e = this.grid.querySelectorAll(`[${N}]`);
|
|
4341
4341
|
if (!e[0]) return;
|
|
4342
4342
|
let t = Oi(this.grid), n = this.overlay && this.scrollContainer ? this.scrollContainer.scrollLeft : 0, r = this.overlay && this.scrollContainer ? this.scrollContainer.clientWidth : Infinity;
|
|
4343
4343
|
this.colGrips.forEach((e, i) => {
|
|
@@ -4354,7 +4354,7 @@ var Or = (e) => {
|
|
|
4354
4354
|
var e;
|
|
4355
4355
|
(e = this.rowResizeObserver) == null || e.disconnect(), this.rowResizeObserver = new ResizeObserver(() => {
|
|
4356
4356
|
this.positionGrips();
|
|
4357
|
-
}), this.grid.querySelectorAll(`[${
|
|
4357
|
+
}), this.grid.querySelectorAll(`[${N}]`).forEach((e) => {
|
|
4358
4358
|
var t;
|
|
4359
4359
|
(t = this.rowResizeObserver) == null || t.observe(e);
|
|
4360
4360
|
});
|
|
@@ -4364,7 +4364,7 @@ var Or = (e) => {
|
|
|
4364
4364
|
}
|
|
4365
4365
|
handleMouseOver(e) {
|
|
4366
4366
|
if (this.isGripInteractionLocked()) return;
|
|
4367
|
-
let t = e.target.closest(`[${
|
|
4367
|
+
let t = e.target.closest(`[${P}]`);
|
|
4368
4368
|
if (!t) return;
|
|
4369
4369
|
this.clearHideTimeout();
|
|
4370
4370
|
let n = this.getCellPosition(t);
|
|
@@ -4374,11 +4374,11 @@ var Or = (e) => {
|
|
|
4374
4374
|
this.isGripInteractionLocked() || this.scheduleHideAll();
|
|
4375
4375
|
}
|
|
4376
4376
|
getCellPosition(e) {
|
|
4377
|
-
let t = e.closest(`[${
|
|
4377
|
+
let t = e.closest(`[${N}]`);
|
|
4378
4378
|
if (!t) return null;
|
|
4379
|
-
let n = Array.from(this.grid.querySelectorAll(`[${
|
|
4379
|
+
let n = Array.from(this.grid.querySelectorAll(`[${N}]`)).indexOf(t);
|
|
4380
4380
|
if (n < 0) return null;
|
|
4381
|
-
let r = Array.from(t.querySelectorAll(`[${
|
|
4381
|
+
let r = Array.from(t.querySelectorAll(`[${P}]`)).indexOf(e);
|
|
4382
4382
|
return r < 0 ? null : {
|
|
4383
4383
|
row: n,
|
|
4384
4384
|
col: r
|
|
@@ -4408,12 +4408,12 @@ var Or = (e) => {
|
|
|
4408
4408
|
}
|
|
4409
4409
|
applyVisibleClasses(e) {
|
|
4410
4410
|
let t = e, n = t.hasAttribute(Bi);
|
|
4411
|
-
Pr(t, n ? "col" : "row", n ? Wi : Gi), this.isInsideTable && (t.style.transition = "none"), t.className =
|
|
4411
|
+
Pr(t, n ? "col" : "row", n ? Wi : Gi), this.isInsideTable && (t.style.transition = "none"), t.className = A(qi, Yi), t.setAttribute("data-blok-table-grip-visible", ""), this.isInsideTable && (t.offsetHeight, t.style.transition = "");
|
|
4412
4412
|
let r = t.querySelector("svg");
|
|
4413
4413
|
r && (r.classList.remove("text-white", "opacity-100"), r.classList.add("text-gray-400", "opacity-0"));
|
|
4414
4414
|
}
|
|
4415
4415
|
applyActiveClasses(e) {
|
|
4416
|
-
Object.assign(e, { className:
|
|
4416
|
+
Object.assign(e, { className: A(qi, Xi) }), e.setAttribute("data-blok-table-grip-visible", "");
|
|
4417
4417
|
let t = e.querySelector("svg");
|
|
4418
4418
|
t && (t.classList.remove("text-gray-400", "opacity-0"), t.classList.add("text-white", "opacity-100"));
|
|
4419
4419
|
}
|
|
@@ -4424,7 +4424,7 @@ var Or = (e) => {
|
|
|
4424
4424
|
}
|
|
4425
4425
|
applyIdleClasses(e) {
|
|
4426
4426
|
let t = e, n = t.hasAttribute(Bi), r = n ? "col" : "row", i = n ? Wi + 12 : Gi + 12;
|
|
4427
|
-
this.isInsideTable && (t.style.transition = "none"), Pr(t, r, i), t.className =
|
|
4427
|
+
this.isInsideTable && (t.style.transition = "none"), Pr(t, r, i), t.className = A(qi, Ji), t.removeAttribute("data-blok-table-grip-visible");
|
|
4428
4428
|
let a = t.querySelector("svg");
|
|
4429
4429
|
a && (a.classList.add("opacity-0"), a.classList.remove("opacity-100")), this.isInsideTable && (t.offsetHeight, t.style.transition = "");
|
|
4430
4430
|
}
|
|
@@ -4501,13 +4501,13 @@ var Or = (e) => {
|
|
|
4501
4501
|
}
|
|
4502
4502
|
updateTooltip() {
|
|
4503
4503
|
let e = this.getTableSize();
|
|
4504
|
-
|
|
4504
|
+
at(this.hitZone, `${e.cols}\u00D7${e.rows}`, { placement: "bottom" });
|
|
4505
4505
|
}
|
|
4506
4506
|
handleMouseEnter() {
|
|
4507
4507
|
this.updateTooltip();
|
|
4508
4508
|
}
|
|
4509
4509
|
handleMouseLeave() {
|
|
4510
|
-
this.dragState === null &&
|
|
4510
|
+
this.dragState === null && t();
|
|
4511
4511
|
}
|
|
4512
4512
|
measureUnitHeight() {
|
|
4513
4513
|
let e = this.gridEl.querySelectorAll("[data-blok-table-row]"), t = e[e.length - 1];
|
|
@@ -4547,8 +4547,8 @@ var Or = (e) => {
|
|
|
4547
4547
|
}
|
|
4548
4548
|
handlePointerUp(e) {
|
|
4549
4549
|
if (this.dragState === null) return;
|
|
4550
|
-
let { didDrag:
|
|
4551
|
-
this.dragState = null,
|
|
4550
|
+
let { didDrag: n, pointerId: r } = this.dragState;
|
|
4551
|
+
this.dragState = null, t(), this.hitZone.releasePointerCapture(r), this.hitZone.removeEventListener("pointermove", this.boundPointerMove), this.hitZone.removeEventListener("pointerup", this.boundPointerUp), n ? (document.body.style.cursor = "", document.body.style.userSelect = "", this.onDragEnd()) : this.onClickAdd ? this.onClickAdd() : (this.onAddRow(), this.onAddColumn());
|
|
4552
4552
|
}
|
|
4553
4553
|
setDisplay(e) {
|
|
4554
4554
|
this.hitZone.style.display = e ? "" : "none";
|
|
@@ -4558,7 +4558,7 @@ var Or = (e) => {
|
|
|
4558
4558
|
}
|
|
4559
4559
|
destroy() {
|
|
4560
4560
|
var e;
|
|
4561
|
-
this.hitZone.removeEventListener("mouseenter", this.boundMouseEnter), this.hitZone.removeEventListener("mouseleave", this.boundMouseLeave), this.hitZone.removeEventListener("pointerdown", this.boundPointerDown), this.hitZone.removeEventListener("pointermove", this.boundPointerMove), this.hitZone.removeEventListener("pointerup", this.boundPointerUp), (e = this.dragState) != null && e.didDrag && (document.body.style.cursor = "", document.body.style.userSelect = ""), this.dragState = null,
|
|
4561
|
+
this.hitZone.removeEventListener("mouseenter", this.boundMouseEnter), this.hitZone.removeEventListener("mouseleave", this.boundMouseLeave), this.hitZone.removeEventListener("pointerdown", this.boundPointerDown), this.hitZone.removeEventListener("pointermove", this.boundPointerMove), this.hitZone.removeEventListener("pointerup", this.boundPointerUp), (e = this.dragState) != null && e.didDrag && (document.body.style.cursor = "", document.body.style.userSelect = ""), this.dragState = null, t(), this.hitZone.remove();
|
|
4562
4562
|
}
|
|
4563
4563
|
}, ta = "data-blok-table-haze", na = "data-blok-table-haze-visible", ra = 1, ia = [
|
|
4564
4564
|
"absolute",
|
|
@@ -4630,7 +4630,7 @@ var Or = (e) => {
|
|
|
4630
4630
|
constructor({ data: e, config: t, api: n, readOnly: r, block: i }) {
|
|
4631
4631
|
this.initialContent = null, this.resize = null, this.addControls = null, this.rowColControls = null, this.cellBlocks = null, this.cellSelection = null, this.cornerDrag = null, this.scrollHaze = null, this.element = null, this.gridElement = null, this.scrollContainer = null, this.gripOverlay = null, this.pendingHighlight = null, this.isNewTable = !1, this.unregisterRestrictedTools = null, this.gridPasteCleanup = null, this.keyboardNavCleanup = null, this.setDataGeneration = 0, this.structuralOpDepth = 0, this.api = n, this.readOnly = r, this.config = t == null ? {} : t;
|
|
4632
4632
|
let a = si(e, this.config);
|
|
4633
|
-
this.initialContent = a.content, this.grid = new Sr({ readOnly: r }), this.model = new mi(a), this.blockId = i == null ? void 0 : i.id, this.config.restrictedTools !== void 0 && (this.unregisterRestrictedTools =
|
|
4633
|
+
this.initialContent = a.content, this.grid = new Sr({ readOnly: r }), this.model = new mi(a), this.blockId = i == null ? void 0 : i.id, this.config.restrictedTools !== void 0 && (this.unregisterRestrictedTools = le(this.config.restrictedTools));
|
|
4634
4634
|
}
|
|
4635
4635
|
runStructuralOp(e, t = !1) {
|
|
4636
4636
|
this.structuralOpDepth++;
|
|
@@ -4680,9 +4680,9 @@ var Or = (e) => {
|
|
|
4680
4680
|
e.forEach((e, i) => {
|
|
4681
4681
|
e.forEach((e, a) => {
|
|
4682
4682
|
if (typeof e == "string" || e.mergedInto) return;
|
|
4683
|
-
let o = t.querySelector(`[${vr}="${i}"][${
|
|
4683
|
+
let o = t.querySelector(`[${vr}="${i}"][${F}="${a}"]`);
|
|
4684
4684
|
if (!o) return;
|
|
4685
|
-
let s = o.querySelector(`[${
|
|
4685
|
+
let s = o.querySelector(`[${L}]`);
|
|
4686
4686
|
s && e.blocks.forEach((e) => {
|
|
4687
4687
|
let t = n.get(e);
|
|
4688
4688
|
t && !r.has(e) && (s.appendChild(t), r.add(e));
|
|
@@ -4709,7 +4709,7 @@ var Or = (e) => {
|
|
|
4709
4709
|
}
|
|
4710
4710
|
static get toolbox() {
|
|
4711
4711
|
return {
|
|
4712
|
-
icon:
|
|
4712
|
+
icon: dt,
|
|
4713
4713
|
title: "Table",
|
|
4714
4714
|
titleKey: "tools.table.title",
|
|
4715
4715
|
searchTerms: [
|
|
@@ -4747,7 +4747,7 @@ var Or = (e) => {
|
|
|
4747
4747
|
em: !0,
|
|
4748
4748
|
mark: (e) => {
|
|
4749
4749
|
let t = e.style, n = Array.from({ length: t.length }, (e, n) => t.item(n));
|
|
4750
|
-
for (let e of n)
|
|
4750
|
+
for (let e of n) oe.has(e) || t.removeProperty(e);
|
|
4751
4751
|
return t.length > 0 ? { style: !0 } : {};
|
|
4752
4752
|
},
|
|
4753
4753
|
a: {
|
|
@@ -4770,25 +4770,25 @@ var Or = (e) => {
|
|
|
4770
4770
|
return n && this.element && (this.element.insertBefore(t, n), t.appendChild(n)), this.scrollContainer = t, (e = this.addControls) == null || e.attachScrollContainer(t), t;
|
|
4771
4771
|
}
|
|
4772
4772
|
render() {
|
|
4773
|
-
var e, n, r
|
|
4774
|
-
let
|
|
4775
|
-
|
|
4776
|
-
let
|
|
4777
|
-
if (
|
|
4778
|
-
var
|
|
4779
|
-
this.grid.fillGrid(
|
|
4773
|
+
var e, t, n, r;
|
|
4774
|
+
let i = document.createElement("div");
|
|
4775
|
+
i.className = A(ua, !this.readOnly && da), i.setAttribute(D.tool, "table"), this.readOnly && i.setAttribute("data-blok-table-readonly", ""), this.isNewTable = ((e = (t = this.initialContent) == null ? void 0 : t.length) == null ? 0 : e) === 0;
|
|
4776
|
+
let a = ((n = (r = this.initialContent) == null ? void 0 : r.length) == null ? 0 : n) > 0, o = a && this.modelHasMerges(), s = o ? this.grid.createGridFromModel(this.model) : this.createFlatGrid();
|
|
4777
|
+
if (a && !o) {
|
|
4778
|
+
var c;
|
|
4779
|
+
this.grid.fillGrid(s, (c = this.initialContent) == null ? [] : c);
|
|
4780
4780
|
}
|
|
4781
|
-
if (this.model.colWidths &&
|
|
4781
|
+
if (this.model.colWidths && z(s, this.model.colWidths), this.gridElement = s, this.model.colWidths || !this.readOnly) {
|
|
4782
4782
|
let e = document.createElement("div");
|
|
4783
4783
|
e.setAttribute("data-blok-table-scroll", "");
|
|
4784
4784
|
let t = this.model.colWidths ? li : [];
|
|
4785
|
-
e.classList.add(...t), e.appendChild(
|
|
4786
|
-
} else
|
|
4785
|
+
e.classList.add(...t), e.appendChild(s), i.appendChild(e), this.scrollContainer = e;
|
|
4786
|
+
} else i.appendChild(s), this.scrollContainer = null;
|
|
4787
4787
|
if (!this.readOnly) {
|
|
4788
4788
|
let e = document.createElement("div");
|
|
4789
|
-
e.setAttribute("data-blok-table-grip-overlay", ""), e.style.position = "absolute", e.style.inset = "0", e.style.pointerEvents = "none", e.style.zIndex = "3",
|
|
4789
|
+
e.setAttribute("data-blok-table-grip-overlay", ""), e.style.position = "absolute", e.style.inset = "0", e.style.pointerEvents = "none", e.style.zIndex = "3", i.appendChild(e), this.gripOverlay = e;
|
|
4790
4790
|
}
|
|
4791
|
-
return this.element =
|
|
4791
|
+
return this.element = i, this.model.withHeadings && H(this.gridElement, this.model.withHeadings), this.model.withHeadingColumn && U(this.gridElement, this.model.withHeadingColumn), this.readOnly || (this.initCellBlocks(s), this.keyboardNavCleanup = ci(s, this.cellBlocks)), i;
|
|
4792
4792
|
}
|
|
4793
4793
|
rendered() {
|
|
4794
4794
|
if (!this.element || this.initialContent === null) return;
|
|
@@ -4804,14 +4804,14 @@ var Or = (e) => {
|
|
|
4804
4804
|
}
|
|
4805
4805
|
if (this.runTransactedStructuralOp(() => {
|
|
4806
4806
|
var n, r;
|
|
4807
|
-
let i = (n = (r = this.cellBlocks) == null ? void 0 : r.initializeCells(t)) == null ? t : n, a = this.isNewTable && i.length === 0 ? Array.from(e.querySelectorAll(`[${
|
|
4808
|
-
let t = e.querySelectorAll(`[${
|
|
4807
|
+
let i = (n = (r = this.cellBlocks) == null ? void 0 : r.initializeCells(t)) == null ? t : n, a = this.isNewTable && i.length === 0 ? Array.from(e.querySelectorAll(`[${N}]`), (e) => {
|
|
4808
|
+
let t = e.querySelectorAll(`[${P}]`).length;
|
|
4809
4809
|
return Array.from({ length: t }, () => ({ blocks: [] }));
|
|
4810
4810
|
}) : i;
|
|
4811
|
-
this.model.replaceAll(
|
|
4811
|
+
this.model.replaceAll(k(k({}, this.model.snapshot()), {}, { content: a })), this.isNewTable && V(e, this.cellBlocks), this.removeGhostChildren();
|
|
4812
4812
|
}, !0), this.model.initialColWidth === void 0) {
|
|
4813
4813
|
var r;
|
|
4814
|
-
let t = (r = this.model.colWidths) == null ?
|
|
4814
|
+
let t = (r = this.model.colWidths) == null ? R(e) : r;
|
|
4815
4815
|
this.model.setInitialColWidth(t.length > 0 ? ri(t) : void 0);
|
|
4816
4816
|
}
|
|
4817
4817
|
this.initSubsystems(e);
|
|
@@ -4849,13 +4849,13 @@ var Or = (e) => {
|
|
|
4849
4849
|
save(e) {
|
|
4850
4850
|
let t = this.model.snapshot();
|
|
4851
4851
|
return t.content = t.content.map((e) => e.map((e) => {
|
|
4852
|
-
if (!
|
|
4852
|
+
if (!I(e)) return e;
|
|
4853
4853
|
let t = e.blocks.filter((e) => {
|
|
4854
4854
|
var t, n;
|
|
4855
4855
|
let r = (t = (n = this.api.blocks).getById) == null ? void 0 : t.call(n, e);
|
|
4856
4856
|
return !r || r.parentId === this.blockId;
|
|
4857
4857
|
});
|
|
4858
|
-
return
|
|
4858
|
+
return k(k({}, e), {}, { blocks: t });
|
|
4859
4859
|
})), t;
|
|
4860
4860
|
}
|
|
4861
4861
|
validate(e) {
|
|
@@ -4864,7 +4864,7 @@ var Or = (e) => {
|
|
|
4864
4864
|
setData(e) {
|
|
4865
4865
|
var t, n, r, i, a;
|
|
4866
4866
|
this.setDataGeneration++;
|
|
4867
|
-
let o = this.setDataGeneration, s = si(
|
|
4867
|
+
let o = this.setDataGeneration, s = si(k(k({}, this.model.snapshot()), e), this.config);
|
|
4868
4868
|
this.initialContent = s.content, this.model.replaceAll(s), this.api.blocks.isSyncingFromYjs || this.runStructuralOp(() => {
|
|
4869
4869
|
var e;
|
|
4870
4870
|
(e = this.cellBlocks) == null || e.deleteAllBlocks();
|
|
@@ -4887,12 +4887,12 @@ var Or = (e) => {
|
|
|
4887
4887
|
let i = (e = (t = (n = this.cellBlocks) == null ? void 0 : n.initializeCells((r = this.initialContent) == null ? [] : r)) == null ? this.initialContent : t) == null ? [] : e;
|
|
4888
4888
|
if (o === this.setDataGeneration) {
|
|
4889
4889
|
if (this.api.blocks.isSyncingFromYjs && i.length === 0 && f) {
|
|
4890
|
-
let e = Array.from(f.querySelectorAll(`[${
|
|
4891
|
-
let t = e.querySelectorAll(`[${
|
|
4890
|
+
let e = Array.from(f.querySelectorAll(`[${N}]`), (e) => {
|
|
4891
|
+
let t = e.querySelectorAll(`[${P}]`).length;
|
|
4892
4892
|
return Array.from({ length: t }, () => ({ blocks: [] }));
|
|
4893
4893
|
});
|
|
4894
|
-
this.model.replaceAll(
|
|
4895
|
-
} else this.model.replaceAll(
|
|
4894
|
+
this.model.replaceAll(k(k({}, this.model.snapshot()), {}, { content: e })), V(f, this.cellBlocks);
|
|
4895
|
+
} else this.model.replaceAll(k(k({}, this.model.snapshot()), {}, { content: i }));
|
|
4896
4896
|
this.initialContent = null;
|
|
4897
4897
|
}
|
|
4898
4898
|
}, !0), o !== this.setDataGeneration)) return;
|
|
@@ -4909,9 +4909,9 @@ var Or = (e) => {
|
|
|
4909
4909
|
var t;
|
|
4910
4910
|
n.push(e.innerHTML);
|
|
4911
4911
|
let i = (t = e.getAttribute("style")) == null ? "" : t, a = {}, o = /background-color\s*:\s*([^;]+)/i.exec(i);
|
|
4912
|
-
o != null && o[1] && (a.color =
|
|
4912
|
+
o != null && o[1] && (a.color = me(o[1].trim(), "bg"));
|
|
4913
4913
|
let s = (/* @__PURE__ */ RegExp("(?<![a-z-])color\\s*:\\s*([^;]+)", "i")).exec(i);
|
|
4914
|
-
s != null && s[1] && !
|
|
4914
|
+
s != null && s[1] && !b(s[1].trim()) && (a.textColor = me(s[1].trim(), "text")), r.push(a);
|
|
4915
4915
|
}), n.length > 0 && (a.push(n), o.push(r));
|
|
4916
4916
|
});
|
|
4917
4917
|
let s = r.querySelector("thead") !== null, c = ((t = i[0]) == null ? void 0 : t.querySelector("th")) !== null, l = s || c;
|
|
@@ -4923,19 +4923,19 @@ var Or = (e) => {
|
|
|
4923
4923
|
if (!(u != null && u.parentNode)) return;
|
|
4924
4924
|
let d = this.render();
|
|
4925
4925
|
u.parentNode.replaceChild(d, u);
|
|
4926
|
-
let
|
|
4927
|
-
if (!this.readOnly &&
|
|
4926
|
+
let f = this.gridElement;
|
|
4927
|
+
if (!this.readOnly && f) {
|
|
4928
4928
|
this.runStructuralOp(() => {
|
|
4929
4929
|
var e, t, n, r;
|
|
4930
4930
|
let i = (e = (t = (n = this.cellBlocks) == null ? void 0 : n.initializeCells((r = this.initialContent) == null ? [] : r)) == null ? this.initialContent : t) == null ? [] : e;
|
|
4931
|
-
this.model.replaceAll(
|
|
4931
|
+
this.model.replaceAll(k(k({}, this.model.snapshot()), {}, { content: i })), this.initialContent = null, o.forEach((e, t) => {
|
|
4932
4932
|
e.forEach((e, n) => {
|
|
4933
4933
|
e.color !== void 0 && this.model.setCellColor(t, n, e.color), e.textColor !== void 0 && this.model.setCellTextColor(t, n, e.textColor);
|
|
4934
4934
|
});
|
|
4935
4935
|
});
|
|
4936
|
-
}, !0), this.initSubsystems(
|
|
4936
|
+
}, !0), this.initSubsystems(f);
|
|
4937
4937
|
let e = this.model.snapshot();
|
|
4938
|
-
di(
|
|
4938
|
+
di(f, e.content), fi(f, e.content);
|
|
4939
4939
|
}
|
|
4940
4940
|
}
|
|
4941
4941
|
destroy() {
|
|
@@ -4982,20 +4982,20 @@ var Or = (e) => {
|
|
|
4982
4982
|
}),
|
|
4983
4983
|
getNewColumnWidth: () => {
|
|
4984
4984
|
var t;
|
|
4985
|
-
let n = (t = this.model.colWidths) == null ?
|
|
4986
|
-
return this.model.initialColWidth === void 0 ?
|
|
4985
|
+
let n = (t = this.model.colWidths) == null ? R(e) : t;
|
|
4986
|
+
return this.model.initialColWidth === void 0 ? B(n) : Math.round(this.model.initialColWidth / 2 * 100) / 100;
|
|
4987
4987
|
},
|
|
4988
4988
|
onAddRow: () => {
|
|
4989
4989
|
this.runTransactedStructuralOp(() => {
|
|
4990
4990
|
var t, n;
|
|
4991
|
-
this.grid.addRow(e), this.model.addRow(),
|
|
4991
|
+
this.grid.addRow(e), this.model.addRow(), V(e, this.cellBlocks), H(this.gridElement, this.model.withHeadings), U(this.gridElement, this.model.withHeadingColumn), this.initResize(e), (t = this.addControls) == null || t.syncRowButtonWidth(), (n = this.rowColControls) == null || n.refresh();
|
|
4992
4992
|
});
|
|
4993
4993
|
},
|
|
4994
4994
|
onAddColumn: () => {
|
|
4995
4995
|
this.runTransactedStructuralOp(() => {
|
|
4996
4996
|
var t, n, r;
|
|
4997
|
-
let i = (t = this.model.colWidths) == null ?
|
|
4998
|
-
this.grid.addColumn(e, void 0, i, a), this.model.addColumn(void 0, a), this.model.setColWidths([...i, a]),
|
|
4997
|
+
let i = (t = this.model.colWidths) == null ? R(e) : t, a = this.model.initialColWidth === void 0 ? B(i) : Math.round(this.model.initialColWidth / 2 * 100) / 100;
|
|
4998
|
+
this.grid.addColumn(e, void 0, i, a), this.model.addColumn(void 0, a), this.model.setColWidths([...i, a]), V(e, this.cellBlocks), U(this.gridElement, this.model.withHeadingColumn), this.initResize(e), (n = this.rowColControls) == null || n.refresh(), this.scrollContainer && (this.scrollContainer.scrollLeft = this.scrollContainer.scrollWidth), (r = this.addControls) == null || r.syncRowButtonWidth();
|
|
4999
4999
|
});
|
|
5000
5000
|
},
|
|
5001
5001
|
onDragStart: () => {
|
|
@@ -5004,7 +5004,7 @@ var Or = (e) => {
|
|
|
5004
5004
|
},
|
|
5005
5005
|
onDragAddRow: () => {
|
|
5006
5006
|
this.runTransactedStructuralOp(() => {
|
|
5007
|
-
this.grid.addRow(e), this.model.addRow(),
|
|
5007
|
+
this.grid.addRow(e), this.model.addRow(), V(e, this.cellBlocks), H(this.gridElement, this.model.withHeadings), U(this.gridElement, this.model.withHeadingColumn);
|
|
5008
5008
|
});
|
|
5009
5009
|
},
|
|
5010
5010
|
onDragRemoveRow: () => {
|
|
@@ -5020,8 +5020,8 @@ var Or = (e) => {
|
|
|
5020
5020
|
onDragAddCol: () => {
|
|
5021
5021
|
this.runTransactedStructuralOp(() => {
|
|
5022
5022
|
var t;
|
|
5023
|
-
let r = (t = this.model.colWidths) == null ?
|
|
5024
|
-
this.grid.addColumn(e, void 0, r, i), this.model.addColumn(void 0, i), this.model.setColWidths(a),
|
|
5023
|
+
let r = (t = this.model.colWidths) == null ? R(e) : t, i = this.model.initialColWidth === void 0 ? B(r) : Math.round(this.model.initialColWidth / 2 * 100) / 100, a = [...r, i];
|
|
5024
|
+
this.grid.addColumn(e, void 0, r, i), this.model.addColumn(void 0, i), this.model.setColWidths(a), z(e, a), V(e, this.cellBlocks), U(this.gridElement, this.model.withHeadingColumn), this.initResize(e), n.addedCols++, this.scrollContainer && (this.scrollContainer.scrollLeft = this.scrollContainer.scrollWidth);
|
|
5025
5025
|
});
|
|
5026
5026
|
},
|
|
5027
5027
|
onDragRemoveCol: () => {
|
|
@@ -5032,7 +5032,7 @@ var Or = (e) => {
|
|
|
5032
5032
|
let { blocksToDelete: i } = this.model.deleteColumn(r - 1);
|
|
5033
5033
|
(t = this.cellBlocks) == null || t.deleteBlocks(i), this.grid.deleteColumn(e, r - 1);
|
|
5034
5034
|
let a = this.model.colWidths;
|
|
5035
|
-
a &&
|
|
5035
|
+
a && z(e, a), this.initResize(e), n.addedCols--;
|
|
5036
5036
|
});
|
|
5037
5037
|
},
|
|
5038
5038
|
onDragEnd: () => {
|
|
@@ -5048,14 +5048,14 @@ var Or = (e) => {
|
|
|
5048
5048
|
gridEl: e,
|
|
5049
5049
|
onAddRow: () => {
|
|
5050
5050
|
this.runStructuralOp(() => {
|
|
5051
|
-
this.grid.addRow(e), this.model.addRow(),
|
|
5051
|
+
this.grid.addRow(e), this.model.addRow(), V(e, this.cellBlocks), H(this.gridElement, this.model.withHeadings), U(this.gridElement, this.model.withHeadingColumn);
|
|
5052
5052
|
});
|
|
5053
5053
|
},
|
|
5054
5054
|
onAddColumn: () => {
|
|
5055
5055
|
this.runStructuralOp(() => {
|
|
5056
5056
|
var t;
|
|
5057
|
-
let n = (t = this.model.colWidths) == null ?
|
|
5058
|
-
this.grid.addColumn(e, void 0, n, r), this.model.addColumn(void 0, r), this.model.setColWidths(i),
|
|
5057
|
+
let n = (t = this.model.colWidths) == null ? R(e) : t, r = this.model.initialColWidth === void 0 ? B(n) : Math.round(this.model.initialColWidth / 2 * 100) / 100, i = [...n, r];
|
|
5058
|
+
this.grid.addColumn(e, void 0, n, r), this.model.addColumn(void 0, r), this.model.setColWidths(i), z(e, i), ui(this.ensureScrollContainer()), V(e, this.cellBlocks), U(this.gridElement, this.model.withHeadingColumn);
|
|
5059
5059
|
});
|
|
5060
5060
|
},
|
|
5061
5061
|
onRemoveLastRow: () => {
|
|
@@ -5075,7 +5075,7 @@ var Or = (e) => {
|
|
|
5075
5075
|
let { blocksToDelete: r } = this.model.deleteColumn(n - 1);
|
|
5076
5076
|
(t = this.cellBlocks) == null || t.deleteBlocks(r), this.grid.deleteColumn(e, n - 1);
|
|
5077
5077
|
let i = this.model.colWidths;
|
|
5078
|
-
i &&
|
|
5078
|
+
i && z(e, i);
|
|
5079
5079
|
});
|
|
5080
5080
|
},
|
|
5081
5081
|
onDragStart: () => {
|
|
@@ -5095,9 +5095,9 @@ var Or = (e) => {
|
|
|
5095
5095
|
onClickAdd: () => {
|
|
5096
5096
|
this.runTransactedStructuralOp(() => {
|
|
5097
5097
|
var t, n, r;
|
|
5098
|
-
this.grid.addRow(e), this.model.addRow(),
|
|
5099
|
-
let i = (t = this.model.colWidths) == null ?
|
|
5100
|
-
this.grid.addColumn(e, void 0, i, a), this.model.addColumn(void 0, a), this.model.setColWidths(o),
|
|
5098
|
+
this.grid.addRow(e), this.model.addRow(), V(e, this.cellBlocks), H(this.gridElement, this.model.withHeadings), U(this.gridElement, this.model.withHeadingColumn);
|
|
5099
|
+
let i = (t = this.model.colWidths) == null ? R(e) : t, a = this.model.initialColWidth === void 0 ? B(i) : Math.round(this.model.initialColWidth / 2 * 100) / 100, o = [...i, a];
|
|
5100
|
+
this.grid.addColumn(e, void 0, i, a), this.model.addColumn(void 0, a), this.model.setColWidths(o), z(e, o), V(e, this.cellBlocks), U(this.gridElement, this.model.withHeadingColumn), this.initResize(e), (n = this.rowColControls) == null || n.refresh(), (r = this.addControls) == null || r.syncRowButtonWidth();
|
|
5101
5101
|
});
|
|
5102
5102
|
}
|
|
5103
5103
|
}));
|
|
@@ -5164,7 +5164,7 @@ var Or = (e) => {
|
|
|
5164
5164
|
blocksToDelete: o
|
|
5165
5165
|
});
|
|
5166
5166
|
if (n !== this.setDataGeneration || this.gridElement !== e) return;
|
|
5167
|
-
if (this.model.setColWidths(s.colWidths), this.model.setWithHeadings(s.withHeadings), this.model.setWithHeadingColumn(s.withHeadingColumn), this.pendingHighlight = s.pendingHighlight,
|
|
5167
|
+
if (this.model.setColWidths(s.colWidths), this.model.setWithHeadings(s.withHeadings), this.model.setWithHeadingColumn(s.withHeadingColumn), this.pendingHighlight = s.pendingHighlight, H(this.gridElement, this.model.withHeadings), U(this.gridElement, this.model.withHeadingColumn), this.initResize(e), (r = this.addControls) == null || r.syncRowButtonWidth(), !(t.type === "toggle-heading" || t.type === "toggle-heading-column")) {
|
|
5168
5168
|
var c;
|
|
5169
5169
|
(c = this.rowColControls) == null || c.refresh();
|
|
5170
5170
|
}
|
|
@@ -5210,7 +5210,7 @@ var Or = (e) => {
|
|
|
5210
5210
|
initResize(e) {
|
|
5211
5211
|
var t, n;
|
|
5212
5212
|
(t = this.resize) == null || t.destroy();
|
|
5213
|
-
let r = this.model.colWidths === void 0, i = (n = this.model.colWidths) == null ?
|
|
5213
|
+
let r = this.model.colWidths === void 0, i = (n = this.model.colWidths) == null ? R(e) : n;
|
|
5214
5214
|
r || ui(this.ensureScrollContainer()), this.resize = new vi(e, i, (e) => {
|
|
5215
5215
|
var t, n, r;
|
|
5216
5216
|
this.model.setColWidths(e), ui(this.ensureScrollContainer()), (t = this.rowColControls) == null || t.positionGrips(), (n = this.addControls) == null || n.syncRowButtonWidth(), (r = this.scrollHaze) == null || r.update();
|
|
@@ -5235,16 +5235,16 @@ var Or = (e) => {
|
|
|
5235
5235
|
handleCellCopy(e, t) {
|
|
5236
5236
|
let n = this.collectCellBlockData(e);
|
|
5237
5237
|
if (n.length === 0) return;
|
|
5238
|
-
let r =
|
|
5239
|
-
t.setData("text/html",
|
|
5238
|
+
let r = i(n);
|
|
5239
|
+
t.setData("text/html", u(r)), t.setData("text/plain", g(r));
|
|
5240
5240
|
}
|
|
5241
5241
|
handleCellCopyViaButton(e) {
|
|
5242
5242
|
let t = this.collectCellBlockData(e);
|
|
5243
5243
|
if (t.length === 0) return;
|
|
5244
|
-
let n =
|
|
5244
|
+
let n = i(t), r = u(n), a = g(n), o = new Blob([r], { type: "text/html" }), s = new Blob([a], { type: "text/plain" });
|
|
5245
5245
|
navigator.clipboard.write([new ClipboardItem({
|
|
5246
|
-
"text/html":
|
|
5247
|
-
"text/plain":
|
|
5246
|
+
"text/html": o,
|
|
5247
|
+
"text/plain": s
|
|
5248
5248
|
})]);
|
|
5249
5249
|
}
|
|
5250
5250
|
handleCellColorChange(e, t, n) {
|
|
@@ -5263,7 +5263,7 @@ var Or = (e) => {
|
|
|
5263
5263
|
let e = Yr(n, r);
|
|
5264
5264
|
if (!e) continue;
|
|
5265
5265
|
this.model.setCellPlacement(e.row, e.col, t === "top-left" ? void 0 : t);
|
|
5266
|
-
let i = r.querySelector(`[${
|
|
5266
|
+
let i = r.querySelector(`[${L}]`);
|
|
5267
5267
|
i && (t === "top-left" ? i.removeAttribute("data-blok-cell-placement") : i.setAttribute("data-blok-cell-placement", t));
|
|
5268
5268
|
}
|
|
5269
5269
|
});
|
|
@@ -5271,12 +5271,12 @@ var Or = (e) => {
|
|
|
5271
5271
|
collectCellBlockData(e) {
|
|
5272
5272
|
let t = this.gridElement;
|
|
5273
5273
|
if (!t) return [];
|
|
5274
|
-
let n = Array.from(t.querySelectorAll(`[${
|
|
5274
|
+
let n = Array.from(t.querySelectorAll(`[${N}]`));
|
|
5275
5275
|
return e.map((e) => {
|
|
5276
5276
|
var t;
|
|
5277
|
-
let r = e.closest(`[${
|
|
5277
|
+
let r = e.closest(`[${N}]`);
|
|
5278
5278
|
if (!r) return null;
|
|
5279
|
-
let i = n.indexOf(r), a = Array.from(r.querySelectorAll(`[${
|
|
5279
|
+
let i = n.indexOf(r), a = Array.from(r.querySelectorAll(`[${P}]`)).indexOf(e), o = e.querySelector(`[${L}]`), s = [];
|
|
5280
5280
|
if (!o) return {
|
|
5281
5281
|
row: i,
|
|
5282
5282
|
col: a,
|
|
@@ -5288,7 +5288,7 @@ var Or = (e) => {
|
|
|
5288
5288
|
let n = this.api.blocks.getBlockIndex(t);
|
|
5289
5289
|
if (n === void 0) return;
|
|
5290
5290
|
let r = this.api.blocks.getBlockByIndex(n);
|
|
5291
|
-
r && s.push(
|
|
5291
|
+
r && s.push(k({
|
|
5292
5292
|
tool: r.name,
|
|
5293
5293
|
data: r.preservedData
|
|
5294
5294
|
}, Object.keys(r.preservedTunes).length > 0 ? { tunes: r.preservedTunes } : {}));
|
|
@@ -5299,7 +5299,7 @@ var Or = (e) => {
|
|
|
5299
5299
|
data: { text: c }
|
|
5300
5300
|
});
|
|
5301
5301
|
let l = this.model.getCellColor(i, a), u = this.model.getCellTextColor(i, a);
|
|
5302
|
-
return
|
|
5302
|
+
return k(k({
|
|
5303
5303
|
row: i,
|
|
5304
5304
|
col: a,
|
|
5305
5305
|
blocks: s
|
|
@@ -5386,20 +5386,20 @@ var Or = (e) => {
|
|
|
5386
5386
|
}
|
|
5387
5387
|
handleGridPaste(e, t) {
|
|
5388
5388
|
if (this.readOnly || !e.clipboardData || e.defaultPrevented) return;
|
|
5389
|
-
let n = e.clipboardData.getData("text/html"), r =
|
|
5389
|
+
let n = e.clipboardData.getData("text/html"), r = se(n), i = r === null ? ht(n) : null, a = r == null ? i : r;
|
|
5390
5390
|
if (!a || i !== null && new DOMParser().parseFromString(n, "text/html").querySelectorAll("table").length > 1) return;
|
|
5391
5391
|
let o = document.activeElement;
|
|
5392
5392
|
if (!o) return;
|
|
5393
|
-
let s = o.closest(`[${
|
|
5393
|
+
let s = o.closest(`[${P}]`);
|
|
5394
5394
|
if (!s || !t.contains(s)) return;
|
|
5395
|
-
let c = s.closest(`[${
|
|
5395
|
+
let c = s.closest(`[${N}]`);
|
|
5396
5396
|
if (!c) return;
|
|
5397
5397
|
if (a.rows === 1 && a.cols === 1) {
|
|
5398
5398
|
e.preventDefault(), e.stopPropagation(), this.insertSingleCellPayloadInline(a.cells[0][0]);
|
|
5399
5399
|
return;
|
|
5400
5400
|
}
|
|
5401
5401
|
e.preventDefault(), e.stopPropagation();
|
|
5402
|
-
let l = Array.from(t.querySelectorAll(`[${
|
|
5402
|
+
let l = Array.from(t.querySelectorAll(`[${N}]`)).indexOf(c), u = Array.from(c.querySelectorAll(`[${P}]`)).indexOf(s);
|
|
5403
5403
|
this.pastePayloadIntoCells(t, a, l, u);
|
|
5404
5404
|
}
|
|
5405
5405
|
insertSingleCellPayloadInline(e) {
|
|
@@ -5420,11 +5420,11 @@ var Or = (e) => {
|
|
|
5420
5420
|
this.runTransactedStructuralOp(() => {
|
|
5421
5421
|
var i, a;
|
|
5422
5422
|
this.expandGridForPaste(e, n + t.rows, r + t.cols);
|
|
5423
|
-
let o = e.querySelectorAll(`[${
|
|
5423
|
+
let o = e.querySelectorAll(`[${N}]`);
|
|
5424
5424
|
Array.from({ length: t.rows }, (e, t) => t).forEach((e) => {
|
|
5425
5425
|
let i = o[n + e];
|
|
5426
5426
|
if (!i) return;
|
|
5427
|
-
let a = i.querySelectorAll(`[${
|
|
5427
|
+
let a = i.querySelectorAll(`[${P}]`);
|
|
5428
5428
|
Array.from({ length: t.cols }, (e, t) => t).forEach((i) => {
|
|
5429
5429
|
let o = a[r + i];
|
|
5430
5430
|
if (o) {
|
|
@@ -5439,7 +5439,7 @@ var Or = (e) => {
|
|
|
5439
5439
|
});
|
|
5440
5440
|
}), this.initResize(e), (i = this.addControls) == null || i.syncRowButtonWidth(), (a = this.rowColControls) == null || a.refresh();
|
|
5441
5441
|
});
|
|
5442
|
-
let i = e.querySelectorAll(`[${
|
|
5442
|
+
let i = e.querySelectorAll(`[${N}]`)[n + t.rows - 1], a = i == null ? void 0 : i.querySelectorAll(`[${P}]`)[r + t.cols - 1];
|
|
5443
5443
|
if (!a || !this.cellBlocks || !this.api.caret) return;
|
|
5444
5444
|
let o = this.cellBlocks.getBlockIdsFromCells([a]), s = o[o.length - 1];
|
|
5445
5445
|
s !== void 0 && this.api.caret.setToBlock(s, "end");
|
|
@@ -5447,11 +5447,11 @@ var Or = (e) => {
|
|
|
5447
5447
|
expandGridForPaste(e, t, n) {
|
|
5448
5448
|
let r = this.grid.getRowCount(e), i = this.grid.getColumnCount(e);
|
|
5449
5449
|
Array.from({ length: Math.max(0, t - r) }).forEach(() => {
|
|
5450
|
-
this.grid.addRow(e), this.model.addRow(),
|
|
5450
|
+
this.grid.addRow(e), this.model.addRow(), V(e, this.cellBlocks), H(this.gridElement, this.model.withHeadings), U(this.gridElement, this.model.withHeadingColumn);
|
|
5451
5451
|
}), Array.from({ length: Math.max(0, n - i) }).forEach(() => {
|
|
5452
5452
|
var t;
|
|
5453
|
-
let n = (t = this.model.colWidths) == null ?
|
|
5454
|
-
this.grid.addColumn(e, void 0, n, r), this.model.addColumn(void 0, r), this.model.setColWidths([...n, r]),
|
|
5453
|
+
let n = (t = this.model.colWidths) == null ? R(e) : t, r = this.model.initialColWidth === void 0 ? B(n) : Math.round(this.model.initialColWidth / 2 * 100) / 100;
|
|
5454
|
+
this.grid.addColumn(e, void 0, n, r), this.model.addColumn(void 0, r), this.model.setColWidths([...n, r]), V(e, this.cellBlocks), U(this.gridElement, this.model.withHeadingColumn);
|
|
5455
5455
|
});
|
|
5456
5456
|
}
|
|
5457
5457
|
pasteCellPayload(e, t) {
|
|
@@ -5459,7 +5459,7 @@ var Or = (e) => {
|
|
|
5459
5459
|
let t = this.cellBlocks.getBlockIdsFromCells([e]);
|
|
5460
5460
|
this.cellBlocks.deleteBlocks(t);
|
|
5461
5461
|
}
|
|
5462
|
-
let n = e.querySelector(`[${
|
|
5462
|
+
let n = e.querySelector(`[${L}]`);
|
|
5463
5463
|
if (n) {
|
|
5464
5464
|
if (t.blocks.length === 0) {
|
|
5465
5465
|
var r;
|
|
@@ -5499,7 +5499,7 @@ var Or = (e) => {
|
|
|
5499
5499
|
newData: e,
|
|
5500
5500
|
inPlace: !1
|
|
5501
5501
|
};
|
|
5502
|
-
let i =
|
|
5502
|
+
let i = k(k({}, e), t);
|
|
5503
5503
|
return typeof t.text == "string" && (r.innerHTML = t.text), {
|
|
5504
5504
|
newData: i,
|
|
5505
5505
|
inPlace: !0
|
|
@@ -5524,11 +5524,11 @@ var Or = (e) => {
|
|
|
5524
5524
|
}
|
|
5525
5525
|
get placeholder() {
|
|
5526
5526
|
if (this._settings.placeholder) return this._settings.placeholder;
|
|
5527
|
-
let e = this.api.i18n.t(
|
|
5527
|
+
let e = this.api.i18n.t(He);
|
|
5528
5528
|
return e === "tools.toggle.placeholder" ? "Toggle" : e;
|
|
5529
5529
|
}
|
|
5530
5530
|
render() {
|
|
5531
|
-
let e =
|
|
5531
|
+
let e = Mt({
|
|
5532
5532
|
data: this._data,
|
|
5533
5533
|
readOnly: this.readOnly,
|
|
5534
5534
|
isOpen: this._isOpen,
|
|
@@ -5536,10 +5536,10 @@ var Or = (e) => {
|
|
|
5536
5536
|
keydownHandler: this.readOnly ? null : this.handleKeyDown.bind(this),
|
|
5537
5537
|
onArrowClick: () => this.toggleOpen(),
|
|
5538
5538
|
onBodyPlaceholderClick: this.readOnly ? null : () => this.handleBodyPlaceholderClick(),
|
|
5539
|
-
bodyPlaceholderText: this.api.i18n.t(
|
|
5539
|
+
bodyPlaceholderText: this.api.i18n.t(Je),
|
|
5540
5540
|
ariaLabels: {
|
|
5541
|
-
collapse: this.api.i18n.t(
|
|
5542
|
-
expand: this.api.i18n.t(
|
|
5541
|
+
collapse: this.api.i18n.t(it),
|
|
5542
|
+
expand: this.api.i18n.t(Ge)
|
|
5543
5543
|
}
|
|
5544
5544
|
});
|
|
5545
5545
|
return this._element = e.wrapper, this._contentElement = e.contentElement, this._arrowElement = e.arrowElement, this._bodyPlaceholderElement = e.bodyPlaceholderElement, this._childContainerElement = e.childContainerElement, this._element;
|
|
@@ -5563,16 +5563,16 @@ var Or = (e) => {
|
|
|
5563
5563
|
onPaste(t) {
|
|
5564
5564
|
let n = t.detail;
|
|
5565
5565
|
if (!("data" in n)) return;
|
|
5566
|
-
let r = n.data, i = r.querySelector("summary"), a =
|
|
5566
|
+
let r = n.data, i = r.querySelector("summary"), a = Ke(i === null ? r.innerHTML : i.innerHTML, e.sanitize.text);
|
|
5567
5567
|
this._data = { text: a };
|
|
5568
5568
|
let o = this.getContentElement();
|
|
5569
5569
|
o !== null && (o.innerHTML = a);
|
|
5570
5570
|
}
|
|
5571
5571
|
setData(e) {
|
|
5572
5572
|
let t = ga(this._data, e, this.getContentElement.bind(this));
|
|
5573
|
-
return this._data = t.newData, typeof this._data.isOpen == "boolean" && (this._isOpen = this._data.isOpen), this._arrowElement && this._element &&
|
|
5574
|
-
collapse: this.api.i18n.t(
|
|
5575
|
-
expand: this.api.i18n.t(
|
|
5573
|
+
return this._data = t.newData, typeof this._data.isOpen == "boolean" && (this._isOpen = this._data.isOpen), this._arrowElement && this._element && M(this._arrowElement, this._element, this._isOpen, {
|
|
5574
|
+
collapse: this.api.i18n.t(it),
|
|
5575
|
+
expand: this.api.i18n.t(Ge)
|
|
5576
5576
|
}), this.updateChildrenVisibility(), this.updateBodyPlaceholderVisibility(), t.inPlace;
|
|
5577
5577
|
}
|
|
5578
5578
|
renderSettings() {
|
|
@@ -5599,9 +5599,9 @@ var Or = (e) => {
|
|
|
5599
5599
|
return this._contentElement;
|
|
5600
5600
|
}
|
|
5601
5601
|
setOpenState(e) {
|
|
5602
|
-
this._isOpen = e, this._arrowElement && this._element &&
|
|
5603
|
-
collapse: this.api.i18n.t(
|
|
5604
|
-
expand: this.api.i18n.t(
|
|
5602
|
+
this._isOpen = e, this._arrowElement && this._element && M(this._arrowElement, this._element, this._isOpen, {
|
|
5603
|
+
collapse: this.api.i18n.t(it),
|
|
5604
|
+
expand: this.api.i18n.t(Ge)
|
|
5605
5605
|
}), this.updateChildrenVisibility(), this.updateBodyPlaceholderVisibility();
|
|
5606
5606
|
}
|
|
5607
5607
|
toggleOpen() {
|
|
@@ -5658,7 +5658,7 @@ var Or = (e) => {
|
|
|
5658
5658
|
}
|
|
5659
5659
|
static get toolbox() {
|
|
5660
5660
|
return {
|
|
5661
|
-
icon:
|
|
5661
|
+
icon: Ve,
|
|
5662
5662
|
title: "Toggle list",
|
|
5663
5663
|
titleKey: "toggleList",
|
|
5664
5664
|
name: Ze,
|
|
@@ -5706,24 +5706,27 @@ var Or = (e) => {
|
|
|
5706
5706
|
static get isReadOnlySupported() {
|
|
5707
5707
|
return !0;
|
|
5708
5708
|
}
|
|
5709
|
-
}, va = "callout", ya = "tools.callout.color", ba = "tools.callout.editIcon", xa = "tools.callout.addEmoji", Sa = "tools.callout.removeEmoji", Ca = "tools.callout.filterEmojis", wa = "tools.callout.calloutEmojiCategory", Ta = "tools.callout.noEmojisFound", Ea = "tools.callout.pickRandom", Da = "tools.callout.skinTone", Oa = "tools.callout.emojiCategoryPeople", ka = "tools.callout.emojiCategoryNature", Aa = "tools.callout.emojiCategoryFood", ja = "tools.callout.emojiCategoryActivity", Ma = "tools.callout.emojiCategoryTravel", Na = "tools.callout.emojiCategoryObjects", Pa = "tools.callout.emojiCategorySymbols", Fa = "tools.callout.emojiCategoryFlags", Ia = "💡", La = "rounded-xl
|
|
5709
|
+
}, va = "callout", ya = "tools.callout.color", ba = "tools.callout.editIcon", xa = "tools.callout.addEmoji", Sa = "tools.callout.removeEmoji", Ca = "tools.callout.filterEmojis", wa = "tools.callout.calloutEmojiCategory", Ta = "tools.callout.noEmojisFound", Ea = "tools.callout.pickRandom", Da = "tools.callout.skinTone", Oa = "tools.callout.emojiCategoryPeople", ka = "tools.callout.emojiCategoryNature", Aa = "tools.callout.emojiCategoryFood", ja = "tools.callout.emojiCategoryActivity", Ma = "tools.callout.emojiCategoryTravel", Na = "tools.callout.emojiCategoryObjects", Pa = "tools.callout.emojiCategorySymbols", Fa = "tools.callout.emojiCategoryFlags", Ia = "💡", La = "rounded-xl pl-8 pr-4 py-[5px] my-1 flex items-start gap-2 relative", Ra = "text-[1.5rem] leading-[1] cursor-pointer bg-transparent border-0 px-0 py-[7px] h-[38px] flex-shrink-0 select-none", za = "flex-1 min-w-0", Ba = "absolute left-0 top-0 h-full cursor-grab select-none";
|
|
5710
5710
|
//#endregion
|
|
5711
5711
|
//#region src/tools/callout/dom-builder.ts
|
|
5712
|
-
function
|
|
5713
|
-
let { emoji:
|
|
5714
|
-
|
|
5715
|
-
let
|
|
5716
|
-
|
|
5717
|
-
let
|
|
5718
|
-
|
|
5719
|
-
|
|
5720
|
-
|
|
5721
|
-
|
|
5712
|
+
function Va(e) {
|
|
5713
|
+
let { emoji: t, readOnly: n, addEmojiLabel: r } = e, i = document.createElement("div");
|
|
5714
|
+
i.className = La;
|
|
5715
|
+
let a = document.createElement("button");
|
|
5716
|
+
a.type = "button", a.className = Ra, a.textContent = t || "", a.setAttribute("aria-label", t === "" ? r : t), a.setAttribute("tabindex", "0"), a.setAttribute("data-blok-testid", "callout-emoji-btn"), n && (a.disabled = !0);
|
|
5717
|
+
let o = document.createElement("div");
|
|
5718
|
+
o.className = za, o.setAttribute(O.toggleChildren, ""), o.setAttribute(D.nestedBlocks, ""), o.setAttribute("data-blok-child-toolbar", ""), o.setAttribute("data-blok-mutation-free", "true"), i.appendChild(a), i.appendChild(o);
|
|
5719
|
+
let s = document.createElement("span");
|
|
5720
|
+
return s.className = Ba, s.style.width = "32px", s.setAttribute("data-callout-drag-zone", ""), i.prepend(s), {
|
|
5721
|
+
wrapper: i,
|
|
5722
|
+
emojiButton: a,
|
|
5723
|
+
childContainer: o,
|
|
5724
|
+
dragZone: s
|
|
5722
5725
|
};
|
|
5723
5726
|
}
|
|
5724
5727
|
//#endregion
|
|
5725
5728
|
//#region src/tools/callout/block-operations.ts
|
|
5726
|
-
function
|
|
5729
|
+
function Ha(e) {
|
|
5727
5730
|
return {
|
|
5728
5731
|
emoji: e.emoji,
|
|
5729
5732
|
textColor: e.textColor,
|
|
@@ -5732,7 +5735,7 @@ function Va(e) {
|
|
|
5732
5735
|
}
|
|
5733
5736
|
//#endregion
|
|
5734
5737
|
//#region src/tools/callout/callout-keyboard.ts
|
|
5735
|
-
async function
|
|
5738
|
+
async function Ua(e) {
|
|
5736
5739
|
if (e.calloutBlockId === void 0) return;
|
|
5737
5740
|
let t = e.api.blocks.getChildren(e.calloutBlockId);
|
|
5738
5741
|
if (e.event.preventDefault(), t.length <= 1) {
|
|
@@ -5746,7 +5749,7 @@ async function Ha(e) {
|
|
|
5746
5749
|
}
|
|
5747
5750
|
//#endregion
|
|
5748
5751
|
//#region src/tools/callout/emoji-picker/emoji-data.ts
|
|
5749
|
-
var
|
|
5752
|
+
var Wa = [
|
|
5750
5753
|
"💡",
|
|
5751
5754
|
"👉",
|
|
5752
5755
|
"☝️",
|
|
@@ -5767,8 +5770,8 @@ var Ua = [
|
|
|
5767
5770
|
"📢",
|
|
5768
5771
|
"🛠️",
|
|
5769
5772
|
"⚙️"
|
|
5770
|
-
],
|
|
5771
|
-
function
|
|
5773
|
+
], Ga = { data: null };
|
|
5774
|
+
function Ka(e, t) {
|
|
5772
5775
|
let n = [];
|
|
5773
5776
|
for (let r of e.emojis) {
|
|
5774
5777
|
let i = t[r];
|
|
@@ -5785,12 +5788,12 @@ function Ga(e, t) {
|
|
|
5785
5788
|
}
|
|
5786
5789
|
return n;
|
|
5787
5790
|
}
|
|
5788
|
-
async function
|
|
5789
|
-
if (
|
|
5790
|
-
let e = await import("./native-D0cfLXsM.mjs"), t = "default" in e && e.default !== void 0 ? e.default : e, n = t.categories.flatMap((e) =>
|
|
5791
|
-
return
|
|
5791
|
+
async function qa() {
|
|
5792
|
+
if (Ga.data !== null) return Ga.data;
|
|
5793
|
+
let e = await import("./native-D0cfLXsM.mjs"), t = "default" in e && e.default !== void 0 ? e.default : e, n = t.categories.flatMap((e) => Ka(e, t.emojis));
|
|
5794
|
+
return Ga.data = n, n;
|
|
5792
5795
|
}
|
|
5793
|
-
function
|
|
5796
|
+
function Ja(e, t, n) {
|
|
5794
5797
|
let r = t.toLowerCase();
|
|
5795
5798
|
return e.filter((e) => {
|
|
5796
5799
|
if (e.name.toLowerCase().includes(r) || e.keywords.some((e) => e.includes(r))) return !0;
|
|
@@ -5798,7 +5801,7 @@ function qa(e, t, n) {
|
|
|
5798
5801
|
return t === void 0 ? !1 : t.n.toLowerCase().includes(r) || t.k !== void 0 && t.k.some((e) => e.toLowerCase().includes(r));
|
|
5799
5802
|
});
|
|
5800
5803
|
}
|
|
5801
|
-
function
|
|
5804
|
+
function Ya(e) {
|
|
5802
5805
|
let t = /* @__PURE__ */ new Map();
|
|
5803
5806
|
for (let r of e) {
|
|
5804
5807
|
var n;
|
|
@@ -5809,7 +5812,7 @@ function Ja(e) {
|
|
|
5809
5812
|
}
|
|
5810
5813
|
//#endregion
|
|
5811
5814
|
//#region src/tools/callout/emoji-picker/emoji-locale.ts
|
|
5812
|
-
var
|
|
5815
|
+
var Xa = /* @__PURE__ */ new Map(), Za = {
|
|
5813
5816
|
am: () => import("./am-BxlkYGsI.mjs"),
|
|
5814
5817
|
ar: () => import("./ar-9vlpr9V8.mjs"),
|
|
5815
5818
|
az: () => import("./az-ON63W_FP.mjs"),
|
|
@@ -5876,22 +5879,22 @@ var Ya = /* @__PURE__ */ new Map(), Xa = {
|
|
|
5876
5879
|
vi: () => import("./vi-bt-3LPGO.mjs"),
|
|
5877
5880
|
zh: () => import("./zh-Dgyb5Ly8.mjs")
|
|
5878
5881
|
};
|
|
5879
|
-
async function
|
|
5882
|
+
async function Qa(e) {
|
|
5880
5883
|
if (e === "en") return null;
|
|
5881
|
-
let t =
|
|
5884
|
+
let t = Xa.get(e);
|
|
5882
5885
|
if (t !== void 0) return t;
|
|
5883
|
-
let n =
|
|
5886
|
+
let n = Za[e];
|
|
5884
5887
|
if (n === void 0) return null;
|
|
5885
5888
|
try {
|
|
5886
5889
|
let t = (await n()).default;
|
|
5887
|
-
return
|
|
5890
|
+
return Xa.set(e, t), t;
|
|
5888
5891
|
} catch (e) {
|
|
5889
5892
|
return null;
|
|
5890
5893
|
}
|
|
5891
5894
|
}
|
|
5892
5895
|
//#endregion
|
|
5893
5896
|
//#region src/tools/callout/emoji-picker/index.ts
|
|
5894
|
-
var
|
|
5897
|
+
var $a = {
|
|
5895
5898
|
callout: wa,
|
|
5896
5899
|
people: Oa,
|
|
5897
5900
|
nature: ka,
|
|
@@ -5901,27 +5904,27 @@ var Qa = {
|
|
|
5901
5904
|
objects: Na,
|
|
5902
5905
|
symbols: Pa,
|
|
5903
5906
|
flags: Fa
|
|
5904
|
-
},
|
|
5905
|
-
["callout",
|
|
5906
|
-
["people",
|
|
5907
|
-
["nature",
|
|
5908
|
-
["foods",
|
|
5909
|
-
["activity",
|
|
5910
|
-
["places",
|
|
5911
|
-
["objects",
|
|
5912
|
-
["symbols",
|
|
5913
|
-
["flags",
|
|
5914
|
-
],
|
|
5907
|
+
}, eo = [
|
|
5908
|
+
["callout", he],
|
|
5909
|
+
["people", p],
|
|
5910
|
+
["nature", de],
|
|
5911
|
+
["foods", d],
|
|
5912
|
+
["activity", y],
|
|
5913
|
+
["places", mt],
|
|
5914
|
+
["objects", pe],
|
|
5915
|
+
["symbols", r],
|
|
5916
|
+
["flags", C]
|
|
5917
|
+
], to = [
|
|
5915
5918
|
"✋",
|
|
5916
5919
|
"✋🏻",
|
|
5917
5920
|
"✋🏼",
|
|
5918
5921
|
"✋🏽",
|
|
5919
5922
|
"✋🏾",
|
|
5920
5923
|
"✋🏿"
|
|
5921
|
-
],
|
|
5922
|
-
function
|
|
5924
|
+
], no = "blok-emoji-skin-tone";
|
|
5925
|
+
function ro() {
|
|
5923
5926
|
try {
|
|
5924
|
-
let e = localStorage.getItem(
|
|
5927
|
+
let e = localStorage.getItem(no);
|
|
5925
5928
|
if (e === null) return 0;
|
|
5926
5929
|
let t = parseInt(e, 10);
|
|
5927
5930
|
return t >= 0 && t <= 5 ? t : 0;
|
|
@@ -5929,12 +5932,12 @@ function no() {
|
|
|
5929
5932
|
return 0;
|
|
5930
5933
|
}
|
|
5931
5934
|
}
|
|
5932
|
-
function
|
|
5935
|
+
function io(e) {
|
|
5933
5936
|
try {
|
|
5934
|
-
localStorage.setItem(
|
|
5937
|
+
localStorage.setItem(no, String(e));
|
|
5935
5938
|
} catch (e) {}
|
|
5936
5939
|
}
|
|
5937
|
-
var
|
|
5940
|
+
var ao = "<svg width=\"14\" height=\"14\" viewBox=\"0 0 14 14\" fill=\"none\"><rect x=\"1.5\" y=\"1.5\" width=\"11\" height=\"11\" rx=\"2\" stroke=\"currentColor\" stroke-width=\"1.2\"/><circle cx=\"4.5\" cy=\"4.5\" r=\".9\" fill=\"currentColor\"/><circle cx=\"7\" cy=\"7\" r=\".9\" fill=\"currentColor\"/><circle cx=\"9.5\" cy=\"9.5\" r=\".9\" fill=\"currentColor\"/></svg>", oo = class {
|
|
5938
5941
|
constructor(e) {
|
|
5939
5942
|
this._localeData = null, this._open = !1, this._allEmojis = [], this._skinTone = 0, this._showingEmptyState = !1, this._anchorEl = null, this._backdrop = null, this._savedOverflow = "", this._navButtons = /* @__PURE__ */ new Map(), this._sectionEls = /* @__PURE__ */ new Map(), this._activeNavId = "", this._navRafId = 0, this._skinToneButtons = [], this.onSelect = e.onSelect, this.onRemove = e.onRemove, this.i18n = e.i18n, this._locale = e.locale, this._element = this.buildElement();
|
|
5940
5943
|
let t = this._element.querySelector("[data-emoji-picker-body]"), n = this._element.querySelector("[data-emoji-picker-nav]"), r = this._element.querySelector("input[type=\"text\"]");
|
|
@@ -5952,13 +5955,13 @@ var io = "<svg width=\"14\" height=\"14\" viewBox=\"0 0 14 14\" fill=\"none\"><r
|
|
|
5952
5955
|
async open(e) {
|
|
5953
5956
|
var t = this;
|
|
5954
5957
|
t._anchorEl = e, t._open = !0, t._filterInput.value = "", t._element.setAttribute("data-theme", t.resolveTheme());
|
|
5955
|
-
let n =
|
|
5958
|
+
let n = ro();
|
|
5956
5959
|
if (n !== t._skinTone) {
|
|
5957
|
-
t._skinTone = n, t._skinToneToggle.textContent =
|
|
5960
|
+
t._skinTone = n, t._skinToneToggle.textContent = to[n];
|
|
5958
5961
|
for (let [e, r] of t._skinToneButtons.entries()) t.applySkinToneActiveStyle(r, e === n);
|
|
5959
5962
|
}
|
|
5960
|
-
if (t._allEmojis.length === 0 && (t._allEmojis = await
|
|
5961
|
-
let e = await
|
|
5963
|
+
if (t._allEmojis.length === 0 && (t._allEmojis = await qa()), t._locale !== "en" && t._localeData === null) {
|
|
5964
|
+
let e = await Qa(t._locale);
|
|
5962
5965
|
e !== null && (t._localeData = e);
|
|
5963
5966
|
}
|
|
5964
5967
|
t.renderEmojiGrid(t._allEmojis), t.showBackdrop(), t._element.style.animation = "none", t._element.hidden = !1, t.position(e), t._element.offsetHeight, t._element.style.animation = "", t._filterInput.focus();
|
|
@@ -5979,7 +5982,7 @@ var io = "<svg width=\"14\" height=\"14\" viewBox=\"0 0 14 14\" fill=\"none\"><r
|
|
|
5979
5982
|
let n = document.createElement("div");
|
|
5980
5983
|
n.className = "relative flex-1 min-w-0";
|
|
5981
5984
|
let r = document.createElement("span");
|
|
5982
|
-
r.className = ["pointer-events-none absolute left-2.5 top-1/2 -translate-y-1/2 flex items-center", "text-neutral-400 theme-dark:text-neutral-500 [&>svg]:w-[16px] [&>svg]:h-[16px]"].join(" "), r.innerHTML =
|
|
5985
|
+
r.className = ["pointer-events-none absolute left-2.5 top-1/2 -translate-y-1/2 flex items-center", "text-neutral-400 theme-dark:text-neutral-500 [&>svg]:w-[16px] [&>svg]:h-[16px]"].join(" "), r.innerHTML = ft;
|
|
5983
5986
|
let i = document.createElement("input");
|
|
5984
5987
|
i.type = "text", i.placeholder = this.i18n.t(Ca), i.className = [
|
|
5985
5988
|
"w-full text-[13px] rounded-lg py-[7px] pl-8 pr-3 outline-hidden",
|
|
@@ -5996,14 +5999,14 @@ var io = "<svg width=\"14\" height=\"14\" viewBox=\"0 0 14 14\" fill=\"none\"><r
|
|
|
5996
5999
|
"text-[14px] leading-none cursor-pointer select-none",
|
|
5997
6000
|
"hover:bg-neutral-100 theme-dark:hover:bg-neutral-800",
|
|
5998
6001
|
"active:scale-90 transition-all duration-100"
|
|
5999
|
-
].join(" "), o.textContent =
|
|
6002
|
+
].join(" "), o.textContent = to[this._skinTone], o.addEventListener("click", () => this.toggleSkinTonePopover()), this._skinToneToggle = o, a.appendChild(o), this._skinTonePopover = this.buildSkinTonePopover(), a.appendChild(this._skinTonePopover);
|
|
6000
6003
|
let s = document.createElement("button");
|
|
6001
6004
|
s.type = "button", s.setAttribute("data-emoji-picker-random", ""), s.setAttribute("aria-label", this.i18n.t(Ea)), s.className = [
|
|
6002
6005
|
"flex-shrink-0 w-[34px] h-[34px] flex items-center justify-center rounded-lg",
|
|
6003
6006
|
"text-neutral-400 hover:bg-neutral-100 hover:text-neutral-600",
|
|
6004
6007
|
"theme-dark:hover:bg-neutral-800 theme-dark:hover:text-neutral-300",
|
|
6005
6008
|
"transition-colors duration-100 cursor-pointer"
|
|
6006
|
-
].join(" "), s.innerHTML =
|
|
6009
|
+
].join(" "), s.innerHTML = ao, s.addEventListener("click", () => this.pickRandom()), T(s, this.i18n.t(Ea), { placement: "bottom" });
|
|
6007
6010
|
let c = document.createElement("button");
|
|
6008
6011
|
c.type = "button", c.setAttribute("data-emoji-picker-remove", ""), c.setAttribute("aria-label", this.i18n.t(Sa)), c.className = [
|
|
6009
6012
|
"flex-shrink-0 w-[34px] h-[34px] flex items-center justify-center rounded-lg",
|
|
@@ -6012,7 +6015,7 @@ var io = "<svg width=\"14\" height=\"14\" viewBox=\"0 0 14 14\" fill=\"none\"><r
|
|
|
6012
6015
|
"transition-colors duration-100 cursor-pointer"
|
|
6013
6016
|
].join(" "), c.innerHTML = "<svg width=\"14\" height=\"14\" viewBox=\"0 0 14 14\" fill=\"none\"><path d=\"M3.5 3.5l7 7M10.5 3.5l-7 7\" stroke=\"currentColor\" stroke-width=\"1.5\" stroke-linecap=\"round\"/></svg>", c.addEventListener("click", () => {
|
|
6014
6017
|
this.onRemove(), this.close();
|
|
6015
|
-
}),
|
|
6018
|
+
}), T(c, this.i18n.t(Sa), { placement: "bottom" });
|
|
6016
6019
|
let l = document.createElement("div");
|
|
6017
6020
|
l.className = "flex items-center gap-1", l.appendChild(s), l.appendChild(c), t.appendChild(n), t.appendChild(a), t.appendChild(l), e.appendChild(t);
|
|
6018
6021
|
let u = document.createElement("div");
|
|
@@ -6039,7 +6042,7 @@ var io = "<svg width=\"14\" height=\"14\" viewBox=\"0 0 14 14\" fill=\"none\"><r
|
|
|
6039
6042
|
"bg-white border border-neutral-200/70 shadow-lg",
|
|
6040
6043
|
"theme-dark:bg-neutral-800 theme-dark:border-neutral-700/50"
|
|
6041
6044
|
].join(" "), e.hidden = !0, this._skinToneButtons = [];
|
|
6042
|
-
for (let [t, n] of
|
|
6045
|
+
for (let [t, n] of to.entries()) {
|
|
6043
6046
|
let r = document.createElement("button");
|
|
6044
6047
|
r.type = "button", r.textContent = n, r.setAttribute("aria-label", `${this.i18n.t(Da)} ${t + 1}`), r.className = [
|
|
6045
6048
|
"w-[32px] h-[32px] flex items-center justify-center rounded-lg",
|
|
@@ -6073,7 +6076,7 @@ var io = "<svg width=\"14\" height=\"14\" viewBox=\"0 0 14 14\" fill=\"none\"><r
|
|
|
6073
6076
|
e ? this._skinToneToggle.classList.add(...t) : this._skinToneToggle.classList.remove(...t);
|
|
6074
6077
|
}
|
|
6075
6078
|
setSkinTone(e) {
|
|
6076
|
-
this._skinTone = e,
|
|
6079
|
+
this._skinTone = e, io(e), this._skinToneToggle.textContent = to[e];
|
|
6077
6080
|
for (let [t, n] of this._skinToneButtons.entries()) this.applySkinToneActiveStyle(n, t === e);
|
|
6078
6081
|
let t = Array.from(this._body.querySelectorAll("[data-emoji-native]"));
|
|
6079
6082
|
for (let e of t) {
|
|
@@ -6090,7 +6093,7 @@ var io = "<svg width=\"14\" height=\"14\" viewBox=\"0 0 14 14\" fill=\"none\"><r
|
|
|
6090
6093
|
}
|
|
6091
6094
|
buildCategoryNav(e) {
|
|
6092
6095
|
this._nav.innerHTML = "", this._navButtons.clear(), this._activeNavId = "";
|
|
6093
|
-
for (let [t, n] of
|
|
6096
|
+
for (let [t, n] of eo) {
|
|
6094
6097
|
if (!e.has(t)) continue;
|
|
6095
6098
|
let r = this.translateCategory(t), i = document.createElement("button");
|
|
6096
6099
|
i.type = "button", i.innerHTML = n, i.title = r, i.setAttribute("aria-label", r), i.setAttribute("data-emoji-nav", t), i.className = [
|
|
@@ -6130,11 +6133,11 @@ var io = "<svg width=\"14\" height=\"14\" viewBox=\"0 0 14 14\" fill=\"none\"><r
|
|
|
6130
6133
|
return;
|
|
6131
6134
|
}
|
|
6132
6135
|
this._nav.hidden = !0;
|
|
6133
|
-
let t =
|
|
6136
|
+
let t = Ja(this._allEmojis, e, this._localeData);
|
|
6134
6137
|
if (t.length === 0) this._showingEmptyState || this.renderEmptyState();
|
|
6135
6138
|
else {
|
|
6136
6139
|
this._body.innerHTML = "", this._sectionEls.clear(), this._showingEmptyState = !1;
|
|
6137
|
-
let e =
|
|
6140
|
+
let e = Ya(t);
|
|
6138
6141
|
for (let [t, n] of e) {
|
|
6139
6142
|
let e = this.buildSection(this.translateCategory(t), n);
|
|
6140
6143
|
e.setAttribute("data-emoji-section", t), this._sectionEls.set(t, e), this._body.appendChild(e);
|
|
@@ -6143,13 +6146,13 @@ var io = "<svg width=\"14\" height=\"14\" viewBox=\"0 0 14 14\" fill=\"none\"><r
|
|
|
6143
6146
|
}
|
|
6144
6147
|
renderEmojiGrid(e) {
|
|
6145
6148
|
this._body.innerHTML = "", this._sectionEls.clear(), this._showingEmptyState = !1;
|
|
6146
|
-
let t = /* @__PURE__ */ new Set(), n =
|
|
6149
|
+
let t = /* @__PURE__ */ new Set(), n = Wa.map((t) => e.find((e) => e.native === t)).filter((e) => e !== void 0);
|
|
6147
6150
|
if (n.length > 0) {
|
|
6148
6151
|
t.add("callout");
|
|
6149
6152
|
let e = this.buildSection(this.translateCategory("callout"), n);
|
|
6150
6153
|
e.setAttribute("data-emoji-section", "callout"), this._sectionEls.set("callout", e), this._body.appendChild(e);
|
|
6151
6154
|
}
|
|
6152
|
-
let r = new Set(
|
|
6155
|
+
let r = new Set(Wa), i = Ya(e.filter((e) => !r.has(e.native)));
|
|
6153
6156
|
for (let [e, n] of i) {
|
|
6154
6157
|
t.add(e);
|
|
6155
6158
|
let r = this.buildSection(this.translateCategory(e), n);
|
|
@@ -6166,12 +6169,12 @@ var io = "<svg width=\"14\" height=\"14\" viewBox=\"0 0 14 14\" fill=\"none\"><r
|
|
|
6166
6169
|
"animate-[blok-emoji-empty-in_300ms_ease-out_both]"
|
|
6167
6170
|
].join(" ");
|
|
6168
6171
|
let t = document.createElement("span");
|
|
6169
|
-
t.className = "mb-3 opacity-20 [&>svg]:w-9 [&>svg]:h-9", t.innerHTML =
|
|
6172
|
+
t.className = "mb-3 opacity-20 [&>svg]:w-9 [&>svg]:h-9", t.innerHTML = ft;
|
|
6170
6173
|
let n = document.createElement("span");
|
|
6171
6174
|
n.className = "text-[13px] font-medium", n.textContent = this.i18n.t(Ta), e.appendChild(t), e.appendChild(n), this._body.appendChild(e);
|
|
6172
6175
|
}
|
|
6173
6176
|
translateCategory(e) {
|
|
6174
|
-
let t =
|
|
6177
|
+
let t = $a[e];
|
|
6175
6178
|
return t === void 0 ? e : this.i18n.t(t);
|
|
6176
6179
|
}
|
|
6177
6180
|
buildSection(e, t) {
|
|
@@ -6199,7 +6202,7 @@ var io = "<svg width=\"14\" height=\"14\" viewBox=\"0 0 14 14\" fill=\"none\"><r
|
|
|
6199
6202
|
"transition-transform duration-75"
|
|
6200
6203
|
].join(" "), e.addEventListener("click", () => {
|
|
6201
6204
|
this.onSelect(this.getSkinnedNative(n)), this.close();
|
|
6202
|
-
}),
|
|
6205
|
+
}), T(e, this.getDisplayName(n), { placement: "bottom" }), t.appendChild(e);
|
|
6203
6206
|
}
|
|
6204
6207
|
return t;
|
|
6205
6208
|
}
|
|
@@ -6226,10 +6229,10 @@ var io = "<svg width=\"14\" height=\"14\" viewBox=\"0 0 14 14\" fill=\"none\"><r
|
|
|
6226
6229
|
};
|
|
6227
6230
|
//#endregion
|
|
6228
6231
|
//#region src/tools/callout/index.ts
|
|
6229
|
-
function
|
|
6232
|
+
function so(e) {
|
|
6230
6233
|
return e.isEmojiVisible === !1 ? "" : typeof e.emoji == "string" && e.emoji.length > 0 ? e.emoji : Ia;
|
|
6231
6234
|
}
|
|
6232
|
-
var
|
|
6235
|
+
var co = {
|
|
6233
6236
|
general: null,
|
|
6234
6237
|
note: "blue",
|
|
6235
6238
|
important: "purple",
|
|
@@ -6237,9 +6240,9 @@ var so = {
|
|
|
6237
6240
|
additional: "yellow",
|
|
6238
6241
|
recommendation: "green",
|
|
6239
6242
|
caution: "red"
|
|
6240
|
-
},
|
|
6243
|
+
}, lo = class {
|
|
6241
6244
|
constructor({ data: e, api: t, readOnly: n, block: r }) {
|
|
6242
|
-
this._dom = null, this._emojiPicker = null, this._colorPicker = null, this.api = t, this.readOnly = n, this._data = this.normalizeData(e), r && (this.blockId = r.id);
|
|
6245
|
+
this._dom = null, this._emojiPicker = null, this._colorPicker = null, this._dragZone = null, this.api = t, this.readOnly = n, this._data = this.normalizeData(e), r && (this.blockId = r.id);
|
|
6243
6246
|
}
|
|
6244
6247
|
normalizeData(e) {
|
|
6245
6248
|
let t = e;
|
|
@@ -6250,21 +6253,21 @@ var so = {
|
|
|
6250
6253
|
};
|
|
6251
6254
|
}
|
|
6252
6255
|
normalizeLegacyData(e) {
|
|
6253
|
-
let t = typeof e.variant == "string" ? e.variant : "general", n = t in
|
|
6256
|
+
let t = typeof e.variant == "string" ? e.variant : "general", n = t in co ? co[t] : null;
|
|
6254
6257
|
return {
|
|
6255
|
-
emoji:
|
|
6258
|
+
emoji: so(e),
|
|
6256
6259
|
textColor: null,
|
|
6257
6260
|
backgroundColor: n == null ? null : n
|
|
6258
6261
|
};
|
|
6259
6262
|
}
|
|
6260
6263
|
render() {
|
|
6261
6264
|
if (this._dom) return this._dom.wrapper;
|
|
6262
|
-
let e =
|
|
6265
|
+
let e = Va({
|
|
6263
6266
|
emoji: this._data.emoji,
|
|
6264
6267
|
readOnly: this.readOnly,
|
|
6265
6268
|
addEmojiLabel: this.api.i18n.t(xa)
|
|
6266
6269
|
});
|
|
6267
|
-
return this._dom = e, this.applyColors(), this.readOnly || (e.emojiButton.addEventListener("click", () => this.openEmojiPicker()), e.emojiButton.addEventListener("keydown", (e) => {
|
|
6270
|
+
return this._dom = e, this._dragZone = e.dragZone, this.applyColors(), this.readOnly || (e.emojiButton.addEventListener("click", () => this.openEmojiPicker()), e.emojiButton.addEventListener("keydown", (e) => {
|
|
6268
6271
|
(e.key === "Enter" || e.key === " ") && (e.preventDefault(), this.openEmojiPicker());
|
|
6269
6272
|
}), e.childContainer.addEventListener("keydown", (e) => {
|
|
6270
6273
|
e.key === "Backspace" && this.handleChildBackspace(e);
|
|
@@ -6273,7 +6276,7 @@ var so = {
|
|
|
6273
6276
|
rendered() {
|
|
6274
6277
|
if (this.blockId === void 0 || this._dom === null) return;
|
|
6275
6278
|
let e = this.api.blocks.getChildren(this.blockId);
|
|
6276
|
-
if (
|
|
6279
|
+
if (jt(this._dom.childContainer, e), e.length === 0) {
|
|
6277
6280
|
let e = this.api.blocks.getBlockIndex(this.blockId);
|
|
6278
6281
|
if (e !== void 0) {
|
|
6279
6282
|
let t = this.api.blocks.insertInsideParent(this.blockId, e + 1);
|
|
@@ -6282,7 +6285,7 @@ var so = {
|
|
|
6282
6285
|
}
|
|
6283
6286
|
}
|
|
6284
6287
|
save() {
|
|
6285
|
-
return
|
|
6288
|
+
return Ha({
|
|
6286
6289
|
emoji: this._data.emoji,
|
|
6287
6290
|
textColor: this._data.textColor,
|
|
6288
6291
|
backgroundColor: this._data.backgroundColor
|
|
@@ -6295,7 +6298,7 @@ var so = {
|
|
|
6295
6298
|
var t;
|
|
6296
6299
|
let n = (t = e.detail.data.getAttribute("style")) == null ? "" : t, r = /background(?:-color)?\s*:\s*([^;]+)/i.exec(n);
|
|
6297
6300
|
if (r != null && r[1]) {
|
|
6298
|
-
let e =
|
|
6301
|
+
let e = m(r[1].trim(), "bg");
|
|
6299
6302
|
e && (this._data.backgroundColor = e);
|
|
6300
6303
|
}
|
|
6301
6304
|
this.applyColors();
|
|
@@ -6315,24 +6318,24 @@ var so = {
|
|
|
6315
6318
|
presetField: "bg"
|
|
6316
6319
|
}],
|
|
6317
6320
|
onColorSelect: (t, n) => {
|
|
6318
|
-
let r = t === null ? null :
|
|
6321
|
+
let r = t === null ? null : m(t, n === "color" ? "text" : "bg");
|
|
6319
6322
|
n === "color" ? this._data.textColor = r : this._data.backgroundColor = r, e.setActiveColor(t, n), this.applyColors();
|
|
6320
6323
|
}
|
|
6321
6324
|
});
|
|
6322
6325
|
this._colorPicker = e;
|
|
6323
6326
|
}
|
|
6324
6327
|
return this.syncPickerActiveColors(), [{
|
|
6325
|
-
icon:
|
|
6328
|
+
icon: p,
|
|
6326
6329
|
title: this.api.i18n.t(ba),
|
|
6327
6330
|
name: "callout-edit-icon",
|
|
6328
6331
|
closeOnActivate: !0,
|
|
6329
6332
|
onActivate: () => this.openEmojiPicker()
|
|
6330
6333
|
}, {
|
|
6331
|
-
icon:
|
|
6334
|
+
icon: Ne,
|
|
6332
6335
|
title: this.api.i18n.t(ya),
|
|
6333
6336
|
name: "callout-color",
|
|
6334
6337
|
children: { items: [{
|
|
6335
|
-
type:
|
|
6338
|
+
type: w.Html,
|
|
6336
6339
|
element: this._colorPicker.element
|
|
6337
6340
|
}] }
|
|
6338
6341
|
}];
|
|
@@ -6341,16 +6344,19 @@ var so = {
|
|
|
6341
6344
|
setReadOnly(e) {
|
|
6342
6345
|
this.readOnly = e, this._dom && (this._dom.emojiButton.disabled = e);
|
|
6343
6346
|
}
|
|
6347
|
+
get dragZone() {
|
|
6348
|
+
return this._dragZone;
|
|
6349
|
+
}
|
|
6344
6350
|
syncPickerActiveColors() {
|
|
6345
6351
|
if (this._colorPicker === null) return;
|
|
6346
6352
|
let e = this._data.textColor, t = this._data.backgroundColor;
|
|
6347
|
-
this._colorPicker.setActiveColor(e === null ? null :
|
|
6353
|
+
this._colorPicker.setActiveColor(e === null ? null : v(e, "text"), "color"), this._colorPicker.setActiveColor(t === null ? null : v(t, "bg"), "background-color");
|
|
6348
6354
|
}
|
|
6349
6355
|
applyColors() {
|
|
6350
6356
|
if (this._dom === null) return;
|
|
6351
6357
|
let { textColor: e, backgroundColor: t } = this._data;
|
|
6352
|
-
if (e === null ? this._dom.wrapper.style.color = "" : this._dom.wrapper.style.color =
|
|
6353
|
-
let e =
|
|
6358
|
+
if (e === null ? this._dom.wrapper.style.color = "" : this._dom.wrapper.style.color = v(e, "text"), t !== null) {
|
|
6359
|
+
let e = v(t, "bg");
|
|
6354
6360
|
this._dom.wrapper.style.backgroundColor = e, this._dom.wrapper.style.border = "", this._dom.wrapper.style.setProperty("--blok-search-input-bg", `light-dark(color-mix(in srgb, ${e} 70%, white), color-mix(in srgb, ${e} 85%, white))`);
|
|
6355
6361
|
} else this._dom.wrapper.style.backgroundColor = "", this._dom.wrapper.style.border = "1px solid var(--blok-callout-default-border, #e5e7eb)", this._dom.wrapper.style.removeProperty("--blok-search-input-bg"), this._dom.wrapper.style.removeProperty("--blok-search-input-border");
|
|
6356
6362
|
}
|
|
@@ -6361,7 +6367,7 @@ var so = {
|
|
|
6361
6367
|
let n = t[0], r = e.target;
|
|
6362
6368
|
if (!n.holder.contains(r)) return;
|
|
6363
6369
|
let i = window.getSelection(), a = i !== null && i.rangeCount > 0 && i.getRangeAt(0).startOffset === 0 && i.getRangeAt(0).collapsed;
|
|
6364
|
-
n.holder.textContent !== "" || !a ||
|
|
6370
|
+
n.holder.textContent !== "" || !a || Ua({
|
|
6365
6371
|
api: this.api,
|
|
6366
6372
|
calloutBlockId: this.blockId,
|
|
6367
6373
|
firstChildBlockId: n.id,
|
|
@@ -6369,7 +6375,7 @@ var so = {
|
|
|
6369
6375
|
});
|
|
6370
6376
|
}
|
|
6371
6377
|
openEmojiPicker() {
|
|
6372
|
-
this._dom !== null && (this._emojiPicker === null && (this._emojiPicker = new
|
|
6378
|
+
this._dom !== null && (this._emojiPicker === null && (this._emojiPicker = new oo({
|
|
6373
6379
|
onSelect: (e) => this.setEmoji(e),
|
|
6374
6380
|
onRemove: () => this.setEmoji(""),
|
|
6375
6381
|
i18n: this.api.i18n,
|
|
@@ -6381,7 +6387,7 @@ var so = {
|
|
|
6381
6387
|
}
|
|
6382
6388
|
static get toolbox() {
|
|
6383
6389
|
return {
|
|
6384
|
-
icon:
|
|
6390
|
+
icon: ie,
|
|
6385
6391
|
title: "Callout",
|
|
6386
6392
|
titleKey: "callout",
|
|
6387
6393
|
name: va,
|
|
@@ -6423,15 +6429,15 @@ var so = {
|
|
|
6423
6429
|
static get isReadOnlySupported() {
|
|
6424
6430
|
return !0;
|
|
6425
6431
|
}
|
|
6426
|
-
},
|
|
6432
|
+
}, uo = class {
|
|
6427
6433
|
constructor(e) {
|
|
6428
6434
|
this.element = null;
|
|
6429
6435
|
}
|
|
6430
6436
|
render() {
|
|
6431
6437
|
let e = document.createElement("div");
|
|
6432
|
-
e.className =
|
|
6438
|
+
e.className = A("py-3", "leading-[1px]");
|
|
6433
6439
|
let t = document.createElement("hr");
|
|
6434
|
-
return t.className =
|
|
6440
|
+
return t.className = A("border-t", "border-border-primary", "border-b-0", "border-l-0", "border-r-0"), e.appendChild(t), this.element = e, e;
|
|
6435
6441
|
}
|
|
6436
6442
|
save() {
|
|
6437
6443
|
return {};
|
|
@@ -6441,7 +6447,7 @@ var so = {
|
|
|
6441
6447
|
}
|
|
6442
6448
|
static get toolbox() {
|
|
6443
6449
|
return {
|
|
6444
|
-
icon:
|
|
6450
|
+
icon: l,
|
|
6445
6451
|
titleKey: "divider",
|
|
6446
6452
|
shortcut: "---",
|
|
6447
6453
|
searchTerms: [
|
|
@@ -6476,7 +6482,7 @@ var so = {
|
|
|
6476
6482
|
static get sanitize() {
|
|
6477
6483
|
return {};
|
|
6478
6484
|
}
|
|
6479
|
-
},
|
|
6485
|
+
}, fo = "tools.quote.placeholder", po = [
|
|
6480
6486
|
"border-l-[3px]",
|
|
6481
6487
|
"border-current",
|
|
6482
6488
|
"pl-[0.9em]",
|
|
@@ -6486,7 +6492,7 @@ var so = {
|
|
|
6486
6492
|
"outline-hidden",
|
|
6487
6493
|
"mt-[0.3em]",
|
|
6488
6494
|
"mb-[0.3em]"
|
|
6489
|
-
],
|
|
6495
|
+
], mo = "text-[1.2em]", ho = class {
|
|
6490
6496
|
constructor({ data: e, api: t, readOnly: n }) {
|
|
6491
6497
|
var r, i;
|
|
6492
6498
|
this.placeholderCleanup = null, this._element = null, this.api = t, this.readOnly = n, this._data = {
|
|
@@ -6499,13 +6505,13 @@ var so = {
|
|
|
6499
6505
|
}
|
|
6500
6506
|
drawView() {
|
|
6501
6507
|
let e = document.createElement("blockquote");
|
|
6502
|
-
return e.className =
|
|
6508
|
+
return e.className = A(this.api.styles.block, po, yt, this._data.size === "large" ? mo : ""), e.setAttribute(D.tool, "quote"), e.contentEditable = "false", this._data.text ? e.innerHTML = this._data.text : this.readOnly && (e.innerHTML = "<br>"), this.readOnly || (e.contentEditable = "true", e.addEventListener("keyup", this.onKeyUp), this.placeholderCleanup = j(e, this.api.i18n.t(fo), "data-blok-placeholder-active")), e;
|
|
6503
6509
|
}
|
|
6504
6510
|
render() {
|
|
6505
6511
|
return this._element || (this._element = this.drawView()), this._element;
|
|
6506
6512
|
}
|
|
6507
6513
|
setReadOnly(e) {
|
|
6508
|
-
this._element && (this.readOnly = e, e ? (this._element.contentEditable = "false", this._element.removeEventListener("keyup", this.onKeyUp), this.placeholderCleanup && (this.placeholderCleanup(), this.placeholderCleanup = null),
|
|
6514
|
+
this._element && (this.readOnly = e, e ? (this._element.contentEditable = "false", this._element.removeEventListener("keyup", this.onKeyUp), this.placeholderCleanup && (this.placeholderCleanup(), this.placeholderCleanup = null), xt(this._element) && (this._element.innerHTML = "<br>")) : (this._element.contentEditable = "true", this._element.addEventListener("keyup", this.onKeyUp), this.placeholderCleanup = j(this._element, this.api.i18n.t(fo), "data-blok-placeholder-active"), this._element.innerHTML === "<br>" && (this._element.innerHTML = "")));
|
|
6509
6515
|
}
|
|
6510
6516
|
save(e) {
|
|
6511
6517
|
return {
|
|
@@ -6526,17 +6532,17 @@ var so = {
|
|
|
6526
6532
|
}
|
|
6527
6533
|
renderSettings() {
|
|
6528
6534
|
return [{
|
|
6529
|
-
icon:
|
|
6535
|
+
icon: pt,
|
|
6530
6536
|
title: this.api.i18n.t("tools.quote.size"),
|
|
6531
6537
|
name: "quote-size",
|
|
6532
6538
|
children: { items: [{
|
|
6533
|
-
icon:
|
|
6539
|
+
icon: pt,
|
|
6534
6540
|
title: this.api.i18n.t("tools.quote.defaultSize"),
|
|
6535
6541
|
onActivate: () => this.setSize("default"),
|
|
6536
6542
|
closeOnActivate: !0,
|
|
6537
6543
|
isActive: this._data.size === "default"
|
|
6538
6544
|
}, {
|
|
6539
|
-
icon:
|
|
6545
|
+
icon: pt,
|
|
6540
6546
|
title: this.api.i18n.t("tools.quote.largeSize"),
|
|
6541
6547
|
onActivate: () => this.setSize("large"),
|
|
6542
6548
|
closeOnActivate: !0,
|
|
@@ -6545,7 +6551,7 @@ var so = {
|
|
|
6545
6551
|
}];
|
|
6546
6552
|
}
|
|
6547
6553
|
setSize(e) {
|
|
6548
|
-
this._data.size = e, this._element && (this._element.className =
|
|
6554
|
+
this._data.size = e, this._element && (this._element.className = A(this.api.styles.block, po, yt, e === "large" ? mo : ""));
|
|
6549
6555
|
}
|
|
6550
6556
|
onPaste(e) {
|
|
6551
6557
|
let t = e.detail;
|
|
@@ -6556,7 +6562,7 @@ var so = {
|
|
|
6556
6562
|
}
|
|
6557
6563
|
static get toolbox() {
|
|
6558
6564
|
return {
|
|
6559
|
-
icon:
|
|
6565
|
+
icon: pt,
|
|
6560
6566
|
title: "Quote",
|
|
6561
6567
|
titleKey: "quote",
|
|
6562
6568
|
searchTerms: [
|
|
@@ -6592,7 +6598,7 @@ var so = {
|
|
|
6592
6598
|
static get pasteConfig() {
|
|
6593
6599
|
return { tags: ["BLOCKQUOTE"] };
|
|
6594
6600
|
}
|
|
6595
|
-
},
|
|
6601
|
+
}, go = "tools.code.language", _o = "tools.code.copied", vo = "tools.code.copyCode", yo = "tools.code.wrapLines", bo = "tools.code.searchLanguage", xo = "plain text", So = [
|
|
6596
6602
|
{
|
|
6597
6603
|
id: "plain text",
|
|
6598
6604
|
name: "Plain Text"
|
|
@@ -6717,64 +6723,79 @@ var so = {
|
|
|
6717
6723
|
id: "lua",
|
|
6718
6724
|
name: "Lua"
|
|
6719
6725
|
}
|
|
6720
|
-
],
|
|
6726
|
+
], Co = "flex flex-col rounded-lg border border-border-secondary bg-bg-secondary overflow-hidden my-1", wo = "flex items-center gap-1 px-3 py-1.5 border-b border-border-primary text-xs text-gray-text", To = "px-1.5 py-0.5 rounded cursor-pointer bg-transparent border-0 text-xs text-gray-text font-medium transition-colors can-hover:hover:bg-item-hover-bg select-none", Eo = "p-1 rounded cursor-pointer bg-transparent border-0 text-gray-text transition-colors can-hover:hover:bg-item-hover-bg flex items-center justify-center", Do = "block px-4 py-3 font-mono text-sm leading-relaxed outline-hidden whitespace-pre-wrap overflow-x-auto min-h-[1.5em]", Oo = "text-xs text-gray-text font-medium select-none", ko = new Set(["latex", "mermaid"]), Ao = "px-4 py-3 overflow-x-auto min-h-[1.5em] flex justify-center", jo = "tools.code.previewToggle", Mo = "absolute right-0 top-full mt-1 min-w-[10rem] rounded-lg bg-bg-secondary border border-border-secondary shadow-lg p-1 z-10", No = "flex items-center gap-2 w-full px-2.5 py-1.5 rounded text-xs text-gray-text cursor-pointer bg-transparent border-0 transition-colors can-hover:hover:bg-item-hover-bg select-none", Po = "one-light", Fo = "vitesse-dark", Io = ".dark", Lo = new Set(So.map((e) => e.id).filter((e) => e !== xo)), Ro = "tools.code.lineNumbers", zo = "flex overflow-hidden", Bo = "select-none text-right pr-3 py-3 font-mono text-sm leading-relaxed text-gray-text/40 border-r border-border-primary shrink-0", Vo = "leading-relaxed";
|
|
6721
6727
|
//#endregion
|
|
6722
6728
|
//#region src/tools/code/dom-builder.ts
|
|
6723
|
-
function Ho(e
|
|
6724
|
-
let
|
|
6725
|
-
|
|
6726
|
-
let
|
|
6727
|
-
|
|
6728
|
-
|
|
6729
|
-
|
|
6730
|
-
codeTab: n,
|
|
6731
|
-
previewTab: r,
|
|
6732
|
-
previewElement: i
|
|
6729
|
+
function Ho(e) {
|
|
6730
|
+
let t = document.createElement("button");
|
|
6731
|
+
t.type = "button", t.className = Eo, t.innerHTML = Re, t.setAttribute("aria-label", e == null ? "Preview" : e), t.setAttribute("data-blok-testid", "code-preview-toggle-btn");
|
|
6732
|
+
let n = document.createElement("div");
|
|
6733
|
+
return n.className = Ao, n.setAttribute("data-blok-testid", "code-preview"), {
|
|
6734
|
+
previewToggleButton: t,
|
|
6735
|
+
previewElement: n
|
|
6733
6736
|
};
|
|
6734
6737
|
}
|
|
6735
6738
|
function Uo(e) {
|
|
6736
|
-
let { code: t, languageName: n, readOnly: r, copyLabel: i, wrapLabel: a, lineNumbersLabel: o, previewable: s,
|
|
6737
|
-
|
|
6738
|
-
let
|
|
6739
|
-
|
|
6740
|
-
let
|
|
6741
|
-
|
|
6742
|
-
let
|
|
6743
|
-
|
|
6744
|
-
let
|
|
6745
|
-
|
|
6746
|
-
|
|
6739
|
+
let { code: t, languageName: n, readOnly: r, copyLabel: i, wrapLabel: a, lineNumbersLabel: o, previewable: s, previewToggleLabel: c } = e, l = document.createElement("div");
|
|
6740
|
+
l.className = Co;
|
|
6741
|
+
let u = document.createElement("div");
|
|
6742
|
+
u.className = wo;
|
|
6743
|
+
let d = document.createElement("button");
|
|
6744
|
+
d.type = "button", d.className = To, d.setAttribute("aria-haspopup", "listbox"), d.setAttribute("data-blok-testid", "code-language-btn");
|
|
6745
|
+
let f = document.createElement("span");
|
|
6746
|
+
f.textContent = n, d.appendChild(f);
|
|
6747
|
+
let p = document.createElement("span");
|
|
6748
|
+
p.className = "inline-flex items-center ml-0.5 -mr-0.5", p.innerHTML = Be, d.appendChild(p);
|
|
6749
|
+
let m = document.createElement("div");
|
|
6750
|
+
m.className = "flex-1";
|
|
6751
|
+
let { previewToggleButton: g, previewElement: ee } = s ? Ho(c) : {
|
|
6752
|
+
previewToggleButton: null,
|
|
6747
6753
|
previewElement: null
|
|
6748
6754
|
}, _ = document.createElement("button");
|
|
6749
|
-
_.type = "button", _.className =
|
|
6755
|
+
_.type = "button", _.className = Eo, _.innerHTML = ne, _.setAttribute("aria-label", i), _.setAttribute("data-blok-testid", "code-copy-btn");
|
|
6750
6756
|
let v = document.createElement("button");
|
|
6751
|
-
v.type = "button", v.className =
|
|
6752
|
-
let y = document.createElement("
|
|
6753
|
-
y.
|
|
6754
|
-
let b = document.createElement("
|
|
6755
|
-
b.
|
|
6756
|
-
let
|
|
6757
|
-
|
|
6758
|
-
let
|
|
6759
|
-
|
|
6757
|
+
v.type = "button", v.className = Eo, v.innerHTML = h, v.setAttribute("aria-label", "More"), v.setAttribute("aria-haspopup", "true"), v.setAttribute("data-blok-testid", "code-more-btn");
|
|
6758
|
+
let y = document.createElement("div");
|
|
6759
|
+
y.className = Mo, y.hidden = !0, y.setAttribute("data-blok-testid", "code-more-menu");
|
|
6760
|
+
let b = document.createElement("button");
|
|
6761
|
+
b.type = "button", b.className = No, b.setAttribute("data-blok-testid", "code-line-numbers-btn");
|
|
6762
|
+
let te = document.createElement("span");
|
|
6763
|
+
te.className = "flex items-center justify-center w-5 h-5", te.innerHTML = rt, b.appendChild(te);
|
|
6764
|
+
let ie = document.createElement("span");
|
|
6765
|
+
ie.textContent = o == null ? "Line numbers" : o, b.appendChild(ie);
|
|
6766
|
+
let x = document.createElement("button");
|
|
6767
|
+
x.type = "button", x.className = No, x.setAttribute("data-blok-testid", "code-wrap-btn");
|
|
6768
|
+
let ae = document.createElement("span");
|
|
6769
|
+
ae.className = "flex items-center justify-center w-5 h-5", ae.innerHTML = re, x.appendChild(ae);
|
|
6770
|
+
let oe = document.createElement("span");
|
|
6771
|
+
oe.textContent = a, x.appendChild(oe), y.appendChild(b), y.appendChild(x);
|
|
6772
|
+
let S = document.createElement("code");
|
|
6773
|
+
S.className = Do, S.setAttribute("data-blok-testid", "code-content"), t && (S.textContent = t), r || (S.setAttribute("contenteditable", "plaintext-only"), S.setAttribute("spellcheck", "false"));
|
|
6774
|
+
let C = document.createElement("div");
|
|
6775
|
+
C.className = Bo, C.setAttribute("aria-hidden", "true"), C.setAttribute("data-blok-testid", "code-gutter");
|
|
6776
|
+
let se = t ? t.split("\n").length : 1;
|
|
6777
|
+
Array.from({ length: se }, (e, t) => {
|
|
6760
6778
|
let n = document.createElement("div");
|
|
6761
|
-
n.className = Vo, n.textContent = String(t + 1),
|
|
6762
|
-
}),
|
|
6763
|
-
let
|
|
6764
|
-
|
|
6765
|
-
let
|
|
6766
|
-
|
|
6767
|
-
|
|
6768
|
-
|
|
6769
|
-
|
|
6770
|
-
|
|
6771
|
-
|
|
6772
|
-
|
|
6773
|
-
|
|
6774
|
-
|
|
6775
|
-
|
|
6776
|
-
|
|
6777
|
-
|
|
6779
|
+
n.className = Vo, n.textContent = String(t + 1), C.appendChild(n);
|
|
6780
|
+
}), u.appendChild(d), u.appendChild(m), g && u.appendChild(g), u.appendChild(_);
|
|
6781
|
+
let ce = document.createElement("div");
|
|
6782
|
+
ce.className = "relative", ce.appendChild(v), ce.appendChild(y), u.appendChild(ce);
|
|
6783
|
+
let le = document.createElement("pre");
|
|
6784
|
+
le.appendChild(S);
|
|
6785
|
+
let ue = document.createElement("div");
|
|
6786
|
+
return ue.className = zo, ue.appendChild(C), ue.appendChild(le), l.appendChild(u), l.appendChild(ue), ee && l.appendChild(ee), {
|
|
6787
|
+
wrapper: l,
|
|
6788
|
+
languageButton: d,
|
|
6789
|
+
lineNumbersButton: b,
|
|
6790
|
+
copyButton: _,
|
|
6791
|
+
wrapButton: x,
|
|
6792
|
+
preElement: le,
|
|
6793
|
+
codeElement: S,
|
|
6794
|
+
gutterElement: C,
|
|
6795
|
+
previewToggleButton: g,
|
|
6796
|
+
previewElement: ee,
|
|
6797
|
+
moreButton: v,
|
|
6798
|
+
moreMenu: y
|
|
6778
6799
|
};
|
|
6779
6800
|
}
|
|
6780
6801
|
//#endregion
|
|
@@ -6870,7 +6891,7 @@ var Xo = class {
|
|
|
6870
6891
|
let t = document.createElement("div");
|
|
6871
6892
|
t.className = "px-2 pt-2 pb-1";
|
|
6872
6893
|
let n = document.createElement("input");
|
|
6873
|
-
n.type = "text", n.placeholder = this._i18n.t(
|
|
6894
|
+
n.type = "text", n.placeholder = this._i18n.t(bo), n.setAttribute("data-blok-testid", "code-language-search"), n.className = [
|
|
6874
6895
|
"w-full text-xs rounded-md py-1.5 px-2.5 outline-hidden",
|
|
6875
6896
|
"bg-neutral-100 text-neutral-800 placeholder:text-neutral-400",
|
|
6876
6897
|
"theme-dark:bg-neutral-800 theme-dark:text-neutral-200 theme-dark:placeholder:text-neutral-500",
|
|
@@ -7011,29 +7032,29 @@ var is = {
|
|
|
7011
7032
|
lua: () => import("./lua-DV0fuZWx.mjs"),
|
|
7012
7033
|
latex: () => import("./latex-24n3TcOR.mjs"),
|
|
7013
7034
|
mermaid: () => import("./mermaid-vF0cEnZ0.mjs")
|
|
7014
|
-
},
|
|
7035
|
+
}, as = {
|
|
7015
7036
|
highlighterPromise: null,
|
|
7016
7037
|
highlighter: null
|
|
7017
7038
|
};
|
|
7018
|
-
function
|
|
7039
|
+
function os(e) {
|
|
7019
7040
|
return Lo.has(e);
|
|
7020
7041
|
}
|
|
7021
|
-
async function
|
|
7022
|
-
return
|
|
7042
|
+
async function ss() {
|
|
7043
|
+
return as.highlighterPromise || (as.highlighterPromise = (async () => {
|
|
7023
7044
|
let { createHighlighterCore: e } = await import("./core-Bm6DWt7D.mjs"), { createJavaScriptRegexEngine: t } = await import("./engine-javascript-CJpnSvzf.mjs"), n = await e({
|
|
7024
7045
|
themes: [import("./one-light-DmNO_Y4X.mjs"), import("./vitesse-dark-CcorSKT2.mjs")],
|
|
7025
7046
|
langs: [],
|
|
7026
7047
|
engine: t()
|
|
7027
7048
|
});
|
|
7028
|
-
return
|
|
7029
|
-
})()),
|
|
7049
|
+
return as.highlighter = n, n;
|
|
7050
|
+
})()), as.highlighterPromise;
|
|
7030
7051
|
}
|
|
7031
|
-
async function
|
|
7052
|
+
async function cs(e, t) {
|
|
7032
7053
|
if (e.getLoadedLanguages().includes(t)) return;
|
|
7033
7054
|
let n = is[t];
|
|
7034
7055
|
n && await e.loadLanguage(await n());
|
|
7035
7056
|
}
|
|
7036
|
-
function
|
|
7057
|
+
function ls(e) {
|
|
7037
7058
|
return {
|
|
7038
7059
|
tokens: e.tokens.map((t) => t.map((t) => {
|
|
7039
7060
|
var n;
|
|
@@ -7046,11 +7067,11 @@ function cs(e) {
|
|
|
7046
7067
|
fg: e.fg
|
|
7047
7068
|
};
|
|
7048
7069
|
}
|
|
7049
|
-
async function
|
|
7050
|
-
if (!
|
|
7070
|
+
async function us(e, t) {
|
|
7071
|
+
if (!os(t)) return null;
|
|
7051
7072
|
try {
|
|
7052
|
-
let n = await
|
|
7053
|
-
await
|
|
7073
|
+
let n = await ss();
|
|
7074
|
+
await cs(n, t);
|
|
7054
7075
|
let r = n.codeToTokens(e, {
|
|
7055
7076
|
lang: t,
|
|
7056
7077
|
theme: Po
|
|
@@ -7059,11 +7080,11 @@ async function ls(e, t) {
|
|
|
7059
7080
|
theme: Fo
|
|
7060
7081
|
});
|
|
7061
7082
|
return {
|
|
7062
|
-
light:
|
|
7063
|
-
dark:
|
|
7083
|
+
light: ls(r),
|
|
7084
|
+
dark: ls(i)
|
|
7064
7085
|
};
|
|
7065
7086
|
} catch (e) {
|
|
7066
|
-
return
|
|
7087
|
+
return as.highlighterPromise = null, as.highlighter = null, null;
|
|
7067
7088
|
}
|
|
7068
7089
|
}
|
|
7069
7090
|
//#endregion
|
|
@@ -7072,26 +7093,26 @@ var W = {
|
|
|
7072
7093
|
stylesheet: null,
|
|
7073
7094
|
knownRules: /* @__PURE__ */ new Set()
|
|
7074
7095
|
};
|
|
7075
|
-
function
|
|
7096
|
+
function ds() {
|
|
7076
7097
|
return typeof CSS < "u" && "highlights" in CSS;
|
|
7077
7098
|
}
|
|
7078
|
-
function
|
|
7099
|
+
function fs() {
|
|
7079
7100
|
return CSS.highlights;
|
|
7080
7101
|
}
|
|
7081
|
-
function
|
|
7102
|
+
function ps() {
|
|
7082
7103
|
return W.stylesheet || (W.stylesheet = new CSSStyleSheet(), document.adoptedStyleSheets = [...document.adoptedStyleSheets, W.stylesheet]), W.stylesheet;
|
|
7083
7104
|
}
|
|
7084
|
-
function
|
|
7105
|
+
function ms(e) {
|
|
7085
7106
|
let t = e.replace("#", "").toLowerCase();
|
|
7086
7107
|
return t.length > 6 ? t.substring(0, 6) : t;
|
|
7087
7108
|
}
|
|
7088
|
-
function
|
|
7109
|
+
function hs(e, t, n, r) {
|
|
7089
7110
|
let i = `${r == null ? "" : r}::${t}`;
|
|
7090
7111
|
if (W.knownRules.has(i)) return;
|
|
7091
7112
|
let a = r ? `${r} ::highlight(${t}) { color: ${n}; }` : `::highlight(${t}) { color: ${n}; }`;
|
|
7092
7113
|
e.insertRule(a, e.cssRules.length), W.knownRules.add(i);
|
|
7093
7114
|
}
|
|
7094
|
-
function
|
|
7115
|
+
function gs(e, t) {
|
|
7095
7116
|
let n = document.createTreeWalker(e, NodeFilter.SHOW_TEXT), r = (i, a) => {
|
|
7096
7117
|
var o, s;
|
|
7097
7118
|
if (!i) {
|
|
@@ -7112,7 +7133,7 @@ function hs(e, t) {
|
|
|
7112
7133
|
};
|
|
7113
7134
|
return r(n.nextNode(), 0);
|
|
7114
7135
|
}
|
|
7115
|
-
function
|
|
7136
|
+
function _s(e) {
|
|
7116
7137
|
return e.split("\n").reduce((e, t) => ({
|
|
7117
7138
|
offsets: [...e.offsets, e.pos],
|
|
7118
7139
|
pos: e.pos + t.length + 1
|
|
@@ -7121,30 +7142,30 @@ function gs(e) {
|
|
|
7121
7142
|
pos: 0
|
|
7122
7143
|
}).offsets;
|
|
7123
7144
|
}
|
|
7124
|
-
function
|
|
7145
|
+
function vs(e, t, n, r, i, a, o, s, c) {
|
|
7125
7146
|
if (!r.content.trim()) return;
|
|
7126
7147
|
let l = n + r.offset, u = l + r.content.length;
|
|
7127
7148
|
if (u > t.length) return;
|
|
7128
|
-
let d =
|
|
7149
|
+
let d = gs(e, l), f = gs(e, u);
|
|
7129
7150
|
if (!(!d || !f)) try {
|
|
7130
7151
|
let e = new Range();
|
|
7131
7152
|
e.setStart(d.node, d.offset), e.setEnd(f.node, f.offset);
|
|
7132
|
-
let t = `blok-${i}-${
|
|
7133
|
-
|
|
7153
|
+
let t = `blok-${i}-${ms(r.color)}`, n = fs();
|
|
7154
|
+
hs(s, t, r.color, a);
|
|
7134
7155
|
let l = n.get(t), u = l == null ? new Highlight() : l;
|
|
7135
7156
|
l || (u.priority = o, n.set(t, u)), u.add(e), c.push([t, e]);
|
|
7136
7157
|
} catch (e) {}
|
|
7137
7158
|
}
|
|
7138
|
-
function
|
|
7159
|
+
function ys(e, t, n, r, i, a, o, s, c) {
|
|
7139
7160
|
for (let [l, u] of r.tokens.entries()) {
|
|
7140
7161
|
let r = n[l];
|
|
7141
|
-
if (r !== void 0) for (let n of u)
|
|
7162
|
+
if (r !== void 0) for (let n of u) vs(e, t, r, n, i, a, o, s, c);
|
|
7142
7163
|
}
|
|
7143
7164
|
}
|
|
7144
|
-
function
|
|
7165
|
+
function bs(e, t) {
|
|
7145
7166
|
var n;
|
|
7146
|
-
if (!
|
|
7147
|
-
let r =
|
|
7167
|
+
if (!ds()) return () => {};
|
|
7168
|
+
let r = ps(), i = [], a = (n = e.textContent) == null ? "" : n, o = _s(a), s = [[
|
|
7148
7169
|
"l",
|
|
7149
7170
|
t.light,
|
|
7150
7171
|
void 0,
|
|
@@ -7155,10 +7176,10 @@ function ys(e, t) {
|
|
|
7155
7176
|
Io,
|
|
7156
7177
|
1
|
|
7157
7178
|
]];
|
|
7158
|
-
for (let [t, n, c, l] of s)
|
|
7159
|
-
return () =>
|
|
7179
|
+
for (let [t, n, c, l] of s) ys(e, a, o, n, t, c, l, r, i);
|
|
7180
|
+
return () => xs(i, fs());
|
|
7160
7181
|
}
|
|
7161
|
-
function
|
|
7182
|
+
function xs(e, t) {
|
|
7162
7183
|
for (let [n, r] of e) {
|
|
7163
7184
|
let e = t.get(n);
|
|
7164
7185
|
e && (e.delete(r), e.size === 0 && t.delete(n));
|
|
@@ -7166,37 +7187,36 @@ function bs(e, t) {
|
|
|
7166
7187
|
}
|
|
7167
7188
|
//#endregion
|
|
7168
7189
|
//#region src/tools/code/index.ts
|
|
7169
|
-
var
|
|
7190
|
+
var Ss = 1500, Cs = class {
|
|
7170
7191
|
constructor({ data: e, api: t, readOnly: n }) {
|
|
7171
7192
|
var r, i, a;
|
|
7172
7193
|
this._dom = null, this._wrapping = !0, this._lineNumbers = !0, this._picker = null, this._previewActive = !1, this._previewContainer = null, this._disposeHighlights = null, this._highlightRafId = null, this.api = t, this.readOnly = n, this._data = {
|
|
7173
7194
|
code: (r = e == null ? void 0 : e.code) == null ? "" : r,
|
|
7174
|
-
language: (i = e == null ? void 0 : e.language) == null ?
|
|
7195
|
+
language: (i = e == null ? void 0 : e.language) == null ? xo : i,
|
|
7175
7196
|
lineNumbers: e == null ? void 0 : e.lineNumbers
|
|
7176
7197
|
}, this._lineNumbers = (a = e == null ? void 0 : e.lineNumbers) == null ? !0 : a;
|
|
7177
7198
|
}
|
|
7178
7199
|
render() {
|
|
7179
|
-
let e =
|
|
7200
|
+
let e = ko.has(this._data.language), t = Uo({
|
|
7180
7201
|
code: this._data.code,
|
|
7181
7202
|
languageName: this.getLanguageName(this._data.language),
|
|
7182
7203
|
readOnly: this.readOnly,
|
|
7183
|
-
copyLabel: this.api.i18n.t(
|
|
7184
|
-
wrapLabel: this.api.i18n.t(
|
|
7204
|
+
copyLabel: this.api.i18n.t(vo),
|
|
7205
|
+
wrapLabel: this.api.i18n.t(yo),
|
|
7185
7206
|
lineNumbersLabel: this.api.i18n.t(Ro),
|
|
7186
7207
|
previewable: this.readOnly ? !1 : e,
|
|
7187
|
-
|
|
7188
|
-
previewTabLabel: this.api.i18n.t(Ao)
|
|
7208
|
+
previewToggleLabel: this.api.i18n.t(jo)
|
|
7189
7209
|
});
|
|
7190
|
-
if (this._dom = t, t.gutterElement.hidden = !this._lineNumbers, t.lineNumbersButton.addEventListener("click", () => this.toggleLineNumbers()), this.readOnly && e) {
|
|
7210
|
+
if (this._dom = t, t.gutterElement.hidden = !this._lineNumbers, t.lineNumbersButton.addEventListener("click", () => this.toggleLineNumbers()), t.moreButton.addEventListener("click", () => this.toggleMoreMenu()), this.readOnly && e) {
|
|
7191
7211
|
let e = document.createElement("div");
|
|
7192
|
-
e.className =
|
|
7212
|
+
e.className = Ao, e.setAttribute("data-blok-testid", "code-preview"), t.wrapper.appendChild(e), t.preElement.hidden = !0, t.gutterElement.hidden = !0, this._previewContainer = e, this.renderPreview();
|
|
7193
7213
|
}
|
|
7194
|
-
return !this.readOnly && e && t.
|
|
7214
|
+
return !this.readOnly && e && t.previewToggleButton && t.previewElement && (this._previewActive = !0, t.preElement.hidden = !0, t.gutterElement.hidden = !0, t.previewElement.hidden = !1, this._previewContainer = t.previewElement, this.renderPreview(), t.previewToggleButton.addEventListener("click", () => this.togglePreview())), this.readOnly || (t.codeElement.addEventListener("keydown", (e) => {
|
|
7195
7215
|
Wo(e, t.codeElement, () => this.exitBlock()) && (e.preventDefault(), this.syncTrailingBr(), this.updateGutter(), this.scheduleHighlight());
|
|
7196
7216
|
}), t.codeElement.addEventListener("input", () => {
|
|
7197
7217
|
this.syncTrailingBr(), this.updateGutter(), this.scheduleHighlight();
|
|
7198
7218
|
})), t.copyButton.addEventListener("click", () => this.copyCode()), t.wrapButton.addEventListener("click", () => this.toggleWrap()), this.readOnly || (this._picker = new Xo({
|
|
7199
|
-
languages:
|
|
7219
|
+
languages: So,
|
|
7200
7220
|
onSelect: (e) => this.setLanguage(e),
|
|
7201
7221
|
i18n: this.api.i18n,
|
|
7202
7222
|
activeLanguageId: this._data.language
|
|
@@ -7208,13 +7228,19 @@ var xs = 1500, Ss = class {
|
|
|
7208
7228
|
rendered() {
|
|
7209
7229
|
this.highlightCode();
|
|
7210
7230
|
}
|
|
7231
|
+
togglePreview() {
|
|
7232
|
+
this._previewActive ? this.showCode() : this.showPreview();
|
|
7233
|
+
}
|
|
7211
7234
|
showCode() {
|
|
7212
7235
|
var e;
|
|
7213
|
-
!((e = this._dom) != null && e.previewElement) || !this._dom.
|
|
7236
|
+
!((e = this._dom) != null && e.previewElement) || !this._dom.previewToggleButton || (this._previewActive = !1, this._dom.preElement.hidden = !1, this._dom.gutterElement.hidden = !this._lineNumbers, this._dom.previewElement.hidden = !0);
|
|
7214
7237
|
}
|
|
7215
7238
|
showPreview() {
|
|
7216
7239
|
var e;
|
|
7217
|
-
!((e = this._dom) != null && e.previewElement) || !this._dom.
|
|
7240
|
+
!((e = this._dom) != null && e.previewElement) || !this._dom.previewToggleButton || (this._previewActive = !0, this._dom.preElement.hidden = !0, this._dom.gutterElement.hidden = !0, this._dom.previewElement.hidden = !1, this.renderPreview());
|
|
7241
|
+
}
|
|
7242
|
+
toggleMoreMenu() {
|
|
7243
|
+
this._dom && (this._dom.moreMenu.hidden = !this._dom.moreMenu.hidden);
|
|
7218
7244
|
}
|
|
7219
7245
|
async renderPreview() {
|
|
7220
7246
|
var e = this, t, n;
|
|
@@ -7241,10 +7267,10 @@ var xs = 1500, Ss = class {
|
|
|
7241
7267
|
}
|
|
7242
7268
|
renderSettings() {
|
|
7243
7269
|
return [{
|
|
7244
|
-
icon:
|
|
7245
|
-
title: this.api.i18n.t(
|
|
7270
|
+
icon: te,
|
|
7271
|
+
title: this.api.i18n.t(go),
|
|
7246
7272
|
name: "code-language",
|
|
7247
|
-
children: { items:
|
|
7273
|
+
children: { items: So.map((e) => ({
|
|
7248
7274
|
title: e.name,
|
|
7249
7275
|
onActivate: () => this.setLanguage(e.id),
|
|
7250
7276
|
closeOnActivate: !0,
|
|
@@ -7268,10 +7294,14 @@ var xs = 1500, Ss = class {
|
|
|
7268
7294
|
}
|
|
7269
7295
|
setLanguage(e) {
|
|
7270
7296
|
var t;
|
|
7271
|
-
this._data.language = e, this._dom
|
|
7297
|
+
if (this._data.language = e, this._dom) {
|
|
7298
|
+
let t = this._dom.languageButton.querySelector("span");
|
|
7299
|
+
t && (t.textContent = this.getLanguageName(e));
|
|
7300
|
+
}
|
|
7301
|
+
(t = this._picker) == null || t.setActiveLanguage(e), this.highlightCode();
|
|
7272
7302
|
}
|
|
7273
7303
|
getLanguageName(e) {
|
|
7274
|
-
let t =
|
|
7304
|
+
let t = So.find((t) => t.id === e);
|
|
7275
7305
|
return t ? t.name : e;
|
|
7276
7306
|
}
|
|
7277
7307
|
copyCode() {
|
|
@@ -7280,13 +7310,13 @@ var xs = 1500, Ss = class {
|
|
|
7280
7310
|
navigator.clipboard.writeText(n).then(() => {
|
|
7281
7311
|
if (!this._dom) return;
|
|
7282
7312
|
let e = this._dom.copyButton, t = e.innerHTML;
|
|
7283
|
-
e.innerHTML = `<span class="${
|
|
7313
|
+
e.innerHTML = `<span class="${Oo}">${this.api.i18n.t(_o)}</span>`, setTimeout(() => {
|
|
7284
7314
|
e.innerHTML = t;
|
|
7285
|
-
},
|
|
7315
|
+
}, Ss);
|
|
7286
7316
|
}).catch(() => {});
|
|
7287
7317
|
}
|
|
7288
7318
|
toggleWrap() {
|
|
7289
|
-
this._wrapping = !this._wrapping, this._dom && (this._wrapping ? this._dom.codeElement.className =
|
|
7319
|
+
this._wrapping = !this._wrapping, this._dom && (this._wrapping ? this._dom.codeElement.className = Do : this._dom.codeElement.className = Do.replace("whitespace-pre-wrap", "whitespace-pre"));
|
|
7290
7320
|
}
|
|
7291
7321
|
toggleLineNumbers() {
|
|
7292
7322
|
this._lineNumbers = !this._lineNumbers, this._dom && (this._dom.gutterElement.hidden = !this._lineNumbers);
|
|
@@ -7313,7 +7343,7 @@ var xs = 1500, Ss = class {
|
|
|
7313
7343
|
}
|
|
7314
7344
|
async highlightCode() {
|
|
7315
7345
|
var e = this, t, n, r;
|
|
7316
|
-
if (!
|
|
7346
|
+
if (!ds() || !os(e._data.language)) {
|
|
7317
7347
|
var i;
|
|
7318
7348
|
(i = e._disposeHighlights) == null || i.call(e), e._disposeHighlights = null;
|
|
7319
7349
|
return;
|
|
@@ -7324,8 +7354,8 @@ var xs = 1500, Ss = class {
|
|
|
7324
7354
|
(o = e._disposeHighlights) == null || o.call(e), e._disposeHighlights = null;
|
|
7325
7355
|
return;
|
|
7326
7356
|
}
|
|
7327
|
-
let s = await
|
|
7328
|
-
!s || !e._dom || ((r = e._disposeHighlights) == null || r.call(e), e._disposeHighlights =
|
|
7357
|
+
let s = await us(a, e._data.language);
|
|
7358
|
+
!s || !e._dom || ((r = e._disposeHighlights) == null || r.call(e), e._disposeHighlights = bs(e._dom.codeElement, s));
|
|
7329
7359
|
}
|
|
7330
7360
|
exitBlock() {
|
|
7331
7361
|
let e = this.api.blocks.getCurrentBlockIndex();
|
|
@@ -7337,7 +7367,7 @@ var xs = 1500, Ss = class {
|
|
|
7337
7367
|
}
|
|
7338
7368
|
static get toolbox() {
|
|
7339
7369
|
return {
|
|
7340
|
-
icon:
|
|
7370
|
+
icon: te,
|
|
7341
7371
|
title: "Code",
|
|
7342
7372
|
titleKey: "code",
|
|
7343
7373
|
searchTerms: [
|
|
@@ -7375,28 +7405,28 @@ var xs = 1500, Ss = class {
|
|
|
7375
7405
|
}, G = (e) => {
|
|
7376
7406
|
let t = e.tagName;
|
|
7377
7407
|
return t === "B" || t === "STRONG";
|
|
7378
|
-
},
|
|
7408
|
+
}, ws = (e) => !!(e && e.nodeType === Node.ELEMENT_NODE && G(e)), Ts = (e) => e.textContent.length === 0, K = (e) => e ? e.nodeType === Node.ELEMENT_NODE && G(e) ? q(e) : K(e.parentNode) : null, q = (e) => {
|
|
7379
7409
|
if (e.tagName === "STRONG") return e;
|
|
7380
7410
|
let t = document.createElement("strong");
|
|
7381
7411
|
for (e.hasAttributes() && Array.from(e.attributes).forEach((e) => {
|
|
7382
7412
|
t.setAttribute(e.name, e.value);
|
|
7383
7413
|
}); e.firstChild;) t.appendChild(e.firstChild);
|
|
7384
7414
|
return e.replaceWith(t), t;
|
|
7385
|
-
},
|
|
7415
|
+
}, Es = (e) => {
|
|
7386
7416
|
let t = e.nextSibling;
|
|
7387
7417
|
if ((t == null ? void 0 : t.nodeType) === Node.TEXT_NODE) return t;
|
|
7388
7418
|
let n = e.parentNode;
|
|
7389
7419
|
if (!n) return null;
|
|
7390
7420
|
let r = e.ownerDocument.createTextNode("");
|
|
7391
7421
|
return n.insertBefore(r, t), r;
|
|
7392
|
-
},
|
|
7422
|
+
}, Ds = (e) => {
|
|
7393
7423
|
if (!e.boldElement.isConnected) return null;
|
|
7394
|
-
let t = q(e.boldElement), n = e.boundary, r = n.isConnected && n.previousSibling === t ? n :
|
|
7424
|
+
let t = q(e.boldElement), n = e.boundary, r = n.isConnected && n.previousSibling === t ? n : Es(t);
|
|
7395
7425
|
return r ? {
|
|
7396
7426
|
boundary: r,
|
|
7397
7427
|
boldElement: t
|
|
7398
7428
|
} : null;
|
|
7399
|
-
},
|
|
7429
|
+
}, Os = (e, t) => e ? e === t || t.contains(e) : !1, ks, J = {
|
|
7400
7430
|
COLLAPSED_LENGTH: "data-blok-bold-collapsed-length",
|
|
7401
7431
|
COLLAPSED_ACTIVE: "data-blok-bold-collapsed-active",
|
|
7402
7432
|
PREV_LENGTH: "data-blok-bold-prev-length",
|
|
@@ -7449,7 +7479,7 @@ var xs = 1500, Ss = class {
|
|
|
7449
7479
|
}
|
|
7450
7480
|
exit(e, t) {
|
|
7451
7481
|
let n = q(t), r = n.parentNode;
|
|
7452
|
-
if (r) return
|
|
7482
|
+
if (r) return Ts(n) ? this.removeEmptyBoldElement(e, n, r) : this.exitBoldWithContent(e, n, r);
|
|
7453
7483
|
}
|
|
7454
7484
|
removeEmptyBoldElement(e, t, n) {
|
|
7455
7485
|
let r = document.createRange();
|
|
@@ -7473,7 +7503,7 @@ var xs = 1500, Ss = class {
|
|
|
7473
7503
|
}
|
|
7474
7504
|
maintain() {
|
|
7475
7505
|
if (!(typeof document > "u")) for (let e of Array.from(this.records)) {
|
|
7476
|
-
let t =
|
|
7506
|
+
let t = Ds(e);
|
|
7477
7507
|
if (!t) {
|
|
7478
7508
|
this.records.delete(e);
|
|
7479
7509
|
continue;
|
|
@@ -7505,11 +7535,11 @@ var xs = 1500, Ss = class {
|
|
|
7505
7535
|
c && this.records.delete(e);
|
|
7506
7536
|
}
|
|
7507
7537
|
synchronize(e) {
|
|
7508
|
-
var
|
|
7509
|
-
let
|
|
7510
|
-
if (!
|
|
7511
|
-
let
|
|
7512
|
-
|
|
7538
|
+
var t, n;
|
|
7539
|
+
let r = (t = e == null ? void 0 : e.anchorNode) == null ? e == null ? void 0 : e.focusNode : t, i = r && r.nodeType === Node.ELEMENT_NODE ? r : r == null ? void 0 : r.parentElement, a = (n = i == null ? void 0 : i.closest(E(D.editor))) == null ? i == null ? void 0 : i.ownerDocument : n;
|
|
7540
|
+
if (!a) return;
|
|
7541
|
+
let o = `strong[${J.COLLAPSED_ACTIVE}="true"]`;
|
|
7542
|
+
a.querySelectorAll(o).forEach((t) => {
|
|
7513
7543
|
var n;
|
|
7514
7544
|
let r = t.getAttribute(J.PREV_LENGTH), i = t.previousSibling;
|
|
7515
7545
|
if (!r || !i || i.nodeType !== Node.TEXT_NODE) return;
|
|
@@ -7523,17 +7553,17 @@ var xs = 1500, Ss = class {
|
|
|
7523
7553
|
if (u && !t.hasAttribute(J.LEADING_WHITESPACE) && t.setAttribute(J.LEADING_WHITESPACE, u[0]), l.length === 0) return;
|
|
7524
7554
|
let d = t.textContent, f = d + l, p = (n = t.getAttribute(J.LEADING_WHITESPACE)) == null ? "" : n, m = p.length > 0 && d.length === 0 && !f.startsWith(p) ? p + f : f, h = document.createTextNode(m);
|
|
7525
7555
|
for (; t.firstChild;) t.removeChild(t.firstChild);
|
|
7526
|
-
if (t.appendChild(h), !(e != null && e.isCollapsed) || !
|
|
7527
|
-
let g = document.createRange(),
|
|
7528
|
-
g.setStart(h,
|
|
7556
|
+
if (t.appendChild(h), !(e != null && e.isCollapsed) || !Os(e.focusNode, o)) return;
|
|
7557
|
+
let g = document.createRange(), ee = h.textContent.length;
|
|
7558
|
+
g.setStart(h, ee), g.collapse(!0), e.removeAllRanges(), e.addRange(g);
|
|
7529
7559
|
});
|
|
7530
7560
|
}
|
|
7531
7561
|
enforceLengths(e) {
|
|
7532
|
-
var
|
|
7533
|
-
let
|
|
7534
|
-
if (!
|
|
7535
|
-
let
|
|
7536
|
-
|
|
7562
|
+
var t;
|
|
7563
|
+
let n = (t = e == null ? void 0 : e.anchorNode) == null ? e == null ? void 0 : e.focusNode : t;
|
|
7564
|
+
if (!n) return;
|
|
7565
|
+
let r = n.nodeType === Node.ELEMENT_NODE ? n : n.parentElement, i = r == null ? void 0 : r.closest(E(D.editor));
|
|
7566
|
+
i && i.querySelectorAll(`strong[${J.COLLAPSED_LENGTH}]`).forEach((t) => {
|
|
7537
7567
|
var n;
|
|
7538
7568
|
let r = t.getAttribute(J.COLLAPSED_LENGTH);
|
|
7539
7569
|
if (!r) return;
|
|
@@ -7547,7 +7577,7 @@ var xs = 1500, Ss = class {
|
|
|
7547
7577
|
let r = document.createTextNode(n);
|
|
7548
7578
|
(m = t.parentNode) == null || m.insertBefore(r, t.nextSibling);
|
|
7549
7579
|
}
|
|
7550
|
-
if (p && t.removeAttribute(J.PREV_LENGTH), e != null && e.isCollapsed && s &&
|
|
7580
|
+
if (p && t.removeAttribute(J.PREV_LENGTH), e != null && e.isCollapsed && s && Os(e.focusNode, t)) {
|
|
7551
7581
|
let t = document.createRange(), n = s.textContent.length;
|
|
7552
7582
|
t.setStart(s, n), t.collapse(!0), e.removeAllRanges(), e.addRange(t);
|
|
7553
7583
|
}
|
|
@@ -7641,10 +7671,10 @@ var xs = 1500, Ss = class {
|
|
|
7641
7671
|
return t.tagName === "STRONG" || t.tagName === "B";
|
|
7642
7672
|
}
|
|
7643
7673
|
};
|
|
7644
|
-
|
|
7674
|
+
ks = Y, ks.instance = null;
|
|
7645
7675
|
//#endregion
|
|
7646
7676
|
//#region src/components/inline-tools/services/bold-normalization-pass.ts
|
|
7647
|
-
var
|
|
7677
|
+
var As = {
|
|
7648
7678
|
convertLegacyTags: !0,
|
|
7649
7679
|
normalizeWhitespace: !0,
|
|
7650
7680
|
removeEmpty: !0,
|
|
@@ -7652,7 +7682,7 @@ var ks = {
|
|
|
7652
7682
|
preserveNode: null
|
|
7653
7683
|
}, X = class e {
|
|
7654
7684
|
constructor(e) {
|
|
7655
|
-
this.options =
|
|
7685
|
+
this.options = k(k({}, As), e);
|
|
7656
7686
|
}
|
|
7657
7687
|
run(e) {
|
|
7658
7688
|
if (typeof document > "u") return;
|
|
@@ -7705,16 +7735,16 @@ var ks = {
|
|
|
7705
7735
|
t.includes("\xA0") && (e.textContent = t.replace(/\u00A0/g, " "));
|
|
7706
7736
|
}
|
|
7707
7737
|
isEmptyAndSafe(e) {
|
|
7708
|
-
return e.textContent.length !== 0 || Y.getInstance().isActivePlaceholder(e) ? !1 : !(this.options.preserveNode &&
|
|
7738
|
+
return e.textContent.length !== 0 || Y.getInstance().isActivePlaceholder(e) ? !1 : !(this.options.preserveNode && Os(this.options.preserveNode, e));
|
|
7709
7739
|
}
|
|
7710
7740
|
mergeWithAdjacent(e) {
|
|
7711
7741
|
let t = e.previousSibling;
|
|
7712
|
-
if (t &&
|
|
7742
|
+
if (t && ws(t)) {
|
|
7713
7743
|
this.mergeStrongNodes(t, e);
|
|
7714
7744
|
return;
|
|
7715
7745
|
}
|
|
7716
7746
|
let n = e.nextSibling;
|
|
7717
|
-
n &&
|
|
7747
|
+
n && ws(n) && this.mergeStrongNodes(e, n);
|
|
7718
7748
|
}
|
|
7719
7749
|
mergeStrongNodes(e, t) {
|
|
7720
7750
|
let n = q(e), r = q(t);
|
|
@@ -7722,13 +7752,13 @@ var ks = {
|
|
|
7722
7752
|
r.remove();
|
|
7723
7753
|
}
|
|
7724
7754
|
static findScopeFromSelection(e) {
|
|
7725
|
-
var
|
|
7726
|
-
let
|
|
7727
|
-
if (!
|
|
7728
|
-
let
|
|
7729
|
-
return
|
|
7755
|
+
var t, n;
|
|
7756
|
+
let r = (t = e == null ? void 0 : e.anchorNode) == null ? e == null ? void 0 : e.focusNode : t;
|
|
7757
|
+
if (!r) return null;
|
|
7758
|
+
let i = r.nodeType === Node.ELEMENT_NODE ? r : r.parentElement;
|
|
7759
|
+
return i ? ((n = i.closest("[data-blok-component=\"paragraph\"]")) == null ? i.closest(E(D.elementContent)) : n) || i.closest(E(D.editor)) : null;
|
|
7730
7760
|
}
|
|
7731
|
-
},
|
|
7761
|
+
}, js, Ms = class e {
|
|
7732
7762
|
constructor() {
|
|
7733
7763
|
this.handlers = /* @__PURE__ */ new Map(), this.listenersRegistered = !1, this.handleSelectionChange = () => {
|
|
7734
7764
|
let e = this.getSelection();
|
|
@@ -7785,10 +7815,10 @@ var ks = {
|
|
|
7785
7815
|
return !(t.meta && !n || t.ctrl && !e.ctrlKey);
|
|
7786
7816
|
}
|
|
7787
7817
|
};
|
|
7788
|
-
|
|
7818
|
+
js = Ms, js.instance = null;
|
|
7789
7819
|
//#endregion
|
|
7790
7820
|
//#region src/components/inline-tools/utils/formatting-range-utils.ts
|
|
7791
|
-
var
|
|
7821
|
+
var Ns = (e, t) => {
|
|
7792
7822
|
try {
|
|
7793
7823
|
return e.intersectsNode(t);
|
|
7794
7824
|
} catch (n) {
|
|
@@ -7797,26 +7827,26 @@ var Ms = (e, t) => {
|
|
|
7797
7827
|
let i = e.compareBoundaryPoints(Range.END_TO_START, r) > 0, a = e.compareBoundaryPoints(Range.START_TO_END, r) < 0;
|
|
7798
7828
|
return i && a;
|
|
7799
7829
|
}
|
|
7800
|
-
},
|
|
7830
|
+
}, Ps = (e) => {
|
|
7801
7831
|
var t;
|
|
7802
7832
|
let n = e.commonAncestorContainer, r = n.nodeType === Node.TEXT_NODE ? (t = n.parentNode) == null ? n : t : n;
|
|
7803
|
-
return document.createTreeWalker(r, NodeFilter.SHOW_TEXT, { acceptNode: (t) =>
|
|
7804
|
-
}, Z = (e, t, n) => !e || e === n ? null : e.nodeType === Node.ELEMENT_NODE && t(e) ? e : Z(e.parentNode, t, n),
|
|
7833
|
+
return document.createTreeWalker(r, NodeFilter.SHOW_TEXT, { acceptNode: (t) => Ns(e, t) ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_REJECT });
|
|
7834
|
+
}, Z = (e, t, n) => !e || e === n ? null : e.nodeType === Node.ELEMENT_NODE && t(e) ? e : Z(e.parentNode, t, n), Fs = (e, t) => Z(e, t) !== null, Is = (e, t, n = {}) => {
|
|
7805
7835
|
if (e.collapsed) return Z(e.startContainer, t) !== null;
|
|
7806
|
-
let r =
|
|
7836
|
+
let r = Ps(e), i = [];
|
|
7807
7837
|
for (; r.nextNode();) {
|
|
7808
7838
|
let e = r.currentNode, t = e.textContent;
|
|
7809
7839
|
n.ignoreWhitespace && t.trim().length === 0 || t.length !== 0 && i.push(e);
|
|
7810
7840
|
}
|
|
7811
|
-
return i.length === 0 ? Z(e.startContainer, t) !== null : i.every((e) =>
|
|
7841
|
+
return i.length === 0 ? Z(e.startContainer, t) !== null : i.every((e) => Fs(e, t));
|
|
7812
7842
|
}, Q = (e, t) => {
|
|
7813
|
-
let n = /* @__PURE__ */ new Set(), r =
|
|
7843
|
+
let n = /* @__PURE__ */ new Set(), r = Ps(e);
|
|
7814
7844
|
for (; r.nextNode();) {
|
|
7815
7845
|
let e = Z(r.currentNode, t);
|
|
7816
7846
|
e && n.add(e);
|
|
7817
7847
|
}
|
|
7818
7848
|
return Array.from(n);
|
|
7819
|
-
}, $,
|
|
7849
|
+
}, $, Ls = class e {
|
|
7820
7850
|
static get sanitize() {
|
|
7821
7851
|
return {
|
|
7822
7852
|
strong: {},
|
|
@@ -7828,7 +7858,7 @@ var Ms = (e, t) => {
|
|
|
7828
7858
|
}
|
|
7829
7859
|
static initializeGlobalListeners() {
|
|
7830
7860
|
if (typeof document > "u") return !1;
|
|
7831
|
-
let t =
|
|
7861
|
+
let t = Ms.getInstance();
|
|
7832
7862
|
return t.hasHandler("bold") ? !0 : (t.register("bold", {
|
|
7833
7863
|
shortcut: {
|
|
7834
7864
|
key: "b",
|
|
@@ -7857,7 +7887,7 @@ var Ms = (e, t) => {
|
|
|
7857
7887
|
}
|
|
7858
7888
|
render() {
|
|
7859
7889
|
return {
|
|
7860
|
-
icon:
|
|
7890
|
+
icon: o,
|
|
7861
7891
|
name: "bold",
|
|
7862
7892
|
onActivate: () => {
|
|
7863
7893
|
this.toggleBold();
|
|
@@ -7910,7 +7940,7 @@ var Ms = (e, t) => {
|
|
|
7910
7940
|
let e = document.createRange();
|
|
7911
7941
|
return e.setStartBefore(s), e.setEndAfter(c), r.removeAllRanges(), r.addRange(e), e;
|
|
7912
7942
|
})() || r.removeAllRanges(), X.normalizeAroundSelection(r), n.forEach((e) => {
|
|
7913
|
-
|
|
7943
|
+
Ts(e) && e.remove();
|
|
7914
7944
|
}), this.notifySelectionChange();
|
|
7915
7945
|
}
|
|
7916
7946
|
replaceRangeWithHtml(t, n) {
|
|
@@ -7950,7 +7980,7 @@ var Ms = (e, t) => {
|
|
|
7950
7980
|
n.selectNodeContents(e), t.removeAllRanges(), t.addRange(n);
|
|
7951
7981
|
}
|
|
7952
7982
|
isRangeBold(e, t) {
|
|
7953
|
-
return
|
|
7983
|
+
return Is(e, G, t);
|
|
7954
7984
|
}
|
|
7955
7985
|
removeNestedBold(e) {
|
|
7956
7986
|
e.querySelectorAll("b,strong").forEach((e) => {
|
|
@@ -7993,12 +8023,12 @@ var Ms = (e, t) => {
|
|
|
7993
8023
|
updateToolbarButtonState() {
|
|
7994
8024
|
let e = window.getSelection();
|
|
7995
8025
|
if (!e) return;
|
|
7996
|
-
let
|
|
7997
|
-
if (!
|
|
7998
|
-
let
|
|
7999
|
-
if (!(
|
|
8000
|
-
let
|
|
8001
|
-
|
|
8026
|
+
let t = e.anchorNode, n = (t == null ? void 0 : t.nodeType) === Node.ELEMENT_NODE ? t : t == null ? void 0 : t.parentElement, r = n == null ? void 0 : n.closest(E(D.editor));
|
|
8027
|
+
if (!r) return;
|
|
8028
|
+
let i = r.querySelector("[data-blok-testid=inline-toolbar]");
|
|
8029
|
+
if (!(i instanceof HTMLElement)) return;
|
|
8030
|
+
let a = i.querySelector("[data-blok-item-name=\"bold\"]");
|
|
8031
|
+
a instanceof HTMLElement && (this.isSelectionVisuallyBold(e) ? a.setAttribute("data-blok-popover-item-active", "true") : a.removeAttribute("data-blok-popover-item-active"));
|
|
8002
8032
|
}
|
|
8003
8033
|
static refreshSelectionState(e) {
|
|
8004
8034
|
let t = window.getSelection();
|
|
@@ -8034,8 +8064,8 @@ var Ms = (e, t) => {
|
|
|
8034
8064
|
}), e.mutationObserver = t;
|
|
8035
8065
|
}
|
|
8036
8066
|
static findBlokScopeFromNode(e) {
|
|
8037
|
-
let
|
|
8038
|
-
return !
|
|
8067
|
+
let t = e.nodeType === Node.ELEMENT_NODE ? e : e.parentElement;
|
|
8068
|
+
return !t || typeof t.closest != "function" ? null : t.closest(`${E(D.interface)}, ${E(D.editor)}`);
|
|
8039
8069
|
}
|
|
8040
8070
|
static getBoundaryBold(t) {
|
|
8041
8071
|
let n = t.startContainer;
|
|
@@ -8046,18 +8076,18 @@ var Ms = (e, t) => {
|
|
|
8046
8076
|
if (e.startOffset === n) return K(t);
|
|
8047
8077
|
if (e.startOffset !== 0) return null;
|
|
8048
8078
|
let r = t.previousSibling;
|
|
8049
|
-
return
|
|
8079
|
+
return ws(r) ? r : null;
|
|
8050
8080
|
}
|
|
8051
8081
|
static getBoundaryBoldForElement(e, t) {
|
|
8052
8082
|
if (e.startOffset <= 0) return null;
|
|
8053
8083
|
let n = t.childNodes[e.startOffset - 1];
|
|
8054
|
-
return
|
|
8084
|
+
return ws(n) ? n : null;
|
|
8055
8085
|
}
|
|
8056
8086
|
static isSelectionInsideBlok(e) {
|
|
8057
|
-
let
|
|
8058
|
-
if (!
|
|
8059
|
-
let
|
|
8060
|
-
return !!(
|
|
8087
|
+
let t = e.anchorNode;
|
|
8088
|
+
if (!t) return !1;
|
|
8089
|
+
let n = t.nodeType === Node.ELEMENT_NODE ? t : t.parentElement;
|
|
8090
|
+
return !!(n != null && n.closest(E(D.editor)));
|
|
8061
8091
|
}
|
|
8062
8092
|
getRangeHtmlWithoutBold(e) {
|
|
8063
8093
|
let t = e.cloneContents();
|
|
@@ -8073,13 +8103,13 @@ var Ms = (e, t) => {
|
|
|
8073
8103
|
return Q(e, G);
|
|
8074
8104
|
}
|
|
8075
8105
|
};
|
|
8076
|
-
$ =
|
|
8106
|
+
$ = Ls, $.isInline = !0, $.title = "Bold", $.titleKey = "bold", $.markerSequence = 0, $.isProcessingMutation = !1, $.instances = /* @__PURE__ */ new Set(), $.guardKeydownListenerRegistered = !1, $.shortcut = "CMD+B";
|
|
8077
8107
|
//#endregion
|
|
8078
8108
|
//#region src/components/inline-tools/inline-tool-italic.ts
|
|
8079
|
-
var
|
|
8109
|
+
var Rs, zs = (e) => {
|
|
8080
8110
|
let t = e.tagName;
|
|
8081
8111
|
return t === "I" || t === "EM";
|
|
8082
|
-
},
|
|
8112
|
+
}, Bs = class {
|
|
8083
8113
|
static get sanitize() {
|
|
8084
8114
|
return {
|
|
8085
8115
|
i: {},
|
|
@@ -8088,7 +8118,7 @@ var Ls, Rs = (e) => {
|
|
|
8088
8118
|
}
|
|
8089
8119
|
render() {
|
|
8090
8120
|
return {
|
|
8091
|
-
icon:
|
|
8121
|
+
icon: Xe,
|
|
8092
8122
|
name: "italic",
|
|
8093
8123
|
onActivate: () => {
|
|
8094
8124
|
this.toggleItalic();
|
|
@@ -8128,7 +8158,7 @@ var Ls, Rs = (e) => {
|
|
|
8128
8158
|
return this.isRangeItalic(t, { ignoreWhitespace: !0 });
|
|
8129
8159
|
}
|
|
8130
8160
|
isRangeItalic(e, t) {
|
|
8131
|
-
return
|
|
8161
|
+
return Is(e, zs, t);
|
|
8132
8162
|
}
|
|
8133
8163
|
wrapWithItalic(e) {
|
|
8134
8164
|
let t = this.getRangeHtmlWithoutItalic(e), n = this.replaceRangeWithHtml(e, `<i>${t}</i>`), r = window.getSelection();
|
|
@@ -8154,13 +8184,13 @@ var Ls, Rs = (e) => {
|
|
|
8154
8184
|
});
|
|
8155
8185
|
}
|
|
8156
8186
|
hasItalicParent(e) {
|
|
8157
|
-
return
|
|
8187
|
+
return Fs(e, zs);
|
|
8158
8188
|
}
|
|
8159
8189
|
findItalicElement(e) {
|
|
8160
|
-
return Z(e,
|
|
8190
|
+
return Z(e, zs);
|
|
8161
8191
|
}
|
|
8162
8192
|
collectItalicAncestors(e) {
|
|
8163
|
-
return Q(e,
|
|
8193
|
+
return Q(e, zs);
|
|
8164
8194
|
}
|
|
8165
8195
|
getRangeHtmlWithoutItalic(e) {
|
|
8166
8196
|
let t = e.cloneContents();
|
|
@@ -8217,10 +8247,10 @@ var Ls, Rs = (e) => {
|
|
|
8217
8247
|
n.insertBefore(r, t.nextSibling), n.insertBefore(e, r);
|
|
8218
8248
|
}
|
|
8219
8249
|
};
|
|
8220
|
-
|
|
8250
|
+
Rs = Bs, Rs.isInline = !0, Rs.title = "Italic", Rs.titleKey = "italic", Rs.shortcut = "CMD+I";
|
|
8221
8251
|
//#endregion
|
|
8222
8252
|
//#region src/components/inline-tools/inline-tool-link.ts
|
|
8223
|
-
var
|
|
8253
|
+
var Vs, Hs = "flex items-center gap-2 w-full mt-0.5 px-1.5 py-1.5 rounded-md text-left cursor-pointer can-hover:hover:bg-item-hover-bg transition-colors", Us = "flex items-center gap-2 w-full mt-0.5 px-1.5 py-1.5 rounded-md text-left pointer-events-none", Ws = class {
|
|
8224
8254
|
static get sanitize() {
|
|
8225
8255
|
return { a: {
|
|
8226
8256
|
href: !0,
|
|
@@ -8240,17 +8270,17 @@ var Bs, Vs = "flex items-center gap-2 w-full mt-0.5 px-1.5 py-1.5 rounded-md tex
|
|
|
8240
8270
|
button: null
|
|
8241
8271
|
}, this.inputOpened = !1, this.unlinkAvailable = !1, this.handleButtonClick = (e) => {
|
|
8242
8272
|
!this.inputOpened || !this.unlinkAvailable || (e.preventDefault(), e.stopPropagation(), e.stopImmediatePropagation(), this.restoreSelection(), this.unlink(), this.inlineToolbar.close());
|
|
8243
|
-
}, this.toolbar = e.toolbar, this.inlineToolbar = e.inlineToolbar, this.notifier = e.notifier, this.i18n = e.i18n, this.selection = new
|
|
8273
|
+
}, this.toolbar = e.toolbar, this.inlineToolbar = e.inlineToolbar, this.notifier = e.notifier, this.i18n = e.i18n, this.selection = new Ye(), this.nodes.input = this.createInput(), this.nodes.suggestion = this.createSuggestion(), this.nodes.inputWrapper = document.createElement("div"), this.nodes.inputWrapper.append(this.nodes.input, this.nodes.suggestion);
|
|
8244
8274
|
}
|
|
8245
8275
|
render() {
|
|
8246
8276
|
return {
|
|
8247
|
-
icon:
|
|
8277
|
+
icon: Ee,
|
|
8248
8278
|
name: "link",
|
|
8249
8279
|
isActive: () => !!this.selection.findParentTag("A"),
|
|
8250
8280
|
children: {
|
|
8251
8281
|
hideChevron: !0,
|
|
8252
8282
|
items: [{
|
|
8253
|
-
type:
|
|
8283
|
+
type: w.Html,
|
|
8254
8284
|
element: this.nodes.inputWrapper
|
|
8255
8285
|
}],
|
|
8256
8286
|
onOpen: () => {
|
|
@@ -8280,7 +8310,7 @@ var Bs, Vs = "flex items-center gap-2 w-full mt-0.5 px-1.5 py-1.5 rounded-md tex
|
|
|
8280
8310
|
let t = document.createElement("div");
|
|
8281
8311
|
t.className = "mt-1 mb-0.5 h-px bg-link-input-border";
|
|
8282
8312
|
let n = document.createElement("button");
|
|
8283
|
-
n.type = "button", n.className =
|
|
8313
|
+
n.type = "button", n.className = Hs, n.setAttribute("data-link-suggestion-row", "");
|
|
8284
8314
|
let r = document.createElement("span");
|
|
8285
8315
|
r.className = "text-gray-text shrink-0 flex [&>svg]:size-7", r.setAttribute("data-link-suggestion-icon", "");
|
|
8286
8316
|
let i = document.createElement("span");
|
|
@@ -8298,20 +8328,20 @@ var Bs, Vs = "flex items-center gap-2 w-full mt-0.5 px-1.5 py-1.5 rounded-md tex
|
|
|
8298
8328
|
return;
|
|
8299
8329
|
}
|
|
8300
8330
|
let n = this.isLinkComplete(t), { icon: r, label: i } = this.getLinkTypeInfo(t), a = this.nodes.suggestion.querySelector("[data-link-suggestion-icon]"), o = this.nodes.suggestion.querySelector("[data-link-suggestion-url]"), s = this.nodes.suggestion.querySelector("[data-link-suggestion-type]"), c = this.nodes.suggestion.querySelector("[data-link-suggestion-row]");
|
|
8301
|
-
a && (a.innerHTML = r, a.className = `${n ? "text-gray-text" : "text-gray-text opacity-40"} shrink-0 flex [&>svg]:size-7`), o && (o.textContent = t, o.className = `block text-xs font-medium truncate ${n ? "text-text-primary" : "text-gray-text"}`), s && (s.textContent = n ? i : "Keep typing to add a link", s.className = "block text-[10.5px] text-gray-text leading-tight mt-px"), c && (c.className = n ?
|
|
8331
|
+
a && (a.innerHTML = r, a.className = `${n ? "text-gray-text" : "text-gray-text opacity-40"} shrink-0 flex [&>svg]:size-7`), o && (o.textContent = t, o.className = `block text-xs font-medium truncate ${n ? "text-text-primary" : "text-gray-text"}`), s && (s.textContent = n ? i : "Keep typing to add a link", s.className = "block text-[10.5px] text-gray-text leading-tight mt-px"), c && (c.className = n ? Hs : Us), this.nodes.suggestion.classList.remove("hidden");
|
|
8302
8332
|
}
|
|
8303
8333
|
isLinkComplete(e) {
|
|
8304
8334
|
return /^https?:\/\//i.test(e) ? e.replace(/^https?:\/\//i, "").length > 0 : /^\w+:\/\//.test(e) ? e.replace(/^\w+:\/\//, "").length > 0 : /^\w+:/.test(e) ? e.slice(e.indexOf(":") + 1).length > 0 : e.startsWith("//") ? e.slice(2).length > 0 : e.startsWith("#") ? e.length > 1 : e.startsWith("/") ? !0 : /\.[a-zA-Z]{2,}/.test(e) || /^\d{1,3}(\.\d{1,3}){3}/.test(e);
|
|
8305
8335
|
}
|
|
8306
|
-
getLinkTypeInfo(
|
|
8307
|
-
return
|
|
8308
|
-
icon:
|
|
8336
|
+
getLinkTypeInfo(t) {
|
|
8337
|
+
return t.startsWith("mailto:") ? {
|
|
8338
|
+
icon: je,
|
|
8309
8339
|
label: "Email address"
|
|
8310
|
-
} :
|
|
8311
|
-
icon:
|
|
8340
|
+
} : t.startsWith("#") ? {
|
|
8341
|
+
icon: e,
|
|
8312
8342
|
label: "Jump to section"
|
|
8313
8343
|
} : {
|
|
8314
|
-
icon:
|
|
8344
|
+
icon: _,
|
|
8315
8345
|
label: "Link to web page"
|
|
8316
8346
|
};
|
|
8317
8347
|
}
|
|
@@ -8336,7 +8366,7 @@ var Bs, Vs = "flex items-center gap-2 w-full mt-0.5 px-1.5 py-1.5 rounded-md tex
|
|
|
8336
8366
|
let e = t.getAttribute("href");
|
|
8337
8367
|
this.nodes.input.value = e === null ? "" : e;
|
|
8338
8368
|
} else this.nodes.input.value = "";
|
|
8339
|
-
this.updateSuggestion(this.nodes.input.value), this.nodes.input.className =
|
|
8369
|
+
this.updateSuggestion(this.nodes.input.value), this.nodes.input.className = A(this.INPUT_BASE_CLASSES, "block"), this.setBooleanStateAttribute(this.nodes.input, this.DATA_ATTRIBUTES.inputOpened, !0), this.selection.setFakeBackground(), this.selection.save(), e && this.focusInputWithRetry(), this.inputOpened = !0;
|
|
8340
8370
|
}
|
|
8341
8371
|
focusInputWithRetry() {
|
|
8342
8372
|
this.nodes.input && (this.nodes.input.focus(), !(typeof window > "u" || typeof document > "u") && window.setTimeout(() => {
|
|
@@ -8347,7 +8377,7 @@ var Bs, Vs = "flex items-center gap-2 w-full mt-0.5 px-1.5 py-1.5 rounded-md tex
|
|
|
8347
8377
|
}, 0));
|
|
8348
8378
|
}
|
|
8349
8379
|
getButtonElement() {
|
|
8350
|
-
let e = document.querySelector(`${
|
|
8380
|
+
let e = document.querySelector(`${E(D.interface, Ue)} [data-blok-item-name="link"]`);
|
|
8351
8381
|
return e && e !== this.nodes.button && (e.addEventListener("click", this.handleButtonClick, !0), this.nodes.button = e), e;
|
|
8352
8382
|
}
|
|
8353
8383
|
updateButtonStateAttributes(e) {
|
|
@@ -8361,7 +8391,7 @@ var Bs, Vs = "flex items-center gap-2 w-full mt-0.5 px-1.5 py-1.5 rounded-md tex
|
|
|
8361
8391
|
(this.selection.isFakeBackgroundEnabled || e && this.selection.savedSelectionRange) && this.restoreSelection(), this.nodes.input && (this.nodes.input.className = this.INPUT_BASE_CLASSES, this.setBooleanStateAttribute(this.nodes.input, this.DATA_ATTRIBUTES.inputOpened, !1), this.nodes.input.value = "", (t = this.nodes.suggestion) == null || t.classList.add("hidden"), this.updateButtonStateAttributes(!1), this.unlinkAvailable = !1, e && this.selection.clearSaved(), this.inputOpened = !1);
|
|
8362
8392
|
}
|
|
8363
8393
|
restoreSelection() {
|
|
8364
|
-
let e = new
|
|
8394
|
+
let e = new Ye(), t = Ye.isAtBlok;
|
|
8365
8395
|
if (t && e.save(), this.selection.removeFakeBackground(), this.selection.restore(), !t && this.selection.savedSelectionRange) {
|
|
8366
8396
|
let e = this.selection.savedSelectionRange.commonAncestorContainer, t = e.nodeType === Node.ELEMENT_NODE ? e : e.parentElement;
|
|
8367
8397
|
t == null || t.focus();
|
|
@@ -8385,7 +8415,7 @@ var Bs, Vs = "flex items-center gap-2 w-full mt-0.5 px-1.5 py-1.5 rounded-md tex
|
|
|
8385
8415
|
this.notifier.show({
|
|
8386
8416
|
message: this.i18n.t("tools.link.invalidLink"),
|
|
8387
8417
|
style: "error"
|
|
8388
|
-
}),
|
|
8418
|
+
}), ye("Incorrect Link pasted", "warn", t);
|
|
8389
8419
|
return;
|
|
8390
8420
|
}
|
|
8391
8421
|
let n = this.prepareLink(t);
|
|
@@ -8408,7 +8438,7 @@ var Bs, Vs = "flex items-center gap-2 w-full mt-0.5 px-1.5 py-1.5 rounded-md tex
|
|
|
8408
8438
|
this.selection.expandToTag(t), t.href = e, t.target = "_blank", t.rel = "nofollow";
|
|
8409
8439
|
return;
|
|
8410
8440
|
}
|
|
8411
|
-
let n =
|
|
8441
|
+
let n = Ye.range;
|
|
8412
8442
|
if (!n) return;
|
|
8413
8443
|
let r = document.createElement("a");
|
|
8414
8444
|
r.href = e, r.target = "_blank", r.rel = "nofollow", r.appendChild(n.extractContents()), n.insertNode(r), this.selection.expandToTag(r);
|
|
@@ -8427,13 +8457,13 @@ var Bs, Vs = "flex items-center gap-2 w-full mt-0.5 px-1.5 py-1.5 rounded-md tex
|
|
|
8427
8457
|
e && e.setAttribute(t, n ? "true" : "false");
|
|
8428
8458
|
}
|
|
8429
8459
|
};
|
|
8430
|
-
|
|
8460
|
+
Vs = Ws, Vs.isInline = !0, Vs.title = "Link", Vs.titleKey = "link", Vs.shortcut = "CMD+K";
|
|
8431
8461
|
//#endregion
|
|
8432
8462
|
//#region src/components/inline-tools/utils/marker-dom-utils.ts
|
|
8433
|
-
var
|
|
8463
|
+
var Gs = (e) => e.tagName === "MARK", Ks = (e) => Z(e, Gs), qs, Js = {
|
|
8434
8464
|
color: "background-color",
|
|
8435
8465
|
"background-color": "color"
|
|
8436
|
-
},
|
|
8466
|
+
}, Ys = class e {
|
|
8437
8467
|
static get sanitize() {
|
|
8438
8468
|
return { mark: (t) => {
|
|
8439
8469
|
let n = t.style, r = Array.from({ length: n.length }, (e, t) => n.item(t));
|
|
@@ -8442,7 +8472,7 @@ var Ws = (e) => e.tagName === "MARK", Gs = (e) => Z(e, Ws), Ks, qs = {
|
|
|
8442
8472
|
} };
|
|
8443
8473
|
}
|
|
8444
8474
|
constructor({ api: e }) {
|
|
8445
|
-
this.colorMode = "color", this.activeTextColor = null, this.activeBgColor = null, this.i18n = e.i18n, this.inlineToolbar = e.inlineToolbar, this.selection = new
|
|
8475
|
+
this.colorMode = "color", this.activeTextColor = null, this.activeBgColor = null, this.i18n = e.i18n, this.inlineToolbar = e.inlineToolbar, this.selection = new Ye(), this.picker = Dr({
|
|
8446
8476
|
i18n: this.i18n,
|
|
8447
8477
|
testIdPrefix: "marker",
|
|
8448
8478
|
modes: [{
|
|
@@ -8461,12 +8491,12 @@ var Ws = (e) => e.tagName === "MARK", Gs = (e) => Z(e, Ws), Ks, qs = {
|
|
|
8461
8491
|
}
|
|
8462
8492
|
render() {
|
|
8463
8493
|
return {
|
|
8464
|
-
icon:
|
|
8494
|
+
icon: Qe,
|
|
8465
8495
|
name: "marker",
|
|
8466
8496
|
isActive: () => {
|
|
8467
8497
|
let e = window.getSelection();
|
|
8468
8498
|
if (!e || e.rangeCount === 0) return !1;
|
|
8469
|
-
let t = e.getRangeAt(0), n =
|
|
8499
|
+
let t = e.getRangeAt(0), n = Is(t, Gs, { ignoreWhitespace: !0 });
|
|
8470
8500
|
if (n) {
|
|
8471
8501
|
let e = this.detectBothSelectionColors(t);
|
|
8472
8502
|
this.updateToolbarColors(e.text, e.bg);
|
|
@@ -8476,7 +8506,7 @@ var Ws = (e) => e.tagName === "MARK", Gs = (e) => Z(e, Ws), Ks, qs = {
|
|
|
8476
8506
|
children: {
|
|
8477
8507
|
hideChevron: !0,
|
|
8478
8508
|
items: [{
|
|
8479
|
-
type:
|
|
8509
|
+
type: w.Html,
|
|
8480
8510
|
element: this.picker.element
|
|
8481
8511
|
}],
|
|
8482
8512
|
onOpen: () => {
|
|
@@ -8517,10 +8547,10 @@ var Ws = (e) => e.tagName === "MARK", Gs = (e) => Z(e, Ws), Ks, qs = {
|
|
|
8517
8547
|
if (!r || r.rangeCount === 0) return;
|
|
8518
8548
|
let i = r.getRangeAt(0), a = i.startContainer, o = i.startOffset, s = i.endContainer, c = i.endOffset, l = i.toString(), u = i.commonAncestorContainer, d = u.nodeType === Node.ELEMENT_NODE ? u : u.parentElement, f = d != null && d.closest("mark") ? (t = (n = d.closest("mark")) == null ? void 0 : n.parentElement) == null ? d : t : d;
|
|
8519
8549
|
this.splitMarksAtBoundaries(i);
|
|
8520
|
-
let p = Q(i,
|
|
8550
|
+
let p = Q(i, Gs);
|
|
8521
8551
|
for (let t of p) {
|
|
8522
8552
|
t.style.removeProperty(e);
|
|
8523
|
-
let n =
|
|
8553
|
+
let n = Js[e], r = t.style.getPropertyValue(n);
|
|
8524
8554
|
r !== "" && r !== "transparent" ? this.ensureTransparentBg(t) : this.unwrapElement(t);
|
|
8525
8555
|
}
|
|
8526
8556
|
let m = a.isConnected, h = s.isConnected;
|
|
@@ -8548,7 +8578,7 @@ var Ws = (e) => e.tagName === "MARK", Gs = (e) => Z(e, Ws), Ks, qs = {
|
|
|
8548
8578
|
this.selection.removeFakeBackground(), this.selection.savedSelectionRange && this.selection.restore(), this.selection.clearSaved();
|
|
8549
8579
|
}
|
|
8550
8580
|
detectBothSelectionColors(e) {
|
|
8551
|
-
let t =
|
|
8581
|
+
let t = Ks(e.startContainer);
|
|
8552
8582
|
if (!t) return {
|
|
8553
8583
|
text: null,
|
|
8554
8584
|
bg: null
|
|
@@ -8568,7 +8598,7 @@ var Ws = (e) => e.tagName === "MARK", Gs = (e) => Z(e, Ws), Ks, qs = {
|
|
|
8568
8598
|
text: null,
|
|
8569
8599
|
bg: null
|
|
8570
8600
|
};
|
|
8571
|
-
let t =
|
|
8601
|
+
let t = Ks(e.getRangeAt(0).startContainer);
|
|
8572
8602
|
if (!t) return {
|
|
8573
8603
|
text: null,
|
|
8574
8604
|
bg: null
|
|
@@ -8588,14 +8618,14 @@ var Ws = (e) => e.tagName === "MARK", Gs = (e) => Z(e, Ws), Ks, qs = {
|
|
|
8588
8618
|
this.selection.savedSelectionRange && (this.selection.removeFakeBackground(), this.selection.restore(), this.selection.clearSaved());
|
|
8589
8619
|
}
|
|
8590
8620
|
findContainingMark(e) {
|
|
8591
|
-
let t =
|
|
8621
|
+
let t = Ks(e.startContainer), n = Ks(e.endContainer);
|
|
8592
8622
|
return t && t === n ? t : null;
|
|
8593
8623
|
}
|
|
8594
8624
|
removeNestedMarkStyle(e, t) {
|
|
8595
|
-
let n = Q(e,
|
|
8625
|
+
let n = Q(e, Gs);
|
|
8596
8626
|
for (let e of n) {
|
|
8597
8627
|
e.style.removeProperty(t);
|
|
8598
|
-
let n =
|
|
8628
|
+
let n = Js[t], r = e.style.getPropertyValue(n);
|
|
8599
8629
|
r !== "" && r !== "transparent" ? this.ensureTransparentBg(e) : this.unwrapElement(e);
|
|
8600
8630
|
}
|
|
8601
8631
|
}
|
|
@@ -8626,7 +8656,7 @@ var Ws = (e) => e.tagName === "MARK", Gs = (e) => Z(e, Ws), Ks, qs = {
|
|
|
8626
8656
|
}
|
|
8627
8657
|
}
|
|
8628
8658
|
splitMarksAtBoundaries(e) {
|
|
8629
|
-
let t = Q(e,
|
|
8659
|
+
let t = Q(e, Gs);
|
|
8630
8660
|
for (let n of t) {
|
|
8631
8661
|
let t = document.createRange();
|
|
8632
8662
|
t.selectNodeContents(n);
|
|
@@ -8691,20 +8721,20 @@ var Ws = (e) => e.tagName === "MARK", Gs = (e) => Z(e, Ws), Ks, qs = {
|
|
|
8691
8721
|
}
|
|
8692
8722
|
resolveToVar(e, t) {
|
|
8693
8723
|
if (e.startsWith("var(")) return e;
|
|
8694
|
-
let n = t === "color" ? "text" : "bg", r =
|
|
8695
|
-
return r === null ? e :
|
|
8724
|
+
let n = t === "color" ? "text" : "bg", r = m(e, n);
|
|
8725
|
+
return r === null ? e : v(r, n);
|
|
8696
8726
|
}
|
|
8697
8727
|
};
|
|
8698
|
-
|
|
8728
|
+
qs = Ys, qs.isInline = !0, qs.title = "Color", qs.titleKey = "marker", qs.shortcut = "CMD+SHIFT+H", qs.ALLOWED_STYLE_PROPS = new Set(["color", "background-color"]);
|
|
8699
8729
|
//#endregion
|
|
8700
8730
|
//#region src/components/inline-tools/inline-tool-underline.ts
|
|
8701
|
-
var
|
|
8731
|
+
var Xs, Zs = (e) => e.tagName === "U", Qs = class {
|
|
8702
8732
|
static get sanitize() {
|
|
8703
8733
|
return { u: {} };
|
|
8704
8734
|
}
|
|
8705
8735
|
render() {
|
|
8706
8736
|
return {
|
|
8707
|
-
icon:
|
|
8737
|
+
icon: ze,
|
|
8708
8738
|
name: "underline",
|
|
8709
8739
|
onActivate: () => {
|
|
8710
8740
|
this.toggleUnderline();
|
|
@@ -8744,7 +8774,7 @@ var Ys, Xs = (e) => e.tagName === "U", Zs = class {
|
|
|
8744
8774
|
return this.isRangeUnderline(t, { ignoreWhitespace: !0 });
|
|
8745
8775
|
}
|
|
8746
8776
|
isRangeUnderline(e, t) {
|
|
8747
|
-
return
|
|
8777
|
+
return Is(e, Zs, t);
|
|
8748
8778
|
}
|
|
8749
8779
|
wrapWithUnderline(e) {
|
|
8750
8780
|
let t = this.getRangeHtmlWithoutUnderline(e), n = this.replaceRangeWithHtml(e, `<u>${t}</u>`), r = window.getSelection();
|
|
@@ -8770,13 +8800,13 @@ var Ys, Xs = (e) => e.tagName === "U", Zs = class {
|
|
|
8770
8800
|
});
|
|
8771
8801
|
}
|
|
8772
8802
|
hasUnderlineParent(e) {
|
|
8773
|
-
return
|
|
8803
|
+
return Fs(e, Zs);
|
|
8774
8804
|
}
|
|
8775
8805
|
findUnderlineElement(e) {
|
|
8776
|
-
return Z(e,
|
|
8806
|
+
return Z(e, Zs);
|
|
8777
8807
|
}
|
|
8778
8808
|
collectUnderlineAncestors(e) {
|
|
8779
|
-
return Q(e,
|
|
8809
|
+
return Q(e, Zs);
|
|
8780
8810
|
}
|
|
8781
8811
|
getRangeHtmlWithoutUnderline(e) {
|
|
8782
8812
|
let t = e.cloneContents();
|
|
@@ -8833,16 +8863,16 @@ var Ys, Xs = (e) => e.tagName === "U", Zs = class {
|
|
|
8833
8863
|
n.insertBefore(r, t.nextSibling), n.insertBefore(e, r);
|
|
8834
8864
|
}
|
|
8835
8865
|
};
|
|
8836
|
-
|
|
8866
|
+
Xs = Qs, Xs.isInline = !0, Xs.title = "Underline", Xs.titleKey = "underline", Xs.shortcut = "CMD+U";
|
|
8837
8867
|
//#endregion
|
|
8838
8868
|
//#region src/components/inline-tools/inline-tool-strikethrough.ts
|
|
8839
|
-
var
|
|
8869
|
+
var $s, ec = (e) => e.tagName === "S", tc = class {
|
|
8840
8870
|
static get sanitize() {
|
|
8841
8871
|
return { s: {} };
|
|
8842
8872
|
}
|
|
8843
8873
|
render() {
|
|
8844
8874
|
return {
|
|
8845
|
-
icon:
|
|
8875
|
+
icon: a,
|
|
8846
8876
|
name: "strikethrough",
|
|
8847
8877
|
onActivate: () => {
|
|
8848
8878
|
this.toggleStrikethrough();
|
|
@@ -8882,7 +8912,7 @@ var Qs, $s = (e) => e.tagName === "S", ec = class {
|
|
|
8882
8912
|
return this.isRangeStrikethrough(t, { ignoreWhitespace: !0 });
|
|
8883
8913
|
}
|
|
8884
8914
|
isRangeStrikethrough(e, t) {
|
|
8885
|
-
return
|
|
8915
|
+
return Is(e, ec, t);
|
|
8886
8916
|
}
|
|
8887
8917
|
wrapWithStrikethrough(e) {
|
|
8888
8918
|
let t = this.getRangeHtmlWithoutStrikethrough(e), n = this.replaceRangeWithHtml(e, `<s>${t}</s>`), r = window.getSelection();
|
|
@@ -8908,13 +8938,13 @@ var Qs, $s = (e) => e.tagName === "S", ec = class {
|
|
|
8908
8938
|
});
|
|
8909
8939
|
}
|
|
8910
8940
|
hasStrikethroughParent(e) {
|
|
8911
|
-
return
|
|
8941
|
+
return Fs(e, ec);
|
|
8912
8942
|
}
|
|
8913
8943
|
findStrikethroughElement(e) {
|
|
8914
|
-
return Z(e,
|
|
8944
|
+
return Z(e, ec);
|
|
8915
8945
|
}
|
|
8916
8946
|
collectStrikethroughAncestors(e) {
|
|
8917
|
-
return Q(e,
|
|
8947
|
+
return Q(e, ec);
|
|
8918
8948
|
}
|
|
8919
8949
|
getRangeHtmlWithoutStrikethrough(e) {
|
|
8920
8950
|
let t = e.cloneContents();
|
|
@@ -8971,16 +9001,16 @@ var Qs, $s = (e) => e.tagName === "S", ec = class {
|
|
|
8971
9001
|
n.insertBefore(r, t.nextSibling), n.insertBefore(e, r);
|
|
8972
9002
|
}
|
|
8973
9003
|
};
|
|
8974
|
-
|
|
9004
|
+
$s = tc, $s.isInline = !0, $s.title = "Strikethrough", $s.titleKey = "strikethrough", $s.shortcut = "CMD+SHIFT+S";
|
|
8975
9005
|
//#endregion
|
|
8976
9006
|
//#region src/components/inline-tools/inline-tool-code.ts
|
|
8977
|
-
var
|
|
9007
|
+
var nc, rc = (e) => e.tagName === "CODE", ic = class {
|
|
8978
9008
|
static get sanitize() {
|
|
8979
9009
|
return { code: {} };
|
|
8980
9010
|
}
|
|
8981
9011
|
render() {
|
|
8982
9012
|
return {
|
|
8983
|
-
icon:
|
|
9013
|
+
icon: Re,
|
|
8984
9014
|
name: "code",
|
|
8985
9015
|
onActivate: () => {
|
|
8986
9016
|
this.toggleCode();
|
|
@@ -9020,7 +9050,7 @@ var tc, nc = (e) => e.tagName === "CODE", rc = class {
|
|
|
9020
9050
|
return this.isRangeCode(t, { ignoreWhitespace: !0 });
|
|
9021
9051
|
}
|
|
9022
9052
|
isRangeCode(e, t) {
|
|
9023
|
-
return
|
|
9053
|
+
return Is(e, rc, t);
|
|
9024
9054
|
}
|
|
9025
9055
|
wrapWithCode(e) {
|
|
9026
9056
|
let t = this.getRangeHtmlWithoutCode(e), n = this.replaceRangeWithHtml(e, `<code>${t}</code>`), r = window.getSelection();
|
|
@@ -9046,10 +9076,10 @@ var tc, nc = (e) => e.tagName === "CODE", rc = class {
|
|
|
9046
9076
|
});
|
|
9047
9077
|
}
|
|
9048
9078
|
findCodeElement(e) {
|
|
9049
|
-
return Z(e,
|
|
9079
|
+
return Z(e, rc);
|
|
9050
9080
|
}
|
|
9051
9081
|
collectCodeAncestors(e) {
|
|
9052
|
-
return Q(e,
|
|
9082
|
+
return Q(e, rc);
|
|
9053
9083
|
}
|
|
9054
9084
|
getRangeHtmlWithoutCode(e) {
|
|
9055
9085
|
let t = e.cloneContents();
|
|
@@ -9106,10 +9136,10 @@ var tc, nc = (e) => e.tagName === "CODE", rc = class {
|
|
|
9106
9136
|
n.insertBefore(r, t.nextSibling), n.insertBefore(e, r);
|
|
9107
9137
|
}
|
|
9108
9138
|
};
|
|
9109
|
-
|
|
9139
|
+
nc = ic, nc.isInline = !0, nc.title = "Code", nc.titleKey = "inlineCode", nc.shortcut = "CMD+E";
|
|
9110
9140
|
//#endregion
|
|
9111
9141
|
//#region src/tools/index.ts
|
|
9112
|
-
var
|
|
9142
|
+
var ac = {
|
|
9113
9143
|
paragraph: { preserveBlank: !0 },
|
|
9114
9144
|
header: {},
|
|
9115
9145
|
list: {},
|
|
@@ -9119,7 +9149,7 @@ var ic = {
|
|
|
9119
9149
|
divider: {},
|
|
9120
9150
|
quote: {},
|
|
9121
9151
|
code: { inlineToolbar: !1 }
|
|
9122
|
-
},
|
|
9152
|
+
}, oc = {
|
|
9123
9153
|
bold: {},
|
|
9124
9154
|
italic: {},
|
|
9125
9155
|
link: {},
|
|
@@ -9129,4 +9159,4 @@ var ic = {
|
|
|
9129
9159
|
inlineCode: {}
|
|
9130
9160
|
};
|
|
9131
9161
|
//#endregion
|
|
9132
|
-
export { Ht as _,
|
|
9162
|
+
export { Ht as _, Qs as a, Bs as c, ho as d, uo as f, cr as g, fa as h, tc as i, Ls as l, _a as m, oc as n, Ys as o, lo as p, ic as r, Ws as s, ac as t, Cs as u, Et as v };
|