@payloadcms/richtext-lexical 3.59.0-canary.0 → 3.59.0-internal.152bf35
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/exports/client/Field-CJFETHA3.js +2 -0
- package/dist/exports/client/Field-CJFETHA3.js.map +7 -0
- package/dist/exports/client/RelationshipComponent-TSIENULZ.js +2 -0
- package/dist/exports/client/RelationshipComponent-TSIENULZ.js.map +7 -0
- package/dist/exports/client/bundled.css +1 -1
- package/dist/exports/client/chunk-BQCXN3B4.js +2 -0
- package/dist/exports/client/chunk-BQCXN3B4.js.map +7 -0
- package/dist/exports/client/chunk-TLQLXR6Q.js +12 -0
- package/dist/exports/client/chunk-TLQLXR6Q.js.map +7 -0
- package/dist/exports/client/chunk-XNERFY6G.js +2 -0
- package/dist/exports/client/chunk-XNERFY6G.js.map +7 -0
- package/dist/exports/client/component-CYFKY3IL.js +2 -0
- package/dist/exports/client/component-CYFKY3IL.js.map +7 -0
- package/dist/exports/client/componentInline-NGTRUSGB.js +2 -0
- package/dist/exports/client/index.d.ts +3 -0
- package/dist/exports/client/index.d.ts.map +1 -1
- package/dist/exports/client/index.js +35 -10
- package/dist/exports/client/index.js.map +4 -4
- package/dist/features/align/server/i18n.d.ts.map +1 -1
- package/dist/features/align/server/i18n.js +6 -0
- package/dist/features/align/server/i18n.js.map +1 -1
- package/dist/features/blockquote/server/i18n.d.ts.map +1 -1
- package/dist/features/blockquote/server/i18n.js +3 -0
- package/dist/features/blockquote/server/i18n.js.map +1 -1
- package/dist/features/blocks/client/component/BlockContent.d.ts +52 -27
- package/dist/features/blocks/client/component/BlockContent.d.ts.map +1 -1
- package/dist/features/blocks/client/component/BlockContent.js +48 -51
- package/dist/features/blocks/client/component/BlockContent.js.map +1 -1
- package/dist/features/blocks/client/component/components/BlockCollapsible.d.ts +2 -9
- package/dist/features/blocks/client/component/components/BlockCollapsible.d.ts.map +1 -1
- package/dist/features/blocks/client/component/components/BlockCollapsible.js +7 -25
- package/dist/features/blocks/client/component/components/BlockCollapsible.js.map +1 -1
- package/dist/features/blocks/client/component/index.d.ts.map +1 -1
- package/dist/features/blocks/client/component/index.js +71 -56
- package/dist/features/blocks/client/component/index.js.map +1 -1
- package/dist/features/blocks/client/componentInline/index.d.ts.map +1 -1
- package/dist/features/blocks/client/componentInline/index.js +13 -11
- package/dist/features/blocks/client/componentInline/index.js.map +1 -1
- package/dist/features/blocks/client/index.d.ts.map +1 -1
- package/dist/features/blocks/client/index.js +5 -0
- package/dist/features/blocks/client/index.js.map +1 -1
- package/dist/features/blocks/client/markdown/getLexicalToMarkdown.d.ts +6 -0
- package/dist/features/blocks/client/markdown/getLexicalToMarkdown.d.ts.map +1 -0
- package/dist/features/blocks/client/markdown/getLexicalToMarkdown.js +24 -0
- package/dist/features/blocks/client/markdown/getLexicalToMarkdown.js.map +1 -0
- package/dist/features/blocks/client/markdown/getMarkdownToLexical.d.ts +6 -0
- package/dist/features/blocks/client/markdown/getMarkdownToLexical.d.ts.map +1 -0
- package/dist/features/blocks/client/markdown/getMarkdownToLexical.js +20 -0
- package/dist/features/blocks/client/markdown/getMarkdownToLexical.js.map +1 -0
- package/dist/features/blocks/client/markdown/markdownTransformer.d.ts +12 -0
- package/dist/features/blocks/client/markdown/markdownTransformer.d.ts.map +1 -0
- package/dist/features/blocks/client/markdown/markdownTransformer.js +348 -0
- package/dist/features/blocks/client/markdown/markdownTransformer.js.map +1 -0
- package/dist/features/blocks/premade/CodeBlock/Component/Block.d.ts +5 -0
- package/dist/features/blocks/premade/CodeBlock/Component/Block.d.ts.map +1 -0
- package/dist/features/blocks/premade/CodeBlock/Component/Block.js +156 -0
- package/dist/features/blocks/premade/CodeBlock/Component/Block.js.map +1 -0
- package/dist/features/blocks/premade/CodeBlock/Component/Code.d.ts +61 -0
- package/dist/features/blocks/premade/CodeBlock/Component/Code.d.ts.map +1 -0
- package/dist/features/blocks/premade/CodeBlock/Component/Code.js +99 -0
- package/dist/features/blocks/premade/CodeBlock/Component/Code.js.map +1 -0
- package/dist/features/blocks/premade/CodeBlock/Component/Collapse/index.d.ts +4 -0
- package/dist/features/blocks/premade/CodeBlock/Component/Collapse/index.d.ts.map +1 -0
- package/dist/features/blocks/premade/CodeBlock/Component/Collapse/index.js +17 -0
- package/dist/features/blocks/premade/CodeBlock/Component/Collapse/index.js.map +1 -0
- package/dist/features/blocks/premade/CodeBlock/Component/FloatingCollapse/index.d.ts +4 -0
- package/dist/features/blocks/premade/CodeBlock/Component/FloatingCollapse/index.d.ts.map +1 -0
- package/dist/features/blocks/premade/CodeBlock/Component/FloatingCollapse/index.js +26 -0
- package/dist/features/blocks/premade/CodeBlock/Component/FloatingCollapse/index.js.map +1 -0
- package/dist/features/blocks/premade/CodeBlock/converter.d.ts +7 -0
- package/dist/features/blocks/premade/CodeBlock/converter.d.ts.map +1 -0
- package/dist/features/blocks/premade/CodeBlock/converter.js +46 -0
- package/dist/features/blocks/premade/CodeBlock/converter.js.map +1 -0
- package/dist/features/blocks/premade/CodeBlock/converterClient.d.ts +2 -0
- package/dist/features/blocks/premade/CodeBlock/converterClient.d.ts.map +1 -0
- package/dist/features/blocks/premade/CodeBlock/converterClient.js +4 -0
- package/dist/features/blocks/premade/CodeBlock/converterClient.js.map +1 -0
- package/dist/features/blocks/premade/CodeBlock/index.d.ts +7 -0
- package/dist/features/blocks/premade/CodeBlock/index.d.ts.map +1 -0
- package/dist/features/blocks/premade/CodeBlock/index.js +52 -0
- package/dist/features/blocks/premade/CodeBlock/index.js.map +1 -0
- package/dist/features/blocks/server/i18n.d.ts.map +1 -1
- package/dist/features/blocks/server/i18n.js +47 -38
- package/dist/features/blocks/server/i18n.js.map +1 -1
- package/dist/features/blocks/server/index.js +1 -1
- package/dist/features/blocks/server/index.js.map +1 -1
- package/dist/features/blocks/server/markdown/getLexicalToMarkdown.d.ts +6 -0
- package/dist/features/blocks/server/markdown/getLexicalToMarkdown.d.ts.map +1 -0
- package/dist/features/blocks/server/markdown/getLexicalToMarkdown.js +27 -0
- package/dist/features/blocks/server/markdown/getLexicalToMarkdown.js.map +1 -0
- package/dist/features/blocks/server/markdown/getMarkdownToLexical.d.ts +7 -0
- package/dist/features/blocks/server/markdown/getMarkdownToLexical.d.ts.map +1 -0
- package/dist/features/blocks/server/markdown/getMarkdownToLexical.js +22 -0
- package/dist/features/blocks/server/markdown/getMarkdownToLexical.js.map +1 -0
- package/dist/features/blocks/server/markdown/linesFromMatchToContentAndPropsString.d.ts.map +1 -0
- package/dist/features/blocks/server/markdown/linesFromMatchToContentAndPropsString.js.map +1 -0
- package/dist/features/blocks/server/markdown/markdownTransformer.d.ts +15 -0
- package/dist/features/blocks/server/markdown/markdownTransformer.d.ts.map +1 -0
- package/dist/features/blocks/server/{markdownTransformer.js → markdown/markdownTransformer.js} +6 -48
- package/dist/features/blocks/server/markdown/markdownTransformer.js.map +1 -0
- package/dist/features/experimental_table/client/plugins/TableHoverActionsPlugin/index.d.ts.map +1 -1
- package/dist/features/experimental_table/client/plugins/TableHoverActionsPlugin/index.js +5 -3
- package/dist/features/experimental_table/client/plugins/TableHoverActionsPlugin/index.js.map +1 -1
- package/dist/features/heading/server/i18n.d.ts.map +1 -1
- package/dist/features/heading/server/i18n.js +3 -0
- package/dist/features/heading/server/i18n.js.map +1 -1
- package/dist/features/horizontalRule/server/i18n.d.ts.map +1 -1
- package/dist/features/horizontalRule/server/i18n.js +3 -0
- package/dist/features/horizontalRule/server/i18n.js.map +1 -1
- package/dist/features/indent/server/i18n.d.ts.map +1 -1
- package/dist/features/indent/server/i18n.js +4 -0
- package/dist/features/indent/server/i18n.js.map +1 -1
- package/dist/features/link/client/plugins/floatingLinkEditor/LinkEditor/index.d.ts.map +1 -1
- package/dist/features/link/client/plugins/floatingLinkEditor/LinkEditor/index.js +3 -1
- package/dist/features/link/client/plugins/floatingLinkEditor/LinkEditor/index.js.map +1 -1
- package/dist/features/link/server/i18n.d.ts.map +1 -1
- package/dist/features/link/server/i18n.js +4 -0
- package/dist/features/link/server/i18n.js.map +1 -1
- package/dist/features/lists/checklist/server/i18n.d.ts.map +1 -1
- package/dist/features/lists/checklist/server/i18n.js +3 -0
- package/dist/features/lists/checklist/server/i18n.js.map +1 -1
- package/dist/features/lists/orderedList/server/i18n.d.ts.map +1 -1
- package/dist/features/lists/orderedList/server/i18n.js +3 -0
- package/dist/features/lists/orderedList/server/i18n.js.map +1 -1
- package/dist/features/lists/unorderedList/server/i18n.d.ts.map +1 -1
- package/dist/features/lists/unorderedList/server/i18n.js +3 -0
- package/dist/features/lists/unorderedList/server/i18n.js.map +1 -1
- package/dist/features/paragraph/server/i18n.d.ts.map +1 -1
- package/dist/features/paragraph/server/i18n.js +4 -0
- package/dist/features/paragraph/server/i18n.js.map +1 -1
- package/dist/features/relationship/client/components/RelationshipComponent.d.ts.map +1 -1
- package/dist/features/relationship/client/components/RelationshipComponent.js +5 -9
- package/dist/features/relationship/client/components/RelationshipComponent.js.map +1 -1
- package/dist/features/relationship/server/i18n.d.ts.map +1 -1
- package/dist/features/relationship/server/i18n.js +3 -0
- package/dist/features/relationship/server/i18n.js.map +1 -1
- package/dist/features/textState/i18n.d.ts.map +1 -1
- package/dist/features/textState/i18n.js +3 -0
- package/dist/features/textState/i18n.js.map +1 -1
- package/dist/features/toolbars/fixed/client/Toolbar/index.d.ts.map +1 -1
- package/dist/features/toolbars/fixed/client/Toolbar/index.js +7 -1
- package/dist/features/toolbars/fixed/client/Toolbar/index.js.map +1 -1
- package/dist/features/toolbars/inline/client/Toolbar/index.d.ts.map +1 -1
- package/dist/features/toolbars/inline/client/Toolbar/index.js +3 -1
- package/dist/features/toolbars/inline/client/Toolbar/index.js.map +1 -1
- package/dist/features/upload/client/component/index.d.ts.map +1 -1
- package/dist/features/upload/client/component/index.js +6 -5
- package/dist/features/upload/client/component/index.js.map +1 -1
- package/dist/features/upload/server/i18n.d.ts.map +1 -1
- package/dist/features/upload/server/i18n.js +3 -0
- package/dist/features/upload/server/i18n.js.map +1 -1
- package/dist/field/RenderLexical/index.d.ts.map +1 -1
- package/dist/field/RenderLexical/index.js +1 -0
- package/dist/field/RenderLexical/index.js.map +1 -1
- package/dist/field/bundled.css +1 -1
- package/dist/field/rscEntry.d.ts.map +1 -1
- package/dist/field/rscEntry.js +2 -0
- package/dist/field/rscEntry.js.map +1 -1
- package/dist/i18n.d.ts.map +1 -1
- package/dist/i18n.js +6 -0
- package/dist/i18n.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/lexical/LexicalEditor.d.ts.map +1 -1
- package/dist/lexical/LexicalEditor.js +20 -26
- package/dist/lexical/LexicalEditor.js.map +1 -1
- package/dist/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/LexicalMenu.d.ts.map +1 -1
- package/dist/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/LexicalMenu.js +5 -5
- package/dist/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/LexicalMenu.js.map +1 -1
- package/dist/lexical/ui/icons/CodeBlock/index.d.ts.map +1 -1
- package/dist/lexical/ui/icons/CodeBlock/index.js +10 -15
- package/dist/lexical/ui/icons/CodeBlock/index.js.map +1 -1
- package/dist/lexical/ui/icons/Collapse/index.d.ts +3 -0
- package/dist/lexical/ui/icons/Collapse/index.d.ts.map +1 -0
- package/dist/lexical/ui/icons/Collapse/index.js +18 -0
- package/dist/lexical/ui/icons/Collapse/index.js.map +1 -0
- package/dist/utilities/buildInitialState.d.ts +1 -0
- package/dist/utilities/buildInitialState.d.ts.map +1 -1
- package/dist/utilities/buildInitialState.js +1 -0
- package/dist/utilities/buildInitialState.js.map +1 -1
- package/dist/utilities/fieldsDrawer/DrawerContent.d.ts.map +1 -1
- package/dist/utilities/fieldsDrawer/DrawerContent.js +7 -3
- package/dist/utilities/fieldsDrawer/DrawerContent.js.map +1 -1
- package/dist/utilities/jsx/collectTopLevelJSXInLines.js +2 -2
- package/dist/utilities/jsx/collectTopLevelJSXInLines.js.map +1 -1
- package/package.json +7 -7
- package/dist/exports/client/Field-U4WLAHNW.js +0 -2
- package/dist/exports/client/Field-U4WLAHNW.js.map +0 -7
- package/dist/exports/client/RelationshipComponent-APF3CN47.js +0 -2
- package/dist/exports/client/RelationshipComponent-APF3CN47.js.map +0 -7
- package/dist/exports/client/chunk-3BY5IZJD.js +0 -2
- package/dist/exports/client/chunk-3BY5IZJD.js.map +0 -7
- package/dist/exports/client/chunk-CYLMY5ZJ.js +0 -2
- package/dist/exports/client/chunk-CYLMY5ZJ.js.map +0 -7
- package/dist/exports/client/chunk-YCH4JNUH.js +0 -12
- package/dist/exports/client/chunk-YCH4JNUH.js.map +0 -7
- package/dist/exports/client/component-VDJI45F2.js +0 -2
- package/dist/exports/client/component-VDJI45F2.js.map +0 -7
- package/dist/exports/client/componentInline-7TPI7ZBC.js +0 -2
- package/dist/features/blocks/client/markdownTransformer.d.ts +0 -17
- package/dist/features/blocks/client/markdownTransformer.d.ts.map +0 -1
- package/dist/features/blocks/client/markdownTransformer.js +0 -144
- package/dist/features/blocks/client/markdownTransformer.js.map +0 -1
- package/dist/features/blocks/server/linesFromMatchToContentAndPropsString.d.ts.map +0 -1
- package/dist/features/blocks/server/linesFromMatchToContentAndPropsString.js.map +0 -1
- package/dist/features/blocks/server/markdownTransformer.d.ts +0 -22
- package/dist/features/blocks/server/markdownTransformer.d.ts.map +0 -1
- package/dist/features/blocks/server/markdownTransformer.js.map +0 -1
- /package/dist/exports/client/{componentInline-7TPI7ZBC.js.map → componentInline-NGTRUSGB.js.map} +0 -0
- /package/dist/features/blocks/server/{linesFromMatchToContentAndPropsString.d.ts → markdown/linesFromMatchToContentAndPropsString.d.ts} +0 -0
- /package/dist/features/blocks/server/{linesFromMatchToContentAndPropsString.js → markdown/linesFromMatchToContentAndPropsString.js} +0 -0
|
@@ -7,6 +7,7 @@ import { LexicalErrorBoundary } from '@lexical/react/LexicalErrorBoundary.js';
|
|
|
7
7
|
import { HistoryPlugin } from '@lexical/react/LexicalHistoryPlugin.js';
|
|
8
8
|
import { OnChangePlugin } from '@lexical/react/LexicalOnChangePlugin.js';
|
|
9
9
|
import { RichTextPlugin } from '@lexical/react/LexicalRichTextPlugin.js';
|
|
10
|
+
import { useLexicalEditable } from '@lexical/react/useLexicalEditable';
|
|
10
11
|
import { BLUR_COMMAND, COMMAND_PRIORITY_LOW, FOCUS_COMMAND } from 'lexical';
|
|
11
12
|
import * as React from 'react';
|
|
12
13
|
import { useEffect, useState } from 'react';
|
|
@@ -23,7 +24,7 @@ import { SlashMenuPlugin } from './plugins/SlashMenu/index.js';
|
|
|
23
24
|
import { TextPlugin } from './plugins/TextPlugin/index.js';
|
|
24
25
|
import { LexicalContentEditable } from './ui/ContentEditable.js';
|
|
25
26
|
export const LexicalEditor = props => {
|
|
26
|
-
const $ = _c(
|
|
27
|
+
const $ = _c(12);
|
|
27
28
|
const {
|
|
28
29
|
editorConfig,
|
|
29
30
|
editorContainerRef,
|
|
@@ -32,6 +33,7 @@ export const LexicalEditor = props => {
|
|
|
32
33
|
} = props;
|
|
33
34
|
const editorConfigContext = useEditorConfigContext();
|
|
34
35
|
const [editor] = useLexicalComposerContext();
|
|
36
|
+
const isEditable = useLexicalEditable();
|
|
35
37
|
const [floatingAnchorElem, setFloatingAnchorElem] = useState(null);
|
|
36
38
|
let t0;
|
|
37
39
|
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
|
|
@@ -87,21 +89,7 @@ export const LexicalEditor = props => {
|
|
|
87
89
|
}
|
|
88
90
|
useEffect(t1, t2);
|
|
89
91
|
let t3;
|
|
90
|
-
if ($[5] !==
|
|
91
|
-
let t4;
|
|
92
|
-
if ($[12] !== onChange) {
|
|
93
|
-
t4 = (editorState, editor_0, tags) => {
|
|
94
|
-
if (!tags.has("focus") || tags.size > 1) {
|
|
95
|
-
if (onChange != null) {
|
|
96
|
-
onChange(editorState, editor_0, tags);
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
};
|
|
100
|
-
$[12] = onChange;
|
|
101
|
-
$[13] = t4;
|
|
102
|
-
} else {
|
|
103
|
-
t4 = $[13];
|
|
104
|
-
}
|
|
92
|
+
if ($[5] !== editorConfig || $[6] !== editorContainerRef || $[7] !== floatingAnchorElem || $[8] !== isEditable || $[9] !== isSmallWidthViewport || $[10] !== onChange) {
|
|
105
93
|
t3 = _jsxs(React.Fragment, {
|
|
106
94
|
children: [editorConfig.features.plugins?.map(_temp), _jsxs("div", {
|
|
107
95
|
className: "editor-container",
|
|
@@ -118,13 +106,19 @@ export const LexicalEditor = props => {
|
|
|
118
106
|
})
|
|
119
107
|
}),
|
|
120
108
|
ErrorBoundary: LexicalErrorBoundary
|
|
121
|
-
}), _jsx(NormalizeSelectionPlugin, {}), _jsx(InsertParagraphAtEndPlugin, {}), _jsx(DecoratorPlugin, {}), _jsx(TextPlugin, {
|
|
109
|
+
}), _jsx(NormalizeSelectionPlugin, {}), isEditable && _jsx(InsertParagraphAtEndPlugin, {}), _jsx(DecoratorPlugin, {}), _jsx(TextPlugin, {
|
|
122
110
|
features: editorConfig.features
|
|
123
|
-
}), _jsx(SelectAllPlugin, {}), _jsx(OnChangePlugin, {
|
|
111
|
+
}), _jsx(SelectAllPlugin, {}), isEditable && _jsx(OnChangePlugin, {
|
|
124
112
|
ignoreSelectionChange: true,
|
|
125
|
-
onChange:
|
|
113
|
+
onChange: (editorState, editor_0, tags) => {
|
|
114
|
+
if (!tags.has("focus") || tags.size > 1) {
|
|
115
|
+
if (onChange != null) {
|
|
116
|
+
onChange(editorState, editor_0, tags);
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
}
|
|
126
120
|
}), floatingAnchorElem && _jsxs(React.Fragment, {
|
|
127
|
-
children: [!isSmallWidthViewport &&
|
|
121
|
+
children: [!isSmallWidthViewport && isEditable && _jsxs(React.Fragment, {
|
|
128
122
|
children: [editorConfig.admin?.hideDraggableBlockElement ? null : _jsx(DraggableBlockPlugin, {
|
|
129
123
|
anchorElem: floatingAnchorElem
|
|
130
124
|
}), editorConfig.admin?.hideAddBlockButton ? null : _jsx(AddBlockHandlePlugin, {
|
|
@@ -138,20 +132,20 @@ export const LexicalEditor = props => {
|
|
|
138
132
|
plugin: plugin_1
|
|
139
133
|
}, plugin_1.key);
|
|
140
134
|
}
|
|
141
|
-
}),
|
|
135
|
+
}), isEditable && _jsx(React.Fragment, {
|
|
142
136
|
children: _jsx(SlashMenuPlugin, {
|
|
143
137
|
anchorElem: floatingAnchorElem
|
|
144
138
|
})
|
|
145
139
|
})]
|
|
146
|
-
}),
|
|
140
|
+
}), isEditable && _jsxs(React.Fragment, {
|
|
147
141
|
children: [_jsx(HistoryPlugin, {}), editorConfig?.features?.markdownTransformers?.length > 0 && _jsx(MarkdownShortcutPlugin, {})]
|
|
148
142
|
}), editorConfig.features.plugins?.map(_temp3), editorConfig.features.plugins?.map(_temp4)]
|
|
149
143
|
}), editorConfig.features.plugins?.map(_temp5)]
|
|
150
144
|
});
|
|
151
|
-
$[5] =
|
|
152
|
-
$[6] =
|
|
153
|
-
$[7] =
|
|
154
|
-
$[8] =
|
|
145
|
+
$[5] = editorConfig;
|
|
146
|
+
$[6] = editorContainerRef;
|
|
147
|
+
$[7] = floatingAnchorElem;
|
|
148
|
+
$[8] = isEditable;
|
|
155
149
|
$[9] = isSmallWidthViewport;
|
|
156
150
|
$[10] = onChange;
|
|
157
151
|
$[11] = t3;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LexicalEditor.js","names":["c","_c","useLexicalComposerContext","LexicalErrorBoundary","HistoryPlugin","OnChangePlugin","RichTextPlugin","BLUR_COMMAND","COMMAND_PRIORITY_LOW","FOCUS_COMMAND","React","useEffect","useState","useEditorConfigContext","EditorPlugin","DecoratorPlugin","AddBlockHandlePlugin","DraggableBlockPlugin","InsertParagraphAtEndPlugin","MarkdownShortcutPlugin","NormalizeSelectionPlugin","SelectAllPlugin","SlashMenuPlugin","TextPlugin","LexicalContentEditable","LexicalEditor","props","$","editorConfig","editorContainerRef","isSmallWidthViewport","onChange","editorConfigContext","editor","floatingAnchorElem","setFloatingAnchorElem","t0","Symbol","for","_floatingAnchorElem","onRef","t1","t2","uuid","console","error","parentEditor","registerChild","handleFocus","focusEditor","handleBlur","blurEditor","unregisterFocus","registerCommand","unregisterBlur","unregisterChild","t3","t4","editorState","editor_0","tags","has","size","_jsxs","Fragment","children","features","plugins","map","_temp","className","ref","_temp2","_jsx","contentEditable","ignoreSelectionChange","isEditable","admin","hideDraggableBlockElement","anchorElem","hideAddBlockButton","plugin_1","plugin","position","desktopOnly","clientProps","key","markdownTransformers","length","_temp3","_temp4","_temp5","plugin_0","plugin_2","plugin_3","plugin_4"],"sources":["../../src/lexical/LexicalEditor.tsx"],"sourcesContent":["'use client'\nimport { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext.js'\nimport { LexicalErrorBoundary } from '@lexical/react/LexicalErrorBoundary.js'\nimport { HistoryPlugin } from '@lexical/react/LexicalHistoryPlugin.js'\nimport { OnChangePlugin } from '@lexical/react/LexicalOnChangePlugin.js'\nimport { RichTextPlugin } from '@lexical/react/LexicalRichTextPlugin.js'\nimport { BLUR_COMMAND, COMMAND_PRIORITY_LOW, FOCUS_COMMAND } from 'lexical'\nimport * as React from 'react'\nimport { useEffect, useState } from 'react'\n\nimport type { LexicalProviderProps } from './LexicalProvider.js'\n\nimport { useEditorConfigContext } from './config/client/EditorConfigProvider.js'\nimport { EditorPlugin } from './EditorPlugin.js'\nimport './LexicalEditor.scss'\nimport { DecoratorPlugin } from './plugins/DecoratorPlugin/index.js'\nimport { AddBlockHandlePlugin } from './plugins/handles/AddBlockHandlePlugin/index.js'\nimport { DraggableBlockPlugin } from './plugins/handles/DraggableBlockPlugin/index.js'\nimport { InsertParagraphAtEndPlugin } from './plugins/InsertParagraphAtEnd/index.js'\nimport { MarkdownShortcutPlugin } from './plugins/MarkdownShortcut/index.js'\nimport { NormalizeSelectionPlugin } from './plugins/NormalizeSelection/index.js'\nimport { SelectAllPlugin } from './plugins/SelectAllPlugin/index.js'\nimport { SlashMenuPlugin } from './plugins/SlashMenu/index.js'\nimport { TextPlugin } from './plugins/TextPlugin/index.js'\nimport { LexicalContentEditable } from './ui/ContentEditable.js'\n\nexport const LexicalEditor: React.FC<\n {\n editorContainerRef: React.RefObject<HTMLDivElement | null>\n isSmallWidthViewport: boolean\n } & Pick<LexicalProviderProps, 'editorConfig' | 'onChange'>\n> = (props) => {\n const { editorConfig, editorContainerRef, isSmallWidthViewport, onChange } = props\n const editorConfigContext = useEditorConfigContext()\n const [editor] = useLexicalComposerContext()\n\n const [floatingAnchorElem, setFloatingAnchorElem] = useState<HTMLDivElement | null>(null)\n const onRef = (_floatingAnchorElem: HTMLDivElement) => {\n if (_floatingAnchorElem !== null) {\n setFloatingAnchorElem(_floatingAnchorElem)\n }\n }\n\n useEffect(() => {\n if (!editorConfigContext?.uuid) {\n console.error('Lexical Editor must be used within an EditorConfigProvider')\n return\n }\n if (editorConfigContext?.parentEditor?.uuid) {\n editorConfigContext.parentEditor?.registerChild(editorConfigContext.uuid, editorConfigContext)\n }\n\n const handleFocus = () => {\n editorConfigContext.focusEditor(editorConfigContext)\n }\n\n const handleBlur = () => {\n editorConfigContext.blurEditor(editorConfigContext)\n }\n\n const unregisterFocus = editor.registerCommand<MouseEvent>(\n FOCUS_COMMAND,\n () => {\n handleFocus()\n return true\n },\n COMMAND_PRIORITY_LOW,\n )\n\n const unregisterBlur = editor.registerCommand<MouseEvent>(\n BLUR_COMMAND,\n () => {\n handleBlur()\n return true\n },\n COMMAND_PRIORITY_LOW,\n )\n\n return () => {\n unregisterFocus()\n unregisterBlur()\n editorConfigContext.parentEditor?.unregisterChild?.(editorConfigContext.uuid)\n }\n }, [editor, editorConfigContext])\n\n return (\n <React.Fragment>\n {editorConfig.features.plugins?.map((plugin) => {\n if (plugin.position === 'aboveContainer') {\n return <EditorPlugin clientProps={plugin.clientProps} key={plugin.key} plugin={plugin} />\n }\n })}\n <div className=\"editor-container\" ref={editorContainerRef}>\n {editorConfig.features.plugins?.map((plugin) => {\n if (plugin.position === 'top') {\n return (\n <EditorPlugin clientProps={plugin.clientProps} key={plugin.key} plugin={plugin} />\n )\n }\n })}\n <RichTextPlugin\n contentEditable={\n <div className=\"editor-scroller\">\n <div className=\"editor\" ref={onRef}>\n <LexicalContentEditable editorConfig={editorConfig} />\n </div>\n </div>\n }\n ErrorBoundary={LexicalErrorBoundary}\n />\n <NormalizeSelectionPlugin />\n <InsertParagraphAtEndPlugin />\n <DecoratorPlugin />\n <TextPlugin features={editorConfig.features} />\n <SelectAllPlugin />\n <OnChangePlugin\n // Selection changes can be ignored here, reducing the\n // frequency that the FieldComponent and Payload receive updates.\n // Selection changes are only needed if you are saving selection state\n ignoreSelectionChange\n onChange={(editorState, editor, tags) => {\n // Ignore any onChange event triggered by focus only\n if (!tags.has('focus') || tags.size > 1) {\n if (onChange != null) {\n onChange(editorState, editor, tags)\n }\n }\n }}\n />\n {floatingAnchorElem && (\n <React.Fragment>\n {!isSmallWidthViewport && editor.isEditable() && (\n <React.Fragment>\n {editorConfig.admin?.hideDraggableBlockElement ? null : (\n <DraggableBlockPlugin anchorElem={floatingAnchorElem} />\n )}\n {editorConfig.admin?.hideAddBlockButton ? null : (\n <AddBlockHandlePlugin anchorElem={floatingAnchorElem} />\n )}\n </React.Fragment>\n )}\n {editorConfig.features.plugins?.map((plugin) => {\n if (\n plugin.position === 'floatingAnchorElem' &&\n !(plugin.desktopOnly === true && isSmallWidthViewport)\n ) {\n return (\n <EditorPlugin\n anchorElem={floatingAnchorElem}\n clientProps={plugin.clientProps}\n key={plugin.key}\n plugin={plugin}\n />\n )\n }\n })}\n {editor.isEditable() && (\n <React.Fragment>\n <SlashMenuPlugin anchorElem={floatingAnchorElem} />\n </React.Fragment>\n )}\n </React.Fragment>\n )}\n {editor.isEditable() && (\n <React.Fragment>\n <HistoryPlugin />\n {editorConfig?.features?.markdownTransformers?.length > 0 && <MarkdownShortcutPlugin />}\n </React.Fragment>\n )}\n {editorConfig.features.plugins?.map((plugin) => {\n if (plugin.position === 'normal') {\n return (\n <EditorPlugin clientProps={plugin.clientProps} key={plugin.key} plugin={plugin} />\n )\n }\n })}\n {editorConfig.features.plugins?.map((plugin) => {\n if (plugin.position === 'bottom') {\n return (\n <EditorPlugin clientProps={plugin.clientProps} key={plugin.key} plugin={plugin} />\n )\n }\n })}\n </div>\n {editorConfig.features.plugins?.map((plugin) => {\n if (plugin.position === 'belowContainer') {\n return <EditorPlugin clientProps={plugin.clientProps} key={plugin.key} plugin={plugin} />\n }\n })}\n </React.Fragment>\n )\n}\n"],"mappings":"AAAA;;AAAA,SAAAA,CAAA,IAAAC,EAAA;;AACA,SAASC,yBAAyB,QAAQ;AAC1C,SAASC,oBAAoB,QAAQ;AACrC,SAASC,aAAa,QAAQ;AAC9B,SAASC,cAAc,QAAQ;AAC/B,SAASC,cAAc,QAAQ;AAC/B,SAASC,YAAY,EAAEC,oBAAoB,EAAEC,aAAa,QAAQ;AAClE,YAAYC,KAAA,MAAW;AACvB,SAASC,SAAS,EAAEC,QAAQ,QAAQ;AAIpC,SAASC,sBAAsB,QAAQ;AACvC,SAASC,YAAY,QAAQ;AAE7B,SAASC,eAAe,QAAQ;AAChC,SAASC,oBAAoB,QAAQ;AACrC,SAASC,oBAAoB,QAAQ;AACrC,SAASC,0BAA0B,QAAQ;AAC3C,SAASC,sBAAsB,QAAQ;AACvC,SAASC,wBAAwB,QAAQ;AACzC,SAASC,eAAe,QAAQ;AAChC,SAASC,eAAe,QAAQ;AAChC,SAASC,UAAU,QAAQ;AAC3B,SAASC,sBAAsB,QAAQ;AAEvC,OAAO,MAAMC,aAAA,GAKTC,KAAA;EAAA,MAAAC,CAAA,GAAA1B,EAAA;EACF;IAAA2B,YAAA;IAAAC,kBAAA;IAAAC,oBAAA;IAAAC;EAAA,IAA6EL,KAAA;EAC7E,MAAAM,mBAAA,GAA4BnB,sBAAA;EAC5B,OA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A,EAA2BH,QAAA,CAAAG,WAAA;MAAAH,MAAA,EAA6CA;IAAA,GAApBA,QAAA,CAAAI,GAAU;EAAA;AAAA;AApJxE,SAAAK,OAAAI,QAAA;EAAA,IA0JQb,QAAA,CAAAC,QAAA,KAAoB;IAAA,OACfV,IAAA,CAAA3D,YAAA;MAAAuE,WAAA,EAA2BH,QAAA,CAAAG,WAAA;MAAAH,MAAA,EAA6CA;IAAA,GAApBA,QAAA,CAAAI,GAAU;EAAA;AAAA","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"LexicalEditor.js","names":["c","_c","useLexicalComposerContext","LexicalErrorBoundary","HistoryPlugin","OnChangePlugin","RichTextPlugin","useLexicalEditable","BLUR_COMMAND","COMMAND_PRIORITY_LOW","FOCUS_COMMAND","React","useEffect","useState","useEditorConfigContext","EditorPlugin","DecoratorPlugin","AddBlockHandlePlugin","DraggableBlockPlugin","InsertParagraphAtEndPlugin","MarkdownShortcutPlugin","NormalizeSelectionPlugin","SelectAllPlugin","SlashMenuPlugin","TextPlugin","LexicalContentEditable","LexicalEditor","props","$","editorConfig","editorContainerRef","isSmallWidthViewport","onChange","editorConfigContext","editor","isEditable","floatingAnchorElem","setFloatingAnchorElem","t0","Symbol","for","_floatingAnchorElem","onRef","t1","t2","uuid","console","error","parentEditor","registerChild","handleFocus","focusEditor","handleBlur","blurEditor","unregisterFocus","registerCommand","unregisterBlur","unregisterChild","t3","_jsxs","Fragment","children","features","plugins","map","_temp","className","ref","_temp2","_jsx","contentEditable","ignoreSelectionChange","editorState","editor_0","tags","has","size","admin","hideDraggableBlockElement","anchorElem","hideAddBlockButton","plugin_1","plugin","position","desktopOnly","clientProps","key","markdownTransformers","length","_temp3","_temp4","_temp5","plugin_0","plugin_2","plugin_3","plugin_4"],"sources":["../../src/lexical/LexicalEditor.tsx"],"sourcesContent":["'use client'\nimport { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext.js'\nimport { LexicalErrorBoundary } from '@lexical/react/LexicalErrorBoundary.js'\nimport { HistoryPlugin } from '@lexical/react/LexicalHistoryPlugin.js'\nimport { OnChangePlugin } from '@lexical/react/LexicalOnChangePlugin.js'\nimport { RichTextPlugin } from '@lexical/react/LexicalRichTextPlugin.js'\nimport { useLexicalEditable } from '@lexical/react/useLexicalEditable'\nimport { BLUR_COMMAND, COMMAND_PRIORITY_LOW, FOCUS_COMMAND } from 'lexical'\nimport * as React from 'react'\nimport { useEffect, useState } from 'react'\n\nimport type { LexicalProviderProps } from './LexicalProvider.js'\n\nimport { useEditorConfigContext } from './config/client/EditorConfigProvider.js'\nimport './LexicalEditor.scss'\nimport { EditorPlugin } from './EditorPlugin.js'\nimport { DecoratorPlugin } from './plugins/DecoratorPlugin/index.js'\nimport { AddBlockHandlePlugin } from './plugins/handles/AddBlockHandlePlugin/index.js'\nimport { DraggableBlockPlugin } from './plugins/handles/DraggableBlockPlugin/index.js'\nimport { InsertParagraphAtEndPlugin } from './plugins/InsertParagraphAtEnd/index.js'\nimport { MarkdownShortcutPlugin } from './plugins/MarkdownShortcut/index.js'\nimport { NormalizeSelectionPlugin } from './plugins/NormalizeSelection/index.js'\nimport { SelectAllPlugin } from './plugins/SelectAllPlugin/index.js'\nimport { SlashMenuPlugin } from './plugins/SlashMenu/index.js'\nimport { TextPlugin } from './plugins/TextPlugin/index.js'\nimport { LexicalContentEditable } from './ui/ContentEditable.js'\n\nexport const LexicalEditor: React.FC<\n {\n editorContainerRef: React.RefObject<HTMLDivElement | null>\n isSmallWidthViewport: boolean\n } & Pick<LexicalProviderProps, 'editorConfig' | 'onChange'>\n> = (props) => {\n const { editorConfig, editorContainerRef, isSmallWidthViewport, onChange } = props\n const editorConfigContext = useEditorConfigContext()\n const [editor] = useLexicalComposerContext()\n const isEditable = useLexicalEditable()\n\n const [floatingAnchorElem, setFloatingAnchorElem] = useState<HTMLDivElement | null>(null)\n const onRef = (_floatingAnchorElem: HTMLDivElement) => {\n if (_floatingAnchorElem !== null) {\n setFloatingAnchorElem(_floatingAnchorElem)\n }\n }\n\n useEffect(() => {\n if (!editorConfigContext?.uuid) {\n console.error('Lexical Editor must be used within an EditorConfigProvider')\n return\n }\n if (editorConfigContext?.parentEditor?.uuid) {\n editorConfigContext.parentEditor?.registerChild(editorConfigContext.uuid, editorConfigContext)\n }\n\n const handleFocus = () => {\n editorConfigContext.focusEditor(editorConfigContext)\n }\n\n const handleBlur = () => {\n editorConfigContext.blurEditor(editorConfigContext)\n }\n\n const unregisterFocus = editor.registerCommand<MouseEvent>(\n FOCUS_COMMAND,\n () => {\n handleFocus()\n return true\n },\n COMMAND_PRIORITY_LOW,\n )\n\n const unregisterBlur = editor.registerCommand<MouseEvent>(\n BLUR_COMMAND,\n () => {\n handleBlur()\n return true\n },\n COMMAND_PRIORITY_LOW,\n )\n\n return () => {\n unregisterFocus()\n unregisterBlur()\n editorConfigContext.parentEditor?.unregisterChild?.(editorConfigContext.uuid)\n }\n }, [editor, editorConfigContext])\n\n return (\n <React.Fragment>\n {editorConfig.features.plugins?.map((plugin) => {\n if (plugin.position === 'aboveContainer') {\n return <EditorPlugin clientProps={plugin.clientProps} key={plugin.key} plugin={plugin} />\n }\n })}\n <div className=\"editor-container\" ref={editorContainerRef}>\n {editorConfig.features.plugins?.map((plugin) => {\n if (plugin.position === 'top') {\n return (\n <EditorPlugin clientProps={plugin.clientProps} key={plugin.key} plugin={plugin} />\n )\n }\n })}\n <RichTextPlugin\n contentEditable={\n <div className=\"editor-scroller\">\n <div className=\"editor\" ref={onRef}>\n <LexicalContentEditable editorConfig={editorConfig} />\n </div>\n </div>\n }\n ErrorBoundary={LexicalErrorBoundary}\n />\n <NormalizeSelectionPlugin />\n {isEditable && <InsertParagraphAtEndPlugin />}\n <DecoratorPlugin />\n <TextPlugin features={editorConfig.features} />\n <SelectAllPlugin />\n {isEditable && (\n <OnChangePlugin\n // Selection changes can be ignored here, reducing the\n // frequency that the FieldComponent and Payload receive updates.\n // Selection changes are only needed if you are saving selection state\n ignoreSelectionChange\n onChange={(editorState, editor, tags) => {\n // Ignore any onChange event triggered by focus only\n if (!tags.has('focus') || tags.size > 1) {\n if (onChange != null) {\n onChange(editorState, editor, tags)\n }\n }\n }}\n />\n )}\n {floatingAnchorElem && (\n <React.Fragment>\n {!isSmallWidthViewport && isEditable && (\n <React.Fragment>\n {editorConfig.admin?.hideDraggableBlockElement ? null : (\n <DraggableBlockPlugin anchorElem={floatingAnchorElem} />\n )}\n {editorConfig.admin?.hideAddBlockButton ? null : (\n <AddBlockHandlePlugin anchorElem={floatingAnchorElem} />\n )}\n </React.Fragment>\n )}\n {editorConfig.features.plugins?.map((plugin) => {\n if (\n plugin.position === 'floatingAnchorElem' &&\n !(plugin.desktopOnly === true && isSmallWidthViewport)\n ) {\n return (\n <EditorPlugin\n anchorElem={floatingAnchorElem}\n clientProps={plugin.clientProps}\n key={plugin.key}\n plugin={plugin}\n />\n )\n }\n })}\n {isEditable && (\n <React.Fragment>\n <SlashMenuPlugin anchorElem={floatingAnchorElem} />\n </React.Fragment>\n )}\n </React.Fragment>\n )}\n {isEditable && (\n <React.Fragment>\n <HistoryPlugin />\n {editorConfig?.features?.markdownTransformers?.length > 0 && <MarkdownShortcutPlugin />}\n </React.Fragment>\n )}\n {editorConfig.features.plugins?.map((plugin) => {\n if (plugin.position === 'normal') {\n return (\n <EditorPlugin clientProps={plugin.clientProps} key={plugin.key} plugin={plugin} />\n )\n }\n })}\n {editorConfig.features.plugins?.map((plugin) => {\n if (plugin.position === 'bottom') {\n return (\n <EditorPlugin clientProps={plugin.clientProps} key={plugin.key} plugin={plugin} />\n )\n }\n })}\n </div>\n {editorConfig.features.plugins?.map((plugin) => {\n if (plugin.position === 'belowContainer') {\n return <EditorPlugin clientProps={plugin.clientProps} key={plugin.key} plugin={plugin} />\n }\n })}\n </React.Fragment>\n )\n}\n"],"mappings":"AAAA;;AAAA,SAAAA,CAAA,IAAAC,EAAA;;AACA,SAASC,yBAAyB,QAAQ;AAC1C,SAASC,oBAAoB,QAAQ;AACrC,SAASC,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yBA,MAAA,CAAAI,GAAU;EAAA;AAAA;AA3D3E,SAAAlB,OAAAwB,QAAA;EAAA,IAgEUV,QAAA,CAAAC,QAAA,KAAoB;IAAA,OAEpBd,IAAA,CAAAtD,YAAA;MAAAsE,WAAA,EAA2BH,QAAA,CAAAG,WAAA;MAAAH,MAAA,EAA6CA;IAAA,GAApBA,QAAA,CAAAI,GAAU;EAAA;AAAA;AAlExE,SAAAG,OAAAI,QAAA;EAAA,IA8IUX,QAAA,CAAAC,QAAA,KAAoB;IAAA,OAEpBd,IAAA,CAAAtD,YAAA;MAAAsE,WAAA,EAA2BH,QAAA,CAAAG,WAAA;MAAAH,MAAA,EAA6CA;IAAA,GAApBA,QAAA,CAAAI,GAAU;EAAA;AAAA;AAhJxE,SAAAI,OAAAI,QAAA;EAAA,IAqJUZ,QAAA,CAAAC,QAAA,KAAoB;IAAA,OAEpBd,IAAA,CAAAtD,YAAA;MAAAsE,WAAA,EAA2BH,QAAA,CAAAG,WAAA;MAAAH,MAAA,EAA6CA;IAAA,GAApBA,QAAA,CAAAI,GAAU;EAAA;AAAA;AAvJxE,SAAAK,OAAAI,QAAA;EAAA,IA6JQb,QAAA,CAAAC,QAAA,KAAoB;IAAA,OACfd,IAAA,CAAAtD,YAAA;MAAAsE,WAAA,EAA2BH,QAAA,CAAAG,WAAA;MAAAH,MAAA,EAA6CA;IAAA,GAApBA,QAAA,CAAAI,GAAU;EAAA;AAAA","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LexicalMenu.d.ts","sourceRoot":"","sources":["../../../../../src/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/LexicalMenu.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAiB,cAAc,EAAE,aAAa,EAAY,MAAM,SAAS,CAAA;AACrF,OAAO,KAAK,EAAE,GAAG,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;
|
|
1
|
+
{"version":3,"file":"LexicalMenu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K,IAAI,QA4CjD;AAED,eAAO,MAAM,yCAAyC,EAAE,cAAc,CAAC;IACrE,KAAK,EAAE,MAAM,CAAA;IACb,IAAI,EAAE,qBAAqB,CAAA;CAC5B,CAA8D,CAAA;AAE/D,wBAAgB,WAAW,CAAC,EAC1B,gBAAgB,EAChB,KAAK,EACL,MAAM,EAEN,MAAM,EACN,YAAY,EACZ,UAAU,EACV,wBAAgC,GACjC,EAAE;IACD,gBAAgB,EAAE,SAAS,CAAC,WAAW,GAAG,IAAI,CAAC,CAAA;IAC/C,KAAK,EAAE,MAAM,IAAI,CAAA;IACjB,MAAM,EAAE,aAAa,CAAA;IACrB,MAAM,EAAE,KAAK,CAAC,sBAAsB,CAAC,CAAA;IACrC,YAAY,EAAE,YAAY,CAAA;IAC1B,UAAU,EAAE,cAAc,CAAA;IAC1B,wBAAwB,CAAC,EAAE,OAAO,CAAA;CACnC,GAAG,GAAG,CAAC,OAAO,GAAG,IAAI,CAuOrB;AAYD,wBAAgB,gBAAgB,CAC9B,UAAU,EAAE,WAAW,EACvB,UAAU,EAAE,cAAc,GAAG,IAAI,EACjC,aAAa,EAAE,CAAC,CAAC,EAAE,cAAc,GAAG,IAAI,KAAK,IAAI,EACjD,SAAS,CAAC,EAAE,MAAM,GACjB,SAAS,CAAC,WAAW,GAAG,IAAI,CAAC,CA6F/B"}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
import { c as _c } from "react/compiler-runtime";
|
|
4
4
|
import { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext.js';
|
|
5
5
|
import { mergeRegister } from '@lexical/utils';
|
|
6
|
-
import { $getSelection, $isRangeSelection, $setSelection, COMMAND_PRIORITY_LOW, createCommand, KEY_ARROW_DOWN_COMMAND, KEY_ARROW_UP_COMMAND, KEY_ENTER_COMMAND, KEY_ESCAPE_COMMAND, KEY_TAB_COMMAND } from 'lexical';
|
|
6
|
+
import { $getSelection, $isRangeSelection, $setSelection, COMMAND_PRIORITY_LOW, COMMAND_PRIORITY_NORMAL, createCommand, KEY_ARROW_DOWN_COMMAND, KEY_ARROW_UP_COMMAND, KEY_ENTER_COMMAND, KEY_ESCAPE_COMMAND, KEY_TAB_COMMAND } from 'lexical';
|
|
7
7
|
import { useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState } from 'react';
|
|
8
8
|
import { CAN_USE_DOM } from '../../../utils/canUseDOM.js';
|
|
9
9
|
const baseClass = 'slash-menu-popup';
|
|
@@ -262,7 +262,7 @@ export function LexicalMenu({
|
|
|
262
262
|
event.stopImmediatePropagation();
|
|
263
263
|
}
|
|
264
264
|
return true;
|
|
265
|
-
},
|
|
265
|
+
}, COMMAND_PRIORITY_NORMAL), editor.registerCommand(KEY_ARROW_UP_COMMAND, payload_0 => {
|
|
266
266
|
const event_0 = payload_0;
|
|
267
267
|
if (groups !== null && groups.length && selectedItemKey !== null) {
|
|
268
268
|
const allItems_1 = groups.flatMap(group_1 => group_1.items);
|
|
@@ -280,7 +280,7 @@ export function LexicalMenu({
|
|
|
280
280
|
event_0.stopImmediatePropagation();
|
|
281
281
|
}
|
|
282
282
|
return true;
|
|
283
|
-
},
|
|
283
|
+
}, COMMAND_PRIORITY_NORMAL), editor.registerCommand(KEY_ESCAPE_COMMAND, payload_1 => {
|
|
284
284
|
const event_1 = payload_1;
|
|
285
285
|
event_1.preventDefault();
|
|
286
286
|
event_1.stopImmediatePropagation();
|
|
@@ -300,7 +300,7 @@ export function LexicalMenu({
|
|
|
300
300
|
event_2.stopImmediatePropagation();
|
|
301
301
|
selectItemAndCleanUp(selectedItem_0);
|
|
302
302
|
return true;
|
|
303
|
-
},
|
|
303
|
+
}, COMMAND_PRIORITY_NORMAL), editor.registerCommand(KEY_ENTER_COMMAND, event_3 => {
|
|
304
304
|
if (groups === null || selectedItemKey === null) {
|
|
305
305
|
return false;
|
|
306
306
|
}
|
|
@@ -315,7 +315,7 @@ export function LexicalMenu({
|
|
|
315
315
|
}
|
|
316
316
|
selectItemAndCleanUp(selectedItem_1);
|
|
317
317
|
return true;
|
|
318
|
-
},
|
|
318
|
+
}, COMMAND_PRIORITY_NORMAL));
|
|
319
319
|
}, [selectItemAndCleanUp, close, editor, groups, selectedItemKey, updateSelectedItem]);
|
|
320
320
|
const listItemProps = useMemo(() => ({
|
|
321
321
|
groups,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LexicalMenu.js","names":["c","_c","useLexicalComposerContext","mergeRegister","$getSelection","$isRangeSelection","$setSelection","COMMAND_PRIORITY_LOW","createCommand","KEY_ARROW_DOWN_COMMAND","KEY_ARROW_UP_COMMAND","KEY_ENTER_COMMAND","KEY_ESCAPE_COMMAND","KEY_TAB_COMMAND","useCallback","useEffect","useLayoutEffect","useMemo","useRef","useState","CAN_USE_DOM","baseClass","scrollIntoViewIfNeeded","target","typeaheadContainerNode","document","getElementById","typeaheadRect","getBoundingClientRect","top","height","window","innerHeight","scrollIntoView","block","getFullMatchOffset","documentText","entryText","offset","triggerOffset","i","length","substring","$splitNodeContainingQuery","match","selection","isCollapsed","anchor","type","anchorNode","getNode","isSimpleText","selectionOffset","textContent","getTextContent","slice","characterOffset","replaceableString","queryOffset","matchingString","startOffset","newNode","splitText","getScrollParent","element","includeHidden","style","getComputedStyle","excludeStaticParent","position","overflowRegex","body","parent1","parentElement","test","overflow","overflowY","overflowX","isTriggerVisibleInNearestScrollContainer","targetElement","containerElement","tRect","cRect","bottom","useDynamicPositioning","resolution","targetElementRef","onReposition","onVisibilityChange","$","editor","t0","t1","current","rootElement","getRootElement","rootScrollParent","ticking","previousIsInView","handleScroll","requestAnimationFrame","isInView","resizeObserver","ResizeObserver","addEventListener","capture","passive","observe","disconnect","removeEventListener","SCROLL_TYPEAHEAD_OPTION_INTO_VIEW_COMMAND","LexicalMenu","anchorElementRef","close","groups","menuRenderFn","shouldSplitNodeWithQuery","selectedItemKey","setSelectedItemKey","updateSelectedItem","item","rootElem","setAttribute","key","setSelectedItemKeyToFirstMatchingItem","allItems","flatMap","group","items","firstMatchingItem","selectItemAndCleanUp","selectedItem","update","textNodeContainingQuery","remove","setTimeout","read","clone","onSelect","queryString","removeAttribute","registerCommand","ref","payload","event","selectedIndex","findIndex","newSelectedIndex","newSelectedItem","dispatchCommand","index","preventDefault","stopImmediatePropagation","find","listItemProps","setContainerDivAttributes","containerDiv","className","display","useMenuAnchorRef","anchorElem","setResolution","Symbol","for","createElement","parent","undefined","menuEle","firstChild","width","getRect","left","rawTop","scrollY","scrollX","menuRect","menuHeight","menuWidth","rootElementRect","right","wouldGoOffBottomOfScreen","wouldGoOffTopOfScreen","isConnected","append","positionMenu","t2","t3","rootElement_0","containerDiv_0","t4"],"sources":["../../../../../src/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/LexicalMenu.tsx"],"sourcesContent":["'use client'\nimport type { BaseSelection, LexicalCommand, LexicalEditor, TextNode } from 'lexical'\nimport type { JSX, ReactPortal, RefObject } from 'react'\n\nimport { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext.js'\nimport { mergeRegister } from '@lexical/utils'\nimport {\n $getSelection,\n $isRangeSelection,\n $setSelection,\n COMMAND_PRIORITY_LOW,\n createCommand,\n KEY_ARROW_DOWN_COMMAND,\n KEY_ARROW_UP_COMMAND,\n KEY_ENTER_COMMAND,\n KEY_ESCAPE_COMMAND,\n KEY_TAB_COMMAND,\n} from 'lexical'\nimport { useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState } from 'react'\n\nimport type { MenuTextMatch } from '../useMenuTriggerMatch.js'\nimport type { SlashMenuGroupInternal, SlashMenuItem, SlashMenuItemInternal } from './types.js'\n\nimport { CAN_USE_DOM } from '../../../utils/canUseDOM.js'\n\nexport type MenuResolution = {\n getRect: () => DOMRect\n match?: MenuTextMatch\n}\n\nconst baseClass = 'slash-menu-popup'\n\nexport type MenuRenderFn = (\n anchorElementRef: RefObject<HTMLElement | null>,\n itemProps: {\n groups: Array<SlashMenuGroupInternal>\n selectedItemKey: null | string\n selectItemAndCleanUp: (selectedItem: SlashMenuItem) => void\n setSelectedItemKey: (itemKey: string) => void\n },\n matchingString: null | string,\n) => JSX.Element | null | ReactPortal\n\nconst scrollIntoViewIfNeeded = (target: HTMLElement) => {\n const typeaheadContainerNode = document.getElementById('slash-menu')\n if (!typeaheadContainerNode) {\n return\n }\n\n const typeaheadRect = typeaheadContainerNode.getBoundingClientRect()\n\n if (typeaheadRect.top + typeaheadRect.height > window.innerHeight) {\n typeaheadContainerNode.scrollIntoView({\n block: 'center',\n })\n }\n\n if (typeaheadRect.top < 0) {\n typeaheadContainerNode.scrollIntoView({\n block: 'center',\n })\n }\n\n target.scrollIntoView({ block: 'nearest' })\n}\n\n/**\n * Walk backwards along user input and forward through entity title to try\n * and replace more of the user's text with entity.\n */\nfunction getFullMatchOffset(documentText: string, entryText: string, offset: number) {\n let triggerOffset = offset\n for (let i = triggerOffset; i <= entryText.length; i++) {\n if (documentText.substring(documentText.length - i) === entryText.substring(0, i)) {\n triggerOffset = i\n }\n }\n return triggerOffset\n}\n\n/**\n * Split Lexical TextNode and return a new TextNode only containing matched text.\n * Common use cases include: removing the node, replacing with a new node.\n */\nfunction $splitNodeContainingQuery(match: MenuTextMatch): TextNode | undefined {\n const selection = $getSelection()\n if (!$isRangeSelection(selection) || !selection.isCollapsed()) {\n return\n }\n const anchor = selection.anchor\n if (anchor.type !== 'text') {\n return\n }\n const anchorNode = anchor.getNode()\n if (!anchorNode.isSimpleText()) {\n return\n }\n const selectionOffset = anchor.offset\n const textContent = anchorNode.getTextContent().slice(0, selectionOffset)\n const characterOffset = match.replaceableString.length\n const queryOffset = getFullMatchOffset(textContent, match.matchingString, characterOffset)\n const startOffset = selectionOffset - queryOffset\n if (startOffset < 0) {\n return\n }\n let newNode\n if (startOffset === 0) {\n ;[newNode] = anchorNode.splitText(selectionOffset)\n } else {\n ;[, newNode] = anchorNode.splitText(startOffset, selectionOffset)\n }\n\n return newNode\n}\n\n// Got from https://stackoverflow.com/a/42543908/2013580\nexport function getScrollParent(\n element: HTMLElement,\n includeHidden: boolean,\n): HTMLBodyElement | HTMLElement {\n let style = getComputedStyle(element)\n const excludeStaticParent = style.position === 'absolute'\n const overflowRegex = includeHidden ? /(auto|scroll|hidden)/ : /(auto|scroll)/\n if (style.position === 'fixed') {\n return document.body\n }\n for (let parent: HTMLElement | null = element; (parent = parent.parentElement); ) {\n style = getComputedStyle(parent)\n if (excludeStaticParent && style.position === 'static') {\n continue\n }\n if (overflowRegex.test(style.overflow + style.overflowY + style.overflowX)) {\n return parent\n }\n }\n return document.body\n}\n\nfunction isTriggerVisibleInNearestScrollContainer(\n targetElement: HTMLElement,\n containerElement: HTMLElement,\n): boolean {\n const tRect = targetElement.getBoundingClientRect()\n const cRect = containerElement.getBoundingClientRect()\n return tRect.top > cRect.top && tRect.top < cRect.bottom\n}\n\n// Reposition the menu on scroll, window resize, and element resize.\nexport function useDynamicPositioning(\n resolution: MenuResolution | null,\n targetElementRef: RefObject<HTMLElement | null>,\n onReposition: () => void,\n onVisibilityChange?: (isInView: boolean) => void,\n) {\n const [editor] = useLexicalComposerContext()\n useEffect(() => {\n const targetElement = targetElementRef.current\n if (targetElement != null && resolution != null) {\n const rootElement = editor.getRootElement()\n const rootScrollParent =\n rootElement != null ? getScrollParent(rootElement, false) : document.body\n let ticking = false\n let previousIsInView = isTriggerVisibleInNearestScrollContainer(\n targetElement,\n rootScrollParent,\n )\n const handleScroll = function () {\n if (!ticking) {\n window.requestAnimationFrame(function () {\n onReposition()\n ticking = false\n })\n ticking = true\n }\n const isInView = isTriggerVisibleInNearestScrollContainer(targetElement, rootScrollParent)\n if (isInView !== previousIsInView) {\n previousIsInView = isInView\n if (onVisibilityChange != null) {\n onVisibilityChange(isInView)\n }\n }\n }\n const resizeObserver = new ResizeObserver(onReposition)\n window.addEventListener('resize', onReposition)\n document.addEventListener('scroll', handleScroll, {\n capture: true,\n passive: true,\n })\n resizeObserver.observe(targetElement)\n return () => {\n resizeObserver.disconnect()\n window.removeEventListener('resize', onReposition)\n document.removeEventListener('scroll', handleScroll, true)\n }\n }\n }, [editor, onVisibilityChange, onReposition, resolution, targetElementRef])\n}\n\nexport const SCROLL_TYPEAHEAD_OPTION_INTO_VIEW_COMMAND: LexicalCommand<{\n index: number\n item: SlashMenuItemInternal\n}> = createCommand('SCROLL_TYPEAHEAD_OPTION_INTO_VIEW_COMMAND')\n\nexport function LexicalMenu({\n anchorElementRef,\n close,\n editor,\n // groups filtering is already handled in SlashMenu/index.tsx. Thus, groups always contains the matching items.\n groups,\n menuRenderFn,\n resolution,\n shouldSplitNodeWithQuery = false,\n}: {\n anchorElementRef: RefObject<HTMLElement | null>\n close: () => void\n editor: LexicalEditor\n groups: Array<SlashMenuGroupInternal>\n menuRenderFn: MenuRenderFn\n resolution: MenuResolution\n shouldSplitNodeWithQuery?: boolean\n}): JSX.Element | null {\n const [selectedItemKey, setSelectedItemKey] = useState<null | string>(null)\n\n const matchingString = (resolution.match && resolution.match.matchingString) || ''\n\n const updateSelectedItem = useCallback(\n (item: SlashMenuItem) => {\n const rootElem = editor.getRootElement()\n if (rootElem !== null) {\n rootElem.setAttribute('aria-activedescendant', `${baseClass}__item-${item.key}`)\n setSelectedItemKey(item.key)\n }\n },\n [editor],\n )\n\n const setSelectedItemKeyToFirstMatchingItem = useCallback(() => {\n // set selected item to the first of the matching ones\n if (groups !== null && matchingString != null) {\n // groups filtering is already handled in SlashMenu/index.tsx. Thus, groups always contains the matching items.\n const allItems = groups.flatMap((group) => group.items)\n\n if (allItems.length) {\n const firstMatchingItem = allItems[0]!\n updateSelectedItem(firstMatchingItem)\n }\n }\n }, [groups, updateSelectedItem, matchingString])\n\n useEffect(() => {\n setSelectedItemKeyToFirstMatchingItem()\n }, [matchingString, setSelectedItemKeyToFirstMatchingItem])\n\n const selectItemAndCleanUp = useCallback(\n (selectedItem: SlashMenuItem) => {\n close()\n\n editor.update(() => {\n const textNodeContainingQuery =\n resolution.match != null && shouldSplitNodeWithQuery\n ? $splitNodeContainingQuery(resolution.match)\n : null\n\n if (textNodeContainingQuery) {\n textNodeContainingQuery.remove()\n }\n })\n\n setTimeout(() => {\n // Needed in Firefox. See https://github.com/payloadcms/payload/issues/10724\n let selection: BaseSelection | undefined\n editor.read(() => {\n selection = $getSelection()?.clone()\n })\n editor.update(() => {\n if (selection) {\n $setSelection(selection)\n }\n })\n\n selectedItem.onSelect({\n editor,\n queryString: resolution.match ? resolution.match.matchingString : '',\n })\n }, 0)\n },\n [editor, shouldSplitNodeWithQuery, resolution.match, close],\n )\n\n useEffect(() => {\n return () => {\n const rootElem = editor.getRootElement()\n if (rootElem !== null) {\n rootElem.removeAttribute('aria-activedescendant')\n }\n }\n }, [editor])\n\n useLayoutEffect(() => {\n if (groups === null) {\n setSelectedItemKey(null)\n } else if (selectedItemKey === null) {\n setSelectedItemKeyToFirstMatchingItem()\n }\n }, [groups, selectedItemKey, updateSelectedItem, setSelectedItemKeyToFirstMatchingItem])\n\n useEffect(() => {\n return mergeRegister(\n editor.registerCommand(\n SCROLL_TYPEAHEAD_OPTION_INTO_VIEW_COMMAND,\n ({ item }) => {\n if (item.ref && item.ref.current != null) {\n scrollIntoViewIfNeeded(item.ref.current)\n return true\n }\n\n return false\n },\n COMMAND_PRIORITY_LOW,\n ),\n )\n }, [editor, updateSelectedItem])\n\n useEffect(() => {\n return mergeRegister(\n editor.registerCommand<KeyboardEvent>(\n KEY_ARROW_DOWN_COMMAND,\n (payload) => {\n const event = payload\n if (groups !== null && groups.length && selectedItemKey !== null) {\n const allItems = groups.flatMap((group) => group.items)\n const selectedIndex = allItems.findIndex((item) => item.key === selectedItemKey)\n\n const newSelectedIndex = selectedIndex !== allItems.length - 1 ? selectedIndex + 1 : 0\n\n const newSelectedItem = allItems[newSelectedIndex]\n if (!newSelectedItem) {\n return false\n }\n\n updateSelectedItem(newSelectedItem)\n if (newSelectedItem.ref != null && newSelectedItem.ref.current) {\n editor.dispatchCommand(SCROLL_TYPEAHEAD_OPTION_INTO_VIEW_COMMAND, {\n index: newSelectedIndex,\n item: newSelectedItem,\n })\n }\n event.preventDefault()\n event.stopImmediatePropagation()\n }\n return true\n },\n COMMAND_PRIORITY_LOW,\n ),\n editor.registerCommand<KeyboardEvent>(\n KEY_ARROW_UP_COMMAND,\n (payload) => {\n const event = payload\n if (groups !== null && groups.length && selectedItemKey !== null) {\n const allItems = groups.flatMap((group) => group.items)\n const selectedIndex = allItems.findIndex((item) => item.key === selectedItemKey)\n\n const newSelectedIndex = selectedIndex !== 0 ? selectedIndex - 1 : allItems.length - 1\n\n const newSelectedItem = allItems[newSelectedIndex]\n if (!newSelectedItem) {\n return false\n }\n\n updateSelectedItem(newSelectedItem)\n if (newSelectedItem.ref != null && newSelectedItem.ref.current) {\n scrollIntoViewIfNeeded(newSelectedItem.ref.current)\n }\n event.preventDefault()\n event.stopImmediatePropagation()\n }\n return true\n },\n COMMAND_PRIORITY_LOW,\n ),\n editor.registerCommand<KeyboardEvent>(\n KEY_ESCAPE_COMMAND,\n (payload) => {\n const event = payload\n event.preventDefault()\n event.stopImmediatePropagation()\n close()\n return true\n },\n COMMAND_PRIORITY_LOW,\n ),\n editor.registerCommand<KeyboardEvent>(\n KEY_TAB_COMMAND,\n (payload) => {\n const event = payload\n\n if (groups === null || selectedItemKey === null) {\n return false\n }\n const allItems = groups.flatMap((group) => group.items)\n const selectedItem = allItems.find((item) => item.key === selectedItemKey)\n if (!selectedItem) {\n return false\n }\n\n event.preventDefault()\n event.stopImmediatePropagation()\n selectItemAndCleanUp(selectedItem)\n return true\n },\n COMMAND_PRIORITY_LOW,\n ),\n editor.registerCommand(\n KEY_ENTER_COMMAND,\n (event: KeyboardEvent | null) => {\n if (groups === null || selectedItemKey === null) {\n return false\n }\n const allItems = groups.flatMap((group) => group.items)\n const selectedItem = allItems.find((item) => item.key === selectedItemKey)\n if (!selectedItem) {\n return false\n }\n\n if (event !== null) {\n event.preventDefault()\n event.stopImmediatePropagation()\n }\n selectItemAndCleanUp(selectedItem)\n return true\n },\n COMMAND_PRIORITY_LOW,\n ),\n )\n }, [selectItemAndCleanUp, close, editor, groups, selectedItemKey, updateSelectedItem])\n\n const listItemProps = useMemo(\n () => ({\n groups,\n selectedItemKey,\n selectItemAndCleanUp,\n setSelectedItemKey,\n }),\n [selectItemAndCleanUp, selectedItemKey, groups],\n )\n\n return menuRenderFn(\n anchorElementRef,\n listItemProps,\n resolution.match ? resolution.match.matchingString : '',\n )\n}\n\nfunction setContainerDivAttributes(containerDiv: HTMLElement, className?: string) {\n if (className != null) {\n containerDiv.className = className\n }\n containerDiv.setAttribute('aria-label', 'Slash menu')\n containerDiv.setAttribute('role', 'listbox')\n containerDiv.style.display = 'block'\n containerDiv.style.position = 'absolute'\n}\n\nexport function useMenuAnchorRef(\n anchorElem: HTMLElement,\n resolution: MenuResolution | null,\n setResolution: (r: MenuResolution | null) => void,\n className?: string,\n): RefObject<HTMLElement | null> {\n const [editor] = useLexicalComposerContext()\n const anchorElementRef = useRef<HTMLElement | null>(\n CAN_USE_DOM ? document.createElement('div') : null,\n )\n const positionMenu = useCallback(() => {\n if (anchorElementRef.current === null || parent === undefined) {\n return\n }\n const rootElement = editor.getRootElement()\n const containerDiv = anchorElementRef.current\n\n const VERTICAL_OFFSET = 32\n\n const menuEle = containerDiv.firstChild as Element\n if (rootElement !== null && resolution !== null) {\n const { height, width } = resolution.getRect()\n let { left, top } = resolution.getRect()\n\n const rawTop = top\n top -= anchorElem.getBoundingClientRect().top + window.scrollY\n left -= anchorElem.getBoundingClientRect().left + window.scrollX\n containerDiv.style.left = `${left + window.scrollX}px`\n containerDiv.style.height = `${height}px`\n containerDiv.style.width = `${width}px`\n if (menuEle !== null) {\n const menuRect = menuEle.getBoundingClientRect()\n const menuHeight = menuRect.height\n const menuWidth = menuRect.width\n\n const rootElementRect = rootElement.getBoundingClientRect()\n\n if (left + menuWidth > rootElementRect.right) {\n containerDiv.style.left = `${rootElementRect.right - menuWidth + window.scrollX}px`\n }\n\n const wouldGoOffBottomOfScreen = rawTop + menuHeight + VERTICAL_OFFSET > window.innerHeight\n //const wouldGoOffBottomOfContainer = top + menuHeight > rootElementRect.bottom\n const wouldGoOffTopOfScreen = rawTop < 0\n\n // Position slash menu above the cursor instead of below (default) if it would otherwise go off the bottom of the screen.\n if (wouldGoOffBottomOfScreen && !wouldGoOffTopOfScreen) {\n const margin = 24\n containerDiv.style.top = `${\n top + VERTICAL_OFFSET - menuHeight + window.scrollY - (height + margin)\n }px`\n } else {\n containerDiv.style.top = `${top + window.scrollY + VERTICAL_OFFSET}px`\n }\n }\n\n if (!containerDiv.isConnected) {\n setContainerDivAttributes(containerDiv, className)\n anchorElem.append(containerDiv)\n }\n containerDiv.setAttribute('id', 'slash-menu')\n anchorElementRef.current = containerDiv\n rootElement.setAttribute('aria-controls', 'slash-menu')\n }\n }, [editor, resolution, className, anchorElem])\n\n useEffect(() => {\n const rootElement = editor.getRootElement()\n if (resolution !== null) {\n positionMenu()\n return () => {\n if (rootElement !== null) {\n rootElement.removeAttribute('aria-controls')\n }\n\n const containerDiv = anchorElementRef.current\n if (containerDiv !== null && containerDiv.isConnected) {\n containerDiv.remove()\n containerDiv.removeAttribute('id')\n }\n }\n }\n }, [editor, positionMenu, resolution])\n\n const onVisibilityChange = useCallback(\n (isInView: boolean) => {\n if (resolution !== null) {\n if (!isInView) {\n setResolution(null)\n }\n }\n },\n [resolution, setResolution],\n )\n\n useDynamicPositioning(resolution, anchorElementRef, positionMenu, onVisibilityChange)\n\n return anchorElementRef\n}\n"],"mappings":"AAAA;;AAAA,SAAAA,CAAA,IAAAC,EAAA;AAIA,SAASC,yBAAyB,QAAQ;AAC1C,SAASC,aAAa,QAAQ;AAC9B,SACEC,aAAa,EACbC,iBAAiB,EACjBC,aAAa,EACbC,oBAAoB,EACpBC,aAAa,EACbC,sBAAsB,EACtBC,oBAAoB,EACpBC,iBAAiB,EACjBC,kBAAkB,EAClBC,eAAe,QACV;AACP,SAASC,WAAW,EAAEC,SAAS,EAAEC,eAAe,EAAEC,OAAO,EAAEC,MAAM,EAAEC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,SAAA,CAAU0K,EAgBV,EAAGC,EAAkC;EAAA,IAAAG,EAAA;EAAA,IAAApG,CAAA,SAAAJ,UAAA,IAAAI,CAAA,SAAAwE,aAAA;IAGnC4B,EAAA,GAAAxF,QAAA;MAAA,IACMhB,UAAA,SAAe;QAAA,KACZgB,QAAA;UACH4D,aAAA,KAAc;QAAA;MAAA;IAAA;IAGpBxE,CAAA,OAAAJ,UAAA;IAAAI,CAAA,OAAAwE,aAAA;IAAAxE,CAAA,OAAAoG,EAAA;EAAA;IAAAA,EAAA,GAAApG,CAAA;EAAA;EAPF,MAAAD,kBAAA,GAA2BqG,EAQE;EAG7BzG,qBAAA,CAAsBC,UAAA,EAAY2B,gBAAA,EAAkBwE,YAAA,EAAchG,kBAAA;EAAA,OAE3DwB,gBAAA;AAAA","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"LexicalMenu.js","names":["c","_c","useLexicalComposerContext","mergeRegister","$getSelection","$isRangeSelection","$setSelection","COMMAND_PRIORITY_LOW","COMMAND_PRIORITY_NORMAL","createCommand","KEY_ARROW_DOWN_COMMAND","KEY_ARROW_UP_COMMAND","KEY_ENTER_COMMAND","KEY_ESCAPE_COMMAND","KEY_TAB_COMMAND","useCallback","useEffect","useLayoutEffect","useMemo","useRef","useState","CAN_USE_DOM","baseClass","scrollIntoViewIfNeeded","target","typeaheadContainerNode","document","getElementById","typeaheadRect","getBoundingClientRect","top","height","window","innerHeight","scrollIntoView","block","getFullMatchOffset","documentText","entryText","offset","triggerOffset","i","length","substring","$splitNodeContainingQuery","match","selection","isCollapsed","anchor","type","anchorNode","getNode","isSimpleText","selectionOffset","textContent","getTextContent","slice","characterOffset","replaceableString","queryOffset","matchingString","startOffset","newNode","splitText","getScrollParent","element","includeHidden","style","getComputedStyle","excludeStaticParent","position","overflowRegex","body","parent1","parentElement","test","overflow","overflowY","overflowX","isTriggerVisibleInNearestScrollContainer","targetElement","containerElement","tRect","cRect","bottom","useDynamicPositioning","resolution","targetElementRef","onReposition","onVisibilityChange","$","editor","t0","t1","current","rootElement","getRootElement","rootScrollParent","ticking","previousIsInView","handleScroll","requestAnimationFrame","isInView","resizeObserver","ResizeObserver","addEventListener","capture","passive","observe","disconnect","removeEventListener","SCROLL_TYPEAHEAD_OPTION_INTO_VIEW_COMMAND","LexicalMenu","anchorElementRef","close","groups","menuRenderFn","shouldSplitNodeWithQuery","selectedItemKey","setSelectedItemKey","updateSelectedItem","item","rootElem","setAttribute","key","setSelectedItemKeyToFirstMatchingItem","allItems","flatMap","group","items","firstMatchingItem","selectItemAndCleanUp","selectedItem","update","textNodeContainingQuery","remove","setTimeout","read","clone","onSelect","queryString","removeAttribute","registerCommand","ref","payload","event","selectedIndex","findIndex","newSelectedIndex","newSelectedItem","dispatchCommand","index","preventDefault","stopImmediatePropagation","find","listItemProps","setContainerDivAttributes","containerDiv","className","display","useMenuAnchorRef","anchorElem","setResolution","Symbol","for","createElement","parent","undefined","menuEle","firstChild","width","getRect","left","rawTop","scrollY","scrollX","menuRect","menuHeight","menuWidth","rootElementRect","right","wouldGoOffBottomOfScreen","wouldGoOffTopOfScreen","isConnected","append","positionMenu","t2","t3","rootElement_0","containerDiv_0","t4"],"sources":["../../../../../src/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/LexicalMenu.tsx"],"sourcesContent":["'use client'\nimport type { BaseSelection, LexicalCommand, LexicalEditor, TextNode } from 'lexical'\nimport type { JSX, ReactPortal, RefObject } from 'react'\n\nimport { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext.js'\nimport { mergeRegister } from '@lexical/utils'\nimport {\n $getSelection,\n $isRangeSelection,\n $setSelection,\n COMMAND_PRIORITY_LOW,\n COMMAND_PRIORITY_NORMAL,\n createCommand,\n KEY_ARROW_DOWN_COMMAND,\n KEY_ARROW_UP_COMMAND,\n KEY_ENTER_COMMAND,\n KEY_ESCAPE_COMMAND,\n KEY_TAB_COMMAND,\n} from 'lexical'\nimport { useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState } from 'react'\n\nimport type { MenuTextMatch } from '../useMenuTriggerMatch.js'\nimport type { SlashMenuGroupInternal, SlashMenuItem, SlashMenuItemInternal } from './types.js'\n\nimport { CAN_USE_DOM } from '../../../utils/canUseDOM.js'\n\nexport type MenuResolution = {\n getRect: () => DOMRect\n match?: MenuTextMatch\n}\n\nconst baseClass = 'slash-menu-popup'\n\nexport type MenuRenderFn = (\n anchorElementRef: RefObject<HTMLElement | null>,\n itemProps: {\n groups: Array<SlashMenuGroupInternal>\n selectedItemKey: null | string\n selectItemAndCleanUp: (selectedItem: SlashMenuItem) => void\n setSelectedItemKey: (itemKey: string) => void\n },\n matchingString: null | string,\n) => JSX.Element | null | ReactPortal\n\nconst scrollIntoViewIfNeeded = (target: HTMLElement) => {\n const typeaheadContainerNode = document.getElementById('slash-menu')\n if (!typeaheadContainerNode) {\n return\n }\n\n const typeaheadRect = typeaheadContainerNode.getBoundingClientRect()\n\n if (typeaheadRect.top + typeaheadRect.height > window.innerHeight) {\n typeaheadContainerNode.scrollIntoView({\n block: 'center',\n })\n }\n\n if (typeaheadRect.top < 0) {\n typeaheadContainerNode.scrollIntoView({\n block: 'center',\n })\n }\n\n target.scrollIntoView({ block: 'nearest' })\n}\n\n/**\n * Walk backwards along user input and forward through entity title to try\n * and replace more of the user's text with entity.\n */\nfunction getFullMatchOffset(documentText: string, entryText: string, offset: number) {\n let triggerOffset = offset\n for (let i = triggerOffset; i <= entryText.length; i++) {\n if (documentText.substring(documentText.length - i) === entryText.substring(0, i)) {\n triggerOffset = i\n }\n }\n return triggerOffset\n}\n\n/**\n * Split Lexical TextNode and return a new TextNode only containing matched text.\n * Common use cases include: removing the node, replacing with a new node.\n */\nfunction $splitNodeContainingQuery(match: MenuTextMatch): TextNode | undefined {\n const selection = $getSelection()\n if (!$isRangeSelection(selection) || !selection.isCollapsed()) {\n return\n }\n const anchor = selection.anchor\n if (anchor.type !== 'text') {\n return\n }\n const anchorNode = anchor.getNode()\n if (!anchorNode.isSimpleText()) {\n return\n }\n const selectionOffset = anchor.offset\n const textContent = anchorNode.getTextContent().slice(0, selectionOffset)\n const characterOffset = match.replaceableString.length\n const queryOffset = getFullMatchOffset(textContent, match.matchingString, characterOffset)\n const startOffset = selectionOffset - queryOffset\n if (startOffset < 0) {\n return\n }\n let newNode\n if (startOffset === 0) {\n ;[newNode] = anchorNode.splitText(selectionOffset)\n } else {\n ;[, newNode] = anchorNode.splitText(startOffset, selectionOffset)\n }\n\n return newNode\n}\n\n// Got from https://stackoverflow.com/a/42543908/2013580\nexport function getScrollParent(\n element: HTMLElement,\n includeHidden: boolean,\n): HTMLBodyElement | HTMLElement {\n let style = getComputedStyle(element)\n const excludeStaticParent = style.position === 'absolute'\n const overflowRegex = includeHidden ? /(auto|scroll|hidden)/ : /(auto|scroll)/\n if (style.position === 'fixed') {\n return document.body\n }\n for (let parent: HTMLElement | null = element; (parent = parent.parentElement); ) {\n style = getComputedStyle(parent)\n if (excludeStaticParent && style.position === 'static') {\n continue\n }\n if (overflowRegex.test(style.overflow + style.overflowY + style.overflowX)) {\n return parent\n }\n }\n return document.body\n}\n\nfunction isTriggerVisibleInNearestScrollContainer(\n targetElement: HTMLElement,\n containerElement: HTMLElement,\n): boolean {\n const tRect = targetElement.getBoundingClientRect()\n const cRect = containerElement.getBoundingClientRect()\n return tRect.top > cRect.top && tRect.top < cRect.bottom\n}\n\n// Reposition the menu on scroll, window resize, and element resize.\nexport function useDynamicPositioning(\n resolution: MenuResolution | null,\n targetElementRef: RefObject<HTMLElement | null>,\n onReposition: () => void,\n onVisibilityChange?: (isInView: boolean) => void,\n) {\n const [editor] = useLexicalComposerContext()\n useEffect(() => {\n const targetElement = targetElementRef.current\n if (targetElement != null && resolution != null) {\n const rootElement = editor.getRootElement()\n const rootScrollParent =\n rootElement != null ? getScrollParent(rootElement, false) : document.body\n let ticking = false\n let previousIsInView = isTriggerVisibleInNearestScrollContainer(\n targetElement,\n rootScrollParent,\n )\n const handleScroll = function () {\n if (!ticking) {\n window.requestAnimationFrame(function () {\n onReposition()\n ticking = false\n })\n ticking = true\n }\n const isInView = isTriggerVisibleInNearestScrollContainer(targetElement, rootScrollParent)\n if (isInView !== previousIsInView) {\n previousIsInView = isInView\n if (onVisibilityChange != null) {\n onVisibilityChange(isInView)\n }\n }\n }\n const resizeObserver = new ResizeObserver(onReposition)\n window.addEventListener('resize', onReposition)\n document.addEventListener('scroll', handleScroll, {\n capture: true,\n passive: true,\n })\n resizeObserver.observe(targetElement)\n return () => {\n resizeObserver.disconnect()\n window.removeEventListener('resize', onReposition)\n document.removeEventListener('scroll', handleScroll, true)\n }\n }\n }, [editor, onVisibilityChange, onReposition, resolution, targetElementRef])\n}\n\nexport const SCROLL_TYPEAHEAD_OPTION_INTO_VIEW_COMMAND: LexicalCommand<{\n index: number\n item: SlashMenuItemInternal\n}> = createCommand('SCROLL_TYPEAHEAD_OPTION_INTO_VIEW_COMMAND')\n\nexport function LexicalMenu({\n anchorElementRef,\n close,\n editor,\n // groups filtering is already handled in SlashMenu/index.tsx. Thus, groups always contains the matching items.\n groups,\n menuRenderFn,\n resolution,\n shouldSplitNodeWithQuery = false,\n}: {\n anchorElementRef: RefObject<HTMLElement | null>\n close: () => void\n editor: LexicalEditor\n groups: Array<SlashMenuGroupInternal>\n menuRenderFn: MenuRenderFn\n resolution: MenuResolution\n shouldSplitNodeWithQuery?: boolean\n}): JSX.Element | null {\n const [selectedItemKey, setSelectedItemKey] = useState<null | string>(null)\n\n const matchingString = (resolution.match && resolution.match.matchingString) || ''\n\n const updateSelectedItem = useCallback(\n (item: SlashMenuItem) => {\n const rootElem = editor.getRootElement()\n if (rootElem !== null) {\n rootElem.setAttribute('aria-activedescendant', `${baseClass}__item-${item.key}`)\n setSelectedItemKey(item.key)\n }\n },\n [editor],\n )\n\n const setSelectedItemKeyToFirstMatchingItem = useCallback(() => {\n // set selected item to the first of the matching ones\n if (groups !== null && matchingString != null) {\n // groups filtering is already handled in SlashMenu/index.tsx. Thus, groups always contains the matching items.\n const allItems = groups.flatMap((group) => group.items)\n\n if (allItems.length) {\n const firstMatchingItem = allItems[0]!\n updateSelectedItem(firstMatchingItem)\n }\n }\n }, [groups, updateSelectedItem, matchingString])\n\n useEffect(() => {\n setSelectedItemKeyToFirstMatchingItem()\n }, [matchingString, setSelectedItemKeyToFirstMatchingItem])\n\n const selectItemAndCleanUp = useCallback(\n (selectedItem: SlashMenuItem) => {\n close()\n\n editor.update(() => {\n const textNodeContainingQuery =\n resolution.match != null && shouldSplitNodeWithQuery\n ? $splitNodeContainingQuery(resolution.match)\n : null\n\n if (textNodeContainingQuery) {\n textNodeContainingQuery.remove()\n }\n })\n\n setTimeout(() => {\n // Needed in Firefox. See https://github.com/payloadcms/payload/issues/10724\n let selection: BaseSelection | undefined\n editor.read(() => {\n selection = $getSelection()?.clone()\n })\n editor.update(() => {\n if (selection) {\n $setSelection(selection)\n }\n })\n\n selectedItem.onSelect({\n editor,\n queryString: resolution.match ? resolution.match.matchingString : '',\n })\n }, 0)\n },\n [editor, shouldSplitNodeWithQuery, resolution.match, close],\n )\n\n useEffect(() => {\n return () => {\n const rootElem = editor.getRootElement()\n if (rootElem !== null) {\n rootElem.removeAttribute('aria-activedescendant')\n }\n }\n }, [editor])\n\n useLayoutEffect(() => {\n if (groups === null) {\n setSelectedItemKey(null)\n } else if (selectedItemKey === null) {\n setSelectedItemKeyToFirstMatchingItem()\n }\n }, [groups, selectedItemKey, updateSelectedItem, setSelectedItemKeyToFirstMatchingItem])\n\n useEffect(() => {\n return mergeRegister(\n editor.registerCommand(\n SCROLL_TYPEAHEAD_OPTION_INTO_VIEW_COMMAND,\n ({ item }) => {\n if (item.ref && item.ref.current != null) {\n scrollIntoViewIfNeeded(item.ref.current)\n return true\n }\n\n return false\n },\n COMMAND_PRIORITY_LOW,\n ),\n )\n }, [editor, updateSelectedItem])\n\n useEffect(() => {\n return mergeRegister(\n editor.registerCommand<KeyboardEvent>(\n KEY_ARROW_DOWN_COMMAND,\n (payload) => {\n const event = payload\n if (groups !== null && groups.length && selectedItemKey !== null) {\n const allItems = groups.flatMap((group) => group.items)\n const selectedIndex = allItems.findIndex((item) => item.key === selectedItemKey)\n\n const newSelectedIndex = selectedIndex !== allItems.length - 1 ? selectedIndex + 1 : 0\n\n const newSelectedItem = allItems[newSelectedIndex]\n if (!newSelectedItem) {\n return false\n }\n\n updateSelectedItem(newSelectedItem)\n if (newSelectedItem.ref != null && newSelectedItem.ref.current) {\n editor.dispatchCommand(SCROLL_TYPEAHEAD_OPTION_INTO_VIEW_COMMAND, {\n index: newSelectedIndex,\n item: newSelectedItem,\n })\n }\n event.preventDefault()\n event.stopImmediatePropagation()\n }\n return true\n },\n COMMAND_PRIORITY_NORMAL,\n ),\n editor.registerCommand<KeyboardEvent>(\n KEY_ARROW_UP_COMMAND,\n (payload) => {\n const event = payload\n if (groups !== null && groups.length && selectedItemKey !== null) {\n const allItems = groups.flatMap((group) => group.items)\n const selectedIndex = allItems.findIndex((item) => item.key === selectedItemKey)\n\n const newSelectedIndex = selectedIndex !== 0 ? selectedIndex - 1 : allItems.length - 1\n\n const newSelectedItem = allItems[newSelectedIndex]\n if (!newSelectedItem) {\n return false\n }\n\n updateSelectedItem(newSelectedItem)\n if (newSelectedItem.ref != null && newSelectedItem.ref.current) {\n scrollIntoViewIfNeeded(newSelectedItem.ref.current)\n }\n event.preventDefault()\n event.stopImmediatePropagation()\n }\n return true\n },\n COMMAND_PRIORITY_NORMAL,\n ),\n editor.registerCommand<KeyboardEvent>(\n KEY_ESCAPE_COMMAND,\n (payload) => {\n const event = payload\n event.preventDefault()\n event.stopImmediatePropagation()\n close()\n return true\n },\n COMMAND_PRIORITY_LOW,\n ),\n editor.registerCommand<KeyboardEvent>(\n KEY_TAB_COMMAND,\n (payload) => {\n const event = payload\n\n if (groups === null || selectedItemKey === null) {\n return false\n }\n const allItems = groups.flatMap((group) => group.items)\n const selectedItem = allItems.find((item) => item.key === selectedItemKey)\n if (!selectedItem) {\n return false\n }\n\n event.preventDefault()\n event.stopImmediatePropagation()\n selectItemAndCleanUp(selectedItem)\n return true\n },\n COMMAND_PRIORITY_NORMAL,\n ),\n editor.registerCommand(\n KEY_ENTER_COMMAND,\n (event: KeyboardEvent | null) => {\n if (groups === null || selectedItemKey === null) {\n return false\n }\n const allItems = groups.flatMap((group) => group.items)\n const selectedItem = allItems.find((item) => item.key === selectedItemKey)\n if (!selectedItem) {\n return false\n }\n\n if (event !== null) {\n event.preventDefault()\n event.stopImmediatePropagation()\n }\n selectItemAndCleanUp(selectedItem)\n return true\n },\n COMMAND_PRIORITY_NORMAL,\n ),\n )\n }, [selectItemAndCleanUp, close, editor, groups, selectedItemKey, updateSelectedItem])\n\n const listItemProps = useMemo(\n () => ({\n groups,\n selectedItemKey,\n selectItemAndCleanUp,\n setSelectedItemKey,\n }),\n [selectItemAndCleanUp, selectedItemKey, groups],\n )\n\n return menuRenderFn(\n anchorElementRef,\n listItemProps,\n resolution.match ? resolution.match.matchingString : '',\n )\n}\n\nfunction setContainerDivAttributes(containerDiv: HTMLElement, className?: string) {\n if (className != null) {\n containerDiv.className = className\n }\n containerDiv.setAttribute('aria-label', 'Slash menu')\n containerDiv.setAttribute('role', 'listbox')\n containerDiv.style.display = 'block'\n containerDiv.style.position = 'absolute'\n}\n\nexport function useMenuAnchorRef(\n anchorElem: HTMLElement,\n resolution: MenuResolution | null,\n setResolution: (r: MenuResolution | null) => void,\n className?: string,\n): RefObject<HTMLElement | null> {\n const [editor] = useLexicalComposerContext()\n const anchorElementRef = useRef<HTMLElement | null>(\n CAN_USE_DOM ? document.createElement('div') : null,\n )\n const positionMenu = useCallback(() => {\n if (anchorElementRef.current === null || parent === undefined) {\n return\n }\n const rootElement = editor.getRootElement()\n const containerDiv = anchorElementRef.current\n\n const VERTICAL_OFFSET = 32\n\n const menuEle = containerDiv.firstChild as Element\n if (rootElement !== null && resolution !== null) {\n const { height, width } = resolution.getRect()\n let { left, top } = resolution.getRect()\n\n const rawTop = top\n top -= anchorElem.getBoundingClientRect().top + window.scrollY\n left -= anchorElem.getBoundingClientRect().left + window.scrollX\n containerDiv.style.left = `${left + window.scrollX}px`\n containerDiv.style.height = `${height}px`\n containerDiv.style.width = `${width}px`\n if (menuEle !== null) {\n const menuRect = menuEle.getBoundingClientRect()\n const menuHeight = menuRect.height\n const menuWidth = menuRect.width\n\n const rootElementRect = rootElement.getBoundingClientRect()\n\n if (left + menuWidth > rootElementRect.right) {\n containerDiv.style.left = `${rootElementRect.right - menuWidth + window.scrollX}px`\n }\n\n const wouldGoOffBottomOfScreen = rawTop + menuHeight + VERTICAL_OFFSET > window.innerHeight\n //const wouldGoOffBottomOfContainer = top + menuHeight > rootElementRect.bottom\n const wouldGoOffTopOfScreen = rawTop < 0\n\n // Position slash menu above the cursor instead of below (default) if it would otherwise go off the bottom of the screen.\n if (wouldGoOffBottomOfScreen && !wouldGoOffTopOfScreen) {\n const margin = 24\n containerDiv.style.top = `${\n top + VERTICAL_OFFSET - menuHeight + window.scrollY - (height + margin)\n }px`\n } else {\n containerDiv.style.top = `${top + window.scrollY + VERTICAL_OFFSET}px`\n }\n }\n\n if (!containerDiv.isConnected) {\n setContainerDivAttributes(containerDiv, className)\n anchorElem.append(containerDiv)\n }\n containerDiv.setAttribute('id', 'slash-menu')\n anchorElementRef.current = containerDiv\n rootElement.setAttribute('aria-controls', 'slash-menu')\n }\n }, [editor, resolution, className, anchorElem])\n\n useEffect(() => {\n const rootElement = editor.getRootElement()\n if (resolution !== null) {\n positionMenu()\n return () => {\n if (rootElement !== null) {\n rootElement.removeAttribute('aria-controls')\n }\n\n const containerDiv = anchorElementRef.current\n if (containerDiv !== null && containerDiv.isConnected) {\n containerDiv.remove()\n containerDiv.removeAttribute('id')\n }\n }\n }\n }, [editor, positionMenu, resolution])\n\n const onVisibilityChange = useCallback(\n (isInView: boolean) => {\n if (resolution !== null) {\n if (!isInView) {\n setResolution(null)\n }\n }\n },\n [resolution, setResolution],\n )\n\n useDynamicPositioning(resolution, anchorElementRef, positionMenu,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wB;YACnD1B,cAAA,CAAAtB,MAAA,CAAmB;YACnBsB,cAAA,CAAAhB,eAAA,CAA6B;UAAA;QAAA;MAAA;IAAA;IAIlC8C,EAAA,IAAChG,MAAA,EAAQ8F,YAAA,EAAcnG,UAAA;IAAWI,CAAA,MAAAC,MAAA;IAAAD,CAAA,MAAA+F,YAAA;IAAA/F,CAAA,MAAAJ,UAAA;IAAAI,CAAA,MAAAgG,EAAA;IAAAhG,CAAA,OAAAiG,EAAA;EAAA;IAAAD,EAAA,GAAAhG,CAAA;IAAAiG,EAAA,GAAAjG,CAAA;EAAA;EAhBrC1E,SAAA,CAAU0K,EAgBV,EAAGC,EAAkC;EAAA,IAAAG,EAAA;EAAA,IAAApG,CAAA,SAAAJ,UAAA,IAAAI,CAAA,SAAAwE,aAAA;IAGnC4B,EAAA,GAAAxF,QAAA;MAAA,IACMhB,UAAA,SAAe;QAAA,KACZgB,QAAA;UACH4D,aAAA,KAAc;QAAA;MAAA;IAAA;IAGpBxE,CAAA,OAAAJ,UAAA;IAAAI,CAAA,OAAAwE,aAAA;IAAAxE,CAAA,OAAAoG,EAAA;EAAA;IAAAA,EAAA,GAAApG,CAAA;EAAA;EAPF,MAAAD,kBAAA,GAA2BqG,EAQE;EAG7BzG,qBAAA,CAAsBC,UAAA,EAAY2B,gBAAA,EAAkBwE,YAAA,EAAchG,kBAAA;EAAA,OAE3DwB,gBAAA;AAAA","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/lexical/ui/icons/CodeBlock/index.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,eAAO,MAAM,aAAa,EAAE,KAAK,CAAC,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/lexical/ui/icons/CodeBlock/index.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,eAAO,MAAM,aAAa,EAAE,KAAK,CAAC,EAQjC,CAAA"}
|
|
@@ -1,22 +1,17 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
|
-
import { jsx as _jsx
|
|
3
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
4
4
|
import React from 'react';
|
|
5
|
-
export const CodeBlockIcon = () => /*#__PURE__*/
|
|
6
|
-
"aria-hidden": "true",
|
|
7
|
-
className: "icon",
|
|
5
|
+
export const CodeBlockIcon = () => /*#__PURE__*/_jsx("svg", {
|
|
8
6
|
fill: "none",
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
width: "20",
|
|
7
|
+
height: "12",
|
|
8
|
+
viewBox: "0 0 15 12",
|
|
9
|
+
width: "15",
|
|
13
10
|
xmlns: "http://www.w3.org/2000/svg",
|
|
14
|
-
children:
|
|
15
|
-
d: "
|
|
16
|
-
stroke: "currentColor"
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
stroke: "currentColor"
|
|
20
|
-
})]
|
|
11
|
+
children: /*#__PURE__*/_jsx("path", {
|
|
12
|
+
d: "M11.3738 8.62598L14.0404 5.95931L11.3738 3.29264M3.37376 3.29264L0.707092 5.95931L3.37376 8.62598M9.04043 0.625977L5.70709 11.2926",
|
|
13
|
+
stroke: "currentColor",
|
|
14
|
+
strokeLinecap: "square"
|
|
15
|
+
})
|
|
21
16
|
});
|
|
22
17
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["React","CodeBlockIcon","
|
|
1
|
+
{"version":3,"file":"index.js","names":["React","CodeBlockIcon","_jsx","fill","height","viewBox","width","xmlns","d","stroke","strokeLinecap"],"sources":["../../../../../src/lexical/ui/icons/CodeBlock/index.tsx"],"sourcesContent":["'use client'\nimport React from 'react'\n\nexport const CodeBlockIcon: React.FC = () => (\n <svg fill=\"none\" height=\"12\" viewBox=\"0 0 15 12\" width=\"15\" xmlns=\"http://www.w3.org/2000/svg\">\n <path\n d=\"M11.3738 8.62598L14.0404 5.95931L11.3738 3.29264M3.37376 3.29264L0.707092 5.95931L3.37376 8.62598M9.04043 0.625977L5.70709 11.2926\"\n stroke=\"currentColor\"\n strokeLinecap=\"square\"\n />\n </svg>\n)\n"],"mappings":"AAAA;;;AACA,OAAOA,KAAA,MAAW;AAElB,OAAO,MAAMC,aAAA,GAA0BA,CAAA,kBACrCC,IAAA,CAAC;EAAIC,IAAA,EAAK;EAAOC,MAAA,EAAO;EAAKC,OAAA,EAAQ;EAAYC,KAAA,EAAM;EAAKC,KAAA,EAAM;YAChE,aAAAL,IAAA,CAAC;IACCM,CAAA,EAAE;IACFC,MAAA,EAAO;IACPC,aAAA,EAAc","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/lexical/ui/icons/Collapse/index.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,eAAO,MAAM,YAAY,EAAE,KAAK,CAAC,EAShC,CAAA"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
4
|
+
import React from 'react';
|
|
5
|
+
export const CollapseIcon = () => /*#__PURE__*/_jsx("svg", {
|
|
6
|
+
fill: "none",
|
|
7
|
+
height: "15",
|
|
8
|
+
viewBox: "0 0 15 15",
|
|
9
|
+
width: "15",
|
|
10
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
11
|
+
children: /*#__PURE__*/_jsx("path", {
|
|
12
|
+
d: "M7.16667 13.8333V9.83333M7.16667 9.83333L9.16667 11.8333M7.16667 9.83333L5.16667 11.8333M7.16667 4.5V0.5M7.16667 4.5L9.16667 2.5M7.16667 4.5L5.16667 2.5M1.83333 7.16667H0.5M5.83333 7.16667H4.5M9.83333 7.16667H8.5M13.8333 7.16667H12.5",
|
|
13
|
+
stroke: "currentColor",
|
|
14
|
+
strokeLinecap: "round",
|
|
15
|
+
strokeLinejoin: "round"
|
|
16
|
+
})
|
|
17
|
+
});
|
|
18
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":["React","CollapseIcon","_jsx","fill","height","viewBox","width","xmlns","d","stroke","strokeLinecap","strokeLinejoin"],"sources":["../../../../../src/lexical/ui/icons/Collapse/index.tsx"],"sourcesContent":["'use client'\nimport React from 'react'\n\nexport const CollapseIcon: React.FC = () => (\n <svg fill=\"none\" height=\"15\" viewBox=\"0 0 15 15\" width=\"15\" xmlns=\"http://www.w3.org/2000/svg\">\n <path\n d=\"M7.16667 13.8333V9.83333M7.16667 9.83333L9.16667 11.8333M7.16667 9.83333L5.16667 11.8333M7.16667 4.5V0.5M7.16667 4.5L9.16667 2.5M7.16667 4.5L5.16667 2.5M1.83333 7.16667H0.5M5.83333 7.16667H4.5M9.83333 7.16667H8.5M13.8333 7.16667H12.5\"\n stroke=\"currentColor\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n />\n </svg>\n)\n"],"mappings":"AAAA;;;AACA,OAAOA,KAAA,MAAW;AAElB,OAAO,MAAMC,YAAA,GAAyBA,CAAA,kBACpCC,IAAA,CAAC;EAAIC,IAAA,EAAK;EAAOC,MAAA,EAAO;EAAKC,OAAA,EAAQ;EAAYC,KAAA,EAAM;EAAKC,KAAA,EAAM;YAChE,aAAAL,IAAA,CAAC;IACCM,CAAA,EAAE;IACFC,MAAA,EAAO;IACPC,aAAA,EAAc;IACdC,cAAA,EAAe","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"buildInitialState.d.ts","sourceRoot":"","sources":["../../src/utilities/buildInitialState.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAA;AACpD,OAAO,KAAK,EACV,oBAAoB,EACpB,mBAAmB,EACnB,cAAc,EACd,SAAS,EACT,SAAS,EACT,cAAc,EACd,aAAa,EACb,yBAAyB,EAC1B,MAAM,SAAS,CAAA;AAMhB,MAAM,MAAM,uBAAuB,GAAG;IACpC,CAAC,MAAM,EAAE,MAAM,GAAG;QAChB,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;QAClB,SAAS,CAAC,EAAE,SAAS,CAAA;KACtB,CAAA;CACF,CAAA;AAED,KAAK,KAAK,GAAG;IACX,OAAO,EAAE;QACP,oBAAoB,EAAE,oBAAoB,CAAA;QAC1C,cAAc,EAAE,MAAM,CAAA;QACtB,YAAY,CAAC,EAAE,GAAG,CAAA;QAClB,KAAK,EAAE,aAAa,CAAA;QACpB,cAAc,EAAE,cAAc,CAAA;QAC9B,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;QACpB,sBAAsB,EAAE,MAAM,CAAA;QAC9B,SAAS,EAAE,SAAS,CAAA;QACpB,WAAW,CAAC,EAAE,yBAAyB,CAAA;QACvC,WAAW,EAAE,mBAAmB,CAAA;QAChC,aAAa,EAAE,GAAG,CAAA;QAClB,GAAG,EAAE,cAAc,CAAA;KACpB,CAAA;IACD,YAAY,CAAC,EAAE,uBAAuB,CAAA;IACtC,QAAQ,EAAE,qBAAqB,EAAE,CAAA;CAClC,CAAA;AAED,wBAAsB,iBAAiB,CAAC,EACtC,OAAO,EACP,YAAY,EAAE,oBAAoB,EAClC,QAAQ,GACT,EAAE,KAAK,GAAG,OAAO,CAAC,uBAAuB,CAAC,
|
|
1
|
+
{"version":3,"file":"buildInitialState.d.ts","sourceRoot":"","sources":["../../src/utilities/buildInitialState.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAA;AACpD,OAAO,KAAK,EACV,oBAAoB,EACpB,mBAAmB,EACnB,cAAc,EACd,SAAS,EACT,SAAS,EACT,cAAc,EACd,aAAa,EACb,yBAAyB,EAC1B,MAAM,SAAS,CAAA;AAMhB,MAAM,MAAM,uBAAuB,GAAG;IACpC,CAAC,MAAM,EAAE,MAAM,GAAG;QAChB,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;QAClB,SAAS,CAAC,EAAE,SAAS,CAAA;KACtB,CAAA;CACF,CAAA;AAED,KAAK,KAAK,GAAG;IACX,OAAO,EAAE;QACP,oBAAoB,EAAE,oBAAoB,CAAA;QAC1C,cAAc,EAAE,MAAM,CAAA;QACtB,QAAQ,CAAC,EAAE,OAAO,CAAA;QAClB,YAAY,CAAC,EAAE,GAAG,CAAA;QAClB,KAAK,EAAE,aAAa,CAAA;QACpB,cAAc,EAAE,cAAc,CAAA;QAC9B,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;QACpB,sBAAsB,EAAE,MAAM,CAAA;QAC9B,SAAS,EAAE,SAAS,CAAA;QACpB,WAAW,CAAC,EAAE,yBAAyB,CAAA;QACvC,WAAW,EAAE,mBAAmB,CAAA;QAChC,aAAa,EAAE,GAAG,CAAA;QAClB,GAAG,EAAE,cAAc,CAAA;KACpB,CAAA;IACD,YAAY,CAAC,EAAE,uBAAuB,CAAA;IACtC,QAAQ,EAAE,qBAAqB,EAAE,CAAA;CAClC,CAAA;AAED,wBAAsB,iBAAiB,CAAC,EACtC,OAAO,EACP,YAAY,EAAE,oBAAoB,EAClC,QAAQ,GACT,EAAE,KAAK,GAAG,OAAO,CAAC,uBAAuB,CAAC,CA4D1C"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"buildInitialState.js","names":["fieldSchemasToFormState","buildInitialState","context","initialState","initialStateFromArgs","nodeData","node","children","type","blockNode","id","fields","schemaFieldsPath","lexicalFieldSchemaPath","blockType","formStateResult","clientFieldSchemaMap","collectionSlug","data","documentData","fieldSchemaMap","get","initialBlockData","operation","permissions","preferences","renderAllFields","renderFieldFn","req","schemaPath","formState","currentFieldPreferences","field","name","collapsedArray","collapsed","Array","isArray","includes"],"sources":["../../src/utilities/buildInitialState.ts"],"sourcesContent":["import type { SerializedLexicalNode } from 'lexical'\nimport type {\n ClientFieldSchemaMap,\n DocumentPreferences,\n FieldSchemaMap,\n FormState,\n Operation,\n PayloadRequest,\n RichTextField,\n SanitizedFieldPermissions,\n} from 'payload'\n\nimport { fieldSchemasToFormState } from '@payloadcms/ui/forms/fieldSchemasToFormState'\n\nimport type { SerializedBlockNode } from '../nodeTypes.js'\n\nexport type InitialLexicalFormState = {\n [nodeID: string]: {\n [key: string]: any\n formState?: FormState\n }\n}\n\ntype Props = {\n context: {\n clientFieldSchemaMap: ClientFieldSchemaMap\n collectionSlug: string\n documentData?: any\n field: RichTextField\n fieldSchemaMap: FieldSchemaMap\n id?: number | string\n lexicalFieldSchemaPath: string\n operation: Operation\n permissions?: SanitizedFieldPermissions\n preferences: DocumentPreferences\n renderFieldFn: any\n req: PayloadRequest\n }\n initialState?: InitialLexicalFormState\n nodeData: SerializedLexicalNode[]\n}\n\nexport async function buildInitialState({\n context,\n initialState: initialStateFromArgs,\n nodeData,\n}: Props): Promise<InitialLexicalFormState> {\n let initialState: InitialLexicalFormState = initialStateFromArgs ?? {}\n for (const node of nodeData) {\n if ('children' in node) {\n initialState = await buildInitialState({\n context,\n initialState,\n nodeData: node.children as SerializedLexicalNode[],\n })\n }\n\n if (node.type === 'block' || node.type === 'inlineBlock') {\n const blockNode = node as SerializedBlockNode\n const id = blockNode?.fields?.id\n if (!id) {\n continue\n }\n\n const schemaFieldsPath =\n node.type === 'block'\n ? `${context.lexicalFieldSchemaPath}.lexical_internal_feature.blocks.lexical_blocks.${blockNode.fields.blockType}.fields`\n : `${context.lexicalFieldSchemaPath}.lexical_internal_feature.blocks.lexical_inline_blocks.${blockNode.fields.blockType}.fields`\n\n // Build form state for the block\n\n const formStateResult = await fieldSchemasToFormState({\n id: context.id,\n clientFieldSchemaMap: context.clientFieldSchemaMap,\n collectionSlug: context.collectionSlug,\n data: blockNode.fields,\n documentData: context.documentData,\n fields: (context.fieldSchemaMap.get(schemaFieldsPath) as any)?.fields,\n fieldSchemaMap: context.fieldSchemaMap,\n initialBlockData: blockNode.fields,\n operation: context.operation as any, // TODO: Type\n permissions: true,\n preferences: context.preferences,\n renderAllFields: true, // If this function runs, the parent lexical field is being re-rendered => thus we can assume all its sub-fields need to be re-rendered\n renderFieldFn: context.renderFieldFn,\n req: context.req,\n schemaPath: schemaFieldsPath,\n })\n\n if (!initialState[id]) {\n initialState[id] = {}\n }\n\n initialState[id].formState = formStateResult\n\n if (node.type === 'block') {\n const currentFieldPreferences = context.preferences?.fields?.[context.field.name]\n const collapsedArray = currentFieldPreferences?.collapsed\n if (Array.isArray(collapsedArray) && collapsedArray.includes(id)) {\n initialState[id].collapsed = true\n }\n }\n }\n }\n return initialState\n}\n"],"mappings":"AAYA,SAASA,uBAAuB,QAAQ;
|
|
1
|
+
{"version":3,"file":"buildInitialState.js","names":["fieldSchemasToFormState","buildInitialState","context","initialState","initialStateFromArgs","nodeData","node","children","type","blockNode","id","fields","schemaFieldsPath","lexicalFieldSchemaPath","blockType","formStateResult","clientFieldSchemaMap","collectionSlug","data","documentData","fieldSchemaMap","get","initialBlockData","operation","permissions","preferences","readOnly","disabled","renderAllFields","renderFieldFn","req","schemaPath","formState","currentFieldPreferences","field","name","collapsedArray","collapsed","Array","isArray","includes"],"sources":["../../src/utilities/buildInitialState.ts"],"sourcesContent":["import type { SerializedLexicalNode } from 'lexical'\nimport type {\n ClientFieldSchemaMap,\n DocumentPreferences,\n FieldSchemaMap,\n FormState,\n Operation,\n PayloadRequest,\n RichTextField,\n SanitizedFieldPermissions,\n} from 'payload'\n\nimport { fieldSchemasToFormState } from '@payloadcms/ui/forms/fieldSchemasToFormState'\n\nimport type { SerializedBlockNode } from '../nodeTypes.js'\n\nexport type InitialLexicalFormState = {\n [nodeID: string]: {\n [key: string]: any\n formState?: FormState\n }\n}\n\ntype Props = {\n context: {\n clientFieldSchemaMap: ClientFieldSchemaMap\n collectionSlug: string\n disabled?: boolean\n documentData?: any\n field: RichTextField\n fieldSchemaMap: FieldSchemaMap\n id?: number | string\n lexicalFieldSchemaPath: string\n operation: Operation\n permissions?: SanitizedFieldPermissions\n preferences: DocumentPreferences\n renderFieldFn: any\n req: PayloadRequest\n }\n initialState?: InitialLexicalFormState\n nodeData: SerializedLexicalNode[]\n}\n\nexport async function buildInitialState({\n context,\n initialState: initialStateFromArgs,\n nodeData,\n}: Props): Promise<InitialLexicalFormState> {\n let initialState: InitialLexicalFormState = initialStateFromArgs ?? {}\n for (const node of nodeData) {\n if ('children' in node) {\n initialState = await buildInitialState({\n context,\n initialState,\n nodeData: node.children as SerializedLexicalNode[],\n })\n }\n\n if (node.type === 'block' || node.type === 'inlineBlock') {\n const blockNode = node as SerializedBlockNode\n const id = blockNode?.fields?.id\n if (!id) {\n continue\n }\n\n const schemaFieldsPath =\n node.type === 'block'\n ? `${context.lexicalFieldSchemaPath}.lexical_internal_feature.blocks.lexical_blocks.${blockNode.fields.blockType}.fields`\n : `${context.lexicalFieldSchemaPath}.lexical_internal_feature.blocks.lexical_inline_blocks.${blockNode.fields.blockType}.fields`\n\n // Build form state for the block\n\n const formStateResult = await fieldSchemasToFormState({\n id: context.id,\n clientFieldSchemaMap: context.clientFieldSchemaMap,\n collectionSlug: context.collectionSlug,\n data: blockNode.fields,\n documentData: context.documentData,\n fields: (context.fieldSchemaMap.get(schemaFieldsPath) as any)?.fields,\n fieldSchemaMap: context.fieldSchemaMap,\n initialBlockData: blockNode.fields,\n operation: context.operation as any, // TODO: Type\n permissions: true,\n preferences: context.preferences,\n readOnly: context.disabled,\n renderAllFields: true, // If this function runs, the parent lexical field is being re-rendered => thus we can assume all its sub-fields need to be re-rendered\n renderFieldFn: context.renderFieldFn,\n req: context.req,\n schemaPath: schemaFieldsPath,\n })\n\n if (!initialState[id]) {\n initialState[id] = {}\n }\n\n initialState[id].formState = formStateResult\n\n if (node.type === 'block') {\n const currentFieldPreferences = context.preferences?.fields?.[context.field.name]\n const collapsedArray = currentFieldPreferences?.collapsed\n if (Array.isArray(collapsedArray) && collapsedArray.includes(id)) {\n initialState[id].collapsed = true\n }\n }\n }\n }\n return initialState\n}\n"],"mappings":"AAYA,SAASA,uBAAuB,QAAQ;AA+BxC,OAAO,eAAeC,kBAAkB;EACtCC,OAAO;EACPC,YAAA,EAAcC,oBAAoB;EAClCC;AAAQ,CACF;EACN,IAAIF,YAAA,GAAwCC,oBAAA,IAAwB,CAAC;EACrE,KAAK,MAAME,IAAA,IAAQD,QAAA,EAAU;IAC3B,IAAI,cAAcC,IAAA,EAAM;MACtBH,YAAA,GAAe,MAAMF,iBAAA,CAAkB;QACrCC,OAAA;QACAC,YAAA;QACAE,QAAA,EAAUC,IAAA,CAAKC;MACjB;IACF;IAEA,IAAID,IAAA,CAAKE,IAAI,KAAK,WAAWF,IAAA,CAAKE,IAAI,KAAK,eAAe;MACxD,MAAMC,SAAA,GAAYH,IAAA;MAClB,MAAMI,EAAA,GAAKD,SAAA,EAAWE,MAAA,EAAQD,EAAA;MAC9B,IAAI,CAACA,EAAA,EAAI;QACP;MACF;MAEA,MAAME,gBAAA,GACJN,IAAA,CAAKE,IAAI,KAAK,UACV,GAAGN,OAAA,CAAQW,sBAAsB,mDAAmDJ,SAAA,CAAUE,MAAM,CAACG,SAAS,SAAS,GACvH,GAAGZ,OAAA,CAAQW,sBAAsB,0DAA0DJ,SAAA,CAAUE,MAAM,CAACG,SAAS,SAAS;MAEpI;MAEA,MAAMC,eAAA,GAAkB,MAAMf,uBAAA,CAAwB;QACpDU,EAAA,EAAIR,OAAA,CAAQQ,EAAE;QACdM,oBAAA,EAAsBd,OAAA,CAAQc,oBAAoB;QAClDC,cAAA,EAAgBf,OAAA,CAAQe,cAAc;QACtCC,IAAA,EAAMT,SAAA,CAAUE,MAAM;QACtBQ,YAAA,EAAcjB,OAAA,CAAQiB,YAAY;QAClCR,MAAA,EAAST,OAAA,CAAQkB,cAAc,CAACC,GAAG,CAACT,gBAAA,GAA2BD,MAAA;QAC/DS,cAAA,EAAgBlB,OAAA,CAAQkB,cAAc;QACtCE,gBAAA,EAAkBb,SAAA,CAAUE,MAAM;QAClCY,SAAA,EAAWrB,OAAA,CAAQqB,SAAS;QAC5BC,WAAA,EAAa;QACbC,WAAA,EAAavB,OAAA,CAAQuB,WAAW;QAChCC,QAAA,EAAUxB,OAAA,CAAQyB,QAAQ;QAC1BC,eAAA,EAAiB;QACjBC,aAAA,EAAe3B,OAAA,CAAQ2B,aAAa;QACpCC,GAAA,EAAK5B,OAAA,CAAQ4B,GAAG;QAChBC,UAAA,EAAYnB;MACd;MAEA,IAAI,CAACT,YAAY,CAACO,EAAA,CAAG,EAAE;QACrBP,YAAY,CAACO,EAAA,CAAG,GAAG,CAAC;MACtB;MAEAP,YAAY,CAACO,EAAA,CAAG,CAACsB,SAAS,GAAGjB,eAAA;MAE7B,IAAIT,IAAA,CAAKE,IAAI,KAAK,SAAS;QACzB,MAAMyB,uBAAA,GAA0B/B,OAAA,CAAQuB,WAAW,EAAEd,MAAA,GAAST,OAAA,CAAQgC,KAAK,CAACC,IAAI,CAAC;QACjF,MAAMC,cAAA,GAAiBH,uBAAA,EAAyBI,SAAA;QAChD,IAAIC,KAAA,CAAMC,OAAO,CAACH,cAAA,KAAmBA,cAAA,CAAeI,QAAQ,CAAC9B,EAAA,GAAK;UAChEP,YAAY,CAACO,EAAA,CAAG,CAAC2B,SAAS,GAAG;QAC/B;MACF;IACF;EACF;EACA,OAAOlC,YAAA;AACT","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DrawerContent.d.ts","sourceRoot":"","sources":["../../../src/utilities/fieldsDrawer/DrawerContent.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"DrawerContent.d.ts","sourceRoot":"","sources":["../../../src/utilities/fieldsDrawer/DrawerContent.tsx"],"names":[],"mappings":"AAeA,OAAO,KAAmD,MAAM,OAAO,CAAA;AAGvE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAA;AAIpD,eAAO,MAAM,aAAa,EAAE,KAAK,CAAC,EAAE,CAAC,IAAI,CAAC,iBAAiB,EAAE,YAAY,GAAG,aAAa,CAAC,CAmJzF,CAAA"}
|