@payloadcms/richtext-lexical 3.59.1 → 3.60.0-canary.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/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-2Y72RT72.js → chunk-TLQLXR6Q.js} +2 -2
- 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/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 +114 -0
- package/dist/features/blocks/premade/CodeBlock/Component/Block.js.map +1 -0
- package/dist/features/blocks/premade/CodeBlock/Component/Code.d.ts +56 -0
- package/dist/features/blocks/premade/CodeBlock/Component/Code.d.ts.map +1 -0
- package/dist/features/blocks/premade/CodeBlock/Component/Code.js +96 -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/Component/defaultLanguages.d.ts +5 -0
- package/dist/features/blocks/premade/CodeBlock/Component/defaultLanguages.d.ts.map +1 -0
- package/dist/features/blocks/premade/CodeBlock/Component/defaultLanguages.js +87 -0
- package/dist/features/blocks/premade/CodeBlock/Component/defaultLanguages.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 +50 -0
- package/dist/features/blocks/premade/CodeBlock/index.js.map +1 -0
- 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/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} +22 -53
- 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/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/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/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/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/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/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-EHRBYNHO.js +0 -2
- package/dist/exports/client/Field-EHRBYNHO.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/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/{chunk-2Y72RT72.js.map → chunk-TLQLXR6Q.js.map} +0 -0
- /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
|
@@ -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,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KI,SAAAa,MAAAa,MAAA;EAAA,IAyDQA,MAAA,CAAAC,QAAA,KAAoB;IAAA,OACfV,IAAA,CAAA3D,YAAA;MAAAuE,WAAA,EAA2BH,MAAA,CAAAG,WAAA;MAAAH;IAAA,GAAyBA,MAAA,CAAAI,GAAU;EAAA;AAAA;AA1D3E,SAAAd,OAAAoB,QAAA;EAAA,IA+DUV,QAAA,CAAAC,QAAA,KAAoB;IAAA,OAEpBV,IAAA,CAAA3D,YAAA;MAAAuE,WAAA,EAA2BH,QAAA,CAAAG,WAAA;MAAAH,MAAA,EAA6CA;IAAA,GAApBA,QAAA,CAAAI,GAAU;EAAA;AAAA;AAjExE,SAAAG,OAAAI,QAAA;EAAA,IA2IUX,QAAA,CAAAC,QAAA,KAAoB;IAAA,OAEpBV,IAAA,CAAA3D,YAAA;MAAAuE,WAAA,EAA2BH,QAAA,CAAAG,WAAA;MAAAH,MAAA,EAA6CA;IAAA,GAApBA,QAAA,CAAAI,GAAU;EAAA;AAAA;AA7IxE,SAAAI,OAAAI,QAAA;EAAA,IAkJUZ,QAAA,CAAAC,QAAA,KAAoB;IAAA,OAEpBV,IAAA,CAAA3D,YAAA;MAAAuE,WAAA,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,aAAa,QAAQ;AAC9B,SAASC,cAAc,QAAQ;AAC/B,SAASC,cAAc,QAAQ;AAC/B,SAASC,kBAAkB,QAAQ;AACnC,SAASC,YAAY,EAAEC,oBAAoB,EAAEC,aAAa,QAAQ;AAClE,YAAYC,KAAA,MAAW;AACvB,SAASC,SAAS,EAAEC,QAAQ,QAAQ;AAIpC,SAASC,sBAAsB,QAAQ;AAEvC,SAASC,YAAY,QAAQ;AAC7B,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,SAAS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A,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":"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,KAA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sB,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"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
3
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
4
|
+
import { useLexicalEditable } from '@lexical/react/useLexicalEditable';
|
|
4
5
|
import { Form, FormSubmit, RenderFields, useDocumentForm, useDocumentInfo, useServerFunctions, useTranslation } from '@payloadcms/ui';
|
|
5
6
|
import { abortAndIgnore } from '@payloadcms/ui/shared';
|
|
6
7
|
import { deepCopyObjectSimpleWithoutReactComponents } from 'payload/shared';
|
|
@@ -28,6 +29,7 @@ export const DrawerContent = ({
|
|
|
28
29
|
const {
|
|
29
30
|
fields: parentDocumentFields
|
|
30
31
|
} = useDocumentForm();
|
|
32
|
+
const isEditable = useLexicalEditable();
|
|
31
33
|
const onChangeAbortControllerRef = useRef(new AbortController());
|
|
32
34
|
const [initialState, setInitialState] = useState(false);
|
|
33
35
|
const {
|
|
@@ -58,6 +60,7 @@ export const DrawerContent = ({
|
|
|
58
60
|
globalSlug,
|
|
59
61
|
initialBlockData: data,
|
|
60
62
|
operation: 'update',
|
|
63
|
+
readOnly: !isEditable,
|
|
61
64
|
renderAllFields: true,
|
|
62
65
|
schemaPath: schemaFieldsPath,
|
|
63
66
|
signal: controller.signal
|
|
@@ -68,7 +71,7 @@ export const DrawerContent = ({
|
|
|
68
71
|
return () => {
|
|
69
72
|
abortAndIgnore(controller);
|
|
70
73
|
};
|
|
71
|
-
}, [schemaFieldsPath, id, data, getFormState, collectionSlug, globalSlug, getDocPreferences, parentDocumentFields]);
|
|
74
|
+
}, [schemaFieldsPath, id, data, getFormState, collectionSlug, isEditable, globalSlug, getDocPreferences, parentDocumentFields]);
|
|
72
75
|
const onChange = useCallback(async ({
|
|
73
76
|
formState: prevFormState
|
|
74
77
|
}) => {
|
|
@@ -89,6 +92,7 @@ export const DrawerContent = ({
|
|
|
89
92
|
globalSlug,
|
|
90
93
|
initialBlockFormState: prevFormState,
|
|
91
94
|
operation: 'update',
|
|
95
|
+
readOnly: !isEditable,
|
|
92
96
|
schemaPath: schemaFieldsPath,
|
|
93
97
|
signal: controller_0.signal
|
|
94
98
|
});
|
|
@@ -96,7 +100,7 @@ export const DrawerContent = ({
|
|
|
96
100
|
return prevFormState;
|
|
97
101
|
}
|
|
98
102
|
return state_0;
|
|
99
|
-
}, [getFormState, id, collectionSlug, getDocPreferences, parentDocumentFields, globalSlug, schemaFieldsPath]);
|
|
103
|
+
}, [getFormState, id, isEditable, collectionSlug, getDocPreferences, parentDocumentFields, globalSlug, schemaFieldsPath]);
|
|
100
104
|
// cleanup effect
|
|
101
105
|
useEffect(() => {
|
|
102
106
|
return () => {
|
|
@@ -123,7 +127,7 @@ export const DrawerContent = ({
|
|
|
123
127
|
|
|
124
128
|
parentSchemaPath: schemaFieldsPath,
|
|
125
129
|
permissions: true,
|
|
126
|
-
readOnly:
|
|
130
|
+
readOnly: !isEditable
|
|
127
131
|
}), /*#__PURE__*/_jsx(FormSubmit, {
|
|
128
132
|
children: t('fields:saveChanges')
|
|
129
133
|
})]
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DrawerContent.js","names":["Form","FormSubmit","RenderFields","useDocumentForm","useDocumentInfo","useServerFunctions","useTranslation","abortAndIgnore","deepCopyObjectSimpleWithoutReactComponents","React","useCallback","useEffect","useRef","useState","v4","uuid","useEditorConfigContext","DrawerContent","data","featureKey","fieldMapOverride","handleDrawerSubmit","schemaFieldsPathOverride","schemaPath","schemaPathSuffix","t","id","collectionSlug","getDocPreferences","globalSlug","fields","parentDocumentFields","onChangeAbortControllerRef","AbortController","initialState","setInitialState","fieldProps","featureClientSchemaMap","getFormState","schemaFieldsPath","controller","awaitInitialState","state","docPermissions","docPreferences","documentFormState","initialBlockData","operation","renderAllFields","signal","onChange","formState","prevFormState","current","initialBlockFormState","_jsxs","beforeSubmit","disableValidationOnSubmit","Array","isArray","onSubmit","_jsx","forceRender","parentIndexPath","parentPath","parentSchemaPath","permissions"
|
|
1
|
+
{"version":3,"file":"DrawerContent.js","names":["useLexicalEditable","Form","FormSubmit","RenderFields","useDocumentForm","useDocumentInfo","useServerFunctions","useTranslation","abortAndIgnore","deepCopyObjectSimpleWithoutReactComponents","React","useCallback","useEffect","useRef","useState","v4","uuid","useEditorConfigContext","DrawerContent","data","featureKey","fieldMapOverride","handleDrawerSubmit","schemaFieldsPathOverride","schemaPath","schemaPathSuffix","t","id","collectionSlug","getDocPreferences","globalSlug","fields","parentDocumentFields","isEditable","onChangeAbortControllerRef","AbortController","initialState","setInitialState","fieldProps","featureClientSchemaMap","getFormState","schemaFieldsPath","controller","awaitInitialState","state","docPermissions","docPreferences","documentFormState","initialBlockData","operation","readOnly","renderAllFields","signal","onChange","formState","prevFormState","current","initialBlockFormState","_jsxs","beforeSubmit","disableValidationOnSubmit","Array","isArray","onSubmit","_jsx","forceRender","parentIndexPath","parentPath","parentSchemaPath","permissions"],"sources":["../../../src/utilities/fieldsDrawer/DrawerContent.tsx"],"sourcesContent":["'use client'\nimport type { FormState } from 'payload'\n\nimport { useLexicalEditable } from '@lexical/react/useLexicalEditable'\nimport {\n Form,\n FormSubmit,\n RenderFields,\n useDocumentForm,\n useDocumentInfo,\n useServerFunctions,\n useTranslation,\n} from '@payloadcms/ui'\nimport { abortAndIgnore } from '@payloadcms/ui/shared'\nimport { deepCopyObjectSimpleWithoutReactComponents } from 'payload/shared'\nimport React, { useCallback, useEffect, useRef, useState } from 'react'\nimport { v4 as uuid } from 'uuid'\n\nimport type { FieldsDrawerProps } from './Drawer.js'\n\nimport { useEditorConfigContext } from '../../lexical/config/client/EditorConfigProvider.js'\n\nexport const DrawerContent: React.FC<Omit<FieldsDrawerProps, 'drawerSlug' | 'drawerTitle'>> = ({\n data,\n featureKey,\n fieldMapOverride,\n handleDrawerSubmit,\n schemaFieldsPathOverride,\n schemaPath,\n schemaPathSuffix,\n}) => {\n const { t } = useTranslation()\n const { id, collectionSlug, getDocPreferences, globalSlug } = useDocumentInfo()\n const { fields: parentDocumentFields } = useDocumentForm()\n const isEditable = useLexicalEditable()\n\n const onChangeAbortControllerRef = useRef(new AbortController())\n\n const [initialState, setInitialState] = useState<false | FormState | undefined>(false)\n\n const {\n fieldProps: { featureClientSchemaMap },\n } = useEditorConfigContext()\n\n const { getFormState } = useServerFunctions()\n\n const schemaFieldsPath =\n schemaFieldsPathOverride ??\n `${schemaPath}.lexical_internal_feature.${featureKey}${schemaPathSuffix ? `.${schemaPathSuffix}` : ''}`\n\n const fields: any = fieldMapOverride ?? featureClientSchemaMap[featureKey]?.[schemaFieldsPath] // Field Schema\n\n useEffect(() => {\n const controller = new AbortController()\n\n const awaitInitialState = async () => {\n const { state } = await getFormState({\n id,\n collectionSlug,\n data: data ?? {},\n docPermissions: {\n fields: true,\n },\n docPreferences: await getDocPreferences(),\n documentFormState: deepCopyObjectSimpleWithoutReactComponents(parentDocumentFields),\n globalSlug,\n initialBlockData: data,\n operation: 'update',\n readOnly: !isEditable,\n renderAllFields: true,\n schemaPath: schemaFieldsPath,\n signal: controller.signal,\n })\n\n setInitialState(state)\n }\n\n void awaitInitialState()\n\n return () => {\n abortAndIgnore(controller)\n }\n }, [\n schemaFieldsPath,\n id,\n data,\n getFormState,\n collectionSlug,\n isEditable,\n globalSlug,\n getDocPreferences,\n parentDocumentFields,\n ])\n\n const onChange = useCallback(\n async ({ formState: prevFormState }: { formState: FormState }) => {\n abortAndIgnore(onChangeAbortControllerRef.current)\n\n const controller = new AbortController()\n onChangeAbortControllerRef.current = controller\n\n const { state } = await getFormState({\n id,\n collectionSlug,\n docPermissions: {\n fields: true,\n },\n docPreferences: await getDocPreferences(),\n documentFormState: deepCopyObjectSimpleWithoutReactComponents(parentDocumentFields),\n formState: prevFormState,\n globalSlug,\n initialBlockFormState: prevFormState,\n operation: 'update',\n readOnly: !isEditable,\n schemaPath: schemaFieldsPath,\n signal: controller.signal,\n })\n\n if (!state) {\n return prevFormState\n }\n\n return state\n },\n [\n getFormState,\n id,\n isEditable,\n collectionSlug,\n getDocPreferences,\n parentDocumentFields,\n globalSlug,\n schemaFieldsPath,\n ],\n )\n\n // cleanup effect\n useEffect(() => {\n return () => {\n abortAndIgnore(onChangeAbortControllerRef.current)\n }\n }, [])\n\n if (initialState === false) {\n return null\n }\n\n return (\n <Form\n beforeSubmit={[onChange]}\n disableValidationOnSubmit\n fields={Array.isArray(fields) ? fields : []}\n initialState={initialState}\n onChange={[onChange]}\n onSubmit={handleDrawerSubmit}\n uuid={uuid()}\n >\n <RenderFields\n fields={Array.isArray(fields) ? fields : []}\n forceRender\n parentIndexPath=\"\"\n parentPath=\"\" // See Blocks feature path for details as for why this is empty\n parentSchemaPath={schemaFieldsPath}\n permissions={true}\n readOnly={!isEditable}\n />\n <FormSubmit>{t('fields:saveChanges')}</FormSubmit>\n </Form>\n )\n}\n"],"mappings":"AAAA;;;AAGA,SAASA,kBAAkB,QAAQ;AACnC,SACEC,IAAI,EACJC,UAAU,EACVC,YAAY,EACZC,eAAe,EACfC,eAAe,EACfC,kBAAkB,EAClBC,cAAc,QACT;AACP,SAASC,cAAc,QAAQ;AAC/B,SAASC,0CAA0C,QAAQ;AAC3D,OAAOC,KAAA,IAASC,WAAW,EAAEC,SAAS,EAAEC,MAAM,EAAEC,QAAQ,QAAQ;AAChE,SAASC,EAAA,IAAMC,IAAI,QAAQ;AAI3B,SAASC,sBAAsB,QAAQ;AAEvC,OAAO,MAAMC,aAAA,GAAiFA,CAAC;EAC7FC,IAAI;EACJC,UAAU;EACVC,gBAAgB;EAChBC,kBAAkB;EAClBC,wBAAwB;EACxBC,UAAU;EACVC;AAAgB,CACjB;EACC,MAAM;IAAEC;EAAC,CAAE,GAAGnB,cAAA;EACd,MAAM;IAAEoB,EAAE;IAAEC,cAAc;IAAEC,iBAAiB;IAAEC;EAAU,CAAE,GAAGzB,eAAA;EAC9D,MAAM;IAAE0B,MAAA,EAAQC;EAAoB,CAAE,GAAG5B,eAAA;EACzC,MAAM6B,UAAA,GAAajC,kBAAA;EAEnB,MAAMkC,0BAAA,GAA6BrB,MAAA,CAAO,IAAIsB,eAAA;EAE9C,MAAM,CAACC,YAAA,EAAcC,eAAA,CAAgB,GAAGvB,QAAA,CAAwC;EAEhF,MAAM;IACJwB,UAAA,EAAY;MAAEC;IAAsB;EAAE,CACvC,GAAGtB,sBAAA;EAEJ,MAAM;IAAEuB;EAAY,CAAE,GAAGlC,kBAAA;EAEzB,MAAMmC,gBAAA,GACJlB,wBAAA,IACA,GAAGC,UAAA,6BAAuCJ,UAAA,GAAaK,gBAAA,GAAmB,IAAIA,gBAAA,E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oreList":[]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { linesFromStartToContentAndPropsString } from '../../features/blocks/server/linesFromMatchToContentAndPropsString.js';
|
|
2
|
-
import { createTagRegexes } from '../../features/blocks/server/markdownTransformer.js';
|
|
1
|
+
import { linesFromStartToContentAndPropsString } from '../../features/blocks/server/markdown/linesFromMatchToContentAndPropsString.js';
|
|
2
|
+
import { createTagRegexes } from '../../features/blocks/server/markdown/markdownTransformer.js';
|
|
3
3
|
/**
|
|
4
4
|
* Helpful utility for parsing out all matching top-level JSX tags in a given string.
|
|
5
5
|
* This will collect them in a list, that contains the content of the JSX tag and the props string.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"collectTopLevelJSXInLines.js","names":["linesFromStartToContentAndPropsString","createTagRegexes","collectTopLevelJSXInLines","lines","jsxToMatch","finds","regex","linesLength","length","i","line","startMatch","match","regExpStart","content","endLineIndex","propsString","isEndOptional","regexpEndRegex","regExpEnd","startLineIndex","push"],"sources":["../../../src/utilities/jsx/collectTopLevelJSXInLines.ts"],"sourcesContent":["import { linesFromStartToContentAndPropsString } from '../../features/blocks/server/linesFromMatchToContentAndPropsString.js'\nimport { createTagRegexes } from '../../features/blocks/server/markdownTransformer.js'\n\n/**\n * Helpful utility for parsing out all matching top-level JSX tags in a given string.\n * This will collect them in a list, that contains the content of the JSX tag and the props string.\n *\n * While this is not used within payload, this can be used for certain payload blocks that need to\n * be serializable and deserializable to and from JSX.\n *\n * @example:\n *\n * Say you have Steps block that contains a steps array. Its JSX representation may look like this:\n *\n * <Steps>\n * <Step title=\"Step1\">\n * <h1>Step 1</h1>\n * </Step>\n * <Step title=\"Step2\">\n * <h1>Step 2</h1>\n * </Step>\n * </Steps>\n *\n * In this case, the Steps block would have the following content as its children string:\n * <Step title=\"Step1\">\n * <h1>Step 1</h1>\n * </Step>\n * <Step title=\"Step2\">\n * <h1>Step 2</h1>\n * </Step>\n *\n * It could then use this function to collect all the top-level JSX tags (= the steps):\n *\n * collectTopLevelJSXInLines(children.split('\\n'), 'Step')\n *\n * This will return:\n *\n * [\n * {\n * content: '<h1>Step 1</h1>',\n * propsString: 'title=\"Step1\"',\n * },\n * {\n * content: '<h1>Step 2</h1>',\n * propsString: 'title=\"Step2\"',\n * },\n * ]\n *\n * You can then map this data to construct the data for this blocks array field.\n */\nexport function collectTopLevelJSXInLines(\n lines: Array<string>,\n jsxToMatch: string,\n): {\n content: string\n propsString: string\n}[] {\n const finds: {\n content: string\n propsString: string\n }[] = []\n const regex = createTagRegexes(jsxToMatch)\n\n const linesLength = lines.length\n\n for (let i = 0; i < linesLength; i++) {\n const line = lines[i]!\n const startMatch = line.match(regex.regExpStart)\n if (!startMatch) {\n continue // Try next transformer\n }\n\n const { content, endLineIndex, propsString } = linesFromStartToContentAndPropsString({\n isEndOptional: false,\n lines,\n regexpEndRegex: regex.regExpEnd,\n startLineIndex: i,\n startMatch,\n })\n\n finds.push({\n content,\n propsString,\n })\n\n i = endLineIndex\n continue\n }\n\n return finds\n}\n"],"mappings":"AAAA,SAASA,qCAAqC,QAAQ;AACtD,SAASC,gBAAgB,QAAQ;AAEjC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+CA,OAAO,SAASC,0BACdC,KAAoB,EACpBC,UAAkB;EAKlB,MAAMC,KAAA,GAGA,EAAE;EACR,MAAMC,KAAA,GAAQL,gBAAA,CAAiBG,UAAA;EAE/B,MAAMG,WAAA,GAAcJ,KAAA,CAAMK,MAAM;EAEhC,KAAK,IAAIC,CAAA,GAAI,GAAGA,CAAA,GAAIF,WAAA,EAAaE,CAAA,IAAK;IACpC,MAAMC,IAAA,GAAOP,KAAK,CAACM,CAAA,CAAE;IACrB,MAAME,UAAA,GAAaD,IAAA,CAAKE,KAAK,CAACN,KAAA,CAAMO,WAAW;IAC/C,IAAI,CAACF,UAAA,EAAY;MACf,UAAS;IACX;IAEA,MAAM;MAAEG,OAAO;MAAEC,YAAY;MAAEC;IAAW,CAAE,GAAGhB,qCAAA,CAAsC;MACnFiB,aAAA,EAAe;MACfd,KAAA;MACAe,cAAA,EAAgBZ,KAAA,CAAMa,SAAS;MAC/BC,cAAA,EAAgBX,CAAA;MAChBE;IACF;IAEAN,KAAA,CAAMgB,IAAI,CAAC;MACTP,OAAA;MACAE;IACF;IAEAP,CAAA,GAAIM,YAAA;IACJ;EACF;EAEA,OAAOV,KAAA;AACT","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"collectTopLevelJSXInLines.js","names":["linesFromStartToContentAndPropsString","createTagRegexes","collectTopLevelJSXInLines","lines","jsxToMatch","finds","regex","linesLength","length","i","line","startMatch","match","regExpStart","content","endLineIndex","propsString","isEndOptional","regexpEndRegex","regExpEnd","startLineIndex","push"],"sources":["../../../src/utilities/jsx/collectTopLevelJSXInLines.ts"],"sourcesContent":["import { linesFromStartToContentAndPropsString } from '../../features/blocks/server/markdown/linesFromMatchToContentAndPropsString.js'\nimport { createTagRegexes } from '../../features/blocks/server/markdown/markdownTransformer.js'\n\n/**\n * Helpful utility for parsing out all matching top-level JSX tags in a given string.\n * This will collect them in a list, that contains the content of the JSX tag and the props string.\n *\n * While this is not used within payload, this can be used for certain payload blocks that need to\n * be serializable and deserializable to and from JSX.\n *\n * @example:\n *\n * Say you have Steps block that contains a steps array. Its JSX representation may look like this:\n *\n * <Steps>\n * <Step title=\"Step1\">\n * <h1>Step 1</h1>\n * </Step>\n * <Step title=\"Step2\">\n * <h1>Step 2</h1>\n * </Step>\n * </Steps>\n *\n * In this case, the Steps block would have the following content as its children string:\n * <Step title=\"Step1\">\n * <h1>Step 1</h1>\n * </Step>\n * <Step title=\"Step2\">\n * <h1>Step 2</h1>\n * </Step>\n *\n * It could then use this function to collect all the top-level JSX tags (= the steps):\n *\n * collectTopLevelJSXInLines(children.split('\\n'), 'Step')\n *\n * This will return:\n *\n * [\n * {\n * content: '<h1>Step 1</h1>',\n * propsString: 'title=\"Step1\"',\n * },\n * {\n * content: '<h1>Step 2</h1>',\n * propsString: 'title=\"Step2\"',\n * },\n * ]\n *\n * You can then map this data to construct the data for this blocks array field.\n */\nexport function collectTopLevelJSXInLines(\n lines: Array<string>,\n jsxToMatch: string,\n): {\n content: string\n propsString: string\n}[] {\n const finds: {\n content: string\n propsString: string\n }[] = []\n const regex = createTagRegexes(jsxToMatch)\n\n const linesLength = lines.length\n\n for (let i = 0; i < linesLength; i++) {\n const line = lines[i]!\n const startMatch = line.match(regex.regExpStart)\n if (!startMatch) {\n continue // Try next transformer\n }\n\n const { content, endLineIndex, propsString } = linesFromStartToContentAndPropsString({\n isEndOptional: false,\n lines,\n regexpEndRegex: regex.regExpEnd,\n startLineIndex: i,\n startMatch,\n })\n\n finds.push({\n content,\n propsString,\n })\n\n i = endLineIndex\n continue\n }\n\n return finds\n}\n"],"mappings":"AAAA,SAASA,qCAAqC,QAAQ;AACtD,SAASC,gBAAgB,QAAQ;AAEjC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+CA,OAAO,SAASC,0BACdC,KAAoB,EACpBC,UAAkB;EAKlB,MAAMC,KAAA,GAGA,EAAE;EACR,MAAMC,KAAA,GAAQL,gBAAA,CAAiBG,UAAA;EAE/B,MAAMG,WAAA,GAAcJ,KAAA,CAAMK,MAAM;EAEhC,KAAK,IAAIC,CAAA,GAAI,GAAGA,CAAA,GAAIF,WAAA,EAAaE,CAAA,IAAK;IACpC,MAAMC,IAAA,GAAOP,KAAK,CAACM,CAAA,CAAE;IACrB,MAAME,UAAA,GAAaD,IAAA,CAAKE,KAAK,CAACN,KAAA,CAAMO,WAAW;IAC/C,IAAI,CAACF,UAAA,EAAY;MACf,UAAS;IACX;IAEA,MAAM;MAAEG,OAAO;MAAEC,YAAY;MAAEC;IAAW,CAAE,GAAGhB,qCAAA,CAAsC;MACnFiB,aAAA,EAAe;MACfd,KAAA;MACAe,cAAA,EAAgBZ,KAAA,CAAMa,SAAS;MAC/BC,cAAA,EAAgBX,CAAA;MAChBE;IACF;IAEAN,KAAA,CAAMgB,IAAI,CAAC;MACTP,OAAA;MACAE;IACF;IAEAP,CAAA,GAAIM,YAAA;IACJ;EACF;EAEA,OAAOV,KAAA;AACT","ignoreList":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@payloadcms/richtext-lexical",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.60.0-canary.0",
|
|
4
4
|
"description": "The officially supported Lexical richtext adapter for Payload",
|
|
5
5
|
"homepage": "https://payloadcms.com",
|
|
6
6
|
"repository": {
|
|
@@ -373,8 +373,8 @@
|
|
|
373
373
|
"react-error-boundary": "4.1.2",
|
|
374
374
|
"ts-essentials": "10.0.3",
|
|
375
375
|
"uuid": "10.0.0",
|
|
376
|
-
"@payloadcms/
|
|
377
|
-
"@payloadcms/
|
|
376
|
+
"@payloadcms/ui": "3.60.0-canary.0",
|
|
377
|
+
"@payloadcms/translations": "3.60.0-canary.0"
|
|
378
378
|
},
|
|
379
379
|
"devDependencies": {
|
|
380
380
|
"@babel/cli": "7.27.2",
|
|
@@ -393,16 +393,16 @@
|
|
|
393
393
|
"esbuild": "0.25.5",
|
|
394
394
|
"esbuild-sass-plugin": "3.3.1",
|
|
395
395
|
"swc-plugin-transform-remove-imports": "4.0.4",
|
|
396
|
-
"
|
|
397
|
-
"
|
|
396
|
+
"@payloadcms/eslint-config": "3.28.0",
|
|
397
|
+
"payload": "3.60.0-canary.0"
|
|
398
398
|
},
|
|
399
399
|
"peerDependencies": {
|
|
400
400
|
"@faceless-ui/modal": "3.0.0",
|
|
401
401
|
"@faceless-ui/scroll-info": "2.0.0",
|
|
402
402
|
"react": "^19.0.0 || ^19.0.0-rc-65a56d0e-20241020",
|
|
403
403
|
"react-dom": "^19.0.0 || ^19.0.0-rc-65a56d0e-20241020",
|
|
404
|
-
"@payloadcms/next": "3.
|
|
405
|
-
"payload": "3.
|
|
404
|
+
"@payloadcms/next": "3.60.0-canary.0",
|
|
405
|
+
"payload": "3.60.0-canary.0"
|
|
406
406
|
},
|
|
407
407
|
"engines": {
|
|
408
408
|
"node": "^18.20.2 || >=20.9.0"
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
"use client";import{b as ke,c as we,f as _,h as ve,i as Te,j as De,k as Le,l as Me}from"./chunk-2Y72RT72.js";import{a as Re,b as R}from"./chunk-BZZVLW4U.js";import{jsx as F,jsxs as ge}from"react/jsx-runtime";import{FieldDescription as xn,FieldError as En,FieldLabel as Cn,RenderCustomComponent as Et,useEditDepth as bn,useEffectEvent as Nn,useField as Pn}from"@payloadcms/ui";import{mergeFieldStyles as Sn}from"@payloadcms/ui/shared";import{dequal as Rn}from"dequal/lite";import Ct,{useCallback as bt,useEffect as Nt,useMemo as kn,useState as Pt}from"react";import{ErrorBoundary as wn}from"react-error-boundary";import"./bundled.css";import{jsx as O}from"react/jsx-runtime";import{LexicalComposer as gn}from"@lexical/react/LexicalComposer.js";import{useEditDepth as hn}from"@payloadcms/ui";import*as ht from"react";import{useMemo as yn}from"react";import{c as Zo}from"react/compiler-runtime";import{jsx as E,jsxs as te}from"react/jsx-runtime";import{useLexicalComposerContext as en}from"@lexical/react/LexicalComposerContext.js";import{LexicalErrorBoundary as tn}from"@lexical/react/LexicalErrorBoundary.js";import{HistoryPlugin as on}from"@lexical/react/LexicalHistoryPlugin.js";import{OnChangePlugin as nn}from"@lexical/react/LexicalOnChangePlugin.js";import{RichTextPlugin as rn}from"@lexical/react/LexicalRichTextPlugin.js";import{BLUR_COMMAND as sn,COMMAND_PRIORITY_LOW as pt,FOCUS_COMMAND as ln}from"lexical";import*as q from"react";import{useEffect as an,useState as cn}from"react";import{jsx as Ae}from"react/jsx-runtime";import"react";var $=({anchorElem:t,clientProps:e,plugin:o})=>o.position==="floatingAnchorElem"&&t?o.Component&&Ae(o.Component,{anchorElem:t,clientProps:e}):o.Component&&Ae(o.Component,{clientProps:e});import{c as kt}from"react/compiler-runtime";import{useLexicalComposerContext as wt}from"@lexical/react/LexicalComposerContext";import{$findMatchingParent as ne,mergeRegister as vt}from"@lexical/utils";import{$createNodeSelection as Tt,$getEditor as X,$getNearestNodeFromDOMNode as Dt,$getSelection as re,$isDecoratorNode as K,$isElementNode as xe,$isLineBreakNode as Lt,$isNodeSelection as ie,$isRangeSelection as Be,$isRootOrShadowRoot as Mt,$isTextNode as At,$setSelection as Ie,CLICK_COMMAND as Bt,COMMAND_PRIORITY_LOW as W,KEY_ARROW_DOWN_COMMAND as It,KEY_ARROW_UP_COMMAND as _t,KEY_BACKSPACE_COMMAND as Ot,KEY_DELETE_COMMAND as Ft,SELECTION_CHANGE_COMMAND as $t}from"lexical";import{useEffect as Kt}from"react";function _e(){let t=kt(3),[e]=wt(),o=Gt,n,r;return t[0]!==e?(n=()=>vt(e.registerCommand(Bt,Vt,W),e.registerCommand(Ft,o,W),e.registerCommand(Ot,o,W),e.registerCommand($t,Yt,W),e.registerCommand(_t,zt,W),e.registerCommand(It,Ht,W)),r=[e],t[0]=e,t[1]=n,t[2]=r):(n=t[1],r=t[2]),Kt(n,r),null}function Ht(t){let e=re();if(ie(e)){t.preventDefault();let s=e.getNodes()[0]?.getNextSibling();if(K(s)){let y=X().getElementByKey(s.getKey());return y&&Z({element:y,node:s}),!0}if(!xe(s))return!0;let l=s.getFirstDescendant()??s;return l&&(ne(l,se)?.selectEnd(),t.preventDefault()),!0}if(!Be(e))return!1;let n=(e.isBackward()?e.anchor:e.focus).getNode(),r=ne(n,jt),c=r?.getNextSibling();if(!r||c!==Oe(r))return!1;if(K(c)){let s=X().getElementByKey(c.getKey());if(s)return Z({element:s,node:c}),t.preventDefault(),!0}return!1}function jt(t){return Oe(t)!==null}function zt(t){let e=re();if(ie(e)){let s=e.getNodes()[0]?.getPreviousSibling();if(K(s)){let y=X().getElementByKey(s.getKey());return y?(Z({element:y,node:s}),t.preventDefault(),!0):!1}if(!xe(s))return!1;let l=s.getLastDescendant()??s;return l?(ne(l,se)?.selectStart(),t.preventDefault(),!0):!1}if(!Be(e))return!1;let n=(e.isBackward()?e.anchor:e.focus).getNode(),r=ne(n,Wt),c=r?.getPreviousSibling();if(!r||c!==Fe(r))return!1;if(K(c)){let s=X().getElementByKey(c.getKey());if(s)return Z({element:s,node:c}),t.preventDefault(),!0}return!1}function Wt(t){return Fe(t)!==null}function Yt(){let t=Jt();return document.querySelector(".decorator-selected")?.classList.remove("decorator-selected"),t?(t.element?.classList.add("decorator-selected"),!0):!1}function Vt(t){document.querySelector(".decorator-selected")?.classList.remove("decorator-selected");let e=qt(t);if(!e)return!0;let{target:o}=t;return!(o instanceof HTMLElement)||o.isContentEditable||o.closest('button, textarea, input, .react-select, .code-editor, .no-select-decorator, [role="button"]')?Ie(null):Z(e),!0}function Gt(t){let e=re();return ie(e)?(t.preventDefault(),e.getNodes().forEach(Ut),!0):!1}function Ut(t){t.remove()}function qt(t){if(!(t.target instanceof HTMLElement))return;let e=t.target.closest('[data-lexical-decorator="true"]');if(!(e instanceof HTMLElement))return;let o=Dt(e);return K(o)?{element:e,node:o}:void 0}function Jt(){let t=re();if(!ie(t))return;let e=t.getNodes();if(e.length!==1)return;let o=e[0];return K(o)?{decorator:o,element:X().getElementByKey(o.getKey())}:void 0}function Z({element:t,node:e}){document.querySelector(".decorator-selected")?.classList.remove("decorator-selected");let o=Tt();o.add(e.getKey()),Ie(o),t.scrollIntoView({behavior:"smooth",block:"nearest"}),t.classList.add("decorator-selected")}function se(t){if(K(t)&&!t.isInline())return!0;if(!xe(t)||Mt(t))return!1;let e=t.getFirstChild(),o=e===null||Lt(e)||At(e)||e.isInline();return!t.isInline()&&t.canBeEmpty()!==!1&&o}function Oe(t){let e=t.getNextSibling();for(;e!==null;){if(se(e))return e;e=e.getNextSibling()}return null}function Fe(t){let e=t.getPreviousSibling();for(;e!==null;){if(se(e))return e;e=e.getPreviousSibling()}return null}import{jsx as Ee}from"react/jsx-runtime";import{useLexicalComposerContext as oo}from"@lexical/react/LexicalComposerContext.js";import{$createParagraphNode as no,isHTMLElement as ro}from"lexical";import*as je from"react";import{useCallback as io,useEffect as He,useRef as so,useState as lo}from"react";import{createPortal as ao}from"react-dom";var Y=(t,e,o,n,r=50,c=25)=>{let s=0;if(t&&!t.contains(n)){let{bottom:l,left:u,right:y,top:h}=t.getBoundingClientRect(),a=h+window.scrollY,i=l+window.scrollY;if(o<a-c||o>i+c||e<u-r||e>y+r)return-1;(e<u||e>y)&&(s=e<u?e-u:e-y)}return s};import{$getNodeByKey as ae}from"lexical";function V(t){let e=t.getBoundingClientRect(),o=getComputedStyle(t).getPropertyValue("transform");if(!o||o==="none")return e;let n=o.split(",").pop();return e.y=e.y-Number(n?.replace(")","")),e}function le(t){let e=(u,y)=>u?parseFloat(window.getComputedStyle(u)[y]):0,{marginBottom:o,marginTop:n}=window.getComputedStyle(t),r=e(t.previousElementSibling,"marginBottom"),c=e(t.nextElementSibling,"marginTop"),s=Math.max(parseFloat(n),r);return{marginBottom:Math.max(parseFloat(o),c),marginTop:s}}import{$getRoot as Qt}from"lexical";function H(t){return t.getEditorState().read(()=>Qt().getChildrenKeys())}var Xt=1,Zt=-1,$e=0,A={props:null,result:null};function eo(t,e,o=20){let n=t.x-e.x,r=t.y-e.y;return n*n+r*r<=o*o}function G(t){let{anchorElem:e,cache_threshold:o=20,editor:n,fuzzy:r=!1,horizontalOffset:c=0,point:{x:s,y:l},startIndex:u=0,useEdgeAsDefault:y=!1}=t;if(o>0&&A.props&&A.result&&A.props.fuzzy===t.fuzzy&&A.props.horizontalOffset===t.horizontalOffset&&A.props.useEdgeAsDefault===t.useEdgeAsDefault&&eo(A.props.point,t.point,o))return A.result;let h=e.getBoundingClientRect(),a=H(n),i={blockElem:null,blockNode:null,distance:1/0,foundAtIndex:-1,isFoundNodeEmptyParagraph:!1};return n.getEditorState().read(()=>{if(y){let d=n.getElementByKey(a[0]),f=n.getElementByKey(a[a.length-1]);if(d&&f){let[p,m]=[V(d),V(f)];if(l<p.top?(i.blockElem=d,i.distance=p.top-l,i.blockNode=ae(a[0]),i.foundAtIndex=0):l>m.bottom&&(i.distance=l-m.bottom,i.blockNode=ae(a[a.length-1]),i.blockElem=f,i.foundAtIndex=a.length-1),i?.blockElem)return{blockElem:null,isFoundNodeEmptyParagraph:!1}}}let g=u,x=$e;for(;g>=0&&g<a.length;){let d=a[g],f=n.getElementByKey(d);if(f===null)break;let p=new _(s+c,l),m=Le.fromDOMRect(V(f)),{marginBottom:C,marginTop:w}=le(f),S=m.generateNewRect({bottom:m.bottom+C,left:h.left,right:h.right,top:m.top-w}),{distance:b,isOnBottomSide:k,isOnTopSide:N}=S.distanceFromPoint(p);if(b===0){i.blockElem=f,i.blockNode=ae(d),i.foundAtIndex=g,i.distance=b,i.blockNode&&i.blockNode.getType()==="paragraph"&&i.blockNode.getTextContent()===""&&(!r&&!t.returnEmptyParagraphs&&(i.blockElem=null,i.blockNode=null),i.isFoundNodeEmptyParagraph=!0);break}else r&&b<i.distance&&(i.blockElem=f,i.blockNode=ae(d),i.distance=b,i.foundAtIndex=g);x===$e&&(N?x=Zt:k?x=Xt:x=1/0),g+=x}}),A.props=t,A.result={blockElem:i.blockElem,blockNode:i.blockNode,foundAtIndex:i.foundAtIndex,isFoundNodeEmptyParagraph:i.isFoundNodeEmptyParagraph},{blockElem:i.blockElem,blockNode:i.blockNode,foundAtIndex:i.foundAtIndex,isFoundNodeEmptyParagraph:i.isFoundNodeEmptyParagraph}}function ce(t,e){return!!t.closest(`.${e}`)}var to=["IMG","INPUT","TEXTAREA","SELECT","BUTTON","VIDEO","OBJECT","EMBED","IFRAME","HR"];function Ke(t){if(!t||to.includes(t.tagName)||t.offsetHeight===0||t.offsetWidth===0)return!1;let e=window.getComputedStyle(t);return!(e.display==="table-cell"||e.position==="absolute"||e.visibility==="hidden"||e.opacity==="0")}function ue(t,e,o,n=0){if(!t){e.style.opacity="0",e.style.transform="translate(-10000px, -10000px)";return}let r=t.getBoundingClientRect(),c=window.getComputedStyle(t),s=e.getBoundingClientRect(),l=o.getBoundingClientRect(),u;if(["lexical-block","lexical-upload","lexical-relationship"].some(a=>t.firstElementChild?.classList.contains(a)))u=r.top+8-l.top;else{let a=Ke(t)?parseInt(c.lineHeight,10):0;u=r.top+(a-s.height)/2-l.top}let h=n;e.style.opacity="1",e.style.transform=`translate(${h}px, ${u}px)`}var co="add-block-menu",de=1/0;function uo(t){return t===0?1/0:de>=0&&de<t?de:Math.floor(t/2)}function mo(t,e,o){let n=e.parentElement,{editorConfig:r}=R(),c=r?.admin?.hideGutter?-24:12,s=so(null),[l,u]=lo(null);He(()=>{function h(a){let i=a.target;if(!ro(i))return;let g=Y(n,a.pageX,a.pageY,i);if(g===-1){u(null);return}if(ce(i,co))return;let x=H(t),{blockElem:d,blockNode:f,foundAtIndex:p}=G({anchorElem:e,cache_threshold:0,editor:t,horizontalOffset:-g,point:new _(a.x,a.y),returnEmptyParagraphs:!0,startIndex:uo(x.length),useEdgeAsDefault:!1});de=p,d&&f&&(l?.node!==f||l?.elem!==d)&&u({elem:d,node:f})}return document?.addEventListener("mousemove",h),()=>{document?.removeEventListener("mousemove",h)}},[n,e,t,l]),He(()=>{s.current&&l?.node&&ue(l?.elem,s.current,e,c)},[e,l,c]);let y=io(h=>{let a=l;a?.node&&(t.update(()=>{let i=!0;if((a?.node.getType()!=="paragraph"||a.node.getTextContent()!=="")&&(i=!1),!i){let g=no();a?.node.insertAfter(g),setTimeout(()=>{a={elem:t.getElementByKey(g.getKey()),node:g},u(a)},0)}}),setTimeout(()=>{t.update(()=>{t.focus(),a?.node&&"select"in a.node&&typeof a.node.select=="function"&&a.node.select()})},1),setTimeout(()=>{t.dispatchCommand(Te,{node:a?.node})},2),h.stopPropagation(),h.preventDefault())},[t,l]);return ao(Ee(je.Fragment,{children:Ee("button",{"aria-label":"Add block",className:"icon add-block-menu",onClick:h=>{y(h)},ref:s,type:"button",children:Ee("div",{className:o?"icon":""})})}),e)}function ze(t){let{anchorElem:e}=t,o=e===void 0?document.body:e,[n]=oo();return mo(n,o,n._editable)}import{jsx as me,jsxs as po}from"react/jsx-runtime";import{useLexicalComposerContext as go}from"@lexical/react/LexicalComposerContext.js";import{eventFiles as Ve}from"@lexical/rich-text";import{$getNearestNodeFromDOMNode as Ge,$getNodeByKey as ho,isHTMLElement as Ce}from"lexical";import*as Xe from"react";import{useEffect as be,useRef as fe,useState as Ue}from"react";import{createPortal as yo}from"react-dom";var We=0,fo=-24;var j=0;function Ye(t,e,o,n,r,c,s,l,u,y=!1){let{height:h,top:a}=n.getBoundingClientRect(),{top:i,width:g}=s.getBoundingClientRect(),{marginBottom:x,marginTop:d}=le(n),f=a,p=c>=a+h/2+window.scrollY,m=!1;if(r?.elem)if(n!==r?.elem)(p&&r?.elem&&r?.elem===n.nextElementSibling||!p&&r?.elem&&r?.elem===n.previousElementSibling)&&(j++,j<200&&(m=!0));else{j++;let b=r?.boundingBox?.y,k=n.getBoundingClientRect().y;(p===r?.isBelow&&b===k||j<200)&&(m=!1)}if(m)return{isBelow:p,willStayInSamePosition:m};y?f+=h/2:p?f+=h+x/2:f-=d/2;let C=0;y||(p?C=-We:C=We);let w=f-i+C,S=fo-e;return o.style.width=`calc(${g}px - ${t})`,o.style.opacity=".8",o.style.transform=`translate(${S}px, calc(${w}px - 2px))`,r?.elem&&(r.elem.style.opacity="",r?.elem===n?p?r.elem.style.marginTop="":r.elem.style.marginBottom="":(r.elem.style.marginBottom="",r.elem.style.marginTop="")),j=0,{isBelow:p,willStayInSamePosition:m}}var xo="draggable-block-menu",qe="application/x-lexical-drag-block",ee=1/0;function Je(t){return t===0?1/0:ee>=0&&ee<t?ee:Math.floor(t/2)}function Eo(t,e){let{transform:o}=e.style;t.setDragImage(e,0,0),setTimeout(()=>{e.style.transform=o})}function Qe(t,e){t&&(t.style.opacity="0"),e&&(e.style.opacity="",e.style.marginBottom="",e.style.marginTop="")}function Co(t,e,o){let n=e.parentElement,r=fe(null),c=fe(null),s=fe(null),l=fe(!1),[u,y]=Ue(null),[h,a]=Ue(null),{editorConfig:i}=R(),g=i?.admin?.hideGutter?-44:-8;be(()=>{function f(p){let m=p.target;if(!Ce(m))return;let C=Y(n,p.pageX,p.pageY,m);if(C===-1){y(null);return}if(ce(m,xo))return;let w=H(t),{blockElem:S,foundAtIndex:b,isFoundNodeEmptyParagraph:k}=G({anchorElem:e,cache_threshold:0,editor:t,horizontalOffset:-C,point:new _(p.x,p.y),startIndex:Je(w.length),useEdgeAsDefault:!1,verbose:!1});ee=b,!(!S&&!k)&&u!==S&&y(S)}return document?.addEventListener("mousemove",f),()=>{document?.removeEventListener("mousemove",f)}},[n,e,t,u]),be(()=>{r.current&&ue(u,r.current,e,g)},[e,u,g]),be(()=>{function f(m){if(!l.current)return!1;let[C]=Ve(m);if(C)return!1;let{pageY:w,target:S}=m;if(!Ce(S))return!1;let b=Y(n,m.pageX,m.pageY,S,100,50),k=H(t),{blockElem:N,foundAtIndex:L,isFoundNodeEmptyParagraph:I}=G({anchorElem:e,editor:t,fuzzy:!0,horizontalOffset:-b,point:new _(m.x,m.y),startIndex:Je(k.length),useEdgeAsDefault:!0,verbose:!0});ee=L;let v=c.current;if(N===null||v===null)return!1;if(u!==N){let{isBelow:T,willStayInSamePosition:J}=Ye(i?.admin?.hideGutter?"0px":"3rem",g+(i?.admin?.hideGutter?r?.current?.getBoundingClientRect()?.width??0:-(r?.current?.getBoundingClientRect()?.width??0)),v,N,h,w,e,m,s,I);m.preventDefault(),J||a({boundingBox:N.getBoundingClientRect(),elem:N,isBelow:T})}else h?.elem&&(Qe(v,h.elem),a({boundingBox:N.getBoundingClientRect(),elem:N,isBelow:!1}));return!0}function p(m){if(!l.current)return!1;let[C]=Ve(m);if(C)return!1;let{dataTransfer:w,pageY:S,target:b}=m,k=w?.getData(qe)||"";return t.update(()=>{let N=ho(k);if(!N||!Ce(b))return!1;let L=Y(n,m.pageX,m.pageY,b,100,50),{blockElem:I,isFoundNodeEmptyParagraph:v}=G({anchorElem:e,editor:t,fuzzy:!0,horizontalOffset:-L,point:new _(m.x,m.y),useEdgeAsDefault:!0});if(!I)return!1;let T=Ge(I);if(!T)return!1;if(T===N)return!0;let{height:J,top:he}=V(I),z=S>=he+J/2+window.scrollY;v?(T.insertBefore(N),T.remove()):z?T.insertAfter(N):T.insertBefore(N),u!==null&&y(null),document.querySelectorAll(".lexical-block-highlighter").forEach(D=>{D.remove()});let oe=t.getElementByKey(N.getKey());setTimeout(()=>{let D=oe?.getBoundingClientRect();if(!D)return;let P=document.createElement("div");P.className="lexical-block-highlighter",P.style.backgroundColor="var(--theme-elevation-1000",P.style.transition="opacity 0.5s ease-in-out",P.style.zIndex="1",P.style.pointerEvents="none",P.style.boxSizing="border-box",P.style.borderRadius="4px",P.style.position="absolute",document.body.appendChild(P),P.style.opacity="0.1",P.style.height=`${D.height+8}px`,P.style.width=`${D.width+8}px`,P.style.top=`${D.top+window.scrollY-4}px`,P.style.left=`${D.left-4}px`,setTimeout(()=>{P.style.opacity="0",setTimeout(()=>{P.remove()},500)},1e3)},120)}),!0}return document.addEventListener("dragover",f),document.addEventListener("drop",p),()=>{document.removeEventListener("dragover",f),document.removeEventListener("drop",p)}},[n,g,e,t,h,u,i?.admin?.hideGutter]);function x(f){let p=f.dataTransfer;if(!p||!u)return;Eo(p,u);let m="";t.update(()=>{let C=Ge(u);C&&(m=C.getKey())}),l.current=!0,p.setData(qe,m)}function d(){l.current=!1,h?.elem&&Qe(c.current,h?.elem)}return yo(po(Xe.Fragment,{children:[me("button",{"aria-label":"Drag to move",className:"icon draggable-block-menu",draggable:!0,onDragEnd:d,onDragStart:x,ref:r,type:"button",children:me("div",{className:o?"icon":""})}),me("div",{className:"draggable-block-target-line",ref:c}),me("div",{className:"debug-highlight",ref:s})]}),e)}function Ze(t){let{anchorElem:e}=t,o=e===void 0?document.body:e,[n]=go();return Co(n,o,n._editable)}import{c as bo}from"react/compiler-runtime";import{jsx as Ne}from"react/jsx-runtime";import{useLexicalComposerContext as No}from"@lexical/react/LexicalComposerContext";import{$createParagraphNode as Po,$getRoot as So}from"lexical";import"react";var et="insert-paragraph-at-end",tt=()=>{let t=bo(2),[e]=No(),{editorConfig:o}=R();if(o?.admin?.hideInsertParagraphAtEnd)return null;let n;return t[0]!==e?(n=Ne("div",{"aria-label":"Insert Paragraph",className:et,onClick:()=>{e.update(Ro)},role:"button",tabIndex:0,children:Ne("div",{className:`${et}-inside`,children:Ne("span",{children:"+"})})}),t[0]=e,t[1]=n):n=t[1],n};function Ro(){let t=Po();So().append(t),t.select()}import{c as ko}from"react/compiler-runtime";import{useLexicalComposerContext as wo}from"@lexical/react/LexicalComposerContext";import*as ot from"react";var nt=()=>{let t=ko(4),{editorConfig:e}=R(),[o]=wo(),n,r;return t[0]!==o||t[1]!==e.features.markdownTransformers?(n=()=>we(o,e.features.markdownTransformers??[]),r=[o,e.features.markdownTransformers],t[0]=o,t[1]=e.features.markdownTransformers,t[2]=n,t[3]=r):(n=t[2],r=t[3]),ot.useEffect(n,r),null};import{useLexicalComposerContext as vo}from"@lexical/react/LexicalComposerContext";import{$getSelection as To,$isRangeSelection as Do,RootNode as Lo}from"lexical";import{useEffect as Mo}from"react";function rt(){let[t]=vo();return Mo(()=>t.registerNodeTransform(Lo,e=>{let o=To();if(Do(o)){let n=o.anchor.getNode(),r=o.focus.getNode();(!n.isAttached()||!r.isAttached())&&(e.selectEnd(),console.warn("updateEditor: selection has been moved to the end of the editor because the previously selected nodes have been removed and selection wasn't moved to another node. Ensure selection changes after removing/replacing a selected node."))}return!1}),[t]),null}import{useLexicalComposerContext as Ao}from"@lexical/react/LexicalComposerContext";import{$getSelection as Bo,COMMAND_PRIORITY_LOW as Io,SELECT_ALL_COMMAND as _o}from"lexical";import{useEffect as Oo}from"react";function it(){let[t]=Ao();return Oo(()=>t.registerCommand(_o,()=>{if(Bo())return!1;let o=document.activeElement;return o instanceof HTMLInputElement&&o.select(),!0},Io),[t]),null}import{jsx as U,jsxs as lt}from"react/jsx-runtime";import{useLexicalComposerContext as $o}from"@lexical/react/LexicalComposerContext.js";import{useTranslation as at}from"@payloadcms/ui";import{useCallback as Ko,useMemo as Ho,useState as jo}from"react";import"react";import*as ct from"react-dom";import{c as Fo}from"react/compiler-runtime";import"react";function st(t,e){let o=Fo(4),{maxLength:n,minLength:r}=e,c=n===void 0?75:n,s=r===void 0?1:r,l;return o[0]!==c||o[1]!==s||o[2]!==t?(l=u=>{let{query:y}=u,h="[^"+t+ve+"\\s]",i=new RegExp("(^|\\s|\\()(["+t+"]((?:"+h+"){0,"+c+"}))$").exec(y);if(i!==null){let g=i[1],x=i[3];if(x.length>=s)return{leadOffset:i.index+g.length,matchingString:x,replaceableString:i[2]}}return null},o[0]=c,o[1]=s,o[2]=t,o[3]=l):l=o[3],l}var B="slash-menu-popup";function zo({isSelected:t,item:e,onClick:o,onMouseEnter:n,ref:r}){let{fieldProps:{featureClientSchemaMap:c,schemaPath:s}}=R(),{i18n:l}=at(),u=`${B}__item ${B}__item-${e.key}`;t&&(u+=` ${B}__item--selected`);let y=e.key;return e.label&&(y=typeof e.label=="function"?e.label({featureClientSchemaMap:c,i18n:l,schemaPath:s}):e.label),y.length>25&&(y=y.substring(0,25)+"..."),lt("button",{"aria-selected":t,className:u,id:B+"__item-"+e.key,onClick:o,onMouseEnter:n,ref:r,role:"option",tabIndex:-1,type:"button",children:[e?.Icon&&U(e.Icon,{}),U("span",{className:`${B}__item-text`,children:y})]},e.key)}function ut({anchorElem:t=document.body}){let[e]=$o(),[o,n]=jo(null),{editorConfig:r}=R(),{i18n:c}=at(),{fieldProps:{featureClientSchemaMap:s,schemaPath:l}}=R(),u=st("/",{minLength:0}),y=Ko(()=>{let a=[];for(let i of r.features.slashMenu.dynamicGroups)if(o){let g=i({editor:e,queryString:o});a=a.concat(g)}return a},[e,o,r?.features]),h=Ho(()=>{let a=[];for(let i of r?.features.slashMenu.groups??[])a.push(i);if(o){a=a.map(g=>{let x=g.items.filter(d=>{let f=d.key;return d.label&&(f=typeof d.label=="function"?d.label({featureClientSchemaMap:s,i18n:c,schemaPath:l}):d.label),new RegExp(o,"gi").exec(f)?!0:d.keywords!=null?d.keywords.some(p=>new RegExp(o,"gi").exec(p)):!1});return x.length?{...g,items:x}:null}),a=a.filter(g=>g!=null);let i=y();for(let g of i){let x=a.find(d=>d.key===g.key);x?a=a.filter(d=>d.key!==g.key):x={...g,items:[]},x?.items?.length&&(x.items=x.items.concat(x.items)),a.push(x)}}return a},[o,r?.features.slashMenu.groups,y,s,c,l]);return U(De,{anchorElem:t,groups:h,menuRenderFn:(a,{selectedItemKey:i,selectItemAndCleanUp:g,setSelectedItemKey:x})=>a.current&&h.length?ct.createPortal(U("div",{className:B,children:h.map(d=>{let f=d.key;return d.label&&s&&(f=typeof d.label=="function"?d.label({featureClientSchemaMap:s,i18n:c,schemaPath:l}):d.label),lt("div",{className:`${B}__group ${B}__group-${d.key}`,children:[U("div",{className:`${B}__group-title`,children:f}),d.items.map((p,m)=>U(zo,{index:m,isSelected:i===p.key,item:p,onClick:()=>{x(p.key),g(p)},onMouseEnter:()=>{x(p.key)},ref:C=>{p.ref={current:C}}},p.key))]},d.key)})}),a.current):null,onQueryChange:n,triggerFn:u})}import{c as Wo}from"react/compiler-runtime";import{useLexicalComposerContext as Yo}from"@lexical/react/LexicalComposerContext";import{TEXT_TYPE_TO_FORMAT as Vo,TextNode as Go}from"lexical";import{useEffect as Uo}from"react";function dt(t){let e=Wo(6),{features:o}=t,[n]=Yo(),r;e[0]!==n||e[1]!==o.enabledFormats?(r=()=>{let s=qo(o.enabledFormats);if(s.length!==0)return n.registerNodeTransform(Go,l=>{s.forEach(u=>{l.hasFormat(u)&&l.toggleFormat(u)})})},e[0]=n,e[1]=o.enabledFormats,e[2]=r):r=e[2];let c;return e[3]!==n||e[4]!==o?(c=[n,o],e[3]=n,e[4]=o,e[5]=c):c=e[5],Uo(r,c),null}function qo(t){let e=Object.keys(Vo),o=new Set(t);return e.filter(n=>!o.has(n))}import{c as Jo}from"react/compiler-runtime";import{jsx as mt}from"react/jsx-runtime";import{ContentEditable as Qo}from"@lexical/react/LexicalContentEditable.js";import{useTranslation as Xo}from"@payloadcms/ui";import"react";function ft(t){let e=Jo(4),{className:o,editorConfig:n}=t,{t:r}=Xo(),c;return e[0]!==o||e[1]!==n?.admin?.placeholder||e[2]!==r?(c=mt(Qo,{"aria-placeholder":r("lexical:general:placeholder"),className:o??"ContentEditable__root",placeholder:mt("p",{className:"editor-placeholder",children:n?.admin?.placeholder??r("lexical:general:placeholder")})}),e[0]=o,e[1]=n?.admin?.placeholder,e[2]=r,e[3]=c):c=e[3],c}var gt=t=>{let e=Zo(14),{editorConfig:o,editorContainerRef:n,isSmallWidthViewport:r,onChange:c}=t,s=R(),[l]=en(),[u,y]=cn(null),h;e[0]===Symbol.for("react.memo_cache_sentinel")?(h=d=>{d!==null&&y(d)},e[0]=h):h=e[0];let a=h,i,g;e[1]!==l||e[2]!==s?(i=()=>{if(!s?.uuid){console.error("Lexical Editor must be used within an EditorConfigProvider");return}s?.parentEditor?.uuid&&s.parentEditor?.registerChild(s.uuid,s);let d=()=>{s.focusEditor(s)},f=()=>{s.blurEditor(s)},p=l.registerCommand(ln,()=>(d(),!0),pt),m=l.registerCommand(sn,()=>(f(),!0),pt);return()=>{p(),m(),s.parentEditor?.unregisterChild?.(s.uuid)}},g=[l,s],e[1]=l,e[2]=s,e[3]=i,e[4]=g):(i=e[3],g=e[4]),an(i,g);let x;if(e[5]!==l||e[6]!==o||e[7]!==n||e[8]!==u||e[9]!==r||e[10]!==c){let d;e[12]!==c?(d=(f,p,m)=>{(!m.has("focus")||m.size>1)&&c?.(f,p,m)},e[12]=c,e[13]=d):d=e[13],x=te(q.Fragment,{children:[o.features.plugins?.map(un),te("div",{className:"editor-container",ref:n,children:[o.features.plugins?.map(dn),E(rn,{contentEditable:E("div",{className:"editor-scroller",children:E("div",{className:"editor",ref:a,children:E(ft,{editorConfig:o})})}),ErrorBoundary:tn}),E(rt,{}),E(tt,{}),E(_e,{}),E(dt,{features:o.features}),E(it,{}),E(nn,{ignoreSelectionChange:!0,onChange:d}),u&&te(q.Fragment,{children:[!r&&l.isEditable()&&te(q.Fragment,{children:[o.admin?.hideDraggableBlockElement?null:E(Ze,{anchorElem:u}),o.admin?.hideAddBlockButton?null:E(ze,{anchorElem:u})]}),o.features.plugins?.map(f=>{if(f.position==="floatingAnchorElem"&&!(f.desktopOnly===!0&&r))return E($,{anchorElem:u,clientProps:f.clientProps,plugin:f},f.key)}),l.isEditable()&&E(q.Fragment,{children:E(ut,{anchorElem:u})})]}),l.isEditable()&&te(q.Fragment,{children:[E(on,{}),o?.features?.markdownTransformers?.length>0&&E(nt,{})]}),o.features.plugins?.map(mn),o.features.plugins?.map(fn)]}),o.features.plugins?.map(pn)]}),e[5]=l,e[6]=o,e[7]=n,e[8]=u,e[9]=r,e[10]=c,e[11]=x}else x=e[11];return x};function un(t){if(t.position==="aboveContainer")return E($,{clientProps:t.clientProps,plugin:t},t.key)}function dn(t){if(t.position==="top")return E($,{clientProps:t.clientProps,plugin:t},t.key)}function mn(t){if(t.position==="normal")return E($,{clientProps:t.clientProps,plugin:t},t.key)}function fn(t){if(t.position==="bottom")return E($,{clientProps:t.clientProps,plugin:t},t.key)}function pn(t){if(t.position==="belowContainer")return E($,{clientProps:t.clientProps,plugin:t},t.key)}var yt=({children:t,providers:e})=>{if(!e?.length)return t;let o=e[0];return e.length>1?O(o,{children:O(yt,{providers:e.slice(1),children:t})}):O(o,{children:t})},xt=t=>{let{composerKey:e,editorConfig:o,fieldProps:n,isSmallWidthViewport:r,onChange:c,readOnly:s,value:l}=t,u=R(),y=hn(),h=ht.useRef(null),a=yn(()=>{if(l&&typeof l!="object")throw new Error("The value passed to the Lexical editor is not an object. This is not supported. Please remove the data from the field and start again. This is the value that was passed in: "+JSON.stringify(l));if(l&&Array.isArray(l)&&!("root"in l))throw new Error("You have tried to pass in data from the old Slate editor to the new Lexical editor. The data structure is different, thus you will have to migrate your data. We offer a one-line migration script which migrates all your rich text fields: https://payloadcms.com/docs/lexical/migration#migration-via-migration-script-recommended");if(l&&"jsonContent"in l)throw new Error("You have tried to pass in data from payload-plugin-lexical. The data structure is different, thus you will have to migrate your data. Migration guide: https://payloadcms.com/docs/lexical/migration#migrating-from-payload-plugin-lexical");return{editable:s!==!0,editorState:l!=null?JSON.stringify(l):void 0,namespace:o.lexical.namespace,nodes:Me({editorConfig:o}),onError:i=>{throw i},theme:o.lexical.theme}},[o]);return a?O(gn,{initialConfig:a,children:O(Re,{editorConfig:o,editorContainerRef:h,fieldProps:n,parentContext:u?.editDepth===y?u:void 0,children:O(yt,{providers:o.features.providers,children:O(gt,{editorConfig:o,editorContainerRef:h,isSmallWidthViewport:r,onChange:c})})})},e+a.editable):O("p",{children:"Loading..."})};var pe="rich-text-lexical",vn=t=>{let{editorConfig:e,field:o,field:{admin:{className:n,description:r,readOnly:c}={},label:s,localized:l,required:u},path:y,readOnly:h,validate:a}=t,i=h||c,g=bn(),x=bt((M,Q)=>typeof a=="function"?a(M,{...Q,required:u}):!0,[a,u]),{customComponents:{AfterInput:d,BeforeInput:f,Description:p,Error:m,Label:C}={},disabled:w,initialValue:S,path:b,setValue:k,showError:N,value:L}=Pn({potentiallyStalePath:y,validate:x}),I=i||w,[v,T]=Pt(!1),[J,he]=Pt(),ye=Ct.useRef(S),z=Ct.useRef(L);Nt(()=>{let M=()=>{let Q=window.matchMedia("(max-width: 768px)").matches;Q!==v&&T(Q)};return M(),window.addEventListener("resize",M),()=>{window.removeEventListener("resize",M)}},[v]);let Pe=[pe,"field-type",n,N&&"error",I&&`${pe}--read-only`,e?.admin?.hideGutter!==!0&&!v?`${pe}--show-gutter`:null].filter(Boolean).join(" "),oe=`${b}.${g}`,D=ke(),P=bt(M=>{D(()=>{let Se=M.toJSON();z.current=Se,k(Se)})},[k,D]),St=kn(()=>Sn(o),[o]),Rt=Nn(M=>{z.current!==L&&!Rn(JSON.parse(JSON.stringify(z.current)),L)&&(ye.current=M,z.current=L,he(new Date))});return Nt(()=>{Object.is(S,ye.current)||Rt(S)},[S]),ge("div",{className:Pe,style:St,children:[F(Et,{CustomComponent:m,Fallback:F(En,{path:b,showError:N})}),C||F(Cn,{label:s,localized:l,path:b,required:u}),ge("div",{className:`${pe}__wrap`,children:[ge(wn,{fallbackRender:Tn,onReset:()=>{},children:[f,F(xt,{composerKey:oe,editorConfig:e,fieldProps:t,isSmallWidthViewport:v,onChange:P,readOnly:I,value:L},JSON.stringify({path:b,rerenderProviderKey:J})),d]}),F(Et,{CustomComponent:p,Fallback:F(xn,{description:r,path:b})})]})]},oe)};function Tn({error:t}){return ge("div",{className:"errorBoundary",role:"alert",children:[F("p",{children:"Something went wrong:"}),F("pre",{style:{color:"red"},children:t.message})]})}var ds=vn;export{ds as RichText};
|
|
2
|
-
//# sourceMappingURL=Field-EHRBYNHO.js.map
|