@baishuyun/ui-mobile 0.13.0 → 0.13.2
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/{Calendar-Bs1aP8-o.js → Calendar-fGgQWuYV.js} +6 -6
- package/dist/Calendar/index.js +3 -3
- package/dist/ConfigProvider/index.js +1 -1
- package/dist/Editor/{Editor-C9XclcXa.js → Editor-Dw7Ydzum.js} +787 -720
- package/dist/Editor/index.js +2 -2
- package/dist/Gantt/{Gantt-Bhvbj3l8.js → Gantt-f_Wfgcug.js} +3 -3
- package/dist/Gantt/index.js +2 -2
- package/dist/Icon/index.js +1 -1
- package/dist/Overlay/index.js +1 -1
- package/dist/Popup/index.js +1 -1
- package/dist/Segmented/{Segmented-PwHjDHry.js → Segmented-nQljvvVM.js} +9 -9
- package/dist/Segmented/index.js +2 -2
- package/dist/components/Editor/plugins/ImePendingFormatPlugin.d.ts +1 -0
- package/dist/components/Editor/utils/imePendingFormat.d.ts +8 -0
- package/dist/index.js +5 -5
- package/dist/style.css +1 -1
- package/dist/vendors/{version-DwyB7hbm.js → version-DnMk3YN4.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
|
-
},
|
|
387
|
-
let n =
|
|
386
|
+
}, Wt = (e, t) => {
|
|
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
|
-
n.select(),
|
|
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
|
-
},
|
|
408
|
-
|
|
407
|
+
}, qt = () => {
|
|
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 ?
|
|
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 =
|
|
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 Qn = (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 Qn = (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 Qn = (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 Qn = (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 Qn = (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 Qn = (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 Qn = (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 Qn = (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 Qn = (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,14 +964,14 @@ var Qn = (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
|
|
972
972
|
});
|
|
973
|
-
a = e.getKey(),
|
|
974
|
-
for (let t of e.getParent()?.getChildren() ?? [])
|
|
973
|
+
a = e.getKey(), xe([e]);
|
|
974
|
+
for (let t of e.getParent()?.getChildren() ?? []) R(t) && t.getTextContentSize() === 0 && t.remove();
|
|
975
975
|
}), a;
|
|
976
976
|
}, [e, n]);
|
|
977
977
|
return {
|
|
@@ -980,7 +980,7 @@ var Qn = (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 Qn = (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 Qn = (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,13 +1049,13 @@ var Qn = (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,
|
|
1056
1056
|
openLink: () => {
|
|
1057
1057
|
n(), e.getEditorState().read(() => {
|
|
1058
|
-
let e =
|
|
1058
|
+
let e = I(), t = L(e) ? e.anchor.getNode() : null, n = t ? B(t, v) : null;
|
|
1059
1059
|
if (n) {
|
|
1060
1060
|
i({
|
|
1061
1061
|
url: n.getURL(),
|
|
@@ -1066,7 +1066,7 @@ var Qn = (e) => {
|
|
|
1066
1066
|
}
|
|
1067
1067
|
i({
|
|
1068
1068
|
url: "",
|
|
1069
|
-
text:
|
|
1069
|
+
text: L(e) ? e.getTextContent() : "",
|
|
1070
1070
|
newBlank: !0
|
|
1071
1071
|
});
|
|
1072
1072
|
});
|
|
@@ -1076,26 +1076,26 @@ var Qn = (e) => {
|
|
|
1076
1076
|
if (!r) return;
|
|
1077
1077
|
let a = r.startsWith("@") || /^https?:\/\//.test(r) ? r : `http://${r}`;
|
|
1078
1078
|
e.update(() => {
|
|
1079
|
-
|
|
1080
|
-
let e =
|
|
1079
|
+
Kt(t.current);
|
|
1080
|
+
let e = I(), r = n.newBlank ? {
|
|
1081
1081
|
target: "_blank",
|
|
1082
1082
|
rel: "noopener noreferrer",
|
|
1083
1083
|
title: n.url
|
|
1084
1084
|
} : { title: n.url };
|
|
1085
|
-
if (
|
|
1085
|
+
if (L(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
|
-
let i =
|
|
1096
|
-
if (
|
|
1095
|
+
let i = F(), o = i.getLastChild();
|
|
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 Qn = (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 =
|
|
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 Qn = (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 Qn = (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 >=
|
|
1137
|
-
let i =
|
|
1138
|
-
if (!
|
|
1136
|
+
if (t.current = n, r <= 0 || r >= hr) return !1;
|
|
1137
|
+
let i = I();
|
|
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 Qn = (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 Qn = (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 Qn = (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 Qn = (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);
|
|
@@ -1232,7 +1232,7 @@ var Qn = (e) => {
|
|
|
1232
1232
|
...r,
|
|
1233
1233
|
forChild: (e, t) => {
|
|
1234
1234
|
let n = (r?.forChild ?? ((e) => e))(e, t);
|
|
1235
|
-
if (
|
|
1235
|
+
if (R(n)) {
|
|
1236
1236
|
let e = [
|
|
1237
1237
|
i ? `background-color: ${i}` : null,
|
|
1238
1238
|
a ? `color: ${a}` : null,
|
|
@@ -1245,53 +1245,53 @@ var Qn = (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 !
|
|
1268
|
-
let t =
|
|
1267
|
+
return !xr.test(r) && !i || e.update(() => {
|
|
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 Qn = (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 Qn = (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 Qn = (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 Qn = (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 Qn = (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 Qn = (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 Qn = (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 Qn = (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,114 +1519,114 @@ var Qn = (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
|
-
|
|
1539
|
-
let e =
|
|
1540
|
-
e &&
|
|
1538
|
+
Kt(n), qt();
|
|
1539
|
+
let e = I();
|
|
1540
|
+
e && st(e, t);
|
|
1541
1541
|
});
|
|
1542
|
-
},
|
|
1543
|
-
let [
|
|
1544
|
-
|
|
1545
|
-
},
|
|
1546
|
-
|
|
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
|
+
}, O = (e) => {
|
|
1546
|
+
w.current = null, D(e, !0, !1);
|
|
1547
1547
|
};
|
|
1548
1548
|
return /* @__PURE__ */ m(f, { children: [
|
|
1549
1549
|
/* @__PURE__ */ p(r, {
|
|
1550
1550
|
open: i === "align",
|
|
1551
|
-
title:
|
|
1551
|
+
title: x("editor.alignment"),
|
|
1552
1552
|
onClose: o,
|
|
1553
1553
|
actions: [
|
|
1554
1554
|
{
|
|
1555
1555
|
key: "left",
|
|
1556
|
-
text:
|
|
1556
|
+
text: x("editor.leftAlign"),
|
|
1557
1557
|
selected: a.align === "left"
|
|
1558
1558
|
},
|
|
1559
1559
|
{
|
|
1560
1560
|
key: "center",
|
|
1561
|
-
text:
|
|
1561
|
+
text: x("editor.centerAlign"),
|
|
1562
1562
|
selected: a.align === "center"
|
|
1563
1563
|
},
|
|
1564
1564
|
{
|
|
1565
1565
|
key: "right",
|
|
1566
|
-
text:
|
|
1566
|
+
text: x("editor.rightAlign"),
|
|
1567
1567
|
selected: a.align === "right"
|
|
1568
1568
|
}
|
|
1569
1569
|
],
|
|
1570
1570
|
onAction: (e) => {
|
|
1571
|
-
H(
|
|
1571
|
+
H(b), b.dispatchCommand(Fe, e.key);
|
|
1572
1572
|
}
|
|
1573
1573
|
}),
|
|
1574
1574
|
/* @__PURE__ */ p(r, {
|
|
1575
1575
|
open: i === "heading",
|
|
1576
|
-
title:
|
|
1576
|
+
title: x("editor.heading"),
|
|
1577
1577
|
onClose: o,
|
|
1578
1578
|
actions: [
|
|
1579
1579
|
{
|
|
1580
1580
|
key: "paragraph",
|
|
1581
|
-
text:
|
|
1581
|
+
text: x("editor.paragraph"),
|
|
1582
1582
|
selected: a.headingTag === !1
|
|
1583
1583
|
},
|
|
1584
1584
|
{
|
|
1585
1585
|
key: "h1",
|
|
1586
|
-
text:
|
|
1586
|
+
text: x("editor.heading1"),
|
|
1587
1587
|
selected: a.headingTag === "h1"
|
|
1588
1588
|
},
|
|
1589
1589
|
{
|
|
1590
1590
|
key: "h2",
|
|
1591
|
-
text:
|
|
1591
|
+
text: x("editor.heading2"),
|
|
1592
1592
|
selected: a.headingTag === "h2"
|
|
1593
1593
|
},
|
|
1594
1594
|
{
|
|
1595
1595
|
key: "h3",
|
|
1596
|
-
text:
|
|
1596
|
+
text: x("editor.heading3"),
|
|
1597
1597
|
selected: a.headingTag === "h3"
|
|
1598
1598
|
}
|
|
1599
1599
|
],
|
|
1600
|
-
onAction: (e) =>
|
|
1600
|
+
onAction: (e) => Vr(b, e.key)
|
|
1601
1601
|
}),
|
|
1602
1602
|
/* @__PURE__ */ p(r, {
|
|
1603
1603
|
open: i === "fontSize",
|
|
1604
|
-
title:
|
|
1604
|
+
title: x("editor.fontSize"),
|
|
1605
1605
|
onClose: o,
|
|
1606
|
-
actions:
|
|
1606
|
+
actions: lt.map((e) => ({
|
|
1607
1607
|
key: e.value,
|
|
1608
1608
|
text: e.label,
|
|
1609
1609
|
selected: e.value === a.fontSize
|
|
1610
1610
|
})),
|
|
1611
|
-
onAction: (e) =>
|
|
1611
|
+
onAction: (e) => Hr(b, { "font-size": e.key })
|
|
1612
1612
|
}),
|
|
1613
1613
|
/* @__PURE__ */ p(t, {
|
|
1614
|
-
open:
|
|
1614
|
+
open: T !== null,
|
|
1615
1615
|
onClose: () => {
|
|
1616
|
-
let e =
|
|
1617
|
-
e &&
|
|
1616
|
+
let e = w.current;
|
|
1617
|
+
e && O(e), o();
|
|
1618
1618
|
},
|
|
1619
1619
|
position: "bottom",
|
|
1620
|
-
children:
|
|
1621
|
-
mode:
|
|
1622
|
-
currentColor:
|
|
1623
|
-
customColors:
|
|
1624
|
-
onApply:
|
|
1620
|
+
children: T ? /* @__PURE__ */ p(Br, {
|
|
1621
|
+
mode: T,
|
|
1622
|
+
currentColor: E,
|
|
1623
|
+
customColors: S,
|
|
1624
|
+
onApply: D,
|
|
1625
1625
|
onCustomDraftChange: (e) => {
|
|
1626
|
-
|
|
1626
|
+
w.current = e;
|
|
1627
1627
|
},
|
|
1628
|
-
onCustomConfirm:
|
|
1629
|
-
},
|
|
1628
|
+
onCustomConfirm: O
|
|
1629
|
+
}, T) : null
|
|
1630
1630
|
}),
|
|
1631
1631
|
/* @__PURE__ */ p(r, {
|
|
1632
1632
|
mode: "menu",
|
|
@@ -1634,10 +1634,10 @@ var Qn = (e) => {
|
|
|
1634
1634
|
onClose: o,
|
|
1635
1635
|
actions: [{
|
|
1636
1636
|
key: "typeset",
|
|
1637
|
-
text:
|
|
1637
|
+
text: x("editor.aiTypeset"),
|
|
1638
1638
|
disabled: !y,
|
|
1639
1639
|
icon: /* @__PURE__ */ p("img", {
|
|
1640
|
-
src:
|
|
1640
|
+
src: Cr,
|
|
1641
1641
|
alt: "",
|
|
1642
1642
|
width: 16,
|
|
1643
1643
|
height: 16,
|
|
@@ -1646,10 +1646,10 @@ var Qn = (e) => {
|
|
|
1646
1646
|
})
|
|
1647
1647
|
}, {
|
|
1648
1648
|
key: "polish",
|
|
1649
|
-
text:
|
|
1650
|
-
disabled: !
|
|
1649
|
+
text: x("editor.aiPolish"),
|
|
1650
|
+
disabled: !ee,
|
|
1651
1651
|
icon: /* @__PURE__ */ p("img", {
|
|
1652
|
-
src:
|
|
1652
|
+
src: wr,
|
|
1653
1653
|
alt: "",
|
|
1654
1654
|
width: 16,
|
|
1655
1655
|
height: 16,
|
|
@@ -1668,29 +1668,29 @@ var Qn = (e) => {
|
|
|
1668
1668
|
/* @__PURE__ */ p(r, {
|
|
1669
1669
|
mode: "menu",
|
|
1670
1670
|
open: i === "aiPreset",
|
|
1671
|
-
title:
|
|
1671
|
+
title: x("editor.aiPolish"),
|
|
1672
1672
|
onClose: o,
|
|
1673
|
-
actions:
|
|
1673
|
+
actions: mt.map((e) => ({
|
|
1674
1674
|
key: e,
|
|
1675
|
-
text:
|
|
1675
|
+
text: x(ht[e])
|
|
1676
1676
|
})),
|
|
1677
1677
|
onAction: (e) => l(e.key)
|
|
1678
1678
|
}),
|
|
1679
1679
|
/* @__PURE__ */ p(r, {
|
|
1680
1680
|
mode: "menu",
|
|
1681
1681
|
open: i === "picture",
|
|
1682
|
-
title:
|
|
1682
|
+
title: x("editor.picture"),
|
|
1683
1683
|
onClose: o,
|
|
1684
1684
|
actions: [{
|
|
1685
1685
|
key: "upload",
|
|
1686
|
-
text:
|
|
1686
|
+
text: x("editor.uploadImage"),
|
|
1687
1687
|
icon: /* @__PURE__ */ p(n, {
|
|
1688
1688
|
name: "picture",
|
|
1689
1689
|
size: 16
|
|
1690
1690
|
})
|
|
1691
1691
|
}, {
|
|
1692
1692
|
key: "url",
|
|
1693
|
-
text:
|
|
1693
|
+
text: x("editor.imageUrl"),
|
|
1694
1694
|
icon: /* @__PURE__ */ p(n, {
|
|
1695
1695
|
name: "Insertlink",
|
|
1696
1696
|
size: 16
|
|
@@ -1699,7 +1699,7 @@ var Qn = (e) => {
|
|
|
1699
1699
|
onAction: (e) => h(e.key)
|
|
1700
1700
|
})
|
|
1701
1701
|
] });
|
|
1702
|
-
},
|
|
1702
|
+
}, Wr = ({ open: r, title: i, bodyClassName: a, onClose: o, onConfirm: s, children: c }) => {
|
|
1703
1703
|
let { t: l } = e();
|
|
1704
1704
|
return /* @__PURE__ */ p(t, {
|
|
1705
1705
|
open: r,
|
|
@@ -1744,11 +1744,11 @@ var Qn = (e) => {
|
|
|
1744
1744
|
]
|
|
1745
1745
|
})
|
|
1746
1746
|
});
|
|
1747
|
-
},
|
|
1747
|
+
}, Gr = ({ open: t, seed: r, onClose: i, onConfirm: a }) => {
|
|
1748
1748
|
let { t: o } = e(), [c, l] = d(""), [u, f] = d(""), [h, g] = d(!0);
|
|
1749
1749
|
return s(() => {
|
|
1750
1750
|
!t || !r || (l(r.url), f(r.text), g(r.newBlank));
|
|
1751
|
-
}, [t, r]), /* @__PURE__ */ m(
|
|
1751
|
+
}, [t, r]), /* @__PURE__ */ m(Wr, {
|
|
1752
1752
|
open: t,
|
|
1753
1753
|
title: o("editor.link"),
|
|
1754
1754
|
bodyClassName: V["bsy-mobile-editor__sheet-body--stack"],
|
|
@@ -1810,13 +1810,13 @@ var Qn = (e) => {
|
|
|
1810
1810
|
})
|
|
1811
1811
|
]
|
|
1812
1812
|
});
|
|
1813
|
-
},
|
|
1813
|
+
}, Kr = /^https?:\/\/.+/i, qr = ({ open: t, onClose: n, onConfirm: r }) => {
|
|
1814
1814
|
let { t: i } = e(), [o, c] = d(""), [l, u] = d(null), f = a((e) => {
|
|
1815
1815
|
e?.focus();
|
|
1816
1816
|
}, []);
|
|
1817
1817
|
return s(() => {
|
|
1818
1818
|
t && (c(""), u(null));
|
|
1819
|
-
}, [t]), /* @__PURE__ */ p(
|
|
1819
|
+
}, [t]), /* @__PURE__ */ p(Wr, {
|
|
1820
1820
|
open: t,
|
|
1821
1821
|
title: i("editor.imageUrl"),
|
|
1822
1822
|
onClose: n,
|
|
@@ -1826,7 +1826,7 @@ var Qn = (e) => {
|
|
|
1826
1826
|
u(i("editor.imageUrlRequired"));
|
|
1827
1827
|
return;
|
|
1828
1828
|
}
|
|
1829
|
-
if (!
|
|
1829
|
+
if (!Kr.test(e)) {
|
|
1830
1830
|
u(i("editor.imageUrlInvalid"));
|
|
1831
1831
|
return;
|
|
1832
1832
|
}
|
|
@@ -1859,7 +1859,7 @@ var Qn = (e) => {
|
|
|
1859
1859
|
]
|
|
1860
1860
|
})
|
|
1861
1861
|
});
|
|
1862
|
-
},
|
|
1862
|
+
}, Jr = `
|
|
1863
1863
|
:host {
|
|
1864
1864
|
all: initial;
|
|
1865
1865
|
display: block;
|
|
@@ -1955,7 +1955,7 @@ var Qn = (e) => {
|
|
|
1955
1955
|
.bsy-editor-html-preview__body li,
|
|
1956
1956
|
.bsy-editor-html-preview__body .editor-listitem {
|
|
1957
1957
|
margin: 0;
|
|
1958
|
-
margin-inline-start: ${
|
|
1958
|
+
margin-inline-start: ${It};
|
|
1959
1959
|
list-style: inherit;
|
|
1960
1960
|
}
|
|
1961
1961
|
.bsy-editor-html-preview__body .editor-nested-listitem {
|
|
@@ -2034,15 +2034,15 @@ var Qn = (e) => {
|
|
|
2034
2034
|
height: auto;
|
|
2035
2035
|
vertical-align: baseline;
|
|
2036
2036
|
}
|
|
2037
|
-
`,
|
|
2037
|
+
`, Yr = ({ html: e }) => {
|
|
2038
2038
|
let t = u(null);
|
|
2039
2039
|
return l(() => {
|
|
2040
|
-
|
|
2040
|
+
Vt(t.current, e, U, Jr);
|
|
2041
2041
|
}, [e]), /* @__PURE__ */ p("div", {
|
|
2042
2042
|
ref: t,
|
|
2043
2043
|
className: "bsy-editor-html-preview"
|
|
2044
2044
|
});
|
|
2045
|
-
},
|
|
2045
|
+
}, Xr = () => {
|
|
2046
2046
|
let e = `${c().replace(/:/g, "")}g`;
|
|
2047
2047
|
return /* @__PURE__ */ p("span", {
|
|
2048
2048
|
className: V["bsy-mobile-editor__ai-think-icon"],
|
|
@@ -2081,7 +2081,7 @@ var Qn = (e) => {
|
|
|
2081
2081
|
}) })]
|
|
2082
2082
|
})
|
|
2083
2083
|
});
|
|
2084
|
-
},
|
|
2084
|
+
}, Zr = (t, n) => {
|
|
2085
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 ?? "";
|
|
2086
2086
|
return s(() => {
|
|
2087
2087
|
if (!i) {
|
|
@@ -2101,12 +2101,12 @@ var Qn = (e) => {
|
|
|
2101
2101
|
reasoning: m,
|
|
2102
2102
|
toggle: () => o((e) => !e)
|
|
2103
2103
|
};
|
|
2104
|
-
},
|
|
2104
|
+
}, Qr = ({ model: e }) => /* @__PURE__ */ m("button", {
|
|
2105
2105
|
type: "button",
|
|
2106
2106
|
className: V["bsy-mobile-editor__ai-think-head"],
|
|
2107
2107
|
disabled: e.thinking,
|
|
2108
2108
|
onClick: e.toggle,
|
|
2109
|
-
children: [e.thinking ? /* @__PURE__ */ p(
|
|
2109
|
+
children: [e.thinking ? /* @__PURE__ */ p(Xr, {}) : /* @__PURE__ */ p(n, {
|
|
2110
2110
|
name: "arrow-down",
|
|
2111
2111
|
size: 12,
|
|
2112
2112
|
className: [V["bsy-mobile-editor__ai-think-arrow"], e.open ? V["bsy-mobile-editor__ai-think-arrow--open"] : ""].filter(Boolean).join(" ")
|
|
@@ -2114,10 +2114,10 @@ var Qn = (e) => {
|
|
|
2114
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"],
|
|
2115
2115
|
children: e.label
|
|
2116
2116
|
})]
|
|
2117
|
-
}),
|
|
2117
|
+
}), $r = ({ model: e }) => !e.visible || !e.open || !e.reasoning ? null : /* @__PURE__ */ p("div", {
|
|
2118
2118
|
className: V["bsy-mobile-editor__ai-think-body"],
|
|
2119
2119
|
children: e.reasoning
|
|
2120
|
-
}),
|
|
2120
|
+
}), ei = ({ enabled: e, status: t, revision: n, compute: r }) => {
|
|
2121
2121
|
let [i, a] = d(""), o = u(r);
|
|
2122
2122
|
o.current = r;
|
|
2123
2123
|
let c = u(null);
|
|
@@ -2144,7 +2144,7 @@ var Qn = (e) => {
|
|
|
2144
2144
|
]), s(() => () => {
|
|
2145
2145
|
c.current !== null && cancelAnimationFrame(c.current);
|
|
2146
2146
|
}, []), i;
|
|
2147
|
-
},
|
|
2147
|
+
}, ti = 32, ni = .25, ri = 2, ii = ({ viewportRef: e, enabled: t, revision: n }) => {
|
|
2148
2148
|
let r = u(!0), i = u(!1), o = u(0), c = a(() => e.current ?? void 0, [e]), l = a(() => {
|
|
2149
2149
|
o.current = 0;
|
|
2150
2150
|
let t = e.current;
|
|
@@ -2154,7 +2154,7 @@ var Qn = (e) => {
|
|
|
2154
2154
|
t.scrollTop = n;
|
|
2155
2155
|
return;
|
|
2156
2156
|
}
|
|
2157
|
-
t.scrollTop += Math.max(i *
|
|
2157
|
+
t.scrollTop += Math.max(i * ni, Math.min(i, ri)), o.current = requestAnimationFrame(l);
|
|
2158
2158
|
}, [e]), d = a(() => {
|
|
2159
2159
|
!o.current && r.current && (o.current = requestAnimationFrame(l));
|
|
2160
2160
|
}, [l]);
|
|
@@ -2181,7 +2181,7 @@ var Qn = (e) => {
|
|
|
2181
2181
|
let f = () => {
|
|
2182
2182
|
let t = e.current;
|
|
2183
2183
|
if (!t) return;
|
|
2184
|
-
let n = t.scrollHeight - t.clientHeight - t.scrollTop <=
|
|
2184
|
+
let n = t.scrollHeight - t.clientHeight - t.scrollTop <= ti;
|
|
2185
2185
|
i.current ? (i.current = !1, r.current = n, !n && o.current && (cancelAnimationFrame(o.current), o.current = 0)) : n && (r.current = !0);
|
|
2186
2186
|
}, p = () => {
|
|
2187
2187
|
i.current = !0;
|
|
@@ -2199,20 +2199,20 @@ var Qn = (e) => {
|
|
|
2199
2199
|
passive: !0,
|
|
2200
2200
|
enable: t
|
|
2201
2201
|
}), { onScroll: f };
|
|
2202
|
-
},
|
|
2203
|
-
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({
|
|
2204
2204
|
enabled: i && !!a,
|
|
2205
|
-
status:
|
|
2206
|
-
revision:
|
|
2207
|
-
compute: () => a === "polish" ? U(
|
|
2208
|
-
}),
|
|
2209
|
-
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,
|
|
2210
2210
|
reasoning: c?.reasoning
|
|
2211
|
-
},
|
|
2211
|
+
}, w), E = ii({
|
|
2212
2212
|
viewportRef: y,
|
|
2213
|
-
enabled: i &&
|
|
2214
|
-
revision: `${c?.reasoning ?? ""}\0${
|
|
2215
|
-
}),
|
|
2213
|
+
enabled: i && x === "loading",
|
|
2214
|
+
revision: `${c?.reasoning ?? ""}\0${C}`
|
|
2215
|
+
}), D = x === "ready" && w;
|
|
2216
2216
|
return /* @__PURE__ */ m(t, {
|
|
2217
2217
|
open: i,
|
|
2218
2218
|
onClose: h,
|
|
@@ -2220,7 +2220,7 @@ var Qn = (e) => {
|
|
|
2220
2220
|
closeOnClickOverlay: !1,
|
|
2221
2221
|
children: [/* @__PURE__ */ m("div", {
|
|
2222
2222
|
className: V["bsy-mobile-editor__ai"],
|
|
2223
|
-
style: { height:
|
|
2223
|
+
style: { height: yt },
|
|
2224
2224
|
children: [
|
|
2225
2225
|
/* @__PURE__ */ m("div", {
|
|
2226
2226
|
className: V["bsy-mobile-editor__header"],
|
|
@@ -2252,25 +2252,25 @@ var Qn = (e) => {
|
|
|
2252
2252
|
}), a === "polish" ? /* @__PURE__ */ m("button", {
|
|
2253
2253
|
type: "button",
|
|
2254
2254
|
className: V["bsy-mobile-editor__ai-preset"],
|
|
2255
|
-
onClick: () =>
|
|
2256
|
-
children: [v(
|
|
2255
|
+
onClick: () => b(!0),
|
|
2256
|
+
children: [v(ht[l]), /* @__PURE__ */ p(n, {
|
|
2257
2257
|
name: "arrow-down",
|
|
2258
2258
|
size: 16
|
|
2259
2259
|
})]
|
|
2260
2260
|
}) : null]
|
|
2261
2261
|
}),
|
|
2262
|
-
|
|
2262
|
+
T.visible ? /* @__PURE__ */ p("div", {
|
|
2263
2263
|
className: V["bsy-mobile-editor__ai-think-pin"],
|
|
2264
|
-
children: /* @__PURE__ */ p(
|
|
2264
|
+
children: /* @__PURE__ */ p(Qr, { model: T })
|
|
2265
2265
|
}) : null,
|
|
2266
2266
|
/* @__PURE__ */ p("div", {
|
|
2267
2267
|
ref: y,
|
|
2268
2268
|
className: V["bsy-mobile-editor__ai-section-scroll"],
|
|
2269
|
-
onScroll:
|
|
2270
|
-
children:
|
|
2269
|
+
onScroll: E.onScroll,
|
|
2270
|
+
children: x === "error" ? /* @__PURE__ */ p("p", {
|
|
2271
2271
|
className: V["bsy-mobile-editor__ai-error"],
|
|
2272
2272
|
children: c?.errorMessage || v("editor.aiError")
|
|
2273
|
-
}) : /* @__PURE__ */ m(f, { children: [/* @__PURE__ */ p(
|
|
2273
|
+
}) : /* @__PURE__ */ m(f, { children: [/* @__PURE__ */ p($r, { model: T }), w ? /* @__PURE__ */ p(Yr, { html: C }) : null] })
|
|
2274
2274
|
})
|
|
2275
2275
|
]
|
|
2276
2276
|
}),
|
|
@@ -2285,7 +2285,7 @@ var Qn = (e) => {
|
|
|
2285
2285
|
})
|
|
2286
2286
|
}), /* @__PURE__ */ p("div", {
|
|
2287
2287
|
className: V["bsy-mobile-editor__ai-section-scroll"],
|
|
2288
|
-
children: /* @__PURE__ */ p(
|
|
2288
|
+
children: /* @__PURE__ */ p(Yr, { html: o })
|
|
2289
2289
|
})]
|
|
2290
2290
|
})
|
|
2291
2291
|
]
|
|
@@ -2299,7 +2299,7 @@ var Qn = (e) => {
|
|
|
2299
2299
|
}), /* @__PURE__ */ p("button", {
|
|
2300
2300
|
type: "button",
|
|
2301
2301
|
className: V["bsy-mobile-editor__ai-footer-ok"],
|
|
2302
|
-
disabled: !
|
|
2302
|
+
disabled: !D,
|
|
2303
2303
|
onClick: g,
|
|
2304
2304
|
children: v("editor.aiApply")
|
|
2305
2305
|
})]
|
|
@@ -2307,38 +2307,38 @@ var Qn = (e) => {
|
|
|
2307
2307
|
]
|
|
2308
2308
|
}), a === "polish" ? /* @__PURE__ */ p(r, {
|
|
2309
2309
|
mode: "menu",
|
|
2310
|
-
open:
|
|
2310
|
+
open: ee,
|
|
2311
2311
|
title: v("editor.aiPolish"),
|
|
2312
|
-
onClose: () =>
|
|
2313
|
-
actions:
|
|
2312
|
+
onClose: () => b(!1),
|
|
2313
|
+
actions: mt.map((e) => ({
|
|
2314
2314
|
key: e,
|
|
2315
|
-
text: v(
|
|
2315
|
+
text: v(ht[e])
|
|
2316
2316
|
})),
|
|
2317
2317
|
onAction: (e) => _(e.key)
|
|
2318
2318
|
}) : null]
|
|
2319
2319
|
});
|
|
2320
|
-
},
|
|
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 = {
|
|
2321
2321
|
fontColor: {
|
|
2322
|
-
path:
|
|
2323
|
-
clipHeight:
|
|
2322
|
+
path: oi,
|
|
2323
|
+
clipHeight: ci,
|
|
2324
2324
|
x: 128,
|
|
2325
2325
|
width: 768,
|
|
2326
2326
|
rx: 0
|
|
2327
2327
|
},
|
|
2328
2328
|
fill: {
|
|
2329
|
-
path:
|
|
2329
|
+
path: si,
|
|
2330
2330
|
clipHeight: 816,
|
|
2331
2331
|
x: 112,
|
|
2332
2332
|
width: 800,
|
|
2333
2333
|
rx: 8
|
|
2334
2334
|
}
|
|
2335
|
-
},
|
|
2335
|
+
}, fi = (e, t) => {
|
|
2336
2336
|
let n = t.trim().toLowerCase();
|
|
2337
|
-
if (e === "fill") return !n || n === "transparent" ||
|
|
2337
|
+
if (e === "fill") return !n || n === "transparent" || ui.test(n);
|
|
2338
2338
|
let r = n.replace(/\s+/g, "");
|
|
2339
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)";
|
|
2340
|
-
},
|
|
2341
|
-
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];
|
|
2342
2342
|
return /* @__PURE__ */ m("svg", {
|
|
2343
2343
|
width: n,
|
|
2344
2344
|
height: n,
|
|
@@ -2361,22 +2361,22 @@ var Qn = (e) => {
|
|
|
2361
2361
|
}),
|
|
2362
2362
|
/* @__PURE__ */ p("rect", {
|
|
2363
2363
|
x: i.x,
|
|
2364
|
-
y:
|
|
2364
|
+
y: ci,
|
|
2365
2365
|
width: i.width,
|
|
2366
|
-
height:
|
|
2366
|
+
height: li,
|
|
2367
2367
|
rx: i.rx,
|
|
2368
|
-
fill:
|
|
2368
|
+
fill: fi(e, t) ? "currentColor" : t
|
|
2369
2369
|
})
|
|
2370
2370
|
]
|
|
2371
2371
|
});
|
|
2372
|
-
},
|
|
2372
|
+
}, mi = {
|
|
2373
2373
|
bold: !1,
|
|
2374
2374
|
italic: !1,
|
|
2375
2375
|
underline: !1,
|
|
2376
2376
|
strikethrough: !1,
|
|
2377
|
-
fontSize:
|
|
2378
|
-
fontColor:
|
|
2379
|
-
backgroundColor:
|
|
2377
|
+
fontSize: ut,
|
|
2378
|
+
fontColor: dt,
|
|
2379
|
+
backgroundColor: ft,
|
|
2380
2380
|
align: "left",
|
|
2381
2381
|
listType: !1,
|
|
2382
2382
|
canIndent: !0,
|
|
@@ -2384,72 +2384,90 @@ var Qn = (e) => {
|
|
|
2384
2384
|
headingTag: !1,
|
|
2385
2385
|
hasRangeSelection: !1,
|
|
2386
2386
|
hasEditorText: !1
|
|
2387
|
-
},
|
|
2388
|
-
let
|
|
2389
|
-
|
|
2390
|
-
|
|
2391
|
-
|
|
2392
|
-
|
|
2393
|
-
|
|
2394
|
-
|
|
2395
|
-
let i = it(r, "font-size", ct), a = it(r, "color", lt), o = it(r, "background-color", ut), s = r.anchor.getNode(), c = s.getKey() === "root" ? s : B(s, (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) => {
|
|
2396
2395
|
let t = e.getParent();
|
|
2397
|
-
return t !== null &&
|
|
2396
|
+
return t !== null && we(t);
|
|
2398
2397
|
});
|
|
2399
|
-
|
|
2400
|
-
let
|
|
2401
|
-
if (
|
|
2402
|
-
|
|
2403
|
-
let e =
|
|
2404
|
-
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)) {
|
|
2405
2404
|
let t = e.getListType();
|
|
2406
|
-
|
|
2405
|
+
a = t === "number" || t === "bullet" ? t : !1;
|
|
2407
2406
|
}
|
|
2408
2407
|
}
|
|
2409
|
-
let f = B(s, re), p = re(f) ? f.getTag() : void 0;
|
|
2410
2408
|
return {
|
|
2411
|
-
|
|
2412
|
-
|
|
2413
|
-
|
|
2414
|
-
|
|
2415
|
-
|
|
2416
|
-
|
|
2417
|
-
|
|
2418
|
-
|
|
2419
|
-
|
|
2420
|
-
|
|
2421
|
-
|
|
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,
|
|
2422
2439
|
headingTag: p === "h1" || p === "h2" || p === "h3" ? p : !1,
|
|
2423
2440
|
hasRangeSelection: !0,
|
|
2424
2441
|
hasEditorText: t
|
|
2425
2442
|
};
|
|
2426
|
-
},
|
|
2443
|
+
}, vi = (e, t) => {
|
|
2427
2444
|
e.isEditable() || e.setEditable(!0), e.update(() => {
|
|
2428
|
-
|
|
2445
|
+
qt(), t(_i(!0));
|
|
2429
2446
|
}), e.focus(void 0, { defaultSelection: "rootStart" });
|
|
2430
|
-
},
|
|
2431
|
-
let t =
|
|
2432
|
-
return
|
|
2447
|
+
}, yi = (e) => {
|
|
2448
|
+
let t = mi;
|
|
2449
|
+
return vi(e, (e) => {
|
|
2433
2450
|
t = e;
|
|
2434
2451
|
}), t;
|
|
2435
|
-
},
|
|
2452
|
+
}, bi = (...e) => e.filter(Boolean).join(" "), xi = (e) => e.buttons.map((e) => ({
|
|
2436
2453
|
name: typeof e == "string" ? e : e.name,
|
|
2437
2454
|
disabled: typeof e != "string" && !!e.props?.disabled
|
|
2438
|
-
})), 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", {
|
|
2439
2456
|
type: "button",
|
|
2440
|
-
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"]),
|
|
2441
2458
|
"aria-label": r,
|
|
2442
2459
|
"aria-pressed": e,
|
|
2443
2460
|
"aria-expanded": i ? !!n : void 0,
|
|
2444
|
-
disabled: t,
|
|
2461
|
+
"aria-disabled": t || void 0,
|
|
2462
|
+
tabIndex: t ? -1 : void 0,
|
|
2445
2463
|
onMouseDown: (e) => e.preventDefault(),
|
|
2446
|
-
onClick: o,
|
|
2464
|
+
onClick: t ? void 0 : o,
|
|
2447
2465
|
children: s
|
|
2448
|
-
}),
|
|
2466
|
+
}), Ci = ({ open: e }) => /* @__PURE__ */ p(n, {
|
|
2449
2467
|
name: "arrow-down",
|
|
2450
|
-
size:
|
|
2451
|
-
className:
|
|
2452
|
-
}),
|
|
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 }) => {
|
|
2453
2471
|
let [l] = z(), { t: d } = e(), f = u(null), h = u(null), g = u(null), _ = () => {
|
|
2454
2472
|
let e = f.current, t = h.current, n = g.current;
|
|
2455
2473
|
if (!e || !t || !n) return;
|
|
@@ -2470,7 +2488,7 @@ var Qn = (e) => {
|
|
|
2470
2488
|
disabled: t,
|
|
2471
2489
|
label: d("editor.bold"),
|
|
2472
2490
|
onClick: () => {
|
|
2473
|
-
H(l), l.dispatchCommand(
|
|
2491
|
+
H(l), l.dispatchCommand(Ie, "bold");
|
|
2474
2492
|
},
|
|
2475
2493
|
children: /* @__PURE__ */ p(n, {
|
|
2476
2494
|
name: "bold",
|
|
@@ -2482,7 +2500,7 @@ var Qn = (e) => {
|
|
|
2482
2500
|
disabled: t,
|
|
2483
2501
|
label: d("editor.italic"),
|
|
2484
2502
|
onClick: () => {
|
|
2485
|
-
H(l), l.dispatchCommand(
|
|
2503
|
+
H(l), l.dispatchCommand(Ie, "italic");
|
|
2486
2504
|
},
|
|
2487
2505
|
children: /* @__PURE__ */ p(n, {
|
|
2488
2506
|
name: "italic",
|
|
@@ -2494,7 +2512,7 @@ var Qn = (e) => {
|
|
|
2494
2512
|
disabled: t,
|
|
2495
2513
|
label: d("editor.underline"),
|
|
2496
2514
|
onClick: () => {
|
|
2497
|
-
H(l), l.dispatchCommand(
|
|
2515
|
+
H(l), l.dispatchCommand(Ie, "underline");
|
|
2498
2516
|
},
|
|
2499
2517
|
children: /* @__PURE__ */ p(n, {
|
|
2500
2518
|
name: "underline",
|
|
@@ -2506,7 +2524,7 @@ var Qn = (e) => {
|
|
|
2506
2524
|
disabled: t,
|
|
2507
2525
|
label: d("editor.strikethrough"),
|
|
2508
2526
|
onClick: () => {
|
|
2509
|
-
H(l), l.dispatchCommand(
|
|
2527
|
+
H(l), l.dispatchCommand(Ie, "strikethrough");
|
|
2510
2528
|
},
|
|
2511
2529
|
children: /* @__PURE__ */ p(n, {
|
|
2512
2530
|
name: "shanchuxian",
|
|
@@ -2514,10 +2532,10 @@ var Qn = (e) => {
|
|
|
2514
2532
|
})
|
|
2515
2533
|
}, e);
|
|
2516
2534
|
case "outdent": return /* @__PURE__ */ p($, {
|
|
2517
|
-
disabled: t ||
|
|
2535
|
+
disabled: t || !r.canOutdent,
|
|
2518
2536
|
label: d("editor.outdent"),
|
|
2519
2537
|
onClick: () => {
|
|
2520
|
-
H(l), l.dispatchCommand(
|
|
2538
|
+
H(l), l.dispatchCommand(Ve, void 0);
|
|
2521
2539
|
},
|
|
2522
2540
|
children: /* @__PURE__ */ p(n, {
|
|
2523
2541
|
name: "jianshaosuojin",
|
|
@@ -2525,10 +2543,10 @@ var Qn = (e) => {
|
|
|
2525
2543
|
})
|
|
2526
2544
|
}, e);
|
|
2527
2545
|
case "indent": return /* @__PURE__ */ p($, {
|
|
2528
|
-
disabled: t ||
|
|
2546
|
+
disabled: t || !r.canIndent,
|
|
2529
2547
|
label: d("editor.indent"),
|
|
2530
2548
|
onClick: () => {
|
|
2531
|
-
H(l), l.dispatchCommand(
|
|
2549
|
+
H(l), l.dispatchCommand(Re, void 0);
|
|
2532
2550
|
},
|
|
2533
2551
|
children: /* @__PURE__ */ p(n, {
|
|
2534
2552
|
name: "zengjiasuojin",
|
|
@@ -2540,8 +2558,8 @@ var Qn = (e) => {
|
|
|
2540
2558
|
disabled: t,
|
|
2541
2559
|
label: d("editor.bulletList"),
|
|
2542
2560
|
onClick: () => {
|
|
2543
|
-
let e =
|
|
2544
|
-
l.dispatchCommand(e.listType === "bullet" ?
|
|
2561
|
+
let e = yi(l);
|
|
2562
|
+
l.dispatchCommand(e.listType === "bullet" ? D : w, void 0);
|
|
2545
2563
|
},
|
|
2546
2564
|
children: /* @__PURE__ */ p(n, {
|
|
2547
2565
|
name: "xuhaoliebiao",
|
|
@@ -2553,8 +2571,8 @@ var Qn = (e) => {
|
|
|
2553
2571
|
disabled: t,
|
|
2554
2572
|
label: d("editor.numberList"),
|
|
2555
2573
|
onClick: () => {
|
|
2556
|
-
let e =
|
|
2557
|
-
l.dispatchCommand(e.listType === "number" ?
|
|
2574
|
+
let e = yi(l);
|
|
2575
|
+
l.dispatchCommand(e.listType === "number" ? D : C, void 0);
|
|
2558
2576
|
},
|
|
2559
2577
|
children: /* @__PURE__ */ p(n, {
|
|
2560
2578
|
name: "bianhaoliebiao",
|
|
@@ -2572,7 +2590,7 @@ var Qn = (e) => {
|
|
|
2572
2590
|
children: [/* @__PURE__ */ p(n, {
|
|
2573
2591
|
name: r.align === "center" ? "paragraphmiddle" : r.align === "right" ? "paragraphright" : "paragraph",
|
|
2574
2592
|
size: Q
|
|
2575
|
-
}), /* @__PURE__ */ p(
|
|
2593
|
+
}), /* @__PURE__ */ p(Ci, { open: a === "align" })]
|
|
2576
2594
|
}, e);
|
|
2577
2595
|
case "heading": return /* @__PURE__ */ m($, {
|
|
2578
2596
|
select: !0,
|
|
@@ -2585,7 +2603,7 @@ var Qn = (e) => {
|
|
|
2585
2603
|
children: [/* @__PURE__ */ p("span", {
|
|
2586
2604
|
className: V["bsy-mobile-editor__tool-text"],
|
|
2587
2605
|
children: r.headingTag ? r.headingTag.toUpperCase() : d("editor.paragraph")
|
|
2588
|
-
}), /* @__PURE__ */ p(
|
|
2606
|
+
}), /* @__PURE__ */ p(Ci, { open: a === "heading" })]
|
|
2589
2607
|
}, e);
|
|
2590
2608
|
case "fontSize": return /* @__PURE__ */ p($, {
|
|
2591
2609
|
active: a === "fontSize",
|
|
@@ -2602,7 +2620,7 @@ var Qn = (e) => {
|
|
|
2602
2620
|
disabled: t,
|
|
2603
2621
|
label: d("editor.fontColor"),
|
|
2604
2622
|
onClick: () => o("fontColor"),
|
|
2605
|
-
children: /* @__PURE__ */ p(
|
|
2623
|
+
children: /* @__PURE__ */ p(pi, {
|
|
2606
2624
|
variant: "fontColor",
|
|
2607
2625
|
barColor: i.fontColor,
|
|
2608
2626
|
size: Q
|
|
@@ -2613,7 +2631,7 @@ var Qn = (e) => {
|
|
|
2613
2631
|
disabled: t,
|
|
2614
2632
|
label: d("editor.fill"),
|
|
2615
2633
|
onClick: () => o("fill"),
|
|
2616
|
-
children: /* @__PURE__ */ p(
|
|
2634
|
+
children: /* @__PURE__ */ p(pi, {
|
|
2617
2635
|
variant: "fill",
|
|
2618
2636
|
barColor: i.fill,
|
|
2619
2637
|
size: Q
|
|
@@ -2629,7 +2647,7 @@ var Qn = (e) => {
|
|
|
2629
2647
|
children: [/* @__PURE__ */ p(n, {
|
|
2630
2648
|
name: "picture",
|
|
2631
2649
|
size: Q
|
|
2632
|
-
}), /* @__PURE__ */ p(
|
|
2650
|
+
}), /* @__PURE__ */ p(Ci, { open: a === "picture" })]
|
|
2633
2651
|
}, e);
|
|
2634
2652
|
case "link": return /* @__PURE__ */ p($, {
|
|
2635
2653
|
disabled: t,
|
|
@@ -2650,13 +2668,13 @@ var Qn = (e) => {
|
|
|
2650
2668
|
label: d("editor.ai"),
|
|
2651
2669
|
onClick: () => o("ai"),
|
|
2652
2670
|
children: [/* @__PURE__ */ p("img", {
|
|
2653
|
-
src:
|
|
2671
|
+
src: Cr,
|
|
2654
2672
|
alt: "",
|
|
2655
2673
|
width: Q,
|
|
2656
2674
|
height: Q,
|
|
2657
2675
|
className: V["bsy-mobile-editor__ai-icon"],
|
|
2658
2676
|
draggable: !1
|
|
2659
|
-
}), /* @__PURE__ */ p(
|
|
2677
|
+
}), /* @__PURE__ */ p(Ci, { open: n })]
|
|
2660
2678
|
}, e);
|
|
2661
2679
|
}
|
|
2662
2680
|
default: return null;
|
|
@@ -2669,7 +2687,7 @@ var Qn = (e) => {
|
|
|
2669
2687
|
className: V["bsy-mobile-editor__toolbar-scroller"],
|
|
2670
2688
|
onScroll: _,
|
|
2671
2689
|
children: t.map((e, t) => {
|
|
2672
|
-
let n =
|
|
2690
|
+
let n = xi(e);
|
|
2673
2691
|
return n.length ? /* @__PURE__ */ m("div", {
|
|
2674
2692
|
className: V["bsy-mobile-editor__toolbar-group"],
|
|
2675
2693
|
children: [t > 0 ? /* @__PURE__ */ p("span", { className: V["bsy-mobile-editor__toolbar-divider"] }) : null, n.map(v)]
|
|
@@ -2686,33 +2704,33 @@ var Qn = (e) => {
|
|
|
2686
2704
|
})
|
|
2687
2705
|
})]
|
|
2688
2706
|
});
|
|
2689
|
-
},
|
|
2690
|
-
if (
|
|
2691
|
-
let e =
|
|
2692
|
-
return
|
|
2693
|
-
},
|
|
2694
|
-
if (!
|
|
2695
|
-
let e =
|
|
2696
|
-
return
|
|
2697
|
-
},
|
|
2698
|
-
let [t] = z(), [n, r] = d(
|
|
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);
|
|
2699
2717
|
return s(() => {
|
|
2700
2718
|
let n = () => {
|
|
2701
2719
|
t.getEditorState().read(() => {
|
|
2702
|
-
r(
|
|
2720
|
+
r(_i(e));
|
|
2703
2721
|
}, { editor: t });
|
|
2704
2722
|
};
|
|
2705
2723
|
return n(), t.registerUpdateListener(({ editorState: e }) => {
|
|
2706
|
-
if (e.read(() =>
|
|
2724
|
+
if (e.read(() => Ti())) {
|
|
2707
2725
|
t.update(() => {
|
|
2708
|
-
|
|
2726
|
+
Ei();
|
|
2709
2727
|
});
|
|
2710
2728
|
return;
|
|
2711
2729
|
}
|
|
2712
2730
|
n();
|
|
2713
2731
|
});
|
|
2714
2732
|
}, [t, e]), n;
|
|
2715
|
-
},
|
|
2733
|
+
}, Oi = "plaintext", ki = "github-light", Ai = new Set([
|
|
2716
2734
|
"plaintext",
|
|
2717
2735
|
"css",
|
|
2718
2736
|
"html",
|
|
@@ -2734,7 +2752,7 @@ var Qn = (e) => {
|
|
|
2734
2752
|
"bash",
|
|
2735
2753
|
"lua",
|
|
2736
2754
|
"markdown"
|
|
2737
|
-
]),
|
|
2755
|
+
]), ji = (e) => e && Ai.has(e) ? e : Oi, Mi = {
|
|
2738
2756
|
css: () => import("@shikijs/langs/css"),
|
|
2739
2757
|
html: () => import("@shikijs/langs/html"),
|
|
2740
2758
|
xml: () => import("@shikijs/langs/xml"),
|
|
@@ -2755,70 +2773,70 @@ var Qn = (e) => {
|
|
|
2755
2773
|
bash: () => import("@shikijs/langs/shellscript"),
|
|
2756
2774
|
lua: () => import("@shikijs/langs/lua"),
|
|
2757
2775
|
markdown: () => import("@shikijs/langs/markdown")
|
|
2758
|
-
},
|
|
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({
|
|
2759
2777
|
engine: t(),
|
|
2760
2778
|
langs: [],
|
|
2761
2779
|
themes: []
|
|
2762
2780
|
})).catch((e) => {
|
|
2763
|
-
throw
|
|
2764
|
-
}),
|
|
2765
|
-
let t =
|
|
2766
|
-
return t || (t =
|
|
2767
|
-
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);
|
|
2768
2786
|
if (!t.getLoadedLanguages().includes(n)) {
|
|
2769
|
-
let n = await
|
|
2787
|
+
let n = await Mi[e]();
|
|
2770
2788
|
await t.loadLanguage(n.default);
|
|
2771
2789
|
}
|
|
2772
2790
|
return t;
|
|
2773
2791
|
}).catch((t) => {
|
|
2774
|
-
throw
|
|
2775
|
-
}),
|
|
2776
|
-
},
|
|
2792
|
+
throw Li.delete(e), t;
|
|
2793
|
+
}), Li.set(e, t)), t;
|
|
2794
|
+
}, Vi = () => (Ii ||= Ri().then(async (e) => {
|
|
2777
2795
|
if (!e.getLoadedThemes().includes("github-light")) {
|
|
2778
2796
|
let t = await import("@shikijs/themes/github-light");
|
|
2779
2797
|
await e.loadTheme(t.default);
|
|
2780
2798
|
}
|
|
2781
2799
|
return e;
|
|
2782
2800
|
}).catch((e) => {
|
|
2783
|
-
throw
|
|
2784
|
-
}),
|
|
2801
|
+
throw Ii = null, e;
|
|
2802
|
+
}), Ii), Hi = (e, t, n) => {
|
|
2785
2803
|
let r = e.getTextContent();
|
|
2786
|
-
if (e.getStyle() && e.setStyle(""), !n || !
|
|
2804
|
+
if (e.getStyle() && e.setStyle(""), !n || !zi(n, t)) return ne(r);
|
|
2787
2805
|
let i = n.codeToTokens(r, {
|
|
2788
|
-
lang:
|
|
2789
|
-
theme:
|
|
2806
|
+
lang: Ni(t),
|
|
2807
|
+
theme: ki
|
|
2790
2808
|
}).tokens, a = [];
|
|
2791
2809
|
return i.forEach((e, t) => {
|
|
2792
|
-
t && a.push(
|
|
2810
|
+
t && a.push(ve()), e.forEach((e) => {
|
|
2793
2811
|
e.content.split(" ").forEach((t, n) => {
|
|
2794
|
-
if (n && a.push(
|
|
2795
|
-
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}` : "";
|
|
2796
2814
|
i && r.setStyle(i), a.push(r);
|
|
2797
2815
|
});
|
|
2798
2816
|
});
|
|
2799
2817
|
}), a;
|
|
2800
|
-
},
|
|
2801
|
-
let n =
|
|
2802
|
-
if (!
|
|
2803
|
-
let r =
|
|
2804
|
-
if (!
|
|
2818
|
+
}, Ui = (e, t) => {
|
|
2819
|
+
let n = P(e);
|
|
2820
|
+
if (!te(n) || !n.isAttached()) return;
|
|
2821
|
+
let r = I();
|
|
2822
|
+
if (!L(r)) {
|
|
2805
2823
|
t();
|
|
2806
2824
|
return;
|
|
2807
2825
|
}
|
|
2808
2826
|
let { anchor: i } = r;
|
|
2809
|
-
if (B(i.getNode(),
|
|
2827
|
+
if (B(i.getNode(), te) !== n) {
|
|
2810
2828
|
t();
|
|
2811
2829
|
return;
|
|
2812
2830
|
}
|
|
2813
|
-
let a = i.offset, o = i.type === "element" &&
|
|
2831
|
+
let a = i.offset, o = i.type === "element" && Ce(n.getChildAtIndex(i.offset - 1)), s = 0;
|
|
2814
2832
|
if (o || (s = a + i.getNode().getPreviousSiblings().reduce((e, t) => e + t.getTextContentSize(), 0)), t()) {
|
|
2815
2833
|
if (o) {
|
|
2816
2834
|
i.getNode().select(a, a);
|
|
2817
2835
|
return;
|
|
2818
2836
|
}
|
|
2819
2837
|
n.getChildren().some((e) => {
|
|
2820
|
-
let t =
|
|
2821
|
-
if (t ||
|
|
2838
|
+
let t = R(e);
|
|
2839
|
+
if (t || Ce(e)) {
|
|
2822
2840
|
let n = e.getTextContentSize();
|
|
2823
2841
|
if (t && n >= s) return e.select(s, s), !0;
|
|
2824
2842
|
s -= n;
|
|
@@ -2826,27 +2844,27 @@ var Qn = (e) => {
|
|
|
2826
2844
|
return !1;
|
|
2827
2845
|
});
|
|
2828
2846
|
}
|
|
2829
|
-
},
|
|
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) => {
|
|
2830
2848
|
let n = 0;
|
|
2831
|
-
for (; n < e.length &&
|
|
2849
|
+
for (; n < e.length && Wi(e[n], t[n]);) n++;
|
|
2832
2850
|
let r = 0, i = Math.min(e.length, t.length) - n;
|
|
2833
|
-
for (; r < i &&
|
|
2851
|
+
for (; r < i && Wi(e[e.length - r - 1], t[t.length - r - 1]);) r++;
|
|
2834
2852
|
return {
|
|
2835
2853
|
from: n,
|
|
2836
2854
|
to: e.length - r,
|
|
2837
2855
|
replacement: t.slice(n, t.length - r)
|
|
2838
2856
|
};
|
|
2839
|
-
},
|
|
2840
|
-
let a = i.getKey(), o =
|
|
2857
|
+
}, Ki = (e, t, n, r, i) => {
|
|
2858
|
+
let a = i.getKey(), o = ji(i.getLanguage());
|
|
2841
2859
|
if (i.getLanguage() !== o && i.setLanguage(o), o === "plaintext") i.getIsSyntaxHighlightSupported() && i.setIsSyntaxHighlightSupported(!1);
|
|
2842
2860
|
else {
|
|
2843
|
-
i.getTheme() !== "github-light" && i.setTheme(
|
|
2844
|
-
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();
|
|
2845
2863
|
if (s) {
|
|
2846
2864
|
i.getIsSyntaxHighlightSupported() && i.setIsSyntaxHighlightSupported(!1), n.pendingKeys.add(a), n.loading !== s && (n.loading = s, s.then((t) => {
|
|
2847
2865
|
r(t);
|
|
2848
2866
|
let i = [...n.pendingKeys];
|
|
2849
|
-
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 });
|
|
2850
2868
|
}, () => {
|
|
2851
2869
|
n.pendingKeys.clear(), n.loading = null;
|
|
2852
2870
|
}));
|
|
@@ -2856,46 +2874,46 @@ var Qn = (e) => {
|
|
|
2856
2874
|
}
|
|
2857
2875
|
n.nodesCurrentlyHighlighting.has(a) || (n.nodesCurrentlyHighlighting.add(a), n.didTransform || (n.didTransform = !0, De(() => {
|
|
2858
2876
|
n.didTransform = !1, n.nodesCurrentlyHighlighting.clear();
|
|
2859
|
-
})),
|
|
2860
|
-
let e =
|
|
2861
|
-
if (!
|
|
2862
|
-
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);
|
|
2863
2881
|
return r === i && o.length === 0 ? !1 : (e.splice(r, i - r, o), !0);
|
|
2864
2882
|
}));
|
|
2865
|
-
},
|
|
2883
|
+
}, qi = () => {
|
|
2866
2884
|
let [e] = z();
|
|
2867
2885
|
return s(() => {
|
|
2868
|
-
if (!e.hasNodes([
|
|
2886
|
+
if (!e.hasNodes([j, A])) throw Error("CodeHighlightPlugin: code nodes are not registered");
|
|
2869
2887
|
let t = null, n = {
|
|
2870
2888
|
didTransform: !1,
|
|
2871
2889
|
nodesCurrentlyHighlighting: /* @__PURE__ */ new Set(),
|
|
2872
2890
|
pendingKeys: /* @__PURE__ */ new Set(),
|
|
2873
2891
|
loading: null
|
|
2874
|
-
}, r = (r) =>
|
|
2892
|
+
}, r = (r) => Ki(e, t, n, (e) => {
|
|
2875
2893
|
t = e;
|
|
2876
2894
|
}, r), i = (e) => {
|
|
2877
2895
|
let t = e.getParent();
|
|
2878
|
-
|
|
2896
|
+
te(t) ? r(t) : k(e) && e.replace(be(e.__text));
|
|
2879
2897
|
};
|
|
2880
|
-
return
|
|
2898
|
+
return qe(re(e), e.registerNodeTransform(j, r), e.registerNodeTransform(Ge, i), e.registerNodeTransform(A, i));
|
|
2881
2899
|
}, [e]), null;
|
|
2882
|
-
},
|
|
2900
|
+
}, Ji = () => {
|
|
2883
2901
|
let [e] = z();
|
|
2884
|
-
return s(() => (
|
|
2902
|
+
return s(() => (ge(e, !0), at(me(e), he(e, !1), pe(e), e.registerNodeTransform(ue, (e) => {
|
|
2885
2903
|
e.getBackgroundColor() !== null && e.setBackgroundColor(null);
|
|
2886
|
-
}), e.registerCommand(
|
|
2887
|
-
let t =
|
|
2888
|
-
if (!
|
|
2889
|
-
let n =
|
|
2904
|
+
}), e.registerCommand(Be, (e) => {
|
|
2905
|
+
let t = I();
|
|
2906
|
+
if (!L(t) || !t.isCollapsed()) return !1;
|
|
2907
|
+
let n = se(t.anchor.getNode());
|
|
2890
2908
|
if (n === null) return !1;
|
|
2891
2909
|
let r = e.shiftKey ? "previous" : "next", i = r === "next" ? "getNextSibling" : "getPreviousSibling", a = r === "next" ? "getFirstChild" : "getLastChild", o = n[i](), s = null;
|
|
2892
|
-
if (
|
|
2910
|
+
if (ce(o)) s = o;
|
|
2893
2911
|
else {
|
|
2894
|
-
let e = B(n,
|
|
2912
|
+
let e = B(n, le);
|
|
2895
2913
|
if (e !== null) for (let t = e[i](); t !== null; t = t[i]()) {
|
|
2896
|
-
if (!
|
|
2914
|
+
if (!le(t)) continue;
|
|
2897
2915
|
let e = t[a]();
|
|
2898
|
-
if (
|
|
2916
|
+
if (ce(e)) {
|
|
2899
2917
|
s = e;
|
|
2900
2918
|
break;
|
|
2901
2919
|
}
|
|
@@ -2905,15 +2923,15 @@ var Qn = (e) => {
|
|
|
2905
2923
|
let e = s.getFirstDescendant();
|
|
2906
2924
|
e ? e.selectStart() : s.selectStart();
|
|
2907
2925
|
} else {
|
|
2908
|
-
let e = B(n,
|
|
2926
|
+
let e = B(n, M);
|
|
2909
2927
|
e && (r === "next" ? e.selectNext() : e.selectPrevious());
|
|
2910
2928
|
}
|
|
2911
2929
|
return !0;
|
|
2912
|
-
},
|
|
2913
|
-
},
|
|
2930
|
+
}, Ae))), [e]), null;
|
|
2931
|
+
}, Yi = (e) => {
|
|
2914
2932
|
let t = e.getIndent();
|
|
2915
2933
|
t < 8 && e.setIndent(t + 1);
|
|
2916
|
-
},
|
|
2934
|
+
}, Xi = (e) => {
|
|
2917
2935
|
let t = e.getIndent();
|
|
2918
2936
|
if (t > 8) {
|
|
2919
2937
|
e.setIndent(8);
|
|
@@ -2923,49 +2941,97 @@ var Qn = (e) => {
|
|
|
2923
2941
|
};
|
|
2924
2942
|
//#endregion
|
|
2925
2943
|
//#region src/components/Editor/plugins/IndentLimitPlugin.tsx
|
|
2926
|
-
function
|
|
2944
|
+
function Zi() {
|
|
2927
2945
|
let [e] = z();
|
|
2928
|
-
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;
|
|
2929
2995
|
}
|
|
2930
2996
|
//#endregion
|
|
2931
2997
|
//#region src/components/Editor/EditorCore.tsx
|
|
2932
|
-
var
|
|
2933
|
-
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) => {
|
|
2934
3000
|
a?.(e), i === void 0 && _(e);
|
|
2935
|
-
}, [
|
|
3001
|
+
}, [b, x] = d(null), [S, C] = d(() => ({
|
|
2936
3002
|
fontColor: y.fontColor,
|
|
2937
3003
|
fill: y.backgroundColor
|
|
2938
|
-
})),
|
|
3004
|
+
})), w = u(!1), [T, E] = d(!1), D = u(null), O = () => {
|
|
2939
3005
|
f.getEditorState().read(() => {
|
|
2940
|
-
|
|
3006
|
+
D.current = I()?.clone() ?? null;
|
|
2941
3007
|
});
|
|
2942
|
-
}, { linkForm:
|
|
3008
|
+
}, { linkForm: k, openLink: te, confirmLink: ne, closeLink: A } = pr({
|
|
2943
3009
|
editor: f,
|
|
2944
|
-
savedSelectionRef:
|
|
2945
|
-
captureSelection:
|
|
2946
|
-
}), [
|
|
3010
|
+
savedSelectionRef: D,
|
|
3011
|
+
captureSelection: O
|
|
3012
|
+
}), [j] = d(() => /* @__PURE__ */ new Map()), { fileInputRef: re, uploadProgress: ie, insertImage: ae, onFileChange: oe, abortUpload: se } = fr({
|
|
2947
3013
|
editor: f,
|
|
2948
3014
|
upload: c,
|
|
2949
|
-
savedSelectionRef:
|
|
2950
|
-
attachmentsBySrc:
|
|
2951
|
-
}),
|
|
3015
|
+
savedSelectionRef: D,
|
|
3016
|
+
attachmentsBySrc: j
|
|
3017
|
+
}), ce = mr({
|
|
2952
3018
|
editor: f,
|
|
2953
3019
|
value: n,
|
|
2954
3020
|
onChange: r,
|
|
2955
|
-
attachmentsBySrc:
|
|
2956
|
-
}),
|
|
3021
|
+
attachmentsBySrc: j
|
|
3022
|
+
}), M = tr({
|
|
2957
3023
|
editor: f,
|
|
2958
3024
|
ai: l
|
|
2959
|
-
}), [
|
|
3025
|
+
}), [le, ue] = d(0), de = o?.config ?? gt;
|
|
2960
3026
|
s(() => {
|
|
2961
3027
|
if (!y.hasEditorText) {
|
|
2962
|
-
|
|
2963
|
-
fontColor:
|
|
2964
|
-
fill:
|
|
3028
|
+
C({
|
|
3029
|
+
fontColor: dt,
|
|
3030
|
+
fill: ft
|
|
2965
3031
|
});
|
|
2966
3032
|
return;
|
|
2967
3033
|
}
|
|
2968
|
-
y.hasRangeSelection &&
|
|
3034
|
+
y.hasRangeSelection && C({
|
|
2969
3035
|
fontColor: y.fontColor,
|
|
2970
3036
|
fill: y.backgroundColor
|
|
2971
3037
|
});
|
|
@@ -2975,43 +3041,43 @@ var Yi = ({ value: n, onChange: r, open: i, onOpenChange: a, toolbar: o, upload:
|
|
|
2975
3041
|
y.hasEditorText,
|
|
2976
3042
|
y.hasRangeSelection
|
|
2977
3043
|
]);
|
|
2978
|
-
let
|
|
2979
|
-
|
|
3044
|
+
let fe = () => {
|
|
3045
|
+
se(), M.close(), x(null), A(), E(!1), ee(!1);
|
|
2980
3046
|
};
|
|
2981
3047
|
s(() => {
|
|
2982
3048
|
if (!v) return;
|
|
2983
3049
|
let e = window.visualViewport;
|
|
2984
3050
|
if (!e) return;
|
|
2985
3051
|
let t = () => {
|
|
2986
|
-
|
|
3052
|
+
ue(Math.max(0, window.innerHeight - e.height - e.offsetTop));
|
|
2987
3053
|
};
|
|
2988
3054
|
return e.addEventListener("resize", t), e.addEventListener("scroll", t), t(), () => {
|
|
2989
3055
|
e.removeEventListener("resize", t), e.removeEventListener("scroll", t);
|
|
2990
3056
|
};
|
|
2991
3057
|
}, [v]), s(() => {
|
|
2992
|
-
v ||
|
|
2993
|
-
}, [
|
|
3058
|
+
v || se();
|
|
3059
|
+
}, [se, v]), s(() => {
|
|
2994
3060
|
if (v) return f.setEditable(!0), f.registerRootListener((e) => {
|
|
2995
3061
|
e && f.focus(void 0, { defaultSelection: "rootEnd" });
|
|
2996
3062
|
});
|
|
2997
3063
|
}, [v, f]);
|
|
2998
|
-
let
|
|
2999
|
-
|
|
3000
|
-
},
|
|
3001
|
-
|
|
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);
|
|
3002
3068
|
};
|
|
3003
3069
|
return /* @__PURE__ */ p(t, {
|
|
3004
3070
|
open: v,
|
|
3005
|
-
onClose:
|
|
3071
|
+
onClose: fe,
|
|
3006
3072
|
position: "bottom",
|
|
3007
3073
|
closeOnClickOverlay: !0,
|
|
3008
|
-
children: /* @__PURE__ */ p(
|
|
3009
|
-
value:
|
|
3074
|
+
children: /* @__PURE__ */ p(nr.Provider, {
|
|
3075
|
+
value: ie,
|
|
3010
3076
|
children: /* @__PURE__ */ m("div", {
|
|
3011
3077
|
className: V["bsy-mobile-editor"],
|
|
3012
3078
|
style: {
|
|
3013
3079
|
height: 300,
|
|
3014
|
-
transform:
|
|
3080
|
+
transform: le ? `translate3d(0, -${le}px, 0)` : void 0
|
|
3015
3081
|
},
|
|
3016
3082
|
children: [
|
|
3017
3083
|
/* @__PURE__ */ p("div", {
|
|
@@ -3024,111 +3090,112 @@ var Yi = ({ value: n, onChange: r, open: i, onOpenChange: a, toolbar: o, upload:
|
|
|
3024
3090
|
/* @__PURE__ */ p("div", {
|
|
3025
3091
|
className: V["bsy-mobile-editor__content"],
|
|
3026
3092
|
style: { height: 200 },
|
|
3027
|
-
children: /* @__PURE__ */ p(
|
|
3028
|
-
contentEditable: /* @__PURE__ */ p(
|
|
3029
|
-
ErrorBoundary:
|
|
3093
|
+
children: /* @__PURE__ */ p($e, {
|
|
3094
|
+
contentEditable: /* @__PURE__ */ p(Je, { className: V["bsy-mobile-editor__editable"] }),
|
|
3095
|
+
ErrorBoundary: et
|
|
3030
3096
|
})
|
|
3031
3097
|
}),
|
|
3032
|
-
|
|
3033
|
-
config:
|
|
3098
|
+
de.length > 0 ? /* @__PURE__ */ p(wi, {
|
|
3099
|
+
config: de,
|
|
3034
3100
|
formats: y,
|
|
3035
|
-
colorValues:
|
|
3036
|
-
openSheet:
|
|
3101
|
+
colorValues: S,
|
|
3102
|
+
openSheet: b,
|
|
3037
3103
|
onOpenSheet: (e) => {
|
|
3038
|
-
(e === "fontColor" || e === "fill") && (
|
|
3104
|
+
(e === "fontColor" || e === "fill") && (O(), C((t) => {
|
|
3039
3105
|
let n = e === "fill" ? y.backgroundColor : y.fontColor, r = y.hasRangeSelection && y.hasEditorText;
|
|
3040
3106
|
return {
|
|
3041
3107
|
...t,
|
|
3042
3108
|
[e]: r ? n : t[e]
|
|
3043
3109
|
};
|
|
3044
|
-
})),
|
|
3110
|
+
})), x(e);
|
|
3045
3111
|
},
|
|
3046
|
-
onOpenLink:
|
|
3112
|
+
onOpenLink: te
|
|
3047
3113
|
}) : null,
|
|
3048
|
-
/* @__PURE__ */ p(qe, {}),
|
|
3049
3114
|
/* @__PURE__ */ p(Ye, {}),
|
|
3050
|
-
/* @__PURE__ */ p(
|
|
3051
|
-
/* @__PURE__ */ p(
|
|
3052
|
-
/* @__PURE__ */ p(br, {}),
|
|
3115
|
+
/* @__PURE__ */ p(Ze, {}),
|
|
3116
|
+
/* @__PURE__ */ p(Xe, {}),
|
|
3053
3117
|
/* @__PURE__ */ p(gr, {}),
|
|
3118
|
+
/* @__PURE__ */ p(Sr, {}),
|
|
3054
3119
|
/* @__PURE__ */ p(vr, {}),
|
|
3055
|
-
/* @__PURE__ */ p(
|
|
3056
|
-
/* @__PURE__ */ p(
|
|
3120
|
+
/* @__PURE__ */ p(br, {}),
|
|
3121
|
+
/* @__PURE__ */ p(qi, {}),
|
|
3057
3122
|
/* @__PURE__ */ p(Ji, {}),
|
|
3058
|
-
/* @__PURE__ */ p(
|
|
3059
|
-
|
|
3123
|
+
/* @__PURE__ */ p(Zi, {}),
|
|
3124
|
+
/* @__PURE__ */ p(ea, {}),
|
|
3125
|
+
/* @__PURE__ */ p(Qe, {
|
|
3126
|
+
onChange: ce,
|
|
3060
3127
|
ignoreSelectionChange: !0
|
|
3061
3128
|
}),
|
|
3062
3129
|
/* @__PURE__ */ p("input", {
|
|
3063
|
-
ref:
|
|
3130
|
+
ref: re,
|
|
3064
3131
|
type: "file",
|
|
3065
|
-
accept:
|
|
3132
|
+
accept: vt,
|
|
3066
3133
|
hidden: !0,
|
|
3067
|
-
onChange:
|
|
3134
|
+
onChange: oe
|
|
3068
3135
|
}),
|
|
3069
|
-
/* @__PURE__ */ p(
|
|
3070
|
-
sheet:
|
|
3136
|
+
/* @__PURE__ */ p(Ur, {
|
|
3137
|
+
sheet: b,
|
|
3071
3138
|
formats: y,
|
|
3072
3139
|
onClose: () => {
|
|
3073
|
-
if (
|
|
3074
|
-
|
|
3140
|
+
if (w.current) {
|
|
3141
|
+
w.current = !1;
|
|
3075
3142
|
return;
|
|
3076
3143
|
}
|
|
3077
|
-
|
|
3144
|
+
x(null), window.requestAnimationFrame(() => f.focus());
|
|
3078
3145
|
},
|
|
3079
|
-
onTypeset:
|
|
3146
|
+
onTypeset: pe,
|
|
3080
3147
|
onPolishMenu: () => {
|
|
3081
|
-
|
|
3148
|
+
w.current = !0, x("aiPreset");
|
|
3082
3149
|
},
|
|
3083
|
-
onPickPreset:
|
|
3084
|
-
savedSelectionRef:
|
|
3085
|
-
committedColors:
|
|
3086
|
-
onColorCommit: (e, t) =>
|
|
3150
|
+
onPickPreset: me,
|
|
3151
|
+
savedSelectionRef: D,
|
|
3152
|
+
committedColors: S,
|
|
3153
|
+
onColorCommit: (e, t) => C((n) => ({
|
|
3087
3154
|
...n,
|
|
3088
3155
|
[e]: t
|
|
3089
3156
|
})),
|
|
3090
3157
|
onPicture: (e) => {
|
|
3091
|
-
if (
|
|
3092
|
-
|
|
3158
|
+
if (O(), e === "upload") {
|
|
3159
|
+
re.current?.click();
|
|
3093
3160
|
return;
|
|
3094
3161
|
}
|
|
3095
|
-
|
|
3162
|
+
w.current = !0, x(null), E(!0);
|
|
3096
3163
|
},
|
|
3097
3164
|
canTypeset: !!l?.typeset,
|
|
3098
3165
|
canPolish: !!l?.polish
|
|
3099
3166
|
}),
|
|
3100
|
-
/* @__PURE__ */ p(Ur, {
|
|
3101
|
-
open: A !== null,
|
|
3102
|
-
seed: A,
|
|
3103
|
-
onClose: M,
|
|
3104
|
-
onConfirm: ee
|
|
3105
|
-
}),
|
|
3106
3167
|
/* @__PURE__ */ p(Gr, {
|
|
3107
|
-
open:
|
|
3108
|
-
|
|
3168
|
+
open: k !== null,
|
|
3169
|
+
seed: k,
|
|
3170
|
+
onClose: A,
|
|
3171
|
+
onConfirm: ne
|
|
3172
|
+
}),
|
|
3173
|
+
/* @__PURE__ */ p(qr, {
|
|
3174
|
+
open: T,
|
|
3175
|
+
onClose: () => E(!1),
|
|
3109
3176
|
onConfirm: (e) => {
|
|
3110
|
-
|
|
3177
|
+
ae(e, "", e), E(!1);
|
|
3111
3178
|
}
|
|
3112
3179
|
}),
|
|
3113
|
-
/* @__PURE__ */ p(
|
|
3114
|
-
open:
|
|
3115
|
-
mode:
|
|
3116
|
-
originalHtml:
|
|
3117
|
-
codeBlocks:
|
|
3180
|
+
/* @__PURE__ */ p(ai, {
|
|
3181
|
+
open: M.mode !== null,
|
|
3182
|
+
mode: M.mode,
|
|
3183
|
+
originalHtml: M.snapshot.html,
|
|
3184
|
+
codeBlocks: M.snapshot.codeBlocks,
|
|
3118
3185
|
ai: l,
|
|
3119
|
-
polishPreset:
|
|
3120
|
-
onClose:
|
|
3121
|
-
onApply:
|
|
3122
|
-
onPickPreset:
|
|
3186
|
+
polishPreset: M.preset,
|
|
3187
|
+
onClose: M.close,
|
|
3188
|
+
onApply: M.apply,
|
|
3189
|
+
onPickPreset: me
|
|
3123
3190
|
})
|
|
3124
3191
|
]
|
|
3125
3192
|
})
|
|
3126
3193
|
})
|
|
3127
3194
|
});
|
|
3128
|
-
},
|
|
3195
|
+
}, na = "1px solid #d9d9d9", ra = { export: new Map([[ue, (e, t) => {
|
|
3129
3196
|
let n = t.exportDOM(e);
|
|
3130
|
-
return
|
|
3131
|
-
}]]) },
|
|
3197
|
+
return Ke(n.element) && (n.element.style.border = na), n;
|
|
3198
|
+
}]]) }, ia = class e extends b {
|
|
3132
3199
|
constructor(e = "", t = {}, n) {
|
|
3133
3200
|
super(e, t, n);
|
|
3134
3201
|
}
|
|
@@ -3143,12 +3210,12 @@ var Yi = ({ value: n, onChange: r, open: i, onOpenChange: a, toolbar: o, upload:
|
|
|
3143
3210
|
}, t.__key);
|
|
3144
3211
|
}
|
|
3145
3212
|
static importJSON(e) {
|
|
3146
|
-
return
|
|
3213
|
+
return aa().updateFromJSON(e);
|
|
3147
3214
|
}
|
|
3148
3215
|
sanitizeUrl(e) {
|
|
3149
3216
|
return e.startsWith("@") ? e : super.sanitizeUrl(e);
|
|
3150
3217
|
}
|
|
3151
|
-
},
|
|
3218
|
+
}, aa = (e = "", t = {}) => _e(new ia(e, t)), oa = {
|
|
3152
3219
|
namespace: "bsyLexicalEditor",
|
|
3153
3220
|
onError: (e) => {
|
|
3154
3221
|
console.error("Lexical error", e);
|
|
@@ -3181,39 +3248,39 @@ var Yi = ({ value: n, onChange: r, open: i, onOpenChange: a, toolbar: o, upload:
|
|
|
3181
3248
|
tableRow: "editor-table-row",
|
|
3182
3249
|
tableScrollableWrapper: "editor-table-scrollable-wrapper"
|
|
3183
3250
|
},
|
|
3184
|
-
html:
|
|
3251
|
+
html: ra,
|
|
3185
3252
|
nodes: [
|
|
3186
|
-
|
|
3253
|
+
ia,
|
|
3187
3254
|
{
|
|
3188
|
-
replace:
|
|
3189
|
-
with: (e) => new
|
|
3255
|
+
replace: b,
|
|
3256
|
+
with: (e) => new ia(e.__url, {
|
|
3190
3257
|
rel: e.__rel,
|
|
3191
3258
|
target: e.__target,
|
|
3192
3259
|
title: e.__title
|
|
3193
3260
|
}),
|
|
3194
|
-
withKlass:
|
|
3261
|
+
withKlass: ia
|
|
3195
3262
|
},
|
|
3196
|
-
|
|
3197
|
-
D,
|
|
3263
|
+
ee,
|
|
3198
3264
|
E,
|
|
3199
|
-
|
|
3200
|
-
|
|
3201
|
-
|
|
3202
|
-
|
|
3265
|
+
T,
|
|
3266
|
+
oe,
|
|
3267
|
+
j,
|
|
3268
|
+
A,
|
|
3269
|
+
de,
|
|
3270
|
+
fe,
|
|
3203
3271
|
ue,
|
|
3204
|
-
|
|
3205
|
-
ir,
|
|
3272
|
+
or,
|
|
3206
3273
|
q,
|
|
3207
3274
|
{
|
|
3208
|
-
replace:
|
|
3275
|
+
replace: Ge,
|
|
3209
3276
|
with: (e) => new q(e.__text),
|
|
3210
3277
|
withKlass: q
|
|
3211
3278
|
}
|
|
3212
3279
|
]
|
|
3213
|
-
},
|
|
3214
|
-
initialConfig:
|
|
3215
|
-
children: /* @__PURE__ */ p(
|
|
3280
|
+
}, sa = (e) => /* @__PURE__ */ p(g, {
|
|
3281
|
+
initialConfig: oa,
|
|
3282
|
+
children: /* @__PURE__ */ p(ta, { ...e })
|
|
3216
3283
|
});
|
|
3217
|
-
|
|
3284
|
+
sa.displayName = "BsyMobileEditor";
|
|
3218
3285
|
//#endregion
|
|
3219
|
-
export {
|
|
3286
|
+
export { Yr as n, sa as t };
|