@payloadcms/richtext-lexical 3.68.0-internal-debug.35482da → 3.68.0-internal-debug.654e4ad

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 (98) hide show
  1. package/dist/exports/client/index.d.ts +1 -0
  2. package/dist/exports/client/index.d.ts.map +1 -1
  3. package/dist/exports/client/index.js +1 -0
  4. package/dist/exports/client/index.js.map +1 -1
  5. package/dist/exports/client/internal-client.d.ts +3 -0
  6. package/dist/exports/client/internal-client.d.ts.map +1 -0
  7. package/dist/exports/client/internal-client.js +4 -0
  8. package/dist/exports/client/internal-client.js.map +1 -0
  9. package/dist/exports/react/index.d.ts +1 -1
  10. package/dist/exports/react/index.d.ts.map +1 -1
  11. package/dist/exports/react/index.js.map +1 -1
  12. package/dist/features/blocks/client/component/index.js +2 -2
  13. package/dist/features/blocks/client/component/index.js.map +1 -1
  14. package/dist/features/blocks/client/componentInline/index.js +2 -2
  15. package/dist/features/blocks/client/componentInline/index.js.map +1 -1
  16. package/dist/features/blocks/server/nodes/BlocksNode.js.map +1 -1
  17. package/dist/features/blocks/server/nodes/InlineBlocksNode.js.map +1 -1
  18. package/dist/features/converters/lexicalToJSX/Component/index.d.ts +2 -14
  19. package/dist/features/converters/lexicalToJSX/Component/index.d.ts.map +1 -1
  20. package/dist/features/converters/lexicalToJSX/Component/index.js +4 -9
  21. package/dist/features/converters/lexicalToJSX/Component/index.js.map +1 -1
  22. package/dist/features/converters/lexicalToJSX/converter/index.d.ts +16 -1
  23. package/dist/features/converters/lexicalToJSX/converter/index.d.ts.map +1 -1
  24. package/dist/features/converters/lexicalToJSX/converter/index.js +87 -5
  25. package/dist/features/converters/lexicalToJSX/converter/index.js.map +1 -1
  26. package/dist/features/converters/lexicalToJSX/converter/types.d.ts +14 -10
  27. package/dist/features/converters/lexicalToJSX/converter/types.d.ts.map +1 -1
  28. package/dist/features/converters/lexicalToJSX/converter/types.js.map +1 -1
  29. package/dist/features/debug/jsxConverter/client/plugin/index.js +1 -1
  30. package/dist/features/debug/jsxConverter/client/plugin/index.js.map +1 -1
  31. package/dist/features/link/nodes/LinkNode.js.map +1 -1
  32. package/dist/features/migrations/lexicalPluginToLexical/nodes/unknownConvertedNode/index.js.map +1 -1
  33. package/dist/features/migrations/slateToLexical/nodes/unknownConvertedNode/index.js.map +1 -1
  34. package/dist/features/relationship/server/nodes/RelationshipNode.js.map +1 -1
  35. package/dist/features/upload/server/nodes/UploadNode.js.map +1 -1
  36. package/dist/field/Field.d.ts.map +1 -1
  37. package/dist/field/Field.js +37 -21
  38. package/dist/field/Field.js.map +1 -1
  39. package/dist/field/RichTextViewProvider.d.ts +83 -0
  40. package/dist/field/RichTextViewProvider.d.ts.map +1 -0
  41. package/dist/field/RichTextViewProvider.js +102 -0
  42. package/dist/field/RichTextViewProvider.js.map +1 -0
  43. package/dist/field/ViewSelector.d.ts +4 -0
  44. package/dist/field/ViewSelector.d.ts.map +1 -0
  45. package/dist/field/ViewSelector.js +90 -0
  46. package/dist/field/ViewSelector.js.map +1 -0
  47. package/dist/field/ViewSelector.scss +34 -0
  48. package/dist/field/index.d.ts +1 -0
  49. package/dist/field/index.d.ts.map +1 -1
  50. package/dist/field/index.js +41 -16
  51. package/dist/field/index.js.map +1 -1
  52. package/dist/field/index.scss +12 -0
  53. package/dist/field/rscEntry.d.ts +1 -1
  54. package/dist/field/rscEntry.d.ts.map +1 -1
  55. package/dist/field/rscEntry.js +13 -1
  56. package/dist/field/rscEntry.js.map +1 -1
  57. package/dist/index.d.ts +1 -1
  58. package/dist/index.d.ts.map +1 -1
  59. package/dist/index.js +3 -1
  60. package/dist/index.js.map +1 -1
  61. package/dist/lexical/LexicalEditor.d.ts.map +1 -1
  62. package/dist/lexical/LexicalEditor.js +34 -28
  63. package/dist/lexical/LexicalEditor.js.map +1 -1
  64. package/dist/lexical/LexicalProvider.d.ts.map +1 -1
  65. package/dist/lexical/LexicalProvider.js +19 -11
  66. package/dist/lexical/LexicalProvider.js.map +1 -1
  67. package/dist/lexical/config/client/sanitize.d.ts +1 -1
  68. package/dist/lexical/config/client/sanitize.d.ts.map +1 -1
  69. package/dist/lexical/config/client/sanitize.js +3 -2
  70. package/dist/lexical/config/client/sanitize.js.map +1 -1
  71. package/dist/lexical/config/types.d.ts +4 -0
  72. package/dist/lexical/config/types.d.ts.map +1 -1
  73. package/dist/lexical/config/types.js +3 -1
  74. package/dist/lexical/config/types.js.map +1 -1
  75. package/dist/lexical/nodes/index.d.ts +12 -2
  76. package/dist/lexical/nodes/index.d.ts.map +1 -1
  77. package/dist/lexical/nodes/index.js +187 -2
  78. package/dist/lexical/nodes/index.js.map +1 -1
  79. package/dist/lexical/plugins/NodeViewOverridePlugin/index.d.ts +2 -0
  80. package/dist/lexical/plugins/NodeViewOverridePlugin/index.d.ts.map +1 -0
  81. package/dist/lexical/plugins/NodeViewOverridePlugin/index.js +31 -0
  82. package/dist/lexical/plugins/NodeViewOverridePlugin/index.js.map +1 -0
  83. package/dist/lexical/utils/point.js.map +1 -1
  84. package/dist/lexical/utils/rect.js.map +1 -1
  85. package/dist/types.d.ts +152 -2
  86. package/dist/types.d.ts.map +1 -1
  87. package/dist/types.js +55 -0
  88. package/dist/types.js.map +1 -1
  89. package/dist/utilities/fieldsDrawer/DrawerContent.js +2 -2
  90. package/dist/utilities/fieldsDrawer/DrawerContent.js.map +1 -1
  91. package/dist/utilities/generateImportMap.d.ts.map +1 -1
  92. package/dist/utilities/generateImportMap.js +1 -0
  93. package/dist/utilities/generateImportMap.js.map +1 -1
  94. package/dist/validate/hasText.d.ts +6 -1
  95. package/dist/validate/hasText.d.ts.map +1 -1
  96. package/dist/validate/hasText.js +10 -4
  97. package/dist/validate/hasText.js.map +1 -1
  98. package/package.json +13 -8
@@ -81,4 +81,5 @@ export { CodeComponent } from '../../features/blocks/premade/CodeBlock/Component
81
81
  export { CodeBlockBlockComponent } from '../../features/blocks/premade/CodeBlock/Component/Block.js';
82
82
  export { RenderLexical } from '../../field/RenderLexical/index.js';
83
83
  export { buildDefaultEditorState, buildEditorState } from '../../utilities/buildEditorState.js';
84
+ export { RichTextViewProvider, useRichTextView } from '../../field/RichTextViewProvider.js';
84
85
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/exports/client/index.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,4BAA4B,EAAE,MAAM,+CAA+C,CAAA;AAE5F,OAAO,EAAE,kBAAkB,EAAE,MAAM,sCAAsC,CAAA;AACzE,OAAO,EAAE,uBAAuB,EAAE,MAAM,2CAA2C,CAAA;AACnF,OAAO,EAAE,mBAAmB,EAAE,MAAM,uCAAuC,CAAA;AAC3E,OAAO,EACL,oBAAoB,EACpB,2BAA2B,GAC5B,MAAM,iDAAiD,CAAA;AAExD,OAAO,EAAE,yBAAyB,EAAE,MAAM,mDAAmD,CAAA;AAC7F,OAAO,EAAE,qBAAqB,EAAE,MAAM,+CAA+C,CAAA;AACrF,OAAO,EAAE,iBAAiB,EAAE,MAAM,8CAA8C,CAAA;AAChF,OAAO,EAAE,uBAAuB,EAAE,MAAM,oDAAoD,CAAA;AAC5F,OAAO,EAAE,mBAAmB,EAAE,MAAM,gDAAgD,CAAA;AACpF,OAAO,EAAE,0BAA0B,EAAE,MAAM,uDAAuD,CAAA;AAClG,OAAO,EAAE,sBAAsB,EAAE,MAAM,mDAAmD,CAAA;AAC1F,OAAO,EAAE,wBAAwB,EAAE,MAAM,qDAAqD,CAAA;AAC9F,OAAO,EAAE,sBAAsB,EAAE,MAAM,mDAAmD,CAAA;AAC1F,OAAO,EAAE,sBAAsB,EAAE,MAAM,4CAA4C,CAAA;AACnF,OAAO,EAAE,oBAAoB,EAAE,MAAM,wCAAwC,CAAA;AAC7E,OAAO,EAAE,2BAA2B,EAAE,MAAM,+CAA+C,CAAA;AAC3F,OAAO,EAAE,mBAAmB,EAAE,MAAM,uCAAuC,CAAA;AAC3E,OAAO,EAAE,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AEpG,OAAO,EAAE,aAAa,EAAE,MAAM,oCAAoC,CAAA;AAClE,OAAO,EAAE,uBAAuB,EAAE,gBAAgB,EAAE,MAAM,qCAAqC,CAAA;AAC/F,OAAO,EAAE,oBAAoB,EAAE,eAAe,EAAE,MAAM,qCAAqC,CAAA"}
@@ -82,5 +82,6 @@ export { CodeComponent } from '../../features/blocks/premade/CodeBlock/Component
82
82
  export { CodeBlockBlockComponent } from '../../features/blocks/premade/CodeBlock/Component/Block.js';
83
83
  export { RenderLexical } from '../../field/RenderLexical/index.js';
84
84
  export { buildDefaultEditorState, buildEditorState } from '../../utilities/buildEditorState.js';
85
+ export { RichTextViewProvider, useRichTextView } from '../../field/RichTextViewProvider.js';
85
86
 
86
87
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/exports/client/index.ts"],"sourcesContent":["/* eslint-disable perfectionist/sort-exports */\n'use client'\n\nexport { slashMenuBasicGroupWithItems } from '../../features/shared/slashMenu/basicGroup.js'\n\nexport { AlignFeatureClient } from '../../features/align/client/index.js'\nexport { BlockquoteFeatureClient } from '../../features/blockquote/client/index.js'\nexport { BlocksFeatureClient } from '../../features/blocks/client/index.js'\nexport {\n INSERT_BLOCK_COMMAND,\n INSERT_INLINE_BLOCK_COMMAND,\n} from '../../features/blocks/client/plugin/commands.js'\n\nexport { TestRecorderFeatureClient } from '../../features/debug/testRecorder/client/index.js'\nexport { TreeViewFeatureClient } from '../../features/debug/treeView/client/index.js'\nexport { BoldFeatureClient } from '../../features/format/bold/feature.client.js'\nexport { InlineCodeFeatureClient } from '../../features/format/inlineCode/feature.client.js'\nexport { ItalicFeatureClient } from '../../features/format/italic/feature.client.js'\nexport { StrikethroughFeatureClient } from '../../features/format/strikethrough/feature.client.js'\nexport { SubscriptFeatureClient } from '../../features/format/subscript/feature.client.js'\nexport { SuperscriptFeatureClient } from '../../features/format/superscript/feature.client.js'\nexport { UnderlineFeatureClient } from '../../features/format/underline/feature.client.js'\nexport { TextStateFeatureClient } from '../../features/textState/feature.client.js'\nexport { HeadingFeatureClient } from '../../features/heading/client/index.js'\nexport { HorizontalRuleFeatureClient } from '../../features/horizontalRule/client/index.js'\nexport { IndentFeatureClient } from '../../features/indent/client/index.js'\nexport { LinkFeatureClient } from '../../features/link/client/index.js'\nexport { ChecklistFeatureClient } from '../../features/lists/checklist/client/index.js'\nexport { OrderedListFeatureClient } from '../../features/lists/orderedList/client/index.js'\nexport { UnorderedListFeatureClient } from '../../features/lists/unorderedList/client/index.js'\nexport { LexicalPluginToLexicalFeatureClient } from '../../features/migrations/lexicalPluginToLexical/feature.client.js'\nexport { SlateToLexicalFeatureClient } from '../../features/migrations/slateToLexical/feature.client.js'\nexport { ParagraphFeatureClient } from '../../features/paragraph/client/index.js'\nexport { DebugJsxConverterFeatureClient } from '../../features/debug/jsxConverter/client/index.js'\nexport { defaultColors } from '../../features/textState/defaultColors.js'\n\nexport { RelationshipFeatureClient } from '../../features/relationship/client/index.js'\n\nexport { toolbarFormatGroupWithItems } from '../../features/format/shared/toolbarFormatGroup.js'\nexport { toolbarAddDropdownGroupWithItems } from '../../features/shared/toolbar/addDropdownGroup.js'\nexport { toolbarFeatureButtonsGroupWithItems } from '../../features/shared/toolbar/featureButtonsGroup.js'\nexport { toolbarTextDropdownGroupWithItems } from '../../features/shared/toolbar/textDropdownGroup.js'\nexport { FixedToolbarFeatureClient } from '../../features/toolbars/fixed/client/index.js'\nexport { InlineToolbarFeatureClient } from '../../features/toolbars/inline/client/index.js'\nexport { ToolbarButton } from '../../features/toolbars/shared/ToolbarButton/index.js'\nexport { TableFeatureClient } from '../../features/experimental_table/client/index.js'\n\nexport { ToolbarDropdown } from '../../features/toolbars/shared/ToolbarDropdown/index.js'\nexport { UploadFeatureClient } from '../../features/upload/client/index.js'\n\nexport { RichTextField } from '../../field/index.js'\nexport {\n EditorConfigProvider,\n useEditorConfigContext,\n} from '../../lexical/config/client/EditorConfigProvider.js'\nexport { defaultEditorLexicalConfig } from '../../lexical/config/client/default.js'\n\nexport {\n sanitizeClientEditorConfig,\n sanitizeClientFeatures,\n} from '../../lexical/config/client/sanitize.js'\nexport { CAN_USE_DOM } from '../../lexical/utils/canUseDOM.js'\nexport { getDOMRangeRect } from '../../lexical/utils/getDOMRangeRect.js'\nexport { getSelectedNode } from '../../lexical/utils/getSelectedNode.js'\nexport { isHTMLElement } from '../../lexical/utils/guard.js'\nexport { joinClasses } from '../../lexical/utils/joinClasses.js'\n\nexport { createBlockNode } from '../../lexical/utils/markdown/createBlockNode.js'\nexport { isPoint, Point } from '../../lexical/utils/point.js'\nexport { Rect } from '../../lexical/utils/rect.js'\nexport { setFloatingElemPosition } from '../../lexical/utils/setFloatingElemPosition.js'\nexport { setFloatingElemPositionForLinkEditor } from '../../lexical/utils/setFloatingElemPositionForLinkEditor.js'\n\nexport {\n addSwipeDownListener,\n addSwipeLeftListener,\n addSwipeRightListener,\n addSwipeUpListener,\n} from '../../lexical/utils/swipe.js'\nexport { createClientFeature } from '../../utilities/createClientFeature.js'\n\nexport {\n DETAIL_TYPE_TO_DETAIL,\n DOUBLE_LINE_BREAK,\n ELEMENT_FORMAT_TO_TYPE,\n ELEMENT_TYPE_TO_FORMAT,\n IS_ALL_FORMATTING,\n LTR_REGEX,\n NodeFormat,\n NON_BREAKING_SPACE,\n RTL_REGEX,\n TEXT_MODE_TO_TYPE,\n TEXT_TYPE_TO_FORMAT,\n TEXT_TYPE_TO_MODE,\n} from '../../lexical/utils/nodeFormat.js'\n\nexport { ENABLE_SLASH_MENU_COMMAND } from '../../lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/index.js'\n\nexport { getEnabledNodes } from '../../lexical/nodes/index.js'\n\nexport {\n $createUploadNode,\n $isUploadNode,\n UploadNode,\n} from '../../features/upload/client/nodes/UploadNode.js'\n\nexport {\n $createRelationshipNode,\n $isRelationshipNode,\n RelationshipNode,\n} from '../../features/relationship/client/nodes/RelationshipNode.js'\n\nexport {\n $createLinkNode,\n $isLinkNode,\n LinkNode,\n TOGGLE_LINK_COMMAND,\n} from '../../features/link/nodes/LinkNode.js'\n\nexport {\n $createAutoLinkNode,\n $isAutoLinkNode,\n AutoLinkNode,\n} from '../../features/link/nodes/AutoLinkNode.js'\n\nexport {\n $createBlockNode,\n $isBlockNode,\n BlockNode,\n} from '../../features/blocks/client/nodes/BlocksNode.js'\n\nexport {\n $createInlineBlockNode,\n $isInlineBlockNode,\n InlineBlockNode,\n} from '../../features/blocks/client/nodes/InlineBlocksNode.js'\n\nexport {\n $createHorizontalRuleNode,\n $isHorizontalRuleNode,\n HorizontalRuleNode,\n} from '../../features/horizontalRule/client/nodes/HorizontalRuleNode.js'\n\nexport { FieldsDrawer } from '../../utilities/fieldsDrawer/Drawer.js'\nexport { useLexicalDocumentDrawer } from '../../utilities/fieldsDrawer/useLexicalDocumentDrawer.js'\nexport { useLexicalDrawer } from '../../utilities/fieldsDrawer/useLexicalDrawer.js'\nexport { useLexicalListDrawer } from '../../utilities/fieldsDrawer/useLexicalListDrawer.js'\n\nexport { InlineBlockEditButton } from '../../features/blocks/client/componentInline/components/InlineBlockEditButton.js'\nexport { InlineBlockRemoveButton } from '../../features/blocks/client/componentInline/components/InlineBlockRemoveButton.js'\nexport { InlineBlockLabel } from '../../features/blocks/client/componentInline/components/InlineBlockLabel.js'\nexport { InlineBlockContainer } from '../../features/blocks/client/componentInline/components/InlineBlockContainer.js'\nexport { useInlineBlockComponentContext } from '../../features/blocks/client/componentInline/index.js'\nexport { BlockCollapsible } from '../../features/blocks/client/component/components/BlockCollapsible.js'\nexport { BlockEditButton } from '../../features/blocks/client/component/components/BlockEditButton.js'\nexport { BlockRemoveButton } from '../../features/blocks/client/component/components/BlockRemoveButton.js'\nexport { useBlockComponentContext } from '../../features/blocks/client/component/BlockContent.js'\nexport { getRestPopulateFn } from '../../features/converters/utilities/restPopulateFn.js'\nexport { codeConverterClient } from '../../features/blocks/premade/CodeBlock/converterClient.js'\nexport { CodeComponent } from '../../features/blocks/premade/CodeBlock/Component/Code.js'\nexport { CodeBlockBlockComponent } from '../../features/blocks/premade/CodeBlock/Component/Block.js'\n\nexport { RenderLexical } from '../../field/RenderLexical/index.js'\nexport { buildDefaultEditorState, buildEditorState } from '../../utilities/buildEditorState.js'\n"],"names":["slashMenuBasicGroupWithItems","AlignFeatureClient","BlockquoteFeatureClient","BlocksFeatureClient","INSERT_BLOCK_COMMAND","INSERT_INLINE_BLOCK_COMMAND","TestRecorderFeatureClient","TreeViewFeatureClient","BoldFeatureClient","InlineCodeFeatureClient","ItalicFeatureClient","StrikethroughFeatureClient","SubscriptFeatureClient","SuperscriptFeatureClient","UnderlineFeatureClient","TextStateFeatureClient","HeadingFeatureClient","HorizontalRuleFeatureClient","IndentFeatureClient","LinkFeatureClient","ChecklistFeatureClient","OrderedListFeatureClient","UnorderedListFeatureClient","LexicalPluginToLexicalFeatureClient","SlateToLexicalFeatureClient","ParagraphFeatureClient","DebugJsxConverterFeatureClient","defaultColors","RelationshipFeatureClient","toolbarFormatGroupWithItems","toolbarAddDropdownGroupWithItems","toolbarFeatureButtonsGroupWithItems","toolbarTextDropdownGroupWithItems","FixedToolbarFeatureClient","InlineToolbarFeatureClient","ToolbarButton","TableFeatureClient","ToolbarDropdown","UploadFeatureClient","RichTextField","EditorConfigProvider","useEditorConfigContext","defaultEditorLexicalConfig","sanitizeClientEditorConfig","sanitizeClientFeatures","CAN_USE_DOM","getDOMRangeRect","getSelectedNode","isHTMLElement","joinClasses","createBlockNode","isPoint","Point","Rect","setFloatingElemPosition","setFloatingElemPositionForLinkEditor","addSwipeDownListener","addSwipeLeftListener","addSwipeRightListener","addSwipeUpListener","createClientFeature","DETAIL_TYPE_TO_DETAIL","DOUBLE_LINE_BREAK","ELEMENT_FORMAT_TO_TYPE","ELEMENT_TYPE_TO_FORMAT","IS_ALL_FORMATTING","LTR_REGEX","NodeFormat","NON_BREAKING_SPACE","RTL_REGEX","TEXT_MODE_TO_TYPE","TEXT_TYPE_TO_FORMAT","TEXT_TYPE_TO_MODE","ENABLE_SLASH_MENU_COMMAND","getEnabledNodes","$createUploadNode","$isUploadNode","UploadNode","$createRelationshipNode","$isRelationshipNode","RelationshipNode","$createLinkNode","$isLinkNode","LinkNode","TOGGLE_LINK_COMMAND","$createAutoLinkNode","$isAutoLinkNode","AutoLinkNode","$createBlockNode","$isBlockNode","BlockNode","$createInlineBlockNode","$isInlineBlockNode","InlineBlockNode","$createHorizontalRuleNode","$isHorizontalRuleNode","HorizontalRuleNode","FieldsDrawer","useLexicalDocumentDrawer","useLexicalDrawer","useLexicalListDrawer","InlineBlockEditButton","InlineBlockRemoveButton","InlineBlockLabel","InlineBlockContainer","useInlineBlockComponentContext","BlockCollapsible","BlockEditButton","BlockRemoveButton","useBlockComponentContext","getRestPopulateFn","codeConverterClient","CodeComponent","CodeBlockBlockComponent","RenderLexical","buildDefaultEditorState","buildEditorState"],"mappings":"AAAA,6CAA6C,GAC7C;AAEA,SAASA,4BAA4B,QAAQ,gDAA+C;AAE5F,SAASC,kBAAkB,QAAQ,uCAAsC;AACzE,SAASC,uBAAuB,QAAQ,4CAA2C;AACnF,SAASC,mBAAmB,QAAQ,wCAAuC;AAC3E,SACEC,oBAAoB,EACpBC,2BAA2B,QACtB,kDAAiD;AAExD,SAASC,yBAAyB,QAAQ,oDAAmD;AAC7F,SAASC,qBAAqB,QAAQ,gDAA+C;AACrF,SAASC,iBAAiB,QAAQ,+CAA8C;AAChF,SAASC,uBAAuB,QAAQ,qDAAoD;AAC5F,SAASC,mBAAmB,QAAQ,iDAAgD;AACpF,SAASC,0BAA0B,QAAQ,wDAAuD;AAClG,SAASC,sBAAsB,QAAQ,oDAAmD;AAC1F,SAASC,wBAAwB,QAAQ,sDAAqD;AAC9F,SAASC,sBAAsB,QAAQ,oDAAmD;AAC1F,SAASC,sBAAsB,QAAQ,6CAA4C;AACnF,SAASC,oBAAoB,QAAQ,yCAAwC;AAC7E,SAASC,2BAA2B,QAAQ,gDAA+C;AAC3F,SAASC,mBAA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Q,wEAAuE;AACxG,SAASC,eAAe,QAAQ,uEAAsE;AACtG,SAASC,iBAAiB,QAAQ,yEAAwE;AAC1G,SAASC,wBAAwB,QAAQ,yDAAwD;AACjG,SAASC,iBAAiB,QAAQ,wDAAuD;AACzF,SAASC,mBAAmB,QAAQ,6DAA4D;AAChG,SAASC,aAAa,QAAQ,4DAA2D;AACzF,SAASC,uBAAuB,QAAQ,6DAA4D;AAEpG,SAASC,aAAa,QAAQ,qCAAoC;AAClE,SAASC,uBAAuB,EAAEC,gBAAgB,QAAQ,sCAAqC"}
1
+ {"version":3,"sources":["../../../src/exports/client/index.ts"],"sourcesContent":["/* eslint-disable perfectionist/sort-exports */\n'use client'\n\nexport { slashMenuBasicGroupWithItems } from '../../features/shared/slashMenu/basicGroup.js'\n\nexport { AlignFeatureClient } from '../../features/align/client/index.js'\nexport { BlockquoteFeatureClient } from '../../features/blockquote/client/index.js'\nexport { BlocksFeatureClient } from '../../features/blocks/client/index.js'\nexport {\n INSERT_BLOCK_COMMAND,\n INSERT_INLINE_BLOCK_COMMAND,\n} from '../../features/blocks/client/plugin/commands.js'\n\nexport { TestRecorderFeatureClient } from '../../features/debug/testRecorder/client/index.js'\nexport { TreeViewFeatureClient } from '../../features/debug/treeView/client/index.js'\nexport { BoldFeatureClient } from '../../features/format/bold/feature.client.js'\nexport { InlineCodeFeatureClient } from '../../features/format/inlineCode/feature.client.js'\nexport { ItalicFeatureClient } from '../../features/format/italic/feature.client.js'\nexport { StrikethroughFeatureClient } from '../../features/format/strikethrough/feature.client.js'\nexport { SubscriptFeatureClient } from '../../features/format/subscript/feature.client.js'\nexport { SuperscriptFeatureClient } from '../../features/format/superscript/feature.client.js'\nexport { UnderlineFeatureClient } from '../../features/format/underline/feature.client.js'\nexport { TextStateFeatureClient } from '../../features/textState/feature.client.js'\nexport { HeadingFeatureClient } from '../../features/heading/client/index.js'\nexport { HorizontalRuleFeatureClient } from '../../features/horizontalRule/client/index.js'\nexport { IndentFeatureClient } from '../../features/indent/client/index.js'\nexport { LinkFeatureClient } from '../../features/link/client/index.js'\nexport { ChecklistFeatureClient } from '../../features/lists/checklist/client/index.js'\nexport { OrderedListFeatureClient } from '../../features/lists/orderedList/client/index.js'\nexport { UnorderedListFeatureClient } from '../../features/lists/unorderedList/client/index.js'\nexport { LexicalPluginToLexicalFeatureClient } from '../../features/migrations/lexicalPluginToLexical/feature.client.js'\nexport { SlateToLexicalFeatureClient } from '../../features/migrations/slateToLexical/feature.client.js'\nexport { ParagraphFeatureClient } from '../../features/paragraph/client/index.js'\nexport { DebugJsxConverterFeatureClient } from '../../features/debug/jsxConverter/client/index.js'\nexport { defaultColors } from '../../features/textState/defaultColors.js'\n\nexport { RelationshipFeatureClient } from '../../features/relationship/client/index.js'\n\nexport { toolbarFormatGroupWithItems } from '../../features/format/shared/toolbarFormatGroup.js'\nexport { toolbarAddDropdownGroupWithItems } from '../../features/shared/toolbar/addDropdownGroup.js'\nexport { toolbarFeatureButtonsGroupWithItems } from '../../features/shared/toolbar/featureButtonsGroup.js'\nexport { toolbarTextDropdownGroupWithItems } from '../../features/shared/toolbar/textDropdownGroup.js'\nexport { FixedToolbarFeatureClient } from '../../features/toolbars/fixed/client/index.js'\nexport { InlineToolbarFeatureClient } from '../../features/toolbars/inline/client/index.js'\nexport { ToolbarButton } from '../../features/toolbars/shared/ToolbarButton/index.js'\nexport { TableFeatureClient } from '../../features/experimental_table/client/index.js'\n\nexport { ToolbarDropdown } from '../../features/toolbars/shared/ToolbarDropdown/index.js'\nexport { UploadFeatureClient } from '../../features/upload/client/index.js'\n\nexport { RichTextField } from '../../field/index.js'\nexport {\n EditorConfigProvider,\n useEditorConfigContext,\n} from '../../lexical/config/client/EditorConfigProvider.js'\nexport { defaultEditorLexicalConfig } from '../../lexical/config/client/default.js'\n\nexport {\n sanitizeClientEditorConfig,\n sanitizeClientFeatures,\n} from '../../lexical/config/client/sanitize.js'\nexport { CAN_USE_DOM } from '../../lexical/utils/canUseDOM.js'\nexport { getDOMRangeRect } from '../../lexical/utils/getDOMRangeRect.js'\nexport { getSelectedNode } from '../../lexical/utils/getSelectedNode.js'\nexport { isHTMLElement } from '../../lexical/utils/guard.js'\nexport { joinClasses } from '../../lexical/utils/joinClasses.js'\n\nexport { createBlockNode } from '../../lexical/utils/markdown/createBlockNode.js'\nexport { isPoint, Point } from '../../lexical/utils/point.js'\nexport { Rect } from '../../lexical/utils/rect.js'\nexport { setFloatingElemPosition } from '../../lexical/utils/setFloatingElemPosition.js'\nexport { setFloatingElemPositionForLinkEditor } from '../../lexical/utils/setFloatingElemPositionForLinkEditor.js'\n\nexport {\n addSwipeDownListener,\n addSwipeLeftListener,\n addSwipeRightListener,\n addSwipeUpListener,\n} from '../../lexical/utils/swipe.js'\nexport { createClientFeature } from '../../utilities/createClientFeature.js'\n\nexport {\n DETAIL_TYPE_TO_DETAIL,\n DOUBLE_LINE_BREAK,\n ELEMENT_FORMAT_TO_TYPE,\n ELEMENT_TYPE_TO_FORMAT,\n IS_ALL_FORMATTING,\n LTR_REGEX,\n NodeFormat,\n NON_BREAKING_SPACE,\n RTL_REGEX,\n TEXT_MODE_TO_TYPE,\n TEXT_TYPE_TO_FORMAT,\n TEXT_TYPE_TO_MODE,\n} from '../../lexical/utils/nodeFormat.js'\n\nexport { ENABLE_SLASH_MENU_COMMAND } from '../../lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/index.js'\n\nexport { getEnabledNodes } from '../../lexical/nodes/index.js'\n\nexport {\n $createUploadNode,\n $isUploadNode,\n UploadNode,\n} from '../../features/upload/client/nodes/UploadNode.js'\n\nexport {\n $createRelationshipNode,\n $isRelationshipNode,\n RelationshipNode,\n} from '../../features/relationship/client/nodes/RelationshipNode.js'\n\nexport {\n $createLinkNode,\n $isLinkNode,\n LinkNode,\n TOGGLE_LINK_COMMAND,\n} from '../../features/link/nodes/LinkNode.js'\n\nexport {\n $createAutoLinkNode,\n $isAutoLinkNode,\n AutoLinkNode,\n} from '../../features/link/nodes/AutoLinkNode.js'\n\nexport {\n $createBlockNode,\n $isBlockNode,\n BlockNode,\n} from '../../features/blocks/client/nodes/BlocksNode.js'\n\nexport {\n $createInlineBlockNode,\n $isInlineBlockNode,\n InlineBlockNode,\n} from '../../features/blocks/client/nodes/InlineBlocksNode.js'\n\nexport {\n $createHorizontalRuleNode,\n $isHorizontalRuleNode,\n HorizontalRuleNode,\n} from '../../features/horizontalRule/client/nodes/HorizontalRuleNode.js'\n\nexport { FieldsDrawer } from '../../utilities/fieldsDrawer/Drawer.js'\nexport { useLexicalDocumentDrawer } from '../../utilities/fieldsDrawer/useLexicalDocumentDrawer.js'\nexport { useLexicalDrawer } from '../../utilities/fieldsDrawer/useLexicalDrawer.js'\nexport { useLexicalListDrawer } from '../../utilities/fieldsDrawer/useLexicalListDrawer.js'\n\nexport { InlineBlockEditButton } from '../../features/blocks/client/componentInline/components/InlineBlockEditButton.js'\nexport { InlineBlockRemoveButton } from '../../features/blocks/client/componentInline/components/InlineBlockRemoveButton.js'\nexport { InlineBlockLabel } from '../../features/blocks/client/componentInline/components/InlineBlockLabel.js'\nexport { InlineBlockContainer } from '../../features/blocks/client/componentInline/components/InlineBlockContainer.js'\nexport { useInlineBlockComponentContext } from '../../features/blocks/client/componentInline/index.js'\nexport { BlockCollapsible } from '../../features/blocks/client/component/components/BlockCollapsible.js'\nexport { BlockEditButton } from '../../features/blocks/client/component/components/BlockEditButton.js'\nexport { BlockRemoveButton } from '../../features/blocks/client/component/components/BlockRemoveButton.js'\nexport { useBlockComponentContext } from '../../features/blocks/client/component/BlockContent.js'\nexport { getRestPopulateFn } from '../../features/converters/utilities/restPopulateFn.js'\nexport { codeConverterClient } from '../../features/blocks/premade/CodeBlock/converterClient.js'\nexport { CodeComponent } from '../../features/blocks/premade/CodeBlock/Component/Code.js'\nexport { CodeBlockBlockComponent } from '../../features/blocks/premade/CodeBlock/Component/Block.js'\n\nexport { RenderLexical } from '../../field/RenderLexical/index.js'\nexport { buildDefaultEditorState, buildEditorState } from '../../utilities/buildEditorState.js'\nexport { RichTextViewProvider, useRichTextView } from '../../field/RichTextViewProvider.js'\n"],"names":["slashMenuBasicGroupWithItems","AlignFeatureClient","BlockquoteFeatureClient","BlocksFeatureClient","INSERT_BLOCK_COMMAND","INSERT_INLINE_BLOCK_COMMAND","TestRecorderFeatureClient","TreeViewFeatureClient","BoldFeatureClient","InlineCodeFeatureClient","ItalicFeatureClient","StrikethroughFeatureClient","SubscriptFeatureClient","SuperscriptFeatureClient","UnderlineFeatureClient","TextStateFeatureClient","HeadingFeatureClient","HorizontalRuleFeatureClient","IndentFeatureClient","LinkFeatureClient","ChecklistFeatureClient","OrderedListFeatureClient","UnorderedListFeatureClient","LexicalPluginToLexicalFeatureClient","SlateToLexicalFeatureClient","ParagraphFeatureClient","DebugJsxConverterFeatureClient","defaultColors","RelationshipFeatureClient","toolbarFormatGroupWithItems","toolbarAddDropdownGroupWithItems","toolbarFeatureButtonsGroupWithItems","toolbarTextDropdownGroupWithItems","FixedToolbarFeatureClient","InlineToolbarFeatureClient","ToolbarButton","TableFeatureClient","ToolbarDropdown","UploadFeatureClient","RichTextField","EditorConfigProvider","useEditorConfigContext","defaultEditorLexicalConfig","sanitizeClientEditorConfig","sanitizeClientFeatures","CAN_USE_DOM","getDOMRangeRect","getSelectedNode","isHTMLElement","joinClasses","createBlockNode","isPoint","Point","Rect","setFloatingElemPosition","setFloatingElemPositionForLinkEditor","addSwipeDownListener","addSwipeLeftListener","addSwipeRightListener","addSwipeUpListener","createClientFeature","DETAIL_TYPE_TO_DETAIL","DOUBLE_LINE_BREAK","ELEMENT_FORMAT_TO_TYPE","ELEMENT_TYPE_TO_FORMAT","IS_ALL_FORMATTING","LTR_REGEX","NodeFormat","NON_BREAKING_SPACE","RTL_REGEX","TEXT_MODE_TO_TYPE","TEXT_TYPE_TO_FORMAT","TEXT_TYPE_TO_MODE","ENABLE_SLASH_MENU_COMMAND","getEnabledNodes","$createUploadNode","$isUploadNode","UploadNode","$createRelationshipNode","$isRelationshipNode","RelationshipNode","$createLinkNode","$isLinkNode","LinkNode","TOGGLE_LINK_COMMAND","$createAutoLinkNode","$isAutoLinkNode","AutoLinkNode","$createBlockNode","$isBlockNode","BlockNode","$createInlineBlockNode","$isInlineBlockNode","InlineBlockNode","$createHorizontalRuleNode","$isHorizontalRuleNode","HorizontalRuleNode","FieldsDrawer","useLexicalDocumentDrawer","useLexicalDrawer","useLexicalListDrawer","InlineBlockEditButton","InlineBlockRemoveButton","InlineBlockLabel","InlineBlockContainer","useInlineBlockComponentContext","BlockCollapsible","BlockEditButton","BlockRemoveButton","useBlockComponentContext","getRestPopulateFn","codeConverterClient","CodeComponent","CodeBlockBlockComponent","RenderLexical","buildDefaultEditorState","buildEditorState","RichTextViewProvider","useRichTextView"],"mappings":"AAAA,6CAA6C,GAC7C;AAEA,SAASA,4BAA4B,QAAQ,gDAA+C;AAE5F,SAASC,kBAAkB,QAAQ,uCAAsC;AACzE,SAASC,uBAAuB,QAAQ,4CAA2C;AACnF,SAASC,mBAAmB,QAAQ,wCAAuC;AAC3E,SACEC,oBAAoB,EACpBC,2BAA2B,QACtB,kDAAiD;AAExD,SAASC,yBAAyB,QAAQ,oDAAmD;AAC7F,SAASC,qBAAqB,QAAQ,gDAA+C;AACrF,SAASC,iBAAiB,QAAQ,+CAA8C;AAChF,SAASC,uBAAuB,QAAQ,qDAAoD;AAC5F,SAASC,mBAAmB,QAAQ,iDAAgD;AACpF,SAASC,0BAA0B,QAAQ,wDAAuD;AAClG,SAASC,sBAAsB,QAAQ,oDAAmD;AAC1F,SAASC,wBAAwB,QAAQ,sDAAqD;AAC9F,SAASC,sBAAsB,QAAQ,oDAAmD;AAC1F,SAASC,sBAAsB,QAAQ,6CAA4C;AACnF,SAASC,oBAAoB,QAAQ,yCAAwC;AAC7E,SAASC,2BAA2B,QAAQ,gDAA+C;AAC3F,SAASC,mBAAmB,QAAQ,wCAAuC;AAC3E,SAASC,iBAAiB,QAAQ,sCAAqC;AACvE,SAASC,sBA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,yEAAwE;AAC1G,SAASC,wBAAwB,QAAQ,yDAAwD;AACjG,SAASC,iBAAiB,QAAQ,wDAAuD;AACzF,SAASC,mBAAmB,QAAQ,6DAA4D;AAChG,SAASC,aAAa,QAAQ,4DAA2D;AACzF,SAASC,uBAAuB,QAAQ,6DAA4D;AAEpG,SAASC,aAAa,QAAQ,qCAAoC;AAClE,SAASC,uBAAuB,EAAEC,gBAAgB,QAAQ,sCAAqC;AAC/F,SAASC,oBAAoB,EAAEC,eAAe,QAAQ,sCAAqC"}
@@ -0,0 +1,3 @@
1
+ export { BlockContent, useBlockComponentContext, } from '../../features/blocks/client/component/BlockContent.js';
2
+ export { BlockComponent } from '../../features/blocks/client/component/index.js';
3
+ //# sourceMappingURL=internal-client.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"internal-client.d.ts","sourceRoot":"","sources":["../../../src/exports/client/internal-client.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EACZ,wBAAwB,GACzB,MAAM,wDAAwD,CAAA;AAC/D,OAAO,EAAE,cAAc,EAAE,MAAM,iDAAiD,CAAA"}
@@ -0,0 +1,4 @@
1
+ export { BlockContent, useBlockComponentContext } from '../../features/blocks/client/component/BlockContent.js';
2
+ export { BlockComponent } from '../../features/blocks/client/component/index.js';
3
+
4
+ //# sourceMappingURL=internal-client.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/exports/client/internal-client.ts"],"sourcesContent":["export {\n BlockContent,\n useBlockComponentContext,\n} from '../../features/blocks/client/component/BlockContent.js'\nexport { BlockComponent } from '../../features/blocks/client/component/index.js'\n"],"names":["BlockContent","useBlockComponentContext","BlockComponent"],"mappings":"AAAA,SACEA,YAAY,EACZC,wBAAwB,QACnB,yDAAwD;AAC/D,SAASC,cAAc,QAAQ,kDAAiD"}
@@ -12,5 +12,5 @@ export { TextJSXConverter } from '../../features/converters/lexicalToJSX/convert
12
12
  export { UploadJSXConverter } from '../../features/converters/lexicalToJSX/converter/converters/upload.js';
13
13
  export { defaultJSXConverters } from '../../features/converters/lexicalToJSX/converter/defaultConverters.js';
14
14
  export { convertLexicalNodesToJSX } from '../../features/converters/lexicalToJSX/converter/index.js';
15
- export type { JSXConverter, JSXConverters, SerializedLexicalNodeWithParent, } from '../../features/converters/lexicalToJSX/converter/types.js';
15
+ export type { JSXConverter, JSXConverterArgs, JSXConverters, SerializedLexicalNodeWithParent, } from '../../features/converters/lexicalToJSX/converter/types.js';
16
16
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/exports/react/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,qBAAqB,EAC1B,QAAQ,GACT,MAAM,2DAA2D,CAAA;AAClE,OAAO,EAAE,sBAAsB,EAAE,MAAM,2EAA2E,CAAA;AAClH,OAAO,EAAE,mBAAmB,EAAE,MAAM,wEAAwE,CAAA;AAC5G,OAAO,EAAE,0BAA0B,EAAE,MAAM,+EAA+E,CAAA;AAC1H,OAAO,EAAE,qBAAqB,EAAE,MAAM,0EAA0E,CAAA;AAChH,OAAO,EAAE,gBAAgB,EAAE,MAAM,qEAAqE,CAAA;AACtG,OAAO,EAAE,gBAAgB,EAAE,MAAM,qEAAqE,CAAA;AACtG,OAAO,EAAE,qBAAqB,EAAE,MAAM,0EAA0E,CAAA;AAChH,OAAO,EAAE,eAAe,EAAE,MAAM,oEAAoE,CAAA;AACpG,OAAO,EAAE,iBAAiB,EAAE,MAAM,sEAAsE,CAAA;AAExG,OAAO,EAAE,gBAAgB,EAAE,MAAM,qEAAqE,CAAA;AAEtG,OAAO,EAAE,kBAAkB,EAAE,MAAM,uEAAuE,CAAA;AAC1G,OAAO,EAAE,oBAAoB,EAAE,MAAM,uEAAuE,CAAA;AAC5G,OAAO,EAAE,wBAAwB,EAAE,MAAM,2DAA2D,CAAA;AACpG,YAAY,EACV,YAAY,EACZ,aAAa,EACb,+BAA+B,GAChC,MAAM,2DAA2D,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/exports/react/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,qBAAqB,EAC1B,QAAQ,GACT,MAAM,2DAA2D,CAAA;AAClE,OAAO,EAAE,sBAAsB,EAAE,MAAM,2EAA2E,CAAA;AAClH,OAAO,EAAE,mBAAmB,EAAE,MAAM,wEAAwE,CAAA;AAC5G,OAAO,EAAE,0BAA0B,EAAE,MAAM,+EAA+E,CAAA;AAC1H,OAAO,EAAE,qBAAqB,EAAE,MAAM,0EAA0E,CAAA;AAChH,OAAO,EAAE,gBAAgB,EAAE,MAAM,qEAAqE,CAAA;AACtG,OAAO,EAAE,gBAAgB,EAAE,MAAM,qEAAqE,CAAA;AACtG,OAAO,EAAE,qBAAqB,EAAE,MAAM,0EAA0E,CAAA;AAChH,OAAO,EAAE,eAAe,EAAE,MAAM,oEAAoE,CAAA;AACpG,OAAO,EAAE,iBAAiB,EAAE,MAAM,sEAAsE,CAAA;AAExG,OAAO,EAAE,gBAAgB,EAAE,MAAM,qEAAqE,CAAA;AAEtG,OAAO,EAAE,kBAAkB,EAAE,MAAM,uEAAuE,CAAA;AAC1G,OAAO,EAAE,oBAAoB,EAAE,MAAM,uEAAuE,CAAA;AAC5G,OAAO,EAAE,wBAAwB,EAAE,MAAM,2DAA2D,CAAA;AACpG,YAAY,EACV,YAAY,EACZ,gBAAgB,EAChB,aAAa,EACb,+BAA+B,GAChC,MAAM,2DAA2D,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/exports/react/index.ts"],"sourcesContent":["export {\n type JSXConvertersFunction,\n RichText,\n} from '../../features/converters/lexicalToJSX/Component/index.js'\nexport { BlockquoteJSXConverter } from '../../features/converters/lexicalToJSX/converter/converters/blockquote.js'\nexport { HeadingJSXConverter } from '../../features/converters/lexicalToJSX/converter/converters/heading.js'\nexport { HorizontalRuleJSXConverter } from '../../features/converters/lexicalToJSX/converter/converters/horizontalRule.js'\nexport { LinebreakJSXConverter } from '../../features/converters/lexicalToJSX/converter/converters/linebreak.js'\nexport { LinkJSXConverter } from '../../features/converters/lexicalToJSX/converter/converters/link.js'\nexport { ListJSXConverter } from '../../features/converters/lexicalToJSX/converter/converters/list.js'\nexport { ParagraphJSXConverter } from '../../features/converters/lexicalToJSX/converter/converters/paragraph.js'\nexport { TabJSXConverter } from '../../features/converters/lexicalToJSX/converter/converters/tab.js'\nexport { TableJSXConverter } from '../../features/converters/lexicalToJSX/converter/converters/table.js'\n\nexport { TextJSXConverter } from '../../features/converters/lexicalToJSX/converter/converters/text.js'\n\nexport { UploadJSXConverter } from '../../features/converters/lexicalToJSX/converter/converters/upload.js'\nexport { defaultJSXConverters } from '../../features/converters/lexicalToJSX/converter/defaultConverters.js'\nexport { convertLexicalNodesToJSX } from '../../features/converters/lexicalToJSX/converter/index.js'\nexport type {\n JSXConverter,\n JSXConverters,\n SerializedLexicalNodeWithParent,\n} from '../../features/converters/lexicalToJSX/converter/types.js'\n"],"names":["RichText","BlockquoteJSXConverter","HeadingJSXConverter","HorizontalRuleJSXConverter","LinebreakJSXConverter","LinkJSXConverter","ListJSXConverter","ParagraphJSXConverter","TabJSXConverter","TableJSXConverter","TextJSXConverter","UploadJSXConverter","defaultJSXConverters","convertLexicalNodesToJSX"],"mappings":"AAAA,SAEEA,QAAQ,QACH,4DAA2D;AAClE,SAASC,sBAAsB,QAAQ,4EAA2E;AAClH,SAASC,mBAAmB,QAAQ,yEAAwE;AAC5G,SAASC,0BAA0B,QAAQ,gFAA+E;AAC1H,SAASC,qBAAqB,QAAQ,2EAA0E;AAChH,SAASC,gBAAgB,QAAQ,sEAAqE;AACtG,SAASC,gBAAgB,QAAQ,sEAAqE;AACtG,SAASC,qBAAqB,QAAQ,2EAA0E;AAChH,SAASC,eAAe,QAAQ,qEAAoE;AACpG,SAASC,iBAAiB,QAAQ,uEAAsE;AAExG,SAASC,gBAAgB,QAAQ,sEAAqE;AAEtG,SAASC,kBAAkB,QAAQ,wEAAuE;AAC1G,SAASC,oBAAoB,QAAQ,wEAAuE;AAC5G,SAASC,wBAAwB,QAAQ,4DAA2D"}
1
+ {"version":3,"sources":["../../../src/exports/react/index.ts"],"sourcesContent":["export {\n type JSXConvertersFunction,\n RichText,\n} from '../../features/converters/lexicalToJSX/Component/index.js'\nexport { BlockquoteJSXConverter } from '../../features/converters/lexicalToJSX/converter/converters/blockquote.js'\nexport { HeadingJSXConverter } from '../../features/converters/lexicalToJSX/converter/converters/heading.js'\nexport { HorizontalRuleJSXConverter } from '../../features/converters/lexicalToJSX/converter/converters/horizontalRule.js'\nexport { LinebreakJSXConverter } from '../../features/converters/lexicalToJSX/converter/converters/linebreak.js'\nexport { LinkJSXConverter } from '../../features/converters/lexicalToJSX/converter/converters/link.js'\nexport { ListJSXConverter } from '../../features/converters/lexicalToJSX/converter/converters/list.js'\nexport { ParagraphJSXConverter } from '../../features/converters/lexicalToJSX/converter/converters/paragraph.js'\nexport { TabJSXConverter } from '../../features/converters/lexicalToJSX/converter/converters/tab.js'\nexport { TableJSXConverter } from '../../features/converters/lexicalToJSX/converter/converters/table.js'\n\nexport { TextJSXConverter } from '../../features/converters/lexicalToJSX/converter/converters/text.js'\n\nexport { UploadJSXConverter } from '../../features/converters/lexicalToJSX/converter/converters/upload.js'\nexport { defaultJSXConverters } from '../../features/converters/lexicalToJSX/converter/defaultConverters.js'\nexport { convertLexicalNodesToJSX } from '../../features/converters/lexicalToJSX/converter/index.js'\nexport type {\n JSXConverter,\n JSXConverterArgs,\n JSXConverters,\n SerializedLexicalNodeWithParent,\n} from '../../features/converters/lexicalToJSX/converter/types.js'\n"],"names":["RichText","BlockquoteJSXConverter","HeadingJSXConverter","HorizontalRuleJSXConverter","LinebreakJSXConverter","LinkJSXConverter","ListJSXConverter","ParagraphJSXConverter","TabJSXConverter","TableJSXConverter","TextJSXConverter","UploadJSXConverter","defaultJSXConverters","convertLexicalNodesToJSX"],"mappings":"AAAA,SAEEA,QAAQ,QACH,4DAA2D;AAClE,SAASC,sBAAsB,QAAQ,4EAA2E;AAClH,SAASC,mBAAmB,QAAQ,yEAAwE;AAC5G,SAASC,0BAA0B,QAAQ,gFAA+E;AAC1H,SAASC,qBAAqB,QAAQ,2EAA0E;AAChH,SAASC,gBAAgB,QAAQ,sEAAqE;AACtG,SAASC,gBAAgB,QAAQ,sEAAqE;AACtG,SAASC,qBAAqB,QAAQ,2EAA0E;AAChH,SAASC,eAAe,QAAQ,qEAAoE;AACpG,SAASC,iBAAiB,QAAQ,uEAAsE;AAExG,SAASC,gBAAgB,QAAQ,sEAAqE;AAEtG,SAASC,kBAAkB,QAAQ,wEAAuE;AAC1G,SAASC,oBAAoB,QAAQ,wEAAuE;AAC5G,SAASC,wBAAwB,QAAQ,4DAA2D"}
@@ -438,8 +438,8 @@ import { removeEmptyArrayValues } from './removeEmptyArrayValues.js';
438
438
  fields: clientBlock?.fields ?? [],
439
439
  forceRender: true,
440
440
  parentIndexPath: "",
441
- parentPath: "",
442
- // See Blocks feature path for details as for why this is empty
441
+ parentPath: // See Blocks feature path for details as for why this is empty
442
+ "",
443
443
  parentSchemaPath: schemaFieldsPath,
444
444
  permissions: true,
445
445
  readOnly: !isEditable
@@ -1 +1 @@
1
- {"version":3,"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 FormSubmit,\n Pill,\n RenderFields,\n SectionTitle,\n useConfig,\n useDocumentForm,\n useDocumentInfo,\n useEditDepth,\n useFormSubmitted,\n useServerFunctions,\n useTranslation,\n} from '@payloadcms/ui'\nimport { abortAndIgnore } from '@payloadcms/ui/shared'\nimport { $getNodeByKey } from 'lexical'\nimport {\n type BlocksFieldClient,\n type ClientBlock,\n type CollapsedPreferences,\n type FormState,\n} from 'payload'\nimport { deepCopyObjectSimpleWithoutReactComponents, reduceFieldsToValues } from 'payload/shared'\nimport React, { useCallback, useEffect, useMemo, useRef } from 'react'\nimport { v4 as uuid } from 'uuid'\n\nimport type { BlockFields } from '../../server/nodes/BlocksNode.js'\n\nimport { useEditorConfigContext } from '../../../../lexical/config/client/EditorConfigProvider.js'\nimport './index.scss'\nimport { useLexicalDrawer } from '../../../../utilities/fieldsDrawer/useLexicalDrawer.js'\nimport { $isBlockNode } from '../nodes/BlocksNode.js'\nimport { type BlockCollapsibleWithErrorProps, BlockContent } from './BlockContent.js'\nimport { removeEmptyArrayValues } from './removeEmptyArrayValues.js'\n\ntype Props = {\n /**\n * Can be modified by the node in order to trigger the re-fetch of the initial state based on the\n * formData. This is useful when node.setFields() is explicitly called from outside of the form - in\n * this case, the new field state is likely not reflected in the form state, so we need to re-fetch\n */\n readonly cacheBuster: number\n readonly className: string\n readonly formData: BlockFields\n readonly nodeKey: string\n}\n\nexport const BlockComponent: React.FC<Props> = (props) => {\n const { cacheBuster, className: baseClass, formData, nodeKey } = props\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\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 cachedFormState = initialLexicalFormState?.[formData.id]?.formState\n if (!cachedFormState) {\n return false\n }\n\n // Merge current formData values into the cached form state\n // This ensures that when the component remounts (e.g., due to view changes), we don't lose user edits\n const mergedState = Object.fromEntries(\n Object.entries(cachedFormState).map(([fieldName, fieldState]) => [\n fieldName,\n fieldName in formData\n ? {\n ...fieldState,\n initialValue: formData[fieldName],\n value: formData[fieldName],\n }\n : fieldState,\n ]),\n )\n\n // Manually add blockName, as it's not part of cachedFormState\n mergedState.blockName = {\n initialValue: formData.blockName,\n passesCondition: true,\n valid: true,\n value: formData.blockName,\n }\n\n return mergedState\n })\n\n const hasMounted = useRef(false)\n const prevCacheBuster = useRef(cacheBuster)\n useEffect(() => {\n if (hasMounted.current) {\n if (prevCacheBuster.current !== cacheBuster) {\n setInitialState(false)\n }\n prevCacheBuster.current = cacheBuster\n } else {\n hasMounted.current = true\n }\n }, [cacheBuster])\n\n const [CustomLabel, setCustomLabel] = React.useState<React.ReactNode | undefined>(\n // @ts-expect-error - vestiges of when tsconfig was not strict. Feel free to improve\n initialState?.['_components']?.customComponents?.BlockLabel ?? undefined,\n )\n\n const [CustomBlock, setCustomBlock] = React.useState<React.ReactNode | undefined>(\n // @ts-expect-error - vestiges of when tsconfig was not strict. Feel free to improve\n initialState?.['_components']?.customComponents?.Block ?? undefined,\n )\n\n // Initial state for newly created blocks\n useEffect(() => {\n const abortController = new AbortController()\n\n const awaitInitialState = async () => {\n /*\n * This will only run if a new block is created. For all existing blocks that are loaded when the document is loaded, or when the form is saved,\n * this is not run, as the lexical field RSC will fetch the state server-side and pass it to the client. That way, we avoid unnecessary client-side\n * requests. Though for newly created blocks, we need to fetch the state client-side, as the server doesn't know about the block yet.\n */\n const { state } = await getFormState({\n id,\n collectionSlug,\n data: formData,\n docPermissions: { fields: true },\n docPreferences: await getDocPreferences(),\n documentFormState: deepCopyObjectSimpleWithoutReactComponents(parentDocumentFields),\n globalSlug,\n initialBlockData: formData,\n 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: BlockFields = reduceFieldsToValues(\n deepCopyObjectSimpleWithoutReactComponents(state),\n 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 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\n setInitialState(state)\n setCustomLabel(state._components?.customComponents?.BlockLabel ?? undefined)\n setCustomBlock(state._components?.customComponents?.Block ?? undefined)\n }\n }\n\n if (formData && !initialState) {\n void awaitInitialState()\n }\n\n return () => {\n abortAndIgnore(abortController)\n }\n }, [\n getFormState,\n schemaFieldsPath,\n isEditable,\n id,\n formData,\n editor,\n nodeKey,\n initialState,\n collectionSlug,\n globalSlug,\n getDocPreferences,\n parentDocumentFields,\n blockType,\n ])\n\n const [isCollapsed, setIsCollapsed] = React.useState<boolean>(\n initialLexicalFormState?.[formData.id]?.collapsed ?? false,\n )\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\n\n const clientBlock: ClientBlock | undefined = blocksField.blockReferences\n ? typeof blocksField?.blockReferences?.[0] === 'string'\n ? config.blocksMap[blocksField?.blockReferences?.[0]]\n : blocksField?.blockReferences?.[0]\n : blocksField?.blocks?.[0]\n\n const { 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\n const { state: newFormState } = await getFormState({\n id,\n collectionSlug,\n docPermissions: {\n fields: true,\n },\n docPreferences: await getDocPreferences(),\n documentFormState: deepCopyObjectSimpleWithoutReactComponents(parentDocumentFields),\n formState: prevFormState,\n globalSlug,\n initialBlockFormState: prevFormState,\n operation: 'update',\n readOnly: !isEditable,\n renderAllFields: submit ? true : false,\n schemaPath: schemaFieldsPath,\n signal: controller.signal,\n })\n\n if (!newFormState) {\n return prevFormState\n }\n\n if (prevFormState.blockName) {\n newFormState.blockName = prevFormState.blockName\n }\n\n const newFormStateData: BlockFields = reduceFieldsToValues(\n removeEmptyArrayValues({\n fields: deepCopyObjectSimpleWithoutReactComponents(newFormState),\n }),\n true,\n ) as BlockFields\n\n setTimeout(() => {\n editor.update(() => {\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 }, 0)\n\n if (submit) {\n setCustomLabel(newFormState._components?.customComponents?.BlockLabel ?? undefined)\n setCustomBlock(newFormState._components?.customComponents?.Block ?? undefined)\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 ],\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 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=\"icon-label\"\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=\"small\"\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=\"icon-label\"\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 ({\n Actions,\n children,\n className,\n collapsibleProps,\n disableBlockName,\n editButton,\n errorCount,\n fieldHasErrors,\n Label,\n Pill: CustomPill,\n removeButton,\n }: BlockCollapsibleWithErrorProps) => {\n return (\n <div className={`${baseClass}__container ${baseClass}-${blockType}`}>\n <Collapsible\n className={[\n `${baseClass}__row`,\n fieldHasErrors ? `${baseClass}__row--has-errors` : `${baseClass}__row--no-errors`,\n className,\n ]\n .filter(Boolean)\n .join(' ')}\n collapsibleStyle={fieldHasErrors ? 'error' : 'default'}\n header={\n <div className={`${baseClass}__block-header`}>\n {typeof Label !== 'undefined' ? (\n Label\n ) : typeof CustomLabel !== 'undefined' ? (\n CustomLabel\n ) : (\n <div className={`${baseClass}__block-label`}>\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\n <div className={`${baseClass}__block-actions`}>\n {typeof Actions !== 'undefined' ? (\n Actions\n ) : (\n <>\n {(CustomBlock && editButton !== false) || (!CustomBlock && editButton) ? (\n <EditButton />\n ) : null}\n {removeButton !== false && isEditable ? <RemoveButton /> : null}\n </>\n )}\n </div>\n </div>\n }\n isCollapsed={isCollapsed}\n key={0}\n onToggle={(incomingCollapsedState) => {\n onCollapsedChange(incomingCollapsedState)\n setIsCollapsed(incomingCollapsedState)\n }}\n {...(collapsibleProps || {})}\n >\n {children}\n </Collapsible>\n </div>\n )\n },\n [\n CustomBlock,\n CustomLabel,\n EditButton,\n RemoveButton,\n blockDisplayName,\n baseClass,\n clientBlock?.admin?.disableBlockName,\n blockType,\n i18n,\n isCollapsed,\n onCollapsedChange,\n isEditable,\n ],\n )\n\n const blockID = formData?.id\n\n const BlockDrawer = useMemo(\n () => () => (\n <EditDepthProvider>\n <Drawer\n className={''}\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 <>\n <RenderFields\n fields={clientBlock?.fields ?? []}\n forceRender\n parentIndexPath=\"\"\n parentPath=\"\" // See Blocks feature path for details as for why this is empty\n parentSchemaPath={schemaFieldsPath}\n permissions={true}\n readOnly={!isEditable}\n />\n <FormSubmit programmaticSubmit={true}>{t('fields:saveChanges')}</FormSubmit>\n </>\n ) : null}\n </Drawer>\n </EditDepthProvider>\n ),\n [\n initialState,\n drawerSlug,\n blockID,\n blockDisplayName,\n t,\n isEditable,\n clientBlock?.fields,\n schemaFieldsPath,\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 <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, newData) => {\n // This is only called when form is submitted from drawer - usually only the case if the block has a custom Block component\n newData.blockType = blockType\n editor.update(() => {\n const node = $getNodeByKey(nodeKey)\n if (node && $isBlockNode(node)) {\n node.setFields(newData as BlockFields, true)\n }\n })\n toggleDrawer()\n }}\n submitted={submitted}\n uuid={uuid()}\n >\n <BlockContent\n baseClass={baseClass}\n BlockDrawer={BlockDrawer}\n Collapsible={BlockCollapsible}\n CustomBlock={CustomBlock}\n EditButton={EditButton}\n errorCount={errorCount}\n formSchema={clientBlock?.fields ?? []}\n initialState={initialState}\n nodeKey={nodeKey}\n RemoveButton={RemoveButton}\n />\n </Form>\n )\n }, [\n BlockCollapsible,\n BlockDrawer,\n CustomBlock,\n blockType,\n RemoveButton,\n EditButton,\n baseClass,\n editor,\n errorCount,\n toggleDrawer,\n clientBlock?.fields,\n // DO NOT ADD FORMDATA HERE! Adding formData will kick you out of sub block editors while writing.\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"],"names":["useLexicalComposerContext","useLexicalEditable","getTranslation","Button","Collapsible","Drawer","EditDepthProvider","ErrorPill","Form","formatDrawerSlug","FormSubmit","Pill","RenderFields","SectionTitle","useConfig","useDocumentForm","useDocumentInfo","useEditDepth","useFormSubmitted","useServerFunctions","useTranslation","abortAndIgnore","$getNodeByKey","deepCopyObjectSimpleWithoutReactComponents","reduceFieldsToValues","React","useCallback","useEffect","useMemo","useRef","v4","uuid","useEditorConfigContext","useLexicalDrawer","$isBlockNode","BlockContent","removeEmptyArrayValues","BlockComponent","props","cacheBuster","className","baseClass","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","getFormState","schemaFieldsPath","initialState","setInitialState","cachedFormState","formState","mergedState","Object","fromEntries","entries","map","fieldName","fieldState","initialValue","value","blockName","passesCondition","valid","hasMounted","prevCacheBuster","current","CustomLabel","setCustomLabel","customComponents","BlockLabel","undefined","CustomBlock","setCustomBlock","Block","abortController","awaitInitialState","state","data","docPermissions","docPreferences","documentFormState","initialBlockData","operation","readOnly","renderAllFields","signal","newFormStateData","update","node","newData","setFields","_components","isCollapsed","setIsCollapsed","collapsed","componentMapRenderedBlockPath","clientSchemaMap","blocksField","clientBlock","blockReferences","blocksMap","blocks","i18n","t","onChange","prevFormState","submit","controller","newFormState","initialBlockFormState","setTimeout","rowErrorCount","formField","values","removeBlock","remove","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","children","collapsibleProps","disableBlockName","editButton","fieldHasErrors","Label","CustomPill","removeButton","div","filter","Boolean","join","collapsibleStyle","header","pillStyle","admin","path","count","withMessage","onToggle","incomingCollapsedState","blockID","BlockDrawer","title","forceRender","parentIndexPath","parentPath","parentSchemaPath","permissions","programmaticSubmit","beforeSubmit","onSubmit","formSchema"],"mappings":"AAAA;;AAEA,SAASA,yBAAyB,QAAQ,wCAAuC;AACjF,SAASC,kBAAkB,QAAQ,oCAAmC;AACtE,SAASC,cAAc,QAAQ,2BAA0B;AACzD,SACEC,MAAM,EACNC,WAAW,EACXC,MAAM,EACNC,iBAAiB,EACjBC,SAAS,EACTC,IAAI,EACJC,gBAAgB,EAChBC,UAAU,EACVC,IAAI,EACJC,YAAY,EACZC,YAAY,EACZC,SAAS,EACTC,eAAe,EACfC,eAAe,EACfC,YAAY,EACZC,gBAAgB,EAChBC,kBAAkB,EAClBC,cAAc,QACT,iBAAgB;AACvB,SAASC,cAAc,QAAQ,wBAAuB;AACtD,SAASC,aAAa,QAAQ,UAAS;AAOvC,SAASC,0CAA0C,EAAEC,oBAAoB,QAAQ,iBAAgB;AACjG,OAAOC,SAASC,WAAW,EAAEC,SAAS,EAAEC,OAAO,EAAEC,MAAM,QAAQ,QAAO;AACtE,SAASC,MAAMC,IAAI,QAAQ,OAAM;AAIjC,SAASC,sBAAsB,QAAQ,4D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O;wBAC9BA,KAAKE,SAAS,CAACD,SAAwB;oBACzC;gBACF;gBACAlD;YACF;YACAvB,WAAWA;YACXb,MAAMA;sBAEN,cAAA,QAACI;gBACCM,WAAWA;gBACX+J,aAAaA;gBACbpM,aAAa4K;gBACb7E,aAAaA;gBACb8D,YAAYA;gBACZrG,YAAYA;gBACZsJ,YAAYpF,aAAavE,UAAU,EAAE;gBACrCoB,cAAcA;gBACdhC,SAASA;gBACToI,cAAcA;;;;;;;;;;;IAItB,GAAG;QACDC;QACAwB;QACArG;QACA3B;QACAuG;QACAd;QACAxH;QACA6B;QACAV;QACAO;QACA2D,aAAavE;QACb,kGAAkG;QAClGoB;QACAhC;QACAyF;QACAxF;KACD;IAED,IAAI,CAACkF,aAAa;QAChB,qBACE,QAACkD;YAAiBI,kBAAkB;YAAME,gBAAgB;sBACxD,cAAA,QAACI;gBAAIlJ,WAAW,GAAGC,UAAU,UAAU,CAAC;;oBAAE;oBACzB+B;oBAAU;;;;;;;;;;;;IAIjC;IAEA,OAAO6B;AACT,EAAC"}
1
+ {"version":3,"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 FormSubmit,\n Pill,\n RenderFields,\n SectionTitle,\n useConfig,\n useDocumentForm,\n useDocumentInfo,\n useEditDepth,\n useFormSubmitted,\n useServerFunctions,\n useTranslation,\n} from '@payloadcms/ui'\nimport { abortAndIgnore } from '@payloadcms/ui/shared'\nimport { $getNodeByKey } from 'lexical'\nimport {\n type BlocksFieldClient,\n type ClientBlock,\n type CollapsedPreferences,\n type FormState,\n} from 'payload'\nimport { deepCopyObjectSimpleWithoutReactComponents, reduceFieldsToValues } from 'payload/shared'\nimport React, { useCallback, useEffect, useMemo, useRef } from 'react'\nimport { v4 as uuid } from 'uuid'\n\nimport type { BlockFields } from '../../server/nodes/BlocksNode.js'\n\nimport { useEditorConfigContext } from '../../../../lexical/config/client/EditorConfigProvider.js'\nimport './index.scss'\nimport { useLexicalDrawer } from '../../../../utilities/fieldsDrawer/useLexicalDrawer.js'\nimport { $isBlockNode } from '../nodes/BlocksNode.js'\nimport { type BlockCollapsibleWithErrorProps, BlockContent } from './BlockContent.js'\nimport { removeEmptyArrayValues } from './removeEmptyArrayValues.js'\n\ntype Props = {\n /**\n * Can be modified by the node in order to trigger the re-fetch of the initial state based on the\n * formData. This is useful when node.setFields() is explicitly called from outside of the form - in\n * this case, the new field state is likely not reflected in the form state, so we need to re-fetch\n */\n readonly cacheBuster: number\n readonly className: string\n readonly formData: BlockFields\n readonly nodeKey: string\n}\n\nexport const BlockComponent: React.FC<Props> = (props) => {\n const { cacheBuster, className: baseClass, formData, nodeKey } = props\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\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 cachedFormState = initialLexicalFormState?.[formData.id]?.formState\n if (!cachedFormState) {\n return false\n }\n\n // Merge current formData values into the cached form state\n // This ensures that when the component remounts (e.g., due to view changes), we don't lose user edits\n const mergedState = Object.fromEntries(\n Object.entries(cachedFormState).map(([fieldName, fieldState]) => [\n fieldName,\n fieldName in formData\n ? {\n ...fieldState,\n initialValue: formData[fieldName],\n value: formData[fieldName],\n }\n : fieldState,\n ]),\n )\n\n // Manually add blockName, as it's not part of cachedFormState\n mergedState.blockName = {\n initialValue: formData.blockName,\n passesCondition: true,\n valid: true,\n value: formData.blockName,\n }\n\n return mergedState\n })\n\n const hasMounted = useRef(false)\n const prevCacheBuster = useRef(cacheBuster)\n useEffect(() => {\n if (hasMounted.current) {\n if (prevCacheBuster.current !== cacheBuster) {\n setInitialState(false)\n }\n prevCacheBuster.current = cacheBuster\n } else {\n hasMounted.current = true\n }\n }, [cacheBuster])\n\n const [CustomLabel, setCustomLabel] = React.useState<React.ReactNode | undefined>(\n // @ts-expect-error - vestiges of when tsconfig was not strict. Feel free to improve\n initialState?.['_components']?.customComponents?.BlockLabel ?? undefined,\n )\n\n const [CustomBlock, setCustomBlock] = React.useState<React.ReactNode | undefined>(\n // @ts-expect-error - vestiges of when tsconfig was not strict. Feel free to improve\n initialState?.['_components']?.customComponents?.Block ?? undefined,\n )\n\n // Initial state for newly created blocks\n useEffect(() => {\n const abortController = new AbortController()\n\n const awaitInitialState = async () => {\n /*\n * This will only run if a new block is created. For all existing blocks that are loaded when the document is loaded, or when the form is saved,\n * this is not run, as the lexical field RSC will fetch the state server-side and pass it to the client. That way, we avoid unnecessary client-side\n * requests. Though for newly created blocks, we need to fetch the state client-side, as the server doesn't know about the block yet.\n */\n const { state } = await getFormState({\n id,\n collectionSlug,\n data: formData,\n docPermissions: { fields: true },\n docPreferences: await getDocPreferences(),\n documentFormState: deepCopyObjectSimpleWithoutReactComponents(parentDocumentFields),\n globalSlug,\n initialBlockData: formData,\n 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: BlockFields = reduceFieldsToValues(\n deepCopyObjectSimpleWithoutReactComponents(state),\n 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 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\n setInitialState(state)\n setCustomLabel(state._components?.customComponents?.BlockLabel ?? undefined)\n setCustomBlock(state._components?.customComponents?.Block ?? undefined)\n }\n }\n\n if (formData && !initialState) {\n void awaitInitialState()\n }\n\n return () => {\n abortAndIgnore(abortController)\n }\n }, [\n getFormState,\n schemaFieldsPath,\n isEditable,\n id,\n formData,\n editor,\n nodeKey,\n initialState,\n collectionSlug,\n globalSlug,\n getDocPreferences,\n parentDocumentFields,\n blockType,\n ])\n\n const [isCollapsed, setIsCollapsed] = React.useState<boolean>(\n initialLexicalFormState?.[formData.id]?.collapsed ?? false,\n )\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\n\n const clientBlock: ClientBlock | undefined = blocksField.blockReferences\n ? typeof blocksField?.blockReferences?.[0] === 'string'\n ? config.blocksMap[blocksField?.blockReferences?.[0]]\n : blocksField?.blockReferences?.[0]\n : blocksField?.blocks?.[0]\n\n const { 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\n const { state: newFormState } = await getFormState({\n id,\n collectionSlug,\n docPermissions: {\n fields: true,\n },\n docPreferences: await getDocPreferences(),\n documentFormState: deepCopyObjectSimpleWithoutReactComponents(parentDocumentFields),\n formState: prevFormState,\n globalSlug,\n initialBlockFormState: prevFormState,\n operation: 'update',\n readOnly: !isEditable,\n renderAllFields: submit ? true : false,\n schemaPath: schemaFieldsPath,\n signal: controller.signal,\n })\n\n if (!newFormState) {\n return prevFormState\n }\n\n if (prevFormState.blockName) {\n newFormState.blockName = prevFormState.blockName\n }\n\n const newFormStateData: BlockFields = reduceFieldsToValues(\n removeEmptyArrayValues({\n fields: deepCopyObjectSimpleWithoutReactComponents(newFormState),\n }),\n true,\n ) as BlockFields\n\n setTimeout(() => {\n editor.update(() => {\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 }, 0)\n\n if (submit) {\n setCustomLabel(newFormState._components?.customComponents?.BlockLabel ?? undefined)\n setCustomBlock(newFormState._components?.customComponents?.Block ?? undefined)\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 ],\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 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=\"icon-label\"\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=\"small\"\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=\"icon-label\"\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 ({\n Actions,\n children,\n className,\n collapsibleProps,\n disableBlockName,\n editButton,\n errorCount,\n fieldHasErrors,\n Label,\n Pill: CustomPill,\n removeButton,\n }: BlockCollapsibleWithErrorProps) => {\n return (\n <div className={`${baseClass}__container ${baseClass}-${blockType}`}>\n <Collapsible\n className={[\n `${baseClass}__row`,\n fieldHasErrors ? `${baseClass}__row--has-errors` : `${baseClass}__row--no-errors`,\n className,\n ]\n .filter(Boolean)\n .join(' ')}\n collapsibleStyle={fieldHasErrors ? 'error' : 'default'}\n header={\n <div className={`${baseClass}__block-header`}>\n {typeof Label !== 'undefined' ? (\n Label\n ) : typeof CustomLabel !== 'undefined' ? (\n CustomLabel\n ) : (\n <div className={`${baseClass}__block-label`}>\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\n <div className={`${baseClass}__block-actions`}>\n {typeof Actions !== 'undefined' ? (\n Actions\n ) : (\n <>\n {(CustomBlock && editButton !== false) || (!CustomBlock && editButton) ? (\n <EditButton />\n ) : null}\n {removeButton !== false && isEditable ? <RemoveButton /> : null}\n </>\n )}\n </div>\n </div>\n }\n isCollapsed={isCollapsed}\n key={0}\n onToggle={(incomingCollapsedState) => {\n onCollapsedChange(incomingCollapsedState)\n setIsCollapsed(incomingCollapsedState)\n }}\n {...(collapsibleProps || {})}\n >\n {children}\n </Collapsible>\n </div>\n )\n },\n [\n CustomBlock,\n CustomLabel,\n EditButton,\n RemoveButton,\n blockDisplayName,\n baseClass,\n clientBlock?.admin?.disableBlockName,\n blockType,\n i18n,\n isCollapsed,\n onCollapsedChange,\n isEditable,\n ],\n )\n\n const blockID = formData?.id\n\n const BlockDrawer = useMemo(\n () => () => (\n <EditDepthProvider>\n <Drawer\n className={''}\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 <>\n <RenderFields\n fields={clientBlock?.fields ?? []}\n forceRender\n parentIndexPath=\"\"\n parentPath=\"\" // See Blocks feature path for details as for why this is empty\n parentSchemaPath={schemaFieldsPath}\n permissions={true}\n readOnly={!isEditable}\n />\n <FormSubmit programmaticSubmit={true}>{t('fields:saveChanges')}</FormSubmit>\n </>\n ) : null}\n </Drawer>\n </EditDepthProvider>\n ),\n [\n initialState,\n drawerSlug,\n blockID,\n blockDisplayName,\n t,\n isEditable,\n clientBlock?.fields,\n schemaFieldsPath,\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 <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, newData) => {\n // This is only called when form is submitted from drawer - usually only the case if the block has a custom Block component\n newData.blockType = blockType\n editor.update(() => {\n const node = $getNodeByKey(nodeKey)\n if (node && $isBlockNode(node)) {\n node.setFields(newData as BlockFields, true)\n }\n })\n toggleDrawer()\n }}\n submitted={submitted}\n uuid={uuid()}\n >\n <BlockContent\n baseClass={baseClass}\n BlockDrawer={BlockDrawer}\n Collapsible={BlockCollapsible}\n CustomBlock={CustomBlock}\n EditButton={EditButton}\n errorCount={errorCount}\n formSchema={clientBlock?.fields ?? []}\n initialState={initialState}\n nodeKey={nodeKey}\n RemoveButton={RemoveButton}\n />\n </Form>\n )\n }, [\n BlockCollapsible,\n BlockDrawer,\n CustomBlock,\n blockType,\n RemoveButton,\n EditButton,\n baseClass,\n editor,\n errorCount,\n toggleDrawer,\n clientBlock?.fields,\n // DO NOT ADD FORMDATA HERE! Adding formData will kick you out of sub block editors while writing.\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"],"names":["useLexicalComposerContext","useLexicalEditable","getTranslation","Button","Collapsible","Drawer","EditDepthProvider","ErrorPill","Form","formatDrawerSlug","FormSubmit","Pill","RenderFields","SectionTitle","useConfig","useDocumentForm","useDocumentInfo","useEditDepth","useFormSubmitted","useServerFunctions","useTranslation","abortAndIgnore","$getNodeByKey","deepCopyObjectSimpleWithoutReactComponents","reduceFieldsToValues","React","useCallback","useEffect","useMemo","useRef","v4","uuid","useEditorConfigContext","useLexicalDrawer","$isBlockNode","BlockContent","removeEmptyArrayValues","BlockComponent","props","cacheBuster","className","baseClass","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","getFormState","schemaFieldsPath","initialState","setInitialState","cachedFormState","formState","mergedState","Object","fromEntries","entries","map","fieldName","fieldState","initialValue","value","blockName","passesCondition","valid","hasMounted","prevCacheBuster","current","CustomLabel","setCustomLabel","customComponents","BlockLabel","undefined","CustomBlock","setCustomBlock","Block","abortController","awaitInitialState","state","data","docPermissions","docPreferences","documentFormState","initialBlockData","operation","readOnly","renderAllFields","signal","newFormStateData","update","node","newData","setFields","_components","isCollapsed","setIsCollapsed","collapsed","componentMapRenderedBlockPath","clientSchemaMap","blocksField","clientBlock","blockReferences","blocksMap","blocks","i18n","t","onChange","prevFormState","submit","controller","newFormState","initialBlockFormState","setTimeout","rowErrorCount","formField","values","removeBlock","remove","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","children","collapsibleProps","disableBlockName","editButton","fieldHasErrors","Label","CustomPill","removeButton","div","filter","Boolean","join","collapsibleStyle","header","pillStyle","admin","path","count","withMessage","onToggle","incomingCollapsedState","blockID","BlockDrawer","title","forceRender","parentIndexPath","parentPath","parentSchemaPath","permissions","programmaticSubmit","beforeSubmit","onSubmit","formSchema"],"mappings":"AAAA;;AAEA,SAASA,yBAAyB,QAAQ,wCAAuC;AACjF,SAASC,kBAAkB,QAAQ,oCAAmC;AACtE,SAASC,cAAc,QAAQ,2BAA0B;AACzD,SACEC,MAAM,EACNC,WAAW,EACXC,MAAM,EACNC,iBAAiB,EACjBC,SAAS,EACTC,IAAI,EACJC,gBAAgB,EAChBC,UAAU,EACVC,IAAI,EACJC,YAAY,EACZC,YAAY,EACZC,SAAS,EACTC,eAAe,EACfC,eAAe,EACfC,YAAY,EACZC,gBAAgB,EAChBC,kBAAkB,EAClBC,cAAc,QACT,iBAAgB;AACvB,SAASC,cAAc,QAAQ,wBAAuB;AACtD,SAASC,aAAa,QAAQ,UAAS;AAOvC,SAASC,0CAA0C,EAAEC,oBAAoB,QAAQ,iBAAgB;AACjG,OAAOC,SAASC,WAAW,EAAEC,SAAS,EAAEC,OAAO,EAAEC,MAAM,QAAQ,QAAO;AACtE,SAASC,MAAMC,IAAI,QAAQ,OAAM;AAIjC,SAASC,sBAAsB,QAAQ,4DAA2D;AAClG,OAAO,eAAc;AACrB,SAASC,gBAAgB,QAAQ,yDAAwD;AACzF,SAASC,YAAY,QAAQ,yBAAwB;AACrD,SAA8CC,YAAY,Q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M,WAAWA;gBACX+J,aAAaA;gBACbpM,aAAa4K;gBACb7E,aAAaA;gBACb8D,YAAYA;gBACZrG,YAAYA;gBACZsJ,YAAYpF,aAAavE,UAAU,EAAE;gBACrCoB,cAAcA;gBACdhC,SAASA;gBACToI,cAAcA;;;;;;;;;;;IAItB,GAAG;QACDC;QACAwB;QACArG;QACA3B;QACAuG;QACAd;QACAxH;QACA6B;QACAV;QACAO;QACA2D,aAAavE;QACb,kGAAkG;QAClGoB;QACAhC;QACAyF;QACAxF;KACD;IAED,IAAI,CAACkF,aAAa;QAChB,qBACE,QAACkD;YAAiBI,kBAAkB;YAAME,gBAAgB;sBACxD,cAAA,QAACI;gBAAIlJ,WAAW,GAAGC,UAAU,UAAU,CAAC;;oBAAE;oBACzB+B;oBAAU;;;;;;;;;;;;IAIjC;IAEA,OAAO6B;AACT,EAAC"}
@@ -396,8 +396,8 @@ export const InlineBlockComponent = (props)=>{
396
396
  fields: clientBlock?.fields,
397
397
  forceRender: true,
398
398
  parentIndexPath: "",
399
- parentPath: "",
400
- // See Blocks feature path for details as for why this is empty
399
+ parentPath: // See Blocks feature path for details as for why this is empty
400
+ "",
401
401
  parentSchemaPath: schemaFieldsPath,
402
402
  permissions: true,
403
403
  readOnly: !isEditable
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../src/features/blocks/client/componentInline/index.tsx"],"sourcesContent":["'use client'\n\nimport type { BlocksFieldClient, ClientBlock, Data, FormState } from 'payload'\n\nimport { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext'\nimport { useLexicalEditable } from '@lexical/react/useLexicalEditable'\nimport { getTranslation } from '@payloadcms/translations'\nimport {\n Button,\n Drawer,\n EditDepthProvider,\n Form,\n formatDrawerSlug,\n FormSubmit,\n RenderFields,\n ShimmerEffect,\n useConfig,\n useDocumentForm,\n useDocumentInfo,\n useEditDepth,\n useServerFunctions,\n useTranslation,\n} from '@payloadcms/ui'\nimport { abortAndIgnore } from '@payloadcms/ui/shared'\nimport { $getNodeByKey } from 'lexical'\n\nimport './index.scss'\n\nimport { deepCopyObjectSimpleWithoutReactComponents, reduceFieldsToValues } from 'payload/shared'\nimport React, { createContext, useCallback, useEffect, useMemo, useRef } from 'react'\nimport { v4 as uuid } from 'uuid'\n\nimport type { InlineBlockFields } from '../../server/nodes/InlineBlocksNode.js'\n\nimport { useEditorConfigContext } from '../../../../lexical/config/client/EditorConfigProvider.js'\nimport { useLexicalDrawer } from '../../../../utilities/fieldsDrawer/useLexicalDrawer.js'\nimport { $isInlineBlockNode } from '../nodes/InlineBlocksNode.js'\n\ntype Props = {\n /**\n * Can be modified by the node in order to trigger the re-fetch of the initial state based on the\n * formData. This is useful when node.setFields() is explicitly called from outside of the form - in\n * this case, the new field state is likely not reflected in the form state, so we need to re-fetch\n */\n readonly cacheBuster: number\n readonly className: string\n readonly formData: InlineBlockFields\n readonly nodeKey: string\n}\n\ntype InlineBlockComponentContextType = {\n EditButton?: React.FC\n initialState: false | FormState | undefined\n InlineBlockContainer?: React.FC<{ children: React.ReactNode }>\n Label?: React.FC\n nodeKey?: string\n RemoveButton?: React.FC\n}\n\nconst InlineBlockComponentContext = createContext<InlineBlockComponentContextType>({\n initialState: false,\n})\n\nexport const useInlineBlockComponentContext = () => React.use(InlineBlockComponentContext)\n\nexport const InlineBlockComponent: React.FC<Props> = (props) => {\n const { cacheBuster, className: baseClass, formData, nodeKey } = props\n\n const [editor] = useLexicalComposerContext()\n const isEditable = useLexicalEditable()\n const { i18n, t } = useTranslation<object, string>()\n const {\n createdInlineBlock,\n fieldProps: { featureClientSchemaMap, initialLexicalFormState, schemaPath },\n setCreatedInlineBlock,\n uuid: uuidFromContext,\n } = useEditorConfigContext()\n const { fields: parentDocumentFields } = useDocumentForm()\n\n const { getFormState } = useServerFunctions()\n const editDepth = useEditDepth()\n const firstTimeDrawer = useRef(false)\n\n const [initialState, setInitialState] = React.useState<false | FormState | undefined>(() => {\n // Initial form state that was calculated server-side. May have stale values\n const cachedFormState = initialLexicalFormState?.[formData.id]?.formState\n if (!cachedFormState) {\n return false\n }\n\n // Merge current formData values into the cached form state\n // This ensures that when the component remounts (e.g., due to view changes), we don't lose user edits\n return Object.fromEntries(\n Object.entries(cachedFormState).map(([fieldName, fieldState]) => [\n fieldName,\n fieldName in formData\n ? {\n ...fieldState,\n initialValue: formData[fieldName],\n value: formData[fieldName],\n }\n : fieldState,\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 [CustomLabel, setCustomLabel] = React.useState<React.ReactNode | undefined>(\n // @ts-expect-error - vestiges of when tsconfig was not strict. Feel free to improve\n initialState?.['_components']?.customComponents?.BlockLabel,\n )\n\n const [CustomBlock, setCustomBlock] = React.useState<React.ReactNode | undefined>(\n // @ts-expect-error - vestiges of when tsconfig was not strict. Feel free to improve\n initialState?.['_components']?.customComponents?.Block,\n )\n\n const drawerSlug = formatDrawerSlug({\n slug: `lexical-inlineBlocks-create-${uuidFromContext}-${formData.id}`,\n depth: editDepth,\n })\n const { toggleDrawer } = useLexicalDrawer(drawerSlug, true)\n\n const inlineBlockElemElemRef = useRef<HTMLDivElement | null>(null)\n const { id, collectionSlug, getDocPreferences, globalSlug } = useDocumentInfo()\n const { config } = useConfig()\n\n const componentMapRenderedBlockPath = `${schemaPath}.lexical_internal_feature.blocks.lexical_inline_blocks.${formData.blockType}`\n\n const clientSchemaMap = featureClientSchemaMap['blocks']\n\n const blocksField: BlocksFieldClient = clientSchemaMap?.[\n componentMapRenderedBlockPath\n ]?.[0] as BlocksFieldClient\n\n const clientBlock: ClientBlock | undefined = blocksField.blockReferences\n ? typeof blocksField?.blockReferences?.[0] === 'string'\n ? config.blocksMap[blocksField?.blockReferences?.[0]]\n : blocksField?.blockReferences?.[0]\n : blocksField?.blocks?.[0]\n\n const clientBlockFields = clientBlock?.fields ?? []\n\n // Open drawer on \"mount\"\n useEffect(() => {\n if (!firstTimeDrawer.current && createdInlineBlock?.getKey() === nodeKey) {\n // > 2 because they always have \"id\" and \"blockName\" fields\n if (clientBlockFields.length > 2) {\n toggleDrawer()\n }\n setCreatedInlineBlock?.(undefined)\n firstTimeDrawer.current = true\n }\n }, [clientBlockFields.length, createdInlineBlock, nodeKey, setCreatedInlineBlock, toggleDrawer])\n\n const removeInlineBlock = useCallback(() => {\n editor.update(() => {\n $getNodeByKey(nodeKey)?.remove()\n })\n }, [editor, nodeKey])\n\n const blockDisplayName = clientBlock?.labels?.singular\n ? getTranslation(clientBlock?.labels.singular, i18n)\n : clientBlock?.slug\n\n const onChangeAbortControllerRef = useRef(new AbortController())\n const schemaFieldsPath = `${schemaPath}.lexical_internal_feature.blocks.lexical_inline_blocks.${clientBlock?.slug}.fields`\n\n // Initial state for newly created blocks\n useEffect(() => {\n const abortController = new AbortController()\n\n const awaitInitialState = async () => {\n /*\n * This will only run if a new block is created. For all existing blocks that are loaded when the document is loaded, or when the form is saved,\n * this is not run, as the lexical field RSC will fetch the state server-side and pass it to the client. That way, we avoid unnecessary client-side\n * requests. Though for newly created blocks, we need to fetch the state client-side, as the server doesn't know about the block yet.\n */\n const { state } = await getFormState({\n id,\n collectionSlug,\n data: formData,\n docPermissions: { fields: true },\n docPreferences: await getDocPreferences(),\n documentFormState: deepCopyObjectSimpleWithoutReactComponents(parentDocumentFields),\n globalSlug,\n initialBlockData: formData,\n initialBlockFormState: formData,\n operation: 'update',\n readOnly: !isEditable,\n renderAllFields: true,\n schemaPath: schemaFieldsPath,\n signal: abortController.signal,\n })\n\n if (state) {\n const newFormStateData: InlineBlockFields = reduceFieldsToValues(\n deepCopyObjectSimpleWithoutReactComponents(state),\n true,\n ) as InlineBlockFields\n\n // Things like default values may come back from the server => update the node with the new data\n editor.update(() => {\n const node = $getNodeByKey(nodeKey)\n if (node && $isInlineBlockNode(node)) {\n const newData = newFormStateData\n newData.blockType = formData.blockType\n\n node.setFields(newData, true)\n }\n })\n\n setInitialState(state)\n setCustomLabel(state['_components']?.customComponents?.BlockLabel)\n setCustomBlock(state['_components']?.customComponents?.Block)\n }\n }\n\n if (formData && !initialState) {\n void awaitInitialState()\n }\n\n return () => {\n abortAndIgnore(abortController)\n }\n }, [\n getFormState,\n editor,\n nodeKey,\n isEditable,\n schemaFieldsPath,\n id,\n formData,\n initialState,\n collectionSlug,\n globalSlug,\n getDocPreferences,\n parentDocumentFields,\n ])\n\n /**\n * HANDLE ONCHANGE\n */\n const onChange = useCallback(\n async ({ formState: prevFormState, submit }: { formState: FormState; submit?: boolean }) => {\n abortAndIgnore(onChangeAbortControllerRef.current)\n\n const controller = new AbortController()\n onChangeAbortControllerRef.current = controller\n\n const { state } = await getFormState({\n id,\n collectionSlug,\n docPermissions: {\n fields: true,\n },\n docPreferences: await getDocPreferences(),\n documentFormState: deepCopyObjectSimpleWithoutReactComponents(parentDocumentFields),\n formState: prevFormState,\n globalSlug,\n initialBlockFormState: prevFormState,\n operation: 'update',\n readOnly: !isEditable,\n renderAllFields: submit ? true : false,\n schemaPath: schemaFieldsPath,\n signal: controller.signal,\n })\n\n if (!state) {\n return prevFormState\n }\n\n if (submit) {\n setCustomLabel(state['_components']?.customComponents?.BlockLabel)\n setCustomBlock(state['_components']?.customComponents?.Block)\n }\n\n return state\n },\n [\n getFormState,\n id,\n collectionSlug,\n getDocPreferences,\n parentDocumentFields,\n globalSlug,\n isEditable,\n schemaFieldsPath,\n ],\n )\n // cleanup effect\n useEffect(() => {\n const isStateOutOfSync = (formData: InlineBlockFields, initialState: FormState) => {\n return Object.keys(initialState).some(\n (key) => initialState[key] && formData[key] !== initialState[key].value,\n )\n }\n\n return () => {\n // If the component is unmounted (either via removeInlineBlock or via lexical itself) and the form state got changed before,\n // we need to reset the initial state to force a re-fetch of the initial state when it gets mounted again (e.g. via lexical history undo).\n // Otherwise it would use an outdated initial state.\n if (initialState && isStateOutOfSync(formData, initialState)) {\n setInitialState(false)\n }\n abortAndIgnore(onChangeAbortControllerRef.current)\n }\n }, [formData, initialState])\n\n /**\n * HANDLE FORM SUBMIT\n */\n const onFormSubmit = useCallback(\n (formState: FormState, newData: Data) => {\n newData.blockType = formData.blockType\n\n editor.update(() => {\n const node = $getNodeByKey(nodeKey)\n if (node && $isInlineBlockNode(node)) {\n node.setFields(newData as InlineBlockFields, true)\n }\n })\n },\n [editor, nodeKey, formData],\n )\n\n const RemoveButton = useMemo(\n () => () => (\n <Button\n buttonStyle=\"icon-label\"\n className={`${baseClass}__removeButton`}\n disabled={!isEditable}\n icon=\"x\"\n onClick={(e) => {\n e.preventDefault()\n removeInlineBlock()\n }}\n round\n size=\"small\"\n tooltip={t('lexical:blocks:inlineBlocks:remove', { label: blockDisplayName })}\n />\n ),\n [baseClass, blockDisplayName, isEditable, removeInlineBlock, t],\n )\n\n const EditButton = useMemo(\n () => () => (\n <Button\n buttonStyle=\"icon-label\"\n className={`${baseClass}__editButton`}\n disabled={!isEditable}\n el=\"button\"\n icon=\"edit\"\n onClick={() => {\n toggleDrawer()\n }}\n round\n size=\"small\"\n tooltip={t('lexical:blocks:inlineBlocks:edit', { label: blockDisplayName })}\n />\n ),\n [baseClass, blockDisplayName, isEditable, t, toggleDrawer],\n )\n\n const InlineBlockContainer = useMemo(\n () =>\n ({ children, className }: { children: React.ReactNode; className?: string }) => (\n <div\n className={[`${baseClass}__container`, baseClass + '-' + formData.blockType, className]\n .filter(Boolean)\n .join(' ')}\n ref={inlineBlockElemElemRef}\n >\n {children}\n </div>\n ),\n [baseClass, formData.blockType],\n )\n\n const Label = useMemo(() => {\n if (CustomLabel) {\n return () => CustomLabel\n } else {\n return () => (\n <div>{clientBlock?.labels ? getTranslation(clientBlock?.labels.singular, i18n) : ''}</div>\n )\n }\n }, [CustomLabel, clientBlock?.labels, i18n])\n\n if (!clientBlock) {\n return (\n <InlineBlockContainer className={`${baseClass}-not-found`}>\n <span>Error: Block '{formData.blockType}' not found</span>\n {isEditable ? (\n <div className={`${baseClass}__actions`}>\n <RemoveButton />\n </div>\n ) : null}\n </InlineBlockContainer>\n )\n }\n\n return (\n <Form\n beforeSubmit={[\n async ({ formState }) => {\n // This is only called when form is submitted from drawer\n return await onChange({ formState, submit: true })\n },\n ]}\n disableValidationOnSubmit\n el=\"div\"\n fields={clientBlock?.fields}\n initialState={initialState || {}}\n onChange={[onChange]}\n onSubmit={(formState, data) => {\n onFormSubmit(formState, data)\n toggleDrawer()\n }}\n uuid={uuid()}\n >\n <EditDepthProvider>\n <Drawer\n className={''}\n slug={drawerSlug}\n title={t(`lexical:blocks:inlineBlocks:${formData?.id ? 'edit' : 'create'}`, {\n label: blockDisplayName ?? t('lexical:blocks:inlineBlocks:label'),\n })}\n >\n {initialState ? (\n <>\n <RenderFields\n fields={clientBlock?.fields}\n forceRender\n parentIndexPath=\"\"\n parentPath=\"\" // See Blocks feature path for details as for why this is empty\n parentSchemaPath={schemaFieldsPath}\n permissions={true}\n readOnly={!isEditable}\n />\n <FormSubmit programmaticSubmit={true}>{t('fields:saveChanges')}</FormSubmit>\n </>\n ) : null}\n </Drawer>\n </EditDepthProvider>\n {CustomBlock ? (\n <InlineBlockComponentContext\n value={{\n EditButton,\n initialState,\n InlineBlockContainer,\n Label,\n nodeKey,\n RemoveButton,\n }}\n >\n {CustomBlock}\n </InlineBlockComponentContext>\n ) : (\n <InlineBlockContainer>\n {initialState ? <Label /> : <ShimmerEffect height=\"15px\" width=\"40px\" />}\n {isEditable ? (\n <div className={`${baseClass}__actions`}>\n <EditButton />\n <RemoveButton />\n </div>\n ) : null}\n </InlineBlockContainer>\n )}\n </Form>\n )\n}\n"],"names":["useLexicalComposerContext","useLexicalEditable","getTranslation","Button","Drawer","EditDepthProvider","Form","formatDrawerSlug","FormSubmit","RenderFields","ShimmerEffect","useConfig","useDocumentForm","useDocumentInfo","useEditDepth","useServerFunctions","useTranslation","abortAndIgnore","$getNodeByKey","deepCopyObjectSimpleWithoutReactComponents","reduceFieldsToValues","React","createContext","useCallback","useEffect","useMemo","useRef","v4","uuid","useEditorConfigContext","useLexicalDrawer","$isInlineBlockNode","InlineBlockComponentContext","initialState","useInlineBlockComponentContext","use","InlineBlockComponent","props","cacheBuster","className","baseClass","formData","nodeKey","editor","isEditable","i18n","t","createdInlineBlock","fieldProps","featureClientSchemaMap","initialLexicalFormState","schemaPath","setCreatedInlineBlock","uuidFromContext","fields","parentDocumentFields","getFormState","editDepth","firstTimeDrawer","setInitialState","useState","cachedFormState","id","formState","Object","fromEntries","entries","map","fieldName","fieldState","initialValue","value","hasMounted","prevCacheBuster","current","CustomLabel","setCustomLabel","customComponents","BlockLabel","CustomBlock","setCustomBlock","Block","drawerSlug","slug","depth","toggleDrawer","inlineBlockElemElemRef","collectionSlug","getDocPreferences","globalSlug","config","componentMapRenderedBlockPath","blockType","clientSchemaMap","blocksField","clientBlock","blockReferences","blocksMap","blocks","clientBlockFields","getKey","length","undefined","removeInlineBlock","update","remove","blockDisplayName","labels","singular","onChangeAbortControllerRef","AbortController","schemaFieldsPath","abortController","awaitInitialState","state","data","docPermissions","docPreferences","documentFormState","initialBlockData","initialBlockFormState","operation","readOnly","renderAllFields","signal","newFormStateData","node","newData","setFields","onChange","prevFormState","submit","controller","isStateOutOfSync","keys","some","key","onFormSubmit","RemoveButton","buttonStyle","disabled","icon","onClick","e","preventDefault","round","size","tooltip","label","EditButton","el","InlineBlockContainer","children","div","filter","Boolean","join","ref","Label","span","beforeSubmit","disableValidationOnSubmit","onSubmit","title","forceRender","parentIndexPath","parentPath","parentSchemaPath","permissions","programmaticSubmit","height","width"],"mappings":"AAAA;;AAIA,SAASA,yBAAyB,QAAQ,wCAAuC;AACjF,SAASC,kBAAkB,QAAQ,oCAAmC;AACtE,SAASC,cAAc,QAAQ,2BAA0B;AACzD,SACEC,MAAM,EACNC,MAAM,EACNC,iBAAiB,EACjBC,IAAI,EACJC,gBAAgB,EAChBC,UAAU,EACVC,YAAY,EAC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;;;;;;;;;+BAED;;;;;;;;;;;;;AAKd,EAAC"}
1
+ {"version":3,"sources":["../../../../../src/features/blocks/client/componentInline/index.tsx"],"sourcesContent":["'use client'\n\nimport type { BlocksFieldClient, ClientBlock, Data, FormState } from 'payload'\n\nimport { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext'\nimport { useLexicalEditable } from '@lexical/react/useLexicalEditable'\nimport { getTranslation } from '@payloadcms/translations'\nimport {\n Button,\n Drawer,\n EditDepthProvider,\n Form,\n formatDrawerSlug,\n FormSubmit,\n RenderFields,\n ShimmerEffect,\n useConfig,\n useDocumentForm,\n useDocumentInfo,\n useEditDepth,\n useServerFunctions,\n useTranslation,\n} from '@payloadcms/ui'\nimport { abortAndIgnore } from '@payloadcms/ui/shared'\nimport { $getNodeByKey } from 'lexical'\n\nimport './index.scss'\n\nimport { deepCopyObjectSimpleWithoutReactComponents, reduceFieldsToValues } from 'payload/shared'\nimport React, { createContext, useCallback, useEffect, useMemo, useRef } from 'react'\nimport { v4 as uuid } from 'uuid'\n\nimport type { InlineBlockFields } from '../../server/nodes/InlineBlocksNode.js'\n\nimport { useEditorConfigContext } from '../../../../lexical/config/client/EditorConfigProvider.js'\nimport { useLexicalDrawer } from '../../../../utilities/fieldsDrawer/useLexicalDrawer.js'\nimport { $isInlineBlockNode } from '../nodes/InlineBlocksNode.js'\n\ntype Props = {\n /**\n * Can be modified by the node in order to trigger the re-fetch of the initial state based on the\n * formData. This is useful when node.setFields() is explicitly called from outside of the form - in\n * this case, the new field state is likely not reflected in the form state, so we need to re-fetch\n */\n readonly cacheBuster: number\n readonly className: string\n readonly formData: InlineBlockFields\n readonly nodeKey: string\n}\n\ntype InlineBlockComponentContextType = {\n EditButton?: React.FC\n initialState: false | FormState | undefined\n InlineBlockContainer?: React.FC<{ children: React.ReactNode }>\n Label?: React.FC\n nodeKey?: string\n RemoveButton?: React.FC\n}\n\nconst InlineBlockComponentContext = createContext<InlineBlockComponentContextType>({\n initialState: false,\n})\n\nexport const useInlineBlockComponentContext = () => React.use(InlineBlockComponentContext)\n\nexport const InlineBlockComponent: React.FC<Props> = (props) => {\n const { cacheBuster, className: baseClass, formData, nodeKey } = props\n\n const [editor] = useLexicalComposerContext()\n const isEditable = useLexicalEditable()\n const { i18n, t } = useTranslation<object, string>()\n const {\n createdInlineBlock,\n fieldProps: { featureClientSchemaMap, initialLexicalFormState, schemaPath },\n setCreatedInlineBlock,\n uuid: uuidFromContext,\n } = useEditorConfigContext()\n const { fields: parentDocumentFields } = useDocumentForm()\n\n const { getFormState } = useServerFunctions()\n const editDepth = useEditDepth()\n const firstTimeDrawer = useRef(false)\n\n const [initialState, setInitialState] = React.useState<false | FormState | undefined>(() => {\n // Initial form state that was calculated server-side. May have stale values\n const cachedFormState = initialLexicalFormState?.[formData.id]?.formState\n if (!cachedFormState) {\n return false\n }\n\n // Merge current formData values into the cached form state\n // This ensures that when the component remounts (e.g., due to view changes), we don't lose user edits\n return Object.fromEntries(\n Object.entries(cachedFormState).map(([fieldName, fieldState]) => [\n fieldName,\n fieldName in formData\n ? {\n ...fieldState,\n initialValue: formData[fieldName],\n value: formData[fieldName],\n }\n : fieldState,\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 [CustomLabel, setCustomLabel] = React.useState<React.ReactNode | undefined>(\n // @ts-expect-error - vestiges of when tsconfig was not strict. Feel free to improve\n initialState?.['_components']?.customComponents?.BlockLabel,\n )\n\n const [CustomBlock, setCustomBlock] = React.useState<React.ReactNode | undefined>(\n // @ts-expect-error - vestiges of when tsconfig was not strict. Feel free to improve\n initialState?.['_components']?.customComponents?.Block,\n )\n\n const drawerSlug = formatDrawerSlug({\n slug: `lexical-inlineBlocks-create-${uuidFromContext}-${formData.id}`,\n depth: editDepth,\n })\n const { toggleDrawer } = useLexicalDrawer(drawerSlug, true)\n\n const inlineBlockElemElemRef = useRef<HTMLDivElement | null>(null)\n const { id, collectionSlug, getDocPreferences, globalSlug } = useDocumentInfo()\n const { config } = useConfig()\n\n const componentMapRenderedBlockPath = `${schemaPath}.lexical_internal_feature.blocks.lexical_inline_blocks.${formData.blockType}`\n\n const clientSchemaMap = featureClientSchemaMap['blocks']\n\n const blocksField: BlocksFieldClient = clientSchemaMap?.[\n componentMapRenderedBlockPath\n ]?.[0] as BlocksFieldClient\n\n const clientBlock: ClientBlock | undefined = blocksField.blockReferences\n ? typeof blocksField?.blockReferences?.[0] === 'string'\n ? config.blocksMap[blocksField?.blockReferences?.[0]]\n : blocksField?.blockReferences?.[0]\n : blocksField?.blocks?.[0]\n\n const clientBlockFields = clientBlock?.fields ?? []\n\n // Open drawer on \"mount\"\n useEffect(() => {\n if (!firstTimeDrawer.current && createdInlineBlock?.getKey() === nodeKey) {\n // > 2 because they always have \"id\" and \"blockName\" fields\n if (clientBlockFields.length > 2) {\n toggleDrawer()\n }\n setCreatedInlineBlock?.(undefined)\n firstTimeDrawer.current = true\n }\n }, [clientBlockFields.length, createdInlineBlock, nodeKey, setCreatedInlineBlock, toggleDrawer])\n\n const removeInlineBlock = useCallback(() => {\n editor.update(() => {\n $getNodeByKey(nodeKey)?.remove()\n })\n }, [editor, nodeKey])\n\n const blockDisplayName = clientBlock?.labels?.singular\n ? getTranslation(clientBlock?.labels.singular, i18n)\n : clientBlock?.slug\n\n const onChangeAbortControllerRef = useRef(new AbortController())\n const schemaFieldsPath = `${schemaPath}.lexical_internal_feature.blocks.lexical_inline_blocks.${clientBlock?.slug}.fields`\n\n // Initial state for newly created blocks\n useEffect(() => {\n const abortController = new AbortController()\n\n const awaitInitialState = async () => {\n /*\n * This will only run if a new block is created. For all existing blocks that are loaded when the document is loaded, or when the form is saved,\n * this is not run, as the lexical field RSC will fetch the state server-side and pass it to the client. That way, we avoid unnecessary client-side\n * requests. Though for newly created blocks, we need to fetch the state client-side, as the server doesn't know about the block yet.\n */\n const { state } = await getFormState({\n id,\n collectionSlug,\n data: formData,\n docPermissions: { fields: true },\n docPreferences: await getDocPreferences(),\n documentFormState: deepCopyObjectSimpleWithoutReactComponents(parentDocumentFields),\n globalSlug,\n initialBlockData: formData,\n initialBlockFormState: formData,\n operation: 'update',\n readOnly: !isEditable,\n renderAllFields: true,\n schemaPath: schemaFieldsPath,\n signal: abortController.signal,\n })\n\n if (state) {\n const newFormStateData: InlineBlockFields = reduceFieldsToValues(\n deepCopyObjectSimpleWithoutReactComponents(state),\n true,\n ) as InlineBlockFields\n\n // Things like default values may come back from the server => update the node with the new data\n editor.update(() => {\n const node = $getNodeByKey(nodeKey)\n if (node && $isInlineBlockNode(node)) {\n const newData = newFormStateData\n newData.blockType = formData.blockType\n\n node.setFields(newData, true)\n }\n })\n\n setInitialState(state)\n setCustomLabel(state['_components']?.customComponents?.BlockLabel)\n setCustomBlock(state['_components']?.customComponents?.Block)\n }\n }\n\n if (formData && !initialState) {\n void awaitInitialState()\n }\n\n return () => {\n abortAndIgnore(abortController)\n }\n }, [\n getFormState,\n editor,\n nodeKey,\n isEditable,\n schemaFieldsPath,\n id,\n formData,\n initialState,\n collectionSlug,\n globalSlug,\n getDocPreferences,\n parentDocumentFields,\n ])\n\n /**\n * HANDLE ONCHANGE\n */\n const onChange = useCallback(\n async ({ formState: prevFormState, submit }: { formState: FormState; submit?: boolean }) => {\n abortAndIgnore(onChangeAbortControllerRef.current)\n\n const controller = new AbortController()\n onChangeAbortControllerRef.current = controller\n\n const { state } = await getFormState({\n id,\n collectionSlug,\n docPermissions: {\n fields: true,\n },\n docPreferences: await getDocPreferences(),\n documentFormState: deepCopyObjectSimpleWithoutReactComponents(parentDocumentFields),\n formState: prevFormState,\n globalSlug,\n initialBlockFormState: prevFormState,\n operation: 'update',\n readOnly: !isEditable,\n renderAllFields: submit ? true : false,\n schemaPath: schemaFieldsPath,\n signal: controller.signal,\n })\n\n if (!state) {\n return prevFormState\n }\n\n if (submit) {\n setCustomLabel(state['_components']?.customComponents?.BlockLabel)\n setCustomBlock(state['_components']?.customComponents?.Block)\n }\n\n return state\n },\n [\n getFormState,\n id,\n collectionSlug,\n getDocPreferences,\n parentDocumentFields,\n globalSlug,\n isEditable,\n schemaFieldsPath,\n ],\n )\n // cleanup effect\n useEffect(() => {\n const isStateOutOfSync = (formData: InlineBlockFields, initialState: FormState) => {\n return Object.keys(initialState).some(\n (key) => initialState[key] && formData[key] !== initialState[key].value,\n )\n }\n\n return () => {\n // If the component is unmounted (either via removeInlineBlock or via lexical itself) and the form state got changed before,\n // we need to reset the initial state to force a re-fetch of the initial state when it gets mounted again (e.g. via lexical history undo).\n // Otherwise it would use an outdated initial state.\n if (initialState && isStateOutOfSync(formData, initialState)) {\n setInitialState(false)\n }\n abortAndIgnore(onChangeAbortControllerRef.current)\n }\n }, [formData, initialState])\n\n /**\n * HANDLE FORM SUBMIT\n */\n const onFormSubmit = useCallback(\n (formState: FormState, newData: Data) => {\n newData.blockType = formData.blockType\n\n editor.update(() => {\n const node = $getNodeByKey(nodeKey)\n if (node && $isInlineBlockNode(node)) {\n node.setFields(newData as InlineBlockFields, true)\n }\n })\n },\n [editor, nodeKey, formData],\n )\n\n const RemoveButton = useMemo(\n () => () => (\n <Button\n buttonStyle=\"icon-label\"\n className={`${baseClass}__removeButton`}\n disabled={!isEditable}\n icon=\"x\"\n onClick={(e) => {\n e.preventDefault()\n removeInlineBlock()\n }}\n round\n size=\"small\"\n tooltip={t('lexical:blocks:inlineBlocks:remove', { label: blockDisplayName })}\n />\n ),\n [baseClass, blockDisplayName, isEditable, removeInlineBlock, t],\n )\n\n const EditButton = useMemo(\n () => () => (\n <Button\n buttonStyle=\"icon-label\"\n className={`${baseClass}__editButton`}\n disabled={!isEditable}\n el=\"button\"\n icon=\"edit\"\n onClick={() => {\n toggleDrawer()\n }}\n round\n size=\"small\"\n tooltip={t('lexical:blocks:inlineBlocks:edit', { label: blockDisplayName })}\n />\n ),\n [baseClass, blockDisplayName, isEditable, t, toggleDrawer],\n )\n\n const InlineBlockContainer = useMemo(\n () =>\n ({ children, className }: { children: React.ReactNode; className?: string }) => (\n <div\n className={[`${baseClass}__container`, baseClass + '-' + formData.blockType, className]\n .filter(Boolean)\n .join(' ')}\n ref={inlineBlockElemElemRef}\n >\n {children}\n </div>\n ),\n [baseClass, formData.blockType],\n )\n\n const Label = useMemo(() => {\n if (CustomLabel) {\n return () => CustomLabel\n } else {\n return () => (\n <div>{clientBlock?.labels ? getTranslation(clientBlock?.labels.singular, i18n) : ''}</div>\n )\n }\n }, [CustomLabel, clientBlock?.labels, i18n])\n\n if (!clientBlock) {\n return (\n <InlineBlockContainer className={`${baseClass}-not-found`}>\n <span>Error: Block '{formData.blockType}' not found</span>\n {isEditable ? (\n <div className={`${baseClass}__actions`}>\n <RemoveButton />\n </div>\n ) : null}\n </InlineBlockContainer>\n )\n }\n\n return (\n <Form\n beforeSubmit={[\n async ({ formState }) => {\n // This is only called when form is submitted from drawer\n return await onChange({ formState, submit: true })\n },\n ]}\n disableValidationOnSubmit\n el=\"div\"\n fields={clientBlock?.fields}\n initialState={initialState || {}}\n onChange={[onChange]}\n onSubmit={(formState, data) => {\n onFormSubmit(formState, data)\n toggleDrawer()\n }}\n uuid={uuid()}\n >\n <EditDepthProvider>\n <Drawer\n className={''}\n slug={drawerSlug}\n title={t(`lexical:blocks:inlineBlocks:${formData?.id ? 'edit' : 'create'}`, {\n label: blockDisplayName ?? t('lexical:blocks:inlineBlocks:label'),\n })}\n >\n {initialState ? (\n <>\n <RenderFields\n fields={clientBlock?.fields}\n forceRender\n parentIndexPath=\"\"\n parentPath=\"\" // See Blocks feature path for details as for why this is empty\n parentSchemaPath={schemaFieldsPath}\n permissions={true}\n readOnly={!isEditable}\n />\n <FormSubmit programmaticSubmit={true}>{t('fields:saveChanges')}</FormSubmit>\n </>\n ) : null}\n </Drawer>\n </EditDepthProvider>\n {CustomBlock ? (\n <InlineBlockComponentContext\n value={{\n EditButton,\n initialState,\n InlineBlockContainer,\n Label,\n nodeKey,\n RemoveButton,\n }}\n >\n {CustomBlock}\n </InlineBlockComponentContext>\n ) : (\n <InlineBlockContainer>\n {initialState ? <Label /> : <ShimmerEffect height=\"15px\" width=\"40px\" />}\n {isEditable ? (\n <div className={`${baseClass}__actions`}>\n <EditButton />\n <RemoveButton />\n </div>\n ) : null}\n </InlineBlockContainer>\n )}\n </Form>\n )\n}\n"],"names":["useLexicalComposerContext","useLexicalEditable","getTranslation","Button","Drawer","EditDepthProvider","Form","formatDrawerSlug","FormSubmit","RenderFields","ShimmerEffect","useConfig","useDocumentForm","useDocumentInfo","useEditDepth","useServerFunctions","useTranslation","abortAndIgnore","$getNodeByKey","deepCopyObjectSimpleWithoutReactComponents","reduceFieldsToValues","React","createContext","useCallback","useEffect","useMemo","useRef","v4","uuid","useEditorConfigContext","useLexicalDrawer","$isInlineBlockNode","InlineBlockComponentContext","initialState","useInlineBlockComponentContext","use","InlineBlockComponent","props","cacheBuster","className","baseClass","formData","nodeKey","editor","isEditable","i18n","t","createdInlineBlock","fieldProps","featureClientSchemaMap","initialLexicalFormState","schemaPath","setCreatedInlineBlock","uuidFromContext","fields","parentDocumentFields","getFormState","editDepth","firstTimeDrawer","setInitialState","useState","cachedFormState","id","formState","Object","fromEntries","entries","map","fieldName","fieldState","initialValue","value","hasMounted","prevCacheBuster","current","CustomLabel","setCustomLabel","customComponents","BlockLabel","CustomBlock","setCustomBlock","Block","drawerSlug","slug","depth","toggleDrawer","inlineBlockElemElemRef","collectionSlug","getDocPreferences","globalSlug","config","componentMapRenderedBlockPath","blockType","clientSchemaMap","blocksField","clientBlock","blockReferences","blocksMap","blocks","clientBlockFields","getKey","length","undefined","removeInlineBlock","update","remove","blockDisplayName","labels","singular","onChangeAbortControllerRef","AbortController","schemaFieldsPath","abortController","awaitInitialState","state","data","docPermissions","docPreferences","documentFormState","initialBlockData","initialBlockFormState","operation","readOnly","renderAllFields","signal","newFormStateData","node","newData","setFields","onChange","prevFormState","submit","controller","isStateOutOfSync","keys","some","key","onFormSubmit","RemoveButton","buttonStyle","disabled","icon","onClick","e","preventDefault","round","size","tooltip","label","EditButton","el","InlineBlockContainer","children","div","filter","Boolean","join","ref","Label","span","beforeSubmit","disableValidationOnSubmit","onSubmit","title","forceRender","parentIndexPath","parentPath","parentSchemaPath","permissions","programmaticSubmit","height","width"],"mappings":"AAAA;;AAIA,SAASA,yBAAyB,QAAQ,wCAAuC;AACjF,SAASC,kBAAkB,QAAQ,oCAAmC;AACtE,SAASC,cAAc,QAAQ,2BAA0B;AACzD,SACEC,MAAM,EACNC,MAAM,EACNC,iBAAiB,EACjBC,IAAI,EACJC,gBAAgB,EAChBC,UAAU,EACVC,YAAY,EACZC,aAAa,EACbC,SAAS,EACTC,eAAe,EACfC,eAAe,EACfC,YAAY,EACZC,kBAAkB,EAClBC,cAAc,QACT,iBAAgB;AACvB,SAASC,cAAc,QAAQ,wBAAuB;AACtD,SAASC,aAAa,QAAQ,UAAS;AAEvC,OAAO,eAAc;AAErB,SAASC,0CAA0C,EAAEC,oBAAoB,QAAQ,iBAAgB;AACjG,OAAOC,SAASC,aAAa,EAAEC,WAAW,EAAEC,SAAS,EAAEC,OAAO,EAAEC,MAAM,QAAQ,QAAO;AACrF,SAASC,MAAMC,IAAI,QAAQ,OAAM;AAIjC,SAASC,sBAAsB,QAAQ,4DAA2D;AAClG,SAASC,gBAAgB,QAAQ,yDAAwD;AACzF,SAASC,kBAAkB,QAAQ,+BAA8B;AAG/D;;;;GAIC,GAgBH,MAAMC,4CAA8BV,cAA+C;IACjFW,cAAc;AAChB;AAEA,OAAO,MAAMC,iCAAiC,IAAMb,MAAMc,GAAG,CAACH,6BAA4B;AAE1F,OAAO,MAAMI,uBAAwC,CAACC;IACpD,MAAM,EAAEC,WAAW,EAAEC,WAAWC,SAAS,EAAEC,QAAQ,EAAEC,OAAO,EAAE,GAAGL;IAEjE,MAAM,CAACM,OA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gCACXC,iBAAgB;gCAChBC,YAAc,+DAA+D;gCAAlE;gCACXC,kBAAkBxD;gCAClByD,aAAa;gCACb9C,UAAU,CAAC9E;;;;;;0CAEb,QAACpC;gCAAWiK,oBAAoB;0CAAO3H,EAAE;;;;;;;uCAEzC;;;;;;;;;;;YAGPiC,4BACC,QAAC/C;gBACCuC,OAAO;oBACL8E;oBACApH;oBACAsH;oBACAO;oBACApH;oBACAgG;gBACF;0BAEC3D;;;;;qCAGH,QAACwE;;oBACEtH,6BAAe,QAAC6H;;;;6CAAW,QAACpJ;wBAAcgK,QAAO;wBAAOC,OAAM;;;;;;oBAC9D/H,2BACC,QAAC6G;wBAAIlH,WAAW,GAAGC,UAAU,SAAS,CAAC;;0CACrC,QAAC6G;;;;;0CACD,QAACX;;;;;;;;;;+BAED;;;;;;;;;;;;;AAKd,EAAC"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../src/features/blocks/server/nodes/BlocksNode.tsx"],"sourcesContent":["import type { SerializedDecoratorBlockNode } from '@lexical/react/LexicalDecoratorBlockNode.js'\nimport type { JsonObject } from 'payload'\nimport type { JSX } from 'react'\n\nimport { DecoratorBlockNode } from '@lexical/react/LexicalDecoratorBlockNode.js'\nimport { addClassNamesToElement } from '@lexical/utils'\nimport ObjectID from 'bson-objectid'\nimport {\n $applyNodeReplacement,\n type DOMConversionMap,\n type DOMExportOutput,\n type EditorConfig,\n type ElementFormatType,\n type LexicalEditor,\n type LexicalNode,\n type NodeKey,\n} from 'lexical'\n\nimport type { StronglyTypedLeafNode } from '../../../../nodeTypes.js'\n\ntype BaseBlockFields<TBlockFields extends JsonObject = JsonObject> = {\n /** Block form data */\n blockName: string\n blockType: string\n} & TBlockFields\n\nexport type BlockFields<TBlockFields extends JsonObject = JsonObject> = {\n id: string\n} & BaseBlockFields<TBlockFields>\n\nexport type BlockFieldsOptionalID<TBlockFields extends JsonObject = JsonObject> = {\n id?: string\n} & BaseBlockFields<TBlockFields>\n\nexport type SerializedBlockNode<TBlockFields extends JsonObject = JsonObject> = {\n fields: BlockFields<TBlockFields>\n} & StronglyTypedLeafNode<SerializedDecoratorBlockNode, 'block'>\n\nexport class ServerBlockNode extends DecoratorBlockNode {\n __cacheBuster: number\n __fields: BlockFields\n\n constructor({\n cacheBuster,\n fields,\n format,\n key,\n }: {\n cacheBuster?: number\n fields: BlockFields\n format?: ElementFormatType\n key?: NodeKey\n }) {\n super(format, key)\n this.__fields = fields\n this.__cacheBuster = cacheBuster || 0\n }\n\n static override clone(node: ServerBlockNode): ServerBlockNode {\n return new this({\n cacheBuster: node.__cacheBuster,\n fields: node.__fields,\n format: node.__format,\n key: node.__key,\n })\n }\n\n static override getType(): string {\n return 'block'\n }\n\n static override importDOM(): DOMConversionMap<HTMLDivElement> | null {\n return {}\n }\n\n static override importJSON(serializedNode: SerializedBlockNode): ServerBlockNode {\n if (serializedNode.version === 1) {\n // Convert (version 1 had the fields wrapped in another, unnecessary data property)\n serializedNode = {\n ...serializedNode,\n fields: {\n ...(serializedNode as any).fields.data,\n },\n version: 2,\n }\n }\n const node = $createServerBlockNode(serializedNode.fields)\n node.setFormat(serializedNode.format)\n return node\n }\n\n static isInline(): false {\n return false\n }\n\n override createDOM(config?: EditorConfig): HTMLElement {\n const element = document.createElement('div')\n addClassNamesToElement(element, config?.theme?.block)\n return element\n }\n\n override decorate(editor: LexicalEditor, config: EditorConfig): JSX.Element {\n return null as unknown as JSX.Element\n }\n\n override exportDOM(): DOMExportOutput {\n const element = document.createElement('div')\n\n const text = document.createTextNode(this.getTextContent())\n element.append(text)\n return { element }\n }\n\n override exportJSON(): SerializedBlockNode {\n return {\n ...super.exportJSON(),\n type: 'block',\n fields: this.getFields(),\n version: 2,\n }\n }\n\n getCacheBuster(): number {\n return this.getLatest().__cacheBuster\n }\n\n getFields(): BlockFields {\n return this.getLatest().__fields\n }\n\n override getTextContent(): string {\n return `Block Field`\n }\n\n setFields(fields: BlockFields, preventFormStateUpdate?: boolean): void {\n const writable = this.getWritable()\n writable.__fields = fields\n if (!preventFormStateUpdate) {\n writable.__cacheBuster++\n }\n }\n}\n\nexport function $createServerBlockNode(fields: BlockFieldsOptionalID): ServerBlockNode {\n return $applyNodeReplacement(\n new ServerBlockNode({\n fields: {\n ...fields,\n id: fields?.id || new ObjectID.default().toHexString(),\n },\n }),\n )\n}\n\nexport function $isServerBlockNode(\n node: LexicalNode | null | ServerBlockNode | undefined,\n): node is ServerBlockNode {\n return node instanceof ServerBlockNode\n}\n"],"names":["DecoratorBlockNode","addClassNamesToElement","ObjectID","$applyNodeReplacement","ServerBlockNode","__cacheBuster","__fields","constructor","cacheBuster","fields","format","key","clone","node","__format","__key","getType","importDOM","importJSON","serializedNode","version","data","$createServerBlockNode","setFormat","isInline","createDOM","config","element","document","createElement","theme","block","decorate","editor","exportDOM","text","createTextNode","getTextContent","append","exportJSON","type","getFields","getCacheBuster","getLatest","setFields","preventFormStateUpdate","writable","getWritable","id","default","toHexString","$isServerBlockNode"],"mappings":"AAIA,SAASA,kBAAkB,QAAQ,8CAA6C;AAChF,SAASC,sBAAsB,QAAQ,iBAAgB;AACvD,OAAOC,cAAc,gBAAe;AACpC,SACEC,qBAAqB,QAQhB,UAAS;AAKd,oBAAoB,GAiBtB,OAAO,MAAMC,wBAAwBJ;IACnCK,cAAqB;IACrBC,SAAqB;IAErBC,YAAY,EACVC,WAAW,EACXC,MAAM,EACNC,MAAM,EACNC,GAAG,EAMJ,CAAE;QACD,KAAK,CAACD,QAAQC;QACd,IAAI,CAACL,QAAQ,GAAGG;QAChB,IAAI,CAACJ,aAAa,GAAGG,eAAe;IACtC;IAEA,OAAgBI,MAAMC,IAAqB,EAAmB;QAC5D,OAAO,IAAI,IAAI,CAAC;YACdL,aAAaK,KAAKR,aAAa;YAC/BI,QAAQI,KAAKP,QAAQ;YACrBI,QAAQG,KAAKC,QAAQ;YACrBH,KAAKE,KAAKE,KAAK;QACjB;IACF;IAEA,OAAgBC,UAAkB;QAChC,OAAO;IACT;IAEA,OAAgB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,OAAO,SAASiB,uBAAuBb,MAA6B;IAClE,OAAON,sBACL,IAAIC,gBAAgB;QAClBK,QAAQ;YACN,GAAGA,MAAM;YACTuC,IAAIvC,QAAQuC,MAAM,IAAI9C,SAAS+C,OAAO,GAAGC,WAAW;QACtD;IACF;AAEJ;AAEA,OAAO,SAASC,mBACdtC,IAAsD;IAEtD,OAAOA,gBAAgBT;AACzB"}
1
+ {"version":3,"sources":["../../../../../src/features/blocks/server/nodes/BlocksNode.tsx"],"sourcesContent":["import type { SerializedDecoratorBlockNode } from '@lexical/react/LexicalDecoratorBlockNode.js'\nimport type { JsonObject } from 'payload'\nimport type { JSX } from 'react'\n\nimport { DecoratorBlockNode } from '@lexical/react/LexicalDecoratorBlockNode.js'\nimport { addClassNamesToElement } from '@lexical/utils'\nimport ObjectID from 'bson-objectid'\nimport {\n $applyNodeReplacement,\n type DOMConversionMap,\n type DOMExportOutput,\n type EditorConfig,\n type ElementFormatType,\n type LexicalEditor,\n type LexicalNode,\n type NodeKey,\n} from 'lexical'\n\nimport type { StronglyTypedLeafNode } from '../../../../nodeTypes.js'\n\ntype BaseBlockFields<TBlockFields extends JsonObject = JsonObject> = {\n /** Block form data */\n blockName: string\n blockType: string\n} & TBlockFields\n\nexport type BlockFields<TBlockFields extends JsonObject = JsonObject> = {\n id: string\n} & BaseBlockFields<TBlockFields>\n\nexport type BlockFieldsOptionalID<TBlockFields extends JsonObject = JsonObject> = {\n id?: string\n} & BaseBlockFields<TBlockFields>\n\nexport type SerializedBlockNode<TBlockFields extends JsonObject = JsonObject> = {\n fields: BlockFields<TBlockFields>\n} & StronglyTypedLeafNode<SerializedDecoratorBlockNode, 'block'>\n\nexport class ServerBlockNode extends DecoratorBlockNode {\n __cacheBuster: number\n __fields: BlockFields\n\n constructor({\n cacheBuster,\n fields,\n format,\n key,\n }: {\n cacheBuster?: number\n fields: BlockFields\n format?: ElementFormatType\n key?: NodeKey\n }) {\n super(format, key)\n this.__fields = fields\n this.__cacheBuster = cacheBuster || 0\n }\n\n static override clone(node: ServerBlockNode): ServerBlockNode {\n return new this({\n cacheBuster: node.__cacheBuster,\n fields: node.__fields,\n format: node.__format,\n key: node.__key,\n })\n }\n\n static override getType(): string {\n return 'block'\n }\n\n static override importDOM(): DOMConversionMap<HTMLDivElement> | null {\n return {}\n }\n\n static override importJSON(serializedNode: SerializedBlockNode): ServerBlockNode {\n if (serializedNode.version === 1) {\n // Convert (version 1 had the fields wrapped in another, unnecessary data property)\n serializedNode = {\n ...serializedNode,\n fields: {\n ...(serializedNode as any).fields.data,\n },\n version: 2,\n }\n }\n const node = $createServerBlockNode(serializedNode.fields)\n node.setFormat(serializedNode.format)\n return node\n }\n\n static isInline(): false {\n return false\n }\n\n override createDOM(config?: EditorConfig): HTMLElement {\n const element = document.createElement('div')\n addClassNamesToElement(element, config?.theme?.block)\n return element\n }\n\n override decorate(editor: LexicalEditor, config: EditorConfig): JSX.Element {\n return null as unknown as JSX.Element\n }\n\n override exportDOM(): DOMExportOutput {\n const element = document.createElement('div')\n\n const text = document.createTextNode(this.getTextContent())\n element.append(text)\n return { element }\n }\n\n override exportJSON(): SerializedBlockNode {\n return {\n ...super.exportJSON(),\n type: 'block',\n fields: this.getFields(),\n version: 2,\n }\n }\n\n getCacheBuster(): number {\n return this.getLatest().__cacheBuster\n }\n\n getFields(): BlockFields {\n return this.getLatest().__fields\n }\n\n override getTextContent(): string {\n return `Block Field`\n }\n\n setFields(fields: BlockFields, preventFormStateUpdate?: boolean): void {\n const writable = this.getWritable()\n writable.__fields = fields\n if (!preventFormStateUpdate) {\n writable.__cacheBuster++\n }\n }\n}\n\nexport function $createServerBlockNode(fields: BlockFieldsOptionalID): ServerBlockNode {\n return $applyNodeReplacement(\n new ServerBlockNode({\n fields: {\n ...fields,\n id: fields?.id || new ObjectID.default().toHexString(),\n },\n }),\n )\n}\n\nexport function $isServerBlockNode(\n node: LexicalNode | null | ServerBlockNode | undefined,\n): node is ServerBlockNode {\n return node instanceof ServerBlockNode\n}\n"],"names":["DecoratorBlockNode","addClassNamesToElement","ObjectID","$applyNodeReplacement","ServerBlockNode","__cacheBuster","__fields","cacheBuster","fields","format","key","clone","node","__format","__key","getType","importDOM","importJSON","serializedNode","version","data","$createServerBlockNode","setFormat","isInline","createDOM","config","element","document","createElement","theme","block","decorate","editor","exportDOM","text","createTextNode","getTextContent","append","exportJSON","type","getFields","getCacheBuster","getLatest","setFields","preventFormStateUpdate","writable","getWritable","id","default","toHexString","$isServerBlockNode"],"mappings":"AAIA,SAASA,kBAAkB,QAAQ,8CAA6C;AAChF,SAASC,sBAAsB,QAAQ,iBAAgB;AACvD,OAAOC,cAAc,gBAAe;AACpC,SACEC,qBAAqB,QAQhB,UAAS;AAKd,oBAAoB,GAiBtB,OAAO,MAAMC,wBAAwBJ;IACnCK,cAAqB;IACrBC,SAAqB;IAErB,YAAY,EACVC,WAAW,EACXC,MAAM,EACNC,MAAM,EACNC,GAAG,EAMJ,CAAE;QACD,KAAK,CAACD,QAAQC;QACd,IAAI,CAACJ,QAAQ,GAAGE;QAChB,IAAI,CAACH,aAAa,GAAGE,eAAe;IACtC;IAEA,OAAgBI,MAAMC,IAAqB,EAAmB;QAC5D,OAAO,IAAI,IAAI,CAAC;YACdL,aAAaK,KAAKP,aAAa;YAC/BG,QAAQI,KAAKN,QAAQ;YACrBG,QAAQG,KAAKC,QAAQ;YACrBH,KAAKE,KAAKE,KAAK;QACjB;IACF;IAEA,OAAgBC,UAAkB;QAChC,OAAO;IACT;IAEA,OAAgBC,YAAqD;QACnE,OAAO,CAAC;IACV;IAEA,OAAgBC,WAAWC,cAAmC,EAAmB;QAC/E,IAAIA,eAAeC,OAAO,KAAK,GAAG;YAChC,mFAAmF;YACnFD,iBAAiB;gBACf,GAAGA,cAAc;gBACjBV,QAAQ;oBACN,GAAG,AAACU,eAAuBV,MAAM,CAACY,IAAI;gBACxC;gBACAD,SAAS;YACX;QACF;QACA,MAAMP,OAAOS,uBAAuBH,eAAeV,MAAM;QACzDI,KAA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