@payloadcms/richtext-lexical 3.84.1 → 4.0.0-internal.d28e9fb

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 (331) hide show
  1. package/dist/exports/client/{Field-4UEGQMIN.js → Field-NXLXFFLW.js} +2 -2
  2. package/dist/exports/client/Field-NXLXFFLW.js.map +7 -0
  3. package/dist/exports/client/bundled.css +1 -1
  4. package/dist/exports/client/chunk-DZDHVMML.js +2 -0
  5. package/dist/exports/client/chunk-DZDHVMML.js.map +7 -0
  6. package/dist/exports/client/componentInline-LCHKRXOV.js +2 -0
  7. package/dist/exports/client/index.d.ts +0 -2
  8. package/dist/exports/client/index.d.ts.map +1 -1
  9. package/dist/exports/client/index.js +32 -32
  10. package/dist/exports/client/index.js.map +4 -4
  11. package/dist/features/blocks/client/component/index.d.ts.map +1 -1
  12. package/dist/features/blocks/client/component/index.js +17 -2
  13. package/dist/features/blocks/client/component/index.js.map +1 -1
  14. package/dist/features/blocks/client/componentInline/index.d.ts.map +1 -1
  15. package/dist/features/blocks/client/componentInline/index.js +13 -3
  16. package/dist/features/blocks/client/componentInline/index.js.map +1 -1
  17. package/dist/field/Field.d.ts.map +1 -1
  18. package/dist/field/Field.js +1 -1
  19. package/dist/field/Field.js.map +1 -1
  20. package/dist/field/bundled.css +1 -1
  21. package/dist/index.d.ts +0 -1
  22. package/dist/index.d.ts.map +1 -1
  23. package/dist/index.js +11 -2
  24. package/dist/index.js.map +1 -1
  25. package/dist/lexical/config/server/loader.d.ts.map +1 -1
  26. package/dist/lexical/config/server/loader.js +12 -9
  27. package/dist/lexical/config/server/loader.js.map +1 -1
  28. package/dist/lexical/ui/icons/Add/index.d.ts +4 -1
  29. package/dist/lexical/ui/icons/Add/index.d.ts.map +1 -1
  30. package/dist/lexical/ui/icons/Add/index.js +19 -12
  31. package/dist/lexical/ui/icons/Add/index.js.map +1 -1
  32. package/dist/lexical/ui/icons/Add/index.svg +2 -3
  33. package/dist/lexical/ui/icons/Add/light.svg +2 -3
  34. package/dist/lexical/ui/icons/AlignCenter/index.d.ts +3 -1
  35. package/dist/lexical/ui/icons/AlignCenter/index.d.ts.map +1 -1
  36. package/dist/lexical/ui/icons/AlignCenter/index.js +15 -19
  37. package/dist/lexical/ui/icons/AlignCenter/index.js.map +1 -1
  38. package/dist/lexical/ui/icons/AlignJustify/index.d.ts +3 -1
  39. package/dist/lexical/ui/icons/AlignJustify/index.d.ts.map +1 -1
  40. package/dist/lexical/ui/icons/AlignJustify/index.js +15 -19
  41. package/dist/lexical/ui/icons/AlignJustify/index.js.map +1 -1
  42. package/dist/lexical/ui/icons/AlignLeft/index.d.ts +3 -1
  43. package/dist/lexical/ui/icons/AlignLeft/index.d.ts.map +1 -1
  44. package/dist/lexical/ui/icons/AlignLeft/index.js +15 -19
  45. package/dist/lexical/ui/icons/AlignLeft/index.js.map +1 -1
  46. package/dist/lexical/ui/icons/AlignRight/index.d.ts +3 -1
  47. package/dist/lexical/ui/icons/AlignRight/index.d.ts.map +1 -1
  48. package/dist/lexical/ui/icons/AlignRight/index.js +15 -19
  49. package/dist/lexical/ui/icons/AlignRight/index.js.map +1 -1
  50. package/dist/lexical/ui/icons/Block/index.d.ts +3 -1
  51. package/dist/lexical/ui/icons/Block/index.d.ts.map +1 -1
  52. package/dist/lexical/ui/icons/Block/index.js +13 -28
  53. package/dist/lexical/ui/icons/Block/index.js.map +1 -1
  54. package/dist/lexical/ui/icons/Blockquote/index.d.ts +3 -1
  55. package/dist/lexical/ui/icons/Blockquote/index.d.ts.map +1 -1
  56. package/dist/lexical/ui/icons/Blockquote/index.js +9 -6
  57. package/dist/lexical/ui/icons/Blockquote/index.js.map +1 -1
  58. package/dist/lexical/ui/icons/Bold/index.d.ts +3 -1
  59. package/dist/lexical/ui/icons/Bold/index.d.ts.map +1 -1
  60. package/dist/lexical/ui/icons/Bold/index.js +13 -8
  61. package/dist/lexical/ui/icons/Bold/index.js.map +1 -1
  62. package/dist/lexical/ui/icons/Checklist/index.d.ts +4 -1
  63. package/dist/lexical/ui/icons/Checklist/index.d.ts.map +1 -1
  64. package/dist/lexical/ui/icons/Checklist/index.js +17 -18
  65. package/dist/lexical/ui/icons/Checklist/index.js.map +1 -1
  66. package/dist/lexical/ui/icons/Code/index.d.ts +3 -1
  67. package/dist/lexical/ui/icons/Code/index.d.ts.map +1 -1
  68. package/dist/lexical/ui/icons/Code/index.js +15 -13
  69. package/dist/lexical/ui/icons/Code/index.js.map +1 -1
  70. package/dist/lexical/ui/icons/CodeBlock/index.d.ts +4 -1
  71. package/dist/lexical/ui/icons/CodeBlock/index.d.ts.map +1 -1
  72. package/dist/lexical/ui/icons/CodeBlock/index.js +18 -7
  73. package/dist/lexical/ui/icons/CodeBlock/index.js.map +1 -1
  74. package/dist/lexical/ui/icons/Collapse/index.d.ts +3 -1
  75. package/dist/lexical/ui/icons/Collapse/index.d.ts.map +1 -1
  76. package/dist/lexical/ui/icons/Collapse/index.js +10 -8
  77. package/dist/lexical/ui/icons/Collapse/index.js.map +1 -1
  78. package/dist/lexical/ui/icons/DraggableBlock/index.svg +7 -7
  79. package/dist/lexical/ui/icons/DraggableBlock/light.svg +7 -7
  80. package/dist/lexical/ui/icons/Expand/index.d.ts +5 -0
  81. package/dist/lexical/ui/icons/Expand/index.d.ts.map +1 -0
  82. package/dist/lexical/ui/icons/Expand/index.js +22 -0
  83. package/dist/lexical/ui/icons/Expand/index.js.map +1 -0
  84. package/dist/lexical/ui/icons/H1/index.d.ts +3 -1
  85. package/dist/lexical/ui/icons/H1/index.d.ts.map +1 -1
  86. package/dist/lexical/ui/icons/H1/index.js +9 -6
  87. package/dist/lexical/ui/icons/H1/index.js.map +1 -1
  88. package/dist/lexical/ui/icons/H2/index.d.ts +3 -1
  89. package/dist/lexical/ui/icons/H2/index.d.ts.map +1 -1
  90. package/dist/lexical/ui/icons/H2/index.js +9 -6
  91. package/dist/lexical/ui/icons/H2/index.js.map +1 -1
  92. package/dist/lexical/ui/icons/H3/index.d.ts +3 -1
  93. package/dist/lexical/ui/icons/H3/index.d.ts.map +1 -1
  94. package/dist/lexical/ui/icons/H3/index.js +9 -6
  95. package/dist/lexical/ui/icons/H3/index.js.map +1 -1
  96. package/dist/lexical/ui/icons/H4/index.d.ts +3 -1
  97. package/dist/lexical/ui/icons/H4/index.d.ts.map +1 -1
  98. package/dist/lexical/ui/icons/H4/index.js +9 -6
  99. package/dist/lexical/ui/icons/H4/index.js.map +1 -1
  100. package/dist/lexical/ui/icons/H5/index.d.ts +3 -1
  101. package/dist/lexical/ui/icons/H5/index.d.ts.map +1 -1
  102. package/dist/lexical/ui/icons/H5/index.js +9 -6
  103. package/dist/lexical/ui/icons/H5/index.js.map +1 -1
  104. package/dist/lexical/ui/icons/H6/index.d.ts +3 -1
  105. package/dist/lexical/ui/icons/H6/index.d.ts.map +1 -1
  106. package/dist/lexical/ui/icons/H6/index.js +9 -6
  107. package/dist/lexical/ui/icons/H6/index.js.map +1 -1
  108. package/dist/lexical/ui/icons/HorizontalRule/index.d.ts +3 -1
  109. package/dist/lexical/ui/icons/HorizontalRule/index.d.ts.map +1 -1
  110. package/dist/lexical/ui/icons/HorizontalRule/index.js +11 -11
  111. package/dist/lexical/ui/icons/HorizontalRule/index.js.map +1 -1
  112. package/dist/lexical/ui/icons/IndentDecrease/index.d.ts +3 -1
  113. package/dist/lexical/ui/icons/IndentDecrease/index.d.ts.map +1 -1
  114. package/dist/lexical/ui/icons/IndentDecrease/index.js +18 -22
  115. package/dist/lexical/ui/icons/IndentDecrease/index.js.map +1 -1
  116. package/dist/lexical/ui/icons/IndentIncrease/index.d.ts +3 -1
  117. package/dist/lexical/ui/icons/IndentIncrease/index.d.ts.map +1 -1
  118. package/dist/lexical/ui/icons/IndentIncrease/index.js +15 -22
  119. package/dist/lexical/ui/icons/IndentIncrease/index.js.map +1 -1
  120. package/dist/lexical/ui/icons/InlineBlocks/index.d.ts +3 -1
  121. package/dist/lexical/ui/icons/InlineBlocks/index.d.ts.map +1 -1
  122. package/dist/lexical/ui/icons/InlineBlocks/index.js +9 -6
  123. package/dist/lexical/ui/icons/InlineBlocks/index.js.map +1 -1
  124. package/dist/lexical/ui/icons/Italic/index.d.ts +3 -1
  125. package/dist/lexical/ui/icons/Italic/index.d.ts.map +1 -1
  126. package/dist/lexical/ui/icons/Italic/index.js +13 -8
  127. package/dist/lexical/ui/icons/Italic/index.js.map +1 -1
  128. package/dist/lexical/ui/icons/Link/index.d.ts +4 -1
  129. package/dist/lexical/ui/icons/Link/index.d.ts.map +1 -1
  130. package/dist/lexical/ui/icons/Link/index.js +14 -9
  131. package/dist/lexical/ui/icons/Link/index.js.map +1 -1
  132. package/dist/lexical/ui/icons/Meatballs/index.d.ts +4 -1
  133. package/dist/lexical/ui/icons/Meatballs/index.d.ts.map +1 -1
  134. package/dist/lexical/ui/icons/Meatballs/index.js +19 -15
  135. package/dist/lexical/ui/icons/Meatballs/index.js.map +1 -1
  136. package/dist/lexical/ui/icons/OrderedList/index.d.ts +4 -1
  137. package/dist/lexical/ui/icons/OrderedList/index.d.ts.map +1 -1
  138. package/dist/lexical/ui/icons/OrderedList/index.js +19 -25
  139. package/dist/lexical/ui/icons/OrderedList/index.js.map +1 -1
  140. package/dist/lexical/ui/icons/Relationship/index.d.ts +3 -1
  141. package/dist/lexical/ui/icons/Relationship/index.d.ts.map +1 -1
  142. package/dist/lexical/ui/icons/Relationship/index.js +13 -25
  143. package/dist/lexical/ui/icons/Relationship/index.js.map +1 -1
  144. package/dist/lexical/ui/icons/Strikethrough/index.d.ts +3 -1
  145. package/dist/lexical/ui/icons/Strikethrough/index.d.ts.map +1 -1
  146. package/dist/lexical/ui/icons/Strikethrough/index.js +13 -13
  147. package/dist/lexical/ui/icons/Strikethrough/index.js.map +1 -1
  148. package/dist/lexical/ui/icons/Subscript/index.d.ts +3 -1
  149. package/dist/lexical/ui/icons/Subscript/index.d.ts.map +1 -1
  150. package/dist/lexical/ui/icons/Subscript/index.js +10 -7
  151. package/dist/lexical/ui/icons/Subscript/index.js.map +1 -1
  152. package/dist/lexical/ui/icons/Superscript/index.d.ts +3 -1
  153. package/dist/lexical/ui/icons/Superscript/index.d.ts.map +1 -1
  154. package/dist/lexical/ui/icons/Superscript/index.js +10 -7
  155. package/dist/lexical/ui/icons/Superscript/index.js.map +1 -1
  156. package/dist/lexical/ui/icons/Table/index.d.ts +4 -1
  157. package/dist/lexical/ui/icons/Table/index.d.ts.map +1 -1
  158. package/dist/lexical/ui/icons/Table/index.js +20 -15
  159. package/dist/lexical/ui/icons/Table/index.js.map +1 -1
  160. package/dist/lexical/ui/icons/Text/index.d.ts +4 -1
  161. package/dist/lexical/ui/icons/Text/index.d.ts.map +1 -1
  162. package/dist/lexical/ui/icons/Text/index.js +17 -8
  163. package/dist/lexical/ui/icons/Text/index.js.map +1 -1
  164. package/dist/lexical/ui/icons/Underline/index.d.ts +3 -1
  165. package/dist/lexical/ui/icons/Underline/index.d.ts.map +1 -1
  166. package/dist/lexical/ui/icons/Underline/index.js +16 -14
  167. package/dist/lexical/ui/icons/Underline/index.js.map +1 -1
  168. package/dist/lexical/ui/icons/UnorderedList/index.d.ts +3 -1
  169. package/dist/lexical/ui/icons/UnorderedList/index.d.ts.map +1 -1
  170. package/dist/lexical/ui/icons/UnorderedList/index.js +13 -40
  171. package/dist/lexical/ui/icons/UnorderedList/index.js.map +1 -1
  172. package/dist/lexical/ui/icons/Upload/index.d.ts +3 -1
  173. package/dist/lexical/ui/icons/Upload/index.d.ts.map +1 -1
  174. package/dist/lexical/ui/icons/Upload/index.js +15 -22
  175. package/dist/lexical/ui/icons/Upload/index.js.map +1 -1
  176. package/dist/utilities/buildEditorState.d.ts.map +1 -1
  177. package/dist/utilities/buildEditorState.js +13 -0
  178. package/dist/utilities/buildEditorState.js.map +1 -1
  179. package/package.json +10 -15
  180. package/dist/exports/client/Component-DOSSWC76.js +0 -2
  181. package/dist/exports/client/Component-DOSSWC76.js.map +0 -7
  182. package/dist/exports/client/Component-MBLHTKDK.js +0 -2
  183. package/dist/exports/client/Component-MBLHTKDK.js.map +0 -7
  184. package/dist/exports/client/Field-4UEGQMIN.js.map +0 -7
  185. package/dist/exports/client/chunk-YWIZCGSY.js +0 -2
  186. package/dist/exports/client/chunk-YWIZCGSY.js.map +0 -7
  187. package/dist/exports/client/componentInline-CBBUBQ7P.js +0 -2
  188. package/dist/exports/server/migrate.d.ts +0 -16
  189. package/dist/exports/server/migrate.d.ts.map +0 -1
  190. package/dist/exports/server/migrate.js +0 -16
  191. package/dist/exports/server/migrate.js.map +0 -1
  192. package/dist/features/migrations/lexicalPluginToLexical/converter/converters/heading/converter.d.ts +0 -3
  193. package/dist/features/migrations/lexicalPluginToLexical/converter/converters/heading/converter.d.ts.map +0 -1
  194. package/dist/features/migrations/lexicalPluginToLexical/converter/converters/heading/converter.js +0 -22
  195. package/dist/features/migrations/lexicalPluginToLexical/converter/converters/heading/converter.js.map +0 -1
  196. package/dist/features/migrations/lexicalPluginToLexical/converter/converters/link/converter.d.ts +0 -3
  197. package/dist/features/migrations/lexicalPluginToLexical/converter/converters/link/converter.d.ts.map +0 -1
  198. package/dist/features/migrations/lexicalPluginToLexical/converter/converters/link/converter.js +0 -33
  199. package/dist/features/migrations/lexicalPluginToLexical/converter/converters/link/converter.js.map +0 -1
  200. package/dist/features/migrations/lexicalPluginToLexical/converter/converters/list/converter.d.ts +0 -3
  201. package/dist/features/migrations/lexicalPluginToLexical/converter/converters/list/converter.d.ts.map +0 -1
  202. package/dist/features/migrations/lexicalPluginToLexical/converter/converters/list/converter.js +0 -24
  203. package/dist/features/migrations/lexicalPluginToLexical/converter/converters/list/converter.js.map +0 -1
  204. package/dist/features/migrations/lexicalPluginToLexical/converter/converters/listItem/converter.d.ts +0 -3
  205. package/dist/features/migrations/lexicalPluginToLexical/converter/converters/listItem/converter.d.ts.map +0 -1
  206. package/dist/features/migrations/lexicalPluginToLexical/converter/converters/listItem/converter.js +0 -25
  207. package/dist/features/migrations/lexicalPluginToLexical/converter/converters/listItem/converter.js.map +0 -1
  208. package/dist/features/migrations/lexicalPluginToLexical/converter/converters/quote/converter.d.ts +0 -3
  209. package/dist/features/migrations/lexicalPluginToLexical/converter/converters/quote/converter.d.ts.map +0 -1
  210. package/dist/features/migrations/lexicalPluginToLexical/converter/converters/quote/converter.js +0 -22
  211. package/dist/features/migrations/lexicalPluginToLexical/converter/converters/quote/converter.js.map +0 -1
  212. package/dist/features/migrations/lexicalPluginToLexical/converter/converters/unknown/converter.d.ts +0 -3
  213. package/dist/features/migrations/lexicalPluginToLexical/converter/converters/unknown/converter.d.ts.map +0 -1
  214. package/dist/features/migrations/lexicalPluginToLexical/converter/converters/unknown/converter.js +0 -28
  215. package/dist/features/migrations/lexicalPluginToLexical/converter/converters/unknown/converter.js.map +0 -1
  216. package/dist/features/migrations/lexicalPluginToLexical/converter/converters/upload/converter.d.ts +0 -3
  217. package/dist/features/migrations/lexicalPluginToLexical/converter/converters/upload/converter.d.ts.map +0 -1
  218. package/dist/features/migrations/lexicalPluginToLexical/converter/converters/upload/converter.js +0 -22
  219. package/dist/features/migrations/lexicalPluginToLexical/converter/converters/upload/converter.js.map +0 -1
  220. package/dist/features/migrations/lexicalPluginToLexical/converter/defaultConverters.d.ts +0 -3
  221. package/dist/features/migrations/lexicalPluginToLexical/converter/defaultConverters.d.ts.map +0 -1
  222. package/dist/features/migrations/lexicalPluginToLexical/converter/defaultConverters.js +0 -9
  223. package/dist/features/migrations/lexicalPluginToLexical/converter/defaultConverters.js.map +0 -1
  224. package/dist/features/migrations/lexicalPluginToLexical/converter/index.d.ts +0 -19
  225. package/dist/features/migrations/lexicalPluginToLexical/converter/index.d.ts.map +0 -1
  226. package/dist/features/migrations/lexicalPluginToLexical/converter/index.js +0 -78
  227. package/dist/features/migrations/lexicalPluginToLexical/converter/index.js.map +0 -1
  228. package/dist/features/migrations/lexicalPluginToLexical/converter/types.d.ts +0 -23
  229. package/dist/features/migrations/lexicalPluginToLexical/converter/types.d.ts.map +0 -1
  230. package/dist/features/migrations/lexicalPluginToLexical/converter/types.js +0 -2
  231. package/dist/features/migrations/lexicalPluginToLexical/converter/types.js.map +0 -1
  232. package/dist/features/migrations/lexicalPluginToLexical/feature.client.d.ts +0 -2
  233. package/dist/features/migrations/lexicalPluginToLexical/feature.client.d.ts.map +0 -1
  234. package/dist/features/migrations/lexicalPluginToLexical/feature.client.js +0 -10
  235. package/dist/features/migrations/lexicalPluginToLexical/feature.client.js.map +0 -1
  236. package/dist/features/migrations/lexicalPluginToLexical/feature.server.d.ts +0 -10
  237. package/dist/features/migrations/lexicalPluginToLexical/feature.server.d.ts.map +0 -1
  238. package/dist/features/migrations/lexicalPluginToLexical/feature.server.js +0 -49
  239. package/dist/features/migrations/lexicalPluginToLexical/feature.server.js.map +0 -1
  240. package/dist/features/migrations/lexicalPluginToLexical/nodes/unknownConvertedNode/Component.d.ts +0 -9
  241. package/dist/features/migrations/lexicalPluginToLexical/nodes/unknownConvertedNode/Component.d.ts.map +0 -1
  242. package/dist/features/migrations/lexicalPluginToLexical/nodes/unknownConvertedNode/Component.js +0 -15
  243. package/dist/features/migrations/lexicalPluginToLexical/nodes/unknownConvertedNode/Component.js.map +0 -1
  244. package/dist/features/migrations/lexicalPluginToLexical/nodes/unknownConvertedNode/index.d.ts +0 -33
  245. package/dist/features/migrations/lexicalPluginToLexical/nodes/unknownConvertedNode/index.d.ts.map +0 -1
  246. package/dist/features/migrations/lexicalPluginToLexical/nodes/unknownConvertedNode/index.js +0 -74
  247. package/dist/features/migrations/lexicalPluginToLexical/nodes/unknownConvertedNode/index.js.map +0 -1
  248. package/dist/features/migrations/slateToLexical/converter/converters/blockquote/converter.d.ts +0 -3
  249. package/dist/features/migrations/slateToLexical/converter/converters/blockquote/converter.d.ts.map +0 -1
  250. package/dist/features/migrations/slateToLexical/converter/converters/blockquote/converter.js +0 -23
  251. package/dist/features/migrations/slateToLexical/converter/converters/blockquote/converter.js.map +0 -1
  252. package/dist/features/migrations/slateToLexical/converter/converters/heading/converter.d.ts +0 -3
  253. package/dist/features/migrations/slateToLexical/converter/converters/heading/converter.d.ts.map +0 -1
  254. package/dist/features/migrations/slateToLexical/converter/converters/heading/converter.js +0 -24
  255. package/dist/features/migrations/slateToLexical/converter/converters/heading/converter.js.map +0 -1
  256. package/dist/features/migrations/slateToLexical/converter/converters/indent/converter.d.ts +0 -3
  257. package/dist/features/migrations/slateToLexical/converter/converters/indent/converter.d.ts.map +0 -1
  258. package/dist/features/migrations/slateToLexical/converter/converters/indent/converter.js +0 -33
  259. package/dist/features/migrations/slateToLexical/converter/converters/indent/converter.js.map +0 -1
  260. package/dist/features/migrations/slateToLexical/converter/converters/link/converter.d.ts +0 -3
  261. package/dist/features/migrations/slateToLexical/converter/converters/link/converter.d.ts.map +0 -1
  262. package/dist/features/migrations/slateToLexical/converter/converters/link/converter.js +0 -30
  263. package/dist/features/migrations/slateToLexical/converter/converters/link/converter.js.map +0 -1
  264. package/dist/features/migrations/slateToLexical/converter/converters/listItem/converter.d.ts +0 -3
  265. package/dist/features/migrations/slateToLexical/converter/converters/listItem/converter.d.ts.map +0 -1
  266. package/dist/features/migrations/slateToLexical/converter/converters/listItem/converter.js +0 -26
  267. package/dist/features/migrations/slateToLexical/converter/converters/listItem/converter.js.map +0 -1
  268. package/dist/features/migrations/slateToLexical/converter/converters/orderedList/converter.d.ts +0 -3
  269. package/dist/features/migrations/slateToLexical/converter/converters/orderedList/converter.d.ts.map +0 -1
  270. package/dist/features/migrations/slateToLexical/converter/converters/orderedList/converter.js +0 -26
  271. package/dist/features/migrations/slateToLexical/converter/converters/orderedList/converter.js.map +0 -1
  272. package/dist/features/migrations/slateToLexical/converter/converters/relationship/converter.d.ts +0 -3
  273. package/dist/features/migrations/slateToLexical/converter/converters/relationship/converter.d.ts.map +0 -1
  274. package/dist/features/migrations/slateToLexical/converter/converters/relationship/converter.js +0 -15
  275. package/dist/features/migrations/slateToLexical/converter/converters/relationship/converter.js.map +0 -1
  276. package/dist/features/migrations/slateToLexical/converter/converters/unknown/converter.d.ts +0 -3
  277. package/dist/features/migrations/slateToLexical/converter/converters/unknown/converter.d.ts.map +0 -1
  278. package/dist/features/migrations/slateToLexical/converter/converters/unknown/converter.js +0 -27
  279. package/dist/features/migrations/slateToLexical/converter/converters/unknown/converter.js.map +0 -1
  280. package/dist/features/migrations/slateToLexical/converter/converters/unorderedList/converter.d.ts +0 -3
  281. package/dist/features/migrations/slateToLexical/converter/converters/unorderedList/converter.d.ts.map +0 -1
  282. package/dist/features/migrations/slateToLexical/converter/converters/unorderedList/converter.js +0 -26
  283. package/dist/features/migrations/slateToLexical/converter/converters/unorderedList/converter.js.map +0 -1
  284. package/dist/features/migrations/slateToLexical/converter/converters/upload/converter.d.ts +0 -3
  285. package/dist/features/migrations/slateToLexical/converter/converters/upload/converter.d.ts.map +0 -1
  286. package/dist/features/migrations/slateToLexical/converter/converters/upload/converter.js +0 -18
  287. package/dist/features/migrations/slateToLexical/converter/converters/upload/converter.js.map +0 -1
  288. package/dist/features/migrations/slateToLexical/converter/defaultConverters.d.ts +0 -3
  289. package/dist/features/migrations/slateToLexical/converter/defaultConverters.d.ts.map +0 -1
  290. package/dist/features/migrations/slateToLexical/converter/defaultConverters.js +0 -12
  291. package/dist/features/migrations/slateToLexical/converter/defaultConverters.js.map +0 -1
  292. package/dist/features/migrations/slateToLexical/converter/index.d.ts +0 -19
  293. package/dist/features/migrations/slateToLexical/converter/index.d.ts.map +0 -1
  294. package/dist/features/migrations/slateToLexical/converter/index.js +0 -130
  295. package/dist/features/migrations/slateToLexical/converter/index.js.map +0 -1
  296. package/dist/features/migrations/slateToLexical/converter/types.d.ts +0 -16
  297. package/dist/features/migrations/slateToLexical/converter/types.d.ts.map +0 -1
  298. package/dist/features/migrations/slateToLexical/converter/types.js +0 -2
  299. package/dist/features/migrations/slateToLexical/converter/types.js.map +0 -1
  300. package/dist/features/migrations/slateToLexical/feature.client.d.ts +0 -2
  301. package/dist/features/migrations/slateToLexical/feature.client.d.ts.map +0 -1
  302. package/dist/features/migrations/slateToLexical/feature.client.js +0 -10
  303. package/dist/features/migrations/slateToLexical/feature.client.js.map +0 -1
  304. package/dist/features/migrations/slateToLexical/feature.server.d.ts +0 -40
  305. package/dist/features/migrations/slateToLexical/feature.server.d.ts.map +0 -1
  306. package/dist/features/migrations/slateToLexical/feature.server.js +0 -68
  307. package/dist/features/migrations/slateToLexical/feature.server.js.map +0 -1
  308. package/dist/features/migrations/slateToLexical/nodes/unknownConvertedNode/Component.d.ts +0 -9
  309. package/dist/features/migrations/slateToLexical/nodes/unknownConvertedNode/Component.d.ts.map +0 -1
  310. package/dist/features/migrations/slateToLexical/nodes/unknownConvertedNode/Component.js +0 -15
  311. package/dist/features/migrations/slateToLexical/nodes/unknownConvertedNode/Component.js.map +0 -1
  312. package/dist/features/migrations/slateToLexical/nodes/unknownConvertedNode/index.d.ts +0 -33
  313. package/dist/features/migrations/slateToLexical/nodes/unknownConvertedNode/index.d.ts.map +0 -1
  314. package/dist/features/migrations/slateToLexical/nodes/unknownConvertedNode/index.js +0 -74
  315. package/dist/features/migrations/slateToLexical/nodes/unknownConvertedNode/index.js.map +0 -1
  316. package/dist/lexical/ui/icons/AI/index.d.ts +0 -3
  317. package/dist/lexical/ui/icons/AI/index.d.ts.map +0 -1
  318. package/dist/lexical/ui/icons/AI/index.js +0 -34
  319. package/dist/lexical/ui/icons/AI/index.js.map +0 -1
  320. package/dist/lexical/ui/icons/Caret/index.svg +0 -3
  321. package/dist/lexical/ui/icons/Edit/index.svg +0 -10
  322. package/dist/lexical/ui/icons/Remove/index.svg +0 -4
  323. package/dist/utilities/migrateSlateToLexical/index.d.ts +0 -15
  324. package/dist/utilities/migrateSlateToLexical/index.d.ts.map +0 -1
  325. package/dist/utilities/migrateSlateToLexical/index.js +0 -152
  326. package/dist/utilities/migrateSlateToLexical/index.js.map +0 -1
  327. package/dist/utilities/migrateSlateToLexical/migrateDocumentFieldsRecursively.d.ts +0 -10
  328. package/dist/utilities/migrateSlateToLexical/migrateDocumentFieldsRecursively.d.ts.map +0 -1
  329. package/dist/utilities/migrateSlateToLexical/migrateDocumentFieldsRecursively.js +0 -85
  330. package/dist/utilities/migrateSlateToLexical/migrateDocumentFieldsRecursively.js.map +0 -1
  331. /package/dist/exports/client/{componentInline-CBBUBQ7P.js.map → componentInline-LCHKRXOV.js.map} +0 -0
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/utilities/migrateSlateToLexical/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAyC,OAAO,EAAE,MAAM,SAAS,CAAA;AAI7E;;;;;;;;;GASG;AACH,wBAAsB,qBAAqB,CAAC,EAAE,OAAO,EAAE,EAAE;IAAE,OAAO,EAAE,OAAO,CAAA;CAAE,iBAoC5E"}
@@ -1,152 +0,0 @@
1
- /* eslint-disable no-console */import { migrateDocumentFieldsRecursively } from './migrateDocumentFieldsRecursively.js';
2
- /**
3
- * This goes through every single collection and field in the payload config, and migrates its data from Slate to Lexical. This does not support sub-fields within slate.
4
- *
5
- * It will only translate fields fulfilling all these requirements:
6
- * - field schema uses lexical editor
7
- * - lexical editor has SlateToLexicalFeature added
8
- * - saved field data is in Slate format
9
- *
10
- * @param payload
11
- */
12
- export async function migrateSlateToLexical({
13
- payload
14
- }) {
15
- const collections = payload.config.collections;
16
- const errors = [];
17
- const allLocales = payload.config.localization ? payload.config.localization.localeCodes : [null];
18
- const totalCollections = collections.length;
19
- for (const locale of allLocales) {
20
- let curCollection = 0;
21
- for (const collection of collections) {
22
- curCollection++;
23
- await migrateCollection({
24
- collection,
25
- cur: curCollection,
26
- errors,
27
- locale,
28
- max: totalCollections,
29
- payload
30
- });
31
- }
32
- for (const global of payload.config.globals) {
33
- await migrateGlobal({
34
- errors,
35
- global,
36
- locale,
37
- payload
38
- });
39
- }
40
- }
41
- if (errors.length) {
42
- console.error(`Found ${errors.length} errors::`, JSON.stringify(errors, null, 2));
43
- } else {
44
- console.log('Migration successful - no errors');
45
- }
46
- }
47
- async function migrateGlobal({
48
- errors,
49
- global,
50
- locale,
51
- payload
52
- }) {
53
- console.log(`SlateToLexical: ${locale}: Migrating global:`, global.slug);
54
- const document = await payload.findGlobal({
55
- slug: global.slug,
56
- depth: 0,
57
- draft: true,
58
- locale: locale || undefined,
59
- overrideAccess: true
60
- });
61
- const found = migrateDocument({
62
- document,
63
- fields: global.fields,
64
- payload
65
- });
66
- if (found) {
67
- try {
68
- await payload.updateGlobal({
69
- slug: global.slug,
70
- data: document,
71
- depth: 0,
72
- draft: document?._status === 'draft',
73
- locale: locale || undefined
74
- });
75
- // Catch it, because some errors were caused by the user previously (e.g. invalid relationships) and will throw an error now, even though they are not related to the migration
76
- } catch (e) {
77
- console.log('Error updating global', e, {
78
- slug: global.slug
79
- });
80
- errors.push(e);
81
- }
82
- }
83
- }
84
- async function migrateCollection({
85
- collection,
86
- cur,
87
- errors,
88
- locale,
89
- max,
90
- payload
91
- }) {
92
- console.log(`SlateToLexical: ${locale}: Migrating collection:`, collection.slug, '(' + cur + '/' + max + ')');
93
- const documentCount = (await payload.count({
94
- collection: collection.slug,
95
- locale: locale || undefined
96
- })).totalDocs;
97
- let page = 1;
98
- let migrated = 0;
99
- while (migrated < documentCount) {
100
- const documents = await payload.find({
101
- collection: collection.slug,
102
- depth: 0,
103
- draft: true,
104
- locale: locale || undefined,
105
- overrideAccess: true,
106
- page,
107
- pagination: true
108
- });
109
- for (const document of documents.docs) {
110
- migrated++;
111
- console.log(`SlateToLexical: ${locale}: Migrating collection:`, collection.slug, '(' + cur + '/' + max + ') - Migrating Document: ' + document.id + ' (' + migrated + '/' + documentCount + ')');
112
- const found = migrateDocument({
113
- document,
114
- fields: collection.fields,
115
- payload
116
- });
117
- if (found) {
118
- try {
119
- await payload.update({
120
- id: document.id,
121
- collection: collection.slug,
122
- data: document,
123
- depth: 0,
124
- draft: document?._status === 'draft',
125
- locale: locale || undefined
126
- });
127
- // Catch it, because some errors were caused by the user previously (e.g. invalid relationships) and will throw an error now, even though they are not related to the migration
128
- } catch (e) {
129
- errors.push(e);
130
- console.log('Error updating collection', e, {
131
- id: document.id,
132
- slug: collection.slug
133
- });
134
- }
135
- }
136
- }
137
- page++;
138
- }
139
- }
140
- function migrateDocument({
141
- document,
142
- fields,
143
- payload
144
- }) {
145
- return !!migrateDocumentFieldsRecursively({
146
- data: document,
147
- fields,
148
- found: 0,
149
- payload
150
- });
151
- }
152
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","names":["migrateDocumentFieldsRecursively","migrateSlateToLexical","payload","collections","config","errors","allLocales","localization","localeCodes","totalCollections","length","locale","curCollection","collection","migrateCollection","cur","max","global","globals","migrateGlobal","console","error","JSON","stringify","log","slug","document","findGlobal","depth","draft","undefined","overrideAccess","found","migrateDocument","fields","updateGlobal","data","_status","e","push","documentCount","count","totalDocs","page","migrated","documents","find","pagination","docs","id","update"],"sources":["../../../src/utilities/migrateSlateToLexical/index.ts"],"sourcesContent":["/* eslint-disable no-console */\nimport type { CollectionConfig, Field, GlobalConfig, Payload } from 'payload'\n\nimport { migrateDocumentFieldsRecursively } from './migrateDocumentFieldsRecursively.js'\n\n/**\n * This goes through every single collection and field in the payload config, and migrates its data from Slate to Lexical. This does not support sub-fields within slate.\n *\n * It will only translate fields fulfilling all these requirements:\n * - field schema uses lexical editor\n * - lexical editor has SlateToLexicalFeature added\n * - saved field data is in Slate format\n *\n * @param payload\n */\nexport async function migrateSlateToLexical({ payload }: { payload: Payload }) {\n const collections = payload.config.collections\n\n const errors: unknown[] = []\n\n const allLocales = payload.config.localization ? payload.config.localization.localeCodes : [null]\n\n const totalCollections = collections.length\n for (const locale of allLocales) {\n let curCollection = 0\n for (const collection of collections) {\n curCollection++\n await migrateCollection({\n collection,\n cur: curCollection,\n errors,\n locale,\n max: totalCollections,\n payload,\n })\n }\n for (const global of payload.config.globals) {\n await migrateGlobal({\n errors,\n global,\n locale,\n payload,\n })\n }\n }\n\n if (errors.length) {\n console.error(`Found ${errors.length} errors::`, JSON.stringify(errors, null, 2))\n } else {\n console.log('Migration successful - no errors')\n }\n}\n\nasync function migrateGlobal({\n errors,\n global,\n locale,\n payload,\n}: {\n errors: unknown[]\n global: GlobalConfig\n locale: null | string\n payload: Payload\n}) {\n console.log(`SlateToLexical: ${locale}: Migrating global:`, global.slug)\n\n const document = await payload.findGlobal({\n slug: global.slug,\n depth: 0,\n draft: true,\n locale: locale || undefined,\n overrideAccess: true,\n })\n\n const found = migrateDocument({\n document,\n fields: global.fields,\n payload,\n })\n\n if (found) {\n try {\n await payload.updateGlobal({\n slug: global.slug,\n data: document,\n depth: 0,\n draft: document?._status === 'draft',\n locale: locale || undefined,\n })\n // Catch it, because some errors were caused by the user previously (e.g. invalid relationships) and will throw an error now, even though they are not related to the migration\n } catch (e) {\n console.log('Error updating global', e, {\n slug: global.slug,\n })\n errors.push(e)\n }\n }\n}\n\nasync function migrateCollection({\n collection,\n cur,\n errors,\n locale,\n max,\n payload,\n}: {\n collection: CollectionConfig\n cur: number\n errors: unknown[]\n locale: null | string\n max: number\n payload: Payload\n}) {\n console.log(\n `SlateToLexical: ${locale}: Migrating collection:`,\n collection.slug,\n '(' + cur + '/' + max + ')',\n )\n\n const documentCount = (\n await payload.count({\n collection: collection.slug,\n locale: locale || undefined,\n })\n ).totalDocs\n\n let page = 1\n let migrated = 0\n\n while (migrated < documentCount) {\n const documents = await payload.find({\n collection: collection.slug,\n depth: 0,\n draft: true,\n locale: locale || undefined,\n overrideAccess: true,\n page,\n pagination: true,\n })\n\n for (const document of documents.docs) {\n migrated++\n console.log(\n `SlateToLexical: ${locale}: Migrating collection:`,\n collection.slug,\n '(' +\n cur +\n '/' +\n max +\n ') - Migrating Document: ' +\n document.id +\n ' (' +\n migrated +\n '/' +\n documentCount +\n ')',\n )\n const found = migrateDocument({\n document,\n fields: collection.fields,\n payload,\n })\n\n if (found) {\n try {\n await payload.update({\n id: document.id,\n collection: collection.slug,\n data: document,\n depth: 0,\n draft: document?._status === 'draft',\n locale: locale || undefined,\n })\n // Catch it, because some errors were caused by the user previously (e.g. invalid relationships) and will throw an error now, even though they are not related to the migration\n } catch (e) {\n errors.push(e)\n\n console.log('Error updating collection', e, {\n id: document.id,\n slug: collection.slug,\n })\n }\n }\n }\n page++\n }\n}\n\nfunction migrateDocument({\n document,\n fields,\n payload,\n}: {\n document: Record<string, unknown>\n fields: Field[]\n payload: Payload\n}): boolean {\n return !!migrateDocumentFieldsRecursively({\n data: document,\n fields,\n found: 0,\n payload,\n })\n}\n"],"mappings":"AAAA,+BAGA,SAASA,gCAAgC,QAAQ;AAEjD;;;;;;;;;;AAUA,OAAO,eAAeC,sBAAsB;EAAEC;AAAO,CAAwB;EAC3E,MAAMC,WAAA,GAAcD,OAAA,CAAQE,MAAM,CAACD,WAAW;EAE9C,MAAME,MAAA,GAAoB,EAAE;EAE5B,MAAMC,UAAA,GAAaJ,OAAA,CAAQE,MAAM,CAACG,YAAY,GAAGL,OAAA,CAAQE,MAAM,CAACG,YAAY,CAACC,WAAW,GAAG,CAAC,KAAK;EAEjG,MAAMC,gBAAA,GAAmBN,WAAA,CAAYO,MAAM;EAC3C,KAAK,MAAMC,MAAA,IAAUL,UAAA,EAAY;IAC/B,IAAIM,aAAA,GAAgB;IACpB,KAAK,MAAMC,UAAA,IAAcV,WAAA,EAAa;MACpCS,aAAA;MACA,MAAME,iBAAA,CAAkB;QACtBD,UAAA;QACAE,GAAA,EAAKH,aAAA;QACLP,MAAA;QACAM,MAAA;QACAK,GAAA,EAAKP,gBAAA;QACLP;MACF;IACF;IACA,KAAK,MAAMe,MAAA,IAAUf,OAAA,CAAQE,MAAM,CAACc,OAAO,EAAE;MAC3C,MAAMC,aAAA,CAAc;QAClBd,MAAA;QACAY,MAAA;QACAN,MAAA;QACAT;MACF;IACF;EACF;EAEA,IAAIG,MAAA,CAAOK,MAAM,EAAE;IACjBU,OAAA,CAAQC,KAAK,CAAC,SAAShB,MAAA,CAAOK,MAAM,WAAW,EAAEY,IA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ACD,CAAA;UAEZlB,OAAA,CAAQI,GAAG,CAAC,6BAA6Bc,CAAA,EAAG;YAC1CW,EAAA,EAAIvB,QAAA,CAASuB,EAAE;YACfxB,IAAA,EAAMZ,UAAA,CAAWY;UACnB;QACF;MACF;IACF;IACAkB,IAAA;EACF;AACF;AAEA,SAASV,gBAAgB;EACvBP,QAAQ;EACRQ,MAAM;EACNhC;AAAO,CAKR;EACC,OAAO,CAAC,CAACF,gCAAA,CAAiC;IACxCoC,IAAA,EAAMV,QAAA;IACNQ,MAAA;IACAF,KAAA,EAAO;IACP9B;EACF;AACF","ignoreList":[]}
@@ -1,10 +0,0 @@
1
- import type { Field, Payload } from 'payload';
2
- type NestedRichTextFieldsArgs = {
3
- data: Record<string, unknown>;
4
- fields: Field[];
5
- found: number;
6
- payload: Payload;
7
- };
8
- export declare const migrateDocumentFieldsRecursively: ({ data, fields, found, payload, }: NestedRichTextFieldsArgs) => number;
9
- export {};
10
- //# sourceMappingURL=migrateDocumentFieldsRecursively.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"migrateDocumentFieldsRecursively.d.ts","sourceRoot":"","sources":["../../../src/utilities/migrateSlateToLexical/migrateDocumentFieldsRecursively.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAkB,OAAO,EAAE,MAAM,SAAS,CAAA;AAY7D,KAAK,wBAAwB,GAAG;IAC9B,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IAE7B,MAAM,EAAE,KAAK,EAAE,CAAA;IACf,KAAK,EAAE,MAAM,CAAA;IACb,OAAO,EAAE,OAAO,CAAA;CACjB,CAAA;AAED,eAAO,MAAM,gCAAgC,sCAK1C,wBAAwB,KAAG,MAuF7B,CAAA"}
@@ -1,85 +0,0 @@
1
- import { fieldAffectsData, fieldHasSubFields, fieldIsArrayType, tabHasName } from 'payload/shared';
2
- import { convertSlateToLexical } from '../../features/migrations/slateToLexical/converter/index.js';
3
- export const migrateDocumentFieldsRecursively = ({
4
- data,
5
- fields,
6
- found,
7
- payload
8
- }) => {
9
- for (const field of fields) {
10
- if (fieldHasSubFields(field) && !fieldIsArrayType(field)) {
11
- if (fieldAffectsData(field) && typeof data[field.name] === 'object') {
12
- found += migrateDocumentFieldsRecursively({
13
- data: data[field.name],
14
- fields: field.fields,
15
- found,
16
- payload
17
- });
18
- } else {
19
- found += migrateDocumentFieldsRecursively({
20
- data,
21
- fields: field.fields,
22
- found,
23
- payload
24
- });
25
- }
26
- } else if (field.type === 'tabs') {
27
- field.tabs.forEach(tab => {
28
- found += migrateDocumentFieldsRecursively({
29
- data: tabHasName(tab) ? data[tab.name] : data,
30
- fields: tab.fields,
31
- found,
32
- payload
33
- });
34
- });
35
- } else if (Array.isArray(data[field.name])) {
36
- if (field.type === 'blocks') {
37
- data[field.name].forEach(row => {
38
- const blockTypeToMatch = row?.blockType;
39
- const block = payload?.blocks[blockTypeToMatch] ?? (field.blockReferences ?? field.blocks).find(block => typeof block !== 'string' && block.slug === blockTypeToMatch);
40
- if (block) {
41
- found += migrateDocumentFieldsRecursively({
42
- data: row,
43
- fields: block.fields,
44
- found,
45
- payload
46
- });
47
- }
48
- });
49
- }
50
- if (field.type === 'array') {
51
- data[field.name].forEach(row => {
52
- found += migrateDocumentFieldsRecursively({
53
- data: row,
54
- fields: field.fields,
55
- found,
56
- payload
57
- });
58
- });
59
- }
60
- }
61
- if (field.type === 'richText' && Array.isArray(data[field.name])) {
62
- // Slate richText
63
- const editor = field.editor;
64
- if (editor && typeof editor === 'object') {
65
- if ('features' in editor && editor.features?.length) {
66
- // find slatetolexical feature
67
- const slateToLexicalFeature = editor.editorConfig.resolvedFeatureMap.get('slateToLexical');
68
- if (slateToLexicalFeature) {
69
- // DO CONVERSION
70
- const {
71
- converters
72
- } = slateToLexicalFeature.sanitizedServerFeatureProps;
73
- data[field.name] = convertSlateToLexical({
74
- converters: converters,
75
- slateData: data[field.name]
76
- });
77
- found++;
78
- }
79
- }
80
- }
81
- }
82
- }
83
- return found;
84
- };
85
- //# sourceMappingURL=migrateDocumentFieldsRecursively.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"migrateDocumentFieldsRecursively.js","names":["fieldAffectsData","fieldHasSubFields","fieldIsArrayType","tabHasName","convertSlateToLexical","migrateDocumentFieldsRecursively","data","fields","found","payload","field","name","type","tabs","forEach","tab","Array","isArray","row","blockTypeToMatch","blockType","block","blocks","blockReferences","find","slug","editor","features","length","slateToLexicalFeature","editorConfig","resolvedFeatureMap","get","converters","sanitizedServerFeatureProps","slateData"],"sources":["../../../src/utilities/migrateSlateToLexical/migrateDocumentFieldsRecursively.ts"],"sourcesContent":["import type { Field, FlattenedBlock, Payload } from 'payload'\n\nimport { fieldAffectsData, fieldHasSubFields, fieldIsArrayType, tabHasName } from 'payload/shared'\n\nimport type {\n SlateNode,\n SlateNodeConverter,\n} from '../../features/migrations/slateToLexical/converter/types.js'\nimport type { LexicalRichTextAdapter } from '../../types.js'\n\nimport { convertSlateToLexical } from '../../features/migrations/slateToLexical/converter/index.js'\n\ntype NestedRichTextFieldsArgs = {\n data: Record<string, unknown>\n\n fields: Field[]\n found: number\n payload: Payload\n}\n\nexport const migrateDocumentFieldsRecursively = ({\n data,\n fields,\n found,\n payload,\n}: NestedRichTextFieldsArgs): number => {\n for (const field of fields) {\n if (fieldHasSubFields(field) && !fieldIsArrayType(field)) {\n if (fieldAffectsData(field) && typeof data[field.name] === 'object') {\n found += migrateDocumentFieldsRecursively({\n data: data[field.name] as Record<string, unknown>,\n fields: field.fields,\n found,\n payload,\n })\n } else {\n found += migrateDocumentFieldsRecursively({\n data,\n fields: field.fields,\n found,\n payload,\n })\n }\n } else if (field.type === 'tabs') {\n field.tabs.forEach((tab) => {\n found += migrateDocumentFieldsRecursively({\n data: (tabHasName(tab) ? data[tab.name] : data) as Record<string, unknown>,\n fields: tab.fields,\n found,\n payload,\n })\n })\n } else if (Array.isArray(data[field.name])) {\n if (field.type === 'blocks') {\n ;(data[field.name] as Array<Record<string, unknown>>).forEach((row) => {\n const blockTypeToMatch: string = row?.blockType as string\n const block =\n payload?.blocks[blockTypeToMatch] ??\n ((field.blockReferences ?? field.blocks).find(\n (block) => typeof block !== 'string' && block.slug === blockTypeToMatch,\n ) as FlattenedBlock | undefined)\n\n if (block) {\n found += migrateDocumentFieldsRecursively({\n data: row,\n fields: block.fields,\n found,\n payload,\n })\n }\n })\n }\n\n if (field.type === 'array') {\n ;(data[field.name] as Array<Record<string, unknown>>).forEach((row) => {\n found += migrateDocumentFieldsRecursively({\n data: row,\n fields: field.fields,\n found,\n payload,\n })\n })\n }\n }\n\n if (field.type === 'richText' && Array.isArray(data[field.name])) {\n // Slate richText\n const editor: LexicalRichTextAdapter = field.editor as LexicalRichTextAdapter\n if (editor && typeof editor === 'object') {\n if ('features' in editor && editor.features?.length) {\n // find slatetolexical feature\n const slateToLexicalFeature = editor.editorConfig.resolvedFeatureMap.get('slateToLexical')\n if (slateToLexicalFeature) {\n // DO CONVERSION\n\n const { converters } = slateToLexicalFeature.sanitizedServerFeatureProps as {\n converters?: SlateNodeConverter[]\n }\n\n data[field.name] = convertSlateToLexical({\n converters: converters!,\n slateData: data[field.name] as SlateNode[],\n })\n\n found++\n }\n }\n }\n }\n }\n\n return found\n}\n"],"mappings":"AAEA,SAASA,gBAAgB,EAAEC,iBAAiB,EAAEC,gBAAgB,EAAEC,UAAU,QAAQ;AAQlF,SAASC,qBAAqB,QAAQ;AAUtC,OAAO,MAAMC,gCAAA,GAAmCA,CAAC;EAC/CC,IAAI;EACJC,MAAM;EACNC,KAAK;EACLC;AAAO,CACkB;EACzB,KAAK,MAAMC,KAAA,IAASH,MAAA,EAAQ;IAC1B,IAAIN,iBAAA,CAAkBS,KAAA,KAAU,CAACR,gBAAA,CAAiBQ,KAAA,GAAQ;MACxD,IAAIV,gBAAA,CAAiBU,KAAA,KAAU,OAAOJ,IAAI,CAACI,KAAA,CAAMC,IAAI,CAAC,KAAK,UAAU;QACnEH,KAAA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