@payloadcms/richtext-lexical 4.0.0-internal.1f9ae9a → 4.0.0-internal.2fddfc0

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 (352) hide show
  1. package/dist/@types/assets.d.js +2 -0
  2. package/dist/@types/assets.d.js.map +1 -0
  3. package/dist/cell/rscEntry.d.ts.map +1 -1
  4. package/dist/cell/rscEntry.js +5 -5
  5. package/dist/cell/rscEntry.js.map +1 -1
  6. package/dist/exports/client/Field-VW7ZGT6K.js +2 -0
  7. package/dist/exports/client/Field-VW7ZGT6K.js.map +7 -0
  8. package/dist/exports/client/{RelationshipComponent-RZL743CS.js → RelationshipComponent-YCPAKOL7.js} +1 -1
  9. package/dist/exports/client/RelationshipComponent-YCPAKOL7.js.map +7 -0
  10. package/dist/exports/client/bundled.css +1 -1
  11. package/dist/exports/client/chunk-4EIYXZ6H.js +12 -0
  12. package/dist/exports/client/chunk-4EIYXZ6H.js.map +7 -0
  13. package/dist/exports/client/chunk-5VIL27GI.js +2 -0
  14. package/dist/exports/client/chunk-5VIL27GI.js.map +7 -0
  15. package/dist/exports/client/chunk-ESITTE3C.js +2 -0
  16. package/dist/exports/client/chunk-ESITTE3C.js.map +7 -0
  17. package/dist/exports/client/chunk-UD4DQ4AK.js +2 -0
  18. package/dist/exports/client/chunk-UD4DQ4AK.js.map +7 -0
  19. package/dist/exports/client/{component-CVM4OESA.js → component-PHZQBOJE.js} +2 -2
  20. package/dist/exports/client/component-PHZQBOJE.js.map +7 -0
  21. package/dist/exports/client/componentInline-H24N7GUG.js +2 -0
  22. package/dist/exports/client/index.d.ts +1 -0
  23. package/dist/exports/client/index.d.ts.map +1 -1
  24. package/dist/exports/client/index.js +25 -25
  25. package/dist/exports/client/index.js.map +4 -4
  26. package/dist/exports/server/rsc.browser.d.ts +11 -0
  27. package/dist/exports/server/rsc.browser.d.ts.map +1 -0
  28. package/dist/exports/server/rsc.browser.js +10 -0
  29. package/dist/exports/server/rsc.browser.js.map +1 -0
  30. package/dist/features/blockquote/server/index.d.ts +1 -4
  31. package/dist/features/blockquote/server/index.d.ts.map +1 -1
  32. package/dist/features/blockquote/server/index.js +2 -0
  33. package/dist/features/blockquote/server/index.js.map +1 -1
  34. package/dist/features/blockquote/server/schema.d.ts +8 -0
  35. package/dist/features/blockquote/server/schema.d.ts.map +1 -0
  36. package/dist/features/blockquote/server/schema.js +15 -0
  37. package/dist/features/blockquote/server/schema.js.map +1 -0
  38. package/dist/features/blocks/client/component/index.d.ts +2 -1
  39. package/dist/features/blocks/client/component/index.d.ts.map +1 -1
  40. package/dist/features/blocks/client/component/index.js +16 -8
  41. package/dist/features/blocks/client/component/index.js.map +1 -1
  42. package/dist/features/blocks/client/componentInline/index.d.ts +2 -1
  43. package/dist/features/blocks/client/componentInline/index.d.ts.map +1 -1
  44. package/dist/features/blocks/client/componentInline/index.js +15 -7
  45. package/dist/features/blocks/client/componentInline/index.js.map +1 -1
  46. package/dist/features/blocks/client/index.d.ts.map +1 -1
  47. package/dist/features/blocks/client/index.js +4 -2
  48. package/dist/features/blocks/client/index.js.map +1 -1
  49. package/dist/features/blocks/client/markdown/markdownTransformer.js +4 -4
  50. package/dist/features/blocks/client/markdown/markdownTransformer.js.map +1 -1
  51. package/dist/features/blocks/client/nodes/BlocksNode.d.ts +1 -1
  52. package/dist/features/blocks/client/nodes/BlocksNode.d.ts.map +1 -1
  53. package/dist/features/blocks/client/nodes/BlocksNode.js.map +1 -1
  54. package/dist/features/blocks/client/nodes/InlineBlocksNode.d.ts +1 -1
  55. package/dist/features/blocks/client/nodes/InlineBlocksNode.d.ts.map +1 -1
  56. package/dist/features/blocks/client/nodes/InlineBlocksNode.js.map +1 -1
  57. package/dist/features/blocks/client/plugin/index.d.ts +1 -1
  58. package/dist/features/blocks/client/plugin/index.d.ts.map +1 -1
  59. package/dist/features/blocks/client/plugin/index.js.map +1 -1
  60. package/dist/features/blocks/premade/CodeBlock/Component/Block.d.ts.map +1 -1
  61. package/dist/features/blocks/premade/CodeBlock/Component/Block.js +1 -0
  62. package/dist/features/blocks/premade/CodeBlock/Component/Block.js.map +1 -1
  63. package/dist/features/blocks/server/graphQLPopulationPromise.d.ts +1 -2
  64. package/dist/features/blocks/server/graphQLPopulationPromise.d.ts.map +1 -1
  65. package/dist/features/blocks/server/graphQLPopulationPromise.js.map +1 -1
  66. package/dist/features/blocks/server/index.d.ts +1 -0
  67. package/dist/features/blocks/server/index.d.ts.map +1 -1
  68. package/dist/features/blocks/server/index.js +24 -72
  69. package/dist/features/blocks/server/index.js.map +1 -1
  70. package/dist/features/blocks/server/markdown/markdownTransformer.js +4 -4
  71. package/dist/features/blocks/server/markdown/markdownTransformer.js.map +1 -1
  72. package/dist/features/blocks/server/nodes/BlocksNode.d.ts +1 -18
  73. package/dist/features/blocks/server/nodes/BlocksNode.d.ts.map +1 -1
  74. package/dist/features/blocks/server/nodes/BlocksNode.js.map +1 -1
  75. package/dist/features/blocks/server/nodes/InlineBlocksNode.d.ts +2 -10
  76. package/dist/features/blocks/server/nodes/InlineBlocksNode.d.ts.map +1 -1
  77. package/dist/features/blocks/server/nodes/InlineBlocksNode.js.map +1 -1
  78. package/dist/features/blocks/server/schema.d.ts +45 -0
  79. package/dist/features/blocks/server/schema.d.ts.map +1 -0
  80. package/dist/features/blocks/server/schema.js +139 -0
  81. package/dist/features/blocks/server/schema.js.map +1 -0
  82. package/dist/features/blocks/server/validate.d.ts +1 -2
  83. package/dist/features/blocks/server/validate.d.ts.map +1 -1
  84. package/dist/features/blocks/server/validate.js.map +1 -1
  85. package/dist/features/converters/lexicalToHtml/async/converters/upload.js.map +1 -1
  86. package/dist/features/converters/lexicalToHtml/async/types.d.ts +14 -15
  87. package/dist/features/converters/lexicalToHtml/async/types.d.ts.map +1 -1
  88. package/dist/features/converters/lexicalToHtml/async/types.js.map +1 -1
  89. package/dist/features/converters/lexicalToHtml/sync/converters/upload.js.map +1 -1
  90. package/dist/features/converters/lexicalToHtml/sync/types.d.ts +14 -15
  91. package/dist/features/converters/lexicalToHtml/sync/types.d.ts.map +1 -1
  92. package/dist/features/converters/lexicalToHtml/sync/types.js.map +1 -1
  93. package/dist/features/converters/lexicalToJSX/Component/index.d.ts +4 -2
  94. package/dist/features/converters/lexicalToJSX/Component/index.d.ts.map +1 -1
  95. package/dist/features/converters/lexicalToJSX/Component/index.js +5 -4
  96. package/dist/features/converters/lexicalToJSX/Component/index.js.map +1 -1
  97. package/dist/features/converters/lexicalToJSX/converter/converters/upload.js.map +1 -1
  98. package/dist/features/converters/lexicalToJSX/converter/types.d.ts +12 -14
  99. package/dist/features/converters/lexicalToJSX/converter/types.d.ts.map +1 -1
  100. package/dist/features/converters/lexicalToJSX/converter/types.js.map +1 -1
  101. package/dist/features/converters/lexicalToPlaintext/sync/types.d.ts +12 -14
  102. package/dist/features/converters/lexicalToPlaintext/sync/types.d.ts.map +1 -1
  103. package/dist/features/converters/lexicalToPlaintext/sync/types.js.map +1 -1
  104. package/dist/features/experimental_table/server/index.d.ts +1 -6
  105. package/dist/features/experimental_table/server/index.d.ts.map +1 -1
  106. package/dist/features/experimental_table/server/index.js +4 -0
  107. package/dist/features/experimental_table/server/index.js.map +1 -1
  108. package/dist/features/experimental_table/server/schema.d.ts +27 -0
  109. package/dist/features/experimental_table/server/schema.d.ts.map +1 -0
  110. package/dist/features/experimental_table/server/schema.js +107 -0
  111. package/dist/features/experimental_table/server/schema.js.map +1 -0
  112. package/dist/features/heading/server/index.d.ts +2 -4
  113. package/dist/features/heading/server/index.d.ts.map +1 -1
  114. package/dist/features/heading/server/index.js +2 -0
  115. package/dist/features/heading/server/index.js.map +1 -1
  116. package/dist/features/heading/server/schema.d.ts +10 -0
  117. package/dist/features/heading/server/schema.d.ts.map +1 -0
  118. package/dist/features/heading/server/schema.js +37 -0
  119. package/dist/features/heading/server/schema.js.map +1 -0
  120. package/dist/features/horizontalRule/client/nodes/HorizontalRuleNode.d.ts +1 -1
  121. package/dist/features/horizontalRule/client/nodes/HorizontalRuleNode.d.ts.map +1 -1
  122. package/dist/features/horizontalRule/client/nodes/HorizontalRuleNode.js.map +1 -1
  123. package/dist/features/horizontalRule/server/index.d.ts +1 -0
  124. package/dist/features/horizontalRule/server/index.d.ts.map +1 -1
  125. package/dist/features/horizontalRule/server/index.js +2 -0
  126. package/dist/features/horizontalRule/server/index.js.map +1 -1
  127. package/dist/features/horizontalRule/server/nodes/HorizontalRuleNode.d.ts +1 -5
  128. package/dist/features/horizontalRule/server/nodes/HorizontalRuleNode.d.ts.map +1 -1
  129. package/dist/features/horizontalRule/server/nodes/HorizontalRuleNode.js.map +1 -1
  130. package/dist/features/horizontalRule/server/schema.d.ts +7 -0
  131. package/dist/features/horizontalRule/server/schema.d.ts.map +1 -0
  132. package/dist/features/horizontalRule/server/schema.js +25 -0
  133. package/dist/features/horizontalRule/server/schema.js.map +1 -0
  134. package/dist/features/link/client/index.d.ts.map +1 -1
  135. package/dist/features/link/client/index.js.map +1 -1
  136. package/dist/features/link/client/plugins/autoLink/index.d.ts +1 -1
  137. package/dist/features/link/client/plugins/autoLink/index.d.ts.map +1 -1
  138. package/dist/features/link/client/plugins/autoLink/index.js.map +1 -1
  139. package/dist/features/link/client/plugins/floatingLinkEditor/LinkEditor/index.js.map +1 -1
  140. package/dist/features/link/client/plugins/floatingLinkEditor/types.d.ts +1 -1
  141. package/dist/features/link/client/plugins/floatingLinkEditor/types.d.ts.map +1 -1
  142. package/dist/features/link/client/plugins/floatingLinkEditor/types.js.map +1 -1
  143. package/dist/features/link/client/plugins/link/index.js.map +1 -1
  144. package/dist/features/link/markdownTransformer.d.ts +1 -1
  145. package/dist/features/link/markdownTransformer.d.ts.map +1 -1
  146. package/dist/features/link/markdownTransformer.js.map +1 -1
  147. package/dist/features/link/markdownTransformer.spec.js.map +1 -1
  148. package/dist/features/link/nodes/AutoLinkNode.d.ts +3 -3
  149. package/dist/features/link/nodes/AutoLinkNode.d.ts.map +1 -1
  150. package/dist/features/link/nodes/AutoLinkNode.js +2 -1
  151. package/dist/features/link/nodes/AutoLinkNode.js.map +1 -1
  152. package/dist/features/link/nodes/LinkNode.d.ts +3 -3
  153. package/dist/features/link/nodes/LinkNode.d.ts.map +1 -1
  154. package/dist/features/link/nodes/LinkNode.js +2 -1
  155. package/dist/features/link/nodes/LinkNode.js.map +1 -1
  156. package/dist/features/link/server/baseFields.js.map +1 -1
  157. package/dist/features/link/server/graphQLPopulationPromise.d.ts +1 -1
  158. package/dist/features/link/server/graphQLPopulationPromise.d.ts.map +1 -1
  159. package/dist/features/link/server/graphQLPopulationPromise.js.map +1 -1
  160. package/dist/features/link/server/index.d.ts +2 -1
  161. package/dist/features/link/server/index.d.ts.map +1 -1
  162. package/dist/features/link/server/index.js +3 -0
  163. package/dist/features/link/server/index.js.map +1 -1
  164. package/dist/features/link/server/schema.d.ts +32 -0
  165. package/dist/features/link/server/schema.d.ts.map +1 -0
  166. package/dist/features/link/server/schema.js +169 -0
  167. package/dist/features/link/server/schema.js.map +1 -0
  168. package/dist/features/link/server/validate.d.ts +1 -1
  169. package/dist/features/link/server/validate.d.ts.map +1 -1
  170. package/dist/features/link/server/validate.js.map +1 -1
  171. package/dist/features/lists/checklist/server/index.d.ts.map +1 -1
  172. package/dist/features/lists/checklist/server/index.js +3 -0
  173. package/dist/features/lists/checklist/server/index.js.map +1 -1
  174. package/dist/features/lists/orderedList/server/index.d.ts.map +1 -1
  175. package/dist/features/lists/orderedList/server/index.js +3 -0
  176. package/dist/features/lists/orderedList/server/index.js.map +1 -1
  177. package/dist/features/lists/plugin/index.d.ts +0 -9
  178. package/dist/features/lists/plugin/index.d.ts.map +1 -1
  179. package/dist/features/lists/plugin/index.js.map +1 -1
  180. package/dist/features/lists/shared/schema.d.ts +18 -0
  181. package/dist/features/lists/shared/schema.d.ts.map +1 -0
  182. package/dist/features/lists/shared/schema.js +62 -0
  183. package/dist/features/lists/shared/schema.js.map +1 -0
  184. package/dist/features/lists/unorderedList/server/index.d.ts.map +1 -1
  185. package/dist/features/lists/unorderedList/server/index.js +3 -0
  186. package/dist/features/lists/unorderedList/server/index.js.map +1 -1
  187. package/dist/features/relationship/client/components/RelationshipComponent.d.ts +1 -1
  188. package/dist/features/relationship/client/components/RelationshipComponent.d.ts.map +1 -1
  189. package/dist/features/relationship/client/components/RelationshipComponent.js.map +1 -1
  190. package/dist/features/relationship/client/nodes/RelationshipNode.d.ts +1 -1
  191. package/dist/features/relationship/client/nodes/RelationshipNode.d.ts.map +1 -1
  192. package/dist/features/relationship/client/nodes/RelationshipNode.js.map +1 -1
  193. package/dist/features/relationship/client/plugins/index.d.ts +1 -1
  194. package/dist/features/relationship/client/plugins/index.d.ts.map +1 -1
  195. package/dist/features/relationship/client/plugins/index.js.map +1 -1
  196. package/dist/features/relationship/client/utils/useEnabledRelationships.d.ts.map +1 -1
  197. package/dist/features/relationship/client/utils/useEnabledRelationships.js +9 -40
  198. package/dist/features/relationship/client/utils/useEnabledRelationships.js.map +1 -1
  199. package/dist/features/relationship/server/graphQLPopulationPromise.d.ts +1 -1
  200. package/dist/features/relationship/server/graphQLPopulationPromise.d.ts.map +1 -1
  201. package/dist/features/relationship/server/graphQLPopulationPromise.js.map +1 -1
  202. package/dist/features/relationship/server/index.d.ts +1 -0
  203. package/dist/features/relationship/server/index.d.ts.map +1 -1
  204. package/dist/features/relationship/server/index.js +2 -0
  205. package/dist/features/relationship/server/index.js.map +1 -1
  206. package/dist/features/relationship/server/nodes/RelationshipNode.d.ts +1 -10
  207. package/dist/features/relationship/server/nodes/RelationshipNode.d.ts.map +1 -1
  208. package/dist/features/relationship/server/nodes/RelationshipNode.js.map +1 -1
  209. package/dist/features/relationship/server/schema.d.ts +28 -0
  210. package/dist/features/relationship/server/schema.d.ts.map +1 -0
  211. package/dist/features/relationship/server/schema.js +80 -0
  212. package/dist/features/relationship/server/schema.js.map +1 -0
  213. package/dist/features/relationship/shared/filterEnabledRelationshipCollections.d.ts +23 -0
  214. package/dist/features/relationship/shared/filterEnabledRelationshipCollections.d.ts.map +1 -0
  215. package/dist/features/relationship/shared/filterEnabledRelationshipCollections.js +34 -0
  216. package/dist/features/relationship/shared/filterEnabledRelationshipCollections.js.map +1 -0
  217. package/dist/features/typesServer.d.ts +17 -40
  218. package/dist/features/typesServer.d.ts.map +1 -1
  219. package/dist/features/typesServer.js.map +1 -1
  220. package/dist/features/upload/client/component/index.css +2 -2
  221. package/dist/features/upload/client/component/index.d.ts +1 -1
  222. package/dist/features/upload/client/component/index.d.ts.map +1 -1
  223. package/dist/features/upload/client/component/index.js.map +1 -1
  224. package/dist/features/upload/client/nodes/UploadNode.d.ts +1 -1
  225. package/dist/features/upload/client/nodes/UploadNode.d.ts.map +1 -1
  226. package/dist/features/upload/client/nodes/UploadNode.js.map +1 -1
  227. package/dist/features/upload/client/plugin/index.d.ts +1 -1
  228. package/dist/features/upload/client/plugin/index.d.ts.map +1 -1
  229. package/dist/features/upload/client/plugin/index.js.map +1 -1
  230. package/dist/features/upload/server/graphQLPopulationPromise.d.ts +1 -1
  231. package/dist/features/upload/server/graphQLPopulationPromise.d.ts.map +1 -1
  232. package/dist/features/upload/server/graphQLPopulationPromise.js.map +1 -1
  233. package/dist/features/upload/server/index.d.ts +1 -0
  234. package/dist/features/upload/server/index.d.ts.map +1 -1
  235. package/dist/features/upload/server/index.js +3 -2
  236. package/dist/features/upload/server/index.js.map +1 -1
  237. package/dist/features/upload/server/nodes/UploadNode.d.ts +1 -55
  238. package/dist/features/upload/server/nodes/UploadNode.d.ts.map +1 -1
  239. package/dist/features/upload/server/nodes/UploadNode.js.map +1 -1
  240. package/dist/features/upload/server/nodes/conversions.d.ts.map +1 -1
  241. package/dist/features/upload/server/nodes/conversions.js.map +1 -1
  242. package/dist/features/upload/server/schema.d.ts +52 -0
  243. package/dist/features/upload/server/schema.d.ts.map +1 -0
  244. package/dist/features/upload/server/schema.js +129 -0
  245. package/dist/features/upload/server/schema.js.map +1 -0
  246. package/dist/features/upload/server/validate.d.ts +1 -1
  247. package/dist/features/upload/server/validate.d.ts.map +1 -1
  248. package/dist/features/upload/server/validate.js.map +1 -1
  249. package/dist/field/Diff/converters/upload/index.js.map +1 -1
  250. package/dist/field/bundled.css +1 -1
  251. package/dist/field/clientEntry.d.ts +29 -0
  252. package/dist/field/clientEntry.d.ts.map +1 -0
  253. package/dist/field/clientEntry.js +86 -0
  254. package/dist/field/clientEntry.js.map +1 -0
  255. package/dist/field/index.css +12 -12
  256. package/dist/field/index.js +1 -1
  257. package/dist/field/index.js.map +1 -1
  258. package/dist/field/rscEntry.d.ts.map +1 -1
  259. package/dist/field/rscEntry.js +2 -0
  260. package/dist/field/rscEntry.js.map +1 -1
  261. package/dist/index.d.ts +8 -5
  262. package/dist/index.d.ts.map +1 -1
  263. package/dist/index.js +47 -4
  264. package/dist/index.js.map +1 -1
  265. package/dist/lexical/LexicalEditor.d.ts.map +1 -1
  266. package/dist/lexical/LexicalEditor.js +36 -2
  267. package/dist/lexical/LexicalEditor.js.map +1 -1
  268. package/dist/lexical/LexicalProvider.d.ts.map +1 -1
  269. package/dist/lexical/LexicalProvider.js +22 -7
  270. package/dist/lexical/LexicalProvider.js.map +1 -1
  271. package/dist/lexical/config/client/loader.d.ts.map +1 -1
  272. package/dist/lexical/config/client/loader.js +5 -1
  273. package/dist/lexical/config/client/loader.js.map +1 -1
  274. package/dist/lexical/config/server/sanitize.d.ts.map +1 -1
  275. package/dist/lexical/config/server/sanitize.js +9 -11
  276. package/dist/lexical/config/server/sanitize.js.map +1 -1
  277. package/dist/packages/@lexical/markdown/LexicalMarkdownHardLineBreak.spec.js +160 -0
  278. package/dist/packages/@lexical/markdown/LexicalMarkdownHardLineBreak.spec.js.map +1 -0
  279. package/dist/packages/@lexical/markdown/MarkdownExport.d.ts.map +1 -1
  280. package/dist/packages/@lexical/markdown/MarkdownExport.js +9 -2
  281. package/dist/packages/@lexical/markdown/MarkdownExport.js.map +1 -1
  282. package/dist/packages/@lexical/markdown/MarkdownImport.d.ts.map +1 -1
  283. package/dist/packages/@lexical/markdown/MarkdownImport.js +3 -2
  284. package/dist/packages/@lexical/markdown/MarkdownImport.js.map +1 -1
  285. package/dist/packages/@lexical/markdown/MarkdownTransformers.d.ts +27 -1
  286. package/dist/packages/@lexical/markdown/MarkdownTransformers.d.ts.map +1 -1
  287. package/dist/packages/@lexical/markdown/MarkdownTransformers.js +88 -4
  288. package/dist/packages/@lexical/markdown/MarkdownTransformers.js.map +1 -1
  289. package/dist/types/builtInNodes.d.ts +14 -0
  290. package/dist/types/builtInNodes.d.ts.map +1 -0
  291. package/dist/types/builtInNodes.js +203 -0
  292. package/dist/types/builtInNodes.js.map +1 -0
  293. package/dist/types/index.d.ts +16 -17
  294. package/dist/types/index.d.ts.map +1 -1
  295. package/dist/types/index.js.map +1 -1
  296. package/dist/types/jsonSchemaHelpers.d.ts +30 -0
  297. package/dist/types/jsonSchemaHelpers.d.ts.map +1 -0
  298. package/dist/types/jsonSchemaHelpers.js +58 -0
  299. package/dist/types/jsonSchemaHelpers.js.map +1 -0
  300. package/dist/types/nodeTypes.d.ts +115 -61
  301. package/dist/types/nodeTypes.d.ts.map +1 -1
  302. package/dist/types/nodeTypes.js +3 -2
  303. package/dist/types/nodeTypes.js.map +1 -1
  304. package/dist/types/schema.d.ts.map +1 -1
  305. package/dist/types/schema.js +67 -65
  306. package/dist/types/schema.js.map +1 -1
  307. package/dist/utilities/applyBaseFilterToFields.d.ts.map +1 -1
  308. package/dist/utilities/applyBaseFilterToFields.js +1 -2
  309. package/dist/utilities/applyBaseFilterToFields.js.map +1 -1
  310. package/dist/utilities/buildEditorState.d.ts +17 -3
  311. package/dist/utilities/buildEditorState.d.ts.map +1 -1
  312. package/dist/utilities/buildEditorState.js +8 -0
  313. package/dist/utilities/buildEditorState.js.map +1 -1
  314. package/dist/utilities/buildInitialState.d.ts +2 -1
  315. package/dist/utilities/buildInitialState.d.ts.map +1 -1
  316. package/dist/utilities/buildInitialState.js.map +1 -1
  317. package/dist/utilities/fieldsDrawer/Drawer.d.ts.map +1 -1
  318. package/dist/utilities/fieldsDrawer/Drawer.js +19 -10
  319. package/dist/utilities/fieldsDrawer/Drawer.js.map +1 -1
  320. package/dist/utilities/fieldsDrawer/DrawerContent.d.ts +4 -1
  321. package/dist/utilities/fieldsDrawer/DrawerContent.d.ts.map +1 -1
  322. package/dist/utilities/fieldsDrawer/DrawerContent.js +8 -7
  323. package/dist/utilities/fieldsDrawer/DrawerContent.js.map +1 -1
  324. package/dist/utilities/fieldsDrawer/index.css +12 -0
  325. package/dist/utilities/fieldsDrawer/useDrawerSubmit.d.ts +29 -0
  326. package/dist/utilities/fieldsDrawer/useDrawerSubmit.d.ts.map +1 -0
  327. package/dist/utilities/fieldsDrawer/useDrawerSubmit.js +97 -0
  328. package/dist/utilities/fieldsDrawer/useDrawerSubmit.js.map +1 -0
  329. package/dist/utilities/generateImportMap.d.ts.map +1 -1
  330. package/dist/utilities/generateImportMap.js +7 -3
  331. package/dist/utilities/generateImportMap.js.map +1 -1
  332. package/dist/utilities/upgradeLexicalData/upgradeDocumentFieldsRecursively.js +1 -1
  333. package/dist/utilities/upgradeLexicalData/upgradeDocumentFieldsRecursively.js.map +1 -1
  334. package/package.json +8 -7
  335. package/dist/exports/client/Field-G5Z2HM5Y.js +0 -2
  336. package/dist/exports/client/Field-G5Z2HM5Y.js.map +0 -7
  337. package/dist/exports/client/RelationshipComponent-RZL743CS.js.map +0 -7
  338. package/dist/exports/client/chunk-6QWQ7JV4.js +0 -2
  339. package/dist/exports/client/chunk-6QWQ7JV4.js.map +0 -7
  340. package/dist/exports/client/chunk-FEJXFRL7.js +0 -2
  341. package/dist/exports/client/chunk-FEJXFRL7.js.map +0 -7
  342. package/dist/exports/client/chunk-INBEEENE.js +0 -2
  343. package/dist/exports/client/chunk-INBEEENE.js.map +0 -7
  344. package/dist/exports/client/chunk-LH634DPU.js +0 -12
  345. package/dist/exports/client/chunk-LH634DPU.js.map +0 -7
  346. package/dist/exports/client/component-CVM4OESA.js.map +0 -7
  347. package/dist/exports/client/componentInline-JJZ2NKW2.js +0 -2
  348. package/dist/features/link/nodes/types.d.ts +0 -27
  349. package/dist/features/link/nodes/types.d.ts.map +0 -1
  350. package/dist/features/link/nodes/types.js +0 -2
  351. package/dist/features/link/nodes/types.js.map +0 -1
  352. /package/dist/exports/client/{componentInline-JJZ2NKW2.js.map → componentInline-H24N7GUG.js.map} +0 -0
@@ -10,7 +10,7 @@ import { RichTextPlugin } from '@lexical/react/LexicalRichTextPlugin.js';
10
10
  import { useLexicalEditable } from '@lexical/react/useLexicalEditable';
11
11
  import { BLUR_COMMAND, COMMAND_PRIORITY_LOW, FOCUS_COMMAND } from 'lexical';
12
12
  import * as React from 'react';
13
- import { useEffect, useState } from 'react';
13
+ import { useCallback, useEffect, useState } from 'react';
14
14
  import { useEditorConfigContext } from './config/client/EditorConfigProvider.js';
15
15
  import './LexicalEditor.css';
16
16
  import { EditorPlugin } from './EditorPlugin.js';
@@ -26,6 +26,40 @@ import { SelectAllPlugin } from './plugins/SelectAllPlugin/index.js';
26
26
  import { SlashMenuPlugin } from './plugins/SlashMenu/index.js';
27
27
  import { TextPlugin } from './plugins/TextPlugin/index.js';
28
28
  import { LexicalContentEditable } from './ui/ContentEditable.js';
29
+ /**
30
+ * Marks the Lexical root element with `data-lexical-editable` once the editor
31
+ * is mounted and interactive. Tests can query this attribute to confirm that
32
+ * React event handlers are attached and keyboard input will be processed.
33
+ */
34
+ function EditorReadyPlugin() {
35
+ const $ = _c(3);
36
+ const [editor] = useLexicalComposerContext();
37
+ let t0;
38
+ let t1;
39
+ if ($[0] !== editor) {
40
+ t0 = () => {
41
+ const root = editor.getRootElement();
42
+ if (root) {
43
+ root.dataset.lexicalEditable = String(editor.isEditable());
44
+ }
45
+ return editor.registerEditableListener(editable => {
46
+ const el = editor.getRootElement();
47
+ if (el) {
48
+ el.dataset.lexicalEditable = String(editable);
49
+ }
50
+ });
51
+ };
52
+ t1 = [editor];
53
+ $[0] = editor;
54
+ $[1] = t0;
55
+ $[2] = t1;
56
+ } else {
57
+ t0 = $[1];
58
+ t1 = $[2];
59
+ }
60
+ useEffect(t0, t1);
61
+ return null;
62
+ }
29
63
  export const LexicalEditor = props => {
30
64
  const $ = _c(13);
31
65
  const {
@@ -111,7 +145,7 @@ export const LexicalEditor = props => {
111
145
  })
112
146
  }),
113
147
  ErrorBoundary: LexicalErrorBoundary
114
- }), _jsx(NormalizeSelectionPlugin, {}), isEditable && _jsx(InsertParagraphAtEndPlugin, {}), _jsx(DecoratorPlugin, {}), _jsx(ClipboardPlugin, {}), _jsx(TextPlugin, {
148
+ }), _jsx(EditorReadyPlugin, {}), _jsx(NormalizeSelectionPlugin, {}), isEditable && _jsx(InsertParagraphAtEndPlugin, {}), _jsx(DecoratorPlugin, {}), _jsx(ClipboardPlugin, {}), _jsx(TextPlugin, {
115
149
  features: editorConfig.features
116
150
  }), _jsx(SelectAllPlugin, {}), _jsx(NodeViewOverridePlugin, {}), isEditable && _jsx(OnChangePlugin, {
117
151
  ignoreSelectionChange: true,
@@ -1 +1 @@
1
- {"version":3,"file":"LexicalEditor.js","names":["c","_c","useLexicalComposerContext","LexicalErrorBoundary","HistoryPlugin","OnChangePlugin","RichTextPlugin","useLexicalEditable","BLUR_COMMAND","COMMAND_PRIORITY_LOW","FOCUS_COMMAND","React","useEffect","useState","useEditorConfigContext","EditorPlugin","ClipboardPlugin","DecoratorPlugin","AddBlockHandlePlugin","DraggableBlockPlugin","InsertParagraphAtEndPlugin","MarkdownShortcutPlugin","NodeViewOverridePlugin","NormalizeSelectionPlugin","SelectAllPlugin","SlashMenuPlugin","TextPlugin","LexicalContentEditable","LexicalEditor","props","$","editorConfig","editorContainerRef","isSmallWidthViewport","onChange","rtl","editorConfigContext","editor","isEditable","floatingAnchorElem","setFloatingAnchorElem","t0","Symbol","for","_floatingAnchorElem","onRef","t1","t2","uuid","console","error","parentEditor","registerChild","handleFocus","focusEditor","handleBlur","blurEditor","unregisterFocus","registerCommand","unregisterBlur","unregisterChild","t3","_jsxs","Fragment","children","features","plugins","map","_temp","className","dir","undefined","ref","_temp2","_jsx","contentEditable","ignoreSelectionChange","editorState","editor_0","tags","has","size","admin","hideDraggableBlockElement","anchorElem","hideAddBlockButton","plugin_1","plugin","position","desktopOnly","clientProps","key","markdownTransformers","length","_temp3","_temp4","_temp5","plugin_0","plugin_2","plugin_3","plugin_4"],"sources":["../../src/lexical/LexicalEditor.tsx"],"sourcesContent":["'use client'\nimport { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext.js'\nimport { LexicalErrorBoundary } from '@lexical/react/LexicalErrorBoundary.js'\nimport { HistoryPlugin } from '@lexical/react/LexicalHistoryPlugin.js'\nimport { OnChangePlugin } from '@lexical/react/LexicalOnChangePlugin.js'\nimport { RichTextPlugin } from '@lexical/react/LexicalRichTextPlugin.js'\nimport { useLexicalEditable } from '@lexical/react/useLexicalEditable'\nimport { BLUR_COMMAND, COMMAND_PRIORITY_LOW, FOCUS_COMMAND } from 'lexical'\nimport * as React from 'react'\nimport { useEffect, useState } from 'react'\n\nimport type { LexicalProviderProps } from './LexicalProvider.js'\n\nimport { useEditorConfigContext } from './config/client/EditorConfigProvider.js'\nimport './LexicalEditor.css'\nimport { EditorPlugin } from './EditorPlugin.js'\nimport { ClipboardPlugin } from './plugins/ClipboardPlugin/index.js'\nimport { DecoratorPlugin } from './plugins/DecoratorPlugin/index.js'\nimport { AddBlockHandlePlugin } from './plugins/handles/AddBlockHandlePlugin/index.js'\nimport { DraggableBlockPlugin } from './plugins/handles/DraggableBlockPlugin/index.js'\nimport { InsertParagraphAtEndPlugin } from './plugins/InsertParagraphAtEnd/index.js'\nimport { MarkdownShortcutPlugin } from './plugins/MarkdownShortcut/index.js'\nimport { NodeViewOverridePlugin } from './plugins/NodeViewOverridePlugin/index.js'\nimport { NormalizeSelectionPlugin } from './plugins/NormalizeSelection/index.js'\nimport { SelectAllPlugin } from './plugins/SelectAllPlugin/index.js'\nimport { SlashMenuPlugin } from './plugins/SlashMenu/index.js'\nimport { TextPlugin } from './plugins/TextPlugin/index.js'\nimport { LexicalContentEditable } from './ui/ContentEditable.js'\n\nexport const LexicalEditor: React.FC<\n {\n editorContainerRef: React.RefObject<HTMLDivElement | null>\n isSmallWidthViewport: boolean\n } & Pick<LexicalProviderProps, 'editorConfig' | 'onChange' | 'rtl'>\n> = (props) => {\n const { editorConfig, editorContainerRef, isSmallWidthViewport, onChange, rtl } = props\n const editorConfigContext = useEditorConfigContext()\n const [editor] = useLexicalComposerContext()\n const isEditable = useLexicalEditable()\n\n const [floatingAnchorElem, setFloatingAnchorElem] = useState<HTMLDivElement | null>(null)\n const onRef = (_floatingAnchorElem: HTMLDivElement) => {\n if (_floatingAnchorElem !== null) {\n setFloatingAnchorElem(_floatingAnchorElem)\n }\n }\n\n useEffect(() => {\n if (!editorConfigContext?.uuid) {\n console.error('Lexical Editor must be used within an EditorConfigProvider')\n return\n }\n if (editorConfigContext?.parentEditor?.uuid) {\n editorConfigContext.parentEditor?.registerChild(editorConfigContext.uuid, editorConfigContext)\n }\n\n const handleFocus = () => {\n editorConfigContext.focusEditor(editorConfigContext)\n }\n\n const handleBlur = () => {\n editorConfigContext.blurEditor(editorConfigContext)\n }\n\n const unregisterFocus = editor.registerCommand<MouseEvent>(\n FOCUS_COMMAND,\n () => {\n handleFocus()\n return true\n },\n COMMAND_PRIORITY_LOW,\n )\n\n const unregisterBlur = editor.registerCommand<MouseEvent>(\n BLUR_COMMAND,\n () => {\n handleBlur()\n return true\n },\n COMMAND_PRIORITY_LOW,\n )\n\n return () => {\n unregisterFocus()\n unregisterBlur()\n editorConfigContext.parentEditor?.unregisterChild?.(editorConfigContext.uuid)\n }\n }, [editor, editorConfigContext])\n\n return (\n <React.Fragment>\n {editorConfig.features.plugins?.map((plugin) => {\n if (plugin.position === 'aboveContainer') {\n return <EditorPlugin clientProps={plugin.clientProps} key={plugin.key} plugin={plugin} />\n }\n })}\n <div className=\"editor-container\" dir={rtl ? 'rtl' : undefined} ref={editorContainerRef}>\n {editorConfig.features.plugins?.map((plugin) => {\n if (plugin.position === 'top') {\n return (\n <EditorPlugin clientProps={plugin.clientProps} key={plugin.key} plugin={plugin} />\n )\n }\n })}\n <RichTextPlugin\n contentEditable={\n <div className=\"editor-scroller\">\n <div className=\"editor\" ref={onRef}>\n <LexicalContentEditable editorConfig={editorConfig} />\n </div>\n </div>\n }\n ErrorBoundary={LexicalErrorBoundary}\n />\n <NormalizeSelectionPlugin />\n {isEditable && <InsertParagraphAtEndPlugin />}\n <DecoratorPlugin />\n <ClipboardPlugin />\n <TextPlugin features={editorConfig.features} />\n <SelectAllPlugin />\n <NodeViewOverridePlugin />\n {isEditable && (\n <OnChangePlugin\n // Selection changes can be ignored here, reducing the\n // frequency that the FieldComponent and Payload receive updates.\n // Selection changes are only needed if you are saving selection state\n ignoreSelectionChange\n onChange={(editorState, editor, tags) => {\n // Ignore any onChange event triggered by focus only\n if (!tags.has('focus') || tags.size > 1) {\n if (onChange != null) {\n onChange(editorState, editor, tags)\n }\n }\n }}\n />\n )}\n {floatingAnchorElem && (\n <React.Fragment>\n {!isSmallWidthViewport && isEditable && (\n <React.Fragment>\n {editorConfig.admin?.hideDraggableBlockElement ? null : (\n <DraggableBlockPlugin anchorElem={floatingAnchorElem} />\n )}\n {editorConfig.admin?.hideAddBlockButton ? null : (\n <AddBlockHandlePlugin anchorElem={floatingAnchorElem} />\n )}\n </React.Fragment>\n )}\n {editorConfig.features.plugins?.map((plugin) => {\n if (\n plugin.position === 'floatingAnchorElem' &&\n !(plugin.desktopOnly === true && isSmallWidthViewport)\n ) {\n return (\n <EditorPlugin\n anchorElem={floatingAnchorElem}\n clientProps={plugin.clientProps}\n key={plugin.key}\n plugin={plugin}\n />\n )\n }\n })}\n {isEditable && (\n <React.Fragment>\n <SlashMenuPlugin anchorElem={floatingAnchorElem} />\n </React.Fragment>\n )}\n </React.Fragment>\n )}\n {isEditable && (\n <React.Fragment>\n <HistoryPlugin />\n {editorConfig?.features?.markdownTransformers?.length > 0 && <MarkdownShortcutPlugin />}\n </React.Fragment>\n )}\n {editorConfig.features.plugins?.map((plugin) => {\n if (plugin.position === 'normal') {\n return (\n <EditorPlugin clientProps={plugin.clientProps} key={plugin.key} plugin={plugin} />\n )\n }\n })}\n {editorConfig.features.plugins?.map((plugin) => {\n if (plugin.position === 'bottom') {\n return (\n <EditorPlugin clientProps={plugin.clientProps} key={plugin.key} plugin={plugin} />\n )\n }\n })}\n </div>\n {editorConfig.features.plugins?.map((plugin) => {\n if (plugin.position === 'belowContainer') {\n return <EditorPlugin clientProps={plugin.clientProps} key={plugin.key} plugin={plugin} />\n }\n })}\n </React.Fragment>\n )\n}\n"],"mappings":"AAAA;;AAAA,SAAAA,CAAA,IAAAC,EAAA;;AACA,SAASC,yBAAyB,QAAQ;AAC1C,SAASC,oBAAoB,QAAQ;AACrC,SAASC,aAAa,QAAQ;AAC9B,SAASC,cAAc,QAAQ;AAC/B,SAASC,cAAc,QAAQ;AAC/B,SAASC,kBAAkB,QAAQ;AACnC,SAASC,YAAY,EAAEC,oBAAoB,EAAEC,aAAa,QAAQ;AAClE,YAAYC,KAAA,MAAW;AACvB,SAASC,SAAS,EAAEC,QAAQ,QAAQ;AAIpC,SAASC,sBAAsB,QAAQ;AACvC,OAAO;AACP,SAASC,YAAY,QAAQ;AAC7B,SAASC,eAAe,QAAQ;AAChC,SAASC,eAAe,QAAQ;AAChC,SAASC,oBAAoB,QAAQ;AACrC,SAASC,oBAAoB,QAAQ;AACrC,SAASC,0BAA0B,QAAQ;AAC3C,SAASC,sBAAsB,QAAQ;AACvC,SAASC,sBAAsB,QAAQ;AACvC,SAASC,wBAAwB,QAAQ;AACzC,SAASC,eAAe,QAAQ;AAChC,SAASC,eAAe,QAAQ;AAChC,SAASC,UAAU,QAAQ;AAC3B,SAASC,sBAAsB,QAAQ;AAEvC,OAAO,MAAMC,aAAA,GAKTC,KAAA;EAAA,MAAAC,CAAA,GAAA7B,EAAA;EACF;IAAA8B,YAAA;IAAAC,kBAAA;IAAAC,o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A;EAAA,IAuJUZ,QAAA,CAAAC,QAAA,KAAoB;IAAA,OAEpBd,IAAA,CAAA3D,YAAA;MAAA2E,WAAA,EAA2BH,QAAA,CAAAG,WAAA;MAAAH,MAAA,EAA6CA;IAAA,GAApBA,QAAA,CAAAI,GAAU;EAAA;AAAA;AAzJxE,SAAAK,OAAAI,QAAA;EAAA,IA+JQb,QAAA,CAAAC,QAAA,KAAoB;IAAA,OACfd,IAAA,CAAA3D,YAAA;MAAA2E,WAAA,EAA2BH,QAAA,CAAAG,WAAA;MAAAH,MAAA,EAA6CA;IAAA,GAApBA,QAAA,CAAAI,GAAU;EAAA;AAAA","ignoreList":[]}
1
+ {"version":3,"file":"LexicalEditor.js","names":["c","_c","useLexicalComposerContext","LexicalErrorBoundary","HistoryPlugin","OnChangePlugin","RichTextPlugin","useLexicalEditable","BLUR_COMMAND","COMMAND_PRIORITY_LOW","FOCUS_COMMAND","React","useCallback","useEffect","useState","useEditorConfigContext","EditorPlugin","ClipboardPlugin","DecoratorPlugin","AddBlockHandlePlugin","DraggableBlockPlugin","InsertParagraphAtEndPlugin","MarkdownShortcutPlugin","NodeViewOverridePlugin","NormalizeSelectionPlugin","SelectAllPlugin","SlashMenuPlugin","TextPlugin","LexicalContentEditable","EditorReadyPlugin","$","editor","t0","t1","root","getRootElement","dataset","lexicalEditable","String","isEditable","registerEditableListener","editable","el","LexicalEditor","props","editorConfig","editorContainerRef","isSmallWidthViewport","onChange","rtl","editorConfigContext","floatingAnchorElem","setFloatingAnchorElem","Symbol","for","_floatingAnchorElem","onRef","t2","uuid","console","error","parentEditor","registerChild","handleFocus","focusEditor","handleBlur","blurEditor","unregisterFocus","registerCommand","unregisterBlur","unregisterChild","t3","_jsxs","Fragment","children","features","plugins","map","_temp","className","dir","undefined","ref","_temp2","_jsx","contentEditable","ignoreSelectionChange","editorState","editor_0","tags","has","size","admin","hideDraggableBlockElement","anchorElem","hideAddBlockButton","plugin_1","plugin","position","desktopOnly","clientProps","key","markdownTransformers","length","_temp3","_temp4","_temp5","plugin_0","plugin_2","plugin_3","plugin_4"],"sources":["../../src/lexical/LexicalEditor.tsx"],"sourcesContent":["'use client'\nimport { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext.js'\nimport { LexicalErrorBoundary } from '@lexical/react/LexicalErrorBoundary.js'\nimport { HistoryPlugin } from '@lexical/react/LexicalHistoryPlugin.js'\nimport { OnChangePlugin } from '@lexical/react/LexicalOnChangePlugin.js'\nimport { RichTextPlugin } from '@lexical/react/LexicalRichTextPlugin.js'\nimport { useLexicalEditable } from '@lexical/react/useLexicalEditable'\nimport { BLUR_COMMAND, COMMAND_PRIORITY_LOW, FOCUS_COMMAND } from 'lexical'\nimport * as React from 'react'\nimport { useCallback, useEffect, useState } from 'react'\n\nimport type { LexicalProviderProps } from './LexicalProvider.js'\n\nimport { useEditorConfigContext } from './config/client/EditorConfigProvider.js'\nimport './LexicalEditor.css'\nimport { EditorPlugin } from './EditorPlugin.js'\nimport { ClipboardPlugin } from './plugins/ClipboardPlugin/index.js'\nimport { DecoratorPlugin } from './plugins/DecoratorPlugin/index.js'\nimport { AddBlockHandlePlugin } from './plugins/handles/AddBlockHandlePlugin/index.js'\nimport { DraggableBlockPlugin } from './plugins/handles/DraggableBlockPlugin/index.js'\nimport { InsertParagraphAtEndPlugin } from './plugins/InsertParagraphAtEnd/index.js'\nimport { MarkdownShortcutPlugin } from './plugins/MarkdownShortcut/index.js'\nimport { NodeViewOverridePlugin } from './plugins/NodeViewOverridePlugin/index.js'\nimport { NormalizeSelectionPlugin } from './plugins/NormalizeSelection/index.js'\nimport { SelectAllPlugin } from './plugins/SelectAllPlugin/index.js'\nimport { SlashMenuPlugin } from './plugins/SlashMenu/index.js'\nimport { TextPlugin } from './plugins/TextPlugin/index.js'\nimport { LexicalContentEditable } from './ui/ContentEditable.js'\n\n/**\n * Marks the Lexical root element with `data-lexical-editable` once the editor\n * is mounted and interactive. Tests can query this attribute to confirm that\n * React event handlers are attached and keyboard input will be processed.\n */\nfunction EditorReadyPlugin() {\n const [editor] = useLexicalComposerContext()\n\n useEffect(() => {\n const root = editor.getRootElement()\n if (root) {\n root.dataset.lexicalEditable = String(editor.isEditable())\n }\n return editor.registerEditableListener((editable) => {\n const el = editor.getRootElement()\n if (el) {\n el.dataset.lexicalEditable = String(editable)\n }\n })\n }, [editor])\n\n return null\n}\n\nexport const LexicalEditor: React.FC<\n {\n editorContainerRef: React.RefObject<HTMLDivElement | null>\n isSmallWidthViewport: boolean\n } & Pick<LexicalProviderProps, 'editorConfig' | 'onChange' | 'rtl'>\n> = (props) => {\n const { editorConfig, editorContainerRef, isSmallWidthViewport, onChange, rtl } = props\n const editorConfigContext = useEditorConfigContext()\n const [editor] = useLexicalComposerContext()\n const isEditable = useLexicalEditable()\n\n const [floatingAnchorElem, setFloatingAnchorElem] = useState<HTMLDivElement | null>(null)\n const onRef = useCallback((_floatingAnchorElem: HTMLDivElement) => {\n if (_floatingAnchorElem !== null) {\n setFloatingAnchorElem(_floatingAnchorElem)\n }\n }, [])\n\n useEffect(() => {\n if (!editorConfigContext?.uuid) {\n console.error('Lexical Editor must be used within an EditorConfigProvider')\n return\n }\n if (editorConfigContext?.parentEditor?.uuid) {\n editorConfigContext.parentEditor?.registerChild(editorConfigContext.uuid, editorConfigContext)\n }\n\n const handleFocus = () => {\n editorConfigContext.focusEditor(editorConfigContext)\n }\n\n const handleBlur = () => {\n editorConfigContext.blurEditor(editorConfigContext)\n }\n\n const unregisterFocus = editor.registerCommand<MouseEvent>(\n FOCUS_COMMAND,\n () => {\n handleFocus()\n return true\n },\n COMMAND_PRIORITY_LOW,\n )\n\n const unregisterBlur = editor.registerCommand<MouseEvent>(\n BLUR_COMMAND,\n () => {\n handleBlur()\n return true\n },\n COMMAND_PRIORITY_LOW,\n )\n\n return () => {\n unregisterFocus()\n unregisterBlur()\n editorConfigContext.parentEditor?.unregisterChild?.(editorConfigContext.uuid)\n }\n }, [editor, editorConfigContext])\n\n return (\n <React.Fragment>\n {editorConfig.features.plugins?.map((plugin) => {\n if (plugin.position === 'aboveContainer') {\n return <EditorPlugin clientProps={plugin.clientProps} key={plugin.key} plugin={plugin} />\n }\n })}\n <div className=\"editor-container\" dir={rtl ? 'rtl' : undefined} ref={editorContainerRef}>\n {editorConfig.features.plugins?.map((plugin) => {\n if (plugin.position === 'top') {\n return (\n <EditorPlugin clientProps={plugin.clientProps} key={plugin.key} plugin={plugin} />\n )\n }\n })}\n <RichTextPlugin\n contentEditable={\n <div className=\"editor-scroller\">\n <div className=\"editor\" ref={onRef}>\n <LexicalContentEditable editorConfig={editorConfig} />\n </div>\n </div>\n }\n ErrorBoundary={LexicalErrorBoundary}\n />\n <EditorReadyPlugin />\n <NormalizeSelectionPlugin />\n {isEditable && <InsertParagraphAtEndPlugin />}\n <DecoratorPlugin />\n <ClipboardPlugin />\n <TextPlugin features={editorConfig.features} />\n <SelectAllPlugin />\n <NodeViewOverridePlugin />\n {isEditable && (\n <OnChangePlugin\n // Selection changes can be ignored here, reducing the\n // frequency that the FieldComponent and Payload receive updates.\n // Selection changes are only needed if you are saving selection state\n ignoreSelectionChange\n onChange={(editorState, editor, tags) => {\n // Ignore any onChange event triggered by focus only\n if (!tags.has('focus') || tags.size > 1) {\n if (onChange != null) {\n onChange(editorState, editor, tags)\n }\n }\n }}\n />\n )}\n {floatingAnchorElem && (\n <React.Fragment>\n {!isSmallWidthViewport && isEditable && (\n <React.Fragment>\n {editorConfig.admin?.hideDraggableBlockElement ? null : (\n <DraggableBlockPlugin anchorElem={floatingAnchorElem} />\n )}\n {editorConfig.admin?.hideAddBlockButton ? null : (\n <AddBlockHandlePlugin anchorElem={floatingAnchorElem} />\n )}\n </React.Fragment>\n )}\n {editorConfig.features.plugins?.map((plugin) => {\n if (\n plugin.position === 'floatingAnchorElem' &&\n !(plugin.desktopOnly === true && isSmallWidthViewport)\n ) {\n return (\n <EditorPlugin\n anchorElem={floatingAnchorElem}\n clientProps={plugin.clientProps}\n key={plugin.key}\n plugin={plugin}\n />\n )\n }\n })}\n {isEditable && (\n <React.Fragment>\n <SlashMenuPlugin anchorElem={floatingAnchorElem} />\n </React.Fragment>\n )}\n </React.Fragment>\n )}\n {isEditable && (\n <React.Fragment>\n <HistoryPlugin />\n {editorConfig?.features?.markdownTransformers?.length > 0 && <MarkdownShortcutPlugin />}\n </React.Fragment>\n )}\n {editorConfig.features.plugins?.map((plugin) => {\n if (plugin.position === 'normal') {\n return (\n <EditorPlugin clientProps={plugin.clientProps} key={plugin.key} plugin={plugin} />\n )\n }\n })}\n {editorConfig.features.plugins?.map((plugin) => {\n if (plugin.position === 'bottom') {\n return (\n <EditorPlugin clientProps={plugin.clientProps} key={plugin.key} plugin={plugin} />\n )\n }\n })}\n </div>\n {editorConfig.features.plugins?.map((plugin) => {\n if (plugin.position === 'belowContainer') {\n return <EditorPlugin clientProps={plugin.clientProps} key={plugin.key} plugin={plugin} />\n }\n })}\n </React.Fragment>\n )\n}\n"],"mappings":"AAAA;;AAAA,SAAAA,CAAA,IAAAC,EAAA;;AACA,SAASC,yBAAyB,QAAQ;AAC1C,SAASC,oBAAoB,QAAQ;AACrC,SAASC,aAAa,QAAQ;AAC9B,SAASC,cAAc,QAAQ;AAC/B,SAASC,cAAc,QAAQ;AAC/B,SAASC,kBAAkB,QAAQ;AACnC,SAASC,YAAY,EAAEC,oBAAoB,EAAEC,aAAa,QAAQ;AAClE,YAAYC,KAAA,MAAW;AACvB,SAASC,WAAW,EAAEC,SAAS,EAAEC,QAAQ,QAAQ;AAIjD,SAASC,sBAAsB,QAAQ;AACvC,OAAO;AACP,SAASC,YAAY,QAAQ;AAC7B,SAASC,eAAe,QAAQ;AAChC,SAASC,eAAe,QAAQ;AAChC,SAASC,oBAAoB,QAAQ;AACrC,SAASC,oBAAoB,QAAQ;AACrC,SAASC,0BAA0B,QAAQ;AAC3C,SAASC,sBAAsB,QAAQ;AACvC,SAASC,sBAAsB,QAAQ;AACvC,SAASC,wBAAwB,QAAQ;AACzC,SAASC,eAAe,Q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EAAA;AAAA;AA1JxE,SAAAK,OAAAI,QAAA;EAAA,IAgKQb,QAAA,CAAAC,QAAA,KAAoB;IAAA,OACfd,IAAA,CAAApE,YAAA;MAAAoF,WAAA,EAA2BH,QAAA,CAAAG,WAAA;MAAAH,MAAA,EAA6CA;IAAA,GAApBA,QAAA,CAAAI,GAAU;EAAA;AAAA","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"LexicalProvider.d.ts","sourceRoot":"","sources":["../../src/lexical/LexicalProvider.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,aAAa,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAA;AAIhF,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAG9B,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,mBAAmB,CAAA;AAClE,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,mBAAmB,CAAA;AAUpE,MAAM,MAAM,oBAAoB,GAAG;IACjC,WAAW,EAAE,MAAM,CAAA;IACnB,YAAY,EAAE,2BAA2B,CAAA;IACzC,UAAU,EAAE,yBAAyB,CAAA;IACrC,oBAAoB,EAAE,OAAO,CAAA;IAC7B,QAAQ,EAAE,CAAC,WAAW,EAAE,WAAW,EAAE,MAAM,EAAE,aAAa,EAAE,IAAI,EAAE,GAAG,CAAC,MAAM,CAAC,KAAK,IAAI,CAAA;IACtF,QAAQ,EAAE,OAAO,CAAA;IACjB,GAAG,CAAC,EAAE,OAAO,CAAA;IACb,KAAK,EAAE,qBAAqB,CAAA;CAC7B,CAAA;AAwBD,eAAO,MAAM,eAAe,EAAE,KAAK,CAAC,EAAE,CAAC,oBAAoB,CA8F1D,CAAA"}
1
+ {"version":3,"file":"LexicalProvider.d.ts","sourceRoot":"","sources":["../../src/lexical/LexicalProvider.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,aAAa,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAA;AAIhF,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAG9B,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,mBAAmB,CAAA;AAClE,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,mBAAmB,CAAA;AAUpE,MAAM,MAAM,oBAAoB,GAAG;IACjC,WAAW,EAAE,MAAM,CAAA;IACnB,YAAY,EAAE,2BAA2B,CAAA;IACzC,UAAU,EAAE,yBAAyB,CAAA;IACrC,oBAAoB,EAAE,OAAO,CAAA;IAC7B,QAAQ,EAAE,CAAC,WAAW,EAAE,WAAW,EAAE,MAAM,EAAE,aAAa,EAAE,IAAI,EAAE,GAAG,CAAC,MAAM,CAAC,KAAK,IAAI,CAAA;IACtF,QAAQ,EAAE,OAAO,CAAA;IACjB,GAAG,CAAC,EAAE,OAAO,CAAA;IACb,KAAK,EAAE,qBAAqB,CAAA;CAC7B,CAAA;AAwBD,eAAO,MAAM,eAAe,EAAE,KAAK,CAAC,EAAE,CAAC,oBAAoB,CAgH1D,CAAA"}
@@ -47,7 +47,8 @@ export const LexicalProvider = props => {
47
47
  const parentContext = useEditorConfigContext();
48
48
  const editDepth = useEditDepth();
49
49
  const editorContainerRef = React.useRef(null);
50
- // useMemo for the initialConfig that depends on readOnly and value
50
+ // useMemo for the initialConfig. `readOnly` and `value` are intentionally excluded from deps
51
+ // to avoid full remounts on every save (which would destroy cursor position and undo history).
51
52
  const initialConfig = useMemo(() => {
52
53
  if (value && typeof value !== 'object') {
53
54
  throw new Error('The value passed to the Lexical editor is not an object. This is not supported. Please remove the data from the field and start again. This is the value that was passed in: ' + JSON.stringify(value));
@@ -76,16 +77,30 @@ export const LexicalProvider = props => {
76
77
  // Important: do not add readOnly and value to the dependencies array. This will cause the entire lexical editor to re-render if the document is saved, which will
77
78
  // cause the editor to lose focus.
78
79
  }, [editorConfig, views, currentView]);
79
- if (!initialConfig) {
80
+ // Track whether the editor has ever been editable. Once it transitions to editable,
81
+ // we never remount due to transient readOnly changes (e.g. during form save processing).
82
+ const hasBeenEditable = React.useRef(readOnly !== true);
83
+ if (readOnly !== true) {
84
+ hasBeenEditable.current = true;
85
+ }
86
+ // Compute the effective editable state for the config.
87
+ // Override the memoized config's editable value to reflect the current readOnly prop.
88
+ const effectiveConfig = useMemo(() => ({
89
+ ...initialConfig,
90
+ editable: readOnly !== true
91
+ }), [initialConfig, readOnly]);
92
+ if (!effectiveConfig) {
80
93
  return /*#__PURE__*/_jsx("p", {
81
94
  children: "Loading..."
82
95
  });
83
96
  }
84
- // We need to add initialConfig.editable to the key to force a re-render when the readOnly prop changes.
85
- // Without it, there were cases where lexical editors inside drawers turn readOnly initially - a few miliseconds later they turn editable, but the editor does not re-render and stays readOnly.
86
- // We also add currentView to force re-render when the view changes.
97
+ // Use `hasBeenEditable` to build the key: only force a remount when the editor has NEVER
98
+ // been editable and transitions to editable for the first time. After that, LexicalComposer
99
+ // stays mounted (preserving cursor/focus/undo) and we rely on Lexical's internal
100
+ // `editor.setEditable()` for transient readOnly changes during saves.
101
+ const editableKey = hasBeenEditable.current ? 'editable' : 'readonly';
87
102
  return /*#__PURE__*/_jsx(LexicalComposer, {
88
- initialConfig: initialConfig,
103
+ initialConfig: effectiveConfig,
89
104
  children: /*#__PURE__*/_jsx(EditorConfigProvider, {
90
105
  editorConfig: editorConfig,
91
106
  editorContainerRef: editorContainerRef,
@@ -105,6 +120,6 @@ export const LexicalProvider = props => {
105
120
  })
106
121
  })
107
122
  })
108
- }, composerKey + initialConfig.editable + currentView);
123
+ }, composerKey + editableKey + currentView);
109
124
  };
110
125
  //# sourceMappingURL=LexicalProvider.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"LexicalProvider.js","names":["LexicalComposer","useEditDepth","React","useMemo","useRichTextView","EditorConfigProvider","useEditorConfigContext","LexicalEditor","LexicalEditorComponent","getEnabledNodes","NestProviders","children","providers","length","Component","_jsx","slice","LexicalProvider","props","composerKey","editorConfig","fieldProps","isSmallWidthViewport","onChange","readOnly","rtl","value","currentView","views","parentContext","editDepth","editorContainerRef","useRef","initialConfig","Error","JSON","stringify","Array","isArray","nodeViews","nodes","editable","editorState","undefined","namespace","lexical","onError","error","theme","features"],"sources":["../../src/lexical/LexicalProvider.tsx"],"sourcesContent":["'use client'\nimport type { InitialConfigType } from '@lexical/react/LexicalComposer.js'\nimport type { EditorState, LexicalEditor, SerializedEditorState } from 'lexical'\n\nimport { LexicalComposer } from '@lexical/react/LexicalComposer.js'\nimport { useEditDepth } from '@payloadcms/ui'\nimport * as React from 'react'\nimport { useMemo } from 'react'\n\nimport type { LexicalRichTextFieldProps } from '../types/index.js'\nimport type { SanitizedClientEditorConfig } from './config/types.js'\n\nimport { useRichTextView } from '../field/RichTextViewProvider.js'\nimport {\n EditorConfigProvider,\n useEditorConfigContext,\n} from './config/client/EditorConfigProvider.js'\nimport { LexicalEditor as LexicalEditorComponent } from './LexicalEditor.js'\nimport { getEnabledNodes } from './nodes/index.js'\n\nexport type LexicalProviderProps = {\n composerKey: string\n editorConfig: SanitizedClientEditorConfig\n fieldProps: LexicalRichTextFieldProps\n isSmallWidthViewport: boolean\n onChange: (editorState: EditorState, editor: LexicalEditor, tags: Set<string>) => void\n readOnly: boolean\n rtl?: boolean\n value: SerializedEditorState\n}\n\nconst NestProviders = ({\n children,\n providers,\n}: {\n children: React.ReactNode\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n providers: any[]\n}) => {\n if (!providers?.length) {\n return children\n }\n const Component = providers[0]\n if (providers.length > 1) {\n return (\n <Component>\n <NestProviders providers={providers.slice(1)}>{children}</NestProviders>\n </Component>\n )\n }\n return <Component>{children}</Component>\n}\n\nexport const LexicalProvider: React.FC<LexicalProviderProps> = (props) => {\n const {\n composerKey,\n editorConfig,\n fieldProps,\n isSmallWidthViewport,\n onChange,\n readOnly,\n rtl,\n value,\n } = props\n\n const { currentView, views } = useRichTextView()\n\n const parentContext = useEditorConfigContext()\n\n const editDepth = useEditDepth()\n\n const editorContainerRef = React.useRef<HTMLDivElement>(null)\n\n // useMemo for the initialConfig that depends on readOnly and value\n const initialConfig = useMemo<InitialConfigType>(() => {\n if (value && typeof value !== 'object') {\n throw new Error(\n 'The value passed to the Lexical editor is not an object. This is not supported. Please remove the data from the field and start again. This is the value that was passed in: ' +\n JSON.stringify(value),\n )\n }\n\n if (value && Array.isArray(value) && !('root' in value)) {\n throw new Error(\n 'You have tried to pass in data from the old Slate editor to the new Lexical editor. The data structure is different, thus you will have to migrate your data. We offer a one-line migration script which migrates all your rich text fields: https://payloadcms.com/docs/lexical/migration#migration-via-migration-script-recommended',\n )\n }\n\n if (value && 'jsonContent' in value) {\n throw new Error(\n 'You have tried to pass in data from payload-plugin-lexical. The data structure is different, thus you will have to migrate your data. Migration guide: https://payloadcms.com/docs/lexical/migration#migrating-from-payload-plugin-lexical',\n )\n }\n\n // Use the 'default' view if available, otherwise undefined\n const nodeViews = views?.[currentView]?.nodes\n\n return {\n editable: readOnly !== true,\n editorState: value != null ? JSON.stringify(value) : undefined,\n namespace: editorConfig.lexical.namespace,\n nodes: getEnabledNodes({\n editorConfig,\n nodeViews,\n }),\n onError: (error: Error) => {\n throw error\n },\n theme: editorConfig.lexical.theme,\n }\n // Important: do not add readOnly and value to the dependencies array. This will cause the entire lexical editor to re-render if the document is saved, which will\n // cause the editor to lose focus.\n }, [editorConfig, views, currentView])\n\n if (!initialConfig) {\n return <p>Loading...</p>\n }\n\n // We need to add initialConfig.editable to the key to force a re-render when the readOnly prop changes.\n // Without it, there were cases where lexical editors inside drawers turn readOnly initially - a few miliseconds later they turn editable, but the editor does not re-render and stays readOnly.\n // We also add currentView to force re-render when the view changes.\n return (\n <LexicalComposer\n initialConfig={initialConfig}\n key={composerKey + initialConfig.editable + currentView}\n >\n <EditorConfigProvider\n editorConfig={editorConfig}\n editorContainerRef={editorContainerRef}\n fieldProps={fieldProps}\n /**\n * Parent editor is not truly the parent editor, if the current editor is part of a drawer and the parent editor is the main editor.\n */\n parentContext={parentContext?.editDepth === editDepth ? parentContext : undefined}\n >\n <NestProviders providers={editorConfig.features.providers}>\n <LexicalEditorComponent\n editorConfig={editorConfig}\n editorContainerRef={editorContainerRef}\n isSmallWidthViewport={isSmallWidthViewport}\n onChange={onChange}\n rtl={rtl}\n />\n </NestProviders>\n </EditorConfigProvider>\n </LexicalComposer>\n )\n}\n"],"mappings":"AAAA;;;AAIA,SAASA,eAAe,QAAQ;AAChC,SAASC,YAAY,QAAQ;AAC7B,YAAYC,KAAA,MAAW;AACvB,SAASC,OAAO,QAAQ;AAKxB,SAASC,eAAe,QAAQ;AAChC,SACEC,oBAAoB,EACpBC,sBAAsB,QACjB;AACP,SAASC,aAAA,IAAiBC,sBAAsB,QAAQ;AACxD,SAASC,eAAe,QAAQ;AAahC,MAAMC,aAAA,GAAgBA,CAAC;EACrBC,QAAQ;EACRC;AAAS,CAKV;EACC,IAAI,CAACA,SAAA,EAAWC,MAAA,EAAQ;IACtB,OAAOF,QAAA;EACT;EACA,MAAMG,SAAA,GAAYF,SAAS,CAAC,EAAE;EAC9B,IAAIA,SAAA,CAAUC,MAAM,GAAG,GAAG;IACxB,oBACEE,IAAA,CAACD,SAAA;gBACC,aAAAC,IAAA,CAACL,aAAA;QAAcE,SAAA,EAAWA,SAAA,CAAUI,KAAK,CAAC;kBAAKL;;;EAGrD;EACA,oBAAOI,IAAA,CAACD,SAAA;cAAWH;;AACrB;AAEA,OAAO,MAAMM,eAAA,GAAmDC,KAAA;EAC9D,MAAM;IACJC,WAAW;IACXC,YAAY;IACZC,UAAU;IACVC,oBAAoB;IACpBC,QAAQ;IACRC,QAAQ;IACRC,GAAG;IACHC;EAAK,CACN,GAAGR,KAAA;EAEJ,MAAM;IAAES,WAAW;IAAEC;EAAK,CAAE,GAAGxB,eAAA;EAE/B,MAAMyB,aAAA,GAAgBvB,sBAAA;EAEtB,MAAMwB,SAAA,GAAY7B,YAAA;EAElB,MAAM8B,kBAAA,GAAqB7B,KAAA,CAAM8B,MAAM,CAAiB;EAExD;EACA,MAAMC,aAAA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QAAcE,SAAA,EAAWQ,YAAA,CAAa6B,QAAQ,CAACrC,SAAS;kBACvD,aAAAG,IAAA,CAACP,sBAAA;UACCY,YAAA,EAAcA,YAAA;UACdW,kBAAA,EAAoBA,kBAAA;UACpBT,oBAAA,EAAsBA,oBAAA;UACtBC,QAAA,EAAUA,QAAA;UACVE,GAAA,EAAKA;;;;KAjBNN,WAAA,GAAcc,aAAA,CAAcQ,QAAQ,GAAGd,WAAA;AAuBlD","ignoreList":[]}
1
+ {"version":3,"file":"LexicalProvider.js","names":["LexicalComposer","useEditDepth","React","useMemo","useRichTextView","EditorConfigProvider","useEditorConfigContext","LexicalEditor","LexicalEditorComponent","getEnabledNodes","NestProviders","children","providers","length","Component","_jsx","slice","LexicalProvider","props","composerKey","editorConfig","fieldProps","isSmallWidthViewport","onChange","readOnly","rtl","value","currentView","views","parentContext","editDepth","editorContainerRef","useRef","initialConfig","Error","JSON","stringify","Array","isArray","nodeViews","nodes","editable","editorState","undefined","namespace","lexical","onError","error","theme","hasBeenEditable","current","effectiveConfig","editableKey","features"],"sources":["../../src/lexical/LexicalProvider.tsx"],"sourcesContent":["'use client'\nimport type { InitialConfigType } from '@lexical/react/LexicalComposer.js'\nimport type { EditorState, LexicalEditor, SerializedEditorState } from 'lexical'\n\nimport { LexicalComposer } from '@lexical/react/LexicalComposer.js'\nimport { useEditDepth } from '@payloadcms/ui'\nimport * as React from 'react'\nimport { useMemo } from 'react'\n\nimport type { LexicalRichTextFieldProps } from '../types/index.js'\nimport type { SanitizedClientEditorConfig } from './config/types.js'\n\nimport { useRichTextView } from '../field/RichTextViewProvider.js'\nimport {\n EditorConfigProvider,\n useEditorConfigContext,\n} from './config/client/EditorConfigProvider.js'\nimport { LexicalEditor as LexicalEditorComponent } from './LexicalEditor.js'\nimport { getEnabledNodes } from './nodes/index.js'\n\nexport type LexicalProviderProps = {\n composerKey: string\n editorConfig: SanitizedClientEditorConfig\n fieldProps: LexicalRichTextFieldProps\n isSmallWidthViewport: boolean\n onChange: (editorState: EditorState, editor: LexicalEditor, tags: Set<string>) => void\n readOnly: boolean\n rtl?: boolean\n value: SerializedEditorState\n}\n\nconst NestProviders = ({\n children,\n providers,\n}: {\n children: React.ReactNode\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n providers: any[]\n}) => {\n if (!providers?.length) {\n return children\n }\n const Component = providers[0]\n if (providers.length > 1) {\n return (\n <Component>\n <NestProviders providers={providers.slice(1)}>{children}</NestProviders>\n </Component>\n )\n }\n return <Component>{children}</Component>\n}\n\nexport const LexicalProvider: React.FC<LexicalProviderProps> = (props) => {\n const {\n composerKey,\n editorConfig,\n fieldProps,\n isSmallWidthViewport,\n onChange,\n readOnly,\n rtl,\n value,\n } = props\n\n const { currentView, views } = useRichTextView()\n\n const parentContext = useEditorConfigContext()\n\n const editDepth = useEditDepth()\n\n const editorContainerRef = React.useRef<HTMLDivElement>(null)\n\n // useMemo for the initialConfig. `readOnly` and `value` are intentionally excluded from deps\n // to avoid full remounts on every save (which would destroy cursor position and undo history).\n const initialConfig = useMemo<InitialConfigType>(() => {\n if (value && typeof value !== 'object') {\n throw new Error(\n 'The value passed to the Lexical editor is not an object. This is not supported. Please remove the data from the field and start again. This is the value that was passed in: ' +\n JSON.stringify(value),\n )\n }\n\n if (value && Array.isArray(value) && !('root' in value)) {\n throw new Error(\n 'You have tried to pass in data from the old Slate editor to the new Lexical editor. The data structure is different, thus you will have to migrate your data. We offer a one-line migration script which migrates all your rich text fields: https://payloadcms.com/docs/lexical/migration#migration-via-migration-script-recommended',\n )\n }\n\n if (value && 'jsonContent' in value) {\n throw new Error(\n 'You have tried to pass in data from payload-plugin-lexical. The data structure is different, thus you will have to migrate your data. Migration guide: https://payloadcms.com/docs/lexical/migration#migrating-from-payload-plugin-lexical',\n )\n }\n\n // Use the 'default' view if available, otherwise undefined\n const nodeViews = views?.[currentView]?.nodes\n\n return {\n editable: readOnly !== true,\n editorState: value != null ? JSON.stringify(value) : undefined,\n namespace: editorConfig.lexical.namespace,\n nodes: getEnabledNodes({\n editorConfig,\n nodeViews,\n }),\n onError: (error: Error) => {\n throw error\n },\n theme: editorConfig.lexical.theme,\n }\n // Important: do not add readOnly and value to the dependencies array. This will cause the entire lexical editor to re-render if the document is saved, which will\n // cause the editor to lose focus.\n }, [editorConfig, views, currentView])\n\n // Track whether the editor has ever been editable. Once it transitions to editable,\n // we never remount due to transient readOnly changes (e.g. during form save processing).\n const hasBeenEditable = React.useRef(readOnly !== true)\n if (readOnly !== true) {\n hasBeenEditable.current = true\n }\n\n // Compute the effective editable state for the config.\n // Override the memoized config's editable value to reflect the current readOnly prop.\n const effectiveConfig = useMemo<InitialConfigType>(\n () => ({\n ...initialConfig,\n editable: readOnly !== true,\n }),\n\n [initialConfig, readOnly],\n )\n\n if (!effectiveConfig) {\n return <p>Loading...</p>\n }\n\n // Use `hasBeenEditable` to build the key: only force a remount when the editor has NEVER\n // been editable and transitions to editable for the first time. After that, LexicalComposer\n // stays mounted (preserving cursor/focus/undo) and we rely on Lexical's internal\n // `editor.setEditable()` for transient readOnly changes during saves.\n const editableKey = hasBeenEditable.current ? 'editable' : 'readonly'\n return (\n <LexicalComposer initialConfig={effectiveConfig} key={composerKey + editableKey + currentView}>\n <EditorConfigProvider\n editorConfig={editorConfig}\n editorContainerRef={editorContainerRef}\n fieldProps={fieldProps}\n /**\n * Parent editor is not truly the parent editor, if the current editor is part of a drawer and the parent editor is the main editor.\n */\n parentContext={parentContext?.editDepth === editDepth ? parentContext : undefined}\n >\n <NestProviders providers={editorConfig.features.providers}>\n <LexicalEditorComponent\n editorConfig={editorConfig}\n editorContainerRef={editorContainerRef}\n isSmallWidthViewport={isSmallWidthViewport}\n onChange={onChange}\n rtl={rtl}\n />\n </NestProviders>\n </EditorConfigProvider>\n </LexicalComposer>\n )\n}\n"],"mappings":"AAAA;;;AAIA,SAASA,eAAe,QAAQ;AAChC,SAASC,YAAY,QAAQ;AAC7B,YAAYC,KAAA,MAAW;AACvB,SAASC,OAAO,QAAQ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cA,SAAA,GAAYD,aAAA,GAAgBc,SAAA;gBAExE,aAAA5B,IAAA,CAACL,aAAA;QAAcE,SAAA,EAAWQ,YAAA,CAAaiC,QAAQ,CAACzC,SAAS;kBACvD,aAAAG,IAAA,CAACP,sBAAA;UACCY,YAAA,EAAcA,YAAA;UACdW,kBAAA,EAAoBA,kBAAA;UACpBT,oBAAA,EAAsBA,oBAAA;UACtBC,QAAA,EAAUA,QAAA;UACVE,GAAA,EAAKA;;;;KAhByCN,WAAA,GAAciC,WAAA,GAAczB,WAAA;AAsBtF","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"loader.d.ts","sourceRoot":"","sources":["../../../../src/lexical/config/client/loader.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAA;AAEhE,OAAO,KAAK,EAGV,wBAAwB,EACzB,MAAM,kCAAkC,CAAA;AACzC,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,yBAAyB,CAAA;AACrE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAA;AAErD;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,EACjC,MAAM,EACN,sBAAsB,EACtB,sBAAsB,EACtB,KAAK,EACL,UAAU,EACV,uBAAuB,GACxB,EAAE;IACD,MAAM,EAAE,YAAY,CAAA;IACpB,sBAAsB,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;IAC3C,sBAAsB,EAAE,sBAAsB,CAAA;IAC9C,KAAK,CAAC,EAAE,mBAAmB,CAAA;IAC3B,UAAU,EAAE,MAAM,CAAA;IAClB,uBAAuB,EAAE,kBAAkB,CAAA;CAC5C,GAAG,wBAAwB,CAoD3B"}
1
+ {"version":3,"file":"loader.d.ts","sourceRoot":"","sources":["../../../../src/lexical/config/client/loader.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAA;AAEhE,OAAO,KAAK,EAGV,wBAAwB,EACzB,MAAM,kCAAkC,CAAA;AACzC,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,yBAAyB,CAAA;AACrE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAA;AAErD;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,EACjC,MAAM,EACN,sBAAsB,EACtB,sBAAsB,EACtB,KAAK,EACL,UAAU,EACV,uBAAuB,GACxB,EAAE;IACD,MAAM,EAAE,YAAY,CAAA;IACpB,sBAAsB,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;IAC3C,sBAAsB,EAAE,sBAAsB,CAAA;IAC9C,KAAK,CAAC,EAAE,mBAAmB,CAAA;IAC3B,UAAU,EAAE,MAAM,CAAA;IAClB,uBAAuB,EAAE,kBAAkB,CAAA;CAC5C,GAAG,wBAAwB,CA0D3B"}
@@ -13,12 +13,16 @@ export function loadClientFeatures({
13
13
  unSanitizedEditorConfig
14
14
  }) {
15
15
  const featureProviderMap = new Map();
16
+ const validFeatures = [];
16
17
  for (const featureProvider of unSanitizedEditorConfig.features) {
17
18
  if (!featureProvider?.clientFeatureProps?.featureKey || featureProvider?.clientFeatureProps?.order === undefined || featureProvider?.clientFeatureProps?.order === null) {
18
- throw new Error('A Feature you have installed does not return the client props as clientFeatureProps. Please make sure to always return those props, even if they are null, as other important props like order and featureKey are later on injected.');
19
+ console.warn('A Feature you have installed does not return the client props as clientFeatureProps. Please make sure to always return those props, even if they are null, as other important props like order and featureKey are later on injected. Skipping feature.');
20
+ continue;
19
21
  }
20
22
  featureProviderMap.set(featureProvider.clientFeatureProps.featureKey, featureProvider);
23
+ validFeatures.push(featureProvider);
21
24
  }
25
+ unSanitizedEditorConfig.features = validFeatures;
22
26
  // sort unSanitizedEditorConfig.features by order
23
27
  unSanitizedEditorConfig.features = unSanitizedEditorConfig.features.sort((a, b) => a.clientFeatureProps.order - b.clientFeatureProps.order);
24
28
  const resolvedFeatures = new Map();
@@ -1 +1 @@
1
- {"version":3,"file":"loader.js","names":["loadClientFeatures","config","featureClientImportMap","featureClientSchemaMap","field","schemaPath","unSanitizedEditorConfig","featureProviderMap","Map","featureProvider","features","clientFeatureProps","featureKey","order","undefined","Error","set","sort","a","b","resolvedFeatures","loaded","feature","key"],"sources":["../../../../src/lexical/config/client/loader.ts"],"sourcesContent":["'use client'\n\nimport type { ClientConfig, RichTextFieldClient } from 'payload'\n\nimport type {\n ClientFeatureProviderMap,\n ResolvedClientFeature,\n ResolvedClientFeatureMap,\n} from '../../../features/typesClient.js'\nimport type { FeatureClientSchemaMap } from '../../../types/index.js'\nimport type { ClientEditorConfig } from '../types.js'\n\n/**\n * This function expects client functions to ALREADY be ordered & dependencies checked on the server\n * @param unSanitizedEditorConfig\n */\nexport function loadClientFeatures({\n config,\n featureClientImportMap,\n featureClientSchemaMap,\n field,\n schemaPath,\n unSanitizedEditorConfig,\n}: {\n config: ClientConfig\n featureClientImportMap: Record<string, any>\n featureClientSchemaMap: FeatureClientSchemaMap\n field?: RichTextFieldClient\n schemaPath: string\n unSanitizedEditorConfig: ClientEditorConfig\n}): ResolvedClientFeatureMap {\n const featureProviderMap: ClientFeatureProviderMap = new Map()\n\n for (const featureProvider of unSanitizedEditorConfig.features) {\n if (\n !featureProvider?.clientFeatureProps?.featureKey ||\n featureProvider?.clientFeatureProps?.order === undefined ||\n featureProvider?.clientFeatureProps?.order === null\n ) {\n throw new Error(\n 'A Feature you have installed does not return the client props as clientFeatureProps. Please make sure to always return those props, even if they are null, as other important props like order and featureKey are later on injected.',\n )\n }\n featureProviderMap.set(featureProvider.clientFeatureProps.featureKey, featureProvider)\n }\n\n // sort unSanitizedEditorConfig.features by order\n unSanitizedEditorConfig.features = unSanitizedEditorConfig.features.sort(\n (a, b) => a.clientFeatureProps.order - b.clientFeatureProps.order,\n )\n\n const resolvedFeatures: ResolvedClientFeatureMap = new Map()\n\n // Make sure all dependencies declared in the respective features exist\n let loaded = 0\n for (const featureProvider of unSanitizedEditorConfig.features) {\n const feature: Partial<ResolvedClientFeature<any>> =\n typeof featureProvider.feature === 'function'\n ? featureProvider.feature({\n config,\n featureClientImportMap,\n featureClientSchemaMap,\n featureProviderMap,\n field,\n resolvedFeatures,\n schemaPath,\n unSanitizedEditorConfig,\n })\n : featureProvider.feature\n\n feature.key = featureProvider.clientFeatureProps.featureKey\n feature.order = loaded\n\n resolvedFeatures.set(\n featureProvider.clientFeatureProps.featureKey,\n feature as ResolvedClientFeature<any>,\n )\n\n loaded++\n }\n\n return resolvedFeatures\n}\n"],"mappings":"AAAA;;AAYA;;;;AAIA,OAAO,SAASA,mBAAmB;EACjCC,MAAM;EACNC,sBAAsB;EACtBC,sBAAsB;EACtBC,KAAK;EACLC,UAAU;EACVC;AAAuB,CAQxB;EACC,MAAMC,kBAAA,GAA+C,IAAIC,GAAA;EAEzD,KAAK,MAAMC,eAAA,IAAmBH,uBAAA,CAAwBI,QAAQ,EAAE;IAC9D,IACE,CAACD,eAAA,EAAiBE,kBAAA,EAAoBC,UAAA,IACtCH,eAAA,EAAiBE,kBAAA,EAAoBE,KAAA,KAAUC,SAAA,IAC/CL,eAAA,EAAiBE,kBAAA,EAAoBE,KAAA,KAAU,MAC/C;MACA,MAAM,IAAIE,KAAA,CACR;IAEJ;IACAR,kBAAA,CAAmBS,GAAG,CAACP,eAAA,CAAgBE,kBAAkB,CAACC,UAAU,EAAEH,eAAA;EACxE;EAEA;EACAH,uBAAA,CAAwBI,QAAQ,GAAGJ,uBAAA,CAAwBI,QAAQ,CAACO,IAAI,CACtE,CAACC,CAAA,EAAGC,CAAA,KAAMD,CAAA,CAAEP,kBAAkB,CAACE,KAAK,GAAGM,CAAA,CAAER,kBAAkB,CAACE,KAAK;EAGnE,MAAMO,gBAAA,GAA6C,IAAIZ,GAAA;EAEvD;EACA,IAAIa,MAAA,GAAS;EACb,KAAK,MAAMZ,eAAA,IAAmBH,uBAAA,CAAwBI,QAAQ,EAAE;IAC9D,MAAMY,OAAA,GACJ,OAAOb,eAAA,CAAgBa,OAAO,KAAK,aAC/Bb,eAAA,CAAgBa,OAAO,CAAC;MACtBrB,MAAA;MACAC,sBAAA;MACAC,sBAAA;MACAI,kBAAA;MACAH,KAAA;MACAgB,gBAAA;MACAf,UAAA;MACAC;IACF,KACAG,eAAA,CAAgBa,OAAO;IAE7BA,OAAA,CAAQC,GAAG,GAAGd,eAAA,CAAgBE,kBAAkB,CAACC,UAAU;IAC3DU,OAAA,CAAQT,KAAK,GAAGQ,MAAA;IAEhBD,gBAAA,CAAiBJ,GAAG,CAClBP,eAAA,CAAgBE,kBAAkB,CAACC,UAAU,EAC7CU,OAAA;IAGFD,MAAA;EACF;EAEA,OAAOD,gBAAA;AACT","ignoreList":[]}
1
+ {"version":3,"file":"loader.js","names":["loadClientFeatures","config","featureClientImportMap","featureClientSchemaMap","field","schemaPath","unSanitizedEditorConfig","featureProviderMap","Map","validFeatures","featureProvider","features","clientFeatureProps","featureKey","order","undefined","console","warn","set","push","sort","a","b","resolvedFeatures","loaded","feature","key"],"sources":["../../../../src/lexical/config/client/loader.ts"],"sourcesContent":["'use client'\n\nimport type { ClientConfig, RichTextFieldClient } from 'payload'\n\nimport type {\n ClientFeatureProviderMap,\n ResolvedClientFeature,\n ResolvedClientFeatureMap,\n} from '../../../features/typesClient.js'\nimport type { FeatureClientSchemaMap } from '../../../types/index.js'\nimport type { ClientEditorConfig } from '../types.js'\n\n/**\n * This function expects client functions to ALREADY be ordered & dependencies checked on the server\n * @param unSanitizedEditorConfig\n */\nexport function loadClientFeatures({\n config,\n featureClientImportMap,\n featureClientSchemaMap,\n field,\n schemaPath,\n unSanitizedEditorConfig,\n}: {\n config: ClientConfig\n featureClientImportMap: Record<string, any>\n featureClientSchemaMap: FeatureClientSchemaMap\n field?: RichTextFieldClient\n schemaPath: string\n unSanitizedEditorConfig: ClientEditorConfig\n}): ResolvedClientFeatureMap {\n const featureProviderMap: ClientFeatureProviderMap = new Map()\n\n const validFeatures: typeof unSanitizedEditorConfig.features = []\n\n for (const featureProvider of unSanitizedEditorConfig.features) {\n if (\n !featureProvider?.clientFeatureProps?.featureKey ||\n featureProvider?.clientFeatureProps?.order === undefined ||\n featureProvider?.clientFeatureProps?.order === null\n ) {\n console.warn(\n 'A Feature you have installed does not return the client props as clientFeatureProps. Please make sure to always return those props, even if they are null, as other important props like order and featureKey are later on injected. Skipping feature.',\n )\n continue\n }\n featureProviderMap.set(featureProvider.clientFeatureProps.featureKey, featureProvider)\n validFeatures.push(featureProvider)\n }\n\n unSanitizedEditorConfig.features = validFeatures\n\n // sort unSanitizedEditorConfig.features by order\n unSanitizedEditorConfig.features = unSanitizedEditorConfig.features.sort(\n (a, b) => a.clientFeatureProps.order - b.clientFeatureProps.order,\n )\n\n const resolvedFeatures: ResolvedClientFeatureMap = new Map()\n\n // Make sure all dependencies declared in the respective features exist\n let loaded = 0\n for (const featureProvider of unSanitizedEditorConfig.features) {\n const feature: Partial<ResolvedClientFeature<any>> =\n typeof featureProvider.feature === 'function'\n ? featureProvider.feature({\n config,\n featureClientImportMap,\n featureClientSchemaMap,\n featureProviderMap,\n field,\n resolvedFeatures,\n schemaPath,\n unSanitizedEditorConfig,\n })\n : featureProvider.feature\n\n feature.key = featureProvider.clientFeatureProps.featureKey\n feature.order = loaded\n\n resolvedFeatures.set(\n featureProvider.clientFeatureProps.featureKey,\n feature as ResolvedClientFeature<any>,\n )\n\n loaded++\n }\n\n return resolvedFeatures\n}\n"],"mappings":"AAAA;;AAYA;;;;AAIA,OAAO,SAASA,mBAAmB;EACjCC,MAAM;EACNC,sBAAsB;EACtBC,sBAAsB;EACtBC,KAAK;EACLC,UAAU;EACVC;AAAuB,CAQxB;EACC,MAAMC,kBAAA,GAA+C,IAAIC,GAAA;EAEzD,MAAMC,aAAA,GAAyD,EAAE;EAEjE,KAAK,MAAMC,eAAA,IAAmBJ,uBAAA,CAAwBK,QAAQ,EAAE;IAC9D,IACE,CAACD,eAAA,EA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config/server/sanitize.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAA;AAE9C,OAAO,KAAK,EACV,wBAAwB,EACxB,uBAAuB,EACxB,MAAM,kCAAkC,CAAA;AACzC,OAAO,KAAK,EAAE,2BAA2B,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAA;AAIlF,eAAO,MAAM,sBAAsB,GACjC,UAAU,wBAAwB,KACjC,uBAyHF,CAAA;AAED,wBAAsB,0BAA0B,CAC9C,YAAY,EAAE,kBAAkB,EAChC,MAAM,EAAE,eAAe,EACvB,iBAAiB,CAAC,EAAE,OAAO,GAC1B,OAAO,CAAC,2BAA2B,CAAC,CAYtC"}
1
+ {"version":3,"file":"sanitize.d.ts","sourceRoot":"","sources":["../../../../src/lexical/config/server/sanitize.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAA;AAE9C,OAAO,KAAK,EACV,wBAAwB,EACxB,uBAAuB,EACxB,MAAM,kCAAkC,CAAA;AACzC,OAAO,KAAK,EAAE,2BAA2B,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAA;AAIlF,eAAO,MAAM,sBAAsB,GACjC,UAAU,wBAAwB,KACjC,uBA0HF,CAAA;AAED,wBAAsB,0BAA0B,CAC9C,YAAY,EAAE,kBAAkB,EAChC,MAAM,EAAE,eAAe,EACvB,iBAAiB,CAAC,EAAE,OAAO,GAC1B,OAAO,CAAC,2BAA2B,CAAC,CAYtC"}
@@ -2,9 +2,6 @@ import { loadFeatures } from './loader.js';
2
2
  export const sanitizeServerFeatures = features => {
3
3
  const sanitized = {
4
4
  enabledFeatures: [],
5
- generatedTypes: {
6
- modifyJSONSchemas: []
7
- },
8
5
  getSubFields: new Map(),
9
6
  getSubFieldsData: new Map(),
10
7
  graphQLPopulationPromises: new Map(),
@@ -29,9 +26,6 @@ export const sanitizeServerFeatures = features => {
29
26
  return sanitized;
30
27
  }
31
28
  features.forEach(feature => {
32
- if (feature?.generatedTypes?.modifyJSONSchema) {
33
- sanitized.generatedTypes.modifyJSONSchemas.push(feature.generatedTypes.modifyJSONSchema);
34
- }
35
29
  if (feature?.hooks?.beforeValidate?.length) {
36
30
  sanitized.hooks.beforeValidate = sanitized.hooks.beforeValidate?.concat(feature.hooks.beforeValidate);
37
31
  }
@@ -58,11 +52,15 @@ export const sanitizeServerFeatures = features => {
58
52
  if (feature.nodes?.length) {
59
53
  // Do not concat here. We need to keep the object reference of sanitized.nodes so that function markdown transformers of features automatically get the updated nodes
60
54
  for (const node of feature.nodes) {
55
+ const nodeType = 'with' in node.node ? node.node.replace.getType() : node.node.getType();
56
+ const alreadyRegistered = sanitized.nodes.some(existing => {
57
+ const existingType = 'with' in existing.node ? existing.node.replace.getType() : existing.node.getType();
58
+ return existingType === nodeType;
59
+ });
60
+ if (alreadyRegistered) {
61
+ throw new Error(`Lexical editor config: node type "${nodeType}" was registered more than once (feature "${feature.key}"). Each lexical node type may only be registered by a single feature.`);
62
+ }
61
63
  sanitized.nodes.push(node);
62
- }
63
- feature.nodes.forEach(node => {
64
- const nodeType = 'with' in node.node ? node.node.replace.getType() : node.node.getType() // TODO: Idk if this works for node replacements
65
- ;
66
64
  if (node?.graphQLPopulationPromises?.length) {
67
65
  sanitized.graphQLPopulationPromises.set(nodeType, node.graphQLPopulationPromises);
68
66
  }
@@ -87,7 +85,7 @@ export const sanitizeServerFeatures = features => {
87
85
  if (node?.getSubFieldsData) {
88
86
  sanitized.getSubFieldsData?.set(nodeType, node.getSubFieldsData);
89
87
  }
90
- });
88
+ }
91
89
  }
92
90
  if (feature.markdownTransformers?.length) {
93
91
  // Do not concat here. We need to keep the object reference of feature.markdownTransformers
@@ -1 +1 @@
1
- {"version":3,"file":"sanitize.js","names":["loadFeatures","sanitizeServerFeatures","features","sanitized","enabledFeatures","generatedTypes","modifyJSONSchemas","getSubFields","Map","getSubFieldsData","graphQLPopulationPromises","hooks","afterChange","afterRead","beforeChange","beforeValidate","i18n","markdownTransformers","nodeHooks","nodes","validations","size","forEach","feature","modifyJSONSchema","push","length","concat","lang","lexical","key","node","nodeType","replace","getType","set","transformer","allNodes","allTransformers","sanitizeServerEditorConfig","editorConfig","config","parentIsLocalized","resolvedFeatureMap","unSanitizedEditorConfig"],"sources":["../../../../src/lexical/config/server/sanitize.ts"],"sourcesContent":["import type { SanitizedConfig } from 'payload'\n\nimport type {\n ResolvedServerFeatureMap,\n SanitizedServerFeatures,\n} from '../../../features/typesServer.js'\nimport type { SanitizedServerEditorConfig, ServerEditorConfig } from '../types.js'\n\nimport { loadFeatures } from './loader.js'\n\nexport const sanitizeServerFeatures = (\n features: ResolvedServerFeatureMap,\n): SanitizedServerFeatures => {\n const sanitized: SanitizedServerFeatures = {\n enabledFeatures: [],\n generatedTypes: {\n modifyJSONSchemas: [],\n },\n getSubFields: new Map(),\n getSubFieldsData: new Map(),\n graphQLPopulationPromises: new Map(),\n hooks: {\n afterChange: [],\n afterRead: [],\n beforeChange: [],\n beforeValidate: [],\n },\n i18n: {},\n markdownTransformers: [],\n nodeHooks: {\n afterChange: new Map(),\n afterRead: new Map(),\n beforeChange: new Map(),\n beforeValidate: new Map(),\n },\n nodes: [],\n\n validations: new Map(),\n }\n\n if (!features?.size) {\n return sanitized\n }\n\n features.forEach((feature) => {\n if (feature?.generatedTypes?.modifyJSONSchema) {\n sanitized.generatedTypes.modifyJSONSchemas.push(feature.generatedTypes.modifyJSONSchema)\n }\n\n if (feature?.hooks?.beforeValidate?.length) {\n sanitized.hooks.beforeValidate = sanitized.hooks.beforeValidate?.concat(\n feature.hooks.beforeValidate,\n )\n }\n if (feature?.hooks?.beforeChange?.length) {\n sanitized.hooks.beforeChange = sanitized.hooks.beforeChange?.concat(\n feature.hooks.beforeChange,\n )\n }\n if (feature?.hooks?.afterRead?.length) {\n sanitized.hooks.afterRead = sanitized.hooks.afterRead?.concat(feature.hooks.afterRead)\n }\n if (feature?.hooks?.afterChange?.length) {\n sanitized.hooks.afterChange = sanitized.hooks.afterChange?.concat(feature.hooks.afterChange)\n }\n\n if (feature?.i18n) {\n for (const lang in feature.i18n) {\n if (!sanitized.i18n[lang as keyof typeof sanitized.i18n]) {\n sanitized.i18n[lang as keyof typeof sanitized.i18n] = {\n lexical: {},\n }\n }\n // @ts-expect-error - vestiges of when tsconfig was not strict. Feel free to improve\n sanitized.i18n[lang].lexical[feature.key] = feature.i18n[lang]\n }\n }\n\n if (feature.nodes?.length) {\n // Do not concat here. We need to keep the object reference of sanitized.nodes so that function markdown transformers of features automatically get the updated nodes\n for (const node of feature.nodes) {\n sanitized.nodes.push(node)\n }\n feature.nodes.forEach((node) => {\n const nodeType = 'with' in node.node ? node.node.replace.getType() : node.node.getType() // TODO: Idk if this works for node replacements\n if (node?.graphQLPopulationPromises?.length) {\n sanitized.graphQLPopulationPromises.set(nodeType, node.graphQLPopulationPromises)\n }\n if (node?.validations?.length) {\n sanitized.validations.set(nodeType, node.validations)\n }\n if (node?.hooks?.afterChange) {\n sanitized.nodeHooks?.afterChange?.set(nodeType, node.hooks.afterChange)\n }\n if (node?.hooks?.afterRead) {\n sanitized.nodeHooks?.afterRead?.set(nodeType, node.hooks.afterRead)\n }\n if (node?.hooks?.beforeChange) {\n sanitized.nodeHooks?.beforeChange?.set(nodeType, node.hooks.beforeChange)\n }\n if (node?.hooks?.beforeValidate) {\n sanitized.nodeHooks?.beforeValidate?.set(nodeType, node.hooks.beforeValidate)\n }\n if (node?.getSubFields) {\n sanitized.getSubFields?.set(nodeType, node.getSubFields)\n }\n if (node?.getSubFieldsData) {\n sanitized.getSubFieldsData?.set(nodeType, node.getSubFieldsData)\n }\n })\n }\n\n if (feature.markdownTransformers?.length) {\n // Do not concat here. We need to keep the object reference of feature.markdownTransformers\n\n for (const transformer of feature.markdownTransformers) {\n if (typeof transformer === 'function') {\n sanitized.markdownTransformers.push(\n transformer({\n allNodes: sanitized.nodes,\n allTransformers: sanitized.markdownTransformers,\n }),\n )\n } else {\n sanitized.markdownTransformers.push(transformer)\n }\n }\n }\n\n sanitized.enabledFeatures.push(feature.key)\n })\n\n return sanitized\n}\n\nexport async function sanitizeServerEditorConfig(\n editorConfig: ServerEditorConfig,\n config: SanitizedConfig,\n parentIsLocalized?: boolean,\n): Promise<SanitizedServerEditorConfig> {\n const resolvedFeatureMap = await loadFeatures({\n config,\n parentIsLocalized: parentIsLocalized!,\n unSanitizedEditorConfig: editorConfig,\n })\n\n return {\n features: sanitizeServerFeatures(resolvedFeatureMap),\n lexical: editorConfig.lexical!,\n resolvedFeatureMap,\n }\n}\n"],"mappings":"AAQA,SAASA,YAAY,QAAQ;AAE7B,OAAO,MAAMC,sBAAA,GACXC,QAAA;EAEA,MAAMC,SAAA,GAAqC;IACzCC,eAAA,EAAiB,EAAE;IACnBC,cAAA,EAAgB;MACdC,iBAAA,EAAmB;IACrB;IACAC,YAAA,EAAc,IAAIC,GAAA;IAClBC,gBAAA,EAAkB,IAAID,GAAA;IACtBE,yBAAA,EAA2B,IAAIF,GAAA;IAC/BG,KAAA,EAAO;MACLC,WAAA,EAAa,EAAE;MACfC,SAAA,EAAW,EAAE;MACbC,YAAA,EAAc,EAAE;MAChBC,cAAA,EAAgB;IAClB;IACAC,IAAA,EAAM,CAAC;IACPC,oBAAA,EAAsB,EAAE;IACxBC,SAAA,EAAW;MACTN,WAAA,EAAa,IAAIJ,GAAA;MACjBK,SAAA,EAAW,IAAIL,GAAA;MACfM,YAAA,EAAc,IAAIN,GAAA;MAClBO,cAAA,EAAgB,IAAIP,GAAA;IACtB;IACAW,KAAA,EAAO,EAAE;IAETC,WAAA,EAAa,IAAIZ,GAAA;EACnB;EAEA,IAAI,CAACN,QAAA,EAAUmB,IAAA,EAAM;IACnB,OAAOlB,SAAA;EACT;EAEAD,QAAA,CAASoB,OAAO,CAAEC,OAAA;IAChB,IAAIA,OAAA,EAASlB,cAAA,EAAgBmB,gBAAA,EAAkB;MAC7CrB,SAAA,CAAUE,cAAc,CAACC,iBAAiB,CAACmB,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reList":[]}
1
+ {"version":3,"file":"sanitize.js","names":["loadFeatures","sanitizeServerFeatures","features","sanitized","enabledFeatures","getSubFields","Map","getSubFieldsData","graphQLPopulationPromises","hooks","afterChange","afterRead","beforeChange","beforeValidate","i18n","markdownTransformers","nodeHooks","nodes","validations","size","forEach","feature","length","concat","lang","lexical","key","node","nodeType","replace","getType","alreadyRegistered","some","existing","existingType","Error","push","set","transformer","allNodes","allTransformers","sanitizeServerEditorConfig","editorConfig","config","parentIsLocalized","resolvedFeatureMap","unSanitizedEditorConfig"],"sources":["../../../../src/lexical/config/server/sanitize.ts"],"sourcesContent":["import type { SanitizedConfig } from 'payload'\n\nimport type {\n ResolvedServerFeatureMap,\n SanitizedServerFeatures,\n} from '../../../features/typesServer.js'\nimport type { SanitizedServerEditorConfig, ServerEditorConfig } from '../types.js'\n\nimport { loadFeatures } from './loader.js'\n\nexport const sanitizeServerFeatures = (\n features: ResolvedServerFeatureMap,\n): SanitizedServerFeatures => {\n const sanitized: SanitizedServerFeatures = {\n enabledFeatures: [],\n getSubFields: new Map(),\n getSubFieldsData: new Map(),\n graphQLPopulationPromises: new Map(),\n hooks: {\n afterChange: [],\n afterRead: [],\n beforeChange: [],\n beforeValidate: [],\n },\n i18n: {},\n markdownTransformers: [],\n nodeHooks: {\n afterChange: new Map(),\n afterRead: new Map(),\n beforeChange: new Map(),\n beforeValidate: new Map(),\n },\n nodes: [],\n\n validations: new Map(),\n }\n\n if (!features?.size) {\n return sanitized\n }\n\n features.forEach((feature) => {\n if (feature?.hooks?.beforeValidate?.length) {\n sanitized.hooks.beforeValidate = sanitized.hooks.beforeValidate?.concat(\n feature.hooks.beforeValidate,\n )\n }\n if (feature?.hooks?.beforeChange?.length) {\n sanitized.hooks.beforeChange = sanitized.hooks.beforeChange?.concat(\n feature.hooks.beforeChange,\n )\n }\n if (feature?.hooks?.afterRead?.length) {\n sanitized.hooks.afterRead = sanitized.hooks.afterRead?.concat(feature.hooks.afterRead)\n }\n if (feature?.hooks?.afterChange?.length) {\n sanitized.hooks.afterChange = sanitized.hooks.afterChange?.concat(feature.hooks.afterChange)\n }\n\n if (feature?.i18n) {\n for (const lang in feature.i18n) {\n if (!sanitized.i18n[lang as keyof typeof sanitized.i18n]) {\n sanitized.i18n[lang as keyof typeof sanitized.i18n] = {\n lexical: {},\n }\n }\n // @ts-expect-error - vestiges of when tsconfig was not strict. Feel free to improve\n sanitized.i18n[lang].lexical[feature.key] = feature.i18n[lang]\n }\n }\n\n if (feature.nodes?.length) {\n // Do not concat here. We need to keep the object reference of sanitized.nodes so that function markdown transformers of features automatically get the updated nodes\n for (const node of feature.nodes) {\n const nodeType = 'with' in node.node ? node.node.replace.getType() : node.node.getType()\n const alreadyRegistered = sanitized.nodes.some((existing) => {\n const existingType =\n 'with' in existing.node ? existing.node.replace.getType() : existing.node.getType()\n return existingType === nodeType\n })\n if (alreadyRegistered) {\n throw new Error(\n `Lexical editor config: node type \"${nodeType}\" was registered more than once (feature \"${feature.key}\"). Each lexical node type may only be registered by a single feature.`,\n )\n }\n sanitized.nodes.push(node)\n if (node?.graphQLPopulationPromises?.length) {\n sanitized.graphQLPopulationPromises.set(nodeType, node.graphQLPopulationPromises)\n }\n if (node?.validations?.length) {\n sanitized.validations.set(nodeType, node.validations)\n }\n if (node?.hooks?.afterChange) {\n sanitized.nodeHooks?.afterChange?.set(nodeType, node.hooks.afterChange)\n }\n if (node?.hooks?.afterRead) {\n sanitized.nodeHooks?.afterRead?.set(nodeType, node.hooks.afterRead)\n }\n if (node?.hooks?.beforeChange) {\n sanitized.nodeHooks?.beforeChange?.set(nodeType, node.hooks.beforeChange)\n }\n if (node?.hooks?.beforeValidate) {\n sanitized.nodeHooks?.beforeValidate?.set(nodeType, node.hooks.beforeValidate)\n }\n if (node?.getSubFields) {\n sanitized.getSubFields?.set(nodeType, node.getSubFields)\n }\n if (node?.getSubFieldsData) {\n sanitized.getSubFieldsData?.set(nodeType, node.getSubFieldsData)\n }\n }\n }\n\n if (feature.markdownTransformers?.length) {\n // Do not concat here. We need to keep the object reference of feature.markdownTransformers\n\n for (const transformer of feature.markdownTransformers) {\n if (typeof transformer === 'function') {\n sanitized.markdownTransformers.push(\n transformer({\n allNodes: sanitized.nodes,\n allTransformers: sanitized.markdownTransformers,\n }),\n )\n } else {\n sanitized.markdownTransformers.push(transformer)\n }\n }\n }\n\n sanitized.enabledFeatures.push(feature.key)\n })\n\n return sanitized\n}\n\nexport async function sanitizeServerEditorConfig(\n editorConfig: ServerEditorConfig,\n config: SanitizedConfig,\n parentIsLocalized?: boolean,\n): Promise<SanitizedServerEditorConfig> {\n const resolvedFeatureMap = await loadFeatures({\n config,\n parentIsLocalized: parentIsLocalized!,\n unSanitizedEditorConfig: editorConfig,\n })\n\n return {\n features: sanitizeServerFeatures(resolvedFeatureMap),\n lexical: editorConfig.lexical!,\n resolvedFeatureMap,\n }\n}\n"],"mappings":"AAQA,SAASA,YAAY,QAAQ;AAE7B,OAAO,MAAMC,sBAAA,GACXC,QAAA;EAEA,MAAMC,SAAA,GAAqC;IACzCC,eAAA,EAAiB,EAAE;IACnBC,YAAA,EAAc,IAAIC,GAAA;IAClBC,gBAAA,EAAkB,IAAID,GAAA;IACtBE,yBAAA,EAA2B,IAAIF,GAAA;IAC/BG,KAAA,EAAO;MACLC,WAAA,EAAa,EAAE;MACfC,SAAA,EAAW,EAAE;MACbC,YAAA,EAAc,EAAE;MAChBC,cAAA,EAAgB;IAClB;IACAC,IAAA,EAAM,CAAC;IACPC,oBAAA,EAAsB,EAAE;IACxBC,SAAA,EAAW;MACTN,WAAA,EAAa,IAAIJ,GAAA;MACjBK,SAAA,EAAW,IAAIL,GAAA;MACfM,YAAA,EAAc,IAAIN,GAAA;MAClBO,cAAA,EAAgB,IAAIP,GAAA;IACtB;IACAW,KAAA,EAAO,EAAE;IAETC,WAAA,EAAa,IAAIZ,GAAA;EACnB;EAEA,IAAI,CAACJ,QAAA,EAAUiB,IAAA,EAAM;IACnB,OAAOhB,SAAA;EACT;EAE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ChCC,MAAuB,EACvBC,iBAA2B;EAE3B,MAAMC,kBAAA,GAAqB,MAAM7C,YAAA,CAAa;IAC5C2C,MAAA;IACAC,iBAAA,EAAmBA,iBAAA;IACnBE,uBAAA,EAAyBJ;EAC3B;EAEA,OAAO;IACLxC,QAAA,EAAUD,sBAAA,CAAuB4C,kBAAA;IACjCpB,OAAA,EAASiB,YAAA,CAAajB,OAAO;IAC7BoB;EACF;AACF","ignoreList":[]}
@@ -0,0 +1,160 @@
1
+ import { createHeadlessEditor } from '@lexical/headless';
2
+ import { LinkNode } from '@lexical/link';
3
+ import { ListItemNode, ListNode } from '@lexical/list';
4
+ import { HeadingNode, QuoteNode } from '@lexical/rich-text';
5
+ import { $getRoot, $getState, $isElementNode, $isLineBreakNode, $isTextNode } from 'lexical';
6
+ import { describe, expect, it } from 'vitest';
7
+ import { $convertFromMarkdownString, $convertToMarkdownString } from './index.js';
8
+ import { hardLineBreakState, normalizeMarkdown } from './MarkdownTransformers.js';
9
+ function createEditor() {
10
+ return createHeadlessEditor({
11
+ nodes: [HeadingNode, QuoteNode, ListNode, ListItemNode, LinkNode]
12
+ });
13
+ }
14
+ function importMarkdown(markdown) {
15
+ const editor = createEditor();
16
+ editor.update(() => $convertFromMarkdownString(markdown), {
17
+ discrete: true
18
+ });
19
+ let result = {
20
+ hasLineBreak: false,
21
+ textContent: ''
22
+ };
23
+ editor.getEditorState().read(() => {
24
+ const firstChild = $getRoot().getFirstChild();
25
+ if (!$isElementNode(firstChild)) {
26
+ throw new Error('Expected an element block');
27
+ }
28
+ result = {
29
+ hasLineBreak: firstChild.getChildren().some(child => $isLineBreakNode(child)),
30
+ textContent: firstChild.getTextContent()
31
+ };
32
+ });
33
+ return result;
34
+ }
35
+ // Returns the hard line break marker stored on the first LineBreakNode of the
36
+ // first block, plus the text content of every text node in that block. Used to
37
+ // assert the marker was moved off the text and onto the line break node, even
38
+ // when the trailing whitespace was split into its own text node by an inline
39
+ // transformer (e.g. after bold or a link).
40
+ function getStoredHardLineBreak(markdown) {
41
+ const editor = createEditor();
42
+ editor.update(() => $convertFromMarkdownString(markdown), {
43
+ discrete: true
44
+ });
45
+ let result = {
46
+ marker: '',
47
+ textNodeTexts: []
48
+ };
49
+ editor.getEditorState().read(() => {
50
+ const block = $getRoot().getFirstChild();
51
+ if (!$isElementNode(block)) {
52
+ throw new Error('Expected an element block');
53
+ }
54
+ const lineBreakNode = block.getChildren().find(child => $isLineBreakNode(child));
55
+ if (lineBreakNode === undefined) {
56
+ throw new Error('Expected a line break node');
57
+ }
58
+ result = {
59
+ marker: $getState(lineBreakNode, hardLineBreakState),
60
+ textNodeTexts: block.getChildren().filter($isTextNode).map(child => child.getTextContent())
61
+ };
62
+ });
63
+ return result;
64
+ }
65
+ function roundTrip(markdown) {
66
+ const editor = createEditor();
67
+ editor.update(() => $convertFromMarkdownString(markdown), {
68
+ discrete: true
69
+ });
70
+ let output = '';
71
+ editor.getEditorState().read(() => {
72
+ output = $convertToMarkdownString();
73
+ });
74
+ return output;
75
+ }
76
+ describe('markdown hard line break normalization', () => {
77
+ it('should preserve trailing-space hard breaks when merging adjacent lines', () => {
78
+ const md = ['foo ', 'bar'].join('\n');
79
+ expect(normalizeMarkdown(md, true)).toBe(md);
80
+ });
81
+ it('should preserve the exact number of trailing spaces', () => {
82
+ const md = ['foo ', 'bar'].join('\n');
83
+ expect(normalizeMarkdown(md, true)).toBe(md);
84
+ });
85
+ it('should preserve backslash hard breaks when merging adjacent lines', () => {
86
+ const md = 'foo\\\nbar';
87
+ expect(normalizeMarkdown(md, true)).toBe(md);
88
+ });
89
+ it('should still merge a soft break into the previous line', () => {
90
+ const md = ['foo', 'bar'].join('\n');
91
+ expect(normalizeMarkdown(md, true)).toBe('foo bar');
92
+ });
93
+ it('should merge a soft break before a hard-breaking line', () => {
94
+ const md = ['foo', 'bar ', 'baz'].join('\n');
95
+ expect(normalizeMarkdown(md, true)).toBe(['foo bar ', 'baz'].join('\n'));
96
+ });
97
+ });
98
+ describe('markdown hard line break import', () => {
99
+ it('should import a trailing-space hard break as a line break node with the marker stripped', () => {
100
+ const {
101
+ hasLineBreak,
102
+ textContent
103
+ } = importMarkdown(['foo ', 'bar'].join('\n'));
104
+ expect(hasLineBreak).toBe(true);
105
+ // The marker is stripped from the text and represented by the line break node.
106
+ expect(textContent).toBe('foo\nbar');
107
+ });
108
+ it('should import a backslash hard break as a line break node with the marker stripped', () => {
109
+ const {
110
+ hasLineBreak,
111
+ textContent
112
+ } = importMarkdown('foo\\\nbar');
113
+ expect(hasLineBreak).toBe(true);
114
+ expect(textContent).toBe('foo\nbar');
115
+ });
116
+ it('should store the marker on the line break when the hard break follows formatted text', () => {
117
+ const {
118
+ marker,
119
+ textNodeTexts
120
+ } = getStoredHardLineBreak('**foo** \nbar');
121
+ expect(marker).toBe(' ');
122
+ // The trailing-space marker is split into its own text node by the bold
123
+ // transformer; it must be moved onto the line break node, not left as text.
124
+ expect(textNodeTexts).not.toContain(' ');
125
+ });
126
+ it('should store the exact number of trailing spaces when the hard break follows formatted text', () => {
127
+ const {
128
+ marker
129
+ } = getStoredHardLineBreak('**foo** \nbar');
130
+ expect(marker).toBe(' ');
131
+ });
132
+ it('should store the marker on the line break when the hard break follows a link', () => {
133
+ const {
134
+ marker
135
+ } = getStoredHardLineBreak('[foo](https://payloadcms.com) \nbar');
136
+ expect(marker).toBe(' ');
137
+ });
138
+ });
139
+ describe('markdown hard line break round trip', () => {
140
+ it('should round trip a trailing-space hard break', () => {
141
+ const md = ['foo ', 'bar'].join('\n');
142
+ expect(roundTrip(md)).toBe(md);
143
+ });
144
+ it('should round trip a backslash hard break', () => {
145
+ const md = 'foo\\\nbar';
146
+ expect(roundTrip(md)).toBe(md);
147
+ });
148
+ it('should not introduce a hard break for a soft wrap', () => {
149
+ expect(roundTrip(['foo', 'bar'].join('\n'))).toBe('foo bar');
150
+ });
151
+ it('should round trip a hard break after formatted text', () => {
152
+ const md = '**foo** \nbar';
153
+ expect(roundTrip(md)).toBe(md);
154
+ });
155
+ it('should round trip a hard break after a link', () => {
156
+ const md = '[foo](https://payloadcms.com) \nbar';
157
+ expect(roundTrip(md)).toBe(md);
158
+ });
159
+ });
160
+ //# sourceMappingURL=LexicalMarkdownHardLineBreak.spec.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"LexicalMarkdownHardLineBreak.spec.js","names":["createHeadlessEditor","LinkNode","ListItemNode","ListNode","HeadingNode","QuoteNode","$getRoot","$getState","$isElementNode","$isLineBreakNode","$isTextNode","describe","expect","it","$convertFromMarkdownString","$convertToMarkdownString","hardLineBreakState","normalizeMarkdown","createEditor","nodes","importMarkdown","markdown","editor","update","discrete","result","hasLineBreak","textContent","getEditorState","read","firstChild","getFirstChild","Error","getChildren","some","child","getTextContent","getStoredHardLineBreak","marker","textNodeTexts","block","lineBreakNode","find","undefined","filter","map","roundTrip","output","md","join","toBe","not","toContain"],"sources":["../../../../src/packages/@lexical/markdown/LexicalMarkdownHardLineBreak.spec.ts"],"sourcesContent":["import { createHeadlessEditor } from '@lexical/headless'\nimport { LinkNode } from '@lexical/link'\nimport { ListItemNode, ListNode } from '@lexical/list'\nimport { HeadingNode, QuoteNode } from '@lexical/rich-text'\nimport { $getRoot, $getState, $isElementNode, $isLineBreakNode, $isTextNode } from 'lexical'\nimport { describe, expect, it } from 'vitest'\n\nimport { $convertFromMarkdownString, $convertToMarkdownString } from './index.js'\nimport { hardLineBreakState, normalizeMarkdown } from './MarkdownTransformers.js'\n\nfunction createEditor() {\n return createHeadlessEditor({\n nodes: [HeadingNode, QuoteNode, ListNode, ListItemNode, LinkNode],\n })\n}\n\nfunction importMarkdown(markdown: string): { hasLineBreak: boolean; textContent: string } {\n const editor = createEditor()\n editor.update(() => $convertFromMarkdownString(markdown), { discrete: true })\n let result = { hasLineBreak: false, textContent: '' }\n editor.getEditorState().read(() => {\n const firstChild = $getRoot().getFirstChild()\n if (!$isElementNode(firstChild)) {\n throw new Error('Expected an element block')\n }\n result = {\n hasLineBreak: firstChild.getChildren().some((child) => $isLineBreakNode(child)),\n textContent: firstChild.getTextContent(),\n }\n })\n return result\n}\n\n// Returns the hard line break marker stored on the first LineBreakNode of the\n// first block, plus the text content of every text node in that block. Used to\n// assert the marker was moved off the text and onto the line break node, even\n// when the trailing whitespace was split into its own text node by an inline\n// transformer (e.g. after bold or a link).\nfunction getStoredHardLineBreak(markdown: string): {\n marker: string\n textNodeTexts: string[]\n} {\n const editor = createEditor()\n editor.update(() => $convertFromMarkdownString(markdown), { discrete: true })\n let result = { marker: '', textNodeTexts: [] as string[] }\n editor.getEditorState().read(() => {\n const block = $getRoot().getFirstChild()\n if (!$isElementNode(block)) {\n throw new Error('Expected an element block')\n }\n const lineBreakNode = block.getChildren().find((child) => $isLineBreakNode(child))\n if (lineBreakNode === undefined) {\n throw new Error('Expected a line break node')\n }\n result = {\n marker: $getState(lineBreakNode, hardLineBreakState),\n textNodeTexts: block\n .getChildren()\n .filter($isTextNode)\n .map((child) => child.getTextContent()),\n }\n })\n return result\n}\n\nfunction roundTrip(markdown: string): string {\n const editor = createEditor()\n editor.update(() => $convertFromMarkdownString(markdown), { discrete: true })\n let output = ''\n editor.getEditorState().read(() => {\n output = $convertToMarkdownString()\n })\n return output\n}\n\ndescribe('markdown hard line break normalization', () => {\n it('should preserve trailing-space hard breaks when merging adjacent lines', () => {\n const md = ['foo ', 'bar'].join('\\n')\n expect(normalizeMarkdown(md, true)).toBe(md)\n })\n\n it('should preserve the exact number of trailing spaces', () => {\n const md = ['foo ', 'bar'].join('\\n')\n expect(normalizeMarkdown(md, true)).toBe(md)\n })\n\n it('should preserve backslash hard breaks when merging adjacent lines', () => {\n const md = 'foo\\\\\\nbar'\n expect(normalizeMarkdown(md, true)).toBe(md)\n })\n\n it('should still merge a soft break into the previous line', () => {\n const md = ['foo', 'bar'].join('\\n')\n expect(normalizeMarkdown(md, true)).toBe('foo bar')\n })\n\n it('should merge a soft break before a hard-breaking line', () => {\n const md = ['foo', 'bar ', 'baz'].join('\\n')\n expect(normalizeMarkdown(md, true)).toBe(['foo bar ', 'baz'].join('\\n'))\n })\n})\n\ndescribe('markdown hard line break import', () => {\n it('should import a trailing-space hard break as a line break node with the marker stripped', () => {\n const { hasLineBreak, textContent } = importMarkdown(['foo ', 'bar'].join('\\n'))\n\n expect(hasLineBreak).toBe(true)\n // The marker is stripped from the text and represented by the line break node.\n expect(textContent).toBe('foo\\nbar')\n })\n\n it('should import a backslash hard break as a line break node with the marker stripped', () => {\n const { hasLineBreak, textContent } = importMarkdown('foo\\\\\\nbar')\n\n expect(hasLineBreak).toBe(true)\n expect(textContent).toBe('foo\\nbar')\n })\n\n it('should store the marker on the line break when the hard break follows formatted text', () => {\n const { marker, textNodeTexts } = getStoredHardLineBreak('**foo** \\nbar')\n\n expect(marker).toBe(' ')\n // The trailing-space marker is split into its own text node by the bold\n // transformer; it must be moved onto the line break node, not left as text.\n expect(textNodeTexts).not.toContain(' ')\n })\n\n it('should store the exact number of trailing spaces when the hard break follows formatted text', () => {\n const { marker } = getStoredHardLineBreak('**foo** \\nbar')\n\n expect(marker).toBe(' ')\n })\n\n it('should store the marker on the line break when the hard break follows a link', () => {\n const { marker } = getStoredHardLineBreak('[foo](https://payloadcms.com) \\nbar')\n\n expect(marker).toBe(' ')\n })\n})\n\ndescribe('markdown hard line break round trip', () => {\n it('should round trip a trailing-space hard break', () => {\n const md = ['foo ', 'bar'].join('\\n')\n expect(roundTrip(md)).toBe(md)\n })\n\n it('should round trip a backslash hard break', () => {\n const md = 'foo\\\\\\nbar'\n expect(roundTrip(md)).toBe(md)\n })\n\n it('should not introduce a hard break for a soft wrap', () => {\n expect(roundTrip(['foo', 'bar'].join('\\n'))).toBe('foo bar')\n })\n\n it('should round trip a hard break after formatted text', () => {\n const md = '**foo** \\nbar'\n expect(roundTrip(md)).toBe(md)\n })\n\n it('should round trip a hard break after a link', () => {\n const md = '[foo](https://payloadcms.com) \\nbar'\n expect(roundTrip(md)).toBe(md)\n })\n})\n"],"mappings":"AAAA,SAASA,oB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AAI,CAAC;IACpB;IACA;IACAtC,MAAA,CAAO2B,aAAA,EAAeY,GAAG,CAACC,SAAS,CAAC;EACtC;EAEAvC,EAAA,CAAG,+FAA+F;IAChG,MAAM;MAAEyB;IAAM,CAAE,GAAGD,sBAAA,CAAuB;IAE1CzB,MAAA,CAAO0B,MAAA,EAAQY,IAAI,CAAC;EACtB;EAEArC,EAAA,CAAG,gFAAgF;IACjF,MAAM;MAAEyB;IAAM,CAAE,GAAGD,sBAAA,CAAuB;IAE1CzB,MAAA,CAAO0B,MAAA,EAAQY,IAAI,CAAC;EACtB;AACF;AAEAvC,QAAA,CAAS,uCAAuC;EAC9CE,EAAA,CAAG,iDAAiD;IAClD,MAAMmC,EAAA,GAAK,CAAC,SAAS,MAAM,CAACC,IAAI,CAAC;IACjCrC,MAAA,CAAOkC,SAAA,CAAUE,EAAA,GAAKE,IAAI,CAACF,EAAA;EAC7B;EAEAnC,EAAA,CAAG,4CAA4C;IAC7C,MAAMmC,EAAA,GAAK;IACXpC,MAAA,CAAOkC,SAAA,CAAUE,EAAA,GAAKE,IAAI,CAACF,EAAA;EAC7B;EAEAnC,EAAA,CAAG,qDAAqD;IACtDD,MAAA,CAAOkC,SAAA,CAAU,CAAC,OAAO,MAAM,CAACG,IAAI,CAAC,QAAQC,IAAI,CAAC;EACpD;EAEArC,EAAA,CAAG,uDAAuD;IACxD,MAAMmC,EAAA,GAAK;IACXpC,MAAA,CAAOkC,SAAA,CAAUE,EAAA,GAAKE,IAAI,CAACF,EAAA;EAC7B;EAEAnC,EAAA,CAAG,+CAA+C;IAChD,MAAMmC,EAAA,GAAK;IACXpC,MAAA,CAAOkC,SAAA,CAAUE,EAAA,GAAKE,IAAI,CAACF,EAAA;EAC7B;AACF","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"MarkdownExport.d.ts","sourceRoot":"","sources":["../../../../src/packages/@lexical/markdown/MarkdownExport.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAyC,MAAM,SAAS,CAAA;AAIjF,OAAO,KAAK,EAKV,WAAW,EACZ,MAAM,2BAA2B,CAAA;AAIlC;;GAEG;AACH,wBAAgB,oBAAoB,CAClC,YAAY,EAAE,KAAK,CAAC,WAAW,CAAC,EAChC,sBAAsB,GAAE,OAAe,GACtC,CAAC,IAAI,CAAC,EAAE,WAAW,KAAK,MAAM,CAkDhC"}
1
+ {"version":3,"file":"MarkdownExport.d.ts","sourceRoot":"","sources":["../../../../src/packages/@lexical/markdown/MarkdownExport.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAwD,MAAM,SAAS,CAAA;AAWhG,OAAO,KAAK,EAKV,WAAW,EACZ,MAAM,2BAA2B,CAAA;AAKlC;;GAEG;AACH,wBAAgB,oBAAoB,CAClC,YAAY,EAAE,KAAK,CAAC,WAAW,CAAC,EAChC,sBAAsB,GAAE,OAAe,GACtC,CAAC,IAAI,CAAC,EAAE,WAAW,KAAK,MAAM,CAkDhC"}