@baishuyun/ui-base 6.10.0 → 6.10.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Amap/{Amap-BNnmSPnl.js → Amap-BLSziesG.js} +1 -1
- package/dist/Amap/AmapCircle/index.js +4 -4
- package/dist/Amap/{AmapCircle-BDW6pnNR.js → AmapCircle-2qupysHe.js} +1 -1
- package/dist/Amap/AmapMarker/index.js +5 -5
- package/dist/Amap/{AmapMarker-CdoPWdff.js → AmapMarker-xEqoVnFR.js} +2 -2
- package/dist/Amap/AmapMarkerCluster/index.js +5 -5
- package/dist/Amap/{AmapMarkerCluster-CSIxiVC5.js → AmapMarkerCluster-CvEQa3o9.js} +2 -2
- package/dist/Amap/AmapProvider/index.js +6 -5
- package/dist/Amap/{AmapProvider-Cwi6WOe0.js → AmapProvider-DqFp3DZ5.js} +2 -2
- package/dist/Amap/hooks/index.js +3 -3
- package/dist/Amap/{hooks-DAN31s_-.js → hooks-BTcFpdd0.js} +1 -1
- package/dist/Amap/index.js +12 -11
- package/dist/Calendar/{AllDaySection-DNsVyixx.js → AllDaySection-BqbcPQls.js} +3 -3
- package/dist/Calendar/{Calendar-DL2X3z_z.js → Calendar-gEtuBW7Y.js} +12 -13
- package/dist/Calendar/{CurrentTimeIndicator-twXtFHIp.js → CurrentTimeIndicator-dRYot1Rk.js} +24 -18
- package/dist/Calendar/{EventCard-CvEnWcKd.js → EventCard-Di5UX4pB.js} +3 -4
- package/dist/Calendar/{TimeGrid-D62R57Bo.js → TimeGrid-CBpDFAM4.js} +1 -1
- package/dist/Calendar/context/index.js +2 -2
- package/dist/Calendar/index.js +21 -20
- package/dist/Calendar/subcomponents/AllDaySection/index.js +8 -7
- package/dist/Calendar/subcomponents/CurrentTimeIndicator/index.js +6 -5
- package/dist/Calendar/subcomponents/EventCard/index.js +7 -6
- package/dist/Calendar/subcomponents/TimeAxis/index.js +4 -4
- package/dist/Calendar/subcomponents/TimeGrid/index.js +4 -3
- package/dist/Calendar/{theme-BRVmxhqD.js → theme-i60ueO92.js} +2 -2
- package/dist/Calendar/utils/index.js +4 -4
- package/dist/Calendar/utils/layout/index.js +3 -3
- package/dist/Calendar/utils/theme/index.js +2 -2
- package/dist/Card/index.js +2 -2
- package/dist/CheckBox/{CheckBox-CcM19LnP.js → CheckBox-nBm0u6zX.js} +1 -1
- package/dist/CheckBox/index.js +3 -3
- package/dist/ColorPicker/ColorPicker-CYlrnMwM.js +174 -0
- package/dist/ColorPicker/index.js +7 -6
- package/dist/ConfigProvider/index.js +4 -3
- package/dist/DatePicker/DatePicker-CagGt_f0.js +101 -0
- package/dist/DatePicker/{DatePickerPanel-Bz3uvbYF.js → DatePickerPanel-CaDZzxMD.js} +5 -5
- package/dist/DatePicker/index.js +10 -9
- package/dist/DatePicker/style/index.js +2 -2
- package/dist/DatePicker/{style-BwmM26RP.js → style-UKXn1N_p.js} +1 -1
- package/dist/DropDown/DropDown-CLuQf970.js +178 -0
- package/dist/DropDown/index.js +11 -10
- package/dist/DropDown/style/index.js +2 -2
- package/dist/DropDown/{style-BSgosymi.js → style-LLDVPpPa.js} +1 -1
- package/dist/Editor/Buttons-ByO5rS19.js +937 -0
- package/dist/Editor/ToolbarPlugin/Buttons/index.js +17 -16
- package/dist/Editor/constants/index.js +3 -3
- package/dist/Editor/index.js +593 -238
- package/dist/Gantt/GanttChart/index.js +18 -17
- package/dist/Gantt/{GanttChart-6gpw5vi6.js → GanttChart-DvCAp8Dk.js} +8 -10
- package/dist/Gantt/GanttTable/index.js +11 -11
- package/dist/Gantt/{GanttTable-lVu-YUtt.js → GanttTable-DyVJOVo3.js} +5 -5
- package/dist/Gantt/GanttToolBar/index.js +14 -13
- package/dist/Gantt/{GanttToolBar-CarBWZg-.js → GanttToolBar-CxT68kmT.js} +3 -4
- package/dist/Gantt/{collapseKeys-_ShTXPKt.js → collapseKeys-B4SOVHjd.js} +2 -2
- package/dist/Gantt/index.js +26 -25
- package/dist/Gantt/{theme-CiMD9Y6i.js → theme-2LyXJRDe.js} +1 -1
- package/dist/Gantt/{timelineViewConfig-CLIpppp0.js → timelineViewConfig-9HArvbmb.js} +1 -1
- package/dist/Gantt/utils/index.js +6 -6
- package/dist/Gantt/utils/theme/index.js +2 -2
- package/dist/Icon/index.js +1 -1
- package/dist/InputTag/{InputTag-DxPO0DwD.js → InputTag-yRPO90Ku.js} +2 -2
- package/dist/InputTag/index.js +5 -5
- package/dist/Loading/{Loading-CVyzO5-s.js → Loading-BF_dtuLc.js} +1 -1
- package/dist/Loading/index.js +4 -4
- package/dist/Modal/Modal-Cb7Msq26.js +96 -0
- package/dist/Modal/index.js +3 -2
- package/dist/NotFoundContent/index.js +2 -2
- package/dist/Overlay/OverlayContext-CVSFoyqN.js +23 -0
- package/dist/Overlay/index.js +3 -0
- package/dist/Radio/index.js +2 -2
- package/dist/ScrollBar/{ScrollBar-CnwYQfXM.js → ScrollBar-N2pOLv-8.js} +1 -1
- package/dist/ScrollBar/index.js +2 -2
- package/dist/Segmented/{Segmented-Ck2ZmfF7.js → Segmented-BCQRrc65.js} +1 -1
- package/dist/Segmented/index.js +2 -2
- package/dist/Select/Select-iwzfNy9d.js +753 -0
- package/dist/Select/{SelectInputSearch-CrGW_eVo.js → SelectInputSearch-Bc_aPNbG.js} +1 -1
- package/dist/Select/index.js +14 -13
- package/dist/Table/{Table-CL-KfNY3.js → Table-Cm8zFl2G.js} +5 -5
- package/dist/Table/hooks/index.js +2 -2
- package/dist/Table/{hooks-uCDY9dqx.js → hooks-BceUZQQm.js} +1 -1
- package/dist/Table/index.js +8 -8
- package/dist/Table/{processRowspan-nIGqGyHh.js → processRowspan-B0WELhG2.js} +1 -1
- package/dist/Table/style/index.js +2 -2
- package/dist/Table/{style-x9xfw6te.js → style-C4wp0IOM.js} +1 -1
- package/dist/Table/utils/index.js +2 -2
- package/dist/Tabs/Tabs-BPWRIwtD.js +413 -0
- package/dist/Tabs/index.js +6 -5
- package/dist/Tooltip/Tooltip-Bb3Jx-If.js +172 -0
- package/dist/Tooltip/index.js +3 -2
- package/dist/Tree/index.js +4 -4
- package/dist/Tree/utils/index.js +1 -1
- package/dist/components/ColorPicker/ColorPalettes.d.ts +2 -0
- package/dist/components/ColorPicker/ColorPicker.type.d.ts +1 -7
- package/dist/components/ConfigProvider/ConfigProvider.type.d.ts +2 -0
- package/dist/components/DatePicker/interface.d.ts +2 -0
- package/dist/components/Editor/ToolbarPlugin/Buttons/BulletListButton.d.ts +2 -0
- package/dist/components/Editor/ToolbarPlugin/Buttons/CodeButton.d.ts +2 -0
- package/dist/components/Editor/ToolbarPlugin/Buttons/CodeLanguageButton.d.ts +2 -0
- package/dist/components/Editor/ToolbarPlugin/Buttons/IndentButton.d.ts +2 -0
- package/dist/components/Editor/ToolbarPlugin/Buttons/NumberListButton.d.ts +2 -0
- package/dist/components/Editor/ToolbarPlugin/Buttons/OutdentButton.d.ts +2 -0
- package/dist/components/Editor/ToolbarPlugin/Buttons/RedoButton.d.ts +2 -0
- package/dist/components/Editor/ToolbarPlugin/Buttons/StrikeThroughButton.d.ts +2 -0
- package/dist/components/Editor/ToolbarPlugin/Buttons/SubscriptButton.d.ts +2 -0
- package/dist/components/Editor/ToolbarPlugin/Buttons/SuperscriptButton.d.ts +2 -0
- package/dist/components/Editor/ToolbarPlugin/Buttons/UndoButton.d.ts +2 -0
- package/dist/components/Editor/ToolbarPlugin/Buttons/index.d.ts +10 -0
- package/dist/components/Editor/ToolbarPlugin/context/HistoryStateProvider.d.ts +8 -0
- package/dist/components/Editor/ToolbarPlugin/context/TextFormatsContext.d.ts +8 -1
- package/dist/components/Editor/ToolbarPlugin/icons/ToolbarIcon.d.ts +13 -0
- package/dist/components/Editor/constants/codeLanguages.d.ts +69 -0
- package/dist/components/Editor/constants/index.d.ts +2 -0
- package/dist/components/Editor/plugins/CodeHighlightPlugin.d.ts +1 -0
- package/dist/components/Editor/plugins/PasteStripImagePlugin.d.ts +1 -0
- package/dist/components/Editor/utils/codeHighlighter.d.ts +12 -0
- package/dist/components/Editor/utils/formatTruncatedFilename.d.ts +4 -0
- package/dist/components/Editor/utils/stripImagesFromHtml.d.ts +1 -0
- package/dist/components/Overlay/OverlayContext.d.ts +16 -0
- package/dist/components/Overlay/index.d.ts +2 -0
- package/dist/components/Tooltip/Tooltip.type.d.ts +1 -1
- package/dist/components/index.d.ts +2 -0
- package/dist/index.js +53 -51
- package/dist/locale/lang/en-US.json.d.ts +14 -2
- package/dist/locale/lang/zh-CN.json.d.ts +14 -2
- package/dist/locale/lang/zh-TW.json.d.ts +14 -2
- package/dist/style.css +1 -1
- package/dist/vendors/{ConfigProvider-DxrZpdIb.js → ConfigProvider-vPuwReNX.js} +70 -36
- package/dist/vendors/{LocaleContext-Dcw6C1LX.js → LocaleContext-CN9doEXT.js} +14 -2
- package/dist/vendors/{Tree-D1s-eADo.js → Tree-B09frqQX.js} +3 -2
- package/dist/vendors/{useLocale-BKZX2_zw.js → useLocale-sawv8CEL.js} +1 -1
- package/dist/vendors/{version-L-kG2La0.js → version-DdQLttdL.js} +1 -1
- package/package.json +7 -1
- package/dist/ColorPicker/ColorPicker-D3JuQ7a7.js +0 -153
- package/dist/DatePicker/DatePicker-Dah_CjYG.js +0 -96
- package/dist/DropDown/DropDown-Daxr9BYf.js +0 -171
- package/dist/Editor/Buttons-DG_-Sg_C.js +0 -600
- package/dist/Modal/Modal-LiztSF7x.js +0 -92
- package/dist/Select/Select-CBI5PgeQ.js +0 -746
- package/dist/Tabs/Tabs-B1RsYb2W.js +0 -409
- package/dist/Tooltip/Tooltip-DWWWYn1a.js +0 -168
- /package/dist/Amap/{AmapContext-D7Njjm5a.js → AmapContext-CJBe6lld.js} +0 -0
- /package/dist/Amap/{useMarkerInfoWindowController-BQmhR0N7.js → useMarkerInfoWindowController-Cjx0xQXw.js} +0 -0
- /package/dist/Calendar/{TimeAxis-D7bgZDKs.js → TimeAxis-C9e2BdYs.js} +0 -0
- /package/dist/Calendar/{colorUtils-lXNjGoCk.js → colorUtils-CBLTsDX0.js} +0 -0
- /package/dist/Calendar/{context-CBJnz0IH.js → context-4tCN5X33.js} +0 -0
- /package/dist/Calendar/{layout-BglMom3m.js → layout-Dz-grtu9.js} +0 -0
- /package/dist/Card/{Card-CtKLNh3n.js → Card-Ds5Rpq--.js} +0 -0
- /package/dist/CheckBox/{CheckBox-Bb0UuX1Y.js → CheckBox-ByWSy9Yr.js} +0 -0
- /package/dist/DatePicker/{ensureDayjsPlugins-CVL-fnAl.js → ensureDayjsPlugins-Cn9Bkjkj.js} +0 -0
- /package/dist/DatePicker/{pickerLocale-BeMlfhKu.js → pickerLocale-BRnNjLcv.js} +0 -0
- /package/dist/Gantt/{GanttHighlightContext-grda5bhd.js → GanttHighlightContext-ChThr8ia.js} +0 -0
- /package/dist/Gantt/{columnResize-DV1tSBx_.js → columnResize-jG0Wy2PC.js} +0 -0
- /package/dist/Gantt/{constants-BObDP0h6.js → constants-LIz5jwed.js} +0 -0
- /package/dist/Gantt/{highlightTarget-DrP0_NrM.js → highlightTarget-BpkYTonb.js} +0 -0
- /package/dist/NotFoundContent/{NotFoundContent-J-TEnljc.js → NotFoundContent-BLmzWNBi.js} +0 -0
- /package/dist/Radio/{Radio-CBUZ7DB5.js → Radio-CX9cUqb7.js} +0 -0
- /package/dist/Table/{constants-CcwjDbe7.js → constants-kRpjsoet.js} +0 -0
- /package/dist/vendors/{animations-Mlw78WYo.js → animations-rwUbyoT0.js} +0 -0
- /package/dist/vendors/{cssVars-B8o94Yao.js → cssVars-l4-kP_14.js} +0 -0
- /package/dist/vendors/{mergeRefs-Bai1cIzv.js → mergeRefs-TiJ0xjUN.js} +0 -0
- /package/dist/vendors/{useFloatingOverlay-BApqkHSu.js → useFloatingOverlay-B3M9k8nj.js} +0 -0
- /package/dist/vendors/{useFloatingPortal-C8V67X0v.js → useFloatingPortal-CmVJbuRm.js} +0 -0
- /package/dist/vendors/{useLatchedPopupPortalRoot-hwf14FJ5.js → useLatchedPopupPortalRoot-4fVhqVT4.js} +0 -0
package/dist/Editor/index.js
CHANGED
|
@@ -1,56 +1,61 @@
|
|
|
1
|
-
import "../vendors/version-
|
|
1
|
+
import "../vendors/version-DdQLttdL.js";
|
|
2
2
|
import "../ScrollBar/style-D26azwz6.js";
|
|
3
|
-
import "../Icon/Icon-BBDcb-yw.js";
|
|
4
|
-
import "../vendors/LocaleContext-
|
|
5
|
-
import "../
|
|
6
|
-
import "../
|
|
7
|
-
import "../
|
|
8
|
-
import "../vendors/
|
|
9
|
-
import "../vendors/
|
|
10
|
-
import
|
|
11
|
-
import "../
|
|
12
|
-
import "../
|
|
13
|
-
import "../CheckBox/CheckBox-
|
|
14
|
-
import "../
|
|
15
|
-
import "../
|
|
16
|
-
import "../
|
|
17
|
-
import "../
|
|
18
|
-
import "../DropDown/
|
|
19
|
-
import
|
|
20
|
-
import {
|
|
21
|
-
import {
|
|
22
|
-
import {
|
|
23
|
-
import
|
|
24
|
-
import w from "
|
|
25
|
-
import
|
|
26
|
-
import {
|
|
27
|
-
import {
|
|
28
|
-
import {
|
|
29
|
-
import {
|
|
30
|
-
import {
|
|
31
|
-
import {
|
|
32
|
-
import {
|
|
33
|
-
import {
|
|
34
|
-
import { $
|
|
35
|
-
import {
|
|
36
|
-
import { $
|
|
37
|
-
import {
|
|
38
|
-
import {
|
|
3
|
+
import { t as e } from "../Icon/Icon-BBDcb-yw.js";
|
|
4
|
+
import "../vendors/LocaleContext-CN9doEXT.js";
|
|
5
|
+
import "../Overlay/OverlayContext-CVSFoyqN.js";
|
|
6
|
+
import "../Modal/Modal-Cb7Msq26.js";
|
|
7
|
+
import "../ColorPicker/ColorPicker-CYlrnMwM.js";
|
|
8
|
+
import "../vendors/useFloatingOverlay-B3M9k8nj.js";
|
|
9
|
+
import { t } from "../vendors/useLocale-sawv8CEL.js";
|
|
10
|
+
import "../vendors/useLatchedPopupPortalRoot-4fVhqVT4.js";
|
|
11
|
+
import { t as n } from "../vendors/cssVars-l4-kP_14.js";
|
|
12
|
+
import "../Select/SelectInputSearch-Bc_aPNbG.js";
|
|
13
|
+
import "../CheckBox/CheckBox-ByWSy9Yr.js";
|
|
14
|
+
import "../CheckBox/CheckBox-nBm0u6zX.js";
|
|
15
|
+
import "../NotFoundContent/NotFoundContent-BLmzWNBi.js";
|
|
16
|
+
import "../ScrollBar/ScrollBar-N2pOLv-8.js";
|
|
17
|
+
import "../vendors/useFloatingPortal-CmVJbuRm.js";
|
|
18
|
+
import { t as r } from "../DropDown/DropDown-CLuQf970.js";
|
|
19
|
+
import "../DropDown/style-LLDVPpPa.js";
|
|
20
|
+
import { _ as i, a, c as o, d as s, f as c, g as l, h as u, i as d, l as f, m as p, n as m, o as h, p as g, r as _, s as ee, u as v, v as y, y as te } from "./Buttons-ByO5rS19.js";
|
|
21
|
+
import { DEFAULT_BACKGROUND_COLOR as ne, DEFAULT_FONT_COLOR as re, DEFAULT_FONT_SIZE as ie } from "./constants/index.js";
|
|
22
|
+
import { omit as ae } from "lodash-es";
|
|
23
|
+
import { Fragment as oe, jsx as b, jsxs as x } from "react/jsx-runtime";
|
|
24
|
+
import se, { useCallback as S, useEffect as C, useMemo as w, useRef as T, useState as E } from "react";
|
|
25
|
+
import D from "clsx";
|
|
26
|
+
import { AnimatePresence as ce, motion as le, useReducedMotion as ue } from "motion/react";
|
|
27
|
+
import { LexicalComposer as de } from "@lexical/react/LexicalComposer";
|
|
28
|
+
import { RichTextPlugin as fe } from "@lexical/react/LexicalRichTextPlugin";
|
|
29
|
+
import { ContentEditable as pe } from "@lexical/react/LexicalContentEditable";
|
|
30
|
+
import { HistoryPlugin as me } from "@lexical/react/LexicalHistoryPlugin";
|
|
31
|
+
import { OnChangePlugin as he } from "@lexical/react/LexicalOnChangePlugin";
|
|
32
|
+
import { LexicalErrorBoundary as ge } from "@lexical/react/LexicalErrorBoundary";
|
|
33
|
+
import { $generateHtmlFromNodes as _e, $generateNodesFromDOM as ve } from "@lexical/html";
|
|
34
|
+
import { $applyNodeReplacement as ye, $createLineBreakNode as be, $createParagraphNode as xe, $createTabNode as Se, $createTextNode as Ce, $getNodeByKey as O, $getRoot as we, $getRoot as k, $getSelection as A, $insertNodes as j, $isElementNode as Te, $isLineBreakNode as M, $isRangeSelection as N, $isRootOrShadowRoot as Ee, $isTabNode as De, $isTextNode as Oe, $onUpdate as ke, COMMAND_PRIORITY_EDITOR as Ae, COMMAND_PRIORITY_HIGH as je, COMMAND_PRIORITY_LOW as Me, DROP_COMMAND as Ne, DecoratorNode as Pe, KEY_ENTER_COMMAND as Fe, PASTE_COMMAND as Ie, PASTE_TAG as Le, RootNode as Re, TextNode as P, mergeRegister as ze } from "lexical";
|
|
35
|
+
import { useLexicalComposerContext as Be, useLexicalComposerContext as F } from "@lexical/react/LexicalComposerContext";
|
|
36
|
+
import { $getSelectionStyleValueForProperty as I, $patchStyleText as Ve, $trimTextContentFromAnchor as L } from "@lexical/selection";
|
|
37
|
+
import { $findMatchingParent as R, $restoreEditorState as He, mergeRegister as Ue } from "@lexical/utils";
|
|
38
|
+
import { $isLinkNode as We, AutoLinkNode as Ge, LinkNode as Ke } from "@lexical/link";
|
|
39
|
+
import { $isListItemNode as z, $isListNode as qe, ListItemNode as Je, ListNode as Ye } from "@lexical/list";
|
|
40
|
+
import { $createCodeHighlightNode as Xe, $isCodeHighlightNode as B, $isCodeNode as V, $plainifyCodeContent as Ze, CodeHighlightNode as H, CodeNode as U, registerCodeIndentation as Qe } from "@lexical/code-core";
|
|
41
|
+
import { useLexicalEditable as $e } from "@lexical/react/useLexicalEditable";
|
|
42
|
+
import { LinkPlugin as et } from "@lexical/react/LexicalLinkPlugin";
|
|
43
|
+
import { ListPlugin as tt } from "@lexical/react/LexicalListPlugin";
|
|
39
44
|
//#region src/components/Editor/utils/resolveEditorToolbarThemeVars.ts
|
|
40
|
-
var
|
|
45
|
+
var W = (e) => {
|
|
41
46
|
if (!(e === void 0 || e === "")) return typeof e == "number" ? `${e}px` : e;
|
|
42
|
-
},
|
|
43
|
-
if (!
|
|
44
|
-
let
|
|
45
|
-
return
|
|
46
|
-
},
|
|
47
|
+
}, nt = (e) => {
|
|
48
|
+
if (!e) return {};
|
|
49
|
+
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", W(e.gap)), n(t, "--bsy-editor-toolbar-group-gap", W(e.groupGap)), n(t, "--bsy-editor-toolbar-divider-color", e.dividerColor), n(t, "--bsy-editor-toolbar-divider-size", W(e.dividerSize)), n(t, "--bsy-editor-toolbar-divider-margin", W(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", W(e.itemPadding)), n(t, "--bsy-editor-toolbar-item-border-radius", W(e.itemBorderRadius)), n(t, "--bsy-editor-toolbar-icon-size", W(e.iconSize)), t;
|
|
51
|
+
}, rt = (e) => {
|
|
47
52
|
if (typeof e == "number" && Number.isFinite(e)) return e;
|
|
48
53
|
if (typeof e == "string") {
|
|
49
54
|
let t = Number.parseFloat(e);
|
|
50
55
|
if (Number.isFinite(t)) return t;
|
|
51
56
|
}
|
|
52
57
|
return 14;
|
|
53
|
-
},
|
|
58
|
+
}, it = (e) => {
|
|
54
59
|
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 = {
|
|
55
60
|
position: "absolute",
|
|
56
61
|
[a ? "bottom" : "top"]: "100%",
|
|
@@ -60,43 +65,72 @@ var H = (e) => {
|
|
|
60
65
|
width: "100%"
|
|
61
66
|
};
|
|
62
67
|
return r && (o.transform = `translateX(${r}px)`), o;
|
|
63
|
-
},
|
|
64
|
-
"bsy-lexical__toolbar": "_bsy-
|
|
65
|
-
"bsy-lexical__toolbar--floating": "_bsy-lexical__toolbar--
|
|
66
|
-
"bsy-lexical__toolbar-
|
|
67
|
-
"bsy-lexical__toolbar-
|
|
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"
|
|
68
77
|
};
|
|
69
78
|
//#endregion
|
|
70
79
|
//#region src/components/Editor/hooks/useTextFormatsState.ts
|
|
71
|
-
function
|
|
72
|
-
let [e] =
|
|
80
|
+
function at() {
|
|
81
|
+
let [e] = F(), [t, n] = E({
|
|
73
82
|
bold: !1,
|
|
74
83
|
italic: !1,
|
|
75
84
|
underline: !1,
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
85
|
+
strikethrough: !1,
|
|
86
|
+
superscript: !1,
|
|
87
|
+
subscript: !1,
|
|
88
|
+
fontSize: ie,
|
|
89
|
+
fontColor: re,
|
|
90
|
+
backgroundColor: ne,
|
|
79
91
|
align: "left",
|
|
92
|
+
listType: !1,
|
|
93
|
+
canOutdent: !1,
|
|
94
|
+
isCodeBlock: !1,
|
|
95
|
+
codeLanguage: i,
|
|
80
96
|
link: void 0
|
|
81
97
|
});
|
|
82
|
-
return
|
|
98
|
+
return C(() => e.registerUpdateListener(({ editorState: e }) => {
|
|
83
99
|
e.read(() => {
|
|
84
|
-
let e =
|
|
85
|
-
if (
|
|
86
|
-
let t =
|
|
100
|
+
let e = A();
|
|
101
|
+
if (N(e)) {
|
|
102
|
+
let t = I(e, "font-size", ie), r = I(e, "color", re), i = I(e, "background-color", ne), a = e.anchor.getNode(), o = a.getKey() === "root" ? a : R(a, (e) => {
|
|
87
103
|
let t = e.getParent();
|
|
88
|
-
return t !== null &&
|
|
104
|
+
return t !== null && Ee(t);
|
|
89
105
|
});
|
|
90
106
|
o === null && (o = a.getTopLevelElementOrThrow());
|
|
91
|
-
let s = {}, c =
|
|
92
|
-
c ? (s.link = c.getURL(), s.linkText = c.getTextContent(), s.newBlank = c.getTarget() === "_blank") : s.linkText = e.getTextContent()
|
|
107
|
+
let s = {}, c = R(a, We);
|
|
108
|
+
c ? (s.link = c.getURL(), s.linkText = c.getTextContent(), s.newBlank = c.getTarget() === "_blank") : s.linkText = e.getTextContent();
|
|
109
|
+
let l = R(a, z), u = !1, d = Te(o) ? o.getIndent() : 0;
|
|
110
|
+
if (z(l)) {
|
|
111
|
+
d = l.getIndent();
|
|
112
|
+
let e = l.getParent();
|
|
113
|
+
if (qe(e)) {
|
|
114
|
+
let t = e.getListType();
|
|
115
|
+
u = t === "number" || t === "bullet" ? t : !1;
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
let f = R(a, V);
|
|
119
|
+
n({
|
|
93
120
|
bold: e.hasFormat("bold"),
|
|
94
121
|
italic: e.hasFormat("italic"),
|
|
95
122
|
underline: e.hasFormat("underline"),
|
|
123
|
+
strikethrough: e.hasFormat("strikethrough"),
|
|
124
|
+
superscript: e.hasFormat("superscript"),
|
|
125
|
+
subscript: e.hasFormat("subscript"),
|
|
96
126
|
fontSize: t,
|
|
97
127
|
fontColor: r,
|
|
98
128
|
backgroundColor: i,
|
|
99
|
-
align:
|
|
129
|
+
align: Te(o) ? o.getFormatType() : "left",
|
|
130
|
+
listType: u,
|
|
131
|
+
canOutdent: d > 0 || u !== !1,
|
|
132
|
+
isCodeBlock: !!f,
|
|
133
|
+
codeLanguage: y(f?.getLanguage()),
|
|
100
134
|
link: s
|
|
101
135
|
});
|
|
102
136
|
}
|
|
@@ -105,14 +139,129 @@ function Ce() {
|
|
|
105
139
|
}
|
|
106
140
|
//#endregion
|
|
107
141
|
//#region src/components/Editor/ToolbarPlugin/context/TextFormatProvider.tsx
|
|
108
|
-
var
|
|
109
|
-
let t =
|
|
110
|
-
return /* @__PURE__ */
|
|
142
|
+
var ot = (e) => {
|
|
143
|
+
let t = at();
|
|
144
|
+
return /* @__PURE__ */ b(te.Provider, {
|
|
111
145
|
value: t,
|
|
112
146
|
children: e.children
|
|
113
147
|
});
|
|
114
|
-
},
|
|
115
|
-
|
|
148
|
+
}, st = u.map((e) => ({
|
|
149
|
+
key: e.id,
|
|
150
|
+
label: e.label
|
|
151
|
+
})), ct = () => {
|
|
152
|
+
let [n] = F(), { codeLanguage: i } = f(), { t: a } = t(), { getPopupContainer: s } = o(), { iconSize: u } = c(), d = S((e) => {
|
|
153
|
+
let t = e.key;
|
|
154
|
+
n.update(() => {
|
|
155
|
+
let e = A();
|
|
156
|
+
N(e) && R(e.anchor.getNode(), V)?.setLanguage(t);
|
|
157
|
+
});
|
|
158
|
+
}, [n]), p = l[i].label;
|
|
159
|
+
return /* @__PURE__ */ b(r, {
|
|
160
|
+
menus: st,
|
|
161
|
+
onClick: d,
|
|
162
|
+
activeKey: [i],
|
|
163
|
+
showSearch: !1,
|
|
164
|
+
getPopupContainer: s,
|
|
165
|
+
style: {
|
|
166
|
+
width: 120,
|
|
167
|
+
minWidth: 120
|
|
168
|
+
},
|
|
169
|
+
children: /* @__PURE__ */ b("div", {
|
|
170
|
+
className: G["bsy-lexical__code-language"],
|
|
171
|
+
children: /* @__PURE__ */ b(v, {
|
|
172
|
+
icon: /* @__PURE__ */ x(oe, { children: [/* @__PURE__ */ b("span", {
|
|
173
|
+
className: G["bsy-lexical__code-language-label"],
|
|
174
|
+
children: p
|
|
175
|
+
}), /* @__PURE__ */ b(e, {
|
|
176
|
+
name: "arrow-down",
|
|
177
|
+
size: u,
|
|
178
|
+
className: G["bsy-lexical__code-language-arrow"]
|
|
179
|
+
})] }),
|
|
180
|
+
tooltip: a("editor.codeLanguage")
|
|
181
|
+
})
|
|
182
|
+
})
|
|
183
|
+
});
|
|
184
|
+
}, lt = {
|
|
185
|
+
initial: {
|
|
186
|
+
opacity: 0,
|
|
187
|
+
x: 6
|
|
188
|
+
},
|
|
189
|
+
animate: {
|
|
190
|
+
opacity: 1,
|
|
191
|
+
x: 0
|
|
192
|
+
},
|
|
193
|
+
exit: {
|
|
194
|
+
opacity: 0,
|
|
195
|
+
x: -6
|
|
196
|
+
}
|
|
197
|
+
}, ut = (e) => typeof e == "string" ? e : e.name, dt = (e, t) => {
|
|
198
|
+
if (t) return [
|
|
199
|
+
{
|
|
200
|
+
kind: "button",
|
|
201
|
+
key: "undo",
|
|
202
|
+
name: "undo"
|
|
203
|
+
},
|
|
204
|
+
{
|
|
205
|
+
kind: "button",
|
|
206
|
+
key: "redo",
|
|
207
|
+
name: "redo"
|
|
208
|
+
},
|
|
209
|
+
{
|
|
210
|
+
kind: "divider",
|
|
211
|
+
key: "divider-code"
|
|
212
|
+
},
|
|
213
|
+
{
|
|
214
|
+
kind: "button",
|
|
215
|
+
key: "code-block-toggle",
|
|
216
|
+
name: "code"
|
|
217
|
+
},
|
|
218
|
+
{
|
|
219
|
+
kind: "language",
|
|
220
|
+
key: "code-language"
|
|
221
|
+
}
|
|
222
|
+
];
|
|
223
|
+
let n = [];
|
|
224
|
+
return e.forEach((t, r) => {
|
|
225
|
+
t.buttons.forEach((e) => {
|
|
226
|
+
let t = ut(e);
|
|
227
|
+
n.push({
|
|
228
|
+
kind: "button",
|
|
229
|
+
key: t,
|
|
230
|
+
name: t,
|
|
231
|
+
props: typeof e == "string" ? void 0 : e.props
|
|
232
|
+
});
|
|
233
|
+
}), r < e.length - 1 && n.push({
|
|
234
|
+
kind: "divider",
|
|
235
|
+
key: `divider-${t.key}`
|
|
236
|
+
});
|
|
237
|
+
}), n;
|
|
238
|
+
}, ft = (e, t) => {
|
|
239
|
+
let n = m(e);
|
|
240
|
+
return n ? /* @__PURE__ */ b(n, { ...t }) : (console.warn(`[ToolbarPlugin] Button "${e}" is not registered.`), null);
|
|
241
|
+
}, pt = ({ config: e }) => {
|
|
242
|
+
let { isCodeBlock: t } = f(), n = ue(), r = dt(e, t), i = {
|
|
243
|
+
duration: n ? 0 : .16,
|
|
244
|
+
ease: "easeOut"
|
|
245
|
+
}, a = n ? {} : lt;
|
|
246
|
+
return /* @__PURE__ */ b(ce, {
|
|
247
|
+
initial: !1,
|
|
248
|
+
mode: "popLayout",
|
|
249
|
+
children: r.map((e) => {
|
|
250
|
+
let t = null;
|
|
251
|
+
return t = e.kind === "divider" ? /* @__PURE__ */ b("div", { className: G["bsy-lexical__toolbar-divider"] }) : e.kind === "language" ? /* @__PURE__ */ b(ct, {}) : ft(e.name, e.props), t === null ? null : /* @__PURE__ */ b(le.div, {
|
|
252
|
+
className: G["bsy-lexical__toolbar-item"],
|
|
253
|
+
layout: "position",
|
|
254
|
+
transition: i,
|
|
255
|
+
...a,
|
|
256
|
+
children: t
|
|
257
|
+
}, e.key);
|
|
258
|
+
})
|
|
259
|
+
});
|
|
260
|
+
}, mt = (e) => {
|
|
261
|
+
let { config: t = [], style: n, theme: r, mode: i, floating: a } = e, { toolbarRef: c } = o(), l = i === "floating", u = ue(), d = {
|
|
262
|
+
duration: u ? 0 : .16,
|
|
263
|
+
ease: "easeOut"
|
|
264
|
+
}, f = w(() => nt(r), [r]), p = w(() => ({ iconSize: rt(r?.iconSize) }), [r?.iconSize]), m = l ? it(a) : void 0, h = l ? ae(n, [
|
|
116
265
|
"position",
|
|
117
266
|
"left",
|
|
118
267
|
"top",
|
|
@@ -122,35 +271,30 @@ var we = (e) => {
|
|
|
122
271
|
"transform",
|
|
123
272
|
"marginTop",
|
|
124
273
|
"marginBottom"
|
|
125
|
-
]) :
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
return /* @__PURE__ */ g(u, {
|
|
130
|
-
value: f,
|
|
131
|
-
children: /* @__PURE__ */ g(we, { children: /* @__PURE__ */ g("div", {
|
|
274
|
+
]) : n;
|
|
275
|
+
return /* @__PURE__ */ b(s, {
|
|
276
|
+
value: p,
|
|
277
|
+
children: /* @__PURE__ */ b(g, { children: /* @__PURE__ */ b(ot, { children: /* @__PURE__ */ b(le.div, {
|
|
132
278
|
ref: c,
|
|
133
|
-
|
|
279
|
+
layout: !u,
|
|
280
|
+
transition: d,
|
|
281
|
+
className: D(G["bsy-lexical__toolbar"], l && G["bsy-lexical__toolbar--floating"]),
|
|
134
282
|
style: {
|
|
135
|
-
...
|
|
136
|
-
...
|
|
283
|
+
...f,
|
|
284
|
+
...m,
|
|
137
285
|
...h
|
|
138
286
|
},
|
|
139
|
-
children:
|
|
140
|
-
|
|
141
|
-
"data-group": e.key,
|
|
142
|
-
children: [e.buttons.map((e, t) => v(e, t)), n < t.length - 1 && /* @__PURE__ */ g("div", { className: U["bsy-lexical__toolbar-divider"] })]
|
|
143
|
-
}, e.key + n))
|
|
144
|
-
}) })
|
|
287
|
+
children: /* @__PURE__ */ b(pt, { config: t })
|
|
288
|
+
}) }) })
|
|
145
289
|
});
|
|
146
|
-
},
|
|
290
|
+
}, K = {
|
|
147
291
|
"bsy-lexical-editor": "_bsy-lexical-editor_1bhfo_1",
|
|
148
292
|
"bsy-lexical-editor--floating": "_bsy-lexical-editor--floating_1bhfo_7",
|
|
149
293
|
"bsy-lexical-editor__content-editable": "_bsy-lexical-editor__content-editable_1bhfo_10",
|
|
150
294
|
"bsy-lexical-editor__content-editable--with-length-badge": "_bsy-lexical-editor__content-editable--with-length-badge_1bhfo_17",
|
|
151
295
|
"bsy-lexical-editor__length-badge": "_bsy-lexical-editor__length-badge_1bhfo_20",
|
|
152
296
|
"bsy-lexical-editor__length-badge--exceeded": "_bsy-lexical-editor__length-badge--exceeded_1bhfo_36"
|
|
153
|
-
},
|
|
297
|
+
}, q = class e extends P {
|
|
154
298
|
constructor(e, t) {
|
|
155
299
|
super(e, t);
|
|
156
300
|
}
|
|
@@ -161,46 +305,46 @@ var we = (e) => {
|
|
|
161
305
|
return new e(t.__text, t.__key);
|
|
162
306
|
}
|
|
163
307
|
static importDOM() {
|
|
164
|
-
let e =
|
|
308
|
+
let e = P.importDOM();
|
|
165
309
|
return {
|
|
166
310
|
...e,
|
|
167
311
|
code: () => ({
|
|
168
|
-
conversion:
|
|
312
|
+
conversion: J(e?.code),
|
|
169
313
|
priority: 1
|
|
170
314
|
}),
|
|
171
315
|
em: () => ({
|
|
172
|
-
conversion:
|
|
316
|
+
conversion: J(e?.em),
|
|
173
317
|
priority: 1
|
|
174
318
|
}),
|
|
175
319
|
span: () => ({
|
|
176
|
-
conversion:
|
|
320
|
+
conversion: J(e?.span),
|
|
177
321
|
priority: 1
|
|
178
322
|
}),
|
|
179
323
|
strong: () => ({
|
|
180
|
-
conversion:
|
|
324
|
+
conversion: J(e?.strong),
|
|
181
325
|
priority: 1
|
|
182
326
|
}),
|
|
183
327
|
sub: () => ({
|
|
184
|
-
conversion:
|
|
328
|
+
conversion: J(e?.sub),
|
|
185
329
|
priority: 1
|
|
186
330
|
}),
|
|
187
331
|
sup: () => ({
|
|
188
|
-
conversion:
|
|
332
|
+
conversion: J(e?.sup),
|
|
189
333
|
priority: 1
|
|
190
334
|
})
|
|
191
335
|
};
|
|
192
336
|
}
|
|
193
337
|
static importJSON(e) {
|
|
194
|
-
return
|
|
338
|
+
return ht().updateFromJSON(e);
|
|
195
339
|
}
|
|
196
340
|
isSimpleText() {
|
|
197
341
|
return this.__type === "extended-text" && this.__mode === 0;
|
|
198
342
|
}
|
|
199
343
|
};
|
|
200
|
-
function
|
|
201
|
-
return
|
|
344
|
+
function ht(e = "") {
|
|
345
|
+
return ye(new q(e));
|
|
202
346
|
}
|
|
203
|
-
function
|
|
347
|
+
function J(e) {
|
|
204
348
|
return (t) => {
|
|
205
349
|
let n = e?.(t);
|
|
206
350
|
if (!n) return null;
|
|
@@ -211,7 +355,7 @@ function K(e) {
|
|
|
211
355
|
...r,
|
|
212
356
|
forChild: (e, t) => {
|
|
213
357
|
let n = (r?.forChild ?? ((e) => e))(e, t);
|
|
214
|
-
if (
|
|
358
|
+
if (Oe(n)) {
|
|
215
359
|
let e = [
|
|
216
360
|
i ? `background-color: ${i}` : null,
|
|
217
361
|
a ? `color: ${a}` : null,
|
|
@@ -229,21 +373,21 @@ function K(e) {
|
|
|
229
373
|
}
|
|
230
374
|
//#endregion
|
|
231
375
|
//#region src/components/Editor/plugins/LinkColorPlugin.tsx
|
|
232
|
-
function
|
|
376
|
+
function gt(e) {
|
|
233
377
|
return e.split(";").map((e) => e.trim()).filter((e) => e && e.split(":")[0].trim().toLowerCase() !== "color").join("; ");
|
|
234
378
|
}
|
|
235
|
-
function
|
|
236
|
-
if (!
|
|
379
|
+
function _t(e) {
|
|
380
|
+
if (!R(e, We)) return;
|
|
237
381
|
let t = e.getStyle();
|
|
238
382
|
if (!t) return;
|
|
239
|
-
let n =
|
|
383
|
+
let n = gt(t);
|
|
240
384
|
n !== t && e.setStyle(n);
|
|
241
385
|
}
|
|
242
|
-
function
|
|
243
|
-
let [e] =
|
|
244
|
-
return
|
|
386
|
+
function vt() {
|
|
387
|
+
let [e] = F();
|
|
388
|
+
return C(() => e.registerNodeTransform(q, _t), [e]), null;
|
|
245
389
|
}
|
|
246
|
-
var
|
|
390
|
+
var Y = {
|
|
247
391
|
imageWrapper: "_imageWrapper_y06h3_1",
|
|
248
392
|
selected: "_selected_y06h3_8",
|
|
249
393
|
resizing: "_resizing_y06h3_12",
|
|
@@ -253,16 +397,16 @@ var q = {
|
|
|
253
397
|
topRight: "_topRight_y06h3_49",
|
|
254
398
|
bottomLeft: "_bottomLeft_y06h3_54",
|
|
255
399
|
bottomRight: "_bottomRight_y06h3_59"
|
|
256
|
-
},
|
|
257
|
-
let [a] =
|
|
400
|
+
}, yt = ({ src: e, altText: t, width: n, height: r, nodeKey: i }) => {
|
|
401
|
+
let [a] = F(), [o, s] = E(!1), [c, l] = E(null), u = T(null), [d, f] = E({
|
|
258
402
|
width: n || void 0,
|
|
259
403
|
height: r || void 0
|
|
260
|
-
}), p =
|
|
404
|
+
}), p = S(() => {
|
|
261
405
|
n && r && f({
|
|
262
406
|
width: n,
|
|
263
407
|
height: r
|
|
264
408
|
});
|
|
265
|
-
}, [n, r]), m =
|
|
409
|
+
}, [n, r]), m = S((e, t) => {
|
|
266
410
|
if (e.preventDefault(), e.stopPropagation(), !u.current) return;
|
|
267
411
|
let n = d.width || u.current.offsetWidth, r = d.height || u.current.offsetHeight, i = n / r;
|
|
268
412
|
(!d.width || !d.height) && f({
|
|
@@ -277,7 +421,7 @@ var q = {
|
|
|
277
421
|
aspectRatio: i,
|
|
278
422
|
direction: t
|
|
279
423
|
});
|
|
280
|
-
}, [d]),
|
|
424
|
+
}, [d]), h = S((e) => {
|
|
281
425
|
if (!c?.isResizing) return;
|
|
282
426
|
let t = e.clientX - c.startX, n;
|
|
283
427
|
switch (c.direction) {
|
|
@@ -300,10 +444,10 @@ var q = {
|
|
|
300
444
|
width: n,
|
|
301
445
|
height: r
|
|
302
446
|
});
|
|
303
|
-
}, [c]),
|
|
447
|
+
}, [c]), g = S(() => {
|
|
304
448
|
c?.isResizing && (a.update(() => {
|
|
305
|
-
let e =
|
|
306
|
-
|
|
449
|
+
let e = O(i);
|
|
450
|
+
bt(e) && e.setWidthAndHeight(d.width, d.height);
|
|
307
451
|
}), l(null));
|
|
308
452
|
}, [
|
|
309
453
|
a,
|
|
@@ -311,71 +455,71 @@ var q = {
|
|
|
311
455
|
d,
|
|
312
456
|
c
|
|
313
457
|
]);
|
|
314
|
-
|
|
315
|
-
if (c?.isResizing) return document.addEventListener("mousemove",
|
|
316
|
-
document.removeEventListener("mousemove",
|
|
458
|
+
se.useEffect(() => {
|
|
459
|
+
if (c?.isResizing) return document.addEventListener("mousemove", h), document.addEventListener("mouseup", g), () => {
|
|
460
|
+
document.removeEventListener("mousemove", h), document.removeEventListener("mouseup", g);
|
|
317
461
|
};
|
|
318
462
|
}, [
|
|
319
463
|
c,
|
|
320
|
-
|
|
321
|
-
|
|
464
|
+
h,
|
|
465
|
+
g
|
|
322
466
|
]);
|
|
323
|
-
let
|
|
467
|
+
let _ = S(() => {
|
|
324
468
|
s(!0);
|
|
325
469
|
}, []);
|
|
326
|
-
return
|
|
470
|
+
return C(() => a.registerUpdateListener(({ editorState: e }) => {
|
|
327
471
|
e.read(() => {
|
|
328
|
-
let e =
|
|
329
|
-
|
|
472
|
+
let e = A();
|
|
473
|
+
N(e) && !e.getNodes().some((e) => e.getKey() === i || e.getParent() && e.getParent()?.getKey() === i) && o && s(!1);
|
|
330
474
|
});
|
|
331
475
|
}), [
|
|
332
476
|
a,
|
|
333
477
|
i,
|
|
334
478
|
o
|
|
335
|
-
]),
|
|
479
|
+
]), C(() => {
|
|
336
480
|
let e = (e) => {
|
|
337
481
|
o && u.current && !u.current.contains(e.target) && s(!1);
|
|
338
482
|
};
|
|
339
483
|
if (o) return document.addEventListener("mousedown", e), () => {
|
|
340
484
|
document.removeEventListener("mousedown", e);
|
|
341
485
|
};
|
|
342
|
-
}, [o]), /* @__PURE__ */
|
|
343
|
-
className:
|
|
344
|
-
[
|
|
345
|
-
[
|
|
486
|
+
}, [o]), /* @__PURE__ */ x("div", {
|
|
487
|
+
className: D(Y.imageWrapper, {
|
|
488
|
+
[Y.selected]: o,
|
|
489
|
+
[Y.resizing]: c?.isResizing
|
|
346
490
|
}),
|
|
347
|
-
children: [/* @__PURE__ */
|
|
491
|
+
children: [/* @__PURE__ */ b("img", {
|
|
348
492
|
ref: u,
|
|
349
493
|
src: e,
|
|
350
494
|
alt: t,
|
|
351
|
-
className:
|
|
495
|
+
className: Y.image,
|
|
352
496
|
style: {
|
|
353
497
|
width: d.width,
|
|
354
498
|
height: d.height
|
|
355
499
|
},
|
|
356
500
|
onLoad: p,
|
|
357
|
-
onClick:
|
|
501
|
+
onClick: _,
|
|
358
502
|
draggable: !1
|
|
359
|
-
}), o && /* @__PURE__ */
|
|
360
|
-
/* @__PURE__ */
|
|
361
|
-
className:
|
|
503
|
+
}), o && /* @__PURE__ */ x(oe, { children: [
|
|
504
|
+
/* @__PURE__ */ b("div", {
|
|
505
|
+
className: D(Y.resizeHandle, Y.bottomRight),
|
|
362
506
|
onMouseDown: (e) => m(e, "bottom-right")
|
|
363
507
|
}),
|
|
364
|
-
/* @__PURE__ */
|
|
365
|
-
className:
|
|
508
|
+
/* @__PURE__ */ b("div", {
|
|
509
|
+
className: D(Y.resizeHandle, Y.bottomLeft),
|
|
366
510
|
onMouseDown: (e) => m(e, "bottom-left")
|
|
367
511
|
}),
|
|
368
|
-
/* @__PURE__ */
|
|
369
|
-
className:
|
|
512
|
+
/* @__PURE__ */ b("div", {
|
|
513
|
+
className: D(Y.resizeHandle, Y.topRight),
|
|
370
514
|
onMouseDown: (e) => m(e, "top-right")
|
|
371
515
|
}),
|
|
372
|
-
/* @__PURE__ */
|
|
373
|
-
className:
|
|
516
|
+
/* @__PURE__ */ b("div", {
|
|
517
|
+
className: D(Y.resizeHandle, Y.topLeft),
|
|
374
518
|
onMouseDown: (e) => m(e, "top-left")
|
|
375
519
|
})
|
|
376
520
|
] })]
|
|
377
521
|
});
|
|
378
|
-
},
|
|
522
|
+
}, X = class e extends Pe {
|
|
379
523
|
static getType() {
|
|
380
524
|
return "image";
|
|
381
525
|
}
|
|
@@ -421,7 +565,7 @@ var q = {
|
|
|
421
565
|
n.__width = e, n.__height = t;
|
|
422
566
|
}
|
|
423
567
|
decorate() {
|
|
424
|
-
return /* @__PURE__ */
|
|
568
|
+
return /* @__PURE__ */ b(yt, {
|
|
425
569
|
src: this.__src,
|
|
426
570
|
altText: this.__altText,
|
|
427
571
|
width: this.__width,
|
|
@@ -431,13 +575,13 @@ var q = {
|
|
|
431
575
|
}
|
|
432
576
|
static importDOM() {
|
|
433
577
|
return { img: () => ({
|
|
434
|
-
conversion:
|
|
578
|
+
conversion: xt,
|
|
435
579
|
priority: 0
|
|
436
580
|
}) };
|
|
437
581
|
}
|
|
438
582
|
static importJSON(e) {
|
|
439
583
|
let { src: t, altText: n, width: r, height: i } = e;
|
|
440
|
-
return
|
|
584
|
+
return Z({
|
|
441
585
|
src: t,
|
|
442
586
|
altText: n,
|
|
443
587
|
width: r,
|
|
@@ -458,13 +602,13 @@ var q = {
|
|
|
458
602
|
return !0;
|
|
459
603
|
}
|
|
460
604
|
};
|
|
461
|
-
function
|
|
462
|
-
return new
|
|
605
|
+
function Z({ src: e, altText: t, width: n, height: r, key: i }) {
|
|
606
|
+
return new X(e, t, n, r, i);
|
|
463
607
|
}
|
|
464
|
-
function
|
|
465
|
-
return e instanceof
|
|
608
|
+
function bt(e) {
|
|
609
|
+
return e instanceof X;
|
|
466
610
|
}
|
|
467
|
-
function
|
|
611
|
+
function xt(e) {
|
|
468
612
|
if (e instanceof HTMLImageElement) {
|
|
469
613
|
let { src: t, alt: n, style: r } = e, i, a;
|
|
470
614
|
if (r.width) {
|
|
@@ -475,7 +619,7 @@ function Me(e) {
|
|
|
475
619
|
let e = parseInt(r.height, 10);
|
|
476
620
|
isNaN(e) || (a = e);
|
|
477
621
|
}
|
|
478
|
-
return i === void 0 && e.width && (i = e.width), a === void 0 && e.height && (a = e.height), { node:
|
|
622
|
+
return i === void 0 && e.width && (i = e.width), a === void 0 && e.height && (a = e.height), { node: Z({
|
|
479
623
|
src: t,
|
|
480
624
|
altText: n,
|
|
481
625
|
width: i,
|
|
@@ -486,23 +630,62 @@ function Me(e) {
|
|
|
486
630
|
}
|
|
487
631
|
//#endregion
|
|
488
632
|
//#region src/components/Editor/plugins/ImagePlugin.tsx
|
|
489
|
-
function
|
|
490
|
-
let [e] =
|
|
491
|
-
return
|
|
633
|
+
function St() {
|
|
634
|
+
let [e] = F();
|
|
635
|
+
return C(() => e.registerCommand(h, (e) => (j([Z(e)]), !0), Ae), [e]), null;
|
|
636
|
+
}
|
|
637
|
+
//#endregion
|
|
638
|
+
//#region src/components/Editor/utils/stripImagesFromHtml.ts
|
|
639
|
+
function Ct(e) {
|
|
640
|
+
let t = new DOMParser().parseFromString(e, "text/html");
|
|
641
|
+
return t.querySelectorAll("img, picture").forEach((e) => e.remove()), t.body.innerHTML;
|
|
642
|
+
}
|
|
643
|
+
//#endregion
|
|
644
|
+
//#region src/components/Editor/plugins/PasteStripImagePlugin.tsx
|
|
645
|
+
var wt = /<img\b|<picture\b/i;
|
|
646
|
+
function Tt() {
|
|
647
|
+
let [e] = F();
|
|
648
|
+
return C(() => {
|
|
649
|
+
let t = (t) => {
|
|
650
|
+
let n = "clipboardData" in t ? t.clipboardData : "dataTransfer" in t ? t.dataTransfer : null;
|
|
651
|
+
if (!n || n.getData("application/x-lexical-editor") || n.getData("application/x-lexical-drag")) return !1;
|
|
652
|
+
let r = n.getData("text/html");
|
|
653
|
+
if (!(Array.from(n.files).some((e) => e.type.startsWith("image/")) || Array.from(n.items).some((e) => e.type.startsWith("image/")) || wt.test(r))) return !1;
|
|
654
|
+
t.preventDefault();
|
|
655
|
+
let i = n.getData("text/plain");
|
|
656
|
+
return !wt.test(r) && !i || e.update(() => {
|
|
657
|
+
let t = A();
|
|
658
|
+
if (t === null) return;
|
|
659
|
+
let n = r ? Ct(r) : "", a = document.createElement("div");
|
|
660
|
+
if (a.innerHTML = n, n && a.textContent?.trim()) {
|
|
661
|
+
let t = ve(e, new DOMParser().parseFromString(n, "text/html"));
|
|
662
|
+
if (t.length) {
|
|
663
|
+
j(t);
|
|
664
|
+
return;
|
|
665
|
+
}
|
|
666
|
+
}
|
|
667
|
+
i && t.insertRawText(i);
|
|
668
|
+
}, { tag: Le }), !0;
|
|
669
|
+
};
|
|
670
|
+
return Ue(e.registerCommand(Ie, (e) => t(e), je), e.registerCommand(Ne, (e) => t(e), je));
|
|
671
|
+
}, [e]), null;
|
|
492
672
|
}
|
|
493
673
|
//#endregion
|
|
494
674
|
//#region src/components/Editor/plugins/EnterKeyPlugin.tsx
|
|
495
|
-
function
|
|
496
|
-
let [e] =
|
|
497
|
-
return
|
|
675
|
+
function Et() {
|
|
676
|
+
let [e] = F(), t = T(0);
|
|
677
|
+
return C(() => e.registerCommand(Fe, (n) => {
|
|
498
678
|
let r = Date.now(), i = r - t.current;
|
|
499
|
-
return t.current = r, i < 250 && i > 0 ?
|
|
500
|
-
let e =
|
|
501
|
-
|
|
679
|
+
return t.current = r, i < 250 && i > 0 ? e.getEditorState().read(() => {
|
|
680
|
+
let e = A();
|
|
681
|
+
return N(e) ? !!R(e.anchor.getNode(), (e) => z(e) || V(e)) : !1;
|
|
682
|
+
}, { editor: e }) ? !1 : (e.update(() => {
|
|
683
|
+
let e = A();
|
|
684
|
+
if (N(e)) {
|
|
502
685
|
let t = e.anchor.getNode().getTopLevelElement();
|
|
503
686
|
if (t && t.getTextContent().trim() === "") {
|
|
504
|
-
let n =
|
|
505
|
-
|
|
687
|
+
let n = xe();
|
|
688
|
+
Ve(e, {
|
|
506
689
|
"background-color": "",
|
|
507
690
|
color: "",
|
|
508
691
|
"font-size": "",
|
|
@@ -515,38 +698,195 @@ function X() {
|
|
|
515
698
|
}
|
|
516
699
|
}
|
|
517
700
|
}), n?.preventDefault(), !0) : !1;
|
|
518
|
-
},
|
|
701
|
+
}, Me), [e]), null;
|
|
702
|
+
}
|
|
703
|
+
//#endregion
|
|
704
|
+
//#region src/components/Editor/utils/codeHighlighter.ts
|
|
705
|
+
var Dt = {
|
|
706
|
+
css: () => import("@shikijs/langs/css"),
|
|
707
|
+
html: () => import("@shikijs/langs/html"),
|
|
708
|
+
xml: () => import("@shikijs/langs/xml"),
|
|
709
|
+
javascript: () => import("@shikijs/langs/javascript"),
|
|
710
|
+
typescript: () => import("@shikijs/langs/typescript"),
|
|
711
|
+
jsx: () => import("@shikijs/langs/jsx"),
|
|
712
|
+
go: () => import("@shikijs/langs/go"),
|
|
713
|
+
php: () => import("@shikijs/langs/php"),
|
|
714
|
+
c: () => import("@shikijs/langs/c"),
|
|
715
|
+
python: () => import("@shikijs/langs/python"),
|
|
716
|
+
java: () => import("@shikijs/langs/java"),
|
|
717
|
+
cpp: () => import("@shikijs/langs/cpp"),
|
|
718
|
+
csharp: () => import("@shikijs/langs/csharp"),
|
|
719
|
+
vb: () => import("@shikijs/langs/vb"),
|
|
720
|
+
sql: () => import("@shikijs/langs/sql"),
|
|
721
|
+
ruby: () => import("@shikijs/langs/ruby"),
|
|
722
|
+
swift: () => import("@shikijs/langs/swift"),
|
|
723
|
+
bash: () => import("@shikijs/langs/shellscript"),
|
|
724
|
+
lua: () => import("@shikijs/langs/lua"),
|
|
725
|
+
markdown: () => import("@shikijs/langs/markdown")
|
|
726
|
+
}, Q = (e) => e === "bash" ? "shellscript" : e, Ot = (e) => e in Dt, $ = null, kt = null, At = /* @__PURE__ */ new Map(), jt = () => ($ ||= Promise.all([import("@shikijs/core"), import("@shikijs/engine-javascript")]).then(([{ createHighlighterCoreSync: e }, { createJavaScriptRegexEngine: t }]) => e({
|
|
727
|
+
engine: t(),
|
|
728
|
+
langs: [],
|
|
729
|
+
themes: []
|
|
730
|
+
})).catch((e) => {
|
|
731
|
+
throw $ = null, e;
|
|
732
|
+
}), $), Mt = (e, t) => Ot(t) && e.getLoadedLanguages().includes(Q(t)), Nt = (e) => {
|
|
733
|
+
let t = At.get(e);
|
|
734
|
+
return t || (t = jt().then(async (t) => {
|
|
735
|
+
let n = Q(e);
|
|
736
|
+
if (!t.getLoadedLanguages().includes(n)) {
|
|
737
|
+
let n = await Dt[e]();
|
|
738
|
+
await t.loadLanguage(n.default);
|
|
739
|
+
}
|
|
740
|
+
return t;
|
|
741
|
+
}).catch((t) => {
|
|
742
|
+
throw At.delete(e), t;
|
|
743
|
+
}), At.set(e, t)), t;
|
|
744
|
+
}, Pt = () => (kt ||= jt().then(async (e) => {
|
|
745
|
+
if (!e.getLoadedThemes().includes("github-light")) {
|
|
746
|
+
let t = await import("@shikijs/themes/github-light");
|
|
747
|
+
await e.loadTheme(t.default);
|
|
748
|
+
}
|
|
749
|
+
return e;
|
|
750
|
+
}).catch((e) => {
|
|
751
|
+
throw kt = null, e;
|
|
752
|
+
}), kt), Ft = (e, t, n) => {
|
|
753
|
+
let r = e.getTextContent();
|
|
754
|
+
if (e.getStyle() && e.setStyle(""), !n || !Mt(n, t)) return Ze(r);
|
|
755
|
+
let i = Q(t), a = n.codeToTokens(r, {
|
|
756
|
+
lang: i,
|
|
757
|
+
theme: p
|
|
758
|
+
}), o = [];
|
|
759
|
+
return a.tokens.forEach((e, t) => {
|
|
760
|
+
t && o.push(be()), e.forEach((e) => {
|
|
761
|
+
e.content.split(" ").forEach((t, n) => {
|
|
762
|
+
if (n && o.push(Se()), t === "") return;
|
|
763
|
+
let r = Xe(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
|
+
i && r.setStyle(i), o.push(r);
|
|
765
|
+
});
|
|
766
|
+
});
|
|
767
|
+
}), o;
|
|
768
|
+
}, It = (e, t) => {
|
|
769
|
+
let n = O(e);
|
|
770
|
+
if (!V(n) || !n.isAttached()) return;
|
|
771
|
+
let r = A();
|
|
772
|
+
if (!N(r)) {
|
|
773
|
+
t();
|
|
774
|
+
return;
|
|
775
|
+
}
|
|
776
|
+
let { anchor: i } = r, a = i.offset, o = i.type === "element" && M(n.getChildAtIndex(i.offset - 1)), s = 0;
|
|
777
|
+
if (o || (s = a + i.getNode().getPreviousSiblings().reduce((e, t) => e + t.getTextContentSize(), 0)), t()) {
|
|
778
|
+
if (o) {
|
|
779
|
+
i.getNode().select(a, a);
|
|
780
|
+
return;
|
|
781
|
+
}
|
|
782
|
+
n.getChildren().some((e) => {
|
|
783
|
+
let t = Oe(e);
|
|
784
|
+
if (t || M(e)) {
|
|
785
|
+
let n = e.getTextContentSize();
|
|
786
|
+
if (t && n >= s) return e.select(s, s), !0;
|
|
787
|
+
s -= n;
|
|
788
|
+
}
|
|
789
|
+
return !1;
|
|
790
|
+
});
|
|
791
|
+
}
|
|
792
|
+
}, Lt = (e, t) => B(e) && B(t) && e.__text === t.__text && e.__highlightType === t.__highlightType && e.__style === t.__style || De(e) && De(t) || M(e) && M(t), Rt = (e, t) => {
|
|
793
|
+
let n = 0;
|
|
794
|
+
for (; n < e.length && Lt(e[n], t[n]);) n++;
|
|
795
|
+
let r = e.length, i = t.length, a = Math.min(r, i) - n, o = 0;
|
|
796
|
+
for (; o < a;) if (o++, !Lt(e[r - o], t[i - o])) {
|
|
797
|
+
o--;
|
|
798
|
+
break;
|
|
799
|
+
}
|
|
800
|
+
return {
|
|
801
|
+
from: n,
|
|
802
|
+
to: r - o,
|
|
803
|
+
nodesForReplacement: t.slice(n, i - o)
|
|
804
|
+
};
|
|
805
|
+
}, zt = (e, t, n, r, i) => {
|
|
806
|
+
let a = i.getKey(), o = y(i.getLanguage());
|
|
807
|
+
if (i.getLanguage() !== o && i.setLanguage(o), o === "plaintext") i.getIsSyntaxHighlightSupported() && i.setIsSyntaxHighlightSupported(!1);
|
|
808
|
+
else {
|
|
809
|
+
i.getTheme() !== "github-light" && i.setTheme(p);
|
|
810
|
+
let s = t ? t.getLoadedThemes().includes("github-light") ? Ot(o) && !Mt(t, o) ? Nt(o) : null : Pt() : jt();
|
|
811
|
+
if (s) {
|
|
812
|
+
i.getIsSyntaxHighlightSupported() && i.setIsSyntaxHighlightSupported(!1), n.pendingKeys.add(a), n.loading !== s && (n.loading = s, s.then((t) => {
|
|
813
|
+
r(t);
|
|
814
|
+
let i = [...n.pendingKeys];
|
|
815
|
+
n.pendingKeys.clear(), n.loading = null, e.update(() => {
|
|
816
|
+
i.forEach((e) => {
|
|
817
|
+
O(e)?.markDirty();
|
|
818
|
+
});
|
|
819
|
+
});
|
|
820
|
+
}, () => {
|
|
821
|
+
n.pendingKeys.clear(), n.loading = null;
|
|
822
|
+
}));
|
|
823
|
+
return;
|
|
824
|
+
}
|
|
825
|
+
i.getIsSyntaxHighlightSupported() || i.setIsSyntaxHighlightSupported(!0);
|
|
826
|
+
}
|
|
827
|
+
n.nodesCurrentlyHighlighting.has(a) || (n.nodesCurrentlyHighlighting.add(a), n.didTransform || (n.didTransform = !0, ke(() => {
|
|
828
|
+
n.didTransform = !1, n.nodesCurrentlyHighlighting.clear();
|
|
829
|
+
})), It(a, () => {
|
|
830
|
+
let e = O(a);
|
|
831
|
+
if (!V(e) || !e.isAttached()) return !1;
|
|
832
|
+
let n = Ft(e, y(e.getLanguage()), t), { from: r, to: i, nodesForReplacement: o } = Rt(e.getChildren(), n);
|
|
833
|
+
return r !== i || o.length ? (e.splice(r, i - r, o), !0) : !1;
|
|
834
|
+
}));
|
|
835
|
+
}, Bt = (e, t, n, r, i) => {
|
|
836
|
+
let a = i.getParent();
|
|
837
|
+
V(a) ? zt(e, t, n, r, a) : B(i) && i.replace(Ce(i.__text));
|
|
838
|
+
};
|
|
839
|
+
function Vt() {
|
|
840
|
+
let [e] = F();
|
|
841
|
+
return C(() => {
|
|
842
|
+
if (!e.hasNodes([U, H])) throw Error("CodeHighlightPlugin: CodeNode or CodeHighlightNode not registered on editor");
|
|
843
|
+
let t = null, n = {
|
|
844
|
+
didTransform: !1,
|
|
845
|
+
nodesCurrentlyHighlighting: /* @__PURE__ */ new Set(),
|
|
846
|
+
pendingKeys: /* @__PURE__ */ new Set(),
|
|
847
|
+
loading: null
|
|
848
|
+
}, r = (e) => {
|
|
849
|
+
t = e;
|
|
850
|
+
};
|
|
851
|
+
return ze(Qe(e), e.registerNodeTransform(U, (i) => {
|
|
852
|
+
zt(e, t, n, r, i);
|
|
853
|
+
}), e.registerNodeTransform(P, (i) => {
|
|
854
|
+
Bt(e, t, n, r, i);
|
|
855
|
+
}), e.registerNodeTransform(H, (i) => {
|
|
856
|
+
Bt(e, t, n, r, i);
|
|
857
|
+
}));
|
|
858
|
+
}, [e]), null;
|
|
519
859
|
}
|
|
520
860
|
//#endregion
|
|
521
861
|
//#region src/components/Editor/plugins/MaxLengthPlugin.tsx
|
|
522
|
-
function
|
|
523
|
-
let [n] =
|
|
524
|
-
return r.current = t,
|
|
862
|
+
function Ht({ maxLength: e, onMaxLengthExceed: t }) {
|
|
863
|
+
let [n] = F(), r = T(t);
|
|
864
|
+
return r.current = t, C(() => {
|
|
525
865
|
let t = null;
|
|
526
|
-
return n.registerNodeTransform(
|
|
866
|
+
return n.registerNodeTransform(Re, (i) => {
|
|
527
867
|
let a = i.getTextContentSize();
|
|
528
868
|
if (a <= e) return;
|
|
529
|
-
let o = n.getEditorState(), s = o.read(() => i.getTextContentSize()), c = a - e, l =
|
|
869
|
+
let o = n.getEditorState(), s = o.read(() => i.getTextContentSize()), c = a - e, l = A();
|
|
530
870
|
if (s === e && t !== o) {
|
|
531
|
-
t = o,
|
|
871
|
+
t = o, He(n, o), r.current?.();
|
|
532
872
|
return;
|
|
533
873
|
}
|
|
534
|
-
if (
|
|
535
|
-
|
|
874
|
+
if (N(l) && l.isCollapsed()) {
|
|
875
|
+
L(n, l.anchor, c), r.current?.();
|
|
536
876
|
return;
|
|
537
877
|
}
|
|
538
878
|
i.selectEnd();
|
|
539
|
-
let u =
|
|
540
|
-
|
|
879
|
+
let u = A();
|
|
880
|
+
N(u) && (L(n, u.anchor, c), r.current?.());
|
|
541
881
|
});
|
|
542
882
|
}, [n, e]), null;
|
|
543
883
|
}
|
|
544
884
|
//#endregion
|
|
545
885
|
//#region src/components/Editor/LengthBadge.tsx
|
|
546
|
-
var
|
|
886
|
+
var Ut = ({ current: e, maxLength: t }) => {
|
|
547
887
|
let n = e > t;
|
|
548
|
-
return /* @__PURE__ */
|
|
549
|
-
className:
|
|
888
|
+
return /* @__PURE__ */ x("div", {
|
|
889
|
+
className: D(K["bsy-lexical-editor__length-badge"], n && K["bsy-lexical-editor__length-badge--exceeded"]),
|
|
550
890
|
"aria-live": "polite",
|
|
551
891
|
children: [
|
|
552
892
|
e,
|
|
@@ -555,22 +895,22 @@ var Z = ({ current: e, maxLength: t }) => {
|
|
|
555
895
|
]
|
|
556
896
|
});
|
|
557
897
|
};
|
|
558
|
-
|
|
898
|
+
Ut.displayName = "BsyLexicalEditorLengthBadge";
|
|
559
899
|
//#endregion
|
|
560
900
|
//#region src/components/Editor/utils/textLength.ts
|
|
561
|
-
function
|
|
901
|
+
function Wt(e) {
|
|
562
902
|
return typeof e == "number" && Number.isFinite(e) && e > 0;
|
|
563
903
|
}
|
|
564
|
-
function
|
|
565
|
-
let n =
|
|
904
|
+
function Gt(e, t) {
|
|
905
|
+
let n = k(), r = n.getTextContentSize();
|
|
566
906
|
if (r <= t) return !1;
|
|
567
907
|
let i = r - t;
|
|
568
908
|
n.selectEnd();
|
|
569
|
-
let a =
|
|
570
|
-
return
|
|
909
|
+
let a = A();
|
|
910
|
+
return N(a) ? L(e, a.anchor, i) : Kt(i), !0;
|
|
571
911
|
}
|
|
572
|
-
function
|
|
573
|
-
let t = e, n =
|
|
912
|
+
function Kt(e) {
|
|
913
|
+
let t = e, n = k().getAllTextNodes();
|
|
574
914
|
for (let e = n.length - 1; e >= 0 && t > 0; e--) {
|
|
575
915
|
let r = n[e], i = r.getTextContent();
|
|
576
916
|
i.length !== 0 && (i.length <= t ? (t -= i.length, r.remove()) : (r.setTextContent(i.slice(0, i.length - t)), t = 0));
|
|
@@ -578,17 +918,17 @@ function Le(e) {
|
|
|
578
918
|
}
|
|
579
919
|
//#endregion
|
|
580
920
|
//#region src/components/Editor/EditorCore.tsx
|
|
581
|
-
var
|
|
582
|
-
let { height: t = 126, onChange: n, toolbar: r, theme: i, maxLength: a, onMaxLengthExceed: o } = e, [s] =
|
|
583
|
-
|
|
584
|
-
let
|
|
921
|
+
var qt = (e) => {
|
|
922
|
+
let { height: t = 126, onChange: n, toolbar: r, theme: i, maxLength: a, onMaxLengthExceed: o } = e, [s] = F(), c = T(null), l = T(null), u = T(null), d = T(o);
|
|
923
|
+
d.current = o;
|
|
924
|
+
let f = Wt(a) ? a : void 0, [p, m] = E(0), h = r?.mode === "floating", g = w(() => ({
|
|
585
925
|
containerRef: c,
|
|
586
|
-
toolbarRef:
|
|
587
|
-
getPopupContainer: () =>
|
|
588
|
-
}), [
|
|
926
|
+
toolbarRef: l,
|
|
927
|
+
getPopupContainer: () => h && l.current ? l.current : c.current || document.body
|
|
928
|
+
}), [h]), _ = S((e) => {
|
|
589
929
|
e.read(() => {
|
|
590
|
-
let t =
|
|
591
|
-
|
|
930
|
+
let t = k().getTextContent(), r = _e(s, null), i = !t.trim() && (r === "<p><br></p>" || r === "<p></p>" || r === "" || /^<p>\s*<br>\s*<\/p>$/.test(r)) ? null : r;
|
|
931
|
+
u.current = i, f !== void 0 && m(t.length), n({
|
|
592
932
|
text: t,
|
|
593
933
|
html: i
|
|
594
934
|
}, e);
|
|
@@ -596,77 +936,80 @@ var Q = (e) => {
|
|
|
596
936
|
}, [
|
|
597
937
|
n,
|
|
598
938
|
s,
|
|
599
|
-
|
|
939
|
+
f
|
|
600
940
|
]);
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
941
|
+
C(() => {
|
|
942
|
+
f !== void 0 && s.getEditorState().read(() => {
|
|
943
|
+
m(k().getTextContentSize());
|
|
604
944
|
}, { editor: s });
|
|
605
|
-
}, [s,
|
|
606
|
-
if (e.value !== void 0 && e.value !==
|
|
945
|
+
}, [s, f]), C(() => {
|
|
946
|
+
if (e.value !== void 0 && e.value !== u.current) {
|
|
607
947
|
let t = !1;
|
|
608
948
|
s.update(() => {
|
|
609
|
-
|
|
610
|
-
}), t &&
|
|
949
|
+
k().clear(), e.value && e.value.trim() && (j(ve(s, new DOMParser().parseFromString(e.value, "text/html"))), f !== void 0 && (t = Gt(s, f)));
|
|
950
|
+
}), t && d.current?.();
|
|
611
951
|
}
|
|
612
952
|
}, [
|
|
613
953
|
e.value,
|
|
614
954
|
s,
|
|
615
|
-
|
|
955
|
+
f
|
|
616
956
|
]);
|
|
617
|
-
let
|
|
618
|
-
return /* @__PURE__ */
|
|
619
|
-
value:
|
|
620
|
-
children: /* @__PURE__ */
|
|
957
|
+
let v = r?.config?.length ? r?.config : [], y = $e();
|
|
958
|
+
return /* @__PURE__ */ b(ee.Provider, {
|
|
959
|
+
value: g,
|
|
960
|
+
children: /* @__PURE__ */ x("div", {
|
|
621
961
|
ref: c,
|
|
622
|
-
className:
|
|
962
|
+
className: D(K["bsy-lexical-editor"], h && K["bsy-lexical-editor--floating"]),
|
|
623
963
|
onClick: (e) => {
|
|
624
964
|
let t = s.getRootElement(), n = e.target;
|
|
625
965
|
!t || !n || !t.contains(n) || s.isEditable() || s.setEditable(!0);
|
|
626
966
|
},
|
|
627
967
|
children: [
|
|
628
|
-
|
|
629
|
-
config:
|
|
968
|
+
v.length > 0 && /* @__PURE__ */ b(mt, {
|
|
969
|
+
config: v,
|
|
630
970
|
theme: i?.toolbar,
|
|
631
971
|
style: r?.style,
|
|
632
972
|
mode: r?.mode,
|
|
633
973
|
floating: r?.floating
|
|
634
974
|
}),
|
|
635
|
-
/* @__PURE__ */
|
|
636
|
-
contentEditable: /* @__PURE__ */
|
|
637
|
-
className:
|
|
975
|
+
/* @__PURE__ */ b(fe, {
|
|
976
|
+
contentEditable: /* @__PURE__ */ b(pe, {
|
|
977
|
+
className: D(K["bsy-lexical-editor__content-editable"], f !== void 0 && K["bsy-lexical-editor__content-editable--with-length-badge"]),
|
|
638
978
|
style: {
|
|
639
979
|
height: t,
|
|
640
|
-
cursor:
|
|
980
|
+
cursor: y ? "auto" : "text"
|
|
641
981
|
}
|
|
642
982
|
}),
|
|
643
|
-
ErrorBoundary:
|
|
983
|
+
ErrorBoundary: ge
|
|
644
984
|
}),
|
|
645
|
-
/* @__PURE__ */
|
|
646
|
-
/* @__PURE__ */
|
|
647
|
-
/* @__PURE__ */
|
|
648
|
-
/* @__PURE__ */
|
|
649
|
-
|
|
650
|
-
|
|
985
|
+
/* @__PURE__ */ b(et, {}),
|
|
986
|
+
/* @__PURE__ */ b(tt, {}),
|
|
987
|
+
/* @__PURE__ */ b(vt, {}),
|
|
988
|
+
/* @__PURE__ */ b(St, {}),
|
|
989
|
+
/* @__PURE__ */ b(Tt, {}),
|
|
990
|
+
/* @__PURE__ */ b(Et, {}),
|
|
991
|
+
/* @__PURE__ */ b(Vt, {}),
|
|
992
|
+
f !== void 0 && /* @__PURE__ */ b(Ht, {
|
|
993
|
+
maxLength: f,
|
|
651
994
|
onMaxLengthExceed: o
|
|
652
995
|
}),
|
|
653
|
-
/* @__PURE__ */
|
|
654
|
-
/* @__PURE__ */
|
|
655
|
-
|
|
656
|
-
current:
|
|
657
|
-
maxLength:
|
|
996
|
+
/* @__PURE__ */ b(me, {}),
|
|
997
|
+
/* @__PURE__ */ b(he, { onChange: _ }),
|
|
998
|
+
f !== void 0 && /* @__PURE__ */ b(Ut, {
|
|
999
|
+
current: p,
|
|
1000
|
+
maxLength: f
|
|
658
1001
|
})
|
|
659
1002
|
]
|
|
660
1003
|
})
|
|
661
1004
|
});
|
|
662
1005
|
};
|
|
663
|
-
|
|
1006
|
+
qt.displayName = "BsyLexicalEditorCore";
|
|
664
1007
|
//#endregion
|
|
665
1008
|
//#region src/components/Editor/Editor.tsx
|
|
666
|
-
var
|
|
1009
|
+
var Jt = (e) => {
|
|
667
1010
|
let { autoFocus: t = !1 } = e;
|
|
668
|
-
return /* @__PURE__ */
|
|
669
|
-
initialConfig:
|
|
1011
|
+
return /* @__PURE__ */ b(de, {
|
|
1012
|
+
initialConfig: w(() => ({
|
|
670
1013
|
namespace: "bsyLexicalEditor",
|
|
671
1014
|
onError: (e) => {
|
|
672
1015
|
console.error("Lexical error", e);
|
|
@@ -676,25 +1019,37 @@ var $ = (e) => {
|
|
|
676
1019
|
text: {
|
|
677
1020
|
bold: "editor-text-bold",
|
|
678
1021
|
italic: "editor-text-italic",
|
|
679
|
-
underline: "editor-text-underline"
|
|
1022
|
+
underline: "editor-text-underline",
|
|
1023
|
+
strikethrough: "editor-text-strikethrough",
|
|
1024
|
+
underlineStrikethrough: "editor-text-underline-strikethrough"
|
|
1025
|
+
},
|
|
1026
|
+
list: {
|
|
1027
|
+
ul: "editor-list-ul",
|
|
1028
|
+
ol: "editor-list-ol",
|
|
1029
|
+
listitem: "editor-listitem"
|
|
680
1030
|
},
|
|
1031
|
+
code: "editor-code",
|
|
681
1032
|
link: "editor-link"
|
|
682
1033
|
},
|
|
683
1034
|
nodes: [
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
1035
|
+
Ke,
|
|
1036
|
+
Ge,
|
|
1037
|
+
Ye,
|
|
1038
|
+
Je,
|
|
1039
|
+
U,
|
|
1040
|
+
H,
|
|
1041
|
+
X,
|
|
1042
|
+
q,
|
|
688
1043
|
{
|
|
689
|
-
replace:
|
|
690
|
-
with: (e) => new
|
|
691
|
-
withKlass:
|
|
1044
|
+
replace: P,
|
|
1045
|
+
with: (e) => new q(e.__text),
|
|
1046
|
+
withKlass: q
|
|
692
1047
|
}
|
|
693
1048
|
]
|
|
694
1049
|
}), [t]),
|
|
695
|
-
children: /* @__PURE__ */
|
|
1050
|
+
children: /* @__PURE__ */ b(qt, { ...e })
|
|
696
1051
|
});
|
|
697
1052
|
};
|
|
698
|
-
|
|
1053
|
+
Jt.displayName = "BsyLexicalEditor";
|
|
699
1054
|
//#endregion
|
|
700
|
-
export {
|
|
1055
|
+
export { we as $getRoot, v as BaseButton, Jt as default, _ as listRegisteredToolbarButtons, d as registerToolbarButton, a as unregisterToolbarButton, Be as useLexicalComposerContext };
|