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