@baishuyun/ui-base 6.13.0 → 6.14.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Amap/AmapCircle/index.js +1 -1
- package/dist/Amap/AmapMarker/index.js +1 -1
- package/dist/Amap/AmapMarkerCluster/index.js +1 -1
- package/dist/Amap/AmapProvider/index.js +1 -1
- package/dist/Amap/hooks/index.js +1 -1
- package/dist/Amap/index.js +1 -1
- package/dist/Calendar/{Calendar-DEjopu9G.js → Calendar-DpANgMxX.js} +1 -1
- package/dist/Calendar/context/index.js +1 -1
- package/dist/Calendar/index.js +3 -3
- package/dist/Calendar/subcomponents/AllDaySection/index.js +1 -1
- package/dist/Calendar/subcomponents/CurrentTimeIndicator/index.js +1 -1
- package/dist/Calendar/subcomponents/EventCard/index.js +1 -1
- package/dist/Calendar/subcomponents/TimeAxis/index.js +1 -1
- package/dist/Calendar/subcomponents/TimeGrid/index.js +1 -1
- package/dist/Calendar/utils/index.js +1 -1
- package/dist/Calendar/utils/layout/index.js +1 -1
- package/dist/Calendar/utils/theme/index.js +1 -1
- 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-BUvDkVjx.js → DatePicker-Sl-c8f3e.js} +1 -1
- package/dist/DatePicker/{DatePickerPanel-BHTPcE6R.js → DatePickerPanel-Bbz1ISVO.js} +1 -1
- package/dist/DatePicker/index.js +2 -2
- package/dist/DatePicker/style/index.js +1 -1
- package/dist/DropDown/index.js +1 -1
- package/dist/DropDown/style/index.js +1 -1
- package/dist/Editor/{Buttons-BUC9qQY1.js → Buttons-C6whbXgn.js} +69 -61
- package/dist/Editor/ToolbarPlugin/Buttons/index.js +2 -2
- package/dist/Editor/constants/index.js +1 -1
- package/dist/Editor/index.js +623 -616
- package/dist/Gantt/GanttChart/index.js +1 -1
- package/dist/Gantt/GanttTable/index.js +1 -1
- package/dist/Gantt/GanttToolBar/index.js +1 -1
- package/dist/Gantt/index.js +1 -1
- package/dist/Gantt/utils/index.js +1 -1
- package/dist/Gantt/utils/theme/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/index.js +1 -1
- package/dist/Select/index.js +1 -1
- package/dist/Table/hooks/index.js +1 -1
- package/dist/Table/index.js +1 -1
- package/dist/Table/style/index.js +1 -1
- package/dist/Table/utils/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/Tree/utils/index.js +1 -1
- package/dist/components/Editor/index.d.ts +1 -1
- package/dist/components/Editor/interface.d.ts +11 -0
- package/dist/components/Editor/utils/resolveEditorContainerThemeVars.d.ts +3 -0
- package/dist/index.js +3 -3
- package/dist/style.css +1 -1
- package/dist/vendors/{version-B14EcH7v.js → version-D17a2Lcy.js} +1 -1
- package/package.json +1 -1
package/dist/Editor/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import "../vendors/version-
|
|
1
|
+
import "../vendors/version-D17a2Lcy.js";
|
|
2
2
|
import "../ScrollBar/style-D26azwz6.js";
|
|
3
3
|
import { t as e } from "../Icon/Icon-DDHx0R18.js";
|
|
4
4
|
import "../vendors/LocaleContext-w5ODGcJX.js";
|
|
@@ -17,35 +17,35 @@ import { t as i } from "../ScrollBar/ScrollBar-N2pOLv-8.js";
|
|
|
17
17
|
import "../vendors/useFloatingPortal-B3N1viK2.js";
|
|
18
18
|
import { t as a } from "../DropDown/DropDown-DV1IuuQD.js";
|
|
19
19
|
import "../DropDown/style-LLDVPpPa.js";
|
|
20
|
-
import { A as o, B as s, C as c, D as l, E as u, F as d, I as f, L as p, M as m, N as h, O as g, P as _, R as v, S as y, T as b, _ as x, a as S, b as C, c as w, d as
|
|
21
|
-
import { DEFAULT_BACKGROUND_COLOR as
|
|
22
|
-
import { dropRightWhile as
|
|
23
|
-
import { Fragment as
|
|
24
|
-
import
|
|
25
|
-
import { Button as
|
|
26
|
-
import
|
|
27
|
-
import { useDocumentVisibility as
|
|
28
|
-
import { AnimatePresence as
|
|
29
|
-
import { LexicalComposer as
|
|
30
|
-
import { RichTextPlugin as
|
|
31
|
-
import { ContentEditable as
|
|
32
|
-
import { HistoryPlugin as
|
|
33
|
-
import { OnChangePlugin as
|
|
34
|
-
import { LexicalErrorBoundary as
|
|
35
|
-
import { $generateHtmlFromNodes as
|
|
36
|
-
import { $applyNodeReplacement as
|
|
37
|
-
import { useLexicalComposerContext as
|
|
38
|
-
import { $getSelectionStyleValueForProperty as
|
|
39
|
-
import { $findMatchingParent as
|
|
40
|
-
import { $isLinkNode as
|
|
41
|
-
import { $isListItemNode as
|
|
42
|
-
import { $createCodeHighlightNode as
|
|
43
|
-
import { $findCellNode as
|
|
44
|
-
import { $isHeadingNode as
|
|
45
|
-
import { useLexicalEditable as
|
|
46
|
-
import { LinkPlugin as
|
|
47
|
-
import { ListPlugin as
|
|
48
|
-
var
|
|
20
|
+
import { A as o, B as s, C as c, D as l, E as u, F as d, I as f, L as p, M as m, N as h, O as g, P as _, R as v, S as y, T as b, _ as x, a as S, b as C, c as w, d as ee, f as T, g as E, h as D, i as O, j as k, k as A, l as te, m as ne, n as re, o as j, p as ie, r as ae, s as oe, u as se, v as ce, w as le, x as ue, y as de, z as fe } from "./Buttons-C6whbXgn.js";
|
|
21
|
+
import { DEFAULT_BACKGROUND_COLOR as pe, DEFAULT_FONT_COLOR as me, DEFAULT_FONT_SIZE as he } from "./constants/index.js";
|
|
22
|
+
import { dropRightWhile as ge, dropWhile as _e, omit as ve } from "lodash-es";
|
|
23
|
+
import { Fragment as ye, jsx as M, jsxs as N } from "react/jsx-runtime";
|
|
24
|
+
import be, { forwardRef as xe, memo as Se, useCallback as P, useDeferredValue as Ce, useEffect as F, useId as we, useLayoutEffect as Te, useMemo as I, useRef as L, useState as R } from "react";
|
|
25
|
+
import { Button as Ee, message as De } from "antd";
|
|
26
|
+
import z from "clsx";
|
|
27
|
+
import { useDocumentVisibility as Oe, useEventListener as ke } from "ahooks";
|
|
28
|
+
import { AnimatePresence as Ae, motion as je, useReducedMotion as Me } from "motion/react";
|
|
29
|
+
import { LexicalComposer as Ne } from "@lexical/react/LexicalComposer";
|
|
30
|
+
import { RichTextPlugin as Pe } from "@lexical/react/LexicalRichTextPlugin";
|
|
31
|
+
import { ContentEditable as Fe } from "@lexical/react/LexicalContentEditable";
|
|
32
|
+
import { HistoryPlugin as Ie } from "@lexical/react/LexicalHistoryPlugin";
|
|
33
|
+
import { OnChangePlugin as Le } from "@lexical/react/LexicalOnChangePlugin";
|
|
34
|
+
import { LexicalErrorBoundary as Re } from "@lexical/react/LexicalErrorBoundary";
|
|
35
|
+
import { $generateHtmlFromNodes as ze, $generateNodesFromDOM as Be } from "@lexical/html";
|
|
36
|
+
import { $applyNodeReplacement as Ve, $createLineBreakNode as He, $createParagraphNode as Ue, $createTabNode as We, $createTextNode as Ge, $getNearestNodeFromDOMNode as Ke, $getNodeByKey as B, $getRoot as qe, $getRoot as V, $getSelection as H, $insertNodes as Je, $isElementNode as Ye, $isLineBreakNode as Xe, $isRangeSelection as U, $isRootOrShadowRoot as Ze, $isTabNode as Qe, $isTextNode as $e, $nodesOfType as et, $onUpdate as tt, $setSelection as nt, CLEAR_HISTORY_COMMAND as rt, COMMAND_PRIORITY_CRITICAL as it, COMMAND_PRIORITY_EDITOR as at, COMMAND_PRIORITY_HIGH as ot, COMMAND_PRIORITY_LOW as st, DROP_COMMAND as ct, DecoratorNode as lt, HISTORY_MERGE_TAG as ut, INDENT_CONTENT_COMMAND as dt, KEY_ENTER_COMMAND as ft, KEY_TAB_COMMAND as pt, PASTE_COMMAND as mt, PASTE_TAG as ht, RootNode as gt, TextNode as _t, isHTMLElement as vt, mergeRegister as yt } from "lexical";
|
|
37
|
+
import { useLexicalComposerContext as bt, useLexicalComposerContext as W } from "@lexical/react/LexicalComposerContext";
|
|
38
|
+
import { $getSelectionStyleValueForProperty as xt, $patchStyleText as St, $trimTextContentFromAnchor as Ct } from "@lexical/selection";
|
|
39
|
+
import { $findMatchingParent as G, $restoreEditorState as wt, mergeRegister as Tt } from "@lexical/utils";
|
|
40
|
+
import { $isLinkNode as Et, AutoLinkNode as Dt, LinkNode as Ot } from "@lexical/link";
|
|
41
|
+
import { $isListItemNode as K, $isListNode as kt, ListItemNode as At, ListNode as jt } from "@lexical/list";
|
|
42
|
+
import { $createCodeHighlightNode as Mt, $createCodeNode as Nt, $isCodeHighlightNode as Pt, $isCodeNode as q, $plainifyCodeContent as Ft, CodeHighlightNode as It, CodeNode as Lt, registerCodeIndentation as Rt } from "@lexical/code-core";
|
|
43
|
+
import { $findCellNode as zt, $isTableCellNode as Bt, $isTableNode as Vt, $isTableRowNode as Ht, $isTableSelection as Ut, TableCellNode as Wt, TableNode as Gt, TableRowNode as Kt, registerTableCellUnmergeTransform as qt, registerTablePlugin as Jt, registerTableSelectionObserver as Yt, setScrollableTablesActive as Xt } from "@lexical/table";
|
|
44
|
+
import { $isHeadingNode as Zt, HeadingNode as Qt } from "@lexical/rich-text";
|
|
45
|
+
import { useLexicalEditable as $t } from "@lexical/react/useLexicalEditable";
|
|
46
|
+
import { LinkPlugin as en } from "@lexical/react/LexicalLinkPlugin";
|
|
47
|
+
import { ListPlugin as tn } from "@lexical/react/LexicalListPlugin";
|
|
48
|
+
var J = {
|
|
49
49
|
imageWrapper: "_imageWrapper_y06h3_1",
|
|
50
50
|
selected: "_selected_y06h3_8",
|
|
51
51
|
resizing: "_resizing_y06h3_12",
|
|
@@ -55,16 +55,16 @@ var Y = {
|
|
|
55
55
|
topRight: "_topRight_y06h3_49",
|
|
56
56
|
bottomLeft: "_bottomLeft_y06h3_54",
|
|
57
57
|
bottomRight: "_bottomRight_y06h3_59"
|
|
58
|
-
},
|
|
59
|
-
let [a] =
|
|
58
|
+
}, nn = ({ src: e, altText: t, width: n, height: r, nodeKey: i }) => {
|
|
59
|
+
let [a] = W(), [o, s] = R(!1), [c, l] = R(null), u = L(null), [d, f] = R({
|
|
60
60
|
width: n || void 0,
|
|
61
61
|
height: r || void 0
|
|
62
|
-
}), p =
|
|
62
|
+
}), p = P(() => {
|
|
63
63
|
n && r && f({
|
|
64
64
|
width: n,
|
|
65
65
|
height: r
|
|
66
66
|
});
|
|
67
|
-
}, [n, r]), m =
|
|
67
|
+
}, [n, r]), m = P((e, t) => {
|
|
68
68
|
if (e.preventDefault(), e.stopPropagation(), !u.current) return;
|
|
69
69
|
let n = d.width || u.current.offsetWidth, r = d.height || u.current.offsetHeight, i = n / r;
|
|
70
70
|
(!d.width || !d.height) && f({
|
|
@@ -79,7 +79,7 @@ var Y = {
|
|
|
79
79
|
aspectRatio: i,
|
|
80
80
|
direction: t
|
|
81
81
|
});
|
|
82
|
-
}, [d]), h =
|
|
82
|
+
}, [d]), h = P((e) => {
|
|
83
83
|
if (!c?.isResizing) return;
|
|
84
84
|
let t = e.clientX - c.startX, n;
|
|
85
85
|
switch (c.direction) {
|
|
@@ -102,10 +102,10 @@ var Y = {
|
|
|
102
102
|
width: n,
|
|
103
103
|
height: r
|
|
104
104
|
});
|
|
105
|
-
}, [c]), g =
|
|
105
|
+
}, [c]), g = P(() => {
|
|
106
106
|
c?.isResizing && (a.update(() => {
|
|
107
|
-
let e =
|
|
108
|
-
|
|
107
|
+
let e = B(i);
|
|
108
|
+
on(e) && e.setWidthAndHeight(d.width, d.height);
|
|
109
109
|
}), l(null));
|
|
110
110
|
}, [
|
|
111
111
|
a,
|
|
@@ -113,7 +113,7 @@ var Y = {
|
|
|
113
113
|
d,
|
|
114
114
|
c
|
|
115
115
|
]);
|
|
116
|
-
|
|
116
|
+
be.useEffect(() => {
|
|
117
117
|
if (c?.isResizing) return document.addEventListener("mousemove", h), document.addEventListener("mouseup", g), () => {
|
|
118
118
|
document.removeEventListener("mousemove", h), document.removeEventListener("mouseup", g);
|
|
119
119
|
};
|
|
@@ -122,35 +122,35 @@ var Y = {
|
|
|
122
122
|
h,
|
|
123
123
|
g
|
|
124
124
|
]);
|
|
125
|
-
let _ =
|
|
125
|
+
let _ = P(() => {
|
|
126
126
|
s(!0);
|
|
127
127
|
}, []);
|
|
128
|
-
return
|
|
128
|
+
return F(() => a.registerUpdateListener(({ editorState: e }) => {
|
|
129
129
|
e.read(() => {
|
|
130
|
-
let e =
|
|
131
|
-
|
|
130
|
+
let e = H();
|
|
131
|
+
U(e) && !e.getNodes().some((e) => e.getKey() === i || e.getParent() && e.getParent()?.getKey() === i) && o && s(!1);
|
|
132
132
|
});
|
|
133
133
|
}), [
|
|
134
134
|
a,
|
|
135
135
|
i,
|
|
136
136
|
o
|
|
137
|
-
]),
|
|
137
|
+
]), F(() => {
|
|
138
138
|
let e = (e) => {
|
|
139
139
|
o && u.current && !u.current.contains(e.target) && s(!1);
|
|
140
140
|
};
|
|
141
141
|
if (o) return document.addEventListener("mousedown", e), () => {
|
|
142
142
|
document.removeEventListener("mousedown", e);
|
|
143
143
|
};
|
|
144
|
-
}, [o]), /* @__PURE__ */
|
|
145
|
-
className:
|
|
146
|
-
[
|
|
147
|
-
[
|
|
144
|
+
}, [o]), /* @__PURE__ */ N("div", {
|
|
145
|
+
className: z(J.imageWrapper, {
|
|
146
|
+
[J.selected]: o,
|
|
147
|
+
[J.resizing]: c?.isResizing
|
|
148
148
|
}),
|
|
149
|
-
children: [/* @__PURE__ */
|
|
149
|
+
children: [/* @__PURE__ */ M("img", {
|
|
150
150
|
ref: u,
|
|
151
151
|
src: e,
|
|
152
152
|
alt: t,
|
|
153
|
-
className:
|
|
153
|
+
className: J.image,
|
|
154
154
|
style: {
|
|
155
155
|
width: d.width,
|
|
156
156
|
height: d.height
|
|
@@ -158,26 +158,26 @@ var Y = {
|
|
|
158
158
|
onLoad: p,
|
|
159
159
|
onClick: _,
|
|
160
160
|
draggable: !1
|
|
161
|
-
}), o && /* @__PURE__ */
|
|
162
|
-
/* @__PURE__ */
|
|
163
|
-
className:
|
|
161
|
+
}), o && /* @__PURE__ */ N(ye, { children: [
|
|
162
|
+
/* @__PURE__ */ M("div", {
|
|
163
|
+
className: z(J.resizeHandle, J.bottomRight),
|
|
164
164
|
onMouseDown: (e) => m(e, "bottom-right")
|
|
165
165
|
}),
|
|
166
|
-
/* @__PURE__ */
|
|
167
|
-
className:
|
|
166
|
+
/* @__PURE__ */ M("div", {
|
|
167
|
+
className: z(J.resizeHandle, J.bottomLeft),
|
|
168
168
|
onMouseDown: (e) => m(e, "bottom-left")
|
|
169
169
|
}),
|
|
170
|
-
/* @__PURE__ */
|
|
171
|
-
className:
|
|
170
|
+
/* @__PURE__ */ M("div", {
|
|
171
|
+
className: z(J.resizeHandle, J.topRight),
|
|
172
172
|
onMouseDown: (e) => m(e, "top-right")
|
|
173
173
|
}),
|
|
174
|
-
/* @__PURE__ */
|
|
175
|
-
className:
|
|
174
|
+
/* @__PURE__ */ M("div", {
|
|
175
|
+
className: z(J.resizeHandle, J.topLeft),
|
|
176
176
|
onMouseDown: (e) => m(e, "top-left")
|
|
177
177
|
})
|
|
178
178
|
] })]
|
|
179
179
|
});
|
|
180
|
-
},
|
|
180
|
+
}, rn = class e extends lt {
|
|
181
181
|
static getType() {
|
|
182
182
|
return "image";
|
|
183
183
|
}
|
|
@@ -223,7 +223,7 @@ var Y = {
|
|
|
223
223
|
n.__width = e, n.__height = t;
|
|
224
224
|
}
|
|
225
225
|
decorate() {
|
|
226
|
-
return /* @__PURE__ */
|
|
226
|
+
return /* @__PURE__ */ M(nn, {
|
|
227
227
|
src: this.__src,
|
|
228
228
|
altText: this.__altText,
|
|
229
229
|
width: this.__width,
|
|
@@ -233,13 +233,13 @@ var Y = {
|
|
|
233
233
|
}
|
|
234
234
|
static importDOM() {
|
|
235
235
|
return { img: () => ({
|
|
236
|
-
conversion:
|
|
236
|
+
conversion: sn,
|
|
237
237
|
priority: 0
|
|
238
238
|
}) };
|
|
239
239
|
}
|
|
240
240
|
static importJSON(e) {
|
|
241
241
|
let { src: t, altText: n, width: r, height: i } = e;
|
|
242
|
-
return
|
|
242
|
+
return an({
|
|
243
243
|
src: t,
|
|
244
244
|
altText: n,
|
|
245
245
|
width: r,
|
|
@@ -260,13 +260,13 @@ var Y = {
|
|
|
260
260
|
return !0;
|
|
261
261
|
}
|
|
262
262
|
};
|
|
263
|
-
function
|
|
264
|
-
return new
|
|
265
|
-
}
|
|
266
|
-
function an(e) {
|
|
267
|
-
return e instanceof nn;
|
|
263
|
+
function an({ src: e, altText: t, width: n, height: r, key: i }) {
|
|
264
|
+
return new rn(e, t, n, r, i);
|
|
268
265
|
}
|
|
269
266
|
function on(e) {
|
|
267
|
+
return e instanceof rn;
|
|
268
|
+
}
|
|
269
|
+
function sn(e) {
|
|
270
270
|
if (e instanceof HTMLImageElement) {
|
|
271
271
|
let { src: t, alt: n, style: r } = e, i, a;
|
|
272
272
|
if (r.width) {
|
|
@@ -277,7 +277,7 @@ function on(e) {
|
|
|
277
277
|
let e = parseInt(r.height, 10);
|
|
278
278
|
isNaN(e) || (a = e);
|
|
279
279
|
}
|
|
280
|
-
return i === void 0 && e.width && (i = e.width), a === void 0 && e.height && (a = e.height), { node:
|
|
280
|
+
return i === void 0 && e.width && (i = e.width), a === void 0 && e.height && (a = e.height), { node: an({
|
|
281
281
|
src: t,
|
|
282
282
|
altText: n,
|
|
283
283
|
width: i,
|
|
@@ -288,24 +288,24 @@ function on(e) {
|
|
|
288
288
|
}
|
|
289
289
|
//#endregion
|
|
290
290
|
//#region src/components/Editor/utils/resolveEditorToolbarThemeVars.ts
|
|
291
|
-
var
|
|
291
|
+
var Y = (e) => {
|
|
292
292
|
if (!(e === void 0 || e === "")) return typeof e == "number" ? `${e}px` : e;
|
|
293
|
-
},
|
|
294
|
-
let n = s[t], i =
|
|
293
|
+
}, cn = (e, t = v) => {
|
|
294
|
+
let n = s[t], i = Y(e?.itemHeight) ?? `${n.itemHeight}px`, a = Y(e?.iconSize) ?? `${n.iconSize}px`, o = {
|
|
295
295
|
"--bsy-editor-toolbar-item-height": i,
|
|
296
296
|
"--bsy-editor-toolbar-icon-size": a,
|
|
297
297
|
"--bsy-editor-toolbar-divider-color": "#e0e0e0",
|
|
298
298
|
"--bsy-editor-toolbar-item-highlight-color": "#0265ff"
|
|
299
299
|
};
|
|
300
|
-
return e ? (r(o, "--bsy-editor-toolbar-bg", e.bg), r(o, "--bsy-editor-toolbar-border-color", e.borderColor), r(o, "--bsy-editor-toolbar-padding", e.padding), r(o, "--bsy-editor-toolbar-gap",
|
|
301
|
-
},
|
|
300
|
+
return e ? (r(o, "--bsy-editor-toolbar-bg", e.bg), r(o, "--bsy-editor-toolbar-border-color", e.borderColor), r(o, "--bsy-editor-toolbar-padding", e.padding), r(o, "--bsy-editor-toolbar-gap", Y(e.gap)), r(o, "--bsy-editor-toolbar-group-gap", Y(e.groupGap)), r(o, "--bsy-editor-toolbar-divider-color", e.dividerColor), r(o, "--bsy-editor-toolbar-divider-margin", Y(e.dividerMargin)), r(o, "--bsy-editor-toolbar-color-icon", e.colorIcon), r(o, "--bsy-editor-toolbar-item-hover-bg", e.itemHoverBg), r(o, "--bsy-editor-toolbar-item-hover-color", e.itemHoverColor), r(o, "--bsy-editor-toolbar-item-active-bg", e.itemActiveBg), r(o, "--bsy-editor-toolbar-item-active-color", e.itemActiveColor), r(o, "--bsy-editor-toolbar-item-highlight-color", e.itemHighlightColor), r(o, "--bsy-editor-toolbar-item-padding", Y(e.itemPadding)), r(o, "--bsy-editor-toolbar-item-border-radius", Y(e.itemBorderRadius)), o) : o;
|
|
301
|
+
}, ln = (e, t = v) => {
|
|
302
302
|
if (typeof e == "number" && Number.isFinite(e)) return e;
|
|
303
303
|
if (typeof e == "string") {
|
|
304
304
|
let t = Number.parseFloat(e);
|
|
305
305
|
if (Number.isFinite(t)) return t;
|
|
306
306
|
}
|
|
307
307
|
return s[t].iconSize;
|
|
308
|
-
},
|
|
308
|
+
}, un = (e) => {
|
|
309
309
|
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 = {
|
|
310
310
|
position: "absolute",
|
|
311
311
|
[a ? "bottom" : "top"]: "100%",
|
|
@@ -315,7 +315,7 @@ var X = (e) => {
|
|
|
315
315
|
width: "100%"
|
|
316
316
|
};
|
|
317
317
|
return r && (o.transform = `translateX(${r}px)`), o;
|
|
318
|
-
},
|
|
318
|
+
}, dn = (e, t, n, r) => {
|
|
319
319
|
if (e.length === 0 || t <= 0 || e.reduce((e, t, n) => e + t.width + (n > 0 ? r : 0), 0) <= t) return e.length;
|
|
320
320
|
let i = 0, a = 0;
|
|
321
321
|
for (let o = 0; o < e.length; o++) {
|
|
@@ -325,26 +325,26 @@ var X = (e) => {
|
|
|
325
325
|
}
|
|
326
326
|
for (; a > 0 && e[a - 1]?.isDivider;) --a;
|
|
327
327
|
return a;
|
|
328
|
-
},
|
|
328
|
+
}, fn = (e, t) => {
|
|
329
329
|
let n = (e) => e.kind === "divider";
|
|
330
330
|
return {
|
|
331
331
|
visible: e.slice(0, t),
|
|
332
|
-
overflow:
|
|
332
|
+
overflow: ge(_e(e.slice(t), n), n)
|
|
333
333
|
};
|
|
334
334
|
};
|
|
335
335
|
//#endregion
|
|
336
336
|
//#region src/components/Editor/hooks/useTextFormatsState.ts
|
|
337
|
-
function
|
|
338
|
-
let [e] =
|
|
337
|
+
function pn() {
|
|
338
|
+
let [e] = W(), [t, n] = R({
|
|
339
339
|
bold: !1,
|
|
340
340
|
italic: !1,
|
|
341
341
|
underline: !1,
|
|
342
342
|
strikethrough: !1,
|
|
343
343
|
superscript: !1,
|
|
344
344
|
subscript: !1,
|
|
345
|
-
fontSize:
|
|
346
|
-
fontColor:
|
|
347
|
-
backgroundColor:
|
|
345
|
+
fontSize: he,
|
|
346
|
+
fontColor: me,
|
|
347
|
+
backgroundColor: pe,
|
|
348
348
|
align: "left",
|
|
349
349
|
listType: !1,
|
|
350
350
|
canOutdent: !1,
|
|
@@ -355,10 +355,10 @@ function fn() {
|
|
|
355
355
|
hasEditorText: !1,
|
|
356
356
|
link: void 0
|
|
357
357
|
});
|
|
358
|
-
return
|
|
358
|
+
return F(() => e.registerUpdateListener(({ editorState: e }) => {
|
|
359
359
|
e.read(() => {
|
|
360
|
-
let e =
|
|
361
|
-
if (
|
|
360
|
+
let e = H(), t = !!V().getTextContent().trim();
|
|
361
|
+
if (Ut(e)) {
|
|
362
362
|
n((e) => ({
|
|
363
363
|
...e,
|
|
364
364
|
isCodeBlock: !1,
|
|
@@ -368,24 +368,24 @@ function fn() {
|
|
|
368
368
|
}));
|
|
369
369
|
return;
|
|
370
370
|
}
|
|
371
|
-
if (
|
|
372
|
-
let r =
|
|
371
|
+
if (U(e)) {
|
|
372
|
+
let r = xt(e, "font-size", he), i = xt(e, "color", me), a = xt(e, "background-color", pe), s = e.anchor.getNode(), c = s.getKey() === "root" ? s : G(s, (e) => {
|
|
373
373
|
let t = e.getParent();
|
|
374
|
-
return t !== null &&
|
|
374
|
+
return t !== null && Ze(t);
|
|
375
375
|
});
|
|
376
376
|
c === null && (c = s.getTopLevelElementOrThrow());
|
|
377
|
-
let l = {}, u =
|
|
377
|
+
let l = {}, u = G(s, Et);
|
|
378
378
|
u ? (l.link = u.getURL(), l.linkText = u.getTextContent(), l.newBlank = u.getTarget() === "_blank") : l.linkText = e.getTextContent();
|
|
379
|
-
let f =
|
|
380
|
-
if (
|
|
379
|
+
let f = G(s, K), p = !1, m = Ye(c) ? c.getIndent() : 0;
|
|
380
|
+
if (K(f)) {
|
|
381
381
|
m = f.getIndent();
|
|
382
382
|
let e = f.getParent();
|
|
383
|
-
if (
|
|
383
|
+
if (kt(e)) {
|
|
384
384
|
let t = e.getListType();
|
|
385
385
|
p = t === "number" || t === "bullet" ? t : !1;
|
|
386
386
|
}
|
|
387
387
|
}
|
|
388
|
-
let h =
|
|
388
|
+
let h = G(s, q), g = G(s, Zt), _ = Zt(g) ? g.getTag() : void 0;
|
|
389
389
|
n({
|
|
390
390
|
bold: e.hasFormat("bold"),
|
|
391
391
|
italic: e.hasFormat("italic"),
|
|
@@ -396,11 +396,11 @@ function fn() {
|
|
|
396
396
|
fontSize: r,
|
|
397
397
|
fontColor: i,
|
|
398
398
|
backgroundColor: a,
|
|
399
|
-
align: o(
|
|
399
|
+
align: o(Ye(c) ? c.getFormatType() : ""),
|
|
400
400
|
listType: p,
|
|
401
401
|
canOutdent: m > 0 || p !== !1,
|
|
402
402
|
isCodeBlock: !!h,
|
|
403
|
-
isInTable: !!
|
|
403
|
+
isInTable: !!G(s, Bt),
|
|
404
404
|
headingTag: _ === "h1" || _ === "h2" || _ === "h3" ? _ : !1,
|
|
405
405
|
codeLanguage: d(h?.getLanguage()),
|
|
406
406
|
hasEditorText: t,
|
|
@@ -415,41 +415,41 @@ function fn() {
|
|
|
415
415
|
}
|
|
416
416
|
//#endregion
|
|
417
417
|
//#region src/components/Editor/ToolbarPlugin/context/TextFormatProvider.tsx
|
|
418
|
-
var
|
|
419
|
-
let t =
|
|
420
|
-
return /* @__PURE__ */
|
|
418
|
+
var mn = (e) => {
|
|
419
|
+
let t = pn();
|
|
420
|
+
return /* @__PURE__ */ M(f.Provider, {
|
|
421
421
|
value: t,
|
|
422
422
|
children: e.children
|
|
423
423
|
});
|
|
424
|
-
},
|
|
424
|
+
}, hn = m.map((e) => ({
|
|
425
425
|
key: e.id,
|
|
426
426
|
label: e.label
|
|
427
|
-
})),
|
|
428
|
-
let [t] =
|
|
427
|
+
})), gn = () => {
|
|
428
|
+
let [t] = W(), { codeLanguage: r } = b(), { t: i } = n(), { iconSize: o } = g(), s = P((e) => {
|
|
429
429
|
let n = e.key;
|
|
430
430
|
t.update(() => {
|
|
431
|
-
let e =
|
|
432
|
-
|
|
431
|
+
let e = H();
|
|
432
|
+
U(e) && G(e.anchor.getNode(), q)?.setLanguage(n);
|
|
433
433
|
});
|
|
434
434
|
}, [t]), c = h[r].label;
|
|
435
|
-
return /* @__PURE__ */
|
|
436
|
-
menus:
|
|
435
|
+
return /* @__PURE__ */ M(a, {
|
|
436
|
+
menus: hn,
|
|
437
437
|
onClick: s,
|
|
438
438
|
activeKey: [r],
|
|
439
439
|
showSearch: !1,
|
|
440
|
-
offset:
|
|
440
|
+
offset: fe,
|
|
441
441
|
style: {
|
|
442
442
|
width: 120,
|
|
443
443
|
minWidth: 120
|
|
444
444
|
},
|
|
445
|
-
children: /* @__PURE__ */
|
|
445
|
+
children: /* @__PURE__ */ M("div", {
|
|
446
446
|
className: p["bsy-lexical__toolbar-select"],
|
|
447
447
|
style: { width: 120 },
|
|
448
|
-
children: /* @__PURE__ */
|
|
449
|
-
icon: /* @__PURE__ */
|
|
448
|
+
children: /* @__PURE__ */ M(u, {
|
|
449
|
+
icon: /* @__PURE__ */ N(ye, { children: [/* @__PURE__ */ M("span", {
|
|
450
450
|
className: p["bsy-lexical__toolbar-select-label"],
|
|
451
451
|
children: c
|
|
452
|
-
}), /* @__PURE__ */
|
|
452
|
+
}), /* @__PURE__ */ M(e, {
|
|
453
453
|
name: "arrow-down",
|
|
454
454
|
size: o,
|
|
455
455
|
className: p["bsy-lexical__toolbar-select-arrow"]
|
|
@@ -458,7 +458,7 @@ var pn = (e) => {
|
|
|
458
458
|
})
|
|
459
459
|
})
|
|
460
460
|
});
|
|
461
|
-
},
|
|
461
|
+
}, _n = {
|
|
462
462
|
initial: {
|
|
463
463
|
opacity: 0,
|
|
464
464
|
x: 6
|
|
@@ -471,7 +471,7 @@ var pn = (e) => {
|
|
|
471
471
|
opacity: 0,
|
|
472
472
|
x: -6
|
|
473
473
|
}
|
|
474
|
-
},
|
|
474
|
+
}, vn = (e, t, n) => {
|
|
475
475
|
if (n) return [
|
|
476
476
|
{
|
|
477
477
|
kind: "button",
|
|
@@ -529,28 +529,28 @@ var pn = (e) => {
|
|
|
529
529
|
key: `divider-${t.key}`
|
|
530
530
|
});
|
|
531
531
|
}), r;
|
|
532
|
-
},
|
|
533
|
-
if (e.kind === "divider") return /* @__PURE__ */
|
|
534
|
-
if (e.kind === "language") return /* @__PURE__ */
|
|
532
|
+
}, yn = (e) => {
|
|
533
|
+
if (e.kind === "divider") return /* @__PURE__ */ M("div", { className: p["bsy-lexical__toolbar-divider"] });
|
|
534
|
+
if (e.kind === "language") return /* @__PURE__ */ M(gn, {});
|
|
535
535
|
let t = re(e.name);
|
|
536
|
-
return t ? /* @__PURE__ */
|
|
537
|
-
},
|
|
538
|
-
let i =
|
|
539
|
-
return i === null ? null : /* @__PURE__ */
|
|
536
|
+
return t ? /* @__PURE__ */ M(t, { ...e.props }) : (console.warn(`[ToolbarPlugin] Button "${e.name}" is not registered.`), null);
|
|
537
|
+
}, bn = xe(function({ item: e, motionProps: t, transition: n }, r) {
|
|
538
|
+
let i = yn(e);
|
|
539
|
+
return i === null ? null : /* @__PURE__ */ M(je.div, {
|
|
540
540
|
ref: r,
|
|
541
541
|
"data-toolbar-item-key": e.key,
|
|
542
|
-
className:
|
|
542
|
+
className: z(p["bsy-lexical__toolbar-item"], e.kind === "button" && e.props?.disabled && p["bsy-lexical__toolbar-item--disabled"]),
|
|
543
543
|
layout: "position",
|
|
544
544
|
transition: n,
|
|
545
545
|
...t,
|
|
546
546
|
children: i
|
|
547
547
|
}, e.key);
|
|
548
|
-
}),
|
|
549
|
-
let { isCodeBlock: r } = b(), { isSourceMode: i } =
|
|
548
|
+
}), xn = ({ config: e, sizeToken: t }) => {
|
|
549
|
+
let { isCodeBlock: r } = b(), { isSourceMode: i } = de(), a = Me(), o = I(() => vn(e, r, i), [
|
|
550
550
|
e,
|
|
551
551
|
r,
|
|
552
552
|
i
|
|
553
|
-
]), s = o.map((e) => e.key).join("|"), { t: c } = n(), l =
|
|
553
|
+
]), s = o.map((e) => e.key).join("|"), { t: c } = n(), l = L(null), d = L({}), f = L(null), m = L(!0), [h, g] = R({
|
|
554
554
|
keys: s,
|
|
555
555
|
count: o.length
|
|
556
556
|
});
|
|
@@ -558,12 +558,12 @@ var pn = (e) => {
|
|
|
558
558
|
keys: s,
|
|
559
559
|
count: o.length
|
|
560
560
|
});
|
|
561
|
-
let _ = h.keys === s ? h.count : o.length, v =
|
|
561
|
+
let _ = h.keys === s ? h.count : o.length, v = L(_);
|
|
562
562
|
v.current = _;
|
|
563
|
-
let [y, x] =
|
|
563
|
+
let [y, x] = R(!1), S = {
|
|
564
564
|
duration: a ? 0 : .16,
|
|
565
565
|
ease: "easeOut"
|
|
566
|
-
}, C = a ? {} :
|
|
566
|
+
}, C = a ? {} : _n, w = P(() => {
|
|
567
567
|
let e = l.current;
|
|
568
568
|
if (!e || m.current && v.current !== o.length) return;
|
|
569
569
|
let t = getComputedStyle(e), n = Number.parseFloat(t.columnGap || t.gap) || 0, r = e.clientWidth, i = new Set(o.map((e) => e.key));
|
|
@@ -579,16 +579,16 @@ var pn = (e) => {
|
|
|
579
579
|
}));
|
|
580
580
|
m.current && o.length > 0 && c.every((e) => e.width <= 0) || (m.current = !1, g({
|
|
581
581
|
keys: s,
|
|
582
|
-
count:
|
|
582
|
+
count: dn(c, r, a, n)
|
|
583
583
|
}));
|
|
584
584
|
}, [s, o]);
|
|
585
|
-
|
|
585
|
+
Te(() => {
|
|
586
586
|
m.current = !0, d.current = {};
|
|
587
587
|
}, [
|
|
588
588
|
s,
|
|
589
589
|
o.length,
|
|
590
590
|
t
|
|
591
|
-
]),
|
|
591
|
+
]), Te(() => {
|
|
592
592
|
w();
|
|
593
593
|
let e = l.current;
|
|
594
594
|
if (!e || typeof ResizeObserver > "u") return;
|
|
@@ -599,48 +599,48 @@ var pn = (e) => {
|
|
|
599
599
|
s,
|
|
600
600
|
t
|
|
601
601
|
]);
|
|
602
|
-
let { visible:
|
|
603
|
-
|
|
604
|
-
let
|
|
605
|
-
return /* @__PURE__ */
|
|
606
|
-
className:
|
|
607
|
-
children: [/* @__PURE__ */
|
|
602
|
+
let { visible: ee, overflow: T } = fn(o, _), E = T.length > 0, D = L(T);
|
|
603
|
+
T.length > 0 && (D.current = T);
|
|
604
|
+
let O = y && E, k = E || y && D.current.length > 0, A = E ? T : D.current;
|
|
605
|
+
return /* @__PURE__ */ N("div", {
|
|
606
|
+
className: z(p["bsy-lexical__toolbar-stack"], a && p["bsy-lexical__toolbar-stack--instant"]),
|
|
607
|
+
children: [/* @__PURE__ */ N("div", {
|
|
608
608
|
ref: l,
|
|
609
609
|
className: p["bsy-lexical__toolbar-items"],
|
|
610
610
|
children: [
|
|
611
|
-
/* @__PURE__ */
|
|
611
|
+
/* @__PURE__ */ M(Ae, {
|
|
612
612
|
initial: !1,
|
|
613
613
|
mode: "popLayout",
|
|
614
|
-
children:
|
|
614
|
+
children: ee.map((e) => /* @__PURE__ */ M(bn, {
|
|
615
615
|
item: e,
|
|
616
616
|
motionProps: C,
|
|
617
617
|
transition: S
|
|
618
618
|
}, e.key))
|
|
619
619
|
}),
|
|
620
|
-
|
|
621
|
-
className:
|
|
622
|
-
children: [/* @__PURE__ */
|
|
623
|
-
icon:
|
|
620
|
+
E ? /* @__PURE__ */ N("div", {
|
|
621
|
+
className: z(p["bsy-lexical__toolbar-overflow"], p["bsy-lexical__toolbar-with-divider"]),
|
|
622
|
+
children: [/* @__PURE__ */ M("div", { className: p["bsy-lexical__toolbar-divider"] }), /* @__PURE__ */ M(u, {
|
|
623
|
+
icon: O ? "packupeverything" : "expandall",
|
|
624
624
|
tooltip: c("editor.more"),
|
|
625
|
-
highlight:
|
|
625
|
+
highlight: O,
|
|
626
626
|
onClick: () => x((e) => !e)
|
|
627
627
|
})]
|
|
628
628
|
}) : null,
|
|
629
|
-
/* @__PURE__ */
|
|
629
|
+
/* @__PURE__ */ N("div", {
|
|
630
630
|
ref: f,
|
|
631
|
-
className:
|
|
631
|
+
className: z(p["bsy-lexical__toolbar-more-sizer"], p["bsy-lexical__toolbar-with-divider"]),
|
|
632
632
|
"aria-hidden": !0,
|
|
633
|
-
children: [/* @__PURE__ */
|
|
633
|
+
children: [/* @__PURE__ */ M("div", { className: p["bsy-lexical__toolbar-divider"] }), /* @__PURE__ */ M(u, {
|
|
634
634
|
icon: "expandall",
|
|
635
635
|
tooltip: ""
|
|
636
636
|
})]
|
|
637
637
|
})
|
|
638
638
|
]
|
|
639
|
-
}),
|
|
640
|
-
className:
|
|
641
|
-
children: /* @__PURE__ */
|
|
639
|
+
}), k ? /* @__PURE__ */ M("div", {
|
|
640
|
+
className: z(p["bsy-lexical__toolbar-overflow-row"], O && p["bsy-lexical__toolbar-overflow-row--open"], a && p["bsy-lexical__toolbar-overflow-row--instant"]),
|
|
641
|
+
children: /* @__PURE__ */ M("div", {
|
|
642
642
|
className: p["bsy-lexical__toolbar-overflow-inner"],
|
|
643
|
-
children:
|
|
643
|
+
children: A.map((e) => /* @__PURE__ */ M(bn, {
|
|
644
644
|
item: e,
|
|
645
645
|
motionProps: {},
|
|
646
646
|
transition: S
|
|
@@ -648,11 +648,11 @@ var pn = (e) => {
|
|
|
648
648
|
})
|
|
649
649
|
}) : null]
|
|
650
650
|
});
|
|
651
|
-
},
|
|
652
|
-
let { config: t = [], style: n, theme: r, mode: i, floating: a, size: o = v } = e, { toolbarRef: s } = le(), c = i === "floating", u =
|
|
651
|
+
}, Sn = (e) => {
|
|
652
|
+
let { config: t = [], style: n, theme: r, mode: i, floating: a, size: o = v } = e, { toolbarRef: s } = le(), c = i === "floating", u = Me(), d = {
|
|
653
653
|
duration: u ? 0 : .16,
|
|
654
654
|
ease: "easeOut"
|
|
655
|
-
}, f =
|
|
655
|
+
}, f = I(() => cn(r, o), [r, o]), m = I(() => ({ iconSize: ln(r?.iconSize, o) }), [r?.iconSize, o]), h = c ? un(a) : void 0, g = c ? ve(n, [
|
|
656
656
|
"position",
|
|
657
657
|
"left",
|
|
658
658
|
"top",
|
|
@@ -663,34 +663,39 @@ var pn = (e) => {
|
|
|
663
663
|
"marginTop",
|
|
664
664
|
"marginBottom"
|
|
665
665
|
]) : n;
|
|
666
|
-
return /* @__PURE__ */
|
|
666
|
+
return /* @__PURE__ */ M(l, {
|
|
667
667
|
value: m,
|
|
668
|
-
children: /* @__PURE__ */
|
|
668
|
+
children: /* @__PURE__ */ M(A, { children: /* @__PURE__ */ M(mn, { children: /* @__PURE__ */ M(je.div, {
|
|
669
669
|
ref: s,
|
|
670
670
|
layout: u ? !1 : "position",
|
|
671
671
|
transition: d,
|
|
672
|
-
className:
|
|
672
|
+
className: z(p["bsy-lexical__toolbar"], c && p["bsy-lexical__toolbar--floating"]),
|
|
673
673
|
style: {
|
|
674
674
|
...f,
|
|
675
675
|
...h,
|
|
676
676
|
...g
|
|
677
677
|
},
|
|
678
|
-
children: /* @__PURE__ */
|
|
678
|
+
children: /* @__PURE__ */ M(xn, {
|
|
679
679
|
config: t,
|
|
680
680
|
sizeToken: `${o}|${r?.itemHeight ?? ""}|${r?.iconSize ?? ""}`
|
|
681
681
|
})
|
|
682
682
|
}) }) })
|
|
683
683
|
});
|
|
684
|
-
},
|
|
685
|
-
"bsy-lexical-editor": "_bsy-lexical-
|
|
686
|
-
"bsy-lexical-editor--floating": "_bsy-lexical-editor--
|
|
687
|
-
"bsy-lexical-editor__body": "_bsy-lexical-
|
|
688
|
-
"bsy-lexical-editor__body--fixed": "_bsy-lexical-editor__body--
|
|
689
|
-
"bsy-lexical-editor__editable-wrap": "_bsy-lexical-editor__editable-
|
|
690
|
-
"bsy-lexical-editor__content-editable": "_bsy-lexical-editor__content-
|
|
691
|
-
"bsy-lexical-editor__length-badge": "_bsy-lexical-editor__length-
|
|
692
|
-
"bsy-lexical-editor__length-badge--exceeded": "_bsy-lexical-editor__length-badge--
|
|
693
|
-
},
|
|
684
|
+
}, X = {
|
|
685
|
+
"bsy-lexical-editor": "_bsy-lexical-editor_17rfr_1",
|
|
686
|
+
"bsy-lexical-editor--floating": "_bsy-lexical-editor--floating_17rfr_7",
|
|
687
|
+
"bsy-lexical-editor__body": "_bsy-lexical-editor__body_17rfr_10",
|
|
688
|
+
"bsy-lexical-editor__body--fixed": "_bsy-lexical-editor__body--fixed_17rfr_15",
|
|
689
|
+
"bsy-lexical-editor__editable-wrap": "_bsy-lexical-editor__editable-wrap_17rfr_18",
|
|
690
|
+
"bsy-lexical-editor__content-editable": "_bsy-lexical-editor__content-editable_17rfr_27",
|
|
691
|
+
"bsy-lexical-editor__length-badge": "_bsy-lexical-editor__length-badge_17rfr_37",
|
|
692
|
+
"bsy-lexical-editor__length-badge--exceeded": "_bsy-lexical-editor__length-badge--exceeded_17rfr_49"
|
|
693
|
+
}, Cn = (e) => {
|
|
694
|
+
if (!(e === void 0 || e === "")) return typeof e == "number" ? `${e}px` : e;
|
|
695
|
+
}, wn = (e) => {
|
|
696
|
+
let t = {};
|
|
697
|
+
return e ? (r(t, "--bsy-editor-container-border-color", e.borderColor), r(t, "--bsy-editor-container-border-width", Cn(e.borderWidth)), r(t, "--bsy-editor-container-border-radius", Cn(e.borderRadius)), t) : t;
|
|
698
|
+
}, Z = class e extends _t {
|
|
694
699
|
constructor(e, t) {
|
|
695
700
|
super(e, t);
|
|
696
701
|
}
|
|
@@ -701,46 +706,46 @@ var pn = (e) => {
|
|
|
701
706
|
return new e(t.__text, t.__key);
|
|
702
707
|
}
|
|
703
708
|
static importDOM() {
|
|
704
|
-
let e =
|
|
709
|
+
let e = _t.importDOM();
|
|
705
710
|
return {
|
|
706
711
|
...e,
|
|
707
712
|
code: () => ({
|
|
708
|
-
conversion:
|
|
713
|
+
conversion: Q(e?.code),
|
|
709
714
|
priority: 1
|
|
710
715
|
}),
|
|
711
716
|
em: () => ({
|
|
712
|
-
conversion:
|
|
717
|
+
conversion: Q(e?.em),
|
|
713
718
|
priority: 1
|
|
714
719
|
}),
|
|
715
720
|
span: () => ({
|
|
716
|
-
conversion:
|
|
721
|
+
conversion: Q(e?.span),
|
|
717
722
|
priority: 1
|
|
718
723
|
}),
|
|
719
724
|
strong: () => ({
|
|
720
|
-
conversion:
|
|
725
|
+
conversion: Q(e?.strong),
|
|
721
726
|
priority: 1
|
|
722
727
|
}),
|
|
723
728
|
sub: () => ({
|
|
724
|
-
conversion:
|
|
729
|
+
conversion: Q(e?.sub),
|
|
725
730
|
priority: 1
|
|
726
731
|
}),
|
|
727
732
|
sup: () => ({
|
|
728
|
-
conversion:
|
|
733
|
+
conversion: Q(e?.sup),
|
|
729
734
|
priority: 1
|
|
730
735
|
})
|
|
731
736
|
};
|
|
732
737
|
}
|
|
733
738
|
static importJSON(e) {
|
|
734
|
-
return
|
|
739
|
+
return Tn().updateFromJSON(e);
|
|
735
740
|
}
|
|
736
741
|
isSimpleText() {
|
|
737
742
|
return this.__type === "extended-text" && this.__mode === 0;
|
|
738
743
|
}
|
|
739
744
|
};
|
|
740
|
-
function
|
|
741
|
-
return
|
|
745
|
+
function Tn(e = "") {
|
|
746
|
+
return Ve(new Z(e));
|
|
742
747
|
}
|
|
743
|
-
function
|
|
748
|
+
function Q(e) {
|
|
744
749
|
return (t) => {
|
|
745
750
|
let n = e?.(t);
|
|
746
751
|
if (!n) return null;
|
|
@@ -751,7 +756,7 @@ function $(e) {
|
|
|
751
756
|
...r,
|
|
752
757
|
forChild: (e, t) => {
|
|
753
758
|
let n = (r?.forChild ?? ((e) => e))(e, t);
|
|
754
|
-
if (
|
|
759
|
+
if ($e(n)) {
|
|
755
760
|
let e = [
|
|
756
761
|
i ? `background-color: ${i}` : null,
|
|
757
762
|
a ? `color: ${a}` : null,
|
|
@@ -769,81 +774,81 @@ function $(e) {
|
|
|
769
774
|
}
|
|
770
775
|
//#endregion
|
|
771
776
|
//#region src/components/Editor/utils/stripInlineStyleProperty.ts
|
|
772
|
-
function
|
|
777
|
+
function En(e, t) {
|
|
773
778
|
return e.split(";").map((e) => e.trim()).filter((e) => e && e.split(":")[0].trim().toLowerCase() !== t).join("; ");
|
|
774
779
|
}
|
|
775
780
|
//#endregion
|
|
776
781
|
//#region src/components/Editor/plugins/LinkColorPlugin.tsx
|
|
777
|
-
function
|
|
778
|
-
if (!
|
|
782
|
+
function Dn(e) {
|
|
783
|
+
if (!G(e, Et)) return;
|
|
779
784
|
let t = e.getStyle();
|
|
780
785
|
if (!t) return;
|
|
781
|
-
let n =
|
|
786
|
+
let n = En(t, "color");
|
|
782
787
|
n !== t && e.setStyle(n);
|
|
783
788
|
}
|
|
784
|
-
function
|
|
785
|
-
let [e] =
|
|
786
|
-
return
|
|
789
|
+
function On() {
|
|
790
|
+
let [e] = W();
|
|
791
|
+
return F(() => e.registerNodeTransform(Z, Dn), [e]), null;
|
|
787
792
|
}
|
|
788
793
|
//#endregion
|
|
789
794
|
//#region src/components/Editor/plugins/ImagePlugin.tsx
|
|
790
|
-
function
|
|
791
|
-
let [e] =
|
|
792
|
-
return
|
|
795
|
+
function kn() {
|
|
796
|
+
let [e] = W();
|
|
797
|
+
return F(() => e.registerCommand(C, (e) => (Je([an(e)]), !0), at), [e]), null;
|
|
793
798
|
}
|
|
794
799
|
//#endregion
|
|
795
800
|
//#region src/components/Editor/utils/stripImagesFromHtml.ts
|
|
796
|
-
function
|
|
801
|
+
function An(e) {
|
|
797
802
|
let t = new DOMParser().parseFromString(e, "text/html");
|
|
798
803
|
return t.querySelectorAll("img, picture").forEach((e) => e.remove()), t.body.innerHTML;
|
|
799
804
|
}
|
|
800
805
|
//#endregion
|
|
801
806
|
//#region src/components/Editor/plugins/PasteStripImagePlugin.tsx
|
|
802
|
-
var
|
|
803
|
-
function
|
|
804
|
-
let [e] =
|
|
805
|
-
return
|
|
807
|
+
var jn = /<img\b|<picture\b/i;
|
|
808
|
+
function Mn() {
|
|
809
|
+
let [e] = W(), { isSourceModeRef: t } = de();
|
|
810
|
+
return F(() => {
|
|
806
811
|
let n = (n) => {
|
|
807
812
|
if (t.current) return !1;
|
|
808
813
|
let r = "clipboardData" in n ? n.clipboardData : "dataTransfer" in n ? n.dataTransfer : null;
|
|
809
814
|
if (!r || r.getData("application/x-lexical-editor") || r.getData("application/x-lexical-drag")) return !1;
|
|
810
815
|
let i = r.getData("text/html");
|
|
811
|
-
if (!(Array.from(r.files).some((e) => e.type.startsWith("image/")) || Array.from(r.items).some((e) => e.type.startsWith("image/")) ||
|
|
816
|
+
if (!(Array.from(r.files).some((e) => e.type.startsWith("image/")) || Array.from(r.items).some((e) => e.type.startsWith("image/")) || jn.test(i))) return !1;
|
|
812
817
|
n.preventDefault();
|
|
813
818
|
let a = r.getData("text/plain");
|
|
814
|
-
return !
|
|
815
|
-
let t =
|
|
819
|
+
return !jn.test(i) && !a || e.update(() => {
|
|
820
|
+
let t = H();
|
|
816
821
|
if (t === null) return;
|
|
817
|
-
let n = i ?
|
|
822
|
+
let n = i ? An(i) : "", r = document.createElement("div");
|
|
818
823
|
if (r.innerHTML = n, n && r.textContent?.trim()) {
|
|
819
|
-
let t =
|
|
824
|
+
let t = Be(e, new DOMParser().parseFromString(n, "text/html"));
|
|
820
825
|
if (t.length) {
|
|
821
|
-
|
|
826
|
+
Je(t);
|
|
822
827
|
return;
|
|
823
828
|
}
|
|
824
829
|
}
|
|
825
830
|
a && t.insertRawText(a);
|
|
826
|
-
}, { tag:
|
|
831
|
+
}, { tag: ht }), !0;
|
|
827
832
|
};
|
|
828
|
-
return
|
|
833
|
+
return Tt(e.registerCommand(mt, (e) => n(e), ot), e.registerCommand(ct, (e) => n(e), ot));
|
|
829
834
|
}, [e, t]), null;
|
|
830
835
|
}
|
|
831
836
|
//#endregion
|
|
832
837
|
//#region src/components/Editor/plugins/EnterKeyPlugin.tsx
|
|
833
|
-
function
|
|
834
|
-
let [e] =
|
|
835
|
-
return
|
|
838
|
+
function Nn() {
|
|
839
|
+
let [e] = W(), t = L(0);
|
|
840
|
+
return F(() => e.registerCommand(ft, (n) => {
|
|
836
841
|
let r = Date.now(), i = r - t.current;
|
|
837
842
|
return t.current = r, i < 250 && i > 0 ? e.getEditorState().read(() => {
|
|
838
|
-
let e =
|
|
839
|
-
return
|
|
843
|
+
let e = H();
|
|
844
|
+
return U(e) ? !!G(e.anchor.getNode(), (e) => K(e) || q(e) || Bt(e)) : !1;
|
|
840
845
|
}, { editor: e }) ? !1 : (e.update(() => {
|
|
841
|
-
let e =
|
|
842
|
-
if (
|
|
846
|
+
let e = H();
|
|
847
|
+
if (U(e)) {
|
|
843
848
|
let t = e.anchor.getNode().getTopLevelElement();
|
|
844
849
|
if (t && t.getTextContent().trim() === "") {
|
|
845
|
-
let n =
|
|
846
|
-
|
|
850
|
+
let n = Ue();
|
|
851
|
+
St(e, {
|
|
847
852
|
"background-color": "",
|
|
848
853
|
color: "",
|
|
849
854
|
"font-size": "",
|
|
@@ -856,11 +861,11 @@ function An() {
|
|
|
856
861
|
}
|
|
857
862
|
}
|
|
858
863
|
}), n?.preventDefault(), !0) : !1;
|
|
859
|
-
},
|
|
864
|
+
}, st), [e]), null;
|
|
860
865
|
}
|
|
861
866
|
//#endregion
|
|
862
867
|
//#region src/components/Editor/utils/codeHighlighter.ts
|
|
863
|
-
var
|
|
868
|
+
var Pn = {
|
|
864
869
|
css: () => import("@shikijs/langs/css"),
|
|
865
870
|
html: () => import("@shikijs/langs/html"),
|
|
866
871
|
xml: () => import("@shikijs/langs/xml"),
|
|
@@ -881,65 +886,65 @@ var jn = {
|
|
|
881
886
|
bash: () => import("@shikijs/langs/shellscript"),
|
|
882
887
|
lua: () => import("@shikijs/langs/lua"),
|
|
883
888
|
markdown: () => import("@shikijs/langs/markdown")
|
|
884
|
-
},
|
|
889
|
+
}, Fn = (e) => e === "bash" ? "shellscript" : e, In = (e) => e in Pn, Ln = null, Rn = null, zn = /* @__PURE__ */ new Map(), Bn = () => (Ln ||= Promise.all([import("@shikijs/core"), import("@shikijs/engine-javascript")]).then(([{ createHighlighterCoreSync: e }, { createJavaScriptRegexEngine: t }]) => e({
|
|
885
890
|
engine: t(),
|
|
886
891
|
langs: [],
|
|
887
892
|
themes: []
|
|
888
893
|
})).catch((e) => {
|
|
889
|
-
throw
|
|
890
|
-
}),
|
|
891
|
-
let t =
|
|
892
|
-
return t || (t =
|
|
893
|
-
let n =
|
|
894
|
+
throw Ln = null, e;
|
|
895
|
+
}), Ln), Vn = (e, t) => In(t) && e.getLoadedLanguages().includes(Fn(t)), Hn = (e) => {
|
|
896
|
+
let t = zn.get(e);
|
|
897
|
+
return t || (t = Bn().then(async (t) => {
|
|
898
|
+
let n = Fn(e);
|
|
894
899
|
if (!t.getLoadedLanguages().includes(n)) {
|
|
895
|
-
let n = await
|
|
900
|
+
let n = await Pn[e]();
|
|
896
901
|
await t.loadLanguage(n.default);
|
|
897
902
|
}
|
|
898
903
|
return t;
|
|
899
904
|
}).catch((t) => {
|
|
900
|
-
throw
|
|
901
|
-
}),
|
|
902
|
-
},
|
|
905
|
+
throw zn.delete(e), t;
|
|
906
|
+
}), zn.set(e, t)), t;
|
|
907
|
+
}, Un = () => (Rn ||= Bn().then(async (e) => {
|
|
903
908
|
if (!e.getLoadedThemes().includes("github-light")) {
|
|
904
909
|
let t = await import("@shikijs/themes/github-light");
|
|
905
910
|
await e.loadTheme(t.default);
|
|
906
911
|
}
|
|
907
912
|
return e;
|
|
908
913
|
}).catch((e) => {
|
|
909
|
-
throw
|
|
910
|
-
}),
|
|
914
|
+
throw Rn = null, e;
|
|
915
|
+
}), Rn), Wn = (e, t, n) => {
|
|
911
916
|
let r = e.getTextContent();
|
|
912
|
-
if (e.getStyle() && e.setStyle(""), !n || !
|
|
913
|
-
let i =
|
|
917
|
+
if (e.getStyle() && e.setStyle(""), !n || !Vn(n, t)) return Ft(r);
|
|
918
|
+
let i = Fn(t), a = n.codeToTokens(r, {
|
|
914
919
|
lang: i,
|
|
915
|
-
theme:
|
|
920
|
+
theme: k
|
|
916
921
|
}), o = [];
|
|
917
922
|
return a.tokens.forEach((e, t) => {
|
|
918
|
-
t && o.push(
|
|
923
|
+
t && o.push(He()), e.forEach((e) => {
|
|
919
924
|
e.content.split(" ").forEach((t, n) => {
|
|
920
|
-
if (n && o.push(
|
|
921
|
-
let r =
|
|
925
|
+
if (n && o.push(We()), t === "") return;
|
|
926
|
+
let r = Mt(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}` : "";
|
|
922
927
|
i && r.setStyle(i), o.push(r);
|
|
923
928
|
});
|
|
924
929
|
});
|
|
925
930
|
}), o;
|
|
926
|
-
},
|
|
927
|
-
let n =
|
|
928
|
-
if (!
|
|
929
|
-
let r =
|
|
930
|
-
if (!
|
|
931
|
+
}, Gn = (e, t) => {
|
|
932
|
+
let n = B(e);
|
|
933
|
+
if (!q(n) || !n.isAttached()) return;
|
|
934
|
+
let r = H();
|
|
935
|
+
if (!U(r)) {
|
|
931
936
|
t();
|
|
932
937
|
return;
|
|
933
938
|
}
|
|
934
|
-
let { anchor: i } = r, a = i.offset, o = i.type === "element" &&
|
|
939
|
+
let { anchor: i } = r, a = i.offset, o = i.type === "element" && Xe(n.getChildAtIndex(i.offset - 1)), s = 0;
|
|
935
940
|
if (o || (s = a + i.getNode().getPreviousSiblings().reduce((e, t) => e + t.getTextContentSize(), 0)), t()) {
|
|
936
941
|
if (o) {
|
|
937
942
|
i.getNode().select(a, a);
|
|
938
943
|
return;
|
|
939
944
|
}
|
|
940
945
|
n.getChildren().some((e) => {
|
|
941
|
-
let t =
|
|
942
|
-
if (t ||
|
|
946
|
+
let t = $e(e);
|
|
947
|
+
if (t || Xe(e)) {
|
|
943
948
|
let n = e.getTextContentSize();
|
|
944
949
|
if (t && n >= s) return e.select(s, s), !0;
|
|
945
950
|
s -= n;
|
|
@@ -947,11 +952,11 @@ var jn = {
|
|
|
947
952
|
return !1;
|
|
948
953
|
});
|
|
949
954
|
}
|
|
950
|
-
},
|
|
955
|
+
}, Kn = (e, t) => Pt(e) && Pt(t) && e.__text === t.__text && e.__highlightType === t.__highlightType && e.__style === t.__style || Qe(e) && Qe(t) || Xe(e) && Xe(t), qn = (e, t) => {
|
|
951
956
|
let n = 0;
|
|
952
|
-
for (; n < e.length &&
|
|
957
|
+
for (; n < e.length && Kn(e[n], t[n]);) n++;
|
|
953
958
|
let r = e.length, i = t.length, a = Math.min(r, i) - n, o = 0;
|
|
954
|
-
for (; o < a;) if (o++, !
|
|
959
|
+
for (; o < a;) if (o++, !Kn(e[r - o], t[i - o])) {
|
|
955
960
|
o--;
|
|
956
961
|
break;
|
|
957
962
|
}
|
|
@@ -960,21 +965,21 @@ var jn = {
|
|
|
960
965
|
to: r - o,
|
|
961
966
|
nodesForReplacement: t.slice(n, i - o)
|
|
962
967
|
};
|
|
963
|
-
},
|
|
968
|
+
}, Jn = (e, t, n, r, i) => {
|
|
964
969
|
let a = i.getKey(), o = d(i.getLanguage());
|
|
965
970
|
if (i.getLanguage() !== o && i.setLanguage(o), o === "plaintext") i.getIsSyntaxHighlightSupported() && i.setIsSyntaxHighlightSupported(!1);
|
|
966
971
|
else {
|
|
967
|
-
i.getTheme() !== "github-light" && i.setTheme(
|
|
968
|
-
let s = t ? t.getLoadedThemes().includes("github-light") ?
|
|
972
|
+
i.getTheme() !== "github-light" && i.setTheme(k);
|
|
973
|
+
let s = t ? t.getLoadedThemes().includes("github-light") ? In(o) && !Vn(t, o) ? Hn(o) : null : Un() : Bn();
|
|
969
974
|
if (s) {
|
|
970
975
|
i.getIsSyntaxHighlightSupported() && i.setIsSyntaxHighlightSupported(!1), n.pendingKeys.add(a), n.loading !== s && (n.loading = s, s.then((t) => {
|
|
971
976
|
r(t);
|
|
972
977
|
let i = [...n.pendingKeys];
|
|
973
978
|
n.pendingKeys.clear(), n.loading = null, e.update(() => {
|
|
974
979
|
i.forEach((e) => {
|
|
975
|
-
|
|
980
|
+
B(e)?.markDirty();
|
|
976
981
|
});
|
|
977
|
-
}, { tag:
|
|
982
|
+
}, { tag: ut });
|
|
978
983
|
}, () => {
|
|
979
984
|
n.pendingKeys.clear(), n.loading = null;
|
|
980
985
|
}));
|
|
@@ -982,22 +987,22 @@ var jn = {
|
|
|
982
987
|
}
|
|
983
988
|
i.getIsSyntaxHighlightSupported() || i.setIsSyntaxHighlightSupported(!0);
|
|
984
989
|
}
|
|
985
|
-
n.nodesCurrentlyHighlighting.has(a) || (n.nodesCurrentlyHighlighting.add(a), n.didTransform || (n.didTransform = !0,
|
|
990
|
+
n.nodesCurrentlyHighlighting.has(a) || (n.nodesCurrentlyHighlighting.add(a), n.didTransform || (n.didTransform = !0, tt(() => {
|
|
986
991
|
n.didTransform = !1, n.nodesCurrentlyHighlighting.clear();
|
|
987
|
-
})),
|
|
988
|
-
let e =
|
|
989
|
-
if (!
|
|
990
|
-
let n =
|
|
992
|
+
})), Gn(a, () => {
|
|
993
|
+
let e = B(a);
|
|
994
|
+
if (!q(e) || !e.isAttached()) return !1;
|
|
995
|
+
let n = Wn(e, d(e.getLanguage()), t), { from: r, to: i, nodesForReplacement: o } = qn(e.getChildren(), n);
|
|
991
996
|
return r !== i || o.length ? (e.splice(r, i - r, o), !0) : !1;
|
|
992
997
|
}));
|
|
993
|
-
},
|
|
998
|
+
}, Yn = (e, t, n, r, i) => {
|
|
994
999
|
let a = i.getParent();
|
|
995
|
-
|
|
1000
|
+
q(a) ? Jn(e, t, n, r, a) : Pt(i) && i.replace(Ge(i.__text));
|
|
996
1001
|
};
|
|
997
|
-
function
|
|
998
|
-
let [e] =
|
|
999
|
-
return
|
|
1000
|
-
if (!e.hasNodes([
|
|
1002
|
+
function Xn() {
|
|
1003
|
+
let [e] = W();
|
|
1004
|
+
return F(() => {
|
|
1005
|
+
if (!e.hasNodes([Lt, It])) throw Error("CodeHighlightPlugin: CodeNode or CodeHighlightNode not registered on editor");
|
|
1001
1006
|
let t = null, n = {
|
|
1002
1007
|
didTransform: !1,
|
|
1003
1008
|
nodesCurrentlyHighlighting: /* @__PURE__ */ new Set(),
|
|
@@ -1006,16 +1011,16 @@ function qn() {
|
|
|
1006
1011
|
}, r = (e) => {
|
|
1007
1012
|
t = e;
|
|
1008
1013
|
}, i = (e) => {
|
|
1009
|
-
let t =
|
|
1010
|
-
if (!
|
|
1014
|
+
let t = B(e);
|
|
1015
|
+
if (!q(t)) return;
|
|
1011
1016
|
let n = t.getChildrenSize();
|
|
1012
1017
|
n === 0 ? t.selectStart() : t.select(0, n);
|
|
1013
1018
|
}, a = (t) => {
|
|
1014
1019
|
if (!(t instanceof Node) || !e.getRootElement()?.contains(t)) return null;
|
|
1015
1020
|
let n = null;
|
|
1016
1021
|
return e.getEditorState().read(() => {
|
|
1017
|
-
let e =
|
|
1018
|
-
|
|
1022
|
+
let e = Ke(t), r = e ? G(e, q) : null;
|
|
1023
|
+
q(r) && (n = r.getKey());
|
|
1019
1024
|
}, { editor: e }), n;
|
|
1020
1025
|
}, o = null, s = (t, n, r) => {
|
|
1021
1026
|
t.preventDefault(), r && (o = n), e.update(() => {
|
|
@@ -1037,12 +1042,12 @@ function qn() {
|
|
|
1037
1042
|
}, d = (e, t) => {
|
|
1038
1043
|
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);
|
|
1039
1044
|
};
|
|
1040
|
-
return
|
|
1041
|
-
|
|
1042
|
-
}), e.registerNodeTransform(
|
|
1043
|
-
|
|
1044
|
-
}), e.registerNodeTransform(
|
|
1045
|
-
|
|
1045
|
+
return yt(Rt(e), e.registerNodeTransform(Lt, (i) => {
|
|
1046
|
+
Jn(e, t, n, r, i);
|
|
1047
|
+
}), e.registerNodeTransform(_t, (i) => {
|
|
1048
|
+
Yn(e, t, n, r, i);
|
|
1049
|
+
}), e.registerNodeTransform(It, (i) => {
|
|
1050
|
+
Yn(e, t, n, r, i);
|
|
1046
1051
|
}), e.registerRootListener(d), () => {
|
|
1047
1052
|
d(null, e.getRootElement());
|
|
1048
1053
|
});
|
|
@@ -1050,23 +1055,23 @@ function qn() {
|
|
|
1050
1055
|
}
|
|
1051
1056
|
//#endregion
|
|
1052
1057
|
//#region src/components/Editor/plugins/TablePlugin.tsx
|
|
1053
|
-
function
|
|
1054
|
-
let [e] =
|
|
1055
|
-
return
|
|
1058
|
+
function Zn() {
|
|
1059
|
+
let [e] = W();
|
|
1060
|
+
return F(() => (Xt(e, !0), Tt(Jt(e), Yt(e, !1), qt(e), e.registerNodeTransform(Wt, (e) => {
|
|
1056
1061
|
e.getBackgroundColor() !== null && e.setBackgroundColor(null);
|
|
1057
|
-
}), e.registerCommand(
|
|
1058
|
-
let t =
|
|
1059
|
-
if (!
|
|
1060
|
-
let n =
|
|
1062
|
+
}), e.registerCommand(pt, (e) => {
|
|
1063
|
+
let t = H();
|
|
1064
|
+
if (!U(t) || !t.isCollapsed()) return !1;
|
|
1065
|
+
let n = zt(t.anchor.getNode());
|
|
1061
1066
|
if (n === null) return !1;
|
|
1062
1067
|
let r = e.shiftKey ? "previous" : "next", i = r === "next" ? "getNextSibling" : "getPreviousSibling", a = r === "next" ? "getFirstChild" : "getLastChild", o = n[i](), s = null;
|
|
1063
|
-
if (
|
|
1068
|
+
if (Bt(o)) s = o;
|
|
1064
1069
|
else {
|
|
1065
|
-
let e =
|
|
1070
|
+
let e = G(n, Ht);
|
|
1066
1071
|
if (e !== null) for (let t = e[i](); t !== null; t = t[i]()) {
|
|
1067
|
-
if (!
|
|
1072
|
+
if (!Ht(t)) continue;
|
|
1068
1073
|
let e = t[a]();
|
|
1069
|
-
if (
|
|
1074
|
+
if (Bt(e)) {
|
|
1070
1075
|
s = e;
|
|
1071
1076
|
break;
|
|
1072
1077
|
}
|
|
@@ -1076,60 +1081,60 @@ function Jn() {
|
|
|
1076
1081
|
let e = s.getFirstDescendant();
|
|
1077
1082
|
e ? e.selectStart() : s.selectStart();
|
|
1078
1083
|
} else {
|
|
1079
|
-
let e =
|
|
1084
|
+
let e = G(n, Vt);
|
|
1080
1085
|
e && (r === "next" ? e.selectNext() : e.selectPrevious());
|
|
1081
1086
|
}
|
|
1082
1087
|
return !0;
|
|
1083
|
-
},
|
|
1088
|
+
}, ot))), [e]), null;
|
|
1084
1089
|
}
|
|
1085
1090
|
//#endregion
|
|
1086
1091
|
//#region src/components/Editor/plugins/TabIndentPlugin.tsx
|
|
1087
|
-
var
|
|
1088
|
-
function
|
|
1089
|
-
let [e] =
|
|
1090
|
-
return
|
|
1092
|
+
var Qn = "\xA0".repeat(4);
|
|
1093
|
+
function $n() {
|
|
1094
|
+
let [e] = W();
|
|
1095
|
+
return F(() => e.registerCommand(pt, (t) => {
|
|
1091
1096
|
if (t.shiftKey) return !1;
|
|
1092
|
-
let n =
|
|
1093
|
-
if (!
|
|
1097
|
+
let n = H();
|
|
1098
|
+
if (!U(n)) return !1;
|
|
1094
1099
|
let r = n.anchor.getNode();
|
|
1095
|
-
if (
|
|
1100
|
+
if (zt(r) !== null || G(r, q)) return !1;
|
|
1096
1101
|
t.preventDefault();
|
|
1097
|
-
let i =
|
|
1098
|
-
if (
|
|
1102
|
+
let i = G(r, K);
|
|
1103
|
+
if (K(i)) {
|
|
1099
1104
|
let e = new Set([i]);
|
|
1100
1105
|
for (let t of n.getNodes()) {
|
|
1101
|
-
let n =
|
|
1102
|
-
|
|
1106
|
+
let n = G(t, K);
|
|
1107
|
+
K(n) && e.add(n);
|
|
1103
1108
|
}
|
|
1104
1109
|
for (let t of e) t.setIndent(t.getIndent() + 1);
|
|
1105
1110
|
return !0;
|
|
1106
1111
|
}
|
|
1107
1112
|
let a = r.getTopLevelElement(), o = n.focus.getNode().getTopLevelElement();
|
|
1108
|
-
return !n.isCollapsed() && a && o && a !== o ? e.dispatchCommand(
|
|
1109
|
-
},
|
|
1113
|
+
return !n.isCollapsed() && a && o && a !== o ? e.dispatchCommand(dt, void 0) : (n.insertText(Qn), !0);
|
|
1114
|
+
}, at), [e]), null;
|
|
1110
1115
|
}
|
|
1111
1116
|
//#endregion
|
|
1112
1117
|
//#region src/components/Editor/plugins/MaxLengthPlugin.tsx
|
|
1113
|
-
function
|
|
1114
|
-
let [n] =
|
|
1115
|
-
return i.current = t,
|
|
1118
|
+
function er({ maxLength: e, onMaxLengthExceed: t }) {
|
|
1119
|
+
let [n] = W(), { isSourceModeRef: r } = de(), i = L(t);
|
|
1120
|
+
return i.current = t, F(() => {
|
|
1116
1121
|
let t = null;
|
|
1117
|
-
return n.registerNodeTransform(
|
|
1122
|
+
return n.registerNodeTransform(gt, (a) => {
|
|
1118
1123
|
if (r.current) return;
|
|
1119
1124
|
let o = a.getTextContentSize();
|
|
1120
1125
|
if (o <= e) return;
|
|
1121
|
-
let s = n.getEditorState(), c = s.read(() => a.getTextContentSize()), l = o - e, u =
|
|
1126
|
+
let s = n.getEditorState(), c = s.read(() => a.getTextContentSize()), l = o - e, u = H();
|
|
1122
1127
|
if (c === e && t !== s) {
|
|
1123
|
-
t = s,
|
|
1128
|
+
t = s, wt(n, s), i.current?.();
|
|
1124
1129
|
return;
|
|
1125
1130
|
}
|
|
1126
|
-
if (
|
|
1127
|
-
|
|
1131
|
+
if (U(u) && u.isCollapsed()) {
|
|
1132
|
+
Ct(n, u.anchor, l), i.current?.();
|
|
1128
1133
|
return;
|
|
1129
1134
|
}
|
|
1130
1135
|
a.selectEnd();
|
|
1131
|
-
let d =
|
|
1132
|
-
|
|
1136
|
+
let d = H();
|
|
1137
|
+
U(d) && (Ct(n, d.anchor, l), i.current?.());
|
|
1133
1138
|
});
|
|
1134
1139
|
}, [
|
|
1135
1140
|
n,
|
|
@@ -1139,19 +1144,19 @@ function Zn({ maxLength: e, onMaxLengthExceed: t }) {
|
|
|
1139
1144
|
}
|
|
1140
1145
|
//#endregion
|
|
1141
1146
|
//#region src/components/Editor/utils/textLength.ts
|
|
1142
|
-
function
|
|
1147
|
+
function tr(e) {
|
|
1143
1148
|
return typeof e == "number" && Number.isFinite(e) && e > 0;
|
|
1144
1149
|
}
|
|
1145
|
-
function
|
|
1146
|
-
let n =
|
|
1150
|
+
function nr(e, t) {
|
|
1151
|
+
let n = V(), r = n.getTextContentSize();
|
|
1147
1152
|
if (r <= t) return !1;
|
|
1148
1153
|
let i = r - t;
|
|
1149
1154
|
n.selectEnd();
|
|
1150
|
-
let a =
|
|
1151
|
-
return
|
|
1155
|
+
let a = H();
|
|
1156
|
+
return U(a) ? Ct(e, a.anchor, i) : rr(i), !0;
|
|
1152
1157
|
}
|
|
1153
|
-
function
|
|
1154
|
-
let t = e, n =
|
|
1158
|
+
function rr(e) {
|
|
1159
|
+
let t = e, n = V().getAllTextNodes();
|
|
1155
1160
|
for (let e = n.length - 1; e >= 0 && t > 0; e--) {
|
|
1156
1161
|
let r = n[e], i = r.getTextContent();
|
|
1157
1162
|
i.length !== 0 && (i.length <= t ? (t -= i.length, r.remove()) : (r.setTextContent(i.slice(0, i.length - t)), t = 0));
|
|
@@ -1159,7 +1164,7 @@ function er(e) {
|
|
|
1159
1164
|
}
|
|
1160
1165
|
//#endregion
|
|
1161
1166
|
//#region src/components/Editor/utils/formatEditorHtml.ts
|
|
1162
|
-
var
|
|
1167
|
+
var ir = new Set([
|
|
1163
1168
|
"area",
|
|
1164
1169
|
"base",
|
|
1165
1170
|
"br",
|
|
@@ -1174,73 +1179,73 @@ var tr = new Set([
|
|
|
1174
1179
|
"source",
|
|
1175
1180
|
"track",
|
|
1176
1181
|
"wbr"
|
|
1177
|
-
]),
|
|
1178
|
-
let r = e.tagName.toLowerCase(), i = `<${r}${
|
|
1179
|
-
if (
|
|
1180
|
-
let a = n || r === "pre", o =
|
|
1181
|
-
return a || !
|
|
1182
|
-
},
|
|
1182
|
+
]), ar = 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(".")), or = 80, sr = (e) => e.replace(/&/g, "&").replace(/"/g, """), cr = (e) => e.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">"), lr = (e) => Array.from(e.attributes).map((e) => ` ${e.name}="${sr(e.value)}"`).join(""), ur = (e) => " ".repeat(e), dr = (e, t, n) => {
|
|
1183
|
+
let r = e.tagName.toLowerCase(), i = `<${r}${lr(e)}>`;
|
|
1184
|
+
if (ir.has(r)) return i;
|
|
1185
|
+
let a = n || r === "pre", o = fr(e, t + 1, a), s = `</${r}>`;
|
|
1186
|
+
return a || !ar.has(r) ? `${i}${o}${s}` : Array.from(e.children).some((e) => ar.has(e.tagName.toLowerCase())) ? `${i}\n${fr(e, t + 1, !1, !0)}\n${ur(t)}${s}` : i.length + o.length + s.length > or ? `${i}\n${ur(t + 1)}${o}\n${ur(t)}${s}` : `${i}${o}${s}`;
|
|
1187
|
+
}, fr = (e, t, n, r = !1) => {
|
|
1183
1188
|
let i = [];
|
|
1184
1189
|
for (let r of Array.from(e.childNodes)) {
|
|
1185
1190
|
if (r.nodeType === Node.TEXT_NODE) {
|
|
1186
1191
|
let e = r.textContent ?? "";
|
|
1187
1192
|
if (n) {
|
|
1188
|
-
i.push(
|
|
1193
|
+
i.push(cr(e));
|
|
1189
1194
|
continue;
|
|
1190
1195
|
}
|
|
1191
|
-
e.trim() && i.push(
|
|
1196
|
+
e.trim() && i.push(cr(e));
|
|
1192
1197
|
continue;
|
|
1193
1198
|
}
|
|
1194
1199
|
if (r.nodeType === Node.COMMENT_NODE) {
|
|
1195
1200
|
i.push(`<!--${r.data}-->`);
|
|
1196
1201
|
continue;
|
|
1197
1202
|
}
|
|
1198
|
-
r.nodeType === Node.ELEMENT_NODE && i.push(
|
|
1203
|
+
r.nodeType === Node.ELEMENT_NODE && i.push(dr(r, t, n));
|
|
1199
1204
|
}
|
|
1200
|
-
return n || !r ? i.join("") : i.map((e) => `${
|
|
1205
|
+
return n || !r ? i.join("") : i.map((e) => `${ur(t)}${e}`).join("\n");
|
|
1201
1206
|
};
|
|
1202
|
-
function
|
|
1203
|
-
return e.trim() ?
|
|
1207
|
+
function pr(e) {
|
|
1208
|
+
return e.trim() ? fr(new DOMParser().parseFromString(te(e), "text/html").body, 0, !1, !0).trimEnd() : e;
|
|
1204
1209
|
}
|
|
1205
1210
|
//#endregion
|
|
1206
1211
|
//#region src/components/Editor/utils/writeHtmlSource.ts
|
|
1207
|
-
function
|
|
1208
|
-
|
|
1209
|
-
let t =
|
|
1210
|
-
if (
|
|
1212
|
+
function mr(e) {
|
|
1213
|
+
V().clear();
|
|
1214
|
+
let t = Nt("html");
|
|
1215
|
+
if (V().append(t), !e) return;
|
|
1211
1216
|
t.select();
|
|
1212
|
-
let n =
|
|
1213
|
-
|
|
1217
|
+
let n = H();
|
|
1218
|
+
U(n) && n.insertRawText(e);
|
|
1214
1219
|
}
|
|
1215
1220
|
//#endregion
|
|
1216
1221
|
//#region src/components/Editor/plugins/SourceModePlugin.tsx
|
|
1217
|
-
function
|
|
1218
|
-
let [r] =
|
|
1222
|
+
function hr({ children: e, maxLength: t, onMaxLengthExceed: n }) {
|
|
1223
|
+
let [r] = W(), [i, a] = R(!1), o = L(!1), s = L(n);
|
|
1219
1224
|
s.current = n;
|
|
1220
|
-
let c =
|
|
1225
|
+
let c = tr(t) ? t : void 0, l = P(() => {
|
|
1221
1226
|
if (o.current) return;
|
|
1222
1227
|
let e = "", t = "";
|
|
1223
1228
|
r.getEditorState().read(() => {
|
|
1224
|
-
t =
|
|
1229
|
+
t = V().getTextContent(), e = ze(r, null);
|
|
1225
1230
|
}, { editor: r });
|
|
1226
|
-
let n = ie(e, t) ? "" :
|
|
1231
|
+
let n = ie(e, t) ? "" : T(e);
|
|
1227
1232
|
o.current = !0, a(!0), r.update(() => {
|
|
1228
|
-
|
|
1229
|
-
}), r.dispatchCommand(
|
|
1230
|
-
}, [r]), u =
|
|
1233
|
+
mr(pr(n));
|
|
1234
|
+
}), r.dispatchCommand(rt, void 0);
|
|
1235
|
+
}, [r]), u = P(() => {
|
|
1231
1236
|
if (!o.current) return;
|
|
1232
1237
|
let e = !1;
|
|
1233
1238
|
o.current = !1, r.update(() => {
|
|
1234
|
-
ne(r,
|
|
1235
|
-
}), a(!1), r.dispatchCommand(
|
|
1236
|
-
}, [r, c]), d =
|
|
1239
|
+
ne(r, T(V().getTextContent())), c !== void 0 && (e = nr(r, c));
|
|
1240
|
+
}), a(!1), r.dispatchCommand(rt, void 0), e && s.current?.();
|
|
1241
|
+
}, [r, c]), d = P(() => {
|
|
1237
1242
|
if (o.current) {
|
|
1238
1243
|
u();
|
|
1239
1244
|
return;
|
|
1240
1245
|
}
|
|
1241
1246
|
l();
|
|
1242
1247
|
}, [l, u]);
|
|
1243
|
-
|
|
1248
|
+
F(() => {
|
|
1244
1249
|
let e = (e) => {
|
|
1245
1250
|
if (!o.current) return !1;
|
|
1246
1251
|
let t = "clipboardData" in e ? e.clipboardData : "dataTransfer" in e ? e.dataTransfer : null;
|
|
@@ -1248,53 +1253,53 @@ function fr({ children: e, maxLength: t, onMaxLengthExceed: n }) {
|
|
|
1248
1253
|
e.preventDefault();
|
|
1249
1254
|
let n = t.getData("text/html") || t.getData("text/plain");
|
|
1250
1255
|
if (!n) return !0;
|
|
1251
|
-
let i =
|
|
1256
|
+
let i = T(n);
|
|
1252
1257
|
return r.update(() => {
|
|
1253
|
-
let e =
|
|
1254
|
-
|
|
1255
|
-
}, { tag:
|
|
1258
|
+
let e = H();
|
|
1259
|
+
U(e) && i && e.insertRawText(i);
|
|
1260
|
+
}, { tag: ht }), !0;
|
|
1256
1261
|
};
|
|
1257
|
-
return
|
|
1262
|
+
return Tt(r.registerNodeTransform(gt, () => {
|
|
1258
1263
|
if (!o.current) return;
|
|
1259
|
-
let e =
|
|
1260
|
-
|
|
1261
|
-
}), r.registerCommand(
|
|
1264
|
+
let e = V(), t = e.getChildrenSize() === 1 ? e.getFirstChild() : null;
|
|
1265
|
+
q(t) && t.getLanguage() === "html" || mr(e.getTextContent());
|
|
1266
|
+
}), r.registerCommand(mt, e, it), r.registerCommand(ct, e, it));
|
|
1262
1267
|
}, [r]);
|
|
1263
|
-
let f =
|
|
1268
|
+
let f = I(() => ({
|
|
1264
1269
|
isSourceMode: i,
|
|
1265
1270
|
isSourceModeRef: o,
|
|
1266
1271
|
toggleSourceMode: d
|
|
1267
1272
|
}), [i, d]);
|
|
1268
|
-
return /* @__PURE__ */
|
|
1273
|
+
return /* @__PURE__ */ M(ce.Provider, {
|
|
1269
1274
|
value: f,
|
|
1270
1275
|
children: e
|
|
1271
1276
|
});
|
|
1272
1277
|
}
|
|
1273
1278
|
//#endregion
|
|
1274
1279
|
//#region src/components/Editor/plugins/HeadingPlugin.tsx
|
|
1275
|
-
function
|
|
1280
|
+
function gr(e) {
|
|
1276
1281
|
let t = e.getTag();
|
|
1277
1282
|
if (t === "h4" || t === "h5" || t === "h6") {
|
|
1278
|
-
e.replace(
|
|
1283
|
+
e.replace(Ue(), !0);
|
|
1279
1284
|
return;
|
|
1280
1285
|
}
|
|
1281
1286
|
for (let t of e.getAllTextNodes()) {
|
|
1282
1287
|
let e = t.getStyle();
|
|
1283
1288
|
if (!e) continue;
|
|
1284
|
-
let n =
|
|
1289
|
+
let n = En(e, "font-size");
|
|
1285
1290
|
n !== e && t.setStyle(n);
|
|
1286
1291
|
}
|
|
1287
1292
|
}
|
|
1288
|
-
function
|
|
1289
|
-
let [e] =
|
|
1290
|
-
return
|
|
1293
|
+
function _r() {
|
|
1294
|
+
let [e] = W();
|
|
1295
|
+
return F(() => e.registerNodeTransform(Qt, gr), [e]), null;
|
|
1291
1296
|
}
|
|
1292
1297
|
//#endregion
|
|
1293
1298
|
//#region src/components/Editor/LengthBadge.tsx
|
|
1294
|
-
var
|
|
1299
|
+
var vr = ({ current: e, maxLength: t }) => {
|
|
1295
1300
|
let n = e > t;
|
|
1296
|
-
return /* @__PURE__ */
|
|
1297
|
-
className:
|
|
1301
|
+
return /* @__PURE__ */ N("div", {
|
|
1302
|
+
className: z(X["bsy-lexical-editor__length-badge"], n && X["bsy-lexical-editor__length-badge--exceeded"]),
|
|
1298
1303
|
"aria-live": "polite",
|
|
1299
1304
|
children: [
|
|
1300
1305
|
e,
|
|
@@ -1303,33 +1308,33 @@ var hr = ({ current: e, maxLength: t }) => {
|
|
|
1303
1308
|
]
|
|
1304
1309
|
});
|
|
1305
1310
|
};
|
|
1306
|
-
|
|
1311
|
+
vr.displayName = "BsyLexicalEditorLengthBadge";
|
|
1307
1312
|
//#endregion
|
|
1308
1313
|
//#region src/components/Editor/utils/unwrapTypesetFence.ts
|
|
1309
|
-
var
|
|
1314
|
+
var yr = /^\uFEFF/, br = /^ {0,3}`{1,3}[A-Za-z]*$/, xr = /^( {0,3})([^`<]*?)```[ \t]*([A-Za-z0-9_-]*)[ \t]*(.*)$/, Sr = /^ {0,3}```[ \t]*$/, Cr = /<\/?[a-zA-Z]/, wr = /<[a-zA-Z!]/, Tr = (e) => wr.test(e), Er = (e) => Cr.test(e), Dr = (e) => e.replace(yr, "").replace(/\r\n/g, "\n"), Or = (e) => {
|
|
1310
1315
|
let t = e.replace(/\n+$/, ""), n = t.lastIndexOf("\n"), r = n === -1 ? t : t.slice(n + 1);
|
|
1311
|
-
return
|
|
1316
|
+
return br.test(r) ? {
|
|
1312
1317
|
text: n === -1 ? "" : t.slice(0, n),
|
|
1313
1318
|
withheld: !0
|
|
1314
1319
|
} : {
|
|
1315
1320
|
text: e,
|
|
1316
1321
|
withheld: !1
|
|
1317
1322
|
};
|
|
1318
|
-
},
|
|
1319
|
-
let t =
|
|
1323
|
+
}, kr = (e) => {
|
|
1324
|
+
let t = xr.exec(e);
|
|
1320
1325
|
return t ? { sameLineBody: t[4] ?? "" } : null;
|
|
1321
|
-
},
|
|
1326
|
+
}, Ar = (e) => {
|
|
1322
1327
|
let t = e.replace(/[ \t]*```[ \t]*$/, "");
|
|
1323
1328
|
return t === e ? e : t;
|
|
1324
|
-
},
|
|
1329
|
+
}, jr = (e) => Tr(e) ? e.replace(/^\n/, "") : "", Mr = (e) => {
|
|
1325
1330
|
let t = e.split("\n"), n = [], r = 0;
|
|
1326
1331
|
for (; r < t.length;) {
|
|
1327
|
-
let e = t[r], i =
|
|
1332
|
+
let e = t[r], i = kr(e);
|
|
1328
1333
|
if (i) {
|
|
1329
1334
|
let e = i.sameLineBody;
|
|
1330
|
-
if (e !==
|
|
1331
|
-
e =
|
|
1332
|
-
let i =
|
|
1335
|
+
if (e !== Ar(e)) {
|
|
1336
|
+
e = Ar(e);
|
|
1337
|
+
let i = jr(t.slice(r + 1).join("\n"));
|
|
1333
1338
|
return [
|
|
1334
1339
|
...n,
|
|
1335
1340
|
e,
|
|
@@ -1337,38 +1342,38 @@ var gr = /^\uFEFF/, _r = /^ {0,3}`{1,3}[A-Za-z]*$/, vr = /^( {0,3})([^`<]*?)```[
|
|
|
1337
1342
|
].filter(Boolean).join("\n");
|
|
1338
1343
|
}
|
|
1339
1344
|
let a = [];
|
|
1340
|
-
for (e && a.push(e), r += 1; r < t.length && !
|
|
1341
|
-
let o = r < t.length ?
|
|
1345
|
+
for (e && a.push(e), r += 1; r < t.length && !Sr.test(t[r]);) a.push(t[r]), r += 1;
|
|
1346
|
+
let o = r < t.length ? jr(t.slice(r + 1).join("\n")) : "";
|
|
1342
1347
|
return [
|
|
1343
1348
|
...n,
|
|
1344
1349
|
a.join("\n"),
|
|
1345
1350
|
o
|
|
1346
1351
|
].filter(Boolean).join("\n");
|
|
1347
1352
|
}
|
|
1348
|
-
if (
|
|
1349
|
-
|
|
1353
|
+
if (Er(e)) return Nr([...n, ...t.slice(r)].join("\n"));
|
|
1354
|
+
Tr(e) && n.push(e), r += 1;
|
|
1350
1355
|
}
|
|
1351
1356
|
return n.length ? n.join("\n") : null;
|
|
1352
|
-
},
|
|
1357
|
+
}, Nr = (e) => {
|
|
1353
1358
|
let t = e.split("\n");
|
|
1354
1359
|
if (!t.length) return e;
|
|
1355
|
-
let n =
|
|
1356
|
-
return n && !
|
|
1360
|
+
let n = kr(t[0]);
|
|
1361
|
+
return n && !Er(t[0].slice(0, t[0].indexOf("```"))) && (t.shift(), n.sameLineBody && t.unshift(Ar(n.sameLineBody))), t.length && Sr.test(t[t.length - 1] ?? "") && t.pop(), t.join("\n");
|
|
1357
1362
|
};
|
|
1358
|
-
function
|
|
1363
|
+
function Pr(e) {
|
|
1359
1364
|
if (!e) return {
|
|
1360
1365
|
html: "",
|
|
1361
1366
|
pending: !1
|
|
1362
1367
|
};
|
|
1363
|
-
let { text: t, withheld: n } =
|
|
1368
|
+
let { text: t, withheld: n } = Or(Dr(e));
|
|
1364
1369
|
if (!t.trim()) return {
|
|
1365
1370
|
html: "",
|
|
1366
|
-
pending: n ||
|
|
1371
|
+
pending: n || br.test(Dr(e).trim())
|
|
1367
1372
|
};
|
|
1368
|
-
let r =
|
|
1373
|
+
let r = Mr(t) ?? t, i = Mr(r);
|
|
1369
1374
|
i !== null && i !== r && (r = i);
|
|
1370
1375
|
let a = r.trim();
|
|
1371
|
-
return
|
|
1376
|
+
return Tr(a) ? {
|
|
1372
1377
|
html: a,
|
|
1373
1378
|
pending: !1
|
|
1374
1379
|
} : {
|
|
@@ -1378,32 +1383,32 @@ function jr(e) {
|
|
|
1378
1383
|
}
|
|
1379
1384
|
//#endregion
|
|
1380
1385
|
//#region src/components/Editor/utils/prepareTypesetProposed.ts
|
|
1381
|
-
var
|
|
1382
|
-
function
|
|
1383
|
-
if (!e.trim() || !
|
|
1386
|
+
var Fr = "p, h1, h2, h3, li", Ir = /background(-color)?\s*:/i;
|
|
1387
|
+
function Lr(e) {
|
|
1388
|
+
if (!e.trim() || !Ir.test(e)) return e;
|
|
1384
1389
|
let t = se(e);
|
|
1385
1390
|
if (!t) return e;
|
|
1386
|
-
for (let e of Array.from(t.querySelectorAll(
|
|
1391
|
+
for (let e of Array.from(t.querySelectorAll(Fr))) {
|
|
1387
1392
|
let t = e;
|
|
1388
1393
|
t.style.removeProperty("background-color"), t.style.removeProperty("background"), t.getAttribute("style")?.trim() || t.removeAttribute("style");
|
|
1389
1394
|
}
|
|
1390
1395
|
return t.innerHTML;
|
|
1391
1396
|
}
|
|
1392
|
-
function
|
|
1393
|
-
let { html: n } =
|
|
1394
|
-
return n ?
|
|
1397
|
+
function Rr(e, t) {
|
|
1398
|
+
let { html: n } = Pr(e);
|
|
1399
|
+
return n ? Lr(ee(n, t)) : "";
|
|
1395
1400
|
}
|
|
1396
1401
|
//#endregion
|
|
1397
1402
|
//#region src/components/Editor/utils/applyAiTypeset.ts
|
|
1398
|
-
function
|
|
1399
|
-
let i =
|
|
1403
|
+
function zr(e, t, n, r) {
|
|
1404
|
+
let i = T(Rr(t, n));
|
|
1400
1405
|
if (!i.trim() || ie(i, "")) return {
|
|
1401
1406
|
applied: !1,
|
|
1402
1407
|
truncated: !1
|
|
1403
1408
|
};
|
|
1404
1409
|
let a = !1;
|
|
1405
1410
|
return e.update(() => {
|
|
1406
|
-
ne(e, i),
|
|
1411
|
+
ne(e, i), tr(r) && (a = nr(e, r));
|
|
1407
1412
|
}, { discrete: !0 }), {
|
|
1408
1413
|
applied: !0,
|
|
1409
1414
|
truncated: a
|
|
@@ -1411,26 +1416,26 @@ function Ir(e, t, n, r) {
|
|
|
1411
1416
|
}
|
|
1412
1417
|
//#endregion
|
|
1413
1418
|
//#region src/components/Editor/Preview/Thinking.tsx
|
|
1414
|
-
var
|
|
1419
|
+
var Br = [
|
|
1415
1420
|
.26,
|
|
1416
1421
|
.02,
|
|
1417
1422
|
.23,
|
|
1418
1423
|
.94
|
|
1419
|
-
],
|
|
1420
|
-
let e = `${
|
|
1421
|
-
return /* @__PURE__ */
|
|
1424
|
+
], Vr = () => {
|
|
1425
|
+
let e = `${we().replace(/:/g, "")}g`;
|
|
1426
|
+
return /* @__PURE__ */ M("span", {
|
|
1422
1427
|
className: j["bsy-lexical-ai__think-icon"],
|
|
1423
1428
|
"aria-hidden": "true",
|
|
1424
|
-
children: /* @__PURE__ */
|
|
1429
|
+
children: /* @__PURE__ */ N("svg", {
|
|
1425
1430
|
xmlns: "http://www.w3.org/2000/svg",
|
|
1426
1431
|
width: "16",
|
|
1427
1432
|
height: "16",
|
|
1428
1433
|
viewBox: "0 0 16 16",
|
|
1429
1434
|
fill: "none",
|
|
1430
|
-
children: [/* @__PURE__ */
|
|
1435
|
+
children: [/* @__PURE__ */ M("path", {
|
|
1431
1436
|
d: "M6.33965 13.3C6.27366 13.4143 6.23082 13.5404 6.21357 13.6712C6.19633 13.802 6.20502 13.9349 6.23914 14.0624C6.30806 14.3198 6.47641 14.5392 6.70715 14.6725C6.93788 14.8058 7.21211 14.8419 7.46951 14.773C7.59696 14.7389 7.71644 14.68 7.82112 14.5997C7.92581 14.5194 8.01366 14.4193 8.07965 14.305C8.21292 14.0743 8.24907 13.8 8.18015 13.5426C8.11123 13.2852 7.94288 13.0658 7.71215 12.9325C7.48141 12.7992 7.20718 12.7631 6.94978 12.832C6.69239 12.9009 6.47292 13.0693 6.33965 13.3ZM8.97265 1C7.44126 0.999778 5.95165 1.4994 4.73011 2.42295C3.69009 3.20927 2.89277 4.26631 2.4213 5.47246C2.33326 5.69768 2.00678 5.72579 1.89765 5.51L1.80165 5.356C1.64959 5.15708 1.42869 5.02215 1.18228 4.97769C0.935881 4.93323 0.681756 4.98244 0.469763 5.11567C0.25777 5.24891 0.103209 5.45654 0.0364008 5.69785C-0.0304072 5.93915 -0.00464041 6.19671 0.108646 6.42L1.34765 8.852L1.45565 9.032C1.86065 9.598 2.61765 9.782 3.23665 9.467L5.62665 8.25L5.78165 8.153C5.98057 8.00094 6.11549 7.78004 6.15995 7.53364C6.20442 7.28723 6.1552 7.03311 6.02197 6.82112C5.88874 6.60912 5.68111 6.45456 5.4398 6.38775C5.19849 6.32095 4.94093 6.34671 4.71765 6.46C4.48237 6.579 4.22662 6.36717 4.32655 6.12317C4.56067 5.55153 4.899 5.02613 5.32623 4.57461C5.90933 3.95836 6.63902 3.49984 7.44723 3.24183C8.25544 2.98382 9.11583 2.93472 9.94815 3.09912C10.7805 3.26352 11.5576 3.63606 12.207 4.18198C12.8564 4.7279 13.357 5.42942 13.662 6.22109C13.967 7.01276 14.0665 7.86879 13.9512 8.70932C13.836 9.54985 13.5097 10.3475 13.0028 11.0278C12.496 11.7082 11.8251 12.249 11.0526 12.6C10.9326 12.654 10.7796 12.71 10.5976 12.766C10.3241 12.8507 10.0934 13.0371 9.95295 13.2867C9.81252 13.5363 9.77305 13.8302 9.84265 14.108C9.90673 14.3421 10.0611 14.5412 10.2718 14.6615C10.4826 14.7819 10.7325 14.8137 10.9666 14.75C11.2736 14.666 11.5226 14.584 11.7136 14.503C13.2066 13.8705 14.435 12.7413 15.1908 11.3067C15.9466 9.87221 16.1832 8.22052 15.8607 6.63149C15.5381 5.04246 14.6762 3.61377 13.4209 2.58747C12.1656 1.56117 10.5941 1.00034 8.97265 1ZM4.16665 10.876C3.90024 10.876 3.64474 10.9818 3.45636 11.1702C3.26798 11.3586 3.16215 11.6141 3.16215 11.8805C3.16215 12.1469 3.26798 12.4024 3.45636 12.5908C3.64474 12.7792 3.90024 12.885 4.16665 12.885C4.43306 12.885 4.68855 12.7792 4.87694 12.5908C5.06532 12.4024 5.17115 12.1469 5.17115 11.8805C5.17115 11.6141 5.06532 11.3586 4.87694 11.1702C4.68855 10.9818 4.43306 10.876 4.16665 10.876Z",
|
|
1432
1437
|
fill: `url(#${e})`
|
|
1433
|
-
}), /* @__PURE__ */
|
|
1438
|
+
}), /* @__PURE__ */ M("defs", { children: /* @__PURE__ */ N("linearGradient", {
|
|
1434
1439
|
id: e,
|
|
1435
1440
|
x1: "8.00059",
|
|
1436
1441
|
y1: "1",
|
|
@@ -1438,12 +1443,12 @@ var Lr = [
|
|
|
1438
1443
|
y2: "14.8072",
|
|
1439
1444
|
gradientUnits: "userSpaceOnUse",
|
|
1440
1445
|
children: [
|
|
1441
|
-
/* @__PURE__ */
|
|
1442
|
-
/* @__PURE__ */
|
|
1446
|
+
/* @__PURE__ */ M("stop", { stopColor: "#0265FF" }),
|
|
1447
|
+
/* @__PURE__ */ M("stop", {
|
|
1443
1448
|
offset: "1",
|
|
1444
1449
|
stopColor: "#A6FFFF"
|
|
1445
1450
|
}),
|
|
1446
|
-
/* @__PURE__ */
|
|
1451
|
+
/* @__PURE__ */ M("animateTransform", {
|
|
1447
1452
|
attributeName: "gradientTransform",
|
|
1448
1453
|
type: "rotate",
|
|
1449
1454
|
from: "0 8 8",
|
|
@@ -1456,14 +1461,14 @@ var Lr = [
|
|
|
1456
1461
|
})
|
|
1457
1462
|
});
|
|
1458
1463
|
};
|
|
1459
|
-
function
|
|
1460
|
-
let { t: i } = n(), a = e.status === "loading" && !t, [o, s] =
|
|
1464
|
+
function Hr(e, t, r) {
|
|
1465
|
+
let { t: i } = n(), a = e.status === "loading" && !t, [o, s] = R(!0), [c, l] = R(0), u = L(Date.now()), d = L(null), f = L(!1), p = L(!1), m = e.reasoning ?? "", h = a || o, g = (a || !!m) && !(e.status === "error" && !m), _ = (e) => {
|
|
1461
1466
|
!e || !p.current || (p.current = !1, e.scrollHeight - e.scrollTop - e.clientHeight > 8 && (f.current = !0));
|
|
1462
|
-
}, v =
|
|
1467
|
+
}, v = P(() => r?.current ?? void 0, [r]), y = P(() => {
|
|
1463
1468
|
let e = v();
|
|
1464
1469
|
return e?.closest("[data-overlayscrollbars]") ?? e;
|
|
1465
1470
|
}, [v]);
|
|
1466
|
-
return
|
|
1471
|
+
return F(() => {
|
|
1467
1472
|
if (!a) {
|
|
1468
1473
|
d.current === null && (d.current = Math.max(1, Math.round((Date.now() - u.current) / 1e3)), l(d.current)), s(!1);
|
|
1469
1474
|
return;
|
|
@@ -1473,26 +1478,26 @@ function zr(e, t, r) {
|
|
|
1473
1478
|
l(Math.max(1, Math.round((Date.now() - u.current) / 1e3)));
|
|
1474
1479
|
}, 500);
|
|
1475
1480
|
return () => window.clearInterval(e);
|
|
1476
|
-
}, [a]),
|
|
1481
|
+
}, [a]), F(() => {
|
|
1477
1482
|
p.current = !1;
|
|
1478
|
-
}, [
|
|
1483
|
+
}, [Oe()]), ke("wheel", () => {
|
|
1479
1484
|
p.current = !0;
|
|
1480
1485
|
}, {
|
|
1481
1486
|
target: y,
|
|
1482
1487
|
passive: !0,
|
|
1483
1488
|
enable: a
|
|
1484
|
-
}),
|
|
1489
|
+
}), ke("pointerdown", (e) => {
|
|
1485
1490
|
let t = e.target;
|
|
1486
1491
|
t instanceof Element && t.closest(".os-scrollbar") && (p.current = !0);
|
|
1487
1492
|
}, {
|
|
1488
1493
|
target: y,
|
|
1489
1494
|
passive: !0,
|
|
1490
1495
|
enable: a
|
|
1491
|
-
}),
|
|
1496
|
+
}), ke("scroll", () => _(v()), {
|
|
1492
1497
|
target: v,
|
|
1493
1498
|
passive: !0,
|
|
1494
1499
|
enable: a
|
|
1495
|
-
}),
|
|
1500
|
+
}), F(() => {
|
|
1496
1501
|
if (!a || f.current || !r?.current) return;
|
|
1497
1502
|
let e = window.requestAnimationFrame(() => {
|
|
1498
1503
|
if (f.current) return;
|
|
@@ -1514,21 +1519,21 @@ function zr(e, t, r) {
|
|
|
1514
1519
|
onViewportScroll: () => _(r?.current)
|
|
1515
1520
|
};
|
|
1516
1521
|
}
|
|
1517
|
-
var
|
|
1522
|
+
var Ur = ({ model: t }) => t.visible ? /* @__PURE__ */ N("button", {
|
|
1518
1523
|
type: "button",
|
|
1519
1524
|
className: j["bsy-lexical-ai__think-head"],
|
|
1520
1525
|
disabled: t.thinking,
|
|
1521
1526
|
onClick: t.toggle,
|
|
1522
|
-
children: [t.thinking ? /* @__PURE__ */
|
|
1527
|
+
children: [t.thinking ? /* @__PURE__ */ M(Vr, {}) : /* @__PURE__ */ M(e, {
|
|
1523
1528
|
name: "arrow-down",
|
|
1524
1529
|
size: 12,
|
|
1525
|
-
className:
|
|
1526
|
-
}), /* @__PURE__ */
|
|
1530
|
+
className: z(j["bsy-lexical-ai__think-arrow"], t.open && j["bsy-lexical-ai__think-arrow--open"])
|
|
1531
|
+
}), /* @__PURE__ */ M("span", {
|
|
1527
1532
|
className: j["bsy-lexical-ai__think-label"],
|
|
1528
|
-
children: /* @__PURE__ */
|
|
1533
|
+
children: /* @__PURE__ */ M(Ae, {
|
|
1529
1534
|
mode: "popLayout",
|
|
1530
1535
|
initial: !1,
|
|
1531
|
-
children: /* @__PURE__ */
|
|
1536
|
+
children: /* @__PURE__ */ M(je.span, {
|
|
1532
1537
|
initial: {
|
|
1533
1538
|
opacity: 0,
|
|
1534
1539
|
y: 6
|
|
@@ -1543,30 +1548,30 @@ var Br = ({ model: t }) => t.visible ? /* @__PURE__ */ P("button", {
|
|
|
1543
1548
|
},
|
|
1544
1549
|
transition: {
|
|
1545
1550
|
duration: .22,
|
|
1546
|
-
ease:
|
|
1551
|
+
ease: Br
|
|
1547
1552
|
},
|
|
1548
|
-
children: /* @__PURE__ */
|
|
1553
|
+
children: /* @__PURE__ */ M("span", {
|
|
1549
1554
|
className: t.thinking ? j["bsy-lexical-ai__think-label--shimmer"] : void 0,
|
|
1550
1555
|
children: t.label
|
|
1551
1556
|
})
|
|
1552
1557
|
}, t.label)
|
|
1553
1558
|
})
|
|
1554
1559
|
})]
|
|
1555
|
-
}) : null,
|
|
1556
|
-
let [t, n] =
|
|
1557
|
-
if (
|
|
1560
|
+
}) : null, Wr = ({ model: e }) => {
|
|
1561
|
+
let [t, n] = R(!0), r = Ce(e.reasoning);
|
|
1562
|
+
if (F(() => {
|
|
1558
1563
|
e.open || n(!0);
|
|
1559
1564
|
}, [e.open]), !e.visible) return null;
|
|
1560
|
-
let i = /* @__PURE__ */
|
|
1565
|
+
let i = /* @__PURE__ */ M("div", {
|
|
1561
1566
|
className: j["bsy-lexical-ai__think-body"],
|
|
1562
1567
|
children: r
|
|
1563
1568
|
});
|
|
1564
|
-
return !t && e.open && e.reasoning ? /* @__PURE__ */
|
|
1565
|
-
className:
|
|
1569
|
+
return !t && e.open && e.reasoning ? /* @__PURE__ */ M("div", {
|
|
1570
|
+
className: z(j["bsy-lexical-ai__think-collapse"], j["bsy-lexical-ai__think-collapse--grown"]),
|
|
1566
1571
|
children: i
|
|
1567
|
-
}) : /* @__PURE__ */
|
|
1572
|
+
}) : /* @__PURE__ */ M(Ae, {
|
|
1568
1573
|
initial: !1,
|
|
1569
|
-
children: e.open && e.reasoning ? /* @__PURE__ */
|
|
1574
|
+
children: e.open && e.reasoning ? /* @__PURE__ */ M(je.div, {
|
|
1570
1575
|
initial: {
|
|
1571
1576
|
height: 0,
|
|
1572
1577
|
opacity: 0
|
|
@@ -1594,57 +1599,57 @@ var Br = ({ model: t }) => t.visible ? /* @__PURE__ */ P("button", {
|
|
|
1594
1599
|
children: i
|
|
1595
1600
|
}, "think-body") : null
|
|
1596
1601
|
});
|
|
1597
|
-
},
|
|
1598
|
-
let [t, n] =
|
|
1599
|
-
return
|
|
1600
|
-
!e ||
|
|
1601
|
-
}, [e]), t ? /* @__PURE__ */
|
|
1602
|
-
className:
|
|
1602
|
+
}, Gr = ({ html: e }) => {
|
|
1603
|
+
let [t, n] = R(() => e && !D(e) ? T(e) : "");
|
|
1604
|
+
return F(() => {
|
|
1605
|
+
!e || D(e) || n(T(e));
|
|
1606
|
+
}, [e]), t ? /* @__PURE__ */ M("div", {
|
|
1607
|
+
className: z("bsy-lexical-editor", j["bsy-lexical-ai__html"]),
|
|
1603
1608
|
dangerouslySetInnerHTML: { __html: t }
|
|
1604
1609
|
}) : null;
|
|
1605
|
-
},
|
|
1610
|
+
}, Kr = {
|
|
1606
1611
|
paddingAbsolute: !0,
|
|
1607
1612
|
overflow: {
|
|
1608
1613
|
x: "hidden",
|
|
1609
1614
|
y: "scroll"
|
|
1610
1615
|
}
|
|
1611
|
-
},
|
|
1612
|
-
let { t: m } = n(), [h, g] =
|
|
1616
|
+
}, qr = ({ status: r, reasoning: o, errorMessage: s, originalHtml: c, proposedHtml: l, preset: u, onPresetChange: d, onCancel: f, onApply: p }) => {
|
|
1617
|
+
let { t: m } = n(), [h, g] = R(!0), _ = L(null), v = !!l.trim(), y = r === "ready" && v, b = Hr({
|
|
1613
1618
|
status: r,
|
|
1614
1619
|
reasoning: o
|
|
1615
|
-
}, v, _), S =
|
|
1620
|
+
}, v, _), S = E.map((e) => ({
|
|
1616
1621
|
key: e,
|
|
1617
1622
|
label: m(x[e])
|
|
1618
1623
|
}));
|
|
1619
|
-
return /* @__PURE__ */
|
|
1624
|
+
return /* @__PURE__ */ M(t, {
|
|
1620
1625
|
title: m("editor.aiPolish"),
|
|
1621
1626
|
open: h,
|
|
1622
1627
|
width: "800px",
|
|
1623
1628
|
fullSwitch: !0,
|
|
1624
1629
|
afterClose: f,
|
|
1625
1630
|
onOpenChange: g,
|
|
1626
|
-
children: /* @__PURE__ */
|
|
1631
|
+
children: /* @__PURE__ */ N("div", {
|
|
1627
1632
|
className: j["bsy-lexical-ai__dialog"],
|
|
1628
|
-
children: [/* @__PURE__ */
|
|
1633
|
+
children: [/* @__PURE__ */ N("div", {
|
|
1629
1634
|
className: j["bsy-lexical-ai__pane"],
|
|
1630
|
-
children: [/* @__PURE__ */
|
|
1635
|
+
children: [/* @__PURE__ */ N("div", {
|
|
1631
1636
|
className: j["bsy-lexical-ai__column"],
|
|
1632
|
-
children: [/* @__PURE__ */
|
|
1633
|
-
className:
|
|
1634
|
-
children: [/* @__PURE__ */
|
|
1635
|
-
}), /* @__PURE__ */
|
|
1637
|
+
children: [/* @__PURE__ */ N("div", {
|
|
1638
|
+
className: z(j["bsy-lexical-ai__column-title"], j["bsy-lexical-ai__column-title--before"]),
|
|
1639
|
+
children: [/* @__PURE__ */ M("span", { className: j["bsy-lexical-ai__column-dot"] }), m("editor.aiOriginal")]
|
|
1640
|
+
}), /* @__PURE__ */ M(i, {
|
|
1636
1641
|
className: j["bsy-lexical-ai__column-body"],
|
|
1637
|
-
options:
|
|
1638
|
-
children: /* @__PURE__ */
|
|
1642
|
+
options: Kr,
|
|
1643
|
+
children: /* @__PURE__ */ M(Gr, { html: c })
|
|
1639
1644
|
})]
|
|
1640
|
-
}), /* @__PURE__ */
|
|
1645
|
+
}), /* @__PURE__ */ N("div", {
|
|
1641
1646
|
className: j["bsy-lexical-ai__column"],
|
|
1642
|
-
children: [/* @__PURE__ */
|
|
1647
|
+
children: [/* @__PURE__ */ N("div", {
|
|
1643
1648
|
className: j["bsy-lexical-ai__column-head"],
|
|
1644
|
-
children: [/* @__PURE__ */
|
|
1645
|
-
className:
|
|
1646
|
-
children: [/* @__PURE__ */
|
|
1647
|
-
}), /* @__PURE__ */
|
|
1649
|
+
children: [/* @__PURE__ */ N("div", {
|
|
1650
|
+
className: z(j["bsy-lexical-ai__column-title"], j["bsy-lexical-ai__column-title--after"]),
|
|
1651
|
+
children: [/* @__PURE__ */ M("span", { className: j["bsy-lexical-ai__column-dot"] }), m("editor.aiOptimized")]
|
|
1652
|
+
}), /* @__PURE__ */ M(a, {
|
|
1648
1653
|
menus: S,
|
|
1649
1654
|
showSearch: !1,
|
|
1650
1655
|
activeKey: [u],
|
|
@@ -1657,39 +1662,39 @@ var Br = ({ model: t }) => t.visible ? /* @__PURE__ */ P("button", {
|
|
|
1657
1662
|
minWidth: 90
|
|
1658
1663
|
},
|
|
1659
1664
|
onClick: (e) => d(e.key),
|
|
1660
|
-
children: /* @__PURE__ */
|
|
1665
|
+
children: /* @__PURE__ */ N("button", {
|
|
1661
1666
|
type: "button",
|
|
1662
1667
|
className: j["bsy-lexical-ai__preset"],
|
|
1663
1668
|
title: m("editor.aiPolish"),
|
|
1664
|
-
children: [m(x[u]), /* @__PURE__ */
|
|
1669
|
+
children: [m(x[u]), /* @__PURE__ */ M(e, {
|
|
1665
1670
|
name: "arrow-down",
|
|
1666
1671
|
size: 16
|
|
1667
1672
|
})]
|
|
1668
1673
|
})
|
|
1669
1674
|
})]
|
|
1670
|
-
}), /* @__PURE__ */
|
|
1675
|
+
}), /* @__PURE__ */ N("div", {
|
|
1671
1676
|
className: j["bsy-lexical-ai__column-stack"],
|
|
1672
|
-
children: [b.visible ? /* @__PURE__ */
|
|
1677
|
+
children: [b.visible ? /* @__PURE__ */ M("div", {
|
|
1673
1678
|
className: j["bsy-lexical-ai__think-pin"],
|
|
1674
|
-
children: /* @__PURE__ */
|
|
1675
|
-
}) : null, /* @__PURE__ */
|
|
1679
|
+
children: /* @__PURE__ */ M(Ur, { model: b })
|
|
1680
|
+
}) : null, /* @__PURE__ */ N(i, {
|
|
1676
1681
|
className: j["bsy-lexical-ai__column-body"],
|
|
1677
|
-
options:
|
|
1682
|
+
options: Kr,
|
|
1678
1683
|
viewportRef: _,
|
|
1679
1684
|
onScroll: b.onViewportScroll,
|
|
1680
|
-
children: [r === "error" ? /* @__PURE__ */
|
|
1685
|
+
children: [r === "error" ? /* @__PURE__ */ M("div", {
|
|
1681
1686
|
className: j["bsy-lexical-ai__error"],
|
|
1682
1687
|
children: s || m("editor.aiError")
|
|
1683
|
-
}) : /* @__PURE__ */
|
|
1688
|
+
}) : /* @__PURE__ */ M(Wr, { model: b }), v ? /* @__PURE__ */ M(Gr, { html: l }) : null]
|
|
1684
1689
|
})]
|
|
1685
1690
|
})]
|
|
1686
1691
|
})]
|
|
1687
|
-
}), /* @__PURE__ */
|
|
1692
|
+
}), /* @__PURE__ */ N("div", {
|
|
1688
1693
|
className: j["bsy-lexical-ai__footer"],
|
|
1689
|
-
children: [/* @__PURE__ */
|
|
1694
|
+
children: [/* @__PURE__ */ M(Ee, {
|
|
1690
1695
|
onClick: () => g(!1),
|
|
1691
1696
|
children: m("editor.aiAbandon")
|
|
1692
|
-
}), /* @__PURE__ */
|
|
1697
|
+
}), /* @__PURE__ */ M(Ee, {
|
|
1693
1698
|
type: "primary",
|
|
1694
1699
|
disabled: !y,
|
|
1695
1700
|
onClick: () => p() && g(!1),
|
|
@@ -1698,66 +1703,66 @@ var Br = ({ model: t }) => t.visible ? /* @__PURE__ */ P("button", {
|
|
|
1698
1703
|
})]
|
|
1699
1704
|
})
|
|
1700
1705
|
});
|
|
1701
|
-
},
|
|
1706
|
+
}, Jr = {
|
|
1702
1707
|
paddingAbsolute: !0,
|
|
1703
1708
|
overflow: {
|
|
1704
1709
|
x: "hidden",
|
|
1705
1710
|
y: "scroll"
|
|
1706
1711
|
}
|
|
1707
|
-
},
|
|
1708
|
-
let { t: u } = n(), [d, f] =
|
|
1712
|
+
}, Yr = ({ status: e, reasoning: r, errorMessage: a, originalHtml: o, proposedHtml: s, onCancel: c, onApply: l }) => {
|
|
1713
|
+
let { t: u } = n(), [d, f] = R(!0), p = L(null), m = !!s.trim(), h = e === "ready" && m, g = Hr({
|
|
1709
1714
|
status: e,
|
|
1710
1715
|
reasoning: r
|
|
1711
1716
|
}, m, p);
|
|
1712
|
-
return /* @__PURE__ */
|
|
1717
|
+
return /* @__PURE__ */ M(t, {
|
|
1713
1718
|
title: u("editor.aiPreview"),
|
|
1714
1719
|
open: d,
|
|
1715
1720
|
width: "800px",
|
|
1716
1721
|
fullSwitch: !0,
|
|
1717
1722
|
afterClose: c,
|
|
1718
1723
|
onOpenChange: f,
|
|
1719
|
-
children: /* @__PURE__ */
|
|
1724
|
+
children: /* @__PURE__ */ N("div", {
|
|
1720
1725
|
className: j["bsy-lexical-ai__dialog"],
|
|
1721
|
-
children: [/* @__PURE__ */
|
|
1726
|
+
children: [/* @__PURE__ */ N("div", {
|
|
1722
1727
|
className: j["bsy-lexical-ai__pane"],
|
|
1723
|
-
children: [/* @__PURE__ */
|
|
1728
|
+
children: [/* @__PURE__ */ N("div", {
|
|
1724
1729
|
className: j["bsy-lexical-ai__column"],
|
|
1725
|
-
children: [/* @__PURE__ */
|
|
1726
|
-
className:
|
|
1727
|
-
children: [/* @__PURE__ */
|
|
1728
|
-
}), /* @__PURE__ */
|
|
1730
|
+
children: [/* @__PURE__ */ N("div", {
|
|
1731
|
+
className: z(j["bsy-lexical-ai__column-title"], j["bsy-lexical-ai__column-title--before"]),
|
|
1732
|
+
children: [/* @__PURE__ */ M("span", { className: j["bsy-lexical-ai__column-dot"] }), u("editor.aiOriginal")]
|
|
1733
|
+
}), /* @__PURE__ */ M(i, {
|
|
1729
1734
|
className: j["bsy-lexical-ai__column-body"],
|
|
1730
|
-
options:
|
|
1731
|
-
children: /* @__PURE__ */
|
|
1735
|
+
options: Jr,
|
|
1736
|
+
children: /* @__PURE__ */ M(Gr, { html: o })
|
|
1732
1737
|
})]
|
|
1733
|
-
}), /* @__PURE__ */
|
|
1738
|
+
}), /* @__PURE__ */ N("div", {
|
|
1734
1739
|
className: j["bsy-lexical-ai__column"],
|
|
1735
|
-
children: [/* @__PURE__ */
|
|
1736
|
-
className:
|
|
1737
|
-
children: [/* @__PURE__ */
|
|
1738
|
-
}), /* @__PURE__ */
|
|
1740
|
+
children: [/* @__PURE__ */ N("div", {
|
|
1741
|
+
className: z(j["bsy-lexical-ai__column-title"], j["bsy-lexical-ai__column-title--after"]),
|
|
1742
|
+
children: [/* @__PURE__ */ M("span", { className: j["bsy-lexical-ai__column-dot"] }), u("editor.aiOptimized")]
|
|
1743
|
+
}), /* @__PURE__ */ N("div", {
|
|
1739
1744
|
className: j["bsy-lexical-ai__column-stack"],
|
|
1740
|
-
children: [g.visible ? /* @__PURE__ */
|
|
1745
|
+
children: [g.visible ? /* @__PURE__ */ M("div", {
|
|
1741
1746
|
className: j["bsy-lexical-ai__think-pin"],
|
|
1742
|
-
children: /* @__PURE__ */
|
|
1743
|
-
}) : null, /* @__PURE__ */
|
|
1747
|
+
children: /* @__PURE__ */ M(Ur, { model: g })
|
|
1748
|
+
}) : null, /* @__PURE__ */ N(i, {
|
|
1744
1749
|
className: j["bsy-lexical-ai__column-body"],
|
|
1745
|
-
options:
|
|
1750
|
+
options: Jr,
|
|
1746
1751
|
viewportRef: p,
|
|
1747
1752
|
onScroll: g.onViewportScroll,
|
|
1748
|
-
children: [e === "error" ? /* @__PURE__ */
|
|
1753
|
+
children: [e === "error" ? /* @__PURE__ */ M("div", {
|
|
1749
1754
|
className: j["bsy-lexical-ai__error"],
|
|
1750
1755
|
children: a || u("editor.aiError")
|
|
1751
|
-
}) : /* @__PURE__ */
|
|
1756
|
+
}) : /* @__PURE__ */ M(Wr, { model: g }), m ? /* @__PURE__ */ M(Gr, { html: s }) : null]
|
|
1752
1757
|
})]
|
|
1753
1758
|
})]
|
|
1754
1759
|
})]
|
|
1755
|
-
}), /* @__PURE__ */
|
|
1760
|
+
}), /* @__PURE__ */ N("div", {
|
|
1756
1761
|
className: j["bsy-lexical-ai__footer"],
|
|
1757
|
-
children: [/* @__PURE__ */
|
|
1762
|
+
children: [/* @__PURE__ */ M(Ee, {
|
|
1758
1763
|
onClick: () => f(!1),
|
|
1759
1764
|
children: u("editor.aiAbandon")
|
|
1760
|
-
}), /* @__PURE__ */
|
|
1765
|
+
}), /* @__PURE__ */ M(Ee, {
|
|
1761
1766
|
type: "primary",
|
|
1762
1767
|
disabled: !h,
|
|
1763
1768
|
onClick: () => l() && f(!1),
|
|
@@ -1766,9 +1771,9 @@ var Br = ({ model: t }) => t.visible ? /* @__PURE__ */ P("button", {
|
|
|
1766
1771
|
})]
|
|
1767
1772
|
})
|
|
1768
1773
|
});
|
|
1769
|
-
},
|
|
1770
|
-
function
|
|
1771
|
-
let [i, a] =
|
|
1774
|
+
}, $ = (e) => !e || D(e) ? e : te(T(e));
|
|
1775
|
+
function Xr(e, t, n, r) {
|
|
1776
|
+
let [i, a] = R(""), o = L({
|
|
1772
1777
|
originalHtml: t,
|
|
1773
1778
|
text: n
|
|
1774
1779
|
});
|
|
@@ -1776,8 +1781,8 @@ function Jr(e, t, n, r) {
|
|
|
1776
1781
|
originalHtml: t,
|
|
1777
1782
|
text: n
|
|
1778
1783
|
};
|
|
1779
|
-
let s =
|
|
1780
|
-
return
|
|
1784
|
+
let s = L(null);
|
|
1785
|
+
return Te(() => {
|
|
1781
1786
|
let t = () => {
|
|
1782
1787
|
s.current !== null && (cancelAnimationFrame(s.current), s.current = null);
|
|
1783
1788
|
};
|
|
@@ -1788,7 +1793,7 @@ function Jr(e, t, n, r) {
|
|
|
1788
1793
|
let n = () => {
|
|
1789
1794
|
s.current = null;
|
|
1790
1795
|
let e = o.current;
|
|
1791
|
-
a(
|
|
1796
|
+
a($(w(e.originalHtml, e.text)));
|
|
1792
1797
|
};
|
|
1793
1798
|
if (r === "ready" || r === "error") {
|
|
1794
1799
|
t(), n();
|
|
@@ -1800,29 +1805,29 @@ function Jr(e, t, n, r) {
|
|
|
1800
1805
|
t,
|
|
1801
1806
|
r,
|
|
1802
1807
|
n
|
|
1803
|
-
]),
|
|
1808
|
+
]), F(() => () => {
|
|
1804
1809
|
s.current !== null && cancelAnimationFrame(s.current);
|
|
1805
1810
|
}, []), i;
|
|
1806
1811
|
}
|
|
1807
|
-
var
|
|
1808
|
-
let [r] =
|
|
1809
|
-
|
|
1812
|
+
var Zr = ({ maxLength: e, onMaxLengthExceed: t }) => {
|
|
1813
|
+
let [r] = W(), { aiOpen: i, setAiOpen: a, aiSessionRef: o, stop: s, polish: l } = le(), { t: u } = n(), [d, f] = De.useMessage(), p = o.current, { text: m, reasoning: h, status: g, errorMessage: _ } = c(), v = !g || g === "idle" ? "loading" : g, y = m, b = $(i === "typeset" ? Rr(y, p?.codeBlocks ?? []) : ""), x = $(p?.originalHtml || ""), S = i === "polish" ? $(p?.originalHtml || "") : "", C = Xr(i === "polish", p?.originalHtml || "", y, v);
|
|
1814
|
+
F(() => {
|
|
1810
1815
|
if (i) return r.setEditable(!1), r.update(() => {
|
|
1811
|
-
|
|
1816
|
+
nt(null);
|
|
1812
1817
|
}), window.getSelection()?.removeAllRanges(), r.getRootElement()?.blur(), () => {
|
|
1813
1818
|
r.setEditable(!0);
|
|
1814
1819
|
};
|
|
1815
1820
|
}, [i, r]);
|
|
1816
|
-
let w =
|
|
1821
|
+
let w = P(() => {
|
|
1817
1822
|
s?.(), o.current = null, a(null);
|
|
1818
1823
|
}, [
|
|
1819
1824
|
o,
|
|
1820
1825
|
a,
|
|
1821
1826
|
s
|
|
1822
|
-
]),
|
|
1827
|
+
]), ee = P(() => {
|
|
1823
1828
|
if (i !== "typeset" || v !== "ready") return !1;
|
|
1824
1829
|
r.setEditable(!0);
|
|
1825
|
-
let { applied: n, truncated: a } =
|
|
1830
|
+
let { applied: n, truncated: a } = zr(r, y, o.current?.codeBlocks ?? [], e);
|
|
1826
1831
|
return n ? (a && t?.(), !0) : (r.setEditable(!1), d.warning(u("editor.aiApplyEmpty")), !1);
|
|
1827
1832
|
}, [
|
|
1828
1833
|
i,
|
|
@@ -1834,14 +1839,14 @@ var Yr = ({ maxLength: e, onMaxLengthExceed: t }) => {
|
|
|
1834
1839
|
v,
|
|
1835
1840
|
u,
|
|
1836
1841
|
y
|
|
1837
|
-
]),
|
|
1842
|
+
]), T = P(() => i !== "polish" || v !== "ready" ? !1 : oe(r, y) ? !0 : (d.warning(u("editor.aiApplyEmpty")), !1), [
|
|
1838
1843
|
i,
|
|
1839
1844
|
r,
|
|
1840
1845
|
d,
|
|
1841
1846
|
v,
|
|
1842
1847
|
u,
|
|
1843
1848
|
y
|
|
1844
|
-
]),
|
|
1849
|
+
]), E = P((e) => {
|
|
1845
1850
|
let t = o.current;
|
|
1846
1851
|
!t?.originalText || !l || (t.preset = e, s?.(), l({
|
|
1847
1852
|
text: t.originalText,
|
|
@@ -1852,39 +1857,39 @@ var Yr = ({ maxLength: e, onMaxLengthExceed: t }) => {
|
|
|
1852
1857
|
l,
|
|
1853
1858
|
s
|
|
1854
1859
|
]);
|
|
1855
|
-
return i ? /* @__PURE__ */
|
|
1860
|
+
return i ? /* @__PURE__ */ N(ye, { children: [f, i === "typeset" ? /* @__PURE__ */ M(Yr, {
|
|
1856
1861
|
status: v,
|
|
1857
1862
|
reasoning: h,
|
|
1858
1863
|
errorMessage: _,
|
|
1859
1864
|
originalHtml: x,
|
|
1860
1865
|
proposedHtml: b,
|
|
1861
1866
|
onCancel: w,
|
|
1862
|
-
onApply:
|
|
1863
|
-
}) : /* @__PURE__ */
|
|
1867
|
+
onApply: ee
|
|
1868
|
+
}) : /* @__PURE__ */ M(qr, {
|
|
1864
1869
|
status: v,
|
|
1865
1870
|
reasoning: h,
|
|
1866
1871
|
errorMessage: _,
|
|
1867
1872
|
originalHtml: S,
|
|
1868
1873
|
proposedHtml: C,
|
|
1869
1874
|
preset: p?.preset ?? "quick",
|
|
1870
|
-
onPresetChange:
|
|
1875
|
+
onPresetChange: E,
|
|
1871
1876
|
onCancel: w,
|
|
1872
|
-
onApply:
|
|
1877
|
+
onApply: T
|
|
1873
1878
|
})] }) : f;
|
|
1874
|
-
},
|
|
1875
|
-
let { height: t = "auto", minHeight: n, onChange: r, toolbar: i, theme: a, maxLength: o, onMaxLengthExceed: s, upload: c, ai: l } = e, [u] =
|
|
1879
|
+
}, Qr = [], $r = (e) => {
|
|
1880
|
+
let { height: t = "auto", minHeight: n, onChange: r, toolbar: i, theme: a, maxLength: o, onMaxLengthExceed: s, upload: c, ai: l } = e, [u] = W(), { isSourceMode: d, isSourceModeRef: f } = de(), p = L(null), m = L(null), h = L(/* @__PURE__ */ new Map()), g = L(null), _ = L(null), v = L(s);
|
|
1876
1881
|
v.current = s;
|
|
1877
|
-
let b =
|
|
1878
|
-
|
|
1879
|
-
let
|
|
1880
|
-
|
|
1881
|
-
let
|
|
1882
|
-
|
|
1883
|
-
}, []),
|
|
1884
|
-
|
|
1885
|
-
}, []), re =
|
|
1886
|
-
|
|
1887
|
-
}, []), j = !!l?.typeset, ae = !!l?.polish, oe =
|
|
1882
|
+
let b = tr(o) ? o : void 0, [x, S] = R(0), [C, w] = R(null), ee = i?.mode === "floating", E = b !== void 0 && !d, D = L(l);
|
|
1883
|
+
D.current = l;
|
|
1884
|
+
let O = L(r);
|
|
1885
|
+
O.current = r;
|
|
1886
|
+
let k = P((e) => {
|
|
1887
|
+
D.current?.typeset?.(e);
|
|
1888
|
+
}, []), A = P((e) => {
|
|
1889
|
+
D.current?.polish?.(e);
|
|
1890
|
+
}, []), re = P(() => {
|
|
1891
|
+
D.current?.stop?.();
|
|
1892
|
+
}, []), j = !!l?.typeset, ae = !!l?.polish, oe = I(() => ({
|
|
1888
1893
|
containerRef: p,
|
|
1889
1894
|
toolbarRef: m,
|
|
1890
1895
|
upload: c,
|
|
@@ -1892,8 +1897,8 @@ var Yr = ({ maxLength: e, onMaxLengthExceed: t }) => {
|
|
|
1892
1897
|
setAiOpen: w,
|
|
1893
1898
|
aiSessionRef: g,
|
|
1894
1899
|
attachmentsBySrcRef: h,
|
|
1895
|
-
typeset:
|
|
1896
|
-
polish:
|
|
1900
|
+
typeset: k,
|
|
1901
|
+
polish: A,
|
|
1897
1902
|
stop: re,
|
|
1898
1903
|
canTypeset: j,
|
|
1899
1904
|
canPolish: ae
|
|
@@ -1901,11 +1906,11 @@ var Yr = ({ maxLength: e, onMaxLengthExceed: t }) => {
|
|
|
1901
1906
|
C,
|
|
1902
1907
|
ae,
|
|
1903
1908
|
j,
|
|
1904
|
-
ee,
|
|
1905
|
-
re,
|
|
1906
1909
|
A,
|
|
1910
|
+
re,
|
|
1911
|
+
k,
|
|
1907
1912
|
c
|
|
1908
|
-
]), se =
|
|
1913
|
+
]), se = I(() => ({
|
|
1909
1914
|
text: l?.text ?? "",
|
|
1910
1915
|
reasoning: l?.reasoning,
|
|
1911
1916
|
status: l?.status,
|
|
@@ -1915,12 +1920,12 @@ var Yr = ({ maxLength: e, onMaxLengthExceed: t }) => {
|
|
|
1915
1920
|
l?.reasoning,
|
|
1916
1921
|
l?.status,
|
|
1917
1922
|
l?.errorMessage
|
|
1918
|
-
]), ce =
|
|
1923
|
+
]), ce = P((e) => {
|
|
1919
1924
|
f.current || e.read(() => {
|
|
1920
|
-
let t =
|
|
1925
|
+
let t = V().getTextContent(), n = te(T(ze(u, null))), r = ie(n, t) ? null : n;
|
|
1921
1926
|
_.current = r, b !== void 0 && S(t.length);
|
|
1922
|
-
let i =
|
|
1923
|
-
|
|
1927
|
+
let i = et(rn).map((e) => h.current.get(e.getSrc())).filter((e) => e !== void 0);
|
|
1928
|
+
O.current({
|
|
1924
1929
|
text: t,
|
|
1925
1930
|
html: r,
|
|
1926
1931
|
attachment: i
|
|
@@ -1931,26 +1936,26 @@ var Yr = ({ maxLength: e, onMaxLengthExceed: t }) => {
|
|
|
1931
1936
|
b,
|
|
1932
1937
|
f
|
|
1933
1938
|
]);
|
|
1934
|
-
|
|
1939
|
+
F(() => {
|
|
1935
1940
|
b === void 0 || d || u.getEditorState().read(() => {
|
|
1936
|
-
S(
|
|
1941
|
+
S(V().getTextContentSize());
|
|
1937
1942
|
}, { editor: u });
|
|
1938
1943
|
}, [
|
|
1939
1944
|
u,
|
|
1940
1945
|
b,
|
|
1941
1946
|
d
|
|
1942
|
-
]),
|
|
1947
|
+
]), F(() => {
|
|
1943
1948
|
if (e.value === void 0 || e.value === _.current) return;
|
|
1944
1949
|
if (f.current) {
|
|
1945
|
-
let t = e.value?.trim() ?
|
|
1950
|
+
let t = e.value?.trim() ? T(e.value) : "";
|
|
1946
1951
|
_.current = e.value, u.update(() => {
|
|
1947
|
-
|
|
1952
|
+
mr(pr(t));
|
|
1948
1953
|
});
|
|
1949
1954
|
return;
|
|
1950
1955
|
}
|
|
1951
1956
|
let t = !1;
|
|
1952
1957
|
u.update(() => {
|
|
1953
|
-
ne(u, e.value?.trim() ?
|
|
1958
|
+
ne(u, e.value?.trim() ? T(e.value) : ""), b !== void 0 && (t = nr(u, b));
|
|
1954
1959
|
}), t && v.current?.();
|
|
1955
1960
|
}, [
|
|
1956
1961
|
e.value,
|
|
@@ -1958,109 +1963,111 @@ var Yr = ({ maxLength: e, onMaxLengthExceed: t }) => {
|
|
|
1958
1963
|
b,
|
|
1959
1964
|
f
|
|
1960
1965
|
]);
|
|
1961
|
-
let le = i?.config?.length ? i.config :
|
|
1966
|
+
let le = i?.config?.length ? i.config : Qr, fe = P(() => {
|
|
1962
1967
|
v.current?.();
|
|
1963
1968
|
}, []);
|
|
1964
|
-
return /* @__PURE__ */
|
|
1969
|
+
return /* @__PURE__ */ M(y.Provider, {
|
|
1965
1970
|
value: oe,
|
|
1966
|
-
children: /* @__PURE__ */
|
|
1971
|
+
children: /* @__PURE__ */ N(ue.Provider, {
|
|
1967
1972
|
value: se,
|
|
1968
|
-
children: [/* @__PURE__ */
|
|
1973
|
+
children: [/* @__PURE__ */ M(ei, {
|
|
1969
1974
|
containerRef: p,
|
|
1970
|
-
isFloating:
|
|
1975
|
+
isFloating: ee,
|
|
1971
1976
|
toolbarConfig: le,
|
|
1972
1977
|
toolbarTheme: a?.toolbar,
|
|
1978
|
+
containerTheme: a?.container,
|
|
1973
1979
|
toolbarStyle: i?.style,
|
|
1974
1980
|
toolbarSize: i?.size,
|
|
1975
1981
|
toolbarMode: i?.mode,
|
|
1976
1982
|
toolbarFloating: i?.floating,
|
|
1977
1983
|
height: t,
|
|
1978
1984
|
minHeight: n,
|
|
1979
|
-
showLengthBadge:
|
|
1985
|
+
showLengthBadge: E,
|
|
1980
1986
|
textLength: x,
|
|
1981
1987
|
validMaxLength: b,
|
|
1982
|
-
onMaxLengthExceed:
|
|
1988
|
+
onMaxLengthExceed: fe,
|
|
1983
1989
|
onChange: ce
|
|
1984
|
-
}), /* @__PURE__ */
|
|
1990
|
+
}), /* @__PURE__ */ M(Zr, {
|
|
1985
1991
|
maxLength: b,
|
|
1986
|
-
onMaxLengthExceed:
|
|
1992
|
+
onMaxLengthExceed: fe
|
|
1987
1993
|
})]
|
|
1988
1994
|
})
|
|
1989
1995
|
});
|
|
1990
|
-
},
|
|
1991
|
-
let [
|
|
1992
|
-
return /* @__PURE__ */
|
|
1996
|
+
}, ei = Se(function({ containerRef: e, isFloating: t, toolbarConfig: n, toolbarTheme: r, containerTheme: i, toolbarStyle: a, toolbarSize: o, toolbarMode: s, toolbarFloating: c, height: l, minHeight: u, showLengthBadge: d, textLength: f, validMaxLength: p, onMaxLengthExceed: m, onChange: h }) {
|
|
1997
|
+
let [g] = W(), _ = $t(), v = typeof l == "number" ? l : void 0, y = I(() => wn(i), [i]);
|
|
1998
|
+
return /* @__PURE__ */ N("div", {
|
|
1993
1999
|
ref: e,
|
|
1994
|
-
className:
|
|
2000
|
+
className: z("bsy-lexical-editor", X["bsy-lexical-editor"], t && X["bsy-lexical-editor--floating"]),
|
|
2001
|
+
style: y,
|
|
1995
2002
|
onClick: (e) => {
|
|
1996
|
-
let t =
|
|
1997
|
-
!t || !n || !t.contains(n) ||
|
|
2003
|
+
let t = g.getRootElement(), n = e.target;
|
|
2004
|
+
!t || !n || !t.contains(n) || g.isEditable() || g.setEditable(!0);
|
|
1998
2005
|
},
|
|
1999
2006
|
children: [
|
|
2000
|
-
n && n.length > 0 ? /* @__PURE__ */
|
|
2007
|
+
n && n.length > 0 ? /* @__PURE__ */ M(Sn, {
|
|
2001
2008
|
config: n,
|
|
2002
2009
|
theme: r,
|
|
2003
|
-
style:
|
|
2004
|
-
size:
|
|
2005
|
-
mode:
|
|
2006
|
-
floating:
|
|
2010
|
+
style: a,
|
|
2011
|
+
size: o,
|
|
2012
|
+
mode: s,
|
|
2013
|
+
floating: c
|
|
2007
2014
|
}) : null,
|
|
2008
|
-
/* @__PURE__ */
|
|
2009
|
-
className:
|
|
2010
|
-
style: { height:
|
|
2011
|
-
children: [/* @__PURE__ */
|
|
2012
|
-
className:
|
|
2013
|
-
children: /* @__PURE__ */
|
|
2014
|
-
contentEditable: /* @__PURE__ */
|
|
2015
|
-
className:
|
|
2015
|
+
/* @__PURE__ */ N("div", {
|
|
2016
|
+
className: z(X["bsy-lexical-editor__body"], v !== void 0 && X["bsy-lexical-editor__body--fixed"]),
|
|
2017
|
+
style: { height: v },
|
|
2018
|
+
children: [/* @__PURE__ */ M("div", {
|
|
2019
|
+
className: X["bsy-lexical-editor__editable-wrap"],
|
|
2020
|
+
children: /* @__PURE__ */ M(Pe, {
|
|
2021
|
+
contentEditable: /* @__PURE__ */ M(Fe, {
|
|
2022
|
+
className: X["bsy-lexical-editor__content-editable"],
|
|
2016
2023
|
style: {
|
|
2017
|
-
minHeight:
|
|
2018
|
-
cursor:
|
|
2024
|
+
minHeight: v === void 0 ? u : void 0,
|
|
2025
|
+
cursor: _ ? "auto" : "text"
|
|
2019
2026
|
}
|
|
2020
2027
|
}),
|
|
2021
|
-
ErrorBoundary:
|
|
2028
|
+
ErrorBoundary: Re
|
|
2022
2029
|
})
|
|
2023
|
-
}),
|
|
2024
|
-
current:
|
|
2025
|
-
maxLength:
|
|
2030
|
+
}), d && p !== void 0 ? /* @__PURE__ */ M(vr, {
|
|
2031
|
+
current: f,
|
|
2032
|
+
maxLength: p
|
|
2026
2033
|
}) : null]
|
|
2027
2034
|
}),
|
|
2028
|
-
/* @__PURE__ */
|
|
2029
|
-
/* @__PURE__ */
|
|
2030
|
-
/* @__PURE__ */
|
|
2031
|
-
/* @__PURE__ */
|
|
2032
|
-
/* @__PURE__ */
|
|
2033
|
-
/* @__PURE__ */
|
|
2034
|
-
/* @__PURE__ */
|
|
2035
|
-
/* @__PURE__ */
|
|
2036
|
-
/* @__PURE__ */
|
|
2037
|
-
/* @__PURE__ */
|
|
2038
|
-
|
|
2039
|
-
maxLength:
|
|
2040
|
-
onMaxLengthExceed:
|
|
2035
|
+
/* @__PURE__ */ M(en, {}),
|
|
2036
|
+
/* @__PURE__ */ M(tn, {}),
|
|
2037
|
+
/* @__PURE__ */ M(On, {}),
|
|
2038
|
+
/* @__PURE__ */ M(_r, {}),
|
|
2039
|
+
/* @__PURE__ */ M(kn, {}),
|
|
2040
|
+
/* @__PURE__ */ M(Mn, {}),
|
|
2041
|
+
/* @__PURE__ */ M(Nn, {}),
|
|
2042
|
+
/* @__PURE__ */ M(Xn, {}),
|
|
2043
|
+
/* @__PURE__ */ M(Zn, {}),
|
|
2044
|
+
/* @__PURE__ */ M($n, {}),
|
|
2045
|
+
d && p !== void 0 ? /* @__PURE__ */ M(er, {
|
|
2046
|
+
maxLength: p,
|
|
2047
|
+
onMaxLengthExceed: m
|
|
2041
2048
|
}) : null,
|
|
2042
|
-
/* @__PURE__ */
|
|
2043
|
-
/* @__PURE__ */
|
|
2044
|
-
onChange:
|
|
2049
|
+
/* @__PURE__ */ M(Ie, {}),
|
|
2050
|
+
/* @__PURE__ */ M(Le, {
|
|
2051
|
+
onChange: h,
|
|
2045
2052
|
ignoreSelectionChange: !0
|
|
2046
2053
|
})
|
|
2047
2054
|
]
|
|
2048
2055
|
});
|
|
2049
|
-
}),
|
|
2056
|
+
}), ti = (e) => /* @__PURE__ */ M(hr, {
|
|
2050
2057
|
maxLength: e.maxLength,
|
|
2051
2058
|
onMaxLengthExceed: e.onMaxLengthExceed,
|
|
2052
|
-
children: /* @__PURE__ */
|
|
2059
|
+
children: /* @__PURE__ */ M($r, { ...e })
|
|
2053
2060
|
});
|
|
2054
|
-
|
|
2061
|
+
ti.displayName = "BsyLexicalEditorCore";
|
|
2055
2062
|
//#endregion
|
|
2056
2063
|
//#region src/components/Editor/htmlConfig.ts
|
|
2057
|
-
var
|
|
2064
|
+
var ni = "1px solid #d9d9d9", ri = { export: new Map([[Wt, (e, t) => {
|
|
2058
2065
|
let n = t.exportDOM(e);
|
|
2059
|
-
return
|
|
2060
|
-
}]]) },
|
|
2066
|
+
return vt(n.element) && (n.element.style.border = ni), n;
|
|
2067
|
+
}]]) }, ii = (e) => {
|
|
2061
2068
|
let { autoFocus: t = !1 } = e;
|
|
2062
|
-
return /* @__PURE__ */
|
|
2063
|
-
initialConfig:
|
|
2069
|
+
return /* @__PURE__ */ M(Ne, {
|
|
2070
|
+
initialConfig: I(() => ({
|
|
2064
2071
|
namespace: "bsyLexicalEditor",
|
|
2065
2072
|
onError: (e) => {
|
|
2066
2073
|
console.error("Lexical error", e);
|
|
@@ -2096,30 +2103,30 @@ var ei = "1px solid #d9d9d9", ti = { export: new Map([[Ut, (e, t) => {
|
|
|
2096
2103
|
tableRow: "editor-table-row",
|
|
2097
2104
|
tableScrollableWrapper: "editor-table-scrollable-wrapper"
|
|
2098
2105
|
},
|
|
2099
|
-
html:
|
|
2106
|
+
html: ri,
|
|
2100
2107
|
nodes: [
|
|
2108
|
+
Ot,
|
|
2101
2109
|
Dt,
|
|
2102
|
-
|
|
2110
|
+
jt,
|
|
2103
2111
|
At,
|
|
2104
|
-
|
|
2105
|
-
|
|
2112
|
+
Qt,
|
|
2113
|
+
Lt,
|
|
2106
2114
|
It,
|
|
2107
|
-
Ft,
|
|
2108
|
-
Wt,
|
|
2109
2115
|
Gt,
|
|
2110
|
-
|
|
2111
|
-
|
|
2112
|
-
|
|
2116
|
+
Kt,
|
|
2117
|
+
Wt,
|
|
2118
|
+
rn,
|
|
2119
|
+
Z,
|
|
2113
2120
|
{
|
|
2114
|
-
replace:
|
|
2115
|
-
with: (e) => new
|
|
2116
|
-
withKlass:
|
|
2121
|
+
replace: _t,
|
|
2122
|
+
with: (e) => new Z(e.__text),
|
|
2123
|
+
withKlass: Z
|
|
2117
2124
|
}
|
|
2118
2125
|
]
|
|
2119
2126
|
}), [t]),
|
|
2120
|
-
children: /* @__PURE__ */
|
|
2127
|
+
children: /* @__PURE__ */ M(ti, { ...e })
|
|
2121
2128
|
});
|
|
2122
2129
|
};
|
|
2123
|
-
|
|
2130
|
+
ii.displayName = "BsyLexicalEditor";
|
|
2124
2131
|
//#endregion
|
|
2125
|
-
export {
|
|
2132
|
+
export { qe as $getRoot, u as BaseButton, ii as default, ae as listRegisteredToolbarButtons, O as registerToolbarButton, S as unregisterToolbarButton, bt as useLexicalComposerContext };
|