@baishuyun/ui-mobile 0.12.3 → 0.13.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/AMap/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-CiMeb1VH.js → Editor-C9XclcXa.js} +579 -549
- package/dist/Editor/index.js +2 -2
- package/dist/Gantt/index.js +1 -1
- package/dist/Icon/index.js +1 -1
- package/dist/Overlay/index.js +1 -1
- package/dist/Popup/index.js +1 -1
- package/dist/Segmented/index.js +1 -1
- package/dist/components/Editor/constants.d.ts +2 -1
- package/dist/components/Editor/nodes/ExtendedTextNode.d.ts +5 -1
- package/dist/components/Editor/popups/OptionSheets.d.ts +3 -1
- package/dist/components/Editor/toolbar/useTextFormats.d.ts +2 -1
- package/dist/components/Editor/utils/readTextFormats.d.ts +1 -0
- package/dist/components/Editor/utils/resetEmptyEditorCarryFormat.d.ts +3 -0
- package/dist/index.js +2 -2
- package/dist/style.css +1 -1
- package/dist/vendors/{version-DNTXk7hK.js → version-DwyB7hbm.js} +1 -1
- package/package.json +1 -1
|
@@ -11,21 +11,21 @@ import { $isListItemNode as S, $isListNode as C, INSERT_ORDERED_LIST_COMMAND as
|
|
|
11
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
12
|
import { $createHeadingNode as ne, $isHeadingNode as re, HeadingNode as ie } from "@lexical/rich-text";
|
|
13
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
|
|
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
|
|
14
|
+
import { $applyNodeReplacement as he, $createLineBreakNode as ge, $createParagraphNode as _e, $createTabNode as ve, $createTextNode as ye, $getNodeByKey as F, $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, COMMAND_PRIORITY_HIGH as ke, COMMAND_PRIORITY_LOW as Ae, DROP_COMMAND as je, DecoratorNode as Me, FORMAT_ELEMENT_COMMAND as Ne, FORMAT_TEXT_COMMAND as Pe, HISTORY_MERGE_TAG as Fe, INDENT_CONTENT_COMMAND as Ie, KEY_ENTER_COMMAND as Le, KEY_TAB_COMMAND as Re, OUTDENT_CONTENT_COMMAND as ze, PASTE_COMMAND as Be, PASTE_TAG as Ve, ParagraphNode as He, TextNode as Ue, isHTMLElement as We, mergeRegister as Ge } from "lexical";
|
|
15
|
+
import { ContentEditable as Ke } from "@lexical/react/LexicalContentEditable";
|
|
16
|
+
import { HistoryPlugin as qe } from "@lexical/react/LexicalHistoryPlugin";
|
|
17
|
+
import { LinkPlugin as Je } from "@lexical/react/LexicalLinkPlugin";
|
|
18
|
+
import { ListPlugin as Ye } from "@lexical/react/LexicalListPlugin";
|
|
19
|
+
import { OnChangePlugin as Xe } from "@lexical/react/LexicalOnChangePlugin";
|
|
20
|
+
import { RichTextPlugin as Ze } from "@lexical/react/LexicalRichTextPlugin";
|
|
21
|
+
import { LexicalErrorBoundary as Qe } from "@lexical/react/LexicalErrorBoundary";
|
|
22
22
|
import { useLexicalComposerContext as z } from "@lexical/react/LexicalComposerContext";
|
|
23
|
-
import { $generateHtmlFromNodes as
|
|
24
|
-
import
|
|
25
|
-
import { $findMatchingParent as B, $handleIndentAndOutdent as
|
|
26
|
-
import { $getSelectionStyleValueForProperty as
|
|
23
|
+
import { $generateHtmlFromNodes as $e, $generateNodesFromDOM as et } from "@lexical/html";
|
|
24
|
+
import tt from "dompurify";
|
|
25
|
+
import { $findMatchingParent as B, $handleIndentAndOutdent as nt, mergeRegister as rt } from "@lexical/utils";
|
|
26
|
+
import { $getSelectionStyleValueForProperty as it, $patchStyleText as at, $setBlocksType as ot } from "@lexical/selection";
|
|
27
27
|
//#region src/components/Editor/constants.ts
|
|
28
|
-
var
|
|
28
|
+
var st = [
|
|
29
29
|
{
|
|
30
30
|
label: "12",
|
|
31
31
|
value: "12px"
|
|
@@ -74,21 +74,21 @@ var lt = [
|
|
|
74
74
|
label: "128",
|
|
75
75
|
value: "128px"
|
|
76
76
|
}
|
|
77
|
-
],
|
|
77
|
+
], ct = "16px", lt = "#000", ut = "transparent", dt = /* @__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("."), ft = [
|
|
78
78
|
"quick",
|
|
79
79
|
"formal",
|
|
80
80
|
"colloquial",
|
|
81
81
|
"lively",
|
|
82
82
|
"literary",
|
|
83
83
|
"retro"
|
|
84
|
-
],
|
|
84
|
+
], pt = {
|
|
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
|
+
}, mt = [
|
|
92
92
|
{
|
|
93
93
|
key: "ai",
|
|
94
94
|
buttons: ["ai"]
|
|
@@ -124,102 +124,102 @@ var lt = [
|
|
|
124
124
|
key: "insert",
|
|
125
125
|
buttons: ["picture", "link"]
|
|
126
126
|
}
|
|
127
|
-
],
|
|
127
|
+
], ht = [
|
|
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
|
+
], gt = ht.map((e) => `.${e}`).join(","), _t = "calc(100dvh - 104px)", V = {
|
|
135
|
+
"bsy-mobile-editor": "_bsy-mobile-editor_1uo7r_2",
|
|
136
|
+
"bsy-mobile-editor__label": "_bsy-mobile-editor__label_1uo7r_15",
|
|
137
|
+
"bsy-mobile-editor__label-text": "_bsy-mobile-editor__label-text_1uo7r_20",
|
|
138
|
+
"bsy-mobile-editor__header": "_bsy-mobile-editor__header_1uo7r_29",
|
|
139
|
+
"bsy-mobile-editor__title": "_bsy-mobile-editor__title_1uo7r_39",
|
|
140
|
+
"bsy-mobile-editor__close": "_bsy-mobile-editor__close_1uo7r_49",
|
|
141
|
+
"bsy-mobile-editor__content": "_bsy-mobile-editor__content_1uo7r_63",
|
|
142
|
+
"bsy-mobile-editor__editable": "_bsy-mobile-editor__editable_1uo7r_75",
|
|
143
|
+
"bsy-mobile-editor__image-shell": "_bsy-mobile-editor__image-shell_1uo7r_245",
|
|
144
|
+
"bsy-mobile-editor__image": "_bsy-mobile-editor__image_1uo7r_245",
|
|
145
|
+
"bsy-mobile-editor__image-mask": "_bsy-mobile-editor__image-mask_1uo7r_267",
|
|
146
|
+
"bsy-mobile-editor__image-progress": "_bsy-mobile-editor__image-progress_1uo7r_276",
|
|
147
|
+
"bsy-mobile-editor__image-progress--spin": "_bsy-mobile-editor__image-progress--spin_1uo7r_279",
|
|
148
|
+
"bsy-mobile-editor-progress-spin": "_bsy-mobile-editor-progress-spin_1uo7r_1",
|
|
149
|
+
"bsy-mobile-editor__toolbar": "_bsy-mobile-editor__toolbar_1uo7r_282",
|
|
150
|
+
"bsy-mobile-editor__toolbar-scroller": "_bsy-mobile-editor__toolbar-scroller_1uo7r_297",
|
|
151
|
+
"bsy-mobile-editor__toolbar-track": "_bsy-mobile-editor__toolbar-track_1uo7r_314",
|
|
152
|
+
"bsy-mobile-editor__toolbar-thumb": "_bsy-mobile-editor__toolbar-thumb_1uo7r_326",
|
|
153
|
+
"bsy-mobile-editor__toolbar-group": "_bsy-mobile-editor__toolbar-group_1uo7r_331",
|
|
154
|
+
"bsy-mobile-editor__toolbar-divider": "_bsy-mobile-editor__toolbar-divider_1uo7r_337",
|
|
155
|
+
"bsy-mobile-editor__tool": "_bsy-mobile-editor__tool_1uo7r_282",
|
|
156
|
+
"bsy-mobile-editor__tool--active": "_bsy-mobile-editor__tool--active_1uo7r_358",
|
|
157
|
+
"bsy-mobile-editor__tool--select": "_bsy-mobile-editor__tool--select_1uo7r_365",
|
|
158
|
+
"bsy-mobile-editor__tool--select-align": "_bsy-mobile-editor__tool--select-align_1uo7r_370",
|
|
159
|
+
"bsy-mobile-editor__tool-caret": "_bsy-mobile-editor__tool-caret_1uo7r_373",
|
|
160
|
+
"bsy-mobile-editor__tool-caret--open": "_bsy-mobile-editor__tool-caret--open_1uo7r_376",
|
|
161
|
+
"bsy-mobile-editor__ai-icon": "_bsy-mobile-editor__ai-icon_1uo7r_379",
|
|
162
|
+
"bsy-mobile-editor__tool-text": "_bsy-mobile-editor__tool-text_1uo7r_384",
|
|
163
|
+
"bsy-mobile-editor__color": "_bsy-mobile-editor__color_1uo7r_389",
|
|
164
|
+
"bsy-mobile-editor__color--custom": "_bsy-mobile-editor__color--custom_1uo7r_397",
|
|
165
|
+
"bsy-mobile-editor__color-header": "_bsy-mobile-editor__color-header_1uo7r_400",
|
|
166
|
+
"bsy-mobile-editor__color-header-title": "_bsy-mobile-editor__color-header-title_1uo7r_409",
|
|
167
|
+
"bsy-mobile-editor__color-header-back": "_bsy-mobile-editor__color-header-back_1uo7r_422",
|
|
168
|
+
"bsy-mobile-editor__color-grid": "_bsy-mobile-editor__color-grid_1uo7r_436",
|
|
169
|
+
"bsy-mobile-editor__color-swatch": "_bsy-mobile-editor__color-swatch_1uo7r_443",
|
|
170
|
+
"bsy-mobile-editor__color-none": "_bsy-mobile-editor__color-none_1uo7r_443",
|
|
171
|
+
"bsy-mobile-editor__color-custom-item": "_bsy-mobile-editor__color-custom-item_1uo7r_443",
|
|
172
|
+
"bsy-mobile-editor__color-swatch--selected": "_bsy-mobile-editor__color-swatch--selected_1uo7r_459",
|
|
173
|
+
"bsy-mobile-editor__color-none--selected": "_bsy-mobile-editor__color-none--selected_1uo7r_459",
|
|
174
|
+
"bsy-mobile-editor__color-custom-item--selected": "_bsy-mobile-editor__color-custom-item--selected_1uo7r_459",
|
|
175
|
+
"bsy-mobile-editor__color-swatch-fill": "_bsy-mobile-editor__color-swatch-fill_1uo7r_473",
|
|
176
|
+
"bsy-mobile-editor__color-bar": "_bsy-mobile-editor__color-bar_1uo7r_480",
|
|
177
|
+
"bsy-mobile-editor__color-custom-trigger": "_bsy-mobile-editor__color-custom-trigger_1uo7r_486",
|
|
178
|
+
"bsy-mobile-editor__color-custom-trigger--active": "_bsy-mobile-editor__color-custom-trigger--active_1uo7r_504",
|
|
179
|
+
"bsy-mobile-editor__color-custom-trigger--preview": "_bsy-mobile-editor__color-custom-trigger--preview_1uo7r_509",
|
|
180
|
+
"bsy-mobile-editor__color-custom-list": "_bsy-mobile-editor__color-custom-list_1uo7r_524",
|
|
181
|
+
"bsy-mobile-editor__color-mixer": "_bsy-mobile-editor__color-mixer_1uo7r_544",
|
|
182
|
+
"bsy-mobile-editor__color-spectrum": "_bsy-mobile-editor__color-spectrum_1uo7r_547",
|
|
183
|
+
"bsy-mobile-editor__color-spectrum-canvas": "_bsy-mobile-editor__color-spectrum-canvas_1uo7r_555",
|
|
184
|
+
"bsy-mobile-editor__color-thumb": "_bsy-mobile-editor__color-thumb_1uo7r_562",
|
|
185
|
+
"bsy-mobile-editor__sheet": "_bsy-mobile-editor__sheet_1uo7r_572",
|
|
186
|
+
"bsy-mobile-editor__sheet-body": "_bsy-mobile-editor__sheet-body_1uo7r_578",
|
|
187
|
+
"bsy-mobile-editor__sheet-body--stack": "_bsy-mobile-editor__sheet-body--stack_1uo7r_583",
|
|
188
|
+
"bsy-mobile-editor__sheet-field": "_bsy-mobile-editor__sheet-field_1uo7r_588",
|
|
189
|
+
"bsy-mobile-editor__sheet-label": "_bsy-mobile-editor__sheet-label_1uo7r_593",
|
|
190
|
+
"bsy-mobile-editor__sheet-note": "_bsy-mobile-editor__sheet-note_1uo7r_599",
|
|
191
|
+
"bsy-mobile-editor__sheet-note--hint": "_bsy-mobile-editor__sheet-note--hint_1uo7r_605",
|
|
192
|
+
"bsy-mobile-editor__sheet-error": "_bsy-mobile-editor__sheet-error_1uo7r_608",
|
|
193
|
+
"bsy-mobile-editor__sheet-bar": "_bsy-mobile-editor__sheet-bar_1uo7r_628",
|
|
194
|
+
"bsy-mobile-editor__sheet-ok": "_bsy-mobile-editor__sheet-ok_1uo7r_649",
|
|
195
|
+
"bsy-mobile-editor__check": "_bsy-mobile-editor__check_1uo7r_654",
|
|
196
|
+
"bsy-mobile-editor__check-input": "_bsy-mobile-editor__check-input_1uo7r_666",
|
|
197
|
+
"bsy-mobile-editor__check-box": "_bsy-mobile-editor__check-box_1uo7r_673",
|
|
198
|
+
"bsy-mobile-editor__ai": "_bsy-mobile-editor__ai_1uo7r_379",
|
|
199
|
+
"bsy-mobile-editor__ai-body": "_bsy-mobile-editor__ai-body_1uo7r_695",
|
|
200
|
+
"bsy-mobile-editor__ai-section": "_bsy-mobile-editor__ai-section_1uo7r_703",
|
|
201
|
+
"bsy-mobile-editor__ai-section-head": "_bsy-mobile-editor__ai-section-head_1uo7r_711",
|
|
202
|
+
"bsy-mobile-editor__ai-section-scroll": "_bsy-mobile-editor__ai-section-scroll_1uo7r_719",
|
|
203
|
+
"bsy-mobile-editor__ai-label": "_bsy-mobile-editor__ai-label_1uo7r_726",
|
|
204
|
+
"bsy-mobile-editor__ai-label--after": "_bsy-mobile-editor__ai-label--after_1uo7r_738",
|
|
205
|
+
"bsy-mobile-editor__ai-label--before": "_bsy-mobile-editor__ai-label--before_1uo7r_742",
|
|
206
|
+
"bsy-mobile-editor__ai-dot": "_bsy-mobile-editor__ai-dot_1uo7r_746",
|
|
207
|
+
"bsy-mobile-editor__ai-split": "_bsy-mobile-editor__ai-split_1uo7r_753",
|
|
208
|
+
"bsy-mobile-editor__ai-preset": "_bsy-mobile-editor__ai-preset_1uo7r_759",
|
|
209
|
+
"bsy-mobile-editor__ai-think-pin": "_bsy-mobile-editor__ai-think-pin_1uo7r_779",
|
|
210
|
+
"bsy-mobile-editor__ai-think-head": "_bsy-mobile-editor__ai-think-head_1uo7r_783",
|
|
211
|
+
"bsy-mobile-editor__ai-think-label": "_bsy-mobile-editor__ai-think-label_1uo7r_800",
|
|
212
|
+
"bsy-mobile-editor__ai-think-label--shimmer": "_bsy-mobile-editor__ai-think-label--shimmer_1uo7r_804",
|
|
213
|
+
"bsy-mobile-ai-think-shimmer": "_bsy-mobile-ai-think-shimmer_1uo7r_1",
|
|
214
|
+
"bsy-mobile-editor__ai-think-arrow": "_bsy-mobile-editor__ai-think-arrow_1uo7r_815",
|
|
215
|
+
"bsy-mobile-editor__ai-think-arrow--open": "_bsy-mobile-editor__ai-think-arrow--open_1uo7r_822",
|
|
216
|
+
"bsy-mobile-editor__ai-think-icon": "_bsy-mobile-editor__ai-think-icon_1uo7r_825",
|
|
217
|
+
"bsy-mobile-ai-think": "_bsy-mobile-ai-think_1uo7r_1",
|
|
218
|
+
"bsy-mobile-editor__ai-think-body": "_bsy-mobile-editor__ai-think-body_1uo7r_837",
|
|
219
|
+
"bsy-mobile-editor__ai-error": "_bsy-mobile-editor__ai-error_1uo7r_846",
|
|
220
|
+
"bsy-mobile-editor__ai-footer": "_bsy-mobile-editor__ai-footer_1uo7r_851",
|
|
221
|
+
"bsy-mobile-editor__ai-footer-ok": "_bsy-mobile-editor__ai-footer-ok_1uo7r_873"
|
|
222
|
+
}, vt = {
|
|
223
223
|
typeset: [
|
|
224
224
|
"你是一名专业的 HTML 文档排版引擎。输入已是 HTML 片段。",
|
|
225
225
|
"任务:在不改内容层(措辞、语序、修辞、情感色彩)的前提下,做形式层 + 视觉层优化,充分利用富文本能力(标题、列表、加粗、字色、背景色、缩进、对齐)。",
|
|
@@ -283,7 +283,7 @@ var lt = [
|
|
|
283
283
|
literary: "语气:更书面、文学感(适配小说、散文、高级文案)。\n规则:若主语言为中文,允许四字格;若为英文,允许复杂从句和排比;不改变原风格基调。",
|
|
284
284
|
retro: "语气:带一点复古书面色彩,仍保持现代可读。\n规则:仅当主语言为中文时生效:仿民国白话风(之/其/乃);其他语言自动降级为 literary。"
|
|
285
285
|
}
|
|
286
|
-
},
|
|
286
|
+
}, yt = vt.typeset.join("\n"), bt = vt.polishSystem.join("\n"), xt = (e) => `${bt}\n\n【本轮风格】\n${vt.polish[e] ?? vt.polish.quick}`, St = (e) => {
|
|
287
287
|
if (!e.trim()) return {
|
|
288
288
|
html: e,
|
|
289
289
|
blocks: []
|
|
@@ -298,16 +298,16 @@ var lt = [
|
|
|
298
298
|
html: t.body.innerHTML,
|
|
299
299
|
blocks: n
|
|
300
300
|
};
|
|
301
|
-
},
|
|
301
|
+
}, Ct = "<!--bsy-block-->", wt = /<!--bsy-code-(\d+)-->/g, Tt = "bsy-html-root", Et = (e) => new DOMParser().parseFromString(`<${Tt}>${e}</${Tt}>`, "text/html").body.querySelector(Tt), Dt = (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(wt, (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
|
+
}, Ot = (e) => {
|
|
309
309
|
if (!/<pre[\s>/]/i.test(e)) return e;
|
|
310
|
-
let t =
|
|
310
|
+
let t = Et(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 lt = [
|
|
|
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
|
+
}, kt = (e, t) => Dt(Ot(e), t), At = "p, h1, h2, h3, li", jt = /background(-color)?\s*:/i, Mt = (e) => {
|
|
319
|
+
if (!e.trim() || !jt.test(e)) return e;
|
|
320
|
+
let t = Et(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(At))) {
|
|
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
|
+
}, Nt = "--listitem-marker-font-size", Pt = `max(24px, calc(var(${Nt}, 1em) * 1.25))`, Ft = new Set([
|
|
328
328
|
"U",
|
|
329
329
|
"I",
|
|
330
330
|
"EM",
|
|
331
331
|
"B",
|
|
332
332
|
"STRONG"
|
|
333
|
-
]),
|
|
334
|
-
["fontSize",
|
|
333
|
+
]), It = (e) => e.startsWith("--listitem-marker-"), Lt = [
|
|
334
|
+
["fontSize", Nt],
|
|
335
335
|
["color", "--listitem-marker-color"],
|
|
336
336
|
["backgroundColor", "--listitem-marker-background-color"],
|
|
337
337
|
["fontFamily", "--listitem-marker-font-family"]
|
|
338
|
-
],
|
|
338
|
+
], Rt = (e) => {
|
|
339
339
|
let t = e.style.fontSize;
|
|
340
|
-
if (
|
|
341
|
-
for (let n = e.parentElement; n; n = n.parentElement) if (t &&
|
|
340
|
+
if (Lt.some(([t]) => e.style[t])) {
|
|
341
|
+
for (let n = e.parentElement; n; n = n.parentElement) if (t && Ft.has(n.tagName) && !n.style.fontSize && (n.style.fontSize = t), !(n.tagName !== "LI" || n.classList.contains("editor-nested-listitem"))) for (let [t, r] of Lt) {
|
|
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
|
+
}, zt = (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 lt = [
|
|
|
354
354
|
}
|
|
355
355
|
let o = document.createElement("style");
|
|
356
356
|
o.textContent = r, i.replaceChildren(o, a);
|
|
357
|
-
},
|
|
357
|
+
}, Bt = [
|
|
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
|
+
], Vt = (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 Bt) {
|
|
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 lt = [
|
|
|
383
383
|
}
|
|
384
384
|
}
|
|
385
385
|
}
|
|
386
|
-
},
|
|
386
|
+
}, Ht = (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
|
+
Vt(r);
|
|
391
|
+
let i = et(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 = _e();
|
|
398
398
|
n.append(r), Oe(null);
|
|
399
|
-
},
|
|
399
|
+
}, Ut = (e) => {
|
|
400
400
|
if (e) {
|
|
401
401
|
I().selectStart();
|
|
402
402
|
return;
|
|
403
403
|
}
|
|
404
404
|
Oe(null);
|
|
405
|
-
},
|
|
405
|
+
}, Wt = (e) => {
|
|
406
406
|
e && Oe(e.clone());
|
|
407
|
-
},
|
|
407
|
+
}, Gt = () => {
|
|
408
408
|
L() === null && I().selectStart();
|
|
409
409
|
}, H = (e) => {
|
|
410
410
|
e.isEditable() || e.setEditable(!0), e.update(() => {
|
|
411
|
-
|
|
411
|
+
Gt();
|
|
412
412
|
}), e.focus(void 0, { defaultSelection: "rootStart" });
|
|
413
|
-
},
|
|
413
|
+
}, Kt = (e, t) => !t.trim() && (e === "<p><br></p>" || e === "<p></p>" || e === "" || /^<p>\s*<br>\s*<\/p>$/.test(e)), qt = /* @__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("."), Jt = [
|
|
414
414
|
"href",
|
|
415
415
|
"src",
|
|
416
416
|
"alt",
|
|
@@ -426,12 +426,12 @@ var lt = [
|
|
|
426
426
|
"style",
|
|
427
427
|
"width",
|
|
428
428
|
"height"
|
|
429
|
-
],
|
|
429
|
+
], Yt = 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(".")), Xt = /^(?:(?:(?:f|ht)tps?|mailto|blob):|data:image\/[a-z0-9.+-]+[;,].*|[^a-z]|[a-z+.-]+(?:[^a-z+.:-]|$))/i, Zt = new Set([
|
|
430
430
|
"pre",
|
|
431
431
|
"code",
|
|
432
432
|
"td",
|
|
433
433
|
"th"
|
|
434
|
-
]),
|
|
434
|
+
]), Qt = new Set(["pre", "code"]), $t = new Set(["sup", "sub"]), en = (e, t) => It(e) ? t === "li" : Yt.has(e) ? e === "padding-inline-start" ? !0 : e === "padding" || e.startsWith("padding-") ? Zt.has(t) : e === "border-radius" ? Qt.has(t) : e === "position" || e === "top" || e === "bottom" ? $t.has(t) : !0 : !1, tn = (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 lt = [
|
|
|
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 !en(r, t) || /expression|javascript:|url\s*\(\s*['"]?\s*javascript/i.test(i) ? null : `${r}: ${i}`;
|
|
443
|
+
}).filter((e) => e !== null).join("; "), nn = !1, rn = () => {
|
|
444
|
+
nn ||= (tt.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 = tn(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 ? (rn(), tt.sanitize(e, {
|
|
452
|
+
ALLOWED_TAGS: qt,
|
|
453
|
+
ALLOWED_ATTR: Jt,
|
|
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: Xt
|
|
461
461
|
})) : "", W = {
|
|
462
462
|
margin: "0.6em 0 0.4em",
|
|
463
463
|
"font-weight": "600",
|
|
464
464
|
"line-height": "1.35"
|
|
465
|
-
},
|
|
465
|
+
}, an = {
|
|
466
466
|
h1: {
|
|
467
467
|
...W,
|
|
468
468
|
"font-size": "2em"
|
|
@@ -487,26 +487,26 @@ var lt = [
|
|
|
487
487
|
...W,
|
|
488
488
|
"font-size": "0.875em"
|
|
489
489
|
}
|
|
490
|
-
},
|
|
490
|
+
}, on = {
|
|
491
491
|
color: "#0269ff",
|
|
492
492
|
cursor: "pointer"
|
|
493
|
-
},
|
|
493
|
+
}, sn = {
|
|
494
494
|
margin: "0",
|
|
495
495
|
"padding-inline-start": "0",
|
|
496
496
|
"list-style-position": "outside"
|
|
497
|
-
},
|
|
497
|
+
}, cn = [
|
|
498
498
|
"disc",
|
|
499
499
|
"circle",
|
|
500
500
|
"square"
|
|
501
|
-
],
|
|
501
|
+
], ln = {
|
|
502
502
|
margin: "0",
|
|
503
|
-
"margin-inline-start":
|
|
503
|
+
"margin-inline-start": Pt,
|
|
504
504
|
"list-style": "inherit"
|
|
505
|
-
},
|
|
505
|
+
}, un = {
|
|
506
506
|
margin: "0",
|
|
507
507
|
"margin-inline-start": "0",
|
|
508
508
|
"list-style-type": "none"
|
|
509
|
-
},
|
|
509
|
+
}, dn = {
|
|
510
510
|
display: "block",
|
|
511
511
|
"box-sizing": "border-box",
|
|
512
512
|
"max-width": "100%",
|
|
@@ -521,23 +521,23 @@ var lt = [
|
|
|
521
521
|
"border-radius": "4px",
|
|
522
522
|
"background-color": "rgb(240, 242, 245)",
|
|
523
523
|
color: "#1f2328"
|
|
524
|
-
},
|
|
524
|
+
}, fn = {
|
|
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
|
+
}, pn = {
|
|
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
|
+
}, mn = {
|
|
538
538
|
"font-weight": "600",
|
|
539
539
|
"background-color": "#f2f3f5"
|
|
540
|
-
},
|
|
540
|
+
}, hn = {
|
|
541
541
|
display: "inline-block",
|
|
542
542
|
position: "static",
|
|
543
543
|
top: "auto",
|
|
@@ -546,39 +546,39 @@ var lt = [
|
|
|
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
|
+
}, gn = (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
|
+
}, _n = (e) => {
|
|
554
554
|
let t = [...e.querySelectorAll("*")].filter((e) => e instanceof HTMLElement);
|
|
555
|
-
for (let e of t)
|
|
555
|
+
for (let e of t) Rt(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 = an[t];
|
|
558
|
+
if (n && G(e, n), t === "a" && G(e, on), t === "ul") {
|
|
559
|
+
let t = Math.min(Math.max(gn(e), 1), cn.length);
|
|
560
560
|
G(e, {
|
|
561
|
-
...
|
|
562
|
-
"list-style-type":
|
|
561
|
+
...sn,
|
|
562
|
+
"list-style-type": cn[t - 1]
|
|
563
563
|
});
|
|
564
564
|
}
|
|
565
565
|
t === "ol" && G(e, {
|
|
566
|
-
...
|
|
566
|
+
...sn,
|
|
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") ? un : ln), t === "pre" && G(e, dn), (t === "sup" || t === "sub") && G(e, {
|
|
569
|
+
...hn,
|
|
570
570
|
"vertical-align": t === "sup" ? "super" : "sub"
|
|
571
|
-
}), t === "table" && G(e,
|
|
571
|
+
}), t === "table" && G(e, fn), (t === "td" || t === "th") && (G(e, pn), (t === "th" || e.classList.contains("editor-table-cell-header")) && G(e, mn)), 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
|
+
}, vn = (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
|
+
}, yn = (e) => {
|
|
582
582
|
let t = !0;
|
|
583
583
|
for (; t;) {
|
|
584
584
|
t = !1;
|
|
@@ -586,21 +586,21 @@ var lt = [
|
|
|
586
586
|
if (n.attributes.length > 0) continue;
|
|
587
587
|
let e = n.tagName.toLowerCase();
|
|
588
588
|
if (e === "span") {
|
|
589
|
-
|
|
589
|
+
vn(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") && (vn(n), t = !0);
|
|
595
595
|
}
|
|
596
596
|
}
|
|
597
|
-
},
|
|
597
|
+
}, bn = (e) => {
|
|
598
598
|
if (!e.trim()) return e;
|
|
599
599
|
let t = new DOMParser().parseFromString(e, "text/html");
|
|
600
|
-
|
|
600
|
+
_n(t.body), yn(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
|
+
}, xn = (e) => e ? new DOMParser().parseFromString(e, "text/html").body.textContent ?? "" : "", Sn = (e) => e.includes("<!--bsy-block-->") ? e.split(Ct).map((e) => e.trim()) : [e], Cn = (e) => e.split(Ct).join("").trim().length > 0, wn = (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 lt = [
|
|
|
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
|
+
}, Tn = new Set([
|
|
617
617
|
"TABLE",
|
|
618
618
|
"THEAD",
|
|
619
619
|
"TBODY",
|
|
@@ -622,7 +622,7 @@ var lt = [
|
|
|
622
622
|
"TH",
|
|
623
623
|
"IMG",
|
|
624
624
|
"BR"
|
|
625
|
-
]),
|
|
625
|
+
]), En = (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 lt = [
|
|
|
632
632
|
e.nodeType === Node.TEXT_NODE && t.push(e);
|
|
633
633
|
};
|
|
634
634
|
return n(e), t;
|
|
635
|
-
},
|
|
635
|
+
}, Dn = (e, t) => {
|
|
636
636
|
let n = e;
|
|
637
|
-
for (; n && n !== t && !
|
|
637
|
+
for (; n && n !== t && !Tn.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
|
+
}, On = (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
|
+
}, kn = (e) => {
|
|
645
|
+
let t = Et(e);
|
|
646
|
+
return t ? Array.from(t.children).filter((e) => !On(e)).map((e) => e.textContent ?? "") : [];
|
|
647
|
+
}, An = (e) => e.includes("<!--bsy-block-->") ? e : xn(e) || e, jn = (e, t) => {
|
|
648
|
+
let n = En(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 = wn(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 lt = [
|
|
|
658
658
|
continue;
|
|
659
659
|
}
|
|
660
660
|
let o = a.parentElement;
|
|
661
|
-
a.remove(),
|
|
661
|
+
a.remove(), Dn(o, e);
|
|
662
662
|
}
|
|
663
|
-
},
|
|
664
|
-
let n =
|
|
665
|
-
if (!
|
|
666
|
-
let r =
|
|
663
|
+
}, Mn = (e, t) => {
|
|
664
|
+
let n = An(t);
|
|
665
|
+
if (!Cn(n) || !e.trim()) return "";
|
|
666
|
+
let r = Et(e);
|
|
667
667
|
if (!r) return "";
|
|
668
|
-
let i = Array.from(r.children).filter((e) => !
|
|
668
|
+
let i = Array.from(r.children).filter((e) => !On(e));
|
|
669
669
|
if (i.length === 0) return "";
|
|
670
|
-
let a =
|
|
671
|
-
for (let e = 0; e < i.length; e++)
|
|
670
|
+
let a = Sn(n), o = a.length === i.length ? a : wn(i.map((e) => e.textContent ?? ""), a.join(""));
|
|
671
|
+
for (let e = 0; e < i.length; e++) jn(i[e], o[e] ?? "");
|
|
672
672
|
return r.innerHTML;
|
|
673
|
-
},
|
|
673
|
+
}, Nn = (e, t) => {
|
|
674
674
|
let n = "";
|
|
675
675
|
e.getEditorState().read(() => {
|
|
676
|
-
n =
|
|
676
|
+
n = bn(U($e(e, null)));
|
|
677
677
|
}, { editor: e });
|
|
678
|
-
let r = U(
|
|
679
|
-
return !r.trim() ||
|
|
680
|
-
|
|
678
|
+
let r = U(Mn(n, t));
|
|
679
|
+
return !r.trim() || Kt(r, xn(r)) ? !1 : (e.update(() => {
|
|
680
|
+
Ht(e, r), Ut(!0);
|
|
681
681
|
}, { discrete: !0 }), !0);
|
|
682
|
-
},
|
|
682
|
+
}, Pn = /^\uFEFF/, Fn = /^ {0,3}`{1,3}[A-Za-z]*$/, In = /^( {0,3})([^`<]*?)```[ \t]*([A-Za-z0-9_-]*)[ \t]*(.*)$/, Ln = /^ {0,3}```[ \t]*$/, Rn = /<\/?[a-zA-Z]/, zn = /<[a-zA-Z!]/, Bn = (e) => zn.test(e), Vn = (e) => Rn.test(e), Hn = (e) => e.replace(Pn, "").replace(/\r\n/g, "\n"), Un = (e) => {
|
|
683
683
|
let t = e.replace(/\n+$/, ""), n = t.lastIndexOf("\n"), r = n === -1 ? t : t.slice(n + 1);
|
|
684
|
-
return
|
|
684
|
+
return Fn.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
|
+
}, Wn = (e) => {
|
|
692
|
+
let t = In.exec(e);
|
|
693
693
|
return t ? { sameLineBody: t[4] ?? "" } : null;
|
|
694
|
-
},
|
|
694
|
+
}, Gn = (e) => {
|
|
695
695
|
let t = e.replace(/[ \t]*```[ \t]*$/, "");
|
|
696
696
|
return t === e ? e : t;
|
|
697
|
-
},
|
|
697
|
+
}, Kn = (e) => Bn(e) ? e.replace(/^\n/, "") : "", qn = (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 = Wn(e);
|
|
701
701
|
if (i) {
|
|
702
702
|
let e = i.sameLineBody;
|
|
703
|
-
if (e !==
|
|
704
|
-
e =
|
|
705
|
-
let i =
|
|
703
|
+
if (e !== Gn(e)) {
|
|
704
|
+
e = Gn(e);
|
|
705
|
+
let i = Kn(t.slice(r + 1).join("\n"));
|
|
706
706
|
return [
|
|
707
707
|
...n,
|
|
708
708
|
e,
|
|
@@ -710,63 +710,63 @@ var lt = [
|
|
|
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 && !Ln.test(t[r]);) a.push(t[r]), r += 1;
|
|
714
|
+
let o = r < t.length ? Kn(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 (Vn(e)) return Jn([...n, ...t.slice(r)].join("\n"));
|
|
722
|
+
Bn(e) && n.push(e), r += 1;
|
|
723
723
|
}
|
|
724
724
|
return n.length ? n.join("\n") : null;
|
|
725
|
-
},
|
|
725
|
+
}, Jn = (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 = Wn(t[0]);
|
|
729
|
+
return n && !Vn(t[0].slice(0, t[0].indexOf("```"))) && (t.shift(), n.sameLineBody && t.unshift(Gn(n.sameLineBody))), t.length && Ln.test(t[t.length - 1] ?? "") && t.pop(), t.join("\n");
|
|
730
|
+
}, Yn = (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 } = Un(Hn(e));
|
|
736
736
|
if (!t.trim()) return {
|
|
737
737
|
html: "",
|
|
738
|
-
pending: n ||
|
|
738
|
+
pending: n || Fn.test(Hn(e).trim())
|
|
739
739
|
};
|
|
740
|
-
let r =
|
|
740
|
+
let r = qn(t) ?? t, i = qn(r);
|
|
741
741
|
i !== null && i !== r && (r = i);
|
|
742
742
|
let a = r.trim();
|
|
743
|
-
return
|
|
743
|
+
return Bn(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
|
+
}, Xn = (e, t) => {
|
|
751
|
+
let { html: n } = Yn(e);
|
|
752
|
+
return n ? Mt(kt(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 Zn(e, t, n) {
|
|
757
|
+
let r = U(Xn(t, n));
|
|
758
|
+
return !r.trim() || Kt(r, "") ? { applied: !1 } : (e.update(() => {
|
|
759
|
+
Ht(e, r), Ut(!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 Qn = (e) => {
|
|
765
765
|
let t = "", n = "", r = "";
|
|
766
766
|
e.getEditorState().read(() => {
|
|
767
|
-
n = I().getTextContent(), t =
|
|
767
|
+
n = I().getTextContent(), t = bn(U($e(e, null))), r = kn(t).join(`\n\n${Ct}\n\n`);
|
|
768
768
|
}, { editor: e });
|
|
769
|
-
let i =
|
|
769
|
+
let i = St(t);
|
|
770
770
|
return {
|
|
771
771
|
html: t,
|
|
772
772
|
text: n,
|
|
@@ -774,7 +774,7 @@ var $n = (e) => {
|
|
|
774
774
|
htmlWithoutCode: i.html,
|
|
775
775
|
codeBlocks: i.blocks
|
|
776
776
|
};
|
|
777
|
-
},
|
|
777
|
+
}, $n = ({ 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 $n = (e) => {
|
|
|
784
784
|
htmlWithoutCode: "",
|
|
785
785
|
codeBlocks: []
|
|
786
786
|
}), [s, c] = d("quick"), l = () => {
|
|
787
|
-
let t =
|
|
787
|
+
let t = Qn(e);
|
|
788
788
|
o(t), i("typeset"), n.current?.typeset?.({
|
|
789
789
|
html: t.htmlWithoutCode,
|
|
790
790
|
text: t.text,
|
|
791
|
-
prompt:
|
|
791
|
+
prompt: yt
|
|
792
792
|
});
|
|
793
793
|
}, f = (t) => {
|
|
794
|
-
let r =
|
|
794
|
+
let r = Qn(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: xt(t)
|
|
799
799
|
});
|
|
800
800
|
}, p = () => {
|
|
801
801
|
n.current?.stop?.(), i(null);
|
|
@@ -809,11 +809,11 @@ var $n = (e) => {
|
|
|
809
809
|
close: p,
|
|
810
810
|
apply: () => {
|
|
811
811
|
let t = n.current?.text ?? "";
|
|
812
|
-
r === "typeset" ?
|
|
812
|
+
r === "typeset" ? Zn(e, t, a.codeBlocks) : r === "polish" && Nn(e, t), p();
|
|
813
813
|
}
|
|
814
814
|
};
|
|
815
|
-
},
|
|
816
|
-
let a = o(
|
|
815
|
+
}, er = i({}), K = 36, tr = 14, nr = 2 * Math.PI * tr, rr = ({ nodeKey: e, src: t, altText: n, dataId: r, dataSrc: i }) => {
|
|
816
|
+
let a = o(er), 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 $n = (e) => {
|
|
|
837
837
|
children: [/* @__PURE__ */ p("circle", {
|
|
838
838
|
cx: K / 2,
|
|
839
839
|
cy: K / 2,
|
|
840
|
-
r:
|
|
840
|
+
r: tr,
|
|
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: tr,
|
|
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 ? `${nr * .25} ${nr}` : nr,
|
|
853
|
+
strokeDashoffset: c === void 0 ? 0 : nr * (1 - c / 100),
|
|
854
854
|
transform: `rotate(-90 ${K / 2} ${K / 2})`
|
|
855
855
|
})]
|
|
856
856
|
})
|
|
857
857
|
}) : null]
|
|
858
858
|
});
|
|
859
|
-
},
|
|
859
|
+
}, ir = class e extends Me {
|
|
860
860
|
__src;
|
|
861
861
|
__altText;
|
|
862
862
|
__width;
|
|
@@ -896,13 +896,13 @@ var $n = (e) => {
|
|
|
896
896
|
}
|
|
897
897
|
static importDOM() {
|
|
898
898
|
return { img: () => ({
|
|
899
|
-
conversion:
|
|
899
|
+
conversion: sr,
|
|
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 or({
|
|
906
906
|
src: t,
|
|
907
907
|
altText: n,
|
|
908
908
|
width: r,
|
|
@@ -927,7 +927,7 @@ var $n = (e) => {
|
|
|
927
927
|
return !0;
|
|
928
928
|
}
|
|
929
929
|
decorate() {
|
|
930
|
-
return /* @__PURE__ */ p(
|
|
930
|
+
return /* @__PURE__ */ p(rr, {
|
|
931
931
|
nodeKey: this.getKey(),
|
|
932
932
|
src: this.__src,
|
|
933
933
|
altText: this.__altText,
|
|
@@ -935,7 +935,7 @@ var $n = (e) => {
|
|
|
935
935
|
dataSrc: this.__dataSrc
|
|
936
936
|
});
|
|
937
937
|
}
|
|
938
|
-
},
|
|
938
|
+
}, ar = (e) => e instanceof ir, or = ({ src: e, altText: t, width: n, height: r, dataId: i, dataSrc: a, key: o }) => new ir(e, t, n, r, o, i, a), sr = (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 $n = (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: or({
|
|
950
950
|
src: t,
|
|
951
951
|
altText: n,
|
|
952
952
|
width: i,
|
|
@@ -954,7 +954,7 @@ var $n = (e) => {
|
|
|
954
954
|
dataId: e.getAttribute("data-id") || void 0,
|
|
955
955
|
dataSrc: e.getAttribute("data-src") || void 0
|
|
956
956
|
}) };
|
|
957
|
-
},
|
|
957
|
+
}, cr = (e) => ht.includes(e.name.split(".").pop()?.toLowerCase() ?? ""), lr = (e) => cr(e) ? e.size > 5242880 ? "size" : null : "type", ur = ({ 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 $n = (e) => {
|
|
|
964
964
|
let m = a((t, r, i) => {
|
|
965
965
|
let a = "";
|
|
966
966
|
return e.update(() => {
|
|
967
|
-
|
|
968
|
-
let e =
|
|
967
|
+
Wt(n.current), L() === null && I().selectEnd();
|
|
968
|
+
let e = or({
|
|
969
969
|
src: t,
|
|
970
970
|
altText: r,
|
|
971
971
|
dataSrc: i
|
|
@@ -980,7 +980,7 @@ var $n = (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 || lr(i)) return;
|
|
984
984
|
p();
|
|
985
985
|
let a = new AbortController();
|
|
986
986
|
if (o.current = a, !t?.customRequest) {
|
|
@@ -1005,7 +1005,7 @@ var $n = (e) => {
|
|
|
1005
1005
|
}));
|
|
1006
1006
|
let u = !1, d = (t) => {
|
|
1007
1007
|
u || (u = !0, URL.revokeObjectURL(s), t || e.update(() => {
|
|
1008
|
-
|
|
1008
|
+
F(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 $n = (e) => {
|
|
|
1034
1034
|
return;
|
|
1035
1035
|
}
|
|
1036
1036
|
e.update(() => {
|
|
1037
|
-
let e =
|
|
1038
|
-
|
|
1037
|
+
let e = F(l);
|
|
1038
|
+
ar(e) && (e.setSrc(o), s && e.setDataId(s));
|
|
1039
1039
|
}), d(!0);
|
|
1040
1040
|
} catch {
|
|
1041
1041
|
d(!1);
|
|
@@ -1049,7 +1049,7 @@ var $n = (e) => {
|
|
|
1049
1049
|
]),
|
|
1050
1050
|
abortUpload: p
|
|
1051
1051
|
};
|
|
1052
|
-
},
|
|
1052
|
+
}, dr = ({ 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 $n = (e) => {
|
|
|
1076
1076
|
if (!r) return;
|
|
1077
1077
|
let a = r.startsWith("@") || /^https?:\/\//.test(r) ? r : `http://${r}`;
|
|
1078
1078
|
e.update(() => {
|
|
1079
|
-
|
|
1079
|
+
Wt(t.current);
|
|
1080
1080
|
let e = L(), r = n.newBlank ? {
|
|
1081
1081
|
target: "_blank",
|
|
1082
1082
|
rel: "noopener noreferrer",
|
|
@@ -1086,16 +1086,16 @@ var $n = (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 = ye(t), i = _(a, r);
|
|
1090
1090
|
i.append(n), e.insertNodes([i]);
|
|
1091
1091
|
}
|
|
1092
1092
|
} else {
|
|
1093
|
-
let e =
|
|
1093
|
+
let e = ye(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 = _e();
|
|
1099
1099
|
e.append(t), i.append(e);
|
|
1100
1100
|
}
|
|
1101
1101
|
}
|
|
@@ -1103,14 +1103,14 @@ var $n = (e) => {
|
|
|
1103
1103
|
},
|
|
1104
1104
|
closeLink: () => i(null)
|
|
1105
1105
|
};
|
|
1106
|
-
},
|
|
1106
|
+
}, fr = ({ 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 = bn(U($e(e, null))), s = Kt(a, n) ? null : a;
|
|
1112
1112
|
i.current = s;
|
|
1113
|
-
let c = Ee(
|
|
1113
|
+
let c = Ee(ir).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 $n = (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
|
+
Ht(e, t?.trim() ? U(t) : ""), Ut(!!e.getRootElement()?.contains(document.activeElement));
|
|
1124
1124
|
}, { onUpdate: () => {
|
|
1125
1125
|
e.getRootElement() || c(e.getEditorState());
|
|
1126
1126
|
} }));
|
|
@@ -1129,11 +1129,11 @@ var $n = (e) => {
|
|
|
1129
1129
|
c,
|
|
1130
1130
|
t
|
|
1131
1131
|
]), c;
|
|
1132
|
-
},
|
|
1132
|
+
}, pr = 250, mr = () => {
|
|
1133
1133
|
let [e] = z(), t = u(0);
|
|
1134
|
-
return s(() => e.registerCommand(
|
|
1134
|
+
return s(() => e.registerCommand(Le, (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 >= pr) 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 $n = (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 = _e();
|
|
1145
|
+
at(i, {
|
|
1146
1146
|
"background-color": "",
|
|
1147
1147
|
color: "",
|
|
1148
1148
|
"font-size": "",
|
|
@@ -1152,23 +1152,23 @@ var $n = (e) => {
|
|
|
1152
1152
|
}), o.replace(s), s.select();
|
|
1153
1153
|
let c = s.getPreviousSibling();
|
|
1154
1154
|
return c?.getTextContent().trim() === "" && c.remove(), e?.preventDefault(), !0;
|
|
1155
|
-
},
|
|
1156
|
-
},
|
|
1155
|
+
}, Ae), [e]), null;
|
|
1156
|
+
}, hr = (e, t) => e.split(";").map((e) => e.trim()).filter((e) => e && e.split(":")[0].trim().toLowerCase() !== t).join("; "), gr = () => {
|
|
1157
1157
|
let [e] = z();
|
|
1158
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(_e(), !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 = hr(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 Ue {
|
|
1172
1172
|
static getType() {
|
|
1173
1173
|
return "extended-text";
|
|
1174
1174
|
}
|
|
@@ -1176,7 +1176,7 @@ var $n = (e) => {
|
|
|
1176
1176
|
return new e(t.__text, t.__key);
|
|
1177
1177
|
}
|
|
1178
1178
|
static importDOM() {
|
|
1179
|
-
let e =
|
|
1179
|
+
let e = Ue.importDOM();
|
|
1180
1180
|
return {
|
|
1181
1181
|
...e,
|
|
1182
1182
|
code: () => ({
|
|
@@ -1206,17 +1206,28 @@ var $n = (e) => {
|
|
|
1206
1206
|
};
|
|
1207
1207
|
}
|
|
1208
1208
|
static importJSON(e) {
|
|
1209
|
-
return
|
|
1209
|
+
return _r().updateFromJSON(e);
|
|
1210
1210
|
}
|
|
1211
1211
|
isSimpleText() {
|
|
1212
1212
|
return this.__type === "extended-text" && this.__mode === 0;
|
|
1213
1213
|
}
|
|
1214
|
-
|
|
1214
|
+
createDOM(e, t) {
|
|
1215
|
+
let n = super.createDOM(e, t);
|
|
1216
|
+
return this.dropInlineTextDecorationIfFormatted(n), n;
|
|
1217
|
+
}
|
|
1218
|
+
updateDOM(e, t, n) {
|
|
1219
|
+
let r = super.updateDOM(e, t, n);
|
|
1220
|
+
return r || this.dropInlineTextDecorationIfFormatted(t), r;
|
|
1221
|
+
}
|
|
1222
|
+
dropInlineTextDecorationIfFormatted(e) {
|
|
1223
|
+
(this.hasFormat("underline") || this.hasFormat("strikethrough")) && e.style.removeProperty("text-decoration");
|
|
1224
|
+
}
|
|
1225
|
+
}, _r = (e = "") => he(new q(e)), J = (e) => (t) => {
|
|
1215
1226
|
let n = e?.(t);
|
|
1216
1227
|
if (!n) return null;
|
|
1217
1228
|
let r = n.conversion(t);
|
|
1218
1229
|
if (!r) return r;
|
|
1219
|
-
let i = t.style.backgroundColor, a = t.style.color, o = t.style.fontFamily, s = t.style.fontWeight, c = t.style.fontSize
|
|
1230
|
+
let i = t.style.backgroundColor, a = t.style.color, o = t.style.fontFamily, s = t.style.fontWeight, c = t.style.fontSize;
|
|
1220
1231
|
return {
|
|
1221
1232
|
...r,
|
|
1222
1233
|
forChild: (e, t) => {
|
|
@@ -1227,61 +1238,60 @@ var $n = (e) => {
|
|
|
1227
1238
|
a ? `color: ${a}` : null,
|
|
1228
1239
|
o ? `font-family: ${o}` : null,
|
|
1229
1240
|
s ? `font-weight: ${s}` : null,
|
|
1230
|
-
c ? `font-size: ${c}` : null
|
|
1231
|
-
l ? `text-decoration: ${l}` : null
|
|
1241
|
+
c ? `font-size: ${c}` : null
|
|
1232
1242
|
].filter((e) => e !== null).join("; ");
|
|
1233
1243
|
if (e.length) return n.setStyle(e);
|
|
1234
1244
|
}
|
|
1235
1245
|
return n;
|
|
1236
1246
|
}
|
|
1237
1247
|
};
|
|
1238
|
-
},
|
|
1248
|
+
}, vr = () => {
|
|
1239
1249
|
let [e] = z();
|
|
1240
1250
|
return s(() => e.registerNodeTransform(q, (e) => {
|
|
1241
1251
|
if (!B(e, v)) return;
|
|
1242
1252
|
let t = e.getStyle();
|
|
1243
1253
|
if (!t) return;
|
|
1244
|
-
let n =
|
|
1254
|
+
let n = hr(t, "color");
|
|
1245
1255
|
n !== t && e.setStyle(n);
|
|
1246
1256
|
}), [e]), null;
|
|
1247
|
-
},
|
|
1257
|
+
}, yr = /<img\b|<picture\b/i, br = () => {
|
|
1248
1258
|
let [e] = z();
|
|
1249
1259
|
return s(() => {
|
|
1250
1260
|
let t = (t) => {
|
|
1251
1261
|
let n = "clipboardData" in t ? t.clipboardData : "dataTransfer" in t ? t.dataTransfer : null;
|
|
1252
1262
|
if (!n || n.getData("application/x-lexical-editor") || n.getData("application/x-lexical-drag")) return !1;
|
|
1253
1263
|
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/")) ||
|
|
1264
|
+
if (!(Array.from(n.files).some((e) => e.type.startsWith("image/")) || Array.from(n.items).some((e) => e.type.startsWith("image/")) || yr.test(r))) return !1;
|
|
1255
1265
|
t.preventDefault();
|
|
1256
1266
|
let i = n.getData("text/plain");
|
|
1257
|
-
return !
|
|
1267
|
+
return !yr.test(r) && !i || e.update(() => {
|
|
1258
1268
|
let t = L();
|
|
1259
1269
|
if (t === null) return;
|
|
1260
1270
|
let n = r ? new DOMParser().parseFromString(r, "text/html") : null;
|
|
1261
1271
|
if (n?.querySelectorAll("img, picture").forEach((e) => e.remove()), (n?.body.innerHTML ?? "") && n?.body.textContent?.trim()) {
|
|
1262
|
-
let t =
|
|
1272
|
+
let t = et(e, n);
|
|
1263
1273
|
if (t.length) {
|
|
1264
1274
|
be(t);
|
|
1265
1275
|
return;
|
|
1266
1276
|
}
|
|
1267
1277
|
}
|
|
1268
1278
|
i && t.insertRawText(i);
|
|
1269
|
-
}, { tag:
|
|
1279
|
+
}, { tag: Ve }), !0;
|
|
1270
1280
|
};
|
|
1271
|
-
return
|
|
1281
|
+
return rt(e.registerCommand(Be, t, ke), e.registerCommand(je, t, ke));
|
|
1272
1282
|
}, [e]), null;
|
|
1273
|
-
},
|
|
1283
|
+
}, xr = "data:image/png;base64,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", Sr = "data:image/png;base64,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", Cr = (e, t, n) => Math.min(n, Math.max(t, e)), Y = (e) => Cr(e, 0, 1), X = (e) => {
|
|
1274
1284
|
let t = e.trim().toLowerCase();
|
|
1275
1285
|
if (t === "" || t === "transparent") return !0;
|
|
1276
1286
|
let n = t.match(/^rgba\([^,]+,[^,]+,[^,]+,\s*([.\d]+)\s*\)$/);
|
|
1277
1287
|
return n !== null && Number(n[1]) === 0;
|
|
1278
|
-
},
|
|
1288
|
+
}, wr = (e) => {
|
|
1279
1289
|
let t = e.trim().replace(/^#/, "");
|
|
1280
1290
|
return /^[0-9a-fA-F]{3}$/.test(t) ? `#${t[0]}${t[0]}${t[1]}${t[1]}${t[2]}${t[2]}`.toLowerCase() : /^[0-9a-fA-F]{6}$/.test(t) ? `#${t.toLowerCase()}` : null;
|
|
1281
|
-
},
|
|
1291
|
+
}, Tr = (e) => {
|
|
1282
1292
|
let t = e.trim();
|
|
1283
1293
|
if (X(t)) return null;
|
|
1284
|
-
let n =
|
|
1294
|
+
let n = wr(t);
|
|
1285
1295
|
if (n) return {
|
|
1286
1296
|
r: Number.parseInt(n.slice(1, 3), 16),
|
|
1287
1297
|
g: Number.parseInt(n.slice(3, 5), 16),
|
|
@@ -1293,59 +1303,59 @@ var $n = (e) => {
|
|
|
1293
1303
|
g: Number(r[2]),
|
|
1294
1304
|
b: Number(r[3])
|
|
1295
1305
|
} : null;
|
|
1296
|
-
},
|
|
1306
|
+
}, Er = ({ r: e, g: t, b: n }) => `#${[
|
|
1297
1307
|
e,
|
|
1298
1308
|
t,
|
|
1299
1309
|
n
|
|
1300
|
-
].map((e) =>
|
|
1310
|
+
].map((e) => Cr(Math.round(e), 0, 255).toString(16).padStart(2, "0")).join("")}`, Dr = (e, t) => {
|
|
1301
1311
|
if (X(e) && X(t)) return !0;
|
|
1302
|
-
let n =
|
|
1312
|
+
let n = Tr(e), r = Tr(t);
|
|
1303
1313
|
return !!(n && r && n.r === r.r && n.g === r.g && n.b === r.b);
|
|
1304
|
-
},
|
|
1314
|
+
}, Or = (e) => {
|
|
1305
1315
|
let t = e.r / 255, n = e.g / 255, r = e.b / 255, i = Math.max(t, n, r), a = Math.min(t, n, r), o = (i + a) / 2, s = i - a, c = 0;
|
|
1306
1316
|
return s !== 0 && (c = i === t ? ((n - r) / s + (n < r ? 6 : 0)) * 60 : i === n ? ((r - t) / s + 2) * 60 : ((t - n) / s + 4) * 60), {
|
|
1307
1317
|
h: c,
|
|
1308
1318
|
s: s === 0 ? 0 : s / (1 - Math.abs(2 * o - 1)),
|
|
1309
1319
|
l: o
|
|
1310
1320
|
};
|
|
1311
|
-
},
|
|
1321
|
+
}, kr = ({ h: e, s: t, l: n }) => {
|
|
1312
1322
|
let r = (e % 360 + 360) % 360, i = (1 - Math.abs(2 * n - 1)) * t, a = i * (1 - Math.abs(r / 60 % 2 - 1)), o = n - i / 2, s = 0, c = 0, l = 0;
|
|
1313
1323
|
return r < 60 ? (s = i, c = a) : r < 120 ? (s = a, c = i) : r < 180 ? (c = i, l = a) : r < 240 ? (c = a, l = i) : r < 300 ? (s = a, l = i) : (s = i, l = a), {
|
|
1314
1324
|
r: Math.round((s + o) * 255),
|
|
1315
1325
|
g: Math.round((c + o) * 255),
|
|
1316
1326
|
b: Math.round((l + o) * 255)
|
|
1317
1327
|
};
|
|
1318
|
-
},
|
|
1328
|
+
}, Ar = (e) => Er(kr(e)), jr = (e, t) => ({
|
|
1319
1329
|
h: Y(e) * 360,
|
|
1320
1330
|
s: 1,
|
|
1321
1331
|
l: Y(1 - t)
|
|
1322
|
-
}),
|
|
1332
|
+
}), Mr = (e) => ({
|
|
1323
1333
|
x: Y((e.h % 360 + 360) % 360 / 360),
|
|
1324
1334
|
y: Y(1 - e.l)
|
|
1325
|
-
}),
|
|
1335
|
+
}), Nr = (e, t, n) => ({
|
|
1326
1336
|
x: Y(n.width === 0 ? 0 : (e - n.left) / n.width),
|
|
1327
1337
|
y: Y(n.height === 0 ? 0 : (t - n.top) / n.height)
|
|
1328
|
-
}),
|
|
1329
|
-
let r =
|
|
1338
|
+
}), Pr = (e, t, n = Infinity) => {
|
|
1339
|
+
let r = Tr(t);
|
|
1330
1340
|
if (!r) return e;
|
|
1331
|
-
let i =
|
|
1332
|
-
return [i, ...e.filter((e) => !
|
|
1333
|
-
},
|
|
1341
|
+
let i = Er(r);
|
|
1342
|
+
return [i, ...e.filter((e) => !Dr(e, i))].slice(0, n);
|
|
1343
|
+
}, Fr = (e, t = 24, n = 8) => Math.max(0, Math.floor((e + n) / (t + n))), Ir = (e, t) => {
|
|
1334
1344
|
let n = t % 11;
|
|
1335
1345
|
return Math.floor(t / 11) === 2 ? e[22] ?? e[t] : e[n] ?? e[t];
|
|
1336
|
-
}, Z = (...e) => e.filter(Boolean).join(" "),
|
|
1337
|
-
let t =
|
|
1346
|
+
}, Z = (...e) => e.filter(Boolean).join(" "), Lr = (e) => {
|
|
1347
|
+
let t = Tr(e) ?? {
|
|
1338
1348
|
r: 0,
|
|
1339
1349
|
g: 94,
|
|
1340
1350
|
b: 239
|
|
1341
1351
|
};
|
|
1342
1352
|
return {
|
|
1343
|
-
color:
|
|
1344
|
-
point:
|
|
1353
|
+
color: Er(t),
|
|
1354
|
+
point: Mr(Or(t))
|
|
1345
1355
|
};
|
|
1346
|
-
},
|
|
1347
|
-
let { t: l } = e(), [f, h] = d("presets"), [g, _] = d(() =>
|
|
1348
|
-
_(
|
|
1356
|
+
}, Rr = ({ mode: t, currentColor: r, customColors: i, onApply: a, onCustomDraftChange: o, onCustomConfirm: c }) => {
|
|
1357
|
+
let { t: l } = e(), [f, h] = d("presets"), [g, _] = d(() => Lr(r)), [v, y] = d(!1), [b, x] = d(null), S = u(null), C = u(null), w = u(null), T = (e = r) => {
|
|
1358
|
+
_(Lr(e)), y(!1), o(null), h("custom");
|
|
1349
1359
|
};
|
|
1350
1360
|
s(() => {
|
|
1351
1361
|
if (f !== "custom" || typeof ResizeObserver > "u") return;
|
|
@@ -1374,7 +1384,7 @@ var $n = (e) => {
|
|
|
1374
1384
|
if (!e) return;
|
|
1375
1385
|
let t = () => {
|
|
1376
1386
|
let t = e.getBoundingClientRect().width;
|
|
1377
|
-
t > 0 && x(
|
|
1387
|
+
t > 0 && x(Fr(t));
|
|
1378
1388
|
};
|
|
1379
1389
|
if (t(), typeof ResizeObserver > "u") return;
|
|
1380
1390
|
let n = new ResizeObserver(t);
|
|
@@ -1383,7 +1393,7 @@ var $n = (e) => {
|
|
|
1383
1393
|
let E = (e) => {
|
|
1384
1394
|
let t = S.current;
|
|
1385
1395
|
if (!t) return;
|
|
1386
|
-
let { x: n, y: r } =
|
|
1396
|
+
let { x: n, y: r } = Nr(e.clientX, e.clientY, t.getBoundingClientRect()), i = Ar(jr(n, r));
|
|
1387
1397
|
_({
|
|
1388
1398
|
color: i,
|
|
1389
1399
|
point: {
|
|
@@ -1422,7 +1432,7 @@ var $n = (e) => {
|
|
|
1422
1432
|
role: "listbox",
|
|
1423
1433
|
"aria-label": l("editor.customColors"),
|
|
1424
1434
|
children: i.slice(0, b ?? i.length).map((e) => {
|
|
1425
|
-
let t =
|
|
1435
|
+
let t = Dr(r, e);
|
|
1426
1436
|
return /* @__PURE__ */ p("button", {
|
|
1427
1437
|
type: "button",
|
|
1428
1438
|
role: "option",
|
|
@@ -1499,8 +1509,8 @@ var $n = (e) => {
|
|
|
1499
1509
|
className: V["bsy-mobile-editor__color-grid"],
|
|
1500
1510
|
role: "listbox",
|
|
1501
1511
|
"aria-label": l("editor.presetColors"),
|
|
1502
|
-
children:
|
|
1503
|
-
let n =
|
|
1512
|
+
children: dt.map((e, t) => {
|
|
1513
|
+
let n = Dr(r, e);
|
|
1504
1514
|
return /* @__PURE__ */ p("button", {
|
|
1505
1515
|
type: "button",
|
|
1506
1516
|
role: "option",
|
|
@@ -1509,7 +1519,7 @@ var $n = (e) => {
|
|
|
1509
1519
|
className: Z(V["bsy-mobile-editor__color-swatch"], n && V["bsy-mobile-editor__color-swatch--selected"]),
|
|
1510
1520
|
style: {
|
|
1511
1521
|
"--swatch-color": e,
|
|
1512
|
-
"--swatch-ring":
|
|
1522
|
+
"--swatch-ring": Ir(dt, t)
|
|
1513
1523
|
},
|
|
1514
1524
|
onClick: () => a(e),
|
|
1515
1525
|
children: /* @__PURE__ */ p("span", { className: V["bsy-mobile-editor__color-swatch-fill"] })
|
|
@@ -1519,122 +1529,115 @@ var $n = (e) => {
|
|
|
1519
1529
|
A
|
|
1520
1530
|
]
|
|
1521
1531
|
});
|
|
1522
|
-
},
|
|
1532
|
+
}, zr = (e, t) => {
|
|
1523
1533
|
H(e), e.update(() => {
|
|
1524
|
-
|
|
1534
|
+
ot(L(), () => t === "paragraph" ? _e() : ne(t));
|
|
1525
1535
|
});
|
|
1526
|
-
},
|
|
1536
|
+
}, Br = (e, t, n) => {
|
|
1527
1537
|
H(e), e.update(() => {
|
|
1528
|
-
|
|
1538
|
+
Wt(n), Gt();
|
|
1529
1539
|
let e = L();
|
|
1530
|
-
e &&
|
|
1540
|
+
e && at(e, t);
|
|
1531
1541
|
});
|
|
1532
|
-
},
|
|
1533
|
-
let [
|
|
1534
|
-
|
|
1535
|
-
},
|
|
1536
|
-
|
|
1542
|
+
}, Vr = ({ sheet: i, formats: a, onClose: o, onTypeset: s, onPolishMenu: c, onPickPreset: l, onPicture: h, savedSelectionRef: g, committedColors: _, onColorCommit: v, canTypeset: y, canPolish: b }) => {
|
|
1543
|
+
let [x] = z(), { t: S } = e(), [C, w] = d([]), T = u(null), E = i === "fontColor" || i === "fill" ? i : null, D = E === "fill" ? _.fill : E === "fontColor" ? _.fontColor : lt, O = (e, t = !1, n = !0) => {
|
|
1544
|
+
E && (n && (T.current = null), Br(x, { [E === "fill" ? "background-color" : "color"]: e }, g.current), v(E, e), t && !X(e) && w((t) => Pr(t, e)), n && o());
|
|
1545
|
+
}, k = (e) => {
|
|
1546
|
+
T.current = null, O(e, !0, !1);
|
|
1537
1547
|
};
|
|
1538
1548
|
return /* @__PURE__ */ m(f, { children: [
|
|
1539
1549
|
/* @__PURE__ */ p(r, {
|
|
1540
|
-
mode: "menu",
|
|
1541
1550
|
open: i === "align",
|
|
1542
|
-
title:
|
|
1543
|
-
onClose:
|
|
1551
|
+
title: S("editor.alignment"),
|
|
1552
|
+
onClose: o,
|
|
1544
1553
|
actions: [
|
|
1545
1554
|
{
|
|
1546
1555
|
key: "left",
|
|
1547
|
-
text:
|
|
1548
|
-
|
|
1549
|
-
name: "paragraph",
|
|
1550
|
-
size: 16
|
|
1551
|
-
})
|
|
1556
|
+
text: S("editor.leftAlign"),
|
|
1557
|
+
selected: a.align === "left"
|
|
1552
1558
|
},
|
|
1553
1559
|
{
|
|
1554
1560
|
key: "center",
|
|
1555
|
-
text:
|
|
1556
|
-
|
|
1557
|
-
name: "paragraphmiddle",
|
|
1558
|
-
size: 16
|
|
1559
|
-
})
|
|
1561
|
+
text: S("editor.centerAlign"),
|
|
1562
|
+
selected: a.align === "center"
|
|
1560
1563
|
},
|
|
1561
1564
|
{
|
|
1562
1565
|
key: "right",
|
|
1563
|
-
text:
|
|
1564
|
-
|
|
1565
|
-
name: "paragraphright",
|
|
1566
|
-
size: 16
|
|
1567
|
-
})
|
|
1566
|
+
text: S("editor.rightAlign"),
|
|
1567
|
+
selected: a.align === "right"
|
|
1568
1568
|
}
|
|
1569
1569
|
],
|
|
1570
1570
|
onAction: (e) => {
|
|
1571
|
-
H(
|
|
1571
|
+
H(x), x.dispatchCommand(Ne, e.key);
|
|
1572
1572
|
}
|
|
1573
1573
|
}),
|
|
1574
1574
|
/* @__PURE__ */ p(r, {
|
|
1575
|
-
mode: "menu",
|
|
1576
1575
|
open: i === "heading",
|
|
1577
|
-
title:
|
|
1578
|
-
onClose:
|
|
1576
|
+
title: S("editor.heading"),
|
|
1577
|
+
onClose: o,
|
|
1579
1578
|
actions: [
|
|
1580
1579
|
{
|
|
1581
1580
|
key: "paragraph",
|
|
1582
|
-
text:
|
|
1581
|
+
text: S("editor.paragraph"),
|
|
1582
|
+
selected: a.headingTag === !1
|
|
1583
1583
|
},
|
|
1584
1584
|
{
|
|
1585
1585
|
key: "h1",
|
|
1586
|
-
text:
|
|
1586
|
+
text: S("editor.heading1"),
|
|
1587
|
+
selected: a.headingTag === "h1"
|
|
1587
1588
|
},
|
|
1588
1589
|
{
|
|
1589
1590
|
key: "h2",
|
|
1590
|
-
text:
|
|
1591
|
+
text: S("editor.heading2"),
|
|
1592
|
+
selected: a.headingTag === "h2"
|
|
1591
1593
|
},
|
|
1592
1594
|
{
|
|
1593
1595
|
key: "h3",
|
|
1594
|
-
text:
|
|
1596
|
+
text: S("editor.heading3"),
|
|
1597
|
+
selected: a.headingTag === "h3"
|
|
1595
1598
|
}
|
|
1596
1599
|
],
|
|
1597
|
-
onAction: (e) =>
|
|
1600
|
+
onAction: (e) => zr(x, e.key)
|
|
1598
1601
|
}),
|
|
1599
1602
|
/* @__PURE__ */ p(r, {
|
|
1600
|
-
mode: "menu",
|
|
1601
1603
|
open: i === "fontSize",
|
|
1602
|
-
title:
|
|
1603
|
-
onClose:
|
|
1604
|
-
actions:
|
|
1604
|
+
title: S("editor.fontSize"),
|
|
1605
|
+
onClose: o,
|
|
1606
|
+
actions: st.map((e) => ({
|
|
1605
1607
|
key: e.value,
|
|
1606
|
-
text: e.label
|
|
1608
|
+
text: e.label,
|
|
1609
|
+
selected: e.value === a.fontSize
|
|
1607
1610
|
})),
|
|
1608
|
-
onAction: (e) =>
|
|
1611
|
+
onAction: (e) => Br(x, { "font-size": e.key })
|
|
1609
1612
|
}),
|
|
1610
1613
|
/* @__PURE__ */ p(t, {
|
|
1611
|
-
open:
|
|
1614
|
+
open: E !== null,
|
|
1612
1615
|
onClose: () => {
|
|
1613
|
-
let e =
|
|
1614
|
-
e &&
|
|
1616
|
+
let e = T.current;
|
|
1617
|
+
e && k(e), o();
|
|
1615
1618
|
},
|
|
1616
1619
|
position: "bottom",
|
|
1617
|
-
children:
|
|
1618
|
-
mode:
|
|
1619
|
-
currentColor:
|
|
1620
|
-
customColors:
|
|
1621
|
-
onApply:
|
|
1620
|
+
children: E ? /* @__PURE__ */ p(Rr, {
|
|
1621
|
+
mode: E,
|
|
1622
|
+
currentColor: D,
|
|
1623
|
+
customColors: C,
|
|
1624
|
+
onApply: O,
|
|
1622
1625
|
onCustomDraftChange: (e) => {
|
|
1623
|
-
|
|
1626
|
+
T.current = e;
|
|
1624
1627
|
},
|
|
1625
|
-
onCustomConfirm:
|
|
1626
|
-
},
|
|
1628
|
+
onCustomConfirm: k
|
|
1629
|
+
}, E) : null
|
|
1627
1630
|
}),
|
|
1628
1631
|
/* @__PURE__ */ p(r, {
|
|
1629
1632
|
mode: "menu",
|
|
1630
1633
|
open: i === "ai",
|
|
1631
|
-
onClose:
|
|
1634
|
+
onClose: o,
|
|
1632
1635
|
actions: [{
|
|
1633
1636
|
key: "typeset",
|
|
1634
|
-
text:
|
|
1635
|
-
disabled: !
|
|
1637
|
+
text: S("editor.aiTypeset"),
|
|
1638
|
+
disabled: !y,
|
|
1636
1639
|
icon: /* @__PURE__ */ p("img", {
|
|
1637
|
-
src:
|
|
1640
|
+
src: xr,
|
|
1638
1641
|
alt: "",
|
|
1639
1642
|
width: 16,
|
|
1640
1643
|
height: 16,
|
|
@@ -1643,10 +1646,10 @@ var $n = (e) => {
|
|
|
1643
1646
|
})
|
|
1644
1647
|
}, {
|
|
1645
1648
|
key: "polish",
|
|
1646
|
-
text:
|
|
1647
|
-
disabled: !
|
|
1649
|
+
text: S("editor.aiPolish"),
|
|
1650
|
+
disabled: !b,
|
|
1648
1651
|
icon: /* @__PURE__ */ p("img", {
|
|
1649
|
-
src:
|
|
1652
|
+
src: Sr,
|
|
1650
1653
|
alt: "",
|
|
1651
1654
|
width: 16,
|
|
1652
1655
|
height: 16,
|
|
@@ -1656,47 +1659,47 @@ var $n = (e) => {
|
|
|
1656
1659
|
}],
|
|
1657
1660
|
onAction: (e) => {
|
|
1658
1661
|
if (e.key === "typeset") {
|
|
1659
|
-
|
|
1662
|
+
s();
|
|
1660
1663
|
return;
|
|
1661
1664
|
}
|
|
1662
|
-
|
|
1665
|
+
c();
|
|
1663
1666
|
}
|
|
1664
1667
|
}),
|
|
1665
1668
|
/* @__PURE__ */ p(r, {
|
|
1666
1669
|
mode: "menu",
|
|
1667
1670
|
open: i === "aiPreset",
|
|
1668
|
-
title:
|
|
1669
|
-
onClose:
|
|
1670
|
-
actions:
|
|
1671
|
+
title: S("editor.aiPolish"),
|
|
1672
|
+
onClose: o,
|
|
1673
|
+
actions: ft.map((e) => ({
|
|
1671
1674
|
key: e,
|
|
1672
|
-
text:
|
|
1675
|
+
text: S(pt[e])
|
|
1673
1676
|
})),
|
|
1674
|
-
onAction: (e) =>
|
|
1677
|
+
onAction: (e) => l(e.key)
|
|
1675
1678
|
}),
|
|
1676
1679
|
/* @__PURE__ */ p(r, {
|
|
1677
1680
|
mode: "menu",
|
|
1678
1681
|
open: i === "picture",
|
|
1679
|
-
title:
|
|
1680
|
-
onClose:
|
|
1682
|
+
title: S("editor.picture"),
|
|
1683
|
+
onClose: o,
|
|
1681
1684
|
actions: [{
|
|
1682
1685
|
key: "upload",
|
|
1683
|
-
text:
|
|
1686
|
+
text: S("editor.uploadImage"),
|
|
1684
1687
|
icon: /* @__PURE__ */ p(n, {
|
|
1685
1688
|
name: "picture",
|
|
1686
1689
|
size: 16
|
|
1687
1690
|
})
|
|
1688
1691
|
}, {
|
|
1689
1692
|
key: "url",
|
|
1690
|
-
text:
|
|
1693
|
+
text: S("editor.imageUrl"),
|
|
1691
1694
|
icon: /* @__PURE__ */ p(n, {
|
|
1692
1695
|
name: "Insertlink",
|
|
1693
1696
|
size: 16
|
|
1694
1697
|
})
|
|
1695
1698
|
}],
|
|
1696
|
-
onAction: (e) =>
|
|
1699
|
+
onAction: (e) => h(e.key)
|
|
1697
1700
|
})
|
|
1698
1701
|
] });
|
|
1699
|
-
},
|
|
1702
|
+
}, Hr = ({ open: r, title: i, bodyClassName: a, onClose: o, onConfirm: s, children: c }) => {
|
|
1700
1703
|
let { t: l } = e();
|
|
1701
1704
|
return /* @__PURE__ */ p(t, {
|
|
1702
1705
|
open: r,
|
|
@@ -1741,11 +1744,11 @@ var $n = (e) => {
|
|
|
1741
1744
|
]
|
|
1742
1745
|
})
|
|
1743
1746
|
});
|
|
1744
|
-
},
|
|
1747
|
+
}, Ur = ({ open: t, seed: r, onClose: i, onConfirm: a }) => {
|
|
1745
1748
|
let { t: o } = e(), [c, l] = d(""), [u, f] = d(""), [h, g] = d(!0);
|
|
1746
1749
|
return s(() => {
|
|
1747
1750
|
!t || !r || (l(r.url), f(r.text), g(r.newBlank));
|
|
1748
|
-
}, [t, r]), /* @__PURE__ */ m(
|
|
1751
|
+
}, [t, r]), /* @__PURE__ */ m(Hr, {
|
|
1749
1752
|
open: t,
|
|
1750
1753
|
title: o("editor.link"),
|
|
1751
1754
|
bodyClassName: V["bsy-mobile-editor__sheet-body--stack"],
|
|
@@ -1807,13 +1810,13 @@ var $n = (e) => {
|
|
|
1807
1810
|
})
|
|
1808
1811
|
]
|
|
1809
1812
|
});
|
|
1810
|
-
},
|
|
1813
|
+
}, Wr = /^https?:\/\/.+/i, Gr = ({ open: t, onClose: n, onConfirm: r }) => {
|
|
1811
1814
|
let { t: i } = e(), [o, c] = d(""), [l, u] = d(null), f = a((e) => {
|
|
1812
1815
|
e?.focus();
|
|
1813
1816
|
}, []);
|
|
1814
1817
|
return s(() => {
|
|
1815
1818
|
t && (c(""), u(null));
|
|
1816
|
-
}, [t]), /* @__PURE__ */ p(
|
|
1819
|
+
}, [t]), /* @__PURE__ */ p(Hr, {
|
|
1817
1820
|
open: t,
|
|
1818
1821
|
title: i("editor.imageUrl"),
|
|
1819
1822
|
onClose: n,
|
|
@@ -1823,7 +1826,7 @@ var $n = (e) => {
|
|
|
1823
1826
|
u(i("editor.imageUrlRequired"));
|
|
1824
1827
|
return;
|
|
1825
1828
|
}
|
|
1826
|
-
if (!
|
|
1829
|
+
if (!Wr.test(e)) {
|
|
1827
1830
|
u(i("editor.imageUrlInvalid"));
|
|
1828
1831
|
return;
|
|
1829
1832
|
}
|
|
@@ -1856,13 +1859,16 @@ var $n = (e) => {
|
|
|
1856
1859
|
]
|
|
1857
1860
|
})
|
|
1858
1861
|
});
|
|
1859
|
-
},
|
|
1862
|
+
}, Kr = `
|
|
1860
1863
|
:host {
|
|
1861
1864
|
all: initial;
|
|
1862
1865
|
display: block;
|
|
1866
|
+
box-sizing: border-box;
|
|
1863
1867
|
width: 100%;
|
|
1864
1868
|
max-width: 100%;
|
|
1865
1869
|
min-width: 0;
|
|
1870
|
+
overflow-x: auto;
|
|
1871
|
+
-webkit-overflow-scrolling: touch;
|
|
1866
1872
|
}
|
|
1867
1873
|
.bsy-editor-html-preview__body {
|
|
1868
1874
|
color: #030303;
|
|
@@ -1949,7 +1955,7 @@ var $n = (e) => {
|
|
|
1949
1955
|
.bsy-editor-html-preview__body li,
|
|
1950
1956
|
.bsy-editor-html-preview__body .editor-listitem {
|
|
1951
1957
|
margin: 0;
|
|
1952
|
-
margin-inline-start: ${
|
|
1958
|
+
margin-inline-start: ${Pt};
|
|
1953
1959
|
list-style: inherit;
|
|
1954
1960
|
}
|
|
1955
1961
|
.bsy-editor-html-preview__body .editor-nested-listitem {
|
|
@@ -2028,15 +2034,15 @@ var $n = (e) => {
|
|
|
2028
2034
|
height: auto;
|
|
2029
2035
|
vertical-align: baseline;
|
|
2030
2036
|
}
|
|
2031
|
-
`,
|
|
2037
|
+
`, qr = ({ html: e }) => {
|
|
2032
2038
|
let t = u(null);
|
|
2033
2039
|
return l(() => {
|
|
2034
|
-
|
|
2040
|
+
zt(t.current, e, U, Kr);
|
|
2035
2041
|
}, [e]), /* @__PURE__ */ p("div", {
|
|
2036
2042
|
ref: t,
|
|
2037
2043
|
className: "bsy-editor-html-preview"
|
|
2038
2044
|
});
|
|
2039
|
-
},
|
|
2045
|
+
}, Jr = () => {
|
|
2040
2046
|
let e = `${c().replace(/:/g, "")}g`;
|
|
2041
2047
|
return /* @__PURE__ */ p("span", {
|
|
2042
2048
|
className: V["bsy-mobile-editor__ai-think-icon"],
|
|
@@ -2075,7 +2081,7 @@ var $n = (e) => {
|
|
|
2075
2081
|
}) })]
|
|
2076
2082
|
})
|
|
2077
2083
|
});
|
|
2078
|
-
},
|
|
2084
|
+
}, Yr = (t, n) => {
|
|
2079
2085
|
let { t: r } = e(), i = t.status === "loading" && !n, [a, o] = d(!0), [c, l] = d(0), f = u(Date.now()), p = u(null), m = t.reasoning ?? "";
|
|
2080
2086
|
return s(() => {
|
|
2081
2087
|
if (!i) {
|
|
@@ -2095,12 +2101,12 @@ var $n = (e) => {
|
|
|
2095
2101
|
reasoning: m,
|
|
2096
2102
|
toggle: () => o((e) => !e)
|
|
2097
2103
|
};
|
|
2098
|
-
},
|
|
2104
|
+
}, Xr = ({ model: e }) => /* @__PURE__ */ m("button", {
|
|
2099
2105
|
type: "button",
|
|
2100
2106
|
className: V["bsy-mobile-editor__ai-think-head"],
|
|
2101
2107
|
disabled: e.thinking,
|
|
2102
2108
|
onClick: e.toggle,
|
|
2103
|
-
children: [e.thinking ? /* @__PURE__ */ p(
|
|
2109
|
+
children: [e.thinking ? /* @__PURE__ */ p(Jr, {}) : /* @__PURE__ */ p(n, {
|
|
2104
2110
|
name: "arrow-down",
|
|
2105
2111
|
size: 12,
|
|
2106
2112
|
className: [V["bsy-mobile-editor__ai-think-arrow"], e.open ? V["bsy-mobile-editor__ai-think-arrow--open"] : ""].filter(Boolean).join(" ")
|
|
@@ -2108,10 +2114,10 @@ var $n = (e) => {
|
|
|
2108
2114
|
className: e.thinking ? `${V["bsy-mobile-editor__ai-think-label"]} ${V["bsy-mobile-editor__ai-think-label--shimmer"]}` : V["bsy-mobile-editor__ai-think-label"],
|
|
2109
2115
|
children: e.label
|
|
2110
2116
|
})]
|
|
2111
|
-
}),
|
|
2117
|
+
}), Zr = ({ model: e }) => !e.visible || !e.open || !e.reasoning ? null : /* @__PURE__ */ p("div", {
|
|
2112
2118
|
className: V["bsy-mobile-editor__ai-think-body"],
|
|
2113
2119
|
children: e.reasoning
|
|
2114
|
-
}),
|
|
2120
|
+
}), Qr = ({ enabled: e, status: t, revision: n, compute: r }) => {
|
|
2115
2121
|
let [i, a] = d(""), o = u(r);
|
|
2116
2122
|
o.current = r;
|
|
2117
2123
|
let c = u(null);
|
|
@@ -2138,7 +2144,7 @@ var $n = (e) => {
|
|
|
2138
2144
|
]), s(() => () => {
|
|
2139
2145
|
c.current !== null && cancelAnimationFrame(c.current);
|
|
2140
2146
|
}, []), i;
|
|
2141
|
-
},
|
|
2147
|
+
}, $r = 32, ei = .25, ti = 2, ni = ({ viewportRef: e, enabled: t, revision: n }) => {
|
|
2142
2148
|
let r = u(!0), i = u(!1), o = u(0), c = a(() => e.current ?? void 0, [e]), l = a(() => {
|
|
2143
2149
|
o.current = 0;
|
|
2144
2150
|
let t = e.current;
|
|
@@ -2148,7 +2154,7 @@ var $n = (e) => {
|
|
|
2148
2154
|
t.scrollTop = n;
|
|
2149
2155
|
return;
|
|
2150
2156
|
}
|
|
2151
|
-
t.scrollTop += Math.max(i *
|
|
2157
|
+
t.scrollTop += Math.max(i * ei, Math.min(i, ti)), o.current = requestAnimationFrame(l);
|
|
2152
2158
|
}, [e]), d = a(() => {
|
|
2153
2159
|
!o.current && r.current && (o.current = requestAnimationFrame(l));
|
|
2154
2160
|
}, [l]);
|
|
@@ -2175,7 +2181,7 @@ var $n = (e) => {
|
|
|
2175
2181
|
let f = () => {
|
|
2176
2182
|
let t = e.current;
|
|
2177
2183
|
if (!t) return;
|
|
2178
|
-
let n = t.scrollHeight - t.clientHeight - t.scrollTop <=
|
|
2184
|
+
let n = t.scrollHeight - t.clientHeight - t.scrollTop <= $r;
|
|
2179
2185
|
i.current ? (i.current = !1, r.current = n, !n && o.current && (cancelAnimationFrame(o.current), o.current = 0)) : n && (r.current = !0);
|
|
2180
2186
|
}, p = () => {
|
|
2181
2187
|
i.current = !0;
|
|
@@ -2193,16 +2199,16 @@ var $n = (e) => {
|
|
|
2193
2199
|
passive: !0,
|
|
2194
2200
|
enable: t
|
|
2195
2201
|
}), { onScroll: f };
|
|
2196
|
-
},
|
|
2197
|
-
let { t: v } = e(), y = u(null), [b, x] = d(!1), S = c?.status ?? "idle", C = c?.text ?? "", w =
|
|
2202
|
+
}, ri = ({ open: i, mode: a, originalHtml: o, codeBlocks: s = [], ai: c, polishPreset: l, onClose: h, onApply: g, onPickPreset: _ }) => {
|
|
2203
|
+
let { t: v } = e(), y = u(null), [b, x] = d(!1), S = c?.status ?? "idle", C = c?.text ?? "", w = Qr({
|
|
2198
2204
|
enabled: i && !!a,
|
|
2199
2205
|
status: S,
|
|
2200
2206
|
revision: C,
|
|
2201
|
-
compute: () => a === "polish" ? U(
|
|
2202
|
-
}), T = !!w.trim(), E =
|
|
2207
|
+
compute: () => a === "polish" ? U(Mn(o, C)) : Xn(C, s)
|
|
2208
|
+
}), T = !!w.trim(), E = Yr({
|
|
2203
2209
|
status: S,
|
|
2204
2210
|
reasoning: c?.reasoning
|
|
2205
|
-
}, T), D =
|
|
2211
|
+
}, T), D = ni({
|
|
2206
2212
|
viewportRef: y,
|
|
2207
2213
|
enabled: i && S === "loading",
|
|
2208
2214
|
revision: `${c?.reasoning ?? ""}\0${w}`
|
|
@@ -2214,7 +2220,7 @@ var $n = (e) => {
|
|
|
2214
2220
|
closeOnClickOverlay: !1,
|
|
2215
2221
|
children: [/* @__PURE__ */ m("div", {
|
|
2216
2222
|
className: V["bsy-mobile-editor__ai"],
|
|
2217
|
-
style: { height:
|
|
2223
|
+
style: { height: _t },
|
|
2218
2224
|
children: [
|
|
2219
2225
|
/* @__PURE__ */ m("div", {
|
|
2220
2226
|
className: V["bsy-mobile-editor__header"],
|
|
@@ -2247,7 +2253,7 @@ var $n = (e) => {
|
|
|
2247
2253
|
type: "button",
|
|
2248
2254
|
className: V["bsy-mobile-editor__ai-preset"],
|
|
2249
2255
|
onClick: () => x(!0),
|
|
2250
|
-
children: [v(
|
|
2256
|
+
children: [v(pt[l]), /* @__PURE__ */ p(n, {
|
|
2251
2257
|
name: "arrow-down",
|
|
2252
2258
|
size: 16
|
|
2253
2259
|
})]
|
|
@@ -2255,7 +2261,7 @@ var $n = (e) => {
|
|
|
2255
2261
|
}),
|
|
2256
2262
|
E.visible ? /* @__PURE__ */ p("div", {
|
|
2257
2263
|
className: V["bsy-mobile-editor__ai-think-pin"],
|
|
2258
|
-
children: /* @__PURE__ */ p(
|
|
2264
|
+
children: /* @__PURE__ */ p(Xr, { model: E })
|
|
2259
2265
|
}) : null,
|
|
2260
2266
|
/* @__PURE__ */ p("div", {
|
|
2261
2267
|
ref: y,
|
|
@@ -2264,7 +2270,7 @@ var $n = (e) => {
|
|
|
2264
2270
|
children: S === "error" ? /* @__PURE__ */ p("p", {
|
|
2265
2271
|
className: V["bsy-mobile-editor__ai-error"],
|
|
2266
2272
|
children: c?.errorMessage || v("editor.aiError")
|
|
2267
|
-
}) : /* @__PURE__ */ m(f, { children: [/* @__PURE__ */ p(
|
|
2273
|
+
}) : /* @__PURE__ */ m(f, { children: [/* @__PURE__ */ p(Zr, { model: E }), T ? /* @__PURE__ */ p(qr, { html: w }) : null] })
|
|
2268
2274
|
})
|
|
2269
2275
|
]
|
|
2270
2276
|
}),
|
|
@@ -2279,7 +2285,7 @@ var $n = (e) => {
|
|
|
2279
2285
|
})
|
|
2280
2286
|
}), /* @__PURE__ */ p("div", {
|
|
2281
2287
|
className: V["bsy-mobile-editor__ai-section-scroll"],
|
|
2282
|
-
children: /* @__PURE__ */ p(
|
|
2288
|
+
children: /* @__PURE__ */ p(qr, { html: o })
|
|
2283
2289
|
})]
|
|
2284
2290
|
})
|
|
2285
2291
|
]
|
|
@@ -2304,35 +2310,35 @@ var $n = (e) => {
|
|
|
2304
2310
|
open: b,
|
|
2305
2311
|
title: v("editor.aiPolish"),
|
|
2306
2312
|
onClose: () => x(!1),
|
|
2307
|
-
actions:
|
|
2313
|
+
actions: ft.map((e) => ({
|
|
2308
2314
|
key: e,
|
|
2309
|
-
text: v(
|
|
2315
|
+
text: v(pt[e])
|
|
2310
2316
|
})),
|
|
2311
2317
|
onAction: (e) => _(e.key)
|
|
2312
2318
|
}) : null]
|
|
2313
2319
|
});
|
|
2314
|
-
},
|
|
2320
|
+
}, ii = "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", ai = "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", oi = 860.48, si = 99.52, ci = /rgba\(\s*0\s*,\s*0\s*,\s*0\s*,\s*0(?:\.0+)?\s*\)/, li = {
|
|
2315
2321
|
fontColor: {
|
|
2316
|
-
path:
|
|
2317
|
-
clipHeight:
|
|
2322
|
+
path: ii,
|
|
2323
|
+
clipHeight: oi,
|
|
2318
2324
|
x: 128,
|
|
2319
2325
|
width: 768,
|
|
2320
2326
|
rx: 0
|
|
2321
2327
|
},
|
|
2322
2328
|
fill: {
|
|
2323
|
-
path:
|
|
2329
|
+
path: ai,
|
|
2324
2330
|
clipHeight: 816,
|
|
2325
2331
|
x: 112,
|
|
2326
2332
|
width: 800,
|
|
2327
2333
|
rx: 8
|
|
2328
2334
|
}
|
|
2329
|
-
},
|
|
2335
|
+
}, ui = (e, t) => {
|
|
2330
2336
|
let n = t.trim().toLowerCase();
|
|
2331
|
-
if (e === "fill") return !n || n === "transparent" ||
|
|
2337
|
+
if (e === "fill") return !n || n === "transparent" || ci.test(n);
|
|
2332
2338
|
let r = n.replace(/\s+/g, "");
|
|
2333
2339
|
return r === "#000" || r === "#000000" || r === "black" || r === "rgb(0,0,0)" || r === "rgba(0,0,0,1)" || r === "rgba(0,0,0,1.0)";
|
|
2334
|
-
},
|
|
2335
|
-
let r = `${c().replace(/:/g, "")}clip`, i =
|
|
2340
|
+
}, di = ({ variant: e, barColor: t, size: n }) => {
|
|
2341
|
+
let r = `${c().replace(/:/g, "")}clip`, i = li[e];
|
|
2336
2342
|
return /* @__PURE__ */ m("svg", {
|
|
2337
2343
|
width: n,
|
|
2338
2344
|
height: n,
|
|
@@ -2355,21 +2361,22 @@ var $n = (e) => {
|
|
|
2355
2361
|
}),
|
|
2356
2362
|
/* @__PURE__ */ p("rect", {
|
|
2357
2363
|
x: i.x,
|
|
2358
|
-
y:
|
|
2364
|
+
y: oi,
|
|
2359
2365
|
width: i.width,
|
|
2360
|
-
height:
|
|
2366
|
+
height: si,
|
|
2361
2367
|
rx: i.rx,
|
|
2362
|
-
fill:
|
|
2368
|
+
fill: ui(e, t) ? "currentColor" : t
|
|
2363
2369
|
})
|
|
2364
2370
|
]
|
|
2365
2371
|
});
|
|
2366
|
-
},
|
|
2372
|
+
}, fi = {
|
|
2367
2373
|
bold: !1,
|
|
2368
2374
|
italic: !1,
|
|
2369
2375
|
underline: !1,
|
|
2370
2376
|
strikethrough: !1,
|
|
2371
|
-
|
|
2372
|
-
|
|
2377
|
+
fontSize: ct,
|
|
2378
|
+
fontColor: lt,
|
|
2379
|
+
backgroundColor: ut,
|
|
2373
2380
|
align: "left",
|
|
2374
2381
|
listType: !1,
|
|
2375
2382
|
canIndent: !0,
|
|
@@ -2377,59 +2384,60 @@ var $n = (e) => {
|
|
|
2377
2384
|
headingTag: !1,
|
|
2378
2385
|
hasRangeSelection: !1,
|
|
2379
2386
|
hasEditorText: !1
|
|
2380
|
-
},
|
|
2387
|
+
}, pi = (e) => e === "center" || e === "right" || e === "left" ? e : e === "end" ? "right" : "left", mi = (e) => {
|
|
2381
2388
|
let t = !!I().getTextContent().trim(), n = {
|
|
2382
|
-
...
|
|
2389
|
+
...fi,
|
|
2383
2390
|
hasEditorText: t
|
|
2384
2391
|
};
|
|
2385
2392
|
if (!e) return n;
|
|
2386
2393
|
let r = L();
|
|
2387
2394
|
if (!R(r)) return n;
|
|
2388
|
-
let i =
|
|
2395
|
+
let i = it(r, "font-size", ct), a = it(r, "color", lt), o = it(r, "background-color", ut), s = r.anchor.getNode(), c = s.getKey() === "root" ? s : B(s, (e) => {
|
|
2389
2396
|
let t = e.getParent();
|
|
2390
2397
|
return t !== null && Ce(t);
|
|
2391
2398
|
});
|
|
2392
|
-
|
|
2393
|
-
let
|
|
2394
|
-
if (S(
|
|
2395
|
-
|
|
2396
|
-
let e =
|
|
2399
|
+
c === null && (c = s.getTopLevelElementOrThrow());
|
|
2400
|
+
let l = B(s, S), u = !1, d = xe(c) ? c.getIndent() : 0;
|
|
2401
|
+
if (S(l)) {
|
|
2402
|
+
d = l.getIndent();
|
|
2403
|
+
let e = l.getParent();
|
|
2397
2404
|
if (C(e)) {
|
|
2398
2405
|
let t = e.getListType();
|
|
2399
|
-
|
|
2406
|
+
u = t === "number" || t === "bullet" ? t : !1;
|
|
2400
2407
|
}
|
|
2401
2408
|
}
|
|
2402
|
-
let
|
|
2409
|
+
let f = B(s, re), p = re(f) ? f.getTag() : void 0;
|
|
2403
2410
|
return {
|
|
2404
2411
|
bold: r.hasFormat("bold"),
|
|
2405
2412
|
italic: r.hasFormat("italic"),
|
|
2406
2413
|
underline: r.hasFormat("underline"),
|
|
2407
2414
|
strikethrough: r.hasFormat("strikethrough"),
|
|
2408
|
-
|
|
2409
|
-
|
|
2410
|
-
|
|
2411
|
-
|
|
2412
|
-
|
|
2413
|
-
|
|
2414
|
-
|
|
2415
|
+
fontSize: i,
|
|
2416
|
+
fontColor: a,
|
|
2417
|
+
backgroundColor: o,
|
|
2418
|
+
align: pi(xe(c) ? c.getFormatType() : ""),
|
|
2419
|
+
listType: u,
|
|
2420
|
+
canIndent: d < 8,
|
|
2421
|
+
canOutdent: d > 0 || u !== !1,
|
|
2422
|
+
headingTag: p === "h1" || p === "h2" || p === "h3" ? p : !1,
|
|
2415
2423
|
hasRangeSelection: !0,
|
|
2416
2424
|
hasEditorText: t
|
|
2417
2425
|
};
|
|
2418
|
-
},
|
|
2426
|
+
}, hi = (e, t) => {
|
|
2419
2427
|
e.isEditable() || e.setEditable(!0), e.update(() => {
|
|
2420
|
-
|
|
2428
|
+
Gt(), t(mi(!0));
|
|
2421
2429
|
}), e.focus(void 0, { defaultSelection: "rootStart" });
|
|
2422
|
-
},
|
|
2423
|
-
let t =
|
|
2424
|
-
return
|
|
2430
|
+
}, gi = (e) => {
|
|
2431
|
+
let t = fi;
|
|
2432
|
+
return hi(e, (e) => {
|
|
2425
2433
|
t = e;
|
|
2426
2434
|
}), t;
|
|
2427
|
-
},
|
|
2435
|
+
}, _i = (...e) => e.filter(Boolean).join(" "), vi = (e) => e.buttons.map((e) => ({
|
|
2428
2436
|
name: typeof e == "string" ? e : e.name,
|
|
2429
2437
|
disabled: typeof e != "string" && !!e.props?.disabled
|
|
2430
|
-
})), Q = 24,
|
|
2438
|
+
})), Q = 24, yi = 20, $ = ({ active: e, disabled: t, expanded: n, label: r, select: i, selectAlign: a, onClick: o, children: s }) => /* @__PURE__ */ p("button", {
|
|
2431
2439
|
type: "button",
|
|
2432
|
-
className:
|
|
2440
|
+
className: _i(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"]),
|
|
2433
2441
|
"aria-label": r,
|
|
2434
2442
|
"aria-pressed": e,
|
|
2435
2443
|
"aria-expanded": i ? !!n : void 0,
|
|
@@ -2437,11 +2445,11 @@ var $n = (e) => {
|
|
|
2437
2445
|
onMouseDown: (e) => e.preventDefault(),
|
|
2438
2446
|
onClick: o,
|
|
2439
2447
|
children: s
|
|
2440
|
-
}),
|
|
2448
|
+
}), bi = ({ open: e }) => /* @__PURE__ */ p(n, {
|
|
2441
2449
|
name: "arrow-down",
|
|
2442
|
-
size:
|
|
2443
|
-
className:
|
|
2444
|
-
}),
|
|
2450
|
+
size: yi,
|
|
2451
|
+
className: _i(V["bsy-mobile-editor__tool-caret"], e && V["bsy-mobile-editor__tool-caret--open"])
|
|
2452
|
+
}), xi = ({ config: t, formats: r, colorValues: i, openSheet: a, onOpenSheet: o, onOpenLink: c }) => {
|
|
2445
2453
|
let [l] = z(), { t: d } = e(), f = u(null), h = u(null), g = u(null), _ = () => {
|
|
2446
2454
|
let e = f.current, t = h.current, n = g.current;
|
|
2447
2455
|
if (!e || !t || !n) return;
|
|
@@ -2462,7 +2470,7 @@ var $n = (e) => {
|
|
|
2462
2470
|
disabled: t,
|
|
2463
2471
|
label: d("editor.bold"),
|
|
2464
2472
|
onClick: () => {
|
|
2465
|
-
H(l), l.dispatchCommand(
|
|
2473
|
+
H(l), l.dispatchCommand(Pe, "bold");
|
|
2466
2474
|
},
|
|
2467
2475
|
children: /* @__PURE__ */ p(n, {
|
|
2468
2476
|
name: "bold",
|
|
@@ -2474,7 +2482,7 @@ var $n = (e) => {
|
|
|
2474
2482
|
disabled: t,
|
|
2475
2483
|
label: d("editor.italic"),
|
|
2476
2484
|
onClick: () => {
|
|
2477
|
-
H(l), l.dispatchCommand(
|
|
2485
|
+
H(l), l.dispatchCommand(Pe, "italic");
|
|
2478
2486
|
},
|
|
2479
2487
|
children: /* @__PURE__ */ p(n, {
|
|
2480
2488
|
name: "italic",
|
|
@@ -2486,7 +2494,7 @@ var $n = (e) => {
|
|
|
2486
2494
|
disabled: t,
|
|
2487
2495
|
label: d("editor.underline"),
|
|
2488
2496
|
onClick: () => {
|
|
2489
|
-
H(l), l.dispatchCommand(
|
|
2497
|
+
H(l), l.dispatchCommand(Pe, "underline");
|
|
2490
2498
|
},
|
|
2491
2499
|
children: /* @__PURE__ */ p(n, {
|
|
2492
2500
|
name: "underline",
|
|
@@ -2498,7 +2506,7 @@ var $n = (e) => {
|
|
|
2498
2506
|
disabled: t,
|
|
2499
2507
|
label: d("editor.strikethrough"),
|
|
2500
2508
|
onClick: () => {
|
|
2501
|
-
H(l), l.dispatchCommand(
|
|
2509
|
+
H(l), l.dispatchCommand(Pe, "strikethrough");
|
|
2502
2510
|
},
|
|
2503
2511
|
children: /* @__PURE__ */ p(n, {
|
|
2504
2512
|
name: "shanchuxian",
|
|
@@ -2509,7 +2517,7 @@ var $n = (e) => {
|
|
|
2509
2517
|
disabled: t || r.hasRangeSelection && !r.canOutdent,
|
|
2510
2518
|
label: d("editor.outdent"),
|
|
2511
2519
|
onClick: () => {
|
|
2512
|
-
H(l), l.dispatchCommand(
|
|
2520
|
+
H(l), l.dispatchCommand(ze, void 0);
|
|
2513
2521
|
},
|
|
2514
2522
|
children: /* @__PURE__ */ p(n, {
|
|
2515
2523
|
name: "jianshaosuojin",
|
|
@@ -2520,7 +2528,7 @@ var $n = (e) => {
|
|
|
2520
2528
|
disabled: t || r.hasRangeSelection && !r.canIndent,
|
|
2521
2529
|
label: d("editor.indent"),
|
|
2522
2530
|
onClick: () => {
|
|
2523
|
-
H(l), l.dispatchCommand(
|
|
2531
|
+
H(l), l.dispatchCommand(Ie, void 0);
|
|
2524
2532
|
},
|
|
2525
2533
|
children: /* @__PURE__ */ p(n, {
|
|
2526
2534
|
name: "zengjiasuojin",
|
|
@@ -2532,7 +2540,7 @@ var $n = (e) => {
|
|
|
2532
2540
|
disabled: t,
|
|
2533
2541
|
label: d("editor.bulletList"),
|
|
2534
2542
|
onClick: () => {
|
|
2535
|
-
let e =
|
|
2543
|
+
let e = gi(l);
|
|
2536
2544
|
l.dispatchCommand(e.listType === "bullet" ? O : T, void 0);
|
|
2537
2545
|
},
|
|
2538
2546
|
children: /* @__PURE__ */ p(n, {
|
|
@@ -2545,7 +2553,7 @@ var $n = (e) => {
|
|
|
2545
2553
|
disabled: t,
|
|
2546
2554
|
label: d("editor.numberList"),
|
|
2547
2555
|
onClick: () => {
|
|
2548
|
-
let e =
|
|
2556
|
+
let e = gi(l);
|
|
2549
2557
|
l.dispatchCommand(e.listType === "number" ? O : w, void 0);
|
|
2550
2558
|
},
|
|
2551
2559
|
children: /* @__PURE__ */ p(n, {
|
|
@@ -2564,7 +2572,7 @@ var $n = (e) => {
|
|
|
2564
2572
|
children: [/* @__PURE__ */ p(n, {
|
|
2565
2573
|
name: r.align === "center" ? "paragraphmiddle" : r.align === "right" ? "paragraphright" : "paragraph",
|
|
2566
2574
|
size: Q
|
|
2567
|
-
}), /* @__PURE__ */ p(
|
|
2575
|
+
}), /* @__PURE__ */ p(bi, { open: a === "align" })]
|
|
2568
2576
|
}, e);
|
|
2569
2577
|
case "heading": return /* @__PURE__ */ m($, {
|
|
2570
2578
|
select: !0,
|
|
@@ -2577,7 +2585,7 @@ var $n = (e) => {
|
|
|
2577
2585
|
children: [/* @__PURE__ */ p("span", {
|
|
2578
2586
|
className: V["bsy-mobile-editor__tool-text"],
|
|
2579
2587
|
children: r.headingTag ? r.headingTag.toUpperCase() : d("editor.paragraph")
|
|
2580
|
-
}), /* @__PURE__ */ p(
|
|
2588
|
+
}), /* @__PURE__ */ p(bi, { open: a === "heading" })]
|
|
2581
2589
|
}, e);
|
|
2582
2590
|
case "fontSize": return /* @__PURE__ */ p($, {
|
|
2583
2591
|
active: a === "fontSize",
|
|
@@ -2594,7 +2602,7 @@ var $n = (e) => {
|
|
|
2594
2602
|
disabled: t,
|
|
2595
2603
|
label: d("editor.fontColor"),
|
|
2596
2604
|
onClick: () => o("fontColor"),
|
|
2597
|
-
children: /* @__PURE__ */ p(
|
|
2605
|
+
children: /* @__PURE__ */ p(di, {
|
|
2598
2606
|
variant: "fontColor",
|
|
2599
2607
|
barColor: i.fontColor,
|
|
2600
2608
|
size: Q
|
|
@@ -2605,7 +2613,7 @@ var $n = (e) => {
|
|
|
2605
2613
|
disabled: t,
|
|
2606
2614
|
label: d("editor.fill"),
|
|
2607
2615
|
onClick: () => o("fill"),
|
|
2608
|
-
children: /* @__PURE__ */ p(
|
|
2616
|
+
children: /* @__PURE__ */ p(di, {
|
|
2609
2617
|
variant: "fill",
|
|
2610
2618
|
barColor: i.fill,
|
|
2611
2619
|
size: Q
|
|
@@ -2621,7 +2629,7 @@ var $n = (e) => {
|
|
|
2621
2629
|
children: [/* @__PURE__ */ p(n, {
|
|
2622
2630
|
name: "picture",
|
|
2623
2631
|
size: Q
|
|
2624
|
-
}), /* @__PURE__ */ p(
|
|
2632
|
+
}), /* @__PURE__ */ p(bi, { open: a === "picture" })]
|
|
2625
2633
|
}, e);
|
|
2626
2634
|
case "link": return /* @__PURE__ */ p($, {
|
|
2627
2635
|
disabled: t,
|
|
@@ -2642,13 +2650,13 @@ var $n = (e) => {
|
|
|
2642
2650
|
label: d("editor.ai"),
|
|
2643
2651
|
onClick: () => o("ai"),
|
|
2644
2652
|
children: [/* @__PURE__ */ p("img", {
|
|
2645
|
-
src:
|
|
2653
|
+
src: xr,
|
|
2646
2654
|
alt: "",
|
|
2647
2655
|
width: Q,
|
|
2648
2656
|
height: Q,
|
|
2649
2657
|
className: V["bsy-mobile-editor__ai-icon"],
|
|
2650
2658
|
draggable: !1
|
|
2651
|
-
}), /* @__PURE__ */ p(
|
|
2659
|
+
}), /* @__PURE__ */ p(bi, { open: n })]
|
|
2652
2660
|
}, e);
|
|
2653
2661
|
}
|
|
2654
2662
|
default: return null;
|
|
@@ -2661,7 +2669,7 @@ var $n = (e) => {
|
|
|
2661
2669
|
className: V["bsy-mobile-editor__toolbar-scroller"],
|
|
2662
2670
|
onScroll: _,
|
|
2663
2671
|
children: t.map((e, t) => {
|
|
2664
|
-
let n =
|
|
2672
|
+
let n = vi(e);
|
|
2665
2673
|
return n.length ? /* @__PURE__ */ m("div", {
|
|
2666
2674
|
className: V["bsy-mobile-editor__toolbar-group"],
|
|
2667
2675
|
children: [t > 0 ? /* @__PURE__ */ p("span", { className: V["bsy-mobile-editor__toolbar-divider"] }) : null, n.map(v)]
|
|
@@ -2678,18 +2686,32 @@ var $n = (e) => {
|
|
|
2678
2686
|
})
|
|
2679
2687
|
})]
|
|
2680
2688
|
});
|
|
2689
|
+
}, Si = () => {
|
|
2690
|
+
if (I().getTextContent().trim() !== "") return !1;
|
|
2691
|
+
let e = L();
|
|
2692
|
+
return R(e) && (e.format !== 0 || e.style.trim() !== "");
|
|
2681
2693
|
}, Ci = () => {
|
|
2682
|
-
|
|
2683
|
-
|
|
2684
|
-
|
|
2685
|
-
|
|
2686
|
-
|
|
2687
|
-
|
|
2688
|
-
|
|
2689
|
-
|
|
2690
|
-
|
|
2691
|
-
|
|
2692
|
-
|
|
2694
|
+
if (!Si()) return !1;
|
|
2695
|
+
let e = L();
|
|
2696
|
+
return R(e) ? (e.setFormat(0), e.setStyle(""), !0) : !1;
|
|
2697
|
+
}, wi = (e) => {
|
|
2698
|
+
let [t] = z(), [n, r] = d(fi);
|
|
2699
|
+
return s(() => {
|
|
2700
|
+
let n = () => {
|
|
2701
|
+
t.getEditorState().read(() => {
|
|
2702
|
+
r(mi(e));
|
|
2703
|
+
}, { editor: t });
|
|
2704
|
+
};
|
|
2705
|
+
return n(), t.registerUpdateListener(({ editorState: e }) => {
|
|
2706
|
+
if (e.read(() => Si())) {
|
|
2707
|
+
t.update(() => {
|
|
2708
|
+
Ci();
|
|
2709
|
+
});
|
|
2710
|
+
return;
|
|
2711
|
+
}
|
|
2712
|
+
n();
|
|
2713
|
+
});
|
|
2714
|
+
}, [t, e]), n;
|
|
2693
2715
|
}, Ti = "plaintext", Ei = "github-light", Di = new Set([
|
|
2694
2716
|
"plaintext",
|
|
2695
2717
|
"css",
|
|
@@ -2769,14 +2791,14 @@ var $n = (e) => {
|
|
|
2769
2791
|
return i.forEach((e, t) => {
|
|
2770
2792
|
t && a.push(ge()), e.forEach((e) => {
|
|
2771
2793
|
e.content.split(" ").forEach((t, n) => {
|
|
2772
|
-
if (n && a.push(
|
|
2794
|
+
if (n && a.push(ve()), !t) return;
|
|
2773
2795
|
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}` : "";
|
|
2774
2796
|
i && r.setStyle(i), a.push(r);
|
|
2775
2797
|
});
|
|
2776
2798
|
});
|
|
2777
2799
|
}), a;
|
|
2778
2800
|
}, Bi = (e, t) => {
|
|
2779
|
-
let n =
|
|
2801
|
+
let n = F(e);
|
|
2780
2802
|
if (!j(n) || !n.isAttached()) return;
|
|
2781
2803
|
let r = L();
|
|
2782
2804
|
if (!R(r)) {
|
|
@@ -2824,7 +2846,7 @@ var $n = (e) => {
|
|
|
2824
2846
|
i.getIsSyntaxHighlightSupported() && i.setIsSyntaxHighlightSupported(!1), n.pendingKeys.add(a), n.loading !== s && (n.loading = s, s.then((t) => {
|
|
2825
2847
|
r(t);
|
|
2826
2848
|
let i = [...n.pendingKeys];
|
|
2827
|
-
n.pendingKeys.clear(), n.loading = null, e.update(() => i.forEach((e) =>
|
|
2849
|
+
n.pendingKeys.clear(), n.loading = null, e.update(() => i.forEach((e) => F(e)?.markDirty()), { tag: Fe });
|
|
2828
2850
|
}, () => {
|
|
2829
2851
|
n.pendingKeys.clear(), n.loading = null;
|
|
2830
2852
|
}));
|
|
@@ -2835,7 +2857,7 @@ var $n = (e) => {
|
|
|
2835
2857
|
n.nodesCurrentlyHighlighting.has(a) || (n.nodesCurrentlyHighlighting.add(a), n.didTransform || (n.didTransform = !0, De(() => {
|
|
2836
2858
|
n.didTransform = !1, n.nodesCurrentlyHighlighting.clear();
|
|
2837
2859
|
})), Bi(a, () => {
|
|
2838
|
-
let e =
|
|
2860
|
+
let e = F(a);
|
|
2839
2861
|
if (!j(e) || !e.isAttached()) return !1;
|
|
2840
2862
|
let n = zi(e, Oi(e.getLanguage()), t), { from: r, to: i, replacement: o } = Hi(e.getChildren(), n);
|
|
2841
2863
|
return r === i && o.length === 0 ? !1 : (e.splice(r, i - r, o), !0);
|
|
@@ -2853,15 +2875,15 @@ var $n = (e) => {
|
|
|
2853
2875
|
t = e;
|
|
2854
2876
|
}, r), i = (e) => {
|
|
2855
2877
|
let t = e.getParent();
|
|
2856
|
-
j(t) ? r(t) : A(e) && e.replace(
|
|
2878
|
+
j(t) ? r(t) : A(e) && e.replace(ye(e.__text));
|
|
2857
2879
|
};
|
|
2858
|
-
return
|
|
2880
|
+
return Ge(te(e), e.registerNodeTransform(N, r), e.registerNodeTransform(Ue, i), e.registerNodeTransform(M, i));
|
|
2859
2881
|
}, [e]), null;
|
|
2860
2882
|
}, Gi = () => {
|
|
2861
2883
|
let [e] = z();
|
|
2862
|
-
return s(() => (me(e, !0),
|
|
2884
|
+
return s(() => (me(e, !0), rt(fe(e), pe(e, !1), de(e), e.registerNodeTransform(ce, (e) => {
|
|
2863
2885
|
e.getBackgroundColor() !== null && e.setBackgroundColor(null);
|
|
2864
|
-
}), e.registerCommand(
|
|
2886
|
+
}), e.registerCommand(Re, (e) => {
|
|
2865
2887
|
let t = L();
|
|
2866
2888
|
if (!R(t) || !t.isCollapsed()) return !1;
|
|
2867
2889
|
let n = ae(t.anchor.getNode());
|
|
@@ -2887,7 +2909,7 @@ var $n = (e) => {
|
|
|
2887
2909
|
e && (r === "next" ? e.selectNext() : e.selectPrevious());
|
|
2888
2910
|
}
|
|
2889
2911
|
return !0;
|
|
2890
|
-
},
|
|
2912
|
+
}, ke))), [e]), null;
|
|
2891
2913
|
}, Ki = (e) => {
|
|
2892
2914
|
let t = e.getIndent();
|
|
2893
2915
|
t < 8 && e.setIndent(t + 1);
|
|
@@ -2903,54 +2925,61 @@ var $n = (e) => {
|
|
|
2903
2925
|
//#region src/components/Editor/plugins/IndentLimitPlugin.tsx
|
|
2904
2926
|
function Ji() {
|
|
2905
2927
|
let [e] = z();
|
|
2906
|
-
return s(() =>
|
|
2928
|
+
return s(() => rt(e.registerCommand(Ie, () => nt(Ki), ke), e.registerNodeTransform(He, qi), e.registerNodeTransform(ie, qi), e.registerNodeTransform(E, qi)), [e]), null;
|
|
2907
2929
|
}
|
|
2908
2930
|
//#endregion
|
|
2909
2931
|
//#region src/components/Editor/EditorCore.tsx
|
|
2910
2932
|
var Yi = ({ value: n, onChange: r, open: i, onOpenChange: a, toolbar: o, upload: c, ai: l }) => {
|
|
2911
|
-
let [f] = z(), { t: h } = e(), g
|
|
2912
|
-
a?.(e), i === void 0 &&
|
|
2933
|
+
let [f] = z(), { t: h } = e(), [g, _] = d(!1), v = i ?? g, y = wi(v), b = (e) => {
|
|
2934
|
+
a?.(e), i === void 0 && _(e);
|
|
2913
2935
|
}, [x, S] = d(null), [C, w] = d(() => ({
|
|
2914
|
-
fontColor:
|
|
2915
|
-
fill:
|
|
2936
|
+
fontColor: y.fontColor,
|
|
2937
|
+
fill: y.backgroundColor
|
|
2916
2938
|
})), T = u(!1), [E, D] = d(!1), O = u(null), k = () => {
|
|
2917
2939
|
f.getEditorState().read(() => {
|
|
2918
2940
|
O.current = L()?.clone() ?? null;
|
|
2919
2941
|
});
|
|
2920
|
-
}, { linkForm: A, openLink: j, confirmLink: ee, closeLink: M } =
|
|
2942
|
+
}, { linkForm: A, openLink: j, confirmLink: ee, closeLink: M } = dr({
|
|
2921
2943
|
editor: f,
|
|
2922
2944
|
savedSelectionRef: O,
|
|
2923
2945
|
captureSelection: k
|
|
2924
|
-
}), [N] = d(() => /* @__PURE__ */ new Map()), { fileInputRef: te, uploadProgress: ne, insertImage: re, onFileChange: ie, abortUpload: ae } =
|
|
2946
|
+
}), [N] = d(() => /* @__PURE__ */ new Map()), { fileInputRef: te, uploadProgress: ne, insertImage: re, onFileChange: ie, abortUpload: ae } = ur({
|
|
2925
2947
|
editor: f,
|
|
2926
2948
|
upload: c,
|
|
2927
2949
|
savedSelectionRef: O,
|
|
2928
2950
|
attachmentsBySrc: N
|
|
2929
|
-
}), oe =
|
|
2951
|
+
}), oe = fr({
|
|
2930
2952
|
editor: f,
|
|
2931
2953
|
value: n,
|
|
2932
2954
|
onChange: r,
|
|
2933
2955
|
attachmentsBySrc: N
|
|
2934
|
-
}), P =
|
|
2956
|
+
}), P = $n({
|
|
2935
2957
|
editor: f,
|
|
2936
2958
|
ai: l
|
|
2937
|
-
}), [se, ce] = d(0), le = o?.config ??
|
|
2959
|
+
}), [se, ce] = d(0), le = o?.config ?? mt;
|
|
2938
2960
|
s(() => {
|
|
2939
|
-
|
|
2940
|
-
|
|
2941
|
-
|
|
2961
|
+
if (!y.hasEditorText) {
|
|
2962
|
+
w({
|
|
2963
|
+
fontColor: lt,
|
|
2964
|
+
fill: ut
|
|
2965
|
+
});
|
|
2966
|
+
return;
|
|
2967
|
+
}
|
|
2968
|
+
y.hasRangeSelection && w({
|
|
2969
|
+
fontColor: y.fontColor,
|
|
2970
|
+
fill: y.backgroundColor
|
|
2942
2971
|
});
|
|
2943
2972
|
}, [
|
|
2944
|
-
|
|
2945
|
-
|
|
2946
|
-
|
|
2947
|
-
|
|
2973
|
+
y.backgroundColor,
|
|
2974
|
+
y.fontColor,
|
|
2975
|
+
y.hasEditorText,
|
|
2976
|
+
y.hasRangeSelection
|
|
2948
2977
|
]);
|
|
2949
2978
|
let ue = () => {
|
|
2950
2979
|
ae(), P.close(), S(null), M(), D(!1), b(!1);
|
|
2951
2980
|
};
|
|
2952
2981
|
s(() => {
|
|
2953
|
-
if (!
|
|
2982
|
+
if (!v) return;
|
|
2954
2983
|
let e = window.visualViewport;
|
|
2955
2984
|
if (!e) return;
|
|
2956
2985
|
let t = () => {
|
|
@@ -2959,24 +2988,24 @@ var Yi = ({ value: n, onChange: r, open: i, onOpenChange: a, toolbar: o, upload:
|
|
|
2959
2988
|
return e.addEventListener("resize", t), e.addEventListener("scroll", t), t(), () => {
|
|
2960
2989
|
e.removeEventListener("resize", t), e.removeEventListener("scroll", t);
|
|
2961
2990
|
};
|
|
2962
|
-
}, [
|
|
2963
|
-
|
|
2964
|
-
}, [ae,
|
|
2965
|
-
if (
|
|
2991
|
+
}, [v]), s(() => {
|
|
2992
|
+
v || ae();
|
|
2993
|
+
}, [ae, v]), s(() => {
|
|
2994
|
+
if (v) return f.setEditable(!0), f.registerRootListener((e) => {
|
|
2966
2995
|
e && f.focus(void 0, { defaultSelection: "rootEnd" });
|
|
2967
2996
|
});
|
|
2968
|
-
}, [
|
|
2997
|
+
}, [v, f]);
|
|
2969
2998
|
let de = () => {
|
|
2970
2999
|
T.current = !0, S(null), P.startTypeset();
|
|
2971
3000
|
}, fe = (e) => {
|
|
2972
3001
|
x === "aiPreset" && (T.current = !0), S(null), P.startPolish(e);
|
|
2973
3002
|
};
|
|
2974
3003
|
return /* @__PURE__ */ p(t, {
|
|
2975
|
-
open:
|
|
3004
|
+
open: v,
|
|
2976
3005
|
onClose: ue,
|
|
2977
3006
|
position: "bottom",
|
|
2978
3007
|
closeOnClickOverlay: !0,
|
|
2979
|
-
children: /* @__PURE__ */ p(
|
|
3008
|
+
children: /* @__PURE__ */ p(er.Provider, {
|
|
2980
3009
|
value: ne,
|
|
2981
3010
|
children: /* @__PURE__ */ m("div", {
|
|
2982
3011
|
className: V["bsy-mobile-editor"],
|
|
@@ -2995,19 +3024,19 @@ var Yi = ({ value: n, onChange: r, open: i, onOpenChange: a, toolbar: o, upload:
|
|
|
2995
3024
|
/* @__PURE__ */ p("div", {
|
|
2996
3025
|
className: V["bsy-mobile-editor__content"],
|
|
2997
3026
|
style: { height: 200 },
|
|
2998
|
-
children: /* @__PURE__ */ p(
|
|
2999
|
-
contentEditable: /* @__PURE__ */ p(
|
|
3000
|
-
ErrorBoundary:
|
|
3027
|
+
children: /* @__PURE__ */ p(Ze, {
|
|
3028
|
+
contentEditable: /* @__PURE__ */ p(Ke, { className: V["bsy-mobile-editor__editable"] }),
|
|
3029
|
+
ErrorBoundary: Qe
|
|
3001
3030
|
})
|
|
3002
3031
|
}),
|
|
3003
|
-
le.length > 0 ? /* @__PURE__ */ p(
|
|
3032
|
+
le.length > 0 ? /* @__PURE__ */ p(xi, {
|
|
3004
3033
|
config: le,
|
|
3005
|
-
formats:
|
|
3034
|
+
formats: y,
|
|
3006
3035
|
colorValues: C,
|
|
3007
3036
|
openSheet: x,
|
|
3008
3037
|
onOpenSheet: (e) => {
|
|
3009
3038
|
(e === "fontColor" || e === "fill") && (k(), w((t) => {
|
|
3010
|
-
let n = e === "fill" ?
|
|
3039
|
+
let n = e === "fill" ? y.backgroundColor : y.fontColor, r = y.hasRangeSelection && y.hasEditorText;
|
|
3011
3040
|
return {
|
|
3012
3041
|
...t,
|
|
3013
3042
|
[e]: r ? n : t[e]
|
|
@@ -3016,29 +3045,30 @@ var Yi = ({ value: n, onChange: r, open: i, onOpenChange: a, toolbar: o, upload:
|
|
|
3016
3045
|
},
|
|
3017
3046
|
onOpenLink: j
|
|
3018
3047
|
}) : null,
|
|
3048
|
+
/* @__PURE__ */ p(qe, {}),
|
|
3019
3049
|
/* @__PURE__ */ p(Ye, {}),
|
|
3020
|
-
/* @__PURE__ */ p(
|
|
3021
|
-
/* @__PURE__ */ p(
|
|
3022
|
-
/* @__PURE__ */ p(
|
|
3023
|
-
/* @__PURE__ */ p(
|
|
3024
|
-
/* @__PURE__ */ p(
|
|
3025
|
-
/* @__PURE__ */ p(yr, {}),
|
|
3050
|
+
/* @__PURE__ */ p(Je, {}),
|
|
3051
|
+
/* @__PURE__ */ p(mr, {}),
|
|
3052
|
+
/* @__PURE__ */ p(br, {}),
|
|
3053
|
+
/* @__PURE__ */ p(gr, {}),
|
|
3054
|
+
/* @__PURE__ */ p(vr, {}),
|
|
3026
3055
|
/* @__PURE__ */ p(Wi, {}),
|
|
3027
3056
|
/* @__PURE__ */ p(Gi, {}),
|
|
3028
3057
|
/* @__PURE__ */ p(Ji, {}),
|
|
3029
|
-
/* @__PURE__ */ p(
|
|
3058
|
+
/* @__PURE__ */ p(Xe, {
|
|
3030
3059
|
onChange: oe,
|
|
3031
3060
|
ignoreSelectionChange: !0
|
|
3032
3061
|
}),
|
|
3033
3062
|
/* @__PURE__ */ p("input", {
|
|
3034
3063
|
ref: te,
|
|
3035
3064
|
type: "file",
|
|
3036
|
-
accept:
|
|
3065
|
+
accept: gt,
|
|
3037
3066
|
hidden: !0,
|
|
3038
3067
|
onChange: ie
|
|
3039
3068
|
}),
|
|
3040
|
-
/* @__PURE__ */ p(
|
|
3069
|
+
/* @__PURE__ */ p(Vr, {
|
|
3041
3070
|
sheet: x,
|
|
3071
|
+
formats: y,
|
|
3042
3072
|
onClose: () => {
|
|
3043
3073
|
if (T.current) {
|
|
3044
3074
|
T.current = !1;
|
|
@@ -3067,20 +3097,20 @@ var Yi = ({ value: n, onChange: r, open: i, onOpenChange: a, toolbar: o, upload:
|
|
|
3067
3097
|
canTypeset: !!l?.typeset,
|
|
3068
3098
|
canPolish: !!l?.polish
|
|
3069
3099
|
}),
|
|
3070
|
-
/* @__PURE__ */ p(
|
|
3100
|
+
/* @__PURE__ */ p(Ur, {
|
|
3071
3101
|
open: A !== null,
|
|
3072
3102
|
seed: A,
|
|
3073
3103
|
onClose: M,
|
|
3074
3104
|
onConfirm: ee
|
|
3075
3105
|
}),
|
|
3076
|
-
/* @__PURE__ */ p(
|
|
3106
|
+
/* @__PURE__ */ p(Gr, {
|
|
3077
3107
|
open: E,
|
|
3078
3108
|
onClose: () => D(!1),
|
|
3079
3109
|
onConfirm: (e) => {
|
|
3080
3110
|
re(e, "", e), D(!1);
|
|
3081
3111
|
}
|
|
3082
3112
|
}),
|
|
3083
|
-
/* @__PURE__ */ p(
|
|
3113
|
+
/* @__PURE__ */ p(ri, {
|
|
3084
3114
|
open: P.mode !== null,
|
|
3085
3115
|
mode: P.mode,
|
|
3086
3116
|
originalHtml: P.snapshot.html,
|
|
@@ -3097,7 +3127,7 @@ var Yi = ({ value: n, onChange: r, open: i, onOpenChange: a, toolbar: o, upload:
|
|
|
3097
3127
|
});
|
|
3098
3128
|
}, Xi = "1px solid #d9d9d9", Zi = { export: new Map([[ce, (e, t) => {
|
|
3099
3129
|
let n = t.exportDOM(e);
|
|
3100
|
-
return
|
|
3130
|
+
return We(n.element) && (n.element.style.border = Xi), n;
|
|
3101
3131
|
}]]) }, Qi = class e extends x {
|
|
3102
3132
|
constructor(e = "", t = {}, n) {
|
|
3103
3133
|
super(e, t, n);
|
|
@@ -3172,10 +3202,10 @@ var Yi = ({ value: n, onChange: r, open: i, onOpenChange: a, toolbar: o, upload:
|
|
|
3172
3202
|
le,
|
|
3173
3203
|
ue,
|
|
3174
3204
|
ce,
|
|
3175
|
-
|
|
3205
|
+
ir,
|
|
3176
3206
|
q,
|
|
3177
3207
|
{
|
|
3178
|
-
replace:
|
|
3208
|
+
replace: Ue,
|
|
3179
3209
|
with: (e) => new q(e.__text),
|
|
3180
3210
|
withKlass: q
|
|
3181
3211
|
}
|
|
@@ -3186,4 +3216,4 @@ var Yi = ({ value: n, onChange: r, open: i, onOpenChange: a, toolbar: o, upload:
|
|
|
3186
3216
|
});
|
|
3187
3217
|
ta.displayName = "BsyMobileEditor";
|
|
3188
3218
|
//#endregion
|
|
3189
|
-
export {
|
|
3219
|
+
export { qr as n, ta as t };
|