@payloadcms/richtext-lexical 3.0.0-beta.36 → 3.0.0-beta.38

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 (177) hide show
  1. package/dist/field/features/align/feature.client.d.ts.map +1 -1
  2. package/dist/field/features/align/feature.client.js +12 -4
  3. package/dist/field/features/align/feature.client.js.map +1 -1
  4. package/dist/field/features/align/feature.server.d.ts.map +1 -1
  5. package/dist/field/features/align/feature.server.js +2 -0
  6. package/dist/field/features/align/feature.server.js.map +1 -1
  7. package/dist/field/features/align/i18n.d.ts +3 -0
  8. package/dist/field/features/align/i18n.d.ts.map +1 -0
  9. package/dist/field/features/align/i18n.js +196 -0
  10. package/dist/field/features/align/i18n.js.map +1 -0
  11. package/dist/field/features/blockquote/feature.client.d.ts.map +1 -1
  12. package/dist/field/features/blockquote/feature.client.js +22 -21
  13. package/dist/field/features/blockquote/feature.client.js.map +1 -1
  14. package/dist/field/features/blockquote/feature.server.d.ts.map +1 -1
  15. package/dist/field/features/blockquote/feature.server.js +2 -0
  16. package/dist/field/features/blockquote/feature.server.js.map +1 -1
  17. package/dist/field/features/blockquote/i18n.d.ts +3 -0
  18. package/dist/field/features/blockquote/i18n.d.ts.map +1 -0
  19. package/dist/field/features/blockquote/i18n.js +100 -0
  20. package/dist/field/features/blockquote/i18n.js.map +1 -0
  21. package/dist/field/features/blocks/feature.client.d.ts.map +1 -1
  22. package/dist/field/features/blocks/feature.client.js +3 -1
  23. package/dist/field/features/blocks/feature.client.js.map +1 -1
  24. package/dist/field/features/blocks/feature.server.d.ts.map +1 -1
  25. package/dist/field/features/blocks/feature.server.js +3 -1
  26. package/dist/field/features/blocks/feature.server.js.map +1 -1
  27. package/dist/field/features/blocks/i18n.d.ts +3 -0
  28. package/dist/field/features/blocks/i18n.d.ts.map +1 -0
  29. package/dist/field/features/blocks/i18n.js +100 -0
  30. package/dist/field/features/blocks/i18n.js.map +1 -0
  31. package/dist/field/features/blocks/populationPromise.js +1 -1
  32. package/dist/field/features/blocks/populationPromise.js.map +1 -1
  33. package/dist/field/features/converters/html/field/index.d.ts.map +1 -1
  34. package/dist/field/features/converters/html/field/index.js +30 -2
  35. package/dist/field/features/converters/html/field/index.js.map +1 -1
  36. package/dist/field/features/heading/feature.client.d.ts.map +1 -1
  37. package/dist/field/features/heading/feature.client.js +26 -21
  38. package/dist/field/features/heading/feature.client.js.map +1 -1
  39. package/dist/field/features/heading/feature.server.d.ts.map +1 -1
  40. package/dist/field/features/heading/feature.server.js +2 -0
  41. package/dist/field/features/heading/feature.server.js.map +1 -1
  42. package/dist/field/features/heading/i18n.d.ts +3 -0
  43. package/dist/field/features/heading/i18n.d.ts.map +1 -0
  44. package/dist/field/features/heading/i18n.js +100 -0
  45. package/dist/field/features/heading/i18n.js.map +1 -0
  46. package/dist/field/features/horizontalRule/feature.client.d.ts.map +1 -1
  47. package/dist/field/features/horizontalRule/feature.client.js +21 -20
  48. package/dist/field/features/horizontalRule/feature.client.js.map +1 -1
  49. package/dist/field/features/horizontalRule/feature.server.d.ts.map +1 -1
  50. package/dist/field/features/horizontalRule/feature.server.js +2 -0
  51. package/dist/field/features/horizontalRule/feature.server.js.map +1 -1
  52. package/dist/field/features/horizontalRule/i18n.d.ts +3 -0
  53. package/dist/field/features/horizontalRule/i18n.d.ts.map +1 -0
  54. package/dist/field/features/horizontalRule/i18n.js +100 -0
  55. package/dist/field/features/horizontalRule/i18n.js.map +1 -0
  56. package/dist/field/features/indent/feature.client.d.ts.map +1 -1
  57. package/dist/field/features/indent/feature.client.js +6 -2
  58. package/dist/field/features/indent/feature.client.js.map +1 -1
  59. package/dist/field/features/indent/feature.server.d.ts.map +1 -1
  60. package/dist/field/features/indent/feature.server.js +2 -0
  61. package/dist/field/features/indent/feature.server.js.map +1 -1
  62. package/dist/field/features/indent/i18n.d.ts +3 -0
  63. package/dist/field/features/indent/i18n.d.ts.map +1 -0
  64. package/dist/field/features/indent/i18n.js +132 -0
  65. package/dist/field/features/indent/i18n.js.map +1 -0
  66. package/dist/field/features/link/feature.client.d.ts.map +1 -1
  67. package/dist/field/features/link/feature.client.js +7 -1
  68. package/dist/field/features/link/feature.client.js.map +1 -1
  69. package/dist/field/features/link/feature.server.d.ts.map +1 -1
  70. package/dist/field/features/link/feature.server.js +11 -3
  71. package/dist/field/features/link/feature.server.js.map +1 -1
  72. package/dist/field/features/link/i18n.d.ts +3 -0
  73. package/dist/field/features/link/i18n.d.ts.map +1 -0
  74. package/dist/field/features/link/i18n.js +100 -0
  75. package/dist/field/features/link/i18n.js.map +1 -0
  76. package/dist/field/features/link/markdownTransformer.d.ts +6 -0
  77. package/dist/field/features/link/markdownTransformer.d.ts.map +1 -0
  78. package/dist/field/features/link/markdownTransformer.js +50 -0
  79. package/dist/field/features/link/markdownTransformer.js.map +1 -0
  80. package/dist/field/features/link/populationPromise.js +1 -1
  81. package/dist/field/features/link/populationPromise.js.map +1 -1
  82. package/dist/field/features/lists/checklist/feature.client.d.ts.map +1 -1
  83. package/dist/field/features/lists/checklist/feature.client.js +21 -20
  84. package/dist/field/features/lists/checklist/feature.client.js.map +1 -1
  85. package/dist/field/features/lists/checklist/feature.server.d.ts.map +1 -1
  86. package/dist/field/features/lists/checklist/feature.server.js +2 -0
  87. package/dist/field/features/lists/checklist/feature.server.js.map +1 -1
  88. package/dist/field/features/lists/checklist/i18n.d.ts +3 -0
  89. package/dist/field/features/lists/checklist/i18n.d.ts.map +1 -0
  90. package/dist/field/features/lists/checklist/i18n.js +100 -0
  91. package/dist/field/features/lists/checklist/i18n.js.map +1 -0
  92. package/dist/field/features/lists/orderedList/feature.client.d.ts.map +1 -1
  93. package/dist/field/features/lists/orderedList/feature.client.js +19 -18
  94. package/dist/field/features/lists/orderedList/feature.client.js.map +1 -1
  95. package/dist/field/features/lists/orderedList/feature.server.d.ts.map +1 -1
  96. package/dist/field/features/lists/orderedList/feature.server.js +3 -1
  97. package/dist/field/features/lists/orderedList/feature.server.js.map +1 -1
  98. package/dist/field/features/lists/orderedList/i18n.d.ts +3 -0
  99. package/dist/field/features/lists/orderedList/i18n.d.ts.map +1 -0
  100. package/dist/field/features/lists/orderedList/i18n.js +100 -0
  101. package/dist/field/features/lists/orderedList/i18n.js.map +1 -0
  102. package/dist/field/features/lists/shared/slashMenuListGroup.d.ts +3 -0
  103. package/dist/field/features/lists/shared/slashMenuListGroup.d.ts.map +1 -0
  104. package/dist/field/features/lists/shared/slashMenuListGroup.js +11 -0
  105. package/dist/field/features/lists/shared/slashMenuListGroup.js.map +1 -0
  106. package/dist/field/features/lists/unorderedList/feature.client.d.ts.map +1 -1
  107. package/dist/field/features/lists/unorderedList/feature.client.js +19 -18
  108. package/dist/field/features/lists/unorderedList/feature.client.js.map +1 -1
  109. package/dist/field/features/lists/unorderedList/feature.server.d.ts.map +1 -1
  110. package/dist/field/features/lists/unorderedList/feature.server.js +2 -0
  111. package/dist/field/features/lists/unorderedList/feature.server.js.map +1 -1
  112. package/dist/field/features/lists/unorderedList/i18n.d.ts +3 -0
  113. package/dist/field/features/lists/unorderedList/i18n.d.ts.map +1 -0
  114. package/dist/field/features/lists/unorderedList/i18n.js +100 -0
  115. package/dist/field/features/lists/unorderedList/i18n.js.map +1 -0
  116. package/dist/field/features/paragraph/feature.client.d.ts.map +1 -1
  117. package/dist/field/features/paragraph/feature.client.js +24 -23
  118. package/dist/field/features/paragraph/feature.client.js.map +1 -1
  119. package/dist/field/features/paragraph/feature.server.d.ts.map +1 -1
  120. package/dist/field/features/paragraph/feature.server.js +2 -0
  121. package/dist/field/features/paragraph/feature.server.js.map +1 -1
  122. package/dist/field/features/paragraph/i18n.d.ts +3 -0
  123. package/dist/field/features/paragraph/i18n.d.ts.map +1 -0
  124. package/dist/field/features/paragraph/i18n.js +132 -0
  125. package/dist/field/features/paragraph/i18n.js.map +1 -0
  126. package/dist/field/features/relationship/feature.client.d.ts.map +1 -1
  127. package/dist/field/features/relationship/feature.client.js +23 -22
  128. package/dist/field/features/relationship/feature.client.js.map +1 -1
  129. package/dist/field/features/relationship/feature.server.d.ts.map +1 -1
  130. package/dist/field/features/relationship/feature.server.js +2 -0
  131. package/dist/field/features/relationship/feature.server.js.map +1 -1
  132. package/dist/field/features/relationship/i18n.d.ts +3 -0
  133. package/dist/field/features/relationship/i18n.d.ts.map +1 -0
  134. package/dist/field/features/relationship/i18n.js +100 -0
  135. package/dist/field/features/relationship/i18n.js.map +1 -0
  136. package/dist/field/features/shared/slashMenu/basicGroup.d.ts +3 -0
  137. package/dist/field/features/shared/slashMenu/basicGroup.d.ts.map +1 -0
  138. package/dist/field/features/shared/slashMenu/basicGroup.js +11 -0
  139. package/dist/field/features/shared/slashMenu/basicGroup.js.map +1 -0
  140. package/dist/field/features/toolbars/types.d.ts +1 -1
  141. package/dist/field/features/toolbars/types.d.ts.map +1 -1
  142. package/dist/field/features/toolbars/types.js.map +1 -1
  143. package/dist/field/features/types.d.ts +21 -2
  144. package/dist/field/features/types.d.ts.map +1 -1
  145. package/dist/field/features/types.js.map +1 -1
  146. package/dist/field/features/upload/feature.client.d.ts.map +1 -1
  147. package/dist/field/features/upload/feature.client.js +26 -25
  148. package/dist/field/features/upload/feature.client.js.map +1 -1
  149. package/dist/field/features/upload/feature.server.d.ts.map +1 -1
  150. package/dist/field/features/upload/feature.server.js +3 -1
  151. package/dist/field/features/upload/feature.server.js.map +1 -1
  152. package/dist/field/features/upload/i18n.d.ts +3 -0
  153. package/dist/field/features/upload/i18n.d.ts.map +1 -0
  154. package/dist/field/features/upload/i18n.js +100 -0
  155. package/dist/field/features/upload/i18n.js.map +1 -0
  156. package/dist/field/features/upload/populationPromise.js +1 -1
  157. package/dist/field/features/upload/populationPromise.js.map +1 -1
  158. package/dist/field/lexical/LexicalEditor.d.ts.map +1 -1
  159. package/dist/field/lexical/LexicalEditor.js +3 -1
  160. package/dist/field/lexical/LexicalEditor.js.map +1 -1
  161. package/dist/field/lexical/config/server/sanitize.d.ts.map +1 -1
  162. package/dist/field/lexical/config/server/sanitize.js +11 -0
  163. package/dist/field/lexical/config/server/sanitize.js.map +1 -1
  164. package/dist/field/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/types.d.ts +2 -2
  165. package/dist/field/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/types.d.ts.map +1 -1
  166. package/dist/field/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/types.js.map +1 -1
  167. package/dist/field/lexical/utils/url.d.ts.map +1 -1
  168. package/dist/field/lexical/utils/url.js +10 -2
  169. package/dist/field/lexical/utils/url.js.map +1 -1
  170. package/dist/i18n.d.ts +3 -0
  171. package/dist/i18n.d.ts.map +1 -0
  172. package/dist/i18n.js +164 -0
  173. package/dist/i18n.js.map +1 -0
  174. package/dist/index.d.ts.map +1 -1
  175. package/dist/index.js +11 -0
  176. package/dist/index.js.map +1 -1
  177. package/package.json +12 -11
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/field/features/blocks/feature.client.tsx"],"sourcesContent":["'use client'\n\nimport type { ReducedBlock } from '@payloadcms/ui/utilities/buildComponentMap'\n\nimport { getTranslation } from '@payloadcms/translations'\n\nimport type { FeatureProviderProviderClient } from '../types.js'\n\nimport { BlockIcon } from '../../lexical/ui/icons/Block/index.js'\nimport { createClientComponent } from '../createClientComponent.js'\nimport { BlockNode } from './nodes/BlocksNode.js'\nimport { INSERT_BLOCK_COMMAND } from './plugin/commands.js'\nimport { BlocksPlugin } from './plugin/index.js'\n\nexport type BlocksFeatureClientProps = {\n reducedBlocks: ReducedBlock[]\n}\n\nconst BlocksFeatureClient: FeatureProviderProviderClient<BlocksFeatureClientProps> = (props) => {\n return {\n clientFeatureProps: props,\n feature: () => ({\n clientFeatureProps: props,\n nodes: [BlockNode],\n plugins: [\n {\n Component: BlocksPlugin,\n position: 'normal',\n },\n ],\n slashMenu: {\n groups: [\n {\n items: props.reducedBlocks.map((block) => {\n return {\n Icon: BlockIcon,\n key: 'block-' + block.slug,\n keywords: ['block', 'blocks', block.slug],\n label: ({ i18n }) => {\n if (!block.labels.singular) {\n return block.slug\n }\n\n return getTranslation(block.labels.singular, i18n)\n },\n onSelect: ({ editor }) => {\n editor.dispatchCommand(INSERT_BLOCK_COMMAND, {\n id: null,\n blockName: '',\n blockType: block.slug,\n })\n },\n }\n }),\n key: 'blocks',\n label: 'Blocks',\n },\n ],\n },\n toolbarFixed: {\n groups: [\n {\n type: 'dropdown',\n ChildComponent: BlockIcon,\n items: props.reducedBlocks.map((block, index) => {\n return {\n ChildComponent: BlockIcon,\n isActive: undefined, // At this point, we would be inside a sub-richtext-editor. And at this point this will be run against the focused sub-editor, not the parent editor which has the actual block. Thus, no point in running this\n key: 'block-' + block.slug,\n label: ({ i18n }) => {\n if (!block.labels.singular) {\n return block.slug\n }\n\n return getTranslation(block.labels.singular, i18n)\n },\n onSelect: ({ editor }) => {\n editor.dispatchCommand(INSERT_BLOCK_COMMAND, {\n id: null,\n blockName: '',\n blockType: block.slug,\n })\n },\n order: index,\n }\n }),\n key: 'blocks',\n order: 20,\n },\n ],\n },\n }),\n }\n}\n\nexport const BlocksFeatureClientComponent = createClientComponent(BlocksFeatureClient)\n"],"names":["getTranslation","BlockIcon","createClientComponent","BlockNode","INSERT_BLOCK_COMMAND","BlocksPlugin","BlocksFeatureClient","props","clientFeatureProps","feature","nodes","plugins","Component","position","slashMenu","groups","items","reducedBlocks","map","block","Icon","key","slug","keywords","label","i18n","labels","singular","onSelect","editor","dispatchCommand","id","blockName","blockType","toolbarFixed","type","ChildComponent","index","isActive","undefined","order","BlocksFeatureClientComponent"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA;AAIA,SAASA,cAAc,QAAQ,2BAA0B;AAIzD,SAASC,SAAS,QAAQ,wCAAuC;AACjE,SAASC,qBAAqB,QAAQ,8BAA6B;AACnE,SAASC,SAAS,QAAQ,wBAAuB;AACjD,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MAAM,CAACC,QAAQ,EAAEF;oCAC/C;oCACAG,UAAU,CAAC,EAAEC,MAAM,EAAE;wCACnBA,OAAOC,eAAe,CAAC1B,sBAAsB;4CAC3C2B,IAAI;4CACJC,WAAW;4CACXC,WAAWd,MAAMG,IAAI;wCACvB;oCACF;oCACAkB,OAAOH;gCACT;4BACF;4BACAhB,KAAK;4BACLmB,OAAO;wBACT;qBACD;gBACH;YACF,CAAA;IACF;AACF;AAEA,OAAO,MAAMC,+BAA+BvC,sBAAsBI,qBAAoB"}
1
+ {"version":3,"sources":["../../../../src/field/features/blocks/feature.client.tsx"],"sourcesContent":["'use client'\n\nimport type { ReducedBlock } from '@payloadcms/ui/utilities/buildComponentMap'\n\nimport { getTranslation } from '@payloadcms/translations'\n\nimport type { FeatureProviderProviderClient } from '../types.js'\n\nimport { BlockIcon } from '../../lexical/ui/icons/Block/index.js'\nimport { createClientComponent } from '../createClientComponent.js'\nimport { BlockNode } from './nodes/BlocksNode.js'\nimport { INSERT_BLOCK_COMMAND } from './plugin/commands.js'\nimport { BlocksPlugin } from './plugin/index.js'\n\nexport type BlocksFeatureClientProps = {\n reducedBlocks: ReducedBlock[]\n}\n\nconst BlocksFeatureClient: FeatureProviderProviderClient<BlocksFeatureClientProps> = (props) => {\n return {\n clientFeatureProps: props,\n feature: () => ({\n clientFeatureProps: props,\n nodes: [BlockNode],\n plugins: [\n {\n Component: BlocksPlugin,\n position: 'normal',\n },\n ],\n slashMenu: {\n groups: [\n {\n items: props.reducedBlocks.map((block) => {\n return {\n Icon: BlockIcon,\n key: 'block-' + block.slug,\n keywords: ['block', 'blocks', block.slug],\n label: ({ i18n }) => {\n if (!block.labels.singular) {\n return block.slug\n }\n\n return getTranslation(block.labels.singular, i18n)\n },\n onSelect: ({ editor }) => {\n editor.dispatchCommand(INSERT_BLOCK_COMMAND, {\n id: null,\n blockName: '',\n blockType: block.slug,\n })\n },\n }\n }),\n key: 'blocks',\n label: ({ i18n }) => {\n return i18n.t('lexical:blocks:label')\n },\n },\n ],\n },\n toolbarFixed: {\n groups: [\n {\n type: 'dropdown',\n ChildComponent: BlockIcon,\n items: props.reducedBlocks.map((block, index) => {\n return {\n ChildComponent: BlockIcon,\n isActive: undefined, // At this point, we would be inside a sub-richtext-editor. And at this point this will be run against the focused sub-editor, not the parent editor which has the actual block. Thus, no point in running this\n key: 'block-' + block.slug,\n label: ({ i18n }) => {\n if (!block.labels.singular) {\n return block.slug\n }\n\n return getTranslation(block.labels.singular, i18n)\n },\n onSelect: ({ editor }) => {\n editor.dispatchCommand(INSERT_BLOCK_COMMAND, {\n id: null,\n blockName: '',\n blockType: block.slug,\n })\n },\n order: index,\n }\n }),\n key: 'blocks',\n order: 20,\n },\n ],\n },\n }),\n }\n}\n\nexport const BlocksFeatureClientComponent = createClientComponent(BlocksFeatureClient)\n"],"names":["getTranslation","BlockIcon","createClientComponent","BlockNode","INSERT_BLOCK_COMMAND","BlocksPlugin","BlocksFeatureClient","props","clientFeatureProps","feature","nodes","plugins","Component","position","slashMenu","groups","items","reducedBlocks","map","block","Icon","key","slug","keywords","label","i18n","labels","singular","onSelect","editor","dispatchCommand","id","blockName","blockType","t","toolbarFixed","type","ChildComponent","index","isActive","undefined","order","BlocksFeatureClientComponent"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA;AAIA,SAASA,cAAc,QAAQ,2BAA0B;AAIzD,SAASC,SAAS,QAAQ,wCAAuC;AACjE,SAASC,qBAAqB,QAAQ,8BAA6B;AACnE,SAASC,SAAS,QAAQ,wBAAuB;AACjD,SAASC,oBAAoB,QAAQ,uBAAsB;AAC3D,SAASC,YAAY,QAAQ,oBAAmB;AAMhD,MAAMC,sBAA+E,CAACC;IACpF,OAAO;QACLC,oBAAoBD;QACpBE,SAAS,IAAO,CAAA;gBACdD,oBAAoBD;gBACpBG,OAAO;oBAACP;iB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IAAI;4CACJC,WAAW;4CACXC,WAAWd,MAAMG,IAAI;wCACvB;oCACF;oCACAmB,OAAOH;gCACT;4BACF;4BACAjB,KAAK;4BACLoB,OAAO;wBACT;qBACD;gBACH;YACF,CAAA;IACF;AACF;AAEA,OAAO,MAAMC,+BAA+BxC,sBAAsBI,qBAAoB"}
@@ -1 +1 @@
1
- {"version":3,"file":"feature.server.d.ts","sourceRoot":"","sources":["../../../../src/field/features/blocks/feature.server.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAqB,MAAM,eAAe,CAAA;AAM7D,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,aAAa,CAAA;AAChE,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,qBAAqB,CAAA;AAQnE,MAAM,MAAM,kBAAkB,GAAG;IAC/B,MAAM,EAAE,KAAK,EAAE,CAAA;CAChB,CAAA;AAED,eAAO,MAAM,aAAa,EAAE,6BAA6B,CACvD,kBAAkB,EAClB,wBAAwB,CAsKzB,CAAA"}
1
+ {"version":3,"file":"feature.server.d.ts","sourceRoot":"","sources":["../../../../src/field/features/blocks/feature.server.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAqB,MAAM,eAAe,CAAA;AAM7D,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,aAAa,CAAA;AAChE,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,qBAAqB,CAAA;AASnE,MAAM,MAAM,kBAAkB,GAAG;IAC/B,MAAM,EAAE,KAAK,EAAE,CAAA;CAChB,CAAA;AAED,eAAO,MAAM,aAAa,EAAE,6BAA6B,CACvD,kBAAkB,EAClB,wBAAwB,CAuKzB,CAAA"}
@@ -1,8 +1,9 @@
1
- import { traverseFields } from '@payloadcms/next/utilities';
1
+ import { traverseFields } from '@payloadcms/ui/utilities/buildFieldSchemaMap/traverseFields';
2
2
  import { baseBlockFields, sanitizeFields } from 'payload/config';
3
3
  import { fieldsToJSONSchema, formatLabels } from 'payload/utilities';
4
4
  import { createNode } from '../typeUtilities.js';
5
5
  import { BlocksFeatureClientComponent } from './feature.client.js';
6
+ import { i18n } from './i18n.js';
6
7
  import { BlockNode } from './nodes/BlocksNode.js';
7
8
  import { blockPopulationPromiseHOC } from './populationPromise.js';
8
9
  import { blockValidationHOC } from './validate.js';
@@ -75,6 +76,7 @@ export const BlocksFeature = (props)=>{
75
76
  return currentSchema;
76
77
  }
77
78
  },
79
+ i18n,
78
80
  nodes: [
79
81
  createNode({
80
82
  /* // TODO: Implement these hooks once docWithLocales / originalSiblingDoc => node matching has been figured out
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/field/features/blocks/feature.server.ts"],"sourcesContent":["import type { Config } from 'payload/config'\nimport type { Block, BlockField, Field } from 'payload/types'\n\nimport { traverseFields } from '@payloadcms/next/utilities'\nimport { baseBlockFields, sanitizeFields } from 'payload/config'\nimport { fieldsToJSONSchema, formatLabels } from 'payload/utilities'\n\nimport type { FeatureProviderProviderServer } from '../types.js'\nimport type { BlocksFeatureClientProps } from './feature.client.js'\n\nimport { createNode } from '../typeUtilities.js'\nimport { BlocksFeatureClientComponent } from './feature.client.js'\nimport { BlockNode } from './nodes/BlocksNode.js'\nimport { blockPopulationPromiseHOC } from './populationPromise.js'\nimport { blockValidationHOC } from './validate.js'\n\nexport type BlocksFeatureProps = {\n blocks: Block[]\n}\n\nexport const BlocksFeature: FeatureProviderProviderServer<\n BlocksFeatureProps,\n BlocksFeatureClientProps\n> = (props) => {\n return {\n feature: async ({ config: _config, isRoot }) => {\n if (props?.blocks?.length) {\n const validRelationships = _config.collections.map((c) => c.slug) || []\n\n for (const block of props.blocks) {\n block.fields = block.fields.concat(baseBlockFields)\n block.labels = !block.labels ? formatLabels(block.slug) : block.labels\n\n block.fields = await sanitizeFields({\n config: _config as unknown as Config,\n fields: block.fields,\n requireFieldLevelRichTextEditor: isRoot,\n validRelationships,\n })\n }\n }\n\n // Build clientProps\n const clientProps: BlocksFeatureClientProps = {\n reducedBlocks: [],\n }\n for (const block of props.blocks) {\n clientProps.reducedBlocks.push({\n slug: block.slug,\n fieldMap: [],\n imageAltText: block.imageAltText,\n imageURL: block.imageURL,\n labels: block.labels,\n })\n }\n\n return {\n ClientComponent: BlocksFeatureClientComponent,\n clientFeatureProps: clientProps,\n generateSchemaMap: ({ config, i18n, props }) => {\n const validRelationships = config.collections.map((c) => c.slug) || []\n\n /**\n * Add sub-fields to the schemaMap. E.g. if you have an array field as part of the block, and it runs addRow, it will request these\n * sub-fields from the component map. Thus, we need to put them in the component map here.\n */\n const schemaMap = new Map<string, Field[]>()\n\n for (const block of props.blocks) {\n schemaMap.set(block.slug, block.fields || [])\n\n traverseFields({\n config,\n fields: block.fields,\n i18n,\n schemaMap,\n schemaPath: block.slug,\n validRelationships,\n })\n }\n\n return schemaMap\n },\n generatedTypes: {\n modifyOutputSchema: ({\n collectionIDFieldTypes,\n config,\n currentSchema,\n field,\n interfaceNameDefinitions,\n }) => {\n if (!props?.blocks?.length) {\n return currentSchema\n }\n\n const blocksField: BlockField = {\n name: field?.name + '_lexical_blocks',\n type: 'blocks',\n blocks: props.blocks,\n }\n // This is only done so that interfaceNameDefinitions sets those block's interfaceNames.\n // we don't actually use the JSON Schema itself in the generated types yet.\n fieldsToJSONSchema(\n collectionIDFieldTypes,\n [blocksField],\n interfaceNameDefinitions,\n config,\n )\n\n return currentSchema\n },\n },\n nodes: [\n createNode({\n /* // TODO: Implement these hooks once docWithLocales / originalSiblingDoc => node matching has been figured out\n hooks: {\n beforeChange: [\n async ({ context, findMany, node, operation, overrideAccess, req }) => {\n const blockType = node.fields.blockType\n\n const block = deepCopyObject(\n props.blocks.find((block) => block.slug === blockType),\n )\n\n\n await beforeChangeTraverseFields({\n id: null,\n collection: null,\n context,\n data: node.fields,\n doc: node.fields,\n fields: sanitizedBlock.fields,\n global: null,\n mergeLocaleActions: [],\n operation:\n operation === 'create' || operation === 'update' ? operation : 'update',\n overrideAccess,\n path: '',\n req,\n siblingData: node.fields,\n siblingDoc: node.fields,\n })\n\n\n return node\n },\n ],\n beforeValidate: [\n async ({ context, findMany, node, operation, overrideAccess, req }) => {\n const blockType = node.fields.blockType\n\n const block = deepCopyObject(\n props.blocks.find((block) => block.slug === blockType),\n )\n\n\n\n await beforeValidateTraverseFields({\n id: null,\n collection: null,\n context,\n data: node.fields,\n doc: node.fields,\n fields: sanitizedBlock.fields,\n global: null,\n operation:\n operation === 'create' || operation === 'update' ? operation : 'update',\n overrideAccess,\n req,\n siblingData: node.fields,\n siblingDoc: node.fields,\n })\n\n return node\n },\n ],\n },*/\n node: BlockNode,\n populationPromises: [blockPopulationPromiseHOC(props)],\n validations: [blockValidationHOC(props)],\n }),\n ],\n serverFeatureProps: props,\n }\n },\n key: 'blocks',\n serverFeatureProps: props,\n }\n}\n"],"names":["traverseFields","baseBlockFields","sanitizeFields","fieldsToJSONSchema","formatLabels","createNode","BlocksFeatureClientComponent","BlockNode","blockPopulationPromiseHOC","blockValidationHOC","BlocksFeature","props","feature","config","_config","isRoot","blocks","length","validRelationships","collections","map","c","slug","block","fields","concat","labels","requireFieldLevelRichTextEditor","clientProps","reducedBlocks","push","fieldMap","imageAltText","imageURL","ClientComponent","clientFeatureProps","generateSchemaMap","i18n","schemaMap","Map","set","schemaPath","generatedTypes","modifyOutputSchema","collectionIDFieldTypes","currentSchema","field","interfaceNameDefinitions","blocksField","name","type","nodes","node","populationPromises","validations","serverFeatureProps","key"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAGA,SAASA,cAAc,QAAQ,6BAA4B;AAC3D,SAASC,eAAe,EAAEC,cAAc,QAAQ,iBAAgB;AAChE,SAASC,kBAAkB,EAAEC,YAAY,QAAQ,oB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C,IAAMA,EAAEC,IAAI,KAAK,EAAE;oBAEtE;;;WAGC,GACD,MAAMgB,YAAY,IAAIC;oBAEtB,KAAK,MAAMhB,SAASZ,MAAMK,MAAM,CAAE;wBAChCsB,UAAUE,GAAG,CAACjB,MAAMD,IAAI,EAAEC,MAAMC,MAAM,IAAI,EAAE;wBAE5CxB,eAAe;4BACba;4BACAW,QAAQD,MAAMC,MAAM;4BACpBa;4BACAC;4BACAG,YAAYlB,MAAMD,IAAI;4BACtBJ;wBACF;oBACF;oBAEA,OAAOoB;gBACT;gBACAI,gBAAgB;oBACdC,oBAAoB,CAAC,EACnBC,sBAAsB,EACtB/B,MAAM,EACNgC,aAAa,EACbC,KAAK,EACLC,wBAAwB,EACzB;wBACC,IAAI,CAACpC,OAAOK,QAAQC,QAAQ;4BAC1B,OAAO4B;wBACT;wBAEA,MAAMG,cAA0B;4BAC9BC,MAAMH,OAAOG,OAAO;4BACpBC,MAAM;4BACNlC,QAAQL,MAAMK,MAAM;wBACtB;wBACA,wFAAwF;wBACxF,2EAA2E;wBAC3Eb,mBACEyC,wBACA;4BAACI;yBAAY,EACbD,0BACAlC;wBAGF,OAAOgC;oBACT;gBACF;gBACAM,OAAO;oBACL9C,WAAW;wBACT;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cA8DE,GACF+C,MAAM7C;wBACN8C,oBAAoB;4BAAC7C,0BAA0BG;yBAAO;wBACtD2C,aAAa;4BAAC7C,mBAAmBE;yBAAO;oBAC1C;iBACD;gBACD4C,oBAAoB5C;YACtB;QACF;QACA6C,KAAK;QACLD,oBAAoB5C;IACtB;AACF,EAAC"}
1
+ {"version":3,"sources":["../../../../src/field/features/blocks/feature.server.ts"],"sourcesContent":["import type { Config } from 'payload/config'\nimport type { Block, BlockField, Field } from 'payload/types'\n\nimport { traverseFields } from '@payloadcms/ui/utilities/buildFieldSchemaMap/traverseFields'\nimport { baseBlockFields, sanitizeFields } from 'payload/config'\nimport { fieldsToJSONSchema, formatLabels } from 'payload/utilities'\n\nimport type { FeatureProviderProviderServer } from '../types.js'\nimport type { BlocksFeatureClientProps } from './feature.client.js'\n\nimport { createNode } from '../typeUtilities.js'\nimport { BlocksFeatureClientComponent } from './feature.client.js'\nimport { i18n } from './i18n.js'\nimport { BlockNode } from './nodes/BlocksNode.js'\nimport { blockPopulationPromiseHOC } from './populationPromise.js'\nimport { blockValidationHOC } from './validate.js'\n\nexport type BlocksFeatureProps = {\n blocks: Block[]\n}\n\nexport const BlocksFeature: FeatureProviderProviderServer<\n BlocksFeatureProps,\n BlocksFeatureClientProps\n> = (props) => {\n return {\n feature: async ({ config: _config, isRoot }) => {\n if (props?.blocks?.length) {\n const validRelationships = _config.collections.map((c) => c.slug) || []\n\n for (const block of props.blocks) {\n block.fields = block.fields.concat(baseBlockFields)\n block.labels = !block.labels ? formatLabels(block.slug) : block.labels\n\n block.fields = await sanitizeFields({\n config: _config as unknown as Config,\n fields: block.fields,\n requireFieldLevelRichTextEditor: isRoot,\n validRelationships,\n })\n }\n }\n\n // Build clientProps\n const clientProps: BlocksFeatureClientProps = {\n reducedBlocks: [],\n }\n for (const block of props.blocks) {\n clientProps.reducedBlocks.push({\n slug: block.slug,\n fieldMap: [],\n imageAltText: block.imageAltText,\n imageURL: block.imageURL,\n labels: block.labels,\n })\n }\n\n return {\n ClientComponent: BlocksFeatureClientComponent,\n clientFeatureProps: clientProps,\n generateSchemaMap: ({ config, i18n, props }) => {\n const validRelationships = config.collections.map((c) => c.slug) || []\n\n /**\n * Add sub-fields to the schemaMap. E.g. if you have an array field as part of the block, and it runs addRow, it will request these\n * sub-fields from the component map. Thus, we need to put them in the component map here.\n */\n const schemaMap = new Map<string, Field[]>()\n\n for (const block of props.blocks) {\n schemaMap.set(block.slug, block.fields || [])\n\n traverseFields({\n config,\n fields: block.fields,\n i18n,\n schemaMap,\n schemaPath: block.slug,\n validRelationships,\n })\n }\n\n return schemaMap\n },\n generatedTypes: {\n modifyOutputSchema: ({\n collectionIDFieldTypes,\n config,\n currentSchema,\n field,\n interfaceNameDefinitions,\n }) => {\n if (!props?.blocks?.length) {\n return currentSchema\n }\n\n const blocksField: BlockField = {\n name: field?.name + '_lexical_blocks',\n type: 'blocks',\n blocks: props.blocks,\n }\n // This is only done so that interfaceNameDefinitions sets those block's interfaceNames.\n // we don't actually use the JSON Schema itself in the generated types yet.\n fieldsToJSONSchema(\n collectionIDFieldTypes,\n [blocksField],\n interfaceNameDefinitions,\n config,\n )\n\n return currentSchema\n },\n },\n i18n,\n nodes: [\n createNode({\n /* // TODO: Implement these hooks once docWithLocales / originalSiblingDoc => node matching has been figured out\n hooks: {\n beforeChange: [\n async ({ context, findMany, node, operation, overrideAccess, req }) => {\n const blockType = node.fields.blockType\n\n const block = deepCopyObject(\n props.blocks.find((block) => block.slug === blockType),\n )\n\n\n await beforeChangeTraverseFields({\n id: null,\n collection: null,\n context,\n data: node.fields,\n doc: node.fields,\n fields: sanitizedBlock.fields,\n global: null,\n mergeLocaleActions: [],\n operation:\n operation === 'create' || operation === 'update' ? operation : 'update',\n overrideAccess,\n path: '',\n req,\n siblingData: node.fields,\n siblingDoc: node.fields,\n })\n\n\n return node\n },\n ],\n beforeValidate: [\n async ({ context, findMany, node, operation, overrideAccess, req }) => {\n const blockType = node.fields.blockType\n\n const block = deepCopyObject(\n props.blocks.find((block) => block.slug === blockType),\n )\n\n\n\n await beforeValidateTraverseFields({\n id: null,\n collection: null,\n context,\n data: node.fields,\n doc: node.fields,\n fields: sanitizedBlock.fields,\n global: null,\n operation:\n operation === 'create' || operation === 'update' ? operation : 'update',\n overrideAccess,\n req,\n siblingData: node.fields,\n siblingDoc: node.fields,\n })\n\n return node\n },\n ],\n },*/\n node: BlockNode,\n populationPromises: [blockPopulationPromiseHOC(props)],\n validations: [blockValidationHOC(props)],\n }),\n ],\n serverFeatureProps: props,\n }\n },\n key: 'blocks',\n serverFeatureProps: props,\n }\n}\n"],"names":["traverseFields","baseBlockFields","sanitizeFields","fieldsToJSONSchema","formatLabels","createNode","BlocksFeatureClientComponent","i18n","BlockNode","blockPopulationPromiseHOC","blockValidationHOC","BlocksFeature","props","feature","config","_config","isRoot","blocks","length","validRelationships","collections","map","c","slug","block","fields","concat","labels","requireFieldLevelRichTextEditor","clientProps","reducedBlocks","push","fieldMap","imageAltText","imageURL","ClientComponent","clientFeatureProps","generateSchemaMap","schemaMap","Map","set","schemaPath","generatedTypes","modifyOutputSchema","collectionIDFieldTypes","currentSchema","field","interfaceNameDefinitions","blocksField","name","type","nodes","node","populationPromises","validations","serverFeatureProps","key"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAGA,SAASA,cAAc,QAAQ,8DAA6D;AAC5F,SAASC,eAAe,EAAEC,cAAc,QAAQ,iBAAgB;AAChE,SAASC,kBAAkB,EAAEC,YAAY,QAAQ,oBAAmB;AAKpE,SAASC,UAAU,QAAQ,sBAAqB;AAChD,SAASC,4BAA4B,QAAQ,sBAAqB;AAClE,SAASC,IAAI,QAAQ,YAAW;AAChC,SAASC,SAAS,QAAQ,wBAAuB;AACjD,SAASC,yBAAyB,QAAQ,yBAAwB;AAClE,SAASC,kBAAkB,QAAQ,gBAAe;AAMlD,OAAO,MAAMC,gBAGT,CAACC;IACH,OAAO;QACLC,SAAS,OAAO,EAAEC,QAAQC,OAAO,EAAEC,MAAM,EAAE;YACzC,IAAIJ,OAAOK,QAAQC,QAAQ;gBACzB,MAAMC,qBAAqBJ,QAAQK,WAAW,CAACC,GAAG,CAAC,CAACC,IAAMA,EAAEC,IAAI,KAAK,EAAE;gBAEvE,KAAK,MAAMC,SAASZ,MAAMK,MAAM,CAAE;oBAChCO,MAAMC,MAAM,GAAGD,MA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;4BAC1B,OAAO2B;wBACT;wBAEA,MAAMG,cAA0B;4BAC9BC,MAAMH,OAAOG,OAAO;4BACpBC,MAAM;4BACNjC,QAAQL,MAAMK,MAAM;wBACtB;wBACA,wFAAwF;wBACxF,2EAA2E;wBAC3Ed,mBACEyC,wBACA;4BAACI;yBAAY,EACbD,0BACAjC;wBAGF,OAAO+B;oBACT;gBACF;gBACAtC;gBACA4C,OAAO;oBACL9C,WAAW;wBACT;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cA8DE,GACF+C,MAAM5C;wBACN6C,oBAAoB;4BAAC5C,0BAA0BG;yBAAO;wBACtD0C,aAAa;4BAAC5C,mBAAmBE;yBAAO;oBAC1C;iBACD;gBACD2C,oBAAoB3C;YACtB;QACF;QACA4C,KAAK;QACLD,oBAAoB3C;IACtB;AACF,EAAC"}
@@ -0,0 +1,3 @@
1
+ import type { GenericLanguages } from '@payloadcms/translations';
2
+ export declare const i18n: Partial<GenericLanguages>;
3
+ //# sourceMappingURL=i18n.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"i18n.d.ts","sourceRoot":"","sources":["../../../../src/field/features/blocks/i18n.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAA;AAEhE,eAAO,MAAM,IAAI,EAAE,OAAO,CAAC,gBAAgB,CAiG1C,CAAA"}
@@ -0,0 +1,100 @@
1
+ export const i18n = {
2
+ ar: {
3
+ label: 'كتل'
4
+ },
5
+ az: {
6
+ label: 'Bloklar'
7
+ },
8
+ bg: {
9
+ label: 'Блокове'
10
+ },
11
+ cs: {
12
+ label: 'Bloky'
13
+ },
14
+ de: {
15
+ label: 'Blöcke'
16
+ },
17
+ en: {
18
+ label: 'Blocks'
19
+ },
20
+ es: {
21
+ label: 'Bloques'
22
+ },
23
+ fa: {
24
+ label: 'بلوک ها'
25
+ },
26
+ fr: {
27
+ label: 'Blocs'
28
+ },
29
+ he: {
30
+ label: 'חסימות'
31
+ },
32
+ hr: {
33
+ label: 'Blokovi'
34
+ },
35
+ hu: {
36
+ label: 'Blokkok'
37
+ },
38
+ it: {
39
+ label: 'Blocchi'
40
+ },
41
+ ja: {
42
+ label: 'ブロック'
43
+ },
44
+ ko: {
45
+ label: '블록'
46
+ },
47
+ my: {
48
+ label: 'တံတားများ'
49
+ },
50
+ nb: {
51
+ label: 'Blokker'
52
+ },
53
+ nl: {
54
+ label: 'Blokken'
55
+ },
56
+ pl: {
57
+ label: 'Bloki'
58
+ },
59
+ pt: {
60
+ label: 'Blocos'
61
+ },
62
+ ro: {
63
+ label: 'Blocuri'
64
+ },
65
+ rs: {
66
+ label: 'Blokovi'
67
+ },
68
+ 'rs-latin': {
69
+ label: 'Blokovi'
70
+ },
71
+ ru: {
72
+ label: 'Блоки'
73
+ },
74
+ sk: {
75
+ label: 'Bloky'
76
+ },
77
+ sv: {
78
+ label: 'Block'
79
+ },
80
+ th: {
81
+ label: 'บล็อค'
82
+ },
83
+ tr: {
84
+ label: 'Bloklar'
85
+ },
86
+ uk: {
87
+ label: 'Блоки'
88
+ },
89
+ vi: {
90
+ label: 'Khối'
91
+ },
92
+ zh: {
93
+ label: '块'
94
+ },
95
+ 'zh-TW': {
96
+ label: '區塊'
97
+ }
98
+ };
99
+
100
+ //# sourceMappingURL=i18n.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../src/field/features/blocks/i18n.ts"],"sourcesContent":["import type { GenericLanguages } from '@payloadcms/translations'\n\nexport const i18n: Partial<GenericLanguages> = {\n ar: {\n label: 'كتل',\n },\n az: {\n label: 'Bloklar',\n },\n bg: {\n label: 'Блокове',\n },\n cs: {\n label: 'Bloky',\n },\n de: {\n label: 'Blöcke',\n },\n en: {\n label: 'Blocks',\n },\n es: {\n label: 'Bloques',\n },\n fa: {\n label: 'بلوک ها',\n },\n fr: {\n label: 'Blocs',\n },\n he: {\n label: 'חסימות',\n },\n hr: {\n label: 'Blokovi',\n },\n hu: {\n label: 'Blokkok',\n },\n it: {\n label: 'Blocchi',\n },\n ja: {\n label: 'ブロック',\n },\n ko: {\n label: '블록',\n },\n my: {\n label: 'တံတားများ',\n },\n nb: {\n label: 'Blokker',\n },\n nl: {\n label: 'Blokken',\n },\n pl: {\n label: 'Bloki',\n },\n pt: {\n label: 'Blocos',\n },\n ro: {\n label: 'Blocuri',\n },\n rs: {\n label: 'Blokovi',\n },\n 'rs-latin': {\n label: 'Blokovi',\n },\n ru: {\n label: 'Блоки',\n },\n sk: {\n label: 'Bloky',\n },\n sv: {\n label: 'Block',\n },\n th: {\n label: 'บล็อค',\n },\n tr: {\n label: 'Bloklar',\n },\n uk: {\n label: 'Блоки',\n },\n vi: {\n label: 'Khối',\n },\n zh: {\n label: '块',\n },\n 'zh-TW': {\n label: '區塊',\n },\n}\n"],"names":["i18n","ar","label","az","bg","cs","de","en","es","fa","fr","he","hr","hu","it","ja","ko","my","nb","nl","pl","pt","ro","rs","ru","sk","sv","th","tr","uk","vi","zh"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAEA,OAAO,MAAMA,OAAkC;IAC7CC,IAAI;QACFC,OAAO;IACT;IACAC,IAAI;QACFD,OAAO;IACT;IACAE,IAAI;QACFF,OAAO;IACT;IACAG,IAAI;QACFH,OAAO;IACT;IACAI,IAAI;QACFJ,OAAO;IACT;IACAK,IAAI;QACFL,OAAO;IACT;IACAM,IAAI;QACFN,OAAO;IACT;IACAO,IAAI;QACFP,OAAO;IACT;IACAQ,IAAI;QACFR,OAAO;IACT;IACAS,IAAI;QACFT,OAAO;IACT;IACAU,IAAI;QACFV,OAAO;IACT;IACAW,IAAI;QACFX,OAAO;IACT;IACAY,IAAI;QACFZ,OAAO;IACT;IACAa,IAAI;QACFb,OAAO;IACT;IACAc,IAAI;QACFd,OAAO;IACT;IACAe,IAAI;QACFf,OAAO;IACT;IACAgB,IAAI;QACFhB,OAAO;IACT;IACAiB,IAAI;QACFjB,OAAO;IACT;IACAkB,IAAI;QACFlB,OAAO;IACT;IACAmB,IAAI;QACFnB,OAAO;IACT;IACAoB,IAAI;QACFpB,OAAO;IACT;IACAqB,IAAI;QACFrB,OAAO;IACT;IACA,YAAY;QACVA,OAAO;IACT;IACAsB,IAAI;QACFtB,OAAO;IACT;IACAuB,IAAI;QACFvB,OAAO;IACT;IACAwB,IAAI;QACFxB,OAAO;IACT;IACAyB,IAAI;QACFzB,OAAO;IACT;IACA0B,IAAI;QACF1B,OAAO;IACT;IACA2B,IAAI;QACF3B,OAAO;IACT;IACA4B,IAAI;QACF5B,OAAO;IACT;IACA6B,IAAI;QACF7B,OAAO;IACT;IACA,SAAS;QACPA,OAAO;IACT;AACF,EAAC"}
@@ -16,7 +16,7 @@ export const blockPopulationPromiseHOC = (props)=>{
16
16
  fieldPromises,
17
17
  fields: block.fields,
18
18
  findMany,
19
- flattenLocales,
19
+ flattenLocales: false,
20
20
  overrideAccess,
21
21
  populationPromises,
22
22
  req,
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/field/features/blocks/populationPromise.ts"],"sourcesContent":["import type { PopulationPromise } from '../types.js'\nimport type { BlocksFeatureProps } from './feature.server.js'\nimport type { SerializedBlockNode } from './nodes/BlocksNode.js'\n\nimport { recurseNestedFields } from '../../../populate/recurseNestedFields.js'\n\nexport const blockPopulationPromiseHOC = (\n props: BlocksFeatureProps,\n): PopulationPromise<SerializedBlockNode> => {\n const blockPopulationPromise: PopulationPromise<SerializedBlockNode> = ({\n context,\n currentDepth,\n depth,\n draft,\n editorPopulationPromises,\n fieldPromises,\n findMany,\n flattenLocales,\n node,\n overrideAccess,\n populationPromises,\n req,\n showHiddenFields,\n siblingDoc,\n }) => {\n const blockFieldData = node.fields\n\n // find block used in this node\n const block = props.blocks.find((block) => block.slug === blockFieldData.blockType)\n if (!block || !block?.fields?.length || !blockFieldData) {\n return\n }\n\n recurseNestedFields({\n context,\n currentDepth,\n data: blockFieldData,\n depth,\n editorPopulationPromises,\n fieldPromises,\n fields: block.fields,\n findMany,\n flattenLocales,\n overrideAccess,\n populationPromises,\n req,\n showHiddenFields,\n // The afterReadPromise gets its data from looking for field.name inside the siblingDoc. Thus, here we cannot pass the whole document's siblingDoc, but only the siblingDoc (sibling fields) of the current field.\n draft,\n siblingDoc: blockFieldData,\n })\n }\n\n return blockPopulationPromise\n}\n"],"names":["recurseNestedFields","blockPopulationPromiseHOC","props","blockPopulationPromise","context","currentDepth","depth","draft","editorPopulationPromises","fieldPromises","findMany","flattenLocales","node","overrideAccess","populationPromises","req","showHiddenFields","siblingDoc","blockFieldData","fields","block","blocks","find","slug","blockType","length","data"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAIA,SAASA,mBAAmB,QAAQ,2CAA0C;AAE9E,OAAO,MAAMC,4BAA4B,CACvCC;IAEA,MAAMC,yBAAiE,CAAC,EACtEC,OAAO,EACPC,YAAY,EACZC,KAAK,EACLC,KAAK,EACLC,wBAAwB,EACxBC,aAAa,EACbC,QAAQ,EACRC,cAAc,EACdC,IAAI,EACJC,cAAc,EACdC,kBAAkB,EAClBC,GAAG,EACHC,gBAAgB,EAChBC,UAAU,EACX;QACC,MAAMC,iBAAiBN,KAAKO,MAAM;QAElC,+BAA+B;QAC/B,MAAMC,QAAQlB,MAAMmB,MAAM,CAACC,IAAI,CAAC,CAACF,QAAUA,MAAMG,IAAI,KAAKL,eAAeM,SAAS;QAClF,IAAI,CAACJ,SAAS,CAACA,OAAOD,QAAQM,UAAU,CAACP,gBAAgB;YACvD;QACF;QAEAlB,oBAAoB;YAClBI;YACAC;YACAqB,MAAMR;YACNZ;YACAE;YACAC;YACAU,QAAQC,MAAMD,MAAM;YACpBT;YACAC;YACAE;YACAC;YACAC;YACAC;YACA,kNAAkN;YAClNT;YACAU,YAAYC;QACd;IACF;IAEA,OAAOf;AACT,EAAC"}
1
+ {"version":3,"sources":["../../../../src/field/features/blocks/populationPromise.ts"],"sourcesContent":["import type { PopulationPromise } from '../types.js'\nimport type { BlocksFeatureProps } from './feature.server.js'\nimport type { SerializedBlockNode } from './nodes/BlocksNode.js'\n\nimport { recurseNestedFields } from '../../../populate/recurseNestedFields.js'\n\nexport const blockPopulationPromiseHOC = (\n props: BlocksFeatureProps,\n): PopulationPromise<SerializedBlockNode> => {\n const blockPopulationPromise: PopulationPromise<SerializedBlockNode> = ({\n context,\n currentDepth,\n depth,\n draft,\n editorPopulationPromises,\n fieldPromises,\n findMany,\n flattenLocales,\n node,\n overrideAccess,\n populationPromises,\n req,\n showHiddenFields,\n siblingDoc,\n }) => {\n const blockFieldData = node.fields\n\n // find block used in this node\n const block = props.blocks.find((block) => block.slug === blockFieldData.blockType)\n if (!block || !block?.fields?.length || !blockFieldData) {\n return\n }\n\n recurseNestedFields({\n context,\n currentDepth,\n data: blockFieldData,\n depth,\n editorPopulationPromises,\n fieldPromises,\n fields: block.fields,\n findMany,\n flattenLocales: false, // Disable localization handling which does not work properly yet. Once we fully support hooks, this can be enabled (pass through flattenLocales again)\n overrideAccess,\n populationPromises,\n req,\n showHiddenFields,\n // The afterReadPromise gets its data from looking for field.name inside the siblingDoc. Thus, here we cannot pass the whole document's siblingDoc, but only the siblingDoc (sibling fields) of the current field.\n draft,\n siblingDoc: blockFieldData,\n })\n }\n\n return blockPopulationPromise\n}\n"],"names":["recurseNestedFields","blockPopulationPromiseHOC","props","blockPopulationPromise","context","currentDepth","depth","draft","editorPopulationPromises","fieldPromises","findMany","flattenLocales","node","overrideAccess","populationPromises","req","showHiddenFields","siblingDoc","blockFieldData","fields","block","blocks","find","slug","blockType","length","data"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAIA,SAASA,mBAAmB,QAAQ,2CAA0C;AAE9E,OAAO,MAAMC,4BAA4B,CACvCC;IAEA,MAAMC,yBAAiE,CAAC,EACtEC,OAAO,EACPC,YAAY,EACZC,KAAK,EACLC,KAAK,EACLC,wBAAwB,EACxBC,aAAa,EACbC,QAAQ,EACRC,cAAc,EACdC,IAAI,EACJC,cAAc,EACdC,kBAAkB,EAClBC,GAAG,EACHC,gBAAgB,EAChBC,UAAU,EACX;QACC,MAAMC,iBAAiBN,KAAKO,MAAM;QAElC,+BAA+B;QAC/B,MAAMC,QAAQlB,MAAMmB,MAAM,CAACC,IAAI,CAAC,CAACF,QAAUA,MAAMG,IAAI,KAAKL,eAAeM,SAAS;QAClF,IAAI,CAACJ,SAAS,CAACA,OAAOD,QAAQM,UAAU,CAACP,gBAAgB;YACvD;QACF;QAEAlB,oBAAoB;YAClBI;YACAC;YACAqB,MAAMR;YACNZ;YACAE;YACAC;YACAU,QAAQC,MAAMD,MAAM;YACpBT;YACAC,gBAAgB;YAChBE;YACAC;YACAC;YACAC;YACA,kNAAkN;YAClNT;YACAU,YAAYC;QACd;IACF;IAEA,OAAOf;AACT,EAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/field/features/converters/html/field/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAiB,MAAM,eAAe,CAAA;AAGzD,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,qCAAqC,CAAA;AACtF,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAA;AAM1D,KAAK,KAAK,GAAG;IACX;;;;OAIG;IACH,MAAM,CAAC,EAAE,OAAO,CAAA;IAChB,IAAI,EAAE,MAAM,CAAA;CACb,CAAA;AAED;;;;GAIG;AACH,eAAO,MAAM,yBAAyB,sBAEnC;IACD,YAAY,EAAE,2BAA2B,CAAA;CAC1C,oBAqBA,CAAA;AAED,eAAO,MAAM,WAAW,EAAE;AACxB;;;;IAII;AACJ,gBAAgB,EAAE,MAAM,EACxB,KAAK,EAAE,KAAK,KACT,KAyHJ,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/field/features/converters/html/field/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAiB,MAAM,eAAe,CAAA;AAGzD,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,qCAAqC,CAAA;AACtF,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAA;AAM1D,KAAK,KAAK,GAAG;IACX;;;;OAIG;IACH,MAAM,CAAC,EAAE,OAAO,CAAA;IAChB,IAAI,EAAE,MAAM,CAAA;CACb,CAAA;AAED;;;;GAIG;AACH,eAAO,MAAM,yBAAyB,sBAEnC;IACD,YAAY,EAAE,2BAA2B,CAAA;CAC1C,KAAG,aAAa,EA+ChB,CAAA;AAED,eAAO,MAAM,WAAW,EAAE;AACxB;;;;IAII;AACJ,gBAAgB,EAAE,MAAM,EACxB,KAAK,EAAE,KAAK,KACT,KAyHJ,CAAA"}
@@ -7,14 +7,42 @@ import { convertLexicalToHTML } from '../converter/index.js';
7
7
  */ export const consolidateHTMLConverters = ({ editorConfig })=>{
8
8
  const htmlConverterFeature = editorConfig.resolvedFeatureMap.get('htmlConverter');
9
9
  const htmlConverterFeatureProps = htmlConverterFeature?.serverFeatureProps;
10
- const defaultConvertersWithConvertersFromFeatures = defaultHTMLConverters;
10
+ const defaultConvertersWithConvertersFromFeatures = [
11
+ ...defaultHTMLConverters
12
+ ];
11
13
  for (const converter of editorConfig.features.converters.html){
12
14
  defaultConvertersWithConvertersFromFeatures.push(converter);
13
15
  }
14
16
  const finalConverters = htmlConverterFeatureProps?.converters && typeof htmlConverterFeatureProps?.converters === 'function' ? htmlConverterFeatureProps.converters({
15
17
  defaultConverters: defaultConvertersWithConvertersFromFeatures
16
18
  }) : htmlConverterFeatureProps?.converters || defaultConvertersWithConvertersFromFeatures;
17
- return finalConverters;
19
+ // filter converters by nodeTypes. The last converter in the list wins. If there are multiple converters for the same nodeType, the last one will be used and the node types will be removed from
20
+ // previous converters. If previous converters do not have any nodeTypes left, they will be removed from the list.
21
+ // This guarantees that user-added converters which are added after the default ones will always have precedence
22
+ const foundNodeTypes = [];
23
+ const filteredConverters = [];
24
+ for (const converter of finalConverters.reverse()){
25
+ if (!converter.nodeTypes?.length) {
26
+ continue;
27
+ }
28
+ const newConverter = {
29
+ converter: converter.converter,
30
+ nodeTypes: [
31
+ ...converter.nodeTypes
32
+ ]
33
+ };
34
+ newConverter.nodeTypes = newConverter.nodeTypes.filter((nodeType)=>{
35
+ if (foundNodeTypes.includes(nodeType)) {
36
+ return false;
37
+ }
38
+ foundNodeTypes.push(nodeType);
39
+ return true;
40
+ });
41
+ if (newConverter.nodeTypes.length) {
42
+ filteredConverters.push(newConverter);
43
+ }
44
+ }
45
+ return filteredConverters;
18
46
  };
19
47
  export const lexicalHTML = (lexicalFieldName, props)=>{
20
48
  const { name = 'lexicalHTML', hidden = true } = props;
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../../src/field/features/converters/html/field/index.ts"],"sourcesContent":["import type { SerializedEditorState } from 'lexical'\nimport type { Field, RichTextField } from 'payload/types'\n\nimport type { AdapterProps, LexicalRichTextAdapter } from '../../../../../types.js'\nimport type { SanitizedServerEditorConfig } from '../../../../lexical/config/types.js'\nimport type { HTMLConverter } from '../converter/types.js'\nimport type { HTMLConverterFeatureProps } from '../feature.server.js'\n\nimport { defaultHTMLConverters } from '../converter/defaultConverters.js'\nimport { convertLexicalToHTML } from '../converter/index.js'\n\ntype Props = {\n /**\n * Whether the lexicalHTML field should be hidden in the admin panel\n *\n * @default true\n */\n hidden?: boolean\n name: string\n}\n\n/**\n * Combines the default HTML converters with HTML converters found in the features, and with HTML converters configured in the htmlConverter feature.\n *\n * @param editorConfig\n */\nexport const consolidateHTMLConverters = ({\n editorConfig,\n}: {\n editorConfig: SanitizedServerEditorConfig\n}) => {\n const htmlConverterFeature = editorConfig.resolvedFeatureMap.get('htmlConverter')\n const htmlConverterFeatureProps: HTMLConverterFeatureProps =\n htmlConverterFeature?.serverFeatureProps\n\n const defaultConvertersWithConvertersFromFeatures = defaultHTMLConverters\n\n for (const converter of editorConfig.features.converters.html) {\n defaultConvertersWithConvertersFromFeatures.push(converter)\n }\n\n const finalConverters =\n htmlConverterFeatureProps?.converters &&\n typeof htmlConverterFeatureProps?.converters === 'function'\n ? htmlConverterFeatureProps.converters({\n defaultConverters: defaultConvertersWithConvertersFromFeatures,\n })\n : (htmlConverterFeatureProps?.converters as HTMLConverter[]) ||\n defaultConvertersWithConvertersFromFeatures\n\n return finalConverters\n}\n\nexport const lexicalHTML: (\n /**\n * A string which matches the lexical field name you want to convert to HTML.\n *\n * This has to be a SIBLING field of this lexicalHTML field - otherwise, it won't be able to find the lexical field.\n **/\n lexicalFieldName: string,\n props: Props,\n) => Field = (lexicalFieldName, props) => {\n const { name = 'lexicalHTML', hidden = true } = props\n return {\n name,\n type: 'code',\n admin: {\n editorOptions: {\n language: 'html',\n },\n hidden,\n },\n hooks: {\n afterRead: [\n async ({ collection, field, global, req, siblingData }) => {\n const fields = collection ? collection.fields : global.fields\n\n // find the path of this field, as well as its sibling fields, by looking for this `field` in fields and traversing it recursively\n function findFieldPathAndSiblingFields(\n fields: Field[],\n path: string[],\n ): {\n path: string[]\n siblingFields: Field[]\n } {\n for (const curField of fields) {\n if (curField === field) {\n return {\n path: [...path, curField.name],\n siblingFields: fields,\n }\n }\n\n if ('fields' in curField) {\n const result = findFieldPathAndSiblingFields(\n curField.fields,\n 'name' in curField ? [...path, curField.name] : [...path],\n )\n if (result) {\n return result\n }\n } else if ('tabs' in curField) {\n for (const tab of curField.tabs) {\n const result = findFieldPathAndSiblingFields(\n tab.fields,\n 'name' in tab ? [...path, tab.name] : [...path],\n )\n if (result) {\n return result\n }\n }\n } else if ('blocks' in curField) {\n for (const block of curField.blocks) {\n if (block?.fields?.length) {\n const result = findFieldPathAndSiblingFields(block.fields, [\n ...path,\n curField.name,\n block.slug,\n ])\n if (result) {\n return result\n }\n }\n }\n }\n }\n\n return null\n }\n\n const foundSiblingFields = findFieldPathAndSiblingFields(fields, [])\n\n if (!foundSiblingFields)\n throw new Error(\n `Could not find sibling fields of current lexicalHTML field with name ${field?.name}`,\n )\n\n const { siblingFields } = foundSiblingFields\n const lexicalField: RichTextField<SerializedEditorState, AdapterProps> =\n siblingFields.find(\n (field) => 'name' in field && field.name === lexicalFieldName,\n ) as RichTextField<SerializedEditorState, AdapterProps>\n\n const lexicalFieldData: SerializedEditorState = siblingData[lexicalFieldName]\n\n if (!lexicalFieldData) {\n return ''\n }\n\n if (!lexicalField) {\n throw new Error(\n 'You cannot use the lexicalHTML field because the referenced lexical field was not found',\n )\n }\n\n const config = (lexicalField?.editor as LexicalRichTextAdapter)?.editorConfig\n\n if (!config) {\n throw new Error(\n 'The linked lexical field does not have an editorConfig. This is needed for the lexicalHTML field.',\n )\n }\n\n if (!config?.resolvedFeatureMap?.has('htmlConverter')) {\n throw new Error(\n 'You cannot use the lexicalHTML field because the linked lexical field does not have a HTMLConverterFeature',\n )\n }\n\n const finalConverters = consolidateHTMLConverters({\n editorConfig: config,\n })\n\n return await convertLexicalToHTML({\n converters: finalConverters,\n data: lexicalFieldData,\n payload: req.payload,\n })\n },\n ],\n },\n }\n}\n"],"names":["defaultHTMLConverters","convertLexicalToHTML","consolidateHTMLConverters","editorConfig","htmlConverterFeature","resolvedFeatureMap","get","htmlConverterFeatureProps","serverFeatureProps","defaultConvertersWithConvertersFromFeatures","converter","features","converters","html","push","finalConverters","defaultConverters","lexicalHTML","lexicalFieldName","props","name","hidden","type","admin","editorOptions","language","hooks","afterRead","collection","field","global","req","siblingData","fields","findFieldPathAndSiblingFields","path","curField","siblingFields","result","tab","tabs","block","blocks","length","slug","foundSiblingFields","Error","lexicalField","find","lexicalFieldData","config","editor","has","data","payload"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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IAAIN,MACR;oBAEJ;oBAEA,MAAM/B,kBAAkBb,0BAA0B;wBAChDC,cAAc+C;oBAChB;oBAEA,OAAO,MAAMjD,qBAAqB;wBAChCW,YAAYG;wBACZsC,MAAMJ;wBACNK,SAASvB,IAAIuB,OAAO;oBACtB;gBACF;aACD;QACH;IACF;AACF,EAAC"}
1
+ {"version":3,"sources":["../../../../../../src/field/features/converters/html/field/index.ts"],"sourcesContent":["import type { SerializedEditorState } from 'lexical'\nimport type { Field, RichTextField } from 'payload/types'\n\nimport type { AdapterProps, LexicalRichTextAdapter } from '../../../../../types.js'\nimport type { SanitizedServerEditorConfig } from '../../../../lexical/config/types.js'\nimport type { HTMLConverter } from '../converter/types.js'\nimport type { HTMLConverterFeatureProps } from '../feature.server.js'\n\nimport { defaultHTMLConverters } from '../converter/defaultConverters.js'\nimport { convertLexicalToHTML } from '../converter/index.js'\n\ntype Props = {\n /**\n * Whether the lexicalHTML field should be hidden in the admin panel\n *\n * @default true\n */\n hidden?: boolean\n name: string\n}\n\n/**\n * Combines the default HTML converters with HTML converters found in the features, and with HTML converters configured in the htmlConverter feature.\n *\n * @param editorConfig\n */\nexport const consolidateHTMLConverters = ({\n editorConfig,\n}: {\n editorConfig: SanitizedServerEditorConfig\n}): HTMLConverter[] => {\n const htmlConverterFeature = editorConfig.resolvedFeatureMap.get('htmlConverter')\n const htmlConverterFeatureProps: HTMLConverterFeatureProps =\n htmlConverterFeature?.serverFeatureProps\n\n const defaultConvertersWithConvertersFromFeatures = [...defaultHTMLConverters]\n\n for (const converter of editorConfig.features.converters.html) {\n defaultConvertersWithConvertersFromFeatures.push(converter)\n }\n\n const finalConverters =\n htmlConverterFeatureProps?.converters &&\n typeof htmlConverterFeatureProps?.converters === 'function'\n ? htmlConverterFeatureProps.converters({\n defaultConverters: defaultConvertersWithConvertersFromFeatures,\n })\n : (htmlConverterFeatureProps?.converters as HTMLConverter[]) ||\n defaultConvertersWithConvertersFromFeatures\n\n // filter converters by nodeTypes. The last converter in the list wins. If there are multiple converters for the same nodeType, the last one will be used and the node types will be removed from\n // previous converters. If previous converters do not have any nodeTypes left, they will be removed from the list.\n // This guarantees that user-added converters which are added after the default ones will always have precedence\n const foundNodeTypes: string[] = []\n const filteredConverters: HTMLConverter[] = []\n for (const converter of finalConverters.reverse()) {\n if (!converter.nodeTypes?.length) {\n continue\n }\n const newConverter: HTMLConverter = {\n converter: converter.converter,\n nodeTypes: [...converter.nodeTypes],\n }\n newConverter.nodeTypes = newConverter.nodeTypes.filter((nodeType) => {\n if (foundNodeTypes.includes(nodeType)) {\n return false\n }\n foundNodeTypes.push(nodeType)\n return true\n })\n\n if (newConverter.nodeTypes.length) {\n filteredConverters.push(newConverter)\n }\n }\n\n return filteredConverters\n}\n\nexport const lexicalHTML: (\n /**\n * A string which matches the lexical field name you want to convert to HTML.\n *\n * This has to be a SIBLING field of this lexicalHTML field - otherwise, it won't be able to find the lexical field.\n **/\n lexicalFieldName: string,\n props: Props,\n) => Field = (lexicalFieldName, props) => {\n const { name = 'lexicalHTML', hidden = true } = props\n return {\n name,\n type: 'code',\n admin: {\n editorOptions: {\n language: 'html',\n },\n hidden,\n },\n hooks: {\n afterRead: [\n async ({ collection, field, global, req, siblingData }) => {\n const fields = collection ? collection.fields : global.fields\n\n // find the path of this field, as well as its sibling fields, by looking for this `field` in fields and traversing it recursively\n function findFieldPathAndSiblingFields(\n fields: Field[],\n path: string[],\n ): {\n path: string[]\n siblingFields: Field[]\n } {\n for (const curField of fields) {\n if (curField === field) {\n return {\n path: [...path, curField.name],\n siblingFields: fields,\n }\n }\n\n if ('fields' in curField) {\n const result = findFieldPathAndSiblingFields(\n curField.fields,\n 'name' in curField ? [...path, curField.name] : [...path],\n )\n if (result) {\n return result\n }\n } else if ('tabs' in curField) {\n for (const tab of curField.tabs) {\n const result = findFieldPathAndSiblingFields(\n tab.fields,\n 'name' in tab ? [...path, tab.name] : [...path],\n )\n if (result) {\n return result\n }\n }\n } else if ('blocks' in curField) {\n for (const block of curField.blocks) {\n if (block?.fields?.length) {\n const result = findFieldPathAndSiblingFields(block.fields, [\n ...path,\n curField.name,\n block.slug,\n ])\n if (result) {\n return result\n }\n }\n }\n }\n }\n\n return null\n }\n\n const foundSiblingFields = findFieldPathAndSiblingFields(fields, [])\n\n if (!foundSiblingFields)\n throw new Error(\n `Could not find sibling fields of current lexicalHTML field with name ${field?.name}`,\n )\n\n const { siblingFields } = foundSiblingFields\n const lexicalField: RichTextField<SerializedEditorState, AdapterProps> =\n siblingFields.find(\n (field) => 'name' in field && field.name === lexicalFieldName,\n ) as RichTextField<SerializedEditorState, AdapterProps>\n\n const lexicalFieldData: SerializedEditorState = siblingData[lexicalFieldName]\n\n if (!lexicalFieldData) {\n return ''\n }\n\n if (!lexicalField) {\n throw new Error(\n 'You cannot use the lexicalHTML field because the referenced lexical field was not found',\n )\n }\n\n const config = (lexicalField?.editor as LexicalRichTextAdapter)?.editorConfig\n\n if (!config) {\n throw new Error(\n 'The linked lexical field does not have an editorConfig. This is needed for the lexicalHTML field.',\n )\n }\n\n if (!config?.resolvedFeatureMap?.has('htmlConverter')) {\n throw new Error(\n 'You cannot use the lexicalHTML field because the linked lexical field does not have a HTMLConverterFeature',\n )\n }\n\n const finalConverters = consolidateHTMLConverters({\n editorConfig: config,\n })\n\n return await convertLexicalToHTML({\n converters: finalConverters,\n data: lexicalFieldData,\n payload: req.payload,\n })\n },\n ],\n },\n }\n}\n"],"names":["defaultHTMLConverters","convertLexicalToHTML","consolidateHTMLConverters","editorConfig","htmlConverterFeature","resolvedFeatureMap","get","htmlConverterFeatureProps","serverFeatureProps","defaultConvertersWithConvertersFromFeatures","converter","features","converters","html","push","finalConverters","defaultConverters","foundNodeTypes","filteredConverters","reverse","nodeTypes","length","newConverter","filter","nodeType","includes","lexicalHTML","lexicalFieldName","props","name","hidden","type","admin","editorOptions","language","hooks","afterRead","collection","field","global","req","siblingData","fields","findFieldPathAndSiblingFields","path","curField","siblingFields","result","tab","tabs","block","blocks","slug","foundSiblingFields","Error","lexicalField","find","lexicalFieldData","config","editor","has","data","payload"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAQA,SAASA,qBAAqB,QAAQ,oCAAmC;AACzE,SAASC,oBAAoB,QAAQ,wBAAuB;AAY5D;;;;CAIC,GACD,OAAO,MAAMC,4BAA4B,CAAC,EACxCC,YAAY,EAGb;IACC,MAAMC,uBAAuBD,aAAaE,kBAAkB,CAACC,GAAG,CAAC;IACjE,MAAMC,4BACJH,sBAAsBI;IAExB,MAAMC,8CAA8C;WAAIT;KAAsB;IAE9E,KAAK,MAAMU,aAAaP,aAAaQ,QAAQ,CAACC,UAAU,CAACC,IAAI,CAAE;QAC7DJ,4CAA4CK,IAAI,CAACJ;IACnD;IAEA,MAAMK,kBACJR,2BAA2BK,cAC3B,OAAOL,2BAA2BK,eAAe,aAC7CL,0BAA0BK,UAAU,CAAC;QACnCI,mBAAmBP;IACrB,KACA,AAACF,2BAA2BK,cAC5BH;IAEN,iMAAiM;IACjM,kHAAkH;IAClH,gHAAgH;IAChH,MAAMQ,iBAA2B,EAAE;IACnC,MAAMC,qBAAsC,EAAE;IAC9C,KAAK,MAAMR,aAAaK,gBAAgBI,OAAO,GAAI;QACjD,IAAI,CAACT,UAAUU,SAAS,EAAEC,QAAQ;YAChC;QACF;QACA,MAAMC,eAA8B;YAClCZ,WAAWA,UAAUA,SAAS;YAC9BU,WAAW;mBAAIV,UAAUU,SAAS;aAAC;QACrC;QACAE,aAAaF,SAAS,GAAGE,aAAaF,SAAS,CAACG,MAAM,CAAC,CAACC;YACtD,IAAIP,eAAeQ,QAAQ,CAACD,WAAW;gBACrC,OAAO;YACT;YACAP,eAAeH,IAAI,CAACU;YACpB,OAAO;QACT;QAEA,IAAIF,a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0B,SAASJ,8BAA8BO,MAAMR,MAAM,EAAE;+CACtDE;4CACHC,SAAShB,IAAI;4CACbqB,MAAME,IAAI;yCACX;wCACD,IAAIL,QAAQ;4CACV,OAAOA;wCACT;oCACF;gCACF;4BACF;wBACF;wBAEA,OAAO;oBACT;oBAEA,MAAMM,qBAAqBV,8BAA8BD,QAAQ,EAAE;oBAEnE,IAAI,CAACW,oBACH,MAAM,IAAIC,MACR,CAAC,qEAAqE,EAAEhB,OAAOT,KAAK,CAAC;oBAGzF,MAAM,EAAEiB,aAAa,EAAE,GAAGO;oBAC1B,MAAME,eACJT,cAAcU,IAAI,CAChB,CAAClB,QAAU,UAAUA,SAASA,MAAMT,IAAI,KAAKF;oBAGjD,MAAM8B,mBAA0ChB,WAAW,CAACd,iBAAiB;oBAE7E,IAAI,CAAC8B,kBAAkB;wBACrB,OAAO;oBACT;oBAEA,IAAI,CAACF,cAAc;wBACjB,MAAM,IAAID,MACR;oBAEJ;oBAEA,MAAMI,SAAUH,cAAcI,QAAmCxD;oBAEjE,IAAI,CAACuD,QAAQ;wBACX,MAAM,IAAIJ,MACR;oBAEJ;oBAEA,IAAI,CAACI,QAAQrD,oBAAoBuD,IAAI,kBAAkB;wBACrD,MAAM,IAAIN,MACR;oBAEJ;oBAEA,MAAMvC,kBAAkBb,0BAA0B;wBAChDC,cAAcuD;oBAChB;oBAEA,OAAO,MAAMzD,qBAAqB;wBAChCW,YAAYG;wBACZ8C,MAAMJ;wBACNK,SAAStB,IAAIsB,OAAO;oBACtB;gBACF;aACD;QACH;IACF;AACF,EAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"feature.client.d.ts","sourceRoot":"","sources":["../../../../src/field/features/heading/feature.client.tsx"],"names":[],"mappings":";AAWA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAA;AA0G9D,eAAO,MAAM,6BAA6B;;;wBAA8C,CAAA"}
1
+ {"version":3,"file":"feature.client.d.ts","sourceRoot":"","sources":["../../../../src/field/features/heading/feature.client.tsx"],"names":[],"mappings":";AAWA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAA;AA+G9D,eAAO,MAAM,6BAA6B;;;wBAA8C,CAAA"}
@@ -10,6 +10,7 @@ import { H4Icon } from '../../lexical/ui/icons/H4/index.js';
10
10
  import { H5Icon } from '../../lexical/ui/icons/H5/index.js';
11
11
  import { H6Icon } from '../../lexical/ui/icons/H6/index.js';
12
12
  import { createClientComponent } from '../createClientComponent.js';
13
+ import { slashMenuBasicGroupWithItems } from '../shared/slashMenu/basicGroup.js';
13
14
  import { toolbarTextDropdownGroupWithItems } from '../shared/toolbar/textDropdownGroup.js';
14
15
  import { MarkdownTransformer } from './markdownTransformer.js';
15
16
  const $setHeading = (headingSize)=>{
@@ -57,7 +58,11 @@ const HeadingFeatureClient = (props)=>{
57
58
  return true;
58
59
  },
59
60
  key: headingSize,
60
- label: `Heading ${headingSize.charAt(1)}`,
61
+ label: ({ i18n })=>{
62
+ return i18n.t('lexical:heading:label', {
63
+ headingLevel: headingSize.charAt(1)
64
+ });
65
+ },
61
66
  onSelect: ({ editor })=>{
62
67
  editor.update(()=>{
63
68
  $setHeading(headingSize);
@@ -77,26 +82,26 @@ const HeadingFeatureClient = (props)=>{
77
82
  ],
78
83
  slashMenu: {
79
84
  groups: enabledHeadingSizes?.length ? [
80
- {
81
- items: enabledHeadingSizes.map((headingSize)=>{
82
- return {
83
- Icon: iconImports[headingSize],
84
- key: `heading-${headingSize.charAt(1)}`,
85
- keywords: [
86
- 'heading',
87
- headingSize
88
- ],
89
- label: `Heading ${headingSize.charAt(1)}`,
90
- onSelect: ({ editor })=>{
91
- editor.update(()=>{
92
- $setHeading(headingSize);
93
- });
94
- }
95
- };
96
- }),
97
- key: 'basic',
98
- label: 'Basic'
99
- }
85
+ slashMenuBasicGroupWithItems(enabledHeadingSizes.map((headingSize)=>{
86
+ return {
87
+ Icon: iconImports[headingSize],
88
+ key: `heading-${headingSize.charAt(1)}`,
89
+ keywords: [
90
+ 'heading',
91
+ headingSize
92
+ ],
93
+ label: ({ i18n })=>{
94
+ return i18n.t('lexical:heading:label', {
95
+ headingLevel: headingSize.charAt(1)
96
+ });
97
+ },
98
+ onSelect: ({ editor })=>{
99
+ editor.update(()=>{
100
+ $setHeading(headingSize);
101
+ });
102
+ }
103
+ };
104
+ }))
100
105
  ] : []
101
106
  },
102
107
  toolbarFixed: {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/field/features/heading/feature.client.tsx"],"sourcesContent":["'use client'\n\nimport type { HeadingTagType } from '@lexical/rich-text'\n\nimport { $isHeadingNode } from '@lexical/rich-text'\nimport { $createHeadingNode, HeadingNode } from '@lexical/rich-text'\nimport { $setBlocksType } from '@lexical/selection'\nimport { $getSelection, $isRangeSelection } from 'lexical'\n\nimport type { ToolbarGroup } from '../toolbars/types.js'\nimport type { FeatureProviderProviderClient } from '../types.js'\nimport type { HeadingFeatureProps } from './feature.server.js'\n\nimport { H1Icon } from '../../lexical/ui/icons/H1/index.js'\nimport { H2Icon } from '../../lexical/ui/icons/H2/index.js'\nimport { H3Icon } from '../../lexical/ui/icons/H3/index.js'\nimport { H4Icon } from '../../lexical/ui/icons/H4/index.js'\nimport { H5Icon } from '../../lexical/ui/icons/H5/index.js'\nimport { H6Icon } from '../../lexical/ui/icons/H6/index.js'\nimport { createClientComponent } from '../createClientComponent.js'\nimport { toolbarTextDropdownGroupWithItems } from '../shared/toolbar/textDropdownGroup.js'\nimport { MarkdownTransformer } from './markdownTransformer.js'\n\nconst $setHeading = (headingSize: HeadingTagType) => {\n const selection = $getSelection()\n $setBlocksType(selection, () => $createHeadingNode(headingSize))\n}\n\nconst iconImports = {\n h1: H1Icon,\n h2: H2Icon,\n h3: H3Icon,\n h4: H4Icon,\n h5: H5Icon,\n h6: H6Icon,\n}\n\nconst HeadingFeatureClient: FeatureProviderProviderClient<HeadingFeatureProps> = (props) => {\n return {\n clientFeatureProps: props,\n feature: () => {\n const { enabledHeadingSizes = ['h1', 'h2', 'h3', 'h4', 'h5', 'h6'] } = props\n\n const toolbarGroups: ToolbarGroup[] = [\n toolbarTextDropdownGroupWithItems(\n enabledHeadingSizes.map((headingSize, i) => {\n return {\n ChildComponent: iconImports[headingSize],\n isActive: ({ selection }) => {\n if (!$isRangeSelection(selection)) {\n return false\n }\n for (const node of selection.getNodes()) {\n if ($isHeadingNode(node) && node.getTag() === headingSize) {\n continue\n }\n\n const parent = node.getParent()\n if ($isHeadingNode(parent) && parent.getTag() === headingSize) {\n continue\n }\n\n return false\n }\n return true\n },\n key: headingSize,\n label: `Heading ${headingSize.charAt(1)}`,\n onSelect: ({ editor }) => {\n editor.update(() => {\n $setHeading(headingSize)\n })\n },\n order: i + 2,\n }\n }),\n ),\n ]\n\n return {\n clientFeatureProps: props,\n markdownTransformers: [MarkdownTransformer(enabledHeadingSizes)],\n nodes: [HeadingNode],\n slashMenu: {\n groups: enabledHeadingSizes?.length\n ? [\n {\n items: enabledHeadingSizes.map((headingSize) => {\n return {\n Icon: iconImports[headingSize],\n key: `heading-${headingSize.charAt(1)}`,\n keywords: ['heading', headingSize],\n label: `Heading ${headingSize.charAt(1)}`,\n onSelect: ({ editor }) => {\n editor.update(() => {\n $setHeading(headingSize)\n })\n },\n }\n }),\n key: 'basic',\n label: 'Basic',\n },\n ]\n : [],\n },\n toolbarFixed: {\n groups: enabledHeadingSizes?.length ? toolbarGroups : [],\n },\n toolbarInline: {\n groups: enabledHeadingSizes?.length ? toolbarGroups : [],\n },\n }\n },\n }\n}\n\nexport const HeadingFeatureClientComponent = createClientComponent(HeadingFeatureClient)\n"],"names":["$isHeadingNode","$createHeadingNode","HeadingNode","$setBlocksType","$getSelection","$isRangeSelection","H1Icon","H2Icon","H3Icon","H4Icon","H5Icon","H6Icon","createClientComponent","toolbarTextDropdownGroupWithItems","MarkdownTransformer","$setHeading","headingSize","selection","iconImports","h1","h2","h3","h4","h5","h6","HeadingFeatureClient","props","clientFeatureProps","feature","enabledHeadingSizes","toolbarGroups","map","i","ChildComponent","isActive","node","getNodes","getTag","parent","getParent","key","label","charAt","onSelect","editor","update","order","markdownTransformers","nodes","slashMenu","groups","length","items","Icon","keywords","toolbarFixed","toolbarInline","HeadingFeatureClientComponent"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA;AAIA,SAASA,cAAc,QAAQ,qBAAoB;AACnD,SAASC,kBAAkB,EAAEC,WAAW,QAAQ,qBAAoB;AACpE,SAASC,cAAc,QAAQ,qBAAoB;AACnD,SAASC,aAAa,EAAEC,iBAAiB,QAAQ,UAAS;AAM1D,SAASC,MAAM,QAAQ,qCAAoC;AAC3D,SAASC,MAAM,QAAQ,qCAAoC;AAC3D,SAASC,MAAM,QAAQ,qCAAoC;AAC3D,SAASC,MAAM,QAAQ,qCAAoC;AAC3D,SAASC,MAAM,QAAQ,qCAAoC;AAC3D,SAASC,MAAM,QAAQ,qCAAoC;AAC3D,SAASC,qBAAqB,QAAQ,8BAA6B;AACnE,SAASC,iCAAiC,QAAQ,yCAAwC;AAC1F,SAASC,mBAAmB,QAAQ,2BAA0B;AAE9D,MAAMC,cAAc,CAACC;IACnB,MAAMC,YAAYb;IAClBD,eAAec,WAAW,IAAMhB,mBAAmBe;AACrD;AAEA,MAAME,cAAc;IAClBC,IAAIb;IACJc,IAAIb;IACJc,IAAIb;IACJc,IAAIb;IACJc,IAAIb;IACJc,IAAIb;AACN;AAEA,MAAMc,uBAA2E,CAACC;IAChF,OAAO;QACLC,oBAAoBD;QACpBE,SAAS;YACP,MAAM,EAAEC,sBAAsB;gBAAC;gBAAM;gBAAM;gBAAM;gBAAM;gBAAM;aAAK,EAAE,GAAGH;YAEvE,MAAMI,gBAAgC;gBACpCjB,kCACEgB,oBAAoBE,GAAG,CAAC,CAACf,aAAagB;oBACpC,OA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BACZL,QAAQrB,qBAAqBsB,SAASrB,gBAAgB,EAAE;gBAC1D;gBACA0B,eAAe;oBACbN,QAAQrB,qBAAqBsB,SAASrB,gBAAgB,EAAE;gBAC1D;YACF;QACF;IACF;AACF;AAEA,OAAO,MAAM2B,gCAAgC7C,sBAAsBa,sBAAqB"}
1
+ {"version":3,"sources":["../../../../src/field/features/heading/feature.client.tsx"],"sourcesContent":["'use client'\n\nimport type { HeadingTagType } from '@lexical/rich-text'\n\nimport { $isHeadingNode } from '@lexical/rich-text'\nimport { $createHeadingNode, HeadingNode } from '@lexical/rich-text'\nimport { $setBlocksType } from '@lexical/selection'\nimport { $getSelection, $isRangeSelection } from 'lexical'\n\nimport type { ToolbarGroup } from '../toolbars/types.js'\nimport type { FeatureProviderProviderClient } from '../types.js'\nimport type { HeadingFeatureProps } from './feature.server.js'\n\nimport { H1Icon } from '../../lexical/ui/icons/H1/index.js'\nimport { H2Icon } from '../../lexical/ui/icons/H2/index.js'\nimport { H3Icon } from '../../lexical/ui/icons/H3/index.js'\nimport { H4Icon } from '../../lexical/ui/icons/H4/index.js'\nimport { H5Icon } from '../../lexical/ui/icons/H5/index.js'\nimport { H6Icon } from '../../lexical/ui/icons/H6/index.js'\nimport { createClientComponent } from '../createClientComponent.js'\nimport { slashMenuBasicGroupWithItems } from '../shared/slashMenu/basicGroup.js'\nimport { toolbarTextDropdownGroupWithItems } from '../shared/toolbar/textDropdownGroup.js'\nimport { MarkdownTransformer } from './markdownTransformer.js'\n\nconst $setHeading = (headingSize: HeadingTagType) => {\n const selection = $getSelection()\n $setBlocksType(selection, () => $createHeadingNode(headingSize))\n}\n\nconst iconImports = {\n h1: H1Icon,\n h2: H2Icon,\n h3: H3Icon,\n h4: H4Icon,\n h5: H5Icon,\n h6: H6Icon,\n}\n\nconst HeadingFeatureClient: FeatureProviderProviderClient<HeadingFeatureProps> = (props) => {\n return {\n clientFeatureProps: props,\n feature: () => {\n const { enabledHeadingSizes = ['h1', 'h2', 'h3', 'h4', 'h5', 'h6'] } = props\n\n const toolbarGroups: ToolbarGroup[] = [\n toolbarTextDropdownGroupWithItems(\n enabledHeadingSizes.map((headingSize, i) => {\n return {\n ChildComponent: iconImports[headingSize],\n isActive: ({ selection }) => {\n if (!$isRangeSelection(selection)) {\n return false\n }\n for (const node of selection.getNodes()) {\n if ($isHeadingNode(node) && node.getTag() === headingSize) {\n continue\n }\n\n const parent = node.getParent()\n if ($isHeadingNode(parent) && parent.getTag() === headingSize) {\n continue\n }\n\n return false\n }\n return true\n },\n key: headingSize,\n label: ({ i18n }) => {\n return i18n.t('lexical:heading:label', { headingLevel: headingSize.charAt(1) })\n },\n onSelect: ({ editor }) => {\n editor.update(() => {\n $setHeading(headingSize)\n })\n },\n order: i + 2,\n }\n }),\n ),\n ]\n\n return {\n clientFeatureProps: props,\n markdownTransformers: [MarkdownTransformer(enabledHeadingSizes)],\n nodes: [HeadingNode],\n slashMenu: {\n groups: enabledHeadingSizes?.length\n ? [\n slashMenuBasicGroupWithItems(\n enabledHeadingSizes.map((headingSize) => {\n return {\n Icon: iconImports[headingSize],\n key: `heading-${headingSize.charAt(1)}`,\n keywords: ['heading', headingSize],\n label: ({ i18n }) => {\n return i18n.t('lexical:heading:label', {\n headingLevel: headingSize.charAt(1),\n })\n },\n onSelect: ({ editor }) => {\n editor.update(() => {\n $setHeading(headingSize)\n })\n },\n }\n }),\n ),\n ]\n : [],\n },\n toolbarFixed: {\n groups: enabledHeadingSizes?.length ? toolbarGroups : [],\n },\n toolbarInline: {\n groups: enabledHeadingSizes?.length ? toolbarGroups : [],\n },\n }\n },\n }\n}\n\nexport const HeadingFeatureClientComponent = createClientComponent(HeadingFeatureClient)\n"],"names":["$isHeadingNode","$createHeadingNode","HeadingNode","$setBlocksType","$getSelection","$isRangeSelection","H1Icon","H2Icon","H3Icon","H4Icon","H5Icon","H6Icon","createClientComponent","slashMenuBasicGroupWithItems","toolbarTextDropdownGroupWithItems","MarkdownTransformer","$setHeading","headingSize","selection","iconImports","h1","h2","h3","h4","h5","h6","HeadingFeatureClient","props","clientFeatureProps","feature","enabledHeadingSizes","toolbarGroups","map","i","ChildComponent","isActive","node","getNodes","getTag","parent","getParent","key","label","i18n","t","headingLevel","charAt","onSelect","editor","update","order","markdownTransformers","nodes","slashMenu","groups","length","Icon","keywords","toolbarFixed","toolbarInline","HeadingFeatureClientComponent"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA;AAIA,SAASA,cAAc,QAAQ,qBAAoB;AACnD,SAASC,kBAAkB,EAAEC,WAAW,QAAQ,qBAAoB;AACpE,SAASC,cAAc,QAAQ,qBAAoB;AACnD,SAASC,aAAa,EAAEC,iBAAiB,QAAQ,UAAS;AAM1D,SAASC,MAAM,QAAQ,qCAAoC;AAC3D,SAASC,MAAM,QAAQ,qCAAoC;AAC3D,SAASC,MAAM,QAAQ,qCAAoC;AAC3D,SAASC,MAAM,QAAQ,qCAAoC;AAC3D,SAASC,MAAM,QAAQ,qCAAoC;AAC3D,SAASC,MAAM,QAAQ,qCAAoC;AAC3D,SAASC,qBAAqB,QAAQ,8BAA6B;AACnE,SAASC,4BAA4B,QAAQ,oCAAmC;AAChF,SAASC,iCAAiC,QAAQ,yCAAwC;AAC1F,SAASC,mBAAmB,QAAQ,2BAA0B;AAE9D,MAAMC,cAAc,CAACC;IACnB,MAAMC,YAAYd;IAClBD,eAAee,WAAW,IAAMjB,mBAAmBgB;AACrD;AAEA,MAAME,cAAc;IAClBC,IAAId;IACJe,IAAId;IACJe,IAAId;IACJe,IAAId;IACJe,IAAId;IACJe,IAAId;AACN;AAEA,MAAMe,uBAA2E,CAACC;IAChF,OAAO;QACLC,oBAAoBD;QACpBE,SAAS;YACP,MAAM,EAAEC,sBAAsB;gBAAC;gBAAM;gBAAM;gBAAM;gBAAM;gBA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ACrCC,cAAc5B,YAAY6B,MAAM,CAAC;oCACnC;gCACF;gCACAC,UAAU,CAAC,EAAEC,MAAM,EAAE;oCACnBA,OAAOC,MAAM,CAAC;wCACZjC,YAAYC;oCACd;gCACF;4BACF;wBACF;qBAEH,GACD,EAAE;gBACR;gBACAyC,cAAc;oBACZJ,QAAQxB,qBAAqByB,SAASxB,gBAAgB,EAAE;gBAC1D;gBACA4B,eAAe;oBACbL,QAAQxB,qBAAqByB,SAASxB,gBAAgB,EAAE;gBAC1D;YACF;QACF;IACF;AACF;AAEA,OAAO,MAAM6B,gCAAgChD,sBAAsBc,sBAAqB"}
@@ -1 +1 @@
1
- {"version":3,"file":"feature.server.d.ts","sourceRoot":"","sources":["../../../../src/field/features/heading/feature.server.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAA;AAIxD,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,aAAa,CAAA;AAOhE,MAAM,MAAM,mBAAmB,GAAG;IAChC,mBAAmB,CAAC,EAAE,cAAc,EAAE,CAAA;CACvC,CAAA;AAED,eAAO,MAAM,cAAc,EAAE,6BAA6B,CACxD,mBAAmB,EACnB,mBAAmB,CA2CpB,CAAA"}
1
+ {"version":3,"file":"feature.server.d.ts","sourceRoot":"","sources":["../../../../src/field/features/heading/feature.server.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAA;AAIxD,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,aAAa,CAAA;AAQhE,MAAM,MAAM,mBAAmB,GAAG;IAChC,mBAAmB,CAAC,EAAE,cAAc,EAAE,CAAA;CACvC,CAAA;AAED,eAAO,MAAM,cAAc,EAAE,6BAA6B,CACxD,mBAAmB,EACnB,mBAAmB,CA4CpB,CAAA"}
@@ -2,6 +2,7 @@ import { HeadingNode } from '@lexical/rich-text';
2
2
  import { convertLexicalNodesToHTML } from '../converters/html/converter/index.js';
3
3
  import { createNode } from '../typeUtilities.js';
4
4
  import { HeadingFeatureClientComponent } from './feature.client.js';
5
+ import { i18n } from './i18n.js';
5
6
  import { MarkdownTransformer } from './markdownTransformer.js';
6
7
  export const HeadingFeature = (props)=>{
7
8
  if (!props) {
@@ -20,6 +21,7 @@ export const HeadingFeature = (props)=>{
20
21
  return {
21
22
  ClientComponent: HeadingFeatureClientComponent,
22
23
  clientFeatureProps: props,
24
+ i18n,
23
25
  markdownTransformers: [
24
26
  MarkdownTransformer(enabledHeadingSizes)
25
27
  ],
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/field/features/heading/feature.server.ts"],"sourcesContent":["import type { HeadingTagType } from '@lexical/rich-text'\n\nimport { HeadingNode } from '@lexical/rich-text'\n\nimport type { FeatureProviderProviderServer } from '../types.js'\n\nimport { convertLexicalNodesToHTML } from '../converters/html/converter/index.js'\nimport { createNode } from '../typeUtilities.js'\nimport { HeadingFeatureClientComponent } from './feature.client.js'\nimport { MarkdownTransformer } from './markdownTransformer.js'\n\nexport type HeadingFeatureProps = {\n enabledHeadingSizes?: HeadingTagType[]\n}\n\nexport const HeadingFeature: FeatureProviderProviderServer<\n HeadingFeatureProps,\n HeadingFeatureProps\n> = (props) => {\n if (!props) {\n props = {}\n }\n\n const { enabledHeadingSizes = ['h1', 'h2', 'h3', 'h4', 'h5', 'h6'] } = props\n\n return {\n feature: () => {\n return {\n ClientComponent: HeadingFeatureClientComponent,\n clientFeatureProps: props,\n markdownTransformers: [MarkdownTransformer(enabledHeadingSizes)],\n nodes: [\n createNode({\n converters: {\n html: {\n converter: async ({ converters, node, parent, payload }) => {\n const childrenText = await convertLexicalNodesToHTML({\n converters,\n lexicalNodes: node.children,\n parent: {\n ...node,\n parent,\n },\n payload,\n })\n\n return '<' + node?.tag + '>' + childrenText + '</' + node?.tag + '>'\n },\n nodeTypes: [HeadingNode.getType()],\n },\n },\n node: HeadingNode,\n }),\n ],\n serverFeatureProps: props,\n }\n },\n key: 'heading',\n serverFeatureProps: props,\n }\n}\n"],"names":["HeadingNode","convertLexicalNodesToHTML","createNode","HeadingFeatureClientComponent","MarkdownTransformer","HeadingFeature","props","enabledHeadingSizes","feature","ClientComponent","clientFeatureProps","markdownTransformers","nodes","converters","html","converter","node","parent","payload","childrenText","lexicalNodes","children","tag","nodeTypes","getType","serverFeatureProps","key"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAEA,SAASA,WAAW,QAAQ,qBAAoB;AAIhD,SAASC,yBAAyB,QAAQ,wCAAuC;AACjF,SAASC,UAAU,QAAQ,sBAAqB;AAChD,SAASC,6BAA6B,QAAQ,sBAAqB;AACnE,SAASC,mBAAmB,QAAQ,2BAA0B;AAM9D,OAAO,MAAMC,iBAGT,CAACC;IACH,IAAI,CAACA,OAAO;QACVA,QAAQ,CAAC;IACX;IAEA,MAAM,EAAEC,sBAAsB;QAAC;QAAM;QAAM;QAAM;QAAM;QAAM;KAAK,EAAE,GAAGD;IAEvE,OAAO;QACLE,SAAS;YACP,OAAO;gBACLC,iBAAiBN;gBACjBO,oBAAoBJ;gBACpBK,sBAAsB;oBAACP,oBAAoBG;iBAAqB;gBAChEK,OAAO;oBACLV,WAAW;wBACTW,YAAY;4BACVC,MAAM;gCACJC,WAAW,OAAO,EAAEF,UAAU,EAAEG,IAAI,EAAEC,MAAM,EAAEC,OAAO,EAAE;oCACrD,MAAMC,eAAe,MAAMlB,0BAA0B;wCACnDY;wCACAO,cAAcJ,KAAKK,QAAQ;wCAC3BJ,QAAQ;4CACN,GAAGD,IAAI;4CACPC;wCACF;wCACAC;oCACF;oCAEA,OAAO,MAAMF,MAAMM,MAAM,MAAMH,eAAe,OAAOH,MAAMM,MAAM;gCACnE;gCACAC,WAAW;oCAACvB,YAAYwB,OAAO;iCAAG;4BACpC;wBACF;wBACAR,MAAMhB;oBACR;iBACD;gBACDyB,oBAAoBnB;YACtB;QACF;QACAoB,KAAK;QACLD,oBAAoBnB;IACtB;AACF,EAAC"}
1
+ {"version":3,"sources":["../../../../src/field/features/heading/feature.server.ts"],"sourcesContent":["import type { HeadingTagType } from '@lexical/rich-text'\n\nimport { HeadingNode } from '@lexical/rich-text'\n\nimport type { FeatureProviderProviderServer } from '../types.js'\n\nimport { convertLexicalNodesToHTML } from '../converters/html/converter/index.js'\nimport { createNode } from '../typeUtilities.js'\nimport { HeadingFeatureClientComponent } from './feature.client.js'\nimport { i18n } from './i18n.js'\nimport { MarkdownTransformer } from './markdownTransformer.js'\n\nexport type HeadingFeatureProps = {\n enabledHeadingSizes?: HeadingTagType[]\n}\n\nexport const HeadingFeature: FeatureProviderProviderServer<\n HeadingFeatureProps,\n HeadingFeatureProps\n> = (props) => {\n if (!props) {\n props = {}\n }\n\n const { enabledHeadingSizes = ['h1', 'h2', 'h3', 'h4', 'h5', 'h6'] } = props\n\n return {\n feature: () => {\n return {\n ClientComponent: HeadingFeatureClientComponent,\n clientFeatureProps: props,\n i18n,\n markdownTransformers: [MarkdownTransformer(enabledHeadingSizes)],\n nodes: [\n createNode({\n converters: {\n html: {\n converter: async ({ converters, node, parent, payload }) => {\n const childrenText = await convertLexicalNodesToHTML({\n converters,\n lexicalNodes: node.children,\n parent: {\n ...node,\n parent,\n },\n payload,\n })\n\n return '<' + node?.tag + '>' + childrenText + '</' + node?.tag + '>'\n },\n nodeTypes: [HeadingNode.getType()],\n },\n },\n node: HeadingNode,\n }),\n ],\n serverFeatureProps: props,\n }\n },\n key: 'heading',\n serverFeatureProps: props,\n }\n}\n"],"names":["HeadingNode","convertLexicalNodesToHTML","createNode","HeadingFeatureClientComponent","i18n","MarkdownTransformer","HeadingFeature","props","enabledHeadingSizes","feature","ClientComponent","clientFeatureProps","markdownTransformers","nodes","converters","html","converter","node","parent","payload","childrenText","lexicalNodes","children","tag","nodeTypes","getType","serverFeatureProps","key"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAEA,SAASA,WAAW,QAAQ,qBAAoB;AAIhD,SAASC,yBAAyB,QAAQ,wCAAuC;AACjF,SAASC,UAAU,QAAQ,sBAAqB;AAChD,SAASC,6BAA6B,QAAQ,sBAAqB;AACnE,SAASC,IAAI,QAAQ,YAAW;AAChC,SAASC,mBAAmB,QAAQ,2BAA0B;AAM9D,OAAO,MAAMC,iBAGT,CAACC;IACH,IAAI,CAACA,OAAO;QACVA,QAAQ,CAAC;IACX;IAEA,MAAM,EAAEC,sBAAsB;QAAC;QAAM;QAAM;QAAM;QAAM;QAAM;KAAK,EAAE,GAAGD;IAEvE,OAAO;QACLE,SAAS;YACP,OAAO;gBACLC,iBAAiBP;gBACjBQ,oBAAoBJ;gBACpBH;gBACAQ,sBAAsB;oBAACP,oBAAoBG;iBAAqB;gBAChEK,OAAO;oBACLX,WAAW;wBACTY,YAAY;4BACVC,MAAM;gCACJC,WAAW,OAAO,EAAEF,UAAU,EAAEG,IAAI,EAAEC,MAAM,EAAEC,OAAO,EAAE;oCACrD,MAAMC,eAAe,MAAMnB,0BAA0B;wCACnDa;wCACAO,cAAcJ,KAAKK,QAAQ;wCAC3BJ,QAAQ;4CACN,GAAGD,IAAI;4CACPC;wCACF;wCACAC;oCACF;oCAEA,OAAO,MAAMF,MAAMM,MAAM,MAAMH,eAAe,OAAOH,MAAMM,MAAM;gCACnE;gCACAC,WAAW;oCAACxB,YAAYyB,OAAO;iCAAG;4BACpC;wBACF;wBACAR,MAAMjB;oBACR;iBACD;gBACD0B,oBAAoBnB;YACtB;QACF;QACAoB,KAAK;QACLD,oBAAoBnB;IACtB;AACF,EAAC"}
@@ -0,0 +1,3 @@
1
+ import type { GenericLanguages } from '@payloadcms/translations';
2
+ export declare const i18n: Partial<GenericLanguages>;
3
+ //# sourceMappingURL=i18n.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"i18n.d.ts","sourceRoot":"","sources":["../../../../src/field/features/heading/i18n.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAA;AAEhE,eAAO,MAAM,IAAI,EAAE,OAAO,CAAC,gBAAgB,CAiG1C,CAAA"}