@namroodinc/liquid-editorial 0.10.1 → 0.11.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 +10 -0
- package/UPGRADING.md +113 -0
- package/dist/chunks/{Board-B8wK079I.js → Board-Cnyqrc-R.js} +2 -2
- package/dist/chunks/{Board-B8wK079I.js.map → Board-Cnyqrc-R.js.map} +1 -1
- package/dist/chunks/{Board-CMf5Azt0.cjs → Board-DFuJt2Oh.cjs} +2 -2
- package/dist/chunks/{Board-CMf5Azt0.cjs.map → Board-DFuJt2Oh.cjs.map} +1 -1
- package/dist/chunks/{ColourField-C1qjpIfB.cjs → ColourField--rS9KDpq.cjs} +2 -2
- package/dist/chunks/{ColourField-C1qjpIfB.cjs.map → ColourField--rS9KDpq.cjs.map} +1 -1
- package/dist/chunks/{ColourField-Ce2oaVcd.js → ColourField-DkO8tjeB.js} +2 -2
- package/dist/chunks/{ColourField-Ce2oaVcd.js.map → ColourField-DkO8tjeB.js.map} +1 -1
- package/dist/chunks/{DatePicker-CnVmsCwO.js → DatePicker-B8tllGYy.js} +2 -2
- package/dist/chunks/{DatePicker-CnVmsCwO.js.map → DatePicker-B8tllGYy.js.map} +1 -1
- package/dist/chunks/{DatePicker-BCnzFJFF.cjs → DatePicker-OiqjoO-f.cjs} +2 -2
- package/dist/chunks/{DatePicker-BCnzFJFF.cjs.map → DatePicker-OiqjoO-f.cjs.map} +1 -1
- package/dist/chunks/EntryPicker-BI_7g2Wg.cjs +2 -0
- package/dist/chunks/EntryPicker-BI_7g2Wg.cjs.map +1 -0
- package/dist/chunks/EntryPicker-KxHZzZsh.js +160 -0
- package/dist/chunks/EntryPicker-KxHZzZsh.js.map +1 -0
- package/dist/chunks/FormEditor-BJcAIVcL.cjs +2 -0
- package/dist/chunks/FormEditor-BJcAIVcL.cjs.map +1 -0
- package/dist/chunks/{FormEditor-BEOp5EW-.js → FormEditor-CdLqPaKK.js} +112 -108
- package/dist/chunks/FormEditor-CdLqPaKK.js.map +1 -0
- package/dist/chunks/Icon-CD3oeiNA.cjs +2 -0
- package/dist/chunks/Icon-CD3oeiNA.cjs.map +1 -0
- package/dist/chunks/Icon-CYXOo0Kt.js +88 -0
- package/dist/chunks/Icon-CYXOo0Kt.js.map +1 -0
- package/dist/chunks/{Message-CaX8Y1Xb.js → Message-CyLq9ef-.js} +2 -2
- package/dist/chunks/{Message-CaX8Y1Xb.js.map → Message-CyLq9ef-.js.map} +1 -1
- package/dist/chunks/{Message-DU31JAb3.cjs → Message-D3b8HDhm.cjs} +2 -2
- package/dist/chunks/{Message-DU31JAb3.cjs.map → Message-D3b8HDhm.cjs.map} +1 -1
- package/dist/chunks/{NumberField-Ccjpa_1d.cjs → NumberField-BrWFmPkW.cjs} +2 -2
- package/dist/chunks/{NumberField-Ccjpa_1d.cjs.map → NumberField-BrWFmPkW.cjs.map} +1 -1
- package/dist/chunks/{NumberField-CVsK4l9P.js → NumberField-C90eJGny.js} +13 -13
- package/dist/chunks/{NumberField-CVsK4l9P.js.map → NumberField-C90eJGny.js.map} +1 -1
- package/dist/chunks/RichTextEditor-BXyhSeJd.cjs +2 -0
- package/dist/chunks/RichTextEditor-BXyhSeJd.cjs.map +1 -0
- package/dist/chunks/RichTextEditor-DmNM63Wg.js +1123 -0
- package/dist/chunks/RichTextEditor-DmNM63Wg.js.map +1 -0
- package/dist/chunks/use-picker-session-BDEWL2jK.js +712 -0
- package/dist/chunks/use-picker-session-BDEWL2jK.js.map +1 -0
- package/dist/chunks/use-picker-session-C4FGinLN.cjs +2 -0
- package/dist/chunks/use-picker-session-C4FGinLN.cjs.map +1 -0
- package/dist/components/AssetCard/index.cjs +1 -1
- package/dist/components/AssetCard/index.js +1 -1
- package/dist/components/AssetGrid/index.cjs +1 -1
- package/dist/components/AssetGrid/index.js +1 -1
- package/dist/components/Banner/index.cjs +1 -1
- package/dist/components/Banner/index.js +1 -1
- package/dist/components/Board/index.cjs +1 -1
- package/dist/components/Board/index.js +1 -1
- package/dist/components/Button/index.cjs +1 -1
- package/dist/components/Button/index.js +1 -1
- package/dist/components/ColourField/index.cjs +1 -1
- package/dist/components/ColourField/index.js +1 -1
- package/dist/components/DatePicker/index.cjs +1 -1
- package/dist/components/DatePicker/index.js +1 -1
- package/dist/components/EditLayout/index.cjs +1 -1
- package/dist/components/EditLayout/index.js +1 -1
- package/dist/components/EntryPicker/index.cjs +1 -1
- package/dist/components/EntryPicker/index.d.cts.map +1 -1
- package/dist/components/EntryPicker/index.d.ts.map +1 -1
- package/dist/components/EntryPicker/index.js +1 -1
- package/dist/components/EntryPicker/use-picker-session.d.cts +110 -0
- package/dist/components/EntryPicker/use-picker-session.d.cts.map +1 -0
- package/dist/components/EntryPicker/use-picker-session.d.ts +110 -0
- package/dist/components/EntryPicker/use-picker-session.d.ts.map +1 -0
- package/dist/components/EntryPicker/use-selected-items.d.cts +9 -2
- package/dist/components/EntryPicker/use-selected-items.d.cts.map +1 -1
- package/dist/components/EntryPicker/use-selected-items.d.ts +9 -2
- package/dist/components/EntryPicker/use-selected-items.d.ts.map +1 -1
- package/dist/components/FormEditor/README.md +118 -0
- package/dist/components/FormEditor/control.d.cts +3 -1
- package/dist/components/FormEditor/control.d.cts.map +1 -1
- package/dist/components/FormEditor/control.d.ts +3 -1
- package/dist/components/FormEditor/control.d.ts.map +1 -1
- package/dist/components/FormEditor/index.cjs +1 -1
- package/dist/components/FormEditor/index.d.cts +3 -1
- package/dist/components/FormEditor/index.d.cts.map +1 -1
- package/dist/components/FormEditor/index.d.ts +3 -1
- package/dist/components/FormEditor/index.d.ts.map +1 -1
- package/dist/components/FormEditor/index.js +1 -1
- package/dist/components/FormEditor/model.d.cts.map +1 -1
- package/dist/components/FormEditor/model.d.ts.map +1 -1
- package/dist/components/Icon/icons.d.cts +3 -0
- package/dist/components/Icon/icons.d.cts.map +1 -1
- package/dist/components/Icon/icons.d.ts +3 -0
- package/dist/components/Icon/icons.d.ts.map +1 -1
- package/dist/components/Icon/index.cjs +1 -1
- package/dist/components/Icon/index.js +1 -1
- package/dist/components/NumberField/index.cjs +1 -1
- package/dist/components/NumberField/index.js +1 -1
- package/dist/components/RichTextEditor/document.d.cts +7 -1
- package/dist/components/RichTextEditor/document.d.cts.map +1 -1
- package/dist/components/RichTextEditor/document.d.ts +7 -1
- package/dist/components/RichTextEditor/document.d.ts.map +1 -1
- package/dist/components/RichTextEditor/embed-context.d.cts +36 -0
- package/dist/components/RichTextEditor/embed-context.d.cts.map +1 -0
- package/dist/components/RichTextEditor/embed-context.d.ts +36 -0
- package/dist/components/RichTextEditor/embed-context.d.ts.map +1 -0
- package/dist/components/RichTextEditor/embed-types.d.cts +27 -0
- package/dist/components/RichTextEditor/embed-types.d.cts.map +1 -0
- package/dist/components/RichTextEditor/embed-types.d.ts +27 -0
- package/dist/components/RichTextEditor/embed-types.d.ts.map +1 -0
- package/dist/components/RichTextEditor/expansion.d.cts +6 -1
- package/dist/components/RichTextEditor/expansion.d.cts.map +1 -1
- package/dist/components/RichTextEditor/expansion.d.ts +6 -1
- package/dist/components/RichTextEditor/expansion.d.ts.map +1 -1
- package/dist/components/RichTextEditor/index.cjs +1 -1
- package/dist/components/RichTextEditor/index.d.cts +4 -0
- package/dist/components/RichTextEditor/index.d.cts.map +1 -1
- package/dist/components/RichTextEditor/index.d.ts +4 -0
- package/dist/components/RichTextEditor/index.d.ts.map +1 -1
- package/dist/components/RichTextEditor/index.js +1 -1
- package/dist/components/RichTextEditor/storyblock-view.d.cts +3 -0
- package/dist/components/RichTextEditor/storyblock-view.d.cts.map +1 -0
- package/dist/components/RichTextEditor/storyblock-view.d.ts +3 -0
- package/dist/components/RichTextEditor/storyblock-view.d.ts.map +1 -0
- package/dist/components/RichTextEditor/storyblock.d.cts +19 -0
- package/dist/components/RichTextEditor/storyblock.d.cts.map +1 -0
- package/dist/components/RichTextEditor/storyblock.d.ts +19 -0
- package/dist/components/RichTextEditor/storyblock.d.ts.map +1 -0
- package/dist/components/RichTextEditor/style.css +147 -0
- package/dist/components/RichTextEditor/use-embeds.d.cts +31 -0
- package/dist/components/RichTextEditor/use-embeds.d.cts.map +1 -0
- package/dist/components/RichTextEditor/use-embeds.d.ts +31 -0
- package/dist/components/RichTextEditor/use-embeds.d.ts.map +1 -0
- package/dist/components/SearchField/index.cjs +1 -1
- package/dist/components/SearchField/index.js +1 -1
- package/dist/components/Select/index.cjs +1 -1
- package/dist/components/Select/index.js +1 -1
- package/dist/components/SideNav/index.cjs +1 -1
- package/dist/components/SideNav/index.js +1 -1
- package/dist/components/SortableList/index.cjs +1 -1
- package/dist/components/SortableList/index.js +1 -1
- package/dist/components/Stepper/index.cjs +1 -1
- package/dist/components/Stepper/index.js +1 -1
- package/dist/components/SubNav/index.cjs +1 -1
- package/dist/components/SubNav/index.js +1 -1
- package/dist/components/Table/index.cjs +1 -1
- package/dist/components/Table/index.js +1 -1
- package/dist/components/Toast/index.cjs +1 -1
- package/dist/components/Toast/index.js +1 -1
- package/dist/components/TopNav/index.cjs +1 -1
- package/dist/components/TopNav/index.js +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +18 -18
- package/package.json +1 -1
- package/dist/chunks/EntryPicker-BhApdZtE.cjs +0 -2
- package/dist/chunks/EntryPicker-BhApdZtE.cjs.map +0 -1
- package/dist/chunks/EntryPicker-LBj_56_e.js +0 -803
- package/dist/chunks/EntryPicker-LBj_56_e.js.map +0 -1
- package/dist/chunks/FormEditor-B5A38LZ4.cjs +0 -2
- package/dist/chunks/FormEditor-B5A38LZ4.cjs.map +0 -1
- package/dist/chunks/FormEditor-BEOp5EW-.js.map +0 -1
- package/dist/chunks/Icon-WOhlu6Rp.cjs +0 -2
- package/dist/chunks/Icon-WOhlu6Rp.cjs.map +0 -1
- package/dist/chunks/Icon-spaFBU4S.js +0 -85
- package/dist/chunks/Icon-spaFBU4S.js.map +0 -1
- package/dist/chunks/RichTextEditor-CuZnjiy2.js +0 -483
- package/dist/chunks/RichTextEditor-CuZnjiy2.js.map +0 -1
- package/dist/chunks/RichTextEditor-DcbLho2Q.cjs +0 -2
- package/dist/chunks/RichTextEditor-DcbLho2Q.cjs.map +0 -1
|
@@ -0,0 +1,1123 @@
|
|
|
1
|
+
import { t as e } from "./Icon-CYXOo0Kt.js";
|
|
2
|
+
import { Button as t } from "../components/Button/index.js";
|
|
3
|
+
import { t as n } from "./mergeRefs-C6_5pADN.js";
|
|
4
|
+
import { d as r, f as i, s as a, u as o } from "./overlayLayer-IuoPVwTO.js";
|
|
5
|
+
import { a as s, o as c } from "./dialogLabel-D18maX-p.js";
|
|
6
|
+
import { t as l } from "./useIsomorphicLayoutEffect-Bc9hxFMc.js";
|
|
7
|
+
import { ButtonGroup as u } from "../components/ButtonGroup/index.js";
|
|
8
|
+
import { Badge as d } from "../components/Badge/index.js";
|
|
9
|
+
/* empty css */
|
|
10
|
+
import { Field as f } from "../components/Field/index.js";
|
|
11
|
+
import { Modal as p } from "../components/Modal/index.js";
|
|
12
|
+
import { TextField as m } from "../components/TextField/index.js";
|
|
13
|
+
import { a as h, i as g, l as _, o as v, s as y, t as b } from "./use-picker-session-BDEWL2jK.js";
|
|
14
|
+
import { createContext as x, forwardRef as S, useCallback as C, useContext as w, useEffect as T, useId as E, useMemo as D, useRef as O, useState as k } from "react";
|
|
15
|
+
import { createPortal as A } from "react-dom";
|
|
16
|
+
import { Fragment as j, jsx as M, jsxs as N } from "react/jsx-runtime";
|
|
17
|
+
import { EditorContent as ee, Node as te, NodeViewWrapper as P, ReactNodeViewRenderer as F, createDocument as ne, getMarkRange as re, getSchema as ie, mergeAttributes as I, useEditor as ae, useEditorState as oe } from "@tiptap/react";
|
|
18
|
+
import { Placeholder as se } from "@tiptap/extension-placeholder";
|
|
19
|
+
import { StarterKit as L } from "@tiptap/starter-kit";
|
|
20
|
+
import { Link as R } from "@tiptap/extension-link";
|
|
21
|
+
//#region src/components/RichTextEditor/expansion.tsx
|
|
22
|
+
function z(e, t) {
|
|
23
|
+
let n = t.querySelector(".ds-rte__content");
|
|
24
|
+
if (!n) return;
|
|
25
|
+
let r = e.view.coordsAtPos(e.state.selection.head), i = n.getBoundingClientRect();
|
|
26
|
+
(r.top < i.top || r.bottom > i.bottom) && (n.scrollTop += r.top - i.top - i.height / 2);
|
|
27
|
+
}
|
|
28
|
+
function ce({ editor: e, disabled: n, isHeld: a = !1, invalid: o, label: u, labelledBy: d, expandedWidth: f, frameRef: m }) {
|
|
29
|
+
let h = c("ds-rte__host"), [g, _] = k(!1), [v, y] = k(0), b = O(null), x = O(null), S = O(null), w = O(!1), T = O(!1), D = E();
|
|
30
|
+
g && n && !a && _(!1);
|
|
31
|
+
let j = C(() => {
|
|
32
|
+
w.current = document.activeElement === S.current, _(!1);
|
|
33
|
+
}, []);
|
|
34
|
+
l(() => {
|
|
35
|
+
h && (s(h, g ? x.current : b.current), T.current !== g && (T.current = g, n || !e ? r(document.activeElement) && i(m.current, { preventScroll: !0 }) : (z(e, h), !g && w.current ? S.current?.focus() : (e.view.focus(), e.commands.scrollIntoView()), w.current = !1)));
|
|
36
|
+
}, [
|
|
37
|
+
h,
|
|
38
|
+
g,
|
|
39
|
+
e,
|
|
40
|
+
n,
|
|
41
|
+
m
|
|
42
|
+
]);
|
|
43
|
+
let N = g ? "Collapse editor" : "Expand editor";
|
|
44
|
+
return {
|
|
45
|
+
expanded: g,
|
|
46
|
+
toggle: /* @__PURE__ */ M(t, {
|
|
47
|
+
ref: S,
|
|
48
|
+
size: "sm",
|
|
49
|
+
isIconOnly: !0,
|
|
50
|
+
iconStart: g ? "minimize-2" : "maximize-2",
|
|
51
|
+
className: "ds-rte__expand",
|
|
52
|
+
"aria-label": N,
|
|
53
|
+
title: N,
|
|
54
|
+
"aria-expanded": g,
|
|
55
|
+
"aria-controls": g ? D : void 0,
|
|
56
|
+
isDisabled: n || !e || !h,
|
|
57
|
+
onMouseDown: (e) => e.preventDefault(),
|
|
58
|
+
onClick: () => {
|
|
59
|
+
g ? j() : (y(m.current.getBoundingClientRect().height), _(!0));
|
|
60
|
+
}
|
|
61
|
+
}),
|
|
62
|
+
surfaceSlot: (e) => /* @__PURE__ */ M("div", {
|
|
63
|
+
ref: b,
|
|
64
|
+
className: "ds-rte__slot",
|
|
65
|
+
children: h ? A(e, h) : e
|
|
66
|
+
}),
|
|
67
|
+
dialog: /* @__PURE__ */ M(p, {
|
|
68
|
+
id: D,
|
|
69
|
+
isOpen: g,
|
|
70
|
+
onClose: j,
|
|
71
|
+
title: u,
|
|
72
|
+
hasHeader: !1,
|
|
73
|
+
size: f === "full" ? "full" : "wide",
|
|
74
|
+
className: "ds-rte__modal",
|
|
75
|
+
"data-invalid": o || void 0,
|
|
76
|
+
"aria-labelledby": d,
|
|
77
|
+
children: /* @__PURE__ */ M("div", {
|
|
78
|
+
ref: x,
|
|
79
|
+
className: "ds-rte__expanded-slot"
|
|
80
|
+
})
|
|
81
|
+
}),
|
|
82
|
+
frameStyle: g ? { minBlockSize: v } : void 0
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
//#endregion
|
|
86
|
+
//#region src/components/RichTextEditor/storyblock.ts
|
|
87
|
+
function B(e) {
|
|
88
|
+
let t = (e) => typeof e == "string" && e.trim().length > 0;
|
|
89
|
+
return [
|
|
90
|
+
"left",
|
|
91
|
+
"full",
|
|
92
|
+
"right"
|
|
93
|
+
].includes(e.align == null ? "full" : e.align) && (e.type === "entry" ? t(e.id) && t(e.entryId) && e.assetId == null : e.type === "asset" && t(e.assetId) && e.id == null && e.entryId == null);
|
|
94
|
+
}
|
|
95
|
+
function V(e) {
|
|
96
|
+
return {
|
|
97
|
+
...e,
|
|
98
|
+
...e.type === "storyblock" && e.attrs ? { attrs: {
|
|
99
|
+
type: e.attrs.type,
|
|
100
|
+
...e.attrs.type === "entry" ? {
|
|
101
|
+
id: e.attrs.id,
|
|
102
|
+
entryId: e.attrs.entryId
|
|
103
|
+
} : { assetId: e.attrs.assetId },
|
|
104
|
+
align: e.attrs.align ?? "full"
|
|
105
|
+
} } : {},
|
|
106
|
+
...e.content ? { content: e.content.map(V) } : {}
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
var H = te.create({
|
|
110
|
+
name: "storyblock",
|
|
111
|
+
group: "block",
|
|
112
|
+
atom: !0,
|
|
113
|
+
draggable: !0,
|
|
114
|
+
selectable: !0,
|
|
115
|
+
marks: "",
|
|
116
|
+
addAttributes() {
|
|
117
|
+
return Object.fromEntries([
|
|
118
|
+
"type",
|
|
119
|
+
"id",
|
|
120
|
+
"entryId",
|
|
121
|
+
"assetId",
|
|
122
|
+
"align"
|
|
123
|
+
].map((e) => [e, {
|
|
124
|
+
default: e === "align" ? "full" : null,
|
|
125
|
+
parseHTML: (t) => t.getAttribute(`data-storyblock-${e.toLowerCase()}`),
|
|
126
|
+
renderHTML: () => ({})
|
|
127
|
+
}]));
|
|
128
|
+
},
|
|
129
|
+
parseHTML() {
|
|
130
|
+
return [{
|
|
131
|
+
tag: "div[data-storyblock]",
|
|
132
|
+
getAttrs: (e) => B(Object.fromEntries([
|
|
133
|
+
"type",
|
|
134
|
+
"id",
|
|
135
|
+
"entryId",
|
|
136
|
+
"assetId",
|
|
137
|
+
"align"
|
|
138
|
+
].map((t) => [t, e.getAttribute(`data-storyblock-${t.toLowerCase()}`)]))) ? null : !1
|
|
139
|
+
}];
|
|
140
|
+
},
|
|
141
|
+
renderHTML({ node: e, HTMLAttributes: t }) {
|
|
142
|
+
let n = V({
|
|
143
|
+
type: "storyblock",
|
|
144
|
+
attrs: e.attrs
|
|
145
|
+
}).attrs;
|
|
146
|
+
return ["div", I(t, {
|
|
147
|
+
"data-storyblock": "",
|
|
148
|
+
...Object.fromEntries(Object.entries(n).map(([e, t]) => [`data-storyblock-${e.toLowerCase()}`, t]))
|
|
149
|
+
})];
|
|
150
|
+
}
|
|
151
|
+
}), U = {
|
|
152
|
+
type: "doc",
|
|
153
|
+
content: [{ type: "paragraph" }]
|
|
154
|
+
}, W = [L.configure({
|
|
155
|
+
link: !1,
|
|
156
|
+
trailingNode: { notAfter: ["paragraph", "storyblock"] }
|
|
157
|
+
}), R.configure({
|
|
158
|
+
openOnClick: !1,
|
|
159
|
+
autolink: !0
|
|
160
|
+
})];
|
|
161
|
+
function G(e = H) {
|
|
162
|
+
return [e, ...W];
|
|
163
|
+
}
|
|
164
|
+
var K = ie(G());
|
|
165
|
+
function q(e) {
|
|
166
|
+
return e.content?.length ? e : {
|
|
167
|
+
...e,
|
|
168
|
+
content: U.content
|
|
169
|
+
};
|
|
170
|
+
}
|
|
171
|
+
function le(e) {
|
|
172
|
+
try {
|
|
173
|
+
if (!e || typeof e != "object" || !("type" in e) || e.type !== "doc") throw Error();
|
|
174
|
+
let t = (e) => {
|
|
175
|
+
let n = K.nodes[e.type ?? ""];
|
|
176
|
+
if (!n || Object.keys(e).some((e) => ![
|
|
177
|
+
"type",
|
|
178
|
+
"attrs",
|
|
179
|
+
"content",
|
|
180
|
+
"marks",
|
|
181
|
+
"text"
|
|
182
|
+
].includes(e)) || e.text !== void 0 && e.type !== "text" || e.attrs && Object.keys(e.attrs).some((e) => !Object.hasOwn(n.spec.attrs ?? {}, e)) || e.type === "storyblock" && (!B(e.attrs ?? {}) || e.marks?.length)) throw Error();
|
|
183
|
+
for (let t of e.marks ?? []) {
|
|
184
|
+
let e = K.marks[t.type];
|
|
185
|
+
if (!e || Object.keys(t).some((e) => !["type", "attrs"].includes(e)) || Object.keys(t.attrs ?? {}).some((t) => !Object.hasOwn(e.spec.attrs ?? {}, t))) throw Error();
|
|
186
|
+
}
|
|
187
|
+
e.content?.forEach(t);
|
|
188
|
+
}, n = e;
|
|
189
|
+
t(n), K.nodeFromJSON(q(n)).check();
|
|
190
|
+
} catch {
|
|
191
|
+
return "Unsupported or invalid rich-text document.";
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
//#endregion
|
|
195
|
+
//#region src/components/RichTextEditor/embed-context.ts
|
|
196
|
+
function J(e) {
|
|
197
|
+
return !!(e && (e.loadPage || e.items?.length || e.onCreate));
|
|
198
|
+
}
|
|
199
|
+
var Y = x({
|
|
200
|
+
views: {},
|
|
201
|
+
disabled: !1,
|
|
202
|
+
busy: !1,
|
|
203
|
+
pickCount: 0,
|
|
204
|
+
replace: () => {},
|
|
205
|
+
seed: () => void 0,
|
|
206
|
+
forgetSeed: () => {}
|
|
207
|
+
}), X = [], Z = [
|
|
208
|
+
{
|
|
209
|
+
align: "left",
|
|
210
|
+
icon: "align-left",
|
|
211
|
+
label: "Align left"
|
|
212
|
+
},
|
|
213
|
+
{
|
|
214
|
+
align: "full",
|
|
215
|
+
icon: "align-justify",
|
|
216
|
+
label: "Full width"
|
|
217
|
+
},
|
|
218
|
+
{
|
|
219
|
+
align: "right",
|
|
220
|
+
icon: "align-right",
|
|
221
|
+
label: "Align right"
|
|
222
|
+
}
|
|
223
|
+
], ue = [
|
|
224
|
+
"left",
|
|
225
|
+
"full",
|
|
226
|
+
"right",
|
|
227
|
+
"replace",
|
|
228
|
+
"edit",
|
|
229
|
+
"remove"
|
|
230
|
+
], de = /* @__PURE__ */ new Map([
|
|
231
|
+
["ArrowLeft", -1],
|
|
232
|
+
["ArrowRight", 1],
|
|
233
|
+
["Home", -Infinity],
|
|
234
|
+
["End", Infinity]
|
|
235
|
+
]);
|
|
236
|
+
function fe(e) {
|
|
237
|
+
let t = de.get(e.key);
|
|
238
|
+
if (t === void 0 || e.altKey || e.ctrlKey || e.metaKey || e.shiftKey) return;
|
|
239
|
+
let n = Array.from(e.currentTarget.querySelectorAll("button:not(:disabled)")), r = n.indexOf(e.target);
|
|
240
|
+
if (r === -1) return;
|
|
241
|
+
e.preventDefault();
|
|
242
|
+
let i = r + t;
|
|
243
|
+
n[Number.isFinite(i) ? (i + n.length) % n.length : Math.max(0, Math.min(i, n.length - 1))].focus();
|
|
244
|
+
}
|
|
245
|
+
function pe(e, t) {
|
|
246
|
+
let [n, r] = k(), [i, a] = k(!1), o = e || i, s = n && t.includes(n) ? n : t[0];
|
|
247
|
+
return {
|
|
248
|
+
control: (e) => ({
|
|
249
|
+
isDisabled: !t.includes(e),
|
|
250
|
+
tabIndex: o && e === s ? 0 : -1,
|
|
251
|
+
onFocus: () => r(e)
|
|
252
|
+
}),
|
|
253
|
+
barProps: {
|
|
254
|
+
onKeyDown: fe,
|
|
255
|
+
onFocus: () => a(!0),
|
|
256
|
+
onBlur: (e) => {
|
|
257
|
+
e.currentTarget.contains(e.relatedTarget) || a(!1);
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
};
|
|
261
|
+
}
|
|
262
|
+
function me(e, t) {
|
|
263
|
+
let { views: n, seed: r, forgetSeed: i } = w(Y), a = n[e], o = a?.items ?? X, s = D(() => [t], [t]), c = C((t) => r(e, t), [r, e]), l = v(s, o, a?.resolveItem, a?.refreshKey, c), u = r(e, t);
|
|
264
|
+
T(() => {
|
|
265
|
+
u && i(e, t, u);
|
|
266
|
+
}, [
|
|
267
|
+
i,
|
|
268
|
+
e,
|
|
269
|
+
t,
|
|
270
|
+
u
|
|
271
|
+
]);
|
|
272
|
+
let { known: d, failures: f } = l, p = !!a?.resolveItem, m = D(() => y({
|
|
273
|
+
selected: s,
|
|
274
|
+
items: o,
|
|
275
|
+
pageItems: X,
|
|
276
|
+
known: d,
|
|
277
|
+
failures: f,
|
|
278
|
+
hasResolver: p,
|
|
279
|
+
itemLabel: e
|
|
280
|
+
})[0], [
|
|
281
|
+
s,
|
|
282
|
+
o,
|
|
283
|
+
d,
|
|
284
|
+
f,
|
|
285
|
+
p,
|
|
286
|
+
e
|
|
287
|
+
]), g = h(`Couldn't load ${e}`, l.status, l.error, l.retry), _ = o.some((e) => e.id === t);
|
|
288
|
+
return {
|
|
289
|
+
view: a,
|
|
290
|
+
item: m,
|
|
291
|
+
missing: m.tone === "removed" || !_ && d.has(t) && !d.get(t),
|
|
292
|
+
failure: g
|
|
293
|
+
};
|
|
294
|
+
}
|
|
295
|
+
function he({ kind: t, isMovable: n, onSelect: r }) {
|
|
296
|
+
return /* @__PURE__ */ N("span", {
|
|
297
|
+
className: "ds-storyblock__kind",
|
|
298
|
+
"data-drag-handle": n ? "" : void 0,
|
|
299
|
+
draggable: n || void 0,
|
|
300
|
+
title: n ? "Drag to move" : void 0,
|
|
301
|
+
onClick: n ? r : void 0,
|
|
302
|
+
children: [n && /* @__PURE__ */ M("span", {
|
|
303
|
+
className: "ds-storyblock__grip",
|
|
304
|
+
"aria-hidden": "true",
|
|
305
|
+
children: /* @__PURE__ */ M(e, {
|
|
306
|
+
name: "grip-vertical",
|
|
307
|
+
size: 16
|
|
308
|
+
})
|
|
309
|
+
}), /* @__PURE__ */ M(d, {
|
|
310
|
+
className: "ds-storyblock__kind-label",
|
|
311
|
+
shape: "tag",
|
|
312
|
+
size: "sm",
|
|
313
|
+
children: t
|
|
314
|
+
})]
|
|
315
|
+
});
|
|
316
|
+
}
|
|
317
|
+
function ge({ kind: e, name: n, align: r, isSelected: i, isLocked: a, canReplace: o, onEdit: s, onSelect: c, onAlign: l, onReplace: d, onRemove: f }) {
|
|
318
|
+
let p = {
|
|
319
|
+
left: !0,
|
|
320
|
+
full: !0,
|
|
321
|
+
right: !0,
|
|
322
|
+
replace: o.isEnabled,
|
|
323
|
+
edit: !!s,
|
|
324
|
+
remove: !0
|
|
325
|
+
}, { control: m, barProps: h } = pe(i, a ? [] : ue.filter((e) => p[e]));
|
|
326
|
+
return /* @__PURE__ */ N("div", {
|
|
327
|
+
className: "ds-storyblock__bar",
|
|
328
|
+
role: "toolbar",
|
|
329
|
+
"aria-label": `Block actions for ${n}`,
|
|
330
|
+
...h,
|
|
331
|
+
children: [
|
|
332
|
+
/* @__PURE__ */ M(he, {
|
|
333
|
+
kind: e,
|
|
334
|
+
isMovable: !a,
|
|
335
|
+
onSelect: c
|
|
336
|
+
}),
|
|
337
|
+
/* @__PURE__ */ M(u, {
|
|
338
|
+
className: "ds-storyblock__alignment",
|
|
339
|
+
"aria-label": "Alignment",
|
|
340
|
+
children: Z.map((e) => /* @__PURE__ */ M(t, {
|
|
341
|
+
...m(e.align),
|
|
342
|
+
size: "sm",
|
|
343
|
+
isIconOnly: !0,
|
|
344
|
+
iconStart: e.icon,
|
|
345
|
+
"aria-label": `${e.label}: ${n}`,
|
|
346
|
+
title: e.label,
|
|
347
|
+
"aria-pressed": r === e.align,
|
|
348
|
+
variant: r === e.align ? "active" : "neutral",
|
|
349
|
+
onClick: () => l(e.align)
|
|
350
|
+
}, e.align))
|
|
351
|
+
}),
|
|
352
|
+
/* @__PURE__ */ N("div", {
|
|
353
|
+
className: "ds-storyblock__actions",
|
|
354
|
+
children: [
|
|
355
|
+
o.isShown && /* @__PURE__ */ M(t, {
|
|
356
|
+
...m("replace"),
|
|
357
|
+
variant: "simple",
|
|
358
|
+
size: "sm",
|
|
359
|
+
"aria-label": `Replace ${n}`,
|
|
360
|
+
onClick: d,
|
|
361
|
+
children: "Replace"
|
|
362
|
+
}),
|
|
363
|
+
s && /* @__PURE__ */ M(t, {
|
|
364
|
+
...m("edit"),
|
|
365
|
+
variant: "simple",
|
|
366
|
+
size: "sm",
|
|
367
|
+
isIconOnly: !0,
|
|
368
|
+
iconStart: "pencil",
|
|
369
|
+
"aria-label": `Edit ${n}`,
|
|
370
|
+
title: `Edit ${e}`,
|
|
371
|
+
onClick: s
|
|
372
|
+
}),
|
|
373
|
+
/* @__PURE__ */ M(t, {
|
|
374
|
+
...m("remove"),
|
|
375
|
+
variant: "simple",
|
|
376
|
+
size: "sm",
|
|
377
|
+
isIconOnly: !0,
|
|
378
|
+
iconStart: "trash",
|
|
379
|
+
"aria-label": `Remove ${n}`,
|
|
380
|
+
title: "Remove block from this field",
|
|
381
|
+
onClick: f
|
|
382
|
+
})
|
|
383
|
+
]
|
|
384
|
+
})
|
|
385
|
+
]
|
|
386
|
+
});
|
|
387
|
+
}
|
|
388
|
+
function _e({ kind: e, id: t, item: n, missing: r }) {
|
|
389
|
+
return /* @__PURE__ */ M("div", {
|
|
390
|
+
className: "ds-entry ds-storyblock__body",
|
|
391
|
+
children: r ? /* @__PURE__ */ N("span", {
|
|
392
|
+
className: "ds-entry__body",
|
|
393
|
+
children: [/* @__PURE__ */ M("em", {
|
|
394
|
+
className: "ds-entry__title",
|
|
395
|
+
children: `Unavailable ${e}`
|
|
396
|
+
}), /* @__PURE__ */ N("span", {
|
|
397
|
+
className: "ds-entry__meta",
|
|
398
|
+
children: [/* @__PURE__ */ M("span", { children: `This ${e} was deleted. Replace or remove it.` }), /* @__PURE__ */ M("code", { children: t })]
|
|
399
|
+
})]
|
|
400
|
+
}) : /* @__PURE__ */ M(_, { item: n })
|
|
401
|
+
});
|
|
402
|
+
}
|
|
403
|
+
function ve({ node: e, selected: t, editor: n, getPos: r, updateAttributes: i }) {
|
|
404
|
+
let { disabled: a, busy: o, replace: s } = w(Y), c = e.attrs.type, l = String(c === "entry" ? e.attrs.entryId : e.attrs.assetId), { view: u, item: d, missing: f, failure: p } = me(c, l), m = e.attrs.align ?? "full", h = !f && !d.isUnavailable && !d.isDisabled && u?.onEditItem, g = t && !a, _ = () => {
|
|
405
|
+
let e = r();
|
|
406
|
+
e !== void 0 && n.chain().focus().setNodeSelection(e).run();
|
|
407
|
+
};
|
|
408
|
+
return /* @__PURE__ */ N(P, {
|
|
409
|
+
className: "ds-storyblock",
|
|
410
|
+
"data-align": m,
|
|
411
|
+
"data-selected": g || void 0,
|
|
412
|
+
"data-missing": f || void 0,
|
|
413
|
+
"data-tone": f ? "removed" : d.tone,
|
|
414
|
+
contentEditable: !1,
|
|
415
|
+
onMouseDown: (e) => {
|
|
416
|
+
let t = e.target instanceof Element ? e.target : null;
|
|
417
|
+
t?.closest("button") ? e.preventDefault() : !a && !t?.closest("[data-drag-handle]") && (e.preventDefault(), _());
|
|
418
|
+
},
|
|
419
|
+
children: [
|
|
420
|
+
a ? /* @__PURE__ */ M("div", {
|
|
421
|
+
className: "ds-storyblock__bar",
|
|
422
|
+
children: /* @__PURE__ */ M(he, {
|
|
423
|
+
kind: c,
|
|
424
|
+
isMovable: !1
|
|
425
|
+
})
|
|
426
|
+
}) : /* @__PURE__ */ M(ge, {
|
|
427
|
+
kind: c,
|
|
428
|
+
name: f ? `Unavailable ${c}` : d.title,
|
|
429
|
+
align: m,
|
|
430
|
+
isSelected: g,
|
|
431
|
+
isLocked: !!u?.isDialogHidden,
|
|
432
|
+
canReplace: {
|
|
433
|
+
isShown: !!u?.canEmbed,
|
|
434
|
+
isEnabled: !!u?.canEmbed && !o
|
|
435
|
+
},
|
|
436
|
+
onEdit: h ? () => h(d) : void 0,
|
|
437
|
+
onSelect: _,
|
|
438
|
+
onAlign: (e) => i({ align: e }),
|
|
439
|
+
onReplace: () => {
|
|
440
|
+
let e = r();
|
|
441
|
+
e !== void 0 && s(c, e);
|
|
442
|
+
},
|
|
443
|
+
onRemove: () => {
|
|
444
|
+
let t = r();
|
|
445
|
+
t !== void 0 && n.chain().focus().setNodeSelection(t).deleteRange({
|
|
446
|
+
from: t,
|
|
447
|
+
to: t + e.nodeSize
|
|
448
|
+
}).run();
|
|
449
|
+
}
|
|
450
|
+
}),
|
|
451
|
+
/* @__PURE__ */ M(_e, {
|
|
452
|
+
kind: c,
|
|
453
|
+
id: l,
|
|
454
|
+
item: d,
|
|
455
|
+
missing: f
|
|
456
|
+
}),
|
|
457
|
+
p && /* @__PURE__ */ M("div", {
|
|
458
|
+
className: "ds-storyblock__failure",
|
|
459
|
+
children: p
|
|
460
|
+
})
|
|
461
|
+
]
|
|
462
|
+
});
|
|
463
|
+
}
|
|
464
|
+
//#endregion
|
|
465
|
+
//#region src/components/RichTextEditor/use-embeds.tsx
|
|
466
|
+
var ye = "ds-rte-embed-commit", be = ["entry", "asset"], xe = {
|
|
467
|
+
entry: {
|
|
468
|
+
itemLabel: "entry",
|
|
469
|
+
itemsLabel: "entries"
|
|
470
|
+
},
|
|
471
|
+
asset: {
|
|
472
|
+
itemLabel: "asset",
|
|
473
|
+
itemsLabel: "assets"
|
|
474
|
+
}
|
|
475
|
+
}, Se = {}, Ce = [];
|
|
476
|
+
function we(e, t, n) {
|
|
477
|
+
return {
|
|
478
|
+
type: e,
|
|
479
|
+
align: t,
|
|
480
|
+
...e === "entry" ? {
|
|
481
|
+
id: n.modelId,
|
|
482
|
+
entryId: n.id
|
|
483
|
+
} : { assetId: n.id }
|
|
484
|
+
};
|
|
485
|
+
}
|
|
486
|
+
function Q(e, t) {
|
|
487
|
+
if (t.tone === "removed") return {
|
|
488
|
+
label: t.removedLabel ?? "Removed",
|
|
489
|
+
description: `This ${e} was removed.`
|
|
490
|
+
};
|
|
491
|
+
if (!B(we(e, "full", t))) return {
|
|
492
|
+
label: "Can't embed",
|
|
493
|
+
description: `This ${e} has no ${e === "entry" && !t.modelId?.trim() ? "model API ID" : "ID"}.`
|
|
494
|
+
};
|
|
495
|
+
}
|
|
496
|
+
var Te = {
|
|
497
|
+
entry: (e) => Q("entry", e),
|
|
498
|
+
asset: (e) => Q("asset", e)
|
|
499
|
+
};
|
|
500
|
+
function Ee(e, t) {
|
|
501
|
+
return e?.type.name === "storyblock" && e.attrs.type === t.kind && String(t.kind === "entry" ? e.attrs.entryId : e.attrs.assetId) === t.replaceId;
|
|
502
|
+
}
|
|
503
|
+
function De(e) {
|
|
504
|
+
return e.flatMap((e) => e.mapping.maps);
|
|
505
|
+
}
|
|
506
|
+
function Oe(e, t) {
|
|
507
|
+
let n = t;
|
|
508
|
+
for (let t of De(e)) {
|
|
509
|
+
let e = n, r;
|
|
510
|
+
if (t.forEach((t, n, i, a) => {
|
|
511
|
+
r === void 0 && t <= e && e < n && n - t === a - i && (r = i + (e - t));
|
|
512
|
+
}), r !== void 0) {
|
|
513
|
+
n = r;
|
|
514
|
+
continue;
|
|
515
|
+
}
|
|
516
|
+
let i = t.mapResult(e, 1);
|
|
517
|
+
if (i.deletedAfter) return null;
|
|
518
|
+
n = i.pos;
|
|
519
|
+
}
|
|
520
|
+
return n;
|
|
521
|
+
}
|
|
522
|
+
function ke(e, t, n) {
|
|
523
|
+
let r = t, i = n;
|
|
524
|
+
for (let t of De(e)) {
|
|
525
|
+
if (r === i) {
|
|
526
|
+
r = i = t.map(i, -1);
|
|
527
|
+
continue;
|
|
528
|
+
}
|
|
529
|
+
let e = !1;
|
|
530
|
+
if (t.forEach((t, n, a, o) => {
|
|
531
|
+
let s = i - r === 1 && t === r && n === i && o - a === 1;
|
|
532
|
+
e ||= t <= r && i <= n && !s;
|
|
533
|
+
}), r = t.map(r, 1), i = t.map(i, -1), e || i <= r) return null;
|
|
534
|
+
}
|
|
535
|
+
return {
|
|
536
|
+
from: r,
|
|
537
|
+
to: i
|
|
538
|
+
};
|
|
539
|
+
}
|
|
540
|
+
function Ae(e, t) {
|
|
541
|
+
let n = e.resolve(Math.min(t, e.content.size));
|
|
542
|
+
return n.depth ? n.after(1) : n.pos;
|
|
543
|
+
}
|
|
544
|
+
function je(e, t, n) {
|
|
545
|
+
let r = e !== void 0, i = !!e?.resolveItem, a = !!e?.onEditItem, o = e?.refreshKey, s = e?.items, c = !!e?.isDialogHidden, l = J(e);
|
|
546
|
+
return D(() => r ? {
|
|
547
|
+
resolveItem: i ? t : void 0,
|
|
548
|
+
refreshKey: o,
|
|
549
|
+
items: s,
|
|
550
|
+
isDialogHidden: c,
|
|
551
|
+
canEmbed: l,
|
|
552
|
+
onEditItem: a ? n : void 0
|
|
553
|
+
} : void 0, [
|
|
554
|
+
r,
|
|
555
|
+
i,
|
|
556
|
+
a,
|
|
557
|
+
o,
|
|
558
|
+
s,
|
|
559
|
+
c,
|
|
560
|
+
l,
|
|
561
|
+
t,
|
|
562
|
+
n
|
|
563
|
+
]);
|
|
564
|
+
}
|
|
565
|
+
function Me({ session: e, source: t, disabled: n, label: r, close: i, target: a, pick: o }) {
|
|
566
|
+
let { itemLabel: s, itemsLabel: c } = xe[e.kind], l = D(() => e.replaceId ? [e.replaceId] : [], [e]), u = b(l, t.items ?? Ce, {
|
|
567
|
+
...t,
|
|
568
|
+
resolveItem: void 0,
|
|
569
|
+
mode: "single"
|
|
570
|
+
}, {
|
|
571
|
+
isOpen: !0,
|
|
572
|
+
isDisabled: n,
|
|
573
|
+
itemLabel: s,
|
|
574
|
+
itemsLabel: c,
|
|
575
|
+
close: i,
|
|
576
|
+
restrict: Te[e.kind]
|
|
577
|
+
}), d = e.replaceId ? "Replace" : "Embed";
|
|
578
|
+
return /* @__PURE__ */ M(g, {
|
|
579
|
+
...u.dialog,
|
|
580
|
+
isOpen: !0,
|
|
581
|
+
onClose: i,
|
|
582
|
+
onToggle: (e) => {
|
|
583
|
+
let t = u.choice(e);
|
|
584
|
+
t && o(t, u.revision);
|
|
585
|
+
},
|
|
586
|
+
addLabel: `${d} ${s}`,
|
|
587
|
+
onCreate: t.onCreate ? () => t.onCreate?.(a) : void 0,
|
|
588
|
+
isCreating: t.isCreating,
|
|
589
|
+
dialogTitle: t.dialogTitle,
|
|
590
|
+
dialogDescription: `Choose one ${s} to embed in ${r}. ${t.dialogDescription ?? ""}`.trim(),
|
|
591
|
+
isDialogHidden: t.isDialogHidden
|
|
592
|
+
});
|
|
593
|
+
}
|
|
594
|
+
function Ne(e, n = Se, r, i) {
|
|
595
|
+
let [a, s] = k(null), c = O(0), l = O({
|
|
596
|
+
session: null,
|
|
597
|
+
from: 0,
|
|
598
|
+
to: 0,
|
|
599
|
+
alive: !1
|
|
600
|
+
}), d = O(/* @__PURE__ */ new Map()), [f, p] = k(0), m = C(() => {
|
|
601
|
+
l.current.alive = !1, s(null);
|
|
602
|
+
}, []), h = a ? n[a.kind] : void 0, g = a && J(h) && (!r || h?.isCreating) ? a : null;
|
|
603
|
+
a && !g && s(null);
|
|
604
|
+
let _ = !!(g && (h?.isDialogHidden || h?.isCreating)), v = o({
|
|
605
|
+
editor: e,
|
|
606
|
+
sources: n,
|
|
607
|
+
disabled: r,
|
|
608
|
+
busy: _
|
|
609
|
+
});
|
|
610
|
+
T(() => {
|
|
611
|
+
if (!e || !a) return;
|
|
612
|
+
l.current.alive = !0;
|
|
613
|
+
let t = ({ editor: e, transaction: t, appendedTransactions: n }) => {
|
|
614
|
+
let r = [t, ...n];
|
|
615
|
+
if (!l.current.alive || !r.some((e) => e.docChanged)) return;
|
|
616
|
+
let { from: i, to: o } = l.current;
|
|
617
|
+
if (a.replaceId === void 0) {
|
|
618
|
+
let e = ke(r, i, o);
|
|
619
|
+
e ? Object.assign(l.current, e) : m();
|
|
620
|
+
return;
|
|
621
|
+
}
|
|
622
|
+
let s = Oe(r, i);
|
|
623
|
+
s === null || !Ee(e.state.doc.nodeAt(s), a) ? m() : Object.assign(l.current, {
|
|
624
|
+
from: s,
|
|
625
|
+
to: s + 1
|
|
626
|
+
});
|
|
627
|
+
};
|
|
628
|
+
return e.on("transaction", t), () => {
|
|
629
|
+
e.off("transaction", t), l.current.session === a && (l.current.alive = !1);
|
|
630
|
+
};
|
|
631
|
+
}, [
|
|
632
|
+
e,
|
|
633
|
+
a,
|
|
634
|
+
m
|
|
635
|
+
]);
|
|
636
|
+
let y = (e) => {
|
|
637
|
+
let { editor: t, sources: n, disabled: r } = v.current, i = n[e.kind];
|
|
638
|
+
return !(!t || t.isDestroyed || l.current.session !== e || !l.current.alive || !J(i) || r && !i?.isCreating);
|
|
639
|
+
}, b = (e, t, n) => {
|
|
640
|
+
let r = v.current.editor;
|
|
641
|
+
if (!r || !y(e) || t.isDisabled || t.tone === "removed") return !1;
|
|
642
|
+
let { doc: i } = r.state, a = e.replaceId !== void 0, o = a ? i.nodeAt(l.current.from) : null;
|
|
643
|
+
if (a && !Ee(o, e)) return !1;
|
|
644
|
+
let s = we(e.kind, o?.attrs.align ?? "full", t);
|
|
645
|
+
if (!B(s)) return !1;
|
|
646
|
+
let c = a ? l.current.from : Ae(i, l.current.to), u = `${e.kind}:${t.id}`;
|
|
647
|
+
l.current.alive = !1, d.current = /* @__PURE__ */ new Map([[u, {
|
|
648
|
+
item: t,
|
|
649
|
+
revision: n
|
|
650
|
+
}]]);
|
|
651
|
+
let f = !1;
|
|
652
|
+
try {
|
|
653
|
+
let e = r.chain().focus().setMeta(ye, !0);
|
|
654
|
+
f = a ? e.setNodeSelection(c).updateAttributes("storyblock", s).run() : e.insertContentAt(c, {
|
|
655
|
+
type: "storyblock",
|
|
656
|
+
attrs: s
|
|
657
|
+
}).setNodeSelection(c).run();
|
|
658
|
+
} catch {
|
|
659
|
+
f = !1;
|
|
660
|
+
} finally {
|
|
661
|
+
m();
|
|
662
|
+
}
|
|
663
|
+
return f ? p((e) => e + 1) : d.current.delete(u), f;
|
|
664
|
+
}, x = (e, t) => {
|
|
665
|
+
let { editor: n, sources: r, disabled: i, busy: a } = v.current;
|
|
666
|
+
if (!n || i || a || !J(r[e])) return;
|
|
667
|
+
let o = t === void 0 ? null : n.state.doc.nodeAt(t);
|
|
668
|
+
if (t !== void 0 && (o?.type.name !== "storyblock" || o.attrs.type !== e)) return;
|
|
669
|
+
let { $from: u, from: d, to: f } = n.state.selection, p = {
|
|
670
|
+
id: c.current += 1,
|
|
671
|
+
kind: e,
|
|
672
|
+
replaceId: o ? String(e === "entry" ? o.attrs.entryId : o.attrs.assetId) : void 0
|
|
673
|
+
}, m = t === void 0 ? u.depth ? {
|
|
674
|
+
from: u.before(1),
|
|
675
|
+
to: u.after(1)
|
|
676
|
+
} : {
|
|
677
|
+
from: d,
|
|
678
|
+
to: f
|
|
679
|
+
} : {
|
|
680
|
+
from: t,
|
|
681
|
+
to: t + 1
|
|
682
|
+
};
|
|
683
|
+
l.current = {
|
|
684
|
+
session: p,
|
|
685
|
+
...m,
|
|
686
|
+
alive: !0
|
|
687
|
+
}, s(p);
|
|
688
|
+
}, S = o({ open: x }), [w] = k(() => ({
|
|
689
|
+
replace: (e, t) => S.current.open(e, t),
|
|
690
|
+
seed: (e, t) => d.current.get(`${e}:${t}`),
|
|
691
|
+
forgetSeed: (e, t, n) => {
|
|
692
|
+
d.current.get(`${e}:${t}`) === n && d.current.delete(`${e}:${t}`);
|
|
693
|
+
},
|
|
694
|
+
resolve: {
|
|
695
|
+
entry: (e) => v.current.sources.entry?.resolveItem?.(e) ?? null,
|
|
696
|
+
asset: (e) => v.current.sources.asset?.resolveItem?.(e) ?? null
|
|
697
|
+
},
|
|
698
|
+
edit: {
|
|
699
|
+
entry: (e) => {
|
|
700
|
+
v.current.sources.entry?.onEditItem?.(e);
|
|
701
|
+
},
|
|
702
|
+
asset: (e) => {
|
|
703
|
+
v.current.sources.asset?.onEditItem?.(e);
|
|
704
|
+
}
|
|
705
|
+
}
|
|
706
|
+
})), E = je(n.entry, w.resolve.entry, w.edit.entry), A = je(n.asset, w.resolve.asset, w.edit.asset), j = D(() => ({
|
|
707
|
+
views: {
|
|
708
|
+
entry: E,
|
|
709
|
+
asset: A
|
|
710
|
+
},
|
|
711
|
+
disabled: r,
|
|
712
|
+
busy: _,
|
|
713
|
+
pickCount: f,
|
|
714
|
+
replace: w.replace,
|
|
715
|
+
seed: w.seed,
|
|
716
|
+
forgetSeed: w.forgetSeed
|
|
717
|
+
}), [
|
|
718
|
+
E,
|
|
719
|
+
A,
|
|
720
|
+
r,
|
|
721
|
+
_,
|
|
722
|
+
f,
|
|
723
|
+
w
|
|
724
|
+
]), N = be.filter((e) => J(n[e]));
|
|
725
|
+
return {
|
|
726
|
+
context: j,
|
|
727
|
+
isCreating: be.some((e) => n[e]?.isCreating),
|
|
728
|
+
toolbar: N.length > 0 && /* @__PURE__ */ M(u, {
|
|
729
|
+
"aria-label": "Embed",
|
|
730
|
+
children: N.map((n) => /* @__PURE__ */ M(t, {
|
|
731
|
+
size: "sm",
|
|
732
|
+
isIconOnly: !0,
|
|
733
|
+
iconStart: n === "entry" ? "file-text" : "image",
|
|
734
|
+
"aria-label": `Embed ${n}`,
|
|
735
|
+
title: `Embed ${n}`,
|
|
736
|
+
"aria-pressed": g?.kind === n,
|
|
737
|
+
variant: g?.kind === n ? "active" : "neutral",
|
|
738
|
+
isDisabled: r || _ || !e,
|
|
739
|
+
onClick: () => x(n)
|
|
740
|
+
}, n))
|
|
741
|
+
}),
|
|
742
|
+
dialog: e && g && h && /* @__PURE__ */ M(Me, {
|
|
743
|
+
session: g,
|
|
744
|
+
source: h,
|
|
745
|
+
disabled: r,
|
|
746
|
+
label: i,
|
|
747
|
+
close: m,
|
|
748
|
+
target: {
|
|
749
|
+
available: () => y(g),
|
|
750
|
+
commit: (e) => b(g, e, v.current.sources[g.kind]?.refreshKey)
|
|
751
|
+
},
|
|
752
|
+
pick: (e, t) => b(g, e, t)
|
|
753
|
+
}, g.id)
|
|
754
|
+
};
|
|
755
|
+
}
|
|
756
|
+
//#endregion
|
|
757
|
+
//#region src/components/RichTextEditor/index.tsx
|
|
758
|
+
function Pe({ editor: e, selection: n, onClose: r }) {
|
|
759
|
+
let [i, a] = k(n.href), [o, s] = k(), c = E();
|
|
760
|
+
T(() => {
|
|
761
|
+
let t = () => {
|
|
762
|
+
e.state.doc.eq(n.document) || r();
|
|
763
|
+
};
|
|
764
|
+
return e.on("transaction", t), () => {
|
|
765
|
+
e.off("transaction", t);
|
|
766
|
+
};
|
|
767
|
+
}, [
|
|
768
|
+
e,
|
|
769
|
+
n,
|
|
770
|
+
r
|
|
771
|
+
]);
|
|
772
|
+
let l = () => !e.isDestroyed && e.isEditable && e.state.doc.eq(n.document), u = () => {
|
|
773
|
+
if (!l()) {
|
|
774
|
+
r();
|
|
775
|
+
return;
|
|
776
|
+
}
|
|
777
|
+
let t = i.trim();
|
|
778
|
+
if (!t || !e.can().setLink({ href: t })) {
|
|
779
|
+
s(t ? "Enter a valid link URL." : "Enter a link URL.");
|
|
780
|
+
return;
|
|
781
|
+
}
|
|
782
|
+
let a = e.chain().focus().setTextSelection({
|
|
783
|
+
from: n.from,
|
|
784
|
+
to: n.to
|
|
785
|
+
});
|
|
786
|
+
n.from === n.to && !n.isEditing ? a.setLink({ href: t }).insertContent({
|
|
787
|
+
type: "text",
|
|
788
|
+
text: t,
|
|
789
|
+
marks: [{
|
|
790
|
+
type: "link",
|
|
791
|
+
attrs: { href: t }
|
|
792
|
+
}]
|
|
793
|
+
}).run() : a.setLink({ href: t }).run(), r();
|
|
794
|
+
};
|
|
795
|
+
return /* @__PURE__ */ M(p, {
|
|
796
|
+
isOpen: !0,
|
|
797
|
+
title: n.isEditing ? "Edit link" : "Add link",
|
|
798
|
+
size: "dialog",
|
|
799
|
+
onClose: r,
|
|
800
|
+
footer: /* @__PURE__ */ N(j, { children: [
|
|
801
|
+
n.isEditing && /* @__PURE__ */ M(t, {
|
|
802
|
+
variant: "danger",
|
|
803
|
+
onClick: () => {
|
|
804
|
+
l() && e.chain().focus().setTextSelection({
|
|
805
|
+
from: n.from,
|
|
806
|
+
to: n.to
|
|
807
|
+
}).unsetLink().run(), r();
|
|
808
|
+
},
|
|
809
|
+
children: "Remove link"
|
|
810
|
+
}),
|
|
811
|
+
/* @__PURE__ */ M(t, {
|
|
812
|
+
onClick: r,
|
|
813
|
+
children: "Cancel"
|
|
814
|
+
}),
|
|
815
|
+
/* @__PURE__ */ M(t, {
|
|
816
|
+
variant: "primary",
|
|
817
|
+
type: "submit",
|
|
818
|
+
form: c,
|
|
819
|
+
children: "Save"
|
|
820
|
+
})
|
|
821
|
+
] }),
|
|
822
|
+
children: /* @__PURE__ */ M("form", {
|
|
823
|
+
id: c,
|
|
824
|
+
noValidate: !0,
|
|
825
|
+
onSubmit: (e) => {
|
|
826
|
+
e.preventDefault(), e.stopPropagation(), u();
|
|
827
|
+
},
|
|
828
|
+
children: /* @__PURE__ */ M(f, {
|
|
829
|
+
label: "URL",
|
|
830
|
+
isRequired: !0,
|
|
831
|
+
error: o,
|
|
832
|
+
children: (e) => /* @__PURE__ */ M(m, {
|
|
833
|
+
...e,
|
|
834
|
+
value: i,
|
|
835
|
+
inputMode: "url",
|
|
836
|
+
autoComplete: "url",
|
|
837
|
+
placeholder: "https://example.com",
|
|
838
|
+
onChange: (e) => {
|
|
839
|
+
a(e.target.value), s(void 0);
|
|
840
|
+
}
|
|
841
|
+
})
|
|
842
|
+
})
|
|
843
|
+
})
|
|
844
|
+
});
|
|
845
|
+
}
|
|
846
|
+
var $ = [
|
|
847
|
+
[
|
|
848
|
+
{
|
|
849
|
+
id: "bold",
|
|
850
|
+
icon: "bold",
|
|
851
|
+
label: "Bold",
|
|
852
|
+
run: (e) => e.chain().focus().toggleBold().run(),
|
|
853
|
+
active: (e) => e.isActive("bold")
|
|
854
|
+
},
|
|
855
|
+
{
|
|
856
|
+
id: "italic",
|
|
857
|
+
icon: "italic",
|
|
858
|
+
label: "Italic",
|
|
859
|
+
run: (e) => e.chain().focus().toggleItalic().run(),
|
|
860
|
+
active: (e) => e.isActive("italic")
|
|
861
|
+
},
|
|
862
|
+
{
|
|
863
|
+
id: "strike",
|
|
864
|
+
icon: "strikethrough",
|
|
865
|
+
label: "Strikethrough",
|
|
866
|
+
run: (e) => e.chain().focus().toggleStrike().run(),
|
|
867
|
+
active: (e) => e.isActive("strike")
|
|
868
|
+
},
|
|
869
|
+
{
|
|
870
|
+
id: "code",
|
|
871
|
+
icon: "code",
|
|
872
|
+
label: "Inline code",
|
|
873
|
+
run: (e) => e.chain().focus().toggleCode().run(),
|
|
874
|
+
active: (e) => e.isActive("code")
|
|
875
|
+
}
|
|
876
|
+
],
|
|
877
|
+
[
|
|
878
|
+
{
|
|
879
|
+
id: "h2",
|
|
880
|
+
icon: "heading-2",
|
|
881
|
+
label: "Heading",
|
|
882
|
+
run: (e) => e.chain().focus().toggleHeading({ level: 2 }).run(),
|
|
883
|
+
active: (e) => e.isActive("heading", { level: 2 })
|
|
884
|
+
},
|
|
885
|
+
{
|
|
886
|
+
id: "h3",
|
|
887
|
+
icon: "heading-3",
|
|
888
|
+
label: "Subheading",
|
|
889
|
+
run: (e) => e.chain().focus().toggleHeading({ level: 3 }).run(),
|
|
890
|
+
active: (e) => e.isActive("heading", { level: 3 })
|
|
891
|
+
},
|
|
892
|
+
{
|
|
893
|
+
id: "quote",
|
|
894
|
+
icon: "quote",
|
|
895
|
+
label: "Quote",
|
|
896
|
+
run: (e) => e.chain().focus().toggleBlockquote().run(),
|
|
897
|
+
active: (e) => e.isActive("blockquote")
|
|
898
|
+
}
|
|
899
|
+
],
|
|
900
|
+
[{
|
|
901
|
+
id: "ul",
|
|
902
|
+
icon: "list",
|
|
903
|
+
label: "Bulleted list",
|
|
904
|
+
run: (e) => e.chain().focus().toggleBulletList().run(),
|
|
905
|
+
active: (e) => e.isActive("bulletList")
|
|
906
|
+
}, {
|
|
907
|
+
id: "ol",
|
|
908
|
+
icon: "list-ordered",
|
|
909
|
+
label: "Numbered list",
|
|
910
|
+
run: (e) => e.chain().focus().toggleOrderedList().run(),
|
|
911
|
+
active: (e) => e.isActive("orderedList")
|
|
912
|
+
}],
|
|
913
|
+
[{
|
|
914
|
+
id: "undo",
|
|
915
|
+
icon: "undo",
|
|
916
|
+
label: "Undo",
|
|
917
|
+
run: (e) => e.chain().focus().undo().run()
|
|
918
|
+
}, {
|
|
919
|
+
id: "redo",
|
|
920
|
+
icon: "redo",
|
|
921
|
+
label: "Redo",
|
|
922
|
+
run: (e) => e.chain().focus().redo().run()
|
|
923
|
+
}]
|
|
924
|
+
];
|
|
925
|
+
function Fe({ editor: e, state: n, disabled: r, label: i, toolbarExtra: a, openLink: o, expandControl: s, embedControl: c }) {
|
|
926
|
+
return /* @__PURE__ */ N("div", {
|
|
927
|
+
className: "ds-rte__toolbar",
|
|
928
|
+
role: "toolbar",
|
|
929
|
+
"aria-label": `${i} formatting`,
|
|
930
|
+
children: [
|
|
931
|
+
$.map((i, a) => /* @__PURE__ */ M(u, {
|
|
932
|
+
"aria-label": `Formatting ${a + 1}`,
|
|
933
|
+
children: i.map((i) => /* @__PURE__ */ M(t, {
|
|
934
|
+
size: "sm",
|
|
935
|
+
isIconOnly: !0,
|
|
936
|
+
iconStart: i.icon,
|
|
937
|
+
"aria-label": i.label,
|
|
938
|
+
title: i.label,
|
|
939
|
+
"aria-pressed": i.active ? n?.active[i.id] : void 0,
|
|
940
|
+
variant: n?.active[i.id] ? "active" : "neutral",
|
|
941
|
+
isDisabled: r || !e,
|
|
942
|
+
onClick: () => e && i.run(e)
|
|
943
|
+
}, i.id))
|
|
944
|
+
}, a)),
|
|
945
|
+
/* @__PURE__ */ M(u, {
|
|
946
|
+
"aria-label": "Link",
|
|
947
|
+
children: /* @__PURE__ */ M(t, {
|
|
948
|
+
size: "sm",
|
|
949
|
+
isIconOnly: !0,
|
|
950
|
+
iconStart: "link",
|
|
951
|
+
"aria-label": n?.linkActive ? "Edit link" : "Add link",
|
|
952
|
+
title: n?.linkActive ? "Edit link" : "Add link",
|
|
953
|
+
variant: n?.linkActive ? "active" : "neutral",
|
|
954
|
+
isDisabled: r || !e,
|
|
955
|
+
onClick: () => e && o(e.state, e.isActive("link") ? e.state.selection.from : void 0)
|
|
956
|
+
})
|
|
957
|
+
}),
|
|
958
|
+
c,
|
|
959
|
+
a,
|
|
960
|
+
s
|
|
961
|
+
]
|
|
962
|
+
});
|
|
963
|
+
}
|
|
964
|
+
var Ie = S(function({ scopeRef: e, className: t, expansion: n, isFocused: r, disabled: i, invalid: o, contentError: s, errorId: c, surface: l, children: u }, d) {
|
|
965
|
+
return /* @__PURE__ */ M(a.Provider, {
|
|
966
|
+
value: e,
|
|
967
|
+
children: /* @__PURE__ */ N("div", {
|
|
968
|
+
ref: d,
|
|
969
|
+
className: ["ds-rte", t].filter(Boolean).join(" "),
|
|
970
|
+
style: n.frameStyle,
|
|
971
|
+
"data-expanded": n.expanded || void 0,
|
|
972
|
+
"data-focused": r && !n.expanded || void 0,
|
|
973
|
+
"data-disabled": i || void 0,
|
|
974
|
+
"aria-invalid": o || void 0,
|
|
975
|
+
children: [
|
|
976
|
+
s && /* @__PURE__ */ M("p", {
|
|
977
|
+
id: c,
|
|
978
|
+
role: "alert",
|
|
979
|
+
className: "ds-field__error",
|
|
980
|
+
children: s
|
|
981
|
+
}),
|
|
982
|
+
n.expanded && /* @__PURE__ */ M("p", {
|
|
983
|
+
className: "ds-rte__placeholder",
|
|
984
|
+
children: "Editing in expanded view. Press Esc to return."
|
|
985
|
+
}),
|
|
986
|
+
n.surfaceSlot(/* @__PURE__ */ M("div", {
|
|
987
|
+
className: "ds-rte__surface",
|
|
988
|
+
hidden: !!s,
|
|
989
|
+
"data-invalid": o || void 0,
|
|
990
|
+
children: l
|
|
991
|
+
})),
|
|
992
|
+
n.dialog,
|
|
993
|
+
u
|
|
994
|
+
]
|
|
995
|
+
})
|
|
996
|
+
});
|
|
997
|
+
}), Le = H.extend({ addNodeView() {
|
|
998
|
+
return F(ve, { update: ({ oldNode: e, newNode: t, updateProps: n }) => e.attrs.type === t.attrs.type && (e !== t && n(), !0) });
|
|
999
|
+
} });
|
|
1000
|
+
function Re(e, t) {
|
|
1001
|
+
return t.key !== "Escape" || t.isComposing ? !1 : (e.someProp("handleKeyDown", (n) => n(e, t)) && t.preventDefault(), !0);
|
|
1002
|
+
}
|
|
1003
|
+
var ze = S(function(e, t) {
|
|
1004
|
+
let { placeholder: r = "Write something…", size: i = "md", expandedWidth: a = "wide", isDisabled: o = !1, isInvalid: s = !1, label: c = "Rich text editor", className: l, toolbarExtra: u, id: d, isRequired: f, required: p, "aria-label": m, "aria-labelledby": h, "aria-describedby": g, "aria-invalid": _ } = e, v = O(null), y = D(() => n(v, t), [t]), [b, x] = k(!1), [S, w] = k(null), A = C(() => w(null), []), [te] = k(() => e.defaultValue ?? (e.format === "json" ? U : "")), P = e.value === void 0 ? te : e.value, F = D(() => e.format === "json" ? le(P) : void 0, [e.format, P]), ie = E(), I = s || !!F || _, L = o || !!F;
|
|
1005
|
+
L && S && w(null);
|
|
1006
|
+
let R = C((e, t) => {
|
|
1007
|
+
if (L) return;
|
|
1008
|
+
let n = t === void 0 ? void 0 : re(e.doc.resolve(t), e.schema.marks.link), r = n && e.doc.nodeAt(n.from)?.marks.find((t) => t.type === e.schema.marks.link);
|
|
1009
|
+
w({
|
|
1010
|
+
from: n?.from ?? e.selection.from,
|
|
1011
|
+
to: n?.to ?? e.selection.to,
|
|
1012
|
+
href: r?.attrs.href ?? "",
|
|
1013
|
+
isEditing: !!r,
|
|
1014
|
+
document: e.doc
|
|
1015
|
+
});
|
|
1016
|
+
}, [L]), z = D(() => ({
|
|
1017
|
+
role: "textbox",
|
|
1018
|
+
...h ? {} : { "aria-label": m ?? c },
|
|
1019
|
+
"aria-multiline": "true",
|
|
1020
|
+
...d ? { id: d } : {},
|
|
1021
|
+
...h ? { "aria-labelledby": h } : {},
|
|
1022
|
+
...g ? { "aria-describedby": g } : {},
|
|
1023
|
+
...I ? { "aria-invalid": String(I) } : {},
|
|
1024
|
+
...f || p ? { "aria-required": "true" } : {}
|
|
1025
|
+
}), [
|
|
1026
|
+
c,
|
|
1027
|
+
m,
|
|
1028
|
+
d,
|
|
1029
|
+
h,
|
|
1030
|
+
g,
|
|
1031
|
+
I,
|
|
1032
|
+
f,
|
|
1033
|
+
p
|
|
1034
|
+
]), B = D(() => ({
|
|
1035
|
+
attributes: z,
|
|
1036
|
+
handleDOMEvents: {
|
|
1037
|
+
keydown: Re,
|
|
1038
|
+
click: (e, t) => {
|
|
1039
|
+
let n = t.target instanceof Element ? t.target.closest("a") : null;
|
|
1040
|
+
return !n || !e.dom.contains(n) ? !1 : (t.preventDefault(), e.editable && R(e.state, e.posAtDOM(n, 0)), !0);
|
|
1041
|
+
}
|
|
1042
|
+
}
|
|
1043
|
+
}), [z, R]), H = D(() => [...G(Le), se.configure({ placeholder: r })], [r]), W = D(() => F ? U : typeof P == "string" ? P : q(P), [P, F]), K = ae({
|
|
1044
|
+
immediatelyRender: !1,
|
|
1045
|
+
editable: !L,
|
|
1046
|
+
content: W,
|
|
1047
|
+
extensions: H,
|
|
1048
|
+
editorProps: B,
|
|
1049
|
+
onFocus: () => x(!0),
|
|
1050
|
+
onBlur: () => x(!1),
|
|
1051
|
+
onUpdate: ({ editor: t, transaction: n }) => {
|
|
1052
|
+
(!L || n.getMeta("ds-rte-embed-commit")) && (e.format === "json" ? e.onChange?.(V(t.getJSON())) : e.onChange?.(t.getHTML()));
|
|
1053
|
+
}
|
|
1054
|
+
});
|
|
1055
|
+
T(() => {
|
|
1056
|
+
K && (K.setEditable(!L, !1), K.setOptions({ editorProps: B }));
|
|
1057
|
+
}, [
|
|
1058
|
+
K,
|
|
1059
|
+
L,
|
|
1060
|
+
B
|
|
1061
|
+
]), T(() => {
|
|
1062
|
+
if (!K || e.value === void 0 || F) return;
|
|
1063
|
+
let t = typeof e.value == "string" ? ne(e.value, K.schema) : K.schema.nodeFromJSON(q(e.value));
|
|
1064
|
+
t.eq(K.state.doc) || K.commands.setContent(t, { emitUpdate: !1 });
|
|
1065
|
+
}, [
|
|
1066
|
+
K,
|
|
1067
|
+
e.value,
|
|
1068
|
+
F
|
|
1069
|
+
]);
|
|
1070
|
+
let J = oe({
|
|
1071
|
+
editor: K,
|
|
1072
|
+
selector: ({ editor: e }) => e ? {
|
|
1073
|
+
active: Object.fromEntries($.flat().map((t) => [t.id, t.active?.(e) ?? !1])),
|
|
1074
|
+
linkActive: e.isActive("link")
|
|
1075
|
+
} : null
|
|
1076
|
+
}), X = Ne(K, F ? void 0 : e.embeds, L, c), Z = ce({
|
|
1077
|
+
editor: K,
|
|
1078
|
+
disabled: L,
|
|
1079
|
+
isHeld: X.isCreating,
|
|
1080
|
+
invalid: !!I,
|
|
1081
|
+
label: m ?? c,
|
|
1082
|
+
labelledBy: h,
|
|
1083
|
+
expandedWidth: a,
|
|
1084
|
+
frameRef: v
|
|
1085
|
+
});
|
|
1086
|
+
return /* @__PURE__ */ M(Y.Provider, {
|
|
1087
|
+
value: X.context,
|
|
1088
|
+
children: /* @__PURE__ */ N(Ie, {
|
|
1089
|
+
ref: y,
|
|
1090
|
+
scopeRef: v,
|
|
1091
|
+
className: l,
|
|
1092
|
+
expansion: Z,
|
|
1093
|
+
isFocused: b,
|
|
1094
|
+
disabled: L,
|
|
1095
|
+
invalid: !!I,
|
|
1096
|
+
contentError: F,
|
|
1097
|
+
errorId: ie,
|
|
1098
|
+
surface: /* @__PURE__ */ N(j, { children: [/* @__PURE__ */ M(Fe, {
|
|
1099
|
+
editor: K,
|
|
1100
|
+
state: J,
|
|
1101
|
+
disabled: L,
|
|
1102
|
+
label: c,
|
|
1103
|
+
toolbarExtra: u,
|
|
1104
|
+
openLink: R,
|
|
1105
|
+
expandControl: Z.toggle,
|
|
1106
|
+
embedControl: X.toolbar
|
|
1107
|
+
}), /* @__PURE__ */ M("div", {
|
|
1108
|
+
className: "ds-rte__content",
|
|
1109
|
+
"data-size": i,
|
|
1110
|
+
children: /* @__PURE__ */ M(ee, { editor: K })
|
|
1111
|
+
})] }),
|
|
1112
|
+
children: [X.dialog, K && S && !L && /* @__PURE__ */ M(Pe, {
|
|
1113
|
+
editor: K,
|
|
1114
|
+
selection: S,
|
|
1115
|
+
onClose: A
|
|
1116
|
+
})]
|
|
1117
|
+
})
|
|
1118
|
+
});
|
|
1119
|
+
});
|
|
1120
|
+
//#endregion
|
|
1121
|
+
export { le as n, U as r, ze as t };
|
|
1122
|
+
|
|
1123
|
+
//# sourceMappingURL=RichTextEditor-DmNM63Wg.js.map
|