@baishuyun/ui-mobile 0.7.0 → 0.9.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/{AMap-DwrSlwyV.js → AMap-B1GiEoPE.js} +2 -2
- package/dist/AMap/index.js +4 -4
- package/dist/ActionSheet/ActionSheet-DVck9uyS.js +85 -0
- package/dist/ActionSheet/index.js +6 -4
- package/dist/Calendar/{Calendar-tYjpphMo.js → Calendar-B1TwDL1q.js} +2 -2
- package/dist/Calendar/index.js +4 -4
- package/dist/ConfigProvider/ConfigProvider-xyGx046s.js +328 -0
- package/dist/ConfigProvider/index.js +4 -3
- package/dist/ConfigProvider/{useLocale-CP8NRZoj.js → useLocale-Bf81I-9U.js} +57 -0
- package/dist/Editor/Editor-DUsPQevQ.js +2051 -0
- package/dist/Editor/index.js +8 -0
- package/dist/Gantt/{Gantt-D2ZGpS5p.js → Gantt-CbHw9RMw.js} +3 -3
- package/dist/Gantt/index.js +8 -6
- package/dist/Icon/{Icon-CFvcrGGg.js → Icon-D3xi1oyo.js} +1 -1
- package/dist/Icon/index.js +2 -2
- package/dist/Overlay/Overlay-CqQWOqO4.js +61 -0
- package/dist/Overlay/index.js +3 -0
- package/dist/Popup/Popup-BIIDAUmB.js +78 -0
- package/dist/Popup/index.js +5 -0
- package/dist/components/ActionSheet/ActionSheet.d.ts +1 -1
- package/dist/components/ActionSheet/interface.d.ts +1 -2
- package/dist/components/ConfigProvider/ConfigProvider.d.ts +1 -1
- package/dist/components/ConfigProvider/context.d.ts +14 -0
- package/dist/components/Editor/Editor.d.ts +6 -0
- package/dist/components/Editor/EditorCore.d.ts +3 -0
- package/dist/components/Editor/EditorHtml.d.ts +3 -0
- package/dist/components/Editor/Thinking.d.ts +22 -0
- package/dist/components/Editor/constants.d.ts +57 -0
- package/dist/components/Editor/index.d.ts +3 -0
- package/dist/components/Editor/interface.d.ts +59 -0
- package/dist/components/Editor/nodes/ExtendedTextNode.d.ts +9 -0
- package/dist/components/Editor/nodes/ImageNode.d.ts +48 -0
- package/dist/components/Editor/plugins/HeadingPlugin.d.ts +2 -0
- package/dist/components/Editor/plugins/LinkColorPlugin.d.ts +2 -0
- package/dist/components/Editor/plugins/PasteStripImagePlugin.d.ts +2 -0
- package/dist/components/Editor/sheets.d.ts +43 -0
- package/dist/components/Editor/toolbar/Toolbar.d.ts +10 -0
- package/dist/components/Editor/toolbar/ToolbarColorGlyph.d.ts +8 -0
- package/dist/components/Editor/toolbar/useTextFormats.d.ts +16 -0
- package/dist/components/Editor/utils/applyAiPolish.d.ts +5 -0
- package/dist/components/Editor/utils/fillRootFromHtml.d.ts +2 -0
- package/dist/components/Editor/utils/isAcceptedImageType.d.ts +5 -0
- package/dist/components/Editor/utils/isEmptyEditorHtml.d.ts +1 -0
- package/dist/components/Editor/utils/readEditorAiSnapshot.d.ts +8 -0
- package/dist/components/Editor/utils/sanitizeEditorHtml.d.ts +1 -0
- package/dist/components/Editor/utils/stripInlineStyleProperty.d.ts +1 -0
- package/dist/components/Editor/utils/toPortableEditorHtml.d.ts +1 -0
- package/dist/components/Editor/utils/unwrapTypesetFence.d.ts +6 -0
- package/dist/components/Overlay/OverlayContext.d.ts +17 -0
- package/dist/components/Overlay/index.d.ts +2 -0
- package/dist/components/Popup/Popup.d.ts +3 -0
- package/dist/components/Popup/index.d.ts +2 -0
- package/dist/components/Popup/interface.d.ts +46 -0
- package/dist/components/index.d.ts +6 -0
- package/dist/index.js +13 -10
- package/dist/locale/lang/en-US.json.d.ts +59 -0
- package/dist/locale/lang/zh-CN.json.d.ts +59 -0
- package/dist/locale/lang/zh-TW.json.d.ts +59 -0
- package/dist/style.css +1 -1
- package/dist/vendors/{version-Dg7dOJFj.js → version-CslTV1sb.js} +1 -1
- package/dist/vite-env.d.ts +5 -0
- package/package.json +12 -3
- package/dist/ActionSheet/ActionSheet-DbrKxa_y.js +0 -133
- package/dist/ConfigProvider/ConfigProvider-DnlakyRE.js +0 -208
- /package/dist/Calendar/{cssVars-UpgK6spf.js → cssVars-DNOooryc.js} +0 -0
|
@@ -0,0 +1,2051 @@
|
|
|
1
|
+
import { t as e } from "../Popup/Popup-BIIDAUmB.js";
|
|
2
|
+
import { t } from "../ActionSheet/ActionSheet-DVck9uyS.js";
|
|
3
|
+
import { t as n } from "../Icon/Icon-D3xi1oyo.js";
|
|
4
|
+
import { t as r } from "../ConfigProvider/useLocale-Bf81I-9U.js";
|
|
5
|
+
import { createContext as i, useCallback as a, useContext as o, useEffect as s, useId as c, useLayoutEffect as l, useRef as u, useState as d } from "react";
|
|
6
|
+
import { Fragment as f, jsx as p, jsxs as m } from "react/jsx-runtime";
|
|
7
|
+
import { useEventListener as h } from "ahooks";
|
|
8
|
+
import { LexicalComposer as g } from "@lexical/react/LexicalComposer";
|
|
9
|
+
import { $createLinkNode as _, $isLinkNode as v, $toggleLink as y, AutoLinkNode as b, LinkNode as x } from "@lexical/link";
|
|
10
|
+
import { $isListItemNode as S, $isListNode as ee, INSERT_ORDERED_LIST_COMMAND as C, INSERT_UNORDERED_LIST_COMMAND as w, ListItemNode as T, ListNode as te, REMOVE_LIST_COMMAND as E } from "@lexical/list";
|
|
11
|
+
import { $createHeadingNode as ne, $isHeadingNode as D, HeadingNode as O } from "@lexical/rich-text";
|
|
12
|
+
import { $applyNodeReplacement as re, $createParagraphNode as k, $createTextNode as ie, $getNodeByKey as ae, $getRoot as A, $getSelection as j, $insertNodes as oe, $isElementNode as se, $isRangeSelection as M, $isRootOrShadowRoot as N, $isTextNode as ce, $nodesOfType as le, $setSelection as ue, COMMAND_PRIORITY_HIGH as de, DROP_COMMAND as fe, DecoratorNode as pe, FORMAT_ELEMENT_COMMAND as P, FORMAT_TEXT_COMMAND as F, INDENT_CONTENT_COMMAND as I, OUTDENT_CONTENT_COMMAND as me, PASTE_COMMAND as he, PASTE_TAG as ge, TextNode as L } from "lexical";
|
|
13
|
+
import { $generateHtmlFromNodes as _e, $generateNodesFromDOM as R } from "@lexical/html";
|
|
14
|
+
import { ContentEditable as ve } from "@lexical/react/LexicalContentEditable";
|
|
15
|
+
import { HistoryPlugin as ye } from "@lexical/react/LexicalHistoryPlugin";
|
|
16
|
+
import { LinkPlugin as be } from "@lexical/react/LexicalLinkPlugin";
|
|
17
|
+
import { ListPlugin as xe } from "@lexical/react/LexicalListPlugin";
|
|
18
|
+
import { OnChangePlugin as Se } from "@lexical/react/LexicalOnChangePlugin";
|
|
19
|
+
import { RichTextPlugin as Ce } from "@lexical/react/LexicalRichTextPlugin";
|
|
20
|
+
import { LexicalErrorBoundary as we } from "@lexical/react/LexicalErrorBoundary";
|
|
21
|
+
import { useLexicalComposerContext as z } from "@lexical/react/LexicalComposerContext";
|
|
22
|
+
import { $findMatchingParent as B, mergeRegister as Te } from "@lexical/utils";
|
|
23
|
+
import { $getSelectionStyleValueForProperty as Ee, $patchStyleText as V, $setBlocksType as De } from "@lexical/selection";
|
|
24
|
+
import Oe from "dompurify";
|
|
25
|
+
//#region src/components/Editor/editor.module.scss
|
|
26
|
+
var H = {
|
|
27
|
+
"bsy-mobile-editor": "_bsy-mobile-editor_12qed_1",
|
|
28
|
+
"bsy-mobile-editor__label": "_bsy-mobile-editor__label_12qed_14",
|
|
29
|
+
"bsy-mobile-editor__label-text": "_bsy-mobile-editor__label-text_12qed_19",
|
|
30
|
+
"bsy-mobile-editor__header": "_bsy-mobile-editor__header_12qed_28",
|
|
31
|
+
"bsy-mobile-editor__title": "_bsy-mobile-editor__title_12qed_38",
|
|
32
|
+
"bsy-mobile-editor__close": "_bsy-mobile-editor__close_12qed_48",
|
|
33
|
+
"bsy-mobile-editor__content": "_bsy-mobile-editor__content_12qed_62",
|
|
34
|
+
"bsy-mobile-editor__editable": "_bsy-mobile-editor__editable_12qed_72",
|
|
35
|
+
"bsy-mobile-editor__image-shell": "_bsy-mobile-editor__image-shell_12qed_161",
|
|
36
|
+
"bsy-mobile-editor__image": "_bsy-mobile-editor__image_12qed_161",
|
|
37
|
+
"bsy-mobile-editor__image-mask": "_bsy-mobile-editor__image-mask_12qed_183",
|
|
38
|
+
"bsy-mobile-editor__image-progress": "_bsy-mobile-editor__image-progress_12qed_192",
|
|
39
|
+
"bsy-mobile-editor__image-progress--spin": "_bsy-mobile-editor__image-progress--spin_12qed_195",
|
|
40
|
+
"bsy-mobile-editor-progress-spin": "_bsy-mobile-editor-progress-spin_12qed_1",
|
|
41
|
+
"bsy-mobile-editor__toolbar": "_bsy-mobile-editor__toolbar_12qed_198",
|
|
42
|
+
"bsy-mobile-editor__toolbar-scroller": "_bsy-mobile-editor__toolbar-scroller_12qed_213",
|
|
43
|
+
"bsy-mobile-editor__toolbar-track": "_bsy-mobile-editor__toolbar-track_12qed_230",
|
|
44
|
+
"bsy-mobile-editor__toolbar-thumb": "_bsy-mobile-editor__toolbar-thumb_12qed_242",
|
|
45
|
+
"bsy-mobile-editor__toolbar-group": "_bsy-mobile-editor__toolbar-group_12qed_247",
|
|
46
|
+
"bsy-mobile-editor__toolbar-divider": "_bsy-mobile-editor__toolbar-divider_12qed_253",
|
|
47
|
+
"bsy-mobile-editor__tool": "_bsy-mobile-editor__tool_12qed_198",
|
|
48
|
+
"bsy-mobile-editor__tool--active": "_bsy-mobile-editor__tool--active_12qed_274",
|
|
49
|
+
"bsy-mobile-editor__tool--select": "_bsy-mobile-editor__tool--select_12qed_281",
|
|
50
|
+
"bsy-mobile-editor__tool--select-align": "_bsy-mobile-editor__tool--select-align_12qed_286",
|
|
51
|
+
"bsy-mobile-editor__tool-caret": "_bsy-mobile-editor__tool-caret_12qed_289",
|
|
52
|
+
"bsy-mobile-editor__tool-caret--open": "_bsy-mobile-editor__tool-caret--open_12qed_292",
|
|
53
|
+
"bsy-mobile-editor__ai-icon": "_bsy-mobile-editor__ai-icon_12qed_295",
|
|
54
|
+
"bsy-mobile-editor__tool-text": "_bsy-mobile-editor__tool-text_12qed_300",
|
|
55
|
+
"bsy-mobile-editor__swatches": "_bsy-mobile-editor__swatches_12qed_305",
|
|
56
|
+
"bsy-mobile-editor__swatch": "_bsy-mobile-editor__swatch_12qed_305",
|
|
57
|
+
"bsy-mobile-editor__sheet": "_bsy-mobile-editor__sheet_12qed_321",
|
|
58
|
+
"bsy-mobile-editor__sheet-body": "_bsy-mobile-editor__sheet-body_12qed_327",
|
|
59
|
+
"bsy-mobile-editor__sheet-body--stack": "_bsy-mobile-editor__sheet-body--stack_12qed_332",
|
|
60
|
+
"bsy-mobile-editor__sheet-field": "_bsy-mobile-editor__sheet-field_12qed_337",
|
|
61
|
+
"bsy-mobile-editor__sheet-label": "_bsy-mobile-editor__sheet-label_12qed_342",
|
|
62
|
+
"bsy-mobile-editor__sheet-note": "_bsy-mobile-editor__sheet-note_12qed_348",
|
|
63
|
+
"bsy-mobile-editor__sheet-note--hint": "_bsy-mobile-editor__sheet-note--hint_12qed_354",
|
|
64
|
+
"bsy-mobile-editor__sheet-error": "_bsy-mobile-editor__sheet-error_12qed_357",
|
|
65
|
+
"bsy-mobile-editor__sheet-bar": "_bsy-mobile-editor__sheet-bar_12qed_377",
|
|
66
|
+
"bsy-mobile-editor__sheet-ok": "_bsy-mobile-editor__sheet-ok_12qed_398",
|
|
67
|
+
"bsy-mobile-editor__check": "_bsy-mobile-editor__check_12qed_403",
|
|
68
|
+
"bsy-mobile-editor__check-input": "_bsy-mobile-editor__check-input_12qed_415",
|
|
69
|
+
"bsy-mobile-editor__check-box": "_bsy-mobile-editor__check-box_12qed_422",
|
|
70
|
+
"bsy-mobile-editor__ai": "_bsy-mobile-editor__ai_12qed_295",
|
|
71
|
+
"bsy-mobile-editor__ai-body": "_bsy-mobile-editor__ai-body_12qed_444",
|
|
72
|
+
"bsy-mobile-editor__ai-section": "_bsy-mobile-editor__ai-section_12qed_452",
|
|
73
|
+
"bsy-mobile-editor__ai-section-head": "_bsy-mobile-editor__ai-section-head_12qed_460",
|
|
74
|
+
"bsy-mobile-editor__ai-section-scroll": "_bsy-mobile-editor__ai-section-scroll_12qed_468",
|
|
75
|
+
"bsy-mobile-editor__ai-label": "_bsy-mobile-editor__ai-label_12qed_475",
|
|
76
|
+
"bsy-mobile-editor__ai-label--after": "_bsy-mobile-editor__ai-label--after_12qed_487",
|
|
77
|
+
"bsy-mobile-editor__ai-label--before": "_bsy-mobile-editor__ai-label--before_12qed_491",
|
|
78
|
+
"bsy-mobile-editor__ai-dot": "_bsy-mobile-editor__ai-dot_12qed_495",
|
|
79
|
+
"bsy-mobile-editor__ai-split": "_bsy-mobile-editor__ai-split_12qed_502",
|
|
80
|
+
"bsy-mobile-editor__ai-preset": "_bsy-mobile-editor__ai-preset_12qed_508",
|
|
81
|
+
"bsy-mobile-editor__ai-think-pin": "_bsy-mobile-editor__ai-think-pin_12qed_528",
|
|
82
|
+
"bsy-mobile-editor__ai-think-head": "_bsy-mobile-editor__ai-think-head_12qed_532",
|
|
83
|
+
"bsy-mobile-editor__ai-think-label": "_bsy-mobile-editor__ai-think-label_12qed_549",
|
|
84
|
+
"bsy-mobile-editor__ai-think-label--shimmer": "_bsy-mobile-editor__ai-think-label--shimmer_12qed_553",
|
|
85
|
+
"bsy-mobile-ai-think-shimmer": "_bsy-mobile-ai-think-shimmer_12qed_1",
|
|
86
|
+
"bsy-mobile-editor__ai-think-arrow": "_bsy-mobile-editor__ai-think-arrow_12qed_564",
|
|
87
|
+
"bsy-mobile-editor__ai-think-arrow--open": "_bsy-mobile-editor__ai-think-arrow--open_12qed_571",
|
|
88
|
+
"bsy-mobile-editor__ai-think-icon": "_bsy-mobile-editor__ai-think-icon_12qed_574",
|
|
89
|
+
"bsy-mobile-ai-think": "_bsy-mobile-ai-think_12qed_1",
|
|
90
|
+
"bsy-mobile-editor__ai-think-body": "_bsy-mobile-editor__ai-think-body_12qed_586",
|
|
91
|
+
"bsy-mobile-editor__ai-error": "_bsy-mobile-editor__ai-error_12qed_595",
|
|
92
|
+
"bsy-mobile-editor__ai-footer": "_bsy-mobile-editor__ai-footer_12qed_600",
|
|
93
|
+
"bsy-mobile-editor__ai-footer-ok": "_bsy-mobile-editor__ai-footer-ok_12qed_622"
|
|
94
|
+
}, ke = [
|
|
95
|
+
{
|
|
96
|
+
label: "12",
|
|
97
|
+
value: "12px"
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
label: "14",
|
|
101
|
+
value: "14px"
|
|
102
|
+
},
|
|
103
|
+
{
|
|
104
|
+
label: "16",
|
|
105
|
+
value: "16px"
|
|
106
|
+
},
|
|
107
|
+
{
|
|
108
|
+
label: "18",
|
|
109
|
+
value: "18px"
|
|
110
|
+
},
|
|
111
|
+
{
|
|
112
|
+
label: "20",
|
|
113
|
+
value: "20px"
|
|
114
|
+
},
|
|
115
|
+
{
|
|
116
|
+
label: "22",
|
|
117
|
+
value: "22px"
|
|
118
|
+
},
|
|
119
|
+
{
|
|
120
|
+
label: "24",
|
|
121
|
+
value: "24px"
|
|
122
|
+
},
|
|
123
|
+
{
|
|
124
|
+
label: "28",
|
|
125
|
+
value: "28px"
|
|
126
|
+
},
|
|
127
|
+
{
|
|
128
|
+
label: "32",
|
|
129
|
+
value: "32px"
|
|
130
|
+
},
|
|
131
|
+
{
|
|
132
|
+
label: "36",
|
|
133
|
+
value: "36px"
|
|
134
|
+
},
|
|
135
|
+
{
|
|
136
|
+
label: "64",
|
|
137
|
+
value: "64px"
|
|
138
|
+
},
|
|
139
|
+
{
|
|
140
|
+
label: "128",
|
|
141
|
+
value: "128px"
|
|
142
|
+
}
|
|
143
|
+
], U = "#000", Ae = "transparent", je = /* @__PURE__ */ "#005eef.#3642e9.#7f43c8.#114bb8.#1379d9.#10a9c4.#119d85.#ffc502.#ff9921.#f06648.#f168b6.#d9e8ff.#dee0ff.#efe2ff.#d5e4ff.#daedff.#ddfaff.#d7fff8.#fff4d0.#ffecd7.#ffe3dd.#ffdef1.#262626.#3c3c3d.#454545.#515152.#5d5c5e.#6c6c6e.#878789.#b0afb1.#d0d0d1.#e6e6e7.#f5f5f6".split("."), W = [
|
|
144
|
+
"quick",
|
|
145
|
+
"formal",
|
|
146
|
+
"colloquial",
|
|
147
|
+
"lively",
|
|
148
|
+
"literary",
|
|
149
|
+
"retro"
|
|
150
|
+
], G = {
|
|
151
|
+
quick: "editor.aiPresetQuick",
|
|
152
|
+
formal: "editor.aiPresetFormal",
|
|
153
|
+
colloquial: "editor.aiPresetColloquial",
|
|
154
|
+
lively: "editor.aiPresetLively",
|
|
155
|
+
literary: "editor.aiPresetLiterary",
|
|
156
|
+
retro: "editor.aiPresetRetro"
|
|
157
|
+
}, Me = [
|
|
158
|
+
{
|
|
159
|
+
key: "ai",
|
|
160
|
+
buttons: ["ai"]
|
|
161
|
+
},
|
|
162
|
+
{
|
|
163
|
+
key: "format",
|
|
164
|
+
buttons: [
|
|
165
|
+
"bold",
|
|
166
|
+
"italic",
|
|
167
|
+
"underline",
|
|
168
|
+
"strikethrough",
|
|
169
|
+
"align"
|
|
170
|
+
]
|
|
171
|
+
},
|
|
172
|
+
{
|
|
173
|
+
key: "style",
|
|
174
|
+
buttons: [
|
|
175
|
+
"heading",
|
|
176
|
+
"fontSize",
|
|
177
|
+
"fontColor",
|
|
178
|
+
"fill"
|
|
179
|
+
]
|
|
180
|
+
},
|
|
181
|
+
{
|
|
182
|
+
key: "indent",
|
|
183
|
+
buttons: ["outdent", "indent"]
|
|
184
|
+
},
|
|
185
|
+
{
|
|
186
|
+
key: "list",
|
|
187
|
+
buttons: ["number", "bullet"]
|
|
188
|
+
},
|
|
189
|
+
{
|
|
190
|
+
key: "insert",
|
|
191
|
+
buttons: ["picture", "link"]
|
|
192
|
+
}
|
|
193
|
+
], Ne = [
|
|
194
|
+
"jpg",
|
|
195
|
+
"jpeg",
|
|
196
|
+
"png",
|
|
197
|
+
"gif",
|
|
198
|
+
"bmp",
|
|
199
|
+
"tif"
|
|
200
|
+
], Pe = Ne.map((e) => `.${e}`).join(","), Fe = "calc(100dvh - 104px)", Ie = i({}), K = 36, Le = 14, Re = 2 * Math.PI * Le, ze = ({ nodeKey: e, src: t, altText: n, dataId: r }) => {
|
|
201
|
+
let i = o(Ie), a = e in i, s = i[e];
|
|
202
|
+
return /* @__PURE__ */ m("span", {
|
|
203
|
+
className: H["bsy-mobile-editor__image"],
|
|
204
|
+
children: [/* @__PURE__ */ p("img", {
|
|
205
|
+
src: t,
|
|
206
|
+
alt: n,
|
|
207
|
+
"data-id": r
|
|
208
|
+
}), a ? /* @__PURE__ */ p("span", {
|
|
209
|
+
className: H["bsy-mobile-editor__image-mask"],
|
|
210
|
+
role: "progressbar",
|
|
211
|
+
"aria-label": n,
|
|
212
|
+
"aria-valuemin": 0,
|
|
213
|
+
"aria-valuemax": 100,
|
|
214
|
+
"aria-valuenow": s === void 0 ? void 0 : Math.round(s),
|
|
215
|
+
children: /* @__PURE__ */ m("svg", {
|
|
216
|
+
className: s === void 0 ? `${H["bsy-mobile-editor__image-progress"]} ${H["bsy-mobile-editor__image-progress--spin"]}` : H["bsy-mobile-editor__image-progress"],
|
|
217
|
+
width: K,
|
|
218
|
+
height: K,
|
|
219
|
+
viewBox: `0 0 ${K} ${K}`,
|
|
220
|
+
"aria-hidden": "true",
|
|
221
|
+
children: [/* @__PURE__ */ p("circle", {
|
|
222
|
+
cx: K / 2,
|
|
223
|
+
cy: K / 2,
|
|
224
|
+
r: Le,
|
|
225
|
+
fill: "none",
|
|
226
|
+
stroke: "rgba(255,255,255,0.35)",
|
|
227
|
+
strokeWidth: "3"
|
|
228
|
+
}), /* @__PURE__ */ p("circle", {
|
|
229
|
+
cx: K / 2,
|
|
230
|
+
cy: K / 2,
|
|
231
|
+
r: Le,
|
|
232
|
+
fill: "none",
|
|
233
|
+
stroke: "#fff",
|
|
234
|
+
strokeWidth: "3",
|
|
235
|
+
strokeLinecap: "round",
|
|
236
|
+
strokeDasharray: s === void 0 ? `${Re * .25} ${Re}` : Re,
|
|
237
|
+
strokeDashoffset: s === void 0 ? 0 : Re * (1 - s / 100),
|
|
238
|
+
transform: `rotate(-90 ${K / 2} ${K / 2})`
|
|
239
|
+
})]
|
|
240
|
+
})
|
|
241
|
+
}) : null]
|
|
242
|
+
});
|
|
243
|
+
}, Be = class e extends pe {
|
|
244
|
+
static getType() {
|
|
245
|
+
return "image";
|
|
246
|
+
}
|
|
247
|
+
static clone(t) {
|
|
248
|
+
return new e(t.__src, t.__altText, t.__width, t.__height, t.__key, t.__dataId);
|
|
249
|
+
}
|
|
250
|
+
constructor(e, t, n, r, i, a) {
|
|
251
|
+
super(i), this.__src = e, this.__altText = t || "", this.__width = n, this.__height = r, this.__dataId = a;
|
|
252
|
+
}
|
|
253
|
+
createDOM() {
|
|
254
|
+
let e = document.createElement("span");
|
|
255
|
+
return e.className = H["bsy-mobile-editor__image-shell"], e;
|
|
256
|
+
}
|
|
257
|
+
updateDOM() {
|
|
258
|
+
return !1;
|
|
259
|
+
}
|
|
260
|
+
exportDOM() {
|
|
261
|
+
let e = document.createElement("img");
|
|
262
|
+
return e.setAttribute("src", this.__src), e.setAttribute("alt", this.__altText), e.style.maxWidth = "100%", e.style.display = "inline", e.style.verticalAlign = "baseline", this.__width && e.setAttribute("width", this.__width.toString()), this.__height && e.setAttribute("height", this.__height.toString()), this.__dataId && e.setAttribute("data-id", this.__dataId), { element: e };
|
|
263
|
+
}
|
|
264
|
+
getSrc() {
|
|
265
|
+
return this.__src;
|
|
266
|
+
}
|
|
267
|
+
setSrc(e) {
|
|
268
|
+
let t = this.getWritable();
|
|
269
|
+
t.__src = e;
|
|
270
|
+
}
|
|
271
|
+
setDataId(e) {
|
|
272
|
+
let t = this.getWritable();
|
|
273
|
+
t.__dataId = e;
|
|
274
|
+
}
|
|
275
|
+
static importDOM() {
|
|
276
|
+
return { img: () => ({
|
|
277
|
+
conversion: Ue,
|
|
278
|
+
priority: 0
|
|
279
|
+
}) };
|
|
280
|
+
}
|
|
281
|
+
static importJSON(e) {
|
|
282
|
+
let { src: t, altText: n, width: r, height: i, dataId: a } = e;
|
|
283
|
+
return He({
|
|
284
|
+
src: t,
|
|
285
|
+
altText: n,
|
|
286
|
+
width: r,
|
|
287
|
+
height: i,
|
|
288
|
+
dataId: a
|
|
289
|
+
});
|
|
290
|
+
}
|
|
291
|
+
exportJSON() {
|
|
292
|
+
return {
|
|
293
|
+
src: this.getSrc(),
|
|
294
|
+
altText: this.__altText,
|
|
295
|
+
width: this.__width,
|
|
296
|
+
height: this.__height,
|
|
297
|
+
dataId: this.__dataId,
|
|
298
|
+
type: "image",
|
|
299
|
+
version: 1
|
|
300
|
+
};
|
|
301
|
+
}
|
|
302
|
+
isInline() {
|
|
303
|
+
return !0;
|
|
304
|
+
}
|
|
305
|
+
decorate() {
|
|
306
|
+
return /* @__PURE__ */ p(ze, {
|
|
307
|
+
nodeKey: this.getKey(),
|
|
308
|
+
src: this.__src,
|
|
309
|
+
altText: this.__altText,
|
|
310
|
+
dataId: this.__dataId
|
|
311
|
+
});
|
|
312
|
+
}
|
|
313
|
+
}, Ve = (e) => e instanceof Be, He = ({ src: e, altText: t, width: n, height: r, dataId: i, key: a }) => new Be(e, t, n, r, a, i), Ue = (e) => {
|
|
314
|
+
if (!(e instanceof HTMLImageElement)) return null;
|
|
315
|
+
let { src: t, alt: n, style: r } = e, i, a;
|
|
316
|
+
if (r.width) {
|
|
317
|
+
let e = parseInt(r.width, 10);
|
|
318
|
+
Number.isNaN(e) || (i = e);
|
|
319
|
+
}
|
|
320
|
+
if (r.height) {
|
|
321
|
+
let e = parseInt(r.height, 10);
|
|
322
|
+
Number.isNaN(e) || (a = e);
|
|
323
|
+
}
|
|
324
|
+
return i === void 0 && e.width && (i = e.width), a === void 0 && e.height && (a = e.height), { node: He({
|
|
325
|
+
src: t,
|
|
326
|
+
altText: n,
|
|
327
|
+
width: i,
|
|
328
|
+
height: a,
|
|
329
|
+
dataId: e.getAttribute("data-id") || void 0
|
|
330
|
+
}) };
|
|
331
|
+
}, We = (e, t) => e.split(";").map((e) => e.trim()).filter((e) => e && e.split(":")[0].trim().toLowerCase() !== t).join("; "), Ge = () => {
|
|
332
|
+
let [e] = z();
|
|
333
|
+
return s(() => e.registerNodeTransform(O, (e) => {
|
|
334
|
+
let t = e.getTag();
|
|
335
|
+
if (t === "h4" || t === "h5" || t === "h6") {
|
|
336
|
+
e.replace(k(), !0);
|
|
337
|
+
return;
|
|
338
|
+
}
|
|
339
|
+
for (let t of e.getAllTextNodes()) {
|
|
340
|
+
let e = t.getStyle();
|
|
341
|
+
if (!e) continue;
|
|
342
|
+
let n = We(e, "font-size");
|
|
343
|
+
n !== e && t.setStyle(n);
|
|
344
|
+
}
|
|
345
|
+
}), [e]), null;
|
|
346
|
+
}, q = class e extends L {
|
|
347
|
+
static getType() {
|
|
348
|
+
return "extended-text";
|
|
349
|
+
}
|
|
350
|
+
static clone(t) {
|
|
351
|
+
return new e(t.__text, t.__key);
|
|
352
|
+
}
|
|
353
|
+
static importDOM() {
|
|
354
|
+
let e = L.importDOM();
|
|
355
|
+
return {
|
|
356
|
+
...e,
|
|
357
|
+
code: () => ({
|
|
358
|
+
conversion: J(e?.code),
|
|
359
|
+
priority: 1
|
|
360
|
+
}),
|
|
361
|
+
em: () => ({
|
|
362
|
+
conversion: J(e?.em),
|
|
363
|
+
priority: 1
|
|
364
|
+
}),
|
|
365
|
+
span: () => ({
|
|
366
|
+
conversion: J(e?.span),
|
|
367
|
+
priority: 1
|
|
368
|
+
}),
|
|
369
|
+
strong: () => ({
|
|
370
|
+
conversion: J(e?.strong),
|
|
371
|
+
priority: 1
|
|
372
|
+
}),
|
|
373
|
+
sub: () => ({
|
|
374
|
+
conversion: J(e?.sub),
|
|
375
|
+
priority: 1
|
|
376
|
+
}),
|
|
377
|
+
sup: () => ({
|
|
378
|
+
conversion: J(e?.sup),
|
|
379
|
+
priority: 1
|
|
380
|
+
})
|
|
381
|
+
};
|
|
382
|
+
}
|
|
383
|
+
static importJSON(e) {
|
|
384
|
+
return Ke().updateFromJSON(e);
|
|
385
|
+
}
|
|
386
|
+
isSimpleText() {
|
|
387
|
+
return this.__type === "extended-text" && this.__mode === 0;
|
|
388
|
+
}
|
|
389
|
+
}, Ke = (e = "") => re(new q(e)), J = (e) => (t) => {
|
|
390
|
+
let n = e?.(t);
|
|
391
|
+
if (!n) return null;
|
|
392
|
+
let r = n.conversion(t);
|
|
393
|
+
if (!r) return r;
|
|
394
|
+
let i = t.style.backgroundColor, a = t.style.color, o = t.style.fontFamily, s = t.style.fontWeight, c = t.style.fontSize, l = t.style.textDecoration;
|
|
395
|
+
return {
|
|
396
|
+
...r,
|
|
397
|
+
forChild: (e, t) => {
|
|
398
|
+
let n = (r?.forChild ?? ((e) => e))(e, t);
|
|
399
|
+
if (ce(n)) {
|
|
400
|
+
let e = [
|
|
401
|
+
i ? `background-color: ${i}` : null,
|
|
402
|
+
a ? `color: ${a}` : null,
|
|
403
|
+
o ? `font-family: ${o}` : null,
|
|
404
|
+
s ? `font-weight: ${s}` : null,
|
|
405
|
+
c ? `font-size: ${c}` : null,
|
|
406
|
+
l ? `text-decoration: ${l}` : null
|
|
407
|
+
].filter((e) => e !== null).join("; ");
|
|
408
|
+
if (e.length) return n.setStyle(e);
|
|
409
|
+
}
|
|
410
|
+
return n;
|
|
411
|
+
}
|
|
412
|
+
};
|
|
413
|
+
}, qe = () => {
|
|
414
|
+
let [e] = z();
|
|
415
|
+
return s(() => e.registerNodeTransform(q, (e) => {
|
|
416
|
+
if (!B(e, v)) return;
|
|
417
|
+
let t = e.getStyle();
|
|
418
|
+
if (!t) return;
|
|
419
|
+
let n = We(t, "color");
|
|
420
|
+
n !== t && e.setStyle(n);
|
|
421
|
+
}), [e]), null;
|
|
422
|
+
}, Je = /<img\b|<picture\b/i, Ye = () => {
|
|
423
|
+
let [e] = z();
|
|
424
|
+
return s(() => {
|
|
425
|
+
let t = (t) => {
|
|
426
|
+
let n = "clipboardData" in t ? t.clipboardData : "dataTransfer" in t ? t.dataTransfer : null;
|
|
427
|
+
if (!n || n.getData("application/x-lexical-editor") || n.getData("application/x-lexical-drag")) return !1;
|
|
428
|
+
let r = n.getData("text/html");
|
|
429
|
+
if (!(Array.from(n.files).some((e) => e.type.startsWith("image/")) || Array.from(n.items).some((e) => e.type.startsWith("image/")) || Je.test(r))) return !1;
|
|
430
|
+
t.preventDefault();
|
|
431
|
+
let i = n.getData("text/plain");
|
|
432
|
+
return !Je.test(r) && !i || e.update(() => {
|
|
433
|
+
let t = j();
|
|
434
|
+
if (t === null) return;
|
|
435
|
+
let n = r ? new DOMParser().parseFromString(r, "text/html") : null;
|
|
436
|
+
if (n?.querySelectorAll("img, picture").forEach((e) => e.remove()), (n?.body.innerHTML ?? "") && n?.body.textContent?.trim()) {
|
|
437
|
+
let t = R(e, n);
|
|
438
|
+
if (t.length) {
|
|
439
|
+
oe(t);
|
|
440
|
+
return;
|
|
441
|
+
}
|
|
442
|
+
}
|
|
443
|
+
i && t.insertRawText(i);
|
|
444
|
+
}, { tag: ge }), !0;
|
|
445
|
+
};
|
|
446
|
+
return Te(e.registerCommand(he, t, de), e.registerCommand(fe, t, de));
|
|
447
|
+
}, [e]), null;
|
|
448
|
+
}, Xe = "data:image/png;base64,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", Ze = "data:image/png;base64,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", Qe = /* @__PURE__ */ "p.br.strong.em.b.i.u.s.span.sub.sup.ul.ol.li.a.img.pre.code.table.thead.tbody.tr.td.th.h1.h2.h3.h4.h5.h6".split("."), $e = [
|
|
449
|
+
"href",
|
|
450
|
+
"src",
|
|
451
|
+
"alt",
|
|
452
|
+
"target",
|
|
453
|
+
"rel",
|
|
454
|
+
"colspan",
|
|
455
|
+
"rowspan",
|
|
456
|
+
"data-language",
|
|
457
|
+
"data-id",
|
|
458
|
+
"class",
|
|
459
|
+
"style",
|
|
460
|
+
"width",
|
|
461
|
+
"height"
|
|
462
|
+
], et = new Set(/* @__PURE__ */ "color.background-color.font-size.font-family.font-weight.font-style.text-decoration.text-align.max-width.display.vertical-align.width.height.border.margin.padding.padding-inline-start.line-height.list-style-type.list-style-position.list-style.border-collapse.table-layout.overflow-x.white-space.tab-size.border-radius.box-sizing.min-width.min-height.cursor".split(".")), tt = /^(?:(?:(?:f|ht)tps?|mailto|blob):|data:image\/[a-z0-9.+-]+[;,].*|[^a-z]|[a-z+.-]+(?:[^a-z+.:-]|$))/i, nt = new Set([
|
|
463
|
+
"pre",
|
|
464
|
+
"code",
|
|
465
|
+
"td",
|
|
466
|
+
"th"
|
|
467
|
+
]), rt = new Set(["pre", "code"]), it = (e, t) => et.has(e) ? e === "padding-inline-start" ? !0 : e === "padding" || e.startsWith("padding-") ? nt.has(t) : e === "border-radius" ? rt.has(t) : !0 : !1, at = (e, t) => e.split(";").map((e) => e.trim()).filter(Boolean).map((e) => {
|
|
468
|
+
let n = e.indexOf(":");
|
|
469
|
+
if (n === -1) return null;
|
|
470
|
+
let r = e.slice(0, n).trim().toLowerCase(), i = e.slice(n + 1).trim();
|
|
471
|
+
if (r === "background") {
|
|
472
|
+
if (/url\s*\(/i.test(i)) return null;
|
|
473
|
+
r = "background-color";
|
|
474
|
+
}
|
|
475
|
+
return !it(r, t) || /expression|javascript:|url\s*\(\s*['"]?\s*javascript/i.test(i) ? null : `${r}: ${i}`;
|
|
476
|
+
}).filter((e) => e !== null).join("; "), ot = !1, st = () => {
|
|
477
|
+
ot ||= (Oe.addHook("uponSanitizeAttribute", (e, t) => {
|
|
478
|
+
if (t.attrName === "href" && /^data:/i.test(t.attrValue)) {
|
|
479
|
+
t.keepAttr = !1;
|
|
480
|
+
return;
|
|
481
|
+
}
|
|
482
|
+
t.attrName === "style" && (t.attrValue = at(t.attrValue, e.nodeName.toLowerCase()), t.attrValue || (t.keepAttr = !1));
|
|
483
|
+
}), !0);
|
|
484
|
+
}, Y = (e) => e ? (st(), Oe.sanitize(e, {
|
|
485
|
+
ALLOWED_TAGS: Qe,
|
|
486
|
+
ALLOWED_ATTR: $e,
|
|
487
|
+
ALLOW_DATA_ATTR: !1,
|
|
488
|
+
ADD_ATTR: ["data-language", "data-id"],
|
|
489
|
+
ALLOWED_URI_REGEXP: tt
|
|
490
|
+
})) : "", ct = "\n:host {\n all: initial;\n display: block;\n width: 100%;\n}\n.root {\n color: #030303;\n font-family: -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Helvetica Neue', sans-serif;\n font-size: 15px;\n line-height: 1.6;\n word-break: break-word;\n}\n.root p {\n margin: 0;\n}\n.root .editor-text-bold {\n font-weight: 700;\n}\n.root .editor-text-italic {\n font-style: italic;\n}\n.root .editor-text-underline {\n text-decoration: underline;\n}\n.root .editor-text-strikethrough {\n text-decoration: line-through;\n}\n.root .editor-text-underline-strikethrough {\n text-decoration: underline line-through;\n}\n.root .editor-heading-h1,\n.root .editor-heading-h2,\n.root .editor-heading-h3 {\n margin: 0.6em 0 0.4em;\n font-weight: 600;\n line-height: 1.35;\n}\n.root .editor-heading-h1 {\n font-size: 2em;\n}\n.root .editor-heading-h2 {\n font-size: 1.5em;\n}\n.root .editor-heading-h3 {\n font-size: 1.25em;\n}\n.root .editor-list-ul,\n.root .editor-list-ol {\n margin: 0;\n padding-inline-start: 24px;\n list-style-position: outside;\n}\n.root .editor-list-ul {\n list-style-type: disc;\n}\n.root .editor-list-ol {\n list-style-type: decimal;\n}\n.root .editor-listitem {\n margin: 0;\n list-style: inherit;\n}\n.root .editor-nested-listitem {\n list-style-type: none;\n}\n.root .editor-list-ul .editor-list-ul {\n list-style-type: circle;\n}\n.root .editor-list-ul .editor-list-ul .editor-list-ul {\n list-style-type: square;\n}\n.root .editor-link,\n.root .editor-link:link,\n.root .editor-link:visited,\n.root .editor-link:hover,\n.root .editor-link:active,\n.root .editor-link:focus {\n color: #0269ff;\n cursor: pointer;\n}\n.root .editor-link * {\n color: #0269ff !important;\n}\n.root img {\n max-width: 100%;\n height: auto;\n vertical-align: baseline;\n}\n", lt = ({ html: e }) => {
|
|
491
|
+
let t = u(null);
|
|
492
|
+
return l(() => {
|
|
493
|
+
let n = t.current;
|
|
494
|
+
if (!n) return;
|
|
495
|
+
let r = n.shadowRoot ?? n.attachShadow({ mode: "open" });
|
|
496
|
+
r.innerHTML = `<style>${ct}</style><div class="root">${Y(e)}</div>`;
|
|
497
|
+
}, [e]), /* @__PURE__ */ p("div", { ref: t });
|
|
498
|
+
}, ut = () => {
|
|
499
|
+
let e = `${c().replace(/:/g, "")}g`;
|
|
500
|
+
return /* @__PURE__ */ p("span", {
|
|
501
|
+
className: H["bsy-mobile-editor__ai-think-icon"],
|
|
502
|
+
"aria-hidden": "true",
|
|
503
|
+
children: /* @__PURE__ */ m("svg", {
|
|
504
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
505
|
+
width: "16",
|
|
506
|
+
height: "16",
|
|
507
|
+
viewBox: "0 0 16 16",
|
|
508
|
+
fill: "none",
|
|
509
|
+
children: [/* @__PURE__ */ p("path", {
|
|
510
|
+
d: "M6.33965 13.3C6.27366 13.4143 6.23082 13.5404 6.21357 13.6712C6.19633 13.802 6.20502 13.9349 6.23914 14.0624C6.30806 14.3198 6.47641 14.5392 6.70715 14.6725C6.93788 14.8058 7.21211 14.8419 7.46951 14.773C7.59696 14.7389 7.71644 14.68 7.82112 14.5997C7.92581 14.5194 8.01366 14.4193 8.07965 14.305C8.21292 14.0743 8.24907 13.8 8.18015 13.5426C8.11123 13.2852 7.94288 13.0658 7.71215 12.9325C7.48141 12.7992 7.20718 12.7631 6.94978 12.832C6.69239 12.9009 6.47292 13.0693 6.33965 13.3ZM8.97265 1C7.44126 0.999778 5.95165 1.4994 4.73011 2.42295C3.69009 3.20927 2.89277 4.26631 2.4213 5.47246C2.33326 5.69768 2.00678 5.72579 1.89765 5.51L1.80165 5.356C1.64959 5.15708 1.42869 5.02215 1.18228 4.97769C0.935881 4.93323 0.681756 4.98244 0.469763 5.11567C0.25777 5.24891 0.103209 5.45654 0.0364008 5.69785C-0.0304072 5.93915 -0.00464041 6.19671 0.108646 6.42L1.34765 8.852L1.45565 9.032C1.86065 9.598 2.61765 9.782 3.23665 9.467L5.62665 8.25L5.78165 8.153C5.98057 8.00094 6.11549 7.78004 6.15995 7.53364C6.20442 7.28723 6.1552 7.03311 6.02197 6.82112C5.88874 6.60912 5.68111 6.45456 5.4398 6.38775C5.19849 6.32095 4.94093 6.34671 4.71765 6.46C4.48237 6.579 4.22662 6.36717 4.32655 6.12317C4.56067 5.55153 4.899 5.02613 5.32623 4.57461C5.90933 3.95836 6.63902 3.49984 7.44723 3.24183C8.25544 2.98382 9.11583 2.93472 9.94815 3.09912C10.7805 3.26352 11.5576 3.63606 12.207 4.18198C12.8564 4.7279 13.357 5.42942 13.662 6.22109C13.967 7.01276 14.0665 7.86879 13.9512 8.70932C13.836 9.54985 13.5097 10.3475 13.0028 11.0278C12.496 11.7082 11.8251 12.249 11.0526 12.6C10.9326 12.654 10.7796 12.71 10.5976 12.766C10.3241 12.8507 10.0934 13.0371 9.95295 13.2867C9.81252 13.5363 9.77305 13.8302 9.84265 14.108C9.90673 14.3421 10.0611 14.5412 10.2718 14.6615C10.4826 14.7819 10.7325 14.8137 10.9666 14.75C11.2736 14.666 11.5226 14.584 11.7136 14.503C13.2066 13.8705 14.435 12.7413 15.1908 11.3067C15.9466 9.87221 16.1832 8.22052 15.8607 6.63149C15.5381 5.04246 14.6762 3.61377 13.4209 2.58747C12.1656 1.56117 10.5941 1.00034 8.97265 1ZM4.16665 10.876C3.90024 10.876 3.64474 10.9818 3.45636 11.1702C3.26798 11.3586 3.16215 11.6141 3.16215 11.8805C3.16215 12.1469 3.26798 12.4024 3.45636 12.5908C3.64474 12.7792 3.90024 12.885 4.16665 12.885C4.43306 12.885 4.68855 12.7792 4.87694 12.5908C5.06532 12.4024 5.17115 12.1469 5.17115 11.8805C5.17115 11.6141 5.06532 11.3586 4.87694 11.1702C4.68855 10.9818 4.43306 10.876 4.16665 10.876Z",
|
|
511
|
+
fill: `url(#${e})`
|
|
512
|
+
}), /* @__PURE__ */ p("defs", { children: /* @__PURE__ */ m("linearGradient", {
|
|
513
|
+
id: e,
|
|
514
|
+
x1: "8.00059",
|
|
515
|
+
y1: "1",
|
|
516
|
+
x2: "8.00059",
|
|
517
|
+
y2: "14.8072",
|
|
518
|
+
gradientUnits: "userSpaceOnUse",
|
|
519
|
+
children: [
|
|
520
|
+
/* @__PURE__ */ p("stop", { stopColor: "#0265FF" }),
|
|
521
|
+
/* @__PURE__ */ p("stop", {
|
|
522
|
+
offset: "1",
|
|
523
|
+
stopColor: "#A6FFFF"
|
|
524
|
+
}),
|
|
525
|
+
/* @__PURE__ */ p("animateTransform", {
|
|
526
|
+
attributeName: "gradientTransform",
|
|
527
|
+
type: "rotate",
|
|
528
|
+
from: "0 8 8",
|
|
529
|
+
to: "360 8 8",
|
|
530
|
+
dur: "1.8s",
|
|
531
|
+
repeatCount: "indefinite"
|
|
532
|
+
})
|
|
533
|
+
]
|
|
534
|
+
}) })]
|
|
535
|
+
})
|
|
536
|
+
});
|
|
537
|
+
}, dt = (e, t, n) => {
|
|
538
|
+
let { t: i } = r(), o = e.status === "loading" && !t, [c, l] = d(!0), [f, p] = d(0), m = u(Date.now()), g = u(null), _ = u(!1), v = u(!1), y = e.reasoning ?? "", b = a(() => n.current ?? void 0, [n]);
|
|
539
|
+
return s(() => {
|
|
540
|
+
if (!o) {
|
|
541
|
+
g.current === null && (g.current = Math.max(1, Math.round((Date.now() - m.current) / 1e3)), p(g.current)), l(!1);
|
|
542
|
+
return;
|
|
543
|
+
}
|
|
544
|
+
m.current = Date.now(), g.current = null, l(!0), _.current = !1, v.current = !1;
|
|
545
|
+
let e = window.setInterval(() => {
|
|
546
|
+
p(Math.max(1, Math.round((Date.now() - m.current) / 1e3)));
|
|
547
|
+
}, 500);
|
|
548
|
+
return () => window.clearInterval(e);
|
|
549
|
+
}, [o]), h("pointerdown", () => {
|
|
550
|
+
v.current = !0;
|
|
551
|
+
}, {
|
|
552
|
+
target: b,
|
|
553
|
+
passive: !0,
|
|
554
|
+
enable: o
|
|
555
|
+
}), h("scroll", () => {
|
|
556
|
+
let e = n.current;
|
|
557
|
+
!e || !v.current || (v.current = !1, e.scrollHeight - e.scrollTop - e.clientHeight > 8 && (_.current = !0));
|
|
558
|
+
}, {
|
|
559
|
+
target: b,
|
|
560
|
+
passive: !0,
|
|
561
|
+
enable: o
|
|
562
|
+
}), s(() => {
|
|
563
|
+
if (!o || _.current || !n.current) return;
|
|
564
|
+
let e = window.requestAnimationFrame(() => {
|
|
565
|
+
if (_.current) return;
|
|
566
|
+
let e = n.current;
|
|
567
|
+
e && e.scrollHeight - e.scrollTop - e.clientHeight > 1 && (e.scrollTop = e.scrollHeight);
|
|
568
|
+
});
|
|
569
|
+
return () => window.cancelAnimationFrame(e);
|
|
570
|
+
}, [
|
|
571
|
+
y,
|
|
572
|
+
n,
|
|
573
|
+
o
|
|
574
|
+
]), {
|
|
575
|
+
visible: (o || !!y) && !(e.status === "error" && !y),
|
|
576
|
+
thinking: o,
|
|
577
|
+
open: o || c,
|
|
578
|
+
label: o ? i("editor.aiThinking") : i("editor.aiThoughtSeconds", { seconds: f }),
|
|
579
|
+
reasoning: y,
|
|
580
|
+
toggle: () => l((e) => !e)
|
|
581
|
+
};
|
|
582
|
+
}, ft = ({ model: e }) => /* @__PURE__ */ m("button", {
|
|
583
|
+
type: "button",
|
|
584
|
+
className: H["bsy-mobile-editor__ai-think-head"],
|
|
585
|
+
disabled: e.thinking,
|
|
586
|
+
onClick: e.toggle,
|
|
587
|
+
children: [e.thinking ? /* @__PURE__ */ p(ut, {}) : /* @__PURE__ */ p(n, {
|
|
588
|
+
name: "arrow-down",
|
|
589
|
+
size: 12,
|
|
590
|
+
className: [H["bsy-mobile-editor__ai-think-arrow"], e.open ? H["bsy-mobile-editor__ai-think-arrow--open"] : ""].filter(Boolean).join(" ")
|
|
591
|
+
}), /* @__PURE__ */ p("span", {
|
|
592
|
+
className: e.thinking ? `${H["bsy-mobile-editor__ai-think-label"]} ${H["bsy-mobile-editor__ai-think-label--shimmer"]}` : H["bsy-mobile-editor__ai-think-label"],
|
|
593
|
+
children: e.label
|
|
594
|
+
})]
|
|
595
|
+
}), pt = ({ model: e }) => !e.visible || !e.open || !e.reasoning ? null : /* @__PURE__ */ p("div", {
|
|
596
|
+
className: H["bsy-mobile-editor__ai-think-body"],
|
|
597
|
+
children: e.reasoning
|
|
598
|
+
}), mt = [
|
|
599
|
+
"color",
|
|
600
|
+
"background-color",
|
|
601
|
+
"font-size",
|
|
602
|
+
"font-family",
|
|
603
|
+
"font-weight",
|
|
604
|
+
"text-decoration"
|
|
605
|
+
], ht = (e) => {
|
|
606
|
+
let t = e.body.querySelectorAll("p, h1, h2, h3, h4, h5, h6, li, td, th");
|
|
607
|
+
for (let n of Array.from(t)) {
|
|
608
|
+
let t = n, r = [];
|
|
609
|
+
for (let e of mt) {
|
|
610
|
+
let n = t.style.getPropertyValue(e);
|
|
611
|
+
n && (r.push(`${e}: ${n}`), t.style.removeProperty(e));
|
|
612
|
+
}
|
|
613
|
+
if (!r.length) continue;
|
|
614
|
+
let i = r.join("; ");
|
|
615
|
+
for (let n of Array.from(t.childNodes)) {
|
|
616
|
+
if (n.nodeType === Node.TEXT_NODE && n.textContent) {
|
|
617
|
+
let r = e.createElement("span");
|
|
618
|
+
r.setAttribute("style", i), t.insertBefore(r, n), r.appendChild(n);
|
|
619
|
+
continue;
|
|
620
|
+
}
|
|
621
|
+
if (n.nodeType === Node.ELEMENT_NODE) {
|
|
622
|
+
let e = n, t = e.getAttribute("style");
|
|
623
|
+
e.setAttribute("style", t ? `${t}; ${i}` : i);
|
|
624
|
+
}
|
|
625
|
+
}
|
|
626
|
+
}
|
|
627
|
+
}, gt = (e, t) => {
|
|
628
|
+
let n = A();
|
|
629
|
+
if (n.clear(), t.trim()) {
|
|
630
|
+
let r = new DOMParser().parseFromString(t, "text/html");
|
|
631
|
+
ht(r);
|
|
632
|
+
let i = R(e, r);
|
|
633
|
+
if (i.length) {
|
|
634
|
+
n.select(), oe(i);
|
|
635
|
+
return;
|
|
636
|
+
}
|
|
637
|
+
}
|
|
638
|
+
let r = k();
|
|
639
|
+
n.append(r), r.select();
|
|
640
|
+
}, _t = (e, t) => !t.trim() && (e === "<p><br></p>" || e === "<p></p>" || e === "" || /^<p>\s*<br>\s*<\/p>$/.test(e)), X = {
|
|
641
|
+
margin: "0.6em 0 0.4em",
|
|
642
|
+
"font-weight": "600",
|
|
643
|
+
"line-height": "1.35"
|
|
644
|
+
}, vt = {
|
|
645
|
+
h1: {
|
|
646
|
+
...X,
|
|
647
|
+
"font-size": "2em"
|
|
648
|
+
},
|
|
649
|
+
h2: {
|
|
650
|
+
...X,
|
|
651
|
+
"font-size": "1.5em"
|
|
652
|
+
},
|
|
653
|
+
h3: {
|
|
654
|
+
...X,
|
|
655
|
+
"font-size": "1.25em"
|
|
656
|
+
},
|
|
657
|
+
h4: {
|
|
658
|
+
...X,
|
|
659
|
+
"font-size": "1.125em"
|
|
660
|
+
},
|
|
661
|
+
h5: {
|
|
662
|
+
...X,
|
|
663
|
+
"font-size": "1em"
|
|
664
|
+
},
|
|
665
|
+
h6: {
|
|
666
|
+
...X,
|
|
667
|
+
"font-size": "0.875em"
|
|
668
|
+
}
|
|
669
|
+
}, yt = {
|
|
670
|
+
color: "#0269ff",
|
|
671
|
+
cursor: "pointer"
|
|
672
|
+
}, bt = {
|
|
673
|
+
margin: "0",
|
|
674
|
+
"padding-inline-start": "24px",
|
|
675
|
+
"list-style-position": "outside"
|
|
676
|
+
}, xt = [
|
|
677
|
+
"disc",
|
|
678
|
+
"circle",
|
|
679
|
+
"square"
|
|
680
|
+
], St = {
|
|
681
|
+
margin: "0",
|
|
682
|
+
"list-style": "inherit"
|
|
683
|
+
}, Ct = {
|
|
684
|
+
margin: "0",
|
|
685
|
+
"list-style-type": "none"
|
|
686
|
+
}, wt = {
|
|
687
|
+
display: "block",
|
|
688
|
+
"box-sizing": "border-box",
|
|
689
|
+
"max-width": "100%",
|
|
690
|
+
margin: "8px 0",
|
|
691
|
+
padding: "8px 12px",
|
|
692
|
+
"overflow-x": "auto",
|
|
693
|
+
"font-family": "Menlo, Consolas, Monaco, monospace",
|
|
694
|
+
"font-size": "13px",
|
|
695
|
+
"line-height": "1.53",
|
|
696
|
+
"white-space": "pre",
|
|
697
|
+
"tab-size": "2",
|
|
698
|
+
"border-radius": "4px",
|
|
699
|
+
"background-color": "rgb(240, 242, 245)",
|
|
700
|
+
color: "#1f2328"
|
|
701
|
+
}, Tt = {
|
|
702
|
+
"border-collapse": "collapse",
|
|
703
|
+
"table-layout": "fixed",
|
|
704
|
+
width: "100%",
|
|
705
|
+
"overflow-x": "auto",
|
|
706
|
+
margin: "8px 0"
|
|
707
|
+
}, Et = {
|
|
708
|
+
"box-sizing": "border-box",
|
|
709
|
+
"min-width": "75px",
|
|
710
|
+
"min-height": "32px",
|
|
711
|
+
padding: "4px 8px",
|
|
712
|
+
border: "1px solid #d9d9d9",
|
|
713
|
+
"vertical-align": "top"
|
|
714
|
+
}, Dt = {
|
|
715
|
+
"font-weight": "600",
|
|
716
|
+
"background-color": "#f2f3f5"
|
|
717
|
+
}, Z = (e, t) => {
|
|
718
|
+
for (let [n, r] of Object.entries(t)) e.style.getPropertyValue(n) || e.style.setProperty(n, r);
|
|
719
|
+
}, Ot = (e) => {
|
|
720
|
+
let t = 0, n = e;
|
|
721
|
+
for (; n;) n.tagName === "UL" && (t += 1), n = n.parentElement;
|
|
722
|
+
return t;
|
|
723
|
+
}, kt = (e) => {
|
|
724
|
+
for (let t of Array.from(e.querySelectorAll("*"))) {
|
|
725
|
+
if (!(t instanceof HTMLElement)) continue;
|
|
726
|
+
let e = t.tagName.toLowerCase(), n = vt[e];
|
|
727
|
+
if (n && Z(t, n), e === "a" && Z(t, yt), e === "ul") {
|
|
728
|
+
let e = Math.min(Math.max(Ot(t), 1), xt.length);
|
|
729
|
+
Z(t, {
|
|
730
|
+
...bt,
|
|
731
|
+
"list-style-type": xt[e - 1]
|
|
732
|
+
});
|
|
733
|
+
}
|
|
734
|
+
e === "ol" && Z(t, {
|
|
735
|
+
...bt,
|
|
736
|
+
"list-style-type": "decimal"
|
|
737
|
+
}), e === "li" && Z(t, t.classList.contains("editor-nested-listitem") ? Ct : St), e === "pre" && Z(t, wt), e === "table" && Z(t, Tt), (e === "td" || e === "th") && (Z(t, Et), (e === "th" || t.classList.contains("editor-table-cell-header")) && Z(t, Dt)), t.classList.contains("editor-text-underline-strikethrough") ? Z(t, { "text-decoration": "underline line-through" }) : t.classList.contains("editor-text-underline") ? Z(t, { "text-decoration": "underline" }) : t.classList.contains("editor-text-strikethrough") && Z(t, { "text-decoration": "line-through" });
|
|
738
|
+
for (let e of Array.from(t.classList)) e.startsWith("editor-") && t.classList.remove(e);
|
|
739
|
+
t.classList.length === 0 && t.removeAttribute("class");
|
|
740
|
+
}
|
|
741
|
+
}, At = (e) => {
|
|
742
|
+
let t = e.parentNode;
|
|
743
|
+
if (t) {
|
|
744
|
+
for (; e.firstChild;) t.insertBefore(e.firstChild, e);
|
|
745
|
+
t.removeChild(e);
|
|
746
|
+
}
|
|
747
|
+
}, jt = (e) => {
|
|
748
|
+
let t = !0;
|
|
749
|
+
for (; t;) {
|
|
750
|
+
t = !1;
|
|
751
|
+
for (let n of Array.from(e.querySelectorAll("span, b, i"))) {
|
|
752
|
+
if (n.attributes.length > 0) continue;
|
|
753
|
+
let e = n.tagName.toLowerCase();
|
|
754
|
+
if (e === "span") {
|
|
755
|
+
At(n), t = !0;
|
|
756
|
+
continue;
|
|
757
|
+
}
|
|
758
|
+
if (n.childElementCount !== 1 || n.childNodes.length !== 1) continue;
|
|
759
|
+
let r = n.firstElementChild;
|
|
760
|
+
(e === "b" && r?.tagName === "STRONG" || e === "i" && r?.tagName === "EM") && (At(n), t = !0);
|
|
761
|
+
}
|
|
762
|
+
}
|
|
763
|
+
}, Mt = (e) => {
|
|
764
|
+
if (!e.trim()) return e;
|
|
765
|
+
let t = new DOMParser().parseFromString(e, "text/html");
|
|
766
|
+
kt(t.body), jt(t.body);
|
|
767
|
+
for (let e of Array.from(t.body.querySelectorAll("pre"))) e.textContent?.trim() || e.remove();
|
|
768
|
+
return t.body.innerHTML;
|
|
769
|
+
}, Nt = "<!--bsy-block-->", Pt = "bsy-html-root", Ft = (e) => new DOMParser().parseFromString(`<${Pt}>${e}</${Pt}>`, "text/html").body.querySelector(Pt), It = (e) => e ? new DOMParser().parseFromString(e, "text/html").body.textContent ?? "" : "", Lt = (e) => e.includes("<!--bsy-block-->") ? e.split(Nt).map((e) => e.trim()) : [e], Rt = (e) => e.split(Nt).join("").trim().length > 0, zt = (e, t) => {
|
|
770
|
+
let n = e.map(() => "");
|
|
771
|
+
if (e.length === 0) return n;
|
|
772
|
+
let r = [], i = [];
|
|
773
|
+
if (e.forEach((e, t) => {
|
|
774
|
+
for (let n of Array.from(e)) i.push(n), r.push(t);
|
|
775
|
+
}), i.length === 0) return n[0] = t, n;
|
|
776
|
+
let a = i, o = Array.from(t), s = a.length, c = o.length, l = Array.from({ length: s + 1 }, () => Array(c + 1).fill(0));
|
|
777
|
+
for (let e = s - 1; e >= 0; e--) for (let t = c - 1; t >= 0; t--) l[e][t] = a[e] === o[t] ? l[e + 1][t + 1] + 1 : Math.max(l[e + 1][t], l[e][t + 1]);
|
|
778
|
+
let u = 0, d = 0, f = r[0];
|
|
779
|
+
for (; u < s && d < c;) a[u] === o[d] ? (f = r[u], n[f] += o[d], u += 1, d += 1) : l[u + 1][d] >= l[u][d + 1] ? (f = r[u], u += 1) : (n[f] += o[d], d += 1);
|
|
780
|
+
for (; d < c;) n[n.length - 1] += o[d], d += 1;
|
|
781
|
+
return n;
|
|
782
|
+
}, Bt = new Set([
|
|
783
|
+
"TABLE",
|
|
784
|
+
"THEAD",
|
|
785
|
+
"TBODY",
|
|
786
|
+
"TR",
|
|
787
|
+
"TD",
|
|
788
|
+
"TH",
|
|
789
|
+
"IMG",
|
|
790
|
+
"BR"
|
|
791
|
+
]), Vt = (e) => {
|
|
792
|
+
let t = [], n = (e) => {
|
|
793
|
+
if (e.nodeType === Node.ELEMENT_NODE) {
|
|
794
|
+
if (e.tagName === "PRE") return;
|
|
795
|
+
for (let t of Array.from(e.childNodes)) n(t);
|
|
796
|
+
return;
|
|
797
|
+
}
|
|
798
|
+
e.nodeType === Node.TEXT_NODE && t.push(e);
|
|
799
|
+
};
|
|
800
|
+
return n(e), t;
|
|
801
|
+
}, Ht = (e, t) => {
|
|
802
|
+
let n = e;
|
|
803
|
+
for (; n && n !== t && !Bt.has(n.tagName) && !(n.textContent ?? "").trim() && !n.querySelector("img, table, br");) {
|
|
804
|
+
let e = n.parentElement;
|
|
805
|
+
n.remove(), n = e;
|
|
806
|
+
}
|
|
807
|
+
}, Ut = (e) => {
|
|
808
|
+
let t = e.tagName;
|
|
809
|
+
return t === "IMG" || t === "TABLE" || t === "PRE";
|
|
810
|
+
}, Wt = (e) => {
|
|
811
|
+
let t = Ft(e);
|
|
812
|
+
return t ? Array.from(t.children).filter((e) => !Ut(e)).map((e) => e.textContent ?? "") : [];
|
|
813
|
+
}, Gt = (e) => e.includes("<!--bsy-block-->") ? e : It(e) || e, Kt = (e, t) => {
|
|
814
|
+
let n = Vt(e);
|
|
815
|
+
if (n.length === 0) {
|
|
816
|
+
t && (e.querySelector("br")?.remove(), e.append(e.ownerDocument.createTextNode(t)));
|
|
817
|
+
return;
|
|
818
|
+
}
|
|
819
|
+
let r = zt(n.map((e) => e.textContent ?? ""), t);
|
|
820
|
+
for (let t = 0; t < n.length; t++) {
|
|
821
|
+
let i = r[t], a = n[t];
|
|
822
|
+
if (i) {
|
|
823
|
+
a.textContent = i;
|
|
824
|
+
continue;
|
|
825
|
+
}
|
|
826
|
+
let o = a.parentElement;
|
|
827
|
+
a.remove(), Ht(o, e);
|
|
828
|
+
}
|
|
829
|
+
}, qt = (e, t) => {
|
|
830
|
+
let n = Gt(t);
|
|
831
|
+
if (!Rt(n) || !e.trim()) return "";
|
|
832
|
+
let r = Ft(e);
|
|
833
|
+
if (!r) return "";
|
|
834
|
+
let i = Array.from(r.children).filter((e) => !Ut(e));
|
|
835
|
+
if (i.length === 0) return "";
|
|
836
|
+
let a = Lt(n), o = a.length === i.length ? a : zt(i.map((e) => e.textContent ?? ""), a.join(""));
|
|
837
|
+
for (let e = 0; e < i.length; e++) Kt(i[e], o[e] ?? "");
|
|
838
|
+
return r.innerHTML;
|
|
839
|
+
}, Jt = (e, t) => {
|
|
840
|
+
let n = "";
|
|
841
|
+
e.getEditorState().read(() => {
|
|
842
|
+
n = Mt(Y(_e(e, null)));
|
|
843
|
+
}, { editor: e });
|
|
844
|
+
let r = Y(qt(n, t));
|
|
845
|
+
return !r.trim() || _t(r, It(r)) ? !1 : (e.update(() => {
|
|
846
|
+
gt(e, r);
|
|
847
|
+
}, { discrete: !0 }), !0);
|
|
848
|
+
}, Yt = /^\uFEFF/, Xt = /^ {0,3}`{1,3}[A-Za-z]*$/, Zt = /^( {0,3})([^`<]*?)```[ \t]*([A-Za-z0-9_-]*)[ \t]*(.*)$/, Qt = /^ {0,3}```[ \t]*$/, $t = /<\/?[a-zA-Z]/, en = /<[a-zA-Z!]/, tn = (e) => en.test(e), nn = (e) => $t.test(e), rn = (e) => e.replace(Yt, "").replace(/\r\n/g, "\n"), an = (e) => {
|
|
849
|
+
let t = e.replace(/\n+$/, ""), n = t.lastIndexOf("\n"), r = n === -1 ? t : t.slice(n + 1);
|
|
850
|
+
return Xt.test(r) ? {
|
|
851
|
+
text: n === -1 ? "" : t.slice(0, n),
|
|
852
|
+
withheld: !0
|
|
853
|
+
} : {
|
|
854
|
+
text: e,
|
|
855
|
+
withheld: !1
|
|
856
|
+
};
|
|
857
|
+
}, on = (e) => {
|
|
858
|
+
let t = Zt.exec(e);
|
|
859
|
+
return t ? { sameLineBody: t[4] ?? "" } : null;
|
|
860
|
+
}, sn = (e) => {
|
|
861
|
+
let t = e.replace(/[ \t]*```[ \t]*$/, "");
|
|
862
|
+
return t === e ? e : t;
|
|
863
|
+
}, cn = (e) => tn(e) ? e.replace(/^\n/, "") : "", ln = (e) => {
|
|
864
|
+
let t = e.split("\n"), n = [], r = 0;
|
|
865
|
+
for (; r < t.length;) {
|
|
866
|
+
let e = t[r], i = on(e);
|
|
867
|
+
if (i) {
|
|
868
|
+
let e = i.sameLineBody;
|
|
869
|
+
if (e !== sn(e)) {
|
|
870
|
+
e = sn(e);
|
|
871
|
+
let i = cn(t.slice(r + 1).join("\n"));
|
|
872
|
+
return [
|
|
873
|
+
...n,
|
|
874
|
+
e,
|
|
875
|
+
i
|
|
876
|
+
].filter(Boolean).join("\n");
|
|
877
|
+
}
|
|
878
|
+
let a = [];
|
|
879
|
+
for (e && a.push(e), r += 1; r < t.length && !Qt.test(t[r]);) a.push(t[r]), r += 1;
|
|
880
|
+
let o = r < t.length ? cn(t.slice(r + 1).join("\n")) : "";
|
|
881
|
+
return [
|
|
882
|
+
...n,
|
|
883
|
+
a.join("\n"),
|
|
884
|
+
o
|
|
885
|
+
].filter(Boolean).join("\n");
|
|
886
|
+
}
|
|
887
|
+
if (nn(e)) return un([...n, ...t.slice(r)].join("\n"));
|
|
888
|
+
tn(e) && n.push(e), r += 1;
|
|
889
|
+
}
|
|
890
|
+
return n.length ? n.join("\n") : null;
|
|
891
|
+
}, un = (e) => {
|
|
892
|
+
let t = e.split("\n");
|
|
893
|
+
if (!t.length) return e;
|
|
894
|
+
let n = on(t[0]);
|
|
895
|
+
return n && !nn(t[0].slice(0, t[0].indexOf("```"))) && (t.shift(), n.sameLineBody && t.unshift(sn(n.sameLineBody))), t.length && Qt.test(t[t.length - 1] ?? "") && t.pop(), t.join("\n");
|
|
896
|
+
}, dn = (e) => {
|
|
897
|
+
if (!e) return {
|
|
898
|
+
html: "",
|
|
899
|
+
pending: !1
|
|
900
|
+
};
|
|
901
|
+
let { text: t, withheld: n } = an(rn(e));
|
|
902
|
+
if (!t.trim()) return {
|
|
903
|
+
html: "",
|
|
904
|
+
pending: n || Xt.test(rn(e).trim())
|
|
905
|
+
};
|
|
906
|
+
let r = ln(t) ?? t, i = ln(r);
|
|
907
|
+
i !== null && i !== r && (r = i);
|
|
908
|
+
let a = r.trim();
|
|
909
|
+
return tn(a) ? {
|
|
910
|
+
html: a,
|
|
911
|
+
pending: !1
|
|
912
|
+
} : {
|
|
913
|
+
html: "",
|
|
914
|
+
pending: !0
|
|
915
|
+
};
|
|
916
|
+
}, fn = (e, t) => {
|
|
917
|
+
e.update(() => {
|
|
918
|
+
De(j(), () => t === "paragraph" ? k() : ne(t));
|
|
919
|
+
});
|
|
920
|
+
}, pn = (e, t) => {
|
|
921
|
+
e.update(() => {
|
|
922
|
+
let e = j();
|
|
923
|
+
e && V(e, t);
|
|
924
|
+
});
|
|
925
|
+
}, mn = ({ sheet: e, onClose: i, onTypeset: a, onPolishMenu: o, onPickPreset: s, onPicture: c, canTypeset: l, canPolish: u }) => {
|
|
926
|
+
let [d] = z(), { t: h } = r();
|
|
927
|
+
return /* @__PURE__ */ m(f, { children: [
|
|
928
|
+
/* @__PURE__ */ p(t, {
|
|
929
|
+
mode: "menu",
|
|
930
|
+
open: e === "align",
|
|
931
|
+
title: h("editor.alignment"),
|
|
932
|
+
onClose: i,
|
|
933
|
+
actions: [
|
|
934
|
+
{
|
|
935
|
+
key: "left",
|
|
936
|
+
text: h("editor.leftAlign"),
|
|
937
|
+
icon: /* @__PURE__ */ p(n, {
|
|
938
|
+
name: "paragraph",
|
|
939
|
+
size: 16
|
|
940
|
+
})
|
|
941
|
+
},
|
|
942
|
+
{
|
|
943
|
+
key: "center",
|
|
944
|
+
text: h("editor.centerAlign"),
|
|
945
|
+
icon: /* @__PURE__ */ p(n, {
|
|
946
|
+
name: "paragraphmiddle",
|
|
947
|
+
size: 16
|
|
948
|
+
})
|
|
949
|
+
},
|
|
950
|
+
{
|
|
951
|
+
key: "right",
|
|
952
|
+
text: h("editor.rightAlign"),
|
|
953
|
+
icon: /* @__PURE__ */ p(n, {
|
|
954
|
+
name: "paragraphright",
|
|
955
|
+
size: 16
|
|
956
|
+
})
|
|
957
|
+
}
|
|
958
|
+
],
|
|
959
|
+
onAction: (e) => d.dispatchCommand(P, e.key)
|
|
960
|
+
}),
|
|
961
|
+
/* @__PURE__ */ p(t, {
|
|
962
|
+
mode: "menu",
|
|
963
|
+
open: e === "heading",
|
|
964
|
+
title: h("editor.heading"),
|
|
965
|
+
onClose: i,
|
|
966
|
+
actions: [
|
|
967
|
+
{
|
|
968
|
+
key: "paragraph",
|
|
969
|
+
text: h("editor.paragraph")
|
|
970
|
+
},
|
|
971
|
+
{
|
|
972
|
+
key: "h1",
|
|
973
|
+
text: h("editor.heading1")
|
|
974
|
+
},
|
|
975
|
+
{
|
|
976
|
+
key: "h2",
|
|
977
|
+
text: h("editor.heading2")
|
|
978
|
+
},
|
|
979
|
+
{
|
|
980
|
+
key: "h3",
|
|
981
|
+
text: h("editor.heading3")
|
|
982
|
+
}
|
|
983
|
+
],
|
|
984
|
+
onAction: (e) => fn(d, e.key)
|
|
985
|
+
}),
|
|
986
|
+
/* @__PURE__ */ p(t, {
|
|
987
|
+
mode: "menu",
|
|
988
|
+
open: e === "fontSize",
|
|
989
|
+
title: h("editor.fontSize"),
|
|
990
|
+
onClose: i,
|
|
991
|
+
actions: ke.map((e) => ({
|
|
992
|
+
key: e.value,
|
|
993
|
+
text: e.label
|
|
994
|
+
})),
|
|
995
|
+
onAction: (e) => pn(d, { "font-size": e.key })
|
|
996
|
+
}),
|
|
997
|
+
/* @__PURE__ */ p(t, {
|
|
998
|
+
open: e === "fontColor" || e === "fill",
|
|
999
|
+
title: h(e === "fill" ? "editor.fill" : "editor.fontColor"),
|
|
1000
|
+
onClose: i,
|
|
1001
|
+
children: /* @__PURE__ */ m("div", {
|
|
1002
|
+
className: H["bsy-mobile-editor__swatches"],
|
|
1003
|
+
children: [e === "fill" ? /* @__PURE__ */ p("button", {
|
|
1004
|
+
type: "button",
|
|
1005
|
+
className: H["bsy-mobile-editor__swatch"],
|
|
1006
|
+
"aria-label": h("editor.fillNone"),
|
|
1007
|
+
onClick: () => {
|
|
1008
|
+
pn(d, { "background-color": "transparent" }), i();
|
|
1009
|
+
}
|
|
1010
|
+
}) : null, je.map((t) => /* @__PURE__ */ p("button", {
|
|
1011
|
+
type: "button",
|
|
1012
|
+
className: H["bsy-mobile-editor__swatch"],
|
|
1013
|
+
style: { background: t },
|
|
1014
|
+
"aria-label": t,
|
|
1015
|
+
onClick: () => {
|
|
1016
|
+
pn(d, { [e === "fill" ? "background-color" : "color"]: t }), i();
|
|
1017
|
+
}
|
|
1018
|
+
}, t))]
|
|
1019
|
+
})
|
|
1020
|
+
}),
|
|
1021
|
+
/* @__PURE__ */ p(t, {
|
|
1022
|
+
mode: "menu",
|
|
1023
|
+
open: e === "ai",
|
|
1024
|
+
onClose: i,
|
|
1025
|
+
actions: [{
|
|
1026
|
+
key: "typeset",
|
|
1027
|
+
text: h("editor.aiTypeset"),
|
|
1028
|
+
disabled: !l,
|
|
1029
|
+
icon: /* @__PURE__ */ p("img", {
|
|
1030
|
+
src: Xe,
|
|
1031
|
+
alt: "",
|
|
1032
|
+
width: 16,
|
|
1033
|
+
height: 16,
|
|
1034
|
+
className: H["bsy-mobile-editor__ai-icon"],
|
|
1035
|
+
draggable: !1
|
|
1036
|
+
})
|
|
1037
|
+
}, {
|
|
1038
|
+
key: "polish",
|
|
1039
|
+
text: h("editor.aiPolish"),
|
|
1040
|
+
disabled: !u,
|
|
1041
|
+
icon: /* @__PURE__ */ p("img", {
|
|
1042
|
+
src: Ze,
|
|
1043
|
+
alt: "",
|
|
1044
|
+
width: 16,
|
|
1045
|
+
height: 16,
|
|
1046
|
+
className: H["bsy-mobile-editor__ai-icon"],
|
|
1047
|
+
draggable: !1
|
|
1048
|
+
})
|
|
1049
|
+
}],
|
|
1050
|
+
onAction: (e) => {
|
|
1051
|
+
if (e.key === "typeset") {
|
|
1052
|
+
a();
|
|
1053
|
+
return;
|
|
1054
|
+
}
|
|
1055
|
+
o();
|
|
1056
|
+
}
|
|
1057
|
+
}),
|
|
1058
|
+
/* @__PURE__ */ p(t, {
|
|
1059
|
+
mode: "menu",
|
|
1060
|
+
open: e === "aiPreset",
|
|
1061
|
+
title: h("editor.aiPolish"),
|
|
1062
|
+
onClose: i,
|
|
1063
|
+
actions: W.map((e) => ({
|
|
1064
|
+
key: e,
|
|
1065
|
+
text: h(G[e])
|
|
1066
|
+
})),
|
|
1067
|
+
onAction: (e) => s(e.key)
|
|
1068
|
+
}),
|
|
1069
|
+
/* @__PURE__ */ p(t, {
|
|
1070
|
+
mode: "menu",
|
|
1071
|
+
open: e === "picture",
|
|
1072
|
+
title: h("editor.picture"),
|
|
1073
|
+
onClose: i,
|
|
1074
|
+
actions: [{
|
|
1075
|
+
key: "upload",
|
|
1076
|
+
text: h("editor.uploadImage"),
|
|
1077
|
+
icon: /* @__PURE__ */ p(n, {
|
|
1078
|
+
name: "picture",
|
|
1079
|
+
size: 16
|
|
1080
|
+
})
|
|
1081
|
+
}, {
|
|
1082
|
+
key: "url",
|
|
1083
|
+
text: h("editor.imageUrl"),
|
|
1084
|
+
icon: /* @__PURE__ */ p(n, {
|
|
1085
|
+
name: "Insertlink",
|
|
1086
|
+
size: 16
|
|
1087
|
+
})
|
|
1088
|
+
}],
|
|
1089
|
+
onAction: (e) => c(e.key)
|
|
1090
|
+
})
|
|
1091
|
+
] });
|
|
1092
|
+
}, hn = ({ open: t, title: i, bodyClassName: a, onClose: o, onConfirm: s, children: c }) => {
|
|
1093
|
+
let { t: l } = r();
|
|
1094
|
+
return /* @__PURE__ */ p(e, {
|
|
1095
|
+
open: t,
|
|
1096
|
+
onClose: o,
|
|
1097
|
+
position: "bottom",
|
|
1098
|
+
children: /* @__PURE__ */ m("div", {
|
|
1099
|
+
className: H["bsy-mobile-editor__sheet"],
|
|
1100
|
+
children: [
|
|
1101
|
+
/* @__PURE__ */ m("div", {
|
|
1102
|
+
className: H["bsy-mobile-editor__header"],
|
|
1103
|
+
children: [/* @__PURE__ */ p("div", {
|
|
1104
|
+
className: H["bsy-mobile-editor__title"],
|
|
1105
|
+
children: i
|
|
1106
|
+
}), /* @__PURE__ */ p("button", {
|
|
1107
|
+
type: "button",
|
|
1108
|
+
className: H["bsy-mobile-editor__close"],
|
|
1109
|
+
"aria-label": l("popup.close"),
|
|
1110
|
+
onClick: o,
|
|
1111
|
+
children: /* @__PURE__ */ p(n, {
|
|
1112
|
+
name: "close",
|
|
1113
|
+
size: 18
|
|
1114
|
+
})
|
|
1115
|
+
})]
|
|
1116
|
+
}),
|
|
1117
|
+
/* @__PURE__ */ p("div", {
|
|
1118
|
+
className: [H["bsy-mobile-editor__sheet-body"], a].filter(Boolean).join(" "),
|
|
1119
|
+
children: c
|
|
1120
|
+
}),
|
|
1121
|
+
/* @__PURE__ */ m("div", {
|
|
1122
|
+
className: H["bsy-mobile-editor__sheet-bar"],
|
|
1123
|
+
children: [/* @__PURE__ */ p("button", {
|
|
1124
|
+
type: "button",
|
|
1125
|
+
onClick: o,
|
|
1126
|
+
children: l("editor.cancel")
|
|
1127
|
+
}), /* @__PURE__ */ p("button", {
|
|
1128
|
+
type: "button",
|
|
1129
|
+
className: H["bsy-mobile-editor__sheet-ok"],
|
|
1130
|
+
onClick: s,
|
|
1131
|
+
children: l("editor.ok")
|
|
1132
|
+
})]
|
|
1133
|
+
})
|
|
1134
|
+
]
|
|
1135
|
+
})
|
|
1136
|
+
});
|
|
1137
|
+
}, gn = ({ open: e, seed: t, onClose: i, onConfirm: a }) => {
|
|
1138
|
+
let { t: o } = r(), [c, l] = d(""), [u, f] = d(""), [h, g] = d(!0);
|
|
1139
|
+
return s(() => {
|
|
1140
|
+
!e || !t || (l(t.url), f(t.text), g(t.newBlank));
|
|
1141
|
+
}, [e, t]), /* @__PURE__ */ m(hn, {
|
|
1142
|
+
open: e,
|
|
1143
|
+
title: o("editor.link"),
|
|
1144
|
+
bodyClassName: H["bsy-mobile-editor__sheet-body--stack"],
|
|
1145
|
+
onClose: i,
|
|
1146
|
+
onConfirm: () => a({
|
|
1147
|
+
url: c,
|
|
1148
|
+
text: u,
|
|
1149
|
+
newBlank: h
|
|
1150
|
+
}),
|
|
1151
|
+
children: [
|
|
1152
|
+
/* @__PURE__ */ m("label", {
|
|
1153
|
+
className: H["bsy-mobile-editor__sheet-field"],
|
|
1154
|
+
children: [
|
|
1155
|
+
/* @__PURE__ */ p("span", {
|
|
1156
|
+
className: H["bsy-mobile-editor__sheet-label"],
|
|
1157
|
+
children: o("editor.linkUrl")
|
|
1158
|
+
}),
|
|
1159
|
+
/* @__PURE__ */ p("span", {
|
|
1160
|
+
className: `${H["bsy-mobile-editor__sheet-note"]} ${H["bsy-mobile-editor__sheet-note--hint"]}`,
|
|
1161
|
+
children: o("editor.linkAliasTip")
|
|
1162
|
+
}),
|
|
1163
|
+
/* @__PURE__ */ p("input", {
|
|
1164
|
+
value: c,
|
|
1165
|
+
placeholder: o("editor.linkTip"),
|
|
1166
|
+
onChange: (e) => l(e.target.value)
|
|
1167
|
+
})
|
|
1168
|
+
]
|
|
1169
|
+
}),
|
|
1170
|
+
/* @__PURE__ */ m("label", {
|
|
1171
|
+
className: H["bsy-mobile-editor__sheet-field"],
|
|
1172
|
+
children: [/* @__PURE__ */ p("span", {
|
|
1173
|
+
className: H["bsy-mobile-editor__sheet-label"],
|
|
1174
|
+
children: o("editor.linkText")
|
|
1175
|
+
}), /* @__PURE__ */ p("input", {
|
|
1176
|
+
value: u,
|
|
1177
|
+
onChange: (e) => f(e.target.value)
|
|
1178
|
+
})]
|
|
1179
|
+
}),
|
|
1180
|
+
/* @__PURE__ */ m("label", {
|
|
1181
|
+
className: H["bsy-mobile-editor__check"],
|
|
1182
|
+
children: [
|
|
1183
|
+
/* @__PURE__ */ p("input", {
|
|
1184
|
+
className: H["bsy-mobile-editor__check-input"],
|
|
1185
|
+
type: "checkbox",
|
|
1186
|
+
checked: h,
|
|
1187
|
+
onChange: (e) => g(e.target.checked)
|
|
1188
|
+
}),
|
|
1189
|
+
/* @__PURE__ */ p("span", {
|
|
1190
|
+
className: H["bsy-mobile-editor__check-box"],
|
|
1191
|
+
"aria-hidden": !0,
|
|
1192
|
+
children: h ? /* @__PURE__ */ p(n, {
|
|
1193
|
+
name: "checkthebox",
|
|
1194
|
+
size: 12,
|
|
1195
|
+
color: "#fff"
|
|
1196
|
+
}) : null
|
|
1197
|
+
}),
|
|
1198
|
+
o("editor.linkNewBlank")
|
|
1199
|
+
]
|
|
1200
|
+
})
|
|
1201
|
+
]
|
|
1202
|
+
});
|
|
1203
|
+
}, _n = /^https?:\/\/.+/i, vn = ({ open: e, onClose: t, onConfirm: n }) => {
|
|
1204
|
+
let { t: i } = r(), [a, o] = d(""), [c, l] = d(null);
|
|
1205
|
+
return s(() => {
|
|
1206
|
+
e && (o(""), l(null));
|
|
1207
|
+
}, [e]), /* @__PURE__ */ p(hn, {
|
|
1208
|
+
open: e,
|
|
1209
|
+
title: i("editor.imageUrl"),
|
|
1210
|
+
onClose: t,
|
|
1211
|
+
onConfirm: () => {
|
|
1212
|
+
let e = a.trim();
|
|
1213
|
+
if (!e) {
|
|
1214
|
+
l(i("editor.imageUrlRequired"));
|
|
1215
|
+
return;
|
|
1216
|
+
}
|
|
1217
|
+
if (!_n.test(e)) {
|
|
1218
|
+
l(i("editor.imageUrlInvalid"));
|
|
1219
|
+
return;
|
|
1220
|
+
}
|
|
1221
|
+
n(e);
|
|
1222
|
+
},
|
|
1223
|
+
children: /* @__PURE__ */ m("label", {
|
|
1224
|
+
className: H["bsy-mobile-editor__sheet-field"],
|
|
1225
|
+
children: [
|
|
1226
|
+
/* @__PURE__ */ p("span", {
|
|
1227
|
+
className: H["bsy-mobile-editor__sheet-label"],
|
|
1228
|
+
children: i("editor.enterImageUrl")
|
|
1229
|
+
}),
|
|
1230
|
+
/* @__PURE__ */ p("span", {
|
|
1231
|
+
className: H["bsy-mobile-editor__sheet-note"],
|
|
1232
|
+
children: i("editor.imageUrlNote")
|
|
1233
|
+
}),
|
|
1234
|
+
/* @__PURE__ */ p("input", {
|
|
1235
|
+
value: a,
|
|
1236
|
+
placeholder: i("editor.imageUrlPlaceholder"),
|
|
1237
|
+
"aria-invalid": !!c,
|
|
1238
|
+
onChange: (e) => {
|
|
1239
|
+
o(e.target.value), c && l(null);
|
|
1240
|
+
}
|
|
1241
|
+
}),
|
|
1242
|
+
c ? /* @__PURE__ */ p("span", {
|
|
1243
|
+
className: H["bsy-mobile-editor__sheet-error"],
|
|
1244
|
+
children: c
|
|
1245
|
+
}) : null
|
|
1246
|
+
]
|
|
1247
|
+
})
|
|
1248
|
+
});
|
|
1249
|
+
}, yn = ({ open: i, mode: a, originalHtml: o, ai: s, polishPreset: c, onClose: l, onApply: h, onPickPreset: g }) => {
|
|
1250
|
+
let { t: _ } = r(), v = u(null), [y, b] = d(!1), x = s?.status ?? "idle", S = s?.text ?? "", ee = a === "polish" ? Y(qt(o, S)) : dn(S).html, C = !!ee.trim(), w = dt({
|
|
1251
|
+
status: x,
|
|
1252
|
+
reasoning: s?.reasoning
|
|
1253
|
+
}, C, v), T = x === "ready" && C;
|
|
1254
|
+
return /* @__PURE__ */ m(e, {
|
|
1255
|
+
open: i,
|
|
1256
|
+
onClose: l,
|
|
1257
|
+
position: "bottom",
|
|
1258
|
+
closeOnClickOverlay: !1,
|
|
1259
|
+
children: [/* @__PURE__ */ m("div", {
|
|
1260
|
+
className: H["bsy-mobile-editor__ai"],
|
|
1261
|
+
style: { height: Fe },
|
|
1262
|
+
children: [
|
|
1263
|
+
/* @__PURE__ */ m("div", {
|
|
1264
|
+
className: H["bsy-mobile-editor__header"],
|
|
1265
|
+
children: [/* @__PURE__ */ p("div", {
|
|
1266
|
+
className: H["bsy-mobile-editor__title"],
|
|
1267
|
+
children: _(a === "polish" ? "editor.aiPolish" : "editor.aiTypeset")
|
|
1268
|
+
}), /* @__PURE__ */ p("button", {
|
|
1269
|
+
type: "button",
|
|
1270
|
+
className: H["bsy-mobile-editor__close"],
|
|
1271
|
+
"aria-label": _("popup.close"),
|
|
1272
|
+
onClick: l,
|
|
1273
|
+
children: /* @__PURE__ */ p(n, {
|
|
1274
|
+
name: "close",
|
|
1275
|
+
size: 18
|
|
1276
|
+
})
|
|
1277
|
+
})]
|
|
1278
|
+
}),
|
|
1279
|
+
/* @__PURE__ */ m("div", {
|
|
1280
|
+
className: H["bsy-mobile-editor__ai-body"],
|
|
1281
|
+
children: [
|
|
1282
|
+
/* @__PURE__ */ m("section", {
|
|
1283
|
+
className: H["bsy-mobile-editor__ai-section"],
|
|
1284
|
+
children: [
|
|
1285
|
+
/* @__PURE__ */ m("div", {
|
|
1286
|
+
className: H["bsy-mobile-editor__ai-section-head"],
|
|
1287
|
+
children: [/* @__PURE__ */ m("div", {
|
|
1288
|
+
className: `${H["bsy-mobile-editor__ai-label"]} ${H["bsy-mobile-editor__ai-label--after"]}`,
|
|
1289
|
+
children: [/* @__PURE__ */ p("span", { className: H["bsy-mobile-editor__ai-dot"] }), _("editor.aiOptimized")]
|
|
1290
|
+
}), a === "polish" ? /* @__PURE__ */ m("button", {
|
|
1291
|
+
type: "button",
|
|
1292
|
+
className: H["bsy-mobile-editor__ai-preset"],
|
|
1293
|
+
onClick: () => b(!0),
|
|
1294
|
+
children: [_(G[c]), /* @__PURE__ */ p(n, {
|
|
1295
|
+
name: "arrow-down",
|
|
1296
|
+
size: 16
|
|
1297
|
+
})]
|
|
1298
|
+
}) : null]
|
|
1299
|
+
}),
|
|
1300
|
+
w.visible ? /* @__PURE__ */ p("div", {
|
|
1301
|
+
className: H["bsy-mobile-editor__ai-think-pin"],
|
|
1302
|
+
children: /* @__PURE__ */ p(ft, { model: w })
|
|
1303
|
+
}) : null,
|
|
1304
|
+
/* @__PURE__ */ p("div", {
|
|
1305
|
+
ref: v,
|
|
1306
|
+
className: H["bsy-mobile-editor__ai-section-scroll"],
|
|
1307
|
+
children: x === "error" ? /* @__PURE__ */ p("p", {
|
|
1308
|
+
className: H["bsy-mobile-editor__ai-error"],
|
|
1309
|
+
children: s?.errorMessage || _("editor.aiError")
|
|
1310
|
+
}) : /* @__PURE__ */ m(f, { children: [/* @__PURE__ */ p(pt, { model: w }), C ? /* @__PURE__ */ p(lt, { html: ee }) : null] })
|
|
1311
|
+
})
|
|
1312
|
+
]
|
|
1313
|
+
}),
|
|
1314
|
+
/* @__PURE__ */ p("div", { className: H["bsy-mobile-editor__ai-split"] }),
|
|
1315
|
+
/* @__PURE__ */ m("section", {
|
|
1316
|
+
className: H["bsy-mobile-editor__ai-section"],
|
|
1317
|
+
children: [/* @__PURE__ */ p("div", {
|
|
1318
|
+
className: H["bsy-mobile-editor__ai-section-head"],
|
|
1319
|
+
children: /* @__PURE__ */ m("div", {
|
|
1320
|
+
className: `${H["bsy-mobile-editor__ai-label"]} ${H["bsy-mobile-editor__ai-label--before"]}`,
|
|
1321
|
+
children: [/* @__PURE__ */ p("span", { className: H["bsy-mobile-editor__ai-dot"] }), _("editor.aiOriginal")]
|
|
1322
|
+
})
|
|
1323
|
+
}), /* @__PURE__ */ p("div", {
|
|
1324
|
+
className: H["bsy-mobile-editor__ai-section-scroll"],
|
|
1325
|
+
children: /* @__PURE__ */ p(lt, { html: o })
|
|
1326
|
+
})]
|
|
1327
|
+
})
|
|
1328
|
+
]
|
|
1329
|
+
}),
|
|
1330
|
+
/* @__PURE__ */ m("div", {
|
|
1331
|
+
className: H["bsy-mobile-editor__ai-footer"],
|
|
1332
|
+
children: [/* @__PURE__ */ p("button", {
|
|
1333
|
+
type: "button",
|
|
1334
|
+
onClick: l,
|
|
1335
|
+
children: _("editor.aiAbandon")
|
|
1336
|
+
}), /* @__PURE__ */ p("button", {
|
|
1337
|
+
type: "button",
|
|
1338
|
+
className: H["bsy-mobile-editor__ai-footer-ok"],
|
|
1339
|
+
disabled: !T,
|
|
1340
|
+
onClick: h,
|
|
1341
|
+
children: _("editor.aiApply")
|
|
1342
|
+
})]
|
|
1343
|
+
})
|
|
1344
|
+
]
|
|
1345
|
+
}), a === "polish" ? /* @__PURE__ */ p(t, {
|
|
1346
|
+
mode: "menu",
|
|
1347
|
+
open: y,
|
|
1348
|
+
title: _("editor.aiPolish"),
|
|
1349
|
+
onClose: () => b(!1),
|
|
1350
|
+
actions: W.map((e) => ({
|
|
1351
|
+
key: e,
|
|
1352
|
+
text: _(G[e])
|
|
1353
|
+
})),
|
|
1354
|
+
onAction: (e) => g(e.key)
|
|
1355
|
+
}) : null]
|
|
1356
|
+
});
|
|
1357
|
+
}, bn = "M896 860.48V960H128v-99.52h768zM578.944 128l251.648 655.936h-115.2l-59.904-164.48H379.904L320 784H204.8L456.384 128h122.56z m-58.944 115.776h-3.712L412.16 531.2h211.072L520 243.84z", xn = "M766.4 744.32c43.712 0 79.36-36.224 79.36-80.512 0-53.504-79.36-140.8-79.36-140.8s-79.36 87.296-79.36 140.8c0 44.288 35.648 80.512 79.36 80.512z m-377.088-44.16c7.04 7.168 18.56 7.168 25.6 0l256.064-256c7.104-7.04 7.104-18.56 0-25.6l-256-256a16.32 16.32 0 0 0-1.92-1.664L334.72 82.688a9.088 9.088 0 0 0-12.8 0l-48 48a9.088 9.088 0 0 0 0 12.8l67.2 67.2-207.808 207.936c-7.04 7.04-7.04 18.56 0 25.6l255.936 256z m12.864-448.576L581.12 430.528H223.36L402.24 251.52z m501.824 564.416H120a8 8 0 0 0-8 8v80c0 4.416 3.584 8 8 8h784a8 8 0 0 0 8-8v-80a8 8 0 0 0-8-8z", Sn = 860.48, Cn = 99.52, wn = /rgba\(\s*0\s*,\s*0\s*,\s*0\s*,\s*0(?:\.0+)?\s*\)/, Tn = {
|
|
1358
|
+
fontColor: {
|
|
1359
|
+
path: bn,
|
|
1360
|
+
clipHeight: Sn,
|
|
1361
|
+
x: 128,
|
|
1362
|
+
width: 768,
|
|
1363
|
+
rx: 0
|
|
1364
|
+
},
|
|
1365
|
+
fill: {
|
|
1366
|
+
path: xn,
|
|
1367
|
+
clipHeight: 816,
|
|
1368
|
+
x: 112,
|
|
1369
|
+
width: 800,
|
|
1370
|
+
rx: 8
|
|
1371
|
+
}
|
|
1372
|
+
}, En = (e, t) => {
|
|
1373
|
+
let n = t.trim().toLowerCase();
|
|
1374
|
+
if (e === "fill") return !n || n === "transparent" || wn.test(n);
|
|
1375
|
+
let r = n.replace(/\s+/g, "");
|
|
1376
|
+
return r === "#000" || r === "#000000" || r === "black" || r === "rgb(0,0,0)" || r === "rgba(0,0,0,1)" || r === "rgba(0,0,0,1.0)";
|
|
1377
|
+
}, Dn = ({ variant: e, barColor: t, size: n }) => {
|
|
1378
|
+
let r = `${c().replace(/:/g, "")}clip`, i = Tn[e];
|
|
1379
|
+
return /* @__PURE__ */ m("svg", {
|
|
1380
|
+
width: n,
|
|
1381
|
+
height: n,
|
|
1382
|
+
viewBox: "0 0 1024 1024",
|
|
1383
|
+
"aria-hidden": "true",
|
|
1384
|
+
children: [
|
|
1385
|
+
/* @__PURE__ */ p("defs", { children: /* @__PURE__ */ p("clipPath", {
|
|
1386
|
+
id: r,
|
|
1387
|
+
children: /* @__PURE__ */ p("rect", {
|
|
1388
|
+
x: 0,
|
|
1389
|
+
y: 0,
|
|
1390
|
+
width: 1024,
|
|
1391
|
+
height: i.clipHeight
|
|
1392
|
+
})
|
|
1393
|
+
}) }),
|
|
1394
|
+
/* @__PURE__ */ p("path", {
|
|
1395
|
+
d: i.path,
|
|
1396
|
+
fill: "currentColor",
|
|
1397
|
+
clipPath: `url(#${r})`
|
|
1398
|
+
}),
|
|
1399
|
+
/* @__PURE__ */ p("rect", {
|
|
1400
|
+
x: i.x,
|
|
1401
|
+
y: Sn,
|
|
1402
|
+
width: i.width,
|
|
1403
|
+
height: Cn,
|
|
1404
|
+
rx: i.rx,
|
|
1405
|
+
fill: En(e, t) ? "currentColor" : t
|
|
1406
|
+
})
|
|
1407
|
+
]
|
|
1408
|
+
});
|
|
1409
|
+
}, On = {
|
|
1410
|
+
bold: !1,
|
|
1411
|
+
italic: !1,
|
|
1412
|
+
underline: !1,
|
|
1413
|
+
strikethrough: !1,
|
|
1414
|
+
fontColor: U,
|
|
1415
|
+
backgroundColor: Ae,
|
|
1416
|
+
align: "left",
|
|
1417
|
+
listType: !1,
|
|
1418
|
+
canOutdent: !1,
|
|
1419
|
+
headingTag: !1,
|
|
1420
|
+
hasEditorText: !1
|
|
1421
|
+
}, kn = (e) => e === "center" || e === "right" || e === "left" ? e : e === "end" ? "right" : "left", An = () => {
|
|
1422
|
+
let [e] = z(), [t, n] = d(On);
|
|
1423
|
+
return s(() => e.registerUpdateListener(({ editorState: e }) => {
|
|
1424
|
+
e.read(() => {
|
|
1425
|
+
let e = j(), t = !!A().getTextContent().trim();
|
|
1426
|
+
if (!M(e)) {
|
|
1427
|
+
n((e) => ({
|
|
1428
|
+
...e,
|
|
1429
|
+
hasEditorText: t
|
|
1430
|
+
}));
|
|
1431
|
+
return;
|
|
1432
|
+
}
|
|
1433
|
+
let r = Ee(e, "color", U), i = Ee(e, "background-color", Ae), a = e.anchor.getNode(), o = a.getKey() === "root" ? a : B(a, (e) => {
|
|
1434
|
+
let t = e.getParent();
|
|
1435
|
+
return t !== null && N(t);
|
|
1436
|
+
});
|
|
1437
|
+
o === null && (o = a.getTopLevelElementOrThrow());
|
|
1438
|
+
let s = B(a, S), c = !1, l = se(o) ? o.getIndent() : 0;
|
|
1439
|
+
if (S(s)) {
|
|
1440
|
+
l = s.getIndent();
|
|
1441
|
+
let e = s.getParent();
|
|
1442
|
+
if (ee(e)) {
|
|
1443
|
+
let t = e.getListType();
|
|
1444
|
+
c = t === "number" || t === "bullet" ? t : !1;
|
|
1445
|
+
}
|
|
1446
|
+
}
|
|
1447
|
+
let u = B(a, D), d = D(u) ? u.getTag() : void 0;
|
|
1448
|
+
n({
|
|
1449
|
+
bold: e.hasFormat("bold"),
|
|
1450
|
+
italic: e.hasFormat("italic"),
|
|
1451
|
+
underline: e.hasFormat("underline"),
|
|
1452
|
+
strikethrough: e.hasFormat("strikethrough"),
|
|
1453
|
+
fontColor: r,
|
|
1454
|
+
backgroundColor: i,
|
|
1455
|
+
align: kn(se(o) ? o.getFormatType() : ""),
|
|
1456
|
+
listType: c,
|
|
1457
|
+
canOutdent: l > 0 || c !== !1,
|
|
1458
|
+
headingTag: d === "h1" || d === "h2" || d === "h3" ? d : !1,
|
|
1459
|
+
hasEditorText: t
|
|
1460
|
+
});
|
|
1461
|
+
});
|
|
1462
|
+
}), [e]), t;
|
|
1463
|
+
}, jn = (...e) => e.filter(Boolean).join(" "), Mn = (e) => e.buttons.map((e) => ({
|
|
1464
|
+
name: typeof e == "string" ? e : e.name,
|
|
1465
|
+
disabled: typeof e != "string" && !!e.props?.disabled
|
|
1466
|
+
})), Q = 24, Nn = 20, $ = ({ active: e, disabled: t, expanded: n, label: r, select: i, selectAlign: a, onClick: o, children: s }) => /* @__PURE__ */ p("button", {
|
|
1467
|
+
type: "button",
|
|
1468
|
+
className: jn(H["bsy-mobile-editor__tool"], i && H["bsy-mobile-editor__tool--select"], a && H["bsy-mobile-editor__tool--select-align"], e && H["bsy-mobile-editor__tool--active"]),
|
|
1469
|
+
"aria-label": r,
|
|
1470
|
+
"aria-pressed": e,
|
|
1471
|
+
"aria-expanded": i ? !!n : void 0,
|
|
1472
|
+
disabled: t,
|
|
1473
|
+
onClick: o,
|
|
1474
|
+
children: s
|
|
1475
|
+
}), Pn = ({ open: e }) => /* @__PURE__ */ p(n, {
|
|
1476
|
+
name: "arrow-down",
|
|
1477
|
+
size: Nn,
|
|
1478
|
+
className: jn(H["bsy-mobile-editor__tool-caret"], e && H["bsy-mobile-editor__tool-caret--open"])
|
|
1479
|
+
}), Fn = ({ config: e, openSheet: t, onOpenSheet: i, onOpenLink: a }) => {
|
|
1480
|
+
let [o] = z(), c = An(), { t: l } = r(), d = u(null), f = u(null), h = u(null), g = () => {
|
|
1481
|
+
let e = d.current, t = f.current, n = h.current;
|
|
1482
|
+
if (!e || !t || !n) return;
|
|
1483
|
+
let { scrollLeft: r, scrollWidth: i, clientWidth: a } = e, o = i > a + 1, s = o ? Math.max(16, a / i * 80) : 46, c = i - a, l = o && c > 0 ? (80 - s) * (r / c) : 0;
|
|
1484
|
+
t.hidden = !o, o && (n.style.width = `${s}px`, n.style.transform = `translateX(${l}px)`);
|
|
1485
|
+
};
|
|
1486
|
+
s(() => {
|
|
1487
|
+
let e = d.current;
|
|
1488
|
+
if (!e) return;
|
|
1489
|
+
g();
|
|
1490
|
+
let t = new ResizeObserver(g);
|
|
1491
|
+
return t.observe(e), () => t.disconnect();
|
|
1492
|
+
}, [e]);
|
|
1493
|
+
let _ = ({ name: e, disabled: r }) => {
|
|
1494
|
+
switch (e) {
|
|
1495
|
+
case "bold": return /* @__PURE__ */ p($, {
|
|
1496
|
+
active: c.bold,
|
|
1497
|
+
disabled: r,
|
|
1498
|
+
label: l("editor.bold"),
|
|
1499
|
+
onClick: () => o.dispatchCommand(F, "bold"),
|
|
1500
|
+
children: /* @__PURE__ */ p(n, {
|
|
1501
|
+
name: "bold",
|
|
1502
|
+
size: Q
|
|
1503
|
+
})
|
|
1504
|
+
}, e);
|
|
1505
|
+
case "italic": return /* @__PURE__ */ p($, {
|
|
1506
|
+
active: c.italic,
|
|
1507
|
+
disabled: r,
|
|
1508
|
+
label: l("editor.italic"),
|
|
1509
|
+
onClick: () => o.dispatchCommand(F, "italic"),
|
|
1510
|
+
children: /* @__PURE__ */ p(n, {
|
|
1511
|
+
name: "italic",
|
|
1512
|
+
size: Q
|
|
1513
|
+
})
|
|
1514
|
+
}, e);
|
|
1515
|
+
case "underline": return /* @__PURE__ */ p($, {
|
|
1516
|
+
active: c.underline,
|
|
1517
|
+
disabled: r,
|
|
1518
|
+
label: l("editor.underline"),
|
|
1519
|
+
onClick: () => o.dispatchCommand(F, "underline"),
|
|
1520
|
+
children: /* @__PURE__ */ p(n, {
|
|
1521
|
+
name: "underline",
|
|
1522
|
+
size: Q
|
|
1523
|
+
})
|
|
1524
|
+
}, e);
|
|
1525
|
+
case "strikethrough": return /* @__PURE__ */ p($, {
|
|
1526
|
+
active: c.strikethrough,
|
|
1527
|
+
disabled: r,
|
|
1528
|
+
label: l("editor.strikethrough"),
|
|
1529
|
+
onClick: () => o.dispatchCommand(F, "strikethrough"),
|
|
1530
|
+
children: /* @__PURE__ */ p(n, {
|
|
1531
|
+
name: "shanchuxian",
|
|
1532
|
+
size: Q
|
|
1533
|
+
})
|
|
1534
|
+
}, e);
|
|
1535
|
+
case "outdent": return /* @__PURE__ */ p($, {
|
|
1536
|
+
disabled: r || !c.canOutdent,
|
|
1537
|
+
label: l("editor.outdent"),
|
|
1538
|
+
onClick: () => o.dispatchCommand(me, void 0),
|
|
1539
|
+
children: /* @__PURE__ */ p(n, {
|
|
1540
|
+
name: "jianshaosuojin",
|
|
1541
|
+
size: Q
|
|
1542
|
+
})
|
|
1543
|
+
}, e);
|
|
1544
|
+
case "indent": return /* @__PURE__ */ p($, {
|
|
1545
|
+
disabled: r,
|
|
1546
|
+
label: l("editor.indent"),
|
|
1547
|
+
onClick: () => o.dispatchCommand(I, void 0),
|
|
1548
|
+
children: /* @__PURE__ */ p(n, {
|
|
1549
|
+
name: "zengjiasuojin",
|
|
1550
|
+
size: Q
|
|
1551
|
+
})
|
|
1552
|
+
}, e);
|
|
1553
|
+
case "bullet": return /* @__PURE__ */ p($, {
|
|
1554
|
+
active: c.listType === "bullet",
|
|
1555
|
+
disabled: r,
|
|
1556
|
+
label: l("editor.bulletList"),
|
|
1557
|
+
onClick: () => o.dispatchCommand(c.listType === "bullet" ? E : w, void 0),
|
|
1558
|
+
children: /* @__PURE__ */ p(n, {
|
|
1559
|
+
name: "xuhaoliebiao",
|
|
1560
|
+
size: Q
|
|
1561
|
+
})
|
|
1562
|
+
}, e);
|
|
1563
|
+
case "number": return /* @__PURE__ */ p($, {
|
|
1564
|
+
active: c.listType === "number",
|
|
1565
|
+
disabled: r,
|
|
1566
|
+
label: l("editor.numberList"),
|
|
1567
|
+
onClick: () => o.dispatchCommand(c.listType === "number" ? E : C, void 0),
|
|
1568
|
+
children: /* @__PURE__ */ p(n, {
|
|
1569
|
+
name: "bianhaoliebiao",
|
|
1570
|
+
size: Q
|
|
1571
|
+
})
|
|
1572
|
+
}, e);
|
|
1573
|
+
case "align": return /* @__PURE__ */ m($, {
|
|
1574
|
+
select: !0,
|
|
1575
|
+
selectAlign: !0,
|
|
1576
|
+
expanded: t === "align",
|
|
1577
|
+
active: t === "align",
|
|
1578
|
+
disabled: r,
|
|
1579
|
+
label: l("editor.alignment"),
|
|
1580
|
+
onClick: () => i("align"),
|
|
1581
|
+
children: [/* @__PURE__ */ p(n, {
|
|
1582
|
+
name: c.align === "center" ? "paragraphmiddle" : c.align === "right" ? "paragraphright" : "paragraph",
|
|
1583
|
+
size: Q
|
|
1584
|
+
}), /* @__PURE__ */ p(Pn, { open: t === "align" })]
|
|
1585
|
+
}, e);
|
|
1586
|
+
case "heading": return /* @__PURE__ */ m($, {
|
|
1587
|
+
select: !0,
|
|
1588
|
+
selectAlign: !0,
|
|
1589
|
+
expanded: t === "heading",
|
|
1590
|
+
active: t === "heading",
|
|
1591
|
+
disabled: r,
|
|
1592
|
+
label: l("editor.heading"),
|
|
1593
|
+
onClick: () => i("heading"),
|
|
1594
|
+
children: [/* @__PURE__ */ p("span", {
|
|
1595
|
+
className: H["bsy-mobile-editor__tool-text"],
|
|
1596
|
+
children: c.headingTag ? c.headingTag.toUpperCase() : l("editor.paragraph")
|
|
1597
|
+
}), /* @__PURE__ */ p(Pn, { open: t === "heading" })]
|
|
1598
|
+
}, e);
|
|
1599
|
+
case "fontSize": return /* @__PURE__ */ p($, {
|
|
1600
|
+
active: t === "fontSize",
|
|
1601
|
+
disabled: r || !!c.headingTag,
|
|
1602
|
+
label: l("editor.fontSize"),
|
|
1603
|
+
onClick: () => i("fontSize"),
|
|
1604
|
+
children: /* @__PURE__ */ p(n, {
|
|
1605
|
+
name: "fontsize",
|
|
1606
|
+
size: Q
|
|
1607
|
+
})
|
|
1608
|
+
}, e);
|
|
1609
|
+
case "fontColor": return /* @__PURE__ */ p($, {
|
|
1610
|
+
active: t === "fontColor",
|
|
1611
|
+
disabled: r,
|
|
1612
|
+
label: l("editor.fontColor"),
|
|
1613
|
+
onClick: () => i("fontColor"),
|
|
1614
|
+
children: /* @__PURE__ */ p(Dn, {
|
|
1615
|
+
variant: "fontColor",
|
|
1616
|
+
barColor: c.fontColor,
|
|
1617
|
+
size: Q
|
|
1618
|
+
})
|
|
1619
|
+
}, e);
|
|
1620
|
+
case "fill": return /* @__PURE__ */ p($, {
|
|
1621
|
+
active: t === "fill",
|
|
1622
|
+
disabled: r,
|
|
1623
|
+
label: l("editor.fill"),
|
|
1624
|
+
onClick: () => i("fill"),
|
|
1625
|
+
children: /* @__PURE__ */ p(Dn, {
|
|
1626
|
+
variant: "fill",
|
|
1627
|
+
barColor: c.backgroundColor,
|
|
1628
|
+
size: Q
|
|
1629
|
+
})
|
|
1630
|
+
}, e);
|
|
1631
|
+
case "picture": return /* @__PURE__ */ m($, {
|
|
1632
|
+
select: !0,
|
|
1633
|
+
expanded: t === "picture",
|
|
1634
|
+
active: t === "picture",
|
|
1635
|
+
disabled: r,
|
|
1636
|
+
label: l("editor.picture"),
|
|
1637
|
+
onClick: () => i("picture"),
|
|
1638
|
+
children: [/* @__PURE__ */ p(n, {
|
|
1639
|
+
name: "picture",
|
|
1640
|
+
size: Q
|
|
1641
|
+
}), /* @__PURE__ */ p(Pn, { open: t === "picture" })]
|
|
1642
|
+
}, e);
|
|
1643
|
+
case "link": return /* @__PURE__ */ p($, {
|
|
1644
|
+
disabled: r,
|
|
1645
|
+
label: l("editor.link"),
|
|
1646
|
+
onClick: a,
|
|
1647
|
+
children: /* @__PURE__ */ p(n, {
|
|
1648
|
+
name: "Insertlink",
|
|
1649
|
+
size: Q
|
|
1650
|
+
})
|
|
1651
|
+
}, e);
|
|
1652
|
+
case "ai": {
|
|
1653
|
+
let n = t === "ai" || t === "aiPreset";
|
|
1654
|
+
return /* @__PURE__ */ m($, {
|
|
1655
|
+
select: !0,
|
|
1656
|
+
expanded: n,
|
|
1657
|
+
active: n,
|
|
1658
|
+
disabled: r || !c.hasEditorText,
|
|
1659
|
+
label: l("editor.ai"),
|
|
1660
|
+
onClick: () => i("ai"),
|
|
1661
|
+
children: [/* @__PURE__ */ p("img", {
|
|
1662
|
+
src: Xe,
|
|
1663
|
+
alt: "",
|
|
1664
|
+
width: Q,
|
|
1665
|
+
height: Q,
|
|
1666
|
+
className: H["bsy-mobile-editor__ai-icon"],
|
|
1667
|
+
draggable: !1
|
|
1668
|
+
}), /* @__PURE__ */ p(Pn, { open: n })]
|
|
1669
|
+
}, e);
|
|
1670
|
+
}
|
|
1671
|
+
default: return null;
|
|
1672
|
+
}
|
|
1673
|
+
};
|
|
1674
|
+
return /* @__PURE__ */ m("div", {
|
|
1675
|
+
className: H["bsy-mobile-editor__toolbar"],
|
|
1676
|
+
children: [/* @__PURE__ */ p("div", {
|
|
1677
|
+
ref: d,
|
|
1678
|
+
className: H["bsy-mobile-editor__toolbar-scroller"],
|
|
1679
|
+
onScroll: g,
|
|
1680
|
+
children: e.map((e, t) => {
|
|
1681
|
+
let n = Mn(e);
|
|
1682
|
+
return n.length ? /* @__PURE__ */ m("div", {
|
|
1683
|
+
className: H["bsy-mobile-editor__toolbar-group"],
|
|
1684
|
+
children: [t > 0 ? /* @__PURE__ */ p("span", { className: H["bsy-mobile-editor__toolbar-divider"] }) : null, n.map(_)]
|
|
1685
|
+
}, e.key) : null;
|
|
1686
|
+
})
|
|
1687
|
+
}), /* @__PURE__ */ p("div", {
|
|
1688
|
+
ref: f,
|
|
1689
|
+
className: H["bsy-mobile-editor__toolbar-track"],
|
|
1690
|
+
hidden: !0,
|
|
1691
|
+
"aria-hidden": !0,
|
|
1692
|
+
children: /* @__PURE__ */ p("div", {
|
|
1693
|
+
ref: h,
|
|
1694
|
+
className: H["bsy-mobile-editor__toolbar-thumb"]
|
|
1695
|
+
})
|
|
1696
|
+
})]
|
|
1697
|
+
});
|
|
1698
|
+
}, In = (e) => Ne.includes(e.name.split(".").pop()?.toLowerCase() ?? ""), Ln = (e) => In(e) ? e.size > 5242880 ? "size" : null : "type", Rn = (e) => {
|
|
1699
|
+
let t = "", n = "", r = "";
|
|
1700
|
+
return e.getEditorState().read(() => {
|
|
1701
|
+
n = A().getTextContent(), t = Mt(Y(_e(e, null))), r = Wt(t).join(`\n\n${Nt}\n\n`);
|
|
1702
|
+
}, { editor: e }), {
|
|
1703
|
+
html: t,
|
|
1704
|
+
text: n,
|
|
1705
|
+
polishText: r
|
|
1706
|
+
};
|
|
1707
|
+
}, zn = (e) => e.startsWith("@") ? "javascript:void(0);" : e.match(/^https?:\/\//) ? e : `http://${e}`, Bn = (e) => new Promise((t, n) => {
|
|
1708
|
+
let r = new FileReader();
|
|
1709
|
+
r.onload = () => t(String(r.result)), r.onerror = () => n(r.error), r.readAsDataURL(e);
|
|
1710
|
+
}), Vn = ({ value: t, onChange: n, open: i, onOpenChange: o, toolbar: c, upload: l, ai: f }) => {
|
|
1711
|
+
let [h] = z(), { t: g } = r(), [b, x] = d(!1), S = i ?? b, ee = (e) => {
|
|
1712
|
+
o?.(e), i === void 0 && x(e);
|
|
1713
|
+
}, [C, w] = d(null), T = u(!1), [te, E] = d(null), [ne, D] = d(!1), O = u(null), re = u(null), N = u(null), de = u(/* @__PURE__ */ new Map()), fe = u(null), pe = u(n);
|
|
1714
|
+
pe.current = n;
|
|
1715
|
+
let P = u(f);
|
|
1716
|
+
P.current = f;
|
|
1717
|
+
let [F, I] = d(null), [me, he] = d({
|
|
1718
|
+
html: "",
|
|
1719
|
+
text: "",
|
|
1720
|
+
polishText: ""
|
|
1721
|
+
}), [ge, L] = d("quick"), [R, Te] = d(0), [Ee, V] = d({}), De = c?.config ?? Me, Oe = () => {
|
|
1722
|
+
N.current?.abort(), N.current = null, P.current?.stop?.(), I(null), w(null), E(null), D(!1), ee(!1);
|
|
1723
|
+
};
|
|
1724
|
+
s(() => {
|
|
1725
|
+
if (!S) return;
|
|
1726
|
+
let e = window.visualViewport;
|
|
1727
|
+
if (!e) return;
|
|
1728
|
+
let t = () => {
|
|
1729
|
+
Te(Math.max(0, window.innerHeight - e.height - e.offsetTop));
|
|
1730
|
+
};
|
|
1731
|
+
return e.addEventListener("resize", t), e.addEventListener("scroll", t), t(), () => {
|
|
1732
|
+
e.removeEventListener("resize", t), e.removeEventListener("scroll", t);
|
|
1733
|
+
};
|
|
1734
|
+
}, [S]), s(() => {
|
|
1735
|
+
S || (N.current?.abort(), N.current = null);
|
|
1736
|
+
}, [S]), s(() => {
|
|
1737
|
+
if (!S) return;
|
|
1738
|
+
h.setEditable(!0);
|
|
1739
|
+
let e = window.requestAnimationFrame(() => h.focus());
|
|
1740
|
+
return () => window.cancelAnimationFrame(e);
|
|
1741
|
+
}, [S, h]), s(() => {
|
|
1742
|
+
t === void 0 || t === fe.current || (fe.current = t ?? null, h.update(() => {
|
|
1743
|
+
gt(h, t?.trim() ? Y(t) : "");
|
|
1744
|
+
}));
|
|
1745
|
+
}, [t, h]);
|
|
1746
|
+
let ke = a((e) => {
|
|
1747
|
+
e.read(() => {
|
|
1748
|
+
let t = A().getTextContent(), n = Mt(Y(_e(h, null))), r = _t(n, t) ? null : n;
|
|
1749
|
+
fe.current = r;
|
|
1750
|
+
let i = le(Be).map((e) => de.current.get(e.getSrc())).filter((e) => e !== void 0);
|
|
1751
|
+
pe.current({
|
|
1752
|
+
text: t,
|
|
1753
|
+
html: r,
|
|
1754
|
+
attachments: i
|
|
1755
|
+
}, e);
|
|
1756
|
+
}, { editor: h });
|
|
1757
|
+
}, [h]), U = () => {
|
|
1758
|
+
h.getEditorState().read(() => {
|
|
1759
|
+
O.current = j()?.clone() ?? null;
|
|
1760
|
+
});
|
|
1761
|
+
}, Ae = () => {
|
|
1762
|
+
U(), h.getEditorState().read(() => {
|
|
1763
|
+
let e = j(), t = M(e) ? e.anchor.getNode() : null, n = t ? B(t, v) : null;
|
|
1764
|
+
if (n) {
|
|
1765
|
+
E({
|
|
1766
|
+
url: n.getURL(),
|
|
1767
|
+
text: n.getTextContent(),
|
|
1768
|
+
newBlank: n.getTarget() === "_blank"
|
|
1769
|
+
});
|
|
1770
|
+
return;
|
|
1771
|
+
}
|
|
1772
|
+
E({
|
|
1773
|
+
url: "",
|
|
1774
|
+
text: M(e) ? e.getTextContent() : "",
|
|
1775
|
+
newBlank: !0
|
|
1776
|
+
});
|
|
1777
|
+
});
|
|
1778
|
+
}, je = (e) => {
|
|
1779
|
+
if (!e.url.trim()) return;
|
|
1780
|
+
let t = zn(e.url.trim());
|
|
1781
|
+
h.update(() => {
|
|
1782
|
+
let n = O.current;
|
|
1783
|
+
n !== null && ue(n);
|
|
1784
|
+
let r = j(), i = e.newBlank ? {
|
|
1785
|
+
target: "_blank",
|
|
1786
|
+
rel: "noopener noreferrer",
|
|
1787
|
+
title: e.url
|
|
1788
|
+
} : { title: e.url };
|
|
1789
|
+
if (M(r)) {
|
|
1790
|
+
let n = e.text.trim() || e.url;
|
|
1791
|
+
if (r.getTextContent()) y(t, i);
|
|
1792
|
+
else {
|
|
1793
|
+
let e = ie(n), a = _(t, i);
|
|
1794
|
+
a.append(e), r.insertNodes([a]);
|
|
1795
|
+
}
|
|
1796
|
+
} else {
|
|
1797
|
+
let n = ie(e.text.trim() || e.url), r = _(t, i);
|
|
1798
|
+
r.append(n);
|
|
1799
|
+
let a = A(), o = a.getLastChild();
|
|
1800
|
+
if (se(o)) o.append(r);
|
|
1801
|
+
else {
|
|
1802
|
+
let e = k();
|
|
1803
|
+
e.append(r), a.append(e);
|
|
1804
|
+
}
|
|
1805
|
+
}
|
|
1806
|
+
}), E(null);
|
|
1807
|
+
}, W = (e, t, n) => {
|
|
1808
|
+
let r = "";
|
|
1809
|
+
return h.update(() => {
|
|
1810
|
+
let i = O.current;
|
|
1811
|
+
i !== null && ue(i), j() === null && A().selectEnd();
|
|
1812
|
+
let a = He({
|
|
1813
|
+
src: e,
|
|
1814
|
+
altText: t,
|
|
1815
|
+
dataId: n
|
|
1816
|
+
});
|
|
1817
|
+
r = a.getKey(), oe([a]);
|
|
1818
|
+
for (let e of a.getParent()?.getChildren() ?? []) ce(e) && e.getTextContentSize() === 0 && e.remove();
|
|
1819
|
+
}), r;
|
|
1820
|
+
}, G = async (e) => {
|
|
1821
|
+
let t = e.target.files?.[0];
|
|
1822
|
+
if (e.target.value = "", !t || Ln(t)) return;
|
|
1823
|
+
N.current?.abort();
|
|
1824
|
+
let n = new AbortController();
|
|
1825
|
+
if (N.current = n, !l?.customRequest) {
|
|
1826
|
+
try {
|
|
1827
|
+
let e = await Bn(t);
|
|
1828
|
+
if (!e || n.signal.aborted) return;
|
|
1829
|
+
W(e, t.name);
|
|
1830
|
+
} catch {
|
|
1831
|
+
return;
|
|
1832
|
+
} finally {
|
|
1833
|
+
N.current === n && (N.current = null);
|
|
1834
|
+
}
|
|
1835
|
+
return;
|
|
1836
|
+
}
|
|
1837
|
+
let r = URL.createObjectURL(t), i = W(r, t.name);
|
|
1838
|
+
V((e) => ({
|
|
1839
|
+
...e,
|
|
1840
|
+
[i]: void 0
|
|
1841
|
+
}));
|
|
1842
|
+
let a = !1, o = (e) => {
|
|
1843
|
+
a || (a = !0, URL.revokeObjectURL(r), e || h.update(() => {
|
|
1844
|
+
ae(i)?.remove();
|
|
1845
|
+
}), V((e) => {
|
|
1846
|
+
let t = { ...e };
|
|
1847
|
+
return delete t[i], t;
|
|
1848
|
+
}), N.current === n && (N.current = null));
|
|
1849
|
+
};
|
|
1850
|
+
n.signal.addEventListener("abort", () => o(!1));
|
|
1851
|
+
try {
|
|
1852
|
+
let e = await l.customRequest(t, {
|
|
1853
|
+
signal: n.signal,
|
|
1854
|
+
onProgress: (e) => {
|
|
1855
|
+
if (!Number.isFinite(e)) return;
|
|
1856
|
+
let t = Math.min(100, Math.max(0, e));
|
|
1857
|
+
V((e) => i in e ? {
|
|
1858
|
+
...e,
|
|
1859
|
+
[i]: t
|
|
1860
|
+
} : e);
|
|
1861
|
+
}
|
|
1862
|
+
});
|
|
1863
|
+
if (n.signal.aborted) {
|
|
1864
|
+
o(!1);
|
|
1865
|
+
return;
|
|
1866
|
+
}
|
|
1867
|
+
let r = "", a;
|
|
1868
|
+
if (typeof e == "string" ? r = e : (r = e.url, e.attachment && (de.current.set(r, e.attachment), a = e.attachment._id)), !r) {
|
|
1869
|
+
o(!1);
|
|
1870
|
+
return;
|
|
1871
|
+
}
|
|
1872
|
+
h.update(() => {
|
|
1873
|
+
let e = ae(i);
|
|
1874
|
+
Ve(e) && (e.setSrc(r), a && e.setDataId(a));
|
|
1875
|
+
}), o(!0);
|
|
1876
|
+
} catch {
|
|
1877
|
+
o(!1);
|
|
1878
|
+
}
|
|
1879
|
+
}, Ne = () => {
|
|
1880
|
+
let e = Rn(h);
|
|
1881
|
+
he(e), w(null), I("typeset"), P.current?.typeset?.({
|
|
1882
|
+
html: e.html,
|
|
1883
|
+
text: e.text
|
|
1884
|
+
});
|
|
1885
|
+
}, Fe = (e) => {
|
|
1886
|
+
let t = Rn(h);
|
|
1887
|
+
he(t), L(e), w(null), I("polish"), P.current?.stop?.(), P.current?.polish?.({
|
|
1888
|
+
text: t.polishText,
|
|
1889
|
+
preset: e
|
|
1890
|
+
});
|
|
1891
|
+
}, K = () => {
|
|
1892
|
+
P.current?.stop?.(), I(null);
|
|
1893
|
+
};
|
|
1894
|
+
return /* @__PURE__ */ p(e, {
|
|
1895
|
+
open: S,
|
|
1896
|
+
onClose: Oe,
|
|
1897
|
+
position: "bottom",
|
|
1898
|
+
closeOnClickOverlay: !0,
|
|
1899
|
+
children: /* @__PURE__ */ p(Ie.Provider, {
|
|
1900
|
+
value: Ee,
|
|
1901
|
+
children: /* @__PURE__ */ m("div", {
|
|
1902
|
+
className: H["bsy-mobile-editor"],
|
|
1903
|
+
style: {
|
|
1904
|
+
height: 300,
|
|
1905
|
+
transform: R ? `translate3d(0, -${R}px, 0)` : void 0
|
|
1906
|
+
},
|
|
1907
|
+
children: [
|
|
1908
|
+
/* @__PURE__ */ p("div", {
|
|
1909
|
+
className: H["bsy-mobile-editor__label"],
|
|
1910
|
+
children: /* @__PURE__ */ p("div", {
|
|
1911
|
+
className: H["bsy-mobile-editor__label-text"],
|
|
1912
|
+
children: g("editor.title")
|
|
1913
|
+
})
|
|
1914
|
+
}),
|
|
1915
|
+
/* @__PURE__ */ p("div", {
|
|
1916
|
+
className: H["bsy-mobile-editor__content"],
|
|
1917
|
+
style: { height: 200 },
|
|
1918
|
+
children: /* @__PURE__ */ p(Ce, {
|
|
1919
|
+
contentEditable: /* @__PURE__ */ p(ve, { className: H["bsy-mobile-editor__editable"] }),
|
|
1920
|
+
ErrorBoundary: we
|
|
1921
|
+
})
|
|
1922
|
+
}),
|
|
1923
|
+
De.length > 0 ? /* @__PURE__ */ p(Fn, {
|
|
1924
|
+
config: De,
|
|
1925
|
+
openSheet: C,
|
|
1926
|
+
onOpenSheet: w,
|
|
1927
|
+
onOpenLink: Ae
|
|
1928
|
+
}) : null,
|
|
1929
|
+
/* @__PURE__ */ p(ye, {}),
|
|
1930
|
+
/* @__PURE__ */ p(xe, {}),
|
|
1931
|
+
/* @__PURE__ */ p(be, {}),
|
|
1932
|
+
/* @__PURE__ */ p(Ye, {}),
|
|
1933
|
+
/* @__PURE__ */ p(Ge, {}),
|
|
1934
|
+
/* @__PURE__ */ p(qe, {}),
|
|
1935
|
+
/* @__PURE__ */ p(Se, { onChange: ke }),
|
|
1936
|
+
/* @__PURE__ */ p("input", {
|
|
1937
|
+
ref: re,
|
|
1938
|
+
type: "file",
|
|
1939
|
+
accept: Pe,
|
|
1940
|
+
hidden: !0,
|
|
1941
|
+
onChange: G
|
|
1942
|
+
}),
|
|
1943
|
+
/* @__PURE__ */ p(mn, {
|
|
1944
|
+
sheet: C,
|
|
1945
|
+
onClose: () => {
|
|
1946
|
+
if (T.current) {
|
|
1947
|
+
T.current = !1;
|
|
1948
|
+
return;
|
|
1949
|
+
}
|
|
1950
|
+
w(null);
|
|
1951
|
+
},
|
|
1952
|
+
onTypeset: Ne,
|
|
1953
|
+
onPolishMenu: () => {
|
|
1954
|
+
T.current = !0, w("aiPreset");
|
|
1955
|
+
},
|
|
1956
|
+
onPickPreset: Fe,
|
|
1957
|
+
onPicture: (e) => {
|
|
1958
|
+
if (U(), e === "upload") {
|
|
1959
|
+
re.current?.click();
|
|
1960
|
+
return;
|
|
1961
|
+
}
|
|
1962
|
+
D(!0);
|
|
1963
|
+
},
|
|
1964
|
+
canTypeset: !!f?.typeset,
|
|
1965
|
+
canPolish: !!f?.polish
|
|
1966
|
+
}),
|
|
1967
|
+
/* @__PURE__ */ p(gn, {
|
|
1968
|
+
open: te !== null,
|
|
1969
|
+
seed: te,
|
|
1970
|
+
onClose: () => E(null),
|
|
1971
|
+
onConfirm: je
|
|
1972
|
+
}),
|
|
1973
|
+
/* @__PURE__ */ p(vn, {
|
|
1974
|
+
open: ne,
|
|
1975
|
+
onClose: () => D(!1),
|
|
1976
|
+
onConfirm: (e) => {
|
|
1977
|
+
W(e, e), D(!1);
|
|
1978
|
+
}
|
|
1979
|
+
}),
|
|
1980
|
+
/* @__PURE__ */ p(yn, {
|
|
1981
|
+
open: F !== null,
|
|
1982
|
+
mode: F,
|
|
1983
|
+
originalHtml: me.html,
|
|
1984
|
+
ai: f,
|
|
1985
|
+
polishPreset: ge,
|
|
1986
|
+
onClose: K,
|
|
1987
|
+
onApply: () => {
|
|
1988
|
+
let e = P.current?.text ?? "";
|
|
1989
|
+
if (F === "typeset") {
|
|
1990
|
+
let t = Y(dn(e).html);
|
|
1991
|
+
if (!t.trim()) return;
|
|
1992
|
+
h.update(() => {
|
|
1993
|
+
gt(h, t);
|
|
1994
|
+
});
|
|
1995
|
+
} else F === "polish" && Jt(h, e);
|
|
1996
|
+
K();
|
|
1997
|
+
},
|
|
1998
|
+
onPickPreset: Fe
|
|
1999
|
+
})
|
|
2000
|
+
]
|
|
2001
|
+
})
|
|
2002
|
+
})
|
|
2003
|
+
});
|
|
2004
|
+
}, Hn = {
|
|
2005
|
+
namespace: "bsyLexicalEditor",
|
|
2006
|
+
onError: (e) => {
|
|
2007
|
+
console.error("Lexical error", e);
|
|
2008
|
+
},
|
|
2009
|
+
editable: !0,
|
|
2010
|
+
theme: {
|
|
2011
|
+
text: {
|
|
2012
|
+
bold: "editor-text-bold",
|
|
2013
|
+
italic: "editor-text-italic",
|
|
2014
|
+
underline: "editor-text-underline",
|
|
2015
|
+
strikethrough: "editor-text-strikethrough",
|
|
2016
|
+
underlineStrikethrough: "editor-text-underline-strikethrough"
|
|
2017
|
+
},
|
|
2018
|
+
list: {
|
|
2019
|
+
ul: "editor-list-ul",
|
|
2020
|
+
ol: "editor-list-ol",
|
|
2021
|
+
listitem: "editor-listitem",
|
|
2022
|
+
nested: { listitem: "editor-nested-listitem" }
|
|
2023
|
+
},
|
|
2024
|
+
heading: {
|
|
2025
|
+
h1: "editor-heading-h1",
|
|
2026
|
+
h2: "editor-heading-h2",
|
|
2027
|
+
h3: "editor-heading-h3"
|
|
2028
|
+
},
|
|
2029
|
+
link: "editor-link"
|
|
2030
|
+
},
|
|
2031
|
+
nodes: [
|
|
2032
|
+
x,
|
|
2033
|
+
b,
|
|
2034
|
+
te,
|
|
2035
|
+
T,
|
|
2036
|
+
O,
|
|
2037
|
+
Be,
|
|
2038
|
+
q,
|
|
2039
|
+
{
|
|
2040
|
+
replace: L,
|
|
2041
|
+
with: (e) => new q(e.__text),
|
|
2042
|
+
withKlass: q
|
|
2043
|
+
}
|
|
2044
|
+
]
|
|
2045
|
+
}, Un = (e) => /* @__PURE__ */ p(g, {
|
|
2046
|
+
initialConfig: Hn,
|
|
2047
|
+
children: /* @__PURE__ */ p(Vn, { ...e })
|
|
2048
|
+
});
|
|
2049
|
+
Un.displayName = "BsyMobileEditor";
|
|
2050
|
+
//#endregion
|
|
2051
|
+
export { lt as n, Un as t };
|