@payloadcms/richtext-lexical 3.80.0-internal.60d6f94 → 3.80.0-internal.82dcece

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 (163) hide show
  1. package/dist/exports/client/Field-OIMYWB22.js +2 -0
  2. package/dist/exports/client/Field-OIMYWB22.js.map +7 -0
  3. package/dist/exports/client/bundled.css +1 -1
  4. package/dist/exports/client/chunk-2S5Q7QYO.js +2 -0
  5. package/dist/exports/client/chunk-2S5Q7QYO.js.map +7 -0
  6. package/dist/exports/client/chunk-EZX4YW7S.js +12 -0
  7. package/dist/exports/client/chunk-EZX4YW7S.js.map +7 -0
  8. package/dist/exports/client/componentInline-NL25DNZ5.js +2 -0
  9. package/dist/exports/client/index.d.ts +0 -1
  10. package/dist/exports/client/index.d.ts.map +1 -1
  11. package/dist/exports/client/index.js +23 -23
  12. package/dist/exports/client/index.js.map +3 -3
  13. package/dist/exports/react/index.d.ts +1 -3
  14. package/dist/exports/react/index.d.ts.map +1 -1
  15. package/dist/exports/react/index.js +0 -1
  16. package/dist/exports/react/index.js.map +1 -1
  17. package/dist/features/blocks/client/component/BlockContent.d.ts +4 -7
  18. package/dist/features/blocks/client/component/BlockContent.d.ts.map +1 -1
  19. package/dist/features/blocks/client/component/BlockContent.js +8 -9
  20. package/dist/features/blocks/client/component/BlockContent.js.map +1 -1
  21. package/dist/features/blocks/client/component/index.d.ts +4 -20
  22. package/dist/features/blocks/client/component/index.d.ts.map +1 -1
  23. package/dist/features/blocks/client/component/index.js +55 -112
  24. package/dist/features/blocks/client/component/index.js.map +1 -1
  25. package/dist/features/blocks/client/componentInline/index.d.ts +14 -8
  26. package/dist/features/blocks/client/componentInline/index.d.ts.map +1 -1
  27. package/dist/features/blocks/client/componentInline/index.js +18 -67
  28. package/dist/features/blocks/client/componentInline/index.js.map +1 -1
  29. package/dist/features/blocks/client/nodes/BlocksNode.d.ts +2 -4
  30. package/dist/features/blocks/client/nodes/BlocksNode.d.ts.map +1 -1
  31. package/dist/features/blocks/client/nodes/BlocksNode.js +1 -3
  32. package/dist/features/blocks/client/nodes/BlocksNode.js.map +1 -1
  33. package/dist/features/blocks/client/nodes/InlineBlocksNode.d.ts +2 -4
  34. package/dist/features/blocks/client/nodes/InlineBlocksNode.d.ts.map +1 -1
  35. package/dist/features/blocks/client/nodes/InlineBlocksNode.js +1 -3
  36. package/dist/features/blocks/client/nodes/InlineBlocksNode.js.map +1 -1
  37. package/dist/features/converters/lexicalToHtml/async/converters/heading.d.ts.map +1 -1
  38. package/dist/features/converters/lexicalToHtml/async/converters/heading.js +3 -1
  39. package/dist/features/converters/lexicalToHtml/async/converters/heading.js.map +1 -1
  40. package/dist/features/converters/lexicalToHtml/async/converters/link.d.ts.map +1 -1
  41. package/dist/features/converters/lexicalToHtml/async/converters/link.js +7 -2
  42. package/dist/features/converters/lexicalToHtml/async/converters/link.js.map +1 -1
  43. package/dist/features/converters/lexicalToHtml/async/converters/list.d.ts.map +1 -1
  44. package/dist/features/converters/lexicalToHtml/async/converters/list.js +5 -1
  45. package/dist/features/converters/lexicalToHtml/async/converters/list.js.map +1 -1
  46. package/dist/features/converters/lexicalToHtml/async/converters/table.d.ts.map +1 -1
  47. package/dist/features/converters/lexicalToHtml/async/converters/table.js +2 -1
  48. package/dist/features/converters/lexicalToHtml/async/converters/table.js.map +1 -1
  49. package/dist/features/converters/lexicalToHtml/async/converters/text.d.ts.map +1 -1
  50. package/dist/features/converters/lexicalToHtml/async/converters/text.js +2 -1
  51. package/dist/features/converters/lexicalToHtml/async/converters/text.js.map +1 -1
  52. package/dist/features/converters/lexicalToHtml/async/converters/upload.d.ts.map +1 -1
  53. package/dist/features/converters/lexicalToHtml/async/converters/upload.js +11 -10
  54. package/dist/features/converters/lexicalToHtml/async/converters/upload.js.map +1 -1
  55. package/dist/features/converters/lexicalToHtml/shared/cssColors.d.ts +5 -0
  56. package/dist/features/converters/lexicalToHtml/shared/cssColors.d.ts.map +1 -0
  57. package/dist/features/converters/lexicalToHtml/shared/cssColors.js +8 -0
  58. package/dist/features/converters/lexicalToHtml/shared/cssColors.js.map +1 -0
  59. package/dist/features/converters/lexicalToHtml/sync/converters/heading.d.ts.map +1 -1
  60. package/dist/features/converters/lexicalToHtml/sync/converters/heading.js +3 -1
  61. package/dist/features/converters/lexicalToHtml/sync/converters/heading.js.map +1 -1
  62. package/dist/features/converters/lexicalToHtml/sync/converters/link.d.ts.map +1 -1
  63. package/dist/features/converters/lexicalToHtml/sync/converters/link.js +7 -2
  64. package/dist/features/converters/lexicalToHtml/sync/converters/link.js.map +1 -1
  65. package/dist/features/converters/lexicalToHtml/sync/converters/list.d.ts.map +1 -1
  66. package/dist/features/converters/lexicalToHtml/sync/converters/list.js +5 -1
  67. package/dist/features/converters/lexicalToHtml/sync/converters/list.js.map +1 -1
  68. package/dist/features/converters/lexicalToHtml/sync/converters/table.d.ts.map +1 -1
  69. package/dist/features/converters/lexicalToHtml/sync/converters/table.js +2 -1
  70. package/dist/features/converters/lexicalToHtml/sync/converters/table.js.map +1 -1
  71. package/dist/features/converters/lexicalToHtml/sync/converters/text.d.ts.map +1 -1
  72. package/dist/features/converters/lexicalToHtml/sync/converters/text.js +2 -1
  73. package/dist/features/converters/lexicalToHtml/sync/converters/text.js.map +1 -1
  74. package/dist/features/converters/lexicalToHtml/sync/converters/upload.d.ts.map +1 -1
  75. package/dist/features/converters/lexicalToHtml/sync/converters/upload.js +11 -10
  76. package/dist/features/converters/lexicalToHtml/sync/converters/upload.js.map +1 -1
  77. package/dist/features/converters/lexicalToJSX/Component/index.d.ts +20 -6
  78. package/dist/features/converters/lexicalToJSX/Component/index.d.ts.map +1 -1
  79. package/dist/features/converters/lexicalToJSX/Component/index.js +5 -7
  80. package/dist/features/converters/lexicalToJSX/Component/index.js.map +1 -1
  81. package/dist/features/converters/lexicalToJSX/converter/index.d.ts +2 -17
  82. package/dist/features/converters/lexicalToJSX/converter/index.d.ts.map +1 -1
  83. package/dist/features/converters/lexicalToJSX/converter/index.js +4 -124
  84. package/dist/features/converters/lexicalToJSX/converter/index.js.map +1 -1
  85. package/dist/features/converters/lexicalToJSX/converter/types.d.ts +10 -14
  86. package/dist/features/converters/lexicalToJSX/converter/types.d.ts.map +1 -1
  87. package/dist/features/converters/lexicalToJSX/converter/types.js.map +1 -1
  88. package/dist/features/debug/jsxConverter/client/plugin/index.js +1 -1
  89. package/dist/features/debug/jsxConverter/client/plugin/index.js.map +1 -1
  90. package/dist/field/Diff/converters/link.d.ts.map +1 -1
  91. package/dist/field/Diff/converters/link.js +7 -2
  92. package/dist/field/Diff/converters/link.js.map +1 -1
  93. package/dist/field/Field.d.ts.map +1 -1
  94. package/dist/field/Field.js +19 -19
  95. package/dist/field/Field.js.map +1 -1
  96. package/dist/field/bundled.css +1 -1
  97. package/dist/field/index.d.ts +0 -1
  98. package/dist/field/index.d.ts.map +1 -1
  99. package/dist/field/index.js +35 -64
  100. package/dist/field/index.js.map +1 -1
  101. package/dist/field/rscEntry.d.ts +1 -1
  102. package/dist/field/rscEntry.d.ts.map +1 -1
  103. package/dist/field/rscEntry.js +0 -12
  104. package/dist/field/rscEntry.js.map +1 -1
  105. package/dist/index.d.ts +1 -1
  106. package/dist/index.d.ts.map +1 -1
  107. package/dist/index.js +1 -3
  108. package/dist/index.js.map +1 -1
  109. package/dist/lexical/LexicalEditor.d.ts +1 -1
  110. package/dist/lexical/LexicalEditor.d.ts.map +1 -1
  111. package/dist/lexical/LexicalEditor.js +9 -7
  112. package/dist/lexical/LexicalEditor.js.map +1 -1
  113. package/dist/lexical/LexicalProvider.d.ts +1 -0
  114. package/dist/lexical/LexicalProvider.d.ts.map +1 -1
  115. package/dist/lexical/LexicalProvider.js +6 -13
  116. package/dist/lexical/LexicalProvider.js.map +1 -1
  117. package/dist/lexical/config/client/sanitize.d.ts +1 -1
  118. package/dist/lexical/config/client/sanitize.d.ts.map +1 -1
  119. package/dist/lexical/config/client/sanitize.js +2 -3
  120. package/dist/lexical/config/client/sanitize.js.map +1 -1
  121. package/dist/lexical/config/types.d.ts +0 -4
  122. package/dist/lexical/config/types.d.ts.map +1 -1
  123. package/dist/lexical/config/types.js.map +1 -1
  124. package/dist/lexical/nodes/index.d.ts +2 -12
  125. package/dist/lexical/nodes/index.d.ts.map +1 -1
  126. package/dist/lexical/nodes/index.js +2 -213
  127. package/dist/lexical/nodes/index.js.map +1 -1
  128. package/dist/lexical/plugins/SlashMenu/index.d.ts.map +1 -1
  129. package/dist/lexical/plugins/SlashMenu/index.js +1 -14
  130. package/dist/lexical/plugins/SlashMenu/index.js.map +1 -1
  131. package/dist/types.d.ts +2 -329
  132. package/dist/types.d.ts.map +1 -1
  133. package/dist/types.js.map +1 -1
  134. package/dist/utilities/generateImportMap.d.ts.map +1 -1
  135. package/dist/utilities/generateImportMap.js +0 -1
  136. package/dist/utilities/generateImportMap.js.map +1 -1
  137. package/dist/validate/hasText.d.ts +1 -6
  138. package/dist/validate/hasText.d.ts.map +1 -1
  139. package/dist/validate/hasText.js +4 -10
  140. package/dist/validate/hasText.js.map +1 -1
  141. package/package.json +6 -11
  142. package/dist/exports/client/Field-ESDONIMD.js +0 -2
  143. package/dist/exports/client/Field-ESDONIMD.js.map +0 -7
  144. package/dist/exports/client/chunk-VCJQ5B3S.js +0 -12
  145. package/dist/exports/client/chunk-VCJQ5B3S.js.map +0 -7
  146. package/dist/exports/client/chunk-YWIZCGSY.js +0 -2
  147. package/dist/exports/client/chunk-YWIZCGSY.js.map +0 -7
  148. package/dist/exports/client/componentInline-CBBUBQ7P.js +0 -2
  149. package/dist/exports/client/internal-client.d.ts +0 -3
  150. package/dist/exports/client/internal-client.d.ts.map +0 -1
  151. package/dist/field/RichTextViewProvider.d.ts +0 -86
  152. package/dist/field/RichTextViewProvider.d.ts.map +0 -1
  153. package/dist/field/RichTextViewProvider.js +0 -90
  154. package/dist/field/RichTextViewProvider.js.map +0 -1
  155. package/dist/field/ViewSelector.d.ts +0 -4
  156. package/dist/field/ViewSelector.d.ts.map +0 -1
  157. package/dist/field/ViewSelector.js +0 -89
  158. package/dist/field/ViewSelector.js.map +0 -1
  159. package/dist/lexical/plugins/NodeViewOverridePlugin/index.d.ts +0 -2
  160. package/dist/lexical/plugins/NodeViewOverridePlugin/index.d.ts.map +0 -1
  161. package/dist/lexical/plugins/NodeViewOverridePlugin/index.js +0 -48
  162. package/dist/lexical/plugins/NodeViewOverridePlugin/index.js.map +0 -1
  163. /package/dist/exports/client/{componentInline-CBBUBQ7P.js.map → componentInline-NL25DNZ5.js.map} +0 -0
@@ -1,4 +1,3 @@
1
- export type { BlockComponentContextType } from '../../features/blocks/client/component/BlockContent.js';
2
1
  export { type JSXConvertersFunction, RichText, } from '../../features/converters/lexicalToJSX/Component/index.js';
3
2
  export { BlockquoteJSXConverter } from '../../features/converters/lexicalToJSX/converter/converters/blockquote.js';
4
3
  export { HeadingJSXConverter } from '../../features/converters/lexicalToJSX/converter/converters/heading.js';
@@ -13,6 +12,5 @@ export { TextJSXConverter } from '../../features/converters/lexicalToJSX/convert
13
12
  export { UploadJSXConverter } from '../../features/converters/lexicalToJSX/converter/converters/upload.js';
14
13
  export { defaultJSXConverters } from '../../features/converters/lexicalToJSX/converter/defaultConverters.js';
15
14
  export { convertLexicalNodesToJSX } from '../../features/converters/lexicalToJSX/converter/index.js';
16
- export type { JSXConverter, JSXConverterArgs, JSXConverters, SerializedLexicalNodeWithParent, } from '../../features/converters/lexicalToJSX/converter/types.js';
17
- export type { ViewMapBlockComponentProps, ViewMapBlockEditorProps, ViewMapBlockJSXConverterProps, } from '../../types.js';
15
+ export type { JSXConverter, JSXConverters, SerializedLexicalNodeWithParent, } from '../../features/converters/lexicalToJSX/converter/types.js';
18
16
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/exports/react/index.ts"],"names":[],"mappings":"AACA,YAAY,EAAE,yBAAyB,EAAE,MAAM,wDAAwD,CAAA;AACvG,OAAO,EACL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1H,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,4 +1,3 @@
1
- // Export block context type for typing custom Block components
2
1
  export { RichText } from '../../features/converters/lexicalToJSX/Component/index.js';
3
2
  export { BlockquoteJSXConverter } from '../../features/converters/lexicalToJSX/converter/converters/blockquote.js';
4
3
  export { HeadingJSXConverter } from '../../features/converters/lexicalToJSX/converter/converters/heading.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["RichText","BlockquoteJSXConverter","HeadingJSXConverter","HorizontalRuleJSXConverter","LinebreakJSXConverter","LinkJSXConverter","ListJSXConverter","ParagraphJSXConverter","TabJSXConverter","TableJSXConverter","TextJSXConverter","UploadJSXConverter","defaultJSXConverters","convertLexicalNodesToJSX"],"sources":["../../../src/exports/react/index.ts"],"sourcesContent":["// Export block context type for typing custom Block components\nexport type { BlockComponentContextType } from '../../features/blocks/client/component/BlockContent.js'\nexport {\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'\n\nexport { TableJSXConverter } from '../../features/converters/lexicalToJSX/converter/converters/table.js'\n\nexport { TextJSXConverter } from '../../features/converters/lexicalToJSX/converter/converters/text.js'\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'\n\nexport type {\n JSXConverter,\n JSXConverterArgs,\n JSXConverters,\n SerializedLexicalNodeWithParent,\n} from '../../features/converters/lexicalToJSX/converter/types.js'\n\n// Export view map block props for typing custom Block components\nexport type {\n ViewMapBlockComponentProps,\n ViewMapBlockEditorProps,\n ViewMapBlockJSXConverterProps,\n} from '../../types.js'\n"],"mappings":"AAAA;AAEA,SAEEA,QAAQ,QACH;AACP,SAASC,sBAAsB,QAAQ;AACvC,SAASC,mBAAmB,QAAQ;AACpC,SAASC,0BAA0B,QAAQ;AAC3C,SAASC,qBAAqB,QAAQ;AACtC,SAASC,gBAAgB,QAAQ;AACjC,SAASC,gBAAgB,QAAQ;AACjC,SAASC,qBAAqB,QAAQ;AACtC,SAASC,eAAe,QAAQ;AAEhC,SAASC,iBAAiB,QAAQ;AAElC,SAASC,gBAAgB,QAAQ;AACjC,SAASC,kBAAkB,QAAQ;AACnC,SAASC,oBAAoB,QAAQ;AACrC,SAASC,wBAAwB,QAAQ","ignoreList":[]}
1
+ {"version":3,"file":"index.js","names":["RichText","BlockquoteJSXConverter","HeadingJSXConverter","HorizontalRuleJSXConverter","LinebreakJSXConverter","LinkJSXConverter","ListJSXConverter","ParagraphJSXConverter","TabJSXConverter","TableJSXConverter","TextJSXConverter","UploadJSXConverter","defaultJSXConverters","convertLexicalNodesToJSX"],"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"],"mappings":"AAAA,SAEEA,QAAQ,QACH;AACP,SAASC,sBAAsB,QAAQ;AACvC,SAASC,mBAAmB,QAAQ;AACpC,SAASC,0BAA0B,QAAQ;AAC3C,SAASC,qBAAqB,QAAQ;AACtC,SAASC,gBAAgB,QAAQ;AACjC,SAASC,gBAAgB,QAAQ;AACjC,SAASC,qBAAqB,QAAQ;AACtC,SAASC,eAAe,QAAQ;AAChC,SAASC,iBAAiB,QAAQ;AAElC,SAASC,gBAAgB,QAAQ;AAEjC,SAASC,kBAAkB,QAAQ;AACnC,SAASC,oBAAoB,QAAQ;AACrC,SAASC,wBAAwB,QAAQ","ignoreList":[]}
@@ -51,11 +51,7 @@ export type BlockContentProps = {
51
51
  baseClass: string;
52
52
  BlockDrawer: React.FC;
53
53
  Collapsible: React.FC<BlockCollapsibleWithErrorProps>;
54
- /**
55
- * Custom block component (pre-rendered ReactNode).
56
- */
57
- CustomBlock?: React.ReactNode;
58
- CustomLabel: React.ReactNode;
54
+ CustomBlock: React.ReactNode;
59
55
  EditButton: React.FC;
60
56
  errorCount: number;
61
57
  formSchema: ClientField[];
@@ -63,9 +59,9 @@ export type BlockContentProps = {
63
59
  nodeKey: string;
64
60
  RemoveButton: React.FC;
65
61
  };
66
- export type BlockComponentContextType = {
62
+ type BlockComponentContextType = {
67
63
  BlockCollapsible: React.FC<BlockCollapsibleProps>;
68
- } & Omit<BlockContentProps, 'Collapsible' | 'CustomBlock' | 'CustomLabel'>;
64
+ } & Omit<BlockContentProps, 'Collapsible'>;
69
65
  export declare const useBlockComponentContext: () => BlockComponentContextType;
70
66
  /**
71
67
  * The actual content of the Block. This should be INSIDE a Form component,
@@ -73,4 +69,5 @@ export declare const useBlockComponentContext: () => BlockComponentContextType;
73
69
  * not the whole document.
74
70
  */
75
71
  export declare const BlockContent: React.FC<BlockContentProps>;
72
+ export {};
76
73
  //# sourceMappingURL=BlockContent.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"BlockContent.d.ts","sourceRoot":"","sources":["../../../../../src/features/blocks/client/component/BlockContent.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE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GAAG,SAAS,GAAG,SAAS,CAAA;IAE3C,OAAO,EAAE,MAAM,CAAA;IACf,YAAY,EAAE,KAAK,CAAC,EAAE,CAAA;CACvB,CAAA;AAED,MAAM,MAAM,yBAAyB,GAAG;IACtC,gBAAgB,EAAE,KAAK,CAAC,EAAE,CAAC,qBAAqB,CAAC,CAAA;CAClD,GAAG,IAAI,CAAC,iBAAiB,EAAE,aAAa,GAAG,aAAa,GAAG,aAAa,CAAC,CAAA;AAc1E,eAAO,MAAM,wBAAwB,iCAAyC,CAAA;AAE9E;;;;GAIG;AACH,eAAO,MAAM,YAAY,EAAE,KAAK,CAAC,EAAE,CAAC,iBAAiB,CA8CpD,CAAA"}
1
+ {"version":3,"file":"BlockContent.d.ts","sourceRoot":"","sources":["../../../../../src/features/blocks/client/component/BlockContent.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,qCAAqC,CAAA;AAC3E,OAAO,KAAK,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,SAAS,CAAA;AAIrD,OAAO,KAAiC,MAAM,OAAO,CAAA;AAErD,MAAM,MAAM,qBAAqB,GAAG;IAClC;;;OAGG;IACH,OAAO,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;IACzB,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;IAC1B;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB;;OAEG;IACH,gBAAgB,CAAC,EAAE,OAAO,CAAC,gBAAgB,CAAC,CAAA;IAC5C;;;OAGG;IACH,gBAAgB,CAAC,EAAE,OAAO,CAAA;IAC1B;;;;OAIG;IACH,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB;;OAEG;IACH,KAAK,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;IACvB;;;OAGG;IACH,IAAI,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;IACtB;;;;OAIG;IACH,YAAY,CAAC,EAAE,OAAO,CAAA;CACvB,CAAA;AAED,MAAM,MAAM,8BAA8B,GAAG;IAC3C,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,cAAc,CAAC,EAAE,OAAO,CAAA;CACzB,GAAG,qBAAqB,CAAA;AAEzB,MAAM,MAAM,iBAAiB,GAAG;IAC9B,SAAS,EAAE,MAAM,CAAA;IACjB,WAAW,EAAE,KAAK,CAAC,EAAE,CAAA;IACrB,WAAW,EAAE,KAAK,CAAC,EAAE,CAAC,8BAA8B,CAAC,CAAA;IACrD,WAAW,EAAE,KAAK,CAAC,SAAS,CAAA;IAC5B,UAAU,EAAE,KAAK,CAAC,EAAE,CAAA;IACpB,UAAU,EAAE,MAAM,CAAA;IAClB,UAAU,EAAE,WAAW,EAAE,CAAA;IACzB,YAAY,EAAE,KAAK,GAAG,SAAS,GAAG,SAAS,CAAA;IAE3C,OAAO,EAAE,MAAM,CAAA;IACf,YAAY,EAAE,KAAK,CAAC,EAAE,CAAA;CACvB,CAAA;AAED,KAAK,yBAAyB,GAAG;IAC/B,gBAAgB,EAAE,KAAK,CAAC,EAAE,CAAC,qBAAqB,CAAC,CAAA;CAClD,GAAG,IAAI,CAAC,iBAAiB,EAAE,aAAa,CAAC,CAAA;AAe1C,eAAO,MAAM,wBAAwB,iCAAyC,CAAA;AAE9E;;;;GAIG;AACH,eAAO,MAAM,YAAY,EAAE,KAAK,CAAC,EAAE,CAAC,iBAAiB,CA6CpD,CAAA"}
@@ -9,6 +9,7 @@ const BlockComponentContext = /*#__PURE__*/createContext({
9
9
  baseClass: 'LexicalEditorTheme__block',
10
10
  BlockCollapsible: () => null,
11
11
  BlockDrawer: () => null,
12
+ CustomBlock: null,
12
13
  EditButton: () => null,
13
14
  errorCount: 0,
14
15
  formSchema: [],
@@ -26,12 +27,11 @@ export const BlockContent = props => {
26
27
  const $ = _c(4);
27
28
  const {
28
29
  Collapsible,
29
- CustomBlock,
30
- CustomLabel,
31
30
  ...contextProps
32
31
  } = props;
33
32
  const {
34
33
  BlockDrawer,
34
+ CustomBlock,
35
35
  errorCount,
36
36
  formSchema
37
37
  } = contextProps;
@@ -40,11 +40,11 @@ export const BlockContent = props => {
40
40
  const isEditable = useLexicalEditable();
41
41
  let t0;
42
42
  if ($[0] !== Collapsible || $[1] !== errorCount || $[2] !== fieldHasErrors) {
43
- t0 = collapsibleProps => {
43
+ t0 = props_0 => {
44
44
  const {
45
45
  children,
46
46
  ...rest
47
- } = collapsibleProps;
47
+ } = props_0;
48
48
  return _jsx(Collapsible, {
49
49
  errorCount,
50
50
  fieldHasErrors,
@@ -60,12 +60,11 @@ export const BlockContent = props => {
60
60
  t0 = $[3];
61
61
  }
62
62
  const CollapsibleWithErrorProps = t0;
63
- const blockContextValue = {
64
- ...contextProps,
65
- BlockCollapsible: CollapsibleWithErrorProps
66
- };
67
63
  return CustomBlock ? _jsxs(BlockComponentContext, {
68
- value: blockContextValue,
64
+ value: {
65
+ ...contextProps,
66
+ BlockCollapsible: CollapsibleWithErrorProps
67
+ },
69
68
  children: [CustomBlock, _jsx(BlockDrawer, {})]
70
69
  }) : _jsx(CollapsibleWithErrorProps, {
71
70
  children: _jsx(RenderFields, {
@@ -1 +1 @@
1
- {"version":3,"file":"BlockContent.js","names":["c","_c","useLexicalEditable","RenderFields","useFormSubmitted","React","createContext","useMemo","BlockComponentContext","baseClass","BlockCollapsible","BlockDrawer","EditButton","errorCount","formSchema","initialState","nodeKey","RemoveButton","useBlockComponentContext","use","BlockContent","props","$","Collapsible","CustomBlock","CustomLabel","contextProps","hasSubmitted","fieldHasErrors","isEditable","t0","collapsibleProps","children","rest","_jsx","CollapsibleWithErrorProps","blockContextValue","_jsxs","value","fields","forceRender","parentIndexPath","parentPath","parentSchemaPath","permissions","readOnly"],"sources":["../../../../../src/features/blocks/client/component/BlockContent.tsx"],"sourcesContent":["'use client'\nimport type { CollapsibleProps } from '@payloadcms/ui/elements/Collapsible'\nimport type { ClientField, FormState } from 'payload'\n\nimport { useLexicalEditable } from '@lexical/react/useLexicalEditable'\nimport { RenderFields, useFormSubmitted } from '@payloadcms/ui'\nimport React, { createContext, useMemo } from 'react'\n\nexport type BlockCollapsibleProps = {\n /**\n * Replace the top-right portion of the header that renders the Edit and Remove buttons with custom content.\n * If this property is provided, the `removeButton` and `editButton` properties are ignored.\n */\n Actions?: React.ReactNode\n children?: React.ReactNode\n /**\n * Additional className to the collapsible wrapper\n */\n className?: string\n /**\n * Props to pass to the underlying Collapsible component. You could use this to override the `Header` entirely, for example.\n */\n collapsibleProps?: Partial<CollapsibleProps>\n /**\n * Whether to disable rendering the block name field in the header Label\n * @default false\n */\n disableBlockName?: boolean\n /**\n * Whether to show the Edit button\n * If `Actions` is provided, this property is ignored.\n * @default true\n */\n editButton?: boolean\n /**\n * Replace the default Label component with a custom Label\n */\n Label?: React.ReactNode\n /**\n * Replace the default Pill component component that's rendered within the default Label component with a custom Pill.\n * This property has no effect if you provide a custom Label component via the `Label` property.\n */\n Pill?: React.ReactNode\n /**\n * Whether to show the Remove button\n * If `Actions` is provided, this property is ignored.\n * @default true\n */\n removeButton?: boolean\n}\n\nexport type BlockCollapsibleWithErrorProps = {\n errorCount?: number\n fieldHasErrors?: boolean\n} & BlockCollapsibleProps\n\nexport type BlockContentProps = {\n baseClass: string\n BlockDrawer: React.FC\n Collapsible: React.FC<BlockCollapsibleWithErrorProps>\n /**\n * Custom block component (pre-rendered ReactNode).\n */\n CustomBlock?: React.ReactNode\n CustomLabel: React.ReactNode\n EditButton: React.FC\n errorCount: number\n formSchema: ClientField[]\n initialState: false | FormState | undefined\n\n nodeKey: string\n RemoveButton: React.FC\n}\n\nexport type BlockComponentContextType = {\n BlockCollapsible: React.FC<BlockCollapsibleProps>\n} & Omit<BlockContentProps, 'Collapsible' | 'CustomBlock' | 'CustomLabel'>\n\nconst BlockComponentContext = createContext<BlockComponentContextType>({\n baseClass: 'LexicalEditorTheme__block',\n BlockCollapsible: () => null,\n BlockDrawer: () => null,\n EditButton: () => null,\n errorCount: 0,\n formSchema: [],\n initialState: false,\n nodeKey: '',\n RemoveButton: () => null,\n})\n\nexport const useBlockComponentContext = () => React.use(BlockComponentContext)\n\n/**\n * The actual content of the Block. This should be INSIDE a Form component,\n * scoped to the block. All format operations in here are thus scoped to the block's form, and\n * not the whole document.\n */\nexport const BlockContent: React.FC<BlockContentProps> = (props) => {\n const { Collapsible, CustomBlock, CustomLabel, ...contextProps } = props\n\n const { BlockDrawer, errorCount, formSchema } = contextProps\n\n const hasSubmitted = useFormSubmitted()\n\n const fieldHasErrors = hasSubmitted && errorCount > 0\n const isEditable = useLexicalEditable()\n\n const CollapsibleWithErrorProps = useMemo(\n () => (collapsibleProps: BlockCollapsibleProps) => {\n const { children, ...rest } = collapsibleProps\n return (\n <Collapsible errorCount={errorCount} fieldHasErrors={fieldHasErrors} {...rest}>\n {children}\n </Collapsible>\n )\n },\n [Collapsible, fieldHasErrors, errorCount],\n )\n\n const blockContextValue: BlockComponentContextType = {\n ...contextProps,\n BlockCollapsible: CollapsibleWithErrorProps,\n }\n\n // Provide context for useBlockComponentContext() hook\n return CustomBlock ? (\n <BlockComponentContext value={blockContextValue}>\n {CustomBlock}\n <BlockDrawer />\n </BlockComponentContext>\n ) : (\n <CollapsibleWithErrorProps>\n <RenderFields\n fields={formSchema}\n forceRender={true}\n parentIndexPath=\"\"\n parentPath={''}\n parentSchemaPath=\"\"\n permissions={true}\n readOnly={!isEditable}\n />\n </CollapsibleWithErrorProps>\n )\n}\n"],"mappings":"AAAA;;AAAA,SAAAA,CAAA,IAAAC,EAAA;;AAIA,SAASC,kBAAkB,QAAQ;AACnC,SAASC,YAAY,EAAEC,gBAAgB,QAAQ;AAC/C,OAAOC,KAAA,IAASC,aAAa,EAAEC,OAAO,QAAQ;AAwE9C,MAAMC,qBAAA,gBAAwBF,aAAA,CAAyC;EACrEG,SAAA,EAAW;EACXC,gBAAA,EAAkBA,CAAA,KAAM;EACxBC,WAAA,EAAaA,CAAA,KAAM;EACnBC,UAAA,EAAYA,CAAA,KAAM;EAClBC,UAAA,E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;IAAAH,QAAA,EACCE,IAAA,CAAA/B,YAAA;MAAAoC,MAAA,EACUzB,UAAA;MAAA0B,WAAA;MAAAC,eAAA,EAEQ;MAAAC,UAAA,EACJ;MAAAC,gBAAA,EACK;MAAAC,WAAA;MAAAC,QAAA,GAENhB;IAAA,C;;CAInB","ignoreList":[]}
1
+ {"version":3,"file":"BlockContent.js","names":["c","_c","useLexicalEditable","RenderFields","useFormSubmitted","React","createContext","useMemo","BlockComponentContext","baseClass","BlockCollapsible","BlockDrawer","CustomBlock","EditButton","errorCount","formSchema","initialState","nodeKey","RemoveButton","useBlockComponentContext","use","BlockContent","props","$","Collapsible","contextProps","hasSubmitted","fieldHasErrors","isEditable","t0","props_0","children","rest","_jsx","CollapsibleWithErrorProps","_jsxs","value","fields","forceRender","parentIndexPath","parentPath","parentSchemaPath","permissions","readOnly"],"sources":["../../../../../src/features/blocks/client/component/BlockContent.tsx"],"sourcesContent":["'use client'\nimport type { CollapsibleProps } from '@payloadcms/ui/elements/Collapsible'\nimport type { ClientField, FormState } from 'payload'\n\nimport { useLexicalEditable } from '@lexical/react/useLexicalEditable'\nimport { RenderFields, useFormSubmitted } from '@payloadcms/ui'\nimport React, { createContext, useMemo } from 'react'\n\nexport type BlockCollapsibleProps = {\n /**\n * Replace the top-right portion of the header that renders the Edit and Remove buttons with custom content.\n * If this property is provided, the `removeButton` and `editButton` properties are ignored.\n */\n Actions?: React.ReactNode\n children?: React.ReactNode\n /**\n * Additional className to the collapsible wrapper\n */\n className?: string\n /**\n * Props to pass to the underlying Collapsible component. You could use this to override the `Header` entirely, for example.\n */\n collapsibleProps?: Partial<CollapsibleProps>\n /**\n * Whether to disable rendering the block name field in the header Label\n * @default false\n */\n disableBlockName?: boolean\n /**\n * Whether to show the Edit button\n * If `Actions` is provided, this property is ignored.\n * @default true\n */\n editButton?: boolean\n /**\n * Replace the default Label component with a custom Label\n */\n Label?: React.ReactNode\n /**\n * Replace the default Pill component component that's rendered within the default Label component with a custom Pill.\n * This property has no effect if you provide a custom Label component via the `Label` property.\n */\n Pill?: React.ReactNode\n /**\n * Whether to show the Remove button\n * If `Actions` is provided, this property is ignored.\n * @default true\n */\n removeButton?: boolean\n}\n\nexport type BlockCollapsibleWithErrorProps = {\n errorCount?: number\n fieldHasErrors?: boolean\n} & BlockCollapsibleProps\n\nexport type BlockContentProps = {\n baseClass: string\n BlockDrawer: React.FC\n Collapsible: React.FC<BlockCollapsibleWithErrorProps>\n CustomBlock: React.ReactNode\n EditButton: React.FC\n errorCount: number\n formSchema: ClientField[]\n initialState: false | FormState | undefined\n\n nodeKey: string\n RemoveButton: React.FC\n}\n\ntype BlockComponentContextType = {\n BlockCollapsible: React.FC<BlockCollapsibleProps>\n} & Omit<BlockContentProps, 'Collapsible'>\n\nconst BlockComponentContext = createContext<BlockComponentContextType>({\n baseClass: 'LexicalEditorTheme__block',\n BlockCollapsible: () => null,\n BlockDrawer: () => null,\n CustomBlock: null,\n EditButton: () => null,\n errorCount: 0,\n formSchema: [],\n initialState: false,\n nodeKey: '',\n RemoveButton: () => null,\n})\n\nexport const useBlockComponentContext = () => React.use(BlockComponentContext)\n\n/**\n * The actual content of the Block. This should be INSIDE a Form component,\n * scoped to the block. All format operations in here are thus scoped to the block's form, and\n * not the whole document.\n */\nexport const BlockContent: React.FC<BlockContentProps> = (props) => {\n const { Collapsible, ...contextProps } = props\n\n const { BlockDrawer, CustomBlock, errorCount, formSchema } = contextProps\n\n const hasSubmitted = useFormSubmitted()\n\n const fieldHasErrors = hasSubmitted && errorCount > 0\n const isEditable = useLexicalEditable()\n\n const CollapsibleWithErrorProps = useMemo(\n () => (props: BlockCollapsibleProps) => {\n const { children, ...rest } = props\n return (\n <Collapsible errorCount={errorCount} fieldHasErrors={fieldHasErrors} {...rest}>\n {children}\n </Collapsible>\n )\n },\n [Collapsible, fieldHasErrors, errorCount],\n )\n\n return CustomBlock ? (\n <BlockComponentContext\n value={{\n ...contextProps,\n BlockCollapsible: CollapsibleWithErrorProps,\n }}\n >\n {CustomBlock}\n <BlockDrawer />\n </BlockComponentContext>\n ) : (\n <CollapsibleWithErrorProps>\n <RenderFields\n fields={formSchema}\n forceRender={true}\n parentIndexPath=\"\"\n parentPath={''}\n parentSchemaPath=\"\"\n permissions={true}\n readOnly={!isEditable}\n />\n </CollapsibleWithErrorProps>\n )\n}\n"],"mappings":"AAAA;;AAAA,SAAAA,CAAA,IAAAC,EAAA;;AAIA,SAASC,kBAAkB,QAAQ;AACnC,SAASC,YAAY,EAAEC,gBAAgB,QAAQ;AAC/C,OAAOC,KAAA,IAASC,aAAa,EAAEC,OAAO,QAAQ;AAoE9C,MAAMC,qBAAA,gBAAwBF,aAAA,CAAyC;EACrEG,SAAA,EAAW;EACXC,gBAAA,EAAkBA,CAAA,KAAM;EACxBC,WAAA,EAAaA,CAAA,KAAM;EACnBC,WAAA,EAAa;EACbC,UAAA,EAAYA,CAAA,KAAM;EAClBC,UAAA,EAAY;EACZC,UAAA,EAAY,EAAE;EACdC,YAAA,EAAc;EACdC,OAAA,EAAS;EACTC,YAAA,EAAcA,CAAA,KAAM;AACtB;AAEA,OAAO,MAAMC,wBAAA,GAA2BA,CAAA,KAAMd,KAAA,CAAMe,GAAG,CAACZ,qBAAA;AAExD;;;;;AAKA,OAAO,MAAMa,YAAA,GAA4CC,KAAA;EAAA,MAAAC,CAAA,GAAAtB,EAAA;EACvD;IAAAuB,WAAA;IAAA,GAAAC;EAAA,IAAyCH,KAAA;EAEzC;IAAAX,WAAA;IAAAC,WAAA;IAAAE,UAAA;IAAAC;EAAA,IAA6DU,YAAA;EAE7D,MAAAC,YAAA,GAAqBtB,gBAAA;EAErB,MAAAuB,cAAA,GAAuBD,YAAA,IAAgBZ,UAAA,IAAa;EACpD,MAAAc,UAAA,GAAmB1B,kBAAA;EAAA,IAAA2B,EAAA;EAAA,IAAAN,CAAA,QAAAC,WAAA,IAAAD,CAAA,QAAAT,UAAA,IAAAS,CAAA,QAAAI,cAAA;IAGXE,EAAA,GAAAC,OAAA;MACJ;QAAAC,QAAA;QAAA,GAAAC;MAAA,IAA8BV,OAAA;MAAA,OAE5BW,IAAA,CAACT,WAAA;QAAAV,UAAA;QAAAa,cAAA;QAAA,GAAwEK,IAAI;QAAAD;MAAA,C;;IAIjFR,CAAA,MAAAC,WAAA;IAAAD,CAAA,MAAAT,UAAA;IAAAS,CAAA,MAAAI,cAAA;IAAAJ,CAAA,MAAAM,EAAA;EAAA;IAAAA,EAAA,GAAAN,CAAA;EAAA;EARF,MAAAW,yBAAA,GACQL,EAON;EACyC,OAGpCjB,WAAA,GACLuB,KAAA,CAAA3B,qBAAA;IAAA4B,KAAA;MAAA,GAEOX,YAAY;MAAAf,gBAAA,EACGwB;IAAA;IAAAH,QAAA,GAGnBnB,WAAA,EACDqB,IAAA,CAACtB,WAAA;EAAA,C,IAGHsB,IAAA,CAACC,yBAAA;IAAAH,QAAA,EACCE,IAAA,CAAA9B,YAAA;MAAAkC,MAAA,EACUtB,UAAA;MAAAuB,WAAA;MAAAC,eAAA,EAEQ;MAAAC,UAAA,EACJ;MAAAC,gBAAA,EACK;MAAAC,WAAA;MAAAC,QAAA,GAENf;IAAA,C;;CAInB","ignoreList":[]}
@@ -1,8 +1,7 @@
1
1
  import React from 'react';
2
- import type { ViewMapBlockComponentProps } from '../../../../types.js';
3
2
  import type { BlockFields } from '../../server/nodes/BlocksNode.js';
4
3
  import './index.scss';
5
- export type BlockComponentProps<TFormData extends Record<string, unknown> = BlockFields> = {
4
+ type Props = {
6
5
  /**
7
6
  * Can be modified by the node in order to trigger the re-fetch of the initial state based on the
8
7
  * formData. This is useful when node.setFields() is explicitly called from outside of the form - in
@@ -10,24 +9,9 @@ export type BlockComponentProps<TFormData extends Record<string, unknown> = Bloc
10
9
  */
11
10
  readonly cacheBuster: number;
12
11
  readonly className: string;
13
- /**
14
- * Custom block component from view map
15
- * Will be rendered with useBlockComponentContext hook.
16
- */
17
- readonly CustomBlock?: React.FC<ViewMapBlockComponentProps>;
18
- /**
19
- * Custom block label from view map
20
- * Will be rendered with useBlockComponentContext hook.
21
- */
22
- readonly CustomLabel?: React.FC<ViewMapBlockComponentProps>;
23
- /**
24
- * The block's form data (field values).
25
- */
26
- readonly formData: TFormData;
27
- /**
28
- * The unique key identifying this block node in the current editor instance.
29
- */
12
+ readonly formData: BlockFields;
30
13
  readonly nodeKey: string;
31
14
  };
32
- export declare const BlockComponent: React.FC<BlockComponentProps>;
15
+ export declare const BlockComponent: React.FC<Props>;
16
+ export {};
33
17
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/features/blocks/client/component/index.tsx"],"names":[],"mappings":"AAkCA,OAAO,KAAkD,MAAM,OAAO,CAAA;AAGtE,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,sBAAsB,CAAA;AACtE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kCAAkC,CAAA;AAEnE,OAAO,cAAc,CAAA;AAWrB,MAAM,MAAM,mBAAmB,CAAC,SAAS,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,WAAW,IAAI;IACzF;;;;OAIG;IACH,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAA;IAC5B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAA;IAC1B;;;OAGG;IACH,QAAQ,CAAC,WAAW,CAAC,EAAE,KAAK,CAAC,EAAE,CAAC,0BAA0B,CAAC,CAAA;IAC3D;;;OAGG;IACH,QAAQ,CAAC,WAAW,CAAC,EAAE,KAAK,CAAC,EAAE,CAAC,0BAA0B,CAAC,CAAA;IAC3D;;OAEG;IACH,QAAQ,CAAC,QAAQ,EAAE,SAAS,CAAA;IAC5B;;OAEG;IACH,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;CACzB,CAAA;AAED,eAAO,MAAM,cAAc,EAAE,KAAK,CAAC,EAAE,CAAC,mBAAmB,CAmpBxD,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/features/blocks/client/component/index.tsx"],"names":[],"mappings":"AAkCA,OAAO,KAAkD,MAAM,OAAO,CAAA;AAGtE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kCAAkC,CAAA;AAGnE,OAAO,cAAc,CAAA;AAMrB,KAAK,KAAK,GAAG;IACX;;;;OAIG;IACH,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAA;IAC5B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAA;IAC1B,QAAQ,CAAC,QAAQ,EAAE,WAAW,CAAA;IAC9B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;CACzB,CAAA;AAED,eAAO,MAAM,cAAc,EAAE,KAAK,CAAC,EAAE,CAAC,KAAK,CA0kB1C,CAAA"}
@@ -13,14 +13,12 @@ import { v4 as uuid } from 'uuid';
13
13
  import { useEditorConfigContext } from '../../../../lexical/config/client/EditorConfigProvider.js';
14
14
  import { useLexicalDrawer } from '../../../../utilities/fieldsDrawer/useLexicalDrawer.js';
15
15
  import { $isBlockNode } from '../nodes/BlocksNode.js';
16
- import { BlockContent, useBlockComponentContext } from './BlockContent.js';
16
+ import { BlockContent } from './BlockContent.js';
17
17
  import { removeEmptyArrayValues } from './removeEmptyArrayValues.js';
18
18
  export const BlockComponent = props => {
19
19
  const {
20
20
  cacheBuster,
21
21
  className: baseClass,
22
- CustomBlock: CustomBlockFromProps,
23
- CustomLabel: CustomLabelFromProps,
24
22
  formData,
25
23
  nodeKey
26
24
  } = props;
@@ -103,54 +101,12 @@ export const BlockComponent = props => {
103
101
  hasMounted.current = true;
104
102
  }
105
103
  }, [cacheBuster]);
106
- const [formUuid] = React.useState(() => uuid());
107
- // Server-rendered custom components (from admin.components, NOT viewMap).
108
- // When viewMap components exist (CustomBlockFromProps/CustomLabelFromProps),
109
- // we render them directly with formData instead, so these states are unused.
110
- const [CustomLabel, setCustomLabel] = React.useState(() => {
111
- if (CustomLabelFromProps) {
112
- return undefined;
113
- }
114
- // @ts-expect-error - vestiges of when tsconfig was not strict. Feel free to improve
115
- return initialState?.['_components']?.customComponents?.BlockLabel ?? undefined;
116
- });
117
- const [CustomBlock, setCustomBlock] = React.useState(() => {
118
- if (CustomBlockFromProps) {
119
- return undefined;
120
- }
121
- // @ts-expect-error - vestiges of when tsconfig was not strict. Feel free to improve
122
- return initialState?.['_components']?.customComponents?.Block ?? undefined;
123
- });
124
- // When viewMap components exist, render directly with formData (always current from
125
- // the lexical node). When they don't, fall back to server-rendered state.
126
- const resolvedCustomBlock = useMemo(() => {
127
- if (CustomBlockFromProps) {
128
- return /*#__PURE__*/_jsx(CustomBlockFromProps, {
129
- className: baseClass,
130
- formData: formData,
131
- isEditor: true,
132
- isJSXConverter: false,
133
- nodeKey: nodeKey,
134
- // eslint-disable-next-line react-compiler/react-compiler -- intentionally passed as a prop for custom block components to call
135
- useBlockComponentContext: useBlockComponentContext
136
- });
137
- }
138
- return CustomBlock;
139
- }, [CustomBlockFromProps, baseClass, formData, nodeKey, CustomBlock]);
140
- const resolvedCustomLabel = useMemo(() => {
141
- if (CustomLabelFromProps) {
142
- return /*#__PURE__*/_jsx(CustomLabelFromProps, {
143
- className: baseClass,
144
- formData: formData,
145
- isEditor: true,
146
- isJSXConverter: false,
147
- nodeKey: nodeKey,
148
- // eslint-disable-next-line react-compiler/react-compiler -- intentionally passed as a prop for custom block components to call
149
- useBlockComponentContext: useBlockComponentContext
150
- });
151
- }
152
- return CustomLabel;
153
- }, [CustomLabelFromProps, baseClass, formData, nodeKey, CustomLabel]);
104
+ const [CustomLabel, setCustomLabel] = React.useState(
105
+ // @ts-expect-error - vestiges of when tsconfig was not strict. Feel free to improve
106
+ initialState?.['_components']?.customComponents?.BlockLabel ?? undefined);
107
+ const [CustomBlock, setCustomBlock] = React.useState(
108
+ // @ts-expect-error - vestiges of when tsconfig was not strict. Feel free to improve
109
+ initialState?.['_components']?.customComponents?.Block ?? undefined);
154
110
  // Initial state for newly created blocks
155
111
  useEffect(() => {
156
112
  const abortController = new AbortController();
@@ -201,12 +157,8 @@ export const BlockComponent = props => {
201
157
  }
202
158
  });
203
159
  setInitialState(state);
204
- if (!CustomLabelFromProps) {
205
- setCustomLabel(state._components?.customComponents?.BlockLabel ?? undefined);
206
- }
207
- if (!CustomBlockFromProps) {
208
- setCustomBlock(state._components?.customComponents?.Block ?? undefined);
209
- }
160
+ setCustomLabel(state._components?.customComponents?.BlockLabel ?? undefined);
161
+ setCustomBlock(state._components?.customComponents?.Block ?? undefined);
210
162
  }
211
163
  };
212
164
  if (formData && !initialState) {
@@ -215,7 +167,7 @@ export const BlockComponent = props => {
215
167
  return () => {
216
168
  abortAndIgnore(abortController);
217
169
  };
218
- }, [getFormState, schemaFieldsPath, isEditable, id, CustomLabelFromProps, CustomBlockFromProps, formData, editor, nodeKey, initialState, collectionSlug, globalSlug, getDocPreferences, parentDocumentFields, blockType]);
170
+ }, [getFormState, schemaFieldsPath, isEditable, id, formData, editor, nodeKey, initialState, collectionSlug, globalSlug, getDocPreferences, parentDocumentFields, blockType]);
219
171
  const [isCollapsed, setIsCollapsed] = React.useState(initialLexicalFormState?.[formData.id]?.collapsed ?? false);
220
172
  const componentMapRenderedBlockPath = `${schemaPath}.lexical_internal_feature.blocks.lexical_blocks.${blockType}`;
221
173
  const clientSchemaMap = featureClientSchemaMap['blocks'];
@@ -275,12 +227,8 @@ export const BlockComponent = props => {
275
227
  });
276
228
  }, 0);
277
229
  if (submit) {
278
- if (!CustomLabelFromProps) {
279
- setCustomLabel(newFormState._components?.customComponents?.BlockLabel ?? undefined);
280
- }
281
- if (!CustomBlockFromProps) {
282
- setCustomBlock(newFormState._components?.customComponents?.Block ?? undefined);
283
- }
230
+ setCustomLabel(newFormState._components?.customComponents?.BlockLabel ?? undefined);
231
+ setCustomBlock(newFormState._components?.customComponents?.Block ?? undefined);
284
232
  let rowErrorCount = 0;
285
233
  for (const formField of Object.values(newFormState)) {
286
234
  if (formField?.valid === false) {
@@ -290,7 +238,7 @@ export const BlockComponent = props => {
290
238
  setErrorCount(rowErrorCount);
291
239
  }
292
240
  return newFormState;
293
- }, [getFormState, id, collectionSlug, getDocPreferences, globalSlug, schemaFieldsPath, blockType, parentDocumentFields, isEditable, editor, nodeKey, CustomBlockFromProps, CustomLabelFromProps]);
241
+ }, [getFormState, id, collectionSlug, getDocPreferences, globalSlug, schemaFieldsPath, blockType, parentDocumentFields, isEditable, editor, nodeKey]);
294
242
  useEffect(() => {
295
243
  return () => {
296
244
  abortAndIgnore(onChangeAbortControllerRef.current);
@@ -377,7 +325,7 @@ export const BlockComponent = props => {
377
325
  collapsibleStyle: fieldHasErrors ? 'error' : 'default',
378
326
  header: /*#__PURE__*/_jsxs("div", {
379
327
  className: `${baseClass}__block-header`,
380
- children: [typeof Label !== 'undefined' ? Label : typeof resolvedCustomLabel !== 'undefined' ? resolvedCustomLabel : /*#__PURE__*/_jsxs("div", {
328
+ children: [typeof Label !== 'undefined' ? Label : typeof CustomLabel !== 'undefined' ? CustomLabel : /*#__PURE__*/_jsxs("div", {
381
329
  className: `${baseClass}__block-label`,
382
330
  children: [typeof CustomPill !== 'undefined' ? CustomPill : /*#__PURE__*/_jsx(Pill, {
383
331
  className: `${baseClass}__block-pill ${baseClass}__block-pill-${blockType}`,
@@ -395,7 +343,7 @@ export const BlockComponent = props => {
395
343
  }), /*#__PURE__*/_jsx("div", {
396
344
  className: `${baseClass}__block-actions`,
397
345
  children: typeof Actions !== 'undefined' ? Actions : /*#__PURE__*/_jsxs(_Fragment, {
398
- children: [resolvedCustomBlock && editButton !== false || !resolvedCustomBlock && editButton ? /*#__PURE__*/_jsx(EditButton, {}) : null, removeButton !== false && isEditable ? /*#__PURE__*/_jsx(RemoveButton, {}) : null]
346
+ children: [CustomBlock && editButton !== false || !CustomBlock && editButton ? /*#__PURE__*/_jsx(EditButton, {}) : null, removeButton !== false && isEditable ? /*#__PURE__*/_jsx(RemoveButton, {}) : null]
399
347
  })
400
348
  })]
401
349
  }),
@@ -408,7 +356,7 @@ export const BlockComponent = props => {
408
356
  children: children
409
357
  }, 0)
410
358
  });
411
- }, [resolvedCustomBlock, resolvedCustomLabel, EditButton, RemoveButton, blockDisplayName, baseClass, clientBlock?.admin?.disableBlockName, blockType, i18n, isCollapsed, onCollapsedChange, isEditable]);
359
+ }, [CustomBlock, CustomLabel, EditButton, RemoveButton, blockDisplayName, baseClass, clientBlock?.admin?.disableBlockName, blockType, i18n, isCollapsed, onCollapsedChange, isEditable]);
412
360
  const blockID = formData?.id;
413
361
  const BlockDrawer = useMemo(() => () => /*#__PURE__*/_jsx(EditDepthProvider, {
414
362
  children: /*#__PURE__*/_jsx(Drawer, {
@@ -438,54 +386,49 @@ export const BlockComponent = props => {
438
386
  if (!initialState) {
439
387
  return null;
440
388
  }
441
- return /*#__PURE__*/_jsx("div", {
442
- "data-block-drawer-slug": drawerSlug,
443
- style: {
444
- display: 'contents'
389
+ return /*#__PURE__*/_jsx(Form, {
390
+ beforeSubmit: [async ({
391
+ formState
392
+ }) => {
393
+ // This is only called when form is submitted from drawer - usually only the case if the block has a custom Block component
394
+ return await onChange({
395
+ formState,
396
+ submit: true
397
+ });
398
+ }],
399
+ el: "div",
400
+ fields: clientBlock?.fields ?? [],
401
+ initialState: initialState,
402
+ onChange: [onChange],
403
+ onSubmit: (formState_0, newData_1) => {
404
+ // This is only called when form is submitted from drawer - usually only the case if the block has a custom Block component
405
+ newData_1.blockType = blockType;
406
+ editor.update(() => {
407
+ const node_1 = $getNodeByKey(nodeKey);
408
+ if (node_1 && $isBlockNode(node_1)) {
409
+ node_1.setFields(newData_1, true);
410
+ }
411
+ });
412
+ toggleDrawer();
445
413
  },
446
- children: /*#__PURE__*/_jsx(Form, {
447
- beforeSubmit: [async ({
448
- formState
449
- }) => {
450
- // This is only called when form is submitted from drawer - usually only the case if the block has a custom Block component
451
- return await onChange({
452
- formState,
453
- submit: true
454
- });
455
- }],
456
- el: "div",
457
- fields: clientBlock?.fields ?? [],
414
+ submitted: submitted,
415
+ uuid: uuid(),
416
+ children: /*#__PURE__*/_jsx(BlockContent, {
417
+ baseClass: baseClass,
418
+ BlockDrawer: BlockDrawer,
419
+ Collapsible: BlockCollapsible,
420
+ CustomBlock: CustomBlock,
421
+ EditButton: EditButton,
422
+ errorCount: errorCount,
423
+ formSchema: clientBlock?.fields ?? [],
458
424
  initialState: initialState,
459
- onChange: [onChange],
460
- onSubmit: (formState_0, newData_1) => {
461
- // This is only called when form is submitted from drawer - usually only the case if the block has a custom Block component
462
- newData_1.blockType = blockType;
463
- editor.update(() => {
464
- const node_1 = $getNodeByKey(nodeKey);
465
- if (node_1 && $isBlockNode(node_1)) {
466
- node_1.setFields(newData_1, true);
467
- }
468
- });
469
- toggleDrawer();
470
- },
471
- submitted: submitted,
472
- uuid: formUuid,
473
- children: /*#__PURE__*/_jsx(BlockContent, {
474
- baseClass: baseClass,
475
- BlockDrawer: BlockDrawer,
476
- Collapsible: BlockCollapsible,
477
- CustomBlock: resolvedCustomBlock,
478
- CustomLabel: resolvedCustomLabel,
479
- EditButton: EditButton,
480
- errorCount: errorCount,
481
- formSchema: clientBlock?.fields ?? [],
482
- initialState: initialState,
483
- nodeKey: nodeKey,
484
- RemoveButton: RemoveButton
485
- })
425
+ nodeKey: nodeKey,
426
+ RemoveButton: RemoveButton
486
427
  })
487
428
  });
488
- }, [BlockCollapsible, BlockDrawer, resolvedCustomBlock, resolvedCustomLabel, blockType, drawerSlug, RemoveButton, EditButton, baseClass, editor, errorCount, toggleDrawer, clientBlock?.fields, formUuid, initialState, nodeKey, onChange, submitted]);
429
+ }, [BlockCollapsible, BlockDrawer, CustomBlock, blockType, RemoveButton, EditButton, baseClass, editor, errorCount, toggleDrawer, clientBlock?.fields,
430
+ // DO NOT ADD FORMDATA HERE! Adding formData will kick you out of sub block editors while writing.
431
+ initialState, nodeKey, onChange, submitted]);
489
432
  if (!clientBlock) {
490
433
  return /*#__PURE__*/_jsx(BlockCollapsible, {
491
434
  disableBlockName: true,