@payloadcms/richtext-lexical 3.61.0-internal.c252d14 → 3.61.0-internal.dd40839

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 (183) hide show
  1. package/dist/cell/rscEntry.d.ts +2 -10
  2. package/dist/cell/rscEntry.d.ts.map +1 -1
  3. package/dist/cell/rscEntry.js +1 -2
  4. package/dist/cell/rscEntry.js.map +1 -1
  5. package/dist/exports/client/Field-5VLZM7KJ.js +2 -0
  6. package/dist/exports/client/Field-5VLZM7KJ.js.map +7 -0
  7. package/dist/exports/client/RelationshipComponent-UCIWIEVD.js +2 -0
  8. package/dist/exports/client/RelationshipComponent-UCIWIEVD.js.map +7 -0
  9. package/dist/exports/client/bundled.css +1 -1
  10. package/dist/exports/client/chunk-52JG5GGJ.js +2 -0
  11. package/dist/exports/client/chunk-52JG5GGJ.js.map +7 -0
  12. package/dist/exports/client/chunk-U4AOQOHA.js +12 -0
  13. package/dist/exports/client/chunk-U4AOQOHA.js.map +7 -0
  14. package/dist/exports/client/component-5YLBQB5B.js +2 -0
  15. package/dist/exports/client/component-5YLBQB5B.js.map +7 -0
  16. package/dist/exports/client/componentInline-QEXUNJU4.js +2 -0
  17. package/dist/exports/client/index.js +22 -22
  18. package/dist/exports/client/index.js.map +3 -3
  19. package/dist/exports/react/index.d.ts +1 -1
  20. package/dist/exports/react/index.d.ts.map +1 -1
  21. package/dist/exports/react/index.js.map +1 -1
  22. package/dist/features/blocks/client/component/BlockContent.js +1 -1
  23. package/dist/features/blocks/client/component/BlockContent.js.map +1 -1
  24. package/dist/features/blocks/client/component/index.d.ts +1 -0
  25. package/dist/features/blocks/client/component/index.d.ts.map +1 -1
  26. package/dist/features/blocks/client/component/index.js +23 -20
  27. package/dist/features/blocks/client/component/index.js.map +1 -1
  28. package/dist/features/blocks/client/componentInline/index.d.ts +2 -1
  29. package/dist/features/blocks/client/componentInline/index.d.ts.map +1 -1
  30. package/dist/features/blocks/client/componentInline/index.js +6 -6
  31. package/dist/features/blocks/client/componentInline/index.js.map +1 -1
  32. package/dist/features/blocks/client/nodes/BlocksNode.d.ts +2 -2
  33. package/dist/features/blocks/client/nodes/BlocksNode.d.ts.map +1 -1
  34. package/dist/features/blocks/client/nodes/BlocksNode.js +5 -3
  35. package/dist/features/blocks/client/nodes/BlocksNode.js.map +1 -1
  36. package/dist/features/blocks/client/nodes/InlineBlocksNode.d.ts +2 -2
  37. package/dist/features/blocks/client/nodes/InlineBlocksNode.d.ts.map +1 -1
  38. package/dist/features/blocks/client/nodes/InlineBlocksNode.js +5 -3
  39. package/dist/features/blocks/client/nodes/InlineBlocksNode.js.map +1 -1
  40. package/dist/features/blocks/server/nodes/BlocksNode.d.ts +2 -1
  41. package/dist/features/blocks/server/nodes/BlocksNode.d.ts.map +1 -1
  42. package/dist/features/blocks/server/nodes/BlocksNode.js +9 -2
  43. package/dist/features/blocks/server/nodes/BlocksNode.js.map +1 -1
  44. package/dist/features/blocks/server/nodes/InlineBlocksNode.d.ts +1 -1
  45. package/dist/features/blocks/server/nodes/InlineBlocksNode.d.ts.map +1 -1
  46. package/dist/features/blocks/server/nodes/InlineBlocksNode.js +6 -5
  47. package/dist/features/blocks/server/nodes/InlineBlocksNode.js.map +1 -1
  48. package/dist/features/converters/lexicalToJSX/Component/index.d.ts +2 -14
  49. package/dist/features/converters/lexicalToJSX/Component/index.d.ts.map +1 -1
  50. package/dist/features/converters/lexicalToJSX/Component/index.js +4 -2
  51. package/dist/features/converters/lexicalToJSX/Component/index.js.map +1 -1
  52. package/dist/features/converters/lexicalToJSX/converter/index.d.ts +16 -1
  53. package/dist/features/converters/lexicalToJSX/converter/index.d.ts.map +1 -1
  54. package/dist/features/converters/lexicalToJSX/converter/index.js +76 -4
  55. package/dist/features/converters/lexicalToJSX/converter/index.js.map +1 -1
  56. package/dist/features/converters/lexicalToJSX/converter/types.d.ts +14 -10
  57. package/dist/features/converters/lexicalToJSX/converter/types.d.ts.map +1 -1
  58. package/dist/features/converters/lexicalToJSX/converter/types.js.map +1 -1
  59. package/dist/features/debug/jsxConverter/client/plugin/index.js +1 -1
  60. package/dist/features/debug/jsxConverter/client/plugin/index.js.map +1 -1
  61. package/dist/features/link/nodes/AutoLinkNode.js +1 -1
  62. package/dist/features/link/nodes/AutoLinkNode.js.map +1 -1
  63. package/dist/features/link/nodes/LinkNode.js +1 -1
  64. package/dist/features/link/nodes/LinkNode.js.map +1 -1
  65. package/dist/features/migrations/lexicalPluginToLexical/nodes/unknownConvertedNode/index.d.ts.map +1 -1
  66. package/dist/features/migrations/lexicalPluginToLexical/nodes/unknownConvertedNode/index.js +4 -4
  67. package/dist/features/migrations/lexicalPluginToLexical/nodes/unknownConvertedNode/index.js.map +1 -1
  68. package/dist/features/migrations/slateToLexical/nodes/unknownConvertedNode/index.d.ts.map +1 -1
  69. package/dist/features/migrations/slateToLexical/nodes/unknownConvertedNode/index.js +4 -4
  70. package/dist/features/migrations/slateToLexical/nodes/unknownConvertedNode/index.js.map +1 -1
  71. package/dist/features/relationship/client/components/RelationshipComponent.d.ts +1 -1
  72. package/dist/features/relationship/client/components/RelationshipComponent.d.ts.map +1 -1
  73. package/dist/features/relationship/client/components/RelationshipComponent.js +2 -2
  74. package/dist/features/relationship/client/components/RelationshipComponent.js.map +1 -1
  75. package/dist/features/relationship/client/nodes/RelationshipNode.d.ts +1 -1
  76. package/dist/features/relationship/client/nodes/RelationshipNode.d.ts.map +1 -1
  77. package/dist/features/relationship/client/nodes/RelationshipNode.js +3 -2
  78. package/dist/features/relationship/client/nodes/RelationshipNode.js.map +1 -1
  79. package/dist/features/relationship/server/nodes/RelationshipNode.d.ts +2 -1
  80. package/dist/features/relationship/server/nodes/RelationshipNode.d.ts.map +1 -1
  81. package/dist/features/relationship/server/nodes/RelationshipNode.js +9 -2
  82. package/dist/features/relationship/server/nodes/RelationshipNode.js.map +1 -1
  83. package/dist/features/typesServer.d.ts +2 -2
  84. package/dist/features/typesServer.d.ts.map +1 -1
  85. package/dist/features/typesServer.js.map +1 -1
  86. package/dist/features/upload/client/component/index.d.ts +1 -0
  87. package/dist/features/upload/client/component/index.d.ts.map +1 -1
  88. package/dist/features/upload/client/component/index.js +2 -2
  89. package/dist/features/upload/client/component/index.js.map +1 -1
  90. package/dist/features/upload/client/nodes/UploadNode.d.ts +2 -2
  91. package/dist/features/upload/client/nodes/UploadNode.d.ts.map +1 -1
  92. package/dist/features/upload/client/nodes/UploadNode.js +2 -1
  93. package/dist/features/upload/client/nodes/UploadNode.js.map +1 -1
  94. package/dist/features/upload/client/plugin/index.js +2 -2
  95. package/dist/features/upload/client/plugin/index.js.map +1 -1
  96. package/dist/features/upload/server/nodes/UploadNode.d.ts +2 -1
  97. package/dist/features/upload/server/nodes/UploadNode.d.ts.map +1 -1
  98. package/dist/features/upload/server/nodes/UploadNode.js +6 -0
  99. package/dist/features/upload/server/nodes/UploadNode.js.map +1 -1
  100. package/dist/field/Field.d.ts.map +1 -1
  101. package/dist/field/Field.js +50 -38
  102. package/dist/field/Field.js.map +1 -1
  103. package/dist/field/RichTextViewProvider.d.ts +84 -0
  104. package/dist/field/RichTextViewProvider.d.ts.map +1 -0
  105. package/dist/field/RichTextViewProvider.js +92 -0
  106. package/dist/field/RichTextViewProvider.js.map +1 -0
  107. package/dist/field/ViewSelector.d.ts +4 -0
  108. package/dist/field/ViewSelector.d.ts.map +1 -0
  109. package/dist/field/ViewSelector.js +89 -0
  110. package/dist/field/ViewSelector.js.map +1 -0
  111. package/dist/field/bundled.css +1 -1
  112. package/dist/field/index.d.ts.map +1 -1
  113. package/dist/field/index.js +63 -41
  114. package/dist/field/index.js.map +1 -1
  115. package/dist/field/rscEntry.d.ts +2 -3
  116. package/dist/field/rscEntry.d.ts.map +1 -1
  117. package/dist/field/rscEntry.js +15 -1
  118. package/dist/field/rscEntry.js.map +1 -1
  119. package/dist/index.d.ts +1 -1
  120. package/dist/index.d.ts.map +1 -1
  121. package/dist/index.js +9 -24
  122. package/dist/index.js.map +1 -1
  123. package/dist/lexical/LexicalEditor.d.ts.map +1 -1
  124. package/dist/lexical/LexicalEditor.js +2 -1
  125. package/dist/lexical/LexicalEditor.js.map +1 -1
  126. package/dist/lexical/LexicalProvider.d.ts.map +1 -1
  127. package/dist/lexical/LexicalProvider.js +12 -3
  128. package/dist/lexical/LexicalProvider.js.map +1 -1
  129. package/dist/lexical/config/client/loader.d.ts.map +1 -1
  130. package/dist/lexical/config/client/loader.js +2 -4
  131. package/dist/lexical/config/client/loader.js.map +1 -1
  132. package/dist/lexical/nodes/index.d.ts +12 -2
  133. package/dist/lexical/nodes/index.d.ts.map +1 -1
  134. package/dist/lexical/nodes/index.js +195 -2
  135. package/dist/lexical/nodes/index.js.map +1 -1
  136. package/dist/lexical/plugins/NodeViewOverridePlugin/index.d.ts +2 -0
  137. package/dist/lexical/plugins/NodeViewOverridePlugin/index.d.ts.map +1 -0
  138. package/dist/lexical/plugins/NodeViewOverridePlugin/index.js +48 -0
  139. package/dist/lexical/plugins/NodeViewOverridePlugin/index.js.map +1 -0
  140. package/dist/lexical/plugins/handles/utils/setHandlePosition.d.ts.map +1 -1
  141. package/dist/lexical/plugins/handles/utils/setHandlePosition.js +1 -1
  142. package/dist/lexical/plugins/handles/utils/setHandlePosition.js.map +1 -1
  143. package/dist/lexical/theme/EditorTheme.d.ts.map +1 -1
  144. package/dist/lexical/theme/EditorTheme.js +3 -39
  145. package/dist/lexical/theme/EditorTheme.js.map +1 -1
  146. package/dist/lexical/ui/ContentEditable.d.ts.map +1 -1
  147. package/dist/lexical/ui/ContentEditable.js +16 -9
  148. package/dist/lexical/ui/ContentEditable.js.map +1 -1
  149. package/dist/types.d.ts +138 -4
  150. package/dist/types.d.ts.map +1 -1
  151. package/dist/types.js.map +1 -1
  152. package/dist/utilities/editorConfigFactory.js +1 -1
  153. package/dist/utilities/editorConfigFactory.js.map +1 -1
  154. package/dist/utilities/generateImportMap.d.ts +2 -0
  155. package/dist/utilities/generateImportMap.d.ts.map +1 -1
  156. package/dist/utilities/generateImportMap.js +6 -13
  157. package/dist/utilities/generateImportMap.js.map +1 -1
  158. package/dist/{getDefaultSanitizedEditorConfig.d.ts → utilities/getDefaultSanitizedEditorConfig.d.ts} +1 -1
  159. package/dist/utilities/getDefaultSanitizedEditorConfig.d.ts.map +1 -0
  160. package/dist/{getDefaultSanitizedEditorConfig.js → utilities/getDefaultSanitizedEditorConfig.js} +2 -2
  161. package/dist/utilities/getDefaultSanitizedEditorConfig.js.map +1 -0
  162. package/dist/utilities/initLexicalFeatures.d.ts.map +1 -1
  163. package/dist/utilities/initLexicalFeatures.js +12 -13
  164. package/dist/utilities/initLexicalFeatures.js.map +1 -1
  165. package/dist/validate/hasText.d.ts +6 -1
  166. package/dist/validate/hasText.d.ts.map +1 -1
  167. package/dist/validate/hasText.js +10 -4
  168. package/dist/validate/hasText.js.map +1 -1
  169. package/package.json +7 -7
  170. package/dist/exports/client/Field-YYMTSGSP.js +0 -2
  171. package/dist/exports/client/Field-YYMTSGSP.js.map +0 -7
  172. package/dist/exports/client/RelationshipComponent-JXQOFHXF.js +0 -2
  173. package/dist/exports/client/RelationshipComponent-JXQOFHXF.js.map +0 -7
  174. package/dist/exports/client/chunk-ADWHGDDR.js +0 -2
  175. package/dist/exports/client/chunk-ADWHGDDR.js.map +0 -7
  176. package/dist/exports/client/chunk-AFXLIYGL.js +0 -12
  177. package/dist/exports/client/chunk-AFXLIYGL.js.map +0 -7
  178. package/dist/exports/client/component-WT25HAJA.js +0 -2
  179. package/dist/exports/client/component-WT25HAJA.js.map +0 -7
  180. package/dist/exports/client/componentInline-MIPTDFRK.js +0 -2
  181. package/dist/getDefaultSanitizedEditorConfig.d.ts.map +0 -1
  182. package/dist/getDefaultSanitizedEditorConfig.js.map +0 -1
  183. /package/dist/exports/client/{componentInline-MIPTDFRK.js.map → componentInline-QEXUNJU4.js.map} +0 -0
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["React","createContext","useCallback","useEffect","useMemo","useRef","baseClass","useLexicalComposerContext","useLexicalEditable","getTranslation","Button","Drawer","EditDepthProvider","Form","formatDrawerSlug","FormSubmit","RenderFields","ShimmerEffect","useConfig","useDocumentForm","useDocumentInfo","useEditDepth","useServerFunctions","useTranslation","abortAndIgnore","$getNodeByKey","deepCopyObjectSimpleWithoutReactComponents","reduceFieldsToValues","v4","uuid","useEditorConfigContext","useLexicalDrawer","$isInlineBlockNode","InlineBlockComponentContext","initialState","useInlineBlockComponentContext","use","InlineBlockComponent","props","cacheBuster","formData","nodeKey","editor","isEditable","i18n","t","createdInlineBlock","fieldProps","featureClientSchemaMap","initialLexicalFormState","schemaPath","setCreatedInlineBlock","uuidFromContext","fields","parentDocumentFields","getFormState","editDepth","firstTimeDrawer","setInitialState","useState","id","formState","hasMounted","prevCacheBuster","current","CustomLabel","setCustomLabel","customComponents","BlockLabel","CustomBlock","setCustomBlock","Block","drawerSlug","slug","depth","toggleDrawer","inlineBlockElemElemRef","collectionSlug","getDocPreferences","globalSlug","config","componentMapRenderedBlockPath","blockType","clientSchemaMap","blocksField","clientBlock","blockReferences","blocksMap","blocks","clientBlockFields","getKey","length","undefined","removeInlineBlock","update","remove","blockDisplayName","labels","singular","onChangeAbortControllerRef","AbortController","schemaFieldsPath","abortController","awaitInitialState","state","data","docPermissions","docPreferences","documentFormState","initialBlockData","initialBlockFormState","operation","readOnly","renderAllFields","signal","newFormStateData","node","newData","setFields","onChange","prevFormState","submit","controller","isStateOutOfSync","Object","keys","some","key","value","onFormSubmit","RemoveButton","_jsx","buttonStyle","className","disabled","icon","onClick","e","preventDefault","round","size","tooltip","label","EditButton","el","InlineBlockContainer","children","filter","Boolean","join","ref","Label","_jsxs","beforeSubmit","disableValidationOnSubmit","onSubmit","title","_Fragment","forceRender","parentIndexPath","parentPath","parentSchemaPath","permissions","programmaticSubmit","height","width"],"sources":["../../../../../src/features/blocks/client/componentInline/index.tsx"],"sourcesContent":["'use client'\n\nimport React, { createContext, useCallback, useEffect, useMemo, useRef } from 'react'\nconst baseClass = 'inline-block'\n\nimport type { BlocksFieldClient, ClientBlock, Data, FormState } from 'payload'\n\nimport { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext'\nimport { useLexicalEditable } from '@lexical/react/useLexicalEditable'\nimport { getTranslation } from '@payloadcms/translations'\nimport {\n Button,\n Drawer,\n EditDepthProvider,\n Form,\n formatDrawerSlug,\n FormSubmit,\n RenderFields,\n ShimmerEffect,\n useConfig,\n useDocumentForm,\n useDocumentInfo,\n useEditDepth,\n useServerFunctions,\n useTranslation,\n} from '@payloadcms/ui'\nimport { abortAndIgnore } from '@payloadcms/ui/shared'\n\nimport './index.scss'\n\nimport { $getNodeByKey } from 'lexical'\nimport { deepCopyObjectSimpleWithoutReactComponents, reduceFieldsToValues } from 'payload/shared'\nimport { v4 as uuid } from 'uuid'\n\nimport type { InlineBlockFields } from '../../server/nodes/InlineBlocksNode.js'\n\nimport { useEditorConfigContext } from '../../../../lexical/config/client/EditorConfigProvider.js'\nimport { useLexicalDrawer } from '../../../../utilities/fieldsDrawer/useLexicalDrawer.js'\nimport { $isInlineBlockNode } from '../nodes/InlineBlocksNode.js'\n\ntype Props = {\n /**\n * Can be modified by the node in order to trigger the re-fetch of the initial state based on the\n * formData. This is useful when node.setFields() is explicitly called from outside of the form - in\n * this case, the new field state is likely not reflected in the form state, so we need to re-fetch\n */\n readonly cacheBuster: number\n readonly formData: InlineBlockFields\n readonly nodeKey: string\n}\n\ntype InlineBlockComponentContextType = {\n EditButton?: React.FC\n initialState: false | FormState | undefined\n InlineBlockContainer?: React.FC<{ children: React.ReactNode }>\n Label?: React.FC\n nodeKey?: string\n RemoveButton?: React.FC\n}\n\nconst InlineBlockComponentContext = createContext<InlineBlockComponentContextType>({\n initialState: false,\n})\n\nexport const useInlineBlockComponentContext = () => React.use(InlineBlockComponentContext)\n\nexport const InlineBlockComponent: React.FC<Props> = (props) => {\n const { cacheBuster, formData, nodeKey } = props\n\n const [editor] = useLexicalComposerContext()\n const isEditable = useLexicalEditable()\n const { i18n, t } = useTranslation<object, string>()\n const {\n createdInlineBlock,\n fieldProps: { featureClientSchemaMap, initialLexicalFormState, schemaPath },\n setCreatedInlineBlock,\n uuid: uuidFromContext,\n } = useEditorConfigContext()\n const { fields: parentDocumentFields } = useDocumentForm()\n\n const { getFormState } = useServerFunctions()\n const editDepth = useEditDepth()\n const firstTimeDrawer = useRef(false)\n\n const [initialState, setInitialState] = React.useState<false | FormState | undefined>(\n () => initialLexicalFormState?.[formData.id]?.formState,\n )\n\n const hasMounted = useRef(false)\n const prevCacheBuster = useRef(cacheBuster)\n useEffect(() => {\n if (hasMounted.current) {\n if (prevCacheBuster.current !== cacheBuster) {\n setInitialState(false)\n }\n prevCacheBuster.current = cacheBuster\n } else {\n hasMounted.current = true\n }\n }, [cacheBuster])\n\n const [CustomLabel, setCustomLabel] = React.useState<React.ReactNode | undefined>(\n // @ts-expect-error - vestiges of when tsconfig was not strict. Feel free to improve\n initialState?.['_components']?.customComponents?.BlockLabel,\n )\n\n const [CustomBlock, setCustomBlock] = React.useState<React.ReactNode | undefined>(\n // @ts-expect-error - vestiges of when tsconfig was not strict. Feel free to improve\n initialState?.['_components']?.customComponents?.Block,\n )\n\n const drawerSlug = formatDrawerSlug({\n slug: `lexical-inlineBlocks-create-${uuidFromContext}-${formData.id}`,\n depth: editDepth,\n })\n const { toggleDrawer } = useLexicalDrawer(drawerSlug, true)\n\n const inlineBlockElemElemRef = useRef<HTMLDivElement | null>(null)\n const { id, collectionSlug, getDocPreferences, globalSlug } = useDocumentInfo()\n const { config } = useConfig()\n\n const componentMapRenderedBlockPath = `${schemaPath}.lexical_internal_feature.blocks.lexical_inline_blocks.${formData.blockType}`\n\n const clientSchemaMap = featureClientSchemaMap['blocks']\n\n const blocksField: BlocksFieldClient = clientSchemaMap?.[\n componentMapRenderedBlockPath\n ]?.[0] as BlocksFieldClient\n\n const clientBlock: ClientBlock | undefined = blocksField.blockReferences\n ? typeof blocksField?.blockReferences?.[0] === 'string'\n ? config.blocksMap[blocksField?.blockReferences?.[0]]\n : blocksField?.blockReferences?.[0]\n : blocksField?.blocks?.[0]\n\n const clientBlockFields = clientBlock?.fields ?? []\n\n // Open drawer on \"mount\"\n useEffect(() => {\n if (!firstTimeDrawer.current && createdInlineBlock?.getKey() === nodeKey) {\n // > 2 because they always have \"id\" and \"blockName\" fields\n if (clientBlockFields.length > 2) {\n toggleDrawer()\n }\n setCreatedInlineBlock?.(undefined)\n firstTimeDrawer.current = true\n }\n }, [clientBlockFields.length, createdInlineBlock, nodeKey, setCreatedInlineBlock, toggleDrawer])\n\n const removeInlineBlock = useCallback(() => {\n editor.update(() => {\n $getNodeByKey(nodeKey)?.remove()\n })\n }, [editor, nodeKey])\n\n const blockDisplayName = clientBlock?.labels?.singular\n ? getTranslation(clientBlock?.labels.singular, i18n)\n : clientBlock?.slug\n\n const onChangeAbortControllerRef = useRef(new AbortController())\n const schemaFieldsPath = `${schemaPath}.lexical_internal_feature.blocks.lexical_inline_blocks.${clientBlock?.slug}.fields`\n\n // Initial state for newly created blocks\n useEffect(() => {\n const abortController = new AbortController()\n\n const awaitInitialState = async () => {\n /*\n * This will only run if a new block is created. For all existing blocks that are loaded when the document is loaded, or when the form is saved,\n * this is not run, as the lexical field RSC will fetch the state server-side and pass it to the client. That way, we avoid unnecessary client-side\n * requests. Though for newly created blocks, we need to fetch the state client-side, as the server doesn't know about the block yet.\n */\n const { state } = await getFormState({\n id,\n collectionSlug,\n data: formData,\n docPermissions: { fields: true },\n docPreferences: await getDocPreferences(),\n documentFormState: deepCopyObjectSimpleWithoutReactComponents(parentDocumentFields),\n globalSlug,\n initialBlockData: formData,\n initialBlockFormState: formData,\n operation: 'update',\n readOnly: !isEditable,\n renderAllFields: true,\n schemaPath: schemaFieldsPath,\n signal: abortController.signal,\n })\n\n if (state) {\n const newFormStateData: InlineBlockFields = reduceFieldsToValues(\n deepCopyObjectSimpleWithoutReactComponents(state),\n true,\n ) as InlineBlockFields\n\n // Things like default values may come back from the server => update the node with the new data\n editor.update(() => {\n const node = $getNodeByKey(nodeKey)\n if (node && $isInlineBlockNode(node)) {\n const newData = newFormStateData\n newData.blockType = formData.blockType\n\n node.setFields(newData, true)\n }\n })\n\n setInitialState(state)\n setCustomLabel(state['_components']?.customComponents?.BlockLabel)\n setCustomBlock(state['_components']?.customComponents?.Block)\n }\n }\n\n if (formData && !initialState) {\n void awaitInitialState()\n }\n\n return () => {\n abortAndIgnore(abortController)\n }\n }, [\n getFormState,\n editor,\n nodeKey,\n isEditable,\n schemaFieldsPath,\n id,\n formData,\n initialState,\n collectionSlug,\n globalSlug,\n getDocPreferences,\n parentDocumentFields,\n ])\n\n /**\n * HANDLE ONCHANGE\n */\n const onChange = useCallback(\n async ({ formState: prevFormState, submit }: { formState: FormState; submit?: boolean }) => {\n abortAndIgnore(onChangeAbortControllerRef.current)\n\n const controller = new AbortController()\n onChangeAbortControllerRef.current = controller\n\n const { state } = await getFormState({\n id,\n collectionSlug,\n docPermissions: {\n fields: true,\n },\n docPreferences: await getDocPreferences(),\n documentFormState: deepCopyObjectSimpleWithoutReactComponents(parentDocumentFields),\n formState: prevFormState,\n globalSlug,\n initialBlockFormState: prevFormState,\n operation: 'update',\n readOnly: !isEditable,\n renderAllFields: submit ? true : false,\n schemaPath: schemaFieldsPath,\n signal: controller.signal,\n })\n\n if (!state) {\n return prevFormState\n }\n\n if (submit) {\n setCustomLabel(state['_components']?.customComponents?.BlockLabel)\n setCustomBlock(state['_components']?.customComponents?.Block)\n }\n\n return state\n },\n [\n getFormState,\n id,\n collectionSlug,\n getDocPreferences,\n parentDocumentFields,\n globalSlug,\n isEditable,\n schemaFieldsPath,\n ],\n )\n // cleanup effect\n useEffect(() => {\n const isStateOutOfSync = (formData: InlineBlockFields, initialState: FormState) => {\n return Object.keys(initialState).some(\n (key) => initialState[key] && formData[key] !== initialState[key].value,\n )\n }\n\n return () => {\n // If the component is unmounted (either via removeInlineBlock or via lexical itself) and the form state got changed before,\n // we need to reset the initial state to force a re-fetch of the initial state when it gets mounted again (e.g. via lexical history undo).\n // Otherwise it would use an outdated initial state.\n if (initialState && isStateOutOfSync(formData, initialState)) {\n setInitialState(false)\n }\n abortAndIgnore(onChangeAbortControllerRef.current)\n }\n }, [formData, initialState])\n\n /**\n * HANDLE FORM SUBMIT\n */\n const onFormSubmit = useCallback(\n (formState: FormState, newData: Data) => {\n newData.blockType = formData.blockType\n\n editor.update(() => {\n const node = $getNodeByKey(nodeKey)\n if (node && $isInlineBlockNode(node)) {\n node.setFields(newData as InlineBlockFields, true)\n }\n })\n },\n [editor, nodeKey, formData],\n )\n\n const RemoveButton = useMemo(\n () => () => (\n <Button\n buttonStyle=\"icon-label\"\n className={`${baseClass}__removeButton`}\n disabled={!isEditable}\n icon=\"x\"\n onClick={(e) => {\n e.preventDefault()\n removeInlineBlock()\n }}\n round\n size=\"small\"\n tooltip={t('lexical:blocks:inlineBlocks:remove', { label: blockDisplayName })}\n />\n ),\n [blockDisplayName, isEditable, removeInlineBlock, t],\n )\n\n const EditButton = useMemo(\n () => () => (\n <Button\n buttonStyle=\"icon-label\"\n className={`${baseClass}__editButton`}\n disabled={!isEditable}\n el=\"button\"\n icon=\"edit\"\n onClick={() => {\n toggleDrawer()\n }}\n round\n size=\"small\"\n tooltip={t('lexical:blocks:inlineBlocks:edit', { label: blockDisplayName })}\n />\n ),\n [blockDisplayName, isEditable, t, toggleDrawer],\n )\n\n const InlineBlockContainer = useMemo(\n () =>\n ({ children, className }: { children: React.ReactNode; className?: string }) => (\n <div\n className={[baseClass, baseClass + '-' + formData.blockType, className]\n .filter(Boolean)\n .join(' ')}\n ref={inlineBlockElemElemRef}\n >\n {children}\n </div>\n ),\n [formData.blockType],\n )\n\n const Label = useMemo(() => {\n if (CustomLabel) {\n return () => CustomLabel\n } else {\n return () => (\n <div>{clientBlock?.labels ? getTranslation(clientBlock?.labels.singular, i18n) : ''}</div>\n )\n }\n }, [CustomLabel, clientBlock?.labels, i18n])\n\n if (!clientBlock) {\n return (\n <InlineBlockContainer className={`${baseClass}-not-found`}>\n <span>Error: Block '{formData.blockType}' not found</span>\n {isEditable ? (\n <div className={`${baseClass}__actions`}>\n <RemoveButton />\n </div>\n ) : null}\n </InlineBlockContainer>\n )\n }\n\n return (\n <Form\n beforeSubmit={[\n async ({ formState }) => {\n // This is only called when form is submitted from drawer\n return await onChange({ formState, submit: true })\n },\n ]}\n disableValidationOnSubmit\n el=\"div\"\n fields={clientBlock?.fields}\n initialState={initialState || {}}\n onChange={[onChange]}\n onSubmit={(formState, data) => {\n onFormSubmit(formState, data)\n toggleDrawer()\n }}\n uuid={uuid()}\n >\n <EditDepthProvider>\n <Drawer\n className={''}\n slug={drawerSlug}\n title={t(`lexical:blocks:inlineBlocks:${formData?.id ? 'edit' : 'create'}`, {\n label: blockDisplayName ?? t('lexical:blocks:inlineBlocks:label'),\n })}\n >\n {initialState ? (\n <>\n <RenderFields\n fields={clientBlock?.fields}\n forceRender\n parentIndexPath=\"\"\n parentPath=\"\" // See Blocks feature path for details as for why this is empty\n parentSchemaPath={schemaFieldsPath}\n permissions={true}\n readOnly={!isEditable}\n />\n <FormSubmit programmaticSubmit={true}>{t('fields:saveChanges')}</FormSubmit>\n </>\n ) : null}\n </Drawer>\n </EditDepthProvider>\n {CustomBlock ? (\n <InlineBlockComponentContext\n value={{\n EditButton,\n initialState,\n InlineBlockContainer,\n Label,\n nodeKey,\n RemoveButton,\n }}\n >\n {CustomBlock}\n </InlineBlockComponentContext>\n ) : (\n <InlineBlockContainer>\n {initialState ? <Label /> : <ShimmerEffect height=\"15px\" width=\"40px\" />}\n {isEditable ? (\n <div className={`${baseClass}__actions`}>\n <EditButton />\n <RemoveButton />\n </div>\n ) : null}\n </InlineBlockContainer>\n )}\n </Form>\n )\n}\n"],"mappings":"AAAA;;;AAEA,OAAOA,KAAA,IAASC,aAAa,EAAEC,WAAW,EAAEC,SAAS,EAAEC,OAAO,EAAEC,MAAM,QAAQ;AAC9E,MAAMC,SAAA,GAAY;AAIlB,SAASC,y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AA,EAAgB;YAChBC,UAAA,EAAW,GAAG;YAAA;;YACdC,gBAAA,EAAkB5D,gBAAA;YAClB6D,WAAA,EAAa;YACblD,QAAA,EAAU,CAACrE;2BAEbwF,IAAA,CAACpH,UAAA;YAAWoJ,kBAAA,EAAoB;sBAAOtH,CAAA,CAAE;;aAEzC;;QAGPwB,WAAA,gBACC8D,IAAA,CAAClG,2BAAA;MACC+F,KAAA,EAAO;QACLe,UAAA;QACA7G,YAAA;QACA+G,oBAAA;QACAM,KAAA;QACA9G,OAAA;QACAyF;MACF;gBAEC7D;sBAGHmF,KAAA,CAACP,oBAAA;iBACE/G,YAAA,gBAAeiG,IAAA,CAACoB,KAAA,qBAAWpB,IAAA,CAAClH,aAAA;QAAcmJ,MAAA,EAAO;QAAOC,KAAA,EAAM;UAC9D1H,UAAA,gBACC6G,KAAA,CAAC;QAAInB,SAAA,EAAW,GAAG/H,SAAA,WAAoB;gCACrC6H,IAAA,CAACY,UAAA,O,aACDZ,IAAA,CAACD,YAAA;WAED;;;AAKd","ignoreList":[]}
1
+ {"version":3,"file":"index.js","names":["useLexicalComposerContext","useLexicalEditable","getTranslation","Button","Drawer","EditDepthProvider","Form","formatDrawerSlug","FormSubmit","RenderFields","ShimmerEffect","useConfig","useDocumentForm","useDocumentInfo","useEditDepth","useServerFunctions","useTranslation","abortAndIgnore","$getNodeByKey","deepCopyObjectSimpleWithoutReactComponents","reduceFieldsToValues","React","createContext","useCallback","useEffect","useMemo","useRef","v4","uuid","useEditorConfigContext","useLexicalDrawer","$isInlineBlockNode","InlineBlockComponentContext","initialState","useInlineBlockComponentContext","use","InlineBlockComponent","props","cacheBuster","className","baseClass","formData","nodeKey","editor","isEditable","i18n","t","createdInlineBlock","fieldProps","featureClientSchemaMap","initialLexicalFormState","schemaPath","setCreatedInlineBlock","uuidFromContext","fields","parentDocumentFields","getFormState","editDepth","firstTimeDrawer","setInitialState","useState","id","formState","hasMounted","prevCacheBuster","current","CustomLabel","setCustomLabel","customComponents","BlockLabel","CustomBlock","setCustomBlock","Block","drawerSlug","slug","depth","toggleDrawer","inlineBlockElemElemRef","collectionSlug","getDocPreferences","globalSlug","config","componentMapRenderedBlockPath","blockType","clientSchemaMap","blocksField","clientBlock","blockReferences","blocksMap","blocks","clientBlockFields","getKey","length","undefined","removeInlineBlock","update","remove","blockDisplayName","labels","singular","onChangeAbortControllerRef","AbortController","schemaFieldsPath","abortController","awaitInitialState","state","data","docPermissions","docPreferences","documentFormState","initialBlockData","initialBlockFormState","operation","readOnly","renderAllFields","signal","newFormStateData","node","newData","setFields","onChange","prevFormState","submit","controller","isStateOutOfSync","Object","keys","some","key","value","onFormSubmit","RemoveButton","_jsx","buttonStyle","disabled","icon","onClick","e","preventDefault","round","size","tooltip","label","EditButton","el","InlineBlockContainer","children","filter","Boolean","join","ref","Label","_jsxs","beforeSubmit","disableValidationOnSubmit","onSubmit","title","_Fragment","forceRender","parentIndexPath","parentPath","parentSchemaPath","permissions","programmaticSubmit","height","width"],"sources":["../../../../../src/features/blocks/client/componentInline/index.tsx"],"sourcesContent":["'use client'\n\nimport type { BlocksFieldClient, ClientBlock, Data, FormState } from 'payload'\n\nimport { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext'\nimport { useLexicalEditable } from '@lexical/react/useLexicalEditable'\nimport { getTranslation } from '@payloadcms/translations'\nimport {\n Button,\n Drawer,\n EditDepthProvider,\n Form,\n formatDrawerSlug,\n FormSubmit,\n RenderFields,\n ShimmerEffect,\n useConfig,\n useDocumentForm,\n useDocumentInfo,\n useEditDepth,\n useServerFunctions,\n useTranslation,\n} from '@payloadcms/ui'\nimport { abortAndIgnore } from '@payloadcms/ui/shared'\nimport { $getNodeByKey } from 'lexical'\n\nimport './index.scss'\n\nimport { deepCopyObjectSimpleWithoutReactComponents, reduceFieldsToValues } from 'payload/shared'\nimport React, { createContext, useCallback, useEffect, useMemo, useRef } from 'react'\nimport { v4 as uuid } from 'uuid'\n\nimport type { InlineBlockFields } from '../../server/nodes/InlineBlocksNode.js'\n\nimport { useEditorConfigContext } from '../../../../lexical/config/client/EditorConfigProvider.js'\nimport { useLexicalDrawer } from '../../../../utilities/fieldsDrawer/useLexicalDrawer.js'\nimport { $isInlineBlockNode } from '../nodes/InlineBlocksNode.js'\n\ntype Props = {\n /**\n * Can be modified by the node in order to trigger the re-fetch of the initial state based on the\n * formData. This is useful when node.setFields() is explicitly called from outside of the form - in\n * this case, the new field state is likely not reflected in the form state, so we need to re-fetch\n */\n readonly cacheBuster: number\n readonly className: string\n readonly formData: InlineBlockFields\n readonly nodeKey: string\n}\n\ntype InlineBlockComponentContextType = {\n EditButton?: React.FC\n initialState: false | FormState | undefined\n InlineBlockContainer?: React.FC<{ children: React.ReactNode }>\n Label?: React.FC\n nodeKey?: string\n RemoveButton?: React.FC\n}\n\nconst InlineBlockComponentContext = createContext<InlineBlockComponentContextType>({\n initialState: false,\n})\n\nexport const useInlineBlockComponentContext = () => React.use(InlineBlockComponentContext)\n\nexport const InlineBlockComponent: React.FC<Props> = (props) => {\n const { cacheBuster, className: baseClass, formData, nodeKey } = props\n\n const [editor] = useLexicalComposerContext()\n const isEditable = useLexicalEditable()\n const { i18n, t } = useTranslation<object, string>()\n const {\n createdInlineBlock,\n fieldProps: { featureClientSchemaMap, initialLexicalFormState, schemaPath },\n setCreatedInlineBlock,\n uuid: uuidFromContext,\n } = useEditorConfigContext()\n const { fields: parentDocumentFields } = useDocumentForm()\n\n const { getFormState } = useServerFunctions()\n const editDepth = useEditDepth()\n const firstTimeDrawer = useRef(false)\n\n const [initialState, setInitialState] = React.useState<false | FormState | undefined>(\n () => initialLexicalFormState?.[formData.id]?.formState,\n )\n\n const hasMounted = useRef(false)\n const prevCacheBuster = useRef(cacheBuster)\n useEffect(() => {\n if (hasMounted.current) {\n if (prevCacheBuster.current !== cacheBuster) {\n setInitialState(false)\n }\n prevCacheBuster.current = cacheBuster\n } else {\n hasMounted.current = true\n }\n }, [cacheBuster])\n\n const [CustomLabel, setCustomLabel] = React.useState<React.ReactNode | undefined>(\n // @ts-expect-error - vestiges of when tsconfig was not strict. Feel free to improve\n initialState?.['_components']?.customComponents?.BlockLabel,\n )\n\n const [CustomBlock, setCustomBlock] = React.useState<React.ReactNode | undefined>(\n // @ts-expect-error - vestiges of when tsconfig was not strict. Feel free to improve\n initialState?.['_components']?.customComponents?.Block,\n )\n\n const drawerSlug = formatDrawerSlug({\n slug: `lexical-inlineBlocks-create-${uuidFromContext}-${formData.id}`,\n depth: editDepth,\n })\n const { toggleDrawer } = useLexicalDrawer(drawerSlug, true)\n\n const inlineBlockElemElemRef = useRef<HTMLDivElement | null>(null)\n const { id, collectionSlug, getDocPreferences, globalSlug } = useDocumentInfo()\n const { config } = useConfig()\n\n const componentMapRenderedBlockPath = `${schemaPath}.lexical_internal_feature.blocks.lexical_inline_blocks.${formData.blockType}`\n\n const clientSchemaMap = featureClientSchemaMap['blocks']\n\n const blocksField: BlocksFieldClient = clientSchemaMap?.[\n componentMapRenderedBlockPath\n ]?.[0] as BlocksFieldClient\n\n const clientBlock: ClientBlock | undefined = blocksField.blockReferences\n ? typeof blocksField?.blockReferences?.[0] === 'string'\n ? config.blocksMap[blocksField?.blockReferences?.[0]]\n : blocksField?.blockReferences?.[0]\n : blocksField?.blocks?.[0]\n\n const clientBlockFields = clientBlock?.fields ?? []\n\n // Open drawer on \"mount\"\n useEffect(() => {\n if (!firstTimeDrawer.current && createdInlineBlock?.getKey() === nodeKey) {\n // > 2 because they always have \"id\" and \"blockName\" fields\n if (clientBlockFields.length > 2) {\n toggleDrawer()\n }\n setCreatedInlineBlock?.(undefined)\n firstTimeDrawer.current = true\n }\n }, [clientBlockFields.length, createdInlineBlock, nodeKey, setCreatedInlineBlock, toggleDrawer])\n\n const removeInlineBlock = useCallback(() => {\n editor.update(() => {\n $getNodeByKey(nodeKey)?.remove()\n })\n }, [editor, nodeKey])\n\n const blockDisplayName = clientBlock?.labels?.singular\n ? getTranslation(clientBlock?.labels.singular, i18n)\n : clientBlock?.slug\n\n const onChangeAbortControllerRef = useRef(new AbortController())\n const schemaFieldsPath = `${schemaPath}.lexical_internal_feature.blocks.lexical_inline_blocks.${clientBlock?.slug}.fields`\n\n // Initial state for newly created blocks\n useEffect(() => {\n const abortController = new AbortController()\n\n const awaitInitialState = async () => {\n /*\n * This will only run if a new block is created. For all existing blocks that are loaded when the document is loaded, or when the form is saved,\n * this is not run, as the lexical field RSC will fetch the state server-side and pass it to the client. That way, we avoid unnecessary client-side\n * requests. Though for newly created blocks, we need to fetch the state client-side, as the server doesn't know about the block yet.\n */\n const { state } = await getFormState({\n id,\n collectionSlug,\n data: formData,\n docPermissions: { fields: true },\n docPreferences: await getDocPreferences(),\n documentFormState: deepCopyObjectSimpleWithoutReactComponents(parentDocumentFields),\n globalSlug,\n initialBlockData: formData,\n initialBlockFormState: formData,\n operation: 'update',\n readOnly: !isEditable,\n renderAllFields: true,\n schemaPath: schemaFieldsPath,\n signal: abortController.signal,\n })\n\n if (state) {\n const newFormStateData: InlineBlockFields = reduceFieldsToValues(\n deepCopyObjectSimpleWithoutReactComponents(state),\n true,\n ) as InlineBlockFields\n\n // Things like default values may come back from the server => update the node with the new data\n editor.update(() => {\n const node = $getNodeByKey(nodeKey)\n if (node && $isInlineBlockNode(node)) {\n const newData = newFormStateData\n newData.blockType = formData.blockType\n\n node.setFields(newData, true)\n }\n })\n\n setInitialState(state)\n setCustomLabel(state['_components']?.customComponents?.BlockLabel)\n setCustomBlock(state['_components']?.customComponents?.Block)\n }\n }\n\n if (formData && !initialState) {\n void awaitInitialState()\n }\n\n return () => {\n abortAndIgnore(abortController)\n }\n }, [\n getFormState,\n editor,\n nodeKey,\n isEditable,\n schemaFieldsPath,\n id,\n formData,\n initialState,\n collectionSlug,\n globalSlug,\n getDocPreferences,\n parentDocumentFields,\n ])\n\n /**\n * HANDLE ONCHANGE\n */\n const onChange = useCallback(\n async ({ formState: prevFormState, submit }: { formState: FormState; submit?: boolean }) => {\n abortAndIgnore(onChangeAbortControllerRef.current)\n\n const controller = new AbortController()\n onChangeAbortControllerRef.current = controller\n\n const { state } = await getFormState({\n id,\n collectionSlug,\n docPermissions: {\n fields: true,\n },\n docPreferences: await getDocPreferences(),\n documentFormState: deepCopyObjectSimpleWithoutReactComponents(parentDocumentFields),\n formState: prevFormState,\n globalSlug,\n initialBlockFormState: prevFormState,\n operation: 'update',\n readOnly: !isEditable,\n renderAllFields: submit ? true : false,\n schemaPath: schemaFieldsPath,\n signal: controller.signal,\n })\n\n if (!state) {\n return prevFormState\n }\n\n if (submit) {\n setCustomLabel(state['_components']?.customComponents?.BlockLabel)\n setCustomBlock(state['_components']?.customComponents?.Block)\n }\n\n return state\n },\n [\n getFormState,\n id,\n collectionSlug,\n getDocPreferences,\n parentDocumentFields,\n globalSlug,\n isEditable,\n schemaFieldsPath,\n ],\n )\n // cleanup effect\n useEffect(() => {\n const isStateOutOfSync = (formData: InlineBlockFields, initialState: FormState) => {\n return Object.keys(initialState).some(\n (key) => initialState[key] && formData[key] !== initialState[key].value,\n )\n }\n\n return () => {\n // If the component is unmounted (either via removeInlineBlock or via lexical itself) and the form state got changed before,\n // we need to reset the initial state to force a re-fetch of the initial state when it gets mounted again (e.g. via lexical history undo).\n // Otherwise it would use an outdated initial state.\n if (initialState && isStateOutOfSync(formData, initialState)) {\n setInitialState(false)\n }\n abortAndIgnore(onChangeAbortControllerRef.current)\n }\n }, [formData, initialState])\n\n /**\n * HANDLE FORM SUBMIT\n */\n const onFormSubmit = useCallback(\n (formState: FormState, newData: Data) => {\n newData.blockType = formData.blockType\n\n editor.update(() => {\n const node = $getNodeByKey(nodeKey)\n if (node && $isInlineBlockNode(node)) {\n node.setFields(newData as InlineBlockFields, true)\n }\n })\n },\n [editor, nodeKey, formData],\n )\n\n const RemoveButton = useMemo(\n () => () => (\n <Button\n buttonStyle=\"icon-label\"\n className={`${baseClass}__removeButton`}\n disabled={!isEditable}\n icon=\"x\"\n onClick={(e) => {\n e.preventDefault()\n removeInlineBlock()\n }}\n round\n size=\"small\"\n tooltip={t('lexical:blocks:inlineBlocks:remove', { label: blockDisplayName })}\n />\n ),\n [baseClass, blockDisplayName, isEditable, removeInlineBlock, t],\n )\n\n const EditButton = useMemo(\n () => () => (\n <Button\n buttonStyle=\"icon-label\"\n className={`${baseClass}__editButton`}\n disabled={!isEditable}\n el=\"button\"\n icon=\"edit\"\n onClick={() => {\n toggleDrawer()\n }}\n round\n size=\"small\"\n tooltip={t('lexical:blocks:inlineBlocks:edit', { label: blockDisplayName })}\n />\n ),\n [baseClass, blockDisplayName, isEditable, t, toggleDrawer],\n )\n\n const InlineBlockContainer = useMemo(\n () =>\n ({ children, className }: { children: React.ReactNode; className?: string }) => (\n <div\n className={[`${baseClass}__container`, baseClass + '-' + formData.blockType, className]\n .filter(Boolean)\n .join(' ')}\n ref={inlineBlockElemElemRef}\n >\n {children}\n </div>\n ),\n [baseClass, formData.blockType],\n )\n\n const Label = useMemo(() => {\n if (CustomLabel) {\n return () => CustomLabel\n } else {\n return () => (\n <div>{clientBlock?.labels ? getTranslation(clientBlock?.labels.singular, i18n) : ''}</div>\n )\n }\n }, [CustomLabel, clientBlock?.labels, i18n])\n\n if (!clientBlock) {\n return (\n <InlineBlockContainer className={`${baseClass}-not-found`}>\n <span>Error: Block '{formData.blockType}' not found</span>\n {isEditable ? (\n <div className={`${baseClass}__actions`}>\n <RemoveButton />\n </div>\n ) : null}\n </InlineBlockContainer>\n )\n }\n\n return (\n <Form\n beforeSubmit={[\n async ({ formState }) => {\n // This is only called when form is submitted from drawer\n return await onChange({ formState, submit: true })\n },\n ]}\n disableValidationOnSubmit\n el=\"div\"\n fields={clientBlock?.fields}\n initialState={initialState || {}}\n onChange={[onChange]}\n onSubmit={(formState, data) => {\n onFormSubmit(formState, data)\n toggleDrawer()\n }}\n uuid={uuid()}\n >\n <EditDepthProvider>\n <Drawer\n className={''}\n slug={drawerSlug}\n title={t(`lexical:blocks:inlineBlocks:${formData?.id ? 'edit' : 'create'}`, {\n label: blockDisplayName ?? t('lexical:blocks:inlineBlocks:label'),\n })}\n >\n {initialState ? (\n <>\n <RenderFields\n fields={clientBlock?.fields}\n forceRender\n parentIndexPath=\"\"\n parentPath=\"\" // See Blocks feature path for details as for why this is empty\n parentSchemaPath={schemaFieldsPath}\n permissions={true}\n readOnly={!isEditable}\n />\n <FormSubmit programmaticSubmit={true}>{t('fields:saveChanges')}</FormSubmit>\n </>\n ) : null}\n </Drawer>\n </EditDepthProvider>\n {CustomBlock ? (\n <InlineBlockComponentContext\n value={{\n EditButton,\n initialState,\n InlineBlockContainer,\n Label,\n nodeKey,\n RemoveButton,\n }}\n >\n {CustomBlock}\n </InlineBlockComponentContext>\n ) : (\n <InlineBlockContainer>\n {initialState ? <Label /> : <ShimmerEffect height=\"15px\" width=\"40px\" />}\n {isEditable ? (\n <div className={`${baseClass}__actions`}>\n <EditButton />\n <RemoveButton />\n </div>\n ) : null}\n </InlineBlockContainer>\n )}\n </Form>\n )\n}\n"],"mappings":"AAAA;;;AAIA,SAASA,yBAAyB,QAAQ;AAC1C,SAASC,kBAAkB,QAAQ;AACnC,SAASC,cAAc,QAAQ;AAC/B,SACEC,MAAM,EACNC,MAAM,EACNC,iBAAiB,EACjBC,IAAI,EACJC,gBAAgB,EAChBC,UAAU,EACVC,YAAY,EACZC,aAAa,EACbC,SAAS,EACTC,eAAe,EACfC,eAAe,EACfC,YAAY,EACZC,kBAAkB,EAClBC,cAAc,QACT;AACP,SAASC,cAAc,QAAQ;AAC/B,SAASC,aAAa,QAAQ;AAI9B,SAASC,0CAA0C,EAAEC,oBAAoB,QAAQ;AACjF,OAAOC,KAAA,IAASC,aAAa,EAAEC,WAAW,EAAEC,SAAS,EAAEC,OAAO,EAAEC,MAAM,QAAQ;AAC9E,SAASC,EAAA,IAAMC,IAAI,QAAQ;AAI3B,SAASC,sBAAsB,QAAQ;AACvC,SAASC,gBAAgB,QAAQ;AACjC,SAASC,kBAAkB,QAAQ;AAuBnC,MAAMC,2BAAA,gBAA8BV,aAAA,CAA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IAAA,CAAC1H,aAAA;QAAc0J,MAAA,EAAO;QAAOC,KAAA,EAAM;UAC9DzH,UAAA,gBACC4G,KAAA,CAAC;QAAIjH,SAAA,EAAW,GAAGC,SAAA,WAAoB;gCACrC4F,IAAA,CAACW,UAAA,O,aACDX,IAAA,CAACD,YAAA;WAED;;;AAKd","ignoreList":[]}
@@ -1,4 +1,4 @@
1
- import type { EditorConfig, LexicalEditor, LexicalNode } from 'lexical';
1
+ import { type EditorConfig, type LexicalEditor, type LexicalNode } from 'lexical';
2
2
  import { type JSX } from 'react';
3
3
  import type { BlockFieldsOptionalID, SerializedBlockNode } from '../../server/nodes/BlocksNode.js';
4
4
  import { ServerBlockNode } from '../../server/nodes/BlocksNode.js';
@@ -6,7 +6,7 @@ export declare class BlockNode extends ServerBlockNode {
6
6
  static clone(node: ServerBlockNode): ServerBlockNode;
7
7
  static getType(): string;
8
8
  static importJSON(serializedNode: SerializedBlockNode): BlockNode;
9
- decorate(editor: LexicalEditor, config: EditorConfig): JSX.Element;
9
+ decorate(_editor: LexicalEditor, config: EditorConfig): JSX.Element;
10
10
  exportJSON(): SerializedBlockNode;
11
11
  }
12
12
  export declare function $createBlockNode(fields: BlockFieldsOptionalID): BlockNode;
@@ -1 +1 @@
1
- {"version":3,"file":"BlocksNode.d.ts","sourceRoot":"","sources":["../../../../../src/features/blocks/client/nodes/BlocksNode.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,SAAS,CAAA;AAGvE,OAAc,EAAE,KAAK,GAAG,EAAE,MAAM,OAAO,CAAA;AAEvC,OAAO,KAAK,EAAE,qBAAqB,EAAE,mBAAmB,EAAE,MAAM,kCAAkC,CAAA;AAElG,OAAO,EAAE,eAAe,EAAE,MAAM,kCAAkC,CAAA;AAGlE,qBAAa,SAAU,SAAQ,eAAe;WAC5B,KAAK,CAAC,IAAI,EAAE,eAAe,GAAG,eAAe;WAI7C,OAAO,IAAI,M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x } from "react/jsx-runtime";
4
4
  import ObjectID from 'bson-objectid';
5
+ import { $applyNodeReplacement } from 'lexical';
5
6
  import React from 'react';
6
7
  import { ServerBlockNode } from '../../server/nodes/BlocksNode.js';
7
8
  import { BlockComponent } from '../component/index.js';
@@ -27,9 +28,10 @@ export class BlockNode extends ServerBlockNode {
27
28
  node.setFormat(serializedNode.format);
28
29
  return node;
29
30
  }
30
- decorate(editor, config) {
31
+ decorate(_editor, config) {
31
32
  return /*#__PURE__*/_jsx(BlockComponent, {
32
33
  cacheBuster: this.getCacheBuster(),
34
+ className: config.theme.block ?? 'LexicalEditorTheme__block',
33
35
  formData: this.getFields(),
34
36
  nodeKey: this.getKey()
35
37
  });
@@ -39,12 +41,12 @@ export class BlockNode extends ServerBlockNode {
39
41
  }
40
42
  }
41
43
  export function $createBlockNode(fields) {
42
- return new BlockNode({
44
+ return $applyNodeReplacement(new BlockNode({
43
45
  fields: {
44
46
  ...fields,
45
47
  id: fields?.id || new ObjectID.default().toHexString()
46
48
  }
47
- });
49
+ }));
48
50
  }
49
51
  export function $isBlockNode(node) {
50
52
  return node instanceof BlockNode;
@@ -1 +1 @@
1
- {"version":3,"file":"BlocksNode.js","names":["ObjectID","React","ServerBlockNode","BlockComponent","BlockNode","clone","node","getType","importJSON","serializedNode","version","fields","data","$createBlockNode","setFormat","format","decorate","editor","config","_jsx","cacheBuster","getCacheBuster","formData","getFields","nodeKey","getKey","exportJSON","id","default","toHexString","$isBlockNode"],"sources":["../../../../../src/features/blocks/client/nodes/BlocksNode.tsx"],"sourcesContent":["'use client'\nimport type { EditorConfig, LexicalEditor, LexicalNode } from 'lexical'\n\nimport ObjectID from 'bson-objectid'\nimport React, { type JSX } from 'react'\n\nimport type { BlockFieldsOptionalID, SerializedBlockNode } from '../../server/nodes/BlocksNode.js'\n\nimport { ServerBlockNode } from '../../server/nodes/BlocksNode.js'\nimport { BlockComponent } from '../component/index.js'\n\nexport class BlockNode extends ServerBlockNode {\n static override clone(node: ServerBlockNode): ServerBlockNode {\n return super.clone(node)\n }\n\n static override getType(): string {\n return super.getType()\n }\n\n static override importJSON(serializedNode: SerializedBlockNode): BlockNode {\n if (serializedNode.version === 1) {\n // Convert (version 1 had the fields wrapped in another, unnecessary data property)\n serializedNode = {\n ...serializedNode,\n fields: {\n ...(serializedNode as any).fields.data,\n },\n version: 2,\n }\n }\n const node = $createBlockNode(serializedNode.fields)\n node.setFormat(serializedNode.format)\n return node\n }\n\n override decorate(editor: LexicalEditor, config: EditorConfig): JSX.Element {\n return (\n <BlockComponent\n cacheBuster={this.getCacheBuster()}\n formData={this.getFields()}\n nodeKey={this.getKey()}\n />\n )\n }\n\n override exportJSON(): SerializedBlockNode {\n return super.exportJSON()\n }\n}\n\nexport function $createBlockNode(fields: BlockFieldsOptionalID): BlockNode {\n return new BlockNode({\n fields: {\n ...fields,\n id: fields?.id || new ObjectID.default().toHexString(),\n },\n })\n}\n\nexport function $isBlockNode(node: BlockNode | LexicalNode | null | undefined): node is BlockNode {\n return node instanceof BlockNode\n}\n"],"mappings":"AAAA;;;AAGA,OAAOA,QAAA,MAAc;AACrB,OAAOC,KAAA,MAAyB;AAIhC,SAASC,eAAe,QAAQ;AAChC,SAASC,cAAc,QAAQ;AAE/B,OAAO,MAAMC,SAAA,SAAkBF,eAAA;EAC7B,OAAgBG,MAAMC,IAAqB,EAAmB;IAC5D,OAAO,KAAK,CAACD,KAAA,CAAMC,IAAA;EACrB;EAEA,OAAgBC,QAAA,EAAkB;IAChC,OAAO,KAAK,CAACA,OAAA;EACf;EAEA,OAAgBC,WAAWC,cAAmC,EAAa;IACzE,IAAIA,cAAA,CAAeC,OAAO,KAAK,GAAG;MAChC;MACAD,cAAA,GAAiB;QACf,GAAGA,cAAc;QACjBE,MAAA,EAAQ;UACN,GAAGF,cAAC,CAAuBE,MAAM,CAACC;QACpC;QACAF,OAAA,EAAS;MACX;IACF;IACA,MAAMJ,IAAA,GAAOO,gBAAA,CAAiBJ,cAAA,CAAeE,MAAM;IACnDL,IAAA,CAAKQ,SAAS,CAACL,cAAA,CAAeM,MAAM;IACpC,OAAOT,IAAA;EACT;EAESU,SAASC,MAAqB,EAAEC,MAAoB,EAAe;IAC1E,oBACEC,IAAA,CAAChB,cAAA;MACCiB,WAAA,EAAa,IAAI,CAACC,cAAc;MAChCC,QAAA,EAAU,IAAI,CAACC,SAAS;MACxBC,OAAA,EAAS,IAAI,CAACC,MAAM;;EAG1B;EAESC,WAAA,EAAkC;IACzC,OAAO,KAAK,CAACA,UAAA;EACf;AACF;AAEA,OAAO,SAASb,iBAAiBF,MAA6B;EAC5D,OAAO,IAAIP,SAAA,CAAU;IACnBO,MAAA,EAAQ;MACN,GAAGA,MAAM;MACTgB,EAAA,EAAIhB,MAAA,EAAQgB,EAAA,IAAM,IAAI3B,QAAA,CAAS4B,OAAO,GAAGC,WAAW;IACtD;EACF;AACF;AAEA,OAAO,SAASC,aAAaxB,IAAgD;EAC3E,OAAOA,IAAA,YAAgBF,SAAA;AACzB","ignoreList":[]}
1
+ {"version":3,"file":"BlocksNode.js","names":["ObjectID","$applyNodeReplacement","React","ServerBlockNode","BlockComponent","BlockNode","clone","node","getType","importJSON","serializedNode","version","fields","data","$createBlockNode","setFormat","format","decorate","_editor","config","_jsx","cacheBuster","getCacheBuster","className","theme","block","formData","getFields","nodeKey","getKey","exportJSON","id","default","toHexString","$isBlockNode"],"sources":["../../../../../src/features/blocks/client/nodes/BlocksNode.tsx"],"sourcesContent":["'use client'\nimport ObjectID from 'bson-objectid'\nimport {\n $applyNodeReplacement,\n type EditorConfig,\n type LexicalEditor,\n type LexicalNode,\n} from 'lexical'\nimport React, { type JSX } from 'react'\n\nimport type { BlockFieldsOptionalID, SerializedBlockNode } from '../../server/nodes/BlocksNode.js'\n\nimport { ServerBlockNode } from '../../server/nodes/BlocksNode.js'\nimport { BlockComponent } from '../component/index.js'\n\nexport class BlockNode extends ServerBlockNode {\n static override clone(node: ServerBlockNode): ServerBlockNode {\n return super.clone(node)\n }\n\n static override getType(): string {\n return super.getType()\n }\n\n static override importJSON(serializedNode: SerializedBlockNode): BlockNode {\n if (serializedNode.version === 1) {\n // Convert (version 1 had the fields wrapped in another, unnecessary data property)\n serializedNode = {\n ...serializedNode,\n fields: {\n ...(serializedNode as any).fields.data,\n },\n version: 2,\n }\n }\n const node = $createBlockNode(serializedNode.fields)\n node.setFormat(serializedNode.format)\n return node\n }\n\n override decorate(_editor: LexicalEditor, config: EditorConfig): JSX.Element {\n return (\n <BlockComponent\n cacheBuster={this.getCacheBuster()}\n className={config.theme.block ?? 'LexicalEditorTheme__block'}\n formData={this.getFields()}\n nodeKey={this.getKey()}\n />\n )\n }\n\n override exportJSON(): SerializedBlockNode {\n return super.exportJSON()\n }\n}\n\nexport function $createBlockNode(fields: BlockFieldsOptionalID): BlockNode {\n return $applyNodeReplacement(\n new BlockNode({\n fields: {\n ...fields,\n id: fields?.id || new ObjectID.default().toHexString(),\n },\n }),\n )\n}\n\nexport function $isBlockNode(node: BlockNode | LexicalNode | null | undefined): node is BlockNode {\n return node instanceof BlockNode\n}\n"],"mappings":"AAAA;;;AACA,OAAOA,QAAA,MAAc;AACrB,SACEC,qBAAqB,QAIhB;AACP,OAAOC,KAAA,MAAyB;AAIhC,SAASC,eAAe,QAAQ;AAChC,SAASC,cAAc,QAAQ;AAE/B,OAAO,MAAMC,SAAA,SAAkBF,eAAA;EAC7B,OAAgBG,MAAMC,IAAqB,EAAmB;IAC5D,OAAO,KAAK,CAACD,KAAA,CAAMC,IAAA;EACrB;EAEA,OAAgBC,QAAA,EAAkB;IAChC,OAAO,KAAK,CAACA,OAAA;EACf;EAEA,OAAgBC,WAAWC,cAAmC,EAAa;IACzE,IAAIA,cAAA,CAAeC,OAAO,KAAK,GAAG;MAChC;MACAD,cAAA,GAAiB;QACf,GAAGA,cAAc;QACjBE,MAAA,EAAQ;UACN,GAAGF,cAAC,CAAuBE,MAAM,CAACC;QACpC;QACAF,OAAA,EAAS;MACX;IACF;IACA,MAAMJ,IAAA,GAAOO,gBAAA,CAAiBJ,cAAA,CAAeE,MAAM;IACnDL,IAAA,CAAKQ,SAAS,CAACL,cAAA,CAAeM,MAAM;IACpC,OAAOT,IAAA;EACT;EAESU,SAASC,OAAsB,EAAEC,MAAoB,EAAe;IAC3E,oBACEC,IAAA,CAAChB,cAAA;MACCiB,WAAA,EAAa,IAAI,CAACC,cAAc;MAChCC,SAAA,EAAWJ,MAAA,CAAOK,KAAK,CAACC,KAAK,IAAI;MACjCC,QAAA,EAAU,IAAI,CAACC,SAAS;MACxBC,OAAA,EAAS,IAAI,CAACC,MAAM;;EAG1B;EAESC,WAAA,EAAkC;IACzC,OAAO,KAAK,CAACA,UAAA;EACf;AACF;AAEA,OAAO,SAAShB,iBAAiBF,MAA6B;EAC5D,OAAOX,qBAAA,CACL,IAAII,SAAA,CAAU;IACZO,MAAA,EAAQ;MACN,GAAGA,MAAM;MACTmB,EAAA,EAAInB,MAAA,EAAQmB,EAAA,IAAM,IAAI/B,QAAA,CAASgC,OAAO,GAAGC,WAAW;IACtD;EACF;AAEJ;AAEA,OAAO,SAASC,aAAa3B,IAAgD;EAC3E,OAAOA,IAAA,YAAgBF,SAAA;AACzB","ignoreList":[]}
@@ -1,4 +1,4 @@
1
- import type { EditorConfig, LexicalEditor, LexicalNode } from 'lexical';
1
+ import { type EditorConfig, type LexicalEditor, type LexicalNode } from 'lexical';
2
2
  import { type JSX } from 'react';
3
3
  import type { InlineBlockFields, SerializedInlineBlockNode } from '../../server/nodes/InlineBlocksNode.js';
4
4
  import { ServerInlineBlockNode } from '../../server/nodes/InlineBlocksNode.js';
@@ -6,7 +6,7 @@ export declare class InlineBlockNode extends ServerInlineBlockNode {
6
6
  static clone(node: ServerInlineBlockNode): ServerInlineBlockNode;
7
7
  static getType(): string;
8
8
  static importJSON(serializedNode: SerializedInlineBlockNode): InlineBlockNode;
9
- decorate(editor: LexicalEditor, config: EditorConfig): JSX.Element;
9
+ decorate(_editor: LexicalEditor, config: EditorConfig): JSX.Element;
10
10
  exportJSON(): SerializedInlineBlockNode;
11
11
  }
12
12
  export declare function $createInlineBlockNode(fields: Exclude<InlineBlockFields, 'id'>): InlineBlockNode;
@@ -1 +1 @@
1
- {"version":3,"file":"InlineBlocksNode.d.ts","sourceRoot":"","sources":["../../../../../src/features/blocks/client/nodes/InlineBlocksNode.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,SAAS,CAAA;AAGvE,OAAc,EAAE,KAAK,GAAG,EAAE,MAAM,OAAO,CAAA;AAEvC,OAAO,KAAK,EACV,iBAAiB,EACjB,yBAAyB,EAC1B,MAAM,wCAAwC,CAAA;AAE/C,OAAO,EAAE,qBAAqB,EAAE,MAAM,wCAAwC,CAAA;AAQ9E,qBAAa,eAAgB,SAAQ,qBAAqB;WACxC,KAAK,CAAC,IAAI,EAAE,qBAAqB,GAAG,qBAAqB;WAIzD,OAAO,IAAI,MAAM;WAIjB,UAAU,CAAC,cAAc,EAAE,yBAAyB,GAAG,eAAe;IAK7E,QAAQ,CAAC,MAAM,EAAE,aAAa,EAAE,MAAM,EAAE,YAAY,GAAG,GAAG,CAAC,OAAO;IAUlE,UAAU,IAAI,yBAAyB;CAGjD;AAED,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,OAAO,CAAC,iBAAiB,EAAE,IAAI,CAAC,GAAG,eAAe,CAOhG;AAED,wBAAgB,kBAAkB,CAChC,IAAI,EAAE,eAAe,GAAG,WAAW,GAAG,IAAI,GAAG,SAAS,GACrD,IAAI,IAAI,eAAe,CAEzB"}
1
+ {"version":3,"file":"InlineBlocksNode.d.ts","sourceRoot":"","sources":["../../../../../src/features/blocks/client/nodes/InlineBlocksNode.tsx"],"names":[],"mappings":"AAEA,OAAO,EAEL,KAAK,YAAY,EACjB,KAAK,aAAa,EAClB,KAAK,WAAW,EACjB,MAAM,SAAS,CAAA;AAChB,OAAc,EAAE,KAAK,GAAG,EAAE,MAAM,OAAO,CAAA;AAEvC,OAAO,KAAK,EACV,iBAAiB,EACjB,yBAAyB,EAC1B,MAAM,wCAAwC,CAAA;AAE/C,OAAO,EAAE,qBAAqB,EAAE,MAAM,wCAAwC,CAAA;AAQ9E,qBAAa,eAAgB,SAAQ,qBAAqB;WACxC,KAAK,CAAC,IAAI,EAAE,qBAAqB,GAAG,qBAAqB;WAIzD,OAAO,IAAI,MAAM;WAIjB,UAAU,CAAC,cAAc,EAAE,yBAAyB,GAAG,eAAe;IAK7E,QAAQ,CAAC,OAAO,EAAE,aAAa,EAAE,MAAM,EAAE,YAAY,GAAG,GAAG,CAAC,OAAO;IAWnE,UAAU,IAAI,yBAAyB;CAGjD;AAED,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,OAAO,CAAC,iBAAiB,EAAE,IAAI,CAAC,GAAG,eAAe,CAShG;AAED,wBAAgB,kBAAkB,CAChC,IAAI,EAAE,eAAe,GAAG,WAAW,GAAG,IAAI,GAAG,SAAS,GACrD,IAAI,IAAI,eAAe,CAEzB"}
@@ -2,6 +2,7 @@
2
2
 
3
3
  import { jsx as _jsx } from "react/jsx-runtime";
4
4
  import ObjectID from 'bson-objectid';
5
+ import { $applyNodeReplacement } from 'lexical';
5
6
  import React from 'react';
6
7
  import { ServerInlineBlockNode } from '../../server/nodes/InlineBlocksNode.js';
7
8
  const InlineBlockComponent = /*#__PURE__*/React.lazy(() => import('../componentInline/index.js').then(module => ({
@@ -18,9 +19,10 @@ export class InlineBlockNode extends ServerInlineBlockNode {
18
19
  const node = $createInlineBlockNode(serializedNode.fields);
19
20
  return node;
20
21
  }
21
- decorate(editor, config) {
22
+ decorate(_editor, config) {
22
23
  return /*#__PURE__*/_jsx(InlineBlockComponent, {
23
24
  cacheBuster: this.getCacheBuster(),
25
+ className: config.theme.inlineBlock ?? 'LexicalEditorTheme__inlineBlock',
24
26
  formData: this.getFields(),
25
27
  nodeKey: this.getKey()
26
28
  });
@@ -30,12 +32,12 @@ export class InlineBlockNode extends ServerInlineBlockNode {
30
32
  }
31
33
  }
32
34
  export function $createInlineBlockNode(fields) {
33
- return new InlineBlockNode({
35
+ return $applyNodeReplacement(new InlineBlockNode({
34
36
  fields: {
35
37
  ...fields,
36
38
  id: fields?.id || new ObjectID.default().toHexString()
37
39
  }
38
- });
40
+ }));
39
41
  }
40
42
  export function $isInlineBlockNode(node) {
41
43
  return node instanceof InlineBlockNode;
@@ -1 +1 @@
1
- {"version":3,"file":"InlineBlocksNode.js","names":["ObjectID","React","ServerInlineBlockNode","InlineBlockComponent","lazy","then","module","default","InlineBlockNode","clone","node","getType","importJSON","serializedNode","$createInlineBlockNode","fields","decorate","editor","config","_jsx","cacheBuster","getCacheBuster","formData","getFields","nodeKey","getKey","exportJSON","id","toHexString","$isInlineBlockNode"],"sources":["../../../../../src/features/blocks/client/nodes/InlineBlocksNode.tsx"],"sourcesContent":["'use client'\nimport type { EditorConfig, LexicalEditor, LexicalNode } from 'lexical'\n\nimport ObjectID from 'bson-objectid'\nimport React, { type JSX } from 'react'\n\nimport type {\n InlineBlockFields,\n SerializedInlineBlockNode,\n} from '../../server/nodes/InlineBlocksNode.js'\n\nimport { ServerInlineBlockNode } from '../../server/nodes/InlineBlocksNode.js'\n\nconst InlineBlockComponent = React.lazy(() =>\n import('../componentInline/index.js').then((module) => ({\n default: module.InlineBlockComponent,\n })),\n)\n\nexport class InlineBlockNode extends ServerInlineBlockNode {\n static override clone(node: ServerInlineBlockNode): ServerInlineBlockNode {\n return super.clone(node)\n }\n\n static override getType(): string {\n return super.getType()\n }\n\n static override importJSON(serializedNode: SerializedInlineBlockNode): InlineBlockNode {\n const node = $createInlineBlockNode(serializedNode.fields)\n return node\n }\n\n override decorate(editor: LexicalEditor, config: EditorConfig): JSX.Element {\n return (\n <InlineBlockComponent\n cacheBuster={this.getCacheBuster()}\n formData={this.getFields()}\n nodeKey={this.getKey()}\n />\n )\n }\n\n override exportJSON(): SerializedInlineBlockNode {\n return super.exportJSON()\n }\n}\n\nexport function $createInlineBlockNode(fields: Exclude<InlineBlockFields, 'id'>): InlineBlockNode {\n return new InlineBlockNode({\n fields: {\n ...fields,\n id: fields?.id || new ObjectID.default().toHexString(),\n },\n })\n}\n\nexport function $isInlineBlockNode(\n node: InlineBlockNode | LexicalNode | null | undefined,\n): node is InlineBlockNode {\n return node instanceof InlineBlockNode\n}\n"],"mappings":"AAAA;;;AAGA,OAAOA,QAAA,MAAc;AACrB,OAAOC,KAAA,MAAyB;AAOhC,SAASC,qBAAqB,QAAQ;AAEtC,MAAMC,oBAAA,gBAAuBF,KAAA,CAAMG,IAAI,CAAC,MACtC,MAAM,CAAC,+BAA+BC,IAAI,CAAEC,MAAA,KAAY;EACtDC,OAAA,EAASD,MAAA,CAAOH;AAClB;AAGF,OAAO,MAAMK,eAAA,SAAwBN,qBAAA;EACnC,OAAgBO,MAAMC,IAA2B,EAAyB;IACxE,OAAO,KAAK,CAACD,KAAA,CAAMC,IAAA;EACrB;EAEA,OAAgBC,QAAA,EAAkB;IAChC,OAAO,KAAK,CAACA,OAAA;EACf;EAEA,OAAgBC,WAAWC,cAAyC,EAAmB;IACrF,MAAMH,IAAA,GAAOI,sBAAA,CAAuBD,cAAA,CAAeE,MAAM;IACzD,OAAOL,IAAA;EACT;EAESM,SAASC,MAAqB,EAAEC,MAAoB,EAAe;IAC1E,oBACEC,IAAA,CAAChB,oBAAA;MACCiB,WAAA,EAAa,IAAI,CAACC,cAAc;MAChCC,QAAA,EAAU,IAAI,CAACC,SAAS;MACxBC,OAAA,EAAS,IAAI,CAACC,MAAM;;EAG1B;EAESC,WAAA,EAAwC;IAC/C,OAAO,KAAK,CAACA,UAAA;EACf;AACF;AAEA,OAAO,SAASZ,uBAAuBC,MAAwC;EAC7E,OAAO,IAAIP,eAAA,CAAgB;IACzBO,MAAA,EAAQ;MACN,GAAGA,MAAM;MACTY,EAAA,EAAIZ,MAAA,EAAQY,EAAA,IAAM,IAAI3B,QAAA,CAASO,OAAO,GAAGqB,WAAW;IACtD;EACF;AACF;AAEA,OAAO,SAASC,mBACdnB,IAAsD;EAEtD,OAAOA,IAAA,YAAgBF,eAAA;AACzB","ignoreList":[]}
1
+ {"version":3,"file":"InlineBlocksNode.js","names":["ObjectID","$applyNodeReplacement","React","ServerInlineBlockNode","InlineBlockComponent","lazy","then","module","default","InlineBlockNode","clone","node","getType","importJSON","serializedNode","$createInlineBlockNode","fields","decorate","_editor","config","_jsx","cacheBuster","getCacheBuster","className","theme","inlineBlock","formData","getFields","nodeKey","getKey","exportJSON","id","toHexString","$isInlineBlockNode"],"sources":["../../../../../src/features/blocks/client/nodes/InlineBlocksNode.tsx"],"sourcesContent":["'use client'\nimport ObjectID from 'bson-objectid'\nimport {\n $applyNodeReplacement,\n type EditorConfig,\n type LexicalEditor,\n type LexicalNode,\n} from 'lexical'\nimport React, { type JSX } from 'react'\n\nimport type {\n InlineBlockFields,\n SerializedInlineBlockNode,\n} from '../../server/nodes/InlineBlocksNode.js'\n\nimport { ServerInlineBlockNode } from '../../server/nodes/InlineBlocksNode.js'\n\nconst InlineBlockComponent = React.lazy(() =>\n import('../componentInline/index.js').then((module) => ({\n default: module.InlineBlockComponent,\n })),\n)\n\nexport class InlineBlockNode extends ServerInlineBlockNode {\n static override clone(node: ServerInlineBlockNode): ServerInlineBlockNode {\n return super.clone(node)\n }\n\n static override getType(): string {\n return super.getType()\n }\n\n static override importJSON(serializedNode: SerializedInlineBlockNode): InlineBlockNode {\n const node = $createInlineBlockNode(serializedNode.fields)\n return node\n }\n\n override decorate(_editor: LexicalEditor, config: EditorConfig): JSX.Element {\n return (\n <InlineBlockComponent\n cacheBuster={this.getCacheBuster()}\n className={config.theme.inlineBlock ?? 'LexicalEditorTheme__inlineBlock'}\n formData={this.getFields()}\n nodeKey={this.getKey()}\n />\n )\n }\n\n override exportJSON(): SerializedInlineBlockNode {\n return super.exportJSON()\n }\n}\n\nexport function $createInlineBlockNode(fields: Exclude<InlineBlockFields, 'id'>): InlineBlockNode {\n return $applyNodeReplacement(\n new InlineBlockNode({\n fields: {\n ...fields,\n id: fields?.id || new ObjectID.default().toHexString(),\n },\n }),\n )\n}\n\nexport function $isInlineBlockNode(\n node: InlineBlockNode | LexicalNode | null | undefined,\n): node is InlineBlockNode {\n return node instanceof InlineBlockNode\n}\n"],"mappings":"AAAA;;;AACA,OAAOA,QAAA,MAAc;AACrB,SACEC,qBAAqB,QAIhB;AACP,OAAOC,KAAA,MAAyB;AAOhC,SAASC,qBAAqB,QAAQ;AAEtC,MAAMC,oBAAA,gBAAuBF,KAAA,CAAMG,IAAI,CAAC,MACtC,MAAM,CAAC,+BAA+BC,IAAI,CAAEC,MAAA,KAAY;EACtDC,OAAA,EAASD,MAAA,CAAOH;AAClB;AAGF,OAAO,MAAMK,eAAA,SAAwBN,qBAAA;EACnC,OAAgBO,MAAMC,IAA2B,EAAyB;IACxE,OAAO,KAAK,CAACD,KAAA,CAAMC,IAAA;EACrB;EAEA,OAAgBC,QAAA,EAAkB;IAChC,OAAO,KAAK,CAACA,OAAA;EACf;EAEA,OAAgBC,WAAWC,cAAyC,EAAmB;IACrF,MAAMH,IAAA,GAAOI,sBAAA,CAAuBD,cAAA,CAAeE,MAAM;IACzD,OAAOL,IAAA;EACT;EAESM,SAASC,OAAsB,EAAEC,MAAoB,EAAe;IAC3E,oBACEC,IAAA,CAAChB,oBAAA;MACCiB,WAAA,EAAa,IAAI,CAACC,cAAc;MAChCC,SAAA,EAAWJ,MAAA,CAAOK,KAAK,CAACC,WAAW,IAAI;MACvCC,QAAA,EAAU,IAAI,CAACC,SAAS;MACxBC,OAAA,EAAS,IAAI,CAACC,MAAM;;EAG1B;EAESC,WAAA,EAAwC;IAC/C,OAAO,KAAK,CAACA,UAAA;EACf;AACF;AAEA,OAAO,SAASf,uBAAuBC,MAAwC;EAC7E,OAAOf,qBAAA,CACL,IAAIQ,eAAA,CAAgB;IAClBO,MAAA,EAAQ;MACN,GAAGA,MAAM;MACTe,EAAA,EAAIf,MAAA,EAAQe,EAAA,IAAM,IAAI/B,QAAA,CAASQ,OAAO,GAAGwB,WAAW;IACtD;EACF;AAEJ;AAEA,OAAO,SAASC,mBACdtB,IAAsD;EAEtD,OAAOA,IAAA,YAAgBF,eAAA;AACzB","ignoreList":[]}
@@ -1,8 +1,8 @@
1
1
  import type { SerializedDecoratorBlockNode } from '@lexical/react/LexicalDecoratorBlockNode.js';
2
- import type { DOMConversionMap, DOMExportOutput, EditorConfig, ElementFormatType, LexicalEditor, LexicalNode, NodeKey } from 'lexical';
3
2
  import type { JsonObject } from 'payload';
4
3
  import type { JSX } from 'react';
5
4
  import { DecoratorBlockNode } from '@lexical/react/LexicalDecoratorBlockNode.js';
5
+ import { type DOMConversionMap, type DOMExportOutput, type EditorConfig, type ElementFormatType, type LexicalEditor, type LexicalNode, type NodeKey } from 'lexical';
6
6
  import type { StronglyTypedLeafNode } from '../../../../nodeTypes.js';
7
7
  type BaseBlockFields<TBlockFields extends JsonObject = JsonObject> = {
8
8
  /** Block form data */
@@ -32,6 +32,7 @@ export declare class ServerBlockNode extends DecoratorBlockNode {
32
32
  static importDOM(): DOMConversionMap<HTMLDivElement> | null;
33
33
  static importJSON(serializedNode: SerializedBlockNode): ServerBlockNode;
34
34
  static isInline(): false;
35
+ createDOM(config?: EditorConfig): HTMLElement;
35
36
  decorate(editor: LexicalEditor, config: EditorConfig): JSX.Element;
36
37
  exportDOM(): DOMExportOutput;
37
38
  exportJSON(): SerializedBlockNode;
@@ -1 +1 @@
1
- {"version":3,"file":"BlocksNode.d.ts","sourceRoot":"","sources":["../../../../../src/features/blocks/server/nodes/BlocksNode.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,6CAA6C,CAAA;AAC/F,OAAO,KAAK,EACV,gBAAgB,EAChB,eAAe,EACf,YAAY,EACZ,iBAAiB,EACjB,aAAa,EACb,WAAW,EACX,OAAO,EACR,MAAM,SAAS,CAAA;AAChB,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAA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AmB;IAS1C,cAAc,IAAI,MAAM;IAIxB,SAAS,IAAI,WAAW;IAIf,cAAc,IAAI,MAAM;IAIjC,SAAS,CAAC,MAAM,EAAE,WAAW,EAAE,sBAAsB,CAAC,EAAE,OAAO,GAAG,IAAI;CAOvE;AAED,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,qBAAqB,GAAG,eAAe,CASrF;AAED,wBAAgB,kBAAkB,CAChC,IAAI,EAAE,WAAW,GAAG,IAAI,GAAG,eAAe,GAAG,SAAS,GACrD,IAAI,IAAI,eAAe,CAEzB"}
@@ -1,5 +1,7 @@
1
1
  import { DecoratorBlockNode } from '@lexical/react/LexicalDecoratorBlockNode.js';
2
+ import { addClassNamesToElement } from '@lexical/utils';
2
3
  import ObjectID from 'bson-objectid';
4
+ import { $applyNodeReplacement } from 'lexical';
3
5
  export class ServerBlockNode extends DecoratorBlockNode {
4
6
  __cacheBuster;
5
7
  __fields;
@@ -45,6 +47,11 @@ export class ServerBlockNode extends DecoratorBlockNode {
45
47
  static isInline() {
46
48
  return false;
47
49
  }
50
+ createDOM(config) {
51
+ const element = document.createElement('div');
52
+ addClassNamesToElement(element, config?.theme?.block);
53
+ return element;
54
+ }
48
55
  decorate(editor, config) {
49
56
  return null;
50
57
  }
@@ -82,12 +89,12 @@ export class ServerBlockNode extends DecoratorBlockNode {
82
89
  }
83
90
  }
84
91
  export function $createServerBlockNode(fields) {
85
- return new ServerBlockNode({
92
+ return $applyNodeReplacement(new ServerBlockNode({
86
93
  fields: {
87
94
  ...fields,
88
95
  id: fields?.id || new ObjectID.default().toHexString()
89
96
  }
90
- });
97
+ }));
91
98
  }
92
99
  export function $isServerBlockNode(node) {
93
100
  return node instanceof ServerBlockNode;
@@ -1 +1 @@
1
- {"version":3,"file":"BlocksNode.js","names":["DecoratorBlockNode","ObjectID","ServerBlockNode","__cacheBuster","__fields","constructor","cacheBuster","fields","format","key","clone","node","__format","__key","getType","importDOM","importJSON","serializedNode","version","data","$createServerBlockNode","setFormat","isInline","decorate","editor","config","exportDOM","element","document","createElement","text","createTextNode","getTextContent","append","exportJSON","type","getFields","getCacheBuster","getLatest","setFields","preventFormStateUpdate","writable","getWritable","id","default","toHexString","$isServerBlockNode"],"sources":["../../../../../src/features/blocks/server/nodes/BlocksNode.tsx"],"sourcesContent":["import type { SerializedDecoratorBlockNode } from '@lexical/react/LexicalDecoratorBlockNode.js'\nimport type {\n DOMConversionMap,\n DOMExportOutput,\n EditorConfig,\n ElementFormatType,\n LexicalEditor,\n LexicalNode,\n NodeKey,\n} from 'lexical'\nimport type { JsonObject } from 'payload'\nimport type { JSX } from 'react'\n\nimport { DecoratorBlockNode } from '@lexical/react/LexicalDecoratorBlockNode.js'\nimport ObjectID from 'bson-objectid'\n\nimport type { StronglyTypedLeafNode } from '../../../../nodeTypes.js'\n\ntype BaseBlockFields<TBlockFields extends JsonObject = JsonObject> = {\n /** Block form data */\n blockName: string\n blockType: string\n} & TBlockFields\n\nexport type BlockFields<TBlockFields extends JsonObject = JsonObject> = {\n id: string\n} & BaseBlockFields<TBlockFields>\n\nexport type BlockFieldsOptionalID<TBlockFields extends JsonObject = JsonObject> = {\n id?: string\n} & BaseBlockFields<TBlockFields>\n\nexport type SerializedBlockNode<TBlockFields extends JsonObject = JsonObject> = {\n fields: BlockFields<TBlockFields>\n} & StronglyTypedLeafNode<SerializedDecoratorBlockNode, 'block'>\n\nexport class ServerBlockNode extends DecoratorBlockNode {\n __cacheBuster: number\n __fields: BlockFields\n\n constructor({\n cacheBuster,\n fields,\n format,\n key,\n }: {\n cacheBuster?: number\n fields: BlockFields\n format?: ElementFormatType\n key?: NodeKey\n }) {\n super(format, key)\n this.__fields = fields\n this.__cacheBuster = cacheBuster || 0\n }\n\n static override clone(node: ServerBlockNode): ServerBlockNode {\n return new this({\n cacheBuster: node.__cacheBuster,\n fields: node.__fields,\n format: node.__format,\n key: node.__key,\n })\n }\n\n static override getType(): string {\n return 'block'\n }\n\n static override importDOM(): DOMConversionMap<HTMLDivElement> | null {\n return {}\n }\n\n static override importJSON(serializedNode: SerializedBlockNode): ServerBlockNode {\n if (serializedNode.version === 1) {\n // Convert (version 1 had the fields wrapped in another, unnecessary data property)\n serializedNode = {\n ...serializedNode,\n fields: {\n ...(serializedNode as any).fields.data,\n },\n version: 2,\n }\n }\n const node = $createServerBlockNode(serializedNode.fields)\n node.setFormat(serializedNode.format)\n return node\n }\n\n static isInline(): false {\n return false\n }\n\n override decorate(editor: LexicalEditor, config: EditorConfig): JSX.Element {\n return null as unknown as JSX.Element\n }\n\n override exportDOM(): DOMExportOutput {\n const element = document.createElement('div')\n\n const text = document.createTextNode(this.getTextContent())\n element.append(text)\n return { element }\n }\n\n override exportJSON(): SerializedBlockNode {\n return {\n ...super.exportJSON(),\n type: 'block',\n fields: this.getFields(),\n version: 2,\n }\n }\n\n getCacheBuster(): number {\n return this.getLatest().__cacheBuster\n }\n\n getFields(): BlockFields {\n return this.getLatest().__fields\n }\n\n override getTextContent(): string {\n return `Block Field`\n }\n\n setFields(fields: BlockFields, preventFormStateUpdate?: boolean): void {\n const writable = this.getWritable()\n writable.__fields = fields\n if (!preventFormStateUpdate) {\n writable.__cacheBuster++\n }\n }\n}\n\nexport function $createServerBlockNode(fields: BlockFieldsOptionalID): ServerBlockNode {\n return new ServerBlockNode({\n fields: {\n ...fields,\n id: fields?.id || new ObjectID.default().toHexString(),\n },\n })\n}\n\nexport function $isServerBlockNode(\n node: LexicalNode | null | ServerBlockNode | undefined,\n): node is ServerBlockNode {\n return node instanceof ServerBlockNode\n}\n"],"mappings":"AAaA,SAASA,kBAAkB,QAAQ;AACnC,OAAOC,QAAA,MAAc;AAsBrB,OAAO,MAAMC,eAAA,SAAwBF,kBAAA;EACnCG,aAAA;EACAC,QAAA;EAEAC,YAAY;IACVC,WAAW;IACXC,MAAM;IACNC,MAAM;IACNC;EAAG,CAMJ,EAAE;IACD,KAAK,CAACD,MAAA,EAAQC,GAAA;IACd,IAAI,CAACL,QAAQ,GAAGG,MAAA;IA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IAAI,CAACC,SAAS,GAAGnC,aAAa;EACvC;EAEAiC,UAAA,EAAyB;IACvB,OAAO,IAAI,CAACE,SAAS,GAAGlC,QAAQ;EAClC;EAES4B,eAAA,EAAyB;IAChC,OAAO,aAAa;EACtB;EAEAO,UAAUhC,MAAmB,EAAEiC,sBAAgC,EAAQ;IACrE,MAAMC,QAAA,GAAW,IAAI,CAACC,WAAW;IACjCD,QAAA,CAASrC,QAAQ,GAAGG,MAAA;IACpB,IAAI,CAACiC,sBAAA,EAAwB;MAC3BC,QAAA,CAAStC,aAAa;IACxB;EACF;AACF;AAEA,OAAO,SAASiB,uBAAuBb,MAA6B;EAClE,OAAO,IAAIL,eAAA,CAAgB;IACzBK,MAAA,EAAQ;MACN,GAAGA,MAAM;MACToC,EAAA,EAAIpC,MAAA,EAAQoC,EAAA,IAAM,IAAI1C,QAAA,CAAS2C,OAAO,GAAGC,WAAW;IACtD;EACF;AACF;AAEA,OAAO,SAASC,mBACdnC,IAAsD;EAEtD,OAAOA,IAAA,YAAgBT,eAAA;AACzB","ignoreList":[]}
1
+ {"version":3,"file":"BlocksNode.js","names":["DecoratorBlockNode","addClassNamesToElement","ObjectID","$applyNodeReplacement","ServerBlockNode","__cacheBuster","__fields","constructor","cacheBuster","fields","format","key","clone","node","__format","__key","getType","importDOM","importJSON","serializedNode","version","data","$createServerBlockNode","setFormat","isInline","createDOM","config","element","document","createElement","theme","block","decorate","editor","exportDOM","text","createTextNode","getTextContent","append","exportJSON","type","getFields","getCacheBuster","getLatest","setFields","preventFormStateUpdate","writable","getWritable","id","default","toHexString","$isServerBlockNode"],"sources":["../../../../../src/features/blocks/server/nodes/BlocksNode.tsx"],"sourcesContent":["import type { SerializedDecoratorBlockNode } from '@lexical/react/LexicalDecoratorBlockNode.js'\nimport type { JsonObject } from 'payload'\nimport type { JSX } from 'react'\n\nimport { DecoratorBlockNode } from '@lexical/react/LexicalDecoratorBlockNode.js'\nimport { addClassNamesToElement } from '@lexical/utils'\nimport ObjectID from 'bson-objectid'\nimport {\n $applyNodeReplacement,\n type DOMConversionMap,\n type DOMExportOutput,\n type EditorConfig,\n type ElementFormatType,\n type LexicalEditor,\n type LexicalNode,\n type NodeKey,\n} from 'lexical'\n\nimport type { StronglyTypedLeafNode } from '../../../../nodeTypes.js'\n\ntype BaseBlockFields<TBlockFields extends JsonObject = JsonObject> = {\n /** Block form data */\n blockName: string\n blockType: string\n} & TBlockFields\n\nexport type BlockFields<TBlockFields extends JsonObject = JsonObject> = {\n id: string\n} & BaseBlockFields<TBlockFields>\n\nexport type BlockFieldsOptionalID<TBlockFields extends JsonObject = JsonObject> = {\n id?: string\n} & BaseBlockFields<TBlockFields>\n\nexport type SerializedBlockNode<TBlockFields extends JsonObject = JsonObject> = {\n fields: BlockFields<TBlockFields>\n} & StronglyTypedLeafNode<SerializedDecoratorBlockNode, 'block'>\n\nexport class ServerBlockNode extends DecoratorBlockNode {\n __cacheBuster: number\n __fields: BlockFields\n\n constructor({\n cacheBuster,\n fields,\n format,\n key,\n }: {\n cacheBuster?: number\n fields: BlockFields\n format?: ElementFormatType\n key?: NodeKey\n }) {\n super(format, key)\n this.__fields = fields\n this.__cacheBuster = cacheBuster || 0\n }\n\n static override clone(node: ServerBlockNode): ServerBlockNode {\n return new this({\n cacheBuster: node.__cacheBuster,\n fields: node.__fields,\n format: node.__format,\n key: node.__key,\n })\n }\n\n static override getType(): string {\n return 'block'\n }\n\n static override importDOM(): DOMConversionMap<HTMLDivElement> | null {\n return {}\n }\n\n static override importJSON(serializedNode: SerializedBlockNode): ServerBlockNode {\n if (serializedNode.version === 1) {\n // Convert (version 1 had the fields wrapped in another, unnecessary data property)\n serializedNode = {\n ...serializedNode,\n fields: {\n ...(serializedNode as any).fields.data,\n },\n version: 2,\n }\n }\n const node = $createServerBlockNode(serializedNode.fields)\n node.setFormat(serializedNode.format)\n return node\n }\n\n static isInline(): false {\n return false\n }\n\n override createDOM(config?: EditorConfig): HTMLElement {\n const element = document.createElement('div')\n addClassNamesToElement(element, config?.theme?.block)\n return element\n }\n\n override decorate(editor: LexicalEditor, config: EditorConfig): JSX.Element {\n return null as unknown as JSX.Element\n }\n\n override exportDOM(): DOMExportOutput {\n const element = document.createElement('div')\n\n const text = document.createTextNode(this.getTextContent())\n element.append(text)\n return { element }\n }\n\n override exportJSON(): SerializedBlockNode {\n return {\n ...super.exportJSON(),\n type: 'block',\n fields: this.getFields(),\n version: 2,\n }\n }\n\n getCacheBuster(): number {\n return this.getLatest().__cacheBuster\n }\n\n getFields(): BlockFields {\n return this.getLatest().__fields\n }\n\n override getTextContent(): string {\n return `Block Field`\n }\n\n setFields(fields: BlockFields, preventFormStateUpdate?: boolean): void {\n const writable = this.getWritable()\n writable.__fields = fields\n if (!preventFormStateUpdate) {\n writable.__cacheBuster++\n }\n }\n}\n\nexport function $createServerBlockNode(fields: BlockFieldsOptionalID): ServerBlockNode {\n return $applyNodeReplacement(\n new ServerBlockNode({\n fields: {\n ...fields,\n id: fields?.id || new ObjectID.default().toHexString(),\n },\n }),\n )\n}\n\nexport function $isServerBlockNode(\n node: LexicalNode | null | ServerBlockNode | undefined,\n): node is ServerBlockNode {\n return node instanceof ServerBlockNode\n}\n"],"mappings":"AAIA,SAASA,kBAAkB,QAAQ;AACnC,SAASC,sBAAsB,QAAQ;AACvC,OAAOC,QAAA,MAAc;AACrB,SACEC,qBAAqB,QAQhB;AAsBP,OAAO,MAAMC,eAAA,SAAwBJ,kBAAA;EACnCK,aAAA;EACAC,QAAA;EAEAC,YAAY;IACVC,WAAW;IACXC,MAAM;IACNC,MAAM;IACNC;EAAG,CAMJ,EAAE;IACD,KAAK,CAACD,MAAA,EAAQC,GAAA;IACd,IAAI,CAACL,QAAQ,GAAGG,MAAA;IAChB,IAAI,CAACJ,aAAa,GAAGG,WAAA,IAAe;EACtC;EAEA,OAAgBI,MAAMC,IAAqB,EAAmB;IAC5D,OAAO,IAAI,IAAI,CAAC;MACdL,WAAA,EAAaK,IAAA,CAAKR,aAAa;MAC/BI,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ACvB,OAAO,IAAI,CAACC,SAAS,GAAGtC,aAAa;EACvC;EAEAoC,UAAA,EAAyB;IACvB,OAAO,IAAI,CAACE,SAAS,GAAGrC,QAAQ;EAClC;EAES+B,eAAA,EAAyB;IAChC,OAAO,aAAa;EACtB;EAEAO,UAAUnC,MAAmB,EAAEoC,sBAAgC,EAAQ;IACrE,MAAMC,QAAA,GAAW,IAAI,CAACC,WAAW;IACjCD,QAAA,CAASxC,QAAQ,GAAGG,MAAA;IACpB,IAAI,CAACoC,sBAAA,EAAwB;MAC3BC,QAAA,CAASzC,aAAa;IACxB;EACF;AACF;AAEA,OAAO,SAASiB,uBAAuBb,MAA6B;EAClE,OAAON,qBAAA,CACL,IAAIC,eAAA,CAAgB;IAClBK,MAAA,EAAQ;MACN,GAAGA,MAAM;MACTuC,EAAA,EAAIvC,MAAA,EAAQuC,EAAA,IAAM,IAAI9C,QAAA,CAAS+C,OAAO,GAAGC,WAAW;IACtD;EACF;AAEJ;AAEA,OAAO,SAASC,mBACdtC,IAAsD;EAEtD,OAAOA,IAAA,YAAgBT,eAAA;AACzB","ignoreList":[]}
@@ -25,7 +25,7 @@ export declare class ServerInlineBlockNode extends DecoratorNode<null | React.Re
25
25
  static importJSON(serializedNode: SerializedInlineBlockNode): ServerInlineBlockNode;
26
26
  static isInline(): false;
27
27
  canIndent(): boolean;
28
- createDOM(): HTMLSpanElement;
28
+ createDOM(config?: EditorConfig): HTMLElement;
29
29
  decorate(editor: LexicalEditor, config: EditorConfig): JSX.Element | null;
30
30
  exportDOM(): DOMExportOutput;
31
31
  exportJSON(): SerializedInlineBlockNode;
@@ -1 +1 @@
1
- {"version":3,"file":"InlineBlocksNode.d.ts","sourceRoot":"","sources":["../../../../../src/features/blocks/server/nodes/InlineBlocksNode.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,gBAAgB,EAChB,eAAe,EACf,YAAY,EACZ,aAAa,EACb,WAAW,EACX,OAAO,EACP,qBAAqB,EACtB,MAAM,SAAS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AqB,GAAG,SAAS,GAC3D,IAAI,IAAI,qBAAqB,CAE/B"}
@@ -1,5 +1,6 @@
1
+ import { addClassNamesToElement } from '@lexical/utils';
1
2
  import ObjectID from 'bson-objectid';
2
- import { DecoratorNode } from 'lexical';
3
+ import { $applyNodeReplacement, DecoratorNode } from 'lexical';
3
4
  export class ServerInlineBlockNode extends DecoratorNode {
4
5
  __cacheBuster;
5
6
  __fields;
@@ -35,9 +36,9 @@ export class ServerInlineBlockNode extends DecoratorNode {
35
36
  canIndent() {
36
37
  return true;
37
38
  }
38
- createDOM() {
39
+ createDOM(config) {
39
40
  const element = document.createElement('span');
40
- element.classList.add('inline-block-container');
41
+ addClassNamesToElement(element, config?.theme?.inlineBlock);
41
42
  return element;
42
43
  }
43
44
  decorate(editor, config) {
@@ -83,12 +84,12 @@ export class ServerInlineBlockNode extends DecoratorNode {
83
84
  }
84
85
  }
85
86
  export function $createServerInlineBlockNode(fields) {
86
- return new ServerInlineBlockNode({
87
+ return $applyNodeReplacement(new ServerInlineBlockNode({
87
88
  fields: {
88
89
  ...fields,
89
90
  id: fields?.id || new ObjectID.default().toHexString()
90
91
  }
91
- });
92
+ }));
92
93
  }
93
94
  export function $isServerInlineBlockNode(node) {
94
95
  return node instanceof ServerInlineBlockNode;
@@ -1 +1 @@
1
- {"version":3,"file":"InlineBlocksNode.js","names":["ObjectID","DecoratorNode","ServerInlineBlockNode","__cacheBuster","__fields","constructor","cacheBuster","fields","key","clone","node","__key","getType","importDOM","importJSON","serializedNode","$createServerInlineBlockNode","isInline","canIndent","createDOM","element","document","createElement","classList","add","decorate","editor","config","exportDOM","text","createTextNode","getTextContent","append","exportJSON","type","getFields","version","getCacheBuster","getLatest","setFields","preventFormStateUpdate","writable","getWritable","updateDOM","id","default","toHexString","$isServerInlineBlockNode"],"sources":["../../../../../src/features/blocks/server/nodes/InlineBlocksNode.tsx"],"sourcesContent":["import type {\n DOMConversionMap,\n DOMExportOutput,\n EditorConfig,\n LexicalEditor,\n LexicalNode,\n NodeKey,\n SerializedLexicalNode,\n} from 'lexical'\nimport type { JsonObject } from 'payload'\nimport type React from 'react'\nimport type { JSX } from 'react'\n\nimport ObjectID from 'bson-objectid'\nimport { DecoratorNode } from 'lexical'\n\nimport type { StronglyTypedLeafNode } from '../../../../nodeTypes.js'\n\nexport type InlineBlockFields<TInlineBlockFields extends JsonObject = JsonObject> = {\n blockType: string\n id: string\n} & TInlineBlockFields\n\nexport type SerializedInlineBlockNode<TBlockFields extends JsonObject = JsonObject> = {\n fields: InlineBlockFields<TBlockFields>\n} & StronglyTypedLeafNode<SerializedLexicalNode, 'inlineBlock'>\n\nexport class ServerInlineBlockNode extends DecoratorNode<null | React.ReactElement> {\n __cacheBuster: number\n __fields: InlineBlockFields\n\n constructor({\n cacheBuster,\n fields,\n key,\n }: {\n cacheBuster?: number\n fields: InlineBlockFields\n key?: NodeKey\n }) {\n super(key)\n this.__fields = fields\n this.__cacheBuster = cacheBuster || 0\n }\n\n static override clone(node: ServerInlineBlockNode): ServerInlineBlockNode {\n return new this({\n cacheBuster: node.__cacheBuster,\n fields: node.__fields,\n key: node.__key,\n })\n }\n\n static override getType(): string {\n return 'inlineBlock'\n }\n\n static override importDOM(): DOMConversionMap<HTMLDivElement> | null {\n return {}\n }\n\n static override importJSON(serializedNode: SerializedInlineBlockNode): ServerInlineBlockNode {\n const node = $createServerInlineBlockNode(serializedNode.fields)\n return node\n }\n\n static isInline(): false {\n return false\n }\n\n canIndent() {\n return true\n }\n override createDOM() {\n const element = document.createElement('span')\n element.classList.add('inline-block-container')\n\n return element\n }\n\n override decorate(editor: LexicalEditor, config: EditorConfig): JSX.Element | null {\n return null\n }\n\n override exportDOM(): DOMExportOutput {\n const element = document.createElement('span')\n element.classList.add('inline-block-container')\n\n const text = document.createTextNode(this.getTextContent())\n element.append(text)\n return { element }\n }\n\n override exportJSON(): SerializedInlineBlockNode {\n return {\n type: 'inlineBlock',\n fields: this.getFields(),\n version: 1,\n }\n }\n\n getCacheBuster(): number {\n return this.getLatest().__cacheBuster\n }\n\n getFields(): InlineBlockFields {\n return this.getLatest().__fields\n }\n\n override getTextContent(): string {\n return `Block Field`\n }\n\n override isInline() {\n return true\n }\n\n setFields(fields: InlineBlockFields, preventFormStateUpdate?: boolean): void {\n const writable = this.getWritable()\n writable.__fields = fields\n if (!preventFormStateUpdate) {\n writable.__cacheBuster++\n }\n }\n\n override updateDOM(): boolean {\n return false\n }\n}\n\nexport function $createServerInlineBlockNode(\n fields: Exclude<InlineBlockFields, 'id'>,\n): ServerInlineBlockNode {\n return new ServerInlineBlockNode({\n fields: {\n ...fields,\n id: fields?.id || new ObjectID.default().toHexString(),\n },\n })\n}\n\nexport function $isServerInlineBlockNode(\n node: LexicalNode | null | ServerInlineBlockNode | undefined,\n): node is ServerInlineBlockNode {\n return node instanceof ServerInlineBlockNode\n}\n"],"mappings":"AAaA,OAAOA,QAAA,MAAc;AACrB,SAASC,aAAa,QAAQ;AAa9B,OAAO,MAAMC,qBAAA,SAA8BD,aAAA;EACzCE,aAAA;EACAC,QAAA;EAEAC,YAAY;IACVC,WAAW;IACXC,MAAM;IACNC;EAAG,CAKJ,EAAE;IACD,KAAK,CAACA,GAAA;IACN,IAAI,CAACJ,QAAQ,GAAGG,MAAA;IAChB,IAAI,CAACJ,aAAa,GAAGG,WAAA,IAAe;EACtC;EAEA,OAAgBG,MAAMC,IAA2B,EAAyB;IACxE,OAAO,IAAI,IAAI,CAAC;MACdJ,WAAA,EAAaI,IAAA,CAAKP,aAAa;MAC/BI,MAAA,EAAQG,IAAA,CAAKN,QAAQ;MACrBI,GAAA,EAAKE,IAAA,CAAKC;IACZ;EACF;EAEA,OAAgBC,QAAA,EAAkB;IAChC,OAAO;EACT;EAEA,OAAgBC,UAAA,EAAqD;IACnE,OAAO,CAAC;EACV;EAEA,OAAgBC,WAAWC,cAAyC,EAAyB;IAC3F,MAAML,IAAA,GAAOM,4BAAA,CAA6BD,cAAA,CAAeR,MAAM;IAC/D,OAAOG,IAAA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AAM;MACTqC,EAAA,EAAIrC,MAAA,EAAQqC,EAAA,IAAM,IAAI5C,QAAA,CAAS6C,OAAO,GAAGC,WAAW;IACtD;EACF;AACF;AAEA,OAAO,SAASC,yBACdrC,IAA4D;EAE5D,OAAOA,IAAA,YAAgBR,qBAAA;AACzB","ignoreList":[]}
1
+ {"version":3,"file":"InlineBlocksNode.js","names":["addClassNamesToElement","ObjectID","$applyNodeReplacement","DecoratorNode","ServerInlineBlockNode","__cacheBuster","__fields","constructor","cacheBuster","fields","key","clone","node","__key","getType","importDOM","importJSON","serializedNode","$createServerInlineBlockNode","isInline","canIndent","createDOM","config","element","document","createElement","theme","inlineBlock","decorate","editor","exportDOM","classList","add","text","createTextNode","getTextContent","append","exportJSON","type","getFields","version","getCacheBuster","getLatest","setFields","preventFormStateUpdate","writable","getWritable","updateDOM","id","default","toHexString","$isServerInlineBlockNode"],"sources":["../../../../../src/features/blocks/server/nodes/InlineBlocksNode.tsx"],"sourcesContent":["import type {\n DOMConversionMap,\n DOMExportOutput,\n EditorConfig,\n LexicalEditor,\n LexicalNode,\n NodeKey,\n SerializedLexicalNode,\n} from 'lexical'\nimport type { JsonObject } from 'payload'\nimport type React from 'react'\nimport type { JSX } from 'react'\n\nimport { addClassNamesToElement } from '@lexical/utils'\nimport ObjectID from 'bson-objectid'\nimport { $applyNodeReplacement, DecoratorNode } from 'lexical'\n\nimport type { StronglyTypedLeafNode } from '../../../../nodeTypes.js'\n\nexport type InlineBlockFields<TInlineBlockFields extends JsonObject = JsonObject> = {\n blockType: string\n id: string\n} & TInlineBlockFields\n\nexport type SerializedInlineBlockNode<TBlockFields extends JsonObject = JsonObject> = {\n fields: InlineBlockFields<TBlockFields>\n} & StronglyTypedLeafNode<SerializedLexicalNode, 'inlineBlock'>\n\nexport class ServerInlineBlockNode extends DecoratorNode<null | React.ReactElement> {\n __cacheBuster: number\n __fields: InlineBlockFields\n\n constructor({\n cacheBuster,\n fields,\n key,\n }: {\n cacheBuster?: number\n fields: InlineBlockFields\n key?: NodeKey\n }) {\n super(key)\n this.__fields = fields\n this.__cacheBuster = cacheBuster || 0\n }\n\n static override clone(node: ServerInlineBlockNode): ServerInlineBlockNode {\n return new this({\n cacheBuster: node.__cacheBuster,\n fields: node.__fields,\n key: node.__key,\n })\n }\n\n static override getType(): string {\n return 'inlineBlock'\n }\n\n static override importDOM(): DOMConversionMap<HTMLDivElement> | null {\n return {}\n }\n\n static override importJSON(serializedNode: SerializedInlineBlockNode): ServerInlineBlockNode {\n const node = $createServerInlineBlockNode(serializedNode.fields)\n return node\n }\n\n static isInline(): false {\n return false\n }\n\n canIndent() {\n return true\n }\n\n override createDOM(config?: EditorConfig): HTMLElement {\n const element = document.createElement('span')\n addClassNamesToElement(element, config?.theme?.inlineBlock)\n return element\n }\n\n override decorate(editor: LexicalEditor, config: EditorConfig): JSX.Element | null {\n return null\n }\n\n override exportDOM(): DOMExportOutput {\n const element = document.createElement('span')\n element.classList.add('inline-block-container')\n\n const text = document.createTextNode(this.getTextContent())\n element.append(text)\n return { element }\n }\n\n override exportJSON(): SerializedInlineBlockNode {\n return {\n type: 'inlineBlock',\n fields: this.getFields(),\n version: 1,\n }\n }\n\n getCacheBuster(): number {\n return this.getLatest().__cacheBuster\n }\n\n getFields(): InlineBlockFields {\n return this.getLatest().__fields\n }\n\n override getTextContent(): string {\n return `Block Field`\n }\n\n override isInline() {\n return true\n }\n\n setFields(fields: InlineBlockFields, preventFormStateUpdate?: boolean): void {\n const writable = this.getWritable()\n writable.__fields = fields\n if (!preventFormStateUpdate) {\n writable.__cacheBuster++\n }\n }\n\n override updateDOM(): boolean {\n return false\n }\n}\n\nexport function $createServerInlineBlockNode(\n fields: Exclude<InlineBlockFields, 'id'>,\n): ServerInlineBlockNode {\n return $applyNodeReplacement(\n new ServerInlineBlockNode({\n fields: {\n ...fields,\n id: fields?.id || new ObjectID.default().toHexString(),\n },\n }),\n )\n}\n\nexport function $isServerInlineBlockNode(\n node: LexicalNode | null | ServerInlineBlockN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AAC;IAEtB,MAAMC,IAAA,GAAOT,QAAA,CAASU,cAAc,CAAC,IAAI,CAACC,cAAc;IACxDZ,OAAA,CAAQa,MAAM,CAACH,IAAA;IACf,OAAO;MAAEV;IAAQ;EACnB;EAESc,WAAA,EAAwC;IAC/C,OAAO;MACLC,IAAA,EAAM;MACN7B,MAAA,EAAQ,IAAI,CAAC8B,SAAS;MACtBC,OAAA,EAAS;IACX;EACF;EAEAC,eAAA,EAAyB;IACvB,OAAO,IAAI,CAACC,SAAS,GAAGrC,aAAa;EACvC;EAEAkC,UAAA,EAA+B;IAC7B,OAAO,IAAI,CAACG,SAAS,GAAGpC,QAAQ;EAClC;EAES6B,eAAA,EAAyB;IAChC,OAAO,aAAa;EACtB;EAEShB,SAAA,EAAW;IAClB,OAAO;EACT;EAEAwB,UAAUlC,MAAyB,EAAEmC,sBAAgC,EAAQ;IAC3E,MAAMC,QAAA,GAAW,IAAI,CAACC,WAAW;IACjCD,QAAA,CAASvC,QAAQ,GAAGG,MAAA;IACpB,IAAI,CAACmC,sBAAA,EAAwB;MAC3BC,QAAA,CAASxC,aAAa;IACxB;EACF;EAES0C,UAAA,EAAqB;IAC5B,OAAO;EACT;AACF;AAEA,OAAO,SAAS7B,6BACdT,MAAwC;EAExC,OAAOP,qBAAA,CACL,IAAIE,qBAAA,CAAsB;IACxBK,MAAA,EAAQ;MACN,GAAGA,MAAM;MACTuC,EAAA,EAAIvC,MAAA,EAAQuC,EAAA,IAAM,IAAI/C,QAAA,CAASgD,OAAO,GAAGC,WAAW;IACtD;EACF;AAEJ;AAEA,OAAO,SAASC,yBACdvC,IAA4D;EAE5D,OAAOA,IAAA,YAAgBR,qBAAA;AACzB","ignoreList":[]}
@@ -1,7 +1,7 @@
1
- import type { SerializedEditorState } from 'lexical';
2
1
  import React from 'react';
3
2
  import type { DefaultNodeTypes, SerializedBlockNode, SerializedInlineBlockNode } from '../../../../nodeTypes.js';
4
3
  import type { JSXConverters } from '../converter/types.js';
4
+ import { type ConvertLexicalToJSXArgs } from '../converter/index.js';
5
5
  export type JSXConvertersFunction<T extends {
6
6
  [key: string]: any;
7
7
  type?: string;
@@ -21,23 +21,11 @@ type RichTextProps = {
21
21
  * Custom converters to transform your nodes to JSX. Can be an object or a function that receives the default converters.
22
22
  */
23
23
  converters?: JSXConverters | JSXConvertersFunction;
24
- /**
25
- * Serialized editor state to render.
26
- */
27
- data: SerializedEditorState;
28
24
  /**
29
25
  * If true, removes the container div wrapper.
30
26
  */
31
27
  disableContainer?: boolean;
32
- /**
33
- * If true, disables indentation globally. If an array, disables for specific node `type` values.
34
- */
35
- disableIndent?: boolean | string[];
36
- /**
37
- * If true, disables text alignment globally. If an array, disables for specific node `type` values.
38
- */
39
- disableTextAlign?: boolean | string[];
40
- };
28
+ } & Pick<ConvertLexicalToJSXArgs, 'data' | 'disableIndent' | 'disableTextAlign' | 'nodeMap'>;
41
29
  export declare const RichText: React.FC<RichTextProps>;
42
30
  export {};
43
31
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/features/converters/lexicalToJSX/Component/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAA;AAEpD,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,OAAO,KAAK,EACV,gBAAgB,EAChB,mBAAmB,EACnB,yBAAyB,EAC1B,MAAM,0BAA0B,CAAA;AACjC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAA;AAK1D,MAAM,MAAM,qBAAqB,CAC/B,CAAC,SAAS;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAA;CAAE,GAC3C,gBAAgB,GAChB,mBAAmB,CAAC;IAAE,SAAS,CAAC,EAAE,IAAI,GAAG,MAAM,CAAA;CAAE,CAAC,GAClD,yBAAyB,CAAC;IAAE,SAAS,CAAC,EAAE,IAAI,GAAG,MAAM,CAAA;CAAE,CAAC,IAC1D,CAAC,IAAI,EAAE;IAAE,iBAAiB,EAAE,aAAa,CAAC,gBAAgB,CAAC,CAAA;CAAE,KAAK,aAAa,CAAC,CAAC,CAAC,CAAA;AAEtF,KAAK,aAAa,GAAG;IACnB;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB;;OAEG;IACH,UAAU,CAAC,EAAE,aAAa,GAAG,qBAAqB,CAAA;IAClD;;OAEG;IACH,IAAI,EAAE,qBAAqB,CAAA;IAC3B;;OAEG;IACH,gBAAgB,CAAC,EAAE,OAAO,CAAA;IAC1B;;OAEG;IACH,aAAa,CAAC,EAAE,OAAO,GAAG,MAAM,EAAE,CAAA;IAClC;;OAEG;IACH,gBAAgB,CAAC,EAAE,OAAO,GAAG,MAAM,EAAE,CAAA;CACtC,CAAA;AAED,eAAO,MAAM,QAAQ,EAAE,KAAK,CAAC,EAAE,CAAC,aAAa,CAwC5C,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/features/converters/lexicalToJSX/Component/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,OAAO,KAAK,EACV,gBAAgB,EAChB,mBAAmB,EACnB,yBAAyB,EAC1B,MAAM,0BAA0B,CAAA;AACjC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAA;AAG1D,OAAO,EAAuB,KAAK,uBAAuB,EAAE,MAAM,uBAAuB,CAAA;AAEzF,MAAM,MAAM,qBAAqB,CAC/B,CAAC,SAAS;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAA;CAAE,GAC3C,gBAAgB,GAChB,mBAAmB,CAAC;IAAE,SAAS,CAAC,EAAE,IAAI,GAAG,MAAM,CAAA;CAAE,CAAC,GAClD,yBAAyB,CAAC;IAAE,SAAS,CAAC,EAAE,IAAI,GAAG,MAAM,CAAA;CAAE,CAAC,IAC1D,CAAC,IAAI,EAAE;IAAE,iBAAiB,EAAE,aAAa,CAAC,gBAAgB,CAAC,CAAA;CAAE,KAAK,aAAa,CAAC,CAAC,CAAC,CAAA;AAEtF,KAAK,aAAa,GAAG;IACnB;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB;;OAEG;IACH,UAAU,CAAC,EAAE,aAAa,GAAG,qBAAqB,CAAA;IAElD;;OAEG;IACH,gBAAgB,CAAC,EAAE,OAAO,CAAA;CAC3B,GAAG,IAAI,CAAC,uBAAuB,EAAE,MAAM,GAAG,eAAe,GAAG,kBAAkB,GAAG,SAAS,CAAC,CAAA;AAE5F,eAAO,MAAM,QAAQ,EAAE,KAAK,CAAC,EAAE,CAAC,aAAa,CA0C5C,CAAA"}
@@ -8,7 +8,8 @@ export const RichText = ({
8
8
  data: editorState,
9
9
  disableContainer,
10
10
  disableIndent,
11
- disableTextAlign
11
+ disableTextAlign,
12
+ nodeMap
12
13
  }) => {
13
14
  if (!editorState) {
14
15
  return null;
@@ -29,7 +30,8 @@ export const RichText = ({
29
30
  converters: finalConverters,
30
31
  data: editorState,
31
32
  disableIndent,
32
- disableTextAlign
33
+ disableTextAlign,
34
+ nodeMap
33
35
  });
34
36
  if (disableContainer) {
35
37
  return /*#__PURE__*/_jsx(_Fragment, {
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["React","defaultJSXConverters","convertLexicalToJSX","RichText","className","converters","data","editorState","disableContainer","disableIndent","disableTextAlign","finalConverters","defaultConverters","content","Array","isArray","_jsx","_Fragment"],"sources":["../../../../../src/features/converters/lexicalToJSX/Component/index.tsx"],"sourcesContent":["import type { SerializedEditorState } from 'lexical'\n\nimport React from 'react'\n\nimport type {\n DefaultNodeTypes,\n SerializedBlockNode,\n SerializedInlineBlockNode,\n} from '../../../../nodeTypes.js'\nimport type { JSXConverters } from '../converter/types.js'\n\nimport { defaultJSXConverters } from '../converter/defaultConverters.js'\nimport { convertLexicalToJSX } from '../converter/index.js'\n\nexport type JSXConvertersFunction<\n T extends { [key: string]: any; type?: string } =\n | DefaultNodeTypes\n | SerializedBlockNode<{ blockName?: null | string }>\n | SerializedInlineBlockNode<{ blockName?: null | string }>,\n> = (args: { defaultConverters: JSXConverters<DefaultNodeTypes> }) => JSXConverters<T>\n\ntype RichTextProps = {\n /**\n * Override class names for the container.\n */\n className?: string\n /**\n * Custom converters to transform your nodes to JSX. Can be an object or a function that receives the default converters.\n */\n converters?: JSXConverters | JSXConvertersFunction\n /**\n * Serialized editor state to render.\n */\n data: SerializedEditorState\n /**\n * If true, removes the container div wrapper.\n */\n disableContainer?: boolean\n /**\n * If true, disables indentation globally. If an array, disables for specific node `type` values.\n */\n disableIndent?: boolean | string[]\n /**\n * If true, disables text alignment globally. If an array, disables for specific node `type` values.\n */\n disableTextAlign?: boolean | string[]\n}\n\nexport const RichText: React.FC<RichTextProps> = ({\n className,\n converters,\n data: editorState,\n disableContainer,\n disableIndent,\n disableTextAlign,\n}) => {\n if (!editorState) {\n return null\n }\n\n let finalConverters: JSXConverters = {}\n if (converters) {\n if (typeof converters === 'function') {\n finalConverters = converters({ defaultConverters: defaultJSXConverters })\n } else {\n finalConverters = converters\n }\n } else {\n finalConverters = defaultJSXConverters\n }\n\n const content =\n editorState &&\n !Array.isArray(editorState) &&\n typeof editorState === 'object' &&\n 'root' in editorState &&\n convertLexicalToJSX({\n converters: finalConverters,\n data: editorState,\n disableIndent,\n disableTextAlign,\n })\n\n if (disableContainer) {\n return <>{content}</>\n }\n\n return <div className={className ?? 'payload-richtext'}>{content}</div>\n}\n"],"mappings":";AAEA,OAAOA,KAAA,MAAW;AASlB,SAASC,oBAAoB,QAAQ;AACrC,SAASC,mBAAmB,QAAQ;AAoCpC,OAAO,MAAMC,QAAA,GAAoCA,CAAC;EAChDC,SAAS;EACTC,UAAU;EACVC,IAAA,EAAMC,WAAW;EACjBC,gBAAgB;EAChBC,aAAa;EACbC;AAAgB,CACjB;EACC,IAAI,CAACH,WAAA,EAAa;IAChB,OAAO;EACT;EAEA,IAAII,eAAA,GAAiC,CAAC;EACtC,IAAIN,UAAA,EAAY;IACd,IAAI,OAAOA,UAAA,KAAe,YAAY;MACpCM,eAAA,GAAkBN,UAAA,CAAW;QAAEO,iBAAA,EAAmBX;MAAqB;IACzE,OAAO;MACLU,eAAA,GAAkBN,UAAA;IACpB;EACF,OAAO;IACLM,eAAA,GAAkBV,oBAAA;EACpB;EAEA,MAAMY,OAAA,GACJN,WAAA,IACA,CAACO,KAAA,CAAMC,OAAO,CAACR,WAAA,KACf,OAAOA,WAAA,KAAgB,YACvB,UAAUA,WAAA,IACVL,mBAAA,CAAoB;IAClBG,UAAA,EAAYM,eAAA;IACZL,IAAA,EAAMC,WAAA;IACNE,aAAA;IACAC;EACF;EAEF,IAAIF,gBAAA,EAAkB;IACpB,oBAAOQ,IAAA,CAAAC,SAAA;gBAAGJ;;EACZ;EAEA,oBAAOG,IAAA,CAAC;IAAIZ,SAAA,EAAWA,SAAA,IAAa;cAAqBS;;AAC3D","ignoreList":[]}
1
+ {"version":3,"file":"index.js","names":["React","defaultJSXConverters","convertLexicalToJSX","RichText","className","converters","data","editorState","disableContainer","disableIndent","disableTextAlign","nodeMap","finalConverters","defaultConverters","content","Array","isArray","_jsx","_Fragment"],"sources":["../../../../../src/features/converters/lexicalToJSX/Component/index.tsx"],"sourcesContent":["import React from 'react'\n\nimport type {\n DefaultNodeTypes,\n SerializedBlockNode,\n SerializedInlineBlockNode,\n} from '../../../../nodeTypes.js'\nimport type { JSXConverters } from '../converter/types.js'\n\nimport { defaultJSXConverters } from '../converter/defaultConverters.js'\nimport { convertLexicalToJSX, type ConvertLexicalToJSXArgs } from '../converter/index.js'\n\nexport type JSXConvertersFunction<\n T extends { [key: string]: any; type?: string } =\n | DefaultNodeTypes\n | SerializedBlockNode<{ blockName?: null | string }>\n | SerializedInlineBlockNode<{ blockName?: null | string }>,\n> = (args: { defaultConverters: JSXConverters<DefaultNodeTypes> }) => JSXConverters<T>\n\ntype RichTextProps = {\n /**\n * Override class names for the container.\n */\n className?: string\n /**\n * Custom converters to transform your nodes to JSX. Can be an object or a function that receives the default converters.\n */\n converters?: JSXConverters | JSXConvertersFunction\n\n /**\n * If true, removes the container div wrapper.\n */\n disableContainer?: boolean\n} & Pick<ConvertLexicalToJSXArgs, 'data' | 'disableIndent' | 'disableTextAlign' | 'nodeMap'>\n\nexport const RichText: React.FC<RichTextProps> = ({\n className,\n converters,\n data: editorState,\n disableContainer,\n disableIndent,\n disableTextAlign,\n nodeMap,\n}) => {\n if (!editorState) {\n return null\n }\n\n let finalConverters: JSXConverters = {}\n if (converters) {\n if (typeof converters === 'function') {\n finalConverters = converters({ defaultConverters: defaultJSXConverters })\n } else {\n finalConverters = converters\n }\n } else {\n finalConverters = defaultJSXConverters\n }\n\n const content =\n editorState &&\n !Array.isArray(editorState) &&\n typeof editorState === 'object' &&\n 'root' in editorState &&\n convertLexicalToJSX({\n converters: finalConverters,\n data: editorState,\n disableIndent,\n disableTextAlign,\n nodeMap,\n })\n\n if (disableContainer) {\n return <>{content}</>\n }\n\n return <div className={className ?? 'payload-richtext'}>{content}</div>\n}\n"],"mappings":";AAAA,OAAOA,KAAA,MAAW;AASlB,SAASC,oBAAoB,QAAQ;AACrC,SAASC,mBAAmB,QAAsC;AAyBlE,OAAO,MAAMC,QAAA,GAAoCA,CAAC;EAChDC,SAAS;EACTC,UAAU;EACVC,IAAA,EAAMC,WAAW;EACjBC,gBAAgB;EAChBC,aAAa;EACbC,gBAAgB;EAChBC;AAAO,CACR;EACC,IAAI,CAACJ,WAAA,EAAa;IAChB,OAAO;EACT;EAEA,IAAIK,eAAA,GAAiC,CAAC;EACtC,IAAIP,UAAA,EAAY;IACd,IAAI,OAAOA,UAAA,KAAe,YAAY;MACpCO,eAAA,GAAkBP,UAAA,CAAW;QAAEQ,iBAAA,EAAmBZ;MAAqB;IACzE,OAAO;MACLW,eAAA,GAAkBP,UAAA;IACpB;EACF,OAAO;IACLO,eAAA,GAAkBX,oBAAA;EACpB;EAEA,MAAMa,OAAA,GACJP,WAAA,IACA,CAACQ,KAAA,CAAMC,OAAO,CAACT,WAAA,KACf,OAAOA,WAAA,KAAgB,YACvB,UAAUA,WAAA,IACVL,mBAAA,CAAoB;IAClBG,UAAA,EAAYO,eAAA;IACZN,IAAA,EAAMC,WAAA;IACNE,aAAA;IACAC,gBAAA;IACAC;EACF;EAEF,IAAIH,gBAAA,EAAkB;IACpB,oBAAOS,IAAA,CAAAC,SAAA;gBAAGJ;;EACZ;EAEA,oBAAOG,IAAA,CAAC;IAAIb,SAAA,EAAWA,SAAA,IAAa;cAAqBU;;AAC3D","ignoreList":[]}