@baishuyun/ui-base 6.9.0 → 6.10.0
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/Amap/AmapCircle/index.js +1 -1
- package/dist/Amap/AmapMarker/index.js +1 -1
- package/dist/Amap/AmapMarkerCluster/index.js +1 -1
- package/dist/Amap/AmapProvider/index.js +1 -1
- package/dist/Amap/hooks/index.js +1 -1
- package/dist/Amap/index.js +1 -1
- package/dist/Calendar/{AllDaySection-a96dIzs3.js → AllDaySection-DNsVyixx.js} +3 -3
- package/dist/Calendar/{Calendar-MghsGFZ0.js → Calendar-DL2X3z_z.js} +11 -11
- package/dist/Calendar/{CurrentTimeIndicator-CNKsVEXH.js → CurrentTimeIndicator-twXtFHIp.js} +1 -1
- package/dist/Calendar/{EventCard-B1LoBxth.js → EventCard-CvEnWcKd.js} +3 -3
- package/dist/Calendar/{TimeGrid-DIw8oCqY.js → TimeGrid-D62R57Bo.js} +1 -1
- package/dist/Calendar/context/index.js +2 -2
- package/dist/Calendar/index.js +17 -17
- package/dist/Calendar/subcomponents/AllDaySection/index.js +7 -7
- package/dist/Calendar/subcomponents/CurrentTimeIndicator/index.js +5 -5
- package/dist/Calendar/subcomponents/EventCard/index.js +6 -6
- package/dist/Calendar/subcomponents/TimeAxis/index.js +4 -4
- package/dist/Calendar/subcomponents/TimeGrid/index.js +3 -3
- package/dist/Calendar/{theme-xnrMsnkg.js → theme-BRVmxhqD.js} +2 -2
- package/dist/Calendar/utils/index.js +4 -4
- package/dist/Calendar/utils/layout/index.js +3 -3
- package/dist/Calendar/utils/theme/index.js +2 -2
- package/dist/Card/index.js +1 -1
- package/dist/CheckBox/{CheckBox-nBm0u6zX.js → CheckBox-CcM19LnP.js} +1 -1
- package/dist/CheckBox/index.js +3 -3
- package/dist/ColorPicker/ColorPicker-D3JuQ7a7.js +153 -0
- package/dist/ColorPicker/index.js +3 -4
- package/dist/ConfigProvider/index.js +1 -1
- package/dist/DatePicker/{DatePicker-uizefM92.js → DatePicker-Dah_CjYG.js} +5 -5
- package/dist/DatePicker/{DatePickerPanel-bbGVwlo7.js → DatePickerPanel-Bz3uvbYF.js} +3 -3
- package/dist/DatePicker/index.js +6 -6
- package/dist/DatePicker/style/index.js +2 -2
- package/dist/DatePicker/{style-CNtPPsZp.js → style-BwmM26RP.js} +1 -1
- package/dist/DropDown/{DropDown-yDH9V_9Y.js → DropDown-Daxr9BYf.js} +7 -7
- package/dist/DropDown/index.js +8 -8
- package/dist/DropDown/style/index.js +2 -2
- package/dist/DropDown/{style-Fdp-U4md.js → style-BSgosymi.js} +1 -1
- package/dist/Editor/Buttons-DG_-Sg_C.js +600 -0
- package/dist/Editor/ToolbarPlugin/Buttons/index.js +12 -13
- package/dist/Editor/constants/index.js +1 -1
- package/dist/Editor/index.js +194 -180
- package/dist/Gantt/GanttChart/index.js +15 -15
- package/dist/Gantt/{GanttChart-CDw1IQ4F.js → GanttChart-6gpw5vi6.js} +22 -24
- package/dist/Gantt/GanttTable/index.js +9 -9
- package/dist/Gantt/{GanttTable-xbXD_PWI.js → GanttTable-lVu-YUtt.js} +5 -5
- package/dist/Gantt/GanttToolBar/index.js +11 -11
- package/dist/Gantt/{GanttToolBar-BTeTsR6Z.js → GanttToolBar-CarBWZg-.js} +2 -2
- package/dist/Gantt/{collapseKeys-B4SOVHjd.js → collapseKeys-_ShTXPKt.js} +2 -2
- package/dist/Gantt/index.js +23 -23
- package/dist/Gantt/{theme-DLNvgM9X.js → theme-CiMD9Y6i.js} +1 -1
- package/dist/Gantt/{timelineViewConfig-9HArvbmb.js → timelineViewConfig-CLIpppp0.js} +1 -1
- package/dist/Gantt/utils/index.js +6 -6
- package/dist/Gantt/utils/theme/index.js +2 -2
- package/dist/Icon/index.js +1 -1
- package/dist/InputTag/{InputTag-hzCCJQ1z.js → InputTag-DxPO0DwD.js} +1 -1
- package/dist/InputTag/index.js +3 -3
- package/dist/Loading/index.js +2 -2
- package/dist/Modal/index.js +1 -1
- package/dist/NotFoundContent/index.js +2 -2
- package/dist/Radio/index.js +2 -2
- package/dist/ScrollBar/{ScrollBar-QhXVe8zd.js → ScrollBar-CnwYQfXM.js} +1 -1
- package/dist/ScrollBar/index.js +2 -2
- package/dist/Segmented/{Segmented-BDz1hMDT.js → Segmented-Ck2ZmfF7.js} +1 -1
- package/dist/Segmented/index.js +2 -2
- package/dist/Select/{Select-D6EK7whJ.js → Select-CBI5PgeQ.js} +10 -8
- package/dist/Select/index.js +11 -11
- package/dist/Table/{Table-yQXQEk6d.js → Table-CL-KfNY3.js} +4 -4
- package/dist/Table/hooks/index.js +2 -2
- package/dist/Table/{hooks-BceUZQQm.js → hooks-uCDY9dqx.js} +1 -1
- package/dist/Table/index.js +6 -6
- package/dist/Table/{processRowspan-B0WELhG2.js → processRowspan-nIGqGyHh.js} +1 -1
- package/dist/Table/style/index.js +2 -2
- package/dist/Table/{style-DgiPEsSp.js → style-x9xfw6te.js} +1 -1
- package/dist/Table/utils/index.js +2 -2
- package/dist/Tabs/Tabs-B1RsYb2W.js +409 -0
- package/dist/Tabs/index.js +3 -4
- package/dist/Tooltip/{Tooltip-Ch9lti_7.js → Tooltip-DWWWYn1a.js} +1 -1
- package/dist/Tooltip/index.js +2 -2
- package/dist/Tree/index.js +4 -4
- package/dist/Tree/utils/index.js +1 -1
- package/dist/components/ColorPicker/ColorPalettes.d.ts +1 -8
- package/dist/components/ColorPicker/ColorPicker.type.d.ts +5 -2
- package/dist/components/ColorPicker/constants.d.ts +3 -1
- package/dist/components/ColorPicker/index.d.ts +1 -1
- package/dist/components/Editor/ToolbarPlugin/Buttons/PictureButton/UploadImage.d.ts +5 -4
- package/dist/components/Editor/plugins/LinkColorPlugin.d.ts +2 -0
- package/dist/index.js +36 -37
- package/dist/style.css +1 -1
- package/dist/vendors/{Tree-DXmVRDn0.js → Tree-D1s-eADo.js} +2 -2
- package/dist/vendors/{version-D76DufO-.js → version-L-kG2La0.js} +1 -1
- package/package.json +1 -1
- package/dist/ColorPicker/ColorPicker-t1uBeATW.js +0 -155
- package/dist/Editor/Buttons-BhStZyIa.js +0 -620
- package/dist/Tabs/Tabs-BiKW70CL.js +0 -398
- package/dist/vendors/color-D6XBXROa.js +0 -12
- /package/dist/Calendar/{TimeAxis-C9e2BdYs.js → TimeAxis-D7bgZDKs.js} +0 -0
- /package/dist/Calendar/{colorUtils-CBLTsDX0.js → colorUtils-lXNjGoCk.js} +0 -0
- /package/dist/Calendar/{context-4tCN5X33.js → context-CBJnz0IH.js} +0 -0
- /package/dist/Calendar/{layout-Dz-grtu9.js → layout-BglMom3m.js} +0 -0
- /package/dist/CheckBox/{CheckBox-ByWSy9Yr.js → CheckBox-Bb0UuX1Y.js} +0 -0
- /package/dist/DatePicker/{ensureDayjsPlugins-Cn9Bkjkj.js → ensureDayjsPlugins-CVL-fnAl.js} +0 -0
- /package/dist/DatePicker/{pickerLocale-BRnNjLcv.js → pickerLocale-BeMlfhKu.js} +0 -0
- /package/dist/Gantt/{GanttHighlightContext-ChThr8ia.js → GanttHighlightContext-grda5bhd.js} +0 -0
- /package/dist/Gantt/{columnResize-jG0Wy2PC.js → columnResize-DV1tSBx_.js} +0 -0
- /package/dist/Gantt/{constants-LIz5jwed.js → constants-BObDP0h6.js} +0 -0
- /package/dist/Gantt/{highlightTarget-BpkYTonb.js → highlightTarget-DrP0_NrM.js} +0 -0
- /package/dist/Loading/{Loading-DiywS7ex.js → Loading-CVyzO5-s.js} +0 -0
- /package/dist/NotFoundContent/{NotFoundContent-BLmzWNBi.js → NotFoundContent-J-TEnljc.js} +0 -0
- /package/dist/Radio/{Radio-CX9cUqb7.js → Radio-CBUZ7DB5.js} +0 -0
- /package/dist/Select/{SelectInputSearch-COUzreau.js → SelectInputSearch-CrGW_eVo.js} +0 -0
- /package/dist/Table/{constants-kRpjsoet.js → constants-CcwjDbe7.js} +0 -0
- /package/dist/vendors/{animations-rwUbyoT0.js → animations-Mlw78WYo.js} +0 -0
- /package/dist/vendors/{cssVars-BYg1matG.js → cssVars-B8o94Yao.js} +0 -0
- /package/dist/vendors/{mergeRefs-Bsywq1Vo.js → mergeRefs-Bai1cIzv.js} +0 -0
- /package/dist/vendors/{useFloatingPortal-CmVJbuRm.js → useFloatingPortal-C8V67X0v.js} +0 -0
- /package/dist/vendors/{useLatchedPopupPortalRoot-4fVhqVT4.js → useLatchedPopupPortalRoot-hwf14FJ5.js} +0 -0
|
@@ -0,0 +1,600 @@
|
|
|
1
|
+
import { t as e } from "../Icon/Icon-BBDcb-yw.js";
|
|
2
|
+
import { t } from "../Modal/Modal-LiztSF7x.js";
|
|
3
|
+
import { t as n } from "../ColorPicker/ColorPicker-D3JuQ7a7.js";
|
|
4
|
+
import { t as r } from "../vendors/useLocale-BKZX2_zw.js";
|
|
5
|
+
import { t as i } from "../CheckBox/CheckBox-CcM19LnP.js";
|
|
6
|
+
import { t as a } from "../ScrollBar/ScrollBar-CnwYQfXM.js";
|
|
7
|
+
import { t as o } from "../DropDown/DropDown-Daxr9BYf.js";
|
|
8
|
+
import { FONT_SIZES as s } from "./constants/index.js";
|
|
9
|
+
import { AlignCenterOutlined as c, AlignLeftOutlined as l, AlignRightOutlined as u } from "@ant-design/icons";
|
|
10
|
+
import { Fragment as d, jsx as f, jsxs as p } from "react/jsx-runtime";
|
|
11
|
+
import m, { createContext as h, forwardRef as g, useCallback as _, useContext as v, useEffect as y, useImperativeHandle as b, useMemo as x, useRef as S, useState as C } from "react";
|
|
12
|
+
import { Button as w, Form as T, Input as E, message as D } from "antd";
|
|
13
|
+
import O from "clsx";
|
|
14
|
+
import { AnimatePresence as ee, motion as k } from "motion/react";
|
|
15
|
+
import { $createParagraphNode as te, $createTextNode as A, $getRoot as ne, $getSelection as j, $isElementNode as re, $isRangeSelection as M, $isTextNode as N, $setSelection as P, FORMAT_ELEMENT_COMMAND as ie, FORMAT_TEXT_COMMAND as F, createCommand as ae } from "lexical";
|
|
16
|
+
import { useLexicalComposerContext as I } from "@lexical/react/LexicalComposerContext";
|
|
17
|
+
import { $patchStyleText as L } from "@lexical/selection";
|
|
18
|
+
import { $createLinkNode as R, $toggleLink as oe, TOGGLE_LINK_COMMAND as se } from "@lexical/link";
|
|
19
|
+
//#region src/components/Editor/ToolbarPlugin/context/TextFormatsContext.tsx
|
|
20
|
+
var z = h(null), B = h({ iconSize: 14 }), ce = B.Provider, le = () => v(B), V = {
|
|
21
|
+
"lexical-editor__toolbar-button": "_lexical-editor__toolbar-button_gbe3v_1",
|
|
22
|
+
"lexical-editor__toolbar-button-active": "_lexical-editor__toolbar-button-active_gbe3v_12"
|
|
23
|
+
}, H = (t) => {
|
|
24
|
+
let { icon: n, tooltip: r, onClick: i, disabled: a = !1, active: o = !1, size: s } = t, { iconSize: c } = le(), l = s ?? c;
|
|
25
|
+
return /* @__PURE__ */ f("button", {
|
|
26
|
+
className: O(V["lexical-editor__toolbar-button"], { [V["lexical-editor__toolbar-button-active"]]: o }),
|
|
27
|
+
type: "button",
|
|
28
|
+
onClick: i,
|
|
29
|
+
onMouseDown: (e) => e.preventDefault(),
|
|
30
|
+
disabled: a,
|
|
31
|
+
title: r,
|
|
32
|
+
children: m.isValidElement(n) ? n : /* @__PURE__ */ f(e, {
|
|
33
|
+
name: n,
|
|
34
|
+
size: l
|
|
35
|
+
})
|
|
36
|
+
});
|
|
37
|
+
}, U = () => {
|
|
38
|
+
let e = v(z);
|
|
39
|
+
if (!e) throw Error("useTextFormatsContext must be used within TextFormatsProvider");
|
|
40
|
+
return e;
|
|
41
|
+
}, ue = () => {
|
|
42
|
+
let [e] = I(), t = U(), { t: n } = r(), i = t.bold;
|
|
43
|
+
return /* @__PURE__ */ f(H, {
|
|
44
|
+
icon: "bold",
|
|
45
|
+
tooltip: n("editor.bold"),
|
|
46
|
+
active: i,
|
|
47
|
+
onClick: () => {
|
|
48
|
+
e.dispatchCommand(F, "bold");
|
|
49
|
+
}
|
|
50
|
+
});
|
|
51
|
+
}, W = () => {
|
|
52
|
+
let [e] = I(), t = U(), { t: n } = r(), i = t.underline;
|
|
53
|
+
return /* @__PURE__ */ f(H, {
|
|
54
|
+
icon: "underline",
|
|
55
|
+
tooltip: n("editor.underline"),
|
|
56
|
+
active: i,
|
|
57
|
+
onClick: () => {
|
|
58
|
+
e.dispatchCommand(F, "underline");
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
}, de = () => {
|
|
62
|
+
let [e] = I(), t = U(), { t: n } = r(), i = t.italic;
|
|
63
|
+
return /* @__PURE__ */ f(H, {
|
|
64
|
+
icon: "italic",
|
|
65
|
+
tooltip: n("editor.italic"),
|
|
66
|
+
active: i,
|
|
67
|
+
onClick: () => {
|
|
68
|
+
e.dispatchCommand(F, "italic");
|
|
69
|
+
}
|
|
70
|
+
});
|
|
71
|
+
}, G = h(null), K = () => {
|
|
72
|
+
let e = v(G);
|
|
73
|
+
if (!e) throw Error("useEditorContainer must be used within EditorContainerProvider");
|
|
74
|
+
return e;
|
|
75
|
+
}, fe = () => {
|
|
76
|
+
let [e] = I(), { t } = r(), n = U(), { getPopupContainer: i } = K();
|
|
77
|
+
return /* @__PURE__ */ f(o, {
|
|
78
|
+
menus: x(() => s.map((e) => ({
|
|
79
|
+
key: e.value,
|
|
80
|
+
label: e.label
|
|
81
|
+
})), []),
|
|
82
|
+
onClick: _((t) => {
|
|
83
|
+
let n = t.key;
|
|
84
|
+
e.update(() => {
|
|
85
|
+
let e = j();
|
|
86
|
+
M(e) && L(e, { "font-size": n });
|
|
87
|
+
});
|
|
88
|
+
}, [e]),
|
|
89
|
+
activeKey: [n.fontSize],
|
|
90
|
+
showSearch: !1,
|
|
91
|
+
getPopupContainer: i,
|
|
92
|
+
style: {
|
|
93
|
+
width: "60px",
|
|
94
|
+
minWidth: "60px"
|
|
95
|
+
},
|
|
96
|
+
children: /* @__PURE__ */ f("div", {
|
|
97
|
+
className: "dropdown__trigger inline-flex",
|
|
98
|
+
children: /* @__PURE__ */ f(H, {
|
|
99
|
+
icon: "fontsize",
|
|
100
|
+
tooltip: t("editor.fontSize"),
|
|
101
|
+
active: !1
|
|
102
|
+
})
|
|
103
|
+
})
|
|
104
|
+
});
|
|
105
|
+
}, pe = () => {
|
|
106
|
+
let [e] = I(), t = U(), { t: i } = r(), { getPopupContainer: a } = K(), o = _((t) => {
|
|
107
|
+
e.update(() => {
|
|
108
|
+
let e = j();
|
|
109
|
+
M(e) && L(e, { color: t });
|
|
110
|
+
});
|
|
111
|
+
}, [e]);
|
|
112
|
+
return /* @__PURE__ */ f(n, {
|
|
113
|
+
value: t.fontColor,
|
|
114
|
+
onChange: o,
|
|
115
|
+
placement: "bottom-start",
|
|
116
|
+
presetColors: "basic",
|
|
117
|
+
getPopupContainer: a,
|
|
118
|
+
children: /* @__PURE__ */ f("div", {
|
|
119
|
+
className: "trigger-picker inline-flex",
|
|
120
|
+
children: /* @__PURE__ */ f(H, {
|
|
121
|
+
icon: "fontcolor",
|
|
122
|
+
tooltip: i("editor.fontColor"),
|
|
123
|
+
onClick: () => {},
|
|
124
|
+
active: !1
|
|
125
|
+
})
|
|
126
|
+
})
|
|
127
|
+
});
|
|
128
|
+
}, me = () => {
|
|
129
|
+
let [e] = I(), t = U(), { t: i } = r(), { getPopupContainer: a } = K(), o = _((t) => {
|
|
130
|
+
e.update(() => {
|
|
131
|
+
let e = j();
|
|
132
|
+
M(e) && L(e, { "background-color": t });
|
|
133
|
+
});
|
|
134
|
+
}, [e]);
|
|
135
|
+
return /* @__PURE__ */ f(n, {
|
|
136
|
+
value: t.backgroundColor,
|
|
137
|
+
onChange: o,
|
|
138
|
+
placement: "bottom-start",
|
|
139
|
+
presetColors: "basic",
|
|
140
|
+
getPopupContainer: a,
|
|
141
|
+
children: /* @__PURE__ */ f("div", {
|
|
142
|
+
className: "trigger-picker inline-flex",
|
|
143
|
+
children: /* @__PURE__ */ f(H, {
|
|
144
|
+
icon: "fill",
|
|
145
|
+
tooltip: i("editor.fill"),
|
|
146
|
+
onClick: () => {},
|
|
147
|
+
active: !1
|
|
148
|
+
})
|
|
149
|
+
})
|
|
150
|
+
});
|
|
151
|
+
}, he = () => {
|
|
152
|
+
let [e] = I(), { align: t } = U(), { t: n } = r(), { getPopupContainer: i } = K(), a = [
|
|
153
|
+
{
|
|
154
|
+
key: "left",
|
|
155
|
+
label: n("leftAlign"),
|
|
156
|
+
icon: /* @__PURE__ */ f(l, {})
|
|
157
|
+
},
|
|
158
|
+
{
|
|
159
|
+
key: "center",
|
|
160
|
+
label: n("editor.centerAlign"),
|
|
161
|
+
icon: /* @__PURE__ */ f(c, {})
|
|
162
|
+
},
|
|
163
|
+
{
|
|
164
|
+
key: "right",
|
|
165
|
+
label: n("editor.rightAlign"),
|
|
166
|
+
icon: /* @__PURE__ */ f(u, {})
|
|
167
|
+
}
|
|
168
|
+
], s = _((t) => {
|
|
169
|
+
e.dispatchCommand(ie, t);
|
|
170
|
+
}, [e]), d = a.map((e) => ({
|
|
171
|
+
key: e.key,
|
|
172
|
+
label: /* @__PURE__ */ p("div", {
|
|
173
|
+
className: "flex items-center gap-2",
|
|
174
|
+
children: [e.icon, /* @__PURE__ */ f("span", { children: e.label })]
|
|
175
|
+
})
|
|
176
|
+
})), m = _((e) => {
|
|
177
|
+
s(e.key);
|
|
178
|
+
}, [s]), h = a.find((e) => e.key === t)?.icon || /* @__PURE__ */ f(l, {});
|
|
179
|
+
return /* @__PURE__ */ f(o, {
|
|
180
|
+
menus: d,
|
|
181
|
+
onClick: m,
|
|
182
|
+
showSearch: !1,
|
|
183
|
+
activeKey: [t],
|
|
184
|
+
getPopupContainer: i,
|
|
185
|
+
style: {
|
|
186
|
+
width: "110px",
|
|
187
|
+
minWidth: "110px"
|
|
188
|
+
},
|
|
189
|
+
children: /* @__PURE__ */ f("div", {
|
|
190
|
+
className: "trigger-dropdown inline-flex text-sm",
|
|
191
|
+
children: /* @__PURE__ */ f(H, {
|
|
192
|
+
icon: h,
|
|
193
|
+
tooltip: n("editor.alignment"),
|
|
194
|
+
onClick: () => {},
|
|
195
|
+
active: !1
|
|
196
|
+
})
|
|
197
|
+
})
|
|
198
|
+
});
|
|
199
|
+
};
|
|
200
|
+
//#endregion
|
|
201
|
+
//#region src/components/Editor/ToolbarPlugin/Buttons/LinkButton.tsx
|
|
202
|
+
function ge(e) {
|
|
203
|
+
return e ? e.startsWith("@") ? "javascript:void(0);" : e.match(/^https?:\/\//) ? e : `http://${e}` : "";
|
|
204
|
+
}
|
|
205
|
+
var _e = () => {
|
|
206
|
+
let [e] = I(), { link: n } = U(), { t: a } = r(), [o, s] = C(!1), [c, l] = C(""), [u, m] = C(""), [h, g] = C(!0), [v, y] = D.useMessage(), b = S(null), x = _((t) => {
|
|
207
|
+
s(t), t || e.setEditable(!0);
|
|
208
|
+
}, [e]), T = () => {
|
|
209
|
+
if (!c) {
|
|
210
|
+
v.warning(a("editor.linkAddressEmpty"));
|
|
211
|
+
return;
|
|
212
|
+
}
|
|
213
|
+
let t = ge(c);
|
|
214
|
+
e.setEditable(!0), e.update(() => {
|
|
215
|
+
let e = h ? {
|
|
216
|
+
target: "_blank",
|
|
217
|
+
rel: "noopener noreferrer",
|
|
218
|
+
title: c
|
|
219
|
+
} : { title: c }, n = b.current;
|
|
220
|
+
n !== null && P(n);
|
|
221
|
+
let r = j();
|
|
222
|
+
if (M(r)) {
|
|
223
|
+
let n = u || c, i = r.getTextContent();
|
|
224
|
+
if (!r.isCollapsed() && n === i) oe(t, e);
|
|
225
|
+
else {
|
|
226
|
+
let i = r.anchor.getNode(), a = N(i) ? i : null, o = r.style || r.getNodes().find(N)?.getStyle() || a?.getStyle() || "", s = r.format || a?.getFormat() || 0, c = R(t, e), l = A(n);
|
|
227
|
+
l.setFormat(s), l.setStyle(o), c.append(l), r.insertNodes([c]);
|
|
228
|
+
}
|
|
229
|
+
} else {
|
|
230
|
+
let n = R(t, e);
|
|
231
|
+
n.append(A(u || c));
|
|
232
|
+
let r = ne(), i = r.getLastChild();
|
|
233
|
+
if (re(i) && i.isEmpty()) i.append(n);
|
|
234
|
+
else {
|
|
235
|
+
let e = te();
|
|
236
|
+
e.append(n), r.append(e);
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
}), b.current = null, l(""), m(""), x(!1);
|
|
240
|
+
}, O = _(() => {
|
|
241
|
+
let t = "";
|
|
242
|
+
e.getEditorState().read(() => {
|
|
243
|
+
let e = j();
|
|
244
|
+
b.current = e ? e.clone() : null, M(e) && !e.isCollapsed() && (t = e.getTextContent());
|
|
245
|
+
}), e.setEditable(!1), e.update(() => {
|
|
246
|
+
P(null);
|
|
247
|
+
}), window.getSelection()?.removeAllRanges(), e.getRootElement()?.blur(), n ? (l(n.link === "javascript:void(0);" ? "" : n.link ?? ""), m(n.linkText ?? "")) : (l(""), m(t)), s(!0);
|
|
248
|
+
}, [n, e]);
|
|
249
|
+
return /* @__PURE__ */ p(d, { children: [
|
|
250
|
+
/* @__PURE__ */ f(H, {
|
|
251
|
+
icon: "Insertlink",
|
|
252
|
+
tooltip: a("link"),
|
|
253
|
+
onClick: O,
|
|
254
|
+
active: !!n?.link
|
|
255
|
+
}),
|
|
256
|
+
y,
|
|
257
|
+
/* @__PURE__ */ f(t, {
|
|
258
|
+
title: a("link"),
|
|
259
|
+
open: o,
|
|
260
|
+
onOpenChange: x,
|
|
261
|
+
children: /* @__PURE__ */ p("div", { children: [/* @__PURE__ */ p("div", {
|
|
262
|
+
className: "px-[20px] pb-[60px] pt-[40px]",
|
|
263
|
+
children: [/* @__PURE__ */ p("div", {
|
|
264
|
+
className: "flex items-center relative",
|
|
265
|
+
children: [
|
|
266
|
+
/* @__PURE__ */ f("label", {
|
|
267
|
+
className: "w-[80px] shrink-0",
|
|
268
|
+
children: a("linkAddress")
|
|
269
|
+
}),
|
|
270
|
+
/* @__PURE__ */ f(E, {
|
|
271
|
+
value: c,
|
|
272
|
+
onChange: (e) => l(e.target.value),
|
|
273
|
+
placeholder: a("editor.linkTip")
|
|
274
|
+
}),
|
|
275
|
+
/* @__PURE__ */ f("div", {
|
|
276
|
+
className: "absolute bottom-[-30px] left-[80px]",
|
|
277
|
+
children: /* @__PURE__ */ f("p", {
|
|
278
|
+
className: "text-[#999]",
|
|
279
|
+
children: a("editor.linkAliasTip")
|
|
280
|
+
})
|
|
281
|
+
})
|
|
282
|
+
]
|
|
283
|
+
}), /* @__PURE__ */ p("div", {
|
|
284
|
+
className: "flex items-center mt-[40px]",
|
|
285
|
+
children: [/* @__PURE__ */ f("label", {
|
|
286
|
+
className: "w-[80px] shrink-0",
|
|
287
|
+
children: a("showContent")
|
|
288
|
+
}), /* @__PURE__ */ f(E, {
|
|
289
|
+
value: u,
|
|
290
|
+
onChange: (e) => m(e.target.value)
|
|
291
|
+
})]
|
|
292
|
+
})]
|
|
293
|
+
}), /* @__PURE__ */ p("div", {
|
|
294
|
+
className: "py-[14px] px-[20px] flex justify-between items-center border-t-[1px] border-solid border-[#e0e0e0]",
|
|
295
|
+
children: [/* @__PURE__ */ f("div", { children: /* @__PURE__ */ f(i, {
|
|
296
|
+
checked: h,
|
|
297
|
+
onChange: (e) => g(e),
|
|
298
|
+
children: a("openInNewTab")
|
|
299
|
+
}) }), /* @__PURE__ */ p("div", {
|
|
300
|
+
className: "flex gap-[15px]",
|
|
301
|
+
children: [/* @__PURE__ */ f(w, {
|
|
302
|
+
onClick: () => x(!1),
|
|
303
|
+
children: a("cancel")
|
|
304
|
+
}), /* @__PURE__ */ f(w, {
|
|
305
|
+
type: "primary",
|
|
306
|
+
onClick: T,
|
|
307
|
+
children: a("confirm")
|
|
308
|
+
})]
|
|
309
|
+
})]
|
|
310
|
+
})] })
|
|
311
|
+
})
|
|
312
|
+
] });
|
|
313
|
+
}, ve = () => {
|
|
314
|
+
let [e] = I(), { link: t } = U(), { t: n } = r();
|
|
315
|
+
return /* @__PURE__ */ f(H, {
|
|
316
|
+
icon: "cancellink",
|
|
317
|
+
tooltip: n("cancelLink"),
|
|
318
|
+
onClick: () => {
|
|
319
|
+
t && e.dispatchCommand(se, null);
|
|
320
|
+
}
|
|
321
|
+
});
|
|
322
|
+
}, q = {
|
|
323
|
+
"picture-modal__container": "_picture-modal__container_dz4c0_1",
|
|
324
|
+
"picture-modal__sidebar": "_picture-modal__sidebar_dz4c0_4",
|
|
325
|
+
"picture-modal__menu-list": "_picture-modal__menu-list_dz4c0_8",
|
|
326
|
+
"picture-modal__menu-item": "_picture-modal__menu-item_dz4c0_13",
|
|
327
|
+
"picture-modal__menu-item--active": "_picture-modal__menu-item--active_dz4c0_22",
|
|
328
|
+
"picture-modal__content": "_picture-modal__content_dz4c0_25",
|
|
329
|
+
"picture-modal__content-body": "_picture-modal__content-body_dz4c0_31",
|
|
330
|
+
"picture-modal__ops": "_picture-modal__ops_dz4c0_34",
|
|
331
|
+
"picture-modal__content-title": "_picture-modal__content-title_dz4c0_42",
|
|
332
|
+
"picture-modal__upload-area": "_picture-modal__upload-area_dz4c0_53",
|
|
333
|
+
"picture-modal__upload-area--dragging": "_picture-modal__upload-area--dragging_dz4c0_69",
|
|
334
|
+
"picture-modal__preview-list": "_picture-modal__preview-list_dz4c0_75",
|
|
335
|
+
"picture-modal__preview": "_picture-modal__preview_dz4c0_75",
|
|
336
|
+
"picture-modal__preview-image": "_picture-modal__preview-image_dz4c0_89",
|
|
337
|
+
"picture-modal__preview-info": "_picture-modal__preview-info_dz4c0_102",
|
|
338
|
+
"picture-modal__preview-filename": "_picture-modal__preview-filename_dz4c0_106",
|
|
339
|
+
"picture-modal__preview-size": "_picture-modal__preview-size_dz4c0_112",
|
|
340
|
+
"picture-modal__preview-delete": "_picture-modal__preview-delete_dz4c0_116",
|
|
341
|
+
"picture-modal__upload-text": "_picture-modal__upload-text_dz4c0_124",
|
|
342
|
+
"picture-modal__footer": "_picture-modal__footer_dz4c0_128"
|
|
343
|
+
}, J = g((e, t) => {
|
|
344
|
+
let [n] = T.useForm(), [i, a] = C(""), { t: o } = r(), s = (e) => /^https?:\/\/.+/i.test(e);
|
|
345
|
+
return b(t, () => ({ getValue: async () => {
|
|
346
|
+
try {
|
|
347
|
+
return await n.validateFields(), i;
|
|
348
|
+
} catch {
|
|
349
|
+
throw Error("URL validation failed");
|
|
350
|
+
}
|
|
351
|
+
} })), /* @__PURE__ */ p(d, { children: [/* @__PURE__ */ f("div", {
|
|
352
|
+
className: q["picture-modal__content-title"],
|
|
353
|
+
"data-title": o("editor.imageUrlNote"),
|
|
354
|
+
children: o("editor.enterImageUrl")
|
|
355
|
+
}), /* @__PURE__ */ f(T, {
|
|
356
|
+
form: n,
|
|
357
|
+
children: /* @__PURE__ */ f(T.Item, {
|
|
358
|
+
name: "url",
|
|
359
|
+
rules: [{
|
|
360
|
+
required: !0,
|
|
361
|
+
message: o("editor.pleaseEnterImageUrl")
|
|
362
|
+
}, { validator: (e, t) => !t || s(t) ? Promise.resolve() : Promise.reject(Error(o("editor.pleaseEnterValidImageUrl"))) }],
|
|
363
|
+
children: /* @__PURE__ */ f(E, {
|
|
364
|
+
placeholder: o("editor.pleaseEnterImageUrl"),
|
|
365
|
+
value: i,
|
|
366
|
+
onChange: (e) => a(e.target.value)
|
|
367
|
+
})
|
|
368
|
+
})
|
|
369
|
+
})] });
|
|
370
|
+
});
|
|
371
|
+
J.displayName = "LinkInput";
|
|
372
|
+
//#endregion
|
|
373
|
+
//#region src/components/Editor/ToolbarPlugin/Buttons/PictureButton/UploadImage.tsx
|
|
374
|
+
var ye = (e) => new Promise((t, n) => {
|
|
375
|
+
let r = new FileReader();
|
|
376
|
+
r.onload = () => t(r.result), r.onerror = () => n(r.error), r.readAsDataURL(e);
|
|
377
|
+
}), Y = g((t, n) => {
|
|
378
|
+
let [i, a] = C(!1), [o, s] = C([]), c = S(o);
|
|
379
|
+
c.current = o;
|
|
380
|
+
let l = S(null), [u, d] = D.useMessage(), { t: m } = r(), h = (e) => (e / 1024).toFixed(1) + "kb", g = (e) => e.type.startsWith("image/") ? e.size > 1048576 ? (u.warning(m("editor.imageSizeNote")), !1) : !0 : (u.warning(m("editor.onlyImageFormatsSupported")), !1), _ = (e) => {
|
|
381
|
+
let t = Array.from(e).filter(g).map((e) => ({
|
|
382
|
+
id: `${e.name}-${e.size}-${e.lastModified}-${Math.random()}`,
|
|
383
|
+
file: e,
|
|
384
|
+
url: URL.createObjectURL(e)
|
|
385
|
+
}));
|
|
386
|
+
t.length && s((e) => [...e, ...t]);
|
|
387
|
+
}, v = (e) => {
|
|
388
|
+
s((t) => {
|
|
389
|
+
let n = t.find((t) => t.id === e);
|
|
390
|
+
return n && URL.revokeObjectURL(n.url), t.filter((t) => t.id !== e);
|
|
391
|
+
});
|
|
392
|
+
}, x = () => {
|
|
393
|
+
l.current?.click();
|
|
394
|
+
}, w = (e) => {
|
|
395
|
+
e.target.files?.length && _(e.target.files), e.target.value = "";
|
|
396
|
+
};
|
|
397
|
+
return y(() => () => {
|
|
398
|
+
c.current.forEach((e) => URL.revokeObjectURL(e.url));
|
|
399
|
+
}, []), b(n, () => ({ getValue: async () => {
|
|
400
|
+
if (!o.length) throw u.warning(m("editor.pleaseUploadImageFirst")), Error(m("editor.pleaseUploadImageFirst"));
|
|
401
|
+
try {
|
|
402
|
+
return await Promise.all(o.map(async (e) => ({
|
|
403
|
+
src: await ye(e.file),
|
|
404
|
+
fileName: e.file.name
|
|
405
|
+
})));
|
|
406
|
+
} catch {
|
|
407
|
+
throw Error(m("editor.operationFailed"));
|
|
408
|
+
}
|
|
409
|
+
} }), [
|
|
410
|
+
o,
|
|
411
|
+
u,
|
|
412
|
+
m
|
|
413
|
+
]), /* @__PURE__ */ p("div", {
|
|
414
|
+
onDragOver: (e) => {
|
|
415
|
+
e.preventDefault(), a(!0);
|
|
416
|
+
},
|
|
417
|
+
onDragLeave: (e) => {
|
|
418
|
+
e.preventDefault(), a(!1);
|
|
419
|
+
},
|
|
420
|
+
onDrop: (e) => {
|
|
421
|
+
e.preventDefault(), a(!1), e.dataTransfer.files.length && _(e.dataTransfer.files);
|
|
422
|
+
},
|
|
423
|
+
children: [
|
|
424
|
+
/* @__PURE__ */ p("div", {
|
|
425
|
+
className: q["picture-modal__ops"],
|
|
426
|
+
children: [/* @__PURE__ */ f("div", {
|
|
427
|
+
className: q["picture-modal__content-title"],
|
|
428
|
+
"data-title": m("editor.imageSizeNote"),
|
|
429
|
+
children: m("editor.uploadImage")
|
|
430
|
+
}), /* @__PURE__ */ p("div", {
|
|
431
|
+
className: `${q["picture-modal__upload-area"]} ${i ? q["picture-modal__upload-area--dragging"] : ""}`,
|
|
432
|
+
onClick: x,
|
|
433
|
+
children: [/* @__PURE__ */ f(e, { name: "upload" }), /* @__PURE__ */ f("span", {
|
|
434
|
+
className: q["picture-modal__upload-text"],
|
|
435
|
+
children: m("editor.clickOrDragToUpload")
|
|
436
|
+
})]
|
|
437
|
+
})]
|
|
438
|
+
}),
|
|
439
|
+
o.length > 0 ? /* @__PURE__ */ f("div", {
|
|
440
|
+
className: q["picture-modal__preview-list"],
|
|
441
|
+
children: /* @__PURE__ */ f(ee, { children: o.map((t) => /* @__PURE__ */ p(k.div, {
|
|
442
|
+
className: q["picture-modal__preview"],
|
|
443
|
+
initial: {
|
|
444
|
+
opacity: 0,
|
|
445
|
+
y: 12
|
|
446
|
+
},
|
|
447
|
+
animate: {
|
|
448
|
+
opacity: 1,
|
|
449
|
+
y: 0
|
|
450
|
+
},
|
|
451
|
+
exit: {
|
|
452
|
+
opacity: 0,
|
|
453
|
+
y: -8
|
|
454
|
+
},
|
|
455
|
+
transition: {
|
|
456
|
+
duration: .2,
|
|
457
|
+
ease: [
|
|
458
|
+
.4,
|
|
459
|
+
0,
|
|
460
|
+
.2,
|
|
461
|
+
1
|
|
462
|
+
]
|
|
463
|
+
},
|
|
464
|
+
children: [
|
|
465
|
+
/* @__PURE__ */ f("div", {
|
|
466
|
+
className: q["picture-modal__preview-image"],
|
|
467
|
+
children: /* @__PURE__ */ f("img", {
|
|
468
|
+
src: t.url,
|
|
469
|
+
alt: m("editor.previewImage")
|
|
470
|
+
})
|
|
471
|
+
}),
|
|
472
|
+
/* @__PURE__ */ p("div", {
|
|
473
|
+
className: q["picture-modal__preview-info"],
|
|
474
|
+
children: [/* @__PURE__ */ f("div", {
|
|
475
|
+
className: q["picture-modal__preview-filename"],
|
|
476
|
+
children: t.file.name
|
|
477
|
+
}), /* @__PURE__ */ f("div", {
|
|
478
|
+
className: q["picture-modal__preview-size"],
|
|
479
|
+
children: h(t.file.size)
|
|
480
|
+
})]
|
|
481
|
+
}),
|
|
482
|
+
/* @__PURE__ */ f("div", {
|
|
483
|
+
className: q["picture-modal__preview-delete"],
|
|
484
|
+
role: "button",
|
|
485
|
+
onClick: () => v(t.id),
|
|
486
|
+
children: /* @__PURE__ */ f(e, { name: "delete" })
|
|
487
|
+
})
|
|
488
|
+
]
|
|
489
|
+
}, t.id)) })
|
|
490
|
+
}) : null,
|
|
491
|
+
/* @__PURE__ */ f("input", {
|
|
492
|
+
ref: l,
|
|
493
|
+
type: "file",
|
|
494
|
+
accept: "image/*",
|
|
495
|
+
multiple: !0,
|
|
496
|
+
style: { display: "none" },
|
|
497
|
+
onChange: w
|
|
498
|
+
}),
|
|
499
|
+
d
|
|
500
|
+
]
|
|
501
|
+
});
|
|
502
|
+
});
|
|
503
|
+
Y.displayName = "UploadImage";
|
|
504
|
+
//#endregion
|
|
505
|
+
//#region src/components/Editor/commands/ImageCommands.ts
|
|
506
|
+
var X = ae("INSERT_INLINE_IMAGE_COMMAND"), be = () => {
|
|
507
|
+
let { t: n } = r(), [i] = I(), [o, s] = C(!1), c = S(null), l = S(null), u = [{
|
|
508
|
+
key: "upload",
|
|
509
|
+
title: n("editor.uploadImage"),
|
|
510
|
+
icon: /* @__PURE__ */ f(e, { name: "picture" })
|
|
511
|
+
}, {
|
|
512
|
+
key: "url",
|
|
513
|
+
title: n("editor.imageUrl"),
|
|
514
|
+
icon: /* @__PURE__ */ f(e, { name: "Insertlink" })
|
|
515
|
+
}], [m, h] = C(u[0].key), g = async () => {
|
|
516
|
+
try {
|
|
517
|
+
if (m === "upload" && l.current) (await l.current.getValue()).forEach((e) => {
|
|
518
|
+
i.dispatchCommand(X, {
|
|
519
|
+
src: e.src,
|
|
520
|
+
altText: e.fileName
|
|
521
|
+
});
|
|
522
|
+
});
|
|
523
|
+
else if (c.current) {
|
|
524
|
+
let e = await c.current.getValue();
|
|
525
|
+
i.dispatchCommand(X, {
|
|
526
|
+
src: e,
|
|
527
|
+
altText: e
|
|
528
|
+
});
|
|
529
|
+
}
|
|
530
|
+
s(!1);
|
|
531
|
+
} catch (e) {
|
|
532
|
+
D.error(e instanceof Error ? e.message : n("editor.operationFailed"));
|
|
533
|
+
}
|
|
534
|
+
}, _ = {
|
|
535
|
+
upload: /* @__PURE__ */ f(Y, { ref: l }),
|
|
536
|
+
url: /* @__PURE__ */ f(J, { ref: c })
|
|
537
|
+
};
|
|
538
|
+
return /* @__PURE__ */ p(d, { children: [/* @__PURE__ */ f(H, {
|
|
539
|
+
icon: "picture",
|
|
540
|
+
tooltip: n("picture"),
|
|
541
|
+
onClick: () => s(!0)
|
|
542
|
+
}), /* @__PURE__ */ p(t, {
|
|
543
|
+
title: n("addPicture"),
|
|
544
|
+
open: o,
|
|
545
|
+
onOpenChange: s,
|
|
546
|
+
width: "620px",
|
|
547
|
+
children: [/* @__PURE__ */ p("div", {
|
|
548
|
+
className: q["picture-modal__container"],
|
|
549
|
+
children: [/* @__PURE__ */ f("div", {
|
|
550
|
+
className: q["picture-modal__sidebar"],
|
|
551
|
+
children: /* @__PURE__ */ f("ul", {
|
|
552
|
+
className: q["picture-modal__menu-list"],
|
|
553
|
+
children: u.map((e) => /* @__PURE__ */ p("li", {
|
|
554
|
+
className: `${q["picture-modal__menu-item"]} ${m === e.key ? q["picture-modal__menu-item--active"] : ""}`,
|
|
555
|
+
onClick: () => h(e.key),
|
|
556
|
+
children: [/* @__PURE__ */ f("span", {
|
|
557
|
+
className: q["picture-modal__menu-icon"],
|
|
558
|
+
children: e.icon
|
|
559
|
+
}), /* @__PURE__ */ f("span", { children: e.title })]
|
|
560
|
+
}, e.title))
|
|
561
|
+
})
|
|
562
|
+
}), /* @__PURE__ */ f(a, {
|
|
563
|
+
className: q["picture-modal__content"],
|
|
564
|
+
contentClassName: q["picture-modal__content-body"],
|
|
565
|
+
children: _[m]
|
|
566
|
+
})]
|
|
567
|
+
}), /* @__PURE__ */ p("div", {
|
|
568
|
+
className: q["picture-modal__footer"],
|
|
569
|
+
children: [/* @__PURE__ */ f(w, {
|
|
570
|
+
onClick: () => s(!1),
|
|
571
|
+
children: n("cancel")
|
|
572
|
+
}), /* @__PURE__ */ f(w, {
|
|
573
|
+
type: "primary",
|
|
574
|
+
onClick: g,
|
|
575
|
+
children: n("confirm")
|
|
576
|
+
})]
|
|
577
|
+
})]
|
|
578
|
+
})] });
|
|
579
|
+
}, Z = /* @__PURE__ */ new Map(), Q = (e, t) => {
|
|
580
|
+
if (!e) throw Error("registerToolbarButton: name is required");
|
|
581
|
+
Z.set(e, t);
|
|
582
|
+
}, xe = (e) => {
|
|
583
|
+
Z.delete(e);
|
|
584
|
+
}, Se = (e) => Z.get(e), Ce = () => Array.from(Z.keys()), $ = {
|
|
585
|
+
bold: ue,
|
|
586
|
+
underline: W,
|
|
587
|
+
italic: de,
|
|
588
|
+
fontSize: fe,
|
|
589
|
+
fontColor: pe,
|
|
590
|
+
fill: me,
|
|
591
|
+
align: he,
|
|
592
|
+
link: _e,
|
|
593
|
+
unLink: ve,
|
|
594
|
+
picture: be
|
|
595
|
+
};
|
|
596
|
+
Object.entries($).forEach(([e, t]) => {
|
|
597
|
+
Q(e, t);
|
|
598
|
+
});
|
|
599
|
+
//#endregion
|
|
600
|
+
export { xe as a, K as c, z as d, Q as i, H as l, Se as n, X as o, Ce as r, G as s, $ as t, ce as u };
|
|
@@ -1,20 +1,19 @@
|
|
|
1
|
-
import "../../../vendors/version-
|
|
1
|
+
import "../../../vendors/version-L-kG2La0.js";
|
|
2
2
|
import "../../../ScrollBar/style-D26azwz6.js";
|
|
3
3
|
import "../../../Icon/Icon-BBDcb-yw.js";
|
|
4
4
|
import "../../../vendors/LocaleContext-Dcw6C1LX.js";
|
|
5
5
|
import "../../../Modal/Modal-LiztSF7x.js";
|
|
6
|
-
import "../../../ColorPicker/ColorPicker-
|
|
6
|
+
import "../../../ColorPicker/ColorPicker-D3JuQ7a7.js";
|
|
7
7
|
import "../../../vendors/useFloatingOverlay-BApqkHSu.js";
|
|
8
8
|
import "../../../vendors/useLocale-BKZX2_zw.js";
|
|
9
|
-
import "../../../vendors/
|
|
10
|
-
import "../../../
|
|
11
|
-
import "../../../
|
|
12
|
-
import "../../../CheckBox/CheckBox-
|
|
13
|
-
import "../../../
|
|
14
|
-
import "../../../
|
|
15
|
-
import "../../../
|
|
16
|
-
import "../../../
|
|
17
|
-
import "../../../DropDown/
|
|
18
|
-
import "
|
|
19
|
-
import { a as e, i as t, n, r, t as i } from "../../Buttons-BhStZyIa.js";
|
|
9
|
+
import "../../../vendors/useLatchedPopupPortalRoot-hwf14FJ5.js";
|
|
10
|
+
import "../../../Select/SelectInputSearch-CrGW_eVo.js";
|
|
11
|
+
import "../../../CheckBox/CheckBox-Bb0UuX1Y.js";
|
|
12
|
+
import "../../../CheckBox/CheckBox-CcM19LnP.js";
|
|
13
|
+
import "../../../NotFoundContent/NotFoundContent-J-TEnljc.js";
|
|
14
|
+
import "../../../ScrollBar/ScrollBar-CnwYQfXM.js";
|
|
15
|
+
import "../../../vendors/useFloatingPortal-C8V67X0v.js";
|
|
16
|
+
import "../../../DropDown/DropDown-Daxr9BYf.js";
|
|
17
|
+
import "../../../DropDown/style-BSgosymi.js";
|
|
18
|
+
import { a as e, i as t, n, r, t as i } from "../../Buttons-DG_-Sg_C.js";
|
|
20
19
|
export { i as default, n as getToolbarButton, r as listRegisteredToolbarButtons, t as registerToolbarButton, e as unregisterToolbarButton };
|