@solibo/solibo-ui 2.2.13 → 2.2.14
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/index.css +1 -1
- package/dist/assets/index10.css +1 -1
- package/dist/assets/index11.css +1 -1
- package/dist/assets/index12.css +1 -1
- package/dist/assets/index13.css +1 -1
- package/dist/assets/index14.css +1 -1
- package/dist/assets/index15.css +1 -1
- package/dist/assets/index16.css +1 -1
- package/dist/assets/index17.css +1 -1
- package/dist/assets/index18.css +1 -1
- package/dist/assets/index19.css +1 -1
- package/dist/assets/index20.css +1 -1
- package/dist/assets/index21.css +1 -1
- package/dist/assets/index22.css +1 -1
- package/dist/assets/index23.css +1 -1
- package/dist/assets/index24.css +1 -1
- package/dist/assets/index25.css +1 -1
- package/dist/assets/index26.css +1 -1
- package/dist/assets/index27.css +1 -1
- package/dist/assets/index28.css +1 -1
- package/dist/assets/index29.css +1 -1
- package/dist/assets/index3.css +1 -1
- package/dist/assets/index30.css +1 -1
- package/dist/assets/index31.css +1 -1
- package/dist/assets/index32.css +1 -1
- package/dist/assets/index33.css +1 -1
- package/dist/assets/index34.css +1 -1
- package/dist/assets/index35.css +1 -1
- package/dist/assets/index36.css +1 -1
- package/dist/assets/index37.css +1 -1
- package/dist/assets/index38.css +1 -1
- package/dist/assets/index39.css +1 -1
- package/dist/assets/index40.css +1 -1
- package/dist/assets/index41.css +1 -1
- package/dist/assets/index42.css +1 -1
- package/dist/assets/index43.css +1 -1
- package/dist/assets/index44.css +1 -1
- package/dist/assets/index45.css +1 -1
- package/dist/assets/index46.css +1 -1
- package/dist/assets/index47.css +1 -1
- package/dist/assets/index48.css +1 -1
- package/dist/assets/index49.css +1 -1
- package/dist/assets/index50.css +1 -1
- package/dist/assets/index51.css +1 -1
- package/dist/assets/index52.css +1 -1
- package/dist/assets/index53.css +1 -1
- package/dist/assets/index54.css +1 -1
- package/dist/assets/index55.css +1 -1
- package/dist/assets/index56.css +1 -1
- package/dist/assets/index57.css +1 -1
- package/dist/assets/index58.css +1 -1
- package/dist/assets/index59.css +1 -0
- package/dist/assets/index6.css +1 -1
- package/dist/assets/index60.css +1 -0
- package/dist/components/app-link/index.cjs +1 -1
- package/dist/components/app-link/index.js +9 -9
- package/dist/components/app-shell/index.cjs +1 -1
- package/dist/components/app-shell/index.js +1 -1
- package/dist/components/aside/index.cjs +1 -1
- package/dist/components/aside/index.js +1 -1
- package/dist/components/avatar/index.cjs +1 -1
- package/dist/components/avatar/index.js +38 -39
- package/dist/components/badge/index.cjs +1 -1
- package/dist/components/badge/index.js +1 -1
- package/dist/components/banner/index.cjs +1 -1
- package/dist/components/banner/index.js +1 -1
- package/dist/components/branding/index.cjs +1 -1
- package/dist/components/branding/index.js +1 -1
- package/dist/components/button/index.cjs +1 -1
- package/dist/components/button/index.js +1 -1
- package/dist/components/card/index.cjs +1 -1
- package/dist/components/card/index.js +49 -49
- package/dist/components/checkbox/index.cjs +1 -1
- package/dist/components/checkbox/index.js +23 -17
- package/dist/components/chip/index.cjs +1 -1
- package/dist/components/chip/index.js +1 -1
- package/dist/components/clipboard/index.cjs +1 -1
- package/dist/components/clipboard/index.js +1 -1
- package/dist/components/collapsible/index.cjs +1 -1
- package/dist/components/collapsible/index.js +1 -1
- package/dist/components/comment/index.cjs +1 -1
- package/dist/components/comment/index.js +1 -1
- package/dist/components/comments/index.cjs +1 -1
- package/dist/components/comments/index.js +2 -2
- package/dist/components/controls/index.cjs +1 -1
- package/dist/components/controls/index.js +1 -1
- package/dist/components/croppable/index.cjs +1 -1
- package/dist/components/croppable/index.js +152 -152
- package/dist/components/dialog/index.cjs +1 -1
- package/dist/components/dialog/index.js +1 -1
- package/dist/components/divider/index.cjs +1 -1
- package/dist/components/divider/index.js +1 -1
- package/dist/components/dropdown/index.cjs +1 -1
- package/dist/components/dropdown/index.js +3 -3
- package/dist/components/dropzone/index.cjs +1 -1
- package/dist/components/dropzone/index.js +1 -1
- package/dist/components/editor/index.cjs +1 -1
- package/dist/components/editor/index.js +237 -234
- package/dist/components/empty-state/index.cjs +1 -1
- package/dist/components/empty-state/index.js +1 -1
- package/dist/components/fieldset/index.cjs +1 -1
- package/dist/components/fieldset/index.js +1 -1
- package/dist/components/figure/index.cjs +1 -1
- package/dist/components/figure/index.js +1 -1
- package/dist/components/file/index.cjs +1 -1
- package/dist/components/file/index.js +1 -1
- package/dist/components/footer/index.cjs +1 -1
- package/dist/components/footer/index.js +1 -1
- package/dist/components/form/index.cjs +1 -1
- package/dist/components/form/index.js +21 -12
- package/dist/components/graph/index.cjs +1 -1
- package/dist/components/graph/index.js +1 -1
- package/dist/components/group/index.cjs +1 -1
- package/dist/components/group/index.js +1 -1
- package/dist/components/header/index.cjs +1 -1
- package/dist/components/header/index.js +1 -1
- package/dist/components/icon/index.cjs +1 -1
- package/dist/components/icon/index.js +1 -1
- package/dist/components/iframe/index.cjs +1 -1
- package/dist/components/iframe/index.js +2 -2
- package/dist/components/image/index.cjs +1 -1
- package/dist/components/image/index.js +1 -1
- package/dist/components/input/index.cjs +1 -1
- package/dist/components/input/index.js +4 -2
- package/dist/components/label/index.cjs +1 -0
- package/dist/components/label/index.js +18 -0
- package/dist/components/link/index.cjs +1 -1
- package/dist/components/link/index.js +1 -1
- package/dist/components/list/index.cjs +1 -1
- package/dist/components/list/index.js +1 -1
- package/dist/components/loading/index.cjs +1 -1
- package/dist/components/loading/index.js +1 -1
- package/dist/components/message/index.cjs +1 -1
- package/dist/components/message/index.js +2 -2
- package/dist/components/messages/index.cjs +1 -1
- package/dist/components/messages/index.js +2 -2
- package/dist/components/nav/index.cjs +1 -1
- package/dist/components/nav/index.js +1 -1
- package/dist/components/object/index.cjs +1 -1
- package/dist/components/object/index.js +1 -1
- package/dist/components/page-layout/index.cjs +1 -1
- package/dist/components/page-layout/index.js +1 -1
- package/dist/components/panel/index.cjs +1 -1
- package/dist/components/panel/index.js +1 -1
- package/dist/components/popover/index.cjs +1 -1
- package/dist/components/popover/index.js +1 -1
- package/dist/components/portal/index.cjs +1 -1
- package/dist/components/portal/index.js +1 -1
- package/dist/components/radio/index.cjs +1 -0
- package/dist/components/radio/index.js +35 -0
- package/dist/components/search/index.cjs +1 -1
- package/dist/components/search/index.js +2 -2
- package/dist/components/select/index.cjs +1 -1
- package/dist/components/select/index.js +3 -2
- package/dist/components/textarea/index.cjs +1 -1
- package/dist/components/textarea/index.js +30 -29
- package/dist/components/toggle/index.cjs +1 -1
- package/dist/components/toggle/index.js +16 -16
- package/dist/components/toolbar/index.cjs +1 -1
- package/dist/components/toolbar/index.js +8 -9
- package/dist/components/tooltip/index.cjs +1 -1
- package/dist/components/tooltip/index.js +1 -1
- package/dist/{index-DqZSdMHT.cjs → index-B4dFheLl.cjs} +1 -1
- package/dist/{index-KGoXYG8u.js → index-BJiUk1q2.js} +2 -2
- package/dist/index-BQoXmNo3.cjs +1 -0
- package/dist/index-Bre56YYa.js +90 -0
- package/dist/{index-Bl5EEYDv.cjs → index-BwfsmdF6.cjs} +1 -1
- package/dist/index-CHJNMNDr.cjs +1 -0
- package/dist/index-GPsHvb4d.js +74 -0
- package/dist/{index-DQuc_Zkg.js → index-acMNM3VJ.js} +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +30 -7
- package/dist/index.js +74 -70
- package/dist/tokens.css +79 -38
- package/dist/tokens.json +627 -257
- package/package.json +1 -1
- package/dist/index-FSKjg3Z8.js +0 -82
- package/dist/index-HVXauXrX.js +0 -73
- package/dist/index-S1XsOUKE.cjs +0 -1
- package/dist/index-riaH5c_S.cjs +0 -1
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import '../../assets/
|
|
2
|
-
var
|
|
3
|
-
var J = (
|
|
4
|
-
import { jsxs as
|
|
5
|
-
import { $generateHtmlFromNodes as
|
|
6
|
-
import { TOGGLE_LINK_COMMAND as _t, $isLinkNode as st, AutoLinkNode as
|
|
1
|
+
import '../../assets/index43.css';var Rt = Object.defineProperty;
|
|
2
|
+
var Ot = (a, e, t) => e in a ? Rt(a, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : a[e] = t;
|
|
3
|
+
var J = (a, e, t) => Ot(a, typeof e != "symbol" ? e + "" : e, t);
|
|
4
|
+
import { jsxs as U, jsx as s, Fragment as ht } from "react/jsx-runtime";
|
|
5
|
+
import { $generateHtmlFromNodes as $t, $generateNodesFromDOM as Ut } from "@lexical/html";
|
|
6
|
+
import { TOGGLE_LINK_COMMAND as _t, $isLinkNode as st, AutoLinkNode as zt, LinkNode as Ht } from "@lexical/link";
|
|
7
7
|
import { $isListNode as bt, $isListItemNode as Dt, REMOVE_LIST_COMMAND as Bt, INSERT_UNORDERED_LIST_COMMAND as Ft, ListNode as Wt, ListItemNode as jt } from "@lexical/list";
|
|
8
8
|
import { AutoFocusPlugin as Kt } from "@lexical/react/LexicalAutoFocusPlugin";
|
|
9
9
|
import { AutoLinkPlugin as Gt } from "@lexical/react/LexicalAutoLinkPlugin";
|
|
10
|
-
import { useLexicalComposerContext as
|
|
10
|
+
import { useLexicalComposerContext as Ct } from "@lexical/react/LexicalComposerContext";
|
|
11
11
|
import { ContentEditable as qt } from "@lexical/react/LexicalContentEditable";
|
|
12
12
|
import { LexicalErrorBoundary as Yt } from "@lexical/react/LexicalErrorBoundary";
|
|
13
13
|
import { LexicalExtensionComposer as Zt } from "@lexical/react/LexicalExtensionComposer";
|
|
@@ -16,47 +16,47 @@ import { LinkPlugin as Xt } from "@lexical/react/LexicalLinkPlugin";
|
|
|
16
16
|
import { ListPlugin as Jt } from "@lexical/react/LexicalListPlugin";
|
|
17
17
|
import { OnChangePlugin as Qt } from "@lexical/react/LexicalOnChangePlugin";
|
|
18
18
|
import { RichTextPlugin as te } from "@lexical/react/LexicalRichTextPlugin";
|
|
19
|
-
import
|
|
20
|
-
import { $getNodeByKey as gt, $isParagraphNode as
|
|
21
|
-
import { useRef as
|
|
22
|
-
import
|
|
23
|
-
import { Button as
|
|
19
|
+
import lt from "classix";
|
|
20
|
+
import { $getNodeByKey as gt, $isParagraphNode as Nt, DecoratorNode as ee, $applyNodeReplacement as re, createCommand as St, COMMAND_PRIORITY_HIGH as At, PASTE_COMMAND as ie, $insertNodes as kt, $isRangeSelection as vt, $setSelection as Pt, $getSelection as It, $isTextNode as at, $createTextNode as ne, $isNodeSelection as oe, COMMAND_PRIORITY_LOW as Lt, SELECTION_CHANGE_COMMAND as se, FORMAT_TEXT_COMMAND as yt, defineExtension as ae, $getRoot as le, CLEAR_HISTORY_COMMAND as ce } from "lexical";
|
|
21
|
+
import { useRef as k, useState as y, useEffect as Z, useCallback as x, useId as ue } from "react";
|
|
22
|
+
import wt from "sanitize-html";
|
|
23
|
+
import { Button as T } from "../button/index.js";
|
|
24
24
|
import { File as de } from "../file/index.js";
|
|
25
|
+
import { Icon as E } from "../icon/index.js";
|
|
25
26
|
import { mergeRegister as me } from "@lexical/utils";
|
|
26
|
-
import {
|
|
27
|
-
import { I as Nt } from "../../index-FSKjg3Z8.js";
|
|
27
|
+
import { I as Mt } from "../../index-Bre56YYa.js";
|
|
28
28
|
import { Toolbar as he } from "../toolbar/index.js";
|
|
29
|
-
const ge = "
|
|
29
|
+
const ge = "_field_x93yd_3", fe = "_editor_x93yd_8", pe = "_submit_x93yd_23", _e = "_resizable_x93yd_68", be = "_resized_x93yd_72", De = "_invalid_x93yd_98", ve = "_error_x93yd_102", Ie = "_dragging_x93yd_108", ye = "_content_x93yd_112", we = "_embedded_x93yd_124", xe = "_files_x93yd_144", Ce = "_placeholder_x93yd_154", ke = "_fill_x93yd_162", Ae = "_meta_x93yd_194", Le = "_active_x93yd_203", Me = "_bold_x93yd_272", Ne = "_italic_x93yd_276", Se = "_underline_x93yd_280", Pe = "_link_x93yd_284", Te = "_list_x93yd_290", Ee = "_paragraph_x93yd_291", g = {
|
|
30
30
|
field: ge,
|
|
31
31
|
editor: fe,
|
|
32
32
|
submit: pe,
|
|
33
|
-
"image-resize-handle": "_image-resize-
|
|
34
|
-
"with-controls": "_with-
|
|
33
|
+
"image-resize-handle": "_image-resize-handle_x93yd_47",
|
|
34
|
+
"with-controls": "_with-controls_x93yd_53",
|
|
35
35
|
resizable: _e,
|
|
36
36
|
resized: be,
|
|
37
|
-
"resize-handle": "_resize-
|
|
37
|
+
"resize-handle": "_resize-handle_x93yd_76",
|
|
38
38
|
invalid: De,
|
|
39
39
|
error: ve,
|
|
40
40
|
dragging: Ie,
|
|
41
|
-
content:
|
|
42
|
-
embedded:
|
|
43
|
-
"has-files": "_has-
|
|
44
|
-
files:
|
|
45
|
-
placeholder:
|
|
46
|
-
fill:
|
|
47
|
-
"fill-editor": "_fill-
|
|
48
|
-
meta:
|
|
49
|
-
active:
|
|
50
|
-
"inline-image": "_inline-
|
|
51
|
-
bold:
|
|
52
|
-
italic:
|
|
53
|
-
underline:
|
|
54
|
-
link:
|
|
55
|
-
list:
|
|
56
|
-
paragraph:
|
|
41
|
+
content: ye,
|
|
42
|
+
embedded: we,
|
|
43
|
+
"has-files": "_has-files_x93yd_140",
|
|
44
|
+
files: xe,
|
|
45
|
+
placeholder: Ce,
|
|
46
|
+
fill: ke,
|
|
47
|
+
"fill-editor": "_fill-editor_x93yd_170",
|
|
48
|
+
meta: Ae,
|
|
49
|
+
active: Le,
|
|
50
|
+
"inline-image": "_inline-image_x93yd_215",
|
|
51
|
+
bold: Me,
|
|
52
|
+
italic: Ne,
|
|
53
|
+
underline: Se,
|
|
54
|
+
link: Pe,
|
|
55
|
+
list: Te,
|
|
56
|
+
paragraph: Ee
|
|
57
57
|
};
|
|
58
|
-
function
|
|
59
|
-
alt:
|
|
58
|
+
function Re({
|
|
59
|
+
alt: a = "",
|
|
60
60
|
editor: e,
|
|
61
61
|
height: t,
|
|
62
62
|
nodeKey: c,
|
|
@@ -65,67 +65,67 @@ function Ee({
|
|
|
65
65
|
src: b,
|
|
66
66
|
width: n
|
|
67
67
|
}) {
|
|
68
|
-
const
|
|
68
|
+
const l = k(null), p = k(null), [S, w] = y(), v = () => {
|
|
69
69
|
const o = e.getRootElement();
|
|
70
70
|
if (!o) return 1 / 0;
|
|
71
71
|
const u = getComputedStyle(o);
|
|
72
72
|
return Math.max(1, o.clientWidth - (parseFloat(u.paddingLeft) || 0) - (parseFloat(u.paddingRight) || 0));
|
|
73
|
-
},
|
|
73
|
+
}, A = (o, u = v()) => Math.round(Math.min(u, Math.max(Math.min(32, u), o))), z = (o) => {
|
|
74
74
|
e.update(() => {
|
|
75
75
|
const u = gt(c);
|
|
76
76
|
pt(u) && u.setWidth(o);
|
|
77
|
-
}),
|
|
77
|
+
}), w(void 0);
|
|
78
78
|
};
|
|
79
|
-
return /* @__PURE__ */
|
|
79
|
+
return /* @__PURE__ */ U("span", { className: g["inline-image"], contentEditable: !1, tabIndex: h ? 0 : void 0, onKeyDown: (o) => {
|
|
80
80
|
!h || o.target !== o.currentTarget || !["Backspace", "Delete"].includes(o.key) || (o.preventDefault(), o.stopPropagation(), e.update(() => {
|
|
81
81
|
const u = gt(c);
|
|
82
82
|
if (!pt(u)) return;
|
|
83
83
|
const D = u.getParent();
|
|
84
|
-
|
|
84
|
+
Nt(D) && D.getChildrenSize() === 1 ? D.remove() : u.remove(), e.dispatchCommand(Tt, h);
|
|
85
85
|
}), e.focus());
|
|
86
86
|
}, "data-component": "editorimage", children: [
|
|
87
|
-
/* @__PURE__ */ s("img", { alt:
|
|
87
|
+
/* @__PURE__ */ s("img", { alt: a, "data-solibo-document-id": f, "data-solibo-document-slot": h, draggable: !1, height: S === void 0 ? t : void 0, ref: l, src: b, width: S ?? n, onClick: (o) => {
|
|
88
88
|
var u;
|
|
89
|
-
o.preventDefault(), h && ((u = o.currentTarget.parentElement) == null || u.focus()), e.dispatchCommand(
|
|
89
|
+
o.preventDefault(), h && ((u = o.currentTarget.parentElement) == null || u.focus()), e.dispatchCommand(Et, {
|
|
90
90
|
key: c,
|
|
91
91
|
soliboDocumentSlot: h,
|
|
92
92
|
src: b,
|
|
93
93
|
width: n
|
|
94
94
|
});
|
|
95
95
|
} }),
|
|
96
|
-
/* @__PURE__ */ s("button", { type: "button", "aria-label": `Resize image${
|
|
96
|
+
/* @__PURE__ */ s("button", { type: "button", "aria-label": `Resize image${a ? `: ${a}` : ""}`, title: "Drag to resize; use arrow keys to adjust width", className: g["image-resize-handle"], tabIndex: 0, onClick: (o) => {
|
|
97
97
|
o.preventDefault(), o.stopPropagation();
|
|
98
98
|
}, onKeyDown: (o) => {
|
|
99
99
|
var D;
|
|
100
100
|
if (!["ArrowLeft", "ArrowRight", "ArrowUp", "ArrowDown"].includes(o.key)) return;
|
|
101
101
|
o.preventDefault(), o.stopPropagation();
|
|
102
|
-
const u = ((D =
|
|
103
|
-
|
|
102
|
+
const u = ((D = l.current) == null ? void 0 : D.getBoundingClientRect().width) ?? n ?? 32;
|
|
103
|
+
z(A(u + (["ArrowRight", "ArrowUp"].includes(o.key) ? 10 : -10)));
|
|
104
104
|
}, onPointerDown: (o) => {
|
|
105
|
-
o.button !== 0 || !
|
|
105
|
+
o.button !== 0 || !l.current || (o.preventDefault(), o.stopPropagation(), o.currentTarget.focus({
|
|
106
106
|
preventScroll: !0
|
|
107
107
|
}), o.currentTarget.setPointerCapture(o.pointerId), p.current = {
|
|
108
108
|
pointerId: o.pointerId,
|
|
109
109
|
x: o.clientX,
|
|
110
|
-
width:
|
|
110
|
+
width: l.current.getBoundingClientRect().width,
|
|
111
111
|
maximum: v()
|
|
112
112
|
});
|
|
113
113
|
}, onPointerMove: (o) => {
|
|
114
114
|
const u = p.current;
|
|
115
|
-
!u || u.pointerId !== o.pointerId ||
|
|
115
|
+
!u || u.pointerId !== o.pointerId || w(A(u.width + o.clientX - u.x, u.maximum));
|
|
116
116
|
}, onPointerUp: (o) => {
|
|
117
117
|
const u = p.current;
|
|
118
|
-
!u || u.pointerId !== o.pointerId || (p.current = null,
|
|
118
|
+
!u || u.pointerId !== o.pointerId || (p.current = null, z(A(u.width + o.clientX - u.x, u.maximum)), o.currentTarget.releasePointerCapture(o.pointerId));
|
|
119
119
|
}, onPointerCancel: () => {
|
|
120
|
-
p.current = null,
|
|
120
|
+
p.current = null, w(void 0);
|
|
121
121
|
}, onLostPointerCapture: () => {
|
|
122
|
-
p.current = null,
|
|
122
|
+
p.current = null, w(void 0);
|
|
123
123
|
} })
|
|
124
124
|
] });
|
|
125
125
|
}
|
|
126
|
-
const
|
|
126
|
+
const Tt = St(), Et = St();
|
|
127
127
|
class ct extends ee {
|
|
128
|
-
constructor(t, c, f, h, b, n,
|
|
128
|
+
constructor(t, c, f, h, b, n, l) {
|
|
129
129
|
super(b);
|
|
130
130
|
J(this, "__src");
|
|
131
131
|
J(this, "__alt");
|
|
@@ -133,7 +133,7 @@ class ct extends ee {
|
|
|
133
133
|
J(this, "__height");
|
|
134
134
|
J(this, "__soliboDocumentId");
|
|
135
135
|
J(this, "__soliboDocumentSlot");
|
|
136
|
-
this.__src = t, this.__alt = c, this.__width = f, this.__height = h, this.__soliboDocumentId = n, this.__soliboDocumentSlot =
|
|
136
|
+
this.__src = t, this.__alt = c, this.__width = f, this.__height = h, this.__soliboDocumentId = n, this.__soliboDocumentSlot = l;
|
|
137
137
|
}
|
|
138
138
|
static getType() {
|
|
139
139
|
return "image";
|
|
@@ -220,52 +220,52 @@ class ct extends ee {
|
|
|
220
220
|
return c.__width = t, c.__height = void 0, c;
|
|
221
221
|
}
|
|
222
222
|
decorate(t) {
|
|
223
|
-
return /* @__PURE__ */ s(
|
|
223
|
+
return /* @__PURE__ */ s(Re, { alt: this.__alt, editor: t, height: this.__height, nodeKey: this.getKey(), soliboDocumentId: this.__soliboDocumentId, soliboDocumentSlot: this.__soliboDocumentSlot, src: this.__src, width: this.__width });
|
|
224
224
|
}
|
|
225
225
|
}
|
|
226
226
|
function ft({
|
|
227
|
-
alt:
|
|
227
|
+
alt: a = "",
|
|
228
228
|
height: e,
|
|
229
229
|
soliboDocumentId: t,
|
|
230
230
|
soliboDocumentSlot: c,
|
|
231
231
|
src: f,
|
|
232
232
|
width: h
|
|
233
233
|
}) {
|
|
234
|
-
return re(new ct(f,
|
|
234
|
+
return re(new ct(f, a, h, e, void 0, t, c));
|
|
235
235
|
}
|
|
236
|
-
function pt(
|
|
237
|
-
return
|
|
236
|
+
function pt(a) {
|
|
237
|
+
return a instanceof ct;
|
|
238
238
|
}
|
|
239
|
-
const
|
|
240
|
-
createImages:
|
|
239
|
+
const Oe = ({
|
|
240
|
+
createImages: a,
|
|
241
241
|
onRemove: e
|
|
242
242
|
}) => {
|
|
243
|
-
const [t] =
|
|
244
|
-
return Z(() => t.registerCommand(
|
|
243
|
+
const [t] = Ct();
|
|
244
|
+
return Z(() => t.registerCommand(Tt, (c) => (e(c), !0), At), [t, e]), Z(() => t.registerCommand(ie, (c) => {
|
|
245
245
|
var n;
|
|
246
246
|
if (!("clipboardData" in c)) return !1;
|
|
247
|
-
const f = c, h = Array.from(((n = f.clipboardData) == null ? void 0 : n.items) ?? []).flatMap((
|
|
248
|
-
if (
|
|
249
|
-
const p =
|
|
247
|
+
const f = c, h = Array.from(((n = f.clipboardData) == null ? void 0 : n.items) ?? []).flatMap((l) => {
|
|
248
|
+
if (l.kind !== "file" || !l.type.startsWith("image/")) return [];
|
|
249
|
+
const p = l.getAsFile();
|
|
250
250
|
return p ? [p] : [];
|
|
251
251
|
});
|
|
252
252
|
if (h.length === 0) return !1;
|
|
253
253
|
f.preventDefault();
|
|
254
|
-
const b =
|
|
254
|
+
const b = a(h);
|
|
255
255
|
return t.update(() => {
|
|
256
|
-
|
|
256
|
+
kt(b.map((l) => ft(l)));
|
|
257
257
|
}), !0;
|
|
258
|
-
},
|
|
259
|
-
},
|
|
260
|
-
const e =
|
|
258
|
+
}, At), [a, t]), null;
|
|
259
|
+
}, $e = /(([^<>()[\]\\.,;:\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,}))/, Ue = /((https?:\/\/(www\.)?)|(www\.))[-a-zA-Z0-9@:%._+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_+.~#?&//=]*)/, ze = [(a) => {
|
|
260
|
+
const e = $e.exec(a);
|
|
261
261
|
return e != null && e.length ? {
|
|
262
262
|
index: e.index,
|
|
263
263
|
length: e[0].length,
|
|
264
264
|
text: e[0],
|
|
265
265
|
url: `mailto:${e[0]}`
|
|
266
266
|
} : null;
|
|
267
|
-
}, (
|
|
268
|
-
const e =
|
|
267
|
+
}, (a) => {
|
|
268
|
+
const e = Ue.exec(a);
|
|
269
269
|
return e != null && e.length ? {
|
|
270
270
|
index: e.index,
|
|
271
271
|
length: e[0].length,
|
|
@@ -273,48 +273,48 @@ const Re = ({
|
|
|
273
273
|
url: e[0].startsWith("http") ? e[0] : `https://${e[0]}`
|
|
274
274
|
} : null;
|
|
275
275
|
}];
|
|
276
|
-
function
|
|
276
|
+
function xt(a) {
|
|
277
277
|
try {
|
|
278
|
-
const e = new URL(
|
|
278
|
+
const e = new URL(a);
|
|
279
279
|
return e.protocol === "http:" || e.protocol === "https:";
|
|
280
280
|
} catch {
|
|
281
281
|
return !1;
|
|
282
282
|
}
|
|
283
283
|
}
|
|
284
284
|
function He({
|
|
285
|
-
editableRef:
|
|
285
|
+
editableRef: a
|
|
286
286
|
}) {
|
|
287
|
-
const e =
|
|
287
|
+
const e = k(null), [t, c] = y(0), [f, h] = y(0);
|
|
288
288
|
Z(() => {
|
|
289
|
-
const n =
|
|
289
|
+
const n = a.current;
|
|
290
290
|
if (!n) return;
|
|
291
|
-
const
|
|
291
|
+
const l = () => {
|
|
292
292
|
c(Math.round(n.getBoundingClientRect().height)), h(Math.round(parseFloat(getComputedStyle(n).minHeight) || 0));
|
|
293
293
|
};
|
|
294
|
-
if (
|
|
295
|
-
const p = new ResizeObserver(
|
|
294
|
+
if (l(), typeof ResizeObserver > "u") return;
|
|
295
|
+
const p = new ResizeObserver(l);
|
|
296
296
|
return p.observe(n), () => p.disconnect();
|
|
297
|
-
}, [
|
|
297
|
+
}, [a]);
|
|
298
298
|
const b = (n) => {
|
|
299
|
-
const
|
|
300
|
-
if (!
|
|
301
|
-
const p = parseFloat(getComputedStyle(
|
|
302
|
-
|
|
299
|
+
const l = a.current;
|
|
300
|
+
if (!l) return;
|
|
301
|
+
const p = parseFloat(getComputedStyle(l).minHeight) || 0;
|
|
302
|
+
l.style.height = `${Math.max(p, n)}px`;
|
|
303
303
|
};
|
|
304
304
|
return /* @__PURE__ */ s("div", { "aria-label": "Resize editor", "aria-orientation": "horizontal", "aria-valuemin": f, "aria-valuenow": t, "aria-valuetext": `${t} pixels`, className: g["resize-handle"], role: "separator", tabIndex: 0, onDoubleClick: () => {
|
|
305
305
|
var n;
|
|
306
|
-
return (n =
|
|
306
|
+
return (n = a.current) == null ? void 0 : n.style.removeProperty("height");
|
|
307
307
|
}, onKeyDown: (n) => {
|
|
308
|
-
const
|
|
309
|
-
|
|
308
|
+
const l = a.current;
|
|
309
|
+
l && (n.key === "Home" ? (n.preventDefault(), l.style.removeProperty("height")) : (n.key === "ArrowUp" || n.key === "ArrowDown") && (n.preventDefault(), b(l.getBoundingClientRect().height + (n.key === "ArrowUp" ? 20 : -20))));
|
|
310
310
|
}, onPointerDown: (n) => {
|
|
311
|
-
const
|
|
312
|
-
n.button !== 0 || !
|
|
311
|
+
const l = a.current;
|
|
312
|
+
n.button !== 0 || !l || (n.preventDefault(), n.currentTarget.focus({
|
|
313
313
|
preventScroll: !0
|
|
314
314
|
}), n.currentTarget.setPointerCapture(n.pointerId), e.current = {
|
|
315
315
|
pointerId: n.pointerId,
|
|
316
316
|
y: n.clientY,
|
|
317
|
-
height:
|
|
317
|
+
height: l.getBoundingClientRect().height
|
|
318
318
|
});
|
|
319
319
|
}, onPointerMove: (n) => {
|
|
320
320
|
!e.current || e.current.pointerId !== n.pointerId || b(e.current.height + e.current.y - n.clientY);
|
|
@@ -327,15 +327,15 @@ function He({
|
|
|
327
327
|
}, "data-component": "editorresizehandle" });
|
|
328
328
|
}
|
|
329
329
|
const Be = ({
|
|
330
|
-
onFilesSelected:
|
|
330
|
+
onFilesSelected: a,
|
|
331
331
|
onInlineImageRemove: e
|
|
332
332
|
}) => {
|
|
333
|
-
const [t] =
|
|
334
|
-
|
|
335
|
-
}, []), V =
|
|
333
|
+
const [t] = Ct(), [c, f] = y(!1), [h, b] = y(!1), [n, l] = y(!1), [p, S] = y(!1), [w, v] = y(!1), [A, z] = y(!1), [o, u] = y(""), [D, W] = y(null), [H, j] = y(null), [B, R] = y(""), K = xt(B.trim()), it = k(null), Q = k(null), nt = k(null), O = k(null), G = k(!1), tt = (r) => r.preventDefault(), et = x((r) => {
|
|
334
|
+
O.current = vt(r) ? r.clone() : null;
|
|
335
|
+
}, []), V = x((r) => {
|
|
336
336
|
t.update(() => {
|
|
337
|
-
|
|
338
|
-
}),
|
|
337
|
+
O.current && Pt(O.current), r();
|
|
338
|
+
}), O.current = null;
|
|
339
339
|
}, [t]), ut = (r) => {
|
|
340
340
|
G.current = !0, r.preventDefault();
|
|
341
341
|
}, X = () => {
|
|
@@ -343,52 +343,52 @@ const Be = ({
|
|
|
343
343
|
G.current = !1;
|
|
344
344
|
return;
|
|
345
345
|
}
|
|
346
|
-
|
|
347
|
-
},
|
|
346
|
+
C();
|
|
347
|
+
}, L = x(() => {
|
|
348
348
|
b(!1), u(""), W(null), j(null);
|
|
349
|
-
}, []),
|
|
350
|
-
v(!1),
|
|
351
|
-
}, []), dt =
|
|
352
|
-
b(!0), u((r == null ? void 0 : r.src) ?? ""), W((r == null ? void 0 : r.key) ?? null), j((r == null ? void 0 : r.soliboDocumentSlot) ?? null),
|
|
349
|
+
}, []), $ = x(() => {
|
|
350
|
+
v(!1), R("");
|
|
351
|
+
}, []), dt = x((r) => {
|
|
352
|
+
b(!0), u((r == null ? void 0 : r.src) ?? ""), W((r == null ? void 0 : r.key) ?? null), j((r == null ? void 0 : r.soliboDocumentSlot) ?? null), $(), r != null && r.soliboDocumentSlot || setTimeout(() => {
|
|
353
353
|
var _;
|
|
354
354
|
return (_ = Q.current) == null ? void 0 : _.focus();
|
|
355
355
|
}, 0);
|
|
356
|
-
}, [
|
|
356
|
+
}, [$]), mt = x((r) => {
|
|
357
357
|
t.getEditorState().read(() => {
|
|
358
358
|
et(It());
|
|
359
|
-
}), v(!0),
|
|
359
|
+
}), v(!0), R(r), L(), setTimeout(() => {
|
|
360
360
|
var _;
|
|
361
361
|
return (_ = nt.current) == null ? void 0 : _.focus();
|
|
362
362
|
}, 0);
|
|
363
|
-
}, [
|
|
364
|
-
const r =
|
|
365
|
-
|
|
363
|
+
}, [L, t, et]), M = x(() => {
|
|
364
|
+
const r = B.trim();
|
|
365
|
+
xt(r) && (V(() => {
|
|
366
366
|
t.dispatchCommand(_t, {
|
|
367
367
|
url: r,
|
|
368
368
|
target: "_blank"
|
|
369
369
|
});
|
|
370
370
|
const _ = It();
|
|
371
371
|
if (!vt(_)) return;
|
|
372
|
-
const
|
|
372
|
+
const N = _.getNodes().at(-1) ?? null, F = (N == null ? void 0 : N.getParent()) ?? null, I = st(N) ? N : st(F) ? F : null;
|
|
373
373
|
if (I) {
|
|
374
374
|
const i = I.getLastChild();
|
|
375
|
-
if (
|
|
376
|
-
const
|
|
377
|
-
ot !==
|
|
375
|
+
if (at(i)) {
|
|
376
|
+
const P = i.getTextContent(), ot = P.replace(/\s+$/, "");
|
|
377
|
+
ot !== P && i.setTextContent(ot);
|
|
378
378
|
}
|
|
379
379
|
const m = I.getNextSibling();
|
|
380
|
-
if (
|
|
380
|
+
if (at(m) && /^\s/.test(m.getTextContent())) {
|
|
381
381
|
m.select(1, 1);
|
|
382
382
|
return;
|
|
383
383
|
}
|
|
384
384
|
const d = ne(" ");
|
|
385
385
|
I.insertAfter(d), d.selectEnd();
|
|
386
386
|
}
|
|
387
|
-
}),
|
|
388
|
-
}, [
|
|
387
|
+
}), $());
|
|
388
|
+
}, [$, t, B, V]), C = x(() => {
|
|
389
389
|
const r = o.trim();
|
|
390
390
|
if (!r) {
|
|
391
|
-
|
|
391
|
+
L();
|
|
392
392
|
return;
|
|
393
393
|
}
|
|
394
394
|
t.update(() => {
|
|
@@ -397,49 +397,49 @@ const Be = ({
|
|
|
397
397
|
pt(_) && _.setSrc(r);
|
|
398
398
|
return;
|
|
399
399
|
}
|
|
400
|
-
|
|
400
|
+
kt([ft({
|
|
401
401
|
src: r
|
|
402
402
|
})]);
|
|
403
|
-
}),
|
|
404
|
-
}, [
|
|
403
|
+
}), L();
|
|
404
|
+
}, [L, t, D, o]), q = x(() => {
|
|
405
405
|
if (!D) {
|
|
406
|
-
|
|
406
|
+
L();
|
|
407
407
|
return;
|
|
408
408
|
}
|
|
409
409
|
t.update(() => {
|
|
410
410
|
const r = gt(D);
|
|
411
411
|
if (pt(r)) {
|
|
412
412
|
const _ = r.getParent();
|
|
413
|
-
|
|
413
|
+
Nt(_) && _.getChildrenSize() === 1 ? _.remove() : r.remove(), H && (e == null || e(H));
|
|
414
414
|
}
|
|
415
|
-
}),
|
|
416
|
-
}, [
|
|
415
|
+
}), L();
|
|
416
|
+
}, [L, t, D, H, e]), rt = x(() => {
|
|
417
417
|
V(() => {
|
|
418
418
|
t.dispatchCommand(_t, null);
|
|
419
|
-
}),
|
|
420
|
-
}, [
|
|
419
|
+
}), $();
|
|
420
|
+
}, [$, t, V]), Y = x(() => {
|
|
421
421
|
const r = It();
|
|
422
422
|
if (!vt(r)) {
|
|
423
423
|
if (oe(r)) {
|
|
424
|
-
const
|
|
425
|
-
f(
|
|
424
|
+
const F = r.getNodes(), I = F[0] ?? null, i = (I == null ? void 0 : I.getParent()) ?? null;
|
|
425
|
+
f(F.some((d) => at(d) && d.hasFormat("bold"))), l(F.some((d) => at(d) && d.hasFormat("italic"))), S(F.some((d) => at(d) && d.hasFormat("underline"))), z(bt(i) || Dt(i) || bt(I) || Dt(I));
|
|
426
426
|
const m = st(I) ? I : st(i) ? i : null;
|
|
427
427
|
if (m) {
|
|
428
|
-
v(!0),
|
|
428
|
+
v(!0), R(m.getURL());
|
|
429
429
|
return;
|
|
430
430
|
}
|
|
431
|
-
v(!1),
|
|
431
|
+
v(!1), R(""), O.current = null;
|
|
432
432
|
return;
|
|
433
433
|
}
|
|
434
|
-
f(!1),
|
|
434
|
+
f(!1), l(!1), S(!1), z(!1), v(!1), R(""), O.current = null;
|
|
435
435
|
return;
|
|
436
436
|
}
|
|
437
|
-
const [_] = r.getNodes(),
|
|
438
|
-
if (f(r.hasFormat("bold")),
|
|
439
|
-
v(!0),
|
|
437
|
+
const [_] = r.getNodes(), N = (_ == null ? void 0 : _.getParent()) ?? null;
|
|
438
|
+
if (f(r.hasFormat("bold")), l(r.hasFormat("italic")), S(r.hasFormat("underline")), z(bt(N) || Dt(N)), st(N)) {
|
|
439
|
+
v(!0), R(N.getURL()), et(r);
|
|
440
440
|
return;
|
|
441
441
|
}
|
|
442
|
-
v(!1),
|
|
442
|
+
v(!1), R(""), O.current = null;
|
|
443
443
|
}, [et]);
|
|
444
444
|
return Z(() => me(t.registerUpdateListener(({
|
|
445
445
|
editorState: r
|
|
@@ -447,62 +447,62 @@ const Be = ({
|
|
|
447
447
|
r.read(() => {
|
|
448
448
|
Y();
|
|
449
449
|
});
|
|
450
|
-
}), t.registerCommand(
|
|
450
|
+
}), t.registerCommand(Et, (r) => (r.soliboDocumentSlot ? (L(), $()) : dt(r), !0), Lt), t.registerCommand(se, () => (t.getEditorState().read(() => {
|
|
451
451
|
Y();
|
|
452
|
-
}), !1),
|
|
453
|
-
/* @__PURE__ */ s(
|
|
454
|
-
t.dispatchCommand(
|
|
455
|
-
}, title: "Bold", variant: "tertiary", children: /* @__PURE__ */ s(
|
|
456
|
-
/* @__PURE__ */ s(
|
|
457
|
-
t.dispatchCommand(
|
|
458
|
-
}, title: "Italic", variant: "tertiary", children: /* @__PURE__ */ s(
|
|
459
|
-
/* @__PURE__ */ s(
|
|
460
|
-
t.dispatchCommand(
|
|
461
|
-
}, title: "Underline", variant: "tertiary", children: /* @__PURE__ */ s(
|
|
462
|
-
/* @__PURE__ */ s(
|
|
463
|
-
|
|
464
|
-
}, title: "List", variant: "tertiary", children: /* @__PURE__ */ s(
|
|
465
|
-
/* @__PURE__ */ s(
|
|
466
|
-
|
|
452
|
+
}), !1), Lt)), [L, $, t, dt, Y]), /* @__PURE__ */ U(he, { variant: "editor", "data-component": "editortoolbar", children: [
|
|
453
|
+
/* @__PURE__ */ s(T, { "aria-label": "Bold", "data-active": c, onClick: () => {
|
|
454
|
+
t.dispatchCommand(yt, "bold");
|
|
455
|
+
}, title: "Bold", variant: "tertiary", children: /* @__PURE__ */ s(E, { name: "TextB" }) }),
|
|
456
|
+
/* @__PURE__ */ s(T, { "aria-label": "Italic", "data-active": n, onClick: () => {
|
|
457
|
+
t.dispatchCommand(yt, "italic");
|
|
458
|
+
}, title: "Italic", variant: "tertiary", children: /* @__PURE__ */ s(E, { name: "TextItalic" }) }),
|
|
459
|
+
/* @__PURE__ */ s(T, { "aria-label": "Underline", "data-active": p, onClick: () => {
|
|
460
|
+
t.dispatchCommand(yt, "underline");
|
|
461
|
+
}, title: "Underline", variant: "tertiary", children: /* @__PURE__ */ s(E, { name: "TextUnderline" }) }),
|
|
462
|
+
/* @__PURE__ */ s(T, { "aria-label": "List", "data-active": A, onClick: () => {
|
|
463
|
+
A ? t.dispatchCommand(Bt, void 0) : t.dispatchCommand(Ft, void 0);
|
|
464
|
+
}, title: "List", variant: "tertiary", children: /* @__PURE__ */ s(E, { name: "ListBullets" }) }),
|
|
465
|
+
/* @__PURE__ */ s(T, { "aria-label": "Link", "data-active": w, onClick: () => {
|
|
466
|
+
w ? mt(B) : (t.dispatchCommand(_t, {
|
|
467
467
|
url: "https://"
|
|
468
468
|
}), mt("https://"));
|
|
469
|
-
}, title: "Link", variant: "tertiary", children: /* @__PURE__ */ s(
|
|
470
|
-
|
|
469
|
+
}, title: "Link", variant: "tertiary", children: /* @__PURE__ */ s(E, { name: "Link" }) }),
|
|
470
|
+
a && /* @__PURE__ */ U(ht, { children: [
|
|
471
471
|
/* @__PURE__ */ s("input", { hidden: !0, multiple: !0, onChange: (r) => {
|
|
472
|
-
r.target.files &&
|
|
472
|
+
r.target.files && a(r.target.files), r.target.value = "";
|
|
473
473
|
}, ref: it, type: "file" }),
|
|
474
|
-
/* @__PURE__ */ s(
|
|
474
|
+
/* @__PURE__ */ s(T, { "aria-label": "Upload files", onClick: () => {
|
|
475
475
|
var r;
|
|
476
476
|
return (r = it.current) == null ? void 0 : r.click();
|
|
477
|
-
}, title: "Upload files", variant: "tertiary", children: /* @__PURE__ */ s(
|
|
477
|
+
}, title: "Upload files", variant: "tertiary", children: /* @__PURE__ */ s(E, { name: "Paperclip" }) })
|
|
478
478
|
] }),
|
|
479
|
-
/* @__PURE__ */
|
|
480
|
-
|
|
481
|
-
/* @__PURE__ */ s(
|
|
482
|
-
r.key === "Enter" && (r.preventDefault(),
|
|
483
|
-
}, ref: nt, value:
|
|
484
|
-
/* @__PURE__ */ s(
|
|
485
|
-
|
|
486
|
-
}, onMouseDown: tt, variant: "tertiary", children: /* @__PURE__ */ s(
|
|
487
|
-
/* @__PURE__ */ s(
|
|
479
|
+
/* @__PURE__ */ U("div", { className: lt(g.meta, w || h ? g.active : ""), children: [
|
|
480
|
+
w && /* @__PURE__ */ U(ht, { children: [
|
|
481
|
+
/* @__PURE__ */ s(Mt, { "aria-invalid": !K, onBlur: () => M(), onChange: (r) => R(r.target.value), onKeyDown: (r) => {
|
|
482
|
+
r.key === "Enter" && (r.preventDefault(), M());
|
|
483
|
+
}, ref: nt, value: B }),
|
|
484
|
+
/* @__PURE__ */ s(T, { "aria-label": "Apply link", disabled: !K, onClick: () => {
|
|
485
|
+
M();
|
|
486
|
+
}, onMouseDown: tt, variant: "tertiary", children: /* @__PURE__ */ s(E, { name: "Check" }) }),
|
|
487
|
+
/* @__PURE__ */ s(T, { "aria-label": "Remove link", onClick: () => rt(), onMouseDown: tt, variant: "tertiary", children: /* @__PURE__ */ s(E, { name: "Trash", variant: "danger" }) })
|
|
488
488
|
] }),
|
|
489
|
-
h && /* @__PURE__ */
|
|
490
|
-
!
|
|
491
|
-
/* @__PURE__ */ s(
|
|
492
|
-
r.key === "Enter" && (r.preventDefault(), G.current = !0,
|
|
489
|
+
h && /* @__PURE__ */ U(ht, { children: [
|
|
490
|
+
!H && /* @__PURE__ */ U(ht, { children: [
|
|
491
|
+
/* @__PURE__ */ s(Mt, { className: lt(g.active), onBlur: X, onChange: (r) => u(r.target.value), onKeyDown: (r) => {
|
|
492
|
+
r.key === "Enter" && (r.preventDefault(), G.current = !0, C());
|
|
493
493
|
}, ref: Q, value: o }),
|
|
494
|
-
/* @__PURE__ */ s(
|
|
494
|
+
/* @__PURE__ */ s(T, { "aria-label": "Apply image", onClick: () => C(), onMouseDown: ut, variant: "tertiary", children: /* @__PURE__ */ s(E, { name: "Check" }) })
|
|
495
495
|
] }),
|
|
496
|
-
/* @__PURE__ */ s(
|
|
496
|
+
/* @__PURE__ */ s(T, { "aria-label": "Remove image", onClick: () => q(), onMouseDown: ut, variant: "tertiary", children: /* @__PURE__ */ s(E, { name: "Trash", variant: "danger" }) })
|
|
497
497
|
] })
|
|
498
498
|
] })
|
|
499
499
|
] });
|
|
500
|
-
}, Fe =
|
|
500
|
+
}, Fe = ae({
|
|
501
501
|
name: "solibo-editor",
|
|
502
502
|
namespace: "Editor",
|
|
503
|
-
nodes: [
|
|
504
|
-
onError(
|
|
505
|
-
throw
|
|
503
|
+
nodes: [zt, Ht, Wt, jt, ct],
|
|
504
|
+
onError(a) {
|
|
505
|
+
throw a;
|
|
506
506
|
},
|
|
507
507
|
theme: {
|
|
508
508
|
link: g.link,
|
|
@@ -519,30 +519,30 @@ const Be = ({
|
|
|
519
519
|
}
|
|
520
520
|
});
|
|
521
521
|
function We({
|
|
522
|
-
autofocus:
|
|
522
|
+
autofocus: a,
|
|
523
523
|
content: e = "",
|
|
524
524
|
sessionKey: t,
|
|
525
525
|
lastEmittedContentRef: c,
|
|
526
526
|
imagePreviews: f
|
|
527
527
|
}) {
|
|
528
|
-
const [h] =
|
|
528
|
+
const [h] = Ct(), b = k(t);
|
|
529
529
|
return Z(() => {
|
|
530
530
|
const n = b.current !== t;
|
|
531
531
|
b.current = t, !(!n && c.current === e) && (h.update(() => {
|
|
532
532
|
const p = new DOMParser().parseFromString(e, "text/html");
|
|
533
533
|
p.querySelectorAll("img[data-solibo-document-slot]").forEach((v) => {
|
|
534
|
-
const
|
|
535
|
-
|
|
534
|
+
const A = f.get(v.getAttribute("data-solibo-document-slot"));
|
|
535
|
+
A && v.setAttribute("src", A);
|
|
536
536
|
});
|
|
537
|
-
const
|
|
538
|
-
|
|
537
|
+
const S = Ut(h, p), w = le();
|
|
538
|
+
w.clear().select(), kt(S), a || n ? w.selectEnd() : Pt(null);
|
|
539
539
|
}, {
|
|
540
540
|
discrete: !0
|
|
541
541
|
}), n && h.dispatchCommand(ce, void 0));
|
|
542
|
-
}, [
|
|
542
|
+
}, [a, e, h, f, c, t]), null;
|
|
543
543
|
}
|
|
544
544
|
const pr = ({
|
|
545
|
-
autofocus:
|
|
545
|
+
autofocus: a = !1,
|
|
546
546
|
attachmentsEnabled: e = !0,
|
|
547
547
|
sessionKey: t,
|
|
548
548
|
autolink: c = !1,
|
|
@@ -550,30 +550,30 @@ const pr = ({
|
|
|
550
550
|
controls: h,
|
|
551
551
|
disabled: b = !1,
|
|
552
552
|
errorMessage: n,
|
|
553
|
-
fill:
|
|
553
|
+
fill: l = !1,
|
|
554
554
|
files: p,
|
|
555
|
-
inline:
|
|
556
|
-
inlineImages:
|
|
555
|
+
inline: S = !1,
|
|
556
|
+
inlineImages: w,
|
|
557
557
|
invalid: v = !1,
|
|
558
|
-
isSubmitting:
|
|
559
|
-
maxRows:
|
|
558
|
+
isSubmitting: A = !1,
|
|
559
|
+
maxRows: z = 12,
|
|
560
560
|
minRows: o = 1,
|
|
561
561
|
onChange: u,
|
|
562
562
|
onFilesChange: D,
|
|
563
563
|
onInlineImagesChange: W,
|
|
564
|
-
onSubmit:
|
|
564
|
+
onSubmit: H,
|
|
565
565
|
onUpload: j,
|
|
566
|
-
placeholder:
|
|
567
|
-
required:
|
|
566
|
+
placeholder: B,
|
|
567
|
+
required: R = !1,
|
|
568
568
|
resizable: K = !1,
|
|
569
569
|
submitLabel: it = "Submit",
|
|
570
570
|
variant: Q = "default"
|
|
571
571
|
}) => {
|
|
572
|
-
const nt = ue(),
|
|
572
|
+
const nt = ue(), O = k(void 0), G = k(!1), tt = k(null), [et, V] = y(!1), [ut, X] = y(!1), [L, $] = y([]), [dt, mt] = y([]), M = k(/* @__PURE__ */ new Map()), C = p ?? L, q = w ?? dt;
|
|
573
573
|
Z(() => {
|
|
574
574
|
const i = tt.current;
|
|
575
575
|
if (!i) return;
|
|
576
|
-
if (!K ||
|
|
576
|
+
if (!K || l) {
|
|
577
577
|
i.style.removeProperty("height"), V(!1);
|
|
578
578
|
return;
|
|
579
579
|
}
|
|
@@ -582,23 +582,23 @@ const pr = ({
|
|
|
582
582
|
attributes: !0,
|
|
583
583
|
attributeFilter: ["style"]
|
|
584
584
|
}), m(), () => d.disconnect();
|
|
585
|
-
}, [
|
|
585
|
+
}, [l, K]);
|
|
586
586
|
const rt = (i) => {
|
|
587
|
-
p === void 0 &&
|
|
588
|
-
}, Y =
|
|
589
|
-
|
|
590
|
-
}, [
|
|
587
|
+
p === void 0 && $(i), D == null || D(i);
|
|
588
|
+
}, Y = x((i) => {
|
|
589
|
+
w === void 0 && mt(i), W == null || W(i);
|
|
590
|
+
}, [w, W]), r = x((i) => {
|
|
591
591
|
const m = i.map((d) => {
|
|
592
|
-
const
|
|
593
|
-
return
|
|
592
|
+
const P = `pasted-${crypto.randomUUID()}`, ot = URL.createObjectURL(d);
|
|
593
|
+
return M.current.set(P, ot), {
|
|
594
594
|
image: {
|
|
595
595
|
alt: d.name,
|
|
596
|
-
soliboDocumentSlot:
|
|
596
|
+
soliboDocumentSlot: P,
|
|
597
597
|
src: ot
|
|
598
598
|
},
|
|
599
599
|
pending: {
|
|
600
600
|
file: d,
|
|
601
|
-
slot:
|
|
601
|
+
slot: P
|
|
602
602
|
}
|
|
603
603
|
};
|
|
604
604
|
});
|
|
@@ -607,20 +607,20 @@ const pr = ({
|
|
|
607
607
|
}) => d)]), m.map(({
|
|
608
608
|
image: d
|
|
609
609
|
}) => d);
|
|
610
|
-
}, [q, Y]), _ =
|
|
610
|
+
}, [q, Y]), _ = x((i) => {
|
|
611
611
|
Y(q.filter((d) => d.slot !== i));
|
|
612
|
-
const m =
|
|
613
|
-
m && URL.revokeObjectURL(m),
|
|
612
|
+
const m = M.current.get(i);
|
|
613
|
+
m && URL.revokeObjectURL(m), M.current.delete(i);
|
|
614
614
|
}, [q, Y]);
|
|
615
615
|
Z(() => () => {
|
|
616
|
-
|
|
616
|
+
M.current.forEach((i) => URL.revokeObjectURL(i)), M.current.clear();
|
|
617
617
|
}, []), Z(() => {
|
|
618
618
|
const i = new Set(q.map((m) => m.slot));
|
|
619
|
-
|
|
620
|
-
i.has(d) || (URL.revokeObjectURL(m),
|
|
619
|
+
M.current.forEach((m, d) => {
|
|
620
|
+
i.has(d) || (URL.revokeObjectURL(m), M.current.delete(d));
|
|
621
621
|
});
|
|
622
622
|
}, [q]);
|
|
623
|
-
const
|
|
623
|
+
const N = (i) => {
|
|
624
624
|
if (typeof DataTransfer < "u") {
|
|
625
625
|
const m = new DataTransfer();
|
|
626
626
|
return i.forEach((d) => m.items.add(d)), m.files;
|
|
@@ -628,11 +628,11 @@ const pr = ({
|
|
|
628
628
|
return Object.assign([...i], {
|
|
629
629
|
item: (m) => i[m] ?? null
|
|
630
630
|
});
|
|
631
|
-
},
|
|
632
|
-
if (!(b ||
|
|
631
|
+
}, F = async () => {
|
|
632
|
+
if (!(b || A || G.current)) {
|
|
633
633
|
G.current = !0;
|
|
634
634
|
try {
|
|
635
|
-
e &&
|
|
635
|
+
e && C.length > 0 && await (j == null ? void 0 : j(N(C))), await (H == null ? void 0 : H()), e && C.length > 0 && rt([]);
|
|
636
636
|
} catch {
|
|
637
637
|
return;
|
|
638
638
|
} finally {
|
|
@@ -642,7 +642,7 @@ const pr = ({
|
|
|
642
642
|
}, I = (i) => {
|
|
643
643
|
i.preventDefault(), i.stopPropagation();
|
|
644
644
|
};
|
|
645
|
-
return /* @__PURE__ */
|
|
645
|
+
return /* @__PURE__ */ U("div", { className: lt(g.field, l && g.fill), "data-max-rows": z, "data-min-rows": o, onDragEnter: (i) => {
|
|
646
646
|
I(i), X(e && !!D);
|
|
647
647
|
}, onDragOver: (i) => {
|
|
648
648
|
I(i), X(e && !!D);
|
|
@@ -651,42 +651,45 @@ const pr = ({
|
|
|
651
651
|
}, onDropCapture: (i) => {
|
|
652
652
|
var d;
|
|
653
653
|
const m = (d = i.dataTransfer) == null ? void 0 : d.files;
|
|
654
|
-
m != null && m.length && (I(i), e && (D || j) && rt([...
|
|
654
|
+
m != null && m.length && (I(i), e && (D || j) && rt([...C, ...Array.from(m)]), X(!1));
|
|
655
655
|
}, onDrop: (i) => {
|
|
656
656
|
i.preventDefault(), X(!1);
|
|
657
657
|
}, "data-component": "editor", children: [
|
|
658
|
-
K === "top" && !
|
|
659
|
-
/* @__PURE__ */ s("div", { className:
|
|
660
|
-
"--editor-max-height": `calc(${
|
|
658
|
+
K === "top" && !l && /* @__PURE__ */ s(He, { editableRef: tt }),
|
|
659
|
+
/* @__PURE__ */ s("div", { className: lt(g.editor, !!h && g["with-controls"], Q === "embedded" && g.embedded, l && g["fill-editor"], K === !0 && !l && g.resizable, K && !l && et && g.resized, v && g.invalid, C.length > 0 && g["has-files"]), style: {
|
|
660
|
+
"--editor-max-height": `calc(${z * 1.25}em + (2 * var(--scale-8)))`,
|
|
661
661
|
"--editor-min-height": `calc(${o * 1.25}em + (2 * var(--scale-8)))`
|
|
662
|
-
}, children: /* @__PURE__ */
|
|
663
|
-
!
|
|
664
|
-
rt([...
|
|
662
|
+
}, children: /* @__PURE__ */ U(Zt, { contentEditable: null, extension: Fe, children: [
|
|
663
|
+
!S && Q !== "embedded" && /* @__PURE__ */ s(Be, { onInlineImageRemove: e ? _ : void 0, onFilesSelected: e && (j || D) ? (i) => {
|
|
664
|
+
rt([...C, ...Array.from(i)]);
|
|
665
665
|
} : void 0 }),
|
|
666
|
-
/* @__PURE__ */ s("div", { className:
|
|
667
|
-
!
|
|
668
|
-
e &&
|
|
669
|
-
|
|
670
|
-
c && /* @__PURE__ */ s(Gt, { matchers:
|
|
666
|
+
/* @__PURE__ */ s("div", { className: lt(g.content, ut && g.dragging), children: /* @__PURE__ */ s(te, { contentEditable: /* @__PURE__ */ s(qt, { ref: tt, "aria-placeholder": B ?? "", ariaErrorMessage: v && n ? nt : void 0, ariaInvalid: v || void 0, ariaRequired: R || void 0, placeholder: () => B ? /* @__PURE__ */ s("div", { className: g.placeholder, children: B }) : null }), ErrorBoundary: Yt }) }),
|
|
667
|
+
!S && Q !== "embedded" && (h || H) && /* @__PURE__ */ s("div", { className: g.submit, children: h ?? /* @__PURE__ */ s(T, { "aria-label": it, "data-cy": "toolbar-submit-button", disabled: b, icon: "PaperPlaneTilt", isLoading: A, onClick: () => void F(), variant: "primary", children: /* @__PURE__ */ s("span", { children: it }) }) }),
|
|
668
|
+
e && C.length > 0 && /* @__PURE__ */ s("div", { "aria-label": "Files to upload", className: g.files, role: "region", children: C.map((i, m) => /* @__PURE__ */ s(de, { deleteAccessibleLabel: `Remove ${i.name} from upload queue`, name: i.name, onDelete: () => rt(C.filter((d, P) => P !== m)) }, `${i.name}-${i.size}-${i.lastModified}-${m}`)) }),
|
|
669
|
+
a && /* @__PURE__ */ s(Kt, {}),
|
|
670
|
+
c && /* @__PURE__ */ s(Gt, { matchers: ze }),
|
|
671
671
|
/* @__PURE__ */ s(Vt, {}),
|
|
672
|
-
e && W && /* @__PURE__ */ s(
|
|
673
|
-
f !== void 0 && /* @__PURE__ */ s(We, { autofocus:
|
|
674
|
-
/* @__PURE__ */ s(Xt, { validateUrl:
|
|
672
|
+
e && W && /* @__PURE__ */ s(Oe, { createImages: r, onRemove: _ }),
|
|
673
|
+
f !== void 0 && /* @__PURE__ */ s(We, { autofocus: a, content: f, sessionKey: t, lastEmittedContentRef: O, imagePreviews: M.current }),
|
|
674
|
+
/* @__PURE__ */ s(Xt, { validateUrl: xt }),
|
|
675
675
|
/* @__PURE__ */ s(Jt, {}),
|
|
676
676
|
u && /* @__PURE__ */ s(Qt, { ignoreHistoryMergeTagChange: !1, onChange: (i, m) => {
|
|
677
677
|
i.read(() => {
|
|
678
|
-
const d =
|
|
678
|
+
const d = $t(m, null), P = wt(d, {
|
|
679
679
|
allowedAttributes: {
|
|
680
|
-
...
|
|
681
|
-
img: [...
|
|
680
|
+
...wt.defaults.allowedAttributes,
|
|
681
|
+
img: [...wt.defaults.allowedAttributes.img ?? [], "data-solibo-document-id", "data-solibo-document-slot"]
|
|
682
682
|
},
|
|
683
683
|
allowedTags: ["a", "b", "br", "i", "img", "li", "ol", "p", "u", "ul"]
|
|
684
684
|
});
|
|
685
|
-
|
|
685
|
+
O.current = P, u(P);
|
|
686
686
|
});
|
|
687
687
|
} })
|
|
688
688
|
] }) }),
|
|
689
|
-
v && n && /* @__PURE__ */
|
|
689
|
+
v && n && /* @__PURE__ */ U("div", { className: g.error, id: nt, children: [
|
|
690
|
+
/* @__PURE__ */ s(E, { name: "Warning", gap: "right", size: "small" }),
|
|
691
|
+
n
|
|
692
|
+
] })
|
|
690
693
|
] });
|
|
691
694
|
};
|
|
692
695
|
export {
|