@payloadcms/richtext-lexical 4.0.0-beta.2 → 4.0.0-beta.4

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 (159) hide show
  1. package/dist/exports/client/Field-334JNLRF.js +2 -0
  2. package/dist/exports/client/Field-334JNLRF.js.map +7 -0
  3. package/dist/exports/client/{RelationshipComponent-YCPAKOL7.js → RelationshipComponent-TVK6I4W4.js} +2 -2
  4. package/dist/exports/client/chunk-BEKGION5.js +2 -0
  5. package/dist/exports/client/chunk-BEKGION5.js.map +7 -0
  6. package/dist/exports/client/{chunk-WSAPGI3Z.js → chunk-EA5BHQ2T.js} +1 -1
  7. package/dist/exports/client/{chunk-WSAPGI3Z.js.map → chunk-EA5BHQ2T.js.map} +1 -1
  8. package/dist/exports/client/chunk-FAJJXXCW.js +2 -0
  9. package/dist/exports/client/{chunk-3LRZDIIG.js.map → chunk-FAJJXXCW.js.map} +2 -2
  10. package/dist/exports/client/{chunk-5VIL27GI.js → chunk-IYBYNEKX.js} +1 -1
  11. package/dist/exports/client/{chunk-5VIL27GI.js.map → chunk-IYBYNEKX.js.map} +1 -1
  12. package/dist/exports/client/chunk-SE5IITBK.js +2 -0
  13. package/dist/exports/client/chunk-SE5IITBK.js.map +7 -0
  14. package/dist/exports/client/{component-6DQLENIE.js → component-QENB4QTS.js} +2 -2
  15. package/dist/exports/client/componentInline-AU7IBNY7.js +2 -0
  16. package/dist/exports/client/index.js +27 -27
  17. package/dist/exports/client/index.js.map +3 -3
  18. package/dist/features/align/client/index.js.map +1 -1
  19. package/dist/features/blocks/client/component/BlockContent.js.map +1 -1
  20. package/dist/features/blocks/client/component/components/BlockCollapsible.js.map +1 -1
  21. package/dist/features/blocks/client/component/components/BlockEditButton.js.map +1 -1
  22. package/dist/features/blocks/client/component/components/BlockRemoveButton.js.map +1 -1
  23. package/dist/features/blocks/client/component/index.d.ts.map +1 -1
  24. package/dist/features/blocks/client/component/index.js +38 -16
  25. package/dist/features/blocks/client/component/index.js.map +1 -1
  26. package/dist/features/blocks/client/componentInline/components/InlineBlockContainer.js.map +1 -1
  27. package/dist/features/blocks/client/componentInline/components/InlineBlockEditButton.js.map +1 -1
  28. package/dist/features/blocks/client/componentInline/components/InlineBlockLabel.js.map +1 -1
  29. package/dist/features/blocks/client/componentInline/components/InlineBlockRemoveButton.js.map +1 -1
  30. package/dist/features/blocks/client/componentInline/index.d.ts.map +1 -1
  31. package/dist/features/blocks/client/componentInline/index.js +5 -11
  32. package/dist/features/blocks/client/componentInline/index.js.map +1 -1
  33. package/dist/features/blocks/client/getCachedFormStateIfDataMatches.js.map +1 -1
  34. package/dist/features/blocks/client/plugin/index.js.map +1 -1
  35. package/dist/features/blocks/premade/CodeBlock/Component/Block.js +121 -78
  36. package/dist/features/blocks/premade/CodeBlock/Component/Block.js.map +1 -1
  37. package/dist/features/blocks/premade/CodeBlock/Component/Code.js +142 -87
  38. package/dist/features/blocks/premade/CodeBlock/Component/Code.js.map +1 -1
  39. package/dist/features/converters/lexicalToHtml/sync/types.d.ts.map +1 -1
  40. package/dist/features/converters/lexicalToHtml/sync/types.js.map +1 -1
  41. package/dist/features/debug/jsxConverter/client/plugin/index.js.map +1 -1
  42. package/dist/features/debug/testRecorder/client/plugin/index.js.map +1 -1
  43. package/dist/features/debug/treeView/client/plugin/index.js.map +1 -1
  44. package/dist/features/heading/client/index.js.map +1 -1
  45. package/dist/features/horizontalRule/client/plugin/index.js.map +1 -1
  46. package/dist/features/indent/client/index.d.ts.map +1 -1
  47. package/dist/features/indent/client/index.js +0 -2
  48. package/dist/features/indent/client/index.js.map +1 -1
  49. package/dist/features/indent/server/i18n.d.ts.map +1 -1
  50. package/dist/features/indent/server/i18n.js.map +1 -1
  51. package/dist/features/link/client/plugins/autoLink/index.js.map +1 -1
  52. package/dist/features/link/client/plugins/floatingLinkEditor/LinkEditor/index.d.ts.map +1 -1
  53. package/dist/features/link/client/plugins/floatingLinkEditor/LinkEditor/index.js +10 -2
  54. package/dist/features/link/client/plugins/floatingLinkEditor/LinkEditor/index.js.map +1 -1
  55. package/dist/features/link/client/plugins/link/index.js.map +1 -1
  56. package/dist/features/link/markdownTransformer.js +2 -2
  57. package/dist/features/link/markdownTransformer.js.map +1 -1
  58. package/dist/features/link/server/baseFields.js.map +1 -1
  59. package/dist/features/lists/shared/schema.d.ts.map +1 -1
  60. package/dist/features/lists/shared/schema.js.map +1 -1
  61. package/dist/features/relationship/client/drawer/index.js.map +1 -1
  62. package/dist/features/relationship/client/plugins/index.js.map +1 -1
  63. package/dist/features/relationship/client/utils/useEnabledRelationships.js.map +1 -1
  64. package/dist/features/table/client/plugins/TableActionMenuPlugin/index.css +1 -1
  65. package/dist/features/table/client/plugins/TableActionMenuPlugin/index.js.map +1 -1
  66. package/dist/features/table/client/plugins/TableCellResizerPlugin/index.js +6 -6
  67. package/dist/features/table/client/plugins/TableCellResizerPlugin/index.js.map +1 -1
  68. package/dist/features/table/client/plugins/TableHoverActionsPlugin/index.js.map +1 -1
  69. package/dist/features/table/client/plugins/TablePlugin/index.js +54 -18
  70. package/dist/features/table/client/plugins/TablePlugin/index.js.map +1 -1
  71. package/dist/features/table/client/utils/useDebounce.js.map +1 -1
  72. package/dist/features/textState/defaultColors.js +1 -1
  73. package/dist/features/textState/defaultColors.js.map +1 -1
  74. package/dist/features/toolbars/fixed/client/Toolbar/horizontalWheelScroll.js.map +1 -1
  75. package/dist/features/toolbars/fixed/client/Toolbar/index.js +126 -70
  76. package/dist/features/toolbars/fixed/client/Toolbar/index.js.map +1 -1
  77. package/dist/features/toolbars/inline/client/Toolbar/index.js +67 -35
  78. package/dist/features/toolbars/inline/client/Toolbar/index.js.map +1 -1
  79. package/dist/features/toolbars/shared/ToolbarButton/index.d.ts.map +1 -1
  80. package/dist/features/toolbars/shared/ToolbarButton/index.js +26 -2
  81. package/dist/features/toolbars/shared/ToolbarButton/index.js.map +1 -1
  82. package/dist/features/toolbars/shared/ToolbarDropdown/DropDown.js +137 -72
  83. package/dist/features/toolbars/shared/ToolbarDropdown/DropDown.js.map +1 -1
  84. package/dist/features/toolbars/shared/ToolbarDropdown/index.d.ts.map +1 -1
  85. package/dist/features/toolbars/shared/ToolbarDropdown/index.js +22 -6
  86. package/dist/features/toolbars/shared/ToolbarDropdown/index.js.map +1 -1
  87. package/dist/features/toolbars/shared/useToolbarKeyboardNavigation.js +100 -70
  88. package/dist/features/toolbars/shared/useToolbarKeyboardNavigation.js.map +1 -1
  89. package/dist/features/upload/client/drawer/index.js.map +1 -1
  90. package/dist/features/upload/client/plugin/index.js.map +1 -1
  91. package/dist/field/RenderLexical/index.js.map +1 -1
  92. package/dist/field/ViewSelector.js +12 -4
  93. package/dist/field/ViewSelector.js.map +1 -1
  94. package/dist/field/bundled.css +1 -1
  95. package/dist/field/index.js.map +1 -1
  96. package/dist/i18n.d.ts.map +1 -1
  97. package/dist/i18n.js +44 -0
  98. package/dist/i18n.js.map +1 -1
  99. package/dist/lexical/LexicalEditor.js.map +1 -1
  100. package/dist/lexical/plugins/ClipboardPlugin/index.js.map +1 -1
  101. package/dist/lexical/plugins/DecoratorPlugin/index.js.map +1 -1
  102. package/dist/lexical/plugins/InsertParagraphAtEnd/index.js.map +1 -1
  103. package/dist/lexical/plugins/MarkdownShortcut/index.js.map +1 -1
  104. package/dist/lexical/plugins/NodeViewOverridePlugin/index.js.map +1 -1
  105. package/dist/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/LexicalMenu.js +234 -87
  106. package/dist/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/LexicalMenu.js.map +1 -1
  107. package/dist/lexical/plugins/SlashMenu/useMenuTriggerMatch.js.map +1 -1
  108. package/dist/lexical/plugins/TextPlugin/index.js.map +1 -1
  109. package/dist/lexical/plugins/handles/AddBlockHandlePlugin/index.js.map +1 -1
  110. package/dist/lexical/plugins/handles/DraggableBlockPlugin/index.css +16 -0
  111. package/dist/lexical/plugins/handles/DraggableBlockPlugin/index.d.ts.map +1 -1
  112. package/dist/lexical/plugins/handles/DraggableBlockPlugin/index.js +126 -38
  113. package/dist/lexical/plugins/handles/DraggableBlockPlugin/index.js.map +1 -1
  114. package/dist/lexical/plugins/handles/DraggableBlockPlugin/moveBlock.d.ts +7 -0
  115. package/dist/lexical/plugins/handles/DraggableBlockPlugin/moveBlock.d.ts.map +1 -0
  116. package/dist/lexical/plugins/handles/DraggableBlockPlugin/moveBlock.js +15 -0
  117. package/dist/lexical/plugins/handles/DraggableBlockPlugin/moveBlock.js.map +1 -0
  118. package/dist/lexical/plugins/handles/DraggableBlockPlugin/useKeyboardReordering.d.ts.map +1 -1
  119. package/dist/lexical/plugins/handles/DraggableBlockPlugin/useKeyboardReordering.js +9 -12
  120. package/dist/lexical/plugins/handles/DraggableBlockPlugin/useKeyboardReordering.js.map +1 -1
  121. package/dist/lexical/ui/ContentEditable.js.map +1 -1
  122. package/dist/lexical/utils/nodeFormat.d.ts.map +1 -1
  123. package/dist/lexical/utils/nodeFormat.js +0 -2
  124. package/dist/lexical/utils/nodeFormat.js.map +1 -1
  125. package/dist/lexical/utils/url.d.ts.map +1 -1
  126. package/dist/lexical/utils/url.js +1 -1
  127. package/dist/lexical/utils/url.js.map +1 -1
  128. package/dist/populateGraphQL/populate.js.map +1 -1
  129. package/dist/types/index.d.ts.map +1 -1
  130. package/dist/types/index.js.map +1 -1
  131. package/dist/utilities/buildEditorState.d.ts.map +1 -1
  132. package/dist/utilities/buildEditorState.js.map +1 -1
  133. package/dist/utilities/fieldsDrawer/Drawer.js +36 -36
  134. package/dist/utilities/fieldsDrawer/Drawer.js.map +1 -1
  135. package/dist/utilities/fieldsDrawer/DrawerContent.d.ts.map +1 -1
  136. package/dist/utilities/fieldsDrawer/DrawerContent.js +6 -9
  137. package/dist/utilities/fieldsDrawer/DrawerContent.js.map +1 -1
  138. package/dist/utilities/fieldsDrawer/useDrawerSubmit.js.map +1 -1
  139. package/dist/utilities/fieldsDrawer/useLexicalDocumentDrawer.js.map +1 -1
  140. package/dist/utilities/fieldsDrawer/useLexicalDrawer.js.map +1 -1
  141. package/dist/utilities/fieldsDrawer/useLexicalListDrawer.js.map +1 -1
  142. package/dist/utilities/initLexicalFeatures.d.ts.map +1 -1
  143. package/dist/utilities/initLexicalFeatures.js +38 -4
  144. package/dist/utilities/initLexicalFeatures.js.map +1 -1
  145. package/dist/utilities/useLexicalFeature.js +15 -6
  146. package/dist/utilities/useLexicalFeature.js.map +1 -1
  147. package/dist/utilities/useRunDeprioritized.js.map +1 -1
  148. package/package.json +32 -35
  149. package/dist/exports/client/Field-W2ABOM7M.js +0 -2
  150. package/dist/exports/client/Field-W2ABOM7M.js.map +0 -7
  151. package/dist/exports/client/chunk-3LRZDIIG.js +0 -2
  152. package/dist/exports/client/chunk-E6LSRRP2.js +0 -2
  153. package/dist/exports/client/chunk-E6LSRRP2.js.map +0 -7
  154. package/dist/exports/client/chunk-ZQX5HXUL.js +0 -2
  155. package/dist/exports/client/chunk-ZQX5HXUL.js.map +0 -7
  156. package/dist/exports/client/componentInline-HNE5G4TE.js +0 -2
  157. /package/dist/exports/client/{RelationshipComponent-YCPAKOL7.js.map → RelationshipComponent-TVK6I4W4.js.map} +0 -0
  158. /package/dist/exports/client/{component-6DQLENIE.js.map → component-QENB4QTS.js.map} +0 -0
  159. /package/dist/exports/client/{componentInline-HNE5G4TE.js.map → componentInline-AU7IBNY7.js.map} +0 -0
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["c","_c","useLexicalComposerContext","$isDecoratorBlockNode","$findMatchingParent","$getSelection","$isElementNode","$isNodeSelection","$isRangeSelection","COMMAND_PRIORITY_LOW","FORMAT_ELEMENT_COMMAND","useEffect","AlignCenterIcon","AlignJustifyIcon","AlignLeftIcon","AlignRightIcon","createClientFeature","toolbarAlignGroupWithItems","getFormatType","node","__format","toolbarGroups","ChildComponent","isActive","selection","getNodes","parent","getParent","key","label","i18n","t","onSelect","editor","dispatchCommand","order","AlignPlugin","$","t0","t1","registerCommand","_temp2","AlignFeatureClient","plugins","Component","position","toolbarFixed","groups","toolbarInline","_temp","parentNode","isInline","format","nodes","element","setFormat"],"sources":["../../../../src/features/align/client/index.tsx"],"sourcesContent":["'use client'\n\nimport type { DecoratorBlockNode } from '@lexical/react/LexicalDecoratorBlockNode'\nimport type { ElementFormatType, ElementNode } from 'lexical'\n\nimport { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext'\nimport { $isDecoratorBlockNode } from '@lexical/react/LexicalDecoratorBlockNode'\nimport { $findMatchingParent } from '@lexical/utils'\nimport {\n $getSelection,\n $isElementNode,\n $isNodeSelection,\n $isRangeSelection,\n COMMAND_PRIORITY_LOW,\n FORMAT_ELEMENT_COMMAND,\n} from 'lexical'\nimport { useEffect } from 'react'\n\nimport type { ToolbarGroup } from '../../toolbars/types.js'\n\nimport { AlignCenterIcon } from '../../../lexical/ui/icons/AlignCenter/index.js'\nimport { AlignJustifyIcon } from '../../../lexical/ui/icons/AlignJustify/index.js'\nimport { AlignLeftIcon } from '../../../lexical/ui/icons/AlignLeft/index.js'\nimport { AlignRightIcon } from '../../../lexical/ui/icons/AlignRight/index.js'\nimport { createClientFeature } from '../../../utilities/createClientFeature.js'\nimport { toolbarAlignGroupWithItems } from './toolbarAlignGroup.js'\n\n// DecoratorBlockNode has format, but Lexical forgot\n// to add the getters like ElementNode does.\nconst getFormatType = (node: DecoratorBlockNode | ElementNode): ElementFormatType => {\n if ($isElementNode(node)) {\n return node.getFormatType()\n }\n return node.__format\n}\n\nconst toolbarGroups: ToolbarGroup[] = [\n toolbarAlignGroupWithItems([\n {\n ChildComponent: AlignLeftIcon,\n isActive: ({ selection }) => {\n if (!$isRangeSelection(selection)) {\n return false\n }\n for (const node of selection.getNodes()) {\n if ($isElementNode(node) || $isDecoratorBlockNode(node)) {\n if (getFormatType(node) === 'left') {\n continue\n }\n }\n\n const parent = node.getParent()\n if ($isElementNode(parent) || $isDecoratorBlockNode(parent)) {\n if (getFormatType(parent) === 'left') {\n continue\n }\n }\n\n return false\n }\n return true\n },\n key: 'alignLeft',\n label: ({ i18n }) => {\n return i18n.t('lexical:align:alignLeftLabel')\n },\n onSelect: ({ editor }) => {\n editor.dispatchCommand(FORMAT_ELEMENT_COMMAND, 'left')\n },\n order: 1,\n },\n {\n ChildComponent: AlignCenterIcon,\n isActive: ({ selection }) => {\n if (!$isRangeSelection(selection)) {\n return false\n }\n for (const node of selection.getNodes()) {\n if ($isElementNode(node) || $isDecoratorBlockNode(node)) {\n if (getFormatType(node) === 'center') {\n continue\n }\n }\n\n const parent = node.getParent()\n if ($isElementNode(parent) || $isDecoratorBlockNode(parent)) {\n if (getFormatType(parent) === 'center') {\n continue\n }\n }\n\n return false\n }\n return true\n },\n key: 'alignCenter',\n label: ({ i18n }) => {\n return i18n.t('lexical:align:alignCenterLabel')\n },\n onSelect: ({ editor }) => {\n editor.dispatchCommand(FORMAT_ELEMENT_COMMAND, 'center')\n },\n order: 2,\n },\n {\n ChildComponent: AlignRightIcon,\n isActive: ({ selection }) => {\n if (!$isRangeSelection(selection)) {\n return false\n }\n for (const node of selection.getNodes()) {\n if ($isElementNode(node) || $isDecoratorBlockNode(node)) {\n if (getFormatType(node) === 'right') {\n continue\n }\n }\n\n const parent = node.getParent()\n if ($isElementNode(parent) || $isDecoratorBlockNode(parent)) {\n if (getFormatType(parent) === 'right') {\n continue\n }\n }\n\n return false\n }\n return true\n },\n key: 'alignRight',\n label: ({ i18n }) => {\n return i18n.t('lexical:align:alignRightLabel')\n },\n onSelect: ({ editor }) => {\n editor.dispatchCommand(FORMAT_ELEMENT_COMMAND, 'right')\n },\n order: 3,\n },\n {\n ChildComponent: AlignJustifyIcon,\n isActive: ({ selection }) => {\n if (!$isRangeSelection(selection)) {\n return false\n }\n for (const node of selection.getNodes()) {\n if ($isElementNode(node) || $isDecoratorBlockNode(node)) {\n if (getFormatType(node) === 'justify') {\n continue\n }\n }\n\n const parent = node.getParent()\n if ($isElementNode(parent) || $isDecoratorBlockNode(parent)) {\n if (getFormatType(parent) === 'justify') {\n continue\n }\n }\n\n return false\n }\n return true\n },\n key: 'alignJustify',\n label: ({ i18n }) => {\n return i18n.t('lexical:align:alignJustifyLabel')\n },\n onSelect: ({ editor }) => {\n editor.dispatchCommand(FORMAT_ELEMENT_COMMAND, 'justify')\n },\n order: 4,\n },\n ]),\n]\n\nconst AlignPlugin = () => {\n const [editor] = useLexicalComposerContext()\n\n useEffect(() => {\n // Just like the default Lexical configuration, but in\n // addition to ElementNode we also set DecoratorBlocks\n return editor.registerCommand(\n FORMAT_ELEMENT_COMMAND,\n (format) => {\n const selection = $getSelection()\n if (!$isRangeSelection(selection) && !$isNodeSelection(selection)) {\n return false\n }\n const nodes = selection.getNodes()\n for (const node of nodes) {\n const element = $findMatchingParent(\n node,\n (parentNode): parentNode is DecoratorBlockNode | ElementNode =>\n ($isElementNode(parentNode) || $isDecoratorBlockNode(parentNode)) &&\n !parentNode.isInline(),\n )\n if (element !== null) {\n element.setFormat(format)\n }\n }\n return true\n },\n COMMAND_PRIORITY_LOW,\n )\n }, [editor])\n return null\n}\n\nexport const AlignFeatureClient = createClientFeature({\n plugins: [\n {\n Component: AlignPlugin,\n position: 'normal',\n },\n ],\n toolbarFixed: {\n groups: toolbarGroups,\n },\n toolbarInline: {\n groups: toolbarGroups,\n },\n})\n"],"mappings":"AAAA;;AAAA,SAAAA,CAAA,IAAAC,EAAA;AAKA,SAASC,yBAAyB,QAAQ;AAC1C,SAASC,qBAAqB,QAAQ;AACtC,SAASC,mBAAmB,QAAQ;AACpC,SACEC,aAAa,EACbC,cAAc,EACdC,gBAAgB,EAChBC,iBAAiB,EACjBC,oBAAoB,EACpBC,sBAAsB,QACjB;AACP,SAASC,SAAS,QAAQ;AAI1B,SAASC,eAAe,QAAQ;AAChC,SAASC,gBAAgB,QAAQ;AACjC,SAASC,aAAa,QAAQ;AAC9B,SAASC,cAAc,QAAQ;AAC/B,SAASC,mBAAmB,QAAQ;AACpC,SAASC,0BAA0B,QAAQ;AAE3C;AACA;A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AAAE,EAAA,GAAAF,CAAA;EAAA;EA1BX1B,SAAA,CAAU2B,EA0BV,EAAGC,EAAQ;EAAA;AAAA,CAEb;AAEA,OAAO,MAAMG,kBAAA,GAAqB1B,mBAAA,CAAoB;EACpD2B,OAAA,EAAS,CACP;IACEC,SAAA,EAAWR,WAAA;IACXS,QAAA,EAAU;EACZ,EACD;EACDC,YAAA,EAAc;IACZC,MAAA,EAAQ1B;EACV;EACA2B,aAAA,EAAe;IACbD,MAAA,EAAQ1B;EACV;AACF;AA9CoB,SAAA4B,MAAAC,UAAA;EAAA,OAkBN,CAAC5C,cAAA,CAAe4C,UAAA,KAAe/C,qBAAA,CAAsB+C,UAAA,CAAU,MAC9DA,UAAA,CAAAC,QAAA,CAAmB;AAAA;AAnBd,SAAAV,OAAAW,MAAA;EASZ,MAAA5B,SAAA,GAAkBnB,aAAA;EAAA,IACd,CAACG,iBAAA,CAAkBgB,SAAA,MAAejB,gBAAA,CAAiBiB,SAAA;IAAA;EAAA;EAGvD,MAAA6B,KAAA,GAAc7B,SAAA,CAAAC,QAAA,CAAkB;EAAA,KAC3B,MAAAN,IAAM,IAAQkC,KAAA;IACjB,MAAAC,OAAA,GAAgBlD,mBAAA,CACde,IAAA,EAAA8B,KAGsB;IAAA,IAEpBK,OAAA,SAAY;MACdA,OAAA,CAAAC,SAAA,CAAkBH,MAAA;IAAA;EAAA;EAAA;AAAA","ignoreList":[]}
1
+ {"version":3,"file":"index.js","names":["c","_c","useLexicalComposerContext","$isDecoratorBlockNode","$findMatchingParent","$getSelection","$isElementNode","$isNodeSelection","$isRangeSelection","COMMAND_PRIORITY_LOW","FORMAT_ELEMENT_COMMAND","useEffect","AlignCenterIcon","AlignJustifyIcon","AlignLeftIcon","AlignRightIcon","createClientFeature","toolbarAlignGroupWithItems","getFormatType","node","__format","toolbarGroups","ChildComponent","isActive","selection","getNodes","parent","getParent","key","label","i18n","t","onSelect","editor","dispatchCommand","order","AlignPlugin","$","t0","t1","registerCommand","_temp2","AlignFeatureClient","plugins","Component","position","toolbarFixed","groups","toolbarInline","_temp","parentNode","isInline","format","nodes","element","setFormat"],"sources":["../../../../src/features/align/client/index.tsx"],"sourcesContent":["'use client'\n\nimport type { DecoratorBlockNode } from '@lexical/react/LexicalDecoratorBlockNode'\nimport type { ElementFormatType, ElementNode } from 'lexical'\n\nimport { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext'\nimport { $isDecoratorBlockNode } from '@lexical/react/LexicalDecoratorBlockNode'\nimport { $findMatchingParent } from '@lexical/utils'\nimport {\n $getSelection,\n $isElementNode,\n $isNodeSelection,\n $isRangeSelection,\n COMMAND_PRIORITY_LOW,\n FORMAT_ELEMENT_COMMAND,\n} from 'lexical'\nimport { useEffect } from 'react'\n\nimport type { ToolbarGroup } from '../../toolbars/types.js'\n\nimport { AlignCenterIcon } from '../../../lexical/ui/icons/AlignCenter/index.js'\nimport { AlignJustifyIcon } from '../../../lexical/ui/icons/AlignJustify/index.js'\nimport { AlignLeftIcon } from '../../../lexical/ui/icons/AlignLeft/index.js'\nimport { AlignRightIcon } from '../../../lexical/ui/icons/AlignRight/index.js'\nimport { createClientFeature } from '../../../utilities/createClientFeature.js'\nimport { toolbarAlignGroupWithItems } from './toolbarAlignGroup.js'\n\n// DecoratorBlockNode has format, but Lexical forgot\n// to add the getters like ElementNode does.\nconst getFormatType = (node: DecoratorBlockNode | ElementNode): ElementFormatType => {\n if ($isElementNode(node)) {\n return node.getFormatType()\n }\n return node.__format\n}\n\nconst toolbarGroups: ToolbarGroup[] = [\n toolbarAlignGroupWithItems([\n {\n ChildComponent: AlignLeftIcon,\n isActive: ({ selection }) => {\n if (!$isRangeSelection(selection)) {\n return false\n }\n for (const node of selection.getNodes()) {\n if ($isElementNode(node) || $isDecoratorBlockNode(node)) {\n if (getFormatType(node) === 'left') {\n continue\n }\n }\n\n const parent = node.getParent()\n if ($isElementNode(parent) || $isDecoratorBlockNode(parent)) {\n if (getFormatType(parent) === 'left') {\n continue\n }\n }\n\n return false\n }\n return true\n },\n key: 'alignLeft',\n label: ({ i18n }) => {\n return i18n.t('lexical:align:alignLeftLabel')\n },\n onSelect: ({ editor }) => {\n editor.dispatchCommand(FORMAT_ELEMENT_COMMAND, 'left')\n },\n order: 1,\n },\n {\n ChildComponent: AlignCenterIcon,\n isActive: ({ selection }) => {\n if (!$isRangeSelection(selection)) {\n return false\n }\n for (const node of selection.getNodes()) {\n if ($isElementNode(node) || $isDecoratorBlockNode(node)) {\n if (getFormatType(node) === 'center') {\n continue\n }\n }\n\n const parent = node.getParent()\n if ($isElementNode(parent) || $isDecoratorBlockNode(parent)) {\n if (getFormatType(parent) === 'center') {\n continue\n }\n }\n\n return false\n }\n return true\n },\n key: 'alignCenter',\n label: ({ i18n }) => {\n return i18n.t('lexical:align:alignCenterLabel')\n },\n onSelect: ({ editor }) => {\n editor.dispatchCommand(FORMAT_ELEMENT_COMMAND, 'center')\n },\n order: 2,\n },\n {\n ChildComponent: AlignRightIcon,\n isActive: ({ selection }) => {\n if (!$isRangeSelection(selection)) {\n return false\n }\n for (const node of selection.getNodes()) {\n if ($isElementNode(node) || $isDecoratorBlockNode(node)) {\n if (getFormatType(node) === 'right') {\n continue\n }\n }\n\n const parent = node.getParent()\n if ($isElementNode(parent) || $isDecoratorBlockNode(parent)) {\n if (getFormatType(parent) === 'right') {\n continue\n }\n }\n\n return false\n }\n return true\n },\n key: 'alignRight',\n label: ({ i18n }) => {\n return i18n.t('lexical:align:alignRightLabel')\n },\n onSelect: ({ editor }) => {\n editor.dispatchCommand(FORMAT_ELEMENT_COMMAND, 'right')\n },\n order: 3,\n },\n {\n ChildComponent: AlignJustifyIcon,\n isActive: ({ selection }) => {\n if (!$isRangeSelection(selection)) {\n return false\n }\n for (const node of selection.getNodes()) {\n if ($isElementNode(node) || $isDecoratorBlockNode(node)) {\n if (getFormatType(node) === 'justify') {\n continue\n }\n }\n\n const parent = node.getParent()\n if ($isElementNode(parent) || $isDecoratorBlockNode(parent)) {\n if (getFormatType(parent) === 'justify') {\n continue\n }\n }\n\n return false\n }\n return true\n },\n key: 'alignJustify',\n label: ({ i18n }) => {\n return i18n.t('lexical:align:alignJustifyLabel')\n },\n onSelect: ({ editor }) => {\n editor.dispatchCommand(FORMAT_ELEMENT_COMMAND, 'justify')\n },\n order: 4,\n },\n ]),\n]\n\nconst AlignPlugin = () => {\n const [editor] = useLexicalComposerContext()\n\n useEffect(() => {\n // Just like the default Lexical configuration, but in\n // addition to ElementNode we also set DecoratorBlocks\n return editor.registerCommand(\n FORMAT_ELEMENT_COMMAND,\n (format) => {\n const selection = $getSelection()\n if (!$isRangeSelection(selection) && !$isNodeSelection(selection)) {\n return false\n }\n const nodes = selection.getNodes()\n for (const node of nodes) {\n const element = $findMatchingParent(\n node,\n (parentNode): parentNode is DecoratorBlockNode | ElementNode =>\n ($isElementNode(parentNode) || $isDecoratorBlockNode(parentNode)) &&\n !parentNode.isInline(),\n )\n if (element !== null) {\n element.setFormat(format)\n }\n }\n return true\n },\n COMMAND_PRIORITY_LOW,\n )\n }, [editor])\n return null\n}\n\nexport const AlignFeatureClient = createClientFeature({\n plugins: [\n {\n Component: AlignPlugin,\n position: 'normal',\n },\n ],\n toolbarFixed: {\n groups: toolbarGroups,\n },\n toolbarInline: {\n groups: toolbarGroups,\n },\n})\n"],"mappings":"AAAA;;AAAA,SAAAA,CAAA,IAAAC,EAAA;AAKA,SAASC,yBAAyB,QAAQ;AAC1C,SAASC,qBAAqB,QAAQ;AACtC,SAASC,mBAAmB,QAAQ;AACpC,SACEC,aAAa,EACbC,cAAc,EACdC,gBAAgB,EAChBC,iBAAiB,EACjBC,oBAAoB,EACpBC,sBAAsB,QACjB;AACP,SAASC,SAAS,QAAQ;AAI1B,SAASC,eAAe,QAAQ;AAChC,SAASC,gBAAgB,QAAQ;AACjC,SAASC,aAAa,QAAQ;AAC9B,SAASC,cAAc,QAAQ;AAC/B,SAASC,mBAAmB,QAAQ;AACpC,SAASC,0BAA0B,QAAQ;AAE3C;AACA;AAC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AAAD,CAAA;IAAAE,EAAA,GAAAF,CAAA;EAAA;EA1BX1B,SAAA,CAAU2B,EA0BV,EAAGC,EAAQ;EAAA,OACJ;AAAA,CACT;AAEA,OAAO,MAAMG,kBAAA,GAAqB1B,mBAAA,CAAoB;EACpD2B,OAAA,EAAS,CACP;IACEC,SAAA,EAAWR,WAAA;IACXS,QAAA,EAAU;EACZ,EACD;EACDC,YAAA,EAAc;IACZC,MAAA,EAAQ1B;EACV;EACA2B,aAAA,EAAe;IACbD,MAAA,EAAQ1B;EACV;AACF;AA9CoB,SAAA4B,MAAAC,UAAA;EAAA,OAkBN,CAAC5C,cAAA,CAAe4C,UAAqC,CAAU,IAAhC/C,qBAAA,CAAsB+C,UAAA,CACjC,KADpB,CACCA,UAAA,CAAAC,QAAmB;AAAA;AAnBd,SAAAV,OAAAW,MAAA;EASZ,MAAA5B,SAAA,GAAkBnB,aAAA;EAClB,IAAI,CAACG,iBAAA,CAAkBgB,SAAA,CAAgC,IAAnD,CAAkCjB,gBAAA,CAAiBiB,SAAA;IAAA,OAC9C;EAAA;EAET,MAAA6B,KAAA,GAAc7B,SAAA,CAAAC,QAAkB;EAChC,KAAK,MAAAN,IAAM,IAAQkC,KAAA;IACjB,MAAAC,OAAA,GAAgBlD,mBAAA,CACde,IAAA,EACA8B,KAEsB;IAExB,IAAIK,OAAA,KAAY;MACdA,OAAA,CAAAC,SAAiB,CAACH,MAAA;IAAA;EACpB;EACF,OACO;AAAA","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"BlockContent.js","names":["c","_c","useLexicalEditable","RenderFields","useFormSubmitted","React","createContext","useMemo","BlockComponentContext","baseClass","BlockCollapsible","BlockDrawer","EditButton","errorCount","formSchema","initialState","nodeKey","RemoveButton","useBlockComponentContext","use","BlockContent","props","$","Collapsible","CustomBlock","CustomLabel","contextProps","hasSubmitted","fieldHasErrors","isEditable","t0","collapsibleProps","children","rest","_jsx","CollapsibleWithErrorProps","blockContextValue","_jsxs","value","fields","forceRender","parentIndexPath","parentPath","parentSchemaPath","permissions","readOnly"],"sources":["../../../../../src/features/blocks/client/component/BlockContent.tsx"],"sourcesContent":["'use client'\nimport type { CollapsibleProps } from '@payloadcms/ui/elements/Collapsible'\nimport type { ClientField, FormState } from 'payload'\n\nimport { useLexicalEditable } from '@lexical/react/useLexicalEditable'\nimport { RenderFields, useFormSubmitted } from '@payloadcms/ui'\nimport React, { createContext, useMemo } from 'react'\n\nexport type BlockCollapsibleProps = {\n /**\n * Replace the top-right portion of the header that renders the Edit and Remove buttons with custom content.\n * If this property is provided, the `removeButton` and `editButton` properties are ignored.\n */\n Actions?: React.ReactNode\n children?: React.ReactNode\n /**\n * Additional className to the collapsible wrapper\n */\n className?: string\n /**\n * Props to pass to the underlying Collapsible component. You could use this to override the `Header` entirely, for example.\n */\n collapsibleProps?: Partial<CollapsibleProps>\n /**\n * Whether to disable rendering the block name field in the header Label\n * @default false\n */\n disableBlockName?: boolean\n /**\n * Whether to show the Edit button\n * If `Actions` is provided, this property is ignored.\n * @default true\n */\n editButton?: boolean\n /**\n * Replace the default Label component with a custom Label\n */\n Label?: React.ReactNode\n /**\n * Replace the default Pill component component that's rendered within the default Label component with a custom Pill.\n * This property has no effect if you provide a custom Label component via the `Label` property.\n */\n Pill?: React.ReactNode\n /**\n * Whether to show the Remove button\n * If `Actions` is provided, this property is ignored.\n * @default true\n */\n removeButton?: boolean\n /**\n * Whether to show the drag handle icon\n * @default true\n */\n showDragHandle?: boolean\n /**\n * Whether to show the row number\n * @default true\n */\n showRowNumber?: boolean\n}\n\nexport type BlockCollapsibleWithErrorProps = {\n errorCount?: number\n fieldHasErrors?: boolean\n} & BlockCollapsibleProps\n\nexport type BlockContentProps = {\n baseClass: string\n BlockDrawer: React.FC\n Collapsible: React.FC<BlockCollapsibleWithErrorProps>\n /**\n * Custom block component (pre-rendered ReactNode).\n */\n CustomBlock?: React.ReactNode\n CustomLabel: React.ReactNode\n EditButton: React.FC\n errorCount: number\n formSchema: ClientField[]\n initialState: false | FormState | undefined\n\n nodeKey: string\n RemoveButton: React.FC\n}\n\nexport type BlockComponentContextType = {\n BlockCollapsible: React.FC<BlockCollapsibleProps>\n} & Omit<BlockContentProps, 'Collapsible' | 'CustomBlock' | 'CustomLabel'>\n\nconst BlockComponentContext = createContext<BlockComponentContextType>({\n baseClass: 'LexicalEditorTheme__block',\n BlockCollapsible: () => null,\n BlockDrawer: () => null,\n EditButton: () => null,\n errorCount: 0,\n formSchema: [],\n initialState: false,\n nodeKey: '',\n RemoveButton: () => null,\n})\n\nexport const useBlockComponentContext = () => React.use(BlockComponentContext)\n\n/**\n * The actual content of the Block. This should be INSIDE a Form component,\n * scoped to the block. All format operations in here are thus scoped to the block's form, and\n * not the whole document.\n */\nexport const BlockContent: React.FC<BlockContentProps> = (props) => {\n const { Collapsible, CustomBlock, CustomLabel, ...contextProps } = props\n\n const { BlockDrawer, errorCount, formSchema } = contextProps\n\n const hasSubmitted = useFormSubmitted()\n\n const fieldHasErrors = hasSubmitted && errorCount > 0\n const isEditable = useLexicalEditable()\n\n const CollapsibleWithErrorProps = useMemo(\n () => (collapsibleProps: BlockCollapsibleProps) => {\n const { children, ...rest } = collapsibleProps\n return (\n <Collapsible errorCount={errorCount} fieldHasErrors={fieldHasErrors} {...rest}>\n {children}\n </Collapsible>\n )\n },\n [Collapsible, fieldHasErrors, errorCount],\n )\n\n const blockContextValue: BlockComponentContextType = {\n ...contextProps,\n BlockCollapsible: CollapsibleWithErrorProps,\n }\n\n // Provide context for useBlockComponentContext() hook\n return CustomBlock ? (\n <BlockComponentContext value={blockContextValue}>\n {CustomBlock}\n <BlockDrawer />\n </BlockComponentContext>\n ) : (\n <CollapsibleWithErrorProps>\n <RenderFields\n fields={formSchema}\n forceRender={true}\n parentIndexPath=\"\"\n parentPath={''}\n parentSchemaPath=\"\"\n permissions={true}\n readOnly={!isEditable}\n />\n </CollapsibleWithErrorProps>\n )\n}\n"],"mappings":"AAAA;;AAAA,SAAAA,CAAA,IAA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,EAAA;EAAA;IAAAA,EAAA,GAAAR,CAAA;EAAA;EARF,MAAAa,yBAAA,GACQL,EAON;EAIF,MAAAM,iBAAA;IAAA,GACKV,YAAY;IAAAhB,gBAAA,EACGyB;EAAA;EACpB,OAGOX,WAAA,GACLa,KAAA,CAAA7B,qBAAA;IAAA8B,KAAA,EAA8BF,iBAAA;IAAAJ,QAAA,GAC3BR,WAAA,EACDU,IAAA,CAACvB,WAAA;EAAA,C,IAGHuB,IAAA,CAACC,yBAAA;IAAAH,QAAA,EACCE,IAAA,CAAA/B,YAAA;MAAAoC,MAAA,EACUzB,UAAA;MAAA0B,WAAA;MAAAC,eAAA,EAEQ;MAAAC,UAAA,EACJ;MAAAC,gBAAA,EACK;MAAAC,WAAA;MAAAC,QAAA,GAENhB;IAAA,C;;CAInB","ignoreList":[]}
1
+ {"version":3,"file":"BlockContent.js","names":["c","_c","useLexicalEditable","RenderFields","useFormSubmitted","React","createContext","useMemo","BlockComponentContext","baseClass","BlockCollapsible","BlockDrawer","EditButton","errorCount","formSchema","initialState","nodeKey","RemoveButton","useBlockComponentContext","use","BlockContent","props","$","Collapsible","CustomBlock","CustomLabel","contextProps","hasSubmitted","fieldHasErrors","isEditable","t0","collapsibleProps","children","rest","_jsx","CollapsibleWithErrorProps","blockContextValue","_jsxs","value","fields","forceRender","parentIndexPath","parentPath","parentSchemaPath","permissions","readOnly"],"sources":["../../../../../src/features/blocks/client/component/BlockContent.tsx"],"sourcesContent":["'use client'\nimport type { CollapsibleProps } from '@payloadcms/ui/elements/Collapsible'\nimport type { ClientField, FormState } from 'payload'\n\nimport { useLexicalEditable } from '@lexical/react/useLexicalEditable'\nimport { RenderFields, useFormSubmitted } from '@payloadcms/ui'\nimport React, { createContext, useMemo } from 'react'\n\nexport type BlockCollapsibleProps = {\n /**\n * Replace the top-right portion of the header that renders the Edit and Remove buttons with custom content.\n * If this property is provided, the `removeButton` and `editButton` properties are ignored.\n */\n Actions?: React.ReactNode\n children?: React.ReactNode\n /**\n * Additional className to the collapsible wrapper\n */\n className?: string\n /**\n * Props to pass to the underlying Collapsible component. You could use this to override the `Header` entirely, for example.\n */\n collapsibleProps?: Partial<CollapsibleProps>\n /**\n * Whether to disable rendering the block name field in the header Label\n * @default false\n */\n disableBlockName?: boolean\n /**\n * Whether to show the Edit button\n * If `Actions` is provided, this property is ignored.\n * @default true\n */\n editButton?: boolean\n /**\n * Replace the default Label component with a custom Label\n */\n Label?: React.ReactNode\n /**\n * Replace the default Pill component component that's rendered within the default Label component with a custom Pill.\n * This property has no effect if you provide a custom Label component via the `Label` property.\n */\n Pill?: React.ReactNode\n /**\n * Whether to show the Remove button\n * If `Actions` is provided, this property is ignored.\n * @default true\n */\n removeButton?: boolean\n /**\n * Whether to show the drag handle icon\n * @default true\n */\n showDragHandle?: boolean\n /**\n * Whether to show the row number\n * @default true\n */\n showRowNumber?: boolean\n}\n\nexport type BlockCollapsibleWithErrorProps = {\n errorCount?: number\n fieldHasErrors?: boolean\n} & BlockCollapsibleProps\n\nexport type BlockContentProps = {\n baseClass: string\n BlockDrawer: React.FC\n Collapsible: React.FC<BlockCollapsibleWithErrorProps>\n /**\n * Custom block component (pre-rendered ReactNode).\n */\n CustomBlock?: React.ReactNode\n CustomLabel: React.ReactNode\n EditButton: React.FC\n errorCount: number\n formSchema: ClientField[]\n initialState: false | FormState | undefined\n\n nodeKey: string\n RemoveButton: React.FC\n}\n\nexport type BlockComponentContextType = {\n BlockCollapsible: React.FC<BlockCollapsibleProps>\n} & Omit<BlockContentProps, 'Collapsible' | 'CustomBlock' | 'CustomLabel'>\n\nconst BlockComponentContext = createContext<BlockComponentContextType>({\n baseClass: 'LexicalEditorTheme__block',\n BlockCollapsible: () => null,\n BlockDrawer: () => null,\n EditButton: () => null,\n errorCount: 0,\n formSchema: [],\n initialState: false,\n nodeKey: '',\n RemoveButton: () => null,\n})\n\nexport const useBlockComponentContext = () => React.use(BlockComponentContext)\n\n/**\n * The actual content of the Block. This should be INSIDE a Form component,\n * scoped to the block. All format operations in here are thus scoped to the block's form, and\n * not the whole document.\n */\nexport const BlockContent: React.FC<BlockContentProps> = (props) => {\n const { Collapsible, CustomBlock, CustomLabel, ...contextProps } = props\n\n const { BlockDrawer, errorCount, formSchema } = contextProps\n\n const hasSubmitted = useFormSubmitted()\n\n const fieldHasErrors = hasSubmitted && errorCount > 0\n const isEditable = useLexicalEditable()\n\n const CollapsibleWithErrorProps = useMemo(\n () => (collapsibleProps: BlockCollapsibleProps) => {\n const { children, ...rest } = collapsibleProps\n return (\n <Collapsible errorCount={errorCount} fieldHasErrors={fieldHasErrors} {...rest}>\n {children}\n </Collapsible>\n )\n },\n [Collapsible, fieldHasErrors, errorCount],\n )\n\n const blockContextValue: BlockComponentContextType = {\n ...contextProps,\n BlockCollapsible: CollapsibleWithErrorProps,\n }\n\n // Provide context for useBlockComponentContext() hook\n return CustomBlock ? (\n <BlockComponentContext value={blockContextValue}>\n {CustomBlock}\n <BlockDrawer />\n </BlockComponentContext>\n ) : (\n <CollapsibleWithErrorProps>\n <RenderFields\n fields={formSchema}\n forceRender={true}\n parentIndexPath=\"\"\n parentPath={''}\n parentSchemaPath=\"\"\n permissions={true}\n readOnly={!isEditable}\n />\n </CollapsibleWithErrorProps>\n )\n}\n"],"mappings":"AAAA;;AAAA,SAAAA,CAAA,IAAAC,EAAA;;AAIA,SAASC,kBAAkB,QAAQ;AACnC,SAASC,YAAY,EAAEC,gBAAgB,QAAQ;AAC/C,OAAOC,KAAA,IAASC,aAAa,EAAEC,OAAO,QAAQ;AAkF9C,MAAMC,qBAAA,gBAAwBF,aAAA,CAAyC;EACrEG,SAAA,EAAW;EACXC,gBAAA,EAAkBA,CAAA,KAAM;EACxBC,WAAA,EAAaA,CAAA,KAAM;EACnBC,UAAA,EAAYA,CAAA,KAAM;EAClBC,UAAA,EAAY;EACZC,UAAA,EAAY,EAAE;EACdC,YAAA,EAAc;EACdC,OAAA,EAAS;EACTC,YAAA,EAAcA,CAAA,KAAM;AACtB;AAEA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AAAC,UAAA,EACJ;MAAAC,gBAAA,EACK;MAAAC,WAAA,EACJ;MAAAC,QAAA,EACH,CAAChB;;;CAInB","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"BlockCollapsible.js","names":["React","useBlockComponentContext","BlockCollapsible","props","children","rest","_jsx"],"sources":["../../../../../../src/features/blocks/client/component/components/BlockCollapsible.tsx"],"sourcesContent":["'use client'\nimport React from 'react'\n\nimport { type BlockCollapsibleProps, useBlockComponentContext } from '../BlockContent.js'\n\nexport const BlockCollapsible: React.FC<BlockCollapsibleProps> = (props) => {\n const { children, ...rest } = props\n const { BlockCollapsible } = useBlockComponentContext()\n\n return BlockCollapsible ? <BlockCollapsible {...rest}>{children}</BlockCollapsible> : null\n}\n"],"mappings":"AAAA;;;AACA,OAAOA,KAAA,MAAW;AAElB,SAAqCC,wBAAwB,QAAQ;AAErE,OAAO,MAAMC,gBAAA,GAAoDC,KAAA;EAC/D;IAAAC,QAAA;IAAA,GAAAC;EAAA,IAA8BF,KAAA;EAC9B;IAAAD;EAAA,IAA6BD,wBAAA;EAAA,OAEtBC,gBAAA,GAAmBI,IAAA,CAACJ,gBAAA;IAAA,GAAqBG,IAAI;IAAAD;EAAA,C,QAAkC;AAAA,CACxF","ignoreList":[]}
1
+ {"version":3,"file":"BlockCollapsible.js","names":["React","useBlockComponentContext","BlockCollapsible","props","children","rest","_jsx"],"sources":["../../../../../../src/features/blocks/client/component/components/BlockCollapsible.tsx"],"sourcesContent":["'use client'\nimport React from 'react'\n\nimport { type BlockCollapsibleProps, useBlockComponentContext } from '../BlockContent.js'\n\nexport const BlockCollapsible: React.FC<BlockCollapsibleProps> = (props) => {\n const { children, ...rest } = props\n const { BlockCollapsible } = useBlockComponentContext()\n\n return BlockCollapsible ? <BlockCollapsible {...rest}>{children}</BlockCollapsible> : null\n}\n"],"mappings":"AAAA;;;AACA,OAAOA,KAAA,MAAW;AAElB,SAAqCC,wBAAwB,QAAQ;AAErE,OAAO,MAAMC,gBAAA,GAAoDC,KAAA;EAC/D;IAAAC,QAAA;IAAA,GAAAC;EAAA,IAA8BF,KAAA;EAC9B;IAAAD;EAAA,IAA6BD,wBAAA;EAAA,OAEtBC,gBAAA,GAAmBI,IAAA,CAACJ,gBAAA;IAAA,GAAqBG,IAAI;IAAAD;GAAkC,IAA/E,IAA+E;AAAA,CACxF","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"BlockEditButton.js","names":["c","_c","React","useBlockComponentContext","BlockEditButton","$","EditButton","t0","_jsx"],"sources":["../../../../../../src/features/blocks/client/component/components/BlockEditButton.tsx"],"sourcesContent":["'use client'\nimport React from 'react'\n\nimport { useBlockComponentContext } from '../BlockContent.js'\n\nexport const BlockEditButton = () => {\n const { EditButton } = useBlockComponentContext()\n\n return EditButton ? <EditButton /> : null\n}\n"],"mappings":"AAAA;;AAAA,SAAAA,CAAA,IAAAC,EAAA;;AACA,OAAOC,KAAA,MAAW;AAElB,SAASC,wBAAwB,QAAQ;AAEzC,OAAO,MAAMC,eAAA,GAAkBA,CAAA;EAAA,MAAAC,CAAA,GAAAJ,EAAA;EAC7B;IAAAK;EAAA,IAAuBH,wBAAA;EAAA,IAAAI,EAAA;EAAA,IAAAF,CAAA,QAAAC,UAAA;IAEhBC,EAAA,GAAAD,UAAA,GAAaE,IAAA,CAACF,UAAA,YAAgB;IAAAD,CAAA,MAAAC,UAAA;IAAAD,CAAA,MAAAE,EAAA;EAAA;IAAAA,EAAA,GAAAF,CAAA;EAAA;EAAA,OAA9BE,EAA8B;AAAA,CACvC","ignoreList":[]}
1
+ {"version":3,"file":"BlockEditButton.js","names":["c","_c","React","useBlockComponentContext","BlockEditButton","$","EditButton","t0","_jsx"],"sources":["../../../../../../src/features/blocks/client/component/components/BlockEditButton.tsx"],"sourcesContent":["'use client'\nimport React from 'react'\n\nimport { useBlockComponentContext } from '../BlockContent.js'\n\nexport const BlockEditButton = () => {\n const { EditButton } = useBlockComponentContext()\n\n return EditButton ? <EditButton /> : null\n}\n"],"mappings":"AAAA;;AAAA,SAAAA,CAAA,IAAAC,EAAA;;AACA,OAAOC,KAAA,MAAW;AAElB,SAASC,wBAAwB,QAAQ;AAEzC,OAAO,MAAMC,eAAA,GAAkBA,CAAA;EAAA,MAAAC,CAAA,GAAAJ,EAAA;EAC7B;IAAAK;EAAA,IAAuBH,wBAAA;EAAA,IAAAI,EAAA;EAAA,IAAAF,CAAA,QAAAC,UAAA;IAEhBC,EAAA,GAAAD,UAAA,GAAaE,IAAA,CAACF,UAAA,IAAgB,IAA9B,IAA8B;IAAAD,CAAA,MAAAC,UAAA;IAAAD,CAAA,MAAAE,EAAA;EAAA;IAAAA,EAAA,GAAAF,CAAA;EAAA;EAAA,OAA9BE,EAA8B;AAAA,CACvC","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"BlockRemoveButton.js","names":["c","_c","React","useBlockComponentContext","BlockRemoveButton","$","RemoveButton","t0","_jsx"],"sources":["../../../../../../src/features/blocks/client/component/components/BlockRemoveButton.tsx"],"sourcesContent":["'use client'\nimport React from 'react'\n\nimport { useBlockComponentContext } from '../BlockContent.js'\n\nexport const BlockRemoveButton = () => {\n const { RemoveButton } = useBlockComponentContext()\n\n return RemoveButton ? <RemoveButton /> : null\n}\n"],"mappings":"AAAA;;AAAA,SAAAA,CAAA,IAAAC,EAAA;;AACA,OAAOC,KAAA,MAAW;AAElB,SAASC,wBAAwB,QAAQ;AAEzC,OAAO,MAAMC,iBAAA,GAAoBA,CAAA;EAAA,MAAAC,CAAA,GAAAJ,EAAA;EAC/B;IAAAK;EAAA,IAAyBH,wBAAA;EAAA,IAAAI,EAAA;EAAA,IAAAF,CAAA,QAAAC,YAAA;IAElBC,EAAA,GAAAD,YAAA,GAAeE,IAAA,CAACF,YAAA,YAAkB;IAAAD,CAAA,MAAAC,YAAA;IAAAD,CAAA,MAAAE,EAAA;EAAA;IAAAA,EAAA,GAAAF,CAAA;EAAA;EAAA,OAAlCE,EAAkC;AAAA,CAC3C","ignoreList":[]}
1
+ {"version":3,"file":"BlockRemoveButton.js","names":["c","_c","React","useBlockComponentContext","BlockRemoveButton","$","RemoveButton","t0","_jsx"],"sources":["../../../../../../src/features/blocks/client/component/components/BlockRemoveButton.tsx"],"sourcesContent":["'use client'\nimport React from 'react'\n\nimport { useBlockComponentContext } from '../BlockContent.js'\n\nexport const BlockRemoveButton = () => {\n const { RemoveButton } = useBlockComponentContext()\n\n return RemoveButton ? <RemoveButton /> : null\n}\n"],"mappings":"AAAA;;AAAA,SAAAA,CAAA,IAAAC,EAAA;;AACA,OAAOC,KAAA,MAAW;AAElB,SAASC,wBAAwB,QAAQ;AAEzC,OAAO,MAAMC,iBAAA,GAAoBA,CAAA;EAAA,MAAAC,CAAA,GAAAJ,EAAA;EAC/B;IAAAK;EAAA,IAAyBH,wBAAA;EAAA,IAAAI,EAAA;EAAA,IAAAF,CAAA,QAAAC,YAAA;IAElBC,EAAA,GAAAD,YAAA,GAAeE,IAAA,CAACF,YAAA,IAAkB,IAAlC,IAAkC;IAAAD,CAAA,MAAAC,YAAA;IAAAD,CAAA,MAAAE,EAAA;EAAA;IAAAA,EAAA,GAAAF,CAAA;EAAA;EAAA,OAAlCE,EAAkC;AAAA,CAC3C","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/features/blocks/client/component/index.tsx"],"names":[],"mappings":"AAqCA,OAAO,KAAkD,MAAM,OAAO,CAAA;AAGtE,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,4BAA4B,CAAA;AAC5E,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAA;AAEzD,OAAO,aAAa,CAAA;AACpB,OAAO,8CAA8C,CAAA;AAmBrD,MAAM,MAAM,mBAAmB,CAAC,SAAS,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,WAAW,IAAI;IACzF;;;;OAIG;IACH,QAAQ,CAAC,WAAW,EAAE,MAAM,CAA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,EAAE,KAAK,CAAC,EAAE,CAAC,mBAAmB,CA0yBxD,CAAA"}
@@ -1,5 +1,6 @@
1
1
  'use client';
2
2
 
3
+ import { c as _c } from "react/compiler-runtime";
3
4
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
4
5
  import { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext';
5
6
  import { useLexicalEditable } from '@lexical/react/useLexicalEditable';
@@ -147,7 +148,7 @@ export const BlockComponent = props => {
147
148
  isEditor: true,
148
149
  isJSXConverter: false,
149
150
  nodeKey: nodeKey,
150
- // eslint-disable-next-line react-compiler/react-compiler -- intentionally passed as a prop for custom block components to call
151
+ // eslint-disable-next-line react-hooks/hooks -- intentionally passed as a prop for custom block components to call
151
152
  useBlockComponentContext: useBlockComponentContext
152
153
  });
153
154
  }
@@ -161,7 +162,7 @@ export const BlockComponent = props => {
161
162
  isEditor: true,
162
163
  isJSXConverter: false,
163
164
  nodeKey: nodeKey,
164
- // eslint-disable-next-line react-compiler/react-compiler -- intentionally passed as a prop for custom block components to call
165
+ // eslint-disable-next-line react-hooks/hooks -- intentionally passed as a prop for custom block components to call
165
166
  useBlockComponentContext: useBlockComponentContext
166
167
  });
167
168
  }
@@ -186,9 +187,7 @@ export const BlockComponent = props => {
186
187
  fields: true
187
188
  },
188
189
  docPreferences: await getDocPreferences(),
189
- documentFormState: deepCopyObjectSimpleWithoutReactComponents(parentDocumentFields, {
190
- excludeFiles: true
191
- }),
190
+ documentFormState: parentDocumentFields,
192
191
  globalSlug,
193
192
  initialBlockData: formData,
194
193
  operation: 'update',
@@ -249,9 +248,7 @@ export const BlockComponent = props => {
249
248
  abortAndIgnore(onChangeAbortControllerRef.current);
250
249
  const controller = new AbortController();
251
250
  onChangeAbortControllerRef.current = controller;
252
- const blockData = reduceFormStateToBlockData(deepCopyObjectSimpleWithoutReactComponents(prevFormState, {
253
- excludeFiles: true
254
- }), formDataRef.current);
251
+ const blockData = reduceFormStateToBlockData(prevFormState, formDataRef.current);
255
252
  const {
256
253
  state: newFormState
257
254
  } = await getFormState({
@@ -262,9 +259,7 @@ export const BlockComponent = props => {
262
259
  fields: true
263
260
  },
264
261
  docPreferences: await getDocPreferences(),
265
- documentFormState: deepCopyObjectSimpleWithoutReactComponents(parentDocumentFields, {
266
- excludeFiles: true
267
- }),
262
+ documentFormState: parentDocumentFields,
268
263
  formState: prevFormState,
269
264
  globalSlug,
270
265
  initialBlockData: blockData,
@@ -498,6 +493,7 @@ export const BlockComponent = props => {
498
493
  role: 'button',
499
494
  tabIndex: 0
500
495
  },
496
+ draggable: true,
501
497
  listeners: {
502
498
  onBlur
503
499
  }
@@ -517,10 +513,8 @@ export const BlockComponent = props => {
517
513
  }), !disableBlockName && !clientBlock?.admin?.disableBlockName && /*#__PURE__*/_jsx(SectionTitle, {
518
514
  path: "blockName",
519
515
  readOnly: !isEditable
520
- }), fieldHasErrors && /*#__PURE__*/_jsx(ErrorPill, {
521
- count: errorCount_0 ?? 0,
522
- i18n: i18n,
523
- withMessage: true
516
+ }), fieldHasErrors && /*#__PURE__*/_jsx(BlockErrorPill, {
517
+ count: errorCount_0 ?? 0
524
518
  })]
525
519
  })
526
520
  }),
@@ -545,7 +539,7 @@ export const BlockComponent = props => {
545
539
  }, 0)
546
540
  })
547
541
  });
548
- }, [editor, resolvedCustomBlock, resolvedCustomLabel, blockDisplayName, baseClass, clientBlock?.admin?.disableBlockName, blockType, i18n, isCollapsed, onCollapsedChange, isEditable, nodeKey, removeBlock, rowIndex, t, toggleDrawer]);
542
+ }, [editor, resolvedCustomBlock, resolvedCustomLabel, blockDisplayName, baseClass, clientBlock?.admin?.disableBlockName, blockType, isCollapsed, onCollapsedChange, isEditable, nodeKey, removeBlock, rowIndex, t, toggleDrawer]);
549
543
  const blockID = formData?.id;
550
544
  const {
551
545
  headerActions,
@@ -646,4 +640,32 @@ export const BlockComponent = props => {
646
640
  }
647
641
  return Block;
648
642
  };
643
+ /**
644
+ * Reads `i18n` itself so `BlockCollapsible` does not depend on it. `BlockCollapsible` is created in
645
+ * a `useMemo`, so each new `i18n` object (e.g. once the date-fns locale is set after mount) would
646
+ * remount the whole block, closing its open menus and dropping focus.
647
+ */
648
+ const BlockErrorPill = t0 => {
649
+ const $ = _c(3);
650
+ const {
651
+ count
652
+ } = t0;
653
+ const {
654
+ i18n
655
+ } = useTranslation();
656
+ let t1;
657
+ if ($[0] !== count || $[1] !== i18n) {
658
+ t1 = _jsx(ErrorPill, {
659
+ count,
660
+ i18n,
661
+ withMessage: true
662
+ });
663
+ $[0] = count;
664
+ $[1] = i18n;
665
+ $[2] = t1;
666
+ } else {
667
+ t1 = $[2];
668
+ }
669
+ return t1;
670
+ };
649
671
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["useLexicalComposerContext","useLexicalEditable","getTranslation","Button","Collapsible","Drawer","EditDepthProvider","ErrorPill","Form","formatDrawerSlug","MoreIcon","Pill","Popup","PopupList","RenderFields","SectionTitle","useConfig","useDocumentForm","useDocumentInfo","useEditDepth","useFormSubmitted","useServerFunctions","useTranslation","XIcon","abortAndIgnore","$getNodeByKey","$getRoot","SKIP_DOM_SELECTION_TAG","deepCopyObjectSimpleWithoutReactComponents","React","useCallback","useEffect","useMemo","useRef","v4","uuid","useEditorConfigContext","RegisterFormSubmit","useDrawerSubmit","useLexicalDrawer","getCachedFormStateIfDataMatches","reduceFormStateToBlockData","$isBlockNode","BlockContent","useBlockComponentContext","BlockReordering","BlockComponent","props","cacheBuster","className","baseClass","CustomBlock","CustomBlockFromProps","CustomLabel","CustomLabelFromProps","formData","nodeKey","submitted","id","collectionSlug","globalSlug","fieldProps","featureClientSchemaMap","field","parentLexicalRichTextField","initialLexicalFormState","schemaPath","uuidFromContext","fields","parentDocumentFields","onChangeAbortControllerRef","AbortController","editDepth","errorCount","setErrorCount","useState","config","drawerSlug","slug","depth","toggleDrawer","getDocPreferences","setDocFieldPreferences","editor","isEditable","blockType","formDataRef","current","componentMapRenderedBlockPath","clientSchemaMap","blocksField","blockOrSlug","blocks","clientBlock","blocksMap","getFormState","schemaFieldsPath","initialState","setInitialState","cachedState","cachedFormState","formState","matchingCachedState","cachedSchemaPath","currentSchemaPath","blockName","initialValue","passesCondition","valid","value","hasMounted","prevCacheBuster","formUuid","setCustomLabel","undefined","customComponents","BlockLabel","setCustomBlock","Block","resolvedCustomBlock","_jsx","isEditor","isJSXConverter","resolvedCustomLabel","abortController","awaitInitialState","state","data","docPermissions","docPreferences","documentFormState","excludeFiles","initialBlockData","operation","readOnly","renderAllFields","signal","newFormStateData","update","node","newData","setFields","tag","_components","isCollapsed","setIsCollapsed","collapsed","i18n","t","onChange","prevFormState","submit","controller","blockData","newFormState","setTimeout","rowErrorCount","formField","Object","values","removeBlock","remove","rowIndex","setRowIndex","updateIndex","getEditorState","read","root","children","getChildren","blockCount","child","getKey","registerUpdateListener","blockDisplayName","labels","singular","onCollapsedChange","changedCollapsed","then","currentDocPreferences","currentFieldPreferences","name","collapsedArray","newCollapsed","length","includes","push","splice","indexOf","hello","EditButton","buttonStyle","disabled","el","icon","onClick","e","preventDefault","stopPropagation","onMouseDown","round","size","tooltip","label","RemoveButton","BlockCollapsible","Actions","collapsibleProps","disableBlockName","editButton","fieldHasErrors","Label","CustomPill","removeButton","showDragHandle","showRowNumber","isReordering","move","onBlur","onKeyDown","reorderInstructionsID","targetIndex","onKeyDownCapture","event","target","altKey","ctrlKey","metaKey","closest","parentElement","currentTarget","matches","key","_jsxs","actions","button","buttonAriaLabel","buttonClassName","caret","horizontalAlign","popupType","render","close","ButtonGroup","buttonSize","direction","filter","Boolean","join","collapsibleStyle","dragHandleProps","attributes","role","tabIndex","listeners","header","String","padStart","pillStyle","admin","path","count","withMessage","onToggle","incomingCollapsedState","AfterCollapsible","_Fragment","blockID","headerActions","submitRef","BlockDrawer","title","forceRender","parentIndexPath","parentPath","parentSchemaPath","permissions","style","display","beforeSubmit","onSubmit","formSchema"],"sources":["../../../../../src/features/blocks/client/component/index.tsx"],"sourcesContent":["'use client'\n\nimport { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext'\nimport { useLexicalEditable } from '@lexical/react/useLexicalEditable'\nimport { getTranslation } from '@payloadcms/translations'\nimport {\n Button,\n Collapsible,\n Drawer,\n EditDepthProvider,\n ErrorPill,\n Form,\n formatDrawerSlug,\n MoreIcon,\n Pill,\n Popup,\n PopupList,\n RenderFields,\n SectionTitle,\n useConfig,\n useDocumentForm,\n useDocumentInfo,\n useEditDepth,\n useFormSubmitted,\n useServerFunctions,\n useTranslation,\n XIcon,\n} from '@payloadcms/ui'\nimport { abortAndIgnore } from '@payloadcms/ui/shared'\nimport { $getNodeByKey, $getRoot, SKIP_DOM_SELECTION_TAG } from 'lexical'\nimport {\n type BlocksFieldClient,\n type ClientBlock,\n type CollapsedPreferences,\n type FormState,\n} from 'payload'\nimport { deepCopyObjectSimpleWithoutReactComponents } from 'payload/shared'\nimport React, { useCallback, useEffect, useMemo, useRef } from 'react'\nimport { v4 as uuid } from 'uuid'\n\nimport type { ViewMapBlockComponentProps } from '../../../../types/index.js'\nimport type { BlockFields } from '../../server/schema.js'\n\nimport './index.css'\nimport '../../../../utilities/fieldsDrawer/index.css'\nimport { useEditorConfigContext } from '../../../../lexical/config/client/EditorConfigProvider.js'\nimport {\n RegisterFormSubmit,\n useDrawerSubmit,\n} from '../../../../utilities/fieldsDrawer/useDrawerSubmit.js'\nimport { useLexicalDrawer } from '../../../../utilities/fieldsDrawer/useLexicalDrawer.js'\nimport {\n getCachedFormStateIfDataMatches,\n reduceFormStateToBlockData,\n} from '../getCachedFormStateIfDataMatches.js'\nimport { $isBlockNode } from '../nodes/BlocksNode.js'\nimport {\n type BlockCollapsibleWithErrorProps,\n BlockContent,\n useBlockComponentContext,\n} from './BlockContent.js'\nimport { BlockReordering } from './BlockReordering/index.js'\n\nexport type BlockComponentProps<TFormData extends Record<string, unknown> = BlockFields> = {\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 /**\n * Custom block component from view map\n * Will be rendered with useBlockComponentContext hook.\n */\n readonly CustomBlock?: React.FC<ViewMapBlockComponentProps>\n /**\n * Custom block label from view map\n * Will be rendered with useBlockComponentContext hook.\n */\n readonly CustomLabel?: React.FC<ViewMapBlockComponentProps>\n readonly formData: TFormData\n readonly nodeKey: string\n}\n\nexport const BlockComponent: React.FC<BlockComponentProps> = (props) => {\n const {\n cacheBuster,\n className: baseClass,\n CustomBlock: CustomBlockFromProps,\n CustomLabel: CustomLabelFromProps,\n formData,\n nodeKey,\n } = props\n\n const submitted = useFormSubmitted()\n const { id, collectionSlug, globalSlug } = useDocumentInfo()\n const {\n fieldProps: {\n featureClientSchemaMap,\n field: parentLexicalRichTextField,\n initialLexicalFormState,\n schemaPath,\n },\n uuid: uuidFromContext,\n } = useEditorConfigContext()\n\n const { fields: parentDocumentFields } = useDocumentForm()\n const onChangeAbortControllerRef = useRef(new AbortController())\n const editDepth = useEditDepth()\n const [errorCount, setErrorCount] = React.useState(0)\n\n const { config } = useConfig()\n\n const drawerSlug = formatDrawerSlug({\n slug: `lexical-blocks-create-${uuidFromContext}-${formData.id}`,\n depth: editDepth,\n })\n const { toggleDrawer } = useLexicalDrawer(drawerSlug)\n\n // Used for saving collapsed to preferences (and gettin' it from there again)\n // Remember, these preferences are scoped to the whole document, not just this form. This\n // is important to consider for the data path used in setDocFieldPreferences\n const { getDocPreferences, setDocFieldPreferences } = useDocumentInfo()\n const [editor] = useLexicalComposerContext()\n const isEditable = useLexicalEditable()\n\n const blockType = formData.blockType\n const formDataRef = useRef(formData)\n formDataRef.current = formData\n\n const componentMapRenderedBlockPath = `${schemaPath}.lexical_internal_feature.blocks.lexical_blocks.${blockType}`\n\n const clientSchemaMap = featureClientSchemaMap['blocks']\n\n const blocksField: BlocksFieldClient | undefined = clientSchemaMap?.[\n componentMapRenderedBlockPath\n ]?.[0] as BlocksFieldClient | undefined\n\n const blockOrSlug = blocksField?.blocks?.[0]\n const clientBlock: ClientBlock | undefined =\n typeof blockOrSlug === 'string' ? config.blocksMap[blockOrSlug] : blockOrSlug\n\n const { getFormState } = useServerFunctions()\n const schemaFieldsPath = `${schemaPath}.lexical_internal_feature.blocks.lexical_blocks.${blockType}.fields`\n\n const [initialState, setInitialState] = React.useState<false | FormState | undefined>(() => {\n // Initial form state that was calculated server-side. May have stale values\n const cachedState = initialLexicalFormState?.[formData.id]\n const cachedFormState = cachedState?.formState\n if (!cachedFormState) {\n return false\n }\n\n const matchingCachedState = getCachedFormStateIfDataMatches({\n cachedFormState,\n cachedSchemaPath: cachedState.schemaPath,\n currentSchemaPath: schemaFieldsPath,\n formData,\n })\n if (!matchingCachedState) {\n return false\n }\n\n // Manually add blockName, as it's not part of cachedFormState\n return {\n ...matchingCachedState,\n blockName: {\n initialValue: formData.blockName,\n passesCondition: true,\n valid: true,\n value: formData.blockName,\n },\n }\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 [formUuid] = React.useState(() => uuid())\n\n // Server-rendered custom components (from admin.components, NOT viewMap).\n // When viewMap components exist (CustomBlockFromProps/CustomLabelFromProps),\n // we render them directly with formData instead, so these states are unused.\n const [CustomLabel, setCustomLabel] = React.useState<React.ReactNode | undefined>(() => {\n if (CustomLabelFromProps) {\n return undefined\n }\n // @ts-expect-error - vestiges of when tsconfig was not strict. Feel free to improve\n return initialState?.['_components']?.customComponents?.BlockLabel ?? undefined\n })\n\n const [CustomBlock, setCustomBlock] = React.useState<React.ReactNode | undefined>(() => {\n if (CustomBlockFromProps) {\n return undefined\n }\n // @ts-expect-error - vestiges of when tsconfig was not strict. Feel free to improve\n return initialState?.['_components']?.customComponents?.Block ?? undefined\n })\n\n // When viewMap components exist, render directly with formData (always current from\n // the lexical node). When they don't, fall back to server-rendered state.\n const resolvedCustomBlock = useMemo(() => {\n if (CustomBlockFromProps) {\n return (\n <CustomBlockFromProps\n className={baseClass}\n formData={formData}\n isEditor={true}\n isJSXConverter={false}\n nodeKey={nodeKey}\n // eslint-disable-next-line react-compiler/react-compiler -- intentionally passed as a prop for custom block components to call\n useBlockComponentContext={useBlockComponentContext}\n />\n )\n }\n return CustomBlock\n }, [CustomBlockFromProps, baseClass, formData, nodeKey, CustomBlock])\n\n const resolvedCustomLabel = useMemo(() => {\n if (CustomLabelFromProps) {\n return (\n <CustomLabelFromProps\n className={baseClass}\n formData={formData}\n isEditor={true}\n isJSXConverter={false}\n nodeKey={nodeKey}\n // eslint-disable-next-line react-compiler/react-compiler -- intentionally passed as a prop for custom block components to call\n useBlockComponentContext={useBlockComponentContext}\n />\n )\n }\n return CustomLabel\n }, [CustomLabelFromProps, baseClass, formData, nodeKey, CustomLabel])\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 excludeFiles: true,\n }),\n globalSlug,\n initialBlockData: formData,\n operation: 'update',\n readOnly: !isEditable,\n renderAllFields: true,\n schemaPath: schemaFieldsPath,\n signal: abortController.signal,\n })\n\n if (state) {\n state.blockName = {\n initialValue: formData.blockName,\n passesCondition: true,\n valid: true,\n value: formData.blockName,\n }\n\n const newFormStateData = reduceFormStateToBlockData(\n deepCopyObjectSimpleWithoutReactComponents(state, { excludeFiles: true }),\n ) as BlockFields\n\n // Things like default values may come back from the server => update the node with the new data\n editor.update(\n () => {\n const node = $getNodeByKey(nodeKey)\n if (node && $isBlockNode(node)) {\n const newData = newFormStateData\n newData.blockType = blockType\n\n node.setFields(newData, true)\n }\n },\n // Without this, the outer editor's reconciler resets DOM selection\n // back into its own root, kicking focus out of any nested richText.\n { tag: SKIP_DOM_SELECTION_TAG },\n )\n\n setInitialState(state)\n if (!CustomLabelFromProps) {\n setCustomLabel(state._components?.customComponents?.BlockLabel ?? undefined)\n }\n if (!CustomBlockFromProps) {\n setCustomBlock(state._components?.customComponents?.Block ?? undefined)\n }\n }\n }\n\n if (clientBlock && formData && !initialState) {\n void awaitInitialState()\n }\n\n return () => {\n abortAndIgnore(abortController)\n }\n }, [\n getFormState,\n schemaFieldsPath,\n isEditable,\n id,\n CustomLabelFromProps,\n CustomBlockFromProps,\n formData,\n editor,\n nodeKey,\n initialState,\n collectionSlug,\n globalSlug,\n getDocPreferences,\n parentDocumentFields,\n blockType,\n clientBlock,\n ])\n\n const [isCollapsed, setIsCollapsed] = React.useState<boolean>(\n initialLexicalFormState?.[formData.id]?.collapsed ?? false,\n )\n\n const { i18n, t } = useTranslation<object, string>()\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 const blockData = reduceFormStateToBlockData(\n deepCopyObjectSimpleWithoutReactComponents(prevFormState, { excludeFiles: true }),\n formDataRef.current,\n )\n\n const { state: newFormState } = await getFormState({\n id,\n collectionSlug,\n data: blockData,\n docPermissions: {\n fields: true,\n },\n docPreferences: await getDocPreferences(),\n documentFormState: deepCopyObjectSimpleWithoutReactComponents(parentDocumentFields, {\n excludeFiles: true,\n }),\n formState: prevFormState,\n globalSlug,\n initialBlockData: blockData,\n operation: 'update',\n readOnly: !isEditable,\n renderAllFields: submit ? true : false,\n schemaPath: schemaFieldsPath,\n signal: controller.signal,\n })\n\n if (!newFormState) {\n return prevFormState\n }\n\n if (prevFormState.blockName) {\n newFormState.blockName = prevFormState.blockName\n }\n\n const newFormStateData = reduceFormStateToBlockData(\n deepCopyObjectSimpleWithoutReactComponents(newFormState, { excludeFiles: true }),\n blockData,\n ) as BlockFields\n\n setTimeout(() => {\n editor.update(\n () => {\n const node = $getNodeByKey(nodeKey)\n if (node && $isBlockNode(node)) {\n const newData = newFormStateData\n newData.blockType = blockType\n node.setFields(newData, true)\n }\n },\n // Without this, the outer editor's reconciler resets DOM selection\n // back into its own root, kicking focus out of any nested richText.\n { tag: SKIP_DOM_SELECTION_TAG },\n )\n }, 0)\n\n if (submit) {\n if (!CustomLabelFromProps) {\n setCustomLabel(newFormState._components?.customComponents?.BlockLabel ?? undefined)\n }\n if (!CustomBlockFromProps) {\n setCustomBlock(newFormState._components?.customComponents?.Block ?? undefined)\n }\n\n let rowErrorCount = 0\n for (const formField of Object.values(newFormState)) {\n if (formField?.valid === false) {\n rowErrorCount++\n }\n }\n setErrorCount(rowErrorCount)\n }\n\n return newFormState\n },\n\n [\n getFormState,\n id,\n collectionSlug,\n getDocPreferences,\n globalSlug,\n schemaFieldsPath,\n blockType,\n parentDocumentFields,\n isEditable,\n editor,\n nodeKey,\n CustomBlockFromProps,\n CustomLabelFromProps,\n ],\n )\n\n useEffect(() => {\n return () => {\n abortAndIgnore(onChangeAbortControllerRef.current)\n }\n }, [])\n\n const removeBlock = useCallback(() => {\n editor.update(() => {\n $getNodeByKey(nodeKey)?.remove()\n })\n }, [editor, nodeKey])\n\n const [rowIndex, setRowIndex] = React.useState<number>(0)\n\n useEffect(() => {\n const updateIndex = () => {\n editor.getEditorState().read(() => {\n const root = $getRoot()\n const children = root.getChildren()\n let blockCount = 0\n for (const child of children) {\n if ($isBlockNode(child)) {\n if (child.getKey() === nodeKey) {\n setRowIndex(blockCount)\n return\n }\n blockCount++\n }\n }\n })\n }\n updateIndex()\n return editor.registerUpdateListener(() => {\n updateIndex()\n })\n }, [editor, nodeKey])\n\n const blockDisplayName = clientBlock?.labels?.singular\n ? getTranslation(clientBlock.labels.singular, i18n)\n : clientBlock?.slug\n\n const onCollapsedChange = useCallback(\n (changedCollapsed: boolean) => {\n void getDocPreferences().then((currentDocPreferences) => {\n const currentFieldPreferences =\n currentDocPreferences?.fields?.[parentLexicalRichTextField.name]\n\n const collapsedArray = currentFieldPreferences?.collapsed\n\n const newCollapsed: CollapsedPreferences =\n collapsedArray && collapsedArray?.length ? collapsedArray : []\n\n if (changedCollapsed) {\n if (!newCollapsed.includes(formData.id)) {\n newCollapsed.push(formData.id)\n }\n } else {\n if (newCollapsed.includes(formData.id)) {\n newCollapsed.splice(newCollapsed.indexOf(formData.id), 1)\n }\n }\n\n setDocFieldPreferences(parentLexicalRichTextField.name, {\n collapsed: newCollapsed,\n hello: 'hi',\n })\n })\n },\n [getDocPreferences, parentLexicalRichTextField.name, setDocFieldPreferences, formData.id],\n )\n\n const EditButton = useMemo(\n () => () => (\n <Button\n buttonStyle=\"ghost\"\n className={`${baseClass}__editButton`}\n disabled={!isEditable}\n el=\"button\"\n icon=\"edit\"\n onClick={(e) => {\n e.preventDefault()\n e.stopPropagation()\n toggleDrawer()\n return false\n }}\n onMouseDown={(e) => {\n // Needed to preserve lexical selection for toggleDrawer lexical selection restore.\n // I believe this is needed due to this button (usually) being inside of a collapsible.\n e.preventDefault()\n }}\n round\n size=\"medium\"\n tooltip={t('lexical:blocks:inlineBlocks:edit', { label: blockDisplayName })}\n />\n ),\n [baseClass, isEditable, t, blockDisplayName, toggleDrawer],\n )\n\n const RemoveButton = useMemo(\n () => () => (\n <Button\n buttonStyle=\"ghost\"\n className={`${baseClass}__removeButton`}\n disabled={!isEditable}\n icon=\"x\"\n onClick={(e) => {\n e.preventDefault()\n removeBlock()\n }}\n round\n tooltip=\"Remove Block\"\n />\n ),\n [baseClass, isEditable, removeBlock],\n )\n\n const BlockCollapsible = useMemo(\n () =>\n function BlockCollapsible({\n Actions,\n children,\n className,\n collapsibleProps,\n disableBlockName,\n editButton,\n errorCount,\n fieldHasErrors,\n Label,\n Pill: CustomPill,\n removeButton,\n showDragHandle = true,\n showRowNumber = true,\n }: BlockCollapsibleWithErrorProps) {\n return (\n <BlockReordering editor={editor} nodeKey={nodeKey}>\n {({ isReordering, move, onBlur, onKeyDown, reorderInstructionsID, targetIndex }) => (\n <div\n className={`${baseClass}__container ${baseClass}-${blockType}`}\n onKeyDownCapture={(event) => {\n const target = event.target as HTMLElement\n\n if (\n event.altKey ||\n event.ctrlKey ||\n event.metaKey ||\n target.closest('.collapsible')?.parentElement !== event.currentTarget\n ) {\n return\n }\n // Handle controls before Lexical consumes keys using its retained text selection.\n if (\n target.matches('.collapsible__drag') &&\n (event.key !== 'Escape' || isReordering) &&\n [' ', 'ArrowDown', 'ArrowUp', 'Enter', 'Escape', 'Tab'].includes(event.key)\n ) {\n onKeyDown(event)\n event.stopPropagation()\n } else if (event.key === 'Tab' && target.matches('.collapsible__toggle')) {\n event.stopPropagation()\n }\n }}\n >\n <Collapsible\n actions={\n typeof Actions !== 'undefined' ? (\n Actions\n ) : isEditable ? (\n <Popup\n button={<MoreIcon />}\n buttonAriaLabel={t('general:moreOptions')}\n buttonClassName={`${baseClass}__actions-button`}\n caret={false}\n horizontalAlign=\"right\"\n popupType=\"menu\"\n render={({ close }) => (\n <PopupList.ButtonGroup buttonSize=\"medium\">\n <PopupList.Button\n onClick={() => {\n close()\n move({ direction: -1 })\n }}\n >\n {t('general:moveUp')}\n </PopupList.Button>\n <PopupList.Button\n onClick={() => {\n close()\n move({ direction: 1 })\n }}\n >\n {t('general:moveDown')}\n </PopupList.Button>\n {((resolvedCustomBlock && editButton !== false) ||\n (!resolvedCustomBlock && editButton)) && (\n <PopupList.Button\n onClick={() => {\n toggleDrawer()\n close()\n }}\n >\n {t('general:edit')}\n </PopupList.Button>\n )}\n {removeButton !== false && (\n <PopupList.Button\n onClick={() => {\n removeBlock()\n close()\n }}\n >\n <XIcon />\n {t('general:remove')}\n </PopupList.Button>\n )}\n </PopupList.ButtonGroup>\n )}\n size=\"large\"\n />\n ) : null\n }\n className={[\n `${baseClass}__row`,\n fieldHasErrors\n ? `${baseClass}__row--has-errors`\n : `${baseClass}__row--no-errors`,\n className,\n ]\n .filter(Boolean)\n .join(' ')}\n collapsibleStyle={fieldHasErrors ? 'error' : 'default'}\n dragHandleProps={\n showDragHandle && isEditable\n ? {\n id: nodeKey,\n attributes: {\n 'aria-describedby': reorderInstructionsID,\n 'aria-pressed': isReordering,\n role: 'button',\n tabIndex: 0,\n },\n listeners: { onBlur },\n }\n : undefined\n }\n header={\n <div className={`${baseClass}__block-header`}>\n {typeof Label !== 'undefined' ? (\n Label\n ) : typeof resolvedCustomLabel !== 'undefined' ? (\n resolvedCustomLabel\n ) : (\n <div className={`${baseClass}__block-label`}>\n {showRowNumber && (\n <span className={`${baseClass}__block-number`}>\n {String(rowIndex + 1).padStart(2, '0')}\n </span>\n )}\n {typeof CustomPill !== 'undefined' ? (\n CustomPill\n ) : (\n <Pill\n className={`${baseClass}__block-pill ${baseClass}__block-pill-${blockType}`}\n pillStyle=\"white\"\n size=\"small\"\n >\n {blockDisplayName ?? blockType}\n </Pill>\n )}\n {!disableBlockName && !clientBlock?.admin?.disableBlockName && (\n <SectionTitle path=\"blockName\" readOnly={!isEditable} />\n )}\n\n {fieldHasErrors && (\n <ErrorPill count={errorCount ?? 0} i18n={i18n} withMessage />\n )}\n </div>\n )}\n </div>\n }\n isCollapsed={isCollapsed}\n key={0}\n onToggle={(incomingCollapsedState) => {\n onCollapsedChange(incomingCollapsedState)\n setIsCollapsed(incomingCollapsedState)\n }}\n {...(collapsibleProps || {})}\n AfterCollapsible={\n <>\n {collapsibleProps?.AfterCollapsible}\n <span className=\"sr-only\" role=\"status\">\n {isReordering ? `${t('general:order')}: ${(targetIndex ?? 0) + 1}` : ''}\n </span>\n </>\n }\n >\n <span className=\"sr-only\" id={reorderInstructionsID}>\n Space / Enter · {t('general:moveUp')} ↑ · {t('general:moveDown')} ↓ ·{' '}\n {t('general:cancel')} Escape\n </span>\n {children}\n </Collapsible>\n </div>\n )}\n </BlockReordering>\n )\n },\n [\n editor,\n resolvedCustomBlock,\n resolvedCustomLabel,\n blockDisplayName,\n baseClass,\n clientBlock?.admin?.disableBlockName,\n blockType,\n i18n,\n isCollapsed,\n onCollapsedChange,\n isEditable,\n nodeKey,\n removeBlock,\n rowIndex,\n t,\n toggleDrawer,\n ],\n )\n\n const blockID = formData?.id\n\n const { headerActions, submitRef } = useDrawerSubmit()\n\n const BlockDrawer = useMemo(\n () => () => (\n <EditDepthProvider>\n <Drawer\n className={''}\n headerActions={headerActions}\n slug={drawerSlug}\n title={t(`lexical:blocks:inlineBlocks:${blockID ? 'edit' : 'create'}`, {\n label: blockDisplayName ?? t('lexical:blocks:inlineBlocks:label'),\n })}\n >\n {initialState ? (\n <div className=\"fields-drawer\">\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 <RegisterFormSubmit submitRef={submitRef} />\n </div>\n ) : null}\n </Drawer>\n </EditDepthProvider>\n ),\n [\n initialState,\n drawerSlug,\n blockID,\n blockDisplayName,\n t,\n isEditable,\n clientBlock?.fields,\n schemaFieldsPath,\n headerActions,\n submitRef,\n // DO NOT ADD FORMDATA HERE! Adding formData will kick you out of sub block editors while writing.\n ],\n )\n\n // Memoized Form JSX\n const Block = useMemo(() => {\n if (!initialState) {\n return null\n }\n return (\n <div data-block-drawer-slug={drawerSlug} style={{ display: 'contents' }}>\n <Form\n beforeSubmit={[\n async ({ formState }) => {\n // This is only called when form is submitted from drawer - usually only the case if the block has a custom Block component\n return await onChange({ formState, submit: true })\n },\n ]}\n el=\"div\"\n fields={clientBlock?.fields ?? []}\n initialState={initialState}\n onChange={[onChange]}\n onSubmit={(formState) => {\n // This is only called when form is submitted from drawer - usually only the case if the block has a custom Block component\n const newData = reduceFormStateToBlockData(\n formState,\n formDataRef.current,\n ) as BlockFields\n newData.blockType = blockType\n editor.update(\n () => {\n const node = $getNodeByKey(nodeKey)\n if (node && $isBlockNode(node)) {\n node.setFields(newData, true)\n }\n },\n // Without this, the outer editor's reconciler resets DOM selection\n // back into its own root, kicking focus out of any nested richText.\n { tag: SKIP_DOM_SELECTION_TAG },\n )\n toggleDrawer()\n }}\n submitted={submitted}\n uuid={formUuid}\n >\n <BlockContent\n baseClass={baseClass}\n BlockDrawer={BlockDrawer}\n Collapsible={BlockCollapsible}\n CustomBlock={resolvedCustomBlock}\n CustomLabel={resolvedCustomLabel}\n EditButton={EditButton}\n errorCount={errorCount}\n formSchema={clientBlock?.fields ?? []}\n initialState={initialState}\n nodeKey={nodeKey}\n RemoveButton={RemoveButton}\n />\n </Form>\n </div>\n )\n }, [\n BlockCollapsible,\n BlockDrawer,\n resolvedCustomBlock,\n resolvedCustomLabel,\n blockType,\n drawerSlug,\n RemoveButton,\n EditButton,\n baseClass,\n editor,\n errorCount,\n toggleDrawer,\n clientBlock?.fields,\n formUuid,\n initialState,\n nodeKey,\n onChange,\n submitted,\n ])\n\n if (!clientBlock) {\n return (\n <BlockCollapsible disableBlockName={true} fieldHasErrors={true}>\n <div className={`${baseClass}-not-found`}>\n Error: Block '{blockType}' not found in the config but exists in the lexical data\n </div>\n </BlockCollapsible>\n )\n }\n\n return Block\n}\n"],"mappings":"AAAA;;;AAEA,SAASA,yBAAyB,QAAQ;AAC1C,SAASC,kBAAkB,QAAQ;AACnC,SAASC,cAAc,QAAQ;AAC/B,SACEC,MAAM,EACNC,WAAW,EACXC,MAAM,EACNC,iBAAiB,EACjBC,SAAS,EACTC,IAAI,EACJC,gBAAgB,EAChBC,QAAQ,EACRC,IAAI,EACJC,KAAK,EACLC,SAAS,EACTC,YAAY,EACZC,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A,EACAI,mBAAA,EACAtC,SAAA,EACAR,UAAA,EACAgI,YAAA,EACAd,UAAA,EACA7I,SAAA,EACAiC,MAAA,EACAV,UAAA,EACAO,YAAA,EACAa,WAAA,EAAazB,MAAA,EACb4C,QAAA,EACAf,YAAA,EACAzC,OAAA,EACA6F,QAAA,EACA5F,SAAA,CACD;EAED,IAAI,CAACoC,WAAA,EAAa;IAChB,oBACE2B,IAAA,CAACsF,gBAAA;MAAiBG,gBAAA,EAAkB;MAAME,cAAA,EAAgB;gBACxD,aAAAuB,KAAA,CAAC;QAAIzL,SAAA,EAAW,GAAGC,SAAA,YAAqB;mBAAE,kBACzBmC,SAAA,EAAU;;;EAIjC;EAEA,OAAOiC,KAAA;AACT","ignoreList":[]}
1
+ {"version":3,"file":"index.js","names":["c","_c","useLexicalComposerContext","useLexicalEditable","getTranslation","Button","Collapsible","Drawer","EditDepthProvider","ErrorPill","Form","formatDrawerSlug","MoreIcon","Pill","Popup","PopupList","RenderFields","SectionTitle","useConfig","useDocumentForm","useDocumentInfo","useEditDepth","useFormSubmitted","useServerFunctions","useTranslation","XIcon","abortAndIgnore","$getNodeByKey","$getRoot","SKIP_DOM_SELECTION_TAG","deepCopyObjectSimpleWithoutReactComponents","React","useCallback","useEffect","useMemo","useRef","v4","uuid","useEditorConfigContext","RegisterFormSubmit","useDrawerSubmit","useLexicalDrawer","getCachedFormStateIfDataMatches","reduceFormStateToBlockData","$isBlockNode","BlockContent","useBlockComponentContext","BlockReordering","BlockComponent","props","cacheBuster","className","baseClass","CustomBlock","CustomBlockFromProps","CustomLabel","CustomLabelFromProps","formData","nodeKey","submitted","id","collectionSlug","globalSlug","fieldProps","featureClientSchemaMap","field","parentLexicalRichTextField","initialLexicalFormState","schemaPath","uuidFromContext","fields","parentDocumentFields","onChangeAbortControllerRef","AbortController","editDepth","errorCount","setErrorCount","useState","config","drawerSlug","slug","depth","toggleDrawer","getDocPreferences","setDocFieldPreferences","editor","isEditable","blockType","formDataRef","current","componentMapRenderedBlockPath","clientSchemaMap","blocksField","blockOrSlug","blocks","clientBlock","blocksMap","getFormState","schemaFieldsPath","initialState","setInitialState","cachedState","cachedFormState","formState","matchingCachedState","cachedSchemaPath","currentSchemaPath","blockName","initialValue","passesCondition","valid","value","hasMounted","prevCacheBuster","formUuid","setCustomLabel","undefined","customComponents","BlockLabel","setCustomBlock","Block","resolvedCustomBlock","_jsx","isEditor","isJSXConverter","resolvedCustomLabel","abortController","awaitInitialState","state","data","docPermissions","docPreferences","documentFormState","initialBlockData","operation","readOnly","renderAllFields","signal","newFormStateData","excludeFiles","update","node","newData","setFields","tag","_components","isCollapsed","setIsCollapsed","collapsed","i18n","t","onChange","prevFormState","submit","controller","blockData","newFormState","setTimeout","rowErrorCount","formField","Object","values","removeBlock","remove","rowIndex","setRowIndex","updateIndex","getEditorState","read","root","children","getChildren","blockCount","child","getKey","registerUpdateListener","blockDisplayName","labels","singular","onCollapsedChange","changedCollapsed","then","currentDocPreferences","currentFieldPreferences","name","collapsedArray","newCollapsed","length","includes","push","splice","indexOf","hello","EditButton","buttonStyle","disabled","el","icon","onClick","e","preventDefault","stopPropagation","onMouseDown","round","size","tooltip","label","RemoveButton","BlockCollapsible","Actions","collapsibleProps","disableBlockName","editButton","fieldHasErrors","Label","CustomPill","removeButton","showDragHandle","showRowNumber","isReordering","move","onBlur","onKeyDown","reorderInstructionsID","targetIndex","onKeyDownCapture","event","target","altKey","ctrlKey","metaKey","closest","parentElement","currentTarget","matches","key","_jsxs","actions","button","buttonAriaLabel","buttonClassName","caret","horizontalAlign","popupType","render","close","ButtonGroup","buttonSize","direction","filter","Boolean","join","collapsibleStyle","dragHandleProps","attributes","role","tabIndex","draggable","listeners","header","String","padStart","pillStyle","admin","path","BlockErrorPill","count","onToggle","incomingCollapsedState","AfterCollapsible","_Fragment","blockID","headerActions","submitRef","BlockDrawer","title","forceRender","parentIndexPath","parentPath","parentSchemaPath","permissions","style","display","beforeSubmit","onSubmit","formSchema","t0","$","t1","withMessage"],"sources":["../../../../../src/features/blocks/client/component/index.tsx"],"sourcesContent":["'use client'\n\nimport { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext'\nimport { useLexicalEditable } from '@lexical/react/useLexicalEditable'\nimport { getTranslation } from '@payloadcms/translations'\nimport {\n Button,\n Collapsible,\n Drawer,\n EditDepthProvider,\n ErrorPill,\n Form,\n formatDrawerSlug,\n MoreIcon,\n Pill,\n Popup,\n PopupList,\n RenderFields,\n SectionTitle,\n useConfig,\n useDocumentForm,\n useDocumentInfo,\n useEditDepth,\n useFormSubmitted,\n useServerFunctions,\n useTranslation,\n XIcon,\n} from '@payloadcms/ui'\nimport { abortAndIgnore } from '@payloadcms/ui/shared'\nimport { $getNodeByKey, $getRoot, SKIP_DOM_SELECTION_TAG } from 'lexical'\nimport {\n type BlocksFieldClient,\n type ClientBlock,\n type CollapsedPreferences,\n type FormState,\n} from 'payload'\nimport { deepCopyObjectSimpleWithoutReactComponents } from 'payload/shared'\nimport React, { useCallback, useEffect, useMemo, useRef } from 'react'\nimport { v4 as uuid } from 'uuid'\n\nimport type { ViewMapBlockComponentProps } from '../../../../types/index.js'\nimport type { BlockFields } from '../../server/schema.js'\n\nimport './index.css'\nimport '../../../../utilities/fieldsDrawer/index.css'\nimport { useEditorConfigContext } from '../../../../lexical/config/client/EditorConfigProvider.js'\nimport {\n RegisterFormSubmit,\n useDrawerSubmit,\n} from '../../../../utilities/fieldsDrawer/useDrawerSubmit.js'\nimport { useLexicalDrawer } from '../../../../utilities/fieldsDrawer/useLexicalDrawer.js'\nimport {\n getCachedFormStateIfDataMatches,\n reduceFormStateToBlockData,\n} from '../getCachedFormStateIfDataMatches.js'\nimport { $isBlockNode } from '../nodes/BlocksNode.js'\nimport {\n type BlockCollapsibleWithErrorProps,\n BlockContent,\n useBlockComponentContext,\n} from './BlockContent.js'\nimport { BlockReordering } from './BlockReordering/index.js'\n\nexport type BlockComponentProps<TFormData extends Record<string, unknown> = BlockFields> = {\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 /**\n * Custom block component from view map\n * Will be rendered with useBlockComponentContext hook.\n */\n readonly CustomBlock?: React.FC<ViewMapBlockComponentProps>\n /**\n * Custom block label from view map\n * Will be rendered with useBlockComponentContext hook.\n */\n readonly CustomLabel?: React.FC<ViewMapBlockComponentProps>\n readonly formData: TFormData\n readonly nodeKey: string\n}\n\nexport const BlockComponent: React.FC<BlockComponentProps> = (props) => {\n const {\n cacheBuster,\n className: baseClass,\n CustomBlock: CustomBlockFromProps,\n CustomLabel: CustomLabelFromProps,\n formData,\n nodeKey,\n } = props\n\n const submitted = useFormSubmitted()\n const { id, collectionSlug, globalSlug } = useDocumentInfo()\n const {\n fieldProps: {\n featureClientSchemaMap,\n field: parentLexicalRichTextField,\n initialLexicalFormState,\n schemaPath,\n },\n uuid: uuidFromContext,\n } = useEditorConfigContext()\n\n const { fields: parentDocumentFields } = useDocumentForm()\n const onChangeAbortControllerRef = useRef(new AbortController())\n const editDepth = useEditDepth()\n const [errorCount, setErrorCount] = React.useState(0)\n\n const { config } = useConfig()\n\n const drawerSlug = formatDrawerSlug({\n slug: `lexical-blocks-create-${uuidFromContext}-${formData.id}`,\n depth: editDepth,\n })\n const { toggleDrawer } = useLexicalDrawer(drawerSlug)\n\n // Used for saving collapsed to preferences (and gettin' it from there again)\n // Remember, these preferences are scoped to the whole document, not just this form. This\n // is important to consider for the data path used in setDocFieldPreferences\n const { getDocPreferences, setDocFieldPreferences } = useDocumentInfo()\n const [editor] = useLexicalComposerContext()\n const isEditable = useLexicalEditable()\n\n const blockType = formData.blockType\n const formDataRef = useRef(formData)\n formDataRef.current = formData\n\n const componentMapRenderedBlockPath = `${schemaPath}.lexical_internal_feature.blocks.lexical_blocks.${blockType}`\n\n const clientSchemaMap = featureClientSchemaMap['blocks']\n\n const blocksField: BlocksFieldClient | undefined = clientSchemaMap?.[\n componentMapRenderedBlockPath\n ]?.[0] as BlocksFieldClient | undefined\n\n const blockOrSlug = blocksField?.blocks?.[0]\n const clientBlock: ClientBlock | undefined =\n typeof blockOrSlug === 'string' ? config.blocksMap[blockOrSlug] : blockOrSlug\n\n const { getFormState } = useServerFunctions()\n const schemaFieldsPath = `${schemaPath}.lexical_internal_feature.blocks.lexical_blocks.${blockType}.fields`\n\n const [initialState, setInitialState] = React.useState<false | FormState | undefined>(() => {\n // Initial form state that was calculated server-side. May have stale values\n const cachedState = initialLexicalFormState?.[formData.id]\n const cachedFormState = cachedState?.formState\n if (!cachedFormState) {\n return false\n }\n\n const matchingCachedState = getCachedFormStateIfDataMatches({\n cachedFormState,\n cachedSchemaPath: cachedState.schemaPath,\n currentSchemaPath: schemaFieldsPath,\n formData,\n })\n if (!matchingCachedState) {\n return false\n }\n\n // Manually add blockName, as it's not part of cachedFormState\n return {\n ...matchingCachedState,\n blockName: {\n initialValue: formData.blockName,\n passesCondition: true,\n valid: true,\n value: formData.blockName,\n },\n }\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 [formUuid] = React.useState(() => uuid())\n\n // Server-rendered custom components (from admin.components, NOT viewMap).\n // When viewMap components exist (CustomBlockFromProps/CustomLabelFromProps),\n // we render them directly with formData instead, so these states are unused.\n const [CustomLabel, setCustomLabel] = React.useState<React.ReactNode | undefined>(() => {\n if (CustomLabelFromProps) {\n return undefined\n }\n // @ts-expect-error - vestiges of when tsconfig was not strict. Feel free to improve\n return initialState?.['_components']?.customComponents?.BlockLabel ?? undefined\n })\n\n const [CustomBlock, setCustomBlock] = React.useState<React.ReactNode | undefined>(() => {\n if (CustomBlockFromProps) {\n return undefined\n }\n // @ts-expect-error - vestiges of when tsconfig was not strict. Feel free to improve\n return initialState?.['_components']?.customComponents?.Block ?? undefined\n })\n\n // When viewMap components exist, render directly with formData (always current from\n // the lexical node). When they don't, fall back to server-rendered state.\n const resolvedCustomBlock = useMemo(() => {\n if (CustomBlockFromProps) {\n return (\n <CustomBlockFromProps\n className={baseClass}\n formData={formData}\n isEditor={true}\n isJSXConverter={false}\n nodeKey={nodeKey}\n // eslint-disable-next-line react-hooks/hooks -- intentionally passed as a prop for custom block components to call\n useBlockComponentContext={useBlockComponentContext}\n />\n )\n }\n return CustomBlock\n }, [CustomBlockFromProps, baseClass, formData, nodeKey, CustomBlock])\n\n const resolvedCustomLabel = useMemo(() => {\n if (CustomLabelFromProps) {\n return (\n <CustomLabelFromProps\n className={baseClass}\n formData={formData}\n isEditor={true}\n isJSXConverter={false}\n nodeKey={nodeKey}\n // eslint-disable-next-line react-hooks/hooks -- intentionally passed as a prop for custom block components to call\n useBlockComponentContext={useBlockComponentContext}\n />\n )\n }\n return CustomLabel\n }, [CustomLabelFromProps, baseClass, formData, nodeKey, CustomLabel])\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: parentDocumentFields,\n globalSlug,\n initialBlockData: formData,\n operation: 'update',\n readOnly: !isEditable,\n renderAllFields: true,\n schemaPath: schemaFieldsPath,\n signal: abortController.signal,\n })\n\n if (state) {\n state.blockName = {\n initialValue: formData.blockName,\n passesCondition: true,\n valid: true,\n value: formData.blockName,\n }\n\n const newFormStateData = reduceFormStateToBlockData(\n deepCopyObjectSimpleWithoutReactComponents(state, { excludeFiles: true }),\n ) as BlockFields\n\n // Things like default values may come back from the server => update the node with the new data\n editor.update(\n () => {\n const node = $getNodeByKey(nodeKey)\n if (node && $isBlockNode(node)) {\n const newData = newFormStateData\n newData.blockType = blockType\n\n node.setFields(newData, true)\n }\n },\n // Without this, the outer editor's reconciler resets DOM selection\n // back into its own root, kicking focus out of any nested richText.\n { tag: SKIP_DOM_SELECTION_TAG },\n )\n\n setInitialState(state)\n if (!CustomLabelFromProps) {\n setCustomLabel(state._components?.customComponents?.BlockLabel ?? undefined)\n }\n if (!CustomBlockFromProps) {\n setCustomBlock(state._components?.customComponents?.Block ?? undefined)\n }\n }\n }\n\n if (clientBlock && formData && !initialState) {\n void awaitInitialState()\n }\n\n return () => {\n abortAndIgnore(abortController)\n }\n }, [\n getFormState,\n schemaFieldsPath,\n isEditable,\n id,\n CustomLabelFromProps,\n CustomBlockFromProps,\n formData,\n editor,\n nodeKey,\n initialState,\n collectionSlug,\n globalSlug,\n getDocPreferences,\n parentDocumentFields,\n blockType,\n clientBlock,\n ])\n\n const [isCollapsed, setIsCollapsed] = React.useState<boolean>(\n initialLexicalFormState?.[formData.id]?.collapsed ?? false,\n )\n\n const { i18n, t } = useTranslation<object, string>()\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 const blockData = reduceFormStateToBlockData(prevFormState, formDataRef.current)\n\n const { state: newFormState } = await getFormState({\n id,\n collectionSlug,\n data: blockData,\n docPermissions: {\n fields: true,\n },\n docPreferences: await getDocPreferences(),\n documentFormState: parentDocumentFields,\n formState: prevFormState,\n globalSlug,\n initialBlockData: blockData,\n operation: 'update',\n readOnly: !isEditable,\n renderAllFields: submit ? true : false,\n schemaPath: schemaFieldsPath,\n signal: controller.signal,\n })\n\n if (!newFormState) {\n return prevFormState\n }\n\n if (prevFormState.blockName) {\n newFormState.blockName = prevFormState.blockName\n }\n\n const newFormStateData = reduceFormStateToBlockData(\n deepCopyObjectSimpleWithoutReactComponents(newFormState, { excludeFiles: true }),\n blockData,\n ) as BlockFields\n\n setTimeout(() => {\n editor.update(\n () => {\n const node = $getNodeByKey(nodeKey)\n if (node && $isBlockNode(node)) {\n const newData = newFormStateData\n newData.blockType = blockType\n node.setFields(newData, true)\n }\n },\n // Without this, the outer editor's reconciler resets DOM selection\n // back into its own root, kicking focus out of any nested richText.\n { tag: SKIP_DOM_SELECTION_TAG },\n )\n }, 0)\n\n if (submit) {\n if (!CustomLabelFromProps) {\n setCustomLabel(newFormState._components?.customComponents?.BlockLabel ?? undefined)\n }\n if (!CustomBlockFromProps) {\n setCustomBlock(newFormState._components?.customComponents?.Block ?? undefined)\n }\n\n let rowErrorCount = 0\n for (const formField of Object.values(newFormState)) {\n if (formField?.valid === false) {\n rowErrorCount++\n }\n }\n setErrorCount(rowErrorCount)\n }\n\n return newFormState\n },\n\n [\n getFormState,\n id,\n collectionSlug,\n getDocPreferences,\n globalSlug,\n schemaFieldsPath,\n blockType,\n parentDocumentFields,\n isEditable,\n editor,\n nodeKey,\n CustomBlockFromProps,\n CustomLabelFromProps,\n ],\n )\n\n useEffect(() => {\n return () => {\n abortAndIgnore(onChangeAbortControllerRef.current)\n }\n }, [])\n\n const removeBlock = useCallback(() => {\n editor.update(() => {\n $getNodeByKey(nodeKey)?.remove()\n })\n }, [editor, nodeKey])\n\n const [rowIndex, setRowIndex] = React.useState<number>(0)\n\n useEffect(() => {\n const updateIndex = () => {\n editor.getEditorState().read(() => {\n const root = $getRoot()\n const children = root.getChildren()\n let blockCount = 0\n for (const child of children) {\n if ($isBlockNode(child)) {\n if (child.getKey() === nodeKey) {\n setRowIndex(blockCount)\n return\n }\n blockCount++\n }\n }\n })\n }\n updateIndex()\n return editor.registerUpdateListener(() => {\n updateIndex()\n })\n }, [editor, nodeKey])\n\n const blockDisplayName = clientBlock?.labels?.singular\n ? getTranslation(clientBlock.labels.singular, i18n)\n : clientBlock?.slug\n\n const onCollapsedChange = useCallback(\n (changedCollapsed: boolean) => {\n void getDocPreferences().then((currentDocPreferences) => {\n const currentFieldPreferences =\n currentDocPreferences?.fields?.[parentLexicalRichTextField.name]\n\n const collapsedArray = currentFieldPreferences?.collapsed\n\n const newCollapsed: CollapsedPreferences =\n collapsedArray && collapsedArray?.length ? collapsedArray : []\n\n if (changedCollapsed) {\n if (!newCollapsed.includes(formData.id)) {\n newCollapsed.push(formData.id)\n }\n } else {\n if (newCollapsed.includes(formData.id)) {\n newCollapsed.splice(newCollapsed.indexOf(formData.id), 1)\n }\n }\n\n setDocFieldPreferences(parentLexicalRichTextField.name, {\n collapsed: newCollapsed,\n hello: 'hi',\n })\n })\n },\n [getDocPreferences, parentLexicalRichTextField.name, setDocFieldPreferences, formData.id],\n )\n\n const EditButton = useMemo(\n () => () => (\n <Button\n buttonStyle=\"ghost\"\n className={`${baseClass}__editButton`}\n disabled={!isEditable}\n el=\"button\"\n icon=\"edit\"\n onClick={(e) => {\n e.preventDefault()\n e.stopPropagation()\n toggleDrawer()\n return false\n }}\n onMouseDown={(e) => {\n // Needed to preserve lexical selection for toggleDrawer lexical selection restore.\n // I believe this is needed due to this button (usually) being inside of a collapsible.\n e.preventDefault()\n }}\n round\n size=\"medium\"\n tooltip={t('lexical:blocks:inlineBlocks:edit', { label: blockDisplayName })}\n />\n ),\n [baseClass, isEditable, t, blockDisplayName, toggleDrawer],\n )\n\n const RemoveButton = useMemo(\n () => () => (\n <Button\n buttonStyle=\"ghost\"\n className={`${baseClass}__removeButton`}\n disabled={!isEditable}\n icon=\"x\"\n onClick={(e) => {\n e.preventDefault()\n removeBlock()\n }}\n round\n tooltip=\"Remove Block\"\n />\n ),\n [baseClass, isEditable, removeBlock],\n )\n\n const BlockCollapsible = useMemo(\n () =>\n function BlockCollapsible({\n Actions,\n children,\n className,\n collapsibleProps,\n disableBlockName,\n editButton,\n errorCount,\n fieldHasErrors,\n Label,\n Pill: CustomPill,\n removeButton,\n showDragHandle = true,\n showRowNumber = true,\n }: BlockCollapsibleWithErrorProps) {\n return (\n <BlockReordering editor={editor} nodeKey={nodeKey}>\n {({ isReordering, move, onBlur, onKeyDown, reorderInstructionsID, targetIndex }) => (\n <div\n className={`${baseClass}__container ${baseClass}-${blockType}`}\n onKeyDownCapture={(event) => {\n const target = event.target as HTMLElement\n\n if (\n event.altKey ||\n event.ctrlKey ||\n event.metaKey ||\n target.closest('.collapsible')?.parentElement !== event.currentTarget\n ) {\n return\n }\n // Handle controls before Lexical consumes keys using its retained text selection.\n if (\n target.matches('.collapsible__drag') &&\n (event.key !== 'Escape' || isReordering) &&\n [' ', 'ArrowDown', 'ArrowUp', 'Enter', 'Escape', 'Tab'].includes(event.key)\n ) {\n onKeyDown(event)\n event.stopPropagation()\n } else if (event.key === 'Tab' && target.matches('.collapsible__toggle')) {\n event.stopPropagation()\n }\n }}\n >\n <Collapsible\n actions={\n typeof Actions !== 'undefined' ? (\n Actions\n ) : isEditable ? (\n <Popup\n button={<MoreIcon />}\n buttonAriaLabel={t('general:moreOptions')}\n buttonClassName={`${baseClass}__actions-button`}\n caret={false}\n horizontalAlign=\"right\"\n popupType=\"menu\"\n render={({ close }) => (\n <PopupList.ButtonGroup buttonSize=\"medium\">\n <PopupList.Button\n onClick={() => {\n close()\n move({ direction: -1 })\n }}\n >\n {t('general:moveUp')}\n </PopupList.Button>\n <PopupList.Button\n onClick={() => {\n close()\n move({ direction: 1 })\n }}\n >\n {t('general:moveDown')}\n </PopupList.Button>\n {((resolvedCustomBlock && editButton !== false) ||\n (!resolvedCustomBlock && editButton)) && (\n <PopupList.Button\n onClick={() => {\n toggleDrawer()\n close()\n }}\n >\n {t('general:edit')}\n </PopupList.Button>\n )}\n {removeButton !== false && (\n <PopupList.Button\n onClick={() => {\n removeBlock()\n close()\n }}\n >\n <XIcon />\n {t('general:remove')}\n </PopupList.Button>\n )}\n </PopupList.ButtonGroup>\n )}\n size=\"large\"\n />\n ) : null\n }\n className={[\n `${baseClass}__row`,\n fieldHasErrors\n ? `${baseClass}__row--has-errors`\n : `${baseClass}__row--no-errors`,\n className,\n ]\n .filter(Boolean)\n .join(' ')}\n collapsibleStyle={fieldHasErrors ? 'error' : 'default'}\n dragHandleProps={\n showDragHandle && isEditable\n ? {\n id: nodeKey,\n attributes: {\n 'aria-describedby': reorderInstructionsID,\n 'aria-pressed': isReordering,\n role: 'button',\n tabIndex: 0,\n },\n draggable: true,\n listeners: { onBlur },\n }\n : undefined\n }\n header={\n <div className={`${baseClass}__block-header`}>\n {typeof Label !== 'undefined' ? (\n Label\n ) : typeof resolvedCustomLabel !== 'undefined' ? (\n resolvedCustomLabel\n ) : (\n <div className={`${baseClass}__block-label`}>\n {showRowNumber && (\n <span className={`${baseClass}__block-number`}>\n {String(rowIndex + 1).padStart(2, '0')}\n </span>\n )}\n {typeof CustomPill !== 'undefined' ? (\n CustomPill\n ) : (\n <Pill\n className={`${baseClass}__block-pill ${baseClass}__block-pill-${blockType}`}\n pillStyle=\"white\"\n size=\"small\"\n >\n {blockDisplayName ?? blockType}\n </Pill>\n )}\n {!disableBlockName && !clientBlock?.admin?.disableBlockName && (\n <SectionTitle path=\"blockName\" readOnly={!isEditable} />\n )}\n\n {fieldHasErrors && <BlockErrorPill count={errorCount ?? 0} />}\n </div>\n )}\n </div>\n }\n isCollapsed={isCollapsed}\n key={0}\n onToggle={(incomingCollapsedState) => {\n onCollapsedChange(incomingCollapsedState)\n setIsCollapsed(incomingCollapsedState)\n }}\n {...(collapsibleProps || {})}\n AfterCollapsible={\n <>\n {collapsibleProps?.AfterCollapsible}\n <span className=\"sr-only\" role=\"status\">\n {isReordering ? `${t('general:order')}: ${(targetIndex ?? 0) + 1}` : ''}\n </span>\n </>\n }\n >\n <span className=\"sr-only\" id={reorderInstructionsID}>\n Space / Enter · {t('general:moveUp')} ↑ · {t('general:moveDown')} ↓ ·{' '}\n {t('general:cancel')} Escape\n </span>\n {children}\n </Collapsible>\n </div>\n )}\n </BlockReordering>\n )\n },\n [\n editor,\n resolvedCustomBlock,\n resolvedCustomLabel,\n blockDisplayName,\n baseClass,\n clientBlock?.admin?.disableBlockName,\n blockType,\n isCollapsed,\n onCollapsedChange,\n isEditable,\n nodeKey,\n removeBlock,\n rowIndex,\n t,\n toggleDrawer,\n ],\n )\n\n const blockID = formData?.id\n\n const { headerActions, submitRef } = useDrawerSubmit()\n\n const BlockDrawer = useMemo(\n () => () => (\n <EditDepthProvider>\n <Drawer\n className={''}\n headerActions={headerActions}\n slug={drawerSlug}\n title={t(`lexical:blocks:inlineBlocks:${blockID ? 'edit' : 'create'}`, {\n label: blockDisplayName ?? t('lexical:blocks:inlineBlocks:label'),\n })}\n >\n {initialState ? (\n <div className=\"fields-drawer\">\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 <RegisterFormSubmit submitRef={submitRef} />\n </div>\n ) : null}\n </Drawer>\n </EditDepthProvider>\n ),\n [\n initialState,\n drawerSlug,\n blockID,\n blockDisplayName,\n t,\n isEditable,\n clientBlock?.fields,\n schemaFieldsPath,\n headerActions,\n submitRef,\n // DO NOT ADD FORMDATA HERE! Adding formData will kick you out of sub block editors while writing.\n ],\n )\n\n // Memoized Form JSX\n const Block = useMemo(() => {\n if (!initialState) {\n return null\n }\n return (\n <div data-block-drawer-slug={drawerSlug} style={{ display: 'contents' }}>\n <Form\n beforeSubmit={[\n async ({ formState }) => {\n // This is only called when form is submitted from drawer - usually only the case if the block has a custom Block component\n return await onChange({ formState, submit: true })\n },\n ]}\n el=\"div\"\n fields={clientBlock?.fields ?? []}\n initialState={initialState}\n onChange={[onChange]}\n onSubmit={(formState) => {\n // This is only called when form is submitted from drawer - usually only the case if the block has a custom Block component\n const newData = reduceFormStateToBlockData(\n formState,\n formDataRef.current,\n ) as BlockFields\n newData.blockType = blockType\n editor.update(\n () => {\n const node = $getNodeByKey(nodeKey)\n if (node && $isBlockNode(node)) {\n node.setFields(newData, true)\n }\n },\n // Without this, the outer editor's reconciler resets DOM selection\n // back into its own root, kicking focus out of any nested richText.\n { tag: SKIP_DOM_SELECTION_TAG },\n )\n toggleDrawer()\n }}\n submitted={submitted}\n uuid={formUuid}\n >\n <BlockContent\n baseClass={baseClass}\n BlockDrawer={BlockDrawer}\n Collapsible={BlockCollapsible}\n CustomBlock={resolvedCustomBlock}\n CustomLabel={resolvedCustomLabel}\n EditButton={EditButton}\n errorCount={errorCount}\n formSchema={clientBlock?.fields ?? []}\n initialState={initialState}\n nodeKey={nodeKey}\n RemoveButton={RemoveButton}\n />\n </Form>\n </div>\n )\n }, [\n BlockCollapsible,\n BlockDrawer,\n resolvedCustomBlock,\n resolvedCustomLabel,\n blockType,\n drawerSlug,\n RemoveButton,\n EditButton,\n baseClass,\n editor,\n errorCount,\n toggleDrawer,\n clientBlock?.fields,\n formUuid,\n initialState,\n nodeKey,\n onChange,\n submitted,\n ])\n\n if (!clientBlock) {\n return (\n <BlockCollapsible disableBlockName={true} fieldHasErrors={true}>\n <div className={`${baseClass}-not-found`}>\n Error: Block '{blockType}' not found in the config but exists in the lexical data\n </div>\n </BlockCollapsible>\n )\n }\n\n return Block\n}\n\n/**\n * Reads `i18n` itself so `BlockCollapsible` does not depend on it. `BlockCollapsible` is created in\n * a `useMemo`, so each new `i18n` object (e.g. once the date-fns locale is set after mount) would\n * remount the whole block, closing its open menus and dropping focus.\n */\nconst BlockErrorPill: React.FC<{ readonly count: number }> = ({ count }) => {\n const { i18n } = useTranslation()\n\n return <ErrorPill count={count} i18n={i18n} withMessage />\n}\n"],"mappings":"AAAA;;AAAA,SAAAA,CAAA,IAAAC,EAAA;;AAEA,SAASC,yBAAyB,QAAQ;AAC1C,SAASC,kBAAkB,QAAQ;AACnC,SAASC,cAAc,QAAQ;AAC/B,SACEC,MAAM,EACNC,WAAW,EACX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A,EACAd,UAAA,EACA7I,SAAA,EACAiC,MAAA,EACAV,UAAA,EACAO,YAAA,EACAa,WAAA,EAAazB,MAAA,EACb4C,QAAA,EACAf,YAAA,EACAzC,OAAA,EACA6F,QAAA,EACA5F,SAAA,CACD;EAED,IAAI,CAACoC,WAAA,EAAa;IAChB,oBACE2B,IAAA,CAACsF,gBAAA;MAAiBG,gBAAA,EAAkB;MAAME,cAAA,EAAgB;gBACxD,aAAAuB,KAAA,CAAC;QAAIzL,SAAA,EAAW,GAAGC,SAAA,YAAqB;mBAAE,kBACzBmC,SAAA,EAAU;;;EAIjC;EAEA,OAAOiC,KAAA;AACT;AAEA;;;;;AAKA,MAAMiJ,cAAA,GAAuDqB,EAAA;EAAA,MAAAC,CAAA,GAAA9R,EAAA;EAAC;IAAAyQ;EAAA,IAAAoB,EAAS;EACrE;IAAAzI;EAAA,IAAiB7H,cAAA;EAAA,IAAAwQ,EAAA;EAAA,IAAAD,CAAA,QAAArB,KAAA,IAAAqB,CAAA,QAAA1I,IAAA;IAEV2I,EAAA,GAAAtK,IAAA,CAACjH,SAAA;MAAAiQ,KAAA;MAAArH,IAAA;MAAA4I,WAAA,EAA+C;;;;;;;;SAAhDD,E;CACT","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"InlineBlockContainer.js","names":["c","_c","React","useInlineBlockComponentContext","InlineBlockContainer","t0","$","children","t1","_jsx"],"sources":["../../../../../../src/features/blocks/client/componentInline/components/InlineBlockContainer.tsx"],"sourcesContent":["'use client'\nimport React from 'react'\n\nimport { useInlineBlockComponentContext } from '../index.js'\n\nexport const InlineBlockContainer = ({ children }: { children: React.ReactNode }) => {\n const { InlineBlockContainer } = useInlineBlockComponentContext()\n\n return InlineBlockContainer ? <InlineBlockContainer>{children}</InlineBlockContainer> : null\n}\n"],"mappings":"AAAA;;AAAA,SAAAA,CAAA,IAAAC,EAAA;;AACA,OAAOC,KAAA,MAAW;AAElB,SAASC,8BAA8B,QAAQ;AAE/C,OAAO,MAAMC,oBAAA,GAAuBC,EAAA;EAAA,MAAAC,CAAA,GAAAL,EAAA;EAAC;IAAAM;EAAA,IAAAF,EAA2C;EAC9E;IAAAD;EAAA,IAAiCD,8BAAA;EAAA,IAAAK,EAAA;EAAA,IAAAF,CAAA,QAAAF,oBAAA,IAAAE,CAAA,QAAAC,QAAA;IAE1BC,EAAA,GAAAJ,oBAAA,GAAuBK,IAAA,CAACL,oBAAA;MAAAG;IAAA,C,QAAyD;IAAAD,CAAA,MAAAF,oBAAA;IAAAE,CAAA,MAAAC,QAAA;IAAAD,CAAA,MAAAE,EAAA;EAAA;IAAAA,EAAA,GAAAF,CAAA;EAAA;EAAA,OAAjFE,EAAiF;AAAA,CAC1F","ignoreList":[]}
1
+ {"version":3,"file":"InlineBlockContainer.js","names":["c","_c","React","useInlineBlockComponentContext","InlineBlockContainer","t0","$","children","t1","_jsx"],"sources":["../../../../../../src/features/blocks/client/componentInline/components/InlineBlockContainer.tsx"],"sourcesContent":["'use client'\nimport React from 'react'\n\nimport { useInlineBlockComponentContext } from '../index.js'\n\nexport const InlineBlockContainer = ({ children }: { children: React.ReactNode }) => {\n const { InlineBlockContainer } = useInlineBlockComponentContext()\n\n return InlineBlockContainer ? <InlineBlockContainer>{children}</InlineBlockContainer> : null\n}\n"],"mappings":"AAAA;;AAAA,SAAAA,CAAA,IAAAC,EAAA;;AACA,OAAOC,KAAA,MAAW;AAElB,SAASC,8BAA8B,QAAQ;AAE/C,OAAO,MAAMC,oBAAA,GAAuBC,EAAA;EAAA,MAAAC,CAAA,GAAAL,EAAA;EAAC;IAAAM;EAAA,IAAAF,EAA2C;EAC9E;IAAAD;EAAA,IAAiCD,8BAAA;EAAA,IAAAK,EAAA;EAAA,IAAAF,CAAA,QAAAF,oBAAA,IAAAE,CAAA,QAAAC,QAAA;IAE1BC,EAAA,GAAAJ,oBAAA,GAAuBK,IAAA,CAACL,oBAAA;MAAAG;KAAyD,IAAjF,IAAiF;IAAAD,CAAA,MAAAF,oBAAA;IAAAE,CAAA,MAAAC,QAAA;IAAAD,CAAA,MAAAE,EAAA;EAAA;IAAAA,EAAA,GAAAF,CAAA;EAAA;EAAA,OAAjFE,EAAiF;AAAA,CAC1F","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"InlineBlockEditButton.js","names":["c","_c","React","useInlineBlockComponentContext","InlineBlockEditButton","$","EditButton","t0","_jsx"],"sources":["../../../../../../src/features/blocks/client/componentInline/components/InlineBlockEditButton.tsx"],"sourcesContent":["'use client'\nimport React from 'react'\n\nimport { useInlineBlockComponentContext } from '../index.js'\n\nexport const InlineBlockEditButton = () => {\n const { EditButton } = useInlineBlockComponentContext()\n\n return EditButton ? <EditButton /> : null\n}\n"],"mappings":"AAAA;;AAAA,SAAAA,CAAA,IAAAC,EAAA;;AACA,OAAOC,KAAA,MAAW;AAElB,SAASC,8BAA8B,QAAQ;AAE/C,OAAO,MAAMC,qBAAA,GAAwBA,CAAA;EAAA,MAAAC,CAAA,GAAAJ,EAAA;EACnC;IAAAK;EAAA,IAAuBH,8BAAA;EAAA,IAAAI,EAAA;EAAA,IAAAF,CAAA,QAAAC,UAAA;IAEhBC,EAAA,GAAAD,UAAA,GAAaE,IAAA,CAACF,UAAA,YAAgB;IAAAD,CAAA,MAAAC,UAAA;IAAAD,CAAA,MAAAE,EAAA;EAAA;IAAAA,EAAA,GAAAF,CAAA;EAAA;EAAA,OAA9BE,EAA8B;AAAA,CACvC","ignoreList":[]}
1
+ {"version":3,"file":"InlineBlockEditButton.js","names":["c","_c","React","useInlineBlockComponentContext","InlineBlockEditButton","$","EditButton","t0","_jsx"],"sources":["../../../../../../src/features/blocks/client/componentInline/components/InlineBlockEditButton.tsx"],"sourcesContent":["'use client'\nimport React from 'react'\n\nimport { useInlineBlockComponentContext } from '../index.js'\n\nexport const InlineBlockEditButton = () => {\n const { EditButton } = useInlineBlockComponentContext()\n\n return EditButton ? <EditButton /> : null\n}\n"],"mappings":"AAAA;;AAAA,SAAAA,CAAA,IAAAC,EAAA;;AACA,OAAOC,KAAA,MAAW;AAElB,SAASC,8BAA8B,QAAQ;AAE/C,OAAO,MAAMC,qBAAA,GAAwBA,CAAA;EAAA,MAAAC,CAAA,GAAAJ,EAAA;EACnC;IAAAK;EAAA,IAAuBH,8BAAA;EAAA,IAAAI,EAAA;EAAA,IAAAF,CAAA,QAAAC,UAAA;IAEhBC,EAAA,GAAAD,UAAA,GAAaE,IAAA,CAACF,UAAA,IAAgB,IAA9B,IAA8B;IAAAD,CAAA,MAAAC,UAAA;IAAAD,CAAA,MAAAE,EAAA;EAAA;IAAAA,EAAA,GAAAF,CAAA;EAAA;EAAA,OAA9BE,EAA8B;AAAA,CACvC","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"InlineBlockLabel.js","names":["c","_c","React","useInlineBlockComponentContext","InlineBlockLabel","$","Label","t0","_jsx"],"sources":["../../../../../../src/features/blocks/client/componentInline/components/InlineBlockLabel.tsx"],"sourcesContent":["'use client'\nimport React from 'react'\n\nimport { useInlineBlockComponentContext } from '../index.js'\n\nexport const InlineBlockLabel = () => {\n const { Label } = useInlineBlockComponentContext()\n\n return Label ? <Label /> : null\n}\n"],"mappings":"AAAA;;AAAA,SAAAA,CAAA,IAAAC,EAAA;;AACA,OAAOC,KAAA,MAAW;AAElB,SAASC,8BAA8B,QAAQ;AAE/C,OAAO,MAAMC,gBAAA,GAAmBA,CAAA;EAAA,MAAAC,CAAA,GAAAJ,EAAA;EAC9B;IAAAK;EAAA,IAAkBH,8BAAA;EAAA,IAAAI,EAAA;EAAA,IAAAF,CAAA,QAAAC,KAAA;IAEXC,EAAA,GAAAD,KAAA,GAAQE,IAAA,CAACF,KAAA,YAAW;IAAAD,CAAA,MAAAC,KAAA;IAAAD,CAAA,MAAAE,EAAA;EAAA;IAAAA,EAAA,GAAAF,CAAA;EAAA;EAAA,OAApBE,EAAoB;AAAA,CAC7B","ignoreList":[]}
1
+ {"version":3,"file":"InlineBlockLabel.js","names":["c","_c","React","useInlineBlockComponentContext","InlineBlockLabel","$","Label","t0","_jsx"],"sources":["../../../../../../src/features/blocks/client/componentInline/components/InlineBlockLabel.tsx"],"sourcesContent":["'use client'\nimport React from 'react'\n\nimport { useInlineBlockComponentContext } from '../index.js'\n\nexport const InlineBlockLabel = () => {\n const { Label } = useInlineBlockComponentContext()\n\n return Label ? <Label /> : null\n}\n"],"mappings":"AAAA;;AAAA,SAAAA,CAAA,IAAAC,EAAA;;AACA,OAAOC,KAAA,MAAW;AAElB,SAASC,8BAA8B,QAAQ;AAE/C,OAAO,MAAMC,gBAAA,GAAmBA,CAAA;EAAA,MAAAC,CAAA,GAAAJ,EAAA;EAC9B;IAAAK;EAAA,IAAkBH,8BAAA;EAAA,IAAAI,EAAA;EAAA,IAAAF,CAAA,QAAAC,KAAA;IAEXC,EAAA,GAAAD,KAAA,GAAQE,IAAA,CAACF,KAAA,IAAW,IAApB,IAAoB;IAAAD,CAAA,MAAAC,KAAA;IAAAD,CAAA,MAAAE,EAAA;EAAA;IAAAA,EAAA,GAAAF,CAAA;EAAA;EAAA,OAApBE,EAAoB;AAAA,CAC7B","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"InlineBlockRemoveButton.js","names":["c","_c","React","useInlineBlockComponentContext","InlineBlockRemoveButton","$","RemoveButton","t0","_jsx"],"sources":["../../../../../../src/features/blocks/client/componentInline/components/InlineBlockRemoveButton.tsx"],"sourcesContent":["'use client'\nimport React from 'react'\n\nimport { useInlineBlockComponentContext } from '../index.js'\n\nexport const InlineBlockRemoveButton = () => {\n const { RemoveButton } = useInlineBlockComponentContext()\n\n return RemoveButton ? <RemoveButton /> : null\n}\n"],"mappings":"AAAA;;AAAA,SAAAA,CAAA,IAAAC,EAAA;;AACA,OAAOC,KAAA,MAAW;AAElB,SAASC,8BAA8B,QAAQ;AAE/C,OAAO,MAAMC,uBAAA,GAA0BA,CAAA;EAAA,MAAAC,CAAA,GAAAJ,EAAA;EACrC;IAAAK;EAAA,IAAyBH,8BAAA;EAAA,IAAAI,EAAA;EAAA,IAAAF,CAAA,QAAAC,YAAA;IAElBC,EAAA,GAAAD,YAAA,GAAeE,IAAA,CAACF,YAAA,YAAkB;IAAAD,CAAA,MAAAC,YAAA;IAAAD,CAAA,MAAAE,EAAA;EAAA;IAAAA,EAAA,GAAAF,CAAA;EAAA;EAAA,OAAlCE,EAAkC;AAAA,CAC3C","ignoreList":[]}
1
+ {"version":3,"file":"InlineBlockRemoveButton.js","names":["c","_c","React","useInlineBlockComponentContext","InlineBlockRemoveButton","$","RemoveButton","t0","_jsx"],"sources":["../../../../../../src/features/blocks/client/componentInline/components/InlineBlockRemoveButton.tsx"],"sourcesContent":["'use client'\nimport React from 'react'\n\nimport { useInlineBlockComponentContext } from '../index.js'\n\nexport const InlineBlockRemoveButton = () => {\n const { RemoveButton } = useInlineBlockComponentContext()\n\n return RemoveButton ? <RemoveButton /> : null\n}\n"],"mappings":"AAAA;;AAAA,SAAAA,CAAA,IAAAC,EAAA;;AACA,OAAOC,KAAA,MAAW;AAElB,SAASC,8BAA8B,QAAQ;AAE/C,OAAO,MAAMC,uBAAA,GAA0BA,CAAA;EAAA,MAAAC,CAAA,GAAAJ,EAAA;EACrC;IAAAK;EAAA,IAAyBH,8BAAA;EAAA,IAAAI,EAAA;EAAA,IAAAF,CAAA,QAAAC,YAAA;IAElBC,EAAA,GAAAD,YAAA,GAAeE,IAAA,CAACF,YAAA,IAAkB,IAAlC,IAAkC;IAAAD,CAAA,MAAAC,YAAA;IAAAD,CAAA,MAAAE,EAAA;EAAA;IAAAA,EAAA,GAAAF,CAAA;EAAA;EAAA,OAAlCE,EAAkC;AAAA,CAC3C","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/features/blocks/client/componentInline/index.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAkC,SAAS,EAAE,MAAM,SAAS,CAAA;AAuBxE,OAAO,aAAa,CAAA;AACpB,OAAO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