@baishuyun/ui-base 6.10.0 → 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/{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-CvRHhN42.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-BS0nzK4h.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-DVwg07Gs.js +174 -0
- package/dist/ColorPicker/index.js +7 -6
- package/dist/ConfigProvider/index.js +4 -3
- package/dist/DatePicker/DatePicker-DNPnHLT2.js +101 -0
- package/dist/DatePicker/{DatePickerPanel-Bz3uvbYF.js → DatePickerPanel-TS6AxAH-.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-DWf5yf4l.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-BBioCubp.js +1148 -0
- package/dist/Editor/ToolbarPlugin/Buttons/index.js +17 -16
- package/dist/Editor/constants/index.js +3 -3
- package/dist/Editor/index.js +1015 -257
- package/dist/Gantt/GanttChart/index.js +18 -17
- package/dist/Gantt/{GanttChart-6gpw5vi6.js → GanttChart-BaEW7EDO.js} +8 -10
- package/dist/Gantt/GanttTable/index.js +11 -11
- package/dist/Gantt/{GanttTable-lVu-YUtt.js → GanttTable-CdXhMHF6.js} +5 -5
- package/dist/Gantt/GanttToolBar/index.js +14 -13
- package/dist/Gantt/{GanttToolBar-CarBWZg-.js → GanttToolBar-COwsYlMG.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-Jpm8H32L.js} +2 -2
- package/dist/InputTag/index.js +5 -5
- package/dist/Loading/{Loading-CVyzO5-s.js → Loading-CiRe7i2R.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-BY5Rpo3f.js +753 -0
- package/dist/Select/{SelectInputSearch-CrGW_eVo.js → SelectInputSearch-i3egm8Wy.js} +1 -1
- package/dist/Select/index.js +14 -13
- package/dist/Table/{Table-CL-KfNY3.js → Table-CSPdFGYn.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-C0m3mt-j.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/HeadingButton.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/SourceButton.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/TableButton.d.ts +2 -0
- package/dist/components/Editor/ToolbarPlugin/Buttons/UndoButton.d.ts +2 -0
- package/dist/components/Editor/ToolbarPlugin/Buttons/index.d.ts +13 -0
- package/dist/components/Editor/ToolbarPlugin/context/HistoryStateProvider.d.ts +8 -0
- package/dist/components/Editor/ToolbarPlugin/context/TextFormatsContext.d.ts +10 -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 +3 -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/CodeHighlightPlugin.d.ts +1 -0
- 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/PasteStripImagePlugin.d.ts +1 -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/codeHighlighter.d.ts +12 -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/formatTruncatedFilename.d.ts +4 -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/stripImagesFromHtml.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/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 +21 -2
- package/dist/locale/lang/zh-CN.json.d.ts +21 -2
- package/dist/locale/lang/zh-TW.json.d.ts +21 -2
- package/dist/style.css +1 -1
- package/dist/vendors/{ConfigProvider-DxrZpdIb.js → ConfigProvider-4xHyyeop.js} +84 -36
- package/dist/vendors/{LocaleContext-Dcw6C1LX.js → LocaleContext-I4PW9j4M.js} +21 -2
- package/dist/vendors/{Tree-D1s-eADo.js → Tree-B09frqQX.js} +3 -2
- package/dist/vendors/{useLocale-BKZX2_zw.js → useLocale-FGYsRWSe.js} +1 -1
- package/dist/vendors/{version-L-kG2La0.js → version-BxI5QM5W.js} +1 -1
- package/package.json +10 -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,64 @@
|
|
|
1
|
-
import "../vendors/version-
|
|
1
|
+
import "../vendors/version-BxI5QM5W.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-I4PW9j4M.js";
|
|
5
|
+
import "../Overlay/OverlayContext-CVSFoyqN.js";
|
|
6
|
+
import "../Modal/Modal-Cb7Msq26.js";
|
|
7
|
+
import "../ColorPicker/ColorPicker-DVwg07Gs.js";
|
|
8
|
+
import "../vendors/useFloatingOverlay-B3M9k8nj.js";
|
|
9
|
+
import { t } from "../vendors/useLocale-FGYsRWSe.js";
|
|
10
|
+
import "../vendors/useLatchedPopupPortalRoot-4fVhqVT4.js";
|
|
11
|
+
import { t as n } from "../vendors/cssVars-l4-kP_14.js";
|
|
12
|
+
import "../Select/SelectInputSearch-i3egm8Wy.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-DWf5yf4l.js";
|
|
19
|
+
import "../DropDown/style-LLDVPpPa.js";
|
|
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";
|
|
39
47
|
//#region src/components/Editor/utils/resolveEditorToolbarThemeVars.ts
|
|
40
|
-
var
|
|
48
|
+
var J = (e) => {
|
|
41
49
|
if (!(e === void 0 || e === "")) return typeof e == "number" ? `${e}px` : e;
|
|
42
|
-
},
|
|
43
|
-
if (!
|
|
44
|
-
let
|
|
45
|
-
return
|
|
46
|
-
},
|
|
50
|
+
}, wt = (e) => {
|
|
51
|
+
if (!e) return {};
|
|
52
|
+
let t = {};
|
|
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) => {
|
|
47
55
|
if (typeof e == "number" && Number.isFinite(e)) return e;
|
|
48
56
|
if (typeof e == "string") {
|
|
49
57
|
let t = Number.parseFloat(e);
|
|
50
58
|
if (Number.isFinite(t)) return t;
|
|
51
59
|
}
|
|
52
60
|
return 14;
|
|
53
|
-
},
|
|
61
|
+
}, Et = (e) => {
|
|
54
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 = {
|
|
55
63
|
position: "absolute",
|
|
56
64
|
[a ? "bottom" : "top"]: "100%",
|
|
@@ -60,43 +68,76 @@ var H = (e) => {
|
|
|
60
68
|
width: "100%"
|
|
61
69
|
};
|
|
62
70
|
return r && (o.transform = `translateX(${r}px)`), o;
|
|
63
|
-
}, U = {
|
|
64
|
-
"bsy-lexical__toolbar": "_bsy-lexical__toolbar_3xekt_1",
|
|
65
|
-
"bsy-lexical__toolbar--floating": "_bsy-lexical__toolbar--floating_3xekt_10",
|
|
66
|
-
"bsy-lexical__toolbar-group": "_bsy-lexical__toolbar-group_3xekt_16",
|
|
67
|
-
"bsy-lexical__toolbar-divider": "_bsy-lexical__toolbar-divider_3xekt_22"
|
|
68
71
|
};
|
|
69
72
|
//#endregion
|
|
70
73
|
//#region src/components/Editor/hooks/useTextFormatsState.ts
|
|
71
|
-
function
|
|
72
|
-
let [e] =
|
|
74
|
+
function Dt() {
|
|
75
|
+
let [e] = R(), [t, n] = O({
|
|
73
76
|
bold: !1,
|
|
74
77
|
italic: !1,
|
|
75
78
|
underline: !1,
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
+
strikethrough: !1,
|
|
80
|
+
superscript: !1,
|
|
81
|
+
subscript: !1,
|
|
82
|
+
fontSize: re,
|
|
83
|
+
fontColor: ne,
|
|
84
|
+
backgroundColor: te,
|
|
79
85
|
align: "left",
|
|
86
|
+
listType: !1,
|
|
87
|
+
canOutdent: !1,
|
|
88
|
+
isCodeBlock: !1,
|
|
89
|
+
isInTable: !1,
|
|
90
|
+
headingTag: !1,
|
|
91
|
+
codeLanguage: i,
|
|
80
92
|
link: void 0
|
|
81
93
|
});
|
|
82
|
-
return
|
|
94
|
+
return T(() => e.registerUpdateListener(({ editorState: e }) => {
|
|
83
95
|
e.read(() => {
|
|
84
96
|
let e = M();
|
|
85
|
-
if (
|
|
86
|
-
|
|
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) => {
|
|
87
108
|
let t = e.getParent();
|
|
88
|
-
return t !== null &&
|
|
109
|
+
return t !== null && Oe(t);
|
|
89
110
|
});
|
|
90
111
|
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()
|
|
112
|
+
let s = {}, c = V(a, Ze);
|
|
113
|
+
c ? (s.link = c.getURL(), s.linkText = c.getTextContent(), s.newBlank = c.getTarget() === "_blank") : s.linkText = e.getTextContent();
|
|
114
|
+
let l = V(a, H), u = !1, d = De(o) ? o.getIndent() : 0;
|
|
115
|
+
if (H(l)) {
|
|
116
|
+
d = l.getIndent();
|
|
117
|
+
let e = l.getParent();
|
|
118
|
+
if (et(e)) {
|
|
119
|
+
let t = e.getListType();
|
|
120
|
+
u = t === "number" || t === "bullet" ? t : !1;
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
let f = V(a, U), p = V(a, vt), m = vt(p) ? p.getTag() : void 0;
|
|
124
|
+
n({
|
|
93
125
|
bold: e.hasFormat("bold"),
|
|
94
126
|
italic: e.hasFormat("italic"),
|
|
95
127
|
underline: e.hasFormat("underline"),
|
|
128
|
+
strikethrough: e.hasFormat("strikethrough"),
|
|
129
|
+
superscript: e.hasFormat("superscript"),
|
|
130
|
+
subscript: e.hasFormat("subscript"),
|
|
96
131
|
fontSize: t,
|
|
97
132
|
fontColor: r,
|
|
98
133
|
backgroundColor: i,
|
|
99
|
-
align:
|
|
134
|
+
align: De(o) ? o.getFormatType() : "left",
|
|
135
|
+
listType: u,
|
|
136
|
+
canOutdent: d > 0 || u !== !1,
|
|
137
|
+
isCodeBlock: !!f,
|
|
138
|
+
isInTable: !!V(a, K),
|
|
139
|
+
headingTag: m === "h1" || m === "h2" || m === "h3" ? m : !1,
|
|
140
|
+
codeLanguage: x(f?.getLanguage()),
|
|
100
141
|
link: s
|
|
101
142
|
});
|
|
102
143
|
}
|
|
@@ -105,14 +146,150 @@ function Ce() {
|
|
|
105
146
|
}
|
|
106
147
|
//#endregion
|
|
107
148
|
//#region src/components/Editor/ToolbarPlugin/context/TextFormatProvider.tsx
|
|
108
|
-
var
|
|
109
|
-
let t =
|
|
110
|
-
return /* @__PURE__ */
|
|
149
|
+
var Ot = (e) => {
|
|
150
|
+
let t = Dt();
|
|
151
|
+
return /* @__PURE__ */ S(ee.Provider, {
|
|
111
152
|
value: t,
|
|
112
153
|
children: e.children
|
|
113
154
|
});
|
|
114
|
-
},
|
|
115
|
-
let
|
|
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) => ({
|
|
160
|
+
key: e.id,
|
|
161
|
+
label: e.label
|
|
162
|
+
})), Mt = () => {
|
|
163
|
+
let [n] = R(), { codeLanguage: i } = p(), { t: a } = t(), { iconSize: s } = l(), c = w((e) => {
|
|
164
|
+
let t = e.key;
|
|
165
|
+
n.update(() => {
|
|
166
|
+
let e = M();
|
|
167
|
+
F(e) && V(e.anchor.getNode(), U)?.setLanguage(t);
|
|
168
|
+
});
|
|
169
|
+
}, [n]), d = u[i].label;
|
|
170
|
+
return /* @__PURE__ */ S(r, {
|
|
171
|
+
menus: jt,
|
|
172
|
+
onClick: c,
|
|
173
|
+
activeKey: [i],
|
|
174
|
+
showSearch: !1,
|
|
175
|
+
style: {
|
|
176
|
+
width: 120,
|
|
177
|
+
minWidth: 120
|
|
178
|
+
},
|
|
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, {
|
|
187
|
+
name: "arrow-down",
|
|
188
|
+
size: s,
|
|
189
|
+
className: o["bsy-lexical__toolbar-select-arrow"]
|
|
190
|
+
})] }),
|
|
191
|
+
tooltip: a("editor.codeLanguage")
|
|
192
|
+
})
|
|
193
|
+
})
|
|
194
|
+
});
|
|
195
|
+
}, Nt = {
|
|
196
|
+
initial: {
|
|
197
|
+
opacity: 0,
|
|
198
|
+
x: 6
|
|
199
|
+
},
|
|
200
|
+
animate: {
|
|
201
|
+
opacity: 1,
|
|
202
|
+
x: 0
|
|
203
|
+
},
|
|
204
|
+
exit: {
|
|
205
|
+
opacity: 0,
|
|
206
|
+
x: -6
|
|
207
|
+
}
|
|
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
|
+
];
|
|
226
|
+
if (t) return [
|
|
227
|
+
{
|
|
228
|
+
kind: "button",
|
|
229
|
+
key: "undo",
|
|
230
|
+
name: "undo"
|
|
231
|
+
},
|
|
232
|
+
{
|
|
233
|
+
kind: "button",
|
|
234
|
+
key: "redo",
|
|
235
|
+
name: "redo"
|
|
236
|
+
},
|
|
237
|
+
{
|
|
238
|
+
kind: "divider",
|
|
239
|
+
key: "divider-code"
|
|
240
|
+
},
|
|
241
|
+
{
|
|
242
|
+
kind: "button",
|
|
243
|
+
key: "code-block-toggle",
|
|
244
|
+
name: "code"
|
|
245
|
+
},
|
|
246
|
+
{
|
|
247
|
+
kind: "language",
|
|
248
|
+
key: "code-language"
|
|
249
|
+
}
|
|
250
|
+
];
|
|
251
|
+
let r = [];
|
|
252
|
+
return e.forEach((t, n) => {
|
|
253
|
+
t.buttons.forEach((e) => {
|
|
254
|
+
let t = Pt(e);
|
|
255
|
+
r.push({
|
|
256
|
+
kind: "button",
|
|
257
|
+
key: t,
|
|
258
|
+
name: t,
|
|
259
|
+
props: typeof e == "string" ? void 0 : e.props
|
|
260
|
+
});
|
|
261
|
+
}), n < e.length - 1 && r.push({
|
|
262
|
+
kind: "divider",
|
|
263
|
+
key: `divider-${t.key}`
|
|
264
|
+
});
|
|
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,
|
|
272
|
+
ease: "easeOut"
|
|
273
|
+
}, s = r ? {} : Nt;
|
|
274
|
+
return /* @__PURE__ */ S(le, {
|
|
275
|
+
initial: !1,
|
|
276
|
+
mode: "popLayout",
|
|
277
|
+
children: i.map((e) => {
|
|
278
|
+
let t = null;
|
|
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"],
|
|
281
|
+
layout: "position",
|
|
282
|
+
transition: a,
|
|
283
|
+
...s,
|
|
284
|
+
children: t
|
|
285
|
+
}, e.key);
|
|
286
|
+
})
|
|
287
|
+
});
|
|
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 = {
|
|
290
|
+
duration: u ? 0 : .16,
|
|
291
|
+
ease: "easeOut"
|
|
292
|
+
}, f = E(() => wt(r), [r]), p = E(() => ({ iconSize: Tt(r?.iconSize) }), [r?.iconSize]), m = l ? Et(a) : void 0, h = l ? ie(n, [
|
|
116
293
|
"position",
|
|
117
294
|
"left",
|
|
118
295
|
"top",
|
|
@@ -122,35 +299,30 @@ var we = (e) => {
|
|
|
122
299
|
"transform",
|
|
123
300
|
"marginTop",
|
|
124
301
|
"marginBottom"
|
|
125
|
-
]) :
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
className: w(U["bsy-lexical__toolbar"], l && U["bsy-lexical__toolbar--floating"]),
|
|
302
|
+
]) : n;
|
|
303
|
+
return /* @__PURE__ */ S(c, {
|
|
304
|
+
value: p,
|
|
305
|
+
children: /* @__PURE__ */ S(_, { children: /* @__PURE__ */ S(Ot, { children: /* @__PURE__ */ S(ue.div, {
|
|
306
|
+
ref: s,
|
|
307
|
+
layout: !u,
|
|
308
|
+
transition: d,
|
|
309
|
+
className: k(o["bsy-lexical__toolbar"], l && o["bsy-lexical__toolbar--floating"]),
|
|
134
310
|
style: {
|
|
135
|
-
...
|
|
136
|
-
...
|
|
311
|
+
...f,
|
|
312
|
+
...m,
|
|
137
313
|
...h
|
|
138
314
|
},
|
|
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
|
-
}) })
|
|
315
|
+
children: /* @__PURE__ */ S(Lt, { config: t })
|
|
316
|
+
}) }) })
|
|
145
317
|
});
|
|
146
|
-
},
|
|
318
|
+
}, Y = {
|
|
147
319
|
"bsy-lexical-editor": "_bsy-lexical-editor_1bhfo_1",
|
|
148
320
|
"bsy-lexical-editor--floating": "_bsy-lexical-editor--floating_1bhfo_7",
|
|
149
321
|
"bsy-lexical-editor__content-editable": "_bsy-lexical-editor__content-editable_1bhfo_10",
|
|
150
322
|
"bsy-lexical-editor__content-editable--with-length-badge": "_bsy-lexical-editor__content-editable--with-length-badge_1bhfo_17",
|
|
151
323
|
"bsy-lexical-editor__length-badge": "_bsy-lexical-editor__length-badge_1bhfo_20",
|
|
152
324
|
"bsy-lexical-editor__length-badge--exceeded": "_bsy-lexical-editor__length-badge--exceeded_1bhfo_36"
|
|
153
|
-
},
|
|
325
|
+
}, X = class e extends L {
|
|
154
326
|
constructor(e, t) {
|
|
155
327
|
super(e, t);
|
|
156
328
|
}
|
|
@@ -161,46 +333,46 @@ var we = (e) => {
|
|
|
161
333
|
return new e(t.__text, t.__key);
|
|
162
334
|
}
|
|
163
335
|
static importDOM() {
|
|
164
|
-
let e =
|
|
336
|
+
let e = L.importDOM();
|
|
165
337
|
return {
|
|
166
338
|
...e,
|
|
167
339
|
code: () => ({
|
|
168
|
-
conversion:
|
|
340
|
+
conversion: Z(e?.code),
|
|
169
341
|
priority: 1
|
|
170
342
|
}),
|
|
171
343
|
em: () => ({
|
|
172
|
-
conversion:
|
|
344
|
+
conversion: Z(e?.em),
|
|
173
345
|
priority: 1
|
|
174
346
|
}),
|
|
175
347
|
span: () => ({
|
|
176
|
-
conversion:
|
|
348
|
+
conversion: Z(e?.span),
|
|
177
349
|
priority: 1
|
|
178
350
|
}),
|
|
179
351
|
strong: () => ({
|
|
180
|
-
conversion:
|
|
352
|
+
conversion: Z(e?.strong),
|
|
181
353
|
priority: 1
|
|
182
354
|
}),
|
|
183
355
|
sub: () => ({
|
|
184
|
-
conversion:
|
|
356
|
+
conversion: Z(e?.sub),
|
|
185
357
|
priority: 1
|
|
186
358
|
}),
|
|
187
359
|
sup: () => ({
|
|
188
|
-
conversion:
|
|
360
|
+
conversion: Z(e?.sup),
|
|
189
361
|
priority: 1
|
|
190
362
|
})
|
|
191
363
|
};
|
|
192
364
|
}
|
|
193
365
|
static importJSON(e) {
|
|
194
|
-
return
|
|
366
|
+
return zt().updateFromJSON(e);
|
|
195
367
|
}
|
|
196
368
|
isSimpleText() {
|
|
197
369
|
return this.__type === "extended-text" && this.__mode === 0;
|
|
198
370
|
}
|
|
199
371
|
};
|
|
200
|
-
function
|
|
201
|
-
return
|
|
372
|
+
function zt(e = "") {
|
|
373
|
+
return be(new X(e));
|
|
202
374
|
}
|
|
203
|
-
function
|
|
375
|
+
function Z(e) {
|
|
204
376
|
return (t) => {
|
|
205
377
|
let n = e?.(t);
|
|
206
378
|
if (!n) return null;
|
|
@@ -211,7 +383,7 @@ function K(e) {
|
|
|
211
383
|
...r,
|
|
212
384
|
forChild: (e, t) => {
|
|
213
385
|
let n = (r?.forChild ?? ((e) => e))(e, t);
|
|
214
|
-
if (
|
|
386
|
+
if (Ae(n)) {
|
|
215
387
|
let e = [
|
|
216
388
|
i ? `background-color: ${i}` : null,
|
|
217
389
|
a ? `color: ${a}` : null,
|
|
@@ -228,22 +400,24 @@ function K(e) {
|
|
|
228
400
|
};
|
|
229
401
|
}
|
|
230
402
|
//#endregion
|
|
231
|
-
//#region src/components/Editor/
|
|
232
|
-
function
|
|
233
|
-
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("; ");
|
|
234
406
|
}
|
|
235
|
-
|
|
236
|
-
|
|
407
|
+
//#endregion
|
|
408
|
+
//#region src/components/Editor/plugins/LinkColorPlugin.tsx
|
|
409
|
+
function Vt(e) {
|
|
410
|
+
if (!V(e, Ze)) return;
|
|
237
411
|
let t = e.getStyle();
|
|
238
412
|
if (!t) return;
|
|
239
|
-
let n =
|
|
413
|
+
let n = Bt(t, "color");
|
|
240
414
|
n !== t && e.setStyle(n);
|
|
241
415
|
}
|
|
242
|
-
function
|
|
243
|
-
let [e] =
|
|
244
|
-
return
|
|
416
|
+
function Ht() {
|
|
417
|
+
let [e] = R();
|
|
418
|
+
return T(() => e.registerNodeTransform(X, Vt), [e]), null;
|
|
245
419
|
}
|
|
246
|
-
var
|
|
420
|
+
var Q = {
|
|
247
421
|
imageWrapper: "_imageWrapper_y06h3_1",
|
|
248
422
|
selected: "_selected_y06h3_8",
|
|
249
423
|
resizing: "_resizing_y06h3_12",
|
|
@@ -253,16 +427,16 @@ var q = {
|
|
|
253
427
|
topRight: "_topRight_y06h3_49",
|
|
254
428
|
bottomLeft: "_bottomLeft_y06h3_54",
|
|
255
429
|
bottomRight: "_bottomRight_y06h3_59"
|
|
256
|
-
},
|
|
257
|
-
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({
|
|
258
432
|
width: n || void 0,
|
|
259
433
|
height: r || void 0
|
|
260
|
-
}), p =
|
|
434
|
+
}), p = w(() => {
|
|
261
435
|
n && r && f({
|
|
262
436
|
width: n,
|
|
263
437
|
height: r
|
|
264
438
|
});
|
|
265
|
-
}, [n, r]), m =
|
|
439
|
+
}, [n, r]), m = w((e, t) => {
|
|
266
440
|
if (e.preventDefault(), e.stopPropagation(), !u.current) return;
|
|
267
441
|
let n = d.width || u.current.offsetWidth, r = d.height || u.current.offsetHeight, i = n / r;
|
|
268
442
|
(!d.width || !d.height) && f({
|
|
@@ -277,7 +451,7 @@ var q = {
|
|
|
277
451
|
aspectRatio: i,
|
|
278
452
|
direction: t
|
|
279
453
|
});
|
|
280
|
-
}, [d]),
|
|
454
|
+
}, [d]), h = w((e) => {
|
|
281
455
|
if (!c?.isResizing) return;
|
|
282
456
|
let t = e.clientX - c.startX, n;
|
|
283
457
|
switch (c.direction) {
|
|
@@ -300,10 +474,10 @@ var q = {
|
|
|
300
474
|
width: n,
|
|
301
475
|
height: r
|
|
302
476
|
});
|
|
303
|
-
}, [c]),
|
|
477
|
+
}, [c]), g = w(() => {
|
|
304
478
|
c?.isResizing && (a.update(() => {
|
|
305
479
|
let e = A(i);
|
|
306
|
-
|
|
480
|
+
Kt(e) && e.setWidthAndHeight(d.width, d.height);
|
|
307
481
|
}), l(null));
|
|
308
482
|
}, [
|
|
309
483
|
a,
|
|
@@ -311,71 +485,71 @@ var q = {
|
|
|
311
485
|
d,
|
|
312
486
|
c
|
|
313
487
|
]);
|
|
314
|
-
|
|
315
|
-
if (c?.isResizing) return document.addEventListener("mousemove",
|
|
316
|
-
document.removeEventListener("mousemove",
|
|
488
|
+
oe.useEffect(() => {
|
|
489
|
+
if (c?.isResizing) return document.addEventListener("mousemove", h), document.addEventListener("mouseup", g), () => {
|
|
490
|
+
document.removeEventListener("mousemove", h), document.removeEventListener("mouseup", g);
|
|
317
491
|
};
|
|
318
492
|
}, [
|
|
319
493
|
c,
|
|
320
|
-
|
|
321
|
-
|
|
494
|
+
h,
|
|
495
|
+
g
|
|
322
496
|
]);
|
|
323
|
-
let
|
|
497
|
+
let _ = w(() => {
|
|
324
498
|
s(!0);
|
|
325
499
|
}, []);
|
|
326
|
-
return
|
|
500
|
+
return T(() => a.registerUpdateListener(({ editorState: e }) => {
|
|
327
501
|
e.read(() => {
|
|
328
502
|
let e = M();
|
|
329
|
-
|
|
503
|
+
F(e) && !e.getNodes().some((e) => e.getKey() === i || e.getParent() && e.getParent()?.getKey() === i) && o && s(!1);
|
|
330
504
|
});
|
|
331
505
|
}), [
|
|
332
506
|
a,
|
|
333
507
|
i,
|
|
334
508
|
o
|
|
335
|
-
]),
|
|
509
|
+
]), T(() => {
|
|
336
510
|
let e = (e) => {
|
|
337
511
|
o && u.current && !u.current.contains(e.target) && s(!1);
|
|
338
512
|
};
|
|
339
513
|
if (o) return document.addEventListener("mousedown", e), () => {
|
|
340
514
|
document.removeEventListener("mousedown", e);
|
|
341
515
|
};
|
|
342
|
-
}, [o]), /* @__PURE__ */
|
|
343
|
-
className:
|
|
344
|
-
[
|
|
345
|
-
[
|
|
516
|
+
}, [o]), /* @__PURE__ */ C("div", {
|
|
517
|
+
className: k(Q.imageWrapper, {
|
|
518
|
+
[Q.selected]: o,
|
|
519
|
+
[Q.resizing]: c?.isResizing
|
|
346
520
|
}),
|
|
347
|
-
children: [/* @__PURE__ */
|
|
521
|
+
children: [/* @__PURE__ */ S("img", {
|
|
348
522
|
ref: u,
|
|
349
523
|
src: e,
|
|
350
524
|
alt: t,
|
|
351
|
-
className:
|
|
525
|
+
className: Q.image,
|
|
352
526
|
style: {
|
|
353
527
|
width: d.width,
|
|
354
528
|
height: d.height
|
|
355
529
|
},
|
|
356
530
|
onLoad: p,
|
|
357
|
-
onClick:
|
|
531
|
+
onClick: _,
|
|
358
532
|
draggable: !1
|
|
359
|
-
}), o && /* @__PURE__ */
|
|
360
|
-
/* @__PURE__ */
|
|
361
|
-
className:
|
|
533
|
+
}), o && /* @__PURE__ */ C(ae, { children: [
|
|
534
|
+
/* @__PURE__ */ S("div", {
|
|
535
|
+
className: k(Q.resizeHandle, Q.bottomRight),
|
|
362
536
|
onMouseDown: (e) => m(e, "bottom-right")
|
|
363
537
|
}),
|
|
364
|
-
/* @__PURE__ */
|
|
365
|
-
className:
|
|
538
|
+
/* @__PURE__ */ S("div", {
|
|
539
|
+
className: k(Q.resizeHandle, Q.bottomLeft),
|
|
366
540
|
onMouseDown: (e) => m(e, "bottom-left")
|
|
367
541
|
}),
|
|
368
|
-
/* @__PURE__ */
|
|
369
|
-
className:
|
|
542
|
+
/* @__PURE__ */ S("div", {
|
|
543
|
+
className: k(Q.resizeHandle, Q.topRight),
|
|
370
544
|
onMouseDown: (e) => m(e, "top-right")
|
|
371
545
|
}),
|
|
372
|
-
/* @__PURE__ */
|
|
373
|
-
className:
|
|
546
|
+
/* @__PURE__ */ S("div", {
|
|
547
|
+
className: k(Q.resizeHandle, Q.topLeft),
|
|
374
548
|
onMouseDown: (e) => m(e, "top-left")
|
|
375
549
|
})
|
|
376
550
|
] })]
|
|
377
551
|
});
|
|
378
|
-
},
|
|
552
|
+
}, Wt = class e extends Le {
|
|
379
553
|
static getType() {
|
|
380
554
|
return "image";
|
|
381
555
|
}
|
|
@@ -421,7 +595,7 @@ var q = {
|
|
|
421
595
|
n.__width = e, n.__height = t;
|
|
422
596
|
}
|
|
423
597
|
decorate() {
|
|
424
|
-
return /* @__PURE__ */
|
|
598
|
+
return /* @__PURE__ */ S(Ut, {
|
|
425
599
|
src: this.__src,
|
|
426
600
|
altText: this.__altText,
|
|
427
601
|
width: this.__width,
|
|
@@ -431,13 +605,13 @@ var q = {
|
|
|
431
605
|
}
|
|
432
606
|
static importDOM() {
|
|
433
607
|
return { img: () => ({
|
|
434
|
-
conversion:
|
|
608
|
+
conversion: qt,
|
|
435
609
|
priority: 0
|
|
436
610
|
}) };
|
|
437
611
|
}
|
|
438
612
|
static importJSON(e) {
|
|
439
613
|
let { src: t, altText: n, width: r, height: i } = e;
|
|
440
|
-
return
|
|
614
|
+
return Gt({
|
|
441
615
|
src: t,
|
|
442
616
|
altText: n,
|
|
443
617
|
width: r,
|
|
@@ -458,13 +632,13 @@ var q = {
|
|
|
458
632
|
return !0;
|
|
459
633
|
}
|
|
460
634
|
};
|
|
461
|
-
function
|
|
462
|
-
return new
|
|
635
|
+
function Gt({ src: e, altText: t, width: n, height: r, key: i }) {
|
|
636
|
+
return new Wt(e, t, n, r, i);
|
|
463
637
|
}
|
|
464
|
-
function
|
|
465
|
-
return e instanceof
|
|
638
|
+
function Kt(e) {
|
|
639
|
+
return e instanceof Wt;
|
|
466
640
|
}
|
|
467
|
-
function
|
|
641
|
+
function qt(e) {
|
|
468
642
|
if (e instanceof HTMLImageElement) {
|
|
469
643
|
let { src: t, alt: n, style: r } = e, i, a;
|
|
470
644
|
if (r.width) {
|
|
@@ -475,7 +649,7 @@ function Me(e) {
|
|
|
475
649
|
let e = parseInt(r.height, 10);
|
|
476
650
|
isNaN(e) || (a = e);
|
|
477
651
|
}
|
|
478
|
-
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({
|
|
479
653
|
src: t,
|
|
480
654
|
altText: n,
|
|
481
655
|
width: i,
|
|
@@ -486,23 +660,63 @@ function Me(e) {
|
|
|
486
660
|
}
|
|
487
661
|
//#endregion
|
|
488
662
|
//#region src/components/Editor/plugins/ImagePlugin.tsx
|
|
489
|
-
function
|
|
490
|
-
let [e] =
|
|
491
|
-
return
|
|
663
|
+
function Jt() {
|
|
664
|
+
let [e] = R();
|
|
665
|
+
return T(() => e.registerCommand(s, (e) => (N([Gt(e)]), !0), Pe), [e]), null;
|
|
666
|
+
}
|
|
667
|
+
//#endregion
|
|
668
|
+
//#region src/components/Editor/utils/stripImagesFromHtml.ts
|
|
669
|
+
function Yt(e) {
|
|
670
|
+
let t = new DOMParser().parseFromString(e, "text/html");
|
|
671
|
+
return t.querySelectorAll("img, picture").forEach((e) => e.remove()), t.body.innerHTML;
|
|
672
|
+
}
|
|
673
|
+
//#endregion
|
|
674
|
+
//#region src/components/Editor/plugins/PasteStripImagePlugin.tsx
|
|
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();
|
|
689
|
+
if (t === null) return;
|
|
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"));
|
|
693
|
+
if (t.length) {
|
|
694
|
+
N(t);
|
|
695
|
+
return;
|
|
696
|
+
}
|
|
697
|
+
}
|
|
698
|
+
a && t.insertRawText(a);
|
|
699
|
+
}, { tag: Ue }), !0;
|
|
700
|
+
};
|
|
701
|
+
return Xe(e.registerCommand(He, (e) => n(e), I), e.registerCommand(Ie, (e) => n(e), I));
|
|
702
|
+
}, [e, t]), null;
|
|
492
703
|
}
|
|
493
704
|
//#endregion
|
|
494
705
|
//#region src/components/Editor/plugins/EnterKeyPlugin.tsx
|
|
495
|
-
function
|
|
496
|
-
let [e] =
|
|
497
|
-
return
|
|
706
|
+
function Qt() {
|
|
707
|
+
let [e] = R(), t = D(0);
|
|
708
|
+
return T(() => e.registerCommand(Be, (n) => {
|
|
498
709
|
let r = Date.now(), i = r - t.current;
|
|
499
|
-
return t.current = r, i < 250 && i > 0 ?
|
|
710
|
+
return t.current = r, i < 250 && i > 0 ? e.getEditorState().read(() => {
|
|
711
|
+
let e = M();
|
|
712
|
+
return F(e) ? !!V(e.anchor.getNode(), (e) => H(e) || U(e) || K(e)) : !1;
|
|
713
|
+
}, { editor: e }) ? !1 : (e.update(() => {
|
|
500
714
|
let e = M();
|
|
501
|
-
if (
|
|
715
|
+
if (F(e)) {
|
|
502
716
|
let t = e.anchor.getNode().getTopLevelElement();
|
|
503
717
|
if (t && t.getTextContent().trim() === "") {
|
|
504
|
-
let n =
|
|
505
|
-
|
|
718
|
+
let n = Se();
|
|
719
|
+
Je(e, {
|
|
506
720
|
"background-color": "",
|
|
507
721
|
color: "",
|
|
508
722
|
"font-size": "",
|
|
@@ -515,61 +729,402 @@ function X() {
|
|
|
515
729
|
}
|
|
516
730
|
}
|
|
517
731
|
}), n?.preventDefault(), !0) : !1;
|
|
518
|
-
},
|
|
732
|
+
}, Fe), [e]), null;
|
|
733
|
+
}
|
|
734
|
+
//#endregion
|
|
735
|
+
//#region src/components/Editor/utils/codeHighlighter.ts
|
|
736
|
+
var $t = {
|
|
737
|
+
css: () => import("@shikijs/langs/css"),
|
|
738
|
+
html: () => import("@shikijs/langs/html"),
|
|
739
|
+
xml: () => import("@shikijs/langs/xml"),
|
|
740
|
+
javascript: () => import("@shikijs/langs/javascript"),
|
|
741
|
+
typescript: () => import("@shikijs/langs/typescript"),
|
|
742
|
+
jsx: () => import("@shikijs/langs/jsx"),
|
|
743
|
+
go: () => import("@shikijs/langs/go"),
|
|
744
|
+
php: () => import("@shikijs/langs/php"),
|
|
745
|
+
c: () => import("@shikijs/langs/c"),
|
|
746
|
+
python: () => import("@shikijs/langs/python"),
|
|
747
|
+
java: () => import("@shikijs/langs/java"),
|
|
748
|
+
cpp: () => import("@shikijs/langs/cpp"),
|
|
749
|
+
csharp: () => import("@shikijs/langs/csharp"),
|
|
750
|
+
vb: () => import("@shikijs/langs/vb"),
|
|
751
|
+
sql: () => import("@shikijs/langs/sql"),
|
|
752
|
+
ruby: () => import("@shikijs/langs/ruby"),
|
|
753
|
+
swift: () => import("@shikijs/langs/swift"),
|
|
754
|
+
bash: () => import("@shikijs/langs/shellscript"),
|
|
755
|
+
lua: () => import("@shikijs/langs/lua"),
|
|
756
|
+
markdown: () => import("@shikijs/langs/markdown")
|
|
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({
|
|
758
|
+
engine: t(),
|
|
759
|
+
langs: [],
|
|
760
|
+
themes: []
|
|
761
|
+
})).catch((e) => {
|
|
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);
|
|
767
|
+
if (!t.getLoadedLanguages().includes(n)) {
|
|
768
|
+
let n = await $t[e]();
|
|
769
|
+
await t.loadLanguage(n.default);
|
|
770
|
+
}
|
|
771
|
+
return t;
|
|
772
|
+
}).catch((t) => {
|
|
773
|
+
throw an.delete(e), t;
|
|
774
|
+
}), an.set(e, t)), t;
|
|
775
|
+
}, ln = () => (rn ||= on().then(async (e) => {
|
|
776
|
+
if (!e.getLoadedThemes().includes("github-light")) {
|
|
777
|
+
let t = await import("@shikijs/themes/github-light");
|
|
778
|
+
await e.loadTheme(t.default);
|
|
779
|
+
}
|
|
780
|
+
return e;
|
|
781
|
+
}).catch((e) => {
|
|
782
|
+
throw rn = null, e;
|
|
783
|
+
}), rn), un = (e, t, n) => {
|
|
784
|
+
let r = e.getTextContent();
|
|
785
|
+
if (e.getStyle() && e.setStyle(""), !n || !sn(n, t)) return ot(r);
|
|
786
|
+
let i = en(t), a = n.codeToTokens(r, {
|
|
787
|
+
lang: i,
|
|
788
|
+
theme: m
|
|
789
|
+
}), o = [];
|
|
790
|
+
return a.tokens.forEach((e, t) => {
|
|
791
|
+
t && o.push(xe()), e.forEach((e) => {
|
|
792
|
+
e.content.split(" ").forEach((t, n) => {
|
|
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}` : "";
|
|
795
|
+
i && r.setStyle(i), o.push(r);
|
|
796
|
+
});
|
|
797
|
+
});
|
|
798
|
+
}), o;
|
|
799
|
+
}, dn = (e, t) => {
|
|
800
|
+
let n = A(e);
|
|
801
|
+
if (!U(n) || !n.isAttached()) return;
|
|
802
|
+
let r = M();
|
|
803
|
+
if (!F(r)) {
|
|
804
|
+
t();
|
|
805
|
+
return;
|
|
806
|
+
}
|
|
807
|
+
let { anchor: i } = r, a = i.offset, o = i.type === "element" && P(n.getChildAtIndex(i.offset - 1)), s = 0;
|
|
808
|
+
if (o || (s = a + i.getNode().getPreviousSiblings().reduce((e, t) => e + t.getTextContentSize(), 0)), t()) {
|
|
809
|
+
if (o) {
|
|
810
|
+
i.getNode().select(a, a);
|
|
811
|
+
return;
|
|
812
|
+
}
|
|
813
|
+
n.getChildren().some((e) => {
|
|
814
|
+
let t = Ae(e);
|
|
815
|
+
if (t || P(e)) {
|
|
816
|
+
let n = e.getTextContentSize();
|
|
817
|
+
if (t && n >= s) return e.select(s, s), !0;
|
|
818
|
+
s -= n;
|
|
819
|
+
}
|
|
820
|
+
return !1;
|
|
821
|
+
});
|
|
822
|
+
}
|
|
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) => {
|
|
824
|
+
let n = 0;
|
|
825
|
+
for (; n < e.length && fn(e[n], t[n]);) n++;
|
|
826
|
+
let r = e.length, i = t.length, a = Math.min(r, i) - n, o = 0;
|
|
827
|
+
for (; o < a;) if (o++, !fn(e[r - o], t[i - o])) {
|
|
828
|
+
o--;
|
|
829
|
+
break;
|
|
830
|
+
}
|
|
831
|
+
return {
|
|
832
|
+
from: n,
|
|
833
|
+
to: r - o,
|
|
834
|
+
nodesForReplacement: t.slice(n, i - o)
|
|
835
|
+
};
|
|
836
|
+
}, mn = (e, t, n, r, i) => {
|
|
837
|
+
let a = i.getKey(), o = x(i.getLanguage());
|
|
838
|
+
if (i.getLanguage() !== o && i.setLanguage(o), o === "plaintext") i.getIsSyntaxHighlightSupported() && i.setIsSyntaxHighlightSupported(!1);
|
|
839
|
+
else {
|
|
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();
|
|
842
|
+
if (s) {
|
|
843
|
+
i.getIsSyntaxHighlightSupported() && i.setIsSyntaxHighlightSupported(!1), n.pendingKeys.add(a), n.loading !== s && (n.loading = s, s.then((t) => {
|
|
844
|
+
r(t);
|
|
845
|
+
let i = [...n.pendingKeys];
|
|
846
|
+
n.pendingKeys.clear(), n.loading = null, e.update(() => {
|
|
847
|
+
i.forEach((e) => {
|
|
848
|
+
A(e)?.markDirty();
|
|
849
|
+
});
|
|
850
|
+
}, { tag: Re });
|
|
851
|
+
}, () => {
|
|
852
|
+
n.pendingKeys.clear(), n.loading = null;
|
|
853
|
+
}));
|
|
854
|
+
return;
|
|
855
|
+
}
|
|
856
|
+
i.getIsSyntaxHighlightSupported() || i.setIsSyntaxHighlightSupported(!0);
|
|
857
|
+
}
|
|
858
|
+
n.nodesCurrentlyHighlighting.has(a) || (n.nodesCurrentlyHighlighting.add(a), n.didTransform || (n.didTransform = !0, je(() => {
|
|
859
|
+
n.didTransform = !1, n.nodesCurrentlyHighlighting.clear();
|
|
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);
|
|
864
|
+
return r !== i || o.length ? (e.splice(r, i - r, o), !0) : !1;
|
|
865
|
+
}));
|
|
866
|
+
}, hn = (e, t, n, r, i) => {
|
|
867
|
+
let a = i.getParent();
|
|
868
|
+
U(a) ? mn(e, t, n, r, a) : at(i) && i.replace(we(i.__text));
|
|
869
|
+
};
|
|
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");
|
|
874
|
+
let t = null, n = {
|
|
875
|
+
didTransform: !1,
|
|
876
|
+
nodesCurrentlyHighlighting: /* @__PURE__ */ new Set(),
|
|
877
|
+
pendingKeys: /* @__PURE__ */ new Set(),
|
|
878
|
+
loading: null
|
|
879
|
+
}, r = (e) => {
|
|
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);
|
|
912
|
+
};
|
|
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
|
+
});
|
|
922
|
+
}, [e]), null;
|
|
923
|
+
}
|
|
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;
|
|
519
983
|
}
|
|
520
984
|
//#endregion
|
|
521
985
|
//#region src/components/Editor/plugins/MaxLengthPlugin.tsx
|
|
522
|
-
function
|
|
523
|
-
let [n] =
|
|
524
|
-
return
|
|
986
|
+
function bn({ maxLength: e, onMaxLengthExceed: t }) {
|
|
987
|
+
let [n] = R(), { isSourceModeRef: r } = y(), i = D(t);
|
|
988
|
+
return i.current = t, T(() => {
|
|
525
989
|
let t = null;
|
|
526
|
-
return n.registerNodeTransform(
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
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?.();
|
|
532
997
|
return;
|
|
533
998
|
}
|
|
534
|
-
if (
|
|
535
|
-
|
|
999
|
+
if (F(u) && u.isCollapsed()) {
|
|
1000
|
+
B(n, u.anchor, l), i.current?.();
|
|
536
1001
|
return;
|
|
537
1002
|
}
|
|
538
|
-
|
|
539
|
-
let
|
|
540
|
-
|
|
1003
|
+
a.selectEnd();
|
|
1004
|
+
let d = M();
|
|
1005
|
+
F(d) && (B(n, d.anchor, l), i.current?.());
|
|
541
1006
|
});
|
|
542
|
-
}, [
|
|
1007
|
+
}, [
|
|
1008
|
+
n,
|
|
1009
|
+
e,
|
|
1010
|
+
r
|
|
1011
|
+
]), null;
|
|
543
1012
|
}
|
|
544
1013
|
//#endregion
|
|
545
|
-
//#region src/components/Editor/
|
|
546
|
-
var
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
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
|
+
}
|
|
557
1044
|
};
|
|
558
|
-
|
|
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
|
+
}
|
|
559
1114
|
//#endregion
|
|
560
1115
|
//#region src/components/Editor/utils/textLength.ts
|
|
561
|
-
function
|
|
1116
|
+
function Mn(e) {
|
|
562
1117
|
return typeof e == "number" && Number.isFinite(e) && e > 0;
|
|
563
1118
|
}
|
|
564
|
-
function
|
|
1119
|
+
function Nn(e, t) {
|
|
565
1120
|
let n = j(), r = n.getTextContentSize();
|
|
566
1121
|
if (r <= t) return !1;
|
|
567
1122
|
let i = r - t;
|
|
568
1123
|
n.selectEnd();
|
|
569
1124
|
let a = M();
|
|
570
|
-
return
|
|
1125
|
+
return F(a) ? B(e, a.anchor, i) : Pn(i), !0;
|
|
571
1126
|
}
|
|
572
|
-
function
|
|
1127
|
+
function Pn(e) {
|
|
573
1128
|
let t = e, n = j().getAllTextNodes();
|
|
574
1129
|
for (let e = n.length - 1; e >= 0 && t > 0; e--) {
|
|
575
1130
|
let r = n[e], i = r.getTextContent();
|
|
@@ -577,18 +1132,163 @@ function Le(e) {
|
|
|
577
1132
|
}
|
|
578
1133
|
}
|
|
579
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
|
|
580
1281
|
//#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
|
|
585
|
-
containerRef:
|
|
586
|
-
toolbarRef:
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
d.current = i, p !== void 0 && h(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({
|
|
592
1292
|
text: t,
|
|
593
1293
|
html: i
|
|
594
1294
|
}, e);
|
|
@@ -596,77 +1296,104 @@ var Q = (e) => {
|
|
|
596
1296
|
}, [
|
|
597
1297
|
n,
|
|
598
1298
|
s,
|
|
599
|
-
|
|
1299
|
+
m,
|
|
1300
|
+
l
|
|
600
1301
|
]);
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
1302
|
+
T(() => {
|
|
1303
|
+
m === void 0 || c || s.getEditorState().read(() => {
|
|
1304
|
+
g(j().getTextContentSize());
|
|
604
1305
|
}, { editor: s });
|
|
605
|
-
}, [
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
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;
|
|
611
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?.();
|
|
612
1325
|
}, [
|
|
613
1326
|
e.value,
|
|
614
1327
|
s,
|
|
615
|
-
|
|
1328
|
+
m,
|
|
1329
|
+
l
|
|
616
1330
|
]);
|
|
617
|
-
let
|
|
618
|
-
return /* @__PURE__ */
|
|
619
|
-
value:
|
|
620
|
-
children: /* @__PURE__ */
|
|
621
|
-
ref:
|
|
622
|
-
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"]),
|
|
623
1337
|
onClick: (e) => {
|
|
624
1338
|
let t = s.getRootElement(), n = e.target;
|
|
625
1339
|
!t || !n || !t.contains(n) || s.isEditable() || s.setEditable(!0);
|
|
626
1340
|
},
|
|
627
1341
|
children: [
|
|
628
|
-
|
|
629
|
-
config:
|
|
1342
|
+
ee.length > 0 && /* @__PURE__ */ S(Rt, {
|
|
1343
|
+
config: ee,
|
|
630
1344
|
theme: i?.toolbar,
|
|
631
1345
|
style: r?.style,
|
|
632
1346
|
mode: r?.mode,
|
|
633
1347
|
floating: r?.floating
|
|
634
1348
|
}),
|
|
635
|
-
/* @__PURE__ */
|
|
636
|
-
contentEditable: /* @__PURE__ */
|
|
637
|
-
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"]),
|
|
638
1352
|
style: {
|
|
639
1353
|
height: t,
|
|
640
|
-
cursor:
|
|
1354
|
+
cursor: te ? "auto" : "text"
|
|
641
1355
|
}
|
|
642
1356
|
}),
|
|
643
|
-
ErrorBoundary:
|
|
1357
|
+
ErrorBoundary: _e
|
|
644
1358
|
}),
|
|
645
|
-
/* @__PURE__ */
|
|
646
|
-
/* @__PURE__ */
|
|
647
|
-
/* @__PURE__ */
|
|
648
|
-
/* @__PURE__ */
|
|
649
|
-
|
|
650
|
-
|
|
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,
|
|
651
1371
|
onMaxLengthExceed: o
|
|
652
|
-
}),
|
|
653
|
-
/* @__PURE__ */
|
|
654
|
-
/* @__PURE__ */
|
|
655
|
-
|
|
656
|
-
current:
|
|
657
|
-
maxLength:
|
|
658
|
-
})
|
|
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
|
|
659
1379
|
]
|
|
660
1380
|
})
|
|
661
1381
|
});
|
|
662
|
-
}
|
|
663
|
-
|
|
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";
|
|
664
1388
|
//#endregion
|
|
665
|
-
//#region src/components/Editor/
|
|
666
|
-
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) => {
|
|
667
1394
|
let { autoFocus: t = !1 } = e;
|
|
668
|
-
return /* @__PURE__ */
|
|
669
|
-
initialConfig:
|
|
1395
|
+
return /* @__PURE__ */ S(fe, {
|
|
1396
|
+
initialConfig: E(() => ({
|
|
670
1397
|
namespace: "bsyLexicalEditor",
|
|
671
1398
|
onError: (e) => {
|
|
672
1399
|
console.error("Lexical error", e);
|
|
@@ -676,25 +1403,56 @@ var $ = (e) => {
|
|
|
676
1403
|
text: {
|
|
677
1404
|
bold: "editor-text-bold",
|
|
678
1405
|
italic: "editor-text-italic",
|
|
679
|
-
underline: "editor-text-underline"
|
|
1406
|
+
underline: "editor-text-underline",
|
|
1407
|
+
strikethrough: "editor-text-strikethrough",
|
|
1408
|
+
underlineStrikethrough: "editor-text-underline-strikethrough"
|
|
1409
|
+
},
|
|
1410
|
+
list: {
|
|
1411
|
+
ul: "editor-list-ul",
|
|
1412
|
+
ol: "editor-list-ol",
|
|
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"
|
|
680
1423
|
},
|
|
681
|
-
|
|
1424
|
+
code: "editor-code",
|
|
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"
|
|
682
1431
|
},
|
|
1432
|
+
html: Kn,
|
|
683
1433
|
nodes: [
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
1434
|
+
$e,
|
|
1435
|
+
Qe,
|
|
1436
|
+
nt,
|
|
1437
|
+
tt,
|
|
1438
|
+
yt,
|
|
687
1439
|
G,
|
|
1440
|
+
W,
|
|
1441
|
+
ft,
|
|
1442
|
+
pt,
|
|
1443
|
+
q,
|
|
1444
|
+
Wt,
|
|
1445
|
+
X,
|
|
688
1446
|
{
|
|
689
|
-
replace:
|
|
690
|
-
with: (e) => new
|
|
691
|
-
withKlass:
|
|
1447
|
+
replace: L,
|
|
1448
|
+
with: (e) => new X(e.__text),
|
|
1449
|
+
withKlass: X
|
|
692
1450
|
}
|
|
693
1451
|
]
|
|
694
1452
|
}), [t]),
|
|
695
|
-
children: /* @__PURE__ */
|
|
1453
|
+
children: /* @__PURE__ */ S(Wn, { ...e })
|
|
696
1454
|
});
|
|
697
1455
|
};
|
|
698
|
-
|
|
1456
|
+
qn.displayName = "BsyLexicalEditor";
|
|
699
1457
|
//#endregion
|
|
700
|
-
export {
|
|
1458
|
+
export { Ee as $getRoot, b as BaseButton, qn as default, v as listRegisteredToolbarButtons, f as registerToolbarButton, a as unregisterToolbarButton, qe as useLexicalComposerContext };
|