@baishuyun/ui-mobile 0.12.4 → 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-CVWffQQX.js → Editor-C9XclcXa.js} +617 -601
- 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/popups/OptionSheets.d.ts +3 -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-CNlAoA_H.js → version-DwyB7hbm.js} +1 -1
- package/package.json +1 -1
|
@@ -8,10 +8,10 @@ import { useEventListener as h } from "ahooks";
|
|
|
8
8
|
import { LexicalComposer as g } from "@lexical/react/LexicalComposer";
|
|
9
9
|
import { $createLinkNode as _, $isLinkNode as v, $toggleLink as y, AutoLinkNode as b, LinkNode as x } from "@lexical/link";
|
|
10
10
|
import { $isListItemNode as S, $isListNode as C, INSERT_ORDERED_LIST_COMMAND as w, INSERT_UNORDERED_LIST_COMMAND as T, ListItemNode as E, ListNode as D, REMOVE_LIST_COMMAND as O } from "@lexical/list";
|
|
11
|
-
import { $createCodeHighlightNode as k, $isCodeHighlightNode as A, $isCodeNode as
|
|
12
|
-
import { $createHeadingNode as
|
|
13
|
-
import { $findCellNode as
|
|
14
|
-
import { $applyNodeReplacement as
|
|
11
|
+
import { $createCodeHighlightNode as k, $isCodeHighlightNode as A, $isCodeNode as j, $plainifyCodeContent as ee, CodeHighlightNode as M, CodeNode as N, registerCodeIndentation as te } from "@lexical/code-core";
|
|
12
|
+
import { $createHeadingNode as ne, $isHeadingNode as re, HeadingNode as ie } from "@lexical/rich-text";
|
|
13
|
+
import { $findCellNode as ae, $isTableCellNode as oe, $isTableNode as P, $isTableRowNode as se, TableCellNode as ce, TableNode as le, TableRowNode as ue, registerTableCellUnmergeTransform as de, registerTablePlugin as fe, registerTableSelectionObserver as pe, setScrollableTablesActive as me } from "@lexical/table";
|
|
14
|
+
import { $applyNodeReplacement as he, $createLineBreakNode as ge, $createParagraphNode as _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
15
|
import { ContentEditable as Ke } from "@lexical/react/LexicalContentEditable";
|
|
16
16
|
import { HistoryPlugin as qe } from "@lexical/react/LexicalHistoryPlugin";
|
|
17
17
|
import { LinkPlugin as Je } from "@lexical/react/LexicalLinkPlugin";
|
|
@@ -74,21 +74,21 @@ var st = [
|
|
|
74
74
|
label: "128",
|
|
75
75
|
value: "128px"
|
|
76
76
|
}
|
|
77
|
-
], ct = "#000",
|
|
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 st = [
|
|
|
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 st = [
|
|
|
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 st = [
|
|
|
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 st = [
|
|
|
315
315
|
e.replaceWith(t);
|
|
316
316
|
}
|
|
317
317
|
return t.innerHTML.replace(/<!--bsy-code-dropped-->/g, "");
|
|
318
|
-
},
|
|
319
|
-
if (!e.trim() || !
|
|
320
|
-
let t =
|
|
318
|
+
}, 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 st = [
|
|
|
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 st = [
|
|
|
383
383
|
}
|
|
384
384
|
}
|
|
385
385
|
}
|
|
386
|
-
},
|
|
387
|
-
let n =
|
|
386
|
+
}, Ht = (e, t) => {
|
|
387
|
+
let n = I();
|
|
388
388
|
if (n.clear(), t.trim()) {
|
|
389
389
|
let r = new DOMParser().parseFromString(t, "text/html");
|
|
390
|
-
|
|
390
|
+
Vt(r);
|
|
391
391
|
let i = et(e, r);
|
|
392
392
|
if (i.length) {
|
|
393
|
-
n.select(),
|
|
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
|
-
},
|
|
408
|
-
|
|
407
|
+
}, Gt = () => {
|
|
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 st = [
|
|
|
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 st = [
|
|
|
439
439
|
if (/url\s*\(/i.test(i)) return null;
|
|
440
440
|
r = "background-color";
|
|
441
441
|
}
|
|
442
|
-
return
|
|
443
|
-
}).filter((e) => e !== null).join("; "),
|
|
444
|
-
|
|
442
|
+
return !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 st = [
|
|
|
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 st = [
|
|
|
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 st = [
|
|
|
546
546
|
"line-height": "1"
|
|
547
547
|
}, G = (e, t) => {
|
|
548
548
|
for (let [n, r] of Object.entries(t)) e.style.getPropertyValue(n) || e.style.setProperty(n, r);
|
|
549
|
-
},
|
|
549
|
+
}, 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 st = [
|
|
|
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 st = [
|
|
|
613
613
|
for (; u < s && d < c;) a[u] === o[d] ? (f = r[u], n[f] += o[d], u += 1, d += 1) : l[u + 1][d] >= l[u][d + 1] ? (f = r[u], u += 1) : (n[f] += o[d], d += 1);
|
|
614
614
|
for (; d < c;) n[n.length - 1] += o[d], d += 1;
|
|
615
615
|
return n;
|
|
616
|
-
},
|
|
616
|
+
}, Tn = new Set([
|
|
617
617
|
"TABLE",
|
|
618
618
|
"THEAD",
|
|
619
619
|
"TBODY",
|
|
@@ -622,7 +622,7 @@ var st = [
|
|
|
622
622
|
"TH",
|
|
623
623
|
"IMG",
|
|
624
624
|
"BR"
|
|
625
|
-
]),
|
|
625
|
+
]), 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 st = [
|
|
|
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 st = [
|
|
|
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
|
-
}, Un = (e) => {
|
|
692
|
-
let t = Fn.exec(e);
|
|
693
|
-
return t ? { sameLineBody: t[4] ?? "" } : null;
|
|
694
691
|
}, Wn = (e) => {
|
|
692
|
+
let t = In.exec(e);
|
|
693
|
+
return t ? { sameLineBody: t[4] ?? "" } : null;
|
|
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 st = [
|
|
|
710
710
|
].filter(Boolean).join("\n");
|
|
711
711
|
}
|
|
712
712
|
let a = [];
|
|
713
|
-
for (e && a.push(e), r += 1; r < t.length && !
|
|
714
|
-
let o = r < t.length ?
|
|
713
|
+
for (e && a.push(e), r += 1; r < t.length && !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 } = Hn(
|
|
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 =
|
|
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 Zn = (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 Zn = (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 Zn = (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 Zn = (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 Zn = (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 Zn = (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 Zn = (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 Zn = (e) => {
|
|
|
946
946
|
let e = parseInt(r.height, 10);
|
|
947
947
|
Number.isNaN(e) || (a = e);
|
|
948
948
|
}
|
|
949
|
-
return i === void 0 && e.width && (i = e.width), a === void 0 && e.height && (a = e.height), { node:
|
|
949
|
+
return i === void 0 && e.width && (i = e.width), a === void 0 && e.height && (a = e.height), { node: or({
|
|
950
950
|
src: t,
|
|
951
951
|
altText: n,
|
|
952
952
|
width: i,
|
|
@@ -954,7 +954,7 @@ var Zn = (e) => {
|
|
|
954
954
|
dataId: e.getAttribute("data-id") || void 0,
|
|
955
955
|
dataSrc: e.getAttribute("data-src") || void 0
|
|
956
956
|
}) };
|
|
957
|
-
},
|
|
957
|
+
}, 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,14 +964,14 @@ var Zn = (e) => {
|
|
|
964
964
|
let m = a((t, r, i) => {
|
|
965
965
|
let a = "";
|
|
966
966
|
return e.update(() => {
|
|
967
|
-
|
|
968
|
-
let e =
|
|
967
|
+
Wt(n.current), L() === null && I().selectEnd();
|
|
968
|
+
let e = or({
|
|
969
969
|
src: t,
|
|
970
970
|
altText: r,
|
|
971
971
|
dataSrc: i
|
|
972
972
|
});
|
|
973
|
-
a = e.getKey(),
|
|
974
|
-
for (let t of e.getParent()?.getChildren() ?? [])
|
|
973
|
+
a = e.getKey(), be([e]);
|
|
974
|
+
for (let t of e.getParent()?.getChildren() ?? []) Te(t) && t.getTextContentSize() === 0 && t.remove();
|
|
975
975
|
}), a;
|
|
976
976
|
}, [e, n]);
|
|
977
977
|
return {
|
|
@@ -980,7 +980,7 @@ var Zn = (e) => {
|
|
|
980
980
|
insertImage: m,
|
|
981
981
|
onFileChange: a(async (n) => {
|
|
982
982
|
let i = n.target.files?.[0];
|
|
983
|
-
if (n.target.value = "", !i ||
|
|
983
|
+
if (n.target.value = "", !i || 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 Zn = (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 Zn = (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,13 +1049,13 @@ var Zn = (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,
|
|
1056
1056
|
openLink: () => {
|
|
1057
1057
|
n(), e.getEditorState().read(() => {
|
|
1058
|
-
let e =
|
|
1058
|
+
let e = L(), t = R(e) ? e.anchor.getNode() : null, n = t ? B(t, v) : null;
|
|
1059
1059
|
if (n) {
|
|
1060
1060
|
i({
|
|
1061
1061
|
url: n.getURL(),
|
|
@@ -1066,7 +1066,7 @@ var Zn = (e) => {
|
|
|
1066
1066
|
}
|
|
1067
1067
|
i({
|
|
1068
1068
|
url: "",
|
|
1069
|
-
text:
|
|
1069
|
+
text: R(e) ? e.getTextContent() : "",
|
|
1070
1070
|
newBlank: !0
|
|
1071
1071
|
});
|
|
1072
1072
|
});
|
|
@@ -1076,13 +1076,13 @@ var Zn = (e) => {
|
|
|
1076
1076
|
if (!r) return;
|
|
1077
1077
|
let a = r.startsWith("@") || /^https?:\/\//.test(r) ? r : `http://${r}`;
|
|
1078
1078
|
e.update(() => {
|
|
1079
|
-
|
|
1080
|
-
let e =
|
|
1079
|
+
Wt(t.current);
|
|
1080
|
+
let e = L(), r = n.newBlank ? {
|
|
1081
1081
|
target: "_blank",
|
|
1082
1082
|
rel: "noopener noreferrer",
|
|
1083
1083
|
title: n.url
|
|
1084
1084
|
} : { title: n.url };
|
|
1085
|
-
if (
|
|
1085
|
+
if (R(e)) {
|
|
1086
1086
|
let t = n.text.trim() || n.url;
|
|
1087
1087
|
if (e.getTextContent()) y(a, r);
|
|
1088
1088
|
else {
|
|
@@ -1092,10 +1092,10 @@ var Zn = (e) => {
|
|
|
1092
1092
|
} else {
|
|
1093
1093
|
let e = ye(n.text.trim() || n.url), t = _(a, r);
|
|
1094
1094
|
t.append(e);
|
|
1095
|
-
let i =
|
|
1096
|
-
if (
|
|
1095
|
+
let i = I(), o = i.getLastChild();
|
|
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 Zn = (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 =
|
|
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 Zn = (e) => {
|
|
|
1120
1120
|
}, [r, e]);
|
|
1121
1121
|
return s(() => {
|
|
1122
1122
|
t === void 0 || t === i.current || (i.current = t ?? null, e.update(() => {
|
|
1123
|
-
|
|
1123
|
+
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,19 +1129,19 @@ var Zn = (e) => {
|
|
|
1129
1129
|
c,
|
|
1130
1130
|
t
|
|
1131
1131
|
]), c;
|
|
1132
|
-
},
|
|
1132
|
+
}, pr = 250, mr = () => {
|
|
1133
1133
|
let [e] = z(), t = u(0);
|
|
1134
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 >=
|
|
1137
|
-
let i =
|
|
1138
|
-
if (!
|
|
1136
|
+
if (t.current = n, r <= 0 || r >= pr) return !1;
|
|
1137
|
+
let i = L();
|
|
1138
|
+
if (!R(i) || !i.isCollapsed()) return !1;
|
|
1139
1139
|
let a = i.anchor.getNode();
|
|
1140
1140
|
if (B(a, S)) return !1;
|
|
1141
1141
|
let o = a.getTopLevelElement();
|
|
1142
1142
|
if (!o || o.getTextContent().trim() !== "") return !1;
|
|
1143
1143
|
i.setFormat(0);
|
|
1144
|
-
let s =
|
|
1144
|
+
let s = _e();
|
|
1145
1145
|
at(i, {
|
|
1146
1146
|
"background-color": "",
|
|
1147
1147
|
color: "",
|
|
@@ -1153,18 +1153,18 @@ var Zn = (e) => {
|
|
|
1153
1153
|
let c = s.getPreviousSibling();
|
|
1154
1154
|
return c?.getTextContent().trim() === "" && c.remove(), e?.preventDefault(), !0;
|
|
1155
1155
|
}, Ae), [e]), null;
|
|
1156
|
-
},
|
|
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
|
-
return s(() => e.registerNodeTransform(
|
|
1158
|
+
return s(() => e.registerNodeTransform(ie, (e) => {
|
|
1159
1159
|
let t = e.getTag();
|
|
1160
1160
|
if (t === "h4" || t === "h5" || t === "h6") {
|
|
1161
|
-
e.replace(
|
|
1161
|
+
e.replace(_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;
|
|
@@ -1206,7 +1206,7 @@ var Zn = (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;
|
|
@@ -1222,7 +1222,7 @@ var Zn = (e) => {
|
|
|
1222
1222
|
dropInlineTextDecorationIfFormatted(e) {
|
|
1223
1223
|
(this.hasFormat("underline") || this.hasFormat("strikethrough")) && e.style.removeProperty("text-decoration");
|
|
1224
1224
|
}
|
|
1225
|
-
},
|
|
1225
|
+
}, _r = (e = "") => he(new q(e)), J = (e) => (t) => {
|
|
1226
1226
|
let n = e?.(t);
|
|
1227
1227
|
if (!n) return null;
|
|
1228
1228
|
let r = n.conversion(t);
|
|
@@ -1232,7 +1232,7 @@ var Zn = (e) => {
|
|
|
1232
1232
|
...r,
|
|
1233
1233
|
forChild: (e, t) => {
|
|
1234
1234
|
let n = (r?.forChild ?? ((e) => e))(e, t);
|
|
1235
|
-
if (
|
|
1235
|
+
if (Te(n)) {
|
|
1236
1236
|
let e = [
|
|
1237
1237
|
i ? `background-color: ${i}` : null,
|
|
1238
1238
|
a ? `color: ${a}` : null,
|
|
@@ -1245,33 +1245,33 @@ var Zn = (e) => {
|
|
|
1245
1245
|
return n;
|
|
1246
1246
|
}
|
|
1247
1247
|
};
|
|
1248
|
-
},
|
|
1248
|
+
}, vr = () => {
|
|
1249
1249
|
let [e] = z();
|
|
1250
1250
|
return s(() => e.registerNodeTransform(q, (e) => {
|
|
1251
1251
|
if (!B(e, v)) return;
|
|
1252
1252
|
let t = e.getStyle();
|
|
1253
1253
|
if (!t) return;
|
|
1254
|
-
let n =
|
|
1254
|
+
let n = hr(t, "color");
|
|
1255
1255
|
n !== t && e.setStyle(n);
|
|
1256
1256
|
}), [e]), null;
|
|
1257
|
-
},
|
|
1257
|
+
}, yr = /<img\b|<picture\b/i, br = () => {
|
|
1258
1258
|
let [e] = z();
|
|
1259
1259
|
return s(() => {
|
|
1260
1260
|
let t = (t) => {
|
|
1261
1261
|
let n = "clipboardData" in t ? t.clipboardData : "dataTransfer" in t ? t.dataTransfer : null;
|
|
1262
1262
|
if (!n || n.getData("application/x-lexical-editor") || n.getData("application/x-lexical-drag")) return !1;
|
|
1263
1263
|
let r = n.getData("text/html");
|
|
1264
|
-
if (!(Array.from(n.files).some((e) => e.type.startsWith("image/")) || Array.from(n.items).some((e) => e.type.startsWith("image/")) ||
|
|
1264
|
+
if (!(Array.from(n.files).some((e) => e.type.startsWith("image/")) || Array.from(n.items).some((e) => e.type.startsWith("image/")) || yr.test(r))) return !1;
|
|
1265
1265
|
t.preventDefault();
|
|
1266
1266
|
let i = n.getData("text/plain");
|
|
1267
|
-
return !
|
|
1268
|
-
let t =
|
|
1267
|
+
return !yr.test(r) && !i || e.update(() => {
|
|
1268
|
+
let t = L();
|
|
1269
1269
|
if (t === null) return;
|
|
1270
1270
|
let n = r ? new DOMParser().parseFromString(r, "text/html") : null;
|
|
1271
1271
|
if (n?.querySelectorAll("img, picture").forEach((e) => e.remove()), (n?.body.innerHTML ?? "") && n?.body.textContent?.trim()) {
|
|
1272
1272
|
let t = et(e, n);
|
|
1273
1273
|
if (t.length) {
|
|
1274
|
-
|
|
1274
|
+
be(t);
|
|
1275
1275
|
return;
|
|
1276
1276
|
}
|
|
1277
1277
|
}
|
|
@@ -1280,18 +1280,18 @@ var Zn = (e) => {
|
|
|
1280
1280
|
};
|
|
1281
1281
|
return rt(e.registerCommand(Be, t, ke), e.registerCommand(je, t, ke));
|
|
1282
1282
|
}, [e]), null;
|
|
1283
|
-
},
|
|
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) => {
|
|
1284
1284
|
let t = e.trim().toLowerCase();
|
|
1285
1285
|
if (t === "" || t === "transparent") return !0;
|
|
1286
1286
|
let n = t.match(/^rgba\([^,]+,[^,]+,[^,]+,\s*([.\d]+)\s*\)$/);
|
|
1287
1287
|
return n !== null && Number(n[1]) === 0;
|
|
1288
|
-
},
|
|
1288
|
+
}, wr = (e) => {
|
|
1289
1289
|
let t = e.trim().replace(/^#/, "");
|
|
1290
1290
|
return /^[0-9a-fA-F]{3}$/.test(t) ? `#${t[0]}${t[0]}${t[1]}${t[1]}${t[2]}${t[2]}`.toLowerCase() : /^[0-9a-fA-F]{6}$/.test(t) ? `#${t.toLowerCase()}` : null;
|
|
1291
|
-
},
|
|
1291
|
+
}, Tr = (e) => {
|
|
1292
1292
|
let t = e.trim();
|
|
1293
1293
|
if (X(t)) return null;
|
|
1294
|
-
let n =
|
|
1294
|
+
let n = wr(t);
|
|
1295
1295
|
if (n) return {
|
|
1296
1296
|
r: Number.parseInt(n.slice(1, 3), 16),
|
|
1297
1297
|
g: Number.parseInt(n.slice(3, 5), 16),
|
|
@@ -1303,59 +1303,59 @@ var Zn = (e) => {
|
|
|
1303
1303
|
g: Number(r[2]),
|
|
1304
1304
|
b: Number(r[3])
|
|
1305
1305
|
} : null;
|
|
1306
|
-
},
|
|
1306
|
+
}, Er = ({ r: e, g: t, b: n }) => `#${[
|
|
1307
1307
|
e,
|
|
1308
1308
|
t,
|
|
1309
1309
|
n
|
|
1310
|
-
].map((e) =>
|
|
1310
|
+
].map((e) => Cr(Math.round(e), 0, 255).toString(16).padStart(2, "0")).join("")}`, Dr = (e, t) => {
|
|
1311
1311
|
if (X(e) && X(t)) return !0;
|
|
1312
|
-
let n =
|
|
1312
|
+
let n = Tr(e), r = Tr(t);
|
|
1313
1313
|
return !!(n && r && n.r === r.r && n.g === r.g && n.b === r.b);
|
|
1314
|
-
},
|
|
1314
|
+
}, Or = (e) => {
|
|
1315
1315
|
let t = e.r / 255, n = e.g / 255, r = e.b / 255, i = Math.max(t, n, r), a = Math.min(t, n, r), o = (i + a) / 2, s = i - a, c = 0;
|
|
1316
1316
|
return s !== 0 && (c = i === t ? ((n - r) / s + (n < r ? 6 : 0)) * 60 : i === n ? ((r - t) / s + 2) * 60 : ((t - n) / s + 4) * 60), {
|
|
1317
1317
|
h: c,
|
|
1318
1318
|
s: s === 0 ? 0 : s / (1 - Math.abs(2 * o - 1)),
|
|
1319
1319
|
l: o
|
|
1320
1320
|
};
|
|
1321
|
-
},
|
|
1321
|
+
}, kr = ({ h: e, s: t, l: n }) => {
|
|
1322
1322
|
let r = (e % 360 + 360) % 360, i = (1 - Math.abs(2 * n - 1)) * t, a = i * (1 - Math.abs(r / 60 % 2 - 1)), o = n - i / 2, s = 0, c = 0, l = 0;
|
|
1323
1323
|
return r < 60 ? (s = i, c = a) : r < 120 ? (s = a, c = i) : r < 180 ? (c = i, l = a) : r < 240 ? (c = a, l = i) : r < 300 ? (s = a, l = i) : (s = i, l = a), {
|
|
1324
1324
|
r: Math.round((s + o) * 255),
|
|
1325
1325
|
g: Math.round((c + o) * 255),
|
|
1326
1326
|
b: Math.round((l + o) * 255)
|
|
1327
1327
|
};
|
|
1328
|
-
},
|
|
1328
|
+
}, Ar = (e) => Er(kr(e)), jr = (e, t) => ({
|
|
1329
1329
|
h: Y(e) * 360,
|
|
1330
1330
|
s: 1,
|
|
1331
1331
|
l: Y(1 - t)
|
|
1332
|
-
}),
|
|
1332
|
+
}), Mr = (e) => ({
|
|
1333
1333
|
x: Y((e.h % 360 + 360) % 360 / 360),
|
|
1334
1334
|
y: Y(1 - e.l)
|
|
1335
|
-
}),
|
|
1335
|
+
}), Nr = (e, t, n) => ({
|
|
1336
1336
|
x: Y(n.width === 0 ? 0 : (e - n.left) / n.width),
|
|
1337
1337
|
y: Y(n.height === 0 ? 0 : (t - n.top) / n.height)
|
|
1338
|
-
}),
|
|
1339
|
-
let r =
|
|
1338
|
+
}), Pr = (e, t, n = Infinity) => {
|
|
1339
|
+
let r = Tr(t);
|
|
1340
1340
|
if (!r) return e;
|
|
1341
|
-
let i =
|
|
1342
|
-
return [i, ...e.filter((e) => !
|
|
1343
|
-
},
|
|
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) => {
|
|
1344
1344
|
let n = t % 11;
|
|
1345
1345
|
return Math.floor(t / 11) === 2 ? e[22] ?? e[t] : e[n] ?? e[t];
|
|
1346
|
-
}, Z = (...e) => e.filter(Boolean).join(" "),
|
|
1347
|
-
let t =
|
|
1346
|
+
}, Z = (...e) => e.filter(Boolean).join(" "), Lr = (e) => {
|
|
1347
|
+
let t = Tr(e) ?? {
|
|
1348
1348
|
r: 0,
|
|
1349
1349
|
g: 94,
|
|
1350
1350
|
b: 239
|
|
1351
1351
|
};
|
|
1352
1352
|
return {
|
|
1353
|
-
color:
|
|
1354
|
-
point:
|
|
1353
|
+
color: Er(t),
|
|
1354
|
+
point: Mr(Or(t))
|
|
1355
1355
|
};
|
|
1356
|
-
},
|
|
1357
|
-
let { t: l } = e(), [f, h] = d("presets"), [g, _] = d(() =>
|
|
1358
|
-
_(
|
|
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");
|
|
1359
1359
|
};
|
|
1360
1360
|
s(() => {
|
|
1361
1361
|
if (f !== "custom" || typeof ResizeObserver > "u") return;
|
|
@@ -1384,7 +1384,7 @@ var Zn = (e) => {
|
|
|
1384
1384
|
if (!e) return;
|
|
1385
1385
|
let t = () => {
|
|
1386
1386
|
let t = e.getBoundingClientRect().width;
|
|
1387
|
-
t > 0 && x(
|
|
1387
|
+
t > 0 && x(Fr(t));
|
|
1388
1388
|
};
|
|
1389
1389
|
if (t(), typeof ResizeObserver > "u") return;
|
|
1390
1390
|
let n = new ResizeObserver(t);
|
|
@@ -1393,7 +1393,7 @@ var Zn = (e) => {
|
|
|
1393
1393
|
let E = (e) => {
|
|
1394
1394
|
let t = S.current;
|
|
1395
1395
|
if (!t) return;
|
|
1396
|
-
let { x: n, y: r } =
|
|
1396
|
+
let { x: n, y: r } = Nr(e.clientX, e.clientY, t.getBoundingClientRect()), i = Ar(jr(n, r));
|
|
1397
1397
|
_({
|
|
1398
1398
|
color: i,
|
|
1399
1399
|
point: {
|
|
@@ -1432,7 +1432,7 @@ var Zn = (e) => {
|
|
|
1432
1432
|
role: "listbox",
|
|
1433
1433
|
"aria-label": l("editor.customColors"),
|
|
1434
1434
|
children: i.slice(0, b ?? i.length).map((e) => {
|
|
1435
|
-
let t =
|
|
1435
|
+
let t = Dr(r, e);
|
|
1436
1436
|
return /* @__PURE__ */ p("button", {
|
|
1437
1437
|
type: "button",
|
|
1438
1438
|
role: "option",
|
|
@@ -1509,8 +1509,8 @@ var Zn = (e) => {
|
|
|
1509
1509
|
className: V["bsy-mobile-editor__color-grid"],
|
|
1510
1510
|
role: "listbox",
|
|
1511
1511
|
"aria-label": l("editor.presetColors"),
|
|
1512
|
-
children:
|
|
1513
|
-
let n =
|
|
1512
|
+
children: dt.map((e, t) => {
|
|
1513
|
+
let n = Dr(r, e);
|
|
1514
1514
|
return /* @__PURE__ */ p("button", {
|
|
1515
1515
|
type: "button",
|
|
1516
1516
|
role: "option",
|
|
@@ -1519,7 +1519,7 @@ var Zn = (e) => {
|
|
|
1519
1519
|
className: Z(V["bsy-mobile-editor__color-swatch"], n && V["bsy-mobile-editor__color-swatch--selected"]),
|
|
1520
1520
|
style: {
|
|
1521
1521
|
"--swatch-color": e,
|
|
1522
|
-
"--swatch-ring":
|
|
1522
|
+
"--swatch-ring": Ir(dt, t)
|
|
1523
1523
|
},
|
|
1524
1524
|
onClick: () => a(e),
|
|
1525
1525
|
children: /* @__PURE__ */ p("span", { className: V["bsy-mobile-editor__color-swatch-fill"] })
|
|
@@ -1529,122 +1529,115 @@ var Zn = (e) => {
|
|
|
1529
1529
|
A
|
|
1530
1530
|
]
|
|
1531
1531
|
});
|
|
1532
|
-
},
|
|
1532
|
+
}, zr = (e, t) => {
|
|
1533
1533
|
H(e), e.update(() => {
|
|
1534
|
-
ot(
|
|
1534
|
+
ot(L(), () => t === "paragraph" ? _e() : ne(t));
|
|
1535
1535
|
});
|
|
1536
|
-
},
|
|
1536
|
+
}, Br = (e, t, n) => {
|
|
1537
1537
|
H(e), e.update(() => {
|
|
1538
|
-
|
|
1539
|
-
let e =
|
|
1538
|
+
Wt(n), Gt();
|
|
1539
|
+
let e = L();
|
|
1540
1540
|
e && at(e, t);
|
|
1541
1541
|
});
|
|
1542
|
-
},
|
|
1543
|
-
let [
|
|
1544
|
-
|
|
1545
|
-
},
|
|
1546
|
-
|
|
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);
|
|
1547
1547
|
};
|
|
1548
1548
|
return /* @__PURE__ */ m(f, { children: [
|
|
1549
1549
|
/* @__PURE__ */ p(r, {
|
|
1550
|
-
mode: "menu",
|
|
1551
1550
|
open: i === "align",
|
|
1552
|
-
title:
|
|
1553
|
-
onClose:
|
|
1551
|
+
title: S("editor.alignment"),
|
|
1552
|
+
onClose: o,
|
|
1554
1553
|
actions: [
|
|
1555
1554
|
{
|
|
1556
1555
|
key: "left",
|
|
1557
|
-
text:
|
|
1558
|
-
|
|
1559
|
-
name: "paragraph",
|
|
1560
|
-
size: 16
|
|
1561
|
-
})
|
|
1556
|
+
text: S("editor.leftAlign"),
|
|
1557
|
+
selected: a.align === "left"
|
|
1562
1558
|
},
|
|
1563
1559
|
{
|
|
1564
1560
|
key: "center",
|
|
1565
|
-
text:
|
|
1566
|
-
|
|
1567
|
-
name: "paragraphmiddle",
|
|
1568
|
-
size: 16
|
|
1569
|
-
})
|
|
1561
|
+
text: S("editor.centerAlign"),
|
|
1562
|
+
selected: a.align === "center"
|
|
1570
1563
|
},
|
|
1571
1564
|
{
|
|
1572
1565
|
key: "right",
|
|
1573
|
-
text:
|
|
1574
|
-
|
|
1575
|
-
name: "paragraphright",
|
|
1576
|
-
size: 16
|
|
1577
|
-
})
|
|
1566
|
+
text: S("editor.rightAlign"),
|
|
1567
|
+
selected: a.align === "right"
|
|
1578
1568
|
}
|
|
1579
1569
|
],
|
|
1580
1570
|
onAction: (e) => {
|
|
1581
|
-
H(
|
|
1571
|
+
H(x), x.dispatchCommand(Ne, e.key);
|
|
1582
1572
|
}
|
|
1583
1573
|
}),
|
|
1584
1574
|
/* @__PURE__ */ p(r, {
|
|
1585
|
-
mode: "menu",
|
|
1586
1575
|
open: i === "heading",
|
|
1587
|
-
title:
|
|
1588
|
-
onClose:
|
|
1576
|
+
title: S("editor.heading"),
|
|
1577
|
+
onClose: o,
|
|
1589
1578
|
actions: [
|
|
1590
1579
|
{
|
|
1591
1580
|
key: "paragraph",
|
|
1592
|
-
text:
|
|
1581
|
+
text: S("editor.paragraph"),
|
|
1582
|
+
selected: a.headingTag === !1
|
|
1593
1583
|
},
|
|
1594
1584
|
{
|
|
1595
1585
|
key: "h1",
|
|
1596
|
-
text:
|
|
1586
|
+
text: S("editor.heading1"),
|
|
1587
|
+
selected: a.headingTag === "h1"
|
|
1597
1588
|
},
|
|
1598
1589
|
{
|
|
1599
1590
|
key: "h2",
|
|
1600
|
-
text:
|
|
1591
|
+
text: S("editor.heading2"),
|
|
1592
|
+
selected: a.headingTag === "h2"
|
|
1601
1593
|
},
|
|
1602
1594
|
{
|
|
1603
1595
|
key: "h3",
|
|
1604
|
-
text:
|
|
1596
|
+
text: S("editor.heading3"),
|
|
1597
|
+
selected: a.headingTag === "h3"
|
|
1605
1598
|
}
|
|
1606
1599
|
],
|
|
1607
|
-
onAction: (e) =>
|
|
1600
|
+
onAction: (e) => zr(x, e.key)
|
|
1608
1601
|
}),
|
|
1609
1602
|
/* @__PURE__ */ p(r, {
|
|
1610
|
-
mode: "menu",
|
|
1611
1603
|
open: i === "fontSize",
|
|
1612
|
-
title:
|
|
1613
|
-
onClose:
|
|
1604
|
+
title: S("editor.fontSize"),
|
|
1605
|
+
onClose: o,
|
|
1614
1606
|
actions: st.map((e) => ({
|
|
1615
1607
|
key: e.value,
|
|
1616
|
-
text: e.label
|
|
1608
|
+
text: e.label,
|
|
1609
|
+
selected: e.value === a.fontSize
|
|
1617
1610
|
})),
|
|
1618
|
-
onAction: (e) =>
|
|
1611
|
+
onAction: (e) => Br(x, { "font-size": e.key })
|
|
1619
1612
|
}),
|
|
1620
1613
|
/* @__PURE__ */ p(t, {
|
|
1621
|
-
open:
|
|
1614
|
+
open: E !== null,
|
|
1622
1615
|
onClose: () => {
|
|
1623
|
-
let e =
|
|
1624
|
-
e &&
|
|
1616
|
+
let e = T.current;
|
|
1617
|
+
e && k(e), o();
|
|
1625
1618
|
},
|
|
1626
1619
|
position: "bottom",
|
|
1627
|
-
children:
|
|
1628
|
-
mode:
|
|
1629
|
-
currentColor:
|
|
1630
|
-
customColors:
|
|
1631
|
-
onApply:
|
|
1620
|
+
children: E ? /* @__PURE__ */ p(Rr, {
|
|
1621
|
+
mode: E,
|
|
1622
|
+
currentColor: D,
|
|
1623
|
+
customColors: C,
|
|
1624
|
+
onApply: O,
|
|
1632
1625
|
onCustomDraftChange: (e) => {
|
|
1633
|
-
|
|
1626
|
+
T.current = e;
|
|
1634
1627
|
},
|
|
1635
|
-
onCustomConfirm:
|
|
1636
|
-
},
|
|
1628
|
+
onCustomConfirm: k
|
|
1629
|
+
}, E) : null
|
|
1637
1630
|
}),
|
|
1638
1631
|
/* @__PURE__ */ p(r, {
|
|
1639
1632
|
mode: "menu",
|
|
1640
1633
|
open: i === "ai",
|
|
1641
|
-
onClose:
|
|
1634
|
+
onClose: o,
|
|
1642
1635
|
actions: [{
|
|
1643
1636
|
key: "typeset",
|
|
1644
|
-
text:
|
|
1645
|
-
disabled: !
|
|
1637
|
+
text: S("editor.aiTypeset"),
|
|
1638
|
+
disabled: !y,
|
|
1646
1639
|
icon: /* @__PURE__ */ p("img", {
|
|
1647
|
-
src:
|
|
1640
|
+
src: xr,
|
|
1648
1641
|
alt: "",
|
|
1649
1642
|
width: 16,
|
|
1650
1643
|
height: 16,
|
|
@@ -1653,10 +1646,10 @@ var Zn = (e) => {
|
|
|
1653
1646
|
})
|
|
1654
1647
|
}, {
|
|
1655
1648
|
key: "polish",
|
|
1656
|
-
text:
|
|
1657
|
-
disabled: !
|
|
1649
|
+
text: S("editor.aiPolish"),
|
|
1650
|
+
disabled: !b,
|
|
1658
1651
|
icon: /* @__PURE__ */ p("img", {
|
|
1659
|
-
src:
|
|
1652
|
+
src: Sr,
|
|
1660
1653
|
alt: "",
|
|
1661
1654
|
width: 16,
|
|
1662
1655
|
height: 16,
|
|
@@ -1666,47 +1659,47 @@ var Zn = (e) => {
|
|
|
1666
1659
|
}],
|
|
1667
1660
|
onAction: (e) => {
|
|
1668
1661
|
if (e.key === "typeset") {
|
|
1669
|
-
|
|
1662
|
+
s();
|
|
1670
1663
|
return;
|
|
1671
1664
|
}
|
|
1672
|
-
|
|
1665
|
+
c();
|
|
1673
1666
|
}
|
|
1674
1667
|
}),
|
|
1675
1668
|
/* @__PURE__ */ p(r, {
|
|
1676
1669
|
mode: "menu",
|
|
1677
1670
|
open: i === "aiPreset",
|
|
1678
|
-
title:
|
|
1679
|
-
onClose:
|
|
1680
|
-
actions:
|
|
1671
|
+
title: S("editor.aiPolish"),
|
|
1672
|
+
onClose: o,
|
|
1673
|
+
actions: ft.map((e) => ({
|
|
1681
1674
|
key: e,
|
|
1682
|
-
text:
|
|
1675
|
+
text: S(pt[e])
|
|
1683
1676
|
})),
|
|
1684
|
-
onAction: (e) =>
|
|
1677
|
+
onAction: (e) => l(e.key)
|
|
1685
1678
|
}),
|
|
1686
1679
|
/* @__PURE__ */ p(r, {
|
|
1687
1680
|
mode: "menu",
|
|
1688
1681
|
open: i === "picture",
|
|
1689
|
-
title:
|
|
1690
|
-
onClose:
|
|
1682
|
+
title: S("editor.picture"),
|
|
1683
|
+
onClose: o,
|
|
1691
1684
|
actions: [{
|
|
1692
1685
|
key: "upload",
|
|
1693
|
-
text:
|
|
1686
|
+
text: S("editor.uploadImage"),
|
|
1694
1687
|
icon: /* @__PURE__ */ p(n, {
|
|
1695
1688
|
name: "picture",
|
|
1696
1689
|
size: 16
|
|
1697
1690
|
})
|
|
1698
1691
|
}, {
|
|
1699
1692
|
key: "url",
|
|
1700
|
-
text:
|
|
1693
|
+
text: S("editor.imageUrl"),
|
|
1701
1694
|
icon: /* @__PURE__ */ p(n, {
|
|
1702
1695
|
name: "Insertlink",
|
|
1703
1696
|
size: 16
|
|
1704
1697
|
})
|
|
1705
1698
|
}],
|
|
1706
|
-
onAction: (e) =>
|
|
1699
|
+
onAction: (e) => h(e.key)
|
|
1707
1700
|
})
|
|
1708
1701
|
] });
|
|
1709
|
-
},
|
|
1702
|
+
}, Hr = ({ open: r, title: i, bodyClassName: a, onClose: o, onConfirm: s, children: c }) => {
|
|
1710
1703
|
let { t: l } = e();
|
|
1711
1704
|
return /* @__PURE__ */ p(t, {
|
|
1712
1705
|
open: r,
|
|
@@ -1751,11 +1744,11 @@ var Zn = (e) => {
|
|
|
1751
1744
|
]
|
|
1752
1745
|
})
|
|
1753
1746
|
});
|
|
1754
|
-
},
|
|
1747
|
+
}, Ur = ({ open: t, seed: r, onClose: i, onConfirm: a }) => {
|
|
1755
1748
|
let { t: o } = e(), [c, l] = d(""), [u, f] = d(""), [h, g] = d(!0);
|
|
1756
1749
|
return s(() => {
|
|
1757
1750
|
!t || !r || (l(r.url), f(r.text), g(r.newBlank));
|
|
1758
|
-
}, [t, r]), /* @__PURE__ */ m(
|
|
1751
|
+
}, [t, r]), /* @__PURE__ */ m(Hr, {
|
|
1759
1752
|
open: t,
|
|
1760
1753
|
title: o("editor.link"),
|
|
1761
1754
|
bodyClassName: V["bsy-mobile-editor__sheet-body--stack"],
|
|
@@ -1817,13 +1810,13 @@ var Zn = (e) => {
|
|
|
1817
1810
|
})
|
|
1818
1811
|
]
|
|
1819
1812
|
});
|
|
1820
|
-
},
|
|
1813
|
+
}, Wr = /^https?:\/\/.+/i, Gr = ({ open: t, onClose: n, onConfirm: r }) => {
|
|
1821
1814
|
let { t: i } = e(), [o, c] = d(""), [l, u] = d(null), f = a((e) => {
|
|
1822
1815
|
e?.focus();
|
|
1823
1816
|
}, []);
|
|
1824
1817
|
return s(() => {
|
|
1825
1818
|
t && (c(""), u(null));
|
|
1826
|
-
}, [t]), /* @__PURE__ */ p(
|
|
1819
|
+
}, [t]), /* @__PURE__ */ p(Hr, {
|
|
1827
1820
|
open: t,
|
|
1828
1821
|
title: i("editor.imageUrl"),
|
|
1829
1822
|
onClose: n,
|
|
@@ -1833,7 +1826,7 @@ var Zn = (e) => {
|
|
|
1833
1826
|
u(i("editor.imageUrlRequired"));
|
|
1834
1827
|
return;
|
|
1835
1828
|
}
|
|
1836
|
-
if (!
|
|
1829
|
+
if (!Wr.test(e)) {
|
|
1837
1830
|
u(i("editor.imageUrlInvalid"));
|
|
1838
1831
|
return;
|
|
1839
1832
|
}
|
|
@@ -1866,13 +1859,16 @@ var Zn = (e) => {
|
|
|
1866
1859
|
]
|
|
1867
1860
|
})
|
|
1868
1861
|
});
|
|
1869
|
-
},
|
|
1862
|
+
}, Kr = `
|
|
1870
1863
|
:host {
|
|
1871
1864
|
all: initial;
|
|
1872
1865
|
display: block;
|
|
1866
|
+
box-sizing: border-box;
|
|
1873
1867
|
width: 100%;
|
|
1874
1868
|
max-width: 100%;
|
|
1875
1869
|
min-width: 0;
|
|
1870
|
+
overflow-x: auto;
|
|
1871
|
+
-webkit-overflow-scrolling: touch;
|
|
1876
1872
|
}
|
|
1877
1873
|
.bsy-editor-html-preview__body {
|
|
1878
1874
|
color: #030303;
|
|
@@ -1959,7 +1955,7 @@ var Zn = (e) => {
|
|
|
1959
1955
|
.bsy-editor-html-preview__body li,
|
|
1960
1956
|
.bsy-editor-html-preview__body .editor-listitem {
|
|
1961
1957
|
margin: 0;
|
|
1962
|
-
margin-inline-start: ${
|
|
1958
|
+
margin-inline-start: ${Pt};
|
|
1963
1959
|
list-style: inherit;
|
|
1964
1960
|
}
|
|
1965
1961
|
.bsy-editor-html-preview__body .editor-nested-listitem {
|
|
@@ -2038,15 +2034,15 @@ var Zn = (e) => {
|
|
|
2038
2034
|
height: auto;
|
|
2039
2035
|
vertical-align: baseline;
|
|
2040
2036
|
}
|
|
2041
|
-
`,
|
|
2037
|
+
`, qr = ({ html: e }) => {
|
|
2042
2038
|
let t = u(null);
|
|
2043
2039
|
return l(() => {
|
|
2044
|
-
|
|
2040
|
+
zt(t.current, e, U, Kr);
|
|
2045
2041
|
}, [e]), /* @__PURE__ */ p("div", {
|
|
2046
2042
|
ref: t,
|
|
2047
2043
|
className: "bsy-editor-html-preview"
|
|
2048
2044
|
});
|
|
2049
|
-
},
|
|
2045
|
+
}, Jr = () => {
|
|
2050
2046
|
let e = `${c().replace(/:/g, "")}g`;
|
|
2051
2047
|
return /* @__PURE__ */ p("span", {
|
|
2052
2048
|
className: V["bsy-mobile-editor__ai-think-icon"],
|
|
@@ -2085,7 +2081,7 @@ var Zn = (e) => {
|
|
|
2085
2081
|
}) })]
|
|
2086
2082
|
})
|
|
2087
2083
|
});
|
|
2088
|
-
},
|
|
2084
|
+
}, Yr = (t, n) => {
|
|
2089
2085
|
let { t: r } = e(), i = t.status === "loading" && !n, [a, o] = d(!0), [c, l] = d(0), f = u(Date.now()), p = u(null), m = t.reasoning ?? "";
|
|
2090
2086
|
return s(() => {
|
|
2091
2087
|
if (!i) {
|
|
@@ -2105,12 +2101,12 @@ var Zn = (e) => {
|
|
|
2105
2101
|
reasoning: m,
|
|
2106
2102
|
toggle: () => o((e) => !e)
|
|
2107
2103
|
};
|
|
2108
|
-
},
|
|
2104
|
+
}, Xr = ({ model: e }) => /* @__PURE__ */ m("button", {
|
|
2109
2105
|
type: "button",
|
|
2110
2106
|
className: V["bsy-mobile-editor__ai-think-head"],
|
|
2111
2107
|
disabled: e.thinking,
|
|
2112
2108
|
onClick: e.toggle,
|
|
2113
|
-
children: [e.thinking ? /* @__PURE__ */ p(
|
|
2109
|
+
children: [e.thinking ? /* @__PURE__ */ p(Jr, {}) : /* @__PURE__ */ p(n, {
|
|
2114
2110
|
name: "arrow-down",
|
|
2115
2111
|
size: 12,
|
|
2116
2112
|
className: [V["bsy-mobile-editor__ai-think-arrow"], e.open ? V["bsy-mobile-editor__ai-think-arrow--open"] : ""].filter(Boolean).join(" ")
|
|
@@ -2118,10 +2114,10 @@ var Zn = (e) => {
|
|
|
2118
2114
|
className: e.thinking ? `${V["bsy-mobile-editor__ai-think-label"]} ${V["bsy-mobile-editor__ai-think-label--shimmer"]}` : V["bsy-mobile-editor__ai-think-label"],
|
|
2119
2115
|
children: e.label
|
|
2120
2116
|
})]
|
|
2121
|
-
}),
|
|
2117
|
+
}), Zr = ({ model: e }) => !e.visible || !e.open || !e.reasoning ? null : /* @__PURE__ */ p("div", {
|
|
2122
2118
|
className: V["bsy-mobile-editor__ai-think-body"],
|
|
2123
2119
|
children: e.reasoning
|
|
2124
|
-
}),
|
|
2120
|
+
}), Qr = ({ enabled: e, status: t, revision: n, compute: r }) => {
|
|
2125
2121
|
let [i, a] = d(""), o = u(r);
|
|
2126
2122
|
o.current = r;
|
|
2127
2123
|
let c = u(null);
|
|
@@ -2148,7 +2144,7 @@ var Zn = (e) => {
|
|
|
2148
2144
|
]), s(() => () => {
|
|
2149
2145
|
c.current !== null && cancelAnimationFrame(c.current);
|
|
2150
2146
|
}, []), i;
|
|
2151
|
-
},
|
|
2147
|
+
}, $r = 32, ei = .25, ti = 2, ni = ({ viewportRef: e, enabled: t, revision: n }) => {
|
|
2152
2148
|
let r = u(!0), i = u(!1), o = u(0), c = a(() => e.current ?? void 0, [e]), l = a(() => {
|
|
2153
2149
|
o.current = 0;
|
|
2154
2150
|
let t = e.current;
|
|
@@ -2158,7 +2154,7 @@ var Zn = (e) => {
|
|
|
2158
2154
|
t.scrollTop = n;
|
|
2159
2155
|
return;
|
|
2160
2156
|
}
|
|
2161
|
-
t.scrollTop += Math.max(i *
|
|
2157
|
+
t.scrollTop += Math.max(i * ei, Math.min(i, ti)), o.current = requestAnimationFrame(l);
|
|
2162
2158
|
}, [e]), d = a(() => {
|
|
2163
2159
|
!o.current && r.current && (o.current = requestAnimationFrame(l));
|
|
2164
2160
|
}, [l]);
|
|
@@ -2185,7 +2181,7 @@ var Zn = (e) => {
|
|
|
2185
2181
|
let f = () => {
|
|
2186
2182
|
let t = e.current;
|
|
2187
2183
|
if (!t) return;
|
|
2188
|
-
let n = t.scrollHeight - t.clientHeight - t.scrollTop <=
|
|
2184
|
+
let n = t.scrollHeight - t.clientHeight - t.scrollTop <= $r;
|
|
2189
2185
|
i.current ? (i.current = !1, r.current = n, !n && o.current && (cancelAnimationFrame(o.current), o.current = 0)) : n && (r.current = !0);
|
|
2190
2186
|
}, p = () => {
|
|
2191
2187
|
i.current = !0;
|
|
@@ -2203,16 +2199,16 @@ var Zn = (e) => {
|
|
|
2203
2199
|
passive: !0,
|
|
2204
2200
|
enable: t
|
|
2205
2201
|
}), { onScroll: f };
|
|
2206
|
-
},
|
|
2207
|
-
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({
|
|
2208
2204
|
enabled: i && !!a,
|
|
2209
2205
|
status: S,
|
|
2210
2206
|
revision: C,
|
|
2211
|
-
compute: () => a === "polish" ? U(
|
|
2212
|
-
}), T = !!w.trim(), E =
|
|
2207
|
+
compute: () => a === "polish" ? U(Mn(o, C)) : Xn(C, s)
|
|
2208
|
+
}), T = !!w.trim(), E = Yr({
|
|
2213
2209
|
status: S,
|
|
2214
2210
|
reasoning: c?.reasoning
|
|
2215
|
-
}, T), D =
|
|
2211
|
+
}, T), D = ni({
|
|
2216
2212
|
viewportRef: y,
|
|
2217
2213
|
enabled: i && S === "loading",
|
|
2218
2214
|
revision: `${c?.reasoning ?? ""}\0${w}`
|
|
@@ -2224,7 +2220,7 @@ var Zn = (e) => {
|
|
|
2224
2220
|
closeOnClickOverlay: !1,
|
|
2225
2221
|
children: [/* @__PURE__ */ m("div", {
|
|
2226
2222
|
className: V["bsy-mobile-editor__ai"],
|
|
2227
|
-
style: { height:
|
|
2223
|
+
style: { height: _t },
|
|
2228
2224
|
children: [
|
|
2229
2225
|
/* @__PURE__ */ m("div", {
|
|
2230
2226
|
className: V["bsy-mobile-editor__header"],
|
|
@@ -2257,7 +2253,7 @@ var Zn = (e) => {
|
|
|
2257
2253
|
type: "button",
|
|
2258
2254
|
className: V["bsy-mobile-editor__ai-preset"],
|
|
2259
2255
|
onClick: () => x(!0),
|
|
2260
|
-
children: [v(
|
|
2256
|
+
children: [v(pt[l]), /* @__PURE__ */ p(n, {
|
|
2261
2257
|
name: "arrow-down",
|
|
2262
2258
|
size: 16
|
|
2263
2259
|
})]
|
|
@@ -2265,7 +2261,7 @@ var Zn = (e) => {
|
|
|
2265
2261
|
}),
|
|
2266
2262
|
E.visible ? /* @__PURE__ */ p("div", {
|
|
2267
2263
|
className: V["bsy-mobile-editor__ai-think-pin"],
|
|
2268
|
-
children: /* @__PURE__ */ p(
|
|
2264
|
+
children: /* @__PURE__ */ p(Xr, { model: E })
|
|
2269
2265
|
}) : null,
|
|
2270
2266
|
/* @__PURE__ */ p("div", {
|
|
2271
2267
|
ref: y,
|
|
@@ -2274,7 +2270,7 @@ var Zn = (e) => {
|
|
|
2274
2270
|
children: S === "error" ? /* @__PURE__ */ p("p", {
|
|
2275
2271
|
className: V["bsy-mobile-editor__ai-error"],
|
|
2276
2272
|
children: c?.errorMessage || v("editor.aiError")
|
|
2277
|
-
}) : /* @__PURE__ */ m(f, { children: [/* @__PURE__ */ p(
|
|
2273
|
+
}) : /* @__PURE__ */ m(f, { children: [/* @__PURE__ */ p(Zr, { model: E }), T ? /* @__PURE__ */ p(qr, { html: w }) : null] })
|
|
2278
2274
|
})
|
|
2279
2275
|
]
|
|
2280
2276
|
}),
|
|
@@ -2289,7 +2285,7 @@ var Zn = (e) => {
|
|
|
2289
2285
|
})
|
|
2290
2286
|
}), /* @__PURE__ */ p("div", {
|
|
2291
2287
|
className: V["bsy-mobile-editor__ai-section-scroll"],
|
|
2292
|
-
children: /* @__PURE__ */ p(
|
|
2288
|
+
children: /* @__PURE__ */ p(qr, { html: o })
|
|
2293
2289
|
})]
|
|
2294
2290
|
})
|
|
2295
2291
|
]
|
|
@@ -2314,35 +2310,35 @@ var Zn = (e) => {
|
|
|
2314
2310
|
open: b,
|
|
2315
2311
|
title: v("editor.aiPolish"),
|
|
2316
2312
|
onClose: () => x(!1),
|
|
2317
|
-
actions:
|
|
2313
|
+
actions: ft.map((e) => ({
|
|
2318
2314
|
key: e,
|
|
2319
|
-
text: v(
|
|
2315
|
+
text: v(pt[e])
|
|
2320
2316
|
})),
|
|
2321
2317
|
onAction: (e) => _(e.key)
|
|
2322
2318
|
}) : null]
|
|
2323
2319
|
});
|
|
2324
|
-
},
|
|
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 = {
|
|
2325
2321
|
fontColor: {
|
|
2326
|
-
path:
|
|
2327
|
-
clipHeight:
|
|
2322
|
+
path: ii,
|
|
2323
|
+
clipHeight: oi,
|
|
2328
2324
|
x: 128,
|
|
2329
2325
|
width: 768,
|
|
2330
2326
|
rx: 0
|
|
2331
2327
|
},
|
|
2332
2328
|
fill: {
|
|
2333
|
-
path:
|
|
2329
|
+
path: ai,
|
|
2334
2330
|
clipHeight: 816,
|
|
2335
2331
|
x: 112,
|
|
2336
2332
|
width: 800,
|
|
2337
2333
|
rx: 8
|
|
2338
2334
|
}
|
|
2339
|
-
},
|
|
2335
|
+
}, ui = (e, t) => {
|
|
2340
2336
|
let n = t.trim().toLowerCase();
|
|
2341
|
-
if (e === "fill") return !n || n === "transparent" ||
|
|
2337
|
+
if (e === "fill") return !n || n === "transparent" || ci.test(n);
|
|
2342
2338
|
let r = n.replace(/\s+/g, "");
|
|
2343
2339
|
return r === "#000" || r === "#000000" || r === "black" || r === "rgb(0,0,0)" || r === "rgba(0,0,0,1)" || r === "rgba(0,0,0,1.0)";
|
|
2344
|
-
},
|
|
2345
|
-
let r = `${c().replace(/:/g, "")}clip`, i =
|
|
2340
|
+
}, di = ({ variant: e, barColor: t, size: n }) => {
|
|
2341
|
+
let r = `${c().replace(/:/g, "")}clip`, i = li[e];
|
|
2346
2342
|
return /* @__PURE__ */ m("svg", {
|
|
2347
2343
|
width: n,
|
|
2348
2344
|
height: n,
|
|
@@ -2365,21 +2361,22 @@ var Zn = (e) => {
|
|
|
2365
2361
|
}),
|
|
2366
2362
|
/* @__PURE__ */ p("rect", {
|
|
2367
2363
|
x: i.x,
|
|
2368
|
-
y:
|
|
2364
|
+
y: oi,
|
|
2369
2365
|
width: i.width,
|
|
2370
|
-
height:
|
|
2366
|
+
height: si,
|
|
2371
2367
|
rx: i.rx,
|
|
2372
|
-
fill:
|
|
2368
|
+
fill: ui(e, t) ? "currentColor" : t
|
|
2373
2369
|
})
|
|
2374
2370
|
]
|
|
2375
2371
|
});
|
|
2376
|
-
},
|
|
2372
|
+
}, fi = {
|
|
2377
2373
|
bold: !1,
|
|
2378
2374
|
italic: !1,
|
|
2379
2375
|
underline: !1,
|
|
2380
2376
|
strikethrough: !1,
|
|
2381
|
-
|
|
2382
|
-
|
|
2377
|
+
fontSize: ct,
|
|
2378
|
+
fontColor: lt,
|
|
2379
|
+
backgroundColor: ut,
|
|
2383
2380
|
align: "left",
|
|
2384
2381
|
listType: !1,
|
|
2385
2382
|
canIndent: !0,
|
|
@@ -2387,54 +2384,51 @@ var Zn = (e) => {
|
|
|
2387
2384
|
headingTag: !1,
|
|
2388
2385
|
hasRangeSelection: !1,
|
|
2389
2386
|
hasEditorText: !1
|
|
2390
|
-
},
|
|
2391
|
-
|
|
2392
|
-
|
|
2393
|
-
return r.length === 0 ? !!t?.hasFormat(n) : r.every((e) => e.hasFormat(n));
|
|
2394
|
-
}, mi = (e) => {
|
|
2395
|
-
let t = !!F().getTextContent().trim(), n = {
|
|
2396
|
-
...di,
|
|
2387
|
+
}, pi = (e) => e === "center" || e === "right" || e === "left" ? e : e === "end" ? "right" : "left", mi = (e) => {
|
|
2388
|
+
let t = !!I().getTextContent().trim(), n = {
|
|
2389
|
+
...fi,
|
|
2397
2390
|
hasEditorText: t
|
|
2398
2391
|
};
|
|
2399
2392
|
if (!e) return n;
|
|
2400
|
-
let r =
|
|
2401
|
-
if (!
|
|
2402
|
-
let i = it(r, "
|
|
2393
|
+
let r = L();
|
|
2394
|
+
if (!R(r)) return n;
|
|
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) => {
|
|
2403
2396
|
let t = e.getParent();
|
|
2404
|
-
return t !== null &&
|
|
2397
|
+
return t !== null && Ce(t);
|
|
2405
2398
|
});
|
|
2406
|
-
|
|
2407
|
-
let
|
|
2408
|
-
if (S(
|
|
2409
|
-
|
|
2410
|
-
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();
|
|
2411
2404
|
if (C(e)) {
|
|
2412
2405
|
let t = e.getListType();
|
|
2413
|
-
|
|
2406
|
+
u = t === "number" || t === "bullet" ? t : !1;
|
|
2414
2407
|
}
|
|
2415
2408
|
}
|
|
2416
|
-
let
|
|
2409
|
+
let f = B(s, re), p = re(f) ? f.getTag() : void 0;
|
|
2417
2410
|
return {
|
|
2418
|
-
bold:
|
|
2419
|
-
italic:
|
|
2420
|
-
underline:
|
|
2421
|
-
strikethrough:
|
|
2422
|
-
|
|
2423
|
-
|
|
2424
|
-
|
|
2425
|
-
|
|
2426
|
-
|
|
2427
|
-
|
|
2428
|
-
|
|
2411
|
+
bold: r.hasFormat("bold"),
|
|
2412
|
+
italic: r.hasFormat("italic"),
|
|
2413
|
+
underline: r.hasFormat("underline"),
|
|
2414
|
+
strikethrough: r.hasFormat("strikethrough"),
|
|
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,
|
|
2429
2423
|
hasRangeSelection: !0,
|
|
2430
2424
|
hasEditorText: t
|
|
2431
2425
|
};
|
|
2432
2426
|
}, hi = (e, t) => {
|
|
2433
2427
|
e.isEditable() || e.setEditable(!0), e.update(() => {
|
|
2434
|
-
|
|
2428
|
+
Gt(), t(mi(!0));
|
|
2435
2429
|
}), e.focus(void 0, { defaultSelection: "rootStart" });
|
|
2436
2430
|
}, gi = (e) => {
|
|
2437
|
-
let t =
|
|
2431
|
+
let t = fi;
|
|
2438
2432
|
return hi(e, (e) => {
|
|
2439
2433
|
t = e;
|
|
2440
2434
|
}), t;
|
|
@@ -2608,7 +2602,7 @@ var Zn = (e) => {
|
|
|
2608
2602
|
disabled: t,
|
|
2609
2603
|
label: d("editor.fontColor"),
|
|
2610
2604
|
onClick: () => o("fontColor"),
|
|
2611
|
-
children: /* @__PURE__ */ p(
|
|
2605
|
+
children: /* @__PURE__ */ p(di, {
|
|
2612
2606
|
variant: "fontColor",
|
|
2613
2607
|
barColor: i.fontColor,
|
|
2614
2608
|
size: Q
|
|
@@ -2619,7 +2613,7 @@ var Zn = (e) => {
|
|
|
2619
2613
|
disabled: t,
|
|
2620
2614
|
label: d("editor.fill"),
|
|
2621
2615
|
onClick: () => o("fill"),
|
|
2622
|
-
children: /* @__PURE__ */ p(
|
|
2616
|
+
children: /* @__PURE__ */ p(di, {
|
|
2623
2617
|
variant: "fill",
|
|
2624
2618
|
barColor: i.fill,
|
|
2625
2619
|
size: Q
|
|
@@ -2656,7 +2650,7 @@ var Zn = (e) => {
|
|
|
2656
2650
|
label: d("editor.ai"),
|
|
2657
2651
|
onClick: () => o("ai"),
|
|
2658
2652
|
children: [/* @__PURE__ */ p("img", {
|
|
2659
|
-
src:
|
|
2653
|
+
src: xr,
|
|
2660
2654
|
alt: "",
|
|
2661
2655
|
width: Q,
|
|
2662
2656
|
height: Q,
|
|
@@ -2692,19 +2686,33 @@ var Zn = (e) => {
|
|
|
2692
2686
|
})
|
|
2693
2687
|
})]
|
|
2694
2688
|
});
|
|
2695
|
-
}, Si = (
|
|
2696
|
-
|
|
2689
|
+
}, Si = () => {
|
|
2690
|
+
if (I().getTextContent().trim() !== "") return !1;
|
|
2691
|
+
let e = L();
|
|
2692
|
+
return R(e) && (e.format !== 0 || e.style.trim() !== "");
|
|
2693
|
+
}, Ci = () => {
|
|
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);
|
|
2697
2699
|
return s(() => {
|
|
2698
2700
|
let n = () => {
|
|
2699
2701
|
t.getEditorState().read(() => {
|
|
2700
2702
|
r(mi(e));
|
|
2701
2703
|
}, { editor: t });
|
|
2702
2704
|
};
|
|
2703
|
-
return n(), t.registerUpdateListener(() => {
|
|
2705
|
+
return n(), t.registerUpdateListener(({ editorState: e }) => {
|
|
2706
|
+
if (e.read(() => Si())) {
|
|
2707
|
+
t.update(() => {
|
|
2708
|
+
Ci();
|
|
2709
|
+
});
|
|
2710
|
+
return;
|
|
2711
|
+
}
|
|
2704
2712
|
n();
|
|
2705
2713
|
});
|
|
2706
2714
|
}, [t, e]), n;
|
|
2707
|
-
},
|
|
2715
|
+
}, Ti = "plaintext", Ei = "github-light", Di = new Set([
|
|
2708
2716
|
"plaintext",
|
|
2709
2717
|
"css",
|
|
2710
2718
|
"html",
|
|
@@ -2726,7 +2734,7 @@ var Zn = (e) => {
|
|
|
2726
2734
|
"bash",
|
|
2727
2735
|
"lua",
|
|
2728
2736
|
"markdown"
|
|
2729
|
-
]),
|
|
2737
|
+
]), Oi = (e) => e && Di.has(e) ? e : Ti, ki = {
|
|
2730
2738
|
css: () => import("@shikijs/langs/css"),
|
|
2731
2739
|
html: () => import("@shikijs/langs/html"),
|
|
2732
2740
|
xml: () => import("@shikijs/langs/xml"),
|
|
@@ -2747,41 +2755,41 @@ var Zn = (e) => {
|
|
|
2747
2755
|
bash: () => import("@shikijs/langs/shellscript"),
|
|
2748
2756
|
lua: () => import("@shikijs/langs/lua"),
|
|
2749
2757
|
markdown: () => import("@shikijs/langs/markdown")
|
|
2750
|
-
},
|
|
2758
|
+
}, Ai = (e) => e === "bash" ? "shellscript" : e, ji = (e) => e in ki, Mi = null, Ni = null, Pi = /* @__PURE__ */ new Map(), Fi = () => (Mi ||= Promise.all([import("@shikijs/core"), import("@shikijs/engine-javascript")]).then(([{ createHighlighterCoreSync: e }, { createJavaScriptRegexEngine: t }]) => e({
|
|
2751
2759
|
engine: t(),
|
|
2752
2760
|
langs: [],
|
|
2753
2761
|
themes: []
|
|
2754
2762
|
})).catch((e) => {
|
|
2755
|
-
throw
|
|
2756
|
-
}),
|
|
2757
|
-
let t =
|
|
2758
|
-
return t || (t =
|
|
2759
|
-
let n =
|
|
2763
|
+
throw Mi = null, e;
|
|
2764
|
+
}), Mi), Ii = (e, t) => ji(t) && e.getLoadedLanguages().includes(Ai(t)), Li = (e) => {
|
|
2765
|
+
let t = Pi.get(e);
|
|
2766
|
+
return t || (t = Fi().then(async (t) => {
|
|
2767
|
+
let n = Ai(e);
|
|
2760
2768
|
if (!t.getLoadedLanguages().includes(n)) {
|
|
2761
|
-
let n = await
|
|
2769
|
+
let n = await ki[e]();
|
|
2762
2770
|
await t.loadLanguage(n.default);
|
|
2763
2771
|
}
|
|
2764
2772
|
return t;
|
|
2765
2773
|
}).catch((t) => {
|
|
2766
|
-
throw
|
|
2767
|
-
}),
|
|
2768
|
-
},
|
|
2774
|
+
throw Pi.delete(e), t;
|
|
2775
|
+
}), Pi.set(e, t)), t;
|
|
2776
|
+
}, Ri = () => (Ni ||= Fi().then(async (e) => {
|
|
2769
2777
|
if (!e.getLoadedThemes().includes("github-light")) {
|
|
2770
2778
|
let t = await import("@shikijs/themes/github-light");
|
|
2771
2779
|
await e.loadTheme(t.default);
|
|
2772
2780
|
}
|
|
2773
2781
|
return e;
|
|
2774
2782
|
}).catch((e) => {
|
|
2775
|
-
throw
|
|
2776
|
-
}),
|
|
2783
|
+
throw Ni = null, e;
|
|
2784
|
+
}), Ni), zi = (e, t, n) => {
|
|
2777
2785
|
let r = e.getTextContent();
|
|
2778
|
-
if (e.getStyle() && e.setStyle(""), !n || !
|
|
2786
|
+
if (e.getStyle() && e.setStyle(""), !n || !Ii(n, t)) return ee(r);
|
|
2779
2787
|
let i = n.codeToTokens(r, {
|
|
2780
|
-
lang:
|
|
2781
|
-
theme:
|
|
2788
|
+
lang: Ai(t),
|
|
2789
|
+
theme: Ei
|
|
2782
2790
|
}).tokens, a = [];
|
|
2783
2791
|
return i.forEach((e, t) => {
|
|
2784
|
-
t && a.push(
|
|
2792
|
+
t && a.push(ge()), e.forEach((e) => {
|
|
2785
2793
|
e.content.split(" ").forEach((t, n) => {
|
|
2786
2794
|
if (n && a.push(ve()), !t) return;
|
|
2787
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}` : "";
|
|
@@ -2789,28 +2797,28 @@ var Zn = (e) => {
|
|
|
2789
2797
|
});
|
|
2790
2798
|
});
|
|
2791
2799
|
}), a;
|
|
2792
|
-
},
|
|
2793
|
-
let n =
|
|
2794
|
-
if (!
|
|
2795
|
-
let r =
|
|
2796
|
-
if (!
|
|
2800
|
+
}, Bi = (e, t) => {
|
|
2801
|
+
let n = F(e);
|
|
2802
|
+
if (!j(n) || !n.isAttached()) return;
|
|
2803
|
+
let r = L();
|
|
2804
|
+
if (!R(r)) {
|
|
2797
2805
|
t();
|
|
2798
2806
|
return;
|
|
2799
2807
|
}
|
|
2800
2808
|
let { anchor: i } = r;
|
|
2801
|
-
if (B(i.getNode(),
|
|
2809
|
+
if (B(i.getNode(), j) !== n) {
|
|
2802
2810
|
t();
|
|
2803
2811
|
return;
|
|
2804
2812
|
}
|
|
2805
|
-
let a = i.offset, o = i.type === "element" &&
|
|
2813
|
+
let a = i.offset, o = i.type === "element" && Se(n.getChildAtIndex(i.offset - 1)), s = 0;
|
|
2806
2814
|
if (o || (s = a + i.getNode().getPreviousSiblings().reduce((e, t) => e + t.getTextContentSize(), 0)), t()) {
|
|
2807
2815
|
if (o) {
|
|
2808
2816
|
i.getNode().select(a, a);
|
|
2809
2817
|
return;
|
|
2810
2818
|
}
|
|
2811
2819
|
n.getChildren().some((e) => {
|
|
2812
|
-
let t =
|
|
2813
|
-
if (t ||
|
|
2820
|
+
let t = Te(e);
|
|
2821
|
+
if (t || Se(e)) {
|
|
2814
2822
|
let n = e.getTextContentSize();
|
|
2815
2823
|
if (t && n >= s) return e.select(s, s), !0;
|
|
2816
2824
|
s -= n;
|
|
@@ -2818,27 +2826,27 @@ var Zn = (e) => {
|
|
|
2818
2826
|
return !1;
|
|
2819
2827
|
});
|
|
2820
2828
|
}
|
|
2821
|
-
},
|
|
2829
|
+
}, Vi = (e, t) => A(e) && A(t) && e.__text === t.__text && e.__highlightType === t.__highlightType && e.__style === t.__style || we(e) && we(t) || Se(e) && Se(t), Hi = (e, t) => {
|
|
2822
2830
|
let n = 0;
|
|
2823
|
-
for (; n < e.length &&
|
|
2831
|
+
for (; n < e.length && Vi(e[n], t[n]);) n++;
|
|
2824
2832
|
let r = 0, i = Math.min(e.length, t.length) - n;
|
|
2825
|
-
for (; r < i &&
|
|
2833
|
+
for (; r < i && Vi(e[e.length - r - 1], t[t.length - r - 1]);) r++;
|
|
2826
2834
|
return {
|
|
2827
2835
|
from: n,
|
|
2828
2836
|
to: e.length - r,
|
|
2829
2837
|
replacement: t.slice(n, t.length - r)
|
|
2830
2838
|
};
|
|
2831
|
-
},
|
|
2832
|
-
let a = i.getKey(), o =
|
|
2839
|
+
}, Ui = (e, t, n, r, i) => {
|
|
2840
|
+
let a = i.getKey(), o = Oi(i.getLanguage());
|
|
2833
2841
|
if (i.getLanguage() !== o && i.setLanguage(o), o === "plaintext") i.getIsSyntaxHighlightSupported() && i.setIsSyntaxHighlightSupported(!1);
|
|
2834
2842
|
else {
|
|
2835
|
-
i.getTheme() !== "github-light" && i.setTheme(
|
|
2836
|
-
let s = t ? t.getLoadedThemes().includes("github-light") ?
|
|
2843
|
+
i.getTheme() !== "github-light" && i.setTheme(Ei);
|
|
2844
|
+
let s = t ? t.getLoadedThemes().includes("github-light") ? ji(o) && !Ii(t, o) ? Li(o) : null : Ri() : Fi();
|
|
2837
2845
|
if (s) {
|
|
2838
2846
|
i.getIsSyntaxHighlightSupported() && i.setIsSyntaxHighlightSupported(!1), n.pendingKeys.add(a), n.loading !== s && (n.loading = s, s.then((t) => {
|
|
2839
2847
|
r(t);
|
|
2840
2848
|
let i = [...n.pendingKeys];
|
|
2841
|
-
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 });
|
|
2842
2850
|
}, () => {
|
|
2843
2851
|
n.pendingKeys.clear(), n.loading = null;
|
|
2844
2852
|
}));
|
|
@@ -2848,46 +2856,46 @@ var Zn = (e) => {
|
|
|
2848
2856
|
}
|
|
2849
2857
|
n.nodesCurrentlyHighlighting.has(a) || (n.nodesCurrentlyHighlighting.add(a), n.didTransform || (n.didTransform = !0, De(() => {
|
|
2850
2858
|
n.didTransform = !1, n.nodesCurrentlyHighlighting.clear();
|
|
2851
|
-
})),
|
|
2852
|
-
let e =
|
|
2853
|
-
if (!
|
|
2854
|
-
let n =
|
|
2859
|
+
})), Bi(a, () => {
|
|
2860
|
+
let e = F(a);
|
|
2861
|
+
if (!j(e) || !e.isAttached()) return !1;
|
|
2862
|
+
let n = zi(e, Oi(e.getLanguage()), t), { from: r, to: i, replacement: o } = Hi(e.getChildren(), n);
|
|
2855
2863
|
return r === i && o.length === 0 ? !1 : (e.splice(r, i - r, o), !0);
|
|
2856
2864
|
}));
|
|
2857
|
-
},
|
|
2865
|
+
}, Wi = () => {
|
|
2858
2866
|
let [e] = z();
|
|
2859
2867
|
return s(() => {
|
|
2860
|
-
if (!e.hasNodes([
|
|
2868
|
+
if (!e.hasNodes([N, M])) throw Error("CodeHighlightPlugin: code nodes are not registered");
|
|
2861
2869
|
let t = null, n = {
|
|
2862
2870
|
didTransform: !1,
|
|
2863
2871
|
nodesCurrentlyHighlighting: /* @__PURE__ */ new Set(),
|
|
2864
2872
|
pendingKeys: /* @__PURE__ */ new Set(),
|
|
2865
2873
|
loading: null
|
|
2866
|
-
}, r = (r) =>
|
|
2874
|
+
}, r = (r) => Ui(e, t, n, (e) => {
|
|
2867
2875
|
t = e;
|
|
2868
2876
|
}, r), i = (e) => {
|
|
2869
2877
|
let t = e.getParent();
|
|
2870
|
-
|
|
2878
|
+
j(t) ? r(t) : A(e) && e.replace(ye(e.__text));
|
|
2871
2879
|
};
|
|
2872
|
-
return Ge(
|
|
2880
|
+
return Ge(te(e), e.registerNodeTransform(N, r), e.registerNodeTransform(Ue, i), e.registerNodeTransform(M, i));
|
|
2873
2881
|
}, [e]), null;
|
|
2874
|
-
},
|
|
2882
|
+
}, Gi = () => {
|
|
2875
2883
|
let [e] = z();
|
|
2876
|
-
return s(() => (
|
|
2884
|
+
return s(() => (me(e, !0), rt(fe(e), pe(e, !1), de(e), e.registerNodeTransform(ce, (e) => {
|
|
2877
2885
|
e.getBackgroundColor() !== null && e.setBackgroundColor(null);
|
|
2878
2886
|
}), e.registerCommand(Re, (e) => {
|
|
2879
|
-
let t =
|
|
2880
|
-
if (!
|
|
2881
|
-
let n =
|
|
2887
|
+
let t = L();
|
|
2888
|
+
if (!R(t) || !t.isCollapsed()) return !1;
|
|
2889
|
+
let n = ae(t.anchor.getNode());
|
|
2882
2890
|
if (n === null) return !1;
|
|
2883
2891
|
let r = e.shiftKey ? "previous" : "next", i = r === "next" ? "getNextSibling" : "getPreviousSibling", a = r === "next" ? "getFirstChild" : "getLastChild", o = n[i](), s = null;
|
|
2884
|
-
if (
|
|
2892
|
+
if (oe(o)) s = o;
|
|
2885
2893
|
else {
|
|
2886
|
-
let e = B(n,
|
|
2894
|
+
let e = B(n, se);
|
|
2887
2895
|
if (e !== null) for (let t = e[i](); t !== null; t = t[i]()) {
|
|
2888
|
-
if (!
|
|
2896
|
+
if (!se(t)) continue;
|
|
2889
2897
|
let e = t[a]();
|
|
2890
|
-
if (
|
|
2898
|
+
if (oe(e)) {
|
|
2891
2899
|
s = e;
|
|
2892
2900
|
break;
|
|
2893
2901
|
}
|
|
@@ -2897,15 +2905,15 @@ var Zn = (e) => {
|
|
|
2897
2905
|
let e = s.getFirstDescendant();
|
|
2898
2906
|
e ? e.selectStart() : s.selectStart();
|
|
2899
2907
|
} else {
|
|
2900
|
-
let e = B(n,
|
|
2908
|
+
let e = B(n, P);
|
|
2901
2909
|
e && (r === "next" ? e.selectNext() : e.selectPrevious());
|
|
2902
2910
|
}
|
|
2903
2911
|
return !0;
|
|
2904
2912
|
}, ke))), [e]), null;
|
|
2905
|
-
},
|
|
2913
|
+
}, Ki = (e) => {
|
|
2906
2914
|
let t = e.getIndent();
|
|
2907
2915
|
t < 8 && e.setIndent(t + 1);
|
|
2908
|
-
},
|
|
2916
|
+
}, qi = (e) => {
|
|
2909
2917
|
let t = e.getIndent();
|
|
2910
2918
|
if (t > 8) {
|
|
2911
2919
|
e.setIndent(8);
|
|
@@ -2915,42 +2923,49 @@ var Zn = (e) => {
|
|
|
2915
2923
|
};
|
|
2916
2924
|
//#endregion
|
|
2917
2925
|
//#region src/components/Editor/plugins/IndentLimitPlugin.tsx
|
|
2918
|
-
function
|
|
2926
|
+
function Ji() {
|
|
2919
2927
|
let [e] = z();
|
|
2920
|
-
return s(() => rt(e.registerCommand(Ie, () => nt(
|
|
2928
|
+
return s(() => rt(e.registerCommand(Ie, () => nt(Ki), ke), e.registerNodeTransform(He, qi), e.registerNodeTransform(ie, qi), e.registerNodeTransform(E, qi)), [e]), null;
|
|
2921
2929
|
}
|
|
2922
2930
|
//#endregion
|
|
2923
2931
|
//#region src/components/Editor/EditorCore.tsx
|
|
2924
|
-
var
|
|
2925
|
-
let [f] = z(), { t: h } = e(), [g, _] = d(!1), v = i ?? g, y =
|
|
2932
|
+
var Yi = ({ value: n, onChange: r, open: i, onOpenChange: a, toolbar: o, upload: c, ai: l }) => {
|
|
2933
|
+
let [f] = z(), { t: h } = e(), [g, _] = d(!1), v = i ?? g, y = wi(v), b = (e) => {
|
|
2926
2934
|
a?.(e), i === void 0 && _(e);
|
|
2927
2935
|
}, [x, S] = d(null), [C, w] = d(() => ({
|
|
2928
2936
|
fontColor: y.fontColor,
|
|
2929
2937
|
fill: y.backgroundColor
|
|
2930
2938
|
})), T = u(!1), [E, D] = d(!1), O = u(null), k = () => {
|
|
2931
2939
|
f.getEditorState().read(() => {
|
|
2932
|
-
O.current =
|
|
2940
|
+
O.current = L()?.clone() ?? null;
|
|
2933
2941
|
});
|
|
2934
|
-
}, { linkForm: A, openLink:
|
|
2942
|
+
}, { linkForm: A, openLink: j, confirmLink: ee, closeLink: M } = dr({
|
|
2935
2943
|
editor: f,
|
|
2936
2944
|
savedSelectionRef: O,
|
|
2937
2945
|
captureSelection: k
|
|
2938
|
-
}), [
|
|
2946
|
+
}), [N] = d(() => /* @__PURE__ */ new Map()), { fileInputRef: te, uploadProgress: ne, insertImage: re, onFileChange: ie, abortUpload: ae } = ur({
|
|
2939
2947
|
editor: f,
|
|
2940
2948
|
upload: c,
|
|
2941
2949
|
savedSelectionRef: O,
|
|
2942
|
-
attachmentsBySrc:
|
|
2943
|
-
}),
|
|
2950
|
+
attachmentsBySrc: N
|
|
2951
|
+
}), oe = fr({
|
|
2944
2952
|
editor: f,
|
|
2945
2953
|
value: n,
|
|
2946
2954
|
onChange: r,
|
|
2947
|
-
attachmentsBySrc:
|
|
2948
|
-
}),
|
|
2955
|
+
attachmentsBySrc: N
|
|
2956
|
+
}), P = $n({
|
|
2949
2957
|
editor: f,
|
|
2950
2958
|
ai: l
|
|
2951
|
-
}), [
|
|
2959
|
+
}), [se, ce] = d(0), le = o?.config ?? mt;
|
|
2952
2960
|
s(() => {
|
|
2953
|
-
|
|
2961
|
+
if (!y.hasEditorText) {
|
|
2962
|
+
w({
|
|
2963
|
+
fontColor: lt,
|
|
2964
|
+
fill: ut
|
|
2965
|
+
});
|
|
2966
|
+
return;
|
|
2967
|
+
}
|
|
2968
|
+
y.hasRangeSelection && w({
|
|
2954
2969
|
fontColor: y.fontColor,
|
|
2955
2970
|
fill: y.backgroundColor
|
|
2956
2971
|
});
|
|
@@ -2960,43 +2975,43 @@ var qi = ({ value: n, onChange: r, open: i, onOpenChange: a, toolbar: o, upload:
|
|
|
2960
2975
|
y.hasEditorText,
|
|
2961
2976
|
y.hasRangeSelection
|
|
2962
2977
|
]);
|
|
2963
|
-
let
|
|
2964
|
-
|
|
2978
|
+
let ue = () => {
|
|
2979
|
+
ae(), P.close(), S(null), M(), D(!1), b(!1);
|
|
2965
2980
|
};
|
|
2966
2981
|
s(() => {
|
|
2967
2982
|
if (!v) return;
|
|
2968
2983
|
let e = window.visualViewport;
|
|
2969
2984
|
if (!e) return;
|
|
2970
2985
|
let t = () => {
|
|
2971
|
-
|
|
2986
|
+
ce(Math.max(0, window.innerHeight - e.height - e.offsetTop));
|
|
2972
2987
|
};
|
|
2973
2988
|
return e.addEventListener("resize", t), e.addEventListener("scroll", t), t(), () => {
|
|
2974
2989
|
e.removeEventListener("resize", t), e.removeEventListener("scroll", t);
|
|
2975
2990
|
};
|
|
2976
2991
|
}, [v]), s(() => {
|
|
2977
|
-
v ||
|
|
2978
|
-
}, [
|
|
2992
|
+
v || ae();
|
|
2993
|
+
}, [ae, v]), s(() => {
|
|
2979
2994
|
if (v) return f.setEditable(!0), f.registerRootListener((e) => {
|
|
2980
2995
|
e && f.focus(void 0, { defaultSelection: "rootEnd" });
|
|
2981
2996
|
});
|
|
2982
2997
|
}, [v, f]);
|
|
2983
|
-
let
|
|
2984
|
-
T.current = !0, S(null),
|
|
2985
|
-
},
|
|
2986
|
-
x === "aiPreset" && (T.current = !0), S(null),
|
|
2998
|
+
let de = () => {
|
|
2999
|
+
T.current = !0, S(null), P.startTypeset();
|
|
3000
|
+
}, fe = (e) => {
|
|
3001
|
+
x === "aiPreset" && (T.current = !0), S(null), P.startPolish(e);
|
|
2987
3002
|
};
|
|
2988
3003
|
return /* @__PURE__ */ p(t, {
|
|
2989
3004
|
open: v,
|
|
2990
|
-
onClose:
|
|
3005
|
+
onClose: ue,
|
|
2991
3006
|
position: "bottom",
|
|
2992
3007
|
closeOnClickOverlay: !0,
|
|
2993
|
-
children: /* @__PURE__ */ p(
|
|
2994
|
-
value:
|
|
3008
|
+
children: /* @__PURE__ */ p(er.Provider, {
|
|
3009
|
+
value: ne,
|
|
2995
3010
|
children: /* @__PURE__ */ m("div", {
|
|
2996
3011
|
className: V["bsy-mobile-editor"],
|
|
2997
3012
|
style: {
|
|
2998
3013
|
height: 300,
|
|
2999
|
-
transform:
|
|
3014
|
+
transform: se ? `translate3d(0, -${se}px, 0)` : void 0
|
|
3000
3015
|
},
|
|
3001
3016
|
children: [
|
|
3002
3017
|
/* @__PURE__ */ p("div", {
|
|
@@ -3014,8 +3029,8 @@ var qi = ({ value: n, onChange: r, open: i, onOpenChange: a, toolbar: o, upload:
|
|
|
3014
3029
|
ErrorBoundary: Qe
|
|
3015
3030
|
})
|
|
3016
3031
|
}),
|
|
3017
|
-
|
|
3018
|
-
config:
|
|
3032
|
+
le.length > 0 ? /* @__PURE__ */ p(xi, {
|
|
3033
|
+
config: le,
|
|
3019
3034
|
formats: y,
|
|
3020
3035
|
colorValues: C,
|
|
3021
3036
|
openSheet: x,
|
|
@@ -3028,31 +3043,32 @@ var qi = ({ value: n, onChange: r, open: i, onOpenChange: a, toolbar: o, upload:
|
|
|
3028
3043
|
};
|
|
3029
3044
|
})), S(e);
|
|
3030
3045
|
},
|
|
3031
|
-
onOpenLink:
|
|
3046
|
+
onOpenLink: j
|
|
3032
3047
|
}) : null,
|
|
3033
3048
|
/* @__PURE__ */ p(qe, {}),
|
|
3034
3049
|
/* @__PURE__ */ p(Ye, {}),
|
|
3035
3050
|
/* @__PURE__ */ p(Je, {}),
|
|
3036
|
-
/* @__PURE__ */ p(
|
|
3037
|
-
/* @__PURE__ */ p(
|
|
3038
|
-
/* @__PURE__ */ p(
|
|
3039
|
-
/* @__PURE__ */ p(
|
|
3040
|
-
/* @__PURE__ */ p(
|
|
3041
|
-
/* @__PURE__ */ p(
|
|
3042
|
-
/* @__PURE__ */ p(
|
|
3051
|
+
/* @__PURE__ */ p(mr, {}),
|
|
3052
|
+
/* @__PURE__ */ p(br, {}),
|
|
3053
|
+
/* @__PURE__ */ p(gr, {}),
|
|
3054
|
+
/* @__PURE__ */ p(vr, {}),
|
|
3055
|
+
/* @__PURE__ */ p(Wi, {}),
|
|
3056
|
+
/* @__PURE__ */ p(Gi, {}),
|
|
3057
|
+
/* @__PURE__ */ p(Ji, {}),
|
|
3043
3058
|
/* @__PURE__ */ p(Xe, {
|
|
3044
|
-
onChange:
|
|
3059
|
+
onChange: oe,
|
|
3045
3060
|
ignoreSelectionChange: !0
|
|
3046
3061
|
}),
|
|
3047
3062
|
/* @__PURE__ */ p("input", {
|
|
3048
|
-
ref:
|
|
3063
|
+
ref: te,
|
|
3049
3064
|
type: "file",
|
|
3050
|
-
accept:
|
|
3065
|
+
accept: gt,
|
|
3051
3066
|
hidden: !0,
|
|
3052
|
-
onChange:
|
|
3067
|
+
onChange: ie
|
|
3053
3068
|
}),
|
|
3054
|
-
/* @__PURE__ */ p(
|
|
3069
|
+
/* @__PURE__ */ p(Vr, {
|
|
3055
3070
|
sheet: x,
|
|
3071
|
+
formats: y,
|
|
3056
3072
|
onClose: () => {
|
|
3057
3073
|
if (T.current) {
|
|
3058
3074
|
T.current = !1;
|
|
@@ -3060,11 +3076,11 @@ var qi = ({ value: n, onChange: r, open: i, onOpenChange: a, toolbar: o, upload:
|
|
|
3060
3076
|
}
|
|
3061
3077
|
S(null), window.requestAnimationFrame(() => f.focus());
|
|
3062
3078
|
},
|
|
3063
|
-
onTypeset:
|
|
3079
|
+
onTypeset: de,
|
|
3064
3080
|
onPolishMenu: () => {
|
|
3065
3081
|
T.current = !0, S("aiPreset");
|
|
3066
3082
|
},
|
|
3067
|
-
onPickPreset:
|
|
3083
|
+
onPickPreset: fe,
|
|
3068
3084
|
savedSelectionRef: O,
|
|
3069
3085
|
committedColors: C,
|
|
3070
3086
|
onColorCommit: (e, t) => w((n) => ({
|
|
@@ -3073,7 +3089,7 @@ var qi = ({ value: n, onChange: r, open: i, onOpenChange: a, toolbar: o, upload:
|
|
|
3073
3089
|
})),
|
|
3074
3090
|
onPicture: (e) => {
|
|
3075
3091
|
if (k(), e === "upload") {
|
|
3076
|
-
|
|
3092
|
+
te.current?.click();
|
|
3077
3093
|
return;
|
|
3078
3094
|
}
|
|
3079
3095
|
T.current = !0, S(null), D(!0);
|
|
@@ -3081,38 +3097,38 @@ var qi = ({ value: n, onChange: r, open: i, onOpenChange: a, toolbar: o, upload:
|
|
|
3081
3097
|
canTypeset: !!l?.typeset,
|
|
3082
3098
|
canPolish: !!l?.polish
|
|
3083
3099
|
}),
|
|
3084
|
-
/* @__PURE__ */ p(
|
|
3100
|
+
/* @__PURE__ */ p(Ur, {
|
|
3085
3101
|
open: A !== null,
|
|
3086
3102
|
seed: A,
|
|
3087
|
-
onClose:
|
|
3088
|
-
onConfirm:
|
|
3103
|
+
onClose: M,
|
|
3104
|
+
onConfirm: ee
|
|
3089
3105
|
}),
|
|
3090
|
-
/* @__PURE__ */ p(
|
|
3106
|
+
/* @__PURE__ */ p(Gr, {
|
|
3091
3107
|
open: E,
|
|
3092
3108
|
onClose: () => D(!1),
|
|
3093
3109
|
onConfirm: (e) => {
|
|
3094
|
-
|
|
3110
|
+
re(e, "", e), D(!1);
|
|
3095
3111
|
}
|
|
3096
3112
|
}),
|
|
3097
|
-
/* @__PURE__ */ p(
|
|
3098
|
-
open:
|
|
3099
|
-
mode:
|
|
3100
|
-
originalHtml:
|
|
3101
|
-
codeBlocks:
|
|
3113
|
+
/* @__PURE__ */ p(ri, {
|
|
3114
|
+
open: P.mode !== null,
|
|
3115
|
+
mode: P.mode,
|
|
3116
|
+
originalHtml: P.snapshot.html,
|
|
3117
|
+
codeBlocks: P.snapshot.codeBlocks,
|
|
3102
3118
|
ai: l,
|
|
3103
|
-
polishPreset:
|
|
3104
|
-
onClose:
|
|
3105
|
-
onApply:
|
|
3106
|
-
onPickPreset:
|
|
3119
|
+
polishPreset: P.preset,
|
|
3120
|
+
onClose: P.close,
|
|
3121
|
+
onApply: P.apply,
|
|
3122
|
+
onPickPreset: fe
|
|
3107
3123
|
})
|
|
3108
3124
|
]
|
|
3109
3125
|
})
|
|
3110
3126
|
})
|
|
3111
3127
|
});
|
|
3112
|
-
},
|
|
3128
|
+
}, Xi = "1px solid #d9d9d9", Zi = { export: new Map([[ce, (e, t) => {
|
|
3113
3129
|
let n = t.exportDOM(e);
|
|
3114
|
-
return We(n.element) && (n.element.style.border =
|
|
3115
|
-
}]]) },
|
|
3130
|
+
return We(n.element) && (n.element.style.border = Xi), n;
|
|
3131
|
+
}]]) }, Qi = class e extends x {
|
|
3116
3132
|
constructor(e = "", t = {}, n) {
|
|
3117
3133
|
super(e, t, n);
|
|
3118
3134
|
}
|
|
@@ -3127,12 +3143,12 @@ var qi = ({ value: n, onChange: r, open: i, onOpenChange: a, toolbar: o, upload:
|
|
|
3127
3143
|
}, t.__key);
|
|
3128
3144
|
}
|
|
3129
3145
|
static importJSON(e) {
|
|
3130
|
-
return
|
|
3146
|
+
return $i().updateFromJSON(e);
|
|
3131
3147
|
}
|
|
3132
3148
|
sanitizeUrl(e) {
|
|
3133
3149
|
return e.startsWith("@") ? e : super.sanitizeUrl(e);
|
|
3134
3150
|
}
|
|
3135
|
-
},
|
|
3151
|
+
}, $i = (e = "", t = {}) => he(new Qi(e, t)), ea = {
|
|
3136
3152
|
namespace: "bsyLexicalEditor",
|
|
3137
3153
|
onError: (e) => {
|
|
3138
3154
|
console.error("Lexical error", e);
|
|
@@ -3165,28 +3181,28 @@ var qi = ({ value: n, onChange: r, open: i, onOpenChange: a, toolbar: o, upload:
|
|
|
3165
3181
|
tableRow: "editor-table-row",
|
|
3166
3182
|
tableScrollableWrapper: "editor-table-scrollable-wrapper"
|
|
3167
3183
|
},
|
|
3168
|
-
html:
|
|
3184
|
+
html: Zi,
|
|
3169
3185
|
nodes: [
|
|
3170
|
-
|
|
3186
|
+
Qi,
|
|
3171
3187
|
{
|
|
3172
3188
|
replace: x,
|
|
3173
|
-
with: (e) => new
|
|
3189
|
+
with: (e) => new Qi(e.__url, {
|
|
3174
3190
|
rel: e.__rel,
|
|
3175
3191
|
target: e.__target,
|
|
3176
3192
|
title: e.__title
|
|
3177
3193
|
}),
|
|
3178
|
-
withKlass:
|
|
3194
|
+
withKlass: Qi
|
|
3179
3195
|
},
|
|
3180
3196
|
b,
|
|
3181
3197
|
D,
|
|
3182
3198
|
E,
|
|
3183
|
-
|
|
3199
|
+
ie,
|
|
3200
|
+
N,
|
|
3184
3201
|
M,
|
|
3185
|
-
j,
|
|
3186
|
-
ue,
|
|
3187
|
-
de,
|
|
3188
3202
|
le,
|
|
3189
|
-
|
|
3203
|
+
ue,
|
|
3204
|
+
ce,
|
|
3205
|
+
ir,
|
|
3190
3206
|
q,
|
|
3191
3207
|
{
|
|
3192
3208
|
replace: Ue,
|
|
@@ -3194,10 +3210,10 @@ var qi = ({ value: n, onChange: r, open: i, onOpenChange: a, toolbar: o, upload:
|
|
|
3194
3210
|
withKlass: q
|
|
3195
3211
|
}
|
|
3196
3212
|
]
|
|
3197
|
-
},
|
|
3198
|
-
initialConfig:
|
|
3199
|
-
children: /* @__PURE__ */ p(
|
|
3213
|
+
}, ta = (e) => /* @__PURE__ */ p(g, {
|
|
3214
|
+
initialConfig: ea,
|
|
3215
|
+
children: /* @__PURE__ */ p(Yi, { ...e })
|
|
3200
3216
|
});
|
|
3201
|
-
|
|
3217
|
+
ta.displayName = "BsyMobileEditor";
|
|
3202
3218
|
//#endregion
|
|
3203
|
-
export {
|
|
3219
|
+
export { qr as n, ta as t };
|