@payloadcms/richtext-lexical 3.0.0-canary.ff8c8fd → 3.0.0

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 (821) hide show
  1. package/LICENSE.md +1 -1
  2. package/dist/cell/rscEntry.d.ts +12 -0
  3. package/dist/cell/rscEntry.d.ts.map +1 -0
  4. package/dist/cell/rscEntry.js +82 -0
  5. package/dist/cell/rscEntry.js.map +1 -0
  6. package/dist/exports/client/Field-KKSJXHR7.js +2 -0
  7. package/dist/exports/client/Field-KKSJXHR7.js.map +7 -0
  8. package/dist/exports/client/RelationshipComponent-2RT3YXUT.js +2 -0
  9. package/dist/exports/client/RelationshipComponent-2RT3YXUT.js.map +7 -0
  10. package/dist/exports/client/bundled.css +1 -1
  11. package/dist/exports/client/chunk-2CYU43GM.js +2 -0
  12. package/dist/exports/client/chunk-2CYU43GM.js.map +7 -0
  13. package/dist/exports/client/chunk-5PBXL4HT.js +2 -0
  14. package/dist/exports/client/chunk-5PBXL4HT.js.map +7 -0
  15. package/dist/exports/client/chunk-C7S3V4EB.js +2 -0
  16. package/dist/exports/client/chunk-C7S3V4EB.js.map +7 -0
  17. package/dist/exports/client/chunk-CUIBIFW2.js +2 -0
  18. package/dist/exports/client/chunk-CUIBIFW2.js.map +7 -0
  19. package/dist/exports/client/{chunk-UJDWBQ2K.js → chunk-MI5HS4QX.js} +2 -2
  20. package/dist/exports/client/{chunk-UJDWBQ2K.js.map → chunk-MI5HS4QX.js.map} +2 -2
  21. package/dist/exports/client/chunk-QPPOQTHD.js +2 -0
  22. package/dist/exports/client/chunk-QPPOQTHD.js.map +7 -0
  23. package/dist/exports/client/chunk-U7O7EYCP.js +2 -0
  24. package/dist/exports/client/chunk-U7O7EYCP.js.map +7 -0
  25. package/dist/exports/client/{chunk-V2LKLT2F.js → chunk-XCEM47RI.js} +3 -3
  26. package/dist/exports/client/{chunk-V2LKLT2F.js.map → chunk-XCEM47RI.js.map} +3 -3
  27. package/dist/exports/client/component-ANB7VZLA.js +2 -0
  28. package/dist/exports/client/component-ANB7VZLA.js.map +7 -0
  29. package/dist/exports/client/component-H3EYQ5KG.js +2 -0
  30. package/dist/exports/client/component-H3EYQ5KG.js.map +7 -0
  31. package/dist/exports/client/componentInline-ZGO3K4TA.js +2 -0
  32. package/dist/exports/client/componentInline-ZGO3K4TA.js.map +7 -0
  33. package/dist/exports/client/index.d.ts +10 -4
  34. package/dist/exports/client/index.d.ts.map +1 -1
  35. package/dist/exports/client/index.js +10 -8
  36. package/dist/exports/client/index.js.map +4 -4
  37. package/dist/exports/server/ast/mdx.d.ts +7 -0
  38. package/dist/exports/server/ast/mdx.d.ts.map +1 -0
  39. package/dist/exports/server/ast/mdx.js +37 -0
  40. package/dist/exports/server/ast/mdx.js.map +1 -0
  41. package/dist/exports/server/rsc.d.ts +3 -0
  42. package/dist/exports/server/rsc.d.ts.map +1 -0
  43. package/dist/exports/server/rsc.js +3 -0
  44. package/dist/exports/server/rsc.js.map +1 -0
  45. package/dist/exports/shared.d.ts +4 -0
  46. package/dist/exports/shared.d.ts.map +1 -0
  47. package/dist/exports/shared.js +4 -0
  48. package/dist/exports/shared.js.map +1 -0
  49. package/dist/features/align/client/index.d.ts +1 -4
  50. package/dist/features/align/client/index.d.ts.map +1 -1
  51. package/dist/features/blockquote/client/index.d.ts +1 -4
  52. package/dist/features/blockquote/client/index.d.ts.map +1 -1
  53. package/dist/features/blockquote/markdownTransformer.js.map +1 -1
  54. package/dist/features/blockquote/server/index.d.ts +1 -1
  55. package/dist/features/blockquote/server/index.d.ts.map +1 -1
  56. package/dist/features/blockquote/server/index.js +5 -1
  57. package/dist/features/blockquote/server/index.js.map +1 -1
  58. package/dist/features/blocks/client/component/BlockContent.d.ts +34 -8
  59. package/dist/features/blocks/client/component/BlockContent.d.ts.map +1 -1
  60. package/dist/features/blocks/client/component/BlockContent.js +66 -170
  61. package/dist/features/blocks/client/component/BlockContent.js.map +1 -1
  62. package/dist/features/blocks/client/component/components/BlockCollapsible.d.ts +11 -0
  63. package/dist/features/blocks/client/component/components/BlockCollapsible.d.ts.map +1 -0
  64. package/dist/features/blocks/client/component/components/BlockCollapsible.js +37 -0
  65. package/dist/features/blocks/client/component/components/BlockCollapsible.js.map +1 -0
  66. package/dist/features/blocks/client/component/components/BlockEditButton.d.ts +3 -0
  67. package/dist/features/blocks/client/component/components/BlockEditButton.d.ts.map +1 -0
  68. package/dist/features/blocks/client/component/components/BlockEditButton.js +22 -0
  69. package/dist/features/blocks/client/component/components/BlockEditButton.js.map +1 -0
  70. package/dist/features/blocks/client/component/components/BlockRemoveButton.d.ts +3 -0
  71. package/dist/features/blocks/client/component/components/BlockRemoveButton.d.ts.map +1 -0
  72. package/dist/features/blocks/client/component/components/BlockRemoveButton.js +22 -0
  73. package/dist/features/blocks/client/component/components/BlockRemoveButton.js.map +1 -0
  74. package/dist/features/blocks/client/component/index.d.ts +1 -1
  75. package/dist/features/blocks/client/component/index.d.ts.map +1 -1
  76. package/dist/features/blocks/client/component/index.js +294 -93
  77. package/dist/features/blocks/client/component/index.js.map +1 -1
  78. package/dist/features/blocks/client/componentInline/components/InlineBlockContainer.d.ts +5 -0
  79. package/dist/features/blocks/client/componentInline/components/InlineBlockContainer.d.ts.map +1 -0
  80. package/dist/features/blocks/client/componentInline/components/InlineBlockContainer.js +28 -0
  81. package/dist/features/blocks/client/componentInline/components/InlineBlockContainer.js.map +1 -0
  82. package/dist/features/blocks/client/componentInline/components/InlineBlockEditButton.d.ts +3 -0
  83. package/dist/features/blocks/client/componentInline/components/InlineBlockEditButton.d.ts.map +1 -0
  84. package/dist/features/blocks/client/componentInline/components/InlineBlockEditButton.js +22 -0
  85. package/dist/features/blocks/client/componentInline/components/InlineBlockEditButton.js.map +1 -0
  86. package/dist/features/blocks/client/componentInline/components/InlineBlockLabel.d.ts +3 -0
  87. package/dist/features/blocks/client/componentInline/components/InlineBlockLabel.d.ts.map +1 -0
  88. package/dist/features/blocks/client/componentInline/components/InlineBlockLabel.js +22 -0
  89. package/dist/features/blocks/client/componentInline/components/InlineBlockLabel.js.map +1 -0
  90. package/dist/features/blocks/client/componentInline/components/InlineBlockRemoveButton.d.ts +3 -0
  91. package/dist/features/blocks/client/componentInline/components/InlineBlockRemoveButton.d.ts.map +1 -0
  92. package/dist/features/blocks/client/componentInline/components/InlineBlockRemoveButton.js +22 -0
  93. package/dist/features/blocks/client/componentInline/components/InlineBlockRemoveButton.js.map +1 -0
  94. package/dist/features/blocks/client/componentInline/index.d.ts +14 -2
  95. package/dist/features/blocks/client/componentInline/index.d.ts.map +1 -1
  96. package/dist/features/blocks/client/componentInline/index.js +237 -63
  97. package/dist/features/blocks/client/componentInline/index.js.map +1 -1
  98. package/dist/features/blocks/client/index.d.ts +1 -8
  99. package/dist/features/blocks/client/index.d.ts.map +1 -1
  100. package/dist/features/blocks/client/index.js +140 -147
  101. package/dist/features/blocks/client/index.js.map +1 -1
  102. package/dist/features/blocks/client/markdownTransformer.d.ts +16 -0
  103. package/dist/features/blocks/client/markdownTransformer.d.ts.map +1 -0
  104. package/dist/features/blocks/client/markdownTransformer.js +144 -0
  105. package/dist/features/blocks/client/markdownTransformer.js.map +1 -0
  106. package/dist/features/blocks/client/nodes/BlocksNode.d.ts +2 -2
  107. package/dist/features/blocks/client/nodes/BlocksNode.d.ts.map +1 -1
  108. package/dist/features/blocks/client/nodes/BlocksNode.js +1 -3
  109. package/dist/features/blocks/client/nodes/BlocksNode.js.map +1 -1
  110. package/dist/features/blocks/client/plugin/commands.d.ts +0 -4
  111. package/dist/features/blocks/client/plugin/commands.d.ts.map +1 -1
  112. package/dist/features/blocks/client/plugin/commands.js +0 -1
  113. package/dist/features/blocks/client/plugin/commands.js.map +1 -1
  114. package/dist/features/blocks/client/plugin/index.d.ts +3 -4
  115. package/dist/features/blocks/client/plugin/index.d.ts.map +1 -1
  116. package/dist/features/blocks/client/plugin/index.js +25 -129
  117. package/dist/features/blocks/client/plugin/index.js.map +1 -1
  118. package/dist/features/blocks/server/index.d.ts +1 -2
  119. package/dist/features/blocks/server/index.d.ts.map +1 -1
  120. package/dist/features/blocks/server/index.js +72 -35
  121. package/dist/features/blocks/server/index.js.map +1 -1
  122. package/dist/features/blocks/server/linesFromMatchToContentAndPropsString.d.ts +22 -0
  123. package/dist/features/blocks/server/linesFromMatchToContentAndPropsString.d.ts.map +1 -0
  124. package/dist/features/blocks/server/linesFromMatchToContentAndPropsString.js +136 -0
  125. package/dist/features/blocks/server/linesFromMatchToContentAndPropsString.js.map +1 -0
  126. package/dist/features/blocks/server/markdownTransformer.d.ts +22 -0
  127. package/dist/features/blocks/server/markdownTransformer.d.ts.map +1 -0
  128. package/dist/features/blocks/server/markdownTransformer.js +400 -0
  129. package/dist/features/blocks/server/markdownTransformer.js.map +1 -0
  130. package/dist/features/blocks/server/nodes/BlocksNode.d.ts +11 -5
  131. package/dist/features/blocks/server/nodes/BlocksNode.d.ts.map +1 -1
  132. package/dist/features/blocks/server/nodes/BlocksNode.js.map +1 -1
  133. package/dist/features/blocks/server/nodes/InlineBlocksNode.d.ts +3 -3
  134. package/dist/features/blocks/server/nodes/InlineBlocksNode.d.ts.map +1 -1
  135. package/dist/features/blocks/server/nodes/InlineBlocksNode.js.map +1 -1
  136. package/dist/features/blocks/server/validate.d.ts.map +1 -1
  137. package/dist/features/blocks/server/validate.js +8 -5
  138. package/dist/features/blocks/server/validate.js.map +1 -1
  139. package/dist/features/converters/html/converter/converters/paragraph.d.ts.map +1 -1
  140. package/dist/features/converters/html/converter/converters/paragraph.js +4 -0
  141. package/dist/features/converters/html/converter/converters/paragraph.js.map +1 -1
  142. package/dist/features/converters/html/converter/converters/text.d.ts.map +1 -1
  143. package/dist/features/converters/html/converter/converters/text.js +2 -1
  144. package/dist/features/converters/html/converter/converters/text.js.map +1 -1
  145. package/dist/features/converters/html/converter/index.d.ts +11 -7
  146. package/dist/features/converters/html/converter/index.d.ts.map +1 -1
  147. package/dist/features/converters/html/converter/index.js +17 -1
  148. package/dist/features/converters/html/converter/index.js.map +1 -1
  149. package/dist/features/converters/html/converter/types.d.ts +3 -1
  150. package/dist/features/converters/html/converter/types.d.ts.map +1 -1
  151. package/dist/features/converters/html/converter/types.js.map +1 -1
  152. package/dist/features/converters/html/field/index.d.ts.map +1 -1
  153. package/dist/features/converters/html/field/index.js +7 -1
  154. package/dist/features/converters/html/field/index.js.map +1 -1
  155. package/dist/features/debug/testRecorder/client/index.d.ts +1 -4
  156. package/dist/features/debug/testRecorder/client/index.d.ts.map +1 -1
  157. package/dist/features/debug/testRecorder/client/plugin/index.js +25 -14
  158. package/dist/features/debug/testRecorder/client/plugin/index.js.map +1 -1
  159. package/dist/features/debug/treeView/client/index.d.ts +1 -4
  160. package/dist/features/debug/treeView/client/index.d.ts.map +1 -1
  161. package/dist/features/experimental_table/client/index.d.ts +1 -1
  162. package/dist/features/experimental_table/client/index.d.ts.map +1 -1
  163. package/dist/features/experimental_table/client/index.js +2 -0
  164. package/dist/features/experimental_table/client/index.js.map +1 -1
  165. package/dist/features/experimental_table/client/plugins/TableActionMenuPlugin/index.d.ts.map +1 -1
  166. package/dist/features/experimental_table/client/plugins/TableActionMenuPlugin/index.js +49 -51
  167. package/dist/features/experimental_table/client/plugins/TableActionMenuPlugin/index.js.map +1 -1
  168. package/dist/features/experimental_table/client/plugins/TableCellResizerPlugin/index.d.ts.map +1 -1
  169. package/dist/features/experimental_table/client/plugins/TableCellResizerPlugin/index.js +55 -42
  170. package/dist/features/experimental_table/client/plugins/TableCellResizerPlugin/index.js.map +1 -1
  171. package/dist/features/experimental_table/client/plugins/TableHoverActionsPlugin/index.d.ts +1 -1
  172. package/dist/features/experimental_table/client/plugins/TableHoverActionsPlugin/index.d.ts.map +1 -1
  173. package/dist/features/experimental_table/client/plugins/TableHoverActionsPlugin/index.js +58 -19
  174. package/dist/features/experimental_table/client/plugins/TableHoverActionsPlugin/index.js.map +1 -1
  175. package/dist/features/experimental_table/client/plugins/TablePlugin/index.d.ts.map +1 -1
  176. package/dist/features/experimental_table/client/plugins/TablePlugin/index.js +52 -50
  177. package/dist/features/experimental_table/client/plugins/TablePlugin/index.js.map +1 -1
  178. package/dist/features/experimental_table/client/utils/debounce.js +4 -4
  179. package/dist/features/experimental_table/client/utils/debounce.js.map +1 -1
  180. package/dist/features/experimental_table/client/utils/useDebounce.js.map +1 -1
  181. package/dist/features/experimental_table/markdownTransformer.d.ts +5 -0
  182. package/dist/features/experimental_table/markdownTransformer.d.ts.map +1 -0
  183. package/dist/features/experimental_table/markdownTransformer.js +127 -0
  184. package/dist/features/experimental_table/markdownTransformer.js.map +1 -0
  185. package/dist/features/experimental_table/server/index.d.ts.map +1 -1
  186. package/dist/features/experimental_table/server/index.js +22 -4
  187. package/dist/features/experimental_table/server/index.js.map +1 -1
  188. package/dist/features/format/bold/feature.client.d.ts +1 -4
  189. package/dist/features/format/bold/feature.client.d.ts.map +1 -1
  190. package/dist/features/format/bold/feature.client.js +2 -1
  191. package/dist/features/format/bold/feature.client.js.map +1 -1
  192. package/dist/features/format/inlineCode/feature.client.d.ts +1 -4
  193. package/dist/features/format/inlineCode/feature.client.d.ts.map +1 -1
  194. package/dist/features/format/inlineCode/feature.client.js +2 -1
  195. package/dist/features/format/inlineCode/feature.client.js.map +1 -1
  196. package/dist/features/format/italic/feature.client.d.ts +1 -4
  197. package/dist/features/format/italic/feature.client.d.ts.map +1 -1
  198. package/dist/features/format/italic/feature.client.js +2 -1
  199. package/dist/features/format/italic/feature.client.js.map +1 -1
  200. package/dist/features/format/strikethrough/feature.client.d.ts +1 -4
  201. package/dist/features/format/strikethrough/feature.client.d.ts.map +1 -1
  202. package/dist/features/format/strikethrough/feature.client.js +2 -1
  203. package/dist/features/format/strikethrough/feature.client.js.map +1 -1
  204. package/dist/features/format/subscript/feature.client.d.ts +1 -4
  205. package/dist/features/format/subscript/feature.client.d.ts.map +1 -1
  206. package/dist/features/format/subscript/feature.client.js +2 -1
  207. package/dist/features/format/subscript/feature.client.js.map +1 -1
  208. package/dist/features/format/superscript/feature.client.d.ts +1 -4
  209. package/dist/features/format/superscript/feature.client.d.ts.map +1 -1
  210. package/dist/features/format/superscript/feature.client.js +2 -1
  211. package/dist/features/format/superscript/feature.client.js.map +1 -1
  212. package/dist/features/format/underline/feature.client.d.ts +1 -4
  213. package/dist/features/format/underline/feature.client.d.ts.map +1 -1
  214. package/dist/features/format/underline/feature.client.js +2 -1
  215. package/dist/features/format/underline/feature.client.js.map +1 -1
  216. package/dist/features/heading/client/index.d.ts +1 -4
  217. package/dist/features/heading/client/index.d.ts.map +1 -1
  218. package/dist/features/heading/server/index.d.ts.map +1 -1
  219. package/dist/features/heading/server/index.js +4 -0
  220. package/dist/features/heading/server/index.js.map +1 -1
  221. package/dist/features/horizontalRule/client/component/index.d.ts +1 -1
  222. package/dist/features/horizontalRule/client/component/index.d.ts.map +1 -1
  223. package/dist/features/horizontalRule/client/component/index.js +12 -9
  224. package/dist/features/horizontalRule/client/component/index.js.map +1 -1
  225. package/dist/features/horizontalRule/client/index.d.ts +1 -4
  226. package/dist/features/horizontalRule/client/index.d.ts.map +1 -1
  227. package/dist/features/horizontalRule/server/nodes/HorizontalRuleNode.d.ts +2 -2
  228. package/dist/features/horizontalRule/server/nodes/HorizontalRuleNode.d.ts.map +1 -1
  229. package/dist/features/horizontalRule/server/nodes/HorizontalRuleNode.js +1 -1
  230. package/dist/features/horizontalRule/server/nodes/HorizontalRuleNode.js.map +1 -1
  231. package/dist/features/indent/client/index.d.ts +1 -4
  232. package/dist/features/indent/client/index.d.ts.map +1 -1
  233. package/dist/features/indent/client/index.js +2 -1
  234. package/dist/features/indent/client/index.js.map +1 -1
  235. package/dist/features/link/client/index.d.ts +1 -13
  236. package/dist/features/link/client/index.d.ts.map +1 -1
  237. package/dist/features/link/client/index.js +2 -2
  238. package/dist/features/link/client/index.js.map +1 -1
  239. package/dist/features/link/client/plugins/autoLink/index.d.ts +1 -1
  240. package/dist/features/link/client/plugins/autoLink/index.d.ts.map +1 -1
  241. package/dist/features/link/client/plugins/autoLink/index.js +3 -1
  242. package/dist/features/link/client/plugins/autoLink/index.js.map +1 -1
  243. package/dist/features/link/client/plugins/floatingLinkEditor/LinkEditor/index.d.ts.map +1 -1
  244. package/dist/features/link/client/plugins/floatingLinkEditor/LinkEditor/index.js +78 -40
  245. package/dist/features/link/client/plugins/floatingLinkEditor/LinkEditor/index.js.map +1 -1
  246. package/dist/features/link/client/plugins/floatingLinkEditor/index.d.ts.map +1 -1
  247. package/dist/features/link/client/plugins/floatingLinkEditor/index.js +1 -1
  248. package/dist/features/link/client/plugins/floatingLinkEditor/index.js.map +1 -1
  249. package/dist/features/link/nodes/AutoLinkNode.js +2 -2
  250. package/dist/features/link/nodes/AutoLinkNode.js.map +1 -1
  251. package/dist/features/link/nodes/LinkNode.d.ts.map +1 -1
  252. package/dist/features/link/nodes/LinkNode.js +12 -7
  253. package/dist/features/link/nodes/LinkNode.js.map +1 -1
  254. package/dist/features/link/nodes/types.d.ts +3 -3
  255. package/dist/features/link/nodes/types.d.ts.map +1 -1
  256. package/dist/features/link/nodes/types.js.map +1 -1
  257. package/dist/features/link/server/baseFields.d.ts +1 -1
  258. package/dist/features/link/server/baseFields.d.ts.map +1 -1
  259. package/dist/features/link/server/baseFields.js +15 -3
  260. package/dist/features/link/server/baseFields.js.map +1 -1
  261. package/dist/features/link/server/i18n.d.ts.map +1 -1
  262. package/dist/features/link/server/i18n.js +64 -32
  263. package/dist/features/link/server/i18n.js.map +1 -1
  264. package/dist/features/link/server/index.d.ts.map +1 -1
  265. package/dist/features/link/server/index.js +17 -4
  266. package/dist/features/link/server/index.js.map +1 -1
  267. package/dist/features/link/server/transformExtraFields.d.ts +1 -1
  268. package/dist/features/link/server/transformExtraFields.d.ts.map +1 -1
  269. package/dist/features/link/server/transformExtraFields.js.map +1 -1
  270. package/dist/features/link/server/validate.d.ts.map +1 -1
  271. package/dist/features/link/server/validate.js +8 -5
  272. package/dist/features/link/server/validate.js.map +1 -1
  273. package/dist/features/lists/checklist/client/index.d.ts +1 -4
  274. package/dist/features/lists/checklist/client/index.d.ts.map +1 -1
  275. package/dist/features/lists/htmlConverter.d.ts.map +1 -1
  276. package/dist/features/lists/htmlConverter.js +8 -0
  277. package/dist/features/lists/htmlConverter.js.map +1 -1
  278. package/dist/features/lists/orderedList/client/index.d.ts +1 -4
  279. package/dist/features/lists/orderedList/client/index.d.ts.map +1 -1
  280. package/dist/features/lists/shared/markdown.js.map +1 -1
  281. package/dist/features/lists/unorderedList/client/index.d.ts +1 -4
  282. package/dist/features/lists/unorderedList/client/index.d.ts.map +1 -1
  283. package/dist/features/migrations/lexicalPluginToLexical/converter/index.d.ts.map +1 -1
  284. package/dist/features/migrations/lexicalPluginToLexical/converter/index.js +1 -0
  285. package/dist/features/migrations/lexicalPluginToLexical/converter/index.js.map +1 -1
  286. package/dist/features/migrations/lexicalPluginToLexical/feature.client.d.ts +1 -4
  287. package/dist/features/migrations/lexicalPluginToLexical/feature.client.d.ts.map +1 -1
  288. package/dist/features/migrations/lexicalPluginToLexical/nodes/unknownConvertedNode/index.d.ts +1 -1
  289. package/dist/features/migrations/lexicalPluginToLexical/nodes/unknownConvertedNode/index.d.ts.map +1 -1
  290. package/dist/features/migrations/lexicalPluginToLexical/nodes/unknownConvertedNode/index.js.map +1 -1
  291. package/dist/features/migrations/slateToLexical/converter/converters/blockquote/converter.js.map +1 -1
  292. package/dist/features/migrations/slateToLexical/converter/converters/heading/converter.js.map +1 -1
  293. package/dist/features/migrations/slateToLexical/converter/converters/link/converter.js.map +1 -1
  294. package/dist/features/migrations/slateToLexical/converter/converters/listItem/converter.js.map +1 -1
  295. package/dist/features/migrations/slateToLexical/converter/converters/orderedList/converter.js.map +1 -1
  296. package/dist/features/migrations/slateToLexical/converter/converters/unknown/converter.js.map +1 -1
  297. package/dist/features/migrations/slateToLexical/converter/converters/unorderedList/converter.js.map +1 -1
  298. package/dist/features/migrations/slateToLexical/converter/index.d.ts.map +1 -1
  299. package/dist/features/migrations/slateToLexical/converter/index.js +1 -0
  300. package/dist/features/migrations/slateToLexical/converter/index.js.map +1 -1
  301. package/dist/features/migrations/slateToLexical/feature.client.d.ts +1 -4
  302. package/dist/features/migrations/slateToLexical/feature.client.d.ts.map +1 -1
  303. package/dist/features/migrations/slateToLexical/feature.client.js +1 -3
  304. package/dist/features/migrations/slateToLexical/feature.client.js.map +1 -1
  305. package/dist/features/migrations/slateToLexical/nodes/unknownConvertedNode/index.d.ts +1 -1
  306. package/dist/features/migrations/slateToLexical/nodes/unknownConvertedNode/index.d.ts.map +1 -1
  307. package/dist/features/migrations/slateToLexical/nodes/unknownConvertedNode/index.js.map +1 -1
  308. package/dist/features/paragraph/client/index.d.ts +1 -4
  309. package/dist/features/paragraph/client/index.d.ts.map +1 -1
  310. package/dist/features/paragraph/server/index.d.ts +1 -1
  311. package/dist/features/paragraph/server/index.d.ts.map +1 -1
  312. package/dist/features/relationship/client/components/RelationshipComponent.d.ts.map +1 -1
  313. package/dist/features/relationship/client/components/RelationshipComponent.js +34 -24
  314. package/dist/features/relationship/client/components/RelationshipComponent.js.map +1 -1
  315. package/dist/features/relationship/client/drawer/index.d.ts.map +1 -1
  316. package/dist/features/relationship/client/drawer/index.js +27 -26
  317. package/dist/features/relationship/client/drawer/index.js.map +1 -1
  318. package/dist/features/relationship/client/index.d.ts +2 -17
  319. package/dist/features/relationship/client/index.d.ts.map +1 -1
  320. package/dist/features/relationship/client/nodes/RelationshipNode.d.ts +1 -1
  321. package/dist/features/relationship/client/nodes/RelationshipNode.d.ts.map +1 -1
  322. package/dist/features/relationship/client/nodes/RelationshipNode.js.map +1 -1
  323. package/dist/features/relationship/client/plugins/index.js +1 -1
  324. package/dist/features/relationship/client/plugins/index.js.map +1 -1
  325. package/dist/features/relationship/client/utils/EnabledRelationshipsCondition.js +1 -1
  326. package/dist/features/relationship/client/utils/EnabledRelationshipsCondition.js.map +1 -1
  327. package/dist/features/relationship/server/index.d.ts +1 -1
  328. package/dist/features/relationship/server/index.d.ts.map +1 -1
  329. package/dist/features/relationship/server/index.js +50 -40
  330. package/dist/features/relationship/server/index.js.map +1 -1
  331. package/dist/features/relationship/server/nodes/RelationshipNode.d.ts +2 -2
  332. package/dist/features/relationship/server/nodes/RelationshipNode.d.ts.map +1 -1
  333. package/dist/features/relationship/server/nodes/RelationshipNode.js.map +1 -1
  334. package/dist/features/toolbars/fixed/client/Toolbar/index.d.ts.map +1 -1
  335. package/dist/features/toolbars/fixed/client/Toolbar/index.js +93 -66
  336. package/dist/features/toolbars/fixed/client/Toolbar/index.js.map +1 -1
  337. package/dist/features/toolbars/fixed/client/index.d.ts +1 -4
  338. package/dist/features/toolbars/fixed/client/index.d.ts.map +1 -1
  339. package/dist/features/toolbars/inline/client/Toolbar/index.js +135 -97
  340. package/dist/features/toolbars/inline/client/Toolbar/index.js.map +1 -1
  341. package/dist/features/toolbars/inline/client/index.d.ts +1 -4
  342. package/dist/features/toolbars/inline/client/index.d.ts.map +1 -1
  343. package/dist/features/toolbars/shared/ToolbarButton/index.d.ts.map +1 -1
  344. package/dist/features/toolbars/shared/ToolbarButton/index.js +5 -2
  345. package/dist/features/toolbars/shared/ToolbarButton/index.js.map +1 -1
  346. package/dist/features/toolbars/shared/ToolbarDropdown/DropDown.d.ts +5 -4
  347. package/dist/features/toolbars/shared/ToolbarDropdown/DropDown.d.ts.map +1 -1
  348. package/dist/features/toolbars/shared/ToolbarDropdown/DropDown.js +24 -10
  349. package/dist/features/toolbars/shared/ToolbarDropdown/DropDown.js.map +1 -1
  350. package/dist/features/toolbars/shared/ToolbarDropdown/index.d.ts +4 -5
  351. package/dist/features/toolbars/shared/ToolbarDropdown/index.d.ts.map +1 -1
  352. package/dist/features/toolbars/shared/ToolbarDropdown/index.js +127 -127
  353. package/dist/features/toolbars/shared/ToolbarDropdown/index.js.map +1 -1
  354. package/dist/features/toolbars/types.d.ts +23 -11
  355. package/dist/features/toolbars/types.d.ts.map +1 -1
  356. package/dist/features/toolbars/types.js.map +1 -1
  357. package/dist/features/typesClient.d.ts +22 -30
  358. package/dist/features/typesClient.d.ts.map +1 -1
  359. package/dist/features/typesClient.js.map +1 -1
  360. package/dist/features/typesServer.d.ts +23 -28
  361. package/dist/features/typesServer.d.ts.map +1 -1
  362. package/dist/features/typesServer.js.map +1 -1
  363. package/dist/features/upload/client/component/index.d.ts.map +1 -1
  364. package/dist/features/upload/client/component/index.js +66 -58
  365. package/dist/features/upload/client/component/index.js.map +1 -1
  366. package/dist/features/upload/client/drawer/index.d.ts.map +1 -1
  367. package/dist/features/upload/client/drawer/index.js +34 -32
  368. package/dist/features/upload/client/drawer/index.js.map +1 -1
  369. package/dist/features/upload/client/feature.client.d.ts +1 -4
  370. package/dist/features/upload/client/feature.client.d.ts.map +1 -1
  371. package/dist/features/upload/client/nodes/UploadNode.d.ts.map +1 -1
  372. package/dist/features/upload/client/nodes/UploadNode.js +1 -1
  373. package/dist/features/upload/client/nodes/UploadNode.js.map +1 -1
  374. package/dist/features/upload/client/plugin/index.js +1 -1
  375. package/dist/features/upload/client/plugin/index.js.map +1 -1
  376. package/dist/features/upload/server/feature.server.d.ts.map +1 -1
  377. package/dist/features/upload/server/feature.server.js +17 -8
  378. package/dist/features/upload/server/feature.server.js.map +1 -1
  379. package/dist/features/upload/server/validate.d.ts.map +1 -1
  380. package/dist/features/upload/server/validate.js +7 -4
  381. package/dist/features/upload/server/validate.js.map +1 -1
  382. package/dist/field/Field.d.ts.map +1 -1
  383. package/dist/field/Field.js +39 -65
  384. package/dist/field/Field.js.map +1 -1
  385. package/dist/field/bundled.css +1 -1
  386. package/dist/field/index.d.ts.map +1 -1
  387. package/dist/field/index.js +74 -74
  388. package/dist/field/index.js.map +1 -1
  389. package/dist/field/rscEntry.d.ts +9 -0
  390. package/dist/field/rscEntry.d.ts.map +1 -0
  391. package/dist/field/rscEntry.js +56 -0
  392. package/dist/field/rscEntry.js.map +1 -0
  393. package/dist/index.d.ts +8 -4
  394. package/dist/index.d.ts.map +1 -1
  395. package/dist/index.js +101 -105
  396. package/dist/index.js.map +1 -1
  397. package/dist/lexical/EditorPlugin.d.ts.map +1 -1
  398. package/dist/lexical/EditorPlugin.js +2 -1
  399. package/dist/lexical/EditorPlugin.js.map +1 -1
  400. package/dist/lexical/LexicalEditor.d.ts +1 -1
  401. package/dist/lexical/LexicalEditor.d.ts.map +1 -1
  402. package/dist/lexical/LexicalEditor.js +10 -10
  403. package/dist/lexical/LexicalEditor.js.map +1 -1
  404. package/dist/lexical/LexicalProvider.d.ts +2 -2
  405. package/dist/lexical/LexicalProvider.d.ts.map +1 -1
  406. package/dist/lexical/LexicalProvider.js +18 -25
  407. package/dist/lexical/LexicalProvider.js.map +1 -1
  408. package/dist/lexical/config/client/EditorConfigProvider.d.ts +6 -5
  409. package/dist/lexical/config/client/EditorConfigProvider.d.ts.map +1 -1
  410. package/dist/lexical/config/client/EditorConfigProvider.js +14 -13
  411. package/dist/lexical/config/client/EditorConfigProvider.js.map +1 -1
  412. package/dist/lexical/config/client/loader.d.ts +5 -2
  413. package/dist/lexical/config/client/loader.d.ts.map +1 -1
  414. package/dist/lexical/config/client/loader.js +12 -18
  415. package/dist/lexical/config/client/loader.js.map +1 -1
  416. package/dist/lexical/config/client/sanitize.d.ts +1 -1
  417. package/dist/lexical/config/client/sanitize.d.ts.map +1 -1
  418. package/dist/lexical/config/client/sanitize.js +19 -18
  419. package/dist/lexical/config/client/sanitize.js.map +1 -1
  420. package/dist/lexical/config/server/loader.d.ts +2 -1
  421. package/dist/lexical/config/server/loader.d.ts.map +1 -1
  422. package/dist/lexical/config/server/loader.js +2 -0
  423. package/dist/lexical/config/server/loader.js.map +1 -1
  424. package/dist/lexical/config/server/sanitize.d.ts +1 -1
  425. package/dist/lexical/config/server/sanitize.d.ts.map +1 -1
  426. package/dist/lexical/config/server/sanitize.js +27 -13
  427. package/dist/lexical/config/server/sanitize.js.map +1 -1
  428. package/dist/lexical/config/types.d.ts +2 -2
  429. package/dist/lexical/config/types.d.ts.map +1 -1
  430. package/dist/lexical/config/types.js.map +1 -1
  431. package/dist/lexical/nodes/index.d.ts +4 -0
  432. package/dist/lexical/nodes/index.d.ts.map +1 -1
  433. package/dist/lexical/nodes/index.js +8 -1
  434. package/dist/lexical/nodes/index.js.map +1 -1
  435. package/dist/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/LexicalMenu.d.ts +6 -6
  436. package/dist/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/LexicalMenu.d.ts.map +1 -1
  437. package/dist/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/LexicalMenu.js +19 -8
  438. package/dist/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/LexicalMenu.js.map +1 -1
  439. package/dist/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/index.d.ts +2 -2
  440. package/dist/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/index.d.ts.map +1 -1
  441. package/dist/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/index.js +7 -7
  442. package/dist/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/index.js.map +1 -1
  443. package/dist/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/types.d.ts +3 -2
  444. package/dist/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/types.d.ts.map +1 -1
  445. package/dist/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/types.js.map +1 -1
  446. package/dist/lexical/plugins/SlashMenu/index.d.ts.map +1 -1
  447. package/dist/lexical/plugins/SlashMenu/index.js +24 -30
  448. package/dist/lexical/plugins/SlashMenu/index.js.map +1 -1
  449. package/dist/lexical/plugins/handles/AddBlockHandlePlugin/index.d.ts.map +1 -1
  450. package/dist/lexical/plugins/handles/AddBlockHandlePlugin/index.js +11 -9
  451. package/dist/lexical/plugins/handles/AddBlockHandlePlugin/index.js.map +1 -1
  452. package/dist/lexical/plugins/handles/DraggableBlockPlugin/debounce.d.ts +1 -1
  453. package/dist/lexical/plugins/handles/DraggableBlockPlugin/debounce.d.ts.map +1 -1
  454. package/dist/lexical/plugins/handles/DraggableBlockPlugin/debounce.js +1 -1
  455. package/dist/lexical/plugins/handles/DraggableBlockPlugin/debounce.js.map +1 -1
  456. package/dist/lexical/plugins/handles/DraggableBlockPlugin/getBoundingRectWithoutTransform.js +1 -1
  457. package/dist/lexical/plugins/handles/DraggableBlockPlugin/getBoundingRectWithoutTransform.js.map +1 -1
  458. package/dist/lexical/plugins/handles/DraggableBlockPlugin/index.d.ts.map +1 -1
  459. package/dist/lexical/plugins/handles/DraggableBlockPlugin/index.js +15 -8
  460. package/dist/lexical/plugins/handles/DraggableBlockPlugin/index.js.map +1 -1
  461. package/dist/lexical/plugins/handles/DraggableBlockPlugin/setTargetLine.d.ts.map +1 -1
  462. package/dist/lexical/plugins/handles/DraggableBlockPlugin/setTargetLine.js +9 -7
  463. package/dist/lexical/plugins/handles/DraggableBlockPlugin/setTargetLine.js.map +1 -1
  464. package/dist/lexical/plugins/handles/utils/doesLineHeightAffectElement.d.ts.map +1 -1
  465. package/dist/lexical/plugins/handles/utils/doesLineHeightAffectElement.js +3 -1
  466. package/dist/lexical/plugins/handles/utils/doesLineHeightAffectElement.js.map +1 -1
  467. package/dist/lexical/plugins/handles/utils/getNodeCloseToPoint.d.ts.map +1 -1
  468. package/dist/lexical/plugins/handles/utils/getNodeCloseToPoint.js +3 -4
  469. package/dist/lexical/plugins/handles/utils/getNodeCloseToPoint.js.map +1 -1
  470. package/dist/lexical/theme/EditorTheme.d.ts.map +1 -1
  471. package/dist/lexical/theme/EditorTheme.js +1 -2
  472. package/dist/lexical/theme/EditorTheme.js.map +1 -1
  473. package/dist/lexical/utils/nodeFormat.d.ts +2 -2
  474. package/dist/lexical/utils/nodeFormat.d.ts.map +1 -1
  475. package/dist/lexical/utils/nodeFormat.js.map +1 -1
  476. package/dist/lexical/utils/rect.d.ts +4 -4
  477. package/dist/lexical/utils/rect.d.ts.map +1 -1
  478. package/dist/lexical/utils/rect.js.map +1 -1
  479. package/dist/lexical/utils/setFloatingElemPosition.d.ts +1 -1
  480. package/dist/lexical/utils/setFloatingElemPosition.d.ts.map +1 -1
  481. package/dist/lexical/utils/setFloatingElemPosition.js.map +1 -1
  482. package/dist/lexical/utils/url.d.ts +5 -0
  483. package/dist/lexical/utils/url.d.ts.map +1 -1
  484. package/dist/lexical/utils/url.js +25 -5
  485. package/dist/lexical/utils/url.js.map +1 -1
  486. package/dist/lexical-proxy/@lexical-headless.d.ts +2 -0
  487. package/dist/lexical-proxy/@lexical-headless.d.ts.map +1 -0
  488. package/dist/lexical-proxy/@lexical-headless.js +2 -0
  489. package/dist/lexical-proxy/@lexical-headless.js.map +1 -0
  490. package/dist/lexical-proxy/@lexical-link.d.ts +2 -0
  491. package/dist/lexical-proxy/@lexical-link.d.ts.map +1 -0
  492. package/dist/lexical-proxy/@lexical-link.js +2 -0
  493. package/dist/lexical-proxy/@lexical-link.js.map +1 -0
  494. package/dist/lexical-proxy/@lexical-list.d.ts +2 -0
  495. package/dist/lexical-proxy/@lexical-list.d.ts.map +1 -0
  496. package/dist/lexical-proxy/@lexical-list.js +2 -0
  497. package/dist/lexical-proxy/@lexical-list.js.map +1 -0
  498. package/dist/lexical-proxy/@lexical-mark.d.ts +2 -0
  499. package/dist/lexical-proxy/@lexical-mark.d.ts.map +1 -0
  500. package/dist/lexical-proxy/@lexical-mark.js +2 -0
  501. package/dist/lexical-proxy/@lexical-mark.js.map +1 -0
  502. package/dist/lexical-proxy/@lexical-markdown.d.ts +2 -0
  503. package/dist/lexical-proxy/@lexical-markdown.d.ts.map +1 -0
  504. package/dist/lexical-proxy/@lexical-markdown.js +2 -0
  505. package/dist/lexical-proxy/@lexical-markdown.js.map +1 -0
  506. package/dist/lexical-proxy/@lexical-react/LexicalAutoEmbedPlugin.d.ts +2 -0
  507. package/dist/lexical-proxy/@lexical-react/LexicalAutoEmbedPlugin.d.ts.map +1 -0
  508. package/dist/lexical-proxy/@lexical-react/LexicalAutoEmbedPlugin.js +2 -0
  509. package/dist/lexical-proxy/@lexical-react/LexicalAutoEmbedPlugin.js.map +1 -0
  510. package/dist/lexical-proxy/@lexical-react/LexicalAutoFocusPlugin.d.ts +2 -0
  511. package/dist/lexical-proxy/@lexical-react/LexicalAutoFocusPlugin.d.ts.map +1 -0
  512. package/dist/lexical-proxy/@lexical-react/LexicalAutoFocusPlugin.js +2 -0
  513. package/dist/lexical-proxy/@lexical-react/LexicalAutoFocusPlugin.js.map +1 -0
  514. package/dist/lexical-proxy/@lexical-react/LexicalAutoLinkPlugin.d.ts +2 -0
  515. package/dist/lexical-proxy/@lexical-react/LexicalAutoLinkPlugin.d.ts.map +1 -0
  516. package/dist/lexical-proxy/@lexical-react/LexicalAutoLinkPlugin.js +2 -0
  517. package/dist/lexical-proxy/@lexical-react/LexicalAutoLinkPlugin.js.map +1 -0
  518. package/dist/lexical-proxy/@lexical-react/LexicalBlockWithAlignableContents.d.ts +2 -0
  519. package/dist/lexical-proxy/@lexical-react/LexicalBlockWithAlignableContents.d.ts.map +1 -0
  520. package/dist/lexical-proxy/@lexical-react/LexicalBlockWithAlignableContents.js +2 -0
  521. package/dist/lexical-proxy/@lexical-react/LexicalBlockWithAlignableContents.js.map +1 -0
  522. package/dist/lexical-proxy/@lexical-react/LexicalCharacterLimitPlugin.d.ts +2 -0
  523. package/dist/lexical-proxy/@lexical-react/LexicalCharacterLimitPlugin.d.ts.map +1 -0
  524. package/dist/lexical-proxy/@lexical-react/LexicalCharacterLimitPlugin.js +2 -0
  525. package/dist/lexical-proxy/@lexical-react/LexicalCharacterLimitPlugin.js.map +1 -0
  526. package/dist/lexical-proxy/@lexical-react/LexicalCheckListPlugin.d.ts +2 -0
  527. package/dist/lexical-proxy/@lexical-react/LexicalCheckListPlugin.d.ts.map +1 -0
  528. package/dist/lexical-proxy/@lexical-react/LexicalCheckListPlugin.js +2 -0
  529. package/dist/lexical-proxy/@lexical-react/LexicalCheckListPlugin.js.map +1 -0
  530. package/dist/lexical-proxy/@lexical-react/LexicalClearEditorPlugin.d.ts +2 -0
  531. package/dist/lexical-proxy/@lexical-react/LexicalClearEditorPlugin.d.ts.map +1 -0
  532. package/dist/lexical-proxy/@lexical-react/LexicalClearEditorPlugin.js +2 -0
  533. package/dist/lexical-proxy/@lexical-react/LexicalClearEditorPlugin.js.map +1 -0
  534. package/dist/lexical-proxy/@lexical-react/LexicalClickableLinkPlugin.d.ts +2 -0
  535. package/dist/lexical-proxy/@lexical-react/LexicalClickableLinkPlugin.d.ts.map +1 -0
  536. package/dist/lexical-proxy/@lexical-react/LexicalClickableLinkPlugin.js +2 -0
  537. package/dist/lexical-proxy/@lexical-react/LexicalClickableLinkPlugin.js.map +1 -0
  538. package/dist/lexical-proxy/@lexical-react/LexicalCollaborationContext.d.ts +2 -0
  539. package/dist/lexical-proxy/@lexical-react/LexicalCollaborationContext.d.ts.map +1 -0
  540. package/dist/lexical-proxy/@lexical-react/LexicalCollaborationContext.js +2 -0
  541. package/dist/lexical-proxy/@lexical-react/LexicalCollaborationContext.js.map +1 -0
  542. package/dist/lexical-proxy/@lexical-react/LexicalCollaborationPlugin.d.ts +2 -0
  543. package/dist/lexical-proxy/@lexical-react/LexicalCollaborationPlugin.d.ts.map +1 -0
  544. package/dist/lexical-proxy/@lexical-react/LexicalCollaborationPlugin.js +2 -0
  545. package/dist/lexical-proxy/@lexical-react/LexicalCollaborationPlugin.js.map +1 -0
  546. package/dist/lexical-proxy/@lexical-react/LexicalComposer.d.ts +2 -0
  547. package/dist/lexical-proxy/@lexical-react/LexicalComposer.d.ts.map +1 -0
  548. package/dist/lexical-proxy/@lexical-react/LexicalComposer.js +2 -0
  549. package/dist/lexical-proxy/@lexical-react/LexicalComposer.js.map +1 -0
  550. package/dist/lexical-proxy/@lexical-react/LexicalComposerContext.d.ts +2 -0
  551. package/dist/lexical-proxy/@lexical-react/LexicalComposerContext.d.ts.map +1 -0
  552. package/dist/lexical-proxy/@lexical-react/LexicalComposerContext.js +2 -0
  553. package/dist/lexical-proxy/@lexical-react/LexicalComposerContext.js.map +1 -0
  554. package/dist/lexical-proxy/@lexical-react/LexicalContentEditable.d.ts +2 -0
  555. package/dist/lexical-proxy/@lexical-react/LexicalContentEditable.d.ts.map +1 -0
  556. package/dist/lexical-proxy/@lexical-react/LexicalContentEditable.js +2 -0
  557. package/dist/lexical-proxy/@lexical-react/LexicalContentEditable.js.map +1 -0
  558. package/dist/lexical-proxy/@lexical-react/LexicalContextMenuPlugin.d.ts +2 -0
  559. package/dist/lexical-proxy/@lexical-react/LexicalContextMenuPlugin.d.ts.map +1 -0
  560. package/dist/lexical-proxy/@lexical-react/LexicalContextMenuPlugin.js +2 -0
  561. package/dist/lexical-proxy/@lexical-react/LexicalContextMenuPlugin.js.map +1 -0
  562. package/dist/lexical-proxy/@lexical-react/LexicalDecoratorBlockNode.d.ts +2 -0
  563. package/dist/lexical-proxy/@lexical-react/LexicalDecoratorBlockNode.d.ts.map +1 -0
  564. package/dist/lexical-proxy/@lexical-react/LexicalDecoratorBlockNode.js +2 -0
  565. package/dist/lexical-proxy/@lexical-react/LexicalDecoratorBlockNode.js.map +1 -0
  566. package/dist/lexical-proxy/@lexical-react/LexicalDraggableBlockPlugin.d.ts +2 -0
  567. package/dist/lexical-proxy/@lexical-react/LexicalDraggableBlockPlugin.d.ts.map +1 -0
  568. package/dist/lexical-proxy/@lexical-react/LexicalDraggableBlockPlugin.js +2 -0
  569. package/dist/lexical-proxy/@lexical-react/LexicalDraggableBlockPlugin.js.map +1 -0
  570. package/dist/lexical-proxy/@lexical-react/LexicalEditorRefPlugin.d.ts +2 -0
  571. package/dist/lexical-proxy/@lexical-react/LexicalEditorRefPlugin.d.ts.map +1 -0
  572. package/dist/lexical-proxy/@lexical-react/LexicalEditorRefPlugin.js +2 -0
  573. package/dist/lexical-proxy/@lexical-react/LexicalEditorRefPlugin.js.map +1 -0
  574. package/dist/lexical-proxy/@lexical-react/LexicalErrorBoundary.d.ts +2 -0
  575. package/dist/lexical-proxy/@lexical-react/LexicalErrorBoundary.d.ts.map +1 -0
  576. package/dist/lexical-proxy/@lexical-react/LexicalErrorBoundary.js +2 -0
  577. package/dist/lexical-proxy/@lexical-react/LexicalErrorBoundary.js.map +1 -0
  578. package/dist/lexical-proxy/@lexical-react/LexicalHashtagPlugin.d.ts +2 -0
  579. package/dist/lexical-proxy/@lexical-react/LexicalHashtagPlugin.d.ts.map +1 -0
  580. package/dist/lexical-proxy/@lexical-react/LexicalHashtagPlugin.js +2 -0
  581. package/dist/lexical-proxy/@lexical-react/LexicalHashtagPlugin.js.map +1 -0
  582. package/dist/lexical-proxy/@lexical-react/LexicalHistoryPlugin.d.ts +2 -0
  583. package/dist/lexical-proxy/@lexical-react/LexicalHistoryPlugin.d.ts.map +1 -0
  584. package/dist/lexical-proxy/@lexical-react/LexicalHistoryPlugin.js +2 -0
  585. package/dist/lexical-proxy/@lexical-react/LexicalHistoryPlugin.js.map +1 -0
  586. package/dist/lexical-proxy/@lexical-react/LexicalHorizontalRuleNode.d.ts +2 -0
  587. package/dist/lexical-proxy/@lexical-react/LexicalHorizontalRuleNode.d.ts.map +1 -0
  588. package/dist/lexical-proxy/@lexical-react/LexicalHorizontalRuleNode.js +2 -0
  589. package/dist/lexical-proxy/@lexical-react/LexicalHorizontalRuleNode.js.map +1 -0
  590. package/dist/lexical-proxy/@lexical-react/LexicalHorizontalRulePlugin.d.ts +2 -0
  591. package/dist/lexical-proxy/@lexical-react/LexicalHorizontalRulePlugin.d.ts.map +1 -0
  592. package/dist/lexical-proxy/@lexical-react/LexicalHorizontalRulePlugin.js +2 -0
  593. package/dist/lexical-proxy/@lexical-react/LexicalHorizontalRulePlugin.js.map +1 -0
  594. package/dist/lexical-proxy/@lexical-react/LexicalLinkPlugin.d.ts +2 -0
  595. package/dist/lexical-proxy/@lexical-react/LexicalLinkPlugin.d.ts.map +1 -0
  596. package/dist/lexical-proxy/@lexical-react/LexicalLinkPlugin.js +2 -0
  597. package/dist/lexical-proxy/@lexical-react/LexicalLinkPlugin.js.map +1 -0
  598. package/dist/lexical-proxy/@lexical-react/LexicalListPlugin.d.ts +2 -0
  599. package/dist/lexical-proxy/@lexical-react/LexicalListPlugin.d.ts.map +1 -0
  600. package/dist/lexical-proxy/@lexical-react/LexicalListPlugin.js +2 -0
  601. package/dist/lexical-proxy/@lexical-react/LexicalListPlugin.js.map +1 -0
  602. package/dist/lexical-proxy/@lexical-react/LexicalMarkdownShortcutPlugin.d.ts +2 -0
  603. package/dist/lexical-proxy/@lexical-react/LexicalMarkdownShortcutPlugin.d.ts.map +1 -0
  604. package/dist/lexical-proxy/@lexical-react/LexicalMarkdownShortcutPlugin.js +2 -0
  605. package/dist/lexical-proxy/@lexical-react/LexicalMarkdownShortcutPlugin.js.map +1 -0
  606. package/dist/lexical-proxy/@lexical-react/LexicalNestedComposer.d.ts +2 -0
  607. package/dist/lexical-proxy/@lexical-react/LexicalNestedComposer.d.ts.map +1 -0
  608. package/dist/lexical-proxy/@lexical-react/LexicalNestedComposer.js +2 -0
  609. package/dist/lexical-proxy/@lexical-react/LexicalNestedComposer.js.map +1 -0
  610. package/dist/lexical-proxy/@lexical-react/LexicalNodeEventPlugin.d.ts +2 -0
  611. package/dist/lexical-proxy/@lexical-react/LexicalNodeEventPlugin.d.ts.map +1 -0
  612. package/dist/lexical-proxy/@lexical-react/LexicalNodeEventPlugin.js +2 -0
  613. package/dist/lexical-proxy/@lexical-react/LexicalNodeEventPlugin.js.map +1 -0
  614. package/dist/lexical-proxy/@lexical-react/LexicalNodeMenuPlugin.d.ts +2 -0
  615. package/dist/lexical-proxy/@lexical-react/LexicalNodeMenuPlugin.d.ts.map +1 -0
  616. package/dist/lexical-proxy/@lexical-react/LexicalNodeMenuPlugin.js +2 -0
  617. package/dist/lexical-proxy/@lexical-react/LexicalNodeMenuPlugin.js.map +1 -0
  618. package/dist/lexical-proxy/@lexical-react/LexicalOnChangePlugin.d.ts +2 -0
  619. package/dist/lexical-proxy/@lexical-react/LexicalOnChangePlugin.d.ts.map +1 -0
  620. package/dist/lexical-proxy/@lexical-react/LexicalOnChangePlugin.js +2 -0
  621. package/dist/lexical-proxy/@lexical-react/LexicalOnChangePlugin.js.map +1 -0
  622. package/dist/lexical-proxy/@lexical-react/LexicalPlainTextPlugin.d.ts +2 -0
  623. package/dist/lexical-proxy/@lexical-react/LexicalPlainTextPlugin.d.ts.map +1 -0
  624. package/dist/lexical-proxy/@lexical-react/LexicalPlainTextPlugin.js +2 -0
  625. package/dist/lexical-proxy/@lexical-react/LexicalPlainTextPlugin.js.map +1 -0
  626. package/dist/lexical-proxy/@lexical-react/LexicalRichTextPlugin.d.ts +2 -0
  627. package/dist/lexical-proxy/@lexical-react/LexicalRichTextPlugin.d.ts.map +1 -0
  628. package/dist/lexical-proxy/@lexical-react/LexicalRichTextPlugin.js +2 -0
  629. package/dist/lexical-proxy/@lexical-react/LexicalRichTextPlugin.js.map +1 -0
  630. package/dist/lexical-proxy/@lexical-react/LexicalTabIndentationPlugin.d.ts +2 -0
  631. package/dist/lexical-proxy/@lexical-react/LexicalTabIndentationPlugin.d.ts.map +1 -0
  632. package/dist/lexical-proxy/@lexical-react/LexicalTabIndentationPlugin.js +2 -0
  633. package/dist/lexical-proxy/@lexical-react/LexicalTabIndentationPlugin.js.map +1 -0
  634. package/dist/lexical-proxy/@lexical-react/LexicalTableOfContents.d.ts +2 -0
  635. package/dist/lexical-proxy/@lexical-react/LexicalTableOfContents.d.ts.map +1 -0
  636. package/dist/lexical-proxy/@lexical-react/LexicalTableOfContents.js +2 -0
  637. package/dist/lexical-proxy/@lexical-react/LexicalTableOfContents.js.map +1 -0
  638. package/dist/lexical-proxy/@lexical-react/LexicalTableOfContentsPlugin.d.ts +2 -0
  639. package/dist/lexical-proxy/@lexical-react/LexicalTableOfContentsPlugin.d.ts.map +1 -0
  640. package/dist/lexical-proxy/@lexical-react/LexicalTableOfContentsPlugin.js +2 -0
  641. package/dist/lexical-proxy/@lexical-react/LexicalTableOfContentsPlugin.js.map +1 -0
  642. package/dist/lexical-proxy/@lexical-react/LexicalTablePlugin.d.ts +2 -0
  643. package/dist/lexical-proxy/@lexical-react/LexicalTablePlugin.d.ts.map +1 -0
  644. package/dist/lexical-proxy/@lexical-react/LexicalTablePlugin.js +2 -0
  645. package/dist/lexical-proxy/@lexical-react/LexicalTablePlugin.js.map +1 -0
  646. package/dist/lexical-proxy/@lexical-react/LexicalTreeView.d.ts +2 -0
  647. package/dist/lexical-proxy/@lexical-react/LexicalTreeView.d.ts.map +1 -0
  648. package/dist/lexical-proxy/@lexical-react/LexicalTreeView.js +2 -0
  649. package/dist/lexical-proxy/@lexical-react/LexicalTreeView.js.map +1 -0
  650. package/dist/lexical-proxy/@lexical-react/LexicalTypeaheadMenuPlugin.d.ts +2 -0
  651. package/dist/lexical-proxy/@lexical-react/LexicalTypeaheadMenuPlugin.d.ts.map +1 -0
  652. package/dist/lexical-proxy/@lexical-react/LexicalTypeaheadMenuPlugin.js +2 -0
  653. package/dist/lexical-proxy/@lexical-react/LexicalTypeaheadMenuPlugin.js.map +1 -0
  654. package/dist/lexical-proxy/@lexical-react/useLexicalEditable.d.ts +2 -0
  655. package/dist/lexical-proxy/@lexical-react/useLexicalEditable.d.ts.map +1 -0
  656. package/dist/lexical-proxy/@lexical-react/useLexicalEditable.js +2 -0
  657. package/dist/lexical-proxy/@lexical-react/useLexicalEditable.js.map +1 -0
  658. package/dist/lexical-proxy/@lexical-react/useLexicalIsTextContentEmpty.d.ts +2 -0
  659. package/dist/lexical-proxy/@lexical-react/useLexicalIsTextContentEmpty.d.ts.map +1 -0
  660. package/dist/lexical-proxy/@lexical-react/useLexicalIsTextContentEmpty.js +2 -0
  661. package/dist/lexical-proxy/@lexical-react/useLexicalIsTextContentEmpty.js.map +1 -0
  662. package/dist/lexical-proxy/@lexical-react/useLexicalNodeSelection.d.ts +2 -0
  663. package/dist/lexical-proxy/@lexical-react/useLexicalNodeSelection.d.ts.map +1 -0
  664. package/dist/lexical-proxy/@lexical-react/useLexicalNodeSelection.js +2 -0
  665. package/dist/lexical-proxy/@lexical-react/useLexicalNodeSelection.js.map +1 -0
  666. package/dist/lexical-proxy/@lexical-react/useLexicalSubscription.d.ts +2 -0
  667. package/dist/lexical-proxy/@lexical-react/useLexicalSubscription.d.ts.map +1 -0
  668. package/dist/lexical-proxy/@lexical-react/useLexicalSubscription.js +2 -0
  669. package/dist/lexical-proxy/@lexical-react/useLexicalSubscription.js.map +1 -0
  670. package/dist/lexical-proxy/@lexical-react/useLexicalTextEntity.d.ts +2 -0
  671. package/dist/lexical-proxy/@lexical-react/useLexicalTextEntity.d.ts.map +1 -0
  672. package/dist/lexical-proxy/@lexical-react/useLexicalTextEntity.js +2 -0
  673. package/dist/lexical-proxy/@lexical-react/useLexicalTextEntity.js.map +1 -0
  674. package/dist/lexical-proxy/@lexical-rich-text.d.ts +2 -0
  675. package/dist/lexical-proxy/@lexical-rich-text.d.ts.map +1 -0
  676. package/dist/lexical-proxy/@lexical-rich-text.js +2 -0
  677. package/dist/lexical-proxy/@lexical-rich-text.js.map +1 -0
  678. package/dist/lexical-proxy/@lexical-selection.d.ts +2 -0
  679. package/dist/lexical-proxy/@lexical-selection.d.ts.map +1 -0
  680. package/dist/lexical-proxy/@lexical-selection.js +2 -0
  681. package/dist/lexical-proxy/@lexical-selection.js.map +1 -0
  682. package/dist/lexical-proxy/@lexical-utils.d.ts +2 -0
  683. package/dist/lexical-proxy/@lexical-utils.d.ts.map +1 -0
  684. package/dist/lexical-proxy/@lexical-utils.js +2 -0
  685. package/dist/lexical-proxy/@lexical-utils.js.map +1 -0
  686. package/dist/lexical-proxy/lexical.d.ts +2 -0
  687. package/dist/lexical-proxy/lexical.d.ts.map +1 -0
  688. package/dist/lexical-proxy/lexical.js +2 -0
  689. package/dist/lexical-proxy/lexical.js.map +1 -0
  690. package/dist/populateGraphQL/populate.d.ts +3 -2
  691. package/dist/populateGraphQL/populate.d.ts.map +1 -1
  692. package/dist/populateGraphQL/populate.js +3 -1
  693. package/dist/populateGraphQL/populate.js.map +1 -1
  694. package/dist/populateGraphQL/populateLexicalPopulationPromises.d.ts +1 -1
  695. package/dist/populateGraphQL/populateLexicalPopulationPromises.d.ts.map +1 -1
  696. package/dist/populateGraphQL/populateLexicalPopulationPromises.js +5 -4
  697. package/dist/populateGraphQL/populateLexicalPopulationPromises.js.map +1 -1
  698. package/dist/populateGraphQL/recursivelyPopulateFieldsForGraphQL.js.map +1 -1
  699. package/dist/types.d.ts +23 -8
  700. package/dist/types.d.ts.map +1 -1
  701. package/dist/types.js.map +1 -1
  702. package/dist/utilities/buildInitialState.d.ts +27 -0
  703. package/dist/utilities/buildInitialState.d.ts.map +1 -0
  704. package/dist/utilities/buildInitialState.js +53 -0
  705. package/dist/utilities/buildInitialState.js.map +1 -0
  706. package/dist/utilities/createClientFeature.d.ts +8 -5
  707. package/dist/utilities/createClientFeature.d.ts.map +1 -1
  708. package/dist/utilities/createClientFeature.js +7 -4
  709. package/dist/utilities/createClientFeature.js.map +1 -1
  710. package/dist/utilities/createServerFeature.d.ts +1 -0
  711. package/dist/utilities/createServerFeature.d.ts.map +1 -1
  712. package/dist/utilities/createServerFeature.js +2 -0
  713. package/dist/utilities/createServerFeature.js.map +1 -1
  714. package/dist/utilities/fieldsDrawer/Drawer.d.ts +1 -0
  715. package/dist/utilities/fieldsDrawer/Drawer.d.ts.map +1 -1
  716. package/dist/utilities/fieldsDrawer/Drawer.js +68 -27
  717. package/dist/utilities/fieldsDrawer/Drawer.js.map +1 -1
  718. package/dist/utilities/fieldsDrawer/DrawerContent.d.ts.map +1 -1
  719. package/dist/utilities/fieldsDrawer/DrawerContent.js +102 -138
  720. package/dist/utilities/fieldsDrawer/DrawerContent.js.map +1 -1
  721. package/dist/utilities/fieldsDrawer/useLexicalDocumentDrawer.d.ts +13 -0
  722. package/dist/utilities/fieldsDrawer/useLexicalDocumentDrawer.d.ts.map +1 -0
  723. package/dist/utilities/fieldsDrawer/useLexicalDocumentDrawer.js +129 -0
  724. package/dist/utilities/fieldsDrawer/useLexicalDocumentDrawer.js.map +1 -0
  725. package/dist/utilities/fieldsDrawer/useLexicalDrawer.d.ts +10 -0
  726. package/dist/utilities/fieldsDrawer/useLexicalDrawer.d.ts.map +1 -0
  727. package/dist/utilities/fieldsDrawer/useLexicalDrawer.js +136 -0
  728. package/dist/utilities/fieldsDrawer/useLexicalDrawer.js.map +1 -0
  729. package/dist/utilities/fieldsDrawer/useLexicalListDrawer.d.ts +16 -0
  730. package/dist/utilities/fieldsDrawer/useLexicalListDrawer.d.ts.map +1 -0
  731. package/dist/utilities/fieldsDrawer/useLexicalListDrawer.js +144 -0
  732. package/dist/utilities/fieldsDrawer/useLexicalListDrawer.js.map +1 -0
  733. package/dist/utilities/generateImportMap.d.ts.map +1 -1
  734. package/dist/utilities/generateImportMap.js +2 -3
  735. package/dist/utilities/generateImportMap.js.map +1 -1
  736. package/dist/utilities/generateSchemaMap.d.ts.map +1 -1
  737. package/dist/utilities/generateSchemaMap.js +13 -10
  738. package/dist/utilities/generateSchemaMap.js.map +1 -1
  739. package/dist/utilities/initLexicalFeatures.d.ts +18 -0
  740. package/dist/utilities/initLexicalFeatures.d.ts.map +1 -0
  741. package/dist/utilities/initLexicalFeatures.js +96 -0
  742. package/dist/utilities/initLexicalFeatures.js.map +1 -0
  743. package/dist/utilities/jsx/collectTopLevelJSXInLines.d.ts +52 -0
  744. package/dist/utilities/jsx/collectTopLevelJSXInLines.d.ts.map +1 -0
  745. package/dist/utilities/jsx/collectTopLevelJSXInLines.js +79 -0
  746. package/dist/utilities/jsx/collectTopLevelJSXInLines.js.map +1 -0
  747. package/dist/utilities/jsx/extractPropsFromJSXPropsString.d.ts +12 -0
  748. package/dist/utilities/jsx/extractPropsFromJSXPropsString.d.ts.map +1 -0
  749. package/dist/utilities/jsx/extractPropsFromJSXPropsString.js +125 -0
  750. package/dist/utilities/jsx/extractPropsFromJSXPropsString.js.map +1 -0
  751. package/dist/utilities/jsx/jsx.d.ts +26 -0
  752. package/dist/utilities/jsx/jsx.d.ts.map +1 -0
  753. package/dist/utilities/jsx/jsx.js +105 -0
  754. package/dist/utilities/jsx/jsx.js.map +1 -0
  755. package/dist/utilities/jsx/jsx.spec.d.ts +2 -0
  756. package/dist/utilities/jsx/jsx.spec.d.ts.map +1 -0
  757. package/dist/utilities/jsx/jsx.spec.js +142 -0
  758. package/dist/utilities/jsx/jsx.spec.js.map +1 -0
  759. package/dist/utilities/jsx/lexicalMarkdownCopy.d.ts +11 -0
  760. package/dist/utilities/jsx/lexicalMarkdownCopy.d.ts.map +1 -0
  761. package/dist/utilities/jsx/lexicalMarkdownCopy.js +61 -0
  762. package/dist/utilities/jsx/lexicalMarkdownCopy.js.map +1 -0
  763. package/dist/utilities/migrateSlateToLexical/migrateDocumentFieldsRecursively.d.ts +1 -1
  764. package/dist/utilities/migrateSlateToLexical/migrateDocumentFieldsRecursively.d.ts.map +1 -1
  765. package/dist/utilities/migrateSlateToLexical/migrateDocumentFieldsRecursively.js +1 -1
  766. package/dist/utilities/migrateSlateToLexical/migrateDocumentFieldsRecursively.js.map +1 -1
  767. package/dist/utilities/upgradeLexicalData/upgradeDocumentFieldsRecursively.d.ts +1 -1
  768. package/dist/utilities/upgradeLexicalData/upgradeDocumentFieldsRecursively.d.ts.map +1 -1
  769. package/dist/utilities/upgradeLexicalData/upgradeDocumentFieldsRecursively.js +5 -1
  770. package/dist/utilities/upgradeLexicalData/upgradeDocumentFieldsRecursively.js.map +1 -1
  771. package/dist/utilities/useLexicalFeature.d.ts.map +1 -1
  772. package/dist/utilities/useLexicalFeature.js +12 -4
  773. package/dist/utilities/useLexicalFeature.js.map +1 -1
  774. package/dist/validate/index.d.ts.map +1 -1
  775. package/dist/validate/index.js +2 -2
  776. package/dist/validate/index.js.map +1 -1
  777. package/dist/validate/validateNodes.d.ts +2 -2
  778. package/dist/validate/validateNodes.d.ts.map +1 -1
  779. package/dist/validate/validateNodes.js +4 -4
  780. package/dist/validate/validateNodes.js.map +1 -1
  781. package/package.json +332 -46
  782. package/dist/cell/index.d.ts +0 -9
  783. package/dist/cell/index.d.ts.map +0 -1
  784. package/dist/cell/index.js +0 -135
  785. package/dist/cell/index.js.map +0 -1
  786. package/dist/exports/client/Field-SUWHJ4HF.js +0 -2
  787. package/dist/exports/client/Field-SUWHJ4HF.js.map +0 -7
  788. package/dist/exports/client/RelationshipComponent-EZORSGUZ.js +0 -2
  789. package/dist/exports/client/RelationshipComponent-EZORSGUZ.js.map +0 -7
  790. package/dist/exports/client/chunk-OLSILJA6.js +0 -2
  791. package/dist/exports/client/chunk-OLSILJA6.js.map +0 -7
  792. package/dist/exports/client/chunk-TD7O23AB.js +0 -2
  793. package/dist/exports/client/chunk-TD7O23AB.js.map +0 -7
  794. package/dist/exports/client/chunk-YL453UOS.js +0 -2
  795. package/dist/exports/client/chunk-YL453UOS.js.map +0 -7
  796. package/dist/exports/client/chunk-YSI2QILQ.js +0 -2
  797. package/dist/exports/client/chunk-YSI2QILQ.js.map +0 -7
  798. package/dist/exports/client/component-2YLEVOFH.js +0 -2
  799. package/dist/exports/client/component-2YLEVOFH.js.map +0 -7
  800. package/dist/exports/client/component-7RAP75FW.js +0 -2
  801. package/dist/exports/client/component-7RAP75FW.js.map +0 -7
  802. package/dist/exports/client/component-LLWMZU6K.js +0 -2
  803. package/dist/exports/client/component-LLWMZU6K.js.map +0 -7
  804. package/dist/exports/client/componentInline-YSHGRL2J.js +0 -2
  805. package/dist/exports/client/componentInline-YSHGRL2J.js.map +0 -7
  806. package/dist/features/blocks/client/component/FormSavePlugin.d.ts +0 -11
  807. package/dist/features/blocks/client/component/FormSavePlugin.d.ts.map +0 -1
  808. package/dist/features/blocks/client/component/FormSavePlugin.js +0 -53
  809. package/dist/features/blocks/client/component/FormSavePlugin.js.map +0 -1
  810. package/dist/features/createClientComponent.d.ts +0 -7
  811. package/dist/features/createClientComponent.d.ts.map +0 -1
  812. package/dist/features/createClientComponent.js +0 -13
  813. package/dist/features/createClientComponent.js.map +0 -1
  814. package/dist/features/createFeaturePropComponent.d.ts +0 -6
  815. package/dist/features/createFeaturePropComponent.d.ts.map +0 -1
  816. package/dist/features/createFeaturePropComponent.js +0 -19
  817. package/dist/features/createFeaturePropComponent.js.map +0 -1
  818. package/dist/utilities/generateComponentMap.d.ts +0 -6
  819. package/dist/utilities/generateComponentMap.d.ts.map +0 -1
  820. package/dist/utilities/generateComponentMap.js +0 -99
  821. package/dist/utilities/generateComponentMap.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["React","useCallback","useEffect","useRef","baseClass","useLexicalComposerContext","useLexicalNodeSelection","mergeRegister","getTranslation","Button","RenderComponent","useTranslation","$getNodeByKey","$getSelection","$isNodeSelection","CLICK_COMMAND","COMMAND_PRIORITY_LOW","KEY_BACKSPACE_COMMAND","KEY_DELETE_COMMAND","useEditorConfigContext","$isInlineBlockNode","OPEN_INLINE_BLOCK_DRAWER_COMMAND","InlineBlockComponent","props","formData","nodeKey","editor","i18n","t","field","inlineBlockElemElemRef","isSelected","setSelected","clearSelection","richTextComponentMap","componentMapRenderedBlockPath","blocksField","get","clientBlock","blocks","find","block","slug","blockType","removeInlineBlock","update","remove","$onDelete","event","preventDefault","node","onClick","payload","target","current","contains","shiftKey","registerCommand","blockDisplayName","labels","singular","_jsxs","className","filter","Boolean","join","ref","admin","components","Label","_jsx","clientProps","blockKind","mappedComponent","isEditable","buttonStyle","disabled","readOnly","el","icon","dispatchCommand","fields","round","size","tooltip","label","e"],"sources":["../../../../../src/features/blocks/client/componentInline/index.tsx"],"sourcesContent":["'use client'\n\nimport React, { useCallback, useEffect, useRef } from 'react'\nconst baseClass = 'inline-block'\n\nimport type { BlockFieldClient } from 'payload'\n\nimport { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext'\nimport { useLexicalNodeSelection } from '@lexical/react/useLexicalNodeSelection'\nimport { mergeRegister } from '@lexical/utils'\nimport { getTranslation } from '@payloadcms/translations'\nimport { Button, RenderComponent, useTranslation } from '@payloadcms/ui'\nimport {\n $getNodeByKey,\n $getSelection,\n $isNodeSelection,\n CLICK_COMMAND,\n COMMAND_PRIORITY_LOW,\n KEY_BACKSPACE_COMMAND,\n KEY_DELETE_COMMAND,\n} from 'lexical'\n\nimport type { InlineBlockFields } from '../nodes/InlineBlocksNode.js'\n\nimport { useEditorConfigContext } from '../../../../lexical/config/client/EditorConfigProvider.js'\nimport { $isInlineBlockNode } from '../nodes/InlineBlocksNode.js'\nimport { OPEN_INLINE_BLOCK_DRAWER_COMMAND } from '../plugin/commands.js'\nimport './index.scss'\n\ntype Props = {\n readonly formData: InlineBlockFields\n readonly nodeKey?: string\n}\n\nexport const InlineBlockComponent: React.FC<Props> = (props) => {\n const { formData, nodeKey } = props\n const [editor] = useLexicalComposerContext()\n const { i18n, t } = useTranslation<object, string>()\n const { field } = useEditorConfigContext()\n const inlineBlockElemElemRef = useRef<HTMLDivElement | null>(null)\n const [isSelected, setSelected, clearSelection] = useLexicalNodeSelection(nodeKey)\n\n const {\n field: { richTextComponentMap },\n } = useEditorConfigContext()\n\n const componentMapRenderedBlockPath = `lexical_internal_feature.blocks.fields.lexical_inline_blocks`\n const blocksField: BlockFieldClient = richTextComponentMap.get(componentMapRenderedBlockPath)[0]\n const clientBlock = blocksField.blocks.find((block) => block.slug === formData.blockType)\n\n const removeInlineBlock = useCallback(() => {\n editor.update(() => {\n $getNodeByKey(nodeKey).remove()\n })\n }, [editor, nodeKey])\n\n const $onDelete = useCallback(\n (event: KeyboardEvent) => {\n if (isSelected && $isNodeSelection($getSelection())) {\n event.preventDefault()\n const node = $getNodeByKey(nodeKey)\n if ($isInlineBlockNode(node)) {\n node.remove()\n return true\n }\n }\n return false\n },\n [isSelected, nodeKey],\n )\n const onClick = useCallback(\n (payload: MouseEvent) => {\n const event = payload\n // Check if inlineBlockElemElemRef.target or anything WITHIN inlineBlockElemElemRef.target was clicked\n if (\n event.target === inlineBlockElemElemRef.current ||\n inlineBlockElemElemRef.current?.contains(event.target as Node)\n ) {\n if (event.shiftKey) {\n setSelected(!isSelected)\n } else {\n if (!isSelected) {\n clearSelection()\n setSelected(true)\n }\n }\n return true\n }\n\n return false\n },\n [isSelected, setSelected, clearSelection],\n )\n\n useEffect(() => {\n return mergeRegister(\n editor.registerCommand<MouseEvent>(CLICK_COMMAND, onClick, COMMAND_PRIORITY_LOW),\n\n editor.registerCommand(KEY_DELETE_COMMAND, $onDelete, COMMAND_PRIORITY_LOW),\n editor.registerCommand(KEY_BACKSPACE_COMMAND, $onDelete, COMMAND_PRIORITY_LOW),\n )\n }, [clearSelection, editor, isSelected, nodeKey, $onDelete, setSelected, onClick])\n\n const blockDisplayName = clientBlock?.labels?.singular\n ? getTranslation(clientBlock.labels.singular, i18n)\n : clientBlock.slug\n\n return (\n <div\n className={[\n baseClass,\n baseClass + '-' + formData.blockType,\n isSelected && `${baseClass}--selected`,\n ]\n .filter(Boolean)\n .join(' ')}\n ref={inlineBlockElemElemRef}\n >\n {clientBlock?.admin?.components?.Label ? (\n <RenderComponent\n clientProps={{ blockKind: 'lexicalInlineBlock', formData }}\n mappedComponent={clientBlock.admin.components.Label}\n />\n ) : (\n <div>{getTranslation(clientBlock.labels?.singular, i18n)}</div>\n )}\n {editor.isEditable() && (\n <div className={`${baseClass}__actions`}>\n <Button\n buttonStyle=\"icon-label\"\n className={`${baseClass}__editButton`}\n disabled={field?.admin?.readOnly}\n el=\"div\"\n icon=\"edit\"\n onClick={() => {\n editor.dispatchCommand(OPEN_INLINE_BLOCK_DRAWER_COMMAND, {\n fields: formData,\n nodeKey,\n })\n }}\n round\n size=\"small\"\n tooltip={t('lexical:blocks:inlineBlocks:edit', { label: blockDisplayName })}\n />\n <Button\n buttonStyle=\"icon-label\"\n className={`${baseClass}__removeButton`}\n disabled={field?.admin?.readOnly}\n icon=\"x\"\n onClick={(e) => {\n e.preventDefault()\n removeInlineBlock()\n }}\n round\n size=\"small\"\n tooltip={t('lexical:blocks:inlineBlocks:remove', { label: blockDisplayName })}\n />\n </div>\n )}\n </div>\n )\n}\n"],"mappings":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ACCkE,WAAA,EAAY;QACZb,SAAA,EAAW,GAAG1D,SAAA,gBAAyB;QACvCwE,QAAA,EAAU/C,KAAA,EAAOsC,KAAA,EAAOU,QAAA;QACxBE,IAAA,EAAK;QACL5B,OAAA,EAAUmC,CAAA;UACRA,CAAA,CAAErC,cAAc;UAChBL,iBAAA;QACF;QACAsC,KAAK;QACLC,IAAA,EAAK;QACLC,OAAA,EAASxD,CAAA,CAAE,sCAAsC;UAAEyD,KAAA,EAAO3B;QAAiB;;;;AAMvF","ignoreList":[]}
1
+ {"version":3,"file":"index.js","names":["React","createContext","useCallback","useEffect","useMemo","useRef","baseClass","useLexicalComposerContext","useLexicalNodeSelection","mergeRegister","getTranslation","Button","Drawer","EditDepthProvider","Form","formatDrawerSlug","FormSubmit","RenderFields","ShimmerEffect","useDocumentInfo","useEditDepth","useServerFunctions","useTranslation","abortAndIgnore","$getNodeByKey","$getSelection","$isNodeSelection","CLICK_COMMAND","COMMAND_PRIORITY_LOW","KEY_BACKSPACE_COMMAND","KEY_DELETE_COMMAND","reduceFieldsToValues","v4","uuid","useEditorConfigContext","useLexicalDrawer","$isInlineBlockNode","InlineBlockComponentContext","initialState","useInlineBlockComponentContext","useContext","InlineBlockComponent","props","formData","nodeKey","editor","i18n","t","fieldProps","featureClientSchemaMap","initialLexicalFormState","permissions","readOnly","schemaPath","uuidFromContext","getFormState","editDepth","setInitialState","useState","id","formState","drawerSlug","slug","depth","toggleDrawer","inlineBlockElemElemRef","isSelected","setSelected","clearSelection","collectionSlug","getDocPreferences","globalSlug","componentMapRenderedBlockPath","blockType","clientSchemaMap","blocksField","clientBlock","blocks","removeInlineBlock","update","remove","$onDelete","event","deleteSelection","preventDefault","getNodes","forEach","node","onClick","payload","target","current","contains","shiftKey","registerCommand","blockDisplayName","labels","singular","onChangeAbortControllerRef","AbortController","schemaFieldsPath","abortController","awaitInitialState","state","data","docPermissions","fields","docPreferences","operation","renderAllFields","signal","onChange","prevFormState","controller","onFormSubmit","newData","setFields","CustomLabel","customComponents","BlockLabel","CustomBlock","Block","RemoveButton","_jsx","buttonStyle","className","disabled","icon","e","round","size","tooltip","label","EditButton","el","InlineBlockContainer","children","filter","Boolean","join","ref","Label","_jsxs","beforeSubmit","disableValidationOnSubmit","onSubmit","title","_Fragment","forceRender","parentIndexPath","parentPath","parentSchemaPath","Provider","value","height","width","isEditable"],"sources":["../../../../../src/features/blocks/client/componentInline/index.tsx"],"sourcesContent":["'use client'\n\nimport React, { createContext, useCallback, useEffect, useMemo, useRef } from 'react'\nconst baseClass = 'inline-block'\n\nimport type { BlocksFieldClient, FormState } from 'payload'\n\nimport { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext'\nimport { useLexicalNodeSelection } from '@lexical/react/useLexicalNodeSelection'\nimport { mergeRegister } from '@lexical/utils'\nimport { getTranslation } from '@payloadcms/translations'\nimport {\n Button,\n Drawer,\n EditDepthProvider,\n Form,\n formatDrawerSlug,\n FormSubmit,\n RenderFields,\n ShimmerEffect,\n useDocumentInfo,\n useEditDepth,\n useServerFunctions,\n useTranslation,\n} from '@payloadcms/ui'\nimport { abortAndIgnore } from '@payloadcms/ui/shared'\nimport {\n $getNodeByKey,\n $getSelection,\n $isNodeSelection,\n CLICK_COMMAND,\n COMMAND_PRIORITY_LOW,\n KEY_BACKSPACE_COMMAND,\n KEY_DELETE_COMMAND,\n} from 'lexical'\nimport { reduceFieldsToValues } from 'payload/shared'\n\nimport './index.scss'\n\nimport { v4 as uuid } from 'uuid'\n\nimport type { InlineBlockFields } from '../nodes/InlineBlocksNode.js'\n\nimport { useEditorConfigContext } from '../../../../lexical/config/client/EditorConfigProvider.js'\nimport { useLexicalDrawer } from '../../../../utilities/fieldsDrawer/useLexicalDrawer.js'\nimport { $isInlineBlockNode } from '../nodes/InlineBlocksNode.js'\n\ntype Props = {\n readonly formData: InlineBlockFields\n readonly nodeKey: string\n}\n\ntype InlineBlockComponentContextType = {\n EditButton?: React.FC\n initialState: false | FormState | undefined\n InlineBlockContainer?: React.FC<{ children: React.ReactNode }>\n Label?: React.FC\n nodeKey?: string\n RemoveButton?: React.FC\n}\n\nconst InlineBlockComponentContext = createContext<InlineBlockComponentContextType>({\n initialState: false,\n})\n\nexport const useInlineBlockComponentContext = () => React.useContext(InlineBlockComponentContext)\n\nexport const InlineBlockComponent: React.FC<Props> = (props) => {\n const { formData, nodeKey } = props\n const [editor] = useLexicalComposerContext()\n const { i18n, t } = useTranslation<object, string>()\n const {\n fieldProps: {\n featureClientSchemaMap,\n initialLexicalFormState,\n permissions,\n readOnly,\n schemaPath,\n },\n uuid: uuidFromContext,\n } = useEditorConfigContext()\n const { getFormState } = useServerFunctions()\n const editDepth = useEditDepth()\n\n const [initialState, setInitialState] = React.useState<false | FormState | undefined>(\n initialLexicalFormState?.[formData.id]?.formState,\n )\n\n const drawerSlug = formatDrawerSlug({\n slug: `lexical-inlineBlocks-create-` + uuidFromContext,\n depth: editDepth,\n })\n const { toggleDrawer } = useLexicalDrawer(drawerSlug, true)\n\n const inlineBlockElemElemRef = useRef<HTMLDivElement | null>(null)\n const [isSelected, setSelected, clearSelection] = useLexicalNodeSelection(nodeKey)\n const { id, collectionSlug, getDocPreferences, globalSlug } = useDocumentInfo()\n\n const componentMapRenderedBlockPath = `${schemaPath}.lexical_internal_feature.blocks.lexical_inline_blocks.${formData.blockType}`\n\n const clientSchemaMap = featureClientSchemaMap['blocks']\n\n const blocksField: BlocksFieldClient = clientSchemaMap[\n componentMapRenderedBlockPath\n ][0] as BlocksFieldClient\n\n const clientBlock = blocksField.blocks[0]\n\n const removeInlineBlock = useCallback(() => {\n editor.update(() => {\n $getNodeByKey(nodeKey)?.remove()\n })\n }, [editor, nodeKey])\n\n const $onDelete = useCallback(\n (event: KeyboardEvent) => {\n const deleteSelection = $getSelection()\n if (isSelected && $isNodeSelection(deleteSelection)) {\n event.preventDefault()\n editor.update(() => {\n deleteSelection.getNodes().forEach((node) => {\n if ($isInlineBlockNode(node)) {\n node.remove()\n }\n })\n })\n }\n return false\n },\n [editor, isSelected],\n )\n const onClick = useCallback(\n (payload: MouseEvent) => {\n const event = payload\n // Check if inlineBlockElemElemRef.target or anything WITHIN inlineBlockElemElemRef.target was clicked\n if (\n event.target === inlineBlockElemElemRef.current ||\n inlineBlockElemElemRef.current?.contains(event.target as Node)\n ) {\n if (event.shiftKey) {\n setSelected(!isSelected)\n } else {\n if (!isSelected) {\n clearSelection()\n setSelected(true)\n }\n }\n return true\n }\n\n return false\n },\n [isSelected, setSelected, clearSelection],\n )\n\n useEffect(() => {\n return mergeRegister(\n editor.registerCommand<MouseEvent>(CLICK_COMMAND, onClick, COMMAND_PRIORITY_LOW),\n\n editor.registerCommand(KEY_DELETE_COMMAND, $onDelete, COMMAND_PRIORITY_LOW),\n editor.registerCommand(KEY_BACKSPACE_COMMAND, $onDelete, COMMAND_PRIORITY_LOW),\n )\n }, [clearSelection, editor, isSelected, nodeKey, $onDelete, setSelected, onClick])\n\n const blockDisplayName = clientBlock?.labels?.singular\n ? getTranslation(clientBlock.labels.singular, i18n)\n : clientBlock?.slug\n\n const onChangeAbortControllerRef = useRef(new AbortController())\n const schemaFieldsPath = `${schemaPath}.lexical_internal_feature.blocks.lexical_inline_blocks.${clientBlock?.slug}.fields`\n\n // Initial state for newly created blocks\n useEffect(() => {\n const abortController = new AbortController()\n\n const awaitInitialState = async () => {\n /*\n * This will only run if a new block is created. For all existing blocks that are loaded when the document is loaded, or when the form is saved,\n * this is not run, as the lexical field RSC will fetch the state server-side and pass it to the client. That way, we avoid unnecessary client-side\n * requests. Though for newly created blocks, we need to fetch the state client-side, as the server doesn't know about the block yet.\n */\n const { state } = await getFormState({\n id,\n collectionSlug,\n data: formData,\n docPermissions: { fields: true },\n docPreferences: await getDocPreferences(),\n globalSlug,\n operation: 'update',\n renderAllFields: true,\n schemaPath: schemaFieldsPath,\n signal: abortController.signal,\n })\n\n if (state) {\n setInitialState(state)\n }\n }\n\n if (formData && !initialState) {\n void awaitInitialState()\n }\n\n return () => {\n abortAndIgnore(abortController)\n }\n }, [\n getFormState,\n schemaFieldsPath,\n id,\n formData,\n initialState,\n collectionSlug,\n globalSlug,\n getDocPreferences,\n ])\n\n /**\n * HANDLE ONCHANGE\n */\n const onChange = useCallback(\n async ({ formState: prevFormState }) => {\n abortAndIgnore(onChangeAbortControllerRef.current)\n\n const controller = new AbortController()\n onChangeAbortControllerRef.current = controller\n\n const { state } = await getFormState({\n id,\n collectionSlug,\n docPermissions: {\n fields: true,\n },\n docPreferences: await getDocPreferences(),\n formState: prevFormState,\n globalSlug,\n operation: 'update',\n schemaPath: schemaFieldsPath,\n signal: controller.signal,\n })\n\n if (!state) {\n return prevFormState\n }\n\n return state\n },\n [getFormState, id, collectionSlug, getDocPreferences, globalSlug, schemaFieldsPath],\n )\n // cleanup effect\n useEffect(() => {\n return () => {\n abortAndIgnore(onChangeAbortControllerRef.current)\n }\n }, [])\n\n /**\n * HANDLE FORM SUBMIT\n */\n const onFormSubmit = useCallback(\n (formState) => {\n const newData: any = reduceFieldsToValues(formState)\n newData.blockType = formData.blockType\n editor.update(() => {\n const node = $getNodeByKey(nodeKey)\n if (node && $isInlineBlockNode(node)) {\n node.setFields(newData)\n }\n })\n },\n [editor, nodeKey, formData],\n )\n\n const CustomLabel = initialState?.['_components']?.customComponents?.BlockLabel\n const CustomBlock = initialState?.['_components']?.customComponents?.Block\n\n const RemoveButton = useMemo(\n () => () => (\n <Button\n buttonStyle=\"icon-label\"\n className={`${baseClass}__removeButton`}\n disabled={readOnly}\n icon=\"x\"\n onClick={(e) => {\n e.preventDefault()\n removeInlineBlock()\n }}\n round\n size=\"small\"\n tooltip={t('lexical:blocks:inlineBlocks:remove', { label: blockDisplayName })}\n />\n ),\n [blockDisplayName, readOnly, removeInlineBlock, t],\n )\n\n const EditButton = useMemo(\n () => () => (\n <Button\n buttonStyle=\"icon-label\"\n className={`${baseClass}__editButton`}\n disabled={readOnly}\n el=\"div\"\n icon=\"edit\"\n onClick={() => {\n toggleDrawer()\n }}\n round\n size=\"small\"\n tooltip={t('lexical:blocks:inlineBlocks:edit', { label: blockDisplayName })}\n />\n ),\n [blockDisplayName, readOnly, t, toggleDrawer],\n )\n\n const InlineBlockContainer = useMemo(\n () =>\n ({ children }) => (\n <div\n className={[\n baseClass,\n baseClass + '-' + formData.blockType,\n isSelected && `${baseClass}--selected`,\n ]\n .filter(Boolean)\n .join(' ')}\n ref={inlineBlockElemElemRef}\n >\n {children}\n </div>\n ),\n [formData.blockType, isSelected],\n )\n\n const Label = useMemo(() => {\n if (CustomLabel) {\n return () => CustomLabel\n } else {\n return () => <div>{getTranslation(clientBlock.labels!.singular, i18n)}</div>\n }\n }, [CustomLabel, clientBlock.labels, i18n])\n\n return (\n <Form\n beforeSubmit={[onChange]}\n disableValidationOnSubmit\n fields={clientBlock.fields}\n initialState={initialState || {}}\n onChange={[onChange]}\n onSubmit={(formState) => {\n onFormSubmit(formState)\n toggleDrawer()\n }}\n uuid={uuid()}\n >\n <EditDepthProvider>\n <Drawer\n className={''}\n slug={drawerSlug}\n title={t(`lexical:blocks:inlineBlocks:${formData?.id ? 'edit' : 'create'}`, {\n label: blockDisplayName ?? t('lexical:blocks:inlineBlocks:label'),\n })}\n >\n {initialState ? (\n <>\n <RenderFields\n fields={clientBlock.fields}\n forceRender\n parentIndexPath=\"\"\n parentPath=\"\" // See Blocks feature path for details as for why this is empty\n parentSchemaPath={schemaFieldsPath}\n permissions={permissions}\n readOnly={false}\n />\n <FormSubmit>{t('fields:saveChanges')}</FormSubmit>\n </>\n ) : null}\n </Drawer>\n </EditDepthProvider>\n {CustomBlock ? (\n <InlineBlockComponentContext.Provider\n value={{\n EditButton,\n initialState,\n InlineBlockContainer,\n Label,\n nodeKey,\n RemoveButton,\n }}\n >\n {CustomBlock}\n </InlineBlockComponentContext.Provider>\n ) : (\n <InlineBlockContainer>\n {initialState ? <Label /> : <ShimmerEffect height=\"15px\" width=\"40px\" />}\n {editor.isEditable() ? (\n <div className={`${baseClass}__actions`}>\n <EditButton />\n <Remo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wI,MAAA,EAAO;QAAOC,KAAA,EAAM;UAC9D9G,MAAA,CAAO+G,UAAU,kBAChBd,KAAA,CAAC;QAAIjB,SAAA,EAAW,GAAGvH,SAAA,WAAoB;gCACrCqH,IAAA,CAACU,UAAA,O,aACDV,IAAA,CAACD,YAAA;WAED;;;AAKd","ignoreList":[]}
@@ -1,9 +1,2 @@
1
- export type BlocksFeatureClientProps = {
2
- clientBlockSlugs: string[];
3
- clientInlineBlockSlugs: string[];
4
- };
5
- export declare const BlocksFeatureClient: import("react").FC<{
6
- featureKey: string;
7
- order: number;
8
- } & BlocksFeatureClientProps>;
1
+ export declare const BlocksFeatureClient: import("../../typesClient.js").FeatureProviderProviderClient<undefined, any>;
9
2
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/features/blocks/client/index.tsx"],"names":[],"mappings":"AAiBA,MAAM,MAAM,wBAAwB,GAAG;IACrC,gBAAgB,EAAE,MAAM,EAAE,CAAA;IAC1B,sBAAsB,EAAE,MAAM,EAAE,CAAA;CACjC,CAAA;AAED,eAAO,MAAM,mBAAmB;;;6BA0K7B,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/features/blocks/client/index.tsx"],"names":[],"mappings":"AAoBA,eAAO,MAAM,mBAAmB,8EAmK/B,CAAA"}
@@ -6,154 +6,147 @@ import { InlineBlocksIcon } from '../../../lexical/ui/icons/InlineBlocks/index.j
6
6
  import { createClientFeature } from '../../../utilities/createClientFeature.js';
7
7
  import { BlockNode } from './nodes/BlocksNode.js';
8
8
  import { InlineBlockNode } from './nodes/InlineBlocksNode.js';
9
- import { INSERT_BLOCK_COMMAND, OPEN_INLINE_BLOCK_DRAWER_COMMAND } from './plugin/commands.js';
9
+ import { INSERT_BLOCK_COMMAND, INSERT_INLINE_BLOCK_COMMAND } from './plugin/commands.js';
10
10
  import { BlocksPlugin } from './plugin/index.js';
11
11
  export const BlocksFeatureClient = createClientFeature(({
12
- props
13
- }) => ({
14
- nodes: [BlockNode, InlineBlockNode],
15
- plugins: [{
16
- Component: BlocksPlugin,
17
- position: 'normal'
18
- }],
19
- sanitizedClientFeatureProps: props,
20
- slashMenu: {
21
- groups: [props.clientBlockSlugs?.length ? {
22
- items: props.clientBlockSlugs.map(blockSlug => {
23
- return {
24
- Icon: BlockIcon,
25
- key: 'block-' + blockSlug,
26
- keywords: ['block', 'blocks', blockSlug],
27
- label: ({
28
- i18n,
29
- richTextComponentMap
30
- }) => {
31
- const componentMapRenderedBlockPath = `lexical_internal_feature.blocks.fields.lexical_blocks`;
32
- const blocksField = richTextComponentMap.get(componentMapRenderedBlockPath)[0];
33
- const clientBlock = blocksField.blocks.find(_block => _block.slug === blockSlug);
34
- const blockDisplayName = clientBlock.labels.singular ? getTranslation(clientBlock.labels.singular, i18n) : clientBlock.slug;
35
- return blockDisplayName;
36
- },
37
- onSelect: ({
38
- editor
39
- }) => {
40
- editor.dispatchCommand(INSERT_BLOCK_COMMAND, {
41
- id: null,
42
- blockName: '',
43
- blockType: blockSlug
44
- });
45
- }
46
- };
47
- }),
48
- key: 'blocks',
49
- label: ({
50
- i18n
51
- }) => {
52
- return i18n.t('lexical:blocks:label');
53
- }
54
- } : null, props.clientInlineBlockSlugs?.length ? {
55
- items: props.clientInlineBlockSlugs.map(inlineBlockSlug => {
56
- return {
57
- Icon: InlineBlocksIcon,
58
- key: 'inlineBlocks-' + inlineBlockSlug,
59
- keywords: ['inlineBlock', 'inline block', inlineBlockSlug],
60
- label: ({
61
- i18n,
62
- richTextComponentMap
63
- }) => {
64
- const componentMapRenderedBlockPath = `lexical_internal_feature.blocks.fields.lexical_inline_blocks`;
65
- const blocksField = richTextComponentMap.get(componentMapRenderedBlockPath)[0];
66
- const clientBlock = blocksField.blocks.find(_block => _block.slug === inlineBlockSlug);
67
- const blockDisplayName = clientBlock.labels.singular ? getTranslation(clientBlock.labels.singular, i18n) : clientBlock.slug;
68
- return blockDisplayName;
69
- },
70
- onSelect: ({
71
- editor
72
- }) => {
73
- editor.dispatchCommand(OPEN_INLINE_BLOCK_DRAWER_COMMAND, {
74
- fields: {
75
- id: null,
12
+ featureClientSchemaMap,
13
+ props,
14
+ schemaPath
15
+ }) => {
16
+ const schemaMapRenderedBlockPathPrefix = `${schemaPath}.lexical_internal_feature.blocks.lexical_blocks`;
17
+ const schemaMapRenderedInlineBlockPathPrefix = `${schemaPath}.lexical_internal_feature.blocks.lexical_inline_blocks`;
18
+ const clientSchema = featureClientSchemaMap['blocks'];
19
+ const blocksFields = Object.entries(clientSchema).filter(([key]) => key.startsWith(schemaMapRenderedBlockPathPrefix + '.') && !key.replace(schemaMapRenderedBlockPathPrefix + '.', '').includes('.')).map(([key, value]) => value[0]);
20
+ const inlineBlocksFields = Object.entries(clientSchema).filter(([key]) => key.startsWith(schemaMapRenderedInlineBlockPathPrefix + '.') && !key.replace(schemaMapRenderedInlineBlockPathPrefix + '.', '').includes('.')).map(([key, value]) => value[0]);
21
+ const clientBlocks = blocksFields.map(field => {
22
+ return field.blocks[0];
23
+ });
24
+ const clientInlineBlocks = inlineBlocksFields.map(field => {
25
+ return field.blocks[0];
26
+ });
27
+ return {
28
+ nodes: [BlockNode, InlineBlockNode],
29
+ plugins: [{
30
+ Component: BlocksPlugin,
31
+ position: 'normal'
32
+ }],
33
+ sanitizedClientFeatureProps: props,
34
+ slashMenu: {
35
+ groups: [clientBlocks?.length ? {
36
+ items: clientBlocks.map(block => {
37
+ return {
38
+ Icon: BlockIcon,
39
+ key: 'block-' + block.slug,
40
+ keywords: ['block', 'blocks', block.slug],
41
+ label: ({
42
+ i18n
43
+ }) => {
44
+ const blockDisplayName = block?.labels?.singular ? getTranslation(block.labels.singular, i18n) : block?.slug;
45
+ return blockDisplayName;
46
+ },
47
+ onSelect: ({
48
+ editor
49
+ }) => {
50
+ editor.dispatchCommand(INSERT_BLOCK_COMMAND, {
76
51
  blockName: '',
77
- blockType: inlineBlockSlug
78
- }
79
- });
80
- }
81
- };
82
- }),
83
- key: 'inlineBlocks',
84
- label: ({
85
- i18n
86
- }) => {
87
- return i18n.t('lexical:blocks:inlineBlocks:label');
88
- }
89
- } : null].filter(Boolean)
90
- },
91
- toolbarFixed: {
92
- groups: [props.clientBlockSlugs?.length ? {
93
- type: 'dropdown',
94
- ChildComponent: BlockIcon,
95
- items: props.clientBlockSlugs.map((blockSlug, index) => {
96
- return {
97
- ChildComponent: BlockIcon,
98
- isActive: undefined,
99
- key: 'block-' + blockSlug,
100
- label: ({
101
- i18n,
102
- richTextComponentMap
103
- }) => {
104
- const componentMapRenderedBlockPath = `lexical_internal_feature.blocks.fields.lexical_blocks`;
105
- const blocksField = richTextComponentMap.get(componentMapRenderedBlockPath)[0];
106
- const clientBlock = blocksField.blocks.find(_block => _block.slug === blockSlug);
107
- const blockDisplayName = clientBlock.labels.singular ? getTranslation(clientBlock.labels.singular, i18n) : clientBlock.slug;
108
- return blockDisplayName;
109
- },
110
- onSelect: ({
111
- editor
112
- }) => {
113
- editor.dispatchCommand(INSERT_BLOCK_COMMAND, {
114
- id: null,
115
- blockName: '',
116
- blockType: blockSlug
117
- });
118
- },
119
- order: index
120
- };
121
- }),
122
- key: 'blocks',
123
- order: 20
124
- } : null, props.clientInlineBlockSlugs?.length ? {
125
- type: 'dropdown',
126
- ChildComponent: InlineBlocksIcon,
127
- items: props.clientInlineBlockSlugs.map((inlineBlockSlug, index) => {
128
- return {
129
- ChildComponent: InlineBlocksIcon,
130
- isActive: undefined,
131
- key: 'inlineBlock-' + inlineBlockSlug,
132
- label: ({
133
- i18n,
134
- richTextComponentMap
135
- }) => {
136
- const componentMapRenderedBlockPath = `lexical_internal_feature.blocks.fields.lexical_inline_blocks`;
137
- const blocksField = richTextComponentMap.get(componentMapRenderedBlockPath)[0];
138
- const clientBlock = blocksField.blocks.find(_block => _block.slug === inlineBlockSlug);
139
- const blockDisplayName = clientBlock.labels.singular ? getTranslation(clientBlock.labels.singular, i18n) : clientBlock.slug;
140
- return blockDisplayName;
141
- },
142
- onSelect: ({
143
- editor
144
- }) => {
145
- editor.dispatchCommand(OPEN_INLINE_BLOCK_DRAWER_COMMAND, {
146
- fields: {
147
- blockType: inlineBlockSlug
148
- }
149
- });
150
- },
151
- order: index
152
- };
153
- }),
154
- key: 'inlineBlocks',
155
- order: 25
156
- } : null].filter(Boolean)
157
- }
158
- }));
52
+ blockType: block.slug
53
+ });
54
+ }
55
+ };
56
+ }),
57
+ key: 'blocks',
58
+ label: ({
59
+ i18n
60
+ }) => {
61
+ return i18n.t('lexical:blocks:label');
62
+ }
63
+ } : null, clientInlineBlocks?.length ? {
64
+ items: clientInlineBlocks.map(inlineBlock => {
65
+ return {
66
+ Icon: InlineBlocksIcon,
67
+ key: 'inlineBlocks-' + inlineBlock.slug,
68
+ keywords: ['inlineBlock', 'inline block', inlineBlock.slug],
69
+ label: ({
70
+ i18n
71
+ }) => {
72
+ const blockDisplayName = inlineBlock?.labels?.singular ? getTranslation(inlineBlock.labels.singular, i18n) : inlineBlock?.slug;
73
+ return blockDisplayName;
74
+ },
75
+ onSelect: ({
76
+ editor
77
+ }) => {
78
+ editor.dispatchCommand(INSERT_INLINE_BLOCK_COMMAND, {
79
+ blockName: '',
80
+ blockType: inlineBlock.slug
81
+ });
82
+ }
83
+ };
84
+ }),
85
+ key: 'inlineBlocks',
86
+ label: ({
87
+ i18n
88
+ }) => {
89
+ return i18n.t('lexical:blocks:inlineBlocks:label');
90
+ }
91
+ } : null].filter(Boolean)
92
+ },
93
+ toolbarFixed: {
94
+ groups: [clientBlocks.length ? {
95
+ type: 'dropdown',
96
+ ChildComponent: BlockIcon,
97
+ items: clientBlocks.map((block, index) => {
98
+ return {
99
+ ChildComponent: BlockIcon,
100
+ isActive: undefined,
101
+ key: 'block-' + block.slug,
102
+ label: ({
103
+ i18n
104
+ }) => {
105
+ const blockDisplayName = block?.labels?.singular ? getTranslation(block.labels.singular, i18n) : block?.slug;
106
+ return blockDisplayName;
107
+ },
108
+ onSelect: ({
109
+ editor
110
+ }) => {
111
+ editor.dispatchCommand(INSERT_BLOCK_COMMAND, {
112
+ blockName: '',
113
+ blockType: block.slug
114
+ });
115
+ },
116
+ order: index
117
+ };
118
+ }),
119
+ key: 'blocks',
120
+ order: 20
121
+ } : null, clientInlineBlocks?.length ? {
122
+ type: 'dropdown',
123
+ ChildComponent: InlineBlocksIcon,
124
+ items: clientInlineBlocks.map((inlineBlock, index) => {
125
+ return {
126
+ ChildComponent: InlineBlocksIcon,
127
+ isActive: undefined,
128
+ key: 'inlineBlock-' + inlineBlock.slug,
129
+ label: ({
130
+ i18n
131
+ }) => {
132
+ const blockDisplayName = inlineBlock?.labels?.singular ? getTranslation(inlineBlock.labels.singular, i18n) : inlineBlock?.slug;
133
+ return blockDisplayName;
134
+ },
135
+ onSelect: ({
136
+ editor
137
+ }) => {
138
+ editor.dispatchCommand(INSERT_INLINE_BLOCK_COMMAND, {
139
+ blockName: '',
140
+ blockType: inlineBlock.slug
141
+ });
142
+ },
143
+ order: index
144
+ };
145
+ }),
146
+ key: 'inlineBlocks',
147
+ order: 25
148
+ } : null].filter(Boolean)
149
+ }
150
+ };
151
+ });
159
152
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["getTranslation","BlockIcon","InlineBlocksIcon","createClientFeature","BlockNode","InlineBlockNode","INSERT_BLOCK_COMMAND","OPEN_INLINE_BLOCK_DRAWER_COMMAND","BlocksPlugin","BlocksFeatureClient","props","nodes","plugins","Component","position","sanitizedClientFeatureProps","slashMenu","groups","clientBlockSlugs","length","items","map","blockSlug","Icon","key","keywords","label","i18n","richTextComponentMap","componentMapRenderedBlockPath","blocksField","get","clientBlock","blocks","find","_block","slug","blockDisplayName","labels","singular","onSelect","editor","dispatchCommand","id","blockName","blockType","t","clientInlineBlockSlugs","inlineBlockSlug","fields","filter","Boolean","toolbarFixed","type","ChildComponent","index","isActive","undefined","order"],"sources":["../../../../src/features/blocks/client/index.tsx"],"sourcesContent":["'use client'\n\nimport type { BlockFieldClient } from 'payload'\n\nimport { getTranslation } from '@payloadcms/translations'\n\nimport type { SlashMenuItem } from '../../../lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/types.js'\nimport type { ToolbarGroup, ToolbarGroupItem } from '../../toolbars/types.js'\n\nimport { BlockIcon } from '../../../lexical/ui/icons/Block/index.js'\nimport { InlineBlocksIcon } from '../../../lexical/ui/icons/InlineBlocks/index.js'\nimport { createClientFeature } from '../../../utilities/createClientFeature.js'\nimport { BlockNode } from './nodes/BlocksNode.js'\nimport { InlineBlockNode } from './nodes/InlineBlocksNode.js'\nimport { INSERT_BLOCK_COMMAND, OPEN_INLINE_BLOCK_DRAWER_COMMAND } from './plugin/commands.js'\nimport { BlocksPlugin } from './plugin/index.js'\n\nexport type BlocksFeatureClientProps = {\n clientBlockSlugs: string[]\n clientInlineBlockSlugs: string[]\n}\n\nexport const BlocksFeatureClient = createClientFeature<BlocksFeatureClientProps>(({ props }) => ({\n nodes: [BlockNode, InlineBlockNode],\n plugins: [\n {\n Component: BlocksPlugin,\n position: 'normal',\n },\n ],\n sanitizedClientFeatureProps: props,\n slashMenu: {\n groups: [\n props.clientBlockSlugs?.length\n ? {\n items: props.clientBlockSlugs.map((blockSlug) => {\n return {\n Icon: BlockIcon,\n key: 'block-' + blockSlug,\n keywords: ['block', 'blocks', blockSlug],\n label: ({ i18n, richTextComponentMap }) => {\n const componentMapRenderedBlockPath = `lexical_internal_feature.blocks.fields.lexical_blocks`\n const blocksField: BlockFieldClient = richTextComponentMap.get(\n componentMapRenderedBlockPath,\n )[0]\n\n const clientBlock = blocksField.blocks.find((_block) => _block.slug === blockSlug)\n\n const blockDisplayName = clientBlock.labels.singular\n ? getTranslation(clientBlock.labels.singular, i18n)\n : clientBlock.slug\n\n return blockDisplayName\n },\n onSelect: ({ editor }) => {\n editor.dispatchCommand(INSERT_BLOCK_COMMAND, {\n id: null,\n blockName: '',\n blockType: blockSlug,\n })\n },\n } as SlashMenuItem\n }),\n key: 'blocks',\n label: ({ i18n }) => {\n return i18n.t('lexical:blocks:label')\n },\n }\n : null,\n props.clientInlineBlockSlugs?.length\n ? {\n items: props.clientInlineBlockSlugs.map((inlineBlockSlug) => {\n return {\n Icon: InlineBlocksIcon,\n key: 'inlineBlocks-' + inlineBlockSlug,\n keywords: ['inlineBlock', 'inline block', inlineBlockSlug],\n label: ({ i18n, richTextComponentMap }) => {\n const componentMapRenderedBlockPath = `lexical_internal_feature.blocks.fields.lexical_inline_blocks`\n\n const blocksField: BlockFieldClient = richTextComponentMap.get(\n componentMapRenderedBlockPath,\n )[0]\n\n const clientBlock = blocksField.blocks.find(\n (_block) => _block.slug === inlineBlockSlug,\n )\n\n const blockDisplayName = clientBlock.labels.singular\n ? getTranslation(clientBlock.labels.singular, i18n)\n : clientBlock.slug\n\n return blockDisplayName\n },\n onSelect: ({ editor }) => {\n editor.dispatchCommand(OPEN_INLINE_BLOCK_DRAWER_COMMAND, {\n fields: {\n id: null,\n blockName: '',\n blockType: inlineBlockSlug,\n },\n })\n },\n } as SlashMenuItem\n }),\n key: 'inlineBlocks',\n label: ({ i18n }) => {\n return i18n.t('lexical:blocks:inlineBlocks:label')\n },\n }\n : null,\n ].filter(Boolean),\n },\n toolbarFixed: {\n groups: [\n props.clientBlockSlugs?.length\n ? {\n type: 'dropdown',\n ChildComponent: BlockIcon,\n items: props.clientBlockSlugs.map((blockSlug, 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-' + blockSlug,\n label: ({ i18n, richTextComponentMap }) => {\n const componentMapRenderedBlockPath = `lexical_internal_feature.blocks.fields.lexical_blocks`\n const blocksField: BlockFieldClient = richTextComponentMap.get(\n componentMapRenderedBlockPath,\n )[0]\n\n const clientBlock = blocksField.blocks.find((_block) => _block.slug === blockSlug)\n\n const blockDisplayName = clientBlock.labels.singular\n ? getTranslation(clientBlock.labels.singular, i18n)\n : clientBlock.slug\n\n return blockDisplayName\n },\n onSelect: ({ editor }) => {\n editor.dispatchCommand(INSERT_BLOCK_COMMAND, {\n id: null,\n blockName: '',\n blockType: blockSlug,\n })\n },\n order: index,\n } as ToolbarGroupItem\n }),\n key: 'blocks',\n order: 20,\n }\n : null,\n props.clientInlineBlockSlugs?.length\n ? {\n type: 'dropdown',\n ChildComponent: InlineBlocksIcon,\n items: props.clientInlineBlockSlugs.map((inlineBlockSlug, index) => {\n return {\n ChildComponent: InlineBlocksIcon,\n isActive: undefined,\n key: 'inlineBlock-' + inlineBlockSlug,\n label: ({ i18n, richTextComponentMap }) => {\n const componentMapRenderedBlockPath = `lexical_internal_feature.blocks.fields.lexical_inline_blocks`\n const blocksField: BlockFieldClient = richTextComponentMap.get(\n componentMapRenderedBlockPath,\n )[0]\n\n const clientBlock = blocksField.blocks.find(\n (_block) => _block.slug === inlineBlockSlug,\n )\n\n const blockDisplayName = clientBlock.labels.singular\n ? getTranslation(clientBlock.labels.singular, i18n)\n : clientBlock.slug\n\n return blockDisplayName\n },\n onSelect: ({ editor }) => {\n editor.dispatchCommand(OPEN_INLINE_BLOCK_DRAWER_COMMAND, {\n fields: {\n blockType: inlineBlockSlug,\n },\n })\n },\n order: index,\n } as ToolbarGroupItem\n }),\n key: 'inlineBlocks',\n order: 25,\n }\n : null,\n ].filter(Boolean) as ToolbarGroup[],\n },\n}))\n"],"mappings":"AAAA;;AAIA,SAASA,cAAc,QAAQ;AAK/B,SAASC,SAAS,QAAQ;AAC1B,SAASC,gBAAgB,QAAQ;AACjC,SAASC,mBAAmB,QAAQ;AACpC,SAASC,SAAS,QAAQ;AAC1B,SAASC,eAAe,QAAQ;AAChC,SAASC,oBAAoB,EAAEC,gCAAgC,QAAQ;AACvE,SAASC,YAAY,QAAQ;AAO7B,OAAO,MAAMC,mBAAA,GAAsBN,mBAAA,CAA8C,CAAC;EAAEO;AAAK,CAAE,MAAM;EAC/FC,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AAgC,8DAA8D;YACpG,MAAMC,WAAA,GAAgCF,oBAAA,CAAqBG,GAAG,CAC5DF,6BAAA,CACD,CAAC,EAAE;YAEJ,MAAMG,WAAA,GAAcF,WAAA,CAAYG,MAAM,CAACC,IAAI,CACxCC,MAAA,IAAWA,MAAA,CAAOC,IAAI,KAAKY,eAAA;YAG9B,MAAMX,gBAAA,GAAmBL,WAAA,CAAYM,MAAM,CAACC,QAAQ,GAChDvC,cAAA,CAAegC,WAAA,CAAYM,MAAM,CAACC,QAAQ,EAAEZ,IAAA,IAC5CK,WAAA,CAAYI,IAAI;YAEpB,OAAOC,gBAAA;UACT;UACAG,QAAA,EAAUA,CAAC;YAAEC;UAAM,CAAE;YACnBA,MAAA,CAAOC,eAAe,CAACnC,gCAAA,EAAkC;cACvD0C,MAAA,EAAQ;gBACNJ,SAAA,EAAWG;cACb;YACF;UACF;UACAU,KAAA,EAAOH;QACT;MACF;MACA/B,GAAA,EAAK;MACLkC,KAAA,EAAO;IACT,IACA,KACL,CAACR,MAAM,CAACC,OAAA;EACX;AACF","ignoreList":[]}
1
+ {"version":3,"file":"index.js","names":["getTranslation","BlockIcon","InlineBlocksIcon","createClientFeature","BlockNode","InlineBlockNode","INSERT_BLOCK_COMMAND","INSERT_INLINE_BLOCK_COMMAND","BlocksPlugin","BlocksFeatureClient","featureClientSchemaMap","props","schemaPath","schemaMapRenderedBlockPathPrefix","schemaMapRenderedInlineBlockPathPrefix","clientSchema","blocksFields","Object","entries","filter","key","startsWith","replace","includes","map","value","inlineBlocksFields","clientBlocks","field","blocks","clientInlineBlocks","nodes","plugins","Component","position","sanitizedClientFeatureProps","slashMenu","groups","length","items","block","Icon","slug","keywords","label","i18n","blockDisplayName","labels","singular","onSelect","editor","dispatchCommand","blockName","blockType","t","inlineBlock","Boolean","toolbarFixed","type","ChildComponent","index","isActive","undefined","order"],"sources":["../../../../src/features/blocks/client/index.tsx"],"sourcesContent":["'use client'\n\nimport type { BlocksFieldClient, ClientBlock } from 'payload'\n\nimport { getTranslation } from '@payloadcms/translations'\n\nimport type {\n SlashMenuGroup,\n SlashMenuItem,\n} from '../../../lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/types.js'\nimport type { ToolbarGroup, ToolbarGroupItem } from '../../toolbars/types.js'\n\nimport { BlockIcon } from '../../../lexical/ui/icons/Block/index.js'\nimport { InlineBlocksIcon } from '../../../lexical/ui/icons/InlineBlocks/index.js'\nimport { createClientFeature } from '../../../utilities/createClientFeature.js'\nimport { BlockNode } from './nodes/BlocksNode.js'\nimport { InlineBlockNode } from './nodes/InlineBlocksNode.js'\nimport { INSERT_BLOCK_COMMAND, INSERT_INLINE_BLOCK_COMMAND } from './plugin/commands.js'\nimport { BlocksPlugin } from './plugin/index.js'\n\nexport const BlocksFeatureClient = createClientFeature(\n ({ featureClientSchemaMap, props, schemaPath }) => {\n const schemaMapRenderedBlockPathPrefix = `${schemaPath}.lexical_internal_feature.blocks.lexical_blocks`\n const schemaMapRenderedInlineBlockPathPrefix = `${schemaPath}.lexical_internal_feature.blocks.lexical_inline_blocks`\n const clientSchema = featureClientSchemaMap['blocks']\n\n const blocksFields: BlocksFieldClient[] = Object.entries(clientSchema)\n .filter(\n ([key]) =>\n key.startsWith(schemaMapRenderedBlockPathPrefix + '.') &&\n !key.replace(schemaMapRenderedBlockPathPrefix + '.', '').includes('.'),\n )\n .map(([key, value]) => value[0] as BlocksFieldClient)\n\n const inlineBlocksFields: BlocksFieldClient[] = Object.entries(clientSchema)\n .filter(\n ([key]) =>\n key.startsWith(schemaMapRenderedInlineBlockPathPrefix + '.') &&\n !key.replace(schemaMapRenderedInlineBlockPathPrefix + '.', '').includes('.'),\n )\n .map(([key, value]) => value[0] as BlocksFieldClient)\n\n const clientBlocks: ClientBlock[] = blocksFields.map((field) => {\n return field.blocks[0]\n })\n\n const clientInlineBlocks: ClientBlock[] = inlineBlocksFields.map((field) => {\n return field.blocks[0]\n })\n\n return {\n nodes: [BlockNode, InlineBlockNode],\n plugins: [\n {\n Component: BlocksPlugin,\n position: 'normal',\n },\n ],\n sanitizedClientFeatureProps: props,\n slashMenu: {\n groups: [\n clientBlocks?.length\n ? {\n items: clientBlocks.map((block) => {\n return {\n Icon: BlockIcon,\n key: 'block-' + block.slug,\n keywords: ['block', 'blocks', block.slug],\n label: ({ i18n }) => {\n const blockDisplayName = block?.labels?.singular\n ? getTranslation(block.labels.singular, i18n)\n : block?.slug\n\n return blockDisplayName\n },\n onSelect: ({ editor }) => {\n editor.dispatchCommand(INSERT_BLOCK_COMMAND, {\n blockName: '',\n blockType: block.slug,\n })\n },\n } as SlashMenuItem\n }),\n key: 'blocks',\n label: ({ i18n }) => {\n return i18n.t('lexical:blocks:label')\n },\n }\n : null,\n clientInlineBlocks?.length\n ? {\n items: clientInlineBlocks.map((inlineBlock) => {\n return {\n Icon: InlineBlocksIcon,\n key: 'inlineBlocks-' + inlineBlock.slug,\n keywords: ['inlineBlock', 'inline block', inlineBlock.slug],\n label: ({ i18n }) => {\n const blockDisplayName = inlineBlock?.labels?.singular\n ? getTranslation(inlineBlock.labels.singular, i18n)\n : inlineBlock?.slug\n\n return blockDisplayName\n },\n onSelect: ({ editor }) => {\n editor.dispatchCommand(INSERT_INLINE_BLOCK_COMMAND, {\n blockName: '',\n blockType: inlineBlock.slug,\n })\n },\n } as SlashMenuItem\n }),\n key: 'inlineBlocks',\n label: ({ i18n }) => {\n return i18n.t('lexical:blocks:inlineBlocks:label')\n },\n }\n : null,\n ].filter(Boolean) as SlashMenuGroup[],\n },\n toolbarFixed: {\n groups: [\n clientBlocks.length\n ? {\n type: 'dropdown',\n ChildComponent: BlockIcon,\n items: clientBlocks.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 const blockDisplayName = block?.labels?.singular\n ? getTranslation(block.labels.singular, i18n)\n : block?.slug\n\n return blockDisplayName\n },\n onSelect: ({ editor }) => {\n editor.dispatchCommand(INSERT_BLOCK_COMMAND, {\n blockName: '',\n blockType: block.slug,\n })\n },\n order: index,\n } as ToolbarGroupItem\n }),\n key: 'blocks',\n order: 20,\n }\n : null,\n clientInlineBlocks?.length\n ? {\n type: 'dropdown',\n ChildComponent: InlineBlocksIcon,\n items: clientInlineBlocks.map((inlineBlock, index) => {\n return {\n ChildComponent: InlineBlocksIcon,\n isActive: undefined,\n key: 'inlineBlock-' + inlineBlock.slug,\n label: ({ i18n }) => {\n const blockDisplayName = inlineBlock?.labels?.singular\n ? getTranslation(inlineBlock.labels.singular, i18n)\n : inlineBlock?.slug\n\n return blockDisplayName\n },\n onSelect: ({ editor }) => {\n editor.dispatchCommand(INSERT_INLINE_BLOCK_COMMAND, {\n blockName: '',\n blockType: inlineBlock.slug,\n })\n },\n order: index,\n } as ToolbarGroupItem\n }),\n key: 'inlineBlocks',\n order: 25,\n }\n : null,\n ].filter(Boolean) as ToolbarGroup[],\n },\n }\n },\n)\n"],"mappings":"AAAA;;AAIA,SAASA,cAAc,QAAQ;AAQ/B,SAASC,SAAS,QAAQ;AAC1B,SAASC,gBAAgB,QAAQ;AACjC,SAASC,mBAAmB,QAAQ;AACpC,SAASC,SAAS,QAAQ;AAC1B,SAASC,eAAe,QAAQ;AAChC,SAASC,oBAAoB,EAAEC,2BAA2B,QAAQ;AAClE,SAASC,YAAY,QAAQ;AAE7B,OAAO,MAAMC,mBAAA,GAAsBN,mBAAA,CACjC,CAAC;EAAEO,sBAAsB;EAAEC,KAAK;EAAEC;AAAU,CAAE;EAC5C,MAAMC,gCAAA,GAAmC,GAAGD,UAAA,iDAA2D;EACvG,MAAME,sCAAA,GAAyC,GAAGF,UAAA,wDAAkE;EACpH,MAAMG,YAAA,GAAeL,sBAAsB,CAAC,SAAS;EAErD,MAAMM,YAAA,GAAoCC,MAAA,CAAOC,OAAO,CAACH,YAAA,EACtDI,MAAM,CACL,CAAC,C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CAAeuD,WAAA,CAAYR,MAAM,CAACC,QAAQ,EAAEH,IAAA,IAC5CU,WAAA,EAAab,IAAA;cAEjB,OAAOI,gBAAA;YACT;YACAG,QAAA,EAAUA,CAAC;cAAEC;YAAM,CAAE;cACnBA,MAAA,CAAOC,eAAe,CAAC5C,2BAAA,EAA6B;gBAClD6C,SAAA,EAAW;gBACXC,SAAA,EAAWE,WAAA,CAAYb;cACzB;YACF;YACAqB,KAAA,EAAOH;UACT;QACF;QACAxC,GAAA,EAAK;QACL2C,KAAA,EAAO;MACT,IACA,KACL,CAAC5C,MAAM,CAACqC,OAAA;IACX;EACF;AACF","ignoreList":[]}
@@ -0,0 +1,16 @@
1
+ import type { MultilineElementTransformer, Transformer } from '@lexical/markdown';
2
+ import type { Klass, LexicalNode, LexicalNodeReplacement, SerializedEditorState } from 'lexical';
3
+ import type { ClientBlock } from 'payload';
4
+ export declare const getBlockMarkdownTransformers: ({ blocks, }: {
5
+ blocks: ClientBlock[];
6
+ }) => ((props: {
7
+ allNodes: Array<Klass<LexicalNode> | LexicalNodeReplacement>;
8
+ allTransformers: Transformer[];
9
+ }) => MultilineElementTransformer)[];
10
+ export declare function getMarkdownToLexical(allNodes: Array<Klass<LexicalNode> | LexicalNodeReplacement>, allTransformers: Transformer[]): (args: {
11
+ markdown: string;
12
+ }) => SerializedEditorState;
13
+ export declare function getLexicalToMarkdown(allNodes: Array<Klass<LexicalNode> | LexicalNodeReplacement>, allTransformers: Transformer[]): (args: {
14
+ editorState: Record<string, any>;
15
+ }) => string;
16
+ //# sourceMappingURL=markdownTransformer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"markdownTransformer.d.ts","sourceRoot":"","sources":["../../../../src/features/blocks/client/markdownTransformer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,2BAA2B,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAA;AACjF,OAAO,KAAK,EAAE,KAAK,EAAE,WAAW,EAAE,sBAAsB,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAA;AAChG,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAA;AAgB1C,eAAO,MAAM,4BAA4B,gBAEtC;IACD,MAAM,EAAE,WAAW,EAAE,CAAA;CACtB,KAAG,CAAC,CAAC,KAAK,EAAE;IACX,QAAQ,EAAE,KAAK,CAAC,KAAK,CAAC,WAAW,CAAC,GAAG,sBAAsB,CAAC,CAAA;IAC5D,eAAe,EAAE,WAAW,EAAE,CAAA;CAC/B,KAAK,2BAA2B,CAAC,EAqGjC,CAAA;AAED,wBAAgB,oBAAoB,CAClC,QAAQ,EAAE,KAAK,CAAC,KAAK,CAAC,WAAW,CAAC,GAAG,sBAAsB,CAAC,EAC5D,eAAe,EAAE,WAAW,EAAE,GAC7B,CAAC,IAAI,EAAE;IAAE,QAAQ,EAAE,MAAM,CAAA;CAAE,KAAK,qBAAqB,CAkBvD;AAED,wBAAgB,oBAAoB,CAClC,QAAQ,EAAE,KAAK,CAAC,KAAK,CAAC,WAAW,CAAC,GAAG,sBAAsB,CAAC,EAC5D,eAAe,EAAE,WAAW,EAAE,GAC7B,CAAC,IAAI,EAAE;IAAE,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;CAAE,KAAK,MAAM,CAoBxD"}
@@ -0,0 +1,144 @@
1
+ import { createHeadlessEditor } from '@lexical/headless';
2
+ import { $convertFromMarkdownString, $convertToMarkdownString } from '@lexical/markdown';
3
+ import { extractPropsFromJSXPropsString } from '../../../utilities/jsx/extractPropsFromJSXPropsString.js';
4
+ import { propsToJSXString } from '../../../utilities/jsx/jsx.js';
5
+ import { $createBlockNode, $isBlockNode, BlockNode } from './nodes/BlocksNode.js';
6
+ function createTagRegexes(tagName) {
7
+ const escapedTagName = tagName.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
8
+ return {
9
+ regExpEnd: new RegExp(`</(${escapedTagName})\\s*>|<${escapedTagName}[^>]*?/>`, 'i'),
10
+ regExpStart: new RegExp(`<(${escapedTagName})([^>]*?)\\s*(/?)>`, 'i')
11
+ };
12
+ }
13
+ export const getBlockMarkdownTransformers = ({
14
+ blocks
15
+ }) => {
16
+ if (!blocks?.length) {
17
+ return [];
18
+ }
19
+ const transformers = [];
20
+ for (const block of blocks) {
21
+ if (!block.jsx) {
22
+ continue;
23
+ }
24
+ const regex = createTagRegexes(block.slug);
25
+ transformers.push(({
26
+ allNodes,
27
+ allTransformers
28
+ }) => ({
29
+ type: 'multiline-element',
30
+ dependencies: [BlockNode],
31
+ export: node => {
32
+ if (!$isBlockNode(node)) {
33
+ return null;
34
+ }
35
+ if (node.getFields()?.blockType?.toLowerCase() !== block.slug.toLowerCase()) {
36
+ return null;
37
+ }
38
+ const nodeFields = node.getFields();
39
+ const lexicalToMarkdown = getLexicalToMarkdown(allNodes, allTransformers);
40
+ const exportResult = block.jsx.export({
41
+ fields: nodeFields,
42
+ lexicalToMarkdown
43
+ });
44
+ if (exportResult === false) {
45
+ return null;
46
+ }
47
+ if (typeof exportResult === 'string') {
48
+ return exportResult;
49
+ }
50
+ if (exportResult?.children?.length) {
51
+ return `<${nodeFields.blockType}${exportResult.props ? ' ' + propsToJSXString({
52
+ props: exportResult.props
53
+ }) : ''}>\n ${exportResult.children}\n</${nodeFields.blockType}>`;
54
+ }
55
+ return `<${nodeFields.blockType}${exportResult.props ? ' ' + propsToJSXString({
56
+ props: exportResult.props
57
+ }) : ''}/>`;
58
+ },
59
+ regExpEnd: block.jsx?.customEndRegex ?? regex.regExpEnd,
60
+ regExpStart: block.jsx?.customStartRegex ?? regex.regExpStart,
61
+ replace: (rootNode, children, openMatch, closeMatch, linesInBetween) => {
62
+ if (block?.jsx?.import) {
63
+ if (!linesInBetween) {
64
+ // convert children to linesInBetween
65
+ let line = '';
66
+ if (children) {
67
+ for (const child of children) {
68
+ line += child.getTextContent();
69
+ }
70
+ }
71
+ linesInBetween = [line];
72
+ }
73
+ const childrenString = linesInBetween.join('\n').trim();
74
+ const propsString = openMatch?.length > 2 ? openMatch[2]?.trim() : null;
75
+ const markdownToLexical = getMarkdownToLexical(allNodes, allTransformers);
76
+ const blockFields = block.jsx.import({
77
+ children: childrenString,
78
+ closeMatch: closeMatch,
79
+ htmlToLexical: null,
80
+ markdownToLexical,
81
+ openMatch: openMatch,
82
+ props: propsString ? extractPropsFromJSXPropsString({
83
+ propsString
84
+ }) : {}
85
+ });
86
+ if (blockFields === false) {
87
+ return false;
88
+ }
89
+ const node = $createBlockNode({
90
+ blockType: block.slug,
91
+ ...blockFields,
92
+ blockName: blockFields.blockName || ''
93
+ });
94
+ if (node) {
95
+ rootNode.append(node);
96
+ }
97
+ return;
98
+ }
99
+ return false // Run next transformer
100
+ ;
101
+ }
102
+ }));
103
+ }
104
+ return transformers;
105
+ };
106
+ export function getMarkdownToLexical(allNodes, allTransformers) {
107
+ const markdownToLexical = ({
108
+ markdown
109
+ }) => {
110
+ const headlessEditor = createHeadlessEditor({
111
+ nodes: allNodes
112
+ });
113
+ headlessEditor.update(() => {
114
+ $convertFromMarkdownString(markdown, allTransformers);
115
+ }, {
116
+ discrete: true
117
+ });
118
+ const editorJSON = headlessEditor.getEditorState().toJSON();
119
+ return editorJSON;
120
+ };
121
+ return markdownToLexical;
122
+ }
123
+ export function getLexicalToMarkdown(allNodes, allTransformers) {
124
+ const lexicalToMarkdown = ({
125
+ editorState
126
+ }) => {
127
+ const headlessEditor = createHeadlessEditor({
128
+ nodes: allNodes
129
+ });
130
+ try {
131
+ headlessEditor.setEditorState(headlessEditor.parseEditorState(editorState)) // This should commit the editor state immediately
132
+ ;
133
+ } catch (e) {
134
+ console.error('getLexicalToMarkdown: ERROR parsing editor state', e);
135
+ }
136
+ let markdown = '';
137
+ headlessEditor.getEditorState().read(() => {
138
+ markdown = $convertToMarkdownString(allTransformers);
139
+ });
140
+ return markdown;
141
+ };
142
+ return lexicalToMarkdown;
143
+ }
144
+ //# sourceMappingURL=markdownTransformer.js.map