noteloom 0.6.0 → 0.7.0
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/canvas.cjs +1 -1
- package/dist/canvas.js +1 -1
- package/dist/comments.cjs +1 -1
- package/dist/comments.js +3 -3
- package/dist/index.cjs +2 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +6 -0
- package/dist/index.js +1529 -1488
- package/dist/index.js.map +1 -1
- package/dist/shared/{CommentThreadCard-DcCHq2Dy.cjs → CommentThreadCard-CIB6nZEA.cjs} +2 -2
- package/dist/shared/{CommentThreadCard-DcCHq2Dy.cjs.map → CommentThreadCard-CIB6nZEA.cjs.map} +1 -1
- package/dist/shared/{CommentThreadCard-DwtE85Xx.js → CommentThreadCard-lW_lbI74.js} +2 -2
- package/dist/shared/{CommentThreadCard-DwtE85Xx.js.map → CommentThreadCard-lW_lbI74.js.map} +1 -1
- package/dist/shared/{CommentsPanel-BRgACUu_.cjs → CommentsPanel-CRxb3RWi.cjs} +2 -2
- package/dist/shared/{CommentsPanel-BRgACUu_.cjs.map → CommentsPanel-CRxb3RWi.cjs.map} +1 -1
- package/dist/shared/{CommentsPanel-D4eP-K_f.js → CommentsPanel-Dg0k_XNU.js} +3 -3
- package/dist/shared/{CommentsPanel-D4eP-K_f.js.map → CommentsPanel-Dg0k_XNU.js.map} +1 -1
- package/dist/shared/{VersionHistory-BRBYQgj5.cjs → VersionHistory-BsSwOq_k.cjs} +2 -2
- package/dist/shared/{VersionHistory-BRBYQgj5.cjs.map → VersionHistory-BsSwOq_k.cjs.map} +1 -1
- package/dist/shared/{VersionHistory-D9sIIAYN.js → VersionHistory-BzMnJpbc.js} +3 -3
- package/dist/shared/{VersionHistory-D9sIIAYN.js.map → VersionHistory-BzMnJpbc.js.map} +1 -1
- package/dist/shared/{VoiceListeningIndicator-Dw0fggpE.cjs → VoiceListeningIndicator-B_7-6Mq4.cjs} +2 -2
- package/dist/shared/{VoiceListeningIndicator-Dw0fggpE.cjs.map → VoiceListeningIndicator-B_7-6Mq4.cjs.map} +1 -1
- package/dist/shared/{VoiceListeningIndicator-DgLMmGSP.js → VoiceListeningIndicator-DeA3hb33.js} +4 -4
- package/dist/shared/{VoiceListeningIndicator-DgLMmGSP.js.map → VoiceListeningIndicator-DeA3hb33.js.map} +1 -1
- package/dist/shared/{icons-Bdptdx1e.js → icons-CmfXmn13.js} +307 -259
- package/dist/shared/icons-CmfXmn13.js.map +1 -0
- package/dist/shared/{icons-DabR_JDW.cjs → icons-DQ7j_-ZK.cjs} +44 -3
- package/dist/shared/icons-DQ7j_-ZK.cjs.map +1 -0
- package/dist/shared/{index-DOIEccLM.js → index-DUigqWQn.js} +3 -3
- package/dist/shared/{index-DOIEccLM.js.map → index-DUigqWQn.js.map} +1 -1
- package/dist/shared/{index-B7_F6NA9.cjs → index-vWtS1iyt.cjs} +2 -2
- package/dist/shared/{index-B7_F6NA9.cjs.map → index-vWtS1iyt.cjs.map} +1 -1
- package/dist/shared/{leafBlockFactory-D3SCDvzc.cjs → leafBlockFactory-6GFBveaC.cjs} +2 -2
- package/dist/shared/{leafBlockFactory-D3SCDvzc.cjs.map → leafBlockFactory-6GFBveaC.cjs.map} +1 -1
- package/dist/shared/{leafBlockFactory-ChlzpKIn.js → leafBlockFactory-Dm6cd2NY.js} +5 -5
- package/dist/shared/{leafBlockFactory-ChlzpKIn.js.map → leafBlockFactory-Dm6cd2NY.js.map} +1 -1
- package/dist/shared/{serialize-C1rjLsIz.js → serialize-R4V4gmHs.js} +2 -2
- package/dist/shared/{serialize-C1rjLsIz.js.map → serialize-R4V4gmHs.js.map} +1 -1
- package/dist/shared/{serialize-k0zXqwEM.cjs → serialize-vLXz0cze.cjs} +2 -2
- package/dist/shared/{serialize-k0zXqwEM.cjs.map → serialize-vLXz0cze.cjs.map} +1 -1
- package/dist/shared/starter-kit-BQUaaql0.cjs +29 -0
- package/dist/shared/starter-kit-BQUaaql0.cjs.map +1 -0
- package/dist/shared/{starter-kit-CJzWMyF8.js → starter-kit-Bp30PiE4.js} +1246 -1188
- package/dist/shared/starter-kit-Bp30PiE4.js.map +1 -0
- package/dist/shared/{usePopoverEdgeClamp-gRlLQeVG.cjs → usePopoverEdgeClamp-BJLbbANB.cjs} +2 -2
- package/dist/shared/{usePopoverEdgeClamp-gRlLQeVG.cjs.map → usePopoverEdgeClamp-BJLbbANB.cjs.map} +1 -1
- package/dist/shared/{usePopoverEdgeClamp-B9KNv9SE.js → usePopoverEdgeClamp-DSpz-6xR.js} +2 -2
- package/dist/shared/{usePopoverEdgeClamp-B9KNv9SE.js.map → usePopoverEdgeClamp-DSpz-6xR.js.map} +1 -1
- package/dist/starter-kit.cjs +1 -1
- package/dist/starter-kit.js +2 -2
- package/dist/style.css +41 -0
- package/dist/versions.cjs +1 -1
- package/dist/versions.js +1 -1
- package/dist/voice.cjs +1 -1
- package/dist/voice.js +1 -1
- package/package.json +1 -1
- package/dist/shared/icons-Bdptdx1e.js.map +0 -1
- package/dist/shared/icons-DabR_JDW.cjs.map +0 -1
- package/dist/shared/starter-kit-CJzWMyF8.js.map +0 -1
- package/dist/shared/starter-kit-Ch2LEpzF.cjs +0 -27
- package/dist/shared/starter-kit-Ch2LEpzF.cjs.map +0 -1
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
var no = Object.defineProperty;
|
|
2
2
|
var oo = (e, t, n) => t in e ? no(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
|
|
3
|
-
var
|
|
4
|
-
import { u as qe, f as te, b as ae, g as De, h as
|
|
3
|
+
var Gt = (e, t, n) => oo(e, typeof t != "symbol" ? t + "" : t, n);
|
|
4
|
+
import { u as qe, f as te, b as ae, g as De, h as Ae, i as Me, j as ct, k as gt, l as he, e as bt, c as ro } from "./index-DUigqWQn.js";
|
|
5
5
|
import { jsx as d, jsxs as T, Fragment as Te } from "react/jsx-runtime";
|
|
6
|
-
import { useState as
|
|
6
|
+
import { useState as S, useEffect as oe, useCallback as m, useLayoutEffect as at, useRef as _, useSyncExternalStore as St, Component as lo, Fragment as ao, memo as so, useMemo as Ge } from "react";
|
|
7
7
|
import { createPortal as He } from "react-dom";
|
|
8
|
-
import { l as de, P as co, X as it, b as
|
|
9
|
-
import { m as
|
|
10
|
-
import { M as
|
|
11
|
-
import { a as
|
|
12
|
-
import { c as
|
|
8
|
+
import { l as de, P as co, X as it, b as pn, a as K, E as Dt, u as io, a8 as Pe, o as Ve, g as C, n as q, k as ke, s as Lt, G as se, J as fn, aq as mn, ar as hn, as as gn, D as bn, at as yn, au as kn, av as Ht, ae as Oe, aw as vn, ax as In, ak as wn, m as yt, a1 as uo, j as V, ah as Tn, ay as po, a2 as fo, K as Cn, L as Bn, a4 as mo, a5 as ho, az as Nn, aA as Rn, T as Ln, a0 as go, aj as Pt, am as bo, aB as yo, aC as ko, aD as vo, ap as Io, aE as wo, aF as To, a6 as Co, aG as Bo, ad as An, aH as Mn, aI as No, aJ as Ro, aK as Lo, r as Ao, al as Mo, aL as Eo } from "./icons-CmfXmn13.js";
|
|
9
|
+
import { m as $o, b as En, g as ve, E as At, l as xo, c as U, n as Oo, i as Ye, o as Xe, p as le, t as re, a as be, q as $n, u as So, d as xn, r as Do, f as Ho } from "./leafBlockFactory-Dm6cd2NY.js";
|
|
10
|
+
import { M as _t, b as Po, d as _o, c as On, a as Uo, e as jo } from "./usePopoverEdgeClamp-DSpz-6xR.js";
|
|
11
|
+
import { a as Fo } from "./CommentThreadCard-lW_lbI74.js";
|
|
12
|
+
import { c as Ko, r as zo } from "./serialize-R4V4gmHs.js";
|
|
13
13
|
function Sn(e) {
|
|
14
14
|
return e ? e.type !== "text" ? !1 : (e.value ?? "") === "" : !0;
|
|
15
15
|
}
|
|
@@ -22,7 +22,7 @@ function kt(e, t) {
|
|
|
22
22
|
const n = t.contentIds.length > 0, o = (((l = (r = t.props) == null ? void 0 : r.titleRunIds) == null ? void 0 : l.length) ?? 0) > 0;
|
|
23
23
|
return !n && !o;
|
|
24
24
|
}
|
|
25
|
-
function
|
|
25
|
+
function Vo({
|
|
26
26
|
isOpen: e,
|
|
27
27
|
initialHref: t,
|
|
28
28
|
initialTarget: n,
|
|
@@ -31,17 +31,17 @@ function zo({
|
|
|
31
31
|
onRemove: l,
|
|
32
32
|
onClose: a
|
|
33
33
|
}) {
|
|
34
|
-
const [s, c] =
|
|
34
|
+
const [s, c] = S(""), [u, p] = S("_self");
|
|
35
35
|
oe(() => {
|
|
36
36
|
e && (c(t), p(n));
|
|
37
37
|
}, [e]);
|
|
38
|
-
const i = s.trim(), f =
|
|
39
|
-
(
|
|
40
|
-
|
|
38
|
+
const i = s.trim(), f = m(
|
|
39
|
+
(y) => {
|
|
40
|
+
y.preventDefault(), i && r(i, u);
|
|
41
41
|
},
|
|
42
42
|
[i, u, r]
|
|
43
43
|
);
|
|
44
|
-
return /* @__PURE__ */ d(
|
|
44
|
+
return /* @__PURE__ */ d(_t, { isOpen: e, onClose: a, title: o ? "Edit link" : "Add link", children: /* @__PURE__ */ T("form", { onSubmit: f, children: [
|
|
45
45
|
/* @__PURE__ */ T("label", { className: "be-modal-field", children: [
|
|
46
46
|
/* @__PURE__ */ d("span", { children: "URL" }),
|
|
47
47
|
/* @__PURE__ */ d(
|
|
@@ -49,7 +49,7 @@ function zo({
|
|
|
49
49
|
{
|
|
50
50
|
type: "text",
|
|
51
51
|
value: s,
|
|
52
|
-
onChange: (
|
|
52
|
+
onChange: (y) => c(y.target.value),
|
|
53
53
|
placeholder: "https://example.com",
|
|
54
54
|
autoFocus: !0
|
|
55
55
|
}
|
|
@@ -57,7 +57,7 @@ function zo({
|
|
|
57
57
|
] }),
|
|
58
58
|
/* @__PURE__ */ T("label", { className: "be-modal-field", children: [
|
|
59
59
|
/* @__PURE__ */ d("span", { children: "Open in" }),
|
|
60
|
-
/* @__PURE__ */ T("select", { value: u, onChange: (
|
|
60
|
+
/* @__PURE__ */ T("select", { value: u, onChange: (y) => p(y.target.value), children: [
|
|
61
61
|
/* @__PURE__ */ d("option", { value: "_self", children: "Same tab" }),
|
|
62
62
|
/* @__PURE__ */ d("option", { value: "_blank", children: "New tab" })
|
|
63
63
|
] })
|
|
@@ -70,7 +70,7 @@ function zo({
|
|
|
70
70
|
] }) });
|
|
71
71
|
}
|
|
72
72
|
function vt(e, t, n, o) {
|
|
73
|
-
const [r, l] =
|
|
73
|
+
const [r, l] = S(null);
|
|
74
74
|
return at(() => {
|
|
75
75
|
if (n == null || o == null) {
|
|
76
76
|
l(null);
|
|
@@ -79,53 +79,53 @@ function vt(e, t, n, o) {
|
|
|
79
79
|
l({ top: n, left: o });
|
|
80
80
|
}, [n, o]), at(() => {
|
|
81
81
|
if (!t || !e.current || !r) return;
|
|
82
|
-
const a = e.current.getBoundingClientRect(), s =
|
|
82
|
+
const a = e.current.getBoundingClientRect(), s = Po(r.left, a.width), c = _o(r.top, a.height);
|
|
83
83
|
(s !== r.left || c !== r.top) && l({ top: c, left: s });
|
|
84
84
|
}, [t, e, r]), r;
|
|
85
85
|
}
|
|
86
86
|
function Go({ containerRef: e, store: t }) {
|
|
87
|
-
var
|
|
88
|
-
const [n, o] =
|
|
87
|
+
var h;
|
|
88
|
+
const [n, o] = S(null), [r, l] = S(!1), a = _(null), s = _(null), c = m(() => {
|
|
89
89
|
a.current && (clearTimeout(a.current), a.current = null);
|
|
90
|
-
}, []), u =
|
|
90
|
+
}, []), u = m(() => {
|
|
91
91
|
c(), a.current = setTimeout(() => {
|
|
92
|
-
o((
|
|
92
|
+
o((b) => r ? b : null);
|
|
93
93
|
}, 250);
|
|
94
94
|
}, [c, r]);
|
|
95
95
|
oe(() => {
|
|
96
|
-
const
|
|
97
|
-
if (!
|
|
96
|
+
const b = e.current;
|
|
97
|
+
if (!b) return;
|
|
98
98
|
const B = (D) => {
|
|
99
|
-
var j, w,
|
|
99
|
+
var j, w, R;
|
|
100
100
|
const L = (w = (j = D.target).closest) == null ? void 0 : w.call(j, "[data-run-id]");
|
|
101
|
-
if (!L || !
|
|
102
|
-
const
|
|
103
|
-
(
|
|
104
|
-
(
|
|
101
|
+
if (!L || !b.contains(L)) return;
|
|
102
|
+
const x = L.dataset.runId, E = t.getRun(x);
|
|
103
|
+
(R = E == null ? void 0 : E.marks) != null && R.link && (c(), o(
|
|
104
|
+
(O) => (O == null ? void 0 : O.runId) === x ? O : { runId: x, rect: L.getBoundingClientRect() }
|
|
105
105
|
));
|
|
106
|
-
},
|
|
107
|
-
return
|
|
108
|
-
|
|
106
|
+
}, $ = () => u();
|
|
107
|
+
return b.addEventListener("mouseover", B), b.addEventListener("mouseout", $), () => {
|
|
108
|
+
b.removeEventListener("mouseover", B), b.removeEventListener("mouseout", $);
|
|
109
109
|
};
|
|
110
110
|
}, [e, t, c, u]), oe(() => () => c(), [c]);
|
|
111
|
-
const p =
|
|
111
|
+
const p = m(() => l(!0), []), i = m(() => {
|
|
112
112
|
l(!1), o(null);
|
|
113
|
-
}, []), f =
|
|
114
|
-
(
|
|
113
|
+
}, []), f = m(
|
|
114
|
+
(b, B) => {
|
|
115
115
|
if (!n) return;
|
|
116
|
-
const
|
|
117
|
-
|
|
118
|
-
de(n.runId, { marks: {
|
|
116
|
+
const $ = t.getRun(n.runId);
|
|
117
|
+
$ && (t.applyOperation(
|
|
118
|
+
de(n.runId, { marks: { ...$.marks, link: { href: b, target: B } } })
|
|
119
119
|
), i());
|
|
120
120
|
},
|
|
121
121
|
[n, t, i]
|
|
122
|
-
),
|
|
122
|
+
), y = m(() => {
|
|
123
123
|
if (!n) return;
|
|
124
|
-
const
|
|
125
|
-
if (!
|
|
126
|
-
const B = { ...
|
|
124
|
+
const b = t.getRun(n.runId);
|
|
125
|
+
if (!b) return;
|
|
126
|
+
const B = { ...b.marks };
|
|
127
127
|
delete B.link, t.applyOperation(de(n.runId, { marks: B })), i();
|
|
128
|
-
}, [n, t, i]), v = n && t.getRun(n.runId), g = (
|
|
128
|
+
}, [n, t, i]), v = n && t.getRun(n.runId), g = (h = v == null ? void 0 : v.marks) == null ? void 0 : h.link, k = !!(n && g && !r), I = vt(
|
|
129
129
|
s,
|
|
130
130
|
k,
|
|
131
131
|
n ? n.rect.bottom + 6 : null,
|
|
@@ -169,7 +169,7 @@ function Go({ containerRef: e, store: t }) {
|
|
|
169
169
|
{
|
|
170
170
|
type: "button",
|
|
171
171
|
className: "be-link-hover-card-btn",
|
|
172
|
-
onClick:
|
|
172
|
+
onClick: y,
|
|
173
173
|
"aria-label": "Remove link",
|
|
174
174
|
title: "Remove link",
|
|
175
175
|
children: /* @__PURE__ */ d(it, { size: 13 })
|
|
@@ -181,20 +181,20 @@ function Go({ containerRef: e, store: t }) {
|
|
|
181
181
|
document.body
|
|
182
182
|
) : null,
|
|
183
183
|
/* @__PURE__ */ d(
|
|
184
|
-
|
|
184
|
+
Vo,
|
|
185
185
|
{
|
|
186
186
|
isOpen: r,
|
|
187
187
|
initialHref: (g == null ? void 0 : g.href) ?? "",
|
|
188
188
|
initialTarget: (g == null ? void 0 : g.target) ?? "_self",
|
|
189
189
|
hasExistingLink: !!g,
|
|
190
190
|
onSave: f,
|
|
191
|
-
onRemove:
|
|
191
|
+
onRemove: y,
|
|
192
192
|
onClose: i
|
|
193
193
|
}
|
|
194
194
|
)
|
|
195
195
|
] });
|
|
196
196
|
}
|
|
197
|
-
function
|
|
197
|
+
function Wo({ title: e, onClose: t }) {
|
|
198
198
|
return /* @__PURE__ */ T("div", { className: "be-comment-popover-header", children: [
|
|
199
199
|
/* @__PURE__ */ d("span", { className: "be-comment-popover-title", children: e }),
|
|
200
200
|
/* @__PURE__ */ d(
|
|
@@ -209,64 +209,64 @@ function Vo({ title: e, onClose: t }) {
|
|
|
209
209
|
)
|
|
210
210
|
] });
|
|
211
211
|
}
|
|
212
|
-
const
|
|
213
|
-
function
|
|
214
|
-
const [o, r] =
|
|
212
|
+
const qo = 'button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])';
|
|
213
|
+
function Yo({ containerRef: e, store: t, authorId: n }) {
|
|
214
|
+
const [o, r] = S(null), [l, a] = S(!1), s = _(null), c = _(null), u = _(null), [, p] = pn(), i = m(() => {
|
|
215
215
|
s.current && (clearTimeout(s.current), s.current = null);
|
|
216
|
-
}, []), f =
|
|
216
|
+
}, []), f = m(() => {
|
|
217
217
|
i(), s.current = setTimeout(() => {
|
|
218
|
-
r((
|
|
218
|
+
r((h) => l ? h : null);
|
|
219
219
|
}, 250);
|
|
220
220
|
}, [i, l]);
|
|
221
221
|
oe(() => {
|
|
222
|
-
const
|
|
223
|
-
if (!
|
|
224
|
-
const
|
|
225
|
-
var j, w,
|
|
226
|
-
const
|
|
227
|
-
if (
|
|
228
|
-
const E = (
|
|
229
|
-
return E != null && E.length ? { runEl:
|
|
222
|
+
const h = e.current;
|
|
223
|
+
if (!h) return;
|
|
224
|
+
const b = (L) => {
|
|
225
|
+
var j, w, R;
|
|
226
|
+
const x = (j = L == null ? void 0 : L.closest) == null ? void 0 : j.call(L, "[data-run-id]");
|
|
227
|
+
if (!x || !h.contains(x)) return null;
|
|
228
|
+
const E = (R = (w = t.getRun(x.dataset.runId)) == null ? void 0 : w.marks) == null ? void 0 : R.commentIds;
|
|
229
|
+
return E != null && E.length ? { runEl: x, commentIds: E } : null;
|
|
230
230
|
}, B = (L) => {
|
|
231
|
-
const
|
|
232
|
-
|
|
233
|
-
(E) => E && E.runEl ===
|
|
234
|
-
rect:
|
|
235
|
-
commentIds:
|
|
236
|
-
runEl:
|
|
231
|
+
const x = b(L.target);
|
|
232
|
+
x && (i(), r(
|
|
233
|
+
(E) => E && E.runEl === x.runEl ? E : {
|
|
234
|
+
rect: x.runEl.getBoundingClientRect(),
|
|
235
|
+
commentIds: x.commentIds,
|
|
236
|
+
runEl: x.runEl
|
|
237
237
|
}
|
|
238
238
|
));
|
|
239
|
-
},
|
|
240
|
-
const
|
|
241
|
-
if (
|
|
239
|
+
}, $ = () => f(), D = (L) => {
|
|
240
|
+
const x = b(L.target);
|
|
241
|
+
if (!x) {
|
|
242
242
|
a(!1), r(null);
|
|
243
243
|
return;
|
|
244
244
|
}
|
|
245
245
|
i(), a(!0), r({
|
|
246
|
-
rect:
|
|
247
|
-
commentIds:
|
|
248
|
-
runEl:
|
|
246
|
+
rect: x.runEl.getBoundingClientRect(),
|
|
247
|
+
commentIds: x.commentIds,
|
|
248
|
+
runEl: x.runEl
|
|
249
249
|
});
|
|
250
250
|
};
|
|
251
|
-
return
|
|
252
|
-
|
|
251
|
+
return h.addEventListener("mouseover", B), h.addEventListener("mouseout", $), h.addEventListener("click", D), () => {
|
|
252
|
+
h.removeEventListener("mouseover", B), h.removeEventListener("mouseout", $), h.removeEventListener("click", D);
|
|
253
253
|
};
|
|
254
254
|
}, [e, t, i, f]), oe(() => {
|
|
255
255
|
if (!o) return;
|
|
256
|
-
const
|
|
257
|
-
var
|
|
258
|
-
(
|
|
259
|
-
},
|
|
256
|
+
const h = (B) => {
|
|
257
|
+
var $, D;
|
|
258
|
+
($ = c.current) != null && $.contains(B.target) || (D = e.current) != null && D.contains(B.target) || (a(!1), r(null));
|
|
259
|
+
}, b = (B) => {
|
|
260
260
|
B.key === "Escape" && (a(!1), r(null));
|
|
261
261
|
};
|
|
262
|
-
return document.addEventListener("mousedown",
|
|
263
|
-
document.removeEventListener("mousedown",
|
|
262
|
+
return document.addEventListener("mousedown", h), document.addEventListener("keydown", b), () => {
|
|
263
|
+
document.removeEventListener("mousedown", h), document.removeEventListener("keydown", b);
|
|
264
264
|
};
|
|
265
265
|
}, [o, e]), oe(() => () => i(), [i]), oe(() => {
|
|
266
|
-
var
|
|
267
|
-
p(((
|
|
266
|
+
var h;
|
|
267
|
+
p(((h = o == null ? void 0 : o.commentIds) == null ? void 0 : h[0]) ?? null);
|
|
268
268
|
}, [o, p]);
|
|
269
|
-
const
|
|
269
|
+
const y = m(() => {
|
|
270
270
|
a(!1), r(null);
|
|
271
271
|
}, []), v = !!o, g = vt(
|
|
272
272
|
c,
|
|
@@ -275,10 +275,10 @@ function qo({ containerRef: e, store: t, authorId: n }) {
|
|
|
275
275
|
o ? o.rect.left : null
|
|
276
276
|
), k = _(!1);
|
|
277
277
|
if (oe(() => {
|
|
278
|
-
var
|
|
279
|
-
l && c.current && !k.current ? (k.current = !0, u.current = document.activeElement, (c.current.querySelector(
|
|
278
|
+
var h, b;
|
|
279
|
+
l && c.current && !k.current ? (k.current = !0, u.current = document.activeElement, (c.current.querySelector(qo) ?? c.current).focus()) : !l && k.current && (k.current = !1, (b = (h = u.current) == null ? void 0 : h.focus) == null || b.call(h), u.current = null);
|
|
280
280
|
}, [l, g]), !v || !g) return null;
|
|
281
|
-
const I = o.commentIds.map((
|
|
281
|
+
const I = o.commentIds.map((h) => t.getComment(h)).filter(Boolean);
|
|
282
282
|
return I.length === 0 ? null : He(
|
|
283
283
|
/* @__PURE__ */ T(
|
|
284
284
|
"div",
|
|
@@ -294,20 +294,20 @@ function qo({ containerRef: e, store: t, authorId: n }) {
|
|
|
294
294
|
"aria-label": `Comments (${I.length})`,
|
|
295
295
|
tabIndex: -1,
|
|
296
296
|
children: [
|
|
297
|
-
/* @__PURE__ */ d(
|
|
298
|
-
I.map((
|
|
297
|
+
/* @__PURE__ */ d(Wo, { title: `Comments (${I.length})`, onClose: y }),
|
|
298
|
+
I.map((h) => /* @__PURE__ */ d(Fo, { store: t, thread: h, authorId: n }, h.id))
|
|
299
299
|
]
|
|
300
300
|
}
|
|
301
301
|
),
|
|
302
302
|
document.body
|
|
303
303
|
);
|
|
304
304
|
}
|
|
305
|
-
function
|
|
305
|
+
function Wt(e, t) {
|
|
306
306
|
const n = e == null ? void 0 : e.parentElement;
|
|
307
307
|
if (!n || !n.hasAttribute("data-placeholder")) return;
|
|
308
308
|
t.length === 0 || t.every(Sn) ? n.setAttribute("data-empty", "") : n.removeAttribute("data-empty");
|
|
309
309
|
}
|
|
310
|
-
function
|
|
310
|
+
function Xo(e = {}) {
|
|
311
311
|
return {
|
|
312
312
|
fontWeight: e.bold ? "bold" : void 0,
|
|
313
313
|
fontStyle: e.italic ? "italic" : void 0,
|
|
@@ -319,21 +319,25 @@ function Yo(e = {}) {
|
|
|
319
319
|
cursor: e.link ? "pointer" : void 0
|
|
320
320
|
};
|
|
321
321
|
}
|
|
322
|
-
function
|
|
322
|
+
function Qo(e, t) {
|
|
323
323
|
const n = e.childNodes.length === 1 ? e.firstChild : null;
|
|
324
324
|
n && n.nodeType === 3 ? n.nodeValue !== t && (n.nodeValue = t) : e.textContent = t;
|
|
325
325
|
}
|
|
326
|
-
function
|
|
327
|
-
|
|
326
|
+
function Jo(e) {
|
|
327
|
+
return e === "" ? At : e.endsWith(`
|
|
328
|
+
`) ? e + At : e;
|
|
329
|
+
}
|
|
330
|
+
function Zo({ id: e, host: t, onValueSynced: n }) {
|
|
331
|
+
const o = qe(e), [r] = pn();
|
|
328
332
|
return at(() => {
|
|
329
|
-
var p, i, f,
|
|
333
|
+
var p, i, f, y, v;
|
|
330
334
|
if (!t || !o) return;
|
|
331
335
|
const l = o.value ?? "";
|
|
332
|
-
(
|
|
333
|
-
const c =
|
|
336
|
+
(xo(t.textContent) !== l || l === "" && t.textContent === "") && Qo(t, Jo(l));
|
|
337
|
+
const c = Xo(o.marks);
|
|
334
338
|
t.style.fontWeight = c.fontWeight ?? "", t.style.fontStyle = c.fontStyle ?? "", t.style.textDecoration = c.textDecoration ?? "", t.style.verticalAlign = c.verticalAlign ?? "", t.style.fontSize = c.fontSize ?? "", t.style.color = c.color ?? "", t.style.backgroundColor = c.backgroundColor ?? "", t.style.cursor = c.cursor ?? "", t.classList.toggle("be-comment-highlight", (((i = (p = o.marks) == null ? void 0 : p.commentIds) == null ? void 0 : i.length) ?? 0) > 0), t.classList.toggle(
|
|
335
339
|
"be-comment-highlight-active",
|
|
336
|
-
!!r && !!((
|
|
340
|
+
!!r && !!((y = (f = o.marks) == null ? void 0 : f.commentIds) != null && y.includes(r))
|
|
337
341
|
);
|
|
338
342
|
const u = (v = o.marks) == null ? void 0 : v.link;
|
|
339
343
|
t.title = u != null && u.href ? `${u.href} — Ctrl+Click to open` : "", t.onclick = u != null && u.href ? (g) => {
|
|
@@ -345,8 +349,8 @@ function Qo({ id: e, host: t, onValueSynced: n }) {
|
|
|
345
349
|
} : null, n == null || n();
|
|
346
350
|
}, [t, o, n, r]), null;
|
|
347
351
|
}
|
|
348
|
-
function
|
|
349
|
-
var i, f,
|
|
352
|
+
function qt(e, t, n, o) {
|
|
353
|
+
var i, f, y;
|
|
350
354
|
const r = (i = window.getSelection) == null ? void 0 : i.call(window);
|
|
351
355
|
if (!r || !r.isCollapsed || r.rangeCount === 0) return null;
|
|
352
356
|
const { anchorNode: l, anchorOffset: a } = r;
|
|
@@ -365,10 +369,10 @@ function Vt(e, t, n, o) {
|
|
|
365
369
|
const I = n(k);
|
|
366
370
|
return I && I.type !== "text" ? k : null;
|
|
367
371
|
}
|
|
368
|
-
const c = l.nodeType === 1 ? l : l.parentElement, u = (
|
|
372
|
+
const c = l.nodeType === 1 ? l : l.parentElement, u = (y = c == null ? void 0 : c.closest) == null ? void 0 : y.call(c, "[data-run-id]");
|
|
369
373
|
return !u || !e.contains(u) || !(o ? a === 0 : a === (l.textContent ?? "").length) ? null : s(u.getAttribute("data-run-id"));
|
|
370
374
|
}
|
|
371
|
-
function
|
|
375
|
+
function Yt(e, t, n) {
|
|
372
376
|
var c, u;
|
|
373
377
|
const o = (c = window.getSelection) == null ? void 0 : c.call(window);
|
|
374
378
|
if (!o || o.isCollapsed || o.rangeCount === 0) return null;
|
|
@@ -379,7 +383,7 @@ function Wt(e, t, n) {
|
|
|
379
383
|
const s = n(a);
|
|
380
384
|
return s && s.type !== "text" ? a : null;
|
|
381
385
|
}
|
|
382
|
-
function
|
|
386
|
+
function Xt(e, t, n) {
|
|
383
387
|
var s;
|
|
384
388
|
if (t === e) return { childIndex: n, charOffset: null };
|
|
385
389
|
const o = t.nodeType === 1 ? t : t.parentElement, r = (s = o == null ? void 0 : o.closest) == null ? void 0 : s.call(o, "[data-run-id]");
|
|
@@ -387,8 +391,8 @@ function qt(e, t, n) {
|
|
|
387
391
|
const l = Array.prototype.indexOf.call(e.childNodes, r), a = t === r ? n === 0 ? 0 : (r.textContent ?? "").length : n;
|
|
388
392
|
return { childIndex: l, charOffset: a };
|
|
389
393
|
}
|
|
390
|
-
function
|
|
391
|
-
const r =
|
|
394
|
+
function er(e, t, n, o) {
|
|
395
|
+
const r = Xt(e, o.startContainer, o.startOffset), l = Xt(e, o.endContainer, o.endOffset);
|
|
392
396
|
if (!r || !l) return null;
|
|
393
397
|
const a = Array.from(e.childNodes).filter(
|
|
394
398
|
(p) => {
|
|
@@ -400,32 +404,32 @@ function Jo(e, t, n, o) {
|
|
|
400
404
|
const c = [];
|
|
401
405
|
let u = null;
|
|
402
406
|
return a.forEach((p, i) => {
|
|
403
|
-
const f = p.dataset.runId,
|
|
404
|
-
if (!
|
|
407
|
+
const f = p.dataset.runId, y = n(f);
|
|
408
|
+
if (!y) return;
|
|
405
409
|
const v = i < r.childIndex, g = l.charOffset === null ? i >= l.childIndex : i > l.childIndex;
|
|
406
410
|
if (v || g) {
|
|
407
|
-
c.push(
|
|
411
|
+
c.push(y);
|
|
408
412
|
return;
|
|
409
413
|
}
|
|
410
414
|
const k = r.charOffset !== null && i === r.childIndex, I = l.charOffset !== null && i === l.childIndex;
|
|
411
|
-
if (
|
|
415
|
+
if (y.type !== "text") {
|
|
412
416
|
s = !0, u === null && (u = c.length);
|
|
413
417
|
return;
|
|
414
418
|
}
|
|
415
|
-
const
|
|
419
|
+
const h = y.value ?? "";
|
|
416
420
|
if (k && I) {
|
|
417
|
-
const
|
|
418
|
-
|
|
421
|
+
const b = h.slice(0, r.charOffset) + h.slice(l.charOffset);
|
|
422
|
+
b && c.push({ ...y, value: b }), u = c.length;
|
|
419
423
|
} else if (k) {
|
|
420
|
-
const
|
|
421
|
-
|
|
424
|
+
const b = h.slice(0, r.charOffset);
|
|
425
|
+
b && c.push({ ...y, value: b }), u === null && (u = c.length);
|
|
422
426
|
} else if (I) {
|
|
423
|
-
const
|
|
424
|
-
|
|
427
|
+
const b = h.slice(l.charOffset);
|
|
428
|
+
b && c.push({ id: C(), type: "text", value: b, marks: y.marks });
|
|
425
429
|
}
|
|
426
430
|
}), s ? { nextRuns: c, insertionIndex: u ?? c.length } : null;
|
|
427
431
|
}
|
|
428
|
-
function
|
|
432
|
+
function tr(e) {
|
|
429
433
|
var l;
|
|
430
434
|
const t = (l = window.getSelection) == null ? void 0 : l.call(window);
|
|
431
435
|
if (!t || !t.isCollapsed) return !1;
|
|
@@ -435,10 +439,10 @@ function Zo(e) {
|
|
|
435
439
|
let o = n;
|
|
436
440
|
for (; o && o.firstChild; ) o = o.firstChild;
|
|
437
441
|
if (t.anchorNode !== o && t.anchorNode !== n) return !1;
|
|
438
|
-
const r = o.nodeType === 3 && o.textContent ===
|
|
442
|
+
const r = o.nodeType === 3 && o.textContent === At ? 1 : 0;
|
|
439
443
|
return t.anchorOffset <= r;
|
|
440
444
|
}
|
|
441
|
-
function
|
|
445
|
+
function nr(e) {
|
|
442
446
|
var l;
|
|
443
447
|
const t = (l = window.getSelection) == null ? void 0 : l.call(window);
|
|
444
448
|
if (!t || !t.isCollapsed) return !1;
|
|
@@ -452,7 +456,7 @@ function er(e) {
|
|
|
452
456
|
const r = o.nodeType === 3 ? (o.textContent ?? "").length : 0;
|
|
453
457
|
return t.anchorOffset >= r;
|
|
454
458
|
}
|
|
455
|
-
function
|
|
459
|
+
function Qt(e, t, n) {
|
|
456
460
|
const o = e.getBlock(t), r = e.getBlock(o == null ? void 0 : o.parentId);
|
|
457
461
|
if (!r) return null;
|
|
458
462
|
const l = r.contentIds.indexOf(t), a = n === "backward" ? l - 1 : l + 1;
|
|
@@ -460,17 +464,17 @@ function Yt(e, t, n) {
|
|
|
460
464
|
const s = r.contentIds[a];
|
|
461
465
|
return kt(e, e.getBlock(s)) ? s : null;
|
|
462
466
|
}
|
|
463
|
-
function
|
|
467
|
+
function or({ id: e, blockId: t, host: n, inlineRegistry: o, onValueSynced: r }) {
|
|
464
468
|
const l = qe(e);
|
|
465
469
|
if (!l) return null;
|
|
466
|
-
if (l.type === "text") return /* @__PURE__ */ d(
|
|
470
|
+
if (l.type === "text") return /* @__PURE__ */ d(Zo, { id: e, host: n, onValueSynced: r });
|
|
467
471
|
const a = o == null ? void 0 : o.get(l.type);
|
|
468
472
|
if (!a)
|
|
469
473
|
return process.env.NODE_ENV !== "production" && console.warn(`[block-editor] No inline type registered for "${l.type}" (run: ${e})`), null;
|
|
470
474
|
const s = a.component;
|
|
471
475
|
return /* @__PURE__ */ d(s, { id: e, blockId: t });
|
|
472
476
|
}
|
|
473
|
-
function
|
|
477
|
+
function rr(e, t, n) {
|
|
474
478
|
let o = e.get(n);
|
|
475
479
|
if (!o) {
|
|
476
480
|
o = document.createElement("span"), o.dataset.runId = n;
|
|
@@ -492,67 +496,67 @@ function Ee({
|
|
|
492
496
|
onShiftTab: u,
|
|
493
497
|
onAutoformat: p
|
|
494
498
|
}) {
|
|
495
|
-
const i = K(), f =
|
|
499
|
+
const i = K(), f = Dt(), y = io(), { getSelectedBlockId: v, setSelectedBlockId: g } = Pe(), k = _(null), I = _(!1), h = _(/* @__PURE__ */ new Map());
|
|
496
500
|
at(() => {
|
|
497
501
|
const w = k.current;
|
|
498
502
|
if (!w) return;
|
|
499
|
-
const
|
|
500
|
-
for (const [P,
|
|
501
|
-
|
|
502
|
-
let
|
|
503
|
+
const R = new Set(t);
|
|
504
|
+
for (const [P, M] of h.current)
|
|
505
|
+
R.has(P) || (M.remove(), h.current.delete(P));
|
|
506
|
+
let O = null;
|
|
503
507
|
for (const P of t) {
|
|
504
|
-
const
|
|
505
|
-
if (!
|
|
506
|
-
const H =
|
|
507
|
-
H !==
|
|
508
|
+
const M = h.current.get(P);
|
|
509
|
+
if (!M) continue;
|
|
510
|
+
const H = O ? O.nextSibling : w.firstChild;
|
|
511
|
+
H !== M && w.insertBefore(M, H), O = M;
|
|
508
512
|
}
|
|
509
513
|
}, [t]);
|
|
510
|
-
const
|
|
514
|
+
const b = m(() => {
|
|
511
515
|
if (I.current) return;
|
|
512
516
|
const w = k.current;
|
|
513
517
|
if (!w) return;
|
|
514
|
-
const
|
|
515
|
-
runs:
|
|
518
|
+
const R = t.map((H) => i.getRun(H)).filter(Boolean), {
|
|
519
|
+
runs: O,
|
|
516
520
|
changed: P,
|
|
517
|
-
onlyValueChanges:
|
|
518
|
-
} =
|
|
521
|
+
onlyValueChanges: M
|
|
522
|
+
} = $o(w, R);
|
|
519
523
|
if (P) {
|
|
520
|
-
if (
|
|
521
|
-
if (
|
|
522
|
-
H !==
|
|
523
|
-
}), p != null && p(
|
|
524
|
+
if (M) {
|
|
525
|
+
if (O.forEach((H, Y) => {
|
|
526
|
+
H !== R[Y] && i.applyOperation(de(H.id, { value: H.value }));
|
|
527
|
+
}), p != null && p(O)) return;
|
|
524
528
|
} else
|
|
525
529
|
i.applyOperation(
|
|
526
|
-
|
|
530
|
+
Ve(
|
|
527
531
|
e,
|
|
528
|
-
|
|
532
|
+
O.length ? O : [{ id: C(), type: "text", value: "", marks: {} }]
|
|
529
533
|
)
|
|
530
534
|
);
|
|
531
|
-
|
|
535
|
+
Wt(w, O);
|
|
532
536
|
}
|
|
533
|
-
}, [i, e, t, p]), B =
|
|
534
|
-
|
|
535
|
-
}, [i, t]),
|
|
537
|
+
}, [i, e, t, p]), B = m(() => {
|
|
538
|
+
Wt(k.current, t.map((w) => i.getRun(w)).filter(Boolean));
|
|
539
|
+
}, [i, t]), $ = m(() => {
|
|
536
540
|
I.current = !0;
|
|
537
|
-
}, []), D =
|
|
538
|
-
I.current = !1,
|
|
539
|
-
}, [
|
|
541
|
+
}, []), D = m(() => {
|
|
542
|
+
I.current = !1, b();
|
|
543
|
+
}, [b]), L = m(
|
|
540
544
|
(w) => {
|
|
541
|
-
const
|
|
545
|
+
const O = t.map((P) => i.getRun(P)).filter(Boolean).filter((P) => P.id !== w);
|
|
542
546
|
i.applyOperation(
|
|
543
|
-
|
|
547
|
+
Ve(
|
|
544
548
|
e,
|
|
545
|
-
|
|
549
|
+
O.length ? O : [{ id: C(), type: "text", value: "", marks: {} }]
|
|
546
550
|
)
|
|
547
551
|
);
|
|
548
552
|
},
|
|
549
553
|
[i, e, t]
|
|
550
|
-
),
|
|
554
|
+
), x = m(
|
|
551
555
|
(w) => {
|
|
552
556
|
v() === w ? (i.applyOperation(q(w)), g(null)) : g(w);
|
|
553
557
|
},
|
|
554
558
|
[i, v, g]
|
|
555
|
-
), E =
|
|
559
|
+
), E = m(
|
|
556
560
|
(w) => {
|
|
557
561
|
var ie, ne, je, $e;
|
|
558
562
|
if (I.current) return;
|
|
@@ -560,34 +564,34 @@ function Ee({
|
|
|
560
564
|
const Z = w.target.nodeType === 1 ? w.target : w.target.parentElement;
|
|
561
565
|
if ((ie = Z == null ? void 0 : Z.closest) != null && ie.call(Z, '[contenteditable="false"]')) return;
|
|
562
566
|
}
|
|
563
|
-
const
|
|
564
|
-
if (!
|
|
565
|
-
const
|
|
566
|
-
if (!
|
|
567
|
+
const R = w.inputType ?? "", O = R.startsWith("delete"), P = R === "insertText" || R === "insertReplacementText";
|
|
568
|
+
if (!O && !P) return;
|
|
569
|
+
const M = k.current;
|
|
570
|
+
if (!M) return;
|
|
567
571
|
const H = (ne = w.getTargetRanges) == null ? void 0 : ne.call(w), Y = (je = window.getSelection) == null ? void 0 : je.call(window), X = (H == null ? void 0 : H[0]) ?? (Y != null && Y.rangeCount ? Y.getRangeAt(0) : null);
|
|
568
|
-
if (!X || !
|
|
572
|
+
if (!X || !M.contains(X.startContainer) || !M.contains(X.endContainer))
|
|
569
573
|
return;
|
|
570
|
-
const pe =
|
|
571
|
-
|
|
574
|
+
const pe = er(
|
|
575
|
+
M,
|
|
572
576
|
t,
|
|
573
577
|
(Z) => i.getRun(Z),
|
|
574
578
|
X
|
|
575
579
|
);
|
|
576
580
|
if (!pe) return;
|
|
577
581
|
w.preventDefault();
|
|
578
|
-
let { nextRuns: F, insertionIndex: Q } = pe,
|
|
582
|
+
let { nextRuns: F, insertionIndex: Q } = pe, G = null, me = !1;
|
|
579
583
|
if (P && w.data) {
|
|
580
584
|
const Z = { id: C(), type: "text", value: w.data, marks: {} };
|
|
581
585
|
F = [
|
|
582
586
|
...F.slice(0, Q),
|
|
583
587
|
Z,
|
|
584
588
|
...F.slice(Q)
|
|
585
|
-
],
|
|
586
|
-
} else Q > 0 ? (
|
|
589
|
+
], G = Z.id, me = !1;
|
|
590
|
+
} else Q > 0 ? (G = ($e = F[Q - 1]) == null ? void 0 : $e.id, me = !1) : F.length > 0 && (G = F[0].id, me = !0);
|
|
587
591
|
const ce = F.length ? F : [{ id: C(), type: "text", value: "", marks: {} }];
|
|
588
|
-
i.applyOperation(
|
|
589
|
-
const Ie =
|
|
590
|
-
me ?
|
|
592
|
+
i.applyOperation(Ve(e, ce));
|
|
593
|
+
const Ie = G ?? ce[0].id;
|
|
594
|
+
me ? En(Ie) : ve(Ie);
|
|
591
595
|
},
|
|
592
596
|
[i, e, t]
|
|
593
597
|
);
|
|
@@ -596,7 +600,7 @@ function Ee({
|
|
|
596
600
|
if (w)
|
|
597
601
|
return w.addEventListener("beforeinput", E), () => w.removeEventListener("beforeinput", E);
|
|
598
602
|
}, [E]);
|
|
599
|
-
const j =
|
|
603
|
+
const j = m(
|
|
600
604
|
(w) => {
|
|
601
605
|
if (!I.current) {
|
|
602
606
|
if (w.key === "Enter" && o) {
|
|
@@ -604,21 +608,21 @@ function Ee({
|
|
|
604
608
|
return;
|
|
605
609
|
}
|
|
606
610
|
if (w.key === "Backspace") {
|
|
607
|
-
const
|
|
608
|
-
if (
|
|
609
|
-
w.preventDefault(), L(
|
|
611
|
+
const R = k.current, O = R && Yt(R, t, i.getRun.bind(i));
|
|
612
|
+
if (O) {
|
|
613
|
+
w.preventDefault(), L(O);
|
|
610
614
|
return;
|
|
611
615
|
}
|
|
612
|
-
const P =
|
|
616
|
+
const P = R && qt(R, t, i.getRun.bind(i), !0);
|
|
613
617
|
if (P) {
|
|
614
618
|
w.preventDefault(), L(P);
|
|
615
619
|
return;
|
|
616
620
|
}
|
|
617
|
-
if (
|
|
621
|
+
if (R && tr(R)) {
|
|
618
622
|
if (!ge(i, t)) {
|
|
619
|
-
const H =
|
|
623
|
+
const H = Qt(i, e, "backward");
|
|
620
624
|
if (H) {
|
|
621
|
-
w.preventDefault(),
|
|
625
|
+
w.preventDefault(), x(H);
|
|
622
626
|
return;
|
|
623
627
|
}
|
|
624
628
|
}
|
|
@@ -627,20 +631,20 @@ function Ee({
|
|
|
627
631
|
return;
|
|
628
632
|
}
|
|
629
633
|
if (w.key === "Delete") {
|
|
630
|
-
const
|
|
631
|
-
if (
|
|
632
|
-
w.preventDefault(), L(
|
|
634
|
+
const R = k.current, O = R && Yt(R, t, i.getRun.bind(i));
|
|
635
|
+
if (O) {
|
|
636
|
+
w.preventDefault(), L(O);
|
|
633
637
|
return;
|
|
634
638
|
}
|
|
635
|
-
const P =
|
|
639
|
+
const P = R && qt(R, t, i.getRun.bind(i), !1);
|
|
636
640
|
if (P) {
|
|
637
641
|
w.preventDefault(), L(P);
|
|
638
642
|
return;
|
|
639
643
|
}
|
|
640
|
-
if (
|
|
641
|
-
const
|
|
642
|
-
if (
|
|
643
|
-
w.preventDefault(),
|
|
644
|
+
if (R && nr(R)) {
|
|
645
|
+
const M = Qt(i, e, "forward");
|
|
646
|
+
if (M) {
|
|
647
|
+
w.preventDefault(), x(M);
|
|
644
648
|
return;
|
|
645
649
|
}
|
|
646
650
|
l && l(w);
|
|
@@ -667,7 +671,7 @@ function Ee({
|
|
|
667
671
|
c,
|
|
668
672
|
u,
|
|
669
673
|
L,
|
|
670
|
-
|
|
674
|
+
x,
|
|
671
675
|
t,
|
|
672
676
|
e,
|
|
673
677
|
i
|
|
@@ -682,53 +686,53 @@ function Ee({
|
|
|
682
686
|
dir: n,
|
|
683
687
|
contentEditable: !0,
|
|
684
688
|
suppressContentEditableWarning: !0,
|
|
685
|
-
onInput:
|
|
686
|
-
onCompositionStart:
|
|
689
|
+
onInput: b,
|
|
690
|
+
onCompositionStart: $,
|
|
687
691
|
onCompositionEnd: D,
|
|
688
692
|
onKeyDown: j,
|
|
689
693
|
children: t.map((w) => {
|
|
690
|
-
const
|
|
694
|
+
const R = rr(h.current, i, w);
|
|
691
695
|
return He(
|
|
692
696
|
/* @__PURE__ */ d(
|
|
693
|
-
|
|
697
|
+
or,
|
|
694
698
|
{
|
|
695
699
|
id: w,
|
|
696
700
|
blockId: e,
|
|
697
|
-
host:
|
|
701
|
+
host: R,
|
|
698
702
|
inlineRegistry: f,
|
|
699
703
|
onValueSynced: B
|
|
700
704
|
},
|
|
701
705
|
w
|
|
702
706
|
),
|
|
703
|
-
|
|
707
|
+
R
|
|
704
708
|
);
|
|
705
709
|
})
|
|
706
710
|
}
|
|
707
711
|
),
|
|
708
712
|
/* @__PURE__ */ d(Go, { containerRef: k, store: i }),
|
|
709
|
-
/* @__PURE__ */ d(
|
|
713
|
+
/* @__PURE__ */ d(Yo, { containerRef: k, store: i, authorId: y })
|
|
710
714
|
] });
|
|
711
715
|
}
|
|
712
|
-
function
|
|
716
|
+
function Ut(e) {
|
|
713
717
|
const t = e.getRootId(), n = e.getBlock(t);
|
|
714
718
|
if (!n || n.contentIds.length > 0) return null;
|
|
715
719
|
const { block: o, runs: r } = U("paragraph")(t);
|
|
716
720
|
return e.applyOperation(ke(o, t, 0, { blocks: [o], runs: r })), o.id;
|
|
717
721
|
}
|
|
718
|
-
const
|
|
719
|
-
function
|
|
720
|
-
return e === t ||
|
|
722
|
+
const lr = /* @__PURE__ */ new Set(["callout"]), Jt = /* @__PURE__ */ new Set(["paragraph", "heading", "blockquote"]);
|
|
723
|
+
function ar(e, t) {
|
|
724
|
+
return e === t || Jt.has(e) && Jt.has(t);
|
|
721
725
|
}
|
|
722
726
|
function ut(e, t) {
|
|
723
727
|
const n = e.getBlock(t);
|
|
724
728
|
if (!n) return null;
|
|
725
|
-
const o = e.getBlock(n.parentId), r = o.contentIds.indexOf(t), l = n.contentIds.length === 0 || n.contentIds.length === 1 &&
|
|
729
|
+
const o = e.getBlock(n.parentId), r = o.contentIds.indexOf(t), l = n.contentIds.length === 0 || n.contentIds.length === 1 && sr(e, n.contentIds[0]);
|
|
726
730
|
if (r <= 0) {
|
|
727
731
|
if (!l) return null;
|
|
728
732
|
if (o.contentIds.length > 1)
|
|
729
733
|
return Ke(e, [q(t)]), e.getBlock(o.id).contentIds[0];
|
|
730
|
-
if (
|
|
731
|
-
return
|
|
734
|
+
if (lr.has(o.type))
|
|
735
|
+
return cr(e, o);
|
|
732
736
|
if (n.type === "paragraph") return null;
|
|
733
737
|
const { block: u, runs: p } = U("paragraph")(o.id);
|
|
734
738
|
return Ke(e, [
|
|
@@ -741,7 +745,7 @@ function ut(e, t) {
|
|
|
741
745
|
return Ke(e, [q(t)]), a;
|
|
742
746
|
if (kt(e, s))
|
|
743
747
|
return Ke(e, [q(a)]), t;
|
|
744
|
-
if (!s || !
|
|
748
|
+
if (!s || !ar(s.type, n.type)) return null;
|
|
745
749
|
const c = [...s.contentIds, ...n.contentIds];
|
|
746
750
|
return Ke(e, [
|
|
747
751
|
Lt(a, c),
|
|
@@ -750,16 +754,16 @@ function ut(e, t) {
|
|
|
750
754
|
q(t)
|
|
751
755
|
]), a;
|
|
752
756
|
}
|
|
753
|
-
function
|
|
757
|
+
function sr(e, t) {
|
|
754
758
|
const n = e.getRun(t);
|
|
755
759
|
return !n || (n.value ?? "") === "";
|
|
756
760
|
}
|
|
757
|
-
function
|
|
761
|
+
function cr(e, t) {
|
|
758
762
|
const n = e.getBlock(t.parentId);
|
|
759
763
|
if (!n) return null;
|
|
760
764
|
const o = n.contentIds.indexOf(t.id), r = o > 0 ? n.contentIds[o - 1] : null, l = o !== -1 && o < n.contentIds.length - 1 ? n.contentIds[o + 1] : null;
|
|
761
765
|
Ke(e, [q(t.id)]);
|
|
762
|
-
const a =
|
|
766
|
+
const a = Ut(e);
|
|
763
767
|
return r ?? l ?? a;
|
|
764
768
|
}
|
|
765
769
|
function Ke(e, t) {
|
|
@@ -770,7 +774,7 @@ function Ke(e, t) {
|
|
|
770
774
|
}
|
|
771
775
|
function Qe(e, t, n, o) {
|
|
772
776
|
if (!t || t === n) return;
|
|
773
|
-
const r =
|
|
777
|
+
const r = Oo(e, t);
|
|
774
778
|
if (r) {
|
|
775
779
|
ve(r);
|
|
776
780
|
return;
|
|
@@ -787,11 +791,11 @@ function Ce(e, t) {
|
|
|
787
791
|
const n = e.getBlock(e.getRootId());
|
|
788
792
|
return ((r = n == null ? void 0 : n.props) == null ? void 0 : r.dir) ?? "auto";
|
|
789
793
|
}
|
|
790
|
-
function
|
|
794
|
+
function ir(e, t) {
|
|
791
795
|
if (typeof e.performBatch == "function") e.performBatch(t);
|
|
792
796
|
else for (const n of t) e.applyOperation(n);
|
|
793
797
|
}
|
|
794
|
-
const
|
|
798
|
+
const ur = [
|
|
795
799
|
{ re: /^(#{1,3})[ ]$/, type: "heading", props: (e) => ({ level: e[1].length }) },
|
|
796
800
|
{ re: /^[-*][ ]$/, type: "listItem", props: () => ({ ordered: !1, titleRunIds: [] }) },
|
|
797
801
|
{ re: /^\d+\.[ ]$/, type: "listItem", props: () => ({ ordered: !0, titleRunIds: [] }) },
|
|
@@ -803,22 +807,22 @@ const cr = [
|
|
|
803
807
|
{ re: /^>[ ]$/, type: "blockquote", props: () => ({}) },
|
|
804
808
|
{ re: /^```$/, type: "code", props: () => ({ language: "plaintext" }) }
|
|
805
809
|
];
|
|
806
|
-
function
|
|
810
|
+
function dr(e, t, n) {
|
|
807
811
|
if (n.length !== 1 || n[0].type !== "text") return !1;
|
|
808
812
|
const o = n[0].value ?? "";
|
|
809
|
-
for (const r of
|
|
813
|
+
for (const r of ur) {
|
|
810
814
|
const l = r.re.exec(o);
|
|
811
815
|
if (!l) continue;
|
|
812
816
|
const a = o.slice(l[0].length), { ops: s } = On(e, t, r.type, r.props(l), [n[0].id]);
|
|
813
|
-
return
|
|
817
|
+
return ir(e, [de(n[0].id, { value: a }), ...s]), En(n[0].id), !0;
|
|
814
818
|
}
|
|
815
819
|
return !1;
|
|
816
820
|
}
|
|
817
|
-
const
|
|
818
|
-
function
|
|
819
|
-
const t = K(), n = te(e), { setSelectedBlockId: o } = Pe(), r =
|
|
820
|
-
const f = t.getBlock(n == null ? void 0 : n.parentId),
|
|
821
|
-
if (
|
|
821
|
+
const pr = /* @__PURE__ */ new Set(["callout", "toggleHeading"]);
|
|
822
|
+
function fr({ id: e }) {
|
|
823
|
+
const t = K(), n = te(e), { setSelectedBlockId: o } = Pe(), r = m(() => {
|
|
824
|
+
const f = t.getBlock(n == null ? void 0 : n.parentId), y = ge(t, (n == null ? void 0 : n.contentIds) ?? []), v = !!f && f.contentIds[f.contentIds.length - 1] === e;
|
|
825
|
+
if (y && v && pr.has(f == null ? void 0 : f.type)) {
|
|
822
826
|
Ye(t, f.id, U("paragraph"));
|
|
823
827
|
return;
|
|
824
828
|
}
|
|
@@ -828,18 +832,18 @@ function dr({ id: e }) {
|
|
|
828
832
|
(n == null ? void 0 : n.contentIds) ?? [],
|
|
829
833
|
U("paragraph")
|
|
830
834
|
);
|
|
831
|
-
}, [t, e, n]), l =
|
|
835
|
+
}, [t, e, n]), l = m(() => {
|
|
832
836
|
var k, I;
|
|
833
|
-
const f = t.getBlock(n == null ? void 0 : n.parentId),
|
|
834
|
-
if (
|
|
835
|
-
const
|
|
836
|
-
|
|
837
|
+
const f = t.getBlock(n == null ? void 0 : n.parentId), y = ge(t, (n == null ? void 0 : n.contentIds) ?? []), v = ((k = f == null ? void 0 : f.contentIds) == null ? void 0 : k.length) === 1 && f.contentIds[0] === e;
|
|
838
|
+
if (y && v && (f == null ? void 0 : f.type) === "toggleHeading") {
|
|
839
|
+
const h = ((I = f.props) == null ? void 0 : I.titleRunIds) ?? [], b = h[h.length - 1];
|
|
840
|
+
b && ve(b);
|
|
837
841
|
return;
|
|
838
842
|
}
|
|
839
843
|
const g = ut(t, e);
|
|
840
844
|
Qe(t, g, e, o);
|
|
841
|
-
}, [t, e, n, o]), a =
|
|
842
|
-
(f) =>
|
|
845
|
+
}, [t, e, n, o]), a = m(() => le(t, e, "up"), [t, e]), s = m(() => le(t, e, "down"), [t, e]), c = m(
|
|
846
|
+
(f) => dr(t, e, f),
|
|
843
847
|
[t, e]
|
|
844
848
|
), u = se("be-paragraph", n);
|
|
845
849
|
if (!n) return null;
|
|
@@ -868,7 +872,7 @@ function dr({ id: e }) {
|
|
|
868
872
|
}
|
|
869
873
|
);
|
|
870
874
|
}
|
|
871
|
-
const
|
|
875
|
+
const mr = {
|
|
872
876
|
STRONG: "bold",
|
|
873
877
|
B: "bold",
|
|
874
878
|
EM: "italic",
|
|
@@ -899,7 +903,7 @@ function Le(e, t, n = {}) {
|
|
|
899
903
|
}
|
|
900
904
|
}
|
|
901
905
|
let s = a;
|
|
902
|
-
const c =
|
|
906
|
+
const c = mr[l.tagName];
|
|
903
907
|
c && (s = { ...s, [c]: !0 }), l.tagName === "A" && l.getAttribute("href") && (s = {
|
|
904
908
|
...s,
|
|
905
909
|
link: {
|
|
@@ -911,19 +915,19 @@ function Le(e, t, n = {}) {
|
|
|
911
915
|
};
|
|
912
916
|
return r(e, n), o.length ? o : [{ id: C(), type: "text", value: "", marks: {} }];
|
|
913
917
|
}
|
|
914
|
-
function
|
|
915
|
-
return `<p>${e.contentIds.map((o) => t.store.getRun(o)).map((o) =>
|
|
918
|
+
function hr(e, t) {
|
|
919
|
+
return `<p>${e.contentIds.map((o) => t.store.getRun(o)).map((o) => Me(o, t)).join("")}</p>`;
|
|
916
920
|
}
|
|
917
|
-
function
|
|
918
|
-
return e.contentIds.map((n) =>
|
|
921
|
+
function gr(e, t) {
|
|
922
|
+
return e.contentIds.map((n) => Ae(t.store.getRun(n), t)).join("");
|
|
919
923
|
}
|
|
920
|
-
function
|
|
924
|
+
function br(e, t) {
|
|
921
925
|
return De(
|
|
922
926
|
e.contentIds.map((n) => t.store.getRun(n)),
|
|
923
927
|
t
|
|
924
928
|
);
|
|
925
929
|
}
|
|
926
|
-
function
|
|
930
|
+
function yr(e, t) {
|
|
927
931
|
if (e.tagName !== "P") return null;
|
|
928
932
|
const n = Le(e, t);
|
|
929
933
|
return { block: {
|
|
@@ -934,35 +938,35 @@ function gr(e, t) {
|
|
|
934
938
|
props: {}
|
|
935
939
|
}, runs: n };
|
|
936
940
|
}
|
|
937
|
-
const
|
|
941
|
+
const kr = ae({
|
|
938
942
|
name: "paragraph",
|
|
939
|
-
component:
|
|
943
|
+
component: fr,
|
|
940
944
|
contentModel: "runs",
|
|
941
945
|
defaultProps: {},
|
|
942
|
-
toHTML:
|
|
943
|
-
toPlainText:
|
|
944
|
-
toMarkdown:
|
|
945
|
-
fromHTML:
|
|
946
|
+
toHTML: hr,
|
|
947
|
+
toPlainText: gr,
|
|
948
|
+
toMarkdown: br,
|
|
949
|
+
fromHTML: yr,
|
|
946
950
|
slashCommand: {
|
|
947
951
|
label: "Text",
|
|
948
|
-
icon:
|
|
952
|
+
icon: fn,
|
|
949
953
|
keywords: ["paragraph", "text", "p"],
|
|
950
954
|
run: (e, t) => re(e, t, U("paragraph"))
|
|
951
955
|
}
|
|
952
956
|
});
|
|
953
|
-
function
|
|
954
|
-
var
|
|
955
|
-
const t = K(), n = te(e), { setSelectedBlockId: o } = Pe(), r =
|
|
957
|
+
function vr({ id: e }) {
|
|
958
|
+
var y;
|
|
959
|
+
const t = K(), n = te(e), { setSelectedBlockId: o } = Pe(), r = m(() => {
|
|
956
960
|
Xe(
|
|
957
961
|
t,
|
|
958
962
|
e,
|
|
959
963
|
(n == null ? void 0 : n.contentIds) ?? [],
|
|
960
964
|
U("paragraph")
|
|
961
965
|
);
|
|
962
|
-
}, [t, e, n]), l =
|
|
966
|
+
}, [t, e, n]), l = m(() => {
|
|
963
967
|
const v = ut(t, e);
|
|
964
968
|
Qe(t, v, e, o);
|
|
965
|
-
}, [t, e, o]), a =
|
|
969
|
+
}, [t, e, o]), a = m(() => le(t, e, "up"), [t, e]), s = m(() => le(t, e, "down"), [t, e]), c = ((y = n == null ? void 0 : n.props) == null ? void 0 : y.level) ?? 3, u = se(`be-heading be-heading-${c}`, n);
|
|
966
970
|
if (!n) return null;
|
|
967
971
|
const p = `h${c}`, i = ge(t, n.contentIds), f = Ce(t, n);
|
|
968
972
|
return /* @__PURE__ */ d(
|
|
@@ -988,16 +992,16 @@ function yr({ id: e }) {
|
|
|
988
992
|
}
|
|
989
993
|
);
|
|
990
994
|
}
|
|
991
|
-
const Tt = { 1:
|
|
992
|
-
function
|
|
995
|
+
const Tt = { 1: mn, 2: hn, 3: gn }, Ir = { H1: 1, H2: 2, H3: 3 };
|
|
996
|
+
function wr(e, t) {
|
|
993
997
|
var r;
|
|
994
998
|
const n = ((r = e.props) == null ? void 0 : r.level) ?? 3, o = e.contentIds.map((l) => t.store.getRun(l));
|
|
995
|
-
return `<h${n}>${o.map((l) =>
|
|
999
|
+
return `<h${n}>${o.map((l) => Me(l, t)).join("")}</h${n}>`;
|
|
996
1000
|
}
|
|
997
|
-
function
|
|
998
|
-
return e.contentIds.map((n) =>
|
|
1001
|
+
function Tr(e, t) {
|
|
1002
|
+
return e.contentIds.map((n) => Ae(t.store.getRun(n), t)).join("");
|
|
999
1003
|
}
|
|
1000
|
-
function
|
|
1004
|
+
function Cr(e, t) {
|
|
1001
1005
|
var r;
|
|
1002
1006
|
const n = ((r = e.props) == null ? void 0 : r.level) ?? 3, o = De(
|
|
1003
1007
|
e.contentIds.map((l) => t.store.getRun(l)),
|
|
@@ -1005,8 +1009,8 @@ function wr(e, t) {
|
|
|
1005
1009
|
);
|
|
1006
1010
|
return `${"#".repeat(n)} ${o}`;
|
|
1007
1011
|
}
|
|
1008
|
-
function
|
|
1009
|
-
const n =
|
|
1012
|
+
function Br(e, t) {
|
|
1013
|
+
const n = Ir[e.tagName];
|
|
1010
1014
|
if (!n) return null;
|
|
1011
1015
|
const o = Le(e, t);
|
|
1012
1016
|
return { block: {
|
|
@@ -1017,15 +1021,15 @@ function Tr(e, t) {
|
|
|
1017
1021
|
props: { level: n }
|
|
1018
1022
|
}, runs: o };
|
|
1019
1023
|
}
|
|
1020
|
-
const
|
|
1024
|
+
const Nr = ae({
|
|
1021
1025
|
name: "heading",
|
|
1022
1026
|
contentModel: "runs",
|
|
1023
|
-
component:
|
|
1027
|
+
component: vr,
|
|
1024
1028
|
defaultProps: { level: 3 },
|
|
1025
|
-
toHTML:
|
|
1026
|
-
toPlainText:
|
|
1027
|
-
toMarkdown:
|
|
1028
|
-
fromHTML:
|
|
1029
|
+
toHTML: wr,
|
|
1030
|
+
toPlainText: Tr,
|
|
1031
|
+
toMarkdown: Cr,
|
|
1032
|
+
fromHTML: Br,
|
|
1029
1033
|
slashCommands: [
|
|
1030
1034
|
{
|
|
1031
1035
|
label: "Heading 1",
|
|
@@ -1046,21 +1050,21 @@ const Cr = ae({
|
|
|
1046
1050
|
run: (e, t) => re(e, t, U("heading", { level: 3 }))
|
|
1047
1051
|
}
|
|
1048
1052
|
]
|
|
1049
|
-
}),
|
|
1053
|
+
}), Rr = [];
|
|
1050
1054
|
function Dn(e) {
|
|
1051
|
-
const t = K(), n =
|
|
1055
|
+
const t = K(), n = m(
|
|
1052
1056
|
(r) => t.subscribe(e, r),
|
|
1053
1057
|
[t, e]
|
|
1054
|
-
), o =
|
|
1058
|
+
), o = m(() => {
|
|
1055
1059
|
const r = t.getBlock(e);
|
|
1056
|
-
return r ? r.contentIds :
|
|
1060
|
+
return r ? r.contentIds : Rr;
|
|
1057
1061
|
}, [t, e]);
|
|
1058
|
-
return
|
|
1062
|
+
return St(n, o);
|
|
1059
1063
|
}
|
|
1060
|
-
class
|
|
1064
|
+
class Lr extends lo {
|
|
1061
1065
|
constructor() {
|
|
1062
1066
|
super(...arguments);
|
|
1063
|
-
|
|
1067
|
+
Gt(this, "state", { hasError: !1, nonce: 0 });
|
|
1064
1068
|
}
|
|
1065
1069
|
static getDerivedStateFromError() {
|
|
1066
1070
|
return { hasError: !0 };
|
|
@@ -1078,15 +1082,15 @@ class Rr extends lo {
|
|
|
1078
1082
|
}
|
|
1079
1083
|
}
|
|
1080
1084
|
const Hn = so(function({ id: t }) {
|
|
1081
|
-
const n = te(t), o =
|
|
1085
|
+
const n = te(t), o = bn();
|
|
1082
1086
|
if (!n) return null;
|
|
1083
1087
|
const r = o.get(n.type);
|
|
1084
1088
|
if (!r)
|
|
1085
1089
|
return process.env.NODE_ENV !== "production" && console.warn(`[block-editor] No block type registered for "${n.type}" (id: ${t})`), null;
|
|
1086
1090
|
const l = r.component;
|
|
1087
|
-
return /* @__PURE__ */ d(
|
|
1091
|
+
return /* @__PURE__ */ d(Lr, { children: /* @__PURE__ */ d(l, { id: t }) });
|
|
1088
1092
|
});
|
|
1089
|
-
function
|
|
1093
|
+
function jt(e, t, n, o) {
|
|
1090
1094
|
const r = _(!1), l = _(!1);
|
|
1091
1095
|
oe(() => {
|
|
1092
1096
|
var p, i;
|
|
@@ -1099,10 +1103,10 @@ function _t(e, t, n, o) {
|
|
|
1099
1103
|
if (!a) return;
|
|
1100
1104
|
const s = () => Array.from(a.querySelectorAll('[role="menuitem"]')), c = (f) => {
|
|
1101
1105
|
var g;
|
|
1102
|
-
const
|
|
1103
|
-
if (
|
|
1104
|
-
const v = (f %
|
|
1105
|
-
(g =
|
|
1106
|
+
const y = s();
|
|
1107
|
+
if (y.length === 0) return;
|
|
1108
|
+
const v = (f % y.length + y.length) % y.length;
|
|
1109
|
+
(g = y[v]) == null || g.focus();
|
|
1106
1110
|
};
|
|
1107
1111
|
l.current || (l.current = !0, c(0));
|
|
1108
1112
|
const u = (f) => {
|
|
@@ -1110,17 +1114,17 @@ function _t(e, t, n, o) {
|
|
|
1110
1114
|
f.preventDefault(), n();
|
|
1111
1115
|
return;
|
|
1112
1116
|
}
|
|
1113
|
-
const
|
|
1114
|
-
v !== -1 && (f.key === "ArrowDown" ? (f.preventDefault(), c(v + 1)) : f.key === "ArrowUp" ? (f.preventDefault(), c(v - 1)) : f.key === "Home" ? (f.preventDefault(), c(0)) : f.key === "End" && (f.preventDefault(), c(
|
|
1117
|
+
const y = s(), v = y.indexOf(document.activeElement);
|
|
1118
|
+
v !== -1 && (f.key === "ArrowDown" ? (f.preventDefault(), c(v + 1)) : f.key === "ArrowUp" ? (f.preventDefault(), c(v - 1)) : f.key === "Home" ? (f.preventDefault(), c(0)) : f.key === "End" && (f.preventDefault(), c(y.length - 1)));
|
|
1115
1119
|
};
|
|
1116
1120
|
return a.addEventListener("keydown", u), () => a.removeEventListener("keydown", u);
|
|
1117
1121
|
});
|
|
1118
1122
|
}
|
|
1119
|
-
const
|
|
1120
|
-
function
|
|
1123
|
+
const Zt = "be-live-region";
|
|
1124
|
+
function Ar() {
|
|
1121
1125
|
if (typeof document > "u") return null;
|
|
1122
|
-
let e = document.getElementById(
|
|
1123
|
-
return e || (e = document.createElement("div"), e.id =
|
|
1126
|
+
let e = document.getElementById(Zt);
|
|
1127
|
+
return e || (e = document.createElement("div"), e.id = Zt, e.setAttribute("role", "status"), e.setAttribute("aria-live", "polite"), e.setAttribute("aria-atomic", "true"), Object.assign(e.style, {
|
|
1124
1128
|
position: "absolute",
|
|
1125
1129
|
width: "1px",
|
|
1126
1130
|
height: "1px",
|
|
@@ -1133,13 +1137,13 @@ function Nr() {
|
|
|
1133
1137
|
}), document.body.appendChild(e), e);
|
|
1134
1138
|
}
|
|
1135
1139
|
function xe(e) {
|
|
1136
|
-
const t =
|
|
1140
|
+
const t = Ar();
|
|
1137
1141
|
t && (t.textContent = "", setTimeout(() => {
|
|
1138
1142
|
t.textContent = e;
|
|
1139
1143
|
}, 0));
|
|
1140
1144
|
}
|
|
1141
1145
|
const _e = "💡", Pn = "gray";
|
|
1142
|
-
function
|
|
1146
|
+
function Mr({
|
|
1143
1147
|
icon: e = _e,
|
|
1144
1148
|
color: t = Pn
|
|
1145
1149
|
} = {}) {
|
|
@@ -1155,27 +1159,27 @@ function Lr({
|
|
|
1155
1159
|
};
|
|
1156
1160
|
}
|
|
1157
1161
|
const _n = [
|
|
1158
|
-
{ type: "paragraph", props: {}, label: "Text", icon:
|
|
1159
|
-
{ type: "heading", props: { level: 1 }, label: "Heading 1", icon:
|
|
1160
|
-
{ type: "heading", props: { level: 2 }, label: "Heading 2", icon:
|
|
1161
|
-
{ type: "heading", props: { level: 3 }, label: "Heading 3", icon:
|
|
1162
|
+
{ type: "paragraph", props: {}, label: "Text", icon: fn },
|
|
1163
|
+
{ type: "heading", props: { level: 1 }, label: "Heading 1", icon: mn },
|
|
1164
|
+
{ type: "heading", props: { level: 2 }, label: "Heading 2", icon: hn },
|
|
1165
|
+
{ type: "heading", props: { level: 3 }, label: "Heading 3", icon: gn },
|
|
1162
1166
|
{
|
|
1163
1167
|
type: "listItem",
|
|
1164
1168
|
props: { ordered: !1, titleRunIds: [] },
|
|
1165
1169
|
label: "Bulleted list",
|
|
1166
|
-
icon:
|
|
1170
|
+
icon: yn
|
|
1167
1171
|
},
|
|
1168
1172
|
{
|
|
1169
1173
|
type: "listItem",
|
|
1170
1174
|
props: { ordered: !0, titleRunIds: [] },
|
|
1171
1175
|
label: "Numbered list",
|
|
1172
|
-
icon:
|
|
1176
|
+
icon: kn
|
|
1173
1177
|
},
|
|
1174
1178
|
{
|
|
1175
1179
|
type: "listItem",
|
|
1176
1180
|
props: { ordered: !1, checked: !1, titleRunIds: [] },
|
|
1177
1181
|
label: "To-do list",
|
|
1178
|
-
icon:
|
|
1182
|
+
icon: Ht
|
|
1179
1183
|
},
|
|
1180
1184
|
{
|
|
1181
1185
|
type: "listItem",
|
|
@@ -1189,18 +1193,18 @@ const _n = [
|
|
|
1189
1193
|
label: "Toggle heading",
|
|
1190
1194
|
icon: Oe
|
|
1191
1195
|
},
|
|
1192
|
-
{ type: "blockquote", props: {}, label: "Quote", icon:
|
|
1193
|
-
{ type: "callout", props: { icon: _e }, label: "Callout", icon:
|
|
1194
|
-
{ type: "code", props: { language: "plaintext" }, label: "Code", icon:
|
|
1195
|
-
],
|
|
1196
|
-
function
|
|
1197
|
-
return
|
|
1198
|
-
}
|
|
1199
|
-
function
|
|
1196
|
+
{ type: "blockquote", props: {}, label: "Quote", icon: vn },
|
|
1197
|
+
{ type: "callout", props: { icon: _e }, label: "Callout", icon: In },
|
|
1198
|
+
{ type: "code", props: { language: "plaintext" }, label: "Code", icon: wn }
|
|
1199
|
+
], Er = new Set(_n.map((e) => e.type));
|
|
1200
|
+
function $r(e) {
|
|
1201
|
+
return Er.has(e);
|
|
1202
|
+
}
|
|
1203
|
+
function xr(e, t) {
|
|
1200
1204
|
return e != null && e.props && "titleRunIds" in e.props ? e.props.titleRunIds : t && !t.isLeaf(e == null ? void 0 : e.type) ? [] : (e == null ? void 0 : e.contentIds) ?? [];
|
|
1201
1205
|
}
|
|
1202
|
-
function
|
|
1203
|
-
const r = e.getBlock(n), l =
|
|
1206
|
+
function Or(e, t, n, o) {
|
|
1207
|
+
const r = e.getBlock(n), l = xr(r, t), a = [];
|
|
1204
1208
|
if (o.type === "code")
|
|
1205
1209
|
for (const p of l) {
|
|
1206
1210
|
const i = e.getRun(p);
|
|
@@ -1216,43 +1220,43 @@ function $r(e, t, n, o) {
|
|
|
1216
1220
|
);
|
|
1217
1221
|
return { ops: [...a, ...c], newBlockId: u };
|
|
1218
1222
|
}
|
|
1219
|
-
function
|
|
1223
|
+
function Sr({
|
|
1220
1224
|
onSelect: e,
|
|
1221
1225
|
onClose: t,
|
|
1222
1226
|
containerRef: n,
|
|
1223
1227
|
menuClassName: o = "be-block-gutter-menu",
|
|
1224
1228
|
itemClassName: r = "be-block-gutter-menu-item"
|
|
1225
1229
|
}) {
|
|
1226
|
-
const [l, a] =
|
|
1227
|
-
(
|
|
1228
|
-
p.current =
|
|
1230
|
+
const [l, a] = S(!1), [s, c] = S(null), u = _(null), p = _(null), i = m(
|
|
1231
|
+
(h) => {
|
|
1232
|
+
p.current = h, n && (n.current = h);
|
|
1229
1233
|
},
|
|
1230
1234
|
[n]
|
|
1231
|
-
), f =
|
|
1235
|
+
), f = m(() => {
|
|
1232
1236
|
a(!1), t == null || t();
|
|
1233
1237
|
}, [t]);
|
|
1234
|
-
ct([u, p], l, f),
|
|
1235
|
-
const
|
|
1238
|
+
ct([u, p], l, f), jt(p, l, f, u);
|
|
1239
|
+
const y = vt(
|
|
1236
1240
|
p,
|
|
1237
1241
|
l,
|
|
1238
1242
|
s == null ? void 0 : s.top,
|
|
1239
1243
|
s ? s.right + 4 : null
|
|
1240
|
-
), v =
|
|
1241
|
-
var
|
|
1242
|
-
c(((
|
|
1243
|
-
}, []), g =
|
|
1244
|
-
(
|
|
1245
|
-
e(
|
|
1244
|
+
), v = m(() => {
|
|
1245
|
+
var h;
|
|
1246
|
+
c(((h = u.current) == null ? void 0 : h.getBoundingClientRect()) ?? null), a(!0);
|
|
1247
|
+
}, []), g = m(
|
|
1248
|
+
(h) => {
|
|
1249
|
+
e(h), f();
|
|
1246
1250
|
},
|
|
1247
1251
|
[e, f]
|
|
1248
|
-
), k =
|
|
1249
|
-
(
|
|
1250
|
-
|
|
1252
|
+
), k = m(
|
|
1253
|
+
(h) => {
|
|
1254
|
+
h.key === "ArrowRight" && !l && (h.preventDefault(), v());
|
|
1251
1255
|
},
|
|
1252
1256
|
[l, v]
|
|
1253
|
-
), I =
|
|
1254
|
-
(
|
|
1255
|
-
|
|
1257
|
+
), I = m(
|
|
1258
|
+
(h) => {
|
|
1259
|
+
h.key === "ArrowLeft" && (h.preventDefault(), f());
|
|
1256
1260
|
},
|
|
1257
1261
|
[f]
|
|
1258
1262
|
);
|
|
@@ -1274,7 +1278,7 @@ function xr({
|
|
|
1274
1278
|
]
|
|
1275
1279
|
}
|
|
1276
1280
|
),
|
|
1277
|
-
l &&
|
|
1281
|
+
l && y && He(
|
|
1278
1282
|
/* @__PURE__ */ d(
|
|
1279
1283
|
"div",
|
|
1280
1284
|
{
|
|
@@ -1282,24 +1286,24 @@ function xr({
|
|
|
1282
1286
|
role: "menu",
|
|
1283
1287
|
"aria-label": "Turn into",
|
|
1284
1288
|
className: o,
|
|
1285
|
-
style: { position: "fixed", top:
|
|
1289
|
+
style: { position: "fixed", top: y.top, left: y.left },
|
|
1286
1290
|
onKeyDown: I,
|
|
1287
|
-
children: _n.map((
|
|
1288
|
-
const B =
|
|
1291
|
+
children: _n.map((h, b) => {
|
|
1292
|
+
const B = h.icon;
|
|
1289
1293
|
return /* @__PURE__ */ T(
|
|
1290
1294
|
"button",
|
|
1291
1295
|
{
|
|
1292
1296
|
type: "button",
|
|
1293
1297
|
role: "menuitem",
|
|
1294
1298
|
className: r,
|
|
1295
|
-
onClick: () => g(
|
|
1299
|
+
onClick: () => g(h),
|
|
1296
1300
|
children: [
|
|
1297
1301
|
/* @__PURE__ */ d(B, { size: 15 }),
|
|
1298
1302
|
" ",
|
|
1299
|
-
|
|
1303
|
+
h.label
|
|
1300
1304
|
]
|
|
1301
1305
|
},
|
|
1302
|
-
`${
|
|
1306
|
+
`${h.type}-${b}`
|
|
1303
1307
|
);
|
|
1304
1308
|
})
|
|
1305
1309
|
}
|
|
@@ -1308,21 +1312,21 @@ function xr({
|
|
|
1308
1312
|
)
|
|
1309
1313
|
] });
|
|
1310
1314
|
}
|
|
1311
|
-
function
|
|
1315
|
+
function Dr(e, t) {
|
|
1312
1316
|
const n = e.getBlock(t);
|
|
1313
1317
|
if (!n) return null;
|
|
1314
|
-
const o = e.getBlock(n.parentId), r = o.contentIds.indexOf(t), l =
|
|
1318
|
+
const o = e.getBlock(n.parentId), r = o.contentIds.indexOf(t), l = Ko(e, t), { block: a, runs: s, subtreeBlocks: c } = zo(l);
|
|
1315
1319
|
return e.applyOperation(
|
|
1316
1320
|
ke(a, o.id, r + 1, { blocks: [a, ...c], runs: s })
|
|
1317
1321
|
), be(e, a.id), a.id;
|
|
1318
1322
|
}
|
|
1319
|
-
function
|
|
1323
|
+
function Hr(e, t) {
|
|
1320
1324
|
const n = e.getBlock(t), o = n && e.getBlock(n.parentId);
|
|
1321
1325
|
if (!o) return !1;
|
|
1322
1326
|
const r = o.contentIds.indexOf(t);
|
|
1323
1327
|
return r <= 0 ? !1 : (e.applyOperation(yt(t, o.id, r - 1)), !0);
|
|
1324
1328
|
}
|
|
1325
|
-
function
|
|
1329
|
+
function Pr(e, t) {
|
|
1326
1330
|
const n = e.getBlock(t), o = n && e.getBlock(n.parentId);
|
|
1327
1331
|
if (!o) return !1;
|
|
1328
1332
|
const r = o.contentIds.indexOf(t);
|
|
@@ -1333,50 +1337,50 @@ function Un(e, t) {
|
|
|
1333
1337
|
if (!n) return null;
|
|
1334
1338
|
const o = e.getBlock(n.parentId), r = o.contentIds.indexOf(t), l = r > 0 ? o.contentIds[r - 1] : null, a = r !== -1 && r < o.contentIds.length - 1 ? o.contentIds[r + 1] : null;
|
|
1335
1339
|
e.applyOperation(q(t));
|
|
1336
|
-
const s =
|
|
1340
|
+
const s = Ut(e), c = l ?? a ?? s;
|
|
1337
1341
|
return c && be(e, c), c ?? null;
|
|
1338
1342
|
}
|
|
1339
|
-
function
|
|
1343
|
+
function _r(e, t) {
|
|
1340
1344
|
if (typeof e.performBatch == "function") e.performBatch(t);
|
|
1341
1345
|
else for (const n of t) e.applyOperation(n);
|
|
1342
1346
|
}
|
|
1343
|
-
function
|
|
1347
|
+
function Ur({ id: e }) {
|
|
1344
1348
|
var w;
|
|
1345
|
-
const t = K(), n =
|
|
1346
|
-
ct(i, r, v),
|
|
1347
|
-
const g =
|
|
1348
|
-
var
|
|
1349
|
-
s(((
|
|
1349
|
+
const t = K(), n = bn(), o = te(e), [r, l] = S(!1), [a, s] = S(null), c = _(null), u = _(null), p = _(null), i = Ge(() => [c, u, p], []), [f] = uo(), y = f.includes(e), v = m(() => l(!1), []);
|
|
1350
|
+
ct(i, r, v), jt(u, r, v, c);
|
|
1351
|
+
const g = m(() => {
|
|
1352
|
+
var R;
|
|
1353
|
+
s(((R = c.current) == null ? void 0 : R.getBoundingClientRect()) ?? null), l(!0);
|
|
1350
1354
|
}, []), k = vt(
|
|
1351
1355
|
u,
|
|
1352
1356
|
r,
|
|
1353
1357
|
(a == null ? void 0 : a.bottom) != null ? a.bottom + 4 : null,
|
|
1354
1358
|
a == null ? void 0 : a.left
|
|
1355
|
-
), I =
|
|
1359
|
+
), I = m(() => {
|
|
1356
1360
|
Ye(t, e, U("paragraph"));
|
|
1357
|
-
}, [t, e]),
|
|
1358
|
-
|
|
1359
|
-
}, [t, e, v]),
|
|
1360
|
-
|
|
1361
|
-
}, [t, e, v]), B =
|
|
1362
|
-
|
|
1363
|
-
}, [t, e, v]),
|
|
1361
|
+
}, [t, e]), h = m(() => {
|
|
1362
|
+
Dr(t, e), xe("Block duplicated"), v();
|
|
1363
|
+
}, [t, e, v]), b = m(() => {
|
|
1364
|
+
Hr(t, e) && xe("Block moved up"), v();
|
|
1365
|
+
}, [t, e, v]), B = m(() => {
|
|
1366
|
+
Pr(t, e) && xe("Block moved down"), v();
|
|
1367
|
+
}, [t, e, v]), $ = m(() => {
|
|
1364
1368
|
Un(t, e), xe("Block deleted"), v();
|
|
1365
|
-
}, [t, e, v]), D = !!((w = o == null ? void 0 : o.props) != null && w.hidden), L =
|
|
1366
|
-
t.applyOperation(
|
|
1367
|
-
}, [t, e, D, v]),
|
|
1368
|
-
t.applyOperation(
|
|
1369
|
-
}, [t, e,
|
|
1370
|
-
(
|
|
1371
|
-
const { ops:
|
|
1372
|
-
|
|
1369
|
+
}, [t, e, v]), D = !!((w = o == null ? void 0 : o.props) != null && w.hidden), L = m(() => {
|
|
1370
|
+
t.applyOperation(V(e, { hidden: !D })), xe(D ? "Block shown in preview" : "Block hidden in preview"), v();
|
|
1371
|
+
}, [t, e, D, v]), x = Ce(t, o) === "rtl", E = m(() => {
|
|
1372
|
+
t.applyOperation(V(e, { dir: x ? "ltr" : "rtl" })), xe(x ? "Block set to left-to-right" : "Block set to right-to-left"), v();
|
|
1373
|
+
}, [t, e, x, v]), j = m(
|
|
1374
|
+
(R) => {
|
|
1375
|
+
const { ops: O } = Or(t, n, e, R);
|
|
1376
|
+
_r(t, O), xe(`Turned into ${R.label}`), v();
|
|
1373
1377
|
},
|
|
1374
1378
|
[t, n, e, v]
|
|
1375
1379
|
);
|
|
1376
1380
|
return o ? /* @__PURE__ */ T(
|
|
1377
1381
|
"div",
|
|
1378
1382
|
{
|
|
1379
|
-
className: `be-block-row${D ? " be-block-row-hidden" : ""}${
|
|
1383
|
+
className: `be-block-row${D ? " be-block-row-hidden" : ""}${y ? " be-block-row-range-selected" : ""}`,
|
|
1380
1384
|
"data-block-row-id": e,
|
|
1381
1385
|
dir: Ce(t, o),
|
|
1382
1386
|
children: [
|
|
@@ -1393,7 +1397,7 @@ function Pr({ id: e }) {
|
|
|
1393
1397
|
className: "be-block-gutter-btn",
|
|
1394
1398
|
onClick: I,
|
|
1395
1399
|
"aria-label": "Add block below",
|
|
1396
|
-
children: /* @__PURE__ */ d(
|
|
1400
|
+
children: /* @__PURE__ */ d(Tn, { size: 16 })
|
|
1397
1401
|
}
|
|
1398
1402
|
),
|
|
1399
1403
|
/* @__PURE__ */ d(
|
|
@@ -1429,7 +1433,7 @@ function Pr({ id: e }) {
|
|
|
1429
1433
|
type: "button",
|
|
1430
1434
|
role: "menuitem",
|
|
1431
1435
|
className: "be-block-gutter-menu-item",
|
|
1432
|
-
onClick:
|
|
1436
|
+
onClick: h,
|
|
1433
1437
|
children: [
|
|
1434
1438
|
/* @__PURE__ */ d(fo, { size: 15 }),
|
|
1435
1439
|
" Duplicate"
|
|
@@ -1442,9 +1446,9 @@ function Pr({ id: e }) {
|
|
|
1442
1446
|
type: "button",
|
|
1443
1447
|
role: "menuitem",
|
|
1444
1448
|
className: "be-block-gutter-menu-item",
|
|
1445
|
-
onClick:
|
|
1449
|
+
onClick: b,
|
|
1446
1450
|
children: [
|
|
1447
|
-
/* @__PURE__ */ d(
|
|
1451
|
+
/* @__PURE__ */ d(Cn, { size: 15 }),
|
|
1448
1452
|
" Move up"
|
|
1449
1453
|
]
|
|
1450
1454
|
}
|
|
@@ -1457,7 +1461,7 @@ function Pr({ id: e }) {
|
|
|
1457
1461
|
className: "be-block-gutter-menu-item",
|
|
1458
1462
|
onClick: B,
|
|
1459
1463
|
children: [
|
|
1460
|
-
/* @__PURE__ */ d(
|
|
1464
|
+
/* @__PURE__ */ d(Bn, { size: 15 }),
|
|
1461
1465
|
" Move down"
|
|
1462
1466
|
]
|
|
1463
1467
|
}
|
|
@@ -1483,13 +1487,13 @@ function Pr({ id: e }) {
|
|
|
1483
1487
|
className: "be-block-gutter-menu-item",
|
|
1484
1488
|
onClick: E,
|
|
1485
1489
|
children: [
|
|
1486
|
-
|
|
1487
|
-
|
|
1490
|
+
x ? /* @__PURE__ */ d(Nn, { size: 15 }) : /* @__PURE__ */ d(Rn, { size: 15 }),
|
|
1491
|
+
x ? "Switch to left-to-right" : "Switch to right-to-left"
|
|
1488
1492
|
]
|
|
1489
1493
|
}
|
|
1490
1494
|
),
|
|
1491
|
-
|
|
1492
|
-
|
|
1495
|
+
$r(o.type) && /* @__PURE__ */ d(
|
|
1496
|
+
Sr,
|
|
1493
1497
|
{
|
|
1494
1498
|
onSelect: j,
|
|
1495
1499
|
onClose: () => {
|
|
@@ -1503,9 +1507,9 @@ function Pr({ id: e }) {
|
|
|
1503
1507
|
type: "button",
|
|
1504
1508
|
role: "menuitem",
|
|
1505
1509
|
className: "be-block-gutter-menu-item be-block-gutter-menu-item-danger",
|
|
1506
|
-
onClick:
|
|
1510
|
+
onClick: $,
|
|
1507
1511
|
children: [
|
|
1508
|
-
/* @__PURE__ */ d(
|
|
1512
|
+
/* @__PURE__ */ d(Ln, { size: 15 }),
|
|
1509
1513
|
" Delete"
|
|
1510
1514
|
]
|
|
1511
1515
|
}
|
|
@@ -1524,9 +1528,9 @@ function Ue({ parentId: e, isTopLevel: t = !1, filterIds: n }) {
|
|
|
1524
1528
|
var u, p;
|
|
1525
1529
|
return !((p = (u = r.getBlock(c)) == null ? void 0 : u.props) != null && p.hidden);
|
|
1526
1530
|
}) : a;
|
|
1527
|
-
return t && !l ? s.map((c) => /* @__PURE__ */ d(
|
|
1531
|
+
return t && !l ? s.map((c) => /* @__PURE__ */ d(Ur, { id: c }, c)) : s.map((c) => /* @__PURE__ */ d(Hn, { id: c }, c));
|
|
1528
1532
|
}
|
|
1529
|
-
const
|
|
1533
|
+
const jr = 97, Fr = [
|
|
1530
1534
|
[1e3, "m"],
|
|
1531
1535
|
[900, "cm"],
|
|
1532
1536
|
[500, "d"],
|
|
@@ -1541,24 +1545,24 @@ const _r = 97, Ur = [
|
|
|
1541
1545
|
[4, "iv"],
|
|
1542
1546
|
[1, "i"]
|
|
1543
1547
|
];
|
|
1544
|
-
function
|
|
1548
|
+
function Kr(e) {
|
|
1545
1549
|
let t = "";
|
|
1546
1550
|
for (; e > 0; )
|
|
1547
|
-
e -= 1, t = String.fromCharCode(
|
|
1551
|
+
e -= 1, t = String.fromCharCode(jr + e % 26) + t, e = Math.floor(e / 26);
|
|
1548
1552
|
return t;
|
|
1549
1553
|
}
|
|
1550
|
-
function
|
|
1554
|
+
function zr(e) {
|
|
1551
1555
|
let t = "", n = e;
|
|
1552
|
-
for (const [o, r] of
|
|
1556
|
+
for (const [o, r] of Fr)
|
|
1553
1557
|
for (; n >= o; )
|
|
1554
1558
|
t += r, n -= o;
|
|
1555
1559
|
return t;
|
|
1556
1560
|
}
|
|
1557
|
-
function
|
|
1561
|
+
function Vr(e) {
|
|
1558
1562
|
var t, n;
|
|
1559
1563
|
return (e == null ? void 0 : e.type) === "listItem" && ((t = e.props) == null ? void 0 : t.checked) === void 0 && ((n = e.props) == null ? void 0 : n.collapsed) === void 0;
|
|
1560
1564
|
}
|
|
1561
|
-
function
|
|
1565
|
+
function en(e, t) {
|
|
1562
1566
|
let n = 0, o = t;
|
|
1563
1567
|
for (; o; ) {
|
|
1564
1568
|
const r = e.getBlock(o.parentId);
|
|
@@ -1567,24 +1571,24 @@ function Jt(e, t) {
|
|
|
1567
1571
|
}
|
|
1568
1572
|
return n;
|
|
1569
1573
|
}
|
|
1570
|
-
function
|
|
1574
|
+
function Gr(e, t, n) {
|
|
1571
1575
|
const o = n.indexOf(t.id);
|
|
1572
1576
|
let r = 1;
|
|
1573
1577
|
for (let l = o - 1; l >= 0; l -= 1) {
|
|
1574
1578
|
const a = e.getBlock(n[l]);
|
|
1575
|
-
if (!
|
|
1579
|
+
if (!Vr(a) || !a.props.ordered) break;
|
|
1576
1580
|
r += 1;
|
|
1577
1581
|
}
|
|
1578
1582
|
return r;
|
|
1579
1583
|
}
|
|
1580
|
-
function
|
|
1584
|
+
function Wr(e, t) {
|
|
1581
1585
|
const n = (e % 3 + 3) % 3;
|
|
1582
|
-
return n === 0 ? `${t}.` : n === 1 ? `${
|
|
1586
|
+
return n === 0 ? `${t}.` : n === 1 ? `${Kr(t)}.` : `${zr(t)}.`;
|
|
1583
1587
|
}
|
|
1584
|
-
const
|
|
1585
|
-
function
|
|
1588
|
+
const qr = ["•", "◦", "▪"];
|
|
1589
|
+
function Yr(e) {
|
|
1586
1590
|
const t = (e % 3 + 3) % 3;
|
|
1587
|
-
return
|
|
1591
|
+
return qr[t];
|
|
1588
1592
|
}
|
|
1589
1593
|
function lt({ ordered: e = !1, checked: t, collapsed: n } = {}) {
|
|
1590
1594
|
return function(r, l) {
|
|
@@ -1593,8 +1597,8 @@ function lt({ ordered: e = !1, checked: t, collapsed: n } = {}) {
|
|
|
1593
1597
|
let u = [], p = [], i = s;
|
|
1594
1598
|
if (n !== void 0) {
|
|
1595
1599
|
c.collapsed = n;
|
|
1596
|
-
const { block: f, runs:
|
|
1597
|
-
u = [f.id], p = [f], i = [...s, ...
|
|
1600
|
+
const { block: f, runs: y } = U("paragraph")(a);
|
|
1601
|
+
u = [f.id], p = [f], i = [...s, ...y];
|
|
1598
1602
|
}
|
|
1599
1603
|
return {
|
|
1600
1604
|
block: { id: a, type: "listItem", parentId: r, contentIds: u, props: c },
|
|
@@ -1603,7 +1607,7 @@ function lt({ ordered: e = !1, checked: t, collapsed: n } = {}) {
|
|
|
1603
1607
|
};
|
|
1604
1608
|
};
|
|
1605
1609
|
}
|
|
1606
|
-
function
|
|
1610
|
+
function Xr(e, t) {
|
|
1607
1611
|
const n = e.getBlock(t), o = e.getBlock(n.parentId), r = o.contentIds.indexOf(t), l = r > 0 ? o.contentIds[r - 1] : null, a = l ? e.getBlock(l) : null;
|
|
1608
1612
|
if (!a || a.type !== "listItem") {
|
|
1609
1613
|
le(e, t, "down");
|
|
@@ -1625,17 +1629,17 @@ function jn(e, t) {
|
|
|
1625
1629
|
var n;
|
|
1626
1630
|
return t.length === 0 || t.length === 1 && (((n = e.getRun(t[0])) == null ? void 0 : n.value) ?? "") === "";
|
|
1627
1631
|
}
|
|
1628
|
-
function
|
|
1632
|
+
function Qr(e, t) {
|
|
1629
1633
|
const n = t.contentIds ?? [];
|
|
1630
1634
|
if (n.length === 0) return !0;
|
|
1631
1635
|
if (n.length > 1) return !1;
|
|
1632
1636
|
const o = e.getBlock(n[0]);
|
|
1633
1637
|
return !!o && o.type === "paragraph" && ge(e, o.contentIds);
|
|
1634
1638
|
}
|
|
1635
|
-
function
|
|
1639
|
+
function Jr(e, t) {
|
|
1636
1640
|
const n = e.getBlock(t);
|
|
1637
1641
|
if (!n) return null;
|
|
1638
|
-
const o = e.getBlock(n.parentId), r = o.contentIds.indexOf(t), l = n.props.titleRunIds ?? [], s = jn(e, l) &&
|
|
1642
|
+
const o = e.getBlock(n.parentId), r = o.contentIds.indexOf(t), l = n.props.titleRunIds ?? [], s = jn(e, l) && Qr(e, n);
|
|
1639
1643
|
if (r > 0) {
|
|
1640
1644
|
const p = o.contentIds[r - 1], i = e.getBlock(p);
|
|
1641
1645
|
if (s)
|
|
@@ -1645,8 +1649,8 @@ function Xr(e, t) {
|
|
|
1645
1649
|
if ((i == null ? void 0 : i.type) === "listItem" && n.contentIds.length === 0) {
|
|
1646
1650
|
const f = [...i.props.titleRunIds ?? [], ...l];
|
|
1647
1651
|
return nt(e, [
|
|
1648
|
-
|
|
1649
|
-
|
|
1652
|
+
V(p, { titleRunIds: f }),
|
|
1653
|
+
V(t, { titleRunIds: [] }),
|
|
1650
1654
|
// detach before delete
|
|
1651
1655
|
q(t)
|
|
1652
1656
|
]), { focusBlockId: p, needsRefocus: !0 };
|
|
@@ -1664,75 +1668,75 @@ function Xr(e, t) {
|
|
|
1664
1668
|
q(t)
|
|
1665
1669
|
]), { focusBlockId: c.id, needsRefocus: !0 };
|
|
1666
1670
|
}
|
|
1667
|
-
function
|
|
1671
|
+
function Zr(e, t) {
|
|
1668
1672
|
if (typeof e.performBatch == "function") e.performBatch(t);
|
|
1669
1673
|
else for (const n of t) e.applyOperation(n);
|
|
1670
1674
|
}
|
|
1671
|
-
function
|
|
1675
|
+
function el(e, t) {
|
|
1672
1676
|
const o = e.getBlock(t).parentId, l = e.getBlock(o).contentIds.indexOf(t), { block: a, runs: s } = U("paragraph")(o);
|
|
1673
|
-
return
|
|
1677
|
+
return Zr(e, [
|
|
1674
1678
|
ke(a, o, l, { blocks: [a], runs: s }),
|
|
1675
|
-
|
|
1679
|
+
V(t, { titleRunIds: [] }),
|
|
1676
1680
|
// detach its own (empty) run before deleting
|
|
1677
1681
|
q(t)
|
|
1678
1682
|
]), be(e, a.id), a.id;
|
|
1679
1683
|
}
|
|
1680
|
-
function
|
|
1684
|
+
function tl(e, t) {
|
|
1681
1685
|
if (typeof e.performBatch == "function") e.performBatch(t);
|
|
1682
1686
|
else for (const n of t) e.applyOperation(n);
|
|
1683
1687
|
}
|
|
1684
|
-
function
|
|
1685
|
-
var L,
|
|
1686
|
-
const t = K(), n = te(e), { setSelectedBlockId: o } = Pe(), r = Dn(n == null ? void 0 : n.parentId), l =
|
|
1688
|
+
function nl({ id: e }) {
|
|
1689
|
+
var L, x;
|
|
1690
|
+
const t = K(), n = te(e), { setSelectedBlockId: o } = Pe(), r = Dn(n == null ? void 0 : n.parentId), l = m(() => {
|
|
1687
1691
|
var H, Y, X, pe, F;
|
|
1688
1692
|
const E = ((H = n == null ? void 0 : n.props) == null ? void 0 : H.titleRunIds) ?? [], j = t.getBlock(n == null ? void 0 : n.parentId), w = jn(t, E);
|
|
1689
1693
|
if (w && (j == null ? void 0 : j.type) === "listItem") {
|
|
1690
1694
|
Mt(t, e);
|
|
1691
1695
|
return;
|
|
1692
1696
|
}
|
|
1693
|
-
const
|
|
1694
|
-
if (w && (j == null ? void 0 : j.type) !== "listItem" && !
|
|
1695
|
-
|
|
1697
|
+
const R = (((Y = n == null ? void 0 : n.contentIds) == null ? void 0 : Y.length) ?? 0) > 0;
|
|
1698
|
+
if (w && (j == null ? void 0 : j.type) !== "listItem" && !R) {
|
|
1699
|
+
el(t, e);
|
|
1696
1700
|
return;
|
|
1697
1701
|
}
|
|
1698
|
-
const
|
|
1702
|
+
const O = ((X = n == null ? void 0 : n.props) == null ? void 0 : X.checked) !== void 0, P = ((pe = n == null ? void 0 : n.props) == null ? void 0 : pe.collapsed) !== void 0, M = lt({
|
|
1699
1703
|
ordered: (F = n == null ? void 0 : n.props) == null ? void 0 : F.ordered,
|
|
1700
|
-
checked:
|
|
1704
|
+
checked: O ? !1 : void 0,
|
|
1701
1705
|
collapsed: P ? !1 : void 0
|
|
1702
1706
|
});
|
|
1703
|
-
|
|
1704
|
-
}, [t, e, n]), a =
|
|
1705
|
-
const E =
|
|
1707
|
+
R && !P ? $n(t, e, E, M) : Xe(t, e, E, M);
|
|
1708
|
+
}, [t, e, n]), a = m(() => Xr(t, e), [t, e]), s = m(() => Mt(t, e), [t, e]), c = m(() => {
|
|
1709
|
+
const E = Jr(t, e);
|
|
1706
1710
|
!E || !E.needsRefocus || Qe(t, E.focusBlockId, e, o);
|
|
1707
|
-
}, [t, e, o]), u =
|
|
1711
|
+
}, [t, e, o]), u = m(() => le(t, e, "up"), [t, e]), p = m(() => le(t, e, "down"), [t, e]), i = m(() => {
|
|
1708
1712
|
var E;
|
|
1709
|
-
t.applyOperation(
|
|
1710
|
-
}, [t, e, (L = n == null ? void 0 : n.props) == null ? void 0 : L.checked]), f =
|
|
1713
|
+
t.applyOperation(V(e, { checked: !((E = n == null ? void 0 : n.props) != null && E.checked) }));
|
|
1714
|
+
}, [t, e, (L = n == null ? void 0 : n.props) == null ? void 0 : L.checked]), f = m(() => {
|
|
1711
1715
|
var j, w;
|
|
1712
1716
|
if (!((((j = n == null ? void 0 : n.contentIds) == null ? void 0 : j.length) ?? 0) > 0)) {
|
|
1713
|
-
const { block:
|
|
1714
|
-
|
|
1715
|
-
ke(
|
|
1716
|
-
|
|
1717
|
-
]), ve(
|
|
1717
|
+
const { block: R, runs: O } = U("paragraph")(e);
|
|
1718
|
+
tl(t, [
|
|
1719
|
+
ke(R, e, 0, { blocks: [R], runs: O }),
|
|
1720
|
+
V(e, { collapsed: !1 })
|
|
1721
|
+
]), ve(R.contentIds[0]);
|
|
1718
1722
|
return;
|
|
1719
1723
|
}
|
|
1720
|
-
t.applyOperation(
|
|
1721
|
-
}, [t, e, n == null ? void 0 : n.contentIds, (
|
|
1724
|
+
t.applyOperation(V(e, { collapsed: !((w = n == null ? void 0 : n.props) != null && w.collapsed) }));
|
|
1725
|
+
}, [t, e, n == null ? void 0 : n.contentIds, (x = n == null ? void 0 : n.props) == null ? void 0 : x.collapsed]), y = se("be-list-item", n);
|
|
1722
1726
|
if (!n) return null;
|
|
1723
|
-
const { ordered: v, checked: g, collapsed: k, titleRunIds: I = [] } = n.props,
|
|
1724
|
-
return /* @__PURE__ */ T("div", { className:
|
|
1727
|
+
const { ordered: v, checked: g, collapsed: k, titleRunIds: I = [] } = n.props, h = g !== void 0, b = !h && k !== void 0, B = n.contentIds.length > 0, $ = I.map((E) => t.getRun(E)).filter((E) => (E == null ? void 0 : E.type) === "text").map((E) => E.value).join("").trim(), D = Ce(t, n);
|
|
1728
|
+
return /* @__PURE__ */ T("div", { className: y, "data-block-id": e, dir: D, children: [
|
|
1725
1729
|
/* @__PURE__ */ T("div", { className: "be-list-item-row", children: [
|
|
1726
|
-
|
|
1730
|
+
h ? /* @__PURE__ */ d(
|
|
1727
1731
|
"input",
|
|
1728
1732
|
{
|
|
1729
1733
|
type: "checkbox",
|
|
1730
1734
|
className: "be-list-checkbox",
|
|
1731
1735
|
checked: !!g,
|
|
1732
1736
|
onChange: i,
|
|
1733
|
-
"aria-label":
|
|
1737
|
+
"aria-label": $ || "To-do item"
|
|
1734
1738
|
}
|
|
1735
|
-
) :
|
|
1739
|
+
) : b ? (
|
|
1736
1740
|
// A real button (not decorative, unlike the plain bullet/number
|
|
1737
1741
|
// marker below): it's the only way to reveal/hide this item's
|
|
1738
1742
|
// children, so assistive tech needs to know it's interactive and
|
|
@@ -1745,7 +1749,7 @@ function el({ id: e }) {
|
|
|
1745
1749
|
onClick: f,
|
|
1746
1750
|
"aria-expanded": !k,
|
|
1747
1751
|
"aria-label": B ? k ? "Expand toggle" : "Collapse toggle" : "Add content to toggle",
|
|
1748
|
-
children: k ? /* @__PURE__ */ d(Oe, {}) : /* @__PURE__ */ d(
|
|
1752
|
+
children: k ? /* @__PURE__ */ d(Oe, {}) : /* @__PURE__ */ d(Pt, {})
|
|
1749
1753
|
}
|
|
1750
1754
|
)
|
|
1751
1755
|
) : (
|
|
@@ -1755,17 +1759,17 @@ function el({ id: e }) {
|
|
|
1755
1759
|
// a,b,c -> i,ii,iii for numbered; disc -> circle -> square for
|
|
1756
1760
|
// bulleted, repeating every 3 levels), a common list-nesting
|
|
1757
1761
|
// convention — see listMarkers.js.
|
|
1758
|
-
/* @__PURE__ */ d("span", { className: "be-list-marker", "aria-hidden": "true", children: v ?
|
|
1759
|
-
|
|
1760
|
-
|
|
1761
|
-
) :
|
|
1762
|
+
/* @__PURE__ */ d("span", { className: "be-list-marker", "aria-hidden": "true", children: v ? Wr(
|
|
1763
|
+
en(t, n),
|
|
1764
|
+
Gr(t, n, r)
|
|
1765
|
+
) : Yr(en(t, n)) })
|
|
1762
1766
|
),
|
|
1763
1767
|
/* @__PURE__ */ d(
|
|
1764
1768
|
"div",
|
|
1765
1769
|
{
|
|
1766
1770
|
className: "be-list-item-title",
|
|
1767
1771
|
"data-empty": ge(t, I) ? "" : void 0,
|
|
1768
|
-
"data-placeholder":
|
|
1772
|
+
"data-placeholder": h ? "To-do" : b ? "Toggle" : "List item",
|
|
1769
1773
|
style: g ? { textDecoration: "line-through", opacity: 0.6 } : void 0,
|
|
1770
1774
|
children: /* @__PURE__ */ d(
|
|
1771
1775
|
Ee,
|
|
@@ -1784,20 +1788,20 @@ function el({ id: e }) {
|
|
|
1784
1788
|
}
|
|
1785
1789
|
)
|
|
1786
1790
|
] }),
|
|
1787
|
-
(!
|
|
1791
|
+
(!b || !k) && /* @__PURE__ */ d("div", { className: "be-list-item-children", children: /* @__PURE__ */ d(Ue, { parentId: e }) })
|
|
1788
1792
|
] });
|
|
1789
1793
|
}
|
|
1790
|
-
function
|
|
1791
|
-
const { titleRunIds: n = [], ordered: o } = e.props, r = n.map((s) =>
|
|
1794
|
+
function ol(e, t) {
|
|
1795
|
+
const { titleRunIds: n = [], ordered: o } = e.props, r = n.map((s) => Me(t.store.getRun(s), t)).join(""), l = e.contentIds.map(
|
|
1792
1796
|
(s) => t.registry.get(t.store.getBlock(s).type).toHTML(t.store.getBlock(s), t)
|
|
1793
1797
|
).join(""), a = l ? `<${o ? "ol" : "ul"}>${l}</${o ? "ol" : "ul"}>` : "";
|
|
1794
1798
|
return `<li>${r}${a}</li>`;
|
|
1795
1799
|
}
|
|
1796
|
-
function
|
|
1800
|
+
function rl(e, t) {
|
|
1797
1801
|
const { titleRunIds: n = [] } = e.props;
|
|
1798
|
-
return n.map((o) =>
|
|
1802
|
+
return n.map((o) => Ae(t.store.getRun(o), t)).join("");
|
|
1799
1803
|
}
|
|
1800
|
-
function
|
|
1804
|
+
function ll(e, t) {
|
|
1801
1805
|
const { titleRunIds: n = [], ordered: o, checked: r } = e.props, l = r !== void 0 ? r ? "- [x] " : "- [ ] " : o ? "1. " : "- ", a = De(
|
|
1802
1806
|
n.map((c) => t.store.getRun(c)),
|
|
1803
1807
|
t
|
|
@@ -1820,9 +1824,9 @@ function Fn(e, t) {
|
|
|
1820
1824
|
const l = Le(r, t), a = C(), s = [...l], c = [], u = [];
|
|
1821
1825
|
for (const i of o) {
|
|
1822
1826
|
const f = i.tagName === "OL";
|
|
1823
|
-
for (const
|
|
1824
|
-
if (
|
|
1825
|
-
const v = Fn(
|
|
1827
|
+
for (const y of i.children) {
|
|
1828
|
+
if (y.tagName !== "LI") continue;
|
|
1829
|
+
const v = Fn(y, t);
|
|
1826
1830
|
v.block.parentId = a, v.block.props.ordered = f, c.push(v.block, ...v.childBlocks), s.push(...v.runs), u.push(v.block.id);
|
|
1827
1831
|
}
|
|
1828
1832
|
}
|
|
@@ -1834,36 +1838,36 @@ function Fn(e, t) {
|
|
|
1834
1838
|
props: { ordered: !1, titleRunIds: l.map((i) => i.id) }
|
|
1835
1839
|
}, runs: s, childBlocks: c };
|
|
1836
1840
|
}
|
|
1837
|
-
function
|
|
1841
|
+
function al(e, t) {
|
|
1838
1842
|
if (e.tagName !== "LI") return null;
|
|
1839
1843
|
const { block: n, runs: o, childBlocks: r } = Fn(e, t);
|
|
1840
1844
|
return { block: n, runs: o, subtreeBlocks: r };
|
|
1841
1845
|
}
|
|
1842
|
-
const
|
|
1846
|
+
const sl = ae({
|
|
1843
1847
|
name: "listItem",
|
|
1844
1848
|
contentModel: "blocks",
|
|
1845
|
-
component:
|
|
1849
|
+
component: nl,
|
|
1846
1850
|
defaultProps: { ordered: !1, titleRunIds: [] },
|
|
1847
|
-
toHTML:
|
|
1848
|
-
toPlainText:
|
|
1849
|
-
toMarkdown:
|
|
1850
|
-
fromHTML:
|
|
1851
|
+
toHTML: ol,
|
|
1852
|
+
toPlainText: rl,
|
|
1853
|
+
toMarkdown: ll,
|
|
1854
|
+
fromHTML: al,
|
|
1851
1855
|
slashCommands: [
|
|
1852
1856
|
{
|
|
1853
1857
|
label: "Bulleted list",
|
|
1854
|
-
icon:
|
|
1858
|
+
icon: yn,
|
|
1855
1859
|
keywords: ["list", "bullet", "ul"],
|
|
1856
1860
|
run: (e, t) => re(e, t, lt({ ordered: !1 }))
|
|
1857
1861
|
},
|
|
1858
1862
|
{
|
|
1859
1863
|
label: "Numbered list",
|
|
1860
|
-
icon:
|
|
1864
|
+
icon: kn,
|
|
1861
1865
|
keywords: ["list", "number", "ordered", "ol"],
|
|
1862
1866
|
run: (e, t) => re(e, t, lt({ ordered: !0 }))
|
|
1863
1867
|
},
|
|
1864
1868
|
{
|
|
1865
1869
|
label: "To-do list",
|
|
1866
|
-
icon:
|
|
1870
|
+
icon: Ht,
|
|
1867
1871
|
keywords: ["todo", "checkbox", "task", "checklist"],
|
|
1868
1872
|
run: (e, t) => re(
|
|
1869
1873
|
e,
|
|
@@ -1882,27 +1886,27 @@ const ll = ae({
|
|
|
1882
1886
|
)
|
|
1883
1887
|
}
|
|
1884
1888
|
]
|
|
1885
|
-
}),
|
|
1886
|
-
function
|
|
1889
|
+
}), cl = ["text", "date", "checkbox", "select"], It = "text", Ft = 160, ze = 80;
|
|
1890
|
+
function il(e) {
|
|
1887
1891
|
return `Column ${e + 1}`;
|
|
1888
1892
|
}
|
|
1889
1893
|
function Kn(e) {
|
|
1890
1894
|
return Array.from({ length: e }, (t, n) => ({
|
|
1891
1895
|
id: C(),
|
|
1892
|
-
label:
|
|
1896
|
+
label: il(n),
|
|
1893
1897
|
type: It,
|
|
1894
|
-
width:
|
|
1898
|
+
width: Ft
|
|
1895
1899
|
}));
|
|
1896
1900
|
}
|
|
1897
1901
|
function fe(e, t) {
|
|
1898
1902
|
var o;
|
|
1899
1903
|
const n = (o = e.props) == null ? void 0 : o.columns;
|
|
1900
1904
|
return !Array.isArray(n) || n.length !== t ? Kn(t) : n.map((r) => {
|
|
1901
|
-
const l = r.type ?? It, a = r.width ??
|
|
1905
|
+
const l = r.type ?? It, a = r.width ?? Ft;
|
|
1902
1906
|
return l === r.type && a === r.width ? r : { ...r, type: l, width: a };
|
|
1903
1907
|
});
|
|
1904
1908
|
}
|
|
1905
|
-
function
|
|
1909
|
+
function ul(e) {
|
|
1906
1910
|
switch (e) {
|
|
1907
1911
|
case "date":
|
|
1908
1912
|
return { id: C(), type: "date", value: "", marks: {}, data: { isoDate: "" } };
|
|
@@ -1926,14 +1930,14 @@ function cl(e) {
|
|
|
1926
1930
|
return { id: C(), type: "text", value: "", marks: {} };
|
|
1927
1931
|
}
|
|
1928
1932
|
}
|
|
1929
|
-
function
|
|
1930
|
-
const n =
|
|
1933
|
+
function Kt(e, t) {
|
|
1934
|
+
const n = ul(t == null ? void 0 : t.type);
|
|
1931
1935
|
return {
|
|
1932
1936
|
block: { id: C(), type: "tableCell", parentId: e, contentIds: [n.id], props: {} },
|
|
1933
1937
|
run: n
|
|
1934
1938
|
};
|
|
1935
1939
|
}
|
|
1936
|
-
function
|
|
1940
|
+
function dl(e, t, n) {
|
|
1937
1941
|
if (e.type === t) return e;
|
|
1938
1942
|
let o;
|
|
1939
1943
|
if (e.type === "text")
|
|
@@ -1960,30 +1964,30 @@ function st(e, t) {
|
|
|
1960
1964
|
const n = t == null ? void 0 : t.get(e.type);
|
|
1961
1965
|
return n != null && n.toPlainText ? n.toPlainText(e) : "";
|
|
1962
1966
|
}
|
|
1963
|
-
function
|
|
1967
|
+
function pl(e, t, n) {
|
|
1964
1968
|
var o, r, l;
|
|
1965
1969
|
return t === "date" ? ((o = e == null ? void 0 : e.data) == null ? void 0 : o.isoDate) ?? "" : t === "checkbox" ? (r = e == null ? void 0 : e.data) != null && r.checked ? 1 : 0 : t === "select" ? (((l = e == null ? void 0 : e.data) == null ? void 0 : l.selectedLabel) ?? "").trim() : st(e, n).trim();
|
|
1966
1970
|
}
|
|
1967
|
-
function
|
|
1971
|
+
function fl(e, t, n) {
|
|
1968
1972
|
if (n === "checkbox") return e - t;
|
|
1969
1973
|
const o = Number(e), r = Number(t);
|
|
1970
1974
|
return e !== "" && t !== "" && !Number.isNaN(o) && !Number.isNaN(r) ? o - r : String(e).localeCompare(String(t), void 0, { sensitivity: "base" });
|
|
1971
1975
|
}
|
|
1972
|
-
function
|
|
1976
|
+
function ml(e, t, n, o) {
|
|
1973
1977
|
const r = e.map(({ rowId: a, run: s }) => ({
|
|
1974
1978
|
rowId: a,
|
|
1975
|
-
key:
|
|
1979
|
+
key: pl(s, t, o)
|
|
1976
1980
|
})), l = (a) => a === "" || a == null;
|
|
1977
1981
|
return r.sort((a, s) => {
|
|
1978
1982
|
const c = l(a.key), u = l(s.key);
|
|
1979
1983
|
if (c && u) return 0;
|
|
1980
1984
|
if (c) return 1;
|
|
1981
1985
|
if (u) return -1;
|
|
1982
|
-
const p =
|
|
1986
|
+
const p = fl(a.key, s.key, t);
|
|
1983
1987
|
return n === "desc" ? -p : p;
|
|
1984
1988
|
}), r.map((a) => a.rowId);
|
|
1985
1989
|
}
|
|
1986
|
-
const
|
|
1990
|
+
const hl = [
|
|
1987
1991
|
"none",
|
|
1988
1992
|
"count",
|
|
1989
1993
|
"count-values",
|
|
@@ -1992,7 +1996,7 @@ const fl = [
|
|
|
1992
1996
|
"average",
|
|
1993
1997
|
"min",
|
|
1994
1998
|
"max"
|
|
1995
|
-
],
|
|
1999
|
+
], gl = {
|
|
1996
2000
|
none: "None",
|
|
1997
2001
|
count: "Count all",
|
|
1998
2002
|
"count-values": "Count filled",
|
|
@@ -2001,7 +2005,7 @@ const fl = [
|
|
|
2001
2005
|
average: "Average",
|
|
2002
2006
|
min: "Min",
|
|
2003
2007
|
max: "Max"
|
|
2004
|
-
},
|
|
2008
|
+
}, bl = {
|
|
2005
2009
|
count: "Count",
|
|
2006
2010
|
"count-values": "Filled",
|
|
2007
2011
|
"count-empty": "Empty",
|
|
@@ -2010,7 +2014,7 @@ const fl = [
|
|
|
2010
2014
|
min: "Min",
|
|
2011
2015
|
max: "Max"
|
|
2012
2016
|
};
|
|
2013
|
-
function
|
|
2017
|
+
function yl(e, t, n, o) {
|
|
2014
2018
|
if (!n || n === "none") return null;
|
|
2015
2019
|
if (n === "count") return e.length;
|
|
2016
2020
|
const r = e.map((a) => st(a, o).trim());
|
|
@@ -2019,7 +2023,7 @@ function gl(e, t, n, o) {
|
|
|
2019
2023
|
const l = r.map(Number).filter((a, s) => r[s] !== "" && !Number.isNaN(a));
|
|
2020
2024
|
return l.length === 0 ? null : n === "sum" ? l.reduce((a, s) => a + s, 0) : n === "average" ? l.reduce((a, s) => a + s, 0) / l.length : n === "min" ? Math.min(...l) : n === "max" ? Math.max(...l) : null;
|
|
2021
2025
|
}
|
|
2022
|
-
function
|
|
2026
|
+
function kl(e) {
|
|
2023
2027
|
return e == null ? "" : Number.isInteger(e) ? String(e) : e.toFixed(2);
|
|
2024
2028
|
}
|
|
2025
2029
|
function Se(e, t) {
|
|
@@ -2029,16 +2033,16 @@ function Se(e, t) {
|
|
|
2029
2033
|
function zn(e, t) {
|
|
2030
2034
|
const o = e.getBlock(t.parentId).contentIds.indexOf(t.id);
|
|
2031
2035
|
Se(e, [q(t.id)]);
|
|
2032
|
-
const r =
|
|
2036
|
+
const r = Ut(e);
|
|
2033
2037
|
if (r)
|
|
2034
2038
|
return be(e, r), null;
|
|
2035
2039
|
const l = e.getBlock(t.parentId), a = l.contentIds[o] ?? l.contentIds[o - 1];
|
|
2036
2040
|
return a && be(e, a), null;
|
|
2037
2041
|
}
|
|
2038
|
-
function
|
|
2042
|
+
function vl(e, t) {
|
|
2039
2043
|
const n = e.getBlock(t), o = e.getBlock(n.parentId), r = o.contentIds.indexOf(t), l = fe(o, n.contentIds.length), a = C(), s = [], c = [], u = [];
|
|
2040
2044
|
for (const i of l) {
|
|
2041
|
-
const f =
|
|
2045
|
+
const f = Kt(a, i);
|
|
2042
2046
|
s.push(f.block), c.push(f.run), u.push(f.block.id);
|
|
2043
2047
|
}
|
|
2044
2048
|
const p = { id: a, type: "tableRow", parentId: o.id, contentIds: u, props: {} };
|
|
@@ -2046,7 +2050,7 @@ function yl(e, t) {
|
|
|
2046
2050
|
ke(p, o.id, r + 1, { blocks: [p, ...s], runs: c })
|
|
2047
2051
|
), be(e, a), a;
|
|
2048
2052
|
}
|
|
2049
|
-
function
|
|
2053
|
+
function Il(e, t) {
|
|
2050
2054
|
const n = e.getBlock(t), o = e.getBlock(n.parentId);
|
|
2051
2055
|
if (o.contentIds.length <= 1)
|
|
2052
2056
|
return zn(e, o);
|
|
@@ -2055,7 +2059,7 @@ function kl(e, t) {
|
|
|
2055
2059
|
const l = e.getBlock(o.id), a = Math.min(r, l.contentIds.length - 1), s = l.contentIds[a];
|
|
2056
2060
|
return s && be(e, s), s ?? null;
|
|
2057
2061
|
}
|
|
2058
|
-
function
|
|
2062
|
+
function tn(e, t, n) {
|
|
2059
2063
|
const o = e.getBlock(t), r = fe(
|
|
2060
2064
|
o,
|
|
2061
2065
|
o.contentIds[0] ? e.getBlock(o.contentIds[0]).contentIds.length : 0
|
|
@@ -2063,19 +2067,19 @@ function Zt(e, t, n) {
|
|
|
2063
2067
|
id: C(),
|
|
2064
2068
|
label: "New Column",
|
|
2065
2069
|
type: It,
|
|
2066
|
-
width:
|
|
2070
|
+
width: Ft
|
|
2067
2071
|
}, a = [];
|
|
2068
2072
|
let s = null;
|
|
2069
2073
|
for (const u of o.contentIds) {
|
|
2070
|
-
const p =
|
|
2074
|
+
const p = Kt(u, l);
|
|
2071
2075
|
s === null && (s = p.block.id), a.push(
|
|
2072
2076
|
ke(p.block, u, n + 1, { blocks: [p.block], runs: [p.run] })
|
|
2073
2077
|
);
|
|
2074
2078
|
}
|
|
2075
2079
|
const c = [...r];
|
|
2076
|
-
return c.splice(n + 1, 0, l), a.push(
|
|
2080
|
+
return c.splice(n + 1, 0, l), a.push(V(t, { columns: c })), Se(e, a), s && be(e, s), s;
|
|
2077
2081
|
}
|
|
2078
|
-
function
|
|
2082
|
+
function wl(e, t, n) {
|
|
2079
2083
|
const o = e.getBlock(t), r = e.getBlock(o.contentIds[0]);
|
|
2080
2084
|
if (!r || r.contentIds.length <= 1)
|
|
2081
2085
|
return zn(e, o);
|
|
@@ -2083,48 +2087,48 @@ function vl(e, t, n) {
|
|
|
2083
2087
|
const f = e.getBlock(i);
|
|
2084
2088
|
return q(f.contentIds[n]);
|
|
2085
2089
|
}), s = l.filter((i, f) => f !== n);
|
|
2086
|
-
a.push(
|
|
2090
|
+
a.push(V(t, { columns: s })), Se(e, a);
|
|
2087
2091
|
const c = e.getBlock(o.contentIds[0]), u = Math.min(n, c.contentIds.length - 1), p = c.contentIds[u];
|
|
2088
2092
|
return p && be(e, p), p ?? null;
|
|
2089
2093
|
}
|
|
2090
|
-
function
|
|
2094
|
+
function nn(e, t, n, o) {
|
|
2091
2095
|
const r = e.getBlock(t), l = e.getBlock(r.contentIds[0]), a = fe(r, l ? l.contentIds.length : 0);
|
|
2092
2096
|
if (!a[n]) return;
|
|
2093
2097
|
const s = [...a];
|
|
2094
2098
|
s[n] = {
|
|
2095
2099
|
...a[n],
|
|
2096
2100
|
width: Math.max(ze, Math.round(o))
|
|
2097
|
-
}, e.applyOperation(
|
|
2101
|
+
}, e.applyOperation(V(t, { columns: s }));
|
|
2098
2102
|
}
|
|
2099
|
-
function
|
|
2103
|
+
function Tl(e, t, n, o) {
|
|
2100
2104
|
const r = e.getBlock(t), l = e.getBlock(r.contentIds[0]), s = [...fe(r, l ? l.contentIds.length : 0)];
|
|
2101
|
-
s[n] && (s[n] = { ...s[n], label: o }, e.applyOperation(
|
|
2105
|
+
s[n] && (s[n] = { ...s[n], label: o }, e.applyOperation(V(t, { columns: s })));
|
|
2102
2106
|
}
|
|
2103
|
-
function
|
|
2107
|
+
function on(e, t, n, o, r) {
|
|
2104
2108
|
var p;
|
|
2105
2109
|
const l = e.getBlock(t), a = l.contentIds.map((i) => {
|
|
2106
|
-
const f = e.getBlock(i),
|
|
2107
|
-
return { rowId: i, run:
|
|
2110
|
+
const f = e.getBlock(i), y = e.getBlock(f.contentIds[n]);
|
|
2111
|
+
return { rowId: i, run: y ? e.getRun(y.contentIds[0]) : null };
|
|
2108
2112
|
}), c = ((p = fe(
|
|
2109
2113
|
l,
|
|
2110
2114
|
a.length ? e.getBlock(l.contentIds[0]).contentIds.length : 0
|
|
2111
|
-
)[n]) == null ? void 0 : p.type) ?? It, u =
|
|
2115
|
+
)[n]) == null ? void 0 : p.type) ?? It, u = ml(a, c, o, r);
|
|
2112
2116
|
e.applyOperation(Lt(t, u));
|
|
2113
2117
|
}
|
|
2114
|
-
function
|
|
2118
|
+
function Cl(e, t, n, o) {
|
|
2115
2119
|
const r = e.getBlock(t), l = e.getBlock(r.contentIds[0]), a = fe(r, l ? l.contentIds.length : 0);
|
|
2116
2120
|
if (!a[n]) return;
|
|
2117
2121
|
const s = [...a];
|
|
2118
|
-
s[n] = { ...a[n], aggregate: o }, e.applyOperation(
|
|
2122
|
+
s[n] = { ...a[n], aggregate: o }, e.applyOperation(V(t, { columns: s }));
|
|
2119
2123
|
}
|
|
2120
|
-
function
|
|
2124
|
+
function zt(e, t, n) {
|
|
2121
2125
|
return t.contentIds.map((o) => {
|
|
2122
2126
|
const l = e.getBlock(o).contentIds[n], a = e.getBlock(l);
|
|
2123
2127
|
return { cellId: l, run: e.getRun(a.contentIds[0]) };
|
|
2124
2128
|
});
|
|
2125
2129
|
}
|
|
2126
|
-
function
|
|
2127
|
-
const r =
|
|
2130
|
+
function Bl(e, t, n, o) {
|
|
2131
|
+
const r = zt(e, t, n), l = [], a = /* @__PURE__ */ new Map();
|
|
2128
2132
|
for (const { run: c } of r) {
|
|
2129
2133
|
const u = st(c, o).trim();
|
|
2130
2134
|
if (!u || a.has(u)) continue;
|
|
@@ -2146,29 +2150,29 @@ function Tl(e, t, n, o) {
|
|
|
2146
2150
|
});
|
|
2147
2151
|
return { options: l, newRuns: s };
|
|
2148
2152
|
}
|
|
2149
|
-
function
|
|
2153
|
+
function Nl(e, t, n, o, r) {
|
|
2150
2154
|
const l = e.getBlock(t), a = e.getBlock(l.contentIds[0]), s = fe(l, a ? a.contentIds.length : 0), c = s[n];
|
|
2151
2155
|
if (!c || c.type === o) return;
|
|
2152
2156
|
const u = [...s];
|
|
2153
2157
|
if (o === "select") {
|
|
2154
|
-
const { options: i, newRuns: f } =
|
|
2158
|
+
const { options: i, newRuns: f } = Bl(
|
|
2155
2159
|
e,
|
|
2156
2160
|
l,
|
|
2157
2161
|
n,
|
|
2158
2162
|
r
|
|
2159
2163
|
);
|
|
2160
2164
|
u[n] = { ...c, type: o, options: i };
|
|
2161
|
-
const
|
|
2162
|
-
for (const { cellId: v, run: g } of f)
|
|
2163
|
-
Se(e,
|
|
2165
|
+
const y = [V(t, { columns: u })];
|
|
2166
|
+
for (const { cellId: v, run: g } of f) y.push(Ve(v, [g]));
|
|
2167
|
+
Se(e, y);
|
|
2164
2168
|
return;
|
|
2165
2169
|
}
|
|
2166
2170
|
u[n] = { ...c, type: o };
|
|
2167
|
-
const p = [
|
|
2168
|
-
for (const { cellId: i, run: f } of
|
|
2171
|
+
const p = [V(t, { columns: u })];
|
|
2172
|
+
for (const { cellId: i, run: f } of zt(e, l, n)) {
|
|
2169
2173
|
if (!f) continue;
|
|
2170
|
-
const
|
|
2171
|
-
p.push(
|
|
2174
|
+
const y = dl(f, o, r);
|
|
2175
|
+
p.push(Ve(i, [y]));
|
|
2172
2176
|
}
|
|
2173
2177
|
Se(e, p);
|
|
2174
2178
|
}
|
|
@@ -2178,43 +2182,43 @@ function ht(e, t, n, o) {
|
|
|
2178
2182
|
if (!s) return;
|
|
2179
2183
|
const c = [...a];
|
|
2180
2184
|
c[n] = { ...s, options: o };
|
|
2181
|
-
const u = [
|
|
2182
|
-
for (const { run:
|
|
2183
|
-
if (!
|
|
2184
|
-
const v = ((i =
|
|
2185
|
-
(k !== v || I !== (((f =
|
|
2186
|
-
de(
|
|
2185
|
+
const u = [V(t, { columns: c })], p = new Map(o.map((y) => [y.value, y]));
|
|
2186
|
+
for (const { run: y } of zt(e, r, n)) {
|
|
2187
|
+
if (!y || y.type !== "tableSelect") continue;
|
|
2188
|
+
const v = ((i = y.data) == null ? void 0 : i.selectedValue) ?? "", g = p.get(v), k = g ? v : "", I = g ? g.label : "";
|
|
2189
|
+
(k !== v || I !== (((f = y.data) == null ? void 0 : f.selectedLabel) ?? "")) && u.push(
|
|
2190
|
+
de(y.id, {
|
|
2187
2191
|
data: { selectedValue: k, selectedLabel: I }
|
|
2188
2192
|
})
|
|
2189
2193
|
);
|
|
2190
2194
|
}
|
|
2191
2195
|
Se(e, u);
|
|
2192
2196
|
}
|
|
2193
|
-
const
|
|
2194
|
-
function
|
|
2195
|
-
const e = K(), t =
|
|
2196
|
-
(o) => e.subscribe(
|
|
2197
|
+
const Rl = "$fieldTypes";
|
|
2198
|
+
function Ll() {
|
|
2199
|
+
const e = K(), t = m(
|
|
2200
|
+
(o) => e.subscribe(Rl, o),
|
|
2197
2201
|
[e]
|
|
2198
|
-
), n =
|
|
2199
|
-
return
|
|
2202
|
+
), n = m(() => e.getFieldTypes(), [e]);
|
|
2203
|
+
return St(t, n);
|
|
2200
2204
|
}
|
|
2201
|
-
function
|
|
2205
|
+
function rn() {
|
|
2202
2206
|
if (typeof window > "u" || !window.visualViewport) return 0;
|
|
2203
2207
|
const e = window.visualViewport, t = window.innerHeight - (e.height + e.offsetTop);
|
|
2204
2208
|
return t > 0 ? Math.round(t) : 0;
|
|
2205
2209
|
}
|
|
2206
|
-
function
|
|
2207
|
-
const [e, t] =
|
|
2210
|
+
function Al() {
|
|
2211
|
+
const [e, t] = S(rn);
|
|
2208
2212
|
return oe(() => {
|
|
2209
2213
|
if (typeof window > "u" || !window.visualViewport) return;
|
|
2210
|
-
const n = window.visualViewport, o = () => t(
|
|
2214
|
+
const n = window.visualViewport, o = () => t(rn());
|
|
2211
2215
|
return o(), n.addEventListener("resize", o), n.addEventListener("scroll", o), () => {
|
|
2212
2216
|
n.removeEventListener("resize", o), n.removeEventListener("scroll", o);
|
|
2213
2217
|
};
|
|
2214
2218
|
}, []), e;
|
|
2215
2219
|
}
|
|
2216
|
-
const
|
|
2217
|
-
function
|
|
2220
|
+
const Ml = 280, ln = 220, El = 32, an = 6;
|
|
2221
|
+
function $l(e, t) {
|
|
2218
2222
|
return t ? e.label.toLowerCase().includes(t.toLowerCase()) : !0;
|
|
2219
2223
|
}
|
|
2220
2224
|
function We({
|
|
@@ -2233,71 +2237,71 @@ function We({
|
|
|
2233
2237
|
autoOpen: f = !1
|
|
2234
2238
|
}) {
|
|
2235
2239
|
var z, ee;
|
|
2236
|
-
const [
|
|
2237
|
-
() => F ? D : t.filter((
|
|
2240
|
+
const [y, v] = S(!1), [g, k] = S(""), [I, h] = S(0), [b, B] = S(null), $ = Al(), [D, L] = S([]), [x, E] = S(!1), [j, w] = S(!1), R = _(null), O = _(null), P = _(null), M = _(null), H = _(null), Y = _(null), X = Ge(() => [R, P], []), pe = a === "tag", F = typeof t == "function", [Q, G] = S(El), [me, ce] = S(0), Ie = F ? void 0 : t.find((N) => N.value === e), ie = e ? Ie ?? (s ? { label: s, color: c } : void 0) : void 0, ne = Ge(
|
|
2241
|
+
() => F ? D : t.filter((N) => $l(N, g)),
|
|
2238
2242
|
[F, D, t, g]
|
|
2239
|
-
), je = Math.max(0, (ne.length - 1) * Q), $e = Math.min(me, je), Z = ne.length ? Math.max(0, Math.floor($e / Q) -
|
|
2243
|
+
), je = Math.max(0, (ne.length - 1) * Q), $e = Math.min(me, je), Z = ne.length ? Math.max(0, Math.floor($e / Q) - an) : 0, dt = Math.ceil(ln / Q) + an * 2, Be = Math.min(ne.length, Z + dt), wt = ne.slice(Z, Be), Je = Z * Q, Ze = Math.max(0, (ne.length - Be) * Q);
|
|
2240
2244
|
at(() => {
|
|
2241
2245
|
var J;
|
|
2242
|
-
const
|
|
2243
|
-
|
|
2246
|
+
const N = (J = Y.current) == null ? void 0 : J.getBoundingClientRect().height;
|
|
2247
|
+
N && Math.abs(N - Q) > 0.5 && G(N);
|
|
2244
2248
|
}), oe(() => {
|
|
2245
|
-
if (!F || !
|
|
2246
|
-
let
|
|
2249
|
+
if (!F || !y) return;
|
|
2250
|
+
let N = !1;
|
|
2247
2251
|
E(!0), w(!1);
|
|
2248
2252
|
const J = setTimeout(() => {
|
|
2249
2253
|
Promise.resolve(t(g)).then((ue) => {
|
|
2250
|
-
|
|
2254
|
+
N || (L(ue ?? []), E(!1));
|
|
2251
2255
|
}).catch(() => {
|
|
2252
|
-
|
|
2256
|
+
N || (L([]), E(!1), w(!0));
|
|
2253
2257
|
});
|
|
2254
2258
|
}, 250);
|
|
2255
2259
|
return () => {
|
|
2256
|
-
|
|
2260
|
+
N = !0, clearTimeout(J);
|
|
2257
2261
|
};
|
|
2258
|
-
}, [F,
|
|
2259
|
-
const ye =
|
|
2260
|
-
ct(X,
|
|
2261
|
-
const Fe =
|
|
2262
|
-
var
|
|
2263
|
-
B(((
|
|
2262
|
+
}, [F, y, t, g]);
|
|
2263
|
+
const ye = m(() => v(!1), []);
|
|
2264
|
+
ct(X, y, ye);
|
|
2265
|
+
const Fe = Uo(P, y, b == null ? void 0 : b.left), et = m(() => {
|
|
2266
|
+
var N;
|
|
2267
|
+
B(((N = O.current) == null ? void 0 : N.getBoundingClientRect()) ?? null), k(""), h(0), ce(0), v(!0);
|
|
2264
2268
|
}, []);
|
|
2265
2269
|
oe(() => {
|
|
2266
2270
|
f && et();
|
|
2267
2271
|
}, []), oe(() => {
|
|
2268
|
-
var
|
|
2269
|
-
|
|
2270
|
-
}, [
|
|
2271
|
-
const
|
|
2272
|
-
if (!
|
|
2273
|
-
const J = I * Q, ue = J + Q,
|
|
2272
|
+
var N;
|
|
2273
|
+
y && ((N = M.current) == null || N.focus());
|
|
2274
|
+
}, [y, Fe]), oe(() => {
|
|
2275
|
+
const N = H.current;
|
|
2276
|
+
if (!N) return;
|
|
2277
|
+
const J = I * Q, ue = J + Q, Ne = N.scrollTop, Re = N.clientHeight || ln, we = Ne + Re;
|
|
2274
2278
|
let tt = null;
|
|
2275
|
-
J <
|
|
2279
|
+
J < Ne ? tt = J : ue > we && (tt = ue - Re), tt !== null && (N.scrollTop = tt, ce(tt));
|
|
2276
2280
|
}, [I, Q]);
|
|
2277
|
-
const
|
|
2278
|
-
(
|
|
2281
|
+
const A = m(
|
|
2282
|
+
(N) => {
|
|
2279
2283
|
var J;
|
|
2280
|
-
n(
|
|
2284
|
+
n(N.value, N), ye(), (J = O.current) == null || J.focus();
|
|
2281
2285
|
},
|
|
2282
2286
|
[n, ye]
|
|
2283
|
-
), W =
|
|
2284
|
-
(
|
|
2287
|
+
), W = m(
|
|
2288
|
+
(N) => {
|
|
2285
2289
|
var J;
|
|
2286
|
-
|
|
2290
|
+
N.key === "ArrowDown" ? (N.preventDefault(), h((ue) => Math.min(ue + 1, Math.max(ne.length - 1, 0)))) : N.key === "ArrowUp" ? (N.preventDefault(), h((ue) => Math.max(ue - 1, 0))) : N.key === "Enter" ? (N.preventDefault(), ne[I] && A(ne[I])) : N.key === "Escape" && (N.preventDefault(), ye(), (J = O.current) == null || J.focus());
|
|
2287
2291
|
},
|
|
2288
|
-
[ne, I,
|
|
2292
|
+
[ne, I, A, ye]
|
|
2289
2293
|
);
|
|
2290
|
-
return /* @__PURE__ */ T("span", { className: `be-select ${l}`.trim(), ref:
|
|
2294
|
+
return /* @__PURE__ */ T("span", { className: `be-select ${l}`.trim(), ref: R, children: [
|
|
2291
2295
|
/* @__PURE__ */ d(
|
|
2292
2296
|
"button",
|
|
2293
2297
|
{
|
|
2294
2298
|
type: "button",
|
|
2295
|
-
ref:
|
|
2299
|
+
ref: O,
|
|
2296
2300
|
className: `be-select-trigger${pe ? " be-select-trigger-tag" : ""}${i ? " be-select-trigger-mention" : ""}`,
|
|
2297
2301
|
"aria-haspopup": "listbox",
|
|
2298
|
-
"aria-expanded":
|
|
2302
|
+
"aria-expanded": y,
|
|
2299
2303
|
"aria-label": r,
|
|
2300
|
-
onClick: () =>
|
|
2304
|
+
onClick: () => y ? ye() : et(),
|
|
2301
2305
|
children: pe ? ie ? /* @__PURE__ */ d(
|
|
2302
2306
|
"span",
|
|
2303
2307
|
{
|
|
@@ -2307,11 +2311,11 @@ function We({
|
|
|
2307
2311
|
}
|
|
2308
2312
|
) : /* @__PURE__ */ d("span", { className: "be-select-value be-select-value-placeholder", children: o }) : /* @__PURE__ */ T(Te, { children: [
|
|
2309
2313
|
/* @__PURE__ */ d("span", { className: "be-select-value", children: ie ? ie.label : o }),
|
|
2310
|
-
/* @__PURE__ */ d(
|
|
2314
|
+
/* @__PURE__ */ d(Pt, { size: 14, className: "be-select-chevron" })
|
|
2311
2315
|
] })
|
|
2312
2316
|
}
|
|
2313
2317
|
),
|
|
2314
|
-
|
|
2318
|
+
y && b && Fe != null && He(
|
|
2315
2319
|
/* @__PURE__ */ T(
|
|
2316
2320
|
"div",
|
|
2317
2321
|
{
|
|
@@ -2320,23 +2324,23 @@ function We({
|
|
|
2320
2324
|
style: {
|
|
2321
2325
|
position: "fixed",
|
|
2322
2326
|
left: Fe,
|
|
2323
|
-
minWidth:
|
|
2327
|
+
minWidth: b.width,
|
|
2324
2328
|
// Flips above the trigger instead of below it once there isn't
|
|
2325
2329
|
// enough room left before the keyboard (or screen bottom) —
|
|
2326
2330
|
// otherwise the popover can render partly/entirely hidden
|
|
2327
2331
|
// underneath an open on-screen keyboard.
|
|
2328
|
-
...
|
|
2332
|
+
...b.bottom + Ml > window.innerHeight - $ ? { bottom: window.innerHeight - b.top + 4 } : { top: b.bottom + 4 }
|
|
2329
2333
|
},
|
|
2330
2334
|
children: [
|
|
2331
2335
|
/* @__PURE__ */ d(
|
|
2332
2336
|
"input",
|
|
2333
2337
|
{
|
|
2334
|
-
ref:
|
|
2338
|
+
ref: M,
|
|
2335
2339
|
type: "text",
|
|
2336
2340
|
className: "be-select-search",
|
|
2337
2341
|
value: g,
|
|
2338
|
-
onChange: (
|
|
2339
|
-
k(
|
|
2342
|
+
onChange: (N) => {
|
|
2343
|
+
k(N.target.value), h(0);
|
|
2340
2344
|
},
|
|
2341
2345
|
onKeyDown: W,
|
|
2342
2346
|
placeholder: "Search…",
|
|
@@ -2349,37 +2353,37 @@ function We({
|
|
|
2349
2353
|
className: "be-select-options",
|
|
2350
2354
|
role: "listbox",
|
|
2351
2355
|
ref: H,
|
|
2352
|
-
onScroll: (
|
|
2356
|
+
onScroll: (N) => ce(N.currentTarget.scrollTop),
|
|
2353
2357
|
children: [
|
|
2354
|
-
F &&
|
|
2355
|
-
F &&
|
|
2356
|
-
|
|
2357
|
-
|
|
2358
|
+
F && x && /* @__PURE__ */ d("div", { className: "be-select-empty", children: "Loading…" }),
|
|
2359
|
+
F && !x && j && /* @__PURE__ */ d("div", { className: "be-select-empty be-select-error", children: "Couldn't load options" }),
|
|
2360
|
+
!x && !j && ne.length === 0 && /* @__PURE__ */ d("div", { className: "be-select-empty", children: "No results" }),
|
|
2361
|
+
!x && !j && ne.length > 0 && /* @__PURE__ */ T(Te, { children: [
|
|
2358
2362
|
Je > 0 && /* @__PURE__ */ d("div", { style: { height: Je }, "aria-hidden": "true" }),
|
|
2359
|
-
wt.map((
|
|
2360
|
-
var
|
|
2363
|
+
wt.map((N, J) => {
|
|
2364
|
+
var Ne, Re;
|
|
2361
2365
|
const ue = Z + J;
|
|
2362
2366
|
return /* @__PURE__ */ d(
|
|
2363
2367
|
"div",
|
|
2364
2368
|
{
|
|
2365
2369
|
ref: J === 0 ? Y : void 0,
|
|
2366
2370
|
role: "option",
|
|
2367
|
-
"aria-selected":
|
|
2368
|
-
className: `be-select-option${ue === I ? " be-select-option-active" : ""}${
|
|
2371
|
+
"aria-selected": N.value === e,
|
|
2372
|
+
className: `be-select-option${ue === I ? " be-select-option-active" : ""}${N.value === e ? " be-select-option-selected" : ""}`,
|
|
2369
2373
|
onMouseDown: (we) => {
|
|
2370
|
-
we.preventDefault(),
|
|
2374
|
+
we.preventDefault(), A(N);
|
|
2371
2375
|
},
|
|
2372
|
-
onMouseEnter: () =>
|
|
2376
|
+
onMouseEnter: () => h(ue),
|
|
2373
2377
|
children: pe ? /* @__PURE__ */ d(
|
|
2374
2378
|
"span",
|
|
2375
2379
|
{
|
|
2376
2380
|
className: "be-select-tag",
|
|
2377
|
-
style: { background: (
|
|
2378
|
-
children:
|
|
2381
|
+
style: { background: (Ne = N.color) == null ? void 0 : Ne.bg, color: (Re = N.color) == null ? void 0 : Re.text },
|
|
2382
|
+
children: N.label
|
|
2379
2383
|
}
|
|
2380
|
-
) :
|
|
2384
|
+
) : N.label
|
|
2381
2385
|
},
|
|
2382
|
-
|
|
2386
|
+
N.value
|
|
2383
2387
|
);
|
|
2384
2388
|
}),
|
|
2385
2389
|
Ze > 0 && /* @__PURE__ */ d("div", { style: { height: Ze }, "aria-hidden": "true" })
|
|
@@ -2392,8 +2396,8 @@ function We({
|
|
|
2392
2396
|
{
|
|
2393
2397
|
type: "button",
|
|
2394
2398
|
className: "be-select-manage-options",
|
|
2395
|
-
onMouseDown: (
|
|
2396
|
-
|
|
2399
|
+
onMouseDown: (N) => {
|
|
2400
|
+
N.preventDefault(), ye(), u();
|
|
2397
2401
|
},
|
|
2398
2402
|
children: p
|
|
2399
2403
|
}
|
|
@@ -2425,15 +2429,15 @@ const pt = [
|
|
|
2425
2429
|
{ bg: "#ffe2dd", text: "#a13a2f" }
|
|
2426
2430
|
// red
|
|
2427
2431
|
];
|
|
2428
|
-
function
|
|
2432
|
+
function Et(e) {
|
|
2429
2433
|
return pt[(e % pt.length + pt.length) % pt.length];
|
|
2430
2434
|
}
|
|
2431
|
-
const
|
|
2435
|
+
const xl = { text: "Text", date: "Date", checkbox: "Checkbox", select: "Select" }, Ol = hl.map((e) => ({
|
|
2432
2436
|
value: e,
|
|
2433
|
-
label:
|
|
2434
|
-
})),
|
|
2435
|
-
function
|
|
2436
|
-
const n = K(), o =
|
|
2437
|
+
label: gl[e]
|
|
2438
|
+
})), Sl = cl.map((e) => ({ value: e, label: xl[e] })), Ct = 800;
|
|
2439
|
+
function Dl({ tableId: e, colIndex: t }) {
|
|
2440
|
+
const n = K(), o = Ll(), { openCreate: r } = bo(), l = m(
|
|
2437
2441
|
(a) => {
|
|
2438
2442
|
const s = n.getFieldType(a);
|
|
2439
2443
|
s && ht(n, e, t, s.options ?? []);
|
|
@@ -2454,8 +2458,8 @@ function Ol({ tableId: e, colIndex: t }) {
|
|
|
2454
2458
|
/* @__PURE__ */ d("button", { type: "button", className: "be-table-header-menu-item", onClick: r, children: "+ New field type" })
|
|
2455
2459
|
] });
|
|
2456
2460
|
}
|
|
2457
|
-
function
|
|
2458
|
-
const o = K(), [r, l] =
|
|
2461
|
+
function Hl({ tableId: e, colIndex: t, options: n }) {
|
|
2462
|
+
const o = K(), [r, l] = S(""), a = m(
|
|
2459
2463
|
(u, p) => {
|
|
2460
2464
|
ht(
|
|
2461
2465
|
o,
|
|
@@ -2465,7 +2469,7 @@ function Sl({ tableId: e, colIndex: t, options: n }) {
|
|
|
2465
2469
|
);
|
|
2466
2470
|
},
|
|
2467
2471
|
[o, e, t, n]
|
|
2468
|
-
), s =
|
|
2472
|
+
), s = m(
|
|
2469
2473
|
(u) => ht(
|
|
2470
2474
|
o,
|
|
2471
2475
|
e,
|
|
@@ -2473,11 +2477,11 @@ function Sl({ tableId: e, colIndex: t, options: n }) {
|
|
|
2473
2477
|
n.filter((p) => p.value !== u)
|
|
2474
2478
|
),
|
|
2475
2479
|
[o, e, t, n]
|
|
2476
|
-
), c =
|
|
2480
|
+
), c = m(() => {
|
|
2477
2481
|
const u = r.trim();
|
|
2478
2482
|
l(""), u && ht(o, e, t, [
|
|
2479
2483
|
...n,
|
|
2480
|
-
{ value: C(), label: u, color:
|
|
2484
|
+
{ value: C(), label: u, color: Et(n.length) }
|
|
2481
2485
|
]);
|
|
2482
2486
|
}, [o, e, t, n, r]);
|
|
2483
2487
|
return /* @__PURE__ */ T("div", { className: "be-table-header-menu-options", children: [
|
|
@@ -2487,7 +2491,7 @@ function Sl({ tableId: e, colIndex: t, options: n }) {
|
|
|
2487
2491
|
"span",
|
|
2488
2492
|
{
|
|
2489
2493
|
className: "be-table-header-menu-option-swatch",
|
|
2490
|
-
style: { background: (u.color ??
|
|
2494
|
+
style: { background: (u.color ?? Et(p)).bg },
|
|
2491
2495
|
"aria-hidden": "true"
|
|
2492
2496
|
}
|
|
2493
2497
|
),
|
|
@@ -2537,58 +2541,58 @@ function Sl({ tableId: e, colIndex: t, options: n }) {
|
|
|
2537
2541
|
] })
|
|
2538
2542
|
] });
|
|
2539
2543
|
}
|
|
2540
|
-
function
|
|
2541
|
-
const a = K(), s =
|
|
2542
|
-
ct(I, c,
|
|
2543
|
-
const
|
|
2544
|
-
var
|
|
2545
|
-
i(((
|
|
2546
|
-
}, []),
|
|
2547
|
-
(
|
|
2544
|
+
function Pl({ tableId: e, column: t, colIndex: n, colCount: o, filterValue: r, onFilterChange: l }) {
|
|
2545
|
+
const a = K(), s = Dt(), [c, u] = S(!1), [p, i] = S(null), [f, y] = S(null), v = _(null), g = _(null), k = _(null), I = Ge(() => [v, g], []), h = m(() => u(!1), []);
|
|
2546
|
+
ct(I, c, h), jt(g, c, h, v);
|
|
2547
|
+
const b = jo(g, c, p == null ? void 0 : p.right), B = m(() => {
|
|
2548
|
+
var M;
|
|
2549
|
+
i(((M = k.current) == null ? void 0 : M.getBoundingClientRect()) ?? null), u(!0);
|
|
2550
|
+
}, []), $ = m(
|
|
2551
|
+
(M) => Tl(a, e, n, M.target.value),
|
|
2548
2552
|
[a, e, n]
|
|
2549
|
-
), D =
|
|
2550
|
-
|
|
2551
|
-
}, [a, e, n,
|
|
2552
|
-
|
|
2553
|
-
}, [a, e, n,
|
|
2554
|
-
|
|
2555
|
-
}, [a, e, n,
|
|
2556
|
-
(
|
|
2553
|
+
), D = m(() => {
|
|
2554
|
+
tn(a, e, n - 1), h();
|
|
2555
|
+
}, [a, e, n, h]), L = m(() => {
|
|
2556
|
+
tn(a, e, n), h();
|
|
2557
|
+
}, [a, e, n, h]), x = m(() => {
|
|
2558
|
+
wl(a, e, n), h();
|
|
2559
|
+
}, [a, e, n, h]), E = m(
|
|
2560
|
+
(M) => Nl(a, e, n, M, s),
|
|
2557
2561
|
[a, e, n, s]
|
|
2558
|
-
), j =
|
|
2559
|
-
|
|
2560
|
-
}, [a, e, n, s,
|
|
2561
|
-
|
|
2562
|
-
}, [a, e, n, s,
|
|
2563
|
-
(
|
|
2562
|
+
), j = m(() => {
|
|
2563
|
+
on(a, e, n, "asc", s), h();
|
|
2564
|
+
}, [a, e, n, s, h]), w = m(() => {
|
|
2565
|
+
on(a, e, n, "desc", s), h();
|
|
2566
|
+
}, [a, e, n, s, h]), R = m(
|
|
2567
|
+
(M) => Cl(a, e, n, M),
|
|
2564
2568
|
[a, e, n]
|
|
2565
|
-
),
|
|
2566
|
-
(
|
|
2569
|
+
), O = m(
|
|
2570
|
+
(M) => {
|
|
2567
2571
|
var me;
|
|
2568
|
-
|
|
2572
|
+
M.preventDefault();
|
|
2569
2573
|
const H = (me = k.current) == null ? void 0 : me.closest("table"), Y = H == null ? void 0 : H.querySelector(`col[data-col-index="${n}"]`);
|
|
2570
2574
|
if (!Y) return;
|
|
2571
|
-
const X = k.current.getBoundingClientRect().width, pe =
|
|
2575
|
+
const X = k.current.getBoundingClientRect().width, pe = M.clientX, F = (ce) => Math.max(ze, Math.round(X + (ce.clientX - pe))), Q = (ce) => {
|
|
2572
2576
|
const Ie = F(ce);
|
|
2573
|
-
Y.style.width = `${Ie}px`,
|
|
2574
|
-
},
|
|
2575
|
-
document.removeEventListener("mousemove", Q), document.removeEventListener("mouseup",
|
|
2577
|
+
Y.style.width = `${Ie}px`, y(Ie);
|
|
2578
|
+
}, G = (ce) => {
|
|
2579
|
+
document.removeEventListener("mousemove", Q), document.removeEventListener("mouseup", G), nn(a, e, n, F(ce)), y(null);
|
|
2576
2580
|
};
|
|
2577
|
-
document.addEventListener("mousemove", Q), document.addEventListener("mouseup",
|
|
2581
|
+
document.addEventListener("mousemove", Q), document.addEventListener("mouseup", G);
|
|
2578
2582
|
},
|
|
2579
2583
|
[a, e, n]
|
|
2580
|
-
), P =
|
|
2581
|
-
(
|
|
2582
|
-
const H = t.width ?? ze, Y =
|
|
2584
|
+
), P = m(
|
|
2585
|
+
(M) => {
|
|
2586
|
+
const H = t.width ?? ze, Y = M.shiftKey ? 1 : 16;
|
|
2583
2587
|
let X;
|
|
2584
|
-
if (
|
|
2588
|
+
if (M.key === "ArrowLeft" || M.key === "ArrowDown")
|
|
2585
2589
|
X = Math.max(ze, H - Y);
|
|
2586
|
-
else if (
|
|
2590
|
+
else if (M.key === "ArrowRight" || M.key === "ArrowUp")
|
|
2587
2591
|
X = Math.min(Ct, H + Y);
|
|
2588
|
-
else if (
|
|
2589
|
-
else if (
|
|
2592
|
+
else if (M.key === "Home") X = ze;
|
|
2593
|
+
else if (M.key === "End") X = Ct;
|
|
2590
2594
|
else return;
|
|
2591
|
-
|
|
2595
|
+
M.preventDefault(), nn(a, e, n, X);
|
|
2592
2596
|
},
|
|
2593
2597
|
[a, e, n, t.width]
|
|
2594
2598
|
);
|
|
@@ -2598,7 +2602,7 @@ function Dl({ tableId: e, column: t, colIndex: n, colCount: o, filterValue: r, o
|
|
|
2598
2602
|
{
|
|
2599
2603
|
className: "be-table-header-label",
|
|
2600
2604
|
value: t.label,
|
|
2601
|
-
onChange:
|
|
2605
|
+
onChange: $,
|
|
2602
2606
|
"aria-label": `Column ${n + 1} name`
|
|
2603
2607
|
}
|
|
2604
2608
|
),
|
|
@@ -2611,7 +2615,7 @@ function Dl({ tableId: e, column: t, colIndex: n, colCount: o, filterValue: r, o
|
|
|
2611
2615
|
"aria-label": `Column ${n + 1} options`,
|
|
2612
2616
|
"aria-haspopup": "menu",
|
|
2613
2617
|
"aria-expanded": c,
|
|
2614
|
-
onClick: () => c ?
|
|
2618
|
+
onClick: () => c ? h() : B(),
|
|
2615
2619
|
children: "⋮"
|
|
2616
2620
|
}
|
|
2617
2621
|
),
|
|
@@ -2619,7 +2623,7 @@ function Dl({ tableId: e, column: t, colIndex: n, colCount: o, filterValue: r, o
|
|
|
2619
2623
|
"div",
|
|
2620
2624
|
{
|
|
2621
2625
|
className: "be-table-col-resize-handle",
|
|
2622
|
-
onMouseDown:
|
|
2626
|
+
onMouseDown: O,
|
|
2623
2627
|
onKeyDown: P,
|
|
2624
2628
|
role: "slider",
|
|
2625
2629
|
tabIndex: 0,
|
|
@@ -2629,7 +2633,7 @@ function Dl({ tableId: e, column: t, colIndex: n, colCount: o, filterValue: r, o
|
|
|
2629
2633
|
"aria-valuenow": f ?? t.width
|
|
2630
2634
|
}
|
|
2631
2635
|
),
|
|
2632
|
-
c && p &&
|
|
2636
|
+
c && p && b != null && He(
|
|
2633
2637
|
/* @__PURE__ */ T(
|
|
2634
2638
|
"div",
|
|
2635
2639
|
{
|
|
@@ -2640,7 +2644,7 @@ function Dl({ tableId: e, column: t, colIndex: n, colCount: o, filterValue: r, o
|
|
|
2640
2644
|
style: {
|
|
2641
2645
|
position: "fixed",
|
|
2642
2646
|
top: p.bottom + 4,
|
|
2643
|
-
left:
|
|
2647
|
+
left: b,
|
|
2644
2648
|
transform: "translateX(-100%)"
|
|
2645
2649
|
},
|
|
2646
2650
|
children: [
|
|
@@ -2650,7 +2654,7 @@ function Dl({ tableId: e, column: t, colIndex: n, colCount: o, filterValue: r, o
|
|
|
2650
2654
|
We,
|
|
2651
2655
|
{
|
|
2652
2656
|
value: t.type,
|
|
2653
|
-
options:
|
|
2657
|
+
options: Sl,
|
|
2654
2658
|
onChange: E,
|
|
2655
2659
|
ariaLabel: "Column type",
|
|
2656
2660
|
className: ""
|
|
@@ -2658,9 +2662,9 @@ function Dl({ tableId: e, column: t, colIndex: n, colCount: o, filterValue: r, o
|
|
|
2658
2662
|
)
|
|
2659
2663
|
] }),
|
|
2660
2664
|
t.type === "select" && /* @__PURE__ */ T(Te, { children: [
|
|
2661
|
-
/* @__PURE__ */ d(
|
|
2665
|
+
/* @__PURE__ */ d(Dl, { tableId: e, colIndex: n }),
|
|
2662
2666
|
/* @__PURE__ */ d(
|
|
2663
|
-
|
|
2667
|
+
Hl,
|
|
2664
2668
|
{
|
|
2665
2669
|
tableId: e,
|
|
2666
2670
|
colIndex: n,
|
|
@@ -2677,7 +2681,7 @@ function Dl({ tableId: e, column: t, colIndex: n, colCount: o, filterValue: r, o
|
|
|
2677
2681
|
className: "be-table-header-menu-item",
|
|
2678
2682
|
onClick: j,
|
|
2679
2683
|
children: [
|
|
2680
|
-
/* @__PURE__ */ d(
|
|
2684
|
+
/* @__PURE__ */ d(Cn, { size: 13 }),
|
|
2681
2685
|
" Sort ascending"
|
|
2682
2686
|
]
|
|
2683
2687
|
}
|
|
@@ -2690,7 +2694,7 @@ function Dl({ tableId: e, column: t, colIndex: n, colCount: o, filterValue: r, o
|
|
|
2690
2694
|
className: "be-table-header-menu-item",
|
|
2691
2695
|
onClick: w,
|
|
2692
2696
|
children: [
|
|
2693
|
-
/* @__PURE__ */ d(
|
|
2697
|
+
/* @__PURE__ */ d(Bn, { size: 13 }),
|
|
2694
2698
|
" Sort descending"
|
|
2695
2699
|
]
|
|
2696
2700
|
}
|
|
@@ -2705,7 +2709,7 @@ function Dl({ tableId: e, column: t, colIndex: n, colCount: o, filterValue: r, o
|
|
|
2705
2709
|
className: "be-table-header-menu-filter-input",
|
|
2706
2710
|
placeholder: "Rows containing…",
|
|
2707
2711
|
value: r ?? "",
|
|
2708
|
-
onChange: (
|
|
2712
|
+
onChange: (M) => l(t.id, M.target.value),
|
|
2709
2713
|
"aria-label": `Filter column ${n + 1}`
|
|
2710
2714
|
}
|
|
2711
2715
|
)
|
|
@@ -2716,8 +2720,8 @@ function Dl({ tableId: e, column: t, colIndex: n, colCount: o, filterValue: r, o
|
|
|
2716
2720
|
We,
|
|
2717
2721
|
{
|
|
2718
2722
|
value: t.aggregate ?? "none",
|
|
2719
|
-
options:
|
|
2720
|
-
onChange:
|
|
2723
|
+
options: Ol,
|
|
2724
|
+
onChange: R,
|
|
2721
2725
|
ariaLabel: "Column footer aggregate",
|
|
2722
2726
|
className: ""
|
|
2723
2727
|
}
|
|
@@ -2749,7 +2753,7 @@ function Dl({ tableId: e, column: t, colIndex: n, colCount: o, filterValue: r, o
|
|
|
2749
2753
|
type: "button",
|
|
2750
2754
|
role: "menuitem",
|
|
2751
2755
|
className: "be-table-header-menu-item be-table-header-menu-item-danger",
|
|
2752
|
-
onClick:
|
|
2756
|
+
onClick: x,
|
|
2753
2757
|
disabled: o <= 1,
|
|
2754
2758
|
children: "Delete column"
|
|
2755
2759
|
}
|
|
@@ -2761,10 +2765,10 @@ function Dl({ tableId: e, column: t, colIndex: n, colCount: o, filterValue: r, o
|
|
|
2761
2765
|
)
|
|
2762
2766
|
] });
|
|
2763
2767
|
}
|
|
2764
|
-
function
|
|
2768
|
+
function _l({ tableId: e, columns: t, filters: n, onFilterChange: o }) {
|
|
2765
2769
|
return /* @__PURE__ */ d("thead", { children: /* @__PURE__ */ T("tr", { className: "be-table-header-row", children: [
|
|
2766
2770
|
t.map((r, l) => /* @__PURE__ */ d(
|
|
2767
|
-
|
|
2771
|
+
Pl,
|
|
2768
2772
|
{
|
|
2769
2773
|
tableId: e,
|
|
2770
2774
|
column: r,
|
|
@@ -2778,28 +2782,28 @@ function Hl({ tableId: e, columns: t, filters: n, onFilterChange: o }) {
|
|
|
2778
2782
|
/* @__PURE__ */ d("th", { className: "be-table-header-spacer", "aria-hidden": "true" })
|
|
2779
2783
|
] }) });
|
|
2780
2784
|
}
|
|
2781
|
-
function
|
|
2785
|
+
function Ul({ id: e }) {
|
|
2782
2786
|
var g;
|
|
2783
|
-
const t = K(), n =
|
|
2787
|
+
const t = K(), n = Dt(), o = te(e), [r, l] = S({}), a = m((k, I) => {
|
|
2784
2788
|
l(
|
|
2785
|
-
(
|
|
2789
|
+
(h) => I ? { ...h, [k]: I } : Object.fromEntries(Object.entries(h).filter(([b]) => b !== k))
|
|
2786
2790
|
);
|
|
2787
|
-
}, []), s =
|
|
2791
|
+
}, []), s = m(() => {
|
|
2788
2792
|
var I;
|
|
2789
2793
|
const k = (I = o == null ? void 0 : o.contentIds) == null ? void 0 : I[o.contentIds.length - 1];
|
|
2790
|
-
k &&
|
|
2791
|
-
}, [t, o]), c = se("be-table-wrapper", o), u =
|
|
2794
|
+
k && vl(t, k);
|
|
2795
|
+
}, [t, o]), c = se("be-table-wrapper", o), u = Ge(() => Object.entries(r).filter(([, k]) => k), [r]), p = m(
|
|
2792
2796
|
(k, I) => {
|
|
2793
|
-
const
|
|
2794
|
-
return
|
|
2797
|
+
const h = t.getBlock(k), b = h && t.getBlock(h.contentIds[I]);
|
|
2798
|
+
return b ? t.getRun(b.contentIds[0]) : null;
|
|
2795
2799
|
},
|
|
2796
2800
|
[t]
|
|
2797
2801
|
);
|
|
2798
2802
|
if (!o) return null;
|
|
2799
|
-
const i = t.getBlock(o.contentIds[0]), f = fe(o, ((g = i == null ? void 0 : i.contentIds) == null ? void 0 : g.length) ?? 0),
|
|
2800
|
-
(k) => u.every(([I,
|
|
2801
|
-
const
|
|
2802
|
-
return
|
|
2803
|
+
const i = t.getBlock(o.contentIds[0]), f = fe(o, ((g = i == null ? void 0 : i.contentIds) == null ? void 0 : g.length) ?? 0), y = u.length === 0 ? o.contentIds : o.contentIds.filter(
|
|
2804
|
+
(k) => u.every(([I, h]) => {
|
|
2805
|
+
const b = f.findIndex(($) => $.id === I);
|
|
2806
|
+
return b === -1 ? !0 : st(p(k, b), n).toLowerCase().includes(h.toLowerCase());
|
|
2803
2807
|
})
|
|
2804
2808
|
), v = f.some((k) => k.aggregate && k.aggregate !== "none");
|
|
2805
2809
|
return (
|
|
@@ -2820,7 +2824,7 @@ function Pl({ id: e }) {
|
|
|
2820
2824
|
/* @__PURE__ */ d("col", { className: "be-table-header-spacer-col" })
|
|
2821
2825
|
] }),
|
|
2822
2826
|
/* @__PURE__ */ d(
|
|
2823
|
-
|
|
2827
|
+
_l,
|
|
2824
2828
|
{
|
|
2825
2829
|
tableId: e,
|
|
2826
2830
|
columns: f,
|
|
@@ -2828,18 +2832,18 @@ function Pl({ id: e }) {
|
|
|
2828
2832
|
onFilterChange: a
|
|
2829
2833
|
}
|
|
2830
2834
|
),
|
|
2831
|
-
/* @__PURE__ */ d("tbody", { children: /* @__PURE__ */ d(Ue, { parentId: e, filterIds:
|
|
2835
|
+
/* @__PURE__ */ d("tbody", { children: /* @__PURE__ */ d(Ue, { parentId: e, filterIds: y }) }),
|
|
2832
2836
|
v && /* @__PURE__ */ d("tfoot", { children: /* @__PURE__ */ T("tr", { className: "be-table-footer-row", children: [
|
|
2833
2837
|
f.map((k, I) => {
|
|
2834
|
-
const
|
|
2835
|
-
|
|
2838
|
+
const h = y.map((B) => p(B, I)), b = yl(
|
|
2839
|
+
h,
|
|
2836
2840
|
k.type,
|
|
2837
2841
|
k.aggregate,
|
|
2838
2842
|
n
|
|
2839
2843
|
);
|
|
2840
|
-
return /* @__PURE__ */ d("td", { className: "be-table-footer-cell", children:
|
|
2841
|
-
/* @__PURE__ */ d("span", { className: "be-table-footer-label", children:
|
|
2842
|
-
|
|
2844
|
+
return /* @__PURE__ */ d("td", { className: "be-table-footer-cell", children: b != null && /* @__PURE__ */ T(Te, { children: [
|
|
2845
|
+
/* @__PURE__ */ d("span", { className: "be-table-footer-label", children: bl[k.aggregate] }),
|
|
2846
|
+
kl(b)
|
|
2843
2847
|
] }) }, k.id);
|
|
2844
2848
|
}),
|
|
2845
2849
|
/* @__PURE__ */ d("td", { className: "be-table-footer-spacer", "aria-hidden": "true" })
|
|
@@ -2853,7 +2857,7 @@ function Pl({ id: e }) {
|
|
|
2853
2857
|
contentEditable: !1,
|
|
2854
2858
|
onClick: s,
|
|
2855
2859
|
children: [
|
|
2856
|
-
/* @__PURE__ */ d(
|
|
2860
|
+
/* @__PURE__ */ d(Tn, { size: 14 }),
|
|
2857
2861
|
" Add row"
|
|
2858
2862
|
]
|
|
2859
2863
|
}
|
|
@@ -2861,8 +2865,8 @@ function Pl({ id: e }) {
|
|
|
2861
2865
|
] }) })
|
|
2862
2866
|
);
|
|
2863
2867
|
}
|
|
2864
|
-
function
|
|
2865
|
-
const t = K(), n = te(e), o = se("be-table-row", n), r =
|
|
2868
|
+
function jl({ id: e }) {
|
|
2869
|
+
const t = K(), n = te(e), o = se("be-table-row", n), r = m(() => Il(t, e), [t, e]);
|
|
2866
2870
|
return /* @__PURE__ */ T("tr", { className: o, "data-block-id": e, children: [
|
|
2867
2871
|
/* @__PURE__ */ d(Ue, { parentId: e }),
|
|
2868
2872
|
/* @__PURE__ */ d("td", { className: "be-table-row-actions", contentEditable: !1, children: /* @__PURE__ */ d(
|
|
@@ -2878,7 +2882,7 @@ function _l({ id: e }) {
|
|
|
2878
2882
|
) })
|
|
2879
2883
|
] });
|
|
2880
2884
|
}
|
|
2881
|
-
function
|
|
2885
|
+
function Vn(e, t) {
|
|
2882
2886
|
const n = e.getBlock(t), o = e.getBlock(n.parentId), r = e.getBlock(o.parentId);
|
|
2883
2887
|
return {
|
|
2884
2888
|
table: r,
|
|
@@ -2887,24 +2891,24 @@ function Gn(e, t) {
|
|
|
2887
2891
|
colIndex: o.contentIds.indexOf(t)
|
|
2888
2892
|
};
|
|
2889
2893
|
}
|
|
2890
|
-
function
|
|
2891
|
-
const { table: o, row: r, rowIndex: l, colIndex: a } =
|
|
2894
|
+
function Fl(e, t, n) {
|
|
2895
|
+
const { table: o, row: r, rowIndex: l, colIndex: a } = Vn(e, t);
|
|
2892
2896
|
if (n === "left" || n === "right") {
|
|
2893
2897
|
const p = n === "right" ? 1 : -1, i = a + p;
|
|
2894
2898
|
if (i >= 0 && i < r.contentIds.length)
|
|
2895
2899
|
return r.contentIds[i];
|
|
2896
2900
|
const f = l + p;
|
|
2897
2901
|
if (f < 0 || f >= o.contentIds.length) return null;
|
|
2898
|
-
const
|
|
2899
|
-
return
|
|
2902
|
+
const y = e.getBlock(o.contentIds[f]), v = n === "right" ? 0 : y.contentIds.length - 1;
|
|
2903
|
+
return y.contentIds[v];
|
|
2900
2904
|
}
|
|
2901
2905
|
const c = l + (n === "down" ? 1 : -1);
|
|
2902
2906
|
if (c < 0 || c >= o.contentIds.length) return null;
|
|
2903
2907
|
const u = e.getBlock(o.contentIds[c]);
|
|
2904
2908
|
return u.contentIds[a] ?? u.contentIds[u.contentIds.length - 1] ?? null;
|
|
2905
2909
|
}
|
|
2906
|
-
function
|
|
2907
|
-
const n =
|
|
2910
|
+
function Kl(e, t) {
|
|
2911
|
+
const n = So(e, t, "down");
|
|
2908
2912
|
if (n) {
|
|
2909
2913
|
ve(n);
|
|
2910
2914
|
return;
|
|
@@ -2913,19 +2917,19 @@ function jl(e, t) {
|
|
|
2913
2917
|
}
|
|
2914
2918
|
function ot(e, t, n) {
|
|
2915
2919
|
var r;
|
|
2916
|
-
const o =
|
|
2920
|
+
const o = Fl(e, t, n);
|
|
2917
2921
|
if (o) {
|
|
2918
2922
|
const l = e.getBlock(o), a = (r = l == null ? void 0 : l.contentIds) == null ? void 0 : r[0];
|
|
2919
2923
|
a && ve(a);
|
|
2920
2924
|
return;
|
|
2921
2925
|
}
|
|
2922
2926
|
if (n === "right") {
|
|
2923
|
-
const { table: l } =
|
|
2924
|
-
|
|
2927
|
+
const { table: l } = Vn(e, t);
|
|
2928
|
+
Kl(e, l.id);
|
|
2925
2929
|
}
|
|
2926
2930
|
}
|
|
2927
|
-
function
|
|
2928
|
-
const t = K(), n = te(e), o =
|
|
2931
|
+
function zl({ id: e }) {
|
|
2932
|
+
const t = K(), n = te(e), o = m(() => ot(t, e, "right"), [t, e]), r = m(() => ot(t, e, "left"), [t, e]), l = m(() => ot(t, e, "up"), [t, e]), a = m(() => ot(t, e, "down"), [t, e]), s = m(() => ot(t, e, "down"), [t, e]), c = se("be-table-cell", n);
|
|
2929
2933
|
if (!n) return null;
|
|
2930
2934
|
const u = Ce(t, n);
|
|
2931
2935
|
return /* @__PURE__ */ d("td", { className: c, "data-block-id": e, dir: u, children: /* @__PURE__ */ d(
|
|
@@ -2942,10 +2946,10 @@ function Fl({ id: e }) {
|
|
|
2942
2946
|
}
|
|
2943
2947
|
) });
|
|
2944
2948
|
}
|
|
2945
|
-
function
|
|
2949
|
+
function Vl(e, t) {
|
|
2946
2950
|
const n = C(), o = [], r = [], l = [];
|
|
2947
2951
|
for (const a of t) {
|
|
2948
|
-
const s =
|
|
2952
|
+
const s = Kt(n, a);
|
|
2949
2953
|
o.push(s.block), r.push(s.run), l.push(s.block.id);
|
|
2950
2954
|
}
|
|
2951
2955
|
return {
|
|
@@ -2954,29 +2958,29 @@ function Kl(e, t) {
|
|
|
2954
2958
|
runs: r
|
|
2955
2959
|
};
|
|
2956
2960
|
}
|
|
2957
|
-
function
|
|
2961
|
+
function Gl({ rows: e = 2, cols: t = 2 } = {}) {
|
|
2958
2962
|
return function(o) {
|
|
2959
2963
|
const r = C(), l = Kn(t), a = [], s = [], c = [];
|
|
2960
2964
|
for (let p = 0; p < e; p += 1) {
|
|
2961
|
-
const i =
|
|
2965
|
+
const i = Vl(r, l);
|
|
2962
2966
|
a.push(i.block, ...i.blocks), s.push(...i.runs), c.push(i.block.id);
|
|
2963
2967
|
}
|
|
2964
2968
|
return { block: { id: r, type: "table", parentId: o, contentIds: c, props: { columns: l } }, runs: s, subtreeBlocks: a };
|
|
2965
2969
|
};
|
|
2966
2970
|
}
|
|
2967
|
-
function
|
|
2968
|
-
return `<td>${e.contentIds.map((o) => t.store.getRun(o)).map((o) =>
|
|
2971
|
+
function Wl(e, t) {
|
|
2972
|
+
return `<td>${e.contentIds.map((o) => t.store.getRun(o)).map((o) => Me(o, t)).join("")}</td>`;
|
|
2969
2973
|
}
|
|
2970
|
-
function
|
|
2971
|
-
return e.contentIds.map((n) =>
|
|
2974
|
+
function ql(e, t) {
|
|
2975
|
+
return e.contentIds.map((n) => Ae(t.store.getRun(n), t)).join("");
|
|
2972
2976
|
}
|
|
2973
|
-
function
|
|
2977
|
+
function Yl(e, t) {
|
|
2974
2978
|
return De(
|
|
2975
2979
|
e.contentIds.map((o) => t.store.getRun(o)),
|
|
2976
2980
|
t
|
|
2977
2981
|
).replace(/\|/g, "\\|").replace(/\r?\n/g, "<br>");
|
|
2978
2982
|
}
|
|
2979
|
-
function
|
|
2983
|
+
function Xl(e, t) {
|
|
2980
2984
|
if (e.tagName !== "TD" && e.tagName !== "TH") return null;
|
|
2981
2985
|
const n = Le(e, t);
|
|
2982
2986
|
return { block: {
|
|
@@ -2987,25 +2991,25 @@ function ql(e, t) {
|
|
|
2987
2991
|
props: {}
|
|
2988
2992
|
}, runs: n };
|
|
2989
2993
|
}
|
|
2990
|
-
function
|
|
2994
|
+
function Ql(e, t) {
|
|
2991
2995
|
return `<tr>${e.contentIds.map((o) => {
|
|
2992
2996
|
const r = t.store.getBlock(o);
|
|
2993
2997
|
return t.registry.get(r.type).toHTML(r, t);
|
|
2994
2998
|
}).join("")}</tr>`;
|
|
2995
2999
|
}
|
|
2996
|
-
function
|
|
3000
|
+
function Jl(e, t) {
|
|
2997
3001
|
return e.contentIds.map((n) => {
|
|
2998
3002
|
const o = t.store.getBlock(n);
|
|
2999
3003
|
return t.registry.get(o.type).toPlainText(o, t);
|
|
3000
3004
|
}).join(" ");
|
|
3001
3005
|
}
|
|
3002
|
-
function
|
|
3006
|
+
function Zl(e, t) {
|
|
3003
3007
|
return `| ${e.contentIds.map((o) => {
|
|
3004
3008
|
const r = t.store.getBlock(o);
|
|
3005
3009
|
return t.registry.get(r.type).toMarkdown(r, t);
|
|
3006
3010
|
}).join(" | ")} |`;
|
|
3007
3011
|
}
|
|
3008
|
-
function
|
|
3012
|
+
function ea(e, t) {
|
|
3009
3013
|
if (e.tagName !== "TR") return null;
|
|
3010
3014
|
const n = [...e.children].filter((c) => c.tagName === "TD" || c.tagName === "TH"), o = C(), r = [], l = [], a = [];
|
|
3011
3015
|
for (const c of n) {
|
|
@@ -3014,7 +3018,7 @@ function Jl(e, t) {
|
|
|
3014
3018
|
}
|
|
3015
3019
|
return { block: { id: o, type: "tableRow", parentId: null, contentIds: a, props: {} }, runs: l, subtreeBlocks: r };
|
|
3016
3020
|
}
|
|
3017
|
-
function
|
|
3021
|
+
function ta(e, t) {
|
|
3018
3022
|
var a;
|
|
3019
3023
|
const n = e.contentIds[0] && t.store.getBlock(e.contentIds[0]), o = fe(e, ((a = n == null ? void 0 : n.contentIds) == null ? void 0 : a.length) ?? 0), r = o.length ? `<thead><tr>${o.map((s) => `<th>${gt(s.label ?? "")}</th>`).join("")}</tr></thead>` : "", l = e.contentIds.map((s) => {
|
|
3020
3024
|
const c = t.store.getBlock(s);
|
|
@@ -3022,14 +3026,14 @@ function Zl(e, t) {
|
|
|
3022
3026
|
}).join("");
|
|
3023
3027
|
return `<table>${r}<tbody>${l}</tbody></table>`;
|
|
3024
3028
|
}
|
|
3025
|
-
function
|
|
3029
|
+
function na(e, t) {
|
|
3026
3030
|
return e.contentIds.map((n) => {
|
|
3027
3031
|
const o = t.store.getBlock(n);
|
|
3028
3032
|
return t.registry.get(o.type).toPlainText(o, t);
|
|
3029
3033
|
}).join(`
|
|
3030
3034
|
`);
|
|
3031
3035
|
}
|
|
3032
|
-
function
|
|
3036
|
+
function oa(e, t) {
|
|
3033
3037
|
var s;
|
|
3034
3038
|
const n = e.contentIds[0] && t.store.getBlock(e.contentIds[0]), o = fe(e, ((s = n == null ? void 0 : n.contentIds) == null ? void 0 : s.length) ?? 0);
|
|
3035
3039
|
if (o.length === 0) return "";
|
|
@@ -3043,7 +3047,7 @@ ${l}
|
|
|
3043
3047
|
${a}` : `${r}
|
|
3044
3048
|
${l}`;
|
|
3045
3049
|
}
|
|
3046
|
-
function
|
|
3050
|
+
function ra(e, t) {
|
|
3047
3051
|
if (e.tagName !== "TABLE") return null;
|
|
3048
3052
|
const n = e.querySelector("thead tr"), o = e.querySelector("tbody") ? [...e.querySelectorAll("tbody tr")] : [...e.querySelectorAll("tr")].filter((p) => p !== n), r = C(), l = [], a = [], s = [];
|
|
3049
3053
|
for (const p of o) {
|
|
@@ -3063,49 +3067,49 @@ function na(e, t) {
|
|
|
3063
3067
|
}
|
|
3064
3068
|
return { block: { id: r, type: "table", parentId: null, contentIds: s, props: c }, runs: a, subtreeBlocks: l };
|
|
3065
3069
|
}
|
|
3066
|
-
const
|
|
3070
|
+
const la = ae({
|
|
3067
3071
|
name: "tableCell",
|
|
3068
3072
|
contentModel: "runs",
|
|
3069
|
-
component:
|
|
3073
|
+
component: zl,
|
|
3070
3074
|
defaultProps: {},
|
|
3071
|
-
toHTML:
|
|
3072
|
-
toPlainText:
|
|
3073
|
-
toMarkdown:
|
|
3074
|
-
fromHTML:
|
|
3075
|
-
}),
|
|
3075
|
+
toHTML: Wl,
|
|
3076
|
+
toPlainText: ql,
|
|
3077
|
+
toMarkdown: Yl,
|
|
3078
|
+
fromHTML: Xl
|
|
3079
|
+
}), aa = ae({
|
|
3076
3080
|
name: "tableRow",
|
|
3077
3081
|
contentModel: "blocks",
|
|
3078
|
-
component:
|
|
3082
|
+
component: jl,
|
|
3079
3083
|
defaultProps: {},
|
|
3080
|
-
toHTML:
|
|
3081
|
-
toPlainText:
|
|
3082
|
-
toMarkdown:
|
|
3083
|
-
fromHTML:
|
|
3084
|
-
}),
|
|
3084
|
+
toHTML: Ql,
|
|
3085
|
+
toPlainText: Jl,
|
|
3086
|
+
toMarkdown: Zl,
|
|
3087
|
+
fromHTML: ea
|
|
3088
|
+
}), sa = ae({
|
|
3085
3089
|
name: "table",
|
|
3086
3090
|
contentModel: "blocks",
|
|
3087
|
-
component:
|
|
3091
|
+
component: Ul,
|
|
3088
3092
|
defaultProps: {},
|
|
3089
|
-
toHTML:
|
|
3090
|
-
toPlainText:
|
|
3091
|
-
toMarkdown:
|
|
3092
|
-
fromHTML:
|
|
3093
|
+
toHTML: ta,
|
|
3094
|
+
toPlainText: na,
|
|
3095
|
+
toMarkdown: oa,
|
|
3096
|
+
fromHTML: ra,
|
|
3093
3097
|
slashCommand: {
|
|
3094
3098
|
label: "Table",
|
|
3095
3099
|
icon: yo,
|
|
3096
3100
|
keywords: ["table", "grid"],
|
|
3097
|
-
run: (e, t) => re(e, t,
|
|
3101
|
+
run: (e, t) => re(e, t, Gl({ rows: 2, cols: 2 }))
|
|
3098
3102
|
}
|
|
3099
3103
|
});
|
|
3100
|
-
function
|
|
3104
|
+
function ca({ id: e }) {
|
|
3101
3105
|
const t = te(e), n = se("be-layout", t);
|
|
3102
3106
|
return /* @__PURE__ */ d("div", { className: n, "data-block-id": e, style: { display: "flex", gap: "1em" }, children: /* @__PURE__ */ d(Ue, { parentId: e }) });
|
|
3103
3107
|
}
|
|
3104
|
-
function
|
|
3108
|
+
function ia({ id: e }) {
|
|
3105
3109
|
const t = te(e), n = se("be-layout-column", t);
|
|
3106
3110
|
return /* @__PURE__ */ d("div", { className: n, "data-block-id": e, children: /* @__PURE__ */ d(Ue, { parentId: e }) });
|
|
3107
3111
|
}
|
|
3108
|
-
function
|
|
3112
|
+
function ua({ columns: e = 2 } = {}) {
|
|
3109
3113
|
return function(n) {
|
|
3110
3114
|
const o = C(), r = [], l = [], a = [];
|
|
3111
3115
|
for (let c = 0; c < e; c += 1) {
|
|
@@ -3121,7 +3125,7 @@ function ca({ columns: e = 2 } = {}) {
|
|
|
3121
3125
|
return { block: { id: o, type: "layout", parentId: n, contentIds: a, props: {} }, runs: l, subtreeBlocks: r };
|
|
3122
3126
|
};
|
|
3123
3127
|
}
|
|
3124
|
-
function
|
|
3128
|
+
function Gn(e, t) {
|
|
3125
3129
|
return (n, o) => `${e}${n.contentIds.map((r) => {
|
|
3126
3130
|
const l = o.store.getBlock(r);
|
|
3127
3131
|
return o.registry.get(l.type).toHTML(l, o);
|
|
@@ -3142,37 +3146,37 @@ function qn(e, t) {
|
|
|
3142
3146
|
|
|
3143
3147
|
`);
|
|
3144
3148
|
}
|
|
3145
|
-
const
|
|
3149
|
+
const da = ae({
|
|
3146
3150
|
name: "layoutColumn",
|
|
3147
3151
|
contentModel: "blocks",
|
|
3148
|
-
component:
|
|
3152
|
+
component: ia,
|
|
3149
3153
|
defaultProps: {},
|
|
3150
|
-
toHTML:
|
|
3154
|
+
toHTML: Gn("<div>", "</div>"),
|
|
3151
3155
|
toPlainText: Wn,
|
|
3152
3156
|
toMarkdown: qn
|
|
3153
3157
|
// no fromHTML: a bare column has no distinct HTML representation of its
|
|
3154
3158
|
// own outside a parent `layout`'s markup; layout.fromHTML would construct
|
|
3155
3159
|
// both together if/when generic multi-column HTML import is added.
|
|
3156
|
-
}),
|
|
3160
|
+
}), pa = ae({
|
|
3157
3161
|
name: "layout",
|
|
3158
3162
|
contentModel: "blocks",
|
|
3159
|
-
component:
|
|
3163
|
+
component: ca,
|
|
3160
3164
|
defaultProps: {},
|
|
3161
|
-
toHTML:
|
|
3165
|
+
toHTML: Gn('<div style="display:flex;gap:1em">', "</div>"),
|
|
3162
3166
|
toPlainText: Wn,
|
|
3163
3167
|
toMarkdown: qn,
|
|
3164
3168
|
slashCommands: [2, 3, 4, 5].map((e) => ({
|
|
3165
3169
|
label: `${e} columns`,
|
|
3166
3170
|
icon: ko,
|
|
3167
3171
|
keywords: ["layout", "columns", "column", String(e)],
|
|
3168
|
-
run: (t, n) => re(t, n,
|
|
3172
|
+
run: (t, n) => re(t, n, ua({ columns: e }))
|
|
3169
3173
|
}))
|
|
3170
3174
|
});
|
|
3171
|
-
function
|
|
3175
|
+
function fa({ id: e }) {
|
|
3172
3176
|
const t = te(e), n = se("be-divider", t);
|
|
3173
3177
|
return /* @__PURE__ */ d("hr", { className: n, "data-block-id": e, contentEditable: !1, tabIndex: -1 });
|
|
3174
3178
|
}
|
|
3175
|
-
function
|
|
3179
|
+
function ma() {
|
|
3176
3180
|
return function(t) {
|
|
3177
3181
|
return {
|
|
3178
3182
|
block: { id: C(), type: "divider", parentId: t, contentIds: [], props: {} },
|
|
@@ -3180,30 +3184,30 @@ function pa() {
|
|
|
3180
3184
|
};
|
|
3181
3185
|
};
|
|
3182
3186
|
}
|
|
3183
|
-
function
|
|
3187
|
+
function ha() {
|
|
3184
3188
|
return "<hr />";
|
|
3185
3189
|
}
|
|
3186
|
-
function
|
|
3190
|
+
function ga() {
|
|
3187
3191
|
return "---";
|
|
3188
3192
|
}
|
|
3189
|
-
function
|
|
3193
|
+
function ba() {
|
|
3190
3194
|
return "---";
|
|
3191
3195
|
}
|
|
3192
|
-
function
|
|
3196
|
+
function ya(e) {
|
|
3193
3197
|
return e.tagName !== "HR" ? null : {
|
|
3194
3198
|
block: { id: C(), type: "divider", parentId: null, contentIds: [], props: {} },
|
|
3195
3199
|
runs: []
|
|
3196
3200
|
};
|
|
3197
3201
|
}
|
|
3198
|
-
const
|
|
3202
|
+
const ka = ae({
|
|
3199
3203
|
name: "divider",
|
|
3200
3204
|
contentModel: "void",
|
|
3201
|
-
component:
|
|
3205
|
+
component: fa,
|
|
3202
3206
|
defaultProps: {},
|
|
3203
|
-
toHTML:
|
|
3204
|
-
toPlainText:
|
|
3205
|
-
toMarkdown:
|
|
3206
|
-
fromHTML:
|
|
3207
|
+
toHTML: ha,
|
|
3208
|
+
toPlainText: ga,
|
|
3209
|
+
toMarkdown: ba,
|
|
3210
|
+
fromHTML: ya,
|
|
3207
3211
|
slashCommand: {
|
|
3208
3212
|
label: "Divider",
|
|
3209
3213
|
icon: vo,
|
|
@@ -3213,11 +3217,11 @@ const ba = ae({
|
|
|
3213
3217
|
e.applyOperation(
|
|
3214
3218
|
de(n, { value: a.slice(0, o) + a.slice(r) })
|
|
3215
3219
|
);
|
|
3216
|
-
const s = xn(e, t,
|
|
3220
|
+
const s = xn(e, t, ma());
|
|
3217
3221
|
return Ye(e, s, U("paragraph")), s;
|
|
3218
3222
|
}
|
|
3219
3223
|
}
|
|
3220
|
-
}),
|
|
3224
|
+
}), va = [
|
|
3221
3225
|
{ value: "gray", label: "Gray" },
|
|
3222
3226
|
{ value: "blue", label: "Blue" },
|
|
3223
3227
|
{ value: "green", label: "Green" },
|
|
@@ -3227,21 +3231,21 @@ const ba = ae({
|
|
|
3227
3231
|
{ value: "purple", label: "Purple" },
|
|
3228
3232
|
{ value: "pink", label: "Pink" }
|
|
3229
3233
|
];
|
|
3230
|
-
function
|
|
3231
|
-
var I,
|
|
3232
|
-
const t = K(), n = te(e), [o, r] =
|
|
3234
|
+
function Ia({ id: e }) {
|
|
3235
|
+
var I, h;
|
|
3236
|
+
const t = K(), n = te(e), [o, r] = S(!1), [l, a] = S(!1), s = _(null), c = _(null), u = Ge(() => [s, c], []), p = m(() => a(!1), []);
|
|
3233
3237
|
ct(u, l, p);
|
|
3234
|
-
const i = ((I = n == null ? void 0 : n.props) == null ? void 0 : I.icon) ?? _e, f = ((
|
|
3235
|
-
(
|
|
3236
|
-
const B =
|
|
3237
|
-
B && t.applyOperation(
|
|
3238
|
+
const i = ((I = n == null ? void 0 : n.props) == null ? void 0 : I.icon) ?? _e, f = ((h = n == null ? void 0 : n.props) == null ? void 0 : h.color) ?? Pn, y = m(
|
|
3239
|
+
(b) => {
|
|
3240
|
+
const B = b.target.value.trim();
|
|
3241
|
+
B && t.applyOperation(V(e, { icon: B })), r(!1);
|
|
3238
3242
|
},
|
|
3239
3243
|
[t, e]
|
|
3240
|
-
), v =
|
|
3241
|
-
|
|
3242
|
-
}, []), g =
|
|
3243
|
-
(
|
|
3244
|
-
t.applyOperation(
|
|
3244
|
+
), v = m((b) => {
|
|
3245
|
+
b.key === "Enter" && b.currentTarget.blur(), b.key === "Escape" && r(!1);
|
|
3246
|
+
}, []), g = m(
|
|
3247
|
+
(b) => {
|
|
3248
|
+
t.applyOperation(V(e, { color: b })), a(!1);
|
|
3245
3249
|
},
|
|
3246
3250
|
[t, e]
|
|
3247
3251
|
), k = se("be-callout", n);
|
|
@@ -3253,7 +3257,7 @@ function ka({ id: e }) {
|
|
|
3253
3257
|
className: "be-callout-icon-input",
|
|
3254
3258
|
defaultValue: i,
|
|
3255
3259
|
autoFocus: !0,
|
|
3256
|
-
onBlur:
|
|
3260
|
+
onBlur: y,
|
|
3257
3261
|
onKeyDown: v,
|
|
3258
3262
|
"aria-label": "Callout icon (paste or type an emoji)"
|
|
3259
3263
|
}
|
|
@@ -3280,7 +3284,7 @@ function ka({ id: e }) {
|
|
|
3280
3284
|
"aria-haspopup": "true",
|
|
3281
3285
|
"aria-expanded": l,
|
|
3282
3286
|
title: "Callout color",
|
|
3283
|
-
onClick: () => a((
|
|
3287
|
+
onClick: () => a((b) => !b),
|
|
3284
3288
|
children: /* @__PURE__ */ d("span", { className: `be-callout-color-dot be-callout-color-dot-${f}` })
|
|
3285
3289
|
}
|
|
3286
3290
|
),
|
|
@@ -3291,35 +3295,35 @@ function ka({ id: e }) {
|
|
|
3291
3295
|
className: "be-callout-color-picker",
|
|
3292
3296
|
role: "menu",
|
|
3293
3297
|
"aria-label": "Callout color",
|
|
3294
|
-
children:
|
|
3298
|
+
children: va.map((b) => /* @__PURE__ */ d(
|
|
3295
3299
|
"button",
|
|
3296
3300
|
{
|
|
3297
3301
|
type: "button",
|
|
3298
3302
|
role: "menuitem",
|
|
3299
|
-
className: `be-callout-color-option be-callout-color-option-${
|
|
3300
|
-
title:
|
|
3301
|
-
"aria-label":
|
|
3302
|
-
onClick: () => g(
|
|
3303
|
+
className: `be-callout-color-option be-callout-color-option-${b.value}${b.value === f ? " be-callout-color-option-active" : ""}`,
|
|
3304
|
+
title: b.label,
|
|
3305
|
+
"aria-label": b.label,
|
|
3306
|
+
onClick: () => g(b.value)
|
|
3303
3307
|
},
|
|
3304
|
-
|
|
3308
|
+
b.value
|
|
3305
3309
|
))
|
|
3306
3310
|
}
|
|
3307
3311
|
)
|
|
3308
3312
|
] })
|
|
3309
3313
|
] }) : null;
|
|
3310
3314
|
}
|
|
3311
|
-
function
|
|
3315
|
+
function wa(e, t) {
|
|
3312
3316
|
return e.contentIds.map((n) => {
|
|
3313
3317
|
const o = t.store.getBlock(n);
|
|
3314
3318
|
return t.registry.get(o.type).toHTML(o, t);
|
|
3315
3319
|
}).join("");
|
|
3316
3320
|
}
|
|
3317
|
-
function
|
|
3321
|
+
function Ta(e, t) {
|
|
3318
3322
|
var o;
|
|
3319
3323
|
const n = ((o = e.props) == null ? void 0 : o.icon) ?? _e;
|
|
3320
|
-
return `<div class="callout" data-icon="${n}"><div class="callout-icon">${n}</div><div class="callout-content">${
|
|
3324
|
+
return `<div class="callout" data-icon="${n}"><div class="callout-icon">${n}</div><div class="callout-content">${wa(e, t)}</div></div>`;
|
|
3321
3325
|
}
|
|
3322
|
-
function
|
|
3326
|
+
function Ca(e, t) {
|
|
3323
3327
|
var r;
|
|
3324
3328
|
const n = ((r = e.props) == null ? void 0 : r.icon) ?? _e, o = e.contentIds.map((l) => {
|
|
3325
3329
|
const a = t.store.getBlock(l);
|
|
@@ -3328,7 +3332,7 @@ function wa(e, t) {
|
|
|
3328
3332
|
`);
|
|
3329
3333
|
return `${n} ${o}`;
|
|
3330
3334
|
}
|
|
3331
|
-
function
|
|
3335
|
+
function Ba(e, t) {
|
|
3332
3336
|
var r;
|
|
3333
3337
|
const n = ((r = e.props) == null ? void 0 : r.icon) ?? _e;
|
|
3334
3338
|
return e.contentIds.map((l) => {
|
|
@@ -3339,14 +3343,14 @@ function Ta(e, t) {
|
|
|
3339
3343
|
`).map((l, a) => `> ${a === 0 ? `${n} ` : ""}${l}`).join(`
|
|
3340
3344
|
`);
|
|
3341
3345
|
}
|
|
3342
|
-
const
|
|
3346
|
+
const Na = ae({
|
|
3343
3347
|
name: "callout",
|
|
3344
3348
|
contentModel: "blocks",
|
|
3345
|
-
component:
|
|
3349
|
+
component: Ia,
|
|
3346
3350
|
defaultProps: { icon: _e },
|
|
3347
|
-
toHTML:
|
|
3348
|
-
toPlainText:
|
|
3349
|
-
toMarkdown:
|
|
3351
|
+
toHTML: Ta,
|
|
3352
|
+
toPlainText: Ca,
|
|
3353
|
+
toMarkdown: Ba,
|
|
3350
3354
|
// No fromHTML: same precedent as layoutColumn — there's no standard
|
|
3351
3355
|
// external HTML shape for a "callout" box, so plain-HTML paste doesn't
|
|
3352
3356
|
// need to reconstruct one. Same-editor copy/paste is already lossless
|
|
@@ -3355,23 +3359,23 @@ const Ca = ae({
|
|
|
3355
3359
|
// contentIds generically and needs no per-type awareness at all.
|
|
3356
3360
|
slashCommand: {
|
|
3357
3361
|
label: "Callout",
|
|
3358
|
-
icon:
|
|
3362
|
+
icon: In,
|
|
3359
3363
|
keywords: ["callout", "aside", "note", "info", "tip", "warning"],
|
|
3360
|
-
run: (e, t) => re(e, t,
|
|
3364
|
+
run: (e, t) => re(e, t, Mr())
|
|
3361
3365
|
}
|
|
3362
3366
|
});
|
|
3363
|
-
function
|
|
3364
|
-
const t = K(), n = te(e), { setSelectedBlockId: o } = Pe(), r =
|
|
3367
|
+
function Ra({ id: e }) {
|
|
3368
|
+
const t = K(), n = te(e), { setSelectedBlockId: o } = Pe(), r = m(() => {
|
|
3365
3369
|
Xe(
|
|
3366
3370
|
t,
|
|
3367
3371
|
e,
|
|
3368
3372
|
(n == null ? void 0 : n.contentIds) ?? [],
|
|
3369
3373
|
U("paragraph")
|
|
3370
3374
|
);
|
|
3371
|
-
}, [t, e, n]), l =
|
|
3375
|
+
}, [t, e, n]), l = m(() => {
|
|
3372
3376
|
const i = ut(t, e);
|
|
3373
3377
|
Qe(t, i, e, o);
|
|
3374
|
-
}, [t, e, o]), a =
|
|
3378
|
+
}, [t, e, o]), a = m(() => le(t, e, "up"), [t, e]), s = m(() => le(t, e, "down"), [t, e]), c = se("be-blockquote", n);
|
|
3375
3379
|
if (!n) return null;
|
|
3376
3380
|
const u = ge(t, n.contentIds), p = Ce(t, n);
|
|
3377
3381
|
return /* @__PURE__ */ d(
|
|
@@ -3397,19 +3401,19 @@ function Ba({ id: e }) {
|
|
|
3397
3401
|
}
|
|
3398
3402
|
);
|
|
3399
3403
|
}
|
|
3400
|
-
function
|
|
3401
|
-
return `<p>${e.contentIds.map((o) => t.store.getRun(o)).map((o) =>
|
|
3404
|
+
function La(e, t) {
|
|
3405
|
+
return `<p>${e.contentIds.map((o) => t.store.getRun(o)).map((o) => Me(o, t)).join("")}</p>`;
|
|
3402
3406
|
}
|
|
3403
|
-
function
|
|
3404
|
-
return e.contentIds.map((n) =>
|
|
3407
|
+
function Aa(e, t) {
|
|
3408
|
+
return e.contentIds.map((n) => Ae(t.store.getRun(n), t)).join("");
|
|
3405
3409
|
}
|
|
3406
|
-
function
|
|
3410
|
+
function Ma(e, t) {
|
|
3407
3411
|
return `> ${De(
|
|
3408
3412
|
e.contentIds.map((o) => t.store.getRun(o)),
|
|
3409
3413
|
t
|
|
3410
3414
|
)}`;
|
|
3411
3415
|
}
|
|
3412
|
-
function
|
|
3416
|
+
function Ea(e, t) {
|
|
3413
3417
|
if (e.tagName !== "BLOCKQUOTE") return null;
|
|
3414
3418
|
const n = Le(e, t);
|
|
3415
3419
|
return { block: {
|
|
@@ -3420,22 +3424,22 @@ function Ma(e, t) {
|
|
|
3420
3424
|
props: {}
|
|
3421
3425
|
}, runs: n };
|
|
3422
3426
|
}
|
|
3423
|
-
const
|
|
3427
|
+
const $a = ae({
|
|
3424
3428
|
name: "blockquote",
|
|
3425
3429
|
contentModel: "runs",
|
|
3426
|
-
component:
|
|
3430
|
+
component: Ra,
|
|
3427
3431
|
defaultProps: {},
|
|
3428
|
-
toHTML:
|
|
3429
|
-
toPlainText:
|
|
3430
|
-
toMarkdown:
|
|
3431
|
-
fromHTML:
|
|
3432
|
+
toHTML: La,
|
|
3433
|
+
toPlainText: Aa,
|
|
3434
|
+
toMarkdown: Ma,
|
|
3435
|
+
fromHTML: Ea,
|
|
3432
3436
|
slashCommand: {
|
|
3433
3437
|
label: "Quote",
|
|
3434
|
-
icon:
|
|
3438
|
+
icon: vn,
|
|
3435
3439
|
keywords: ["quote", "blockquote", "citation"],
|
|
3436
3440
|
run: (e, t) => re(e, t, U("blockquote"))
|
|
3437
3441
|
}
|
|
3438
|
-
}),
|
|
3442
|
+
}), xa = [
|
|
3439
3443
|
"plaintext",
|
|
3440
3444
|
"javascript",
|
|
3441
3445
|
"python",
|
|
@@ -3444,42 +3448,69 @@ const Aa = ae({
|
|
|
3444
3448
|
"json",
|
|
3445
3449
|
"bash",
|
|
3446
3450
|
"sql"
|
|
3447
|
-
],
|
|
3448
|
-
function
|
|
3449
|
-
const o =
|
|
3451
|
+
], Oa = xa.map((e) => ({ value: e, label: e }));
|
|
3452
|
+
function sn(e, t, n) {
|
|
3453
|
+
const o = Do();
|
|
3450
3454
|
if (!o || o.blockId !== t) return;
|
|
3451
3455
|
const r = e.getRun(o.runId);
|
|
3452
3456
|
if (!r || r.type !== "text") return;
|
|
3453
3457
|
const l = r.value ?? "", a = l.slice(0, o.offset) + n + l.slice(o.offset);
|
|
3454
|
-
e.applyOperation(de(r.id, { value: a })),
|
|
3455
|
-
}
|
|
3456
|
-
function
|
|
3457
|
-
|
|
3458
|
-
|
|
3459
|
-
|
|
3460
|
-
|
|
3461
|
-
|
|
3462
|
-
|
|
3463
|
-
|
|
3464
|
-
|
|
3465
|
-
|
|
3466
|
-
|
|
3458
|
+
e.applyOperation(de(r.id, { value: a })), Ho(r.id, o.offset + n.length);
|
|
3459
|
+
}
|
|
3460
|
+
function Sa(e, t) {
|
|
3461
|
+
const n = m(
|
|
3462
|
+
(r) => {
|
|
3463
|
+
const l = t.map((a) => e.subscribe(a, r));
|
|
3464
|
+
return () => l.forEach((a) => a());
|
|
3465
|
+
},
|
|
3466
|
+
[e, t]
|
|
3467
|
+
), o = m(
|
|
3468
|
+
() => t.map((r) => {
|
|
3469
|
+
var l;
|
|
3470
|
+
return ((l = e.getRun(r)) == null ? void 0 : l.value) ?? "";
|
|
3471
|
+
}).join(""),
|
|
3472
|
+
[e, t]
|
|
3473
|
+
);
|
|
3474
|
+
return St(n, o);
|
|
3475
|
+
}
|
|
3476
|
+
function Da({ store: e, runIds: t, language: n, highlightCode: o }) {
|
|
3477
|
+
const r = Sa(e, t), l = o(r, n);
|
|
3478
|
+
return /* @__PURE__ */ d(
|
|
3479
|
+
"span",
|
|
3480
|
+
{
|
|
3481
|
+
className: "be-code-block-highlight",
|
|
3482
|
+
"aria-hidden": "true",
|
|
3483
|
+
dangerouslySetInnerHTML: { __html: l }
|
|
3484
|
+
}
|
|
3485
|
+
);
|
|
3486
|
+
}
|
|
3487
|
+
function Ha({ id: e }) {
|
|
3488
|
+
var k, I;
|
|
3489
|
+
const t = K(), n = te(e), o = Io(), r = wo(), l = m(() => sn(t, e, `
|
|
3490
|
+
`), [t, e]), a = m(() => sn(t, e, " "), [t, e]), s = m(() => {
|
|
3491
|
+
var $;
|
|
3492
|
+
const h = ut(t, e);
|
|
3493
|
+
if (!h || h === e) return;
|
|
3494
|
+
const b = t.getBlock(h), B = ($ = b == null ? void 0 : b.contentIds) == null ? void 0 : $[b.contentIds.length - 1];
|
|
3495
|
+
B && ve(B);
|
|
3496
|
+
}, [t, e]), c = m(() => le(t, e, "up"), [t, e]), u = m(() => le(t, e, "down"), [t, e]), p = m(
|
|
3497
|
+
(h) => t.applyOperation(V(e, { language: h })),
|
|
3467
3498
|
[t, e]
|
|
3468
|
-
),
|
|
3499
|
+
), i = m(() => Un(t, e), [t, e]), f = se("be-code-block", n);
|
|
3469
3500
|
if (!n) return null;
|
|
3470
|
-
const
|
|
3471
|
-
var
|
|
3472
|
-
return ((
|
|
3473
|
-
}).join("").match(/\n/g)) == null ? void 0 :
|
|
3474
|
-
return /* @__PURE__ */ T("div", { className:
|
|
3501
|
+
const y = ((k = n.props) == null ? void 0 : k.language) ?? "plaintext", v = ge(t, n.contentIds), g = o ? (((I = n.contentIds.map((h) => {
|
|
3502
|
+
var b;
|
|
3503
|
+
return ((b = t.getRun(h)) == null ? void 0 : b.value) ?? "";
|
|
3504
|
+
}).join("").match(/\n/g)) == null ? void 0 : I.length) ?? 0) + 1 : 0;
|
|
3505
|
+
return /* @__PURE__ */ T("div", { className: f, "data-block-id": e, children: [
|
|
3475
3506
|
/* @__PURE__ */ T("div", { className: "be-code-block-header", contentEditable: !1, children: [
|
|
3476
3507
|
/* @__PURE__ */ d(
|
|
3477
3508
|
We,
|
|
3478
3509
|
{
|
|
3479
3510
|
className: "be-code-block-language",
|
|
3480
|
-
value:
|
|
3481
|
-
options:
|
|
3482
|
-
onChange:
|
|
3511
|
+
value: y,
|
|
3512
|
+
options: Oa,
|
|
3513
|
+
onChange: p,
|
|
3483
3514
|
ariaLabel: "Code language"
|
|
3484
3515
|
}
|
|
3485
3516
|
),
|
|
@@ -3488,40 +3519,67 @@ function xa({ id: e }) {
|
|
|
3488
3519
|
{
|
|
3489
3520
|
type: "button",
|
|
3490
3521
|
className: "be-code-block-delete",
|
|
3491
|
-
onClick:
|
|
3522
|
+
onClick: i,
|
|
3492
3523
|
"aria-label": "Delete code block",
|
|
3493
3524
|
title: "Delete code block",
|
|
3494
|
-
children: /* @__PURE__ */ d(
|
|
3525
|
+
children: /* @__PURE__ */ d(Ln, { size: 14 })
|
|
3495
3526
|
}
|
|
3496
3527
|
)
|
|
3497
3528
|
] }),
|
|
3498
3529
|
/* @__PURE__ */ T("div", { className: "be-code-block-body", children: [
|
|
3499
|
-
o && /* @__PURE__ */ d("div", { className: "be-code-block-gutter", contentEditable: !1, "aria-hidden": "true", children: Array.from({ length:
|
|
3500
|
-
/* @__PURE__ */
|
|
3501
|
-
|
|
3530
|
+
o && /* @__PURE__ */ d("div", { className: "be-code-block-gutter", contentEditable: !1, "aria-hidden": "true", children: Array.from({ length: g }, (h, b) => /* @__PURE__ */ d("span", { children: b + 1 }, b)) }),
|
|
3531
|
+
/* @__PURE__ */ T(
|
|
3532
|
+
"pre",
|
|
3502
3533
|
{
|
|
3503
|
-
|
|
3504
|
-
runIds: n.contentIds,
|
|
3534
|
+
className: r ? "be-code-block-pre be-code-block-highlighted" : "be-code-block-pre",
|
|
3505
3535
|
dir: "ltr",
|
|
3506
|
-
|
|
3507
|
-
|
|
3508
|
-
|
|
3509
|
-
|
|
3510
|
-
|
|
3536
|
+
children: [
|
|
3537
|
+
r && /* @__PURE__ */ d(
|
|
3538
|
+
Da,
|
|
3539
|
+
{
|
|
3540
|
+
store: t,
|
|
3541
|
+
runIds: n.contentIds,
|
|
3542
|
+
language: y,
|
|
3543
|
+
highlightCode: r
|
|
3544
|
+
}
|
|
3545
|
+
),
|
|
3546
|
+
/* @__PURE__ */ d("code", { "data-empty": v ? "" : void 0, "data-placeholder": "Empty code block", children: /* @__PURE__ */ d(
|
|
3547
|
+
Ee,
|
|
3548
|
+
{
|
|
3549
|
+
blockId: e,
|
|
3550
|
+
runIds: n.contentIds,
|
|
3551
|
+
dir: "ltr",
|
|
3552
|
+
onEnter: l,
|
|
3553
|
+
onTab: a,
|
|
3554
|
+
onBackspaceAtStart: s,
|
|
3555
|
+
onArrowUp: c,
|
|
3556
|
+
onArrowDown: u
|
|
3557
|
+
}
|
|
3558
|
+
) })
|
|
3559
|
+
]
|
|
3511
3560
|
}
|
|
3512
|
-
)
|
|
3561
|
+
)
|
|
3513
3562
|
] })
|
|
3514
3563
|
] });
|
|
3515
3564
|
}
|
|
3516
|
-
|
|
3565
|
+
const Pa = /* @__PURE__ */ new Set(["DIV", "P", "LI", "TR"]);
|
|
3566
|
+
function _a(e) {
|
|
3567
|
+
const t = [""], n = (o) => {
|
|
3568
|
+
for (const r of o.childNodes)
|
|
3569
|
+
r.nodeType === 3 ? t[t.length - 1] += r.textContent : r.nodeType === 1 && (r.tagName === "BR" ? t.push("") : Pa.has(r.tagName) ? (n(r), t.push("")) : n(r));
|
|
3570
|
+
};
|
|
3571
|
+
return n(e), t.length > 1 && t[t.length - 1] === "" && t.pop(), t.join(`
|
|
3572
|
+
`);
|
|
3573
|
+
}
|
|
3574
|
+
function Ua(e, t) {
|
|
3517
3575
|
var l;
|
|
3518
3576
|
const n = e.contentIds.map((a) => t.store.getRun(a)), o = (l = e.props) == null ? void 0 : l.language;
|
|
3519
|
-
return `<pre><code${o && o !== "plaintext" ? ` data-language="${gt(o)}"` : ""}>${n.map((a) =>
|
|
3577
|
+
return `<pre><code${o && o !== "plaintext" ? ` data-language="${gt(o)}"` : ""}>${n.map((a) => Me(a, t)).join("")}</code></pre>`;
|
|
3520
3578
|
}
|
|
3521
|
-
function
|
|
3522
|
-
return e.contentIds.map((n) =>
|
|
3579
|
+
function ja(e, t) {
|
|
3580
|
+
return e.contentIds.map((n) => Ae(t.store.getRun(n), t)).join("");
|
|
3523
3581
|
}
|
|
3524
|
-
function
|
|
3582
|
+
function Fa(e, t) {
|
|
3525
3583
|
var l;
|
|
3526
3584
|
const n = (l = e.props) == null ? void 0 : l.language, o = n && n !== "plaintext" ? n : "", r = e.contentIds.map((a) => {
|
|
3527
3585
|
var s;
|
|
@@ -3531,7 +3589,7 @@ function Da(e, t) {
|
|
|
3531
3589
|
${r}
|
|
3532
3590
|
\`\`\``;
|
|
3533
3591
|
}
|
|
3534
|
-
function
|
|
3592
|
+
function Ka(e, t) {
|
|
3535
3593
|
var a;
|
|
3536
3594
|
if (e.tagName !== "PRE") return null;
|
|
3537
3595
|
const n = e.querySelector("code") ?? e, o = (a = n.getAttribute) == null ? void 0 : a.call(n, "data-language"), r = C();
|
|
@@ -3541,29 +3599,29 @@ function Ha(e, t) {
|
|
|
3541
3599
|
parentId: null,
|
|
3542
3600
|
contentIds: [r],
|
|
3543
3601
|
props: o ? { language: o } : {}
|
|
3544
|
-
}, runs: [{ id: r, type: "text", value: n
|
|
3602
|
+
}, runs: [{ id: r, type: "text", value: _a(n), marks: {} }] };
|
|
3545
3603
|
}
|
|
3546
|
-
const
|
|
3604
|
+
const za = ae({
|
|
3547
3605
|
name: "code",
|
|
3548
3606
|
contentModel: "runs",
|
|
3549
|
-
component:
|
|
3607
|
+
component: Ha,
|
|
3550
3608
|
defaultProps: { language: "plaintext" },
|
|
3551
|
-
toHTML:
|
|
3552
|
-
toPlainText:
|
|
3553
|
-
toMarkdown:
|
|
3554
|
-
fromHTML:
|
|
3609
|
+
toHTML: Ua,
|
|
3610
|
+
toPlainText: ja,
|
|
3611
|
+
toMarkdown: Fa,
|
|
3612
|
+
fromHTML: Ka,
|
|
3555
3613
|
slashCommand: {
|
|
3556
3614
|
label: "Code",
|
|
3557
|
-
icon:
|
|
3615
|
+
icon: wn,
|
|
3558
3616
|
keywords: ["code", "codeblock", "snippet", "pre"],
|
|
3559
3617
|
run: (e, t) => re(e, t, U("code"))
|
|
3560
3618
|
}
|
|
3561
3619
|
});
|
|
3562
|
-
function
|
|
3620
|
+
function Va(e, t) {
|
|
3563
3621
|
var n;
|
|
3564
3622
|
return t.length === 0 || t.length === 1 && (((n = e.getRun(t[0])) == null ? void 0 : n.value) ?? "") === "";
|
|
3565
3623
|
}
|
|
3566
|
-
function
|
|
3624
|
+
function Ga(e, t) {
|
|
3567
3625
|
const n = t.contentIds ?? [];
|
|
3568
3626
|
if (n.length === 0) return !0;
|
|
3569
3627
|
if (n.length > 1) return !1;
|
|
@@ -3574,10 +3632,10 @@ function ft(e, t) {
|
|
|
3574
3632
|
if (typeof e.performBatch == "function") e.performBatch(t);
|
|
3575
3633
|
else for (const n of t) e.applyOperation(n);
|
|
3576
3634
|
}
|
|
3577
|
-
function
|
|
3635
|
+
function Wa(e, t) {
|
|
3578
3636
|
const n = e.getBlock(t);
|
|
3579
3637
|
if (!n) return null;
|
|
3580
|
-
const o = e.getBlock(n.parentId), r = o.contentIds.indexOf(t), l = n.props.titleRunIds ?? [], a =
|
|
3638
|
+
const o = e.getBlock(n.parentId), r = o.contentIds.indexOf(t), l = n.props.titleRunIds ?? [], a = Va(e, l) && Ga(e, n);
|
|
3581
3639
|
if (r <= 0) {
|
|
3582
3640
|
if (!a) return null;
|
|
3583
3641
|
if (o.contentIds.length > 1)
|
|
@@ -3591,33 +3649,33 @@ function ja(e, t) {
|
|
|
3591
3649
|
const s = o.contentIds[r - 1], c = e.getBlock(s);
|
|
3592
3650
|
return a ? (ft(e, [q(t)]), { focusBlockId: s, needsRefocus: !0 }) : kt(e, c) ? (ft(e, [q(s)]), { focusBlockId: t, needsRefocus: !1 }) : null;
|
|
3593
3651
|
}
|
|
3594
|
-
function
|
|
3652
|
+
function qa(e, t) {
|
|
3595
3653
|
if (typeof e.performBatch == "function") e.performBatch(t);
|
|
3596
3654
|
else for (const n of t) e.applyOperation(n);
|
|
3597
3655
|
}
|
|
3598
|
-
function
|
|
3656
|
+
function Ya({ id: e }) {
|
|
3599
3657
|
var k;
|
|
3600
|
-
const t = K(), n = te(e), { setSelectedBlockId: o } = Pe(), r =
|
|
3601
|
-
var B,
|
|
3602
|
-
const I = ((B = n == null ? void 0 : n.props) == null ? void 0 : B.titleRunIds) ?? [],
|
|
3603
|
-
|
|
3604
|
-
}, [t, e, n]), l =
|
|
3605
|
-
const I =
|
|
3658
|
+
const t = K(), n = te(e), { setSelectedBlockId: o } = Pe(), r = m(() => {
|
|
3659
|
+
var B, $;
|
|
3660
|
+
const I = ((B = n == null ? void 0 : n.props) == null ? void 0 : B.titleRunIds) ?? [], h = ((($ = n == null ? void 0 : n.contentIds) == null ? void 0 : $.length) ?? 0) > 0, b = U("paragraph");
|
|
3661
|
+
h ? $n(t, e, I, b) : Xe(t, e, I, b);
|
|
3662
|
+
}, [t, e, n]), l = m(() => {
|
|
3663
|
+
const I = Wa(t, e);
|
|
3606
3664
|
!I || !I.needsRefocus || Qe(t, I.focusBlockId, e, o);
|
|
3607
|
-
}, [t, e, o]), a =
|
|
3608
|
-
var
|
|
3609
|
-
if (!((((
|
|
3610
|
-
const { block: B, runs:
|
|
3611
|
-
|
|
3612
|
-
ke(B, e, 0, { blocks: [B], runs:
|
|
3613
|
-
|
|
3665
|
+
}, [t, e, o]), a = m(() => le(t, e, "up"), [t, e]), s = m(() => le(t, e, "down"), [t, e]), c = m(() => {
|
|
3666
|
+
var h, b;
|
|
3667
|
+
if (!((((h = n == null ? void 0 : n.contentIds) == null ? void 0 : h.length) ?? 0) > 0)) {
|
|
3668
|
+
const { block: B, runs: $ } = U("paragraph")(e);
|
|
3669
|
+
qa(t, [
|
|
3670
|
+
ke(B, e, 0, { blocks: [B], runs: $ }),
|
|
3671
|
+
V(e, { collapsed: !1 })
|
|
3614
3672
|
]), ve(B.contentIds[0]);
|
|
3615
3673
|
return;
|
|
3616
3674
|
}
|
|
3617
|
-
t.applyOperation(
|
|
3675
|
+
t.applyOperation(V(e, { collapsed: !((b = n == null ? void 0 : n.props) != null && b.collapsed) }));
|
|
3618
3676
|
}, [t, e, n == null ? void 0 : n.contentIds, (k = n == null ? void 0 : n.props) == null ? void 0 : k.collapsed]), u = se("be-toggle-heading", n);
|
|
3619
3677
|
if (!n) return null;
|
|
3620
|
-
const { level: p = 2, collapsed: i, titleRunIds: f = [] } = n.props,
|
|
3678
|
+
const { level: p = 2, collapsed: i, titleRunIds: f = [] } = n.props, y = n.contentIds.length > 0, v = `h${p}`, g = Ce(t, n);
|
|
3621
3679
|
return /* @__PURE__ */ T("div", { className: u, "data-block-id": e, dir: g, children: [
|
|
3622
3680
|
/* @__PURE__ */ T("div", { className: "be-toggle-heading-row", children: [
|
|
3623
3681
|
/* @__PURE__ */ d(
|
|
@@ -3627,8 +3685,8 @@ function Ka({ id: e }) {
|
|
|
3627
3685
|
className: "be-toggle-heading-marker",
|
|
3628
3686
|
onClick: c,
|
|
3629
3687
|
"aria-expanded": !i,
|
|
3630
|
-
"aria-label":
|
|
3631
|
-
children: i ? /* @__PURE__ */ d(Oe, {}) : /* @__PURE__ */ d(
|
|
3688
|
+
"aria-label": y ? i ? "Expand section" : "Collapse section" : "Add content to section",
|
|
3689
|
+
children: i ? /* @__PURE__ */ d(Oe, {}) : /* @__PURE__ */ d(Pt, {})
|
|
3632
3690
|
}
|
|
3633
3691
|
),
|
|
3634
3692
|
/* @__PURE__ */ d(
|
|
@@ -3655,7 +3713,7 @@ function Ka({ id: e }) {
|
|
|
3655
3713
|
!i && /* @__PURE__ */ d("div", { className: "be-toggle-heading-children", children: /* @__PURE__ */ d(Ue, { parentId: e }) })
|
|
3656
3714
|
] });
|
|
3657
3715
|
}
|
|
3658
|
-
function
|
|
3716
|
+
function Xa({ level: e = 2, collapsed: t = !1 } = {}) {
|
|
3659
3717
|
return function(o, r) {
|
|
3660
3718
|
const l = C(), a = r != null && r.length ? r : [{ id: C(), type: "text", value: "", marks: {} }], { block: s, runs: c } = U("paragraph")(l);
|
|
3661
3719
|
return {
|
|
@@ -3671,15 +3729,15 @@ function za({ level: e = 2, collapsed: t = !1 } = {}) {
|
|
|
3671
3729
|
};
|
|
3672
3730
|
};
|
|
3673
3731
|
}
|
|
3674
|
-
function
|
|
3675
|
-
const { titleRunIds: n = [], level: o = 2, collapsed: r } = e.props, l = n.map((s) =>
|
|
3732
|
+
function Qa(e, t) {
|
|
3733
|
+
const { titleRunIds: n = [], level: o = 2, collapsed: r } = e.props, l = n.map((s) => Me(t.store.getRun(s), t)).join(""), a = e.contentIds.map((s) => {
|
|
3676
3734
|
const c = t.store.getBlock(s);
|
|
3677
3735
|
return t.registry.get(c.type).toHTML(c, t);
|
|
3678
3736
|
}).join("");
|
|
3679
3737
|
return `<details${r ? "" : " open"}><summary><h${o}>${l}</h${o}></summary>${a}</details>`;
|
|
3680
3738
|
}
|
|
3681
|
-
function
|
|
3682
|
-
const { titleRunIds: n = [] } = e.props, o = n.map((l) =>
|
|
3739
|
+
function Ja(e, t) {
|
|
3740
|
+
const { titleRunIds: n = [] } = e.props, o = n.map((l) => Ae(t.store.getRun(l), t)).join(""), r = e.contentIds.map((l) => {
|
|
3683
3741
|
const a = t.store.getBlock(l);
|
|
3684
3742
|
return t.registry.get(a.type).toPlainText(a, t);
|
|
3685
3743
|
}).join(`
|
|
@@ -3687,7 +3745,7 @@ function Va(e, t) {
|
|
|
3687
3745
|
return r ? `${o}
|
|
3688
3746
|
${r}` : o;
|
|
3689
3747
|
}
|
|
3690
|
-
function
|
|
3748
|
+
function Za(e, t) {
|
|
3691
3749
|
const { titleRunIds: n = [], level: o = 2 } = e.props, r = De(
|
|
3692
3750
|
n.map((s) => t.store.getRun(s)),
|
|
3693
3751
|
t
|
|
@@ -3701,19 +3759,19 @@ function Wa(e, t) {
|
|
|
3701
3759
|
|
|
3702
3760
|
${a}` : l;
|
|
3703
3761
|
}
|
|
3704
|
-
function
|
|
3762
|
+
function es(e, t) {
|
|
3705
3763
|
if (e.tagName !== "DETAILS") return null;
|
|
3706
3764
|
const n = [...e.children].find((i) => i.tagName === "SUMMARY"), o = n == null ? void 0 : n.querySelector("h1,h2,h3,h4,h5,h6"), r = o ? Math.min(6, Math.max(1, Number(o.tagName[1]))) : 2, l = o ? Le(o, t) : [{ id: C(), type: "text", value: "", marks: {} }], a = C(), s = [], c = [], u = [];
|
|
3707
3765
|
for (const i of e.children) {
|
|
3708
3766
|
if (i === n || i.tagName !== "P") continue;
|
|
3709
|
-
const f = Le(i, t),
|
|
3767
|
+
const f = Le(i, t), y = {
|
|
3710
3768
|
id: C(),
|
|
3711
3769
|
type: "paragraph",
|
|
3712
3770
|
parentId: a,
|
|
3713
3771
|
contentIds: f.map((v) => v.id),
|
|
3714
3772
|
props: {}
|
|
3715
3773
|
};
|
|
3716
|
-
s.push(
|
|
3774
|
+
s.push(y), c.push(...f), u.push(y.id);
|
|
3717
3775
|
}
|
|
3718
3776
|
if (u.length === 0) {
|
|
3719
3777
|
const { block: i, runs: f } = U("paragraph")(a);
|
|
@@ -3731,15 +3789,15 @@ function qa(e, t) {
|
|
|
3731
3789
|
}
|
|
3732
3790
|
}, runs: [...l, ...c], subtreeBlocks: s };
|
|
3733
3791
|
}
|
|
3734
|
-
const
|
|
3792
|
+
const ts = ae({
|
|
3735
3793
|
name: "toggleHeading",
|
|
3736
3794
|
contentModel: "blocks",
|
|
3737
|
-
component:
|
|
3795
|
+
component: Ya,
|
|
3738
3796
|
defaultProps: { level: 2, collapsed: !1, titleRunIds: [] },
|
|
3739
|
-
toHTML:
|
|
3740
|
-
toPlainText:
|
|
3741
|
-
toMarkdown:
|
|
3742
|
-
fromHTML:
|
|
3797
|
+
toHTML: Qa,
|
|
3798
|
+
toPlainText: Ja,
|
|
3799
|
+
toMarkdown: Za,
|
|
3800
|
+
fromHTML: es,
|
|
3743
3801
|
slashCommands: [1, 2, 3].map((e) => ({
|
|
3744
3802
|
label: `Toggle heading ${e}`,
|
|
3745
3803
|
icon: Oe,
|
|
@@ -3748,7 +3806,7 @@ const Ya = ae({
|
|
|
3748
3806
|
// heading/index.js); duplicating them here would make "/h3" ambiguous
|
|
3749
3807
|
// between "Heading 3" and "Toggle heading 3".
|
|
3750
3808
|
keywords: ["toggle", "heading", "collapse", "section"],
|
|
3751
|
-
run: (t, n) => re(t, n,
|
|
3809
|
+
run: (t, n) => re(t, n, Xa({ level: e }))
|
|
3752
3810
|
}))
|
|
3753
3811
|
}), Bt = [
|
|
3754
3812
|
{ label: "Blue", value: "#2b6fd6" },
|
|
@@ -3758,38 +3816,38 @@ const Ya = ae({
|
|
|
3758
3816
|
{ label: "Gray", value: "#495057" },
|
|
3759
3817
|
{ label: "Black", value: "#1a1a1a" }
|
|
3760
3818
|
];
|
|
3761
|
-
function
|
|
3819
|
+
function ns(e, t) {
|
|
3762
3820
|
if (typeof e.performBatch == "function") e.performBatch(t);
|
|
3763
3821
|
else for (const n of t) e.applyOperation(n);
|
|
3764
3822
|
}
|
|
3765
|
-
function
|
|
3766
|
-
const [r, l] =
|
|
3823
|
+
function os({ isOpen: e, onClose: t, store: n, blockId: o }) {
|
|
3824
|
+
const [r, l] = S(""), [a, s] = S(""), [c, u] = S(Bt[0].value), [p, i] = S([{ key: "", value: "" }]);
|
|
3767
3825
|
oe(() => {
|
|
3768
|
-
var
|
|
3826
|
+
var h, b, B;
|
|
3769
3827
|
if (!e) return;
|
|
3770
3828
|
const g = n.getBlock(o);
|
|
3771
3829
|
if (!g) return;
|
|
3772
|
-
const k = g.contentIds.map((
|
|
3830
|
+
const k = g.contentIds.map(($) => {
|
|
3773
3831
|
var D;
|
|
3774
|
-
return ((D = n.getRun(
|
|
3775
|
-
}).join(""), I = ((
|
|
3776
|
-
l(k), s(((
|
|
3832
|
+
return ((D = n.getRun($)) == null ? void 0 : D.value) ?? "";
|
|
3833
|
+
}).join(""), I = ((h = g.props) == null ? void 0 : h.customAttrs) ?? [];
|
|
3834
|
+
l(k), s(((b = g.props) == null ? void 0 : b.href) ?? ""), u(((B = g.props) == null ? void 0 : B.color) ?? Bt[0].value), i([...I, { key: "", value: "" }]);
|
|
3777
3835
|
}, [e, o, n]);
|
|
3778
|
-
const f =
|
|
3836
|
+
const f = m((g, k) => {
|
|
3779
3837
|
i((I) => {
|
|
3780
|
-
const
|
|
3781
|
-
return (
|
|
3838
|
+
const h = I.map((B, $) => $ === g ? { ...B, ...k } : B), b = h[h.length - 1];
|
|
3839
|
+
return (b.key.trim() || b.value.trim()) && h.push({ key: "", value: "" }), h;
|
|
3782
3840
|
});
|
|
3783
|
-
}, []),
|
|
3784
|
-
i((k) => k.filter((I,
|
|
3785
|
-
}, []), v =
|
|
3841
|
+
}, []), y = m((g) => {
|
|
3842
|
+
i((k) => k.filter((I, h) => h !== g));
|
|
3843
|
+
}, []), v = m(() => {
|
|
3786
3844
|
const g = { id: C(), type: "text", value: r, marks: {} }, k = p.filter((I) => I.key.trim());
|
|
3787
|
-
|
|
3788
|
-
|
|
3789
|
-
|
|
3845
|
+
ns(n, [
|
|
3846
|
+
Ve(o, [g]),
|
|
3847
|
+
V(o, { href: a.trim(), color: c, customAttrs: k })
|
|
3790
3848
|
]), t();
|
|
3791
3849
|
}, [n, o, r, a, c, p, t]);
|
|
3792
|
-
return /* @__PURE__ */ T(
|
|
3850
|
+
return /* @__PURE__ */ T(_t, { isOpen: e, onClose: t, title: "Edit button", children: [
|
|
3793
3851
|
/* @__PURE__ */ T("label", { className: "be-modal-field", children: [
|
|
3794
3852
|
/* @__PURE__ */ d("span", { children: "Label" }),
|
|
3795
3853
|
/* @__PURE__ */ d(
|
|
@@ -3855,7 +3913,7 @@ function Qa({ isOpen: e, onClose: t, store: n, blockId: o }) {
|
|
|
3855
3913
|
{
|
|
3856
3914
|
type: "button",
|
|
3857
3915
|
className: "be-modal-attr-remove",
|
|
3858
|
-
onClick: () =>
|
|
3916
|
+
onClick: () => y(k),
|
|
3859
3917
|
"aria-label": "Remove attribute",
|
|
3860
3918
|
children: /* @__PURE__ */ d(it, { size: 14 })
|
|
3861
3919
|
}
|
|
@@ -3868,31 +3926,31 @@ function Qa({ isOpen: e, onClose: t, store: n, blockId: o }) {
|
|
|
3868
3926
|
] })
|
|
3869
3927
|
] });
|
|
3870
3928
|
}
|
|
3871
|
-
const
|
|
3872
|
-
function
|
|
3873
|
-
var
|
|
3874
|
-
const t = K(), n = te(e), { setSelectedBlockId: o } = Pe(), [r, l] =
|
|
3929
|
+
const rs = "#2b6fd6";
|
|
3930
|
+
function ls({ id: e }) {
|
|
3931
|
+
var h, b, B, $;
|
|
3932
|
+
const t = K(), n = te(e), { setSelectedBlockId: o } = Pe(), [r, l] = S(!1), a = m(() => {
|
|
3875
3933
|
Xe(
|
|
3876
3934
|
t,
|
|
3877
3935
|
e,
|
|
3878
3936
|
(n == null ? void 0 : n.contentIds) ?? [],
|
|
3879
3937
|
U("paragraph")
|
|
3880
3938
|
);
|
|
3881
|
-
}, [t, e, n]), s =
|
|
3939
|
+
}, [t, e, n]), s = m(() => {
|
|
3882
3940
|
const D = ut(t, e);
|
|
3883
3941
|
Qe(t, D, e, o);
|
|
3884
|
-
}, [t, e, o]), c =
|
|
3942
|
+
}, [t, e, o]), c = m(() => le(t, e, "up"), [t, e]), u = m(() => le(t, e, "down"), [t, e]), p = m(() => {
|
|
3885
3943
|
var L;
|
|
3886
3944
|
const D = (L = n == null ? void 0 : n.props) == null ? void 0 : L.href;
|
|
3887
3945
|
D && window.open(D, "_blank", "noopener,noreferrer");
|
|
3888
|
-
}, [(
|
|
3946
|
+
}, [(h = n == null ? void 0 : n.props) == null ? void 0 : h.href]), i = se("be-button-block", n);
|
|
3889
3947
|
if (!n) return null;
|
|
3890
|
-
const f = ((
|
|
3948
|
+
const f = ((b = n.props) == null ? void 0 : b.href) ?? "", y = ((B = n.props) == null ? void 0 : B.color) ?? rs, v = (($ = n.props) == null ? void 0 : $.customAttrs) ?? [], g = ge(t, n.contentIds), k = {};
|
|
3891
3949
|
for (const { key: D, value: L } of v)
|
|
3892
3950
|
D.trim() && (k[`data-${D.trim()}`] = L);
|
|
3893
3951
|
const I = Ce(t, n);
|
|
3894
3952
|
return /* @__PURE__ */ T("div", { className: i, "data-block-id": e, dir: I, children: [
|
|
3895
|
-
/* @__PURE__ */ T("div", { className: "be-button-block-pill", style: { backgroundColor:
|
|
3953
|
+
/* @__PURE__ */ T("div", { className: "be-button-block-pill", style: { backgroundColor: y }, ...k, children: [
|
|
3896
3954
|
/* @__PURE__ */ d(
|
|
3897
3955
|
"span",
|
|
3898
3956
|
{
|
|
@@ -3938,7 +3996,7 @@ function Za({ id: e }) {
|
|
|
3938
3996
|
)
|
|
3939
3997
|
] }),
|
|
3940
3998
|
/* @__PURE__ */ d(
|
|
3941
|
-
|
|
3999
|
+
os,
|
|
3942
4000
|
{
|
|
3943
4001
|
isOpen: r,
|
|
3944
4002
|
onClose: () => l(!1),
|
|
@@ -3948,7 +4006,7 @@ function Za({ id: e }) {
|
|
|
3948
4006
|
)
|
|
3949
4007
|
] });
|
|
3950
4008
|
}
|
|
3951
|
-
function
|
|
4009
|
+
function as({
|
|
3952
4010
|
href: e = "",
|
|
3953
4011
|
label: t = "Button",
|
|
3954
4012
|
color: n = "",
|
|
@@ -3969,18 +4027,18 @@ function es({
|
|
|
3969
4027
|
};
|
|
3970
4028
|
}
|
|
3971
4029
|
const Yn = "be-button-block-link";
|
|
3972
|
-
function
|
|
4030
|
+
function ss(e, t) {
|
|
3973
4031
|
var c, u, p;
|
|
3974
4032
|
const n = e.contentIds.map((i) => t.store.getRun(i)), o = ((c = e.props) == null ? void 0 : c.href) ?? "", r = (u = e.props) == null ? void 0 : u.color, l = r ? ` style="background-color:${he(r)}"` : "", s = (((p = e.props) == null ? void 0 : p.customAttrs) ?? []).filter((i) => {
|
|
3975
4033
|
var f;
|
|
3976
4034
|
return (f = i.key) == null ? void 0 : f.trim();
|
|
3977
4035
|
}).map((i) => ` data-${he(i.key.trim())}="${he(i.value ?? "")}"`).join("");
|
|
3978
|
-
return `<a class="${Yn}" href="${he(o)}"${l}${s}>${n.map((i) =>
|
|
4036
|
+
return `<a class="${Yn}" href="${he(o)}"${l}${s}>${n.map((i) => Me(i, t)).join("")}</a>`;
|
|
3979
4037
|
}
|
|
3980
|
-
function
|
|
3981
|
-
return e.contentIds.map((n) =>
|
|
4038
|
+
function cs(e, t) {
|
|
4039
|
+
return e.contentIds.map((n) => Ae(t.store.getRun(n), t)).join("");
|
|
3982
4040
|
}
|
|
3983
|
-
function
|
|
4041
|
+
function is(e, t) {
|
|
3984
4042
|
var r;
|
|
3985
4043
|
const n = ((r = e.props) == null ? void 0 : r.href) ?? "";
|
|
3986
4044
|
return `[${De(
|
|
@@ -3988,7 +4046,7 @@ function os(e, t) {
|
|
|
3988
4046
|
t
|
|
3989
4047
|
) || n}](${n})`;
|
|
3990
4048
|
}
|
|
3991
|
-
function
|
|
4049
|
+
function us(e, t) {
|
|
3992
4050
|
var l;
|
|
3993
4051
|
if (e.tagName !== "A" || !e.classList.contains(Yn)) return null;
|
|
3994
4052
|
const n = Le(e, t), o = [];
|
|
@@ -4006,32 +4064,32 @@ function rs(e, t) {
|
|
|
4006
4064
|
}
|
|
4007
4065
|
}, runs: n };
|
|
4008
4066
|
}
|
|
4009
|
-
const
|
|
4067
|
+
const ds = ae({
|
|
4010
4068
|
name: "button",
|
|
4011
4069
|
contentModel: "runs",
|
|
4012
|
-
component:
|
|
4070
|
+
component: ls,
|
|
4013
4071
|
defaultProps: { href: "", color: "", customAttrs: [] },
|
|
4014
|
-
toHTML:
|
|
4015
|
-
toPlainText:
|
|
4016
|
-
toMarkdown:
|
|
4017
|
-
fromHTML:
|
|
4072
|
+
toHTML: ss,
|
|
4073
|
+
toPlainText: cs,
|
|
4074
|
+
toMarkdown: is,
|
|
4075
|
+
fromHTML: us,
|
|
4018
4076
|
slashCommand: {
|
|
4019
4077
|
label: "Button",
|
|
4020
|
-
icon:
|
|
4078
|
+
icon: To,
|
|
4021
4079
|
keywords: ["button", "link", "cta", "action"],
|
|
4022
|
-
run: (e, t) => re(e, t,
|
|
4080
|
+
run: (e, t) => re(e, t, as())
|
|
4023
4081
|
}
|
|
4024
4082
|
});
|
|
4025
|
-
function
|
|
4083
|
+
function ps(e) {
|
|
4026
4084
|
return new Promise((t, n) => {
|
|
4027
4085
|
const o = new FileReader();
|
|
4028
4086
|
o.onload = () => t(o.result), o.onerror = () => n(o.error), o.readAsDataURL(e);
|
|
4029
4087
|
});
|
|
4030
4088
|
}
|
|
4031
|
-
function
|
|
4089
|
+
function cn(e) {
|
|
4032
4090
|
return e < 1024 ? `${e} B` : e < 1024 * 1024 ? `${Math.round(e / 1024)} KB` : `${(e / (1024 * 1024)).toFixed(1)} MB`;
|
|
4033
4091
|
}
|
|
4034
|
-
function
|
|
4092
|
+
function fs(e) {
|
|
4035
4093
|
return e != null && e.startsWith("image/") ? "image" : e != null && e.startsWith("video/") ? "video" : e != null && e.startsWith("audio/") ? "audio" : "file";
|
|
4036
4094
|
}
|
|
4037
4095
|
async function Xn(e, { uploadFile: t, maxFileSize: n, kind: o }) {
|
|
@@ -4045,12 +4103,12 @@ async function Xn(e, { uploadFile: t, maxFileSize: n, kind: o }) {
|
|
|
4045
4103
|
}
|
|
4046
4104
|
if (n && e.size > n)
|
|
4047
4105
|
throw new Error(
|
|
4048
|
-
`This file is ${
|
|
4106
|
+
`This file is ${cn(e.size)} — larger than the ${cn(n)} limit.`
|
|
4049
4107
|
);
|
|
4050
|
-
return { src: await
|
|
4108
|
+
return { src: await ps(e), name: e.name, mimeType: e.type };
|
|
4051
4109
|
}
|
|
4052
|
-
async function
|
|
4053
|
-
const n =
|
|
4110
|
+
async function fc(e, t) {
|
|
4111
|
+
const n = fs(e.type), { src: o, name: r, mimeType: l } = await Xn(e, { ...t, kind: n });
|
|
4054
4112
|
return {
|
|
4055
4113
|
block: {
|
|
4056
4114
|
id: C(),
|
|
@@ -4063,7 +4121,7 @@ async function sc(e, t) {
|
|
|
4063
4121
|
subtreeBlocks: []
|
|
4064
4122
|
};
|
|
4065
4123
|
}
|
|
4066
|
-
const
|
|
4124
|
+
const ms = [
|
|
4067
4125
|
{
|
|
4068
4126
|
name: "youtube",
|
|
4069
4127
|
test: /(?:youtube\.com\/watch\?(?:.*&)?v=|youtu\.be\/|youtube\.com\/shorts\/|youtube\.com\/embed\/)([\w-]{6,})/,
|
|
@@ -4095,9 +4153,9 @@ const cs = [
|
|
|
4095
4153
|
embed: (e) => `https://open.spotify.com/embed/${e[1]}/${e[2]}`
|
|
4096
4154
|
}
|
|
4097
4155
|
];
|
|
4098
|
-
function
|
|
4156
|
+
function hs(e) {
|
|
4099
4157
|
if (!e) return null;
|
|
4100
|
-
for (const t of
|
|
4158
|
+
for (const t of ms) {
|
|
4101
4159
|
const n = e.match(t.test);
|
|
4102
4160
|
if (n) return { provider: t.name, embedUrl: t.embed(n, e) };
|
|
4103
4161
|
}
|
|
@@ -4109,15 +4167,15 @@ const mt = {
|
|
|
4109
4167
|
audio: "audio",
|
|
4110
4168
|
file: "file",
|
|
4111
4169
|
oembed: "embed"
|
|
4112
|
-
},
|
|
4113
|
-
{ value: "left", Icon:
|
|
4114
|
-
{ value: "center", Icon:
|
|
4170
|
+
}, gs = { image: "image/*", video: "video/*", audio: "audio/*", file: "*/*" }, $t = 20, xt = 100, bs = [
|
|
4171
|
+
{ value: "left", Icon: Nn, label: "Align left" },
|
|
4172
|
+
{ value: "center", Icon: Bo, label: "Align center" },
|
|
4115
4173
|
{ value: "right", Icon: Rn, label: "Align right" }
|
|
4116
4174
|
];
|
|
4117
|
-
function
|
|
4118
|
-
return Math.min(
|
|
4175
|
+
function Nt(e) {
|
|
4176
|
+
return Math.min(xt, Math.max($t, Math.round(e)));
|
|
4119
4177
|
}
|
|
4120
|
-
function
|
|
4178
|
+
function ys({ kind: e, src: t, name: n, alt: o, provider: r, onError: l }) {
|
|
4121
4179
|
return e === "image" ? /* @__PURE__ */ d("img", { className: "be-embed-image", src: t, alt: o || "", onError: l }) : e === "video" ? /* @__PURE__ */ d("video", { className: "be-embed-video", src: t, controls: !0, onError: l }) : e === "audio" ? /* @__PURE__ */ d("audio", { className: "be-embed-audio", src: t, controls: !0, onError: l }) : e === "oembed" ? /* @__PURE__ */ d(
|
|
4122
4180
|
"iframe",
|
|
4123
4181
|
{
|
|
@@ -4145,97 +4203,97 @@ function ps({ kind: e, src: t, name: n, alt: o, provider: r, onError: l }) {
|
|
|
4145
4203
|
}
|
|
4146
4204
|
);
|
|
4147
4205
|
}
|
|
4148
|
-
function
|
|
4206
|
+
function ks({ id: e }) {
|
|
4149
4207
|
var Je, Ze, ye, Fe, et;
|
|
4150
|
-
const t = K(), n = te(e), { uploadFile: o, maxFileSize: r, resolveEmbedSrc: l, onEmbedError: a } =
|
|
4151
|
-
(
|
|
4208
|
+
const t = K(), n = te(e), { uploadFile: o, maxFileSize: r, resolveEmbedSrc: l, onEmbedError: a } = Co(), [s, c] = S(""), [u, p] = S(!1), [i, f] = S(null), [y, v] = S(!1), [g, k] = S(""), [I, h] = S(!1), [b, B] = S(null), $ = _(null), D = _(null), L = m(
|
|
4209
|
+
(A) => t.applyOperation(V(e, A)),
|
|
4152
4210
|
[t, e]
|
|
4153
|
-
),
|
|
4154
|
-
var
|
|
4155
|
-
k(((
|
|
4156
|
-
}, [(Je = n == null ? void 0 : n.props) == null ? void 0 : Je.alt]), E =
|
|
4157
|
-
(
|
|
4158
|
-
|
|
4211
|
+
), x = m(() => {
|
|
4212
|
+
var A;
|
|
4213
|
+
k(((A = n == null ? void 0 : n.props) == null ? void 0 : A.alt) ?? ""), v(!0);
|
|
4214
|
+
}, [(Je = n == null ? void 0 : n.props) == null ? void 0 : Je.alt]), E = m(() => v(!1), []), j = m(
|
|
4215
|
+
(A) => {
|
|
4216
|
+
A.preventDefault(), L({ alt: g.trim() }), v(!1);
|
|
4159
4217
|
},
|
|
4160
4218
|
[g, L]
|
|
4161
|
-
), w =
|
|
4162
|
-
async (
|
|
4163
|
-
B(null),
|
|
4219
|
+
), w = m(
|
|
4220
|
+
async (A, W) => {
|
|
4221
|
+
B(null), h(!0);
|
|
4164
4222
|
try {
|
|
4165
|
-
const { src: z, name: ee, mimeType:
|
|
4223
|
+
const { src: z, name: ee, mimeType: N } = await Xn(A, {
|
|
4166
4224
|
uploadFile: o,
|
|
4167
4225
|
maxFileSize: r,
|
|
4168
4226
|
kind: W
|
|
4169
4227
|
});
|
|
4170
|
-
L({ src: z, name: ee, mimeType:
|
|
4228
|
+
L({ src: z, name: ee, mimeType: N });
|
|
4171
4229
|
} catch (z) {
|
|
4172
4230
|
B((z == null ? void 0 : z.message) || "Upload failed. Please try again.");
|
|
4173
4231
|
} finally {
|
|
4174
|
-
|
|
4232
|
+
h(!1);
|
|
4175
4233
|
}
|
|
4176
4234
|
},
|
|
4177
4235
|
[o, r, L]
|
|
4178
|
-
),
|
|
4179
|
-
(
|
|
4236
|
+
), R = m(
|
|
4237
|
+
(A) => {
|
|
4180
4238
|
var z, ee;
|
|
4181
|
-
const W = (z =
|
|
4182
|
-
|
|
4239
|
+
const W = (z = A.target.files) == null ? void 0 : z[0];
|
|
4240
|
+
A.target.value = "", W && w(W, ((ee = n == null ? void 0 : n.props) == null ? void 0 : ee.kind) ?? "file");
|
|
4183
4241
|
},
|
|
4184
4242
|
[w, (Ze = n == null ? void 0 : n.props) == null ? void 0 : Ze.kind]
|
|
4185
|
-
),
|
|
4186
|
-
(
|
|
4243
|
+
), O = m(
|
|
4244
|
+
(A) => {
|
|
4187
4245
|
var z, ee;
|
|
4188
|
-
|
|
4189
|
-
const W = (z =
|
|
4246
|
+
A.preventDefault(), p(!1);
|
|
4247
|
+
const W = (z = A.dataTransfer.files) == null ? void 0 : z[0];
|
|
4190
4248
|
W && w(W, ((ee = n == null ? void 0 : n.props) == null ? void 0 : ee.kind) ?? "file");
|
|
4191
4249
|
},
|
|
4192
4250
|
[w, (ye = n == null ? void 0 : n.props) == null ? void 0 : ye.kind]
|
|
4193
|
-
), P =
|
|
4194
|
-
|
|
4195
|
-
}, []),
|
|
4196
|
-
const
|
|
4197
|
-
if (!
|
|
4198
|
-
const W =
|
|
4251
|
+
), P = m((A) => {
|
|
4252
|
+
A.preventDefault(), p(!0);
|
|
4253
|
+
}, []), M = m(() => p(!1), []), H = m(() => {
|
|
4254
|
+
const A = s.trim();
|
|
4255
|
+
if (!A) return;
|
|
4256
|
+
const W = hs(A);
|
|
4199
4257
|
L(W ? {
|
|
4200
4258
|
kind: "oembed",
|
|
4201
4259
|
src: W.embedUrl,
|
|
4202
|
-
name:
|
|
4260
|
+
name: A,
|
|
4203
4261
|
mimeType: "",
|
|
4204
4262
|
provider: W.provider,
|
|
4205
|
-
originalUrl:
|
|
4206
|
-
} : { src:
|
|
4207
|
-
}, [s, L]), Y =
|
|
4263
|
+
originalUrl: A
|
|
4264
|
+
} : { src: A, name: A }), c("");
|
|
4265
|
+
}, [s, L]), Y = m(
|
|
4208
4266
|
() => L({ src: "", name: "", mimeType: "", provider: "", originalUrl: "" }),
|
|
4209
4267
|
[L]
|
|
4210
|
-
), X =
|
|
4211
|
-
(
|
|
4212
|
-
|
|
4213
|
-
const W =
|
|
4268
|
+
), X = m(
|
|
4269
|
+
(A) => {
|
|
4270
|
+
A.preventDefault();
|
|
4271
|
+
const W = $.current, z = D.current;
|
|
4214
4272
|
if (!W || !z) return;
|
|
4215
|
-
const ee = W.getBoundingClientRect().width,
|
|
4216
|
-
document.removeEventListener("mousemove",
|
|
4273
|
+
const ee = W.getBoundingClientRect().width, N = z.getBoundingClientRect().width, J = A.clientX, ue = (we) => Nt((N + (we.clientX - J)) / ee * 100), Ne = (we) => f(ue(we)), Re = (we) => {
|
|
4274
|
+
document.removeEventListener("mousemove", Ne), document.removeEventListener("mouseup", Re), L({ width: ue(we) }), f(null);
|
|
4217
4275
|
};
|
|
4218
|
-
document.addEventListener("mousemove",
|
|
4276
|
+
document.addEventListener("mousemove", Ne), document.addEventListener("mouseup", Re);
|
|
4219
4277
|
},
|
|
4220
4278
|
[L]
|
|
4221
|
-
), pe =
|
|
4222
|
-
(
|
|
4223
|
-
var
|
|
4224
|
-
const W = ((
|
|
4279
|
+
), pe = m(
|
|
4280
|
+
(A) => {
|
|
4281
|
+
var N;
|
|
4282
|
+
const W = ((N = n == null ? void 0 : n.props) == null ? void 0 : N.width) ?? 100, z = A.shiftKey ? 1 : 5;
|
|
4225
4283
|
let ee;
|
|
4226
|
-
if (
|
|
4227
|
-
else if (
|
|
4228
|
-
ee =
|
|
4229
|
-
else if (
|
|
4230
|
-
else if (
|
|
4284
|
+
if (A.key === "ArrowLeft" || A.key === "ArrowDown") ee = Nt(W - z);
|
|
4285
|
+
else if (A.key === "ArrowRight" || A.key === "ArrowUp")
|
|
4286
|
+
ee = Nt(W + z);
|
|
4287
|
+
else if (A.key === "Home") ee = $t;
|
|
4288
|
+
else if (A.key === "End") ee = xt;
|
|
4231
4289
|
else return;
|
|
4232
|
-
|
|
4290
|
+
A.preventDefault(), L({ width: ee });
|
|
4233
4291
|
},
|
|
4234
4292
|
[(Fe = n == null ? void 0 : n.props) == null ? void 0 : Fe.width, L]
|
|
4235
4293
|
), F = se("be-embed", n), Q = l((et = n == null ? void 0 : n.props) == null ? void 0 : et.src);
|
|
4236
4294
|
if (!n) return null;
|
|
4237
4295
|
const {
|
|
4238
|
-
kind:
|
|
4296
|
+
kind: G = "file",
|
|
4239
4297
|
src: me,
|
|
4240
4298
|
name: ce,
|
|
4241
4299
|
alt: Ie = "",
|
|
@@ -4243,7 +4301,7 @@ function fs({ id: e }) {
|
|
|
4243
4301
|
width: ne = 100,
|
|
4244
4302
|
provider: je = "",
|
|
4245
4303
|
originalUrl: $e = ""
|
|
4246
|
-
} = n.props, Z =
|
|
4304
|
+
} = n.props, Z = G === "image" || G === "video" || G === "oembed", dt = i ?? ne, Be = G === "oembed", wt = () => a == null ? void 0 : a(me);
|
|
4247
4305
|
return (
|
|
4248
4306
|
// tabIndex={-1}: focusable via .focus() (see setSelectedBlockId in
|
|
4249
4307
|
// EditorProvider.jsx) without joining the normal Tab order — keeps the
|
|
@@ -4255,11 +4313,11 @@ function fs({ id: e }) {
|
|
|
4255
4313
|
{
|
|
4256
4314
|
className: F,
|
|
4257
4315
|
"data-block-id": e,
|
|
4258
|
-
"data-kind":
|
|
4316
|
+
"data-kind": G,
|
|
4259
4317
|
contentEditable: !1,
|
|
4260
4318
|
tabIndex: -1,
|
|
4261
4319
|
children: [
|
|
4262
|
-
me ? /* @__PURE__ */ d("div", { ref:
|
|
4320
|
+
me ? /* @__PURE__ */ d("div", { ref: $, className: `be-embed-preview be-embed-align-${ie}`, children: /* @__PURE__ */ T(
|
|
4263
4321
|
"div",
|
|
4264
4322
|
{
|
|
4265
4323
|
ref: D,
|
|
@@ -4267,25 +4325,25 @@ function fs({ id: e }) {
|
|
|
4267
4325
|
style: Z ? { width: `${dt}%` } : void 0,
|
|
4268
4326
|
children: [
|
|
4269
4327
|
/* @__PURE__ */ T("div", { className: "be-embed-toolbar", contentEditable: !1, children: [
|
|
4270
|
-
|
|
4328
|
+
bs.map(({ value: A, Icon: W, label: z }) => /* @__PURE__ */ d(
|
|
4271
4329
|
"button",
|
|
4272
4330
|
{
|
|
4273
4331
|
type: "button",
|
|
4274
|
-
className: `be-embed-toolbar-btn${ie ===
|
|
4332
|
+
className: `be-embed-toolbar-btn${ie === A ? " be-embed-toolbar-btn-active" : ""}`,
|
|
4275
4333
|
title: z,
|
|
4276
4334
|
"aria-label": z,
|
|
4277
|
-
"aria-pressed": ie ===
|
|
4278
|
-
onClick: () => L({ align:
|
|
4335
|
+
"aria-pressed": ie === A,
|
|
4336
|
+
onClick: () => L({ align: A }),
|
|
4279
4337
|
children: /* @__PURE__ */ d(W, { size: 14 })
|
|
4280
4338
|
},
|
|
4281
|
-
|
|
4339
|
+
A
|
|
4282
4340
|
)),
|
|
4283
|
-
|
|
4341
|
+
G === "image" && /* @__PURE__ */ d(
|
|
4284
4342
|
"button",
|
|
4285
4343
|
{
|
|
4286
4344
|
type: "button",
|
|
4287
4345
|
className: "be-embed-toolbar-btn be-embed-alt-text-btn",
|
|
4288
|
-
onClick:
|
|
4346
|
+
onClick: x,
|
|
4289
4347
|
children: "Alt text"
|
|
4290
4348
|
}
|
|
4291
4349
|
),
|
|
@@ -4298,7 +4356,7 @@ function fs({ id: e }) {
|
|
|
4298
4356
|
rel: "noopener noreferrer",
|
|
4299
4357
|
title: "Open original link",
|
|
4300
4358
|
"aria-label": "Open original link",
|
|
4301
|
-
children: /* @__PURE__ */ d(
|
|
4359
|
+
children: /* @__PURE__ */ d(An, { size: 14 })
|
|
4302
4360
|
}
|
|
4303
4361
|
),
|
|
4304
4362
|
/* @__PURE__ */ d(
|
|
@@ -4307,15 +4365,15 @@ function fs({ id: e }) {
|
|
|
4307
4365
|
type: "button",
|
|
4308
4366
|
className: "be-embed-remove",
|
|
4309
4367
|
onClick: Y,
|
|
4310
|
-
"aria-label": `Remove ${mt[
|
|
4368
|
+
"aria-label": `Remove ${mt[G]}`,
|
|
4311
4369
|
children: "Remove"
|
|
4312
4370
|
}
|
|
4313
4371
|
)
|
|
4314
4372
|
] }),
|
|
4315
4373
|
/* @__PURE__ */ d(
|
|
4316
|
-
|
|
4374
|
+
ys,
|
|
4317
4375
|
{
|
|
4318
|
-
kind:
|
|
4376
|
+
kind: G,
|
|
4319
4377
|
src: Q,
|
|
4320
4378
|
name: ce,
|
|
4321
4379
|
alt: Ie,
|
|
@@ -4331,9 +4389,9 @@ function fs({ id: e }) {
|
|
|
4331
4389
|
onKeyDown: pe,
|
|
4332
4390
|
role: "slider",
|
|
4333
4391
|
tabIndex: 0,
|
|
4334
|
-
"aria-label": `Resize ${mt[
|
|
4335
|
-
"aria-valuemin":
|
|
4336
|
-
"aria-valuemax":
|
|
4392
|
+
"aria-label": `Resize ${mt[G]}`,
|
|
4393
|
+
"aria-valuemin": $t,
|
|
4394
|
+
"aria-valuemax": xt,
|
|
4337
4395
|
"aria-valuenow": dt
|
|
4338
4396
|
}
|
|
4339
4397
|
)
|
|
@@ -4343,21 +4401,21 @@ function fs({ id: e }) {
|
|
|
4343
4401
|
"div",
|
|
4344
4402
|
{
|
|
4345
4403
|
className: `be-embed-dropzone${u ? " be-embed-dropzone-active" : ""}`,
|
|
4346
|
-
onDrop: Be || I ? void 0 :
|
|
4404
|
+
onDrop: Be || I ? void 0 : O,
|
|
4347
4405
|
onDragOver: Be || I ? void 0 : P,
|
|
4348
|
-
onDragLeave:
|
|
4406
|
+
onDragLeave: M,
|
|
4349
4407
|
children: [
|
|
4350
4408
|
I ? /* @__PURE__ */ d("span", { className: "be-embed-uploading", children: "Uploading…" }) : /* @__PURE__ */ T(Te, { children: [
|
|
4351
4409
|
!Be && /* @__PURE__ */ T(Te, { children: [
|
|
4352
4410
|
/* @__PURE__ */ T("label", { className: "be-embed-upload-btn", children: [
|
|
4353
4411
|
"Upload ",
|
|
4354
|
-
mt[
|
|
4412
|
+
mt[G],
|
|
4355
4413
|
/* @__PURE__ */ d(
|
|
4356
4414
|
"input",
|
|
4357
4415
|
{
|
|
4358
4416
|
type: "file",
|
|
4359
|
-
accept:
|
|
4360
|
-
onChange:
|
|
4417
|
+
accept: gs[G],
|
|
4418
|
+
onChange: R,
|
|
4361
4419
|
hidden: !0
|
|
4362
4420
|
}
|
|
4363
4421
|
)
|
|
@@ -4370,23 +4428,23 @@ function fs({ id: e }) {
|
|
|
4370
4428
|
{
|
|
4371
4429
|
type: "text",
|
|
4372
4430
|
className: "be-embed-url-input",
|
|
4373
|
-
placeholder: Be ? "Paste a YouTube, Vimeo, Loom, Figma, CodePen, or Spotify link" : `https://... ${mt[
|
|
4431
|
+
placeholder: Be ? "Paste a YouTube, Vimeo, Loom, Figma, CodePen, or Spotify link" : `https://... ${mt[G]} URL`,
|
|
4374
4432
|
value: s,
|
|
4375
|
-
onChange: (
|
|
4376
|
-
onKeyDown: (
|
|
4433
|
+
onChange: (A) => c(A.target.value),
|
|
4434
|
+
onKeyDown: (A) => A.key === "Enter" && H()
|
|
4377
4435
|
}
|
|
4378
4436
|
),
|
|
4379
4437
|
/* @__PURE__ */ d("button", { type: "button", className: "be-embed-url-commit", onClick: H, children: "Embed" })
|
|
4380
4438
|
] })
|
|
4381
4439
|
] }),
|
|
4382
|
-
|
|
4383
|
-
|
|
4440
|
+
b && /* @__PURE__ */ T("div", { className: "be-embed-upload-error", role: "alert", children: [
|
|
4441
|
+
b,
|
|
4384
4442
|
/* @__PURE__ */ d("button", { type: "button", onClick: () => B(null), "aria-label": "Dismiss error", children: "×" })
|
|
4385
4443
|
] })
|
|
4386
4444
|
]
|
|
4387
4445
|
}
|
|
4388
4446
|
),
|
|
4389
|
-
/* @__PURE__ */ d(
|
|
4447
|
+
/* @__PURE__ */ d(_t, { isOpen: y, onClose: E, title: "Alt text", children: /* @__PURE__ */ T("form", { onSubmit: j, children: [
|
|
4390
4448
|
/* @__PURE__ */ T("label", { className: "be-modal-field", children: [
|
|
4391
4449
|
/* @__PURE__ */ d("span", { children: "Describe this image for screen readers" }),
|
|
4392
4450
|
/* @__PURE__ */ d(
|
|
@@ -4394,7 +4452,7 @@ function fs({ id: e }) {
|
|
|
4394
4452
|
{
|
|
4395
4453
|
type: "text",
|
|
4396
4454
|
value: g,
|
|
4397
|
-
onChange: (
|
|
4455
|
+
onChange: (A) => k(A.target.value),
|
|
4398
4456
|
placeholder: "e.g. A hand-drawn diagram of the release process",
|
|
4399
4457
|
autoFocus: !0
|
|
4400
4458
|
}
|
|
@@ -4410,7 +4468,7 @@ function fs({ id: e }) {
|
|
|
4410
4468
|
)
|
|
4411
4469
|
);
|
|
4412
4470
|
}
|
|
4413
|
-
function
|
|
4471
|
+
function vs({
|
|
4414
4472
|
kind: e = "file",
|
|
4415
4473
|
src: t = "",
|
|
4416
4474
|
name: n = "",
|
|
@@ -4434,25 +4492,25 @@ function ms({
|
|
|
4434
4492
|
};
|
|
4435
4493
|
};
|
|
4436
4494
|
}
|
|
4437
|
-
const
|
|
4438
|
-
image:
|
|
4495
|
+
const un = {
|
|
4496
|
+
image: Lo,
|
|
4439
4497
|
video: Ro,
|
|
4440
|
-
audio:
|
|
4498
|
+
audio: No,
|
|
4441
4499
|
file: Mn,
|
|
4442
|
-
oembed:
|
|
4500
|
+
oembed: An
|
|
4443
4501
|
}, Qn = "be-embed-file-link", Jn = "be-embed-oembed-link";
|
|
4444
|
-
function
|
|
4502
|
+
function Is(e, t, n) {
|
|
4445
4503
|
if (e !== "image" && e !== "video" && e !== "oembed") return "";
|
|
4446
4504
|
const o = [];
|
|
4447
4505
|
return n !== 100 && o.push(`width:${n}%`), t === "center" ? o.push("display:block", "margin-left:auto", "margin-right:auto") : t === "right" && o.push("display:block", "margin-left:auto"), o.length ? ` style="${o.join(";")}"` : "";
|
|
4448
4506
|
}
|
|
4449
|
-
function
|
|
4507
|
+
function Rt(e) {
|
|
4450
4508
|
var r, l, a, s;
|
|
4451
4509
|
const t = (r = e.style) == null ? void 0 : r.width, n = t && t.endsWith("%") ? parseInt(t, 10) : 100;
|
|
4452
4510
|
let o = "left";
|
|
4453
4511
|
return ((l = e.style) == null ? void 0 : l.marginLeft) === "auto" && ((a = e.style) == null ? void 0 : a.marginRight) === "auto" ? o = "center" : ((s = e.style) == null ? void 0 : s.marginLeft) === "auto" && (o = "right"), { align: o, width: Number.isFinite(n) ? n : 100 };
|
|
4454
4512
|
}
|
|
4455
|
-
function
|
|
4513
|
+
function ws(e) {
|
|
4456
4514
|
const {
|
|
4457
4515
|
kind: t,
|
|
4458
4516
|
src: n,
|
|
@@ -4464,23 +4522,23 @@ function gs(e) {
|
|
|
4464
4522
|
originalUrl: c = ""
|
|
4465
4523
|
} = e.props;
|
|
4466
4524
|
if (!n) return "<p></p>";
|
|
4467
|
-
const u =
|
|
4525
|
+
const u = Is(t, l, a);
|
|
4468
4526
|
return t === "image" ? `<img src="${he(n)}" alt="${he(r)}"${u}>` : t === "video" ? `<video src="${he(n)}" controls${u}></video>` : t === "audio" ? `<audio src="${he(n)}" controls></audio>` : t === "oembed" ? `<a class="${Jn}" href="${he(c || n)}" data-embed-url="${he(n)}" data-embed-provider="${he(s)}">${gt(c || n)}</a>` : `<a class="${Qn}" href="${he(n)}">${gt(o || n)}</a>`;
|
|
4469
4527
|
}
|
|
4470
|
-
function
|
|
4528
|
+
function Ts(e) {
|
|
4471
4529
|
const { kind: t, src: n, name: o, originalUrl: r = "" } = e.props;
|
|
4472
4530
|
return n ? t === "oembed" ? `[embed: ${r || n}]` : `[${t}: ${o || n}]` : "";
|
|
4473
4531
|
}
|
|
4474
|
-
function
|
|
4532
|
+
function Cs(e) {
|
|
4475
4533
|
const { kind: t, src: n, name: o, alt: r = "", originalUrl: l = "" } = e.props;
|
|
4476
4534
|
return n ? t === "image" ? `` : t === "oembed" ? `[${l || n}](${l || n})` : `[${o || n}](${n})` : "";
|
|
4477
4535
|
}
|
|
4478
|
-
function
|
|
4536
|
+
function Bs(e) {
|
|
4479
4537
|
return e.tagName === "IMG" ? rt("image", e.getAttribute("src") ?? "", "", {
|
|
4480
|
-
...
|
|
4538
|
+
...Rt(e),
|
|
4481
4539
|
alt: e.getAttribute("alt") ?? ""
|
|
4482
|
-
}) : e.tagName === "VIDEO" ? rt("video", e.getAttribute("src") ?? "", "",
|
|
4483
|
-
...
|
|
4540
|
+
}) : e.tagName === "VIDEO" ? rt("video", e.getAttribute("src") ?? "", "", Rt(e)) : e.tagName === "AUDIO" ? rt("audio", e.getAttribute("src") ?? "", "") : e.tagName === "A" && e.classList.contains(Jn) ? rt("oembed", e.getAttribute("data-embed-url") ?? "", "", {
|
|
4541
|
+
...Rt(e),
|
|
4484
4542
|
provider: e.getAttribute("data-embed-provider") ?? "",
|
|
4485
4543
|
originalUrl: e.getAttribute("href") ?? ""
|
|
4486
4544
|
}) : e.tagName === "A" && e.classList.contains(Qn) ? rt("file", e.getAttribute("href") ?? "", e.textContent ?? "") : null;
|
|
@@ -4497,20 +4555,20 @@ function rt(e, t, n, { align: o = "left", width: r = 100, alt: l = "", provider:
|
|
|
4497
4555
|
runs: []
|
|
4498
4556
|
};
|
|
4499
4557
|
}
|
|
4500
|
-
function
|
|
4558
|
+
function dn(e) {
|
|
4501
4559
|
return (t, { blockId: n, runId: o, sliceStart: r, sliceEnd: l }) => {
|
|
4502
4560
|
const a = t.getRun(o), s = (a == null ? void 0 : a.value) ?? "";
|
|
4503
4561
|
t.applyOperation(
|
|
4504
4562
|
de(o, { value: s.slice(0, r) + s.slice(l) })
|
|
4505
4563
|
);
|
|
4506
|
-
const c = xn(t, n,
|
|
4564
|
+
const c = xn(t, n, vs({ kind: e }));
|
|
4507
4565
|
return Ye(t, c, U("paragraph")), c;
|
|
4508
4566
|
};
|
|
4509
4567
|
}
|
|
4510
|
-
const
|
|
4568
|
+
const Ns = ae({
|
|
4511
4569
|
name: "embed",
|
|
4512
4570
|
contentModel: "void",
|
|
4513
|
-
component:
|
|
4571
|
+
component: ks,
|
|
4514
4572
|
defaultProps: {
|
|
4515
4573
|
kind: "file",
|
|
4516
4574
|
src: "",
|
|
@@ -4522,36 +4580,36 @@ const vs = ae({
|
|
|
4522
4580
|
provider: "",
|
|
4523
4581
|
originalUrl: ""
|
|
4524
4582
|
},
|
|
4525
|
-
toHTML:
|
|
4526
|
-
toPlainText:
|
|
4527
|
-
toMarkdown:
|
|
4528
|
-
fromHTML:
|
|
4583
|
+
toHTML: ws,
|
|
4584
|
+
toPlainText: Ts,
|
|
4585
|
+
toMarkdown: Cs,
|
|
4586
|
+
fromHTML: Bs,
|
|
4529
4587
|
slashCommands: [
|
|
4530
4588
|
...["image", "video", "audio", "file"].map((e) => ({
|
|
4531
4589
|
label: e.charAt(0).toUpperCase() + e.slice(1),
|
|
4532
|
-
icon:
|
|
4590
|
+
icon: un[e],
|
|
4533
4591
|
keywords: ["embed", "upload", "insert", e],
|
|
4534
|
-
run:
|
|
4592
|
+
run: dn(e)
|
|
4535
4593
|
})),
|
|
4536
4594
|
{
|
|
4537
4595
|
label: "Embed link",
|
|
4538
|
-
icon:
|
|
4596
|
+
icon: un.oembed,
|
|
4539
4597
|
// A YouTube/Vimeo/Loom/Figma/CodePen/Spotify link pasted into an
|
|
4540
4598
|
// image/video/file block's own URL field is also auto-detected (see
|
|
4541
4599
|
// EmbedBlock.jsx's commitUrl) — this command just gets there in one
|
|
4542
4600
|
// step instead of via "/video" first.
|
|
4543
4601
|
keywords: ["embed", "link", "youtube", "vimeo", "loom", "figma", "codepen", "spotify"],
|
|
4544
|
-
run:
|
|
4602
|
+
run: dn("oembed")
|
|
4545
4603
|
}
|
|
4546
4604
|
]
|
|
4547
|
-
}),
|
|
4548
|
-
function
|
|
4549
|
-
|
|
4605
|
+
}), Ot = /* @__PURE__ */ new Set();
|
|
4606
|
+
function Rs(e) {
|
|
4607
|
+
Ot.add(e);
|
|
4550
4608
|
}
|
|
4551
|
-
function
|
|
4552
|
-
return
|
|
4609
|
+
function Ls(e) {
|
|
4610
|
+
return Ot.has(e) ? (Ot.delete(e), !0) : !1;
|
|
4553
4611
|
}
|
|
4554
|
-
function
|
|
4612
|
+
function As(e, t, n) {
|
|
4555
4613
|
var s;
|
|
4556
4614
|
const o = e.getBlock(t), r = ((s = o == null ? void 0 : o.props) == null ? void 0 : s.titleRunIds) ?? (o == null ? void 0 : o.contentIds) ?? [], l = r.indexOf(n), a = l >= 0 ? r[l + 1] : void 0;
|
|
4557
4615
|
if (a) {
|
|
@@ -4560,12 +4618,12 @@ function Ts(e, t, n) {
|
|
|
4560
4618
|
}
|
|
4561
4619
|
Ye(e, t, U("paragraph"));
|
|
4562
4620
|
}
|
|
4563
|
-
function
|
|
4621
|
+
function Ms({ id: e, blockId: t }) {
|
|
4564
4622
|
const n = K(), o = qe(e), r = _(null);
|
|
4565
|
-
r.current === null && (r.current =
|
|
4566
|
-
const l =
|
|
4623
|
+
r.current === null && (r.current = Ls(e));
|
|
4624
|
+
const l = m(
|
|
4567
4625
|
(u) => {
|
|
4568
|
-
n.applyOperation(de(e, { data: { ...o == null ? void 0 : o.data, selectedValue: u } })), r.current &&
|
|
4626
|
+
n.applyOperation(de(e, { data: { ...o == null ? void 0 : o.data, selectedValue: u } })), r.current && As(n, t, e);
|
|
4569
4627
|
},
|
|
4570
4628
|
[n, e, o == null ? void 0 : o.data, t]
|
|
4571
4629
|
);
|
|
@@ -4593,11 +4651,11 @@ function Cs({ id: e, blockId: t }) {
|
|
|
4593
4651
|
}
|
|
4594
4652
|
);
|
|
4595
4653
|
}
|
|
4596
|
-
function
|
|
4597
|
-
const s = e.getRun(n), c = (s == null ? void 0 : s.value) ?? "", u = c.slice(0, o), p = c.slice(r), i = l(), f = { ...s, value: u },
|
|
4598
|
-
e.applyOperation(
|
|
4654
|
+
function Vt(e, { blockId: t, runId: n, sliceStart: o, sliceEnd: r }, l, { autoOpen: a = !1 } = {}) {
|
|
4655
|
+
const s = e.getRun(n), c = (s == null ? void 0 : s.value) ?? "", u = c.slice(0, o), p = c.slice(r), i = l(), f = { ...s, value: u }, y = { id: C(), type: "text", value: p, marks: { ...s == null ? void 0 : s.marks } };
|
|
4656
|
+
e.applyOperation(Ao(t, [n], [f, i, y])), a ? Rs(i.id) : ve(y.id);
|
|
4599
4657
|
}
|
|
4600
|
-
function
|
|
4658
|
+
function Es(e) {
|
|
4601
4659
|
return String(e).replace(/&/g, "&").replace(/"/g, """);
|
|
4602
4660
|
}
|
|
4603
4661
|
function Zn(e) {
|
|
@@ -4605,15 +4663,15 @@ function Zn(e) {
|
|
|
4605
4663
|
const { options: t = [], selectedValue: n = "" } = e.data ?? {};
|
|
4606
4664
|
return ((o = t.find((r) => r.value === n)) == null ? void 0 : o.label) ?? "";
|
|
4607
4665
|
}
|
|
4608
|
-
function
|
|
4666
|
+
function $s(e) {
|
|
4609
4667
|
var n, o;
|
|
4610
4668
|
const t = Zn(e) || ((n = e.data) == null ? void 0 : n.placeholder) || "";
|
|
4611
|
-
return `<span data-inline-type="select" data-selected-value="${
|
|
4669
|
+
return `<span data-inline-type="select" data-selected-value="${Es(((o = e.data) == null ? void 0 : o.selectedValue) ?? "")}">${t}</span>`;
|
|
4612
4670
|
}
|
|
4613
|
-
function
|
|
4671
|
+
function xs(e) {
|
|
4614
4672
|
return Zn(e);
|
|
4615
4673
|
}
|
|
4616
|
-
function
|
|
4674
|
+
function Os(e) {
|
|
4617
4675
|
var t;
|
|
4618
4676
|
return ((t = e.getAttribute) == null ? void 0 : t.call(e, "data-inline-type")) !== "select" ? null : {
|
|
4619
4677
|
id: C(),
|
|
@@ -4626,17 +4684,17 @@ function Ls(e) {
|
|
|
4626
4684
|
}
|
|
4627
4685
|
};
|
|
4628
4686
|
}
|
|
4629
|
-
const
|
|
4687
|
+
const Ss = bt({
|
|
4630
4688
|
name: "select",
|
|
4631
|
-
component:
|
|
4632
|
-
toHTML:
|
|
4633
|
-
toPlainText:
|
|
4634
|
-
fromHTML:
|
|
4689
|
+
component: Ms,
|
|
4690
|
+
toHTML: $s,
|
|
4691
|
+
toPlainText: xs,
|
|
4692
|
+
fromHTML: Os,
|
|
4635
4693
|
slashCommand: {
|
|
4636
4694
|
label: "Select",
|
|
4637
4695
|
icon: Mo,
|
|
4638
4696
|
keywords: ["select", "dropdown", "choice", "picker"],
|
|
4639
|
-
run: (e, { blockId: t, runId: n, sliceStart: o, sliceEnd: r }) =>
|
|
4697
|
+
run: (e, { blockId: t, runId: n, sliceStart: o, sliceEnd: r }) => Vt(
|
|
4640
4698
|
e,
|
|
4641
4699
|
{ blockId: t, runId: n, sliceStart: o, sliceEnd: r },
|
|
4642
4700
|
() => ({
|
|
@@ -4650,8 +4708,8 @@ const Ms = bt({
|
|
|
4650
4708
|
)
|
|
4651
4709
|
}
|
|
4652
4710
|
});
|
|
4653
|
-
function
|
|
4654
|
-
const t = K(), n = qe(e), o =
|
|
4711
|
+
function Ds({ id: e }) {
|
|
4712
|
+
const t = K(), n = qe(e), o = m(
|
|
4655
4713
|
(l) => {
|
|
4656
4714
|
t.applyOperation(de(e, { data: { ...n == null ? void 0 : n.data, isoDate: l.target.value } }));
|
|
4657
4715
|
},
|
|
@@ -4669,7 +4727,7 @@ function As({ id: e }) {
|
|
|
4669
4727
|
}
|
|
4670
4728
|
);
|
|
4671
4729
|
}
|
|
4672
|
-
function
|
|
4730
|
+
function Hs(e) {
|
|
4673
4731
|
return String(e).replace(/&/g, "&").replace(/"/g, """);
|
|
4674
4732
|
}
|
|
4675
4733
|
function eo(e) {
|
|
@@ -4677,16 +4735,16 @@ function eo(e) {
|
|
|
4677
4735
|
const t = /* @__PURE__ */ new Date(`${e}T00:00:00`);
|
|
4678
4736
|
return Number.isNaN(t.getTime()) ? e : t.toLocaleDateString(void 0, { year: "numeric", month: "short", day: "numeric" });
|
|
4679
4737
|
}
|
|
4680
|
-
function
|
|
4738
|
+
function Ps(e) {
|
|
4681
4739
|
var n;
|
|
4682
4740
|
const t = ((n = e.data) == null ? void 0 : n.isoDate) ?? "";
|
|
4683
|
-
return `<span data-inline-type="date" data-iso-date="${
|
|
4741
|
+
return `<span data-inline-type="date" data-iso-date="${Hs(t)}">${eo(t)}</span>`;
|
|
4684
4742
|
}
|
|
4685
|
-
function
|
|
4743
|
+
function _s(e) {
|
|
4686
4744
|
var t;
|
|
4687
4745
|
return eo(((t = e.data) == null ? void 0 : t.isoDate) ?? "");
|
|
4688
4746
|
}
|
|
4689
|
-
function
|
|
4747
|
+
function Us(e) {
|
|
4690
4748
|
var t;
|
|
4691
4749
|
return ((t = e.getAttribute) == null ? void 0 : t.call(e, "data-inline-type")) !== "date" ? null : {
|
|
4692
4750
|
id: C(),
|
|
@@ -4696,37 +4754,37 @@ function Os(e) {
|
|
|
4696
4754
|
data: { isoDate: e.getAttribute("data-iso-date") ?? "" }
|
|
4697
4755
|
};
|
|
4698
4756
|
}
|
|
4699
|
-
function
|
|
4757
|
+
function js() {
|
|
4700
4758
|
return (/* @__PURE__ */ new Date()).toISOString().slice(0, 10);
|
|
4701
4759
|
}
|
|
4702
|
-
const
|
|
4760
|
+
const Fs = bt({
|
|
4703
4761
|
name: "date",
|
|
4704
|
-
component:
|
|
4705
|
-
toHTML:
|
|
4706
|
-
toPlainText:
|
|
4707
|
-
fromHTML:
|
|
4762
|
+
component: Ds,
|
|
4763
|
+
toHTML: Ps,
|
|
4764
|
+
toPlainText: _s,
|
|
4765
|
+
fromHTML: Us,
|
|
4708
4766
|
slashCommand: {
|
|
4709
4767
|
label: "Date",
|
|
4710
|
-
icon:
|
|
4768
|
+
icon: Eo,
|
|
4711
4769
|
keywords: ["date", "when", "schedule", "calendar"],
|
|
4712
|
-
run: (e, { blockId: t, runId: n, sliceStart: o, sliceEnd: r }) =>
|
|
4770
|
+
run: (e, { blockId: t, runId: n, sliceStart: o, sliceEnd: r }) => Vt(e, { blockId: t, runId: n, sliceStart: o, sliceEnd: r }, () => ({
|
|
4713
4771
|
id: C(),
|
|
4714
4772
|
type: "date",
|
|
4715
4773
|
value: "",
|
|
4716
4774
|
marks: {},
|
|
4717
|
-
data: { isoDate:
|
|
4775
|
+
data: { isoDate: js() }
|
|
4718
4776
|
}))
|
|
4719
4777
|
}
|
|
4720
4778
|
});
|
|
4721
|
-
function
|
|
4722
|
-
const t = K(), n = qe(e), o =
|
|
4779
|
+
function Ks({ id: e }) {
|
|
4780
|
+
const t = K(), n = qe(e), o = m(
|
|
4723
4781
|
(s) => {
|
|
4724
4782
|
t.applyOperation(
|
|
4725
4783
|
de(e, { data: { ...n == null ? void 0 : n.data, checked: s.target.checked } })
|
|
4726
4784
|
);
|
|
4727
4785
|
},
|
|
4728
4786
|
[t, e, n == null ? void 0 : n.data]
|
|
4729
|
-
), r =
|
|
4787
|
+
), r = m(
|
|
4730
4788
|
(s) => {
|
|
4731
4789
|
t.applyOperation(de(e, { data: { ...n == null ? void 0 : n.data, label: s.target.value } }));
|
|
4732
4790
|
},
|
|
@@ -4764,18 +4822,18 @@ function Hs({ id: e }) {
|
|
|
4764
4822
|
}
|
|
4765
4823
|
);
|
|
4766
4824
|
}
|
|
4767
|
-
function
|
|
4825
|
+
function zs(e) {
|
|
4768
4826
|
return String(e).replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">");
|
|
4769
4827
|
}
|
|
4770
|
-
function
|
|
4828
|
+
function Vs(e) {
|
|
4771
4829
|
const { checked: t = !1, label: n = "" } = e.data ?? {};
|
|
4772
|
-
return `<span data-inline-type="checkbox" data-checked="${t}">${t ? "☑" : "☐"} ${
|
|
4830
|
+
return `<span data-inline-type="checkbox" data-checked="${t}">${t ? "☑" : "☐"} ${zs(n)}</span>`;
|
|
4773
4831
|
}
|
|
4774
|
-
function
|
|
4832
|
+
function Gs(e) {
|
|
4775
4833
|
const { checked: t = !1, label: n = "" } = e.data ?? {};
|
|
4776
4834
|
return `${t ? "[x]" : "[ ]"} ${n}`.trim();
|
|
4777
4835
|
}
|
|
4778
|
-
function
|
|
4836
|
+
function Ws(e) {
|
|
4779
4837
|
var t;
|
|
4780
4838
|
return ((t = e.getAttribute) == null ? void 0 : t.call(e, "data-inline-type")) !== "checkbox" ? null : {
|
|
4781
4839
|
id: C(),
|
|
@@ -4788,17 +4846,17 @@ function js(e) {
|
|
|
4788
4846
|
}
|
|
4789
4847
|
};
|
|
4790
4848
|
}
|
|
4791
|
-
const
|
|
4849
|
+
const qs = bt({
|
|
4792
4850
|
name: "checkbox",
|
|
4793
|
-
component:
|
|
4794
|
-
toHTML:
|
|
4795
|
-
toPlainText:
|
|
4796
|
-
fromHTML:
|
|
4851
|
+
component: Ks,
|
|
4852
|
+
toHTML: Vs,
|
|
4853
|
+
toPlainText: Gs,
|
|
4854
|
+
fromHTML: Ws,
|
|
4797
4855
|
slashCommand: {
|
|
4798
4856
|
label: "Checkbox",
|
|
4799
|
-
icon:
|
|
4857
|
+
icon: Ht,
|
|
4800
4858
|
keywords: ["checkbox", "todo", "check", "toggle"],
|
|
4801
|
-
run: (e, { blockId: t, runId: n, sliceStart: o, sliceEnd: r }) =>
|
|
4859
|
+
run: (e, { blockId: t, runId: n, sliceStart: o, sliceEnd: r }) => Vt(e, { blockId: t, runId: n, sliceStart: o, sliceEnd: r }, () => ({
|
|
4802
4860
|
id: C(),
|
|
4803
4861
|
type: "checkbox",
|
|
4804
4862
|
value: "",
|
|
@@ -4807,12 +4865,12 @@ const Fs = bt({
|
|
|
4807
4865
|
}))
|
|
4808
4866
|
}
|
|
4809
4867
|
});
|
|
4810
|
-
function
|
|
4811
|
-
var
|
|
4812
|
-
const n = K(), o = qe(e), r = t ? n.getBlock(t) : null, l = r ? n.getBlock(r.parentId) : null, a = (l == null ? void 0 : l.parentId) ?? null, s = te(a), c = l ? l.contentIds.indexOf(t) : -1, p = (((
|
|
4868
|
+
function Ys({ id: e, blockId: t }) {
|
|
4869
|
+
var y;
|
|
4870
|
+
const n = K(), o = qe(e), r = t ? n.getBlock(t) : null, l = r ? n.getBlock(r.parentId) : null, a = (l == null ? void 0 : l.parentId) ?? null, s = te(a), c = l ? l.contentIds.indexOf(t) : -1, p = (((y = (s && l ? fe(s, l.contentIds.length) : [])[c]) == null ? void 0 : y.options) ?? []).map((v, g) => ({
|
|
4813
4871
|
...v,
|
|
4814
|
-
color: v.color ??
|
|
4815
|
-
})), i =
|
|
4872
|
+
color: v.color ?? Et(g)
|
|
4873
|
+
})), i = m(
|
|
4816
4874
|
(v, g) => {
|
|
4817
4875
|
n.applyOperation(
|
|
4818
4876
|
de(e, { data: { selectedValue: v, selectedLabel: (g == null ? void 0 : g.label) ?? "" } })
|
|
@@ -4847,18 +4905,18 @@ function Ks({ id: e, blockId: t }) {
|
|
|
4847
4905
|
function to(e) {
|
|
4848
4906
|
return String(e).replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">");
|
|
4849
4907
|
}
|
|
4850
|
-
function
|
|
4908
|
+
function Xs(e) {
|
|
4851
4909
|
return to(e).replace(/"/g, """);
|
|
4852
4910
|
}
|
|
4853
|
-
function
|
|
4911
|
+
function Qs(e) {
|
|
4854
4912
|
const { selectedValue: t = "", selectedLabel: n = "" } = e.data ?? {};
|
|
4855
|
-
return `<span data-inline-type="tableSelect" data-selected-value="${
|
|
4913
|
+
return `<span data-inline-type="tableSelect" data-selected-value="${Xs(t)}">${to(n)}</span>`;
|
|
4856
4914
|
}
|
|
4857
|
-
function
|
|
4915
|
+
function Js(e) {
|
|
4858
4916
|
var t;
|
|
4859
4917
|
return ((t = e.data) == null ? void 0 : t.selectedLabel) ?? "";
|
|
4860
4918
|
}
|
|
4861
|
-
function
|
|
4919
|
+
function Zs(e) {
|
|
4862
4920
|
var t;
|
|
4863
4921
|
return ((t = e.getAttribute) == null ? void 0 : t.call(e, "data-inline-type")) !== "tableSelect" ? null : {
|
|
4864
4922
|
id: C(),
|
|
@@ -4871,120 +4929,120 @@ function Ws(e) {
|
|
|
4871
4929
|
}
|
|
4872
4930
|
};
|
|
4873
4931
|
}
|
|
4874
|
-
const
|
|
4932
|
+
const ec = bt({
|
|
4875
4933
|
name: "tableSelect",
|
|
4876
|
-
component:
|
|
4877
|
-
toHTML:
|
|
4878
|
-
toPlainText:
|
|
4879
|
-
fromHTML:
|
|
4934
|
+
component: Ys,
|
|
4935
|
+
toHTML: Qs,
|
|
4936
|
+
toPlainText: Js,
|
|
4937
|
+
fromHTML: Zs
|
|
4880
4938
|
// No slashCommand: unlike select/date/custom field types, this type is never
|
|
4881
4939
|
// inserted ad-hoc into a paragraph — it only exists inside a table cell
|
|
4882
4940
|
// whose column type has been set to "select" (see setColumnType).
|
|
4883
|
-
}),
|
|
4884
|
-
|
|
4885
|
-
|
|
4886
|
-
|
|
4941
|
+
}), tc = { name: "emoji", kind: "inline" }, nc = [
|
|
4942
|
+
kr,
|
|
4943
|
+
Nr,
|
|
4944
|
+
sl,
|
|
4945
|
+
sa,
|
|
4946
|
+
aa,
|
|
4887
4947
|
la,
|
|
4888
|
-
|
|
4889
|
-
|
|
4890
|
-
|
|
4891
|
-
|
|
4892
|
-
|
|
4893
|
-
|
|
4894
|
-
|
|
4895
|
-
|
|
4896
|
-
|
|
4897
|
-
ls,
|
|
4898
|
-
vs,
|
|
4948
|
+
pa,
|
|
4949
|
+
da,
|
|
4950
|
+
ka,
|
|
4951
|
+
Na,
|
|
4952
|
+
$a,
|
|
4953
|
+
za,
|
|
4954
|
+
ts,
|
|
4955
|
+
ds,
|
|
4956
|
+
Ns,
|
|
4899
4957
|
ro,
|
|
4900
|
-
|
|
4901
|
-
Ds,
|
|
4958
|
+
Ss,
|
|
4902
4959
|
Fs,
|
|
4903
4960
|
qs,
|
|
4904
|
-
|
|
4961
|
+
ec,
|
|
4962
|
+
tc
|
|
4905
4963
|
];
|
|
4906
|
-
function
|
|
4964
|
+
function mc({ exclude: e = [] } = {}) {
|
|
4907
4965
|
const t = new Set(e);
|
|
4908
|
-
return
|
|
4966
|
+
return nc.filter((n) => !t.has(n.name));
|
|
4909
4967
|
}
|
|
4910
4968
|
export {
|
|
4911
|
-
|
|
4912
|
-
|
|
4969
|
+
Lr as $,
|
|
4970
|
+
jt as A,
|
|
4913
4971
|
xe as B,
|
|
4914
|
-
|
|
4915
|
-
|
|
4972
|
+
ar as C,
|
|
4973
|
+
fc as D,
|
|
4916
4974
|
ge as E,
|
|
4917
4975
|
kt as F,
|
|
4918
|
-
|
|
4919
|
-
|
|
4976
|
+
Al as G,
|
|
4977
|
+
Wo as H,
|
|
4920
4978
|
Ue as I,
|
|
4921
|
-
|
|
4922
|
-
|
|
4923
|
-
|
|
4924
|
-
|
|
4979
|
+
Dr as J,
|
|
4980
|
+
Hr as K,
|
|
4981
|
+
Vo as L,
|
|
4982
|
+
Pr as M,
|
|
4925
4983
|
Un as N,
|
|
4926
|
-
|
|
4927
|
-
|
|
4928
|
-
|
|
4929
|
-
|
|
4984
|
+
va as O,
|
|
4985
|
+
vl as P,
|
|
4986
|
+
tn as Q,
|
|
4987
|
+
xa as R,
|
|
4930
4988
|
We as S,
|
|
4931
|
-
|
|
4932
|
-
|
|
4933
|
-
|
|
4934
|
-
|
|
4935
|
-
|
|
4936
|
-
|
|
4937
|
-
|
|
4938
|
-
|
|
4939
|
-
|
|
4940
|
-
|
|
4989
|
+
Sr as T,
|
|
4990
|
+
Ls as U,
|
|
4991
|
+
As as V,
|
|
4992
|
+
Vt as W,
|
|
4993
|
+
Ll as X,
|
|
4994
|
+
Et as Y,
|
|
4995
|
+
gl as Z,
|
|
4996
|
+
hl as _,
|
|
4997
|
+
pa as a,
|
|
4998
|
+
Ur as a0,
|
|
4941
4999
|
Hn as a1,
|
|
4942
|
-
|
|
5000
|
+
cl as a2,
|
|
4943
5001
|
It as a3,
|
|
4944
|
-
|
|
5002
|
+
Ft as a4,
|
|
4945
5003
|
Ee as a5,
|
|
4946
5004
|
ze as a6,
|
|
4947
|
-
|
|
4948
|
-
|
|
4949
|
-
|
|
4950
|
-
|
|
4951
|
-
|
|
5005
|
+
_l as a7,
|
|
5006
|
+
ul as a8,
|
|
5007
|
+
yl as a9,
|
|
5008
|
+
dl as aa,
|
|
5009
|
+
Kt as ab,
|
|
4952
5010
|
Kn as ac,
|
|
4953
|
-
|
|
4954
|
-
|
|
4955
|
-
|
|
4956
|
-
|
|
4957
|
-
|
|
5011
|
+
wl as ad,
|
|
5012
|
+
Il as ae,
|
|
5013
|
+
kl as af,
|
|
5014
|
+
Tl as ag,
|
|
5015
|
+
Cl as ah,
|
|
4958
5016
|
ht as ai,
|
|
4959
|
-
|
|
4960
|
-
|
|
4961
|
-
|
|
4962
|
-
|
|
5017
|
+
Nl as aj,
|
|
5018
|
+
nn as ak,
|
|
5019
|
+
on as al,
|
|
5020
|
+
mc as am,
|
|
4963
5021
|
Dn as an,
|
|
4964
|
-
|
|
4965
|
-
|
|
4966
|
-
|
|
4967
|
-
|
|
4968
|
-
|
|
4969
|
-
|
|
4970
|
-
|
|
4971
|
-
|
|
4972
|
-
|
|
4973
|
-
|
|
4974
|
-
|
|
4975
|
-
|
|
4976
|
-
|
|
4977
|
-
|
|
4978
|
-
|
|
4979
|
-
|
|
4980
|
-
|
|
4981
|
-
|
|
4982
|
-
|
|
5022
|
+
aa as b,
|
|
5023
|
+
sa as c,
|
|
5024
|
+
ds as d,
|
|
5025
|
+
Ns as e,
|
|
5026
|
+
ts as f,
|
|
5027
|
+
za as g,
|
|
5028
|
+
$a as h,
|
|
5029
|
+
Na as i,
|
|
5030
|
+
ka as j,
|
|
5031
|
+
sl as k,
|
|
5032
|
+
da as l,
|
|
5033
|
+
Nr as m,
|
|
5034
|
+
ec as n,
|
|
5035
|
+
tc as o,
|
|
5036
|
+
kr as p,
|
|
5037
|
+
qs as q,
|
|
5038
|
+
Fs as r,
|
|
5039
|
+
Ss as s,
|
|
5040
|
+
la as t,
|
|
4983
5041
|
fe as u,
|
|
4984
5042
|
Le as v,
|
|
4985
|
-
|
|
4986
|
-
|
|
4987
|
-
|
|
5043
|
+
Ut as w,
|
|
5044
|
+
$r as x,
|
|
5045
|
+
Or as y,
|
|
4988
5046
|
vt as z
|
|
4989
5047
|
};
|
|
4990
|
-
//# sourceMappingURL=starter-kit-
|
|
5048
|
+
//# sourceMappingURL=starter-kit-Bp30PiE4.js.map
|