@baishuyun/ui-base 6.18.0 → 6.19.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Amap/index.js +1 -1
- package/dist/Calendar/{Calendar-Dk6FVbJ2.js → Calendar-DbAebHXs.js} +2 -2
- package/dist/Calendar/index.js +4 -4
- package/dist/Card/index.js +1 -1
- package/dist/CheckBox/index.js +1 -1
- package/dist/ColorPicker/index.js +1 -1
- package/dist/ConfigProvider/index.js +1 -1
- package/dist/DatePicker/{DatePicker-CItkTpdZ.js → DatePicker-B6E5kERj.js} +1 -1
- package/dist/DatePicker/{DatePickerPanel-DJXmFihs.js → DatePickerPanel-Ch2PMF9n.js} +1 -1
- package/dist/DatePicker/index.js +2 -2
- package/dist/DropDown/index.js +1 -1
- package/dist/Editor/index.js +1285 -1024
- package/dist/Gantt/index.js +1 -1
- package/dist/Icon/index.js +1 -1
- package/dist/InputTag/index.js +1 -1
- package/dist/Loading/index.js +1 -1
- package/dist/Modal/index.js +1 -1
- package/dist/NotFoundContent/index.js +1 -1
- package/dist/Overlay/index.js +1 -1
- package/dist/Radio/index.js +1 -1
- package/dist/ScrollBar/index.js +1 -1
- package/dist/Segmented/{Segmented-DpmwFerw.js → Segmented-BkTy5v9V.js} +7 -3
- package/dist/Segmented/index.js +2 -2
- package/dist/Select/index.js +1 -1
- package/dist/Table/index.js +1 -1
- package/dist/Tabs/index.js +1 -1
- package/dist/Tooltip/index.js +1 -1
- package/dist/Tree/index.js +1 -1
- package/dist/components/Editor/Preview/EditorPreview.d.ts +0 -3
- package/dist/components/Editor/Preview/Thinking.d.ts +2 -5
- package/dist/components/Editor/Preview/useAutoScroll.d.ts +9 -0
- package/dist/components/Editor/constants/ai.d.ts +0 -2
- package/dist/components/Editor/constants/portableEditorStyles.d.ts +0 -1
- package/dist/components/Editor/interface.d.ts +4 -4
- package/dist/components/Editor/utils/applyAiPolish.d.ts +0 -1
- package/dist/components/Editor/utils/prepareTypesetProposed.d.ts +1 -2
- package/dist/index.js +4 -4
- package/dist/style.css +1 -1
- package/dist/vendors/{version-BucxnUKs.js → version-TqGVVc-h.js} +1 -1
- package/package.json +3 -2
- package/dist/components/Editor/utils/extractCodePlaceholders.d.ts +0 -6
- package/dist/components/Editor/utils/stitchCodePlaceholders.d.ts +0 -6
package/dist/Editor/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import "../vendors/version-
|
|
1
|
+
import "../vendors/version-TqGVVc-h.js";
|
|
2
2
|
import "../ScrollBar/style-D26azwz6.js";
|
|
3
3
|
import { t as e } from "../Icon/Icon-DrdQOEJE.js";
|
|
4
4
|
import "../vendors/LocaleContext-DXQoOKM2.js";
|
|
@@ -21,33 +21,33 @@ import { t as d } from "../vendors/useFloatingPortal-DJ1iKmW-.js";
|
|
|
21
21
|
import { t as f } from "../DropDown/DropDown-B_szM67V.js";
|
|
22
22
|
import { dropRightWhile as p, dropWhile as m, keyBy as h, omit as g, range as _ } from "lodash-es";
|
|
23
23
|
import { Fragment as v, jsx as y, jsxs as b } from "react/jsx-runtime";
|
|
24
|
-
import x, { createContext as S, forwardRef as C, memo as w, useCallback as T, useContext as E, useDeferredValue as D, useEffect as O, useId as
|
|
25
|
-
import { Button as
|
|
26
|
-
import
|
|
27
|
-
import {
|
|
28
|
-
import { AnimatePresence as
|
|
29
|
-
import { FloatingPortal as
|
|
30
|
-
import { LexicalComposer as
|
|
31
|
-
import { RichTextPlugin as
|
|
32
|
-
import { ContentEditable as
|
|
33
|
-
import { HistoryPlugin as
|
|
34
|
-
import { OnChangePlugin as
|
|
35
|
-
import { LexicalErrorBoundary as
|
|
36
|
-
import { $generateHtmlFromNodes as
|
|
37
|
-
import { $applyNodeReplacement as
|
|
38
|
-
import { useLexicalComposerContext as
|
|
39
|
-
import { $createLinkNode as
|
|
40
|
-
import { $isListItemNode as
|
|
41
|
-
import { $createCodeHighlightNode as
|
|
42
|
-
import { $getSelectionStyleValueForProperty as
|
|
43
|
-
import { $findCellNode as
|
|
44
|
-
import { $createHeadingNode as
|
|
45
|
-
import { $findMatchingParent as
|
|
46
|
-
import
|
|
47
|
-
import { useLexicalEditable as
|
|
48
|
-
import { LinkPlugin as
|
|
49
|
-
import { ListPlugin as
|
|
50
|
-
var
|
|
24
|
+
import x, { createContext as S, forwardRef as C, memo as w, useCallback as T, useContext as E, useDeferredValue as D, useEffect as O, useId as ee, useImperativeHandle as k, useLayoutEffect as te, useMemo as A, useRef as j, useState as M } from "react";
|
|
25
|
+
import { Button as N, Form as ne, Input as re, message as ie } from "antd";
|
|
26
|
+
import P from "clsx";
|
|
27
|
+
import { useEventListener as ae } from "ahooks";
|
|
28
|
+
import { AnimatePresence as oe, motion as se, useReducedMotion as ce } from "motion/react";
|
|
29
|
+
import { FloatingPortal as le } from "@floating-ui/react";
|
|
30
|
+
import { LexicalComposer as ue } from "@lexical/react/LexicalComposer";
|
|
31
|
+
import { RichTextPlugin as de } from "@lexical/react/LexicalRichTextPlugin";
|
|
32
|
+
import { ContentEditable as fe } from "@lexical/react/LexicalContentEditable";
|
|
33
|
+
import { HistoryPlugin as pe } from "@lexical/react/LexicalHistoryPlugin";
|
|
34
|
+
import { OnChangePlugin as me } from "@lexical/react/LexicalOnChangePlugin";
|
|
35
|
+
import { LexicalErrorBoundary as he } from "@lexical/react/LexicalErrorBoundary";
|
|
36
|
+
import { $generateHtmlFromNodes as ge, $generateNodesFromDOM as _e } from "@lexical/html";
|
|
37
|
+
import { $applyNodeReplacement as ve, $createLineBreakNode as ye, $createParagraphNode as be, $createTabNode as xe, $createTextNode as Se, $getNearestNodeFromDOMNode as Ce, $getNodeByKey as we, $getRoot as Te, $getRoot as F, $getSelection as I, $insertNodes as Ee, $isElementNode as De, $isLineBreakNode as Oe, $isRangeSelection as L, $isRootOrShadowRoot as ke, $isTabNode as Ae, $isTextNode as je, $nodesOfType as Me, $onUpdate as Ne, $setSelection as Pe, BLUR_COMMAND as Fe, CAN_REDO_COMMAND as Ie, CAN_UNDO_COMMAND as Le, CLEAR_HISTORY_COMMAND as Re, COMMAND_PRIORITY_CRITICAL as ze, COMMAND_PRIORITY_EDITOR as Be, COMMAND_PRIORITY_HIGH as Ve, COMMAND_PRIORITY_LOW as He, DROP_COMMAND as Ue, DecoratorNode as We, FOCUS_COMMAND as Ge, FORMAT_ELEMENT_COMMAND as Ke, FORMAT_TEXT_COMMAND as qe, HISTORY_MERGE_TAG as Je, INDENT_CONTENT_COMMAND as Ye, KEY_ENTER_COMMAND as Xe, KEY_TAB_COMMAND as Ze, OUTDENT_CONTENT_COMMAND as Qe, PASTE_COMMAND as $e, PASTE_TAG as et, REDO_COMMAND as tt, RootNode as nt, TextNode as rt, UNDO_COMMAND as it, createCommand as at, isHTMLElement as ot, mergeRegister as st } from "lexical";
|
|
38
|
+
import { useLexicalComposerContext as ct, useLexicalComposerContext as R } from "@lexical/react/LexicalComposerContext";
|
|
39
|
+
import { $createLinkNode as lt, $isLinkNode as ut, $toggleLink as dt, AutoLinkNode as ft, LinkNode as pt, TOGGLE_LINK_COMMAND as mt } from "@lexical/link";
|
|
40
|
+
import { $isListItemNode as ht, $isListNode as gt, INSERT_ORDERED_LIST_COMMAND as _t, INSERT_UNORDERED_LIST_COMMAND as vt, ListItemNode as yt, ListNode as bt, REMOVE_LIST_COMMAND as xt } from "@lexical/list";
|
|
41
|
+
import { $createCodeHighlightNode as St, $createCodeNode as Ct, $isCodeHighlightNode as wt, $isCodeNode as z, $plainifyCodeContent as Tt, CodeHighlightNode as Et, CodeNode as Dt, registerCodeIndentation as Ot } from "@lexical/code-core";
|
|
42
|
+
import { $getSelectionStyleValueForProperty as kt, $patchStyleText as At, $setBlocksType as jt, $trimTextContentFromAnchor as Mt } from "@lexical/selection";
|
|
43
|
+
import { $findCellNode as Nt, $isTableCellNode as Pt, $isTableNode as Ft, $isTableRowNode as It, $isTableSelection as Lt, INSERT_TABLE_COMMAND as Rt, TableCellNode as zt, TableNode as Bt, TableRowNode as Vt, registerTableCellUnmergeTransform as Ht, registerTablePlugin as Ut, registerTableSelectionObserver as Wt, setScrollableTablesActive as Gt } from "@lexical/table";
|
|
44
|
+
import { $createHeadingNode as Kt, $isHeadingNode as qt, HeadingNode as Jt } from "@lexical/rich-text";
|
|
45
|
+
import { $findMatchingParent as B, $restoreEditorState as Yt, mergeRegister as Xt } from "@lexical/utils";
|
|
46
|
+
import Zt from "dompurify";
|
|
47
|
+
import { useLexicalEditable as Qt } from "@lexical/react/useLexicalEditable";
|
|
48
|
+
import { LinkPlugin as $t } from "@lexical/react/LexicalLinkPlugin";
|
|
49
|
+
import { ListPlugin as en } from "@lexical/react/LexicalListPlugin";
|
|
50
|
+
var V = {
|
|
51
51
|
imageWrapper: "_imageWrapper_y06h3_1",
|
|
52
52
|
selected: "_selected_y06h3_8",
|
|
53
53
|
resizing: "_resizing_y06h3_12",
|
|
@@ -57,8 +57,8 @@ var U = {
|
|
|
57
57
|
topRight: "_topRight_y06h3_49",
|
|
58
58
|
bottomLeft: "_bottomLeft_y06h3_54",
|
|
59
59
|
bottomRight: "_bottomRight_y06h3_59"
|
|
60
|
-
},
|
|
61
|
-
let [s] =
|
|
60
|
+
}, tn = ({ src: e, altText: t, width: n, height: r, dataId: i, dataSrc: a, nodeKey: o }) => {
|
|
61
|
+
let [s] = R(), [c, l] = M(!1), [u, d] = M(null), f = j(null), [p, m] = M({
|
|
62
62
|
width: n || void 0,
|
|
63
63
|
height: r || void 0
|
|
64
64
|
}), h = T(() => {
|
|
@@ -106,8 +106,8 @@ var U = {
|
|
|
106
106
|
});
|
|
107
107
|
}, [u]), S = T(() => {
|
|
108
108
|
u?.isResizing && (s.update(() => {
|
|
109
|
-
let e =
|
|
110
|
-
|
|
109
|
+
let e = we(o);
|
|
110
|
+
an(e) && e.setWidthAndHeight(p.width, p.height);
|
|
111
111
|
}), d(null));
|
|
112
112
|
}, [
|
|
113
113
|
s,
|
|
@@ -129,8 +129,8 @@ var U = {
|
|
|
129
129
|
}, []);
|
|
130
130
|
return O(() => s.registerUpdateListener(({ editorState: e }) => {
|
|
131
131
|
e.read(() => {
|
|
132
|
-
let e =
|
|
133
|
-
|
|
132
|
+
let e = I();
|
|
133
|
+
L(e) && !e.getNodes().some((e) => e.getKey() === o || e.getParent() && e.getParent()?.getKey() === o) && c && l(!1);
|
|
134
134
|
});
|
|
135
135
|
}), [
|
|
136
136
|
s,
|
|
@@ -144,9 +144,9 @@ var U = {
|
|
|
144
144
|
document.removeEventListener("mousedown", e);
|
|
145
145
|
};
|
|
146
146
|
}, [c]), /* @__PURE__ */ b("div", {
|
|
147
|
-
className:
|
|
148
|
-
[
|
|
149
|
-
[
|
|
147
|
+
className: P(V.imageWrapper, {
|
|
148
|
+
[V.selected]: c,
|
|
149
|
+
[V.resizing]: u?.isResizing
|
|
150
150
|
}),
|
|
151
151
|
children: [/* @__PURE__ */ y("img", {
|
|
152
152
|
ref: f,
|
|
@@ -154,7 +154,7 @@ var U = {
|
|
|
154
154
|
alt: t,
|
|
155
155
|
"data-id": i,
|
|
156
156
|
"data-src": a,
|
|
157
|
-
className:
|
|
157
|
+
className: V.image,
|
|
158
158
|
style: {
|
|
159
159
|
width: p.width,
|
|
160
160
|
height: p.height
|
|
@@ -164,24 +164,24 @@ var U = {
|
|
|
164
164
|
draggable: !1
|
|
165
165
|
}), c && /* @__PURE__ */ b(v, { children: [
|
|
166
166
|
/* @__PURE__ */ y("div", {
|
|
167
|
-
className:
|
|
167
|
+
className: P(V.resizeHandle, V.bottomRight),
|
|
168
168
|
onMouseDown: (e) => g(e, "bottom-right")
|
|
169
169
|
}),
|
|
170
170
|
/* @__PURE__ */ y("div", {
|
|
171
|
-
className:
|
|
171
|
+
className: P(V.resizeHandle, V.bottomLeft),
|
|
172
172
|
onMouseDown: (e) => g(e, "bottom-left")
|
|
173
173
|
}),
|
|
174
174
|
/* @__PURE__ */ y("div", {
|
|
175
|
-
className:
|
|
175
|
+
className: P(V.resizeHandle, V.topRight),
|
|
176
176
|
onMouseDown: (e) => g(e, "top-right")
|
|
177
177
|
}),
|
|
178
178
|
/* @__PURE__ */ y("div", {
|
|
179
|
-
className:
|
|
179
|
+
className: P(V.resizeHandle, V.topLeft),
|
|
180
180
|
onMouseDown: (e) => g(e, "top-left")
|
|
181
181
|
})
|
|
182
182
|
] })]
|
|
183
183
|
});
|
|
184
|
-
},
|
|
184
|
+
}, nn = class e extends We {
|
|
185
185
|
__src;
|
|
186
186
|
__altText;
|
|
187
187
|
__width;
|
|
@@ -236,7 +236,7 @@ var U = {
|
|
|
236
236
|
n.__width = e, n.__height = t;
|
|
237
237
|
}
|
|
238
238
|
decorate() {
|
|
239
|
-
return /* @__PURE__ */ y(
|
|
239
|
+
return /* @__PURE__ */ y(tn, {
|
|
240
240
|
src: this.__src,
|
|
241
241
|
altText: this.__altText,
|
|
242
242
|
width: this.__width,
|
|
@@ -248,13 +248,13 @@ var U = {
|
|
|
248
248
|
}
|
|
249
249
|
static importDOM() {
|
|
250
250
|
return { img: () => ({
|
|
251
|
-
conversion:
|
|
251
|
+
conversion: on,
|
|
252
252
|
priority: 0
|
|
253
253
|
}) };
|
|
254
254
|
}
|
|
255
255
|
static importJSON(e) {
|
|
256
256
|
let { src: t, altText: n, width: r, height: i, dataId: a, dataSrc: o } = e;
|
|
257
|
-
return
|
|
257
|
+
return rn({
|
|
258
258
|
src: t,
|
|
259
259
|
altText: n,
|
|
260
260
|
width: r,
|
|
@@ -279,13 +279,13 @@ var U = {
|
|
|
279
279
|
return !0;
|
|
280
280
|
}
|
|
281
281
|
};
|
|
282
|
-
function
|
|
283
|
-
return new
|
|
284
|
-
}
|
|
285
|
-
function rn(e) {
|
|
286
|
-
return e instanceof tn;
|
|
282
|
+
function rn({ src: e, altText: t, width: n, height: r, dataId: i, dataSrc: a, key: o }) {
|
|
283
|
+
return new nn(e, t, n, r, o, i, a);
|
|
287
284
|
}
|
|
288
285
|
function an(e) {
|
|
286
|
+
return e instanceof nn;
|
|
287
|
+
}
|
|
288
|
+
function on(e) {
|
|
289
289
|
if (e instanceof HTMLImageElement) {
|
|
290
290
|
let { src: t, alt: n, style: r } = e, i, a;
|
|
291
291
|
if (r.width) {
|
|
@@ -298,7 +298,7 @@ function an(e) {
|
|
|
298
298
|
}
|
|
299
299
|
i === void 0 && e.width && (i = e.width), a === void 0 && e.height && (a = e.height);
|
|
300
300
|
let o = e.getAttribute("data-id") || void 0, s = e.getAttribute("data-src") || void 0;
|
|
301
|
-
return { node:
|
|
301
|
+
return { node: rn({
|
|
302
302
|
src: t,
|
|
303
303
|
altText: n,
|
|
304
304
|
width: i,
|
|
@@ -311,10 +311,10 @@ function an(e) {
|
|
|
311
311
|
}
|
|
312
312
|
//#endregion
|
|
313
313
|
//#region src/components/Editor/constants/toolbarSize.ts
|
|
314
|
-
var
|
|
314
|
+
var sn = "default", H = {
|
|
315
315
|
x: 0,
|
|
316
316
|
y: 5
|
|
317
|
-
},
|
|
317
|
+
}, cn = {
|
|
318
318
|
small: {
|
|
319
319
|
itemHeight: 20,
|
|
320
320
|
iconSize: 14
|
|
@@ -323,23 +323,23 @@ var on = "default", W = {
|
|
|
323
323
|
itemHeight: 30,
|
|
324
324
|
iconSize: 16
|
|
325
325
|
}
|
|
326
|
-
},
|
|
326
|
+
}, U = (e) => {
|
|
327
327
|
if (!(e === void 0 || e === "")) return typeof e == "number" ? `${e}px` : e;
|
|
328
|
-
}, ln = (e, t =
|
|
329
|
-
let n =
|
|
328
|
+
}, ln = (e, t = sn) => {
|
|
329
|
+
let n = cn[t], r = U(e?.itemHeight) ?? `${n.itemHeight}px`, i = U(e?.iconSize) ?? `${n.iconSize}px`, a = {
|
|
330
330
|
"--bsy-editor-toolbar-item-height": r,
|
|
331
331
|
"--bsy-editor-toolbar-icon-size": i,
|
|
332
332
|
"--bsy-editor-toolbar-divider-color": "#e0e0e0",
|
|
333
333
|
"--bsy-editor-toolbar-item-highlight-color": "#0265ff"
|
|
334
334
|
};
|
|
335
|
-
return e ? (s(a, "--bsy-editor-toolbar-bg", e.bg), s(a, "--bsy-editor-toolbar-border-color", e.borderColor), s(a, "--bsy-editor-toolbar-padding", e.padding), s(a, "--bsy-editor-toolbar-gap",
|
|
336
|
-
}, un = (e, t =
|
|
335
|
+
return e ? (s(a, "--bsy-editor-toolbar-bg", e.bg), s(a, "--bsy-editor-toolbar-border-color", e.borderColor), s(a, "--bsy-editor-toolbar-padding", e.padding), s(a, "--bsy-editor-toolbar-gap", U(e.gap)), s(a, "--bsy-editor-toolbar-group-gap", U(e.groupGap)), s(a, "--bsy-editor-toolbar-divider-color", e.dividerColor), s(a, "--bsy-editor-toolbar-divider-margin", U(e.dividerMargin)), s(a, "--bsy-editor-toolbar-color-icon", e.colorIcon), s(a, "--bsy-editor-toolbar-item-hover-bg", e.itemHoverBg), s(a, "--bsy-editor-toolbar-item-hover-color", e.itemHoverColor), s(a, "--bsy-editor-toolbar-item-active-bg", e.itemActiveBg), s(a, "--bsy-editor-toolbar-item-active-color", e.itemActiveColor), s(a, "--bsy-editor-toolbar-item-highlight-color", e.itemHighlightColor), s(a, "--bsy-editor-toolbar-item-padding", U(e.itemPadding)), s(a, "--bsy-editor-toolbar-item-border-radius", U(e.itemBorderRadius)), a) : a;
|
|
336
|
+
}, un = (e, t = sn) => {
|
|
337
337
|
if (typeof e == "number" && Number.isFinite(e)) return e;
|
|
338
338
|
if (typeof e == "string") {
|
|
339
339
|
let t = Number.parseFloat(e);
|
|
340
340
|
if (Number.isFinite(t)) return t;
|
|
341
341
|
}
|
|
342
|
-
return
|
|
342
|
+
return cn[t].iconSize;
|
|
343
343
|
}, dn = (e) => {
|
|
344
344
|
let t = e?.placement ?? "top", n = e?.offset, r = typeof n == "number" ? 0 : n?.x ?? 0, i = typeof n == "number" ? n : n?.y ?? 0, a = t === "top", o = {
|
|
345
345
|
position: "absolute",
|
|
@@ -366,7 +366,7 @@ var on = "default", W = {
|
|
|
366
366
|
visible: e.slice(0, t),
|
|
367
367
|
overflow: p(m(e.slice(t), n), n)
|
|
368
368
|
};
|
|
369
|
-
},
|
|
369
|
+
}, W = {
|
|
370
370
|
"bsy-lexical__toolbar": "_bsy-lexical__toolbar_1wqto_1",
|
|
371
371
|
"bsy-lexical__toolbar--floating": "_bsy-lexical__toolbar--floating_1wqto_14",
|
|
372
372
|
"bsy-lexical__toolbar--sticky": "_bsy-lexical__toolbar--sticky_1wqto_19",
|
|
@@ -530,16 +530,16 @@ var on = "default", W = {
|
|
|
530
530
|
}
|
|
531
531
|
], wn = h(Cn, "id"), Tn = (e) => e && wn[e] ? e : xn, En = (e) => e === "center" || e === "right" || e === "left" ? e : e === "end" ? "right" : "left", Dn = (e) => {
|
|
532
532
|
if (e) {
|
|
533
|
-
|
|
533
|
+
F().selectStart();
|
|
534
534
|
return;
|
|
535
535
|
}
|
|
536
|
-
|
|
536
|
+
Pe(null);
|
|
537
537
|
}, On = (e) => {
|
|
538
538
|
let t = e.getRootElement();
|
|
539
539
|
Dn(!!(t && document.activeElement && t.contains(document.activeElement)));
|
|
540
540
|
}, kn = () => {
|
|
541
|
-
|
|
542
|
-
},
|
|
541
|
+
I() === null && F().selectStart();
|
|
542
|
+
}, G = (e) => {
|
|
543
543
|
e.isEditable() || e.setEditable(!0), e.update(() => {
|
|
544
544
|
kn();
|
|
545
545
|
}), e.focus(void 0, { defaultSelection: "rootStart" });
|
|
@@ -563,34 +563,34 @@ var on = "default", W = {
|
|
|
563
563
|
hasEditorText: !1,
|
|
564
564
|
link: void 0
|
|
565
565
|
}, jn = (e) => {
|
|
566
|
-
let t = !!
|
|
566
|
+
let t = !!F().getTextContent().trim(), n = {
|
|
567
567
|
...An,
|
|
568
568
|
hasEditorText: t
|
|
569
569
|
};
|
|
570
570
|
if (!e) return n;
|
|
571
|
-
let r =
|
|
572
|
-
if (
|
|
571
|
+
let r = I();
|
|
572
|
+
if (Lt(r)) return {
|
|
573
573
|
...n,
|
|
574
574
|
isInTable: !0
|
|
575
575
|
};
|
|
576
|
-
if (!
|
|
577
|
-
let i =
|
|
576
|
+
if (!L(r)) return n;
|
|
577
|
+
let i = kt(r, "font-size", gn), a = kt(r, "color", _n), o = kt(r, "background-color", vn), s = r.anchor.getNode(), c = s.getKey() === "root" ? s : B(s, (e) => {
|
|
578
578
|
let t = e.getParent();
|
|
579
|
-
return t !== null &&
|
|
579
|
+
return t !== null && ke(t);
|
|
580
580
|
});
|
|
581
581
|
c === null && (c = s.getTopLevelElementOrThrow());
|
|
582
|
-
let l = {}, u =
|
|
582
|
+
let l = {}, u = B(s, ut);
|
|
583
583
|
u ? (l.link = u.getURL(), l.linkText = u.getTextContent(), l.newBlank = u.getTarget() === "_blank") : l.linkText = r.getTextContent();
|
|
584
|
-
let d =
|
|
585
|
-
if (
|
|
584
|
+
let d = B(s, ht), f = !1, p = De(c) ? c.getIndent() : 0;
|
|
585
|
+
if (ht(d)) {
|
|
586
586
|
p = d.getIndent();
|
|
587
587
|
let e = d.getParent();
|
|
588
|
-
if (
|
|
588
|
+
if (gt(e)) {
|
|
589
589
|
let t = e.getListType();
|
|
590
590
|
f = t === "number" || t === "bullet" ? t : !1;
|
|
591
591
|
}
|
|
592
592
|
}
|
|
593
|
-
let m =
|
|
593
|
+
let m = B(s, z), h = B(s, qt), g = qt(h) ? h.getTag() : void 0;
|
|
594
594
|
return {
|
|
595
595
|
bold: r.hasFormat("bold"),
|
|
596
596
|
italic: r.hasFormat("italic"),
|
|
@@ -601,11 +601,11 @@ var on = "default", W = {
|
|
|
601
601
|
fontSize: i,
|
|
602
602
|
fontColor: a,
|
|
603
603
|
backgroundColor: o,
|
|
604
|
-
align: En(
|
|
604
|
+
align: En(De(c) ? c.getFormatType() : ""),
|
|
605
605
|
listType: f,
|
|
606
606
|
canOutdent: p > 0 || f !== !1,
|
|
607
607
|
isCodeBlock: !!m,
|
|
608
|
-
isInTable: !!
|
|
608
|
+
isInTable: !!B(s, Pt),
|
|
609
609
|
headingTag: g === "h1" || g === "h2" || g === "h3" ? g : !1,
|
|
610
610
|
codeLanguage: Tn(m?.getLanguage()),
|
|
611
611
|
hasEditorText: t,
|
|
@@ -621,10 +621,10 @@ var on = "default", W = {
|
|
|
621
621
|
t = e;
|
|
622
622
|
}), t;
|
|
623
623
|
}, Pn = () => {
|
|
624
|
-
let [e] =
|
|
625
|
-
return O(() =>
|
|
624
|
+
let [e] = R(), [t, n] = M(!1);
|
|
625
|
+
return O(() => Xt(e.registerCommand(Ge, () => (n(!0), !1), He), e.registerCommand(Fe, () => (n(!1), !1), He)), [e]), t;
|
|
626
626
|
}, Fn = () => {
|
|
627
|
-
let [e] =
|
|
627
|
+
let [e] = R(), t = Pn(), [n, r] = M(An);
|
|
628
628
|
return O(() => (e.getEditorState().read(() => {
|
|
629
629
|
r(jn(t));
|
|
630
630
|
}, { editor: e }), e.registerUpdateListener(({ editorState: n }) => {
|
|
@@ -643,30 +643,30 @@ var on = "default", W = {
|
|
|
643
643
|
if (!e) throw Error("useHistoryStateContext must be used within HistoryStateProvider");
|
|
644
644
|
return e;
|
|
645
645
|
}, zn = ({ children: e }) => {
|
|
646
|
-
let [t] =
|
|
646
|
+
let [t] = R(), [n, r] = M({
|
|
647
647
|
canUndo: !1,
|
|
648
648
|
canRedo: !1
|
|
649
649
|
});
|
|
650
|
-
return O(() =>
|
|
650
|
+
return O(() => st(t.registerCommand(Le, (e) => (r((t) => t.canUndo === e ? t : {
|
|
651
651
|
...t,
|
|
652
652
|
canUndo: e
|
|
653
|
-
}), !1),
|
|
653
|
+
}), !1), ze), t.registerCommand(Ie, (e) => (r((t) => t.canRedo === e ? t : {
|
|
654
654
|
...t,
|
|
655
655
|
canRedo: e
|
|
656
|
-
}), !1),
|
|
656
|
+
}), !1), ze)), [t]), /* @__PURE__ */ y(Ln.Provider, {
|
|
657
657
|
value: n,
|
|
658
658
|
children: e
|
|
659
659
|
});
|
|
660
|
-
}, Bn = S({ iconSize:
|
|
660
|
+
}, Bn = S({ iconSize: cn.default.iconSize }), Vn = Bn.Provider, K = () => E(Bn), Hn = {
|
|
661
661
|
"lexical-editor__toolbar-button": "_lexical-editor__toolbar-button_dp4a1_1",
|
|
662
662
|
"lexical-editor__toolbar-button-active": "_lexical-editor__toolbar-button-active_dp4a1_26",
|
|
663
663
|
"lexical-editor__toolbar-button-highlight": "_lexical-editor__toolbar-button-highlight_dp4a1_30",
|
|
664
664
|
"lexical-editor__toolbar-button-tooltip-trigger": "_lexical-editor__toolbar-button-tooltip-trigger_dp4a1_36"
|
|
665
665
|
}, q = ({ icon: t, tooltip: n, onClick: r, disabled: i, showDisabledTooltip: a, active: o, highlight: s, size: l }) => {
|
|
666
|
-
let { iconSize: u } =
|
|
667
|
-
className:
|
|
668
|
-
[
|
|
669
|
-
[
|
|
666
|
+
let { iconSize: u } = K(), d = /* @__PURE__ */ y("button", {
|
|
667
|
+
className: P(Hn["lexical-editor__toolbar-button"], {
|
|
668
|
+
[Hn["lexical-editor__toolbar-button-active"]]: o,
|
|
669
|
+
[Hn["lexical-editor__toolbar-button-highlight"]]: s
|
|
670
670
|
}),
|
|
671
671
|
type: "button",
|
|
672
672
|
onClick: r,
|
|
@@ -681,7 +681,7 @@ var on = "default", W = {
|
|
|
681
681
|
content: n,
|
|
682
682
|
minWidth: "auto",
|
|
683
683
|
children: i ? /* @__PURE__ */ y("span", {
|
|
684
|
-
className:
|
|
684
|
+
className: Hn["lexical-editor__toolbar-button-tooltip-trigger"],
|
|
685
685
|
children: d
|
|
686
686
|
}) : d
|
|
687
687
|
});
|
|
@@ -689,8 +689,8 @@ var on = "default", W = {
|
|
|
689
689
|
let e = E(mn);
|
|
690
690
|
if (!e) throw Error("useTextFormatsContext must be used within TextFormatsProvider");
|
|
691
691
|
return e;
|
|
692
|
-
},
|
|
693
|
-
let [r] =
|
|
692
|
+
}, Un = ({ disabled: e, tooltip: t, showDisabledTooltip: n }) => {
|
|
693
|
+
let [r] = R(), i = J(), { t: o } = a(), s = i.bold;
|
|
694
694
|
return /* @__PURE__ */ y(q, {
|
|
695
695
|
icon: "bold",
|
|
696
696
|
tooltip: t ?? o("editor.bold"),
|
|
@@ -698,11 +698,11 @@ var on = "default", W = {
|
|
|
698
698
|
active: s,
|
|
699
699
|
disabled: e,
|
|
700
700
|
onClick: () => {
|
|
701
|
-
|
|
701
|
+
G(r), r.dispatchCommand(qe, "bold");
|
|
702
702
|
}
|
|
703
703
|
});
|
|
704
|
-
},
|
|
705
|
-
let [r] =
|
|
704
|
+
}, Wn = ({ disabled: e, tooltip: t, showDisabledTooltip: n }) => {
|
|
705
|
+
let [r] = R(), i = J(), { t: o } = a(), s = i.underline;
|
|
706
706
|
return /* @__PURE__ */ y(q, {
|
|
707
707
|
icon: "underline",
|
|
708
708
|
tooltip: t ?? o("editor.underline"),
|
|
@@ -710,11 +710,11 @@ var on = "default", W = {
|
|
|
710
710
|
active: s,
|
|
711
711
|
disabled: e,
|
|
712
712
|
onClick: () => {
|
|
713
|
-
|
|
713
|
+
G(r), r.dispatchCommand(qe, "underline");
|
|
714
714
|
}
|
|
715
715
|
});
|
|
716
|
-
},
|
|
717
|
-
let [r] =
|
|
716
|
+
}, Gn = ({ disabled: e, tooltip: t, showDisabledTooltip: n }) => {
|
|
717
|
+
let [r] = R(), i = J(), { t: o } = a(), s = i.italic;
|
|
718
718
|
return /* @__PURE__ */ y(q, {
|
|
719
719
|
icon: "italic",
|
|
720
720
|
tooltip: t ?? o("editor.italic"),
|
|
@@ -722,18 +722,18 @@ var on = "default", W = {
|
|
|
722
722
|
active: s,
|
|
723
723
|
disabled: e,
|
|
724
724
|
onClick: () => {
|
|
725
|
-
|
|
725
|
+
G(r), r.dispatchCommand(qe, "italic");
|
|
726
726
|
}
|
|
727
727
|
});
|
|
728
|
-
},
|
|
729
|
-
let [r] =
|
|
728
|
+
}, Kn = ({ disabled: e, tooltip: t, showDisabledTooltip: n }) => {
|
|
729
|
+
let [r] = R(), { t: i } = a(), { fontSize: o, headingTag: s } = J(), c = A(() => hn.map((e) => ({
|
|
730
730
|
key: e.value,
|
|
731
731
|
label: e.label
|
|
732
732
|
})), []), l = T((e) => {
|
|
733
733
|
let t = e.key;
|
|
734
|
-
|
|
735
|
-
let e =
|
|
736
|
-
|
|
734
|
+
G(r), r.update(() => {
|
|
735
|
+
let e = I();
|
|
736
|
+
L(e) && At(e, { "font-size": t });
|
|
737
737
|
});
|
|
738
738
|
}, [r]);
|
|
739
739
|
return s || e ? /* @__PURE__ */ y(q, {
|
|
@@ -746,7 +746,7 @@ var on = "default", W = {
|
|
|
746
746
|
onClick: l,
|
|
747
747
|
activeKey: [o],
|
|
748
748
|
showSearch: !1,
|
|
749
|
-
offset:
|
|
749
|
+
offset: H,
|
|
750
750
|
style: {
|
|
751
751
|
width: "60px",
|
|
752
752
|
minWidth: "60px"
|
|
@@ -761,28 +761,28 @@ var on = "default", W = {
|
|
|
761
761
|
})
|
|
762
762
|
})
|
|
763
763
|
});
|
|
764
|
-
},
|
|
764
|
+
}, qn = "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", Jn = "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", Yn = 860.48, Xn = 99.52, Zn = /rgba\(\s*0\s*,\s*0\s*,\s*0\s*,\s*0(?:\.0+)?\s*\)/, Qn = {
|
|
765
765
|
fontColor: {
|
|
766
|
-
path:
|
|
767
|
-
clipHeight:
|
|
766
|
+
path: qn,
|
|
767
|
+
clipHeight: Yn,
|
|
768
768
|
x: 128,
|
|
769
769
|
width: 768,
|
|
770
770
|
rx: 0
|
|
771
771
|
},
|
|
772
772
|
fill: {
|
|
773
|
-
path:
|
|
773
|
+
path: Jn,
|
|
774
774
|
clipHeight: 816,
|
|
775
775
|
x: 112,
|
|
776
776
|
width: 800,
|
|
777
777
|
rx: 8
|
|
778
778
|
}
|
|
779
|
-
},
|
|
779
|
+
}, $n = (e, t) => {
|
|
780
780
|
let n = t.trim().toLowerCase();
|
|
781
|
-
if (e === "fill") return !n || n === "transparent" ||
|
|
781
|
+
if (e === "fill") return !n || n === "transparent" || Zn.test(n);
|
|
782
782
|
let r = n.replace(/\s+/g, "");
|
|
783
783
|
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)";
|
|
784
|
-
},
|
|
785
|
-
let r = `${
|
|
784
|
+
}, er = ({ variant: e, barColor: t, size: n }) => {
|
|
785
|
+
let r = `${ee().replace(/:/g, "")}clip`, i = Qn[e];
|
|
786
786
|
return /* @__PURE__ */ b("svg", {
|
|
787
787
|
width: n,
|
|
788
788
|
height: n,
|
|
@@ -805,32 +805,32 @@ var on = "default", W = {
|
|
|
805
805
|
}),
|
|
806
806
|
/* @__PURE__ */ y("rect", {
|
|
807
807
|
x: i.x,
|
|
808
|
-
y:
|
|
808
|
+
y: Yn,
|
|
809
809
|
width: i.width,
|
|
810
|
-
height:
|
|
810
|
+
height: Xn,
|
|
811
811
|
rx: i.rx,
|
|
812
|
-
fill:
|
|
812
|
+
fill: $n(e, t) ? "currentColor" : t
|
|
813
813
|
})
|
|
814
814
|
]
|
|
815
815
|
});
|
|
816
|
-
},
|
|
817
|
-
let [r] =
|
|
818
|
-
|
|
819
|
-
let t =
|
|
820
|
-
|
|
816
|
+
}, tr = ({ disabled: e, tooltip: t, showDisabledTooltip: n }) => {
|
|
817
|
+
let [r] = R(), o = J(), { iconSize: s } = K(), { t: c } = a(), l = T((e) => {
|
|
818
|
+
G(r), r.update(() => {
|
|
819
|
+
let t = I();
|
|
820
|
+
L(t) && At(t, { color: e });
|
|
821
821
|
});
|
|
822
822
|
}, [r]);
|
|
823
823
|
return /* @__PURE__ */ y(i, {
|
|
824
824
|
value: o.fontColor,
|
|
825
825
|
onChange: l,
|
|
826
826
|
placement: "bottom-start",
|
|
827
|
-
offset:
|
|
827
|
+
offset: H.y,
|
|
828
828
|
presetColors: "basic",
|
|
829
829
|
disabled: e,
|
|
830
830
|
children: /* @__PURE__ */ y("div", {
|
|
831
831
|
className: "trigger-picker inline-flex",
|
|
832
832
|
children: /* @__PURE__ */ y(q, {
|
|
833
|
-
icon: /* @__PURE__ */ y(
|
|
833
|
+
icon: /* @__PURE__ */ y(er, {
|
|
834
834
|
variant: "fontColor",
|
|
835
835
|
barColor: o.fontColor,
|
|
836
836
|
size: s
|
|
@@ -841,24 +841,24 @@ var on = "default", W = {
|
|
|
841
841
|
})
|
|
842
842
|
})
|
|
843
843
|
});
|
|
844
|
-
},
|
|
845
|
-
let [r] =
|
|
846
|
-
|
|
847
|
-
let t =
|
|
848
|
-
|
|
844
|
+
}, nr = ({ disabled: e, tooltip: t, showDisabledTooltip: n }) => {
|
|
845
|
+
let [r] = R(), o = J(), { iconSize: s } = K(), { t: c } = a(), l = T((e) => {
|
|
846
|
+
G(r), r.update(() => {
|
|
847
|
+
let t = I();
|
|
848
|
+
L(t) && At(t, { "background-color": e });
|
|
849
849
|
});
|
|
850
850
|
}, [r]);
|
|
851
851
|
return /* @__PURE__ */ y(i, {
|
|
852
852
|
value: o.backgroundColor,
|
|
853
853
|
onChange: l,
|
|
854
854
|
placement: "bottom-start",
|
|
855
|
-
offset:
|
|
855
|
+
offset: H.y,
|
|
856
856
|
presetColors: "basic",
|
|
857
857
|
disabled: e,
|
|
858
858
|
children: /* @__PURE__ */ y("div", {
|
|
859
859
|
className: "trigger-picker inline-flex",
|
|
860
860
|
children: /* @__PURE__ */ y(q, {
|
|
861
|
-
icon: /* @__PURE__ */ y(
|
|
861
|
+
icon: /* @__PURE__ */ y(er, {
|
|
862
862
|
variant: "fill",
|
|
863
863
|
barColor: o.backgroundColor,
|
|
864
864
|
size: s
|
|
@@ -869,17 +869,17 @@ var on = "default", W = {
|
|
|
869
869
|
})
|
|
870
870
|
})
|
|
871
871
|
});
|
|
872
|
-
},
|
|
872
|
+
}, rr = {
|
|
873
873
|
left: "paragraph",
|
|
874
874
|
center: "paragraphmiddle",
|
|
875
875
|
right: "paragraphright"
|
|
876
|
-
},
|
|
877
|
-
let [i] =
|
|
876
|
+
}, ir = ({ disabled: t, tooltip: n, showDisabledTooltip: r }) => {
|
|
877
|
+
let [i] = R(), { align: o } = J(), { iconSize: s } = K(), { t: c } = a(), l = A(() => [
|
|
878
878
|
{
|
|
879
879
|
key: "left",
|
|
880
880
|
label: c("leftAlign"),
|
|
881
881
|
icon: /* @__PURE__ */ y(e, {
|
|
882
|
-
name:
|
|
882
|
+
name: rr.left,
|
|
883
883
|
size: s
|
|
884
884
|
})
|
|
885
885
|
},
|
|
@@ -887,7 +887,7 @@ var on = "default", W = {
|
|
|
887
887
|
key: "center",
|
|
888
888
|
label: c("editor.centerAlign"),
|
|
889
889
|
icon: /* @__PURE__ */ y(e, {
|
|
890
|
-
name:
|
|
890
|
+
name: rr.center,
|
|
891
891
|
size: s
|
|
892
892
|
})
|
|
893
893
|
},
|
|
@@ -895,23 +895,23 @@ var on = "default", W = {
|
|
|
895
895
|
key: "right",
|
|
896
896
|
label: c("editor.rightAlign"),
|
|
897
897
|
icon: /* @__PURE__ */ y(e, {
|
|
898
|
-
name:
|
|
898
|
+
name: rr.right,
|
|
899
899
|
size: s
|
|
900
900
|
})
|
|
901
901
|
}
|
|
902
902
|
], [s, c]), u = T((e) => {
|
|
903
|
-
|
|
903
|
+
G(i), i.dispatchCommand(Ke, e.key);
|
|
904
904
|
}, [i]), d = /* @__PURE__ */ y("div", {
|
|
905
|
-
className:
|
|
905
|
+
className: W["bsy-lexical__toolbar-select"],
|
|
906
906
|
style: { width: 50 },
|
|
907
907
|
children: /* @__PURE__ */ y(q, {
|
|
908
908
|
icon: /* @__PURE__ */ b(v, { children: [/* @__PURE__ */ y(e, {
|
|
909
|
-
name:
|
|
909
|
+
name: rr[En(o)],
|
|
910
910
|
size: s
|
|
911
911
|
}), /* @__PURE__ */ y(e, {
|
|
912
912
|
name: "arrow-down",
|
|
913
913
|
size: s,
|
|
914
|
-
className:
|
|
914
|
+
className: W["bsy-lexical__toolbar-select-arrow"]
|
|
915
915
|
})] }),
|
|
916
916
|
tooltip: n ?? c("editor.alignment"),
|
|
917
917
|
showDisabledTooltip: r,
|
|
@@ -923,44 +923,44 @@ var on = "default", W = {
|
|
|
923
923
|
onClick: u,
|
|
924
924
|
showSearch: !1,
|
|
925
925
|
activeKey: [o],
|
|
926
|
-
offset:
|
|
926
|
+
offset: H,
|
|
927
927
|
style: {
|
|
928
928
|
width: "110px",
|
|
929
929
|
minWidth: "110px"
|
|
930
930
|
},
|
|
931
931
|
children: d
|
|
932
932
|
});
|
|
933
|
-
},
|
|
934
|
-
let [i] =
|
|
933
|
+
}, ar = (e) => e ? e.startsWith("@") || e.match(/^https?:\/\//) ? e : `http://${e}` : "", or = ({ disabled: e, tooltip: t, showDisabledTooltip: n }) => {
|
|
934
|
+
let [i] = R(), { link: o } = J(), { t: s } = a(), [c, u] = M(!1), [d, f] = M(""), [p, m] = M(""), [h, g] = M(!0), [_, x] = ie.useMessage(), S = j(null), C = T((e) => {
|
|
935
935
|
u(e), e || i.setEditable(!0);
|
|
936
936
|
}, [i]), w = () => {
|
|
937
937
|
if (!d) {
|
|
938
938
|
_.warning(s("editor.linkAddressEmpty"));
|
|
939
939
|
return;
|
|
940
940
|
}
|
|
941
|
-
let e =
|
|
941
|
+
let e = ar(d);
|
|
942
942
|
i.setEditable(!0), i.update(() => {
|
|
943
943
|
let t = h ? {
|
|
944
944
|
target: "_blank",
|
|
945
945
|
rel: "noopener noreferrer",
|
|
946
946
|
title: d
|
|
947
947
|
} : { title: d }, n = S.current;
|
|
948
|
-
n !== null &&
|
|
949
|
-
let r =
|
|
950
|
-
if (
|
|
948
|
+
n !== null && Pe(n);
|
|
949
|
+
let r = I();
|
|
950
|
+
if (L(r)) {
|
|
951
951
|
let n = p || d, i = r.getTextContent();
|
|
952
|
-
if (!r.isCollapsed() && n === i)
|
|
952
|
+
if (!r.isCollapsed() && n === i) dt(e, t);
|
|
953
953
|
else {
|
|
954
|
-
let i = r.anchor.getNode(), a =
|
|
954
|
+
let i = r.anchor.getNode(), a = je(i) ? i : null, o = r.style || r.getNodes().find(je)?.getStyle() || a?.getStyle() || "", s = r.format || a?.getFormat() || 0, c = lt(e, t), l = Se(n);
|
|
955
955
|
l.setFormat(s), l.setStyle(o), c.append(l), r.insertNodes([c]);
|
|
956
956
|
}
|
|
957
957
|
} else {
|
|
958
|
-
let n =
|
|
959
|
-
n.append(
|
|
960
|
-
let r =
|
|
961
|
-
if (
|
|
958
|
+
let n = lt(e, t);
|
|
959
|
+
n.append(Se(p || d));
|
|
960
|
+
let r = F(), i = r.getLastChild();
|
|
961
|
+
if (De(i) && i.isEmpty()) i.append(n);
|
|
962
962
|
else {
|
|
963
|
-
let e =
|
|
963
|
+
let e = be();
|
|
964
964
|
e.append(n), r.append(e);
|
|
965
965
|
}
|
|
966
966
|
}
|
|
@@ -968,10 +968,10 @@ var on = "default", W = {
|
|
|
968
968
|
}, E = T(() => {
|
|
969
969
|
let e = "";
|
|
970
970
|
i.getEditorState().read(() => {
|
|
971
|
-
let t =
|
|
972
|
-
S.current = t ? t.clone() : null,
|
|
971
|
+
let t = I();
|
|
972
|
+
S.current = t ? t.clone() : null, L(t) && !t.isCollapsed() && (e = t.getTextContent());
|
|
973
973
|
}), i.setEditable(!1), i.update(() => {
|
|
974
|
-
|
|
974
|
+
Pe(null);
|
|
975
975
|
}), window.getSelection()?.removeAllRanges(), i.getRootElement()?.blur(), o ? (f(o.link ?? ""), m(o.linkText ?? "")) : (f(""), m(e)), u(!0);
|
|
976
976
|
}, [o, i]);
|
|
977
977
|
return /* @__PURE__ */ b(v, { children: [
|
|
@@ -997,7 +997,7 @@ var on = "default", W = {
|
|
|
997
997
|
className: "w-[80px] shrink-0",
|
|
998
998
|
children: s("linkAddress")
|
|
999
999
|
}),
|
|
1000
|
-
/* @__PURE__ */ y(
|
|
1000
|
+
/* @__PURE__ */ y(re, {
|
|
1001
1001
|
value: d,
|
|
1002
1002
|
onChange: (e) => f(e.target.value),
|
|
1003
1003
|
placeholder: s("editor.linkTip")
|
|
@@ -1015,7 +1015,7 @@ var on = "default", W = {
|
|
|
1015
1015
|
children: [/* @__PURE__ */ y("label", {
|
|
1016
1016
|
className: "w-[80px] shrink-0",
|
|
1017
1017
|
children: s("showContent")
|
|
1018
|
-
}), /* @__PURE__ */ y(
|
|
1018
|
+
}), /* @__PURE__ */ y(re, {
|
|
1019
1019
|
value: p,
|
|
1020
1020
|
onChange: (e) => m(e.target.value)
|
|
1021
1021
|
})]
|
|
@@ -1028,10 +1028,10 @@ var on = "default", W = {
|
|
|
1028
1028
|
children: s("openInNewTab")
|
|
1029
1029
|
}) }), /* @__PURE__ */ b("div", {
|
|
1030
1030
|
className: "flex gap-[15px]",
|
|
1031
|
-
children: [/* @__PURE__ */ y(
|
|
1031
|
+
children: [/* @__PURE__ */ y(N, {
|
|
1032
1032
|
onClick: () => C(!1),
|
|
1033
1033
|
children: s("cancel")
|
|
1034
|
-
}), /* @__PURE__ */ y(
|
|
1034
|
+
}), /* @__PURE__ */ y(N, {
|
|
1035
1035
|
type: "primary",
|
|
1036
1036
|
onClick: w,
|
|
1037
1037
|
children: s("confirm")
|
|
@@ -1040,15 +1040,15 @@ var on = "default", W = {
|
|
|
1040
1040
|
})] })
|
|
1041
1041
|
})
|
|
1042
1042
|
] });
|
|
1043
|
-
},
|
|
1044
|
-
let [r] =
|
|
1043
|
+
}, sr = ({ disabled: e, tooltip: t, showDisabledTooltip: n }) => {
|
|
1044
|
+
let [r] = R(), { link: i } = J(), { t: o } = a();
|
|
1045
1045
|
return /* @__PURE__ */ y(q, {
|
|
1046
1046
|
icon: "cancellink",
|
|
1047
1047
|
tooltip: t ?? o("cancelLink"),
|
|
1048
1048
|
showDisabledTooltip: n,
|
|
1049
1049
|
disabled: e,
|
|
1050
1050
|
onClick: () => {
|
|
1051
|
-
i && (
|
|
1051
|
+
i && (G(r), r.dispatchCommand(mt, null));
|
|
1052
1052
|
}
|
|
1053
1053
|
});
|
|
1054
1054
|
}, Y = {
|
|
@@ -1077,9 +1077,9 @@ var on = "default", W = {
|
|
|
1077
1077
|
"picture-modal__preview-delete": "_picture-modal__preview-delete_1067t_143",
|
|
1078
1078
|
"picture-modal__upload-text": "_picture-modal__upload-text_1067t_151",
|
|
1079
1079
|
"picture-modal__footer": "_picture-modal__footer_1067t_155"
|
|
1080
|
-
},
|
|
1081
|
-
let [n] =
|
|
1082
|
-
return
|
|
1080
|
+
}, cr = C((e, t) => {
|
|
1081
|
+
let [n] = ne.useForm(), [r, i] = M(""), { t: o } = a(), s = (e) => /^https?:\/\/.+/i.test(e);
|
|
1082
|
+
return k(t, () => ({ getValue: async () => {
|
|
1083
1083
|
try {
|
|
1084
1084
|
return await n.validateFields(), r;
|
|
1085
1085
|
} catch {
|
|
@@ -1089,15 +1089,15 @@ var on = "default", W = {
|
|
|
1089
1089
|
className: Y["picture-modal__content-title"],
|
|
1090
1090
|
"data-title": o("editor.imageUrlNote"),
|
|
1091
1091
|
children: o("editor.enterImageUrl")
|
|
1092
|
-
}), /* @__PURE__ */ y(
|
|
1092
|
+
}), /* @__PURE__ */ y(ne, {
|
|
1093
1093
|
form: n,
|
|
1094
|
-
children: /* @__PURE__ */ y(
|
|
1094
|
+
children: /* @__PURE__ */ y(ne.Item, {
|
|
1095
1095
|
name: "url",
|
|
1096
1096
|
rules: [{
|
|
1097
1097
|
required: !0,
|
|
1098
1098
|
message: o("editor.pleaseEnterImageUrl")
|
|
1099
1099
|
}, { validator: (e, t) => !t || s(t) ? Promise.resolve() : Promise.reject(Error(o("editor.pleaseEnterValidImageUrl"))) }],
|
|
1100
|
-
children: /* @__PURE__ */ y(
|
|
1100
|
+
children: /* @__PURE__ */ y(re, {
|
|
1101
1101
|
placeholder: o("editor.pleaseEnterImageUrl"),
|
|
1102
1102
|
value: r,
|
|
1103
1103
|
onChange: (e) => i(e.target.value)
|
|
@@ -1105,17 +1105,17 @@ var on = "default", W = {
|
|
|
1105
1105
|
})
|
|
1106
1106
|
})] });
|
|
1107
1107
|
});
|
|
1108
|
-
|
|
1108
|
+
cr.displayName = "LinkInput";
|
|
1109
1109
|
//#endregion
|
|
1110
1110
|
//#region src/components/Editor/utils/formatTruncatedFilename.ts
|
|
1111
|
-
var
|
|
1111
|
+
var lr = "......", ur = (e, t, n) => {
|
|
1112
1112
|
if (t <= 0 || n(e) <= t) return {
|
|
1113
1113
|
display: e,
|
|
1114
1114
|
truncated: !1
|
|
1115
1115
|
};
|
|
1116
|
-
let r = e.lastIndexOf("."), i = r > 0 && r < e.length - 1, a = i ? e.slice(0, r) : e, o = i ? e.slice(r) : "", s = a.slice(-2), c = a.slice(0, -2), l = (e) => `${e}${
|
|
1116
|
+
let r = e.lastIndexOf("."), i = r > 0 && r < e.length - 1, a = i ? e.slice(0, r) : e, o = i ? e.slice(r) : "", s = a.slice(-2), c = a.slice(0, -2), l = (e) => `${e}${lr}${s}${o}`, u = (e) => n(e) <= t;
|
|
1117
1117
|
if (!u(l(""))) {
|
|
1118
|
-
let t = `${
|
|
1118
|
+
let t = `${lr}${o}`;
|
|
1119
1119
|
return {
|
|
1120
1120
|
display: u(t) ? t : e,
|
|
1121
1121
|
truncated: !0
|
|
@@ -1130,28 +1130,28 @@ var ur = "......", dr = (e, t, n) => {
|
|
|
1130
1130
|
display: l(c.slice(0, p)),
|
|
1131
1131
|
truncated: !0
|
|
1132
1132
|
};
|
|
1133
|
-
},
|
|
1134
|
-
let e = E(
|
|
1133
|
+
}, dr = S(null), fr = S({ text: "" }), pr = S(void 0), mr = () => {
|
|
1134
|
+
let e = E(dr);
|
|
1135
1135
|
if (!e) throw Error("useEditorContainer must be used within EditorContainerProvider");
|
|
1136
1136
|
return e;
|
|
1137
|
-
},
|
|
1138
|
-
function
|
|
1137
|
+
}, hr = () => E(fr), gr = () => E(pr), _r = "EditorImageUploadingError";
|
|
1138
|
+
function vr(e) {
|
|
1139
1139
|
if (!e || typeof e != "object" || !("name" in e)) return !1;
|
|
1140
1140
|
let t = String(e.name);
|
|
1141
1141
|
return t === "AbortError" || t === "CanceledError";
|
|
1142
1142
|
}
|
|
1143
|
-
function
|
|
1143
|
+
function yr(e) {
|
|
1144
1144
|
return yn.includes(e.name.split(".").pop()?.toLowerCase() ?? "");
|
|
1145
1145
|
}
|
|
1146
|
-
function
|
|
1146
|
+
function br(e) {
|
|
1147
1147
|
if (Number.isFinite(e)) return Math.min(100, Math.max(0, e));
|
|
1148
1148
|
}
|
|
1149
|
-
function
|
|
1149
|
+
function xr(e) {
|
|
1150
1150
|
return e === void 0 ? .55 : .55 * (1 - e / 100);
|
|
1151
1151
|
}
|
|
1152
1152
|
//#endregion
|
|
1153
1153
|
//#region src/components/Editor/ToolbarPlugin/Buttons/PictureButton/UploadImage.tsx
|
|
1154
|
-
var
|
|
1154
|
+
var Sr = {
|
|
1155
1155
|
duration: .2,
|
|
1156
1156
|
ease: [
|
|
1157
1157
|
.4,
|
|
@@ -1159,14 +1159,14 @@ var Cr = {
|
|
|
1159
1159
|
.2,
|
|
1160
1160
|
1
|
|
1161
1161
|
]
|
|
1162
|
-
},
|
|
1163
|
-
let n =
|
|
1164
|
-
return
|
|
1162
|
+
}, Cr = ({ name: e, error: t }) => {
|
|
1163
|
+
let n = j(null), [r, i] = M(e), [a, o] = M(!1);
|
|
1164
|
+
return te(() => {
|
|
1165
1165
|
let t = n.current, r = document.createElement("canvas").getContext("2d");
|
|
1166
1166
|
if (!t || !r) return;
|
|
1167
1167
|
let a = () => {
|
|
1168
1168
|
r.font = getComputedStyle(t).font;
|
|
1169
|
-
let n =
|
|
1169
|
+
let n = ur(e, t.clientWidth, (e) => r.measureText(e).width);
|
|
1170
1170
|
i(n.display), o(n.truncated);
|
|
1171
1171
|
};
|
|
1172
1172
|
a();
|
|
@@ -1174,17 +1174,17 @@ var Cr = {
|
|
|
1174
1174
|
return s.observe(t), () => s.disconnect();
|
|
1175
1175
|
}, [e]), /* @__PURE__ */ y("div", {
|
|
1176
1176
|
ref: n,
|
|
1177
|
-
className:
|
|
1177
|
+
className: P(Y["picture-modal__preview-filename"], t && Y["picture-modal__preview-filename--error"]),
|
|
1178
1178
|
title: a ? e : void 0,
|
|
1179
1179
|
children: r
|
|
1180
1180
|
});
|
|
1181
|
-
},
|
|
1181
|
+
}, wr = (e) => new Promise((t, n) => {
|
|
1182
1182
|
let r = new FileReader();
|
|
1183
1183
|
r.onload = () => t(r.result), r.onerror = () => n(r.error), r.readAsDataURL(e);
|
|
1184
|
-
}),
|
|
1185
|
-
let { upload: r } =
|
|
1184
|
+
}), Tr = C((t, n) => {
|
|
1185
|
+
let { upload: r } = mr(), [i, o] = M(!1), [s, c] = M([]), l = j(s);
|
|
1186
1186
|
l.current = s;
|
|
1187
|
-
let u =
|
|
1187
|
+
let u = j(null), d = j(/* @__PURE__ */ new Map()), f = r?.customRequest, [p, m] = ie.useMessage(), { t: h } = a(), g = (e) => (e / 1024).toFixed(1) + "kb", _ = (e, t) => {
|
|
1188
1188
|
c((n) => n.map((n) => n.id === e ? {
|
|
1189
1189
|
...n,
|
|
1190
1190
|
...t
|
|
@@ -1198,7 +1198,7 @@ var Cr = {
|
|
|
1198
1198
|
d.current.set(e, n), f(t, {
|
|
1199
1199
|
signal: n.signal,
|
|
1200
1200
|
onProgress: (t) => {
|
|
1201
|
-
let n =
|
|
1201
|
+
let n = br(t);
|
|
1202
1202
|
n !== void 0 && _(e, { percent: n });
|
|
1203
1203
|
}
|
|
1204
1204
|
}).then((t) => {
|
|
@@ -1209,11 +1209,11 @@ var Cr = {
|
|
|
1209
1209
|
attachment: typeof t == "string" ? void 0 : t.attachment
|
|
1210
1210
|
});
|
|
1211
1211
|
}).catch((t) => {
|
|
1212
|
-
n.signal.aborted ||
|
|
1212
|
+
n.signal.aborted || vr(t) || _(e, { status: "error" });
|
|
1213
1213
|
}).finally(() => {
|
|
1214
1214
|
d.current.delete(e);
|
|
1215
1215
|
});
|
|
1216
|
-
}, x = (e) =>
|
|
1216
|
+
}, x = (e) => yr(e) ? e.size > 5242880 ? (p.warning(h("editor.imageSizeNote")), !1) : !0 : (p.warning(h("editor.onlyImageFormatsSupported")), !1), S = (e) => {
|
|
1217
1217
|
let t = 10 - l.current.length;
|
|
1218
1218
|
if (t <= 0) {
|
|
1219
1219
|
p.warning(h("editor.imageCountNote", { count: 10 }));
|
|
@@ -1242,16 +1242,16 @@ var Cr = {
|
|
|
1242
1242
|
};
|
|
1243
1243
|
return O(() => () => {
|
|
1244
1244
|
d.current.forEach((e) => e.abort()), d.current.clear(), l.current.forEach((e) => URL.revokeObjectURL(e.url));
|
|
1245
|
-
}, []),
|
|
1245
|
+
}, []), k(n, () => ({ getValue: async () => {
|
|
1246
1246
|
if (s.some((e) => e.status === "uploading")) {
|
|
1247
1247
|
let e = Error(h("editor.imageUploading"));
|
|
1248
|
-
throw e.name =
|
|
1248
|
+
throw e.name = _r, e;
|
|
1249
1249
|
}
|
|
1250
1250
|
let e = s.filter((e) => e.status === "success");
|
|
1251
1251
|
if (!e.length) throw p.warning(h("editor.pleaseUploadImageFirst")), Error(h("editor.pleaseUploadImageFirst"));
|
|
1252
1252
|
try {
|
|
1253
1253
|
return await Promise.all(e.map(async (e) => ({
|
|
1254
|
-
src: e.src ?? await
|
|
1254
|
+
src: e.src ?? await wr(e.file),
|
|
1255
1255
|
fileName: e.file.name,
|
|
1256
1256
|
attachment: e.attachment
|
|
1257
1257
|
})));
|
|
@@ -1290,11 +1290,11 @@ var Cr = {
|
|
|
1290
1290
|
}),
|
|
1291
1291
|
s.length > 0 ? /* @__PURE__ */ y("div", {
|
|
1292
1292
|
className: Y["picture-modal__preview-list"],
|
|
1293
|
-
children: /* @__PURE__ */ y(
|
|
1293
|
+
children: /* @__PURE__ */ y(oe, {
|
|
1294
1294
|
mode: "popLayout",
|
|
1295
|
-
children: s.map((t) => /* @__PURE__ */ b(
|
|
1295
|
+
children: s.map((t) => /* @__PURE__ */ b(se.div, {
|
|
1296
1296
|
layout: "position",
|
|
1297
|
-
className:
|
|
1297
|
+
className: P(Y["picture-modal__preview"], t.status === "error" && Y["picture-modal__preview--error"]),
|
|
1298
1298
|
initial: {
|
|
1299
1299
|
opacity: 0,
|
|
1300
1300
|
y: 12
|
|
@@ -1307,7 +1307,7 @@ var Cr = {
|
|
|
1307
1307
|
opacity: 0,
|
|
1308
1308
|
y: -8
|
|
1309
1309
|
},
|
|
1310
|
-
transition:
|
|
1310
|
+
transition: Sr,
|
|
1311
1311
|
children: [
|
|
1312
1312
|
/* @__PURE__ */ b("div", {
|
|
1313
1313
|
className: Y["picture-modal__preview-image"],
|
|
@@ -1316,13 +1316,13 @@ var Cr = {
|
|
|
1316
1316
|
alt: h("editor.previewImage")
|
|
1317
1317
|
}), t.status === "uploading" ? /* @__PURE__ */ y("div", {
|
|
1318
1318
|
className: Y["picture-modal__preview-mask"],
|
|
1319
|
-
style: { opacity:
|
|
1319
|
+
style: { opacity: xr(t.percent) },
|
|
1320
1320
|
children: t.percent === void 0 ? /* @__PURE__ */ y("span", { className: Y["picture-modal__preview-spinner"] }) : null
|
|
1321
1321
|
}) : null]
|
|
1322
1322
|
}),
|
|
1323
1323
|
/* @__PURE__ */ b("div", {
|
|
1324
1324
|
className: Y["picture-modal__preview-info"],
|
|
1325
|
-
children: [/* @__PURE__ */ y(
|
|
1325
|
+
children: [/* @__PURE__ */ y(Cr, {
|
|
1326
1326
|
name: t.file.name,
|
|
1327
1327
|
error: t.status === "error"
|
|
1328
1328
|
}), /* @__PURE__ */ y("div", {
|
|
@@ -1352,11 +1352,11 @@ var Cr = {
|
|
|
1352
1352
|
]
|
|
1353
1353
|
});
|
|
1354
1354
|
});
|
|
1355
|
-
|
|
1355
|
+
Tr.displayName = "UploadImage";
|
|
1356
1356
|
//#endregion
|
|
1357
1357
|
//#region src/components/Editor/commands/ImageCommands.ts
|
|
1358
|
-
var
|
|
1359
|
-
let { t: o } = a(), [s] =
|
|
1358
|
+
var Er = at("INSERT_INLINE_IMAGE_COMMAND"), Dr = ({ disabled: t, tooltip: n, showDisabledTooltip: i }) => {
|
|
1359
|
+
let { t: o } = a(), [s] = R(), { attachmentsBySrcRef: c } = mr(), [l, d] = M(!1), f = j(null), p = j(null), m = [{
|
|
1360
1360
|
key: "upload",
|
|
1361
1361
|
title: o("editor.uploadImage"),
|
|
1362
1362
|
icon: /* @__PURE__ */ y(e, { name: "picture" })
|
|
@@ -1364,10 +1364,10 @@ var Dr = it("INSERT_INLINE_IMAGE_COMMAND"), Or = ({ disabled: t, tooltip: n, sho
|
|
|
1364
1364
|
key: "url",
|
|
1365
1365
|
title: o("editor.imageUrl"),
|
|
1366
1366
|
icon: /* @__PURE__ */ y(e, { name: "Insertlink" })
|
|
1367
|
-
}], [h, g] =
|
|
1367
|
+
}], [h, g] = M(m[0].key), _ = async () => {
|
|
1368
1368
|
try {
|
|
1369
1369
|
if (h === "upload" && p.current) (await p.current.getValue()).forEach((e) => {
|
|
1370
|
-
e.attachment !== void 0 && c.current.set(e.src, e.attachment), s.dispatchCommand(
|
|
1370
|
+
e.attachment !== void 0 && c.current.set(e.src, e.attachment), s.dispatchCommand(Er, {
|
|
1371
1371
|
src: e.src,
|
|
1372
1372
|
altText: e.fileName,
|
|
1373
1373
|
dataId: e.attachment?._id
|
|
@@ -1375,7 +1375,7 @@ var Dr = it("INSERT_INLINE_IMAGE_COMMAND"), Or = ({ disabled: t, tooltip: n, sho
|
|
|
1375
1375
|
});
|
|
1376
1376
|
else if (f.current) {
|
|
1377
1377
|
let e = await f.current.getValue();
|
|
1378
|
-
s.dispatchCommand(
|
|
1378
|
+
s.dispatchCommand(Er, {
|
|
1379
1379
|
src: e,
|
|
1380
1380
|
dataSrc: e
|
|
1381
1381
|
});
|
|
@@ -1384,14 +1384,14 @@ var Dr = it("INSERT_INLINE_IMAGE_COMMAND"), Or = ({ disabled: t, tooltip: n, sho
|
|
|
1384
1384
|
} catch (e) {
|
|
1385
1385
|
let t = e instanceof Error ? e.message : o("editor.operationFailed");
|
|
1386
1386
|
if (e instanceof Error && e.name === "EditorImageUploadingError") {
|
|
1387
|
-
|
|
1387
|
+
ie.warning(t);
|
|
1388
1388
|
return;
|
|
1389
1389
|
}
|
|
1390
|
-
|
|
1390
|
+
ie.error(t);
|
|
1391
1391
|
}
|
|
1392
1392
|
}, x = {
|
|
1393
|
-
upload: /* @__PURE__ */ y(
|
|
1394
|
-
url: /* @__PURE__ */ y(
|
|
1393
|
+
upload: /* @__PURE__ */ y(Tr, { ref: p }),
|
|
1394
|
+
url: /* @__PURE__ */ y(cr, { ref: f })
|
|
1395
1395
|
};
|
|
1396
1396
|
return /* @__PURE__ */ b(v, { children: [/* @__PURE__ */ y(q, {
|
|
1397
1397
|
icon: "picture",
|
|
@@ -1426,38 +1426,38 @@ var Dr = it("INSERT_INLINE_IMAGE_COMMAND"), Or = ({ disabled: t, tooltip: n, sho
|
|
|
1426
1426
|
})]
|
|
1427
1427
|
}), /* @__PURE__ */ b("div", {
|
|
1428
1428
|
className: Y["picture-modal__footer"],
|
|
1429
|
-
children: [/* @__PURE__ */ y(
|
|
1429
|
+
children: [/* @__PURE__ */ y(N, {
|
|
1430
1430
|
onClick: () => d(!1),
|
|
1431
1431
|
children: o("cancel")
|
|
1432
|
-
}), /* @__PURE__ */ y(
|
|
1432
|
+
}), /* @__PURE__ */ y(N, {
|
|
1433
1433
|
type: "primary",
|
|
1434
1434
|
onClick: _,
|
|
1435
1435
|
children: o("confirm")
|
|
1436
1436
|
})]
|
|
1437
1437
|
})]
|
|
1438
1438
|
})] });
|
|
1439
|
-
},
|
|
1440
|
-
let [r] =
|
|
1439
|
+
}, Or = ({ disabled: e, tooltip: t, showDisabledTooltip: n }) => {
|
|
1440
|
+
let [r] = R(), { canUndo: i } = Rn(), { t: o } = a();
|
|
1441
1441
|
return /* @__PURE__ */ y(q, {
|
|
1442
1442
|
icon: "chexiao",
|
|
1443
1443
|
tooltip: t ?? o("editor.undo"),
|
|
1444
1444
|
showDisabledTooltip: n,
|
|
1445
1445
|
disabled: e || !i,
|
|
1446
1446
|
onClick: () => {
|
|
1447
|
-
r.dispatchCommand(
|
|
1447
|
+
r.dispatchCommand(it, void 0);
|
|
1448
1448
|
}
|
|
1449
1449
|
});
|
|
1450
|
-
},
|
|
1451
|
-
let [r] =
|
|
1450
|
+
}, kr = ({ disabled: e, tooltip: t, showDisabledTooltip: n }) => {
|
|
1451
|
+
let [r] = R(), { canRedo: i } = Rn(), { t: o } = a();
|
|
1452
1452
|
return /* @__PURE__ */ y(q, {
|
|
1453
1453
|
icon: "fanhui",
|
|
1454
1454
|
tooltip: t ?? o("editor.redo"),
|
|
1455
1455
|
showDisabledTooltip: n,
|
|
1456
1456
|
disabled: e || !i,
|
|
1457
|
-
onClick: () => r.dispatchCommand(
|
|
1457
|
+
onClick: () => r.dispatchCommand(tt, void 0)
|
|
1458
1458
|
});
|
|
1459
|
-
},
|
|
1460
|
-
let [r] =
|
|
1459
|
+
}, Ar = ({ disabled: e, tooltip: t, showDisabledTooltip: n }) => {
|
|
1460
|
+
let [r] = R(), { strikethrough: i } = J(), { t: o } = a();
|
|
1461
1461
|
return /* @__PURE__ */ y(q, {
|
|
1462
1462
|
icon: "shanchuxian",
|
|
1463
1463
|
tooltip: t ?? o("editor.strikethrough"),
|
|
@@ -1465,11 +1465,11 @@ var Dr = it("INSERT_INLINE_IMAGE_COMMAND"), Or = ({ disabled: t, tooltip: n, sho
|
|
|
1465
1465
|
active: i,
|
|
1466
1466
|
disabled: e,
|
|
1467
1467
|
onClick: () => {
|
|
1468
|
-
|
|
1468
|
+
G(r), r.dispatchCommand(qe, "strikethrough");
|
|
1469
1469
|
}
|
|
1470
1470
|
});
|
|
1471
|
-
},
|
|
1472
|
-
let [r] =
|
|
1471
|
+
}, jr = ({ disabled: e, tooltip: t, showDisabledTooltip: n }) => {
|
|
1472
|
+
let [r] = R(), { superscript: i } = J(), { t: o } = a();
|
|
1473
1473
|
return /* @__PURE__ */ y(q, {
|
|
1474
1474
|
icon: "shangbiao",
|
|
1475
1475
|
tooltip: t ?? o("editor.superscript"),
|
|
@@ -1477,11 +1477,11 @@ var Dr = it("INSERT_INLINE_IMAGE_COMMAND"), Or = ({ disabled: t, tooltip: n, sho
|
|
|
1477
1477
|
active: i,
|
|
1478
1478
|
disabled: e,
|
|
1479
1479
|
onClick: () => {
|
|
1480
|
-
|
|
1480
|
+
G(r), r.dispatchCommand(qe, "superscript");
|
|
1481
1481
|
}
|
|
1482
1482
|
});
|
|
1483
|
-
},
|
|
1484
|
-
let [r] =
|
|
1483
|
+
}, Mr = ({ disabled: e, tooltip: t, showDisabledTooltip: n }) => {
|
|
1484
|
+
let [r] = R(), { subscript: i } = J(), { t: o } = a();
|
|
1485
1485
|
return /* @__PURE__ */ y(q, {
|
|
1486
1486
|
icon: "xiabiao",
|
|
1487
1487
|
tooltip: t ?? o("editor.subscript"),
|
|
@@ -1489,36 +1489,36 @@ var Dr = it("INSERT_INLINE_IMAGE_COMMAND"), Or = ({ disabled: t, tooltip: n, sho
|
|
|
1489
1489
|
active: i,
|
|
1490
1490
|
disabled: e,
|
|
1491
1491
|
onClick: () => {
|
|
1492
|
-
|
|
1492
|
+
G(r), r.dispatchCommand(qe, "subscript");
|
|
1493
1493
|
}
|
|
1494
1494
|
});
|
|
1495
|
-
},
|
|
1496
|
-
let [r] =
|
|
1495
|
+
}, Nr = ({ disabled: e, tooltip: t, showDisabledTooltip: n }) => {
|
|
1496
|
+
let [r] = R(), { t: i } = a();
|
|
1497
1497
|
return /* @__PURE__ */ y(q, {
|
|
1498
1498
|
icon: "zengjiasuojin",
|
|
1499
1499
|
tooltip: t ?? i("editor.indent"),
|
|
1500
1500
|
showDisabledTooltip: n,
|
|
1501
1501
|
disabled: e,
|
|
1502
1502
|
onClick: () => {
|
|
1503
|
-
|
|
1503
|
+
G(r), r.dispatchCommand(Ye, void 0);
|
|
1504
1504
|
}
|
|
1505
1505
|
});
|
|
1506
|
-
},
|
|
1507
|
-
let [r] =
|
|
1506
|
+
}, Pr = ({ disabled: e, tooltip: t, showDisabledTooltip: n }) => {
|
|
1507
|
+
let [r] = R(), { canOutdent: i } = J(), o = Pn(), { t: s } = a();
|
|
1508
1508
|
return /* @__PURE__ */ b("div", {
|
|
1509
|
-
className:
|
|
1510
|
-
children: [/* @__PURE__ */ y("div", { className:
|
|
1509
|
+
className: W["bsy-lexical__toolbar-with-divider"],
|
|
1510
|
+
children: [/* @__PURE__ */ y("div", { className: W["bsy-lexical__toolbar-divider"] }), /* @__PURE__ */ y(q, {
|
|
1511
1511
|
icon: "jianshaosuojin",
|
|
1512
1512
|
tooltip: t ?? s("editor.outdent"),
|
|
1513
1513
|
showDisabledTooltip: n,
|
|
1514
1514
|
disabled: e || o && !i,
|
|
1515
1515
|
onClick: () => {
|
|
1516
|
-
|
|
1516
|
+
G(r), r.dispatchCommand(Qe, void 0);
|
|
1517
1517
|
}
|
|
1518
1518
|
})]
|
|
1519
1519
|
});
|
|
1520
|
-
},
|
|
1521
|
-
let [r] =
|
|
1520
|
+
}, Fr = ({ disabled: e, tooltip: t, showDisabledTooltip: n }) => {
|
|
1521
|
+
let [r] = R(), { listType: i } = J(), { t: o } = a(), s = i === "bullet";
|
|
1522
1522
|
return /* @__PURE__ */ y(q, {
|
|
1523
1523
|
icon: "xuhaoliebiao",
|
|
1524
1524
|
tooltip: t ?? o("editor.bulletList"),
|
|
@@ -1527,11 +1527,11 @@ var Dr = it("INSERT_INLINE_IMAGE_COMMAND"), Or = ({ disabled: t, tooltip: n, sho
|
|
|
1527
1527
|
disabled: e,
|
|
1528
1528
|
onClick: () => {
|
|
1529
1529
|
let e = Nn(r);
|
|
1530
|
-
r.dispatchCommand(e.listType === "bullet" ?
|
|
1530
|
+
r.dispatchCommand(e.listType === "bullet" ? xt : vt, void 0);
|
|
1531
1531
|
}
|
|
1532
1532
|
});
|
|
1533
|
-
},
|
|
1534
|
-
let [r] =
|
|
1533
|
+
}, Ir = ({ disabled: e, tooltip: t, showDisabledTooltip: n }) => {
|
|
1534
|
+
let [r] = R(), { listType: i } = J(), { t: o } = a(), s = i === "number";
|
|
1535
1535
|
return /* @__PURE__ */ y(q, {
|
|
1536
1536
|
icon: "bianhaoliebiao",
|
|
1537
1537
|
tooltip: t ?? o("editor.numberList"),
|
|
@@ -1540,11 +1540,11 @@ var Dr = it("INSERT_INLINE_IMAGE_COMMAND"), Or = ({ disabled: t, tooltip: n, sho
|
|
|
1540
1540
|
disabled: e,
|
|
1541
1541
|
onClick: () => {
|
|
1542
1542
|
let e = Nn(r);
|
|
1543
|
-
r.dispatchCommand(e.listType === "number" ?
|
|
1543
|
+
r.dispatchCommand(e.listType === "number" ? xt : _t, void 0);
|
|
1544
1544
|
}
|
|
1545
1545
|
});
|
|
1546
|
-
},
|
|
1547
|
-
let [r] =
|
|
1546
|
+
}, Lr = ({ disabled: e, tooltip: t, showDisabledTooltip: n }) => {
|
|
1547
|
+
let [r] = R(), { isCodeBlock: i } = J(), { t: o } = a();
|
|
1548
1548
|
return /* @__PURE__ */ y(q, {
|
|
1549
1549
|
icon: "daima",
|
|
1550
1550
|
tooltip: t ?? o("editor.codeBlock"),
|
|
@@ -1553,18 +1553,18 @@ var Dr = it("INSERT_INLINE_IMAGE_COMMAND"), Or = ({ disabled: t, tooltip: n, sho
|
|
|
1553
1553
|
disabled: e,
|
|
1554
1554
|
onClick: () => {
|
|
1555
1555
|
Mn(r, (e) => {
|
|
1556
|
-
|
|
1556
|
+
jt(I(), () => e.isCodeBlock ? be() : Ct(xn));
|
|
1557
1557
|
});
|
|
1558
1558
|
}
|
|
1559
1559
|
});
|
|
1560
|
-
},
|
|
1560
|
+
}, Rr = {
|
|
1561
1561
|
"bsy-lexical__table-picker": "_bsy-lexical__table-picker_mv0nn_1",
|
|
1562
1562
|
"bsy-lexical__table-picker-grid": "_bsy-lexical__table-picker-grid_mv0nn_9",
|
|
1563
1563
|
"bsy-lexical__table-picker-cell": "_bsy-lexical__table-picker-cell_mv0nn_15",
|
|
1564
1564
|
"bsy-lexical__table-picker-cell--active": "_bsy-lexical__table-picker-cell--active_mv0nn_24",
|
|
1565
1565
|
"bsy-lexical__table-picker-label": "_bsy-lexical__table-picker-label_mv0nn_28"
|
|
1566
|
-
},
|
|
1567
|
-
let [s] =
|
|
1566
|
+
}, zr = _(1, 11), Br = ({ disabled: e, tooltip: r, showDisabledTooltip: i }) => {
|
|
1567
|
+
let [s] = R(), { isInTable: c } = J(), { t: l } = a(), u = t(), [f, p] = M(!1), [m, h] = M({
|
|
1568
1568
|
rows: 0,
|
|
1569
1569
|
cols: 0
|
|
1570
1570
|
});
|
|
@@ -1582,7 +1582,7 @@ var Dr = it("INSERT_INLINE_IMAGE_COMMAND"), Or = ({ disabled: t, tooltip: n, sho
|
|
|
1582
1582
|
showMask: !1,
|
|
1583
1583
|
zIndex: u,
|
|
1584
1584
|
popupMinWidth: "220px",
|
|
1585
|
-
offset:
|
|
1585
|
+
offset: H
|
|
1586
1586
|
});
|
|
1587
1587
|
return c ? /* @__PURE__ */ y(q, {
|
|
1588
1588
|
icon: "charubiaoge",
|
|
@@ -1599,9 +1599,9 @@ var Dr = it("INSERT_INLINE_IMAGE_COMMAND"), Or = ({ disabled: t, tooltip: n, sho
|
|
|
1599
1599
|
showDisabledTooltip: i,
|
|
1600
1600
|
disabled: e
|
|
1601
1601
|
})
|
|
1602
|
-
}), /* @__PURE__ */ y(
|
|
1602
|
+
}), /* @__PURE__ */ y(le, { children: /* @__PURE__ */ y(n, {
|
|
1603
1603
|
zIndex: u,
|
|
1604
|
-
children: /* @__PURE__ */ y(
|
|
1604
|
+
children: /* @__PURE__ */ y(oe, { children: f ? /* @__PURE__ */ y(se.div, {
|
|
1605
1605
|
ref: _.setFloating,
|
|
1606
1606
|
...C(),
|
|
1607
1607
|
style: {
|
|
@@ -1610,23 +1610,23 @@ var Dr = it("INSERT_INLINE_IMAGE_COMMAND"), Or = ({ disabled: t, tooltip: n, sho
|
|
|
1610
1610
|
},
|
|
1611
1611
|
...o,
|
|
1612
1612
|
children: /* @__PURE__ */ b("div", {
|
|
1613
|
-
className:
|
|
1613
|
+
className: Rr["bsy-lexical__table-picker"],
|
|
1614
1614
|
onMouseDown: (e) => e.preventDefault(),
|
|
1615
1615
|
onMouseLeave: () => h({
|
|
1616
1616
|
rows: 0,
|
|
1617
1617
|
cols: 0
|
|
1618
1618
|
}),
|
|
1619
1619
|
children: [/* @__PURE__ */ y("div", {
|
|
1620
|
-
className:
|
|
1621
|
-
children:
|
|
1620
|
+
className: Rr["bsy-lexical__table-picker-grid"],
|
|
1621
|
+
children: zr.map((e) => zr.map((t) => /* @__PURE__ */ y("button", {
|
|
1622
1622
|
type: "button",
|
|
1623
|
-
className:
|
|
1623
|
+
className: P(Rr["bsy-lexical__table-picker-cell"], m.rows >= e && m.cols >= t && Rr["bsy-lexical__table-picker-cell--active"]),
|
|
1624
1624
|
onMouseEnter: () => h({
|
|
1625
1625
|
rows: e,
|
|
1626
1626
|
cols: t
|
|
1627
1627
|
}),
|
|
1628
1628
|
onClick: () => {
|
|
1629
|
-
s.dispatchCommand(
|
|
1629
|
+
s.dispatchCommand(Rt, {
|
|
1630
1630
|
rows: String(e),
|
|
1631
1631
|
columns: String(t),
|
|
1632
1632
|
includeHeaders: !1
|
|
@@ -1634,7 +1634,7 @@ var Dr = it("INSERT_INLINE_IMAGE_COMMAND"), Or = ({ disabled: t, tooltip: n, sho
|
|
|
1634
1634
|
}
|
|
1635
1635
|
}, `${e}-${t}`)))
|
|
1636
1636
|
}), /* @__PURE__ */ b("div", {
|
|
1637
|
-
className:
|
|
1637
|
+
className: Rr["bsy-lexical__table-picker-label"],
|
|
1638
1638
|
children: [
|
|
1639
1639
|
m.rows,
|
|
1640
1640
|
" × ",
|
|
@@ -1644,12 +1644,12 @@ var Dr = it("INSERT_INLINE_IMAGE_COMMAND"), Or = ({ disabled: t, tooltip: n, sho
|
|
|
1644
1644
|
})
|
|
1645
1645
|
}, "bsy-lexical-table-picker") : null })
|
|
1646
1646
|
}) })] });
|
|
1647
|
-
},
|
|
1648
|
-
let e = E(
|
|
1647
|
+
}, Vr = S(null), Hr = () => {
|
|
1648
|
+
let e = E(Vr);
|
|
1649
1649
|
if (!e) throw Error("useSourceMode must be used within SourceModeProvider");
|
|
1650
1650
|
return e;
|
|
1651
|
-
},
|
|
1652
|
-
let { t: r } = a(), { isSourceMode: i, toggleSourceMode: o } =
|
|
1651
|
+
}, Ur = ({ disabled: e, tooltip: t, showDisabledTooltip: n }) => {
|
|
1652
|
+
let { t: r } = a(), { isSourceMode: i, toggleSourceMode: o } = Hr();
|
|
1653
1653
|
return /* @__PURE__ */ y(q, {
|
|
1654
1654
|
icon: "yuanmamoshi",
|
|
1655
1655
|
tooltip: t ?? r("editor.sourceMode"),
|
|
@@ -1658,8 +1658,8 @@ var Dr = it("INSERT_INLINE_IMAGE_COMMAND"), Or = ({ disabled: t, tooltip: n, sho
|
|
|
1658
1658
|
disabled: e,
|
|
1659
1659
|
onClick: o
|
|
1660
1660
|
});
|
|
1661
|
-
},
|
|
1662
|
-
let [i] =
|
|
1661
|
+
}, Wr = ({ disabled: t, tooltip: n, showDisabledTooltip: r }) => {
|
|
1662
|
+
let [i] = R(), { headingTag: o, isInTable: s } = J(), { t: c } = a(), { iconSize: l } = K(), u = o || "paragraph", d = [
|
|
1663
1663
|
{
|
|
1664
1664
|
key: "paragraph",
|
|
1665
1665
|
label: c("editor.paragraph")
|
|
@@ -1678,20 +1678,20 @@ var Dr = it("INSERT_INLINE_IMAGE_COMMAND"), Or = ({ disabled: t, tooltip: n, sho
|
|
|
1678
1678
|
}
|
|
1679
1679
|
], p = d.find((e) => e.key === u)?.label, m = T((e) => {
|
|
1680
1680
|
let t = e.key;
|
|
1681
|
-
|
|
1682
|
-
|
|
1681
|
+
G(i), i.update(() => {
|
|
1682
|
+
jt(I(), () => t === "paragraph" ? be() : Kt(t));
|
|
1683
1683
|
});
|
|
1684
1684
|
}, [i]), h = /* @__PURE__ */ y("div", {
|
|
1685
|
-
className:
|
|
1685
|
+
className: W["bsy-lexical__toolbar-select"],
|
|
1686
1686
|
style: { width: 62 },
|
|
1687
1687
|
children: /* @__PURE__ */ y(q, {
|
|
1688
1688
|
icon: /* @__PURE__ */ b(v, { children: [/* @__PURE__ */ y("span", {
|
|
1689
|
-
className:
|
|
1689
|
+
className: W["bsy-lexical__toolbar-select-label"],
|
|
1690
1690
|
children: p
|
|
1691
1691
|
}), /* @__PURE__ */ y(e, {
|
|
1692
1692
|
name: "arrow-down",
|
|
1693
1693
|
size: l,
|
|
1694
|
-
className:
|
|
1694
|
+
className: W["bsy-lexical__toolbar-select-arrow"]
|
|
1695
1695
|
})] }),
|
|
1696
1696
|
tooltip: n,
|
|
1697
1697
|
showDisabledTooltip: r,
|
|
@@ -1703,7 +1703,7 @@ var Dr = it("INSERT_INLINE_IMAGE_COMMAND"), Or = ({ disabled: t, tooltip: n, sho
|
|
|
1703
1703
|
onClick: m,
|
|
1704
1704
|
showSearch: !1,
|
|
1705
1705
|
activeKey: [u],
|
|
1706
|
-
offset:
|
|
1706
|
+
offset: H,
|
|
1707
1707
|
style: {
|
|
1708
1708
|
width: "62px",
|
|
1709
1709
|
minWidth: "62px"
|
|
@@ -1713,70 +1713,195 @@ var Dr = it("INSERT_INLINE_IMAGE_COMMAND"), Or = ({ disabled: t, tooltip: n, sho
|
|
|
1713
1713
|
};
|
|
1714
1714
|
//#endregion
|
|
1715
1715
|
//#region src/components/Editor/utils/clearInlineTextFormat.ts
|
|
1716
|
-
function
|
|
1717
|
-
let e =
|
|
1718
|
-
if (
|
|
1719
|
-
|
|
1716
|
+
function Gr() {
|
|
1717
|
+
let e = I();
|
|
1718
|
+
if (L(e)) {
|
|
1719
|
+
At(e, {
|
|
1720
1720
|
"font-size": null,
|
|
1721
1721
|
color: null,
|
|
1722
1722
|
"background-color": null
|
|
1723
1723
|
});
|
|
1724
|
-
for (let t of e.getNodes())
|
|
1724
|
+
for (let t of e.getNodes()) je(t) && t.setFormat(0);
|
|
1725
1725
|
e.setFormat(0);
|
|
1726
1726
|
}
|
|
1727
1727
|
}
|
|
1728
1728
|
//#endregion
|
|
1729
1729
|
//#region src/components/Editor/ToolbarPlugin/Buttons/ClearFormatButton.tsx
|
|
1730
|
-
var
|
|
1731
|
-
let [r] =
|
|
1730
|
+
var Kr = ({ disabled: e, tooltip: t, showDisabledTooltip: n }) => {
|
|
1731
|
+
let [r] = R(), { t: i } = a();
|
|
1732
1732
|
return /* @__PURE__ */ y(q, {
|
|
1733
1733
|
icon: "clearTree",
|
|
1734
1734
|
tooltip: t ?? i("editor.clearFormat"),
|
|
1735
1735
|
showDisabledTooltip: n,
|
|
1736
1736
|
disabled: e,
|
|
1737
1737
|
onClick: () => {
|
|
1738
|
-
|
|
1739
|
-
|
|
1738
|
+
G(r), r.update(() => {
|
|
1739
|
+
Gr();
|
|
1740
1740
|
});
|
|
1741
1741
|
}
|
|
1742
1742
|
});
|
|
1743
|
-
},
|
|
1743
|
+
}, qr = [
|
|
1744
1744
|
"quick",
|
|
1745
1745
|
"formal",
|
|
1746
1746
|
"colloquial",
|
|
1747
1747
|
"lively",
|
|
1748
1748
|
"literary",
|
|
1749
1749
|
"retro"
|
|
1750
|
-
],
|
|
1750
|
+
], Jr = {
|
|
1751
1751
|
quick: "editor.aiPresetQuick",
|
|
1752
1752
|
formal: "editor.aiPresetFormal",
|
|
1753
1753
|
colloquial: "editor.aiPresetColloquial",
|
|
1754
1754
|
lively: "editor.aiPresetLively",
|
|
1755
1755
|
literary: "editor.aiPresetLiterary",
|
|
1756
1756
|
retro: "editor.aiPresetRetro"
|
|
1757
|
+
}, Yr = {
|
|
1758
|
+
typeset: [
|
|
1759
|
+
"你是一名专业的 HTML 文档排版引擎。输入已是 HTML 片段。",
|
|
1760
|
+
"任务:在不改内容层(措辞、语序、修辞、情感色彩)的前提下,做形式层 + 视觉层优化,充分利用富文本能力(标题、列表、加粗、字色、背景色、缩进、对齐)。",
|
|
1761
|
+
"",
|
|
1762
|
+
"【核心原则】",
|
|
1763
|
+
"1. 清洁:物理勘误(OCR 误触)、空格/标点治理。",
|
|
1764
|
+
"2. 结构:语义化标签(p / h1 / h2 / h3 / ul / ol / 联系方式分行)。",
|
|
1765
|
+
"3. 视觉:为标题、小节名、关键词、联系方式、并列项增加加粗、颜色、浅底、缩进。可以新增强调,不要求原文先有引号或加粗。",
|
|
1766
|
+
"绝对禁止:重写句子、替换同义词、删改口语词/语气词(如「哈哈」「傻死了」)、调整叙事顺序。",
|
|
1767
|
+
"",
|
|
1768
|
+
"【允许的排版操作】",
|
|
1769
|
+
"1. 断句与分段:",
|
|
1770
|
+
" - 无标点连写长句按语义切成短句,切分处可补「。」或「,」。",
|
|
1771
|
+
" - 每个独立语义块用 <p> 包裹。",
|
|
1772
|
+
" - 不得调换语义块先后顺序;允许同一语义流内断句分段。",
|
|
1773
|
+
"2. 标点规范化:",
|
|
1774
|
+
" - 「!!!!」→「!」,「。。。」→「。」,「,,,」→「,」。",
|
|
1775
|
+
" - 中文语境下「,」→「,」、「.」→「。」;英文缩写、小数、网址、邮箱中的「.」「,」不改。",
|
|
1776
|
+
"3. 空格治理:",
|
|
1777
|
+
" - 删除汉字之间无意义空格;保留英文词间空格。",
|
|
1778
|
+
" - 中英混排时,英文单词前后各留一个半角空格。",
|
|
1779
|
+
"4. 物理勘误:",
|
|
1780
|
+
" - 仅当上下文能唯一判定时,修正 0/O、1/l/I 等误触。",
|
|
1781
|
+
" - 不修正拼写(「监介」必须保留)。",
|
|
1782
|
+
"5. 结构标签化:",
|
|
1783
|
+
" - 篇名/主标题用 <h1>,小节用 <h2>,更小的小标题用 <h3>。正文用 <p>。一篇里主标题通常只有一个 h1。",
|
|
1784
|
+
" - 并列项用 <ul>/<ol> + <li>。",
|
|
1785
|
+
" - 联系方式(电话/邮箱/地址)用 <p> 分行,除勘误外不改字符。",
|
|
1786
|
+
" - 已有 a / img / table / strong / em / u / s / span 必须保留语义,可调整包裹层级。",
|
|
1787
|
+
" - 表格单元格可以排版,不得删改实质内容。",
|
|
1788
|
+
"6. 视觉增强(鼓励,且必须用内联 style;禁止 markdown):",
|
|
1789
|
+
" - 小节名、分类标签、原文已强调的词:<strong>。禁止 **加粗**、## 标题、- 列表、[text](url)、围栏。",
|
|
1790
|
+
" - 标题、关键数字、电话/邮箱:可给 span 加 color。",
|
|
1791
|
+
" - 需要扫读的关键词:给 span 加 background-color 浅底。对:<span style=\"background-color:#fff4cd\">关键词</span>。错:<p style=\"background-color:#f0f6ff\">整段</p>。",
|
|
1792
|
+
" - 背景色只能写在 span 上(短语级),禁止写在 p / h1-h3 / ul / ol / li。",
|
|
1793
|
+
" - 段落/标题缩进只用 padding-inline-start,且必须是 40px 的倍数(与编辑器「增加缩进」一致)。",
|
|
1794
|
+
" - 列表不要写 ul/ol/li 的 padding;标记槽由编辑器按字号处理。",
|
|
1795
|
+
" - 颜色用任意合法 CSS 色值即可(#RGB、#RRGGBB、rgb())。同一篇里主色不超过 2 种强调色,正文保持深色可读。",
|
|
1796
|
+
" - span 仅可用于 color / font-size / background-color。",
|
|
1797
|
+
" - p / h1-h3 仅可用于 text-align / padding-inline-start。",
|
|
1798
|
+
" - 禁止 padding(四边)、padding-top/right/bottom/left、border-radius、margin、box-shadow、border(td/th 除外)。编辑器不能给段落设内边距、圆角或背景色。",
|
|
1799
|
+
"",
|
|
1800
|
+
"【绝对红线】",
|
|
1801
|
+
"- 不得增删实质性单词、数字、年份、名称。",
|
|
1802
|
+
"- 不得删除括号、注释、语气词。",
|
|
1803
|
+
"- 不得把口语改成书面语。",
|
|
1804
|
+
"- 必须原样保留所有 <!--bsy-code-N-->;禁止新增、删除或改写 pre、code、data-language。",
|
|
1805
|
+
"- 禁止编造或改写 img 的 src。",
|
|
1806
|
+
"",
|
|
1807
|
+
"【输出格式】",
|
|
1808
|
+
"只输出纯净 HTML 片段。禁止 markdown 围栏(``` / ```html)、xml 声明、解释性前后文。",
|
|
1809
|
+
"加粗用 <strong>,主标题用 <h1>,小节用 <h2>/<h3>,列表用 <ul>/<ol>。",
|
|
1810
|
+
"允许标签:p, br, h1, h2, h3, ul, ol, li, strong, em, b, i, u, s, span, a, img, table, thead, tbody, tr, td, th, sub, sup。"
|
|
1811
|
+
],
|
|
1812
|
+
polishSystem: /* @__PURE__ */ "你是多语言语义层编辑引擎,只管「意」,不管「版式」(缩进、字体样式、HTML 标签)。,输入是按块切开的纯文本,可能包含任意语言(中文、英文、日文、代码注释、混合文本)。独立代码块不会出现在输入里。,输出仅润色后的纯文本,不加引号、标签或解释。,,【块结构(必须遵守)】,- 输入用 <!--bsy-block--> 分成若干块。一块对应编辑器里的一个标题或段落,顺序就是阅读顺序。,- 输出必须块数相同、顺序相同,并原样保留 <!--bsy-block-->。,- 禁止把两块合成一块,也禁止把一块拆成两块。,- 整块都是套话:该块输出为空,不要把文字并进前后块。,- 断句、加标点、删字只允许发生在块内。,- 不要跨块交换事实(电话、地址、日期、金额不要挪到别的块)。,- <!--bsy-block--> 不是版式,必须原样保留;分隔符周围的空行也不要删。,,【语言自适应处理】,- 自动识别输入文本的主语言(或混合语言比例)。,- 润色时,仅对该语言的语法、措辞、语气进行优化,绝对不跨语言串改(例如:不要把英文短句改成中文中式英语)。,- 专有名词(人名、地名、品牌名)、年份、固定术语保留原语言原字符,不进行翻译或音译。,,【受保护内容隔离区(绝对红线)】,以下内容不做语序或措辞调整;允许明显的 OCR/键盘字符级勘误(如 0 与 O、1 与 l),不要改空格布局。,1. 数学公式与符号:包括但不限于 = + - * / ^ _ { } ( ) [ ],以及 LaTeX 片段(如 E=mc^2、\\frac{a}{b})。,2. 计量单位与数值:如 10kg、$99.99、2026-08-26、99.9%。,3. 混在正文里的路径、命令、行内代码(如 /usr/bin/python)。独立代码块不在输入中。,4. 邮箱地址、网址(URL)、IP 地址:不要改域名或结构。,5. 化学式(H₂O)、物理量符号(λ、Δ)。,,【标点与断句(特殊允许)】,- 根据检测到的语言使用对应的标准标点(中文用中文标点,英文用英文标点)。,- 允许在块内添加/修改句号、逗号、感叹号、问号,用于断句和表达语气。,- 合并连续重复标点(如「!!!!」→「!」或「!!!!」→「!」)。,,【废话分级删除规则】,- 无意义套话(如「如有雷同纯属巧合」「最终解释权归本公司所有」)→ 直接删除。,- 无具体主体的万能版权模板(如单独一行 All rights reserved)可删;带年份或公司名的版权行保留。,- 冗余语气缓冲词(如「说实话」「我个人觉得」「I think」)→ 仅当语气为 formal / literary 时删除;为 colloquial / lively 时保留。,,【勘误优先级(必读)】,- 第一步:物理勘误(仅限明显的 OCR/键盘误触:如数字 0 写成字母 O、数字 1 写成 l/I,全角英文数字改成半角),直接修正。,- 第二步:措辞润色,但绝不修改第一步修正后的数字、年份、公式符号。,,【风格一致性约束】,- 全篇人称/敬语必须统一(中文:你/您;英文:you 与对应敬语;日文:です/ます调)。,- 禁止改变原文的事实性数据(数字、日期、金额、单位)。".split(","),
|
|
1813
|
+
polish: {
|
|
1814
|
+
quick: "语气:轻微改通顺,保持原意和人称。\n规则:尽量不改词,仅补充标点和必要连词;保护区原样保留。",
|
|
1815
|
+
formal: "语气:更正式、书面(适配任意语言的标准书面体)。\n规则:删除口语词(啊/哦/啦/yeah/well),替换为客观陈述;数字原则上保持阿拉伯数字,不拼写为单词。",
|
|
1816
|
+
colloquial: "语气:更口语、自然(适配日常聊天、社交媒体)。\n规则:保留语气词、感叹词,允许短句和不完整句,保留重复强调词(哈哈/haha/すごい)。",
|
|
1817
|
+
lively: "语气:更生动、有画面感。\n规则:适当添加形容词和程度副词,但禁止虚构事实数据。",
|
|
1818
|
+
literary: "语气:更书面、文学感(适配小说、散文、高级文案)。\n规则:若主语言为中文,允许四字格;若为英文,允许复杂从句和排比;不改变原风格基调。",
|
|
1819
|
+
retro: "语气:带一点复古书面色彩,仍保持现代可读。\n规则:仅当主语言为中文时生效:仿民国白话风(之/其/乃);其他语言自动降级为 literary。"
|
|
1820
|
+
}
|
|
1821
|
+
}, Xr = Yr.typeset.join("\n"), Zr = Yr.polishSystem.join("\n"), Qr = (e) => `${Zr}\n\n【本轮风格】\n${Yr.polish[e] ?? Yr.polish.quick}`, $r = (e) => {
|
|
1822
|
+
if (!e.trim()) return {
|
|
1823
|
+
html: e,
|
|
1824
|
+
blocks: []
|
|
1825
|
+
};
|
|
1826
|
+
let t = new DOMParser().parseFromString(e, "text/html"), n = [], r = Array.from(t.body.querySelectorAll("pre"));
|
|
1827
|
+
for (let e of r) {
|
|
1828
|
+
n.push(e.outerHTML);
|
|
1829
|
+
let r = t.createComment(`bsy-code-${n.length - 1}`);
|
|
1830
|
+
e.replaceWith(r);
|
|
1831
|
+
}
|
|
1832
|
+
return {
|
|
1833
|
+
html: t.body.innerHTML,
|
|
1834
|
+
blocks: n
|
|
1835
|
+
};
|
|
1836
|
+
}, ei = "<!--bsy-block-->", ti = /<!--bsy-code-(\d+)-->/g, ni = "bsy-html-root", ri = (e) => new DOMParser().parseFromString(`<${ni}>${e}</${ni}>`, "text/html").body.querySelector(ni), ii = (e, t) => {
|
|
1837
|
+
if (!t.length) return e;
|
|
1838
|
+
let n = /* @__PURE__ */ new Set(), r = e.replace(ti, (e, r) => {
|
|
1839
|
+
let i = Number(r), a = t[i];
|
|
1840
|
+
return a === void 0 ? "" : (n.add(i), a);
|
|
1841
|
+
}), i = t.filter((e, t) => !n.has(t)).join("");
|
|
1842
|
+
return i ? `${r}${i}` : r;
|
|
1843
|
+
}, ai = (e) => {
|
|
1844
|
+
if (!/<pre[\s>/]/i.test(e)) return e;
|
|
1845
|
+
let t = ri(e);
|
|
1846
|
+
if (!t) return e;
|
|
1847
|
+
let n = t.ownerDocument;
|
|
1848
|
+
for (let e of Array.from(t.querySelectorAll("pre"))) {
|
|
1849
|
+
let t = n.createComment("bsy-code-dropped");
|
|
1850
|
+
e.replaceWith(t);
|
|
1851
|
+
}
|
|
1852
|
+
return t.innerHTML.replace(/<!--bsy-code-dropped-->/g, "");
|
|
1853
|
+
}, oi = (e, t) => ii(ai(e), t), si = "p, h1, h2, h3, li", ci = /background(-color)?\s*:/i, li = (e) => {
|
|
1854
|
+
if (!e.trim() || !ci.test(e)) return e;
|
|
1855
|
+
let t = ri(e);
|
|
1856
|
+
if (!t) return e;
|
|
1857
|
+
for (let e of Array.from(t.querySelectorAll(si))) {
|
|
1858
|
+
let t = e;
|
|
1859
|
+
t.style.removeProperty("background-color"), t.style.removeProperty("background"), t.getAttribute("style")?.trim() || t.removeAttribute("style");
|
|
1860
|
+
}
|
|
1861
|
+
return t.innerHTML;
|
|
1862
|
+
}, ui = "--listitem-marker-font-size", di = `max(24px, calc(var(${ui}, 1em) * 1.25))`, fi = new Set([
|
|
1863
|
+
"U",
|
|
1864
|
+
"I",
|
|
1865
|
+
"EM",
|
|
1866
|
+
"B",
|
|
1867
|
+
"STRONG"
|
|
1868
|
+
]), pi = (e) => e.startsWith("--listitem-marker-"), mi = (e) => {
|
|
1869
|
+
let t = e.style.fontSize;
|
|
1870
|
+
if (t) for (let n = e.parentElement; n; n = n.parentElement) fi.has(n.tagName) && !n.style.fontSize && (n.style.fontSize = t), n.tagName === "LI" && !n.classList.contains("editor-nested-listitem") && !n.style.getPropertyValue(ui) && n.style.setProperty(ui, t);
|
|
1871
|
+
}, hi = (e, t, n, r) => {
|
|
1872
|
+
if (!e) return;
|
|
1873
|
+
let i = e.shadowRoot ?? e.attachShadow({ mode: "open" }), a = document.createElement("div");
|
|
1874
|
+
a.className = "bsy-editor-html-preview__body", a.innerHTML = n(t);
|
|
1875
|
+
for (let e of Array.from(a.querySelectorAll("table"))) {
|
|
1876
|
+
if (e.parentElement?.classList.contains("editor-table-scrollable-wrapper")) continue;
|
|
1877
|
+
let t = document.createElement("div");
|
|
1878
|
+
t.className = "editor-table-scrollable-wrapper", e.replaceWith(t), t.append(e);
|
|
1879
|
+
}
|
|
1880
|
+
let o = document.createElement("style");
|
|
1881
|
+
o.textContent = r, i.replaceChildren(o, a);
|
|
1757
1882
|
};
|
|
1758
1883
|
//#endregion
|
|
1759
1884
|
//#region src/components/Editor/utils/htmlText.ts
|
|
1760
|
-
function
|
|
1885
|
+
function gi(e) {
|
|
1761
1886
|
return /<[^>]*$/.test(e.trim());
|
|
1762
1887
|
}
|
|
1763
|
-
function
|
|
1888
|
+
function _i(e) {
|
|
1764
1889
|
return e ? new DOMParser().parseFromString(e, "text/html").body.textContent ?? "" : "";
|
|
1765
1890
|
}
|
|
1766
1891
|
//#endregion
|
|
1767
1892
|
//#region src/components/Editor/utils/fillRootFromHtml.ts
|
|
1768
|
-
var
|
|
1893
|
+
var vi = [
|
|
1769
1894
|
"color",
|
|
1770
1895
|
"background-color",
|
|
1771
1896
|
"font-size",
|
|
1772
1897
|
"font-family",
|
|
1773
1898
|
"font-weight",
|
|
1774
1899
|
"text-decoration"
|
|
1775
|
-
],
|
|
1900
|
+
], yi = (e) => {
|
|
1776
1901
|
let t = e.body.querySelectorAll("p, h1, h2, h3, h4, h5, h6, li, td, th");
|
|
1777
1902
|
for (let n of Array.from(t)) {
|
|
1778
1903
|
let t = n, r = [];
|
|
1779
|
-
for (let e of
|
|
1904
|
+
for (let e of vi) {
|
|
1780
1905
|
let n = t.style.getPropertyValue(e);
|
|
1781
1906
|
n && (r.push(`${e}: ${n}`), t.style.removeProperty(e));
|
|
1782
1907
|
}
|
|
@@ -1794,28 +1919,28 @@ var $r = [
|
|
|
1794
1919
|
}
|
|
1795
1920
|
}
|
|
1796
1921
|
}
|
|
1797
|
-
},
|
|
1798
|
-
let n =
|
|
1922
|
+
}, bi = (e, t) => {
|
|
1923
|
+
let n = F();
|
|
1799
1924
|
if (n.clear(), t.trim()) {
|
|
1800
1925
|
let r = new DOMParser().parseFromString(t, "text/html");
|
|
1801
|
-
|
|
1802
|
-
let i =
|
|
1926
|
+
yi(r);
|
|
1927
|
+
let i = _e(e, r);
|
|
1803
1928
|
if (i.length) {
|
|
1804
|
-
n.select(),
|
|
1929
|
+
n.select(), Ee(i), Pe(null);
|
|
1805
1930
|
return;
|
|
1806
1931
|
}
|
|
1807
1932
|
}
|
|
1808
|
-
let r =
|
|
1809
|
-
n.append(r),
|
|
1933
|
+
let r = be();
|
|
1934
|
+
n.append(r), Pe(null);
|
|
1810
1935
|
};
|
|
1811
1936
|
//#endregion
|
|
1812
1937
|
//#region src/components/Editor/utils/isEmptyEditorHtml.ts
|
|
1813
|
-
function
|
|
1938
|
+
function xi(e, t) {
|
|
1814
1939
|
return !t.trim() && (e === "<p><br></p>" || e === "<p></p>" || e === "" || /^<p>\s*<br>\s*<\/p>$/.test(e));
|
|
1815
1940
|
}
|
|
1816
1941
|
//#endregion
|
|
1817
1942
|
//#region src/components/Editor/utils/sanitizeEditorHtml.ts
|
|
1818
|
-
var
|
|
1943
|
+
var Si = /* @__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("."), Ci = [
|
|
1819
1944
|
"href",
|
|
1820
1945
|
"src",
|
|
1821
1946
|
"alt",
|
|
@@ -1831,12 +1956,12 @@ var ri = /* @__PURE__ */ "p.br.strong.em.b.i.u.s.span.sub.sup.ul.ol.li.a.img.pre
|
|
|
1831
1956
|
"style",
|
|
1832
1957
|
"width",
|
|
1833
1958
|
"height"
|
|
1834
|
-
],
|
|
1959
|
+
], wi = 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(".")), Ti = /^(?:(?:(?:f|ht)tps?|mailto|blob):|data:image\/[a-z0-9.+-]+[;,].*|[^a-z]|[a-z+.-]+(?:[^a-z+.:-]|$))/i, Ei = new Set([
|
|
1835
1960
|
"pre",
|
|
1836
1961
|
"code",
|
|
1837
1962
|
"td",
|
|
1838
1963
|
"th"
|
|
1839
|
-
]),
|
|
1964
|
+
]), Di = new Set(["pre", "code"]), Oi = new Set(["sup", "sub"]), ki = (e, t) => pi(e) ? t === "li" : wi.has(e) ? e === "padding-inline-start" ? !0 : e === "padding" || e.startsWith("padding-") ? Ei.has(t) : e === "border-radius" ? Di.has(t) : e === "position" || e === "top" || e === "bottom" ? Oi.has(t) : !0 : !1, Ai = (e, t) => e.split(";").map((e) => e.trim()).filter(Boolean).map((e) => {
|
|
1840
1965
|
let n = e.indexOf(":");
|
|
1841
1966
|
if (n === -1) return null;
|
|
1842
1967
|
let r = e.slice(0, n).trim().toLowerCase(), i = e.slice(n + 1).trim();
|
|
@@ -1844,106 +1969,80 @@ var ri = /* @__PURE__ */ "p.br.strong.em.b.i.u.s.span.sub.sup.ul.ol.li.a.img.pre
|
|
|
1844
1969
|
if (/url\s*\(/i.test(i)) return null;
|
|
1845
1970
|
r = "background-color";
|
|
1846
1971
|
}
|
|
1847
|
-
return !
|
|
1848
|
-
}).filter((e) => e !== null).join("; "),
|
|
1849
|
-
|
|
1972
|
+
return !ki(r, t) || /expression|javascript:|url\s*\(\s*['"]?\s*javascript/i.test(i) ? null : `${r}: ${i}`;
|
|
1973
|
+
}).filter((e) => e !== null).join("; "), ji = !1, Mi = () => {
|
|
1974
|
+
ji ||= (Zt.addHook("uponSanitizeAttribute", (e, t) => {
|
|
1850
1975
|
if (t.attrName === "href" && /^data:/i.test(t.attrValue)) {
|
|
1851
1976
|
t.keepAttr = !1;
|
|
1852
1977
|
return;
|
|
1853
1978
|
}
|
|
1854
|
-
t.attrName === "style" && (t.attrValue =
|
|
1979
|
+
t.attrName === "style" && (t.attrValue = Ai(t.attrValue, e.nodeName.toLowerCase()), t.attrValue || (t.keepAttr = !1));
|
|
1855
1980
|
}), !0);
|
|
1856
1981
|
};
|
|
1857
1982
|
function X(e) {
|
|
1858
|
-
return e ? (
|
|
1859
|
-
ALLOWED_TAGS:
|
|
1860
|
-
ALLOWED_ATTR:
|
|
1983
|
+
return e ? (Mi(), Zt.sanitize(e, {
|
|
1984
|
+
ALLOWED_TAGS: Si,
|
|
1985
|
+
ALLOWED_ATTR: Ci,
|
|
1861
1986
|
ALLOW_DATA_ATTR: !1,
|
|
1862
1987
|
ADD_ATTR: [
|
|
1863
1988
|
"data-language",
|
|
1864
1989
|
"data-id",
|
|
1865
1990
|
"data-src"
|
|
1866
1991
|
],
|
|
1867
|
-
ALLOWED_URI_REGEXP:
|
|
1992
|
+
ALLOWED_URI_REGEXP: Ti
|
|
1868
1993
|
})) : "";
|
|
1869
1994
|
}
|
|
1870
1995
|
//#endregion
|
|
1871
|
-
//#region src/components/Editor/utils/stitchCodePlaceholders.ts
|
|
1872
|
-
var mi = "bsy-html-root";
|
|
1873
|
-
function hi(e) {
|
|
1874
|
-
return new DOMParser().parseFromString(`<${mi}>${e}</${mi}>`, "text/html").body.querySelector(mi);
|
|
1875
|
-
}
|
|
1876
|
-
function gi(e, t) {
|
|
1877
|
-
if (!t.length) return e;
|
|
1878
|
-
let n = /* @__PURE__ */ new Set(), r = e.replace(Jr, (e, r) => {
|
|
1879
|
-
let i = Number(r), a = t[i];
|
|
1880
|
-
return a === void 0 ? "" : (n.add(i), a);
|
|
1881
|
-
}), i = t.filter((e, t) => !n.has(t)).join("");
|
|
1882
|
-
return i ? `${r}${i}` : r;
|
|
1883
|
-
}
|
|
1884
|
-
function _i(e, t) {
|
|
1885
|
-
return gi(vi(e), t);
|
|
1886
|
-
}
|
|
1887
|
-
function vi(e) {
|
|
1888
|
-
if (!/<pre[\s>/]/i.test(e)) return e;
|
|
1889
|
-
let t = hi(e);
|
|
1890
|
-
if (!t) return e;
|
|
1891
|
-
let n = t.ownerDocument;
|
|
1892
|
-
for (let e of Array.from(t.querySelectorAll("pre"))) {
|
|
1893
|
-
let t = n.createComment("bsy-code-dropped");
|
|
1894
|
-
e.replaceWith(t);
|
|
1895
|
-
}
|
|
1896
|
-
return t.innerHTML.replace(/<!--bsy-code-dropped-->/g, "");
|
|
1897
|
-
}
|
|
1898
|
-
//#endregion
|
|
1899
1996
|
//#region src/components/Editor/constants/portableEditorStyles.ts
|
|
1900
|
-
var
|
|
1997
|
+
var Ni = {
|
|
1901
1998
|
margin: "0.6em 0 0.4em",
|
|
1902
1999
|
"font-weight": "600",
|
|
1903
2000
|
"line-height": "1.35"
|
|
1904
|
-
},
|
|
2001
|
+
}, Pi = {
|
|
1905
2002
|
h1: {
|
|
1906
|
-
...
|
|
2003
|
+
...Ni,
|
|
1907
2004
|
"font-size": "2em"
|
|
1908
2005
|
},
|
|
1909
2006
|
h2: {
|
|
1910
|
-
...
|
|
2007
|
+
...Ni,
|
|
1911
2008
|
"font-size": "1.5em"
|
|
1912
2009
|
},
|
|
1913
2010
|
h3: {
|
|
1914
|
-
...
|
|
2011
|
+
...Ni,
|
|
1915
2012
|
"font-size": "1.25em"
|
|
1916
2013
|
},
|
|
1917
2014
|
h4: {
|
|
1918
|
-
...
|
|
2015
|
+
...Ni,
|
|
1919
2016
|
"font-size": "1.125em"
|
|
1920
2017
|
},
|
|
1921
2018
|
h5: {
|
|
1922
|
-
...
|
|
2019
|
+
...Ni,
|
|
1923
2020
|
"font-size": "1em"
|
|
1924
2021
|
},
|
|
1925
2022
|
h6: {
|
|
1926
|
-
...
|
|
2023
|
+
...Ni,
|
|
1927
2024
|
"font-size": "0.875em"
|
|
1928
2025
|
}
|
|
1929
|
-
},
|
|
2026
|
+
}, Fi = {
|
|
1930
2027
|
color: "#0269ff",
|
|
1931
2028
|
cursor: "pointer"
|
|
1932
|
-
},
|
|
2029
|
+
}, Ii = {
|
|
1933
2030
|
margin: "0",
|
|
1934
|
-
"padding-inline-start": "
|
|
2031
|
+
"padding-inline-start": "0",
|
|
1935
2032
|
"list-style-position": "outside"
|
|
1936
|
-
},
|
|
2033
|
+
}, Li = [
|
|
1937
2034
|
"disc",
|
|
1938
2035
|
"circle",
|
|
1939
2036
|
"square"
|
|
1940
|
-
],
|
|
2037
|
+
], Ri = {
|
|
1941
2038
|
margin: "0",
|
|
2039
|
+
"margin-inline-start": di,
|
|
1942
2040
|
"list-style": "inherit"
|
|
1943
|
-
},
|
|
2041
|
+
}, zi = {
|
|
1944
2042
|
margin: "0",
|
|
2043
|
+
"margin-inline-start": "0",
|
|
1945
2044
|
"list-style-type": "none"
|
|
1946
|
-
},
|
|
2045
|
+
}, Bi = {
|
|
1947
2046
|
display: "block",
|
|
1948
2047
|
"box-sizing": "border-box",
|
|
1949
2048
|
"max-width": "100%",
|
|
@@ -1958,23 +2057,23 @@ var yi = {
|
|
|
1958
2057
|
"border-radius": "4px",
|
|
1959
2058
|
"background-color": "rgb(240, 242, 245)",
|
|
1960
2059
|
color: "#1f2328"
|
|
1961
|
-
},
|
|
2060
|
+
}, Vi = {
|
|
1962
2061
|
"border-collapse": "collapse",
|
|
1963
2062
|
"table-layout": "fixed",
|
|
1964
2063
|
width: "100%",
|
|
1965
2064
|
"overflow-x": "auto",
|
|
1966
2065
|
margin: "8px 0"
|
|
1967
|
-
},
|
|
2066
|
+
}, Hi = {
|
|
1968
2067
|
"box-sizing": "border-box",
|
|
1969
2068
|
"min-width": "75px",
|
|
1970
2069
|
"min-height": "32px",
|
|
1971
2070
|
padding: "4px 8px",
|
|
1972
2071
|
border: "1px solid #d9d9d9",
|
|
1973
2072
|
"vertical-align": "top"
|
|
1974
|
-
},
|
|
2073
|
+
}, Ui = {
|
|
1975
2074
|
"font-weight": "600",
|
|
1976
2075
|
"background-color": "#f2f3f5"
|
|
1977
|
-
},
|
|
2076
|
+
}, Wi = {
|
|
1978
2077
|
display: "inline-block",
|
|
1979
2078
|
position: "static",
|
|
1980
2079
|
top: "auto",
|
|
@@ -1983,38 +2082,39 @@ var yi = {
|
|
|
1983
2082
|
"line-height": "1"
|
|
1984
2083
|
}, Z = (e, t) => {
|
|
1985
2084
|
for (let [n, r] of Object.entries(t)) e.style.getPropertyValue(n) || e.style.setProperty(n, r);
|
|
1986
|
-
},
|
|
2085
|
+
}, Gi = (e) => {
|
|
1987
2086
|
let t = 0, n = e;
|
|
1988
2087
|
for (; n;) n.tagName === "UL" && (t += 1), n = n.parentElement;
|
|
1989
2088
|
return t;
|
|
1990
|
-
},
|
|
1991
|
-
|
|
1992
|
-
|
|
1993
|
-
|
|
1994
|
-
|
|
1995
|
-
|
|
1996
|
-
|
|
1997
|
-
|
|
1998
|
-
|
|
2089
|
+
}, Ki = (e) => {
|
|
2090
|
+
let t = [...e.querySelectorAll("*")].filter((e) => e instanceof HTMLElement);
|
|
2091
|
+
for (let e of t) mi(e);
|
|
2092
|
+
for (let e of t) {
|
|
2093
|
+
let t = e.tagName.toLowerCase(), n = Pi[t];
|
|
2094
|
+
if (n && Z(e, n), t === "a" && Z(e, Fi), t === "ul") {
|
|
2095
|
+
let t = Math.min(Math.max(Gi(e), 1), Li.length);
|
|
2096
|
+
Z(e, {
|
|
2097
|
+
...Ii,
|
|
2098
|
+
"list-style-type": Li[t - 1]
|
|
1999
2099
|
});
|
|
2000
2100
|
}
|
|
2001
|
-
|
|
2002
|
-
...
|
|
2101
|
+
t === "ol" && Z(e, {
|
|
2102
|
+
...Ii,
|
|
2003
2103
|
"list-style-type": "decimal"
|
|
2004
|
-
}),
|
|
2005
|
-
...
|
|
2006
|
-
"vertical-align":
|
|
2007
|
-
}),
|
|
2008
|
-
for (let
|
|
2009
|
-
|
|
2104
|
+
}), t === "li" && Z(e, e.classList.contains("editor-nested-listitem") ? zi : Ri), t === "pre" && Z(e, Bi), (t === "sup" || t === "sub") && Z(e, {
|
|
2105
|
+
...Wi,
|
|
2106
|
+
"vertical-align": t === "sup" ? "super" : "sub"
|
|
2107
|
+
}), t === "table" && Z(e, Vi), (t === "td" || t === "th") && (Z(e, Hi), (t === "th" || e.classList.contains("editor-table-cell-header")) && Z(e, Ui)), e.classList.contains("editor-text-underline-strikethrough") ? Z(e, { "text-decoration": "underline line-through" }) : e.classList.contains("editor-text-underline") ? Z(e, { "text-decoration": "underline" }) : e.classList.contains("editor-text-strikethrough") && Z(e, { "text-decoration": "line-through" });
|
|
2108
|
+
for (let t of Array.from(e.classList)) t.startsWith("editor-") && e.classList.remove(t);
|
|
2109
|
+
e.classList.length === 0 && e.removeAttribute("class");
|
|
2010
2110
|
}
|
|
2011
|
-
},
|
|
2111
|
+
}, qi = (e) => {
|
|
2012
2112
|
let t = e.parentNode;
|
|
2013
2113
|
if (t) {
|
|
2014
2114
|
for (; e.firstChild;) t.insertBefore(e.firstChild, e);
|
|
2015
2115
|
t.removeChild(e);
|
|
2016
2116
|
}
|
|
2017
|
-
},
|
|
2117
|
+
}, Ji = (e) => {
|
|
2018
2118
|
let t = !0;
|
|
2019
2119
|
for (; t;) {
|
|
2020
2120
|
t = !1;
|
|
@@ -2022,35 +2122,34 @@ var yi = {
|
|
|
2022
2122
|
if (n.attributes.length > 0) continue;
|
|
2023
2123
|
let e = n.tagName.toLowerCase();
|
|
2024
2124
|
if (e === "span") {
|
|
2025
|
-
|
|
2125
|
+
qi(n), t = !0;
|
|
2026
2126
|
continue;
|
|
2027
2127
|
}
|
|
2028
2128
|
if (n.childElementCount !== 1 || n.childNodes.length !== 1) continue;
|
|
2029
2129
|
let r = n.firstElementChild;
|
|
2030
|
-
(e === "b" && r?.tagName === "STRONG" || e === "i" && r?.tagName === "EM") && (
|
|
2130
|
+
(e === "b" && r?.tagName === "STRONG" || e === "i" && r?.tagName === "EM") && (qi(n), t = !0);
|
|
2031
2131
|
}
|
|
2032
2132
|
}
|
|
2033
2133
|
};
|
|
2034
|
-
function
|
|
2134
|
+
function Yi(e) {
|
|
2035
2135
|
if (!e.trim()) return e;
|
|
2036
2136
|
let t = new DOMParser().parseFromString(e, "text/html");
|
|
2037
|
-
|
|
2137
|
+
Ki(t.body), Ji(t.body);
|
|
2038
2138
|
for (let e of Array.from(t.body.querySelectorAll("pre"))) e.textContent?.trim() || e.remove();
|
|
2039
2139
|
return t.body.innerHTML;
|
|
2040
2140
|
}
|
|
2041
2141
|
//#endregion
|
|
2042
2142
|
//#region src/components/Editor/utils/applyAiPolish.ts
|
|
2043
|
-
|
|
2044
|
-
|
|
2045
|
-
return e.join(`\n\n${Ii}\n\n`);
|
|
2143
|
+
function Xi(e) {
|
|
2144
|
+
return e.join(`\n\n${ei}\n\n`);
|
|
2046
2145
|
}
|
|
2047
|
-
function
|
|
2048
|
-
return e.includes("<!--bsy-block-->") ? e.split(
|
|
2146
|
+
function Zi(e) {
|
|
2147
|
+
return e.includes("<!--bsy-block-->") ? e.split(ei).map((e) => e.trim()) : [e];
|
|
2049
2148
|
}
|
|
2050
|
-
function
|
|
2051
|
-
return e.split(
|
|
2149
|
+
function Qi(e) {
|
|
2150
|
+
return e.split(ei).join("").trim().length > 0;
|
|
2052
2151
|
}
|
|
2053
|
-
function
|
|
2152
|
+
function $i(e, t) {
|
|
2054
2153
|
let n = e.map(() => "");
|
|
2055
2154
|
if (e.length === 0) return n;
|
|
2056
2155
|
let r = [], i = [];
|
|
@@ -2064,7 +2163,7 @@ function Bi(e, t) {
|
|
|
2064
2163
|
for (; d < c;) n[n.length - 1] += o[d], d += 1;
|
|
2065
2164
|
return n;
|
|
2066
2165
|
}
|
|
2067
|
-
var
|
|
2166
|
+
var ea = new Set(["PRE"]), ta = new Set([
|
|
2068
2167
|
"PRE",
|
|
2069
2168
|
"TABLE",
|
|
2070
2169
|
"THEAD",
|
|
@@ -2075,11 +2174,11 @@ var Vi = new Set(["PRE"]), Hi = new Set([
|
|
|
2075
2174
|
"IMG",
|
|
2076
2175
|
"BR"
|
|
2077
2176
|
]);
|
|
2078
|
-
function
|
|
2177
|
+
function na(e) {
|
|
2079
2178
|
let t = [], n = (e) => {
|
|
2080
2179
|
if (e.nodeType === Node.ELEMENT_NODE) {
|
|
2081
2180
|
let t = e.tagName;
|
|
2082
|
-
if (
|
|
2181
|
+
if (ea.has(t)) return;
|
|
2083
2182
|
for (let t of Array.from(e.childNodes)) n(t);
|
|
2084
2183
|
return;
|
|
2085
2184
|
}
|
|
@@ -2087,31 +2186,31 @@ function Ui(e) {
|
|
|
2087
2186
|
};
|
|
2088
2187
|
return n(e), t;
|
|
2089
2188
|
}
|
|
2090
|
-
function
|
|
2189
|
+
function ra(e, t) {
|
|
2091
2190
|
let n = e;
|
|
2092
|
-
for (; n && n !== t && !
|
|
2191
|
+
for (; n && n !== t && !ta.has(n.tagName) && !(n.textContent ?? "").trim() && !n.querySelector("img, pre, table, br");) {
|
|
2093
2192
|
let e = n.parentElement;
|
|
2094
2193
|
n.remove(), n = e;
|
|
2095
2194
|
}
|
|
2096
2195
|
}
|
|
2097
|
-
function
|
|
2196
|
+
function ia(e) {
|
|
2098
2197
|
let t = e.tagName;
|
|
2099
2198
|
return t === "PRE" || t === "IMG" || t === "TABLE";
|
|
2100
2199
|
}
|
|
2101
|
-
function
|
|
2102
|
-
let t =
|
|
2103
|
-
return t ? Array.from(t.children).filter((e) => !
|
|
2200
|
+
function aa(e) {
|
|
2201
|
+
let t = ri(e);
|
|
2202
|
+
return t ? Array.from(t.children).filter((e) => !ia(e)).map((e) => e.textContent ?? "") : [];
|
|
2104
2203
|
}
|
|
2105
|
-
function
|
|
2106
|
-
return e.includes("<!--bsy-block-->") ? e :
|
|
2204
|
+
function oa(e) {
|
|
2205
|
+
return e.includes("<!--bsy-block-->") ? e : _i(e) || e;
|
|
2107
2206
|
}
|
|
2108
|
-
function
|
|
2109
|
-
let n =
|
|
2207
|
+
function sa(e, t) {
|
|
2208
|
+
let n = na(e);
|
|
2110
2209
|
if (n.length === 0) {
|
|
2111
2210
|
t && (e.querySelector("br")?.remove(), e.append(e.ownerDocument.createTextNode(t)));
|
|
2112
2211
|
return;
|
|
2113
2212
|
}
|
|
2114
|
-
let r =
|
|
2213
|
+
let r = $i(n.map((e) => e.textContent ?? ""), t);
|
|
2115
2214
|
for (let t = 0; t < n.length; t++) {
|
|
2116
2215
|
let i = r[t], a = n[t];
|
|
2117
2216
|
if (i) {
|
|
@@ -2119,56 +2218,38 @@ function Ji(e, t) {
|
|
|
2119
2218
|
continue;
|
|
2120
2219
|
}
|
|
2121
2220
|
let o = a.parentElement;
|
|
2122
|
-
a.remove(),
|
|
2221
|
+
a.remove(), ra(o, e);
|
|
2123
2222
|
}
|
|
2124
2223
|
}
|
|
2125
|
-
function
|
|
2126
|
-
let n =
|
|
2127
|
-
if (!
|
|
2128
|
-
let r =
|
|
2224
|
+
function ca(e, t) {
|
|
2225
|
+
let n = oa(t);
|
|
2226
|
+
if (!Qi(n) || !e.trim()) return "";
|
|
2227
|
+
let r = ri(e);
|
|
2129
2228
|
if (!r) return "";
|
|
2130
|
-
let i = Array.from(r.children).filter((e) => !
|
|
2229
|
+
let i = Array.from(r.children).filter((e) => !ia(e));
|
|
2131
2230
|
if (i.length === 0) return "";
|
|
2132
|
-
let a =
|
|
2133
|
-
for (let e = 0; e < i.length; e++)
|
|
2231
|
+
let a = Zi(n), o = a.length === i.length ? a : $i(i.map((e) => e.textContent ?? ""), a.join(""));
|
|
2232
|
+
for (let e = 0; e < i.length; e++) sa(i[e], o[e] ?? "");
|
|
2134
2233
|
return r.innerHTML;
|
|
2135
2234
|
}
|
|
2136
|
-
function
|
|
2235
|
+
function la(e, t) {
|
|
2137
2236
|
let n = "";
|
|
2138
2237
|
e.getEditorState().read(() => {
|
|
2139
|
-
n =
|
|
2238
|
+
n = Yi(X(ge(e, null)));
|
|
2140
2239
|
}, { editor: e });
|
|
2141
|
-
let r = X(
|
|
2142
|
-
return !r.trim() ||
|
|
2143
|
-
|
|
2240
|
+
let r = X(ca(n, t));
|
|
2241
|
+
return !r.trim() || xi(r, _i(r)) ? !1 : (e.update(() => {
|
|
2242
|
+
bi(e, r), Dn(!0);
|
|
2144
2243
|
}, { discrete: !0 }), !0);
|
|
2145
2244
|
}
|
|
2146
2245
|
//#endregion
|
|
2147
|
-
//#region src/components/Editor/utils/extractCodePlaceholders.ts
|
|
2148
|
-
function Zi(e) {
|
|
2149
|
-
if (!e.trim()) return {
|
|
2150
|
-
html: e,
|
|
2151
|
-
blocks: []
|
|
2152
|
-
};
|
|
2153
|
-
let t = new DOMParser().parseFromString(e, "text/html"), n = [], r = Array.from(t.body.querySelectorAll("pre"));
|
|
2154
|
-
for (let e of r) {
|
|
2155
|
-
n.push(e.outerHTML);
|
|
2156
|
-
let r = t.createComment(`bsy-code-${n.length - 1}`);
|
|
2157
|
-
e.replaceWith(r);
|
|
2158
|
-
}
|
|
2159
|
-
return {
|
|
2160
|
-
html: t.body.innerHTML,
|
|
2161
|
-
blocks: n
|
|
2162
|
-
};
|
|
2163
|
-
}
|
|
2164
|
-
//#endregion
|
|
2165
2246
|
//#region src/components/Editor/utils/readEditorAiSnapshot.ts
|
|
2166
|
-
function
|
|
2247
|
+
function ua(e) {
|
|
2167
2248
|
let t = "", n = "", r = "";
|
|
2168
2249
|
e.getEditorState().read(() => {
|
|
2169
|
-
n =
|
|
2250
|
+
n = F().getTextContent(), t = Yi(X(ge(e, null))), r = Xi(aa(t));
|
|
2170
2251
|
}, { editor: e });
|
|
2171
|
-
let i =
|
|
2252
|
+
let i = $r(t);
|
|
2172
2253
|
return {
|
|
2173
2254
|
html: t,
|
|
2174
2255
|
text: n,
|
|
@@ -2207,16 +2288,17 @@ var Q = {
|
|
|
2207
2288
|
"bsy-lexical-ai__footer": "_bsy-lexical-ai__footer_p7v4i_165",
|
|
2208
2289
|
"bsy-lexical-ai__error": "_bsy-lexical-ai__error_p7v4i_173",
|
|
2209
2290
|
"bsy-lexical-ai__preset": "_bsy-lexical-ai__preset_p7v4i_178"
|
|
2210
|
-
},
|
|
2211
|
-
let [i] =
|
|
2291
|
+
}, da = "data:image/png;base64,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", fa = "data:image/png;base64,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", pa = 16, ma = ({ disabled: t, tooltip: n, showDisabledTooltip: r }) => {
|
|
2292
|
+
let [i] = R(), { typeset: o, polish: s, canTypeset: c, canPolish: l, aiOpen: u, setAiOpen: d, aiSessionRef: p } = mr(), { hasEditorText: m } = J(), { t: h } = a(), { iconSize: g } = K(), _ = t || !c || !m, x = t || !l || !m, S = t || !!u, C = T(() => {
|
|
2212
2293
|
if (t || !c || !o) return;
|
|
2213
|
-
let e =
|
|
2294
|
+
let e = ua(i);
|
|
2214
2295
|
e.text.trim() && (p.current = {
|
|
2215
2296
|
originalHtml: e.html,
|
|
2216
2297
|
codeBlocks: e.codeBlocks
|
|
2217
2298
|
}, d("typeset"), o({
|
|
2218
2299
|
text: e.text,
|
|
2219
|
-
html: e.htmlWithoutCode
|
|
2300
|
+
html: e.htmlWithoutCode,
|
|
2301
|
+
prompt: Xr
|
|
2220
2302
|
}));
|
|
2221
2303
|
}, [
|
|
2222
2304
|
p,
|
|
@@ -2227,14 +2309,15 @@ var Q = {
|
|
|
2227
2309
|
o
|
|
2228
2310
|
]), w = T((e) => {
|
|
2229
2311
|
if (t || !l || !s) return;
|
|
2230
|
-
let n =
|
|
2231
|
-
|
|
2312
|
+
let n = ua(i);
|
|
2313
|
+
Qi(n.polishText) && (p.current = {
|
|
2232
2314
|
originalHtml: n.html,
|
|
2233
2315
|
originalText: n.polishText,
|
|
2234
2316
|
preset: e
|
|
2235
2317
|
}, d("polish"), s({
|
|
2236
2318
|
text: n.polishText,
|
|
2237
|
-
preset: e
|
|
2319
|
+
preset: e,
|
|
2320
|
+
prompt: Qr(e)
|
|
2238
2321
|
}));
|
|
2239
2322
|
}, [
|
|
2240
2323
|
p,
|
|
@@ -2248,16 +2331,16 @@ var Q = {
|
|
|
2248
2331
|
C();
|
|
2249
2332
|
return;
|
|
2250
2333
|
}
|
|
2251
|
-
|
|
2334
|
+
qr.includes(e.key) && w(e.key);
|
|
2252
2335
|
}, [w, C]), D = [{
|
|
2253
2336
|
key: "typeset",
|
|
2254
2337
|
label: h("editor.aiTypeset"),
|
|
2255
2338
|
disabled: _,
|
|
2256
2339
|
icon: /* @__PURE__ */ y("img", {
|
|
2257
|
-
src:
|
|
2340
|
+
src: da,
|
|
2258
2341
|
alt: "",
|
|
2259
|
-
width:
|
|
2260
|
-
height:
|
|
2342
|
+
width: pa,
|
|
2343
|
+
height: pa,
|
|
2261
2344
|
className: Q["bsy-lexical-ai__icon"],
|
|
2262
2345
|
draggable: !1
|
|
2263
2346
|
})
|
|
@@ -2266,40 +2349,40 @@ var Q = {
|
|
|
2266
2349
|
label: h("editor.aiPolish"),
|
|
2267
2350
|
disabled: x,
|
|
2268
2351
|
icon: /* @__PURE__ */ y("img", {
|
|
2269
|
-
src:
|
|
2352
|
+
src: fa,
|
|
2270
2353
|
alt: "",
|
|
2271
|
-
width:
|
|
2272
|
-
height:
|
|
2354
|
+
width: pa,
|
|
2355
|
+
height: pa,
|
|
2273
2356
|
className: Q["bsy-lexical-ai__icon"],
|
|
2274
2357
|
draggable: !1
|
|
2275
2358
|
}),
|
|
2276
|
-
children:
|
|
2359
|
+
children: qr.map((e) => ({
|
|
2277
2360
|
key: e,
|
|
2278
|
-
label: h(
|
|
2361
|
+
label: h(Jr[e])
|
|
2279
2362
|
}))
|
|
2280
2363
|
}], O = /* @__PURE__ */ y("div", {
|
|
2281
|
-
className:
|
|
2364
|
+
className: P(W["bsy-lexical__toolbar-select"], W["bsy-lexical__toolbar-select--ai"], Q["bsy-lexical-ai__trigger"]),
|
|
2282
2365
|
children: /* @__PURE__ */ y(q, {
|
|
2283
2366
|
tooltip: n,
|
|
2284
2367
|
showDisabledTooltip: r,
|
|
2285
2368
|
disabled: S,
|
|
2286
2369
|
icon: /* @__PURE__ */ b(v, { children: [
|
|
2287
2370
|
/* @__PURE__ */ y("img", {
|
|
2288
|
-
src:
|
|
2371
|
+
src: da,
|
|
2289
2372
|
alt: "",
|
|
2290
|
-
width:
|
|
2291
|
-
height:
|
|
2373
|
+
width: pa,
|
|
2374
|
+
height: pa,
|
|
2292
2375
|
className: Q["bsy-lexical-ai__icon"],
|
|
2293
2376
|
draggable: !1
|
|
2294
2377
|
}),
|
|
2295
2378
|
/* @__PURE__ */ y("span", {
|
|
2296
|
-
className:
|
|
2379
|
+
className: W["bsy-lexical__toolbar-select-label"],
|
|
2297
2380
|
children: h("editor.aiTypeset")
|
|
2298
2381
|
}),
|
|
2299
2382
|
/* @__PURE__ */ y(e, {
|
|
2300
2383
|
name: "arrow-down",
|
|
2301
2384
|
size: g,
|
|
2302
|
-
className:
|
|
2385
|
+
className: W["bsy-lexical__toolbar-select-arrow"]
|
|
2303
2386
|
})
|
|
2304
2387
|
] })
|
|
2305
2388
|
})
|
|
@@ -2308,51 +2391,51 @@ var Q = {
|
|
|
2308
2391
|
menus: D,
|
|
2309
2392
|
onClick: E,
|
|
2310
2393
|
showSearch: !1,
|
|
2311
|
-
offset:
|
|
2394
|
+
offset: H,
|
|
2312
2395
|
style: {
|
|
2313
2396
|
width: 147,
|
|
2314
2397
|
minWidth: 147
|
|
2315
2398
|
},
|
|
2316
2399
|
children: O
|
|
2317
2400
|
});
|
|
2318
|
-
},
|
|
2401
|
+
}, ha = /* @__PURE__ */ new Map(), ga = (e, t) => {
|
|
2319
2402
|
if (!e) throw Error("registerToolbarButton: name is required");
|
|
2320
|
-
|
|
2321
|
-
},
|
|
2322
|
-
|
|
2323
|
-
},
|
|
2403
|
+
ha.set(e, t);
|
|
2404
|
+
}, _a = (e) => {
|
|
2405
|
+
ha.delete(e);
|
|
2406
|
+
}, va = (e) => ha.get(e), ya = () => Array.from(ha.keys());
|
|
2324
2407
|
Object.entries({
|
|
2325
|
-
undo:
|
|
2326
|
-
redo:
|
|
2327
|
-
bold:
|
|
2328
|
-
underline:
|
|
2329
|
-
italic:
|
|
2330
|
-
strikethrough:
|
|
2331
|
-
superscript:
|
|
2332
|
-
subscript:
|
|
2333
|
-
heading:
|
|
2334
|
-
fontSize:
|
|
2335
|
-
fontColor:
|
|
2336
|
-
fill:
|
|
2337
|
-
clearFormat:
|
|
2338
|
-
bullet:
|
|
2339
|
-
number:
|
|
2340
|
-
outdent:
|
|
2341
|
-
indent:
|
|
2342
|
-
align:
|
|
2343
|
-
link:
|
|
2344
|
-
unLink:
|
|
2345
|
-
picture:
|
|
2346
|
-
code:
|
|
2347
|
-
table:
|
|
2348
|
-
source:
|
|
2349
|
-
ai:
|
|
2408
|
+
undo: Or,
|
|
2409
|
+
redo: kr,
|
|
2410
|
+
bold: Un,
|
|
2411
|
+
underline: Wn,
|
|
2412
|
+
italic: Gn,
|
|
2413
|
+
strikethrough: Ar,
|
|
2414
|
+
superscript: jr,
|
|
2415
|
+
subscript: Mr,
|
|
2416
|
+
heading: Wr,
|
|
2417
|
+
fontSize: Kn,
|
|
2418
|
+
fontColor: tr,
|
|
2419
|
+
fill: nr,
|
|
2420
|
+
clearFormat: Kr,
|
|
2421
|
+
bullet: Fr,
|
|
2422
|
+
number: Ir,
|
|
2423
|
+
outdent: Pr,
|
|
2424
|
+
indent: Nr,
|
|
2425
|
+
align: ir,
|
|
2426
|
+
link: or,
|
|
2427
|
+
unLink: sr,
|
|
2428
|
+
picture: Dr,
|
|
2429
|
+
code: Lr,
|
|
2430
|
+
table: Br,
|
|
2431
|
+
source: Ur,
|
|
2432
|
+
ai: ma
|
|
2350
2433
|
}).forEach(([e, t]) => {
|
|
2351
|
-
|
|
2434
|
+
ga(e, t);
|
|
2352
2435
|
});
|
|
2353
2436
|
//#endregion
|
|
2354
2437
|
//#region src/components/Editor/utils/getToolbarItems.ts
|
|
2355
|
-
var
|
|
2438
|
+
var ba = (e, t, n) => {
|
|
2356
2439
|
if (n) return [
|
|
2357
2440
|
{
|
|
2358
2441
|
kind: "button",
|
|
@@ -2410,44 +2493,44 @@ var ca = (e, t, n) => {
|
|
|
2410
2493
|
key: `divider-${t.key}`
|
|
2411
2494
|
});
|
|
2412
2495
|
}), r;
|
|
2413
|
-
},
|
|
2496
|
+
}, xa = Cn.map((e) => ({
|
|
2414
2497
|
key: e.id,
|
|
2415
2498
|
label: e.label
|
|
2416
|
-
})),
|
|
2417
|
-
let [t] =
|
|
2499
|
+
})), Sa = () => {
|
|
2500
|
+
let [t] = R(), { codeLanguage: n } = J(), { t: r } = a(), { iconSize: i } = K(), o = T((e) => {
|
|
2418
2501
|
let n = e.key;
|
|
2419
|
-
|
|
2420
|
-
let e =
|
|
2421
|
-
|
|
2502
|
+
G(t), t.update(() => {
|
|
2503
|
+
let e = I();
|
|
2504
|
+
L(e) && B(e.anchor.getNode(), z)?.setLanguage(n);
|
|
2422
2505
|
});
|
|
2423
2506
|
}, [t]), s = wn[n].label;
|
|
2424
2507
|
return /* @__PURE__ */ y(f, {
|
|
2425
|
-
menus:
|
|
2508
|
+
menus: xa,
|
|
2426
2509
|
onClick: o,
|
|
2427
2510
|
activeKey: [n],
|
|
2428
2511
|
showSearch: !1,
|
|
2429
|
-
offset:
|
|
2512
|
+
offset: H,
|
|
2430
2513
|
style: {
|
|
2431
2514
|
width: 120,
|
|
2432
2515
|
minWidth: 120
|
|
2433
2516
|
},
|
|
2434
2517
|
children: /* @__PURE__ */ y("div", {
|
|
2435
|
-
className:
|
|
2518
|
+
className: W["bsy-lexical__toolbar-select"],
|
|
2436
2519
|
style: { width: 120 },
|
|
2437
2520
|
children: /* @__PURE__ */ y(q, {
|
|
2438
2521
|
icon: /* @__PURE__ */ b(v, { children: [/* @__PURE__ */ y("span", {
|
|
2439
|
-
className:
|
|
2522
|
+
className: W["bsy-lexical__toolbar-select-label"],
|
|
2440
2523
|
children: s
|
|
2441
2524
|
}), /* @__PURE__ */ y(e, {
|
|
2442
2525
|
name: "arrow-down",
|
|
2443
2526
|
size: i,
|
|
2444
|
-
className:
|
|
2527
|
+
className: W["bsy-lexical__toolbar-select-arrow"]
|
|
2445
2528
|
})] }),
|
|
2446
2529
|
tooltip: r("editor.codeLanguage")
|
|
2447
2530
|
})
|
|
2448
2531
|
})
|
|
2449
2532
|
});
|
|
2450
|
-
},
|
|
2533
|
+
}, Ca = {
|
|
2451
2534
|
initial: {
|
|
2452
2535
|
opacity: 0,
|
|
2453
2536
|
x: 6
|
|
@@ -2460,28 +2543,28 @@ var ca = (e, t, n) => {
|
|
|
2460
2543
|
opacity: 0,
|
|
2461
2544
|
x: -6
|
|
2462
2545
|
}
|
|
2463
|
-
},
|
|
2464
|
-
if (e.kind === "divider") return /* @__PURE__ */ y("div", { className:
|
|
2465
|
-
if (e.kind === "language") return /* @__PURE__ */ y(
|
|
2466
|
-
let t =
|
|
2546
|
+
}, wa = (e) => {
|
|
2547
|
+
if (e.kind === "divider") return /* @__PURE__ */ y("div", { className: W["bsy-lexical__toolbar-divider"] });
|
|
2548
|
+
if (e.kind === "language") return /* @__PURE__ */ y(Sa, {});
|
|
2549
|
+
let t = va(e.name);
|
|
2467
2550
|
return t ? /* @__PURE__ */ y(t, { ...e.props }) : (console.warn(`[ToolbarPlugin] Button "${e.name}" is not registered.`), null);
|
|
2468
|
-
},
|
|
2469
|
-
let i =
|
|
2470
|
-
return i === null ? null : /* @__PURE__ */ y(
|
|
2551
|
+
}, Ta = C(function({ item: e, motionProps: t, transition: n }, r) {
|
|
2552
|
+
let i = wa(e);
|
|
2553
|
+
return i === null ? null : /* @__PURE__ */ y(se.div, {
|
|
2471
2554
|
ref: r,
|
|
2472
2555
|
"data-toolbar-item-key": e.key,
|
|
2473
|
-
className:
|
|
2556
|
+
className: P(W["bsy-lexical__toolbar-item"], e.kind === "button" && e.props?.disabled && W["bsy-lexical__toolbar-item--disabled"]),
|
|
2474
2557
|
layout: "position",
|
|
2475
2558
|
transition: n,
|
|
2476
2559
|
...t,
|
|
2477
2560
|
children: i
|
|
2478
2561
|
}, e.key);
|
|
2479
|
-
}),
|
|
2480
|
-
let { isCodeBlock: n } = J(), { isSourceMode: r } =
|
|
2562
|
+
}), Ea = ({ config: e, sizeToken: t }) => {
|
|
2563
|
+
let { isCodeBlock: n } = J(), { isSourceMode: r } = Hr(), i = ce(), o = A(() => ba(e, n, r), [
|
|
2481
2564
|
e,
|
|
2482
2565
|
n,
|
|
2483
2566
|
r
|
|
2484
|
-
]), s = o.map((e) => e.key).join("|"), { t: c } = a(), l =
|
|
2567
|
+
]), s = o.map((e) => e.key).join("|"), { t: c } = a(), l = j(null), u = j({}), d = j(null), f = j(!0), [p, m] = M({
|
|
2485
2568
|
keys: s,
|
|
2486
2569
|
count: o.length
|
|
2487
2570
|
});
|
|
@@ -2489,12 +2572,12 @@ var ca = (e, t, n) => {
|
|
|
2489
2572
|
keys: s,
|
|
2490
2573
|
count: o.length
|
|
2491
2574
|
});
|
|
2492
|
-
let h = p.keys === s ? p.count : o.length, g =
|
|
2575
|
+
let h = p.keys === s ? p.count : o.length, g = j(h);
|
|
2493
2576
|
g.current = h;
|
|
2494
|
-
let [_, v] =
|
|
2577
|
+
let [_, v] = M(!1), x = {
|
|
2495
2578
|
duration: i ? 0 : .16,
|
|
2496
2579
|
ease: "easeOut"
|
|
2497
|
-
}, S = i ? {} :
|
|
2580
|
+
}, S = i ? {} : Ca, C = T(() => {
|
|
2498
2581
|
let e = l.current;
|
|
2499
2582
|
if (!e || f.current && g.current !== o.length) return;
|
|
2500
2583
|
let t = getComputedStyle(e), n = Number.parseFloat(t.columnGap || t.gap) || 0, r = e.clientWidth, i = new Set(o.map((e) => e.key));
|
|
@@ -2513,13 +2596,13 @@ var ca = (e, t, n) => {
|
|
|
2513
2596
|
count: fn(c, r, a, n)
|
|
2514
2597
|
}));
|
|
2515
2598
|
}, [s, o]);
|
|
2516
|
-
|
|
2599
|
+
te(() => {
|
|
2517
2600
|
f.current = !0, u.current = {};
|
|
2518
2601
|
}, [
|
|
2519
2602
|
s,
|
|
2520
2603
|
o.length,
|
|
2521
2604
|
t
|
|
2522
|
-
]),
|
|
2605
|
+
]), te(() => {
|
|
2523
2606
|
C();
|
|
2524
2607
|
let e = l.current;
|
|
2525
2608
|
if (!e || typeof ResizeObserver > "u") return;
|
|
@@ -2530,48 +2613,48 @@ var ca = (e, t, n) => {
|
|
|
2530
2613
|
s,
|
|
2531
2614
|
t
|
|
2532
2615
|
]);
|
|
2533
|
-
let { visible: w, overflow: E } = pn(o, h), D = E.length > 0, O =
|
|
2616
|
+
let { visible: w, overflow: E } = pn(o, h), D = E.length > 0, O = j(E);
|
|
2534
2617
|
E.length > 0 && (O.current = E);
|
|
2535
|
-
let
|
|
2618
|
+
let ee = _ && D, k = D || _ && O.current.length > 0, N = D ? E : O.current;
|
|
2536
2619
|
return /* @__PURE__ */ b("div", {
|
|
2537
|
-
className:
|
|
2620
|
+
className: P(W["bsy-lexical__toolbar-stack"], i && W["bsy-lexical__toolbar-stack--instant"]),
|
|
2538
2621
|
children: [/* @__PURE__ */ b("div", {
|
|
2539
2622
|
ref: l,
|
|
2540
|
-
className:
|
|
2623
|
+
className: W["bsy-lexical__toolbar-items"],
|
|
2541
2624
|
children: [
|
|
2542
|
-
/* @__PURE__ */ y(
|
|
2625
|
+
/* @__PURE__ */ y(oe, {
|
|
2543
2626
|
initial: !1,
|
|
2544
2627
|
mode: "popLayout",
|
|
2545
|
-
children: w.map((e) => /* @__PURE__ */ y(
|
|
2628
|
+
children: w.map((e) => /* @__PURE__ */ y(Ta, {
|
|
2546
2629
|
item: e,
|
|
2547
2630
|
motionProps: S,
|
|
2548
2631
|
transition: x
|
|
2549
2632
|
}, e.key))
|
|
2550
2633
|
}),
|
|
2551
2634
|
D ? /* @__PURE__ */ b("div", {
|
|
2552
|
-
className:
|
|
2553
|
-
children: [/* @__PURE__ */ y("div", { className:
|
|
2554
|
-
icon:
|
|
2555
|
-
tooltip: c(
|
|
2556
|
-
highlight:
|
|
2635
|
+
className: P(W["bsy-lexical__toolbar-overflow"], W["bsy-lexical__toolbar-with-divider"]),
|
|
2636
|
+
children: [/* @__PURE__ */ y("div", { className: W["bsy-lexical__toolbar-divider"] }), /* @__PURE__ */ y(q, {
|
|
2637
|
+
icon: ee ? "packupeverything" : "expandall",
|
|
2638
|
+
tooltip: c(ee ? "editor.collapse" : "editor.expand"),
|
|
2639
|
+
highlight: ee,
|
|
2557
2640
|
onClick: () => v((e) => !e)
|
|
2558
2641
|
})]
|
|
2559
2642
|
}) : null,
|
|
2560
2643
|
/* @__PURE__ */ b("div", {
|
|
2561
2644
|
ref: d,
|
|
2562
|
-
className:
|
|
2645
|
+
className: P(W["bsy-lexical__toolbar-more-sizer"], W["bsy-lexical__toolbar-with-divider"]),
|
|
2563
2646
|
"aria-hidden": !0,
|
|
2564
|
-
children: [/* @__PURE__ */ y("div", { className:
|
|
2647
|
+
children: [/* @__PURE__ */ y("div", { className: W["bsy-lexical__toolbar-divider"] }), /* @__PURE__ */ y(q, {
|
|
2565
2648
|
icon: "expandall",
|
|
2566
2649
|
tooltip: ""
|
|
2567
2650
|
})]
|
|
2568
2651
|
})
|
|
2569
2652
|
]
|
|
2570
|
-
}),
|
|
2571
|
-
className:
|
|
2653
|
+
}), k ? /* @__PURE__ */ y("div", {
|
|
2654
|
+
className: P(W["bsy-lexical__toolbar-overflow-row"], ee && W["bsy-lexical__toolbar-overflow-row--open"], i && W["bsy-lexical__toolbar-overflow-row--instant"]),
|
|
2572
2655
|
children: /* @__PURE__ */ y("div", {
|
|
2573
|
-
className:
|
|
2574
|
-
children:
|
|
2656
|
+
className: W["bsy-lexical__toolbar-overflow-inner"],
|
|
2657
|
+
children: N.map((e) => /* @__PURE__ */ y(Ta, {
|
|
2575
2658
|
item: e,
|
|
2576
2659
|
motionProps: {},
|
|
2577
2660
|
transition: x
|
|
@@ -2579,11 +2662,11 @@ var ca = (e, t, n) => {
|
|
|
2579
2662
|
})
|
|
2580
2663
|
}) : null]
|
|
2581
2664
|
});
|
|
2582
|
-
},
|
|
2583
|
-
let { config: t = [], style: n, theme: r, mode: i, floating: a, stickyOffset: o, size: s =
|
|
2665
|
+
}, Da = (e) => {
|
|
2666
|
+
let { config: t = [], style: n, theme: r, mode: i, floating: a, stickyOffset: o, size: s = sn } = e, { toolbarRef: c } = mr(), l = i === "floating", u = o !== void 0, d = ce(), f = {
|
|
2584
2667
|
duration: d ? 0 : .16,
|
|
2585
2668
|
ease: "easeOut"
|
|
2586
|
-
}, p =
|
|
2669
|
+
}, p = A(() => ln(r, s), [r, s]), m = A(() => ({ iconSize: un(r?.iconSize, s) }), [r?.iconSize, s]), h = l ? dn(a) : void 0, _ = l ? g(n, [
|
|
2587
2670
|
"position",
|
|
2588
2671
|
"left",
|
|
2589
2672
|
"top",
|
|
@@ -2596,18 +2679,18 @@ var ca = (e, t, n) => {
|
|
|
2596
2679
|
]) : n;
|
|
2597
2680
|
return /* @__PURE__ */ y(Vn, {
|
|
2598
2681
|
value: m,
|
|
2599
|
-
children: /* @__PURE__ */ y(zn, { children: /* @__PURE__ */ y(In, { children: /* @__PURE__ */ y(
|
|
2682
|
+
children: /* @__PURE__ */ y(zn, { children: /* @__PURE__ */ y(In, { children: /* @__PURE__ */ y(se.div, {
|
|
2600
2683
|
ref: c,
|
|
2601
2684
|
layout: d || u ? !1 : "position",
|
|
2602
2685
|
transition: f,
|
|
2603
|
-
className:
|
|
2686
|
+
className: P(W["bsy-lexical__toolbar"], l && W["bsy-lexical__toolbar--floating"], u && W["bsy-lexical__toolbar--sticky"]),
|
|
2604
2687
|
style: {
|
|
2605
2688
|
...p,
|
|
2606
2689
|
...u ? { top: o } : null,
|
|
2607
2690
|
...h,
|
|
2608
2691
|
..._
|
|
2609
2692
|
},
|
|
2610
|
-
children: /* @__PURE__ */ y(
|
|
2693
|
+
children: /* @__PURE__ */ y(Ea, {
|
|
2611
2694
|
config: t,
|
|
2612
2695
|
sizeToken: `${s}|${r?.itemHeight ?? ""}|${r?.iconSize ?? ""}`
|
|
2613
2696
|
})
|
|
@@ -2623,12 +2706,12 @@ var ca = (e, t, n) => {
|
|
|
2623
2706
|
"bsy-lexical-editor__content-editable": "_bsy-lexical-editor__content-editable_1l05x_28",
|
|
2624
2707
|
"bsy-lexical-editor__length-badge": "_bsy-lexical-editor__length-badge_1l05x_41",
|
|
2625
2708
|
"bsy-lexical-editor__length-badge--exceeded": "_bsy-lexical-editor__length-badge--exceeded_1l05x_53"
|
|
2626
|
-
},
|
|
2709
|
+
}, Oa = (e) => {
|
|
2627
2710
|
if (!(e === void 0 || e === "")) return typeof e == "number" ? `${e}px` : e;
|
|
2628
|
-
},
|
|
2711
|
+
}, ka = (e) => {
|
|
2629
2712
|
let t = {};
|
|
2630
|
-
return e ? (s(t, "--bsy-editor-container-border-color", e.borderColor), s(t, "--bsy-editor-container-border-width",
|
|
2631
|
-
},
|
|
2713
|
+
return e ? (s(t, "--bsy-editor-container-border-color", e.borderColor), s(t, "--bsy-editor-container-border-width", Oa(e.borderWidth)), s(t, "--bsy-editor-container-border-radius", Oa(e.borderRadius)), t) : t;
|
|
2714
|
+
}, Aa = class e extends rt {
|
|
2632
2715
|
constructor(e, t) {
|
|
2633
2716
|
super(e, t);
|
|
2634
2717
|
}
|
|
@@ -2639,46 +2722,46 @@ var ca = (e, t, n) => {
|
|
|
2639
2722
|
return new e(t.__text, t.__key);
|
|
2640
2723
|
}
|
|
2641
2724
|
static importDOM() {
|
|
2642
|
-
let e =
|
|
2725
|
+
let e = rt.importDOM();
|
|
2643
2726
|
return {
|
|
2644
2727
|
...e,
|
|
2645
2728
|
code: () => ({
|
|
2646
|
-
conversion:
|
|
2729
|
+
conversion: Ma(e?.code),
|
|
2647
2730
|
priority: 1
|
|
2648
2731
|
}),
|
|
2649
2732
|
em: () => ({
|
|
2650
|
-
conversion:
|
|
2733
|
+
conversion: Ma(e?.em),
|
|
2651
2734
|
priority: 1
|
|
2652
2735
|
}),
|
|
2653
2736
|
span: () => ({
|
|
2654
|
-
conversion:
|
|
2737
|
+
conversion: Ma(e?.span),
|
|
2655
2738
|
priority: 1
|
|
2656
2739
|
}),
|
|
2657
2740
|
strong: () => ({
|
|
2658
|
-
conversion:
|
|
2741
|
+
conversion: Ma(e?.strong),
|
|
2659
2742
|
priority: 1
|
|
2660
2743
|
}),
|
|
2661
2744
|
sub: () => ({
|
|
2662
|
-
conversion:
|
|
2745
|
+
conversion: Ma(e?.sub),
|
|
2663
2746
|
priority: 1
|
|
2664
2747
|
}),
|
|
2665
2748
|
sup: () => ({
|
|
2666
|
-
conversion:
|
|
2749
|
+
conversion: Ma(e?.sup),
|
|
2667
2750
|
priority: 1
|
|
2668
2751
|
})
|
|
2669
2752
|
};
|
|
2670
2753
|
}
|
|
2671
2754
|
static importJSON(e) {
|
|
2672
|
-
return
|
|
2755
|
+
return ja().updateFromJSON(e);
|
|
2673
2756
|
}
|
|
2674
2757
|
isSimpleText() {
|
|
2675
2758
|
return this.__type === "extended-text" && this.__mode === 0;
|
|
2676
2759
|
}
|
|
2677
2760
|
};
|
|
2678
|
-
function
|
|
2679
|
-
return
|
|
2761
|
+
function ja(e = "") {
|
|
2762
|
+
return ve(new Aa(e));
|
|
2680
2763
|
}
|
|
2681
|
-
function
|
|
2764
|
+
function Ma(e) {
|
|
2682
2765
|
return (t) => {
|
|
2683
2766
|
let n = e?.(t);
|
|
2684
2767
|
if (!n) return null;
|
|
@@ -2689,7 +2772,7 @@ function ba(e) {
|
|
|
2689
2772
|
...r,
|
|
2690
2773
|
forChild: (e, t) => {
|
|
2691
2774
|
let n = (r?.forChild ?? ((e) => e))(e, t);
|
|
2692
|
-
if (
|
|
2775
|
+
if (je(n)) {
|
|
2693
2776
|
let e = [
|
|
2694
2777
|
i ? `background-color: ${i}` : null,
|
|
2695
2778
|
a ? `color: ${a}` : null,
|
|
@@ -2707,81 +2790,81 @@ function ba(e) {
|
|
|
2707
2790
|
}
|
|
2708
2791
|
//#endregion
|
|
2709
2792
|
//#region src/components/Editor/utils/stripInlineStyleProperty.ts
|
|
2710
|
-
function
|
|
2793
|
+
function Na(e, t) {
|
|
2711
2794
|
return e.split(";").map((e) => e.trim()).filter((e) => e && e.split(":")[0].trim().toLowerCase() !== t).join("; ");
|
|
2712
2795
|
}
|
|
2713
2796
|
//#endregion
|
|
2714
2797
|
//#region src/components/Editor/plugins/LinkColorPlugin.tsx
|
|
2715
|
-
function
|
|
2716
|
-
if (!
|
|
2798
|
+
function Pa(e) {
|
|
2799
|
+
if (!B(e, ut)) return;
|
|
2717
2800
|
let t = e.getStyle();
|
|
2718
2801
|
if (!t) return;
|
|
2719
|
-
let n =
|
|
2802
|
+
let n = Na(t, "color");
|
|
2720
2803
|
n !== t && e.setStyle(n);
|
|
2721
2804
|
}
|
|
2722
|
-
function
|
|
2723
|
-
let [e] =
|
|
2724
|
-
return O(() => e.registerNodeTransform(
|
|
2805
|
+
function Fa() {
|
|
2806
|
+
let [e] = R();
|
|
2807
|
+
return O(() => e.registerNodeTransform(Aa, Pa), [e]), null;
|
|
2725
2808
|
}
|
|
2726
2809
|
//#endregion
|
|
2727
2810
|
//#region src/components/Editor/plugins/ImagePlugin.tsx
|
|
2728
|
-
function
|
|
2729
|
-
let [e] =
|
|
2730
|
-
return O(() => e.registerCommand(
|
|
2811
|
+
function Ia() {
|
|
2812
|
+
let [e] = R();
|
|
2813
|
+
return O(() => e.registerCommand(Er, (e) => (Ee([rn(e)]), !0), Be), [e]), null;
|
|
2731
2814
|
}
|
|
2732
2815
|
//#endregion
|
|
2733
2816
|
//#region src/components/Editor/utils/stripImagesFromHtml.ts
|
|
2734
|
-
function
|
|
2817
|
+
function La(e) {
|
|
2735
2818
|
let t = new DOMParser().parseFromString(e, "text/html");
|
|
2736
2819
|
return t.querySelectorAll("img, picture").forEach((e) => e.remove()), t.body.innerHTML;
|
|
2737
2820
|
}
|
|
2738
2821
|
//#endregion
|
|
2739
2822
|
//#region src/components/Editor/plugins/PasteStripImagePlugin.tsx
|
|
2740
|
-
var
|
|
2741
|
-
function
|
|
2742
|
-
let [e] =
|
|
2823
|
+
var Ra = /<img\b|<picture\b/i;
|
|
2824
|
+
function za() {
|
|
2825
|
+
let [e] = R(), { isSourceModeRef: t } = Hr();
|
|
2743
2826
|
return O(() => {
|
|
2744
2827
|
let n = (n) => {
|
|
2745
2828
|
if (t.current) return !1;
|
|
2746
2829
|
let r = "clipboardData" in n ? n.clipboardData : "dataTransfer" in n ? n.dataTransfer : null;
|
|
2747
2830
|
if (!r || r.getData("application/x-lexical-editor") || r.getData("application/x-lexical-drag")) return !1;
|
|
2748
2831
|
let i = r.getData("text/html");
|
|
2749
|
-
if (!(Array.from(r.files).some((e) => e.type.startsWith("image/")) || Array.from(r.items).some((e) => e.type.startsWith("image/")) ||
|
|
2832
|
+
if (!(Array.from(r.files).some((e) => e.type.startsWith("image/")) || Array.from(r.items).some((e) => e.type.startsWith("image/")) || Ra.test(i))) return !1;
|
|
2750
2833
|
n.preventDefault();
|
|
2751
2834
|
let a = r.getData("text/plain");
|
|
2752
|
-
return !
|
|
2753
|
-
let t =
|
|
2835
|
+
return !Ra.test(i) && !a || e.update(() => {
|
|
2836
|
+
let t = I();
|
|
2754
2837
|
if (t === null) return;
|
|
2755
|
-
let n = i ?
|
|
2838
|
+
let n = i ? La(i) : "", r = document.createElement("div");
|
|
2756
2839
|
if (r.innerHTML = n, n && r.textContent?.trim()) {
|
|
2757
|
-
let t =
|
|
2840
|
+
let t = _e(e, new DOMParser().parseFromString(n, "text/html"));
|
|
2758
2841
|
if (t.length) {
|
|
2759
|
-
|
|
2842
|
+
Ee(t);
|
|
2760
2843
|
return;
|
|
2761
2844
|
}
|
|
2762
2845
|
}
|
|
2763
2846
|
a && t.insertRawText(a);
|
|
2764
|
-
}, { tag:
|
|
2847
|
+
}, { tag: et }), !0;
|
|
2765
2848
|
};
|
|
2766
|
-
return
|
|
2849
|
+
return Xt(e.registerCommand($e, (e) => n(e), Ve), e.registerCommand(Ue, (e) => n(e), Ve));
|
|
2767
2850
|
}, [e, t]), null;
|
|
2768
2851
|
}
|
|
2769
2852
|
//#endregion
|
|
2770
2853
|
//#region src/components/Editor/plugins/EnterKeyPlugin.tsx
|
|
2771
|
-
function
|
|
2772
|
-
let [e] =
|
|
2773
|
-
return O(() => e.registerCommand(
|
|
2854
|
+
function Ba() {
|
|
2855
|
+
let [e] = R(), t = j(0);
|
|
2856
|
+
return O(() => e.registerCommand(Xe, (n) => {
|
|
2774
2857
|
let r = Date.now(), i = r - t.current;
|
|
2775
2858
|
return t.current = r, i < 250 && i > 0 ? e.getEditorState().read(() => {
|
|
2776
|
-
let e =
|
|
2777
|
-
return
|
|
2859
|
+
let e = I();
|
|
2860
|
+
return L(e) ? !!B(e.anchor.getNode(), (e) => ht(e) || z(e) || Pt(e)) : !1;
|
|
2778
2861
|
}, { editor: e }) ? !1 : (e.update(() => {
|
|
2779
|
-
let e =
|
|
2780
|
-
if (
|
|
2862
|
+
let e = I();
|
|
2863
|
+
if (L(e)) {
|
|
2781
2864
|
let t = e.anchor.getNode().getTopLevelElement();
|
|
2782
2865
|
if (t && t.getTextContent().trim() === "") {
|
|
2783
|
-
let n =
|
|
2784
|
-
|
|
2866
|
+
let n = be();
|
|
2867
|
+
At(e, {
|
|
2785
2868
|
"background-color": "",
|
|
2786
2869
|
color: "",
|
|
2787
2870
|
"font-size": "",
|
|
@@ -2794,11 +2877,11 @@ function Oa() {
|
|
|
2794
2877
|
}
|
|
2795
2878
|
}
|
|
2796
2879
|
}), n?.preventDefault(), !0) : !1;
|
|
2797
|
-
},
|
|
2880
|
+
}, He), [e]), null;
|
|
2798
2881
|
}
|
|
2799
2882
|
//#endregion
|
|
2800
2883
|
//#region src/components/Editor/utils/codeHighlighter.ts
|
|
2801
|
-
var
|
|
2884
|
+
var Va = {
|
|
2802
2885
|
css: () => import("@shikijs/langs/css"),
|
|
2803
2886
|
html: () => import("@shikijs/langs/html"),
|
|
2804
2887
|
xml: () => import("@shikijs/langs/xml"),
|
|
@@ -2819,70 +2902,70 @@ var ka = {
|
|
|
2819
2902
|
bash: () => import("@shikijs/langs/shellscript"),
|
|
2820
2903
|
lua: () => import("@shikijs/langs/lua"),
|
|
2821
2904
|
markdown: () => import("@shikijs/langs/markdown")
|
|
2822
|
-
},
|
|
2905
|
+
}, Ha = (e) => e === "bash" ? "shellscript" : e, Ua = (e) => e in Va, Wa = null, Ga = null, Ka = /* @__PURE__ */ new Map(), qa = () => (Wa ||= Promise.all([import("@shikijs/core"), import("@shikijs/engine-javascript")]).then(([{ createHighlighterCoreSync: e }, { createJavaScriptRegexEngine: t }]) => e({
|
|
2823
2906
|
engine: t(),
|
|
2824
2907
|
langs: [],
|
|
2825
2908
|
themes: []
|
|
2826
2909
|
})).catch((e) => {
|
|
2827
|
-
throw
|
|
2828
|
-
}),
|
|
2829
|
-
let t =
|
|
2830
|
-
return t || (t =
|
|
2831
|
-
let n =
|
|
2910
|
+
throw Wa = null, e;
|
|
2911
|
+
}), Wa), Ja = (e, t) => Ua(t) && e.getLoadedLanguages().includes(Ha(t)), Ya = (e) => {
|
|
2912
|
+
let t = Ka.get(e);
|
|
2913
|
+
return t || (t = qa().then(async (t) => {
|
|
2914
|
+
let n = Ha(e);
|
|
2832
2915
|
if (!t.getLoadedLanguages().includes(n)) {
|
|
2833
|
-
let n = await
|
|
2916
|
+
let n = await Va[e]();
|
|
2834
2917
|
await t.loadLanguage(n.default);
|
|
2835
2918
|
}
|
|
2836
2919
|
return t;
|
|
2837
2920
|
}).catch((t) => {
|
|
2838
|
-
throw
|
|
2839
|
-
}),
|
|
2840
|
-
},
|
|
2921
|
+
throw Ka.delete(e), t;
|
|
2922
|
+
}), Ka.set(e, t)), t;
|
|
2923
|
+
}, Xa = () => (Ga ||= qa().then(async (e) => {
|
|
2841
2924
|
if (!e.getLoadedThemes().includes("github-light")) {
|
|
2842
2925
|
let t = await import("@shikijs/themes/github-light");
|
|
2843
2926
|
await e.loadTheme(t.default);
|
|
2844
2927
|
}
|
|
2845
2928
|
return e;
|
|
2846
2929
|
}).catch((e) => {
|
|
2847
|
-
throw
|
|
2848
|
-
}),
|
|
2930
|
+
throw Ga = null, e;
|
|
2931
|
+
}), Ga), Za = (e, t, n) => {
|
|
2849
2932
|
let r = e.getTextContent();
|
|
2850
|
-
if (e.getStyle() && e.setStyle(""), !n || !
|
|
2851
|
-
let i =
|
|
2933
|
+
if (e.getStyle() && e.setStyle(""), !n || !Ja(n, t)) return Tt(r);
|
|
2934
|
+
let i = Ha(t), a = n.codeToTokens(r, {
|
|
2852
2935
|
lang: i,
|
|
2853
2936
|
theme: Sn
|
|
2854
2937
|
}), o = [];
|
|
2855
2938
|
return a.tokens.forEach((e, t) => {
|
|
2856
|
-
t && o.push(
|
|
2939
|
+
t && o.push(ye()), e.forEach((e) => {
|
|
2857
2940
|
e.content.split(" ").forEach((t, n) => {
|
|
2858
|
-
if (n && o.push(
|
|
2859
|
-
let r =
|
|
2941
|
+
if (n && o.push(xe()), t === "") return;
|
|
2942
|
+
let r = St(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}` : "";
|
|
2860
2943
|
i && r.setStyle(i), o.push(r);
|
|
2861
2944
|
});
|
|
2862
2945
|
});
|
|
2863
2946
|
}), o;
|
|
2864
|
-
},
|
|
2865
|
-
let n =
|
|
2866
|
-
if (!
|
|
2867
|
-
let r =
|
|
2868
|
-
if (!
|
|
2947
|
+
}, Qa = (e, t) => {
|
|
2948
|
+
let n = we(e);
|
|
2949
|
+
if (!z(n) || !n.isAttached()) return;
|
|
2950
|
+
let r = I();
|
|
2951
|
+
if (!L(r)) {
|
|
2869
2952
|
t();
|
|
2870
2953
|
return;
|
|
2871
2954
|
}
|
|
2872
2955
|
let { anchor: i } = r;
|
|
2873
|
-
if (
|
|
2956
|
+
if (B(i.getNode(), z) !== n) {
|
|
2874
2957
|
t();
|
|
2875
2958
|
return;
|
|
2876
2959
|
}
|
|
2877
|
-
let a = i.offset, o = i.type === "element" &&
|
|
2960
|
+
let a = i.offset, o = i.type === "element" && Oe(n.getChildAtIndex(i.offset - 1)), s = 0;
|
|
2878
2961
|
if (o || (s = a + i.getNode().getPreviousSiblings().reduce((e, t) => e + t.getTextContentSize(), 0)), t()) {
|
|
2879
2962
|
if (o) {
|
|
2880
2963
|
i.getNode().select(a, a);
|
|
2881
2964
|
return;
|
|
2882
2965
|
}
|
|
2883
2966
|
n.getChildren().some((e) => {
|
|
2884
|
-
let t =
|
|
2885
|
-
if (t ||
|
|
2967
|
+
let t = je(e);
|
|
2968
|
+
if (t || Oe(e)) {
|
|
2886
2969
|
let n = e.getTextContentSize();
|
|
2887
2970
|
if (t && n >= s) return e.select(s, s), !0;
|
|
2888
2971
|
s -= n;
|
|
@@ -2890,11 +2973,11 @@ var ka = {
|
|
|
2890
2973
|
return !1;
|
|
2891
2974
|
});
|
|
2892
2975
|
}
|
|
2893
|
-
},
|
|
2976
|
+
}, $a = (e, t) => wt(e) && wt(t) && e.__text === t.__text && e.__highlightType === t.__highlightType && e.__style === t.__style || Ae(e) && Ae(t) || Oe(e) && Oe(t), eo = (e, t) => {
|
|
2894
2977
|
let n = 0;
|
|
2895
|
-
for (; n < e.length &&
|
|
2978
|
+
for (; n < e.length && $a(e[n], t[n]);) n++;
|
|
2896
2979
|
let r = e.length, i = t.length, a = Math.min(r, i) - n, o = 0;
|
|
2897
|
-
for (; o < a;) if (o++,
|
|
2980
|
+
for (; o < a;) if (o++, !$a(e[r - o], t[i - o])) {
|
|
2898
2981
|
o--;
|
|
2899
2982
|
break;
|
|
2900
2983
|
}
|
|
@@ -2903,21 +2986,21 @@ var ka = {
|
|
|
2903
2986
|
to: r - o,
|
|
2904
2987
|
nodesForReplacement: t.slice(n, i - o)
|
|
2905
2988
|
};
|
|
2906
|
-
},
|
|
2989
|
+
}, to = (e, t, n, r, i) => {
|
|
2907
2990
|
let a = i.getKey(), o = Tn(i.getLanguage());
|
|
2908
2991
|
if (i.getLanguage() !== o && i.setLanguage(o), o === "plaintext") i.getIsSyntaxHighlightSupported() && i.setIsSyntaxHighlightSupported(!1);
|
|
2909
2992
|
else {
|
|
2910
2993
|
i.getTheme() !== "github-light" && i.setTheme(Sn);
|
|
2911
|
-
let s = t ? t.getLoadedThemes().includes("github-light") ?
|
|
2994
|
+
let s = t ? t.getLoadedThemes().includes("github-light") ? Ua(o) && !Ja(t, o) ? Ya(o) : null : Xa() : qa();
|
|
2912
2995
|
if (s) {
|
|
2913
2996
|
i.getIsSyntaxHighlightSupported() && i.setIsSyntaxHighlightSupported(!1), n.pendingKeys.add(a), n.loading !== s && (n.loading = s, s.then((t) => {
|
|
2914
2997
|
r(t);
|
|
2915
2998
|
let i = [...n.pendingKeys];
|
|
2916
2999
|
n.pendingKeys.clear(), n.loading = null, e.update(() => {
|
|
2917
3000
|
i.forEach((e) => {
|
|
2918
|
-
|
|
3001
|
+
we(e)?.markDirty();
|
|
2919
3002
|
});
|
|
2920
|
-
}, { tag:
|
|
3003
|
+
}, { tag: Je });
|
|
2921
3004
|
}, () => {
|
|
2922
3005
|
n.pendingKeys.clear(), n.loading = null;
|
|
2923
3006
|
}));
|
|
@@ -2925,22 +3008,22 @@ var ka = {
|
|
|
2925
3008
|
}
|
|
2926
3009
|
i.getIsSyntaxHighlightSupported() || i.setIsSyntaxHighlightSupported(!0);
|
|
2927
3010
|
}
|
|
2928
|
-
n.nodesCurrentlyHighlighting.has(a) || (n.nodesCurrentlyHighlighting.add(a), n.didTransform || (n.didTransform = !0,
|
|
3011
|
+
n.nodesCurrentlyHighlighting.has(a) || (n.nodesCurrentlyHighlighting.add(a), n.didTransform || (n.didTransform = !0, Ne(() => {
|
|
2929
3012
|
n.didTransform = !1, n.nodesCurrentlyHighlighting.clear();
|
|
2930
|
-
})),
|
|
2931
|
-
let e =
|
|
2932
|
-
if (!
|
|
2933
|
-
let n =
|
|
3013
|
+
})), Qa(a, () => {
|
|
3014
|
+
let e = we(a);
|
|
3015
|
+
if (!z(e) || !e.isAttached()) return !1;
|
|
3016
|
+
let n = Za(e, Tn(e.getLanguage()), t), { from: r, to: i, nodesForReplacement: o } = eo(e.getChildren(), n);
|
|
2934
3017
|
return r !== i || o.length ? (e.splice(r, i - r, o), !0) : !1;
|
|
2935
3018
|
}));
|
|
2936
|
-
},
|
|
3019
|
+
}, no = (e, t, n, r, i) => {
|
|
2937
3020
|
let a = i.getParent();
|
|
2938
|
-
|
|
3021
|
+
z(a) ? to(e, t, n, r, a) : wt(i) && i.replace(Se(i.__text));
|
|
2939
3022
|
};
|
|
2940
|
-
function
|
|
2941
|
-
let [e] =
|
|
3023
|
+
function ro() {
|
|
3024
|
+
let [e] = R();
|
|
2942
3025
|
return O(() => {
|
|
2943
|
-
if (!e.hasNodes([
|
|
3026
|
+
if (!e.hasNodes([Dt, Et])) throw Error("CodeHighlightPlugin: CodeNode or CodeHighlightNode not registered on editor");
|
|
2944
3027
|
let t = null, n = {
|
|
2945
3028
|
didTransform: !1,
|
|
2946
3029
|
nodesCurrentlyHighlighting: /* @__PURE__ */ new Set(),
|
|
@@ -2949,16 +3032,16 @@ function Ga() {
|
|
|
2949
3032
|
}, r = (e) => {
|
|
2950
3033
|
t = e;
|
|
2951
3034
|
}, i = (e) => {
|
|
2952
|
-
let t =
|
|
2953
|
-
if (!
|
|
3035
|
+
let t = we(e);
|
|
3036
|
+
if (!z(t)) return;
|
|
2954
3037
|
let n = t.getChildrenSize();
|
|
2955
3038
|
n === 0 ? t.selectStart() : t.select(0, n);
|
|
2956
3039
|
}, a = (t) => {
|
|
2957
3040
|
if (!(t instanceof Node) || !e.getRootElement()?.contains(t)) return null;
|
|
2958
3041
|
let n = null;
|
|
2959
3042
|
return e.getEditorState().read(() => {
|
|
2960
|
-
let e =
|
|
2961
|
-
|
|
3043
|
+
let e = Ce(t), r = e ? B(e, z) : null;
|
|
3044
|
+
z(r) && (n = r.getKey());
|
|
2962
3045
|
}, { editor: e }), n;
|
|
2963
3046
|
}, o = null, s = (t, n, r) => {
|
|
2964
3047
|
t.preventDefault(), r && (o = n), e.update(() => {
|
|
@@ -2980,12 +3063,12 @@ function Ga() {
|
|
|
2980
3063
|
}, d = (e, t) => {
|
|
2981
3064
|
t?.removeEventListener("mousedown", c, !0), t?.removeEventListener("mouseup", u, !0), t?.removeEventListener("dblclick", l, !0), e?.addEventListener("mousedown", c, !0), e?.addEventListener("mouseup", u, !0), e?.addEventListener("dblclick", l, !0);
|
|
2982
3065
|
};
|
|
2983
|
-
return
|
|
2984
|
-
|
|
2985
|
-
}), e.registerNodeTransform(
|
|
2986
|
-
|
|
2987
|
-
}), e.registerNodeTransform(
|
|
2988
|
-
|
|
3066
|
+
return st(Ot(e), e.registerNodeTransform(Dt, (i) => {
|
|
3067
|
+
to(e, t, n, r, i);
|
|
3068
|
+
}), e.registerNodeTransform(rt, (i) => {
|
|
3069
|
+
no(e, t, n, r, i);
|
|
3070
|
+
}), e.registerNodeTransform(Et, (i) => {
|
|
3071
|
+
no(e, t, n, r, i);
|
|
2989
3072
|
}), e.registerRootListener(d), () => {
|
|
2990
3073
|
d(null, e.getRootElement());
|
|
2991
3074
|
});
|
|
@@ -2993,23 +3076,23 @@ function Ga() {
|
|
|
2993
3076
|
}
|
|
2994
3077
|
//#endregion
|
|
2995
3078
|
//#region src/components/Editor/plugins/TablePlugin.tsx
|
|
2996
|
-
function
|
|
2997
|
-
let [e] =
|
|
2998
|
-
return O(() => (
|
|
3079
|
+
function io() {
|
|
3080
|
+
let [e] = R();
|
|
3081
|
+
return O(() => (Gt(e, !0), Xt(Ut(e), Wt(e, !1), Ht(e), e.registerNodeTransform(zt, (e) => {
|
|
2999
3082
|
e.getBackgroundColor() !== null && e.setBackgroundColor(null);
|
|
3000
|
-
}), e.registerCommand(
|
|
3001
|
-
let t =
|
|
3002
|
-
if (!
|
|
3003
|
-
let n =
|
|
3083
|
+
}), e.registerCommand(Ze, (e) => {
|
|
3084
|
+
let t = I();
|
|
3085
|
+
if (!L(t) || !t.isCollapsed()) return !1;
|
|
3086
|
+
let n = Nt(t.anchor.getNode());
|
|
3004
3087
|
if (n === null) return !1;
|
|
3005
3088
|
let r = e.shiftKey ? "previous" : "next", i = r === "next" ? "getNextSibling" : "getPreviousSibling", a = r === "next" ? "getFirstChild" : "getLastChild", o = n[i](), s = null;
|
|
3006
|
-
if (
|
|
3089
|
+
if (Pt(o)) s = o;
|
|
3007
3090
|
else {
|
|
3008
|
-
let e =
|
|
3091
|
+
let e = B(n, It);
|
|
3009
3092
|
if (e !== null) for (let t = e[i](); t !== null; t = t[i]()) {
|
|
3010
|
-
if (!
|
|
3093
|
+
if (!It(t)) continue;
|
|
3011
3094
|
let e = t[a]();
|
|
3012
|
-
if (
|
|
3095
|
+
if (Pt(e)) {
|
|
3013
3096
|
s = e;
|
|
3014
3097
|
break;
|
|
3015
3098
|
}
|
|
@@ -3019,60 +3102,60 @@ function Ka() {
|
|
|
3019
3102
|
let e = s.getFirstDescendant();
|
|
3020
3103
|
e ? e.selectStart() : s.selectStart();
|
|
3021
3104
|
} else {
|
|
3022
|
-
let e =
|
|
3105
|
+
let e = B(n, Ft);
|
|
3023
3106
|
e && (r === "next" ? e.selectNext() : e.selectPrevious());
|
|
3024
3107
|
}
|
|
3025
3108
|
return !0;
|
|
3026
|
-
},
|
|
3109
|
+
}, Ve))), [e]), null;
|
|
3027
3110
|
}
|
|
3028
3111
|
//#endregion
|
|
3029
3112
|
//#region src/components/Editor/plugins/TabIndentPlugin.tsx
|
|
3030
|
-
var
|
|
3031
|
-
function
|
|
3032
|
-
let [e] =
|
|
3033
|
-
return O(() => e.registerCommand(
|
|
3113
|
+
var ao = "\xA0".repeat(4);
|
|
3114
|
+
function oo() {
|
|
3115
|
+
let [e] = R();
|
|
3116
|
+
return O(() => e.registerCommand(Ze, (t) => {
|
|
3034
3117
|
if (t.shiftKey) return !1;
|
|
3035
|
-
let n =
|
|
3036
|
-
if (!
|
|
3118
|
+
let n = I();
|
|
3119
|
+
if (!L(n)) return !1;
|
|
3037
3120
|
let r = n.anchor.getNode();
|
|
3038
|
-
if (
|
|
3121
|
+
if (Nt(r) !== null || B(r, z)) return !1;
|
|
3039
3122
|
t.preventDefault();
|
|
3040
|
-
let i =
|
|
3041
|
-
if (
|
|
3123
|
+
let i = B(r, ht);
|
|
3124
|
+
if (ht(i)) {
|
|
3042
3125
|
let e = new Set([i]);
|
|
3043
3126
|
for (let t of n.getNodes()) {
|
|
3044
|
-
let n =
|
|
3045
|
-
|
|
3127
|
+
let n = B(t, ht);
|
|
3128
|
+
ht(n) && e.add(n);
|
|
3046
3129
|
}
|
|
3047
3130
|
for (let t of e) t.setIndent(t.getIndent() + 1);
|
|
3048
3131
|
return !0;
|
|
3049
3132
|
}
|
|
3050
3133
|
let a = r.getTopLevelElement(), o = n.focus.getNode().getTopLevelElement();
|
|
3051
|
-
return !n.isCollapsed() && a && o && a !== o ? e.dispatchCommand(
|
|
3052
|
-
},
|
|
3134
|
+
return !n.isCollapsed() && a && o && a !== o ? e.dispatchCommand(Ye, void 0) : (n.insertText(ao), !0);
|
|
3135
|
+
}, Be), [e]), null;
|
|
3053
3136
|
}
|
|
3054
3137
|
//#endregion
|
|
3055
3138
|
//#region src/components/Editor/plugins/MaxLengthPlugin.tsx
|
|
3056
|
-
function
|
|
3057
|
-
let [n] =
|
|
3139
|
+
function so({ maxLength: e, onMaxLengthExceed: t }) {
|
|
3140
|
+
let [n] = R(), { isSourceModeRef: r } = Hr(), i = j(t);
|
|
3058
3141
|
return i.current = t, O(() => {
|
|
3059
3142
|
let t = null;
|
|
3060
|
-
return n.registerNodeTransform(
|
|
3143
|
+
return n.registerNodeTransform(nt, (a) => {
|
|
3061
3144
|
if (r.current) return;
|
|
3062
3145
|
let o = a.getTextContentSize();
|
|
3063
3146
|
if (o <= e) return;
|
|
3064
|
-
let s = n.getEditorState(), c = s.read(() => a.getTextContentSize()), l = o - e, u =
|
|
3147
|
+
let s = n.getEditorState(), c = s.read(() => a.getTextContentSize()), l = o - e, u = I();
|
|
3065
3148
|
if (c === e && t !== s) {
|
|
3066
|
-
t = s,
|
|
3149
|
+
t = s, Yt(n, s), i.current?.();
|
|
3067
3150
|
return;
|
|
3068
3151
|
}
|
|
3069
|
-
if (
|
|
3070
|
-
|
|
3152
|
+
if (L(u) && u.isCollapsed()) {
|
|
3153
|
+
Mt(n, u.anchor, l), i.current?.();
|
|
3071
3154
|
return;
|
|
3072
3155
|
}
|
|
3073
3156
|
a.selectEnd();
|
|
3074
|
-
let d =
|
|
3075
|
-
|
|
3157
|
+
let d = I();
|
|
3158
|
+
L(d) && (Mt(n, d.anchor, l), i.current?.());
|
|
3076
3159
|
});
|
|
3077
3160
|
}, [
|
|
3078
3161
|
n,
|
|
@@ -3082,19 +3165,19 @@ function Ya({ maxLength: e, onMaxLengthExceed: t }) {
|
|
|
3082
3165
|
}
|
|
3083
3166
|
//#endregion
|
|
3084
3167
|
//#region src/components/Editor/utils/textLength.ts
|
|
3085
|
-
function
|
|
3168
|
+
function co(e) {
|
|
3086
3169
|
return typeof e == "number" && Number.isFinite(e) && e > 0;
|
|
3087
3170
|
}
|
|
3088
|
-
function
|
|
3089
|
-
let n =
|
|
3171
|
+
function lo(e, t) {
|
|
3172
|
+
let n = F(), r = n.getTextContentSize();
|
|
3090
3173
|
if (r <= t) return !1;
|
|
3091
3174
|
let i = r - t;
|
|
3092
3175
|
n.selectEnd();
|
|
3093
|
-
let a =
|
|
3094
|
-
return
|
|
3176
|
+
let a = I();
|
|
3177
|
+
return L(a) ? Mt(e, a.anchor, i) : uo(i), !0;
|
|
3095
3178
|
}
|
|
3096
|
-
function
|
|
3097
|
-
let t = e, n =
|
|
3179
|
+
function uo(e) {
|
|
3180
|
+
let t = e, n = F().getAllTextNodes();
|
|
3098
3181
|
for (let e = n.length - 1; e >= 0 && t > 0; e--) {
|
|
3099
3182
|
let r = n[e], i = r.getTextContent();
|
|
3100
3183
|
i.length !== 0 && (i.length <= t ? (t -= i.length, r.remove()) : (r.setTextContent(i.slice(0, i.length - t)), t = 0));
|
|
@@ -3102,7 +3185,7 @@ function Qa(e) {
|
|
|
3102
3185
|
}
|
|
3103
3186
|
//#endregion
|
|
3104
3187
|
//#region src/components/Editor/utils/formatEditorHtml.ts
|
|
3105
|
-
var
|
|
3188
|
+
var fo = new Set([
|
|
3106
3189
|
"area",
|
|
3107
3190
|
"base",
|
|
3108
3191
|
"br",
|
|
@@ -3117,65 +3200,65 @@ var $a = new Set([
|
|
|
3117
3200
|
"source",
|
|
3118
3201
|
"track",
|
|
3119
3202
|
"wbr"
|
|
3120
|
-
]),
|
|
3121
|
-
let r = e.tagName.toLowerCase(), i = `<${r}${
|
|
3122
|
-
if (
|
|
3123
|
-
let a = n || r === "pre", o =
|
|
3124
|
-
return a || !
|
|
3125
|
-
},
|
|
3203
|
+
]), po = new Set(/* @__PURE__ */ "address.article.aside.blockquote.div.dl.dt.dd.fieldset.figcaption.figure.footer.form.h1.h2.h3.h4.h5.h6.header.hr.li.main.nav.ol.p.pre.section.table.tbody.td.tfoot.th.thead.tr.ul".split(".")), mo = 80, ho = (e) => e.replace(/&/g, "&").replace(/"/g, """), go = (e) => e.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">"), _o = (e) => Array.from(e.attributes).map((e) => ` ${e.name}="${ho(e.value)}"`).join(""), vo = (e) => " ".repeat(e), yo = (e, t, n) => {
|
|
3204
|
+
let r = e.tagName.toLowerCase(), i = `<${r}${_o(e)}>`;
|
|
3205
|
+
if (fo.has(r)) return i;
|
|
3206
|
+
let a = n || r === "pre", o = bo(e, t + 1, a), s = `</${r}>`;
|
|
3207
|
+
return a || !po.has(r) ? `${i}${o}${s}` : Array.from(e.children).some((e) => po.has(e.tagName.toLowerCase())) ? `${i}\n${bo(e, t + 1, !1, !0)}\n${vo(t)}${s}` : i.length + o.length + s.length > mo ? `${i}\n${vo(t + 1)}${o}\n${vo(t)}${s}` : `${i}${o}${s}`;
|
|
3208
|
+
}, bo = (e, t, n, r = !1) => {
|
|
3126
3209
|
let i = [];
|
|
3127
3210
|
for (let r of Array.from(e.childNodes)) {
|
|
3128
3211
|
if (r.nodeType === Node.TEXT_NODE) {
|
|
3129
3212
|
let e = r.textContent ?? "";
|
|
3130
3213
|
if (n) {
|
|
3131
|
-
i.push(
|
|
3214
|
+
i.push(go(e));
|
|
3132
3215
|
continue;
|
|
3133
3216
|
}
|
|
3134
|
-
e.trim() && i.push(
|
|
3217
|
+
e.trim() && i.push(go(e));
|
|
3135
3218
|
continue;
|
|
3136
3219
|
}
|
|
3137
3220
|
if (r.nodeType === Node.COMMENT_NODE) {
|
|
3138
3221
|
i.push(`<!--${r.data}-->`);
|
|
3139
3222
|
continue;
|
|
3140
3223
|
}
|
|
3141
|
-
r.nodeType === Node.ELEMENT_NODE && i.push(
|
|
3224
|
+
r.nodeType === Node.ELEMENT_NODE && i.push(yo(r, t, n));
|
|
3142
3225
|
}
|
|
3143
|
-
return n || !r ? i.join("") : i.map((e) => `${
|
|
3226
|
+
return n || !r ? i.join("") : i.map((e) => `${vo(t)}${e}`).join("\n");
|
|
3144
3227
|
};
|
|
3145
|
-
function
|
|
3146
|
-
return e.trim() ?
|
|
3228
|
+
function xo(e) {
|
|
3229
|
+
return e.trim() ? bo(new DOMParser().parseFromString(Yi(e), "text/html").body, 0, !1, !0).trimEnd() : e;
|
|
3147
3230
|
}
|
|
3148
3231
|
//#endregion
|
|
3149
3232
|
//#region src/components/Editor/utils/writeHtmlSource.ts
|
|
3150
|
-
function
|
|
3151
|
-
|
|
3152
|
-
let t =
|
|
3153
|
-
if (
|
|
3233
|
+
function So(e) {
|
|
3234
|
+
F().clear();
|
|
3235
|
+
let t = Ct("html");
|
|
3236
|
+
if (F().append(t), !e) return;
|
|
3154
3237
|
t.select();
|
|
3155
|
-
let n =
|
|
3156
|
-
|
|
3238
|
+
let n = I();
|
|
3239
|
+
L(n) && n.insertRawText(e);
|
|
3157
3240
|
}
|
|
3158
3241
|
//#endregion
|
|
3159
3242
|
//#region src/components/Editor/plugins/SourceModePlugin.tsx
|
|
3160
|
-
function
|
|
3161
|
-
let [r] =
|
|
3243
|
+
function Co({ children: e, maxLength: t, onMaxLengthExceed: n }) {
|
|
3244
|
+
let [r] = R(), [i, a] = M(!1), o = j(!1), s = j(n);
|
|
3162
3245
|
s.current = n;
|
|
3163
|
-
let c =
|
|
3246
|
+
let c = co(t) ? t : void 0, l = T(() => {
|
|
3164
3247
|
if (o.current) return;
|
|
3165
3248
|
let e = "", t = "";
|
|
3166
3249
|
r.getEditorState().read(() => {
|
|
3167
|
-
t =
|
|
3250
|
+
t = F().getTextContent(), e = ge(r, null);
|
|
3168
3251
|
}, { editor: r });
|
|
3169
|
-
let n =
|
|
3252
|
+
let n = xi(e, t) ? "" : X(e);
|
|
3170
3253
|
o.current = !0, a(!0), r.update(() => {
|
|
3171
|
-
|
|
3172
|
-
}), r.dispatchCommand(
|
|
3254
|
+
So(xo(n));
|
|
3255
|
+
}), r.dispatchCommand(Re, void 0);
|
|
3173
3256
|
}, [r]), u = T(() => {
|
|
3174
3257
|
if (!o.current) return;
|
|
3175
3258
|
let e = !1;
|
|
3176
3259
|
o.current = !1, r.update(() => {
|
|
3177
|
-
|
|
3178
|
-
}), a(!1), r.dispatchCommand(
|
|
3260
|
+
bi(r, X(F().getTextContent())), c !== void 0 && (e = lo(r, c)), Dn(!0);
|
|
3261
|
+
}), a(!1), r.dispatchCommand(Re, void 0), e && s.current?.();
|
|
3179
3262
|
}, [r, c]), d = T(() => {
|
|
3180
3263
|
if (o.current) {
|
|
3181
3264
|
u();
|
|
@@ -3193,51 +3276,51 @@ function uo({ children: e, maxLength: t, onMaxLengthExceed: n }) {
|
|
|
3193
3276
|
if (!n) return !0;
|
|
3194
3277
|
let i = X(n);
|
|
3195
3278
|
return r.update(() => {
|
|
3196
|
-
let e =
|
|
3197
|
-
|
|
3198
|
-
}, { tag:
|
|
3279
|
+
let e = I();
|
|
3280
|
+
L(e) && i && e.insertRawText(i);
|
|
3281
|
+
}, { tag: et }), !0;
|
|
3199
3282
|
};
|
|
3200
|
-
return
|
|
3283
|
+
return Xt(r.registerNodeTransform(nt, () => {
|
|
3201
3284
|
if (!o.current) return;
|
|
3202
|
-
let e =
|
|
3203
|
-
|
|
3204
|
-
}), r.registerCommand(
|
|
3285
|
+
let e = F(), t = e.getChildrenSize() === 1 ? e.getFirstChild() : null;
|
|
3286
|
+
z(t) && t.getLanguage() === "html" || So(e.getTextContent());
|
|
3287
|
+
}), r.registerCommand($e, e, ze), r.registerCommand(Ue, e, ze));
|
|
3205
3288
|
}, [r]);
|
|
3206
|
-
let f =
|
|
3289
|
+
let f = A(() => ({
|
|
3207
3290
|
isSourceMode: i,
|
|
3208
3291
|
isSourceModeRef: o,
|
|
3209
3292
|
toggleSourceMode: d
|
|
3210
3293
|
}), [i, d]);
|
|
3211
|
-
return /* @__PURE__ */ y(
|
|
3294
|
+
return /* @__PURE__ */ y(Vr.Provider, {
|
|
3212
3295
|
value: f,
|
|
3213
3296
|
children: e
|
|
3214
3297
|
});
|
|
3215
3298
|
}
|
|
3216
3299
|
//#endregion
|
|
3217
3300
|
//#region src/components/Editor/plugins/HeadingPlugin.tsx
|
|
3218
|
-
function
|
|
3301
|
+
function wo(e) {
|
|
3219
3302
|
let t = e.getTag();
|
|
3220
3303
|
if (t === "h4" || t === "h5" || t === "h6") {
|
|
3221
|
-
e.replace(
|
|
3304
|
+
e.replace(be(), !0);
|
|
3222
3305
|
return;
|
|
3223
3306
|
}
|
|
3224
3307
|
for (let t of e.getAllTextNodes()) {
|
|
3225
3308
|
let e = t.getStyle();
|
|
3226
3309
|
if (!e) continue;
|
|
3227
|
-
let n =
|
|
3310
|
+
let n = Na(e, "font-size");
|
|
3228
3311
|
n !== e && t.setStyle(n);
|
|
3229
3312
|
}
|
|
3230
3313
|
}
|
|
3231
|
-
function
|
|
3232
|
-
let [e] =
|
|
3233
|
-
return O(() => e.registerNodeTransform(
|
|
3314
|
+
function To() {
|
|
3315
|
+
let [e] = R();
|
|
3316
|
+
return O(() => e.registerNodeTransform(Jt, wo), [e]), null;
|
|
3234
3317
|
}
|
|
3235
3318
|
//#endregion
|
|
3236
3319
|
//#region src/components/Editor/LengthBadge.tsx
|
|
3237
|
-
var
|
|
3320
|
+
var Eo = ({ current: e, maxLength: t }) => {
|
|
3238
3321
|
let n = e > t;
|
|
3239
3322
|
return /* @__PURE__ */ b("div", {
|
|
3240
|
-
className:
|
|
3323
|
+
className: P($["bsy-lexical-editor__length-badge"], n && $["bsy-lexical-editor__length-badge--exceeded"]),
|
|
3241
3324
|
"aria-live": "polite",
|
|
3242
3325
|
children: [
|
|
3243
3326
|
e,
|
|
@@ -3246,33 +3329,33 @@ var mo = ({ current: e, maxLength: t }) => {
|
|
|
3246
3329
|
]
|
|
3247
3330
|
});
|
|
3248
3331
|
};
|
|
3249
|
-
|
|
3332
|
+
Eo.displayName = "BsyLexicalEditorLengthBadge";
|
|
3250
3333
|
//#endregion
|
|
3251
3334
|
//#region src/components/Editor/utils/unwrapTypesetFence.ts
|
|
3252
|
-
var
|
|
3335
|
+
var Do = /^\uFEFF/, Oo = /^ {0,3}`{1,3}[A-Za-z]*$/, ko = /^( {0,3})([^`<]*?)```[ \t]*([A-Za-z0-9_-]*)[ \t]*(.*)$/, Ao = /^ {0,3}```[ \t]*$/, jo = /<\/?[a-zA-Z]/, Mo = /<[a-zA-Z!]/, No = (e) => Mo.test(e), Po = (e) => jo.test(e), Fo = (e) => e.replace(Do, "").replace(/\r\n/g, "\n"), Io = (e) => {
|
|
3253
3336
|
let t = e.replace(/\n+$/, ""), n = t.lastIndexOf("\n"), r = n === -1 ? t : t.slice(n + 1);
|
|
3254
|
-
return
|
|
3337
|
+
return Oo.test(r) ? {
|
|
3255
3338
|
text: n === -1 ? "" : t.slice(0, n),
|
|
3256
3339
|
withheld: !0
|
|
3257
3340
|
} : {
|
|
3258
3341
|
text: e,
|
|
3259
3342
|
withheld: !1
|
|
3260
3343
|
};
|
|
3261
|
-
},
|
|
3262
|
-
let t =
|
|
3344
|
+
}, Lo = (e) => {
|
|
3345
|
+
let t = ko.exec(e);
|
|
3263
3346
|
return t ? { sameLineBody: t[4] ?? "" } : null;
|
|
3264
|
-
},
|
|
3347
|
+
}, Ro = (e) => {
|
|
3265
3348
|
let t = e.replace(/[ \t]*```[ \t]*$/, "");
|
|
3266
3349
|
return t === e ? e : t;
|
|
3267
|
-
},
|
|
3350
|
+
}, zo = (e) => No(e) ? e.replace(/^\n/, "") : "", Bo = (e) => {
|
|
3268
3351
|
let t = e.split("\n"), n = [], r = 0;
|
|
3269
3352
|
for (; r < t.length;) {
|
|
3270
|
-
let e = t[r], i =
|
|
3353
|
+
let e = t[r], i = Lo(e);
|
|
3271
3354
|
if (i) {
|
|
3272
3355
|
let e = i.sameLineBody;
|
|
3273
|
-
if (e !==
|
|
3274
|
-
e =
|
|
3275
|
-
let i =
|
|
3356
|
+
if (e !== Ro(e)) {
|
|
3357
|
+
e = Ro(e);
|
|
3358
|
+
let i = zo(t.slice(r + 1).join("\n"));
|
|
3276
3359
|
return [
|
|
3277
3360
|
...n,
|
|
3278
3361
|
e,
|
|
@@ -3280,38 +3363,38 @@ var ho = /^\uFEFF/, go = /^ {0,3}`{1,3}[A-Za-z]*$/, _o = /^( {0,3})([^`<]*?)```[
|
|
|
3280
3363
|
].filter(Boolean).join("\n");
|
|
3281
3364
|
}
|
|
3282
3365
|
let a = [];
|
|
3283
|
-
for (e && a.push(e), r += 1; r < t.length && !
|
|
3284
|
-
let o = r < t.length ?
|
|
3366
|
+
for (e && a.push(e), r += 1; r < t.length && !Ao.test(t[r]);) a.push(t[r]), r += 1;
|
|
3367
|
+
let o = r < t.length ? zo(t.slice(r + 1).join("\n")) : "";
|
|
3285
3368
|
return [
|
|
3286
3369
|
...n,
|
|
3287
3370
|
a.join("\n"),
|
|
3288
3371
|
o
|
|
3289
3372
|
].filter(Boolean).join("\n");
|
|
3290
3373
|
}
|
|
3291
|
-
if (
|
|
3292
|
-
|
|
3374
|
+
if (Po(e)) return Vo([...n, ...t.slice(r)].join("\n"));
|
|
3375
|
+
No(e) && n.push(e), r += 1;
|
|
3293
3376
|
}
|
|
3294
3377
|
return n.length ? n.join("\n") : null;
|
|
3295
|
-
},
|
|
3378
|
+
}, Vo = (e) => {
|
|
3296
3379
|
let t = e.split("\n");
|
|
3297
3380
|
if (!t.length) return e;
|
|
3298
|
-
let n =
|
|
3299
|
-
return n && !
|
|
3381
|
+
let n = Lo(t[0]);
|
|
3382
|
+
return n && !Po(t[0].slice(0, t[0].indexOf("```"))) && (t.shift(), n.sameLineBody && t.unshift(Ro(n.sameLineBody))), t.length && Ao.test(t[t.length - 1] ?? "") && t.pop(), t.join("\n");
|
|
3300
3383
|
};
|
|
3301
|
-
function
|
|
3384
|
+
function Ho(e) {
|
|
3302
3385
|
if (!e) return {
|
|
3303
3386
|
html: "",
|
|
3304
3387
|
pending: !1
|
|
3305
3388
|
};
|
|
3306
|
-
let { text: t, withheld: n } =
|
|
3389
|
+
let { text: t, withheld: n } = Io(Fo(e));
|
|
3307
3390
|
if (!t.trim()) return {
|
|
3308
3391
|
html: "",
|
|
3309
|
-
pending: n ||
|
|
3392
|
+
pending: n || Oo.test(Fo(e).trim())
|
|
3310
3393
|
};
|
|
3311
|
-
let r =
|
|
3394
|
+
let r = Bo(t) ?? t, i = Bo(r);
|
|
3312
3395
|
i !== null && i !== r && (r = i);
|
|
3313
3396
|
let a = r.trim();
|
|
3314
|
-
return
|
|
3397
|
+
return No(a) ? {
|
|
3315
3398
|
html: a,
|
|
3316
3399
|
pending: !1
|
|
3317
3400
|
} : {
|
|
@@ -3321,32 +3404,21 @@ function Ao(e) {
|
|
|
3321
3404
|
}
|
|
3322
3405
|
//#endregion
|
|
3323
3406
|
//#region src/components/Editor/utils/prepareTypesetProposed.ts
|
|
3324
|
-
var
|
|
3325
|
-
|
|
3326
|
-
|
|
3327
|
-
|
|
3328
|
-
if (!t) return e;
|
|
3329
|
-
for (let e of Array.from(t.querySelectorAll(jo))) {
|
|
3330
|
-
let t = e;
|
|
3331
|
-
t.style.removeProperty("background-color"), t.style.removeProperty("background"), t.getAttribute("style")?.trim() || t.removeAttribute("style");
|
|
3332
|
-
}
|
|
3333
|
-
return t.innerHTML;
|
|
3334
|
-
}
|
|
3335
|
-
function Po(e, t) {
|
|
3336
|
-
let { html: n } = Ao(e);
|
|
3337
|
-
return n ? No(_i(n, t)) : "";
|
|
3338
|
-
}
|
|
3407
|
+
var Uo = (e, t) => {
|
|
3408
|
+
let { html: n } = Ho(e);
|
|
3409
|
+
return n ? li(oi(n, t)) : "";
|
|
3410
|
+
};
|
|
3339
3411
|
//#endregion
|
|
3340
3412
|
//#region src/components/Editor/utils/applyAiTypeset.ts
|
|
3341
|
-
function
|
|
3342
|
-
let i = X(
|
|
3343
|
-
if (!i.trim() ||
|
|
3413
|
+
function Wo(e, t, n, r) {
|
|
3414
|
+
let i = X(Uo(t, n));
|
|
3415
|
+
if (!i.trim() || xi(i, "")) return {
|
|
3344
3416
|
applied: !1,
|
|
3345
3417
|
truncated: !1
|
|
3346
3418
|
};
|
|
3347
3419
|
let a = !1;
|
|
3348
3420
|
return e.update(() => {
|
|
3349
|
-
|
|
3421
|
+
bi(e, i), co(r) && (a = lo(e, r)), Dn(!0);
|
|
3350
3422
|
}, { discrete: !0 }), {
|
|
3351
3423
|
applied: !0,
|
|
3352
3424
|
truncated: a
|
|
@@ -3354,15 +3426,15 @@ function Fo(e, t, n, r) {
|
|
|
3354
3426
|
}
|
|
3355
3427
|
//#endregion
|
|
3356
3428
|
//#region src/components/Editor/Preview/useAiPreviewHtml.ts
|
|
3357
|
-
var
|
|
3358
|
-
if (!e ||
|
|
3429
|
+
var Go = (e, t) => {
|
|
3430
|
+
if (!e || gi(e)) return e;
|
|
3359
3431
|
let n = X(e);
|
|
3360
|
-
return t === "ready" || t === "error" ?
|
|
3361
|
-
},
|
|
3362
|
-
let [i, a] =
|
|
3432
|
+
return t === "ready" || t === "error" ? Yi(n) : n;
|
|
3433
|
+
}, Ko = ({ enabled: e, status: t, revision: n, compute: r }) => {
|
|
3434
|
+
let [i, a] = M(""), o = j(r);
|
|
3363
3435
|
o.current = r;
|
|
3364
|
-
let s =
|
|
3365
|
-
return
|
|
3436
|
+
let s = j(null);
|
|
3437
|
+
return te(() => {
|
|
3366
3438
|
let n = () => {
|
|
3367
3439
|
s.current !== null && (cancelAnimationFrame(s.current), s.current = null);
|
|
3368
3440
|
};
|
|
@@ -3385,13 +3457,13 @@ var Io = (e, t) => {
|
|
|
3385
3457
|
]), O(() => () => {
|
|
3386
3458
|
s.current !== null && cancelAnimationFrame(s.current);
|
|
3387
3459
|
}, []), i;
|
|
3388
|
-
},
|
|
3460
|
+
}, qo = [
|
|
3389
3461
|
.26,
|
|
3390
3462
|
.02,
|
|
3391
3463
|
.23,
|
|
3392
3464
|
.94
|
|
3393
|
-
],
|
|
3394
|
-
let e = `${
|
|
3465
|
+
], Jo = () => {
|
|
3466
|
+
let e = `${ee().replace(/:/g, "")}g`;
|
|
3395
3467
|
return /* @__PURE__ */ y("span", {
|
|
3396
3468
|
className: Q["bsy-lexical-ai__think-icon"],
|
|
3397
3469
|
"aria-hidden": "true",
|
|
@@ -3429,80 +3501,41 @@ var Io = (e, t) => {
|
|
|
3429
3501
|
}) })]
|
|
3430
3502
|
})
|
|
3431
3503
|
});
|
|
3432
|
-
}
|
|
3433
|
-
|
|
3434
|
-
let { t: r } = a(), i = e.status === "loading" && !t, [o, s] = P(!0), [c, l] = P(0), u = N(Date.now()), d = N(null), f = N(!1), p = N(!1), m = e.reasoning ?? "", h = i || o, g = (i || !!m) && !(e.status === "error" && !m), _ = (e) => {
|
|
3435
|
-
!e || !p.current || (p.current = !1, e.scrollHeight - e.scrollTop - e.clientHeight > 8 && (f.current = !0));
|
|
3436
|
-
}, v = T(() => n?.current ?? void 0, [n]), y = T(() => {
|
|
3437
|
-
let e = v();
|
|
3438
|
-
return e?.closest("[data-overlayscrollbars]") ?? e;
|
|
3439
|
-
}, [v]);
|
|
3504
|
+
}, Yo = (e, t) => {
|
|
3505
|
+
let { t: n } = a(), r = e.status === "loading" && !t, [i, o] = M(!0), [s, c] = M(0), l = j(Date.now()), u = j(null), d = e.reasoning ?? "", f = r || i, p = (r || !!d) && !(e.status === "error" && !d);
|
|
3440
3506
|
return O(() => {
|
|
3441
|
-
if (!
|
|
3442
|
-
|
|
3507
|
+
if (!r) {
|
|
3508
|
+
u.current === null && (u.current = Math.max(1, Math.round((Date.now() - l.current) / 1e3)), c(u.current)), o(!1);
|
|
3443
3509
|
return;
|
|
3444
3510
|
}
|
|
3445
|
-
|
|
3511
|
+
l.current = Date.now(), u.current = null, o(!0);
|
|
3446
3512
|
let e = window.setInterval(() => {
|
|
3447
|
-
|
|
3513
|
+
c(Math.max(1, Math.round((Date.now() - l.current) / 1e3)));
|
|
3448
3514
|
}, 500);
|
|
3449
3515
|
return () => window.clearInterval(e);
|
|
3450
|
-
}, [
|
|
3451
|
-
p
|
|
3452
|
-
|
|
3453
|
-
|
|
3454
|
-
|
|
3455
|
-
|
|
3456
|
-
|
|
3457
|
-
enable: i
|
|
3458
|
-
}), ie("pointerdown", (e) => {
|
|
3459
|
-
let t = e.target;
|
|
3460
|
-
t instanceof Element && t.closest(".os-scrollbar") && (p.current = !0);
|
|
3461
|
-
}, {
|
|
3462
|
-
target: y,
|
|
3463
|
-
passive: !0,
|
|
3464
|
-
enable: i
|
|
3465
|
-
}), ie("scroll", () => _(v()), {
|
|
3466
|
-
target: v,
|
|
3467
|
-
passive: !0,
|
|
3468
|
-
enable: i
|
|
3469
|
-
}), O(() => {
|
|
3470
|
-
if (!i || f.current || !n?.current) return;
|
|
3471
|
-
let e = window.requestAnimationFrame(() => {
|
|
3472
|
-
if (f.current) return;
|
|
3473
|
-
let e = n?.current;
|
|
3474
|
-
e && e.scrollHeight - e.scrollTop - e.clientHeight > 1 && (e.scrollTop = e.scrollHeight);
|
|
3475
|
-
});
|
|
3476
|
-
return () => window.cancelAnimationFrame(e);
|
|
3477
|
-
}, [
|
|
3478
|
-
m,
|
|
3479
|
-
n,
|
|
3480
|
-
i
|
|
3481
|
-
]), {
|
|
3482
|
-
visible: g,
|
|
3483
|
-
thinking: i,
|
|
3484
|
-
open: h,
|
|
3485
|
-
label: i ? r("editor.aiThinking") : r("editor.aiThoughtSeconds", { seconds: c }),
|
|
3486
|
-
reasoning: m,
|
|
3487
|
-
toggle: () => s((e) => !e),
|
|
3488
|
-
onViewportScroll: () => _(n?.current)
|
|
3516
|
+
}, [r]), {
|
|
3517
|
+
visible: p,
|
|
3518
|
+
thinking: r,
|
|
3519
|
+
open: f,
|
|
3520
|
+
label: r ? n("editor.aiThinking") : n("editor.aiThoughtSeconds", { seconds: s }),
|
|
3521
|
+
reasoning: d,
|
|
3522
|
+
toggle: () => o((e) => !e)
|
|
3489
3523
|
};
|
|
3490
|
-
}
|
|
3491
|
-
var Vo = ({ model: t }) => t.visible ? /* @__PURE__ */ b("button", {
|
|
3524
|
+
}, Xo = ({ model: t }) => t.visible ? /* @__PURE__ */ b("button", {
|
|
3492
3525
|
type: "button",
|
|
3493
3526
|
className: Q["bsy-lexical-ai__think-head"],
|
|
3494
3527
|
disabled: t.thinking,
|
|
3495
3528
|
onClick: t.toggle,
|
|
3496
|
-
children: [t.thinking ? /* @__PURE__ */ y(
|
|
3529
|
+
children: [t.thinking ? /* @__PURE__ */ y(Jo, {}) : /* @__PURE__ */ y(e, {
|
|
3497
3530
|
name: "arrow-down",
|
|
3498
3531
|
size: 12,
|
|
3499
|
-
className:
|
|
3532
|
+
className: P(Q["bsy-lexical-ai__think-arrow"], t.open && Q["bsy-lexical-ai__think-arrow--open"])
|
|
3500
3533
|
}), /* @__PURE__ */ y("span", {
|
|
3501
3534
|
className: Q["bsy-lexical-ai__think-label"],
|
|
3502
|
-
children: /* @__PURE__ */ y(
|
|
3535
|
+
children: /* @__PURE__ */ y(oe, {
|
|
3503
3536
|
mode: "popLayout",
|
|
3504
3537
|
initial: !1,
|
|
3505
|
-
children: /* @__PURE__ */ y(
|
|
3538
|
+
children: /* @__PURE__ */ y(se.span, {
|
|
3506
3539
|
initial: {
|
|
3507
3540
|
opacity: 0,
|
|
3508
3541
|
y: 6
|
|
@@ -3517,7 +3550,7 @@ var Vo = ({ model: t }) => t.visible ? /* @__PURE__ */ b("button", {
|
|
|
3517
3550
|
},
|
|
3518
3551
|
transition: {
|
|
3519
3552
|
duration: .22,
|
|
3520
|
-
ease:
|
|
3553
|
+
ease: qo
|
|
3521
3554
|
},
|
|
3522
3555
|
children: /* @__PURE__ */ y("span", {
|
|
3523
3556
|
className: t.thinking ? Q["bsy-lexical-ai__think-label--shimmer"] : void 0,
|
|
@@ -3526,8 +3559,8 @@ var Vo = ({ model: t }) => t.visible ? /* @__PURE__ */ b("button", {
|
|
|
3526
3559
|
}, t.label)
|
|
3527
3560
|
})
|
|
3528
3561
|
})]
|
|
3529
|
-
}) : null,
|
|
3530
|
-
let [t, n] =
|
|
3562
|
+
}) : null, Zo = ({ model: e }) => {
|
|
3563
|
+
let [t, n] = M(!0), r = D(e.reasoning);
|
|
3531
3564
|
if (O(() => {
|
|
3532
3565
|
e.open || n(!0);
|
|
3533
3566
|
}, [e.open]), !e.visible) return null;
|
|
@@ -3536,11 +3569,11 @@ var Vo = ({ model: t }) => t.visible ? /* @__PURE__ */ b("button", {
|
|
|
3536
3569
|
children: r
|
|
3537
3570
|
});
|
|
3538
3571
|
return !t && e.open && e.reasoning ? /* @__PURE__ */ y("div", {
|
|
3539
|
-
className:
|
|
3572
|
+
className: P(Q["bsy-lexical-ai__think-collapse"], Q["bsy-lexical-ai__think-collapse--grown"]),
|
|
3540
3573
|
children: i
|
|
3541
|
-
}) : /* @__PURE__ */ y(
|
|
3574
|
+
}) : /* @__PURE__ */ y(oe, {
|
|
3542
3575
|
initial: !1,
|
|
3543
|
-
children: e.open && e.reasoning ? /* @__PURE__ */ y(
|
|
3576
|
+
children: e.open && e.reasoning ? /* @__PURE__ */ y(se.div, {
|
|
3544
3577
|
initial: {
|
|
3545
3578
|
height: 0,
|
|
3546
3579
|
opacity: 0
|
|
@@ -3568,43 +3601,272 @@ var Vo = ({ model: t }) => t.visible ? /* @__PURE__ */ b("button", {
|
|
|
3568
3601
|
children: i
|
|
3569
3602
|
}, "think-body") : null
|
|
3570
3603
|
});
|
|
3571
|
-
},
|
|
3572
|
-
let
|
|
3573
|
-
|
|
3574
|
-
|
|
3575
|
-
|
|
3576
|
-
|
|
3577
|
-
|
|
3578
|
-
|
|
3579
|
-
|
|
3580
|
-
|
|
3581
|
-
t.
|
|
3604
|
+
}, Qo = 32, $o = .25, es = 2, ts = ({ viewportRef: e, enabled: t, revision: n }) => {
|
|
3605
|
+
let r = j(!0), i = j(!1), a = j(0), o = T(() => e.current ?? void 0, [e]), s = T(() => {
|
|
3606
|
+
let t = e.current;
|
|
3607
|
+
return t?.closest("[data-overlayscrollbars]") ?? t ?? void 0;
|
|
3608
|
+
}, [e]), c = T(() => {
|
|
3609
|
+
a.current = 0;
|
|
3610
|
+
let t = e.current;
|
|
3611
|
+
if (!t || !r.current) return;
|
|
3612
|
+
let n = Math.max(0, t.scrollHeight - t.clientHeight), i = n - t.scrollTop;
|
|
3613
|
+
if (i <= 1) {
|
|
3614
|
+
t.scrollTop = n;
|
|
3615
|
+
return;
|
|
3616
|
+
}
|
|
3617
|
+
t.scrollTop += Math.max(i * $o, Math.min(i, es)), a.current = requestAnimationFrame(c);
|
|
3618
|
+
}, [e]), l = T(() => {
|
|
3619
|
+
!a.current && r.current && (a.current = requestAnimationFrame(c));
|
|
3620
|
+
}, [c]);
|
|
3621
|
+
O(() => {
|
|
3622
|
+
if (!t) {
|
|
3623
|
+
r.current = !0, i.current = !1, cancelAnimationFrame(a.current), a.current = 0;
|
|
3624
|
+
return;
|
|
3582
3625
|
}
|
|
3583
|
-
|
|
3584
|
-
|
|
3585
|
-
|
|
3626
|
+
l();
|
|
3627
|
+
}, [
|
|
3628
|
+
t,
|
|
3629
|
+
n,
|
|
3630
|
+
l
|
|
3631
|
+
]), O(() => {
|
|
3632
|
+
let n = e.current;
|
|
3633
|
+
if (!t || !n || typeof ResizeObserver > "u") return;
|
|
3634
|
+
let r = new ResizeObserver(l);
|
|
3635
|
+
return r.observe(n), n.firstElementChild && r.observe(n.firstElementChild), () => r.disconnect();
|
|
3636
|
+
}, [
|
|
3637
|
+
t,
|
|
3638
|
+
l,
|
|
3639
|
+
e
|
|
3640
|
+
]), O(() => () => cancelAnimationFrame(a.current), []);
|
|
3641
|
+
let u = () => {
|
|
3642
|
+
let t = e.current;
|
|
3643
|
+
if (!t) return;
|
|
3644
|
+
let n = t.scrollHeight - t.clientHeight - t.scrollTop <= Qo;
|
|
3645
|
+
i.current ? (i.current = !1, r.current = n, !n && a.current && (cancelAnimationFrame(a.current), a.current = 0)) : n && (r.current = !0);
|
|
3646
|
+
}, d = () => {
|
|
3647
|
+
i.current = !0;
|
|
3648
|
+
};
|
|
3649
|
+
return ae("wheel", d, {
|
|
3650
|
+
target: s,
|
|
3651
|
+
passive: !0,
|
|
3652
|
+
enable: t
|
|
3653
|
+
}), ae("touchstart", d, {
|
|
3654
|
+
target: o,
|
|
3655
|
+
passive: !0,
|
|
3656
|
+
enable: t
|
|
3657
|
+
}), ae("pointerdown", (e) => {
|
|
3658
|
+
e.target instanceof Element && e.target.closest(".os-scrollbar") && d();
|
|
3659
|
+
}, {
|
|
3660
|
+
target: s,
|
|
3661
|
+
passive: !0,
|
|
3662
|
+
enable: t
|
|
3663
|
+
}), ae("scroll", u, {
|
|
3664
|
+
target: o,
|
|
3665
|
+
passive: !0,
|
|
3666
|
+
enable: t
|
|
3667
|
+
}), { onScroll: u };
|
|
3668
|
+
}, ns = `
|
|
3669
|
+
:host {
|
|
3670
|
+
all: initial;
|
|
3671
|
+
display: block;
|
|
3672
|
+
width: 100%;
|
|
3673
|
+
max-width: 100%;
|
|
3674
|
+
min-width: 0;
|
|
3675
|
+
}
|
|
3676
|
+
.bsy-editor-html-preview__body {
|
|
3677
|
+
color: #030303;
|
|
3678
|
+
font-family: -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Helvetica Neue', sans-serif;
|
|
3679
|
+
font-size: 15px;
|
|
3680
|
+
line-height: 1.6;
|
|
3681
|
+
word-break: break-word;
|
|
3682
|
+
}
|
|
3683
|
+
.bsy-editor-html-preview__body p {
|
|
3684
|
+
margin: 0;
|
|
3685
|
+
}
|
|
3686
|
+
.bsy-editor-html-preview__body .editor-text-bold {
|
|
3687
|
+
font-weight: 700;
|
|
3688
|
+
}
|
|
3689
|
+
.bsy-editor-html-preview__body .editor-text-italic {
|
|
3690
|
+
font-style: italic;
|
|
3691
|
+
}
|
|
3692
|
+
.bsy-editor-html-preview__body .editor-text-underline {
|
|
3693
|
+
text-decoration: underline;
|
|
3694
|
+
}
|
|
3695
|
+
.bsy-editor-html-preview__body .editor-text-strikethrough {
|
|
3696
|
+
text-decoration: line-through;
|
|
3697
|
+
}
|
|
3698
|
+
.bsy-editor-html-preview__body .editor-text-underline-strikethrough {
|
|
3699
|
+
text-decoration: underline line-through;
|
|
3700
|
+
}
|
|
3701
|
+
.bsy-editor-html-preview__body sup,
|
|
3702
|
+
.bsy-editor-html-preview__body sub {
|
|
3703
|
+
display: inline-block;
|
|
3704
|
+
position: static;
|
|
3705
|
+
top: auto;
|
|
3706
|
+
bottom: auto;
|
|
3707
|
+
font-size: 0.75em;
|
|
3708
|
+
line-height: 1;
|
|
3709
|
+
}
|
|
3710
|
+
.bsy-editor-html-preview__body sup {
|
|
3711
|
+
vertical-align: super;
|
|
3712
|
+
}
|
|
3713
|
+
.bsy-editor-html-preview__body sub {
|
|
3714
|
+
vertical-align: sub;
|
|
3715
|
+
}
|
|
3716
|
+
.bsy-editor-html-preview__body .editor-heading-h1,
|
|
3717
|
+
.bsy-editor-html-preview__body .editor-heading-h2,
|
|
3718
|
+
.bsy-editor-html-preview__body .editor-heading-h3,
|
|
3719
|
+
.bsy-editor-html-preview__body .editor-heading-h4,
|
|
3720
|
+
.bsy-editor-html-preview__body .editor-heading-h5,
|
|
3721
|
+
.bsy-editor-html-preview__body .editor-heading-h6 {
|
|
3722
|
+
margin: 0.6em 0 0.4em;
|
|
3723
|
+
font-weight: 600;
|
|
3724
|
+
line-height: 1.35;
|
|
3725
|
+
}
|
|
3726
|
+
.bsy-editor-html-preview__body .editor-heading-h1 {
|
|
3727
|
+
font-size: 2em;
|
|
3728
|
+
}
|
|
3729
|
+
.bsy-editor-html-preview__body .editor-heading-h2 {
|
|
3730
|
+
font-size: 1.5em;
|
|
3731
|
+
}
|
|
3732
|
+
.bsy-editor-html-preview__body .editor-heading-h3 {
|
|
3733
|
+
font-size: 1.25em;
|
|
3734
|
+
}
|
|
3735
|
+
.bsy-editor-html-preview__body .editor-heading-h4 {
|
|
3736
|
+
font-size: 1.125em;
|
|
3737
|
+
}
|
|
3738
|
+
.bsy-editor-html-preview__body .editor-heading-h5 {
|
|
3739
|
+
font-size: 1em;
|
|
3740
|
+
}
|
|
3741
|
+
.bsy-editor-html-preview__body .editor-heading-h6 {
|
|
3742
|
+
font-size: 0.875em;
|
|
3743
|
+
}
|
|
3744
|
+
.bsy-editor-html-preview__body ul,
|
|
3745
|
+
.bsy-editor-html-preview__body ol,
|
|
3746
|
+
.bsy-editor-html-preview__body .editor-list-ul,
|
|
3747
|
+
.bsy-editor-html-preview__body .editor-list-ol {
|
|
3748
|
+
margin: 0;
|
|
3749
|
+
padding-inline-start: 0;
|
|
3750
|
+
list-style-position: outside;
|
|
3751
|
+
}
|
|
3752
|
+
.bsy-editor-html-preview__body .editor-list-ul {
|
|
3753
|
+
list-style-type: disc;
|
|
3754
|
+
}
|
|
3755
|
+
.bsy-editor-html-preview__body .editor-list-ol {
|
|
3756
|
+
list-style-type: decimal;
|
|
3757
|
+
}
|
|
3758
|
+
.bsy-editor-html-preview__body li,
|
|
3759
|
+
.bsy-editor-html-preview__body .editor-listitem {
|
|
3760
|
+
margin: 0;
|
|
3761
|
+
margin-inline-start: ${di};
|
|
3762
|
+
list-style: inherit;
|
|
3763
|
+
}
|
|
3764
|
+
.bsy-editor-html-preview__body .editor-nested-listitem {
|
|
3765
|
+
margin-inline-start: 0;
|
|
3766
|
+
list-style-type: none;
|
|
3767
|
+
}
|
|
3768
|
+
.bsy-editor-html-preview__body li::marker,
|
|
3769
|
+
.bsy-editor-html-preview__body .editor-listitem::marker {
|
|
3770
|
+
color: var(--listitem-marker-color);
|
|
3771
|
+
background-color: var(--listitem-marker-background-color);
|
|
3772
|
+
font-family: var(--listitem-marker-font-family);
|
|
3773
|
+
font-size: var(--listitem-marker-font-size);
|
|
3774
|
+
}
|
|
3775
|
+
.bsy-editor-html-preview__body .editor-list-ul .editor-list-ul {
|
|
3776
|
+
list-style-type: circle;
|
|
3777
|
+
}
|
|
3778
|
+
.bsy-editor-html-preview__body .editor-list-ul .editor-list-ul .editor-list-ul {
|
|
3779
|
+
list-style-type: square;
|
|
3780
|
+
}
|
|
3781
|
+
.bsy-editor-html-preview__body .editor-link,
|
|
3782
|
+
.bsy-editor-html-preview__body .editor-link:link,
|
|
3783
|
+
.bsy-editor-html-preview__body .editor-link:visited,
|
|
3784
|
+
.bsy-editor-html-preview__body .editor-link:hover,
|
|
3785
|
+
.bsy-editor-html-preview__body .editor-link:active,
|
|
3786
|
+
.bsy-editor-html-preview__body .editor-link:focus {
|
|
3787
|
+
color: #0269ff;
|
|
3788
|
+
cursor: pointer;
|
|
3789
|
+
}
|
|
3790
|
+
.bsy-editor-html-preview__body .editor-link * {
|
|
3791
|
+
color: #0269ff !important;
|
|
3792
|
+
}
|
|
3793
|
+
.bsy-editor-html-preview__body pre,
|
|
3794
|
+
.bsy-editor-html-preview__body .editor-code {
|
|
3795
|
+
display: block;
|
|
3796
|
+
box-sizing: border-box;
|
|
3797
|
+
max-width: 100%;
|
|
3798
|
+
margin: 8px 0;
|
|
3799
|
+
padding: 8px 12px;
|
|
3800
|
+
overflow-x: auto;
|
|
3801
|
+
border-radius: 4px;
|
|
3802
|
+
background: rgb(240, 242, 245);
|
|
3803
|
+
color: #1f2328;
|
|
3804
|
+
font-family: Menlo, Consolas, Monaco, monospace;
|
|
3805
|
+
font-size: 13px;
|
|
3806
|
+
line-height: 1.53;
|
|
3807
|
+
tab-size: 2;
|
|
3808
|
+
white-space: pre;
|
|
3809
|
+
}
|
|
3810
|
+
.bsy-editor-html-preview__body .editor-table-scrollable-wrapper {
|
|
3811
|
+
max-width: 100%;
|
|
3812
|
+
margin: 8px 0;
|
|
3813
|
+
overflow-x: auto;
|
|
3814
|
+
}
|
|
3815
|
+
.bsy-editor-html-preview__body table {
|
|
3816
|
+
width: max-content;
|
|
3817
|
+
min-width: 100%;
|
|
3818
|
+
margin: 0;
|
|
3819
|
+
border-collapse: collapse;
|
|
3820
|
+
table-layout: fixed;
|
|
3821
|
+
}
|
|
3822
|
+
.bsy-editor-html-preview__body td,
|
|
3823
|
+
.bsy-editor-html-preview__body th {
|
|
3824
|
+
box-sizing: border-box;
|
|
3825
|
+
min-width: 75px;
|
|
3826
|
+
min-height: 32px;
|
|
3827
|
+
padding: 4px 8px;
|
|
3828
|
+
border: 1px solid #d9d9d9;
|
|
3829
|
+
vertical-align: top;
|
|
3830
|
+
}
|
|
3831
|
+
.bsy-editor-html-preview__body th {
|
|
3832
|
+
background: #f2f3f5;
|
|
3833
|
+
font-weight: 600;
|
|
3834
|
+
}
|
|
3835
|
+
.bsy-editor-html-preview__body img {
|
|
3836
|
+
max-width: 100%;
|
|
3837
|
+
height: auto;
|
|
3838
|
+
vertical-align: baseline;
|
|
3839
|
+
}
|
|
3840
|
+
`, rs = ({ html: e }) => {
|
|
3841
|
+
let t = j(null);
|
|
3842
|
+
return te(() => {
|
|
3843
|
+
hi(t.current, e, X, ns);
|
|
3586
3844
|
}, [e]), /* @__PURE__ */ y("div", {
|
|
3587
3845
|
ref: t,
|
|
3588
3846
|
className: "bsy-editor-html-preview"
|
|
3589
3847
|
});
|
|
3590
|
-
},
|
|
3591
|
-
let [t, n] =
|
|
3848
|
+
}, is = ({ html: e }) => {
|
|
3849
|
+
let [t, n] = M(() => e && !gi(e) ? e : "");
|
|
3592
3850
|
return O(() => {
|
|
3593
|
-
!e ||
|
|
3594
|
-
}, [e]), t ? /* @__PURE__ */ y(
|
|
3595
|
-
},
|
|
3851
|
+
!e || gi(e) || n(e);
|
|
3852
|
+
}, [e]), t ? /* @__PURE__ */ y(rs, { html: t }) : null;
|
|
3853
|
+
}, as = {
|
|
3596
3854
|
paddingAbsolute: !0,
|
|
3597
3855
|
overflow: {
|
|
3598
3856
|
x: "hidden",
|
|
3599
3857
|
y: "scroll"
|
|
3600
3858
|
}
|
|
3601
|
-
},
|
|
3602
|
-
let { t: p } = a(), m =
|
|
3859
|
+
}, os = ({ status: t, errorMessage: n, originalHtml: i, proposedHtml: o, preset: s, onPresetChange: c, onCancel: l, onApply: d }) => {
|
|
3860
|
+
let { t: p } = a(), m = gr(), [h, g] = M(!0), _ = j(null), v = !!o.trim(), x = t === "ready" && v, S = Yo({
|
|
3603
3861
|
status: t,
|
|
3604
3862
|
reasoning: m
|
|
3605
|
-
}, v
|
|
3863
|
+
}, v), C = ts({
|
|
3864
|
+
viewportRef: _,
|
|
3865
|
+
enabled: t === "loading",
|
|
3866
|
+
revision: `${m ?? ""}\0${o}`
|
|
3867
|
+
}), w = qr.map((e) => ({
|
|
3606
3868
|
key: e,
|
|
3607
|
-
label: p(
|
|
3869
|
+
label: p(Jr[e])
|
|
3608
3870
|
}));
|
|
3609
3871
|
return /* @__PURE__ */ y(r, {
|
|
3610
3872
|
title: p("editor.aiPolish"),
|
|
@@ -3620,22 +3882,22 @@ var Vo = ({ model: t }) => t.visible ? /* @__PURE__ */ b("button", {
|
|
|
3620
3882
|
children: [/* @__PURE__ */ b("div", {
|
|
3621
3883
|
className: Q["bsy-lexical-ai__column"],
|
|
3622
3884
|
children: [/* @__PURE__ */ b("div", {
|
|
3623
|
-
className:
|
|
3885
|
+
className: P(Q["bsy-lexical-ai__column-title"], Q["bsy-lexical-ai__column-title--before"]),
|
|
3624
3886
|
children: [/* @__PURE__ */ y("span", { className: Q["bsy-lexical-ai__column-dot"] }), p("editor.aiOriginal")]
|
|
3625
3887
|
}), /* @__PURE__ */ y(u, {
|
|
3626
3888
|
className: Q["bsy-lexical-ai__column-body"],
|
|
3627
|
-
options:
|
|
3628
|
-
children: /* @__PURE__ */ y(
|
|
3889
|
+
options: as,
|
|
3890
|
+
children: /* @__PURE__ */ y(is, { html: i })
|
|
3629
3891
|
})]
|
|
3630
3892
|
}), /* @__PURE__ */ b("div", {
|
|
3631
3893
|
className: Q["bsy-lexical-ai__column"],
|
|
3632
3894
|
children: [/* @__PURE__ */ b("div", {
|
|
3633
3895
|
className: Q["bsy-lexical-ai__column-head"],
|
|
3634
3896
|
children: [/* @__PURE__ */ b("div", {
|
|
3635
|
-
className:
|
|
3897
|
+
className: P(Q["bsy-lexical-ai__column-title"], Q["bsy-lexical-ai__column-title--after"]),
|
|
3636
3898
|
children: [/* @__PURE__ */ y("span", { className: Q["bsy-lexical-ai__column-dot"] }), p("editor.aiOptimized")]
|
|
3637
3899
|
}), /* @__PURE__ */ y(f, {
|
|
3638
|
-
menus:
|
|
3900
|
+
menus: w,
|
|
3639
3901
|
showSearch: !1,
|
|
3640
3902
|
activeKey: [s],
|
|
3641
3903
|
offset: {
|
|
@@ -3651,7 +3913,7 @@ var Vo = ({ model: t }) => t.visible ? /* @__PURE__ */ b("button", {
|
|
|
3651
3913
|
type: "button",
|
|
3652
3914
|
className: Q["bsy-lexical-ai__preset"],
|
|
3653
3915
|
title: p("editor.aiPolish"),
|
|
3654
|
-
children: [p(
|
|
3916
|
+
children: [p(Jr[s]), /* @__PURE__ */ y(e, {
|
|
3655
3917
|
name: "arrow-down",
|
|
3656
3918
|
size: 16
|
|
3657
3919
|
})]
|
|
@@ -3661,25 +3923,25 @@ var Vo = ({ model: t }) => t.visible ? /* @__PURE__ */ b("button", {
|
|
|
3661
3923
|
className: Q["bsy-lexical-ai__column-stack"],
|
|
3662
3924
|
children: [S.visible ? /* @__PURE__ */ y("div", {
|
|
3663
3925
|
className: Q["bsy-lexical-ai__think-pin"],
|
|
3664
|
-
children: /* @__PURE__ */ y(
|
|
3926
|
+
children: /* @__PURE__ */ y(Xo, { model: S })
|
|
3665
3927
|
}) : null, /* @__PURE__ */ b(u, {
|
|
3666
3928
|
className: Q["bsy-lexical-ai__column-body"],
|
|
3667
|
-
options:
|
|
3929
|
+
options: as,
|
|
3668
3930
|
viewportRef: _,
|
|
3669
|
-
onScroll:
|
|
3931
|
+
onScroll: C.onScroll,
|
|
3670
3932
|
children: [t === "error" ? /* @__PURE__ */ y("div", {
|
|
3671
3933
|
className: Q["bsy-lexical-ai__error"],
|
|
3672
3934
|
children: n || p("editor.aiError")
|
|
3673
|
-
}) : /* @__PURE__ */ y(
|
|
3935
|
+
}) : /* @__PURE__ */ y(Zo, { model: S }), v ? /* @__PURE__ */ y(is, { html: o }) : null]
|
|
3674
3936
|
})]
|
|
3675
3937
|
})]
|
|
3676
3938
|
})]
|
|
3677
3939
|
}), /* @__PURE__ */ b("div", {
|
|
3678
3940
|
className: Q["bsy-lexical-ai__footer"],
|
|
3679
|
-
children: [/* @__PURE__ */ y(
|
|
3941
|
+
children: [/* @__PURE__ */ y(N, {
|
|
3680
3942
|
onClick: () => g(!1),
|
|
3681
3943
|
children: p("editor.aiAbandon")
|
|
3682
|
-
}), /* @__PURE__ */ y(
|
|
3944
|
+
}), /* @__PURE__ */ y(N, {
|
|
3683
3945
|
type: "primary",
|
|
3684
3946
|
disabled: !x,
|
|
3685
3947
|
onClick: () => d() && g(!1),
|
|
@@ -3688,17 +3950,21 @@ var Vo = ({ model: t }) => t.visible ? /* @__PURE__ */ b("button", {
|
|
|
3688
3950
|
})]
|
|
3689
3951
|
})
|
|
3690
3952
|
});
|
|
3691
|
-
},
|
|
3953
|
+
}, ss = {
|
|
3692
3954
|
paddingAbsolute: !0,
|
|
3693
3955
|
overflow: {
|
|
3694
3956
|
x: "hidden",
|
|
3695
3957
|
y: "scroll"
|
|
3696
3958
|
}
|
|
3697
|
-
},
|
|
3698
|
-
let { t: c } = a(), l =
|
|
3959
|
+
}, cs = ({ status: e, errorMessage: t, originalHtml: n, proposedHtml: i, onCancel: o, onApply: s }) => {
|
|
3960
|
+
let { t: c } = a(), l = gr(), [d, f] = M(!0), p = j(null), m = !!i.trim(), h = e === "ready" && m, g = Yo({
|
|
3699
3961
|
status: e,
|
|
3700
3962
|
reasoning: l
|
|
3701
|
-
}, m,
|
|
3963
|
+
}, m), _ = ts({
|
|
3964
|
+
viewportRef: p,
|
|
3965
|
+
enabled: e === "loading",
|
|
3966
|
+
revision: `${l ?? ""}\0${i}`
|
|
3967
|
+
});
|
|
3702
3968
|
return /* @__PURE__ */ y(r, {
|
|
3703
3969
|
title: c("editor.aiPreview"),
|
|
3704
3970
|
open: d,
|
|
@@ -3713,41 +3979,41 @@ var Vo = ({ model: t }) => t.visible ? /* @__PURE__ */ b("button", {
|
|
|
3713
3979
|
children: [/* @__PURE__ */ b("div", {
|
|
3714
3980
|
className: Q["bsy-lexical-ai__column"],
|
|
3715
3981
|
children: [/* @__PURE__ */ b("div", {
|
|
3716
|
-
className:
|
|
3982
|
+
className: P(Q["bsy-lexical-ai__column-title"], Q["bsy-lexical-ai__column-title--before"]),
|
|
3717
3983
|
children: [/* @__PURE__ */ y("span", { className: Q["bsy-lexical-ai__column-dot"] }), c("editor.aiOriginal")]
|
|
3718
3984
|
}), /* @__PURE__ */ y(u, {
|
|
3719
3985
|
className: Q["bsy-lexical-ai__column-body"],
|
|
3720
|
-
options:
|
|
3721
|
-
children: /* @__PURE__ */ y(
|
|
3986
|
+
options: ss,
|
|
3987
|
+
children: /* @__PURE__ */ y(is, { html: n })
|
|
3722
3988
|
})]
|
|
3723
3989
|
}), /* @__PURE__ */ b("div", {
|
|
3724
3990
|
className: Q["bsy-lexical-ai__column"],
|
|
3725
3991
|
children: [/* @__PURE__ */ b("div", {
|
|
3726
|
-
className:
|
|
3992
|
+
className: P(Q["bsy-lexical-ai__column-title"], Q["bsy-lexical-ai__column-title--after"]),
|
|
3727
3993
|
children: [/* @__PURE__ */ y("span", { className: Q["bsy-lexical-ai__column-dot"] }), c("editor.aiOptimized")]
|
|
3728
3994
|
}), /* @__PURE__ */ b("div", {
|
|
3729
3995
|
className: Q["bsy-lexical-ai__column-stack"],
|
|
3730
3996
|
children: [g.visible ? /* @__PURE__ */ y("div", {
|
|
3731
3997
|
className: Q["bsy-lexical-ai__think-pin"],
|
|
3732
|
-
children: /* @__PURE__ */ y(
|
|
3998
|
+
children: /* @__PURE__ */ y(Xo, { model: g })
|
|
3733
3999
|
}) : null, /* @__PURE__ */ b(u, {
|
|
3734
4000
|
className: Q["bsy-lexical-ai__column-body"],
|
|
3735
|
-
options:
|
|
4001
|
+
options: ss,
|
|
3736
4002
|
viewportRef: p,
|
|
3737
|
-
onScroll:
|
|
4003
|
+
onScroll: _.onScroll,
|
|
3738
4004
|
children: [e === "error" ? /* @__PURE__ */ y("div", {
|
|
3739
4005
|
className: Q["bsy-lexical-ai__error"],
|
|
3740
4006
|
children: t || c("editor.aiError")
|
|
3741
|
-
}) : /* @__PURE__ */ y(
|
|
4007
|
+
}) : /* @__PURE__ */ y(Zo, { model: g }), m ? /* @__PURE__ */ y(is, { html: i }) : null]
|
|
3742
4008
|
})]
|
|
3743
4009
|
})]
|
|
3744
4010
|
})]
|
|
3745
4011
|
}), /* @__PURE__ */ b("div", {
|
|
3746
4012
|
className: Q["bsy-lexical-ai__footer"],
|
|
3747
|
-
children: [/* @__PURE__ */ y(
|
|
4013
|
+
children: [/* @__PURE__ */ y(N, {
|
|
3748
4014
|
onClick: () => f(!1),
|
|
3749
4015
|
children: c("editor.aiAbandon")
|
|
3750
|
-
}), /* @__PURE__ */ y(
|
|
4016
|
+
}), /* @__PURE__ */ y(N, {
|
|
3751
4017
|
type: "primary",
|
|
3752
4018
|
disabled: !h,
|
|
3753
4019
|
onClick: () => s() && f(!1),
|
|
@@ -3756,41 +4022,35 @@ var Vo = ({ model: t }) => t.visible ? /* @__PURE__ */ b("button", {
|
|
|
3756
4022
|
})]
|
|
3757
4023
|
})
|
|
3758
4024
|
});
|
|
3759
|
-
}
|
|
3760
|
-
|
|
3761
|
-
//#region src/components/Editor/Preview/EditorPreview.tsx
|
|
3762
|
-
function Xo(e, t, n, r) {
|
|
3763
|
-
return Lo({
|
|
3764
|
-
enabled: e,
|
|
3765
|
-
status: r,
|
|
3766
|
-
revision: n,
|
|
3767
|
-
compute: () => Io(Yi(t, n), r)
|
|
3768
|
-
});
|
|
3769
|
-
}
|
|
3770
|
-
var Zo = ({ maxLength: e, onMaxLengthExceed: t }) => {
|
|
3771
|
-
let [n] = B(), { aiOpen: r, setAiOpen: i, aiSessionRef: o, stop: s, polish: c } = hr(), { t: l } = a(), [u, d] = ne.useMessage(), f = o.current, { text: p, status: m, errorMessage: h } = gr(), g = !m || m === "idle" ? "loading" : m, _ = p, x = M(() => r ? Io(o.current?.originalHtml || "", "ready") : "", [r, o]), S = Lo({
|
|
4025
|
+
}, ls = ({ maxLength: e, onMaxLengthExceed: t }) => {
|
|
4026
|
+
let [n] = R(), { aiOpen: r, setAiOpen: i, aiSessionRef: o, stop: s, polish: c } = mr(), { t: l } = a(), [u, d] = ie.useMessage(), f = o.current, { text: p, status: m, errorMessage: h } = hr(), g = !m || m === "idle" ? "loading" : m, _ = A(() => r ? Go(o.current?.originalHtml || "", "ready") : "", [r, o]), x = Ko({
|
|
3772
4027
|
enabled: r === "typeset",
|
|
3773
4028
|
status: g,
|
|
3774
|
-
revision:
|
|
3775
|
-
compute: () =>
|
|
3776
|
-
}),
|
|
4029
|
+
revision: p,
|
|
4030
|
+
compute: () => Go(Uo(p, f?.codeBlocks ?? []), g)
|
|
4031
|
+
}), S = Ko({
|
|
4032
|
+
enabled: r === "polish",
|
|
4033
|
+
status: g,
|
|
4034
|
+
revision: p,
|
|
4035
|
+
compute: () => Go(ca(f?.originalHtml || "", p), g)
|
|
4036
|
+
});
|
|
3777
4037
|
O(() => {
|
|
3778
4038
|
if (r) return n.setEditable(!1), n.update(() => {
|
|
3779
|
-
|
|
4039
|
+
Pe(null);
|
|
3780
4040
|
}), window.getSelection()?.removeAllRanges(), n.getRootElement()?.blur(), () => {
|
|
3781
4041
|
n.setEditable(!0);
|
|
3782
4042
|
};
|
|
3783
4043
|
}, [r, n]);
|
|
3784
|
-
let
|
|
4044
|
+
let C = T(() => {
|
|
3785
4045
|
s?.(), o.current = null, i(null);
|
|
3786
4046
|
}, [
|
|
3787
4047
|
o,
|
|
3788
4048
|
i,
|
|
3789
4049
|
s
|
|
3790
|
-
]),
|
|
4050
|
+
]), w = T(() => {
|
|
3791
4051
|
if (r !== "typeset" || g !== "ready") return !1;
|
|
3792
4052
|
n.setEditable(!0);
|
|
3793
|
-
let { applied: i, truncated: a } =
|
|
4053
|
+
let { applied: i, truncated: a } = Wo(n, p, o.current?.codeBlocks ?? [], e);
|
|
3794
4054
|
return i ? (a && t?.(), !0) : (n.setEditable(!1), u.warning(l("editor.aiApplyEmpty")), !1);
|
|
3795
4055
|
}, [
|
|
3796
4056
|
r,
|
|
@@ -3801,56 +4061,57 @@ var Zo = ({ maxLength: e, onMaxLengthExceed: t }) => {
|
|
|
3801
4061
|
t,
|
|
3802
4062
|
g,
|
|
3803
4063
|
l,
|
|
3804
|
-
|
|
3805
|
-
]),
|
|
4064
|
+
p
|
|
4065
|
+
]), E = T(() => r !== "polish" || g !== "ready" ? !1 : la(n, p) ? !0 : (u.warning(l("editor.aiApplyEmpty")), !1), [
|
|
3806
4066
|
r,
|
|
3807
4067
|
n,
|
|
3808
4068
|
u,
|
|
3809
4069
|
g,
|
|
3810
4070
|
l,
|
|
3811
|
-
|
|
3812
|
-
]),
|
|
4071
|
+
p
|
|
4072
|
+
]), D = T((e) => {
|
|
3813
4073
|
let t = o.current;
|
|
3814
4074
|
!t?.originalText || !c || (t.preset = e, s?.(), c({
|
|
3815
4075
|
text: t.originalText,
|
|
3816
|
-
preset: e
|
|
4076
|
+
preset: e,
|
|
4077
|
+
prompt: Qr(e)
|
|
3817
4078
|
}));
|
|
3818
4079
|
}, [
|
|
3819
4080
|
o,
|
|
3820
4081
|
c,
|
|
3821
4082
|
s
|
|
3822
4083
|
]);
|
|
3823
|
-
return r ? /* @__PURE__ */ b(v, { children: [d, r === "typeset" ? /* @__PURE__ */ y(
|
|
4084
|
+
return r ? /* @__PURE__ */ b(v, { children: [d, r === "typeset" ? /* @__PURE__ */ y(cs, {
|
|
3824
4085
|
status: g,
|
|
3825
4086
|
errorMessage: h,
|
|
3826
|
-
originalHtml:
|
|
3827
|
-
proposedHtml:
|
|
3828
|
-
onCancel:
|
|
3829
|
-
onApply:
|
|
3830
|
-
}) : /* @__PURE__ */ y(
|
|
4087
|
+
originalHtml: _,
|
|
4088
|
+
proposedHtml: x,
|
|
4089
|
+
onCancel: C,
|
|
4090
|
+
onApply: w
|
|
4091
|
+
}) : /* @__PURE__ */ y(os, {
|
|
3831
4092
|
status: g,
|
|
3832
4093
|
errorMessage: h,
|
|
3833
|
-
originalHtml:
|
|
3834
|
-
proposedHtml:
|
|
4094
|
+
originalHtml: _,
|
|
4095
|
+
proposedHtml: S,
|
|
3835
4096
|
preset: f?.preset ?? "quick",
|
|
3836
|
-
onPresetChange:
|
|
3837
|
-
onCancel:
|
|
3838
|
-
onApply:
|
|
4097
|
+
onPresetChange: D,
|
|
4098
|
+
onCancel: C,
|
|
4099
|
+
onApply: E
|
|
3839
4100
|
})] }) : d;
|
|
3840
|
-
},
|
|
3841
|
-
let { height: t = "auto", minHeight: n, onChange: r, toolbar: i, theme: a, maxLength: o, onMaxLengthExceed: s, upload: c, ai: l } = e, [u] =
|
|
4101
|
+
}, us = [], ds = (e) => {
|
|
4102
|
+
let { height: t = "auto", minHeight: n, onChange: r, toolbar: i, theme: a, maxLength: o, onMaxLengthExceed: s, upload: c, ai: l } = e, [u] = R(), { isSourceMode: d, isSourceModeRef: f } = Hr(), p = j(null), m = j(null), h = j(/* @__PURE__ */ new Map()), g = j(null), _ = j(null), v = j(s);
|
|
3842
4103
|
v.current = s;
|
|
3843
|
-
let x =
|
|
3844
|
-
|
|
3845
|
-
let
|
|
3846
|
-
|
|
3847
|
-
let
|
|
3848
|
-
|
|
3849
|
-
}, []),
|
|
3850
|
-
|
|
3851
|
-
}, []),
|
|
3852
|
-
|
|
3853
|
-
}, []),
|
|
4104
|
+
let x = co(o) ? o : void 0, [S, C] = M(0), [w, E] = M(null), D = i?.mode === "floating", ee = x !== void 0 && !d, k = j(l);
|
|
4105
|
+
k.current = l;
|
|
4106
|
+
let te = j(r);
|
|
4107
|
+
te.current = r;
|
|
4108
|
+
let N = T((e) => {
|
|
4109
|
+
k.current?.typeset?.(e);
|
|
4110
|
+
}, []), ne = T((e) => {
|
|
4111
|
+
k.current?.polish?.(e);
|
|
4112
|
+
}, []), re = T(() => {
|
|
4113
|
+
k.current?.stop?.();
|
|
4114
|
+
}, []), ie = !!l?.typeset, P = !!l?.polish, ae = A(() => ({
|
|
3854
4115
|
containerRef: p,
|
|
3855
4116
|
toolbarRef: m,
|
|
3856
4117
|
upload: c,
|
|
@@ -3858,20 +4119,20 @@ var Zo = ({ maxLength: e, onMaxLengthExceed: t }) => {
|
|
|
3858
4119
|
setAiOpen: E,
|
|
3859
4120
|
aiSessionRef: g,
|
|
3860
4121
|
attachmentsBySrcRef: h,
|
|
3861
|
-
typeset:
|
|
3862
|
-
polish:
|
|
3863
|
-
stop:
|
|
3864
|
-
canTypeset:
|
|
3865
|
-
canPolish:
|
|
4122
|
+
typeset: N,
|
|
4123
|
+
polish: ne,
|
|
4124
|
+
stop: re,
|
|
4125
|
+
canTypeset: ie,
|
|
4126
|
+
canPolish: P
|
|
3866
4127
|
}), [
|
|
3867
4128
|
w,
|
|
3868
|
-
|
|
4129
|
+
P,
|
|
4130
|
+
ie,
|
|
3869
4131
|
ne,
|
|
3870
|
-
|
|
3871
|
-
|
|
3872
|
-
F,
|
|
4132
|
+
re,
|
|
4133
|
+
N,
|
|
3873
4134
|
c
|
|
3874
|
-
]),
|
|
4135
|
+
]), oe = A(() => ({
|
|
3875
4136
|
text: l?.text ?? "",
|
|
3876
4137
|
status: l?.status,
|
|
3877
4138
|
errorMessage: l?.errorMessage
|
|
@@ -3879,12 +4140,12 @@ var Zo = ({ maxLength: e, onMaxLengthExceed: t }) => {
|
|
|
3879
4140
|
l?.text,
|
|
3880
4141
|
l?.status,
|
|
3881
4142
|
l?.errorMessage
|
|
3882
|
-
]),
|
|
4143
|
+
]), se = T((e) => {
|
|
3883
4144
|
f.current || e.read(() => {
|
|
3884
|
-
let t =
|
|
4145
|
+
let t = F().getTextContent(), n = Yi(X(ge(u, null))), r = xi(n, t) ? null : n;
|
|
3885
4146
|
_.current = r, x !== void 0 && C(t.length);
|
|
3886
|
-
let i =
|
|
3887
|
-
|
|
4147
|
+
let i = Me(nn).map((e) => h.current.get(e.getSrc())).filter((e) => e !== void 0);
|
|
4148
|
+
te.current({
|
|
3888
4149
|
text: t,
|
|
3889
4150
|
html: r,
|
|
3890
4151
|
attachments: i
|
|
@@ -3897,7 +4158,7 @@ var Zo = ({ maxLength: e, onMaxLengthExceed: t }) => {
|
|
|
3897
4158
|
]);
|
|
3898
4159
|
O(() => {
|
|
3899
4160
|
x === void 0 || d || u.getEditorState().read(() => {
|
|
3900
|
-
C(
|
|
4161
|
+
C(F().getTextContentSize());
|
|
3901
4162
|
}, { editor: u });
|
|
3902
4163
|
}, [
|
|
3903
4164
|
u,
|
|
@@ -3908,33 +4169,33 @@ var Zo = ({ maxLength: e, onMaxLengthExceed: t }) => {
|
|
|
3908
4169
|
if (f.current) {
|
|
3909
4170
|
let t = e.value?.trim() ? X(e.value) : "";
|
|
3910
4171
|
_.current = e.value, u.update(() => {
|
|
3911
|
-
|
|
4172
|
+
So(xo(t));
|
|
3912
4173
|
});
|
|
3913
4174
|
return;
|
|
3914
4175
|
}
|
|
3915
4176
|
let t = !1, n = _.current === null;
|
|
3916
4177
|
u.update(() => {
|
|
3917
|
-
|
|
3918
|
-
}), n && u.dispatchCommand(
|
|
4178
|
+
bi(u, e.value?.trim() ? X(e.value) : ""), x !== void 0 && (t = lo(u, x)), On(u);
|
|
4179
|
+
}), n && u.dispatchCommand(Re, void 0), t && v.current?.();
|
|
3919
4180
|
}, [
|
|
3920
4181
|
e.value,
|
|
3921
4182
|
u,
|
|
3922
4183
|
x,
|
|
3923
4184
|
f
|
|
3924
4185
|
]);
|
|
3925
|
-
let
|
|
4186
|
+
let ce = i?.config?.length ? i.config : us, le = T(() => {
|
|
3926
4187
|
v.current?.();
|
|
3927
4188
|
}, []);
|
|
3928
|
-
return /* @__PURE__ */ y(
|
|
3929
|
-
value:
|
|
3930
|
-
children: /* @__PURE__ */ y(
|
|
3931
|
-
value:
|
|
3932
|
-
children: /* @__PURE__ */ b(
|
|
4189
|
+
return /* @__PURE__ */ y(dr.Provider, {
|
|
4190
|
+
value: ae,
|
|
4191
|
+
children: /* @__PURE__ */ y(fr.Provider, {
|
|
4192
|
+
value: oe,
|
|
4193
|
+
children: /* @__PURE__ */ b(pr.Provider, {
|
|
3933
4194
|
value: l?.reasoning,
|
|
3934
|
-
children: [/* @__PURE__ */ y(
|
|
4195
|
+
children: [/* @__PURE__ */ y(fs, {
|
|
3935
4196
|
containerRef: p,
|
|
3936
4197
|
isFloating: D,
|
|
3937
|
-
toolbarConfig:
|
|
4198
|
+
toolbarConfig: ce,
|
|
3938
4199
|
toolbarTheme: a?.toolbar,
|
|
3939
4200
|
containerTheme: a?.container,
|
|
3940
4201
|
toolbarStyle: i?.style,
|
|
@@ -3944,34 +4205,34 @@ var Zo = ({ maxLength: e, onMaxLengthExceed: t }) => {
|
|
|
3944
4205
|
toolbarStickyOffset: i?.stickyOffset,
|
|
3945
4206
|
height: t,
|
|
3946
4207
|
minHeight: n,
|
|
3947
|
-
showLengthBadge:
|
|
4208
|
+
showLengthBadge: ee,
|
|
3948
4209
|
textLength: S,
|
|
3949
4210
|
validMaxLength: x,
|
|
3950
|
-
onMaxLengthExceed:
|
|
3951
|
-
onChange:
|
|
3952
|
-
}), /* @__PURE__ */ y(
|
|
4211
|
+
onMaxLengthExceed: le,
|
|
4212
|
+
onChange: se
|
|
4213
|
+
}), /* @__PURE__ */ y(ls, {
|
|
3953
4214
|
maxLength: x,
|
|
3954
|
-
onMaxLengthExceed:
|
|
4215
|
+
onMaxLengthExceed: le
|
|
3955
4216
|
})]
|
|
3956
4217
|
})
|
|
3957
4218
|
})
|
|
3958
4219
|
});
|
|
3959
|
-
},
|
|
3960
|
-
let [_] =
|
|
4220
|
+
}, fs = w(function({ containerRef: e, isFloating: t, toolbarConfig: n, toolbarTheme: r, containerTheme: i, toolbarStyle: a, toolbarSize: o, toolbarMode: s, toolbarFloating: c, toolbarStickyOffset: l, height: u, minHeight: d, showLengthBadge: f, textLength: p, validMaxLength: m, onMaxLengthExceed: h, onChange: g }) {
|
|
4221
|
+
let [_] = R(), v = Qt(), x = typeof u == "number" ? u : void 0, S = !t && x === void 0 && l !== void 0, C = j(!1);
|
|
3961
4222
|
O(() => {
|
|
3962
4223
|
v && C.current && (C.current = !1, _.focus());
|
|
3963
4224
|
}, [v, _]);
|
|
3964
|
-
let w =
|
|
4225
|
+
let w = A(() => ka(i), [i]);
|
|
3965
4226
|
return /* @__PURE__ */ b("div", {
|
|
3966
4227
|
ref: e,
|
|
3967
|
-
className:
|
|
4228
|
+
className: P("bsy-lexical-editor", $["bsy-lexical-editor"], t && $["bsy-lexical-editor--floating"], S && $["bsy-lexical-editor--sticky-toolbar"]),
|
|
3968
4229
|
style: w,
|
|
3969
4230
|
onClick: (e) => {
|
|
3970
4231
|
let t = _.getRootElement(), n = e.target;
|
|
3971
4232
|
!t || !n || !t.contains(n) || _.isEditable() || (C.current = !0, _.setEditable(!0));
|
|
3972
4233
|
},
|
|
3973
4234
|
children: [
|
|
3974
|
-
n && n.length > 0 ? /* @__PURE__ */ y(
|
|
4235
|
+
n && n.length > 0 ? /* @__PURE__ */ y(Da, {
|
|
3975
4236
|
config: n,
|
|
3976
4237
|
theme: r,
|
|
3977
4238
|
style: a,
|
|
@@ -3981,56 +4242,56 @@ var Zo = ({ maxLength: e, onMaxLengthExceed: t }) => {
|
|
|
3981
4242
|
stickyOffset: S ? l : void 0
|
|
3982
4243
|
}) : null,
|
|
3983
4244
|
/* @__PURE__ */ b("div", {
|
|
3984
|
-
className:
|
|
4245
|
+
className: P($["bsy-lexical-editor__body"], x !== void 0 && $["bsy-lexical-editor__body--fixed"]),
|
|
3985
4246
|
style: { height: x },
|
|
3986
4247
|
children: [/* @__PURE__ */ y("div", {
|
|
3987
4248
|
className: $["bsy-lexical-editor__editable-wrap"],
|
|
3988
|
-
children: /* @__PURE__ */ y(
|
|
3989
|
-
contentEditable: /* @__PURE__ */ y(
|
|
4249
|
+
children: /* @__PURE__ */ y(de, {
|
|
4250
|
+
contentEditable: /* @__PURE__ */ y(fe, {
|
|
3990
4251
|
className: $["bsy-lexical-editor__content-editable"],
|
|
3991
4252
|
style: {
|
|
3992
4253
|
minHeight: x === void 0 ? d : void 0,
|
|
3993
4254
|
cursor: v ? "auto" : "text"
|
|
3994
4255
|
}
|
|
3995
4256
|
}),
|
|
3996
|
-
ErrorBoundary:
|
|
4257
|
+
ErrorBoundary: he
|
|
3997
4258
|
})
|
|
3998
|
-
}), f && m !== void 0 ? /* @__PURE__ */ y(
|
|
4259
|
+
}), f && m !== void 0 ? /* @__PURE__ */ y(Eo, {
|
|
3999
4260
|
current: p,
|
|
4000
4261
|
maxLength: m
|
|
4001
4262
|
}) : null]
|
|
4002
4263
|
}),
|
|
4003
|
-
/* @__PURE__ */ y(Qt, {}),
|
|
4004
4264
|
/* @__PURE__ */ y($t, {}),
|
|
4005
|
-
/* @__PURE__ */ y(
|
|
4006
|
-
/* @__PURE__ */ y(
|
|
4007
|
-
/* @__PURE__ */ y(
|
|
4008
|
-
/* @__PURE__ */ y(
|
|
4009
|
-
/* @__PURE__ */ y(
|
|
4010
|
-
/* @__PURE__ */ y(
|
|
4011
|
-
/* @__PURE__ */ y(
|
|
4012
|
-
/* @__PURE__ */ y(
|
|
4013
|
-
|
|
4265
|
+
/* @__PURE__ */ y(en, {}),
|
|
4266
|
+
/* @__PURE__ */ y(Fa, {}),
|
|
4267
|
+
/* @__PURE__ */ y(To, {}),
|
|
4268
|
+
/* @__PURE__ */ y(Ia, {}),
|
|
4269
|
+
/* @__PURE__ */ y(za, {}),
|
|
4270
|
+
/* @__PURE__ */ y(Ba, {}),
|
|
4271
|
+
/* @__PURE__ */ y(ro, {}),
|
|
4272
|
+
/* @__PURE__ */ y(io, {}),
|
|
4273
|
+
/* @__PURE__ */ y(oo, {}),
|
|
4274
|
+
f && m !== void 0 ? /* @__PURE__ */ y(so, {
|
|
4014
4275
|
maxLength: m,
|
|
4015
4276
|
onMaxLengthExceed: h
|
|
4016
4277
|
}) : null,
|
|
4017
|
-
/* @__PURE__ */ y(
|
|
4018
|
-
/* @__PURE__ */ y(
|
|
4278
|
+
/* @__PURE__ */ y(pe, {}),
|
|
4279
|
+
/* @__PURE__ */ y(me, {
|
|
4019
4280
|
onChange: g,
|
|
4020
4281
|
ignoreSelectionChange: !0,
|
|
4021
4282
|
ignoreHistoryMergeTagChange: !1
|
|
4022
4283
|
})
|
|
4023
4284
|
]
|
|
4024
4285
|
});
|
|
4025
|
-
}),
|
|
4286
|
+
}), ps = (e) => /* @__PURE__ */ y(Co, {
|
|
4026
4287
|
maxLength: e.maxLength,
|
|
4027
4288
|
onMaxLengthExceed: e.onMaxLengthExceed,
|
|
4028
|
-
children: /* @__PURE__ */ y(
|
|
4289
|
+
children: /* @__PURE__ */ y(ds, { ...e })
|
|
4029
4290
|
});
|
|
4030
|
-
|
|
4291
|
+
ps.displayName = "BsyLexicalEditorCore";
|
|
4031
4292
|
//#endregion
|
|
4032
4293
|
//#region src/components/Editor/nodes/ExtendedLinkNode.ts
|
|
4033
|
-
var
|
|
4294
|
+
var ms = class e extends pt {
|
|
4034
4295
|
constructor(e = "", t = {}, n) {
|
|
4035
4296
|
super(e, t, n);
|
|
4036
4297
|
}
|
|
@@ -4045,18 +4306,18 @@ var ns = class e extends ft {
|
|
|
4045
4306
|
}, t.__key);
|
|
4046
4307
|
}
|
|
4047
4308
|
static importJSON(e) {
|
|
4048
|
-
return
|
|
4309
|
+
return hs().updateFromJSON(e);
|
|
4049
4310
|
}
|
|
4050
4311
|
sanitizeUrl(e) {
|
|
4051
4312
|
return e.startsWith("@") ? e : super.sanitizeUrl(e);
|
|
4052
4313
|
}
|
|
4053
|
-
},
|
|
4314
|
+
}, hs = (e = "", t = {}) => ve(new ms(e, t)), gs = "1px solid #d9d9d9", _s = { export: new Map([[zt, (e, t) => {
|
|
4054
4315
|
let n = t.exportDOM(e);
|
|
4055
|
-
return
|
|
4056
|
-
}]]) },
|
|
4316
|
+
return ot(n.element) && (n.element.style.border = gs), n;
|
|
4317
|
+
}]]) }, vs = (e) => {
|
|
4057
4318
|
let { autoFocus: t = !1 } = e;
|
|
4058
|
-
return /* @__PURE__ */ y(
|
|
4059
|
-
initialConfig:
|
|
4319
|
+
return /* @__PURE__ */ y(ue, {
|
|
4320
|
+
initialConfig: A(() => ({
|
|
4060
4321
|
namespace: "bsyLexicalEditor",
|
|
4061
4322
|
onError: (e) => {
|
|
4062
4323
|
console.error("Lexical error", e);
|
|
@@ -4092,39 +4353,39 @@ var ns = class e extends ft {
|
|
|
4092
4353
|
tableRow: "editor-table-row",
|
|
4093
4354
|
tableScrollableWrapper: "editor-table-scrollable-wrapper"
|
|
4094
4355
|
},
|
|
4095
|
-
html:
|
|
4356
|
+
html: _s,
|
|
4096
4357
|
nodes: [
|
|
4097
|
-
|
|
4358
|
+
ms,
|
|
4098
4359
|
{
|
|
4099
|
-
replace:
|
|
4100
|
-
with: (e) => new
|
|
4360
|
+
replace: pt,
|
|
4361
|
+
with: (e) => new ms(e.__url, {
|
|
4101
4362
|
rel: e.__rel,
|
|
4102
4363
|
target: e.__target,
|
|
4103
4364
|
title: e.__title
|
|
4104
4365
|
}),
|
|
4105
|
-
withKlass:
|
|
4366
|
+
withKlass: ms
|
|
4106
4367
|
},
|
|
4107
|
-
|
|
4368
|
+
ft,
|
|
4369
|
+
bt,
|
|
4108
4370
|
yt,
|
|
4109
|
-
|
|
4110
|
-
|
|
4371
|
+
Jt,
|
|
4372
|
+
Dt,
|
|
4111
4373
|
Et,
|
|
4112
|
-
Tt,
|
|
4113
|
-
zt,
|
|
4114
4374
|
Bt,
|
|
4115
|
-
|
|
4116
|
-
|
|
4117
|
-
|
|
4375
|
+
Vt,
|
|
4376
|
+
zt,
|
|
4377
|
+
nn,
|
|
4378
|
+
Aa,
|
|
4118
4379
|
{
|
|
4119
|
-
replace:
|
|
4120
|
-
with: (e) => new
|
|
4121
|
-
withKlass:
|
|
4380
|
+
replace: rt,
|
|
4381
|
+
with: (e) => new Aa(e.__text),
|
|
4382
|
+
withKlass: Aa
|
|
4122
4383
|
}
|
|
4123
4384
|
]
|
|
4124
4385
|
}), [t]),
|
|
4125
|
-
children: /* @__PURE__ */ y(
|
|
4386
|
+
children: /* @__PURE__ */ y(ps, { ...e })
|
|
4126
4387
|
});
|
|
4127
4388
|
};
|
|
4128
|
-
|
|
4389
|
+
vs.displayName = "BsyLexicalEditor";
|
|
4129
4390
|
//#endregion
|
|
4130
|
-
export {
|
|
4391
|
+
export { Te as $getRoot, q as BaseButton, rs as EditorHtmlPreview, vs as default, ya as listRegisteredToolbarButtons, ga as registerToolbarButton, _a as unregisterToolbarButton, ct as useLexicalComposerContext };
|