@baishuyun/ui-base 6.9.1 → 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-Bcs9mxET.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--kMNwM9Q.js → DatePicker-Dah_CjYG.js} +5 -5
- package/dist/DatePicker/{DatePickerPanel-C_TDG3HH.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-DjwZsxEj.js → GanttChart-6gpw5vi6.js} +7 -7
- 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-DiV_Cnd8.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
|
@@ -1,620 +0,0 @@
|
|
|
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-t1uBeATW.js";
|
|
4
|
-
import { t as r } from "../vendors/useLocale-BKZX2_zw.js";
|
|
5
|
-
import { t as i } from "../CheckBox/CheckBox-nBm0u6zX.js";
|
|
6
|
-
import { t as a } from "../DropDown/DropDown-yDH9V_9Y.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 { Button as S, Form as C, Input as w, message as T } from "antd";
|
|
12
|
-
import E from "clsx";
|
|
13
|
-
import { AnimatePresence as D, motion as O } from "motion/react";
|
|
14
|
-
import { $createParagraphNode as ee, $createTextNode as k, $getRoot as A, $getSelection as j, $isElementNode as te, $isRangeSelection as M, $isTextNode as N, $setSelection as P, FORMAT_ELEMENT_COMMAND as F, FORMAT_TEXT_COMMAND as I, createCommand as ne } from "lexical";
|
|
15
|
-
import { useLexicalComposerContext as L } from "@lexical/react/LexicalComposerContext";
|
|
16
|
-
import { $patchStyleText as R } from "@lexical/selection";
|
|
17
|
-
import { $createLinkNode as z, $toggleLink as re, TOGGLE_LINK_COMMAND as ie } from "@lexical/link";
|
|
18
|
-
//#region src/components/Editor/ToolbarPlugin/context/TextFormatsContext.tsx
|
|
19
|
-
var B = m(null), V = m({ iconSize: 14 }), ae = V.Provider, oe = () => _(V), H = {
|
|
20
|
-
"lexical-editor__toolbar-button": "_lexical-editor__toolbar-button_gbe3v_1",
|
|
21
|
-
"lexical-editor__toolbar-button-active": "_lexical-editor__toolbar-button-active_gbe3v_12"
|
|
22
|
-
}, U = (t) => {
|
|
23
|
-
let { icon: n, tooltip: r, onClick: i, disabled: a = !1, active: o = !1, size: s } = t, { iconSize: c } = oe(), l = s ?? c;
|
|
24
|
-
return /* @__PURE__ */ d("button", {
|
|
25
|
-
className: E(H["lexical-editor__toolbar-button"], { [H["lexical-editor__toolbar-button-active"]]: o }),
|
|
26
|
-
type: "button",
|
|
27
|
-
onClick: i,
|
|
28
|
-
onMouseDown: (e) => e.preventDefault(),
|
|
29
|
-
disabled: a,
|
|
30
|
-
title: r,
|
|
31
|
-
children: p.isValidElement(n) ? n : /* @__PURE__ */ d(e, {
|
|
32
|
-
name: n,
|
|
33
|
-
size: l
|
|
34
|
-
})
|
|
35
|
-
});
|
|
36
|
-
}, W = () => {
|
|
37
|
-
let e = _(B);
|
|
38
|
-
if (!e) throw Error("useTextFormatsContext must be used within TextFormatsProvider");
|
|
39
|
-
return e;
|
|
40
|
-
}, se = () => {
|
|
41
|
-
let [e] = L(), t = W(), { t: n } = r(), i = t.bold;
|
|
42
|
-
return /* @__PURE__ */ d(U, {
|
|
43
|
-
icon: "bold",
|
|
44
|
-
tooltip: n("editor.bold"),
|
|
45
|
-
active: i,
|
|
46
|
-
onClick: () => {
|
|
47
|
-
e.dispatchCommand(I, "bold");
|
|
48
|
-
}
|
|
49
|
-
});
|
|
50
|
-
}, ce = () => {
|
|
51
|
-
let [e] = L(), t = W(), { t: n } = r(), i = t.underline;
|
|
52
|
-
return /* @__PURE__ */ d(U, {
|
|
53
|
-
icon: "underline",
|
|
54
|
-
tooltip: n("editor.underline"),
|
|
55
|
-
active: i,
|
|
56
|
-
onClick: () => {
|
|
57
|
-
e.dispatchCommand(I, "underline");
|
|
58
|
-
}
|
|
59
|
-
});
|
|
60
|
-
}, le = () => {
|
|
61
|
-
let [e] = L(), t = W(), { t: n } = r(), i = t.italic;
|
|
62
|
-
return /* @__PURE__ */ d(U, {
|
|
63
|
-
icon: "italic",
|
|
64
|
-
tooltip: n("editor.italic"),
|
|
65
|
-
active: i,
|
|
66
|
-
onClick: () => {
|
|
67
|
-
e.dispatchCommand(I, "italic");
|
|
68
|
-
}
|
|
69
|
-
});
|
|
70
|
-
}, G = m(null), K = () => {
|
|
71
|
-
let e = _(G);
|
|
72
|
-
if (!e) throw Error("useEditorContainer must be used within EditorContainerProvider");
|
|
73
|
-
return e;
|
|
74
|
-
}, ue = () => {
|
|
75
|
-
let [e] = L(), { t } = r(), n = W(), { getPopupContainer: i } = K();
|
|
76
|
-
return /* @__PURE__ */ d(a, {
|
|
77
|
-
menus: y(() => o.map((e) => ({
|
|
78
|
-
key: e.value,
|
|
79
|
-
label: e.label
|
|
80
|
-
})), []),
|
|
81
|
-
onClick: g((t) => {
|
|
82
|
-
let n = t.key;
|
|
83
|
-
e.update(() => {
|
|
84
|
-
let e = j();
|
|
85
|
-
M(e) && R(e, { "font-size": n });
|
|
86
|
-
});
|
|
87
|
-
}, [e]),
|
|
88
|
-
activeKey: [n.fontSize],
|
|
89
|
-
showSearch: !1,
|
|
90
|
-
getPopupContainer: i,
|
|
91
|
-
style: {
|
|
92
|
-
width: "60px",
|
|
93
|
-
minWidth: "60px"
|
|
94
|
-
},
|
|
95
|
-
children: /* @__PURE__ */ d("div", {
|
|
96
|
-
className: "dropdown__trigger inline-flex",
|
|
97
|
-
children: /* @__PURE__ */ d(U, {
|
|
98
|
-
icon: "fontsize",
|
|
99
|
-
tooltip: t("editor.fontSize"),
|
|
100
|
-
active: !1
|
|
101
|
-
})
|
|
102
|
-
})
|
|
103
|
-
});
|
|
104
|
-
}, de = () => {
|
|
105
|
-
let [e] = L(), t = W(), { t: i } = r(), { getPopupContainer: a } = K(), o = g((t) => {
|
|
106
|
-
e.update(() => {
|
|
107
|
-
let e = j();
|
|
108
|
-
M(e) && R(e, { color: t });
|
|
109
|
-
});
|
|
110
|
-
}, [e]);
|
|
111
|
-
return /* @__PURE__ */ d(n, {
|
|
112
|
-
value: t.fontColor,
|
|
113
|
-
onChange: o,
|
|
114
|
-
placement: "bottom-start",
|
|
115
|
-
getPopupContainer: a,
|
|
116
|
-
children: /* @__PURE__ */ d("div", {
|
|
117
|
-
className: "trigger-picker inline-flex",
|
|
118
|
-
children: /* @__PURE__ */ d(U, {
|
|
119
|
-
icon: "fontcolor",
|
|
120
|
-
tooltip: i("editor.fontColor"),
|
|
121
|
-
onClick: () => {},
|
|
122
|
-
active: !1
|
|
123
|
-
})
|
|
124
|
-
})
|
|
125
|
-
});
|
|
126
|
-
}, fe = () => {
|
|
127
|
-
let [e] = L(), t = W(), { t: i } = r(), { getPopupContainer: a } = K(), o = g((t) => {
|
|
128
|
-
e.update(() => {
|
|
129
|
-
let e = j();
|
|
130
|
-
M(e) && R(e, { "background-color": t });
|
|
131
|
-
});
|
|
132
|
-
}, [e]);
|
|
133
|
-
return /* @__PURE__ */ d(n, {
|
|
134
|
-
value: t.backgroundColor,
|
|
135
|
-
onChange: o,
|
|
136
|
-
placement: "bottom-start",
|
|
137
|
-
getPopupContainer: a,
|
|
138
|
-
children: /* @__PURE__ */ d("div", {
|
|
139
|
-
className: "trigger-picker inline-flex",
|
|
140
|
-
children: /* @__PURE__ */ d(U, {
|
|
141
|
-
icon: "fill",
|
|
142
|
-
tooltip: i("editor.fill"),
|
|
143
|
-
onClick: () => {},
|
|
144
|
-
active: !1
|
|
145
|
-
})
|
|
146
|
-
})
|
|
147
|
-
});
|
|
148
|
-
}, pe = () => {
|
|
149
|
-
let [e] = L(), { align: t } = W(), { t: n } = r(), { getPopupContainer: i } = K(), o = [
|
|
150
|
-
{
|
|
151
|
-
key: "left",
|
|
152
|
-
label: n("leftAlign"),
|
|
153
|
-
icon: /* @__PURE__ */ d(c, {})
|
|
154
|
-
},
|
|
155
|
-
{
|
|
156
|
-
key: "center",
|
|
157
|
-
label: n("editor.centerAlign"),
|
|
158
|
-
icon: /* @__PURE__ */ d(s, {})
|
|
159
|
-
},
|
|
160
|
-
{
|
|
161
|
-
key: "right",
|
|
162
|
-
label: n("editor.rightAlign"),
|
|
163
|
-
icon: /* @__PURE__ */ d(l, {})
|
|
164
|
-
}
|
|
165
|
-
], u = g((t) => {
|
|
166
|
-
e.dispatchCommand(F, t);
|
|
167
|
-
}, [e]), p = o.map((e) => ({
|
|
168
|
-
key: e.key,
|
|
169
|
-
label: /* @__PURE__ */ f("div", {
|
|
170
|
-
className: "flex items-center gap-2",
|
|
171
|
-
children: [e.icon, /* @__PURE__ */ d("span", { children: e.label })]
|
|
172
|
-
})
|
|
173
|
-
})), m = g((e) => {
|
|
174
|
-
u(e.key);
|
|
175
|
-
}, [u]), h = o.find((e) => e.key === t)?.icon || /* @__PURE__ */ d(c, {});
|
|
176
|
-
return /* @__PURE__ */ d(a, {
|
|
177
|
-
menus: p,
|
|
178
|
-
onClick: m,
|
|
179
|
-
showSearch: !1,
|
|
180
|
-
activeKey: [t],
|
|
181
|
-
getPopupContainer: i,
|
|
182
|
-
style: {
|
|
183
|
-
width: "110px",
|
|
184
|
-
minWidth: "110px"
|
|
185
|
-
},
|
|
186
|
-
children: /* @__PURE__ */ d("div", {
|
|
187
|
-
className: "trigger-dropdown inline-flex text-sm",
|
|
188
|
-
children: /* @__PURE__ */ d(U, {
|
|
189
|
-
icon: h,
|
|
190
|
-
tooltip: n("editor.alignment"),
|
|
191
|
-
onClick: () => {},
|
|
192
|
-
active: !1
|
|
193
|
-
})
|
|
194
|
-
})
|
|
195
|
-
});
|
|
196
|
-
};
|
|
197
|
-
//#endregion
|
|
198
|
-
//#region src/components/Editor/ToolbarPlugin/Buttons/LinkButton.tsx
|
|
199
|
-
function me(e) {
|
|
200
|
-
return e ? e.startsWith("@") ? "javascript:void(0);" : e.match(/^https?:\/\//) ? e : `http://${e}` : "";
|
|
201
|
-
}
|
|
202
|
-
var he = () => {
|
|
203
|
-
let [e] = L(), { link: n } = W(), { t: a } = r(), [o, s] = x(!1), [c, l] = x(""), [p, m] = x(""), [h, _] = x(!0), [v, y] = T.useMessage(), C = b(null), E = g((t) => {
|
|
204
|
-
s(t), t || e.setEditable(!0);
|
|
205
|
-
}, [e]), D = () => {
|
|
206
|
-
if (!c) {
|
|
207
|
-
v.warning(a("editor.linkAddressEmpty"));
|
|
208
|
-
return;
|
|
209
|
-
}
|
|
210
|
-
let t = me(c);
|
|
211
|
-
e.setEditable(!0), e.update(() => {
|
|
212
|
-
let e = h ? {
|
|
213
|
-
target: "_blank",
|
|
214
|
-
rel: "noopener noreferrer",
|
|
215
|
-
title: c
|
|
216
|
-
} : { title: c }, n = C.current;
|
|
217
|
-
n !== null && P(n);
|
|
218
|
-
let r = j();
|
|
219
|
-
if (M(r)) {
|
|
220
|
-
let n = p || c, i = r.getTextContent();
|
|
221
|
-
if (!r.isCollapsed() && n === i) re(t, e);
|
|
222
|
-
else {
|
|
223
|
-
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 = z(t, e), l = k(n);
|
|
224
|
-
l.setFormat(s), l.setStyle(o), c.append(l), r.insertNodes([c]);
|
|
225
|
-
}
|
|
226
|
-
} else {
|
|
227
|
-
let n = z(t, e);
|
|
228
|
-
n.append(k(p || c));
|
|
229
|
-
let r = A(), i = r.getLastChild();
|
|
230
|
-
if (te(i) && i.isEmpty()) i.append(n);
|
|
231
|
-
else {
|
|
232
|
-
let e = ee();
|
|
233
|
-
e.append(n), r.append(e);
|
|
234
|
-
}
|
|
235
|
-
}
|
|
236
|
-
}), C.current = null, l(""), m(""), E(!1);
|
|
237
|
-
}, O = g(() => {
|
|
238
|
-
let t = "";
|
|
239
|
-
e.getEditorState().read(() => {
|
|
240
|
-
let e = j();
|
|
241
|
-
C.current = e ? e.clone() : null, M(e) && !e.isCollapsed() && (t = e.getTextContent());
|
|
242
|
-
}), e.setEditable(!1), e.update(() => {
|
|
243
|
-
P(null);
|
|
244
|
-
}), window.getSelection()?.removeAllRanges(), e.getRootElement()?.blur(), n ? (l(n.link === "javascript:void(0);" ? "" : n.link ?? ""), m(n.linkText ?? "")) : (l(""), m(t)), s(!0);
|
|
245
|
-
}, [n, e]);
|
|
246
|
-
return /* @__PURE__ */ f(u, { children: [
|
|
247
|
-
/* @__PURE__ */ d(U, {
|
|
248
|
-
icon: "Insertlink",
|
|
249
|
-
tooltip: a("link"),
|
|
250
|
-
onClick: O,
|
|
251
|
-
active: !!n?.link
|
|
252
|
-
}),
|
|
253
|
-
y,
|
|
254
|
-
/* @__PURE__ */ d(t, {
|
|
255
|
-
title: a("link"),
|
|
256
|
-
open: o,
|
|
257
|
-
onOpenChange: E,
|
|
258
|
-
children: /* @__PURE__ */ f("div", { children: [/* @__PURE__ */ f("div", {
|
|
259
|
-
className: "px-[20px] pb-[60px] pt-[40px]",
|
|
260
|
-
children: [/* @__PURE__ */ f("div", {
|
|
261
|
-
className: "flex items-center relative",
|
|
262
|
-
children: [
|
|
263
|
-
/* @__PURE__ */ d("label", {
|
|
264
|
-
className: "w-[80px] shrink-0",
|
|
265
|
-
children: a("linkAddress")
|
|
266
|
-
}),
|
|
267
|
-
/* @__PURE__ */ d(w, {
|
|
268
|
-
value: c,
|
|
269
|
-
onChange: (e) => l(e.target.value),
|
|
270
|
-
placeholder: a("editor.linkTip")
|
|
271
|
-
}),
|
|
272
|
-
/* @__PURE__ */ d("div", {
|
|
273
|
-
className: "absolute bottom-[-30px] left-[80px]",
|
|
274
|
-
children: /* @__PURE__ */ d("p", {
|
|
275
|
-
className: "text-[#999]",
|
|
276
|
-
children: a("editor.linkAliasTip")
|
|
277
|
-
})
|
|
278
|
-
})
|
|
279
|
-
]
|
|
280
|
-
}), /* @__PURE__ */ f("div", {
|
|
281
|
-
className: "flex items-center mt-[40px]",
|
|
282
|
-
children: [/* @__PURE__ */ d("label", {
|
|
283
|
-
className: "w-[80px] shrink-0",
|
|
284
|
-
children: a("showContent")
|
|
285
|
-
}), /* @__PURE__ */ d(w, {
|
|
286
|
-
value: p,
|
|
287
|
-
onChange: (e) => m(e.target.value)
|
|
288
|
-
})]
|
|
289
|
-
})]
|
|
290
|
-
}), /* @__PURE__ */ f("div", {
|
|
291
|
-
className: "py-[14px] px-[20px] flex justify-between items-center border-t-[1px] border-solid border-[#e0e0e0]",
|
|
292
|
-
children: [/* @__PURE__ */ d("div", { children: /* @__PURE__ */ d(i, {
|
|
293
|
-
checked: h,
|
|
294
|
-
onChange: (e) => _(e),
|
|
295
|
-
children: a("openInNewTab")
|
|
296
|
-
}) }), /* @__PURE__ */ f("div", {
|
|
297
|
-
className: "flex gap-[15px]",
|
|
298
|
-
children: [/* @__PURE__ */ d(S, {
|
|
299
|
-
onClick: () => E(!1),
|
|
300
|
-
children: a("cancel")
|
|
301
|
-
}), /* @__PURE__ */ d(S, {
|
|
302
|
-
type: "primary",
|
|
303
|
-
onClick: D,
|
|
304
|
-
children: a("confirm")
|
|
305
|
-
})]
|
|
306
|
-
})]
|
|
307
|
-
})] })
|
|
308
|
-
})
|
|
309
|
-
] });
|
|
310
|
-
}, ge = () => {
|
|
311
|
-
let [e] = L(), { link: t } = W(), { t: n } = r();
|
|
312
|
-
return /* @__PURE__ */ d(U, {
|
|
313
|
-
icon: "cancellink",
|
|
314
|
-
tooltip: n("cancelLink"),
|
|
315
|
-
onClick: () => {
|
|
316
|
-
t && e.dispatchCommand(ie, null);
|
|
317
|
-
}
|
|
318
|
-
});
|
|
319
|
-
}, q = {
|
|
320
|
-
"picture-modal__container": "_picture-modal__container_1lb4d_1",
|
|
321
|
-
"picture-modal__sidebar": "_picture-modal__sidebar_1lb4d_4",
|
|
322
|
-
"picture-modal__menu-list": "_picture-modal__menu-list_1lb4d_9",
|
|
323
|
-
"picture-modal__menu-item": "_picture-modal__menu-item_1lb4d_14",
|
|
324
|
-
"picture-modal__slider": "_picture-modal__slider_1lb4d_24",
|
|
325
|
-
"picture-modal__content": "_picture-modal__content_1lb4d_35",
|
|
326
|
-
"picture-modal__content-wrapper": "_picture-modal__content-wrapper_1lb4d_41",
|
|
327
|
-
"picture-modal__content-container": "_picture-modal__content-container_1lb4d_45",
|
|
328
|
-
"picture-modal__content-page": "_picture-modal__content-page_1lb4d_48",
|
|
329
|
-
"picture-modal__content-title": "_picture-modal__content-title_1lb4d_51",
|
|
330
|
-
"picture-modal__upload-area": "_picture-modal__upload-area_1lb4d_62",
|
|
331
|
-
"picture-modal__upload-area--dragging": "_picture-modal__upload-area--dragging_1lb4d_77",
|
|
332
|
-
"picture-modal__preview": "_picture-modal__preview_1lb4d_83",
|
|
333
|
-
"picture-modal__preview-image": "_picture-modal__preview-image_1lb4d_92",
|
|
334
|
-
"picture-modal__preview-info": "_picture-modal__preview-info_1lb4d_102",
|
|
335
|
-
"picture-modal__preview-filename": "_picture-modal__preview-filename_1lb4d_106",
|
|
336
|
-
"picture-modal__preview-size": "_picture-modal__preview-size_1lb4d_112",
|
|
337
|
-
"picture-modal__preview-delete": "_picture-modal__preview-delete_1lb4d_116",
|
|
338
|
-
"picture-modal__upload-text": "_picture-modal__upload-text_1lb4d_124",
|
|
339
|
-
"picture-modal__footer": "_picture-modal__footer_1lb4d_128"
|
|
340
|
-
}, J = h((e, t) => {
|
|
341
|
-
let [n] = C.useForm(), [i, a] = x(""), { t: o } = r(), s = (e) => /^https?:\/\/.+/i.test(e);
|
|
342
|
-
return v(t, () => ({ getValue: async () => {
|
|
343
|
-
try {
|
|
344
|
-
return await n.validateFields(), i;
|
|
345
|
-
} catch {
|
|
346
|
-
throw Error("URL validation failed");
|
|
347
|
-
}
|
|
348
|
-
} })), /* @__PURE__ */ f(u, { children: [/* @__PURE__ */ d("div", {
|
|
349
|
-
className: q["picture-modal__content-title"],
|
|
350
|
-
"data-title": o("editor.imageUrlNote"),
|
|
351
|
-
children: o("editor.enterImageUrl")
|
|
352
|
-
}), /* @__PURE__ */ d(C, {
|
|
353
|
-
form: n,
|
|
354
|
-
children: /* @__PURE__ */ d(C.Item, {
|
|
355
|
-
name: "url",
|
|
356
|
-
rules: [{
|
|
357
|
-
required: !0,
|
|
358
|
-
message: o("editor.pleaseEnterImageUrl")
|
|
359
|
-
}, { validator: (e, t) => !t || s(t) ? Promise.resolve() : Promise.reject(Error(o("editor.pleaseEnterValidImageUrl"))) }],
|
|
360
|
-
children: /* @__PURE__ */ d(w, {
|
|
361
|
-
placeholder: o("editor.pleaseEnterImageUrl"),
|
|
362
|
-
value: i,
|
|
363
|
-
onChange: (e) => a(e.target.value)
|
|
364
|
-
})
|
|
365
|
-
})
|
|
366
|
-
})] });
|
|
367
|
-
});
|
|
368
|
-
J.displayName = "LinkInput";
|
|
369
|
-
//#endregion
|
|
370
|
-
//#region src/components/Editor/ToolbarPlugin/Buttons/PictureButton/UploadImage.tsx
|
|
371
|
-
var Y = h((t, n) => {
|
|
372
|
-
let [i, a] = x(null), [o, s] = x(!1), [c, l] = x(null), u = b(null), [p, m] = T.useMessage(), { t: h } = r(), 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) => {
|
|
373
|
-
_(e) && (a(URL.createObjectURL(e)), l(e));
|
|
374
|
-
}, S = () => {
|
|
375
|
-
u.current?.click();
|
|
376
|
-
}, C = (e) => {
|
|
377
|
-
let t = e.target.files?.[0];
|
|
378
|
-
t && y(t);
|
|
379
|
-
};
|
|
380
|
-
return v(n, () => ({ getValue: async () => {
|
|
381
|
-
if (!c) throw p.warning(h("editor.pleaseUploadImageFirst")), Error(h("editor.pleaseUploadImageFirst"));
|
|
382
|
-
return new Promise((e, t) => {
|
|
383
|
-
let n = new FileReader();
|
|
384
|
-
n.onload = () => {
|
|
385
|
-
e({
|
|
386
|
-
src: n.result,
|
|
387
|
-
fileName: c.name
|
|
388
|
-
});
|
|
389
|
-
}, n.onerror = () => {
|
|
390
|
-
t(Error(h("editor.operationFailed")));
|
|
391
|
-
}, n.readAsDataURL(c);
|
|
392
|
-
});
|
|
393
|
-
} })), /* @__PURE__ */ f("div", {
|
|
394
|
-
className: "h-full",
|
|
395
|
-
onDragOver: (e) => {
|
|
396
|
-
e.preventDefault(), s(!0);
|
|
397
|
-
},
|
|
398
|
-
onDragLeave: (e) => {
|
|
399
|
-
e.preventDefault(), s(!1);
|
|
400
|
-
},
|
|
401
|
-
onDrop: (e) => {
|
|
402
|
-
e.preventDefault(), s(!1);
|
|
403
|
-
let t = e.dataTransfer.files[0];
|
|
404
|
-
t && y(t);
|
|
405
|
-
},
|
|
406
|
-
children: [
|
|
407
|
-
/* @__PURE__ */ d("div", {
|
|
408
|
-
className: q["picture-modal__content-title"],
|
|
409
|
-
"data-title": h("editor.imageSizeNote"),
|
|
410
|
-
children: h("editor.uploadImage")
|
|
411
|
-
}),
|
|
412
|
-
/* @__PURE__ */ f("div", {
|
|
413
|
-
className: `${q["picture-modal__upload-area"]} ${o ? q["picture-modal__upload-area--dragging"] : ""}`,
|
|
414
|
-
onClick: S,
|
|
415
|
-
children: [/* @__PURE__ */ d(e, { name: "upload" }), /* @__PURE__ */ d("span", {
|
|
416
|
-
className: q["picture-modal__upload-text"],
|
|
417
|
-
children: h("editor.clickOrDragToUpload")
|
|
418
|
-
})]
|
|
419
|
-
}),
|
|
420
|
-
/* @__PURE__ */ d(D, {
|
|
421
|
-
mode: "wait",
|
|
422
|
-
children: i && c && /* @__PURE__ */ f(O.div, {
|
|
423
|
-
className: q["picture-modal__preview"],
|
|
424
|
-
initial: {
|
|
425
|
-
opacity: 0,
|
|
426
|
-
y: 20,
|
|
427
|
-
scale: .95
|
|
428
|
-
},
|
|
429
|
-
animate: {
|
|
430
|
-
opacity: 1,
|
|
431
|
-
y: 0,
|
|
432
|
-
scale: 1
|
|
433
|
-
},
|
|
434
|
-
exit: {
|
|
435
|
-
opacity: 0,
|
|
436
|
-
y: -10,
|
|
437
|
-
scale: .95
|
|
438
|
-
},
|
|
439
|
-
transition: {
|
|
440
|
-
duration: .3,
|
|
441
|
-
ease: [
|
|
442
|
-
.4,
|
|
443
|
-
0,
|
|
444
|
-
.2,
|
|
445
|
-
1
|
|
446
|
-
]
|
|
447
|
-
},
|
|
448
|
-
children: [
|
|
449
|
-
/* @__PURE__ */ d(O.div, {
|
|
450
|
-
className: q["picture-modal__preview-image"],
|
|
451
|
-
initial: {
|
|
452
|
-
opacity: 0,
|
|
453
|
-
scale: .8
|
|
454
|
-
},
|
|
455
|
-
animate: {
|
|
456
|
-
opacity: 1,
|
|
457
|
-
scale: 1
|
|
458
|
-
},
|
|
459
|
-
transition: {
|
|
460
|
-
delay: .1,
|
|
461
|
-
duration: .2
|
|
462
|
-
},
|
|
463
|
-
children: /* @__PURE__ */ d("img", {
|
|
464
|
-
src: i,
|
|
465
|
-
alt: h("editor.previewImage")
|
|
466
|
-
})
|
|
467
|
-
}),
|
|
468
|
-
/* @__PURE__ */ f(O.div, {
|
|
469
|
-
className: q["picture-modal__preview-info"],
|
|
470
|
-
initial: {
|
|
471
|
-
opacity: 0,
|
|
472
|
-
x: 20
|
|
473
|
-
},
|
|
474
|
-
animate: {
|
|
475
|
-
opacity: 1,
|
|
476
|
-
x: 0
|
|
477
|
-
},
|
|
478
|
-
transition: {
|
|
479
|
-
delay: .15,
|
|
480
|
-
duration: .2
|
|
481
|
-
},
|
|
482
|
-
children: [/* @__PURE__ */ d("div", {
|
|
483
|
-
className: q["picture-modal__preview-filename"],
|
|
484
|
-
children: c.name
|
|
485
|
-
}), /* @__PURE__ */ d("div", {
|
|
486
|
-
className: q["picture-modal__preview-size"],
|
|
487
|
-
children: g(c.size)
|
|
488
|
-
})]
|
|
489
|
-
}),
|
|
490
|
-
/* @__PURE__ */ d(O.div, {
|
|
491
|
-
className: q["picture-modal__preview-delete"],
|
|
492
|
-
role: "button",
|
|
493
|
-
onClick: () => {
|
|
494
|
-
a(null), l(null);
|
|
495
|
-
},
|
|
496
|
-
initial: {
|
|
497
|
-
opacity: 0,
|
|
498
|
-
scale: .8
|
|
499
|
-
},
|
|
500
|
-
animate: {
|
|
501
|
-
opacity: 1,
|
|
502
|
-
scale: 1
|
|
503
|
-
},
|
|
504
|
-
transition: {
|
|
505
|
-
delay: .2,
|
|
506
|
-
duration: .2
|
|
507
|
-
},
|
|
508
|
-
whileHover: { scale: 1.1 },
|
|
509
|
-
whileTap: { scale: .95 },
|
|
510
|
-
children: /* @__PURE__ */ d(e, { name: "delete" })
|
|
511
|
-
})
|
|
512
|
-
]
|
|
513
|
-
}, "preview")
|
|
514
|
-
}),
|
|
515
|
-
/* @__PURE__ */ d("input", {
|
|
516
|
-
ref: u,
|
|
517
|
-
type: "file",
|
|
518
|
-
accept: "image/*",
|
|
519
|
-
style: { display: "none" },
|
|
520
|
-
onChange: C
|
|
521
|
-
}),
|
|
522
|
-
m
|
|
523
|
-
]
|
|
524
|
-
});
|
|
525
|
-
});
|
|
526
|
-
Y.displayName = "UploadImage";
|
|
527
|
-
//#endregion
|
|
528
|
-
//#region src/components/Editor/commands/ImageCommands.ts
|
|
529
|
-
var X = ne("INSERT_INLINE_IMAGE_COMMAND"), _e = () => {
|
|
530
|
-
let { t: n } = r(), [i] = L(), [a, o] = x(!1), s = b(null), c = b(null), l = [{
|
|
531
|
-
key: "upload",
|
|
532
|
-
title: n("editor.uploadImage"),
|
|
533
|
-
icon: /* @__PURE__ */ d(e, { name: "picture" })
|
|
534
|
-
}, {
|
|
535
|
-
key: "url",
|
|
536
|
-
title: n("editor.imageUrl"),
|
|
537
|
-
icon: /* @__PURE__ */ d(e, { name: "Insertlink" })
|
|
538
|
-
}], [p, m] = x(l[0].key), h = () => l.findIndex((e) => e.key === p) * 40, g = async () => {
|
|
539
|
-
try {
|
|
540
|
-
let e = "", t = "";
|
|
541
|
-
if (p === "upload" && c.current) {
|
|
542
|
-
let n = await c.current.getValue();
|
|
543
|
-
e = n.src, t = n.fileName;
|
|
544
|
-
} else s.current && (e = await s.current.getValue(), t = e);
|
|
545
|
-
i.dispatchCommand(X, {
|
|
546
|
-
src: e,
|
|
547
|
-
altText: t
|
|
548
|
-
}), o(!1);
|
|
549
|
-
} catch (e) {
|
|
550
|
-
T.error(e instanceof Error ? e.message : n("editor.operationFailed"));
|
|
551
|
-
}
|
|
552
|
-
}, _ = {
|
|
553
|
-
upload: /* @__PURE__ */ d(Y, { ref: c }),
|
|
554
|
-
url: /* @__PURE__ */ d(J, { ref: s })
|
|
555
|
-
};
|
|
556
|
-
return /* @__PURE__ */ f(u, { children: [/* @__PURE__ */ d(U, {
|
|
557
|
-
icon: "picture",
|
|
558
|
-
tooltip: n("picture"),
|
|
559
|
-
onClick: () => o(!0)
|
|
560
|
-
}), /* @__PURE__ */ f(t, {
|
|
561
|
-
title: n("addPicture"),
|
|
562
|
-
open: a,
|
|
563
|
-
onOpenChange: o,
|
|
564
|
-
width: "620px",
|
|
565
|
-
children: [/* @__PURE__ */ f("div", {
|
|
566
|
-
className: q["picture-modal__container"],
|
|
567
|
-
children: [/* @__PURE__ */ f("div", {
|
|
568
|
-
className: q["picture-modal__sidebar"],
|
|
569
|
-
children: [/* @__PURE__ */ d("div", {
|
|
570
|
-
className: q["picture-modal__slider"],
|
|
571
|
-
style: { transform: `translateY(${h()}px)` }
|
|
572
|
-
}), /* @__PURE__ */ d("ul", {
|
|
573
|
-
className: q["picture-modal__menu-list"],
|
|
574
|
-
children: l.map((e) => /* @__PURE__ */ f("li", {
|
|
575
|
-
className: `${q["picture-modal__menu-item"]} ${p === e.key ? q["picture-modal__menu-item--active"] : ""}`,
|
|
576
|
-
onClick: () => m(e.key),
|
|
577
|
-
children: [/* @__PURE__ */ d("span", {
|
|
578
|
-
className: q["picture-modal__menu-icon"],
|
|
579
|
-
children: e.icon
|
|
580
|
-
}), /* @__PURE__ */ d("span", { children: e.title })]
|
|
581
|
-
}, e.title))
|
|
582
|
-
})]
|
|
583
|
-
}), /* @__PURE__ */ d("div", {
|
|
584
|
-
className: q["picture-modal__content"],
|
|
585
|
-
children: _[p]
|
|
586
|
-
})]
|
|
587
|
-
}), /* @__PURE__ */ f("div", {
|
|
588
|
-
className: q["picture-modal__footer"],
|
|
589
|
-
children: [/* @__PURE__ */ d(S, {
|
|
590
|
-
onClick: () => o(!1),
|
|
591
|
-
children: n("cancel")
|
|
592
|
-
}), /* @__PURE__ */ d(S, {
|
|
593
|
-
type: "primary",
|
|
594
|
-
onClick: g,
|
|
595
|
-
children: n("confirm")
|
|
596
|
-
})]
|
|
597
|
-
})]
|
|
598
|
-
})] });
|
|
599
|
-
}, Z = /* @__PURE__ */ new Map(), Q = (e, t) => {
|
|
600
|
-
if (!e) throw Error("registerToolbarButton: name is required");
|
|
601
|
-
Z.set(e, t);
|
|
602
|
-
}, ve = (e) => {
|
|
603
|
-
Z.delete(e);
|
|
604
|
-
}, ye = (e) => Z.get(e), be = () => Array.from(Z.keys()), $ = {
|
|
605
|
-
bold: se,
|
|
606
|
-
underline: ce,
|
|
607
|
-
italic: le,
|
|
608
|
-
fontSize: ue,
|
|
609
|
-
fontColor: de,
|
|
610
|
-
fill: fe,
|
|
611
|
-
align: pe,
|
|
612
|
-
link: he,
|
|
613
|
-
unLink: ge,
|
|
614
|
-
picture: _e
|
|
615
|
-
};
|
|
616
|
-
Object.entries($).forEach(([e, t]) => {
|
|
617
|
-
Q(e, t);
|
|
618
|
-
});
|
|
619
|
-
//#endregion
|
|
620
|
-
export { ve as a, K as c, B as d, Q as i, U as l, ye as n, X as o, be as r, G as s, $ as t, ae as u };
|