noteloom 0.4.0 → 0.6.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/README.md +162 -1026
- package/dist/canvas.cjs +1 -1
- package/dist/canvas.js +1 -1
- package/dist/collab.cjs +1 -1
- package/dist/collab.cjs.map +1 -1
- package/dist/collab.js +157 -102
- package/dist/collab.js.map +1 -1
- package/dist/comments.cjs +1 -1
- package/dist/comments.js +3 -3
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +29 -1
- package/dist/index.js +1600 -1542
- package/dist/index.js.map +1 -1
- package/dist/shared/{CommentThreadCard-CAJ3oPdr.cjs → CommentThreadCard-DcCHq2Dy.cjs} +2 -2
- package/dist/shared/{CommentThreadCard-CAJ3oPdr.cjs.map → CommentThreadCard-DcCHq2Dy.cjs.map} +1 -1
- package/dist/shared/{CommentThreadCard-Cxf8GwHJ.js → CommentThreadCard-DwtE85Xx.js} +2 -2
- package/dist/shared/{CommentThreadCard-Cxf8GwHJ.js.map → CommentThreadCard-DwtE85Xx.js.map} +1 -1
- package/dist/shared/{CommentsPanel-CES4uzye.cjs → CommentsPanel-BRgACUu_.cjs} +2 -2
- package/dist/shared/{CommentsPanel-CES4uzye.cjs.map → CommentsPanel-BRgACUu_.cjs.map} +1 -1
- package/dist/shared/{CommentsPanel-BwVVyMOC.js → CommentsPanel-D4eP-K_f.js} +3 -3
- package/dist/shared/{CommentsPanel-BwVVyMOC.js.map → CommentsPanel-D4eP-K_f.js.map} +1 -1
- package/dist/shared/VersionHistory-BRBYQgj5.cjs +12 -0
- package/dist/shared/VersionHistory-BRBYQgj5.cjs.map +1 -0
- package/dist/shared/{VersionHistory-Bg6fufP5.js → VersionHistory-D9sIIAYN.js} +221 -206
- package/dist/shared/VersionHistory-D9sIIAYN.js.map +1 -0
- package/dist/shared/VoiceListeningIndicator-DgLMmGSP.js +342 -0
- package/dist/shared/VoiceListeningIndicator-DgLMmGSP.js.map +1 -0
- package/dist/shared/VoiceListeningIndicator-Dw0fggpE.cjs +2 -0
- package/dist/shared/VoiceListeningIndicator-Dw0fggpE.cjs.map +1 -0
- package/dist/shared/{icons-C1_s0jKK.js → icons-Bdptdx1e.js} +307 -277
- package/dist/shared/{icons-C1_s0jKK.js.map → icons-Bdptdx1e.js.map} +1 -1
- package/dist/shared/{icons-DtCsXuU6.cjs → icons-DabR_JDW.cjs} +3 -3
- package/dist/shared/{icons-DtCsXuU6.cjs.map → icons-DabR_JDW.cjs.map} +1 -1
- package/dist/shared/{index-D9WEXpYM.cjs → index-B7_F6NA9.cjs} +2 -2
- package/dist/shared/{index-D9WEXpYM.cjs.map → index-B7_F6NA9.cjs.map} +1 -1
- package/dist/shared/{index-B9jyyL8u.js → index-DOIEccLM.js} +52 -52
- package/dist/shared/{index-B9jyyL8u.js.map → index-DOIEccLM.js.map} +1 -1
- package/dist/shared/{leafBlockFactory-A9eUhSe-.js → leafBlockFactory-ChlzpKIn.js} +2 -2
- package/dist/shared/{leafBlockFactory-A9eUhSe-.js.map → leafBlockFactory-ChlzpKIn.js.map} +1 -1
- package/dist/shared/{leafBlockFactory-Dp382eP8.cjs → leafBlockFactory-D3SCDvzc.cjs} +2 -2
- package/dist/shared/{leafBlockFactory-Dp382eP8.cjs.map → leafBlockFactory-D3SCDvzc.cjs.map} +1 -1
- package/dist/shared/{serialize-T9Odwx24.js → serialize-C1rjLsIz.js} +2 -2
- package/dist/shared/{serialize-T9Odwx24.js.map → serialize-C1rjLsIz.js.map} +1 -1
- package/dist/shared/{serialize-DWEfk0vU.cjs → serialize-k0zXqwEM.cjs} +2 -2
- package/dist/shared/{serialize-DWEfk0vU.cjs.map → serialize-k0zXqwEM.cjs.map} +1 -1
- package/dist/shared/{starter-kit-CY5wzYDf.js → starter-kit-CJzWMyF8.js} +683 -673
- package/dist/shared/{starter-kit-CY5wzYDf.js.map → starter-kit-CJzWMyF8.js.map} +1 -1
- package/dist/shared/starter-kit-Ch2LEpzF.cjs +27 -0
- package/dist/shared/{starter-kit-lPN-NpJ5.cjs.map → starter-kit-Ch2LEpzF.cjs.map} +1 -1
- package/dist/shared/{usePopoverEdgeClamp-gmFm0CnI.js → usePopoverEdgeClamp-B9KNv9SE.js} +2 -2
- package/dist/shared/{usePopoverEdgeClamp-gmFm0CnI.js.map → usePopoverEdgeClamp-B9KNv9SE.js.map} +1 -1
- package/dist/shared/{usePopoverEdgeClamp-CDG26jBM.cjs → usePopoverEdgeClamp-gRlLQeVG.cjs} +2 -2
- package/dist/shared/{usePopoverEdgeClamp-CDG26jBM.cjs.map → usePopoverEdgeClamp-gRlLQeVG.cjs.map} +1 -1
- package/dist/starter-kit.cjs +1 -1
- package/dist/starter-kit.js +2 -2
- 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 +2 -2
- package/dist/shared/VersionHistory-Bg6fufP5.js.map +0 -1
- package/dist/shared/VersionHistory-DELa2Wbq.cjs +0 -12
- package/dist/shared/VersionHistory-DELa2Wbq.cjs.map +0 -1
- package/dist/shared/VoiceListeningIndicator-BOfVmLK0.js +0 -338
- package/dist/shared/VoiceListeningIndicator-BOfVmLK0.js.map +0 -1
- package/dist/shared/VoiceListeningIndicator-DNX8JlQM.cjs +0 -2
- package/dist/shared/VoiceListeningIndicator-DNX8JlQM.cjs.map +0 -1
- package/dist/shared/starter-kit-lPN-NpJ5.cjs +0 -27
|
@@ -1,19 +1,19 @@
|
|
|
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
|
|
3
|
+
var zt = (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 Me, i as Ae, j as ct, k as gt, l as he, e as bt, c as ro } from "./index-DOIEccLM.js";
|
|
5
5
|
import { jsx as d, jsxs as T, Fragment as Te } from "react/jsx-runtime";
|
|
6
|
-
import { useState as O, useEffect as oe, useCallback as h, useLayoutEffect as
|
|
7
|
-
import { createPortal as
|
|
8
|
-
import { l as
|
|
9
|
-
import { m as Eo, b as
|
|
10
|
-
import { M as Ht, b as Ho, d as Po, c as On, a as _o, e as Uo } from "./usePopoverEdgeClamp-
|
|
11
|
-
import { a as jo } from "./CommentThreadCard-
|
|
12
|
-
import { c as Fo, r as
|
|
6
|
+
import { useState as O, useEffect as oe, useCallback as h, useLayoutEffect as at, useRef as _, useSyncExternalStore as un, Component as lo, Fragment as ao, memo as so, useMemo as Ve } from "react";
|
|
7
|
+
import { createPortal as He } from "react-dom";
|
|
8
|
+
import { l as de, P as co, X as it, b as dn, a as K, E as Ot, u as io, a8 as Pe, o as Ge, g as C, n as q, k as ke, s as Lt, G as se, J as pn, aq as fn, ar as mn, as as hn, D as gn, at as bn, au as yn, av as St, ae as Oe, aw as kn, ax as vn, ak as In, m as yt, a1 as uo, j as G, ah as wn, ay as po, a2 as fo, K as Tn, L as Cn, a4 as mo, a5 as ho, az as Bn, aA as Rn, T as Nn, a0 as go, aj as Dt, am as bo, aB as yo, aC as ko, aD as vo, ap as Io, aE as wo, a6 as To, aF as Co, ad as Ln, aG as Mn, aH as Bo, aI as Ro, aJ as No, r as Lo, al as Mo, aK as Ao } from "./icons-Bdptdx1e.js";
|
|
9
|
+
import { m as Eo, b as An, j as ve, E as En, l as $o, c as U, n as xo, i as Ye, o as Xe, p as le, t as re, a as be, q as $n, u as Oo, d as xn, r as So, f as Do } from "./leafBlockFactory-ChlzpKIn.js";
|
|
10
|
+
import { M as Ht, b as Ho, d as Po, c as On, a as _o, e as Uo } from "./usePopoverEdgeClamp-B9KNv9SE.js";
|
|
11
|
+
import { a as jo } from "./CommentThreadCard-DwtE85Xx.js";
|
|
12
|
+
import { c as Fo, r as Ko } from "./serialize-C1rjLsIz.js";
|
|
13
13
|
function Sn(e) {
|
|
14
14
|
return e ? e.type !== "text" ? !1 : (e.value ?? "") === "" : !0;
|
|
15
15
|
}
|
|
16
|
-
function
|
|
16
|
+
function ge(e, t) {
|
|
17
17
|
return !t || t.length === 0 ? !0 : t.every((n) => Sn(e.getRun(n)));
|
|
18
18
|
}
|
|
19
19
|
function kt(e, t) {
|
|
@@ -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 zo({
|
|
26
26
|
isOpen: e,
|
|
27
27
|
initialHref: t,
|
|
28
28
|
initialTarget: n,
|
|
@@ -71,19 +71,19 @@ function Ko({
|
|
|
71
71
|
}
|
|
72
72
|
function vt(e, t, n, o) {
|
|
73
73
|
const [r, l] = O(null);
|
|
74
|
-
return
|
|
74
|
+
return at(() => {
|
|
75
75
|
if (n == null || o == null) {
|
|
76
76
|
l(null);
|
|
77
77
|
return;
|
|
78
78
|
}
|
|
79
79
|
l({ top: n, left: o });
|
|
80
|
-
}, [n, o]),
|
|
80
|
+
}, [n, o]), at(() => {
|
|
81
81
|
if (!t || !e.current || !r) return;
|
|
82
82
|
const a = e.current.getBoundingClientRect(), s = Ho(r.left, a.width), c = Po(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
|
-
function
|
|
86
|
+
function Go({ containerRef: e, store: t }) {
|
|
87
87
|
var m;
|
|
88
88
|
const [n, o] = O(null), [r, l] = O(!1), a = _(null), s = _(null), c = h(() => {
|
|
89
89
|
a.current && (clearTimeout(a.current), a.current = null);
|
|
@@ -96,16 +96,16 @@ function Vo({ containerRef: e, store: t }) {
|
|
|
96
96
|
const y = e.current;
|
|
97
97
|
if (!y) return;
|
|
98
98
|
const B = (D) => {
|
|
99
|
-
var
|
|
100
|
-
const
|
|
101
|
-
if (!
|
|
102
|
-
const $ =
|
|
103
|
-
(N =
|
|
104
|
-
(x) => (x == null ? void 0 : x.runId) === $ ? x : { runId: $, rect:
|
|
99
|
+
var j, w, N;
|
|
100
|
+
const L = (w = (j = D.target).closest) == null ? void 0 : w.call(j, "[data-run-id]");
|
|
101
|
+
if (!L || !y.contains(L)) return;
|
|
102
|
+
const $ = L.dataset.runId, E = t.getRun($);
|
|
103
|
+
(N = E == null ? void 0 : E.marks) != null && N.link && (c(), o(
|
|
104
|
+
(x) => (x == null ? void 0 : x.runId) === $ ? x : { runId: $, rect: L.getBoundingClientRect() }
|
|
105
105
|
));
|
|
106
|
-
},
|
|
107
|
-
return y.addEventListener("mouseover", B), y.addEventListener("mouseout",
|
|
108
|
-
y.removeEventListener("mouseover", B), y.removeEventListener("mouseout",
|
|
106
|
+
}, S = () => u();
|
|
107
|
+
return y.addEventListener("mouseover", B), y.addEventListener("mouseout", S), () => {
|
|
108
|
+
y.removeEventListener("mouseover", B), y.removeEventListener("mouseout", S);
|
|
109
109
|
};
|
|
110
110
|
}, [e, t, c, u]), oe(() => () => c(), [c]);
|
|
111
111
|
const p = h(() => l(!0), []), i = h(() => {
|
|
@@ -113,9 +113,9 @@ function Vo({ containerRef: e, store: t }) {
|
|
|
113
113
|
}, []), f = h(
|
|
114
114
|
(y, B) => {
|
|
115
115
|
if (!n) return;
|
|
116
|
-
const
|
|
117
|
-
|
|
118
|
-
|
|
116
|
+
const S = t.getRun(n.runId);
|
|
117
|
+
S && (t.applyOperation(
|
|
118
|
+
de(n.runId, { marks: { ...S.marks, link: { href: y, target: B } } })
|
|
119
119
|
), i());
|
|
120
120
|
},
|
|
121
121
|
[n, t, i]
|
|
@@ -124,7 +124,7 @@ function Vo({ containerRef: e, store: t }) {
|
|
|
124
124
|
const y = t.getRun(n.runId);
|
|
125
125
|
if (!y) return;
|
|
126
126
|
const B = { ...y.marks };
|
|
127
|
-
delete B.link, t.applyOperation(
|
|
127
|
+
delete B.link, t.applyOperation(de(n.runId, { marks: B })), i();
|
|
128
128
|
}, [n, t, i]), v = n && t.getRun(n.runId), g = (m = v == null ? void 0 : v.marks) == null ? void 0 : m.link, k = !!(n && g && !r), I = vt(
|
|
129
129
|
s,
|
|
130
130
|
k,
|
|
@@ -132,7 +132,7 @@ function Vo({ containerRef: e, store: t }) {
|
|
|
132
132
|
n ? n.rect.left : null
|
|
133
133
|
);
|
|
134
134
|
return /* @__PURE__ */ T(Te, { children: [
|
|
135
|
-
k && I ?
|
|
135
|
+
k && I ? He(
|
|
136
136
|
/* @__PURE__ */ T(
|
|
137
137
|
"div",
|
|
138
138
|
{
|
|
@@ -172,7 +172,7 @@ function Vo({ containerRef: e, store: t }) {
|
|
|
172
172
|
onClick: b,
|
|
173
173
|
"aria-label": "Remove link",
|
|
174
174
|
title: "Remove link",
|
|
175
|
-
children: /* @__PURE__ */ d(
|
|
175
|
+
children: /* @__PURE__ */ d(it, { size: 13 })
|
|
176
176
|
}
|
|
177
177
|
)
|
|
178
178
|
]
|
|
@@ -181,7 +181,7 @@ function Vo({ containerRef: e, store: t }) {
|
|
|
181
181
|
document.body
|
|
182
182
|
) : null,
|
|
183
183
|
/* @__PURE__ */ d(
|
|
184
|
-
|
|
184
|
+
zo,
|
|
185
185
|
{
|
|
186
186
|
isOpen: r,
|
|
187
187
|
initialHref: (g == null ? void 0 : g.href) ?? "",
|
|
@@ -194,7 +194,7 @@ function Vo({ containerRef: e, store: t }) {
|
|
|
194
194
|
)
|
|
195
195
|
] });
|
|
196
196
|
}
|
|
197
|
-
function
|
|
197
|
+
function Vo({ 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(
|
|
@@ -204,7 +204,7 @@ function Go({ title: e, onClose: t }) {
|
|
|
204
204
|
className: "be-comment-popover-close",
|
|
205
205
|
onClick: t,
|
|
206
206
|
"aria-label": "Close",
|
|
207
|
-
children: /* @__PURE__ */ d(
|
|
207
|
+
children: /* @__PURE__ */ d(it, { size: 14 })
|
|
208
208
|
}
|
|
209
209
|
)
|
|
210
210
|
] });
|
|
@@ -221,23 +221,23 @@ function qo({ containerRef: e, store: t, authorId: n }) {
|
|
|
221
221
|
oe(() => {
|
|
222
222
|
const m = e.current;
|
|
223
223
|
if (!m) return;
|
|
224
|
-
const y = (
|
|
225
|
-
var
|
|
226
|
-
const $ = (
|
|
224
|
+
const y = (L) => {
|
|
225
|
+
var j, w, N;
|
|
226
|
+
const $ = (j = L == null ? void 0 : L.closest) == null ? void 0 : j.call(L, "[data-run-id]");
|
|
227
227
|
if (!$ || !m.contains($)) return null;
|
|
228
|
-
const
|
|
229
|
-
return
|
|
230
|
-
}, B = (
|
|
231
|
-
const $ = y(
|
|
228
|
+
const E = (N = (w = t.getRun($.dataset.runId)) == null ? void 0 : w.marks) == null ? void 0 : N.commentIds;
|
|
229
|
+
return E != null && E.length ? { runEl: $, commentIds: E } : null;
|
|
230
|
+
}, B = (L) => {
|
|
231
|
+
const $ = y(L.target);
|
|
232
232
|
$ && (i(), r(
|
|
233
|
-
(
|
|
233
|
+
(E) => E && E.runEl === $.runEl ? E : {
|
|
234
234
|
rect: $.runEl.getBoundingClientRect(),
|
|
235
235
|
commentIds: $.commentIds,
|
|
236
236
|
runEl: $.runEl
|
|
237
237
|
}
|
|
238
238
|
));
|
|
239
|
-
},
|
|
240
|
-
const $ = y(
|
|
239
|
+
}, S = () => f(), D = (L) => {
|
|
240
|
+
const $ = y(L.target);
|
|
241
241
|
if (!$) {
|
|
242
242
|
a(!1), r(null);
|
|
243
243
|
return;
|
|
@@ -248,14 +248,14 @@ function qo({ containerRef: e, store: t, authorId: n }) {
|
|
|
248
248
|
runEl: $.runEl
|
|
249
249
|
});
|
|
250
250
|
};
|
|
251
|
-
return m.addEventListener("mouseover", B), m.addEventListener("mouseout",
|
|
252
|
-
m.removeEventListener("mouseover", B), m.removeEventListener("mouseout",
|
|
251
|
+
return m.addEventListener("mouseover", B), m.addEventListener("mouseout", S), m.addEventListener("click", D), () => {
|
|
252
|
+
m.removeEventListener("mouseover", B), m.removeEventListener("mouseout", S), m.removeEventListener("click", D);
|
|
253
253
|
};
|
|
254
254
|
}, [e, t, i, f]), oe(() => {
|
|
255
255
|
if (!o) return;
|
|
256
256
|
const m = (B) => {
|
|
257
|
-
var
|
|
258
|
-
(
|
|
257
|
+
var S, D;
|
|
258
|
+
(S = c.current) != null && S.contains(B.target) || (D = e.current) != null && D.contains(B.target) || (a(!1), r(null));
|
|
259
259
|
}, y = (B) => {
|
|
260
260
|
B.key === "Escape" && (a(!1), r(null));
|
|
261
261
|
};
|
|
@@ -279,7 +279,7 @@ function qo({ containerRef: e, store: t, authorId: n }) {
|
|
|
279
279
|
l && c.current && !k.current ? (k.current = !0, u.current = document.activeElement, (c.current.querySelector(Wo) ?? c.current).focus()) : !l && k.current && (k.current = !1, (y = (m = u.current) == null ? void 0 : m.focus) == null || y.call(m), u.current = null);
|
|
280
280
|
}, [l, g]), !v || !g) return null;
|
|
281
281
|
const I = o.commentIds.map((m) => t.getComment(m)).filter(Boolean);
|
|
282
|
-
return I.length === 0 ? null :
|
|
282
|
+
return I.length === 0 ? null : He(
|
|
283
283
|
/* @__PURE__ */ T(
|
|
284
284
|
"div",
|
|
285
285
|
{
|
|
@@ -294,7 +294,7 @@ 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(
|
|
297
|
+
/* @__PURE__ */ d(Vo, { title: `Comments (${I.length})`, onClose: b }),
|
|
298
298
|
I.map((m) => /* @__PURE__ */ d(jo, { store: t, thread: m, authorId: n }, m.id))
|
|
299
299
|
]
|
|
300
300
|
}
|
|
@@ -302,7 +302,7 @@ function qo({ containerRef: e, store: t, authorId: n }) {
|
|
|
302
302
|
document.body
|
|
303
303
|
);
|
|
304
304
|
}
|
|
305
|
-
function
|
|
305
|
+
function Gt(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");
|
|
@@ -324,8 +324,8 @@ function Xo(e, t) {
|
|
|
324
324
|
n && n.nodeType === 3 ? n.nodeValue !== t && (n.nodeValue = t) : e.textContent = t;
|
|
325
325
|
}
|
|
326
326
|
function Qo({ id: e, host: t, onValueSynced: n }) {
|
|
327
|
-
const o =
|
|
328
|
-
return
|
|
327
|
+
const o = qe(e), [r] = dn();
|
|
328
|
+
return at(() => {
|
|
329
329
|
var p, i, f, b, v;
|
|
330
330
|
if (!t || !o) return;
|
|
331
331
|
const l = o.value ?? "";
|
|
@@ -345,7 +345,7 @@ function Qo({ id: e, host: t, onValueSynced: n }) {
|
|
|
345
345
|
} : null, n == null || n();
|
|
346
346
|
}, [t, o, n, r]), null;
|
|
347
347
|
}
|
|
348
|
-
function
|
|
348
|
+
function Vt(e, t, n, o) {
|
|
349
349
|
var i, f, b;
|
|
350
350
|
const r = (i = window.getSelection) == null ? void 0 : i.call(window);
|
|
351
351
|
if (!r || !r.isCollapsed || r.rangeCount === 0) return null;
|
|
@@ -461,7 +461,7 @@ function Yt(e, t, n) {
|
|
|
461
461
|
return kt(e, e.getBlock(s)) ? s : null;
|
|
462
462
|
}
|
|
463
463
|
function tr({ id: e, blockId: t, host: n, inlineRegistry: o, onValueSynced: r }) {
|
|
464
|
-
const l =
|
|
464
|
+
const l = qe(e);
|
|
465
465
|
if (!l) return null;
|
|
466
466
|
if (l.type === "text") return /* @__PURE__ */ d(Qo, { id: e, host: n, onValueSynced: r });
|
|
467
467
|
const a = o == null ? void 0 : o.get(l.type);
|
|
@@ -479,7 +479,7 @@ function nr(e, t, n) {
|
|
|
479
479
|
}
|
|
480
480
|
return o;
|
|
481
481
|
}
|
|
482
|
-
function
|
|
482
|
+
function Ee({
|
|
483
483
|
blockId: e,
|
|
484
484
|
runIds: t,
|
|
485
485
|
dir: n = "auto",
|
|
@@ -492,55 +492,55 @@ function Le({
|
|
|
492
492
|
onShiftTab: u,
|
|
493
493
|
onAutoformat: p
|
|
494
494
|
}) {
|
|
495
|
-
const i =
|
|
496
|
-
|
|
495
|
+
const i = K(), f = Ot(), b = io(), { getSelectedBlockId: v, setSelectedBlockId: g } = Pe(), k = _(null), I = _(!1), m = _(/* @__PURE__ */ new Map());
|
|
496
|
+
at(() => {
|
|
497
497
|
const w = k.current;
|
|
498
498
|
if (!w) return;
|
|
499
499
|
const N = new Set(t);
|
|
500
|
-
for (const [
|
|
501
|
-
N.has(
|
|
500
|
+
for (const [P, A] of m.current)
|
|
501
|
+
N.has(P) || (A.remove(), m.current.delete(P));
|
|
502
502
|
let x = null;
|
|
503
|
-
for (const
|
|
504
|
-
const
|
|
505
|
-
if (!
|
|
506
|
-
const
|
|
507
|
-
|
|
503
|
+
for (const P of t) {
|
|
504
|
+
const A = m.current.get(P);
|
|
505
|
+
if (!A) continue;
|
|
506
|
+
const H = x ? x.nextSibling : w.firstChild;
|
|
507
|
+
H !== A && w.insertBefore(A, H), x = A;
|
|
508
508
|
}
|
|
509
509
|
}, [t]);
|
|
510
510
|
const y = h(() => {
|
|
511
511
|
if (I.current) return;
|
|
512
512
|
const w = k.current;
|
|
513
513
|
if (!w) return;
|
|
514
|
-
const N = t.map((
|
|
514
|
+
const N = t.map((H) => i.getRun(H)).filter(Boolean), {
|
|
515
515
|
runs: x,
|
|
516
|
-
changed:
|
|
517
|
-
onlyValueChanges:
|
|
516
|
+
changed: P,
|
|
517
|
+
onlyValueChanges: A
|
|
518
518
|
} = Eo(w, N);
|
|
519
|
-
if (
|
|
520
|
-
if (
|
|
521
|
-
if (x.forEach((
|
|
522
|
-
|
|
519
|
+
if (P) {
|
|
520
|
+
if (A) {
|
|
521
|
+
if (x.forEach((H, Y) => {
|
|
522
|
+
H !== N[Y] && i.applyOperation(de(H.id, { value: H.value }));
|
|
523
523
|
}), p != null && p(x)) return;
|
|
524
524
|
} else
|
|
525
525
|
i.applyOperation(
|
|
526
|
-
|
|
526
|
+
Ge(
|
|
527
527
|
e,
|
|
528
528
|
x.length ? x : [{ id: C(), type: "text", value: "", marks: {} }]
|
|
529
529
|
)
|
|
530
530
|
);
|
|
531
|
-
|
|
531
|
+
Gt(w, x);
|
|
532
532
|
}
|
|
533
533
|
}, [i, e, t, p]), B = h(() => {
|
|
534
|
-
|
|
535
|
-
}, [i, t]),
|
|
534
|
+
Gt(k.current, t.map((w) => i.getRun(w)).filter(Boolean));
|
|
535
|
+
}, [i, t]), S = h(() => {
|
|
536
536
|
I.current = !0;
|
|
537
537
|
}, []), D = h(() => {
|
|
538
538
|
I.current = !1, y();
|
|
539
|
-
}, [y]),
|
|
539
|
+
}, [y]), L = h(
|
|
540
540
|
(w) => {
|
|
541
|
-
const x = t.map((
|
|
541
|
+
const x = t.map((P) => i.getRun(P)).filter(Boolean).filter((P) => P.id !== w);
|
|
542
542
|
i.applyOperation(
|
|
543
|
-
|
|
543
|
+
Ge(
|
|
544
544
|
e,
|
|
545
545
|
x.length ? x : [{ id: C(), type: "text", value: "", marks: {} }]
|
|
546
546
|
)
|
|
@@ -552,51 +552,51 @@ function Le({
|
|
|
552
552
|
v() === w ? (i.applyOperation(q(w)), g(null)) : g(w);
|
|
553
553
|
},
|
|
554
554
|
[i, v, g]
|
|
555
|
-
),
|
|
555
|
+
), E = h(
|
|
556
556
|
(w) => {
|
|
557
|
-
var
|
|
557
|
+
var ie, ne, je, $e;
|
|
558
558
|
if (I.current) return;
|
|
559
559
|
if (w.target instanceof Node) {
|
|
560
560
|
const Z = w.target.nodeType === 1 ? w.target : w.target.parentElement;
|
|
561
|
-
if ((
|
|
561
|
+
if ((ie = Z == null ? void 0 : Z.closest) != null && ie.call(Z, '[contenteditable="false"]')) return;
|
|
562
562
|
}
|
|
563
|
-
const N = w.inputType ?? "", x = N.startsWith("delete"),
|
|
564
|
-
if (!x && !
|
|
565
|
-
const
|
|
566
|
-
if (!
|
|
567
|
-
const
|
|
568
|
-
if (!X || !
|
|
563
|
+
const N = w.inputType ?? "", x = N.startsWith("delete"), P = N === "insertText" || N === "insertReplacementText";
|
|
564
|
+
if (!x && !P) return;
|
|
565
|
+
const A = k.current;
|
|
566
|
+
if (!A) return;
|
|
567
|
+
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 || !A.contains(X.startContainer) || !A.contains(X.endContainer))
|
|
569
569
|
return;
|
|
570
|
-
const
|
|
571
|
-
|
|
570
|
+
const pe = Jo(
|
|
571
|
+
A,
|
|
572
572
|
t,
|
|
573
573
|
(Z) => i.getRun(Z),
|
|
574
574
|
X
|
|
575
575
|
);
|
|
576
|
-
if (!
|
|
576
|
+
if (!pe) return;
|
|
577
577
|
w.preventDefault();
|
|
578
|
-
let { nextRuns:
|
|
579
|
-
if (
|
|
578
|
+
let { nextRuns: F, insertionIndex: Q } = pe, V = null, me = !1;
|
|
579
|
+
if (P && w.data) {
|
|
580
580
|
const Z = { id: C(), type: "text", value: w.data, marks: {} };
|
|
581
|
-
|
|
582
|
-
...
|
|
581
|
+
F = [
|
|
582
|
+
...F.slice(0, Q),
|
|
583
583
|
Z,
|
|
584
|
-
...
|
|
585
|
-
],
|
|
586
|
-
} else Q > 0 ? (
|
|
587
|
-
const ce =
|
|
588
|
-
i.applyOperation(
|
|
589
|
-
const Ie =
|
|
590
|
-
|
|
584
|
+
...F.slice(Q)
|
|
585
|
+
], V = Z.id, me = !1;
|
|
586
|
+
} else Q > 0 ? (V = ($e = F[Q - 1]) == null ? void 0 : $e.id, me = !1) : F.length > 0 && (V = F[0].id, me = !0);
|
|
587
|
+
const ce = F.length ? F : [{ id: C(), type: "text", value: "", marks: {} }];
|
|
588
|
+
i.applyOperation(Ge(e, ce));
|
|
589
|
+
const Ie = V ?? ce[0].id;
|
|
590
|
+
me ? An(Ie) : ve(Ie);
|
|
591
591
|
},
|
|
592
592
|
[i, e, t]
|
|
593
593
|
);
|
|
594
594
|
oe(() => {
|
|
595
595
|
const w = k.current;
|
|
596
596
|
if (w)
|
|
597
|
-
return w.addEventListener("beforeinput",
|
|
598
|
-
}, [
|
|
599
|
-
const
|
|
597
|
+
return w.addEventListener("beforeinput", E), () => w.removeEventListener("beforeinput", E);
|
|
598
|
+
}, [E]);
|
|
599
|
+
const j = h(
|
|
600
600
|
(w) => {
|
|
601
601
|
if (!I.current) {
|
|
602
602
|
if (w.key === "Enter" && o) {
|
|
@@ -606,19 +606,19 @@ function Le({
|
|
|
606
606
|
if (w.key === "Backspace") {
|
|
607
607
|
const N = k.current, x = N && Wt(N, t, i.getRun.bind(i));
|
|
608
608
|
if (x) {
|
|
609
|
-
w.preventDefault(),
|
|
609
|
+
w.preventDefault(), L(x);
|
|
610
610
|
return;
|
|
611
611
|
}
|
|
612
|
-
const
|
|
613
|
-
if (
|
|
614
|
-
w.preventDefault(),
|
|
612
|
+
const P = N && Vt(N, t, i.getRun.bind(i), !0);
|
|
613
|
+
if (P) {
|
|
614
|
+
w.preventDefault(), L(P);
|
|
615
615
|
return;
|
|
616
616
|
}
|
|
617
617
|
if (N && Zo(N)) {
|
|
618
|
-
if (!
|
|
619
|
-
const
|
|
620
|
-
if (
|
|
621
|
-
w.preventDefault(), $(
|
|
618
|
+
if (!ge(i, t)) {
|
|
619
|
+
const H = Yt(i, e, "backward");
|
|
620
|
+
if (H) {
|
|
621
|
+
w.preventDefault(), $(H);
|
|
622
622
|
return;
|
|
623
623
|
}
|
|
624
624
|
}
|
|
@@ -629,18 +629,18 @@ function Le({
|
|
|
629
629
|
if (w.key === "Delete") {
|
|
630
630
|
const N = k.current, x = N && Wt(N, t, i.getRun.bind(i));
|
|
631
631
|
if (x) {
|
|
632
|
-
w.preventDefault(),
|
|
632
|
+
w.preventDefault(), L(x);
|
|
633
633
|
return;
|
|
634
634
|
}
|
|
635
|
-
const
|
|
636
|
-
if (
|
|
637
|
-
w.preventDefault(),
|
|
635
|
+
const P = N && Vt(N, t, i.getRun.bind(i), !1);
|
|
636
|
+
if (P) {
|
|
637
|
+
w.preventDefault(), L(P);
|
|
638
638
|
return;
|
|
639
639
|
}
|
|
640
640
|
if (N && er(N)) {
|
|
641
|
-
const
|
|
642
|
-
if (
|
|
643
|
-
w.preventDefault(), $(
|
|
641
|
+
const A = Yt(i, e, "forward");
|
|
642
|
+
if (A) {
|
|
643
|
+
w.preventDefault(), $(A);
|
|
644
644
|
return;
|
|
645
645
|
}
|
|
646
646
|
l && l(w);
|
|
@@ -666,7 +666,7 @@ function Le({
|
|
|
666
666
|
s,
|
|
667
667
|
c,
|
|
668
668
|
u,
|
|
669
|
-
|
|
669
|
+
L,
|
|
670
670
|
$,
|
|
671
671
|
t,
|
|
672
672
|
e,
|
|
@@ -683,12 +683,12 @@ function Le({
|
|
|
683
683
|
contentEditable: !0,
|
|
684
684
|
suppressContentEditableWarning: !0,
|
|
685
685
|
onInput: y,
|
|
686
|
-
onCompositionStart:
|
|
686
|
+
onCompositionStart: S,
|
|
687
687
|
onCompositionEnd: D,
|
|
688
|
-
onKeyDown:
|
|
688
|
+
onKeyDown: j,
|
|
689
689
|
children: t.map((w) => {
|
|
690
690
|
const N = nr(m.current, i, w);
|
|
691
|
-
return
|
|
691
|
+
return He(
|
|
692
692
|
/* @__PURE__ */ d(
|
|
693
693
|
tr,
|
|
694
694
|
{
|
|
@@ -705,7 +705,7 @@ function Le({
|
|
|
705
705
|
})
|
|
706
706
|
}
|
|
707
707
|
),
|
|
708
|
-
/* @__PURE__ */ d(
|
|
708
|
+
/* @__PURE__ */ d(Go, { containerRef: k, store: i }),
|
|
709
709
|
/* @__PURE__ */ d(qo, { containerRef: k, store: i, authorId: b })
|
|
710
710
|
] });
|
|
711
711
|
}
|
|
@@ -719,31 +719,31 @@ const or = /* @__PURE__ */ new Set(["callout"]), Xt = /* @__PURE__ */ new Set(["
|
|
|
719
719
|
function rr(e, t) {
|
|
720
720
|
return e === t || Xt.has(e) && Xt.has(t);
|
|
721
721
|
}
|
|
722
|
-
function
|
|
722
|
+
function ut(e, t) {
|
|
723
723
|
const n = e.getBlock(t);
|
|
724
724
|
if (!n) return null;
|
|
725
725
|
const o = e.getBlock(n.parentId), r = o.contentIds.indexOf(t), l = n.contentIds.length === 0 || n.contentIds.length === 1 && lr(e, n.contentIds[0]);
|
|
726
726
|
if (r <= 0) {
|
|
727
727
|
if (!l) return null;
|
|
728
728
|
if (o.contentIds.length > 1)
|
|
729
|
-
return
|
|
729
|
+
return Ke(e, [q(t)]), e.getBlock(o.id).contentIds[0];
|
|
730
730
|
if (or.has(o.type))
|
|
731
731
|
return ar(e, o);
|
|
732
732
|
if (n.type === "paragraph") return null;
|
|
733
733
|
const { block: u, runs: p } = U("paragraph")(o.id);
|
|
734
|
-
return
|
|
734
|
+
return Ke(e, [
|
|
735
735
|
ke(u, o.id, r, { blocks: [u], runs: p }),
|
|
736
736
|
q(t)
|
|
737
737
|
]), u.id;
|
|
738
738
|
}
|
|
739
739
|
const a = o.contentIds[r - 1], s = e.getBlock(a);
|
|
740
740
|
if (l)
|
|
741
|
-
return
|
|
741
|
+
return Ke(e, [q(t)]), a;
|
|
742
742
|
if (kt(e, s))
|
|
743
|
-
return
|
|
743
|
+
return Ke(e, [q(a)]), t;
|
|
744
744
|
if (!s || !rr(s.type, n.type)) return null;
|
|
745
745
|
const c = [...s.contentIds, ...n.contentIds];
|
|
746
|
-
return
|
|
746
|
+
return Ke(e, [
|
|
747
747
|
Lt(a, c),
|
|
748
748
|
Lt(t, []),
|
|
749
749
|
// detach moved runs before deleting the shell
|
|
@@ -758,17 +758,17 @@ function ar(e, t) {
|
|
|
758
758
|
const n = e.getBlock(t.parentId);
|
|
759
759
|
if (!n) return null;
|
|
760
760
|
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
|
-
|
|
761
|
+
Ke(e, [q(t.id)]);
|
|
762
762
|
const a = Pt(e);
|
|
763
763
|
return r ?? l ?? a;
|
|
764
764
|
}
|
|
765
|
-
function
|
|
765
|
+
function Ke(e, t) {
|
|
766
766
|
if (typeof e.performBatch == "function")
|
|
767
767
|
e.performBatch(t);
|
|
768
768
|
else
|
|
769
769
|
for (const n of t) e.applyOperation(n);
|
|
770
770
|
}
|
|
771
|
-
function
|
|
771
|
+
function Qe(e, t, n, o) {
|
|
772
772
|
if (!t || t === n) return;
|
|
773
773
|
const r = xo(e, t);
|
|
774
774
|
if (r) {
|
|
@@ -810,19 +810,19 @@ function ir(e, t, n) {
|
|
|
810
810
|
const l = r.re.exec(o);
|
|
811
811
|
if (!l) continue;
|
|
812
812
|
const a = o.slice(l[0].length), { ops: s } = On(e, t, r.type, r.props(l), [n[0].id]);
|
|
813
|
-
return sr(e, [
|
|
813
|
+
return sr(e, [de(n[0].id, { value: a }), ...s]), An(n[0].id), !0;
|
|
814
814
|
}
|
|
815
815
|
return !1;
|
|
816
816
|
}
|
|
817
817
|
const ur = /* @__PURE__ */ new Set(["callout", "toggleHeading"]);
|
|
818
818
|
function dr({ id: e }) {
|
|
819
|
-
const t =
|
|
820
|
-
const f = t.getBlock(n == null ? void 0 : n.parentId), b =
|
|
819
|
+
const t = K(), n = te(e), { setSelectedBlockId: o } = Pe(), r = h(() => {
|
|
820
|
+
const f = t.getBlock(n == null ? void 0 : n.parentId), b = ge(t, (n == null ? void 0 : n.contentIds) ?? []), v = !!f && f.contentIds[f.contentIds.length - 1] === e;
|
|
821
821
|
if (b && v && ur.has(f == null ? void 0 : f.type)) {
|
|
822
|
-
|
|
822
|
+
Ye(t, f.id, U("paragraph"));
|
|
823
823
|
return;
|
|
824
824
|
}
|
|
825
|
-
|
|
825
|
+
Xe(
|
|
826
826
|
t,
|
|
827
827
|
e,
|
|
828
828
|
(n == null ? void 0 : n.contentIds) ?? [],
|
|
@@ -830,20 +830,20 @@ function dr({ id: e }) {
|
|
|
830
830
|
);
|
|
831
831
|
}, [t, e, n]), l = h(() => {
|
|
832
832
|
var k, I;
|
|
833
|
-
const f = t.getBlock(n == null ? void 0 : n.parentId), b =
|
|
833
|
+
const f = t.getBlock(n == null ? void 0 : n.parentId), b = 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;
|
|
834
834
|
if (b && v && (f == null ? void 0 : f.type) === "toggleHeading") {
|
|
835
835
|
const m = ((I = f.props) == null ? void 0 : I.titleRunIds) ?? [], y = m[m.length - 1];
|
|
836
836
|
y && ve(y);
|
|
837
837
|
return;
|
|
838
838
|
}
|
|
839
|
-
const g =
|
|
840
|
-
|
|
839
|
+
const g = ut(t, e);
|
|
840
|
+
Qe(t, g, e, o);
|
|
841
841
|
}, [t, e, n, o]), a = h(() => le(t, e, "up"), [t, e]), s = h(() => le(t, e, "down"), [t, e]), c = h(
|
|
842
842
|
(f) => ir(t, e, f),
|
|
843
843
|
[t, e]
|
|
844
844
|
), u = se("be-paragraph", n);
|
|
845
845
|
if (!n) return null;
|
|
846
|
-
const p =
|
|
846
|
+
const p = ge(t, n.contentIds), i = Ce(t, n);
|
|
847
847
|
return /* @__PURE__ */ d(
|
|
848
848
|
"div",
|
|
849
849
|
{
|
|
@@ -853,7 +853,7 @@ function dr({ id: e }) {
|
|
|
853
853
|
"data-placeholder": "Type '/' for commands",
|
|
854
854
|
dir: i,
|
|
855
855
|
children: /* @__PURE__ */ d(
|
|
856
|
-
|
|
856
|
+
Ee,
|
|
857
857
|
{
|
|
858
858
|
blockId: e,
|
|
859
859
|
runIds: n.contentIds,
|
|
@@ -881,7 +881,7 @@ const pr = {
|
|
|
881
881
|
SUB: "subscript",
|
|
882
882
|
SUP: "superscript"
|
|
883
883
|
};
|
|
884
|
-
function
|
|
884
|
+
function Le(e, t, n = {}) {
|
|
885
885
|
const o = [], r = (l, a) => {
|
|
886
886
|
var u, p;
|
|
887
887
|
if (l.nodeType === 3) {
|
|
@@ -912,20 +912,20 @@ function Be(e, t, n = {}) {
|
|
|
912
912
|
return r(e, n), o.length ? o : [{ id: C(), type: "text", value: "", marks: {} }];
|
|
913
913
|
}
|
|
914
914
|
function fr(e, t) {
|
|
915
|
-
return `<p>${e.contentIds.map((o) => t.store.getRun(o)).map((o) =>
|
|
915
|
+
return `<p>${e.contentIds.map((o) => t.store.getRun(o)).map((o) => Ae(o, t)).join("")}</p>`;
|
|
916
916
|
}
|
|
917
917
|
function mr(e, t) {
|
|
918
|
-
return e.contentIds.map((n) =>
|
|
918
|
+
return e.contentIds.map((n) => Me(t.store.getRun(n), t)).join("");
|
|
919
919
|
}
|
|
920
920
|
function hr(e, t) {
|
|
921
|
-
return
|
|
921
|
+
return De(
|
|
922
922
|
e.contentIds.map((n) => t.store.getRun(n)),
|
|
923
923
|
t
|
|
924
924
|
);
|
|
925
925
|
}
|
|
926
926
|
function gr(e, t) {
|
|
927
927
|
if (e.tagName !== "P") return null;
|
|
928
|
-
const n =
|
|
928
|
+
const n = Le(e, t);
|
|
929
929
|
return { block: {
|
|
930
930
|
id: C(),
|
|
931
931
|
type: "paragraph",
|
|
@@ -952,19 +952,19 @@ const br = ae({
|
|
|
952
952
|
});
|
|
953
953
|
function yr({ id: e }) {
|
|
954
954
|
var b;
|
|
955
|
-
const t =
|
|
956
|
-
|
|
955
|
+
const t = K(), n = te(e), { setSelectedBlockId: o } = Pe(), r = h(() => {
|
|
956
|
+
Xe(
|
|
957
957
|
t,
|
|
958
958
|
e,
|
|
959
959
|
(n == null ? void 0 : n.contentIds) ?? [],
|
|
960
960
|
U("paragraph")
|
|
961
961
|
);
|
|
962
962
|
}, [t, e, n]), l = h(() => {
|
|
963
|
-
const v =
|
|
964
|
-
|
|
963
|
+
const v = ut(t, e);
|
|
964
|
+
Qe(t, v, e, o);
|
|
965
965
|
}, [t, e, o]), a = h(() => le(t, e, "up"), [t, e]), s = h(() => le(t, e, "down"), [t, e]), c = ((b = n == null ? void 0 : n.props) == null ? void 0 : b.level) ?? 3, u = se(`be-heading be-heading-${c}`, n);
|
|
966
966
|
if (!n) return null;
|
|
967
|
-
const p = `h${c}`, i =
|
|
967
|
+
const p = `h${c}`, i = ge(t, n.contentIds), f = Ce(t, n);
|
|
968
968
|
return /* @__PURE__ */ d(
|
|
969
969
|
p,
|
|
970
970
|
{
|
|
@@ -974,7 +974,7 @@ function yr({ id: e }) {
|
|
|
974
974
|
"data-placeholder": `Heading ${c}`,
|
|
975
975
|
dir: f,
|
|
976
976
|
children: /* @__PURE__ */ d(
|
|
977
|
-
|
|
977
|
+
Ee,
|
|
978
978
|
{
|
|
979
979
|
blockId: e,
|
|
980
980
|
runIds: n.contentIds,
|
|
@@ -992,14 +992,14 @@ const Tt = { 1: fn, 2: mn, 3: hn }, kr = { H1: 1, H2: 2, H3: 3 };
|
|
|
992
992
|
function vr(e, t) {
|
|
993
993
|
var r;
|
|
994
994
|
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) =>
|
|
995
|
+
return `<h${n}>${o.map((l) => Ae(l, t)).join("")}</h${n}>`;
|
|
996
996
|
}
|
|
997
997
|
function Ir(e, t) {
|
|
998
|
-
return e.contentIds.map((n) =>
|
|
998
|
+
return e.contentIds.map((n) => Me(t.store.getRun(n), t)).join("");
|
|
999
999
|
}
|
|
1000
1000
|
function wr(e, t) {
|
|
1001
1001
|
var r;
|
|
1002
|
-
const n = ((r = e.props) == null ? void 0 : r.level) ?? 3, o =
|
|
1002
|
+
const n = ((r = e.props) == null ? void 0 : r.level) ?? 3, o = De(
|
|
1003
1003
|
e.contentIds.map((l) => t.store.getRun(l)),
|
|
1004
1004
|
t
|
|
1005
1005
|
);
|
|
@@ -1008,7 +1008,7 @@ function wr(e, t) {
|
|
|
1008
1008
|
function Tr(e, t) {
|
|
1009
1009
|
const n = kr[e.tagName];
|
|
1010
1010
|
if (!n) return null;
|
|
1011
|
-
const o =
|
|
1011
|
+
const o = Le(e, t);
|
|
1012
1012
|
return { block: {
|
|
1013
1013
|
id: C(),
|
|
1014
1014
|
type: "heading",
|
|
@@ -1048,7 +1048,7 @@ const Cr = ae({
|
|
|
1048
1048
|
]
|
|
1049
1049
|
}), Br = [];
|
|
1050
1050
|
function Dn(e) {
|
|
1051
|
-
const t =
|
|
1051
|
+
const t = K(), n = h(
|
|
1052
1052
|
(r) => t.subscribe(e, r),
|
|
1053
1053
|
[t, e]
|
|
1054
1054
|
), o = h(() => {
|
|
@@ -1060,7 +1060,7 @@ function Dn(e) {
|
|
|
1060
1060
|
class Rr extends lo {
|
|
1061
1061
|
constructor() {
|
|
1062
1062
|
super(...arguments);
|
|
1063
|
-
|
|
1063
|
+
zt(this, "state", { hasError: !1, nonce: 0 });
|
|
1064
1064
|
}
|
|
1065
1065
|
static getDerivedStateFromError() {
|
|
1066
1066
|
return { hasError: !0 };
|
|
@@ -1078,7 +1078,7 @@ class Rr extends lo {
|
|
|
1078
1078
|
}
|
|
1079
1079
|
}
|
|
1080
1080
|
const Hn = so(function({ id: t }) {
|
|
1081
|
-
const n =
|
|
1081
|
+
const n = te(t), o = gn();
|
|
1082
1082
|
if (!n) return null;
|
|
1083
1083
|
const r = o.get(n.type);
|
|
1084
1084
|
if (!r)
|
|
@@ -1132,15 +1132,15 @@ function Nr() {
|
|
|
1132
1132
|
border: "0"
|
|
1133
1133
|
}), document.body.appendChild(e), e);
|
|
1134
1134
|
}
|
|
1135
|
-
function
|
|
1135
|
+
function xe(e) {
|
|
1136
1136
|
const t = Nr();
|
|
1137
1137
|
t && (t.textContent = "", setTimeout(() => {
|
|
1138
1138
|
t.textContent = e;
|
|
1139
1139
|
}, 0));
|
|
1140
1140
|
}
|
|
1141
|
-
const
|
|
1141
|
+
const _e = "💡", Pn = "gray";
|
|
1142
1142
|
function Lr({
|
|
1143
|
-
icon: e =
|
|
1143
|
+
icon: e = _e,
|
|
1144
1144
|
color: t = Pn
|
|
1145
1145
|
} = {}) {
|
|
1146
1146
|
return function(o) {
|
|
@@ -1181,20 +1181,20 @@ const _n = [
|
|
|
1181
1181
|
type: "listItem",
|
|
1182
1182
|
props: { ordered: !1, collapsed: !1, titleRunIds: [] },
|
|
1183
1183
|
label: "Toggle list",
|
|
1184
|
-
icon:
|
|
1184
|
+
icon: Oe
|
|
1185
1185
|
},
|
|
1186
1186
|
{
|
|
1187
1187
|
type: "toggleHeading",
|
|
1188
1188
|
props: { level: 2, collapsed: !1, titleRunIds: [] },
|
|
1189
1189
|
label: "Toggle heading",
|
|
1190
|
-
icon:
|
|
1190
|
+
icon: Oe
|
|
1191
1191
|
},
|
|
1192
1192
|
{ type: "blockquote", props: {}, label: "Quote", icon: kn },
|
|
1193
|
-
{ type: "callout", props: { icon:
|
|
1193
|
+
{ type: "callout", props: { icon: _e }, label: "Callout", icon: vn },
|
|
1194
1194
|
{ type: "code", props: { language: "plaintext" }, label: "Code", icon: In }
|
|
1195
|
-
],
|
|
1196
|
-
function
|
|
1197
|
-
return
|
|
1195
|
+
], Mr = new Set(_n.map((e) => e.type));
|
|
1196
|
+
function Ar(e) {
|
|
1197
|
+
return Mr.has(e);
|
|
1198
1198
|
}
|
|
1199
1199
|
function Er(e, t) {
|
|
1200
1200
|
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) ?? [];
|
|
@@ -1204,7 +1204,7 @@ function $r(e, t, n, o) {
|
|
|
1204
1204
|
if (o.type === "code")
|
|
1205
1205
|
for (const p of l) {
|
|
1206
1206
|
const i = e.getRun(p);
|
|
1207
|
-
i != null && i.marks && Object.keys(i.marks).length > 0 && a.push(
|
|
1207
|
+
i != null && i.marks && Object.keys(i.marks).length > 0 && a.push(de(p, { marks: {} }));
|
|
1208
1208
|
}
|
|
1209
1209
|
const s = { ...o.props }, { ops: c, newBlockId: u } = On(
|
|
1210
1210
|
e,
|
|
@@ -1231,7 +1231,7 @@ function xr({
|
|
|
1231
1231
|
), f = h(() => {
|
|
1232
1232
|
a(!1), t == null || t();
|
|
1233
1233
|
}, [t]);
|
|
1234
|
-
|
|
1234
|
+
ct([u, p], l, f), _t(p, l, f, u);
|
|
1235
1235
|
const b = vt(
|
|
1236
1236
|
p,
|
|
1237
1237
|
l,
|
|
@@ -1269,12 +1269,12 @@ function xr({
|
|
|
1269
1269
|
onClick: () => l ? f() : v(),
|
|
1270
1270
|
onKeyDown: k,
|
|
1271
1271
|
children: [
|
|
1272
|
-
/* @__PURE__ */ d(
|
|
1272
|
+
/* @__PURE__ */ d(Oe, { size: 15 }),
|
|
1273
1273
|
" Turn into"
|
|
1274
1274
|
]
|
|
1275
1275
|
}
|
|
1276
1276
|
),
|
|
1277
|
-
l && b &&
|
|
1277
|
+
l && b && He(
|
|
1278
1278
|
/* @__PURE__ */ d(
|
|
1279
1279
|
"div",
|
|
1280
1280
|
{
|
|
@@ -1311,7 +1311,7 @@ function xr({
|
|
|
1311
1311
|
function Or(e, t) {
|
|
1312
1312
|
const n = e.getBlock(t);
|
|
1313
1313
|
if (!n) return null;
|
|
1314
|
-
const o = e.getBlock(n.parentId), r = o.contentIds.indexOf(t), l = Fo(e, t), { block: a, runs: s, subtreeBlocks: c } =
|
|
1314
|
+
const o = e.getBlock(n.parentId), r = o.contentIds.indexOf(t), l = Fo(e, t), { block: a, runs: s, subtreeBlocks: c } = Ko(l);
|
|
1315
1315
|
return e.applyOperation(
|
|
1316
1316
|
ke(a, o.id, r + 1, { blocks: [a, ...c], runs: s })
|
|
1317
1317
|
), be(e, a.id), a.id;
|
|
@@ -1342,8 +1342,8 @@ function Hr(e, t) {
|
|
|
1342
1342
|
}
|
|
1343
1343
|
function Pr({ id: e }) {
|
|
1344
1344
|
var w;
|
|
1345
|
-
const t =
|
|
1346
|
-
|
|
1345
|
+
const t = K(), n = gn(), o = te(e), [r, l] = O(!1), [a, s] = O(null), c = _(null), u = _(null), p = _(null), i = Ve(() => [c, u, p], []), [f] = uo(), b = f.includes(e), v = h(() => l(!1), []);
|
|
1346
|
+
ct(i, r, v), _t(u, r, v, c);
|
|
1347
1347
|
const g = h(() => {
|
|
1348
1348
|
var N;
|
|
1349
1349
|
s(((N = c.current) == null ? void 0 : N.getBoundingClientRect()) ?? null), l(!0);
|
|
@@ -1353,23 +1353,23 @@ function Pr({ id: e }) {
|
|
|
1353
1353
|
(a == null ? void 0 : a.bottom) != null ? a.bottom + 4 : null,
|
|
1354
1354
|
a == null ? void 0 : a.left
|
|
1355
1355
|
), I = h(() => {
|
|
1356
|
-
|
|
1356
|
+
Ye(t, e, U("paragraph"));
|
|
1357
1357
|
}, [t, e]), m = h(() => {
|
|
1358
|
-
Or(t, e),
|
|
1358
|
+
Or(t, e), xe("Block duplicated"), v();
|
|
1359
1359
|
}, [t, e, v]), y = h(() => {
|
|
1360
|
-
Sr(t, e) &&
|
|
1360
|
+
Sr(t, e) && xe("Block moved up"), v();
|
|
1361
1361
|
}, [t, e, v]), B = h(() => {
|
|
1362
|
-
Dr(t, e) &&
|
|
1363
|
-
}, [t, e, v]),
|
|
1364
|
-
Un(t, e),
|
|
1365
|
-
}, [t, e, v]), D = !!((w = o == null ? void 0 : o.props) != null && w.hidden),
|
|
1366
|
-
t.applyOperation(G(e, { hidden: !D })),
|
|
1367
|
-
}, [t, e, D, v]), $ = Ce(t, o) === "rtl",
|
|
1368
|
-
t.applyOperation(G(e, { dir: $ ? "ltr" : "rtl" })),
|
|
1369
|
-
}, [t, e, $, v]),
|
|
1362
|
+
Dr(t, e) && xe("Block moved down"), v();
|
|
1363
|
+
}, [t, e, v]), S = h(() => {
|
|
1364
|
+
Un(t, e), xe("Block deleted"), v();
|
|
1365
|
+
}, [t, e, v]), D = !!((w = o == null ? void 0 : o.props) != null && w.hidden), L = h(() => {
|
|
1366
|
+
t.applyOperation(G(e, { hidden: !D })), xe(D ? "Block shown in preview" : "Block hidden in preview"), v();
|
|
1367
|
+
}, [t, e, D, v]), $ = Ce(t, o) === "rtl", E = h(() => {
|
|
1368
|
+
t.applyOperation(G(e, { dir: $ ? "ltr" : "rtl" })), xe($ ? "Block set to left-to-right" : "Block set to right-to-left"), v();
|
|
1369
|
+
}, [t, e, $, v]), j = h(
|
|
1370
1370
|
(N) => {
|
|
1371
1371
|
const { ops: x } = $r(t, n, e, N);
|
|
1372
|
-
Hr(t, x),
|
|
1372
|
+
Hr(t, x), xe(`Turned into ${N.label}`), v();
|
|
1373
1373
|
},
|
|
1374
1374
|
[t, n, e, v]
|
|
1375
1375
|
);
|
|
@@ -1413,7 +1413,7 @@ function Pr({ id: e }) {
|
|
|
1413
1413
|
}
|
|
1414
1414
|
),
|
|
1415
1415
|
/* @__PURE__ */ d("div", { className: "be-block-row-content", children: /* @__PURE__ */ d(Hn, { id: e }) }),
|
|
1416
|
-
r && k &&
|
|
1416
|
+
r && k && He(
|
|
1417
1417
|
/* @__PURE__ */ T(
|
|
1418
1418
|
"div",
|
|
1419
1419
|
{
|
|
@@ -1468,7 +1468,7 @@ function Pr({ id: e }) {
|
|
|
1468
1468
|
type: "button",
|
|
1469
1469
|
role: "menuitem",
|
|
1470
1470
|
className: "be-block-gutter-menu-item",
|
|
1471
|
-
onClick:
|
|
1471
|
+
onClick: L,
|
|
1472
1472
|
children: [
|
|
1473
1473
|
D ? /* @__PURE__ */ d(mo, { size: 15 }) : /* @__PURE__ */ d(ho, { size: 15 }),
|
|
1474
1474
|
D ? "Show in preview" : "Hide in preview"
|
|
@@ -1481,17 +1481,17 @@ function Pr({ id: e }) {
|
|
|
1481
1481
|
type: "button",
|
|
1482
1482
|
role: "menuitem",
|
|
1483
1483
|
className: "be-block-gutter-menu-item",
|
|
1484
|
-
onClick:
|
|
1484
|
+
onClick: E,
|
|
1485
1485
|
children: [
|
|
1486
1486
|
$ ? /* @__PURE__ */ d(Bn, { size: 15 }) : /* @__PURE__ */ d(Rn, { size: 15 }),
|
|
1487
1487
|
$ ? "Switch to left-to-right" : "Switch to right-to-left"
|
|
1488
1488
|
]
|
|
1489
1489
|
}
|
|
1490
1490
|
),
|
|
1491
|
-
|
|
1491
|
+
Ar(o.type) && /* @__PURE__ */ d(
|
|
1492
1492
|
xr,
|
|
1493
1493
|
{
|
|
1494
|
-
onSelect:
|
|
1494
|
+
onSelect: j,
|
|
1495
1495
|
onClose: () => {
|
|
1496
1496
|
},
|
|
1497
1497
|
containerRef: p
|
|
@@ -1503,7 +1503,7 @@ function Pr({ id: e }) {
|
|
|
1503
1503
|
type: "button",
|
|
1504
1504
|
role: "menuitem",
|
|
1505
1505
|
className: "be-block-gutter-menu-item be-block-gutter-menu-item-danger",
|
|
1506
|
-
onClick:
|
|
1506
|
+
onClick: S,
|
|
1507
1507
|
children: [
|
|
1508
1508
|
/* @__PURE__ */ d(Nn, { size: 15 }),
|
|
1509
1509
|
" Delete"
|
|
@@ -1519,8 +1519,8 @@ function Pr({ id: e }) {
|
|
|
1519
1519
|
}
|
|
1520
1520
|
) : null;
|
|
1521
1521
|
}
|
|
1522
|
-
function
|
|
1523
|
-
const o = Dn(e), r =
|
|
1522
|
+
function Ue({ parentId: e, isTopLevel: t = !1, filterIds: n }) {
|
|
1523
|
+
const o = Dn(e), r = K(), [l] = go(), a = n ?? o, s = l ? a.filter((c) => {
|
|
1524
1524
|
var u, p;
|
|
1525
1525
|
return !((p = (u = r.getBlock(c)) == null ? void 0 : u.props) != null && p.hidden);
|
|
1526
1526
|
}) : a;
|
|
@@ -1554,7 +1554,7 @@ function Fr(e) {
|
|
|
1554
1554
|
t += r, n -= o;
|
|
1555
1555
|
return t;
|
|
1556
1556
|
}
|
|
1557
|
-
function
|
|
1557
|
+
function Kr(e) {
|
|
1558
1558
|
var t, n;
|
|
1559
1559
|
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
1560
|
}
|
|
@@ -1567,26 +1567,26 @@ function Jt(e, t) {
|
|
|
1567
1567
|
}
|
|
1568
1568
|
return n;
|
|
1569
1569
|
}
|
|
1570
|
-
function
|
|
1570
|
+
function zr(e, t, n) {
|
|
1571
1571
|
const o = n.indexOf(t.id);
|
|
1572
1572
|
let r = 1;
|
|
1573
1573
|
for (let l = o - 1; l >= 0; l -= 1) {
|
|
1574
1574
|
const a = e.getBlock(n[l]);
|
|
1575
|
-
if (!
|
|
1575
|
+
if (!Kr(a) || !a.props.ordered) break;
|
|
1576
1576
|
r += 1;
|
|
1577
1577
|
}
|
|
1578
1578
|
return r;
|
|
1579
1579
|
}
|
|
1580
|
-
function
|
|
1580
|
+
function Gr(e, t) {
|
|
1581
1581
|
const n = (e % 3 + 3) % 3;
|
|
1582
1582
|
return n === 0 ? `${t}.` : n === 1 ? `${jr(t)}.` : `${Fr(t)}.`;
|
|
1583
1583
|
}
|
|
1584
|
-
const
|
|
1584
|
+
const Vr = ["•", "◦", "▪"];
|
|
1585
1585
|
function Wr(e) {
|
|
1586
1586
|
const t = (e % 3 + 3) % 3;
|
|
1587
|
-
return
|
|
1587
|
+
return Vr[t];
|
|
1588
1588
|
}
|
|
1589
|
-
function
|
|
1589
|
+
function lt({ ordered: e = !1, checked: t, collapsed: n } = {}) {
|
|
1590
1590
|
return function(r, l) {
|
|
1591
1591
|
const a = C(), s = l != null && l.length ? l : [{ id: C(), type: "text", value: "", marks: {} }], c = { ordered: e, titleRunIds: s.map((f) => f.id) };
|
|
1592
1592
|
t !== void 0 && (c.checked = t);
|
|
@@ -1611,13 +1611,13 @@ function qr(e, t) {
|
|
|
1611
1611
|
}
|
|
1612
1612
|
e.applyOperation(yt(t, l, a.contentIds.length)), be(e, t);
|
|
1613
1613
|
}
|
|
1614
|
-
function
|
|
1614
|
+
function Mt(e, t) {
|
|
1615
1615
|
const n = e.getBlock(t), o = e.getBlock(n.parentId);
|
|
1616
1616
|
if (!o || o.type !== "listItem") return;
|
|
1617
1617
|
const r = o.parentId, a = e.getBlock(r).contentIds.indexOf(o.id);
|
|
1618
1618
|
e.applyOperation(yt(t, r, a + 1)), be(e, t);
|
|
1619
1619
|
}
|
|
1620
|
-
function
|
|
1620
|
+
function nt(e, t) {
|
|
1621
1621
|
if (typeof e.performBatch == "function") e.performBatch(t);
|
|
1622
1622
|
else for (const n of t) e.applyOperation(n);
|
|
1623
1623
|
}
|
|
@@ -1630,7 +1630,7 @@ function Yr(e, t) {
|
|
|
1630
1630
|
if (n.length === 0) return !0;
|
|
1631
1631
|
if (n.length > 1) return !1;
|
|
1632
1632
|
const o = e.getBlock(n[0]);
|
|
1633
|
-
return !!o && o.type === "paragraph" &&
|
|
1633
|
+
return !!o && o.type === "paragraph" && ge(e, o.contentIds);
|
|
1634
1634
|
}
|
|
1635
1635
|
function Xr(e, t) {
|
|
1636
1636
|
const n = e.getBlock(t);
|
|
@@ -1639,12 +1639,12 @@ function Xr(e, t) {
|
|
|
1639
1639
|
if (r > 0) {
|
|
1640
1640
|
const p = o.contentIds[r - 1], i = e.getBlock(p);
|
|
1641
1641
|
if (s)
|
|
1642
|
-
return
|
|
1642
|
+
return nt(e, [q(t)]), { focusBlockId: p, needsRefocus: !0 };
|
|
1643
1643
|
if (kt(e, i))
|
|
1644
|
-
return
|
|
1644
|
+
return nt(e, [q(p)]), { focusBlockId: t, needsRefocus: !1 };
|
|
1645
1645
|
if ((i == null ? void 0 : i.type) === "listItem" && n.contentIds.length === 0) {
|
|
1646
1646
|
const f = [...i.props.titleRunIds ?? [], ...l];
|
|
1647
|
-
return
|
|
1647
|
+
return nt(e, [
|
|
1648
1648
|
G(p, { titleRunIds: f }),
|
|
1649
1649
|
G(t, { titleRunIds: [] }),
|
|
1650
1650
|
// detach before delete
|
|
@@ -1654,12 +1654,12 @@ function Xr(e, t) {
|
|
|
1654
1654
|
return null;
|
|
1655
1655
|
}
|
|
1656
1656
|
if (o.type === "listItem")
|
|
1657
|
-
return
|
|
1657
|
+
return Mt(e, t), { focusBlockId: t, needsRefocus: !0 };
|
|
1658
1658
|
if (!s) return null;
|
|
1659
1659
|
if (o.contentIds.length > 1)
|
|
1660
|
-
return
|
|
1660
|
+
return nt(e, [q(t)]), { focusBlockId: e.getBlock(o.id).contentIds[0], needsRefocus: !0 };
|
|
1661
1661
|
const { block: c, runs: u } = U("paragraph")(o.id);
|
|
1662
|
-
return
|
|
1662
|
+
return nt(e, [
|
|
1663
1663
|
ke(c, o.id, r, { blocks: [c], runs: u }),
|
|
1664
1664
|
q(t)
|
|
1665
1665
|
]), { focusBlockId: c.id, needsRefocus: !0 };
|
|
@@ -1682,34 +1682,34 @@ function Zr(e, t) {
|
|
|
1682
1682
|
else for (const n of t) e.applyOperation(n);
|
|
1683
1683
|
}
|
|
1684
1684
|
function el({ id: e }) {
|
|
1685
|
-
var
|
|
1686
|
-
const t =
|
|
1687
|
-
var
|
|
1688
|
-
const
|
|
1689
|
-
if (w && (
|
|
1690
|
-
|
|
1685
|
+
var L, $;
|
|
1686
|
+
const t = K(), n = te(e), { setSelectedBlockId: o } = Pe(), r = Dn(n == null ? void 0 : n.parentId), l = h(() => {
|
|
1687
|
+
var H, Y, X, pe, F;
|
|
1688
|
+
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
|
+
if (w && (j == null ? void 0 : j.type) === "listItem") {
|
|
1690
|
+
Mt(t, e);
|
|
1691
1691
|
return;
|
|
1692
1692
|
}
|
|
1693
1693
|
const N = (((Y = n == null ? void 0 : n.contentIds) == null ? void 0 : Y.length) ?? 0) > 0;
|
|
1694
|
-
if (w && (
|
|
1694
|
+
if (w && (j == null ? void 0 : j.type) !== "listItem" && !N) {
|
|
1695
1695
|
Jr(t, e);
|
|
1696
1696
|
return;
|
|
1697
1697
|
}
|
|
1698
|
-
const x = ((X = n == null ? void 0 : n.props) == null ? void 0 : X.checked) !== void 0,
|
|
1699
|
-
ordered: (
|
|
1698
|
+
const x = ((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, A = lt({
|
|
1699
|
+
ordered: (F = n == null ? void 0 : n.props) == null ? void 0 : F.ordered,
|
|
1700
1700
|
checked: x ? !1 : void 0,
|
|
1701
|
-
collapsed:
|
|
1701
|
+
collapsed: P ? !1 : void 0
|
|
1702
1702
|
});
|
|
1703
|
-
N && !
|
|
1704
|
-
}, [t, e, n]), a = h(() => qr(t, e), [t, e]), s = h(() =>
|
|
1705
|
-
const
|
|
1706
|
-
!
|
|
1703
|
+
N && !P ? $n(t, e, E, A) : Xe(t, e, E, A);
|
|
1704
|
+
}, [t, e, n]), a = h(() => qr(t, e), [t, e]), s = h(() => Mt(t, e), [t, e]), c = h(() => {
|
|
1705
|
+
const E = Xr(t, e);
|
|
1706
|
+
!E || !E.needsRefocus || Qe(t, E.focusBlockId, e, o);
|
|
1707
1707
|
}, [t, e, o]), u = h(() => le(t, e, "up"), [t, e]), p = h(() => le(t, e, "down"), [t, e]), i = h(() => {
|
|
1708
|
-
var
|
|
1709
|
-
t.applyOperation(G(e, { checked: !((
|
|
1710
|
-
}, [t, e, (
|
|
1711
|
-
var
|
|
1712
|
-
if (!((((
|
|
1708
|
+
var E;
|
|
1709
|
+
t.applyOperation(G(e, { checked: !((E = n == null ? void 0 : n.props) != null && E.checked) }));
|
|
1710
|
+
}, [t, e, (L = n == null ? void 0 : n.props) == null ? void 0 : L.checked]), f = h(() => {
|
|
1711
|
+
var j, w;
|
|
1712
|
+
if (!((((j = n == null ? void 0 : n.contentIds) == null ? void 0 : j.length) ?? 0) > 0)) {
|
|
1713
1713
|
const { block: N, runs: x } = U("paragraph")(e);
|
|
1714
1714
|
Zr(t, [
|
|
1715
1715
|
ke(N, e, 0, { blocks: [N], runs: x }),
|
|
@@ -1720,7 +1720,7 @@ function el({ id: e }) {
|
|
|
1720
1720
|
t.applyOperation(G(e, { collapsed: !((w = n == null ? void 0 : n.props) != null && w.collapsed) }));
|
|
1721
1721
|
}, [t, e, n == null ? void 0 : n.contentIds, ($ = n == null ? void 0 : n.props) == null ? void 0 : $.collapsed]), b = se("be-list-item", n);
|
|
1722
1722
|
if (!n) return null;
|
|
1723
|
-
const { ordered: v, checked: g, collapsed: k, titleRunIds: I = [] } = n.props, m = g !== void 0, y = !m && k !== void 0, B = n.contentIds.length > 0,
|
|
1723
|
+
const { ordered: v, checked: g, collapsed: k, titleRunIds: I = [] } = n.props, m = g !== void 0, y = !m && k !== void 0, B = n.contentIds.length > 0, S = 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);
|
|
1724
1724
|
return /* @__PURE__ */ T("div", { className: b, "data-block-id": e, dir: D, children: [
|
|
1725
1725
|
/* @__PURE__ */ T("div", { className: "be-list-item-row", children: [
|
|
1726
1726
|
m ? /* @__PURE__ */ d(
|
|
@@ -1730,7 +1730,7 @@ function el({ id: e }) {
|
|
|
1730
1730
|
className: "be-list-checkbox",
|
|
1731
1731
|
checked: !!g,
|
|
1732
1732
|
onChange: i,
|
|
1733
|
-
"aria-label":
|
|
1733
|
+
"aria-label": S || "To-do item"
|
|
1734
1734
|
}
|
|
1735
1735
|
) : y ? (
|
|
1736
1736
|
// A real button (not decorative, unlike the plain bullet/number
|
|
@@ -1745,7 +1745,7 @@ function el({ id: e }) {
|
|
|
1745
1745
|
onClick: f,
|
|
1746
1746
|
"aria-expanded": !k,
|
|
1747
1747
|
"aria-label": B ? k ? "Expand toggle" : "Collapse toggle" : "Add content to toggle",
|
|
1748
|
-
children: k ? /* @__PURE__ */ d(
|
|
1748
|
+
children: k ? /* @__PURE__ */ d(Oe, {}) : /* @__PURE__ */ d(Dt, {})
|
|
1749
1749
|
}
|
|
1750
1750
|
)
|
|
1751
1751
|
) : (
|
|
@@ -1755,20 +1755,20 @@ function el({ id: e }) {
|
|
|
1755
1755
|
// a,b,c -> i,ii,iii for numbered; disc -> circle -> square for
|
|
1756
1756
|
// bulleted, repeating every 3 levels), a common list-nesting
|
|
1757
1757
|
// convention — see listMarkers.js.
|
|
1758
|
-
/* @__PURE__ */ d("span", { className: "be-list-marker", "aria-hidden": "true", children: v ?
|
|
1758
|
+
/* @__PURE__ */ d("span", { className: "be-list-marker", "aria-hidden": "true", children: v ? Gr(
|
|
1759
1759
|
Jt(t, n),
|
|
1760
|
-
|
|
1760
|
+
zr(t, n, r)
|
|
1761
1761
|
) : Wr(Jt(t, n)) })
|
|
1762
1762
|
),
|
|
1763
1763
|
/* @__PURE__ */ d(
|
|
1764
1764
|
"div",
|
|
1765
1765
|
{
|
|
1766
1766
|
className: "be-list-item-title",
|
|
1767
|
-
"data-empty":
|
|
1767
|
+
"data-empty": ge(t, I) ? "" : void 0,
|
|
1768
1768
|
"data-placeholder": m ? "To-do" : y ? "Toggle" : "List item",
|
|
1769
1769
|
style: g ? { textDecoration: "line-through", opacity: 0.6 } : void 0,
|
|
1770
1770
|
children: /* @__PURE__ */ d(
|
|
1771
|
-
|
|
1771
|
+
Ee,
|
|
1772
1772
|
{
|
|
1773
1773
|
blockId: e,
|
|
1774
1774
|
runIds: I,
|
|
@@ -1784,21 +1784,21 @@ function el({ id: e }) {
|
|
|
1784
1784
|
}
|
|
1785
1785
|
)
|
|
1786
1786
|
] }),
|
|
1787
|
-
(!y || !k) && /* @__PURE__ */ d("div", { className: "be-list-item-children", children: /* @__PURE__ */ d(
|
|
1787
|
+
(!y || !k) && /* @__PURE__ */ d("div", { className: "be-list-item-children", children: /* @__PURE__ */ d(Ue, { parentId: e }) })
|
|
1788
1788
|
] });
|
|
1789
1789
|
}
|
|
1790
1790
|
function tl(e, t) {
|
|
1791
|
-
const { titleRunIds: n = [], ordered: o } = e.props, r = n.map((s) =>
|
|
1791
|
+
const { titleRunIds: n = [], ordered: o } = e.props, r = n.map((s) => Ae(t.store.getRun(s), t)).join(""), l = e.contentIds.map(
|
|
1792
1792
|
(s) => t.registry.get(t.store.getBlock(s).type).toHTML(t.store.getBlock(s), t)
|
|
1793
1793
|
).join(""), a = l ? `<${o ? "ol" : "ul"}>${l}</${o ? "ol" : "ul"}>` : "";
|
|
1794
1794
|
return `<li>${r}${a}</li>`;
|
|
1795
1795
|
}
|
|
1796
1796
|
function nl(e, t) {
|
|
1797
1797
|
const { titleRunIds: n = [] } = e.props;
|
|
1798
|
-
return n.map((o) =>
|
|
1798
|
+
return n.map((o) => Me(t.store.getRun(o), t)).join("");
|
|
1799
1799
|
}
|
|
1800
1800
|
function ol(e, t) {
|
|
1801
|
-
const { titleRunIds: n = [], ordered: o, checked: r } = e.props, l = r !== void 0 ? r ? "- [x] " : "- [ ] " : o ? "1. " : "- ", a =
|
|
1801
|
+
const { titleRunIds: n = [], ordered: o, checked: r } = e.props, l = r !== void 0 ? r ? "- [x] " : "- [ ] " : o ? "1. " : "- ", a = De(
|
|
1802
1802
|
n.map((c) => t.store.getRun(c)),
|
|
1803
1803
|
t
|
|
1804
1804
|
), s = e.contentIds.map((c) => {
|
|
@@ -1817,7 +1817,7 @@ function Fn(e, t) {
|
|
|
1817
1817
|
i.nodeType === 1 && (i.tagName === "UL" || i.tagName === "OL") ? o.push(i) : n.push(i);
|
|
1818
1818
|
const r = e.ownerDocument.createElement("span");
|
|
1819
1819
|
for (const i of n) r.appendChild(i.cloneNode(!0));
|
|
1820
|
-
const l =
|
|
1820
|
+
const l = Le(r, t), a = C(), s = [...l], c = [], u = [];
|
|
1821
1821
|
for (const i of o) {
|
|
1822
1822
|
const f = i.tagName === "OL";
|
|
1823
1823
|
for (const b of i.children) {
|
|
@@ -1853,13 +1853,13 @@ const ll = ae({
|
|
|
1853
1853
|
label: "Bulleted list",
|
|
1854
1854
|
icon: bn,
|
|
1855
1855
|
keywords: ["list", "bullet", "ul"],
|
|
1856
|
-
run: (e, t) => re(e, t,
|
|
1856
|
+
run: (e, t) => re(e, t, lt({ ordered: !1 }))
|
|
1857
1857
|
},
|
|
1858
1858
|
{
|
|
1859
1859
|
label: "Numbered list",
|
|
1860
1860
|
icon: yn,
|
|
1861
1861
|
keywords: ["list", "number", "ordered", "ol"],
|
|
1862
|
-
run: (e, t) => re(e, t,
|
|
1862
|
+
run: (e, t) => re(e, t, lt({ ordered: !0 }))
|
|
1863
1863
|
},
|
|
1864
1864
|
{
|
|
1865
1865
|
label: "To-do list",
|
|
@@ -1868,25 +1868,25 @@ const ll = ae({
|
|
|
1868
1868
|
run: (e, t) => re(
|
|
1869
1869
|
e,
|
|
1870
1870
|
t,
|
|
1871
|
-
|
|
1871
|
+
lt({ ordered: !1, checked: !1 })
|
|
1872
1872
|
)
|
|
1873
1873
|
},
|
|
1874
1874
|
{
|
|
1875
1875
|
label: "Toggle list",
|
|
1876
|
-
icon:
|
|
1876
|
+
icon: Oe,
|
|
1877
1877
|
keywords: ["toggle", "collapse", "expand", "dropdown", "accordion"],
|
|
1878
1878
|
run: (e, t) => re(
|
|
1879
1879
|
e,
|
|
1880
1880
|
t,
|
|
1881
|
-
|
|
1881
|
+
lt({ ordered: !1, collapsed: !1 })
|
|
1882
1882
|
)
|
|
1883
1883
|
}
|
|
1884
1884
|
]
|
|
1885
|
-
}), al = ["text", "date", "checkbox", "select"], It = "text", Ut = 160,
|
|
1885
|
+
}), al = ["text", "date", "checkbox", "select"], It = "text", Ut = 160, ze = 80;
|
|
1886
1886
|
function sl(e) {
|
|
1887
1887
|
return `Column ${e + 1}`;
|
|
1888
1888
|
}
|
|
1889
|
-
function
|
|
1889
|
+
function Kn(e) {
|
|
1890
1890
|
return Array.from({ length: e }, (t, n) => ({
|
|
1891
1891
|
id: C(),
|
|
1892
1892
|
label: sl(n),
|
|
@@ -1894,10 +1894,10 @@ function zn(e) {
|
|
|
1894
1894
|
width: Ut
|
|
1895
1895
|
}));
|
|
1896
1896
|
}
|
|
1897
|
-
function
|
|
1897
|
+
function fe(e, t) {
|
|
1898
1898
|
var o;
|
|
1899
1899
|
const n = (o = e.props) == null ? void 0 : o.columns;
|
|
1900
|
-
return !Array.isArray(n) || n.length !== t ?
|
|
1900
|
+
return !Array.isArray(n) || n.length !== t ? Kn(t) : n.map((r) => {
|
|
1901
1901
|
const l = r.type ?? It, a = r.width ?? Ut;
|
|
1902
1902
|
return l === r.type && a === r.width ? r : { ...r, type: l, width: a };
|
|
1903
1903
|
});
|
|
@@ -1954,7 +1954,7 @@ function il(e, t, n) {
|
|
|
1954
1954
|
data: { checked: !1, label: o }
|
|
1955
1955
|
} : { id: C(), type: "text", value: o, marks: {} };
|
|
1956
1956
|
}
|
|
1957
|
-
function
|
|
1957
|
+
function st(e, t) {
|
|
1958
1958
|
if (!e) return "";
|
|
1959
1959
|
if (e.type === "text") return e.value ?? "";
|
|
1960
1960
|
const n = t == null ? void 0 : t.get(e.type);
|
|
@@ -1962,7 +1962,7 @@ function lt(e, t) {
|
|
|
1962
1962
|
}
|
|
1963
1963
|
function ul(e, t, n) {
|
|
1964
1964
|
var o, r, l;
|
|
1965
|
-
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() :
|
|
1965
|
+
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
1966
|
}
|
|
1967
1967
|
function dl(e, t, n) {
|
|
1968
1968
|
if (n === "checkbox") return e - t;
|
|
@@ -2013,7 +2013,7 @@ const fl = [
|
|
|
2013
2013
|
function gl(e, t, n, o) {
|
|
2014
2014
|
if (!n || n === "none") return null;
|
|
2015
2015
|
if (n === "count") return e.length;
|
|
2016
|
-
const r = e.map((a) =>
|
|
2016
|
+
const r = e.map((a) => st(a, o).trim());
|
|
2017
2017
|
if (n === "count-values") return r.filter((a) => a !== "").length;
|
|
2018
2018
|
if (n === "count-empty") return r.filter((a) => a === "").length;
|
|
2019
2019
|
const l = r.map(Number).filter((a, s) => r[s] !== "" && !Number.isNaN(a));
|
|
@@ -2022,13 +2022,13 @@ function gl(e, t, n, o) {
|
|
|
2022
2022
|
function bl(e) {
|
|
2023
2023
|
return e == null ? "" : Number.isInteger(e) ? String(e) : e.toFixed(2);
|
|
2024
2024
|
}
|
|
2025
|
-
function
|
|
2025
|
+
function Se(e, t) {
|
|
2026
2026
|
if (typeof e.performBatch == "function") e.performBatch(t);
|
|
2027
2027
|
else for (const n of t) e.applyOperation(n);
|
|
2028
2028
|
}
|
|
2029
|
-
function
|
|
2029
|
+
function zn(e, t) {
|
|
2030
2030
|
const o = e.getBlock(t.parentId).contentIds.indexOf(t.id);
|
|
2031
|
-
|
|
2031
|
+
Se(e, [q(t.id)]);
|
|
2032
2032
|
const r = Pt(e);
|
|
2033
2033
|
if (r)
|
|
2034
2034
|
return be(e, r), null;
|
|
@@ -2036,7 +2036,7 @@ function Kn(e, t) {
|
|
|
2036
2036
|
return a && be(e, a), null;
|
|
2037
2037
|
}
|
|
2038
2038
|
function yl(e, t) {
|
|
2039
|
-
const n = e.getBlock(t), o = e.getBlock(n.parentId), r = o.contentIds.indexOf(t), l =
|
|
2039
|
+
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
2040
|
for (const i of l) {
|
|
2041
2041
|
const f = jt(a, i);
|
|
2042
2042
|
s.push(f.block), c.push(f.run), u.push(f.block.id);
|
|
@@ -2049,14 +2049,14 @@ function yl(e, t) {
|
|
|
2049
2049
|
function kl(e, t) {
|
|
2050
2050
|
const n = e.getBlock(t), o = e.getBlock(n.parentId);
|
|
2051
2051
|
if (o.contentIds.length <= 1)
|
|
2052
|
-
return
|
|
2052
|
+
return zn(e, o);
|
|
2053
2053
|
const r = o.contentIds.indexOf(t);
|
|
2054
|
-
|
|
2054
|
+
Se(e, [q(t)]);
|
|
2055
2055
|
const l = e.getBlock(o.id), a = Math.min(r, l.contentIds.length - 1), s = l.contentIds[a];
|
|
2056
2056
|
return s && be(e, s), s ?? null;
|
|
2057
2057
|
}
|
|
2058
2058
|
function Zt(e, t, n) {
|
|
2059
|
-
const o = e.getBlock(t), r =
|
|
2059
|
+
const o = e.getBlock(t), r = fe(
|
|
2060
2060
|
o,
|
|
2061
2061
|
o.contentIds[0] ? e.getBlock(o.contentIds[0]).contentIds.length : 0
|
|
2062
2062
|
), l = {
|
|
@@ -2073,31 +2073,31 @@ function Zt(e, t, n) {
|
|
|
2073
2073
|
);
|
|
2074
2074
|
}
|
|
2075
2075
|
const c = [...r];
|
|
2076
|
-
return c.splice(n + 1, 0, l), a.push(G(t, { columns: c })),
|
|
2076
|
+
return c.splice(n + 1, 0, l), a.push(G(t, { columns: c })), Se(e, a), s && be(e, s), s;
|
|
2077
2077
|
}
|
|
2078
2078
|
function vl(e, t, n) {
|
|
2079
2079
|
const o = e.getBlock(t), r = e.getBlock(o.contentIds[0]);
|
|
2080
2080
|
if (!r || r.contentIds.length <= 1)
|
|
2081
|
-
return
|
|
2082
|
-
const l =
|
|
2081
|
+
return zn(e, o);
|
|
2082
|
+
const l = fe(o, r.contentIds.length), a = o.contentIds.map((i) => {
|
|
2083
2083
|
const f = e.getBlock(i);
|
|
2084
2084
|
return q(f.contentIds[n]);
|
|
2085
2085
|
}), s = l.filter((i, f) => f !== n);
|
|
2086
|
-
a.push(G(t, { columns: s })),
|
|
2086
|
+
a.push(G(t, { columns: s })), Se(e, a);
|
|
2087
2087
|
const c = e.getBlock(o.contentIds[0]), u = Math.min(n, c.contentIds.length - 1), p = c.contentIds[u];
|
|
2088
2088
|
return p && be(e, p), p ?? null;
|
|
2089
2089
|
}
|
|
2090
2090
|
function en(e, t, n, o) {
|
|
2091
|
-
const r = e.getBlock(t), l = e.getBlock(r.contentIds[0]), a =
|
|
2091
|
+
const r = e.getBlock(t), l = e.getBlock(r.contentIds[0]), a = fe(r, l ? l.contentIds.length : 0);
|
|
2092
2092
|
if (!a[n]) return;
|
|
2093
2093
|
const s = [...a];
|
|
2094
2094
|
s[n] = {
|
|
2095
2095
|
...a[n],
|
|
2096
|
-
width: Math.max(
|
|
2096
|
+
width: Math.max(ze, Math.round(o))
|
|
2097
2097
|
}, e.applyOperation(G(t, { columns: s }));
|
|
2098
2098
|
}
|
|
2099
2099
|
function Il(e, t, n, o) {
|
|
2100
|
-
const r = e.getBlock(t), l = e.getBlock(r.contentIds[0]), s = [...
|
|
2100
|
+
const r = e.getBlock(t), l = e.getBlock(r.contentIds[0]), s = [...fe(r, l ? l.contentIds.length : 0)];
|
|
2101
2101
|
s[n] && (s[n] = { ...s[n], label: o }, e.applyOperation(G(t, { columns: s })));
|
|
2102
2102
|
}
|
|
2103
2103
|
function tn(e, t, n, o, r) {
|
|
@@ -2105,14 +2105,14 @@ function tn(e, t, n, o, r) {
|
|
|
2105
2105
|
const l = e.getBlock(t), a = l.contentIds.map((i) => {
|
|
2106
2106
|
const f = e.getBlock(i), b = e.getBlock(f.contentIds[n]);
|
|
2107
2107
|
return { rowId: i, run: b ? e.getRun(b.contentIds[0]) : null };
|
|
2108
|
-
}), c = ((p =
|
|
2108
|
+
}), c = ((p = fe(
|
|
2109
2109
|
l,
|
|
2110
2110
|
a.length ? e.getBlock(l.contentIds[0]).contentIds.length : 0
|
|
2111
2111
|
)[n]) == null ? void 0 : p.type) ?? It, u = pl(a, c, o, r);
|
|
2112
2112
|
e.applyOperation(Lt(t, u));
|
|
2113
2113
|
}
|
|
2114
2114
|
function wl(e, t, n, o) {
|
|
2115
|
-
const r = e.getBlock(t), l = e.getBlock(r.contentIds[0]), a =
|
|
2115
|
+
const r = e.getBlock(t), l = e.getBlock(r.contentIds[0]), a = fe(r, l ? l.contentIds.length : 0);
|
|
2116
2116
|
if (!a[n]) return;
|
|
2117
2117
|
const s = [...a];
|
|
2118
2118
|
s[n] = { ...a[n], aggregate: o }, e.applyOperation(G(t, { columns: s }));
|
|
@@ -2126,13 +2126,13 @@ function Ft(e, t, n) {
|
|
|
2126
2126
|
function Tl(e, t, n, o) {
|
|
2127
2127
|
const r = Ft(e, t, n), l = [], a = /* @__PURE__ */ new Map();
|
|
2128
2128
|
for (const { run: c } of r) {
|
|
2129
|
-
const u =
|
|
2129
|
+
const u = st(c, o).trim();
|
|
2130
2130
|
if (!u || a.has(u)) continue;
|
|
2131
2131
|
const p = { value: C(), label: u };
|
|
2132
2132
|
a.set(u, p), l.push(p);
|
|
2133
2133
|
}
|
|
2134
2134
|
const s = r.map(({ cellId: c, run: u }) => {
|
|
2135
|
-
const p =
|
|
2135
|
+
const p = st(u, o).trim(), i = a.get(p);
|
|
2136
2136
|
return {
|
|
2137
2137
|
cellId: c,
|
|
2138
2138
|
run: {
|
|
@@ -2147,7 +2147,7 @@ function Tl(e, t, n, o) {
|
|
|
2147
2147
|
return { options: l, newRuns: s };
|
|
2148
2148
|
}
|
|
2149
2149
|
function Cl(e, t, n, o, r) {
|
|
2150
|
-
const l = e.getBlock(t), a = e.getBlock(l.contentIds[0]), s =
|
|
2150
|
+
const l = e.getBlock(t), a = e.getBlock(l.contentIds[0]), s = fe(l, a ? a.contentIds.length : 0), c = s[n];
|
|
2151
2151
|
if (!c || c.type === o) return;
|
|
2152
2152
|
const u = [...s];
|
|
2153
2153
|
if (o === "select") {
|
|
@@ -2159,8 +2159,8 @@ function Cl(e, t, n, o, r) {
|
|
|
2159
2159
|
);
|
|
2160
2160
|
u[n] = { ...c, type: o, options: i };
|
|
2161
2161
|
const b = [G(t, { columns: u })];
|
|
2162
|
-
for (const { cellId: v, run: g } of f) b.push(
|
|
2163
|
-
|
|
2162
|
+
for (const { cellId: v, run: g } of f) b.push(Ge(v, [g]));
|
|
2163
|
+
Se(e, b);
|
|
2164
2164
|
return;
|
|
2165
2165
|
}
|
|
2166
2166
|
u[n] = { ...c, type: o };
|
|
@@ -2168,13 +2168,13 @@ function Cl(e, t, n, o, r) {
|
|
|
2168
2168
|
for (const { cellId: i, run: f } of Ft(e, l, n)) {
|
|
2169
2169
|
if (!f) continue;
|
|
2170
2170
|
const b = il(f, o, r);
|
|
2171
|
-
p.push(
|
|
2171
|
+
p.push(Ge(i, [b]));
|
|
2172
2172
|
}
|
|
2173
|
-
|
|
2173
|
+
Se(e, p);
|
|
2174
2174
|
}
|
|
2175
2175
|
function ht(e, t, n, o) {
|
|
2176
2176
|
var i, f;
|
|
2177
|
-
const r = e.getBlock(t), l = e.getBlock(r.contentIds[0]), a =
|
|
2177
|
+
const r = e.getBlock(t), l = e.getBlock(r.contentIds[0]), a = fe(r, l ? l.contentIds.length : 0), s = a[n];
|
|
2178
2178
|
if (!s) return;
|
|
2179
2179
|
const c = [...a];
|
|
2180
2180
|
c[n] = { ...s, options: o };
|
|
@@ -2183,16 +2183,16 @@ function ht(e, t, n, o) {
|
|
|
2183
2183
|
if (!b || b.type !== "tableSelect") continue;
|
|
2184
2184
|
const v = ((i = b.data) == null ? void 0 : i.selectedValue) ?? "", g = p.get(v), k = g ? v : "", I = g ? g.label : "";
|
|
2185
2185
|
(k !== v || I !== (((f = b.data) == null ? void 0 : f.selectedLabel) ?? "")) && u.push(
|
|
2186
|
-
|
|
2186
|
+
de(b.id, {
|
|
2187
2187
|
data: { selectedValue: k, selectedLabel: I }
|
|
2188
2188
|
})
|
|
2189
2189
|
);
|
|
2190
2190
|
}
|
|
2191
|
-
|
|
2191
|
+
Se(e, u);
|
|
2192
2192
|
}
|
|
2193
2193
|
const Bl = "$fieldTypes";
|
|
2194
2194
|
function Rl() {
|
|
2195
|
-
const e =
|
|
2195
|
+
const e = K(), t = h(
|
|
2196
2196
|
(o) => e.subscribe(Bl, o),
|
|
2197
2197
|
[e]
|
|
2198
2198
|
), n = h(() => e.getFieldTypes(), [e]);
|
|
@@ -2213,11 +2213,11 @@ function Nl() {
|
|
|
2213
2213
|
};
|
|
2214
2214
|
}, []), e;
|
|
2215
2215
|
}
|
|
2216
|
-
const Ll = 280, on = 220,
|
|
2217
|
-
function
|
|
2216
|
+
const Ll = 280, on = 220, Ml = 32, rn = 6;
|
|
2217
|
+
function Al(e, t) {
|
|
2218
2218
|
return t ? e.label.toLowerCase().includes(t.toLowerCase()) : !0;
|
|
2219
2219
|
}
|
|
2220
|
-
function
|
|
2220
|
+
function We({
|
|
2221
2221
|
value: e,
|
|
2222
2222
|
options: t,
|
|
2223
2223
|
onChange: n,
|
|
@@ -2232,60 +2232,60 @@ function Fe({
|
|
|
2232
2232
|
mention: i = !1,
|
|
2233
2233
|
autoOpen: f = !1
|
|
2234
2234
|
}) {
|
|
2235
|
-
var
|
|
2236
|
-
const [b, v] = O(!1), [g, k] = O(""), [I, m] = O(0), [y, B] = O(null),
|
|
2237
|
-
() =>
|
|
2238
|
-
[
|
|
2239
|
-
),
|
|
2240
|
-
|
|
2241
|
-
var
|
|
2242
|
-
const R = (
|
|
2243
|
-
R && Math.abs(R - Q) > 0.5 &&
|
|
2235
|
+
var z, ee;
|
|
2236
|
+
const [b, v] = O(!1), [g, k] = O(""), [I, m] = O(0), [y, B] = O(null), S = Nl(), [D, L] = O([]), [$, E] = O(!1), [j, w] = O(!1), N = _(null), x = _(null), P = _(null), A = _(null), H = _(null), Y = _(null), X = Ve(() => [N, P], []), pe = a === "tag", F = typeof t == "function", [Q, V] = O(Ml), [me, ce] = O(0), Ie = F ? void 0 : t.find((R) => R.value === e), ie = e ? Ie ?? (s ? { label: s, color: c } : void 0) : void 0, ne = Ve(
|
|
2237
|
+
() => F ? D : t.filter((R) => Al(R, g)),
|
|
2238
|
+
[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) - rn) : 0, dt = Math.ceil(on / Q) + rn * 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
|
+
at(() => {
|
|
2241
|
+
var J;
|
|
2242
|
+
const R = (J = Y.current) == null ? void 0 : J.getBoundingClientRect().height;
|
|
2243
|
+
R && Math.abs(R - Q) > 0.5 && V(R);
|
|
2244
2244
|
}), oe(() => {
|
|
2245
|
-
if (!
|
|
2245
|
+
if (!F || !b) return;
|
|
2246
2246
|
let R = !1;
|
|
2247
|
-
|
|
2248
|
-
const
|
|
2249
|
-
Promise.resolve(t(g)).then((
|
|
2250
|
-
R || (
|
|
2247
|
+
E(!0), w(!1);
|
|
2248
|
+
const J = setTimeout(() => {
|
|
2249
|
+
Promise.resolve(t(g)).then((ue) => {
|
|
2250
|
+
R || (L(ue ?? []), E(!1));
|
|
2251
2251
|
}).catch(() => {
|
|
2252
|
-
R || (
|
|
2252
|
+
R || (L([]), E(!1), w(!0));
|
|
2253
2253
|
});
|
|
2254
2254
|
}, 250);
|
|
2255
2255
|
return () => {
|
|
2256
|
-
R = !0, clearTimeout(
|
|
2256
|
+
R = !0, clearTimeout(J);
|
|
2257
2257
|
};
|
|
2258
|
-
}, [
|
|
2259
|
-
const
|
|
2260
|
-
|
|
2261
|
-
const
|
|
2258
|
+
}, [F, b, t, g]);
|
|
2259
|
+
const ye = h(() => v(!1), []);
|
|
2260
|
+
ct(X, b, ye);
|
|
2261
|
+
const Fe = _o(P, b, y == null ? void 0 : y.left), et = h(() => {
|
|
2262
2262
|
var R;
|
|
2263
2263
|
B(((R = x.current) == null ? void 0 : R.getBoundingClientRect()) ?? null), k(""), m(0), ce(0), v(!0);
|
|
2264
2264
|
}, []);
|
|
2265
2265
|
oe(() => {
|
|
2266
|
-
f &&
|
|
2266
|
+
f && et();
|
|
2267
2267
|
}, []), oe(() => {
|
|
2268
2268
|
var R;
|
|
2269
|
-
b && ((R =
|
|
2270
|
-
}, [b,
|
|
2271
|
-
const R =
|
|
2269
|
+
b && ((R = A.current) == null || R.focus());
|
|
2270
|
+
}, [b, Fe]), oe(() => {
|
|
2271
|
+
const R = H.current;
|
|
2272
2272
|
if (!R) return;
|
|
2273
|
-
const
|
|
2274
|
-
let
|
|
2275
|
-
|
|
2273
|
+
const J = I * Q, ue = J + Q, Re = R.scrollTop, Ne = R.clientHeight || on, we = Re + Ne;
|
|
2274
|
+
let tt = null;
|
|
2275
|
+
J < Re ? tt = J : ue > we && (tt = ue - Ne), tt !== null && (R.scrollTop = tt, ce(tt));
|
|
2276
2276
|
}, [I, Q]);
|
|
2277
|
-
const
|
|
2277
|
+
const M = h(
|
|
2278
2278
|
(R) => {
|
|
2279
|
-
var
|
|
2280
|
-
n(R.value, R),
|
|
2279
|
+
var J;
|
|
2280
|
+
n(R.value, R), ye(), (J = x.current) == null || J.focus();
|
|
2281
2281
|
},
|
|
2282
|
-
[n,
|
|
2283
|
-
),
|
|
2282
|
+
[n, ye]
|
|
2283
|
+
), W = h(
|
|
2284
2284
|
(R) => {
|
|
2285
|
-
var
|
|
2286
|
-
R.key === "ArrowDown" ? (R.preventDefault(), m((
|
|
2285
|
+
var J;
|
|
2286
|
+
R.key === "ArrowDown" ? (R.preventDefault(), m((ue) => Math.min(ue + 1, Math.max(ne.length - 1, 0)))) : R.key === "ArrowUp" ? (R.preventDefault(), m((ue) => Math.max(ue - 1, 0))) : R.key === "Enter" ? (R.preventDefault(), ne[I] && M(ne[I])) : R.key === "Escape" && (R.preventDefault(), ye(), (J = x.current) == null || J.focus());
|
|
2287
2287
|
},
|
|
2288
|
-
[
|
|
2288
|
+
[ne, I, M, ye]
|
|
2289
2289
|
);
|
|
2290
2290
|
return /* @__PURE__ */ T("span", { className: `be-select ${l}`.trim(), ref: N, children: [
|
|
2291
2291
|
/* @__PURE__ */ d(
|
|
@@ -2293,52 +2293,52 @@ function Fe({
|
|
|
2293
2293
|
{
|
|
2294
2294
|
type: "button",
|
|
2295
2295
|
ref: x,
|
|
2296
|
-
className: `be-select-trigger${
|
|
2296
|
+
className: `be-select-trigger${pe ? " be-select-trigger-tag" : ""}${i ? " be-select-trigger-mention" : ""}`,
|
|
2297
2297
|
"aria-haspopup": "listbox",
|
|
2298
2298
|
"aria-expanded": b,
|
|
2299
2299
|
"aria-label": r,
|
|
2300
|
-
onClick: () => b ?
|
|
2301
|
-
children:
|
|
2300
|
+
onClick: () => b ? ye() : et(),
|
|
2301
|
+
children: pe ? ie ? /* @__PURE__ */ d(
|
|
2302
2302
|
"span",
|
|
2303
2303
|
{
|
|
2304
2304
|
className: `be-select-tag${i ? " be-select-tag-mention" : ""}`,
|
|
2305
|
-
style: i ? void 0 : { background: (
|
|
2306
|
-
children: i ? `@${
|
|
2305
|
+
style: i ? void 0 : { background: (z = ie.color) == null ? void 0 : z.bg, color: (ee = ie.color) == null ? void 0 : ee.text },
|
|
2306
|
+
children: i ? `@${ie.label}` : ie.label
|
|
2307
2307
|
}
|
|
2308
2308
|
) : /* @__PURE__ */ d("span", { className: "be-select-value be-select-value-placeholder", children: o }) : /* @__PURE__ */ T(Te, { children: [
|
|
2309
|
-
/* @__PURE__ */ d("span", { className: "be-select-value", children:
|
|
2309
|
+
/* @__PURE__ */ d("span", { className: "be-select-value", children: ie ? ie.label : o }),
|
|
2310
2310
|
/* @__PURE__ */ d(Dt, { size: 14, className: "be-select-chevron" })
|
|
2311
2311
|
] })
|
|
2312
2312
|
}
|
|
2313
2313
|
),
|
|
2314
|
-
b && y &&
|
|
2314
|
+
b && y && Fe != null && He(
|
|
2315
2315
|
/* @__PURE__ */ T(
|
|
2316
2316
|
"div",
|
|
2317
2317
|
{
|
|
2318
|
-
ref:
|
|
2318
|
+
ref: P,
|
|
2319
2319
|
className: "be-select-popover",
|
|
2320
2320
|
style: {
|
|
2321
2321
|
position: "fixed",
|
|
2322
|
-
left:
|
|
2322
|
+
left: Fe,
|
|
2323
2323
|
minWidth: y.width,
|
|
2324
2324
|
// Flips above the trigger instead of below it once there isn't
|
|
2325
2325
|
// enough room left before the keyboard (or screen bottom) —
|
|
2326
2326
|
// otherwise the popover can render partly/entirely hidden
|
|
2327
2327
|
// underneath an open on-screen keyboard.
|
|
2328
|
-
...y.bottom + Ll > window.innerHeight -
|
|
2328
|
+
...y.bottom + Ll > window.innerHeight - S ? { bottom: window.innerHeight - y.top + 4 } : { top: y.bottom + 4 }
|
|
2329
2329
|
},
|
|
2330
2330
|
children: [
|
|
2331
2331
|
/* @__PURE__ */ d(
|
|
2332
2332
|
"input",
|
|
2333
2333
|
{
|
|
2334
|
-
ref:
|
|
2334
|
+
ref: A,
|
|
2335
2335
|
type: "text",
|
|
2336
2336
|
className: "be-select-search",
|
|
2337
2337
|
value: g,
|
|
2338
2338
|
onChange: (R) => {
|
|
2339
2339
|
k(R.target.value), m(0);
|
|
2340
2340
|
},
|
|
2341
|
-
onKeyDown:
|
|
2341
|
+
onKeyDown: W,
|
|
2342
2342
|
placeholder: "Search…",
|
|
2343
2343
|
"aria-label": r ? `Search ${r}` : "Search options"
|
|
2344
2344
|
}
|
|
@@ -2348,33 +2348,33 @@ function Fe({
|
|
|
2348
2348
|
{
|
|
2349
2349
|
className: "be-select-options",
|
|
2350
2350
|
role: "listbox",
|
|
2351
|
-
ref:
|
|
2351
|
+
ref: H,
|
|
2352
2352
|
onScroll: (R) => ce(R.currentTarget.scrollTop),
|
|
2353
2353
|
children: [
|
|
2354
|
-
|
|
2355
|
-
|
|
2356
|
-
!$ && !
|
|
2357
|
-
!$ && !
|
|
2358
|
-
|
|
2359
|
-
|
|
2360
|
-
var
|
|
2361
|
-
const
|
|
2354
|
+
F && $ && /* @__PURE__ */ d("div", { className: "be-select-empty", children: "Loading…" }),
|
|
2355
|
+
F && !$ && j && /* @__PURE__ */ d("div", { className: "be-select-empty be-select-error", children: "Couldn't load options" }),
|
|
2356
|
+
!$ && !j && ne.length === 0 && /* @__PURE__ */ d("div", { className: "be-select-empty", children: "No results" }),
|
|
2357
|
+
!$ && !j && ne.length > 0 && /* @__PURE__ */ T(Te, { children: [
|
|
2358
|
+
Je > 0 && /* @__PURE__ */ d("div", { style: { height: Je }, "aria-hidden": "true" }),
|
|
2359
|
+
wt.map((R, J) => {
|
|
2360
|
+
var Re, Ne;
|
|
2361
|
+
const ue = Z + J;
|
|
2362
2362
|
return /* @__PURE__ */ d(
|
|
2363
2363
|
"div",
|
|
2364
2364
|
{
|
|
2365
|
-
ref:
|
|
2365
|
+
ref: J === 0 ? Y : void 0,
|
|
2366
2366
|
role: "option",
|
|
2367
2367
|
"aria-selected": R.value === e,
|
|
2368
|
-
className: `be-select-option${
|
|
2369
|
-
onMouseDown: (
|
|
2370
|
-
|
|
2368
|
+
className: `be-select-option${ue === I ? " be-select-option-active" : ""}${R.value === e ? " be-select-option-selected" : ""}`,
|
|
2369
|
+
onMouseDown: (we) => {
|
|
2370
|
+
we.preventDefault(), M(R);
|
|
2371
2371
|
},
|
|
2372
|
-
onMouseEnter: () => m(
|
|
2373
|
-
children:
|
|
2372
|
+
onMouseEnter: () => m(ue),
|
|
2373
|
+
children: pe ? /* @__PURE__ */ d(
|
|
2374
2374
|
"span",
|
|
2375
2375
|
{
|
|
2376
2376
|
className: "be-select-tag",
|
|
2377
|
-
style: { background: (
|
|
2377
|
+
style: { background: (Re = R.color) == null ? void 0 : Re.bg, color: (Ne = R.color) == null ? void 0 : Ne.text },
|
|
2378
2378
|
children: R.label
|
|
2379
2379
|
}
|
|
2380
2380
|
) : R.label
|
|
@@ -2382,7 +2382,7 @@ function Fe({
|
|
|
2382
2382
|
R.value
|
|
2383
2383
|
);
|
|
2384
2384
|
}),
|
|
2385
|
-
|
|
2385
|
+
Ze > 0 && /* @__PURE__ */ d("div", { style: { height: Ze }, "aria-hidden": "true" })
|
|
2386
2386
|
] })
|
|
2387
2387
|
]
|
|
2388
2388
|
}
|
|
@@ -2393,7 +2393,7 @@ function Fe({
|
|
|
2393
2393
|
type: "button",
|
|
2394
2394
|
className: "be-select-manage-options",
|
|
2395
2395
|
onMouseDown: (R) => {
|
|
2396
|
-
R.preventDefault(),
|
|
2396
|
+
R.preventDefault(), ye(), u();
|
|
2397
2397
|
},
|
|
2398
2398
|
children: p
|
|
2399
2399
|
}
|
|
@@ -2425,7 +2425,7 @@ const pt = [
|
|
|
2425
2425
|
{ bg: "#ffe2dd", text: "#a13a2f" }
|
|
2426
2426
|
// red
|
|
2427
2427
|
];
|
|
2428
|
-
function
|
|
2428
|
+
function At(e) {
|
|
2429
2429
|
return pt[(e % pt.length + pt.length) % pt.length];
|
|
2430
2430
|
}
|
|
2431
2431
|
const El = { text: "Text", date: "Date", checkbox: "Checkbox", select: "Select" }, $l = fl.map((e) => ({
|
|
@@ -2433,7 +2433,7 @@ const El = { text: "Text", date: "Date", checkbox: "Checkbox", select: "Select"
|
|
|
2433
2433
|
label: ml[e]
|
|
2434
2434
|
})), xl = al.map((e) => ({ value: e, label: El[e] })), Ct = 800;
|
|
2435
2435
|
function Ol({ tableId: e, colIndex: t }) {
|
|
2436
|
-
const n =
|
|
2436
|
+
const n = K(), o = Rl(), { openCreate: r } = bo(), l = h(
|
|
2437
2437
|
(a) => {
|
|
2438
2438
|
const s = n.getFieldType(a);
|
|
2439
2439
|
s && ht(n, e, t, s.options ?? []);
|
|
@@ -2442,7 +2442,7 @@ function Ol({ tableId: e, colIndex: t }) {
|
|
|
2442
2442
|
);
|
|
2443
2443
|
return /* @__PURE__ */ T("div", { className: "be-table-header-menu-field-type", children: [
|
|
2444
2444
|
o.length > 0 && /* @__PURE__ */ d(
|
|
2445
|
-
|
|
2445
|
+
We,
|
|
2446
2446
|
{
|
|
2447
2447
|
value: "",
|
|
2448
2448
|
options: o.map((a) => ({ value: a.id, label: a.label })),
|
|
@@ -2455,7 +2455,7 @@ function Ol({ tableId: e, colIndex: t }) {
|
|
|
2455
2455
|
] });
|
|
2456
2456
|
}
|
|
2457
2457
|
function Sl({ tableId: e, colIndex: t, options: n }) {
|
|
2458
|
-
const o =
|
|
2458
|
+
const o = K(), [r, l] = O(""), a = h(
|
|
2459
2459
|
(u, p) => {
|
|
2460
2460
|
ht(
|
|
2461
2461
|
o,
|
|
@@ -2477,7 +2477,7 @@ function Sl({ tableId: e, colIndex: t, options: n }) {
|
|
|
2477
2477
|
const u = r.trim();
|
|
2478
2478
|
l(""), u && ht(o, e, t, [
|
|
2479
2479
|
...n,
|
|
2480
|
-
{ value: C(), label: u, color:
|
|
2480
|
+
{ value: C(), label: u, color: At(n.length) }
|
|
2481
2481
|
]);
|
|
2482
2482
|
}, [o, e, t, n, r]);
|
|
2483
2483
|
return /* @__PURE__ */ T("div", { className: "be-table-header-menu-options", children: [
|
|
@@ -2487,7 +2487,7 @@ function Sl({ tableId: e, colIndex: t, options: n }) {
|
|
|
2487
2487
|
"span",
|
|
2488
2488
|
{
|
|
2489
2489
|
className: "be-table-header-menu-option-swatch",
|
|
2490
|
-
style: { background: (u.color ??
|
|
2490
|
+
style: { background: (u.color ?? At(p)).bg },
|
|
2491
2491
|
"aria-hidden": "true"
|
|
2492
2492
|
}
|
|
2493
2493
|
),
|
|
@@ -2507,7 +2507,7 @@ function Sl({ tableId: e, colIndex: t, options: n }) {
|
|
|
2507
2507
|
className: "be-table-header-menu-option-remove",
|
|
2508
2508
|
onClick: () => s(u.value),
|
|
2509
2509
|
"aria-label": `Remove option ${u.label}`,
|
|
2510
|
-
children: /* @__PURE__ */ d(
|
|
2510
|
+
children: /* @__PURE__ */ d(it, { size: 14 })
|
|
2511
2511
|
}
|
|
2512
2512
|
)
|
|
2513
2513
|
] }, u.value)),
|
|
@@ -2538,57 +2538,57 @@ function Sl({ tableId: e, colIndex: t, options: n }) {
|
|
|
2538
2538
|
] });
|
|
2539
2539
|
}
|
|
2540
2540
|
function Dl({ tableId: e, column: t, colIndex: n, colCount: o, filterValue: r, onFilterChange: l }) {
|
|
2541
|
-
const a =
|
|
2542
|
-
|
|
2541
|
+
const a = K(), s = Ot(), [c, u] = O(!1), [p, i] = O(null), [f, b] = O(null), v = _(null), g = _(null), k = _(null), I = Ve(() => [v, g], []), m = h(() => u(!1), []);
|
|
2542
|
+
ct(I, c, m), _t(g, c, m, v);
|
|
2543
2543
|
const y = Uo(g, c, p == null ? void 0 : p.right), B = h(() => {
|
|
2544
|
-
var
|
|
2545
|
-
i(((
|
|
2546
|
-
}, []),
|
|
2547
|
-
(
|
|
2544
|
+
var A;
|
|
2545
|
+
i(((A = k.current) == null ? void 0 : A.getBoundingClientRect()) ?? null), u(!0);
|
|
2546
|
+
}, []), S = h(
|
|
2547
|
+
(A) => Il(a, e, n, A.target.value),
|
|
2548
2548
|
[a, e, n]
|
|
2549
2549
|
), D = h(() => {
|
|
2550
2550
|
Zt(a, e, n - 1), m();
|
|
2551
|
-
}, [a, e, n, m]),
|
|
2551
|
+
}, [a, e, n, m]), L = h(() => {
|
|
2552
2552
|
Zt(a, e, n), m();
|
|
2553
2553
|
}, [a, e, n, m]), $ = h(() => {
|
|
2554
2554
|
vl(a, e, n), m();
|
|
2555
|
-
}, [a, e, n, m]),
|
|
2556
|
-
(
|
|
2555
|
+
}, [a, e, n, m]), E = h(
|
|
2556
|
+
(A) => Cl(a, e, n, A, s),
|
|
2557
2557
|
[a, e, n, s]
|
|
2558
|
-
),
|
|
2558
|
+
), j = h(() => {
|
|
2559
2559
|
tn(a, e, n, "asc", s), m();
|
|
2560
2560
|
}, [a, e, n, s, m]), w = h(() => {
|
|
2561
2561
|
tn(a, e, n, "desc", s), m();
|
|
2562
2562
|
}, [a, e, n, s, m]), N = h(
|
|
2563
|
-
(
|
|
2563
|
+
(A) => wl(a, e, n, A),
|
|
2564
2564
|
[a, e, n]
|
|
2565
2565
|
), x = h(
|
|
2566
|
-
(
|
|
2567
|
-
var
|
|
2568
|
-
|
|
2569
|
-
const
|
|
2566
|
+
(A) => {
|
|
2567
|
+
var me;
|
|
2568
|
+
A.preventDefault();
|
|
2569
|
+
const H = (me = k.current) == null ? void 0 : me.closest("table"), Y = H == null ? void 0 : H.querySelector(`col[data-col-index="${n}"]`);
|
|
2570
2570
|
if (!Y) return;
|
|
2571
|
-
const X = k.current.getBoundingClientRect().width,
|
|
2572
|
-
const Ie =
|
|
2571
|
+
const X = k.current.getBoundingClientRect().width, pe = A.clientX, F = (ce) => Math.max(ze, Math.round(X + (ce.clientX - pe))), Q = (ce) => {
|
|
2572
|
+
const Ie = F(ce);
|
|
2573
2573
|
Y.style.width = `${Ie}px`, b(Ie);
|
|
2574
|
-
},
|
|
2575
|
-
document.removeEventListener("mousemove", Q), document.removeEventListener("mouseup",
|
|
2574
|
+
}, V = (ce) => {
|
|
2575
|
+
document.removeEventListener("mousemove", Q), document.removeEventListener("mouseup", V), en(a, e, n, F(ce)), b(null);
|
|
2576
2576
|
};
|
|
2577
|
-
document.addEventListener("mousemove", Q), document.addEventListener("mouseup",
|
|
2577
|
+
document.addEventListener("mousemove", Q), document.addEventListener("mouseup", V);
|
|
2578
2578
|
},
|
|
2579
2579
|
[a, e, n]
|
|
2580
|
-
),
|
|
2581
|
-
(
|
|
2582
|
-
const
|
|
2580
|
+
), P = h(
|
|
2581
|
+
(A) => {
|
|
2582
|
+
const H = t.width ?? ze, Y = A.shiftKey ? 1 : 16;
|
|
2583
2583
|
let X;
|
|
2584
|
-
if (
|
|
2585
|
-
X = Math.max(
|
|
2586
|
-
else if (
|
|
2587
|
-
X = Math.min(Ct,
|
|
2588
|
-
else if (
|
|
2589
|
-
else if (
|
|
2584
|
+
if (A.key === "ArrowLeft" || A.key === "ArrowDown")
|
|
2585
|
+
X = Math.max(ze, H - Y);
|
|
2586
|
+
else if (A.key === "ArrowRight" || A.key === "ArrowUp")
|
|
2587
|
+
X = Math.min(Ct, H + Y);
|
|
2588
|
+
else if (A.key === "Home") X = ze;
|
|
2589
|
+
else if (A.key === "End") X = Ct;
|
|
2590
2590
|
else return;
|
|
2591
|
-
|
|
2591
|
+
A.preventDefault(), en(a, e, n, X);
|
|
2592
2592
|
},
|
|
2593
2593
|
[a, e, n, t.width]
|
|
2594
2594
|
);
|
|
@@ -2598,7 +2598,7 @@ function Dl({ tableId: e, column: t, colIndex: n, colCount: o, filterValue: r, o
|
|
|
2598
2598
|
{
|
|
2599
2599
|
className: "be-table-header-label",
|
|
2600
2600
|
value: t.label,
|
|
2601
|
-
onChange:
|
|
2601
|
+
onChange: S,
|
|
2602
2602
|
"aria-label": `Column ${n + 1} name`
|
|
2603
2603
|
}
|
|
2604
2604
|
),
|
|
@@ -2620,16 +2620,16 @@ function Dl({ tableId: e, column: t, colIndex: n, colCount: o, filterValue: r, o
|
|
|
2620
2620
|
{
|
|
2621
2621
|
className: "be-table-col-resize-handle",
|
|
2622
2622
|
onMouseDown: x,
|
|
2623
|
-
onKeyDown:
|
|
2623
|
+
onKeyDown: P,
|
|
2624
2624
|
role: "slider",
|
|
2625
2625
|
tabIndex: 0,
|
|
2626
2626
|
"aria-label": `Resize column ${n + 1}`,
|
|
2627
|
-
"aria-valuemin":
|
|
2627
|
+
"aria-valuemin": ze,
|
|
2628
2628
|
"aria-valuemax": Ct,
|
|
2629
2629
|
"aria-valuenow": f ?? t.width
|
|
2630
2630
|
}
|
|
2631
2631
|
),
|
|
2632
|
-
c && p && y != null &&
|
|
2632
|
+
c && p && y != null && He(
|
|
2633
2633
|
/* @__PURE__ */ T(
|
|
2634
2634
|
"div",
|
|
2635
2635
|
{
|
|
@@ -2647,11 +2647,11 @@ function Dl({ tableId: e, column: t, colIndex: n, colCount: o, filterValue: r, o
|
|
|
2647
2647
|
/* @__PURE__ */ T("div", { className: "be-table-header-menu-type", children: [
|
|
2648
2648
|
/* @__PURE__ */ d("span", { id: `be-table-col-type-${t.id}`, children: "Type" }),
|
|
2649
2649
|
/* @__PURE__ */ d(
|
|
2650
|
-
|
|
2650
|
+
We,
|
|
2651
2651
|
{
|
|
2652
2652
|
value: t.type,
|
|
2653
2653
|
options: xl,
|
|
2654
|
-
onChange:
|
|
2654
|
+
onChange: E,
|
|
2655
2655
|
ariaLabel: "Column type",
|
|
2656
2656
|
className: ""
|
|
2657
2657
|
}
|
|
@@ -2675,7 +2675,7 @@ function Dl({ tableId: e, column: t, colIndex: n, colCount: o, filterValue: r, o
|
|
|
2675
2675
|
type: "button",
|
|
2676
2676
|
role: "menuitem",
|
|
2677
2677
|
className: "be-table-header-menu-item",
|
|
2678
|
-
onClick:
|
|
2678
|
+
onClick: j,
|
|
2679
2679
|
children: [
|
|
2680
2680
|
/* @__PURE__ */ d(Tn, { size: 13 }),
|
|
2681
2681
|
" Sort ascending"
|
|
@@ -2705,7 +2705,7 @@ function Dl({ tableId: e, column: t, colIndex: n, colCount: o, filterValue: r, o
|
|
|
2705
2705
|
className: "be-table-header-menu-filter-input",
|
|
2706
2706
|
placeholder: "Rows containing…",
|
|
2707
2707
|
value: r ?? "",
|
|
2708
|
-
onChange: (
|
|
2708
|
+
onChange: (A) => l(t.id, A.target.value),
|
|
2709
2709
|
"aria-label": `Filter column ${n + 1}`
|
|
2710
2710
|
}
|
|
2711
2711
|
)
|
|
@@ -2713,7 +2713,7 @@ function Dl({ tableId: e, column: t, colIndex: n, colCount: o, filterValue: r, o
|
|
|
2713
2713
|
/* @__PURE__ */ T("div", { className: "be-table-header-menu-type be-table-header-menu-aggregate", children: [
|
|
2714
2714
|
/* @__PURE__ */ d("span", { id: `be-table-col-aggregate-${t.id}`, children: "Footer" }),
|
|
2715
2715
|
/* @__PURE__ */ d(
|
|
2716
|
-
|
|
2716
|
+
We,
|
|
2717
2717
|
{
|
|
2718
2718
|
value: t.aggregate ?? "none",
|
|
2719
2719
|
options: $l,
|
|
@@ -2739,7 +2739,7 @@ function Dl({ tableId: e, column: t, colIndex: n, colCount: o, filterValue: r, o
|
|
|
2739
2739
|
type: "button",
|
|
2740
2740
|
role: "menuitem",
|
|
2741
2741
|
className: "be-table-header-menu-item",
|
|
2742
|
-
onClick:
|
|
2742
|
+
onClick: L,
|
|
2743
2743
|
children: "Insert column right"
|
|
2744
2744
|
}
|
|
2745
2745
|
),
|
|
@@ -2780,7 +2780,7 @@ function Hl({ tableId: e, columns: t, filters: n, onFilterChange: o }) {
|
|
|
2780
2780
|
}
|
|
2781
2781
|
function Pl({ id: e }) {
|
|
2782
2782
|
var g;
|
|
2783
|
-
const t =
|
|
2783
|
+
const t = K(), n = Ot(), o = te(e), [r, l] = O({}), a = h((k, I) => {
|
|
2784
2784
|
l(
|
|
2785
2785
|
(m) => I ? { ...m, [k]: I } : Object.fromEntries(Object.entries(m).filter(([y]) => y !== k))
|
|
2786
2786
|
);
|
|
@@ -2788,7 +2788,7 @@ function Pl({ id: e }) {
|
|
|
2788
2788
|
var I;
|
|
2789
2789
|
const k = (I = o == null ? void 0 : o.contentIds) == null ? void 0 : I[o.contentIds.length - 1];
|
|
2790
2790
|
k && yl(t, k);
|
|
2791
|
-
}, [t, o]), c = se("be-table-wrapper", o), u =
|
|
2791
|
+
}, [t, o]), c = se("be-table-wrapper", o), u = Ve(() => Object.entries(r).filter(([, k]) => k), [r]), p = h(
|
|
2792
2792
|
(k, I) => {
|
|
2793
2793
|
const m = t.getBlock(k), y = m && t.getBlock(m.contentIds[I]);
|
|
2794
2794
|
return y ? t.getRun(y.contentIds[0]) : null;
|
|
@@ -2796,10 +2796,10 @@ function Pl({ id: e }) {
|
|
|
2796
2796
|
[t]
|
|
2797
2797
|
);
|
|
2798
2798
|
if (!o) return null;
|
|
2799
|
-
const i = t.getBlock(o.contentIds[0]), f =
|
|
2799
|
+
const i = t.getBlock(o.contentIds[0]), f = fe(o, ((g = i == null ? void 0 : i.contentIds) == null ? void 0 : g.length) ?? 0), b = u.length === 0 ? o.contentIds : o.contentIds.filter(
|
|
2800
2800
|
(k) => u.every(([I, m]) => {
|
|
2801
|
-
const y = f.findIndex((
|
|
2802
|
-
return y === -1 ? !0 :
|
|
2801
|
+
const y = f.findIndex((S) => S.id === I);
|
|
2802
|
+
return y === -1 ? !0 : st(p(k, y), n).toLowerCase().includes(m.toLowerCase());
|
|
2803
2803
|
})
|
|
2804
2804
|
), v = f.some((k) => k.aggregate && k.aggregate !== "none");
|
|
2805
2805
|
return (
|
|
@@ -2828,7 +2828,7 @@ function Pl({ id: e }) {
|
|
|
2828
2828
|
onFilterChange: a
|
|
2829
2829
|
}
|
|
2830
2830
|
),
|
|
2831
|
-
/* @__PURE__ */ d("tbody", { children: /* @__PURE__ */ d(
|
|
2831
|
+
/* @__PURE__ */ d("tbody", { children: /* @__PURE__ */ d(Ue, { parentId: e, filterIds: b }) }),
|
|
2832
2832
|
v && /* @__PURE__ */ d("tfoot", { children: /* @__PURE__ */ T("tr", { className: "be-table-footer-row", children: [
|
|
2833
2833
|
f.map((k, I) => {
|
|
2834
2834
|
const m = b.map((B) => p(B, I)), y = gl(
|
|
@@ -2862,9 +2862,9 @@ function Pl({ id: e }) {
|
|
|
2862
2862
|
);
|
|
2863
2863
|
}
|
|
2864
2864
|
function _l({ id: e }) {
|
|
2865
|
-
const t =
|
|
2865
|
+
const t = K(), n = te(e), o = se("be-table-row", n), r = h(() => kl(t, e), [t, e]);
|
|
2866
2866
|
return /* @__PURE__ */ T("tr", { className: o, "data-block-id": e, children: [
|
|
2867
|
-
/* @__PURE__ */ d(
|
|
2867
|
+
/* @__PURE__ */ d(Ue, { parentId: e }),
|
|
2868
2868
|
/* @__PURE__ */ d("td", { className: "be-table-row-actions", contentEditable: !1, children: /* @__PURE__ */ d(
|
|
2869
2869
|
"button",
|
|
2870
2870
|
{
|
|
@@ -2873,12 +2873,12 @@ function _l({ id: e }) {
|
|
|
2873
2873
|
onClick: r,
|
|
2874
2874
|
"aria-label": "Delete row",
|
|
2875
2875
|
title: "Delete row",
|
|
2876
|
-
children: /* @__PURE__ */ d(
|
|
2876
|
+
children: /* @__PURE__ */ d(it, { size: 14 })
|
|
2877
2877
|
}
|
|
2878
2878
|
) })
|
|
2879
2879
|
] });
|
|
2880
2880
|
}
|
|
2881
|
-
function
|
|
2881
|
+
function Gn(e, t) {
|
|
2882
2882
|
const n = e.getBlock(t), o = e.getBlock(n.parentId), r = e.getBlock(o.parentId);
|
|
2883
2883
|
return {
|
|
2884
2884
|
table: r,
|
|
@@ -2888,7 +2888,7 @@ function Vn(e, t) {
|
|
|
2888
2888
|
};
|
|
2889
2889
|
}
|
|
2890
2890
|
function Ul(e, t, n) {
|
|
2891
|
-
const { table: o, row: r, rowIndex: l, colIndex: a } =
|
|
2891
|
+
const { table: o, row: r, rowIndex: l, colIndex: a } = Gn(e, t);
|
|
2892
2892
|
if (n === "left" || n === "right") {
|
|
2893
2893
|
const p = n === "right" ? 1 : -1, i = a + p;
|
|
2894
2894
|
if (i >= 0 && i < r.contentIds.length)
|
|
@@ -2909,9 +2909,9 @@ function jl(e, t) {
|
|
|
2909
2909
|
ve(n);
|
|
2910
2910
|
return;
|
|
2911
2911
|
}
|
|
2912
|
-
|
|
2912
|
+
Ye(e, t, U("paragraph"));
|
|
2913
2913
|
}
|
|
2914
|
-
function
|
|
2914
|
+
function ot(e, t, n) {
|
|
2915
2915
|
var r;
|
|
2916
2916
|
const o = Ul(e, t, n);
|
|
2917
2917
|
if (o) {
|
|
@@ -2920,16 +2920,16 @@ function tt(e, t, n) {
|
|
|
2920
2920
|
return;
|
|
2921
2921
|
}
|
|
2922
2922
|
if (n === "right") {
|
|
2923
|
-
const { table: l } =
|
|
2923
|
+
const { table: l } = Gn(e, t);
|
|
2924
2924
|
jl(e, l.id);
|
|
2925
2925
|
}
|
|
2926
2926
|
}
|
|
2927
2927
|
function Fl({ id: e }) {
|
|
2928
|
-
const t =
|
|
2928
|
+
const t = K(), n = te(e), o = h(() => ot(t, e, "right"), [t, e]), r = h(() => ot(t, e, "left"), [t, e]), l = h(() => ot(t, e, "up"), [t, e]), a = h(() => ot(t, e, "down"), [t, e]), s = h(() => ot(t, e, "down"), [t, e]), c = se("be-table-cell", n);
|
|
2929
2929
|
if (!n) return null;
|
|
2930
2930
|
const u = Ce(t, n);
|
|
2931
2931
|
return /* @__PURE__ */ d("td", { className: c, "data-block-id": e, dir: u, children: /* @__PURE__ */ d(
|
|
2932
|
-
|
|
2932
|
+
Ee,
|
|
2933
2933
|
{
|
|
2934
2934
|
blockId: e,
|
|
2935
2935
|
runIds: n.contentIds,
|
|
@@ -2942,7 +2942,7 @@ function Fl({ id: e }) {
|
|
|
2942
2942
|
}
|
|
2943
2943
|
) });
|
|
2944
2944
|
}
|
|
2945
|
-
function
|
|
2945
|
+
function Kl(e, t) {
|
|
2946
2946
|
const n = C(), o = [], r = [], l = [];
|
|
2947
2947
|
for (const a of t) {
|
|
2948
2948
|
const s = jt(n, a);
|
|
@@ -2954,31 +2954,31 @@ function zl(e, t) {
|
|
|
2954
2954
|
runs: r
|
|
2955
2955
|
};
|
|
2956
2956
|
}
|
|
2957
|
-
function
|
|
2957
|
+
function zl({ rows: e = 2, cols: t = 2 } = {}) {
|
|
2958
2958
|
return function(o) {
|
|
2959
|
-
const r = C(), l =
|
|
2959
|
+
const r = C(), l = Kn(t), a = [], s = [], c = [];
|
|
2960
2960
|
for (let p = 0; p < e; p += 1) {
|
|
2961
|
-
const i =
|
|
2961
|
+
const i = Kl(r, l);
|
|
2962
2962
|
a.push(i.block, ...i.blocks), s.push(...i.runs), c.push(i.block.id);
|
|
2963
2963
|
}
|
|
2964
2964
|
return { block: { id: r, type: "table", parentId: o, contentIds: c, props: { columns: l } }, runs: s, subtreeBlocks: a };
|
|
2965
2965
|
};
|
|
2966
2966
|
}
|
|
2967
|
-
function Vl(e, t) {
|
|
2968
|
-
return `<td>${e.contentIds.map((o) => t.store.getRun(o)).map((o) => Ne(o, t)).join("")}</td>`;
|
|
2969
|
-
}
|
|
2970
2967
|
function Gl(e, t) {
|
|
2971
|
-
return e.contentIds.map((
|
|
2968
|
+
return `<td>${e.contentIds.map((o) => t.store.getRun(o)).map((o) => Ae(o, t)).join("")}</td>`;
|
|
2969
|
+
}
|
|
2970
|
+
function Vl(e, t) {
|
|
2971
|
+
return e.contentIds.map((n) => Me(t.store.getRun(n), t)).join("");
|
|
2972
2972
|
}
|
|
2973
2973
|
function Wl(e, t) {
|
|
2974
|
-
return
|
|
2974
|
+
return De(
|
|
2975
2975
|
e.contentIds.map((o) => t.store.getRun(o)),
|
|
2976
2976
|
t
|
|
2977
2977
|
).replace(/\|/g, "\\|").replace(/\r?\n/g, "<br>");
|
|
2978
2978
|
}
|
|
2979
2979
|
function ql(e, t) {
|
|
2980
2980
|
if (e.tagName !== "TD" && e.tagName !== "TH") return null;
|
|
2981
|
-
const n =
|
|
2981
|
+
const n = Le(e, t);
|
|
2982
2982
|
return { block: {
|
|
2983
2983
|
id: C(),
|
|
2984
2984
|
type: "tableCell",
|
|
@@ -3016,7 +3016,7 @@ function Jl(e, t) {
|
|
|
3016
3016
|
}
|
|
3017
3017
|
function Zl(e, t) {
|
|
3018
3018
|
var a;
|
|
3019
|
-
const n = e.contentIds[0] && t.store.getBlock(e.contentIds[0]), o =
|
|
3019
|
+
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
3020
|
const c = t.store.getBlock(s);
|
|
3021
3021
|
return t.registry.get(c.type).toHTML(c, t);
|
|
3022
3022
|
}).join("");
|
|
@@ -3031,7 +3031,7 @@ function ea(e, t) {
|
|
|
3031
3031
|
}
|
|
3032
3032
|
function ta(e, t) {
|
|
3033
3033
|
var s;
|
|
3034
|
-
const n = e.contentIds[0] && t.store.getBlock(e.contentIds[0]), o =
|
|
3034
|
+
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
3035
|
if (o.length === 0) return "";
|
|
3036
3036
|
const r = `| ${o.map((c) => (c.label ?? "").replace(/\|/g, "\\|")).join(" | ")} |`, l = `| ${o.map(() => "---").join(" | ")} |`, a = e.contentIds.map((c) => {
|
|
3037
3037
|
const u = t.store.getBlock(c);
|
|
@@ -3068,8 +3068,8 @@ const oa = ae({
|
|
|
3068
3068
|
contentModel: "runs",
|
|
3069
3069
|
component: Fl,
|
|
3070
3070
|
defaultProps: {},
|
|
3071
|
-
toHTML:
|
|
3072
|
-
toPlainText:
|
|
3071
|
+
toHTML: Gl,
|
|
3072
|
+
toPlainText: Vl,
|
|
3073
3073
|
toMarkdown: Wl,
|
|
3074
3074
|
fromHTML: ql
|
|
3075
3075
|
}), ra = ae({
|
|
@@ -3094,16 +3094,16 @@ const oa = ae({
|
|
|
3094
3094
|
label: "Table",
|
|
3095
3095
|
icon: yo,
|
|
3096
3096
|
keywords: ["table", "grid"],
|
|
3097
|
-
run: (e, t) => re(e, t,
|
|
3097
|
+
run: (e, t) => re(e, t, zl({ rows: 2, cols: 2 }))
|
|
3098
3098
|
}
|
|
3099
3099
|
});
|
|
3100
3100
|
function aa({ id: e }) {
|
|
3101
|
-
const t =
|
|
3102
|
-
return /* @__PURE__ */ d("div", { className: n, "data-block-id": e, style: { display: "flex", gap: "1em" }, children: /* @__PURE__ */ d(
|
|
3101
|
+
const t = te(e), n = se("be-layout", t);
|
|
3102
|
+
return /* @__PURE__ */ d("div", { className: n, "data-block-id": e, style: { display: "flex", gap: "1em" }, children: /* @__PURE__ */ d(Ue, { parentId: e }) });
|
|
3103
3103
|
}
|
|
3104
3104
|
function sa({ id: e }) {
|
|
3105
|
-
const t =
|
|
3106
|
-
return /* @__PURE__ */ d("div", { className: n, "data-block-id": e, children: /* @__PURE__ */ d(
|
|
3105
|
+
const t = te(e), n = se("be-layout-column", t);
|
|
3106
|
+
return /* @__PURE__ */ d("div", { className: n, "data-block-id": e, children: /* @__PURE__ */ d(Ue, { parentId: e }) });
|
|
3107
3107
|
}
|
|
3108
3108
|
function ca({ columns: e = 2 } = {}) {
|
|
3109
3109
|
return function(n) {
|
|
@@ -3121,7 +3121,7 @@ function ca({ columns: e = 2 } = {}) {
|
|
|
3121
3121
|
return { block: { id: o, type: "layout", parentId: n, contentIds: a, props: {} }, runs: l, subtreeBlocks: r };
|
|
3122
3122
|
};
|
|
3123
3123
|
}
|
|
3124
|
-
function
|
|
3124
|
+
function Vn(e, t) {
|
|
3125
3125
|
return (n, o) => `${e}${n.contentIds.map((r) => {
|
|
3126
3126
|
const l = o.store.getBlock(r);
|
|
3127
3127
|
return o.registry.get(l.type).toHTML(l, o);
|
|
@@ -3147,7 +3147,7 @@ const ia = ae({
|
|
|
3147
3147
|
contentModel: "blocks",
|
|
3148
3148
|
component: sa,
|
|
3149
3149
|
defaultProps: {},
|
|
3150
|
-
toHTML:
|
|
3150
|
+
toHTML: Vn("<div>", "</div>"),
|
|
3151
3151
|
toPlainText: Wn,
|
|
3152
3152
|
toMarkdown: qn
|
|
3153
3153
|
// no fromHTML: a bare column has no distinct HTML representation of its
|
|
@@ -3158,7 +3158,7 @@ const ia = ae({
|
|
|
3158
3158
|
contentModel: "blocks",
|
|
3159
3159
|
component: aa,
|
|
3160
3160
|
defaultProps: {},
|
|
3161
|
-
toHTML:
|
|
3161
|
+
toHTML: Vn('<div style="display:flex;gap:1em">', "</div>"),
|
|
3162
3162
|
toPlainText: Wn,
|
|
3163
3163
|
toMarkdown: qn,
|
|
3164
3164
|
slashCommands: [2, 3, 4, 5].map((e) => ({
|
|
@@ -3169,7 +3169,7 @@ const ia = ae({
|
|
|
3169
3169
|
}))
|
|
3170
3170
|
});
|
|
3171
3171
|
function da({ id: e }) {
|
|
3172
|
-
const t =
|
|
3172
|
+
const t = te(e), n = se("be-divider", t);
|
|
3173
3173
|
return /* @__PURE__ */ d("hr", { className: n, "data-block-id": e, contentEditable: !1, tabIndex: -1 });
|
|
3174
3174
|
}
|
|
3175
3175
|
function pa() {
|
|
@@ -3211,10 +3211,10 @@ const ba = ae({
|
|
|
3211
3211
|
run: (e, { blockId: t, runId: n, sliceStart: o, sliceEnd: r }) => {
|
|
3212
3212
|
const l = e.getRun(n), a = (l == null ? void 0 : l.value) ?? "";
|
|
3213
3213
|
e.applyOperation(
|
|
3214
|
-
|
|
3214
|
+
de(n, { value: a.slice(0, o) + a.slice(r) })
|
|
3215
3215
|
);
|
|
3216
3216
|
const s = xn(e, t, pa());
|
|
3217
|
-
return
|
|
3217
|
+
return Ye(e, s, U("paragraph")), s;
|
|
3218
3218
|
}
|
|
3219
3219
|
}
|
|
3220
3220
|
}), ya = [
|
|
@@ -3229,9 +3229,9 @@ const ba = ae({
|
|
|
3229
3229
|
];
|
|
3230
3230
|
function ka({ id: e }) {
|
|
3231
3231
|
var I, m;
|
|
3232
|
-
const t =
|
|
3233
|
-
|
|
3234
|
-
const i = ((I = n == null ? void 0 : n.props) == null ? void 0 : I.icon) ??
|
|
3232
|
+
const t = K(), n = te(e), [o, r] = O(!1), [l, a] = O(!1), s = _(null), c = _(null), u = Ve(() => [s, c], []), p = h(() => a(!1), []);
|
|
3233
|
+
ct(u, l, p);
|
|
3234
|
+
const i = ((I = n == null ? void 0 : n.props) == null ? void 0 : I.icon) ?? _e, f = ((m = n == null ? void 0 : n.props) == null ? void 0 : m.color) ?? Pn, b = h(
|
|
3235
3235
|
(y) => {
|
|
3236
3236
|
const B = y.target.value.trim();
|
|
3237
3237
|
B && t.applyOperation(G(e, { icon: B })), r(!1);
|
|
@@ -3268,7 +3268,7 @@ function ka({ id: e }) {
|
|
|
3268
3268
|
children: i
|
|
3269
3269
|
}
|
|
3270
3270
|
) }),
|
|
3271
|
-
/* @__PURE__ */ d("div", { className: "be-callout-content", children: /* @__PURE__ */ d(
|
|
3271
|
+
/* @__PURE__ */ d("div", { className: "be-callout-content", children: /* @__PURE__ */ d(Ue, { parentId: e }) }),
|
|
3272
3272
|
/* @__PURE__ */ T("div", { className: "be-callout-color-wrap", contentEditable: !1, children: [
|
|
3273
3273
|
/* @__PURE__ */ d(
|
|
3274
3274
|
"button",
|
|
@@ -3316,12 +3316,12 @@ function va(e, t) {
|
|
|
3316
3316
|
}
|
|
3317
3317
|
function Ia(e, t) {
|
|
3318
3318
|
var o;
|
|
3319
|
-
const n = ((o = e.props) == null ? void 0 : o.icon) ??
|
|
3319
|
+
const n = ((o = e.props) == null ? void 0 : o.icon) ?? _e;
|
|
3320
3320
|
return `<div class="callout" data-icon="${n}"><div class="callout-icon">${n}</div><div class="callout-content">${va(e, t)}</div></div>`;
|
|
3321
3321
|
}
|
|
3322
3322
|
function wa(e, t) {
|
|
3323
3323
|
var r;
|
|
3324
|
-
const n = ((r = e.props) == null ? void 0 : r.icon) ??
|
|
3324
|
+
const n = ((r = e.props) == null ? void 0 : r.icon) ?? _e, o = e.contentIds.map((l) => {
|
|
3325
3325
|
const a = t.store.getBlock(l);
|
|
3326
3326
|
return t.registry.get(a.type).toPlainText(a, t);
|
|
3327
3327
|
}).join(`
|
|
@@ -3330,7 +3330,7 @@ function wa(e, t) {
|
|
|
3330
3330
|
}
|
|
3331
3331
|
function Ta(e, t) {
|
|
3332
3332
|
var r;
|
|
3333
|
-
const n = ((r = e.props) == null ? void 0 : r.icon) ??
|
|
3333
|
+
const n = ((r = e.props) == null ? void 0 : r.icon) ?? _e;
|
|
3334
3334
|
return e.contentIds.map((l) => {
|
|
3335
3335
|
const a = t.store.getBlock(l), s = t.registry.get(a.type);
|
|
3336
3336
|
return (s.toMarkdown ?? s.toPlainText)(a, t);
|
|
@@ -3343,7 +3343,7 @@ const Ca = ae({
|
|
|
3343
3343
|
name: "callout",
|
|
3344
3344
|
contentModel: "blocks",
|
|
3345
3345
|
component: ka,
|
|
3346
|
-
defaultProps: { icon:
|
|
3346
|
+
defaultProps: { icon: _e },
|
|
3347
3347
|
toHTML: Ia,
|
|
3348
3348
|
toPlainText: wa,
|
|
3349
3349
|
toMarkdown: Ta,
|
|
@@ -3361,19 +3361,19 @@ const Ca = ae({
|
|
|
3361
3361
|
}
|
|
3362
3362
|
});
|
|
3363
3363
|
function Ba({ id: e }) {
|
|
3364
|
-
const t =
|
|
3365
|
-
|
|
3364
|
+
const t = K(), n = te(e), { setSelectedBlockId: o } = Pe(), r = h(() => {
|
|
3365
|
+
Xe(
|
|
3366
3366
|
t,
|
|
3367
3367
|
e,
|
|
3368
3368
|
(n == null ? void 0 : n.contentIds) ?? [],
|
|
3369
3369
|
U("paragraph")
|
|
3370
3370
|
);
|
|
3371
3371
|
}, [t, e, n]), l = h(() => {
|
|
3372
|
-
const i =
|
|
3373
|
-
|
|
3372
|
+
const i = ut(t, e);
|
|
3373
|
+
Qe(t, i, e, o);
|
|
3374
3374
|
}, [t, e, o]), a = h(() => le(t, e, "up"), [t, e]), s = h(() => le(t, e, "down"), [t, e]), c = se("be-blockquote", n);
|
|
3375
3375
|
if (!n) return null;
|
|
3376
|
-
const u =
|
|
3376
|
+
const u = ge(t, n.contentIds), p = Ce(t, n);
|
|
3377
3377
|
return /* @__PURE__ */ d(
|
|
3378
3378
|
"blockquote",
|
|
3379
3379
|
{
|
|
@@ -3383,7 +3383,7 @@ function Ba({ id: e }) {
|
|
|
3383
3383
|
"data-placeholder": "Empty quote",
|
|
3384
3384
|
dir: p,
|
|
3385
3385
|
children: /* @__PURE__ */ d(
|
|
3386
|
-
|
|
3386
|
+
Ee,
|
|
3387
3387
|
{
|
|
3388
3388
|
blockId: e,
|
|
3389
3389
|
runIds: n.contentIds,
|
|
@@ -3398,20 +3398,20 @@ function Ba({ id: e }) {
|
|
|
3398
3398
|
);
|
|
3399
3399
|
}
|
|
3400
3400
|
function Ra(e, t) {
|
|
3401
|
-
return `<p>${e.contentIds.map((o) => t.store.getRun(o)).map((o) =>
|
|
3401
|
+
return `<p>${e.contentIds.map((o) => t.store.getRun(o)).map((o) => Ae(o, t)).join("")}</p>`;
|
|
3402
3402
|
}
|
|
3403
3403
|
function Na(e, t) {
|
|
3404
|
-
return e.contentIds.map((n) =>
|
|
3404
|
+
return e.contentIds.map((n) => Me(t.store.getRun(n), t)).join("");
|
|
3405
3405
|
}
|
|
3406
3406
|
function La(e, t) {
|
|
3407
|
-
return `> ${
|
|
3407
|
+
return `> ${De(
|
|
3408
3408
|
e.contentIds.map((o) => t.store.getRun(o)),
|
|
3409
3409
|
t
|
|
3410
3410
|
)}`;
|
|
3411
3411
|
}
|
|
3412
|
-
function
|
|
3412
|
+
function Ma(e, t) {
|
|
3413
3413
|
if (e.tagName !== "BLOCKQUOTE") return null;
|
|
3414
|
-
const n =
|
|
3414
|
+
const n = Le(e, t);
|
|
3415
3415
|
return { block: {
|
|
3416
3416
|
id: C(),
|
|
3417
3417
|
type: "blockquote",
|
|
@@ -3420,7 +3420,7 @@ function Aa(e, t) {
|
|
|
3420
3420
|
props: {}
|
|
3421
3421
|
}, runs: n };
|
|
3422
3422
|
}
|
|
3423
|
-
const
|
|
3423
|
+
const Aa = ae({
|
|
3424
3424
|
name: "blockquote",
|
|
3425
3425
|
contentModel: "runs",
|
|
3426
3426
|
component: Ba,
|
|
@@ -3428,7 +3428,7 @@ const Ma = ae({
|
|
|
3428
3428
|
toHTML: Ra,
|
|
3429
3429
|
toPlainText: Na,
|
|
3430
3430
|
toMarkdown: La,
|
|
3431
|
-
fromHTML:
|
|
3431
|
+
fromHTML: Ma,
|
|
3432
3432
|
slashCommand: {
|
|
3433
3433
|
label: "Quote",
|
|
3434
3434
|
icon: kn,
|
|
@@ -3451,14 +3451,14 @@ function ln(e, t, n) {
|
|
|
3451
3451
|
const r = e.getRun(o.runId);
|
|
3452
3452
|
if (!r || r.type !== "text") return;
|
|
3453
3453
|
const l = r.value ?? "", a = l.slice(0, o.offset) + n + l.slice(o.offset);
|
|
3454
|
-
e.applyOperation(
|
|
3454
|
+
e.applyOperation(de(r.id, { value: a })), Do(r.id, o.offset + n.length);
|
|
3455
3455
|
}
|
|
3456
3456
|
function xa({ id: e }) {
|
|
3457
3457
|
var g, k;
|
|
3458
|
-
const t =
|
|
3458
|
+
const t = K(), n = te(e), o = Io(), r = h(() => ln(t, e, `
|
|
3459
3459
|
`), [t, e]), l = h(() => ln(t, e, " "), [t, e]), a = h(() => {
|
|
3460
3460
|
var B;
|
|
3461
|
-
const I =
|
|
3461
|
+
const I = ut(t, e);
|
|
3462
3462
|
if (!I || I === e) return;
|
|
3463
3463
|
const m = t.getBlock(I), y = (B = m == null ? void 0 : m.contentIds) == null ? void 0 : B[m.contentIds.length - 1];
|
|
3464
3464
|
y && ve(y);
|
|
@@ -3467,14 +3467,14 @@ function xa({ id: e }) {
|
|
|
3467
3467
|
[t, e]
|
|
3468
3468
|
), p = h(() => Un(t, e), [t, e]), i = se("be-code-block", n);
|
|
3469
3469
|
if (!n) return null;
|
|
3470
|
-
const f = ((g = n.props) == null ? void 0 : g.language) ?? "plaintext", b =
|
|
3470
|
+
const f = ((g = n.props) == null ? void 0 : g.language) ?? "plaintext", b = ge(t, n.contentIds), v = o ? (((k = n.contentIds.map((I) => {
|
|
3471
3471
|
var m;
|
|
3472
3472
|
return ((m = t.getRun(I)) == null ? void 0 : m.value) ?? "";
|
|
3473
3473
|
}).join("").match(/\n/g)) == null ? void 0 : k.length) ?? 0) + 1 : 0;
|
|
3474
3474
|
return /* @__PURE__ */ T("div", { className: i, "data-block-id": e, children: [
|
|
3475
3475
|
/* @__PURE__ */ T("div", { className: "be-code-block-header", contentEditable: !1, children: [
|
|
3476
3476
|
/* @__PURE__ */ d(
|
|
3477
|
-
|
|
3477
|
+
We,
|
|
3478
3478
|
{
|
|
3479
3479
|
className: "be-code-block-language",
|
|
3480
3480
|
value: f,
|
|
@@ -3498,7 +3498,7 @@ function xa({ id: e }) {
|
|
|
3498
3498
|
/* @__PURE__ */ T("div", { className: "be-code-block-body", children: [
|
|
3499
3499
|
o && /* @__PURE__ */ d("div", { className: "be-code-block-gutter", contentEditable: !1, "aria-hidden": "true", children: Array.from({ length: v }, (I, m) => /* @__PURE__ */ d("span", { children: m + 1 }, m)) }),
|
|
3500
3500
|
/* @__PURE__ */ d("pre", { className: "be-code-block-pre", dir: "ltr", children: /* @__PURE__ */ d("code", { "data-empty": b ? "" : void 0, "data-placeholder": "Empty code block", children: /* @__PURE__ */ d(
|
|
3501
|
-
|
|
3501
|
+
Ee,
|
|
3502
3502
|
{
|
|
3503
3503
|
blockId: e,
|
|
3504
3504
|
runIds: n.contentIds,
|
|
@@ -3516,10 +3516,10 @@ function xa({ id: e }) {
|
|
|
3516
3516
|
function Oa(e, t) {
|
|
3517
3517
|
var l;
|
|
3518
3518
|
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) =>
|
|
3519
|
+
return `<pre><code${o && o !== "plaintext" ? ` data-language="${gt(o)}"` : ""}>${n.map((a) => Ae(a, t)).join("")}</code></pre>`;
|
|
3520
3520
|
}
|
|
3521
3521
|
function Sa(e, t) {
|
|
3522
|
-
return e.contentIds.map((n) =>
|
|
3522
|
+
return e.contentIds.map((n) => Me(t.store.getRun(n), t)).join("");
|
|
3523
3523
|
}
|
|
3524
3524
|
function Da(e, t) {
|
|
3525
3525
|
var l;
|
|
@@ -3568,7 +3568,7 @@ function Ua(e, t) {
|
|
|
3568
3568
|
if (n.length === 0) return !0;
|
|
3569
3569
|
if (n.length > 1) return !1;
|
|
3570
3570
|
const o = e.getBlock(n[0]);
|
|
3571
|
-
return !!o && o.type === "paragraph" &&
|
|
3571
|
+
return !!o && o.type === "paragraph" && ge(e, o.contentIds);
|
|
3572
3572
|
}
|
|
3573
3573
|
function ft(e, t) {
|
|
3574
3574
|
if (typeof e.performBatch == "function") e.performBatch(t);
|
|
@@ -3595,21 +3595,21 @@ function Fa(e, t) {
|
|
|
3595
3595
|
if (typeof e.performBatch == "function") e.performBatch(t);
|
|
3596
3596
|
else for (const n of t) e.applyOperation(n);
|
|
3597
3597
|
}
|
|
3598
|
-
function
|
|
3598
|
+
function Ka({ id: e }) {
|
|
3599
3599
|
var k;
|
|
3600
|
-
const t =
|
|
3601
|
-
var B,
|
|
3602
|
-
const I = ((B = n == null ? void 0 : n.props) == null ? void 0 : B.titleRunIds) ?? [], m = (((
|
|
3603
|
-
m ? $n(t, e, I, y) :
|
|
3600
|
+
const t = K(), n = te(e), { setSelectedBlockId: o } = Pe(), r = h(() => {
|
|
3601
|
+
var B, S;
|
|
3602
|
+
const I = ((B = n == null ? void 0 : n.props) == null ? void 0 : B.titleRunIds) ?? [], m = (((S = n == null ? void 0 : n.contentIds) == null ? void 0 : S.length) ?? 0) > 0, y = U("paragraph");
|
|
3603
|
+
m ? $n(t, e, I, y) : Xe(t, e, I, y);
|
|
3604
3604
|
}, [t, e, n]), l = h(() => {
|
|
3605
3605
|
const I = ja(t, e);
|
|
3606
|
-
!I || !I.needsRefocus ||
|
|
3606
|
+
!I || !I.needsRefocus || Qe(t, I.focusBlockId, e, o);
|
|
3607
3607
|
}, [t, e, o]), a = h(() => le(t, e, "up"), [t, e]), s = h(() => le(t, e, "down"), [t, e]), c = h(() => {
|
|
3608
3608
|
var m, y;
|
|
3609
3609
|
if (!((((m = n == null ? void 0 : n.contentIds) == null ? void 0 : m.length) ?? 0) > 0)) {
|
|
3610
|
-
const { block: B, runs:
|
|
3610
|
+
const { block: B, runs: S } = U("paragraph")(e);
|
|
3611
3611
|
Fa(t, [
|
|
3612
|
-
ke(B, e, 0, { blocks: [B], runs:
|
|
3612
|
+
ke(B, e, 0, { blocks: [B], runs: S }),
|
|
3613
3613
|
G(e, { collapsed: !1 })
|
|
3614
3614
|
]), ve(B.contentIds[0]);
|
|
3615
3615
|
return;
|
|
@@ -3628,17 +3628,17 @@ function za({ id: e }) {
|
|
|
3628
3628
|
onClick: c,
|
|
3629
3629
|
"aria-expanded": !i,
|
|
3630
3630
|
"aria-label": b ? i ? "Expand section" : "Collapse section" : "Add content to section",
|
|
3631
|
-
children: i ? /* @__PURE__ */ d(
|
|
3631
|
+
children: i ? /* @__PURE__ */ d(Oe, {}) : /* @__PURE__ */ d(Dt, {})
|
|
3632
3632
|
}
|
|
3633
3633
|
),
|
|
3634
3634
|
/* @__PURE__ */ d(
|
|
3635
3635
|
v,
|
|
3636
3636
|
{
|
|
3637
3637
|
className: `be-heading be-heading-${p} be-toggle-heading-title`,
|
|
3638
|
-
"data-empty":
|
|
3638
|
+
"data-empty": ge(t, f) ? "" : void 0,
|
|
3639
3639
|
"data-placeholder": `Toggle heading ${p}`,
|
|
3640
3640
|
children: /* @__PURE__ */ d(
|
|
3641
|
-
|
|
3641
|
+
Ee,
|
|
3642
3642
|
{
|
|
3643
3643
|
blockId: e,
|
|
3644
3644
|
runIds: f,
|
|
@@ -3652,10 +3652,10 @@ function za({ id: e }) {
|
|
|
3652
3652
|
}
|
|
3653
3653
|
)
|
|
3654
3654
|
] }),
|
|
3655
|
-
!i && /* @__PURE__ */ d("div", { className: "be-toggle-heading-children", children: /* @__PURE__ */ d(
|
|
3655
|
+
!i && /* @__PURE__ */ d("div", { className: "be-toggle-heading-children", children: /* @__PURE__ */ d(Ue, { parentId: e }) })
|
|
3656
3656
|
] });
|
|
3657
3657
|
}
|
|
3658
|
-
function
|
|
3658
|
+
function za({ level: e = 2, collapsed: t = !1 } = {}) {
|
|
3659
3659
|
return function(o, r) {
|
|
3660
3660
|
const l = C(), a = r != null && r.length ? r : [{ id: C(), type: "text", value: "", marks: {} }], { block: s, runs: c } = U("paragraph")(l);
|
|
3661
3661
|
return {
|
|
@@ -3671,15 +3671,15 @@ function Ka({ level: e = 2, collapsed: t = !1 } = {}) {
|
|
|
3671
3671
|
};
|
|
3672
3672
|
};
|
|
3673
3673
|
}
|
|
3674
|
-
function
|
|
3675
|
-
const { titleRunIds: n = [], level: o = 2, collapsed: r } = e.props, l = n.map((s) =>
|
|
3674
|
+
function Ga(e, t) {
|
|
3675
|
+
const { titleRunIds: n = [], level: o = 2, collapsed: r } = e.props, l = n.map((s) => Ae(t.store.getRun(s), t)).join(""), a = e.contentIds.map((s) => {
|
|
3676
3676
|
const c = t.store.getBlock(s);
|
|
3677
3677
|
return t.registry.get(c.type).toHTML(c, t);
|
|
3678
3678
|
}).join("");
|
|
3679
3679
|
return `<details${r ? "" : " open"}><summary><h${o}>${l}</h${o}></summary>${a}</details>`;
|
|
3680
3680
|
}
|
|
3681
|
-
function
|
|
3682
|
-
const { titleRunIds: n = [] } = e.props, o = n.map((l) =>
|
|
3681
|
+
function Va(e, t) {
|
|
3682
|
+
const { titleRunIds: n = [] } = e.props, o = n.map((l) => Me(t.store.getRun(l), t)).join(""), r = e.contentIds.map((l) => {
|
|
3683
3683
|
const a = t.store.getBlock(l);
|
|
3684
3684
|
return t.registry.get(a.type).toPlainText(a, t);
|
|
3685
3685
|
}).join(`
|
|
@@ -3688,7 +3688,7 @@ function Ga(e, t) {
|
|
|
3688
3688
|
${r}` : o;
|
|
3689
3689
|
}
|
|
3690
3690
|
function Wa(e, t) {
|
|
3691
|
-
const { titleRunIds: n = [], level: o = 2 } = e.props, r =
|
|
3691
|
+
const { titleRunIds: n = [], level: o = 2 } = e.props, r = De(
|
|
3692
3692
|
n.map((s) => t.store.getRun(s)),
|
|
3693
3693
|
t
|
|
3694
3694
|
), l = `${"#".repeat(Math.min(6, o))} ${r}`, a = e.contentIds.map((s) => {
|
|
@@ -3703,10 +3703,10 @@ ${a}` : l;
|
|
|
3703
3703
|
}
|
|
3704
3704
|
function qa(e, t) {
|
|
3705
3705
|
if (e.tagName !== "DETAILS") return null;
|
|
3706
|
-
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 ?
|
|
3706
|
+
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
3707
|
for (const i of e.children) {
|
|
3708
3708
|
if (i === n || i.tagName !== "P") continue;
|
|
3709
|
-
const f =
|
|
3709
|
+
const f = Le(i, t), b = {
|
|
3710
3710
|
id: C(),
|
|
3711
3711
|
type: "paragraph",
|
|
3712
3712
|
parentId: a,
|
|
@@ -3734,21 +3734,21 @@ function qa(e, t) {
|
|
|
3734
3734
|
const Ya = ae({
|
|
3735
3735
|
name: "toggleHeading",
|
|
3736
3736
|
contentModel: "blocks",
|
|
3737
|
-
component:
|
|
3737
|
+
component: Ka,
|
|
3738
3738
|
defaultProps: { level: 2, collapsed: !1, titleRunIds: [] },
|
|
3739
|
-
toHTML:
|
|
3740
|
-
toPlainText:
|
|
3739
|
+
toHTML: Ga,
|
|
3740
|
+
toPlainText: Va,
|
|
3741
3741
|
toMarkdown: Wa,
|
|
3742
3742
|
fromHTML: qa,
|
|
3743
3743
|
slashCommands: [1, 2, 3].map((e) => ({
|
|
3744
3744
|
label: `Toggle heading ${e}`,
|
|
3745
|
-
icon:
|
|
3745
|
+
icon: Oe,
|
|
3746
3746
|
// Deliberately does NOT include "h1"/"h2"/"h3" — those short forms
|
|
3747
3747
|
// already belong exclusively to the plain heading commands (see
|
|
3748
3748
|
// heading/index.js); duplicating them here would make "/h3" ambiguous
|
|
3749
3749
|
// between "Heading 3" and "Toggle heading 3".
|
|
3750
3750
|
keywords: ["toggle", "heading", "collapse", "section"],
|
|
3751
|
-
run: (t, n) => re(t, n,
|
|
3751
|
+
run: (t, n) => re(t, n, za({ level: e }))
|
|
3752
3752
|
}))
|
|
3753
3753
|
}), Bt = [
|
|
3754
3754
|
{ label: "Blue", value: "#2b6fd6" },
|
|
@@ -3769,15 +3769,15 @@ function Qa({ isOpen: e, onClose: t, store: n, blockId: o }) {
|
|
|
3769
3769
|
if (!e) return;
|
|
3770
3770
|
const g = n.getBlock(o);
|
|
3771
3771
|
if (!g) return;
|
|
3772
|
-
const k = g.contentIds.map((
|
|
3772
|
+
const k = g.contentIds.map((S) => {
|
|
3773
3773
|
var D;
|
|
3774
|
-
return ((D = n.getRun(
|
|
3774
|
+
return ((D = n.getRun(S)) == null ? void 0 : D.value) ?? "";
|
|
3775
3775
|
}).join(""), I = ((m = g.props) == null ? void 0 : m.customAttrs) ?? [];
|
|
3776
3776
|
l(k), s(((y = g.props) == null ? void 0 : y.href) ?? ""), u(((B = g.props) == null ? void 0 : B.color) ?? Bt[0].value), i([...I, { key: "", value: "" }]);
|
|
3777
3777
|
}, [e, o, n]);
|
|
3778
3778
|
const f = h((g, k) => {
|
|
3779
3779
|
i((I) => {
|
|
3780
|
-
const m = I.map((B,
|
|
3780
|
+
const m = I.map((B, S) => S === g ? { ...B, ...k } : B), y = m[m.length - 1];
|
|
3781
3781
|
return (y.key.trim() || y.value.trim()) && m.push({ key: "", value: "" }), m;
|
|
3782
3782
|
});
|
|
3783
3783
|
}, []), b = h((g) => {
|
|
@@ -3785,7 +3785,7 @@ function Qa({ isOpen: e, onClose: t, store: n, blockId: o }) {
|
|
|
3785
3785
|
}, []), v = h(() => {
|
|
3786
3786
|
const g = { id: C(), type: "text", value: r, marks: {} }, k = p.filter((I) => I.key.trim());
|
|
3787
3787
|
Xa(n, [
|
|
3788
|
-
|
|
3788
|
+
Ge(o, [g]),
|
|
3789
3789
|
G(o, { href: a.trim(), color: c, customAttrs: k })
|
|
3790
3790
|
]), t();
|
|
3791
3791
|
}, [n, o, r, a, c, p, t]);
|
|
@@ -3857,7 +3857,7 @@ function Qa({ isOpen: e, onClose: t, store: n, blockId: o }) {
|
|
|
3857
3857
|
className: "be-modal-attr-remove",
|
|
3858
3858
|
onClick: () => b(k),
|
|
3859
3859
|
"aria-label": "Remove attribute",
|
|
3860
|
-
children: /* @__PURE__ */ d(
|
|
3860
|
+
children: /* @__PURE__ */ d(it, { size: 14 })
|
|
3861
3861
|
}
|
|
3862
3862
|
)
|
|
3863
3863
|
] }, k))
|
|
@@ -3870,26 +3870,26 @@ function Qa({ isOpen: e, onClose: t, store: n, blockId: o }) {
|
|
|
3870
3870
|
}
|
|
3871
3871
|
const Ja = "#2b6fd6";
|
|
3872
3872
|
function Za({ id: e }) {
|
|
3873
|
-
var m, y, B,
|
|
3874
|
-
const t =
|
|
3875
|
-
|
|
3873
|
+
var m, y, B, S;
|
|
3874
|
+
const t = K(), n = te(e), { setSelectedBlockId: o } = Pe(), [r, l] = O(!1), a = h(() => {
|
|
3875
|
+
Xe(
|
|
3876
3876
|
t,
|
|
3877
3877
|
e,
|
|
3878
3878
|
(n == null ? void 0 : n.contentIds) ?? [],
|
|
3879
3879
|
U("paragraph")
|
|
3880
3880
|
);
|
|
3881
3881
|
}, [t, e, n]), s = h(() => {
|
|
3882
|
-
const D =
|
|
3883
|
-
|
|
3882
|
+
const D = ut(t, e);
|
|
3883
|
+
Qe(t, D, e, o);
|
|
3884
3884
|
}, [t, e, o]), c = h(() => le(t, e, "up"), [t, e]), u = h(() => le(t, e, "down"), [t, e]), p = h(() => {
|
|
3885
|
-
var
|
|
3886
|
-
const D = (
|
|
3885
|
+
var L;
|
|
3886
|
+
const D = (L = n == null ? void 0 : n.props) == null ? void 0 : L.href;
|
|
3887
3887
|
D && window.open(D, "_blank", "noopener,noreferrer");
|
|
3888
3888
|
}, [(m = n == null ? void 0 : n.props) == null ? void 0 : m.href]), i = se("be-button-block", n);
|
|
3889
3889
|
if (!n) return null;
|
|
3890
|
-
const f = ((y = n.props) == null ? void 0 : y.href) ?? "", b = ((B = n.props) == null ? void 0 : B.color) ?? Ja, v = ((
|
|
3891
|
-
for (const { key: D, value:
|
|
3892
|
-
D.trim() && (k[`data-${D.trim()}`] =
|
|
3890
|
+
const f = ((y = n.props) == null ? void 0 : y.href) ?? "", b = ((B = n.props) == null ? void 0 : B.color) ?? Ja, v = ((S = n.props) == null ? void 0 : S.customAttrs) ?? [], g = ge(t, n.contentIds), k = {};
|
|
3891
|
+
for (const { key: D, value: L } of v)
|
|
3892
|
+
D.trim() && (k[`data-${D.trim()}`] = L);
|
|
3893
3893
|
const I = Ce(t, n);
|
|
3894
3894
|
return /* @__PURE__ */ T("div", { className: i, "data-block-id": e, dir: I, children: [
|
|
3895
3895
|
/* @__PURE__ */ T("div", { className: "be-button-block-pill", style: { backgroundColor: b }, ...k, children: [
|
|
@@ -3900,7 +3900,7 @@ function Za({ id: e }) {
|
|
|
3900
3900
|
"data-empty": g ? "" : void 0,
|
|
3901
3901
|
"data-placeholder": "Button",
|
|
3902
3902
|
children: /* @__PURE__ */ d(
|
|
3903
|
-
|
|
3903
|
+
Ee,
|
|
3904
3904
|
{
|
|
3905
3905
|
blockId: e,
|
|
3906
3906
|
runIds: n.contentIds,
|
|
@@ -3971,19 +3971,19 @@ function es({
|
|
|
3971
3971
|
const Yn = "be-button-block-link";
|
|
3972
3972
|
function ts(e, t) {
|
|
3973
3973
|
var c, u, p;
|
|
3974
|
-
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:${
|
|
3974
|
+
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
3975
|
var f;
|
|
3976
3976
|
return (f = i.key) == null ? void 0 : f.trim();
|
|
3977
|
-
}).map((i) => ` data-${
|
|
3978
|
-
return `<a class="${Yn}" href="${
|
|
3977
|
+
}).map((i) => ` data-${he(i.key.trim())}="${he(i.value ?? "")}"`).join("");
|
|
3978
|
+
return `<a class="${Yn}" href="${he(o)}"${l}${s}>${n.map((i) => Ae(i, t)).join("")}</a>`;
|
|
3979
3979
|
}
|
|
3980
3980
|
function ns(e, t) {
|
|
3981
|
-
return e.contentIds.map((n) =>
|
|
3981
|
+
return e.contentIds.map((n) => Me(t.store.getRun(n), t)).join("");
|
|
3982
3982
|
}
|
|
3983
3983
|
function os(e, t) {
|
|
3984
3984
|
var r;
|
|
3985
3985
|
const n = ((r = e.props) == null ? void 0 : r.href) ?? "";
|
|
3986
|
-
return `[${
|
|
3986
|
+
return `[${De(
|
|
3987
3987
|
e.contentIds.map((l) => t.store.getRun(l)),
|
|
3988
3988
|
t
|
|
3989
3989
|
) || n}](${n})`;
|
|
@@ -3991,7 +3991,7 @@ function os(e, t) {
|
|
|
3991
3991
|
function rs(e, t) {
|
|
3992
3992
|
var l;
|
|
3993
3993
|
if (e.tagName !== "A" || !e.classList.contains(Yn)) return null;
|
|
3994
|
-
const n =
|
|
3994
|
+
const n = Le(e, t), o = [];
|
|
3995
3995
|
for (const a of e.attributes)
|
|
3996
3996
|
a.name.startsWith("data-") && o.push({ key: a.name.slice(5), value: a.value });
|
|
3997
3997
|
return { block: {
|
|
@@ -4117,8 +4117,8 @@ const mt = {
|
|
|
4117
4117
|
function Rt(e) {
|
|
4118
4118
|
return Math.min($t, Math.max(Et, Math.round(e)));
|
|
4119
4119
|
}
|
|
4120
|
-
function ps({ kind: e, src: t, name: n, alt: o, provider: r }) {
|
|
4121
|
-
return e === "image" ? /* @__PURE__ */ d("img", { className: "be-embed-image", src: t, alt: o || "" }) : e === "video" ? /* @__PURE__ */ d("video", { className: "be-embed-video", src: t, controls: !0 }) : e === "audio" ? /* @__PURE__ */ d("audio", { className: "be-embed-audio", src: t, controls: !0 }) : e === "oembed" ? /* @__PURE__ */ d(
|
|
4120
|
+
function ps({ kind: e, src: t, name: n, alt: o, provider: r, onError: l }) {
|
|
4121
|
+
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
4122
|
"iframe",
|
|
4123
4123
|
{
|
|
4124
4124
|
className: "be-embed-oembed",
|
|
@@ -4138,7 +4138,7 @@ function ps({ kind: e, src: t, name: n, alt: o, provider: r }) {
|
|
|
4138
4138
|
target: "_blank",
|
|
4139
4139
|
rel: "noopener noreferrer",
|
|
4140
4140
|
children: [
|
|
4141
|
-
/* @__PURE__ */ d(
|
|
4141
|
+
/* @__PURE__ */ d(Mn, { size: 14 }),
|
|
4142
4142
|
" ",
|
|
4143
4143
|
n || t
|
|
4144
4144
|
]
|
|
@@ -4146,54 +4146,54 @@ function ps({ kind: e, src: t, name: n, alt: o, provider: r }) {
|
|
|
4146
4146
|
);
|
|
4147
4147
|
}
|
|
4148
4148
|
function fs({ id: e }) {
|
|
4149
|
-
var
|
|
4150
|
-
const t =
|
|
4149
|
+
var Je, Ze, ye, Fe, et;
|
|
4150
|
+
const t = K(), n = te(e), { uploadFile: o, maxFileSize: r, resolveEmbedSrc: l, onEmbedError: a } = To(), [s, c] = O(""), [u, p] = O(!1), [i, f] = O(null), [b, v] = O(!1), [g, k] = O(""), [I, m] = O(!1), [y, B] = O(null), S = _(null), D = _(null), L = h(
|
|
4151
4151
|
(M) => t.applyOperation(G(e, M)),
|
|
4152
4152
|
[t, e]
|
|
4153
|
-
),
|
|
4153
|
+
), $ = h(() => {
|
|
4154
4154
|
var M;
|
|
4155
|
-
|
|
4156
|
-
}, [(
|
|
4155
|
+
k(((M = n == null ? void 0 : n.props) == null ? void 0 : M.alt) ?? ""), v(!0);
|
|
4156
|
+
}, [(Je = n == null ? void 0 : n.props) == null ? void 0 : Je.alt]), E = h(() => v(!1), []), j = h(
|
|
4157
4157
|
(M) => {
|
|
4158
|
-
M.preventDefault(), L({ alt:
|
|
4158
|
+
M.preventDefault(), L({ alt: g.trim() }), v(!1);
|
|
4159
4159
|
},
|
|
4160
|
-
[
|
|
4161
|
-
),
|
|
4160
|
+
[g, L]
|
|
4161
|
+
), w = h(
|
|
4162
4162
|
async (M, W) => {
|
|
4163
|
-
|
|
4163
|
+
B(null), m(!0);
|
|
4164
4164
|
try {
|
|
4165
|
-
const { src:
|
|
4165
|
+
const { src: z, name: ee, mimeType: R } = await Xn(M, {
|
|
4166
4166
|
uploadFile: o,
|
|
4167
4167
|
maxFileSize: r,
|
|
4168
4168
|
kind: W
|
|
4169
4169
|
});
|
|
4170
|
-
L({ src:
|
|
4171
|
-
} catch (
|
|
4172
|
-
|
|
4170
|
+
L({ src: z, name: ee, mimeType: R });
|
|
4171
|
+
} catch (z) {
|
|
4172
|
+
B((z == null ? void 0 : z.message) || "Upload failed. Please try again.");
|
|
4173
4173
|
} finally {
|
|
4174
|
-
|
|
4174
|
+
m(!1);
|
|
4175
4175
|
}
|
|
4176
4176
|
},
|
|
4177
4177
|
[o, r, L]
|
|
4178
|
-
),
|
|
4178
|
+
), N = h(
|
|
4179
4179
|
(M) => {
|
|
4180
|
-
var
|
|
4181
|
-
const W = (
|
|
4182
|
-
M.target.value = "", W &&
|
|
4180
|
+
var z, ee;
|
|
4181
|
+
const W = (z = M.target.files) == null ? void 0 : z[0];
|
|
4182
|
+
M.target.value = "", W && w(W, ((ee = n == null ? void 0 : n.props) == null ? void 0 : ee.kind) ?? "file");
|
|
4183
4183
|
},
|
|
4184
|
-
[
|
|
4185
|
-
),
|
|
4184
|
+
[w, (Ze = n == null ? void 0 : n.props) == null ? void 0 : Ze.kind]
|
|
4185
|
+
), x = h(
|
|
4186
4186
|
(M) => {
|
|
4187
|
-
var
|
|
4188
|
-
M.preventDefault(),
|
|
4189
|
-
const W = (
|
|
4190
|
-
W &&
|
|
4187
|
+
var z, ee;
|
|
4188
|
+
M.preventDefault(), p(!1);
|
|
4189
|
+
const W = (z = M.dataTransfer.files) == null ? void 0 : z[0];
|
|
4190
|
+
W && w(W, ((ee = n == null ? void 0 : n.props) == null ? void 0 : ee.kind) ?? "file");
|
|
4191
4191
|
},
|
|
4192
|
-
[
|
|
4193
|
-
),
|
|
4194
|
-
M.preventDefault(),
|
|
4195
|
-
}, []),
|
|
4196
|
-
const M =
|
|
4192
|
+
[w, (ye = n == null ? void 0 : n.props) == null ? void 0 : ye.kind]
|
|
4193
|
+
), P = h((M) => {
|
|
4194
|
+
M.preventDefault(), p(!0);
|
|
4195
|
+
}, []), A = h(() => p(!1), []), H = h(() => {
|
|
4196
|
+
const M = s.trim();
|
|
4197
4197
|
if (!M) return;
|
|
4198
4198
|
const W = is(M);
|
|
4199
4199
|
L(W ? {
|
|
@@ -4203,47 +4203,47 @@ function fs({ id: e }) {
|
|
|
4203
4203
|
mimeType: "",
|
|
4204
4204
|
provider: W.provider,
|
|
4205
4205
|
originalUrl: M
|
|
4206
|
-
} : { src: M, name: M }),
|
|
4207
|
-
}, [
|
|
4206
|
+
} : { src: M, name: M }), c("");
|
|
4207
|
+
}, [s, L]), Y = h(
|
|
4208
4208
|
() => L({ src: "", name: "", mimeType: "", provider: "", originalUrl: "" }),
|
|
4209
4209
|
[L]
|
|
4210
|
-
),
|
|
4210
|
+
), X = h(
|
|
4211
4211
|
(M) => {
|
|
4212
4212
|
M.preventDefault();
|
|
4213
|
-
const W =
|
|
4214
|
-
if (!W || !
|
|
4215
|
-
const
|
|
4216
|
-
document.removeEventListener("mousemove",
|
|
4213
|
+
const W = S.current, z = D.current;
|
|
4214
|
+
if (!W || !z) return;
|
|
4215
|
+
const ee = W.getBoundingClientRect().width, R = z.getBoundingClientRect().width, J = M.clientX, ue = (we) => Rt((R + (we.clientX - J)) / ee * 100), Re = (we) => f(ue(we)), Ne = (we) => {
|
|
4216
|
+
document.removeEventListener("mousemove", Re), document.removeEventListener("mouseup", Ne), L({ width: ue(we) }), f(null);
|
|
4217
4217
|
};
|
|
4218
|
-
document.addEventListener("mousemove",
|
|
4218
|
+
document.addEventListener("mousemove", Re), document.addEventListener("mouseup", Ne);
|
|
4219
4219
|
},
|
|
4220
4220
|
[L]
|
|
4221
|
-
),
|
|
4221
|
+
), pe = h(
|
|
4222
4222
|
(M) => {
|
|
4223
|
-
var
|
|
4224
|
-
const W = ((
|
|
4225
|
-
let
|
|
4226
|
-
if (M.key === "ArrowLeft" || M.key === "ArrowDown")
|
|
4223
|
+
var R;
|
|
4224
|
+
const W = ((R = n == null ? void 0 : n.props) == null ? void 0 : R.width) ?? 100, z = M.shiftKey ? 1 : 5;
|
|
4225
|
+
let ee;
|
|
4226
|
+
if (M.key === "ArrowLeft" || M.key === "ArrowDown") ee = Rt(W - z);
|
|
4227
4227
|
else if (M.key === "ArrowRight" || M.key === "ArrowUp")
|
|
4228
|
-
|
|
4229
|
-
else if (M.key === "Home")
|
|
4230
|
-
else if (M.key === "End")
|
|
4228
|
+
ee = Rt(W + z);
|
|
4229
|
+
else if (M.key === "Home") ee = Et;
|
|
4230
|
+
else if (M.key === "End") ee = $t;
|
|
4231
4231
|
else return;
|
|
4232
|
-
M.preventDefault(), L({ width:
|
|
4232
|
+
M.preventDefault(), L({ width: ee });
|
|
4233
4233
|
},
|
|
4234
|
-
[(
|
|
4235
|
-
),
|
|
4234
|
+
[(Fe = n == null ? void 0 : n.props) == null ? void 0 : Fe.width, L]
|
|
4235
|
+
), F = se("be-embed", n), Q = l((et = n == null ? void 0 : n.props) == null ? void 0 : et.src);
|
|
4236
4236
|
if (!n) return null;
|
|
4237
4237
|
const {
|
|
4238
|
-
kind:
|
|
4239
|
-
src:
|
|
4240
|
-
name:
|
|
4241
|
-
alt:
|
|
4242
|
-
align:
|
|
4243
|
-
width:
|
|
4244
|
-
provider:
|
|
4245
|
-
originalUrl:
|
|
4246
|
-
} = n.props,
|
|
4238
|
+
kind: V = "file",
|
|
4239
|
+
src: me,
|
|
4240
|
+
name: ce,
|
|
4241
|
+
alt: Ie = "",
|
|
4242
|
+
align: ie = "left",
|
|
4243
|
+
width: ne = 100,
|
|
4244
|
+
provider: je = "",
|
|
4245
|
+
originalUrl: $e = ""
|
|
4246
|
+
} = n.props, Z = V === "image" || V === "video" || V === "oembed", dt = i ?? ne, Be = V === "oembed", wt = () => a == null ? void 0 : a(me);
|
|
4247
4247
|
return (
|
|
4248
4248
|
// tabIndex={-1}: focusable via .focus() (see setSelectedBlockId in
|
|
4249
4249
|
// EditorProvider.jsx) without joining the normal Tab order — keeps the
|
|
@@ -4253,47 +4253,47 @@ function fs({ id: e }) {
|
|
|
4253
4253
|
/* @__PURE__ */ T(
|
|
4254
4254
|
"div",
|
|
4255
4255
|
{
|
|
4256
|
-
className:
|
|
4256
|
+
className: F,
|
|
4257
4257
|
"data-block-id": e,
|
|
4258
|
-
"data-kind":
|
|
4258
|
+
"data-kind": V,
|
|
4259
4259
|
contentEditable: !1,
|
|
4260
4260
|
tabIndex: -1,
|
|
4261
4261
|
children: [
|
|
4262
|
-
|
|
4262
|
+
me ? /* @__PURE__ */ d("div", { ref: S, className: `be-embed-preview be-embed-align-${ie}`, children: /* @__PURE__ */ T(
|
|
4263
4263
|
"div",
|
|
4264
4264
|
{
|
|
4265
|
-
ref:
|
|
4265
|
+
ref: D,
|
|
4266
4266
|
className: "be-embed-frame",
|
|
4267
|
-
style:
|
|
4267
|
+
style: Z ? { width: `${dt}%` } : void 0,
|
|
4268
4268
|
children: [
|
|
4269
4269
|
/* @__PURE__ */ T("div", { className: "be-embed-toolbar", contentEditable: !1, children: [
|
|
4270
|
-
ds.map(({ value: M, Icon: W, label:
|
|
4270
|
+
ds.map(({ value: M, Icon: W, label: z }) => /* @__PURE__ */ d(
|
|
4271
4271
|
"button",
|
|
4272
4272
|
{
|
|
4273
4273
|
type: "button",
|
|
4274
|
-
className: `be-embed-toolbar-btn${
|
|
4275
|
-
title:
|
|
4276
|
-
"aria-label":
|
|
4277
|
-
"aria-pressed":
|
|
4274
|
+
className: `be-embed-toolbar-btn${ie === M ? " be-embed-toolbar-btn-active" : ""}`,
|
|
4275
|
+
title: z,
|
|
4276
|
+
"aria-label": z,
|
|
4277
|
+
"aria-pressed": ie === M,
|
|
4278
4278
|
onClick: () => L({ align: M }),
|
|
4279
4279
|
children: /* @__PURE__ */ d(W, { size: 14 })
|
|
4280
4280
|
},
|
|
4281
4281
|
M
|
|
4282
4282
|
)),
|
|
4283
|
-
|
|
4283
|
+
V === "image" && /* @__PURE__ */ d(
|
|
4284
4284
|
"button",
|
|
4285
4285
|
{
|
|
4286
4286
|
type: "button",
|
|
4287
4287
|
className: "be-embed-toolbar-btn be-embed-alt-text-btn",
|
|
4288
|
-
onClick:
|
|
4288
|
+
onClick: $,
|
|
4289
4289
|
children: "Alt text"
|
|
4290
4290
|
}
|
|
4291
4291
|
),
|
|
4292
|
-
|
|
4292
|
+
Be && $e && /* @__PURE__ */ d(
|
|
4293
4293
|
"a",
|
|
4294
4294
|
{
|
|
4295
4295
|
className: "be-embed-toolbar-btn be-embed-open-original",
|
|
4296
|
-
href:
|
|
4296
|
+
href: $e,
|
|
4297
4297
|
target: "_blank",
|
|
4298
4298
|
rel: "noopener noreferrer",
|
|
4299
4299
|
title: "Open original link",
|
|
@@ -4306,25 +4306,35 @@ function fs({ id: e }) {
|
|
|
4306
4306
|
{
|
|
4307
4307
|
type: "button",
|
|
4308
4308
|
className: "be-embed-remove",
|
|
4309
|
-
onClick:
|
|
4310
|
-
"aria-label": `Remove ${mt[
|
|
4309
|
+
onClick: Y,
|
|
4310
|
+
"aria-label": `Remove ${mt[V]}`,
|
|
4311
4311
|
children: "Remove"
|
|
4312
4312
|
}
|
|
4313
4313
|
)
|
|
4314
4314
|
] }),
|
|
4315
|
-
/* @__PURE__ */ d(
|
|
4316
|
-
|
|
4315
|
+
/* @__PURE__ */ d(
|
|
4316
|
+
ps,
|
|
4317
|
+
{
|
|
4318
|
+
kind: V,
|
|
4319
|
+
src: Q,
|
|
4320
|
+
name: ce,
|
|
4321
|
+
alt: Ie,
|
|
4322
|
+
provider: je,
|
|
4323
|
+
onError: wt
|
|
4324
|
+
}
|
|
4325
|
+
),
|
|
4326
|
+
Z && /* @__PURE__ */ d(
|
|
4317
4327
|
"div",
|
|
4318
4328
|
{
|
|
4319
4329
|
className: "be-embed-resize-handle",
|
|
4320
|
-
onMouseDown:
|
|
4321
|
-
onKeyDown:
|
|
4330
|
+
onMouseDown: X,
|
|
4331
|
+
onKeyDown: pe,
|
|
4322
4332
|
role: "slider",
|
|
4323
4333
|
tabIndex: 0,
|
|
4324
|
-
"aria-label": `Resize ${mt[
|
|
4334
|
+
"aria-label": `Resize ${mt[V]}`,
|
|
4325
4335
|
"aria-valuemin": Et,
|
|
4326
4336
|
"aria-valuemax": $t,
|
|
4327
|
-
"aria-valuenow":
|
|
4337
|
+
"aria-valuenow": dt
|
|
4328
4338
|
}
|
|
4329
4339
|
)
|
|
4330
4340
|
]
|
|
@@ -4332,22 +4342,22 @@ function fs({ id: e }) {
|
|
|
4332
4342
|
) }) : /* @__PURE__ */ T(
|
|
4333
4343
|
"div",
|
|
4334
4344
|
{
|
|
4335
|
-
className: `be-embed-dropzone${
|
|
4336
|
-
onDrop:
|
|
4337
|
-
onDragOver:
|
|
4338
|
-
onDragLeave:
|
|
4345
|
+
className: `be-embed-dropzone${u ? " be-embed-dropzone-active" : ""}`,
|
|
4346
|
+
onDrop: Be || I ? void 0 : x,
|
|
4347
|
+
onDragOver: Be || I ? void 0 : P,
|
|
4348
|
+
onDragLeave: A,
|
|
4339
4349
|
children: [
|
|
4340
|
-
|
|
4341
|
-
!
|
|
4350
|
+
I ? /* @__PURE__ */ d("span", { className: "be-embed-uploading", children: "Uploading…" }) : /* @__PURE__ */ T(Te, { children: [
|
|
4351
|
+
!Be && /* @__PURE__ */ T(Te, { children: [
|
|
4342
4352
|
/* @__PURE__ */ T("label", { className: "be-embed-upload-btn", children: [
|
|
4343
4353
|
"Upload ",
|
|
4344
|
-
mt[
|
|
4354
|
+
mt[V],
|
|
4345
4355
|
/* @__PURE__ */ d(
|
|
4346
4356
|
"input",
|
|
4347
4357
|
{
|
|
4348
4358
|
type: "file",
|
|
4349
|
-
accept: us[
|
|
4350
|
-
onChange:
|
|
4359
|
+
accept: us[V],
|
|
4360
|
+
onChange: N,
|
|
4351
4361
|
hidden: !0
|
|
4352
4362
|
}
|
|
4353
4363
|
)
|
|
@@ -4360,38 +4370,38 @@ function fs({ id: e }) {
|
|
|
4360
4370
|
{
|
|
4361
4371
|
type: "text",
|
|
4362
4372
|
className: "be-embed-url-input",
|
|
4363
|
-
placeholder:
|
|
4364
|
-
value:
|
|
4365
|
-
onChange: (M) =>
|
|
4373
|
+
placeholder: Be ? "Paste a YouTube, Vimeo, Loom, Figma, CodePen, or Spotify link" : `https://... ${mt[V]} URL`,
|
|
4374
|
+
value: s,
|
|
4375
|
+
onChange: (M) => c(M.target.value),
|
|
4366
4376
|
onKeyDown: (M) => M.key === "Enter" && H()
|
|
4367
4377
|
}
|
|
4368
4378
|
),
|
|
4369
4379
|
/* @__PURE__ */ d("button", { type: "button", className: "be-embed-url-commit", onClick: H, children: "Embed" })
|
|
4370
4380
|
] })
|
|
4371
4381
|
] }),
|
|
4372
|
-
|
|
4373
|
-
|
|
4374
|
-
/* @__PURE__ */ d("button", { type: "button", onClick: () =>
|
|
4382
|
+
y && /* @__PURE__ */ T("div", { className: "be-embed-upload-error", role: "alert", children: [
|
|
4383
|
+
y,
|
|
4384
|
+
/* @__PURE__ */ d("button", { type: "button", onClick: () => B(null), "aria-label": "Dismiss error", children: "×" })
|
|
4375
4385
|
] })
|
|
4376
4386
|
]
|
|
4377
4387
|
}
|
|
4378
4388
|
),
|
|
4379
|
-
/* @__PURE__ */ d(Ht, { isOpen:
|
|
4389
|
+
/* @__PURE__ */ d(Ht, { isOpen: b, onClose: E, title: "Alt text", children: /* @__PURE__ */ T("form", { onSubmit: j, children: [
|
|
4380
4390
|
/* @__PURE__ */ T("label", { className: "be-modal-field", children: [
|
|
4381
4391
|
/* @__PURE__ */ d("span", { children: "Describe this image for screen readers" }),
|
|
4382
4392
|
/* @__PURE__ */ d(
|
|
4383
4393
|
"input",
|
|
4384
4394
|
{
|
|
4385
4395
|
type: "text",
|
|
4386
|
-
value:
|
|
4387
|
-
onChange: (M) =>
|
|
4396
|
+
value: g,
|
|
4397
|
+
onChange: (M) => k(M.target.value),
|
|
4388
4398
|
placeholder: "e.g. A hand-drawn diagram of the release process",
|
|
4389
4399
|
autoFocus: !0
|
|
4390
4400
|
}
|
|
4391
4401
|
)
|
|
4392
4402
|
] }),
|
|
4393
4403
|
/* @__PURE__ */ T("div", { className: "be-modal-actions", children: [
|
|
4394
|
-
/* @__PURE__ */ d("button", { type: "button", className: "be-modal-cancel", onClick:
|
|
4404
|
+
/* @__PURE__ */ d("button", { type: "button", className: "be-modal-cancel", onClick: E, children: "Cancel" }),
|
|
4395
4405
|
/* @__PURE__ */ d("button", { type: "submit", className: "be-modal-save", children: "Save" })
|
|
4396
4406
|
] })
|
|
4397
4407
|
] }) })
|
|
@@ -4428,7 +4438,7 @@ const sn = {
|
|
|
4428
4438
|
image: No,
|
|
4429
4439
|
video: Ro,
|
|
4430
4440
|
audio: Bo,
|
|
4431
|
-
file:
|
|
4441
|
+
file: Mn,
|
|
4432
4442
|
oembed: Ln
|
|
4433
4443
|
}, Qn = "be-embed-file-link", Jn = "be-embed-oembed-link";
|
|
4434
4444
|
function hs(e, t, n) {
|
|
@@ -4455,7 +4465,7 @@ function gs(e) {
|
|
|
4455
4465
|
} = e.props;
|
|
4456
4466
|
if (!n) return "<p></p>";
|
|
4457
4467
|
const u = hs(t, l, a);
|
|
4458
|
-
return t === "image" ? `<img src="${
|
|
4468
|
+
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>`;
|
|
4459
4469
|
}
|
|
4460
4470
|
function bs(e) {
|
|
4461
4471
|
const { kind: t, src: n, name: o, originalUrl: r = "" } = e.props;
|
|
@@ -4466,16 +4476,16 @@ function ys(e) {
|
|
|
4466
4476
|
return n ? t === "image" ? `` : t === "oembed" ? `[${l || n}](${l || n})` : `[${o || n}](${n})` : "";
|
|
4467
4477
|
}
|
|
4468
4478
|
function ks(e) {
|
|
4469
|
-
return e.tagName === "IMG" ?
|
|
4479
|
+
return e.tagName === "IMG" ? rt("image", e.getAttribute("src") ?? "", "", {
|
|
4470
4480
|
...Nt(e),
|
|
4471
4481
|
alt: e.getAttribute("alt") ?? ""
|
|
4472
|
-
}) : e.tagName === "VIDEO" ?
|
|
4482
|
+
}) : e.tagName === "VIDEO" ? rt("video", e.getAttribute("src") ?? "", "", Nt(e)) : e.tagName === "AUDIO" ? rt("audio", e.getAttribute("src") ?? "", "") : e.tagName === "A" && e.classList.contains(Jn) ? rt("oembed", e.getAttribute("data-embed-url") ?? "", "", {
|
|
4473
4483
|
...Nt(e),
|
|
4474
4484
|
provider: e.getAttribute("data-embed-provider") ?? "",
|
|
4475
4485
|
originalUrl: e.getAttribute("href") ?? ""
|
|
4476
|
-
}) : e.tagName === "A" && e.classList.contains(Qn) ?
|
|
4486
|
+
}) : e.tagName === "A" && e.classList.contains(Qn) ? rt("file", e.getAttribute("href") ?? "", e.textContent ?? "") : null;
|
|
4477
4487
|
}
|
|
4478
|
-
function
|
|
4488
|
+
function rt(e, t, n, { align: o = "left", width: r = 100, alt: l = "", provider: a = "", originalUrl: s = "" } = {}) {
|
|
4479
4489
|
return {
|
|
4480
4490
|
block: {
|
|
4481
4491
|
id: C(),
|
|
@@ -4491,10 +4501,10 @@ function cn(e) {
|
|
|
4491
4501
|
return (t, { blockId: n, runId: o, sliceStart: r, sliceEnd: l }) => {
|
|
4492
4502
|
const a = t.getRun(o), s = (a == null ? void 0 : a.value) ?? "";
|
|
4493
4503
|
t.applyOperation(
|
|
4494
|
-
|
|
4504
|
+
de(o, { value: s.slice(0, r) + s.slice(l) })
|
|
4495
4505
|
);
|
|
4496
4506
|
const c = xn(t, n, ms({ kind: e }));
|
|
4497
|
-
return
|
|
4507
|
+
return Ye(t, c, U("paragraph")), c;
|
|
4498
4508
|
};
|
|
4499
4509
|
}
|
|
4500
4510
|
const vs = ae({
|
|
@@ -4548,14 +4558,14 @@ function Ts(e, t, n) {
|
|
|
4548
4558
|
ve(a);
|
|
4549
4559
|
return;
|
|
4550
4560
|
}
|
|
4551
|
-
|
|
4561
|
+
Ye(e, t, U("paragraph"));
|
|
4552
4562
|
}
|
|
4553
4563
|
function Cs({ id: e, blockId: t }) {
|
|
4554
|
-
const n =
|
|
4564
|
+
const n = K(), o = qe(e), r = _(null);
|
|
4555
4565
|
r.current === null && (r.current = ws(e));
|
|
4556
4566
|
const l = h(
|
|
4557
4567
|
(u) => {
|
|
4558
|
-
n.applyOperation(
|
|
4568
|
+
n.applyOperation(de(e, { data: { ...o == null ? void 0 : o.data, selectedValue: u } })), r.current && Ts(n, t, e);
|
|
4559
4569
|
},
|
|
4560
4570
|
[n, e, o == null ? void 0 : o.data, t]
|
|
4561
4571
|
);
|
|
@@ -4570,7 +4580,7 @@ function Cs({ id: e, blockId: t }) {
|
|
|
4570
4580
|
},
|
|
4571
4581
|
onKeyDown: (u) => u.stopPropagation(),
|
|
4572
4582
|
children: /* @__PURE__ */ d(
|
|
4573
|
-
|
|
4583
|
+
We,
|
|
4574
4584
|
{
|
|
4575
4585
|
value: s,
|
|
4576
4586
|
options: a,
|
|
@@ -4583,7 +4593,7 @@ function Cs({ id: e, blockId: t }) {
|
|
|
4583
4593
|
}
|
|
4584
4594
|
);
|
|
4585
4595
|
}
|
|
4586
|
-
function
|
|
4596
|
+
function Kt(e, { blockId: t, runId: n, sliceStart: o, sliceEnd: r }, l, { autoOpen: a = !1 } = {}) {
|
|
4587
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 }, b = { id: C(), type: "text", value: p, marks: { ...s == null ? void 0 : s.marks } };
|
|
4588
4598
|
e.applyOperation(Lo(t, [n], [f, i, b])), a ? Is(i.id) : ve(b.id);
|
|
4589
4599
|
}
|
|
@@ -4616,7 +4626,7 @@ function Ls(e) {
|
|
|
4616
4626
|
}
|
|
4617
4627
|
};
|
|
4618
4628
|
}
|
|
4619
|
-
const
|
|
4629
|
+
const Ms = bt({
|
|
4620
4630
|
name: "select",
|
|
4621
4631
|
component: Cs,
|
|
4622
4632
|
toHTML: Rs,
|
|
@@ -4624,9 +4634,9 @@ const As = bt({
|
|
|
4624
4634
|
fromHTML: Ls,
|
|
4625
4635
|
slashCommand: {
|
|
4626
4636
|
label: "Select",
|
|
4627
|
-
icon:
|
|
4637
|
+
icon: Mo,
|
|
4628
4638
|
keywords: ["select", "dropdown", "choice", "picker"],
|
|
4629
|
-
run: (e, { blockId: t, runId: n, sliceStart: o, sliceEnd: r }) =>
|
|
4639
|
+
run: (e, { blockId: t, runId: n, sliceStart: o, sliceEnd: r }) => Kt(
|
|
4630
4640
|
e,
|
|
4631
4641
|
{ blockId: t, runId: n, sliceStart: o, sliceEnd: r },
|
|
4632
4642
|
() => ({
|
|
@@ -4640,10 +4650,10 @@ const As = bt({
|
|
|
4640
4650
|
)
|
|
4641
4651
|
}
|
|
4642
4652
|
});
|
|
4643
|
-
function
|
|
4644
|
-
const t =
|
|
4653
|
+
function As({ id: e }) {
|
|
4654
|
+
const t = K(), n = qe(e), o = h(
|
|
4645
4655
|
(l) => {
|
|
4646
|
-
t.applyOperation(
|
|
4656
|
+
t.applyOperation(de(e, { data: { ...n == null ? void 0 : n.data, isoDate: l.target.value } }));
|
|
4647
4657
|
},
|
|
4648
4658
|
[t, e, n == null ? void 0 : n.data]
|
|
4649
4659
|
);
|
|
@@ -4691,15 +4701,15 @@ function Ss() {
|
|
|
4691
4701
|
}
|
|
4692
4702
|
const Ds = bt({
|
|
4693
4703
|
name: "date",
|
|
4694
|
-
component:
|
|
4704
|
+
component: As,
|
|
4695
4705
|
toHTML: $s,
|
|
4696
4706
|
toPlainText: xs,
|
|
4697
4707
|
fromHTML: Os,
|
|
4698
4708
|
slashCommand: {
|
|
4699
4709
|
label: "Date",
|
|
4700
|
-
icon:
|
|
4710
|
+
icon: Ao,
|
|
4701
4711
|
keywords: ["date", "when", "schedule", "calendar"],
|
|
4702
|
-
run: (e, { blockId: t, runId: n, sliceStart: o, sliceEnd: r }) =>
|
|
4712
|
+
run: (e, { blockId: t, runId: n, sliceStart: o, sliceEnd: r }) => Kt(e, { blockId: t, runId: n, sliceStart: o, sliceEnd: r }, () => ({
|
|
4703
4713
|
id: C(),
|
|
4704
4714
|
type: "date",
|
|
4705
4715
|
value: "",
|
|
@@ -4709,16 +4719,16 @@ const Ds = bt({
|
|
|
4709
4719
|
}
|
|
4710
4720
|
});
|
|
4711
4721
|
function Hs({ id: e }) {
|
|
4712
|
-
const t =
|
|
4722
|
+
const t = K(), n = qe(e), o = h(
|
|
4713
4723
|
(s) => {
|
|
4714
4724
|
t.applyOperation(
|
|
4715
|
-
|
|
4725
|
+
de(e, { data: { ...n == null ? void 0 : n.data, checked: s.target.checked } })
|
|
4716
4726
|
);
|
|
4717
4727
|
},
|
|
4718
4728
|
[t, e, n == null ? void 0 : n.data]
|
|
4719
4729
|
), r = h(
|
|
4720
4730
|
(s) => {
|
|
4721
|
-
t.applyOperation(
|
|
4731
|
+
t.applyOperation(de(e, { data: { ...n == null ? void 0 : n.data, label: s.target.value } }));
|
|
4722
4732
|
},
|
|
4723
4733
|
[t, e, n == null ? void 0 : n.data]
|
|
4724
4734
|
);
|
|
@@ -4788,7 +4798,7 @@ const Fs = bt({
|
|
|
4788
4798
|
label: "Checkbox",
|
|
4789
4799
|
icon: St,
|
|
4790
4800
|
keywords: ["checkbox", "todo", "check", "toggle"],
|
|
4791
|
-
run: (e, { blockId: t, runId: n, sliceStart: o, sliceEnd: r }) =>
|
|
4801
|
+
run: (e, { blockId: t, runId: n, sliceStart: o, sliceEnd: r }) => Kt(e, { blockId: t, runId: n, sliceStart: o, sliceEnd: r }, () => ({
|
|
4792
4802
|
id: C(),
|
|
4793
4803
|
type: "checkbox",
|
|
4794
4804
|
value: "",
|
|
@@ -4797,15 +4807,15 @@ const Fs = bt({
|
|
|
4797
4807
|
}))
|
|
4798
4808
|
}
|
|
4799
4809
|
});
|
|
4800
|
-
function
|
|
4810
|
+
function Ks({ id: e, blockId: t }) {
|
|
4801
4811
|
var b;
|
|
4802
|
-
const n =
|
|
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 = (((b = (s && l ? fe(s, l.contentIds.length) : [])[c]) == null ? void 0 : b.options) ?? []).map((v, g) => ({
|
|
4803
4813
|
...v,
|
|
4804
|
-
color: v.color ??
|
|
4814
|
+
color: v.color ?? At(g)
|
|
4805
4815
|
})), i = h(
|
|
4806
4816
|
(v, g) => {
|
|
4807
4817
|
n.applyOperation(
|
|
4808
|
-
|
|
4818
|
+
de(e, { data: { selectedValue: v, selectedLabel: (g == null ? void 0 : g.label) ?? "" } })
|
|
4809
4819
|
);
|
|
4810
4820
|
},
|
|
4811
4821
|
[n, e]
|
|
@@ -4821,7 +4831,7 @@ function zs({ id: e, blockId: t }) {
|
|
|
4821
4831
|
},
|
|
4822
4832
|
onKeyDown: (v) => v.stopPropagation(),
|
|
4823
4833
|
children: /* @__PURE__ */ d(
|
|
4824
|
-
|
|
4834
|
+
We,
|
|
4825
4835
|
{
|
|
4826
4836
|
value: f,
|
|
4827
4837
|
options: p,
|
|
@@ -4837,14 +4847,14 @@ function zs({ id: e, blockId: t }) {
|
|
|
4837
4847
|
function to(e) {
|
|
4838
4848
|
return String(e).replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">");
|
|
4839
4849
|
}
|
|
4840
|
-
function
|
|
4850
|
+
function zs(e) {
|
|
4841
4851
|
return to(e).replace(/"/g, """);
|
|
4842
4852
|
}
|
|
4843
|
-
function
|
|
4853
|
+
function Gs(e) {
|
|
4844
4854
|
const { selectedValue: t = "", selectedLabel: n = "" } = e.data ?? {};
|
|
4845
|
-
return `<span data-inline-type="tableSelect" data-selected-value="${
|
|
4855
|
+
return `<span data-inline-type="tableSelect" data-selected-value="${zs(t)}">${to(n)}</span>`;
|
|
4846
4856
|
}
|
|
4847
|
-
function
|
|
4857
|
+
function Vs(e) {
|
|
4848
4858
|
var t;
|
|
4849
4859
|
return ((t = e.data) == null ? void 0 : t.selectedLabel) ?? "";
|
|
4850
4860
|
}
|
|
@@ -4863,9 +4873,9 @@ function Ws(e) {
|
|
|
4863
4873
|
}
|
|
4864
4874
|
const qs = bt({
|
|
4865
4875
|
name: "tableSelect",
|
|
4866
|
-
component:
|
|
4867
|
-
toHTML:
|
|
4868
|
-
toPlainText:
|
|
4876
|
+
component: Ks,
|
|
4877
|
+
toHTML: Gs,
|
|
4878
|
+
toPlainText: Vs,
|
|
4869
4879
|
fromHTML: Ws
|
|
4870
4880
|
// No slashCommand: unlike select/date/custom field types, this type is never
|
|
4871
4881
|
// inserted ad-hoc into a paragraph — it only exists inside a table cell
|
|
@@ -4881,13 +4891,13 @@ const qs = bt({
|
|
|
4881
4891
|
ia,
|
|
4882
4892
|
ba,
|
|
4883
4893
|
Ca,
|
|
4884
|
-
|
|
4894
|
+
Aa,
|
|
4885
4895
|
Pa,
|
|
4886
4896
|
Ya,
|
|
4887
4897
|
ls,
|
|
4888
4898
|
vs,
|
|
4889
4899
|
ro,
|
|
4890
|
-
|
|
4900
|
+
Ms,
|
|
4891
4901
|
Ds,
|
|
4892
4902
|
Fs,
|
|
4893
4903
|
qs,
|
|
@@ -4900,30 +4910,30 @@ function cc({ exclude: e = [] } = {}) {
|
|
|
4900
4910
|
export {
|
|
4901
4911
|
Rr as $,
|
|
4902
4912
|
_t as A,
|
|
4903
|
-
|
|
4913
|
+
xe as B,
|
|
4904
4914
|
rr as C,
|
|
4905
4915
|
sc as D,
|
|
4906
|
-
|
|
4916
|
+
ge as E,
|
|
4907
4917
|
kt as F,
|
|
4908
4918
|
Nl as G,
|
|
4909
|
-
|
|
4910
|
-
|
|
4919
|
+
Vo as H,
|
|
4920
|
+
Ue as I,
|
|
4911
4921
|
Or as J,
|
|
4912
4922
|
Sr as K,
|
|
4913
|
-
|
|
4923
|
+
zo as L,
|
|
4914
4924
|
Dr as M,
|
|
4915
4925
|
Un as N,
|
|
4916
4926
|
ya as O,
|
|
4917
4927
|
yl as P,
|
|
4918
4928
|
Zt as Q,
|
|
4919
4929
|
Ea as R,
|
|
4920
|
-
|
|
4930
|
+
We as S,
|
|
4921
4931
|
xr as T,
|
|
4922
4932
|
ws as U,
|
|
4923
4933
|
Ts as V,
|
|
4924
|
-
|
|
4934
|
+
Kt as W,
|
|
4925
4935
|
Rl as X,
|
|
4926
|
-
|
|
4936
|
+
At as Y,
|
|
4927
4937
|
ml as Z,
|
|
4928
4938
|
fl as _,
|
|
4929
4939
|
ua as a,
|
|
@@ -4932,14 +4942,14 @@ export {
|
|
|
4932
4942
|
al as a2,
|
|
4933
4943
|
It as a3,
|
|
4934
4944
|
Ut as a4,
|
|
4935
|
-
|
|
4936
|
-
|
|
4945
|
+
Ee as a5,
|
|
4946
|
+
ze as a6,
|
|
4937
4947
|
Hl as a7,
|
|
4938
4948
|
cl as a8,
|
|
4939
4949
|
gl as a9,
|
|
4940
4950
|
il as aa,
|
|
4941
4951
|
jt as ab,
|
|
4942
|
-
|
|
4952
|
+
Kn as ac,
|
|
4943
4953
|
vl as ad,
|
|
4944
4954
|
kl as ae,
|
|
4945
4955
|
bl as af,
|
|
@@ -4957,7 +4967,7 @@ export {
|
|
|
4957
4967
|
vs as e,
|
|
4958
4968
|
Ya as f,
|
|
4959
4969
|
Pa as g,
|
|
4960
|
-
|
|
4970
|
+
Aa as h,
|
|
4961
4971
|
Ca as i,
|
|
4962
4972
|
ba as j,
|
|
4963
4973
|
ll as k,
|
|
@@ -4968,13 +4978,13 @@ export {
|
|
|
4968
4978
|
br as p,
|
|
4969
4979
|
Fs as q,
|
|
4970
4980
|
Ds as r,
|
|
4971
|
-
|
|
4981
|
+
Ms as s,
|
|
4972
4982
|
oa as t,
|
|
4973
|
-
|
|
4974
|
-
|
|
4983
|
+
fe as u,
|
|
4984
|
+
Le as v,
|
|
4975
4985
|
Pt as w,
|
|
4976
|
-
|
|
4986
|
+
Ar as x,
|
|
4977
4987
|
$r as y,
|
|
4978
4988
|
vt as z
|
|
4979
4989
|
};
|
|
4980
|
-
//# sourceMappingURL=starter-kit-
|
|
4990
|
+
//# sourceMappingURL=starter-kit-CJzWMyF8.js.map
|