@baishuyun/ui-base 6.11.0 → 6.12.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-BqbcPQls.js → AllDaySection-CTaXpCmK.js} +1 -1
- package/dist/Calendar/{Calendar-BS0nzK4h.js → Calendar-BOLbbip1.js} +4 -4
- package/dist/Calendar/{TimeGrid-CBpDFAM4.js → TimeGrid-Ci8Dfama.js} +1 -1
- package/dist/Calendar/context/index.js +1 -1
- package/dist/Calendar/index.js +6 -6
- package/dist/Calendar/subcomponents/AllDaySection/index.js +3 -3
- package/dist/Calendar/subcomponents/CurrentTimeIndicator/index.js +1 -1
- package/dist/Calendar/subcomponents/EventCard/index.js +1 -1
- package/dist/Calendar/subcomponents/TimeAxis/index.js +1 -1
- package/dist/Calendar/subcomponents/TimeGrid/index.js +3 -3
- package/dist/Calendar/utils/index.js +1 -1
- package/dist/Calendar/utils/layout/index.js +1 -1
- package/dist/Calendar/utils/theme/index.js +1 -1
- package/dist/Card/{Card-Ds5Rpq--.js → Card-C8A4XaJZ.js} +1 -1
- package/dist/Card/index.js +3 -3
- package/dist/CheckBox/{CheckBox-nBm0u6zX.js → CheckBox-DBzTOuRy.js} +1 -1
- package/dist/CheckBox/{CheckBox-ByWSy9Yr.js → CheckBox-Dt4x6IqH.js} +1 -1
- package/dist/CheckBox/index.js +4 -4
- package/dist/ColorPicker/{ColorPicker-DVwg07Gs.js → ColorPicker-Buku806Y.js} +1 -1
- package/dist/ColorPicker/index.js +3 -3
- package/dist/ConfigProvider/index.js +1 -1
- package/dist/DatePicker/{DatePicker-DNPnHLT2.js → DatePicker-Vi3wfsfz.js} +1 -1
- package/dist/DatePicker/{DatePickerPanel-TS6AxAH-.js → DatePickerPanel-Cwmb-4UR.js} +2 -2
- package/dist/DatePicker/index.js +2 -2
- package/dist/DatePicker/style/index.js +1 -1
- package/dist/DropDown/{DropDown-DWf5yf4l.js → DropDown-CuL1Qq25.js} +1 -1
- package/dist/DropDown/index.js +4 -4
- package/dist/DropDown/style/index.js +1 -1
- package/dist/Editor/{Buttons-BBioCubp.js → Buttons-CMkFTv6y.js} +236 -368
- package/dist/Editor/ToolbarPlugin/Buttons/index.js +9 -9
- package/dist/Editor/constants/index.js +1 -1
- package/dist/Editor/index.js +274 -270
- package/dist/Gantt/GanttChart/index.js +6 -6
- package/dist/Gantt/{GanttChart-BaEW7EDO.js → GanttChart-WIrD6Z7O.js} +2 -2
- package/dist/Gantt/GanttTable/index.js +1 -1
- package/dist/Gantt/GanttToolBar/index.js +5 -5
- package/dist/Gantt/{GanttToolBar-COwsYlMG.js → GanttToolBar-C1gAS9v2.js} +2 -2
- package/dist/Gantt/index.js +6 -6
- package/dist/Gantt/utils/index.js +1 -1
- package/dist/Gantt/utils/theme/index.js +1 -1
- package/dist/Icon/{Icon-BBDcb-yw.js → Icon-oQ_uBooE.js} +1 -1
- package/dist/Icon/index.js +2 -2
- package/dist/InputTag/{InputTag-Jpm8H32L.js → InputTag-BQpIRPtc.js} +1 -1
- package/dist/InputTag/index.js +3 -3
- package/dist/Loading/index.js +1 -1
- package/dist/Modal/{Modal-Cb7Msq26.js → Modal-17rLsxN4.js} +1 -1
- package/dist/Modal/index.js +3 -3
- package/dist/NotFoundContent/index.js +1 -1
- package/dist/Overlay/index.js +1 -1
- package/dist/Radio/index.js +1 -1
- package/dist/ScrollBar/index.js +1 -1
- package/dist/Segmented/index.js +1 -1
- package/dist/Select/{Select-BY5Rpo3f.js → Select-p_ly7xmz.js} +4 -4
- package/dist/Select/{SelectInputSearch-i3egm8Wy.js → SelectInputSearch-BBwVIb8u.js} +1 -1
- package/dist/Select/index.js +7 -7
- package/dist/Table/hooks/index.js +1 -1
- package/dist/Table/index.js +1 -1
- package/dist/Table/style/index.js +1 -1
- package/dist/Table/utils/index.js +1 -1
- package/dist/Tabs/{Tabs-C0m3mt-j.js → Tabs-D2A8nJl8.js} +1 -1
- package/dist/Tabs/index.js +3 -3
- package/dist/Tooltip/index.js +1 -1
- package/dist/Tree/index.js +4 -4
- package/dist/Tree/utils/index.js +1 -1
- package/dist/components/Editor/interface.d.ts +9 -2
- package/dist/index.js +17 -17
- package/dist/style.css +1 -1
- package/dist/vendors/{Tree-B09frqQX.js → Tree-B8cR9y6U.js} +2 -2
- package/dist/vendors/{version-BxI5QM5W.js → version-CJyzNHuS.js} +1 -1
- package/package.json +2 -2
- package/dist/components/Editor/ToolbarPlugin/icons/ToolbarIcon.d.ts +0 -13
|
@@ -1,32 +1,32 @@
|
|
|
1
|
-
import { t as e } from "../Icon/Icon-
|
|
1
|
+
import { t as e } from "../Icon/Icon-oQ_uBooE.js";
|
|
2
2
|
import { a as t, i as n } from "../Overlay/OverlayContext-CVSFoyqN.js";
|
|
3
|
-
import { t as r } from "../Modal/Modal-
|
|
4
|
-
import { t as i } from "../ColorPicker/ColorPicker-
|
|
3
|
+
import { t as r } from "../Modal/Modal-17rLsxN4.js";
|
|
4
|
+
import { t as i } from "../ColorPicker/ColorPicker-Buku806Y.js";
|
|
5
5
|
import { t as a } from "../vendors/useLocale-FGYsRWSe.js";
|
|
6
6
|
import { n as o } from "../vendors/animations-rwUbyoT0.js";
|
|
7
|
-
import { t as s } from "../CheckBox/CheckBox-
|
|
7
|
+
import { t as s } from "../CheckBox/CheckBox-DBzTOuRy.js";
|
|
8
8
|
import { t as c } from "../ScrollBar/ScrollBar-N2pOLv-8.js";
|
|
9
9
|
import { t as l } from "../vendors/useFloatingPortal-CmVJbuRm.js";
|
|
10
|
-
import { t as u } from "../DropDown/DropDown-
|
|
10
|
+
import { t as u } from "../DropDown/DropDown-CuL1Qq25.js";
|
|
11
11
|
import { FONT_SIZES as d } from "./constants/index.js";
|
|
12
12
|
import { AlignCenterOutlined as f, AlignLeftOutlined as p, AlignRightOutlined as m } from "@ant-design/icons";
|
|
13
13
|
import { keyBy as h, range as g } from "lodash-es";
|
|
14
14
|
import { Fragment as _, jsx as v, jsxs as y } from "react/jsx-runtime";
|
|
15
15
|
import b, { createContext as x, forwardRef as S, useCallback as C, useContext as w, useEffect as T, useImperativeHandle as ee, useLayoutEffect as te, useMemo as ne, useRef as E, useState as D } from "react";
|
|
16
16
|
import { Button as O, Form as k, Input as A, message as j } from "antd";
|
|
17
|
-
import
|
|
18
|
-
import { AnimatePresence as
|
|
19
|
-
import { FloatingPortal as
|
|
20
|
-
import { $createParagraphNode as
|
|
21
|
-
import { useLexicalComposerContext as
|
|
22
|
-
import { $patchStyleText as
|
|
23
|
-
import { $createLinkNode as
|
|
24
|
-
import { INSERT_ORDERED_LIST_COMMAND as
|
|
25
|
-
import { $createCodeNode as
|
|
26
|
-
import { INSERT_TABLE_COMMAND as
|
|
27
|
-
import { $createHeadingNode as
|
|
17
|
+
import M from "clsx";
|
|
18
|
+
import { AnimatePresence as N, motion as P } from "motion/react";
|
|
19
|
+
import { FloatingPortal as re } from "@floating-ui/react";
|
|
20
|
+
import { $createParagraphNode as F, $createTextNode as ie, $getRoot as ae, $getSelection as I, $isElementNode as oe, $isRangeSelection as L, $isTextNode as se, $setSelection as ce, CAN_REDO_COMMAND as le, CAN_UNDO_COMMAND as ue, COMMAND_PRIORITY_CRITICAL as R, FORMAT_ELEMENT_COMMAND as de, FORMAT_TEXT_COMMAND as z, INDENT_CONTENT_COMMAND as fe, OUTDENT_CONTENT_COMMAND as pe, REDO_COMMAND as me, UNDO_COMMAND as he, createCommand as ge, mergeRegister as _e } from "lexical";
|
|
21
|
+
import { useLexicalComposerContext as B } from "@lexical/react/LexicalComposerContext";
|
|
22
|
+
import { $patchStyleText as V, $setBlocksType as H } from "@lexical/selection";
|
|
23
|
+
import { $createLinkNode as U, $toggleLink as ve, TOGGLE_LINK_COMMAND as ye } from "@lexical/link";
|
|
24
|
+
import { INSERT_ORDERED_LIST_COMMAND as be, INSERT_UNORDERED_LIST_COMMAND as xe, REMOVE_LIST_COMMAND as Se } from "@lexical/list";
|
|
25
|
+
import { $createCodeNode as Ce } from "@lexical/code-core";
|
|
26
|
+
import { INSERT_TABLE_COMMAND as we } from "@lexical/table";
|
|
27
|
+
import { $createHeadingNode as Te } from "@lexical/rich-text";
|
|
28
28
|
//#region src/components/Editor/ToolbarPlugin/toolbarPlugin.module.scss
|
|
29
|
-
var
|
|
29
|
+
var W = {
|
|
30
30
|
"bsy-lexical__toolbar": "_bsy-lexical__toolbar_4va97_1",
|
|
31
31
|
"bsy-lexical__toolbar--floating": "_bsy-lexical__toolbar--floating_4va97_12",
|
|
32
32
|
"bsy-lexical__toolbar-item": "_bsy-lexical__toolbar-item_4va97_18",
|
|
@@ -35,7 +35,7 @@ var z = {
|
|
|
35
35
|
"bsy-lexical__toolbar-select": "_bsy-lexical__toolbar-select_4va97_37",
|
|
36
36
|
"bsy-lexical__toolbar-select-label": "_bsy-lexical__toolbar-select-label_4va97_55",
|
|
37
37
|
"bsy-lexical__toolbar-select-arrow": "_bsy-lexical__toolbar-select-arrow_4va97_66"
|
|
38
|
-
},
|
|
38
|
+
}, Ee = x(null), G = "plaintext", De = "github-light", Oe = [
|
|
39
39
|
{
|
|
40
40
|
id: "plaintext",
|
|
41
41
|
label: "Plain text"
|
|
@@ -120,32 +120,32 @@ var z = {
|
|
|
120
120
|
id: "markdown",
|
|
121
121
|
label: "Markdown"
|
|
122
122
|
}
|
|
123
|
-
],
|
|
124
|
-
let e = w(
|
|
123
|
+
], ke = h(Oe, "id"), Ae = (e) => e && ke[e] ? e : G, je = x(null), K = () => {
|
|
124
|
+
let e = w(je);
|
|
125
125
|
if (!e) throw Error("useHistoryStateContext must be used within HistoryStateProvider");
|
|
126
126
|
return e;
|
|
127
|
-
},
|
|
128
|
-
let [t] =
|
|
127
|
+
}, Me = ({ children: e }) => {
|
|
128
|
+
let [t] = B(), [n, r] = D({
|
|
129
129
|
canUndo: !1,
|
|
130
130
|
canRedo: !1
|
|
131
131
|
});
|
|
132
|
-
return T(() =>
|
|
132
|
+
return T(() => _e(t.registerCommand(ue, (e) => (r((t) => t.canUndo === e ? t : {
|
|
133
133
|
...t,
|
|
134
134
|
canUndo: e
|
|
135
|
-
}), !1),
|
|
135
|
+
}), !1), R), t.registerCommand(le, (e) => (r((t) => t.canRedo === e ? t : {
|
|
136
136
|
...t,
|
|
137
137
|
canRedo: e
|
|
138
|
-
}), !1),
|
|
138
|
+
}), !1), R)), [t]), /* @__PURE__ */ v(je.Provider, {
|
|
139
139
|
value: n,
|
|
140
140
|
children: e
|
|
141
141
|
});
|
|
142
|
-
},
|
|
142
|
+
}, Ne = x({ iconSize: 14 }), Pe = Ne.Provider, q = () => w(Ne), Fe = {
|
|
143
143
|
"lexical-editor__toolbar-button": "_lexical-editor__toolbar-button_10xg7_1",
|
|
144
144
|
"lexical-editor__toolbar-button-active": "_lexical-editor__toolbar-button-active_10xg7_20"
|
|
145
|
-
},
|
|
146
|
-
let { icon: n, tooltip: r, onClick: i, disabled: a = !1, active: o = !1, size: s } = t, { iconSize: c } =
|
|
145
|
+
}, J = (t) => {
|
|
146
|
+
let { icon: n, tooltip: r, onClick: i, disabled: a = !1, active: o = !1, size: s } = t, { iconSize: c } = q(), l = s ?? c;
|
|
147
147
|
return /* @__PURE__ */ v("button", {
|
|
148
|
-
className:
|
|
148
|
+
className: M(Fe["lexical-editor__toolbar-button"], { [Fe["lexical-editor__toolbar-button-active"]]: o }),
|
|
149
149
|
type: "button",
|
|
150
150
|
onClick: i,
|
|
151
151
|
onMouseDown: (e) => e.preventDefault(),
|
|
@@ -156,52 +156,52 @@ var z = {
|
|
|
156
156
|
size: l
|
|
157
157
|
})
|
|
158
158
|
});
|
|
159
|
-
},
|
|
160
|
-
let e = w(
|
|
159
|
+
}, Y = () => {
|
|
160
|
+
let e = w(Ee);
|
|
161
161
|
if (!e) throw Error("useTextFormatsContext must be used within TextFormatsProvider");
|
|
162
162
|
return e;
|
|
163
|
-
},
|
|
164
|
-
let [e] =
|
|
165
|
-
return /* @__PURE__ */ v(
|
|
163
|
+
}, Ie = () => {
|
|
164
|
+
let [e] = B(), t = Y(), { t: n } = a(), r = t.bold;
|
|
165
|
+
return /* @__PURE__ */ v(J, {
|
|
166
166
|
icon: "bold",
|
|
167
167
|
tooltip: n("editor.bold"),
|
|
168
168
|
active: r,
|
|
169
169
|
onClick: () => {
|
|
170
|
-
e.dispatchCommand(
|
|
170
|
+
e.dispatchCommand(z, "bold");
|
|
171
171
|
}
|
|
172
172
|
});
|
|
173
|
-
},
|
|
174
|
-
let [e] =
|
|
175
|
-
return /* @__PURE__ */ v(
|
|
173
|
+
}, Le = () => {
|
|
174
|
+
let [e] = B(), t = Y(), { t: n } = a(), r = t.underline;
|
|
175
|
+
return /* @__PURE__ */ v(J, {
|
|
176
176
|
icon: "underline",
|
|
177
177
|
tooltip: n("editor.underline"),
|
|
178
178
|
active: r,
|
|
179
179
|
onClick: () => {
|
|
180
|
-
e.dispatchCommand(
|
|
180
|
+
e.dispatchCommand(z, "underline");
|
|
181
181
|
}
|
|
182
182
|
});
|
|
183
|
-
},
|
|
184
|
-
let [e] =
|
|
185
|
-
return /* @__PURE__ */ v(
|
|
183
|
+
}, Re = () => {
|
|
184
|
+
let [e] = B(), t = Y(), { t: n } = a(), r = t.italic;
|
|
185
|
+
return /* @__PURE__ */ v(J, {
|
|
186
186
|
icon: "italic",
|
|
187
187
|
tooltip: n("editor.italic"),
|
|
188
188
|
active: r,
|
|
189
189
|
onClick: () => {
|
|
190
|
-
e.dispatchCommand(
|
|
190
|
+
e.dispatchCommand(z, "italic");
|
|
191
191
|
}
|
|
192
192
|
});
|
|
193
|
-
},
|
|
194
|
-
let [e] =
|
|
193
|
+
}, ze = () => {
|
|
194
|
+
let [e] = B(), { t } = a(), { fontSize: n, headingTag: r } = Y(), i = ne(() => d.map((e) => ({
|
|
195
195
|
key: e.value,
|
|
196
196
|
label: e.label
|
|
197
197
|
})), []), o = C((t) => {
|
|
198
198
|
let n = t.key;
|
|
199
199
|
e.update(() => {
|
|
200
|
-
let e =
|
|
201
|
-
|
|
200
|
+
let e = I();
|
|
201
|
+
L(e) && V(e, { "font-size": n });
|
|
202
202
|
});
|
|
203
203
|
}, [e]);
|
|
204
|
-
return r ? /* @__PURE__ */ v(
|
|
204
|
+
return r ? /* @__PURE__ */ v(J, {
|
|
205
205
|
icon: "fontsize",
|
|
206
206
|
tooltip: t("editor.fontSize"),
|
|
207
207
|
disabled: !0
|
|
@@ -216,18 +216,18 @@ var z = {
|
|
|
216
216
|
},
|
|
217
217
|
children: /* @__PURE__ */ v("div", {
|
|
218
218
|
className: "dropdown__trigger inline-flex",
|
|
219
|
-
children: /* @__PURE__ */ v(
|
|
219
|
+
children: /* @__PURE__ */ v(J, {
|
|
220
220
|
icon: "fontsize",
|
|
221
221
|
tooltip: t("editor.fontSize"),
|
|
222
222
|
active: !1
|
|
223
223
|
})
|
|
224
224
|
})
|
|
225
225
|
});
|
|
226
|
-
},
|
|
227
|
-
let [e] =
|
|
226
|
+
}, Be = () => {
|
|
227
|
+
let [e] = B(), t = Y(), { t: n } = a(), r = C((t) => {
|
|
228
228
|
e.update(() => {
|
|
229
|
-
let e =
|
|
230
|
-
|
|
229
|
+
let e = I();
|
|
230
|
+
L(e) && V(e, { color: t });
|
|
231
231
|
});
|
|
232
232
|
}, [e]);
|
|
233
233
|
return /* @__PURE__ */ v(i, {
|
|
@@ -237,7 +237,7 @@ var z = {
|
|
|
237
237
|
presetColors: "basic",
|
|
238
238
|
children: /* @__PURE__ */ v("div", {
|
|
239
239
|
className: "trigger-picker inline-flex",
|
|
240
|
-
children: /* @__PURE__ */ v(
|
|
240
|
+
children: /* @__PURE__ */ v(J, {
|
|
241
241
|
icon: "fontcolor",
|
|
242
242
|
tooltip: n("editor.fontColor"),
|
|
243
243
|
onClick: () => {},
|
|
@@ -245,11 +245,11 @@ var z = {
|
|
|
245
245
|
})
|
|
246
246
|
})
|
|
247
247
|
});
|
|
248
|
-
},
|
|
249
|
-
let [e] =
|
|
248
|
+
}, Ve = () => {
|
|
249
|
+
let [e] = B(), t = Y(), { t: n } = a(), r = C((t) => {
|
|
250
250
|
e.update(() => {
|
|
251
|
-
let e =
|
|
252
|
-
|
|
251
|
+
let e = I();
|
|
252
|
+
L(e) && V(e, { "background-color": t });
|
|
253
253
|
});
|
|
254
254
|
}, [e]);
|
|
255
255
|
return /* @__PURE__ */ v(i, {
|
|
@@ -259,7 +259,7 @@ var z = {
|
|
|
259
259
|
presetColors: "basic",
|
|
260
260
|
children: /* @__PURE__ */ v("div", {
|
|
261
261
|
className: "trigger-picker inline-flex",
|
|
262
|
-
children: /* @__PURE__ */ v(
|
|
262
|
+
children: /* @__PURE__ */ v(J, {
|
|
263
263
|
icon: "fill",
|
|
264
264
|
tooltip: n("editor.fill"),
|
|
265
265
|
onClick: () => {},
|
|
@@ -267,8 +267,8 @@ var z = {
|
|
|
267
267
|
})
|
|
268
268
|
})
|
|
269
269
|
});
|
|
270
|
-
},
|
|
271
|
-
let [e] =
|
|
270
|
+
}, He = () => {
|
|
271
|
+
let [e] = B(), { align: t } = Y(), { t: n } = a(), r = [
|
|
272
272
|
{
|
|
273
273
|
key: "left",
|
|
274
274
|
label: n("leftAlign"),
|
|
@@ -285,7 +285,7 @@ var z = {
|
|
|
285
285
|
icon: /* @__PURE__ */ v(m, {})
|
|
286
286
|
}
|
|
287
287
|
], i = C((t) => {
|
|
288
|
-
e.dispatchCommand(
|
|
288
|
+
e.dispatchCommand(de, t);
|
|
289
289
|
}, [e]), o = r.map((e) => ({
|
|
290
290
|
key: e.key,
|
|
291
291
|
label: /* @__PURE__ */ y("div", {
|
|
@@ -306,7 +306,7 @@ var z = {
|
|
|
306
306
|
},
|
|
307
307
|
children: /* @__PURE__ */ v("div", {
|
|
308
308
|
className: "trigger-dropdown inline-flex text-sm",
|
|
309
|
-
children: /* @__PURE__ */ v(
|
|
309
|
+
children: /* @__PURE__ */ v(J, {
|
|
310
310
|
icon: c,
|
|
311
311
|
tooltip: n("editor.alignment"),
|
|
312
312
|
onClick: () => {},
|
|
@@ -317,40 +317,40 @@ var z = {
|
|
|
317
317
|
};
|
|
318
318
|
//#endregion
|
|
319
319
|
//#region src/components/Editor/ToolbarPlugin/Buttons/LinkButton.tsx
|
|
320
|
-
function
|
|
320
|
+
function Ue(e) {
|
|
321
321
|
return e ? e.startsWith("@") ? "javascript:void(0);" : e.match(/^https?:\/\//) ? e : `http://${e}` : "";
|
|
322
322
|
}
|
|
323
|
-
var
|
|
324
|
-
let [e] =
|
|
323
|
+
var We = () => {
|
|
324
|
+
let [e] = B(), { link: t } = Y(), { t: n } = a(), [i, o] = D(!1), [c, l] = D(""), [u, d] = D(""), [f, p] = D(!0), [m, h] = j.useMessage(), g = E(null), b = C((t) => {
|
|
325
325
|
o(t), t || e.setEditable(!0);
|
|
326
326
|
}, [e]), x = () => {
|
|
327
327
|
if (!c) {
|
|
328
328
|
m.warning(n("editor.linkAddressEmpty"));
|
|
329
329
|
return;
|
|
330
330
|
}
|
|
331
|
-
let t =
|
|
331
|
+
let t = Ue(c);
|
|
332
332
|
e.setEditable(!0), e.update(() => {
|
|
333
333
|
let e = f ? {
|
|
334
334
|
target: "_blank",
|
|
335
335
|
rel: "noopener noreferrer",
|
|
336
336
|
title: c
|
|
337
337
|
} : { title: c }, n = g.current;
|
|
338
|
-
n !== null &&
|
|
339
|
-
let r =
|
|
340
|
-
if (
|
|
338
|
+
n !== null && ce(n);
|
|
339
|
+
let r = I();
|
|
340
|
+
if (L(r)) {
|
|
341
341
|
let n = u || c, i = r.getTextContent();
|
|
342
|
-
if (!r.isCollapsed() && n === i)
|
|
342
|
+
if (!r.isCollapsed() && n === i) ve(t, e);
|
|
343
343
|
else {
|
|
344
|
-
let i = r.anchor.getNode(), a =
|
|
344
|
+
let i = r.anchor.getNode(), a = se(i) ? i : null, o = r.style || r.getNodes().find(se)?.getStyle() || a?.getStyle() || "", s = r.format || a?.getFormat() || 0, c = U(t, e), l = ie(n);
|
|
345
345
|
l.setFormat(s), l.setStyle(o), c.append(l), r.insertNodes([c]);
|
|
346
346
|
}
|
|
347
347
|
} else {
|
|
348
|
-
let n =
|
|
349
|
-
n.append(
|
|
350
|
-
let r =
|
|
351
|
-
if (
|
|
348
|
+
let n = U(t, e);
|
|
349
|
+
n.append(ie(u || c));
|
|
350
|
+
let r = ae(), i = r.getLastChild();
|
|
351
|
+
if (oe(i) && i.isEmpty()) i.append(n);
|
|
352
352
|
else {
|
|
353
|
-
let e =
|
|
353
|
+
let e = F();
|
|
354
354
|
e.append(n), r.append(e);
|
|
355
355
|
}
|
|
356
356
|
}
|
|
@@ -358,14 +358,14 @@ var Ke = () => {
|
|
|
358
358
|
}, S = C(() => {
|
|
359
359
|
let n = "";
|
|
360
360
|
e.getEditorState().read(() => {
|
|
361
|
-
let e =
|
|
362
|
-
g.current = e ? e.clone() : null,
|
|
361
|
+
let e = I();
|
|
362
|
+
g.current = e ? e.clone() : null, L(e) && !e.isCollapsed() && (n = e.getTextContent());
|
|
363
363
|
}), e.setEditable(!1), e.update(() => {
|
|
364
|
-
|
|
364
|
+
ce(null);
|
|
365
365
|
}), window.getSelection()?.removeAllRanges(), e.getRootElement()?.blur(), t ? (l(t.link === "javascript:void(0);" ? "" : t.link ?? ""), d(t.linkText ?? "")) : (l(""), d(n)), o(!0);
|
|
366
366
|
}, [t, e]);
|
|
367
367
|
return /* @__PURE__ */ y(_, { children: [
|
|
368
|
-
/* @__PURE__ */ v(
|
|
368
|
+
/* @__PURE__ */ v(J, {
|
|
369
369
|
icon: "Insertlink",
|
|
370
370
|
tooltip: n("link"),
|
|
371
371
|
onClick: S,
|
|
@@ -428,16 +428,16 @@ var Ke = () => {
|
|
|
428
428
|
})] })
|
|
429
429
|
})
|
|
430
430
|
] });
|
|
431
|
-
},
|
|
432
|
-
let [e] =
|
|
433
|
-
return /* @__PURE__ */ v(
|
|
431
|
+
}, Ge = () => {
|
|
432
|
+
let [e] = B(), { link: t } = Y(), { t: n } = a();
|
|
433
|
+
return /* @__PURE__ */ v(J, {
|
|
434
434
|
icon: "cancellink",
|
|
435
435
|
tooltip: n("cancelLink"),
|
|
436
436
|
onClick: () => {
|
|
437
|
-
t && e.dispatchCommand(
|
|
437
|
+
t && e.dispatchCommand(ye, null);
|
|
438
438
|
}
|
|
439
439
|
});
|
|
440
|
-
},
|
|
440
|
+
}, X = {
|
|
441
441
|
"picture-modal__container": "_picture-modal__container_oo6vo_1",
|
|
442
442
|
"picture-modal__sidebar": "_picture-modal__sidebar_oo6vo_4",
|
|
443
443
|
"picture-modal__menu-list": "_picture-modal__menu-list_oo6vo_8",
|
|
@@ -458,7 +458,7 @@ var Ke = () => {
|
|
|
458
458
|
"picture-modal__preview-delete": "_picture-modal__preview-delete_oo6vo_118",
|
|
459
459
|
"picture-modal__upload-text": "_picture-modal__upload-text_oo6vo_126",
|
|
460
460
|
"picture-modal__footer": "_picture-modal__footer_oo6vo_130"
|
|
461
|
-
},
|
|
461
|
+
}, Ke = S((e, t) => {
|
|
462
462
|
let [n] = k.useForm(), [r, i] = D(""), { t: o } = a(), s = (e) => /^https?:\/\/.+/i.test(e);
|
|
463
463
|
return ee(t, () => ({ getValue: async () => {
|
|
464
464
|
try {
|
|
@@ -467,7 +467,7 @@ var Ke = () => {
|
|
|
467
467
|
throw Error("URL validation failed");
|
|
468
468
|
}
|
|
469
469
|
} })), /* @__PURE__ */ y(_, { children: [/* @__PURE__ */ v("div", {
|
|
470
|
-
className:
|
|
470
|
+
className: X["picture-modal__content-title"],
|
|
471
471
|
"data-title": o("editor.imageUrlNote"),
|
|
472
472
|
children: o("editor.enterImageUrl")
|
|
473
473
|
}), /* @__PURE__ */ v(k, {
|
|
@@ -486,17 +486,17 @@ var Ke = () => {
|
|
|
486
486
|
})
|
|
487
487
|
})] });
|
|
488
488
|
});
|
|
489
|
-
|
|
489
|
+
Ke.displayName = "LinkInput";
|
|
490
490
|
//#endregion
|
|
491
491
|
//#region src/components/Editor/utils/formatTruncatedFilename.ts
|
|
492
|
-
var
|
|
492
|
+
var qe = "......", Je = (e, t, n) => {
|
|
493
493
|
if (t <= 0 || n(e) <= t) return {
|
|
494
494
|
display: e,
|
|
495
495
|
truncated: !1
|
|
496
496
|
};
|
|
497
|
-
let r = e.lastIndexOf("."), i = r > 0 && r < e.length - 1, a = i ? e.slice(0, r) : e, o = i ? e.slice(r) : "", s = a.slice(-2), c = a.slice(0, -2), l = (e) => `${e}${
|
|
497
|
+
let r = e.lastIndexOf("."), i = r > 0 && r < e.length - 1, a = i ? e.slice(0, r) : e, o = i ? e.slice(r) : "", s = a.slice(-2), c = a.slice(0, -2), l = (e) => `${e}${qe}${s}${o}`, u = (e) => n(e) <= t;
|
|
498
498
|
if (!u(l(""))) {
|
|
499
|
-
let t = `${
|
|
499
|
+
let t = `${qe}${o}`;
|
|
500
500
|
return {
|
|
501
501
|
display: u(t) ? t : e,
|
|
502
502
|
truncated: !0
|
|
@@ -511,7 +511,7 @@ var Ye = "......", Xe = (e, t, n) => {
|
|
|
511
511
|
display: l(c.slice(0, p)),
|
|
512
512
|
truncated: !0
|
|
513
513
|
};
|
|
514
|
-
},
|
|
514
|
+
}, Ye = {
|
|
515
515
|
duration: .2,
|
|
516
516
|
ease: [
|
|
517
517
|
.4,
|
|
@@ -519,14 +519,14 @@ var Ye = "......", Xe = (e, t, n) => {
|
|
|
519
519
|
.2,
|
|
520
520
|
1
|
|
521
521
|
]
|
|
522
|
-
},
|
|
522
|
+
}, Xe = ({ name: e }) => {
|
|
523
523
|
let t = E(null), [n, r] = D(e), [i, a] = D(!1);
|
|
524
524
|
return te(() => {
|
|
525
525
|
let n = t.current, i = document.createElement("canvas").getContext("2d");
|
|
526
526
|
if (!n || !i) return;
|
|
527
527
|
let o = () => {
|
|
528
528
|
i.font = getComputedStyle(n).font;
|
|
529
|
-
let t =
|
|
529
|
+
let t = Je(e, n.clientWidth, (e) => i.measureText(e).width);
|
|
530
530
|
r(t.display), a(t.truncated);
|
|
531
531
|
};
|
|
532
532
|
o();
|
|
@@ -534,14 +534,14 @@ var Ye = "......", Xe = (e, t, n) => {
|
|
|
534
534
|
return s.observe(n), () => s.disconnect();
|
|
535
535
|
}, [e]), /* @__PURE__ */ v("div", {
|
|
536
536
|
ref: t,
|
|
537
|
-
className:
|
|
537
|
+
className: X["picture-modal__preview-filename"],
|
|
538
538
|
title: i ? e : void 0,
|
|
539
539
|
children: n
|
|
540
540
|
});
|
|
541
|
-
},
|
|
541
|
+
}, Ze = (e) => new Promise((t, n) => {
|
|
542
542
|
let r = new FileReader();
|
|
543
543
|
r.onload = () => t(r.result), r.onerror = () => n(r.error), r.readAsDataURL(e);
|
|
544
|
-
}),
|
|
544
|
+
}), Qe = S((t, n) => {
|
|
545
545
|
let [r, i] = D(!1), [o, s] = D([]), c = E(o);
|
|
546
546
|
c.current = o;
|
|
547
547
|
let l = E(null), [u, d] = j.useMessage(), { t: f } = a(), p = (e) => (e / 1024).toFixed(1) + "kb", m = (e) => e.type.startsWith("image/") ? e.size > 5242880 ? (u.warning(f("editor.imageSizeNote")), !1) : !0 : (u.warning(f("editor.onlyImageFormatsSupported")), !1), h = (e) => {
|
|
@@ -572,7 +572,7 @@ var Ye = "......", Xe = (e, t, n) => {
|
|
|
572
572
|
if (!o.length) throw u.warning(f("editor.pleaseUploadImageFirst")), Error(f("editor.pleaseUploadImageFirst"));
|
|
573
573
|
try {
|
|
574
574
|
return await Promise.all(o.map(async (e) => ({
|
|
575
|
-
src: await
|
|
575
|
+
src: await Ze(e.file),
|
|
576
576
|
fileName: e.file.name
|
|
577
577
|
})));
|
|
578
578
|
} catch {
|
|
@@ -594,27 +594,27 @@ var Ye = "......", Xe = (e, t, n) => {
|
|
|
594
594
|
},
|
|
595
595
|
children: [
|
|
596
596
|
/* @__PURE__ */ y("div", {
|
|
597
|
-
className:
|
|
597
|
+
className: X["picture-modal__ops"],
|
|
598
598
|
children: [/* @__PURE__ */ v("div", {
|
|
599
|
-
className:
|
|
599
|
+
className: X["picture-modal__content-title"],
|
|
600
600
|
"data-title": f("editor.imageSizeNote"),
|
|
601
601
|
children: f("editor.uploadImage")
|
|
602
602
|
}), /* @__PURE__ */ y("div", {
|
|
603
|
-
className: `${
|
|
603
|
+
className: `${X["picture-modal__upload-area"]} ${r ? X["picture-modal__upload-area--dragging"] : ""}`,
|
|
604
604
|
onClick: _,
|
|
605
605
|
children: [/* @__PURE__ */ v(e, { name: "upload" }), /* @__PURE__ */ v("span", {
|
|
606
|
-
className:
|
|
606
|
+
className: X["picture-modal__upload-text"],
|
|
607
607
|
children: f("editor.clickOrDragToUpload")
|
|
608
608
|
})]
|
|
609
609
|
})]
|
|
610
610
|
}),
|
|
611
611
|
o.length > 0 ? /* @__PURE__ */ v("div", {
|
|
612
|
-
className:
|
|
613
|
-
children: /* @__PURE__ */ v(
|
|
612
|
+
className: X["picture-modal__preview-list"],
|
|
613
|
+
children: /* @__PURE__ */ v(N, {
|
|
614
614
|
mode: "popLayout",
|
|
615
|
-
children: o.map((t) => /* @__PURE__ */ y(
|
|
615
|
+
children: o.map((t) => /* @__PURE__ */ y(P.div, {
|
|
616
616
|
layout: "position",
|
|
617
|
-
className:
|
|
617
|
+
className: X["picture-modal__preview"],
|
|
618
618
|
initial: {
|
|
619
619
|
opacity: 0,
|
|
620
620
|
y: 12
|
|
@@ -627,24 +627,24 @@ var Ye = "......", Xe = (e, t, n) => {
|
|
|
627
627
|
opacity: 0,
|
|
628
628
|
y: -8
|
|
629
629
|
},
|
|
630
|
-
transition:
|
|
630
|
+
transition: Ye,
|
|
631
631
|
children: [
|
|
632
632
|
/* @__PURE__ */ v("div", {
|
|
633
|
-
className:
|
|
633
|
+
className: X["picture-modal__preview-image"],
|
|
634
634
|
children: /* @__PURE__ */ v("img", {
|
|
635
635
|
src: t.url,
|
|
636
636
|
alt: f("editor.previewImage")
|
|
637
637
|
})
|
|
638
638
|
}),
|
|
639
639
|
/* @__PURE__ */ y("div", {
|
|
640
|
-
className:
|
|
641
|
-
children: [/* @__PURE__ */ v(
|
|
642
|
-
className:
|
|
640
|
+
className: X["picture-modal__preview-info"],
|
|
641
|
+
children: [/* @__PURE__ */ v(Xe, { name: t.file.name }), /* @__PURE__ */ v("div", {
|
|
642
|
+
className: X["picture-modal__preview-size"],
|
|
643
643
|
children: p(t.file.size)
|
|
644
644
|
})]
|
|
645
645
|
}),
|
|
646
646
|
/* @__PURE__ */ v("div", {
|
|
647
|
-
className:
|
|
647
|
+
className: X["picture-modal__preview-delete"],
|
|
648
648
|
role: "button",
|
|
649
649
|
onClick: () => g(t.id),
|
|
650
650
|
children: /* @__PURE__ */ v(e, { name: "delete" })
|
|
@@ -665,11 +665,11 @@ var Ye = "......", Xe = (e, t, n) => {
|
|
|
665
665
|
]
|
|
666
666
|
});
|
|
667
667
|
});
|
|
668
|
-
|
|
668
|
+
Qe.displayName = "UploadImage";
|
|
669
669
|
//#endregion
|
|
670
670
|
//#region src/components/Editor/commands/ImageCommands.ts
|
|
671
|
-
var
|
|
672
|
-
let { t } = a(), [n] =
|
|
671
|
+
var Z = ge("INSERT_INLINE_IMAGE_COMMAND"), $e = () => {
|
|
672
|
+
let { t } = a(), [n] = B(), [i, o] = D(!1), s = E(null), l = E(null), u = [{
|
|
673
673
|
key: "upload",
|
|
674
674
|
title: t("editor.uploadImage"),
|
|
675
675
|
icon: /* @__PURE__ */ v(e, { name: "picture" })
|
|
@@ -680,14 +680,14 @@ var Y = ye("INSERT_INLINE_IMAGE_COMMAND"), tt = () => {
|
|
|
680
680
|
}], [d, f] = D(u[0].key), p = async () => {
|
|
681
681
|
try {
|
|
682
682
|
if (d === "upload" && l.current) (await l.current.getValue()).forEach((e) => {
|
|
683
|
-
n.dispatchCommand(
|
|
683
|
+
n.dispatchCommand(Z, {
|
|
684
684
|
src: e.src,
|
|
685
685
|
altText: e.fileName
|
|
686
686
|
});
|
|
687
687
|
});
|
|
688
688
|
else if (s.current) {
|
|
689
689
|
let e = await s.current.getValue();
|
|
690
|
-
n.dispatchCommand(
|
|
690
|
+
n.dispatchCommand(Z, {
|
|
691
691
|
src: e,
|
|
692
692
|
altText: e
|
|
693
693
|
});
|
|
@@ -697,10 +697,10 @@ var Y = ye("INSERT_INLINE_IMAGE_COMMAND"), tt = () => {
|
|
|
697
697
|
j.error(e instanceof Error ? e.message : t("editor.operationFailed"));
|
|
698
698
|
}
|
|
699
699
|
}, m = {
|
|
700
|
-
upload: /* @__PURE__ */ v(
|
|
701
|
-
url: /* @__PURE__ */ v(
|
|
700
|
+
upload: /* @__PURE__ */ v(Qe, { ref: l }),
|
|
701
|
+
url: /* @__PURE__ */ v(Ke, { ref: s })
|
|
702
702
|
};
|
|
703
|
-
return /* @__PURE__ */ y(_, { children: [/* @__PURE__ */ v(
|
|
703
|
+
return /* @__PURE__ */ y(_, { children: [/* @__PURE__ */ v(J, {
|
|
704
704
|
icon: "picture",
|
|
705
705
|
tooltip: t("picture"),
|
|
706
706
|
onClick: () => o(!0)
|
|
@@ -710,27 +710,27 @@ var Y = ye("INSERT_INLINE_IMAGE_COMMAND"), tt = () => {
|
|
|
710
710
|
onOpenChange: o,
|
|
711
711
|
width: "620px",
|
|
712
712
|
children: [/* @__PURE__ */ y("div", {
|
|
713
|
-
className:
|
|
713
|
+
className: X["picture-modal__container"],
|
|
714
714
|
children: [/* @__PURE__ */ v("div", {
|
|
715
|
-
className:
|
|
715
|
+
className: X["picture-modal__sidebar"],
|
|
716
716
|
children: /* @__PURE__ */ v("ul", {
|
|
717
|
-
className:
|
|
717
|
+
className: X["picture-modal__menu-list"],
|
|
718
718
|
children: u.map((e) => /* @__PURE__ */ y("li", {
|
|
719
|
-
className: `${
|
|
719
|
+
className: `${X["picture-modal__menu-item"]} ${d === e.key ? X["picture-modal__menu-item--active"] : ""}`,
|
|
720
720
|
onClick: () => f(e.key),
|
|
721
721
|
children: [/* @__PURE__ */ v("span", {
|
|
722
|
-
className:
|
|
722
|
+
className: X["picture-modal__menu-icon"],
|
|
723
723
|
children: e.icon
|
|
724
724
|
}), /* @__PURE__ */ v("span", { children: e.title })]
|
|
725
725
|
}, e.title))
|
|
726
726
|
})
|
|
727
727
|
}), /* @__PURE__ */ v(c, {
|
|
728
|
-
className:
|
|
729
|
-
contentClassName:
|
|
728
|
+
className: X["picture-modal__content"],
|
|
729
|
+
contentClassName: X["picture-modal__content-body"],
|
|
730
730
|
children: m[d]
|
|
731
731
|
})]
|
|
732
732
|
}), /* @__PURE__ */ y("div", {
|
|
733
|
-
className:
|
|
733
|
+
className: X["picture-modal__footer"],
|
|
734
734
|
children: [/* @__PURE__ */ v(O, {
|
|
735
735
|
onClick: () => o(!1),
|
|
736
736
|
children: t("cancel")
|
|
@@ -741,235 +741,103 @@ var Y = ye("INSERT_INLINE_IMAGE_COMMAND"), tt = () => {
|
|
|
741
741
|
})]
|
|
742
742
|
})]
|
|
743
743
|
})] });
|
|
744
|
-
},
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
viewBox: "0 0 24 24",
|
|
749
|
-
fill: "none",
|
|
750
|
-
stroke: "currentColor",
|
|
751
|
-
strokeWidth: 2,
|
|
752
|
-
strokeLinecap: "round",
|
|
753
|
-
strokeLinejoin: "round"
|
|
754
|
-
}, nt = () => /* @__PURE__ */ y("svg", {
|
|
755
|
-
...X,
|
|
756
|
-
children: [
|
|
757
|
-
/* @__PURE__ */ v("path", { d: "M16 4H9a3 3 0 0 0-2.83 4" }),
|
|
758
|
-
/* @__PURE__ */ v("path", { d: "M14 12a4 4 0 0 1 0 8H6" }),
|
|
759
|
-
/* @__PURE__ */ v("line", {
|
|
760
|
-
x1: "4",
|
|
761
|
-
x2: "20",
|
|
762
|
-
y1: "12",
|
|
763
|
-
y2: "12"
|
|
764
|
-
})
|
|
765
|
-
]
|
|
766
|
-
}), rt = () => /* @__PURE__ */ y("svg", {
|
|
767
|
-
...X,
|
|
768
|
-
children: [/* @__PURE__ */ v("path", { d: "M9 14 4 9l5-5" }), /* @__PURE__ */ v("path", { d: "M4 9h10.5a5.5 5.5 0 0 1 5.5 5.5a5.5 5.5 0 0 1-5.5 5.5H11" })]
|
|
769
|
-
}), it = () => /* @__PURE__ */ y("svg", {
|
|
770
|
-
...X,
|
|
771
|
-
children: [/* @__PURE__ */ v("path", { d: "m15 14 5-5-5-5" }), /* @__PURE__ */ v("path", { d: "M20 9H9.5A5.5 5.5 0 0 0 4 14.5A5.5 5.5 0 0 0 9.5 20H13" })]
|
|
772
|
-
}), at = () => /* @__PURE__ */ y("svg", {
|
|
773
|
-
...X,
|
|
774
|
-
children: [
|
|
775
|
-
/* @__PURE__ */ v("path", { d: "m4 19 8-8" }),
|
|
776
|
-
/* @__PURE__ */ v("path", { d: "m12 19-8-8" }),
|
|
777
|
-
/* @__PURE__ */ v("path", { d: "M20 12h-4c0-1.5.442-2 1.5-2.5S20 8.334 20 7.002c0-.472-.17-.93-.484-1.29a2.105 2.105 0 0 0-2.617-.436c-.42.239-.738.614-.899 1.06" })
|
|
778
|
-
]
|
|
779
|
-
}), ot = () => /* @__PURE__ */ y("svg", {
|
|
780
|
-
...X,
|
|
781
|
-
children: [
|
|
782
|
-
/* @__PURE__ */ v("path", { d: "m4 5 8 8" }),
|
|
783
|
-
/* @__PURE__ */ v("path", { d: "m12 5-8 8" }),
|
|
784
|
-
/* @__PURE__ */ v("path", { d: "M20 19h-4c0-1.5.44-2 1.5-2.5S20 15.33 20 14c0-.47-.17-.93-.48-1.29a2.11 2.11 0 0 0-2.62-.44c-.42.24-.74.62-.9 1.07" })
|
|
785
|
-
]
|
|
786
|
-
}), st = () => /* @__PURE__ */ y("svg", {
|
|
787
|
-
...X,
|
|
788
|
-
children: [
|
|
789
|
-
/* @__PURE__ */ v("path", { d: "M21 5H11" }),
|
|
790
|
-
/* @__PURE__ */ v("path", { d: "M21 12H11" }),
|
|
791
|
-
/* @__PURE__ */ v("path", { d: "M21 19H11" }),
|
|
792
|
-
/* @__PURE__ */ v("path", { d: "m3 8 4 4-4 4" })
|
|
793
|
-
]
|
|
794
|
-
}), ct = () => /* @__PURE__ */ y("svg", {
|
|
795
|
-
...X,
|
|
796
|
-
children: [
|
|
797
|
-
/* @__PURE__ */ v("path", { d: "M21 5H11" }),
|
|
798
|
-
/* @__PURE__ */ v("path", { d: "M21 12H11" }),
|
|
799
|
-
/* @__PURE__ */ v("path", { d: "M21 19H11" }),
|
|
800
|
-
/* @__PURE__ */ v("path", { d: "m7 8-4 4 4 4" })
|
|
801
|
-
]
|
|
802
|
-
}), lt = () => /* @__PURE__ */ y("svg", {
|
|
803
|
-
...X,
|
|
804
|
-
children: [
|
|
805
|
-
/* @__PURE__ */ v("path", { d: "M11 5h10" }),
|
|
806
|
-
/* @__PURE__ */ v("path", { d: "M11 12h10" }),
|
|
807
|
-
/* @__PURE__ */ v("path", { d: "M11 19h10" }),
|
|
808
|
-
/* @__PURE__ */ v("path", { d: "M4 4h1v5" }),
|
|
809
|
-
/* @__PURE__ */ v("path", { d: "M4 9h2" }),
|
|
810
|
-
/* @__PURE__ */ v("path", { d: "M6.5 20H3.4c0-1 2.6-1.925 2.6-3.5a1.5 1.5 0 0 0-2.6-1.02" })
|
|
811
|
-
]
|
|
812
|
-
}), ut = () => /* @__PURE__ */ y("svg", {
|
|
813
|
-
...X,
|
|
814
|
-
children: [
|
|
815
|
-
/* @__PURE__ */ v("path", { d: "M3 5h.01" }),
|
|
816
|
-
/* @__PURE__ */ v("path", { d: "M3 12h.01" }),
|
|
817
|
-
/* @__PURE__ */ v("path", { d: "M3 19h.01" }),
|
|
818
|
-
/* @__PURE__ */ v("path", { d: "M8 5h13" }),
|
|
819
|
-
/* @__PURE__ */ v("path", { d: "M8 12h13" }),
|
|
820
|
-
/* @__PURE__ */ v("path", { d: "M8 19h13" })
|
|
821
|
-
]
|
|
822
|
-
}), dt = () => /* @__PURE__ */ y("svg", {
|
|
823
|
-
...X,
|
|
824
|
-
className: "lucide lucide-code-xml-icon lucide-code-xml",
|
|
825
|
-
children: [
|
|
826
|
-
/* @__PURE__ */ v("path", { d: "m18 16 4-4-4-4" }),
|
|
827
|
-
/* @__PURE__ */ v("path", { d: "m6 8-4 4 4 4" }),
|
|
828
|
-
/* @__PURE__ */ v("path", { d: "m14.5 4-5 16" })
|
|
829
|
-
]
|
|
830
|
-
}), ft = () => /* @__PURE__ */ y("svg", {
|
|
831
|
-
...X,
|
|
832
|
-
className: "lucide lucide-sheet-icon lucide-sheet",
|
|
833
|
-
children: [
|
|
834
|
-
/* @__PURE__ */ v("rect", {
|
|
835
|
-
width: "18",
|
|
836
|
-
height: "18",
|
|
837
|
-
x: "3",
|
|
838
|
-
y: "3",
|
|
839
|
-
rx: "2",
|
|
840
|
-
ry: "2"
|
|
841
|
-
}),
|
|
842
|
-
/* @__PURE__ */ v("line", {
|
|
843
|
-
x1: "3",
|
|
844
|
-
x2: "21",
|
|
845
|
-
y1: "9",
|
|
846
|
-
y2: "9"
|
|
847
|
-
}),
|
|
848
|
-
/* @__PURE__ */ v("line", {
|
|
849
|
-
x1: "3",
|
|
850
|
-
x2: "21",
|
|
851
|
-
y1: "15",
|
|
852
|
-
y2: "15"
|
|
853
|
-
}),
|
|
854
|
-
/* @__PURE__ */ v("line", {
|
|
855
|
-
x1: "9",
|
|
856
|
-
x2: "9",
|
|
857
|
-
y1: "9",
|
|
858
|
-
y2: "21"
|
|
859
|
-
}),
|
|
860
|
-
/* @__PURE__ */ v("line", {
|
|
861
|
-
x1: "15",
|
|
862
|
-
x2: "15",
|
|
863
|
-
y1: "9",
|
|
864
|
-
y2: "21"
|
|
865
|
-
})
|
|
866
|
-
]
|
|
867
|
-
}), pt = () => /* @__PURE__ */ y("svg", {
|
|
868
|
-
...X,
|
|
869
|
-
className: "lucide lucide-file-code-corner-icon lucide-file-code-corner",
|
|
870
|
-
children: [
|
|
871
|
-
/* @__PURE__ */ v("path", { d: "M4 12.15V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.706.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2h-3.35" }),
|
|
872
|
-
/* @__PURE__ */ v("path", { d: "M14 2v5a1 1 0 0 0 1 1h5" }),
|
|
873
|
-
/* @__PURE__ */ v("path", { d: "m5 16-3 3 3 3" }),
|
|
874
|
-
/* @__PURE__ */ v("path", { d: "m9 22 3-3-3-3" })
|
|
875
|
-
]
|
|
876
|
-
}), mt = () => {
|
|
877
|
-
let [e] = L(), { canUndo: t } = Ne(), { t: n } = a();
|
|
878
|
-
return /* @__PURE__ */ v(K, {
|
|
879
|
-
icon: /* @__PURE__ */ v(rt, {}),
|
|
744
|
+
}, et = () => {
|
|
745
|
+
let [e] = B(), { canUndo: t } = K(), { t: n } = a();
|
|
746
|
+
return /* @__PURE__ */ v(J, {
|
|
747
|
+
icon: "chexiao",
|
|
880
748
|
tooltip: n("editor.undo"),
|
|
881
749
|
disabled: !t,
|
|
882
750
|
onClick: () => {
|
|
883
|
-
e.dispatchCommand(
|
|
751
|
+
e.dispatchCommand(he, void 0);
|
|
884
752
|
}
|
|
885
753
|
});
|
|
886
|
-
},
|
|
887
|
-
let [e] =
|
|
888
|
-
return /* @__PURE__ */ v(
|
|
889
|
-
icon:
|
|
754
|
+
}, tt = () => {
|
|
755
|
+
let [e] = B(), { canRedo: t } = K(), { t: n } = a();
|
|
756
|
+
return /* @__PURE__ */ v(J, {
|
|
757
|
+
icon: "fanhui",
|
|
890
758
|
tooltip: n("editor.redo"),
|
|
891
759
|
disabled: !t,
|
|
892
|
-
onClick: () => e.dispatchCommand(
|
|
760
|
+
onClick: () => e.dispatchCommand(me, void 0)
|
|
893
761
|
});
|
|
894
|
-
},
|
|
895
|
-
let [e] =
|
|
896
|
-
return /* @__PURE__ */ v(
|
|
897
|
-
icon:
|
|
762
|
+
}, nt = () => {
|
|
763
|
+
let [e] = B(), { strikethrough: t } = Y(), { t: n } = a();
|
|
764
|
+
return /* @__PURE__ */ v(J, {
|
|
765
|
+
icon: "shanchuxian",
|
|
898
766
|
tooltip: n("editor.strikethrough"),
|
|
899
767
|
active: t,
|
|
900
|
-
onClick: () => e.dispatchCommand(
|
|
768
|
+
onClick: () => e.dispatchCommand(z, "strikethrough")
|
|
901
769
|
});
|
|
902
|
-
},
|
|
903
|
-
let [e] =
|
|
904
|
-
return /* @__PURE__ */ v(
|
|
905
|
-
icon:
|
|
770
|
+
}, rt = () => {
|
|
771
|
+
let [e] = B(), { superscript: t } = Y(), { t: n } = a();
|
|
772
|
+
return /* @__PURE__ */ v(J, {
|
|
773
|
+
icon: "shangbiao",
|
|
906
774
|
tooltip: n("editor.superscript"),
|
|
907
775
|
active: t,
|
|
908
|
-
onClick: () => e.dispatchCommand(
|
|
776
|
+
onClick: () => e.dispatchCommand(z, "superscript")
|
|
909
777
|
});
|
|
910
|
-
},
|
|
911
|
-
let [e] =
|
|
912
|
-
return /* @__PURE__ */ v(
|
|
913
|
-
icon:
|
|
778
|
+
}, it = () => {
|
|
779
|
+
let [e] = B(), { subscript: t } = Y(), { t: n } = a();
|
|
780
|
+
return /* @__PURE__ */ v(J, {
|
|
781
|
+
icon: "xiabiao",
|
|
914
782
|
tooltip: n("editor.subscript"),
|
|
915
783
|
active: t,
|
|
916
|
-
onClick: () => e.dispatchCommand(
|
|
784
|
+
onClick: () => e.dispatchCommand(z, "subscript")
|
|
917
785
|
});
|
|
918
|
-
},
|
|
919
|
-
let [e] =
|
|
920
|
-
return /* @__PURE__ */ v(
|
|
921
|
-
icon:
|
|
786
|
+
}, at = () => {
|
|
787
|
+
let [e] = B(), { t } = a();
|
|
788
|
+
return /* @__PURE__ */ v(J, {
|
|
789
|
+
icon: "zengjiasuojin",
|
|
922
790
|
tooltip: t("editor.indent"),
|
|
923
|
-
onClick: () => e.dispatchCommand(
|
|
791
|
+
onClick: () => e.dispatchCommand(fe, void 0)
|
|
924
792
|
});
|
|
925
|
-
},
|
|
926
|
-
let [e] =
|
|
927
|
-
return /* @__PURE__ */ v(
|
|
928
|
-
icon:
|
|
793
|
+
}, ot = () => {
|
|
794
|
+
let [e] = B(), { canOutdent: t } = Y(), { t: n } = a();
|
|
795
|
+
return /* @__PURE__ */ v(J, {
|
|
796
|
+
icon: "jianshaosuojin",
|
|
929
797
|
tooltip: n("editor.outdent"),
|
|
930
798
|
disabled: !t,
|
|
931
|
-
onClick: () => e.dispatchCommand(
|
|
799
|
+
onClick: () => e.dispatchCommand(pe, void 0)
|
|
932
800
|
});
|
|
933
|
-
},
|
|
934
|
-
let [e] =
|
|
935
|
-
return /* @__PURE__ */ v(
|
|
936
|
-
icon:
|
|
801
|
+
}, st = () => {
|
|
802
|
+
let [e] = B(), { listType: t } = Y(), { t: n } = a(), r = t === "bullet";
|
|
803
|
+
return /* @__PURE__ */ v(J, {
|
|
804
|
+
icon: "xuhaoliebiao",
|
|
937
805
|
tooltip: n("editor.bulletList"),
|
|
938
806
|
active: r,
|
|
939
807
|
onClick: () => {
|
|
940
|
-
e.dispatchCommand(r ?
|
|
808
|
+
e.dispatchCommand(r ? Se : xe, void 0);
|
|
941
809
|
}
|
|
942
810
|
});
|
|
943
|
-
},
|
|
944
|
-
let [e] =
|
|
945
|
-
return /* @__PURE__ */ v(
|
|
946
|
-
icon:
|
|
811
|
+
}, ct = () => {
|
|
812
|
+
let [e] = B(), { listType: t } = Y(), { t: n } = a(), r = t === "number";
|
|
813
|
+
return /* @__PURE__ */ v(J, {
|
|
814
|
+
icon: "bianhaoliebiao",
|
|
947
815
|
tooltip: n("editor.numberList"),
|
|
948
816
|
active: r,
|
|
949
817
|
onClick: () => {
|
|
950
|
-
e.dispatchCommand(r ?
|
|
818
|
+
e.dispatchCommand(r ? Se : be, void 0);
|
|
951
819
|
}
|
|
952
820
|
});
|
|
953
|
-
},
|
|
954
|
-
let [e] =
|
|
955
|
-
return /* @__PURE__ */ v(
|
|
956
|
-
icon:
|
|
821
|
+
}, lt = () => {
|
|
822
|
+
let [e] = B(), { isCodeBlock: t } = Y(), { t: n } = a();
|
|
823
|
+
return /* @__PURE__ */ v(J, {
|
|
824
|
+
icon: "daima",
|
|
957
825
|
tooltip: n("editor.codeBlock"),
|
|
958
826
|
active: t,
|
|
959
827
|
onClick: () => {
|
|
960
828
|
e.update(() => {
|
|
961
|
-
|
|
829
|
+
H(I(), () => t ? F() : Ce(G));
|
|
962
830
|
});
|
|
963
831
|
}
|
|
964
832
|
});
|
|
965
|
-
},
|
|
833
|
+
}, Q = {
|
|
966
834
|
"bsy-lexical__table-picker": "_bsy-lexical__table-picker_mv0nn_1",
|
|
967
835
|
"bsy-lexical__table-picker-grid": "_bsy-lexical__table-picker-grid_mv0nn_9",
|
|
968
836
|
"bsy-lexical__table-picker-cell": "_bsy-lexical__table-picker-cell_mv0nn_15",
|
|
969
837
|
"bsy-lexical__table-picker-cell--active": "_bsy-lexical__table-picker-cell--active_mv0nn_24",
|
|
970
838
|
"bsy-lexical__table-picker-label": "_bsy-lexical__table-picker-label_mv0nn_28"
|
|
971
|
-
},
|
|
972
|
-
let [e] =
|
|
839
|
+
}, ut = g(1, 11), dt = () => {
|
|
840
|
+
let [e] = B(), { isInTable: r } = Y(), { t: i } = a(), s = t(), [c, u] = D(!1), [d, f] = D({
|
|
973
841
|
rows: 0,
|
|
974
842
|
cols: 0
|
|
975
843
|
});
|
|
@@ -992,21 +860,21 @@ var Y = ye("INSERT_INLINE_IMAGE_COMMAND"), tt = () => {
|
|
|
992
860
|
y: 4
|
|
993
861
|
}
|
|
994
862
|
});
|
|
995
|
-
return r ? /* @__PURE__ */ v(
|
|
996
|
-
icon:
|
|
863
|
+
return r ? /* @__PURE__ */ v(J, {
|
|
864
|
+
icon: "charubiaoge",
|
|
997
865
|
tooltip: i("editor.table"),
|
|
998
866
|
disabled: !0
|
|
999
867
|
}) : /* @__PURE__ */ y(_, { children: [/* @__PURE__ */ v("div", {
|
|
1000
868
|
className: "inline-flex",
|
|
1001
869
|
ref: m.setReference,
|
|
1002
870
|
...g({ onClick: () => u((e) => !e) }),
|
|
1003
|
-
children: /* @__PURE__ */ v(
|
|
1004
|
-
icon:
|
|
871
|
+
children: /* @__PURE__ */ v(J, {
|
|
872
|
+
icon: "charubiaoge",
|
|
1005
873
|
tooltip: i("editor.table")
|
|
1006
874
|
})
|
|
1007
|
-
}), /* @__PURE__ */ v(
|
|
875
|
+
}), /* @__PURE__ */ v(re, { children: /* @__PURE__ */ v(N, { children: c ? /* @__PURE__ */ v(n, {
|
|
1008
876
|
zIndex: s,
|
|
1009
|
-
children: /* @__PURE__ */ v(
|
|
877
|
+
children: /* @__PURE__ */ v(P.div, {
|
|
1010
878
|
ref: m.setFloating,
|
|
1011
879
|
...b(),
|
|
1012
880
|
style: {
|
|
@@ -1015,23 +883,23 @@ var Y = ye("INSERT_INLINE_IMAGE_COMMAND"), tt = () => {
|
|
|
1015
883
|
},
|
|
1016
884
|
...o,
|
|
1017
885
|
children: /* @__PURE__ */ y("div", {
|
|
1018
|
-
className:
|
|
886
|
+
className: Q["bsy-lexical__table-picker"],
|
|
1019
887
|
onMouseDown: (e) => e.preventDefault(),
|
|
1020
888
|
onMouseLeave: () => f({
|
|
1021
889
|
rows: 0,
|
|
1022
890
|
cols: 0
|
|
1023
891
|
}),
|
|
1024
892
|
children: [/* @__PURE__ */ v("div", {
|
|
1025
|
-
className:
|
|
1026
|
-
children:
|
|
893
|
+
className: Q["bsy-lexical__table-picker-grid"],
|
|
894
|
+
children: ut.map((t) => ut.map((n) => /* @__PURE__ */ v("button", {
|
|
1027
895
|
type: "button",
|
|
1028
|
-
className:
|
|
896
|
+
className: M(Q["bsy-lexical__table-picker-cell"], d.rows >= t && d.cols >= n && Q["bsy-lexical__table-picker-cell--active"]),
|
|
1029
897
|
onMouseEnter: () => f({
|
|
1030
898
|
rows: t,
|
|
1031
899
|
cols: n
|
|
1032
900
|
}),
|
|
1033
901
|
onClick: () => {
|
|
1034
|
-
e.dispatchCommand(
|
|
902
|
+
e.dispatchCommand(we, {
|
|
1035
903
|
rows: String(t),
|
|
1036
904
|
columns: String(n),
|
|
1037
905
|
includeHeaders: !1
|
|
@@ -1039,7 +907,7 @@ var Y = ye("INSERT_INLINE_IMAGE_COMMAND"), tt = () => {
|
|
|
1039
907
|
}
|
|
1040
908
|
}, `${t}-${n}`)))
|
|
1041
909
|
}), /* @__PURE__ */ y("div", {
|
|
1042
|
-
className:
|
|
910
|
+
className: Q["bsy-lexical__table-picker-label"],
|
|
1043
911
|
children: [
|
|
1044
912
|
d.rows,
|
|
1045
913
|
" × ",
|
|
@@ -1049,20 +917,20 @@ var Y = ye("INSERT_INLINE_IMAGE_COMMAND"), tt = () => {
|
|
|
1049
917
|
})
|
|
1050
918
|
}, "bsy-lexical-table-picker")
|
|
1051
919
|
}) : null }) })] });
|
|
1052
|
-
},
|
|
1053
|
-
let e = w(
|
|
920
|
+
}, ft = x(null), pt = () => {
|
|
921
|
+
let e = w(ft);
|
|
1054
922
|
if (!e) throw Error("useSourceMode must be used within SourceModeProvider");
|
|
1055
923
|
return e;
|
|
1056
|
-
},
|
|
1057
|
-
let { t: e } = a(), { isSourceMode: t, toggleSourceMode: n } =
|
|
1058
|
-
return /* @__PURE__ */ v(
|
|
1059
|
-
icon:
|
|
924
|
+
}, mt = () => {
|
|
925
|
+
let { t: e } = a(), { isSourceMode: t, toggleSourceMode: n } = pt();
|
|
926
|
+
return /* @__PURE__ */ v(J, {
|
|
927
|
+
icon: "yuanmamoshi",
|
|
1060
928
|
tooltip: e("editor.sourceMode"),
|
|
1061
929
|
active: t,
|
|
1062
930
|
onClick: n
|
|
1063
931
|
});
|
|
1064
|
-
},
|
|
1065
|
-
let [t] =
|
|
932
|
+
}, ht = () => {
|
|
933
|
+
let [t] = B(), { headingTag: n, isInTable: r } = Y(), { t: i } = a(), { iconSize: o } = q(), s = n || "paragraph", c = [
|
|
1066
934
|
{
|
|
1067
935
|
key: "paragraph",
|
|
1068
936
|
label: i("editor.paragraph")
|
|
@@ -1082,19 +950,19 @@ var Y = ye("INSERT_INLINE_IMAGE_COMMAND"), tt = () => {
|
|
|
1082
950
|
], l = c.find((e) => e.key === s)?.label, d = C((e) => {
|
|
1083
951
|
let n = e.key;
|
|
1084
952
|
t.update(() => {
|
|
1085
|
-
|
|
953
|
+
H(I(), () => n === "paragraph" ? F() : Te(n));
|
|
1086
954
|
});
|
|
1087
955
|
}, [t]), f = /* @__PURE__ */ v("div", {
|
|
1088
|
-
className:
|
|
956
|
+
className: W["bsy-lexical__toolbar-select"],
|
|
1089
957
|
style: { width: 58 },
|
|
1090
|
-
children: /* @__PURE__ */ v(
|
|
958
|
+
children: /* @__PURE__ */ v(J, {
|
|
1091
959
|
icon: /* @__PURE__ */ y(_, { children: [/* @__PURE__ */ v("span", {
|
|
1092
|
-
className:
|
|
960
|
+
className: W["bsy-lexical__toolbar-select-label"],
|
|
1093
961
|
children: l
|
|
1094
962
|
}), /* @__PURE__ */ v(e, {
|
|
1095
963
|
name: "arrow-down",
|
|
1096
964
|
size: o,
|
|
1097
|
-
className:
|
|
965
|
+
className: W["bsy-lexical__toolbar-select-arrow"]
|
|
1098
966
|
})] }),
|
|
1099
967
|
tooltip: i("editor.heading"),
|
|
1100
968
|
disabled: r
|
|
@@ -1111,38 +979,38 @@ var Y = ye("INSERT_INLINE_IMAGE_COMMAND"), tt = () => {
|
|
|
1111
979
|
},
|
|
1112
980
|
children: f
|
|
1113
981
|
});
|
|
1114
|
-
}, $ = /* @__PURE__ */ new Map(),
|
|
982
|
+
}, $ = /* @__PURE__ */ new Map(), gt = (e, t) => {
|
|
1115
983
|
if (!e) throw Error("registerToolbarButton: name is required");
|
|
1116
984
|
$.set(e, t);
|
|
1117
|
-
},
|
|
985
|
+
}, _t = (e) => {
|
|
1118
986
|
$.delete(e);
|
|
1119
|
-
},
|
|
1120
|
-
undo:
|
|
1121
|
-
redo:
|
|
1122
|
-
bold:
|
|
1123
|
-
underline:
|
|
1124
|
-
italic:
|
|
1125
|
-
strikethrough:
|
|
1126
|
-
superscript:
|
|
1127
|
-
subscript:
|
|
1128
|
-
heading:
|
|
1129
|
-
fontSize:
|
|
1130
|
-
fontColor:
|
|
1131
|
-
fill:
|
|
1132
|
-
bullet:
|
|
1133
|
-
number:
|
|
1134
|
-
outdent:
|
|
1135
|
-
indent:
|
|
1136
|
-
align:
|
|
1137
|
-
link:
|
|
1138
|
-
unLink:
|
|
1139
|
-
picture:
|
|
1140
|
-
code:
|
|
1141
|
-
table:
|
|
1142
|
-
source:
|
|
987
|
+
}, vt = (e) => $.get(e), yt = () => Array.from($.keys()), bt = {
|
|
988
|
+
undo: et,
|
|
989
|
+
redo: tt,
|
|
990
|
+
bold: Ie,
|
|
991
|
+
underline: Le,
|
|
992
|
+
italic: Re,
|
|
993
|
+
strikethrough: nt,
|
|
994
|
+
superscript: rt,
|
|
995
|
+
subscript: it,
|
|
996
|
+
heading: ht,
|
|
997
|
+
fontSize: ze,
|
|
998
|
+
fontColor: Be,
|
|
999
|
+
fill: Ve,
|
|
1000
|
+
bullet: st,
|
|
1001
|
+
number: ct,
|
|
1002
|
+
outdent: ot,
|
|
1003
|
+
indent: at,
|
|
1004
|
+
align: He,
|
|
1005
|
+
link: We,
|
|
1006
|
+
unLink: Ge,
|
|
1007
|
+
picture: $e,
|
|
1008
|
+
code: lt,
|
|
1009
|
+
table: dt,
|
|
1010
|
+
source: mt
|
|
1143
1011
|
};
|
|
1144
|
-
Object.entries(
|
|
1145
|
-
|
|
1012
|
+
Object.entries(bt).forEach(([e, t]) => {
|
|
1013
|
+
gt(e, t);
|
|
1146
1014
|
});
|
|
1147
1015
|
//#endregion
|
|
1148
|
-
export {
|
|
1016
|
+
export { G as _, _t as a, W as b, Z as c, Pe as d, q as f, ke as g, Oe as h, gt as i, Y as l, De as m, vt as n, ft as o, Me as p, yt as r, pt as s, bt as t, J as u, Ae as v, Ee as y };
|