@baishuyun/ui-base 6.10.1 → 6.11.1

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.
Files changed (108) hide show
  1. package/dist/Amap/AmapCircle/index.js +1 -1
  2. package/dist/Amap/AmapMarker/index.js +1 -1
  3. package/dist/Amap/AmapMarkerCluster/index.js +1 -1
  4. package/dist/Amap/AmapProvider/index.js +4 -4
  5. package/dist/Amap/{AmapProvider-DqFp3DZ5.js → AmapProvider-CvRHhN42.js} +1 -1
  6. package/dist/Amap/hooks/index.js +1 -1
  7. package/dist/Amap/index.js +4 -4
  8. package/dist/Calendar/{AllDaySection-BqbcPQls.js → AllDaySection-CTaXpCmK.js} +1 -1
  9. package/dist/Calendar/{Calendar-gEtuBW7Y.js → Calendar-BAojDII3.js} +5 -5
  10. package/dist/Calendar/{TimeGrid-CBpDFAM4.js → TimeGrid-Ci8Dfama.js} +1 -1
  11. package/dist/Calendar/context/index.js +1 -1
  12. package/dist/Calendar/index.js +8 -8
  13. package/dist/Calendar/subcomponents/AllDaySection/index.js +3 -3
  14. package/dist/Calendar/subcomponents/CurrentTimeIndicator/index.js +1 -1
  15. package/dist/Calendar/subcomponents/EventCard/index.js +1 -1
  16. package/dist/Calendar/subcomponents/TimeAxis/index.js +1 -1
  17. package/dist/Calendar/subcomponents/TimeGrid/index.js +3 -3
  18. package/dist/Calendar/utils/index.js +1 -1
  19. package/dist/Calendar/utils/layout/index.js +1 -1
  20. package/dist/Calendar/utils/theme/index.js +1 -1
  21. package/dist/Card/{Card-Ds5Rpq--.js → Card-C8A4XaJZ.js} +1 -1
  22. package/dist/Card/index.js +3 -3
  23. package/dist/CheckBox/{CheckBox-nBm0u6zX.js → CheckBox-DBzTOuRy.js} +1 -1
  24. package/dist/CheckBox/{CheckBox-ByWSy9Yr.js → CheckBox-Dt4x6IqH.js} +1 -1
  25. package/dist/CheckBox/index.js +4 -4
  26. package/dist/ColorPicker/{ColorPicker-CYlrnMwM.js → ColorPicker-Buku806Y.js} +2 -2
  27. package/dist/ColorPicker/index.js +5 -5
  28. package/dist/ConfigProvider/index.js +3 -3
  29. package/dist/DatePicker/{DatePicker-CagGt_f0.js → DatePicker-E9HxZcGE.js} +2 -2
  30. package/dist/DatePicker/{DatePickerPanel-CaDZzxMD.js → DatePickerPanel-DM5Bje8r.js} +4 -4
  31. package/dist/DatePicker/index.js +4 -4
  32. package/dist/DatePicker/style/index.js +1 -1
  33. package/dist/DropDown/{DropDown-CLuQf970.js → DropDown-CuL1Qq25.js} +2 -2
  34. package/dist/DropDown/index.js +6 -6
  35. package/dist/DropDown/style/index.js +1 -1
  36. package/dist/Editor/Buttons-CMkFTv6y.js +1016 -0
  37. package/dist/Editor/ToolbarPlugin/Buttons/index.js +11 -11
  38. package/dist/Editor/constants/index.js +3 -3
  39. package/dist/Editor/index.js +778 -375
  40. package/dist/Gantt/GanttChart/index.js +8 -8
  41. package/dist/Gantt/{GanttChart-DvCAp8Dk.js → GanttChart-WIrD6Z7O.js} +3 -3
  42. package/dist/Gantt/GanttTable/index.js +5 -5
  43. package/dist/Gantt/{GanttTable-DyVJOVo3.js → GanttTable-CdXhMHF6.js} +1 -1
  44. package/dist/Gantt/GanttToolBar/index.js +7 -7
  45. package/dist/Gantt/{GanttToolBar-CxT68kmT.js → GanttToolBar-C1gAS9v2.js} +3 -3
  46. package/dist/Gantt/index.js +10 -10
  47. package/dist/Gantt/utils/index.js +1 -1
  48. package/dist/Gantt/utils/theme/index.js +1 -1
  49. package/dist/Icon/{Icon-BBDcb-yw.js → Icon-oQ_uBooE.js} +1 -1
  50. package/dist/Icon/index.js +2 -2
  51. package/dist/InputTag/{InputTag-yRPO90Ku.js → InputTag-BQpIRPtc.js} +2 -2
  52. package/dist/InputTag/index.js +5 -5
  53. package/dist/Loading/{Loading-BF_dtuLc.js → Loading-CiRe7i2R.js} +1 -1
  54. package/dist/Loading/index.js +4 -4
  55. package/dist/Modal/{Modal-Cb7Msq26.js → Modal-17rLsxN4.js} +1 -1
  56. package/dist/Modal/index.js +3 -3
  57. package/dist/NotFoundContent/index.js +1 -1
  58. package/dist/Overlay/index.js +1 -1
  59. package/dist/Radio/index.js +1 -1
  60. package/dist/ScrollBar/index.js +1 -1
  61. package/dist/Segmented/index.js +1 -1
  62. package/dist/Select/{Select-iwzfNy9d.js → Select-p_ly7xmz.js} +5 -5
  63. package/dist/Select/{SelectInputSearch-Bc_aPNbG.js → SelectInputSearch-BBwVIb8u.js} +2 -2
  64. package/dist/Select/index.js +9 -9
  65. package/dist/Table/{Table-Cm8zFl2G.js → Table-CSPdFGYn.js} +1 -1
  66. package/dist/Table/hooks/index.js +1 -1
  67. package/dist/Table/index.js +4 -4
  68. package/dist/Table/style/index.js +1 -1
  69. package/dist/Table/utils/index.js +1 -1
  70. package/dist/Tabs/{Tabs-BPWRIwtD.js → Tabs-D2A8nJl8.js} +2 -2
  71. package/dist/Tabs/index.js +5 -5
  72. package/dist/Tooltip/index.js +1 -1
  73. package/dist/Tree/index.js +4 -4
  74. package/dist/Tree/utils/index.js +1 -1
  75. package/dist/components/Editor/ToolbarPlugin/Buttons/HeadingButton.d.ts +2 -0
  76. package/dist/components/Editor/ToolbarPlugin/Buttons/SourceButton.d.ts +2 -0
  77. package/dist/components/Editor/ToolbarPlugin/Buttons/TableButton.d.ts +2 -0
  78. package/dist/components/Editor/ToolbarPlugin/Buttons/index.d.ts +3 -0
  79. package/dist/components/Editor/ToolbarPlugin/context/TextFormatsContext.d.ts +2 -0
  80. package/dist/components/Editor/constants/index.d.ts +1 -0
  81. package/dist/components/Editor/context/EditorContainerContext.d.ts +0 -1
  82. package/dist/components/Editor/context/SourceModeContext.d.ts +9 -0
  83. package/dist/components/Editor/htmlConfig.d.ts +2 -0
  84. package/dist/components/Editor/interface.d.ts +1 -1
  85. package/dist/components/Editor/plugins/HeadingPlugin.d.ts +3 -0
  86. package/dist/components/Editor/plugins/LinkColorPlugin.d.ts +2 -0
  87. package/dist/components/Editor/plugins/SourceModePlugin.d.ts +7 -0
  88. package/dist/components/Editor/plugins/TabIndentPlugin.d.ts +1 -0
  89. package/dist/components/Editor/plugins/TablePlugin.d.ts +1 -0
  90. package/dist/components/Editor/utils/fillRootFromHtml.d.ts +2 -0
  91. package/dist/components/Editor/utils/formatEditorHtml.d.ts +1 -0
  92. package/dist/components/Editor/utils/isEmptyEditorHtml.d.ts +1 -0
  93. package/dist/components/Editor/utils/sanitizeEditorHtml.d.ts +1 -0
  94. package/dist/components/Editor/utils/stripInlineStyleProperty.d.ts +2 -0
  95. package/dist/components/Editor/utils/writeHtmlSource.d.ts +1 -0
  96. package/dist/index.js +23 -23
  97. package/dist/locale/lang/en-US.json.d.ts +7 -0
  98. package/dist/locale/lang/zh-CN.json.d.ts +7 -0
  99. package/dist/locale/lang/zh-TW.json.d.ts +7 -0
  100. package/dist/style.css +1 -1
  101. package/dist/vendors/{ConfigProvider-vPuwReNX.js → ConfigProvider-4xHyyeop.js} +15 -1
  102. package/dist/vendors/{LocaleContext-CN9doEXT.js → LocaleContext-I4PW9j4M.js} +7 -0
  103. package/dist/vendors/{Tree-B09frqQX.js → Tree-B8cR9y6U.js} +2 -2
  104. package/dist/vendors/{useLocale-sawv8CEL.js → useLocale-FGYsRWSe.js} +1 -1
  105. package/dist/vendors/{version-DdQLttdL.js → version-DU4mlk3q.js} +1 -1
  106. package/package.json +5 -2
  107. package/dist/Editor/Buttons-ByO5rS19.js +0 -937
  108. package/dist/components/Editor/ToolbarPlugin/icons/ToolbarIcon.d.ts +0 -13
@@ -0,0 +1,1016 @@
1
+ import { t as e } from "../Icon/Icon-oQ_uBooE.js";
2
+ import { a as t, i as n } from "../Overlay/OverlayContext-CVSFoyqN.js";
3
+ import { t as r } from "../Modal/Modal-17rLsxN4.js";
4
+ import { t as i } from "../ColorPicker/ColorPicker-Buku806Y.js";
5
+ import { t as a } from "../vendors/useLocale-FGYsRWSe.js";
6
+ import { n as o } from "../vendors/animations-rwUbyoT0.js";
7
+ import { t as s } from "../CheckBox/CheckBox-DBzTOuRy.js";
8
+ import { t as c } from "../ScrollBar/ScrollBar-N2pOLv-8.js";
9
+ import { t as l } from "../vendors/useFloatingPortal-CmVJbuRm.js";
10
+ import { t as u } from "../DropDown/DropDown-CuL1Qq25.js";
11
+ import { FONT_SIZES as d } from "./constants/index.js";
12
+ import { AlignCenterOutlined as f, AlignLeftOutlined as p, AlignRightOutlined as m } from "@ant-design/icons";
13
+ import { keyBy as h, range as g } from "lodash-es";
14
+ import { Fragment as _, jsx as v, jsxs as y } from "react/jsx-runtime";
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
+ import { Button as O, Form as k, Input as A, message as j } from "antd";
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
+ //#region src/components/Editor/ToolbarPlugin/toolbarPlugin.module.scss
29
+ var W = {
30
+ "bsy-lexical__toolbar": "_bsy-lexical__toolbar_4va97_1",
31
+ "bsy-lexical__toolbar--floating": "_bsy-lexical__toolbar--floating_4va97_12",
32
+ "bsy-lexical__toolbar-item": "_bsy-lexical__toolbar-item_4va97_18",
33
+ "bsy-lexical__toolbar-group": "_bsy-lexical__toolbar-group_4va97_24",
34
+ "bsy-lexical__toolbar-divider": "_bsy-lexical__toolbar-divider_4va97_30",
35
+ "bsy-lexical__toolbar-select": "_bsy-lexical__toolbar-select_4va97_37",
36
+ "bsy-lexical__toolbar-select-label": "_bsy-lexical__toolbar-select-label_4va97_55",
37
+ "bsy-lexical__toolbar-select-arrow": "_bsy-lexical__toolbar-select-arrow_4va97_66"
38
+ }, Ee = x(null), G = "plaintext", De = "github-light", Oe = [
39
+ {
40
+ id: "plaintext",
41
+ label: "Plain text"
42
+ },
43
+ {
44
+ id: "css",
45
+ label: "CSS"
46
+ },
47
+ {
48
+ id: "html",
49
+ label: "HTML"
50
+ },
51
+ {
52
+ id: "xml",
53
+ label: "XML"
54
+ },
55
+ {
56
+ id: "javascript",
57
+ label: "JavaScript"
58
+ },
59
+ {
60
+ id: "typescript",
61
+ label: "TypeScript"
62
+ },
63
+ {
64
+ id: "jsx",
65
+ label: "JSX"
66
+ },
67
+ {
68
+ id: "go",
69
+ label: "Go"
70
+ },
71
+ {
72
+ id: "php",
73
+ label: "PHP"
74
+ },
75
+ {
76
+ id: "c",
77
+ label: "C"
78
+ },
79
+ {
80
+ id: "python",
81
+ label: "Python"
82
+ },
83
+ {
84
+ id: "java",
85
+ label: "Java"
86
+ },
87
+ {
88
+ id: "cpp",
89
+ label: "C++"
90
+ },
91
+ {
92
+ id: "csharp",
93
+ label: "C#"
94
+ },
95
+ {
96
+ id: "vb",
97
+ label: "Visual Basic"
98
+ },
99
+ {
100
+ id: "sql",
101
+ label: "SQL"
102
+ },
103
+ {
104
+ id: "ruby",
105
+ label: "Ruby"
106
+ },
107
+ {
108
+ id: "swift",
109
+ label: "Swift"
110
+ },
111
+ {
112
+ id: "bash",
113
+ label: "Bash"
114
+ },
115
+ {
116
+ id: "lua",
117
+ label: "Lua"
118
+ },
119
+ {
120
+ id: "markdown",
121
+ label: "Markdown"
122
+ }
123
+ ], ke = h(Oe, "id"), Ae = (e) => e && ke[e] ? e : G, je = x(null), K = () => {
124
+ let e = w(je);
125
+ if (!e) throw Error("useHistoryStateContext must be used within HistoryStateProvider");
126
+ return e;
127
+ }, Me = ({ children: e }) => {
128
+ let [t] = B(), [n, r] = D({
129
+ canUndo: !1,
130
+ canRedo: !1
131
+ });
132
+ return T(() => _e(t.registerCommand(ue, (e) => (r((t) => t.canUndo === e ? t : {
133
+ ...t,
134
+ canUndo: e
135
+ }), !1), R), t.registerCommand(le, (e) => (r((t) => t.canRedo === e ? t : {
136
+ ...t,
137
+ canRedo: e
138
+ }), !1), R)), [t]), /* @__PURE__ */ v(je.Provider, {
139
+ value: n,
140
+ children: e
141
+ });
142
+ }, Ne = x({ iconSize: 14 }), Pe = Ne.Provider, q = () => w(Ne), Fe = {
143
+ "lexical-editor__toolbar-button": "_lexical-editor__toolbar-button_10xg7_1",
144
+ "lexical-editor__toolbar-button-active": "_lexical-editor__toolbar-button-active_10xg7_20"
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
+ return /* @__PURE__ */ v("button", {
148
+ className: M(Fe["lexical-editor__toolbar-button"], { [Fe["lexical-editor__toolbar-button-active"]]: o }),
149
+ type: "button",
150
+ onClick: i,
151
+ onMouseDown: (e) => e.preventDefault(),
152
+ disabled: a,
153
+ title: r,
154
+ children: b.isValidElement(n) ? n : /* @__PURE__ */ v(e, {
155
+ name: n,
156
+ size: l
157
+ })
158
+ });
159
+ }, Y = () => {
160
+ let e = w(Ee);
161
+ if (!e) throw Error("useTextFormatsContext must be used within TextFormatsProvider");
162
+ return e;
163
+ }, Ie = () => {
164
+ let [e] = B(), t = Y(), { t: n } = a(), r = t.bold;
165
+ return /* @__PURE__ */ v(J, {
166
+ icon: "bold",
167
+ tooltip: n("editor.bold"),
168
+ active: r,
169
+ onClick: () => {
170
+ e.dispatchCommand(z, "bold");
171
+ }
172
+ });
173
+ }, Le = () => {
174
+ let [e] = B(), t = Y(), { t: n } = a(), r = t.underline;
175
+ return /* @__PURE__ */ v(J, {
176
+ icon: "underline",
177
+ tooltip: n("editor.underline"),
178
+ active: r,
179
+ onClick: () => {
180
+ e.dispatchCommand(z, "underline");
181
+ }
182
+ });
183
+ }, Re = () => {
184
+ let [e] = B(), t = Y(), { t: n } = a(), r = t.italic;
185
+ return /* @__PURE__ */ v(J, {
186
+ icon: "italic",
187
+ tooltip: n("editor.italic"),
188
+ active: r,
189
+ onClick: () => {
190
+ e.dispatchCommand(z, "italic");
191
+ }
192
+ });
193
+ }, ze = () => {
194
+ let [e] = B(), { t } = a(), { fontSize: n, headingTag: r } = Y(), i = ne(() => d.map((e) => ({
195
+ key: e.value,
196
+ label: e.label
197
+ })), []), o = C((t) => {
198
+ let n = t.key;
199
+ e.update(() => {
200
+ let e = I();
201
+ L(e) && V(e, { "font-size": n });
202
+ });
203
+ }, [e]);
204
+ return r ? /* @__PURE__ */ v(J, {
205
+ icon: "fontsize",
206
+ tooltip: t("editor.fontSize"),
207
+ disabled: !0
208
+ }) : /* @__PURE__ */ v(u, {
209
+ menus: i,
210
+ onClick: o,
211
+ activeKey: [n],
212
+ showSearch: !1,
213
+ style: {
214
+ width: "60px",
215
+ minWidth: "60px"
216
+ },
217
+ children: /* @__PURE__ */ v("div", {
218
+ className: "dropdown__trigger inline-flex",
219
+ children: /* @__PURE__ */ v(J, {
220
+ icon: "fontsize",
221
+ tooltip: t("editor.fontSize"),
222
+ active: !1
223
+ })
224
+ })
225
+ });
226
+ }, Be = () => {
227
+ let [e] = B(), t = Y(), { t: n } = a(), r = C((t) => {
228
+ e.update(() => {
229
+ let e = I();
230
+ L(e) && V(e, { color: t });
231
+ });
232
+ }, [e]);
233
+ return /* @__PURE__ */ v(i, {
234
+ value: t.fontColor,
235
+ onChange: r,
236
+ placement: "bottom-start",
237
+ presetColors: "basic",
238
+ children: /* @__PURE__ */ v("div", {
239
+ className: "trigger-picker inline-flex",
240
+ children: /* @__PURE__ */ v(J, {
241
+ icon: "fontcolor",
242
+ tooltip: n("editor.fontColor"),
243
+ onClick: () => {},
244
+ active: !1
245
+ })
246
+ })
247
+ });
248
+ }, Ve = () => {
249
+ let [e] = B(), t = Y(), { t: n } = a(), r = C((t) => {
250
+ e.update(() => {
251
+ let e = I();
252
+ L(e) && V(e, { "background-color": t });
253
+ });
254
+ }, [e]);
255
+ return /* @__PURE__ */ v(i, {
256
+ value: t.backgroundColor,
257
+ onChange: r,
258
+ placement: "bottom-start",
259
+ presetColors: "basic",
260
+ children: /* @__PURE__ */ v("div", {
261
+ className: "trigger-picker inline-flex",
262
+ children: /* @__PURE__ */ v(J, {
263
+ icon: "fill",
264
+ tooltip: n("editor.fill"),
265
+ onClick: () => {},
266
+ active: !1
267
+ })
268
+ })
269
+ });
270
+ }, He = () => {
271
+ let [e] = B(), { align: t } = Y(), { t: n } = a(), r = [
272
+ {
273
+ key: "left",
274
+ label: n("leftAlign"),
275
+ icon: /* @__PURE__ */ v(p, {})
276
+ },
277
+ {
278
+ key: "center",
279
+ label: n("editor.centerAlign"),
280
+ icon: /* @__PURE__ */ v(f, {})
281
+ },
282
+ {
283
+ key: "right",
284
+ label: n("editor.rightAlign"),
285
+ icon: /* @__PURE__ */ v(m, {})
286
+ }
287
+ ], i = C((t) => {
288
+ e.dispatchCommand(de, t);
289
+ }, [e]), o = r.map((e) => ({
290
+ key: e.key,
291
+ label: /* @__PURE__ */ y("div", {
292
+ className: "flex items-center gap-2",
293
+ children: [e.icon, /* @__PURE__ */ v("span", { children: e.label })]
294
+ })
295
+ })), s = C((e) => {
296
+ i(e.key);
297
+ }, [i]), c = r.find((e) => e.key === t)?.icon || /* @__PURE__ */ v(p, {});
298
+ return /* @__PURE__ */ v(u, {
299
+ menus: o,
300
+ onClick: s,
301
+ showSearch: !1,
302
+ activeKey: [t],
303
+ style: {
304
+ width: "110px",
305
+ minWidth: "110px"
306
+ },
307
+ children: /* @__PURE__ */ v("div", {
308
+ className: "trigger-dropdown inline-flex text-sm",
309
+ children: /* @__PURE__ */ v(J, {
310
+ icon: c,
311
+ tooltip: n("editor.alignment"),
312
+ onClick: () => {},
313
+ active: !1
314
+ })
315
+ })
316
+ });
317
+ };
318
+ //#endregion
319
+ //#region src/components/Editor/ToolbarPlugin/Buttons/LinkButton.tsx
320
+ function Ue(e) {
321
+ return e ? e.startsWith("@") ? "javascript:void(0);" : e.match(/^https?:\/\//) ? e : `http://${e}` : "";
322
+ }
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
+ o(t), t || e.setEditable(!0);
326
+ }, [e]), x = () => {
327
+ if (!c) {
328
+ m.warning(n("editor.linkAddressEmpty"));
329
+ return;
330
+ }
331
+ let t = Ue(c);
332
+ e.setEditable(!0), e.update(() => {
333
+ let e = f ? {
334
+ target: "_blank",
335
+ rel: "noopener noreferrer",
336
+ title: c
337
+ } : { title: c }, n = g.current;
338
+ n !== null && ce(n);
339
+ let r = I();
340
+ if (L(r)) {
341
+ let n = u || c, i = r.getTextContent();
342
+ if (!r.isCollapsed() && n === i) ve(t, e);
343
+ else {
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
+ l.setFormat(s), l.setStyle(o), c.append(l), r.insertNodes([c]);
346
+ }
347
+ } else {
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
+ else {
353
+ let e = F();
354
+ e.append(n), r.append(e);
355
+ }
356
+ }
357
+ }), g.current = null, l(""), d(""), b(!1);
358
+ }, S = C(() => {
359
+ let n = "";
360
+ e.getEditorState().read(() => {
361
+ let e = I();
362
+ g.current = e ? e.clone() : null, L(e) && !e.isCollapsed() && (n = e.getTextContent());
363
+ }), e.setEditable(!1), e.update(() => {
364
+ ce(null);
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
+ }, [t, e]);
367
+ return /* @__PURE__ */ y(_, { children: [
368
+ /* @__PURE__ */ v(J, {
369
+ icon: "Insertlink",
370
+ tooltip: n("link"),
371
+ onClick: S,
372
+ active: !!t?.link
373
+ }),
374
+ h,
375
+ /* @__PURE__ */ v(r, {
376
+ title: n("link"),
377
+ open: i,
378
+ onOpenChange: b,
379
+ children: /* @__PURE__ */ y("div", { children: [/* @__PURE__ */ y("div", {
380
+ className: "px-[20px] pb-[60px] pt-[40px]",
381
+ children: [/* @__PURE__ */ y("div", {
382
+ className: "flex items-center relative",
383
+ children: [
384
+ /* @__PURE__ */ v("label", {
385
+ className: "w-[80px] shrink-0",
386
+ children: n("linkAddress")
387
+ }),
388
+ /* @__PURE__ */ v(A, {
389
+ value: c,
390
+ onChange: (e) => l(e.target.value),
391
+ placeholder: n("editor.linkTip")
392
+ }),
393
+ /* @__PURE__ */ v("div", {
394
+ className: "absolute bottom-[-30px] left-[80px]",
395
+ children: /* @__PURE__ */ v("p", {
396
+ className: "text-[#999]",
397
+ children: n("editor.linkAliasTip")
398
+ })
399
+ })
400
+ ]
401
+ }), /* @__PURE__ */ y("div", {
402
+ className: "flex items-center mt-[40px]",
403
+ children: [/* @__PURE__ */ v("label", {
404
+ className: "w-[80px] shrink-0",
405
+ children: n("showContent")
406
+ }), /* @__PURE__ */ v(A, {
407
+ value: u,
408
+ onChange: (e) => d(e.target.value)
409
+ })]
410
+ })]
411
+ }), /* @__PURE__ */ y("div", {
412
+ className: "py-[14px] px-[20px] flex justify-between items-center border-t-[1px] border-solid border-[#e0e0e0]",
413
+ children: [/* @__PURE__ */ v("div", { children: /* @__PURE__ */ v(s, {
414
+ checked: f,
415
+ onChange: (e) => p(e),
416
+ children: n("openInNewTab")
417
+ }) }), /* @__PURE__ */ y("div", {
418
+ className: "flex gap-[15px]",
419
+ children: [/* @__PURE__ */ v(O, {
420
+ onClick: () => b(!1),
421
+ children: n("cancel")
422
+ }), /* @__PURE__ */ v(O, {
423
+ type: "primary",
424
+ onClick: x,
425
+ children: n("confirm")
426
+ })]
427
+ })]
428
+ })] })
429
+ })
430
+ ] });
431
+ }, Ge = () => {
432
+ let [e] = B(), { link: t } = Y(), { t: n } = a();
433
+ return /* @__PURE__ */ v(J, {
434
+ icon: "cancellink",
435
+ tooltip: n("cancelLink"),
436
+ onClick: () => {
437
+ t && e.dispatchCommand(ye, null);
438
+ }
439
+ });
440
+ }, X = {
441
+ "picture-modal__container": "_picture-modal__container_oo6vo_1",
442
+ "picture-modal__sidebar": "_picture-modal__sidebar_oo6vo_4",
443
+ "picture-modal__menu-list": "_picture-modal__menu-list_oo6vo_8",
444
+ "picture-modal__menu-item": "_picture-modal__menu-item_oo6vo_13",
445
+ "picture-modal__menu-item--active": "_picture-modal__menu-item--active_oo6vo_22",
446
+ "picture-modal__content": "_picture-modal__content_oo6vo_25",
447
+ "picture-modal__content-body": "_picture-modal__content-body_oo6vo_31",
448
+ "picture-modal__ops": "_picture-modal__ops_oo6vo_34",
449
+ "picture-modal__content-title": "_picture-modal__content-title_oo6vo_42",
450
+ "picture-modal__upload-area": "_picture-modal__upload-area_oo6vo_53",
451
+ "picture-modal__upload-area--dragging": "_picture-modal__upload-area--dragging_oo6vo_69",
452
+ "picture-modal__preview-list": "_picture-modal__preview-list_oo6vo_75",
453
+ "picture-modal__preview": "_picture-modal__preview_oo6vo_75",
454
+ "picture-modal__preview-image": "_picture-modal__preview-image_oo6vo_89",
455
+ "picture-modal__preview-info": "_picture-modal__preview-info_oo6vo_102",
456
+ "picture-modal__preview-filename": "_picture-modal__preview-filename_oo6vo_106",
457
+ "picture-modal__preview-size": "_picture-modal__preview-size_oo6vo_114",
458
+ "picture-modal__preview-delete": "_picture-modal__preview-delete_oo6vo_118",
459
+ "picture-modal__upload-text": "_picture-modal__upload-text_oo6vo_126",
460
+ "picture-modal__footer": "_picture-modal__footer_oo6vo_130"
461
+ }, Ke = S((e, t) => {
462
+ let [n] = k.useForm(), [r, i] = D(""), { t: o } = a(), s = (e) => /^https?:\/\/.+/i.test(e);
463
+ return ee(t, () => ({ getValue: async () => {
464
+ try {
465
+ return await n.validateFields(), r;
466
+ } catch {
467
+ throw Error("URL validation failed");
468
+ }
469
+ } })), /* @__PURE__ */ y(_, { children: [/* @__PURE__ */ v("div", {
470
+ className: X["picture-modal__content-title"],
471
+ "data-title": o("editor.imageUrlNote"),
472
+ children: o("editor.enterImageUrl")
473
+ }), /* @__PURE__ */ v(k, {
474
+ form: n,
475
+ children: /* @__PURE__ */ v(k.Item, {
476
+ name: "url",
477
+ rules: [{
478
+ required: !0,
479
+ message: o("editor.pleaseEnterImageUrl")
480
+ }, { validator: (e, t) => !t || s(t) ? Promise.resolve() : Promise.reject(Error(o("editor.pleaseEnterValidImageUrl"))) }],
481
+ children: /* @__PURE__ */ v(A, {
482
+ placeholder: o("editor.pleaseEnterImageUrl"),
483
+ value: r,
484
+ onChange: (e) => i(e.target.value)
485
+ })
486
+ })
487
+ })] });
488
+ });
489
+ Ke.displayName = "LinkInput";
490
+ //#endregion
491
+ //#region src/components/Editor/utils/formatTruncatedFilename.ts
492
+ var qe = "......", Je = (e, t, n) => {
493
+ if (t <= 0 || n(e) <= t) return {
494
+ display: e,
495
+ truncated: !1
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}${qe}${s}${o}`, u = (e) => n(e) <= t;
498
+ if (!u(l(""))) {
499
+ let t = `${qe}${o}`;
500
+ return {
501
+ display: u(t) ? t : e,
502
+ truncated: !0
503
+ };
504
+ }
505
+ let d = 0, f = c.length, p = 0;
506
+ for (; d <= f;) {
507
+ let e = d + f >> 1;
508
+ u(l(c.slice(0, e))) ? (p = e, d = e + 1) : f = e - 1;
509
+ }
510
+ return {
511
+ display: l(c.slice(0, p)),
512
+ truncated: !0
513
+ };
514
+ }, Ye = {
515
+ duration: .2,
516
+ ease: [
517
+ .4,
518
+ 0,
519
+ .2,
520
+ 1
521
+ ]
522
+ }, Xe = ({ name: e }) => {
523
+ let t = E(null), [n, r] = D(e), [i, a] = D(!1);
524
+ return te(() => {
525
+ let n = t.current, i = document.createElement("canvas").getContext("2d");
526
+ if (!n || !i) return;
527
+ let o = () => {
528
+ i.font = getComputedStyle(n).font;
529
+ let t = Je(e, n.clientWidth, (e) => i.measureText(e).width);
530
+ r(t.display), a(t.truncated);
531
+ };
532
+ o();
533
+ let s = new ResizeObserver(o);
534
+ return s.observe(n), () => s.disconnect();
535
+ }, [e]), /* @__PURE__ */ v("div", {
536
+ ref: t,
537
+ className: X["picture-modal__preview-filename"],
538
+ title: i ? e : void 0,
539
+ children: n
540
+ });
541
+ }, Ze = (e) => new Promise((t, n) => {
542
+ let r = new FileReader();
543
+ r.onload = () => t(r.result), r.onerror = () => n(r.error), r.readAsDataURL(e);
544
+ }), Qe = S((t, n) => {
545
+ let [r, i] = D(!1), [o, s] = D([]), c = E(o);
546
+ c.current = o;
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) => {
548
+ let t = 10 - c.current.length;
549
+ if (t <= 0) {
550
+ u.warning(f("editor.imageCountNote", { count: 10 }));
551
+ return;
552
+ }
553
+ let n = Array.from(e).filter(m), r = n.slice(0, t);
554
+ n.length > t && u.warning(f("editor.imageCountNote", { count: 10 })), r.length && s((e) => [...e, ...r.map((e) => ({
555
+ id: `${e.name}-${e.size}-${e.lastModified}-${Math.random()}`,
556
+ file: e,
557
+ url: URL.createObjectURL(e)
558
+ }))]);
559
+ }, g = (e) => {
560
+ s((t) => {
561
+ let n = t.find((t) => t.id === e);
562
+ return n && URL.revokeObjectURL(n.url), t.filter((t) => t.id !== e);
563
+ });
564
+ }, _ = () => {
565
+ l.current?.click();
566
+ }, b = (e) => {
567
+ e.target.files?.length && h(e.target.files), e.target.value = "";
568
+ };
569
+ return T(() => () => {
570
+ c.current.forEach((e) => URL.revokeObjectURL(e.url));
571
+ }, []), ee(n, () => ({ getValue: async () => {
572
+ if (!o.length) throw u.warning(f("editor.pleaseUploadImageFirst")), Error(f("editor.pleaseUploadImageFirst"));
573
+ try {
574
+ return await Promise.all(o.map(async (e) => ({
575
+ src: await Ze(e.file),
576
+ fileName: e.file.name
577
+ })));
578
+ } catch {
579
+ throw Error(f("editor.operationFailed"));
580
+ }
581
+ } }), [
582
+ o,
583
+ u,
584
+ f
585
+ ]), /* @__PURE__ */ y("div", {
586
+ onDragOver: (e) => {
587
+ e.preventDefault(), i(!0);
588
+ },
589
+ onDragLeave: (e) => {
590
+ e.preventDefault(), i(!1);
591
+ },
592
+ onDrop: (e) => {
593
+ e.preventDefault(), i(!1), e.dataTransfer.files.length && h(e.dataTransfer.files);
594
+ },
595
+ children: [
596
+ /* @__PURE__ */ y("div", {
597
+ className: X["picture-modal__ops"],
598
+ children: [/* @__PURE__ */ v("div", {
599
+ className: X["picture-modal__content-title"],
600
+ "data-title": f("editor.imageSizeNote"),
601
+ children: f("editor.uploadImage")
602
+ }), /* @__PURE__ */ y("div", {
603
+ className: `${X["picture-modal__upload-area"]} ${r ? X["picture-modal__upload-area--dragging"] : ""}`,
604
+ onClick: _,
605
+ children: [/* @__PURE__ */ v(e, { name: "upload" }), /* @__PURE__ */ v("span", {
606
+ className: X["picture-modal__upload-text"],
607
+ children: f("editor.clickOrDragToUpload")
608
+ })]
609
+ })]
610
+ }),
611
+ o.length > 0 ? /* @__PURE__ */ v("div", {
612
+ className: X["picture-modal__preview-list"],
613
+ children: /* @__PURE__ */ v(N, {
614
+ mode: "popLayout",
615
+ children: o.map((t) => /* @__PURE__ */ y(P.div, {
616
+ layout: "position",
617
+ className: X["picture-modal__preview"],
618
+ initial: {
619
+ opacity: 0,
620
+ y: 12
621
+ },
622
+ animate: {
623
+ opacity: 1,
624
+ y: 0
625
+ },
626
+ exit: {
627
+ opacity: 0,
628
+ y: -8
629
+ },
630
+ transition: Ye,
631
+ children: [
632
+ /* @__PURE__ */ v("div", {
633
+ className: X["picture-modal__preview-image"],
634
+ children: /* @__PURE__ */ v("img", {
635
+ src: t.url,
636
+ alt: f("editor.previewImage")
637
+ })
638
+ }),
639
+ /* @__PURE__ */ y("div", {
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
+ children: p(t.file.size)
644
+ })]
645
+ }),
646
+ /* @__PURE__ */ v("div", {
647
+ className: X["picture-modal__preview-delete"],
648
+ role: "button",
649
+ onClick: () => g(t.id),
650
+ children: /* @__PURE__ */ v(e, { name: "delete" })
651
+ })
652
+ ]
653
+ }, t.id))
654
+ })
655
+ }) : null,
656
+ /* @__PURE__ */ v("input", {
657
+ ref: l,
658
+ type: "file",
659
+ accept: "image/*",
660
+ multiple: !0,
661
+ style: { display: "none" },
662
+ onChange: b
663
+ }),
664
+ d
665
+ ]
666
+ });
667
+ });
668
+ Qe.displayName = "UploadImage";
669
+ //#endregion
670
+ //#region src/components/Editor/commands/ImageCommands.ts
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
+ key: "upload",
674
+ title: t("editor.uploadImage"),
675
+ icon: /* @__PURE__ */ v(e, { name: "picture" })
676
+ }, {
677
+ key: "url",
678
+ title: t("editor.imageUrl"),
679
+ icon: /* @__PURE__ */ v(e, { name: "Insertlink" })
680
+ }], [d, f] = D(u[0].key), p = async () => {
681
+ try {
682
+ if (d === "upload" && l.current) (await l.current.getValue()).forEach((e) => {
683
+ n.dispatchCommand(Z, {
684
+ src: e.src,
685
+ altText: e.fileName
686
+ });
687
+ });
688
+ else if (s.current) {
689
+ let e = await s.current.getValue();
690
+ n.dispatchCommand(Z, {
691
+ src: e,
692
+ altText: e
693
+ });
694
+ }
695
+ o(!1);
696
+ } catch (e) {
697
+ j.error(e instanceof Error ? e.message : t("editor.operationFailed"));
698
+ }
699
+ }, m = {
700
+ upload: /* @__PURE__ */ v(Qe, { ref: l }),
701
+ url: /* @__PURE__ */ v(Ke, { ref: s })
702
+ };
703
+ return /* @__PURE__ */ y(_, { children: [/* @__PURE__ */ v(J, {
704
+ icon: "picture",
705
+ tooltip: t("picture"),
706
+ onClick: () => o(!0)
707
+ }), /* @__PURE__ */ y(r, {
708
+ title: t("addPicture"),
709
+ open: i,
710
+ onOpenChange: o,
711
+ width: "620px",
712
+ children: [/* @__PURE__ */ y("div", {
713
+ className: X["picture-modal__container"],
714
+ children: [/* @__PURE__ */ v("div", {
715
+ className: X["picture-modal__sidebar"],
716
+ children: /* @__PURE__ */ v("ul", {
717
+ className: X["picture-modal__menu-list"],
718
+ children: u.map((e) => /* @__PURE__ */ y("li", {
719
+ className: `${X["picture-modal__menu-item"]} ${d === e.key ? X["picture-modal__menu-item--active"] : ""}`,
720
+ onClick: () => f(e.key),
721
+ children: [/* @__PURE__ */ v("span", {
722
+ className: X["picture-modal__menu-icon"],
723
+ children: e.icon
724
+ }), /* @__PURE__ */ v("span", { children: e.title })]
725
+ }, e.title))
726
+ })
727
+ }), /* @__PURE__ */ v(c, {
728
+ className: X["picture-modal__content"],
729
+ contentClassName: X["picture-modal__content-body"],
730
+ children: m[d]
731
+ })]
732
+ }), /* @__PURE__ */ y("div", {
733
+ className: X["picture-modal__footer"],
734
+ children: [/* @__PURE__ */ v(O, {
735
+ onClick: () => o(!1),
736
+ children: t("cancel")
737
+ }), /* @__PURE__ */ v(O, {
738
+ type: "primary",
739
+ onClick: p,
740
+ children: t("confirm")
741
+ })]
742
+ })]
743
+ })] });
744
+ }, et = () => {
745
+ let [e] = B(), { canUndo: t } = K(), { t: n } = a();
746
+ return /* @__PURE__ */ v(J, {
747
+ icon: "chexiao",
748
+ tooltip: n("editor.undo"),
749
+ disabled: !t,
750
+ onClick: () => {
751
+ e.dispatchCommand(he, void 0);
752
+ }
753
+ });
754
+ }, tt = () => {
755
+ let [e] = B(), { canRedo: t } = K(), { t: n } = a();
756
+ return /* @__PURE__ */ v(J, {
757
+ icon: "fanhui",
758
+ tooltip: n("editor.redo"),
759
+ disabled: !t,
760
+ onClick: () => e.dispatchCommand(me, void 0)
761
+ });
762
+ }, nt = () => {
763
+ let [e] = B(), { strikethrough: t } = Y(), { t: n } = a();
764
+ return /* @__PURE__ */ v(J, {
765
+ icon: "shanchuxian",
766
+ tooltip: n("editor.strikethrough"),
767
+ active: t,
768
+ onClick: () => e.dispatchCommand(z, "strikethrough")
769
+ });
770
+ }, rt = () => {
771
+ let [e] = B(), { superscript: t } = Y(), { t: n } = a();
772
+ return /* @__PURE__ */ v(J, {
773
+ icon: "shangbiao",
774
+ tooltip: n("editor.superscript"),
775
+ active: t,
776
+ onClick: () => e.dispatchCommand(z, "superscript")
777
+ });
778
+ }, it = () => {
779
+ let [e] = B(), { subscript: t } = Y(), { t: n } = a();
780
+ return /* @__PURE__ */ v(J, {
781
+ icon: "xiabiao",
782
+ tooltip: n("editor.subscript"),
783
+ active: t,
784
+ onClick: () => e.dispatchCommand(z, "subscript")
785
+ });
786
+ }, at = () => {
787
+ let [e] = B(), { t } = a();
788
+ return /* @__PURE__ */ v(J, {
789
+ icon: "zengjiasuojin",
790
+ tooltip: t("editor.indent"),
791
+ onClick: () => e.dispatchCommand(fe, void 0)
792
+ });
793
+ }, ot = () => {
794
+ let [e] = B(), { canOutdent: t } = Y(), { t: n } = a();
795
+ return /* @__PURE__ */ v(J, {
796
+ icon: "jianshaosuojin",
797
+ tooltip: n("editor.outdent"),
798
+ disabled: !t,
799
+ onClick: () => e.dispatchCommand(pe, void 0)
800
+ });
801
+ }, st = () => {
802
+ let [e] = B(), { listType: t } = Y(), { t: n } = a(), r = t === "bullet";
803
+ return /* @__PURE__ */ v(J, {
804
+ icon: "xuhaoliebiao",
805
+ tooltip: n("editor.bulletList"),
806
+ active: r,
807
+ onClick: () => {
808
+ e.dispatchCommand(r ? Se : xe, void 0);
809
+ }
810
+ });
811
+ }, ct = () => {
812
+ let [e] = B(), { listType: t } = Y(), { t: n } = a(), r = t === "number";
813
+ return /* @__PURE__ */ v(J, {
814
+ icon: "bianhaoliebiao",
815
+ tooltip: n("editor.numberList"),
816
+ active: r,
817
+ onClick: () => {
818
+ e.dispatchCommand(r ? Se : be, void 0);
819
+ }
820
+ });
821
+ }, lt = () => {
822
+ let [e] = B(), { isCodeBlock: t } = Y(), { t: n } = a();
823
+ return /* @__PURE__ */ v(J, {
824
+ icon: "daima",
825
+ tooltip: n("editor.codeBlock"),
826
+ active: t,
827
+ onClick: () => {
828
+ e.update(() => {
829
+ H(I(), () => t ? F() : Ce(G));
830
+ });
831
+ }
832
+ });
833
+ }, Q = {
834
+ "bsy-lexical__table-picker": "_bsy-lexical__table-picker_mv0nn_1",
835
+ "bsy-lexical__table-picker-grid": "_bsy-lexical__table-picker-grid_mv0nn_9",
836
+ "bsy-lexical__table-picker-cell": "_bsy-lexical__table-picker-cell_mv0nn_15",
837
+ "bsy-lexical__table-picker-cell--active": "_bsy-lexical__table-picker-cell--active_mv0nn_24",
838
+ "bsy-lexical__table-picker-label": "_bsy-lexical__table-picker-label_mv0nn_28"
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({
841
+ rows: 0,
842
+ cols: 0
843
+ });
844
+ T(() => {
845
+ r && u(!1);
846
+ }, [r]);
847
+ let p = () => {
848
+ u(!1), f({
849
+ rows: 0,
850
+ cols: 0
851
+ });
852
+ }, { refs: m, floatingStyles: h, getReferenceProps: g, getFloatingProps: b } = l({
853
+ isOpen: c,
854
+ close: p,
855
+ showMask: !1,
856
+ zIndex: s,
857
+ popupMinWidth: "220px",
858
+ offset: {
859
+ x: 0,
860
+ y: 4
861
+ }
862
+ });
863
+ return r ? /* @__PURE__ */ v(J, {
864
+ icon: "charubiaoge",
865
+ tooltip: i("editor.table"),
866
+ disabled: !0
867
+ }) : /* @__PURE__ */ y(_, { children: [/* @__PURE__ */ v("div", {
868
+ className: "inline-flex",
869
+ ref: m.setReference,
870
+ ...g({ onClick: () => u((e) => !e) }),
871
+ children: /* @__PURE__ */ v(J, {
872
+ icon: "charubiaoge",
873
+ tooltip: i("editor.table")
874
+ })
875
+ }), /* @__PURE__ */ v(re, { children: /* @__PURE__ */ v(N, { children: c ? /* @__PURE__ */ v(n, {
876
+ zIndex: s,
877
+ children: /* @__PURE__ */ v(P.div, {
878
+ ref: m.setFloating,
879
+ ...b(),
880
+ style: {
881
+ ...h,
882
+ zIndex: s
883
+ },
884
+ ...o,
885
+ children: /* @__PURE__ */ y("div", {
886
+ className: Q["bsy-lexical__table-picker"],
887
+ onMouseDown: (e) => e.preventDefault(),
888
+ onMouseLeave: () => f({
889
+ rows: 0,
890
+ cols: 0
891
+ }),
892
+ children: [/* @__PURE__ */ v("div", {
893
+ className: Q["bsy-lexical__table-picker-grid"],
894
+ children: ut.map((t) => ut.map((n) => /* @__PURE__ */ v("button", {
895
+ type: "button",
896
+ className: M(Q["bsy-lexical__table-picker-cell"], d.rows >= t && d.cols >= n && Q["bsy-lexical__table-picker-cell--active"]),
897
+ onMouseEnter: () => f({
898
+ rows: t,
899
+ cols: n
900
+ }),
901
+ onClick: () => {
902
+ e.dispatchCommand(we, {
903
+ rows: String(t),
904
+ columns: String(n),
905
+ includeHeaders: !1
906
+ }), p();
907
+ }
908
+ }, `${t}-${n}`)))
909
+ }), /* @__PURE__ */ y("div", {
910
+ className: Q["bsy-lexical__table-picker-label"],
911
+ children: [
912
+ d.rows,
913
+ " × ",
914
+ d.cols
915
+ ]
916
+ })]
917
+ })
918
+ }, "bsy-lexical-table-picker")
919
+ }) : null }) })] });
920
+ }, ft = x(null), pt = () => {
921
+ let e = w(ft);
922
+ if (!e) throw Error("useSourceMode must be used within SourceModeProvider");
923
+ return e;
924
+ }, mt = () => {
925
+ let { t: e } = a(), { isSourceMode: t, toggleSourceMode: n } = pt();
926
+ return /* @__PURE__ */ v(J, {
927
+ icon: "yuanmamoshi",
928
+ tooltip: e("editor.sourceMode"),
929
+ active: t,
930
+ onClick: n
931
+ });
932
+ }, ht = () => {
933
+ let [t] = B(), { headingTag: n, isInTable: r } = Y(), { t: i } = a(), { iconSize: o } = q(), s = n || "paragraph", c = [
934
+ {
935
+ key: "paragraph",
936
+ label: i("editor.paragraph")
937
+ },
938
+ {
939
+ key: "h1",
940
+ label: i("editor.heading1")
941
+ },
942
+ {
943
+ key: "h2",
944
+ label: i("editor.heading2")
945
+ },
946
+ {
947
+ key: "h3",
948
+ label: i("editor.heading3")
949
+ }
950
+ ], l = c.find((e) => e.key === s)?.label, d = C((e) => {
951
+ let n = e.key;
952
+ t.update(() => {
953
+ H(I(), () => n === "paragraph" ? F() : Te(n));
954
+ });
955
+ }, [t]), f = /* @__PURE__ */ v("div", {
956
+ className: W["bsy-lexical__toolbar-select"],
957
+ style: { width: 58 },
958
+ children: /* @__PURE__ */ v(J, {
959
+ icon: /* @__PURE__ */ y(_, { children: [/* @__PURE__ */ v("span", {
960
+ className: W["bsy-lexical__toolbar-select-label"],
961
+ children: l
962
+ }), /* @__PURE__ */ v(e, {
963
+ name: "arrow-down",
964
+ size: o,
965
+ className: W["bsy-lexical__toolbar-select-arrow"]
966
+ })] }),
967
+ tooltip: i("editor.heading"),
968
+ disabled: r
969
+ })
970
+ });
971
+ return r ? f : /* @__PURE__ */ v(u, {
972
+ menus: c,
973
+ onClick: d,
974
+ showSearch: !1,
975
+ activeKey: [s],
976
+ style: {
977
+ width: "110px",
978
+ minWidth: "110px"
979
+ },
980
+ children: f
981
+ });
982
+ }, $ = /* @__PURE__ */ new Map(), gt = (e, t) => {
983
+ if (!e) throw Error("registerToolbarButton: name is required");
984
+ $.set(e, t);
985
+ }, _t = (e) => {
986
+ $.delete(e);
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
1011
+ };
1012
+ Object.entries(bt).forEach(([e, t]) => {
1013
+ gt(e, t);
1014
+ });
1015
+ //#endregion
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 };