@baishuyun/ui-base 6.10.1 → 6.11.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 +4 -4
- package/dist/Amap/{AmapProvider-DqFp3DZ5.js → AmapProvider-CvRHhN42.js} +1 -1
- package/dist/Amap/hooks/index.js +1 -1
- package/dist/Amap/index.js +4 -4
- package/dist/Calendar/{Calendar-gEtuBW7Y.js → Calendar-BS0nzK4h.js} +2 -2
- package/dist/Calendar/context/index.js +1 -1
- package/dist/Calendar/index.js +5 -5
- 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/{ColorPicker-CYlrnMwM.js → ColorPicker-DVwg07Gs.js} +1 -1
- package/dist/ColorPicker/index.js +4 -4
- package/dist/ConfigProvider/index.js +3 -3
- package/dist/DatePicker/{DatePicker-CagGt_f0.js → DatePicker-DNPnHLT2.js} +2 -2
- package/dist/DatePicker/{DatePickerPanel-CaDZzxMD.js → DatePickerPanel-TS6AxAH-.js} +3 -3
- package/dist/DatePicker/index.js +4 -4
- package/dist/DatePicker/style/index.js +1 -1
- package/dist/DropDown/{DropDown-CLuQf970.js → DropDown-DWf5yf4l.js} +2 -2
- package/dist/DropDown/index.js +5 -5
- package/dist/DropDown/style/index.js +1 -1
- package/dist/Editor/Buttons-BBioCubp.js +1148 -0
- package/dist/Editor/ToolbarPlugin/Buttons/index.js +7 -7
- package/dist/Editor/constants/index.js +3 -3
- package/dist/Editor/index.js +774 -371
- package/dist/Gantt/GanttChart/index.js +7 -7
- package/dist/Gantt/{GanttChart-DvCAp8Dk.js → GanttChart-BaEW7EDO.js} +2 -2
- package/dist/Gantt/GanttTable/index.js +5 -5
- package/dist/Gantt/{GanttTable-DyVJOVo3.js → GanttTable-CdXhMHF6.js} +1 -1
- package/dist/Gantt/GanttToolBar/index.js +6 -6
- package/dist/Gantt/{GanttToolBar-CxT68kmT.js → GanttToolBar-COwsYlMG.js} +2 -2
- package/dist/Gantt/index.js +9 -9
- 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/{InputTag-yRPO90Ku.js → InputTag-Jpm8H32L.js} +1 -1
- package/dist/InputTag/index.js +4 -4
- package/dist/Loading/{Loading-BF_dtuLc.js → Loading-CiRe7i2R.js} +1 -1
- package/dist/Loading/index.js +4 -4
- 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/{Select-iwzfNy9d.js → Select-BY5Rpo3f.js} +2 -2
- package/dist/Select/{SelectInputSearch-Bc_aPNbG.js → SelectInputSearch-i3egm8Wy.js} +1 -1
- package/dist/Select/index.js +5 -5
- package/dist/Table/{Table-Cm8zFl2G.js → Table-CSPdFGYn.js} +1 -1
- package/dist/Table/hooks/index.js +1 -1
- package/dist/Table/index.js +4 -4
- package/dist/Table/style/index.js +1 -1
- package/dist/Table/utils/index.js +1 -1
- package/dist/Tabs/{Tabs-BPWRIwtD.js → Tabs-C0m3mt-j.js} +1 -1
- package/dist/Tabs/index.js +4 -4
- 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/ToolbarPlugin/Buttons/HeadingButton.d.ts +2 -0
- package/dist/components/Editor/ToolbarPlugin/Buttons/SourceButton.d.ts +2 -0
- package/dist/components/Editor/ToolbarPlugin/Buttons/TableButton.d.ts +2 -0
- package/dist/components/Editor/ToolbarPlugin/Buttons/index.d.ts +3 -0
- package/dist/components/Editor/ToolbarPlugin/context/TextFormatsContext.d.ts +2 -0
- package/dist/components/Editor/constants/index.d.ts +1 -0
- package/dist/components/Editor/context/EditorContainerContext.d.ts +0 -1
- package/dist/components/Editor/context/SourceModeContext.d.ts +9 -0
- package/dist/components/Editor/htmlConfig.d.ts +2 -0
- package/dist/components/Editor/interface.d.ts +1 -1
- package/dist/components/Editor/plugins/HeadingPlugin.d.ts +3 -0
- package/dist/components/Editor/plugins/LinkColorPlugin.d.ts +2 -0
- package/dist/components/Editor/plugins/SourceModePlugin.d.ts +7 -0
- package/dist/components/Editor/plugins/TabIndentPlugin.d.ts +1 -0
- package/dist/components/Editor/plugins/TablePlugin.d.ts +1 -0
- package/dist/components/Editor/utils/fillRootFromHtml.d.ts +2 -0
- package/dist/components/Editor/utils/formatEditorHtml.d.ts +1 -0
- package/dist/components/Editor/utils/isEmptyEditorHtml.d.ts +1 -0
- package/dist/components/Editor/utils/sanitizeEditorHtml.d.ts +1 -0
- package/dist/components/Editor/utils/stripInlineStyleProperty.d.ts +2 -0
- package/dist/components/Editor/utils/writeHtmlSource.d.ts +1 -0
- package/dist/index.js +15 -15
- package/dist/locale/lang/en-US.json.d.ts +7 -0
- package/dist/locale/lang/zh-CN.json.d.ts +7 -0
- package/dist/locale/lang/zh-TW.json.d.ts +7 -0
- package/dist/style.css +1 -1
- package/dist/vendors/{ConfigProvider-vPuwReNX.js → ConfigProvider-4xHyyeop.js} +15 -1
- package/dist/vendors/{LocaleContext-CN9doEXT.js → LocaleContext-I4PW9j4M.js} +7 -0
- package/dist/vendors/{useLocale-sawv8CEL.js → useLocale-FGYsRWSe.js} +1 -1
- package/dist/vendors/{version-DdQLttdL.js → version-BxI5QM5W.js} +1 -1
- package/package.json +4 -1
- package/dist/Editor/Buttons-ByO5rS19.js +0 -937
package/dist/Editor/index.js
CHANGED
|
@@ -1,61 +1,64 @@
|
|
|
1
|
-
import "../vendors/version-
|
|
1
|
+
import "../vendors/version-BxI5QM5W.js";
|
|
2
2
|
import "../ScrollBar/style-D26azwz6.js";
|
|
3
3
|
import { t as e } from "../Icon/Icon-BBDcb-yw.js";
|
|
4
|
-
import "../vendors/LocaleContext-
|
|
4
|
+
import "../vendors/LocaleContext-I4PW9j4M.js";
|
|
5
5
|
import "../Overlay/OverlayContext-CVSFoyqN.js";
|
|
6
6
|
import "../Modal/Modal-Cb7Msq26.js";
|
|
7
|
-
import "../ColorPicker/ColorPicker-
|
|
7
|
+
import "../ColorPicker/ColorPicker-DVwg07Gs.js";
|
|
8
8
|
import "../vendors/useFloatingOverlay-B3M9k8nj.js";
|
|
9
|
-
import { t } from "../vendors/useLocale-
|
|
9
|
+
import { t } from "../vendors/useLocale-FGYsRWSe.js";
|
|
10
10
|
import "../vendors/useLatchedPopupPortalRoot-4fVhqVT4.js";
|
|
11
11
|
import { t as n } from "../vendors/cssVars-l4-kP_14.js";
|
|
12
|
-
import "../Select/SelectInputSearch-
|
|
12
|
+
import "../Select/SelectInputSearch-i3egm8Wy.js";
|
|
13
13
|
import "../CheckBox/CheckBox-ByWSy9Yr.js";
|
|
14
14
|
import "../CheckBox/CheckBox-nBm0u6zX.js";
|
|
15
15
|
import "../NotFoundContent/NotFoundContent-BLmzWNBi.js";
|
|
16
16
|
import "../ScrollBar/ScrollBar-N2pOLv-8.js";
|
|
17
17
|
import "../vendors/useFloatingPortal-CmVJbuRm.js";
|
|
18
|
-
import { t as r } from "../DropDown/DropDown-
|
|
18
|
+
import { t as r } from "../DropDown/DropDown-DWf5yf4l.js";
|
|
19
19
|
import "../DropDown/style-LLDVPpPa.js";
|
|
20
|
-
import { _ as i, a,
|
|
21
|
-
import { DEFAULT_BACKGROUND_COLOR as
|
|
22
|
-
import { omit as
|
|
23
|
-
import { Fragment as
|
|
24
|
-
import
|
|
25
|
-
import
|
|
26
|
-
import { AnimatePresence as
|
|
27
|
-
import { LexicalComposer as
|
|
28
|
-
import { RichTextPlugin as
|
|
29
|
-
import { ContentEditable as
|
|
30
|
-
import { HistoryPlugin as
|
|
31
|
-
import { OnChangePlugin as
|
|
32
|
-
import { LexicalErrorBoundary as
|
|
33
|
-
import { $generateHtmlFromNodes as
|
|
34
|
-
import { $applyNodeReplacement as
|
|
35
|
-
import { useLexicalComposerContext as
|
|
36
|
-
import { $getSelectionStyleValueForProperty as
|
|
37
|
-
import { $findMatchingParent as
|
|
38
|
-
import { $isLinkNode as
|
|
39
|
-
import { $isListItemNode as
|
|
40
|
-
import { $createCodeHighlightNode as
|
|
41
|
-
import {
|
|
42
|
-
import {
|
|
43
|
-
import {
|
|
20
|
+
import { _ as i, a, b as o, c as s, d as c, f as l, g as u, h as d, i as f, l as p, m, n as h, o as g, p as _, r as v, s as y, u as b, v as x, y as ee } from "./Buttons-BBioCubp.js";
|
|
21
|
+
import { DEFAULT_BACKGROUND_COLOR as te, DEFAULT_FONT_COLOR as ne, DEFAULT_FONT_SIZE as re } from "./constants/index.js";
|
|
22
|
+
import { omit as ie } from "lodash-es";
|
|
23
|
+
import { Fragment as ae, jsx as S, jsxs as C } from "react/jsx-runtime";
|
|
24
|
+
import oe, { createContext as se, useCallback as w, useContext as ce, useEffect as T, useMemo as E, useRef as D, useState as O } from "react";
|
|
25
|
+
import k from "clsx";
|
|
26
|
+
import { AnimatePresence as le, motion as ue, useReducedMotion as de } from "motion/react";
|
|
27
|
+
import { LexicalComposer as fe } from "@lexical/react/LexicalComposer";
|
|
28
|
+
import { RichTextPlugin as pe } from "@lexical/react/LexicalRichTextPlugin";
|
|
29
|
+
import { ContentEditable as me } from "@lexical/react/LexicalContentEditable";
|
|
30
|
+
import { HistoryPlugin as he } from "@lexical/react/LexicalHistoryPlugin";
|
|
31
|
+
import { OnChangePlugin as ge } from "@lexical/react/LexicalOnChangePlugin";
|
|
32
|
+
import { LexicalErrorBoundary as _e } from "@lexical/react/LexicalErrorBoundary";
|
|
33
|
+
import { $generateHtmlFromNodes as ve, $generateNodesFromDOM as ye } from "@lexical/html";
|
|
34
|
+
import { $applyNodeReplacement as be, $createLineBreakNode as xe, $createParagraphNode as Se, $createTabNode as Ce, $createTextNode as we, $getNearestNodeFromDOMNode as Te, $getNodeByKey as A, $getRoot as Ee, $getRoot as j, $getSelection as M, $insertNodes as N, $isElementNode as De, $isLineBreakNode as P, $isRangeSelection as F, $isRootOrShadowRoot as Oe, $isTabNode as ke, $isTextNode as Ae, $onUpdate as je, CLEAR_HISTORY_COMMAND as Me, COMMAND_PRIORITY_CRITICAL as Ne, COMMAND_PRIORITY_EDITOR as Pe, COMMAND_PRIORITY_HIGH as I, COMMAND_PRIORITY_LOW as Fe, DROP_COMMAND as Ie, DecoratorNode as Le, HISTORY_MERGE_TAG as Re, INDENT_CONTENT_COMMAND as ze, KEY_ENTER_COMMAND as Be, KEY_TAB_COMMAND as Ve, PASTE_COMMAND as He, PASTE_TAG as Ue, RootNode as We, TextNode as L, isHTMLElement as Ge, mergeRegister as Ke } from "lexical";
|
|
35
|
+
import { useLexicalComposerContext as qe, useLexicalComposerContext as R } from "@lexical/react/LexicalComposerContext";
|
|
36
|
+
import { $getSelectionStyleValueForProperty as z, $patchStyleText as Je, $trimTextContentFromAnchor as B } from "@lexical/selection";
|
|
37
|
+
import { $findMatchingParent as V, $restoreEditorState as Ye, mergeRegister as Xe } from "@lexical/utils";
|
|
38
|
+
import { $isLinkNode as Ze, AutoLinkNode as Qe, LinkNode as $e } from "@lexical/link";
|
|
39
|
+
import { $isListItemNode as H, $isListNode as et, ListItemNode as tt, ListNode as nt } from "@lexical/list";
|
|
40
|
+
import { $createCodeHighlightNode as rt, $createCodeNode as it, $isCodeHighlightNode as at, $isCodeNode as U, $plainifyCodeContent as ot, CodeHighlightNode as W, CodeNode as G, registerCodeIndentation as st } from "@lexical/code-core";
|
|
41
|
+
import { $findCellNode as ct, $isTableCellNode as K, $isTableNode as lt, $isTableRowNode as ut, $isTableSelection as dt, TableCellNode as q, TableNode as ft, TableRowNode as pt, registerTableCellUnmergeTransform as mt, registerTablePlugin as ht, registerTableSelectionObserver as gt, setScrollableTablesActive as _t } from "@lexical/table";
|
|
42
|
+
import { $isHeadingNode as vt, HeadingNode as yt } from "@lexical/rich-text";
|
|
43
|
+
import { useLexicalEditable as bt } from "@lexical/react/useLexicalEditable";
|
|
44
|
+
import { LinkPlugin as xt } from "@lexical/react/LexicalLinkPlugin";
|
|
45
|
+
import { ListPlugin as St } from "@lexical/react/LexicalListPlugin";
|
|
46
|
+
import Ct from "dompurify";
|
|
44
47
|
//#region src/components/Editor/utils/resolveEditorToolbarThemeVars.ts
|
|
45
|
-
var
|
|
48
|
+
var J = (e) => {
|
|
46
49
|
if (!(e === void 0 || e === "")) return typeof e == "number" ? `${e}px` : e;
|
|
47
|
-
},
|
|
50
|
+
}, wt = (e) => {
|
|
48
51
|
if (!e) return {};
|
|
49
52
|
let t = {};
|
|
50
|
-
return n(t, "--bsy-editor-toolbar-bg", e.bg), n(t, "--bsy-editor-toolbar-border-color", e.borderColor), n(t, "--bsy-editor-toolbar-padding", e.padding), n(t, "--bsy-editor-toolbar-gap",
|
|
51
|
-
},
|
|
53
|
+
return n(t, "--bsy-editor-toolbar-bg", e.bg), n(t, "--bsy-editor-toolbar-border-color", e.borderColor), n(t, "--bsy-editor-toolbar-padding", e.padding), n(t, "--bsy-editor-toolbar-gap", J(e.gap)), n(t, "--bsy-editor-toolbar-group-gap", J(e.groupGap)), n(t, "--bsy-editor-toolbar-divider-color", e.dividerColor), n(t, "--bsy-editor-toolbar-divider-size", J(e.dividerSize)), n(t, "--bsy-editor-toolbar-divider-margin", J(e.dividerMargin)), n(t, "--bsy-editor-toolbar-color-icon", e.colorIcon), n(t, "--bsy-editor-toolbar-item-hover-bg", e.itemHoverBg), n(t, "--bsy-editor-toolbar-item-hover-color", e.itemHoverColor), n(t, "--bsy-editor-toolbar-item-active-bg", e.itemActiveBg), n(t, "--bsy-editor-toolbar-item-active-color", e.itemActiveColor), n(t, "--bsy-editor-toolbar-item-padding", J(e.itemPadding)), n(t, "--bsy-editor-toolbar-item-border-radius", J(e.itemBorderRadius)), n(t, "--bsy-editor-toolbar-icon-size", J(e.iconSize)), t;
|
|
54
|
+
}, Tt = (e) => {
|
|
52
55
|
if (typeof e == "number" && Number.isFinite(e)) return e;
|
|
53
56
|
if (typeof e == "string") {
|
|
54
57
|
let t = Number.parseFloat(e);
|
|
55
58
|
if (Number.isFinite(t)) return t;
|
|
56
59
|
}
|
|
57
60
|
return 14;
|
|
58
|
-
},
|
|
61
|
+
}, Et = (e) => {
|
|
59
62
|
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 = {
|
|
60
63
|
position: "absolute",
|
|
61
64
|
[a ? "bottom" : "top"]: "100%",
|
|
@@ -65,57 +68,59 @@ var W = (e) => {
|
|
|
65
68
|
width: "100%"
|
|
66
69
|
};
|
|
67
70
|
return r && (o.transform = `translateX(${r}px)`), o;
|
|
68
|
-
}, G = {
|
|
69
|
-
"bsy-lexical__toolbar": "_bsy-lexical__toolbar_se2wg_1",
|
|
70
|
-
"bsy-lexical__toolbar--floating": "_bsy-lexical__toolbar--floating_se2wg_12",
|
|
71
|
-
"bsy-lexical__toolbar-item": "_bsy-lexical__toolbar-item_se2wg_18",
|
|
72
|
-
"bsy-lexical__toolbar-group": "_bsy-lexical__toolbar-group_se2wg_24",
|
|
73
|
-
"bsy-lexical__toolbar-divider": "_bsy-lexical__toolbar-divider_se2wg_30",
|
|
74
|
-
"bsy-lexical__code-language": "_bsy-lexical__code-language_se2wg_37",
|
|
75
|
-
"bsy-lexical__code-language-label": "_bsy-lexical__code-language-label_se2wg_54",
|
|
76
|
-
"bsy-lexical__code-language-arrow": "_bsy-lexical__code-language-arrow_se2wg_65"
|
|
77
71
|
};
|
|
78
72
|
//#endregion
|
|
79
73
|
//#region src/components/Editor/hooks/useTextFormatsState.ts
|
|
80
|
-
function
|
|
81
|
-
let [e] =
|
|
74
|
+
function Dt() {
|
|
75
|
+
let [e] = R(), [t, n] = O({
|
|
82
76
|
bold: !1,
|
|
83
77
|
italic: !1,
|
|
84
78
|
underline: !1,
|
|
85
79
|
strikethrough: !1,
|
|
86
80
|
superscript: !1,
|
|
87
81
|
subscript: !1,
|
|
88
|
-
fontSize:
|
|
89
|
-
fontColor:
|
|
90
|
-
backgroundColor:
|
|
82
|
+
fontSize: re,
|
|
83
|
+
fontColor: ne,
|
|
84
|
+
backgroundColor: te,
|
|
91
85
|
align: "left",
|
|
92
86
|
listType: !1,
|
|
93
87
|
canOutdent: !1,
|
|
94
88
|
isCodeBlock: !1,
|
|
89
|
+
isInTable: !1,
|
|
90
|
+
headingTag: !1,
|
|
95
91
|
codeLanguage: i,
|
|
96
92
|
link: void 0
|
|
97
93
|
});
|
|
98
|
-
return
|
|
94
|
+
return T(() => e.registerUpdateListener(({ editorState: e }) => {
|
|
99
95
|
e.read(() => {
|
|
100
|
-
let e =
|
|
101
|
-
if (
|
|
102
|
-
|
|
96
|
+
let e = M();
|
|
97
|
+
if (dt(e)) {
|
|
98
|
+
n((e) => ({
|
|
99
|
+
...e,
|
|
100
|
+
isCodeBlock: !1,
|
|
101
|
+
isInTable: !0,
|
|
102
|
+
headingTag: !1
|
|
103
|
+
}));
|
|
104
|
+
return;
|
|
105
|
+
}
|
|
106
|
+
if (F(e)) {
|
|
107
|
+
let t = z(e, "font-size", re), r = z(e, "color", ne), i = z(e, "background-color", te), a = e.anchor.getNode(), o = a.getKey() === "root" ? a : V(a, (e) => {
|
|
103
108
|
let t = e.getParent();
|
|
104
|
-
return t !== null &&
|
|
109
|
+
return t !== null && Oe(t);
|
|
105
110
|
});
|
|
106
111
|
o === null && (o = a.getTopLevelElementOrThrow());
|
|
107
|
-
let s = {}, c =
|
|
112
|
+
let s = {}, c = V(a, Ze);
|
|
108
113
|
c ? (s.link = c.getURL(), s.linkText = c.getTextContent(), s.newBlank = c.getTarget() === "_blank") : s.linkText = e.getTextContent();
|
|
109
|
-
let l =
|
|
110
|
-
if (
|
|
114
|
+
let l = V(a, H), u = !1, d = De(o) ? o.getIndent() : 0;
|
|
115
|
+
if (H(l)) {
|
|
111
116
|
d = l.getIndent();
|
|
112
117
|
let e = l.getParent();
|
|
113
|
-
if (
|
|
118
|
+
if (et(e)) {
|
|
114
119
|
let t = e.getListType();
|
|
115
120
|
u = t === "number" || t === "bullet" ? t : !1;
|
|
116
121
|
}
|
|
117
122
|
}
|
|
118
|
-
let f =
|
|
123
|
+
let f = V(a, U), p = V(a, vt), m = vt(p) ? p.getTag() : void 0;
|
|
119
124
|
n({
|
|
120
125
|
bold: e.hasFormat("bold"),
|
|
121
126
|
italic: e.hasFormat("italic"),
|
|
@@ -126,11 +131,13 @@ function at() {
|
|
|
126
131
|
fontSize: t,
|
|
127
132
|
fontColor: r,
|
|
128
133
|
backgroundColor: i,
|
|
129
|
-
align:
|
|
134
|
+
align: De(o) ? o.getFormatType() : "left",
|
|
130
135
|
listType: u,
|
|
131
136
|
canOutdent: d > 0 || u !== !1,
|
|
132
137
|
isCodeBlock: !!f,
|
|
133
|
-
|
|
138
|
+
isInTable: !!V(a, K),
|
|
139
|
+
headingTag: m === "h1" || m === "h2" || m === "h3" ? m : !1,
|
|
140
|
+
codeLanguage: x(f?.getLanguage()),
|
|
134
141
|
link: s
|
|
135
142
|
});
|
|
136
143
|
}
|
|
@@ -139,49 +146,53 @@ function at() {
|
|
|
139
146
|
}
|
|
140
147
|
//#endregion
|
|
141
148
|
//#region src/components/Editor/ToolbarPlugin/context/TextFormatProvider.tsx
|
|
142
|
-
var
|
|
143
|
-
let t =
|
|
144
|
-
return /* @__PURE__ */
|
|
149
|
+
var Ot = (e) => {
|
|
150
|
+
let t = Dt();
|
|
151
|
+
return /* @__PURE__ */ S(ee.Provider, {
|
|
145
152
|
value: t,
|
|
146
153
|
children: e.children
|
|
147
154
|
});
|
|
148
|
-
},
|
|
155
|
+
}, kt = se(null), At = () => {
|
|
156
|
+
let e = ce(kt);
|
|
157
|
+
if (!e) throw Error("useEditorContainer must be used within EditorContainerProvider");
|
|
158
|
+
return e;
|
|
159
|
+
}, jt = d.map((e) => ({
|
|
149
160
|
key: e.id,
|
|
150
161
|
label: e.label
|
|
151
|
-
})),
|
|
152
|
-
let [n] =
|
|
162
|
+
})), Mt = () => {
|
|
163
|
+
let [n] = R(), { codeLanguage: i } = p(), { t: a } = t(), { iconSize: s } = l(), c = w((e) => {
|
|
153
164
|
let t = e.key;
|
|
154
165
|
n.update(() => {
|
|
155
|
-
let e =
|
|
156
|
-
|
|
166
|
+
let e = M();
|
|
167
|
+
F(e) && V(e.anchor.getNode(), U)?.setLanguage(t);
|
|
157
168
|
});
|
|
158
|
-
}, [n]),
|
|
159
|
-
return /* @__PURE__ */
|
|
160
|
-
menus:
|
|
161
|
-
onClick:
|
|
169
|
+
}, [n]), d = u[i].label;
|
|
170
|
+
return /* @__PURE__ */ S(r, {
|
|
171
|
+
menus: jt,
|
|
172
|
+
onClick: c,
|
|
162
173
|
activeKey: [i],
|
|
163
174
|
showSearch: !1,
|
|
164
|
-
getPopupContainer: s,
|
|
165
175
|
style: {
|
|
166
176
|
width: 120,
|
|
167
177
|
minWidth: 120
|
|
168
178
|
},
|
|
169
|
-
children: /* @__PURE__ */
|
|
170
|
-
className:
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
179
|
+
children: /* @__PURE__ */ S("div", {
|
|
180
|
+
className: o["bsy-lexical__toolbar-select"],
|
|
181
|
+
style: { width: 120 },
|
|
182
|
+
children: /* @__PURE__ */ S(b, {
|
|
183
|
+
icon: /* @__PURE__ */ C(ae, { children: [/* @__PURE__ */ S("span", {
|
|
184
|
+
className: o["bsy-lexical__toolbar-select-label"],
|
|
185
|
+
children: d
|
|
186
|
+
}), /* @__PURE__ */ S(e, {
|
|
176
187
|
name: "arrow-down",
|
|
177
|
-
size:
|
|
178
|
-
className:
|
|
188
|
+
size: s,
|
|
189
|
+
className: o["bsy-lexical__toolbar-select-arrow"]
|
|
179
190
|
})] }),
|
|
180
191
|
tooltip: a("editor.codeLanguage")
|
|
181
192
|
})
|
|
182
193
|
})
|
|
183
194
|
});
|
|
184
|
-
},
|
|
195
|
+
}, Nt = {
|
|
185
196
|
initial: {
|
|
186
197
|
opacity: 0,
|
|
187
198
|
x: 6
|
|
@@ -194,7 +205,24 @@ var ot = (e) => {
|
|
|
194
205
|
opacity: 0,
|
|
195
206
|
x: -6
|
|
196
207
|
}
|
|
197
|
-
},
|
|
208
|
+
}, Pt = (e) => typeof e == "string" ? e : e.name, Ft = (e, t, n) => {
|
|
209
|
+
if (n) return [
|
|
210
|
+
{
|
|
211
|
+
kind: "button",
|
|
212
|
+
key: "undo",
|
|
213
|
+
name: "undo"
|
|
214
|
+
},
|
|
215
|
+
{
|
|
216
|
+
kind: "button",
|
|
217
|
+
key: "redo",
|
|
218
|
+
name: "redo"
|
|
219
|
+
},
|
|
220
|
+
{
|
|
221
|
+
kind: "button",
|
|
222
|
+
key: "source-mode",
|
|
223
|
+
name: "source"
|
|
224
|
+
}
|
|
225
|
+
];
|
|
198
226
|
if (t) return [
|
|
199
227
|
{
|
|
200
228
|
kind: "button",
|
|
@@ -220,48 +248,48 @@ var ot = (e) => {
|
|
|
220
248
|
key: "code-language"
|
|
221
249
|
}
|
|
222
250
|
];
|
|
223
|
-
let
|
|
224
|
-
return e.forEach((t,
|
|
251
|
+
let r = [];
|
|
252
|
+
return e.forEach((t, n) => {
|
|
225
253
|
t.buttons.forEach((e) => {
|
|
226
|
-
let t =
|
|
227
|
-
|
|
254
|
+
let t = Pt(e);
|
|
255
|
+
r.push({
|
|
228
256
|
kind: "button",
|
|
229
257
|
key: t,
|
|
230
258
|
name: t,
|
|
231
259
|
props: typeof e == "string" ? void 0 : e.props
|
|
232
260
|
});
|
|
233
|
-
}),
|
|
261
|
+
}), n < e.length - 1 && r.push({
|
|
234
262
|
kind: "divider",
|
|
235
263
|
key: `divider-${t.key}`
|
|
236
264
|
});
|
|
237
|
-
}),
|
|
238
|
-
},
|
|
239
|
-
let n =
|
|
240
|
-
return n ? /* @__PURE__ */
|
|
241
|
-
},
|
|
242
|
-
let { isCodeBlock: t } =
|
|
243
|
-
duration:
|
|
265
|
+
}), r;
|
|
266
|
+
}, It = (e, t) => {
|
|
267
|
+
let n = h(e);
|
|
268
|
+
return n ? /* @__PURE__ */ S(n, { ...t }) : (console.warn(`[ToolbarPlugin] Button "${e}" is not registered.`), null);
|
|
269
|
+
}, Lt = ({ config: e }) => {
|
|
270
|
+
let { isCodeBlock: t } = p(), { isSourceMode: n } = y(), r = de(), i = Ft(e, t, n), a = {
|
|
271
|
+
duration: r ? 0 : .16,
|
|
244
272
|
ease: "easeOut"
|
|
245
|
-
},
|
|
246
|
-
return /* @__PURE__ */
|
|
273
|
+
}, s = r ? {} : Nt;
|
|
274
|
+
return /* @__PURE__ */ S(le, {
|
|
247
275
|
initial: !1,
|
|
248
276
|
mode: "popLayout",
|
|
249
|
-
children:
|
|
277
|
+
children: i.map((e) => {
|
|
250
278
|
let t = null;
|
|
251
|
-
return t = e.kind === "divider" ? /* @__PURE__ */
|
|
252
|
-
className:
|
|
279
|
+
return t = e.kind === "divider" ? /* @__PURE__ */ S("div", { className: o["bsy-lexical__toolbar-divider"] }) : e.kind === "language" ? /* @__PURE__ */ S(Mt, {}) : It(e.name, e.props), t === null ? null : /* @__PURE__ */ S(ue.div, {
|
|
280
|
+
className: o["bsy-lexical__toolbar-item"],
|
|
253
281
|
layout: "position",
|
|
254
|
-
transition:
|
|
255
|
-
...
|
|
282
|
+
transition: a,
|
|
283
|
+
...s,
|
|
256
284
|
children: t
|
|
257
285
|
}, e.key);
|
|
258
286
|
})
|
|
259
287
|
});
|
|
260
|
-
},
|
|
261
|
-
let { config: t = [], style: n, theme: r, mode: i, floating: a } = e, { toolbarRef:
|
|
288
|
+
}, Rt = (e) => {
|
|
289
|
+
let { config: t = [], style: n, theme: r, mode: i, floating: a } = e, { toolbarRef: s } = At(), l = i === "floating", u = de(), d = {
|
|
262
290
|
duration: u ? 0 : .16,
|
|
263
291
|
ease: "easeOut"
|
|
264
|
-
}, f =
|
|
292
|
+
}, f = E(() => wt(r), [r]), p = E(() => ({ iconSize: Tt(r?.iconSize) }), [r?.iconSize]), m = l ? Et(a) : void 0, h = l ? ie(n, [
|
|
265
293
|
"position",
|
|
266
294
|
"left",
|
|
267
295
|
"top",
|
|
@@ -272,29 +300,29 @@ var ot = (e) => {
|
|
|
272
300
|
"marginTop",
|
|
273
301
|
"marginBottom"
|
|
274
302
|
]) : n;
|
|
275
|
-
return /* @__PURE__ */
|
|
303
|
+
return /* @__PURE__ */ S(c, {
|
|
276
304
|
value: p,
|
|
277
|
-
children: /* @__PURE__ */
|
|
278
|
-
ref:
|
|
305
|
+
children: /* @__PURE__ */ S(_, { children: /* @__PURE__ */ S(Ot, { children: /* @__PURE__ */ S(ue.div, {
|
|
306
|
+
ref: s,
|
|
279
307
|
layout: !u,
|
|
280
308
|
transition: d,
|
|
281
|
-
className:
|
|
309
|
+
className: k(o["bsy-lexical__toolbar"], l && o["bsy-lexical__toolbar--floating"]),
|
|
282
310
|
style: {
|
|
283
311
|
...f,
|
|
284
312
|
...m,
|
|
285
313
|
...h
|
|
286
314
|
},
|
|
287
|
-
children: /* @__PURE__ */
|
|
315
|
+
children: /* @__PURE__ */ S(Lt, { config: t })
|
|
288
316
|
}) }) })
|
|
289
317
|
});
|
|
290
|
-
},
|
|
318
|
+
}, Y = {
|
|
291
319
|
"bsy-lexical-editor": "_bsy-lexical-editor_1bhfo_1",
|
|
292
320
|
"bsy-lexical-editor--floating": "_bsy-lexical-editor--floating_1bhfo_7",
|
|
293
321
|
"bsy-lexical-editor__content-editable": "_bsy-lexical-editor__content-editable_1bhfo_10",
|
|
294
322
|
"bsy-lexical-editor__content-editable--with-length-badge": "_bsy-lexical-editor__content-editable--with-length-badge_1bhfo_17",
|
|
295
323
|
"bsy-lexical-editor__length-badge": "_bsy-lexical-editor__length-badge_1bhfo_20",
|
|
296
324
|
"bsy-lexical-editor__length-badge--exceeded": "_bsy-lexical-editor__length-badge--exceeded_1bhfo_36"
|
|
297
|
-
},
|
|
325
|
+
}, X = class e extends L {
|
|
298
326
|
constructor(e, t) {
|
|
299
327
|
super(e, t);
|
|
300
328
|
}
|
|
@@ -305,46 +333,46 @@ var ot = (e) => {
|
|
|
305
333
|
return new e(t.__text, t.__key);
|
|
306
334
|
}
|
|
307
335
|
static importDOM() {
|
|
308
|
-
let e =
|
|
336
|
+
let e = L.importDOM();
|
|
309
337
|
return {
|
|
310
338
|
...e,
|
|
311
339
|
code: () => ({
|
|
312
|
-
conversion:
|
|
340
|
+
conversion: Z(e?.code),
|
|
313
341
|
priority: 1
|
|
314
342
|
}),
|
|
315
343
|
em: () => ({
|
|
316
|
-
conversion:
|
|
344
|
+
conversion: Z(e?.em),
|
|
317
345
|
priority: 1
|
|
318
346
|
}),
|
|
319
347
|
span: () => ({
|
|
320
|
-
conversion:
|
|
348
|
+
conversion: Z(e?.span),
|
|
321
349
|
priority: 1
|
|
322
350
|
}),
|
|
323
351
|
strong: () => ({
|
|
324
|
-
conversion:
|
|
352
|
+
conversion: Z(e?.strong),
|
|
325
353
|
priority: 1
|
|
326
354
|
}),
|
|
327
355
|
sub: () => ({
|
|
328
|
-
conversion:
|
|
356
|
+
conversion: Z(e?.sub),
|
|
329
357
|
priority: 1
|
|
330
358
|
}),
|
|
331
359
|
sup: () => ({
|
|
332
|
-
conversion:
|
|
360
|
+
conversion: Z(e?.sup),
|
|
333
361
|
priority: 1
|
|
334
362
|
})
|
|
335
363
|
};
|
|
336
364
|
}
|
|
337
365
|
static importJSON(e) {
|
|
338
|
-
return
|
|
366
|
+
return zt().updateFromJSON(e);
|
|
339
367
|
}
|
|
340
368
|
isSimpleText() {
|
|
341
369
|
return this.__type === "extended-text" && this.__mode === 0;
|
|
342
370
|
}
|
|
343
371
|
};
|
|
344
|
-
function
|
|
345
|
-
return
|
|
372
|
+
function zt(e = "") {
|
|
373
|
+
return be(new X(e));
|
|
346
374
|
}
|
|
347
|
-
function
|
|
375
|
+
function Z(e) {
|
|
348
376
|
return (t) => {
|
|
349
377
|
let n = e?.(t);
|
|
350
378
|
if (!n) return null;
|
|
@@ -355,7 +383,7 @@ function J(e) {
|
|
|
355
383
|
...r,
|
|
356
384
|
forChild: (e, t) => {
|
|
357
385
|
let n = (r?.forChild ?? ((e) => e))(e, t);
|
|
358
|
-
if (
|
|
386
|
+
if (Ae(n)) {
|
|
359
387
|
let e = [
|
|
360
388
|
i ? `background-color: ${i}` : null,
|
|
361
389
|
a ? `color: ${a}` : null,
|
|
@@ -372,22 +400,24 @@ function J(e) {
|
|
|
372
400
|
};
|
|
373
401
|
}
|
|
374
402
|
//#endregion
|
|
375
|
-
//#region src/components/Editor/
|
|
376
|
-
function
|
|
377
|
-
return e.split(";").map((e) => e.trim()).filter((e) => e && e.split(":")[0].trim().toLowerCase() !==
|
|
403
|
+
//#region src/components/Editor/utils/stripInlineStyleProperty.ts
|
|
404
|
+
function Bt(e, t) {
|
|
405
|
+
return e.split(";").map((e) => e.trim()).filter((e) => e && e.split(":")[0].trim().toLowerCase() !== t).join("; ");
|
|
378
406
|
}
|
|
379
|
-
|
|
380
|
-
|
|
407
|
+
//#endregion
|
|
408
|
+
//#region src/components/Editor/plugins/LinkColorPlugin.tsx
|
|
409
|
+
function Vt(e) {
|
|
410
|
+
if (!V(e, Ze)) return;
|
|
381
411
|
let t = e.getStyle();
|
|
382
412
|
if (!t) return;
|
|
383
|
-
let n =
|
|
413
|
+
let n = Bt(t, "color");
|
|
384
414
|
n !== t && e.setStyle(n);
|
|
385
415
|
}
|
|
386
|
-
function
|
|
387
|
-
let [e] =
|
|
388
|
-
return
|
|
416
|
+
function Ht() {
|
|
417
|
+
let [e] = R();
|
|
418
|
+
return T(() => e.registerNodeTransform(X, Vt), [e]), null;
|
|
389
419
|
}
|
|
390
|
-
var
|
|
420
|
+
var Q = {
|
|
391
421
|
imageWrapper: "_imageWrapper_y06h3_1",
|
|
392
422
|
selected: "_selected_y06h3_8",
|
|
393
423
|
resizing: "_resizing_y06h3_12",
|
|
@@ -397,16 +427,16 @@ var Y = {
|
|
|
397
427
|
topRight: "_topRight_y06h3_49",
|
|
398
428
|
bottomLeft: "_bottomLeft_y06h3_54",
|
|
399
429
|
bottomRight: "_bottomRight_y06h3_59"
|
|
400
|
-
},
|
|
401
|
-
let [a] =
|
|
430
|
+
}, Ut = ({ src: e, altText: t, width: n, height: r, nodeKey: i }) => {
|
|
431
|
+
let [a] = R(), [o, s] = O(!1), [c, l] = O(null), u = D(null), [d, f] = O({
|
|
402
432
|
width: n || void 0,
|
|
403
433
|
height: r || void 0
|
|
404
|
-
}), p =
|
|
434
|
+
}), p = w(() => {
|
|
405
435
|
n && r && f({
|
|
406
436
|
width: n,
|
|
407
437
|
height: r
|
|
408
438
|
});
|
|
409
|
-
}, [n, r]), m =
|
|
439
|
+
}, [n, r]), m = w((e, t) => {
|
|
410
440
|
if (e.preventDefault(), e.stopPropagation(), !u.current) return;
|
|
411
441
|
let n = d.width || u.current.offsetWidth, r = d.height || u.current.offsetHeight, i = n / r;
|
|
412
442
|
(!d.width || !d.height) && f({
|
|
@@ -421,7 +451,7 @@ var Y = {
|
|
|
421
451
|
aspectRatio: i,
|
|
422
452
|
direction: t
|
|
423
453
|
});
|
|
424
|
-
}, [d]), h =
|
|
454
|
+
}, [d]), h = w((e) => {
|
|
425
455
|
if (!c?.isResizing) return;
|
|
426
456
|
let t = e.clientX - c.startX, n;
|
|
427
457
|
switch (c.direction) {
|
|
@@ -444,10 +474,10 @@ var Y = {
|
|
|
444
474
|
width: n,
|
|
445
475
|
height: r
|
|
446
476
|
});
|
|
447
|
-
}, [c]), g =
|
|
477
|
+
}, [c]), g = w(() => {
|
|
448
478
|
c?.isResizing && (a.update(() => {
|
|
449
|
-
let e =
|
|
450
|
-
|
|
479
|
+
let e = A(i);
|
|
480
|
+
Kt(e) && e.setWidthAndHeight(d.width, d.height);
|
|
451
481
|
}), l(null));
|
|
452
482
|
}, [
|
|
453
483
|
a,
|
|
@@ -455,7 +485,7 @@ var Y = {
|
|
|
455
485
|
d,
|
|
456
486
|
c
|
|
457
487
|
]);
|
|
458
|
-
|
|
488
|
+
oe.useEffect(() => {
|
|
459
489
|
if (c?.isResizing) return document.addEventListener("mousemove", h), document.addEventListener("mouseup", g), () => {
|
|
460
490
|
document.removeEventListener("mousemove", h), document.removeEventListener("mouseup", g);
|
|
461
491
|
};
|
|
@@ -464,35 +494,35 @@ var Y = {
|
|
|
464
494
|
h,
|
|
465
495
|
g
|
|
466
496
|
]);
|
|
467
|
-
let _ =
|
|
497
|
+
let _ = w(() => {
|
|
468
498
|
s(!0);
|
|
469
499
|
}, []);
|
|
470
|
-
return
|
|
500
|
+
return T(() => a.registerUpdateListener(({ editorState: e }) => {
|
|
471
501
|
e.read(() => {
|
|
472
|
-
let e =
|
|
473
|
-
|
|
502
|
+
let e = M();
|
|
503
|
+
F(e) && !e.getNodes().some((e) => e.getKey() === i || e.getParent() && e.getParent()?.getKey() === i) && o && s(!1);
|
|
474
504
|
});
|
|
475
505
|
}), [
|
|
476
506
|
a,
|
|
477
507
|
i,
|
|
478
508
|
o
|
|
479
|
-
]),
|
|
509
|
+
]), T(() => {
|
|
480
510
|
let e = (e) => {
|
|
481
511
|
o && u.current && !u.current.contains(e.target) && s(!1);
|
|
482
512
|
};
|
|
483
513
|
if (o) return document.addEventListener("mousedown", e), () => {
|
|
484
514
|
document.removeEventListener("mousedown", e);
|
|
485
515
|
};
|
|
486
|
-
}, [o]), /* @__PURE__ */
|
|
487
|
-
className:
|
|
488
|
-
[
|
|
489
|
-
[
|
|
516
|
+
}, [o]), /* @__PURE__ */ C("div", {
|
|
517
|
+
className: k(Q.imageWrapper, {
|
|
518
|
+
[Q.selected]: o,
|
|
519
|
+
[Q.resizing]: c?.isResizing
|
|
490
520
|
}),
|
|
491
|
-
children: [/* @__PURE__ */
|
|
521
|
+
children: [/* @__PURE__ */ S("img", {
|
|
492
522
|
ref: u,
|
|
493
523
|
src: e,
|
|
494
524
|
alt: t,
|
|
495
|
-
className:
|
|
525
|
+
className: Q.image,
|
|
496
526
|
style: {
|
|
497
527
|
width: d.width,
|
|
498
528
|
height: d.height
|
|
@@ -500,26 +530,26 @@ var Y = {
|
|
|
500
530
|
onLoad: p,
|
|
501
531
|
onClick: _,
|
|
502
532
|
draggable: !1
|
|
503
|
-
}), o && /* @__PURE__ */
|
|
504
|
-
/* @__PURE__ */
|
|
505
|
-
className:
|
|
533
|
+
}), o && /* @__PURE__ */ C(ae, { children: [
|
|
534
|
+
/* @__PURE__ */ S("div", {
|
|
535
|
+
className: k(Q.resizeHandle, Q.bottomRight),
|
|
506
536
|
onMouseDown: (e) => m(e, "bottom-right")
|
|
507
537
|
}),
|
|
508
|
-
/* @__PURE__ */
|
|
509
|
-
className:
|
|
538
|
+
/* @__PURE__ */ S("div", {
|
|
539
|
+
className: k(Q.resizeHandle, Q.bottomLeft),
|
|
510
540
|
onMouseDown: (e) => m(e, "bottom-left")
|
|
511
541
|
}),
|
|
512
|
-
/* @__PURE__ */
|
|
513
|
-
className:
|
|
542
|
+
/* @__PURE__ */ S("div", {
|
|
543
|
+
className: k(Q.resizeHandle, Q.topRight),
|
|
514
544
|
onMouseDown: (e) => m(e, "top-right")
|
|
515
545
|
}),
|
|
516
|
-
/* @__PURE__ */
|
|
517
|
-
className:
|
|
546
|
+
/* @__PURE__ */ S("div", {
|
|
547
|
+
className: k(Q.resizeHandle, Q.topLeft),
|
|
518
548
|
onMouseDown: (e) => m(e, "top-left")
|
|
519
549
|
})
|
|
520
550
|
] })]
|
|
521
551
|
});
|
|
522
|
-
},
|
|
552
|
+
}, Wt = class e extends Le {
|
|
523
553
|
static getType() {
|
|
524
554
|
return "image";
|
|
525
555
|
}
|
|
@@ -565,7 +595,7 @@ var Y = {
|
|
|
565
595
|
n.__width = e, n.__height = t;
|
|
566
596
|
}
|
|
567
597
|
decorate() {
|
|
568
|
-
return /* @__PURE__ */
|
|
598
|
+
return /* @__PURE__ */ S(Ut, {
|
|
569
599
|
src: this.__src,
|
|
570
600
|
altText: this.__altText,
|
|
571
601
|
width: this.__width,
|
|
@@ -575,13 +605,13 @@ var Y = {
|
|
|
575
605
|
}
|
|
576
606
|
static importDOM() {
|
|
577
607
|
return { img: () => ({
|
|
578
|
-
conversion:
|
|
608
|
+
conversion: qt,
|
|
579
609
|
priority: 0
|
|
580
610
|
}) };
|
|
581
611
|
}
|
|
582
612
|
static importJSON(e) {
|
|
583
613
|
let { src: t, altText: n, width: r, height: i } = e;
|
|
584
|
-
return
|
|
614
|
+
return Gt({
|
|
585
615
|
src: t,
|
|
586
616
|
altText: n,
|
|
587
617
|
width: r,
|
|
@@ -602,13 +632,13 @@ var Y = {
|
|
|
602
632
|
return !0;
|
|
603
633
|
}
|
|
604
634
|
};
|
|
605
|
-
function
|
|
606
|
-
return new
|
|
635
|
+
function Gt({ src: e, altText: t, width: n, height: r, key: i }) {
|
|
636
|
+
return new Wt(e, t, n, r, i);
|
|
607
637
|
}
|
|
608
|
-
function
|
|
609
|
-
return e instanceof
|
|
638
|
+
function Kt(e) {
|
|
639
|
+
return e instanceof Wt;
|
|
610
640
|
}
|
|
611
|
-
function
|
|
641
|
+
function qt(e) {
|
|
612
642
|
if (e instanceof HTMLImageElement) {
|
|
613
643
|
let { src: t, alt: n, style: r } = e, i, a;
|
|
614
644
|
if (r.width) {
|
|
@@ -619,7 +649,7 @@ function xt(e) {
|
|
|
619
649
|
let e = parseInt(r.height, 10);
|
|
620
650
|
isNaN(e) || (a = e);
|
|
621
651
|
}
|
|
622
|
-
return i === void 0 && e.width && (i = e.width), a === void 0 && e.height && (a = e.height), { node:
|
|
652
|
+
return i === void 0 && e.width && (i = e.width), a === void 0 && e.height && (a = e.height), { node: Gt({
|
|
623
653
|
src: t,
|
|
624
654
|
altText: n,
|
|
625
655
|
width: i,
|
|
@@ -630,62 +660,63 @@ function xt(e) {
|
|
|
630
660
|
}
|
|
631
661
|
//#endregion
|
|
632
662
|
//#region src/components/Editor/plugins/ImagePlugin.tsx
|
|
633
|
-
function
|
|
634
|
-
let [e] =
|
|
635
|
-
return
|
|
663
|
+
function Jt() {
|
|
664
|
+
let [e] = R();
|
|
665
|
+
return T(() => e.registerCommand(s, (e) => (N([Gt(e)]), !0), Pe), [e]), null;
|
|
636
666
|
}
|
|
637
667
|
//#endregion
|
|
638
668
|
//#region src/components/Editor/utils/stripImagesFromHtml.ts
|
|
639
|
-
function
|
|
669
|
+
function Yt(e) {
|
|
640
670
|
let t = new DOMParser().parseFromString(e, "text/html");
|
|
641
671
|
return t.querySelectorAll("img, picture").forEach((e) => e.remove()), t.body.innerHTML;
|
|
642
672
|
}
|
|
643
673
|
//#endregion
|
|
644
674
|
//#region src/components/Editor/plugins/PasteStripImagePlugin.tsx
|
|
645
|
-
var
|
|
646
|
-
function
|
|
647
|
-
let [e] =
|
|
648
|
-
return
|
|
649
|
-
let
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
675
|
+
var Xt = /<img\b|<picture\b/i;
|
|
676
|
+
function Zt() {
|
|
677
|
+
let [e] = R(), { isSourceModeRef: t } = y();
|
|
678
|
+
return T(() => {
|
|
679
|
+
let n = (n) => {
|
|
680
|
+
if (t.current) return !1;
|
|
681
|
+
let r = "clipboardData" in n ? n.clipboardData : "dataTransfer" in n ? n.dataTransfer : null;
|
|
682
|
+
if (!r || r.getData("application/x-lexical-editor") || r.getData("application/x-lexical-drag")) return !1;
|
|
683
|
+
let i = r.getData("text/html");
|
|
684
|
+
if (!(Array.from(r.files).some((e) => e.type.startsWith("image/")) || Array.from(r.items).some((e) => e.type.startsWith("image/")) || Xt.test(i))) return !1;
|
|
685
|
+
n.preventDefault();
|
|
686
|
+
let a = r.getData("text/plain");
|
|
687
|
+
return !Xt.test(i) && !a || e.update(() => {
|
|
688
|
+
let t = M();
|
|
658
689
|
if (t === null) return;
|
|
659
|
-
let n =
|
|
660
|
-
if (
|
|
661
|
-
let t =
|
|
690
|
+
let n = i ? Yt(i) : "", r = document.createElement("div");
|
|
691
|
+
if (r.innerHTML = n, n && r.textContent?.trim()) {
|
|
692
|
+
let t = ye(e, new DOMParser().parseFromString(n, "text/html"));
|
|
662
693
|
if (t.length) {
|
|
663
|
-
|
|
694
|
+
N(t);
|
|
664
695
|
return;
|
|
665
696
|
}
|
|
666
697
|
}
|
|
667
|
-
|
|
668
|
-
}, { tag:
|
|
698
|
+
a && t.insertRawText(a);
|
|
699
|
+
}, { tag: Ue }), !0;
|
|
669
700
|
};
|
|
670
|
-
return
|
|
671
|
-
}, [e]), null;
|
|
701
|
+
return Xe(e.registerCommand(He, (e) => n(e), I), e.registerCommand(Ie, (e) => n(e), I));
|
|
702
|
+
}, [e, t]), null;
|
|
672
703
|
}
|
|
673
704
|
//#endregion
|
|
674
705
|
//#region src/components/Editor/plugins/EnterKeyPlugin.tsx
|
|
675
|
-
function
|
|
676
|
-
let [e] =
|
|
677
|
-
return
|
|
706
|
+
function Qt() {
|
|
707
|
+
let [e] = R(), t = D(0);
|
|
708
|
+
return T(() => e.registerCommand(Be, (n) => {
|
|
678
709
|
let r = Date.now(), i = r - t.current;
|
|
679
710
|
return t.current = r, i < 250 && i > 0 ? e.getEditorState().read(() => {
|
|
680
|
-
let e =
|
|
681
|
-
return
|
|
711
|
+
let e = M();
|
|
712
|
+
return F(e) ? !!V(e.anchor.getNode(), (e) => H(e) || U(e) || K(e)) : !1;
|
|
682
713
|
}, { editor: e }) ? !1 : (e.update(() => {
|
|
683
|
-
let e =
|
|
684
|
-
if (
|
|
714
|
+
let e = M();
|
|
715
|
+
if (F(e)) {
|
|
685
716
|
let t = e.anchor.getNode().getTopLevelElement();
|
|
686
717
|
if (t && t.getTextContent().trim() === "") {
|
|
687
|
-
let n =
|
|
688
|
-
|
|
718
|
+
let n = Se();
|
|
719
|
+
Je(e, {
|
|
689
720
|
"background-color": "",
|
|
690
721
|
color: "",
|
|
691
722
|
"font-size": "",
|
|
@@ -698,11 +729,11 @@ function Et() {
|
|
|
698
729
|
}
|
|
699
730
|
}
|
|
700
731
|
}), n?.preventDefault(), !0) : !1;
|
|
701
|
-
},
|
|
732
|
+
}, Fe), [e]), null;
|
|
702
733
|
}
|
|
703
734
|
//#endregion
|
|
704
735
|
//#region src/components/Editor/utils/codeHighlighter.ts
|
|
705
|
-
var
|
|
736
|
+
var $t = {
|
|
706
737
|
css: () => import("@shikijs/langs/css"),
|
|
707
738
|
html: () => import("@shikijs/langs/html"),
|
|
708
739
|
xml: () => import("@shikijs/langs/xml"),
|
|
@@ -723,65 +754,65 @@ var Dt = {
|
|
|
723
754
|
bash: () => import("@shikijs/langs/shellscript"),
|
|
724
755
|
lua: () => import("@shikijs/langs/lua"),
|
|
725
756
|
markdown: () => import("@shikijs/langs/markdown")
|
|
726
|
-
},
|
|
757
|
+
}, en = (e) => e === "bash" ? "shellscript" : e, tn = (e) => e in $t, nn = null, rn = null, an = /* @__PURE__ */ new Map(), on = () => (nn ||= Promise.all([import("@shikijs/core"), import("@shikijs/engine-javascript")]).then(([{ createHighlighterCoreSync: e }, { createJavaScriptRegexEngine: t }]) => e({
|
|
727
758
|
engine: t(),
|
|
728
759
|
langs: [],
|
|
729
760
|
themes: []
|
|
730
761
|
})).catch((e) => {
|
|
731
|
-
throw
|
|
732
|
-
}),
|
|
733
|
-
let t =
|
|
734
|
-
return t || (t =
|
|
735
|
-
let n =
|
|
762
|
+
throw nn = null, e;
|
|
763
|
+
}), nn), sn = (e, t) => tn(t) && e.getLoadedLanguages().includes(en(t)), cn = (e) => {
|
|
764
|
+
let t = an.get(e);
|
|
765
|
+
return t || (t = on().then(async (t) => {
|
|
766
|
+
let n = en(e);
|
|
736
767
|
if (!t.getLoadedLanguages().includes(n)) {
|
|
737
|
-
let n = await
|
|
768
|
+
let n = await $t[e]();
|
|
738
769
|
await t.loadLanguage(n.default);
|
|
739
770
|
}
|
|
740
771
|
return t;
|
|
741
772
|
}).catch((t) => {
|
|
742
|
-
throw
|
|
743
|
-
}),
|
|
744
|
-
},
|
|
773
|
+
throw an.delete(e), t;
|
|
774
|
+
}), an.set(e, t)), t;
|
|
775
|
+
}, ln = () => (rn ||= on().then(async (e) => {
|
|
745
776
|
if (!e.getLoadedThemes().includes("github-light")) {
|
|
746
777
|
let t = await import("@shikijs/themes/github-light");
|
|
747
778
|
await e.loadTheme(t.default);
|
|
748
779
|
}
|
|
749
780
|
return e;
|
|
750
781
|
}).catch((e) => {
|
|
751
|
-
throw
|
|
752
|
-
}),
|
|
782
|
+
throw rn = null, e;
|
|
783
|
+
}), rn), un = (e, t, n) => {
|
|
753
784
|
let r = e.getTextContent();
|
|
754
|
-
if (e.getStyle() && e.setStyle(""), !n || !
|
|
755
|
-
let i =
|
|
785
|
+
if (e.getStyle() && e.setStyle(""), !n || !sn(n, t)) return ot(r);
|
|
786
|
+
let i = en(t), a = n.codeToTokens(r, {
|
|
756
787
|
lang: i,
|
|
757
|
-
theme:
|
|
788
|
+
theme: m
|
|
758
789
|
}), o = [];
|
|
759
790
|
return a.tokens.forEach((e, t) => {
|
|
760
|
-
t && o.push(
|
|
791
|
+
t && o.push(xe()), e.forEach((e) => {
|
|
761
792
|
e.content.split(" ").forEach((t, n) => {
|
|
762
|
-
if (n && o.push(
|
|
763
|
-
let r =
|
|
793
|
+
if (n && o.push(Ce()), t === "") return;
|
|
794
|
+
let r = rt(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}` : "";
|
|
764
795
|
i && r.setStyle(i), o.push(r);
|
|
765
796
|
});
|
|
766
797
|
});
|
|
767
798
|
}), o;
|
|
768
|
-
},
|
|
769
|
-
let n =
|
|
770
|
-
if (!
|
|
771
|
-
let r =
|
|
772
|
-
if (!
|
|
799
|
+
}, dn = (e, t) => {
|
|
800
|
+
let n = A(e);
|
|
801
|
+
if (!U(n) || !n.isAttached()) return;
|
|
802
|
+
let r = M();
|
|
803
|
+
if (!F(r)) {
|
|
773
804
|
t();
|
|
774
805
|
return;
|
|
775
806
|
}
|
|
776
|
-
let { anchor: i } = r, a = i.offset, o = i.type === "element" &&
|
|
807
|
+
let { anchor: i } = r, a = i.offset, o = i.type === "element" && P(n.getChildAtIndex(i.offset - 1)), s = 0;
|
|
777
808
|
if (o || (s = a + i.getNode().getPreviousSiblings().reduce((e, t) => e + t.getTextContentSize(), 0)), t()) {
|
|
778
809
|
if (o) {
|
|
779
810
|
i.getNode().select(a, a);
|
|
780
811
|
return;
|
|
781
812
|
}
|
|
782
813
|
n.getChildren().some((e) => {
|
|
783
|
-
let t =
|
|
784
|
-
if (t ||
|
|
814
|
+
let t = Ae(e);
|
|
815
|
+
if (t || P(e)) {
|
|
785
816
|
let n = e.getTextContentSize();
|
|
786
817
|
if (t && n >= s) return e.select(s, s), !0;
|
|
787
818
|
s -= n;
|
|
@@ -789,11 +820,11 @@ var Dt = {
|
|
|
789
820
|
return !1;
|
|
790
821
|
});
|
|
791
822
|
}
|
|
792
|
-
},
|
|
823
|
+
}, fn = (e, t) => at(e) && at(t) && e.__text === t.__text && e.__highlightType === t.__highlightType && e.__style === t.__style || ke(e) && ke(t) || P(e) && P(t), pn = (e, t) => {
|
|
793
824
|
let n = 0;
|
|
794
|
-
for (; n < e.length &&
|
|
825
|
+
for (; n < e.length && fn(e[n], t[n]);) n++;
|
|
795
826
|
let r = e.length, i = t.length, a = Math.min(r, i) - n, o = 0;
|
|
796
|
-
for (; o < a;) if (o++, !
|
|
827
|
+
for (; o < a;) if (o++, !fn(e[r - o], t[i - o])) {
|
|
797
828
|
o--;
|
|
798
829
|
break;
|
|
799
830
|
}
|
|
@@ -802,21 +833,21 @@ var Dt = {
|
|
|
802
833
|
to: r - o,
|
|
803
834
|
nodesForReplacement: t.slice(n, i - o)
|
|
804
835
|
};
|
|
805
|
-
},
|
|
806
|
-
let a = i.getKey(), o =
|
|
836
|
+
}, mn = (e, t, n, r, i) => {
|
|
837
|
+
let a = i.getKey(), o = x(i.getLanguage());
|
|
807
838
|
if (i.getLanguage() !== o && i.setLanguage(o), o === "plaintext") i.getIsSyntaxHighlightSupported() && i.setIsSyntaxHighlightSupported(!1);
|
|
808
839
|
else {
|
|
809
|
-
i.getTheme() !== "github-light" && i.setTheme(
|
|
810
|
-
let s = t ? t.getLoadedThemes().includes("github-light") ?
|
|
840
|
+
i.getTheme() !== "github-light" && i.setTheme(m);
|
|
841
|
+
let s = t ? t.getLoadedThemes().includes("github-light") ? tn(o) && !sn(t, o) ? cn(o) : null : ln() : on();
|
|
811
842
|
if (s) {
|
|
812
843
|
i.getIsSyntaxHighlightSupported() && i.setIsSyntaxHighlightSupported(!1), n.pendingKeys.add(a), n.loading !== s && (n.loading = s, s.then((t) => {
|
|
813
844
|
r(t);
|
|
814
845
|
let i = [...n.pendingKeys];
|
|
815
846
|
n.pendingKeys.clear(), n.loading = null, e.update(() => {
|
|
816
847
|
i.forEach((e) => {
|
|
817
|
-
|
|
848
|
+
A(e)?.markDirty();
|
|
818
849
|
});
|
|
819
|
-
});
|
|
850
|
+
}, { tag: Re });
|
|
820
851
|
}, () => {
|
|
821
852
|
n.pendingKeys.clear(), n.loading = null;
|
|
822
853
|
}));
|
|
@@ -824,22 +855,22 @@ var Dt = {
|
|
|
824
855
|
}
|
|
825
856
|
i.getIsSyntaxHighlightSupported() || i.setIsSyntaxHighlightSupported(!0);
|
|
826
857
|
}
|
|
827
|
-
n.nodesCurrentlyHighlighting.has(a) || (n.nodesCurrentlyHighlighting.add(a), n.didTransform || (n.didTransform = !0,
|
|
858
|
+
n.nodesCurrentlyHighlighting.has(a) || (n.nodesCurrentlyHighlighting.add(a), n.didTransform || (n.didTransform = !0, je(() => {
|
|
828
859
|
n.didTransform = !1, n.nodesCurrentlyHighlighting.clear();
|
|
829
|
-
})),
|
|
830
|
-
let e =
|
|
831
|
-
if (!
|
|
832
|
-
let n =
|
|
860
|
+
})), dn(a, () => {
|
|
861
|
+
let e = A(a);
|
|
862
|
+
if (!U(e) || !e.isAttached()) return !1;
|
|
863
|
+
let n = un(e, x(e.getLanguage()), t), { from: r, to: i, nodesForReplacement: o } = pn(e.getChildren(), n);
|
|
833
864
|
return r !== i || o.length ? (e.splice(r, i - r, o), !0) : !1;
|
|
834
865
|
}));
|
|
835
|
-
},
|
|
866
|
+
}, hn = (e, t, n, r, i) => {
|
|
836
867
|
let a = i.getParent();
|
|
837
|
-
|
|
868
|
+
U(a) ? mn(e, t, n, r, a) : at(i) && i.replace(we(i.__text));
|
|
838
869
|
};
|
|
839
|
-
function
|
|
840
|
-
let [e] =
|
|
841
|
-
return
|
|
842
|
-
if (!e.hasNodes([
|
|
870
|
+
function gn() {
|
|
871
|
+
let [e] = R();
|
|
872
|
+
return T(() => {
|
|
873
|
+
if (!e.hasNodes([G, W])) throw Error("CodeHighlightPlugin: CodeNode or CodeHighlightNode not registered on editor");
|
|
843
874
|
let t = null, n = {
|
|
844
875
|
didTransform: !1,
|
|
845
876
|
nodesCurrentlyHighlighting: /* @__PURE__ */ new Set(),
|
|
@@ -847,88 +878,417 @@ function Vt() {
|
|
|
847
878
|
loading: null
|
|
848
879
|
}, r = (e) => {
|
|
849
880
|
t = e;
|
|
881
|
+
}, i = (e) => {
|
|
882
|
+
let t = A(e);
|
|
883
|
+
if (!U(t)) return;
|
|
884
|
+
let n = t.getChildrenSize();
|
|
885
|
+
n === 0 ? t.selectStart() : t.select(0, n);
|
|
886
|
+
}, a = (t) => {
|
|
887
|
+
if (!(t instanceof Node) || !e.getRootElement()?.contains(t)) return null;
|
|
888
|
+
let n = null;
|
|
889
|
+
return e.getEditorState().read(() => {
|
|
890
|
+
let e = Te(t), r = e ? V(e, U) : null;
|
|
891
|
+
U(r) && (n = r.getKey());
|
|
892
|
+
}, { editor: e }), n;
|
|
893
|
+
}, o = null, s = (t, n, r) => {
|
|
894
|
+
t.preventDefault(), r && (o = n), e.update(() => {
|
|
895
|
+
i(n);
|
|
896
|
+
});
|
|
897
|
+
}, c = (t) => {
|
|
898
|
+
if (t.detail < 2 || !e.isEditable()) return;
|
|
899
|
+
let n = a(t.target);
|
|
900
|
+
n !== null && s(t, n, !0);
|
|
901
|
+
}, l = (t) => {
|
|
902
|
+
if (!e.isEditable()) return;
|
|
903
|
+
let n = a(t.target);
|
|
904
|
+
n !== null && s(t, n, !1);
|
|
905
|
+
}, u = () => {
|
|
906
|
+
let t = o;
|
|
907
|
+
t !== null && (o = null, e.update(() => {
|
|
908
|
+
i(t);
|
|
909
|
+
}));
|
|
910
|
+
}, d = (e, t) => {
|
|
911
|
+
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);
|
|
850
912
|
};
|
|
851
|
-
return
|
|
852
|
-
|
|
853
|
-
}), e.registerNodeTransform(
|
|
854
|
-
|
|
855
|
-
}), e.registerNodeTransform(
|
|
856
|
-
|
|
857
|
-
}))
|
|
913
|
+
return Ke(st(e), e.registerNodeTransform(G, (i) => {
|
|
914
|
+
mn(e, t, n, r, i);
|
|
915
|
+
}), e.registerNodeTransform(L, (i) => {
|
|
916
|
+
hn(e, t, n, r, i);
|
|
917
|
+
}), e.registerNodeTransform(W, (i) => {
|
|
918
|
+
hn(e, t, n, r, i);
|
|
919
|
+
}), e.registerRootListener(d), () => {
|
|
920
|
+
d(null, e.getRootElement());
|
|
921
|
+
});
|
|
858
922
|
}, [e]), null;
|
|
859
923
|
}
|
|
860
924
|
//#endregion
|
|
925
|
+
//#region src/components/Editor/plugins/TablePlugin.tsx
|
|
926
|
+
function _n() {
|
|
927
|
+
let [e] = R();
|
|
928
|
+
return T(() => (_t(e, !0), Xe(ht(e), gt(e, !1), mt(e), e.registerNodeTransform(q, (e) => {
|
|
929
|
+
e.getBackgroundColor() !== null && e.setBackgroundColor(null);
|
|
930
|
+
}), e.registerCommand(Ve, (e) => {
|
|
931
|
+
let t = M();
|
|
932
|
+
if (!F(t) || !t.isCollapsed()) return !1;
|
|
933
|
+
let n = ct(t.anchor.getNode());
|
|
934
|
+
if (n === null) return !1;
|
|
935
|
+
let r = e.shiftKey ? "previous" : "next", i = r === "next" ? "getNextSibling" : "getPreviousSibling", a = r === "next" ? "getFirstChild" : "getLastChild", o = n[i](), s = null;
|
|
936
|
+
if (K(o)) s = o;
|
|
937
|
+
else {
|
|
938
|
+
let e = V(n, ut);
|
|
939
|
+
if (e !== null) for (let t = e[i](); t !== null; t = t[i]()) {
|
|
940
|
+
if (!ut(t)) continue;
|
|
941
|
+
let e = t[a]();
|
|
942
|
+
if (K(e)) {
|
|
943
|
+
s = e;
|
|
944
|
+
break;
|
|
945
|
+
}
|
|
946
|
+
}
|
|
947
|
+
}
|
|
948
|
+
if (e.preventDefault(), s) {
|
|
949
|
+
let e = s.getFirstDescendant();
|
|
950
|
+
e ? e.selectStart() : s.selectStart();
|
|
951
|
+
} else {
|
|
952
|
+
let e = V(n, lt);
|
|
953
|
+
e && (r === "next" ? e.selectNext() : e.selectPrevious());
|
|
954
|
+
}
|
|
955
|
+
return !0;
|
|
956
|
+
}, I))), [e]), null;
|
|
957
|
+
}
|
|
958
|
+
//#endregion
|
|
959
|
+
//#region src/components/Editor/plugins/TabIndentPlugin.tsx
|
|
960
|
+
var vn = "\xA0".repeat(4);
|
|
961
|
+
function yn() {
|
|
962
|
+
let [e] = R();
|
|
963
|
+
return T(() => e.registerCommand(Ve, (t) => {
|
|
964
|
+
if (t.shiftKey) return !1;
|
|
965
|
+
let n = M();
|
|
966
|
+
if (!F(n)) return !1;
|
|
967
|
+
let r = n.anchor.getNode();
|
|
968
|
+
if (ct(r) !== null || V(r, U)) return !1;
|
|
969
|
+
t.preventDefault();
|
|
970
|
+
let i = V(r, H);
|
|
971
|
+
if (H(i)) {
|
|
972
|
+
let e = new Set([i]);
|
|
973
|
+
for (let t of n.getNodes()) {
|
|
974
|
+
let n = V(t, H);
|
|
975
|
+
H(n) && e.add(n);
|
|
976
|
+
}
|
|
977
|
+
for (let t of e) t.setIndent(t.getIndent() + 1);
|
|
978
|
+
return !0;
|
|
979
|
+
}
|
|
980
|
+
let a = r.getTopLevelElement(), o = n.focus.getNode().getTopLevelElement();
|
|
981
|
+
return !n.isCollapsed() && a && o && a !== o ? e.dispatchCommand(ze, void 0) : (n.insertText(vn), !0);
|
|
982
|
+
}, Pe), [e]), null;
|
|
983
|
+
}
|
|
984
|
+
//#endregion
|
|
861
985
|
//#region src/components/Editor/plugins/MaxLengthPlugin.tsx
|
|
862
|
-
function
|
|
863
|
-
let [n] =
|
|
864
|
-
return
|
|
986
|
+
function bn({ maxLength: e, onMaxLengthExceed: t }) {
|
|
987
|
+
let [n] = R(), { isSourceModeRef: r } = y(), i = D(t);
|
|
988
|
+
return i.current = t, T(() => {
|
|
865
989
|
let t = null;
|
|
866
|
-
return n.registerNodeTransform(
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
990
|
+
return n.registerNodeTransform(We, (a) => {
|
|
991
|
+
if (r.current) return;
|
|
992
|
+
let o = a.getTextContentSize();
|
|
993
|
+
if (o <= e) return;
|
|
994
|
+
let s = n.getEditorState(), c = s.read(() => a.getTextContentSize()), l = o - e, u = M();
|
|
995
|
+
if (c === e && t !== s) {
|
|
996
|
+
t = s, Ye(n, s), i.current?.();
|
|
872
997
|
return;
|
|
873
998
|
}
|
|
874
|
-
if (
|
|
875
|
-
|
|
999
|
+
if (F(u) && u.isCollapsed()) {
|
|
1000
|
+
B(n, u.anchor, l), i.current?.();
|
|
876
1001
|
return;
|
|
877
1002
|
}
|
|
878
|
-
|
|
879
|
-
let
|
|
880
|
-
|
|
1003
|
+
a.selectEnd();
|
|
1004
|
+
let d = M();
|
|
1005
|
+
F(d) && (B(n, d.anchor, l), i.current?.());
|
|
881
1006
|
});
|
|
882
|
-
}, [
|
|
1007
|
+
}, [
|
|
1008
|
+
n,
|
|
1009
|
+
e,
|
|
1010
|
+
r
|
|
1011
|
+
]), null;
|
|
883
1012
|
}
|
|
884
1013
|
//#endregion
|
|
885
|
-
//#region src/components/Editor/
|
|
886
|
-
var
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
1014
|
+
//#region src/components/Editor/utils/fillRootFromHtml.ts
|
|
1015
|
+
var xn = [
|
|
1016
|
+
"color",
|
|
1017
|
+
"background-color",
|
|
1018
|
+
"font-size",
|
|
1019
|
+
"font-family",
|
|
1020
|
+
"font-weight",
|
|
1021
|
+
"text-decoration"
|
|
1022
|
+
], Sn = (e) => {
|
|
1023
|
+
let t = e.body.querySelectorAll("p, h1, h2, h3, h4, h5, h6, li, td, th");
|
|
1024
|
+
for (let n of Array.from(t)) {
|
|
1025
|
+
let t = n, r = [];
|
|
1026
|
+
for (let e of xn) {
|
|
1027
|
+
let n = t.style.getPropertyValue(e);
|
|
1028
|
+
n && (r.push(`${e}: ${n}`), t.style.removeProperty(e));
|
|
1029
|
+
}
|
|
1030
|
+
if (!r.length) continue;
|
|
1031
|
+
let i = r.join("; ");
|
|
1032
|
+
for (let n of Array.from(t.childNodes)) {
|
|
1033
|
+
if (n.nodeType === Node.TEXT_NODE && n.textContent) {
|
|
1034
|
+
let r = e.createElement("span");
|
|
1035
|
+
r.setAttribute("style", i), t.insertBefore(r, n), r.appendChild(n);
|
|
1036
|
+
continue;
|
|
1037
|
+
}
|
|
1038
|
+
if (n.nodeType === Node.ELEMENT_NODE) {
|
|
1039
|
+
let e = n, t = e.getAttribute("style");
|
|
1040
|
+
e.setAttribute("style", t ? `${t}; ${i}` : i);
|
|
1041
|
+
}
|
|
1042
|
+
}
|
|
1043
|
+
}
|
|
897
1044
|
};
|
|
898
|
-
|
|
1045
|
+
function Cn(e, t) {
|
|
1046
|
+
let n = j();
|
|
1047
|
+
if (n.clear(), !t.trim()) return;
|
|
1048
|
+
let r = new DOMParser().parseFromString(t, "text/html");
|
|
1049
|
+
Sn(r);
|
|
1050
|
+
let i = ye(e, r);
|
|
1051
|
+
i.length && (n.select(), N(i));
|
|
1052
|
+
}
|
|
1053
|
+
//#endregion
|
|
1054
|
+
//#region src/components/Editor/utils/isEmptyEditorHtml.ts
|
|
1055
|
+
function wn(e, t) {
|
|
1056
|
+
return !t.trim() && (e === "<p><br></p>" || e === "<p></p>" || e === "" || /^<p>\s*<br>\s*<\/p>$/.test(e));
|
|
1057
|
+
}
|
|
1058
|
+
//#endregion
|
|
1059
|
+
//#region src/components/Editor/utils/sanitizeEditorHtml.ts
|
|
1060
|
+
var Tn = /* @__PURE__ */ "p.br.strong.em.b.i.u.s.span.sub.sup.ul.ol.li.a.img.pre.code.table.thead.tbody.tr.td.th.h1.h2.h3.h4.h5.h6".split("."), En = [
|
|
1061
|
+
"href",
|
|
1062
|
+
"src",
|
|
1063
|
+
"alt",
|
|
1064
|
+
"target",
|
|
1065
|
+
"rel",
|
|
1066
|
+
"colspan",
|
|
1067
|
+
"rowspan",
|
|
1068
|
+
"data-language",
|
|
1069
|
+
"class",
|
|
1070
|
+
"style",
|
|
1071
|
+
"width",
|
|
1072
|
+
"height"
|
|
1073
|
+
], Dn = new Set([
|
|
1074
|
+
"color",
|
|
1075
|
+
"background-color",
|
|
1076
|
+
"font-size",
|
|
1077
|
+
"font-family",
|
|
1078
|
+
"font-weight",
|
|
1079
|
+
"text-decoration",
|
|
1080
|
+
"text-align",
|
|
1081
|
+
"max-width",
|
|
1082
|
+
"display",
|
|
1083
|
+
"vertical-align",
|
|
1084
|
+
"width",
|
|
1085
|
+
"height",
|
|
1086
|
+
"border"
|
|
1087
|
+
]), On = /^(?:(?:(?:f|ht)tps?|mailto|blob):|data:image\/[a-z0-9.+-]+[;,].*|[^a-z]|[a-z+.-]+(?:[^a-z+.:-]|$))/i, kn = (e) => e.split(";").map((e) => e.trim()).filter(Boolean).map((e) => {
|
|
1088
|
+
let t = e.indexOf(":");
|
|
1089
|
+
if (t === -1) return null;
|
|
1090
|
+
let n = e.slice(0, t).trim().toLowerCase(), r = e.slice(t + 1).trim();
|
|
1091
|
+
if (n === "background") {
|
|
1092
|
+
if (/url\s*\(/i.test(r)) return null;
|
|
1093
|
+
n = "background-color";
|
|
1094
|
+
}
|
|
1095
|
+
return !Dn.has(n) || /expression|javascript:|url\s*\(\s*['"]?\s*javascript/i.test(r) ? null : `${n}: ${r}`;
|
|
1096
|
+
}).filter((e) => e !== null).join("; "), An = !1, jn = () => {
|
|
1097
|
+
An ||= (Ct.addHook("uponSanitizeAttribute", (e, t) => {
|
|
1098
|
+
if (t.attrName === "href" && /^data:/i.test(t.attrValue)) {
|
|
1099
|
+
t.keepAttr = !1;
|
|
1100
|
+
return;
|
|
1101
|
+
}
|
|
1102
|
+
t.attrName === "style" && (t.attrValue = kn(t.attrValue), t.attrValue || (t.keepAttr = !1));
|
|
1103
|
+
}), !0);
|
|
1104
|
+
};
|
|
1105
|
+
function $(e) {
|
|
1106
|
+
return e ? (jn(), Ct.sanitize(e, {
|
|
1107
|
+
ALLOWED_TAGS: Tn,
|
|
1108
|
+
ALLOWED_ATTR: En,
|
|
1109
|
+
ALLOW_DATA_ATTR: !1,
|
|
1110
|
+
ADD_ATTR: ["data-language"],
|
|
1111
|
+
ALLOWED_URI_REGEXP: On
|
|
1112
|
+
})) : "";
|
|
1113
|
+
}
|
|
899
1114
|
//#endregion
|
|
900
1115
|
//#region src/components/Editor/utils/textLength.ts
|
|
901
|
-
function
|
|
1116
|
+
function Mn(e) {
|
|
902
1117
|
return typeof e == "number" && Number.isFinite(e) && e > 0;
|
|
903
1118
|
}
|
|
904
|
-
function
|
|
905
|
-
let n =
|
|
1119
|
+
function Nn(e, t) {
|
|
1120
|
+
let n = j(), r = n.getTextContentSize();
|
|
906
1121
|
if (r <= t) return !1;
|
|
907
1122
|
let i = r - t;
|
|
908
1123
|
n.selectEnd();
|
|
909
|
-
let a =
|
|
910
|
-
return
|
|
1124
|
+
let a = M();
|
|
1125
|
+
return F(a) ? B(e, a.anchor, i) : Pn(i), !0;
|
|
911
1126
|
}
|
|
912
|
-
function
|
|
913
|
-
let t = e, n =
|
|
1127
|
+
function Pn(e) {
|
|
1128
|
+
let t = e, n = j().getAllTextNodes();
|
|
914
1129
|
for (let e = n.length - 1; e >= 0 && t > 0; e--) {
|
|
915
1130
|
let r = n[e], i = r.getTextContent();
|
|
916
1131
|
i.length !== 0 && (i.length <= t ? (t -= i.length, r.remove()) : (r.setTextContent(i.slice(0, i.length - t)), t = 0));
|
|
917
1132
|
}
|
|
918
1133
|
}
|
|
919
1134
|
//#endregion
|
|
1135
|
+
//#region src/components/Editor/utils/formatEditorHtml.ts
|
|
1136
|
+
var Fn = (e) => {
|
|
1137
|
+
let t = e.parentNode;
|
|
1138
|
+
if (t) {
|
|
1139
|
+
for (; e.firstChild;) t.insertBefore(e.firstChild, e);
|
|
1140
|
+
t.removeChild(e);
|
|
1141
|
+
}
|
|
1142
|
+
}, In = (e) => {
|
|
1143
|
+
let t = new DOMParser().parseFromString(e, "text/html");
|
|
1144
|
+
for (let e of Array.from(t.body.querySelectorAll("*"))) {
|
|
1145
|
+
for (let t of Array.from(e.classList)) t.startsWith("editor-") && e.classList.remove(t);
|
|
1146
|
+
e.classList.length === 0 && e.removeAttribute("class");
|
|
1147
|
+
}
|
|
1148
|
+
let n = !0;
|
|
1149
|
+
for (; n;) {
|
|
1150
|
+
n = !1;
|
|
1151
|
+
for (let e of Array.from(t.body.querySelectorAll("span, b, i"))) {
|
|
1152
|
+
if (e.attributes.length > 0) continue;
|
|
1153
|
+
let t = e.tagName.toLowerCase();
|
|
1154
|
+
if (t === "span") {
|
|
1155
|
+
Fn(e), n = !0;
|
|
1156
|
+
continue;
|
|
1157
|
+
}
|
|
1158
|
+
if (e.childElementCount !== 1 || e.childNodes.length !== 1) continue;
|
|
1159
|
+
let r = e.firstElementChild;
|
|
1160
|
+
(t === "b" && r?.tagName === "STRONG" || t === "i" && r?.tagName === "EM") && (Fn(e), n = !0);
|
|
1161
|
+
}
|
|
1162
|
+
}
|
|
1163
|
+
return t.body.innerHTML;
|
|
1164
|
+
};
|
|
1165
|
+
async function Ln(e) {
|
|
1166
|
+
if (!e.trim()) return e;
|
|
1167
|
+
let t = In(e);
|
|
1168
|
+
try {
|
|
1169
|
+
let [{ format: e }, n] = await Promise.all([import("prettier/standalone"), import("prettier/plugins/html")]);
|
|
1170
|
+
return (await e(t, {
|
|
1171
|
+
parser: "html",
|
|
1172
|
+
plugins: [n]
|
|
1173
|
+
})).trimEnd();
|
|
1174
|
+
} catch {
|
|
1175
|
+
return t;
|
|
1176
|
+
}
|
|
1177
|
+
}
|
|
1178
|
+
//#endregion
|
|
1179
|
+
//#region src/components/Editor/utils/writeHtmlSource.ts
|
|
1180
|
+
function Rn(e) {
|
|
1181
|
+
j().clear();
|
|
1182
|
+
let t = it("html");
|
|
1183
|
+
if (j().append(t), !e) return;
|
|
1184
|
+
t.select();
|
|
1185
|
+
let n = M();
|
|
1186
|
+
F(n) && n.insertRawText(e);
|
|
1187
|
+
}
|
|
1188
|
+
//#endregion
|
|
1189
|
+
//#region src/components/Editor/plugins/SourceModePlugin.tsx
|
|
1190
|
+
function zn({ children: e, maxLength: t, onMaxLengthExceed: n }) {
|
|
1191
|
+
let [r] = R(), [i, a] = O(!1), o = D(!1), s = D(n);
|
|
1192
|
+
s.current = n;
|
|
1193
|
+
let c = Mn(t) ? t : void 0, l = w(() => {
|
|
1194
|
+
if (o.current) return;
|
|
1195
|
+
let e = "", t = "";
|
|
1196
|
+
r.getEditorState().read(() => {
|
|
1197
|
+
t = j().getTextContent(), e = ve(r, null);
|
|
1198
|
+
}, { editor: r }), Ln(wn(e, t) ? "" : $(e)).then((e) => {
|
|
1199
|
+
o.current || (o.current = !0, a(!0), r.update(() => {
|
|
1200
|
+
Rn(e);
|
|
1201
|
+
}), r.dispatchCommand(Me, void 0));
|
|
1202
|
+
});
|
|
1203
|
+
}, [r]), u = w(() => {
|
|
1204
|
+
if (!o.current) return;
|
|
1205
|
+
let e = !1;
|
|
1206
|
+
o.current = !1, r.update(() => {
|
|
1207
|
+
Cn(r, $(j().getTextContent())), c !== void 0 && (e = Nn(r, c));
|
|
1208
|
+
}), a(!1), r.dispatchCommand(Me, void 0), e && s.current?.();
|
|
1209
|
+
}, [r, c]), d = w(() => {
|
|
1210
|
+
if (o.current) {
|
|
1211
|
+
u();
|
|
1212
|
+
return;
|
|
1213
|
+
}
|
|
1214
|
+
l();
|
|
1215
|
+
}, [l, u]);
|
|
1216
|
+
T(() => {
|
|
1217
|
+
let e = (e) => {
|
|
1218
|
+
if (!o.current) return !1;
|
|
1219
|
+
let t = "clipboardData" in e ? e.clipboardData : "dataTransfer" in e ? e.dataTransfer : null;
|
|
1220
|
+
if (!t) return !1;
|
|
1221
|
+
e.preventDefault();
|
|
1222
|
+
let n = t.getData("text/html") || t.getData("text/plain");
|
|
1223
|
+
if (!n) return !0;
|
|
1224
|
+
let i = $(n);
|
|
1225
|
+
return r.update(() => {
|
|
1226
|
+
let e = M();
|
|
1227
|
+
F(e) && i && e.insertRawText(i);
|
|
1228
|
+
}, { tag: Ue }), !0;
|
|
1229
|
+
};
|
|
1230
|
+
return Xe(r.registerNodeTransform(We, () => {
|
|
1231
|
+
if (!o.current) return;
|
|
1232
|
+
let e = j(), t = e.getChildrenSize() === 1 ? e.getFirstChild() : null;
|
|
1233
|
+
U(t) && t.getLanguage() === "html" || Rn(e.getTextContent());
|
|
1234
|
+
}), r.registerCommand(He, e, Ne), r.registerCommand(Ie, e, Ne));
|
|
1235
|
+
}, [r]);
|
|
1236
|
+
let f = E(() => ({
|
|
1237
|
+
isSourceMode: i,
|
|
1238
|
+
isSourceModeRef: o,
|
|
1239
|
+
toggleSourceMode: d
|
|
1240
|
+
}), [i, d]);
|
|
1241
|
+
return /* @__PURE__ */ S(g.Provider, {
|
|
1242
|
+
value: f,
|
|
1243
|
+
children: e
|
|
1244
|
+
});
|
|
1245
|
+
}
|
|
1246
|
+
//#endregion
|
|
1247
|
+
//#region src/components/Editor/plugins/HeadingPlugin.tsx
|
|
1248
|
+
function Bn(e) {
|
|
1249
|
+
let t = e.getTag();
|
|
1250
|
+
if (t === "h4" || t === "h5" || t === "h6") {
|
|
1251
|
+
e.replace(Se(), !0);
|
|
1252
|
+
return;
|
|
1253
|
+
}
|
|
1254
|
+
for (let t of e.getAllTextNodes()) {
|
|
1255
|
+
let e = t.getStyle();
|
|
1256
|
+
if (!e) continue;
|
|
1257
|
+
let n = Bt(e, "font-size");
|
|
1258
|
+
n !== e && t.setStyle(n);
|
|
1259
|
+
}
|
|
1260
|
+
}
|
|
1261
|
+
function Vn() {
|
|
1262
|
+
let [e] = R();
|
|
1263
|
+
return T(() => e.registerNodeTransform(yt, Bn), [e]), null;
|
|
1264
|
+
}
|
|
1265
|
+
//#endregion
|
|
1266
|
+
//#region src/components/Editor/LengthBadge.tsx
|
|
1267
|
+
var Hn = ({ current: e, maxLength: t }) => {
|
|
1268
|
+
let n = e > t;
|
|
1269
|
+
return /* @__PURE__ */ C("div", {
|
|
1270
|
+
className: k(Y["bsy-lexical-editor__length-badge"], n && Y["bsy-lexical-editor__length-badge--exceeded"]),
|
|
1271
|
+
"aria-live": "polite",
|
|
1272
|
+
children: [
|
|
1273
|
+
e,
|
|
1274
|
+
"/",
|
|
1275
|
+
t
|
|
1276
|
+
]
|
|
1277
|
+
});
|
|
1278
|
+
};
|
|
1279
|
+
Hn.displayName = "BsyLexicalEditorLengthBadge";
|
|
1280
|
+
//#endregion
|
|
920
1281
|
//#region src/components/Editor/EditorCore.tsx
|
|
921
|
-
var
|
|
922
|
-
let { height: t = 126, onChange: n, toolbar: r, theme: i, maxLength: a, onMaxLengthExceed: o } = e, [s] =
|
|
923
|
-
|
|
924
|
-
let
|
|
925
|
-
containerRef:
|
|
926
|
-
toolbarRef:
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
u.current = i, f !== void 0 && m(t.length), n({
|
|
1282
|
+
var Un = (e) => {
|
|
1283
|
+
let { height: t = 126, onChange: n, toolbar: r, theme: i, maxLength: a, onMaxLengthExceed: o } = e, [s] = R(), { isSourceMode: c, isSourceModeRef: l } = y(), u = D(null), d = D(null), f = D(null), p = D(o);
|
|
1284
|
+
p.current = o;
|
|
1285
|
+
let m = Mn(a) ? a : void 0, [h, g] = O(0), _ = r?.mode === "floating", v = m !== void 0 && !c, b = E(() => ({
|
|
1286
|
+
containerRef: u,
|
|
1287
|
+
toolbarRef: d
|
|
1288
|
+
}), []), x = w((e) => {
|
|
1289
|
+
l.current || e.read(() => {
|
|
1290
|
+
let t = j().getTextContent(), r = $(ve(s, null)), i = wn(r, t) ? null : r;
|
|
1291
|
+
f.current = i, m !== void 0 && g(t.length), n({
|
|
932
1292
|
text: t,
|
|
933
1293
|
html: i
|
|
934
1294
|
}, e);
|
|
@@ -936,80 +1296,104 @@ var qt = (e) => {
|
|
|
936
1296
|
}, [
|
|
937
1297
|
n,
|
|
938
1298
|
s,
|
|
939
|
-
|
|
1299
|
+
m,
|
|
1300
|
+
l
|
|
940
1301
|
]);
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
1302
|
+
T(() => {
|
|
1303
|
+
m === void 0 || c || s.getEditorState().read(() => {
|
|
1304
|
+
g(j().getTextContentSize());
|
|
944
1305
|
}, { editor: s });
|
|
945
|
-
}, [
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
1306
|
+
}, [
|
|
1307
|
+
s,
|
|
1308
|
+
m,
|
|
1309
|
+
c
|
|
1310
|
+
]), T(() => {
|
|
1311
|
+
if (e.value === void 0 || e.value === f.current) return;
|
|
1312
|
+
if (l.current) {
|
|
1313
|
+
let t = e.value?.trim() ? $(e.value) : "", n = e.value;
|
|
1314
|
+
Ln(t).then((e) => {
|
|
1315
|
+
!l.current || f.current !== n || s.update(() => {
|
|
1316
|
+
Rn(e);
|
|
1317
|
+
});
|
|
1318
|
+
}), f.current = e.value;
|
|
1319
|
+
return;
|
|
951
1320
|
}
|
|
1321
|
+
let t = !1;
|
|
1322
|
+
s.update(() => {
|
|
1323
|
+
Cn(s, e.value?.trim() ? $(e.value) : ""), m !== void 0 && (t = Nn(s, m));
|
|
1324
|
+
}), t && p.current?.();
|
|
952
1325
|
}, [
|
|
953
1326
|
e.value,
|
|
954
1327
|
s,
|
|
955
|
-
|
|
1328
|
+
m,
|
|
1329
|
+
l
|
|
956
1330
|
]);
|
|
957
|
-
let
|
|
958
|
-
return /* @__PURE__ */
|
|
959
|
-
value:
|
|
960
|
-
children: /* @__PURE__ */
|
|
961
|
-
ref:
|
|
962
|
-
className:
|
|
1331
|
+
let ee = r?.config?.length ? r?.config : [], te = bt();
|
|
1332
|
+
return /* @__PURE__ */ S(kt.Provider, {
|
|
1333
|
+
value: b,
|
|
1334
|
+
children: /* @__PURE__ */ C("div", {
|
|
1335
|
+
ref: u,
|
|
1336
|
+
className: k(Y["bsy-lexical-editor"], _ && Y["bsy-lexical-editor--floating"]),
|
|
963
1337
|
onClick: (e) => {
|
|
964
1338
|
let t = s.getRootElement(), n = e.target;
|
|
965
1339
|
!t || !n || !t.contains(n) || s.isEditable() || s.setEditable(!0);
|
|
966
1340
|
},
|
|
967
1341
|
children: [
|
|
968
|
-
|
|
969
|
-
config:
|
|
1342
|
+
ee.length > 0 && /* @__PURE__ */ S(Rt, {
|
|
1343
|
+
config: ee,
|
|
970
1344
|
theme: i?.toolbar,
|
|
971
1345
|
style: r?.style,
|
|
972
1346
|
mode: r?.mode,
|
|
973
1347
|
floating: r?.floating
|
|
974
1348
|
}),
|
|
975
|
-
/* @__PURE__ */
|
|
976
|
-
contentEditable: /* @__PURE__ */
|
|
977
|
-
className:
|
|
1349
|
+
/* @__PURE__ */ S(pe, {
|
|
1350
|
+
contentEditable: /* @__PURE__ */ S(me, {
|
|
1351
|
+
className: k(Y["bsy-lexical-editor__content-editable"], v && Y["bsy-lexical-editor__content-editable--with-length-badge"]),
|
|
978
1352
|
style: {
|
|
979
1353
|
height: t,
|
|
980
|
-
cursor:
|
|
1354
|
+
cursor: te ? "auto" : "text"
|
|
981
1355
|
}
|
|
982
1356
|
}),
|
|
983
|
-
ErrorBoundary:
|
|
1357
|
+
ErrorBoundary: _e
|
|
984
1358
|
}),
|
|
985
|
-
/* @__PURE__ */
|
|
986
|
-
/* @__PURE__ */
|
|
987
|
-
/* @__PURE__ */
|
|
988
|
-
/* @__PURE__ */
|
|
989
|
-
/* @__PURE__ */
|
|
990
|
-
/* @__PURE__ */
|
|
991
|
-
/* @__PURE__ */
|
|
992
|
-
|
|
993
|
-
|
|
1359
|
+
/* @__PURE__ */ S(xt, {}),
|
|
1360
|
+
/* @__PURE__ */ S(St, {}),
|
|
1361
|
+
/* @__PURE__ */ S(Ht, {}),
|
|
1362
|
+
/* @__PURE__ */ S(Vn, {}),
|
|
1363
|
+
/* @__PURE__ */ S(Jt, {}),
|
|
1364
|
+
/* @__PURE__ */ S(Zt, {}),
|
|
1365
|
+
/* @__PURE__ */ S(Qt, {}),
|
|
1366
|
+
/* @__PURE__ */ S(gn, {}),
|
|
1367
|
+
/* @__PURE__ */ S(_n, {}),
|
|
1368
|
+
/* @__PURE__ */ S(yn, {}),
|
|
1369
|
+
v ? /* @__PURE__ */ S(bn, {
|
|
1370
|
+
maxLength: m,
|
|
994
1371
|
onMaxLengthExceed: o
|
|
995
|
-
}),
|
|
996
|
-
/* @__PURE__ */
|
|
997
|
-
/* @__PURE__ */
|
|
998
|
-
|
|
999
|
-
current:
|
|
1000
|
-
maxLength:
|
|
1001
|
-
})
|
|
1372
|
+
}) : null,
|
|
1373
|
+
/* @__PURE__ */ S(he, {}),
|
|
1374
|
+
/* @__PURE__ */ S(ge, { onChange: x }),
|
|
1375
|
+
v ? /* @__PURE__ */ S(Hn, {
|
|
1376
|
+
current: h,
|
|
1377
|
+
maxLength: m
|
|
1378
|
+
}) : null
|
|
1002
1379
|
]
|
|
1003
1380
|
})
|
|
1004
1381
|
});
|
|
1005
|
-
}
|
|
1006
|
-
|
|
1382
|
+
}, Wn = (e) => /* @__PURE__ */ S(zn, {
|
|
1383
|
+
maxLength: e.maxLength,
|
|
1384
|
+
onMaxLengthExceed: e.onMaxLengthExceed,
|
|
1385
|
+
children: /* @__PURE__ */ S(Un, { ...e })
|
|
1386
|
+
});
|
|
1387
|
+
Wn.displayName = "BsyLexicalEditorCore";
|
|
1007
1388
|
//#endregion
|
|
1008
|
-
//#region src/components/Editor/
|
|
1009
|
-
var
|
|
1389
|
+
//#region src/components/Editor/htmlConfig.ts
|
|
1390
|
+
var Gn = "1px solid #d9d9d9", Kn = { export: new Map([[q, (e, t) => {
|
|
1391
|
+
let n = t.exportDOM(e);
|
|
1392
|
+
return Ge(n.element) && (n.element.style.border = Gn), n;
|
|
1393
|
+
}]]) }, qn = (e) => {
|
|
1010
1394
|
let { autoFocus: t = !1 } = e;
|
|
1011
|
-
return /* @__PURE__ */
|
|
1012
|
-
initialConfig:
|
|
1395
|
+
return /* @__PURE__ */ S(fe, {
|
|
1396
|
+
initialConfig: E(() => ({
|
|
1013
1397
|
namespace: "bsyLexicalEditor",
|
|
1014
1398
|
onError: (e) => {
|
|
1015
1399
|
console.error("Lexical error", e);
|
|
@@ -1026,30 +1410,49 @@ var Jt = (e) => {
|
|
|
1026
1410
|
list: {
|
|
1027
1411
|
ul: "editor-list-ul",
|
|
1028
1412
|
ol: "editor-list-ol",
|
|
1029
|
-
listitem: "editor-listitem"
|
|
1413
|
+
listitem: "editor-listitem",
|
|
1414
|
+
nested: { listitem: "editor-nested-listitem" }
|
|
1415
|
+
},
|
|
1416
|
+
heading: {
|
|
1417
|
+
h1: "editor-heading-h1",
|
|
1418
|
+
h2: "editor-heading-h2",
|
|
1419
|
+
h3: "editor-heading-h3",
|
|
1420
|
+
h4: "editor-heading-h4",
|
|
1421
|
+
h5: "editor-heading-h5",
|
|
1422
|
+
h6: "editor-heading-h6"
|
|
1030
1423
|
},
|
|
1031
1424
|
code: "editor-code",
|
|
1032
|
-
link: "editor-link"
|
|
1425
|
+
link: "editor-link",
|
|
1426
|
+
table: "editor-table",
|
|
1427
|
+
tableCell: "editor-table-cell",
|
|
1428
|
+
tableCellHeader: "editor-table-cell-header",
|
|
1429
|
+
tableRow: "editor-table-row",
|
|
1430
|
+
tableScrollableWrapper: "editor-table-scrollable-wrapper"
|
|
1033
1431
|
},
|
|
1432
|
+
html: Kn,
|
|
1034
1433
|
nodes: [
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1434
|
+
$e,
|
|
1435
|
+
Qe,
|
|
1436
|
+
nt,
|
|
1437
|
+
tt,
|
|
1438
|
+
yt,
|
|
1439
|
+
G,
|
|
1440
|
+
W,
|
|
1441
|
+
ft,
|
|
1442
|
+
pt,
|
|
1042
1443
|
q,
|
|
1444
|
+
Wt,
|
|
1445
|
+
X,
|
|
1043
1446
|
{
|
|
1044
|
-
replace:
|
|
1045
|
-
with: (e) => new
|
|
1046
|
-
withKlass:
|
|
1447
|
+
replace: L,
|
|
1448
|
+
with: (e) => new X(e.__text),
|
|
1449
|
+
withKlass: X
|
|
1047
1450
|
}
|
|
1048
1451
|
]
|
|
1049
1452
|
}), [t]),
|
|
1050
|
-
children: /* @__PURE__ */
|
|
1453
|
+
children: /* @__PURE__ */ S(Wn, { ...e })
|
|
1051
1454
|
});
|
|
1052
1455
|
};
|
|
1053
|
-
|
|
1456
|
+
qn.displayName = "BsyLexicalEditor";
|
|
1054
1457
|
//#endregion
|
|
1055
|
-
export {
|
|
1458
|
+
export { Ee as $getRoot, b as BaseButton, qn as default, v as listRegisteredToolbarButtons, f as registerToolbarButton, a as unregisterToolbarButton, qe as useLexicalComposerContext };
|