@payloadcms/richtext-lexical 4.0.0-internal.5f0cd13 → 4.0.0-internal.a0ef1b8

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.
Files changed (146) hide show
  1. package/dist/@types/assets.d.js +2 -0
  2. package/dist/@types/assets.d.js.map +1 -0
  3. package/dist/cell/rscEntry.d.ts.map +1 -1
  4. package/dist/cell/rscEntry.js +5 -5
  5. package/dist/cell/rscEntry.js.map +1 -1
  6. package/dist/exports/client/Field-VYBSMSRY.js +2 -0
  7. package/dist/exports/client/Field-VYBSMSRY.js.map +7 -0
  8. package/dist/exports/client/bundled.css +1 -1
  9. package/dist/exports/client/chunk-5VIL27GI.js +2 -0
  10. package/dist/exports/client/chunk-5VIL27GI.js.map +7 -0
  11. package/dist/exports/client/chunk-UD4DQ4AK.js +2 -0
  12. package/dist/exports/client/chunk-UD4DQ4AK.js.map +7 -0
  13. package/dist/exports/client/chunk-ZYXHC5CY.js +2 -0
  14. package/dist/exports/client/chunk-ZYXHC5CY.js.map +7 -0
  15. package/dist/exports/client/{component-HKTAZ77E.js → component-PHZQBOJE.js} +2 -2
  16. package/dist/exports/client/componentInline-R3EPNYWF.js +2 -0
  17. package/dist/exports/client/index.d.ts +1 -0
  18. package/dist/exports/client/index.d.ts.map +1 -1
  19. package/dist/exports/client/index.js +25 -25
  20. package/dist/exports/client/index.js.map +4 -4
  21. package/dist/exports/server/rsc.browser.d.ts +11 -0
  22. package/dist/exports/server/rsc.browser.d.ts.map +1 -0
  23. package/dist/exports/server/rsc.browser.js +10 -0
  24. package/dist/exports/server/rsc.browser.js.map +1 -0
  25. package/dist/features/blocks/client/component/index.d.ts +1 -0
  26. package/dist/features/blocks/client/component/index.d.ts.map +1 -1
  27. package/dist/features/blocks/client/component/index.js +15 -8
  28. package/dist/features/blocks/client/component/index.js.map +1 -1
  29. package/dist/features/blocks/client/componentInline/index.d.ts +1 -0
  30. package/dist/features/blocks/client/componentInline/index.d.ts.map +1 -1
  31. package/dist/features/blocks/client/componentInline/index.js +14 -7
  32. package/dist/features/blocks/client/componentInline/index.js.map +1 -1
  33. package/dist/features/blocks/premade/CodeBlock/Component/Block.d.ts.map +1 -1
  34. package/dist/features/blocks/premade/CodeBlock/Component/Block.js +1 -0
  35. package/dist/features/blocks/premade/CodeBlock/Component/Block.js.map +1 -1
  36. package/dist/features/blocks/server/index.d.ts.map +1 -1
  37. package/dist/features/blocks/server/index.js +2 -2
  38. package/dist/features/blocks/server/index.js.map +1 -1
  39. package/dist/features/blocks/server/schema.d.ts +5 -5
  40. package/dist/features/blocks/server/schema.d.ts.map +1 -1
  41. package/dist/features/blocks/server/schema.js +26 -23
  42. package/dist/features/blocks/server/schema.js.map +1 -1
  43. package/dist/features/converters/lexicalToHtml/async/types.d.ts +13 -15
  44. package/dist/features/converters/lexicalToHtml/async/types.d.ts.map +1 -1
  45. package/dist/features/converters/lexicalToHtml/async/types.js.map +1 -1
  46. package/dist/features/converters/lexicalToHtml/sync/types.d.ts +13 -15
  47. package/dist/features/converters/lexicalToHtml/sync/types.d.ts.map +1 -1
  48. package/dist/features/converters/lexicalToHtml/sync/types.js.map +1 -1
  49. package/dist/features/converters/lexicalToJSX/Component/index.d.ts +2 -2
  50. package/dist/features/converters/lexicalToJSX/Component/index.d.ts.map +1 -1
  51. package/dist/features/converters/lexicalToJSX/Component/index.js +5 -4
  52. package/dist/features/converters/lexicalToJSX/Component/index.js.map +1 -1
  53. package/dist/features/converters/lexicalToJSX/converter/types.d.ts +12 -14
  54. package/dist/features/converters/lexicalToJSX/converter/types.d.ts.map +1 -1
  55. package/dist/features/converters/lexicalToJSX/converter/types.js.map +1 -1
  56. package/dist/features/converters/lexicalToPlaintext/sync/types.d.ts +12 -14
  57. package/dist/features/converters/lexicalToPlaintext/sync/types.d.ts.map +1 -1
  58. package/dist/features/converters/lexicalToPlaintext/sync/types.js.map +1 -1
  59. package/dist/features/experimental_table/server/schema.d.ts.map +1 -1
  60. package/dist/features/experimental_table/server/schema.js +6 -3
  61. package/dist/features/experimental_table/server/schema.js.map +1 -1
  62. package/dist/features/link/server/schema.d.ts.map +1 -1
  63. package/dist/features/link/server/schema.js +10 -7
  64. package/dist/features/link/server/schema.js.map +1 -1
  65. package/dist/features/relationship/server/schema.d.ts.map +1 -1
  66. package/dist/features/relationship/server/schema.js +5 -8
  67. package/dist/features/relationship/server/schema.js.map +1 -1
  68. package/dist/features/upload/client/component/index.css +2 -2
  69. package/dist/features/upload/server/schema.d.ts +4 -4
  70. package/dist/features/upload/server/schema.d.ts.map +1 -1
  71. package/dist/features/upload/server/schema.js +34 -18
  72. package/dist/features/upload/server/schema.js.map +1 -1
  73. package/dist/field/bundled.css +1 -1
  74. package/dist/field/clientEntry.d.ts +29 -0
  75. package/dist/field/clientEntry.d.ts.map +1 -0
  76. package/dist/field/clientEntry.js +86 -0
  77. package/dist/field/clientEntry.js.map +1 -0
  78. package/dist/field/index.css +9 -12
  79. package/dist/field/index.js +1 -1
  80. package/dist/field/index.js.map +1 -1
  81. package/dist/field/rscEntry.d.ts.map +1 -1
  82. package/dist/field/rscEntry.js +2 -0
  83. package/dist/field/rscEntry.js.map +1 -1
  84. package/dist/index.d.ts.map +1 -1
  85. package/dist/index.js +47 -4
  86. package/dist/index.js.map +1 -1
  87. package/dist/lexical/LexicalEditor.d.ts.map +1 -1
  88. package/dist/lexical/LexicalEditor.js +36 -2
  89. package/dist/lexical/LexicalEditor.js.map +1 -1
  90. package/dist/lexical/LexicalProvider.d.ts.map +1 -1
  91. package/dist/lexical/LexicalProvider.js +22 -7
  92. package/dist/lexical/LexicalProvider.js.map +1 -1
  93. package/dist/lexical/config/client/loader.d.ts.map +1 -1
  94. package/dist/lexical/config/client/loader.js +5 -1
  95. package/dist/lexical/config/client/loader.js.map +1 -1
  96. package/dist/types/builtInNodes.d.ts.map +1 -1
  97. package/dist/types/builtInNodes.js +17 -17
  98. package/dist/types/builtInNodes.js.map +1 -1
  99. package/dist/types/index.d.ts +16 -16
  100. package/dist/types/index.d.ts.map +1 -1
  101. package/dist/types/index.js.map +1 -1
  102. package/dist/types/jsonSchemaHelpers.d.ts +2 -0
  103. package/dist/types/jsonSchemaHelpers.d.ts.map +1 -1
  104. package/dist/types/jsonSchemaHelpers.js +7 -3
  105. package/dist/types/jsonSchemaHelpers.js.map +1 -1
  106. package/dist/types/nodeTypes.d.ts +51 -9
  107. package/dist/types/nodeTypes.d.ts.map +1 -1
  108. package/dist/types/nodeTypes.js +3 -3
  109. package/dist/types/nodeTypes.js.map +1 -1
  110. package/dist/types/schema.d.ts.map +1 -1
  111. package/dist/types/schema.js +12 -2
  112. package/dist/types/schema.js.map +1 -1
  113. package/dist/utilities/buildEditorState.d.ts +17 -3
  114. package/dist/utilities/buildEditorState.d.ts.map +1 -1
  115. package/dist/utilities/buildEditorState.js +8 -0
  116. package/dist/utilities/buildEditorState.js.map +1 -1
  117. package/dist/utilities/buildInitialState.d.ts +2 -1
  118. package/dist/utilities/buildInitialState.d.ts.map +1 -1
  119. package/dist/utilities/buildInitialState.js.map +1 -1
  120. package/dist/utilities/fieldsDrawer/Drawer.d.ts.map +1 -1
  121. package/dist/utilities/fieldsDrawer/Drawer.js +19 -10
  122. package/dist/utilities/fieldsDrawer/Drawer.js.map +1 -1
  123. package/dist/utilities/fieldsDrawer/DrawerContent.d.ts +4 -1
  124. package/dist/utilities/fieldsDrawer/DrawerContent.d.ts.map +1 -1
  125. package/dist/utilities/fieldsDrawer/DrawerContent.js +8 -7
  126. package/dist/utilities/fieldsDrawer/DrawerContent.js.map +1 -1
  127. package/dist/utilities/fieldsDrawer/index.css +12 -0
  128. package/dist/utilities/fieldsDrawer/useDrawerSubmit.d.ts +29 -0
  129. package/dist/utilities/fieldsDrawer/useDrawerSubmit.d.ts.map +1 -0
  130. package/dist/utilities/fieldsDrawer/useDrawerSubmit.js +97 -0
  131. package/dist/utilities/fieldsDrawer/useDrawerSubmit.js.map +1 -0
  132. package/dist/utilities/generateImportMap.d.ts.map +1 -1
  133. package/dist/utilities/generateImportMap.js +7 -3
  134. package/dist/utilities/generateImportMap.js.map +1 -1
  135. package/package.json +8 -7
  136. package/dist/exports/client/Field-G5Z2HM5Y.js +0 -2
  137. package/dist/exports/client/Field-G5Z2HM5Y.js.map +0 -7
  138. package/dist/exports/client/chunk-6QWQ7JV4.js +0 -2
  139. package/dist/exports/client/chunk-6QWQ7JV4.js.map +0 -7
  140. package/dist/exports/client/chunk-INBEEENE.js +0 -2
  141. package/dist/exports/client/chunk-INBEEENE.js.map +0 -7
  142. package/dist/exports/client/chunk-UAKNDD6R.js +0 -2
  143. package/dist/exports/client/chunk-UAKNDD6R.js.map +0 -7
  144. package/dist/exports/client/componentInline-D3A6OW76.js +0 -2
  145. /package/dist/exports/client/{component-HKTAZ77E.js.map → component-PHZQBOJE.js.map} +0 -0
  146. /package/dist/exports/client/{componentInline-D3A6OW76.js.map → componentInline-R3EPNYWF.js.map} +0 -0
@@ -1 +1 @@
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","ClipboardPlugin","DecoratorPlugin","AddBlockHandlePlugin","DraggableBlockPlugin","InsertParagraphAtEndPlugin","MarkdownShortcutPlugin","NodeViewOverridePlugin","NormalizeSelectionPlugin","SelectAllPlugin","SlashMenuPlugin","TextPlugin","LexicalContentEditable","LexicalEditor","props","$","editorConfig","editorContainerRef","isSmallWidthViewport","onChange","rtl","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","dir","undefined","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.css'\nimport { EditorPlugin } from './EditorPlugin.js'\nimport { ClipboardPlugin } from './plugins/ClipboardPlugin/index.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 { NodeViewOverridePlugin } from './plugins/NodeViewOverridePlugin/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' | 'rtl'>\n> = (props) => {\n const { editorConfig, editorContainerRef, isSmallWidthViewport, onChange, rtl } = 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\" dir={rtl ? 'rtl' : undefined} 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 <ClipboardPlugin />\n <TextPlugin features={editorConfig.features} />\n <SelectAllPlugin />\n <NodeViewOverridePlugin />\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;AACvC,OAAO;AACP,SAASC,YAAY,QAAQ;AAC7B,SAASC,eAAe,QAAQ;AAChC,SAASC,eAAe,QAAQ;AAChC,SAASC,oBAAoB,QAAQ;AACrC,SAASC,oBAAoB,QAAQ;AACrC,SAASC,0BAA0B,QAAQ;AAC3C,SAASC,sBAAsB,QAAQ;AACvC,SAASC,sBAAsB,QAAQ;AACvC,SAASC,wBAAwB,QAAQ;AACzC,SAASC,eAAe,QAAQ;AAChC,SAASC,eAAe,QAAQ;AAChC,SAASC,UAAU,QAAQ;AAC3B,SAASC,sBAAsB,QAAQ;AAEvC,OAAO,MAAMC,aAAA,GAKTC,KAAA;EAAA,MAAAC,CAAA,GAAA7B,EAAA;EACF;IAAA8B,YAAA;IAAAC,kBAAA;IAAAC,oBAAA;IAAAC,QAAA;IAAAC;EAAA,IAAkF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AAoB;IAAA,OAEpBd,IAAA,CAAA3D,YAAA;MAAA2E,WAAA,EAA2BH,QAAA,CAAAG,WAAA;MAAAH,MAAA,EAA6CA;IAAA,GAApBA,QAAA,CAAAI,GAAU;EAAA;AAAA;AAzJxE,SAAAK,OAAAI,QAAA;EAAA,IA+JQb,QAAA,CAAAC,QAAA,KAAoB;IAAA,OACfd,IAAA,CAAA3D,YAAA;MAAA2E,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","useCallback","useEffect","useState","useEditorConfigContext","EditorPlugin","ClipboardPlugin","DecoratorPlugin","AddBlockHandlePlugin","DraggableBlockPlugin","InsertParagraphAtEndPlugin","MarkdownShortcutPlugin","NodeViewOverridePlugin","NormalizeSelectionPlugin","SelectAllPlugin","SlashMenuPlugin","TextPlugin","LexicalContentEditable","EditorReadyPlugin","$","editor","t0","t1","root","getRootElement","dataset","lexicalEditable","String","isEditable","registerEditableListener","editable","el","LexicalEditor","props","editorConfig","editorContainerRef","isSmallWidthViewport","onChange","rtl","editorConfigContext","floatingAnchorElem","setFloatingAnchorElem","Symbol","for","_floatingAnchorElem","onRef","t2","uuid","console","error","parentEditor","registerChild","handleFocus","focusEditor","handleBlur","blurEditor","unregisterFocus","registerCommand","unregisterBlur","unregisterChild","t3","_jsxs","Fragment","children","features","plugins","map","_temp","className","dir","undefined","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 { useCallback, useEffect, useState } from 'react'\n\nimport type { LexicalProviderProps } from './LexicalProvider.js'\n\nimport { useEditorConfigContext } from './config/client/EditorConfigProvider.js'\nimport './LexicalEditor.css'\nimport { EditorPlugin } from './EditorPlugin.js'\nimport { ClipboardPlugin } from './plugins/ClipboardPlugin/index.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 { NodeViewOverridePlugin } from './plugins/NodeViewOverridePlugin/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\n/**\n * Marks the Lexical root element with `data-lexical-editable` once the editor\n * is mounted and interactive. Tests can query this attribute to confirm that\n * React event handlers are attached and keyboard input will be processed.\n */\nfunction EditorReadyPlugin() {\n const [editor] = useLexicalComposerContext()\n\n useEffect(() => {\n const root = editor.getRootElement()\n if (root) {\n root.dataset.lexicalEditable = String(editor.isEditable())\n }\n return editor.registerEditableListener((editable) => {\n const el = editor.getRootElement()\n if (el) {\n el.dataset.lexicalEditable = String(editable)\n }\n })\n }, [editor])\n\n return null\n}\n\nexport const LexicalEditor: React.FC<\n {\n editorContainerRef: React.RefObject<HTMLDivElement | null>\n isSmallWidthViewport: boolean\n } & Pick<LexicalProviderProps, 'editorConfig' | 'onChange' | 'rtl'>\n> = (props) => {\n const { editorConfig, editorContainerRef, isSmallWidthViewport, onChange, rtl } = 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 = useCallback((_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\" dir={rtl ? 'rtl' : undefined} 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 <EditorReadyPlugin />\n <NormalizeSelectionPlugin />\n {isEditable && <InsertParagraphAtEndPlugin />}\n <DecoratorPlugin />\n <ClipboardPlugin />\n <TextPlugin features={editorConfig.features} />\n <SelectAllPlugin />\n <NodeViewOverridePlugin />\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,WAAW,EAAEC,SAAS,EAAEC,QAAQ,QAAQ;AAIjD,SAASC,sBAAsB,QAAQ;AACvC,OAAO;AACP,SAASC,YAAY,QAAQ;AAC7B,SAASC,eAAe,QAAQ;AAChC,SAASC,eAAe,QAAQ;AAChC,SAASC,oBAAoB,QAAQ;AACrC,SAASC,oBAAoB,QAAQ;AACrC,SAASC,0BAA0B,QAAQ;AAC3C,SAASC,sBAAsB,QAAQ;AACvC,SAASC,sBAAsB,QAAQ;AACvC,SAASC,wBAAwB,QAAQ;AACzC,SAASC,eAAe,QAAQ;AAChC,SAASC,eAAe,QAAQ;AAChC,S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A;EAAA,IAgKQb,QAAA,CAAAC,QAAA,KAAoB;IAAA,OACfd,IAAA,CAAApE,YAAA;MAAAoF,WAAA,EAA2BH,QAAA,CAAAG,WAAA;MAAAH,MAAA,EAA6CA;IAAA,GAApBA,QAAA,CAAAI,GAAU;EAAA;AAAA","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"LexicalProvider.d.ts","sourceRoot":"","sources":["../../src/lexical/LexicalProvider.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,aAAa,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAA;AAIhF,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAG9B,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,mBAAmB,CAAA;AAClE,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,mBAAmB,CAAA;AAUpE,MAAM,MAAM,oBAAoB,GAAG;IACjC,WAAW,EAAE,MAAM,CAAA;IACnB,YAAY,EAAE,2BAA2B,CAAA;IACzC,UAAU,EAAE,yBAAyB,CAAA;IACrC,oBAAoB,EAAE,OAAO,CAAA;IAC7B,QAAQ,EAAE,CAAC,WAAW,EAAE,WAAW,EAAE,MAAM,EAAE,aAAa,EAAE,IAAI,EAAE,GAAG,CAAC,MAAM,CAAC,KAAK,IAAI,CAAA;IACtF,QAAQ,EAAE,OAAO,CAAA;IACjB,GAAG,CAAC,EAAE,OAAO,CAAA;IACb,KAAK,EAAE,qBAAqB,CAAA;CAC7B,CAAA;AAwBD,eAAO,MAAM,eAAe,EAAE,KAAK,CAAC,EAAE,CAAC,oBAAoB,CA8F1D,CAAA"}
1
+ {"version":3,"file":"LexicalProvider.d.ts","sourceRoot":"","sources":["../../src/lexical/LexicalProvider.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,aAAa,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAA;AAIhF,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAG9B,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,mBAAmB,CAAA;AAClE,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,mBAAmB,CAAA;AAUpE,MAAM,MAAM,oBAAoB,GAAG;IACjC,WAAW,EAAE,MAAM,CAAA;IACnB,YAAY,EAAE,2BAA2B,CAAA;IACzC,UAAU,EAAE,yBAAyB,CAAA;IACrC,oBAAoB,EAAE,OAAO,CAAA;IAC7B,QAAQ,EAAE,CAAC,WAAW,EAAE,WAAW,EAAE,MAAM,EAAE,aAAa,EAAE,IAAI,EAAE,GAAG,CAAC,MAAM,CAAC,KAAK,IAAI,CAAA;IACtF,QAAQ,EAAE,OAAO,CAAA;IACjB,GAAG,CAAC,EAAE,OAAO,CAAA;IACb,KAAK,EAAE,qBAAqB,CAAA;CAC7B,CAAA;AAwBD,eAAO,MAAM,eAAe,EAAE,KAAK,CAAC,EAAE,CAAC,oBAAoB,CAgH1D,CAAA"}
@@ -47,7 +47,8 @@ export const LexicalProvider = props => {
47
47
  const parentContext = useEditorConfigContext();
48
48
  const editDepth = useEditDepth();
49
49
  const editorContainerRef = React.useRef(null);
50
- // useMemo for the initialConfig that depends on readOnly and value
50
+ // useMemo for the initialConfig. `readOnly` and `value` are intentionally excluded from deps
51
+ // to avoid full remounts on every save (which would destroy cursor position and undo history).
51
52
  const initialConfig = useMemo(() => {
52
53
  if (value && typeof value !== 'object') {
53
54
  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(value));
@@ -76,16 +77,30 @@ export const LexicalProvider = props => {
76
77
  // Important: do not add readOnly and value to the dependencies array. This will cause the entire lexical editor to re-render if the document is saved, which will
77
78
  // cause the editor to lose focus.
78
79
  }, [editorConfig, views, currentView]);
79
- if (!initialConfig) {
80
+ // Track whether the editor has ever been editable. Once it transitions to editable,
81
+ // we never remount due to transient readOnly changes (e.g. during form save processing).
82
+ const hasBeenEditable = React.useRef(readOnly !== true);
83
+ if (readOnly !== true) {
84
+ hasBeenEditable.current = true;
85
+ }
86
+ // Compute the effective editable state for the config.
87
+ // Override the memoized config's editable value to reflect the current readOnly prop.
88
+ const effectiveConfig = useMemo(() => ({
89
+ ...initialConfig,
90
+ editable: readOnly !== true
91
+ }), [initialConfig, readOnly]);
92
+ if (!effectiveConfig) {
80
93
  return /*#__PURE__*/_jsx("p", {
81
94
  children: "Loading..."
82
95
  });
83
96
  }
84
- // We need to add initialConfig.editable to the key to force a re-render when the readOnly prop changes.
85
- // Without it, there were cases where lexical editors inside drawers turn readOnly initially - a few miliseconds later they turn editable, but the editor does not re-render and stays readOnly.
86
- // We also add currentView to force re-render when the view changes.
97
+ // Use `hasBeenEditable` to build the key: only force a remount when the editor has NEVER
98
+ // been editable and transitions to editable for the first time. After that, LexicalComposer
99
+ // stays mounted (preserving cursor/focus/undo) and we rely on Lexical's internal
100
+ // `editor.setEditable()` for transient readOnly changes during saves.
101
+ const editableKey = hasBeenEditable.current ? 'editable' : 'readonly';
87
102
  return /*#__PURE__*/_jsx(LexicalComposer, {
88
- initialConfig: initialConfig,
103
+ initialConfig: effectiveConfig,
89
104
  children: /*#__PURE__*/_jsx(EditorConfigProvider, {
90
105
  editorConfig: editorConfig,
91
106
  editorContainerRef: editorContainerRef,
@@ -105,6 +120,6 @@ export const LexicalProvider = props => {
105
120
  })
106
121
  })
107
122
  })
108
- }, composerKey + initialConfig.editable + currentView);
123
+ }, composerKey + editableKey + currentView);
109
124
  };
110
125
  //# sourceMappingURL=LexicalProvider.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"LexicalProvider.js","names":["LexicalComposer","useEditDepth","React","useMemo","useRichTextView","EditorConfigProvider","useEditorConfigContext","LexicalEditor","LexicalEditorComponent","getEnabledNodes","NestProviders","children","providers","length","Component","_jsx","slice","LexicalProvider","props","composerKey","editorConfig","fieldProps","isSmallWidthViewport","onChange","readOnly","rtl","value","currentView","views","parentContext","editDepth","editorContainerRef","useRef","initialConfig","Error","JSON","stringify","Array","isArray","nodeViews","nodes","editable","editorState","undefined","namespace","lexical","onError","error","theme","features"],"sources":["../../src/lexical/LexicalProvider.tsx"],"sourcesContent":["'use client'\nimport type { InitialConfigType } from '@lexical/react/LexicalComposer.js'\nimport type { EditorState, LexicalEditor, SerializedEditorState } from 'lexical'\n\nimport { LexicalComposer } from '@lexical/react/LexicalComposer.js'\nimport { useEditDepth } from '@payloadcms/ui'\nimport * as React from 'react'\nimport { useMemo } from 'react'\n\nimport type { LexicalRichTextFieldProps } from '../types/index.js'\nimport type { SanitizedClientEditorConfig } from './config/types.js'\n\nimport { useRichTextView } from '../field/RichTextViewProvider.js'\nimport {\n EditorConfigProvider,\n useEditorConfigContext,\n} from './config/client/EditorConfigProvider.js'\nimport { LexicalEditor as LexicalEditorComponent } from './LexicalEditor.js'\nimport { getEnabledNodes } from './nodes/index.js'\n\nexport type LexicalProviderProps = {\n composerKey: string\n editorConfig: SanitizedClientEditorConfig\n fieldProps: LexicalRichTextFieldProps\n isSmallWidthViewport: boolean\n onChange: (editorState: EditorState, editor: LexicalEditor, tags: Set<string>) => void\n readOnly: boolean\n rtl?: boolean\n value: SerializedEditorState\n}\n\nconst NestProviders = ({\n children,\n providers,\n}: {\n children: React.ReactNode\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n providers: any[]\n}) => {\n if (!providers?.length) {\n return children\n }\n const Component = providers[0]\n if (providers.length > 1) {\n return (\n <Component>\n <NestProviders providers={providers.slice(1)}>{children}</NestProviders>\n </Component>\n )\n }\n return <Component>{children}</Component>\n}\n\nexport const LexicalProvider: React.FC<LexicalProviderProps> = (props) => {\n const {\n composerKey,\n editorConfig,\n fieldProps,\n isSmallWidthViewport,\n onChange,\n readOnly,\n rtl,\n value,\n } = props\n\n const { currentView, views } = useRichTextView()\n\n const parentContext = useEditorConfigContext()\n\n const editDepth = useEditDepth()\n\n const editorContainerRef = React.useRef<HTMLDivElement>(null)\n\n // useMemo for the initialConfig that depends on readOnly and value\n const initialConfig = useMemo<InitialConfigType>(() => {\n if (value && typeof value !== 'object') {\n throw new Error(\n '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: ' +\n JSON.stringify(value),\n )\n }\n\n if (value && Array.isArray(value) && !('root' in value)) {\n throw new Error(\n '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',\n )\n }\n\n if (value && 'jsonContent' in value) {\n throw new Error(\n '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',\n )\n }\n\n // Use the 'default' view if available, otherwise undefined\n const nodeViews = views?.[currentView]?.nodes\n\n return {\n editable: readOnly !== true,\n editorState: value != null ? JSON.stringify(value) : undefined,\n namespace: editorConfig.lexical.namespace,\n nodes: getEnabledNodes({\n editorConfig,\n nodeViews,\n }),\n onError: (error: Error) => {\n throw error\n },\n theme: editorConfig.lexical.theme,\n }\n // Important: do not add readOnly and value to the dependencies array. This will cause the entire lexical editor to re-render if the document is saved, which will\n // cause the editor to lose focus.\n }, [editorConfig, views, currentView])\n\n if (!initialConfig) {\n return <p>Loading...</p>\n }\n\n // We need to add initialConfig.editable to the key to force a re-render when the readOnly prop changes.\n // Without it, there were cases where lexical editors inside drawers turn readOnly initially - a few miliseconds later they turn editable, but the editor does not re-render and stays readOnly.\n // We also add currentView to force re-render when the view changes.\n return (\n <LexicalComposer\n initialConfig={initialConfig}\n key={composerKey + initialConfig.editable + currentView}\n >\n <EditorConfigProvider\n editorConfig={editorConfig}\n editorContainerRef={editorContainerRef}\n fieldProps={fieldProps}\n /**\n * Parent editor is not truly the parent editor, if the current editor is part of a drawer and the parent editor is the main editor.\n */\n parentContext={parentContext?.editDepth === editDepth ? parentContext : undefined}\n >\n <NestProviders providers={editorConfig.features.providers}>\n <LexicalEditorComponent\n editorConfig={editorConfig}\n editorContainerRef={editorContainerRef}\n isSmallWidthViewport={isSmallWidthViewport}\n onChange={onChange}\n rtl={rtl}\n />\n </NestProviders>\n </EditorConfigProvider>\n </LexicalComposer>\n )\n}\n"],"mappings":"AAAA;;;AAIA,SAASA,eAAe,QAAQ;AAChC,SAASC,YAAY,QAAQ;AAC7B,YAAYC,KAAA,MAAW;AACvB,SAASC,OAAO,QAAQ;AAKxB,SAASC,eAAe,QAAQ;AAChC,SACEC,oBAAoB,EACpBC,sBAAsB,QACjB;AACP,SAASC,aAAA,IAAiBC,sBAAsB,QAAQ;AACxD,SAASC,eAAe,QAAQ;AAahC,MAAMC,aAAA,GAAgBA,CAAC;EACrBC,QAAQ;EACRC;AAAS,CAKV;EACC,IAAI,CAACA,SAAA,EAAWC,MAAA,EAAQ;IACtB,OAAOF,QAAA;EACT;EACA,MAAMG,SAAA,GAAYF,SAAS,CAAC,EAAE;EAC9B,IAAIA,SAAA,CAAUC,MAAM,GAAG,GAAG;IACxB,oBACEE,IAAA,CAACD,SAAA;gBACC,aAAAC,IAAA,CAACL,aAAA;QAAcE,SAAA,EAAWA,SAAA,CAAUI,KAAK,CAAC;kBAAKL;;;EAGrD;EACA,oBAAOI,IAAA,CAACD,SAAA;cAAWH;;AACrB;AAEA,OAAO,MAAMM,eAAA,GAAmDC,KAAA;EAC9D,MAAM;IACJC,WAAW;IACXC,YAAY;IACZC,UAAU;IACVC,oBAAoB;IACpBC,QAAQ;IACRC,QAAQ;IACRC,GAAG;IACHC;EAAK,CACN,GAAGR,KAAA;EAEJ,MAAM;IAAES,WAAW;IAAEC;EAAK,CAAE,GAAGxB,eAAA;EAE/B,MAAMyB,aAAA,GAAgBvB,sBAAA;EAEtB,MAAMwB,SAAA,GAAY7B,YAAA;EAElB,MAAM8B,kBAAA,GAAqB7B,KAAA,CAAM8B,MAAM,CAAiB;EAExD;EACA,MAAMC,aAAA,GAAgB9B,OAAA,CAA2B;IAC/C,IAAIuB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AQ,CAACrC,SAAS;kBACvD,aAAAG,IAAA,CAACP,sBAAA;UACCY,YAAA,EAAcA,YAAA;UACdW,kBAAA,EAAoBA,kBAAA;UACpBT,oBAAA,EAAsBA,oBAAA;UACtBC,QAAA,EAAUA,QAAA;UACVE,GAAA,EAAKA;;;;KAjBNN,WAAA,GAAcc,aAAA,CAAcQ,QAAQ,GAAGd,WAAA;AAuBlD","ignoreList":[]}
1
+ {"version":3,"file":"LexicalProvider.js","names":["LexicalComposer","useEditDepth","React","useMemo","useRichTextView","EditorConfigProvider","useEditorConfigContext","LexicalEditor","LexicalEditorComponent","getEnabledNodes","NestProviders","children","providers","length","Component","_jsx","slice","LexicalProvider","props","composerKey","editorConfig","fieldProps","isSmallWidthViewport","onChange","readOnly","rtl","value","currentView","views","parentContext","editDepth","editorContainerRef","useRef","initialConfig","Error","JSON","stringify","Array","isArray","nodeViews","nodes","editable","editorState","undefined","namespace","lexical","onError","error","theme","hasBeenEditable","current","effectiveConfig","editableKey","features"],"sources":["../../src/lexical/LexicalProvider.tsx"],"sourcesContent":["'use client'\nimport type { InitialConfigType } from '@lexical/react/LexicalComposer.js'\nimport type { EditorState, LexicalEditor, SerializedEditorState } from 'lexical'\n\nimport { LexicalComposer } from '@lexical/react/LexicalComposer.js'\nimport { useEditDepth } from '@payloadcms/ui'\nimport * as React from 'react'\nimport { useMemo } from 'react'\n\nimport type { LexicalRichTextFieldProps } from '../types/index.js'\nimport type { SanitizedClientEditorConfig } from './config/types.js'\n\nimport { useRichTextView } from '../field/RichTextViewProvider.js'\nimport {\n EditorConfigProvider,\n useEditorConfigContext,\n} from './config/client/EditorConfigProvider.js'\nimport { LexicalEditor as LexicalEditorComponent } from './LexicalEditor.js'\nimport { getEnabledNodes } from './nodes/index.js'\n\nexport type LexicalProviderProps = {\n composerKey: string\n editorConfig: SanitizedClientEditorConfig\n fieldProps: LexicalRichTextFieldProps\n isSmallWidthViewport: boolean\n onChange: (editorState: EditorState, editor: LexicalEditor, tags: Set<string>) => void\n readOnly: boolean\n rtl?: boolean\n value: SerializedEditorState\n}\n\nconst NestProviders = ({\n children,\n providers,\n}: {\n children: React.ReactNode\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n providers: any[]\n}) => {\n if (!providers?.length) {\n return children\n }\n const Component = providers[0]\n if (providers.length > 1) {\n return (\n <Component>\n <NestProviders providers={providers.slice(1)}>{children}</NestProviders>\n </Component>\n )\n }\n return <Component>{children}</Component>\n}\n\nexport const LexicalProvider: React.FC<LexicalProviderProps> = (props) => {\n const {\n composerKey,\n editorConfig,\n fieldProps,\n isSmallWidthViewport,\n onChange,\n readOnly,\n rtl,\n value,\n } = props\n\n const { currentView, views } = useRichTextView()\n\n const parentContext = useEditorConfigContext()\n\n const editDepth = useEditDepth()\n\n const editorContainerRef = React.useRef<HTMLDivElement>(null)\n\n // useMemo for the initialConfig. `readOnly` and `value` are intentionally excluded from deps\n // to avoid full remounts on every save (which would destroy cursor position and undo history).\n const initialConfig = useMemo<InitialConfigType>(() => {\n if (value && typeof value !== 'object') {\n throw new Error(\n '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: ' +\n JSON.stringify(value),\n )\n }\n\n if (value && Array.isArray(value) && !('root' in value)) {\n throw new Error(\n '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',\n )\n }\n\n if (value && 'jsonContent' in value) {\n throw new Error(\n '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',\n )\n }\n\n // Use the 'default' view if available, otherwise undefined\n const nodeViews = views?.[currentView]?.nodes\n\n return {\n editable: readOnly !== true,\n editorState: value != null ? JSON.stringify(value) : undefined,\n namespace: editorConfig.lexical.namespace,\n nodes: getEnabledNodes({\n editorConfig,\n nodeViews,\n }),\n onError: (error: Error) => {\n throw error\n },\n theme: editorConfig.lexical.theme,\n }\n // Important: do not add readOnly and value to the dependencies array. This will cause the entire lexical editor to re-render if the document is saved, which will\n // cause the editor to lose focus.\n }, [editorConfig, views, currentView])\n\n // Track whether the editor has ever been editable. Once it transitions to editable,\n // we never remount due to transient readOnly changes (e.g. during form save processing).\n const hasBeenEditable = React.useRef(readOnly !== true)\n if (readOnly !== true) {\n hasBeenEditable.current = true\n }\n\n // Compute the effective editable state for the config.\n // Override the memoized config's editable value to reflect the current readOnly prop.\n const effectiveConfig = useMemo<InitialConfigType>(\n () => ({\n ...initialConfig,\n editable: readOnly !== true,\n }),\n\n [initialConfig, readOnly],\n )\n\n if (!effectiveConfig) {\n return <p>Loading...</p>\n }\n\n // Use `hasBeenEditable` to build the key: only force a remount when the editor has NEVER\n // been editable and transitions to editable for the first time. After that, LexicalComposer\n // stays mounted (preserving cursor/focus/undo) and we rely on Lexical's internal\n // `editor.setEditable()` for transient readOnly changes during saves.\n const editableKey = hasBeenEditable.current ? 'editable' : 'readonly'\n return (\n <LexicalComposer initialConfig={effectiveConfig} key={composerKey + editableKey + currentView}>\n <EditorConfigProvider\n editorConfig={editorConfig}\n editorContainerRef={editorContainerRef}\n fieldProps={fieldProps}\n /**\n * Parent editor is not truly the parent editor, if the current editor is part of a drawer and the parent editor is the main editor.\n */\n parentContext={parentContext?.editDepth === editDepth ? parentContext : undefined}\n >\n <NestProviders providers={editorConfig.features.providers}>\n <LexicalEditorComponent\n editorConfig={editorConfig}\n editorContainerRef={editorContainerRef}\n isSmallWidthViewport={isSmallWidthViewport}\n onChange={onChange}\n rtl={rtl}\n />\n </NestProviders>\n </EditorConfigProvider>\n </LexicalComposer>\n )\n}\n"],"mappings":"AAAA;;;AAIA,SAASA,eAAe,QAAQ;AAChC,SAASC,YAAY,QAAQ;AAC7B,YAAYC,KAAA,MAAW;AACvB,SAASC,OAAO,QAAQ;AAKxB,SAASC,eAAe,QAAQ;AAChC,SACEC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BAExE,aAAA5B,IAAA,CAACL,aAAA;QAAcE,SAAA,EAAWQ,YAAA,CAAaiC,QAAQ,CAACzC,SAAS;kBACvD,aAAAG,IAAA,CAACP,sBAAA;UACCY,YAAA,EAAcA,YAAA;UACdW,kBAAA,EAAoBA,kBAAA;UACpBT,oBAAA,EAAsBA,oBAAA;UACtBC,QAAA,EAAUA,QAAA;UACVE,GAAA,EAAKA;;;;KAhByCN,WAAA,GAAciC,WAAA,GAAczB,WAAA;AAsBtF","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"loader.d.ts","sourceRoot":"","sources":["../../../../src/lexical/config/client/loader.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAA;AAEhE,OAAO,KAAK,EAGV,wBAAwB,EACzB,MAAM,kCAAkC,CAAA;AACzC,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,yBAAyB,CAAA;AACrE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAA;AAErD;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,EACjC,MAAM,EACN,sBAAsB,EACtB,sBAAsB,EACtB,KAAK,EACL,UAAU,EACV,uBAAuB,GACxB,EAAE;IACD,MAAM,EAAE,YAAY,CAAA;IACpB,sBAAsB,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;IAC3C,sBAAsB,EAAE,sBAAsB,CAAA;IAC9C,KAAK,CAAC,EAAE,mBAAmB,CAAA;IAC3B,UAAU,EAAE,MAAM,CAAA;IAClB,uBAAuB,EAAE,kBAAkB,CAAA;CAC5C,GAAG,wBAAwB,CAoD3B"}
1
+ {"version":3,"file":"loader.d.ts","sourceRoot":"","sources":["../../../../src/lexical/config/client/loader.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAA;AAEhE,OAAO,KAAK,EAGV,wBAAwB,EACzB,MAAM,kCAAkC,CAAA;AACzC,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,yBAAyB,CAAA;AACrE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAA;AAErD;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,EACjC,MAAM,EACN,sBAAsB,EACtB,sBAAsB,EACtB,KAAK,EACL,UAAU,EACV,uBAAuB,GACxB,EAAE;IACD,MAAM,EAAE,YAAY,CAAA;IACpB,sBAAsB,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;IAC3C,sBAAsB,EAAE,sBAAsB,CAAA;IAC9C,KAAK,CAAC,EAAE,mBAAmB,CAAA;IAC3B,UAAU,EAAE,MAAM,CAAA;IAClB,uBAAuB,EAAE,kBAAkB,CAAA;CAC5C,GAAG,wBAAwB,CA0D3B"}
@@ -13,12 +13,16 @@ export function loadClientFeatures({
13
13
  unSanitizedEditorConfig
14
14
  }) {
15
15
  const featureProviderMap = new Map();
16
+ const validFeatures = [];
16
17
  for (const featureProvider of unSanitizedEditorConfig.features) {
17
18
  if (!featureProvider?.clientFeatureProps?.featureKey || featureProvider?.clientFeatureProps?.order === undefined || featureProvider?.clientFeatureProps?.order === null) {
18
- throw new Error('A Feature you have installed does not return the client props as clientFeatureProps. Please make sure to always return those props, even if they are null, as other important props like order and featureKey are later on injected.');
19
+ console.warn('A Feature you have installed does not return the client props as clientFeatureProps. Please make sure to always return those props, even if they are null, as other important props like order and featureKey are later on injected. Skipping feature.');
20
+ continue;
19
21
  }
20
22
  featureProviderMap.set(featureProvider.clientFeatureProps.featureKey, featureProvider);
23
+ validFeatures.push(featureProvider);
21
24
  }
25
+ unSanitizedEditorConfig.features = validFeatures;
22
26
  // sort unSanitizedEditorConfig.features by order
23
27
  unSanitizedEditorConfig.features = unSanitizedEditorConfig.features.sort((a, b) => a.clientFeatureProps.order - b.clientFeatureProps.order);
24
28
  const resolvedFeatures = new Map();
@@ -1 +1 @@
1
- {"version":3,"file":"loader.js","names":["loadClientFeatures","config","featureClientImportMap","featureClientSchemaMap","field","schemaPath","unSanitizedEditorConfig","featureProviderMap","Map","featureProvider","features","clientFeatureProps","featureKey","order","undefined","Error","set","sort","a","b","resolvedFeatures","loaded","feature","key"],"sources":["../../../../src/lexical/config/client/loader.ts"],"sourcesContent":["'use client'\n\nimport type { ClientConfig, RichTextFieldClient } from 'payload'\n\nimport type {\n ClientFeatureProviderMap,\n ResolvedClientFeature,\n ResolvedClientFeatureMap,\n} from '../../../features/typesClient.js'\nimport type { FeatureClientSchemaMap } from '../../../types/index.js'\nimport type { ClientEditorConfig } from '../types.js'\n\n/**\n * This function expects client functions to ALREADY be ordered & dependencies checked on the server\n * @param unSanitizedEditorConfig\n */\nexport function loadClientFeatures({\n config,\n featureClientImportMap,\n featureClientSchemaMap,\n field,\n schemaPath,\n unSanitizedEditorConfig,\n}: {\n config: ClientConfig\n featureClientImportMap: Record<string, any>\n featureClientSchemaMap: FeatureClientSchemaMap\n field?: RichTextFieldClient\n schemaPath: string\n unSanitizedEditorConfig: ClientEditorConfig\n}): ResolvedClientFeatureMap {\n const featureProviderMap: ClientFeatureProviderMap = new Map()\n\n for (const featureProvider of unSanitizedEditorConfig.features) {\n if (\n !featureProvider?.clientFeatureProps?.featureKey ||\n featureProvider?.clientFeatureProps?.order === undefined ||\n featureProvider?.clientFeatureProps?.order === null\n ) {\n throw new Error(\n 'A Feature you have installed does not return the client props as clientFeatureProps. Please make sure to always return those props, even if they are null, as other important props like order and featureKey are later on injected.',\n )\n }\n featureProviderMap.set(featureProvider.clientFeatureProps.featureKey, featureProvider)\n }\n\n // sort unSanitizedEditorConfig.features by order\n unSanitizedEditorConfig.features = unSanitizedEditorConfig.features.sort(\n (a, b) => a.clientFeatureProps.order - b.clientFeatureProps.order,\n )\n\n const resolvedFeatures: ResolvedClientFeatureMap = new Map()\n\n // Make sure all dependencies declared in the respective features exist\n let loaded = 0\n for (const featureProvider of unSanitizedEditorConfig.features) {\n const feature: Partial<ResolvedClientFeature<any>> =\n typeof featureProvider.feature === 'function'\n ? featureProvider.feature({\n config,\n featureClientImportMap,\n featureClientSchemaMap,\n featureProviderMap,\n field,\n resolvedFeatures,\n schemaPath,\n unSanitizedEditorConfig,\n })\n : featureProvider.feature\n\n feature.key = featureProvider.clientFeatureProps.featureKey\n feature.order = loaded\n\n resolvedFeatures.set(\n featureProvider.clientFeatureProps.featureKey,\n feature as ResolvedClientFeature<any>,\n )\n\n loaded++\n }\n\n return resolvedFeatures\n}\n"],"mappings":"AAAA;;AAYA;;;;AAIA,OAAO,SAASA,mBAAmB;EACjCC,MAAM;EACNC,sBAAsB;EACtBC,sBAAsB;EACtBC,KAAK;EACLC,UAAU;EACVC;AAAuB,CAQxB;EACC,MAAMC,kBAAA,GAA+C,IAAIC,GAAA;EAEzD,KAAK,MAAMC,eAAA,IAAmBH,uBAAA,CAAwBI,QAAQ,EAAE;IAC9D,IACE,CAACD,eAAA,EAAiBE,kBAAA,EAAoBC,UAAA,IACtCH,eAAA,EAAiBE,kBAAA,EAAoBE,KAAA,KAAUC,SAAA,IAC/CL,eAAA,EAAiBE,kBAAA,EAAoBE,KAAA,KAAU,MAC/C;MACA,MAAM,IAAIE,KAAA,CACR;IAEJ;IACAR,kBAAA,CAAmBS,GAAG,CAACP,eAAA,CAAgBE,kBAAkB,CAACC,UAAU,EAAEH,eAAA;EACxE;EAEA;EACAH,uBAAA,CAAwBI,QAAQ,GAAGJ,uBAAA,CAAwBI,QAAQ,CAACO,IAAI,CACtE,CAACC,CAAA,EAAGC,CAAA,KAAMD,CAAA,CAAEP,kBAAkB,CAACE,KAAK,GAAGM,CAAA,CAAER,kBAAkB,CAACE,KAAK;EAGnE,MAAMO,gBAAA,GAA6C,IAAIZ,GAAA;EAEvD;EACA,IAAIa,MAAA,GAAS;EACb,KAAK,MAAMZ,eAAA,IAAmBH,uBAAA,CAAwBI,QAAQ,EAAE;IAC9D,MAAMY,OAAA,GACJ,OAAOb,eAAA,CAAgBa,OAAO,KAAK,aAC/Bb,eAAA,CAAgBa,OAAO,CAAC;MACtBrB,MAAA;MACAC,sBAAA;MACAC,sBAAA;MACAI,kBAAA;MACAH,KAAA;MACAgB,gBAAA;MACAf,UAAA;MACAC;IACF,KACAG,eAAA,CAAgBa,OAAO;IAE7BA,OAAA,CAAQC,GAAG,GAAGd,eAAA,CAAgBE,kBAAkB,CAACC,UAAU;IAC3DU,OAAA,CAAQT,KAAK,GAAGQ,MAAA;IAEhBD,gBAAA,CAAiBJ,GAAG,CAClBP,eAAA,CAAgBE,kBAAkB,CAACC,UAAU,EAC7CU,OAAA;IAGFD,MAAA;EACF;EAEA,OAAOD,gBAAA;AACT","ignoreList":[]}
1
+ {"version":3,"file":"loader.js","names":["loadClientFeatures","config","featureClientImportMap","featureClientSchemaMap","field","schemaPath","unSanitizedEditorConfig","featureProviderMap","Map","validFeatures","featureProvider","features","clientFeatureProps","featureKey","order","undefined","console","warn","set","push","sort","a","b","resolvedFeatures","loaded","feature","key"],"sources":["../../../../src/lexical/config/client/loader.ts"],"sourcesContent":["'use client'\n\nimport type { ClientConfig, RichTextFieldClient } from 'payload'\n\nimport type {\n ClientFeatureProviderMap,\n ResolvedClientFeature,\n ResolvedClientFeatureMap,\n} from '../../../features/typesClient.js'\nimport type { FeatureClientSchemaMap } from '../../../types/index.js'\nimport type { ClientEditorConfig } from '../types.js'\n\n/**\n * This function expects client functions to ALREADY be ordered & dependencies checked on the server\n * @param unSanitizedEditorConfig\n */\nexport function loadClientFeatures({\n config,\n featureClientImportMap,\n featureClientSchemaMap,\n field,\n schemaPath,\n unSanitizedEditorConfig,\n}: {\n config: ClientConfig\n featureClientImportMap: Record<string, any>\n featureClientSchemaMap: FeatureClientSchemaMap\n field?: RichTextFieldClient\n schemaPath: string\n unSanitizedEditorConfig: ClientEditorConfig\n}): ResolvedClientFeatureMap {\n const featureProviderMap: ClientFeatureProviderMap = new Map()\n\n const validFeatures: typeof unSanitizedEditorConfig.features = []\n\n for (const featureProvider of unSanitizedEditorConfig.features) {\n if (\n !featureProvider?.clientFeatureProps?.featureKey ||\n featureProvider?.clientFeatureProps?.order === undefined ||\n featureProvider?.clientFeatureProps?.order === null\n ) {\n console.warn(\n 'A Feature you have installed does not return the client props as clientFeatureProps. Please make sure to always return those props, even if they are null, as other important props like order and featureKey are later on injected. Skipping feature.',\n )\n continue\n }\n featureProviderMap.set(featureProvider.clientFeatureProps.featureKey, featureProvider)\n validFeatures.push(featureProvider)\n }\n\n unSanitizedEditorConfig.features = validFeatures\n\n // sort unSanitizedEditorConfig.features by order\n unSanitizedEditorConfig.features = unSanitizedEditorConfig.features.sort(\n (a, b) => a.clientFeatureProps.order - b.clientFeatureProps.order,\n )\n\n const resolvedFeatures: ResolvedClientFeatureMap = new Map()\n\n // Make sure all dependencies declared in the respective features exist\n let loaded = 0\n for (const featureProvider of unSanitizedEditorConfig.features) {\n const feature: Partial<ResolvedClientFeature<any>> =\n typeof featureProvider.feature === 'function'\n ? featureProvider.feature({\n config,\n featureClientImportMap,\n featureClientSchemaMap,\n featureProviderMap,\n field,\n resolvedFeatures,\n schemaPath,\n unSanitizedEditorConfig,\n })\n : featureProvider.feature\n\n feature.key = featureProvider.clientFeatureProps.featureKey\n feature.order = loaded\n\n resolvedFeatures.set(\n featureProvider.clientFeatureProps.featureKey,\n feature as ResolvedClientFeature<any>,\n )\n\n loaded++\n }\n\n return resolvedFeatures\n}\n"],"mappings":"AAAA;;AAYA;;;;AAIA,OAAO,SAASA,mBAAmB;EACjCC,MAAM;EACNC,sBAAsB;EACtBC,sBAAsB;EACtBC,KAAK;EACLC,UAAU;EACVC;AAAuB,CAQxB;EACC,MAAMC,kBAAA,GAA+C,IAAIC,GAAA;EAEzD,MAAMC,aAAA,GAAyD,EAAE;EAEjE,KAAK,MAAMC,eAAA,IAAmBJ,uBAAA,CAAwBK,QAAQ,EAAE;IAC9D,IACE,CAACD,eAAA,EAAiBE,kBAAA,EAAoBC,UAAA,IACtCH,eAA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AK,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAA;AAE9D;;;;;GAKG;AACH,eAAO,MAAM,wBAAwB,6eAYnC,CAAA;AAqDF,eAAO,MAAM,kBAAkB,EAAE,YAkBhC,CAAA;AAED,eAAO,MAAM,iBAAiB,EAAE,YAkB/B,CAAA;AAED,eAAO,MAAM,uBAAuB,EAAE,YAYrC,CAAA;AAED,eAAO,MAAM,uBAAuB,EAAE,YAerC,CAAA;AAeD,eAAO,MAAM,kBAAkB,EAAE,YAoBhC,CAAA"}
1
+ {"version":3,"file":"builtInNodes.d.ts","sourceRoot":"","sources":["../../src/types/builtInNodes.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAA;AAI9D;;;;;GAKG;AACH,eAAO,MAAM,wBAAwB,6eAYnC,CAAA;AA4DF,eAAO,MAAM,kBAAkB,EAAE,YAkBhC,CAAA;AAED,eAAO,MAAM,iBAAiB,EAAE,YAoB/B,CAAA;AAED,eAAO,MAAM,uBAAuB,EAAE,YAYrC,CAAA;AAED,eAAO,MAAM,uBAAuB,EAAE,YAerC,CAAA;AAeD,eAAO,MAAM,kBAAkB,EAAE,YAoBhC,CAAA"}
@@ -1,4 +1,5 @@
1
1
  import { withNullableJSONSchemaType } from 'payload';
2
+ import { versionSchema } from './jsonSchemaHelpers.js';
2
3
  /**
3
4
  * Cross-cutting Lexical types shared by every element node. Inlined into
4
5
  * `payload-types.ts`. Must stay byte-for-byte in sync with the runtime twins
@@ -61,6 +62,11 @@ const textModeSchema = {
61
62
  enum: ['normal', 'token', 'segmented'],
62
63
  tsType: 'LexicalTextMode'
63
64
  };
65
+ /** Text-node `format` bitmask (Lexical text-format flags). */
66
+ const textFormatSchema = {
67
+ type: 'integer',
68
+ description: 'Active text formats as a bitmask, OR-ed together (0 = none): bold=1, italic=2, strikethrough=4, underline=8, code=16, subscript=32, superscript=64, highlight=128, lowercase=256, uppercase=512. e.g. bold + italic = 3.'
69
+ };
64
70
  export const textNodeJSONSchema = ({
65
71
  typeStringDefinitions
66
72
  }) => {
@@ -77,9 +83,7 @@ export const textNodeJSONSchema = ({
77
83
  detail: {
78
84
  type: 'integer'
79
85
  },
80
- format: {
81
- type: 'integer'
82
- },
86
+ format: textFormatSchema,
83
87
  mode: textModeSchema,
84
88
  style: {
85
89
  type: 'string'
@@ -87,9 +91,7 @@ export const textNodeJSONSchema = ({
87
91
  text: {
88
92
  type: 'string'
89
93
  },
90
- version: {
91
- type: 'integer'
92
- }
94
+ version: versionSchema
93
95
  },
94
96
  required: ['detail', 'format', 'mode', 'style', 'text', 'type', 'version'],
95
97
  tsType: 'SerializedTextNode'
@@ -108,22 +110,22 @@ export const tabNodeJSONSchema = ({
108
110
  type: 'string',
109
111
  const: 'tab'
110
112
  },
113
+ // A tab node is fully fixed: Lexical marks it unmergeable (`detail` = IS_UNMERGEABLE = 2) and
114
+ // its text is a single tab. Any other `detail` makes `TabNode.setDetail` throw on load.
111
115
  detail: {
112
- type: 'integer'
113
- },
114
- format: {
115
- type: 'integer'
116
+ const: 2,
117
+ description: 'Always 2 (Lexical IS_UNMERGEABLE); other values throw.'
116
118
  },
119
+ format: textFormatSchema,
117
120
  mode: textModeSchema,
118
121
  style: {
119
122
  type: 'string'
120
123
  },
121
124
  text: {
122
- type: 'string'
125
+ const: '\t',
126
+ description: 'Always a single tab character.'
123
127
  },
124
- version: {
125
- type: 'integer'
126
- }
128
+ version: versionSchema
127
129
  },
128
130
  required: ['detail', 'format', 'mode', 'style', 'text', 'type', 'version'],
129
131
  tsType: 'SerializedTabNode'
@@ -141,9 +143,7 @@ export const lineBreakNodeJSONSchema = ({
141
143
  type: 'string',
142
144
  const: 'linebreak'
143
145
  },
144
- version: {
145
- type: 'integer'
146
- }
146
+ version: versionSchema
147
147
  },
148
148
  required: ['type', 'version'],
149
149
  tsType: 'SerializedLineBreakNode'
@@ -1 +1 @@
1
- {"version":3,"file":"builtInNodes.js","names":["withNullableJSONSchemaType","CORE_LEXICAL_TYPE_STRING","LEXICAL_TEXT_MODE_TS","SERIALIZED_TEXT_NODE_TS","SERIALIZED_TAB_NODE_TS","SERIALIZED_LINE_BREAK_NODE_TS","SERIALIZED_PARAGRAPH_NODE_TS","textModeSchema","type","enum","tsType","textNodeJSONSchema","typeStringDefinitions","add","additionalProperties","properties","const","detail","format","mode","style","text","version","required","tabNodeJSONSchema","lineBreakNodeJSONSchema","paragraphNodeJSONSchema","elementNodeSchema","nodeUnionName","nodeType","textFormat","textStyle","ROOT_NODE_TS","rootNodeJSONSchema","field","root"],"sources":["../../src/types/builtInNodes.ts"],"sourcesContent":["import type { JSONSchema4 } from 'json-schema'\n\nimport { withNullableJSONSchemaType } from 'payload'\n\nimport type { JSONSchemaFn } from '../features/typesServer.js'\n\n/**\n * Cross-cutting Lexical types shared by every element node. Inlined into\n * `payload-types.ts`. Must stay byte-for-byte in sync with the runtime twins\n * in `types/nodeTypes.ts` (`LexicalElementFormat`, `LexicalElementDirection`,\n * `SerializedLexicalElementBase`) — cross-module assignability depends on it.\n */\nexport const CORE_LEXICAL_TYPE_STRING = `/** @internal Core Lexical types — see @payloadcms/richtext-lexical. */\nexport type LexicalElementFormat = 'left' | 'start' | 'center' | 'right' | 'end' | 'justify' | '';\nexport type LexicalElementDirection = ('ltr' | 'rtl') | null;\n\nexport interface SerializedLexicalElementBase<TChildren> {\n children: TChildren[];\n direction: LexicalElementDirection;\n format: LexicalElementFormat;\n indent: number;\n textFormat?: number;\n textStyle?: string;\n version: number;\n}`\n\n/**\n * Built-in Lexical node schemas (always present regardless of feature config).\n * Co-located with the TS source they reference — each `JSONSchemaFn` adds\n * its helper interface(s) to `typeStringDefinitions` and returns the JSON\n * schema for that node.\n */\n\n/** MUST stay byte-for-byte in sync with `LexicalTextMode` in `types/nodeTypes.ts`. */\nconst LEXICAL_TEXT_MODE_TS = `export type LexicalTextMode = 'normal' | 'token' | 'segmented';`\n\n/** MUST stay byte-for-byte in sync with `SerializedTextNode` in `types/nodeTypes.ts`. */\nconst SERIALIZED_TEXT_NODE_TS = `export interface SerializedTextNode {\n type: 'text';\n detail: number;\n format: number;\n mode: LexicalTextMode;\n style: string;\n text: string;\n version: number;\n}`\n\n/** MUST stay byte-for-byte in sync with `SerializedTabNode` in `types/nodeTypes.ts`. */\nconst SERIALIZED_TAB_NODE_TS = `export interface SerializedTabNode {\n type: 'tab';\n detail: number;\n format: number;\n mode: LexicalTextMode;\n style: string;\n text: string;\n version: number;\n}`\n\n/** MUST stay byte-for-byte in sync with `SerializedLineBreakNode` in `types/nodeTypes.ts`. */\nconst SERIALIZED_LINE_BREAK_NODE_TS = `export interface SerializedLineBreakNode {\n type: 'linebreak';\n version: number;\n}`\n\n/** MUST stay byte-for-byte in sync with `SerializedParagraphNode` in `types/nodeTypes.ts`. */\nconst SERIALIZED_PARAGRAPH_NODE_TS = `export interface SerializedParagraphNode<TChildren> extends SerializedLexicalElementBase<TChildren> {\n type: 'paragraph';\n textFormat: number;\n textStyle: string;\n}`\n\nconst textModeSchema: JSONSchema4 = {\n type: 'string',\n enum: ['normal', 'token', 'segmented'],\n tsType: 'LexicalTextMode',\n}\n\nexport const textNodeJSONSchema: JSONSchemaFn = ({ typeStringDefinitions }) => {\n typeStringDefinitions.add(LEXICAL_TEXT_MODE_TS)\n typeStringDefinitions.add(SERIALIZED_TEXT_NODE_TS)\n return {\n type: 'object',\n additionalProperties: false,\n properties: {\n type: { type: 'string', const: 'text' },\n detail: { type: 'integer' },\n format: { type: 'integer' },\n mode: textModeSchema,\n style: { type: 'string' },\n text: { type: 'string' },\n version: { type: 'integer' },\n },\n required: ['detail', 'format', 'mode', 'style', 'text', 'type', 'version'],\n tsType: 'SerializedTextNode',\n }\n}\n\nexport const tabNodeJSONSchema: JSONSchemaFn = ({ typeStringDefinitions }) => {\n typeStringDefinitions.add(LEXICAL_TEXT_MODE_TS)\n typeStringDefinitions.add(SERIALIZED_TAB_NODE_TS)\n return {\n type: 'object',\n additionalProperties: false,\n properties: {\n type: { type: 'string', const: 'tab' },\n detail: { type: 'integer' },\n format: { type: 'integer' },\n mode: textModeSchema,\n style: { type: 'string' },\n text: { type: 'string' },\n version: { type: 'integer' },\n },\n required: ['detail', 'format', 'mode', 'style', 'text', 'type', 'version'],\n tsType: 'SerializedTabNode',\n }\n}\n\nexport const lineBreakNodeJSONSchema: JSONSchemaFn = ({ typeStringDefinitions }) => {\n typeStringDefinitions.add(SERIALIZED_LINE_BREAK_NODE_TS)\n return {\n type: 'object',\n additionalProperties: false,\n properties: {\n type: { type: 'string', const: 'linebreak' },\n version: { type: 'integer' },\n },\n required: ['type', 'version'],\n tsType: 'SerializedLineBreakNode',\n }\n}\n\nexport const paragraphNodeJSONSchema: JSONSchemaFn = ({\n elementNodeSchema,\n nodeUnionName,\n typeStringDefinitions,\n}) => {\n typeStringDefinitions.add(SERIALIZED_PARAGRAPH_NODE_TS)\n return elementNodeSchema({\n nodeType: 'paragraph',\n properties: {\n textFormat: { type: 'integer' },\n textStyle: { type: 'string' },\n },\n required: ['textFormat', 'textStyle'],\n tsType: `SerializedParagraphNode<${nodeUnionName}>`,\n })\n}\n\n/** MUST stay byte-for-byte in sync with `LexicalRichText` in `types/nodeTypes.ts`. */\nconst ROOT_NODE_TS = `/** Shape of a Lexical \\`richText\\` field. */\nexport interface LexicalRichText<TNode> {\n root: {\n children: TNode[];\n direction: LexicalElementDirection;\n format: LexicalElementFormat;\n indent: number;\n type: 'root';\n version: number;\n };\n}`\n\nexport const rootNodeJSONSchema: JSONSchemaFn = ({\n elementNodeSchema,\n field,\n nodeUnionName,\n typeStringDefinitions,\n}) => {\n typeStringDefinitions.add(ROOT_NODE_TS)\n return {\n type: withNullableJSONSchemaType('object', !!field.required),\n additionalProperties: false,\n properties: {\n root: elementNodeSchema({\n nodeType: 'root',\n }),\n },\n required: ['root'],\n tsType: field.required\n ? `LexicalRichText<${nodeUnionName}>`\n : `LexicalRichText<${nodeUnionName}> | null`,\n }\n}\n"],"mappings":"AAEA,SAASA,0BA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C;AACF;AAEA;AACA,MAAMI,YAAA,GAAe;;;;;;;;;;EAUnB;AAEF,OAAO,MAAMC,kBAAA,GAAmCA,CAAC;EAC/CN,iBAAiB;EACjBO,KAAK;EACLN,aAAa;EACbhB;AAAqB,CACtB;EACCA,qBAAA,CAAsBC,GAAG,CAACmB,YAAA;EAC1B,OAAO;IACLxB,IAAA,EAAMR,0BAAA,CAA2B,UAAU,CAAC,CAACkC,KAAA,CAAMX,QAAQ;IAC3DT,oBAAA,EAAsB;IACtBC,UAAA,EAAY;MACVoB,IAAA,EAAMR,iBAAA,CAAkB;QACtBE,QAAA,EAAU;MACZ;IACF;IACAN,QAAA,EAAU,CAAC,OAAO;IAClBb,MAAA,EAAQwB,KAAA,CAAMX,QAAQ,GAClB,mBAAmBK,aAAA,GAAgB,GACnC,mBAAmBA,aAAA;EACzB;AACF","ignoreList":[]}
1
+ {"version":3,"file":"builtInNodes.js","names":["withNullableJSONSchemaType","versionSchema","CORE_LEXICAL_TYPE_STRING","LEXICAL_TEXT_MODE_TS","SERIALIZED_TEXT_NODE_TS","SERIALIZED_TAB_NODE_TS","SERIALIZED_LINE_BREAK_NODE_TS","SERIALIZED_PARAGRAPH_NODE_TS","textModeSchema","type","enum","tsType","textFormatSchema","description","textNodeJSONSchema","typeStringDefinitions","add","additionalProperties","properties","const","detail","format","mode","style","text","version","required","tabNodeJSONSchema","lineBreakNodeJSONSchema","paragraphNodeJSONSchema","elementNodeSchema","nodeUnionName","nodeType","textFormat","textStyle","ROOT_NODE_TS","rootNodeJSONSchema","field","root"],"sources":["../../src/types/builtInNodes.ts"],"sourcesContent":["import type { JSONSchema4 } from 'json-schema'\n\nimport { withNullableJSONSchemaType } from 'payload'\n\nimport type { JSONSchemaFn } from '../features/typesServer.js'\n\nimport { versionSchema } from './jsonSchemaHelpers.js'\n\n/**\n * Cross-cutting Lexical types shared by every element node. Inlined into\n * `payload-types.ts`. Must stay byte-for-byte in sync with the runtime twins\n * in `types/nodeTypes.ts` (`LexicalElementFormat`, `LexicalElementDirection`,\n * `SerializedLexicalElementBase`) — cross-module assignability depends on it.\n */\nexport const CORE_LEXICAL_TYPE_STRING = `/** @internal Core Lexical types — see @payloadcms/richtext-lexical. */\nexport type LexicalElementFormat = 'left' | 'start' | 'center' | 'right' | 'end' | 'justify' | '';\nexport type LexicalElementDirection = ('ltr' | 'rtl') | null;\n\nexport interface SerializedLexicalElementBase<TChildren> {\n children: TChildren[];\n direction: LexicalElementDirection;\n format: LexicalElementFormat;\n indent: number;\n textFormat?: number;\n textStyle?: string;\n version: number;\n}`\n\n/**\n * Built-in Lexical node schemas (always present regardless of feature config).\n * Co-located with the TS source they reference — each `JSONSchemaFn` adds\n * its helper interface(s) to `typeStringDefinitions` and returns the JSON\n * schema for that node.\n */\n\n/** MUST stay byte-for-byte in sync with `LexicalTextMode` in `types/nodeTypes.ts`. */\nconst LEXICAL_TEXT_MODE_TS = `export type LexicalTextMode = 'normal' | 'token' | 'segmented';`\n\n/** MUST stay byte-for-byte in sync with `SerializedTextNode` in `types/nodeTypes.ts`. */\nconst SERIALIZED_TEXT_NODE_TS = `export interface SerializedTextNode {\n type: 'text';\n detail: number;\n format: number;\n mode: LexicalTextMode;\n style: string;\n text: string;\n version: number;\n}`\n\n/** MUST stay byte-for-byte in sync with `SerializedTabNode` in `types/nodeTypes.ts`. */\nconst SERIALIZED_TAB_NODE_TS = `export interface SerializedTabNode {\n type: 'tab';\n detail: number;\n format: number;\n mode: LexicalTextMode;\n style: string;\n text: string;\n version: number;\n}`\n\n/** MUST stay byte-for-byte in sync with `SerializedLineBreakNode` in `types/nodeTypes.ts`. */\nconst SERIALIZED_LINE_BREAK_NODE_TS = `export interface SerializedLineBreakNode {\n type: 'linebreak';\n version: number;\n}`\n\n/** MUST stay byte-for-byte in sync with `SerializedParagraphNode` in `types/nodeTypes.ts`. */\nconst SERIALIZED_PARAGRAPH_NODE_TS = `export interface SerializedParagraphNode<TChildren> extends SerializedLexicalElementBase<TChildren> {\n type: 'paragraph';\n textFormat: number;\n textStyle: string;\n}`\n\nconst textModeSchema: JSONSchema4 = {\n type: 'string',\n enum: ['normal', 'token', 'segmented'],\n tsType: 'LexicalTextMode',\n}\n\n/** Text-node `format` bitmask (Lexical text-format flags). */\nconst textFormatSchema: JSONSchema4 = {\n type: 'integer',\n description:\n 'Active text formats as a bitmask, OR-ed together (0 = none): bold=1, italic=2, strikethrough=4, underline=8, code=16, subscript=32, superscript=64, highlight=128, lowercase=256, uppercase=512. e.g. bold + italic = 3.',\n}\n\nexport const textNodeJSONSchema: JSONSchemaFn = ({ typeStringDefinitions }) => {\n typeStringDefinitions.add(LEXICAL_TEXT_MODE_TS)\n typeStringDefinitions.add(SERIALIZED_TEXT_NODE_TS)\n return {\n type: 'object',\n additionalProperties: false,\n properties: {\n type: { type: 'string', const: 'text' },\n detail: { type: 'integer' },\n format: textFormatSchema,\n mode: textModeSchema,\n style: { type: 'string' },\n text: { type: 'string' },\n version: versionSchema,\n },\n required: ['detail', 'format', 'mode', 'style', 'text', 'type', 'version'],\n tsType: 'SerializedTextNode',\n }\n}\n\nexport const tabNodeJSONSchema: JSONSchemaFn = ({ typeStringDefinitions }) => {\n typeStringDefinitions.add(LEXICAL_TEXT_MODE_TS)\n typeStringDefinitions.add(SERIALIZED_TAB_NODE_TS)\n return {\n type: 'object',\n additionalProperties: false,\n properties: {\n type: { type: 'string', const: 'tab' },\n // A tab node is fully fixed: Lexical marks it unmergeable (`detail` = IS_UNMERGEABLE = 2) and\n // its text is a single tab. Any other `detail` makes `TabNode.setDetail` throw on load.\n detail: { const: 2, description: 'Always 2 (Lexical IS_UNMERGEABLE); other values throw.' },\n format: textFormatSchema,\n mode: textModeSchema,\n style: { type: 'string' },\n text: { const: '\\t', description: 'Always a single tab character.' },\n version: versionSchema,\n },\n required: ['detail', 'format', 'mode', 'style', 'text', 'type', 'version'],\n tsType: 'SerializedTabNode',\n }\n}\n\nexport const lineBreakNodeJSONSchema: JSONSchemaFn = ({ typeStringDefinitions }) => {\n typeStringDefinitions.add(SERIALIZED_LINE_BREAK_NODE_TS)\n return {\n type: 'object',\n additionalProperties: false,\n properties: {\n type: { type: 'string', const: 'linebreak' },\n version: versionSchema,\n },\n required: ['type', 'version'],\n tsType: 'SerializedLineBreakNode',\n }\n}\n\nexport const paragraphNodeJSONSchema: JSONSchemaFn = ({\n elementNodeSchema,\n nodeUnionName,\n typeStringDefinitions,\n}) => {\n typeStringDefinitions.add(SERIALIZED_PARAGRAPH_NODE_TS)\n return elementNodeSchema({\n nodeType: 'paragraph',\n properties: {\n textFormat: { type: 'integer' },\n textStyle: { type: 'string' },\n },\n required: ['textFormat', 'textStyle'],\n tsType: `SerializedParagraphNode<${nodeUnionName}>`,\n })\n}\n\n/** MUST stay byte-for-byte in sync with `LexicalRichText` in `types/nodeTypes.ts`. */\nconst ROOT_NODE_TS = `/** Shape of a Lexical \\`richText\\` field. */\nexport interface LexicalRichText<TNode> {\n root: {\n children: TNode[];\n direction: LexicalElementDirection;\n format: LexicalElementFormat;\n indent: number;\n type: 'root';\n version: number;\n };\n}`\n\nexport const rootNodeJSONSchema: JSONSchemaFn = ({\n elementNodeSchema,\n field,\n nodeUnionName,\n typeStringDefinitions,\n}) => {\n typeStringDefinitions.add(ROOT_NODE_TS)\n return {\n type: withNullableJSONSchemaType('object', !!field.required),\n additionalProperties: false,\n properties: {\n root: elementNodeSchema({\n nodeType: 'root',\n }),\n },\n required: ['root'],\n tsType: field.required\n ? `LexicalRichText<${nodeUnionName}>`\n : `LexicalRichText<${nodeUnionName}> | null`,\n }\n}\n"],"mappings":"AAEA,SAASA,0BAA0B,QAAQ;AAI3C,SAASC,aAAa,QAAQ;AAE9B;;;;;;AAMA,OAAO,MAAMC,wBAAA,GAA2B;;;;;;;;;;;;EAYtC;AAEF;;;;;GAAA,CAOA;AACA,MAAMC,oBAAA,GAAuB,iEAAiE;AAE9F;AACA,MAAMC,uBAAA,GAA0B;;;;;;;;EAQ9B;AAEF;AACA,MAAMC,sBAAA,GA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B,OAAO;IACL1B,IAAA,EAAMT,0BAAA,CAA2B,UAAU,CAAC,CAACqC,KAAA,CAAMX,QAAQ;IAC3DT,oBAAA,EAAsB;IACtBC,UAAA,EAAY;MACVoB,IAAA,EAAMR,iBAAA,CAAkB;QACtBE,QAAA,EAAU;MACZ;IACF;IACAN,QAAA,EAAU,CAAC,OAAO;IAClBf,MAAA,EAAQ0B,KAAA,CAAMX,QAAQ,GAClB,mBAAmBK,aAAA,GAAgB,GACnC,mBAAmBA,aAAA;EACzB;AACF","ignoreList":[]}
@@ -313,26 +313,26 @@ export type LexicalEditorNodeMap<TNodes extends SerializedNodeBase = DefaultNode
313
313
  }>>;
314
314
  } & {
315
315
  blocks?: {
316
- [K in Extract<Extract<TNodes, {
316
+ [K in (Extract<TNodes, {
317
317
  type: 'block';
318
- }> extends SerializedBlockNode<infer B> ? B extends {
319
- blockType: string;
320
- } ? B['blockType'] : never : never, string>]?: NodeMapBlockValue<Extract<TNodes, {
318
+ }> & SerializedBlockNode)['fields']['blockType']]?: NodeMapBlockValue<Extract<Extract<TNodes, {
321
319
  type: 'block';
322
- }> extends SerializedBlockNode<infer B> ? SerializedBlockNode<Extract<B, {
323
- blockType: K;
324
- }>> : SerializedBlockNode>;
320
+ }> & SerializedBlockNode, {
321
+ fields: {
322
+ blockType: K;
323
+ };
324
+ }>>;
325
325
  };
326
326
  inlineBlocks?: {
327
- [K in Extract<Extract<TNodes, {
327
+ [K in (Extract<TNodes, {
328
328
  type: 'inlineBlock';
329
- }> extends SerializedInlineBlockNode<infer B> ? B extends {
330
- blockType: string;
331
- } ? B['blockType'] : never : never, string>]?: NodeMapInlineBlockValue<Extract<TNodes, {
329
+ }> & SerializedInlineBlockNode)['fields']['blockType']]?: NodeMapInlineBlockValue<Extract<Extract<TNodes, {
332
330
  type: 'inlineBlock';
333
- }> extends SerializedInlineBlockNode<infer B> ? SerializedInlineBlockNode<Extract<B, {
334
- blockType: K;
335
- }>> : SerializedInlineBlockNode>;
331
+ }> & SerializedInlineBlockNode, {
332
+ fields: {
333
+ blockType: K;
334
+ };
335
+ }>>;
336
336
  };
337
337
  unknown?: NodeMapValue<SerializedLexicalNode>;
338
338
  };
@@ -434,8 +434,8 @@ export type LexicalRichTextFieldProps = {
434
434
  */
435
435
  featureClientImportMap?: Record<string, any>;
436
436
  featureClientSchemaMap: FeatureClientSchemaMap;
437
- initialLexicalFormState: InitialLexicalFormState;
438
- lexicalEditorConfig: LexicalEditorConfig | undefined;
437
+ initialLexicalFormState?: InitialLexicalFormState;
438
+ lexicalEditorConfig?: LexicalEditorConfig;
439
439
  views?: LexicalEditorViewMap;
440
440
  } & Pick<ServerFieldBase, 'permissions'> & RichTextFieldClientProps<SerializedEditorState, AdapterProps, object>;
441
441
  export type LexicalRichTextCellProps = DefaultServerCellComponentProps<RichTextFieldClient<SerializedEditorState, AdapterProps, object>, SerializedEditorState>;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,aAAa,EACb,YAAY,EACZ,aAAa,EACb,YAAY,IAAI,mBAAmB,EACnC,WAAW,EACX,qBAAqB,EACrB,qBAAqB,EACtB,MAAM,SAAS,CAAA;AAChB,OAAO,KAAK,EACV,WAAW,EACX,+BAA+B,EAC/B,aAAa,EACb,gBAAgB,EAChB,eAAe,EACf,aAAa,EACb,mBAAmB,EACnB,wBAAwB,EACxB,eAAe,EACf,eAAe,EACf,WAAW,EACZ,MAAM,SAAS,CAAA;AAEhB,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,qDAAqD,CAAA;AACpG,YAAY,EAAE,yBAAyB,EAAE,CAAA;AACzC,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,8CAA8C,CAAA;AACvF,OAAO,KAAK,EAAE,+BAA+B,EAAE,MAAM,oDAAoD,CAAA;AACzG,OAAO,KAAK,EACV,gBAAgB,EAChB,aAAa,EACb,+BAA+B,EAChC,MAAM,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A;IAEpC,cAAc,EAAE,iBAAiB,CAAA;IACjC;;;OAGG;IACH,sBAAsB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;IAC5C,sBAAsB,EAAE,sBAAsB,CAAA;IAC9C,uBAAuB,CAAC,EAAE,uBAAuB,CAAA;IACjD,mBAAmB,CAAC,EAAE,mBAAmB,CAAA;IACzC,KAAK,CAAC,EAAE,oBAAoB,CAAA;CAC7B,GAAG,IAAI,CAAC,eAAe,EAAE,aAAa,CAAC,GACtC,wBAAwB,CAAC,qBAAqB,EAAE,YAAY,EAAE,MAAM,CAAC,CAAA;AAEvE,MAAM,MAAM,wBAAwB,GAAG,+BAA+B,CACpE,mBAAmB,CAAC,qBAAqB,EAAE,YAAY,EAAE,MAAM,CAAC,EAChE,qBAAqB,CACtB,CAAA;AAED,MAAM,MAAM,YAAY,GAAG;IACzB,YAAY,EAAE,2BAA2B,CAAA;CAC1C,CAAA;AAED,MAAM,MAAM,iCAAiC,GAAG;IAC9C,aAAa,EAAE,6BAA6B,CAAC,GAAG,EAAE,GAAG,CAAC,CAAA;IACtD,kBAAkB,EAAE,sBAAsB,CAAC,MAAM,CAAC,CAAA;CACnD,CAAA;AAED,MAAM,MAAM,oBAAoB,GAAG,aAAa,CAAC,qBAAqB,EAAE,YAAY,CAAC,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":[],"sources":["../../src/types/index.ts"],"sourcesContent":["import type {\n DecoratorNode,\n EditorConfig,\n LexicalEditor,\n EditorConfig as LexicalEditorConfig,\n LexicalNode,\n SerializedEditorState,\n SerializedLexicalNode,\n} from 'lexical'\nimport type {\n ClientField,\n DefaultServerCellComponentProps,\n LabelFunction,\n PayloadComponent,\n RichTextAdapter,\n RichTextField,\n RichTextFieldClient,\n RichTextFieldClientProps,\n SanitizedConfig,\n ServerFieldBase,\n StaticLabel,\n} from 'payload'\n\nimport type { BlockComponentContextType } from '../features/blocks/client/component/BlockContent.js'\nexport type { BlockComponentContextType }\nimport type { BlockComponentProps } from '../features/blocks/client/component/index.js'\nimport type { InlineBlockComponentContextType } from '../features/blocks/client/componentInline/index.js'\nimport type {\n JSXConverterArgs,\n JSXConverters,\n SerializedLexicalNodeWithParent,\n} from '../features/converters/lexicalToJSX/converter/types.js'\nimport type {\n BaseClientFeatureProps,\n FeatureProviderProviderClient,\n} from '../features/typesClient.js'\nimport type { FeatureProviderServer } from '../features/typesServer.js'\nimport type { SanitizedServerEditorConfig } from '../lexical/config/types.js'\nimport type { InitialLexicalFormState } from '../utilities/buildInitialState.js'\nimport type {\n DefaultNodeTypes,\n SerializedBlockNode,\n SerializedInlineBlockNode,\n} from './nodeTypes.js'\n\n/**\n * Base constraint for serialized Lexical node types.\n * Used as the generic constraint for node map types.\n * Extends the base SerializedLexicalNode with optional type for flexibility.\n */\nexport type SerializedNodeBase = { type?: string }\n\nexport type LexicalFieldAdminProps = {\n /**\n * Controls if the add block button should be hidden. @default false\n */\n hideAddBlockButton?: boolean\n /**\n * Controls if the draggable block element should be hidden. @default false\n */\n hideDraggableBlockElement?: boolean\n /**\n * Controls if the gutter (padding to the left & gray vertical line) should be hidden. @default false\n */\n hideGutter?: boolean\n /**\n * Controls if the insert paragraph at the end button should be hidden. @default false\n */\n hideInsertParagraphAtEnd?: boolean\n /**\n * Changes the placeholder text in the editor if no content is present.\n */\n placeholder?: LabelFunction | StaticLabel\n}\n\nexport type LexicalFieldAdminClientProps = {\n placeholder?: string\n} & Omit<LexicalFieldAdminProps, 'placeholder'>\n\nexport type FeaturesInput =\n | (({\n defaultFeatures,\n rootFeatures,\n }: {\n /**\n * This opinionated array contains all \"recommended\" default features.\n *\n * @Example\n *\n * ```ts\n * editor: lexicalEditor({\n * features: ({ defaultFeatures }) => [...defaultFeatures, FixedToolbarFeature()],\n * })\n * ```\n */\n defaultFeatures: FeatureProviderServer<any, any, any>[]\n /**\n * This array contains all features that are enabled in the root richText editor (the one defined in the payload.config.ts).\n * If this field is the root richText editor, or if the root richText editor is not a lexical editor, this array will be empty.\n *\n * @Example\n *\n * ```ts\n * editor: lexicalEditor({\n * features: ({ rootFeatures }) => [...rootFeatures, FixedToolbarFeature()],\n * })\n * ```\n */\n rootFeatures: FeatureProviderServer<any, any, any>[]\n }) => FeatureProviderServer<any, any, any>[])\n | FeatureProviderServer<any, any, any>[]\n\ntype WithinEditorArgs = {\n config: EditorConfig\n editor: LexicalEditor\n node: LexicalNode\n}\n\n/**\n *\n * @experimental - This API is experimental and may change in a minor release.\n * @internal\n */\nexport type NodeMapValue<TNode extends SerializedNodeBase = SerializedLexicalNode> = {\n /**\n * Provide a react component to render the node.\n *\n * **JSX Converter:** Always works. Takes priority over `html`.\n *\n * **Lexical Editor:** Only works for DecoratorNodes (renders in `decorate` method). Takes priority over `html` and `createDOM`.\n */\n Component?: (\n args:\n | ({\n isEditor: false\n isJSXConverter: true\n } & JSXConverterArgs<TNode>)\n | ({\n isEditor: true\n isJSXConverter: false\n node: {\n _originalDecorate?: (editor: LexicalEditor, config: EditorConfig) => React.ReactNode\n } & DecoratorNode<React.ReactNode>\n } & Omit<WithinEditorArgs, 'node'>),\n ) => React.ReactNode\n /**\n * Provide a function to create the DOM element for the node.\n *\n * **JSX Converter:** Not used (only `Component` and `html` work).\n *\n * **Lexical Editor:** Always works (renders in `createDOM` method).\n * - For ElementNodes: This is the standard way to customize rendering.\n * - For DecoratorNodes: When combined with `html`, the DOM gets custom structure while `decorate` renders the `html` content.\n */\n createDOM?: (args: WithinEditorArgs) => HTMLElement\n /**\n * Provide HTML string or function to render the node.\n *\n * **JSX Converter:** Always works (ignored if `Component` is provided).\n *\n * **Lexical Editor behavior depends on node type:**\n *\n * - **ElementNodes:** `html` is used in `createDOM` to generate the DOM structure.\n *\n * - **DecoratorNodes (have both `createDOM` and `decorate`):**\n * - If only `html` is provided: `createDOM` uses `html` to create DOM, `decorate` returns `null`\n * - If `html` + `Component`: `createDOM` uses `html`, `decorate` uses `Component`\n * - If `html` + `createDOM`: Custom `createDOM` creates structure, `decorate` renders `html` content\n * - If `html` + `Component` + `createDOM`: Custom `createDOM` creates structure, `decorate` uses `Component` (html ignored in editor)\n */\n html?: (\n args:\n | ({\n isEditor: false\n isJSXConverter: true\n } & JSXConverterArgs<TNode>)\n | ({\n isEditor: true\n isJSXConverter: false\n } & WithinEditorArgs),\n ) => string\n}\n\ntype SharedViewMapBlockEditorProps<TNode extends SerializedBlockNode | SerializedInlineBlockNode> =\n {\n /**\n * True when rendering in the admin editor.\n */\n isEditor: true\n /**\n * False when rendering in the admin editor.\n */\n isJSXConverter: false\n } & Pick<BlockComponentProps<TNode['fields']>, 'className' | 'formData' | 'nodeKey'>\n\n/**\n * Props passed to a custom Block component in editor mode.\n * Use `isEditor` to discriminate between editor and JSX converter modes.\n *\n * @experimental - This API is experimental and may change in a minor release.\n */\nexport type ViewMapBlockEditorProps<TNode extends SerializedBlockNode> = {\n /**\n * Hook to access block UI components (BlockCollapsible, EditButton, etc.).\n * Call this inside your component to get the context values.\n * Passed as a prop so you don't need to import from @payloadcms/richtext-lexical/client.\n */\n useBlockComponentContext: () => BlockComponentContextType\n} & SharedViewMapBlockEditorProps<TNode>\n\n/**\n * Props passed to a custom Block component in editor mode.\n * Use `isEditor` to discriminate between editor and JSX converter modes.\n *\n * @experimental - This API is experimental and may change in a minor release.\n */\nexport type ViewMapInlineBlockEditorProps<TNode extends SerializedInlineBlockNode> = {\n useInlineBlockComponentContext: () => InlineBlockComponentContextType\n} & SharedViewMapBlockEditorProps<TNode>\n\n/**\n * Props passed to a custom Block component in JSX converter mode (frontend).\n * Use `isEditor` to discriminate between editor and JSX converter modes.\n *\n * @experimental - This API is experimental and may change in a minor release.\n */\nexport type ViewMapBlockJSXConverterProps<\n TNode extends SerializedBlockNode | SerializedInlineBlockNode =\n | SerializedBlockNode\n | SerializedInlineBlockNode,\n> = {\n /**\n * Index of this node among its siblings.\n */\n childIndex: number\n /**\n * Available JSX converters for nested content.\n */\n converters: JSXConverters\n /**\n * The block's form data (field values).\n */\n formData: TNode['fields']\n /**\n * False when rendering via JSX converter (frontend).\n */\n isEditor: false\n /**\n * True when rendering via JSX converter (frontend).\n */\n isJSXConverter: true\n /**\n * The serialized block node.\n */\n node: TNode\n /**\n * Function to convert child nodes to JSX.\n */\n nodesToJSX: (args: {\n converters?: JSXConverters\n disableIndent?: boolean | string[]\n disableTextAlign?: boolean | string[]\n nodes: SerializedLexicalNode[]\n parent?: SerializedLexicalNodeWithParent\n }) => React.ReactNode[]\n /**\n * The parent node in the tree.\n */\n parent: SerializedLexicalNodeWithParent\n}\n\n/**\n * Props passed to a custom Block component in a view map.\n * This is a discriminated union - use `isEditor` to narrow the type.\n *\n * When `isEditor` is true, you're in the admin editor with access to `blockContext`.\n * When `isEditor` is false, you're in the frontend JSX converter with `nodesToJSX`.\n *\n * @example\n * ```tsx\n * const MyBlock: React.FC<ViewMapBlockComponentProps> = (props) => {\n * if (props.isEditor) {\n * // Admin editor - blockContext available\n * const { BlockCollapsible, EditButton } = props.blockContext\n * return <BlockCollapsible>{props.formData.title}</BlockCollapsible>\n * }\n * // Frontend - readonly render\n * return <div>{props.formData.title}</div>\n * }\n * ```\n *\n * @experimental - This API is experimental and may change in a minor release.\n */\nexport type ViewMapBlockComponentProps<TNode extends SerializedBlockNode = SerializedBlockNode> =\n | ViewMapBlockEditorProps<TNode>\n | ViewMapBlockJSXConverterProps<TNode>\n\nexport type ViewMapInlineBlockComponentProps<\n TNode extends SerializedInlineBlockNode = SerializedInlineBlockNode,\n> = ViewMapBlockJSXConverterProps<TNode> | ViewMapInlineBlockEditorProps<TNode>\n\n/**\n *\n * @experimental - This API is experimental and may change in a minor release.\n * @internal\n */\nexport type NodeMapBlockValue<TNode extends SerializedBlockNode = SerializedBlockNode> = {\n /**\n * A React component that replaces the entire block, including the header/collapsible.\n * Works for both admin editor and frontend JSX conversion.\n *\n * Use `isEditor` to discriminate between modes:\n * - Editor mode: `blockContext` is available with UI components (BlockCollapsible, EditButton, etc.)\n * - JSX converter mode: `nodesToJSX` is available for rendering nested content\n *\n * @example\n * ```tsx\n * Block: (props) => {\n * if (props.isEditor) {\n * const { BlockCollapsible } = props.blockContext\n * return <BlockCollapsible>{props.formData.title}</BlockCollapsible>\n * }\n * return <div>{props.formData.title}</div>\n * }\n * ```\n */\n Block?: React.FC<ViewMapBlockComponentProps<TNode>>\n /**\n * A React component that replaces the block label.\n * Use `useBlockComponentContext()` hook to access block context.\n */\n Label?: React.FC<ViewMapBlockComponentProps<TNode>>\n} & Pick<NodeMapValue<TNode>, 'Component' | 'createDOM' | 'html'>\n\nexport type NodeMapInlineBlockValue<\n TNode extends SerializedInlineBlockNode = SerializedInlineBlockNode,\n> = {\n /**\n * A React component that replaces the entire block, including the header/collapsible.\n * Works for both admin editor and frontend JSX conversion.\n *\n * Use `isEditor` to discriminate between modes:\n * - Editor mode: `blockContext` is available with UI components (BlockCollapsible, EditButton, etc.)\n * - JSX converter mode: `nodesToJSX` is available for rendering nested content\n *\n * @example\n * ```tsx\n * InlineBlock: (props) => {\n * if (props.isEditor) {\n * const { BlockCollapsible } = props.blockContext\n * return <BlockCollapsible>{props.formData.title}</BlockCollapsible>\n * }\n * return <div>{props.formData.title}</div>\n * }\n * ```\n */\n Block?: React.FC<ViewMapInlineBlockComponentProps<TNode>>\n /**\n * A React component that replaces the block label.\n * Use `useBlockComponentContext()` hook to access block context.\n */\n Label?: React.FC<ViewMapInlineBlockComponentProps<TNode>>\n} & Pick<NodeMapValue<TNode>, 'Component' | 'createDOM' | 'html'>\n\n/**\n * @experimental - This API is experimental and may change in a minor release.\n * @internal\n */\nexport type LexicalEditorNodeMap<\n TNodes extends SerializedNodeBase =\n | DefaultNodeTypes\n | SerializedBlockNode<{ blockName?: null | string; blockType: string }> // need these to ensure types for blocks and inlineBlocks work if no generics are provided\n | SerializedInlineBlockNode<{ blockName?: null | string; blockType: string }>, // need these to ensure types for blocks and inlineBlocks work if no generics are provided\n> = {\n // The index signature must include NodeMapBlockValue in the nested blockSlug mapping because\n // 'blocks' and 'inlineBlocks' properties use NodeMapBlockValue (which adds Block/Label props).\n // TypeScript requires that intersection properties be assignable to index signatures.\n [key: string]:\n | {\n [blockSlug: string]: NodeMapBlockValue<any> | NodeMapInlineBlockValue<any>\n }\n | NodeMapValue<any>\n | undefined\n} & {\n [nodeType in Exclude<NonNullable<TNodes['type']>, 'block' | 'inlineBlock'>]?: NodeMapValue<\n Extract<TNodes, { type: nodeType }>\n >\n} & {\n blocks?: {\n [K in Extract<\n Extract<TNodes, { type: 'block' }> extends SerializedBlockNode<infer B>\n ? B extends { blockType: string }\n ? B['blockType']\n : never\n : never,\n string\n >]?: NodeMapBlockValue<\n Extract<TNodes, { type: 'block' }> extends SerializedBlockNode<infer B>\n ? SerializedBlockNode<Extract<B, { blockType: K }>>\n : SerializedBlockNode\n >\n }\n inlineBlocks?: {\n [K in Extract<\n Extract<TNodes, { type: 'inlineBlock' }> extends SerializedInlineBlockNode<infer B>\n ? B extends { blockType: string }\n ? B['blockType']\n : never\n : never,\n string\n >]?: NodeMapInlineBlockValue<\n Extract<TNodes, { type: 'inlineBlock' }> extends SerializedInlineBlockNode<infer B>\n ? SerializedInlineBlockNode<Extract<B, { blockType: K }>>\n : SerializedInlineBlockNode\n >\n }\n unknown?: NodeMapValue<SerializedLexicalNode>\n}\n\n/**\n * A map of views, which can be used to render the editor in different ways.\n *\n * In order to override the default view, you can add a `default` key to the map.\n *\n * @experimental - This API is experimental and may change in a minor release.\n * @internal\n */\nexport type ClientFeaturesMap = {\n [featureKey: string]: {\n clientFeatureProps?: BaseClientFeatureProps<Record<string, any>>\n clientFeatureProvider?: FeatureProviderProviderClient<any, any>\n }\n}\n\nexport type LexicalEditorViewMap<\n TNodes extends SerializedNodeBase =\n | DefaultNodeTypes\n | SerializedBlockNode<{ blockName?: null | string; blockType: string }> // need these to ensure types for blocks and inlineBlocks work if no generics are provided\n | SerializedInlineBlockNode<{ blockName?: null | string; blockType: string }>, // need these to ensure types for blocks and inlineBlocks work if no generics are provided\n> = {\n [viewKey: string]: {\n admin?: LexicalFieldAdminClientProps\n /**\n * Transform the client features for this view.\n * Receives the full clientFeatures map and should return a (potentially modified) map.\n * Can be used to remove features or add new ones per-view.\n *\n * @example Remove toolbars\n * ```ts\n * filterFeatures: (features) => {\n * const { toolbarFixed, toolbarInline, ...rest } = features\n * return rest\n * }\n * ```\n */\n filterFeatures?: (clientFeatures: ClientFeaturesMap) => ClientFeaturesMap\n /**\n * Lexical editor configuration. Can be an object or a function that receives the default config.\n * Using a function avoids needing to import defaultEditorLexicalConfig.\n *\n * @example\n * ```ts\n * lexical: (defaultConfig) => ({\n * ...defaultConfig,\n * theme: { ...defaultConfig.theme, paragraph: 'my-paragraph' },\n * })\n * ```\n */\n lexical?: ((defaultConfig: LexicalEditorConfig) => LexicalEditorConfig) | LexicalEditorConfig\n nodes: LexicalEditorNodeMap<TNodes>\n }\n}\n\n/**\n * @todo rename to LexicalEditorArgs in 4.0, since these are arguments for the lexicalEditor function\n */\nexport type LexicalEditorProps = {\n admin?: LexicalFieldAdminProps\n features?: FeaturesInput\n lexical?: LexicalEditorConfig\n /**\n * A path to a LexicalEditorViewMap, which can be used to render the editor in different ways.\n *\n * In order to override the default view, you can add a `default` key to the map.\n *\n * @experimental - This API is experimental and may change in a minor release.\n * @internal\n */\n views?: PayloadComponent\n}\n\nexport type LexicalRichTextAdapter = {\n editorConfig: SanitizedServerEditorConfig\n features: FeatureProviderServer<any, any, any>[]\n} & RichTextAdapter<SerializedEditorState, AdapterProps>\n\nexport type LexicalRichTextAdapterProvider =\n /**\n * This is being called during the payload sanitization process\n */\n ({\n config,\n isRoot,\n parentIsLocalized,\n }: {\n config: SanitizedConfig\n isRoot?: boolean\n parentIsLocalized: boolean\n }) => Promise<LexicalRichTextAdapter>\n\nexport type SingleFeatureClientSchemaMap = {\n [key: string]: ClientField[]\n}\nexport type FeatureClientSchemaMap = {\n [featureKey: string]: SingleFeatureClientSchemaMap\n}\n\nexport type LexicalRichTextFieldProps = {\n admin?: LexicalFieldAdminClientProps\n // clientFeatures is added through the rsc field\n clientFeatures: ClientFeaturesMap\n /**\n * Part of the import map that contains client components for all lexical features of this field that\n * have been added through `feature.componentImports`.\n */\n featureClientImportMap?: Record<string, any>\n featureClientSchemaMap: FeatureClientSchemaMap\n initialLexicalFormState: InitialLexicalFormState\n lexicalEditorConfig: LexicalEditorConfig | undefined // Undefined if default lexical editor config should be used\n views?: LexicalEditorViewMap\n} & Pick<ServerFieldBase, 'permissions'> &\n RichTextFieldClientProps<SerializedEditorState, AdapterProps, object>\n\nexport type LexicalRichTextCellProps = DefaultServerCellComponentProps<\n RichTextFieldClient<SerializedEditorState, AdapterProps, object>,\n SerializedEditorState\n>\n\nexport type AdapterProps = {\n editorConfig: SanitizedServerEditorConfig\n}\n\nexport type GeneratedFeatureProviderComponent = {\n clientFeature: FeatureProviderProviderClient<any, any>\n clientFeatureProps: BaseClientFeatureProps<object>\n}\n\nexport type LexicalRichTextField = RichTextField<SerializedEditorState, AdapterProps>\n"],"mappings":"AAmiBA","ignoreList":[]}
1
+ {"version":3,"file":"index.js","names":[],"sources":["../../src/types/index.ts"],"sourcesContent":["import type {\n DecoratorNode,\n EditorConfig,\n LexicalEditor,\n EditorConfig as LexicalEditorConfig,\n LexicalNode,\n SerializedEditorState,\n SerializedLexicalNode,\n} from 'lexical'\nimport type {\n ClientField,\n DefaultServerCellComponentProps,\n LabelFunction,\n PayloadComponent,\n RichTextAdapter,\n RichTextField,\n RichTextFieldClient,\n RichTextFieldClientProps,\n SanitizedConfig,\n ServerFieldBase,\n StaticLabel,\n} from 'payload'\n\nimport type { BlockComponentContextType } from '../features/blocks/client/component/BlockContent.js'\nexport type { BlockComponentContextType }\nimport type { BlockComponentProps } from '../features/blocks/client/component/index.js'\nimport type { InlineBlockComponentContextType } from '../features/blocks/client/componentInline/index.js'\nimport type {\n JSXConverterArgs,\n JSXConverters,\n SerializedLexicalNodeWithParent,\n} from '../features/converters/lexicalToJSX/converter/types.js'\nimport type {\n BaseClientFeatureProps,\n FeatureProviderProviderClient,\n} from '../features/typesClient.js'\nimport type { FeatureProviderServer } from '../features/typesServer.js'\nimport type { SanitizedServerEditorConfig } from '../lexical/config/types.js'\nimport type { InitialLexicalFormState } from '../utilities/buildInitialState.js'\nimport type {\n DefaultNodeTypes,\n SerializedBlockNode,\n SerializedInlineBlockNode,\n} from './nodeTypes.js'\n\n/**\n * Base constraint for serialized Lexical node types.\n * Used as the generic constraint for node map types.\n * Extends the base SerializedLexicalNode with optional type for flexibility.\n */\nexport type SerializedNodeBase = { type?: string }\n\nexport type LexicalFieldAdminProps = {\n /**\n * Controls if the add block button should be hidden. @default false\n */\n hideAddBlockButton?: boolean\n /**\n * Controls if the draggable block element should be hidden. @default false\n */\n hideDraggableBlockElement?: boolean\n /**\n * Controls if the gutter (padding to the left & gray vertical line) should be hidden. @default false\n */\n hideGutter?: boolean\n /**\n * Controls if the insert paragraph at the end button should be hidden. @default false\n */\n hideInsertParagraphAtEnd?: boolean\n /**\n * Changes the placeholder text in the editor if no content is present.\n */\n placeholder?: LabelFunction | StaticLabel\n}\n\nexport type LexicalFieldAdminClientProps = {\n placeholder?: string\n} & Omit<LexicalFieldAdminProps, 'placeholder'>\n\nexport type FeaturesInput =\n | (({\n defaultFeatures,\n rootFeatures,\n }: {\n /**\n * This opinionated array contains all \"recommended\" default features.\n *\n * @Example\n *\n * ```ts\n * editor: lexicalEditor({\n * features: ({ defaultFeatures }) => [...defaultFeatures, FixedToolbarFeature()],\n * })\n * ```\n */\n defaultFeatures: FeatureProviderServer<any, any, any>[]\n /**\n * This array contains all features that are enabled in the root richText editor (the one defined in the payload.config.ts).\n * If this field is the root richText editor, or if the root richText editor is not a lexical editor, this array will be empty.\n *\n * @Example\n *\n * ```ts\n * editor: lexicalEditor({\n * features: ({ rootFeatures }) => [...rootFeatures, FixedToolbarFeature()],\n * })\n * ```\n */\n rootFeatures: FeatureProviderServer<any, any, any>[]\n }) => FeatureProviderServer<any, any, any>[])\n | FeatureProviderServer<any, any, any>[]\n\ntype WithinEditorArgs = {\n config: EditorConfig\n editor: LexicalEditor\n node: LexicalNode\n}\n\n/**\n *\n * @experimental - This API is experimental and may change in a minor release.\n * @internal\n */\nexport type NodeMapValue<TNode extends SerializedNodeBase = SerializedLexicalNode> = {\n /**\n * Provide a react component to render the node.\n *\n * **JSX Converter:** Always works. Takes priority over `html`.\n *\n * **Lexical Editor:** Only works for DecoratorNodes (renders in `decorate` method). Takes priority over `html` and `createDOM`.\n */\n Component?: (\n args:\n | ({\n isEditor: false\n isJSXConverter: true\n } & JSXConverterArgs<TNode>)\n | ({\n isEditor: true\n isJSXConverter: false\n node: {\n _originalDecorate?: (editor: LexicalEditor, config: EditorConfig) => React.ReactNode\n } & DecoratorNode<React.ReactNode>\n } & Omit<WithinEditorArgs, 'node'>),\n ) => React.ReactNode\n /**\n * Provide a function to create the DOM element for the node.\n *\n * **JSX Converter:** Not used (only `Component` and `html` work).\n *\n * **Lexical Editor:** Always works (renders in `createDOM` method).\n * - For ElementNodes: This is the standard way to customize rendering.\n * - For DecoratorNodes: When combined with `html`, the DOM gets custom structure while `decorate` renders the `html` content.\n */\n createDOM?: (args: WithinEditorArgs) => HTMLElement\n /**\n * Provide HTML string or function to render the node.\n *\n * **JSX Converter:** Always works (ignored if `Component` is provided).\n *\n * **Lexical Editor behavior depends on node type:**\n *\n * - **ElementNodes:** `html` is used in `createDOM` to generate the DOM structure.\n *\n * - **DecoratorNodes (have both `createDOM` and `decorate`):**\n * - If only `html` is provided: `createDOM` uses `html` to create DOM, `decorate` returns `null`\n * - If `html` + `Component`: `createDOM` uses `html`, `decorate` uses `Component`\n * - If `html` + `createDOM`: Custom `createDOM` creates structure, `decorate` renders `html` content\n * - If `html` + `Component` + `createDOM`: Custom `createDOM` creates structure, `decorate` uses `Component` (html ignored in editor)\n */\n html?: (\n args:\n | ({\n isEditor: false\n isJSXConverter: true\n } & JSXConverterArgs<TNode>)\n | ({\n isEditor: true\n isJSXConverter: false\n } & WithinEditorArgs),\n ) => string\n}\n\ntype SharedViewMapBlockEditorProps<TNode extends SerializedBlockNode | SerializedInlineBlockNode> =\n {\n /**\n * True when rendering in the admin editor.\n */\n isEditor: true\n /**\n * False when rendering in the admin editor.\n */\n isJSXConverter: false\n } & Pick<BlockComponentProps<TNode['fields']>, 'className' | 'formData' | 'nodeKey'>\n\n/**\n * Props passed to a custom Block component in editor mode.\n * Use `isEditor` to discriminate between editor and JSX converter modes.\n *\n * @experimental - This API is experimental and may change in a minor release.\n */\nexport type ViewMapBlockEditorProps<TNode extends SerializedBlockNode> = {\n /**\n * Hook to access block UI components (BlockCollapsible, EditButton, etc.).\n * Call this inside your component to get the context values.\n * Passed as a prop so you don't need to import from @payloadcms/richtext-lexical/client.\n */\n useBlockComponentContext: () => BlockComponentContextType\n} & SharedViewMapBlockEditorProps<TNode>\n\n/**\n * Props passed to a custom Block component in editor mode.\n * Use `isEditor` to discriminate between editor and JSX converter modes.\n *\n * @experimental - This API is experimental and may change in a minor release.\n */\nexport type ViewMapInlineBlockEditorProps<TNode extends SerializedInlineBlockNode> = {\n useInlineBlockComponentContext: () => InlineBlockComponentContextType\n} & SharedViewMapBlockEditorProps<TNode>\n\n/**\n * Props passed to a custom Block component in JSX converter mode (frontend).\n * Use `isEditor` to discriminate between editor and JSX converter modes.\n *\n * @experimental - This API is experimental and may change in a minor release.\n */\nexport type ViewMapBlockJSXConverterProps<\n TNode extends SerializedBlockNode | SerializedInlineBlockNode =\n | SerializedBlockNode\n | SerializedInlineBlockNode,\n> = {\n /**\n * Index of this node among its siblings.\n */\n childIndex: number\n /**\n * Available JSX converters for nested content.\n */\n converters: JSXConverters\n /**\n * The block's form data (field values).\n */\n formData: TNode['fields']\n /**\n * False when rendering via JSX converter (frontend).\n */\n isEditor: false\n /**\n * True when rendering via JSX converter (frontend).\n */\n isJSXConverter: true\n /**\n * The serialized block node.\n */\n node: TNode\n /**\n * Function to convert child nodes to JSX.\n */\n nodesToJSX: (args: {\n converters?: JSXConverters\n disableIndent?: boolean | string[]\n disableTextAlign?: boolean | string[]\n nodes: SerializedLexicalNode[]\n parent?: SerializedLexicalNodeWithParent\n }) => React.ReactNode[]\n /**\n * The parent node in the tree.\n */\n parent: SerializedLexicalNodeWithParent\n}\n\n/**\n * Props passed to a custom Block component in a view map.\n * This is a discriminated union - use `isEditor` to narrow the type.\n *\n * When `isEditor` is true, you're in the admin editor with access to `blockContext`.\n * When `isEditor` is false, you're in the frontend JSX converter with `nodesToJSX`.\n *\n * @example\n * ```tsx\n * const MyBlock: React.FC<ViewMapBlockComponentProps> = (props) => {\n * if (props.isEditor) {\n * // Admin editor - blockContext available\n * const { BlockCollapsible, EditButton } = props.blockContext\n * return <BlockCollapsible>{props.formData.title}</BlockCollapsible>\n * }\n * // Frontend - readonly render\n * return <div>{props.formData.title}</div>\n * }\n * ```\n *\n * @experimental - This API is experimental and may change in a minor release.\n */\nexport type ViewMapBlockComponentProps<TNode extends SerializedBlockNode = SerializedBlockNode> =\n | ViewMapBlockEditorProps<TNode>\n | ViewMapBlockJSXConverterProps<TNode>\n\nexport type ViewMapInlineBlockComponentProps<\n TNode extends SerializedInlineBlockNode = SerializedInlineBlockNode,\n> = ViewMapBlockJSXConverterProps<TNode> | ViewMapInlineBlockEditorProps<TNode>\n\n/**\n *\n * @experimental - This API is experimental and may change in a minor release.\n * @internal\n */\nexport type NodeMapBlockValue<TNode extends SerializedBlockNode = SerializedBlockNode> = {\n /**\n * A React component that replaces the entire block, including the header/collapsible.\n * Works for both admin editor and frontend JSX conversion.\n *\n * Use `isEditor` to discriminate between modes:\n * - Editor mode: `blockContext` is available with UI components (BlockCollapsible, EditButton, etc.)\n * - JSX converter mode: `nodesToJSX` is available for rendering nested content\n *\n * @example\n * ```tsx\n * Block: (props) => {\n * if (props.isEditor) {\n * const { BlockCollapsible } = props.blockContext\n * return <BlockCollapsible>{props.formData.title}</BlockCollapsible>\n * }\n * return <div>{props.formData.title}</div>\n * }\n * ```\n */\n Block?: React.FC<ViewMapBlockComponentProps<TNode>>\n /**\n * A React component that replaces the block label.\n * Use `useBlockComponentContext()` hook to access block context.\n */\n Label?: React.FC<ViewMapBlockComponentProps<TNode>>\n} & Pick<NodeMapValue<TNode>, 'Component' | 'createDOM' | 'html'>\n\nexport type NodeMapInlineBlockValue<\n TNode extends SerializedInlineBlockNode = SerializedInlineBlockNode,\n> = {\n /**\n * A React component that replaces the entire block, including the header/collapsible.\n * Works for both admin editor and frontend JSX conversion.\n *\n * Use `isEditor` to discriminate between modes:\n * - Editor mode: `blockContext` is available with UI components (BlockCollapsible, EditButton, etc.)\n * - JSX converter mode: `nodesToJSX` is available for rendering nested content\n *\n * @example\n * ```tsx\n * InlineBlock: (props) => {\n * if (props.isEditor) {\n * const { BlockCollapsible } = props.blockContext\n * return <BlockCollapsible>{props.formData.title}</BlockCollapsible>\n * }\n * return <div>{props.formData.title}</div>\n * }\n * ```\n */\n Block?: React.FC<ViewMapInlineBlockComponentProps<TNode>>\n /**\n * A React component that replaces the block label.\n * Use `useBlockComponentContext()` hook to access block context.\n */\n Label?: React.FC<ViewMapInlineBlockComponentProps<TNode>>\n} & Pick<NodeMapValue<TNode>, 'Component' | 'createDOM' | 'html'>\n\n/**\n * @experimental - This API is experimental and may change in a minor release.\n * @internal\n */\nexport type LexicalEditorNodeMap<\n TNodes extends SerializedNodeBase =\n | DefaultNodeTypes\n | SerializedBlockNode<{ blockName?: null | string; blockType: string }> // need these to ensure types for blocks and inlineBlocks work if no generics are provided\n | SerializedInlineBlockNode<{ blockName?: null | string; blockType: string }>, // need these to ensure types for blocks and inlineBlocks work if no generics are provided\n> = {\n // The index signature must include NodeMapBlockValue in the nested blockSlug mapping because\n // 'blocks' and 'inlineBlocks' properties use NodeMapBlockValue (which adds Block/Label props).\n // TypeScript requires that intersection properties be assignable to index signatures.\n [key: string]:\n | {\n [blockSlug: string]: NodeMapBlockValue<any> | NodeMapInlineBlockValue<any>\n }\n | NodeMapValue<any>\n | undefined\n} & {\n [nodeType in Exclude<NonNullable<TNodes['type']>, 'block' | 'inlineBlock'>]?: NodeMapValue<\n Extract<TNodes, { type: nodeType }>\n >\n} & {\n blocks?: {\n [K in (Extract<TNodes, { type: 'block' }> & SerializedBlockNode)['fields']['blockType']]?: NodeMapBlockValue<\n Extract<Extract<TNodes, { type: 'block' }> & SerializedBlockNode, { fields: { blockType: K } }>\n >\n }\n inlineBlocks?: {\n [K in (Extract<TNodes, { type: 'inlineBlock' }> &\n SerializedInlineBlockNode)['fields']['blockType']]?: NodeMapInlineBlockValue<\n Extract<\n Extract<TNodes, { type: 'inlineBlock' }> & SerializedInlineBlockNode,\n { fields: { blockType: K } }\n >\n >\n }\n unknown?: NodeMapValue<SerializedLexicalNode>\n}\n\n/**\n * A map of views, which can be used to render the editor in different ways.\n *\n * In order to override the default view, you can add a `default` key to the map.\n *\n * @experimental - This API is experimental and may change in a minor release.\n * @internal\n */\nexport type ClientFeaturesMap = {\n [featureKey: string]: {\n clientFeatureProps?: BaseClientFeatureProps<Record<string, any>>\n clientFeatureProvider?: FeatureProviderProviderClient<any, any>\n }\n}\n\nexport type LexicalEditorViewMap<\n TNodes extends SerializedNodeBase =\n | DefaultNodeTypes\n | SerializedBlockNode<{ blockName?: null | string; blockType: string }> // need these to ensure types for blocks and inlineBlocks work if no generics are provided\n | SerializedInlineBlockNode<{ blockName?: null | string; blockType: string }>, // need these to ensure types for blocks and inlineBlocks work if no generics are provided\n> = {\n [viewKey: string]: {\n admin?: LexicalFieldAdminClientProps\n /**\n * Transform the client features for this view.\n * Receives the full clientFeatures map and should return a (potentially modified) map.\n * Can be used to remove features or add new ones per-view.\n *\n * @example Remove toolbars\n * ```ts\n * filterFeatures: (features) => {\n * const { toolbarFixed, toolbarInline, ...rest } = features\n * return rest\n * }\n * ```\n */\n filterFeatures?: (clientFeatures: ClientFeaturesMap) => ClientFeaturesMap\n /**\n * Lexical editor configuration. Can be an object or a function that receives the default config.\n * Using a function avoids needing to import defaultEditorLexicalConfig.\n *\n * @example\n * ```ts\n * lexical: (defaultConfig) => ({\n * ...defaultConfig,\n * theme: { ...defaultConfig.theme, paragraph: 'my-paragraph' },\n * })\n * ```\n */\n lexical?: ((defaultConfig: LexicalEditorConfig) => LexicalEditorConfig) | LexicalEditorConfig\n nodes: LexicalEditorNodeMap<TNodes>\n }\n}\n\n/**\n * @todo rename to LexicalEditorArgs in 4.0, since these are arguments for the lexicalEditor function\n */\nexport type LexicalEditorProps = {\n admin?: LexicalFieldAdminProps\n features?: FeaturesInput\n lexical?: LexicalEditorConfig\n /**\n * A path to a LexicalEditorViewMap, which can be used to render the editor in different ways.\n *\n * In order to override the default view, you can add a `default` key to the map.\n *\n * @experimental - This API is experimental and may change in a minor release.\n * @internal\n */\n views?: PayloadComponent\n}\n\nexport type LexicalRichTextAdapter = {\n editorConfig: SanitizedServerEditorConfig\n features: FeatureProviderServer<any, any, any>[]\n} & RichTextAdapter<SerializedEditorState, AdapterProps>\n\nexport type LexicalRichTextAdapterProvider =\n /**\n * This is being called during the payload sanitization process\n */\n ({\n config,\n isRoot,\n parentIsLocalized,\n }: {\n config: SanitizedConfig\n isRoot?: boolean\n parentIsLocalized: boolean\n }) => Promise<LexicalRichTextAdapter>\n\nexport type SingleFeatureClientSchemaMap = {\n [key: string]: ClientField[]\n}\nexport type FeatureClientSchemaMap = {\n [featureKey: string]: SingleFeatureClientSchemaMap\n}\n\nexport type LexicalRichTextFieldProps = {\n admin?: LexicalFieldAdminClientProps\n // clientFeatures is added through the rsc field\n clientFeatures: ClientFeaturesMap\n /**\n * Part of the import map that contains client components for all lexical features of this field that\n * have been added through `feature.componentImports`.\n */\n featureClientImportMap?: Record<string, any>\n featureClientSchemaMap: FeatureClientSchemaMap\n initialLexicalFormState?: InitialLexicalFormState\n lexicalEditorConfig?: LexicalEditorConfig // Undefined if default lexical editor config should be used\n views?: LexicalEditorViewMap\n} & Pick<ServerFieldBase, 'permissions'> &\n RichTextFieldClientProps<SerializedEditorState, AdapterProps, object>\n\nexport type LexicalRichTextCellProps = DefaultServerCellComponentProps<\n RichTextFieldClient<SerializedEditorState, AdapterProps, object>,\n SerializedEditorState\n>\n\nexport type AdapterProps = {\n editorConfig: SanitizedServerEditorConfig\n}\n\nexport type GeneratedFeatureProviderComponent = {\n clientFeature: FeatureProviderProviderClient<any, any>\n clientFeatureProps: BaseClientFeatureProps<object>\n}\n\nexport type LexicalRichTextField = RichTextField<SerializedEditorState, AdapterProps>\n"],"mappings":"AAqhBA","ignoreList":[]}