@payloadcms/richtext-lexical 3.0.0-canary.b8dd0db → 3.0.0-canary.bb00d64

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 (512) hide show
  1. package/dist/cell/rscEntry.d.ts +12 -0
  2. package/dist/cell/rscEntry.d.ts.map +1 -0
  3. package/dist/cell/rscEntry.js +82 -0
  4. package/dist/cell/rscEntry.js.map +1 -0
  5. package/dist/exports/client/Field-LKCJPU2R.js +2 -0
  6. package/dist/exports/client/Field-LKCJPU2R.js.map +7 -0
  7. package/dist/exports/client/RelationshipComponent-IMM4CFBE.js +2 -0
  8. package/dist/exports/client/RelationshipComponent-IMM4CFBE.js.map +7 -0
  9. package/dist/exports/client/bundled.css +1 -1
  10. package/dist/exports/client/chunk-5PBXL4HT.js +2 -0
  11. package/dist/exports/client/chunk-5PBXL4HT.js.map +7 -0
  12. package/dist/exports/client/chunk-NNE6RSU5.js +2 -0
  13. package/dist/exports/client/chunk-NNE6RSU5.js.map +7 -0
  14. package/dist/exports/client/{chunk-LGUXX2QH.js → chunk-O4IOO4EU.js} +2 -2
  15. package/dist/exports/client/{chunk-LGUXX2QH.js.map → chunk-O4IOO4EU.js.map} +2 -2
  16. package/dist/exports/client/chunk-PDAZFJVO.js +2 -0
  17. package/dist/exports/client/chunk-PDAZFJVO.js.map +7 -0
  18. package/dist/exports/client/chunk-PSABE6CO.js +2 -0
  19. package/dist/exports/client/chunk-PSABE6CO.js.map +7 -0
  20. package/dist/exports/client/{chunk-V2LKLT2F.js → chunk-XCEM47RI.js} +3 -3
  21. package/dist/exports/client/{chunk-V2LKLT2F.js.map → chunk-XCEM47RI.js.map} +3 -3
  22. package/dist/exports/client/chunk-ZFVIUTHB.js +2 -0
  23. package/dist/exports/client/chunk-ZFVIUTHB.js.map +7 -0
  24. package/dist/exports/client/{chunk-OKMIHD2R.js → chunk-ZOYGBIAN.js} +2 -2
  25. package/dist/exports/client/{chunk-OKMIHD2R.js.map → chunk-ZOYGBIAN.js.map} +2 -2
  26. package/dist/exports/client/component-4OBXHYCD.js +2 -0
  27. package/dist/exports/client/component-4OBXHYCD.js.map +7 -0
  28. package/dist/exports/client/component-ANB7VZLA.js +2 -0
  29. package/dist/exports/client/component-ANB7VZLA.js.map +7 -0
  30. package/dist/exports/client/component-P25AKAUU.js +2 -0
  31. package/dist/exports/client/component-P25AKAUU.js.map +7 -0
  32. package/dist/exports/client/componentInline-N5LJ2LY2.js +2 -0
  33. package/dist/exports/client/componentInline-N5LJ2LY2.js.map +7 -0
  34. package/dist/exports/client/index.d.ts +3 -4
  35. package/dist/exports/client/index.d.ts.map +1 -1
  36. package/dist/exports/client/index.js +7 -7
  37. package/dist/exports/client/index.js.map +4 -4
  38. package/dist/exports/server/rsc.d.ts +3 -0
  39. package/dist/exports/server/rsc.d.ts.map +1 -0
  40. package/dist/exports/server/rsc.js +3 -0
  41. package/dist/exports/server/rsc.js.map +1 -0
  42. package/dist/features/align/client/index.d.ts +1 -4
  43. package/dist/features/align/client/index.d.ts.map +1 -1
  44. package/dist/features/blockquote/client/index.d.ts +1 -4
  45. package/dist/features/blockquote/client/index.d.ts.map +1 -1
  46. package/dist/features/blockquote/markdownTransformer.js.map +1 -1
  47. package/dist/features/blockquote/server/index.d.ts +1 -1
  48. package/dist/features/blockquote/server/index.d.ts.map +1 -1
  49. package/dist/features/blockquote/server/index.js +5 -1
  50. package/dist/features/blockquote/server/index.js.map +1 -1
  51. package/dist/features/blocks/client/component/BlockContent.d.ts +1 -0
  52. package/dist/features/blocks/client/component/BlockContent.d.ts.map +1 -1
  53. package/dist/features/blocks/client/component/BlockContent.js +28 -28
  54. package/dist/features/blocks/client/component/BlockContent.js.map +1 -1
  55. package/dist/features/blocks/client/component/index.d.ts +1 -1
  56. package/dist/features/blocks/client/component/index.d.ts.map +1 -1
  57. package/dist/features/blocks/client/component/index.js +94 -55
  58. package/dist/features/blocks/client/component/index.js.map +1 -1
  59. package/dist/features/blocks/client/componentInline/index.d.ts +1 -1
  60. package/dist/features/blocks/client/componentInline/index.d.ts.map +1 -1
  61. package/dist/features/blocks/client/componentInline/index.js +27 -29
  62. package/dist/features/blocks/client/componentInline/index.js.map +1 -1
  63. package/dist/features/blocks/client/index.d.ts +1 -4
  64. package/dist/features/blocks/client/index.d.ts.map +1 -1
  65. package/dist/features/blocks/client/index.js +35 -23
  66. package/dist/features/blocks/client/index.js.map +1 -1
  67. package/dist/features/blocks/client/nodes/BlocksNode.d.ts +2 -2
  68. package/dist/features/blocks/client/nodes/BlocksNode.d.ts.map +1 -1
  69. package/dist/features/blocks/client/nodes/BlocksNode.js.map +1 -1
  70. package/dist/features/blocks/client/plugin/index.d.ts +2 -2
  71. package/dist/features/blocks/client/plugin/index.d.ts.map +1 -1
  72. package/dist/features/blocks/client/plugin/index.js +96 -93
  73. package/dist/features/blocks/client/plugin/index.js.map +1 -1
  74. package/dist/features/blocks/server/index.d.ts.map +1 -1
  75. package/dist/features/blocks/server/index.js +41 -27
  76. package/dist/features/blocks/server/index.js.map +1 -1
  77. package/dist/features/blocks/server/nodes/BlocksNode.d.ts +11 -5
  78. package/dist/features/blocks/server/nodes/BlocksNode.d.ts.map +1 -1
  79. package/dist/features/blocks/server/nodes/BlocksNode.js.map +1 -1
  80. package/dist/features/blocks/server/nodes/InlineBlocksNode.d.ts +3 -3
  81. package/dist/features/blocks/server/nodes/InlineBlocksNode.d.ts.map +1 -1
  82. package/dist/features/blocks/server/nodes/InlineBlocksNode.js.map +1 -1
  83. package/dist/features/blocks/server/validate.d.ts.map +1 -1
  84. package/dist/features/blocks/server/validate.js +8 -5
  85. package/dist/features/blocks/server/validate.js.map +1 -1
  86. package/dist/features/converters/html/converter/converters/paragraph.d.ts.map +1 -1
  87. package/dist/features/converters/html/converter/converters/paragraph.js +4 -0
  88. package/dist/features/converters/html/converter/converters/paragraph.js.map +1 -1
  89. package/dist/features/converters/html/converter/converters/text.d.ts.map +1 -1
  90. package/dist/features/converters/html/converter/converters/text.js +2 -1
  91. package/dist/features/converters/html/converter/converters/text.js.map +1 -1
  92. package/dist/features/converters/html/converter/index.d.ts +11 -7
  93. package/dist/features/converters/html/converter/index.d.ts.map +1 -1
  94. package/dist/features/converters/html/converter/index.js +17 -1
  95. package/dist/features/converters/html/converter/index.js.map +1 -1
  96. package/dist/features/converters/html/converter/types.d.ts +3 -1
  97. package/dist/features/converters/html/converter/types.d.ts.map +1 -1
  98. package/dist/features/converters/html/converter/types.js.map +1 -1
  99. package/dist/features/converters/html/field/index.d.ts.map +1 -1
  100. package/dist/features/converters/html/field/index.js +7 -1
  101. package/dist/features/converters/html/field/index.js.map +1 -1
  102. package/dist/features/debug/testRecorder/client/index.d.ts +1 -4
  103. package/dist/features/debug/testRecorder/client/index.d.ts.map +1 -1
  104. package/dist/features/debug/testRecorder/client/plugin/index.js +180 -345
  105. package/dist/features/debug/testRecorder/client/plugin/index.js.map +1 -1
  106. package/dist/features/debug/treeView/client/index.d.ts +1 -4
  107. package/dist/features/debug/treeView/client/index.d.ts.map +1 -1
  108. package/dist/features/experimental_table/client/index.d.ts +1 -1
  109. package/dist/features/experimental_table/client/index.d.ts.map +1 -1
  110. package/dist/features/experimental_table/client/plugins/TableActionMenuPlugin/index.d.ts.map +1 -1
  111. package/dist/features/experimental_table/client/plugins/TableActionMenuPlugin/index.js +250 -488
  112. package/dist/features/experimental_table/client/plugins/TableActionMenuPlugin/index.js.map +1 -1
  113. package/dist/features/experimental_table/client/plugins/TableCellResizerPlugin/index.d.ts.map +1 -1
  114. package/dist/features/experimental_table/client/plugins/TableCellResizerPlugin/index.js +39 -39
  115. package/dist/features/experimental_table/client/plugins/TableCellResizerPlugin/index.js.map +1 -1
  116. package/dist/features/experimental_table/client/plugins/TableHoverActionsPlugin/index.d.ts +1 -1
  117. package/dist/features/experimental_table/client/plugins/TableHoverActionsPlugin/index.d.ts.map +1 -1
  118. package/dist/features/experimental_table/client/plugins/TableHoverActionsPlugin/index.js +60 -124
  119. package/dist/features/experimental_table/client/plugins/TableHoverActionsPlugin/index.js.map +1 -1
  120. package/dist/features/experimental_table/client/plugins/TablePlugin/index.d.ts.map +1 -1
  121. package/dist/features/experimental_table/client/plugins/TablePlugin/index.js +52 -50
  122. package/dist/features/experimental_table/client/plugins/TablePlugin/index.js.map +1 -1
  123. package/dist/features/experimental_table/client/utils/debounce.js +4 -4
  124. package/dist/features/experimental_table/client/utils/debounce.js.map +1 -1
  125. package/dist/features/experimental_table/client/utils/useDebounce.js.map +1 -1
  126. package/dist/features/experimental_table/server/index.d.ts.map +1 -1
  127. package/dist/features/experimental_table/server/index.js +20 -4
  128. package/dist/features/experimental_table/server/index.js.map +1 -1
  129. package/dist/features/format/bold/feature.client.d.ts +1 -4
  130. package/dist/features/format/bold/feature.client.d.ts.map +1 -1
  131. package/dist/features/format/inlineCode/feature.client.d.ts +1 -4
  132. package/dist/features/format/inlineCode/feature.client.d.ts.map +1 -1
  133. package/dist/features/format/italic/feature.client.d.ts +1 -4
  134. package/dist/features/format/italic/feature.client.d.ts.map +1 -1
  135. package/dist/features/format/strikethrough/feature.client.d.ts +1 -4
  136. package/dist/features/format/strikethrough/feature.client.d.ts.map +1 -1
  137. package/dist/features/format/subscript/feature.client.d.ts +1 -4
  138. package/dist/features/format/subscript/feature.client.d.ts.map +1 -1
  139. package/dist/features/format/superscript/feature.client.d.ts +1 -4
  140. package/dist/features/format/superscript/feature.client.d.ts.map +1 -1
  141. package/dist/features/format/underline/feature.client.d.ts +1 -4
  142. package/dist/features/format/underline/feature.client.d.ts.map +1 -1
  143. package/dist/features/heading/client/index.d.ts +1 -4
  144. package/dist/features/heading/client/index.d.ts.map +1 -1
  145. package/dist/features/heading/server/index.d.ts.map +1 -1
  146. package/dist/features/heading/server/index.js +4 -0
  147. package/dist/features/heading/server/index.js.map +1 -1
  148. package/dist/features/horizontalRule/client/component/index.d.ts +1 -1
  149. package/dist/features/horizontalRule/client/component/index.d.ts.map +1 -1
  150. package/dist/features/horizontalRule/client/component/index.js +12 -9
  151. package/dist/features/horizontalRule/client/component/index.js.map +1 -1
  152. package/dist/features/horizontalRule/client/index.d.ts +1 -4
  153. package/dist/features/horizontalRule/client/index.d.ts.map +1 -1
  154. package/dist/features/horizontalRule/server/nodes/HorizontalRuleNode.d.ts +2 -2
  155. package/dist/features/horizontalRule/server/nodes/HorizontalRuleNode.d.ts.map +1 -1
  156. package/dist/features/horizontalRule/server/nodes/HorizontalRuleNode.js +1 -1
  157. package/dist/features/horizontalRule/server/nodes/HorizontalRuleNode.js.map +1 -1
  158. package/dist/features/indent/client/index.d.ts +1 -4
  159. package/dist/features/indent/client/index.d.ts.map +1 -1
  160. package/dist/features/indent/client/index.js +2 -1
  161. package/dist/features/indent/client/index.js.map +1 -1
  162. package/dist/features/link/client/index.d.ts +1 -13
  163. package/dist/features/link/client/index.d.ts.map +1 -1
  164. package/dist/features/link/client/index.js +2 -2
  165. package/dist/features/link/client/index.js.map +1 -1
  166. package/dist/features/link/client/plugins/autoLink/index.d.ts +1 -1
  167. package/dist/features/link/client/plugins/autoLink/index.d.ts.map +1 -1
  168. package/dist/features/link/client/plugins/autoLink/index.js +3 -1
  169. package/dist/features/link/client/plugins/autoLink/index.js.map +1 -1
  170. package/dist/features/link/client/plugins/floatingLinkEditor/LinkEditor/index.d.ts.map +1 -1
  171. package/dist/features/link/client/plugins/floatingLinkEditor/LinkEditor/index.js +21 -20
  172. package/dist/features/link/client/plugins/floatingLinkEditor/LinkEditor/index.js.map +1 -1
  173. package/dist/features/link/client/plugins/floatingLinkEditor/index.d.ts.map +1 -1
  174. package/dist/features/link/client/plugins/floatingLinkEditor/index.js +1 -1
  175. package/dist/features/link/client/plugins/floatingLinkEditor/index.js.map +1 -1
  176. package/dist/features/link/nodes/AutoLinkNode.js +2 -2
  177. package/dist/features/link/nodes/AutoLinkNode.js.map +1 -1
  178. package/dist/features/link/nodes/LinkNode.d.ts.map +1 -1
  179. package/dist/features/link/nodes/LinkNode.js +12 -7
  180. package/dist/features/link/nodes/LinkNode.js.map +1 -1
  181. package/dist/features/link/nodes/types.d.ts +3 -3
  182. package/dist/features/link/nodes/types.d.ts.map +1 -1
  183. package/dist/features/link/nodes/types.js.map +1 -1
  184. package/dist/features/link/server/baseFields.d.ts +1 -1
  185. package/dist/features/link/server/baseFields.d.ts.map +1 -1
  186. package/dist/features/link/server/baseFields.js +15 -3
  187. package/dist/features/link/server/baseFields.js.map +1 -1
  188. package/dist/features/link/server/index.d.ts.map +1 -1
  189. package/dist/features/link/server/index.js +17 -4
  190. package/dist/features/link/server/index.js.map +1 -1
  191. package/dist/features/link/server/transformExtraFields.d.ts +1 -1
  192. package/dist/features/link/server/transformExtraFields.d.ts.map +1 -1
  193. package/dist/features/link/server/transformExtraFields.js.map +1 -1
  194. package/dist/features/link/server/validate.d.ts.map +1 -1
  195. package/dist/features/link/server/validate.js +8 -5
  196. package/dist/features/link/server/validate.js.map +1 -1
  197. package/dist/features/lists/checklist/client/index.d.ts +1 -4
  198. package/dist/features/lists/checklist/client/index.d.ts.map +1 -1
  199. package/dist/features/lists/htmlConverter.d.ts.map +1 -1
  200. package/dist/features/lists/htmlConverter.js +8 -0
  201. package/dist/features/lists/htmlConverter.js.map +1 -1
  202. package/dist/features/lists/orderedList/client/index.d.ts +1 -4
  203. package/dist/features/lists/orderedList/client/index.d.ts.map +1 -1
  204. package/dist/features/lists/shared/markdown.js.map +1 -1
  205. package/dist/features/lists/unorderedList/client/index.d.ts +1 -4
  206. package/dist/features/lists/unorderedList/client/index.d.ts.map +1 -1
  207. package/dist/features/migrations/lexicalPluginToLexical/converter/index.d.ts.map +1 -1
  208. package/dist/features/migrations/lexicalPluginToLexical/converter/index.js +1 -0
  209. package/dist/features/migrations/lexicalPluginToLexical/converter/index.js.map +1 -1
  210. package/dist/features/migrations/lexicalPluginToLexical/feature.client.d.ts +1 -4
  211. package/dist/features/migrations/lexicalPluginToLexical/feature.client.d.ts.map +1 -1
  212. package/dist/features/migrations/lexicalPluginToLexical/nodes/unknownConvertedNode/index.d.ts +1 -1
  213. package/dist/features/migrations/lexicalPluginToLexical/nodes/unknownConvertedNode/index.d.ts.map +1 -1
  214. package/dist/features/migrations/lexicalPluginToLexical/nodes/unknownConvertedNode/index.js.map +1 -1
  215. package/dist/features/migrations/slateToLexical/converter/converters/blockquote/converter.js.map +1 -1
  216. package/dist/features/migrations/slateToLexical/converter/converters/heading/converter.js.map +1 -1
  217. package/dist/features/migrations/slateToLexical/converter/converters/link/converter.js.map +1 -1
  218. package/dist/features/migrations/slateToLexical/converter/converters/listItem/converter.js.map +1 -1
  219. package/dist/features/migrations/slateToLexical/converter/converters/orderedList/converter.js.map +1 -1
  220. package/dist/features/migrations/slateToLexical/converter/converters/unknown/converter.js.map +1 -1
  221. package/dist/features/migrations/slateToLexical/converter/converters/unorderedList/converter.js.map +1 -1
  222. package/dist/features/migrations/slateToLexical/converter/index.d.ts.map +1 -1
  223. package/dist/features/migrations/slateToLexical/converter/index.js +1 -0
  224. package/dist/features/migrations/slateToLexical/converter/index.js.map +1 -1
  225. package/dist/features/migrations/slateToLexical/feature.client.d.ts +1 -4
  226. package/dist/features/migrations/slateToLexical/feature.client.d.ts.map +1 -1
  227. package/dist/features/migrations/slateToLexical/feature.client.js +1 -3
  228. package/dist/features/migrations/slateToLexical/feature.client.js.map +1 -1
  229. package/dist/features/migrations/slateToLexical/nodes/unknownConvertedNode/index.d.ts +1 -1
  230. package/dist/features/migrations/slateToLexical/nodes/unknownConvertedNode/index.d.ts.map +1 -1
  231. package/dist/features/migrations/slateToLexical/nodes/unknownConvertedNode/index.js.map +1 -1
  232. package/dist/features/paragraph/client/index.d.ts +1 -4
  233. package/dist/features/paragraph/client/index.d.ts.map +1 -1
  234. package/dist/features/paragraph/server/index.d.ts +1 -1
  235. package/dist/features/paragraph/server/index.d.ts.map +1 -1
  236. package/dist/features/relationship/client/components/RelationshipComponent.d.ts.map +1 -1
  237. package/dist/features/relationship/client/components/RelationshipComponent.js +42 -29
  238. package/dist/features/relationship/client/components/RelationshipComponent.js.map +1 -1
  239. package/dist/features/relationship/client/drawer/index.d.ts.map +1 -1
  240. package/dist/features/relationship/client/drawer/index.js +27 -26
  241. package/dist/features/relationship/client/drawer/index.js.map +1 -1
  242. package/dist/features/relationship/client/index.d.ts +2 -17
  243. package/dist/features/relationship/client/index.d.ts.map +1 -1
  244. package/dist/features/relationship/client/nodes/RelationshipNode.d.ts +1 -1
  245. package/dist/features/relationship/client/nodes/RelationshipNode.d.ts.map +1 -1
  246. package/dist/features/relationship/client/nodes/RelationshipNode.js.map +1 -1
  247. package/dist/features/relationship/client/plugins/index.js +1 -1
  248. package/dist/features/relationship/client/plugins/index.js.map +1 -1
  249. package/dist/features/relationship/client/utils/EnabledRelationshipsCondition.js +1 -1
  250. package/dist/features/relationship/client/utils/EnabledRelationshipsCondition.js.map +1 -1
  251. package/dist/features/relationship/server/index.d.ts +1 -1
  252. package/dist/features/relationship/server/index.d.ts.map +1 -1
  253. package/dist/features/relationship/server/index.js +50 -40
  254. package/dist/features/relationship/server/index.js.map +1 -1
  255. package/dist/features/relationship/server/nodes/RelationshipNode.d.ts +8 -6
  256. package/dist/features/relationship/server/nodes/RelationshipNode.d.ts.map +1 -1
  257. package/dist/features/relationship/server/nodes/RelationshipNode.js.map +1 -1
  258. package/dist/features/toolbars/fixed/client/Toolbar/index.d.ts.map +1 -1
  259. package/dist/features/toolbars/fixed/client/Toolbar/index.js +93 -66
  260. package/dist/features/toolbars/fixed/client/Toolbar/index.js.map +1 -1
  261. package/dist/features/toolbars/fixed/client/index.d.ts +1 -4
  262. package/dist/features/toolbars/fixed/client/index.d.ts.map +1 -1
  263. package/dist/features/toolbars/inline/client/Toolbar/index.js +43 -46
  264. package/dist/features/toolbars/inline/client/Toolbar/index.js.map +1 -1
  265. package/dist/features/toolbars/inline/client/index.d.ts +1 -4
  266. package/dist/features/toolbars/inline/client/index.d.ts.map +1 -1
  267. package/dist/features/toolbars/shared/ToolbarButton/index.d.ts.map +1 -1
  268. package/dist/features/toolbars/shared/ToolbarButton/index.js +4 -1
  269. package/dist/features/toolbars/shared/ToolbarButton/index.js.map +1 -1
  270. package/dist/features/toolbars/shared/ToolbarDropdown/DropDown.d.ts +2 -2
  271. package/dist/features/toolbars/shared/ToolbarDropdown/DropDown.d.ts.map +1 -1
  272. package/dist/features/toolbars/shared/ToolbarDropdown/DropDown.js +12 -6
  273. package/dist/features/toolbars/shared/ToolbarDropdown/DropDown.js.map +1 -1
  274. package/dist/features/toolbars/shared/ToolbarDropdown/index.d.ts +4 -5
  275. package/dist/features/toolbars/shared/ToolbarDropdown/index.d.ts.map +1 -1
  276. package/dist/features/toolbars/shared/ToolbarDropdown/index.js +119 -116
  277. package/dist/features/toolbars/shared/ToolbarDropdown/index.js.map +1 -1
  278. package/dist/features/toolbars/types.d.ts +23 -11
  279. package/dist/features/toolbars/types.d.ts.map +1 -1
  280. package/dist/features/toolbars/types.js.map +1 -1
  281. package/dist/features/typesClient.d.ts +10 -11
  282. package/dist/features/typesClient.d.ts.map +1 -1
  283. package/dist/features/typesClient.js.map +1 -1
  284. package/dist/features/typesServer.d.ts +17 -26
  285. package/dist/features/typesServer.d.ts.map +1 -1
  286. package/dist/features/typesServer.js.map +1 -1
  287. package/dist/features/upload/client/component/index.d.ts.map +1 -1
  288. package/dist/features/upload/client/component/index.js +69 -58
  289. package/dist/features/upload/client/component/index.js.map +1 -1
  290. package/dist/features/upload/client/drawer/index.d.ts.map +1 -1
  291. package/dist/features/upload/client/drawer/index.js +34 -32
  292. package/dist/features/upload/client/drawer/index.js.map +1 -1
  293. package/dist/features/upload/client/feature.client.d.ts +1 -4
  294. package/dist/features/upload/client/feature.client.d.ts.map +1 -1
  295. package/dist/features/upload/client/nodes/UploadNode.d.ts.map +1 -1
  296. package/dist/features/upload/client/nodes/UploadNode.js +1 -1
  297. package/dist/features/upload/client/nodes/UploadNode.js.map +1 -1
  298. package/dist/features/upload/client/plugin/index.js +1 -1
  299. package/dist/features/upload/client/plugin/index.js.map +1 -1
  300. package/dist/features/upload/server/feature.server.d.ts.map +1 -1
  301. package/dist/features/upload/server/feature.server.js +17 -8
  302. package/dist/features/upload/server/feature.server.js.map +1 -1
  303. package/dist/features/upload/server/nodes/UploadNode.d.ts +9 -7
  304. package/dist/features/upload/server/nodes/UploadNode.d.ts.map +1 -1
  305. package/dist/features/upload/server/nodes/UploadNode.js.map +1 -1
  306. package/dist/features/upload/server/validate.d.ts.map +1 -1
  307. package/dist/features/upload/server/validate.js +7 -4
  308. package/dist/features/upload/server/validate.js.map +1 -1
  309. package/dist/field/Field.d.ts.map +1 -1
  310. package/dist/field/Field.js +29 -44
  311. package/dist/field/Field.js.map +1 -1
  312. package/dist/field/bundled.css +1 -1
  313. package/dist/field/index.d.ts.map +1 -1
  314. package/dist/field/index.js +63 -73
  315. package/dist/field/index.js.map +1 -1
  316. package/dist/field/rscEntry.d.ts +9 -0
  317. package/dist/field/rscEntry.d.ts.map +1 -0
  318. package/dist/field/rscEntry.js +37 -0
  319. package/dist/field/rscEntry.js.map +1 -0
  320. package/dist/index.d.ts +4 -3
  321. package/dist/index.d.ts.map +1 -1
  322. package/dist/index.js +94 -103
  323. package/dist/index.js.map +1 -1
  324. package/dist/lexical/EditorPlugin.d.ts.map +1 -1
  325. package/dist/lexical/EditorPlugin.js +2 -1
  326. package/dist/lexical/EditorPlugin.js.map +1 -1
  327. package/dist/lexical/LexicalEditor.d.ts +1 -1
  328. package/dist/lexical/LexicalEditor.d.ts.map +1 -1
  329. package/dist/lexical/LexicalEditor.js +10 -10
  330. package/dist/lexical/LexicalEditor.js.map +1 -1
  331. package/dist/lexical/LexicalProvider.d.ts +2 -2
  332. package/dist/lexical/LexicalProvider.d.ts.map +1 -1
  333. package/dist/lexical/LexicalProvider.js +9 -7
  334. package/dist/lexical/LexicalProvider.js.map +1 -1
  335. package/dist/lexical/config/client/EditorConfigProvider.d.ts +6 -5
  336. package/dist/lexical/config/client/EditorConfigProvider.d.ts.map +1 -1
  337. package/dist/lexical/config/client/EditorConfigProvider.js +13 -12
  338. package/dist/lexical/config/client/EditorConfigProvider.js.map +1 -1
  339. package/dist/lexical/config/client/loader.d.ts +1 -3
  340. package/dist/lexical/config/client/loader.d.ts.map +1 -1
  341. package/dist/lexical/config/client/loader.js +7 -19
  342. package/dist/lexical/config/client/loader.js.map +1 -1
  343. package/dist/lexical/config/client/sanitize.d.ts +1 -1
  344. package/dist/lexical/config/client/sanitize.d.ts.map +1 -1
  345. package/dist/lexical/config/client/sanitize.js +4 -4
  346. package/dist/lexical/config/client/sanitize.js.map +1 -1
  347. package/dist/lexical/config/server/loader.d.ts +2 -1
  348. package/dist/lexical/config/server/loader.d.ts.map +1 -1
  349. package/dist/lexical/config/server/loader.js +2 -0
  350. package/dist/lexical/config/server/loader.js.map +1 -1
  351. package/dist/lexical/config/server/sanitize.d.ts +1 -1
  352. package/dist/lexical/config/server/sanitize.d.ts.map +1 -1
  353. package/dist/lexical/config/server/sanitize.js +12 -11
  354. package/dist/lexical/config/server/sanitize.js.map +1 -1
  355. package/dist/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/LexicalMenu.d.ts +4 -4
  356. package/dist/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/LexicalMenu.d.ts.map +1 -1
  357. package/dist/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/LexicalMenu.js +82 -113
  358. package/dist/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/LexicalMenu.js.map +1 -1
  359. package/dist/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/index.d.ts +2 -2
  360. package/dist/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/index.d.ts.map +1 -1
  361. package/dist/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/index.js +2 -2
  362. package/dist/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/index.js.map +1 -1
  363. package/dist/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/types.d.ts +3 -2
  364. package/dist/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/types.d.ts.map +1 -1
  365. package/dist/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/types.js.map +1 -1
  366. package/dist/lexical/plugins/SlashMenu/index.d.ts.map +1 -1
  367. package/dist/lexical/plugins/SlashMenu/index.js +24 -30
  368. package/dist/lexical/plugins/SlashMenu/index.js.map +1 -1
  369. package/dist/lexical/plugins/handles/AddBlockHandlePlugin/index.d.ts.map +1 -1
  370. package/dist/lexical/plugins/handles/AddBlockHandlePlugin/index.js +93 -130
  371. package/dist/lexical/plugins/handles/AddBlockHandlePlugin/index.js.map +1 -1
  372. package/dist/lexical/plugins/handles/DraggableBlockPlugin/debounce.d.ts +1 -1
  373. package/dist/lexical/plugins/handles/DraggableBlockPlugin/debounce.d.ts.map +1 -1
  374. package/dist/lexical/plugins/handles/DraggableBlockPlugin/debounce.js +1 -1
  375. package/dist/lexical/plugins/handles/DraggableBlockPlugin/debounce.js.map +1 -1
  376. package/dist/lexical/plugins/handles/DraggableBlockPlugin/getBoundingRectWithoutTransform.js +1 -1
  377. package/dist/lexical/plugins/handles/DraggableBlockPlugin/getBoundingRectWithoutTransform.js.map +1 -1
  378. package/dist/lexical/plugins/handles/DraggableBlockPlugin/index.d.ts.map +1 -1
  379. package/dist/lexical/plugins/handles/DraggableBlockPlugin/index.js +119 -137
  380. package/dist/lexical/plugins/handles/DraggableBlockPlugin/index.js.map +1 -1
  381. package/dist/lexical/plugins/handles/DraggableBlockPlugin/setTargetLine.d.ts.map +1 -1
  382. package/dist/lexical/plugins/handles/DraggableBlockPlugin/setTargetLine.js +16 -32
  383. package/dist/lexical/plugins/handles/DraggableBlockPlugin/setTargetLine.js.map +1 -1
  384. package/dist/lexical/plugins/handles/utils/doesLineHeightAffectElement.d.ts.map +1 -1
  385. package/dist/lexical/plugins/handles/utils/doesLineHeightAffectElement.js +3 -1
  386. package/dist/lexical/plugins/handles/utils/doesLineHeightAffectElement.js.map +1 -1
  387. package/dist/lexical/plugins/handles/utils/getNodeCloseToPoint.d.ts.map +1 -1
  388. package/dist/lexical/plugins/handles/utils/getNodeCloseToPoint.js +3 -4
  389. package/dist/lexical/plugins/handles/utils/getNodeCloseToPoint.js.map +1 -1
  390. package/dist/lexical/plugins/handles/utils/setHandlePosition.d.ts.map +1 -1
  391. package/dist/lexical/plugins/handles/utils/setHandlePosition.js +4 -6
  392. package/dist/lexical/plugins/handles/utils/setHandlePosition.js.map +1 -1
  393. package/dist/lexical/theme/EditorTheme.d.ts.map +1 -1
  394. package/dist/lexical/theme/EditorTheme.js +1 -2
  395. package/dist/lexical/theme/EditorTheme.js.map +1 -1
  396. package/dist/lexical/ui/icons/Caret/index.svg +2 -2
  397. package/dist/lexical/utils/nodeFormat.d.ts +2 -2
  398. package/dist/lexical/utils/nodeFormat.d.ts.map +1 -1
  399. package/dist/lexical/utils/nodeFormat.js.map +1 -1
  400. package/dist/lexical/utils/rect.d.ts +4 -4
  401. package/dist/lexical/utils/rect.d.ts.map +1 -1
  402. package/dist/lexical/utils/rect.js.map +1 -1
  403. package/dist/lexical/utils/setFloatingElemPosition.d.ts +1 -1
  404. package/dist/lexical/utils/setFloatingElemPosition.d.ts.map +1 -1
  405. package/dist/lexical/utils/setFloatingElemPosition.js +1 -1
  406. package/dist/lexical/utils/setFloatingElemPosition.js.map +1 -1
  407. package/dist/lexical/utils/url.d.ts +5 -0
  408. package/dist/lexical/utils/url.d.ts.map +1 -1
  409. package/dist/lexical/utils/url.js +25 -5
  410. package/dist/lexical/utils/url.js.map +1 -1
  411. package/dist/populateGraphQL/populate.d.ts +3 -2
  412. package/dist/populateGraphQL/populate.d.ts.map +1 -1
  413. package/dist/populateGraphQL/populate.js +3 -1
  414. package/dist/populateGraphQL/populate.js.map +1 -1
  415. package/dist/populateGraphQL/populateLexicalPopulationPromises.d.ts +1 -1
  416. package/dist/populateGraphQL/populateLexicalPopulationPromises.d.ts.map +1 -1
  417. package/dist/populateGraphQL/populateLexicalPopulationPromises.js +5 -4
  418. package/dist/populateGraphQL/populateLexicalPopulationPromises.js.map +1 -1
  419. package/dist/populateGraphQL/recursivelyPopulateFieldsForGraphQL.js.map +1 -1
  420. package/dist/types.d.ts +20 -7
  421. package/dist/types.d.ts.map +1 -1
  422. package/dist/types.js.map +1 -1
  423. package/dist/utilities/createClientFeature.d.ts +3 -5
  424. package/dist/utilities/createClientFeature.d.ts.map +1 -1
  425. package/dist/utilities/createClientFeature.js +1 -4
  426. package/dist/utilities/createClientFeature.js.map +1 -1
  427. package/dist/utilities/createServerFeature.d.ts +1 -0
  428. package/dist/utilities/createServerFeature.d.ts.map +1 -1
  429. package/dist/utilities/createServerFeature.js +2 -0
  430. package/dist/utilities/createServerFeature.js.map +1 -1
  431. package/dist/utilities/fieldsDrawer/Drawer.d.ts +1 -0
  432. package/dist/utilities/fieldsDrawer/Drawer.d.ts.map +1 -1
  433. package/dist/utilities/fieldsDrawer/Drawer.js +68 -27
  434. package/dist/utilities/fieldsDrawer/Drawer.js.map +1 -1
  435. package/dist/utilities/fieldsDrawer/DrawerContent.d.ts.map +1 -1
  436. package/dist/utilities/fieldsDrawer/DrawerContent.js +115 -139
  437. package/dist/utilities/fieldsDrawer/DrawerContent.js.map +1 -1
  438. package/dist/utilities/fieldsDrawer/useLexicalDocumentDrawer.d.ts +13 -0
  439. package/dist/utilities/fieldsDrawer/useLexicalDocumentDrawer.d.ts.map +1 -0
  440. package/dist/utilities/fieldsDrawer/useLexicalDocumentDrawer.js +129 -0
  441. package/dist/utilities/fieldsDrawer/useLexicalDocumentDrawer.js.map +1 -0
  442. package/dist/utilities/fieldsDrawer/useLexicalDrawer.d.ts +10 -0
  443. package/dist/utilities/fieldsDrawer/useLexicalDrawer.d.ts.map +1 -0
  444. package/dist/utilities/fieldsDrawer/useLexicalDrawer.js +136 -0
  445. package/dist/utilities/fieldsDrawer/useLexicalDrawer.js.map +1 -0
  446. package/dist/utilities/fieldsDrawer/useLexicalListDrawer.d.ts +16 -0
  447. package/dist/utilities/fieldsDrawer/useLexicalListDrawer.d.ts.map +1 -0
  448. package/dist/utilities/fieldsDrawer/useLexicalListDrawer.js +144 -0
  449. package/dist/utilities/fieldsDrawer/useLexicalListDrawer.js.map +1 -0
  450. package/dist/utilities/generateImportMap.d.ts.map +1 -1
  451. package/dist/utilities/generateImportMap.js +2 -3
  452. package/dist/utilities/generateImportMap.js.map +1 -1
  453. package/dist/utilities/generateSchemaMap.d.ts.map +1 -1
  454. package/dist/utilities/generateSchemaMap.js +13 -10
  455. package/dist/utilities/generateSchemaMap.js.map +1 -1
  456. package/dist/utilities/initLexicalFeatures.d.ts +18 -0
  457. package/dist/utilities/initLexicalFeatures.d.ts.map +1 -0
  458. package/dist/utilities/initLexicalFeatures.js +95 -0
  459. package/dist/utilities/initLexicalFeatures.js.map +1 -0
  460. package/dist/utilities/migrateSlateToLexical/migrateDocumentFieldsRecursively.d.ts +1 -1
  461. package/dist/utilities/migrateSlateToLexical/migrateDocumentFieldsRecursively.d.ts.map +1 -1
  462. package/dist/utilities/migrateSlateToLexical/migrateDocumentFieldsRecursively.js +1 -1
  463. package/dist/utilities/migrateSlateToLexical/migrateDocumentFieldsRecursively.js.map +1 -1
  464. package/dist/utilities/upgradeLexicalData/upgradeDocumentFieldsRecursively.d.ts +1 -1
  465. package/dist/utilities/upgradeLexicalData/upgradeDocumentFieldsRecursively.d.ts.map +1 -1
  466. package/dist/utilities/upgradeLexicalData/upgradeDocumentFieldsRecursively.js +5 -1
  467. package/dist/utilities/upgradeLexicalData/upgradeDocumentFieldsRecursively.js.map +1 -1
  468. package/dist/utilities/useLexicalFeature.d.ts.map +1 -1
  469. package/dist/utilities/useLexicalFeature.js +12 -4
  470. package/dist/utilities/useLexicalFeature.js.map +1 -1
  471. package/dist/validate/index.d.ts.map +1 -1
  472. package/dist/validate/index.js +2 -2
  473. package/dist/validate/index.js.map +1 -1
  474. package/dist/validate/validateNodes.d.ts +2 -2
  475. package/dist/validate/validateNodes.d.ts.map +1 -1
  476. package/dist/validate/validateNodes.js +4 -4
  477. package/dist/validate/validateNodes.js.map +1 -1
  478. package/package.json +51 -49
  479. package/dist/cell/index.d.ts +0 -9
  480. package/dist/cell/index.d.ts.map +0 -1
  481. package/dist/cell/index.js +0 -135
  482. package/dist/cell/index.js.map +0 -1
  483. package/dist/exports/client/Field-63NGLPJB.js +0 -2
  484. package/dist/exports/client/Field-63NGLPJB.js.map +0 -7
  485. package/dist/exports/client/RelationshipComponent-3QWBV4GT.js +0 -2
  486. package/dist/exports/client/RelationshipComponent-3QWBV4GT.js.map +0 -7
  487. package/dist/exports/client/chunk-G5DTIOPI.js +0 -2
  488. package/dist/exports/client/chunk-G5DTIOPI.js.map +0 -7
  489. package/dist/exports/client/chunk-NI6Z4GBD.js +0 -2
  490. package/dist/exports/client/chunk-NI6Z4GBD.js.map +0 -7
  491. package/dist/exports/client/chunk-TO2W7Q2G.js +0 -2
  492. package/dist/exports/client/chunk-TO2W7Q2G.js.map +0 -7
  493. package/dist/exports/client/component-3OFD6Q4Z.js +0 -2
  494. package/dist/exports/client/component-3OFD6Q4Z.js.map +0 -7
  495. package/dist/exports/client/component-LCAAX56T.js +0 -2
  496. package/dist/exports/client/component-LCAAX56T.js.map +0 -7
  497. package/dist/exports/client/component-LLWMZU6K.js +0 -2
  498. package/dist/exports/client/component-LLWMZU6K.js.map +0 -7
  499. package/dist/exports/client/componentInline-72VZAAHP.js +0 -2
  500. package/dist/exports/client/componentInline-72VZAAHP.js.map +0 -7
  501. package/dist/features/createClientComponent.d.ts +0 -7
  502. package/dist/features/createClientComponent.d.ts.map +0 -1
  503. package/dist/features/createClientComponent.js +0 -13
  504. package/dist/features/createClientComponent.js.map +0 -1
  505. package/dist/features/createFeaturePropComponent.d.ts +0 -6
  506. package/dist/features/createFeaturePropComponent.d.ts.map +0 -1
  507. package/dist/features/createFeaturePropComponent.js +0 -19
  508. package/dist/features/createFeaturePropComponent.js.map +0 -1
  509. package/dist/utilities/generateComponentMap.d.ts +0 -6
  510. package/dist/utilities/generateComponentMap.d.ts.map +0 -1
  511. package/dist/utilities/generateComponentMap.js +0 -99
  512. package/dist/utilities/generateComponentMap.js.map +0 -1
@@ -0,0 +1,3 @@
1
+ export { RscEntryLexicalCell } from '../../cell/rscEntry.js';
2
+ export { RscEntryLexicalField } from '../../field/rscEntry.js';
3
+ //# sourceMappingURL=rsc.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rsc.d.ts","sourceRoot":"","sources":["../../../src/exports/server/rsc.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAA;AAC5D,OAAO,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAA"}
@@ -0,0 +1,3 @@
1
+ export { RscEntryLexicalCell } from '../../cell/rscEntry.js';
2
+ export { RscEntryLexicalField } from '../../field/rscEntry.js';
3
+ //# sourceMappingURL=rsc.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rsc.js","names":["RscEntryLexicalCell","RscEntryLexicalField"],"sources":["../../../src/exports/server/rsc.ts"],"sourcesContent":["export { RscEntryLexicalCell } from '../../cell/rscEntry.js'\nexport { RscEntryLexicalField } from '../../field/rscEntry.js'\n"],"mappings":"AAAA,SAASA,mBAAmB,QAAQ;AACpC,SAASC,oBAAoB,QAAQ","ignoreList":[]}
@@ -1,5 +1,2 @@
1
- export declare const AlignFeatureClient: import("react").FC<{
2
- featureKey: string;
3
- order: number;
4
- }>;
1
+ export declare const AlignFeatureClient: import("../../typesClient.js").FeatureProviderProviderClient<undefined, undefined>;
5
2
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/features/align/client/index.tsx"],"names":[],"mappings":"AAsJA,eAAO,MAAM,kBAAkB;;;EAO7B,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/features/align/client/index.tsx"],"names":[],"mappings":"AAsJA,eAAO,MAAM,kBAAkB,oFAO7B,CAAA"}
@@ -1,5 +1,2 @@
1
- export declare const BlockquoteFeatureClient: import("react").FC<{
2
- featureKey: string;
3
- order: number;
4
- }>;
1
+ export declare const BlockquoteFeatureClient: import("../../typesClient.js").FeatureProviderProviderClient<undefined, undefined>;
5
2
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/features/blockquote/client/index.tsx"],"names":[],"mappings":"AA4CA,eAAO,MAAM,uBAAuB;;;EA8BlC,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/features/blockquote/client/index.tsx"],"names":[],"mappings":"AA4CA,eAAO,MAAM,uBAAuB,oFA8BlC,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"markdownTransformer.js","names":["$createQuoteNode","$isQuoteNode","QuoteNode","$createLineBreakNode","MarkdownTransformer","type","dependencies","export","node","exportChildren","lines","split","output","line","push","join","regExp","replace","parentNode","children","_match","isImport","previousNode","getPreviousSibling","splice","getChildrenSize","select","remove","append"],"sources":["../../../src/features/blockquote/markdownTransformer.ts"],"sourcesContent":["import type { ElementTransformer } from '@lexical/markdown'\n\nimport { $createQuoteNode, $isQuoteNode, QuoteNode } from '@lexical/rich-text'\nimport { $createLineBreakNode } from 'lexical'\n\nexport const MarkdownTransformer: ElementTransformer = {\n type: 'element',\n dependencies: [QuoteNode],\n export: (node, exportChildren) => {\n if (!$isQuoteNode(node)) {\n return null\n }\n\n const lines = exportChildren(node).split('\\n')\n const output = []\n for (const line of lines) {\n output.push('> ' + line)\n }\n return output.join('\\n')\n },\n regExp: /^>\\s/,\n replace: (parentNode, children, _match, isImport) => {\n if (isImport) {\n const previousNode = parentNode.getPreviousSibling()\n if ($isQuoteNode(previousNode)) {\n previousNode.splice(previousNode.getChildrenSize(), 0, [\n $createLineBreakNode(),\n ...children,\n ])\n previousNode.select(0, 0)\n parentNode.remove()\n return\n }\n }\n\n const node = $createQuoteNode()\n node.append(...children)\n parentNode.replace(node)\n node.select(0, 0)\n },\n}\n"],"mappings":"AAEA,SAASA,gBAAgB,EAAEC,YAAY,EAAEC,SAAS,QAAQ;AAC1D,SAASC,oBAAoB,QAAQ;AAErC,OAAO,MAAMC,mBAAA,GAA0C;EACrDC,IAAA,EAAM;EACNC,YAAA,EAAc,CAACJ,SAAA,CAAU;EACzBK,MAAA,EAAQA,CAACC,IAAA,EAAMC,cAAA;IACb,IAAI,CAACR,YAAA,CAAaO,IAAA,GAAO;MACvB,OAAO;IACT;IAEA,MAAME,KAAA,GAAQD,cAAA,CAAeD,IAAA,EAAMG,KAAK,CAAC;IACzC,MAAMC,MAAA,GAAS,EAAE;IACjB,KAAK,MAAMC,IAAA,IAAQH,KAAA,EAAO;MACxBE,MAAA,CAAOE,IAAI,CAAC,OAAOD,IAAA;IACrB;IACA,OAAOD,MAAA,CAAOG,IAAI,CAAC;EACrB;EACAC,MAAA,EAAQ;EACRC,OAAA,EAASA,CAACC,UAAA,EAAYC,QAAA,EAAUC,MAAA,EAAQC,QAAA;IACtC,IAAIA,QAAA,EAAU;MACZ,MAAMC,YAAA,GAAeJ,UAAA,CAAWK,kBAAkB;MAClD,IAAItB,YAAA,CAAaqB,YAAA,GAAe;QAC9BA,YAAA,CAAaE,MAAM,CAACF,YAAA,CAAaG,eAAe,IAAI,GAAG,CACrDtB,oBAAA,I,GACGgB,QAAA,CACJ;QACDG,YAAA,CAAaI,MAAM,CAAC,GAAG;QACvBR,UAAA,CAAWS,MAAM;QACjB;MACF;IACF;IAEA,MAAMnB,IAAA,GAAOR,gBAAA;IACbQ,IAAA,CAAKoB,MAAM,IAAIT,QAAA;IACfD,UAAA,CAAWD,OAAO,CAACT,IAAA;IACnBA,IAAA,CAAKkB,MAAM,CAAC,GAAG;EACjB;AACF","ignoreList":[]}
1
+ {"version":3,"file":"markdownTransformer.js","names":["$createQuoteNode","$isQuoteNode","QuoteNode","$createLineBreakNode","MarkdownTransformer","type","dependencies","export","node","exportChildren","lines","split","output","line","push","join","regExp","replace","parentNode","children","_match","isImport","previousNode","getPreviousSibling","splice","getChildrenSize","select","remove","append"],"sources":["../../../src/features/blockquote/markdownTransformer.ts"],"sourcesContent":["import type { ElementTransformer } from '@lexical/markdown'\n\nimport { $createQuoteNode, $isQuoteNode, QuoteNode } from '@lexical/rich-text'\nimport { $createLineBreakNode } from 'lexical'\n\nexport const MarkdownTransformer: ElementTransformer = {\n type: 'element',\n dependencies: [QuoteNode],\n export: (node, exportChildren) => {\n if (!$isQuoteNode(node)) {\n return null\n }\n\n const lines = exportChildren(node).split('\\n')\n const output: string[] = []\n for (const line of lines) {\n output.push('> ' + line)\n }\n return output.join('\\n')\n },\n regExp: /^>\\s/,\n replace: (parentNode, children, _match, isImport) => {\n if (isImport) {\n const previousNode = parentNode.getPreviousSibling()\n if ($isQuoteNode(previousNode)) {\n previousNode.splice(previousNode.getChildrenSize(), 0, [\n $createLineBreakNode(),\n ...children,\n ])\n previousNode.select(0, 0)\n parentNode.remove()\n return\n }\n }\n\n const node = $createQuoteNode()\n node.append(...children)\n parentNode.replace(node)\n node.select(0, 0)\n },\n}\n"],"mappings":"AAEA,SAASA,gBAAgB,EAAEC,YAAY,EAAEC,SAAS,QAAQ;AAC1D,SAASC,oBAAoB,QAAQ;AAErC,OAAO,MAAMC,mBAAA,GAA0C;EACrDC,IAAA,EAAM;EACNC,YAAA,EAAc,CAACJ,SAAA,CAAU;EACzBK,MAAA,EAAQA,CAACC,IAAA,EAAMC,cAAA;IACb,IAAI,CAACR,YAAA,CAAaO,IAAA,GAAO;MACvB,OAAO;IACT;IAEA,MAAME,KAAA,GAAQD,cAAA,CAAeD,IAAA,EAAMG,KAAK,CAAC;IACzC,MAAMC,MAAA,GAAmB,EAAE;IAC3B,KAAK,MAAMC,IAAA,IAAQH,KAAA,EAAO;MACxBE,MAAA,CAAOE,IAAI,CAAC,OAAOD,IAAA;IACrB;IACA,OAAOD,MAAA,CAAOG,IAAI,CAAC;EACrB;EACAC,MAAA,EAAQ;EACRC,OAAA,EAASA,CAACC,UAAA,EAAYC,QAAA,EAAUC,MAAA,EAAQC,QAAA;IACtC,IAAIA,QAAA,EAAU;MACZ,MAAMC,YAAA,GAAeJ,UAAA,CAAWK,kBAAkB;MAClD,IAAItB,YAAA,CAAaqB,YAAA,GAAe;QAC9BA,YAAA,CAAaE,MAAM,CAACF,YAAA,CAAaG,eAAe,IAAI,GAAG,CACrDtB,oBAAA,I,GACGgB,QAAA,CACJ;QACDG,YAAA,CAAaI,MAAM,CAAC,GAAG;QACvBR,UAAA,CAAWS,MAAM;QACjB;MACF;IACF;IAEA,MAAMnB,IAAA,GAAOR,gBAAA;IACbQ,IAAA,CAAKoB,MAAM,IAAIT,QAAA;IACfD,UAAA,CAAWD,OAAO,CAACT,IAAA;IACnBA,IAAA,CAAKkB,MAAM,CAAC,GAAG;EACjB;AACF","ignoreList":[]}
@@ -3,5 +3,5 @@ import type { Spread } from 'lexical';
3
3
  export type SerializedQuoteNode = Spread<{
4
4
  type: 'quote';
5
5
  }, _SerializedQuoteNode>;
6
- export declare const BlockquoteFeature: import("../../typesServer.js").FeatureProviderProviderServer<undefined, undefined, any>;
6
+ export declare const BlockquoteFeature: import("../../typesServer.js").FeatureProviderProviderServer<undefined, undefined, null>;
7
7
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/features/blockquote/server/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,IAAI,oBAAoB,EAAE,MAAM,oBAAoB,CAAA;AACrF,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,SAAS,CAAA;AAUrC,MAAM,MAAM,mBAAmB,GAAG,MAAM,CACtC;IACE,IAAI,EAAE,OAAO,CAAA;CACd,EACD,oBAAoB,CACrB,CAAA;AAED,eAAO,MAAM,iBAAiB,yFA0C5B,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/features/blockquote/server/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,IAAI,oBAAoB,EAAE,MAAM,oBAAoB,CAAA;AACrF,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,SAAS,CAAA;AAUrC,MAAM,MAAM,mBAAmB,GAAG,MAAM,CACtC;IACE,IAAI,EAAE,OAAO,CAAA;CACd,EACD,oBAAoB,CACrB,CAAA;AAED,eAAO,MAAM,iBAAiB,0FA8C5B,CAAA"}
@@ -2,8 +2,8 @@ import { QuoteNode } from '@lexical/rich-text';
2
2
  import { createServerFeature } from '../../../utilities/createServerFeature.js';
3
3
  import { convertLexicalNodesToHTML } from '../../converters/html/converter/index.js';
4
4
  import { createNode } from '../../typeUtilities.js';
5
- import { i18n } from './i18n.js';
6
5
  import { MarkdownTransformer } from '../markdownTransformer.js';
6
+ import { i18n } from './i18n.js';
7
7
  export const BlockquoteFeature = createServerFeature({
8
8
  feature: {
9
9
  ClientFeature: '@payloadcms/richtext-lexical/client#BlockquoteFeatureClient',
@@ -15,6 +15,8 @@ export const BlockquoteFeature = createServerFeature({
15
15
  html: {
16
16
  converter: async ({
17
17
  converters,
18
+ currentDepth,
19
+ depth,
18
20
  draft,
19
21
  node,
20
22
  overrideAccess,
@@ -24,6 +26,8 @@ export const BlockquoteFeature = createServerFeature({
24
26
  }) => {
25
27
  const childrenText = await convertLexicalNodesToHTML({
26
28
  converters,
29
+ currentDepth,
30
+ depth,
27
31
  draft,
28
32
  lexicalNodes: node.children,
29
33
  overrideAccess,
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["QuoteNode","createServerFeature","convertLexicalNodesToHTML","createNode","i18n","MarkdownTransformer","BlockquoteFeature","feature","ClientFeature","clientFeatureProps","markdownTransformers","nodes","converters","html","converter","draft","node","overrideAccess","parent","req","showHiddenFields","childrenText","lexicalNodes","children","nodeTypes","getType","key"],"sources":["../../../../src/features/blockquote/server/index.ts"],"sourcesContent":["import type { SerializedQuoteNode as _SerializedQuoteNode } from '@lexical/rich-text'\nimport type { Spread } from 'lexical'\n\nimport { QuoteNode } from '@lexical/rich-text'\n\nimport { createServerFeature } from '../../../utilities/createServerFeature.js'\nimport { convertLexicalNodesToHTML } from '../../converters/html/converter/index.js'\nimport { createNode } from '../../typeUtilities.js'\nimport { i18n } from './i18n.js'\nimport { MarkdownTransformer } from '../markdownTransformer.js'\n\nexport type SerializedQuoteNode = Spread<\n {\n type: 'quote'\n },\n _SerializedQuoteNode\n>\n\nexport const BlockquoteFeature = createServerFeature({\n feature: {\n ClientFeature: '@payloadcms/richtext-lexical/client#BlockquoteFeatureClient',\n clientFeatureProps: null,\n i18n,\n markdownTransformers: [MarkdownTransformer],\n nodes: [\n createNode({\n converters: {\n html: {\n converter: async ({\n converters,\n draft,\n node,\n overrideAccess,\n parent,\n req,\n showHiddenFields,\n }) => {\n const childrenText = await convertLexicalNodesToHTML({\n converters,\n draft,\n lexicalNodes: node.children,\n overrideAccess,\n parent: {\n ...node,\n parent,\n },\n req,\n showHiddenFields,\n })\n\n return `<blockquote>${childrenText}</blockquote>`\n },\n nodeTypes: [QuoteNode.getType()],\n },\n },\n node: QuoteNode,\n }),\n ],\n },\n key: 'blockquote',\n})\n"],"mappings":"AAGA,SAASA,SAAS,QAAQ;AAE1B,SAASC,mBAAmB,QAAQ;AACpC,SAASC,yBAAyB,QAAQ;AAC1C,SAASC,UAAU,QAAQ;AAC3B,SAASC,IAAI,QAAQ;AACrB,SAASC,mBAAmB,QAAQ;AASpC,OAAO,MAAMC,iBAAA,GAAoBL,mBAAA,CAAoB;EACnDM,OAAA,EAAS;IACPC,aAAA,EAAe;IACfC,kBAAA,EAAoB;IACpBL,IAAA;IACAM,oBAAA,EAAsB,CAACL,mBAAA,CAAoB;IAC3CM,KAAA,EAAO,CACLR,UAAA,CAAW;MACTS,UAAA,EAAY;QACVC,IAAA,EAAM;UACJC,SAAA,EAAW,MAAAA,CAAO;YAChBF,UAAU;YACVG,KAAK;YACLC,IAAI;YACJC,cAAc;YACdC,MAAM;YACNC,GAAG;YACHC;UAAgB,CACjB;YACC,MAAMC,YAAA,GAAe,MAAMnB,yBAAA,CAA0B;cACnDU,UAAA;cACAG,KAAA;cACAO,YAAA,EAAcN,IAAA,CAAKO,QAAQ;cAC3BN,cAAA;cACAC,MAAA,EAAQ;gBACN,GAAGF,IAAI;gBACPE;cACF;cACAC,GAAA;cACAC;YACF;YAEA,OAAO,eAAeC,YAAA,eAA2B;UACnD;UACAG,SAAA,EAAW,CAACxB,SAAA,CAAUyB,OAAO;QAC/B;MACF;MACAT,IAAA,EAAMhB;IACR;EAEJ;EACA0B,GAAA,EAAK;AACP","ignoreList":[]}
1
+ {"version":3,"file":"index.js","names":["QuoteNode","createServerFeature","convertLexicalNodesToHTML","createNode","MarkdownTransformer","i18n","BlockquoteFeature","feature","ClientFeature","clientFeatureProps","markdownTransformers","nodes","converters","html","converter","currentDepth","depth","draft","node","overrideAccess","parent","req","showHiddenFields","childrenText","lexicalNodes","children","nodeTypes","getType","key"],"sources":["../../../../src/features/blockquote/server/index.ts"],"sourcesContent":["import type { SerializedQuoteNode as _SerializedQuoteNode } from '@lexical/rich-text'\nimport type { Spread } from 'lexical'\n\nimport { QuoteNode } from '@lexical/rich-text'\n\nimport { createServerFeature } from '../../../utilities/createServerFeature.js'\nimport { convertLexicalNodesToHTML } from '../../converters/html/converter/index.js'\nimport { createNode } from '../../typeUtilities.js'\nimport { MarkdownTransformer } from '../markdownTransformer.js'\nimport { i18n } from './i18n.js'\n\nexport type SerializedQuoteNode = Spread<\n {\n type: 'quote'\n },\n _SerializedQuoteNode\n>\n\nexport const BlockquoteFeature = createServerFeature({\n feature: {\n ClientFeature: '@payloadcms/richtext-lexical/client#BlockquoteFeatureClient',\n clientFeatureProps: null,\n i18n,\n markdownTransformers: [MarkdownTransformer],\n nodes: [\n createNode({\n converters: {\n html: {\n converter: async ({\n converters,\n currentDepth,\n depth,\n draft,\n node,\n overrideAccess,\n parent,\n req,\n showHiddenFields,\n }) => {\n const childrenText = await convertLexicalNodesToHTML({\n converters,\n currentDepth,\n depth,\n draft,\n lexicalNodes: node.children,\n overrideAccess,\n parent: {\n ...node,\n parent,\n },\n req,\n showHiddenFields,\n })\n\n return `<blockquote>${childrenText}</blockquote>`\n },\n nodeTypes: [QuoteNode.getType()],\n },\n },\n node: QuoteNode,\n }),\n ],\n },\n key: 'blockquote',\n})\n"],"mappings":"AAGA,SAASA,SAAS,QAAQ;AAE1B,SAASC,mBAAmB,QAAQ;AACpC,SAASC,yBAAyB,QAAQ;AAC1C,SAASC,UAAU,QAAQ;AAC3B,SAASC,mBAAmB,QAAQ;AACpC,SAASC,IAAI,QAAQ;AASrB,OAAO,MAAMC,iBAAA,GAAoBL,mBAAA,CAAoB;EACnDM,OAAA,EAAS;IACPC,aAAA,EAAe;IACfC,kBAAA,EAAoB;IACpBJ,IAAA;IACAK,oBAAA,EAAsB,CAACN,mBAAA,CAAoB;IAC3CO,KAAA,EAAO,CACLR,UAAA,CAAW;MACTS,UAAA,EAAY;QACVC,IAAA,EAAM;UACJC,SAAA,EAAW,MAAAA,CAAO;YAChBF,UAAU;YACVG,YAAY;YACZC,KAAK;YACLC,KAAK;YACLC,IAAI;YACJC,cAAc;YACdC,MAAM;YACNC,GAAG;YACHC;UAAgB,CACjB;YACC,MAAMC,YAAA,GAAe,MAAMrB,yBAAA,CAA0B;cACnDU,UAAA;cACAG,YAAA;cACAC,KAAA;cACAC,KAAA;cACAO,YAAA,EAAcN,IAAA,CAAKO,QAAQ;cAC3BN,cAAA;cACAC,MAAA,EAAQ;gBACN,GAAGF,IAAI;gBACPE;cACF;cACAC,GAAA;cACAC;YACF;YAEA,OAAO,eAAeC,YAAA,eAA2B;UACnD;UACAG,SAAA,EAAW,CAAC1B,SAAA,CAAU2B,OAAO;QAC/B;MACF;MACAT,IAAA,EAAMlB;IACR;EAEJ;EACA4B,GAAA,EAAK;AACP","ignoreList":[]}
@@ -8,6 +8,7 @@ type Props = {
8
8
  field: LexicalRichTextFieldProps['field'];
9
9
  formData: BlockFields;
10
10
  formSchema: ClientField[];
11
+ Label?: React.ReactNode;
11
12
  nodeKey: string;
12
13
  path: string;
13
14
  schemaPath: string;
@@ -1 +1 @@
1
- {"version":3,"file":"BlockContent.d.ts","sourceRoot":"","sources":["../../../../../src/features/blocks/client/component/BlockContent.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,WAAW,EAAmC,MAAM,SAAS,CAAA;AAkBxF,OAAO,KAAsB,MAAM,OAAO,CAAA;AAE1C,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,sBAAsB,CAAA;AACrE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kCAAkC,CAAA;AAKnE,KAAK,KAAK,GAAG;IACX,SAAS,EAAE,MAAM,CAAA;IACjB,WAAW,EAAE,WAAW,CAAA;IACxB,KAAK,EAAE,yBAAyB,CAAC,OAAO,CAAC,CAAA;IACzC,QAAQ,EAAE,WAAW,CAAA;IACrB,UAAU,EAAE,WAAW,EAAE,CAAA;IACzB,OAAO,EAAE,MAAM,CAAA;IACf,IAAI,EAAE,MAAM,CAAA;IACZ,UAAU,EAAE,MAAM,CAAA;CACnB,CAAA;AAoBD;;;;GAIG;AACH,eAAO,MAAM,YAAY,EAAE,KAAK,CAAC,EAAE,CAAC,KAAK,CAwLxC,CAAA"}
1
+ {"version":3,"file":"BlockContent.d.ts","sourceRoot":"","sources":["../../../../../src/features/blocks/client/component/BlockContent.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,WAAW,EAAmC,MAAM,SAAS,CAAA;AAiBxF,OAAO,KAAiC,MAAM,OAAO,CAAA;AAErD,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,sBAAsB,CAAA;AACrE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kCAAkC,CAAA;AAMnE,KAAK,KAAK,GAAG;IACX,SAAS,EAAE,MAAM,CAAA;IACjB,WAAW,EAAE,WAAW,CAAA;IACxB,KAAK,EAAE,yBAAyB,CAAC,OAAO,CAAC,CAAA;IACzC,QAAQ,EAAE,WAAW,CAAA;IACrB,UAAU,EAAE,WAAW,EAAE,CAAA;IACzB,KAAK,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;IACvB,OAAO,EAAE,MAAM,CAAA;IACf,IAAI,EAAE,MAAM,CAAA;IACZ,UAAU,EAAE,MAAM,CAAA;CACnB,CAAA;AAoBD;;;;GAIG;AACH,eAAO,MAAM,YAAY,EAAE,KAAK,CAAC,EAAE,CAAC,KAAK,CAmLxC,CAAA"}
@@ -3,10 +3,12 @@
3
3
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
4
4
  import { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext.js';
5
5
  import { getTranslation } from '@payloadcms/translations';
6
- import { Button, Collapsible, ErrorPill, Pill, RenderComponent, RenderFields, SectionTitle, useDocumentInfo, useFormSubmitted, useTranslation } from '@payloadcms/ui';
6
+ import { Button, Collapsible, ErrorPill, Pill, RenderFields, SectionTitle, useDocumentInfo, useFormSubmitted, useTranslation } from '@payloadcms/ui';
7
7
  import { dequal } from 'dequal/lite';
8
8
  import { $getNodeByKey } from 'lexical';
9
- import React, { useCallback } from 'react';
9
+ import React, { useCallback, useEffect } from 'react';
10
+ import { useEditorConfigContext } from '../../../../lexical/config/client/EditorConfigProvider.js';
11
+ import { $isBlockNode } from '../nodes/BlocksNode.js';
10
12
  import { FormSavePlugin } from './FormSavePlugin.js';
11
13
  // Recursively remove all undefined values from even being present in formData, as they will
12
14
  // cause isDeepEqual to return false if, for example, formData has a key that fields.data
@@ -36,12 +38,19 @@ export const BlockContent = props => {
36
38
  clientBlock,
37
39
  field,
38
40
  formSchema,
41
+ Label,
39
42
  nodeKey,
43
+ path,
40
44
  schemaPath
41
45
  } = props;
42
46
  let {
43
47
  formData
44
48
  } = props;
49
+ const {
50
+ fieldProps: {
51
+ permissions
52
+ }
53
+ } = useEditorConfigContext();
45
54
  const {
46
55
  i18n
47
56
  } = useTranslation();
@@ -50,21 +59,18 @@ export const BlockContent = props => {
50
59
  // Remember, these preferences are scoped to the whole document, not just this form. This
51
60
  // is important to consider for the data path used in setDocFieldPreferences
52
61
  const {
62
+ docPermissions,
53
63
  getDocPreferences,
54
64
  setDocFieldPreferences
55
65
  } = useDocumentInfo();
56
- const [isCollapsed, setIsCollapsed] = React.useState(() => {
57
- let initialState = false;
66
+ const [isCollapsed, setIsCollapsed] = React.useState();
67
+ useEffect(() => {
58
68
  void getDocPreferences().then(currentDocPreferences => {
59
69
  const currentFieldPreferences = currentDocPreferences?.fields[field.name];
60
70
  const collapsedArray = currentFieldPreferences?.collapsed;
61
- if (collapsedArray && collapsedArray.includes(formData.id)) {
62
- initialState = true;
63
- setIsCollapsed(true);
64
- }
71
+ setIsCollapsed(collapsedArray ? collapsedArray.includes(formData.id) : false);
65
72
  });
66
- return initialState;
67
- });
73
+ }, [field.name, formData.id, getDocPreferences]);
68
74
  const hasSubmitted = useFormSubmitted();
69
75
  const [errorCount, setErrorCount] = React.useState(0);
70
76
  const fieldHasErrors = hasSubmitted && errorCount > 0;
@@ -87,7 +93,7 @@ export const BlockContent = props => {
87
93
  setTimeout(() => {
88
94
  editor.update(() => {
89
95
  const node = $getNodeByKey(nodeKey);
90
- if (node) {
96
+ if (node && $isBlockNode(node)) {
91
97
  formData = newFormData;
92
98
  node.setFields(newFormData);
93
99
  }
@@ -127,29 +133,26 @@ export const BlockContent = props => {
127
133
  }, [getDocPreferences, field.name, setDocFieldPreferences, formData.id]);
128
134
  const removeBlock = useCallback(() => {
129
135
  editor.update(() => {
130
- $getNodeByKey(nodeKey).remove();
136
+ $getNodeByKey(nodeKey)?.remove();
131
137
  });
132
138
  }, [editor, nodeKey]);
139
+ if (typeof isCollapsed !== 'boolean') {
140
+ return null;
141
+ }
133
142
  return /*#__PURE__*/_jsxs(React.Fragment, {
134
143
  children: [/*#__PURE__*/_jsx(Collapsible, {
135
144
  className: classNames,
136
145
  collapsibleStyle: fieldHasErrors ? 'error' : 'default',
137
- header: clientBlock?.admin?.components?.Label ? /*#__PURE__*/_jsx(RenderComponent, {
138
- clientProps: {
139
- blockKind: 'lexicalBlock',
140
- formData
141
- },
142
- mappedComponent: clientBlock.admin.components.Label
143
- }) : /*#__PURE__*/_jsxs("div", {
146
+ header: Label || /*#__PURE__*/_jsxs("div", {
144
147
  className: `${baseClass}__block-header`,
145
148
  children: [/*#__PURE__*/_jsxs("div", {
146
149
  children: [/*#__PURE__*/_jsx(Pill, {
147
150
  className: `${baseClass}__block-pill ${baseClass}__block-pill-${formData?.blockType}`,
148
151
  pillStyle: "white",
149
- children: typeof clientBlock?.labels.singular === 'string' ? getTranslation(clientBlock?.labels.singular, i18n) : clientBlock.slug
152
+ children: typeof clientBlock?.labels?.singular === 'string' ? getTranslation(clientBlock?.labels.singular, i18n) : clientBlock.slug
150
153
  }), /*#__PURE__*/_jsx(SectionTitle, {
151
154
  path: "blockName",
152
- readOnly: field?.admin?.readOnly
155
+ readOnly: field?.admin?.readOnly || false
153
156
  }), fieldHasErrors && /*#__PURE__*/_jsx(ErrorPill, {
154
157
  count: errorCount,
155
158
  i18n: i18n,
@@ -174,15 +177,12 @@ export const BlockContent = props => {
174
177
  setIsCollapsed(incomingCollapsedState);
175
178
  },
176
179
  children: /*#__PURE__*/_jsx(RenderFields, {
177
- className: `${baseClass}__fields`,
178
180
  fields: formSchema,
179
181
  forceRender: true,
180
- margins: "small",
181
- path: "" // Leaving path empty makes it so field values are not prefixed / scoped by the entire schemaPath. e.g. we can access "myField" instead of "someLexicalField.feature.blocks.someArrayB" // TODO: Could there be any implications leaving path different than schemaPath?
182
- ,
183
-
184
- readOnly: false,
185
- schemaPath: schemaPath
182
+ parentIndexPath: "",
183
+ parentPath: '',
184
+ parentSchemaPath: "",
185
+ permissions: permissions
186
186
  })
187
187
  }, 0), /*#__PURE__*/_jsx(FormSavePlugin, {
188
188
  onChange: onFormChange
@@ -1 +1 @@
1
- {"version":3,"file":"BlockContent.js","names":["useLexicalComposerContext","getTranslation","Button","Collapsible","ErrorPill","Pill","RenderComponent","RenderFields","SectionTitle","useDocumentInfo","useFormSubmitted","useTranslation","dequal","$getNodeByKey","React","useCallback","FormSavePlugin","removeUndefinedAndNullAndEmptyArraysRecursively","obj","key","value","Array","isArray","length","undefined","BlockContent","props","baseClass","clientBlock","field","formSchema","nodeKey","schemaPath","formData","i18n","editor","getDocPreferences","setDocFieldPreferences","isCollapsed","setIsCollapsed","useState","initialState","then","currentDocPreferences","currentFieldPreferences","fields","name","collapsedArray","collapsed","includes","id","hasSubmitted","errorCount","setErrorCount","fieldHasErrors","classNames","filter","Boolean","join","onFormChange","fullFieldsWithValues","newFormData","blockType","setTimeout","update","node","setFields","rowErrorCount","formField","Object","values","valid","onCollapsedChange","changedCollapsed","newCollapsed","push","splice","indexOf","hello","removeBlock","remove","_jsxs","Fragment","_jsx","className","collapsibleStyle","header","admin","components","Label","clientProps","blockKind","mappedComponent","pillStyle","labels","singular","slug","path","readOnly","count","withMessage","isEditable","buttonStyle","disabled","icon","onClick","e","preventDefault","round","tooltip","onToggle","incomingCollapsedState","forceRender","margins","onChange"],"sources":["../../../../../src/features/blocks/client/component/BlockContent.tsx"],"sourcesContent":["'use client'\nimport type { ClientBlock, ClientField, CollapsedPreferences, FormState } from 'payload'\n\nimport { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext.js'\nimport { getTranslation } from '@payloadcms/translations'\nimport {\n Button,\n Collapsible,\n ErrorPill,\n Pill,\n RenderComponent,\n RenderFields,\n SectionTitle,\n useDocumentInfo,\n useFormSubmitted,\n useTranslation,\n} from '@payloadcms/ui'\nimport { dequal } from 'dequal/lite'\nimport { $getNodeByKey } from 'lexical'\nimport React, { useCallback } from 'react'\n\nimport type { LexicalRichTextFieldProps } from '../../../../types.js'\nimport type { BlockFields } from '../../server/nodes/BlocksNode.js'\nimport type { BlockNode } from '../nodes/BlocksNode.js'\n\nimport { FormSavePlugin } from './FormSavePlugin.js'\n\ntype Props = {\n baseClass: string\n clientBlock: ClientBlock\n field: LexicalRichTextFieldProps['field']\n formData: BlockFields\n formSchema: ClientField[]\n nodeKey: string\n path: string\n schemaPath: string\n}\n\n// Recursively remove all undefined values from even being present in formData, as they will\n// cause isDeepEqual to return false if, for example, formData has a key that fields.data\n// does not have, even if it's undefined.\n// Currently, this happens if a block has another sub-blocks field. Inside formData, that sub-blocks field has an undefined blockName property.\n// Inside of fields.data however, that sub-blocks blockName property does not exist at all.\nfunction removeUndefinedAndNullAndEmptyArraysRecursively(obj: object) {\n for (const key in obj) {\n const value = obj[key]\n if (Array.isArray(value) && !value?.length) {\n delete obj[key]\n } else if (value && typeof value === 'object') {\n removeUndefinedAndNullAndEmptyArraysRecursively(value)\n } else if (value === undefined || value === null) {\n delete obj[key]\n }\n }\n}\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<Props> = (props) => {\n const { baseClass, clientBlock, field, formSchema, nodeKey, schemaPath } = props\n let { formData } = props\n\n const { i18n } = useTranslation()\n const [editor] = useLexicalComposerContext()\n // Used for saving collapsed to preferences (and gettin' it from there again)\n // Remember, these preferences are scoped to the whole document, not just this form. This\n // is important to consider for the data path used in setDocFieldPreferences\n const { getDocPreferences, setDocFieldPreferences } = useDocumentInfo()\n\n const [isCollapsed, setIsCollapsed] = React.useState<boolean>(() => {\n let initialState = false\n\n void getDocPreferences().then((currentDocPreferences) => {\n const currentFieldPreferences = currentDocPreferences?.fields[field.name]\n\n const collapsedArray = currentFieldPreferences?.collapsed\n\n if (collapsedArray && collapsedArray.includes(formData.id)) {\n initialState = true\n setIsCollapsed(true)\n }\n })\n return initialState\n })\n\n const hasSubmitted = useFormSubmitted()\n\n const [errorCount, setErrorCount] = React.useState(0)\n\n const fieldHasErrors = hasSubmitted && errorCount > 0\n\n const classNames = [\n `${baseClass}__row`,\n fieldHasErrors ? `${baseClass}__row--has-errors` : `${baseClass}__row--no-errors`,\n ]\n .filter(Boolean)\n .join(' ')\n\n const onFormChange = useCallback(\n ({\n fullFieldsWithValues,\n newFormData,\n }: {\n fullFieldsWithValues: FormState\n newFormData: BlockFields\n }) => {\n newFormData.id = formData.id\n newFormData.blockType = formData.blockType\n\n removeUndefinedAndNullAndEmptyArraysRecursively(newFormData)\n removeUndefinedAndNullAndEmptyArraysRecursively(formData)\n\n // Only update if the data has actually changed. Otherwise, we may be triggering an unnecessary value change,\n // which would trigger the \"Leave without saving\" dialog unnecessarily\n if (!dequal(formData, newFormData)) {\n // Running this in the next tick in the meantime fixes this issue: https://github.com/payloadcms/payload/issues/4108\n // I don't know why. When this is called immediately, it might focus out of a nested lexical editor field if an update is made there.\n // My hypothesis is that the nested editor might not have fully finished its update cycle yet. By updating in the next tick, we\n // ensure that the nested editor has finished its update cycle before we update the block node.\n setTimeout(() => {\n editor.update(() => {\n const node: BlockNode = $getNodeByKey(nodeKey)\n if (node) {\n formData = newFormData\n node.setFields(newFormData)\n }\n })\n }, 0)\n }\n\n // update error count\n if (hasSubmitted) {\n let rowErrorCount = 0\n for (const formField of Object.values(fullFieldsWithValues)) {\n if (formField?.valid === false) {\n rowErrorCount++\n }\n }\n setErrorCount(rowErrorCount)\n }\n },\n [editor, nodeKey, hasSubmitted, formData],\n )\n\n const onCollapsedChange = useCallback(\n (changedCollapsed: boolean) => {\n void getDocPreferences().then((currentDocPreferences) => {\n const currentFieldPreferences = currentDocPreferences?.fields[field.name]\n\n const collapsedArray = currentFieldPreferences?.collapsed\n\n const newCollapsed: CollapsedPreferences =\n collapsedArray && collapsedArray?.length ? collapsedArray : []\n\n if (changedCollapsed) {\n if (!newCollapsed.includes(formData.id)) {\n newCollapsed.push(formData.id)\n }\n } else {\n if (newCollapsed.includes(formData.id)) {\n newCollapsed.splice(newCollapsed.indexOf(formData.id), 1)\n }\n }\n\n setDocFieldPreferences(field.name, {\n collapsed: newCollapsed,\n hello: 'hi',\n })\n })\n },\n [getDocPreferences, field.name, setDocFieldPreferences, formData.id],\n )\n\n const removeBlock = useCallback(() => {\n editor.update(() => {\n $getNodeByKey(nodeKey).remove()\n })\n }, [editor, nodeKey])\n\n return (\n <React.Fragment>\n <Collapsible\n className={classNames}\n collapsibleStyle={fieldHasErrors ? 'error' : 'default'}\n header={\n clientBlock?.admin?.components?.Label ? (\n <RenderComponent\n clientProps={{ blockKind: 'lexicalBlock', formData }}\n mappedComponent={clientBlock.admin.components.Label}\n />\n ) : (\n <div className={`${baseClass}__block-header`}>\n <div>\n <Pill\n className={`${baseClass}__block-pill ${baseClass}__block-pill-${formData?.blockType}`}\n pillStyle=\"white\"\n >\n {typeof clientBlock?.labels.singular === 'string'\n ? getTranslation(clientBlock?.labels.singular, i18n)\n : clientBlock.slug}\n </Pill>\n <SectionTitle path=\"blockName\" readOnly={field?.admin?.readOnly} />\n {fieldHasErrors && <ErrorPill count={errorCount} i18n={i18n} withMessage />}\n </div>\n {editor.isEditable() && (\n <Button\n buttonStyle=\"icon-label\"\n className={`${baseClass}__removeButton`}\n disabled={field?.admin?.readOnly}\n icon=\"x\"\n onClick={(e) => {\n e.preventDefault()\n removeBlock()\n }}\n round\n tooltip=\"Remove Block\"\n />\n )}\n </div>\n )\n }\n isCollapsed={isCollapsed}\n key={0}\n onToggle={(incomingCollapsedState) => {\n onCollapsedChange(incomingCollapsedState)\n setIsCollapsed(incomingCollapsedState)\n }}\n >\n <RenderFields\n className={`${baseClass}__fields`}\n fields={formSchema}\n forceRender\n margins=\"small\"\n path=\"\" // Leaving path empty makes it so field values are not prefixed / scoped by the entire schemaPath. e.g. we can access \"myField\" instead of \"someLexicalField.feature.blocks.someArrayB\" // TODO: Could there be any implications leaving path different than schemaPath?\n readOnly={false}\n schemaPath={schemaPath} // Having the correct schemaPath here allows sub-fields (like array > addRow) to run correct form-state calls and retrieve their needed form state from the server\n />\n </Collapsible>\n\n <FormSavePlugin onChange={onFormChange} />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AAA,EAAY;UACZlB,SAAA,EAAW,GAAGzD,SAAA,gBAAyB;UACvC4E,QAAA,EAAU1E,KAAA,EAAO0D,KAAA,EAAOW,QAAA;UACxBM,IAAA,EAAK;UACLC,OAAA,EAAUC,CAAA;YACRA,CAAA,CAAEC,cAAc;YAChB5B,WAAA;UACF;UACA6B,KAAK;UACLC,OAAA,EAAQ;;;MAMlBvE,WAAA,EAAaA,WAAA;MAEbwE,QAAA,EAAWC,sBAAA;QACTvC,iBAAA,CAAkBuC,sBAAA;QAClBxE,cAAA,CAAewE,sBAAA;MACjB;gBAEA,aAAA5B,IAAA,CAAC5E,YAAA;QACC6E,SAAA,EAAW,GAAGzD,SAAA,UAAmB;QACjCkB,MAAA,EAAQf,UAAA;QACRkF,WAAW;QACXC,OAAA,EAAQ;QACRhB,IAAA,EAAK,GAAG;QAAA;;QACRC,QAAA,EAAU;QACVlE,UAAA,EAAYA;;OAbT,I,aAiBPmD,IAAA,CAACnE,cAAA;MAAekG,QAAA,EAAUvD;;;AAGhC","ignoreList":[]}
1
+ {"version":3,"file":"BlockContent.js","names":["useLexicalComposerContext","getTranslation","Button","Collapsible","ErrorPill","Pill","RenderFields","SectionTitle","useDocumentInfo","useFormSubmitted","useTranslation","dequal","$getNodeByKey","React","useCallback","useEffect","useEditorConfigContext","$isBlockNode","FormSavePlugin","removeUndefinedAndNullAndEmptyArraysRecursively","obj","key","value","Array","isArray","length","undefined","BlockContent","props","baseClass","clientBlock","field","formSchema","Label","nodeKey","path","schemaPath","formData","fieldProps","permissions","i18n","editor","docPermissions","getDocPreferences","setDocFieldPreferences","isCollapsed","setIsCollapsed","useState","then","currentDocPreferences","currentFieldPreferences","fields","name","collapsedArray","collapsed","includes","id","hasSubmitted","errorCount","setErrorCount","fieldHasErrors","classNames","filter","Boolean","join","onFormChange","fullFieldsWithValues","newFormData","blockType","setTimeout","update","node","setFields","rowErrorCount","formField","Object","values","valid","onCollapsedChange","changedCollapsed","newCollapsed","push","splice","indexOf","hello","removeBlock","remove","_jsxs","Fragment","_jsx","className","collapsibleStyle","header","pillStyle","labels","singular","slug","readOnly","admin","count","withMessage","isEditable","buttonStyle","disabled","icon","onClick","e","preventDefault","round","tooltip","onToggle","incomingCollapsedState","forceRender","parentIndexPath","parentPath","parentSchemaPath","onChange"],"sources":["../../../../../src/features/blocks/client/component/BlockContent.tsx"],"sourcesContent":["'use client'\nimport type { ClientBlock, ClientField, CollapsedPreferences, FormState } from 'payload'\n\nimport { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext.js'\nimport { getTranslation } from '@payloadcms/translations'\nimport {\n Button,\n Collapsible,\n ErrorPill,\n Pill,\n RenderFields,\n SectionTitle,\n useDocumentInfo,\n useFormSubmitted,\n useTranslation,\n} from '@payloadcms/ui'\nimport { dequal } from 'dequal/lite'\nimport { $getNodeByKey } from 'lexical'\nimport React, { useCallback, useEffect } from 'react'\n\nimport type { LexicalRichTextFieldProps } from '../../../../types.js'\nimport type { BlockFields } from '../../server/nodes/BlocksNode.js'\n\nimport { useEditorConfigContext } from '../../../../lexical/config/client/EditorConfigProvider.js'\nimport { $isBlockNode } from '../nodes/BlocksNode.js'\nimport { FormSavePlugin } from './FormSavePlugin.js'\n\ntype Props = {\n baseClass: string\n clientBlock: ClientBlock\n field: LexicalRichTextFieldProps['field']\n formData: BlockFields\n formSchema: ClientField[]\n Label?: React.ReactNode\n nodeKey: string\n path: string\n schemaPath: string\n}\n\n// Recursively remove all undefined values from even being present in formData, as they will\n// cause isDeepEqual to return false if, for example, formData has a key that fields.data\n// does not have, even if it's undefined.\n// Currently, this happens if a block has another sub-blocks field. Inside formData, that sub-blocks field has an undefined blockName property.\n// Inside of fields.data however, that sub-blocks blockName property does not exist at all.\nfunction removeUndefinedAndNullAndEmptyArraysRecursively(obj: object) {\n for (const key in obj) {\n const value = obj[key]\n if (Array.isArray(value) && !value?.length) {\n delete obj[key]\n } else if (value && typeof value === 'object') {\n removeUndefinedAndNullAndEmptyArraysRecursively(value)\n } else if (value === undefined || value === null) {\n delete obj[key]\n }\n }\n}\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<Props> = (props) => {\n const { baseClass, clientBlock, field, formSchema, Label, nodeKey, path, schemaPath } = props\n let { formData } = props\n const {\n fieldProps: { permissions },\n } = useEditorConfigContext()\n\n const { i18n } = useTranslation()\n const [editor] = useLexicalComposerContext()\n // Used for saving collapsed to preferences (and gettin' it from there again)\n // Remember, these preferences are scoped to the whole document, not just this form. This\n // is important to consider for the data path used in setDocFieldPreferences\n const { docPermissions, getDocPreferences, setDocFieldPreferences } = useDocumentInfo()\n\n const [isCollapsed, setIsCollapsed] = React.useState<boolean>()\n\n useEffect(() => {\n void getDocPreferences().then((currentDocPreferences) => {\n const currentFieldPreferences = currentDocPreferences?.fields[field.name]\n const collapsedArray = currentFieldPreferences?.collapsed\n setIsCollapsed(collapsedArray ? collapsedArray.includes(formData.id) : false)\n })\n }, [field.name, formData.id, getDocPreferences])\n\n const hasSubmitted = useFormSubmitted()\n\n const [errorCount, setErrorCount] = React.useState(0)\n\n const fieldHasErrors = hasSubmitted && errorCount > 0\n\n const classNames = [\n `${baseClass}__row`,\n fieldHasErrors ? `${baseClass}__row--has-errors` : `${baseClass}__row--no-errors`,\n ]\n .filter(Boolean)\n .join(' ')\n\n const onFormChange = useCallback(\n ({\n fullFieldsWithValues,\n newFormData,\n }: {\n fullFieldsWithValues: FormState\n newFormData: BlockFields\n }) => {\n newFormData.id = formData.id\n newFormData.blockType = formData.blockType\n\n removeUndefinedAndNullAndEmptyArraysRecursively(newFormData)\n removeUndefinedAndNullAndEmptyArraysRecursively(formData)\n\n // Only update if the data has actually changed. Otherwise, we may be triggering an unnecessary value change,\n // which would trigger the \"Leave without saving\" dialog unnecessarily\n if (!dequal(formData, newFormData)) {\n // Running this in the next tick in the meantime fixes this issue: https://github.com/payloadcms/payload/issues/4108\n // I don't know why. When this is called immediately, it might focus out of a nested lexical editor field if an update is made there.\n // My hypothesis is that the nested editor might not have fully finished its update cycle yet. By updating in the next tick, we\n // ensure that the nested editor has finished its update cycle before we update the block node.\n setTimeout(() => {\n editor.update(() => {\n const node = $getNodeByKey(nodeKey)\n if (node && $isBlockNode(node)) {\n formData = newFormData\n node.setFields(newFormData)\n }\n })\n }, 0)\n }\n\n // update error count\n if (hasSubmitted) {\n let rowErrorCount = 0\n for (const formField of Object.values(fullFieldsWithValues)) {\n if (formField?.valid === false) {\n rowErrorCount++\n }\n }\n setErrorCount(rowErrorCount)\n }\n },\n [editor, nodeKey, hasSubmitted, formData],\n )\n\n const onCollapsedChange = useCallback(\n (changedCollapsed: boolean) => {\n void getDocPreferences().then((currentDocPreferences) => {\n const currentFieldPreferences = currentDocPreferences?.fields[field.name]\n\n const collapsedArray = currentFieldPreferences?.collapsed\n\n const newCollapsed: CollapsedPreferences =\n collapsedArray && collapsedArray?.length ? collapsedArray : []\n\n if (changedCollapsed) {\n if (!newCollapsed.includes(formData.id)) {\n newCollapsed.push(formData.id)\n }\n } else {\n if (newCollapsed.includes(formData.id)) {\n newCollapsed.splice(newCollapsed.indexOf(formData.id), 1)\n }\n }\n\n setDocFieldPreferences(field.name, {\n collapsed: newCollapsed,\n hello: 'hi',\n })\n })\n },\n [getDocPreferences, field.name, setDocFieldPreferences, formData.id],\n )\n\n const removeBlock = useCallback(() => {\n editor.update(() => {\n $getNodeByKey(nodeKey)?.remove()\n })\n }, [editor, nodeKey])\n\n if (typeof isCollapsed !== 'boolean') {\n return null\n }\n\n return (\n <React.Fragment>\n <Collapsible\n className={classNames}\n collapsibleStyle={fieldHasErrors ? 'error' : 'default'}\n header={\n Label || (\n <div className={`${baseClass}__block-header`}>\n <div>\n <Pill\n className={`${baseClass}__block-pill ${baseClass}__block-pill-${formData?.blockType}`}\n pillStyle=\"white\"\n >\n {typeof clientBlock?.labels?.singular === 'string'\n ? getTranslation(clientBlock?.labels.singular, i18n)\n : clientBlock.slug}\n </Pill>\n <SectionTitle path=\"blockName\" readOnly={field?.admin?.readOnly || false} />\n {fieldHasErrors && <ErrorPill count={errorCount} i18n={i18n} withMessage />}\n </div>\n {editor.isEditable() && (\n <Button\n buttonStyle=\"icon-label\"\n className={`${baseClass}__removeButton`}\n disabled={field?.admin?.readOnly}\n icon=\"x\"\n onClick={(e) => {\n e.preventDefault()\n removeBlock()\n }}\n round\n tooltip=\"Remove Block\"\n />\n )}\n </div>\n )\n }\n isCollapsed={isCollapsed}\n key={0}\n onToggle={(incomingCollapsedState) => {\n onCollapsedChange(incomingCollapsedState)\n setIsCollapsed(incomingCollapsedState)\n }}\n >\n <RenderFields\n fields={formSchema}\n forceRender={true}\n parentIndexPath=\"\"\n parentPath={''}\n parentSchemaPath=\"\"\n permissions={permissions} // TODO: Pass field permissions\n />\n </Collapsible>\n\n <FormSavePlugin onChange={onFormChange} />\n </React.Fragment>\n )\n}\n"],"mappings":"AAAA;;;AAGA,SAASA,yBAAyB,QAAQ;AAC1C,SAASC,cAAc,QAAQ;AAC/B,SACEC,MAAM,EACNC,WAAW,EACXC,SAAS,EACTC,IAAI,EACJC,YAAY,EACZC,YAAY,EACZC,eAAe,EACfC,gBAAgB,EAChBC,cAAc,QACT;AACP,SAASC,MAAM,QAAQ;AACvB,SAASC,aAAa,QAAQ;AAC9B,OAAOC,KAAA,IAASC,WAAW,EAAEC,SAAS,QAAQ;AAK9C,SAASC,sBAAsB,QAAQ;AACvC,SAASC,YAAY,QAAQ;AAC7B,SAASC,cAAc,QAAQ;AAc/B;AACA;AACA;AACA;AACA;AACA,SAASC,gDAAgDC,GAAW;EAClE,KAAK,MAAMC,GAAA,IAAOD,GAAA,EAAK;IACrB,MAAME,KAAA,GAAQF,GAAG,CAACC,GAAA,CAAI;IACtB,IAAIE,KAAA,CAAMC,OAAO,CAACF,KAAA,KAAU,CAACA,KAAA,EAAOG,MAAA,EAAQ;MAC1C,OAAOL,GAAG,CAACC,GAAA,CAAI;IACjB,OAAO,I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C","ignoreList":[]}
@@ -4,7 +4,7 @@ import './index.scss';
4
4
  type Props = {
5
5
  readonly children?: React.ReactNode;
6
6
  readonly formData: BlockFields;
7
- readonly nodeKey?: string;
7
+ readonly nodeKey: string;
8
8
  };
9
9
  export declare const BlockComponent: React.FC<Props>;
10
10
  export {};
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/features/blocks/client/component/index.tsx"],"names":[],"mappings":"AAiBA,OAAO,KAAoD,MAAM,OAAO,CAAA;AASxE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kCAAkC,CAAA;AAInE,OAAO,cAAc,CAAA;AAErB,KAAK,KAAK,GAAG;IACX,QAAQ,CAAC,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;IACnC,QAAQ,CAAC,QAAQ,EAAE,WAAW,CAAA;IAC9B,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAA;CAC1B,CAAA;AAED,eAAO,MAAM,cAAc,EAAE,KAAK,CAAC,EAAE,CAAC,KAAK,CAsJ1C,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/features/blocks/client/component/index.tsx"],"names":[],"mappings":"AAaA,OAAO,KAA4D,MAAM,OAAO,CAAA;AAOhF,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kCAAkC,CAAA;AAInE,OAAO,cAAc,CAAA;AAErB,KAAK,KAAK,GAAG;IACX,QAAQ,CAAC,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;IACnC,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,CAwN1C,CAAA"}
@@ -1,11 +1,10 @@
1
1
  'use client';
2
2
 
3
3
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
4
- import { Collapsible, Form, Pill, RenderComponent, SectionTitle, ShimmerEffect, useConfig, useDocumentInfo, useFieldProps, useFormSubmitted, useTranslation } from '@payloadcms/ui';
5
- import React, { useCallback, useEffect, useMemo, useState } from 'react';
4
+ import { Collapsible, Form, Pill, SectionTitle, ShimmerEffect, useDocumentInfo, useFormSubmitted, useServerFunctions, useTranslation } from '@payloadcms/ui';
5
+ import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react';
6
6
  const baseClass = 'lexical-block';
7
7
  import { getTranslation } from '@payloadcms/translations';
8
- import { getFormState } from '@payloadcms/ui/shared';
9
8
  import { v4 as uuid } from 'uuid';
10
9
  import { useEditorConfigContext } from '../../../../lexical/config/client/EditorConfigProvider.js';
11
10
  import { BlockContent } from './BlockContent.js';
@@ -14,42 +13,55 @@ export const BlockComponent = props => {
14
13
  formData,
15
14
  nodeKey
16
15
  } = props;
17
- const {
18
- config
19
- } = useConfig();
20
16
  const submitted = useFormSubmitted();
21
17
  const {
22
- id
18
+ id,
19
+ collectionSlug,
20
+ globalSlug
23
21
  } = useDocumentInfo();
24
22
  const {
25
- path,
26
- schemaPath
27
- } = useFieldProps();
28
- const {
29
- field: parentLexicalRichTextField
23
+ fieldProps: {
24
+ featureClientSchemaMap,
25
+ field: parentLexicalRichTextField,
26
+ path,
27
+ schemaPath
28
+ }
30
29
  } = useEditorConfigContext();
30
+ const abortControllerRef = useRef(new AbortController());
31
+ const {
32
+ docPermissions,
33
+ getDocPreferences
34
+ } = useDocumentInfo();
35
+ const {
36
+ getFormState
37
+ } = useServerFunctions();
31
38
  const [initialState, setInitialState] = useState(false);
39
+ const schemaFieldsPath = `${schemaPath}.lexical_internal_feature.blocks.lexical_blocks.${formData.blockType}.fields`;
40
+ const componentMapRenderedBlockPath = `${schemaPath}.lexical_internal_feature.blocks.lexical_blocks.${formData.blockType}`;
41
+ const clientSchemaMap = featureClientSchemaMap['blocks'];
42
+ const blocksField = clientSchemaMap[componentMapRenderedBlockPath][0];
43
+ const clientBlock = blocksField.blocks[0];
32
44
  const {
33
- field: {
34
- richTextComponentMap
35
- }
36
- } = useEditorConfigContext();
37
- const schemaFieldsPath = `${schemaPath}.lexical_internal_feature.blocks.lexical_blocks.lexical_blocks.${formData.blockType}`;
38
- const componentMapRenderedBlockPath = `lexical_internal_feature.blocks.fields.lexical_blocks`;
39
- const blocksField = richTextComponentMap.get(componentMapRenderedBlockPath)[0];
40
- const clientBlock = blocksField.blocks.find(block => block.slug === formData.blockType);
45
+ i18n
46
+ } = useTranslation();
41
47
  // Field Schema
42
48
  useEffect(() => {
49
+ const abortController = new AbortController();
43
50
  const awaitInitialState = async () => {
44
- const state = await getFormState({
45
- apiRoute: config.routes.api,
46
- body: {
47
- id,
48
- data: formData,
49
- operation: 'update',
50
- schemaPath: schemaFieldsPath
51
- },
52
- serverURL: config.serverURL
51
+ const {
52
+ state
53
+ } = await getFormState({
54
+ id,
55
+ collectionSlug,
56
+ data: formData,
57
+ docPermissions,
58
+ docPreferences: await getDocPreferences(),
59
+ doNotAbort: true,
60
+ globalSlug,
61
+ operation: 'update',
62
+ renderAllFields: true,
63
+ schemaPath: schemaFieldsPath,
64
+ signal: abortController.signal
53
65
  });
54
66
  if (state) {
55
67
  state.blockName = {
@@ -64,33 +76,65 @@ export const BlockComponent = props => {
64
76
  if (formData) {
65
77
  void awaitInitialState();
66
78
  }
67
- }, [config.routes.api, config.serverURL, schemaFieldsPath, id]) // DO NOT ADD FORMDATA HERE! Adding formData will kick you out of sub block editors while writing.
79
+ return () => {
80
+ try {
81
+ abortController.abort();
82
+ } catch (_err) {
83
+ // swallow error
84
+ }
85
+ };
86
+ }, [getFormState, schemaFieldsPath, id, collectionSlug, globalSlug, getDocPreferences, docPermissions]) // DO NOT ADD FORMDATA HERE! Adding formData will kick you out of sub block editors while writing.
68
87
  ;
69
88
  const onChange = useCallback(async ({
70
89
  formState: prevFormState
71
90
  }) => {
72
- const formState = await getFormState({
73
- apiRoute: config.routes.api,
74
- body: {
75
- id,
76
- formState: prevFormState,
77
- operation: 'update',
78
- schemaPath: schemaFieldsPath
79
- },
80
- serverURL: config.serverURL
91
+ if (abortControllerRef.current) {
92
+ try {
93
+ abortControllerRef.current.abort();
94
+ } catch (_err_0) {
95
+ // swallow error
96
+ }
97
+ }
98
+ const abortController_0 = new AbortController();
99
+ abortControllerRef.current = abortController_0;
100
+ const {
101
+ state: newFormState
102
+ } = await getFormState({
103
+ id,
104
+ collectionSlug,
105
+ docPermissions,
106
+ docPreferences: await getDocPreferences(),
107
+ doNotAbort: true,
108
+ formState: prevFormState,
109
+ globalSlug,
110
+ operation: 'update',
111
+ schemaPath: schemaFieldsPath,
112
+ signal: abortController_0.signal
81
113
  });
82
- formState.blockName = {
114
+ if (!newFormState) {
115
+ return prevFormState;
116
+ }
117
+ newFormState.blockName = {
83
118
  initialValue: '',
84
119
  passesCondition: true,
85
120
  valid: true,
86
121
  value: formData.blockName
87
122
  };
88
- return formState;
89
- }, [config.routes.api, config.serverURL, id, schemaFieldsPath, formData.blockName]);
90
- const {
91
- i18n
92
- } = useTranslation();
123
+ return newFormState;
124
+ }, [getFormState, id, collectionSlug, docPermissions, getDocPreferences, globalSlug, schemaFieldsPath, formData.blockName]);
125
+ // cleanup effect
126
+ useEffect(() => {
127
+ const abortController_1 = abortControllerRef.current;
128
+ return () => {
129
+ try {
130
+ abortController_1.abort();
131
+ } catch (_err_1) {
132
+ // swallow error
133
+ }
134
+ };
135
+ }, []);
93
136
  const classNames = [`${baseClass}__row`, `${baseClass}__row--no-errors`].filter(Boolean).join(' ');
137
+ const Label = clientBlock?.admin?.components?.Label;
94
138
  // Memoized Form JSX
95
139
  const formContent = useMemo(() => {
96
140
  return clientBlock && initialState !== false ? /*#__PURE__*/_jsx(Form, {
@@ -113,22 +157,16 @@ export const BlockComponent = props => {
113
157
  }) : /*#__PURE__*/_jsx(Collapsible, {
114
158
  className: classNames,
115
159
  collapsibleStyle: "default",
116
- header: clientBlock?.admin?.components?.Label ? /*#__PURE__*/_jsx(RenderComponent, {
117
- clientProps: {
118
- blockKind: 'lexicalBlock',
119
- formData
120
- },
121
- mappedComponent: clientBlock.admin.components.Label
122
- }) : /*#__PURE__*/_jsx("div", {
160
+ header: clientBlock?.admin?.components?.Label ? Label : /*#__PURE__*/_jsx("div", {
123
161
  className: `${baseClass}__block-header`,
124
162
  children: /*#__PURE__*/_jsxs("div", {
125
163
  children: [/*#__PURE__*/_jsx(Pill, {
126
164
  className: `${baseClass}__block-pill ${baseClass}__block-pill-${formData?.blockType}`,
127
165
  pillStyle: "white",
128
- children: clientBlock && typeof clientBlock.labels.singular === 'string' ? getTranslation(clientBlock.labels.singular, i18n) : clientBlock.slug
166
+ children: clientBlock && typeof clientBlock.labels?.singular === 'string' ? getTranslation(clientBlock.labels.singular, i18n) : clientBlock?.slug
129
167
  }), /*#__PURE__*/_jsx(SectionTitle, {
130
168
  path: "blockName",
131
- readOnly: parentLexicalRichTextField?.admin?.readOnly
169
+ readOnly: parentLexicalRichTextField?.admin?.readOnly || false
132
170
  })]
133
171
  })
134
172
  }),
@@ -136,7 +174,8 @@ export const BlockComponent = props => {
136
174
  height: "35vh"
137
175
  })
138
176
  }, 0);
139
- }, [clientBlock, initialState, onChange, submitted, parentLexicalRichTextField, nodeKey, path, schemaFieldsPath, classNames, i18n]);
177
+ }, [clientBlock, initialState, onChange, submitted, parentLexicalRichTextField, nodeKey, path, schemaFieldsPath, classNames, i18n]) // DO NOT ADD FORMDATA HERE! Adding formData will kick you out of sub block editors while writing.
178
+ ;
140
179
  return /*#__PURE__*/_jsx("div", {
141
180
  className: baseClass + ' ' + baseClass + '-' + formData.blockType,
142
181
  children: formContent