@baishuyun/ui-base 2.3.1 → 2.3.2
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/Card/Card-BE6v4I-A.js +69 -0
- package/dist/Card/index.js +3 -4
- package/dist/CheckBox/CheckBox--rXaUgMO.js +67 -0
- package/dist/CheckBox/CheckBox-Db8X-pw9.js +33 -0
- package/dist/CheckBox/index.js +4 -39
- package/dist/ColorPicker/ColorPicker-BBP-4-so.js +168 -0
- package/dist/ColorPicker/index.js +6 -5
- package/dist/DropDown/DropDown-CKXi9mXN.js +162 -0
- package/dist/DropDown/index.js +7 -4
- package/dist/Editor/Buttons--dMLPuk2.js +595 -0
- package/dist/Editor/ToolbarPlugin/Buttons/index.js +14 -8
- package/dist/Editor/constants/index.js +53 -20
- package/dist/Editor/index.js +518 -576
- package/dist/Icon/Icon-DppVOyPK.js +19 -0
- package/dist/Icon/index.js +2 -4
- package/dist/InputTag/InputTag-B6N5MZA2.js +139 -0
- package/dist/InputTag/index.js +3 -4
- package/dist/Loading/Loading-Bi5NO-Ky.js +15 -0
- package/dist/Loading/index.js +2 -4
- package/dist/Modal/Modal-FVJpbEgw.js +81 -0
- package/dist/Modal/index.js +3 -4
- package/dist/NotFoundContent/NotFoundContent-CTPpcZOt.js +9 -0
- package/dist/NotFoundContent/index.js +2 -4
- package/dist/Radio/Radio-dyoBNiKF.js +85 -0
- package/dist/Radio/index.js +2 -105
- package/dist/Segmented/Segmented-Dd8glDXI.js +62 -0
- package/dist/Segmented/index.js +2 -4
- package/dist/Select/Select-Bd2ECrB0.js +729 -0
- package/dist/Select/SelectInputSearch-CIXBNLFi.js +46 -0
- package/dist/Select/index.js +11 -6
- package/dist/Tabs/Tabs-C79GTyGd.js +410 -0
- package/dist/Tabs/index.js +6 -7
- package/dist/Tree/index.js +5 -4
- package/dist/Tree/utils/index.js +24 -39
- package/dist/components/Editor/context/EditorContainerContext.d.ts +8 -0
- package/dist/index.js +103 -81
- package/dist/style.css +2 -1
- package/dist/vendors/Tree-CQR9fvpA.js +231 -0
- package/dist/vendors/animations-C5JKFkz4.js +38 -0
- package/dist/vendors/clsx-DNOE4Gl8.js +16 -0
- package/dist/vendors/color-BPWy9DvT.js +12 -0
- package/dist/vendors/fuse.js-BKtvbTjL.js +877 -0
- package/dist/vendors/lexical-hZliMgDv.js +6439 -0
- package/dist/vendors/lodash-es-Bu9xU1fK.js +334 -0
- package/dist/vendors/simplebar-react-CFlS-Nm9.js +370 -0
- package/dist/vendors/tinycolor2-DToeAEPD.js +726 -0
- package/dist/vendors/useFloatingPortal-BA6P5GxV.js +45 -0
- package/dist/vendors/useLocale-BfT0V1j4.js +75 -0
- package/package.json +3 -3
- package/dist/Card/Card-Y1ISqAp9.js +0 -86
- package/dist/CheckBox/CheckBox-C9sXWSA5.js +0 -84
- package/dist/ColorPicker/ColorPicker-uPJOs52x.js +0 -215
- package/dist/DropDown/DropDown-DGkSeXQT.js +0 -166
- package/dist/Editor/index-D7tFsaxU.js +0 -846
- package/dist/Icon/Icon-CBlIwtp2.js +0 -24
- package/dist/InputTag/InputTag-C-rQUJnF.js +0 -155
- package/dist/Loading/Loading-CEB4PLUE.js +0 -9
- package/dist/Modal/Modal-z3TvEXwN.js +0 -80
- package/dist/NotFoundContent/NotFoundContent-h0-oIXlk.js +0 -6
- package/dist/Segmented/Segmented-UgzW78Ey.js +0 -75
- package/dist/Select/Select-hwXXDuLU.js +0 -820
- package/dist/Select/SelectInputSearch-ChUpUgxa.js +0 -34
- package/dist/Tabs/TabSelect-DL8Bhehc.js +0 -445
- package/dist/vendors/Tree-CLEy-xqz.js +0 -235
- package/dist/vendors/clsx-OuTLNxxd.js +0 -16
- package/dist/vendors/color-VzwvCPhF.js +0 -21
- package/dist/vendors/fuse.js-D1DCbUBb.js +0 -1022
- package/dist/vendors/index-MTmG1Ezy.js +0 -15
- package/dist/vendors/lexical-DO7eMeC2.js +0 -5891
- package/dist/vendors/lodash-es-DFpaJB4Y.js +0 -305
- package/dist/vendors/simplebar-react-D68KzE44.js +0 -408
- package/dist/vendors/tinycolor2-Begv3Jc8.js +0 -711
- package/dist/vendors/useFloatingPortal-9VUFOAOG.js +0 -45
- package/dist/vendors/useLocale-DgqW9M3h.js +0 -47
|
@@ -0,0 +1,595 @@
|
|
|
1
|
+
import { t as e } from "../Icon/Icon-DppVOyPK.js";
|
|
2
|
+
import { t } from "../vendors/useLocale-BfT0V1j4.js";
|
|
3
|
+
import { t as n } from "../vendors/clsx-DNOE4Gl8.js";
|
|
4
|
+
import { t as r } from "../Modal/Modal-FVJpbEgw.js";
|
|
5
|
+
import { t as i } from "../ColorPicker/ColorPicker-BBP-4-so.js";
|
|
6
|
+
import { t as a } from "../CheckBox/CheckBox-Db8X-pw9.js";
|
|
7
|
+
import { t as o } from "../DropDown/DropDown-CKXi9mXN.js";
|
|
8
|
+
import { A as s, E as c, F as l, I as u, P as d, T as f, g as p, i as m, j as h, k as g, n as _, s as v, x as y, y as ee } from "../vendors/lexical-hZliMgDv.js";
|
|
9
|
+
import { FONT_SIZES as b } from "./constants/index.js";
|
|
10
|
+
import { AlignCenterOutlined as x, AlignLeftOutlined as S, AlignRightOutlined as C } from "@ant-design/icons";
|
|
11
|
+
import { Fragment as w, jsx as T, jsxs as E } from "react/jsx-runtime";
|
|
12
|
+
import D, { createContext as O, forwardRef as k, useCallback as A, useContext as j, useImperativeHandle as M, useMemo as N, useRef as P, useState as F } from "react";
|
|
13
|
+
import { Button as I, Form as L, Input as R, message as z } from "antd";
|
|
14
|
+
import { AnimatePresence as te, motion as B } from "motion/react";
|
|
15
|
+
//#region src/components/Editor/ToolbarPlugin/context/TextFormatsContext.tsx
|
|
16
|
+
var V = O(null), H = {
|
|
17
|
+
"lexical-editor__toolbar-button": "_lexical-editor__toolbar-button_1y192_1",
|
|
18
|
+
"lexical-editor__toolbar-button-active": "_lexical-editor__toolbar-button-active_1y192_7"
|
|
19
|
+
}, U = (t) => {
|
|
20
|
+
let { icon: r, tooltip: i, onClick: a, disabled: o = !1, active: s = !1, size: c = 14 } = t;
|
|
21
|
+
return /* @__PURE__ */ T("button", {
|
|
22
|
+
className: n(H["lexical-editor__toolbar-button"], { [H["lexical-editor__toolbar-button-active"]]: s }),
|
|
23
|
+
type: "button",
|
|
24
|
+
onClick: a,
|
|
25
|
+
disabled: o,
|
|
26
|
+
title: i,
|
|
27
|
+
children: D.isValidElement(r) ? r : /* @__PURE__ */ T(e, {
|
|
28
|
+
name: r,
|
|
29
|
+
size: c
|
|
30
|
+
})
|
|
31
|
+
});
|
|
32
|
+
}, W = () => {
|
|
33
|
+
let e = j(V);
|
|
34
|
+
if (!e) throw Error("useTextFormatsContext must be used within TextFormatsProvider");
|
|
35
|
+
return e;
|
|
36
|
+
}, ne = () => {
|
|
37
|
+
let [e] = u(), n = W(), { t: r } = t(), i = n.bold;
|
|
38
|
+
return /* @__PURE__ */ T(U, {
|
|
39
|
+
icon: "bold",
|
|
40
|
+
tooltip: r("editor.bold"),
|
|
41
|
+
active: i,
|
|
42
|
+
onClick: () => {
|
|
43
|
+
e.dispatchCommand(h, "bold");
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
}, re = () => {
|
|
47
|
+
let [e] = u(), n = W(), { t: r } = t(), i = n.underline;
|
|
48
|
+
return /* @__PURE__ */ T(U, {
|
|
49
|
+
icon: "underline",
|
|
50
|
+
tooltip: r("editor.underline"),
|
|
51
|
+
active: i,
|
|
52
|
+
onClick: () => {
|
|
53
|
+
e.dispatchCommand(h, "underline");
|
|
54
|
+
}
|
|
55
|
+
});
|
|
56
|
+
}, ie = () => {
|
|
57
|
+
let [e] = u(), n = W(), { t: r } = t(), i = n.italic;
|
|
58
|
+
return /* @__PURE__ */ T(U, {
|
|
59
|
+
icon: "italic",
|
|
60
|
+
tooltip: r("editor.italic"),
|
|
61
|
+
active: i,
|
|
62
|
+
onClick: () => {
|
|
63
|
+
e.dispatchCommand(h, "italic");
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
}, ae = () => {
|
|
67
|
+
let [e] = u(), t = W();
|
|
68
|
+
return /* @__PURE__ */ T(o, {
|
|
69
|
+
menus: N(() => b.map((e) => ({
|
|
70
|
+
key: e.value,
|
|
71
|
+
label: e.label
|
|
72
|
+
})), []),
|
|
73
|
+
onClick: A((t) => {
|
|
74
|
+
let n = t.key;
|
|
75
|
+
e.update(() => {
|
|
76
|
+
let e = y();
|
|
77
|
+
f(e) && p(e, { "font-size": n });
|
|
78
|
+
});
|
|
79
|
+
}, [e]),
|
|
80
|
+
activeKey: [t.fontSize],
|
|
81
|
+
showSearch: !1,
|
|
82
|
+
style: {
|
|
83
|
+
width: "60px",
|
|
84
|
+
minWidth: "60px"
|
|
85
|
+
},
|
|
86
|
+
children: /* @__PURE__ */ T("div", {
|
|
87
|
+
className: "dropdown__trigger inline-flex",
|
|
88
|
+
children: /* @__PURE__ */ T(U, {
|
|
89
|
+
icon: "fontsize",
|
|
90
|
+
tooltip: "字号",
|
|
91
|
+
active: !1
|
|
92
|
+
})
|
|
93
|
+
})
|
|
94
|
+
});
|
|
95
|
+
}, G = O(null), K = () => {
|
|
96
|
+
let e = j(G);
|
|
97
|
+
if (!e) throw Error("useEditorContainer must be used within EditorContainerProvider");
|
|
98
|
+
return e;
|
|
99
|
+
}, oe = () => {
|
|
100
|
+
let [e] = u(), n = W(), { t: r } = t(), { getPopupContainer: a } = K(), o = A((t) => {
|
|
101
|
+
e.update(() => {
|
|
102
|
+
let e = y();
|
|
103
|
+
f(e) && p(e, { color: t });
|
|
104
|
+
});
|
|
105
|
+
}, [e]);
|
|
106
|
+
return /* @__PURE__ */ T(i, {
|
|
107
|
+
value: n.fontColor,
|
|
108
|
+
onChange: o,
|
|
109
|
+
placement: "bottom-start",
|
|
110
|
+
getPopupContainer: a,
|
|
111
|
+
children: /* @__PURE__ */ T("div", {
|
|
112
|
+
className: "trigger-picker inline-flex",
|
|
113
|
+
children: /* @__PURE__ */ T(U, {
|
|
114
|
+
icon: "fontcolor",
|
|
115
|
+
tooltip: r("editor.fontColor"),
|
|
116
|
+
onClick: () => {},
|
|
117
|
+
active: !1
|
|
118
|
+
})
|
|
119
|
+
})
|
|
120
|
+
});
|
|
121
|
+
}, se = () => {
|
|
122
|
+
let [e] = u(), n = W(), { t: r } = t(), { getPopupContainer: a } = K(), o = A((t) => {
|
|
123
|
+
e.update(() => {
|
|
124
|
+
let e = y();
|
|
125
|
+
f(e) && p(e, { "background-color": t });
|
|
126
|
+
});
|
|
127
|
+
}, [e]);
|
|
128
|
+
return /* @__PURE__ */ T(i, {
|
|
129
|
+
value: n.backgroundColor,
|
|
130
|
+
onChange: o,
|
|
131
|
+
placement: "bottom-start",
|
|
132
|
+
getPopupContainer: a,
|
|
133
|
+
children: /* @__PURE__ */ T("div", {
|
|
134
|
+
className: "trigger-picker inline-flex",
|
|
135
|
+
children: /* @__PURE__ */ T(U, {
|
|
136
|
+
icon: "fill",
|
|
137
|
+
tooltip: r("editor.fill"),
|
|
138
|
+
onClick: () => {},
|
|
139
|
+
active: !1
|
|
140
|
+
})
|
|
141
|
+
})
|
|
142
|
+
});
|
|
143
|
+
}, ce = () => {
|
|
144
|
+
let [e] = u(), { align: n } = W(), { t: r } = t(), i = [
|
|
145
|
+
{
|
|
146
|
+
key: "left",
|
|
147
|
+
label: r("leftAlign"),
|
|
148
|
+
icon: /* @__PURE__ */ T(S, {})
|
|
149
|
+
},
|
|
150
|
+
{
|
|
151
|
+
key: "center",
|
|
152
|
+
label: r("editor.centerAlign"),
|
|
153
|
+
icon: /* @__PURE__ */ T(x, {})
|
|
154
|
+
},
|
|
155
|
+
{
|
|
156
|
+
key: "right",
|
|
157
|
+
label: r("editor.rightAlign"),
|
|
158
|
+
icon: /* @__PURE__ */ T(C, {})
|
|
159
|
+
}
|
|
160
|
+
], a = A((t) => {
|
|
161
|
+
e.dispatchCommand(s, t);
|
|
162
|
+
}, [e]), c = i.map((e) => ({
|
|
163
|
+
key: e.key,
|
|
164
|
+
label: /* @__PURE__ */ E("div", {
|
|
165
|
+
className: "flex items-center gap-2",
|
|
166
|
+
children: [e.icon, /* @__PURE__ */ T("span", { children: e.label })]
|
|
167
|
+
})
|
|
168
|
+
})), l = A((e) => {
|
|
169
|
+
a(e.key);
|
|
170
|
+
}, [a]), d = i.find((e) => e.key === n)?.icon || /* @__PURE__ */ T(S, {});
|
|
171
|
+
return /* @__PURE__ */ T(o, {
|
|
172
|
+
menus: c,
|
|
173
|
+
onClick: l,
|
|
174
|
+
showSearch: !1,
|
|
175
|
+
activeKey: [n],
|
|
176
|
+
style: {
|
|
177
|
+
width: "110px",
|
|
178
|
+
minWidth: "110px"
|
|
179
|
+
},
|
|
180
|
+
children: /* @__PURE__ */ T("div", {
|
|
181
|
+
className: "trigger-dropdown inline-flex text-sm",
|
|
182
|
+
children: /* @__PURE__ */ T(U, {
|
|
183
|
+
icon: d,
|
|
184
|
+
tooltip: r("editor.alignment"),
|
|
185
|
+
onClick: () => {},
|
|
186
|
+
active: !1
|
|
187
|
+
})
|
|
188
|
+
})
|
|
189
|
+
});
|
|
190
|
+
}, le = () => {
|
|
191
|
+
let [e] = u(), { link: n } = W(), { t: i } = t(), [o, s] = F(!1), [c, p] = F(""), [m, h] = F(""), [b, x] = F(!0), [S, C] = z.useMessage(), D = A((e) => e ? e.startsWith("@") ? "javascript:void(0);" : e.match(/^https?:\/\//) ? e : `http://${e}` : "", []), O = () => {
|
|
192
|
+
if (!c) {
|
|
193
|
+
S.warning(i("editor.linkAddressEmpty"));
|
|
194
|
+
return;
|
|
195
|
+
}
|
|
196
|
+
let t = D(c);
|
|
197
|
+
e.update(() => {
|
|
198
|
+
let e = b ? {
|
|
199
|
+
target: "_blank",
|
|
200
|
+
rel: "noopener noreferrer",
|
|
201
|
+
title: c
|
|
202
|
+
} : { title: c }, n = y(), r = _(t, e), i = g(m || c);
|
|
203
|
+
if (f(n)) n.isCollapsed() ? (r.append(i), n.insertNodes([r])) : v(t);
|
|
204
|
+
else {
|
|
205
|
+
r.append(i);
|
|
206
|
+
let e = d(), t = e.getLastChild();
|
|
207
|
+
if (l(t) && t.isEmpty()) t.append(r);
|
|
208
|
+
else {
|
|
209
|
+
let t = ee();
|
|
210
|
+
t.append(r), e.append(t);
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
}), p(""), h(""), s(!1);
|
|
214
|
+
}, k = A(() => {
|
|
215
|
+
n ? (p(n.link === "javascript:void(0);" ? "" : n.link), h(n.linkText)) : (p(""), h("")), s(!0);
|
|
216
|
+
}, [n]);
|
|
217
|
+
return /* @__PURE__ */ E(w, { children: [
|
|
218
|
+
/* @__PURE__ */ T(U, {
|
|
219
|
+
icon: "Insertlink",
|
|
220
|
+
tooltip: i("link"),
|
|
221
|
+
onClick: k,
|
|
222
|
+
active: !!n?.link
|
|
223
|
+
}),
|
|
224
|
+
C,
|
|
225
|
+
/* @__PURE__ */ T(r, {
|
|
226
|
+
title: i("link"),
|
|
227
|
+
open: o,
|
|
228
|
+
onOpenChange: s,
|
|
229
|
+
children: /* @__PURE__ */ E("div", { children: [/* @__PURE__ */ E("div", {
|
|
230
|
+
className: "px-[20px] pb-[60px] pt-[40px]",
|
|
231
|
+
children: [/* @__PURE__ */ E("div", {
|
|
232
|
+
className: "flex items-center relative",
|
|
233
|
+
children: [
|
|
234
|
+
/* @__PURE__ */ T("label", {
|
|
235
|
+
className: "w-[80px] shrink-0",
|
|
236
|
+
children: i("linkAddress")
|
|
237
|
+
}),
|
|
238
|
+
/* @__PURE__ */ T(R, {
|
|
239
|
+
value: c,
|
|
240
|
+
onChange: (e) => p(e.target.value),
|
|
241
|
+
placeholder: i("editor.linkTip")
|
|
242
|
+
}),
|
|
243
|
+
/* @__PURE__ */ T("div", {
|
|
244
|
+
className: "absolute bottom-[-30px] left-[80px]",
|
|
245
|
+
children: /* @__PURE__ */ T("p", {
|
|
246
|
+
className: "text-[#999]",
|
|
247
|
+
children: "链接可用 @表单别名,用于应用内表单跳转"
|
|
248
|
+
})
|
|
249
|
+
})
|
|
250
|
+
]
|
|
251
|
+
}), /* @__PURE__ */ E("div", {
|
|
252
|
+
className: "flex items-center mt-[40px]",
|
|
253
|
+
children: [/* @__PURE__ */ T("label", {
|
|
254
|
+
className: "w-[80px] shrink-0",
|
|
255
|
+
children: i("showContent")
|
|
256
|
+
}), /* @__PURE__ */ T(R, {
|
|
257
|
+
value: m,
|
|
258
|
+
onChange: (e) => h(e.target.value)
|
|
259
|
+
})]
|
|
260
|
+
})]
|
|
261
|
+
}), /* @__PURE__ */ E("div", {
|
|
262
|
+
className: "py-[14px] px-[20px] flex justify-between items-center border-t-[1px] border-solid border-[#e0e0e0]",
|
|
263
|
+
children: [/* @__PURE__ */ T("div", { children: /* @__PURE__ */ T(a, {
|
|
264
|
+
checked: b,
|
|
265
|
+
onChange: (e) => x(e),
|
|
266
|
+
children: i("openInNewTab")
|
|
267
|
+
}) }), /* @__PURE__ */ E("div", {
|
|
268
|
+
className: "flex gap-[15px]",
|
|
269
|
+
children: [/* @__PURE__ */ T(I, {
|
|
270
|
+
onClick: () => s(!1),
|
|
271
|
+
children: i("cancel")
|
|
272
|
+
}), /* @__PURE__ */ T(I, {
|
|
273
|
+
type: "primary",
|
|
274
|
+
onClick: O,
|
|
275
|
+
children: i("confirm")
|
|
276
|
+
})]
|
|
277
|
+
})]
|
|
278
|
+
})] })
|
|
279
|
+
})
|
|
280
|
+
] });
|
|
281
|
+
}, ue = () => {
|
|
282
|
+
let [e] = u(), { link: n } = W(), { t: r } = t();
|
|
283
|
+
return /* @__PURE__ */ T(U, {
|
|
284
|
+
icon: "cancellink",
|
|
285
|
+
tooltip: r("cancelLink"),
|
|
286
|
+
onClick: () => {
|
|
287
|
+
n && e.dispatchCommand(m, null);
|
|
288
|
+
}
|
|
289
|
+
});
|
|
290
|
+
}, q = {
|
|
291
|
+
"picture-modal__container": "_picture-modal__container_qyj1h_1",
|
|
292
|
+
"picture-modal__sidebar": "_picture-modal__sidebar_qyj1h_4",
|
|
293
|
+
"picture-modal__menu-list": "_picture-modal__menu-list_qyj1h_9",
|
|
294
|
+
"picture-modal__menu-item": "_picture-modal__menu-item_qyj1h_14",
|
|
295
|
+
"picture-modal__slider": "_picture-modal__slider_qyj1h_24",
|
|
296
|
+
"picture-modal__content": "_picture-modal__content_qyj1h_35",
|
|
297
|
+
"picture-modal__content-wrapper": "_picture-modal__content-wrapper_qyj1h_41",
|
|
298
|
+
"picture-modal__content-container": "_picture-modal__content-container_qyj1h_45",
|
|
299
|
+
"picture-modal__content-page": "_picture-modal__content-page_qyj1h_48",
|
|
300
|
+
"picture-modal__content-title": "_picture-modal__content-title_qyj1h_51",
|
|
301
|
+
"picture-modal__upload-area": "_picture-modal__upload-area_qyj1h_62",
|
|
302
|
+
"picture-modal__upload-area--dragging": "_picture-modal__upload-area--dragging_qyj1h_77",
|
|
303
|
+
"picture-modal__preview": "_picture-modal__preview_qyj1h_83",
|
|
304
|
+
"picture-modal__preview-image": "_picture-modal__preview-image_qyj1h_92",
|
|
305
|
+
"picture-modal__preview-info": "_picture-modal__preview-info_qyj1h_99",
|
|
306
|
+
"picture-modal__preview-filename": "_picture-modal__preview-filename_qyj1h_103",
|
|
307
|
+
"picture-modal__preview-size": "_picture-modal__preview-size_qyj1h_109",
|
|
308
|
+
"picture-modal__preview-delete": "_picture-modal__preview-delete_qyj1h_113",
|
|
309
|
+
"picture-modal__upload-text": "_picture-modal__upload-text_qyj1h_121",
|
|
310
|
+
"picture-modal__footer": "_picture-modal__footer_qyj1h_125"
|
|
311
|
+
}, J = k((e, n) => {
|
|
312
|
+
let [r] = L.useForm(), [i, a] = F(""), { t: o } = t(), s = (e) => /^https?:\/\/.+/i.test(e);
|
|
313
|
+
return M(n, () => ({ getValue: async () => {
|
|
314
|
+
try {
|
|
315
|
+
return await r.validateFields(), i;
|
|
316
|
+
} catch {
|
|
317
|
+
throw Error("URL validation failed");
|
|
318
|
+
}
|
|
319
|
+
} })), /* @__PURE__ */ E(w, { children: [/* @__PURE__ */ T("div", {
|
|
320
|
+
className: q["picture-modal__content-title"],
|
|
321
|
+
"data-title": o("editor.imageUrlNote"),
|
|
322
|
+
children: o("editor.enterImageUrl")
|
|
323
|
+
}), /* @__PURE__ */ T(L, {
|
|
324
|
+
form: r,
|
|
325
|
+
children: /* @__PURE__ */ T(L.Item, {
|
|
326
|
+
name: "url",
|
|
327
|
+
rules: [{
|
|
328
|
+
required: !0,
|
|
329
|
+
message: o("editor.pleaseEnterImageUrl")
|
|
330
|
+
}, { validator: (e, t) => !t || s(t) ? Promise.resolve() : Promise.reject(Error(o("editor.pleaseEnterValidImageUrl"))) }],
|
|
331
|
+
children: /* @__PURE__ */ T(R, {
|
|
332
|
+
placeholder: o("editor.pleaseEnterImageUrl"),
|
|
333
|
+
value: i,
|
|
334
|
+
onChange: (e) => a(e.target.value)
|
|
335
|
+
})
|
|
336
|
+
})
|
|
337
|
+
})] });
|
|
338
|
+
});
|
|
339
|
+
J.displayName = "LinkInput";
|
|
340
|
+
//#endregion
|
|
341
|
+
//#region src/components/Editor/ToolbarPlugin/Buttons/PictureButton/UploadImage.tsx
|
|
342
|
+
var Y = k((n, r) => {
|
|
343
|
+
let [i, a] = F(null), [o, s] = F(!1), [c, l] = F(null), u = P(null), [d, f] = z.useMessage(), { t: p } = t(), m = (e) => (e / 1024).toFixed(1) + "kb", h = (e) => e.type.startsWith("image/") ? e.size > 1048576 ? (d.warning(p("editor.imageSizeNote")), !1) : !0 : (d.warning(p("editor.onlyImageFormatsSupported")), !1), g = (e) => {
|
|
344
|
+
h(e) && (a(URL.createObjectURL(e)), l(e));
|
|
345
|
+
}, _ = () => {
|
|
346
|
+
u.current?.click();
|
|
347
|
+
}, v = (e) => {
|
|
348
|
+
let t = e.target.files?.[0];
|
|
349
|
+
t && g(t);
|
|
350
|
+
};
|
|
351
|
+
return M(r, () => ({ getValue: async () => {
|
|
352
|
+
if (!c) throw d.warning(p("editor.pleaseUploadImageFirst")), Error(p("editor.pleaseUploadImageFirst"));
|
|
353
|
+
return new Promise((e, t) => {
|
|
354
|
+
let n = new FileReader();
|
|
355
|
+
n.onload = () => {
|
|
356
|
+
e({
|
|
357
|
+
src: n.result,
|
|
358
|
+
fileName: c.name
|
|
359
|
+
});
|
|
360
|
+
}, n.onerror = () => {
|
|
361
|
+
t(Error(p("editor.operationFailed")));
|
|
362
|
+
}, n.readAsDataURL(c);
|
|
363
|
+
});
|
|
364
|
+
} })), /* @__PURE__ */ E("div", {
|
|
365
|
+
className: "h-full",
|
|
366
|
+
onDragOver: (e) => {
|
|
367
|
+
e.preventDefault(), s(!0);
|
|
368
|
+
},
|
|
369
|
+
onDragLeave: (e) => {
|
|
370
|
+
e.preventDefault(), s(!1);
|
|
371
|
+
},
|
|
372
|
+
onDrop: (e) => {
|
|
373
|
+
e.preventDefault(), s(!1);
|
|
374
|
+
let t = e.dataTransfer.files[0];
|
|
375
|
+
t && g(t);
|
|
376
|
+
},
|
|
377
|
+
children: [
|
|
378
|
+
/* @__PURE__ */ T("div", {
|
|
379
|
+
className: q["picture-modal__content-title"],
|
|
380
|
+
"data-title": p("editor.imageSizeNote"),
|
|
381
|
+
children: p("editor.uploadImage")
|
|
382
|
+
}),
|
|
383
|
+
/* @__PURE__ */ E("div", {
|
|
384
|
+
className: `${q["picture-modal__upload-area"]} ${o ? q["picture-modal__upload-area--dragging"] : ""}`,
|
|
385
|
+
onClick: _,
|
|
386
|
+
children: [/* @__PURE__ */ T(e, { name: "upload" }), /* @__PURE__ */ T("span", {
|
|
387
|
+
className: q["picture-modal__upload-text"],
|
|
388
|
+
children: p("editor.clickOrDragToUpload")
|
|
389
|
+
})]
|
|
390
|
+
}),
|
|
391
|
+
/* @__PURE__ */ T(te, {
|
|
392
|
+
mode: "wait",
|
|
393
|
+
children: i && c && /* @__PURE__ */ E(B.div, {
|
|
394
|
+
className: q["picture-modal__preview"],
|
|
395
|
+
initial: {
|
|
396
|
+
opacity: 0,
|
|
397
|
+
y: 20,
|
|
398
|
+
scale: .95
|
|
399
|
+
},
|
|
400
|
+
animate: {
|
|
401
|
+
opacity: 1,
|
|
402
|
+
y: 0,
|
|
403
|
+
scale: 1
|
|
404
|
+
},
|
|
405
|
+
exit: {
|
|
406
|
+
opacity: 0,
|
|
407
|
+
y: -10,
|
|
408
|
+
scale: .95
|
|
409
|
+
},
|
|
410
|
+
transition: {
|
|
411
|
+
duration: .3,
|
|
412
|
+
ease: [
|
|
413
|
+
.4,
|
|
414
|
+
0,
|
|
415
|
+
.2,
|
|
416
|
+
1
|
|
417
|
+
]
|
|
418
|
+
},
|
|
419
|
+
children: [
|
|
420
|
+
/* @__PURE__ */ T(B.div, {
|
|
421
|
+
className: q["picture-modal__preview-image"],
|
|
422
|
+
initial: {
|
|
423
|
+
opacity: 0,
|
|
424
|
+
scale: .8
|
|
425
|
+
},
|
|
426
|
+
animate: {
|
|
427
|
+
opacity: 1,
|
|
428
|
+
scale: 1
|
|
429
|
+
},
|
|
430
|
+
transition: {
|
|
431
|
+
delay: .1,
|
|
432
|
+
duration: .2
|
|
433
|
+
},
|
|
434
|
+
children: /* @__PURE__ */ T("img", {
|
|
435
|
+
src: i,
|
|
436
|
+
style: {
|
|
437
|
+
maxWidth: "120px",
|
|
438
|
+
height: "80px"
|
|
439
|
+
},
|
|
440
|
+
alt: p("editor.previewImage")
|
|
441
|
+
})
|
|
442
|
+
}),
|
|
443
|
+
/* @__PURE__ */ E(B.div, {
|
|
444
|
+
className: q["picture-modal__preview-info"],
|
|
445
|
+
initial: {
|
|
446
|
+
opacity: 0,
|
|
447
|
+
x: 20
|
|
448
|
+
},
|
|
449
|
+
animate: {
|
|
450
|
+
opacity: 1,
|
|
451
|
+
x: 0
|
|
452
|
+
},
|
|
453
|
+
transition: {
|
|
454
|
+
delay: .15,
|
|
455
|
+
duration: .2
|
|
456
|
+
},
|
|
457
|
+
children: [/* @__PURE__ */ T("div", {
|
|
458
|
+
className: q["picture-modal__preview-filename"],
|
|
459
|
+
children: c.name
|
|
460
|
+
}), /* @__PURE__ */ T("div", {
|
|
461
|
+
className: q["picture-modal__preview-size"],
|
|
462
|
+
children: m(c.size)
|
|
463
|
+
})]
|
|
464
|
+
}),
|
|
465
|
+
/* @__PURE__ */ T(B.div, {
|
|
466
|
+
className: q["picture-modal__preview-delete"],
|
|
467
|
+
role: "button",
|
|
468
|
+
onClick: () => {
|
|
469
|
+
a(null), l(null);
|
|
470
|
+
},
|
|
471
|
+
initial: {
|
|
472
|
+
opacity: 0,
|
|
473
|
+
scale: .8
|
|
474
|
+
},
|
|
475
|
+
animate: {
|
|
476
|
+
opacity: 1,
|
|
477
|
+
scale: 1
|
|
478
|
+
},
|
|
479
|
+
transition: {
|
|
480
|
+
delay: .2,
|
|
481
|
+
duration: .2
|
|
482
|
+
},
|
|
483
|
+
whileHover: { scale: 1.1 },
|
|
484
|
+
whileTap: { scale: .95 },
|
|
485
|
+
children: /* @__PURE__ */ T(e, { name: "delete" })
|
|
486
|
+
})
|
|
487
|
+
]
|
|
488
|
+
}, "preview")
|
|
489
|
+
}),
|
|
490
|
+
/* @__PURE__ */ T("input", {
|
|
491
|
+
ref: u,
|
|
492
|
+
type: "file",
|
|
493
|
+
accept: "image/*",
|
|
494
|
+
style: { display: "none" },
|
|
495
|
+
onChange: v
|
|
496
|
+
}),
|
|
497
|
+
f
|
|
498
|
+
]
|
|
499
|
+
});
|
|
500
|
+
});
|
|
501
|
+
Y.displayName = "UploadImage";
|
|
502
|
+
//#endregion
|
|
503
|
+
//#region src/components/Editor/commands/ImageCommands.ts
|
|
504
|
+
var X = c("INSERT_INLINE_IMAGE_COMMAND"), de = () => {
|
|
505
|
+
let { t: n } = t(), [i] = u(), [a, o] = F(!1), s = P(null), c = P(null), l = [{
|
|
506
|
+
key: "upload",
|
|
507
|
+
title: n("editor.uploadImage"),
|
|
508
|
+
icon: /* @__PURE__ */ T(e, { name: "picture" })
|
|
509
|
+
}, {
|
|
510
|
+
key: "url",
|
|
511
|
+
title: n("editor.imageUrl"),
|
|
512
|
+
icon: /* @__PURE__ */ T(e, { name: "Insertlink" })
|
|
513
|
+
}], [d, f] = F(l[0].key), p = () => l.findIndex((e) => e.key === d) * 40, m = async () => {
|
|
514
|
+
try {
|
|
515
|
+
let e = "", t = "";
|
|
516
|
+
if (d === "upload" && c.current) {
|
|
517
|
+
let n = await c.current.getValue();
|
|
518
|
+
e = n.src, t = n.fileName;
|
|
519
|
+
} else s.current && (e = await s.current.getValue(), t = e);
|
|
520
|
+
i.dispatchCommand(X, {
|
|
521
|
+
src: e,
|
|
522
|
+
altText: t
|
|
523
|
+
}), o(!1);
|
|
524
|
+
} catch (e) {
|
|
525
|
+
z.error(e instanceof Error ? e.message : n("editor.operationFailed"));
|
|
526
|
+
}
|
|
527
|
+
}, h = {
|
|
528
|
+
upload: /* @__PURE__ */ T(Y, { ref: c }),
|
|
529
|
+
url: /* @__PURE__ */ T(J, { ref: s })
|
|
530
|
+
};
|
|
531
|
+
return /* @__PURE__ */ E(w, { children: [/* @__PURE__ */ T(U, {
|
|
532
|
+
icon: "picture",
|
|
533
|
+
tooltip: n("picture"),
|
|
534
|
+
onClick: () => o(!0)
|
|
535
|
+
}), /* @__PURE__ */ E(r, {
|
|
536
|
+
title: n("addPicture"),
|
|
537
|
+
open: a,
|
|
538
|
+
onOpenChange: o,
|
|
539
|
+
width: "620px",
|
|
540
|
+
children: [/* @__PURE__ */ E("div", {
|
|
541
|
+
className: q["picture-modal__container"],
|
|
542
|
+
children: [/* @__PURE__ */ E("div", {
|
|
543
|
+
className: q["picture-modal__sidebar"],
|
|
544
|
+
children: [/* @__PURE__ */ T("div", {
|
|
545
|
+
className: q["picture-modal__slider"],
|
|
546
|
+
style: { transform: `translateY(${p()}px)` }
|
|
547
|
+
}), /* @__PURE__ */ T("ul", {
|
|
548
|
+
className: q["picture-modal__menu-list"],
|
|
549
|
+
children: l.map((e) => /* @__PURE__ */ E("li", {
|
|
550
|
+
className: `${q["picture-modal__menu-item"]} ${d === e.key ? q["picture-modal__menu-item--active"] : ""}`,
|
|
551
|
+
onClick: () => f(e.key),
|
|
552
|
+
children: [/* @__PURE__ */ T("span", {
|
|
553
|
+
className: q["picture-modal__menu-icon"],
|
|
554
|
+
children: e.icon
|
|
555
|
+
}), /* @__PURE__ */ T("span", { children: e.title })]
|
|
556
|
+
}, e.title))
|
|
557
|
+
})]
|
|
558
|
+
}), /* @__PURE__ */ T("div", {
|
|
559
|
+
className: q["picture-modal__content"],
|
|
560
|
+
children: h[d]
|
|
561
|
+
})]
|
|
562
|
+
}), /* @__PURE__ */ E("div", {
|
|
563
|
+
className: q["picture-modal__footer"],
|
|
564
|
+
children: [/* @__PURE__ */ T(I, {
|
|
565
|
+
onClick: () => o(!1),
|
|
566
|
+
children: n("cancel")
|
|
567
|
+
}), /* @__PURE__ */ T(I, {
|
|
568
|
+
type: "primary",
|
|
569
|
+
onClick: m,
|
|
570
|
+
children: n("confirm")
|
|
571
|
+
})]
|
|
572
|
+
})]
|
|
573
|
+
})] });
|
|
574
|
+
}, Z = /* @__PURE__ */ new Map(), Q = (e, t) => {
|
|
575
|
+
if (!e) throw Error("registerToolbarButton: name is required");
|
|
576
|
+
Z.set(e, t);
|
|
577
|
+
}, fe = (e) => {
|
|
578
|
+
Z.delete(e);
|
|
579
|
+
}, pe = (e) => Z.get(e), me = () => Array.from(Z.keys()), $ = {
|
|
580
|
+
bold: ne,
|
|
581
|
+
underline: re,
|
|
582
|
+
italic: ie,
|
|
583
|
+
fontSize: ae,
|
|
584
|
+
fontColor: oe,
|
|
585
|
+
fill: se,
|
|
586
|
+
align: ce,
|
|
587
|
+
link: le,
|
|
588
|
+
unLink: ue,
|
|
589
|
+
picture: de
|
|
590
|
+
};
|
|
591
|
+
Object.entries($).forEach(([e, t]) => {
|
|
592
|
+
Q(e, t);
|
|
593
|
+
});
|
|
594
|
+
//#endregion
|
|
595
|
+
export { fe as a, U as c, Q as i, V as l, pe as n, X as o, me as r, G as s, $ as t };
|
|
@@ -1,8 +1,14 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
import "../../../Icon/Icon-DppVOyPK.js";
|
|
2
|
+
import "../../../vendors/useLocale-BfT0V1j4.js";
|
|
3
|
+
import "../../../Modal/Modal-FVJpbEgw.js";
|
|
4
|
+
import "../../../ColorPicker/ColorPicker-BBP-4-so.js";
|
|
5
|
+
import "../../../vendors/tinycolor2-DToeAEPD.js";
|
|
6
|
+
import "../../../vendors/color-BPWy9DvT.js";
|
|
7
|
+
import "../../../Select/SelectInputSearch-CIXBNLFi.js";
|
|
8
|
+
import "../../../CheckBox/CheckBox--rXaUgMO.js";
|
|
9
|
+
import "../../../CheckBox/CheckBox-Db8X-pw9.js";
|
|
10
|
+
import "../../../NotFoundContent/NotFoundContent-CTPpcZOt.js";
|
|
11
|
+
import "../../../vendors/useFloatingPortal-BA6P5GxV.js";
|
|
12
|
+
import "../../../DropDown/DropDown-CKXi9mXN.js";
|
|
13
|
+
import { a as e, i as t, n, r, t as i } from "../../Buttons--dMLPuk2.js";
|
|
14
|
+
export { i as default, n as getToolbarButton, r as listRegisteredToolbarButtons, t as registerToolbarButton, e as unregisterToolbarButton };
|
|
@@ -1,20 +1,53 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
1
|
+
//#region src/components/Editor/constants/index.ts
|
|
2
|
+
var e = [
|
|
3
|
+
{
|
|
4
|
+
label: "12",
|
|
5
|
+
value: "12px"
|
|
6
|
+
},
|
|
7
|
+
{
|
|
8
|
+
label: "14",
|
|
9
|
+
value: "14px"
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
label: "16",
|
|
13
|
+
value: "16px"
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
label: "18",
|
|
17
|
+
value: "18px"
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
label: "20",
|
|
21
|
+
value: "20px"
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
label: "22",
|
|
25
|
+
value: "22px"
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
label: "24",
|
|
29
|
+
value: "24px"
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
label: "28",
|
|
33
|
+
value: "28px"
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
label: "32",
|
|
37
|
+
value: "32px"
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
label: "36",
|
|
41
|
+
value: "36px"
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
label: "64",
|
|
45
|
+
value: "64px"
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
label: "128",
|
|
49
|
+
value: "128px"
|
|
50
|
+
}
|
|
51
|
+
], t = "16px", n = "#000", r = "transparent";
|
|
52
|
+
//#endregion
|
|
53
|
+
export { r as DEFAULT_BACKGROUND_COLOR, n as DEFAULT_FONT_COLOR, t as DEFAULT_FONT_SIZE, e as FONT_SIZES };
|