@baishuyun/ui-mobile 0.12.2 → 0.12.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/AMap/index.js +1 -1
- package/dist/ActionSheet/index.js +1 -1
- package/dist/Calendar/index.js +1 -1
- package/dist/ConfigProvider/index.js +1 -1
- package/dist/Editor/{Editor-Cnznf4wf.js → Editor-CiMeb1VH.js} +571 -537
- package/dist/Editor/index.js +2 -2
- package/dist/Gantt/index.js +1 -1
- package/dist/Icon/index.js +1 -1
- package/dist/Overlay/index.js +1 -1
- package/dist/Popup/index.js +1 -1
- package/dist/Segmented/index.js +1 -1
- package/dist/components/Editor/constants.d.ts +2 -0
- package/dist/components/Editor/plugins/IndentLimitPlugin.d.ts +1 -0
- package/dist/components/Editor/utils/clampElementIndent.d.ts +3 -0
- package/dist/components/Editor/utils/readTextFormats.d.ts +1 -0
- package/dist/index.js +2 -2
- package/dist/style.css +1 -1
- package/dist/vendors/{version-BgnXws3P.js → version-DNTXk7hK.js} +1 -1
- package/package.json +2 -2
|
@@ -8,24 +8,24 @@ import { useEventListener as h } from "ahooks";
|
|
|
8
8
|
import { LexicalComposer as g } from "@lexical/react/LexicalComposer";
|
|
9
9
|
import { $createLinkNode as _, $isLinkNode as v, $toggleLink as y, AutoLinkNode as b, LinkNode as x } from "@lexical/link";
|
|
10
10
|
import { $isListItemNode as S, $isListNode as C, INSERT_ORDERED_LIST_COMMAND as w, INSERT_UNORDERED_LIST_COMMAND as T, ListItemNode as E, ListNode as D, REMOVE_LIST_COMMAND as O } from "@lexical/list";
|
|
11
|
-
import { $createCodeHighlightNode as k, $isCodeHighlightNode as A, $isCodeNode 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
|
|
11
|
+
import { $createCodeHighlightNode as k, $isCodeHighlightNode as A, $isCodeNode as j, $plainifyCodeContent as ee, CodeHighlightNode as M, CodeNode as N, registerCodeIndentation as te } from "@lexical/code-core";
|
|
12
|
+
import { $createHeadingNode as ne, $isHeadingNode as re, HeadingNode as ie } from "@lexical/rich-text";
|
|
13
|
+
import { $findCellNode as ae, $isTableCellNode as oe, $isTableNode as P, $isTableRowNode as se, TableCellNode as ce, TableNode as le, TableRowNode as ue, registerTableCellUnmergeTransform as de, registerTablePlugin as fe, registerTableSelectionObserver as pe, setScrollableTablesActive as me } from "@lexical/table";
|
|
14
|
+
import { $applyNodeReplacement as he, $createLineBreakNode as ge, $createParagraphNode as F, $createTabNode as _e, $createTextNode as ve, $getNodeByKey as ye, $getRoot as I, $getSelection as L, $insertNodes as be, $isElementNode as xe, $isLineBreakNode as Se, $isRangeSelection as R, $isRootOrShadowRoot as Ce, $isTabNode as we, $isTextNode as Te, $nodesOfType as Ee, $onUpdate as De, $setSelection as Oe, BLUR_COMMAND as ke, COMMAND_PRIORITY_HIGH as Ae, COMMAND_PRIORITY_LOW as je, DROP_COMMAND as Me, DecoratorNode as Ne, FOCUS_COMMAND 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, mergeRegister 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 = "#000", dt = "transparent", ft = /* @__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("."), pt = [
|
|
78
78
|
"quick",
|
|
79
79
|
"formal",
|
|
80
80
|
"colloquial",
|
|
81
81
|
"lively",
|
|
82
82
|
"literary",
|
|
83
83
|
"retro"
|
|
84
|
-
],
|
|
84
|
+
], mt = {
|
|
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
|
+
}, ht = [
|
|
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
|
+
], gt = [
|
|
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
|
+
], _t = gt.map((e) => `.${e}`).join(","), vt = "calc(100dvh - 104px)", V = {
|
|
135
|
+
"bsy-mobile-editor": "_bsy-mobile-editor_dfbcr_2",
|
|
136
|
+
"bsy-mobile-editor__label": "_bsy-mobile-editor__label_dfbcr_15",
|
|
137
|
+
"bsy-mobile-editor__label-text": "_bsy-mobile-editor__label-text_dfbcr_20",
|
|
138
|
+
"bsy-mobile-editor__header": "_bsy-mobile-editor__header_dfbcr_29",
|
|
139
|
+
"bsy-mobile-editor__title": "_bsy-mobile-editor__title_dfbcr_39",
|
|
140
|
+
"bsy-mobile-editor__close": "_bsy-mobile-editor__close_dfbcr_49",
|
|
141
|
+
"bsy-mobile-editor__content": "_bsy-mobile-editor__content_dfbcr_63",
|
|
142
|
+
"bsy-mobile-editor__editable": "_bsy-mobile-editor__editable_dfbcr_73",
|
|
143
|
+
"bsy-mobile-editor__image-shell": "_bsy-mobile-editor__image-shell_dfbcr_243",
|
|
144
|
+
"bsy-mobile-editor__image": "_bsy-mobile-editor__image_dfbcr_243",
|
|
145
|
+
"bsy-mobile-editor__image-mask": "_bsy-mobile-editor__image-mask_dfbcr_265",
|
|
146
|
+
"bsy-mobile-editor__image-progress": "_bsy-mobile-editor__image-progress_dfbcr_274",
|
|
147
|
+
"bsy-mobile-editor__image-progress--spin": "_bsy-mobile-editor__image-progress--spin_dfbcr_277",
|
|
148
|
+
"bsy-mobile-editor-progress-spin": "_bsy-mobile-editor-progress-spin_dfbcr_1",
|
|
149
|
+
"bsy-mobile-editor__toolbar": "_bsy-mobile-editor__toolbar_dfbcr_280",
|
|
150
|
+
"bsy-mobile-editor__toolbar-scroller": "_bsy-mobile-editor__toolbar-scroller_dfbcr_295",
|
|
151
|
+
"bsy-mobile-editor__toolbar-track": "_bsy-mobile-editor__toolbar-track_dfbcr_312",
|
|
152
|
+
"bsy-mobile-editor__toolbar-thumb": "_bsy-mobile-editor__toolbar-thumb_dfbcr_324",
|
|
153
|
+
"bsy-mobile-editor__toolbar-group": "_bsy-mobile-editor__toolbar-group_dfbcr_329",
|
|
154
|
+
"bsy-mobile-editor__toolbar-divider": "_bsy-mobile-editor__toolbar-divider_dfbcr_335",
|
|
155
|
+
"bsy-mobile-editor__tool": "_bsy-mobile-editor__tool_dfbcr_280",
|
|
156
|
+
"bsy-mobile-editor__tool--active": "_bsy-mobile-editor__tool--active_dfbcr_356",
|
|
157
|
+
"bsy-mobile-editor__tool--select": "_bsy-mobile-editor__tool--select_dfbcr_363",
|
|
158
|
+
"bsy-mobile-editor__tool--select-align": "_bsy-mobile-editor__tool--select-align_dfbcr_368",
|
|
159
|
+
"bsy-mobile-editor__tool-caret": "_bsy-mobile-editor__tool-caret_dfbcr_371",
|
|
160
|
+
"bsy-mobile-editor__tool-caret--open": "_bsy-mobile-editor__tool-caret--open_dfbcr_374",
|
|
161
|
+
"bsy-mobile-editor__ai-icon": "_bsy-mobile-editor__ai-icon_dfbcr_377",
|
|
162
|
+
"bsy-mobile-editor__tool-text": "_bsy-mobile-editor__tool-text_dfbcr_382",
|
|
163
|
+
"bsy-mobile-editor__color": "_bsy-mobile-editor__color_dfbcr_387",
|
|
164
|
+
"bsy-mobile-editor__color--custom": "_bsy-mobile-editor__color--custom_dfbcr_395",
|
|
165
|
+
"bsy-mobile-editor__color-header": "_bsy-mobile-editor__color-header_dfbcr_398",
|
|
166
|
+
"bsy-mobile-editor__color-header-title": "_bsy-mobile-editor__color-header-title_dfbcr_407",
|
|
167
|
+
"bsy-mobile-editor__color-header-back": "_bsy-mobile-editor__color-header-back_dfbcr_420",
|
|
168
|
+
"bsy-mobile-editor__color-grid": "_bsy-mobile-editor__color-grid_dfbcr_434",
|
|
169
|
+
"bsy-mobile-editor__color-swatch": "_bsy-mobile-editor__color-swatch_dfbcr_441",
|
|
170
|
+
"bsy-mobile-editor__color-none": "_bsy-mobile-editor__color-none_dfbcr_441",
|
|
171
|
+
"bsy-mobile-editor__color-custom-item": "_bsy-mobile-editor__color-custom-item_dfbcr_441",
|
|
172
|
+
"bsy-mobile-editor__color-swatch--selected": "_bsy-mobile-editor__color-swatch--selected_dfbcr_457",
|
|
173
|
+
"bsy-mobile-editor__color-none--selected": "_bsy-mobile-editor__color-none--selected_dfbcr_457",
|
|
174
|
+
"bsy-mobile-editor__color-custom-item--selected": "_bsy-mobile-editor__color-custom-item--selected_dfbcr_457",
|
|
175
|
+
"bsy-mobile-editor__color-swatch-fill": "_bsy-mobile-editor__color-swatch-fill_dfbcr_471",
|
|
176
|
+
"bsy-mobile-editor__color-bar": "_bsy-mobile-editor__color-bar_dfbcr_478",
|
|
177
|
+
"bsy-mobile-editor__color-custom-trigger": "_bsy-mobile-editor__color-custom-trigger_dfbcr_484",
|
|
178
|
+
"bsy-mobile-editor__color-custom-trigger--active": "_bsy-mobile-editor__color-custom-trigger--active_dfbcr_502",
|
|
179
|
+
"bsy-mobile-editor__color-custom-trigger--preview": "_bsy-mobile-editor__color-custom-trigger--preview_dfbcr_507",
|
|
180
|
+
"bsy-mobile-editor__color-custom-list": "_bsy-mobile-editor__color-custom-list_dfbcr_522",
|
|
181
|
+
"bsy-mobile-editor__color-mixer": "_bsy-mobile-editor__color-mixer_dfbcr_542",
|
|
182
|
+
"bsy-mobile-editor__color-spectrum": "_bsy-mobile-editor__color-spectrum_dfbcr_545",
|
|
183
|
+
"bsy-mobile-editor__color-spectrum-canvas": "_bsy-mobile-editor__color-spectrum-canvas_dfbcr_553",
|
|
184
|
+
"bsy-mobile-editor__color-thumb": "_bsy-mobile-editor__color-thumb_dfbcr_560",
|
|
185
|
+
"bsy-mobile-editor__sheet": "_bsy-mobile-editor__sheet_dfbcr_570",
|
|
186
|
+
"bsy-mobile-editor__sheet-body": "_bsy-mobile-editor__sheet-body_dfbcr_576",
|
|
187
|
+
"bsy-mobile-editor__sheet-body--stack": "_bsy-mobile-editor__sheet-body--stack_dfbcr_581",
|
|
188
|
+
"bsy-mobile-editor__sheet-field": "_bsy-mobile-editor__sheet-field_dfbcr_586",
|
|
189
|
+
"bsy-mobile-editor__sheet-label": "_bsy-mobile-editor__sheet-label_dfbcr_591",
|
|
190
|
+
"bsy-mobile-editor__sheet-note": "_bsy-mobile-editor__sheet-note_dfbcr_597",
|
|
191
|
+
"bsy-mobile-editor__sheet-note--hint": "_bsy-mobile-editor__sheet-note--hint_dfbcr_603",
|
|
192
|
+
"bsy-mobile-editor__sheet-error": "_bsy-mobile-editor__sheet-error_dfbcr_606",
|
|
193
|
+
"bsy-mobile-editor__sheet-bar": "_bsy-mobile-editor__sheet-bar_dfbcr_626",
|
|
194
|
+
"bsy-mobile-editor__sheet-ok": "_bsy-mobile-editor__sheet-ok_dfbcr_647",
|
|
195
|
+
"bsy-mobile-editor__check": "_bsy-mobile-editor__check_dfbcr_652",
|
|
196
|
+
"bsy-mobile-editor__check-input": "_bsy-mobile-editor__check-input_dfbcr_664",
|
|
197
|
+
"bsy-mobile-editor__check-box": "_bsy-mobile-editor__check-box_dfbcr_671",
|
|
198
|
+
"bsy-mobile-editor__ai": "_bsy-mobile-editor__ai_dfbcr_377",
|
|
199
|
+
"bsy-mobile-editor__ai-body": "_bsy-mobile-editor__ai-body_dfbcr_693",
|
|
200
|
+
"bsy-mobile-editor__ai-section": "_bsy-mobile-editor__ai-section_dfbcr_701",
|
|
201
|
+
"bsy-mobile-editor__ai-section-head": "_bsy-mobile-editor__ai-section-head_dfbcr_709",
|
|
202
|
+
"bsy-mobile-editor__ai-section-scroll": "_bsy-mobile-editor__ai-section-scroll_dfbcr_717",
|
|
203
|
+
"bsy-mobile-editor__ai-label": "_bsy-mobile-editor__ai-label_dfbcr_724",
|
|
204
|
+
"bsy-mobile-editor__ai-label--after": "_bsy-mobile-editor__ai-label--after_dfbcr_736",
|
|
205
|
+
"bsy-mobile-editor__ai-label--before": "_bsy-mobile-editor__ai-label--before_dfbcr_740",
|
|
206
|
+
"bsy-mobile-editor__ai-dot": "_bsy-mobile-editor__ai-dot_dfbcr_744",
|
|
207
|
+
"bsy-mobile-editor__ai-split": "_bsy-mobile-editor__ai-split_dfbcr_751",
|
|
208
|
+
"bsy-mobile-editor__ai-preset": "_bsy-mobile-editor__ai-preset_dfbcr_757",
|
|
209
|
+
"bsy-mobile-editor__ai-think-pin": "_bsy-mobile-editor__ai-think-pin_dfbcr_777",
|
|
210
|
+
"bsy-mobile-editor__ai-think-head": "_bsy-mobile-editor__ai-think-head_dfbcr_781",
|
|
211
|
+
"bsy-mobile-editor__ai-think-label": "_bsy-mobile-editor__ai-think-label_dfbcr_798",
|
|
212
|
+
"bsy-mobile-editor__ai-think-label--shimmer": "_bsy-mobile-editor__ai-think-label--shimmer_dfbcr_802",
|
|
213
|
+
"bsy-mobile-ai-think-shimmer": "_bsy-mobile-ai-think-shimmer_dfbcr_1",
|
|
214
|
+
"bsy-mobile-editor__ai-think-arrow": "_bsy-mobile-editor__ai-think-arrow_dfbcr_813",
|
|
215
|
+
"bsy-mobile-editor__ai-think-arrow--open": "_bsy-mobile-editor__ai-think-arrow--open_dfbcr_820",
|
|
216
|
+
"bsy-mobile-editor__ai-think-icon": "_bsy-mobile-editor__ai-think-icon_dfbcr_823",
|
|
217
|
+
"bsy-mobile-ai-think": "_bsy-mobile-ai-think_dfbcr_1",
|
|
218
|
+
"bsy-mobile-editor__ai-think-body": "_bsy-mobile-editor__ai-think-body_dfbcr_835",
|
|
219
|
+
"bsy-mobile-editor__ai-error": "_bsy-mobile-editor__ai-error_dfbcr_844",
|
|
220
|
+
"bsy-mobile-editor__ai-footer": "_bsy-mobile-editor__ai-footer_dfbcr_849",
|
|
221
|
+
"bsy-mobile-editor__ai-footer-ok": "_bsy-mobile-editor__ai-footer-ok_dfbcr_871"
|
|
222
|
+
}, yt = {
|
|
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
|
+
}, bt = yt.typeset.join("\n"), xt = yt.polishSystem.join("\n"), St = (e) => `${xt}\n\n【本轮风格】\n${yt.polish[e] ?? yt.polish.quick}`, Ct = (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
|
+
}, wt = "<!--bsy-block-->", Tt = /<!--bsy-code-(\d+)-->/g, Et = "bsy-html-root", Dt = (e) => new DOMParser().parseFromString(`<${Et}>${e}</${Et}>`, "text/html").body.querySelector(Et), Ot = (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(Tt, (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
|
+
}, kt = (e) => {
|
|
309
309
|
if (!/<pre[\s>/]/i.test(e)) return e;
|
|
310
|
-
let t =
|
|
310
|
+
let t = Dt(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
|
+
}, At = (e, t) => Ot(kt(e), t), jt = "p, h1, h2, h3, li", Mt = /background(-color)?\s*:/i, Nt = (e) => {
|
|
319
|
+
if (!e.trim() || !Mt.test(e)) return e;
|
|
320
|
+
let t = Dt(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(jt))) {
|
|
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
|
+
}, Pt = "--listitem-marker-font-size", Ft = `max(24px, calc(var(${Pt}, 1em) * 1.25))`, It = new Set([
|
|
328
328
|
"U",
|
|
329
329
|
"I",
|
|
330
330
|
"EM",
|
|
331
331
|
"B",
|
|
332
332
|
"STRONG"
|
|
333
|
-
]),
|
|
334
|
-
["fontSize",
|
|
333
|
+
]), Lt = (e) => e.startsWith("--listitem-marker-"), Rt = [
|
|
334
|
+
["fontSize", Pt],
|
|
335
335
|
["color", "--listitem-marker-color"],
|
|
336
336
|
["backgroundColor", "--listitem-marker-background-color"],
|
|
337
337
|
["fontFamily", "--listitem-marker-font-family"]
|
|
338
|
-
],
|
|
338
|
+
], zt = (e) => {
|
|
339
339
|
let t = e.style.fontSize;
|
|
340
|
-
if (
|
|
341
|
-
for (let n = e.parentElement; n; n = n.parentElement) if (t &&
|
|
340
|
+
if (Rt.some(([t]) => e.style[t])) {
|
|
341
|
+
for (let n = e.parentElement; n; n = n.parentElement) if (t && It.has(n.tagName) && !n.style.fontSize && (n.style.fontSize = t), !(n.tagName !== "LI" || n.classList.contains("editor-nested-listitem"))) for (let [t, r] of Rt) {
|
|
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
|
+
}, Bt = (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
|
+
}, Vt = [
|
|
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
|
+
], Ht = (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 Vt) {
|
|
369
369
|
let n = t.style.getPropertyValue(e);
|
|
370
370
|
n && (r.push(`${e}: ${n}`), t.style.removeProperty(e));
|
|
371
371
|
}
|
|
@@ -383,34 +383,34 @@ var st = [
|
|
|
383
383
|
}
|
|
384
384
|
}
|
|
385
385
|
}
|
|
386
|
-
},
|
|
386
|
+
}, Ut = (e, t) => {
|
|
387
387
|
let n = I();
|
|
388
388
|
if (n.clear(), t.trim()) {
|
|
389
389
|
let r = new DOMParser().parseFromString(t, "text/html");
|
|
390
|
-
|
|
391
|
-
let i =
|
|
390
|
+
Ht(r);
|
|
391
|
+
let i = nt(e, r);
|
|
392
392
|
if (i.length) {
|
|
393
393
|
n.select(), be(i), Oe(null);
|
|
394
394
|
return;
|
|
395
395
|
}
|
|
396
396
|
}
|
|
397
|
-
let r =
|
|
397
|
+
let r = F();
|
|
398
398
|
n.append(r), Oe(null);
|
|
399
|
-
},
|
|
399
|
+
}, Wt = (e) => {
|
|
400
400
|
if (e) {
|
|
401
401
|
I().selectStart();
|
|
402
402
|
return;
|
|
403
403
|
}
|
|
404
404
|
Oe(null);
|
|
405
|
-
},
|
|
405
|
+
}, Gt = (e) => {
|
|
406
406
|
e && Oe(e.clone());
|
|
407
|
-
},
|
|
407
|
+
}, Kt = () => {
|
|
408
408
|
L() === null && I().selectStart();
|
|
409
409
|
}, H = (e) => {
|
|
410
410
|
e.isEditable() || e.setEditable(!0), e.update(() => {
|
|
411
|
-
|
|
411
|
+
Kt();
|
|
412
412
|
}), e.focus(void 0, { defaultSelection: "rootStart" });
|
|
413
|
-
},
|
|
413
|
+
}, qt = (e, t) => !t.trim() && (e === "<p><br></p>" || e === "<p></p>" || e === "" || /^<p>\s*<br>\s*<\/p>$/.test(e)), Jt = /* @__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("."), Yt = [
|
|
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
|
+
], Xt = 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(".")), Zt = /^(?:(?:(?:f|ht)tps?|mailto|blob):|data:image\/[a-z0-9.+-]+[;,].*|[^a-z]|[a-z+.-]+(?:[^a-z+.:-]|$))/i, Qt = new Set([
|
|
430
430
|
"pre",
|
|
431
431
|
"code",
|
|
432
432
|
"td",
|
|
433
433
|
"th"
|
|
434
|
-
]),
|
|
434
|
+
]), $t = new Set(["pre", "code"]), en = new Set(["sup", "sub"]), tn = (e, t) => Lt(e) ? t === "li" : Xt.has(e) ? e === "padding-inline-start" ? !0 : e === "padding" || e.startsWith("padding-") ? Qt.has(t) : e === "border-radius" ? $t.has(t) : e === "position" || e === "top" || e === "bottom" ? en.has(t) : !0 : !1, nn = (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 !tn(r, t) || /expression|javascript:|url\s*\(\s*['"]?\s*javascript/i.test(i) ? null : `${r}: ${i}`;
|
|
443
|
+
}).filter((e) => e !== null).join("; "), rn = !1, an = () => {
|
|
444
|
+
rn ||= (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 = nn(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 ? (an(), rt.sanitize(e, {
|
|
452
|
+
ALLOWED_TAGS: Jt,
|
|
453
|
+
ALLOWED_ATTR: Yt,
|
|
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: Zt
|
|
461
461
|
})) : "", W = {
|
|
462
462
|
margin: "0.6em 0 0.4em",
|
|
463
463
|
"font-weight": "600",
|
|
464
464
|
"line-height": "1.35"
|
|
465
|
-
},
|
|
465
|
+
}, on = {
|
|
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
|
+
}, sn = {
|
|
491
491
|
color: "#0269ff",
|
|
492
492
|
cursor: "pointer"
|
|
493
|
-
},
|
|
493
|
+
}, cn = {
|
|
494
494
|
margin: "0",
|
|
495
495
|
"padding-inline-start": "0",
|
|
496
496
|
"list-style-position": "outside"
|
|
497
|
-
},
|
|
497
|
+
}, ln = [
|
|
498
498
|
"disc",
|
|
499
499
|
"circle",
|
|
500
500
|
"square"
|
|
501
|
-
],
|
|
501
|
+
], un = {
|
|
502
502
|
margin: "0",
|
|
503
|
-
"margin-inline-start":
|
|
503
|
+
"margin-inline-start": Ft,
|
|
504
504
|
"list-style": "inherit"
|
|
505
|
-
},
|
|
505
|
+
}, dn = {
|
|
506
506
|
margin: "0",
|
|
507
507
|
"margin-inline-start": "0",
|
|
508
508
|
"list-style-type": "none"
|
|
509
|
-
},
|
|
509
|
+
}, fn = {
|
|
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
|
+
}, pn = {
|
|
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
|
+
}, mn = {
|
|
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
|
+
}, hn = {
|
|
538
538
|
"font-weight": "600",
|
|
539
539
|
"background-color": "#f2f3f5"
|
|
540
|
-
},
|
|
540
|
+
}, gn = {
|
|
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
|
+
}, _n = (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
|
+
}, vn = (e) => {
|
|
554
554
|
let t = [...e.querySelectorAll("*")].filter((e) => e instanceof HTMLElement);
|
|
555
|
-
for (let e of t)
|
|
555
|
+
for (let e of t) zt(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 = on[t];
|
|
558
|
+
if (n && G(e, n), t === "a" && G(e, sn), t === "ul") {
|
|
559
|
+
let t = Math.min(Math.max(_n(e), 1), ln.length);
|
|
560
560
|
G(e, {
|
|
561
|
-
...
|
|
562
|
-
"list-style-type":
|
|
561
|
+
...cn,
|
|
562
|
+
"list-style-type": ln[t - 1]
|
|
563
563
|
});
|
|
564
564
|
}
|
|
565
565
|
t === "ol" && G(e, {
|
|
566
|
-
...
|
|
566
|
+
...cn,
|
|
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") ? dn : un), t === "pre" && G(e, fn), (t === "sup" || t === "sub") && G(e, {
|
|
569
|
+
...gn,
|
|
570
570
|
"vertical-align": t === "sup" ? "super" : "sub"
|
|
571
|
-
}), t === "table" && G(e,
|
|
571
|
+
}), t === "table" && G(e, pn), (t === "td" || t === "th") && (G(e, mn), (t === "th" || e.classList.contains("editor-table-cell-header")) && G(e, hn)), 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
|
+
}, yn = (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
|
+
}, bn = (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
|
+
yn(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") && (yn(n), t = !0);
|
|
595
595
|
}
|
|
596
596
|
}
|
|
597
|
-
},
|
|
597
|
+
}, xn = (e) => {
|
|
598
598
|
if (!e.trim()) return e;
|
|
599
599
|
let t = new DOMParser().parseFromString(e, "text/html");
|
|
600
|
-
|
|
600
|
+
vn(t.body), bn(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
|
+
}, Sn = (e) => e ? new DOMParser().parseFromString(e, "text/html").body.textContent ?? "" : "", Cn = (e) => e.includes("<!--bsy-block-->") ? e.split(wt).map((e) => e.trim()) : [e], wn = (e) => e.split(wt).join("").trim().length > 0, Tn = (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
|
+
}, En = 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
|
+
]), Dn = (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
|
+
}, On = (e, t) => {
|
|
636
636
|
let n = e;
|
|
637
|
-
for (; n && n !== t && !
|
|
637
|
+
for (; n && n !== t && !En.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
|
+
}, kn = (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
|
+
}, An = (e) => {
|
|
645
|
+
let t = Dt(e);
|
|
646
|
+
return t ? Array.from(t.children).filter((e) => !kn(e)).map((e) => e.textContent ?? "") : [];
|
|
647
|
+
}, jn = (e) => e.includes("<!--bsy-block-->") ? e : Sn(e) || e, Mn = (e, t) => {
|
|
648
|
+
let n = Dn(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 = Tn(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(), On(o, e);
|
|
662
662
|
}
|
|
663
|
-
},
|
|
664
|
-
let n =
|
|
665
|
-
if (!
|
|
666
|
-
let r =
|
|
663
|
+
}, Nn = (e, t) => {
|
|
664
|
+
let n = jn(t);
|
|
665
|
+
if (!wn(n) || !e.trim()) return "";
|
|
666
|
+
let r = Dt(e);
|
|
667
667
|
if (!r) return "";
|
|
668
|
-
let i = Array.from(r.children).filter((e) => !
|
|
668
|
+
let i = Array.from(r.children).filter((e) => !kn(e));
|
|
669
669
|
if (i.length === 0) return "";
|
|
670
|
-
let a =
|
|
671
|
-
for (let e = 0; e < i.length; e++)
|
|
670
|
+
let a = Cn(n), o = a.length === i.length ? a : Tn(i.map((e) => e.textContent ?? ""), a.join(""));
|
|
671
|
+
for (let e = 0; e < i.length; e++) Mn(i[e], o[e] ?? "");
|
|
672
672
|
return r.innerHTML;
|
|
673
|
-
},
|
|
673
|
+
}, Pn = (e, t) => {
|
|
674
674
|
let n = "";
|
|
675
675
|
e.getEditorState().read(() => {
|
|
676
|
-
n =
|
|
676
|
+
n = xn(U(tt(e, null)));
|
|
677
677
|
}, { editor: e });
|
|
678
|
-
let r = U(
|
|
679
|
-
return !r.trim() ||
|
|
680
|
-
|
|
678
|
+
let r = U(Nn(n, t));
|
|
679
|
+
return !r.trim() || qt(r, Sn(r)) ? !1 : (e.update(() => {
|
|
680
|
+
Ut(e, r), Wt(!0);
|
|
681
681
|
}, { discrete: !0 }), !0);
|
|
682
|
-
},
|
|
682
|
+
}, Fn = /^\uFEFF/, In = /^ {0,3}`{1,3}[A-Za-z]*$/, Ln = /^( {0,3})([^`<]*?)```[ \t]*([A-Za-z0-9_-]*)[ \t]*(.*)$/, Rn = /^ {0,3}```[ \t]*$/, zn = /<\/?[a-zA-Z]/, Bn = /<[a-zA-Z!]/, Vn = (e) => Bn.test(e), Hn = (e) => zn.test(e), Un = (e) => e.replace(Fn, "").replace(/\r\n/g, "\n"), Wn = (e) => {
|
|
683
683
|
let t = e.replace(/\n+$/, ""), n = t.lastIndexOf("\n"), r = n === -1 ? t : t.slice(n + 1);
|
|
684
|
-
return
|
|
684
|
+
return In.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
|
+
}, Gn = (e) => {
|
|
692
|
+
let t = Ln.exec(e);
|
|
693
693
|
return t ? { sameLineBody: t[4] ?? "" } : null;
|
|
694
|
-
},
|
|
694
|
+
}, Kn = (e) => {
|
|
695
695
|
let t = e.replace(/[ \t]*```[ \t]*$/, "");
|
|
696
696
|
return t === e ? e : t;
|
|
697
|
-
},
|
|
697
|
+
}, qn = (e) => Vn(e) ? e.replace(/^\n/, "") : "", Jn = (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 = Gn(e);
|
|
701
701
|
if (i) {
|
|
702
702
|
let e = i.sameLineBody;
|
|
703
|
-
if (e !==
|
|
704
|
-
e =
|
|
705
|
-
let i =
|
|
703
|
+
if (e !== Kn(e)) {
|
|
704
|
+
e = Kn(e);
|
|
705
|
+
let i = qn(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 && !Rn.test(t[r]);) a.push(t[r]), r += 1;
|
|
714
|
+
let o = r < t.length ? qn(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 (Hn(e)) return Yn([...n, ...t.slice(r)].join("\n"));
|
|
722
|
+
Vn(e) && n.push(e), r += 1;
|
|
723
723
|
}
|
|
724
724
|
return n.length ? n.join("\n") : null;
|
|
725
|
-
},
|
|
725
|
+
}, Yn = (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 = Gn(t[0]);
|
|
729
|
+
return n && !Hn(t[0].slice(0, t[0].indexOf("```"))) && (t.shift(), n.sameLineBody && t.unshift(Kn(n.sameLineBody))), t.length && Rn.test(t[t.length - 1] ?? "") && t.pop(), t.join("\n");
|
|
730
|
+
}, Xn = (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 } = Wn(Un(e));
|
|
736
736
|
if (!t.trim()) return {
|
|
737
737
|
html: "",
|
|
738
|
-
pending: n ||
|
|
738
|
+
pending: n || In.test(Un(e).trim())
|
|
739
739
|
};
|
|
740
|
-
let r =
|
|
740
|
+
let r = Jn(t) ?? t, i = Jn(r);
|
|
741
741
|
i !== null && i !== r && (r = i);
|
|
742
742
|
let a = r.trim();
|
|
743
|
-
return
|
|
743
|
+
return Vn(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
|
+
}, Zn = (e, t) => {
|
|
751
|
+
let { html: n } = Xn(e);
|
|
752
|
+
return n ? Nt(At(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 Qn(e, t, n) {
|
|
757
|
+
let r = U(Zn(t, n));
|
|
758
|
+
return !r.trim() || qt(r, "") ? { applied: !1 } : (e.update(() => {
|
|
759
|
+
Ut(e, r), Wt(!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 $n = (e) => {
|
|
765
765
|
let t = "", n = "", r = "";
|
|
766
766
|
e.getEditorState().read(() => {
|
|
767
|
-
n = I().getTextContent(), t =
|
|
767
|
+
n = I().getTextContent(), t = xn(U(tt(e, null))), r = An(t).join(`\n\n${wt}\n\n`);
|
|
768
768
|
}, { editor: e });
|
|
769
|
-
let i =
|
|
769
|
+
let i = Ct(t);
|
|
770
770
|
return {
|
|
771
771
|
html: t,
|
|
772
772
|
text: n,
|
|
@@ -774,7 +774,7 @@ var Zn = (e) => {
|
|
|
774
774
|
htmlWithoutCode: i.html,
|
|
775
775
|
codeBlocks: i.blocks
|
|
776
776
|
};
|
|
777
|
-
},
|
|
777
|
+
}, er = ({ editor: e, ai: t }) => {
|
|
778
778
|
let n = u(t);
|
|
779
779
|
n.current = t;
|
|
780
780
|
let [r, i] = d(null), [a, o] = d({
|
|
@@ -784,18 +784,18 @@ var Zn = (e) => {
|
|
|
784
784
|
htmlWithoutCode: "",
|
|
785
785
|
codeBlocks: []
|
|
786
786
|
}), [s, c] = d("quick"), l = () => {
|
|
787
|
-
let t =
|
|
787
|
+
let t = $n(e);
|
|
788
788
|
o(t), i("typeset"), n.current?.typeset?.({
|
|
789
789
|
html: t.htmlWithoutCode,
|
|
790
790
|
text: t.text,
|
|
791
|
-
prompt:
|
|
791
|
+
prompt: bt
|
|
792
792
|
});
|
|
793
793
|
}, f = (t) => {
|
|
794
|
-
let r =
|
|
794
|
+
let r = $n(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: St(t)
|
|
799
799
|
});
|
|
800
800
|
}, p = () => {
|
|
801
801
|
n.current?.stop?.(), i(null);
|
|
@@ -809,11 +809,11 @@ var Zn = (e) => {
|
|
|
809
809
|
close: p,
|
|
810
810
|
apply: () => {
|
|
811
811
|
let t = n.current?.text ?? "";
|
|
812
|
-
r === "typeset" ?
|
|
812
|
+
r === "typeset" ? Qn(e, t, a.codeBlocks) : r === "polish" && Pn(e, t), p();
|
|
813
813
|
}
|
|
814
814
|
};
|
|
815
|
-
},
|
|
816
|
-
let a = o(
|
|
815
|
+
}, tr = i({}), K = 36, nr = 14, rr = 2 * Math.PI * nr, ir = ({ nodeKey: e, src: t, altText: n, dataId: r, dataSrc: i }) => {
|
|
816
|
+
let a = o(tr), s = e in a, c = a[e];
|
|
817
817
|
return /* @__PURE__ */ m("span", {
|
|
818
818
|
className: V["bsy-mobile-editor__image"],
|
|
819
819
|
children: [/* @__PURE__ */ p("img", {
|
|
@@ -837,26 +837,26 @@ var Zn = (e) => {
|
|
|
837
837
|
children: [/* @__PURE__ */ p("circle", {
|
|
838
838
|
cx: K / 2,
|
|
839
839
|
cy: K / 2,
|
|
840
|
-
r:
|
|
840
|
+
r: nr,
|
|
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: nr,
|
|
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 ? `${rr * .25} ${rr}` : rr,
|
|
853
|
+
strokeDashoffset: c === void 0 ? 0 : rr * (1 - c / 100),
|
|
854
854
|
transform: `rotate(-90 ${K / 2} ${K / 2})`
|
|
855
855
|
})]
|
|
856
856
|
})
|
|
857
857
|
}) : null]
|
|
858
858
|
});
|
|
859
|
-
},
|
|
859
|
+
}, ar = class e extends Ne {
|
|
860
860
|
__src;
|
|
861
861
|
__altText;
|
|
862
862
|
__width;
|
|
@@ -896,13 +896,13 @@ var Zn = (e) => {
|
|
|
896
896
|
}
|
|
897
897
|
static importDOM() {
|
|
898
898
|
return { img: () => ({
|
|
899
|
-
conversion:
|
|
899
|
+
conversion: cr,
|
|
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 sr({
|
|
906
906
|
src: t,
|
|
907
907
|
altText: n,
|
|
908
908
|
width: r,
|
|
@@ -927,7 +927,7 @@ var Zn = (e) => {
|
|
|
927
927
|
return !0;
|
|
928
928
|
}
|
|
929
929
|
decorate() {
|
|
930
|
-
return /* @__PURE__ */ p(
|
|
930
|
+
return /* @__PURE__ */ p(ir, {
|
|
931
931
|
nodeKey: this.getKey(),
|
|
932
932
|
src: this.__src,
|
|
933
933
|
altText: this.__altText,
|
|
@@ -935,7 +935,7 @@ var Zn = (e) => {
|
|
|
935
935
|
dataSrc: this.__dataSrc
|
|
936
936
|
});
|
|
937
937
|
}
|
|
938
|
-
},
|
|
938
|
+
}, or = (e) => e instanceof ar, sr = ({ src: e, altText: t, width: n, height: r, dataId: i, dataSrc: a, key: o }) => new ar(e, t, n, r, o, i, a), cr = (e) => {
|
|
939
939
|
if (!(e instanceof HTMLImageElement)) return null;
|
|
940
940
|
let { src: t, alt: n, style: r } = e, i, a;
|
|
941
941
|
if (r.width) {
|
|
@@ -946,7 +946,7 @@ var Zn = (e) => {
|
|
|
946
946
|
let e = parseInt(r.height, 10);
|
|
947
947
|
Number.isNaN(e) || (a = e);
|
|
948
948
|
}
|
|
949
|
-
return i === void 0 && e.width && (i = e.width), a === void 0 && e.height && (a = e.height), { node:
|
|
949
|
+
return i === void 0 && e.width && (i = e.width), a === void 0 && e.height && (a = e.height), { node: sr({
|
|
950
950
|
src: t,
|
|
951
951
|
altText: n,
|
|
952
952
|
width: i,
|
|
@@ -954,7 +954,7 @@ var Zn = (e) => {
|
|
|
954
954
|
dataId: e.getAttribute("data-id") || void 0,
|
|
955
955
|
dataSrc: e.getAttribute("data-src") || void 0
|
|
956
956
|
}) };
|
|
957
|
-
},
|
|
957
|
+
}, lr = (e) => gt.includes(e.name.split(".").pop()?.toLowerCase() ?? ""), ur = (e) => lr(e) ? e.size > 5242880 ? "size" : null : "type", dr = ({ editor: e, upload: t, savedSelectionRef: n, attachmentsBySrc: r }) => {
|
|
958
958
|
let i = u(null), o = u(null), c = u(!0), [l, f] = d({}), p = a(() => {
|
|
959
959
|
o.current?.abort(), o.current = null;
|
|
960
960
|
}, []);
|
|
@@ -964,8 +964,8 @@ var Zn = (e) => {
|
|
|
964
964
|
let m = a((t, r, i) => {
|
|
965
965
|
let a = "";
|
|
966
966
|
return e.update(() => {
|
|
967
|
-
|
|
968
|
-
let e =
|
|
967
|
+
Gt(n.current), L() === null && I().selectEnd();
|
|
968
|
+
let e = sr({
|
|
969
969
|
src: t,
|
|
970
970
|
altText: r,
|
|
971
971
|
dataSrc: i
|
|
@@ -980,7 +980,7 @@ var Zn = (e) => {
|
|
|
980
980
|
insertImage: m,
|
|
981
981
|
onFileChange: a(async (n) => {
|
|
982
982
|
let i = n.target.files?.[0];
|
|
983
|
-
if (n.target.value = "", !i ||
|
|
983
|
+
if (n.target.value = "", !i || ur(i)) return;
|
|
984
984
|
p();
|
|
985
985
|
let a = new AbortController();
|
|
986
986
|
if (o.current = a, !t?.customRequest) {
|
|
@@ -1005,7 +1005,7 @@ var Zn = (e) => {
|
|
|
1005
1005
|
}));
|
|
1006
1006
|
let u = !1, d = (t) => {
|
|
1007
1007
|
u || (u = !0, URL.revokeObjectURL(s), t || e.update(() => {
|
|
1008
|
-
|
|
1008
|
+
ye(l)?.remove();
|
|
1009
1009
|
}, c.current ? void 0 : { discrete: !0 }), c.current && f((e) => {
|
|
1010
1010
|
let t = { ...e };
|
|
1011
1011
|
return delete t[l], t;
|
|
@@ -1034,8 +1034,8 @@ var Zn = (e) => {
|
|
|
1034
1034
|
return;
|
|
1035
1035
|
}
|
|
1036
1036
|
e.update(() => {
|
|
1037
|
-
let e =
|
|
1038
|
-
|
|
1037
|
+
let e = ye(l);
|
|
1038
|
+
or(e) && (e.setSrc(o), s && e.setDataId(s));
|
|
1039
1039
|
}), d(!0);
|
|
1040
1040
|
} catch {
|
|
1041
1041
|
d(!1);
|
|
@@ -1049,7 +1049,7 @@ var Zn = (e) => {
|
|
|
1049
1049
|
]),
|
|
1050
1050
|
abortUpload: p
|
|
1051
1051
|
};
|
|
1052
|
-
},
|
|
1052
|
+
}, fr = ({ editor: e, savedSelectionRef: t, captureSelection: n }) => {
|
|
1053
1053
|
let [r, i] = d(null);
|
|
1054
1054
|
return {
|
|
1055
1055
|
linkForm: r,
|
|
@@ -1076,7 +1076,7 @@ var Zn = (e) => {
|
|
|
1076
1076
|
if (!r) return;
|
|
1077
1077
|
let a = r.startsWith("@") || /^https?:\/\//.test(r) ? r : `http://${r}`;
|
|
1078
1078
|
e.update(() => {
|
|
1079
|
-
|
|
1079
|
+
Gt(t.current);
|
|
1080
1080
|
let e = L(), r = n.newBlank ? {
|
|
1081
1081
|
target: "_blank",
|
|
1082
1082
|
rel: "noopener noreferrer",
|
|
@@ -1086,16 +1086,16 @@ var Zn = (e) => {
|
|
|
1086
1086
|
let t = n.text.trim() || n.url;
|
|
1087
1087
|
if (e.getTextContent()) y(a, r);
|
|
1088
1088
|
else {
|
|
1089
|
-
let n =
|
|
1089
|
+
let n = ve(t), i = _(a, r);
|
|
1090
1090
|
i.append(n), e.insertNodes([i]);
|
|
1091
1091
|
}
|
|
1092
1092
|
} else {
|
|
1093
|
-
let e =
|
|
1093
|
+
let e = ve(n.text.trim() || n.url), t = _(a, r);
|
|
1094
1094
|
t.append(e);
|
|
1095
1095
|
let i = I(), o = i.getLastChild();
|
|
1096
1096
|
if (xe(o)) o.append(t);
|
|
1097
1097
|
else {
|
|
1098
|
-
let e =
|
|
1098
|
+
let e = F();
|
|
1099
1099
|
e.append(t), i.append(e);
|
|
1100
1100
|
}
|
|
1101
1101
|
}
|
|
@@ -1103,14 +1103,14 @@ var Zn = (e) => {
|
|
|
1103
1103
|
},
|
|
1104
1104
|
closeLink: () => i(null)
|
|
1105
1105
|
};
|
|
1106
|
-
},
|
|
1106
|
+
}, pr = ({ 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 = I().getTextContent(), a =
|
|
1111
|
+
let n = I().getTextContent(), a = xn(U(tt(e, null))), s = qt(a, n) ? null : a;
|
|
1112
1112
|
i.current = s;
|
|
1113
|
-
let c = Ee(
|
|
1113
|
+
let c = Ee(ar).map((e) => r.get(e.getSrc())).filter((e) => e !== void 0);
|
|
1114
1114
|
o.current({
|
|
1115
1115
|
text: n,
|
|
1116
1116
|
html: s,
|
|
@@ -1120,7 +1120,7 @@ var Zn = (e) => {
|
|
|
1120
1120
|
}, [r, e]);
|
|
1121
1121
|
return s(() => {
|
|
1122
1122
|
t === void 0 || t === i.current || (i.current = t ?? null, e.update(() => {
|
|
1123
|
-
|
|
1123
|
+
Ut(e, t?.trim() ? U(t) : ""), Wt(!!e.getRootElement()?.contains(document.activeElement));
|
|
1124
1124
|
}, { onUpdate: () => {
|
|
1125
1125
|
e.getRootElement() || c(e.getEditorState());
|
|
1126
1126
|
} }));
|
|
@@ -1129,11 +1129,11 @@ var Zn = (e) => {
|
|
|
1129
1129
|
c,
|
|
1130
1130
|
t
|
|
1131
1131
|
]), c;
|
|
1132
|
-
},
|
|
1132
|
+
}, mr = 250, hr = () => {
|
|
1133
1133
|
let [e] = z(), t = u(0);
|
|
1134
1134
|
return s(() => e.registerCommand(ze, (e) => {
|
|
1135
1135
|
let n = Date.now(), r = n - t.current;
|
|
1136
|
-
if (t.current = n, r <= 0 || r >=
|
|
1136
|
+
if (t.current = n, r <= 0 || r >= mr) return !1;
|
|
1137
1137
|
let i = L();
|
|
1138
1138
|
if (!R(i) || !i.isCollapsed()) return !1;
|
|
1139
1139
|
let a = i.anchor.getNode();
|
|
@@ -1141,8 +1141,8 @@ var Zn = (e) => {
|
|
|
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 = F();
|
|
1145
|
+
st(i, {
|
|
1146
1146
|
"background-color": "",
|
|
1147
1147
|
color: "",
|
|
1148
1148
|
"font-size": "",
|
|
@@ -1153,22 +1153,22 @@ var Zn = (e) => {
|
|
|
1153
1153
|
let c = s.getPreviousSibling();
|
|
1154
1154
|
return c?.getTextContent().trim() === "" && c.remove(), e?.preventDefault(), !0;
|
|
1155
1155
|
}, je), [e]), null;
|
|
1156
|
-
},
|
|
1156
|
+
}, gr = (e, t) => e.split(";").map((e) => e.trim()).filter((e) => e && e.split(":")[0].trim().toLowerCase() !== t).join("; "), _r = () => {
|
|
1157
1157
|
let [e] = z();
|
|
1158
|
-
return s(() => e.registerNodeTransform(
|
|
1158
|
+
return s(() => e.registerNodeTransform(ie, (e) => {
|
|
1159
1159
|
let t = e.getTag();
|
|
1160
1160
|
if (t === "h4" || t === "h5" || t === "h6") {
|
|
1161
|
-
e.replace(
|
|
1161
|
+
e.replace(F(), !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 = gr(e, "font-size");
|
|
1168
1168
|
n !== e && t.setStyle(n);
|
|
1169
1169
|
}
|
|
1170
1170
|
}), [e]), null;
|
|
1171
|
-
}, q = class e extends
|
|
1171
|
+
}, q = class e extends Ge {
|
|
1172
1172
|
static getType() {
|
|
1173
1173
|
return "extended-text";
|
|
1174
1174
|
}
|
|
@@ -1176,7 +1176,7 @@ var Zn = (e) => {
|
|
|
1176
1176
|
return new e(t.__text, t.__key);
|
|
1177
1177
|
}
|
|
1178
1178
|
static importDOM() {
|
|
1179
|
-
let e =
|
|
1179
|
+
let e = Ge.importDOM();
|
|
1180
1180
|
return {
|
|
1181
1181
|
...e,
|
|
1182
1182
|
code: () => ({
|
|
@@ -1206,12 +1206,12 @@ var Zn = (e) => {
|
|
|
1206
1206
|
};
|
|
1207
1207
|
}
|
|
1208
1208
|
static importJSON(e) {
|
|
1209
|
-
return
|
|
1209
|
+
return vr().updateFromJSON(e);
|
|
1210
1210
|
}
|
|
1211
1211
|
isSimpleText() {
|
|
1212
1212
|
return this.__type === "extended-text" && this.__mode === 0;
|
|
1213
1213
|
}
|
|
1214
|
-
},
|
|
1214
|
+
}, vr = (e = "") => he(new q(e)), J = (e) => (t) => {
|
|
1215
1215
|
let n = e?.(t);
|
|
1216
1216
|
if (!n) return null;
|
|
1217
1217
|
let r = n.conversion(t);
|
|
@@ -1235,31 +1235,31 @@ var Zn = (e) => {
|
|
|
1235
1235
|
return n;
|
|
1236
1236
|
}
|
|
1237
1237
|
};
|
|
1238
|
-
},
|
|
1238
|
+
}, yr = () => {
|
|
1239
1239
|
let [e] = z();
|
|
1240
1240
|
return s(() => e.registerNodeTransform(q, (e) => {
|
|
1241
1241
|
if (!B(e, v)) return;
|
|
1242
1242
|
let t = e.getStyle();
|
|
1243
1243
|
if (!t) return;
|
|
1244
|
-
let n =
|
|
1244
|
+
let n = gr(t, "color");
|
|
1245
1245
|
n !== t && e.setStyle(n);
|
|
1246
1246
|
}), [e]), null;
|
|
1247
|
-
},
|
|
1247
|
+
}, br = /<img\b|<picture\b/i, xr = () => {
|
|
1248
1248
|
let [e] = z();
|
|
1249
1249
|
return s(() => {
|
|
1250
1250
|
let t = (t) => {
|
|
1251
1251
|
let n = "clipboardData" in t ? t.clipboardData : "dataTransfer" in t ? t.dataTransfer : null;
|
|
1252
1252
|
if (!n || n.getData("application/x-lexical-editor") || n.getData("application/x-lexical-drag")) return !1;
|
|
1253
1253
|
let r = n.getData("text/html");
|
|
1254
|
-
if (!(Array.from(n.files).some((e) => e.type.startsWith("image/")) || Array.from(n.items).some((e) => e.type.startsWith("image/")) ||
|
|
1254
|
+
if (!(Array.from(n.files).some((e) => e.type.startsWith("image/")) || Array.from(n.items).some((e) => e.type.startsWith("image/")) || br.test(r))) return !1;
|
|
1255
1255
|
t.preventDefault();
|
|
1256
1256
|
let i = n.getData("text/plain");
|
|
1257
|
-
return !
|
|
1257
|
+
return !br.test(r) && !i || e.update(() => {
|
|
1258
1258
|
let t = L();
|
|
1259
1259
|
if (t === null) return;
|
|
1260
1260
|
let n = r ? new DOMParser().parseFromString(r, "text/html") : null;
|
|
1261
1261
|
if (n?.querySelectorAll("img, picture").forEach((e) => e.remove()), (n?.body.innerHTML ?? "") && n?.body.textContent?.trim()) {
|
|
1262
|
-
let t =
|
|
1262
|
+
let t = nt(e, n);
|
|
1263
1263
|
if (t.length) {
|
|
1264
1264
|
be(t);
|
|
1265
1265
|
return;
|
|
@@ -1268,20 +1268,20 @@ var Zn = (e) => {
|
|
|
1268
1268
|
i && t.insertRawText(i);
|
|
1269
1269
|
}, { tag: Ue }), !0;
|
|
1270
1270
|
};
|
|
1271
|
-
return
|
|
1271
|
+
return at(e.registerCommand(He, t, Ae), e.registerCommand(Me, t, Ae));
|
|
1272
1272
|
}, [e]), null;
|
|
1273
|
-
},
|
|
1273
|
+
}, Sr = "data:image/png;base64,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", Cr = "data:image/png;base64,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", wr = (e, t, n) => Math.min(n, Math.max(t, e)), Y = (e) => wr(e, 0, 1), X = (e) => {
|
|
1274
1274
|
let t = e.trim().toLowerCase();
|
|
1275
1275
|
if (t === "" || t === "transparent") return !0;
|
|
1276
1276
|
let n = t.match(/^rgba\([^,]+,[^,]+,[^,]+,\s*([.\d]+)\s*\)$/);
|
|
1277
1277
|
return n !== null && Number(n[1]) === 0;
|
|
1278
|
-
},
|
|
1278
|
+
}, Tr = (e) => {
|
|
1279
1279
|
let t = e.trim().replace(/^#/, "");
|
|
1280
1280
|
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;
|
|
1281
|
-
},
|
|
1281
|
+
}, Er = (e) => {
|
|
1282
1282
|
let t = e.trim();
|
|
1283
1283
|
if (X(t)) return null;
|
|
1284
|
-
let n =
|
|
1284
|
+
let n = Tr(t);
|
|
1285
1285
|
if (n) return {
|
|
1286
1286
|
r: Number.parseInt(n.slice(1, 3), 16),
|
|
1287
1287
|
g: Number.parseInt(n.slice(3, 5), 16),
|
|
@@ -1293,59 +1293,59 @@ var Zn = (e) => {
|
|
|
1293
1293
|
g: Number(r[2]),
|
|
1294
1294
|
b: Number(r[3])
|
|
1295
1295
|
} : null;
|
|
1296
|
-
},
|
|
1296
|
+
}, Dr = ({ r: e, g: t, b: n }) => `#${[
|
|
1297
1297
|
e,
|
|
1298
1298
|
t,
|
|
1299
1299
|
n
|
|
1300
|
-
].map((e) =>
|
|
1300
|
+
].map((e) => wr(Math.round(e), 0, 255).toString(16).padStart(2, "0")).join("")}`, Or = (e, t) => {
|
|
1301
1301
|
if (X(e) && X(t)) return !0;
|
|
1302
|
-
let n =
|
|
1302
|
+
let n = Er(e), r = Er(t);
|
|
1303
1303
|
return !!(n && r && n.r === r.r && n.g === r.g && n.b === r.b);
|
|
1304
|
-
},
|
|
1304
|
+
}, kr = (e) => {
|
|
1305
1305
|
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;
|
|
1306
1306
|
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), {
|
|
1307
1307
|
h: c,
|
|
1308
1308
|
s: s === 0 ? 0 : s / (1 - Math.abs(2 * o - 1)),
|
|
1309
1309
|
l: o
|
|
1310
1310
|
};
|
|
1311
|
-
},
|
|
1311
|
+
}, Ar = ({ h: e, s: t, l: n }) => {
|
|
1312
1312
|
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;
|
|
1313
1313
|
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), {
|
|
1314
1314
|
r: Math.round((s + o) * 255),
|
|
1315
1315
|
g: Math.round((c + o) * 255),
|
|
1316
1316
|
b: Math.round((l + o) * 255)
|
|
1317
1317
|
};
|
|
1318
|
-
},
|
|
1318
|
+
}, jr = (e) => Dr(Ar(e)), Mr = (e, t) => ({
|
|
1319
1319
|
h: Y(e) * 360,
|
|
1320
1320
|
s: 1,
|
|
1321
1321
|
l: Y(1 - t)
|
|
1322
|
-
}),
|
|
1322
|
+
}), Nr = (e) => ({
|
|
1323
1323
|
x: Y((e.h % 360 + 360) % 360 / 360),
|
|
1324
1324
|
y: Y(1 - e.l)
|
|
1325
|
-
}),
|
|
1325
|
+
}), Pr = (e, t, n) => ({
|
|
1326
1326
|
x: Y(n.width === 0 ? 0 : (e - n.left) / n.width),
|
|
1327
1327
|
y: Y(n.height === 0 ? 0 : (t - n.top) / n.height)
|
|
1328
|
-
}),
|
|
1329
|
-
let r =
|
|
1328
|
+
}), Fr = (e, t, n = Infinity) => {
|
|
1329
|
+
let r = Er(t);
|
|
1330
1330
|
if (!r) return e;
|
|
1331
|
-
let i =
|
|
1332
|
-
return [i, ...e.filter((e) => !
|
|
1333
|
-
},
|
|
1331
|
+
let i = Dr(r);
|
|
1332
|
+
return [i, ...e.filter((e) => !Or(e, i))].slice(0, n);
|
|
1333
|
+
}, Ir = (e, t = 24, n = 8) => Math.max(0, Math.floor((e + n) / (t + n))), Lr = (e, t) => {
|
|
1334
1334
|
let n = t % 11;
|
|
1335
1335
|
return Math.floor(t / 11) === 2 ? e[22] ?? e[t] : e[n] ?? e[t];
|
|
1336
|
-
}, Z = (...e) => e.filter(Boolean).join(" "),
|
|
1337
|
-
let t =
|
|
1336
|
+
}, Z = (...e) => e.filter(Boolean).join(" "), Rr = (e) => {
|
|
1337
|
+
let t = Er(e) ?? {
|
|
1338
1338
|
r: 0,
|
|
1339
1339
|
g: 94,
|
|
1340
1340
|
b: 239
|
|
1341
1341
|
};
|
|
1342
1342
|
return {
|
|
1343
|
-
color:
|
|
1344
|
-
point:
|
|
1343
|
+
color: Dr(t),
|
|
1344
|
+
point: Nr(kr(t))
|
|
1345
1345
|
};
|
|
1346
|
-
},
|
|
1347
|
-
let { t: l } = e(), [f, h] = d("presets"), [g, _] = d(() =>
|
|
1348
|
-
_(
|
|
1346
|
+
}, zr = ({ mode: t, currentColor: r, customColors: i, onApply: a, onCustomDraftChange: o, onCustomConfirm: c }) => {
|
|
1347
|
+
let { t: l } = e(), [f, h] = d("presets"), [g, _] = d(() => Rr(r)), [v, y] = d(!1), [b, x] = d(null), S = u(null), C = u(null), w = u(null), T = (e = r) => {
|
|
1348
|
+
_(Rr(e)), y(!1), o(null), h("custom");
|
|
1349
1349
|
};
|
|
1350
1350
|
s(() => {
|
|
1351
1351
|
if (f !== "custom" || typeof ResizeObserver > "u") return;
|
|
@@ -1374,7 +1374,7 @@ var Zn = (e) => {
|
|
|
1374
1374
|
if (!e) return;
|
|
1375
1375
|
let t = () => {
|
|
1376
1376
|
let t = e.getBoundingClientRect().width;
|
|
1377
|
-
t > 0 && x(
|
|
1377
|
+
t > 0 && x(Ir(t));
|
|
1378
1378
|
};
|
|
1379
1379
|
if (t(), typeof ResizeObserver > "u") return;
|
|
1380
1380
|
let n = new ResizeObserver(t);
|
|
@@ -1383,7 +1383,7 @@ var Zn = (e) => {
|
|
|
1383
1383
|
let E = (e) => {
|
|
1384
1384
|
let t = S.current;
|
|
1385
1385
|
if (!t) return;
|
|
1386
|
-
let { x: n, y: r } =
|
|
1386
|
+
let { x: n, y: r } = Pr(e.clientX, e.clientY, t.getBoundingClientRect()), i = jr(Mr(n, r));
|
|
1387
1387
|
_({
|
|
1388
1388
|
color: i,
|
|
1389
1389
|
point: {
|
|
@@ -1422,7 +1422,7 @@ var Zn = (e) => {
|
|
|
1422
1422
|
role: "listbox",
|
|
1423
1423
|
"aria-label": l("editor.customColors"),
|
|
1424
1424
|
children: i.slice(0, b ?? i.length).map((e) => {
|
|
1425
|
-
let t =
|
|
1425
|
+
let t = Or(r, e);
|
|
1426
1426
|
return /* @__PURE__ */ p("button", {
|
|
1427
1427
|
type: "button",
|
|
1428
1428
|
role: "option",
|
|
@@ -1499,8 +1499,8 @@ var Zn = (e) => {
|
|
|
1499
1499
|
className: V["bsy-mobile-editor__color-grid"],
|
|
1500
1500
|
role: "listbox",
|
|
1501
1501
|
"aria-label": l("editor.presetColors"),
|
|
1502
|
-
children:
|
|
1503
|
-
let n =
|
|
1502
|
+
children: ft.map((e, t) => {
|
|
1503
|
+
let n = Or(r, e);
|
|
1504
1504
|
return /* @__PURE__ */ p("button", {
|
|
1505
1505
|
type: "button",
|
|
1506
1506
|
role: "option",
|
|
@@ -1509,7 +1509,7 @@ var Zn = (e) => {
|
|
|
1509
1509
|
className: Z(V["bsy-mobile-editor__color-swatch"], n && V["bsy-mobile-editor__color-swatch--selected"]),
|
|
1510
1510
|
style: {
|
|
1511
1511
|
"--swatch-color": e,
|
|
1512
|
-
"--swatch-ring":
|
|
1512
|
+
"--swatch-ring": Lr(ft, t)
|
|
1513
1513
|
},
|
|
1514
1514
|
onClick: () => a(e),
|
|
1515
1515
|
children: /* @__PURE__ */ p("span", { className: V["bsy-mobile-editor__color-swatch-fill"] })
|
|
@@ -1519,19 +1519,19 @@ var Zn = (e) => {
|
|
|
1519
1519
|
A
|
|
1520
1520
|
]
|
|
1521
1521
|
});
|
|
1522
|
-
},
|
|
1522
|
+
}, Br = (e, t) => {
|
|
1523
1523
|
H(e), e.update(() => {
|
|
1524
|
-
|
|
1524
|
+
ct(L(), () => t === "paragraph" ? F() : ne(t));
|
|
1525
1525
|
});
|
|
1526
|
-
},
|
|
1526
|
+
}, Vr = (e, t, n) => {
|
|
1527
1527
|
H(e), e.update(() => {
|
|
1528
|
-
|
|
1528
|
+
Gt(n), Kt();
|
|
1529
1529
|
let e = L();
|
|
1530
|
-
e &&
|
|
1530
|
+
e && st(e, t);
|
|
1531
1531
|
});
|
|
1532
|
-
},
|
|
1533
|
-
let [b] = z(), { t: x } = e(), [S, C] = d([]), w = u(null), T = i === "fontColor" || i === "fill" ? i : null, E = T === "fill" ? g.fill : T === "fontColor" ? g.fontColor :
|
|
1534
|
-
T && (n && (w.current = null),
|
|
1532
|
+
}, Hr = ({ sheet: i, onClose: a, onTypeset: o, onPolishMenu: s, onPickPreset: c, onPicture: l, savedSelectionRef: h, committedColors: g, onColorCommit: _, canTypeset: v, canPolish: y }) => {
|
|
1533
|
+
let [b] = z(), { t: x } = e(), [S, C] = d([]), w = u(null), T = i === "fontColor" || i === "fill" ? i : null, E = T === "fill" ? g.fill : T === "fontColor" ? g.fontColor : ut, D = (e, t = !1, n = !0) => {
|
|
1534
|
+
T && (n && (w.current = null), Vr(b, { [T === "fill" ? "background-color" : "color"]: e }, h.current), _(T, e), t && !X(e) && C((t) => Fr(t, e)), n && a());
|
|
1535
1535
|
}, O = (e) => {
|
|
1536
1536
|
w.current = null, D(e, !0, !1);
|
|
1537
1537
|
};
|
|
@@ -1594,18 +1594,18 @@ var Zn = (e) => {
|
|
|
1594
1594
|
text: x("editor.heading3")
|
|
1595
1595
|
}
|
|
1596
1596
|
],
|
|
1597
|
-
onAction: (e) =>
|
|
1597
|
+
onAction: (e) => Br(b, e.key)
|
|
1598
1598
|
}),
|
|
1599
1599
|
/* @__PURE__ */ p(r, {
|
|
1600
1600
|
mode: "menu",
|
|
1601
1601
|
open: i === "fontSize",
|
|
1602
1602
|
title: x("editor.fontSize"),
|
|
1603
1603
|
onClose: a,
|
|
1604
|
-
actions:
|
|
1604
|
+
actions: lt.map((e) => ({
|
|
1605
1605
|
key: e.value,
|
|
1606
1606
|
text: e.label
|
|
1607
1607
|
})),
|
|
1608
|
-
onAction: (e) =>
|
|
1608
|
+
onAction: (e) => Vr(b, { "font-size": e.key })
|
|
1609
1609
|
}),
|
|
1610
1610
|
/* @__PURE__ */ p(t, {
|
|
1611
1611
|
open: T !== null,
|
|
@@ -1614,7 +1614,7 @@ var Zn = (e) => {
|
|
|
1614
1614
|
e && O(e), a();
|
|
1615
1615
|
},
|
|
1616
1616
|
position: "bottom",
|
|
1617
|
-
children: T ? /* @__PURE__ */ p(
|
|
1617
|
+
children: T ? /* @__PURE__ */ p(zr, {
|
|
1618
1618
|
mode: T,
|
|
1619
1619
|
currentColor: E,
|
|
1620
1620
|
customColors: S,
|
|
@@ -1634,7 +1634,7 @@ var Zn = (e) => {
|
|
|
1634
1634
|
text: x("editor.aiTypeset"),
|
|
1635
1635
|
disabled: !v,
|
|
1636
1636
|
icon: /* @__PURE__ */ p("img", {
|
|
1637
|
-
src:
|
|
1637
|
+
src: Sr,
|
|
1638
1638
|
alt: "",
|
|
1639
1639
|
width: 16,
|
|
1640
1640
|
height: 16,
|
|
@@ -1646,7 +1646,7 @@ var Zn = (e) => {
|
|
|
1646
1646
|
text: x("editor.aiPolish"),
|
|
1647
1647
|
disabled: !y,
|
|
1648
1648
|
icon: /* @__PURE__ */ p("img", {
|
|
1649
|
-
src:
|
|
1649
|
+
src: Cr,
|
|
1650
1650
|
alt: "",
|
|
1651
1651
|
width: 16,
|
|
1652
1652
|
height: 16,
|
|
@@ -1667,9 +1667,9 @@ var Zn = (e) => {
|
|
|
1667
1667
|
open: i === "aiPreset",
|
|
1668
1668
|
title: x("editor.aiPolish"),
|
|
1669
1669
|
onClose: a,
|
|
1670
|
-
actions:
|
|
1670
|
+
actions: pt.map((e) => ({
|
|
1671
1671
|
key: e,
|
|
1672
|
-
text: x(
|
|
1672
|
+
text: x(mt[e])
|
|
1673
1673
|
})),
|
|
1674
1674
|
onAction: (e) => c(e.key)
|
|
1675
1675
|
}),
|
|
@@ -1696,7 +1696,7 @@ var Zn = (e) => {
|
|
|
1696
1696
|
onAction: (e) => l(e.key)
|
|
1697
1697
|
})
|
|
1698
1698
|
] });
|
|
1699
|
-
},
|
|
1699
|
+
}, Ur = ({ open: r, title: i, bodyClassName: a, onClose: o, onConfirm: s, children: c }) => {
|
|
1700
1700
|
let { t: l } = e();
|
|
1701
1701
|
return /* @__PURE__ */ p(t, {
|
|
1702
1702
|
open: r,
|
|
@@ -1741,11 +1741,11 @@ var Zn = (e) => {
|
|
|
1741
1741
|
]
|
|
1742
1742
|
})
|
|
1743
1743
|
});
|
|
1744
|
-
},
|
|
1744
|
+
}, Wr = ({ open: t, seed: r, onClose: i, onConfirm: a }) => {
|
|
1745
1745
|
let { t: o } = e(), [c, l] = d(""), [u, f] = d(""), [h, g] = d(!0);
|
|
1746
1746
|
return s(() => {
|
|
1747
1747
|
!t || !r || (l(r.url), f(r.text), g(r.newBlank));
|
|
1748
|
-
}, [t, r]), /* @__PURE__ */ m(
|
|
1748
|
+
}, [t, r]), /* @__PURE__ */ m(Ur, {
|
|
1749
1749
|
open: t,
|
|
1750
1750
|
title: o("editor.link"),
|
|
1751
1751
|
bodyClassName: V["bsy-mobile-editor__sheet-body--stack"],
|
|
@@ -1807,13 +1807,13 @@ var Zn = (e) => {
|
|
|
1807
1807
|
})
|
|
1808
1808
|
]
|
|
1809
1809
|
});
|
|
1810
|
-
},
|
|
1810
|
+
}, Gr = /^https?:\/\/.+/i, Kr = ({ open: t, onClose: n, onConfirm: r }) => {
|
|
1811
1811
|
let { t: i } = e(), [o, c] = d(""), [l, u] = d(null), f = a((e) => {
|
|
1812
1812
|
e?.focus();
|
|
1813
1813
|
}, []);
|
|
1814
1814
|
return s(() => {
|
|
1815
1815
|
t && (c(""), u(null));
|
|
1816
|
-
}, [t]), /* @__PURE__ */ p(
|
|
1816
|
+
}, [t]), /* @__PURE__ */ p(Ur, {
|
|
1817
1817
|
open: t,
|
|
1818
1818
|
title: i("editor.imageUrl"),
|
|
1819
1819
|
onClose: n,
|
|
@@ -1823,7 +1823,7 @@ var Zn = (e) => {
|
|
|
1823
1823
|
u(i("editor.imageUrlRequired"));
|
|
1824
1824
|
return;
|
|
1825
1825
|
}
|
|
1826
|
-
if (!
|
|
1826
|
+
if (!Gr.test(e)) {
|
|
1827
1827
|
u(i("editor.imageUrlInvalid"));
|
|
1828
1828
|
return;
|
|
1829
1829
|
}
|
|
@@ -1856,7 +1856,7 @@ var Zn = (e) => {
|
|
|
1856
1856
|
]
|
|
1857
1857
|
})
|
|
1858
1858
|
});
|
|
1859
|
-
},
|
|
1859
|
+
}, qr = `
|
|
1860
1860
|
:host {
|
|
1861
1861
|
all: initial;
|
|
1862
1862
|
display: block;
|
|
@@ -1869,8 +1869,20 @@ var Zn = (e) => {
|
|
|
1869
1869
|
font-family: -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Helvetica Neue', sans-serif;
|
|
1870
1870
|
font-size: 15px;
|
|
1871
1871
|
line-height: 1.6;
|
|
1872
|
+
overflow-wrap: anywhere;
|
|
1872
1873
|
word-break: break-word;
|
|
1873
1874
|
}
|
|
1875
|
+
.bsy-editor-html-preview__body p,
|
|
1876
|
+
.bsy-editor-html-preview__body li,
|
|
1877
|
+
.bsy-editor-html-preview__body h1,
|
|
1878
|
+
.bsy-editor-html-preview__body h2,
|
|
1879
|
+
.bsy-editor-html-preview__body h3,
|
|
1880
|
+
.bsy-editor-html-preview__body h4,
|
|
1881
|
+
.bsy-editor-html-preview__body h5,
|
|
1882
|
+
.bsy-editor-html-preview__body h6 {
|
|
1883
|
+
box-sizing: border-box;
|
|
1884
|
+
max-width: 100%;
|
|
1885
|
+
}
|
|
1874
1886
|
.bsy-editor-html-preview__body p {
|
|
1875
1887
|
margin: 0;
|
|
1876
1888
|
}
|
|
@@ -1937,7 +1949,7 @@ var Zn = (e) => {
|
|
|
1937
1949
|
.bsy-editor-html-preview__body li,
|
|
1938
1950
|
.bsy-editor-html-preview__body .editor-listitem {
|
|
1939
1951
|
margin: 0;
|
|
1940
|
-
margin-inline-start: ${
|
|
1952
|
+
margin-inline-start: ${Ft};
|
|
1941
1953
|
list-style: inherit;
|
|
1942
1954
|
}
|
|
1943
1955
|
.bsy-editor-html-preview__body .editor-nested-listitem {
|
|
@@ -2016,15 +2028,15 @@ var Zn = (e) => {
|
|
|
2016
2028
|
height: auto;
|
|
2017
2029
|
vertical-align: baseline;
|
|
2018
2030
|
}
|
|
2019
|
-
`,
|
|
2031
|
+
`, Jr = ({ html: e }) => {
|
|
2020
2032
|
let t = u(null);
|
|
2021
2033
|
return l(() => {
|
|
2022
|
-
|
|
2034
|
+
Bt(t.current, e, U, qr);
|
|
2023
2035
|
}, [e]), /* @__PURE__ */ p("div", {
|
|
2024
2036
|
ref: t,
|
|
2025
2037
|
className: "bsy-editor-html-preview"
|
|
2026
2038
|
});
|
|
2027
|
-
},
|
|
2039
|
+
}, Yr = () => {
|
|
2028
2040
|
let e = `${c().replace(/:/g, "")}g`;
|
|
2029
2041
|
return /* @__PURE__ */ p("span", {
|
|
2030
2042
|
className: V["bsy-mobile-editor__ai-think-icon"],
|
|
@@ -2063,7 +2075,7 @@ var Zn = (e) => {
|
|
|
2063
2075
|
}) })]
|
|
2064
2076
|
})
|
|
2065
2077
|
});
|
|
2066
|
-
},
|
|
2078
|
+
}, Xr = (t, n) => {
|
|
2067
2079
|
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 ?? "";
|
|
2068
2080
|
return s(() => {
|
|
2069
2081
|
if (!i) {
|
|
@@ -2083,12 +2095,12 @@ var Zn = (e) => {
|
|
|
2083
2095
|
reasoning: m,
|
|
2084
2096
|
toggle: () => o((e) => !e)
|
|
2085
2097
|
};
|
|
2086
|
-
},
|
|
2098
|
+
}, Zr = ({ model: e }) => /* @__PURE__ */ m("button", {
|
|
2087
2099
|
type: "button",
|
|
2088
2100
|
className: V["bsy-mobile-editor__ai-think-head"],
|
|
2089
2101
|
disabled: e.thinking,
|
|
2090
2102
|
onClick: e.toggle,
|
|
2091
|
-
children: [e.thinking ? /* @__PURE__ */ p(
|
|
2103
|
+
children: [e.thinking ? /* @__PURE__ */ p(Yr, {}) : /* @__PURE__ */ p(n, {
|
|
2092
2104
|
name: "arrow-down",
|
|
2093
2105
|
size: 12,
|
|
2094
2106
|
className: [V["bsy-mobile-editor__ai-think-arrow"], e.open ? V["bsy-mobile-editor__ai-think-arrow--open"] : ""].filter(Boolean).join(" ")
|
|
@@ -2096,10 +2108,10 @@ var Zn = (e) => {
|
|
|
2096
2108
|
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"],
|
|
2097
2109
|
children: e.label
|
|
2098
2110
|
})]
|
|
2099
|
-
}),
|
|
2111
|
+
}), Qr = ({ model: e }) => !e.visible || !e.open || !e.reasoning ? null : /* @__PURE__ */ p("div", {
|
|
2100
2112
|
className: V["bsy-mobile-editor__ai-think-body"],
|
|
2101
2113
|
children: e.reasoning
|
|
2102
|
-
}),
|
|
2114
|
+
}), $r = ({ enabled: e, status: t, revision: n, compute: r }) => {
|
|
2103
2115
|
let [i, a] = d(""), o = u(r);
|
|
2104
2116
|
o.current = r;
|
|
2105
2117
|
let c = u(null);
|
|
@@ -2126,7 +2138,7 @@ var Zn = (e) => {
|
|
|
2126
2138
|
]), s(() => () => {
|
|
2127
2139
|
c.current !== null && cancelAnimationFrame(c.current);
|
|
2128
2140
|
}, []), i;
|
|
2129
|
-
},
|
|
2141
|
+
}, ei = 32, ti = .25, ni = 2, ri = ({ viewportRef: e, enabled: t, revision: n }) => {
|
|
2130
2142
|
let r = u(!0), i = u(!1), o = u(0), c = a(() => e.current ?? void 0, [e]), l = a(() => {
|
|
2131
2143
|
o.current = 0;
|
|
2132
2144
|
let t = e.current;
|
|
@@ -2136,7 +2148,7 @@ var Zn = (e) => {
|
|
|
2136
2148
|
t.scrollTop = n;
|
|
2137
2149
|
return;
|
|
2138
2150
|
}
|
|
2139
|
-
t.scrollTop += Math.max(i *
|
|
2151
|
+
t.scrollTop += Math.max(i * ti, Math.min(i, ni)), o.current = requestAnimationFrame(l);
|
|
2140
2152
|
}, [e]), d = a(() => {
|
|
2141
2153
|
!o.current && r.current && (o.current = requestAnimationFrame(l));
|
|
2142
2154
|
}, [l]);
|
|
@@ -2163,7 +2175,7 @@ var Zn = (e) => {
|
|
|
2163
2175
|
let f = () => {
|
|
2164
2176
|
let t = e.current;
|
|
2165
2177
|
if (!t) return;
|
|
2166
|
-
let n = t.scrollHeight - t.clientHeight - t.scrollTop <=
|
|
2178
|
+
let n = t.scrollHeight - t.clientHeight - t.scrollTop <= ei;
|
|
2167
2179
|
i.current ? (i.current = !1, r.current = n, !n && o.current && (cancelAnimationFrame(o.current), o.current = 0)) : n && (r.current = !0);
|
|
2168
2180
|
}, p = () => {
|
|
2169
2181
|
i.current = !0;
|
|
@@ -2181,16 +2193,16 @@ var Zn = (e) => {
|
|
|
2181
2193
|
passive: !0,
|
|
2182
2194
|
enable: t
|
|
2183
2195
|
}), { onScroll: f };
|
|
2184
|
-
},
|
|
2185
|
-
let { t: v } = e(), y = u(null), [b, x] = d(!1), S = c?.status ?? "idle", C = c?.text ?? "", w =
|
|
2196
|
+
}, ii = ({ open: i, mode: a, originalHtml: o, codeBlocks: s = [], ai: c, polishPreset: l, onClose: h, onApply: g, onPickPreset: _ }) => {
|
|
2197
|
+
let { t: v } = e(), y = u(null), [b, x] = d(!1), S = c?.status ?? "idle", C = c?.text ?? "", w = $r({
|
|
2186
2198
|
enabled: i && !!a,
|
|
2187
2199
|
status: S,
|
|
2188
2200
|
revision: C,
|
|
2189
|
-
compute: () => a === "polish" ? U(
|
|
2190
|
-
}), T = !!w.trim(), E =
|
|
2201
|
+
compute: () => a === "polish" ? U(Nn(o, C)) : Zn(C, s)
|
|
2202
|
+
}), T = !!w.trim(), E = Xr({
|
|
2191
2203
|
status: S,
|
|
2192
2204
|
reasoning: c?.reasoning
|
|
2193
|
-
}, T), D =
|
|
2205
|
+
}, T), D = ri({
|
|
2194
2206
|
viewportRef: y,
|
|
2195
2207
|
enabled: i && S === "loading",
|
|
2196
2208
|
revision: `${c?.reasoning ?? ""}\0${w}`
|
|
@@ -2202,7 +2214,7 @@ var Zn = (e) => {
|
|
|
2202
2214
|
closeOnClickOverlay: !1,
|
|
2203
2215
|
children: [/* @__PURE__ */ m("div", {
|
|
2204
2216
|
className: V["bsy-mobile-editor__ai"],
|
|
2205
|
-
style: { height:
|
|
2217
|
+
style: { height: vt },
|
|
2206
2218
|
children: [
|
|
2207
2219
|
/* @__PURE__ */ m("div", {
|
|
2208
2220
|
className: V["bsy-mobile-editor__header"],
|
|
@@ -2235,7 +2247,7 @@ var Zn = (e) => {
|
|
|
2235
2247
|
type: "button",
|
|
2236
2248
|
className: V["bsy-mobile-editor__ai-preset"],
|
|
2237
2249
|
onClick: () => x(!0),
|
|
2238
|
-
children: [v(
|
|
2250
|
+
children: [v(mt[l]), /* @__PURE__ */ p(n, {
|
|
2239
2251
|
name: "arrow-down",
|
|
2240
2252
|
size: 16
|
|
2241
2253
|
})]
|
|
@@ -2243,7 +2255,7 @@ var Zn = (e) => {
|
|
|
2243
2255
|
}),
|
|
2244
2256
|
E.visible ? /* @__PURE__ */ p("div", {
|
|
2245
2257
|
className: V["bsy-mobile-editor__ai-think-pin"],
|
|
2246
|
-
children: /* @__PURE__ */ p(
|
|
2258
|
+
children: /* @__PURE__ */ p(Zr, { model: E })
|
|
2247
2259
|
}) : null,
|
|
2248
2260
|
/* @__PURE__ */ p("div", {
|
|
2249
2261
|
ref: y,
|
|
@@ -2252,7 +2264,7 @@ var Zn = (e) => {
|
|
|
2252
2264
|
children: S === "error" ? /* @__PURE__ */ p("p", {
|
|
2253
2265
|
className: V["bsy-mobile-editor__ai-error"],
|
|
2254
2266
|
children: c?.errorMessage || v("editor.aiError")
|
|
2255
|
-
}) : /* @__PURE__ */ m(f, { children: [/* @__PURE__ */ p(
|
|
2267
|
+
}) : /* @__PURE__ */ m(f, { children: [/* @__PURE__ */ p(Qr, { model: E }), T ? /* @__PURE__ */ p(Jr, { html: w }) : null] })
|
|
2256
2268
|
})
|
|
2257
2269
|
]
|
|
2258
2270
|
}),
|
|
@@ -2267,7 +2279,7 @@ var Zn = (e) => {
|
|
|
2267
2279
|
})
|
|
2268
2280
|
}), /* @__PURE__ */ p("div", {
|
|
2269
2281
|
className: V["bsy-mobile-editor__ai-section-scroll"],
|
|
2270
|
-
children: /* @__PURE__ */ p(
|
|
2282
|
+
children: /* @__PURE__ */ p(Jr, { html: o })
|
|
2271
2283
|
})]
|
|
2272
2284
|
})
|
|
2273
2285
|
]
|
|
@@ -2292,35 +2304,35 @@ var Zn = (e) => {
|
|
|
2292
2304
|
open: b,
|
|
2293
2305
|
title: v("editor.aiPolish"),
|
|
2294
2306
|
onClose: () => x(!1),
|
|
2295
|
-
actions:
|
|
2307
|
+
actions: pt.map((e) => ({
|
|
2296
2308
|
key: e,
|
|
2297
|
-
text: v(
|
|
2309
|
+
text: v(mt[e])
|
|
2298
2310
|
})),
|
|
2299
2311
|
onAction: (e) => _(e.key)
|
|
2300
2312
|
}) : null]
|
|
2301
2313
|
});
|
|
2302
|
-
},
|
|
2314
|
+
}, ai = "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", oi = "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", si = 860.48, ci = 99.52, li = /rgba\(\s*0\s*,\s*0\s*,\s*0\s*,\s*0(?:\.0+)?\s*\)/, ui = {
|
|
2303
2315
|
fontColor: {
|
|
2304
|
-
path:
|
|
2305
|
-
clipHeight:
|
|
2316
|
+
path: ai,
|
|
2317
|
+
clipHeight: si,
|
|
2306
2318
|
x: 128,
|
|
2307
2319
|
width: 768,
|
|
2308
2320
|
rx: 0
|
|
2309
2321
|
},
|
|
2310
2322
|
fill: {
|
|
2311
|
-
path:
|
|
2323
|
+
path: oi,
|
|
2312
2324
|
clipHeight: 816,
|
|
2313
2325
|
x: 112,
|
|
2314
2326
|
width: 800,
|
|
2315
2327
|
rx: 8
|
|
2316
2328
|
}
|
|
2317
|
-
},
|
|
2329
|
+
}, di = (e, t) => {
|
|
2318
2330
|
let n = t.trim().toLowerCase();
|
|
2319
|
-
if (e === "fill") return !n || n === "transparent" ||
|
|
2331
|
+
if (e === "fill") return !n || n === "transparent" || li.test(n);
|
|
2320
2332
|
let r = n.replace(/\s+/g, "");
|
|
2321
2333
|
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)";
|
|
2322
|
-
},
|
|
2323
|
-
let r = `${c().replace(/:/g, "")}clip`, i =
|
|
2334
|
+
}, fi = ({ variant: e, barColor: t, size: n }) => {
|
|
2335
|
+
let r = `${c().replace(/:/g, "")}clip`, i = ui[e];
|
|
2324
2336
|
return /* @__PURE__ */ m("svg", {
|
|
2325
2337
|
width: n,
|
|
2326
2338
|
height: n,
|
|
@@ -2343,36 +2355,37 @@ var Zn = (e) => {
|
|
|
2343
2355
|
}),
|
|
2344
2356
|
/* @__PURE__ */ p("rect", {
|
|
2345
2357
|
x: i.x,
|
|
2346
|
-
y:
|
|
2358
|
+
y: si,
|
|
2347
2359
|
width: i.width,
|
|
2348
|
-
height:
|
|
2360
|
+
height: ci,
|
|
2349
2361
|
rx: i.rx,
|
|
2350
|
-
fill:
|
|
2362
|
+
fill: di(e, t) ? "currentColor" : t
|
|
2351
2363
|
})
|
|
2352
2364
|
]
|
|
2353
2365
|
});
|
|
2354
|
-
},
|
|
2366
|
+
}, pi = {
|
|
2355
2367
|
bold: !1,
|
|
2356
2368
|
italic: !1,
|
|
2357
2369
|
underline: !1,
|
|
2358
2370
|
strikethrough: !1,
|
|
2359
|
-
fontColor:
|
|
2360
|
-
backgroundColor:
|
|
2371
|
+
fontColor: ut,
|
|
2372
|
+
backgroundColor: dt,
|
|
2361
2373
|
align: "left",
|
|
2362
2374
|
listType: !1,
|
|
2375
|
+
canIndent: !0,
|
|
2363
2376
|
canOutdent: !1,
|
|
2364
2377
|
headingTag: !1,
|
|
2365
2378
|
hasRangeSelection: !1,
|
|
2366
2379
|
hasEditorText: !1
|
|
2367
|
-
},
|
|
2380
|
+
}, mi = (e) => e === "center" || e === "right" || e === "left" ? e : e === "end" ? "right" : "left", hi = (e) => {
|
|
2368
2381
|
let t = !!I().getTextContent().trim(), n = {
|
|
2369
|
-
...
|
|
2382
|
+
...pi,
|
|
2370
2383
|
hasEditorText: t
|
|
2371
2384
|
};
|
|
2372
2385
|
if (!e) return n;
|
|
2373
2386
|
let r = L();
|
|
2374
2387
|
if (!R(r)) return n;
|
|
2375
|
-
let i =
|
|
2388
|
+
let i = ot(r, "color", ut), a = ot(r, "background-color", dt), o = r.anchor.getNode(), s = o.getKey() === "root" ? o : B(o, (e) => {
|
|
2376
2389
|
let t = e.getParent();
|
|
2377
2390
|
return t !== null && Ce(t);
|
|
2378
2391
|
});
|
|
@@ -2386,7 +2399,7 @@ var Zn = (e) => {
|
|
|
2386
2399
|
l = t === "number" || t === "bullet" ? t : !1;
|
|
2387
2400
|
}
|
|
2388
2401
|
}
|
|
2389
|
-
let d = B(o,
|
|
2402
|
+
let d = B(o, re), f = re(d) ? d.getTag() : void 0;
|
|
2390
2403
|
return {
|
|
2391
2404
|
bold: r.hasFormat("bold"),
|
|
2392
2405
|
italic: r.hasFormat("italic"),
|
|
@@ -2394,28 +2407,29 @@ var Zn = (e) => {
|
|
|
2394
2407
|
strikethrough: r.hasFormat("strikethrough"),
|
|
2395
2408
|
fontColor: i,
|
|
2396
2409
|
backgroundColor: a,
|
|
2397
|
-
align:
|
|
2410
|
+
align: mi(xe(s) ? s.getFormatType() : ""),
|
|
2398
2411
|
listType: l,
|
|
2412
|
+
canIndent: u < 8,
|
|
2399
2413
|
canOutdent: u > 0 || l !== !1,
|
|
2400
2414
|
headingTag: f === "h1" || f === "h2" || f === "h3" ? f : !1,
|
|
2401
2415
|
hasRangeSelection: !0,
|
|
2402
2416
|
hasEditorText: t
|
|
2403
2417
|
};
|
|
2404
|
-
},
|
|
2418
|
+
}, gi = (e, t) => {
|
|
2405
2419
|
e.isEditable() || e.setEditable(!0), e.update(() => {
|
|
2406
|
-
|
|
2420
|
+
Kt(), t(hi(!0));
|
|
2407
2421
|
}), e.focus(void 0, { defaultSelection: "rootStart" });
|
|
2408
|
-
},
|
|
2409
|
-
let t =
|
|
2410
|
-
return
|
|
2422
|
+
}, _i = (e) => {
|
|
2423
|
+
let t = pi;
|
|
2424
|
+
return gi(e, (e) => {
|
|
2411
2425
|
t = e;
|
|
2412
2426
|
}), t;
|
|
2413
|
-
},
|
|
2427
|
+
}, vi = (...e) => e.filter(Boolean).join(" "), yi = (e) => e.buttons.map((e) => ({
|
|
2414
2428
|
name: typeof e == "string" ? e : e.name,
|
|
2415
2429
|
disabled: typeof e != "string" && !!e.props?.disabled
|
|
2416
|
-
})), Q = 24,
|
|
2430
|
+
})), Q = 24, bi = 20, $ = ({ active: e, disabled: t, expanded: n, label: r, select: i, selectAlign: a, onClick: o, children: s }) => /* @__PURE__ */ p("button", {
|
|
2417
2431
|
type: "button",
|
|
2418
|
-
className:
|
|
2432
|
+
className: vi(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"]),
|
|
2419
2433
|
"aria-label": r,
|
|
2420
2434
|
"aria-pressed": e,
|
|
2421
2435
|
"aria-expanded": i ? !!n : void 0,
|
|
@@ -2423,11 +2437,11 @@ var Zn = (e) => {
|
|
|
2423
2437
|
onMouseDown: (e) => e.preventDefault(),
|
|
2424
2438
|
onClick: o,
|
|
2425
2439
|
children: s
|
|
2426
|
-
}),
|
|
2440
|
+
}), xi = ({ open: e }) => /* @__PURE__ */ p(n, {
|
|
2427
2441
|
name: "arrow-down",
|
|
2428
|
-
size:
|
|
2429
|
-
className:
|
|
2430
|
-
}),
|
|
2442
|
+
size: bi,
|
|
2443
|
+
className: vi(V["bsy-mobile-editor__tool-caret"], e && V["bsy-mobile-editor__tool-caret--open"])
|
|
2444
|
+
}), Si = ({ config: t, formats: r, colorValues: i, openSheet: a, onOpenSheet: o, onOpenLink: c }) => {
|
|
2431
2445
|
let [l] = z(), { t: d } = e(), f = u(null), h = u(null), g = u(null), _ = () => {
|
|
2432
2446
|
let e = f.current, t = h.current, n = g.current;
|
|
2433
2447
|
if (!e || !t || !n) return;
|
|
@@ -2503,7 +2517,7 @@ var Zn = (e) => {
|
|
|
2503
2517
|
})
|
|
2504
2518
|
}, e);
|
|
2505
2519
|
case "indent": return /* @__PURE__ */ p($, {
|
|
2506
|
-
disabled: t,
|
|
2520
|
+
disabled: t || r.hasRangeSelection && !r.canIndent,
|
|
2507
2521
|
label: d("editor.indent"),
|
|
2508
2522
|
onClick: () => {
|
|
2509
2523
|
H(l), l.dispatchCommand(Re, void 0);
|
|
@@ -2518,7 +2532,7 @@ var Zn = (e) => {
|
|
|
2518
2532
|
disabled: t,
|
|
2519
2533
|
label: d("editor.bulletList"),
|
|
2520
2534
|
onClick: () => {
|
|
2521
|
-
let e =
|
|
2535
|
+
let e = _i(l);
|
|
2522
2536
|
l.dispatchCommand(e.listType === "bullet" ? O : T, void 0);
|
|
2523
2537
|
},
|
|
2524
2538
|
children: /* @__PURE__ */ p(n, {
|
|
@@ -2531,7 +2545,7 @@ var Zn = (e) => {
|
|
|
2531
2545
|
disabled: t,
|
|
2532
2546
|
label: d("editor.numberList"),
|
|
2533
2547
|
onClick: () => {
|
|
2534
|
-
let e =
|
|
2548
|
+
let e = _i(l);
|
|
2535
2549
|
l.dispatchCommand(e.listType === "number" ? O : w, void 0);
|
|
2536
2550
|
},
|
|
2537
2551
|
children: /* @__PURE__ */ p(n, {
|
|
@@ -2550,7 +2564,7 @@ var Zn = (e) => {
|
|
|
2550
2564
|
children: [/* @__PURE__ */ p(n, {
|
|
2551
2565
|
name: r.align === "center" ? "paragraphmiddle" : r.align === "right" ? "paragraphright" : "paragraph",
|
|
2552
2566
|
size: Q
|
|
2553
|
-
}), /* @__PURE__ */ p(
|
|
2567
|
+
}), /* @__PURE__ */ p(xi, { open: a === "align" })]
|
|
2554
2568
|
}, e);
|
|
2555
2569
|
case "heading": return /* @__PURE__ */ m($, {
|
|
2556
2570
|
select: !0,
|
|
@@ -2563,7 +2577,7 @@ var Zn = (e) => {
|
|
|
2563
2577
|
children: [/* @__PURE__ */ p("span", {
|
|
2564
2578
|
className: V["bsy-mobile-editor__tool-text"],
|
|
2565
2579
|
children: r.headingTag ? r.headingTag.toUpperCase() : d("editor.paragraph")
|
|
2566
|
-
}), /* @__PURE__ */ p(
|
|
2580
|
+
}), /* @__PURE__ */ p(xi, { open: a === "heading" })]
|
|
2567
2581
|
}, e);
|
|
2568
2582
|
case "fontSize": return /* @__PURE__ */ p($, {
|
|
2569
2583
|
active: a === "fontSize",
|
|
@@ -2580,7 +2594,7 @@ var Zn = (e) => {
|
|
|
2580
2594
|
disabled: t,
|
|
2581
2595
|
label: d("editor.fontColor"),
|
|
2582
2596
|
onClick: () => o("fontColor"),
|
|
2583
|
-
children: /* @__PURE__ */ p(
|
|
2597
|
+
children: /* @__PURE__ */ p(fi, {
|
|
2584
2598
|
variant: "fontColor",
|
|
2585
2599
|
barColor: i.fontColor,
|
|
2586
2600
|
size: Q
|
|
@@ -2591,7 +2605,7 @@ var Zn = (e) => {
|
|
|
2591
2605
|
disabled: t,
|
|
2592
2606
|
label: d("editor.fill"),
|
|
2593
2607
|
onClick: () => o("fill"),
|
|
2594
|
-
children: /* @__PURE__ */ p(
|
|
2608
|
+
children: /* @__PURE__ */ p(fi, {
|
|
2595
2609
|
variant: "fill",
|
|
2596
2610
|
barColor: i.fill,
|
|
2597
2611
|
size: Q
|
|
@@ -2607,7 +2621,7 @@ var Zn = (e) => {
|
|
|
2607
2621
|
children: [/* @__PURE__ */ p(n, {
|
|
2608
2622
|
name: "picture",
|
|
2609
2623
|
size: Q
|
|
2610
|
-
}), /* @__PURE__ */ p(
|
|
2624
|
+
}), /* @__PURE__ */ p(xi, { open: a === "picture" })]
|
|
2611
2625
|
}, e);
|
|
2612
2626
|
case "link": return /* @__PURE__ */ p($, {
|
|
2613
2627
|
disabled: t,
|
|
@@ -2628,13 +2642,13 @@ var Zn = (e) => {
|
|
|
2628
2642
|
label: d("editor.ai"),
|
|
2629
2643
|
onClick: () => o("ai"),
|
|
2630
2644
|
children: [/* @__PURE__ */ p("img", {
|
|
2631
|
-
src:
|
|
2645
|
+
src: Sr,
|
|
2632
2646
|
alt: "",
|
|
2633
2647
|
width: Q,
|
|
2634
2648
|
height: Q,
|
|
2635
2649
|
className: V["bsy-mobile-editor__ai-icon"],
|
|
2636
2650
|
draggable: !1
|
|
2637
|
-
}), /* @__PURE__ */ p(
|
|
2651
|
+
}), /* @__PURE__ */ p(xi, { open: n })]
|
|
2638
2652
|
}, e);
|
|
2639
2653
|
}
|
|
2640
2654
|
default: return null;
|
|
@@ -2647,7 +2661,7 @@ var Zn = (e) => {
|
|
|
2647
2661
|
className: V["bsy-mobile-editor__toolbar-scroller"],
|
|
2648
2662
|
onScroll: _,
|
|
2649
2663
|
children: t.map((e, t) => {
|
|
2650
|
-
let n =
|
|
2664
|
+
let n = yi(e);
|
|
2651
2665
|
return n.length ? /* @__PURE__ */ m("div", {
|
|
2652
2666
|
className: V["bsy-mobile-editor__toolbar-group"],
|
|
2653
2667
|
children: [t > 0 ? /* @__PURE__ */ p("span", { className: V["bsy-mobile-editor__toolbar-divider"] }) : null, n.map(v)]
|
|
@@ -2664,19 +2678,19 @@ var Zn = (e) => {
|
|
|
2664
2678
|
})
|
|
2665
2679
|
})]
|
|
2666
2680
|
});
|
|
2667
|
-
},
|
|
2681
|
+
}, Ci = () => {
|
|
2668
2682
|
let [e] = z(), [t, n] = d(!1);
|
|
2669
|
-
return s(() =>
|
|
2670
|
-
},
|
|
2671
|
-
let [e] = z(), t =
|
|
2683
|
+
return s(() => at(e.registerCommand(Pe, () => (n(!0), !1), je), e.registerCommand(ke, () => (n(!1), !1), je)), [e]), t;
|
|
2684
|
+
}, wi = () => {
|
|
2685
|
+
let [e] = z(), t = Ci(), [n, r] = d(pi);
|
|
2672
2686
|
return s(() => (e.getEditorState().read(() => {
|
|
2673
|
-
r(
|
|
2687
|
+
r(hi(t));
|
|
2674
2688
|
}, { editor: e }), e.registerUpdateListener(({ editorState: n }) => {
|
|
2675
2689
|
n.read(() => {
|
|
2676
|
-
r(
|
|
2690
|
+
r(hi(t));
|
|
2677
2691
|
}, { editor: e });
|
|
2678
2692
|
})), [e, t]), n;
|
|
2679
|
-
},
|
|
2693
|
+
}, Ti = "plaintext", Ei = "github-light", Di = new Set([
|
|
2680
2694
|
"plaintext",
|
|
2681
2695
|
"css",
|
|
2682
2696
|
"html",
|
|
@@ -2698,7 +2712,7 @@ var Zn = (e) => {
|
|
|
2698
2712
|
"bash",
|
|
2699
2713
|
"lua",
|
|
2700
2714
|
"markdown"
|
|
2701
|
-
]),
|
|
2715
|
+
]), Oi = (e) => e && Di.has(e) ? e : Ti, ki = {
|
|
2702
2716
|
css: () => import("@shikijs/langs/css"),
|
|
2703
2717
|
html: () => import("@shikijs/langs/html"),
|
|
2704
2718
|
xml: () => import("@shikijs/langs/xml"),
|
|
@@ -2719,58 +2733,58 @@ var Zn = (e) => {
|
|
|
2719
2733
|
bash: () => import("@shikijs/langs/shellscript"),
|
|
2720
2734
|
lua: () => import("@shikijs/langs/lua"),
|
|
2721
2735
|
markdown: () => import("@shikijs/langs/markdown")
|
|
2722
|
-
},
|
|
2736
|
+
}, Ai = (e) => e === "bash" ? "shellscript" : e, ji = (e) => e in ki, Mi = null, Ni = null, Pi = /* @__PURE__ */ new Map(), Fi = () => (Mi ||= Promise.all([import("@shikijs/core"), import("@shikijs/engine-javascript")]).then(([{ createHighlighterCoreSync: e }, { createJavaScriptRegexEngine: t }]) => e({
|
|
2723
2737
|
engine: t(),
|
|
2724
2738
|
langs: [],
|
|
2725
2739
|
themes: []
|
|
2726
2740
|
})).catch((e) => {
|
|
2727
|
-
throw
|
|
2728
|
-
}),
|
|
2729
|
-
let t =
|
|
2730
|
-
return t || (t =
|
|
2731
|
-
let n =
|
|
2741
|
+
throw Mi = null, e;
|
|
2742
|
+
}), Mi), Ii = (e, t) => ji(t) && e.getLoadedLanguages().includes(Ai(t)), Li = (e) => {
|
|
2743
|
+
let t = Pi.get(e);
|
|
2744
|
+
return t || (t = Fi().then(async (t) => {
|
|
2745
|
+
let n = Ai(e);
|
|
2732
2746
|
if (!t.getLoadedLanguages().includes(n)) {
|
|
2733
|
-
let n = await
|
|
2747
|
+
let n = await ki[e]();
|
|
2734
2748
|
await t.loadLanguage(n.default);
|
|
2735
2749
|
}
|
|
2736
2750
|
return t;
|
|
2737
2751
|
}).catch((t) => {
|
|
2738
|
-
throw
|
|
2739
|
-
}),
|
|
2740
|
-
},
|
|
2752
|
+
throw Pi.delete(e), t;
|
|
2753
|
+
}), Pi.set(e, t)), t;
|
|
2754
|
+
}, Ri = () => (Ni ||= Fi().then(async (e) => {
|
|
2741
2755
|
if (!e.getLoadedThemes().includes("github-light")) {
|
|
2742
2756
|
let t = await import("@shikijs/themes/github-light");
|
|
2743
2757
|
await e.loadTheme(t.default);
|
|
2744
2758
|
}
|
|
2745
2759
|
return e;
|
|
2746
2760
|
}).catch((e) => {
|
|
2747
|
-
throw
|
|
2748
|
-
}),
|
|
2761
|
+
throw Ni = null, e;
|
|
2762
|
+
}), Ni), zi = (e, t, n) => {
|
|
2749
2763
|
let r = e.getTextContent();
|
|
2750
|
-
if (e.getStyle() && e.setStyle(""), !n || !
|
|
2764
|
+
if (e.getStyle() && e.setStyle(""), !n || !Ii(n, t)) return ee(r);
|
|
2751
2765
|
let i = n.codeToTokens(r, {
|
|
2752
|
-
lang:
|
|
2753
|
-
theme:
|
|
2766
|
+
lang: Ai(t),
|
|
2767
|
+
theme: Ei
|
|
2754
2768
|
}).tokens, a = [];
|
|
2755
2769
|
return i.forEach((e, t) => {
|
|
2756
|
-
t && a.push(
|
|
2770
|
+
t && a.push(ge()), e.forEach((e) => {
|
|
2757
2771
|
e.content.split(" ").forEach((t, n) => {
|
|
2758
|
-
if (n && a.push(
|
|
2772
|
+
if (n && a.push(_e()), !t) return;
|
|
2759
2773
|
let r = k(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}` : "";
|
|
2760
2774
|
i && r.setStyle(i), a.push(r);
|
|
2761
2775
|
});
|
|
2762
2776
|
});
|
|
2763
2777
|
}), a;
|
|
2764
|
-
},
|
|
2765
|
-
let n =
|
|
2766
|
-
if (!
|
|
2778
|
+
}, Bi = (e, t) => {
|
|
2779
|
+
let n = ye(e);
|
|
2780
|
+
if (!j(n) || !n.isAttached()) return;
|
|
2767
2781
|
let r = L();
|
|
2768
2782
|
if (!R(r)) {
|
|
2769
2783
|
t();
|
|
2770
2784
|
return;
|
|
2771
2785
|
}
|
|
2772
2786
|
let { anchor: i } = r;
|
|
2773
|
-
if (B(i.getNode(),
|
|
2787
|
+
if (B(i.getNode(), j) !== n) {
|
|
2774
2788
|
t();
|
|
2775
2789
|
return;
|
|
2776
2790
|
}
|
|
@@ -2790,27 +2804,27 @@ var Zn = (e) => {
|
|
|
2790
2804
|
return !1;
|
|
2791
2805
|
});
|
|
2792
2806
|
}
|
|
2793
|
-
},
|
|
2807
|
+
}, Vi = (e, t) => A(e) && A(t) && e.__text === t.__text && e.__highlightType === t.__highlightType && e.__style === t.__style || we(e) && we(t) || Se(e) && Se(t), Hi = (e, t) => {
|
|
2794
2808
|
let n = 0;
|
|
2795
|
-
for (; n < e.length &&
|
|
2809
|
+
for (; n < e.length && Vi(e[n], t[n]);) n++;
|
|
2796
2810
|
let r = 0, i = Math.min(e.length, t.length) - n;
|
|
2797
|
-
for (; r < i &&
|
|
2811
|
+
for (; r < i && Vi(e[e.length - r - 1], t[t.length - r - 1]);) r++;
|
|
2798
2812
|
return {
|
|
2799
2813
|
from: n,
|
|
2800
2814
|
to: e.length - r,
|
|
2801
2815
|
replacement: t.slice(n, t.length - r)
|
|
2802
2816
|
};
|
|
2803
|
-
},
|
|
2804
|
-
let a = i.getKey(), o =
|
|
2817
|
+
}, Ui = (e, t, n, r, i) => {
|
|
2818
|
+
let a = i.getKey(), o = Oi(i.getLanguage());
|
|
2805
2819
|
if (i.getLanguage() !== o && i.setLanguage(o), o === "plaintext") i.getIsSyntaxHighlightSupported() && i.setIsSyntaxHighlightSupported(!1);
|
|
2806
2820
|
else {
|
|
2807
|
-
i.getTheme() !== "github-light" && i.setTheme(
|
|
2808
|
-
let s = t ? t.getLoadedThemes().includes("github-light") ?
|
|
2821
|
+
i.getTheme() !== "github-light" && i.setTheme(Ei);
|
|
2822
|
+
let s = t ? t.getLoadedThemes().includes("github-light") ? ji(o) && !Ii(t, o) ? Li(o) : null : Ri() : Fi();
|
|
2809
2823
|
if (s) {
|
|
2810
2824
|
i.getIsSyntaxHighlightSupported() && i.setIsSyntaxHighlightSupported(!1), n.pendingKeys.add(a), n.loading !== s && (n.loading = s, s.then((t) => {
|
|
2811
2825
|
r(t);
|
|
2812
2826
|
let i = [...n.pendingKeys];
|
|
2813
|
-
n.pendingKeys.clear(), n.loading = null, e.update(() => i.forEach((e) =>
|
|
2827
|
+
n.pendingKeys.clear(), n.loading = null, e.update(() => i.forEach((e) => ye(e)?.markDirty()), { tag: Le });
|
|
2814
2828
|
}, () => {
|
|
2815
2829
|
n.pendingKeys.clear(), n.loading = null;
|
|
2816
2830
|
}));
|
|
@@ -2820,46 +2834,46 @@ var Zn = (e) => {
|
|
|
2820
2834
|
}
|
|
2821
2835
|
n.nodesCurrentlyHighlighting.has(a) || (n.nodesCurrentlyHighlighting.add(a), n.didTransform || (n.didTransform = !0, De(() => {
|
|
2822
2836
|
n.didTransform = !1, n.nodesCurrentlyHighlighting.clear();
|
|
2823
|
-
})),
|
|
2824
|
-
let e =
|
|
2825
|
-
if (!
|
|
2826
|
-
let n =
|
|
2837
|
+
})), Bi(a, () => {
|
|
2838
|
+
let e = ye(a);
|
|
2839
|
+
if (!j(e) || !e.isAttached()) return !1;
|
|
2840
|
+
let n = zi(e, Oi(e.getLanguage()), t), { from: r, to: i, replacement: o } = Hi(e.getChildren(), n);
|
|
2827
2841
|
return r === i && o.length === 0 ? !1 : (e.splice(r, i - r, o), !0);
|
|
2828
2842
|
}));
|
|
2829
|
-
},
|
|
2843
|
+
}, Wi = () => {
|
|
2830
2844
|
let [e] = z();
|
|
2831
2845
|
return s(() => {
|
|
2832
|
-
if (!e.hasNodes([
|
|
2846
|
+
if (!e.hasNodes([N, M])) throw Error("CodeHighlightPlugin: code nodes are not registered");
|
|
2833
2847
|
let t = null, n = {
|
|
2834
2848
|
didTransform: !1,
|
|
2835
2849
|
nodesCurrentlyHighlighting: /* @__PURE__ */ new Set(),
|
|
2836
2850
|
pendingKeys: /* @__PURE__ */ new Set(),
|
|
2837
2851
|
loading: null
|
|
2838
|
-
}, r = (r) =>
|
|
2852
|
+
}, r = (r) => Ui(e, t, n, (e) => {
|
|
2839
2853
|
t = e;
|
|
2840
2854
|
}, r), i = (e) => {
|
|
2841
2855
|
let t = e.getParent();
|
|
2842
|
-
|
|
2856
|
+
j(t) ? r(t) : A(e) && e.replace(ve(e.__text));
|
|
2843
2857
|
};
|
|
2844
|
-
return
|
|
2858
|
+
return qe(te(e), e.registerNodeTransform(N, r), e.registerNodeTransform(Ge, i), e.registerNodeTransform(M, i));
|
|
2845
2859
|
}, [e]), null;
|
|
2846
|
-
},
|
|
2860
|
+
}, Gi = () => {
|
|
2847
2861
|
let [e] = z();
|
|
2848
|
-
return s(() => (
|
|
2862
|
+
return s(() => (me(e, !0), at(fe(e), pe(e, !1), de(e), e.registerNodeTransform(ce, (e) => {
|
|
2849
2863
|
e.getBackgroundColor() !== null && e.setBackgroundColor(null);
|
|
2850
2864
|
}), e.registerCommand(Be, (e) => {
|
|
2851
2865
|
let t = L();
|
|
2852
2866
|
if (!R(t) || !t.isCollapsed()) return !1;
|
|
2853
|
-
let n =
|
|
2867
|
+
let n = ae(t.anchor.getNode());
|
|
2854
2868
|
if (n === null) return !1;
|
|
2855
2869
|
let r = e.shiftKey ? "previous" : "next", i = r === "next" ? "getNextSibling" : "getPreviousSibling", a = r === "next" ? "getFirstChild" : "getLastChild", o = n[i](), s = null;
|
|
2856
|
-
if (
|
|
2870
|
+
if (oe(o)) s = o;
|
|
2857
2871
|
else {
|
|
2858
|
-
let e = B(n,
|
|
2872
|
+
let e = B(n, se);
|
|
2859
2873
|
if (e !== null) for (let t = e[i](); t !== null; t = t[i]()) {
|
|
2860
|
-
if (!
|
|
2874
|
+
if (!se(t)) continue;
|
|
2861
2875
|
let e = t[a]();
|
|
2862
|
-
if (
|
|
2876
|
+
if (oe(e)) {
|
|
2863
2877
|
s = e;
|
|
2864
2878
|
break;
|
|
2865
2879
|
}
|
|
@@ -2869,13 +2883,32 @@ var Zn = (e) => {
|
|
|
2869
2883
|
let e = s.getFirstDescendant();
|
|
2870
2884
|
e ? e.selectStart() : s.selectStart();
|
|
2871
2885
|
} else {
|
|
2872
|
-
let e = B(n,
|
|
2886
|
+
let e = B(n, P);
|
|
2873
2887
|
e && (r === "next" ? e.selectNext() : e.selectPrevious());
|
|
2874
2888
|
}
|
|
2875
2889
|
return !0;
|
|
2876
2890
|
}, Ae))), [e]), null;
|
|
2877
|
-
},
|
|
2878
|
-
let
|
|
2891
|
+
}, Ki = (e) => {
|
|
2892
|
+
let t = e.getIndent();
|
|
2893
|
+
t < 8 && e.setIndent(t + 1);
|
|
2894
|
+
}, qi = (e) => {
|
|
2895
|
+
let t = e.getIndent();
|
|
2896
|
+
if (t > 8) {
|
|
2897
|
+
e.setIndent(8);
|
|
2898
|
+
return;
|
|
2899
|
+
}
|
|
2900
|
+
t < 0 && e.setIndent(0);
|
|
2901
|
+
};
|
|
2902
|
+
//#endregion
|
|
2903
|
+
//#region src/components/Editor/plugins/IndentLimitPlugin.tsx
|
|
2904
|
+
function Ji() {
|
|
2905
|
+
let [e] = z();
|
|
2906
|
+
return s(() => at(e.registerCommand(Re, () => it(Ki), Ae), e.registerNodeTransform(We, qi), e.registerNodeTransform(ie, qi), e.registerNodeTransform(E, qi)), [e]), null;
|
|
2907
|
+
}
|
|
2908
|
+
//#endregion
|
|
2909
|
+
//#region src/components/Editor/EditorCore.tsx
|
|
2910
|
+
var Yi = ({ value: n, onChange: r, open: i, onOpenChange: a, toolbar: o, upload: c, ai: l }) => {
|
|
2911
|
+
let [f] = z(), { t: h } = e(), g = wi(), [_, v] = d(!1), y = i ?? _, b = (e) => {
|
|
2879
2912
|
a?.(e), i === void 0 && v(e);
|
|
2880
2913
|
}, [x, S] = d(null), [C, w] = d(() => ({
|
|
2881
2914
|
fontColor: g.fontColor,
|
|
@@ -2884,24 +2917,24 @@ var Zn = (e) => {
|
|
|
2884
2917
|
f.getEditorState().read(() => {
|
|
2885
2918
|
O.current = L()?.clone() ?? null;
|
|
2886
2919
|
});
|
|
2887
|
-
}, { linkForm: A, openLink:
|
|
2920
|
+
}, { linkForm: A, openLink: j, confirmLink: ee, closeLink: M } = fr({
|
|
2888
2921
|
editor: f,
|
|
2889
2922
|
savedSelectionRef: O,
|
|
2890
2923
|
captureSelection: k
|
|
2891
|
-
}), [
|
|
2924
|
+
}), [N] = d(() => /* @__PURE__ */ new Map()), { fileInputRef: te, uploadProgress: ne, insertImage: re, onFileChange: ie, abortUpload: ae } = dr({
|
|
2892
2925
|
editor: f,
|
|
2893
2926
|
upload: c,
|
|
2894
2927
|
savedSelectionRef: O,
|
|
2895
|
-
attachmentsBySrc:
|
|
2896
|
-
}),
|
|
2928
|
+
attachmentsBySrc: N
|
|
2929
|
+
}), oe = pr({
|
|
2897
2930
|
editor: f,
|
|
2898
2931
|
value: n,
|
|
2899
2932
|
onChange: r,
|
|
2900
|
-
attachmentsBySrc:
|
|
2901
|
-
}),
|
|
2933
|
+
attachmentsBySrc: N
|
|
2934
|
+
}), P = er({
|
|
2902
2935
|
editor: f,
|
|
2903
2936
|
ai: l
|
|
2904
|
-
}), [
|
|
2937
|
+
}), [se, ce] = d(0), le = o?.config ?? ht;
|
|
2905
2938
|
s(() => {
|
|
2906
2939
|
!g.hasRangeSelection || !g.hasEditorText || w({
|
|
2907
2940
|
fontColor: g.fontColor,
|
|
@@ -2913,43 +2946,43 @@ var Zn = (e) => {
|
|
|
2913
2946
|
g.hasEditorText,
|
|
2914
2947
|
g.hasRangeSelection
|
|
2915
2948
|
]);
|
|
2916
|
-
let
|
|
2917
|
-
|
|
2949
|
+
let ue = () => {
|
|
2950
|
+
ae(), P.close(), S(null), M(), D(!1), b(!1);
|
|
2918
2951
|
};
|
|
2919
2952
|
s(() => {
|
|
2920
2953
|
if (!y) return;
|
|
2921
2954
|
let e = window.visualViewport;
|
|
2922
2955
|
if (!e) return;
|
|
2923
2956
|
let t = () => {
|
|
2924
|
-
|
|
2957
|
+
ce(Math.max(0, window.innerHeight - e.height - e.offsetTop));
|
|
2925
2958
|
};
|
|
2926
2959
|
return e.addEventListener("resize", t), e.addEventListener("scroll", t), t(), () => {
|
|
2927
2960
|
e.removeEventListener("resize", t), e.removeEventListener("scroll", t);
|
|
2928
2961
|
};
|
|
2929
2962
|
}, [y]), s(() => {
|
|
2930
|
-
y ||
|
|
2931
|
-
}, [
|
|
2963
|
+
y || ae();
|
|
2964
|
+
}, [ae, y]), s(() => {
|
|
2932
2965
|
if (y) return f.setEditable(!0), f.registerRootListener((e) => {
|
|
2933
2966
|
e && f.focus(void 0, { defaultSelection: "rootEnd" });
|
|
2934
2967
|
});
|
|
2935
2968
|
}, [y, f]);
|
|
2936
|
-
let
|
|
2937
|
-
T.current = !0, S(null),
|
|
2938
|
-
},
|
|
2939
|
-
x === "aiPreset" && (T.current = !0), S(null),
|
|
2969
|
+
let de = () => {
|
|
2970
|
+
T.current = !0, S(null), P.startTypeset();
|
|
2971
|
+
}, fe = (e) => {
|
|
2972
|
+
x === "aiPreset" && (T.current = !0), S(null), P.startPolish(e);
|
|
2940
2973
|
};
|
|
2941
2974
|
return /* @__PURE__ */ p(t, {
|
|
2942
2975
|
open: y,
|
|
2943
|
-
onClose:
|
|
2976
|
+
onClose: ue,
|
|
2944
2977
|
position: "bottom",
|
|
2945
2978
|
closeOnClickOverlay: !0,
|
|
2946
|
-
children: /* @__PURE__ */ p(
|
|
2947
|
-
value:
|
|
2979
|
+
children: /* @__PURE__ */ p(tr.Provider, {
|
|
2980
|
+
value: ne,
|
|
2948
2981
|
children: /* @__PURE__ */ m("div", {
|
|
2949
2982
|
className: V["bsy-mobile-editor"],
|
|
2950
2983
|
style: {
|
|
2951
2984
|
height: 300,
|
|
2952
|
-
transform:
|
|
2985
|
+
transform: se ? `translate3d(0, -${se}px, 0)` : void 0
|
|
2953
2986
|
},
|
|
2954
2987
|
children: [
|
|
2955
2988
|
/* @__PURE__ */ p("div", {
|
|
@@ -2962,13 +2995,13 @@ var Zn = (e) => {
|
|
|
2962
2995
|
/* @__PURE__ */ p("div", {
|
|
2963
2996
|
className: V["bsy-mobile-editor__content"],
|
|
2964
2997
|
style: { height: 200 },
|
|
2965
|
-
children: /* @__PURE__ */ p(
|
|
2966
|
-
contentEditable: /* @__PURE__ */ p(
|
|
2967
|
-
ErrorBoundary:
|
|
2998
|
+
children: /* @__PURE__ */ p($e, {
|
|
2999
|
+
contentEditable: /* @__PURE__ */ p(Je, { className: V["bsy-mobile-editor__editable"] }),
|
|
3000
|
+
ErrorBoundary: et
|
|
2968
3001
|
})
|
|
2969
3002
|
}),
|
|
2970
|
-
|
|
2971
|
-
config:
|
|
3003
|
+
le.length > 0 ? /* @__PURE__ */ p(Si, {
|
|
3004
|
+
config: le,
|
|
2972
3005
|
formats: g,
|
|
2973
3006
|
colorValues: C,
|
|
2974
3007
|
openSheet: x,
|
|
@@ -2981,29 +3014,30 @@ var Zn = (e) => {
|
|
|
2981
3014
|
};
|
|
2982
3015
|
})), S(e);
|
|
2983
3016
|
},
|
|
2984
|
-
onOpenLink:
|
|
3017
|
+
onOpenLink: j
|
|
2985
3018
|
}) : null,
|
|
2986
|
-
/* @__PURE__ */ p(Je, {}),
|
|
2987
|
-
/* @__PURE__ */ p(Xe, {}),
|
|
2988
3019
|
/* @__PURE__ */ p(Ye, {}),
|
|
2989
|
-
/* @__PURE__ */ p(
|
|
2990
|
-
/* @__PURE__ */ p(
|
|
3020
|
+
/* @__PURE__ */ p(Ze, {}),
|
|
3021
|
+
/* @__PURE__ */ p(Xe, {}),
|
|
2991
3022
|
/* @__PURE__ */ p(hr, {}),
|
|
3023
|
+
/* @__PURE__ */ p(xr, {}),
|
|
2992
3024
|
/* @__PURE__ */ p(_r, {}),
|
|
2993
|
-
/* @__PURE__ */ p(
|
|
2994
|
-
/* @__PURE__ */ p(
|
|
2995
|
-
/* @__PURE__ */ p(
|
|
2996
|
-
|
|
3025
|
+
/* @__PURE__ */ p(yr, {}),
|
|
3026
|
+
/* @__PURE__ */ p(Wi, {}),
|
|
3027
|
+
/* @__PURE__ */ p(Gi, {}),
|
|
3028
|
+
/* @__PURE__ */ p(Ji, {}),
|
|
3029
|
+
/* @__PURE__ */ p(Qe, {
|
|
3030
|
+
onChange: oe,
|
|
2997
3031
|
ignoreSelectionChange: !0
|
|
2998
3032
|
}),
|
|
2999
3033
|
/* @__PURE__ */ p("input", {
|
|
3000
|
-
ref:
|
|
3034
|
+
ref: te,
|
|
3001
3035
|
type: "file",
|
|
3002
|
-
accept:
|
|
3036
|
+
accept: _t,
|
|
3003
3037
|
hidden: !0,
|
|
3004
|
-
onChange:
|
|
3038
|
+
onChange: ie
|
|
3005
3039
|
}),
|
|
3006
|
-
/* @__PURE__ */ p(
|
|
3040
|
+
/* @__PURE__ */ p(Hr, {
|
|
3007
3041
|
sheet: x,
|
|
3008
3042
|
onClose: () => {
|
|
3009
3043
|
if (T.current) {
|
|
@@ -3012,11 +3046,11 @@ var Zn = (e) => {
|
|
|
3012
3046
|
}
|
|
3013
3047
|
S(null), window.requestAnimationFrame(() => f.focus());
|
|
3014
3048
|
},
|
|
3015
|
-
onTypeset:
|
|
3049
|
+
onTypeset: de,
|
|
3016
3050
|
onPolishMenu: () => {
|
|
3017
3051
|
T.current = !0, S("aiPreset");
|
|
3018
3052
|
},
|
|
3019
|
-
onPickPreset:
|
|
3053
|
+
onPickPreset: fe,
|
|
3020
3054
|
savedSelectionRef: O,
|
|
3021
3055
|
committedColors: C,
|
|
3022
3056
|
onColorCommit: (e, t) => w((n) => ({
|
|
@@ -3025,7 +3059,7 @@ var Zn = (e) => {
|
|
|
3025
3059
|
})),
|
|
3026
3060
|
onPicture: (e) => {
|
|
3027
3061
|
if (k(), e === "upload") {
|
|
3028
|
-
|
|
3062
|
+
te.current?.click();
|
|
3029
3063
|
return;
|
|
3030
3064
|
}
|
|
3031
3065
|
T.current = !0, S(null), D(!0);
|
|
@@ -3033,38 +3067,38 @@ var Zn = (e) => {
|
|
|
3033
3067
|
canTypeset: !!l?.typeset,
|
|
3034
3068
|
canPolish: !!l?.polish
|
|
3035
3069
|
}),
|
|
3036
|
-
/* @__PURE__ */ p(
|
|
3070
|
+
/* @__PURE__ */ p(Wr, {
|
|
3037
3071
|
open: A !== null,
|
|
3038
3072
|
seed: A,
|
|
3039
|
-
onClose:
|
|
3040
|
-
onConfirm:
|
|
3073
|
+
onClose: M,
|
|
3074
|
+
onConfirm: ee
|
|
3041
3075
|
}),
|
|
3042
|
-
/* @__PURE__ */ p(
|
|
3076
|
+
/* @__PURE__ */ p(Kr, {
|
|
3043
3077
|
open: E,
|
|
3044
3078
|
onClose: () => D(!1),
|
|
3045
3079
|
onConfirm: (e) => {
|
|
3046
|
-
|
|
3080
|
+
re(e, "", e), D(!1);
|
|
3047
3081
|
}
|
|
3048
3082
|
}),
|
|
3049
|
-
/* @__PURE__ */ p(
|
|
3050
|
-
open:
|
|
3051
|
-
mode:
|
|
3052
|
-
originalHtml:
|
|
3053
|
-
codeBlocks:
|
|
3083
|
+
/* @__PURE__ */ p(ii, {
|
|
3084
|
+
open: P.mode !== null,
|
|
3085
|
+
mode: P.mode,
|
|
3086
|
+
originalHtml: P.snapshot.html,
|
|
3087
|
+
codeBlocks: P.snapshot.codeBlocks,
|
|
3054
3088
|
ai: l,
|
|
3055
|
-
polishPreset:
|
|
3056
|
-
onClose:
|
|
3057
|
-
onApply:
|
|
3058
|
-
onPickPreset:
|
|
3089
|
+
polishPreset: P.preset,
|
|
3090
|
+
onClose: P.close,
|
|
3091
|
+
onApply: P.apply,
|
|
3092
|
+
onPickPreset: fe
|
|
3059
3093
|
})
|
|
3060
3094
|
]
|
|
3061
3095
|
})
|
|
3062
3096
|
})
|
|
3063
3097
|
});
|
|
3064
|
-
},
|
|
3098
|
+
}, Xi = "1px solid #d9d9d9", Zi = { export: new Map([[ce, (e, t) => {
|
|
3065
3099
|
let n = t.exportDOM(e);
|
|
3066
|
-
return
|
|
3067
|
-
}]]) },
|
|
3100
|
+
return Ke(n.element) && (n.element.style.border = Xi), n;
|
|
3101
|
+
}]]) }, Qi = class e extends x {
|
|
3068
3102
|
constructor(e = "", t = {}, n) {
|
|
3069
3103
|
super(e, t, n);
|
|
3070
3104
|
}
|
|
@@ -3079,12 +3113,12 @@ var Zn = (e) => {
|
|
|
3079
3113
|
}, t.__key);
|
|
3080
3114
|
}
|
|
3081
3115
|
static importJSON(e) {
|
|
3082
|
-
return
|
|
3116
|
+
return $i().updateFromJSON(e);
|
|
3083
3117
|
}
|
|
3084
3118
|
sanitizeUrl(e) {
|
|
3085
3119
|
return e.startsWith("@") ? e : super.sanitizeUrl(e);
|
|
3086
3120
|
}
|
|
3087
|
-
},
|
|
3121
|
+
}, $i = (e = "", t = {}) => he(new Qi(e, t)), ea = {
|
|
3088
3122
|
namespace: "bsyLexicalEditor",
|
|
3089
3123
|
onError: (e) => {
|
|
3090
3124
|
console.error("Lexical error", e);
|
|
@@ -3117,39 +3151,39 @@ var Zn = (e) => {
|
|
|
3117
3151
|
tableRow: "editor-table-row",
|
|
3118
3152
|
tableScrollableWrapper: "editor-table-scrollable-wrapper"
|
|
3119
3153
|
},
|
|
3120
|
-
html:
|
|
3154
|
+
html: Zi,
|
|
3121
3155
|
nodes: [
|
|
3122
|
-
|
|
3156
|
+
Qi,
|
|
3123
3157
|
{
|
|
3124
3158
|
replace: x,
|
|
3125
|
-
with: (e) => new
|
|
3159
|
+
with: (e) => new Qi(e.__url, {
|
|
3126
3160
|
rel: e.__rel,
|
|
3127
3161
|
target: e.__target,
|
|
3128
3162
|
title: e.__title
|
|
3129
3163
|
}),
|
|
3130
|
-
withKlass:
|
|
3164
|
+
withKlass: Qi
|
|
3131
3165
|
},
|
|
3132
3166
|
b,
|
|
3133
3167
|
D,
|
|
3134
3168
|
E,
|
|
3135
|
-
|
|
3169
|
+
ie,
|
|
3170
|
+
N,
|
|
3136
3171
|
M,
|
|
3137
|
-
j,
|
|
3138
|
-
ue,
|
|
3139
|
-
de,
|
|
3140
3172
|
le,
|
|
3141
|
-
|
|
3173
|
+
ue,
|
|
3174
|
+
ce,
|
|
3175
|
+
ar,
|
|
3142
3176
|
q,
|
|
3143
3177
|
{
|
|
3144
|
-
replace:
|
|
3178
|
+
replace: Ge,
|
|
3145
3179
|
with: (e) => new q(e.__text),
|
|
3146
3180
|
withKlass: q
|
|
3147
3181
|
}
|
|
3148
3182
|
]
|
|
3149
|
-
},
|
|
3150
|
-
initialConfig:
|
|
3151
|
-
children: /* @__PURE__ */ p(
|
|
3183
|
+
}, ta = (e) => /* @__PURE__ */ p(g, {
|
|
3184
|
+
initialConfig: ea,
|
|
3185
|
+
children: /* @__PURE__ */ p(Yi, { ...e })
|
|
3152
3186
|
});
|
|
3153
|
-
|
|
3187
|
+
ta.displayName = "BsyMobileEditor";
|
|
3154
3188
|
//#endregion
|
|
3155
|
-
export {
|
|
3189
|
+
export { Jr as n, ta as t };
|