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