@baishuyun/ui-mobile 0.12.4 → 0.13.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.
- package/dist/AMap/index.js +1 -1
- package/dist/ActionSheet/index.js +1 -1
- package/dist/Calendar/index.js +1 -1
- package/dist/ConfigProvider/index.js +1 -1
- package/dist/Editor/{Editor-CVWffQQX.js → Editor-Dw7Ydzum.js} +774 -691
- package/dist/Editor/index.js +2 -2
- package/dist/Gantt/index.js +1 -1
- package/dist/Icon/index.js +1 -1
- package/dist/Overlay/index.js +1 -1
- package/dist/Popup/index.js +1 -1
- package/dist/Segmented/index.js +1 -1
- package/dist/components/Editor/constants.d.ts +2 -1
- package/dist/components/Editor/plugins/ImePendingFormatPlugin.d.ts +1 -0
- package/dist/components/Editor/popups/OptionSheets.d.ts +3 -1
- package/dist/components/Editor/utils/imePendingFormat.d.ts +8 -0
- package/dist/components/Editor/utils/readTextFormats.d.ts +1 -0
- package/dist/components/Editor/utils/resetEmptyEditorCarryFormat.d.ts +3 -0
- package/dist/index.js +2 -2
- package/dist/style.css +1 -1
- package/dist/vendors/{version-CNlAoA_H.js → version-DHbKErmD.js} +1 -1
- package/package.json +1 -1
|
@@ -6,26 +6,26 @@ import { createContext as i, useCallback as a, useContext as o, useEffect as s,
|
|
|
6
6
|
import { Fragment as f, jsx as p, jsxs as m } from "react/jsx-runtime";
|
|
7
7
|
import { useEventListener as h } from "ahooks";
|
|
8
8
|
import { LexicalComposer as g } from "@lexical/react/LexicalComposer";
|
|
9
|
-
import { $createLinkNode as _, $isLinkNode as v, $toggleLink as y, AutoLinkNode as
|
|
10
|
-
import { $isListItemNode as
|
|
11
|
-
import { $createCodeHighlightNode as
|
|
12
|
-
import { $createHeadingNode as
|
|
13
|
-
import { $findCellNode as
|
|
14
|
-
import { $applyNodeReplacement as
|
|
15
|
-
import { ContentEditable as
|
|
16
|
-
import { HistoryPlugin as
|
|
17
|
-
import { LinkPlugin as
|
|
18
|
-
import { ListPlugin as
|
|
19
|
-
import { OnChangePlugin as
|
|
20
|
-
import { RichTextPlugin as
|
|
21
|
-
import { LexicalErrorBoundary as
|
|
9
|
+
import { $createLinkNode as _, $isLinkNode as v, $toggleLink as y, AutoLinkNode as ee, LinkNode as b } from "@lexical/link";
|
|
10
|
+
import { $isListItemNode as x, $isListNode as S, INSERT_ORDERED_LIST_COMMAND as C, INSERT_UNORDERED_LIST_COMMAND as w, ListItemNode as T, ListNode as E, REMOVE_LIST_COMMAND as D } from "@lexical/list";
|
|
11
|
+
import { $createCodeHighlightNode as O, $isCodeHighlightNode as k, $isCodeNode as te, $plainifyCodeContent as ne, CodeHighlightNode as A, CodeNode as j, registerCodeIndentation as re } from "@lexical/code-core";
|
|
12
|
+
import { $createHeadingNode as ie, $isHeadingNode as ae, HeadingNode as oe } from "@lexical/rich-text";
|
|
13
|
+
import { $findCellNode as se, $isTableCellNode as ce, $isTableNode as M, $isTableRowNode as le, TableCellNode as ue, TableNode as de, TableRowNode as fe, registerTableCellUnmergeTransform as pe, registerTablePlugin as me, registerTableSelectionObserver as he, setScrollableTablesActive as ge } from "@lexical/table";
|
|
14
|
+
import { $applyNodeReplacement as _e, $createLineBreakNode as ve, $createParagraphNode as N, $createTabNode as ye, $createTextNode as be, $getNodeByKey as P, $getRoot as F, $getSelection as I, $insertNodes as xe, $isElementNode as Se, $isLineBreakNode as Ce, $isRangeSelection as L, $isRootOrShadowRoot as we, $isTabNode as Te, $isTextNode as R, $nodesOfType as Ee, $onUpdate as De, $setSelection as Oe, COMMAND_PRIORITY_CRITICAL as ke, COMMAND_PRIORITY_HIGH as Ae, COMMAND_PRIORITY_LOW as je, COMPOSITION_START_COMMAND as Me, DROP_COMMAND as Ne, DecoratorNode as Pe, FORMAT_ELEMENT_COMMAND as Fe, FORMAT_TEXT_COMMAND as Ie, HISTORY_MERGE_TAG as Le, INDENT_CONTENT_COMMAND as Re, KEY_ENTER_COMMAND as ze, KEY_TAB_COMMAND as Be, OUTDENT_CONTENT_COMMAND as Ve, PASTE_COMMAND as He, PASTE_TAG as Ue, ParagraphNode as We, TextNode as Ge, isHTMLElement as Ke, mergeRegister as qe } from "lexical";
|
|
15
|
+
import { ContentEditable as Je } from "@lexical/react/LexicalContentEditable";
|
|
16
|
+
import { HistoryPlugin as Ye } from "@lexical/react/LexicalHistoryPlugin";
|
|
17
|
+
import { LinkPlugin as Xe } from "@lexical/react/LexicalLinkPlugin";
|
|
18
|
+
import { ListPlugin as Ze } from "@lexical/react/LexicalListPlugin";
|
|
19
|
+
import { OnChangePlugin as Qe } from "@lexical/react/LexicalOnChangePlugin";
|
|
20
|
+
import { RichTextPlugin as $e } from "@lexical/react/LexicalRichTextPlugin";
|
|
21
|
+
import { LexicalErrorBoundary as et } from "@lexical/react/LexicalErrorBoundary";
|
|
22
22
|
import { useLexicalComposerContext as z } from "@lexical/react/LexicalComposerContext";
|
|
23
|
-
import { $generateHtmlFromNodes as
|
|
24
|
-
import
|
|
25
|
-
import { $findMatchingParent as B, $handleIndentAndOutdent as
|
|
26
|
-
import { $getSelectionStyleValueForProperty as
|
|
23
|
+
import { $generateHtmlFromNodes as tt, $generateNodesFromDOM as nt } from "@lexical/html";
|
|
24
|
+
import rt from "dompurify";
|
|
25
|
+
import { $findMatchingParent as B, $handleIndentAndOutdent as it, mergeRegister as at } from "@lexical/utils";
|
|
26
|
+
import { $getSelectionStyleValueForProperty as ot, $patchStyleText as st, $setBlocksType as ct } from "@lexical/selection";
|
|
27
27
|
//#region src/components/Editor/constants.ts
|
|
28
|
-
var
|
|
28
|
+
var lt = [
|
|
29
29
|
{
|
|
30
30
|
label: "12",
|
|
31
31
|
value: "12px"
|
|
@@ -74,21 +74,21 @@ var st = [
|
|
|
74
74
|
label: "128",
|
|
75
75
|
value: "128px"
|
|
76
76
|
}
|
|
77
|
-
],
|
|
77
|
+
], ut = "16px", dt = "#000", ft = "transparent", pt = /* @__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("."), mt = [
|
|
78
78
|
"quick",
|
|
79
79
|
"formal",
|
|
80
80
|
"colloquial",
|
|
81
81
|
"lively",
|
|
82
82
|
"literary",
|
|
83
83
|
"retro"
|
|
84
|
-
],
|
|
84
|
+
], ht = {
|
|
85
85
|
quick: "editor.aiPresetQuick",
|
|
86
86
|
formal: "editor.aiPresetFormal",
|
|
87
87
|
colloquial: "editor.aiPresetColloquial",
|
|
88
88
|
lively: "editor.aiPresetLively",
|
|
89
89
|
literary: "editor.aiPresetLiterary",
|
|
90
90
|
retro: "editor.aiPresetRetro"
|
|
91
|
-
},
|
|
91
|
+
}, gt = [
|
|
92
92
|
{
|
|
93
93
|
key: "ai",
|
|
94
94
|
buttons: ["ai"]
|
|
@@ -124,102 +124,102 @@ var st = [
|
|
|
124
124
|
key: "insert",
|
|
125
125
|
buttons: ["picture", "link"]
|
|
126
126
|
}
|
|
127
|
-
],
|
|
127
|
+
], _t = [
|
|
128
128
|
"jpg",
|
|
129
129
|
"jpeg",
|
|
130
130
|
"png",
|
|
131
131
|
"gif",
|
|
132
132
|
"bmp",
|
|
133
133
|
"tif"
|
|
134
|
-
],
|
|
135
|
-
"bsy-mobile-editor": "_bsy-mobile-
|
|
136
|
-
"bsy-mobile-editor__label": "_bsy-mobile-
|
|
137
|
-
"bsy-mobile-editor__label-text": "_bsy-mobile-editor__label-
|
|
138
|
-
"bsy-mobile-editor__header": "_bsy-mobile-
|
|
139
|
-
"bsy-mobile-editor__title": "_bsy-mobile-
|
|
140
|
-
"bsy-mobile-editor__close": "_bsy-mobile-
|
|
141
|
-
"bsy-mobile-editor__content": "_bsy-mobile-
|
|
142
|
-
"bsy-mobile-editor__editable": "_bsy-mobile-
|
|
143
|
-
"bsy-mobile-editor__image-shell": "_bsy-mobile-editor__image-
|
|
144
|
-
"bsy-mobile-editor__image": "_bsy-mobile-
|
|
145
|
-
"bsy-mobile-editor__image-mask": "_bsy-mobile-editor__image-
|
|
146
|
-
"bsy-mobile-editor__image-progress": "_bsy-mobile-editor__image-
|
|
147
|
-
"bsy-mobile-editor__image-progress--spin": "_bsy-mobile-editor__image-progress--
|
|
148
|
-
"bsy-mobile-editor-progress-spin": "_bsy-mobile-editor-progress-
|
|
149
|
-
"bsy-mobile-editor__toolbar": "_bsy-mobile-
|
|
150
|
-
"bsy-mobile-editor__toolbar-scroller": "_bsy-mobile-editor__toolbar-
|
|
151
|
-
"bsy-mobile-editor__toolbar-track": "_bsy-mobile-editor__toolbar-
|
|
152
|
-
"bsy-mobile-editor__toolbar-thumb": "_bsy-mobile-editor__toolbar-
|
|
153
|
-
"bsy-mobile-editor__toolbar-group": "_bsy-mobile-editor__toolbar-
|
|
154
|
-
"bsy-mobile-editor__toolbar-divider": "_bsy-mobile-editor__toolbar-
|
|
155
|
-
"bsy-mobile-editor__tool": "_bsy-mobile-
|
|
156
|
-
"bsy-mobile-editor__tool--active": "_bsy-mobile-editor__tool--
|
|
157
|
-
"bsy-mobile-editor__tool--select": "_bsy-mobile-editor__tool--
|
|
158
|
-
"bsy-mobile-editor__tool--select-align": "_bsy-mobile-editor__tool--select-
|
|
159
|
-
"bsy-mobile-editor__tool-caret": "_bsy-mobile-editor__tool-
|
|
160
|
-
"bsy-mobile-editor__tool-caret--open": "_bsy-mobile-editor__tool-caret--
|
|
161
|
-
"bsy-mobile-editor__ai-icon": "_bsy-mobile-editor__ai-
|
|
162
|
-
"bsy-mobile-editor__tool-text": "_bsy-mobile-editor__tool-
|
|
163
|
-
"bsy-mobile-editor__color": "_bsy-mobile-
|
|
164
|
-
"bsy-mobile-editor__color--custom": "_bsy-mobile-editor__color--
|
|
165
|
-
"bsy-mobile-editor__color-header": "_bsy-mobile-editor__color-
|
|
166
|
-
"bsy-mobile-editor__color-header-title": "_bsy-mobile-editor__color-header-
|
|
167
|
-
"bsy-mobile-editor__color-header-back": "_bsy-mobile-editor__color-header-
|
|
168
|
-
"bsy-mobile-editor__color-grid": "_bsy-mobile-editor__color-
|
|
169
|
-
"bsy-mobile-editor__color-swatch": "_bsy-mobile-editor__color-
|
|
170
|
-
"bsy-mobile-editor__color-none": "_bsy-mobile-editor__color-
|
|
171
|
-
"bsy-mobile-editor__color-custom-item": "_bsy-mobile-editor__color-custom-
|
|
172
|
-
"bsy-mobile-editor__color-swatch--selected": "_bsy-mobile-editor__color-swatch--
|
|
173
|
-
"bsy-mobile-editor__color-none--selected": "_bsy-mobile-editor__color-none--
|
|
174
|
-
"bsy-mobile-editor__color-custom-item--selected": "_bsy-mobile-editor__color-custom-item--
|
|
175
|
-
"bsy-mobile-editor__color-swatch-fill": "_bsy-mobile-editor__color-swatch-
|
|
176
|
-
"bsy-mobile-editor__color-bar": "_bsy-mobile-editor__color-
|
|
177
|
-
"bsy-mobile-editor__color-custom-trigger": "_bsy-mobile-editor__color-custom-
|
|
178
|
-
"bsy-mobile-editor__color-custom-trigger--active": "_bsy-mobile-editor__color-custom-trigger--
|
|
179
|
-
"bsy-mobile-editor__color-custom-trigger--preview": "_bsy-mobile-editor__color-custom-trigger--
|
|
180
|
-
"bsy-mobile-editor__color-custom-list": "_bsy-mobile-editor__color-custom-
|
|
181
|
-
"bsy-mobile-editor__color-mixer": "_bsy-mobile-editor__color-
|
|
182
|
-
"bsy-mobile-editor__color-spectrum": "_bsy-mobile-editor__color-
|
|
183
|
-
"bsy-mobile-editor__color-spectrum-canvas": "_bsy-mobile-editor__color-spectrum-
|
|
184
|
-
"bsy-mobile-editor__color-thumb": "_bsy-mobile-editor__color-
|
|
185
|
-
"bsy-mobile-editor__sheet": "_bsy-mobile-
|
|
186
|
-
"bsy-mobile-editor__sheet-body": "_bsy-mobile-editor__sheet-
|
|
187
|
-
"bsy-mobile-editor__sheet-body--stack": "_bsy-mobile-editor__sheet-body--
|
|
188
|
-
"bsy-mobile-editor__sheet-field": "_bsy-mobile-editor__sheet-
|
|
189
|
-
"bsy-mobile-editor__sheet-label": "_bsy-mobile-editor__sheet-
|
|
190
|
-
"bsy-mobile-editor__sheet-note": "_bsy-mobile-editor__sheet-
|
|
191
|
-
"bsy-mobile-editor__sheet-note--hint": "_bsy-mobile-editor__sheet-note--
|
|
192
|
-
"bsy-mobile-editor__sheet-error": "_bsy-mobile-editor__sheet-
|
|
193
|
-
"bsy-mobile-editor__sheet-bar": "_bsy-mobile-editor__sheet-
|
|
194
|
-
"bsy-mobile-editor__sheet-ok": "_bsy-mobile-editor__sheet-
|
|
195
|
-
"bsy-mobile-editor__check": "_bsy-mobile-
|
|
196
|
-
"bsy-mobile-editor__check-input": "_bsy-mobile-editor__check-
|
|
197
|
-
"bsy-mobile-editor__check-box": "_bsy-mobile-editor__check-
|
|
198
|
-
"bsy-mobile-editor__ai": "_bsy-mobile-
|
|
199
|
-
"bsy-mobile-editor__ai-body": "_bsy-mobile-editor__ai-
|
|
200
|
-
"bsy-mobile-editor__ai-section": "_bsy-mobile-editor__ai-
|
|
201
|
-
"bsy-mobile-editor__ai-section-head": "_bsy-mobile-editor__ai-section-
|
|
202
|
-
"bsy-mobile-editor__ai-section-scroll": "_bsy-mobile-editor__ai-section-
|
|
203
|
-
"bsy-mobile-editor__ai-label": "_bsy-mobile-editor__ai-
|
|
204
|
-
"bsy-mobile-editor__ai-label--after": "_bsy-mobile-editor__ai-label--
|
|
205
|
-
"bsy-mobile-editor__ai-label--before": "_bsy-mobile-editor__ai-label--
|
|
206
|
-
"bsy-mobile-editor__ai-dot": "_bsy-mobile-editor__ai-
|
|
207
|
-
"bsy-mobile-editor__ai-split": "_bsy-mobile-editor__ai-
|
|
208
|
-
"bsy-mobile-editor__ai-preset": "_bsy-mobile-editor__ai-
|
|
209
|
-
"bsy-mobile-editor__ai-think-pin": "_bsy-mobile-editor__ai-think-
|
|
210
|
-
"bsy-mobile-editor__ai-think-head": "_bsy-mobile-editor__ai-think-
|
|
211
|
-
"bsy-mobile-editor__ai-think-label": "_bsy-mobile-editor__ai-think-
|
|
212
|
-
"bsy-mobile-editor__ai-think-label--shimmer": "_bsy-mobile-editor__ai-think-label--
|
|
213
|
-
"bsy-mobile-ai-think-shimmer": "_bsy-mobile-ai-think-
|
|
214
|
-
"bsy-mobile-editor__ai-think-arrow": "_bsy-mobile-editor__ai-think-
|
|
215
|
-
"bsy-mobile-editor__ai-think-arrow--open": "_bsy-mobile-editor__ai-think-arrow--
|
|
216
|
-
"bsy-mobile-editor__ai-think-icon": "_bsy-mobile-editor__ai-think-
|
|
217
|
-
"bsy-mobile-ai-think": "_bsy-mobile-ai-
|
|
218
|
-
"bsy-mobile-editor__ai-think-body": "_bsy-mobile-editor__ai-think-
|
|
219
|
-
"bsy-mobile-editor__ai-error": "_bsy-mobile-editor__ai-
|
|
220
|
-
"bsy-mobile-editor__ai-footer": "_bsy-mobile-editor__ai-
|
|
221
|
-
"bsy-mobile-editor__ai-footer-ok": "_bsy-mobile-editor__ai-footer-
|
|
222
|
-
},
|
|
134
|
+
], vt = _t.map((e) => `.${e}`).join(","), yt = "calc(100dvh - 104px)", V = {
|
|
135
|
+
"bsy-mobile-editor": "_bsy-mobile-editor_8oz1v_2",
|
|
136
|
+
"bsy-mobile-editor__label": "_bsy-mobile-editor__label_8oz1v_15",
|
|
137
|
+
"bsy-mobile-editor__label-text": "_bsy-mobile-editor__label-text_8oz1v_20",
|
|
138
|
+
"bsy-mobile-editor__header": "_bsy-mobile-editor__header_8oz1v_29",
|
|
139
|
+
"bsy-mobile-editor__title": "_bsy-mobile-editor__title_8oz1v_39",
|
|
140
|
+
"bsy-mobile-editor__close": "_bsy-mobile-editor__close_8oz1v_49",
|
|
141
|
+
"bsy-mobile-editor__content": "_bsy-mobile-editor__content_8oz1v_63",
|
|
142
|
+
"bsy-mobile-editor__editable": "_bsy-mobile-editor__editable_8oz1v_75",
|
|
143
|
+
"bsy-mobile-editor__image-shell": "_bsy-mobile-editor__image-shell_8oz1v_245",
|
|
144
|
+
"bsy-mobile-editor__image": "_bsy-mobile-editor__image_8oz1v_245",
|
|
145
|
+
"bsy-mobile-editor__image-mask": "_bsy-mobile-editor__image-mask_8oz1v_267",
|
|
146
|
+
"bsy-mobile-editor__image-progress": "_bsy-mobile-editor__image-progress_8oz1v_276",
|
|
147
|
+
"bsy-mobile-editor__image-progress--spin": "_bsy-mobile-editor__image-progress--spin_8oz1v_279",
|
|
148
|
+
"bsy-mobile-editor-progress-spin": "_bsy-mobile-editor-progress-spin_8oz1v_1",
|
|
149
|
+
"bsy-mobile-editor__toolbar": "_bsy-mobile-editor__toolbar_8oz1v_282",
|
|
150
|
+
"bsy-mobile-editor__toolbar-scroller": "_bsy-mobile-editor__toolbar-scroller_8oz1v_297",
|
|
151
|
+
"bsy-mobile-editor__toolbar-track": "_bsy-mobile-editor__toolbar-track_8oz1v_314",
|
|
152
|
+
"bsy-mobile-editor__toolbar-thumb": "_bsy-mobile-editor__toolbar-thumb_8oz1v_326",
|
|
153
|
+
"bsy-mobile-editor__toolbar-group": "_bsy-mobile-editor__toolbar-group_8oz1v_331",
|
|
154
|
+
"bsy-mobile-editor__toolbar-divider": "_bsy-mobile-editor__toolbar-divider_8oz1v_337",
|
|
155
|
+
"bsy-mobile-editor__tool": "_bsy-mobile-editor__tool_8oz1v_282",
|
|
156
|
+
"bsy-mobile-editor__tool--active": "_bsy-mobile-editor__tool--active_8oz1v_358",
|
|
157
|
+
"bsy-mobile-editor__tool--select": "_bsy-mobile-editor__tool--select_8oz1v_365",
|
|
158
|
+
"bsy-mobile-editor__tool--select-align": "_bsy-mobile-editor__tool--select-align_8oz1v_370",
|
|
159
|
+
"bsy-mobile-editor__tool-caret": "_bsy-mobile-editor__tool-caret_8oz1v_373",
|
|
160
|
+
"bsy-mobile-editor__tool-caret--open": "_bsy-mobile-editor__tool-caret--open_8oz1v_376",
|
|
161
|
+
"bsy-mobile-editor__ai-icon": "_bsy-mobile-editor__ai-icon_8oz1v_379",
|
|
162
|
+
"bsy-mobile-editor__tool-text": "_bsy-mobile-editor__tool-text_8oz1v_384",
|
|
163
|
+
"bsy-mobile-editor__color": "_bsy-mobile-editor__color_8oz1v_389",
|
|
164
|
+
"bsy-mobile-editor__color--custom": "_bsy-mobile-editor__color--custom_8oz1v_397",
|
|
165
|
+
"bsy-mobile-editor__color-header": "_bsy-mobile-editor__color-header_8oz1v_400",
|
|
166
|
+
"bsy-mobile-editor__color-header-title": "_bsy-mobile-editor__color-header-title_8oz1v_409",
|
|
167
|
+
"bsy-mobile-editor__color-header-back": "_bsy-mobile-editor__color-header-back_8oz1v_422",
|
|
168
|
+
"bsy-mobile-editor__color-grid": "_bsy-mobile-editor__color-grid_8oz1v_436",
|
|
169
|
+
"bsy-mobile-editor__color-swatch": "_bsy-mobile-editor__color-swatch_8oz1v_443",
|
|
170
|
+
"bsy-mobile-editor__color-none": "_bsy-mobile-editor__color-none_8oz1v_443",
|
|
171
|
+
"bsy-mobile-editor__color-custom-item": "_bsy-mobile-editor__color-custom-item_8oz1v_443",
|
|
172
|
+
"bsy-mobile-editor__color-swatch--selected": "_bsy-mobile-editor__color-swatch--selected_8oz1v_459",
|
|
173
|
+
"bsy-mobile-editor__color-none--selected": "_bsy-mobile-editor__color-none--selected_8oz1v_459",
|
|
174
|
+
"bsy-mobile-editor__color-custom-item--selected": "_bsy-mobile-editor__color-custom-item--selected_8oz1v_459",
|
|
175
|
+
"bsy-mobile-editor__color-swatch-fill": "_bsy-mobile-editor__color-swatch-fill_8oz1v_473",
|
|
176
|
+
"bsy-mobile-editor__color-bar": "_bsy-mobile-editor__color-bar_8oz1v_480",
|
|
177
|
+
"bsy-mobile-editor__color-custom-trigger": "_bsy-mobile-editor__color-custom-trigger_8oz1v_486",
|
|
178
|
+
"bsy-mobile-editor__color-custom-trigger--active": "_bsy-mobile-editor__color-custom-trigger--active_8oz1v_504",
|
|
179
|
+
"bsy-mobile-editor__color-custom-trigger--preview": "_bsy-mobile-editor__color-custom-trigger--preview_8oz1v_509",
|
|
180
|
+
"bsy-mobile-editor__color-custom-list": "_bsy-mobile-editor__color-custom-list_8oz1v_524",
|
|
181
|
+
"bsy-mobile-editor__color-mixer": "_bsy-mobile-editor__color-mixer_8oz1v_544",
|
|
182
|
+
"bsy-mobile-editor__color-spectrum": "_bsy-mobile-editor__color-spectrum_8oz1v_547",
|
|
183
|
+
"bsy-mobile-editor__color-spectrum-canvas": "_bsy-mobile-editor__color-spectrum-canvas_8oz1v_555",
|
|
184
|
+
"bsy-mobile-editor__color-thumb": "_bsy-mobile-editor__color-thumb_8oz1v_562",
|
|
185
|
+
"bsy-mobile-editor__sheet": "_bsy-mobile-editor__sheet_8oz1v_572",
|
|
186
|
+
"bsy-mobile-editor__sheet-body": "_bsy-mobile-editor__sheet-body_8oz1v_578",
|
|
187
|
+
"bsy-mobile-editor__sheet-body--stack": "_bsy-mobile-editor__sheet-body--stack_8oz1v_583",
|
|
188
|
+
"bsy-mobile-editor__sheet-field": "_bsy-mobile-editor__sheet-field_8oz1v_588",
|
|
189
|
+
"bsy-mobile-editor__sheet-label": "_bsy-mobile-editor__sheet-label_8oz1v_593",
|
|
190
|
+
"bsy-mobile-editor__sheet-note": "_bsy-mobile-editor__sheet-note_8oz1v_599",
|
|
191
|
+
"bsy-mobile-editor__sheet-note--hint": "_bsy-mobile-editor__sheet-note--hint_8oz1v_605",
|
|
192
|
+
"bsy-mobile-editor__sheet-error": "_bsy-mobile-editor__sheet-error_8oz1v_608",
|
|
193
|
+
"bsy-mobile-editor__sheet-bar": "_bsy-mobile-editor__sheet-bar_8oz1v_628",
|
|
194
|
+
"bsy-mobile-editor__sheet-ok": "_bsy-mobile-editor__sheet-ok_8oz1v_649",
|
|
195
|
+
"bsy-mobile-editor__check": "_bsy-mobile-editor__check_8oz1v_654",
|
|
196
|
+
"bsy-mobile-editor__check-input": "_bsy-mobile-editor__check-input_8oz1v_666",
|
|
197
|
+
"bsy-mobile-editor__check-box": "_bsy-mobile-editor__check-box_8oz1v_673",
|
|
198
|
+
"bsy-mobile-editor__ai": "_bsy-mobile-editor__ai_8oz1v_379",
|
|
199
|
+
"bsy-mobile-editor__ai-body": "_bsy-mobile-editor__ai-body_8oz1v_695",
|
|
200
|
+
"bsy-mobile-editor__ai-section": "_bsy-mobile-editor__ai-section_8oz1v_703",
|
|
201
|
+
"bsy-mobile-editor__ai-section-head": "_bsy-mobile-editor__ai-section-head_8oz1v_711",
|
|
202
|
+
"bsy-mobile-editor__ai-section-scroll": "_bsy-mobile-editor__ai-section-scroll_8oz1v_719",
|
|
203
|
+
"bsy-mobile-editor__ai-label": "_bsy-mobile-editor__ai-label_8oz1v_726",
|
|
204
|
+
"bsy-mobile-editor__ai-label--after": "_bsy-mobile-editor__ai-label--after_8oz1v_738",
|
|
205
|
+
"bsy-mobile-editor__ai-label--before": "_bsy-mobile-editor__ai-label--before_8oz1v_742",
|
|
206
|
+
"bsy-mobile-editor__ai-dot": "_bsy-mobile-editor__ai-dot_8oz1v_746",
|
|
207
|
+
"bsy-mobile-editor__ai-split": "_bsy-mobile-editor__ai-split_8oz1v_753",
|
|
208
|
+
"bsy-mobile-editor__ai-preset": "_bsy-mobile-editor__ai-preset_8oz1v_759",
|
|
209
|
+
"bsy-mobile-editor__ai-think-pin": "_bsy-mobile-editor__ai-think-pin_8oz1v_779",
|
|
210
|
+
"bsy-mobile-editor__ai-think-head": "_bsy-mobile-editor__ai-think-head_8oz1v_783",
|
|
211
|
+
"bsy-mobile-editor__ai-think-label": "_bsy-mobile-editor__ai-think-label_8oz1v_800",
|
|
212
|
+
"bsy-mobile-editor__ai-think-label--shimmer": "_bsy-mobile-editor__ai-think-label--shimmer_8oz1v_804",
|
|
213
|
+
"bsy-mobile-ai-think-shimmer": "_bsy-mobile-ai-think-shimmer_8oz1v_1",
|
|
214
|
+
"bsy-mobile-editor__ai-think-arrow": "_bsy-mobile-editor__ai-think-arrow_8oz1v_815",
|
|
215
|
+
"bsy-mobile-editor__ai-think-arrow--open": "_bsy-mobile-editor__ai-think-arrow--open_8oz1v_822",
|
|
216
|
+
"bsy-mobile-editor__ai-think-icon": "_bsy-mobile-editor__ai-think-icon_8oz1v_825",
|
|
217
|
+
"bsy-mobile-ai-think": "_bsy-mobile-ai-think_8oz1v_1",
|
|
218
|
+
"bsy-mobile-editor__ai-think-body": "_bsy-mobile-editor__ai-think-body_8oz1v_837",
|
|
219
|
+
"bsy-mobile-editor__ai-error": "_bsy-mobile-editor__ai-error_8oz1v_846",
|
|
220
|
+
"bsy-mobile-editor__ai-footer": "_bsy-mobile-editor__ai-footer_8oz1v_851",
|
|
221
|
+
"bsy-mobile-editor__ai-footer-ok": "_bsy-mobile-editor__ai-footer-ok_8oz1v_873"
|
|
222
|
+
}, bt = {
|
|
223
223
|
typeset: [
|
|
224
224
|
"你是一名专业的 HTML 文档排版引擎。输入已是 HTML 片段。",
|
|
225
225
|
"任务:在不改内容层(措辞、语序、修辞、情感色彩)的前提下,做形式层 + 视觉层优化,充分利用富文本能力(标题、列表、加粗、字色、背景色、缩进、对齐)。",
|
|
@@ -283,7 +283,7 @@ var st = [
|
|
|
283
283
|
literary: "语气:更书面、文学感(适配小说、散文、高级文案)。\n规则:若主语言为中文,允许四字格;若为英文,允许复杂从句和排比;不改变原风格基调。",
|
|
284
284
|
retro: "语气:带一点复古书面色彩,仍保持现代可读。\n规则:仅当主语言为中文时生效:仿民国白话风(之/其/乃);其他语言自动降级为 literary。"
|
|
285
285
|
}
|
|
286
|
-
},
|
|
286
|
+
}, xt = bt.typeset.join("\n"), St = bt.polishSystem.join("\n"), Ct = (e) => `${St}\n\n【本轮风格】\n${bt.polish[e] ?? bt.polish.quick}`, wt = (e) => {
|
|
287
287
|
if (!e.trim()) return {
|
|
288
288
|
html: e,
|
|
289
289
|
blocks: []
|
|
@@ -298,16 +298,16 @@ var st = [
|
|
|
298
298
|
html: t.body.innerHTML,
|
|
299
299
|
blocks: n
|
|
300
300
|
};
|
|
301
|
-
},
|
|
301
|
+
}, Tt = "<!--bsy-block-->", Et = /<!--bsy-code-(\d+)-->/g, Dt = "bsy-html-root", Ot = (e) => new DOMParser().parseFromString(`<${Dt}>${e}</${Dt}>`, "text/html").body.querySelector(Dt), kt = (e, t) => {
|
|
302
302
|
if (!t.length) return e;
|
|
303
|
-
let n = /* @__PURE__ */ new Set(), r = e.replace(
|
|
303
|
+
let n = /* @__PURE__ */ new Set(), r = e.replace(Et, (e, r) => {
|
|
304
304
|
let i = Number(r), a = t[i];
|
|
305
305
|
return a === void 0 ? "" : (n.add(i), a);
|
|
306
306
|
}), i = t.filter((e, t) => !n.has(t)).join("");
|
|
307
307
|
return i ? `${r}${i}` : r;
|
|
308
|
-
},
|
|
308
|
+
}, At = (e) => {
|
|
309
309
|
if (!/<pre[\s>/]/i.test(e)) return e;
|
|
310
|
-
let t =
|
|
310
|
+
let t = Ot(e);
|
|
311
311
|
if (!t) return e;
|
|
312
312
|
let n = t.ownerDocument;
|
|
313
313
|
for (let e of Array.from(t.querySelectorAll("pre"))) {
|
|
@@ -315,35 +315,35 @@ var st = [
|
|
|
315
315
|
e.replaceWith(t);
|
|
316
316
|
}
|
|
317
317
|
return t.innerHTML.replace(/<!--bsy-code-dropped-->/g, "");
|
|
318
|
-
},
|
|
319
|
-
if (!e.trim() || !
|
|
320
|
-
let t =
|
|
318
|
+
}, jt = (e, t) => kt(At(e), t), Mt = "p, h1, h2, h3, li", Nt = /background(-color)?\s*:/i, Pt = (e) => {
|
|
319
|
+
if (!e.trim() || !Nt.test(e)) return e;
|
|
320
|
+
let t = Ot(e);
|
|
321
321
|
if (!t) return e;
|
|
322
|
-
for (let e of Array.from(t.querySelectorAll(
|
|
322
|
+
for (let e of Array.from(t.querySelectorAll(Mt))) {
|
|
323
323
|
let t = e;
|
|
324
324
|
t.style.removeProperty("background-color"), t.style.removeProperty("background"), t.getAttribute("style")?.trim() || t.removeAttribute("style");
|
|
325
325
|
}
|
|
326
326
|
return t.innerHTML;
|
|
327
|
-
},
|
|
327
|
+
}, Ft = "--listitem-marker-font-size", It = `max(24px, calc(var(${Ft}, 1em) * 1.25))`, Lt = new Set([
|
|
328
328
|
"U",
|
|
329
329
|
"I",
|
|
330
330
|
"EM",
|
|
331
331
|
"B",
|
|
332
332
|
"STRONG"
|
|
333
|
-
]),
|
|
334
|
-
["fontSize",
|
|
333
|
+
]), Rt = (e) => e.startsWith("--listitem-marker-"), zt = [
|
|
334
|
+
["fontSize", Ft],
|
|
335
335
|
["color", "--listitem-marker-color"],
|
|
336
336
|
["backgroundColor", "--listitem-marker-background-color"],
|
|
337
337
|
["fontFamily", "--listitem-marker-font-family"]
|
|
338
|
-
],
|
|
338
|
+
], Bt = (e) => {
|
|
339
339
|
let t = e.style.fontSize;
|
|
340
|
-
if (
|
|
341
|
-
for (let n = e.parentElement; n; n = n.parentElement) if (t &&
|
|
340
|
+
if (zt.some(([t]) => e.style[t])) {
|
|
341
|
+
for (let n = e.parentElement; n; n = n.parentElement) if (t && Lt.has(n.tagName) && !n.style.fontSize && (n.style.fontSize = t), !(n.tagName !== "LI" || n.classList.contains("editor-nested-listitem"))) for (let [t, r] of zt) {
|
|
342
342
|
let i = e.style[t];
|
|
343
343
|
i && !n.style.getPropertyValue(r) && n.style.setProperty(r, i);
|
|
344
344
|
}
|
|
345
345
|
}
|
|
346
|
-
},
|
|
346
|
+
}, Vt = (e, t, n, r) => {
|
|
347
347
|
if (!e) return;
|
|
348
348
|
let i = e.shadowRoot ?? e.attachShadow({ mode: "open" }), a = document.createElement("div");
|
|
349
349
|
a.className = "bsy-editor-html-preview__body", a.innerHTML = n(t);
|
|
@@ -354,18 +354,18 @@ var st = [
|
|
|
354
354
|
}
|
|
355
355
|
let o = document.createElement("style");
|
|
356
356
|
o.textContent = r, i.replaceChildren(o, a);
|
|
357
|
-
},
|
|
357
|
+
}, Ht = [
|
|
358
358
|
"color",
|
|
359
359
|
"background-color",
|
|
360
360
|
"font-size",
|
|
361
361
|
"font-family",
|
|
362
362
|
"font-weight",
|
|
363
363
|
"text-decoration"
|
|
364
|
-
],
|
|
364
|
+
], Ut = (e) => {
|
|
365
365
|
let t = e.body.querySelectorAll("p, h1, h2, h3, h4, h5, h6, li, td, th");
|
|
366
366
|
for (let n of Array.from(t)) {
|
|
367
367
|
let t = n, r = [];
|
|
368
|
-
for (let e of
|
|
368
|
+
for (let e of Ht) {
|
|
369
369
|
let n = t.style.getPropertyValue(e);
|
|
370
370
|
n && (r.push(`${e}: ${n}`), t.style.removeProperty(e));
|
|
371
371
|
}
|
|
@@ -383,34 +383,34 @@ var st = [
|
|
|
383
383
|
}
|
|
384
384
|
}
|
|
385
385
|
}
|
|
386
|
-
},
|
|
386
|
+
}, Wt = (e, t) => {
|
|
387
387
|
let n = F();
|
|
388
388
|
if (n.clear(), t.trim()) {
|
|
389
389
|
let r = new DOMParser().parseFromString(t, "text/html");
|
|
390
|
-
|
|
391
|
-
let i =
|
|
390
|
+
Ut(r);
|
|
391
|
+
let i = nt(e, r);
|
|
392
392
|
if (i.length) {
|
|
393
393
|
n.select(), xe(i), Oe(null);
|
|
394
394
|
return;
|
|
395
395
|
}
|
|
396
396
|
}
|
|
397
|
-
let r =
|
|
397
|
+
let r = N();
|
|
398
398
|
n.append(r), Oe(null);
|
|
399
|
-
},
|
|
399
|
+
}, Gt = (e) => {
|
|
400
400
|
if (e) {
|
|
401
401
|
F().selectStart();
|
|
402
402
|
return;
|
|
403
403
|
}
|
|
404
404
|
Oe(null);
|
|
405
|
-
},
|
|
405
|
+
}, Kt = (e) => {
|
|
406
406
|
e && Oe(e.clone());
|
|
407
|
-
},
|
|
407
|
+
}, qt = () => {
|
|
408
408
|
I() === null && F().selectStart();
|
|
409
409
|
}, H = (e) => {
|
|
410
410
|
e.isEditable() || e.setEditable(!0), e.update(() => {
|
|
411
|
-
|
|
411
|
+
qt();
|
|
412
412
|
}), e.focus(void 0, { defaultSelection: "rootStart" });
|
|
413
|
-
},
|
|
413
|
+
}, Jt = (e, t) => !t.trim() && (e === "<p><br></p>" || e === "<p></p>" || e === "" || /^<p>\s*<br>\s*<\/p>$/.test(e)), Yt = /* @__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("."), Xt = [
|
|
414
414
|
"href",
|
|
415
415
|
"src",
|
|
416
416
|
"alt",
|
|
@@ -426,12 +426,12 @@ var st = [
|
|
|
426
426
|
"style",
|
|
427
427
|
"width",
|
|
428
428
|
"height"
|
|
429
|
-
],
|
|
429
|
+
], Zt = 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.margin-inline-start.padding.padding-inline-start.line-height.list-style-type.list-style-position.list-style.border-collapse.table-layout.overflow-x.white-space.position.top.bottom.tab-size.border-radius.box-sizing.min-width.min-height.cursor".split(".")), Qt = /^(?:(?:(?:f|ht)tps?|mailto|blob):|data:image\/[a-z0-9.+-]+[;,].*|[^a-z]|[a-z+.-]+(?:[^a-z+.:-]|$))/i, $t = new Set([
|
|
430
430
|
"pre",
|
|
431
431
|
"code",
|
|
432
432
|
"td",
|
|
433
433
|
"th"
|
|
434
|
-
]),
|
|
434
|
+
]), en = new Set(["pre", "code"]), tn = new Set(["sup", "sub"]), nn = (e, t) => Rt(e) ? t === "li" : Zt.has(e) ? e === "padding-inline-start" ? !0 : e === "padding" || e.startsWith("padding-") ? $t.has(t) : e === "border-radius" ? en.has(t) : e === "position" || e === "top" || e === "bottom" ? tn.has(t) : !0 : !1, rn = (e, t) => e.split(";").map((e) => e.trim()).filter(Boolean).map((e) => {
|
|
435
435
|
let n = e.indexOf(":");
|
|
436
436
|
if (n === -1) return null;
|
|
437
437
|
let r = e.slice(0, n).trim().toLowerCase(), i = e.slice(n + 1).trim();
|
|
@@ -439,30 +439,30 @@ var st = [
|
|
|
439
439
|
if (/url\s*\(/i.test(i)) return null;
|
|
440
440
|
r = "background-color";
|
|
441
441
|
}
|
|
442
|
-
return
|
|
443
|
-
}).filter((e) => e !== null).join("; "),
|
|
444
|
-
|
|
442
|
+
return !nn(r, t) || /expression|javascript:|url\s*\(\s*['"]?\s*javascript/i.test(i) ? null : `${r}: ${i}`;
|
|
443
|
+
}).filter((e) => e !== null).join("; "), an = !1, on = () => {
|
|
444
|
+
an ||= (rt.addHook("uponSanitizeAttribute", (e, t) => {
|
|
445
445
|
if (t.attrName === "href" && /^data:/i.test(t.attrValue)) {
|
|
446
446
|
t.keepAttr = !1;
|
|
447
447
|
return;
|
|
448
448
|
}
|
|
449
|
-
t.attrName === "style" && (t.attrValue =
|
|
449
|
+
t.attrName === "style" && (t.attrValue = rn(t.attrValue, e.nodeName.toLowerCase()), t.attrValue || (t.keepAttr = !1));
|
|
450
450
|
}), !0);
|
|
451
|
-
}, U = (e) => e ? (
|
|
452
|
-
ALLOWED_TAGS:
|
|
453
|
-
ALLOWED_ATTR:
|
|
451
|
+
}, U = (e) => e ? (on(), rt.sanitize(e, {
|
|
452
|
+
ALLOWED_TAGS: Yt,
|
|
453
|
+
ALLOWED_ATTR: Xt,
|
|
454
454
|
ALLOW_DATA_ATTR: !1,
|
|
455
455
|
ADD_ATTR: [
|
|
456
456
|
"data-language",
|
|
457
457
|
"data-id",
|
|
458
458
|
"data-src"
|
|
459
459
|
],
|
|
460
|
-
ALLOWED_URI_REGEXP:
|
|
460
|
+
ALLOWED_URI_REGEXP: Qt
|
|
461
461
|
})) : "", W = {
|
|
462
462
|
margin: "0.6em 0 0.4em",
|
|
463
463
|
"font-weight": "600",
|
|
464
464
|
"line-height": "1.35"
|
|
465
|
-
},
|
|
465
|
+
}, sn = {
|
|
466
466
|
h1: {
|
|
467
467
|
...W,
|
|
468
468
|
"font-size": "2em"
|
|
@@ -487,26 +487,26 @@ var st = [
|
|
|
487
487
|
...W,
|
|
488
488
|
"font-size": "0.875em"
|
|
489
489
|
}
|
|
490
|
-
},
|
|
490
|
+
}, cn = {
|
|
491
491
|
color: "#0269ff",
|
|
492
492
|
cursor: "pointer"
|
|
493
|
-
},
|
|
493
|
+
}, ln = {
|
|
494
494
|
margin: "0",
|
|
495
495
|
"padding-inline-start": "0",
|
|
496
496
|
"list-style-position": "outside"
|
|
497
|
-
},
|
|
497
|
+
}, un = [
|
|
498
498
|
"disc",
|
|
499
499
|
"circle",
|
|
500
500
|
"square"
|
|
501
|
-
],
|
|
501
|
+
], dn = {
|
|
502
502
|
margin: "0",
|
|
503
|
-
"margin-inline-start":
|
|
503
|
+
"margin-inline-start": It,
|
|
504
504
|
"list-style": "inherit"
|
|
505
|
-
},
|
|
505
|
+
}, fn = {
|
|
506
506
|
margin: "0",
|
|
507
507
|
"margin-inline-start": "0",
|
|
508
508
|
"list-style-type": "none"
|
|
509
|
-
},
|
|
509
|
+
}, pn = {
|
|
510
510
|
display: "block",
|
|
511
511
|
"box-sizing": "border-box",
|
|
512
512
|
"max-width": "100%",
|
|
@@ -521,23 +521,23 @@ var st = [
|
|
|
521
521
|
"border-radius": "4px",
|
|
522
522
|
"background-color": "rgb(240, 242, 245)",
|
|
523
523
|
color: "#1f2328"
|
|
524
|
-
},
|
|
524
|
+
}, mn = {
|
|
525
525
|
"border-collapse": "collapse",
|
|
526
526
|
"table-layout": "fixed",
|
|
527
527
|
width: "100%",
|
|
528
528
|
"overflow-x": "auto",
|
|
529
529
|
margin: "8px 0"
|
|
530
|
-
},
|
|
530
|
+
}, hn = {
|
|
531
531
|
"box-sizing": "border-box",
|
|
532
532
|
"min-width": "75px",
|
|
533
533
|
"min-height": "32px",
|
|
534
534
|
padding: "4px 8px",
|
|
535
535
|
border: "1px solid #d9d9d9",
|
|
536
536
|
"vertical-align": "top"
|
|
537
|
-
},
|
|
537
|
+
}, gn = {
|
|
538
538
|
"font-weight": "600",
|
|
539
539
|
"background-color": "#f2f3f5"
|
|
540
|
-
},
|
|
540
|
+
}, _n = {
|
|
541
541
|
display: "inline-block",
|
|
542
542
|
position: "static",
|
|
543
543
|
top: "auto",
|
|
@@ -546,39 +546,39 @@ var st = [
|
|
|
546
546
|
"line-height": "1"
|
|
547
547
|
}, G = (e, t) => {
|
|
548
548
|
for (let [n, r] of Object.entries(t)) e.style.getPropertyValue(n) || e.style.setProperty(n, r);
|
|
549
|
-
},
|
|
549
|
+
}, vn = (e) => {
|
|
550
550
|
let t = 0, n = e;
|
|
551
551
|
for (; n;) n.tagName === "UL" && (t += 1), n = n.parentElement;
|
|
552
552
|
return t;
|
|
553
|
-
},
|
|
553
|
+
}, yn = (e) => {
|
|
554
554
|
let t = [...e.querySelectorAll("*")].filter((e) => e instanceof HTMLElement);
|
|
555
|
-
for (let e of t)
|
|
555
|
+
for (let e of t) Bt(e);
|
|
556
556
|
for (let e of t) {
|
|
557
|
-
let t = e.tagName.toLowerCase(), n =
|
|
558
|
-
if (n && G(e, n), t === "a" && G(e,
|
|
559
|
-
let t = Math.min(Math.max(
|
|
557
|
+
let t = e.tagName.toLowerCase(), n = sn[t];
|
|
558
|
+
if (n && G(e, n), t === "a" && G(e, cn), t === "ul") {
|
|
559
|
+
let t = Math.min(Math.max(vn(e), 1), un.length);
|
|
560
560
|
G(e, {
|
|
561
|
-
...
|
|
562
|
-
"list-style-type":
|
|
561
|
+
...ln,
|
|
562
|
+
"list-style-type": un[t - 1]
|
|
563
563
|
});
|
|
564
564
|
}
|
|
565
565
|
t === "ol" && G(e, {
|
|
566
|
-
...
|
|
566
|
+
...ln,
|
|
567
567
|
"list-style-type": "decimal"
|
|
568
|
-
}), t === "li" && G(e, e.classList.contains("editor-nested-listitem") ?
|
|
569
|
-
...
|
|
568
|
+
}), t === "li" && G(e, e.classList.contains("editor-nested-listitem") ? fn : dn), t === "pre" && G(e, pn), (t === "sup" || t === "sub") && G(e, {
|
|
569
|
+
..._n,
|
|
570
570
|
"vertical-align": t === "sup" ? "super" : "sub"
|
|
571
|
-
}), t === "table" && G(e,
|
|
571
|
+
}), t === "table" && G(e, mn), (t === "td" || t === "th") && (G(e, hn), (t === "th" || e.classList.contains("editor-table-cell-header")) && G(e, gn)), e.classList.contains("editor-text-underline-strikethrough") ? G(e, { "text-decoration": "underline line-through" }) : e.classList.contains("editor-text-underline") ? G(e, { "text-decoration": "underline" }) : e.classList.contains("editor-text-strikethrough") && G(e, { "text-decoration": "line-through" });
|
|
572
572
|
for (let t of Array.from(e.classList)) t.startsWith("editor-") && e.classList.remove(t);
|
|
573
573
|
e.classList.length === 0 && e.removeAttribute("class");
|
|
574
574
|
}
|
|
575
|
-
},
|
|
575
|
+
}, bn = (e) => {
|
|
576
576
|
let t = e.parentNode;
|
|
577
577
|
if (t) {
|
|
578
578
|
for (; e.firstChild;) t.insertBefore(e.firstChild, e);
|
|
579
579
|
t.removeChild(e);
|
|
580
580
|
}
|
|
581
|
-
},
|
|
581
|
+
}, xn = (e) => {
|
|
582
582
|
let t = !0;
|
|
583
583
|
for (; t;) {
|
|
584
584
|
t = !1;
|
|
@@ -586,21 +586,21 @@ var st = [
|
|
|
586
586
|
if (n.attributes.length > 0) continue;
|
|
587
587
|
let e = n.tagName.toLowerCase();
|
|
588
588
|
if (e === "span") {
|
|
589
|
-
|
|
589
|
+
bn(n), t = !0;
|
|
590
590
|
continue;
|
|
591
591
|
}
|
|
592
592
|
if (n.childElementCount !== 1 || n.childNodes.length !== 1) continue;
|
|
593
593
|
let r = n.firstElementChild;
|
|
594
|
-
(e === "b" && r?.tagName === "STRONG" || e === "i" && r?.tagName === "EM") && (
|
|
594
|
+
(e === "b" && r?.tagName === "STRONG" || e === "i" && r?.tagName === "EM") && (bn(n), t = !0);
|
|
595
595
|
}
|
|
596
596
|
}
|
|
597
|
-
},
|
|
597
|
+
}, Sn = (e) => {
|
|
598
598
|
if (!e.trim()) return e;
|
|
599
599
|
let t = new DOMParser().parseFromString(e, "text/html");
|
|
600
|
-
|
|
600
|
+
yn(t.body), xn(t.body);
|
|
601
601
|
for (let e of Array.from(t.body.querySelectorAll("pre"))) e.textContent?.trim() || e.remove();
|
|
602
602
|
return t.body.innerHTML;
|
|
603
|
-
},
|
|
603
|
+
}, Cn = (e) => e ? new DOMParser().parseFromString(e, "text/html").body.textContent ?? "" : "", wn = (e) => e.includes("<!--bsy-block-->") ? e.split(Tt).map((e) => e.trim()) : [e], Tn = (e) => e.split(Tt).join("").trim().length > 0, En = (e, t) => {
|
|
604
604
|
let n = e.map(() => "");
|
|
605
605
|
if (e.length === 0) return n;
|
|
606
606
|
let r = [], i = [];
|
|
@@ -613,7 +613,7 @@ var st = [
|
|
|
613
613
|
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);
|
|
614
614
|
for (; d < c;) n[n.length - 1] += o[d], d += 1;
|
|
615
615
|
return n;
|
|
616
|
-
},
|
|
616
|
+
}, Dn = new Set([
|
|
617
617
|
"TABLE",
|
|
618
618
|
"THEAD",
|
|
619
619
|
"TBODY",
|
|
@@ -622,7 +622,7 @@ var st = [
|
|
|
622
622
|
"TH",
|
|
623
623
|
"IMG",
|
|
624
624
|
"BR"
|
|
625
|
-
]),
|
|
625
|
+
]), On = (e) => {
|
|
626
626
|
let t = [], n = (e) => {
|
|
627
627
|
if (e.nodeType === Node.ELEMENT_NODE) {
|
|
628
628
|
if (e.tagName === "PRE") return;
|
|
@@ -632,25 +632,25 @@ var st = [
|
|
|
632
632
|
e.nodeType === Node.TEXT_NODE && t.push(e);
|
|
633
633
|
};
|
|
634
634
|
return n(e), t;
|
|
635
|
-
},
|
|
635
|
+
}, kn = (e, t) => {
|
|
636
636
|
let n = e;
|
|
637
|
-
for (; n && n !== t && !
|
|
637
|
+
for (; n && n !== t && !Dn.has(n.tagName) && !(n.textContent ?? "").trim() && !n.querySelector("img, table, br");) {
|
|
638
638
|
let e = n.parentElement;
|
|
639
639
|
n.remove(), n = e;
|
|
640
640
|
}
|
|
641
|
-
},
|
|
641
|
+
}, An = (e) => {
|
|
642
642
|
let t = e.tagName;
|
|
643
643
|
return t === "IMG" || t === "TABLE" || t === "PRE";
|
|
644
|
-
},
|
|
645
|
-
let t =
|
|
646
|
-
return t ? Array.from(t.children).filter((e) => !
|
|
647
|
-
},
|
|
648
|
-
let n =
|
|
644
|
+
}, jn = (e) => {
|
|
645
|
+
let t = Ot(e);
|
|
646
|
+
return t ? Array.from(t.children).filter((e) => !An(e)).map((e) => e.textContent ?? "") : [];
|
|
647
|
+
}, Mn = (e) => e.includes("<!--bsy-block-->") ? e : Cn(e) || e, Nn = (e, t) => {
|
|
648
|
+
let n = On(e);
|
|
649
649
|
if (n.length === 0) {
|
|
650
650
|
t && (e.querySelector("br")?.remove(), e.append(e.ownerDocument.createTextNode(t)));
|
|
651
651
|
return;
|
|
652
652
|
}
|
|
653
|
-
let r =
|
|
653
|
+
let r = En(n.map((e) => e.textContent ?? ""), t);
|
|
654
654
|
for (let t = 0; t < n.length; t++) {
|
|
655
655
|
let i = r[t], a = n[t];
|
|
656
656
|
if (i) {
|
|
@@ -658,51 +658,51 @@ var st = [
|
|
|
658
658
|
continue;
|
|
659
659
|
}
|
|
660
660
|
let o = a.parentElement;
|
|
661
|
-
a.remove(),
|
|
661
|
+
a.remove(), kn(o, e);
|
|
662
662
|
}
|
|
663
|
-
},
|
|
664
|
-
let n =
|
|
665
|
-
if (!
|
|
666
|
-
let r =
|
|
663
|
+
}, Pn = (e, t) => {
|
|
664
|
+
let n = Mn(t);
|
|
665
|
+
if (!Tn(n) || !e.trim()) return "";
|
|
666
|
+
let r = Ot(e);
|
|
667
667
|
if (!r) return "";
|
|
668
|
-
let i = Array.from(r.children).filter((e) => !
|
|
668
|
+
let i = Array.from(r.children).filter((e) => !An(e));
|
|
669
669
|
if (i.length === 0) return "";
|
|
670
|
-
let a =
|
|
671
|
-
for (let e = 0; e < i.length; e++)
|
|
670
|
+
let a = wn(n), o = a.length === i.length ? a : En(i.map((e) => e.textContent ?? ""), a.join(""));
|
|
671
|
+
for (let e = 0; e < i.length; e++) Nn(i[e], o[e] ?? "");
|
|
672
672
|
return r.innerHTML;
|
|
673
|
-
},
|
|
673
|
+
}, Fn = (e, t) => {
|
|
674
674
|
let n = "";
|
|
675
675
|
e.getEditorState().read(() => {
|
|
676
|
-
n =
|
|
676
|
+
n = Sn(U(tt(e, null)));
|
|
677
677
|
}, { editor: e });
|
|
678
|
-
let r = U(
|
|
679
|
-
return !r.trim() ||
|
|
680
|
-
|
|
678
|
+
let r = U(Pn(n, t));
|
|
679
|
+
return !r.trim() || Jt(r, Cn(r)) ? !1 : (e.update(() => {
|
|
680
|
+
Wt(e, r), Gt(!0);
|
|
681
681
|
}, { discrete: !0 }), !0);
|
|
682
|
-
},
|
|
682
|
+
}, In = /^\uFEFF/, Ln = /^ {0,3}`{1,3}[A-Za-z]*$/, Rn = /^( {0,3})([^`<]*?)```[ \t]*([A-Za-z0-9_-]*)[ \t]*(.*)$/, zn = /^ {0,3}```[ \t]*$/, Bn = /<\/?[a-zA-Z]/, Vn = /<[a-zA-Z!]/, Hn = (e) => Vn.test(e), Un = (e) => Bn.test(e), Wn = (e) => e.replace(In, "").replace(/\r\n/g, "\n"), Gn = (e) => {
|
|
683
683
|
let t = e.replace(/\n+$/, ""), n = t.lastIndexOf("\n"), r = n === -1 ? t : t.slice(n + 1);
|
|
684
|
-
return
|
|
684
|
+
return Ln.test(r) ? {
|
|
685
685
|
text: n === -1 ? "" : t.slice(0, n),
|
|
686
686
|
withheld: !0
|
|
687
687
|
} : {
|
|
688
688
|
text: e,
|
|
689
689
|
withheld: !1
|
|
690
690
|
};
|
|
691
|
-
},
|
|
692
|
-
let t =
|
|
691
|
+
}, Kn = (e) => {
|
|
692
|
+
let t = Rn.exec(e);
|
|
693
693
|
return t ? { sameLineBody: t[4] ?? "" } : null;
|
|
694
|
-
},
|
|
694
|
+
}, qn = (e) => {
|
|
695
695
|
let t = e.replace(/[ \t]*```[ \t]*$/, "");
|
|
696
696
|
return t === e ? e : t;
|
|
697
|
-
},
|
|
697
|
+
}, Jn = (e) => Hn(e) ? e.replace(/^\n/, "") : "", Yn = (e) => {
|
|
698
698
|
let t = e.split("\n"), n = [], r = 0;
|
|
699
699
|
for (; r < t.length;) {
|
|
700
|
-
let e = t[r], i =
|
|
700
|
+
let e = t[r], i = Kn(e);
|
|
701
701
|
if (i) {
|
|
702
702
|
let e = i.sameLineBody;
|
|
703
|
-
if (e !==
|
|
704
|
-
e =
|
|
705
|
-
let i =
|
|
703
|
+
if (e !== qn(e)) {
|
|
704
|
+
e = qn(e);
|
|
705
|
+
let i = Jn(t.slice(r + 1).join("\n"));
|
|
706
706
|
return [
|
|
707
707
|
...n,
|
|
708
708
|
e,
|
|
@@ -710,63 +710,63 @@ var st = [
|
|
|
710
710
|
].filter(Boolean).join("\n");
|
|
711
711
|
}
|
|
712
712
|
let a = [];
|
|
713
|
-
for (e && a.push(e), r += 1; r < t.length && !
|
|
714
|
-
let o = r < t.length ?
|
|
713
|
+
for (e && a.push(e), r += 1; r < t.length && !zn.test(t[r]);) a.push(t[r]), r += 1;
|
|
714
|
+
let o = r < t.length ? Jn(t.slice(r + 1).join("\n")) : "";
|
|
715
715
|
return [
|
|
716
716
|
...n,
|
|
717
717
|
a.join("\n"),
|
|
718
718
|
o
|
|
719
719
|
].filter(Boolean).join("\n");
|
|
720
720
|
}
|
|
721
|
-
if (
|
|
722
|
-
|
|
721
|
+
if (Un(e)) return Xn([...n, ...t.slice(r)].join("\n"));
|
|
722
|
+
Hn(e) && n.push(e), r += 1;
|
|
723
723
|
}
|
|
724
724
|
return n.length ? n.join("\n") : null;
|
|
725
|
-
},
|
|
725
|
+
}, Xn = (e) => {
|
|
726
726
|
let t = e.split("\n");
|
|
727
727
|
if (!t.length) return e;
|
|
728
|
-
let n =
|
|
729
|
-
return n && !
|
|
730
|
-
},
|
|
728
|
+
let n = Kn(t[0]);
|
|
729
|
+
return n && !Un(t[0].slice(0, t[0].indexOf("```"))) && (t.shift(), n.sameLineBody && t.unshift(qn(n.sameLineBody))), t.length && zn.test(t[t.length - 1] ?? "") && t.pop(), t.join("\n");
|
|
730
|
+
}, Zn = (e) => {
|
|
731
731
|
if (!e) return {
|
|
732
732
|
html: "",
|
|
733
733
|
pending: !1
|
|
734
734
|
};
|
|
735
|
-
let { text: t, withheld: n } =
|
|
735
|
+
let { text: t, withheld: n } = Gn(Wn(e));
|
|
736
736
|
if (!t.trim()) return {
|
|
737
737
|
html: "",
|
|
738
|
-
pending: n ||
|
|
738
|
+
pending: n || Ln.test(Wn(e).trim())
|
|
739
739
|
};
|
|
740
|
-
let r =
|
|
740
|
+
let r = Yn(t) ?? t, i = Yn(r);
|
|
741
741
|
i !== null && i !== r && (r = i);
|
|
742
742
|
let a = r.trim();
|
|
743
|
-
return
|
|
743
|
+
return Hn(a) ? {
|
|
744
744
|
html: a,
|
|
745
745
|
pending: !1
|
|
746
746
|
} : {
|
|
747
747
|
html: "",
|
|
748
748
|
pending: !0
|
|
749
749
|
};
|
|
750
|
-
},
|
|
751
|
-
let { html: n } =
|
|
752
|
-
return n ? jt(
|
|
750
|
+
}, Qn = (e, t) => {
|
|
751
|
+
let { html: n } = Zn(e);
|
|
752
|
+
return n ? Pt(jt(n, t)) : "";
|
|
753
753
|
};
|
|
754
754
|
//#endregion
|
|
755
755
|
//#region src/components/Editor/utils/applyAiTypeset.ts
|
|
756
|
-
function
|
|
757
|
-
let r = U(
|
|
758
|
-
return !r.trim() ||
|
|
759
|
-
|
|
756
|
+
function $n(e, t, n) {
|
|
757
|
+
let r = U(Qn(t, n));
|
|
758
|
+
return !r.trim() || Jt(r, "") ? { applied: !1 } : (e.update(() => {
|
|
759
|
+
Wt(e, r), Gt(!0);
|
|
760
760
|
}, { discrete: !0 }), { applied: !0 });
|
|
761
761
|
}
|
|
762
762
|
//#endregion
|
|
763
763
|
//#region src/components/Editor/utils/readEditorAiSnapshot.ts
|
|
764
|
-
var
|
|
764
|
+
var er = (e) => {
|
|
765
765
|
let t = "", n = "", r = "";
|
|
766
766
|
e.getEditorState().read(() => {
|
|
767
|
-
n = F().getTextContent(), t =
|
|
767
|
+
n = F().getTextContent(), t = Sn(U(tt(e, null))), r = jn(t).join(`\n\n${Tt}\n\n`);
|
|
768
768
|
}, { editor: e });
|
|
769
|
-
let i =
|
|
769
|
+
let i = wt(t);
|
|
770
770
|
return {
|
|
771
771
|
html: t,
|
|
772
772
|
text: n,
|
|
@@ -774,7 +774,7 @@ var Zn = (e) => {
|
|
|
774
774
|
htmlWithoutCode: i.html,
|
|
775
775
|
codeBlocks: i.blocks
|
|
776
776
|
};
|
|
777
|
-
},
|
|
777
|
+
}, tr = ({ editor: e, ai: t }) => {
|
|
778
778
|
let n = u(t);
|
|
779
779
|
n.current = t;
|
|
780
780
|
let [r, i] = d(null), [a, o] = d({
|
|
@@ -784,18 +784,18 @@ var Zn = (e) => {
|
|
|
784
784
|
htmlWithoutCode: "",
|
|
785
785
|
codeBlocks: []
|
|
786
786
|
}), [s, c] = d("quick"), l = () => {
|
|
787
|
-
let t =
|
|
787
|
+
let t = er(e);
|
|
788
788
|
o(t), i("typeset"), n.current?.typeset?.({
|
|
789
789
|
html: t.htmlWithoutCode,
|
|
790
790
|
text: t.text,
|
|
791
|
-
prompt:
|
|
791
|
+
prompt: xt
|
|
792
792
|
});
|
|
793
793
|
}, f = (t) => {
|
|
794
|
-
let r =
|
|
794
|
+
let r = er(e);
|
|
795
795
|
o(r), c(t), i("polish"), n.current?.stop?.(), n.current?.polish?.({
|
|
796
796
|
text: r.polishText,
|
|
797
797
|
preset: t,
|
|
798
|
-
prompt:
|
|
798
|
+
prompt: Ct(t)
|
|
799
799
|
});
|
|
800
800
|
}, p = () => {
|
|
801
801
|
n.current?.stop?.(), i(null);
|
|
@@ -809,11 +809,11 @@ var Zn = (e) => {
|
|
|
809
809
|
close: p,
|
|
810
810
|
apply: () => {
|
|
811
811
|
let t = n.current?.text ?? "";
|
|
812
|
-
r === "typeset" ?
|
|
812
|
+
r === "typeset" ? $n(e, t, a.codeBlocks) : r === "polish" && Fn(e, t), p();
|
|
813
813
|
}
|
|
814
814
|
};
|
|
815
|
-
},
|
|
816
|
-
let a = o(
|
|
815
|
+
}, nr = i({}), K = 36, rr = 14, ir = 2 * Math.PI * rr, ar = ({ nodeKey: e, src: t, altText: n, dataId: r, dataSrc: i }) => {
|
|
816
|
+
let a = o(nr), s = e in a, c = a[e];
|
|
817
817
|
return /* @__PURE__ */ m("span", {
|
|
818
818
|
className: V["bsy-mobile-editor__image"],
|
|
819
819
|
children: [/* @__PURE__ */ p("img", {
|
|
@@ -837,26 +837,26 @@ var Zn = (e) => {
|
|
|
837
837
|
children: [/* @__PURE__ */ p("circle", {
|
|
838
838
|
cx: K / 2,
|
|
839
839
|
cy: K / 2,
|
|
840
|
-
r:
|
|
840
|
+
r: rr,
|
|
841
841
|
fill: "none",
|
|
842
842
|
stroke: "rgba(255,255,255,0.35)",
|
|
843
843
|
strokeWidth: "3"
|
|
844
844
|
}), /* @__PURE__ */ p("circle", {
|
|
845
845
|
cx: K / 2,
|
|
846
846
|
cy: K / 2,
|
|
847
|
-
r:
|
|
847
|
+
r: rr,
|
|
848
848
|
fill: "none",
|
|
849
849
|
stroke: "#fff",
|
|
850
850
|
strokeWidth: "3",
|
|
851
851
|
strokeLinecap: "round",
|
|
852
|
-
strokeDasharray: c === void 0 ? `${
|
|
853
|
-
strokeDashoffset: c === void 0 ? 0 :
|
|
852
|
+
strokeDasharray: c === void 0 ? `${ir * .25} ${ir}` : ir,
|
|
853
|
+
strokeDashoffset: c === void 0 ? 0 : ir * (1 - c / 100),
|
|
854
854
|
transform: `rotate(-90 ${K / 2} ${K / 2})`
|
|
855
855
|
})]
|
|
856
856
|
})
|
|
857
857
|
}) : null]
|
|
858
858
|
});
|
|
859
|
-
},
|
|
859
|
+
}, or = class e extends Pe {
|
|
860
860
|
__src;
|
|
861
861
|
__altText;
|
|
862
862
|
__width;
|
|
@@ -896,13 +896,13 @@ var Zn = (e) => {
|
|
|
896
896
|
}
|
|
897
897
|
static importDOM() {
|
|
898
898
|
return { img: () => ({
|
|
899
|
-
conversion:
|
|
899
|
+
conversion: lr,
|
|
900
900
|
priority: 0
|
|
901
901
|
}) };
|
|
902
902
|
}
|
|
903
903
|
static importJSON(e) {
|
|
904
904
|
let { src: t, altText: n, width: r, height: i, dataId: a, dataSrc: o } = e;
|
|
905
|
-
return
|
|
905
|
+
return cr({
|
|
906
906
|
src: t,
|
|
907
907
|
altText: n,
|
|
908
908
|
width: r,
|
|
@@ -927,7 +927,7 @@ var Zn = (e) => {
|
|
|
927
927
|
return !0;
|
|
928
928
|
}
|
|
929
929
|
decorate() {
|
|
930
|
-
return /* @__PURE__ */ p(
|
|
930
|
+
return /* @__PURE__ */ p(ar, {
|
|
931
931
|
nodeKey: this.getKey(),
|
|
932
932
|
src: this.__src,
|
|
933
933
|
altText: this.__altText,
|
|
@@ -935,7 +935,7 @@ var Zn = (e) => {
|
|
|
935
935
|
dataSrc: this.__dataSrc
|
|
936
936
|
});
|
|
937
937
|
}
|
|
938
|
-
},
|
|
938
|
+
}, sr = (e) => e instanceof or, cr = ({ src: e, altText: t, width: n, height: r, dataId: i, dataSrc: a, key: o }) => new or(e, t, n, r, o, i, a), lr = (e) => {
|
|
939
939
|
if (!(e instanceof HTMLImageElement)) return null;
|
|
940
940
|
let { src: t, alt: n, style: r } = e, i, a;
|
|
941
941
|
if (r.width) {
|
|
@@ -946,7 +946,7 @@ var Zn = (e) => {
|
|
|
946
946
|
let e = parseInt(r.height, 10);
|
|
947
947
|
Number.isNaN(e) || (a = e);
|
|
948
948
|
}
|
|
949
|
-
return i === void 0 && e.width && (i = e.width), a === void 0 && e.height && (a = e.height), { node:
|
|
949
|
+
return i === void 0 && e.width && (i = e.width), a === void 0 && e.height && (a = e.height), { node: cr({
|
|
950
950
|
src: t,
|
|
951
951
|
altText: n,
|
|
952
952
|
width: i,
|
|
@@ -954,7 +954,7 @@ var Zn = (e) => {
|
|
|
954
954
|
dataId: e.getAttribute("data-id") || void 0,
|
|
955
955
|
dataSrc: e.getAttribute("data-src") || void 0
|
|
956
956
|
}) };
|
|
957
|
-
},
|
|
957
|
+
}, ur = (e) => _t.includes(e.name.split(".").pop()?.toLowerCase() ?? ""), dr = (e) => ur(e) ? e.size > 5242880 ? "size" : null : "type", fr = ({ editor: e, upload: t, savedSelectionRef: n, attachmentsBySrc: r }) => {
|
|
958
958
|
let i = u(null), o = u(null), c = u(!0), [l, f] = d({}), p = a(() => {
|
|
959
959
|
o.current?.abort(), o.current = null;
|
|
960
960
|
}, []);
|
|
@@ -964,8 +964,8 @@ var Zn = (e) => {
|
|
|
964
964
|
let m = a((t, r, i) => {
|
|
965
965
|
let a = "";
|
|
966
966
|
return e.update(() => {
|
|
967
|
-
|
|
968
|
-
let e =
|
|
967
|
+
Kt(n.current), I() === null && F().selectEnd();
|
|
968
|
+
let e = cr({
|
|
969
969
|
src: t,
|
|
970
970
|
altText: r,
|
|
971
971
|
dataSrc: i
|
|
@@ -980,7 +980,7 @@ var Zn = (e) => {
|
|
|
980
980
|
insertImage: m,
|
|
981
981
|
onFileChange: a(async (n) => {
|
|
982
982
|
let i = n.target.files?.[0];
|
|
983
|
-
if (n.target.value = "", !i ||
|
|
983
|
+
if (n.target.value = "", !i || dr(i)) return;
|
|
984
984
|
p();
|
|
985
985
|
let a = new AbortController();
|
|
986
986
|
if (o.current = a, !t?.customRequest) {
|
|
@@ -1005,7 +1005,7 @@ var Zn = (e) => {
|
|
|
1005
1005
|
}));
|
|
1006
1006
|
let u = !1, d = (t) => {
|
|
1007
1007
|
u || (u = !0, URL.revokeObjectURL(s), t || e.update(() => {
|
|
1008
|
-
|
|
1008
|
+
P(l)?.remove();
|
|
1009
1009
|
}, c.current ? void 0 : { discrete: !0 }), c.current && f((e) => {
|
|
1010
1010
|
let t = { ...e };
|
|
1011
1011
|
return delete t[l], t;
|
|
@@ -1034,8 +1034,8 @@ var Zn = (e) => {
|
|
|
1034
1034
|
return;
|
|
1035
1035
|
}
|
|
1036
1036
|
e.update(() => {
|
|
1037
|
-
let e =
|
|
1038
|
-
|
|
1037
|
+
let e = P(l);
|
|
1038
|
+
sr(e) && (e.setSrc(o), s && e.setDataId(s));
|
|
1039
1039
|
}), d(!0);
|
|
1040
1040
|
} catch {
|
|
1041
1041
|
d(!1);
|
|
@@ -1049,7 +1049,7 @@ var Zn = (e) => {
|
|
|
1049
1049
|
]),
|
|
1050
1050
|
abortUpload: p
|
|
1051
1051
|
};
|
|
1052
|
-
},
|
|
1052
|
+
}, pr = ({ editor: e, savedSelectionRef: t, captureSelection: n }) => {
|
|
1053
1053
|
let [r, i] = d(null);
|
|
1054
1054
|
return {
|
|
1055
1055
|
linkForm: r,
|
|
@@ -1076,7 +1076,7 @@ var Zn = (e) => {
|
|
|
1076
1076
|
if (!r) return;
|
|
1077
1077
|
let a = r.startsWith("@") || /^https?:\/\//.test(r) ? r : `http://${r}`;
|
|
1078
1078
|
e.update(() => {
|
|
1079
|
-
|
|
1079
|
+
Kt(t.current);
|
|
1080
1080
|
let e = I(), r = n.newBlank ? {
|
|
1081
1081
|
target: "_blank",
|
|
1082
1082
|
rel: "noopener noreferrer",
|
|
@@ -1086,16 +1086,16 @@ var Zn = (e) => {
|
|
|
1086
1086
|
let t = n.text.trim() || n.url;
|
|
1087
1087
|
if (e.getTextContent()) y(a, r);
|
|
1088
1088
|
else {
|
|
1089
|
-
let n =
|
|
1089
|
+
let n = be(t), i = _(a, r);
|
|
1090
1090
|
i.append(n), e.insertNodes([i]);
|
|
1091
1091
|
}
|
|
1092
1092
|
} else {
|
|
1093
|
-
let e =
|
|
1093
|
+
let e = be(n.text.trim() || n.url), t = _(a, r);
|
|
1094
1094
|
t.append(e);
|
|
1095
1095
|
let i = F(), o = i.getLastChild();
|
|
1096
1096
|
if (Se(o)) o.append(t);
|
|
1097
1097
|
else {
|
|
1098
|
-
let e =
|
|
1098
|
+
let e = N();
|
|
1099
1099
|
e.append(t), i.append(e);
|
|
1100
1100
|
}
|
|
1101
1101
|
}
|
|
@@ -1103,14 +1103,14 @@ var Zn = (e) => {
|
|
|
1103
1103
|
},
|
|
1104
1104
|
closeLink: () => i(null)
|
|
1105
1105
|
};
|
|
1106
|
-
},
|
|
1106
|
+
}, mr = ({ editor: e, value: t, onChange: n, attachmentsBySrc: r }) => {
|
|
1107
1107
|
let i = u(null), o = u(n);
|
|
1108
1108
|
o.current = n;
|
|
1109
1109
|
let c = a((t) => {
|
|
1110
1110
|
t.read(() => {
|
|
1111
|
-
let n = F().getTextContent(), a =
|
|
1111
|
+
let n = F().getTextContent(), a = Sn(U(tt(e, null))), s = Jt(a, n) ? null : a;
|
|
1112
1112
|
i.current = s;
|
|
1113
|
-
let c = Ee(
|
|
1113
|
+
let c = Ee(or).map((e) => r.get(e.getSrc())).filter((e) => e !== void 0);
|
|
1114
1114
|
o.current({
|
|
1115
1115
|
text: n,
|
|
1116
1116
|
html: s,
|
|
@@ -1120,7 +1120,7 @@ var Zn = (e) => {
|
|
|
1120
1120
|
}, [r, e]);
|
|
1121
1121
|
return s(() => {
|
|
1122
1122
|
t === void 0 || t === i.current || (i.current = t ?? null, e.update(() => {
|
|
1123
|
-
|
|
1123
|
+
Wt(e, t?.trim() ? U(t) : ""), Gt(!!e.getRootElement()?.contains(document.activeElement));
|
|
1124
1124
|
}, { onUpdate: () => {
|
|
1125
1125
|
e.getRootElement() || c(e.getEditorState());
|
|
1126
1126
|
} }));
|
|
@@ -1129,20 +1129,20 @@ var Zn = (e) => {
|
|
|
1129
1129
|
c,
|
|
1130
1130
|
t
|
|
1131
1131
|
]), c;
|
|
1132
|
-
},
|
|
1132
|
+
}, hr = 250, gr = () => {
|
|
1133
1133
|
let [e] = z(), t = u(0);
|
|
1134
|
-
return s(() => e.registerCommand(
|
|
1134
|
+
return s(() => e.registerCommand(ze, (e) => {
|
|
1135
1135
|
let n = Date.now(), r = n - t.current;
|
|
1136
|
-
if (t.current = n, r <= 0 || r >=
|
|
1136
|
+
if (t.current = n, r <= 0 || r >= hr) return !1;
|
|
1137
1137
|
let i = I();
|
|
1138
1138
|
if (!L(i) || !i.isCollapsed()) return !1;
|
|
1139
1139
|
let a = i.anchor.getNode();
|
|
1140
|
-
if (B(a,
|
|
1140
|
+
if (B(a, x)) return !1;
|
|
1141
1141
|
let o = a.getTopLevelElement();
|
|
1142
1142
|
if (!o || o.getTextContent().trim() !== "") return !1;
|
|
1143
1143
|
i.setFormat(0);
|
|
1144
|
-
let s =
|
|
1145
|
-
|
|
1144
|
+
let s = N();
|
|
1145
|
+
st(i, {
|
|
1146
1146
|
"background-color": "",
|
|
1147
1147
|
color: "",
|
|
1148
1148
|
"font-size": "",
|
|
@@ -1152,23 +1152,23 @@ var Zn = (e) => {
|
|
|
1152
1152
|
}), o.replace(s), s.select();
|
|
1153
1153
|
let c = s.getPreviousSibling();
|
|
1154
1154
|
return c?.getTextContent().trim() === "" && c.remove(), e?.preventDefault(), !0;
|
|
1155
|
-
},
|
|
1156
|
-
},
|
|
1155
|
+
}, je), [e]), null;
|
|
1156
|
+
}, _r = (e, t) => e.split(";").map((e) => e.trim()).filter((e) => e && e.split(":")[0].trim().toLowerCase() !== t).join("; "), vr = () => {
|
|
1157
1157
|
let [e] = z();
|
|
1158
|
-
return s(() => e.registerNodeTransform(
|
|
1158
|
+
return s(() => e.registerNodeTransform(oe, (e) => {
|
|
1159
1159
|
let t = e.getTag();
|
|
1160
1160
|
if (t === "h4" || t === "h5" || t === "h6") {
|
|
1161
|
-
e.replace(
|
|
1161
|
+
e.replace(N(), !0);
|
|
1162
1162
|
return;
|
|
1163
1163
|
}
|
|
1164
1164
|
for (let t of e.getAllTextNodes()) {
|
|
1165
1165
|
let e = t.getStyle();
|
|
1166
1166
|
if (!e) continue;
|
|
1167
|
-
let n =
|
|
1167
|
+
let n = _r(e, "font-size");
|
|
1168
1168
|
n !== e && t.setStyle(n);
|
|
1169
1169
|
}
|
|
1170
1170
|
}), [e]), null;
|
|
1171
|
-
}, q = class e extends
|
|
1171
|
+
}, q = class e extends Ge {
|
|
1172
1172
|
static getType() {
|
|
1173
1173
|
return "extended-text";
|
|
1174
1174
|
}
|
|
@@ -1176,7 +1176,7 @@ var Zn = (e) => {
|
|
|
1176
1176
|
return new e(t.__text, t.__key);
|
|
1177
1177
|
}
|
|
1178
1178
|
static importDOM() {
|
|
1179
|
-
let e =
|
|
1179
|
+
let e = Ge.importDOM();
|
|
1180
1180
|
return {
|
|
1181
1181
|
...e,
|
|
1182
1182
|
code: () => ({
|
|
@@ -1206,7 +1206,7 @@ var Zn = (e) => {
|
|
|
1206
1206
|
};
|
|
1207
1207
|
}
|
|
1208
1208
|
static importJSON(e) {
|
|
1209
|
-
return
|
|
1209
|
+
return yr().updateFromJSON(e);
|
|
1210
1210
|
}
|
|
1211
1211
|
isSimpleText() {
|
|
1212
1212
|
return this.__type === "extended-text" && this.__mode === 0;
|
|
@@ -1222,7 +1222,7 @@ var Zn = (e) => {
|
|
|
1222
1222
|
dropInlineTextDecorationIfFormatted(e) {
|
|
1223
1223
|
(this.hasFormat("underline") || this.hasFormat("strikethrough")) && e.style.removeProperty("text-decoration");
|
|
1224
1224
|
}
|
|
1225
|
-
},
|
|
1225
|
+
}, yr = (e = "") => _e(new q(e)), J = (e) => (t) => {
|
|
1226
1226
|
let n = e?.(t);
|
|
1227
1227
|
if (!n) return null;
|
|
1228
1228
|
let r = n.conversion(t);
|
|
@@ -1245,53 +1245,53 @@ var Zn = (e) => {
|
|
|
1245
1245
|
return n;
|
|
1246
1246
|
}
|
|
1247
1247
|
};
|
|
1248
|
-
},
|
|
1248
|
+
}, br = () => {
|
|
1249
1249
|
let [e] = z();
|
|
1250
1250
|
return s(() => e.registerNodeTransform(q, (e) => {
|
|
1251
1251
|
if (!B(e, v)) return;
|
|
1252
1252
|
let t = e.getStyle();
|
|
1253
1253
|
if (!t) return;
|
|
1254
|
-
let n =
|
|
1254
|
+
let n = _r(t, "color");
|
|
1255
1255
|
n !== t && e.setStyle(n);
|
|
1256
1256
|
}), [e]), null;
|
|
1257
|
-
},
|
|
1257
|
+
}, xr = /<img\b|<picture\b/i, Sr = () => {
|
|
1258
1258
|
let [e] = z();
|
|
1259
1259
|
return s(() => {
|
|
1260
1260
|
let t = (t) => {
|
|
1261
1261
|
let n = "clipboardData" in t ? t.clipboardData : "dataTransfer" in t ? t.dataTransfer : null;
|
|
1262
1262
|
if (!n || n.getData("application/x-lexical-editor") || n.getData("application/x-lexical-drag")) return !1;
|
|
1263
1263
|
let r = n.getData("text/html");
|
|
1264
|
-
if (!(Array.from(n.files).some((e) => e.type.startsWith("image/")) || Array.from(n.items).some((e) => e.type.startsWith("image/")) ||
|
|
1264
|
+
if (!(Array.from(n.files).some((e) => e.type.startsWith("image/")) || Array.from(n.items).some((e) => e.type.startsWith("image/")) || xr.test(r))) return !1;
|
|
1265
1265
|
t.preventDefault();
|
|
1266
1266
|
let i = n.getData("text/plain");
|
|
1267
|
-
return !
|
|
1267
|
+
return !xr.test(r) && !i || e.update(() => {
|
|
1268
1268
|
let t = I();
|
|
1269
1269
|
if (t === null) return;
|
|
1270
1270
|
let n = r ? new DOMParser().parseFromString(r, "text/html") : null;
|
|
1271
1271
|
if (n?.querySelectorAll("img, picture").forEach((e) => e.remove()), (n?.body.innerHTML ?? "") && n?.body.textContent?.trim()) {
|
|
1272
|
-
let t =
|
|
1272
|
+
let t = nt(e, n);
|
|
1273
1273
|
if (t.length) {
|
|
1274
1274
|
xe(t);
|
|
1275
1275
|
return;
|
|
1276
1276
|
}
|
|
1277
1277
|
}
|
|
1278
1278
|
i && t.insertRawText(i);
|
|
1279
|
-
}, { tag:
|
|
1279
|
+
}, { tag: Ue }), !0;
|
|
1280
1280
|
};
|
|
1281
|
-
return
|
|
1281
|
+
return at(e.registerCommand(He, t, Ae), e.registerCommand(Ne, t, Ae));
|
|
1282
1282
|
}, [e]), null;
|
|
1283
|
-
},
|
|
1283
|
+
}, Cr = "data:image/png;base64,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", wr = "data:image/png;base64,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", Tr = (e, t, n) => Math.min(n, Math.max(t, e)), Y = (e) => Tr(e, 0, 1), X = (e) => {
|
|
1284
1284
|
let t = e.trim().toLowerCase();
|
|
1285
1285
|
if (t === "" || t === "transparent") return !0;
|
|
1286
1286
|
let n = t.match(/^rgba\([^,]+,[^,]+,[^,]+,\s*([.\d]+)\s*\)$/);
|
|
1287
1287
|
return n !== null && Number(n[1]) === 0;
|
|
1288
|
-
},
|
|
1288
|
+
}, Er = (e) => {
|
|
1289
1289
|
let t = e.trim().replace(/^#/, "");
|
|
1290
1290
|
return /^[0-9a-fA-F]{3}$/.test(t) ? `#${t[0]}${t[0]}${t[1]}${t[1]}${t[2]}${t[2]}`.toLowerCase() : /^[0-9a-fA-F]{6}$/.test(t) ? `#${t.toLowerCase()}` : null;
|
|
1291
|
-
},
|
|
1291
|
+
}, Dr = (e) => {
|
|
1292
1292
|
let t = e.trim();
|
|
1293
1293
|
if (X(t)) return null;
|
|
1294
|
-
let n =
|
|
1294
|
+
let n = Er(t);
|
|
1295
1295
|
if (n) return {
|
|
1296
1296
|
r: Number.parseInt(n.slice(1, 3), 16),
|
|
1297
1297
|
g: Number.parseInt(n.slice(3, 5), 16),
|
|
@@ -1303,63 +1303,63 @@ var Zn = (e) => {
|
|
|
1303
1303
|
g: Number(r[2]),
|
|
1304
1304
|
b: Number(r[3])
|
|
1305
1305
|
} : null;
|
|
1306
|
-
},
|
|
1306
|
+
}, Or = ({ r: e, g: t, b: n }) => `#${[
|
|
1307
1307
|
e,
|
|
1308
1308
|
t,
|
|
1309
1309
|
n
|
|
1310
|
-
].map((e) =>
|
|
1310
|
+
].map((e) => Tr(Math.round(e), 0, 255).toString(16).padStart(2, "0")).join("")}`, kr = (e, t) => {
|
|
1311
1311
|
if (X(e) && X(t)) return !0;
|
|
1312
|
-
let n =
|
|
1312
|
+
let n = Dr(e), r = Dr(t);
|
|
1313
1313
|
return !!(n && r && n.r === r.r && n.g === r.g && n.b === r.b);
|
|
1314
|
-
},
|
|
1314
|
+
}, Ar = (e) => {
|
|
1315
1315
|
let t = e.r / 255, n = e.g / 255, r = e.b / 255, i = Math.max(t, n, r), a = Math.min(t, n, r), o = (i + a) / 2, s = i - a, c = 0;
|
|
1316
1316
|
return s !== 0 && (c = i === t ? ((n - r) / s + (n < r ? 6 : 0)) * 60 : i === n ? ((r - t) / s + 2) * 60 : ((t - n) / s + 4) * 60), {
|
|
1317
1317
|
h: c,
|
|
1318
1318
|
s: s === 0 ? 0 : s / (1 - Math.abs(2 * o - 1)),
|
|
1319
1319
|
l: o
|
|
1320
1320
|
};
|
|
1321
|
-
},
|
|
1321
|
+
}, jr = ({ h: e, s: t, l: n }) => {
|
|
1322
1322
|
let r = (e % 360 + 360) % 360, i = (1 - Math.abs(2 * n - 1)) * t, a = i * (1 - Math.abs(r / 60 % 2 - 1)), o = n - i / 2, s = 0, c = 0, l = 0;
|
|
1323
1323
|
return r < 60 ? (s = i, c = a) : r < 120 ? (s = a, c = i) : r < 180 ? (c = i, l = a) : r < 240 ? (c = a, l = i) : r < 300 ? (s = a, l = i) : (s = i, l = a), {
|
|
1324
1324
|
r: Math.round((s + o) * 255),
|
|
1325
1325
|
g: Math.round((c + o) * 255),
|
|
1326
1326
|
b: Math.round((l + o) * 255)
|
|
1327
1327
|
};
|
|
1328
|
-
},
|
|
1328
|
+
}, Mr = (e) => Or(jr(e)), Nr = (e, t) => ({
|
|
1329
1329
|
h: Y(e) * 360,
|
|
1330
1330
|
s: 1,
|
|
1331
1331
|
l: Y(1 - t)
|
|
1332
|
-
}),
|
|
1332
|
+
}), Pr = (e) => ({
|
|
1333
1333
|
x: Y((e.h % 360 + 360) % 360 / 360),
|
|
1334
1334
|
y: Y(1 - e.l)
|
|
1335
|
-
}),
|
|
1335
|
+
}), Fr = (e, t, n) => ({
|
|
1336
1336
|
x: Y(n.width === 0 ? 0 : (e - n.left) / n.width),
|
|
1337
1337
|
y: Y(n.height === 0 ? 0 : (t - n.top) / n.height)
|
|
1338
|
-
}),
|
|
1339
|
-
let r =
|
|
1338
|
+
}), Ir = (e, t, n = Infinity) => {
|
|
1339
|
+
let r = Dr(t);
|
|
1340
1340
|
if (!r) return e;
|
|
1341
|
-
let i =
|
|
1342
|
-
return [i, ...e.filter((e) => !
|
|
1343
|
-
},
|
|
1341
|
+
let i = Or(r);
|
|
1342
|
+
return [i, ...e.filter((e) => !kr(e, i))].slice(0, n);
|
|
1343
|
+
}, Lr = (e, t = 24, n = 8) => Math.max(0, Math.floor((e + n) / (t + n))), Rr = (e, t) => {
|
|
1344
1344
|
let n = t % 11;
|
|
1345
1345
|
return Math.floor(t / 11) === 2 ? e[22] ?? e[t] : e[n] ?? e[t];
|
|
1346
|
-
}, Z = (...e) => e.filter(Boolean).join(" "),
|
|
1347
|
-
let t =
|
|
1346
|
+
}, Z = (...e) => e.filter(Boolean).join(" "), zr = (e) => {
|
|
1347
|
+
let t = Dr(e) ?? {
|
|
1348
1348
|
r: 0,
|
|
1349
1349
|
g: 94,
|
|
1350
1350
|
b: 239
|
|
1351
1351
|
};
|
|
1352
1352
|
return {
|
|
1353
|
-
color:
|
|
1354
|
-
point:
|
|
1353
|
+
color: Or(t),
|
|
1354
|
+
point: Pr(Ar(t))
|
|
1355
1355
|
};
|
|
1356
|
-
},
|
|
1357
|
-
let { t: l } = e(), [f, h] = d("presets"), [g, _] = d(() =>
|
|
1358
|
-
_(
|
|
1356
|
+
}, Br = ({ mode: t, currentColor: r, customColors: i, onApply: a, onCustomDraftChange: o, onCustomConfirm: c }) => {
|
|
1357
|
+
let { t: l } = e(), [f, h] = d("presets"), [g, _] = d(() => zr(r)), [v, y] = d(!1), [ee, b] = d(null), x = u(null), S = u(null), C = u(null), w = (e = r) => {
|
|
1358
|
+
_(zr(e)), y(!1), o(null), h("custom");
|
|
1359
1359
|
};
|
|
1360
1360
|
s(() => {
|
|
1361
1361
|
if (f !== "custom" || typeof ResizeObserver > "u") return;
|
|
1362
|
-
let e =
|
|
1362
|
+
let e = S.current;
|
|
1363
1363
|
if (!e) return;
|
|
1364
1364
|
let t = () => {
|
|
1365
1365
|
let { width: t, height: n } = e.getBoundingClientRect();
|
|
@@ -1380,20 +1380,20 @@ var Zn = (e) => {
|
|
|
1380
1380
|
let n = new ResizeObserver(t);
|
|
1381
1381
|
return n.observe(e), () => n.disconnect();
|
|
1382
1382
|
}, [f]), s(() => {
|
|
1383
|
-
let e =
|
|
1383
|
+
let e = C.current;
|
|
1384
1384
|
if (!e) return;
|
|
1385
1385
|
let t = () => {
|
|
1386
1386
|
let t = e.getBoundingClientRect().width;
|
|
1387
|
-
t > 0 &&
|
|
1387
|
+
t > 0 && b(Lr(t));
|
|
1388
1388
|
};
|
|
1389
1389
|
if (t(), typeof ResizeObserver > "u") return;
|
|
1390
1390
|
let n = new ResizeObserver(t);
|
|
1391
1391
|
return n.observe(e), () => n.disconnect();
|
|
1392
1392
|
}, [t]);
|
|
1393
|
-
let
|
|
1394
|
-
let t =
|
|
1393
|
+
let T = (e) => {
|
|
1394
|
+
let t = x.current;
|
|
1395
1395
|
if (!t) return;
|
|
1396
|
-
let { x: n, y: r } =
|
|
1396
|
+
let { x: n, y: r } = Fr(e.clientX, e.clientY, t.getBoundingClientRect()), i = Mr(Nr(n, r));
|
|
1397
1397
|
_({
|
|
1398
1398
|
color: i,
|
|
1399
1399
|
point: {
|
|
@@ -1401,17 +1401,17 @@ var Zn = (e) => {
|
|
|
1401
1401
|
y: r
|
|
1402
1402
|
}
|
|
1403
1403
|
}), y(!0), o(i);
|
|
1404
|
-
},
|
|
1404
|
+
}, E = f === "custom", { color: D, point: O } = g, k = /* @__PURE__ */ m("div", {
|
|
1405
1405
|
className: V["bsy-mobile-editor__color-bar"],
|
|
1406
1406
|
children: [
|
|
1407
1407
|
/* @__PURE__ */ p("button", {
|
|
1408
1408
|
type: "button",
|
|
1409
|
-
className: Z(V["bsy-mobile-editor__color-custom-trigger"],
|
|
1409
|
+
className: Z(V["bsy-mobile-editor__color-custom-trigger"], E && V["bsy-mobile-editor__color-custom-trigger--active"], v && V["bsy-mobile-editor__color-custom-trigger--preview"]),
|
|
1410
1410
|
"aria-label": l("editor.addSwatch"),
|
|
1411
|
-
"aria-pressed":
|
|
1412
|
-
style: { backgroundColor:
|
|
1411
|
+
"aria-pressed": E,
|
|
1412
|
+
style: { backgroundColor: E && v ? D : void 0 },
|
|
1413
1413
|
onClick: () => {
|
|
1414
|
-
|
|
1414
|
+
E || w(r);
|
|
1415
1415
|
},
|
|
1416
1416
|
children: v ? null : /* @__PURE__ */ p(n, {
|
|
1417
1417
|
name: "add",
|
|
@@ -1427,12 +1427,12 @@ var Zn = (e) => {
|
|
|
1427
1427
|
onClick: () => a("transparent")
|
|
1428
1428
|
}) : null,
|
|
1429
1429
|
/* @__PURE__ */ p("div", {
|
|
1430
|
-
ref:
|
|
1430
|
+
ref: C,
|
|
1431
1431
|
className: V["bsy-mobile-editor__color-custom-list"],
|
|
1432
1432
|
role: "listbox",
|
|
1433
1433
|
"aria-label": l("editor.customColors"),
|
|
1434
|
-
children: i.slice(0,
|
|
1435
|
-
let t =
|
|
1434
|
+
children: i.slice(0, ee ?? i.length).map((e) => {
|
|
1435
|
+
let t = kr(r, e);
|
|
1436
1436
|
return /* @__PURE__ */ p("button", {
|
|
1437
1437
|
type: "button",
|
|
1438
1438
|
role: "option",
|
|
@@ -1450,16 +1450,16 @@ var Zn = (e) => {
|
|
|
1450
1450
|
]
|
|
1451
1451
|
});
|
|
1452
1452
|
return /* @__PURE__ */ m("div", {
|
|
1453
|
-
className: Z(V["bsy-mobile-editor__color"],
|
|
1453
|
+
className: Z(V["bsy-mobile-editor__color"], E && V["bsy-mobile-editor__color--custom"]),
|
|
1454
1454
|
children: [
|
|
1455
1455
|
/* @__PURE__ */ m("div", {
|
|
1456
1456
|
className: V["bsy-mobile-editor__color-header"],
|
|
1457
|
-
children: [
|
|
1457
|
+
children: [E ? /* @__PURE__ */ p("button", {
|
|
1458
1458
|
type: "button",
|
|
1459
1459
|
className: V["bsy-mobile-editor__color-header-back"],
|
|
1460
1460
|
"aria-label": l("editor.colorBack"),
|
|
1461
1461
|
onClick: () => {
|
|
1462
|
-
v && c(
|
|
1462
|
+
v && c(D), o(null), y(!1), h("presets");
|
|
1463
1463
|
},
|
|
1464
1464
|
children: /* @__PURE__ */ p(n, {
|
|
1465
1465
|
name: "left",
|
|
@@ -1467,31 +1467,31 @@ var Zn = (e) => {
|
|
|
1467
1467
|
})
|
|
1468
1468
|
}) : null, /* @__PURE__ */ p("span", {
|
|
1469
1469
|
className: V["bsy-mobile-editor__color-header-title"],
|
|
1470
|
-
children: l(
|
|
1470
|
+
children: l(E ? "editor.customColor" : t === "fill" ? "editor.fill" : "editor.fontColor")
|
|
1471
1471
|
})]
|
|
1472
1472
|
}),
|
|
1473
|
-
|
|
1473
|
+
E ? /* @__PURE__ */ p("div", {
|
|
1474
1474
|
className: V["bsy-mobile-editor__color-mixer"],
|
|
1475
1475
|
children: /* @__PURE__ */ m("div", {
|
|
1476
|
-
ref:
|
|
1476
|
+
ref: x,
|
|
1477
1477
|
className: V["bsy-mobile-editor__color-spectrum"],
|
|
1478
1478
|
role: "slider",
|
|
1479
1479
|
"aria-label": l("editor.colorSpectrum"),
|
|
1480
1480
|
"aria-valuemin": 0,
|
|
1481
1481
|
"aria-valuemax": 100,
|
|
1482
|
-
"aria-valuenow": Math.round(
|
|
1483
|
-
"aria-valuetext":
|
|
1482
|
+
"aria-valuenow": Math.round(O.x * 100),
|
|
1483
|
+
"aria-valuetext": D,
|
|
1484
1484
|
onPointerDown: (e) => {
|
|
1485
|
-
e.currentTarget.setPointerCapture(e.pointerId),
|
|
1485
|
+
e.currentTarget.setPointerCapture(e.pointerId), T(e);
|
|
1486
1486
|
},
|
|
1487
1487
|
onPointerMove: (e) => {
|
|
1488
|
-
e.buttons !== 0 &&
|
|
1488
|
+
e.buttons !== 0 && T(e);
|
|
1489
1489
|
},
|
|
1490
1490
|
onPointerUp: (e) => {
|
|
1491
|
-
|
|
1491
|
+
T(e);
|
|
1492
1492
|
},
|
|
1493
1493
|
children: [/* @__PURE__ */ p("canvas", {
|
|
1494
|
-
ref:
|
|
1494
|
+
ref: S,
|
|
1495
1495
|
className: V["bsy-mobile-editor__color-spectrum-canvas"],
|
|
1496
1496
|
width: 392,
|
|
1497
1497
|
height: 192,
|
|
@@ -1499,9 +1499,9 @@ var Zn = (e) => {
|
|
|
1499
1499
|
}), /* @__PURE__ */ p("span", {
|
|
1500
1500
|
className: V["bsy-mobile-editor__color-thumb"],
|
|
1501
1501
|
style: {
|
|
1502
|
-
left: `${
|
|
1503
|
-
top: `${
|
|
1504
|
-
backgroundColor:
|
|
1502
|
+
left: `${O.x * 100}%`,
|
|
1503
|
+
top: `${O.y * 100}%`,
|
|
1504
|
+
backgroundColor: D
|
|
1505
1505
|
}
|
|
1506
1506
|
})]
|
|
1507
1507
|
})
|
|
@@ -1509,8 +1509,8 @@ var Zn = (e) => {
|
|
|
1509
1509
|
className: V["bsy-mobile-editor__color-grid"],
|
|
1510
1510
|
role: "listbox",
|
|
1511
1511
|
"aria-label": l("editor.presetColors"),
|
|
1512
|
-
children:
|
|
1513
|
-
let n =
|
|
1512
|
+
children: pt.map((e, t) => {
|
|
1513
|
+
let n = kr(r, e);
|
|
1514
1514
|
return /* @__PURE__ */ p("button", {
|
|
1515
1515
|
type: "button",
|
|
1516
1516
|
role: "option",
|
|
@@ -1519,112 +1519,105 @@ var Zn = (e) => {
|
|
|
1519
1519
|
className: Z(V["bsy-mobile-editor__color-swatch"], n && V["bsy-mobile-editor__color-swatch--selected"]),
|
|
1520
1520
|
style: {
|
|
1521
1521
|
"--swatch-color": e,
|
|
1522
|
-
"--swatch-ring":
|
|
1522
|
+
"--swatch-ring": Rr(pt, t)
|
|
1523
1523
|
},
|
|
1524
1524
|
onClick: () => a(e),
|
|
1525
1525
|
children: /* @__PURE__ */ p("span", { className: V["bsy-mobile-editor__color-swatch-fill"] })
|
|
1526
1526
|
}, e);
|
|
1527
1527
|
})
|
|
1528
1528
|
}),
|
|
1529
|
-
|
|
1529
|
+
k
|
|
1530
1530
|
]
|
|
1531
1531
|
});
|
|
1532
|
-
},
|
|
1532
|
+
}, Vr = (e, t) => {
|
|
1533
1533
|
H(e), e.update(() => {
|
|
1534
|
-
|
|
1534
|
+
ct(I(), () => t === "paragraph" ? N() : ie(t));
|
|
1535
1535
|
});
|
|
1536
|
-
},
|
|
1536
|
+
}, Hr = (e, t, n) => {
|
|
1537
1537
|
H(e), e.update(() => {
|
|
1538
|
-
|
|
1538
|
+
Kt(n), qt();
|
|
1539
1539
|
let e = I();
|
|
1540
|
-
e &&
|
|
1540
|
+
e && st(e, t);
|
|
1541
1541
|
});
|
|
1542
|
-
},
|
|
1543
|
-
let [b] = z(), { t: x } = e(), [S, C] = d([]), w = u(null), T = i === "fontColor" || i === "fill" ? i : null, E = T === "fill" ?
|
|
1544
|
-
T && (n && (w.current = null),
|
|
1542
|
+
}, Ur = ({ sheet: i, formats: a, onClose: o, onTypeset: s, onPolishMenu: c, onPickPreset: l, onPicture: h, savedSelectionRef: g, committedColors: _, onColorCommit: v, canTypeset: y, canPolish: ee }) => {
|
|
1543
|
+
let [b] = z(), { t: x } = e(), [S, C] = d([]), w = u(null), T = i === "fontColor" || i === "fill" ? i : null, E = T === "fill" ? _.fill : T === "fontColor" ? _.fontColor : dt, D = (e, t = !1, n = !0) => {
|
|
1544
|
+
T && (n && (w.current = null), Hr(b, { [T === "fill" ? "background-color" : "color"]: e }, g.current), v(T, e), t && !X(e) && C((t) => Ir(t, e)), n && o());
|
|
1545
1545
|
}, O = (e) => {
|
|
1546
1546
|
w.current = null, D(e, !0, !1);
|
|
1547
1547
|
};
|
|
1548
1548
|
return /* @__PURE__ */ m(f, { children: [
|
|
1549
1549
|
/* @__PURE__ */ p(r, {
|
|
1550
|
-
mode: "menu",
|
|
1551
1550
|
open: i === "align",
|
|
1552
1551
|
title: x("editor.alignment"),
|
|
1553
|
-
onClose:
|
|
1552
|
+
onClose: o,
|
|
1554
1553
|
actions: [
|
|
1555
1554
|
{
|
|
1556
1555
|
key: "left",
|
|
1557
1556
|
text: x("editor.leftAlign"),
|
|
1558
|
-
|
|
1559
|
-
name: "paragraph",
|
|
1560
|
-
size: 16
|
|
1561
|
-
})
|
|
1557
|
+
selected: a.align === "left"
|
|
1562
1558
|
},
|
|
1563
1559
|
{
|
|
1564
1560
|
key: "center",
|
|
1565
1561
|
text: x("editor.centerAlign"),
|
|
1566
|
-
|
|
1567
|
-
name: "paragraphmiddle",
|
|
1568
|
-
size: 16
|
|
1569
|
-
})
|
|
1562
|
+
selected: a.align === "center"
|
|
1570
1563
|
},
|
|
1571
1564
|
{
|
|
1572
1565
|
key: "right",
|
|
1573
1566
|
text: x("editor.rightAlign"),
|
|
1574
|
-
|
|
1575
|
-
name: "paragraphright",
|
|
1576
|
-
size: 16
|
|
1577
|
-
})
|
|
1567
|
+
selected: a.align === "right"
|
|
1578
1568
|
}
|
|
1579
1569
|
],
|
|
1580
1570
|
onAction: (e) => {
|
|
1581
|
-
H(b), b.dispatchCommand(
|
|
1571
|
+
H(b), b.dispatchCommand(Fe, e.key);
|
|
1582
1572
|
}
|
|
1583
1573
|
}),
|
|
1584
1574
|
/* @__PURE__ */ p(r, {
|
|
1585
|
-
mode: "menu",
|
|
1586
1575
|
open: i === "heading",
|
|
1587
1576
|
title: x("editor.heading"),
|
|
1588
|
-
onClose:
|
|
1577
|
+
onClose: o,
|
|
1589
1578
|
actions: [
|
|
1590
1579
|
{
|
|
1591
1580
|
key: "paragraph",
|
|
1592
|
-
text: x("editor.paragraph")
|
|
1581
|
+
text: x("editor.paragraph"),
|
|
1582
|
+
selected: a.headingTag === !1
|
|
1593
1583
|
},
|
|
1594
1584
|
{
|
|
1595
1585
|
key: "h1",
|
|
1596
|
-
text: x("editor.heading1")
|
|
1586
|
+
text: x("editor.heading1"),
|
|
1587
|
+
selected: a.headingTag === "h1"
|
|
1597
1588
|
},
|
|
1598
1589
|
{
|
|
1599
1590
|
key: "h2",
|
|
1600
|
-
text: x("editor.heading2")
|
|
1591
|
+
text: x("editor.heading2"),
|
|
1592
|
+
selected: a.headingTag === "h2"
|
|
1601
1593
|
},
|
|
1602
1594
|
{
|
|
1603
1595
|
key: "h3",
|
|
1604
|
-
text: x("editor.heading3")
|
|
1596
|
+
text: x("editor.heading3"),
|
|
1597
|
+
selected: a.headingTag === "h3"
|
|
1605
1598
|
}
|
|
1606
1599
|
],
|
|
1607
|
-
onAction: (e) =>
|
|
1600
|
+
onAction: (e) => Vr(b, e.key)
|
|
1608
1601
|
}),
|
|
1609
1602
|
/* @__PURE__ */ p(r, {
|
|
1610
|
-
mode: "menu",
|
|
1611
1603
|
open: i === "fontSize",
|
|
1612
1604
|
title: x("editor.fontSize"),
|
|
1613
|
-
onClose:
|
|
1614
|
-
actions:
|
|
1605
|
+
onClose: o,
|
|
1606
|
+
actions: lt.map((e) => ({
|
|
1615
1607
|
key: e.value,
|
|
1616
|
-
text: e.label
|
|
1608
|
+
text: e.label,
|
|
1609
|
+
selected: e.value === a.fontSize
|
|
1617
1610
|
})),
|
|
1618
|
-
onAction: (e) =>
|
|
1611
|
+
onAction: (e) => Hr(b, { "font-size": e.key })
|
|
1619
1612
|
}),
|
|
1620
1613
|
/* @__PURE__ */ p(t, {
|
|
1621
1614
|
open: T !== null,
|
|
1622
1615
|
onClose: () => {
|
|
1623
1616
|
let e = w.current;
|
|
1624
|
-
e && O(e),
|
|
1617
|
+
e && O(e), o();
|
|
1625
1618
|
},
|
|
1626
1619
|
position: "bottom",
|
|
1627
|
-
children: T ? /* @__PURE__ */ p(
|
|
1620
|
+
children: T ? /* @__PURE__ */ p(Br, {
|
|
1628
1621
|
mode: T,
|
|
1629
1622
|
currentColor: E,
|
|
1630
1623
|
customColors: S,
|
|
@@ -1638,13 +1631,13 @@ var Zn = (e) => {
|
|
|
1638
1631
|
/* @__PURE__ */ p(r, {
|
|
1639
1632
|
mode: "menu",
|
|
1640
1633
|
open: i === "ai",
|
|
1641
|
-
onClose:
|
|
1634
|
+
onClose: o,
|
|
1642
1635
|
actions: [{
|
|
1643
1636
|
key: "typeset",
|
|
1644
1637
|
text: x("editor.aiTypeset"),
|
|
1645
|
-
disabled: !
|
|
1638
|
+
disabled: !y,
|
|
1646
1639
|
icon: /* @__PURE__ */ p("img", {
|
|
1647
|
-
src:
|
|
1640
|
+
src: Cr,
|
|
1648
1641
|
alt: "",
|
|
1649
1642
|
width: 16,
|
|
1650
1643
|
height: 16,
|
|
@@ -1654,9 +1647,9 @@ var Zn = (e) => {
|
|
|
1654
1647
|
}, {
|
|
1655
1648
|
key: "polish",
|
|
1656
1649
|
text: x("editor.aiPolish"),
|
|
1657
|
-
disabled: !
|
|
1650
|
+
disabled: !ee,
|
|
1658
1651
|
icon: /* @__PURE__ */ p("img", {
|
|
1659
|
-
src:
|
|
1652
|
+
src: wr,
|
|
1660
1653
|
alt: "",
|
|
1661
1654
|
width: 16,
|
|
1662
1655
|
height: 16,
|
|
@@ -1666,28 +1659,28 @@ var Zn = (e) => {
|
|
|
1666
1659
|
}],
|
|
1667
1660
|
onAction: (e) => {
|
|
1668
1661
|
if (e.key === "typeset") {
|
|
1669
|
-
|
|
1662
|
+
s();
|
|
1670
1663
|
return;
|
|
1671
1664
|
}
|
|
1672
|
-
|
|
1665
|
+
c();
|
|
1673
1666
|
}
|
|
1674
1667
|
}),
|
|
1675
1668
|
/* @__PURE__ */ p(r, {
|
|
1676
1669
|
mode: "menu",
|
|
1677
1670
|
open: i === "aiPreset",
|
|
1678
1671
|
title: x("editor.aiPolish"),
|
|
1679
|
-
onClose:
|
|
1680
|
-
actions:
|
|
1672
|
+
onClose: o,
|
|
1673
|
+
actions: mt.map((e) => ({
|
|
1681
1674
|
key: e,
|
|
1682
|
-
text: x(
|
|
1675
|
+
text: x(ht[e])
|
|
1683
1676
|
})),
|
|
1684
|
-
onAction: (e) =>
|
|
1677
|
+
onAction: (e) => l(e.key)
|
|
1685
1678
|
}),
|
|
1686
1679
|
/* @__PURE__ */ p(r, {
|
|
1687
1680
|
mode: "menu",
|
|
1688
1681
|
open: i === "picture",
|
|
1689
1682
|
title: x("editor.picture"),
|
|
1690
|
-
onClose:
|
|
1683
|
+
onClose: o,
|
|
1691
1684
|
actions: [{
|
|
1692
1685
|
key: "upload",
|
|
1693
1686
|
text: x("editor.uploadImage"),
|
|
@@ -1703,10 +1696,10 @@ var Zn = (e) => {
|
|
|
1703
1696
|
size: 16
|
|
1704
1697
|
})
|
|
1705
1698
|
}],
|
|
1706
|
-
onAction: (e) =>
|
|
1699
|
+
onAction: (e) => h(e.key)
|
|
1707
1700
|
})
|
|
1708
1701
|
] });
|
|
1709
|
-
},
|
|
1702
|
+
}, Wr = ({ open: r, title: i, bodyClassName: a, onClose: o, onConfirm: s, children: c }) => {
|
|
1710
1703
|
let { t: l } = e();
|
|
1711
1704
|
return /* @__PURE__ */ p(t, {
|
|
1712
1705
|
open: r,
|
|
@@ -1751,11 +1744,11 @@ var Zn = (e) => {
|
|
|
1751
1744
|
]
|
|
1752
1745
|
})
|
|
1753
1746
|
});
|
|
1754
|
-
},
|
|
1747
|
+
}, Gr = ({ open: t, seed: r, onClose: i, onConfirm: a }) => {
|
|
1755
1748
|
let { t: o } = e(), [c, l] = d(""), [u, f] = d(""), [h, g] = d(!0);
|
|
1756
1749
|
return s(() => {
|
|
1757
1750
|
!t || !r || (l(r.url), f(r.text), g(r.newBlank));
|
|
1758
|
-
}, [t, r]), /* @__PURE__ */ m(
|
|
1751
|
+
}, [t, r]), /* @__PURE__ */ m(Wr, {
|
|
1759
1752
|
open: t,
|
|
1760
1753
|
title: o("editor.link"),
|
|
1761
1754
|
bodyClassName: V["bsy-mobile-editor__sheet-body--stack"],
|
|
@@ -1817,13 +1810,13 @@ var Zn = (e) => {
|
|
|
1817
1810
|
})
|
|
1818
1811
|
]
|
|
1819
1812
|
});
|
|
1820
|
-
},
|
|
1813
|
+
}, Kr = /^https?:\/\/.+/i, qr = ({ open: t, onClose: n, onConfirm: r }) => {
|
|
1821
1814
|
let { t: i } = e(), [o, c] = d(""), [l, u] = d(null), f = a((e) => {
|
|
1822
1815
|
e?.focus();
|
|
1823
1816
|
}, []);
|
|
1824
1817
|
return s(() => {
|
|
1825
1818
|
t && (c(""), u(null));
|
|
1826
|
-
}, [t]), /* @__PURE__ */ p(
|
|
1819
|
+
}, [t]), /* @__PURE__ */ p(Wr, {
|
|
1827
1820
|
open: t,
|
|
1828
1821
|
title: i("editor.imageUrl"),
|
|
1829
1822
|
onClose: n,
|
|
@@ -1833,7 +1826,7 @@ var Zn = (e) => {
|
|
|
1833
1826
|
u(i("editor.imageUrlRequired"));
|
|
1834
1827
|
return;
|
|
1835
1828
|
}
|
|
1836
|
-
if (!
|
|
1829
|
+
if (!Kr.test(e)) {
|
|
1837
1830
|
u(i("editor.imageUrlInvalid"));
|
|
1838
1831
|
return;
|
|
1839
1832
|
}
|
|
@@ -1866,13 +1859,16 @@ var Zn = (e) => {
|
|
|
1866
1859
|
]
|
|
1867
1860
|
})
|
|
1868
1861
|
});
|
|
1869
|
-
},
|
|
1862
|
+
}, Jr = `
|
|
1870
1863
|
:host {
|
|
1871
1864
|
all: initial;
|
|
1872
1865
|
display: block;
|
|
1866
|
+
box-sizing: border-box;
|
|
1873
1867
|
width: 100%;
|
|
1874
1868
|
max-width: 100%;
|
|
1875
1869
|
min-width: 0;
|
|
1870
|
+
overflow-x: auto;
|
|
1871
|
+
-webkit-overflow-scrolling: touch;
|
|
1876
1872
|
}
|
|
1877
1873
|
.bsy-editor-html-preview__body {
|
|
1878
1874
|
color: #030303;
|
|
@@ -1959,7 +1955,7 @@ var Zn = (e) => {
|
|
|
1959
1955
|
.bsy-editor-html-preview__body li,
|
|
1960
1956
|
.bsy-editor-html-preview__body .editor-listitem {
|
|
1961
1957
|
margin: 0;
|
|
1962
|
-
margin-inline-start: ${
|
|
1958
|
+
margin-inline-start: ${It};
|
|
1963
1959
|
list-style: inherit;
|
|
1964
1960
|
}
|
|
1965
1961
|
.bsy-editor-html-preview__body .editor-nested-listitem {
|
|
@@ -2038,15 +2034,15 @@ var Zn = (e) => {
|
|
|
2038
2034
|
height: auto;
|
|
2039
2035
|
vertical-align: baseline;
|
|
2040
2036
|
}
|
|
2041
|
-
`,
|
|
2037
|
+
`, Yr = ({ html: e }) => {
|
|
2042
2038
|
let t = u(null);
|
|
2043
2039
|
return l(() => {
|
|
2044
|
-
|
|
2040
|
+
Vt(t.current, e, U, Jr);
|
|
2045
2041
|
}, [e]), /* @__PURE__ */ p("div", {
|
|
2046
2042
|
ref: t,
|
|
2047
2043
|
className: "bsy-editor-html-preview"
|
|
2048
2044
|
});
|
|
2049
|
-
},
|
|
2045
|
+
}, Xr = () => {
|
|
2050
2046
|
let e = `${c().replace(/:/g, "")}g`;
|
|
2051
2047
|
return /* @__PURE__ */ p("span", {
|
|
2052
2048
|
className: V["bsy-mobile-editor__ai-think-icon"],
|
|
@@ -2085,7 +2081,7 @@ var Zn = (e) => {
|
|
|
2085
2081
|
}) })]
|
|
2086
2082
|
})
|
|
2087
2083
|
});
|
|
2088
|
-
},
|
|
2084
|
+
}, Zr = (t, n) => {
|
|
2089
2085
|
let { t: r } = e(), i = t.status === "loading" && !n, [a, o] = d(!0), [c, l] = d(0), f = u(Date.now()), p = u(null), m = t.reasoning ?? "";
|
|
2090
2086
|
return s(() => {
|
|
2091
2087
|
if (!i) {
|
|
@@ -2105,12 +2101,12 @@ var Zn = (e) => {
|
|
|
2105
2101
|
reasoning: m,
|
|
2106
2102
|
toggle: () => o((e) => !e)
|
|
2107
2103
|
};
|
|
2108
|
-
},
|
|
2104
|
+
}, Qr = ({ model: e }) => /* @__PURE__ */ m("button", {
|
|
2109
2105
|
type: "button",
|
|
2110
2106
|
className: V["bsy-mobile-editor__ai-think-head"],
|
|
2111
2107
|
disabled: e.thinking,
|
|
2112
2108
|
onClick: e.toggle,
|
|
2113
|
-
children: [e.thinking ? /* @__PURE__ */ p(
|
|
2109
|
+
children: [e.thinking ? /* @__PURE__ */ p(Xr, {}) : /* @__PURE__ */ p(n, {
|
|
2114
2110
|
name: "arrow-down",
|
|
2115
2111
|
size: 12,
|
|
2116
2112
|
className: [V["bsy-mobile-editor__ai-think-arrow"], e.open ? V["bsy-mobile-editor__ai-think-arrow--open"] : ""].filter(Boolean).join(" ")
|
|
@@ -2118,10 +2114,10 @@ var Zn = (e) => {
|
|
|
2118
2114
|
className: e.thinking ? `${V["bsy-mobile-editor__ai-think-label"]} ${V["bsy-mobile-editor__ai-think-label--shimmer"]}` : V["bsy-mobile-editor__ai-think-label"],
|
|
2119
2115
|
children: e.label
|
|
2120
2116
|
})]
|
|
2121
|
-
}),
|
|
2117
|
+
}), $r = ({ model: e }) => !e.visible || !e.open || !e.reasoning ? null : /* @__PURE__ */ p("div", {
|
|
2122
2118
|
className: V["bsy-mobile-editor__ai-think-body"],
|
|
2123
2119
|
children: e.reasoning
|
|
2124
|
-
}),
|
|
2120
|
+
}), ei = ({ enabled: e, status: t, revision: n, compute: r }) => {
|
|
2125
2121
|
let [i, a] = d(""), o = u(r);
|
|
2126
2122
|
o.current = r;
|
|
2127
2123
|
let c = u(null);
|
|
@@ -2148,7 +2144,7 @@ var Zn = (e) => {
|
|
|
2148
2144
|
]), s(() => () => {
|
|
2149
2145
|
c.current !== null && cancelAnimationFrame(c.current);
|
|
2150
2146
|
}, []), i;
|
|
2151
|
-
},
|
|
2147
|
+
}, ti = 32, ni = .25, ri = 2, ii = ({ viewportRef: e, enabled: t, revision: n }) => {
|
|
2152
2148
|
let r = u(!0), i = u(!1), o = u(0), c = a(() => e.current ?? void 0, [e]), l = a(() => {
|
|
2153
2149
|
o.current = 0;
|
|
2154
2150
|
let t = e.current;
|
|
@@ -2158,7 +2154,7 @@ var Zn = (e) => {
|
|
|
2158
2154
|
t.scrollTop = n;
|
|
2159
2155
|
return;
|
|
2160
2156
|
}
|
|
2161
|
-
t.scrollTop += Math.max(i *
|
|
2157
|
+
t.scrollTop += Math.max(i * ni, Math.min(i, ri)), o.current = requestAnimationFrame(l);
|
|
2162
2158
|
}, [e]), d = a(() => {
|
|
2163
2159
|
!o.current && r.current && (o.current = requestAnimationFrame(l));
|
|
2164
2160
|
}, [l]);
|
|
@@ -2185,7 +2181,7 @@ var Zn = (e) => {
|
|
|
2185
2181
|
let f = () => {
|
|
2186
2182
|
let t = e.current;
|
|
2187
2183
|
if (!t) return;
|
|
2188
|
-
let n = t.scrollHeight - t.clientHeight - t.scrollTop <=
|
|
2184
|
+
let n = t.scrollHeight - t.clientHeight - t.scrollTop <= ti;
|
|
2189
2185
|
i.current ? (i.current = !1, r.current = n, !n && o.current && (cancelAnimationFrame(o.current), o.current = 0)) : n && (r.current = !0);
|
|
2190
2186
|
}, p = () => {
|
|
2191
2187
|
i.current = !0;
|
|
@@ -2203,20 +2199,20 @@ var Zn = (e) => {
|
|
|
2203
2199
|
passive: !0,
|
|
2204
2200
|
enable: t
|
|
2205
2201
|
}), { onScroll: f };
|
|
2206
|
-
},
|
|
2207
|
-
let { t: v } = e(), y = u(null), [
|
|
2202
|
+
}, ai = ({ open: i, mode: a, originalHtml: o, codeBlocks: s = [], ai: c, polishPreset: l, onClose: h, onApply: g, onPickPreset: _ }) => {
|
|
2203
|
+
let { t: v } = e(), y = u(null), [ee, b] = d(!1), x = c?.status ?? "idle", S = c?.text ?? "", C = ei({
|
|
2208
2204
|
enabled: i && !!a,
|
|
2209
|
-
status:
|
|
2210
|
-
revision:
|
|
2211
|
-
compute: () => a === "polish" ? U(
|
|
2212
|
-
}),
|
|
2213
|
-
status:
|
|
2205
|
+
status: x,
|
|
2206
|
+
revision: S,
|
|
2207
|
+
compute: () => a === "polish" ? U(Pn(o, S)) : Qn(S, s)
|
|
2208
|
+
}), w = !!C.trim(), T = Zr({
|
|
2209
|
+
status: x,
|
|
2214
2210
|
reasoning: c?.reasoning
|
|
2215
|
-
},
|
|
2211
|
+
}, w), E = ii({
|
|
2216
2212
|
viewportRef: y,
|
|
2217
|
-
enabled: i &&
|
|
2218
|
-
revision: `${c?.reasoning ?? ""}\0${
|
|
2219
|
-
}),
|
|
2213
|
+
enabled: i && x === "loading",
|
|
2214
|
+
revision: `${c?.reasoning ?? ""}\0${C}`
|
|
2215
|
+
}), D = x === "ready" && w;
|
|
2220
2216
|
return /* @__PURE__ */ m(t, {
|
|
2221
2217
|
open: i,
|
|
2222
2218
|
onClose: h,
|
|
@@ -2224,7 +2220,7 @@ var Zn = (e) => {
|
|
|
2224
2220
|
closeOnClickOverlay: !1,
|
|
2225
2221
|
children: [/* @__PURE__ */ m("div", {
|
|
2226
2222
|
className: V["bsy-mobile-editor__ai"],
|
|
2227
|
-
style: { height:
|
|
2223
|
+
style: { height: yt },
|
|
2228
2224
|
children: [
|
|
2229
2225
|
/* @__PURE__ */ m("div", {
|
|
2230
2226
|
className: V["bsy-mobile-editor__header"],
|
|
@@ -2256,25 +2252,25 @@ var Zn = (e) => {
|
|
|
2256
2252
|
}), a === "polish" ? /* @__PURE__ */ m("button", {
|
|
2257
2253
|
type: "button",
|
|
2258
2254
|
className: V["bsy-mobile-editor__ai-preset"],
|
|
2259
|
-
onClick: () =>
|
|
2260
|
-
children: [v(
|
|
2255
|
+
onClick: () => b(!0),
|
|
2256
|
+
children: [v(ht[l]), /* @__PURE__ */ p(n, {
|
|
2261
2257
|
name: "arrow-down",
|
|
2262
2258
|
size: 16
|
|
2263
2259
|
})]
|
|
2264
2260
|
}) : null]
|
|
2265
2261
|
}),
|
|
2266
|
-
|
|
2262
|
+
T.visible ? /* @__PURE__ */ p("div", {
|
|
2267
2263
|
className: V["bsy-mobile-editor__ai-think-pin"],
|
|
2268
|
-
children: /* @__PURE__ */ p(
|
|
2264
|
+
children: /* @__PURE__ */ p(Qr, { model: T })
|
|
2269
2265
|
}) : null,
|
|
2270
2266
|
/* @__PURE__ */ p("div", {
|
|
2271
2267
|
ref: y,
|
|
2272
2268
|
className: V["bsy-mobile-editor__ai-section-scroll"],
|
|
2273
|
-
onScroll:
|
|
2274
|
-
children:
|
|
2269
|
+
onScroll: E.onScroll,
|
|
2270
|
+
children: x === "error" ? /* @__PURE__ */ p("p", {
|
|
2275
2271
|
className: V["bsy-mobile-editor__ai-error"],
|
|
2276
2272
|
children: c?.errorMessage || v("editor.aiError")
|
|
2277
|
-
}) : /* @__PURE__ */ m(f, { children: [/* @__PURE__ */ p(
|
|
2273
|
+
}) : /* @__PURE__ */ m(f, { children: [/* @__PURE__ */ p($r, { model: T }), w ? /* @__PURE__ */ p(Yr, { html: C }) : null] })
|
|
2278
2274
|
})
|
|
2279
2275
|
]
|
|
2280
2276
|
}),
|
|
@@ -2289,7 +2285,7 @@ var Zn = (e) => {
|
|
|
2289
2285
|
})
|
|
2290
2286
|
}), /* @__PURE__ */ p("div", {
|
|
2291
2287
|
className: V["bsy-mobile-editor__ai-section-scroll"],
|
|
2292
|
-
children: /* @__PURE__ */ p(
|
|
2288
|
+
children: /* @__PURE__ */ p(Yr, { html: o })
|
|
2293
2289
|
})]
|
|
2294
2290
|
})
|
|
2295
2291
|
]
|
|
@@ -2303,7 +2299,7 @@ var Zn = (e) => {
|
|
|
2303
2299
|
}), /* @__PURE__ */ p("button", {
|
|
2304
2300
|
type: "button",
|
|
2305
2301
|
className: V["bsy-mobile-editor__ai-footer-ok"],
|
|
2306
|
-
disabled: !
|
|
2302
|
+
disabled: !D,
|
|
2307
2303
|
onClick: g,
|
|
2308
2304
|
children: v("editor.aiApply")
|
|
2309
2305
|
})]
|
|
@@ -2311,38 +2307,38 @@ var Zn = (e) => {
|
|
|
2311
2307
|
]
|
|
2312
2308
|
}), a === "polish" ? /* @__PURE__ */ p(r, {
|
|
2313
2309
|
mode: "menu",
|
|
2314
|
-
open:
|
|
2310
|
+
open: ee,
|
|
2315
2311
|
title: v("editor.aiPolish"),
|
|
2316
|
-
onClose: () =>
|
|
2317
|
-
actions:
|
|
2312
|
+
onClose: () => b(!1),
|
|
2313
|
+
actions: mt.map((e) => ({
|
|
2318
2314
|
key: e,
|
|
2319
|
-
text: v(
|
|
2315
|
+
text: v(ht[e])
|
|
2320
2316
|
})),
|
|
2321
2317
|
onAction: (e) => _(e.key)
|
|
2322
2318
|
}) : null]
|
|
2323
2319
|
});
|
|
2324
|
-
},
|
|
2320
|
+
}, oi = "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", si = "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", ci = 860.48, li = 99.52, ui = /rgba\(\s*0\s*,\s*0\s*,\s*0\s*,\s*0(?:\.0+)?\s*\)/, di = {
|
|
2325
2321
|
fontColor: {
|
|
2326
|
-
path:
|
|
2327
|
-
clipHeight:
|
|
2322
|
+
path: oi,
|
|
2323
|
+
clipHeight: ci,
|
|
2328
2324
|
x: 128,
|
|
2329
2325
|
width: 768,
|
|
2330
2326
|
rx: 0
|
|
2331
2327
|
},
|
|
2332
2328
|
fill: {
|
|
2333
|
-
path:
|
|
2329
|
+
path: si,
|
|
2334
2330
|
clipHeight: 816,
|
|
2335
2331
|
x: 112,
|
|
2336
2332
|
width: 800,
|
|
2337
2333
|
rx: 8
|
|
2338
2334
|
}
|
|
2339
|
-
},
|
|
2335
|
+
}, fi = (e, t) => {
|
|
2340
2336
|
let n = t.trim().toLowerCase();
|
|
2341
|
-
if (e === "fill") return !n || n === "transparent" ||
|
|
2337
|
+
if (e === "fill") return !n || n === "transparent" || ui.test(n);
|
|
2342
2338
|
let r = n.replace(/\s+/g, "");
|
|
2343
2339
|
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)";
|
|
2344
|
-
},
|
|
2345
|
-
let r = `${c().replace(/:/g, "")}clip`, i =
|
|
2340
|
+
}, pi = ({ variant: e, barColor: t, size: n }) => {
|
|
2341
|
+
let r = `${c().replace(/:/g, "")}clip`, i = di[e];
|
|
2346
2342
|
return /* @__PURE__ */ m("svg", {
|
|
2347
2343
|
width: n,
|
|
2348
2344
|
height: n,
|
|
@@ -2365,21 +2361,22 @@ var Zn = (e) => {
|
|
|
2365
2361
|
}),
|
|
2366
2362
|
/* @__PURE__ */ p("rect", {
|
|
2367
2363
|
x: i.x,
|
|
2368
|
-
y:
|
|
2364
|
+
y: ci,
|
|
2369
2365
|
width: i.width,
|
|
2370
|
-
height:
|
|
2366
|
+
height: li,
|
|
2371
2367
|
rx: i.rx,
|
|
2372
|
-
fill:
|
|
2368
|
+
fill: fi(e, t) ? "currentColor" : t
|
|
2373
2369
|
})
|
|
2374
2370
|
]
|
|
2375
2371
|
});
|
|
2376
|
-
},
|
|
2372
|
+
}, mi = {
|
|
2377
2373
|
bold: !1,
|
|
2378
2374
|
italic: !1,
|
|
2379
2375
|
underline: !1,
|
|
2380
2376
|
strikethrough: !1,
|
|
2381
|
-
|
|
2382
|
-
|
|
2377
|
+
fontSize: ut,
|
|
2378
|
+
fontColor: dt,
|
|
2379
|
+
backgroundColor: ft,
|
|
2383
2380
|
align: "left",
|
|
2384
2381
|
listType: !1,
|
|
2385
2382
|
canIndent: !0,
|
|
@@ -2387,75 +2384,90 @@ var Zn = (e) => {
|
|
|
2387
2384
|
headingTag: !1,
|
|
2388
2385
|
hasRangeSelection: !1,
|
|
2389
2386
|
hasEditorText: !1
|
|
2390
|
-
},
|
|
2391
|
-
|
|
2392
|
-
|
|
2393
|
-
|
|
2394
|
-
|
|
2395
|
-
|
|
2396
|
-
|
|
2397
|
-
|
|
2398
|
-
};
|
|
2399
|
-
if (!e) return n;
|
|
2400
|
-
let r = I();
|
|
2401
|
-
if (!L(r)) return n;
|
|
2402
|
-
let i = it(r, "color", ct), a = it(r, "background-color", lt), o = r.anchor.getNode(), s = o.getKey() === "root" ? o : B(o, (e) => {
|
|
2387
|
+
}, hi = (e) => e === "center" || e === "right" || e === "left" ? e : e === "end" ? "right" : "left", gi = () => {
|
|
2388
|
+
let e = {
|
|
2389
|
+
canIndent: !0,
|
|
2390
|
+
canOutdent: !1,
|
|
2391
|
+
listType: !1
|
|
2392
|
+
}, t = I();
|
|
2393
|
+
if (!L(t)) return e;
|
|
2394
|
+
let n = t.anchor.getNode(), r = n.getKey() === "root" ? n : B(n, (e) => {
|
|
2403
2395
|
let t = e.getParent();
|
|
2404
2396
|
return t !== null && we(t);
|
|
2405
2397
|
});
|
|
2406
|
-
|
|
2407
|
-
let
|
|
2408
|
-
if (
|
|
2409
|
-
|
|
2410
|
-
let e =
|
|
2411
|
-
if (
|
|
2398
|
+
r === null && (r = n.getTopLevelElementOrThrow());
|
|
2399
|
+
let i = B(n, x), a = !1, o = Se(r) ? r.getIndent() : 0;
|
|
2400
|
+
if (x(i)) {
|
|
2401
|
+
o = i.getIndent();
|
|
2402
|
+
let e = i.getParent();
|
|
2403
|
+
if (S(e)) {
|
|
2412
2404
|
let t = e.getListType();
|
|
2413
|
-
|
|
2405
|
+
a = t === "number" || t === "bullet" ? t : !1;
|
|
2414
2406
|
}
|
|
2415
2407
|
}
|
|
2416
|
-
let d = B(o, ie), f = ie(d) ? d.getTag() : void 0, p = R(o) ? o : null;
|
|
2417
2408
|
return {
|
|
2418
|
-
|
|
2419
|
-
|
|
2420
|
-
|
|
2421
|
-
|
|
2422
|
-
|
|
2423
|
-
|
|
2424
|
-
|
|
2425
|
-
|
|
2426
|
-
canIndent:
|
|
2427
|
-
canOutdent:
|
|
2428
|
-
|
|
2409
|
+
canIndent: o < 8,
|
|
2410
|
+
canOutdent: o > 0 || a !== !1,
|
|
2411
|
+
listType: a
|
|
2412
|
+
};
|
|
2413
|
+
}, _i = (e) => {
|
|
2414
|
+
let t = !!F().getTextContent().trim(), { canIndent: n, canOutdent: r } = gi(), i = {
|
|
2415
|
+
...mi,
|
|
2416
|
+
hasEditorText: t,
|
|
2417
|
+
canIndent: n,
|
|
2418
|
+
canOutdent: r
|
|
2419
|
+
};
|
|
2420
|
+
if (!e) return i;
|
|
2421
|
+
let a = I();
|
|
2422
|
+
if (!L(a)) return i;
|
|
2423
|
+
let o = ot(a, "font-size", ut), s = ot(a, "color", dt), c = ot(a, "background-color", ft), l = a.anchor.getNode(), u = l.getKey() === "root" ? l : B(l, (e) => {
|
|
2424
|
+
let t = e.getParent();
|
|
2425
|
+
return t !== null && we(t);
|
|
2426
|
+
});
|
|
2427
|
+
u === null && (u = l.getTopLevelElementOrThrow());
|
|
2428
|
+
let d = gi(), f = B(l, ae), p = ae(f) ? f.getTag() : void 0;
|
|
2429
|
+
return {
|
|
2430
|
+
bold: a.hasFormat("bold"),
|
|
2431
|
+
italic: a.hasFormat("italic"),
|
|
2432
|
+
underline: a.hasFormat("underline"),
|
|
2433
|
+
strikethrough: a.hasFormat("strikethrough"),
|
|
2434
|
+
fontSize: o,
|
|
2435
|
+
fontColor: s,
|
|
2436
|
+
backgroundColor: c,
|
|
2437
|
+
align: hi(Se(u) ? u.getFormatType() : ""),
|
|
2438
|
+
...d,
|
|
2439
|
+
headingTag: p === "h1" || p === "h2" || p === "h3" ? p : !1,
|
|
2429
2440
|
hasRangeSelection: !0,
|
|
2430
2441
|
hasEditorText: t
|
|
2431
2442
|
};
|
|
2432
|
-
},
|
|
2443
|
+
}, vi = (e, t) => {
|
|
2433
2444
|
e.isEditable() || e.setEditable(!0), e.update(() => {
|
|
2434
|
-
|
|
2445
|
+
qt(), t(_i(!0));
|
|
2435
2446
|
}), e.focus(void 0, { defaultSelection: "rootStart" });
|
|
2436
|
-
},
|
|
2437
|
-
let t =
|
|
2438
|
-
return
|
|
2447
|
+
}, yi = (e) => {
|
|
2448
|
+
let t = mi;
|
|
2449
|
+
return vi(e, (e) => {
|
|
2439
2450
|
t = e;
|
|
2440
2451
|
}), t;
|
|
2441
|
-
},
|
|
2452
|
+
}, bi = (...e) => e.filter(Boolean).join(" "), xi = (e) => e.buttons.map((e) => ({
|
|
2442
2453
|
name: typeof e == "string" ? e : e.name,
|
|
2443
2454
|
disabled: typeof e != "string" && !!e.props?.disabled
|
|
2444
|
-
})), Q = 24,
|
|
2455
|
+
})), Q = 24, Si = 20, $ = ({ active: e, disabled: t, expanded: n, label: r, select: i, selectAlign: a, onClick: o, children: s }) => /* @__PURE__ */ p("button", {
|
|
2445
2456
|
type: "button",
|
|
2446
|
-
className:
|
|
2457
|
+
className: bi(V["bsy-mobile-editor__tool"], i && V["bsy-mobile-editor__tool--select"], a && V["bsy-mobile-editor__tool--select-align"], e && V["bsy-mobile-editor__tool--active"]),
|
|
2447
2458
|
"aria-label": r,
|
|
2448
2459
|
"aria-pressed": e,
|
|
2449
2460
|
"aria-expanded": i ? !!n : void 0,
|
|
2450
|
-
disabled: t,
|
|
2461
|
+
"aria-disabled": t || void 0,
|
|
2462
|
+
tabIndex: t ? -1 : void 0,
|
|
2451
2463
|
onMouseDown: (e) => e.preventDefault(),
|
|
2452
|
-
onClick: o,
|
|
2464
|
+
onClick: t ? void 0 : o,
|
|
2453
2465
|
children: s
|
|
2454
|
-
}),
|
|
2466
|
+
}), Ci = ({ open: e }) => /* @__PURE__ */ p(n, {
|
|
2455
2467
|
name: "arrow-down",
|
|
2456
|
-
size:
|
|
2457
|
-
className:
|
|
2458
|
-
}),
|
|
2468
|
+
size: Si,
|
|
2469
|
+
className: bi(V["bsy-mobile-editor__tool-caret"], e && V["bsy-mobile-editor__tool-caret--open"])
|
|
2470
|
+
}), wi = ({ config: t, formats: r, colorValues: i, openSheet: a, onOpenSheet: o, onOpenLink: c }) => {
|
|
2459
2471
|
let [l] = z(), { t: d } = e(), f = u(null), h = u(null), g = u(null), _ = () => {
|
|
2460
2472
|
let e = f.current, t = h.current, n = g.current;
|
|
2461
2473
|
if (!e || !t || !n) return;
|
|
@@ -2476,7 +2488,7 @@ var Zn = (e) => {
|
|
|
2476
2488
|
disabled: t,
|
|
2477
2489
|
label: d("editor.bold"),
|
|
2478
2490
|
onClick: () => {
|
|
2479
|
-
H(l), l.dispatchCommand(
|
|
2491
|
+
H(l), l.dispatchCommand(Ie, "bold");
|
|
2480
2492
|
},
|
|
2481
2493
|
children: /* @__PURE__ */ p(n, {
|
|
2482
2494
|
name: "bold",
|
|
@@ -2488,7 +2500,7 @@ var Zn = (e) => {
|
|
|
2488
2500
|
disabled: t,
|
|
2489
2501
|
label: d("editor.italic"),
|
|
2490
2502
|
onClick: () => {
|
|
2491
|
-
H(l), l.dispatchCommand(
|
|
2503
|
+
H(l), l.dispatchCommand(Ie, "italic");
|
|
2492
2504
|
},
|
|
2493
2505
|
children: /* @__PURE__ */ p(n, {
|
|
2494
2506
|
name: "italic",
|
|
@@ -2500,7 +2512,7 @@ var Zn = (e) => {
|
|
|
2500
2512
|
disabled: t,
|
|
2501
2513
|
label: d("editor.underline"),
|
|
2502
2514
|
onClick: () => {
|
|
2503
|
-
H(l), l.dispatchCommand(
|
|
2515
|
+
H(l), l.dispatchCommand(Ie, "underline");
|
|
2504
2516
|
},
|
|
2505
2517
|
children: /* @__PURE__ */ p(n, {
|
|
2506
2518
|
name: "underline",
|
|
@@ -2512,7 +2524,7 @@ var Zn = (e) => {
|
|
|
2512
2524
|
disabled: t,
|
|
2513
2525
|
label: d("editor.strikethrough"),
|
|
2514
2526
|
onClick: () => {
|
|
2515
|
-
H(l), l.dispatchCommand(
|
|
2527
|
+
H(l), l.dispatchCommand(Ie, "strikethrough");
|
|
2516
2528
|
},
|
|
2517
2529
|
children: /* @__PURE__ */ p(n, {
|
|
2518
2530
|
name: "shanchuxian",
|
|
@@ -2520,10 +2532,10 @@ var Zn = (e) => {
|
|
|
2520
2532
|
})
|
|
2521
2533
|
}, e);
|
|
2522
2534
|
case "outdent": return /* @__PURE__ */ p($, {
|
|
2523
|
-
disabled: t ||
|
|
2535
|
+
disabled: t || !r.canOutdent,
|
|
2524
2536
|
label: d("editor.outdent"),
|
|
2525
2537
|
onClick: () => {
|
|
2526
|
-
H(l), l.dispatchCommand(
|
|
2538
|
+
H(l), l.dispatchCommand(Ve, void 0);
|
|
2527
2539
|
},
|
|
2528
2540
|
children: /* @__PURE__ */ p(n, {
|
|
2529
2541
|
name: "jianshaosuojin",
|
|
@@ -2531,10 +2543,10 @@ var Zn = (e) => {
|
|
|
2531
2543
|
})
|
|
2532
2544
|
}, e);
|
|
2533
2545
|
case "indent": return /* @__PURE__ */ p($, {
|
|
2534
|
-
disabled: t ||
|
|
2546
|
+
disabled: t || !r.canIndent,
|
|
2535
2547
|
label: d("editor.indent"),
|
|
2536
2548
|
onClick: () => {
|
|
2537
|
-
H(l), l.dispatchCommand(
|
|
2549
|
+
H(l), l.dispatchCommand(Re, void 0);
|
|
2538
2550
|
},
|
|
2539
2551
|
children: /* @__PURE__ */ p(n, {
|
|
2540
2552
|
name: "zengjiasuojin",
|
|
@@ -2546,8 +2558,8 @@ var Zn = (e) => {
|
|
|
2546
2558
|
disabled: t,
|
|
2547
2559
|
label: d("editor.bulletList"),
|
|
2548
2560
|
onClick: () => {
|
|
2549
|
-
let e =
|
|
2550
|
-
l.dispatchCommand(e.listType === "bullet" ?
|
|
2561
|
+
let e = yi(l);
|
|
2562
|
+
l.dispatchCommand(e.listType === "bullet" ? D : w, void 0);
|
|
2551
2563
|
},
|
|
2552
2564
|
children: /* @__PURE__ */ p(n, {
|
|
2553
2565
|
name: "xuhaoliebiao",
|
|
@@ -2559,8 +2571,8 @@ var Zn = (e) => {
|
|
|
2559
2571
|
disabled: t,
|
|
2560
2572
|
label: d("editor.numberList"),
|
|
2561
2573
|
onClick: () => {
|
|
2562
|
-
let e =
|
|
2563
|
-
l.dispatchCommand(e.listType === "number" ?
|
|
2574
|
+
let e = yi(l);
|
|
2575
|
+
l.dispatchCommand(e.listType === "number" ? D : C, void 0);
|
|
2564
2576
|
},
|
|
2565
2577
|
children: /* @__PURE__ */ p(n, {
|
|
2566
2578
|
name: "bianhaoliebiao",
|
|
@@ -2578,7 +2590,7 @@ var Zn = (e) => {
|
|
|
2578
2590
|
children: [/* @__PURE__ */ p(n, {
|
|
2579
2591
|
name: r.align === "center" ? "paragraphmiddle" : r.align === "right" ? "paragraphright" : "paragraph",
|
|
2580
2592
|
size: Q
|
|
2581
|
-
}), /* @__PURE__ */ p(
|
|
2593
|
+
}), /* @__PURE__ */ p(Ci, { open: a === "align" })]
|
|
2582
2594
|
}, e);
|
|
2583
2595
|
case "heading": return /* @__PURE__ */ m($, {
|
|
2584
2596
|
select: !0,
|
|
@@ -2591,7 +2603,7 @@ var Zn = (e) => {
|
|
|
2591
2603
|
children: [/* @__PURE__ */ p("span", {
|
|
2592
2604
|
className: V["bsy-mobile-editor__tool-text"],
|
|
2593
2605
|
children: r.headingTag ? r.headingTag.toUpperCase() : d("editor.paragraph")
|
|
2594
|
-
}), /* @__PURE__ */ p(
|
|
2606
|
+
}), /* @__PURE__ */ p(Ci, { open: a === "heading" })]
|
|
2595
2607
|
}, e);
|
|
2596
2608
|
case "fontSize": return /* @__PURE__ */ p($, {
|
|
2597
2609
|
active: a === "fontSize",
|
|
@@ -2608,7 +2620,7 @@ var Zn = (e) => {
|
|
|
2608
2620
|
disabled: t,
|
|
2609
2621
|
label: d("editor.fontColor"),
|
|
2610
2622
|
onClick: () => o("fontColor"),
|
|
2611
|
-
children: /* @__PURE__ */ p(
|
|
2623
|
+
children: /* @__PURE__ */ p(pi, {
|
|
2612
2624
|
variant: "fontColor",
|
|
2613
2625
|
barColor: i.fontColor,
|
|
2614
2626
|
size: Q
|
|
@@ -2619,7 +2631,7 @@ var Zn = (e) => {
|
|
|
2619
2631
|
disabled: t,
|
|
2620
2632
|
label: d("editor.fill"),
|
|
2621
2633
|
onClick: () => o("fill"),
|
|
2622
|
-
children: /* @__PURE__ */ p(
|
|
2634
|
+
children: /* @__PURE__ */ p(pi, {
|
|
2623
2635
|
variant: "fill",
|
|
2624
2636
|
barColor: i.fill,
|
|
2625
2637
|
size: Q
|
|
@@ -2635,7 +2647,7 @@ var Zn = (e) => {
|
|
|
2635
2647
|
children: [/* @__PURE__ */ p(n, {
|
|
2636
2648
|
name: "picture",
|
|
2637
2649
|
size: Q
|
|
2638
|
-
}), /* @__PURE__ */ p(
|
|
2650
|
+
}), /* @__PURE__ */ p(Ci, { open: a === "picture" })]
|
|
2639
2651
|
}, e);
|
|
2640
2652
|
case "link": return /* @__PURE__ */ p($, {
|
|
2641
2653
|
disabled: t,
|
|
@@ -2656,13 +2668,13 @@ var Zn = (e) => {
|
|
|
2656
2668
|
label: d("editor.ai"),
|
|
2657
2669
|
onClick: () => o("ai"),
|
|
2658
2670
|
children: [/* @__PURE__ */ p("img", {
|
|
2659
|
-
src:
|
|
2671
|
+
src: Cr,
|
|
2660
2672
|
alt: "",
|
|
2661
2673
|
width: Q,
|
|
2662
2674
|
height: Q,
|
|
2663
2675
|
className: V["bsy-mobile-editor__ai-icon"],
|
|
2664
2676
|
draggable: !1
|
|
2665
|
-
}), /* @__PURE__ */ p(
|
|
2677
|
+
}), /* @__PURE__ */ p(Ci, { open: n })]
|
|
2666
2678
|
}, e);
|
|
2667
2679
|
}
|
|
2668
2680
|
default: return null;
|
|
@@ -2675,7 +2687,7 @@ var Zn = (e) => {
|
|
|
2675
2687
|
className: V["bsy-mobile-editor__toolbar-scroller"],
|
|
2676
2688
|
onScroll: _,
|
|
2677
2689
|
children: t.map((e, t) => {
|
|
2678
|
-
let n =
|
|
2690
|
+
let n = xi(e);
|
|
2679
2691
|
return n.length ? /* @__PURE__ */ m("div", {
|
|
2680
2692
|
className: V["bsy-mobile-editor__toolbar-group"],
|
|
2681
2693
|
children: [t > 0 ? /* @__PURE__ */ p("span", { className: V["bsy-mobile-editor__toolbar-divider"] }) : null, n.map(v)]
|
|
@@ -2692,19 +2704,33 @@ var Zn = (e) => {
|
|
|
2692
2704
|
})
|
|
2693
2705
|
})]
|
|
2694
2706
|
});
|
|
2695
|
-
},
|
|
2696
|
-
|
|
2707
|
+
}, Ti = () => {
|
|
2708
|
+
if (F().getTextContent().trim() !== "") return !1;
|
|
2709
|
+
let e = I();
|
|
2710
|
+
return L(e) && (e.format !== 0 || e.style.trim() !== "");
|
|
2711
|
+
}, Ei = () => {
|
|
2712
|
+
if (!Ti()) return !1;
|
|
2713
|
+
let e = I();
|
|
2714
|
+
return L(e) ? (e.setFormat(0), e.setStyle(""), !0) : !1;
|
|
2715
|
+
}, Di = (e) => {
|
|
2716
|
+
let [t] = z(), [n, r] = d(mi);
|
|
2697
2717
|
return s(() => {
|
|
2698
2718
|
let n = () => {
|
|
2699
2719
|
t.getEditorState().read(() => {
|
|
2700
|
-
r(
|
|
2720
|
+
r(_i(e));
|
|
2701
2721
|
}, { editor: t });
|
|
2702
2722
|
};
|
|
2703
|
-
return n(), t.registerUpdateListener(() => {
|
|
2723
|
+
return n(), t.registerUpdateListener(({ editorState: e }) => {
|
|
2724
|
+
if (e.read(() => Ti())) {
|
|
2725
|
+
t.update(() => {
|
|
2726
|
+
Ei();
|
|
2727
|
+
});
|
|
2728
|
+
return;
|
|
2729
|
+
}
|
|
2704
2730
|
n();
|
|
2705
2731
|
});
|
|
2706
2732
|
}, [t, e]), n;
|
|
2707
|
-
},
|
|
2733
|
+
}, Oi = "plaintext", ki = "github-light", Ai = new Set([
|
|
2708
2734
|
"plaintext",
|
|
2709
2735
|
"css",
|
|
2710
2736
|
"html",
|
|
@@ -2726,7 +2752,7 @@ var Zn = (e) => {
|
|
|
2726
2752
|
"bash",
|
|
2727
2753
|
"lua",
|
|
2728
2754
|
"markdown"
|
|
2729
|
-
]),
|
|
2755
|
+
]), ji = (e) => e && Ai.has(e) ? e : Oi, Mi = {
|
|
2730
2756
|
css: () => import("@shikijs/langs/css"),
|
|
2731
2757
|
html: () => import("@shikijs/langs/html"),
|
|
2732
2758
|
xml: () => import("@shikijs/langs/xml"),
|
|
@@ -2747,58 +2773,58 @@ var Zn = (e) => {
|
|
|
2747
2773
|
bash: () => import("@shikijs/langs/shellscript"),
|
|
2748
2774
|
lua: () => import("@shikijs/langs/lua"),
|
|
2749
2775
|
markdown: () => import("@shikijs/langs/markdown")
|
|
2750
|
-
},
|
|
2776
|
+
}, Ni = (e) => e === "bash" ? "shellscript" : e, Pi = (e) => e in Mi, Fi = null, Ii = null, Li = /* @__PURE__ */ new Map(), Ri = () => (Fi ||= Promise.all([import("@shikijs/core"), import("@shikijs/engine-javascript")]).then(([{ createHighlighterCoreSync: e }, { createJavaScriptRegexEngine: t }]) => e({
|
|
2751
2777
|
engine: t(),
|
|
2752
2778
|
langs: [],
|
|
2753
2779
|
themes: []
|
|
2754
2780
|
})).catch((e) => {
|
|
2755
|
-
throw
|
|
2756
|
-
}),
|
|
2757
|
-
let t =
|
|
2758
|
-
return t || (t =
|
|
2759
|
-
let n =
|
|
2781
|
+
throw Fi = null, e;
|
|
2782
|
+
}), Fi), zi = (e, t) => Pi(t) && e.getLoadedLanguages().includes(Ni(t)), Bi = (e) => {
|
|
2783
|
+
let t = Li.get(e);
|
|
2784
|
+
return t || (t = Ri().then(async (t) => {
|
|
2785
|
+
let n = Ni(e);
|
|
2760
2786
|
if (!t.getLoadedLanguages().includes(n)) {
|
|
2761
|
-
let n = await
|
|
2787
|
+
let n = await Mi[e]();
|
|
2762
2788
|
await t.loadLanguage(n.default);
|
|
2763
2789
|
}
|
|
2764
2790
|
return t;
|
|
2765
2791
|
}).catch((t) => {
|
|
2766
|
-
throw
|
|
2767
|
-
}),
|
|
2768
|
-
},
|
|
2792
|
+
throw Li.delete(e), t;
|
|
2793
|
+
}), Li.set(e, t)), t;
|
|
2794
|
+
}, Vi = () => (Ii ||= Ri().then(async (e) => {
|
|
2769
2795
|
if (!e.getLoadedThemes().includes("github-light")) {
|
|
2770
2796
|
let t = await import("@shikijs/themes/github-light");
|
|
2771
2797
|
await e.loadTheme(t.default);
|
|
2772
2798
|
}
|
|
2773
2799
|
return e;
|
|
2774
2800
|
}).catch((e) => {
|
|
2775
|
-
throw
|
|
2776
|
-
}),
|
|
2801
|
+
throw Ii = null, e;
|
|
2802
|
+
}), Ii), Hi = (e, t, n) => {
|
|
2777
2803
|
let r = e.getTextContent();
|
|
2778
|
-
if (e.getStyle() && e.setStyle(""), !n || !
|
|
2804
|
+
if (e.getStyle() && e.setStyle(""), !n || !zi(n, t)) return ne(r);
|
|
2779
2805
|
let i = n.codeToTokens(r, {
|
|
2780
|
-
lang:
|
|
2781
|
-
theme:
|
|
2806
|
+
lang: Ni(t),
|
|
2807
|
+
theme: ki
|
|
2782
2808
|
}).tokens, a = [];
|
|
2783
2809
|
return i.forEach((e, t) => {
|
|
2784
|
-
t && a.push(
|
|
2810
|
+
t && a.push(ve()), e.forEach((e) => {
|
|
2785
2811
|
e.content.split(" ").forEach((t, n) => {
|
|
2786
|
-
if (n && a.push(
|
|
2787
|
-
let r =
|
|
2812
|
+
if (n && a.push(ye()), !t) return;
|
|
2813
|
+
let r = O(t), i = typeof e.htmlStyle == "string" ? e.htmlStyle : e.htmlStyle ? Object.entries(e.htmlStyle).map(([e, t]) => `${e}:${t}`).join(";") : e.color ? `color: ${e.color}` : "";
|
|
2788
2814
|
i && r.setStyle(i), a.push(r);
|
|
2789
2815
|
});
|
|
2790
2816
|
});
|
|
2791
2817
|
}), a;
|
|
2792
|
-
},
|
|
2793
|
-
let n =
|
|
2794
|
-
if (!
|
|
2818
|
+
}, Ui = (e, t) => {
|
|
2819
|
+
let n = P(e);
|
|
2820
|
+
if (!te(n) || !n.isAttached()) return;
|
|
2795
2821
|
let r = I();
|
|
2796
2822
|
if (!L(r)) {
|
|
2797
2823
|
t();
|
|
2798
2824
|
return;
|
|
2799
2825
|
}
|
|
2800
2826
|
let { anchor: i } = r;
|
|
2801
|
-
if (B(i.getNode(),
|
|
2827
|
+
if (B(i.getNode(), te) !== n) {
|
|
2802
2828
|
t();
|
|
2803
2829
|
return;
|
|
2804
2830
|
}
|
|
@@ -2818,27 +2844,27 @@ var Zn = (e) => {
|
|
|
2818
2844
|
return !1;
|
|
2819
2845
|
});
|
|
2820
2846
|
}
|
|
2821
|
-
},
|
|
2847
|
+
}, Wi = (e, t) => k(e) && k(t) && e.__text === t.__text && e.__highlightType === t.__highlightType && e.__style === t.__style || Te(e) && Te(t) || Ce(e) && Ce(t), Gi = (e, t) => {
|
|
2822
2848
|
let n = 0;
|
|
2823
|
-
for (; n < e.length &&
|
|
2849
|
+
for (; n < e.length && Wi(e[n], t[n]);) n++;
|
|
2824
2850
|
let r = 0, i = Math.min(e.length, t.length) - n;
|
|
2825
|
-
for (; r < i &&
|
|
2851
|
+
for (; r < i && Wi(e[e.length - r - 1], t[t.length - r - 1]);) r++;
|
|
2826
2852
|
return {
|
|
2827
2853
|
from: n,
|
|
2828
2854
|
to: e.length - r,
|
|
2829
2855
|
replacement: t.slice(n, t.length - r)
|
|
2830
2856
|
};
|
|
2831
|
-
},
|
|
2832
|
-
let a = i.getKey(), o =
|
|
2857
|
+
}, Ki = (e, t, n, r, i) => {
|
|
2858
|
+
let a = i.getKey(), o = ji(i.getLanguage());
|
|
2833
2859
|
if (i.getLanguage() !== o && i.setLanguage(o), o === "plaintext") i.getIsSyntaxHighlightSupported() && i.setIsSyntaxHighlightSupported(!1);
|
|
2834
2860
|
else {
|
|
2835
|
-
i.getTheme() !== "github-light" && i.setTheme(
|
|
2836
|
-
let s = t ? t.getLoadedThemes().includes("github-light") ?
|
|
2861
|
+
i.getTheme() !== "github-light" && i.setTheme(ki);
|
|
2862
|
+
let s = t ? t.getLoadedThemes().includes("github-light") ? Pi(o) && !zi(t, o) ? Bi(o) : null : Vi() : Ri();
|
|
2837
2863
|
if (s) {
|
|
2838
2864
|
i.getIsSyntaxHighlightSupported() && i.setIsSyntaxHighlightSupported(!1), n.pendingKeys.add(a), n.loading !== s && (n.loading = s, s.then((t) => {
|
|
2839
2865
|
r(t);
|
|
2840
2866
|
let i = [...n.pendingKeys];
|
|
2841
|
-
n.pendingKeys.clear(), n.loading = null, e.update(() => i.forEach((e) =>
|
|
2867
|
+
n.pendingKeys.clear(), n.loading = null, e.update(() => i.forEach((e) => P(e)?.markDirty()), { tag: Le });
|
|
2842
2868
|
}, () => {
|
|
2843
2869
|
n.pendingKeys.clear(), n.loading = null;
|
|
2844
2870
|
}));
|
|
@@ -2848,46 +2874,46 @@ var Zn = (e) => {
|
|
|
2848
2874
|
}
|
|
2849
2875
|
n.nodesCurrentlyHighlighting.has(a) || (n.nodesCurrentlyHighlighting.add(a), n.didTransform || (n.didTransform = !0, De(() => {
|
|
2850
2876
|
n.didTransform = !1, n.nodesCurrentlyHighlighting.clear();
|
|
2851
|
-
})),
|
|
2852
|
-
let e =
|
|
2853
|
-
if (!
|
|
2854
|
-
let n =
|
|
2877
|
+
})), Ui(a, () => {
|
|
2878
|
+
let e = P(a);
|
|
2879
|
+
if (!te(e) || !e.isAttached()) return !1;
|
|
2880
|
+
let n = Hi(e, ji(e.getLanguage()), t), { from: r, to: i, replacement: o } = Gi(e.getChildren(), n);
|
|
2855
2881
|
return r === i && o.length === 0 ? !1 : (e.splice(r, i - r, o), !0);
|
|
2856
2882
|
}));
|
|
2857
|
-
},
|
|
2883
|
+
}, qi = () => {
|
|
2858
2884
|
let [e] = z();
|
|
2859
2885
|
return s(() => {
|
|
2860
|
-
if (!e.hasNodes([
|
|
2886
|
+
if (!e.hasNodes([j, A])) throw Error("CodeHighlightPlugin: code nodes are not registered");
|
|
2861
2887
|
let t = null, n = {
|
|
2862
2888
|
didTransform: !1,
|
|
2863
2889
|
nodesCurrentlyHighlighting: /* @__PURE__ */ new Set(),
|
|
2864
2890
|
pendingKeys: /* @__PURE__ */ new Set(),
|
|
2865
2891
|
loading: null
|
|
2866
|
-
}, r = (r) =>
|
|
2892
|
+
}, r = (r) => Ki(e, t, n, (e) => {
|
|
2867
2893
|
t = e;
|
|
2868
2894
|
}, r), i = (e) => {
|
|
2869
2895
|
let t = e.getParent();
|
|
2870
|
-
|
|
2896
|
+
te(t) ? r(t) : k(e) && e.replace(be(e.__text));
|
|
2871
2897
|
};
|
|
2872
|
-
return
|
|
2898
|
+
return qe(re(e), e.registerNodeTransform(j, r), e.registerNodeTransform(Ge, i), e.registerNodeTransform(A, i));
|
|
2873
2899
|
}, [e]), null;
|
|
2874
|
-
},
|
|
2900
|
+
}, Ji = () => {
|
|
2875
2901
|
let [e] = z();
|
|
2876
|
-
return s(() => (
|
|
2902
|
+
return s(() => (ge(e, !0), at(me(e), he(e, !1), pe(e), e.registerNodeTransform(ue, (e) => {
|
|
2877
2903
|
e.getBackgroundColor() !== null && e.setBackgroundColor(null);
|
|
2878
|
-
}), e.registerCommand(
|
|
2904
|
+
}), e.registerCommand(Be, (e) => {
|
|
2879
2905
|
let t = I();
|
|
2880
2906
|
if (!L(t) || !t.isCollapsed()) return !1;
|
|
2881
|
-
let n =
|
|
2907
|
+
let n = se(t.anchor.getNode());
|
|
2882
2908
|
if (n === null) return !1;
|
|
2883
2909
|
let r = e.shiftKey ? "previous" : "next", i = r === "next" ? "getNextSibling" : "getPreviousSibling", a = r === "next" ? "getFirstChild" : "getLastChild", o = n[i](), s = null;
|
|
2884
|
-
if (
|
|
2910
|
+
if (ce(o)) s = o;
|
|
2885
2911
|
else {
|
|
2886
|
-
let e = B(n,
|
|
2912
|
+
let e = B(n, le);
|
|
2887
2913
|
if (e !== null) for (let t = e[i](); t !== null; t = t[i]()) {
|
|
2888
|
-
if (!
|
|
2914
|
+
if (!le(t)) continue;
|
|
2889
2915
|
let e = t[a]();
|
|
2890
|
-
if (
|
|
2916
|
+
if (ce(e)) {
|
|
2891
2917
|
s = e;
|
|
2892
2918
|
break;
|
|
2893
2919
|
}
|
|
@@ -2897,15 +2923,15 @@ var Zn = (e) => {
|
|
|
2897
2923
|
let e = s.getFirstDescendant();
|
|
2898
2924
|
e ? e.selectStart() : s.selectStart();
|
|
2899
2925
|
} else {
|
|
2900
|
-
let e = B(n,
|
|
2926
|
+
let e = B(n, M);
|
|
2901
2927
|
e && (r === "next" ? e.selectNext() : e.selectPrevious());
|
|
2902
2928
|
}
|
|
2903
2929
|
return !0;
|
|
2904
|
-
},
|
|
2905
|
-
},
|
|
2930
|
+
}, Ae))), [e]), null;
|
|
2931
|
+
}, Yi = (e) => {
|
|
2906
2932
|
let t = e.getIndent();
|
|
2907
2933
|
t < 8 && e.setIndent(t + 1);
|
|
2908
|
-
},
|
|
2934
|
+
}, Xi = (e) => {
|
|
2909
2935
|
let t = e.getIndent();
|
|
2910
2936
|
if (t > 8) {
|
|
2911
2937
|
e.setIndent(8);
|
|
@@ -2915,42 +2941,97 @@ var Zn = (e) => {
|
|
|
2915
2941
|
};
|
|
2916
2942
|
//#endregion
|
|
2917
2943
|
//#region src/components/Editor/plugins/IndentLimitPlugin.tsx
|
|
2918
|
-
function
|
|
2944
|
+
function Zi() {
|
|
2919
2945
|
let [e] = z();
|
|
2920
|
-
return s(() =>
|
|
2946
|
+
return s(() => at(e.registerCommand(Re, () => it(Yi), Ae), e.registerNodeTransform(We, Xi), e.registerNodeTransform(oe, Xi), e.registerNodeTransform(T, Xi)), [e]), null;
|
|
2947
|
+
}
|
|
2948
|
+
//#endregion
|
|
2949
|
+
//#region src/components/Editor/utils/imePendingFormat.ts
|
|
2950
|
+
function Qi() {
|
|
2951
|
+
let e = I();
|
|
2952
|
+
if (!L(e) || !e.isCollapsed()) return null;
|
|
2953
|
+
let t = e.anchor.getNode();
|
|
2954
|
+
if (!R(t)) return null;
|
|
2955
|
+
let n = t.getFormat(), r = t.getStyle();
|
|
2956
|
+
if (e.format === n && e.style === r) return null;
|
|
2957
|
+
let i = {
|
|
2958
|
+
format: e.format,
|
|
2959
|
+
style: e.style,
|
|
2960
|
+
offset: e.anchor.offset,
|
|
2961
|
+
key: t.getKey()
|
|
2962
|
+
};
|
|
2963
|
+
return e.setFormat(n), e.setStyle(r), i;
|
|
2964
|
+
}
|
|
2965
|
+
function $i(e) {
|
|
2966
|
+
let t = I();
|
|
2967
|
+
if (!L(t)) return;
|
|
2968
|
+
let n = t.anchor.getNode();
|
|
2969
|
+
if (R(n) && n.getKey() === e.key) {
|
|
2970
|
+
let r = t.anchor.offset;
|
|
2971
|
+
if (r > e.offset) {
|
|
2972
|
+
let t = n.splitText(e.offset, r), i = e.offset === 0 ? t[0] : t[1];
|
|
2973
|
+
i.setFormat(e.format), i.setStyle(e.style), i.selectEnd();
|
|
2974
|
+
}
|
|
2975
|
+
}
|
|
2976
|
+
let r = I();
|
|
2977
|
+
L(r) && (r.setFormat(e.format), r.setStyle(e.style));
|
|
2978
|
+
}
|
|
2979
|
+
//#endregion
|
|
2980
|
+
//#region src/components/Editor/plugins/ImePendingFormatPlugin.tsx
|
|
2981
|
+
function ea() {
|
|
2982
|
+
let [e] = z(), t = u(null);
|
|
2983
|
+
return s(() => {
|
|
2984
|
+
let n = e.registerCommand(Me, () => (t.current = Qi(), !1), ke), r = e.registerUpdateListener(({ tags: n }) => {
|
|
2985
|
+
if (!n.has("composition-end") || t.current === null) return;
|
|
2986
|
+
let r = t.current;
|
|
2987
|
+
t.current = null, e.update(() => {
|
|
2988
|
+
$i(r);
|
|
2989
|
+
});
|
|
2990
|
+
});
|
|
2991
|
+
return () => {
|
|
2992
|
+
n(), r();
|
|
2993
|
+
};
|
|
2994
|
+
}, [e]), null;
|
|
2921
2995
|
}
|
|
2922
2996
|
//#endregion
|
|
2923
2997
|
//#region src/components/Editor/EditorCore.tsx
|
|
2924
|
-
var
|
|
2925
|
-
let [f] = z(), { t: h } = e(), [g, _] = d(!1), v = i ?? g, y =
|
|
2998
|
+
var ta = ({ value: n, onChange: r, open: i, onOpenChange: a, toolbar: o, upload: c, ai: l }) => {
|
|
2999
|
+
let [f] = z(), { t: h } = e(), [g, _] = d(!1), v = i ?? g, y = Di(v), ee = (e) => {
|
|
2926
3000
|
a?.(e), i === void 0 && _(e);
|
|
2927
|
-
}, [
|
|
3001
|
+
}, [b, x] = d(null), [S, C] = d(() => ({
|
|
2928
3002
|
fontColor: y.fontColor,
|
|
2929
3003
|
fill: y.backgroundColor
|
|
2930
|
-
})),
|
|
3004
|
+
})), w = u(!1), [T, E] = d(!1), D = u(null), O = () => {
|
|
2931
3005
|
f.getEditorState().read(() => {
|
|
2932
|
-
|
|
3006
|
+
D.current = I()?.clone() ?? null;
|
|
2933
3007
|
});
|
|
2934
|
-
}, { linkForm:
|
|
3008
|
+
}, { linkForm: k, openLink: te, confirmLink: ne, closeLink: A } = pr({
|
|
2935
3009
|
editor: f,
|
|
2936
|
-
savedSelectionRef:
|
|
2937
|
-
captureSelection:
|
|
2938
|
-
}), [
|
|
3010
|
+
savedSelectionRef: D,
|
|
3011
|
+
captureSelection: O
|
|
3012
|
+
}), [j] = d(() => /* @__PURE__ */ new Map()), { fileInputRef: re, uploadProgress: ie, insertImage: ae, onFileChange: oe, abortUpload: se } = fr({
|
|
2939
3013
|
editor: f,
|
|
2940
3014
|
upload: c,
|
|
2941
|
-
savedSelectionRef:
|
|
2942
|
-
attachmentsBySrc:
|
|
2943
|
-
}),
|
|
3015
|
+
savedSelectionRef: D,
|
|
3016
|
+
attachmentsBySrc: j
|
|
3017
|
+
}), ce = mr({
|
|
2944
3018
|
editor: f,
|
|
2945
3019
|
value: n,
|
|
2946
3020
|
onChange: r,
|
|
2947
|
-
attachmentsBySrc:
|
|
2948
|
-
}),
|
|
3021
|
+
attachmentsBySrc: j
|
|
3022
|
+
}), M = tr({
|
|
2949
3023
|
editor: f,
|
|
2950
3024
|
ai: l
|
|
2951
|
-
}), [
|
|
3025
|
+
}), [le, ue] = d(0), de = o?.config ?? gt;
|
|
2952
3026
|
s(() => {
|
|
2953
|
-
|
|
3027
|
+
if (!y.hasEditorText) {
|
|
3028
|
+
C({
|
|
3029
|
+
fontColor: dt,
|
|
3030
|
+
fill: ft
|
|
3031
|
+
});
|
|
3032
|
+
return;
|
|
3033
|
+
}
|
|
3034
|
+
y.hasRangeSelection && C({
|
|
2954
3035
|
fontColor: y.fontColor,
|
|
2955
3036
|
fill: y.backgroundColor
|
|
2956
3037
|
});
|
|
@@ -2960,43 +3041,43 @@ var qi = ({ value: n, onChange: r, open: i, onOpenChange: a, toolbar: o, upload:
|
|
|
2960
3041
|
y.hasEditorText,
|
|
2961
3042
|
y.hasRangeSelection
|
|
2962
3043
|
]);
|
|
2963
|
-
let
|
|
2964
|
-
|
|
3044
|
+
let fe = () => {
|
|
3045
|
+
se(), M.close(), x(null), A(), E(!1), ee(!1);
|
|
2965
3046
|
};
|
|
2966
3047
|
s(() => {
|
|
2967
3048
|
if (!v) return;
|
|
2968
3049
|
let e = window.visualViewport;
|
|
2969
3050
|
if (!e) return;
|
|
2970
3051
|
let t = () => {
|
|
2971
|
-
|
|
3052
|
+
ue(Math.max(0, window.innerHeight - e.height - e.offsetTop));
|
|
2972
3053
|
};
|
|
2973
3054
|
return e.addEventListener("resize", t), e.addEventListener("scroll", t), t(), () => {
|
|
2974
3055
|
e.removeEventListener("resize", t), e.removeEventListener("scroll", t);
|
|
2975
3056
|
};
|
|
2976
3057
|
}, [v]), s(() => {
|
|
2977
|
-
v ||
|
|
2978
|
-
}, [
|
|
3058
|
+
v || se();
|
|
3059
|
+
}, [se, v]), s(() => {
|
|
2979
3060
|
if (v) return f.setEditable(!0), f.registerRootListener((e) => {
|
|
2980
3061
|
e && f.focus(void 0, { defaultSelection: "rootEnd" });
|
|
2981
3062
|
});
|
|
2982
3063
|
}, [v, f]);
|
|
2983
|
-
let
|
|
2984
|
-
|
|
2985
|
-
},
|
|
2986
|
-
|
|
3064
|
+
let pe = () => {
|
|
3065
|
+
w.current = !0, x(null), M.startTypeset();
|
|
3066
|
+
}, me = (e) => {
|
|
3067
|
+
b === "aiPreset" && (w.current = !0), x(null), M.startPolish(e);
|
|
2987
3068
|
};
|
|
2988
3069
|
return /* @__PURE__ */ p(t, {
|
|
2989
3070
|
open: v,
|
|
2990
|
-
onClose:
|
|
3071
|
+
onClose: fe,
|
|
2991
3072
|
position: "bottom",
|
|
2992
3073
|
closeOnClickOverlay: !0,
|
|
2993
|
-
children: /* @__PURE__ */ p(
|
|
2994
|
-
value:
|
|
3074
|
+
children: /* @__PURE__ */ p(nr.Provider, {
|
|
3075
|
+
value: ie,
|
|
2995
3076
|
children: /* @__PURE__ */ m("div", {
|
|
2996
3077
|
className: V["bsy-mobile-editor"],
|
|
2997
3078
|
style: {
|
|
2998
3079
|
height: 300,
|
|
2999
|
-
transform:
|
|
3080
|
+
transform: le ? `translate3d(0, -${le}px, 0)` : void 0
|
|
3000
3081
|
},
|
|
3001
3082
|
children: [
|
|
3002
3083
|
/* @__PURE__ */ p("div", {
|
|
@@ -3009,110 +3090,112 @@ var qi = ({ value: n, onChange: r, open: i, onOpenChange: a, toolbar: o, upload:
|
|
|
3009
3090
|
/* @__PURE__ */ p("div", {
|
|
3010
3091
|
className: V["bsy-mobile-editor__content"],
|
|
3011
3092
|
style: { height: 200 },
|
|
3012
|
-
children: /* @__PURE__ */ p(
|
|
3013
|
-
contentEditable: /* @__PURE__ */ p(
|
|
3014
|
-
ErrorBoundary:
|
|
3093
|
+
children: /* @__PURE__ */ p($e, {
|
|
3094
|
+
contentEditable: /* @__PURE__ */ p(Je, { className: V["bsy-mobile-editor__editable"] }),
|
|
3095
|
+
ErrorBoundary: et
|
|
3015
3096
|
})
|
|
3016
3097
|
}),
|
|
3017
|
-
|
|
3018
|
-
config:
|
|
3098
|
+
de.length > 0 ? /* @__PURE__ */ p(wi, {
|
|
3099
|
+
config: de,
|
|
3019
3100
|
formats: y,
|
|
3020
|
-
colorValues:
|
|
3021
|
-
openSheet:
|
|
3101
|
+
colorValues: S,
|
|
3102
|
+
openSheet: b,
|
|
3022
3103
|
onOpenSheet: (e) => {
|
|
3023
|
-
(e === "fontColor" || e === "fill") && (
|
|
3104
|
+
(e === "fontColor" || e === "fill") && (O(), C((t) => {
|
|
3024
3105
|
let n = e === "fill" ? y.backgroundColor : y.fontColor, r = y.hasRangeSelection && y.hasEditorText;
|
|
3025
3106
|
return {
|
|
3026
3107
|
...t,
|
|
3027
3108
|
[e]: r ? n : t[e]
|
|
3028
3109
|
};
|
|
3029
|
-
})),
|
|
3110
|
+
})), x(e);
|
|
3030
3111
|
},
|
|
3031
|
-
onOpenLink:
|
|
3112
|
+
onOpenLink: te
|
|
3032
3113
|
}) : null,
|
|
3033
|
-
/* @__PURE__ */ p(qe, {}),
|
|
3034
3114
|
/* @__PURE__ */ p(Ye, {}),
|
|
3035
|
-
/* @__PURE__ */ p(
|
|
3036
|
-
/* @__PURE__ */ p(
|
|
3037
|
-
/* @__PURE__ */ p(
|
|
3038
|
-
/* @__PURE__ */ p(
|
|
3039
|
-
/* @__PURE__ */ p(
|
|
3040
|
-
/* @__PURE__ */ p(
|
|
3041
|
-
/* @__PURE__ */ p(
|
|
3042
|
-
/* @__PURE__ */ p(
|
|
3043
|
-
/* @__PURE__ */ p(
|
|
3044
|
-
|
|
3115
|
+
/* @__PURE__ */ p(Ze, {}),
|
|
3116
|
+
/* @__PURE__ */ p(Xe, {}),
|
|
3117
|
+
/* @__PURE__ */ p(gr, {}),
|
|
3118
|
+
/* @__PURE__ */ p(Sr, {}),
|
|
3119
|
+
/* @__PURE__ */ p(vr, {}),
|
|
3120
|
+
/* @__PURE__ */ p(br, {}),
|
|
3121
|
+
/* @__PURE__ */ p(qi, {}),
|
|
3122
|
+
/* @__PURE__ */ p(Ji, {}),
|
|
3123
|
+
/* @__PURE__ */ p(Zi, {}),
|
|
3124
|
+
/* @__PURE__ */ p(ea, {}),
|
|
3125
|
+
/* @__PURE__ */ p(Qe, {
|
|
3126
|
+
onChange: ce,
|
|
3045
3127
|
ignoreSelectionChange: !0
|
|
3046
3128
|
}),
|
|
3047
3129
|
/* @__PURE__ */ p("input", {
|
|
3048
|
-
ref:
|
|
3130
|
+
ref: re,
|
|
3049
3131
|
type: "file",
|
|
3050
|
-
accept:
|
|
3132
|
+
accept: vt,
|
|
3051
3133
|
hidden: !0,
|
|
3052
|
-
onChange:
|
|
3134
|
+
onChange: oe
|
|
3053
3135
|
}),
|
|
3054
|
-
/* @__PURE__ */ p(
|
|
3055
|
-
sheet:
|
|
3136
|
+
/* @__PURE__ */ p(Ur, {
|
|
3137
|
+
sheet: b,
|
|
3138
|
+
formats: y,
|
|
3056
3139
|
onClose: () => {
|
|
3057
|
-
if (
|
|
3058
|
-
|
|
3140
|
+
if (w.current) {
|
|
3141
|
+
w.current = !1;
|
|
3059
3142
|
return;
|
|
3060
3143
|
}
|
|
3061
|
-
|
|
3144
|
+
x(null), window.requestAnimationFrame(() => f.focus());
|
|
3062
3145
|
},
|
|
3063
|
-
onTypeset:
|
|
3146
|
+
onTypeset: pe,
|
|
3064
3147
|
onPolishMenu: () => {
|
|
3065
|
-
|
|
3148
|
+
w.current = !0, x("aiPreset");
|
|
3066
3149
|
},
|
|
3067
|
-
onPickPreset:
|
|
3068
|
-
savedSelectionRef:
|
|
3069
|
-
committedColors:
|
|
3070
|
-
onColorCommit: (e, t) =>
|
|
3150
|
+
onPickPreset: me,
|
|
3151
|
+
savedSelectionRef: D,
|
|
3152
|
+
committedColors: S,
|
|
3153
|
+
onColorCommit: (e, t) => C((n) => ({
|
|
3071
3154
|
...n,
|
|
3072
3155
|
[e]: t
|
|
3073
3156
|
})),
|
|
3074
3157
|
onPicture: (e) => {
|
|
3075
|
-
if (
|
|
3076
|
-
|
|
3158
|
+
if (O(), e === "upload") {
|
|
3159
|
+
re.current?.click();
|
|
3077
3160
|
return;
|
|
3078
3161
|
}
|
|
3079
|
-
|
|
3162
|
+
w.current = !0, x(null), E(!0);
|
|
3080
3163
|
},
|
|
3081
3164
|
canTypeset: !!l?.typeset,
|
|
3082
3165
|
canPolish: !!l?.polish
|
|
3083
3166
|
}),
|
|
3084
|
-
/* @__PURE__ */ p(
|
|
3085
|
-
open:
|
|
3086
|
-
seed:
|
|
3087
|
-
onClose:
|
|
3088
|
-
onConfirm:
|
|
3167
|
+
/* @__PURE__ */ p(Gr, {
|
|
3168
|
+
open: k !== null,
|
|
3169
|
+
seed: k,
|
|
3170
|
+
onClose: A,
|
|
3171
|
+
onConfirm: ne
|
|
3089
3172
|
}),
|
|
3090
|
-
/* @__PURE__ */ p(
|
|
3091
|
-
open:
|
|
3092
|
-
onClose: () =>
|
|
3173
|
+
/* @__PURE__ */ p(qr, {
|
|
3174
|
+
open: T,
|
|
3175
|
+
onClose: () => E(!1),
|
|
3093
3176
|
onConfirm: (e) => {
|
|
3094
|
-
|
|
3177
|
+
ae(e, "", e), E(!1);
|
|
3095
3178
|
}
|
|
3096
3179
|
}),
|
|
3097
|
-
/* @__PURE__ */ p(
|
|
3098
|
-
open:
|
|
3099
|
-
mode:
|
|
3100
|
-
originalHtml:
|
|
3101
|
-
codeBlocks:
|
|
3180
|
+
/* @__PURE__ */ p(ai, {
|
|
3181
|
+
open: M.mode !== null,
|
|
3182
|
+
mode: M.mode,
|
|
3183
|
+
originalHtml: M.snapshot.html,
|
|
3184
|
+
codeBlocks: M.snapshot.codeBlocks,
|
|
3102
3185
|
ai: l,
|
|
3103
|
-
polishPreset:
|
|
3104
|
-
onClose:
|
|
3105
|
-
onApply:
|
|
3106
|
-
onPickPreset:
|
|
3186
|
+
polishPreset: M.preset,
|
|
3187
|
+
onClose: M.close,
|
|
3188
|
+
onApply: M.apply,
|
|
3189
|
+
onPickPreset: me
|
|
3107
3190
|
})
|
|
3108
3191
|
]
|
|
3109
3192
|
})
|
|
3110
3193
|
})
|
|
3111
3194
|
});
|
|
3112
|
-
},
|
|
3195
|
+
}, na = "1px solid #d9d9d9", ra = { export: new Map([[ue, (e, t) => {
|
|
3113
3196
|
let n = t.exportDOM(e);
|
|
3114
|
-
return
|
|
3115
|
-
}]]) },
|
|
3197
|
+
return Ke(n.element) && (n.element.style.border = na), n;
|
|
3198
|
+
}]]) }, ia = class e extends b {
|
|
3116
3199
|
constructor(e = "", t = {}, n) {
|
|
3117
3200
|
super(e, t, n);
|
|
3118
3201
|
}
|
|
@@ -3127,12 +3210,12 @@ var qi = ({ value: n, onChange: r, open: i, onOpenChange: a, toolbar: o, upload:
|
|
|
3127
3210
|
}, t.__key);
|
|
3128
3211
|
}
|
|
3129
3212
|
static importJSON(e) {
|
|
3130
|
-
return
|
|
3213
|
+
return aa().updateFromJSON(e);
|
|
3131
3214
|
}
|
|
3132
3215
|
sanitizeUrl(e) {
|
|
3133
3216
|
return e.startsWith("@") ? e : super.sanitizeUrl(e);
|
|
3134
3217
|
}
|
|
3135
|
-
},
|
|
3218
|
+
}, aa = (e = "", t = {}) => _e(new ia(e, t)), oa = {
|
|
3136
3219
|
namespace: "bsyLexicalEditor",
|
|
3137
3220
|
onError: (e) => {
|
|
3138
3221
|
console.error("Lexical error", e);
|
|
@@ -3165,39 +3248,39 @@ var qi = ({ value: n, onChange: r, open: i, onOpenChange: a, toolbar: o, upload:
|
|
|
3165
3248
|
tableRow: "editor-table-row",
|
|
3166
3249
|
tableScrollableWrapper: "editor-table-scrollable-wrapper"
|
|
3167
3250
|
},
|
|
3168
|
-
html:
|
|
3251
|
+
html: ra,
|
|
3169
3252
|
nodes: [
|
|
3170
|
-
|
|
3253
|
+
ia,
|
|
3171
3254
|
{
|
|
3172
|
-
replace:
|
|
3173
|
-
with: (e) => new
|
|
3255
|
+
replace: b,
|
|
3256
|
+
with: (e) => new ia(e.__url, {
|
|
3174
3257
|
rel: e.__rel,
|
|
3175
3258
|
target: e.__target,
|
|
3176
3259
|
title: e.__title
|
|
3177
3260
|
}),
|
|
3178
|
-
withKlass:
|
|
3261
|
+
withKlass: ia
|
|
3179
3262
|
},
|
|
3180
|
-
|
|
3181
|
-
D,
|
|
3263
|
+
ee,
|
|
3182
3264
|
E,
|
|
3183
|
-
|
|
3184
|
-
|
|
3265
|
+
T,
|
|
3266
|
+
oe,
|
|
3185
3267
|
j,
|
|
3186
|
-
|
|
3268
|
+
A,
|
|
3187
3269
|
de,
|
|
3188
|
-
|
|
3189
|
-
|
|
3270
|
+
fe,
|
|
3271
|
+
ue,
|
|
3272
|
+
or,
|
|
3190
3273
|
q,
|
|
3191
3274
|
{
|
|
3192
|
-
replace:
|
|
3275
|
+
replace: Ge,
|
|
3193
3276
|
with: (e) => new q(e.__text),
|
|
3194
3277
|
withKlass: q
|
|
3195
3278
|
}
|
|
3196
3279
|
]
|
|
3197
|
-
},
|
|
3198
|
-
initialConfig:
|
|
3199
|
-
children: /* @__PURE__ */ p(
|
|
3280
|
+
}, sa = (e) => /* @__PURE__ */ p(g, {
|
|
3281
|
+
initialConfig: oa,
|
|
3282
|
+
children: /* @__PURE__ */ p(ta, { ...e })
|
|
3200
3283
|
});
|
|
3201
|
-
|
|
3284
|
+
sa.displayName = "BsyMobileEditor";
|
|
3202
3285
|
//#endregion
|
|
3203
|
-
export {
|
|
3286
|
+
export { Yr as n, sa as t };
|