@payloadcms/richtext-lexical 3.0.0-beta.3 → 3.0.0-beta.31

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 (666) hide show
  1. package/dist/cell/index.d.ts +1 -1
  2. package/dist/cell/index.d.ts.map +1 -1
  3. package/dist/cell/index.js +2 -4
  4. package/dist/cell/index.js.map +1 -1
  5. package/dist/exports/components.d.ts +8 -2
  6. package/dist/exports/components.d.ts.map +1 -1
  7. package/dist/exports/components.js +8 -2
  8. package/dist/exports/components.js.map +1 -1
  9. package/dist/field/Field.d.ts +0 -2
  10. package/dist/field/Field.d.ts.map +1 -1
  11. package/dist/field/Field.js.map +1 -1
  12. package/dist/field/features/align/feature.client.d.ts +4 -1
  13. package/dist/field/features/align/feature.client.d.ts.map +1 -1
  14. package/dist/field/features/align/feature.client.js +127 -54
  15. package/dist/field/features/align/feature.client.js.map +1 -1
  16. package/dist/field/features/align/toolbarAlignGroup.d.ts +3 -0
  17. package/dist/field/features/align/toolbarAlignGroup.d.ts.map +1 -0
  18. package/dist/field/features/align/toolbarAlignGroup.js +12 -0
  19. package/dist/field/features/align/toolbarAlignGroup.js.map +1 -0
  20. package/dist/field/features/blockquote/feature.client.d.ts +4 -1
  21. package/dist/field/features/blockquote/feature.client.d.ts.map +1 -1
  22. package/dist/field/features/blockquote/feature.client.js +53 -40
  23. package/dist/field/features/blockquote/feature.client.js.map +1 -1
  24. package/dist/field/features/blockquote/feature.server.d.ts +1 -1
  25. package/dist/field/features/blockquote/feature.server.d.ts.map +1 -1
  26. package/dist/field/features/blockquote/feature.server.js +7 -7
  27. package/dist/field/features/blockquote/feature.server.js.map +1 -1
  28. package/dist/field/features/blockquote/markdownTransformer.d.ts.map +1 -1
  29. package/dist/field/features/blockquote/markdownTransformer.js +2 -4
  30. package/dist/field/features/blockquote/markdownTransformer.js.map +1 -1
  31. package/dist/field/features/blocks/component/BlockContent.d.ts.map +1 -1
  32. package/dist/field/features/blocks/component/BlockContent.js +3 -5
  33. package/dist/field/features/blocks/component/BlockContent.js.map +1 -1
  34. package/dist/field/features/blocks/component/index.d.ts.map +1 -1
  35. package/dist/field/features/blocks/component/index.js +37 -4
  36. package/dist/field/features/blocks/component/index.js.map +1 -1
  37. package/dist/field/features/blocks/drawer/index.d.ts.map +1 -1
  38. package/dist/field/features/blocks/drawer/index.js +2 -4
  39. package/dist/field/features/blocks/drawer/index.js.map +1 -1
  40. package/dist/field/features/blocks/feature.client.d.ts +4 -1
  41. package/dist/field/features/blocks/feature.client.d.ts.map +1 -1
  42. package/dist/field/features/blocks/feature.client.js +56 -27
  43. package/dist/field/features/blocks/feature.client.js.map +1 -1
  44. package/dist/field/features/blocks/feature.server.d.ts +2 -5
  45. package/dist/field/features/blocks/feature.server.d.ts.map +1 -1
  46. package/dist/field/features/blocks/feature.server.js +109 -77
  47. package/dist/field/features/blocks/feature.server.js.map +1 -1
  48. package/dist/field/features/blocks/nodes/BlocksNode.d.ts +1 -3
  49. package/dist/field/features/blocks/nodes/BlocksNode.d.ts.map +1 -1
  50. package/dist/field/features/blocks/nodes/BlocksNode.js +1 -2
  51. package/dist/field/features/blocks/nodes/BlocksNode.js.map +1 -1
  52. package/dist/field/features/blocks/plugin/commands.d.ts.map +1 -1
  53. package/dist/field/features/blocks/plugin/commands.js +1 -2
  54. package/dist/field/features/blocks/plugin/commands.js.map +1 -1
  55. package/dist/field/features/blocks/plugin/index.d.ts +3 -2
  56. package/dist/field/features/blocks/plugin/index.d.ts.map +1 -1
  57. package/dist/field/features/blocks/plugin/index.js +5 -8
  58. package/dist/field/features/blocks/plugin/index.js.map +1 -1
  59. package/dist/field/features/blocks/populationPromise.d.ts.map +1 -1
  60. package/dist/field/features/blocks/populationPromise.js +4 -18
  61. package/dist/field/features/blocks/populationPromise.js.map +1 -1
  62. package/dist/field/features/blocks/validate.d.ts.map +1 -1
  63. package/dist/field/features/blocks/validate.js +22 -36
  64. package/dist/field/features/blocks/validate.js.map +1 -1
  65. package/dist/field/features/converters/html/field/index.d.ts +8 -2
  66. package/dist/field/features/converters/html/field/index.d.ts.map +1 -1
  67. package/dist/field/features/converters/html/field/index.js +6 -3
  68. package/dist/field/features/converters/html/field/index.js.map +1 -1
  69. package/dist/field/features/debug/{testrecorder → testRecorder}/feature.client.d.ts +4 -1
  70. package/dist/field/features/debug/testRecorder/feature.client.d.ts.map +1 -0
  71. package/dist/field/features/debug/{testrecorder → testRecorder}/feature.client.js.map +1 -1
  72. package/dist/field/features/debug/{testrecorder → testRecorder}/feature.server.d.ts.map +1 -1
  73. package/dist/field/features/debug/{testrecorder → testRecorder}/feature.server.js +1 -1
  74. package/dist/field/features/debug/{testrecorder → testRecorder}/feature.server.js.map +1 -1
  75. package/dist/field/features/debug/testRecorder/plugin/index.d.ts +5 -0
  76. package/dist/field/features/debug/testRecorder/plugin/index.d.ts.map +1 -0
  77. package/dist/field/features/debug/{testrecorder → testRecorder}/plugin/index.js +2 -4
  78. package/dist/field/features/debug/testRecorder/plugin/index.js.map +1 -0
  79. package/dist/field/features/debug/{treeview → treeView}/feature.client.d.ts +4 -1
  80. package/dist/field/features/debug/treeView/feature.client.d.ts.map +1 -0
  81. package/dist/field/features/debug/{treeview → treeView}/feature.client.js.map +1 -1
  82. package/dist/field/features/debug/{treeview → treeView}/feature.server.d.ts.map +1 -1
  83. package/dist/field/features/debug/{treeview → treeView}/feature.server.js +1 -1
  84. package/dist/field/features/debug/{treeview → treeView}/feature.server.js.map +1 -1
  85. package/dist/field/features/debug/treeView/plugin/index.d.ts +4 -0
  86. package/dist/field/features/debug/treeView/plugin/index.d.ts.map +1 -0
  87. package/dist/field/features/debug/{treeview → treeView}/plugin/index.js +4 -6
  88. package/dist/field/features/debug/treeView/plugin/index.js.map +1 -0
  89. package/dist/field/features/format/bold/feature.client.d.ts +4 -1
  90. package/dist/field/features/format/bold/feature.client.d.ts.map +1 -1
  91. package/dist/field/features/format/bold/feature.client.js +26 -23
  92. package/dist/field/features/format/bold/feature.client.js.map +1 -1
  93. package/dist/field/features/format/{inlinecode → inlineCode}/feature.client.d.ts +4 -1
  94. package/dist/field/features/format/inlineCode/feature.client.d.ts.map +1 -0
  95. package/dist/field/features/format/inlineCode/feature.client.js +46 -0
  96. package/dist/field/features/format/inlineCode/feature.client.js.map +1 -0
  97. package/dist/field/features/format/{inlinecode → inlineCode}/feature.server.d.ts.map +1 -1
  98. package/dist/field/features/format/{inlinecode → inlineCode}/feature.server.js +1 -1
  99. package/dist/field/features/format/{inlinecode → inlineCode}/feature.server.js.map +1 -1
  100. package/dist/field/features/format/{inlinecode → inlineCode}/markdownTransformers.d.ts.map +1 -1
  101. package/dist/field/features/format/{inlinecode → inlineCode}/markdownTransformers.js.map +1 -1
  102. package/dist/field/features/format/italic/feature.client.d.ts +4 -1
  103. package/dist/field/features/format/italic/feature.client.d.ts.map +1 -1
  104. package/dist/field/features/format/italic/feature.client.js +27 -24
  105. package/dist/field/features/format/italic/feature.client.js.map +1 -1
  106. package/dist/field/features/format/shared/toolbarFormatGroup.d.ts +3 -0
  107. package/dist/field/features/format/shared/toolbarFormatGroup.d.ts.map +1 -0
  108. package/dist/field/features/format/shared/toolbarFormatGroup.js +10 -0
  109. package/dist/field/features/format/shared/toolbarFormatGroup.js.map +1 -0
  110. package/dist/field/features/format/strikethrough/feature.client.d.ts +4 -1
  111. package/dist/field/features/format/strikethrough/feature.client.d.ts.map +1 -1
  112. package/dist/field/features/format/strikethrough/feature.client.js +27 -24
  113. package/dist/field/features/format/strikethrough/feature.client.js.map +1 -1
  114. package/dist/field/features/format/subscript/feature.client.d.ts +4 -1
  115. package/dist/field/features/format/subscript/feature.client.d.ts.map +1 -1
  116. package/dist/field/features/format/subscript/feature.client.js +25 -22
  117. package/dist/field/features/format/subscript/feature.client.js.map +1 -1
  118. package/dist/field/features/format/superscript/feature.client.d.ts +4 -1
  119. package/dist/field/features/format/superscript/feature.client.d.ts.map +1 -1
  120. package/dist/field/features/format/superscript/feature.client.js +25 -22
  121. package/dist/field/features/format/superscript/feature.client.js.map +1 -1
  122. package/dist/field/features/format/underline/feature.client.d.ts +4 -1
  123. package/dist/field/features/format/underline/feature.client.d.ts.map +1 -1
  124. package/dist/field/features/format/underline/feature.client.js +25 -22
  125. package/dist/field/features/format/underline/feature.client.js.map +1 -1
  126. package/dist/field/features/heading/feature.client.d.ts +4 -1
  127. package/dist/field/features/heading/feature.client.d.ts.map +1 -1
  128. package/dist/field/features/heading/feature.client.js +71 -54
  129. package/dist/field/features/heading/feature.client.js.map +1 -1
  130. package/dist/field/features/heading/feature.server.d.ts.map +1 -1
  131. package/dist/field/features/heading/feature.server.js +5 -5
  132. package/dist/field/features/heading/feature.server.js.map +1 -1
  133. package/dist/field/features/heading/markdownTransformer.d.ts.map +1 -1
  134. package/dist/field/features/heading/markdownTransformer.js +1 -2
  135. package/dist/field/features/heading/markdownTransformer.js.map +1 -1
  136. package/dist/field/features/horizontalRule/component/index.d.ts +10 -0
  137. package/dist/field/features/horizontalRule/component/index.d.ts.map +1 -0
  138. package/dist/field/features/horizontalRule/component/index.js +62 -0
  139. package/dist/field/features/horizontalRule/component/index.js.map +1 -0
  140. package/dist/field/features/horizontalRule/feature.client.d.ts +6 -0
  141. package/dist/field/features/horizontalRule/feature.client.d.ts.map +1 -0
  142. package/dist/field/features/horizontalRule/feature.client.js +76 -0
  143. package/dist/field/features/horizontalRule/feature.client.js.map +1 -0
  144. package/dist/field/features/horizontalRule/feature.server.d.ts +3 -0
  145. package/dist/field/features/horizontalRule/feature.server.d.ts.map +1 -0
  146. package/dist/field/features/horizontalRule/feature.server.js +36 -0
  147. package/dist/field/features/horizontalRule/feature.server.js.map +1 -0
  148. package/dist/field/features/horizontalRule/markdownTransformer.d.ts +3 -0
  149. package/dist/field/features/horizontalRule/markdownTransformer.d.ts.map +1 -0
  150. package/dist/field/features/horizontalRule/markdownTransformer.js +23 -0
  151. package/dist/field/features/horizontalRule/markdownTransformer.js.map +1 -0
  152. package/dist/field/features/horizontalRule/nodes/HorizontalRuleNode.d.ts +53 -0
  153. package/dist/field/features/horizontalRule/nodes/HorizontalRuleNode.d.ts.map +1 -0
  154. package/dist/field/features/horizontalRule/nodes/HorizontalRuleNode.js +88 -0
  155. package/dist/field/features/horizontalRule/nodes/HorizontalRuleNode.js.map +1 -0
  156. package/dist/field/features/horizontalRule/plugin/index.d.ts +7 -0
  157. package/dist/field/features/horizontalRule/plugin/index.d.ts.map +1 -0
  158. package/dist/field/features/horizontalRule/plugin/index.js +31 -0
  159. package/dist/field/features/horizontalRule/plugin/index.js.map +1 -0
  160. package/dist/field/features/horizontalRule/plugin/index.scss +20 -0
  161. package/dist/field/features/indent/feature.client.d.ts +4 -1
  162. package/dist/field/features/indent/feature.client.d.ts.map +1 -1
  163. package/dist/field/features/indent/feature.client.js +43 -42
  164. package/dist/field/features/indent/feature.client.js.map +1 -1
  165. package/dist/field/features/indent/toolbarIndentGroup.d.ts +3 -0
  166. package/dist/field/features/indent/toolbarIndentGroup.d.ts.map +1 -0
  167. package/dist/field/features/indent/toolbarIndentGroup.js +10 -0
  168. package/dist/field/features/indent/toolbarIndentGroup.js.map +1 -0
  169. package/dist/field/features/link/drawer/baseFields.d.ts +2 -2
  170. package/dist/field/features/link/drawer/baseFields.d.ts.map +1 -1
  171. package/dist/field/features/link/drawer/baseFields.js +30 -43
  172. package/dist/field/features/link/drawer/baseFields.js.map +1 -1
  173. package/dist/field/features/link/drawer/index.js +3 -2
  174. package/dist/field/features/link/drawer/index.js.map +1 -1
  175. package/dist/field/features/link/drawer/types.d.ts +4 -2
  176. package/dist/field/features/link/drawer/types.d.ts.map +1 -1
  177. package/dist/field/features/link/drawer/types.js.map +1 -1
  178. package/dist/field/features/link/feature.client.d.ts +13 -1
  179. package/dist/field/features/link/feature.client.d.ts.map +1 -1
  180. package/dist/field/features/link/feature.client.js +59 -47
  181. package/dist/field/features/link/feature.client.js.map +1 -1
  182. package/dist/field/features/link/feature.server.d.ts +10 -5
  183. package/dist/field/features/link/feature.server.d.ts.map +1 -1
  184. package/dist/field/features/link/feature.server.js +48 -9
  185. package/dist/field/features/link/feature.server.js.map +1 -1
  186. package/dist/field/features/link/nodes/AutoLinkNode.d.ts.map +1 -1
  187. package/dist/field/features/link/nodes/AutoLinkNode.js +1 -2
  188. package/dist/field/features/link/nodes/AutoLinkNode.js.map +1 -1
  189. package/dist/field/features/link/nodes/LinkNode.d.ts +1 -3
  190. package/dist/field/features/link/nodes/LinkNode.d.ts.map +1 -1
  191. package/dist/field/features/link/nodes/LinkNode.js +2 -4
  192. package/dist/field/features/link/nodes/LinkNode.js.map +1 -1
  193. package/dist/field/features/link/plugins/autoLink/index.d.ts +3 -2
  194. package/dist/field/features/link/plugins/autoLink/index.d.ts.map +1 -1
  195. package/dist/field/features/link/plugins/autoLink/index.js +5 -8
  196. package/dist/field/features/link/plugins/autoLink/index.js.map +1 -1
  197. package/dist/field/features/link/plugins/clickableLink/index.d.ts +3 -2
  198. package/dist/field/features/link/plugins/clickableLink/index.d.ts.map +1 -1
  199. package/dist/field/features/link/plugins/clickableLink/index.js +2 -2
  200. package/dist/field/features/link/plugins/clickableLink/index.js.map +1 -1
  201. package/dist/field/features/link/plugins/floatingLinkEditor/LinkEditor/commands.d.ts.map +1 -1
  202. package/dist/field/features/link/plugins/floatingLinkEditor/LinkEditor/commands.js +1 -2
  203. package/dist/field/features/link/plugins/floatingLinkEditor/LinkEditor/commands.js.map +1 -1
  204. package/dist/field/features/link/plugins/floatingLinkEditor/LinkEditor/index.d.ts.map +1 -1
  205. package/dist/field/features/link/plugins/floatingLinkEditor/LinkEditor/index.js +93 -69
  206. package/dist/field/features/link/plugins/floatingLinkEditor/LinkEditor/index.js.map +1 -1
  207. package/dist/field/features/link/plugins/floatingLinkEditor/index.d.ts +3 -4
  208. package/dist/field/features/link/plugins/floatingLinkEditor/index.d.ts.map +1 -1
  209. package/dist/field/features/link/plugins/floatingLinkEditor/index.js.map +1 -1
  210. package/dist/field/features/link/plugins/floatingLinkEditor/index.scss +11 -3
  211. package/dist/field/features/link/plugins/floatingLinkEditor/utilities.d.ts +1 -3
  212. package/dist/field/features/link/plugins/floatingLinkEditor/utilities.d.ts.map +1 -1
  213. package/dist/field/features/link/plugins/floatingLinkEditor/utilities.js +12 -30
  214. package/dist/field/features/link/plugins/floatingLinkEditor/utilities.js.map +1 -1
  215. package/dist/field/features/link/plugins/link/index.d.ts +3 -1
  216. package/dist/field/features/link/plugins/link/index.d.ts.map +1 -1
  217. package/dist/field/features/link/plugins/link/index.js +5 -14
  218. package/dist/field/features/link/plugins/link/index.js.map +1 -1
  219. package/dist/field/features/link/populationPromise.d.ts.map +1 -1
  220. package/dist/field/features/link/populationPromise.js +10 -25
  221. package/dist/field/features/link/populationPromise.js.map +1 -1
  222. package/dist/field/features/link/validate.d.ts +5 -0
  223. package/dist/field/features/link/validate.d.ts.map +1 -0
  224. package/dist/field/features/link/validate.js +32 -0
  225. package/dist/field/features/link/validate.js.map +1 -0
  226. package/dist/field/features/lists/checklist/feature.client.d.ts +4 -1
  227. package/dist/field/features/lists/checklist/feature.client.d.ts.map +1 -1
  228. package/dist/field/features/lists/checklist/feature.client.js +56 -32
  229. package/dist/field/features/lists/checklist/feature.client.js.map +1 -1
  230. package/dist/field/features/lists/checklist/feature.server.d.ts +1 -1
  231. package/dist/field/features/lists/checklist/feature.server.d.ts.map +1 -1
  232. package/dist/field/features/lists/checklist/feature.server.js +10 -10
  233. package/dist/field/features/lists/checklist/feature.server.js.map +1 -1
  234. package/dist/field/features/lists/checklist/markdownTransformers.d.ts.map +1 -1
  235. package/dist/field/features/lists/checklist/markdownTransformers.js +2 -3
  236. package/dist/field/features/lists/checklist/markdownTransformers.js.map +1 -1
  237. package/dist/field/features/lists/checklist/plugin/index.d.ts +2 -2
  238. package/dist/field/features/lists/checklist/plugin/index.d.ts.map +1 -1
  239. package/dist/field/features/lists/checklist/plugin/index.js +3 -4
  240. package/dist/field/features/lists/checklist/plugin/index.js.map +1 -1
  241. package/dist/field/features/lists/htmlConverter.d.ts.map +1 -1
  242. package/dist/field/features/lists/htmlConverter.js +13 -6
  243. package/dist/field/features/lists/htmlConverter.js.map +1 -1
  244. package/dist/field/features/lists/{orderedlist → orderedList}/feature.client.d.ts +4 -1
  245. package/dist/field/features/lists/orderedList/feature.client.d.ts.map +1 -0
  246. package/dist/field/features/lists/orderedList/feature.client.js +96 -0
  247. package/dist/field/features/lists/orderedList/feature.client.js.map +1 -0
  248. package/dist/field/features/lists/orderedList/feature.server.d.ts.map +1 -0
  249. package/dist/field/features/lists/{orderedlist → orderedList}/feature.server.js +7 -7
  250. package/dist/field/features/lists/orderedList/feature.server.js.map +1 -0
  251. package/dist/field/features/lists/orderedList/markdownTransformer.d.ts.map +1 -0
  252. package/dist/field/features/lists/{orderedlist → orderedList}/markdownTransformer.js +2 -3
  253. package/dist/field/features/lists/orderedList/markdownTransformer.js.map +1 -0
  254. package/dist/field/features/lists/plugin/index.d.ts +2 -2
  255. package/dist/field/features/lists/plugin/index.d.ts.map +1 -1
  256. package/dist/field/features/lists/plugin/index.js +3 -4
  257. package/dist/field/features/lists/plugin/index.js.map +1 -1
  258. package/dist/field/features/lists/{common → shared}/markdown.d.ts.map +1 -1
  259. package/dist/field/features/lists/{common → shared}/markdown.js +1 -2
  260. package/dist/field/features/lists/shared/markdown.js.map +1 -0
  261. package/dist/field/features/lists/{unorderedlist → unorderedList}/feature.client.d.ts +4 -1
  262. package/dist/field/features/lists/unorderedList/feature.client.d.ts.map +1 -0
  263. package/dist/field/features/lists/unorderedList/feature.client.js +96 -0
  264. package/dist/field/features/lists/unorderedList/feature.client.js.map +1 -0
  265. package/dist/field/features/lists/unorderedList/feature.server.d.ts.map +1 -0
  266. package/dist/field/features/lists/{unorderedlist → unorderedList}/feature.server.js +7 -7
  267. package/dist/field/features/lists/unorderedList/feature.server.js.map +1 -0
  268. package/dist/field/features/lists/unorderedList/markdownTransformer.d.ts.map +1 -0
  269. package/dist/field/features/lists/{unorderedlist → unorderedList}/markdownTransformer.js +2 -3
  270. package/dist/field/features/lists/unorderedList/markdownTransformer.js.map +1 -0
  271. package/dist/field/features/migrations/lexicalPluginToLexical/converter/converters/upload/converter.d.ts.map +1 -1
  272. package/dist/field/features/migrations/lexicalPluginToLexical/converter/converters/upload/converter.js +2 -4
  273. package/dist/field/features/migrations/lexicalPluginToLexical/converter/converters/upload/converter.js.map +1 -1
  274. package/dist/field/features/migrations/lexicalPluginToLexical/feature.client.d.ts +4 -1
  275. package/dist/field/features/migrations/lexicalPluginToLexical/feature.client.d.ts.map +1 -1
  276. package/dist/field/features/migrations/lexicalPluginToLexical/nodes/unknownConvertedNode/index.d.ts +1 -3
  277. package/dist/field/features/migrations/lexicalPluginToLexical/nodes/unknownConvertedNode/index.d.ts.map +1 -1
  278. package/dist/field/features/migrations/lexicalPluginToLexical/nodes/unknownConvertedNode/index.js +2 -4
  279. package/dist/field/features/migrations/lexicalPluginToLexical/nodes/unknownConvertedNode/index.js.map +1 -1
  280. package/dist/field/features/migrations/slateToLexical/converter/converters/blockquote/client.d.ts +1 -1
  281. package/dist/field/features/migrations/slateToLexical/converter/converters/blockquote/client.js +1 -1
  282. package/dist/field/features/migrations/slateToLexical/converter/converters/blockquote/client.js.map +1 -1
  283. package/dist/field/features/migrations/slateToLexical/converter/converters/blockquote/index.js +2 -2
  284. package/dist/field/features/migrations/slateToLexical/converter/converters/blockquote/index.js.map +1 -1
  285. package/dist/field/features/migrations/slateToLexical/converter/converters/relationship/converter.d.ts.map +1 -1
  286. package/dist/field/features/migrations/slateToLexical/converter/converters/relationship/converter.js +2 -4
  287. package/dist/field/features/migrations/slateToLexical/converter/converters/relationship/converter.js.map +1 -1
  288. package/dist/field/features/migrations/slateToLexical/converter/converters/upload/converter.d.ts.map +1 -1
  289. package/dist/field/features/migrations/slateToLexical/converter/converters/upload/converter.js +2 -4
  290. package/dist/field/features/migrations/slateToLexical/converter/converters/upload/converter.js.map +1 -1
  291. package/dist/field/features/migrations/slateToLexical/converter/index.d.ts.map +1 -1
  292. package/dist/field/features/migrations/slateToLexical/converter/index.js +2 -1
  293. package/dist/field/features/migrations/slateToLexical/converter/index.js.map +1 -1
  294. package/dist/field/features/migrations/slateToLexical/feature.client.d.ts +4 -1
  295. package/dist/field/features/migrations/slateToLexical/feature.client.d.ts.map +1 -1
  296. package/dist/field/features/migrations/slateToLexical/nodes/unknownConvertedNode/index.d.ts +1 -3
  297. package/dist/field/features/migrations/slateToLexical/nodes/unknownConvertedNode/index.d.ts.map +1 -1
  298. package/dist/field/features/migrations/slateToLexical/nodes/unknownConvertedNode/index.js +2 -4
  299. package/dist/field/features/migrations/slateToLexical/nodes/unknownConvertedNode/index.js.map +1 -1
  300. package/dist/field/features/paragraph/feature.client.d.ts +4 -1
  301. package/dist/field/features/paragraph/feature.client.d.ts.map +1 -1
  302. package/dist/field/features/paragraph/feature.client.js +45 -33
  303. package/dist/field/features/paragraph/feature.client.js.map +1 -1
  304. package/dist/field/features/relationship/drawer/commands.d.ts.map +1 -1
  305. package/dist/field/features/relationship/drawer/commands.js +1 -2
  306. package/dist/field/features/relationship/drawer/commands.js.map +1 -1
  307. package/dist/field/features/relationship/drawer/index.d.ts.map +1 -1
  308. package/dist/field/features/relationship/drawer/index.js +7 -13
  309. package/dist/field/features/relationship/drawer/index.js.map +1 -1
  310. package/dist/field/features/relationship/feature.client.d.ts +17 -2
  311. package/dist/field/features/relationship/feature.client.d.ts.map +1 -1
  312. package/dist/field/features/relationship/feature.client.js +37 -15
  313. package/dist/field/features/relationship/feature.client.js.map +1 -1
  314. package/dist/field/features/relationship/feature.server.d.ts +10 -1
  315. package/dist/field/features/relationship/feature.server.d.ts.map +1 -1
  316. package/dist/field/features/relationship/feature.server.js +5 -4
  317. package/dist/field/features/relationship/feature.server.js.map +1 -1
  318. package/dist/field/features/relationship/nodes/RelationshipNode.d.ts +3 -8
  319. package/dist/field/features/relationship/nodes/RelationshipNode.d.ts.map +1 -1
  320. package/dist/field/features/relationship/nodes/RelationshipNode.js +8 -8
  321. package/dist/field/features/relationship/nodes/RelationshipNode.js.map +1 -1
  322. package/dist/field/features/relationship/nodes/components/RelationshipComponent.d.ts.map +1 -1
  323. package/dist/field/features/relationship/nodes/components/RelationshipComponent.js +56 -7
  324. package/dist/field/features/relationship/nodes/components/RelationshipComponent.js.map +1 -1
  325. package/dist/field/features/relationship/plugins/index.d.ts +2 -2
  326. package/dist/field/features/relationship/plugins/index.d.ts.map +1 -1
  327. package/dist/field/features/relationship/plugins/index.js +9 -12
  328. package/dist/field/features/relationship/plugins/index.js.map +1 -1
  329. package/dist/field/features/relationship/populationPromise.d.ts +2 -1
  330. package/dist/field/features/relationship/populationPromise.d.ts.map +1 -1
  331. package/dist/field/features/relationship/populationPromise.js +25 -19
  332. package/dist/field/features/relationship/populationPromise.js.map +1 -1
  333. package/dist/field/features/shared/toolbar/addDropdownGroup.d.ts +3 -0
  334. package/dist/field/features/shared/toolbar/addDropdownGroup.d.ts.map +1 -0
  335. package/dist/field/features/shared/toolbar/addDropdownGroup.js +12 -0
  336. package/dist/field/features/shared/toolbar/addDropdownGroup.js.map +1 -0
  337. package/dist/field/features/shared/toolbar/featureButtonsGroup.d.ts +3 -0
  338. package/dist/field/features/shared/toolbar/featureButtonsGroup.d.ts.map +1 -0
  339. package/dist/field/features/shared/toolbar/featureButtonsGroup.js +10 -0
  340. package/dist/field/features/shared/toolbar/featureButtonsGroup.js.map +1 -0
  341. package/dist/field/features/shared/toolbar/textDropdownGroup.d.ts +3 -0
  342. package/dist/field/features/shared/toolbar/textDropdownGroup.d.ts.map +1 -0
  343. package/dist/field/features/shared/toolbar/textDropdownGroup.js +12 -0
  344. package/dist/field/features/shared/toolbar/textDropdownGroup.js.map +1 -0
  345. package/dist/field/features/toolbars/fixed/Toolbar/index.d.ts +4 -0
  346. package/dist/field/features/toolbars/fixed/Toolbar/index.d.ts.map +1 -0
  347. package/dist/field/features/toolbars/fixed/Toolbar/index.js +152 -0
  348. package/dist/field/features/toolbars/fixed/Toolbar/index.js.map +1 -0
  349. package/dist/field/features/toolbars/fixed/Toolbar/index.scss +91 -0
  350. package/dist/field/features/toolbars/fixed/feature.client.d.ts +6 -0
  351. package/dist/field/features/toolbars/fixed/feature.client.d.ts.map +1 -0
  352. package/dist/field/features/toolbars/fixed/feature.client.js +20 -0
  353. package/dist/field/features/toolbars/fixed/feature.client.js.map +1 -0
  354. package/dist/field/features/toolbars/fixed/feature.server.d.ts +3 -0
  355. package/dist/field/features/toolbars/fixed/feature.server.d.ts.map +1 -0
  356. package/dist/field/features/toolbars/fixed/feature.server.js +15 -0
  357. package/dist/field/features/toolbars/fixed/feature.server.js.map +1 -0
  358. package/dist/field/features/toolbars/inline/Toolbar/index.d.ts +4 -0
  359. package/dist/field/features/toolbars/inline/Toolbar/index.d.ts.map +1 -0
  360. package/dist/field/{lexical/plugins/FloatingSelectToolbar → features/toolbars/inline/Toolbar}/index.js +112 -70
  361. package/dist/field/features/toolbars/inline/Toolbar/index.js.map +1 -0
  362. package/dist/field/{lexical/plugins/FloatingSelectToolbar → features/toolbars/inline/Toolbar}/index.scss +7 -11
  363. package/dist/field/features/toolbars/inline/feature.client.d.ts +6 -0
  364. package/dist/field/features/toolbars/inline/feature.client.d.ts.map +1 -0
  365. package/dist/field/features/toolbars/inline/feature.client.js +20 -0
  366. package/dist/field/features/toolbars/inline/feature.client.js.map +1 -0
  367. package/dist/field/features/toolbars/inline/feature.server.d.ts +3 -0
  368. package/dist/field/features/toolbars/inline/feature.server.d.ts.map +1 -0
  369. package/dist/field/features/toolbars/inline/feature.server.js +15 -0
  370. package/dist/field/features/toolbars/inline/feature.server.js.map +1 -0
  371. package/dist/field/features/toolbars/shared/ToolbarButton/index.d.ts +10 -0
  372. package/dist/field/features/toolbars/shared/ToolbarButton/index.d.ts.map +1 -0
  373. package/dist/field/{lexical/plugins/FloatingSelectToolbar → features/toolbars/shared}/ToolbarButton/index.js +29 -19
  374. package/dist/field/features/toolbars/shared/ToolbarButton/index.js.map +1 -0
  375. package/dist/field/{lexical/plugins/FloatingSelectToolbar → features/toolbars/shared}/ToolbarButton/index.scss +3 -1
  376. package/dist/field/features/toolbars/shared/ToolbarDropdown/DropDown.d.ts +23 -0
  377. package/dist/field/features/toolbars/shared/ToolbarDropdown/DropDown.d.ts.map +1 -0
  378. package/dist/field/{lexical/plugins/FloatingSelectToolbar → features/toolbars/shared}/ToolbarDropdown/DropDown.js +27 -72
  379. package/dist/field/features/toolbars/shared/ToolbarDropdown/DropDown.js.map +1 -0
  380. package/dist/field/features/toolbars/shared/ToolbarDropdown/index.d.ts +23 -0
  381. package/dist/field/features/toolbars/shared/ToolbarDropdown/index.d.ts.map +1 -0
  382. package/dist/field/features/toolbars/shared/ToolbarDropdown/index.js +139 -0
  383. package/dist/field/features/toolbars/shared/ToolbarDropdown/index.js.map +1 -0
  384. package/dist/field/{lexical/plugins/FloatingSelectToolbar → features/toolbars/shared}/ToolbarDropdown/index.scss +25 -13
  385. package/dist/field/features/toolbars/types.d.ts +48 -0
  386. package/dist/field/features/toolbars/types.d.ts.map +1 -0
  387. package/dist/field/features/toolbars/types.js.map +1 -0
  388. package/dist/field/features/typeUtilities.d.ts +8 -0
  389. package/dist/field/features/typeUtilities.d.ts.map +1 -0
  390. package/dist/field/features/typeUtilities.js +8 -0
  391. package/dist/field/features/typeUtilities.js.map +1 -0
  392. package/dist/field/features/types.d.ts +136 -62
  393. package/dist/field/features/types.d.ts.map +1 -1
  394. package/dist/field/features/types.js.map +1 -1
  395. package/dist/field/features/upload/component/ExtraFieldsDrawer/index.d.ts.map +1 -1
  396. package/dist/field/features/upload/component/ExtraFieldsDrawer/index.js +5 -6
  397. package/dist/field/features/upload/component/ExtraFieldsDrawer/index.js.map +1 -1
  398. package/dist/field/features/upload/component/index.d.ts.map +1 -1
  399. package/dist/field/features/upload/component/index.js +59 -9
  400. package/dist/field/features/upload/component/index.js.map +1 -1
  401. package/dist/field/features/upload/drawer/commands.d.ts.map +1 -1
  402. package/dist/field/features/upload/drawer/commands.js +1 -2
  403. package/dist/field/features/upload/drawer/commands.js.map +1 -1
  404. package/dist/field/features/upload/drawer/index.d.ts.map +1 -1
  405. package/dist/field/features/upload/drawer/index.js +8 -12
  406. package/dist/field/features/upload/drawer/index.js.map +1 -1
  407. package/dist/field/features/upload/feature.client.d.ts +4 -1
  408. package/dist/field/features/upload/feature.client.d.ts.map +1 -1
  409. package/dist/field/features/upload/feature.client.js +35 -10
  410. package/dist/field/features/upload/feature.client.js.map +1 -1
  411. package/dist/field/features/upload/feature.server.d.ts +10 -3
  412. package/dist/field/features/upload/feature.server.d.ts.map +1 -1
  413. package/dist/field/features/upload/feature.server.js +39 -11
  414. package/dist/field/features/upload/feature.server.js.map +1 -1
  415. package/dist/field/features/upload/nodes/UploadNode.d.ts +2 -14
  416. package/dist/field/features/upload/nodes/UploadNode.d.ts.map +1 -1
  417. package/dist/field/features/upload/nodes/UploadNode.js +24 -11
  418. package/dist/field/features/upload/nodes/UploadNode.js.map +1 -1
  419. package/dist/field/features/upload/plugin/index.d.ts +5 -4
  420. package/dist/field/features/upload/plugin/index.d.ts.map +1 -1
  421. package/dist/field/features/upload/plugin/index.js +6 -11
  422. package/dist/field/features/upload/plugin/index.js.map +1 -1
  423. package/dist/field/features/upload/populationPromise.d.ts.map +1 -1
  424. package/dist/field/features/upload/populationPromise.js +15 -9
  425. package/dist/field/features/upload/populationPromise.js.map +1 -1
  426. package/dist/field/features/upload/validate.d.ts +2 -1
  427. package/dist/field/features/upload/validate.d.ts.map +1 -1
  428. package/dist/field/features/upload/validate.js +37 -12
  429. package/dist/field/features/upload/validate.js.map +1 -1
  430. package/dist/field/index.d.ts +1 -1
  431. package/dist/field/index.d.ts.map +1 -1
  432. package/dist/field/index.js.map +1 -1
  433. package/dist/field/index.scss +4 -0
  434. package/dist/field/lexical/EditorFocusProvider.d.ts +20 -0
  435. package/dist/field/lexical/EditorFocusProvider.d.ts.map +1 -0
  436. package/dist/field/lexical/EditorFocusProvider.js +78 -0
  437. package/dist/field/lexical/EditorFocusProvider.js.map +1 -0
  438. package/dist/field/lexical/EditorPlugin.d.ts +1 -0
  439. package/dist/field/lexical/EditorPlugin.d.ts.map +1 -1
  440. package/dist/field/lexical/EditorPlugin.js +6 -3
  441. package/dist/field/lexical/EditorPlugin.js.map +1 -1
  442. package/dist/field/lexical/LexicalEditor.d.ts.map +1 -1
  443. package/dist/field/lexical/LexicalEditor.js +31 -15
  444. package/dist/field/lexical/LexicalEditor.js.map +1 -1
  445. package/dist/field/lexical/LexicalEditor.scss +3 -19
  446. package/dist/field/lexical/LexicalProvider.d.ts +1 -1
  447. package/dist/field/lexical/LexicalProvider.d.ts.map +1 -1
  448. package/dist/field/lexical/LexicalProvider.js +4 -4
  449. package/dist/field/lexical/LexicalProvider.js.map +1 -1
  450. package/dist/field/lexical/config/client/EditorConfigProvider.d.ts +2 -3
  451. package/dist/field/lexical/config/client/EditorConfigProvider.d.ts.map +1 -1
  452. package/dist/field/lexical/config/client/EditorConfigProvider.js.map +1 -1
  453. package/dist/field/lexical/config/client/default.d.ts +1 -1
  454. package/dist/field/lexical/config/client/default.d.ts.map +1 -1
  455. package/dist/field/lexical/config/client/default.js.map +1 -1
  456. package/dist/field/lexical/config/client/sanitize.d.ts +1 -1
  457. package/dist/field/lexical/config/client/sanitize.d.ts.map +1 -1
  458. package/dist/field/lexical/config/client/sanitize.js +81 -32
  459. package/dist/field/lexical/config/client/sanitize.js.map +1 -1
  460. package/dist/field/lexical/config/server/default.d.ts +2 -3
  461. package/dist/field/lexical/config/server/default.d.ts.map +1 -1
  462. package/dist/field/lexical/config/server/default.js +12 -10
  463. package/dist/field/lexical/config/server/default.js.map +1 -1
  464. package/dist/field/lexical/config/server/loader.d.ts +5 -2
  465. package/dist/field/lexical/config/server/loader.d.ts.map +1 -1
  466. package/dist/field/lexical/config/server/loader.js +4 -2
  467. package/dist/field/lexical/config/server/loader.js.map +1 -1
  468. package/dist/field/lexical/config/server/sanitize.d.ts +2 -1
  469. package/dist/field/lexical/config/server/sanitize.d.ts.map +1 -1
  470. package/dist/field/lexical/config/server/sanitize.js +23 -8
  471. package/dist/field/lexical/config/server/sanitize.js.map +1 -1
  472. package/dist/field/lexical/config/types.d.ts +1 -1
  473. package/dist/field/lexical/config/types.d.ts.map +1 -1
  474. package/dist/field/lexical/config/types.js.map +1 -1
  475. package/dist/field/lexical/plugins/MarkdownShortcut/index.d.ts.map +1 -1
  476. package/dist/field/lexical/plugins/MarkdownShortcut/index.js +1 -2
  477. package/dist/field/lexical/plugins/MarkdownShortcut/index.js.map +1 -1
  478. package/dist/field/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/LexicalMenu.d.ts +9 -9
  479. package/dist/field/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/LexicalMenu.d.ts.map +1 -1
  480. package/dist/field/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/LexicalMenu.js +74 -77
  481. package/dist/field/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/LexicalMenu.js.map +1 -1
  482. package/dist/field/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/index.d.ts +4 -4
  483. package/dist/field/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/index.d.ts.map +1 -1
  484. package/dist/field/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/index.js +6 -9
  485. package/dist/field/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/index.js.map +1 -1
  486. package/dist/field/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/types.d.ts +19 -27
  487. package/dist/field/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/types.d.ts.map +1 -1
  488. package/dist/field/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/types.js +1 -37
  489. package/dist/field/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/types.js.map +1 -1
  490. package/dist/field/lexical/plugins/SlashMenu/index.d.ts +2 -2
  491. package/dist/field/lexical/plugins/SlashMenu/index.d.ts.map +1 -1
  492. package/dist/field/lexical/plugins/SlashMenu/index.js +72 -67
  493. package/dist/field/lexical/plugins/SlashMenu/index.js.map +1 -1
  494. package/dist/field/lexical/plugins/handles/AddBlockHandlePlugin/index.d.ts.map +1 -1
  495. package/dist/field/lexical/plugins/handles/AddBlockHandlePlugin/index.js +13 -10
  496. package/dist/field/lexical/plugins/handles/AddBlockHandlePlugin/index.js.map +1 -1
  497. package/dist/field/lexical/plugins/handles/DraggableBlockPlugin/getNodeCloseToPoint.d.ts +1 -1
  498. package/dist/field/lexical/plugins/handles/DraggableBlockPlugin/getNodeCloseToPoint.d.ts.map +1 -1
  499. package/dist/field/lexical/plugins/handles/DraggableBlockPlugin/getNodeCloseToPoint.js +3 -4
  500. package/dist/field/lexical/plugins/handles/DraggableBlockPlugin/getNodeCloseToPoint.js.map +1 -1
  501. package/dist/field/lexical/plugins/handles/DraggableBlockPlugin/index.d.ts.map +1 -1
  502. package/dist/field/lexical/plugins/handles/DraggableBlockPlugin/index.js +16 -10
  503. package/dist/field/lexical/plugins/handles/DraggableBlockPlugin/index.js.map +1 -1
  504. package/dist/field/lexical/plugins/handles/DraggableBlockPlugin/index.scss +8 -0
  505. package/dist/field/lexical/plugins/handles/DraggableBlockPlugin/setTargetLine.d.ts.map +1 -1
  506. package/dist/field/lexical/plugins/handles/DraggableBlockPlugin/setTargetLine.js +25 -6
  507. package/dist/field/lexical/plugins/handles/DraggableBlockPlugin/setTargetLine.js.map +1 -1
  508. package/dist/field/lexical/plugins/handles/utils/doesLineHeightAffectElement.d.ts +9 -0
  509. package/dist/field/lexical/plugins/handles/utils/doesLineHeightAffectElement.d.ts.map +1 -0
  510. package/dist/field/lexical/plugins/handles/utils/doesLineHeightAffectElement.js +35 -0
  511. package/dist/field/lexical/plugins/handles/utils/doesLineHeightAffectElement.js.map +1 -0
  512. package/dist/field/lexical/plugins/handles/utils/getTopLevelNodeKeys.d.ts.map +1 -1
  513. package/dist/field/lexical/plugins/handles/utils/getTopLevelNodeKeys.js +1 -2
  514. package/dist/field/lexical/plugins/handles/utils/getTopLevelNodeKeys.js.map +1 -1
  515. package/dist/field/lexical/plugins/handles/utils/setHandlePosition.d.ts +1 -1
  516. package/dist/field/lexical/plugins/handles/utils/setHandlePosition.d.ts.map +1 -1
  517. package/dist/field/lexical/plugins/handles/utils/setHandlePosition.js +17 -7
  518. package/dist/field/lexical/plugins/handles/utils/setHandlePosition.js.map +1 -1
  519. package/dist/field/lexical/theme/EditorTheme.scss +13 -14
  520. package/dist/field/lexical/ui/ContentEditable.d.ts.map +1 -1
  521. package/dist/field/lexical/ui/ContentEditable.js +1 -2
  522. package/dist/field/lexical/ui/ContentEditable.js.map +1 -1
  523. package/dist/field/lexical/ui/icons/Add/index.d.ts +3 -0
  524. package/dist/field/lexical/ui/icons/Add/index.d.ts.map +1 -0
  525. package/dist/field/lexical/ui/icons/Add/index.js +16 -0
  526. package/dist/field/lexical/ui/icons/Add/index.js.map +1 -0
  527. package/dist/field/lexical/ui/icons/HorizontalRule/index.d.ts +3 -0
  528. package/dist/field/lexical/ui/icons/HorizontalRule/index.d.ts.map +1 -0
  529. package/dist/field/lexical/ui/icons/HorizontalRule/index.js +19 -0
  530. package/dist/field/lexical/ui/icons/HorizontalRule/index.js.map +1 -0
  531. package/dist/field/lexical/utils/getSelectedNode.d.ts.map +1 -1
  532. package/dist/field/lexical/utils/getSelectedNode.js +1 -2
  533. package/dist/field/lexical/utils/getSelectedNode.js.map +1 -1
  534. package/dist/field/lexical/utils/nodeFormat.d.ts +2 -1
  535. package/dist/field/lexical/utils/nodeFormat.d.ts.map +1 -1
  536. package/dist/field/lexical/utils/nodeFormat.js.map +1 -1
  537. package/dist/field/lexical/utils/setFloatingElemPosition.d.ts +11 -1
  538. package/dist/field/lexical/utils/setFloatingElemPosition.d.ts.map +1 -1
  539. package/dist/field/lexical/utils/setFloatingElemPosition.js +16 -13
  540. package/dist/field/lexical/utils/setFloatingElemPosition.js.map +1 -1
  541. package/dist/field/lexical/utils/url.d.ts.map +1 -1
  542. package/dist/field/lexical/utils/url.js +3 -0
  543. package/dist/field/lexical/utils/url.js.map +1 -1
  544. package/dist/forEachNodeRecursively.d.ts +10 -0
  545. package/dist/forEachNodeRecursively.d.ts.map +1 -0
  546. package/dist/forEachNodeRecursively.js +24 -0
  547. package/dist/forEachNodeRecursively.js.map +1 -0
  548. package/dist/generateComponentMap.d.ts.map +1 -1
  549. package/dist/generateComponentMap.js +16 -22
  550. package/dist/generateComponentMap.js.map +1 -1
  551. package/dist/generateSchemaMap.d.ts.map +1 -1
  552. package/dist/generateSchemaMap.js +4 -12
  553. package/dist/generateSchemaMap.js.map +1 -1
  554. package/dist/index.d.ts +24 -20
  555. package/dist/index.d.ts.map +1 -1
  556. package/dist/index.js +275 -184
  557. package/dist/index.js.map +1 -1
  558. package/dist/populate/defaultValue.d.ts.map +1 -1
  559. package/dist/populate/defaultValue.js +1 -0
  560. package/dist/populate/defaultValue.js.map +1 -1
  561. package/dist/populate/populate.d.ts +5 -4
  562. package/dist/populate/populate.d.ts.map +1 -1
  563. package/dist/populate/populate.js +13 -11
  564. package/dist/populate/populate.js.map +1 -1
  565. package/dist/populate/populateLexicalPopulationPromises.d.ts +12 -0
  566. package/dist/populate/populateLexicalPopulationPromises.d.ts.map +1 -0
  567. package/dist/populate/populateLexicalPopulationPromises.js +36 -0
  568. package/dist/populate/populateLexicalPopulationPromises.js.map +1 -0
  569. package/dist/populate/recurseNestedFields.d.ts +8 -4
  570. package/dist/populate/recurseNestedFields.d.ts.map +1 -1
  571. package/dist/populate/recurseNestedFields.js +4 -5
  572. package/dist/populate/recurseNestedFields.js.map +1 -1
  573. package/dist/scss/app.scss +2 -3
  574. package/dist/scss/vars.scss +0 -7
  575. package/dist/types.d.ts +12 -5
  576. package/dist/types.d.ts.map +1 -1
  577. package/dist/types.js.map +1 -1
  578. package/dist/validate/index.d.ts +1 -1
  579. package/dist/validate/index.d.ts.map +1 -1
  580. package/package.json +48 -47
  581. package/components.d.ts +0 -6
  582. package/components.js +0 -7
  583. package/dist/field/features/align/floatingSelectToolbarAlignDropdownSection.d.ts +0 -3
  584. package/dist/field/features/align/floatingSelectToolbarAlignDropdownSection.d.ts.map +0 -1
  585. package/dist/field/features/align/floatingSelectToolbarAlignDropdownSection.js +0 -12
  586. package/dist/field/features/align/floatingSelectToolbarAlignDropdownSection.js.map +0 -1
  587. package/dist/field/features/common/floatingSelectToolbarFeaturesButtonsSection/index.d.ts +0 -3
  588. package/dist/field/features/common/floatingSelectToolbarFeaturesButtonsSection/index.d.ts.map +0 -1
  589. package/dist/field/features/common/floatingSelectToolbarFeaturesButtonsSection/index.js +0 -10
  590. package/dist/field/features/common/floatingSelectToolbarFeaturesButtonsSection/index.js.map +0 -1
  591. package/dist/field/features/common/floatingSelectToolbarTextDropdownSection/index.d.ts +0 -3
  592. package/dist/field/features/common/floatingSelectToolbarTextDropdownSection/index.d.ts.map +0 -1
  593. package/dist/field/features/common/floatingSelectToolbarTextDropdownSection/index.js +0 -12
  594. package/dist/field/features/common/floatingSelectToolbarTextDropdownSection/index.js.map +0 -1
  595. package/dist/field/features/debug/testrecorder/feature.client.d.ts.map +0 -1
  596. package/dist/field/features/debug/testrecorder/plugin/index.d.ts +0 -5
  597. package/dist/field/features/debug/testrecorder/plugin/index.d.ts.map +0 -1
  598. package/dist/field/features/debug/testrecorder/plugin/index.js.map +0 -1
  599. package/dist/field/features/debug/treeview/feature.client.d.ts.map +0 -1
  600. package/dist/field/features/debug/treeview/plugin/index.d.ts +0 -4
  601. package/dist/field/features/debug/treeview/plugin/index.d.ts.map +0 -1
  602. package/dist/field/features/debug/treeview/plugin/index.js.map +0 -1
  603. package/dist/field/features/format/common/floatingSelectToolbarSection.d.ts +0 -3
  604. package/dist/field/features/format/common/floatingSelectToolbarSection.d.ts.map +0 -1
  605. package/dist/field/features/format/common/floatingSelectToolbarSection.js +0 -10
  606. package/dist/field/features/format/common/floatingSelectToolbarSection.js.map +0 -1
  607. package/dist/field/features/format/inlinecode/feature.client.d.ts.map +0 -1
  608. package/dist/field/features/format/inlinecode/feature.client.js +0 -43
  609. package/dist/field/features/format/inlinecode/feature.client.js.map +0 -1
  610. package/dist/field/features/indent/floatingSelectToolbarIndentSection.d.ts +0 -3
  611. package/dist/field/features/indent/floatingSelectToolbarIndentSection.d.ts.map +0 -1
  612. package/dist/field/features/indent/floatingSelectToolbarIndentSection.js +0 -10
  613. package/dist/field/features/indent/floatingSelectToolbarIndentSection.js.map +0 -1
  614. package/dist/field/features/indent/index.scss +0 -4
  615. package/dist/field/features/lists/common/markdown.js.map +0 -1
  616. package/dist/field/features/lists/orderedlist/feature.client.d.ts.map +0 -1
  617. package/dist/field/features/lists/orderedlist/feature.client.js +0 -72
  618. package/dist/field/features/lists/orderedlist/feature.client.js.map +0 -1
  619. package/dist/field/features/lists/orderedlist/feature.server.d.ts.map +0 -1
  620. package/dist/field/features/lists/orderedlist/feature.server.js.map +0 -1
  621. package/dist/field/features/lists/orderedlist/markdownTransformer.d.ts.map +0 -1
  622. package/dist/field/features/lists/orderedlist/markdownTransformer.js.map +0 -1
  623. package/dist/field/features/lists/unorderedlist/feature.client.d.ts.map +0 -1
  624. package/dist/field/features/lists/unorderedlist/feature.client.js +0 -72
  625. package/dist/field/features/lists/unorderedlist/feature.client.js.map +0 -1
  626. package/dist/field/features/lists/unorderedlist/feature.server.d.ts.map +0 -1
  627. package/dist/field/features/lists/unorderedlist/feature.server.js.map +0 -1
  628. package/dist/field/features/lists/unorderedlist/markdownTransformer.d.ts.map +0 -1
  629. package/dist/field/features/lists/unorderedlist/markdownTransformer.js.map +0 -1
  630. package/dist/field/lexical/plugins/FloatingSelectToolbar/ToolbarButton/index.d.ts +0 -8
  631. package/dist/field/lexical/plugins/FloatingSelectToolbar/ToolbarButton/index.d.ts.map +0 -1
  632. package/dist/field/lexical/plugins/FloatingSelectToolbar/ToolbarButton/index.js.map +0 -1
  633. package/dist/field/lexical/plugins/FloatingSelectToolbar/ToolbarDropdown/DropDown.d.ts +0 -17
  634. package/dist/field/lexical/plugins/FloatingSelectToolbar/ToolbarDropdown/DropDown.d.ts.map +0 -1
  635. package/dist/field/lexical/plugins/FloatingSelectToolbar/ToolbarDropdown/DropDown.js.map +0 -1
  636. package/dist/field/lexical/plugins/FloatingSelectToolbar/ToolbarDropdown/index.d.ts +0 -18
  637. package/dist/field/lexical/plugins/FloatingSelectToolbar/ToolbarDropdown/index.d.ts.map +0 -1
  638. package/dist/field/lexical/plugins/FloatingSelectToolbar/ToolbarDropdown/index.js +0 -42
  639. package/dist/field/lexical/plugins/FloatingSelectToolbar/ToolbarDropdown/index.js.map +0 -1
  640. package/dist/field/lexical/plugins/FloatingSelectToolbar/index.d.ts +0 -6
  641. package/dist/field/lexical/plugins/FloatingSelectToolbar/index.d.ts.map +0 -1
  642. package/dist/field/lexical/plugins/FloatingSelectToolbar/index.js.map +0 -1
  643. package/dist/field/lexical/plugins/FloatingSelectToolbar/types.d.ts +0 -40
  644. package/dist/field/lexical/plugins/FloatingSelectToolbar/types.d.ts.map +0 -1
  645. package/dist/field/lexical/plugins/FloatingSelectToolbar/types.js.map +0 -1
  646. package/dist/populate/richTextRelationshipPromise.d.ts +0 -23
  647. package/dist/populate/richTextRelationshipPromise.d.ts.map +0 -1
  648. package/dist/populate/richTextRelationshipPromise.js +0 -68
  649. package/dist/populate/richTextRelationshipPromise.js.map +0 -1
  650. package/dist/scss/fonts.scss +0 -75
  651. package/src/index.ts +0 -423
  652. /package/dist/field/features/debug/{testrecorder → testRecorder}/feature.client.js +0 -0
  653. /package/dist/field/features/debug/{testrecorder → testRecorder}/feature.server.d.ts +0 -0
  654. /package/dist/field/features/debug/{testrecorder → testRecorder}/plugin/index.scss +0 -0
  655. /package/dist/field/features/debug/{treeview → treeView}/feature.client.js +0 -0
  656. /package/dist/field/features/debug/{treeview → treeView}/feature.server.d.ts +0 -0
  657. /package/dist/field/features/debug/{treeview → treeView}/plugin/index.scss +0 -0
  658. /package/dist/field/features/format/{inlinecode → inlineCode}/feature.server.d.ts +0 -0
  659. /package/dist/field/features/format/{inlinecode → inlineCode}/markdownTransformers.d.ts +0 -0
  660. /package/dist/field/features/format/{inlinecode → inlineCode}/markdownTransformers.js +0 -0
  661. /package/dist/field/features/lists/{orderedlist → orderedList}/feature.server.d.ts +0 -0
  662. /package/dist/field/features/lists/{orderedlist → orderedList}/markdownTransformer.d.ts +0 -0
  663. /package/dist/field/features/lists/{common → shared}/markdown.d.ts +0 -0
  664. /package/dist/field/features/lists/{unorderedlist → unorderedList}/feature.server.d.ts +0 -0
  665. /package/dist/field/features/lists/{unorderedlist → unorderedList}/markdownTransformer.d.ts +0 -0
  666. /package/dist/field/{lexical/plugins/FloatingSelectToolbar → features/toolbars}/types.js +0 -0
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/field/features/blockquote/feature.client.tsx"],"sourcesContent":["'use client'\n\nimport lexicalRichTextImport from '@lexical/rich-text'\nconst { $createQuoteNode, QuoteNode } = lexicalRichTextImport\n\nimport lexicalSelectionImport from '@lexical/selection'\nconst { $setBlocksType } = lexicalSelectionImport\n\nimport lexicalImport from 'lexical'\nconst { $getSelection } = lexicalImport\n\nimport type { FeatureProviderProviderClient } from '../types.js'\n\nimport { SlashMenuOption } from '../../lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/types.js'\nimport { BlockquoteIcon } from '../../lexical/ui/icons/Blockquote/index.js'\nimport { TextDropdownSectionWithEntries } from '../common/floatingSelectToolbarTextDropdownSection/index.js'\nimport { createClientComponent } from '../createClientComponent.js'\nimport { MarkdownTransformer } from './markdownTransformer.js'\n\nconst BlockQuoteFeatureClient: FeatureProviderProviderClient<undefined> = (props) => {\n return {\n clientFeatureProps: props,\n feature: () => ({\n clientFeatureProps: props,\n floatingSelectToolbar: {\n sections: [\n TextDropdownSectionWithEntries([\n {\n ChildComponent: BlockquoteIcon,\n isActive: () => false,\n key: 'blockquote',\n label: `Blockquote`,\n onClick: ({ editor }) => {\n editor.update(() => {\n const selection = $getSelection()\n $setBlocksType(selection, () => $createQuoteNode())\n })\n },\n order: 20,\n },\n ]),\n ],\n },\n markdownTransformers: [MarkdownTransformer],\n\n nodes: [QuoteNode],\n slashMenu: {\n options: [\n {\n displayName: 'Basic',\n key: 'basic',\n options: [\n new SlashMenuOption(`blockquote`, {\n Icon: BlockquoteIcon,\n displayName: `Blockquote`,\n keywords: ['quote', 'blockquote'],\n onSelect: () => {\n const selection = $getSelection()\n $setBlocksType(selection, () => $createQuoteNode())\n },\n }),\n ],\n },\n ],\n },\n }),\n }\n}\n\nexport const BlockQuoteFeatureClientComponent = createClientComponent(BlockQuoteFeatureClient)\n"],"names":["lexicalRichTextImport","$createQuoteNode","QuoteNode","lexicalSelectionImport","$setBlocksType","lexicalImport","$getSelection","SlashMenuOption","BlockquoteIcon","TextDropdownSectionWithEntries","createClientComponent","MarkdownTransformer","BlockQuoteFeatureClient","props","clientFeatureProps","feature","floatingSelectToolbar","sections","ChildComponent","isActive","key","label","onClick","editor","update","selection","order","markdownTransformers","nodes","slashMenu","options","displayName","Icon","keywords","onSelect","BlockQuoteFeatureClientComponent"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA;AAEA,OAAOA,2BAA2B,qBAAoB;AACtD,MAAM,EAAEC,gBAAgB,EAAEC,SAAS,EAAE,GAAGF;AAExC,OAAOG,4BAA4B,qBAAoB;AACvD,MAAM,EAAEC,cAAc,EAAE,GAAGD;AAE3B,OAAOE,mBAAmB,UAAS;AACnC,MAAM,EAAEC,aAAa,EAAE,GAAGD;AAI1B,SAASE,eAAe,QAAQ,sEAAqE;AACrG,SAASC,cAAc,QAAQ,6CAA4C;AAC3E,SAASC,8BAA8B,QAAQ,8DAA6D;AAC5G,SAASC,qBAAqB,QAAQ,8BAA6B;AACnE,SAASC,mBAAmB,QAAQ,2BAA0B;AAE9D,MAAMC,0BAAoE,CAACC;IACzE,OAAO;QACLC,oBAAoBD;QACpBE,SAAS,IAAO,CAAA;gBACdD,oBAAoBD;gBACpBG,uBAAuB;oBACrBC,UAAU;wBACRR,+BAA+B;4BAC7B;gCACES,gBAAgBV;gCAChBW,UAAU,IAAM;gCAChBC,KAAK;gCACLC,OAAO,CAAC,UAAU,CAAC;gCACnBC,SAAS,CAAC,EAAEC,MAAM,EAAE;oCAClBA,OAAOC,MAAM,CAAC;wCACZ,MAAMC,YAAYnB;wCAClBF,eAAeqB,WAAW,IAAMxB;oCAClC;gCACF;gCACAyB,OAAO;4BACT;yBACD;qBACF;gBACH;gBACAC,sBAAsB;oBAAChB;iBAAoB;gBAE3CiB,OAAO;oBAAC1B;iBAAU;gBAClB2B,WAAW;oBACTC,SAAS;wBACP;4BACEC,aAAa;4BACbX,KAAK;4BACLU,SAAS;gCACP,IAAIvB,gBAAgB,CAAC,UAAU,CAAC,EAAE;oCAChCyB,MAAMxB;oCACNuB,aAAa,CAAC,UAAU,CAAC;oCACzBE,UAAU;wCAAC;wCAAS;qCAAa;oCACjCC,UAAU;wCACR,MAAMT,YAAYnB;wCAClBF,eAAeqB,WAAW,IAAMxB;oCAClC;gCACF;6BACD;wBACH;qBACD;gBACH;YACF,CAAA;IACF;AACF;AAEA,OAAO,MAAMkC,mCAAmCzB,sBAAsBE,yBAAwB"}
1
+ {"version":3,"sources":["../../../../src/field/features/blockquote/feature.client.tsx"],"sourcesContent":["'use client'\n\nimport { $createQuoteNode, $isQuoteNode, QuoteNode } 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'\n\nimport { BlockquoteIcon } from '../../lexical/ui/icons/Blockquote/index.js'\nimport { createClientComponent } from '../createClientComponent.js'\nimport { toolbarTextDropdownGroupWithItems } from '../shared/toolbar/textDropdownGroup.js'\nimport { MarkdownTransformer } from './markdownTransformer.js'\n\nconst toolbarGroups: ToolbarGroup[] = [\n toolbarTextDropdownGroupWithItems([\n {\n ChildComponent: BlockquoteIcon,\n isActive: ({ selection }) => {\n if (!$isRangeSelection(selection)) {\n return false\n }\n for (const node of selection.getNodes()) {\n if (!$isQuoteNode(node) && !$isQuoteNode(node.getParent())) {\n return false\n }\n }\n return true\n },\n key: 'blockquote',\n label: `Blockquote`,\n onSelect: ({ editor }) => {\n editor.update(() => {\n const selection = $getSelection()\n $setBlocksType(selection, () => $createQuoteNode())\n })\n },\n order: 20,\n },\n ]),\n]\n\nconst BlockquoteFeatureClient: FeatureProviderProviderClient<undefined> = (props) => {\n return {\n clientFeatureProps: props,\n feature: () => ({\n clientFeatureProps: props,\n markdownTransformers: [MarkdownTransformer],\n nodes: [QuoteNode],\n\n slashMenu: {\n groups: [\n {\n items: [\n {\n Icon: BlockquoteIcon,\n key: 'blockquote',\n keywords: ['quote', 'blockquote'],\n label: 'Blockquote',\n onSelect: ({ editor }) => {\n editor.update(() => {\n const selection = $getSelection()\n $setBlocksType(selection, () => $createQuoteNode())\n })\n },\n },\n ],\n key: 'basic',\n label: 'Basic',\n },\n ],\n },\n toolbarFixed: {\n groups: toolbarGroups,\n },\n toolbarInline: {\n groups: toolbarGroups,\n },\n }),\n }\n}\n\nexport const BlockquoteFeatureClientComponent = createClientComponent(BlockquoteFeatureClient)\n"],"names":["$createQuoteNode","$isQuoteNode","QuoteNode","$setBlocksType","$getSelection","$isRangeSelection","BlockquoteIcon","createClientComponent","toolbarTextDropdownGroupWithItems","MarkdownTransformer","toolbarGroups","ChildComponent","isActive","selection","node","getNodes","getParent","key","label","onSelect","editor","update","order","BlockquoteFeatureClient","props","clientFeatureProps","feature","markdownTransformers","nodes","slashMenu","groups","items","Icon","keywords","toolbarFixed","toolbarInline","BlockquoteFeatureClientComponent"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA;AAEA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;4BACDiB,KAAK;4BACLC,OAAO;wBACT;qBACD;gBACH;gBACAgB,cAAc;oBACZJ,QAAQpB;gBACV;gBACAyB,eAAe;oBACbL,QAAQpB;gBACV;YACF,CAAA;IACF;AACF;AAEA,OAAO,MAAM0B,mCAAmC7B,sBAAsBgB,yBAAwB"}
@@ -1,3 +1,3 @@
1
1
  import type { FeatureProviderProviderServer } from '../types.js';
2
- export declare const BlockQuoteFeature: FeatureProviderProviderServer<undefined, undefined>;
2
+ export declare const BlockquoteFeature: FeatureProviderProviderServer<undefined, undefined>;
3
3
  //# sourceMappingURL=feature.server.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"feature.server.d.ts","sourceRoot":"","sources":["../../../../src/field/features/blockquote/feature.server.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,aAAa,CAAA;AAMhE,eAAO,MAAM,iBAAiB,EAAE,6BAA6B,CAAC,SAAS,EAAE,SAAS,CAoCjF,CAAA"}
1
+ {"version":3,"file":"feature.server.d.ts","sourceRoot":"","sources":["../../../../src/field/features/blockquote/feature.server.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,aAAa,CAAA;AAOhE,eAAO,MAAM,iBAAiB,EAAE,6BAA6B,CAAC,SAAS,EAAE,SAAS,CAoCjF,CAAA"}
@@ -1,19 +1,19 @@
1
- import lexicalRichTextImport from '@lexical/rich-text';
2
- const { QuoteNode } = lexicalRichTextImport;
1
+ import { QuoteNode } from '@lexical/rich-text';
3
2
  import { convertLexicalNodesToHTML } from '../converters/html/converter/index.js';
4
- import { BlockQuoteFeatureClientComponent } from './feature.client.js';
3
+ import { createNode } from '../typeUtilities.js';
4
+ import { BlockquoteFeatureClientComponent } from './feature.client.js';
5
5
  import { MarkdownTransformer } from './markdownTransformer.js';
6
- export const BlockQuoteFeature = (props)=>{
6
+ export const BlockquoteFeature = (props)=>{
7
7
  return {
8
8
  feature: ()=>{
9
9
  return {
10
- ClientComponent: BlockQuoteFeatureClientComponent,
10
+ ClientComponent: BlockquoteFeatureClientComponent,
11
11
  clientFeatureProps: null,
12
12
  markdownTransformers: [
13
13
  MarkdownTransformer
14
14
  ],
15
15
  nodes: [
16
- {
16
+ createNode({
17
17
  converters: {
18
18
  html: {
19
19
  converter: async ({ converters, node, parent, payload })=>{
@@ -34,7 +34,7 @@ export const BlockQuoteFeature = (props)=>{
34
34
  }
35
35
  },
36
36
  node: QuoteNode
37
- }
37
+ })
38
38
  ],
39
39
  serverFeatureProps: props
40
40
  };
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/field/features/blockquote/feature.server.ts"],"sourcesContent":["import lexicalRichTextImport, { type SerializedQuoteNode } from '@lexical/rich-text'\nconst { QuoteNode } = lexicalRichTextImport\n\nimport type { HTMLConverter } from '../converters/html/converter/types.js'\nimport type { FeatureProviderProviderServer } from '../types.js'\n\nimport { convertLexicalNodesToHTML } from '../converters/html/converter/index.js'\nimport { BlockQuoteFeatureClientComponent } from './feature.client.js'\nimport { MarkdownTransformer } from './markdownTransformer.js'\n\nexport const BlockQuoteFeature: FeatureProviderProviderServer<undefined, undefined> = (props) => {\n return {\n feature: () => {\n return {\n ClientComponent: BlockQuoteFeatureClientComponent,\n clientFeatureProps: null,\n markdownTransformers: [MarkdownTransformer],\n nodes: [\n {\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 `<blockquote>${childrenText}</blockquote>`\n },\n nodeTypes: [QuoteNode.getType()],\n } as HTMLConverter<SerializedQuoteNode>,\n },\n node: QuoteNode,\n },\n ],\n serverFeatureProps: props,\n }\n },\n key: 'blockquote',\n serverFeatureProps: props,\n }\n}\n"],"names":["lexicalRichTextImport","QuoteNode","convertLexicalNodesToHTML","BlockQuoteFeatureClientComponent","MarkdownTransformer","BlockQuoteFeature","props","feature","ClientComponent","clientFeatureProps","markdownTransformers","nodes","converters","html","converter","node","parent","payload","childrenText","lexicalNodes","children","nodeTypes","getType","serverFeatureProps","key"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA,OAAOA,2BAAyD,qBAAoB;AACpF,MAAM,EAAEC,SAAS,EAAE,GAAGD;AAKtB,SAASE,yBAAyB,QAAQ,wCAAuC;AACjF,SAASC,gCAAgC,QAAQ,sBAAqB;AACtE,SAASC,mBAAmB,QAAQ,2BAA0B;AAE9D,OAAO,MAAMC,oBAAyE,CAACC;IACrF,OAAO;QACLC,SAAS;YACP,OAAO;gBACLC,iBAAiBL;gBACjBM,oBAAoB;gBACpBC,sBAAsB;oBAACN;iBAAoB;gBAC3CO,OAAO;oBACL;wBACEC,YAAY;4BACVC,MAAM;gCACJC,WAAW,OAAO,EAAEF,UAAU,EAAEG,IAAI,EAAEC,MAAM,EAAEC,OAAO,EAAE;oCACrD,MAAMC,eAAe,MAAMhB,0BAA0B;wCACnDU;wCACAO,cAAcJ,KAAKK,QAAQ;wCAC3BJ,QAAQ;4CACN,GAAGD,IAAI;4CACPC;wCACF;wCACAC;oCACF;oCAEA,OAAO,CAAC,YAAY,EAAEC,aAAa,aAAa,CAAC;gCACnD;gCACAG,WAAW;oCAACpB,UAAUqB,OAAO;iCAAG;4BAClC;wBACF;wBACAP,MAAMd;oBACR;iBACD;gBACDsB,oBAAoBjB;YACtB;QACF;QACAkB,KAAK;QACLD,oBAAoBjB;IACtB;AACF,EAAC"}
1
+ {"version":3,"sources":["../../../../src/field/features/blockquote/feature.server.ts"],"sourcesContent":["import { QuoteNode } 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 { BlockquoteFeatureClientComponent } from './feature.client.js'\nimport { MarkdownTransformer } from './markdownTransformer.js'\n\nexport const BlockquoteFeature: FeatureProviderProviderServer<undefined, undefined> = (props) => {\n return {\n feature: () => {\n return {\n ClientComponent: BlockquoteFeatureClientComponent,\n clientFeatureProps: null,\n markdownTransformers: [MarkdownTransformer],\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 `<blockquote>${childrenText}</blockquote>`\n },\n nodeTypes: [QuoteNode.getType()],\n },\n },\n node: QuoteNode,\n }),\n ],\n serverFeatureProps: props,\n }\n },\n key: 'blockquote',\n serverFeatureProps: props,\n }\n}\n"],"names":["QuoteNode","convertLexicalNodesToHTML","createNode","BlockquoteFeatureClientComponent","MarkdownTransformer","BlockquoteFeature","props","feature","ClientComponent","clientFeatureProps","markdownTransformers","nodes","converters","html","converter","node","parent","payload","childrenText","lexicalNodes","children","nodeTypes","getType","serverFeatureProps","key"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA,SAASA,SAAS,QAAQ,qBAAoB;AAI9C,SAASC,yBAAyB,QAAQ,wCAAuC;AACjF,SAASC,UAAU,QAAQ,sBAAqB;AAChD,SAASC,gCAAgC,QAAQ,sBAAqB;AACtE,SAASC,mBAAmB,QAAQ,2BAA0B;AAE9D,OAAO,MAAMC,oBAAyE,CAACC;IACrF,OAAO;QACLC,SAAS;YACP,OAAO;gBACLC,iBAAiBL;gBACjBM,oBAAoB;gBACpBC,sBAAsB;oBAACN;iBAAoB;gBAC3CO,OAAO;oBACLT,WAAW;wBACTU,YAAY;4BACVC,MAAM;gCACJC,WAAW,OAAO,EAAEF,UAAU,EAAEG,IAAI,EAAEC,MAAM,EAAEC,OAAO,EAAE;oCACrD,MAAMC,eAAe,MAAMjB,0BAA0B;wCACnDW;wCACAO,cAAcJ,KAAKK,QAAQ;wCAC3BJ,QAAQ;4CACN,GAAGD,IAAI;4CACPC;wCACF;wCACAC;oCACF;oCAEA,OAAO,CAAC,YAAY,EAAEC,aAAa,aAAa,CAAC;gCACnD;gCACAG,WAAW;oCAACrB,UAAUsB,OAAO;iCAAG;4BAClC;wBACF;wBACAP,MAAMf;oBACR;iBACD;gBACDuB,oBAAoBjB;YACtB;QACF;QACAkB,KAAK;QACLD,oBAAoBjB;IACtB;AACF,EAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"markdownTransformer.d.ts","sourceRoot":"","sources":["../../../../src/field/features/blockquote/markdownTransformer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAA;AAQ3D,eAAO,MAAM,mBAAmB,EAAE,kBAmCjC,CAAA"}
1
+ {"version":3,"file":"markdownTransformer.d.ts","sourceRoot":"","sources":["../../../../src/field/features/blockquote/markdownTransformer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAA;AAK3D,eAAO,MAAM,mBAAmB,EAAE,kBAmCjC,CAAA"}
@@ -1,7 +1,5 @@
1
- import lexicalRichTextImport from '@lexical/rich-text';
2
- const { $createQuoteNode, $isQuoteNode, QuoteNode } = lexicalRichTextImport;
3
- import lexicalImport from 'lexical';
4
- const { $createLineBreakNode } = lexicalImport;
1
+ import { $createQuoteNode, $isQuoteNode, QuoteNode } from '@lexical/rich-text';
2
+ import { $createLineBreakNode } from 'lexical';
5
3
  export const MarkdownTransformer = {
6
4
  type: 'element',
7
5
  dependencies: [
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/field/features/blockquote/markdownTransformer.ts"],"sourcesContent":["import type { ElementTransformer } from '@lexical/markdown'\n\nimport lexicalRichTextImport from '@lexical/rich-text'\nconst { $createQuoteNode, $isQuoteNode, QuoteNode } = lexicalRichTextImport\n\nimport lexicalImport from 'lexical'\nconst { $createLineBreakNode } = lexicalImport\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"],"names":["lexicalRichTextImport","$createQuoteNode","$isQuoteNode","QuoteNode","lexicalImport","$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"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAEA,OAAOA,2BAA2B,qBAAoB;AACtD,MAAM,EAAEC,gBAAgB,EAAEC,YAAY,EAAEC,SAAS,EAAE,GAAGH;AAEtD,OAAOI,mBAAmB,UAAS;AACnC,MAAM,EAAEC,oBAAoB,EAAE,GAAGD;AAEjC,OAAO,MAAME,sBAA0C;IACrDC,MAAM;IACNC,cAAc;QAACL;KAAU;IACzBM,QAAQ,CAACC,MAAMC;QACb,IAAI,CAACT,aAAaQ,OAAO;YACvB,OAAO;QACT;QAEA,MAAME,QAAQD,eAAeD,MAAMG,KAAK,CAAC;QACzC,MAAMC,SAAS,EAAE;QACjB,KAAK,MAAMC,QAAQH,MAAO;YACxBE,OAAOE,IAAI,CAAC,OAAOD;QACrB;QACA,OAAOD,OAAOG,IAAI,CAAC;IACrB;IACAC,QAAQ;IACRC,SAAS,CAACC,YAAYC,UAAUC,QAAQC;QACtC,IAAIA,UAAU;YACZ,MAAMC,eAAeJ,WAAWK,kBAAkB;YAClD,IAAIvB,aAAasB,eAAe;gBAC9BA,aAAaE,MAAM,CAACF,aAAaG,eAAe,IAAI,GAAG;oBACrDtB;uBACGgB;iBACJ;gBACDG,aAAaI,MAAM,CAAC,GAAG;gBACvBR,WAAWS,MAAM;gBACjB;YACF;QACF;QAEA,MAAMnB,OAAOT;QACbS,KAAKoB,MAAM,IAAIT;QACfD,WAAWD,OAAO,CAACT;QACnBA,KAAKkB,MAAM,CAAC,GAAG;IACjB;AACF,EAAC"}
1
+ {"version":3,"sources":["../../../../src/field/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"],"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"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAEA,SAASA,gBAAgB,EAAEC,YAAY,EAAEC,SAAS,QAAQ,qBAAoB;AAC9E,SAASC,oBAAoB,QAAQ,UAAS;AAE9C,OAAO,MAAMC,sBAA0C;IACrDC,MAAM;IACNC,cAAc;QAACJ;KAAU;IACzBK,QAAQ,CAACC,MAAMC;QACb,IAAI,CAACR,aAAaO,OAAO;YACvB,OAAO;QACT;QAEA,MAAME,QAAQD,eAAeD,MAAMG,KAAK,CAAC;QACzC,MAAMC,SAAS,EAAE;QACjB,KAAK,MAAMC,QAAQH,MAAO;YACxBE,OAAOE,IAAI,CAAC,OAAOD;QACrB;QACA,OAAOD,OAAOG,IAAI,CAAC;IACrB;IACAC,QAAQ;IACRC,SAAS,CAACC,YAAYC,UAAUC,QAAQC;QACtC,IAAIA,UAAU;YACZ,MAAMC,eAAeJ,WAAWK,kBAAkB;YAClD,IAAItB,aAAaqB,eAAe;gBAC9BA,aAAaE,MAAM,CAACF,aAAaG,eAAe,IAAI,GAAG;oBACrDtB;uBACGgB;iBACJ;gBACDG,aAAaI,MAAM,CAAC,GAAG;gBACvBR,WAAWS,MAAM;gBACjB;YACF;QACF;QAEA,MAAMnB,OAAOR;QACbQ,KAAKoB,MAAM,IAAIT;QACfD,WAAWD,OAAO,CAACT;QACnBA,KAAKkB,MAAM,CAAC,GAAG;IACjB;AACF,EAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"BlockContent.d.ts","sourceRoot":"","sources":["../../../../../src/field/features/blocks/component/BlockContent.tsx"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAA;AACjE,OAAO,KAAK,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,4CAA4C,CAAA;AAYxF,OAAO,KAAsB,MAAM,OAAO,CAAA;AAE1C,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,kCAAkC,CAAA;AACnF,OAAO,KAAK,EAAE,WAAW,EAAa,MAAM,wBAAwB,CAAA;AAIpE,KAAK,KAAK,GAAG;IACX,SAAS,EAAE,MAAM,CAAA;IACjB,KAAK,EAAE,aAAa,GAAG;QACrB,YAAY,EAAE,2BAA2B,CAAA;QACzC,IAAI,EAAE,MAAM,CAAA;QACZ,oBAAoB,EAAE,GAAG,CAAC,MAAM,EAAE,KAAK,CAAC,SAAS,CAAC,CAAA;KACnD,CAAA;IACD,QAAQ,EAAE,WAAW,CAAA;IACrB,UAAU,EAAE,QAAQ,CAAA;IACpB,OAAO,EAAE,MAAM,CAAA;IACf,IAAI,EAAE,MAAM,CAAA;IACZ,YAAY,EAAE,YAAY,CAAA;IAC1B,UAAU,EAAE,MAAM,CAAA;CACnB,CAAA;AAED;;;;GAIG;AACH,eAAO,MAAM,YAAY,EAAE,KAAK,CAAC,EAAE,CAAC,KAAK,CAyMxC,CAAA"}
1
+ {"version":3,"file":"BlockContent.d.ts","sourceRoot":"","sources":["../../../../../src/field/features/blocks/component/BlockContent.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAA;AACjE,OAAO,KAAK,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,4CAA4C,CAAA;AAkBxF,OAAO,KAAsB,MAAM,OAAO,CAAA;AAE1C,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,kCAAkC,CAAA;AACnF,OAAO,KAAK,EAAE,WAAW,EAAa,MAAM,wBAAwB,CAAA;AAIpE,KAAK,KAAK,GAAG;IACX,SAAS,EAAE,MAAM,CAAA;IACjB,KAAK,EAAE,aAAa,GAAG;QACrB,YAAY,EAAE,2BAA2B,CAAA;QACzC,IAAI,EAAE,MAAM,CAAA;QACZ,oBAAoB,EAAE,GAAG,CAAC,MAAM,EAAE,KAAK,CAAC,SAAS,CAAC,CAAA;KACnD,CAAA;IACD,QAAQ,EAAE,WAAW,CAAA;IACrB,UAAU,EAAE,QAAQ,CAAA;IACpB,OAAO,EAAE,MAAM,CAAA;IACf,IAAI,EAAE,MAAM,CAAA;IACZ,YAAY,EAAE,YAAY,CAAA;IAC1B,UAAU,EAAE,MAAM,CAAA;CACnB,CAAA;AAED;;;;GAIG;AACH,eAAO,MAAM,YAAY,EAAE,KAAK,CAAC,EAAE,CAAC,KAAK,CAyMxC,CAAA"}
@@ -1,9 +1,5 @@
1
- import lexicalComposerContextImport from '@lexical/react/LexicalComposerContext.js';
2
- const { useLexicalComposerContext } = lexicalComposerContextImport;
1
+ import { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext.js';
3
2
  import { getTranslation } from '@payloadcms/translations';
4
- import isDeepEqual from 'deep-equal';
5
- import lexicalImport from 'lexical';
6
- const { $getNodeByKey } = lexicalImport;
7
3
  import { Button } from '@payloadcms/ui/elements/Button';
8
4
  import { Collapsible } from '@payloadcms/ui/elements/Collapsible';
9
5
  import { ErrorPill } from '@payloadcms/ui/elements/ErrorPill';
@@ -13,6 +9,8 @@ import { useFormSubmitted } from '@payloadcms/ui/forms/Form';
13
9
  import { RenderFields } from '@payloadcms/ui/forms/RenderFields';
14
10
  import { useDocumentInfo } from '@payloadcms/ui/providers/DocumentInfo';
15
11
  import { useTranslation } from '@payloadcms/ui/providers/Translation';
12
+ import isDeepEqual from 'deep-equal';
13
+ import { $getNodeByKey } from 'lexical';
16
14
  import React, { useCallback } from 'react';
17
15
  import { FormSavePlugin } from './FormSavePlugin.js';
18
16
  /**
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../src/field/features/blocks/component/BlockContent.tsx"],"sourcesContent":["import type { FormState } from 'payload/types'\nimport type { Data } from 'payload/types'\n\nimport lexicalComposerContextImport from '@lexical/react/LexicalComposerContext.js'\nconst { useLexicalComposerContext } = lexicalComposerContextImport\nimport { getTranslation } from '@payloadcms/translations'\nimport isDeepEqual from 'deep-equal'\nimport lexicalImport from 'lexical'\nconst { $getNodeByKey } = lexicalImport\nimport type { FormFieldBase } from '@payloadcms/ui/fields/shared'\nimport type { FieldMap, ReducedBlock } from '@payloadcms/ui/utilities/buildComponentMap'\nimport type { CollapsedPreferences } from 'payload/types'\n\nimport { Button } from '@payloadcms/ui/elements/Button'\nimport { Collapsible } from '@payloadcms/ui/elements/Collapsible'\nimport { ErrorPill } from '@payloadcms/ui/elements/ErrorPill'\nimport { Pill } from '@payloadcms/ui/elements/Pill'\nimport { SectionTitle } from '@payloadcms/ui/fields/Blocks/SectionTitle'\nimport { useFormSubmitted } from '@payloadcms/ui/forms/Form'\nimport { RenderFields } from '@payloadcms/ui/forms/RenderFields'\nimport { useDocumentInfo } from '@payloadcms/ui/providers/DocumentInfo'\nimport { useTranslation } from '@payloadcms/ui/providers/Translation'\nimport React, { useCallback } from 'react'\n\nimport type { SanitizedClientEditorConfig } from '../../../lexical/config/types.js'\nimport type { BlockFields, BlockNode } from '../nodes/BlocksNode.js'\n\nimport { FormSavePlugin } from './FormSavePlugin.js'\n\ntype Props = {\n baseClass: string\n field: FormFieldBase & {\n editorConfig: SanitizedClientEditorConfig // With rendered features n stuff\n name: string\n richTextComponentMap: Map<string, React.ReactNode>\n }\n formData: BlockFields\n formSchema: FieldMap\n nodeKey: string\n path: string\n reducedBlock: ReducedBlock\n schemaPath: string\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 {\n baseClass,\n field,\n formData,\n formSchema,\n nodeKey,\n path,\n reducedBlock: { labels },\n schemaPath,\n } = 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: Data\n }) => {\n newFormData = {\n ...newFormData,\n id: formData.id,\n blockType: formData.blockType,\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.\n function removeUndefinedAndNullRecursively(obj: object) {\n Object.keys(obj).forEach((key) => {\n if (obj[key] && typeof obj[key] === 'object') {\n removeUndefinedAndNullRecursively(obj[key])\n } else if (obj[key] === undefined || obj[key] === null) {\n delete obj[key]\n }\n })\n }\n removeUndefinedAndNullRecursively(newFormData)\n removeUndefinedAndNullRecursively(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 (!isDeepEqual(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 node.setFields(newFormData as BlockFields)\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 <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 labels.singular === 'string'\n ? getTranslation(labels.singular, i18n)\n : '[Singular Label]'}\n </Pill>\n <SectionTitle path=\"blockName\" readOnly={field?.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?.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 isCollapsed={isCollapsed}\n key={0}\n onToggle={(incomingCollapsedState) => {\n onCollapsedChange(incomingCollapsedState)\n setIsCollapsed(incomingCollapsedState)\n }}\n >\n <RenderFields\n className={`${baseClass}__fields`}\n fieldMap={Array.isArray(formSchema) ? 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} />\n </React.Fragment>\n )\n}\n"],"names":["lexicalComposerContextImport","useLexicalComposerContext","getTranslation","isDeepEqual","lexicalImport","$getNodeByKey","Button","Collapsible","ErrorPill","Pill","SectionTitle","useFormSubmitted","RenderFields","useDocumentInfo","useTranslation","React","useCallback","FormSavePlugin","BlockContent","props","baseClass","field","formData","formSchema","nodeKey","path","reducedBlock","labels","schemaPath","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","removeUndefinedAndNullRecursively","obj","Object","keys","forEach","key","undefined","setTimeout","update","node","setFields","rowErrorCount","formField","values","valid","onCollapsedChange","changedCollapsed","newCollapsed","length","push","splice","indexOf","hello","removeBlock","remove","Fragment","className","collapsibleStyle","header","div","pillStyle","singular","readOnly","count","withMessage","isEditable","buttonStyle","disabled","icon","onClick","e","preventDefault","round","tooltip","onToggle","incomingCollapsedState","fieldMap","Array","isArray","forceRender","margins","onChange"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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ACC6E,WAAWlC;QACXmC,kBAAkBpC,iBAAiB,UAAU;QAC7CqC,sBACE,oBAACC;YAAIH,WAAW,CAAC,EAAEhE,UAAU,cAAc,CAAC;yBAC1C,oBAACmE,2BACC,oBAAC9E;YACC2E,WAAW,CAAC,EAAEhE,UAAU,aAAa,EAAEA,UAAU,aAAa,EAAEE,UAAUmC,UAAU,CAAC;YACrF+B,WAAU;WAET,OAAO7D,OAAO8D,QAAQ,KAAK,WACxBvF,eAAeyB,OAAO8D,QAAQ,EAAE5D,QAChC,mCAEN,oBAACnB;YAAae,MAAK;YAAYiE,UAAUrE,OAAOqE;YAC/CzC,gCAAkB,oBAACzC;YAAUmF,OAAO5C;YAAYlB,MAAMA;YAAM+D,aAAAA;aAE9D9D,OAAO+D,UAAU,oBAChB,oBAACvF;YACCwF,aAAY;YACZV,WAAW,CAAC,EAAEhE,UAAU,cAAc,CAAC;YACvC2E,UAAU1E,OAAOqE;YACjBM,MAAK;YACLC,SAAS,CAACC;gBACRA,EAAEC,cAAc;gBAChBlB;YACF;YACAmB,OAAAA;YACAC,SAAQ;;QAKhBpE,aAAaA;QACb8B,KAAK;QACLuC,UAAU,CAACC;YACT9B,kBAAkB8B;YAClBrE,eAAeqE;QACjB;qBAEA,oBAAC3F;QACCwE,WAAW,CAAC,EAAEhE,UAAU,QAAQ,CAAC;QACjCoF,UAAUC,MAAMC,OAAO,CAACnF,cAAcA,aAAa,EAAE;QACrDoF,aAAAA;QACAC,SAAQ;QACRnF,MAAK,GAAG,wQAAwQ;;QAChRiE,UAAU;QACV9D,YAAYA;uBAIhB,oBAACX;QAAe4F,UAAUvD;;AAGhC,EAAC"}
1
+ {"version":3,"sources":["../../../../../src/field/features/blocks/component/BlockContent.tsx"],"sourcesContent":["import type { FormFieldBase } from '@payloadcms/ui/fields/shared'\nimport type { FieldMap, ReducedBlock } from '@payloadcms/ui/utilities/buildComponentMap'\nimport type { FormState } from 'payload/types'\nimport type { Data } from 'payload/types'\nimport type { CollapsedPreferences } from 'payload/types'\n\nimport { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext.js'\nimport { getTranslation } from '@payloadcms/translations'\nimport { Button } from '@payloadcms/ui/elements/Button'\nimport { Collapsible } from '@payloadcms/ui/elements/Collapsible'\nimport { ErrorPill } from '@payloadcms/ui/elements/ErrorPill'\nimport { Pill } from '@payloadcms/ui/elements/Pill'\nimport { SectionTitle } from '@payloadcms/ui/fields/Blocks/SectionTitle'\nimport { useFormSubmitted } from '@payloadcms/ui/forms/Form'\nimport { RenderFields } from '@payloadcms/ui/forms/RenderFields'\nimport { useDocumentInfo } from '@payloadcms/ui/providers/DocumentInfo'\nimport { useTranslation } from '@payloadcms/ui/providers/Translation'\nimport isDeepEqual from 'deep-equal'\nimport { $getNodeByKey } from 'lexical'\nimport React, { useCallback } from 'react'\n\nimport type { SanitizedClientEditorConfig } from '../../../lexical/config/types.js'\nimport type { BlockFields, BlockNode } from '../nodes/BlocksNode.js'\n\nimport { FormSavePlugin } from './FormSavePlugin.js'\n\ntype Props = {\n baseClass: string\n field: FormFieldBase & {\n editorConfig: SanitizedClientEditorConfig // With rendered features n stuff\n name: string\n richTextComponentMap: Map<string, React.ReactNode>\n }\n formData: BlockFields\n formSchema: FieldMap\n nodeKey: string\n path: string\n reducedBlock: ReducedBlock\n schemaPath: string\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 {\n baseClass,\n field,\n formData,\n formSchema,\n nodeKey,\n path,\n reducedBlock: { labels },\n schemaPath,\n } = 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: Data\n }) => {\n newFormData = {\n ...newFormData,\n id: formData.id,\n blockType: formData.blockType,\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.\n function removeUndefinedAndNullRecursively(obj: object) {\n Object.keys(obj).forEach((key) => {\n if (obj[key] && typeof obj[key] === 'object') {\n removeUndefinedAndNullRecursively(obj[key])\n } else if (obj[key] === undefined || obj[key] === null) {\n delete obj[key]\n }\n })\n }\n removeUndefinedAndNullRecursively(newFormData)\n removeUndefinedAndNullRecursively(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 (!isDeepEqual(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 node.setFields(newFormData as BlockFields)\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 <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 labels.singular === 'string'\n ? getTranslation(labels.singular, i18n)\n : '[Singular Label]'}\n </Pill>\n <SectionTitle path=\"blockName\" readOnly={field?.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?.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 isCollapsed={isCollapsed}\n key={0}\n onToggle={(incomingCollapsedState) => {\n onCollapsedChange(incomingCollapsedState)\n setIsCollapsed(incomingCollapsedState)\n }}\n >\n <RenderFields\n className={`${baseClass}__fields`}\n fieldMap={Array.isArray(formSchema) ? 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} />\n </React.Fragment>\n )\n}\n"],"names":["useLexicalComposerContext","getTranslation","Button","Collapsible","ErrorPill","Pill","SectionTitle","useFormSubmitted","RenderFields","useDocumentInfo","useTranslation","isDeepEqual","$getNodeByKey","React","useCallback","FormSavePlugin","BlockContent","props","baseClass","field","formData","formSchema","nodeKey","path","reducedBlock","labels","schemaPath","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","removeUndefinedAndNullRecursively","obj","Object","keys","forEach","key","undefined","setTimeout","update","node","setFields","rowErrorCount","formField","values","valid","onCollapsedChange","changedCollapsed","newCollapsed","length","push","splice","indexOf","hello","removeBlock","remove","Fragment","className","collapsibleStyle","header","div","pillStyle","singular","readOnly","count","withMessage","isEditable","buttonStyle","disabled","icon","onClick","e","preventDefault","round","tooltip","onToggle","incomingCollapsedState","fieldMap","Array","isArray","forceRender","margins","onChange"],"rangeMappings":";;;;;;;;;;;;;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AACT,MAAMoE,QAAQ,sBACb,oBAAC9E;QACC+E,WAAWlC;QACXmC,kBAAkBpC,iBAAiB,UAAU;QAC7CqC,sBACE,oBAACC;YAAIH,WAAW,CAAC,EAAEhE,UAAU,cAAc,CAAC;yBAC1C,oBAACmE,2BACC,oBAAChF;YACC6E,WAAW,CAAC,EAAEhE,UAAU,aAAa,EAAEA,UAAU,aAAa,EAAEE,UAAUmC,UAAU,CAAC;YACrF+B,WAAU;WAET,OAAO7D,OAAO8D,QAAQ,KAAK,WACxBtF,eAAewB,OAAO8D,QAAQ,EAAE5D,QAChC,mCAEN,oBAACrB;YAAaiB,MAAK;YAAYiE,UAAUrE,OAAOqE;YAC/CzC,gCAAkB,oBAAC3C;YAAUqF,OAAO5C;YAAYlB,MAAMA;YAAM+D,aAAAA;aAE9D9D,OAAO+D,UAAU,oBAChB,oBAACzF;YACC0F,aAAY;YACZV,WAAW,CAAC,EAAEhE,UAAU,cAAc,CAAC;YACvC2E,UAAU1E,OAAOqE;YACjBM,MAAK;YACLC,SAAS,CAACC;gBACRA,EAAEC,cAAc;gBAChBlB;YACF;YACAmB,OAAAA;YACAC,SAAQ;;QAKhBpE,aAAaA;QACb8B,KAAK;QACLuC,UAAU,CAACC;YACT9B,kBAAkB8B;YAClBrE,eAAeqE;QACjB;qBAEA,oBAAC7F;QACC0E,WAAW,CAAC,EAAEhE,UAAU,QAAQ,CAAC;QACjCoF,UAAUC,MAAMC,OAAO,CAACnF,cAAcA,aAAa,EAAE;QACrDoF,aAAAA;QACAC,SAAQ;QACRnF,MAAK,GAAG,wQAAwQ;;QAChRiE,UAAU;QACV9D,YAAYA;uBAIhB,oBAACX;QAAe4F,UAAUvD;;AAGhC,EAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/field/features/blocks/component/index.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAoD,MAAM,OAAO,CAAA;AAExE,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,wBAAwB,CAAA;AAkBzD,OAAO,cAAc,CAAA;AAGrB,KAAK,KAAK,GAAG;IACX,qBAAqB,EAAE,MAAM,CAAA;IAC7B,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;IAE1B,QAAQ,EAAE,WAAW,CAAA;IACrB,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB;;OAEG;IACH,mBAAmB,EAAE,WAAW,CAAA;CACjC,CAAA;AAED,eAAO,MAAM,cAAc,EAAE,KAAK,CAAC,EAAE,CAAC,KAAK,CAuH1C,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/field/features/blocks/component/index.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAoD,MAAM,OAAO,CAAA;AAExE,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,wBAAwB,CAAA;AAuBzD,OAAO,cAAc,CAAA;AAGrB,KAAK,KAAK,GAAG;IACX,qBAAqB,EAAE,MAAM,CAAA;IAC7B,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;IAE1B,QAAQ,EAAE,WAAW,CAAA;IACrB,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB;;OAEG;IACH,mBAAmB,EAAE,WAAW,CAAA;CACjC,CAAA;AAED,eAAO,MAAM,cAAc,EAAE,KAAK,CAAC,EAAE,CAAC,KAAK,CAiJ1C,CAAA"}
@@ -2,10 +2,16 @@
2
2
  import { Form } from '@payloadcms/ui/forms/Form';
3
3
  import React, { useCallback, useEffect, useMemo, useState } from 'react';
4
4
  const baseClass = 'lexical-block';
5
+ import { getTranslation } from '@payloadcms/translations';
6
+ import { Collapsible } from '@payloadcms/ui/elements/Collapsible';
7
+ import { Pill } from '@payloadcms/ui/elements/Pill';
8
+ import { ShimmerEffect } from '@payloadcms/ui/elements/ShimmerEffect';
9
+ import { SectionTitle } from '@payloadcms/ui/fields/Blocks/SectionTitle';
5
10
  import { useFieldProps } from '@payloadcms/ui/forms/FieldPropsProvider';
6
11
  import { useFormSubmitted } from '@payloadcms/ui/forms/Form';
7
12
  import { useConfig } from '@payloadcms/ui/providers/Config';
8
13
  import { useDocumentInfo } from '@payloadcms/ui/providers/DocumentInfo';
14
+ import { useTranslation } from '@payloadcms/ui/providers/Translation';
9
15
  import { getFormState } from '@payloadcms/ui/utilities/getFormState';
10
16
  import { v4 as uuid } from 'uuid';
11
17
  import { useEditorConfigContext } from '../../../lexical/config/client/EditorConfigProvider.js';
@@ -89,9 +95,17 @@ export const BlockComponent = (props)=>{
89
95
  id,
90
96
  formData.blockName
91
97
  ]);
98
+ const { i18n } = useTranslation();
99
+ const classNames = [
100
+ `${baseClass}__row`,
101
+ `${baseClass}__row--no-errors`
102
+ ].filter(Boolean).join(' ');
92
103
  // Memoized Form JSX
93
104
  const formContent = useMemo(()=>{
94
- return reducedBlock && initialState !== false && /*#__PURE__*/ React.createElement(Form, {
105
+ return reducedBlock && initialState !== false ? /*#__PURE__*/ React.createElement(Form, {
106
+ beforeSubmit: [
107
+ onChange
108
+ ],
95
109
  // @ts-expect-error TODO: Fix this
96
110
  fields: fieldMap,
97
111
  initialState: initialState,
@@ -109,19 +123,38 @@ export const BlockComponent = (props)=>{
109
123
  path: `${path}.feature.blocks.${formData.blockType}`,
110
124
  reducedBlock: reducedBlock,
111
125
  schemaPath: schemaFieldsPath
126
+ })) : /*#__PURE__*/ React.createElement(Collapsible, {
127
+ className: classNames,
128
+ collapsibleStyle: "default",
129
+ header: /*#__PURE__*/ React.createElement("div", {
130
+ className: `${baseClass}__block-header`
131
+ }, /*#__PURE__*/ React.createElement("div", null, /*#__PURE__*/ React.createElement(Pill, {
132
+ className: `${baseClass}__block-pill ${baseClass}__block-pill-${formData?.blockType}`,
133
+ pillStyle: "white"
134
+ }, typeof reducedBlock.labels.singular === 'string' ? getTranslation(reducedBlock.labels.singular, i18n) : '[Singular Label]'), /*#__PURE__*/ React.createElement(SectionTitle, {
135
+ path: "blockName",
136
+ readOnly: parentLexicalRichTextField?.readOnly
137
+ }))),
138
+ key: 0
139
+ }, /*#__PURE__*/ React.createElement(ShimmerEffect, {
140
+ height: "35vh"
112
141
  }));
113
142
  }, [
114
143
  fieldMap,
115
144
  parentLexicalRichTextField,
116
145
  nodeKey,
146
+ i18n,
117
147
  submitted,
118
148
  initialState,
119
149
  reducedBlock,
120
150
  blockFieldWrapperName,
121
- onChange
122
- ]);
151
+ onChange,
152
+ schemaFieldsPath,
153
+ path
154
+ ]) // Adding formData to the dependencies here might break it
155
+ ;
123
156
  return /*#__PURE__*/ React.createElement("div", {
124
- className: baseClass
157
+ className: baseClass + ' ' + baseClass + '-' + formData.blockType
125
158
  }, formContent);
126
159
  };
127
160
 
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../src/field/features/blocks/component/index.tsx"],"sourcesContent":["'use client'\n\nimport type { FormProps } from '@payloadcms/ui/forms/Form'\n\nimport { Form } from '@payloadcms/ui/forms/Form'\nimport React, { useCallback, useEffect, useMemo, useState } from 'react'\n\nimport { type BlockFields } from '../nodes/BlocksNode.js'\nconst baseClass = 'lexical-block'\n\nimport type { ReducedBlock } from '@payloadcms/ui/utilities/buildComponentMap'\nimport type { FormState } from 'payload/types'\n\nimport { useFieldProps } from '@payloadcms/ui/forms/FieldPropsProvider'\nimport { useFormSubmitted } from '@payloadcms/ui/forms/Form'\nimport { useConfig } from '@payloadcms/ui/providers/Config'\nimport { useDocumentInfo } from '@payloadcms/ui/providers/DocumentInfo'\nimport { getFormState } from '@payloadcms/ui/utilities/getFormState'\nimport { v4 as uuid } from 'uuid'\n\nimport type { ClientComponentProps } from '../../types.js'\nimport type { BlocksFeatureClientProps } from '../feature.client.js'\n\nimport { useEditorConfigContext } from '../../../lexical/config/client/EditorConfigProvider.js'\nimport { BlockContent } from './BlockContent.js'\nimport './index.scss'\nimport { removeEmptyArrayValues } from './removeEmptyArrayValues.js'\n\ntype Props = {\n blockFieldWrapperName: string\n children?: React.ReactNode\n\n formData: BlockFields\n nodeKey?: string\n /**\n * This transformedFormData already comes wrapped in blockFieldWrapperName\n */\n transformedFormData: BlockFields\n}\n\nexport const BlockComponent: React.FC<Props> = (props) => {\n const { blockFieldWrapperName, formData, nodeKey } = props\n const config = useConfig()\n const submitted = useFormSubmitted()\n const { id } = useDocumentInfo()\n const { path, schemaPath } = useFieldProps()\n const { editorConfig, field: parentLexicalRichTextField } = useEditorConfigContext()\n\n const [initialState, setInitialState] = useState<FormState | false>(false)\n const {\n field: { richTextComponentMap },\n } = useEditorConfigContext()\n\n const componentMapRenderedFieldsPath = `feature.blocks.fields.${formData?.blockType}`\n const schemaFieldsPath = `${schemaPath}.feature.blocks.${formData?.blockType}`\n\n const reducedBlock: ReducedBlock = (\n editorConfig?.resolvedFeatureMap?.get('blocks')\n ?.clientFeatureProps as ClientComponentProps<BlocksFeatureClientProps>\n )?.reducedBlocks?.find((block) => block.slug === formData?.blockType)\n\n const fieldMap = richTextComponentMap.get(componentMapRenderedFieldsPath)\n // Field Schema\n useEffect(() => {\n const awaitInitialState = async () => {\n const state = await getFormState({\n apiRoute: config.routes.api,\n body: {\n id,\n data: JSON.parse(JSON.stringify(formData)),\n operation: 'update',\n schemaPath: schemaFieldsPath,\n },\n serverURL: config.serverURL,\n }) // Form State\n\n if (state) {\n setInitialState({\n ...removeEmptyArrayValues({ fields: state }),\n blockName: {\n initialValue: '',\n passesCondition: true,\n valid: true,\n value: formData.blockName,\n },\n })\n }\n }\n\n if (formData) {\n void awaitInitialState()\n }\n }, [config.routes.api, config.serverURL, schemaFieldsPath, id])\n\n const onChange: FormProps['onChange'][0] = useCallback(\n async ({ formState: prevFormState }) => {\n const formState = await getFormState({\n apiRoute: config.routes.api,\n body: {\n id,\n formState: prevFormState,\n operation: 'update',\n schemaPath: schemaFieldsPath,\n },\n serverURL: config.serverURL,\n })\n\n return {\n ...formState,\n blockName: {\n initialValue: '',\n passesCondition: true,\n valid: true,\n value: formData.blockName,\n },\n }\n },\n\n [config.routes.api, config.serverURL, schemaFieldsPath, id, formData.blockName],\n )\n\n // Memoized Form JSX\n const formContent = useMemo(() => {\n return (\n reducedBlock &&\n initialState !== false && (\n <Form\n // @ts-expect-error TODO: Fix this\n fields={fieldMap}\n initialState={initialState}\n onChange={[onChange]}\n submitted={submitted}\n uuid={uuid()}\n >\n <BlockContent\n baseClass={baseClass}\n field={parentLexicalRichTextField}\n formData={formData}\n formSchema={Array.isArray(fieldMap) ? fieldMap : []}\n nodeKey={nodeKey}\n path={`${path}.feature.blocks.${formData.blockType}`}\n reducedBlock={reducedBlock}\n schemaPath={schemaFieldsPath}\n />\n </Form>\n )\n )\n }, [\n fieldMap,\n parentLexicalRichTextField,\n nodeKey,\n submitted,\n initialState,\n reducedBlock,\n blockFieldWrapperName,\n onChange,\n ])\n\n return <div className={baseClass}>{formContent}</div>\n}\n"],"names":["Form","React","useCallback","useEffect","useMemo","useState","baseClass","useFieldProps","useFormSubmitted","useConfig","useDocumentInfo","getFormState","v4","uuid","useEditorConfigContext","BlockContent","removeEmptyArrayValues","BlockComponent","props","blockFieldWrapperName","formData","nodeKey","config","submitted","id","path","schemaPath","editorConfig","field","parentLexicalRichTextField","initialState","setInitialState","richTextComponentMap","componentMapRenderedFieldsPath","blockType","schemaFieldsPath","reducedBlock","resolvedFeatureMap","get","clientFeatureProps","reducedBlocks","find","block","slug","fieldMap","awaitInitialState","state","apiRoute","routes","api","body","data","JSON","parse","stringify","operation","serverURL","fields","blockName","initialValue","passesCondition","valid","value","onChange","formState","prevFormState","formContent","formSchema","Array","isArray","div","className"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA;AAIA,SAASA,IAAI,QAAQ,4BAA2B;AAChD,OAAOC,SAASC,WAAW,EAAEC,SAAS,EAAEC,OAAO,EAAEC,QAAQ,QAAQ,QAAO;AAGxE,M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AW,EAAE;YACnDvB,SAASA;YACTI,MAAM,CAAC,EAAEA,KAAK,gBAAgB,EAAEL,SAASc,SAAS,CAAC,CAAC;YACpDE,cAAcA;YACdV,YAAYS;;IAKtB,GAAG;QACDS;QACAf;QACAR;QACAE;QACAO;QACAM;QACAjB;QACA4C;KACD;IAED,qBAAO,oBAACO;QAAIC,WAAWjE;OAAY4D;AACrC,EAAC"}
1
+ {"version":3,"sources":["../../../../../src/field/features/blocks/component/index.tsx"],"sourcesContent":["'use client'\n\nimport type { FormProps } from '@payloadcms/ui/forms/Form'\n\nimport { Form } from '@payloadcms/ui/forms/Form'\nimport React, { useCallback, useEffect, useMemo, useState } from 'react'\n\nimport { type BlockFields } from '../nodes/BlocksNode.js'\nconst baseClass = 'lexical-block'\nimport type { ReducedBlock } from '@payloadcms/ui/utilities/buildComponentMap'\nimport type { FormState } from 'payload/types'\n\nimport { getTranslation } from '@payloadcms/translations'\nimport { Collapsible } from '@payloadcms/ui/elements/Collapsible'\nimport { Pill } from '@payloadcms/ui/elements/Pill'\nimport { ShimmerEffect } from '@payloadcms/ui/elements/ShimmerEffect'\nimport { SectionTitle } from '@payloadcms/ui/fields/Blocks/SectionTitle'\nimport { useFieldProps } from '@payloadcms/ui/forms/FieldPropsProvider'\nimport { useFormSubmitted } from '@payloadcms/ui/forms/Form'\nimport { useConfig } from '@payloadcms/ui/providers/Config'\nimport { useDocumentInfo } from '@payloadcms/ui/providers/DocumentInfo'\nimport { useTranslation } from '@payloadcms/ui/providers/Translation'\nimport { getFormState } from '@payloadcms/ui/utilities/getFormState'\nimport { v4 as uuid } from 'uuid'\n\nimport type { ClientComponentProps } from '../../types.js'\nimport type { BlocksFeatureClientProps } from '../feature.client.js'\n\nimport { useEditorConfigContext } from '../../../lexical/config/client/EditorConfigProvider.js'\nimport { BlockContent } from './BlockContent.js'\nimport './index.scss'\nimport { removeEmptyArrayValues } from './removeEmptyArrayValues.js'\n\ntype Props = {\n blockFieldWrapperName: string\n children?: React.ReactNode\n\n formData: BlockFields\n nodeKey?: string\n /**\n * This transformedFormData already comes wrapped in blockFieldWrapperName\n */\n transformedFormData: BlockFields\n}\n\nexport const BlockComponent: React.FC<Props> = (props) => {\n const { blockFieldWrapperName, formData, nodeKey } = props\n const config = useConfig()\n const submitted = useFormSubmitted()\n const { id } = useDocumentInfo()\n const { path, schemaPath } = useFieldProps()\n const { editorConfig, field: parentLexicalRichTextField } = useEditorConfigContext()\n\n const [initialState, setInitialState] = useState<FormState | false>(false)\n const {\n field: { richTextComponentMap },\n } = useEditorConfigContext()\n\n const componentMapRenderedFieldsPath = `feature.blocks.fields.${formData?.blockType}`\n const schemaFieldsPath = `${schemaPath}.feature.blocks.${formData?.blockType}`\n\n const reducedBlock: ReducedBlock = (\n editorConfig?.resolvedFeatureMap?.get('blocks')\n ?.clientFeatureProps as ClientComponentProps<BlocksFeatureClientProps>\n )?.reducedBlocks?.find((block) => block.slug === formData?.blockType)\n\n const fieldMap = richTextComponentMap.get(componentMapRenderedFieldsPath)\n // Field Schema\n useEffect(() => {\n const awaitInitialState = async () => {\n const state = await getFormState({\n apiRoute: config.routes.api,\n body: {\n id,\n data: JSON.parse(JSON.stringify(formData)),\n operation: 'update',\n schemaPath: schemaFieldsPath,\n },\n serverURL: config.serverURL,\n }) // Form State\n\n if (state) {\n setInitialState({\n ...removeEmptyArrayValues({ fields: state }),\n blockName: {\n initialValue: '',\n passesCondition: true,\n valid: true,\n value: formData.blockName,\n },\n })\n }\n }\n\n if (formData) {\n void awaitInitialState()\n }\n }, [config.routes.api, config.serverURL, schemaFieldsPath, id])\n\n const onChange: FormProps['onChange'][0] = useCallback(\n async ({ formState: prevFormState }) => {\n const formState = await getFormState({\n apiRoute: config.routes.api,\n body: {\n id,\n formState: prevFormState,\n operation: 'update',\n schemaPath: schemaFieldsPath,\n },\n serverURL: config.serverURL,\n })\n\n return {\n ...formState,\n blockName: {\n initialValue: '',\n passesCondition: true,\n valid: true,\n value: formData.blockName,\n },\n }\n },\n\n [config.routes.api, config.serverURL, schemaFieldsPath, id, formData.blockName],\n )\n const { i18n } = useTranslation()\n\n const classNames = [`${baseClass}__row`, `${baseClass}__row--no-errors`].filter(Boolean).join(' ')\n\n // Memoized Form JSX\n const formContent = useMemo(() => {\n return reducedBlock && initialState !== false ? (\n <Form\n beforeSubmit={[onChange]}\n // @ts-expect-error TODO: Fix this\n fields={fieldMap}\n initialState={initialState}\n onChange={[onChange]}\n submitted={submitted}\n uuid={uuid()}\n >\n <BlockContent\n baseClass={baseClass}\n field={parentLexicalRichTextField}\n formData={formData}\n formSchema={Array.isArray(fieldMap) ? fieldMap : []}\n nodeKey={nodeKey}\n path={`${path}.feature.blocks.${formData.blockType}`}\n reducedBlock={reducedBlock}\n schemaPath={schemaFieldsPath}\n />\n </Form>\n ) : (\n <Collapsible\n className={classNames}\n collapsibleStyle=\"default\"\n header={\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 reducedBlock.labels.singular === 'string'\n ? getTranslation(reducedBlock.labels.singular, i18n)\n : '[Singular Label]'}\n </Pill>\n <SectionTitle path=\"blockName\" readOnly={parentLexicalRichTextField?.readOnly} />\n </div>\n </div>\n }\n key={0}\n >\n <ShimmerEffect height=\"35vh\" />\n </Collapsible>\n )\n }, [\n fieldMap,\n parentLexicalRichTextField,\n nodeKey,\n i18n,\n submitted,\n initialState,\n reducedBlock,\n blockFieldWrapperName,\n onChange,\n schemaFieldsPath,\n path,\n ]) // Adding formData to the dependencies here might break it\n return <div className={baseClass + ' ' + baseClass + '-' + formData.blockType}>{formContent}</div>\n}\n"],"names":["Form","React","useCallback","useEffect","useMemo","useState","baseClass","getTranslation","Collapsible","Pill","ShimmerEffect","SectionTitle","useFieldProps","useFormSubmitted","useConfig","useDocumentInfo","useTranslation","getFormState","v4","uuid","useEditorConfigContext","BlockContent","removeEmptyArrayValues","BlockComponent","props","blockFieldWrapperName","formData","nodeKey","config","submitted","id","path","schemaPath","editorConfig","field","parentLexicalRichTextField","initialState","setInitialState","richTextComponentMap","componentMapRenderedFieldsPath","blockType","schemaFieldsPath","reducedBlock","resolvedFeatureMap","get","clientFeatureProps","reducedBlocks","find","block","slug","fieldMap","awaitInitialState","state","apiRoute","routes","api","body","data","JSON","parse","stringify","operation","serverURL","fields","blockName","initialValue","passesCondition","valid","value","onChange","formState","prevFormState","i18n","classNames","filter","Boolean","join","formContent","beforeSubmit","formSchema","Array","isArray","className","collapsibleStyle","header","div","pillStyle","labels","singular","readOnly","key","height"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA;AAIA,SAASA,IAAI,QAAQ,4BAA2B;AAChD,OAAOC,SAASC,WAAW,EAAEC,SAAS,EAAEC,OAAO,EAAEC,QAAQ,QAAQ,QAAO;AAGxE,MAAMC,YAAY;AAIlB,SAASC,cAAc,QAAQ,2BAA0B;AACzD,SAASC,WAAW,QAAQ,sCAAqC;AACjE,SAASC,IAAI,QAAQ,+BAA8B;AACnD,SAASC,aAAa,QAAQ,wCAAuC;AACrE,SAASC,YAAY,QAAQ,4CAA2C;AACxE,SAASC,aAAa,QAAQ,0CAAyC;AACvE,SAASC,gBAAgB,QAAQ,4BAA2B;AAC5D,SAASC,SAAS,QAAQ,kCAAiC;AAC3D,SAASC,eAAe,QAAQ,wCAAuC;AACvE,SAASC,cAAc,QAAQ,uCAAsC;AACrE,SAASC,YAAY,QAAQ,wCAAuC;AACpE,SAASC,MAAMC,IAAI,QAAQ,OAAM;AAKjC,SAASC,sBAAsB,QAAQ,yDAAwD;AAC/F,SAASC,YAAY,QAAQ,oBAAmB;AAChD,OAAO,eAAc;AACrB,SAASC,sB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dV,YAAYS;4BAIhB,oBAACjC;YACC0E,WAAWT;YACXU,kBAAiB;YACjBC,sBACE,oBAACC;gBAAIH,WAAW,CAAC,EAAE5E,UAAU,cAAc,CAAC;6BAC1C,oBAAC+E,2BACC,oBAAC5E;gBACCyE,WAAW,CAAC,EAAE5E,UAAU,aAAa,EAAEA,UAAU,aAAa,EAAEoB,UAAUc,UAAU,CAAC;gBACrF8C,WAAU;eAET,OAAO5C,aAAa6C,MAAM,CAACC,QAAQ,KAAK,WACrCjF,eAAemC,aAAa6C,MAAM,CAACC,QAAQ,EAAEhB,QAC7C,mCAEN,oBAAC7D;gBAAaoB,MAAK;gBAAY0D,UAAUtD,4BAA4BsD;;YAI3EC,KAAK;yBAEL,oBAAChF;YAAciF,QAAO;;IAG5B,GAAG;QACDzC;QACAf;QACAR;QACA6C;QACA3C;QACAO;QACAM;QACAjB;QACA4C;QACA5B;QACAV;KACD,EAAE,0DAA0D;;IAC7D,qBAAO,oBAACsD;QAAIH,WAAW5E,YAAY,MAAMA,YAAY,MAAMoB,SAASc,SAAS;OAAGqC;AAClF,EAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/field/features/blocks/drawer/index.tsx"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,cAAc,EAAiB,MAAM,SAAS,CAAA;AAM5D,OAAO,KAA2C,MAAM,OAAO,CAAA;AAU/D,eAAO,MAAM,gCAAgC,EAAE,cAAc,CAAC;IAC5D,OAAO,EAAE;QAAE,OAAO,EAAE,MAAM,CAAA;KAAE,GAAG,KAAK,CAAA;CACrC,CAAqD,CAAA;AAiCtD,eAAO,MAAM,qBAAqB,EAAE,KAAK,CAAC,EA4DzC,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/field/features/blocks/drawer/index.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAiB,MAAM,SAAS,CAAA;AAS5D,OAAO,KAA2C,MAAM,OAAO,CAAA;AAU/D,eAAO,MAAM,gCAAgC,EAAE,cAAc,CAAC;IAC5D,OAAO,EAAE;QAAE,OAAO,EAAE,MAAM,CAAA;KAAE,GAAG,KAAK,CAAA;CACrC,CAAqD,CAAA;AAiCtD,eAAO,MAAM,qBAAqB,EAAE,KAAK,CAAC,EA4DzC,CAAA"}
@@ -1,13 +1,11 @@
1
1
  'use client';
2
2
  import * as facelessUIImport from '@faceless-ui/modal';
3
- import lexicalComposerContextImport from '@lexical/react/LexicalComposerContext.js';
4
- const { useLexicalComposerContext } = lexicalComposerContextImport;
5
- import lexicalImport from 'lexical';
6
- const { $getNodeByKey, COMMAND_PRIORITY_EDITOR, createCommand } = lexicalImport;
3
+ import { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext.js';
7
4
  import { formatDrawerSlug } from '@payloadcms/ui/elements/Drawer';
8
5
  import { BlocksDrawer } from '@payloadcms/ui/fields/Blocks/BlocksDrawer';
9
6
  import { useEditDepth } from '@payloadcms/ui/providers/EditDepth';
10
7
  import { useTranslation } from '@payloadcms/ui/providers/Translation';
8
+ import { $getNodeByKey, COMMAND_PRIORITY_EDITOR, createCommand } from 'lexical';
11
9
  import React, { useCallback, useEffect, useState } from 'react';
12
10
  import { useEditorConfigContext } from '../../../lexical/config/client/EditorConfigProvider.js';
13
11
  import { $createBlockNode } from '../nodes/BlocksNode.js';
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../src/field/features/blocks/drawer/index.tsx"],"sourcesContent":["'use client'\nimport * as facelessUIImport from '@faceless-ui/modal'\nimport lexicalComposerContextImport from '@lexical/react/LexicalComposerContext.js'\nconst { useLexicalComposerContext } = lexicalComposerContextImport\nimport lexicalImport from 'lexical'\nconst { $getNodeByKey, COMMAND_PRIORITY_EDITOR, createCommand } = lexicalImport\n\nimport type { LexicalCommand, LexicalEditor } from 'lexical'\n\nimport { formatDrawerSlug } from '@payloadcms/ui/elements/Drawer'\nimport { BlocksDrawer } from '@payloadcms/ui/fields/Blocks/BlocksDrawer'\nimport { useEditDepth } from '@payloadcms/ui/providers/EditDepth'\nimport { useTranslation } from '@payloadcms/ui/providers/Translation'\nimport React, { useCallback, useEffect, useState } from 'react'\n\nimport type { ClientComponentProps } from '../../types.js'\nimport type { BlocksFeatureClientProps } from '../feature.client.js'\n\nimport { useEditorConfigContext } from '../../../lexical/config/client/EditorConfigProvider.js'\nimport { $createBlockNode } from '../nodes/BlocksNode.js'\nimport { INSERT_BLOCK_COMMAND } from '../plugin/commands.js'\nconst baseClass = 'lexical-blocks-drawer'\n\nexport const INSERT_BLOCK_WITH_DRAWER_COMMAND: LexicalCommand<{\n replace: { nodeKey: string } | false\n}> = createCommand('INSERT_BLOCK_WITH_DRAWER_COMMAND')\n\nconst insertBlock = ({\n blockType,\n editor,\n replaceNodeKey,\n}: {\n blockType: string\n editor: LexicalEditor\n replaceNodeKey: null | string\n}) => {\n if (!replaceNodeKey) {\n editor.dispatchCommand(INSERT_BLOCK_COMMAND, {\n id: null,\n blockName: '',\n blockType,\n })\n } else {\n editor.update(() => {\n const node = $getNodeByKey(replaceNodeKey)\n if (node) {\n node.replace(\n $createBlockNode({\n id: null,\n blockName: '',\n blockType,\n }),\n )\n }\n })\n }\n}\n\nexport const BlocksDrawerComponent: React.FC = () => {\n const { useModal } = facelessUIImport\n\n const [editor] = useLexicalComposerContext()\n const { editorConfig, uuid } = useEditorConfigContext()\n\n const [replaceNodeKey, setReplaceNodeKey] = useState<null | string>(null)\n const editDepth = useEditDepth()\n const { t } = useTranslation()\n const { openModal } = useModal()\n\n const labels = {\n plural: t('fields:blocks') || 'Blocks',\n singular: t('fields:block') || 'Block',\n }\n\n const addRow = useCallback(\n (rowIndex: number, blockType: string) => {\n insertBlock({\n blockType,\n editor,\n replaceNodeKey,\n })\n },\n [editor, replaceNodeKey],\n )\n\n const drawerSlug = formatDrawerSlug({\n slug: `lexical-rich-text-blocks-` + uuid,\n depth: editDepth,\n })\n\n const reducedBlocks = (\n editorConfig?.resolvedFeatureMap?.get('blocks')\n ?.clientFeatureProps as ClientComponentProps<BlocksFeatureClientProps>\n )?.reducedBlocks\n\n useEffect(() => {\n return editor.registerCommand<{\n replace: { nodeKey: string } | false\n }>(\n INSERT_BLOCK_WITH_DRAWER_COMMAND,\n (payload) => {\n setReplaceNodeKey(payload?.replace ? payload?.replace.nodeKey : null)\n openModal(drawerSlug)\n return true\n },\n COMMAND_PRIORITY_EDITOR,\n )\n }, [editor, drawerSlug, openModal])\n\n return (\n <BlocksDrawer\n addRow={addRow}\n addRowIndex={0}\n blocks={reducedBlocks}\n drawerSlug={drawerSlug}\n labels={labels}\n />\n )\n}\n"],"names":["facelessUIImport","lexicalComposerContextImport","useLexicalComposerContext","lexicalImport","$getNodeByKey","COMMAND_PRIORITY_EDITOR","createCommand","formatDrawerSlug","BlocksDrawer","useEditDepth","useTranslation","React","useCallback","useEffect","useState","useEditorConfigContext","$createBlockNode","INSERT_BLOCK_COMMAND","baseClass","INSERT_BLOCK_WITH_DRAWER_COMMAND","insertBlock","blockType","editor","replaceNodeKey","dispatchCommand","id","blockName","update","node","replace","BlocksDrawerComponent","useModal","editorConfig","uuid","setReplaceNodeKey","editDepth","t","openModal","labels","plural","singular","addRow","rowIndex","drawerSlug","slug","depth","reducedBlocks","resolvedFeatureMap","get","clientFeatureProps","registerCommand","payload","nodeKey","addRowIndex","blocks"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA;AACA,YAAYA,sBAAsB,qBAAoB;AACtD,OAAOC,kCAAkC,2CAA0C;AACnF,MAAM,EAAEC,yBAAyB,EAAE,GAAGD;AACtC,OAAOE,mBAAmB,UAAS;AACnC,MAAM,EAAEC,aAAa,EAAEC,uBAAuB,EAAEC,aAAa,EAAE,GAAGH;AAIlE,SAASI,gBAAgB,QAAQ,iCAAgC;AACjE,SAASC,YAAY,QAAQ,4CA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AAC,GAAGX;QACpCY,OAAOV;IACT;IAEA,MAAMW,gBACJd,cAAce,oBAAoBC,IAAI,WAClCC,oBACHH;IAEHjC,UAAU;QACR,OAAOS,OAAO4B,eAAe,CAG3B/B,kCACA,CAACgC;YACCjB,kBAAkBiB,SAAStB,UAAUsB,SAAStB,QAAQuB,UAAU;YAChEf,UAAUM;YACV,OAAO;QACT,GACAtC;IAEJ,GAAG;QAACiB;QAAQqB;QAAYN;KAAU;IAElC,qBACE,oBAAC7B;QACCiC,QAAQA;QACRY,aAAa;QACbC,QAAQR;QACRH,YAAYA;QACZL,QAAQA;;AAGd,EAAC"}
1
+ {"version":3,"sources":["../../../../../src/field/features/blocks/drawer/index.tsx"],"sourcesContent":["'use client'\nimport type { LexicalCommand, LexicalEditor } from 'lexical'\n\nimport * as facelessUIImport from '@faceless-ui/modal'\nimport { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext.js'\nimport { formatDrawerSlug } from '@payloadcms/ui/elements/Drawer'\nimport { BlocksDrawer } from '@payloadcms/ui/fields/Blocks/BlocksDrawer'\nimport { useEditDepth } from '@payloadcms/ui/providers/EditDepth'\nimport { useTranslation } from '@payloadcms/ui/providers/Translation'\nimport { $getNodeByKey, COMMAND_PRIORITY_EDITOR, createCommand } from 'lexical'\nimport React, { useCallback, useEffect, useState } from 'react'\n\nimport type { ClientComponentProps } from '../../types.js'\nimport type { BlocksFeatureClientProps } from '../feature.client.js'\n\nimport { useEditorConfigContext } from '../../../lexical/config/client/EditorConfigProvider.js'\nimport { $createBlockNode } from '../nodes/BlocksNode.js'\nimport { INSERT_BLOCK_COMMAND } from '../plugin/commands.js'\nconst baseClass = 'lexical-blocks-drawer'\n\nexport const INSERT_BLOCK_WITH_DRAWER_COMMAND: LexicalCommand<{\n replace: { nodeKey: string } | false\n}> = createCommand('INSERT_BLOCK_WITH_DRAWER_COMMAND')\n\nconst insertBlock = ({\n blockType,\n editor,\n replaceNodeKey,\n}: {\n blockType: string\n editor: LexicalEditor\n replaceNodeKey: null | string\n}) => {\n if (!replaceNodeKey) {\n editor.dispatchCommand(INSERT_BLOCK_COMMAND, {\n id: null,\n blockName: '',\n blockType,\n })\n } else {\n editor.update(() => {\n const node = $getNodeByKey(replaceNodeKey)\n if (node) {\n node.replace(\n $createBlockNode({\n id: null,\n blockName: '',\n blockType,\n }),\n )\n }\n })\n }\n}\n\nexport const BlocksDrawerComponent: React.FC = () => {\n const { useModal } = facelessUIImport\n\n const [editor] = useLexicalComposerContext()\n const { editorConfig, uuid } = useEditorConfigContext()\n\n const [replaceNodeKey, setReplaceNodeKey] = useState<null | string>(null)\n const editDepth = useEditDepth()\n const { t } = useTranslation()\n const { openModal } = useModal()\n\n const labels = {\n plural: t('fields:blocks') || 'Blocks',\n singular: t('fields:block') || 'Block',\n }\n\n const addRow = useCallback(\n (rowIndex: number, blockType: string) => {\n insertBlock({\n blockType,\n editor,\n replaceNodeKey,\n })\n },\n [editor, replaceNodeKey],\n )\n\n const drawerSlug = formatDrawerSlug({\n slug: `lexical-rich-text-blocks-` + uuid,\n depth: editDepth,\n })\n\n const reducedBlocks = (\n editorConfig?.resolvedFeatureMap?.get('blocks')\n ?.clientFeatureProps as ClientComponentProps<BlocksFeatureClientProps>\n )?.reducedBlocks\n\n useEffect(() => {\n return editor.registerCommand<{\n replace: { nodeKey: string } | false\n }>(\n INSERT_BLOCK_WITH_DRAWER_COMMAND,\n (payload) => {\n setReplaceNodeKey(payload?.replace ? payload?.replace.nodeKey : null)\n openModal(drawerSlug)\n return true\n },\n COMMAND_PRIORITY_EDITOR,\n )\n }, [editor, drawerSlug, openModal])\n\n return (\n <BlocksDrawer\n addRow={addRow}\n addRowIndex={0}\n blocks={reducedBlocks}\n drawerSlug={drawerSlug}\n labels={labels}\n />\n )\n}\n"],"names":["facelessUIImport","useLexicalComposerContext","formatDrawerSlug","BlocksDrawer","useEditDepth","useTranslation","$getNodeByKey","COMMAND_PRIORITY_EDITOR","createCommand","React","useCallback","useEffect","useState","useEditorConfigContext","$createBlockNode","INSERT_BLOCK_COMMAND","baseClass","INSERT_BLOCK_WITH_DRAWER_COMMAND","insertBlock","blockType","editor","replaceNodeKey","dispatchCommand","id","blockName","update","node","replace","BlocksDrawerComponent","useModal","editorConfig","uuid","setReplaceNodeKey","editDepth","t","openModal","labels","plural","singular","addRow","rowIndex","drawerSlug","slug","depth","reducedBlocks","resolvedFeatureMap","get","clientFeatureProps","registerCommand","payload","nodeKey","addRowIndex","blocks"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA;AAGA,YAAYA,sBAAsB,qBAAoB;AACtD,SAASC,yBAAyB,QAAQ,2CAA0C;AACpF,SAASC,gBAAgB,QAAQ,iCAAgC;AACjE,SAASC,YAAY,QAAQ,4CAA2C;AACxE,SAASC,YAAY,QAAQ,qCAAoC;AACjE,SAASC,cAAc,QAAQ,uCAAsC;AACrE,SAASC,aAAa,EAAEC,uBAAuB,EAAEC,aAAa,QAAQ,UAAS;AAC/E,OAAOC,SAASC,WAAW,EAAEC,SAAS,EAAEC,QAAQ,QAAQ,QAAO;AAK/D,SAASC,sBAAsB,QAAQ,yDAAwD;AAC/F,SAASC,gBAAgB,QAAQ,yBAAwB;AACzD,SAASC,oBAAoB,QAAQ,wBAAuB;AAC5D,MAAMC,YAAY;AAElB,OAAO,MAAMC,mCAERT,cAAc,oCAAmC;AAEtD,MAAMU,cAAc,CAAC,EACnBC,SAAS,EACTC,MAAM,EACNC,cAAc,EAKf;IACC,IAAI,CAACA,gBAAgB;QACnBD,OAAOE,eAAe,CAACP,sBAAsB;YAC3CQ,IAAI;YACJC,WAAW;YACXL;QACF;IACF,OAAO;QACLC,OAAOK,MAAM,CAAC;YACZ,MAAMC,OAAOpB,cAAce;YAC3B,IAAIK,MAAM;gBACRA,KAAKC,OAAO,CACVb,iBAAiB;oBACfS,IAAI;oBACJC,WAAW;oBACXL;gBACF;YAEJ;QACF;IACF;AACF;AAEA,OAAO,MAAMS,wBAAkC;IAC7C,MAAM,EAAEC,QAAQ,EAAE,GAAG7B;IAErB,MAAM,CAACoB,OAAO,GAAGnB;IACjB,MAAM,EAAE6B,YAAY,EAAEC,IAAI,EAAE,GAAGlB;IAE/B,MAAM,CAACQ,gBAAgBW,kBAAkB,GAAGpB,SAAwB;IACpE,MAAMqB,YAAY7B;IAClB,MAAM,EAAE8B,CAAC,EAAE,GAAG7B;IACd,MAAM,EAAE8B,SAAS,EAAE,GAAGN;IAEtB,MAAMO,SAAS;QACbC,QAAQH,EAAE,oBAAoB;QAC9BI,UAAUJ,EAAE,mBAAmB;IACjC;IAEA,MAAMK,SAAS7B,YACb,CAAC8B,UAAkBrB;QACjBD,YAAY;YACVC;YACAC;YACAC;QACF;IACF,GACA;QAACD;QAAQC;KAAe;IAG1B,MAAMoB,aAAavC,iBAAiB;QAClCwC,MAAM,CAAC,yBAAyB,CAAC,GAAGX;QACpCY,OAAOV;IACT;IAEA,MAAMW,gBACJd,cAAce,oBAAoBC,IAAI,WAClCC,oBACHH;IAEHjC,UAAU;QACR,OAAOS,OAAO4B,eAAe,CAG3B/B,kCACA,CAACgC;YACCjB,kBAAkBiB,SAAStB,UAAUsB,SAAStB,QAAQuB,UAAU;YAChEf,UAAUM;YACV,OAAO;QACT,GACAlC;IAEJ,GAAG;QAACa;QAAQqB;QAAYN;KAAU;IAElC,qBACE,oBAAChC;QACCoC,QAAQA;QACRY,aAAa;QACbC,QAAQR;QACRH,YAAYA;QACZL,QAAQA;;AAGd,EAAC"}
@@ -3,5 +3,8 @@ import type { ReducedBlock } from '@payloadcms/ui/utilities/buildComponentMap';
3
3
  export type BlocksFeatureClientProps = {
4
4
  reducedBlocks: ReducedBlock[];
5
5
  };
6
- export declare const BlocksFeatureClientComponent: import("react").FC<import("../types.js").ClientComponentProps<BlocksFeatureClientProps>>;
6
+ export declare const BlocksFeatureClientComponent: import("react").FC<{
7
+ featureKey: string;
8
+ order: number;
9
+ } & BlocksFeatureClientProps>;
7
10
  //# sourceMappingURL=feature.client.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"feature.client.d.ts","sourceRoot":"","sources":["../../../../src/field/features/blocks/feature.client.tsx"],"names":[],"mappings":";AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,4CAA4C,CAAA;AAa9E,MAAM,MAAM,wBAAwB,GAAG;IACrC,aAAa,EAAE,YAAY,EAAE,CAAA;CAC9B,CAAA;AAgDD,eAAO,MAAM,4BAA4B,0FAA6C,CAAA"}
1
+ {"version":3,"file":"feature.client.d.ts","sourceRoot":"","sources":["../../../../src/field/features/blocks/feature.client.tsx"],"names":[],"mappings":";AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,4CAA4C,CAAA;AAY9E,MAAM,MAAM,wBAAwB,GAAG;IACrC,aAAa,EAAE,YAAY,EAAE,CAAA;CAC9B,CAAA;AA+ED,eAAO,MAAM,4BAA4B;;;6BAA6C,CAAA"}
@@ -1,6 +1,5 @@
1
1
  'use client';
2
2
  import { getTranslation } from '@payloadcms/translations';
3
- import { SlashMenuOption } from '../../lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/types.js';
4
3
  import { BlockIcon } from '../../lexical/ui/icons/Block/index.js';
5
4
  import { createClientComponent } from '../createClientComponent.js';
6
5
  import { BlockNode } from './nodes/BlocksNode.js';
@@ -21,35 +20,65 @@ const BlocksFeatureClient = (props)=>{
21
20
  }
22
21
  ],
23
22
  slashMenu: {
24
- options: [
23
+ groups: [
25
24
  {
26
- displayName: 'Blocks',
25
+ items: props.reducedBlocks.map((block)=>{
26
+ return {
27
+ Icon: BlockIcon,
28
+ key: 'block-' + block.slug,
29
+ keywords: [
30
+ 'block',
31
+ 'blocks',
32
+ block.slug
33
+ ],
34
+ label: ({ i18n })=>{
35
+ if (!block.labels.singular) {
36
+ return block.slug;
37
+ }
38
+ return getTranslation(block.labels.singular, i18n);
39
+ },
40
+ onSelect: ({ editor })=>{
41
+ editor.dispatchCommand(INSERT_BLOCK_COMMAND, {
42
+ id: null,
43
+ blockName: '',
44
+ blockType: block.slug
45
+ });
46
+ }
47
+ };
48
+ }),
27
49
  key: 'blocks',
28
- options: [
29
- ...props.reducedBlocks.map((block)=>{
30
- return new SlashMenuOption('block-' + block.slug, {
31
- Icon: BlockIcon,
32
- displayName: ({ i18n })=>{
33
- if (!block.labels.singular) {
34
- return block.slug;
35
- }
36
- return getTranslation(block.labels.singular, i18n);
37
- },
38
- keywords: [
39
- 'block',
40
- 'blocks',
41
- block.slug
42
- ],
43
- onSelect: ({ editor })=>{
44
- editor.dispatchCommand(INSERT_BLOCK_COMMAND, {
45
- id: null,
46
- blockName: '',
47
- blockType: block.slug
48
- });
50
+ label: 'Blocks'
51
+ }
52
+ ]
53
+ },
54
+ toolbarFixed: {
55
+ groups: [
56
+ {
57
+ type: 'dropdown',
58
+ ChildComponent: BlockIcon,
59
+ items: props.reducedBlocks.map((block, index)=>{
60
+ return {
61
+ ChildComponent: BlockIcon,
62
+ isActive: undefined,
63
+ key: 'block-' + block.slug,
64
+ label: ({ i18n })=>{
65
+ if (!block.labels.singular) {
66
+ return block.slug;
49
67
  }
50
- });
51
- })
52
- ]
68
+ return getTranslation(block.labels.singular, i18n);
69
+ },
70
+ onSelect: ({ editor })=>{
71
+ editor.dispatchCommand(INSERT_BLOCK_COMMAND, {
72
+ id: null,
73
+ blockName: '',
74
+ blockType: block.slug
75
+ });
76
+ },
77
+ order: index
78
+ };
79
+ }),
80
+ key: 'blocks',
81
+ order: 20
53
82
  }
54
83
  ]
55
84
  }
@@ -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 { SlashMenuOption } from '../../lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/types.js'\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 options: [\n {\n displayName: 'Blocks',\n key: 'blocks',\n options: [\n ...props.reducedBlocks.map((block) => {\n return new SlashMenuOption('block-' + block.slug, {\n Icon: BlockIcon,\n displayName: ({ i18n }) => {\n if (!block.labels.singular) {\n return block.slug\n }\n\n return getTranslation(block.labels.singular, i18n)\n },\n keywords: ['block', 'blocks', block.slug],\n onSelect: ({ editor }) => {\n editor.dispatchCommand(INSERT_BLOCK_COMMAND, {\n id: null,\n blockName: '',\n blockType: block.slug,\n })\n },\n })\n }),\n ],\n },\n ],\n },\n }),\n }\n}\n\nexport const BlocksFeatureClientComponent = createClientComponent(BlocksFeatureClient)\n"],"names":["getTranslation","SlashMenuOption","BlockIcon","createClientComponent","BlockNode","INSERT_BLOCK_COMMAND","BlocksPlugin","BlocksFeatureClient","props","clientFeatureProps","feature","nodes","plugins","Component","position","slashMenu","options","displayName","key","reducedBlocks","map","block","slug","Icon","i18n","labels","singular","keywords","onSelect","editor","dispatchCommand","id","blockName","blockType","BlocksFeatureClientComponent"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA;AAIA,SAASA,cAAc,QAAQ,2BAA0B;AAIzD,SAASC,eAAe,QAAQ,sEAAqE;AACrG,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;iBAAU;gBAClBQ,SAAS;oBACP;wBACEC,WAAWP;wBACXQ,UAAU;oBACZ;iBACD;gBACDC,WAAW;oBACTC,SAAS;wBACP;4BACEC,aAAa;4BACbC,KAAK;4BACLF,SAAS;mCACJR,MAAMW,aAAa,CAACC,GAAG,CAAC,CAACC;oCAC1B,OAAO,IAAIpB,gBAAgB,WAAWoB,MAAMC,IAAI,EAAE;wCAChDC,MAAMrB;wCACNe,aAAa,CAAC,EAAEO,IAAI,EAAE;4CACpB,IAAI,CAACH,MAAMI,MAAM,CAACC,QAAQ,EAAE;gDAC1B,OAAOL,MAAMC,IAAI;4CACnB;4CAEA,OAAOtB,eAAeqB,MAAMI,MAAM,CAACC,QAAQ,EAAEF;wCAC/C;wCACAG,UAAU;4CAAC;4CAAS;4CAAUN,MAAMC,IAAI;yCAAC;wCACzCM,UAAU,CAAC,EAAEC,MAAM,EAAE;4CACnBA,OAAOC,eAAe,CAACzB,sBAAsB;gDAC3C0B,IAAI;gDACJC,WAAW;gDACXC,WAAWZ,MAAMC,IAAI;4CACvB;wCACF;oCACF;gCACF;6BACD;wBACH;qBACD;gBACH;YACF,CAAA;IACF;AACF;AAEA,OAAO,MAAMY,+BAA+B/B,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: '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,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;iBAAU;gBAClBQ,SAAS;oBACP;wBACEC,WAAWP;wBACXQ,UAAU;oBACZ;iBACD;gBACDC,WAAW;oBACTC,QAAQ;wBACN;4BACEC,OAAOT,MAAMU,aAAa,CAACC,GAAG,CAAC,CAACC;gCAC9B,OAAO;oCACLC,MAAMnB;oCACNoB,KAAK,WAAWF,MAAMG,IAAI;oCAC1BC,UAAU;wCAAC;wCAAS;wCAAUJ,MAAMG,IAAI;qCAAC;oCACzCE,OAAO,CAAC,EAAEC,IAAI,EAAE;wCACd,IAAI,CAACN,MAAMO,MAAM,CAACC,QAAQ,EAAE;4CAC1B,OAAOR,MAAMG,IAAI;wCACnB;wCAEA,OAAOtB,eAAemB,MAAMO,MAAM,CAACC,QAAQ,EAAEF;oCAC/C;oCACAG,UAAU,CAAC,EAAEC,MAAM,EAAE;wCACnBA,OAAOC,eAAe,CAAC1B,sBAAsB;4CAC3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