@solibo/solibo-ui 2.2.9 → 2.2.11
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.
|
@@ -1,51 +1,146 @@
|
|
|
1
|
-
import '../../assets/index43.css';var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
import {
|
|
5
|
-
import { $generateHtmlFromNodes as $t, $generateNodesFromDOM as
|
|
6
|
-
import { TOGGLE_LINK_COMMAND as ft, $isLinkNode as
|
|
7
|
-
import { $isListNode as pt, $isListItemNode as
|
|
8
|
-
import { AutoFocusPlugin as
|
|
9
|
-
import { AutoLinkPlugin as
|
|
10
|
-
import { useLexicalComposerContext as
|
|
11
|
-
import { ContentEditable as
|
|
12
|
-
import { LexicalErrorBoundary as
|
|
13
|
-
import { LexicalExtensionComposer as
|
|
14
|
-
import { HistoryPlugin as
|
|
15
|
-
import { LinkPlugin as
|
|
1
|
+
import '../../assets/index43.css';var Rt = Object.defineProperty;
|
|
2
|
+
var Ot = (s, r, e) => r in s ? Rt(s, r, { enumerable: !0, configurable: !0, writable: !0, value: e }) : s[r] = e;
|
|
3
|
+
var j = (s, r, e) => Ot(s, typeof r != "symbol" ? r + "" : r, e);
|
|
4
|
+
import { jsxs as O, jsx as o, Fragment as ct } from "react/jsx-runtime";
|
|
5
|
+
import { $generateHtmlFromNodes as $t, $generateNodesFromDOM as Ut } from "@lexical/html";
|
|
6
|
+
import { TOGGLE_LINK_COMMAND as ft, $isLinkNode as rt, AutoLinkNode as zt, LinkNode as Bt } from "@lexical/link";
|
|
7
|
+
import { $isListNode as pt, $isListItemNode as _t, REMOVE_LIST_COMMAND as Ht, INSERT_UNORDERED_LIST_COMMAND as Ft, ListNode as Wt, ListItemNode as Kt } from "@lexical/list";
|
|
8
|
+
import { AutoFocusPlugin as jt } from "@lexical/react/LexicalAutoFocusPlugin";
|
|
9
|
+
import { AutoLinkPlugin as Gt } from "@lexical/react/LexicalAutoLinkPlugin";
|
|
10
|
+
import { useLexicalComposerContext as wt } from "@lexical/react/LexicalComposerContext";
|
|
11
|
+
import { ContentEditable as Zt } from "@lexical/react/LexicalContentEditable";
|
|
12
|
+
import { LexicalErrorBoundary as qt } from "@lexical/react/LexicalErrorBoundary";
|
|
13
|
+
import { LexicalExtensionComposer as Vt } from "@lexical/react/LexicalExtensionComposer";
|
|
14
|
+
import { HistoryPlugin as Xt } from "@lexical/react/LexicalHistoryPlugin";
|
|
15
|
+
import { LinkPlugin as Yt } from "@lexical/react/LexicalLinkPlugin";
|
|
16
16
|
import { ListPlugin as Jt } from "@lexical/react/LexicalListPlugin";
|
|
17
|
-
import { OnChangePlugin as
|
|
18
|
-
import { RichTextPlugin as
|
|
19
|
-
import
|
|
20
|
-
import {
|
|
21
|
-
import {
|
|
22
|
-
import
|
|
23
|
-
import { Button as
|
|
24
|
-
import { File as
|
|
25
|
-
import { mergeRegister as
|
|
26
|
-
import { Icon as
|
|
27
|
-
import { I as
|
|
28
|
-
import { Toolbar as
|
|
29
|
-
const
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
17
|
+
import { OnChangePlugin as Qt } from "@lexical/react/LexicalOnChangePlugin";
|
|
18
|
+
import { RichTextPlugin as te } from "@lexical/react/LexicalRichTextPlugin";
|
|
19
|
+
import nt from "classix";
|
|
20
|
+
import { $getNodeByKey as ut, $isParagraphNode as xt, DecoratorNode as ee, $applyNodeReplacement as re, createCommand as Et, COMMAND_PRIORITY_HIGH as Mt, PASTE_COMMAND as ie, $insertNodes as Ct, $isRangeSelection as bt, $setSelection as Pt, $getSelection as kt, $isTextNode as it, $createTextNode as ne, $isNodeSelection as oe, COMMAND_PRIORITY_LOW as yt, SELECTION_CHANGE_COMMAND as ae, FORMAT_TEXT_COMMAND as Dt, defineExtension as se, $getRoot as le } from "lexical";
|
|
21
|
+
import { useRef as x, useState as k, useEffect as F, useCallback as C, useId as ce } from "react";
|
|
22
|
+
import vt from "sanitize-html";
|
|
23
|
+
import { Button as N } from "../button/index.js";
|
|
24
|
+
import { File as ue } from "../file/index.js";
|
|
25
|
+
import { mergeRegister as de } from "@lexical/utils";
|
|
26
|
+
import { Icon as P } from "../icon/index.js";
|
|
27
|
+
import { I as Nt } from "../../index-Dd20d_9U.js";
|
|
28
|
+
import { Toolbar as me } from "../toolbar/index.js";
|
|
29
|
+
const he = "_field_1trki_3", ge = "_editor_1trki_8", fe = "_submit_1trki_26", pe = "_resizable_1trki_56", _e = "_resized_1trki_60", be = "_invalid_1trki_86", ke = "_error_1trki_90", De = "_dragging_1trki_96", ve = "_content_1trki_100", Ie = "_files_1trki_116", we = "_placeholder_1trki_125", Ce = "_fill_1trki_133", Le = "_meta_1trki_161", Ae = "_active_1trki_170", Me = "_bold_1trki_240", ye = "_italic_1trki_244", Ne = "_underline_1trki_248", xe = "_link_1trki_252", Ee = "_list_1trki_258", Pe = "_paragraph_1trki_259", h = {
|
|
30
|
+
field: he,
|
|
31
|
+
editor: ge,
|
|
32
|
+
submit: fe,
|
|
33
|
+
"image-resize-handle": "_image-resize-handle_1trki_50",
|
|
34
|
+
resizable: pe,
|
|
35
|
+
resized: _e,
|
|
36
|
+
"resize-handle": "_resize-handle_1trki_64",
|
|
37
|
+
invalid: be,
|
|
38
|
+
error: ke,
|
|
39
|
+
dragging: De,
|
|
40
|
+
content: ve,
|
|
41
|
+
"has-files": "_has-files_1trki_112",
|
|
42
|
+
files: Ie,
|
|
43
|
+
placeholder: we,
|
|
44
|
+
fill: Ce,
|
|
45
|
+
"fill-editor": "_fill-editor_1trki_141",
|
|
46
|
+
meta: Le,
|
|
47
|
+
active: Ae,
|
|
48
|
+
"inline-image": "_inline-image_1trki_182",
|
|
49
|
+
bold: Me,
|
|
50
|
+
italic: ye,
|
|
51
|
+
underline: Ne,
|
|
52
|
+
link: xe,
|
|
53
|
+
list: Ee,
|
|
54
|
+
paragraph: Pe
|
|
55
|
+
};
|
|
56
|
+
function Se({
|
|
57
|
+
alt: s = "",
|
|
58
|
+
editor: r,
|
|
59
|
+
height: e,
|
|
60
|
+
nodeKey: c,
|
|
61
|
+
soliboDocumentId: g,
|
|
62
|
+
soliboDocumentSlot: m,
|
|
63
|
+
src: p,
|
|
64
|
+
width: n
|
|
65
|
+
}) {
|
|
66
|
+
const u = x(null), f = x(null), [$, A] = k(), L = () => {
|
|
67
|
+
const i = r.getRootElement();
|
|
68
|
+
if (!i) return 1 / 0;
|
|
69
|
+
const l = getComputedStyle(i);
|
|
70
|
+
return Math.max(1, i.clientWidth - (parseFloat(l.paddingLeft) || 0) - (parseFloat(l.paddingRight) || 0));
|
|
71
|
+
}, S = (i, l = L()) => Math.round(Math.min(l, Math.max(Math.min(32, l), i))), w = (i) => {
|
|
72
|
+
r.update(() => {
|
|
73
|
+
const l = ut(c);
|
|
74
|
+
mt(l) && l.setWidth(i);
|
|
75
|
+
}), A(void 0);
|
|
76
|
+
};
|
|
77
|
+
return /* @__PURE__ */ O("span", { className: h["inline-image"], contentEditable: !1, tabIndex: m ? 0 : void 0, onKeyDown: (i) => {
|
|
78
|
+
!m || i.target !== i.currentTarget || !["Backspace", "Delete"].includes(i.key) || (i.preventDefault(), i.stopPropagation(), r.update(() => {
|
|
79
|
+
const l = ut(c);
|
|
80
|
+
if (!mt(l)) return;
|
|
81
|
+
const b = l.getParent();
|
|
82
|
+
xt(b) && b.getChildrenSize() === 1 ? b.remove() : l.remove(), r.dispatchCommand(St, m);
|
|
83
|
+
}), r.focus());
|
|
84
|
+
}, "data-component": "editorimage", children: [
|
|
85
|
+
/* @__PURE__ */ o("img", { alt: s, "data-solibo-document-id": g, "data-solibo-document-slot": m, draggable: !1, height: $ === void 0 ? e : void 0, ref: u, src: p, width: $ ?? n, onClick: (i) => {
|
|
86
|
+
var l;
|
|
87
|
+
i.preventDefault(), m && ((l = i.currentTarget.parentElement) == null || l.focus()), r.dispatchCommand(Tt, {
|
|
88
|
+
key: c,
|
|
89
|
+
soliboDocumentSlot: m,
|
|
90
|
+
src: p,
|
|
91
|
+
width: n
|
|
92
|
+
});
|
|
93
|
+
} }),
|
|
94
|
+
/* @__PURE__ */ o("button", { type: "button", "aria-label": `Resize image${s ? `: ${s}` : ""}`, title: "Drag to resize; use arrow keys to adjust width", className: h["image-resize-handle"], tabIndex: 0, onClick: (i) => {
|
|
95
|
+
i.preventDefault(), i.stopPropagation();
|
|
96
|
+
}, onKeyDown: (i) => {
|
|
97
|
+
var b;
|
|
98
|
+
if (!["ArrowLeft", "ArrowRight", "ArrowUp", "ArrowDown"].includes(i.key)) return;
|
|
99
|
+
i.preventDefault(), i.stopPropagation();
|
|
100
|
+
const l = ((b = u.current) == null ? void 0 : b.getBoundingClientRect().width) ?? n ?? 32;
|
|
101
|
+
w(S(l + (["ArrowRight", "ArrowUp"].includes(i.key) ? 10 : -10)));
|
|
102
|
+
}, onPointerDown: (i) => {
|
|
103
|
+
i.button !== 0 || !u.current || (i.preventDefault(), i.stopPropagation(), i.currentTarget.focus({
|
|
104
|
+
preventScroll: !0
|
|
105
|
+
}), i.currentTarget.setPointerCapture(i.pointerId), f.current = {
|
|
106
|
+
pointerId: i.pointerId,
|
|
107
|
+
x: i.clientX,
|
|
108
|
+
width: u.current.getBoundingClientRect().width,
|
|
109
|
+
maximum: L()
|
|
110
|
+
});
|
|
111
|
+
}, onPointerMove: (i) => {
|
|
112
|
+
const l = f.current;
|
|
113
|
+
!l || l.pointerId !== i.pointerId || A(S(l.width + i.clientX - l.x, l.maximum));
|
|
114
|
+
}, onPointerUp: (i) => {
|
|
115
|
+
const l = f.current;
|
|
116
|
+
!l || l.pointerId !== i.pointerId || (f.current = null, w(S(l.width + i.clientX - l.x, l.maximum)), i.currentTarget.releasePointerCapture(i.pointerId));
|
|
117
|
+
}, onPointerCancel: () => {
|
|
118
|
+
f.current = null, A(void 0);
|
|
119
|
+
}, onLostPointerCapture: () => {
|
|
120
|
+
f.current = null, A(void 0);
|
|
121
|
+
} })
|
|
122
|
+
] });
|
|
123
|
+
}
|
|
124
|
+
const St = Et(), Tt = Et();
|
|
125
|
+
class ot extends ee {
|
|
126
|
+
constructor(e, c, g, m, p, n, u) {
|
|
127
|
+
super(p);
|
|
128
|
+
j(this, "__src");
|
|
129
|
+
j(this, "__alt");
|
|
130
|
+
j(this, "__width");
|
|
131
|
+
j(this, "__height");
|
|
132
|
+
j(this, "__soliboDocumentId");
|
|
133
|
+
j(this, "__soliboDocumentSlot");
|
|
134
|
+
this.__src = e, this.__alt = c, this.__width = g, this.__height = m, this.__soliboDocumentId = n, this.__soliboDocumentSlot = u;
|
|
40
135
|
}
|
|
41
136
|
static getType() {
|
|
42
137
|
return "image";
|
|
43
138
|
}
|
|
44
139
|
static clone(e) {
|
|
45
|
-
return new
|
|
140
|
+
return new ot(e.__src, e.__alt, e.__width, e.__height, e.__key, e.__soliboDocumentId, e.__soliboDocumentSlot);
|
|
46
141
|
}
|
|
47
142
|
static importJSON(e) {
|
|
48
|
-
return
|
|
143
|
+
return dt({
|
|
49
144
|
alt: e.alt,
|
|
50
145
|
height: e.height,
|
|
51
146
|
soliboDocumentId: e.soliboDocumentId,
|
|
@@ -74,21 +169,21 @@ class at extends te {
|
|
|
74
169
|
return {
|
|
75
170
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
76
171
|
img: (e) => ({
|
|
77
|
-
conversion: (
|
|
78
|
-
if (!(
|
|
172
|
+
conversion: (c) => {
|
|
173
|
+
if (!(c instanceof HTMLImageElement))
|
|
79
174
|
return null;
|
|
80
|
-
const
|
|
81
|
-
if (!
|
|
175
|
+
const g = c.getAttribute("src") ?? "";
|
|
176
|
+
if (!g)
|
|
82
177
|
return null;
|
|
83
|
-
const
|
|
178
|
+
const m = c.getAttribute("width"), p = c.getAttribute("height");
|
|
84
179
|
return {
|
|
85
|
-
node:
|
|
86
|
-
alt:
|
|
87
|
-
height:
|
|
88
|
-
soliboDocumentId:
|
|
89
|
-
soliboDocumentSlot:
|
|
90
|
-
src:
|
|
91
|
-
width:
|
|
180
|
+
node: dt({
|
|
181
|
+
alt: c.getAttribute("alt") ?? "",
|
|
182
|
+
height: p ? Number(p) : void 0,
|
|
183
|
+
soliboDocumentId: c.getAttribute("data-solibo-document-id") ?? void 0,
|
|
184
|
+
soliboDocumentSlot: c.getAttribute("data-solibo-document-slot") ?? void 0,
|
|
185
|
+
src: g,
|
|
186
|
+
width: m ? Number(m) : void 0
|
|
92
187
|
})
|
|
93
188
|
};
|
|
94
189
|
},
|
|
@@ -115,58 +210,52 @@ class at extends te {
|
|
|
115
210
|
return this.__src;
|
|
116
211
|
}
|
|
117
212
|
setSrc(e) {
|
|
118
|
-
const
|
|
119
|
-
return
|
|
213
|
+
const c = this.getWritable();
|
|
214
|
+
return c.__src = e, c;
|
|
120
215
|
}
|
|
121
216
|
setWidth(e) {
|
|
122
|
-
const
|
|
123
|
-
return
|
|
217
|
+
const c = this.getWritable();
|
|
218
|
+
return c.__width = e, c.__height = void 0, c;
|
|
124
219
|
}
|
|
125
220
|
decorate(e) {
|
|
126
|
-
return /* @__PURE__ */
|
|
127
|
-
l.preventDefault(), e.dispatchCommand(Tt, {
|
|
128
|
-
key: this.getKey(),
|
|
129
|
-
soliboDocumentSlot: this.__soliboDocumentSlot,
|
|
130
|
-
src: this.__src,
|
|
131
|
-
width: this.__width
|
|
132
|
-
});
|
|
133
|
-
}, src: this.__src, width: this.__width });
|
|
221
|
+
return /* @__PURE__ */ o(Se, { alt: this.__alt, editor: e, height: this.__height, nodeKey: this.getKey(), soliboDocumentId: this.__soliboDocumentId, soliboDocumentSlot: this.__soliboDocumentSlot, src: this.__src, width: this.__width });
|
|
134
222
|
}
|
|
135
223
|
}
|
|
136
|
-
function
|
|
224
|
+
function dt({
|
|
137
225
|
alt: s = "",
|
|
138
226
|
height: r,
|
|
139
227
|
soliboDocumentId: e,
|
|
140
|
-
soliboDocumentSlot:
|
|
141
|
-
src:
|
|
142
|
-
width:
|
|
228
|
+
soliboDocumentSlot: c,
|
|
229
|
+
src: g,
|
|
230
|
+
width: m
|
|
143
231
|
}) {
|
|
144
|
-
return
|
|
232
|
+
return re(new ot(g, s, m, r, void 0, e, c));
|
|
145
233
|
}
|
|
146
|
-
function
|
|
147
|
-
return s instanceof
|
|
234
|
+
function mt(s) {
|
|
235
|
+
return s instanceof ot;
|
|
148
236
|
}
|
|
149
|
-
const
|
|
150
|
-
createImages: s
|
|
237
|
+
const Te = ({
|
|
238
|
+
createImages: s,
|
|
239
|
+
onRemove: r
|
|
151
240
|
}) => {
|
|
152
|
-
const [
|
|
153
|
-
return
|
|
154
|
-
var
|
|
155
|
-
if (!("clipboardData" in
|
|
156
|
-
const
|
|
157
|
-
if (
|
|
158
|
-
const
|
|
159
|
-
return
|
|
241
|
+
const [e] = wt();
|
|
242
|
+
return F(() => e.registerCommand(St, (c) => (r(c), !0), Mt), [e, r]), F(() => e.registerCommand(ie, (c) => {
|
|
243
|
+
var n;
|
|
244
|
+
if (!("clipboardData" in c)) return !1;
|
|
245
|
+
const g = c, m = Array.from(((n = g.clipboardData) == null ? void 0 : n.items) ?? []).flatMap((u) => {
|
|
246
|
+
if (u.kind !== "file" || !u.type.startsWith("image/")) return [];
|
|
247
|
+
const f = u.getAsFile();
|
|
248
|
+
return f ? [f] : [];
|
|
160
249
|
});
|
|
161
|
-
if (
|
|
162
|
-
|
|
163
|
-
const
|
|
164
|
-
return
|
|
165
|
-
|
|
250
|
+
if (m.length === 0) return !1;
|
|
251
|
+
g.preventDefault();
|
|
252
|
+
const p = s(m);
|
|
253
|
+
return e.update(() => {
|
|
254
|
+
Ct(p.map((u) => dt(u)));
|
|
166
255
|
}), !0;
|
|
167
|
-
},
|
|
168
|
-
},
|
|
169
|
-
const r =
|
|
256
|
+
}, Mt), [s, e]), null;
|
|
257
|
+
}, Re = /(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))/, Oe = /((https?:\/\/(www\.)?)|(www\.))[-a-zA-Z0-9@:%._+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_+.~#?&//=]*)/, $e = [(s) => {
|
|
258
|
+
const r = Re.exec(s);
|
|
170
259
|
return r != null && r.length ? {
|
|
171
260
|
index: r.index,
|
|
172
261
|
length: r[0].length,
|
|
@@ -174,7 +263,7 @@ const ge = ({
|
|
|
174
263
|
url: `mailto:${r[0]}`
|
|
175
264
|
} : null;
|
|
176
265
|
}, (s) => {
|
|
177
|
-
const r =
|
|
266
|
+
const r = Oe.exec(s);
|
|
178
267
|
return r != null && r.length ? {
|
|
179
268
|
index: r.index,
|
|
180
269
|
length: r[0].length,
|
|
@@ -182,7 +271,7 @@ const ge = ({
|
|
|
182
271
|
url: r[0].startsWith("http") ? r[0] : `https://${r[0]}`
|
|
183
272
|
} : null;
|
|
184
273
|
}];
|
|
185
|
-
function
|
|
274
|
+
function It(s) {
|
|
186
275
|
try {
|
|
187
276
|
const r = new URL(s);
|
|
188
277
|
return r.protocol === "http:" || r.protocol === "https:";
|
|
@@ -190,442 +279,395 @@ function Ct(s) {
|
|
|
190
279
|
return !1;
|
|
191
280
|
}
|
|
192
281
|
}
|
|
193
|
-
|
|
194
|
-
field: ve,
|
|
195
|
-
editor: De,
|
|
196
|
-
submit: Ie,
|
|
197
|
-
resizable: ke,
|
|
198
|
-
resized: we,
|
|
199
|
-
"resize-handle": "_resize-handle_1clme_64",
|
|
200
|
-
invalid: Le,
|
|
201
|
-
error: Ce,
|
|
202
|
-
dragging: Ae,
|
|
203
|
-
content: Me,
|
|
204
|
-
"has-files": "_has-files_1clme_112",
|
|
205
|
-
files: Se,
|
|
206
|
-
placeholder: Ne,
|
|
207
|
-
fill: Ee,
|
|
208
|
-
"fill-editor": "_fill-editor_1clme_141",
|
|
209
|
-
meta: ye,
|
|
210
|
-
active: xe,
|
|
211
|
-
"image-sizes": "_image-sizes_1clme_182",
|
|
212
|
-
bold: Te,
|
|
213
|
-
italic: Oe,
|
|
214
|
-
underline: Pe,
|
|
215
|
-
link: $e,
|
|
216
|
-
list: Re,
|
|
217
|
-
paragraph: Ue
|
|
218
|
-
};
|
|
219
|
-
function ze({
|
|
282
|
+
function Ue({
|
|
220
283
|
editableRef: s
|
|
221
284
|
}) {
|
|
222
|
-
const r =
|
|
223
|
-
|
|
224
|
-
const
|
|
225
|
-
if (!
|
|
226
|
-
const
|
|
227
|
-
|
|
285
|
+
const r = x(null), [e, c] = k(0), [g, m] = k(0);
|
|
286
|
+
F(() => {
|
|
287
|
+
const n = s.current;
|
|
288
|
+
if (!n) return;
|
|
289
|
+
const u = () => {
|
|
290
|
+
c(Math.round(n.getBoundingClientRect().height)), m(Math.round(parseFloat(getComputedStyle(n).minHeight) || 0));
|
|
228
291
|
};
|
|
229
|
-
if (
|
|
230
|
-
const
|
|
231
|
-
return
|
|
292
|
+
if (u(), typeof ResizeObserver > "u") return;
|
|
293
|
+
const f = new ResizeObserver(u);
|
|
294
|
+
return f.observe(n), () => f.disconnect();
|
|
232
295
|
}, [s]);
|
|
233
|
-
const
|
|
234
|
-
const
|
|
235
|
-
if (!
|
|
236
|
-
const
|
|
237
|
-
|
|
296
|
+
const p = (n) => {
|
|
297
|
+
const u = s.current;
|
|
298
|
+
if (!u) return;
|
|
299
|
+
const f = parseFloat(getComputedStyle(u).minHeight) || 0;
|
|
300
|
+
u.style.height = `${Math.max(f, n)}px`;
|
|
238
301
|
};
|
|
239
|
-
return /* @__PURE__ */
|
|
240
|
-
var
|
|
241
|
-
return (
|
|
242
|
-
}, onKeyDown: (
|
|
243
|
-
const
|
|
244
|
-
|
|
245
|
-
}, onPointerDown: (
|
|
246
|
-
const
|
|
247
|
-
|
|
302
|
+
return /* @__PURE__ */ o("div", { "aria-label": "Resize editor", "aria-orientation": "horizontal", "aria-valuemin": g, "aria-valuenow": e, "aria-valuetext": `${e} pixels`, className: h["resize-handle"], role: "separator", tabIndex: 0, onDoubleClick: () => {
|
|
303
|
+
var n;
|
|
304
|
+
return (n = s.current) == null ? void 0 : n.style.removeProperty("height");
|
|
305
|
+
}, onKeyDown: (n) => {
|
|
306
|
+
const u = s.current;
|
|
307
|
+
u && (n.key === "Home" ? (n.preventDefault(), u.style.removeProperty("height")) : (n.key === "ArrowUp" || n.key === "ArrowDown") && (n.preventDefault(), p(u.getBoundingClientRect().height + (n.key === "ArrowUp" ? 20 : -20))));
|
|
308
|
+
}, onPointerDown: (n) => {
|
|
309
|
+
const u = s.current;
|
|
310
|
+
n.button !== 0 || !u || (n.preventDefault(), n.currentTarget.focus({
|
|
248
311
|
preventScroll: !0
|
|
249
|
-
}),
|
|
250
|
-
pointerId:
|
|
251
|
-
y:
|
|
252
|
-
height:
|
|
312
|
+
}), n.currentTarget.setPointerCapture(n.pointerId), r.current = {
|
|
313
|
+
pointerId: n.pointerId,
|
|
314
|
+
y: n.clientY,
|
|
315
|
+
height: u.getBoundingClientRect().height
|
|
253
316
|
});
|
|
254
|
-
}, onPointerMove: (
|
|
255
|
-
!r.current || r.current.pointerId !==
|
|
256
|
-
}, onPointerUp: (
|
|
257
|
-
!r.current || r.current.pointerId !==
|
|
317
|
+
}, onPointerMove: (n) => {
|
|
318
|
+
!r.current || r.current.pointerId !== n.pointerId || p(r.current.height + r.current.y - n.clientY);
|
|
319
|
+
}, onPointerUp: (n) => {
|
|
320
|
+
!r.current || r.current.pointerId !== n.pointerId || (r.current = null, n.currentTarget.releasePointerCapture(n.pointerId));
|
|
258
321
|
}, onLostPointerCapture: () => {
|
|
259
322
|
r.current = null;
|
|
260
323
|
}, onPointerCancel: () => {
|
|
261
324
|
r.current = null;
|
|
262
325
|
}, "data-component": "editorresizehandle" });
|
|
263
326
|
}
|
|
264
|
-
const
|
|
265
|
-
label: "Small",
|
|
266
|
-
width: 320
|
|
267
|
-
}, {
|
|
268
|
-
label: "Medium",
|
|
269
|
-
width: 640
|
|
270
|
-
}, {
|
|
271
|
-
label: "Large",
|
|
272
|
-
width: 960
|
|
273
|
-
}, {
|
|
274
|
-
label: "Original",
|
|
275
|
-
width: void 0
|
|
276
|
-
}], Be = ({
|
|
327
|
+
const ze = ({
|
|
277
328
|
onFilesSelected: s,
|
|
278
329
|
onInlineImageRemove: r
|
|
279
330
|
}) => {
|
|
280
|
-
const [e] =
|
|
281
|
-
T.current =
|
|
282
|
-
}, []),
|
|
331
|
+
const [e] = wt(), [c, g] = k(!1), [m, p] = k(!1), [n, u] = k(!1), [f, $] = k(!1), [A, L] = k(!1), [S, w] = k(!1), [i, l] = k(""), [b, G] = k(null), [Z, U] = k(null), [z, M] = k(""), Q = It(z.trim()), q = x(null), at = x(null), tt = x(null), T = x(null), E = x(!1), st = (t) => t.preventDefault(), V = C((t) => {
|
|
332
|
+
T.current = bt(t) ? t.clone() : null;
|
|
333
|
+
}, []), X = C((t) => {
|
|
283
334
|
e.update(() => {
|
|
284
|
-
T.current &&
|
|
335
|
+
T.current && Pt(T.current), t();
|
|
285
336
|
}), T.current = null;
|
|
286
|
-
}, [e]),
|
|
287
|
-
|
|
288
|
-
},
|
|
289
|
-
if (
|
|
290
|
-
|
|
337
|
+
}, [e]), lt = (t) => {
|
|
338
|
+
E.current = !0, t.preventDefault();
|
|
339
|
+
}, R = () => {
|
|
340
|
+
if (E.current) {
|
|
341
|
+
E.current = !1;
|
|
291
342
|
return;
|
|
292
343
|
}
|
|
293
|
-
|
|
294
|
-
},
|
|
295
|
-
|
|
296
|
-
}, []),
|
|
297
|
-
|
|
298
|
-
}, []),
|
|
299
|
-
|
|
300
|
-
var
|
|
301
|
-
return (
|
|
344
|
+
Y();
|
|
345
|
+
}, _ = C(() => {
|
|
346
|
+
p(!1), l(""), G(null), U(null);
|
|
347
|
+
}, []), v = C(() => {
|
|
348
|
+
L(!1), M("");
|
|
349
|
+
}, []), W = C((t) => {
|
|
350
|
+
p(!0), l((t == null ? void 0 : t.src) ?? ""), G((t == null ? void 0 : t.key) ?? null), U((t == null ? void 0 : t.soliboDocumentSlot) ?? null), v(), t != null && t.soliboDocumentSlot || setTimeout(() => {
|
|
351
|
+
var a;
|
|
352
|
+
return (a = at.current) == null ? void 0 : a.focus();
|
|
302
353
|
}, 0);
|
|
303
|
-
}, [
|
|
354
|
+
}, [v]), K = C((t) => {
|
|
304
355
|
e.getEditorState().read(() => {
|
|
305
|
-
V(
|
|
306
|
-
}),
|
|
307
|
-
var
|
|
308
|
-
return (
|
|
356
|
+
V(kt());
|
|
357
|
+
}), L(!0), M(t), _(), setTimeout(() => {
|
|
358
|
+
var a;
|
|
359
|
+
return (a = tt.current) == null ? void 0 : a.focus();
|
|
309
360
|
}, 0);
|
|
310
|
-
}, [
|
|
311
|
-
const t =
|
|
312
|
-
|
|
361
|
+
}, [_, e, V]), et = C(() => {
|
|
362
|
+
const t = z.trim();
|
|
363
|
+
It(t) && (X(() => {
|
|
313
364
|
e.dispatchCommand(ft, {
|
|
314
365
|
url: t,
|
|
315
366
|
target: "_blank"
|
|
316
367
|
});
|
|
317
|
-
const
|
|
318
|
-
if (!
|
|
319
|
-
const
|
|
320
|
-
if (
|
|
321
|
-
const H =
|
|
322
|
-
if (
|
|
323
|
-
const
|
|
324
|
-
|
|
368
|
+
const a = kt();
|
|
369
|
+
if (!bt(a)) return;
|
|
370
|
+
const d = a.getNodes().at(-1) ?? null, D = (d == null ? void 0 : d.getParent()) ?? null, I = rt(d) ? d : rt(D) ? D : null;
|
|
371
|
+
if (I) {
|
|
372
|
+
const H = I.getLastChild();
|
|
373
|
+
if (it(H)) {
|
|
374
|
+
const Lt = H.getTextContent(), At = Lt.replace(/\s+$/, "");
|
|
375
|
+
At !== Lt && H.setTextContent(At);
|
|
325
376
|
}
|
|
326
|
-
const
|
|
327
|
-
if (
|
|
328
|
-
|
|
377
|
+
const J = I.getNextSibling();
|
|
378
|
+
if (it(J) && /^\s/.test(J.getTextContent())) {
|
|
379
|
+
J.select(1, 1);
|
|
329
380
|
return;
|
|
330
381
|
}
|
|
331
|
-
const
|
|
332
|
-
|
|
382
|
+
const y = ne(" ");
|
|
383
|
+
I.insertAfter(y), y.selectEnd();
|
|
333
384
|
}
|
|
334
|
-
}),
|
|
335
|
-
}, [
|
|
336
|
-
const t =
|
|
385
|
+
}), v());
|
|
386
|
+
}, [v, e, z, X]), Y = C(() => {
|
|
387
|
+
const t = i.trim();
|
|
337
388
|
if (!t) {
|
|
338
|
-
|
|
389
|
+
_();
|
|
339
390
|
return;
|
|
340
391
|
}
|
|
341
392
|
e.update(() => {
|
|
342
|
-
if (
|
|
343
|
-
const
|
|
344
|
-
|
|
393
|
+
if (b) {
|
|
394
|
+
const a = ut(b);
|
|
395
|
+
mt(a) && a.setSrc(t);
|
|
345
396
|
return;
|
|
346
397
|
}
|
|
347
|
-
|
|
398
|
+
Ct([dt({
|
|
348
399
|
src: t
|
|
349
400
|
})]);
|
|
350
|
-
}),
|
|
351
|
-
}, [
|
|
352
|
-
if (!
|
|
353
|
-
|
|
401
|
+
}), _();
|
|
402
|
+
}, [_, e, b, i]), ht = C(() => {
|
|
403
|
+
if (!b) {
|
|
404
|
+
_();
|
|
354
405
|
return;
|
|
355
406
|
}
|
|
356
407
|
e.update(() => {
|
|
357
|
-
const t =
|
|
358
|
-
if (
|
|
359
|
-
const
|
|
360
|
-
|
|
408
|
+
const t = ut(b);
|
|
409
|
+
if (mt(t)) {
|
|
410
|
+
const a = t.getParent();
|
|
411
|
+
xt(a) && a.getChildrenSize() === 1 ? a.remove() : t.remove(), Z && (r == null || r(Z));
|
|
361
412
|
}
|
|
362
|
-
}),
|
|
363
|
-
}, [
|
|
364
|
-
|
|
365
|
-
const c = It(p);
|
|
366
|
-
Lt(c) && c.setWidth(t);
|
|
367
|
-
}), q(t));
|
|
368
|
-
}, [e, p]), a = b(() => {
|
|
369
|
-
I(() => {
|
|
413
|
+
}), _();
|
|
414
|
+
}, [_, e, b, Z, r]), gt = C(() => {
|
|
415
|
+
X(() => {
|
|
370
416
|
e.dispatchCommand(ft, null);
|
|
371
|
-
}),
|
|
372
|
-
}, [
|
|
373
|
-
const t =
|
|
374
|
-
if (!
|
|
375
|
-
if (
|
|
376
|
-
const
|
|
377
|
-
|
|
378
|
-
const
|
|
379
|
-
if (
|
|
380
|
-
|
|
417
|
+
}), v();
|
|
418
|
+
}, [v, e, X]), B = C(() => {
|
|
419
|
+
const t = kt();
|
|
420
|
+
if (!bt(t)) {
|
|
421
|
+
if (oe(t)) {
|
|
422
|
+
const D = t.getNodes(), I = D[0] ?? null, H = (I == null ? void 0 : I.getParent()) ?? null;
|
|
423
|
+
g(D.some((y) => it(y) && y.hasFormat("bold"))), u(D.some((y) => it(y) && y.hasFormat("italic"))), $(D.some((y) => it(y) && y.hasFormat("underline"))), w(pt(H) || _t(H) || pt(I) || _t(I));
|
|
424
|
+
const J = rt(I) ? I : rt(H) ? H : null;
|
|
425
|
+
if (J) {
|
|
426
|
+
L(!0), M(J.getURL());
|
|
381
427
|
return;
|
|
382
428
|
}
|
|
383
|
-
|
|
429
|
+
L(!1), M(""), T.current = null;
|
|
384
430
|
return;
|
|
385
431
|
}
|
|
386
|
-
|
|
432
|
+
g(!1), u(!1), $(!1), w(!1), L(!1), M(""), T.current = null;
|
|
387
433
|
return;
|
|
388
434
|
}
|
|
389
|
-
const [
|
|
390
|
-
if (
|
|
391
|
-
|
|
435
|
+
const [a] = t.getNodes(), d = (a == null ? void 0 : a.getParent()) ?? null;
|
|
436
|
+
if (g(t.hasFormat("bold")), u(t.hasFormat("italic")), $(t.hasFormat("underline")), w(pt(d) || _t(d)), rt(d)) {
|
|
437
|
+
L(!0), M(d.getURL()), V(t);
|
|
392
438
|
return;
|
|
393
439
|
}
|
|
394
|
-
|
|
440
|
+
L(!1), M(""), T.current = null;
|
|
395
441
|
}, [V]);
|
|
396
|
-
return
|
|
442
|
+
return F(() => de(e.registerUpdateListener(({
|
|
397
443
|
editorState: t
|
|
398
444
|
}) => {
|
|
399
445
|
t.read(() => {
|
|
400
|
-
|
|
446
|
+
B();
|
|
401
447
|
});
|
|
402
|
-
}), e.registerCommand(Tt, (t) => (
|
|
403
|
-
|
|
404
|
-
}), !1),
|
|
405
|
-
/* @__PURE__ */
|
|
406
|
-
e.dispatchCommand(
|
|
407
|
-
}, title: "Bold", variant: "tertiary", children: /* @__PURE__ */
|
|
408
|
-
/* @__PURE__ */
|
|
409
|
-
e.dispatchCommand(
|
|
410
|
-
}, title: "Italic", variant: "tertiary", children: /* @__PURE__ */
|
|
411
|
-
/* @__PURE__ */
|
|
412
|
-
e.dispatchCommand(
|
|
413
|
-
}, title: "Underline", variant: "tertiary", children: /* @__PURE__ */
|
|
414
|
-
/* @__PURE__ */
|
|
415
|
-
|
|
416
|
-
}, title: "List", variant: "tertiary", children: /* @__PURE__ */
|
|
417
|
-
/* @__PURE__ */
|
|
418
|
-
|
|
448
|
+
}), e.registerCommand(Tt, (t) => (t.soliboDocumentSlot ? (_(), v()) : W(t), !0), yt), e.registerCommand(ae, () => (e.getEditorState().read(() => {
|
|
449
|
+
B();
|
|
450
|
+
}), !1), yt)), [_, v, e, W, B]), /* @__PURE__ */ O(me, { variant: "editor", "data-component": "editortoolbar", children: [
|
|
451
|
+
/* @__PURE__ */ o(N, { "aria-label": "Bold", "data-active": c, onClick: () => {
|
|
452
|
+
e.dispatchCommand(Dt, "bold");
|
|
453
|
+
}, title: "Bold", variant: "tertiary", children: /* @__PURE__ */ o(P, { name: "TextB" }) }),
|
|
454
|
+
/* @__PURE__ */ o(N, { "aria-label": "Italic", "data-active": n, onClick: () => {
|
|
455
|
+
e.dispatchCommand(Dt, "italic");
|
|
456
|
+
}, title: "Italic", variant: "tertiary", children: /* @__PURE__ */ o(P, { name: "TextItalic" }) }),
|
|
457
|
+
/* @__PURE__ */ o(N, { "aria-label": "Underline", "data-active": f, onClick: () => {
|
|
458
|
+
e.dispatchCommand(Dt, "underline");
|
|
459
|
+
}, title: "Underline", variant: "tertiary", children: /* @__PURE__ */ o(P, { name: "TextUnderline" }) }),
|
|
460
|
+
/* @__PURE__ */ o(N, { "aria-label": "List", "data-active": S, onClick: () => {
|
|
461
|
+
S ? e.dispatchCommand(Ht, void 0) : e.dispatchCommand(Ft, void 0);
|
|
462
|
+
}, title: "List", variant: "tertiary", children: /* @__PURE__ */ o(P, { name: "ListBullets" }) }),
|
|
463
|
+
/* @__PURE__ */ o(N, { "aria-label": "Link", "data-active": A, onClick: () => {
|
|
464
|
+
A ? K(z) : (e.dispatchCommand(ft, {
|
|
419
465
|
url: "https://"
|
|
420
|
-
}),
|
|
421
|
-
}, title: "Link", variant: "tertiary", children: /* @__PURE__ */
|
|
422
|
-
s && /* @__PURE__ */
|
|
423
|
-
/* @__PURE__ */
|
|
466
|
+
}), K("https://"));
|
|
467
|
+
}, title: "Link", variant: "tertiary", children: /* @__PURE__ */ o(P, { name: "Link" }) }),
|
|
468
|
+
s && /* @__PURE__ */ O(ct, { children: [
|
|
469
|
+
/* @__PURE__ */ o("input", { hidden: !0, multiple: !0, onChange: (t) => {
|
|
424
470
|
t.target.files && s(t.target.files), t.target.value = "";
|
|
425
|
-
}, ref:
|
|
426
|
-
/* @__PURE__ */
|
|
471
|
+
}, ref: q, type: "file" }),
|
|
472
|
+
/* @__PURE__ */ o(N, { "aria-label": "Upload files", onClick: () => {
|
|
427
473
|
var t;
|
|
428
|
-
return (t =
|
|
429
|
-
}, title: "Upload files", variant: "tertiary", children: /* @__PURE__ */
|
|
474
|
+
return (t = q.current) == null ? void 0 : t.click();
|
|
475
|
+
}, title: "Upload files", variant: "tertiary", children: /* @__PURE__ */ o(P, { name: "Paperclip" }) })
|
|
430
476
|
] }),
|
|
431
|
-
/* @__PURE__ */
|
|
432
|
-
|
|
433
|
-
/* @__PURE__ */
|
|
434
|
-
t.key === "Enter" && (t.preventDefault(),
|
|
435
|
-
}, ref:
|
|
436
|
-
/* @__PURE__ */
|
|
437
|
-
|
|
438
|
-
}, onMouseDown:
|
|
439
|
-
/* @__PURE__ */
|
|
477
|
+
/* @__PURE__ */ O("div", { className: nt(h.meta, A || m ? h.active : ""), children: [
|
|
478
|
+
A && /* @__PURE__ */ O(ct, { children: [
|
|
479
|
+
/* @__PURE__ */ o(Nt, { "aria-invalid": !Q, onBlur: () => et(), onChange: (t) => M(t.target.value), onKeyDown: (t) => {
|
|
480
|
+
t.key === "Enter" && (t.preventDefault(), et());
|
|
481
|
+
}, ref: tt, value: z }),
|
|
482
|
+
/* @__PURE__ */ o(N, { "aria-label": "Apply link", disabled: !Q, onClick: () => {
|
|
483
|
+
et();
|
|
484
|
+
}, onMouseDown: st, variant: "tertiary", children: /* @__PURE__ */ o(P, { name: "Check" }) }),
|
|
485
|
+
/* @__PURE__ */ o(N, { "aria-label": "Remove link", onClick: () => gt(), onMouseDown: st, variant: "tertiary", children: /* @__PURE__ */ o(P, { name: "Trash", variant: "danger" }) })
|
|
440
486
|
] }),
|
|
441
|
-
|
|
442
|
-
!Z && /* @__PURE__ */
|
|
443
|
-
/* @__PURE__ */
|
|
444
|
-
t.key === "Enter" && (t.preventDefault(),
|
|
445
|
-
}, ref:
|
|
446
|
-
/* @__PURE__ */
|
|
487
|
+
m && /* @__PURE__ */ O(ct, { children: [
|
|
488
|
+
!Z && /* @__PURE__ */ O(ct, { children: [
|
|
489
|
+
/* @__PURE__ */ o(Nt, { className: nt(h.active), onBlur: R, onChange: (t) => l(t.target.value), onKeyDown: (t) => {
|
|
490
|
+
t.key === "Enter" && (t.preventDefault(), E.current = !0, Y());
|
|
491
|
+
}, ref: at, value: i }),
|
|
492
|
+
/* @__PURE__ */ o(N, { "aria-label": "Apply image", onClick: () => Y(), onMouseDown: lt, variant: "tertiary", children: /* @__PURE__ */ o(P, { name: "Check" }) })
|
|
447
493
|
] }),
|
|
448
|
-
/* @__PURE__ */
|
|
449
|
-
label: t,
|
|
450
|
-
width: c
|
|
451
|
-
}) => /* @__PURE__ */ n(L, { "aria-label": `${t} image`, "data-active": ct === c, onClick: () => i(c), onMouseDown: rt, variant: "tertiary", children: t }, t)) }),
|
|
452
|
-
/* @__PURE__ */ n(L, { "aria-label": "Remove image", onClick: () => J(), onMouseDown: k, variant: "tertiary", children: /* @__PURE__ */ n(y, { name: "Trash", variant: "danger" }) })
|
|
494
|
+
/* @__PURE__ */ o(N, { "aria-label": "Remove image", onClick: () => ht(), onMouseDown: lt, variant: "tertiary", children: /* @__PURE__ */ o(P, { name: "Trash", variant: "danger" }) })
|
|
453
495
|
] })
|
|
454
496
|
] })
|
|
455
497
|
] });
|
|
456
|
-
},
|
|
498
|
+
}, Be = se({
|
|
457
499
|
name: "solibo-editor",
|
|
458
500
|
namespace: "Editor",
|
|
459
|
-
nodes: [
|
|
501
|
+
nodes: [zt, Bt, Wt, Kt, ot],
|
|
460
502
|
onError(s) {
|
|
461
503
|
throw s;
|
|
462
504
|
},
|
|
463
505
|
theme: {
|
|
464
|
-
link:
|
|
506
|
+
link: h.link,
|
|
465
507
|
list: {
|
|
466
|
-
ol:
|
|
467
|
-
ul:
|
|
508
|
+
ol: h.list,
|
|
509
|
+
ul: h.list
|
|
468
510
|
},
|
|
469
|
-
paragraph:
|
|
511
|
+
paragraph: h.paragraph,
|
|
470
512
|
text: {
|
|
471
|
-
bold:
|
|
472
|
-
italic:
|
|
473
|
-
underline:
|
|
513
|
+
bold: h.bold,
|
|
514
|
+
italic: h.italic,
|
|
515
|
+
underline: h.underline
|
|
474
516
|
}
|
|
475
517
|
}
|
|
476
518
|
});
|
|
477
|
-
function
|
|
519
|
+
function He({
|
|
478
520
|
autofocus: s,
|
|
479
521
|
content: r = "",
|
|
480
522
|
lastEmittedContentRef: e
|
|
481
523
|
}) {
|
|
482
|
-
const [
|
|
483
|
-
return
|
|
484
|
-
e.current !== r &&
|
|
485
|
-
const
|
|
486
|
-
|
|
524
|
+
const [c] = wt();
|
|
525
|
+
return F(() => {
|
|
526
|
+
e.current !== r && c.update(() => {
|
|
527
|
+
const m = new DOMParser().parseFromString(r, "text/html"), p = Ut(c, m), n = le();
|
|
528
|
+
n.clear().select(), Ct(p), s ? n.selectEnd() : Pt(null);
|
|
487
529
|
});
|
|
488
|
-
}, [s, r,
|
|
530
|
+
}, [s, r, c, e]), null;
|
|
489
531
|
}
|
|
490
|
-
const
|
|
532
|
+
const gr = ({
|
|
491
533
|
autofocus: s = !1,
|
|
492
534
|
autolink: r = !1,
|
|
493
535
|
content: e,
|
|
494
|
-
disabled:
|
|
495
|
-
errorMessage:
|
|
496
|
-
fill:
|
|
497
|
-
files:
|
|
498
|
-
inline:
|
|
499
|
-
inlineImages:
|
|
500
|
-
invalid:
|
|
501
|
-
isSubmitting:
|
|
502
|
-
maxRows:
|
|
503
|
-
minRows:
|
|
504
|
-
onChange:
|
|
505
|
-
onFilesChange:
|
|
506
|
-
onInlineImagesChange:
|
|
507
|
-
onSubmit:
|
|
508
|
-
onUpload:
|
|
536
|
+
disabled: c = !1,
|
|
537
|
+
errorMessage: g,
|
|
538
|
+
fill: m = !1,
|
|
539
|
+
files: p,
|
|
540
|
+
inline: n = !1,
|
|
541
|
+
inlineImages: u,
|
|
542
|
+
invalid: f = !1,
|
|
543
|
+
isSubmitting: $ = !1,
|
|
544
|
+
maxRows: A = 12,
|
|
545
|
+
minRows: L = 1,
|
|
546
|
+
onChange: S,
|
|
547
|
+
onFilesChange: w,
|
|
548
|
+
onInlineImagesChange: i,
|
|
549
|
+
onSubmit: l,
|
|
550
|
+
onUpload: b,
|
|
509
551
|
placeholder: G,
|
|
510
552
|
required: Z = !1,
|
|
511
|
-
resizable:
|
|
512
|
-
submitLabel:
|
|
553
|
+
resizable: U = !1,
|
|
554
|
+
submitLabel: z = "Submit"
|
|
513
555
|
}) => {
|
|
514
|
-
const
|
|
515
|
-
|
|
516
|
-
const
|
|
517
|
-
if (!
|
|
518
|
-
if (
|
|
519
|
-
|
|
556
|
+
const M = ce(), Q = x(void 0), q = x(null), [at, tt] = k(!1), [T, E] = k(!1), [st, V] = k([]), [X, lt] = k([]), R = x(/* @__PURE__ */ new Map()), _ = p ?? st, v = u ?? X;
|
|
557
|
+
F(() => {
|
|
558
|
+
const t = q.current;
|
|
559
|
+
if (!t) return;
|
|
560
|
+
if (!U || m) {
|
|
561
|
+
t.style.removeProperty("height"), tt(!1);
|
|
520
562
|
return;
|
|
521
563
|
}
|
|
522
|
-
const a = () =>
|
|
523
|
-
return
|
|
564
|
+
const a = () => tt(t.style.height !== ""), d = new MutationObserver(a);
|
|
565
|
+
return d.observe(t, {
|
|
524
566
|
attributes: !0,
|
|
525
567
|
attributeFilter: ["style"]
|
|
526
|
-
}), a(), () =>
|
|
527
|
-
}, [
|
|
528
|
-
const
|
|
529
|
-
|
|
530
|
-
},
|
|
531
|
-
|
|
532
|
-
}, [
|
|
533
|
-
const a =
|
|
534
|
-
const
|
|
535
|
-
return
|
|
568
|
+
}), a(), () => d.disconnect();
|
|
569
|
+
}, [m, U]);
|
|
570
|
+
const W = (t) => {
|
|
571
|
+
p === void 0 && V(t), w == null || w(t);
|
|
572
|
+
}, K = C((t) => {
|
|
573
|
+
u === void 0 && lt(t), i == null || i(t);
|
|
574
|
+
}, [u, i]), et = C((t) => {
|
|
575
|
+
const a = t.map((d) => {
|
|
576
|
+
const D = `pasted-${crypto.randomUUID()}`, I = URL.createObjectURL(d);
|
|
577
|
+
return R.current.set(D, I), {
|
|
536
578
|
image: {
|
|
537
|
-
alt:
|
|
538
|
-
soliboDocumentSlot:
|
|
539
|
-
src:
|
|
579
|
+
alt: d.name,
|
|
580
|
+
soliboDocumentSlot: D,
|
|
581
|
+
src: I
|
|
540
582
|
},
|
|
541
583
|
pending: {
|
|
542
|
-
file:
|
|
543
|
-
slot:
|
|
584
|
+
file: d,
|
|
585
|
+
slot: D
|
|
544
586
|
}
|
|
545
587
|
};
|
|
546
588
|
});
|
|
547
|
-
return
|
|
548
|
-
pending:
|
|
549
|
-
}) =>
|
|
550
|
-
image:
|
|
551
|
-
}) =>
|
|
552
|
-
}, [
|
|
553
|
-
|
|
554
|
-
const a =
|
|
555
|
-
a && URL.revokeObjectURL(a),
|
|
556
|
-
}, [
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
}, []),
|
|
560
|
-
const
|
|
561
|
-
|
|
562
|
-
|
|
589
|
+
return K([...v, ...a.map(({
|
|
590
|
+
pending: d
|
|
591
|
+
}) => d)]), a.map(({
|
|
592
|
+
image: d
|
|
593
|
+
}) => d);
|
|
594
|
+
}, [v, K]), Y = C((t) => {
|
|
595
|
+
K(v.filter((d) => d.slot !== t));
|
|
596
|
+
const a = R.current.get(t);
|
|
597
|
+
a && URL.revokeObjectURL(a), R.current.delete(t);
|
|
598
|
+
}, [v, K]);
|
|
599
|
+
F(() => () => {
|
|
600
|
+
R.current.forEach((t) => URL.revokeObjectURL(t)), R.current.clear();
|
|
601
|
+
}, []), F(() => {
|
|
602
|
+
const t = new Set(v.map((a) => a.slot));
|
|
603
|
+
R.current.forEach((a, d) => {
|
|
604
|
+
t.has(d) || (URL.revokeObjectURL(a), R.current.delete(d));
|
|
563
605
|
});
|
|
564
|
-
}, [
|
|
565
|
-
const
|
|
606
|
+
}, [v]);
|
|
607
|
+
const ht = (t) => {
|
|
566
608
|
if (typeof DataTransfer < "u") {
|
|
567
609
|
const a = new DataTransfer();
|
|
568
|
-
return
|
|
610
|
+
return t.forEach((d) => a.items.add(d)), a.files;
|
|
569
611
|
}
|
|
570
|
-
return Object.assign([...
|
|
571
|
-
item: (a) =>
|
|
612
|
+
return Object.assign([...t], {
|
|
613
|
+
item: (a) => t[a] ?? null
|
|
572
614
|
});
|
|
573
|
-
},
|
|
615
|
+
}, gt = async () => {
|
|
574
616
|
try {
|
|
575
|
-
|
|
617
|
+
_.length > 0 && await (b == null ? void 0 : b(ht(_))), await (l == null ? void 0 : l()), _.length > 0 && W([]);
|
|
576
618
|
} catch {
|
|
577
619
|
return;
|
|
578
620
|
}
|
|
579
|
-
},
|
|
580
|
-
|
|
621
|
+
}, B = (t) => {
|
|
622
|
+
t.preventDefault(), t.stopPropagation();
|
|
581
623
|
};
|
|
582
|
-
return /* @__PURE__ */
|
|
583
|
-
|
|
584
|
-
}, onDragOver: (
|
|
585
|
-
|
|
586
|
-
}, onDragLeave: (
|
|
587
|
-
|
|
588
|
-
}, onDropCapture: (
|
|
589
|
-
var
|
|
590
|
-
const a = (
|
|
591
|
-
a != null && a.length && (
|
|
592
|
-
}, onDrop: (
|
|
593
|
-
|
|
624
|
+
return /* @__PURE__ */ O("div", { className: nt(h.field, m && h.fill), "data-max-rows": A, "data-min-rows": L, onDragEnter: (t) => {
|
|
625
|
+
B(t), E(!!w);
|
|
626
|
+
}, onDragOver: (t) => {
|
|
627
|
+
B(t), E(!!w);
|
|
628
|
+
}, onDragLeave: (t) => {
|
|
629
|
+
B(t), E(!1);
|
|
630
|
+
}, onDropCapture: (t) => {
|
|
631
|
+
var d;
|
|
632
|
+
const a = (d = t.dataTransfer) == null ? void 0 : d.files;
|
|
633
|
+
a != null && a.length && (B(t), (w || b) && W([..._, ...Array.from(a)]), E(!1));
|
|
634
|
+
}, onDrop: (t) => {
|
|
635
|
+
t.preventDefault(), E(!1);
|
|
594
636
|
}, "data-component": "editor", children: [
|
|
595
|
-
|
|
596
|
-
/* @__PURE__ */
|
|
597
|
-
"--editor-max-height": `calc(${
|
|
598
|
-
"--editor-min-height": `calc(${
|
|
599
|
-
}, children: /* @__PURE__ */
|
|
600
|
-
!
|
|
601
|
-
|
|
637
|
+
U === "top" && !m && /* @__PURE__ */ o(Ue, { editableRef: q }),
|
|
638
|
+
/* @__PURE__ */ o("div", { className: nt(h.editor, m && h["fill-editor"], U === !0 && !m && h.resizable, U && !m && at && h.resized, f && h.invalid, _.length > 0 && h["has-files"]), style: {
|
|
639
|
+
"--editor-max-height": `calc(${A * 1.25}em + (2 * var(--scale-8)))`,
|
|
640
|
+
"--editor-min-height": `calc(${L * 1.25}em + (2 * var(--scale-8)))`
|
|
641
|
+
}, children: /* @__PURE__ */ O(Vt, { contentEditable: null, extension: Be, children: [
|
|
642
|
+
!n && /* @__PURE__ */ o(ze, { onInlineImageRemove: Y, onFilesSelected: b || w ? (t) => {
|
|
643
|
+
W([..._, ...Array.from(t)]);
|
|
602
644
|
} : void 0 }),
|
|
603
|
-
/* @__PURE__ */
|
|
604
|
-
!
|
|
605
|
-
|
|
606
|
-
s && /* @__PURE__ */
|
|
607
|
-
r && /* @__PURE__ */
|
|
608
|
-
/* @__PURE__ */
|
|
609
|
-
|
|
610
|
-
e !== void 0 && /* @__PURE__ */
|
|
611
|
-
/* @__PURE__ */
|
|
612
|
-
/* @__PURE__ */
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
const
|
|
645
|
+
/* @__PURE__ */ o("div", { className: nt(h.content, T && h.dragging), children: /* @__PURE__ */ o(te, { contentEditable: /* @__PURE__ */ o(Zt, { ref: q, "aria-placeholder": G ?? "", ariaErrorMessage: f && g ? M : void 0, ariaInvalid: f || void 0, ariaRequired: Z || void 0, placeholder: () => G ? /* @__PURE__ */ o("div", { className: h.placeholder, children: G }) : null }), ErrorBoundary: qt }) }),
|
|
646
|
+
!n && l && /* @__PURE__ */ o("div", { className: h.submit, children: /* @__PURE__ */ o(N, { "aria-label": z, "data-cy": "toolbar-submit-button", disabled: c, icon: "PaperPlaneTilt", isLoading: $, onClick: () => void gt(), variant: "primary", children: /* @__PURE__ */ o("span", { children: z }) }) }),
|
|
647
|
+
_.length > 0 && /* @__PURE__ */ o("div", { "aria-label": "Files to upload", className: h.files, role: "region", children: _.map((t, a) => /* @__PURE__ */ o(ue, { deleteAccessibleLabel: `Remove ${t.name} from upload queue`, name: t.name, onDelete: () => W(_.filter((d, D) => D !== a)) }, `${t.name}-${t.size}-${t.lastModified}-${a}`)) }),
|
|
648
|
+
s && /* @__PURE__ */ o(jt, {}),
|
|
649
|
+
r && /* @__PURE__ */ o(Gt, { matchers: $e }),
|
|
650
|
+
/* @__PURE__ */ o(Xt, {}),
|
|
651
|
+
i && /* @__PURE__ */ o(Te, { createImages: et, onRemove: Y }),
|
|
652
|
+
e !== void 0 && /* @__PURE__ */ o(He, { autofocus: s, content: e, lastEmittedContentRef: Q }),
|
|
653
|
+
/* @__PURE__ */ o(Yt, { validateUrl: It }),
|
|
654
|
+
/* @__PURE__ */ o(Jt, {}),
|
|
655
|
+
S && /* @__PURE__ */ o(Qt, { onChange: (t, a) => {
|
|
656
|
+
t.read(() => {
|
|
657
|
+
const d = $t(a, null), D = vt(d, {
|
|
616
658
|
allowedAttributes: {
|
|
617
|
-
...
|
|
618
|
-
img: [...
|
|
659
|
+
...vt.defaults.allowedAttributes,
|
|
660
|
+
img: [...vt.defaults.allowedAttributes.img ?? [], "data-solibo-document-id", "data-solibo-document-slot"]
|
|
619
661
|
},
|
|
620
662
|
allowedTags: ["a", "b", "br", "i", "img", "li", "ol", "p", "u", "ul"]
|
|
621
663
|
});
|
|
622
|
-
|
|
664
|
+
Q.current = D, S(D);
|
|
623
665
|
});
|
|
624
666
|
} })
|
|
625
667
|
] }) }),
|
|
626
|
-
|
|
668
|
+
f && g && /* @__PURE__ */ o("div", { className: h.error, id: M, children: g })
|
|
627
669
|
] });
|
|
628
670
|
};
|
|
629
671
|
export {
|
|
630
|
-
|
|
672
|
+
gr as Editor
|
|
631
673
|
};
|