@payloadcms/richtext-lexical 4.0.0-internal.38b7f1d → 4.0.0-internal.4c792ad

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 (603) 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 +1 -1
  4. package/dist/cell/rscEntry.d.ts.map +1 -1
  5. package/dist/cell/rscEntry.js +5 -5
  6. package/dist/cell/rscEntry.js.map +1 -1
  7. package/dist/exports/client/Field-VW7ZGT6K.js +2 -0
  8. package/dist/exports/client/Field-VW7ZGT6K.js.map +7 -0
  9. package/dist/exports/client/{RelationshipComponent-5RONAYJM.js → RelationshipComponent-YCPAKOL7.js} +2 -2
  10. package/dist/exports/client/RelationshipComponent-YCPAKOL7.js.map +7 -0
  11. package/dist/exports/client/bundled.css +1 -1
  12. package/dist/exports/client/chunk-4EIYXZ6H.js +12 -0
  13. package/dist/exports/client/chunk-4EIYXZ6H.js.map +7 -0
  14. package/dist/exports/client/chunk-5VIL27GI.js +2 -0
  15. package/dist/exports/client/chunk-5VIL27GI.js.map +7 -0
  16. package/dist/exports/client/chunk-ESITTE3C.js +2 -0
  17. package/dist/exports/client/chunk-ESITTE3C.js.map +7 -0
  18. package/dist/exports/client/{chunk-BZZVLW4U.js → chunk-RJ5MAOKZ.js} +1 -1
  19. package/dist/exports/client/chunk-RJ5MAOKZ.js.map +7 -0
  20. package/dist/exports/client/chunk-UD4DQ4AK.js +2 -0
  21. package/dist/exports/client/chunk-UD4DQ4AK.js.map +7 -0
  22. package/dist/exports/client/component-PHZQBOJE.js +2 -0
  23. package/dist/exports/client/component-PHZQBOJE.js.map +7 -0
  24. package/dist/exports/client/componentInline-H24N7GUG.js +2 -0
  25. package/dist/exports/client/index.d.ts +1 -0
  26. package/dist/exports/client/index.d.ts.map +1 -1
  27. package/dist/exports/client/index.js +25 -25
  28. package/dist/exports/client/index.js.map +4 -4
  29. package/dist/exports/react/index.d.ts +1 -1
  30. package/dist/exports/react/index.d.ts.map +1 -1
  31. package/dist/exports/react/index.js.map +1 -1
  32. package/dist/exports/server/rsc.browser.d.ts +11 -0
  33. package/dist/exports/server/rsc.browser.d.ts.map +1 -0
  34. package/dist/exports/server/rsc.browser.js +10 -0
  35. package/dist/exports/server/rsc.browser.js.map +1 -0
  36. package/dist/features/align/client/toolbarAlignGroup.d.ts.map +1 -1
  37. package/dist/features/blockquote/server/index.d.ts +1 -4
  38. package/dist/features/blockquote/server/index.d.ts.map +1 -1
  39. package/dist/features/blockquote/server/index.js +2 -0
  40. package/dist/features/blockquote/server/index.js.map +1 -1
  41. package/dist/features/blockquote/server/schema.d.ts +8 -0
  42. package/dist/features/blockquote/server/schema.d.ts.map +1 -0
  43. package/dist/features/blockquote/server/schema.js +15 -0
  44. package/dist/features/blockquote/server/schema.js.map +1 -0
  45. package/dist/features/blocks/client/component/index.d.ts +3 -2
  46. package/dist/features/blocks/client/component/index.d.ts.map +1 -1
  47. package/dist/features/blocks/client/component/index.js +18 -10
  48. package/dist/features/blocks/client/component/index.js.map +1 -1
  49. package/dist/features/blocks/client/componentInline/components/InlineBlockContainer.d.ts.map +1 -1
  50. package/dist/features/blocks/client/componentInline/index.d.ts +3 -2
  51. package/dist/features/blocks/client/componentInline/index.d.ts.map +1 -1
  52. package/dist/features/blocks/client/componentInline/index.js +17 -9
  53. package/dist/features/blocks/client/componentInline/index.js.map +1 -1
  54. package/dist/features/blocks/client/index.d.ts.map +1 -1
  55. package/dist/features/blocks/client/index.js +4 -2
  56. package/dist/features/blocks/client/index.js.map +1 -1
  57. package/dist/features/blocks/client/markdown/markdownTransformer.d.ts.map +1 -1
  58. package/dist/features/blocks/client/markdown/markdownTransformer.js +4 -4
  59. package/dist/features/blocks/client/markdown/markdownTransformer.js.map +1 -1
  60. package/dist/features/blocks/client/nodes/BlocksNode.d.ts +2 -2
  61. package/dist/features/blocks/client/nodes/BlocksNode.d.ts.map +1 -1
  62. package/dist/features/blocks/client/nodes/BlocksNode.js.map +1 -1
  63. package/dist/features/blocks/client/nodes/InlineBlocksNode.d.ts +2 -2
  64. package/dist/features/blocks/client/nodes/InlineBlocksNode.d.ts.map +1 -1
  65. package/dist/features/blocks/client/nodes/InlineBlocksNode.js.map +1 -1
  66. package/dist/features/blocks/client/plugin/index.d.ts +1 -1
  67. package/dist/features/blocks/client/plugin/index.d.ts.map +1 -1
  68. package/dist/features/blocks/client/plugin/index.js.map +1 -1
  69. package/dist/features/blocks/premade/CodeBlock/Component/Block.d.ts.map +1 -1
  70. package/dist/features/blocks/premade/CodeBlock/Component/Block.js +1 -0
  71. package/dist/features/blocks/premade/CodeBlock/Component/Block.js.map +1 -1
  72. package/dist/features/blocks/server/graphQLPopulationPromise.d.ts +1 -2
  73. package/dist/features/blocks/server/graphQLPopulationPromise.d.ts.map +1 -1
  74. package/dist/features/blocks/server/graphQLPopulationPromise.js.map +1 -1
  75. package/dist/features/blocks/server/index.d.ts +1 -0
  76. package/dist/features/blocks/server/index.d.ts.map +1 -1
  77. package/dist/features/blocks/server/index.js +24 -72
  78. package/dist/features/blocks/server/index.js.map +1 -1
  79. package/dist/features/blocks/server/markdown/markdownTransformer.d.ts.map +1 -1
  80. package/dist/features/blocks/server/markdown/markdownTransformer.js +4 -4
  81. package/dist/features/blocks/server/markdown/markdownTransformer.js.map +1 -1
  82. package/dist/features/blocks/server/nodes/BlocksNode.d.ts +1 -18
  83. package/dist/features/blocks/server/nodes/BlocksNode.d.ts.map +1 -1
  84. package/dist/features/blocks/server/nodes/BlocksNode.js.map +1 -1
  85. package/dist/features/blocks/server/nodes/InlineBlocksNode.d.ts +2 -10
  86. package/dist/features/blocks/server/nodes/InlineBlocksNode.d.ts.map +1 -1
  87. package/dist/features/blocks/server/nodes/InlineBlocksNode.js.map +1 -1
  88. package/dist/features/blocks/server/schema.d.ts +45 -0
  89. package/dist/features/blocks/server/schema.d.ts.map +1 -0
  90. package/dist/features/blocks/server/schema.js +139 -0
  91. package/dist/features/blocks/server/schema.js.map +1 -0
  92. package/dist/features/blocks/server/validate.d.ts +1 -2
  93. package/dist/features/blocks/server/validate.d.ts.map +1 -1
  94. package/dist/features/blocks/server/validate.js.map +1 -1
  95. package/dist/features/converters/htmlToLexical/index.d.ts +1 -1
  96. package/dist/features/converters/htmlToLexical/index.d.ts.map +1 -1
  97. package/dist/features/converters/htmlToLexical/index.js.map +1 -1
  98. package/dist/features/converters/lexicalToHtml/async/converters/blockquote.d.ts +1 -1
  99. package/dist/features/converters/lexicalToHtml/async/converters/blockquote.d.ts.map +1 -1
  100. package/dist/features/converters/lexicalToHtml/async/converters/blockquote.js.map +1 -1
  101. package/dist/features/converters/lexicalToHtml/async/converters/heading.d.ts +1 -1
  102. package/dist/features/converters/lexicalToHtml/async/converters/heading.d.ts.map +1 -1
  103. package/dist/features/converters/lexicalToHtml/async/converters/heading.js.map +1 -1
  104. package/dist/features/converters/lexicalToHtml/async/converters/horizontalRule.d.ts +1 -1
  105. package/dist/features/converters/lexicalToHtml/async/converters/horizontalRule.d.ts.map +1 -1
  106. package/dist/features/converters/lexicalToHtml/async/converters/horizontalRule.js.map +1 -1
  107. package/dist/features/converters/lexicalToHtml/async/converters/linebreak.d.ts +1 -1
  108. package/dist/features/converters/lexicalToHtml/async/converters/linebreak.d.ts.map +1 -1
  109. package/dist/features/converters/lexicalToHtml/async/converters/linebreak.js.map +1 -1
  110. package/dist/features/converters/lexicalToHtml/async/converters/link.d.ts +1 -1
  111. package/dist/features/converters/lexicalToHtml/async/converters/link.d.ts.map +1 -1
  112. package/dist/features/converters/lexicalToHtml/async/converters/link.js.map +1 -1
  113. package/dist/features/converters/lexicalToHtml/async/converters/list.d.ts +1 -1
  114. package/dist/features/converters/lexicalToHtml/async/converters/list.d.ts.map +1 -1
  115. package/dist/features/converters/lexicalToHtml/async/converters/list.js.map +1 -1
  116. package/dist/features/converters/lexicalToHtml/async/converters/paragraph.d.ts +1 -1
  117. package/dist/features/converters/lexicalToHtml/async/converters/paragraph.d.ts.map +1 -1
  118. package/dist/features/converters/lexicalToHtml/async/converters/paragraph.js.map +1 -1
  119. package/dist/features/converters/lexicalToHtml/async/converters/tab.d.ts +1 -1
  120. package/dist/features/converters/lexicalToHtml/async/converters/tab.d.ts.map +1 -1
  121. package/dist/features/converters/lexicalToHtml/async/converters/tab.js.map +1 -1
  122. package/dist/features/converters/lexicalToHtml/async/converters/table.d.ts +1 -1
  123. package/dist/features/converters/lexicalToHtml/async/converters/table.d.ts.map +1 -1
  124. package/dist/features/converters/lexicalToHtml/async/converters/table.js +1 -1
  125. package/dist/features/converters/lexicalToHtml/async/converters/table.js.map +1 -1
  126. package/dist/features/converters/lexicalToHtml/async/converters/text.d.ts +1 -1
  127. package/dist/features/converters/lexicalToHtml/async/converters/text.d.ts.map +1 -1
  128. package/dist/features/converters/lexicalToHtml/async/converters/text.js.map +1 -1
  129. package/dist/features/converters/lexicalToHtml/async/converters/upload.d.ts +1 -1
  130. package/dist/features/converters/lexicalToHtml/async/converters/upload.d.ts.map +1 -1
  131. package/dist/features/converters/lexicalToHtml/async/converters/upload.js.map +1 -1
  132. package/dist/features/converters/lexicalToHtml/async/defaultConverters.d.ts +1 -1
  133. package/dist/features/converters/lexicalToHtml/async/defaultConverters.d.ts.map +1 -1
  134. package/dist/features/converters/lexicalToHtml/async/defaultConverters.js.map +1 -1
  135. package/dist/features/converters/lexicalToHtml/async/types.d.ts +15 -16
  136. package/dist/features/converters/lexicalToHtml/async/types.d.ts.map +1 -1
  137. package/dist/features/converters/lexicalToHtml/async/types.js.map +1 -1
  138. package/dist/features/converters/lexicalToHtml/shared/cssColors.d.ts.map +1 -1
  139. package/dist/features/converters/lexicalToHtml/shared/findConverterForNode.js.map +1 -1
  140. package/dist/features/converters/lexicalToHtml/sync/converters/blockquote.d.ts +1 -1
  141. package/dist/features/converters/lexicalToHtml/sync/converters/blockquote.d.ts.map +1 -1
  142. package/dist/features/converters/lexicalToHtml/sync/converters/blockquote.js.map +1 -1
  143. package/dist/features/converters/lexicalToHtml/sync/converters/heading.d.ts +1 -1
  144. package/dist/features/converters/lexicalToHtml/sync/converters/heading.d.ts.map +1 -1
  145. package/dist/features/converters/lexicalToHtml/sync/converters/heading.js.map +1 -1
  146. package/dist/features/converters/lexicalToHtml/sync/converters/horizontalRule.d.ts +1 -1
  147. package/dist/features/converters/lexicalToHtml/sync/converters/horizontalRule.d.ts.map +1 -1
  148. package/dist/features/converters/lexicalToHtml/sync/converters/horizontalRule.js.map +1 -1
  149. package/dist/features/converters/lexicalToHtml/sync/converters/linebreak.d.ts +1 -1
  150. package/dist/features/converters/lexicalToHtml/sync/converters/linebreak.d.ts.map +1 -1
  151. package/dist/features/converters/lexicalToHtml/sync/converters/linebreak.js.map +1 -1
  152. package/dist/features/converters/lexicalToHtml/sync/converters/link.d.ts +1 -1
  153. package/dist/features/converters/lexicalToHtml/sync/converters/link.d.ts.map +1 -1
  154. package/dist/features/converters/lexicalToHtml/sync/converters/link.js.map +1 -1
  155. package/dist/features/converters/lexicalToHtml/sync/converters/list.d.ts +1 -1
  156. package/dist/features/converters/lexicalToHtml/sync/converters/list.d.ts.map +1 -1
  157. package/dist/features/converters/lexicalToHtml/sync/converters/list.js.map +1 -1
  158. package/dist/features/converters/lexicalToHtml/sync/converters/paragraph.d.ts +1 -1
  159. package/dist/features/converters/lexicalToHtml/sync/converters/paragraph.d.ts.map +1 -1
  160. package/dist/features/converters/lexicalToHtml/sync/converters/paragraph.js.map +1 -1
  161. package/dist/features/converters/lexicalToHtml/sync/converters/tab.d.ts +1 -1
  162. package/dist/features/converters/lexicalToHtml/sync/converters/tab.d.ts.map +1 -1
  163. package/dist/features/converters/lexicalToHtml/sync/converters/tab.js.map +1 -1
  164. package/dist/features/converters/lexicalToHtml/sync/converters/table.d.ts +1 -1
  165. package/dist/features/converters/lexicalToHtml/sync/converters/table.d.ts.map +1 -1
  166. package/dist/features/converters/lexicalToHtml/sync/converters/table.js +1 -1
  167. package/dist/features/converters/lexicalToHtml/sync/converters/table.js.map +1 -1
  168. package/dist/features/converters/lexicalToHtml/sync/converters/text.d.ts +1 -1
  169. package/dist/features/converters/lexicalToHtml/sync/converters/text.d.ts.map +1 -1
  170. package/dist/features/converters/lexicalToHtml/sync/converters/text.js.map +1 -1
  171. package/dist/features/converters/lexicalToHtml/sync/converters/upload.d.ts +1 -1
  172. package/dist/features/converters/lexicalToHtml/sync/converters/upload.d.ts.map +1 -1
  173. package/dist/features/converters/lexicalToHtml/sync/converters/upload.js.map +1 -1
  174. package/dist/features/converters/lexicalToHtml/sync/defaultConverters.d.ts +1 -1
  175. package/dist/features/converters/lexicalToHtml/sync/defaultConverters.d.ts.map +1 -1
  176. package/dist/features/converters/lexicalToHtml/sync/defaultConverters.js.map +1 -1
  177. package/dist/features/converters/lexicalToHtml/sync/types.d.ts +15 -16
  178. package/dist/features/converters/lexicalToHtml/sync/types.d.ts.map +1 -1
  179. package/dist/features/converters/lexicalToHtml/sync/types.js.map +1 -1
  180. package/dist/features/converters/lexicalToJSX/Component/index.d.ts +6 -4
  181. package/dist/features/converters/lexicalToJSX/Component/index.d.ts.map +1 -1
  182. package/dist/features/converters/lexicalToJSX/Component/index.js +5 -4
  183. package/dist/features/converters/lexicalToJSX/Component/index.js.map +1 -1
  184. package/dist/features/converters/lexicalToJSX/converter/converters/blockquote.d.ts +1 -1
  185. package/dist/features/converters/lexicalToJSX/converter/converters/blockquote.d.ts.map +1 -1
  186. package/dist/features/converters/lexicalToJSX/converter/converters/blockquote.js.map +1 -1
  187. package/dist/features/converters/lexicalToJSX/converter/converters/heading.d.ts +1 -1
  188. package/dist/features/converters/lexicalToJSX/converter/converters/heading.d.ts.map +1 -1
  189. package/dist/features/converters/lexicalToJSX/converter/converters/heading.js.map +1 -1
  190. package/dist/features/converters/lexicalToJSX/converter/converters/horizontalRule.d.ts +1 -1
  191. package/dist/features/converters/lexicalToJSX/converter/converters/horizontalRule.d.ts.map +1 -1
  192. package/dist/features/converters/lexicalToJSX/converter/converters/horizontalRule.js.map +1 -1
  193. package/dist/features/converters/lexicalToJSX/converter/converters/linebreak.d.ts +1 -1
  194. package/dist/features/converters/lexicalToJSX/converter/converters/linebreak.d.ts.map +1 -1
  195. package/dist/features/converters/lexicalToJSX/converter/converters/linebreak.js.map +1 -1
  196. package/dist/features/converters/lexicalToJSX/converter/converters/link.d.ts +1 -1
  197. package/dist/features/converters/lexicalToJSX/converter/converters/link.d.ts.map +1 -1
  198. package/dist/features/converters/lexicalToJSX/converter/converters/link.js.map +1 -1
  199. package/dist/features/converters/lexicalToJSX/converter/converters/list.d.ts +1 -1
  200. package/dist/features/converters/lexicalToJSX/converter/converters/list.d.ts.map +1 -1
  201. package/dist/features/converters/lexicalToJSX/converter/converters/list.js.map +1 -1
  202. package/dist/features/converters/lexicalToJSX/converter/converters/paragraph.d.ts +1 -1
  203. package/dist/features/converters/lexicalToJSX/converter/converters/paragraph.d.ts.map +1 -1
  204. package/dist/features/converters/lexicalToJSX/converter/converters/paragraph.js.map +1 -1
  205. package/dist/features/converters/lexicalToJSX/converter/converters/tab.d.ts +1 -1
  206. package/dist/features/converters/lexicalToJSX/converter/converters/tab.d.ts.map +1 -1
  207. package/dist/features/converters/lexicalToJSX/converter/converters/tab.js.map +1 -1
  208. package/dist/features/converters/lexicalToJSX/converter/converters/table.d.ts +1 -1
  209. package/dist/features/converters/lexicalToJSX/converter/converters/table.d.ts.map +1 -1
  210. package/dist/features/converters/lexicalToJSX/converter/converters/table.js.map +1 -1
  211. package/dist/features/converters/lexicalToJSX/converter/converters/text.d.ts +1 -1
  212. package/dist/features/converters/lexicalToJSX/converter/converters/text.d.ts.map +1 -1
  213. package/dist/features/converters/lexicalToJSX/converter/converters/text.js.map +1 -1
  214. package/dist/features/converters/lexicalToJSX/converter/converters/upload.d.ts +1 -1
  215. package/dist/features/converters/lexicalToJSX/converter/converters/upload.d.ts.map +1 -1
  216. package/dist/features/converters/lexicalToJSX/converter/converters/upload.js.map +1 -1
  217. package/dist/features/converters/lexicalToJSX/converter/defaultConverters.d.ts +1 -1
  218. package/dist/features/converters/lexicalToJSX/converter/defaultConverters.d.ts.map +1 -1
  219. package/dist/features/converters/lexicalToJSX/converter/defaultConverters.js.map +1 -1
  220. package/dist/features/converters/lexicalToJSX/converter/index.d.ts +1 -1
  221. package/dist/features/converters/lexicalToJSX/converter/index.d.ts.map +1 -1
  222. package/dist/features/converters/lexicalToJSX/converter/index.js.map +1 -1
  223. package/dist/features/converters/lexicalToJSX/converter/types.d.ts +13 -15
  224. package/dist/features/converters/lexicalToJSX/converter/types.d.ts.map +1 -1
  225. package/dist/features/converters/lexicalToJSX/converter/types.js.map +1 -1
  226. package/dist/features/converters/lexicalToMarkdown/index.d.ts.map +1 -1
  227. package/dist/features/converters/lexicalToPlaintext/convertLexicalToPlaintext.spec.js.map +1 -1
  228. package/dist/features/converters/lexicalToPlaintext/shared/findConverterForNode.js.map +1 -1
  229. package/dist/features/converters/lexicalToPlaintext/sync/types.d.ts +13 -15
  230. package/dist/features/converters/lexicalToPlaintext/sync/types.d.ts.map +1 -1
  231. package/dist/features/converters/lexicalToPlaintext/sync/types.js.map +1 -1
  232. package/dist/features/converters/markdownToLexical/index.d.ts +1 -1
  233. package/dist/features/converters/markdownToLexical/index.d.ts.map +1 -1
  234. package/dist/features/converters/markdownToLexical/index.js.map +1 -1
  235. package/dist/features/experimental_table/client/plugins/TableActionMenuPlugin/index.css +4 -4
  236. package/dist/features/experimental_table/client/plugins/TablePlugin/TableGridPopup/index.css +1 -1
  237. package/dist/features/experimental_table/server/index.d.ts +1 -6
  238. package/dist/features/experimental_table/server/index.d.ts.map +1 -1
  239. package/dist/features/experimental_table/server/index.js +4 -0
  240. package/dist/features/experimental_table/server/index.js.map +1 -1
  241. package/dist/features/experimental_table/server/schema.d.ts +27 -0
  242. package/dist/features/experimental_table/server/schema.d.ts.map +1 -0
  243. package/dist/features/experimental_table/server/schema.js +107 -0
  244. package/dist/features/experimental_table/server/schema.js.map +1 -0
  245. package/dist/features/format/shared/toolbarFormatGroup.d.ts.map +1 -1
  246. package/dist/features/heading/server/index.d.ts +2 -4
  247. package/dist/features/heading/server/index.d.ts.map +1 -1
  248. package/dist/features/heading/server/index.js +2 -0
  249. package/dist/features/heading/server/index.js.map +1 -1
  250. package/dist/features/heading/server/schema.d.ts +10 -0
  251. package/dist/features/heading/server/schema.d.ts.map +1 -0
  252. package/dist/features/heading/server/schema.js +37 -0
  253. package/dist/features/heading/server/schema.js.map +1 -0
  254. package/dist/features/horizontalRule/client/nodes/HorizontalRuleNode.d.ts +1 -1
  255. package/dist/features/horizontalRule/client/nodes/HorizontalRuleNode.d.ts.map +1 -1
  256. package/dist/features/horizontalRule/client/nodes/HorizontalRuleNode.js.map +1 -1
  257. package/dist/features/horizontalRule/server/index.d.ts +1 -0
  258. package/dist/features/horizontalRule/server/index.d.ts.map +1 -1
  259. package/dist/features/horizontalRule/server/index.js +2 -0
  260. package/dist/features/horizontalRule/server/index.js.map +1 -1
  261. package/dist/features/horizontalRule/server/nodes/HorizontalRuleNode.d.ts +1 -5
  262. package/dist/features/horizontalRule/server/nodes/HorizontalRuleNode.d.ts.map +1 -1
  263. package/dist/features/horizontalRule/server/nodes/HorizontalRuleNode.js.map +1 -1
  264. package/dist/features/horizontalRule/server/schema.d.ts +7 -0
  265. package/dist/features/horizontalRule/server/schema.d.ts.map +1 -0
  266. package/dist/features/horizontalRule/server/schema.js +25 -0
  267. package/dist/features/horizontalRule/server/schema.js.map +1 -0
  268. package/dist/features/indent/client/toolbarIndentGroup.d.ts.map +1 -1
  269. package/dist/features/link/client/index.d.ts.map +1 -1
  270. package/dist/features/link/client/index.js.map +1 -1
  271. package/dist/features/link/client/plugins/autoLink/index.d.ts +1 -1
  272. package/dist/features/link/client/plugins/autoLink/index.d.ts.map +1 -1
  273. package/dist/features/link/client/plugins/autoLink/index.js.map +1 -1
  274. package/dist/features/link/client/plugins/floatingLinkEditor/LinkEditor/index.js.map +1 -1
  275. package/dist/features/link/client/plugins/floatingLinkEditor/index.css +2 -2
  276. package/dist/features/link/client/plugins/floatingLinkEditor/types.d.ts +1 -1
  277. package/dist/features/link/client/plugins/floatingLinkEditor/types.d.ts.map +1 -1
  278. package/dist/features/link/client/plugins/floatingLinkEditor/types.js.map +1 -1
  279. package/dist/features/link/client/plugins/link/index.js.map +1 -1
  280. package/dist/features/link/markdownTransformer.d.ts +1 -1
  281. package/dist/features/link/markdownTransformer.d.ts.map +1 -1
  282. package/dist/features/link/markdownTransformer.js.map +1 -1
  283. package/dist/features/link/markdownTransformer.spec.js.map +1 -1
  284. package/dist/features/link/nodes/AutoLinkNode.d.ts +3 -3
  285. package/dist/features/link/nodes/AutoLinkNode.d.ts.map +1 -1
  286. package/dist/features/link/nodes/AutoLinkNode.js +2 -1
  287. package/dist/features/link/nodes/AutoLinkNode.js.map +1 -1
  288. package/dist/features/link/nodes/LinkNode.d.ts +3 -3
  289. package/dist/features/link/nodes/LinkNode.d.ts.map +1 -1
  290. package/dist/features/link/nodes/LinkNode.js +2 -1
  291. package/dist/features/link/nodes/LinkNode.js.map +1 -1
  292. package/dist/features/link/server/baseFields.d.ts.map +1 -1
  293. package/dist/features/link/server/baseFields.js.map +1 -1
  294. package/dist/features/link/server/graphQLPopulationPromise.d.ts +1 -1
  295. package/dist/features/link/server/graphQLPopulationPromise.d.ts.map +1 -1
  296. package/dist/features/link/server/graphQLPopulationPromise.js.map +1 -1
  297. package/dist/features/link/server/index.d.ts +2 -1
  298. package/dist/features/link/server/index.d.ts.map +1 -1
  299. package/dist/features/link/server/index.js +3 -0
  300. package/dist/features/link/server/index.js.map +1 -1
  301. package/dist/features/link/server/schema.d.ts +32 -0
  302. package/dist/features/link/server/schema.d.ts.map +1 -0
  303. package/dist/features/link/server/schema.js +169 -0
  304. package/dist/features/link/server/schema.js.map +1 -0
  305. package/dist/features/link/server/validate.d.ts +1 -1
  306. package/dist/features/link/server/validate.d.ts.map +1 -1
  307. package/dist/features/link/server/validate.js.map +1 -1
  308. package/dist/features/lists/checklist/server/index.d.ts.map +1 -1
  309. package/dist/features/lists/checklist/server/index.js +3 -0
  310. package/dist/features/lists/checklist/server/index.js.map +1 -1
  311. package/dist/features/lists/orderedList/server/index.d.ts.map +1 -1
  312. package/dist/features/lists/orderedList/server/index.js +3 -0
  313. package/dist/features/lists/orderedList/server/index.js.map +1 -1
  314. package/dist/features/lists/plugin/index.d.ts +0 -9
  315. package/dist/features/lists/plugin/index.d.ts.map +1 -1
  316. package/dist/features/lists/plugin/index.js.map +1 -1
  317. package/dist/features/lists/shared/markdown.d.ts.map +1 -1
  318. package/dist/features/lists/shared/schema.d.ts +18 -0
  319. package/dist/features/lists/shared/schema.d.ts.map +1 -0
  320. package/dist/features/lists/shared/schema.js +62 -0
  321. package/dist/features/lists/shared/schema.js.map +1 -0
  322. package/dist/features/lists/unorderedList/server/index.d.ts.map +1 -1
  323. package/dist/features/lists/unorderedList/server/index.js +3 -0
  324. package/dist/features/lists/unorderedList/server/index.js.map +1 -1
  325. package/dist/features/relationship/client/components/RelationshipComponent.d.ts +1 -1
  326. package/dist/features/relationship/client/components/RelationshipComponent.d.ts.map +1 -1
  327. package/dist/features/relationship/client/components/RelationshipComponent.js +2 -2
  328. package/dist/features/relationship/client/components/RelationshipComponent.js.map +1 -1
  329. package/dist/features/relationship/client/components/index.css +2 -2
  330. package/dist/features/relationship/client/drawer/index.d.ts.map +1 -1
  331. package/dist/features/relationship/client/nodes/RelationshipNode.d.ts +1 -1
  332. package/dist/features/relationship/client/nodes/RelationshipNode.d.ts.map +1 -1
  333. package/dist/features/relationship/client/nodes/RelationshipNode.js.map +1 -1
  334. package/dist/features/relationship/client/plugins/index.d.ts +1 -1
  335. package/dist/features/relationship/client/plugins/index.d.ts.map +1 -1
  336. package/dist/features/relationship/client/plugins/index.js.map +1 -1
  337. package/dist/features/relationship/client/utils/useEnabledRelationships.d.ts.map +1 -1
  338. package/dist/features/relationship/client/utils/useEnabledRelationships.js +9 -40
  339. package/dist/features/relationship/client/utils/useEnabledRelationships.js.map +1 -1
  340. package/dist/features/relationship/server/graphQLPopulationPromise.d.ts +1 -1
  341. package/dist/features/relationship/server/graphQLPopulationPromise.d.ts.map +1 -1
  342. package/dist/features/relationship/server/graphQLPopulationPromise.js.map +1 -1
  343. package/dist/features/relationship/server/index.d.ts +1 -0
  344. package/dist/features/relationship/server/index.d.ts.map +1 -1
  345. package/dist/features/relationship/server/index.js +2 -0
  346. package/dist/features/relationship/server/index.js.map +1 -1
  347. package/dist/features/relationship/server/nodes/RelationshipNode.d.ts +1 -10
  348. package/dist/features/relationship/server/nodes/RelationshipNode.d.ts.map +1 -1
  349. package/dist/features/relationship/server/nodes/RelationshipNode.js.map +1 -1
  350. package/dist/features/relationship/server/schema.d.ts +28 -0
  351. package/dist/features/relationship/server/schema.d.ts.map +1 -0
  352. package/dist/features/relationship/server/schema.js +80 -0
  353. package/dist/features/relationship/server/schema.js.map +1 -0
  354. package/dist/features/relationship/shared/filterEnabledRelationshipCollections.d.ts +23 -0
  355. package/dist/features/relationship/shared/filterEnabledRelationshipCollections.d.ts.map +1 -0
  356. package/dist/features/relationship/shared/filterEnabledRelationshipCollections.js +34 -0
  357. package/dist/features/relationship/shared/filterEnabledRelationshipCollections.js.map +1 -0
  358. package/dist/features/shared/toolbar/addDropdownGroup.d.ts.map +1 -1
  359. package/dist/features/shared/toolbar/featureButtonsGroup.d.ts.map +1 -1
  360. package/dist/features/shared/toolbar/textDropdownGroup.d.ts.map +1 -1
  361. package/dist/features/toolbars/shared/ToolbarButton/index.d.ts.map +1 -1
  362. package/dist/features/toolbars/shared/ToolbarDropdown/DropDown.d.ts.map +1 -1
  363. package/dist/features/toolbars/shared/ToolbarDropdown/DropDown.js +1 -2
  364. package/dist/features/toolbars/shared/ToolbarDropdown/DropDown.js.map +1 -1
  365. package/dist/features/toolbars/shared/ToolbarDropdown/index.css +4 -4
  366. package/dist/features/toolbars/shared/ToolbarDropdown/index.d.ts.map +1 -1
  367. package/dist/features/toolbars/shared/ToolbarDropdown/index.js.map +1 -1
  368. package/dist/features/toolbars/types.d.ts +1 -1
  369. package/dist/features/toolbars/types.d.ts.map +1 -1
  370. package/dist/features/toolbars/types.js.map +1 -1
  371. package/dist/features/typesClient.d.ts +1 -1
  372. package/dist/features/typesClient.d.ts.map +1 -1
  373. package/dist/features/typesClient.js.map +1 -1
  374. package/dist/features/typesServer.d.ts +18 -41
  375. package/dist/features/typesServer.d.ts.map +1 -1
  376. package/dist/features/typesServer.js.map +1 -1
  377. package/dist/features/upload/client/component/index.css +13 -17
  378. package/dist/features/upload/client/component/index.d.ts +1 -1
  379. package/dist/features/upload/client/component/index.d.ts.map +1 -1
  380. package/dist/features/upload/client/component/index.js +4 -4
  381. package/dist/features/upload/client/component/index.js.map +1 -1
  382. package/dist/features/upload/client/drawer/index.d.ts.map +1 -1
  383. package/dist/features/upload/client/nodes/UploadNode.d.ts +1 -1
  384. package/dist/features/upload/client/nodes/UploadNode.d.ts.map +1 -1
  385. package/dist/features/upload/client/nodes/UploadNode.js.map +1 -1
  386. package/dist/features/upload/client/plugin/index.d.ts +1 -1
  387. package/dist/features/upload/client/plugin/index.d.ts.map +1 -1
  388. package/dist/features/upload/client/plugin/index.js.map +1 -1
  389. package/dist/features/upload/server/graphQLPopulationPromise.d.ts +1 -1
  390. package/dist/features/upload/server/graphQLPopulationPromise.d.ts.map +1 -1
  391. package/dist/features/upload/server/graphQLPopulationPromise.js.map +1 -1
  392. package/dist/features/upload/server/index.d.ts +1 -0
  393. package/dist/features/upload/server/index.d.ts.map +1 -1
  394. package/dist/features/upload/server/index.js +3 -2
  395. package/dist/features/upload/server/index.js.map +1 -1
  396. package/dist/features/upload/server/nodes/UploadNode.d.ts +1 -55
  397. package/dist/features/upload/server/nodes/UploadNode.d.ts.map +1 -1
  398. package/dist/features/upload/server/nodes/UploadNode.js.map +1 -1
  399. package/dist/features/upload/server/nodes/conversions.d.ts.map +1 -1
  400. package/dist/features/upload/server/nodes/conversions.js.map +1 -1
  401. package/dist/features/upload/server/schema.d.ts +52 -0
  402. package/dist/features/upload/server/schema.d.ts.map +1 -0
  403. package/dist/features/upload/server/schema.js +129 -0
  404. package/dist/features/upload/server/schema.js.map +1 -0
  405. package/dist/features/upload/server/validate.d.ts +1 -1
  406. package/dist/features/upload/server/validate.d.ts.map +1 -1
  407. package/dist/features/upload/server/validate.js.map +1 -1
  408. package/dist/field/Diff/converters/link.d.ts +1 -1
  409. package/dist/field/Diff/converters/link.d.ts.map +1 -1
  410. package/dist/field/Diff/converters/link.js.map +1 -1
  411. package/dist/field/Diff/converters/listitem/index.css +44 -8
  412. package/dist/field/Diff/converters/listitem/index.d.ts +1 -1
  413. package/dist/field/Diff/converters/listitem/index.d.ts.map +1 -1
  414. package/dist/field/Diff/converters/listitem/index.js.map +1 -1
  415. package/dist/field/Diff/converters/relationship/index.css +76 -36
  416. package/dist/field/Diff/converters/relationship/index.d.ts +1 -1
  417. package/dist/field/Diff/converters/relationship/index.d.ts.map +1 -1
  418. package/dist/field/Diff/converters/relationship/index.js +10 -28
  419. package/dist/field/Diff/converters/relationship/index.js.map +1 -1
  420. package/dist/field/Diff/converters/unknown/index.js.map +1 -1
  421. package/dist/field/Diff/converters/upload/index.css +106 -43
  422. package/dist/field/Diff/converters/upload/index.d.ts +1 -1
  423. package/dist/field/Diff/converters/upload/index.d.ts.map +1 -1
  424. package/dist/field/Diff/converters/upload/index.js +6 -2
  425. package/dist/field/Diff/converters/upload/index.js.map +1 -1
  426. package/dist/field/Diff/index.css +116 -61
  427. package/dist/field/Diff/index.js.map +1 -1
  428. package/dist/field/Field.d.ts +1 -1
  429. package/dist/field/Field.d.ts.map +1 -1
  430. package/dist/field/Field.js +3 -4
  431. package/dist/field/Field.js.map +1 -1
  432. package/dist/field/RenderLexical/index.d.ts +2 -2
  433. package/dist/field/RenderLexical/index.d.ts.map +1 -1
  434. package/dist/field/RenderLexical/index.js.map +1 -1
  435. package/dist/field/RichTextViewProvider.d.ts +1 -1
  436. package/dist/field/RichTextViewProvider.d.ts.map +1 -1
  437. package/dist/field/RichTextViewProvider.js.map +1 -1
  438. package/dist/field/bundled.css +1 -1
  439. package/dist/field/clientEntry.d.ts +29 -0
  440. package/dist/field/clientEntry.d.ts.map +1 -0
  441. package/dist/field/clientEntry.js +86 -0
  442. package/dist/field/clientEntry.js.map +1 -0
  443. package/dist/field/index.css +12 -12
  444. package/dist/field/index.d.ts +1 -1
  445. package/dist/field/index.d.ts.map +1 -1
  446. package/dist/field/index.js +1 -1
  447. package/dist/field/index.js.map +1 -1
  448. package/dist/field/rscEntry.d.ts +1 -1
  449. package/dist/field/rscEntry.d.ts.map +1 -1
  450. package/dist/field/rscEntry.js +2 -0
  451. package/dist/field/rscEntry.js.map +1 -1
  452. package/dist/hooks.d.ts +6 -0
  453. package/dist/hooks.d.ts.map +1 -0
  454. package/dist/hooks.js +548 -0
  455. package/dist/hooks.js.map +1 -0
  456. package/dist/index.d.ts +11 -8
  457. package/dist/index.d.ts.map +1 -1
  458. package/dist/index.js +56 -622
  459. package/dist/index.js.map +1 -1
  460. package/dist/lexical/LexicalEditor.d.ts.map +1 -1
  461. package/dist/lexical/LexicalEditor.js +36 -2
  462. package/dist/lexical/LexicalEditor.js.map +1 -1
  463. package/dist/lexical/LexicalProvider.d.ts +1 -1
  464. package/dist/lexical/LexicalProvider.d.ts.map +1 -1
  465. package/dist/lexical/LexicalProvider.js +22 -7
  466. package/dist/lexical/LexicalProvider.js.map +1 -1
  467. package/dist/lexical/config/client/EditorConfigProvider.d.ts +1 -1
  468. package/dist/lexical/config/client/EditorConfigProvider.d.ts.map +1 -1
  469. package/dist/lexical/config/client/EditorConfigProvider.js.map +1 -1
  470. package/dist/lexical/config/client/loader.d.ts +1 -1
  471. package/dist/lexical/config/client/loader.d.ts.map +1 -1
  472. package/dist/lexical/config/client/loader.js +5 -1
  473. package/dist/lexical/config/client/loader.js.map +1 -1
  474. package/dist/lexical/config/client/sanitize.d.ts +1 -1
  475. package/dist/lexical/config/client/sanitize.d.ts.map +1 -1
  476. package/dist/lexical/config/client/sanitize.js.map +1 -1
  477. package/dist/lexical/config/server/sanitize.d.ts.map +1 -1
  478. package/dist/lexical/config/server/sanitize.js +9 -11
  479. package/dist/lexical/config/server/sanitize.js.map +1 -1
  480. package/dist/lexical/config/types.d.ts +1 -1
  481. package/dist/lexical/config/types.d.ts.map +1 -1
  482. package/dist/lexical/config/types.js.map +1 -1
  483. package/dist/lexical/nodes/index.d.ts +1 -1
  484. package/dist/lexical/nodes/index.d.ts.map +1 -1
  485. package/dist/lexical/nodes/index.js.map +1 -1
  486. package/dist/lexical/plugins/DecoratorPlugin/index.js.map +1 -1
  487. package/dist/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/types.d.ts +1 -1
  488. package/dist/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/types.d.ts.map +1 -1
  489. package/dist/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/types.js.map +1 -1
  490. package/dist/lexical/plugins/handles/DraggableBlockPlugin/debounce.d.ts.map +1 -1
  491. package/dist/lexical/plugins/handles/utils/calculateDistanceFromScrollerElem.d.ts.map +1 -1
  492. package/dist/lexical/theme/EditorTheme.css +4 -4
  493. package/dist/lexical/utils/markdown/createBlockNode.d.ts.map +1 -1
  494. package/dist/packages/@lexical/markdown/LexicalMarkdownHardLineBreak.spec.js +160 -0
  495. package/dist/packages/@lexical/markdown/LexicalMarkdownHardLineBreak.spec.js.map +1 -0
  496. package/dist/packages/@lexical/markdown/MarkdownExport.d.ts.map +1 -1
  497. package/dist/packages/@lexical/markdown/MarkdownExport.js +9 -2
  498. package/dist/packages/@lexical/markdown/MarkdownExport.js.map +1 -1
  499. package/dist/packages/@lexical/markdown/MarkdownImport.d.ts.map +1 -1
  500. package/dist/packages/@lexical/markdown/MarkdownImport.js +3 -2
  501. package/dist/packages/@lexical/markdown/MarkdownImport.js.map +1 -1
  502. package/dist/packages/@lexical/markdown/MarkdownTransformers.d.ts +27 -1
  503. package/dist/packages/@lexical/markdown/MarkdownTransformers.d.ts.map +1 -1
  504. package/dist/packages/@lexical/markdown/MarkdownTransformers.js +88 -4
  505. package/dist/packages/@lexical/markdown/MarkdownTransformers.js.map +1 -1
  506. package/dist/populateGraphQL/populateLexicalPopulationPromises.d.ts +1 -1
  507. package/dist/populateGraphQL/populateLexicalPopulationPromises.d.ts.map +1 -1
  508. package/dist/populateGraphQL/populateLexicalPopulationPromises.js.map +1 -1
  509. package/dist/populateGraphQL/recursivelyPopulateFieldsForGraphQL.d.ts.map +1 -1
  510. package/dist/types/builtInNodes.d.ts +14 -0
  511. package/dist/types/builtInNodes.d.ts.map +1 -0
  512. package/dist/types/builtInNodes.js +203 -0
  513. package/dist/types/builtInNodes.js.map +1 -0
  514. package/dist/{types.d.ts → types/index.d.ts} +25 -26
  515. package/dist/types/index.d.ts.map +1 -0
  516. package/dist/types/index.js +2 -0
  517. package/dist/types/index.js.map +1 -0
  518. package/dist/types/jsonSchemaHelpers.d.ts +30 -0
  519. package/dist/types/jsonSchemaHelpers.d.ts.map +1 -0
  520. package/dist/types/jsonSchemaHelpers.js +58 -0
  521. package/dist/types/jsonSchemaHelpers.js.map +1 -0
  522. package/dist/types/nodeTypes.d.ts +128 -0
  523. package/dist/types/nodeTypes.d.ts.map +1 -0
  524. package/dist/types/nodeTypes.js +6 -0
  525. package/dist/types/nodeTypes.js.map +1 -0
  526. package/dist/types/schema.d.ts +6 -0
  527. package/dist/types/schema.d.ts.map +1 -0
  528. package/dist/types/schema.js +83 -0
  529. package/dist/types/schema.js.map +1 -0
  530. package/dist/utilities/applyBaseFilterToFields.d.ts.map +1 -1
  531. package/dist/utilities/applyBaseFilterToFields.js +1 -2
  532. package/dist/utilities/applyBaseFilterToFields.js.map +1 -1
  533. package/dist/utilities/buildEditorState.d.ts +18 -4
  534. package/dist/utilities/buildEditorState.d.ts.map +1 -1
  535. package/dist/utilities/buildEditorState.js +8 -0
  536. package/dist/utilities/buildEditorState.js.map +1 -1
  537. package/dist/utilities/buildInitialState.d.ts +2 -1
  538. package/dist/utilities/buildInitialState.d.ts.map +1 -1
  539. package/dist/utilities/buildInitialState.js.map +1 -1
  540. package/dist/utilities/createClientFeature.d.ts +1 -1
  541. package/dist/utilities/createClientFeature.d.ts.map +1 -1
  542. package/dist/utilities/createClientFeature.js.map +1 -1
  543. package/dist/utilities/editorConfigFactory.d.ts +1 -1
  544. package/dist/utilities/editorConfigFactory.d.ts.map +1 -1
  545. package/dist/utilities/editorConfigFactory.js.map +1 -1
  546. package/dist/utilities/fieldsDrawer/Drawer.d.ts.map +1 -1
  547. package/dist/utilities/fieldsDrawer/Drawer.js +19 -10
  548. package/dist/utilities/fieldsDrawer/Drawer.js.map +1 -1
  549. package/dist/utilities/fieldsDrawer/DrawerContent.d.ts +4 -1
  550. package/dist/utilities/fieldsDrawer/DrawerContent.d.ts.map +1 -1
  551. package/dist/utilities/fieldsDrawer/DrawerContent.js +8 -7
  552. package/dist/utilities/fieldsDrawer/DrawerContent.js.map +1 -1
  553. package/dist/utilities/fieldsDrawer/index.css +12 -0
  554. package/dist/utilities/fieldsDrawer/useDrawerSubmit.d.ts +29 -0
  555. package/dist/utilities/fieldsDrawer/useDrawerSubmit.d.ts.map +1 -0
  556. package/dist/utilities/fieldsDrawer/useDrawerSubmit.js +97 -0
  557. package/dist/utilities/fieldsDrawer/useDrawerSubmit.js.map +1 -0
  558. package/dist/utilities/fieldsDrawer/useLexicalDocumentDrawer.d.ts.map +1 -1
  559. package/dist/utilities/fieldsDrawer/useLexicalDrawer.d.ts.map +1 -1
  560. package/dist/utilities/fieldsDrawer/useLexicalListDrawer.d.ts.map +1 -1
  561. package/dist/utilities/generateImportMap.d.ts +1 -1
  562. package/dist/utilities/generateImportMap.d.ts.map +1 -1
  563. package/dist/utilities/generateImportMap.js +7 -3
  564. package/dist/utilities/generateImportMap.js.map +1 -1
  565. package/dist/utilities/generateSchemaMap.d.ts.map +1 -1
  566. package/dist/utilities/getDefaultSanitizedEditorConfig.d.ts.map +1 -1
  567. package/dist/utilities/initLexicalFeatures.d.ts +1 -1
  568. package/dist/utilities/initLexicalFeatures.d.ts.map +1 -1
  569. package/dist/utilities/initLexicalFeatures.js.map +1 -1
  570. package/dist/utilities/recurseNodeTree.d.ts.map +1 -1
  571. package/dist/utilities/upgradeLexicalData/upgradeDocumentFieldsRecursively.d.ts.map +1 -1
  572. package/dist/utilities/upgradeLexicalData/upgradeDocumentFieldsRecursively.js +1 -1
  573. package/dist/utilities/upgradeLexicalData/upgradeDocumentFieldsRecursively.js.map +1 -1
  574. package/dist/utilities/useLexicalFeature.d.ts.map +1 -1
  575. package/dist/validate/index.d.ts.map +1 -1
  576. package/package.json +14 -13
  577. package/dist/exports/client/Field-PJW7KUJG.js +0 -2
  578. package/dist/exports/client/Field-PJW7KUJG.js.map +0 -7
  579. package/dist/exports/client/RelationshipComponent-5RONAYJM.js.map +0 -7
  580. package/dist/exports/client/chunk-44G3K3W7.js +0 -2
  581. package/dist/exports/client/chunk-44G3K3W7.js.map +0 -7
  582. package/dist/exports/client/chunk-BZZVLW4U.js.map +0 -7
  583. package/dist/exports/client/chunk-FTT5KJ6W.js +0 -12
  584. package/dist/exports/client/chunk-FTT5KJ6W.js.map +0 -7
  585. package/dist/exports/client/chunk-INBEEENE.js +0 -2
  586. package/dist/exports/client/chunk-INBEEENE.js.map +0 -7
  587. package/dist/exports/client/chunk-QJ5EETIB.js +0 -2
  588. package/dist/exports/client/chunk-QJ5EETIB.js.map +0 -7
  589. package/dist/exports/client/component-53Y3RYR5.js +0 -2
  590. package/dist/exports/client/component-53Y3RYR5.js.map +0 -7
  591. package/dist/exports/client/componentInline-PM4PLNUK.js +0 -2
  592. package/dist/features/link/nodes/types.d.ts +0 -27
  593. package/dist/features/link/nodes/types.d.ts.map +0 -1
  594. package/dist/features/link/nodes/types.js +0 -2
  595. package/dist/features/link/nodes/types.js.map +0 -1
  596. package/dist/nodeTypes.d.ts +0 -74
  597. package/dist/nodeTypes.d.ts.map +0 -1
  598. package/dist/nodeTypes.js +0 -5
  599. package/dist/nodeTypes.js.map +0 -1
  600. package/dist/types.d.ts.map +0 -1
  601. package/dist/types.js +0 -2
  602. package/dist/types.js.map +0 -1
  603. /package/dist/exports/client/{componentInline-PM4PLNUK.js.map → componentInline-H24N7GUG.js.map} +0 -0
@@ -6,7 +6,7 @@
6
6
  *
7
7
  */import { $createListItemNode, $createListNode, $isListItemNode, $isListNode, ListItemNode, ListNode } from '@lexical/list';
8
8
  import { $createHeadingNode, $createQuoteNode, $isHeadingNode, $isQuoteNode, HeadingNode, QuoteNode } from '@lexical/rich-text';
9
- import { $createLineBreakNode } from 'lexical';
9
+ import { $createLineBreakNode, $isLineBreakNode, $isTextNode, $setState, createState } from 'lexical';
10
10
  const EMPTY_OR_WHITESPACE_ONLY = /^[\t ]*$/;
11
11
  const ORDERED_LIST_REGEX = /^(\s*)(\d+)\.\s/;
12
12
  const UNORDERED_LIST_REGEX = /^(\s*)[-*+]\s/;
@@ -20,6 +20,84 @@ const TABLE_ROW_REG_EXP = /^\|(.+)\|\s?$/;
20
20
  const TABLE_ROW_DIVIDER_REG_EXP = /^(\| ?:?-*:? ?)+\|\s?$/;
21
21
  const TAG_START_REGEX = /^[ \t]*<[a-z_][\w-]*(?:\s[^<>]*)?\/?>/i;
22
22
  const TAG_END_REGEX = /^[ \t]*<\/[a-z_][\w-]*\s*>/i;
23
+ /**
24
+ * Stores the original hard line break marker on a `LineBreakNode` so it can be
25
+ * preserved across a markdown import/export round trip instead of being
26
+ * collapsed into a soft line break.
27
+ *
28
+ * Note: unlike upstream Lexical (which sets `resetOnCopyNode: true`), that option
29
+ * does not exist in the `lexical` version pinned here (0.41.0), so it is omitted.
30
+ */
31
+ export const hardLineBreakState = createState('mdHardLineBreak', {
32
+ parse: val => {
33
+ if (typeof val === 'string' && /^(\\| {2,})$/.test(val)) {
34
+ return val;
35
+ }
36
+ return '';
37
+ }
38
+ });
39
+ /**
40
+ * Detects a CommonMark hard line break marker at the end of a raw line.
41
+ *
42
+ * @returns a tuple of `[textWithoutMarker, marker]` when a marker is found, otherwise null.
43
+ */
44
+ export function parseMarkdownHardLineBreak(line) {
45
+ if (line.endsWith('\\')) {
46
+ return [line.slice(0, -1), '\\'];
47
+ }
48
+ const spaces = line.match(/^(.*?\S)( {2,})$/);
49
+ return spaces ? [spaces[1], spaces[2]] : null;
50
+ }
51
+ function hasNonWhitespaceContentOnLine(children, endIndex) {
52
+ for (let i = endIndex - 1; i >= 0; i--) {
53
+ if ($isLineBreakNode(children[i])) {
54
+ return false;
55
+ }
56
+ if (/\S/.test(children[i].getTextContent())) {
57
+ return true;
58
+ }
59
+ }
60
+ return false;
61
+ }
62
+ /**
63
+ * Removes a trailing hard line break marker from the last text node of `previousNode`
64
+ * (if present) and returns the marker, so it can be carried onto a `LineBreakNode`.
65
+ */
66
+ function $extractMarkdownHardLineBreakMarker(previousNode) {
67
+ const children = previousNode.getChildren();
68
+ const lastChildIndex = children.length - 1;
69
+ const lastChild = children[lastChildIndex];
70
+ if (!$isTextNode(lastChild)) {
71
+ return null;
72
+ }
73
+ const lastText = lastChild.getTextContent();
74
+ const hardLineBreak = parseMarkdownHardLineBreak(lastText);
75
+ if (hardLineBreak !== null) {
76
+ const [text, marker] = hardLineBreak;
77
+ lastChild.setTextContent(text);
78
+ return marker;
79
+ }
80
+ // Trailing whitespace may have been split into its own text node by inline
81
+ // transformers (e.g. after formatted or linked content). Only treat it as a
82
+ // hard break when there is preceding non-whitespace content on the same line.
83
+ if (/^ {2,}$/.test(lastText) && hasNonWhitespaceContentOnLine(children, lastChildIndex)) {
84
+ lastChild.setTextContent('');
85
+ return lastText;
86
+ }
87
+ return null;
88
+ }
89
+ /**
90
+ * Creates a `LineBreakNode` for a markdown line join, preserving any CommonMark
91
+ * hard line break marker found at the end of `previousNode` via node state.
92
+ */
93
+ export function $createMarkdownLineBreakNode(previousNode) {
94
+ const lineBreakNode = $createLineBreakNode();
95
+ const hardLineBreak = $extractMarkdownHardLineBreakMarker(previousNode);
96
+ if (hardLineBreak !== null) {
97
+ $setState(lineBreakNode, hardLineBreakState, hardLineBreak);
98
+ }
99
+ return lineBreakNode;
100
+ }
23
101
  const createBlockNode = createNode => {
24
102
  return (parentNode, children, match) => {
25
103
  const node = createNode(match);
@@ -130,7 +208,7 @@ export const QUOTE = {
130
208
  if (isImport) {
131
209
  const previousNode = parentNode.getPreviousSibling();
132
210
  if ($isQuoteNode(previousNode)) {
133
- previousNode.splice(previousNode.getChildrenSize(), 0, [$createLineBreakNode(), ...children]);
211
+ previousNode.splice(previousNode.getChildrenSize(), 0, [$createMarkdownLineBreakNode(previousNode), ...children]);
134
212
  previousNode.select(0, 0);
135
213
  parentNode.remove();
136
214
  return;
@@ -225,6 +303,9 @@ export function normalizeMarkdown(input, shouldMergeAdjacentLines) {
225
303
  for (let i = 0; i < lines.length; i++) {
226
304
  const line = lines[i];
227
305
  const lastLine = sanitizedLines[sanitizedLines.length - 1];
306
+ // A hard line break marker on the current line only matters if another line follows it.
307
+ const hardLineBreak = i < lines.length - 1 ? parseMarkdownHardLineBreak(line) : null;
308
+ const lastLineHasHardLineBreak = lastLine !== undefined && parseMarkdownHardLineBreak(lastLine) !== null;
228
309
  // Code blocks of ```single line``` don't toggle the inCodeBlock flag
229
310
  if (CODE_SINGLE_LINE_REGEX.test(line)) {
230
311
  sanitizedLines.push(line);
@@ -257,10 +338,13 @@ export function normalizeMarkdown(input, shouldMergeAdjacentLines) {
257
338
  }
258
339
  // In markdown the concept of "empty paragraphs" does not exist.
259
340
  // Blocks must be separated by an empty line. Non-empty adjacent lines must be merged.
260
- if (EMPTY_OR_WHITESPACE_ONLY.test(line) || EMPTY_OR_WHITESPACE_ONLY.test(lastLine) || !lastLine || HEADING_REGEX.test(lastLine) || HEADING_REGEX.test(line) || QUOTE_REGEX.test(line) || ORDERED_LIST_REGEX.test(line) || UNORDERED_LIST_REGEX.test(line) || CHECK_LIST_REGEX.test(line) || TABLE_ROW_REG_EXP.test(line) || TABLE_ROW_DIVIDER_REG_EXP.test(line) || !shouldMergeAdjacentLines || TAG_START_REGEX.test(line) || TAG_END_REGEX.test(line) || TAG_START_REGEX.test(lastLine) || TAG_END_REGEX.test(lastLine) || CODE_END_REGEX.test(lastLine)) {
341
+ if (EMPTY_OR_WHITESPACE_ONLY.test(line) || EMPTY_OR_WHITESPACE_ONLY.test(lastLine) || !lastLine || HEADING_REGEX.test(lastLine) || HEADING_REGEX.test(line) || QUOTE_REGEX.test(line) || ORDERED_LIST_REGEX.test(line) || UNORDERED_LIST_REGEX.test(line) || CHECK_LIST_REGEX.test(line) || TABLE_ROW_REG_EXP.test(line) || TABLE_ROW_DIVIDER_REG_EXP.test(line) ||
342
+ // Don't merge the next line into a line that ends with a hard line break marker.
343
+ lastLineHasHardLineBreak || !shouldMergeAdjacentLines || TAG_START_REGEX.test(line) || TAG_END_REGEX.test(line) || TAG_START_REGEX.test(lastLine) || TAG_END_REGEX.test(lastLine) || CODE_END_REGEX.test(lastLine)) {
261
344
  sanitizedLines.push(line);
262
345
  } else {
263
- sanitizedLines[sanitizedLines.length - 1] = lastLine + ' ' + line.trim();
346
+ // Preserve a trailing hard line break marker on the merged line so it survives import.
347
+ sanitizedLines[sanitizedLines.length - 1] = lastLine + ' ' + (hardLineBreak === null ? line.trim() : line.trimStart());
264
348
  }
265
349
  }
266
350
  return sanitizedLines.join('\n');
@@ -1 +1 @@
1
- {"version":3,"file":"MarkdownTransformers.js","names":["$createListItemNode","$createListNode","$isListItemNode","$isListNode","ListItemNode","ListNode","$createHeadingNode","$createQuoteNode","$isHeadingNode","$isQuoteNode","HeadingNode","QuoteNode","$createLineBreakNode","EMPTY_OR_WHITESPACE_ONLY","ORDERED_LIST_REGEX","UNORDERED_LIST_REGEX","CHECK_LIST_REGEX","HEADING_REGEX","QUOTE_REGEX","CODE_START_REGEX","CODE_END_REGEX","CODE_SINGLE_LINE_REGEX","TABLE_ROW_REG_EXP","TABLE_ROW_DIVIDER_REG_EXP","TAG_START_REGEX","TAG_END_REGEX","createBlockNode","createNode","parentNode","children","match","node","append","replace","select","LIST_INDENT_SIZE","getIndent","whitespaces","tabs","spaces","indent","length","Math","floor","listReplace","listType","previousNode","getPreviousSibling","nextNode","getNextSibling","listItem","undefined","getListType","firstChild","getFirstChild","insertBefore","remove","list","Number","setIndent","listExport","listNode","exportChildren","depth","output","getChildren","index","listItemNode","getChildrenSize","push","repeat","prefix","getStart","getChecked","join","HEADING","type","dependencies","export","level","getTag","slice","regExp","tag","QUOTE","lines","split","line","_match","isImport","splice","UNORDERED_LIST","CHECK_LIST","ORDERED_LIST","INLINE_CODE","format","HIGHLIGHT","BOLD_ITALIC_STAR","BOLD_ITALIC_UNDERSCORE","intraword","BOLD_STAR","BOLD_UNDERSCORE","STRIKETHROUGH","ITALIC_STAR","ITALIC_UNDERSCORE","normalizeMarkdown","input","shouldMergeAdjacentLines","inCodeBlock","sanitizedLines","nestedDeepCodeBlock","i","lastLine","test","trim"],"sources":["../../../../src/packages/@lexical/markdown/MarkdownTransformers.ts"],"sourcesContent":["/* eslint-disable regexp/no-unused-capturing-group */\n/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n\nimport type { ListType } from '@lexical/list'\nimport type { HeadingTagType } from '@lexical/rich-text'\nimport type { ElementNode, Klass, LexicalNode, TextFormatType, TextNode } from 'lexical'\n\nimport {\n $createListItemNode,\n $createListNode,\n $isListItemNode,\n $isListNode,\n ListItemNode,\n ListNode,\n} from '@lexical/list'\nimport {\n $createHeadingNode,\n $createQuoteNode,\n $isHeadingNode,\n $isQuoteNode,\n HeadingNode,\n QuoteNode,\n} from '@lexical/rich-text'\nimport { $createLineBreakNode } from 'lexical'\n\nexport type Transformer =\n | ElementTransformer\n | MultilineElementTransformer\n | TextFormatTransformer\n | TextMatchTransformer\n\nexport type ElementTransformer = {\n dependencies: Array<Klass<LexicalNode>>\n /**\n * `export` is called when the `$convertToMarkdownString` is called to convert the editor state into markdown.\n *\n * @return return null to cancel the export, even though the regex matched. Lexical will then search for the next transformer.\n */\n export: (\n node: LexicalNode,\n\n traverseChildren: (node: ElementNode) => string,\n ) => null | string\n regExp: RegExp\n /**\n * `replace` is called when markdown is imported or typed in the editor\n *\n * @return return false to cancel the transform, even though the regex matched. Lexical will then search for the next transformer.\n */\n replace: (\n parentNode: ElementNode,\n children: Array<LexicalNode>,\n match: Array<string>,\n /**\n * Whether the match is from an import operation (e.g. through `$convertFromMarkdownString`) or not (e.g. through typing in the editor).\n */\n isImport: boolean,\n ) => boolean | void\n type: 'element'\n}\n\nexport type MultilineElementTransformer = {\n dependencies: Array<Klass<LexicalNode>>\n /**\n * `export` is called when the `$convertToMarkdownString` is called to convert the editor state into markdown.\n *\n * @return return null to cancel the export, even though the regex matched. Lexical will then search for the next transformer.\n */\n export?: (\n node: LexicalNode,\n\n traverseChildren: (node: ElementNode) => string,\n ) => null | string\n /**\n * Use this function to manually handle the import process, once the `regExpStart` has matched successfully.\n * Without providing this function, the default behavior is to match until `regExpEnd` is found, or until the end of the document if `regExpEnd.optional` is true.\n *\n * @returns a tuple or null. The first element of the returned tuple is a boolean indicating if a multiline element was imported. The second element is the index of the last line that was processed. If null is returned, the next multilineElementTransformer will be tried. If undefined is returned, the default behavior will be used.\n */\n handleImportAfterStartMatch?: (args: {\n lines: Array<string>\n rootNode: ElementNode\n startLineIndex: number\n startMatch: RegExpMatchArray\n transformer: MultilineElementTransformer\n }) => [boolean, number] | null | undefined\n /**\n * This regex determines when to stop matching. Anything in between regExpStart and regExpEnd will be matched\n */\n regExpEnd?:\n | {\n /**\n * Whether the end match is optional. If true, the end match is not required to match for the transformer to be triggered.\n * The entire text from regexpStart to the end of the document will then be matched.\n */\n optional?: true\n regExp: RegExp\n }\n | RegExp\n /**\n * This regex determines when to start matching\n */\n regExpStart: RegExp\n /**\n * `replace` is called only when markdown is imported in the editor, not when it's typed\n *\n * @return return false to cancel the transform, even though the regex matched. Lexical will then search for the next transformer.\n */\n replace: (\n rootNode: ElementNode,\n /**\n * During markdown shortcut transforms, children nodes may be provided to the transformer. If this is the case, no `linesInBetween` will be provided and\n * the children nodes should be used instead of the `linesInBetween` to create the new node.\n */\n children: Array<LexicalNode> | null,\n startMatch: Array<string>,\n endMatch: Array<string> | null,\n /**\n * linesInBetween includes the text between the start & end matches, split up by lines, not including the matches themselves.\n * This is null when the transformer is triggered through markdown shortcuts (by typing in the editor)\n */\n linesInBetween: Array<string> | null,\n /**\n * Whether the match is from an import operation (e.g. through `$convertFromMarkdownString`) or not (e.g. through typing in the editor).\n */\n isImport: boolean,\n ) => boolean | void\n type: 'multiline-element'\n}\n\nexport type TextFormatTransformer = Readonly<{\n format: ReadonlyArray<TextFormatType>\n intraword?: boolean\n tag: string\n type: 'text-format'\n}>\n\nexport type TextMatchTransformer = Readonly<{\n dependencies: Array<Klass<LexicalNode>>\n /**\n * Determines how a node should be exported to markdown\n */\n export?: (\n node: LexicalNode,\n\n exportChildren: (node: ElementNode) => string,\n\n exportFormat: (node: TextNode, textContent: string) => string,\n ) => null | string\n /**\n * For import operations, this function can be used to determine the end index of the match, after `importRegExp` has matched.\n * Without this function, the end index will be determined by the length of the match from `importRegExp`. Manually determining the end index can be useful if\n * the match from `importRegExp` is not the entire text content of the node. That way, `importRegExp` can be used to match only the start of the node, and `getEndIndex`\n * can be used to match the end of the node.\n *\n * @returns The end index of the match, or false if the match was unsuccessful and a different transformer should be tried.\n */\n getEndIndex?: (node: TextNode, match: RegExpMatchArray) => false | number\n /**\n * This regex determines what text is matched during markdown imports\n */\n importRegExp?: RegExp\n /**\n * This regex determines what text is matched for markdown shortcuts while typing in the editor\n */\n regExp: RegExp\n /**\n * Determines how the matched markdown text should be transformed into a node during the markdown import process\n *\n * @returns nothing, or a TextNode that may be a child of the new node that is created.\n * If a TextNode is returned, text format matching will be applied to it (e.g. bold, italic, etc.)\n */\n replace?: (node: TextNode, match: RegExpMatchArray) => TextNode | void\n /**\n * Single character that allows the transformer to trigger when typed in the editor. This does not affect markdown imports outside of the markdown shortcut plugin.\n * If the trigger is matched, the `regExp` will be used to match the text in the second step.\n */\n trigger?: string\n type: 'text-match'\n}>\n\nconst EMPTY_OR_WHITESPACE_ONLY = /^[\\t ]*$/\nconst ORDERED_LIST_REGEX = /^(\\s*)(\\d+)\\.\\s/\nconst UNORDERED_LIST_REGEX = /^(\\s*)[-*+]\\s/\nconst CHECK_LIST_REGEX = /^(\\s*)(?:-\\s)?\\s?(\\[(\\s|x)?\\])\\s/i\nconst HEADING_REGEX = /^(#{1,6})\\s/\nconst QUOTE_REGEX = /^>\\s/\nconst CODE_START_REGEX = /^[ \\t]*(\\\\`\\\\`\\\\`|```)(\\w+)?/\nconst CODE_END_REGEX = /[ \\t]*(\\\\`\\\\`\\\\`|```)$/\nconst CODE_SINGLE_LINE_REGEX = /^[ \\t]*```[^`]+(?:(?:`{1,2}|`{4,})[^`]+)*```(?:[^`]|$)/\nconst TABLE_ROW_REG_EXP = /^\\|(.+)\\|\\s?$/\nconst TABLE_ROW_DIVIDER_REG_EXP = /^(\\| ?:?-*:? ?)+\\|\\s?$/\nconst TAG_START_REGEX = /^[ \\t]*<[a-z_][\\w-]*(?:\\s[^<>]*)?\\/?>/i\nconst TAG_END_REGEX = /^[ \\t]*<\\/[a-z_][\\w-]*\\s*>/i\n\nconst createBlockNode = (\n createNode: (match: Array<string>) => ElementNode,\n): ElementTransformer['replace'] => {\n return (parentNode, children, match) => {\n const node = createNode(match)\n node.append(...children)\n parentNode.replace(node)\n node.select(0, 0)\n }\n}\n\n// Amount of spaces that define indentation level\n// TODO: should be an option\nconst LIST_INDENT_SIZE = 4\n\nfunction getIndent(whitespaces: string): number {\n const tabs = whitespaces.match(/\\t/g)\n const spaces = whitespaces.match(/ /g)\n\n let indent = 0\n\n if (tabs) {\n indent += tabs.length\n }\n\n if (spaces) {\n indent += Math.floor(spaces.length / LIST_INDENT_SIZE)\n }\n\n return indent\n}\n\nconst listReplace = (listType: ListType): ElementTransformer['replace'] => {\n return (parentNode, children, match) => {\n const previousNode = parentNode.getPreviousSibling()\n const nextNode = parentNode.getNextSibling()\n const listItem = $createListItemNode(listType === 'check' ? match[3] === 'x' : undefined)\n if ($isListNode(nextNode) && nextNode.getListType() === listType) {\n const firstChild = nextNode.getFirstChild()\n if (firstChild !== null) {\n firstChild.insertBefore(listItem)\n } else {\n // should never happen, but let's handle gracefully, just in case.\n nextNode.append(listItem)\n }\n parentNode.remove()\n } else if ($isListNode(previousNode) && previousNode.getListType() === listType) {\n previousNode.append(listItem)\n parentNode.remove()\n } else {\n const list = $createListNode(listType, listType === 'number' ? Number(match[2]) : undefined)\n list.append(listItem)\n parentNode.replace(list)\n }\n listItem.append(...children)\n listItem.select(0, 0)\n const indent = getIndent(match[1]!)\n if (indent) {\n listItem.setIndent(indent)\n }\n }\n}\n\nconst listExport = (\n listNode: ListNode,\n exportChildren: (node: ElementNode) => string,\n depth: number,\n): string => {\n const output: string[] = []\n const children = listNode.getChildren()\n let index = 0\n for (const listItemNode of children) {\n if ($isListItemNode(listItemNode)) {\n if (listItemNode.getChildrenSize() === 1) {\n const firstChild = listItemNode.getFirstChild()\n if ($isListNode(firstChild)) {\n output.push(listExport(firstChild, exportChildren, depth + 1))\n continue\n }\n }\n const indent = ' '.repeat(depth * LIST_INDENT_SIZE)\n const listType = listNode.getListType()\n const prefix =\n listType === 'number'\n ? `${listNode.getStart() + index}. `\n : listType === 'check'\n ? `- [${listItemNode.getChecked() ? 'x' : ' '}] `\n : '- '\n output.push(indent + prefix + exportChildren(listItemNode))\n index++\n }\n }\n\n return output.join('\\n')\n}\n\nexport const HEADING: ElementTransformer = {\n type: 'element',\n dependencies: [HeadingNode],\n export: (node, exportChildren) => {\n if (!$isHeadingNode(node)) {\n return null\n }\n const level = Number(node.getTag().slice(1))\n return '#'.repeat(level) + ' ' + exportChildren(node)\n },\n regExp: HEADING_REGEX,\n replace: createBlockNode((match) => {\n const tag = ('h' + match[1]!.length) as HeadingTagType\n return $createHeadingNode(tag)\n }),\n}\n\nexport const QUOTE: ElementTransformer = {\n type: 'element',\n dependencies: [QuoteNode],\n export: (node, exportChildren) => {\n if (!$isQuoteNode(node)) {\n return null\n }\n\n const lines = exportChildren(node).split('\\n')\n const output: string[] = []\n for (const line of lines) {\n output.push('> ' + line)\n }\n return output.join('\\n')\n },\n regExp: QUOTE_REGEX,\n replace: (parentNode, children, _match, isImport) => {\n if (isImport) {\n const previousNode = parentNode.getPreviousSibling()\n if ($isQuoteNode(previousNode)) {\n previousNode.splice(previousNode.getChildrenSize(), 0, [\n $createLineBreakNode(),\n ...children,\n ])\n previousNode.select(0, 0)\n parentNode.remove()\n return\n }\n }\n\n const node = $createQuoteNode()\n node.append(...children)\n parentNode.replace(node)\n node.select(0, 0)\n },\n}\n\nexport const UNORDERED_LIST: ElementTransformer = {\n type: 'element',\n dependencies: [ListNode, ListItemNode],\n export: (node, exportChildren) => {\n return $isListNode(node) ? listExport(node, exportChildren, 0) : null\n },\n regExp: UNORDERED_LIST_REGEX,\n replace: listReplace('bullet'),\n}\n\nexport const CHECK_LIST: ElementTransformer = {\n type: 'element',\n dependencies: [ListNode, ListItemNode],\n export: (node, exportChildren) => {\n return $isListNode(node) ? listExport(node, exportChildren, 0) : null\n },\n regExp: CHECK_LIST_REGEX,\n replace: listReplace('check'),\n}\n\nexport const ORDERED_LIST: ElementTransformer = {\n type: 'element',\n dependencies: [ListNode, ListItemNode],\n export: (node, exportChildren) => {\n return $isListNode(node) ? listExport(node, exportChildren, 0) : null\n },\n regExp: ORDERED_LIST_REGEX,\n replace: listReplace('number'),\n}\n\nexport const INLINE_CODE: TextFormatTransformer = {\n type: 'text-format',\n format: ['code'],\n tag: '`',\n}\n\nexport const HIGHLIGHT: TextFormatTransformer = {\n type: 'text-format',\n format: ['highlight'],\n tag: '==',\n}\n\nexport const BOLD_ITALIC_STAR: TextFormatTransformer = {\n type: 'text-format',\n format: ['bold', 'italic'],\n tag: '***',\n}\n\nexport const BOLD_ITALIC_UNDERSCORE: TextFormatTransformer = {\n type: 'text-format',\n format: ['bold', 'italic'],\n intraword: false,\n tag: '___',\n}\n\nexport const BOLD_STAR: TextFormatTransformer = {\n type: 'text-format',\n format: ['bold'],\n tag: '**',\n}\n\nexport const BOLD_UNDERSCORE: TextFormatTransformer = {\n type: 'text-format',\n format: ['bold'],\n intraword: false,\n tag: '__',\n}\n\nexport const STRIKETHROUGH: TextFormatTransformer = {\n type: 'text-format',\n format: ['strikethrough'],\n tag: '~~',\n}\n\nexport const ITALIC_STAR: TextFormatTransformer = {\n type: 'text-format',\n format: ['italic'],\n tag: '*',\n}\n\nexport const ITALIC_UNDERSCORE: TextFormatTransformer = {\n type: 'text-format',\n format: ['italic'],\n intraword: false,\n tag: '_',\n}\n\nexport function normalizeMarkdown(input: string, shouldMergeAdjacentLines: boolean): string {\n const lines = input.split('\\n')\n let inCodeBlock = false\n const sanitizedLines: string[] = []\n let nestedDeepCodeBlock = 0\n\n for (let i = 0; i < lines.length; i++) {\n const line = lines[i]!\n const lastLine = sanitizedLines[sanitizedLines.length - 1]\n\n // Code blocks of ```single line``` don't toggle the inCodeBlock flag\n if (CODE_SINGLE_LINE_REGEX.test(line)) {\n sanitizedLines.push(line)\n continue\n }\n\n if (CODE_END_REGEX.test(line)) {\n if (nestedDeepCodeBlock === 0) {\n inCodeBlock = true\n }\n if (nestedDeepCodeBlock === 1) {\n inCodeBlock = false\n }\n if (nestedDeepCodeBlock > 0) {\n nestedDeepCodeBlock--\n }\n sanitizedLines.push(line)\n continue\n }\n\n // Toggle inCodeBlock state when encountering start or end of a code block\n if (CODE_START_REGEX.test(line)) {\n inCodeBlock = true\n nestedDeepCodeBlock++\n sanitizedLines.push(line)\n continue\n }\n\n // If we are inside a code block, keep the line unchanged\n if (inCodeBlock) {\n sanitizedLines.push(line)\n continue\n }\n\n // In markdown the concept of \"empty paragraphs\" does not exist.\n // Blocks must be separated by an empty line. Non-empty adjacent lines must be merged.\n if (\n EMPTY_OR_WHITESPACE_ONLY.test(line) ||\n EMPTY_OR_WHITESPACE_ONLY.test(lastLine!) ||\n !lastLine ||\n HEADING_REGEX.test(lastLine) ||\n HEADING_REGEX.test(line) ||\n QUOTE_REGEX.test(line) ||\n ORDERED_LIST_REGEX.test(line) ||\n UNORDERED_LIST_REGEX.test(line) ||\n CHECK_LIST_REGEX.test(line) ||\n TABLE_ROW_REG_EXP.test(line) ||\n TABLE_ROW_DIVIDER_REG_EXP.test(line) ||\n !shouldMergeAdjacentLines ||\n TAG_START_REGEX.test(line) ||\n TAG_END_REGEX.test(line) ||\n TAG_START_REGEX.test(lastLine) ||\n TAG_END_REGEX.test(lastLine) ||\n CODE_END_REGEX.test(lastLine)\n ) {\n sanitizedLines.push(line)\n } else {\n sanitizedLines[sanitizedLines.length - 1] = lastLine + ' ' + line.trim()\n }\n }\n\n return sanitizedLines.join('\\n')\n}\n"],"mappings":"AAAA,sDACA;;;;;;wDAYA,SACEA,mBAAmB,EACnBC,eAAe,EACfC,eAAe,EACfC,WAAW,EACXC,YAAY,EACZC,QAAQ,QACH;AACP,SACEC,kBAAkB,EAClBC,gBAAgB,EAChBC,cAAc,EACdC,YAAY,EACZC,WAAW,EACXC,SAAS,QACJ;AACP,SAASC,oBAAoB,QAAQ;AA8JrC,MAAMC,wBAAA,GAA2B;AACjC,MAAMC,kBAAA,GAAqB;AAC3B,MAAMC,oBAAA,GAAuB;AAC7B,MAAMC,gBAAA,GAAmB;AACzB,MAAMC,aAAA,GAAgB;AACtB,MAAMC,WAAA,GAAc;AACpB,MAAMC,gBAAA,GAAmB;AACzB,MAAMC,cAAA,GAAiB;AACvB,MAAMC,sBAAA,GAAyB;AAC/B,MAAMC,iBAAA,GAAoB;AAC1B,MAAMC,yBAAA,GAA4B;AAClC,MAAMC,eAAA,GAAkB;AACxB,MAAMC,aAAA,GAAgB;AAEtB,MAAMC,eAAA,GACJC,UAAA;EAEA,OAAO,CAACC,UAAA,EAAYC,QAAA,EAAUC,KAAA;IAC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AACD,QAAA,KAC9B,CAACA,QAAA,IACD/F,aAAA,CAAcgG,IAAI,CAACD,QAAA,KACnB/F,aAAA,CAAcgG,IAAI,CAAC1B,IAAA,KACnBrE,WAAA,CAAY+F,IAAI,CAAC1B,IAAA,KACjBzE,kBAAA,CAAmBmG,IAAI,CAAC1B,IAAA,KACxBxE,oBAAA,CAAqBkG,IAAI,CAAC1B,IAAA,KAC1BvE,gBAAA,CAAiBiG,IAAI,CAAC1B,IAAA,KACtBjE,iBAAA,CAAkB2F,IAAI,CAAC1B,IAAA,KACvBhE,yBAAA,CAA0B0F,IAAI,CAAC1B,IAAA,KAC/B,CAACoB,wBAAA,IACDnF,eAAA,CAAgByF,IAAI,CAAC1B,IAAA,KACrB9D,aAAA,CAAcwF,IAAI,CAAC1B,IAAA,KACnB/D,eAAA,CAAgByF,IAAI,CAACD,QAAA,KACrBvF,aAAA,CAAcwF,IAAI,CAACD,QAAA,KACnB5F,cAAA,CAAe6F,IAAI,CAACD,QAAA,GACpB;MACAH,cAAA,CAAexC,IAAI,CAACkB,IAAA;IACtB,OAAO;MACLsB,cAAc,CAACA,cAAA,CAAepE,MAAM,GAAG,EAAE,GAAGuE,QAAA,GAAW,MAAMzB,IAAA,CAAK2B,IAAI;IACxE;EACF;EAEA,OAAOL,cAAA,CAAenC,IAAI,CAAC;AAC7B","ignoreList":[]}
1
+ {"version":3,"file":"MarkdownTransformers.js","names":["$createListItemNode","$createListNode","$isListItemNode","$isListNode","ListItemNode","ListNode","$createHeadingNode","$createQuoteNode","$isHeadingNode","$isQuoteNode","HeadingNode","QuoteNode","$createLineBreakNode","$isLineBreakNode","$isTextNode","$setState","createState","EMPTY_OR_WHITESPACE_ONLY","ORDERED_LIST_REGEX","UNORDERED_LIST_REGEX","CHECK_LIST_REGEX","HEADING_REGEX","QUOTE_REGEX","CODE_START_REGEX","CODE_END_REGEX","CODE_SINGLE_LINE_REGEX","TABLE_ROW_REG_EXP","TABLE_ROW_DIVIDER_REG_EXP","TAG_START_REGEX","TAG_END_REGEX","hardLineBreakState","parse","val","test","parseMarkdownHardLineBreak","line","endsWith","slice","spaces","match","hasNonWhitespaceContentOnLine","children","endIndex","i","getTextContent","$extractMarkdownHardLineBreakMarker","previousNode","getChildren","lastChildIndex","length","lastChild","lastText","hardLineBreak","text","marker","setTextContent","$createMarkdownLineBreakNode","lineBreakNode","createBlockNode","createNode","parentNode","node","append","replace","select","LIST_INDENT_SIZE","getIndent","whitespaces","tabs","indent","Math","floor","listReplace","listType","getPreviousSibling","nextNode","getNextSibling","listItem","undefined","getListType","firstChild","getFirstChild","insertBefore","remove","list","Number","setIndent","listExport","listNode","exportChildren","depth","output","index","listItemNode","getChildrenSize","push","repeat","prefix","getStart","getChecked","join","HEADING","type","dependencies","export","level","getTag","regExp","tag","QUOTE","lines","split","_match","isImport","splice","UNORDERED_LIST","CHECK_LIST","ORDERED_LIST","INLINE_CODE","format","HIGHLIGHT","BOLD_ITALIC_STAR","BOLD_ITALIC_UNDERSCORE","intraword","BOLD_STAR","BOLD_UNDERSCORE","STRIKETHROUGH","ITALIC_STAR","ITALIC_UNDERSCORE","normalizeMarkdown","input","shouldMergeAdjacentLines","inCodeBlock","sanitizedLines","nestedDeepCodeBlock","lastLine","lastLineHasHardLineBreak","trim","trimStart"],"sources":["../../../../src/packages/@lexical/markdown/MarkdownTransformers.ts"],"sourcesContent":["/* eslint-disable regexp/no-unused-capturing-group */\n/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n\nimport type { ListType } from '@lexical/list'\nimport type { HeadingTagType } from '@lexical/rich-text'\nimport type {\n ElementNode,\n Klass,\n LexicalNode,\n LineBreakNode,\n TextFormatType,\n TextNode,\n} from 'lexical'\n\nimport {\n $createListItemNode,\n $createListNode,\n $isListItemNode,\n $isListNode,\n ListItemNode,\n ListNode,\n} from '@lexical/list'\nimport {\n $createHeadingNode,\n $createQuoteNode,\n $isHeadingNode,\n $isQuoteNode,\n HeadingNode,\n QuoteNode,\n} from '@lexical/rich-text'\nimport {\n $createLineBreakNode,\n $isLineBreakNode,\n $isTextNode,\n $setState,\n createState,\n} from 'lexical'\n\nexport type Transformer =\n | ElementTransformer\n | MultilineElementTransformer\n | TextFormatTransformer\n | TextMatchTransformer\n\nexport type ElementTransformer = {\n dependencies: Array<Klass<LexicalNode>>\n /**\n * `export` is called when the `$convertToMarkdownString` is called to convert the editor state into markdown.\n *\n * @return return null to cancel the export, even though the regex matched. Lexical will then search for the next transformer.\n */\n export: (\n node: LexicalNode,\n\n traverseChildren: (node: ElementNode) => string,\n ) => null | string\n regExp: RegExp\n /**\n * `replace` is called when markdown is imported or typed in the editor\n *\n * @return return false to cancel the transform, even though the regex matched. Lexical will then search for the next transformer.\n */\n replace: (\n parentNode: ElementNode,\n children: Array<LexicalNode>,\n match: Array<string>,\n /**\n * Whether the match is from an import operation (e.g. through `$convertFromMarkdownString`) or not (e.g. through typing in the editor).\n */\n isImport: boolean,\n ) => boolean | void\n type: 'element'\n}\n\nexport type MultilineElementTransformer = {\n dependencies: Array<Klass<LexicalNode>>\n /**\n * `export` is called when the `$convertToMarkdownString` is called to convert the editor state into markdown.\n *\n * @return return null to cancel the export, even though the regex matched. Lexical will then search for the next transformer.\n */\n export?: (\n node: LexicalNode,\n\n traverseChildren: (node: ElementNode) => string,\n ) => null | string\n /**\n * Use this function to manually handle the import process, once the `regExpStart` has matched successfully.\n * Without providing this function, the default behavior is to match until `regExpEnd` is found, or until the end of the document if `regExpEnd.optional` is true.\n *\n * @returns a tuple or null. The first element of the returned tuple is a boolean indicating if a multiline element was imported. The second element is the index of the last line that was processed. If null is returned, the next multilineElementTransformer will be tried. If undefined is returned, the default behavior will be used.\n */\n handleImportAfterStartMatch?: (args: {\n lines: Array<string>\n rootNode: ElementNode\n startLineIndex: number\n startMatch: RegExpMatchArray\n transformer: MultilineElementTransformer\n }) => [boolean, number] | null | undefined\n /**\n * This regex determines when to stop matching. Anything in between regExpStart and regExpEnd will be matched\n */\n regExpEnd?:\n | {\n /**\n * Whether the end match is optional. If true, the end match is not required to match for the transformer to be triggered.\n * The entire text from regexpStart to the end of the document will then be matched.\n */\n optional?: true\n regExp: RegExp\n }\n | RegExp\n /**\n * This regex determines when to start matching\n */\n regExpStart: RegExp\n /**\n * `replace` is called only when markdown is imported in the editor, not when it's typed\n *\n * @return return false to cancel the transform, even though the regex matched. Lexical will then search for the next transformer.\n */\n replace: (\n rootNode: ElementNode,\n /**\n * During markdown shortcut transforms, children nodes may be provided to the transformer. If this is the case, no `linesInBetween` will be provided and\n * the children nodes should be used instead of the `linesInBetween` to create the new node.\n */\n children: Array<LexicalNode> | null,\n startMatch: Array<string>,\n endMatch: Array<string> | null,\n /**\n * linesInBetween includes the text between the start & end matches, split up by lines, not including the matches themselves.\n * This is null when the transformer is triggered through markdown shortcuts (by typing in the editor)\n */\n linesInBetween: Array<string> | null,\n /**\n * Whether the match is from an import operation (e.g. through `$convertFromMarkdownString`) or not (e.g. through typing in the editor).\n */\n isImport: boolean,\n ) => boolean | void\n type: 'multiline-element'\n}\n\nexport type TextFormatTransformer = Readonly<{\n format: ReadonlyArray<TextFormatType>\n intraword?: boolean\n tag: string\n type: 'text-format'\n}>\n\nexport type TextMatchTransformer = Readonly<{\n dependencies: Array<Klass<LexicalNode>>\n /**\n * Determines how a node should be exported to markdown\n */\n export?: (\n node: LexicalNode,\n\n exportChildren: (node: ElementNode) => string,\n\n exportFormat: (node: TextNode, textContent: string) => string,\n ) => null | string\n /**\n * For import operations, this function can be used to determine the end index of the match, after `importRegExp` has matched.\n * Without this function, the end index will be determined by the length of the match from `importRegExp`. Manually determining the end index can be useful if\n * the match from `importRegExp` is not the entire text content of the node. That way, `importRegExp` can be used to match only the start of the node, and `getEndIndex`\n * can be used to match the end of the node.\n *\n * @returns The end index of the match, or false if the match was unsuccessful and a different transformer should be tried.\n */\n getEndIndex?: (node: TextNode, match: RegExpMatchArray) => false | number\n /**\n * This regex determines what text is matched during markdown imports\n */\n importRegExp?: RegExp\n /**\n * This regex determines what text is matched for markdown shortcuts while typing in the editor\n */\n regExp: RegExp\n /**\n * Determines how the matched markdown text should be transformed into a node during the markdown import process\n *\n * @returns nothing, or a TextNode that may be a child of the new node that is created.\n * If a TextNode is returned, text format matching will be applied to it (e.g. bold, italic, etc.)\n */\n replace?: (node: TextNode, match: RegExpMatchArray) => TextNode | void\n /**\n * Single character that allows the transformer to trigger when typed in the editor. This does not affect markdown imports outside of the markdown shortcut plugin.\n * If the trigger is matched, the `regExp` will be used to match the text in the second step.\n */\n trigger?: string\n type: 'text-match'\n}>\n\nconst EMPTY_OR_WHITESPACE_ONLY = /^[\\t ]*$/\nconst ORDERED_LIST_REGEX = /^(\\s*)(\\d+)\\.\\s/\nconst UNORDERED_LIST_REGEX = /^(\\s*)[-*+]\\s/\nconst CHECK_LIST_REGEX = /^(\\s*)(?:-\\s)?\\s?(\\[(\\s|x)?\\])\\s/i\nconst HEADING_REGEX = /^(#{1,6})\\s/\nconst QUOTE_REGEX = /^>\\s/\nconst CODE_START_REGEX = /^[ \\t]*(\\\\`\\\\`\\\\`|```)(\\w+)?/\nconst CODE_END_REGEX = /[ \\t]*(\\\\`\\\\`\\\\`|```)$/\nconst CODE_SINGLE_LINE_REGEX = /^[ \\t]*```[^`]+(?:(?:`{1,2}|`{4,})[^`]+)*```(?:[^`]|$)/\nconst TABLE_ROW_REG_EXP = /^\\|(.+)\\|\\s?$/\nconst TABLE_ROW_DIVIDER_REG_EXP = /^(\\| ?:?-*:? ?)+\\|\\s?$/\nconst TAG_START_REGEX = /^[ \\t]*<[a-z_][\\w-]*(?:\\s[^<>]*)?\\/?>/i\nconst TAG_END_REGEX = /^[ \\t]*<\\/[a-z_][\\w-]*\\s*>/i\n\n/**\n * A CommonMark hard line break marker: either a single backslash (`\\`) or two or\n * more trailing spaces, both placed at the end of a line before the newline.\n * See https://spec.commonmark.org/0.31.2/#hard-line-breaks\n */\nexport type MarkdownHardLineBreak = string\n\n/**\n * Stores the original hard line break marker on a `LineBreakNode` so it can be\n * preserved across a markdown import/export round trip instead of being\n * collapsed into a soft line break.\n *\n * Note: unlike upstream Lexical (which sets `resetOnCopyNode: true`), that option\n * does not exist in the `lexical` version pinned here (0.41.0), so it is omitted.\n */\nexport const hardLineBreakState = createState('mdHardLineBreak', {\n parse: (val): MarkdownHardLineBreak => {\n if (typeof val === 'string' && /^(\\\\| {2,})$/.test(val)) {\n return val\n }\n return ''\n },\n})\n\n/**\n * Detects a CommonMark hard line break marker at the end of a raw line.\n *\n * @returns a tuple of `[textWithoutMarker, marker]` when a marker is found, otherwise null.\n */\nexport function parseMarkdownHardLineBreak(line: string): [string, MarkdownHardLineBreak] | null {\n if (line.endsWith('\\\\')) {\n return [line.slice(0, -1), '\\\\']\n }\n\n const spaces = line.match(/^(.*?\\S)( {2,})$/)\n return spaces ? [spaces[1]!, spaces[2]!] : null\n}\n\nfunction hasNonWhitespaceContentOnLine(children: Array<LexicalNode>, endIndex: number): boolean {\n for (let i = endIndex - 1; i >= 0; i--) {\n if ($isLineBreakNode(children[i])) {\n return false\n }\n if (/\\S/.test(children[i]!.getTextContent())) {\n return true\n }\n }\n return false\n}\n\n/**\n * Removes a trailing hard line break marker from the last text node of `previousNode`\n * (if present) and returns the marker, so it can be carried onto a `LineBreakNode`.\n */\nfunction $extractMarkdownHardLineBreakMarker(\n previousNode: ElementNode,\n): MarkdownHardLineBreak | null {\n const children = previousNode.getChildren()\n const lastChildIndex = children.length - 1\n const lastChild = children[lastChildIndex]\n\n if (!$isTextNode(lastChild)) {\n return null\n }\n\n const lastText = lastChild.getTextContent()\n const hardLineBreak = parseMarkdownHardLineBreak(lastText)\n\n if (hardLineBreak !== null) {\n const [text, marker] = hardLineBreak\n lastChild.setTextContent(text)\n return marker\n }\n\n // Trailing whitespace may have been split into its own text node by inline\n // transformers (e.g. after formatted or linked content). Only treat it as a\n // hard break when there is preceding non-whitespace content on the same line.\n if (/^ {2,}$/.test(lastText) && hasNonWhitespaceContentOnLine(children, lastChildIndex)) {\n lastChild.setTextContent('')\n return lastText\n }\n\n return null\n}\n\n/**\n * Creates a `LineBreakNode` for a markdown line join, preserving any CommonMark\n * hard line break marker found at the end of `previousNode` via node state.\n */\nexport function $createMarkdownLineBreakNode(previousNode: ElementNode): LineBreakNode {\n const lineBreakNode = $createLineBreakNode()\n const hardLineBreak = $extractMarkdownHardLineBreakMarker(previousNode)\n\n if (hardLineBreak !== null) {\n $setState(lineBreakNode, hardLineBreakState, hardLineBreak)\n }\n\n return lineBreakNode\n}\n\nconst createBlockNode = (\n createNode: (match: Array<string>) => ElementNode,\n): ElementTransformer['replace'] => {\n return (parentNode, children, match) => {\n const node = createNode(match)\n node.append(...children)\n parentNode.replace(node)\n node.select(0, 0)\n }\n}\n\n// Amount of spaces that define indentation level\n// TODO: should be an option\nconst LIST_INDENT_SIZE = 4\n\nfunction getIndent(whitespaces: string): number {\n const tabs = whitespaces.match(/\\t/g)\n const spaces = whitespaces.match(/ /g)\n\n let indent = 0\n\n if (tabs) {\n indent += tabs.length\n }\n\n if (spaces) {\n indent += Math.floor(spaces.length / LIST_INDENT_SIZE)\n }\n\n return indent\n}\n\nconst listReplace = (listType: ListType): ElementTransformer['replace'] => {\n return (parentNode, children, match) => {\n const previousNode = parentNode.getPreviousSibling()\n const nextNode = parentNode.getNextSibling()\n const listItem = $createListItemNode(listType === 'check' ? match[3] === 'x' : undefined)\n if ($isListNode(nextNode) && nextNode.getListType() === listType) {\n const firstChild = nextNode.getFirstChild()\n if (firstChild !== null) {\n firstChild.insertBefore(listItem)\n } else {\n // should never happen, but let's handle gracefully, just in case.\n nextNode.append(listItem)\n }\n parentNode.remove()\n } else if ($isListNode(previousNode) && previousNode.getListType() === listType) {\n previousNode.append(listItem)\n parentNode.remove()\n } else {\n const list = $createListNode(listType, listType === 'number' ? Number(match[2]) : undefined)\n list.append(listItem)\n parentNode.replace(list)\n }\n listItem.append(...children)\n listItem.select(0, 0)\n const indent = getIndent(match[1]!)\n if (indent) {\n listItem.setIndent(indent)\n }\n }\n}\n\nconst listExport = (\n listNode: ListNode,\n exportChildren: (node: ElementNode) => string,\n depth: number,\n): string => {\n const output: string[] = []\n const children = listNode.getChildren()\n let index = 0\n for (const listItemNode of children) {\n if ($isListItemNode(listItemNode)) {\n if (listItemNode.getChildrenSize() === 1) {\n const firstChild = listItemNode.getFirstChild()\n if ($isListNode(firstChild)) {\n output.push(listExport(firstChild, exportChildren, depth + 1))\n continue\n }\n }\n const indent = ' '.repeat(depth * LIST_INDENT_SIZE)\n const listType = listNode.getListType()\n const prefix =\n listType === 'number'\n ? `${listNode.getStart() + index}. `\n : listType === 'check'\n ? `- [${listItemNode.getChecked() ? 'x' : ' '}] `\n : '- '\n output.push(indent + prefix + exportChildren(listItemNode))\n index++\n }\n }\n\n return output.join('\\n')\n}\n\nexport const HEADING: ElementTransformer = {\n type: 'element',\n dependencies: [HeadingNode],\n export: (node, exportChildren) => {\n if (!$isHeadingNode(node)) {\n return null\n }\n const level = Number(node.getTag().slice(1))\n return '#'.repeat(level) + ' ' + exportChildren(node)\n },\n regExp: HEADING_REGEX,\n replace: createBlockNode((match) => {\n const tag = ('h' + match[1]!.length) as HeadingTagType\n return $createHeadingNode(tag)\n }),\n}\n\nexport const QUOTE: ElementTransformer = {\n type: 'element',\n dependencies: [QuoteNode],\n export: (node, exportChildren) => {\n if (!$isQuoteNode(node)) {\n return null\n }\n\n const lines = exportChildren(node).split('\\n')\n const output: string[] = []\n for (const line of lines) {\n output.push('> ' + line)\n }\n return output.join('\\n')\n },\n regExp: QUOTE_REGEX,\n replace: (parentNode, children, _match, isImport) => {\n if (isImport) {\n const previousNode = parentNode.getPreviousSibling()\n if ($isQuoteNode(previousNode)) {\n previousNode.splice(previousNode.getChildrenSize(), 0, [\n $createMarkdownLineBreakNode(previousNode),\n ...children,\n ])\n previousNode.select(0, 0)\n parentNode.remove()\n return\n }\n }\n\n const node = $createQuoteNode()\n node.append(...children)\n parentNode.replace(node)\n node.select(0, 0)\n },\n}\n\nexport const UNORDERED_LIST: ElementTransformer = {\n type: 'element',\n dependencies: [ListNode, ListItemNode],\n export: (node, exportChildren) => {\n return $isListNode(node) ? listExport(node, exportChildren, 0) : null\n },\n regExp: UNORDERED_LIST_REGEX,\n replace: listReplace('bullet'),\n}\n\nexport const CHECK_LIST: ElementTransformer = {\n type: 'element',\n dependencies: [ListNode, ListItemNode],\n export: (node, exportChildren) => {\n return $isListNode(node) ? listExport(node, exportChildren, 0) : null\n },\n regExp: CHECK_LIST_REGEX,\n replace: listReplace('check'),\n}\n\nexport const ORDERED_LIST: ElementTransformer = {\n type: 'element',\n dependencies: [ListNode, ListItemNode],\n export: (node, exportChildren) => {\n return $isListNode(node) ? listExport(node, exportChildren, 0) : null\n },\n regExp: ORDERED_LIST_REGEX,\n replace: listReplace('number'),\n}\n\nexport const INLINE_CODE: TextFormatTransformer = {\n type: 'text-format',\n format: ['code'],\n tag: '`',\n}\n\nexport const HIGHLIGHT: TextFormatTransformer = {\n type: 'text-format',\n format: ['highlight'],\n tag: '==',\n}\n\nexport const BOLD_ITALIC_STAR: TextFormatTransformer = {\n type: 'text-format',\n format: ['bold', 'italic'],\n tag: '***',\n}\n\nexport const BOLD_ITALIC_UNDERSCORE: TextFormatTransformer = {\n type: 'text-format',\n format: ['bold', 'italic'],\n intraword: false,\n tag: '___',\n}\n\nexport const BOLD_STAR: TextFormatTransformer = {\n type: 'text-format',\n format: ['bold'],\n tag: '**',\n}\n\nexport const BOLD_UNDERSCORE: TextFormatTransformer = {\n type: 'text-format',\n format: ['bold'],\n intraword: false,\n tag: '__',\n}\n\nexport const STRIKETHROUGH: TextFormatTransformer = {\n type: 'text-format',\n format: ['strikethrough'],\n tag: '~~',\n}\n\nexport const ITALIC_STAR: TextFormatTransformer = {\n type: 'text-format',\n format: ['italic'],\n tag: '*',\n}\n\nexport const ITALIC_UNDERSCORE: TextFormatTransformer = {\n type: 'text-format',\n format: ['italic'],\n intraword: false,\n tag: '_',\n}\n\nexport function normalizeMarkdown(input: string, shouldMergeAdjacentLines: boolean): string {\n const lines = input.split('\\n')\n let inCodeBlock = false\n const sanitizedLines: string[] = []\n let nestedDeepCodeBlock = 0\n\n for (let i = 0; i < lines.length; i++) {\n const line = lines[i]!\n const lastLine = sanitizedLines[sanitizedLines.length - 1]\n // A hard line break marker on the current line only matters if another line follows it.\n const hardLineBreak = i < lines.length - 1 ? parseMarkdownHardLineBreak(line) : null\n const lastLineHasHardLineBreak =\n lastLine !== undefined && parseMarkdownHardLineBreak(lastLine) !== null\n\n // Code blocks of ```single line``` don't toggle the inCodeBlock flag\n if (CODE_SINGLE_LINE_REGEX.test(line)) {\n sanitizedLines.push(line)\n continue\n }\n\n if (CODE_END_REGEX.test(line)) {\n if (nestedDeepCodeBlock === 0) {\n inCodeBlock = true\n }\n if (nestedDeepCodeBlock === 1) {\n inCodeBlock = false\n }\n if (nestedDeepCodeBlock > 0) {\n nestedDeepCodeBlock--\n }\n sanitizedLines.push(line)\n continue\n }\n\n // Toggle inCodeBlock state when encountering start or end of a code block\n if (CODE_START_REGEX.test(line)) {\n inCodeBlock = true\n nestedDeepCodeBlock++\n sanitizedLines.push(line)\n continue\n }\n\n // If we are inside a code block, keep the line unchanged\n if (inCodeBlock) {\n sanitizedLines.push(line)\n continue\n }\n\n // In markdown the concept of \"empty paragraphs\" does not exist.\n // Blocks must be separated by an empty line. Non-empty adjacent lines must be merged.\n if (\n EMPTY_OR_WHITESPACE_ONLY.test(line) ||\n EMPTY_OR_WHITESPACE_ONLY.test(lastLine!) ||\n !lastLine ||\n HEADING_REGEX.test(lastLine) ||\n HEADING_REGEX.test(line) ||\n QUOTE_REGEX.test(line) ||\n ORDERED_LIST_REGEX.test(line) ||\n UNORDERED_LIST_REGEX.test(line) ||\n CHECK_LIST_REGEX.test(line) ||\n TABLE_ROW_REG_EXP.test(line) ||\n TABLE_ROW_DIVIDER_REG_EXP.test(line) ||\n // Don't merge the next line into a line that ends with a hard line break marker.\n lastLineHasHardLineBreak ||\n !shouldMergeAdjacentLines ||\n TAG_START_REGEX.test(line) ||\n TAG_END_REGEX.test(line) ||\n TAG_START_REGEX.test(lastLine) ||\n TAG_END_REGEX.test(lastLine) ||\n CODE_END_REGEX.test(lastLine)\n ) {\n sanitizedLines.push(line)\n } else {\n // Preserve a trailing hard line break marker on the merged line so it survives import.\n sanitizedLines[sanitizedLines.length - 1] =\n lastLine + ' ' + (hardLineBreak === null ? line.trim() : line.trimStart())\n }\n }\n\n return sanitizedLines.join('\\n')\n}\n"],"mappings":"AAAA,sDACA;;;;;;wDAmBA,SACEA,mBAAmB,EACnBC,eAAe,EACfC,eAAe,EACfC,WAAW,EACXC,YAAY,EACZC,QAAQ,QACH;AACP,SACEC,kBAAkB,EAClBC,gBAAgB,EAChBC,cAAc,EACdC,YAAY,EACZC,WAAW,EACXC,SAAS,QACJ;AACP,SACEC,oBAAoB,EACpBC,gBAAgB,EAChBC,WAAW,EACXC,SAAS,EACTC,WAAW,QACN;AA8JP,MAAMC,wBAAA,GAA2B;AACjC,MAAMC,kBAAA,GAAqB;AAC3B,MAAMC,oBAAA,GAAuB;AAC7B,MAAMC,gBAAA,GAAmB;AACzB,MAAMC,aAAA,GAAgB;AACtB,MAAMC,WAAA,GAAc;AACpB,MAAMC,gBAAA,GAAmB;AACzB,MAAMC,cAAA,GAAiB;AACvB,MAAMC,sBAAA,GAAyB;AAC/B,MAAMC,iBAAA,GAAoB;AAC1B,MAAMC,yBAAA,GAA4B;AAClC,MAAMC,eAAA,GAAkB;AACxB,MAAMC,aAAA,GAAgB;AAStB;;;;;;;;AAQA,OAAO,MAAMC,kBAAA,GAAqBd,WAAA,CAAY,mBAAmB;EAC/De,KAAA,EAAQC,GAAA;IACN,IAAI,OAAOA,GAAA,KAAQ,YAAY,eAAeC,IAAI,CAACD,GAAA,GAAM;MACvD,OAAOA,GAAA;IACT;IACA,OAAO;EACT;AACF;AAEA;;;;;AAKA,OAAO,SAASE,2BAA2BC,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;IACtB,OAAO;MACL;MACAkG,cAAc,CAACA,cAAA,CAAepF,MAAM,GAAG,EAAE,GACvCsF,QAAA,GAAW,OAAOnF,aAAA,KAAkB,OAAOjB,IAAA,CAAKsG,IAAI,KAAKtG,IAAA,CAAKuG,SAAS,EAAC;IAC5E;EACF;EAEA,OAAOL,cAAA,CAAejC,IAAI,CAAC;AAC7B","ignoreList":[]}
@@ -1,7 +1,7 @@
1
1
  import type { SerializedEditorState } from 'lexical';
2
2
  import type { RichTextAdapter } from 'payload';
3
3
  import type { PopulationPromise } from '../features/typesServer.js';
4
- import type { AdapterProps } from '../types.js';
4
+ import type { AdapterProps } from '../types/index.js';
5
5
  export type Args = {
6
6
  editorPopulationPromises: Map<string, Array<PopulationPromise>>;
7
7
  parentIsLocalized: boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"populateLexicalPopulationPromises.d.ts","sourceRoot":"","sources":["../../src/populateGraphQL/populateLexicalPopulationPromises.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAA;AACpD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAA;AAE9C,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAA;AACnE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAI/C,MAAM,MAAM,IAAI,GAAG;IACjB,wBAAwB,EAAE,GAAG,CAAC,MAAM,EAAE,KAAK,CAAC,iBAAiB,CAAC,CAAC,CAAA;IAC/D,iBAAiB,EAAE,OAAO,CAAA;CAC3B,GAAG,UAAU,CACZ,WAAW,CAAC,eAAe,CAAC,qBAAqB,EAAE,YAAY,CAAC,CAAC,2BAA2B,CAAC,CAAC,CAC/F,CAAC,CAAC,CAAC,CAAA;AAEJ;;GAEG;AACH,eAAO,MAAM,iCAAiC,iNAgB3C,IAAI,SAoCN,CAAA"}
1
+ {"version":3,"file":"populateLexicalPopulationPromises.d.ts","sourceRoot":"","sources":["../../src/populateGraphQL/populateLexicalPopulationPromises.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAA;AACpD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAA;AAE9C,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAA;AACnE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAIrD,MAAM,MAAM,IAAI,GAAG;IACjB,wBAAwB,EAAE,GAAG,CAAC,MAAM,EAAE,KAAK,CAAC,iBAAiB,CAAC,CAAC,CAAA;IAC/D,iBAAiB,EAAE,OAAO,CAAA;CAC3B,GAAG,UAAU,CACZ,WAAW,CAAC,eAAe,CAAC,qBAAqB,EAAE,YAAY,CAAC,CAAC,2BAA2B,CAAC,CAAC,CAC/F,CAAC,CAAC,CAAC,CAAA;AAEJ;;GAEG;AACH,eAAO,MAAM,iCAAiC,GAAI,8MAgB/C,IAAI,SAoCN,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"populateLexicalPopulationPromises.js","names":["recurseNodes","populateLexicalPopulationPromises","context","currentDepth","depth","draft","editorPopulationPromises","field","fieldPromises","findMany","flattenLocales","overrideAccess","parentIsLocalized","populationPromises","req","showHiddenFields","siblingDoc","shouldPopulate","callback","node","editorPopulationPromisesOfNodeType","get","type","promise","nodes","name","root","children"],"sources":["../../src/populateGraphQL/populateLexicalPopulationPromises.ts"],"sourcesContent":["import type { SerializedEditorState } from 'lexical'\nimport type { RichTextAdapter } from 'payload'\n\nimport type { PopulationPromise } from '../features/typesServer.js'\nimport type { AdapterProps } from '../types.js'\n\nimport { recurseNodes } from '../utilities/forEachNodeRecursively.js'\n\nexport type Args = {\n editorPopulationPromises: Map<string, Array<PopulationPromise>>\n parentIsLocalized: boolean\n} & Parameters<\n NonNullable<RichTextAdapter<SerializedEditorState, AdapterProps>['graphQLPopulationPromises']>\n>[0]\n\n/**\n * Appends all new populationPromises to the populationPromises prop\n */\nexport const populateLexicalPopulationPromises = ({\n context,\n currentDepth,\n depth,\n draft,\n editorPopulationPromises,\n field,\n fieldPromises,\n findMany,\n flattenLocales,\n overrideAccess,\n parentIsLocalized,\n populationPromises,\n req,\n showHiddenFields,\n siblingDoc,\n}: Args) => {\n const shouldPopulate = depth && currentDepth! <= depth\n\n if (!shouldPopulate) {\n return\n }\n\n recurseNodes({\n callback: (node) => {\n const editorPopulationPromisesOfNodeType = editorPopulationPromises?.get(node.type)\n if (editorPopulationPromisesOfNodeType) {\n for (const promise of editorPopulationPromisesOfNodeType) {\n promise({\n context,\n currentDepth: currentDepth!,\n depth,\n draft,\n editorPopulationPromises,\n field,\n fieldPromises,\n findMany,\n flattenLocales,\n node,\n overrideAccess: overrideAccess!,\n parentIsLocalized,\n populationPromises,\n req,\n showHiddenFields,\n siblingDoc,\n })\n }\n }\n },\n\n nodes: (siblingDoc[field?.name] as SerializedEditorState)?.root?.children ?? [],\n })\n}\n"],"mappings":"AAMA,SAASA,YAAY,QAAQ;AAS7B;;;AAGA,OAAO,MAAMC,iCAAA,GAAoCA,CAAC;EAChDC,OAAO;EACPC,YAAY;EACZC,KAAK;EACLC,KAAK;EACLC,wBAAwB;EACxBC,KAAK;EACLC,aAAa;EACbC,QAAQ;EACRC,cAAc;EACdC,cAAc;EACdC,iBAAiB;EACjBC,kBAAkB;EAClBC,GAAG;EACHC,gBAAgB;EAChBC;AAAU,CACL;EACL,MAAMC,cAAA,GAAiBb,KAAA,IAASD,YAAA,IAAiBC,KAAA;EAEjD,IAAI,CAACa,cAAA,EAAgB;IACnB;EACF;EAEAjB,YAAA,CAAa;IACXkB,QAAA,EAAWC,IAAA;MACT,MAAMC,kCAAA,GAAqCd,wBAAA,EAA0Be,GAAA,CAAIF,IAAA,CAAKG,IAAI;MAClF,IAAIF,kCAAA,EAAoC;QACtC,KAAK,MAAMG,OAAA,IAAWH,kCAAA,EAAoC;UACxDG,OAAA,CAAQ;YACNrB,OAAA;YACAC,YAAA,EAAcA,YAAA;YACdC,KAAA;YACAC,KAAA;YACAC,wBAAA;YACAC,KAAA;YACAC,aAAA;YACAC,QAAA;YACAC,cAAA;YACAS,IAAA;YACAR,cAAA,EAAgBA,cAAA;YAChBC,iBAAA;YACAC,kBAAA;YACAC,GAAA;YACAC,gBAAA;YACAC;UACF;QACF;MACF;IACF;IAEAQ,KAAA,EAAOR,UAAW,CAACT,KAAA,EAAOkB,IAAA,CAAK,EAA4BC,IAAA,EAAMC,QAAA,IAAY;EAC/E;AACF","ignoreList":[]}
1
+ {"version":3,"file":"populateLexicalPopulationPromises.js","names":["recurseNodes","populateLexicalPopulationPromises","context","currentDepth","depth","draft","editorPopulationPromises","field","fieldPromises","findMany","flattenLocales","overrideAccess","parentIsLocalized","populationPromises","req","showHiddenFields","siblingDoc","shouldPopulate","callback","node","editorPopulationPromisesOfNodeType","get","type","promise","nodes","name","root","children"],"sources":["../../src/populateGraphQL/populateLexicalPopulationPromises.ts"],"sourcesContent":["import type { SerializedEditorState } from 'lexical'\nimport type { RichTextAdapter } from 'payload'\n\nimport type { PopulationPromise } from '../features/typesServer.js'\nimport type { AdapterProps } from '../types/index.js'\n\nimport { recurseNodes } from '../utilities/forEachNodeRecursively.js'\n\nexport type Args = {\n editorPopulationPromises: Map<string, Array<PopulationPromise>>\n parentIsLocalized: boolean\n} & Parameters<\n NonNullable<RichTextAdapter<SerializedEditorState, AdapterProps>['graphQLPopulationPromises']>\n>[0]\n\n/**\n * Appends all new populationPromises to the populationPromises prop\n */\nexport const populateLexicalPopulationPromises = ({\n context,\n currentDepth,\n depth,\n draft,\n editorPopulationPromises,\n field,\n fieldPromises,\n findMany,\n flattenLocales,\n overrideAccess,\n parentIsLocalized,\n populationPromises,\n req,\n showHiddenFields,\n siblingDoc,\n}: Args) => {\n const shouldPopulate = depth && currentDepth! <= depth\n\n if (!shouldPopulate) {\n return\n }\n\n recurseNodes({\n callback: (node) => {\n const editorPopulationPromisesOfNodeType = editorPopulationPromises?.get(node.type)\n if (editorPopulationPromisesOfNodeType) {\n for (const promise of editorPopulationPromisesOfNodeType) {\n promise({\n context,\n currentDepth: currentDepth!,\n depth,\n draft,\n editorPopulationPromises,\n field,\n fieldPromises,\n findMany,\n flattenLocales,\n node,\n overrideAccess: overrideAccess!,\n parentIsLocalized,\n populationPromises,\n req,\n showHiddenFields,\n siblingDoc,\n })\n }\n }\n },\n\n nodes: (siblingDoc[field?.name] as SerializedEditorState)?.root?.children ?? [],\n })\n}\n"],"mappings":"AAMA,SAASA,YAAY,QAAQ;AAS7B;;;AAGA,OAAO,MAAMC,iCAAA,GAAoCA,CAAC;EAChDC,OAAO;EACPC,YAAY;EACZC,KAAK;EACLC,KAAK;EACLC,wBAAwB;EACxBC,KAAK;EACLC,aAAa;EACbC,QAAQ;EACRC,cAAc;EACdC,cAAc;EACdC,iBAAiB;EACjBC,kBAAkB;EAClBC,GAAG;EACHC,gBAAgB;EAChBC;AAAU,CACL;EACL,MAAMC,cAAA,GAAiBb,KAAA,IAASD,YAAA,IAAiBC,KAAA;EAEjD,IAAI,CAACa,cAAA,EAAgB;IACnB;EACF;EAEAjB,YAAA,CAAa;IACXkB,QAAA,EAAWC,IAAA;MACT,MAAMC,kCAAA,GAAqCd,wBAAA,EAA0Be,GAAA,CAAIF,IAAA,CAAKG,IAAI;MAClF,IAAIF,kCAAA,EAAoC;QACtC,KAAK,MAAMG,OAAA,IAAWH,kCAAA,EAAoC;UACxDG,OAAA,CAAQ;YACNrB,OAAA;YACAC,YAAA,EAAcA,YAAA;YACdC,KAAA;YACAC,KAAA;YACAC,wBAAA;YACAC,KAAA;YACAC,aAAA;YACAC,QAAA;YACAC,cAAA;YACAS,IAAA;YACAR,cAAA,EAAgBA,cAAA;YAChBC,iBAAA;YACAC,kBAAA;YACAC,GAAA;YACAC,gBAAA;YACAC;UACF;QACF;MACF;IACF;IAEAQ,KAAA,EAAOR,UAAW,CAACT,KAAA,EAAOkB,IAAA,CAAK,EAA4BC,IAAA,EAAMC,QAAA,IAAY;EAC/E;AACF","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"recursivelyPopulateFieldsForGraphQL.d.ts","sourceRoot":"","sources":["../../src/populateGraphQL/recursivelyPopulateFieldsForGraphQL.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,UAAU,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,SAAS,CAAA;AAIhF,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAA;AAEnE,KAAK,wBAAwB,GAAG;IAC9B,OAAO,EAAE,cAAc,CAAA;IACvB,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,IAAI,EAAE,OAAO,CAAA;IACb,KAAK,EAAE,MAAM,CAAA;IACb,KAAK,EAAE,OAAO,CAAA;IACd;;OAEG;IACH,wBAAwB,EAAE,GAAG,CAAC,MAAM,EAAE,KAAK,CAAC,iBAAiB,CAAC,CAAC,CAAA;IAC/D;;OAEG;IACH,aAAa,EAAE,OAAO,CAAC,IAAI,CAAC,EAAE,CAAA;IAC9B,MAAM,EAAE,KAAK,EAAE,CAAA;IACf,QAAQ,EAAE,OAAO,CAAA;IACjB,cAAc,EAAE,OAAO,CAAA;IACvB,cAAc,EAAE,OAAO,CAAA;IACvB,iBAAiB,EAAE,OAAO,CAAA;IAC1B,kBAAkB,EAAE,OAAO,CAAC,IAAI,CAAC,EAAE,CAAA;IACnC,GAAG,EAAE,cAAc,CAAA;IACnB,gBAAgB,EAAE,OAAO,CAAA;IACzB,UAAU,EAAE,UAAU,CAAA;CACvB,CAAA;AAED,eAAO,MAAM,mCAAmC,8LAgB7C,wBAAwB,KAAG,IA0B7B,CAAA"}
1
+ {"version":3,"file":"recursivelyPopulateFieldsForGraphQL.d.ts","sourceRoot":"","sources":["../../src/populateGraphQL/recursivelyPopulateFieldsForGraphQL.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,UAAU,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,SAAS,CAAA;AAIhF,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAA;AAEnE,KAAK,wBAAwB,GAAG;IAC9B,OAAO,EAAE,cAAc,CAAA;IACvB,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,IAAI,EAAE,OAAO,CAAA;IACb,KAAK,EAAE,MAAM,CAAA;IACb,KAAK,EAAE,OAAO,CAAA;IACd;;OAEG;IACH,wBAAwB,EAAE,GAAG,CAAC,MAAM,EAAE,KAAK,CAAC,iBAAiB,CAAC,CAAC,CAAA;IAC/D;;OAEG;IACH,aAAa,EAAE,OAAO,CAAC,IAAI,CAAC,EAAE,CAAA;IAC9B,MAAM,EAAE,KAAK,EAAE,CAAA;IACf,QAAQ,EAAE,OAAO,CAAA;IACjB,cAAc,EAAE,OAAO,CAAA;IACvB,cAAc,EAAE,OAAO,CAAA;IACvB,iBAAiB,EAAE,OAAO,CAAA;IAC1B,kBAAkB,EAAE,OAAO,CAAC,IAAI,CAAC,EAAE,CAAA;IACnC,GAAG,EAAE,cAAc,CAAA;IACnB,gBAAgB,EAAE,OAAO,CAAA;IACzB,UAAU,EAAE,UAAU,CAAA;CACvB,CAAA;AAED,eAAO,MAAM,mCAAmC,GAAI,2LAgBjD,wBAAwB,KAAG,IA0B7B,CAAA"}
@@ -0,0 +1,14 @@
1
+ import type { JSONSchemaFn } from '../features/typesServer.js';
2
+ /**
3
+ * Cross-cutting Lexical types shared by every element node. Inlined into
4
+ * `payload-types.ts`. Must stay byte-for-byte in sync with the runtime twins
5
+ * in `types/nodeTypes.ts` (`LexicalElementFormat`, `LexicalElementDirection`,
6
+ * `SerializedLexicalElementBase`) — cross-module assignability depends on it.
7
+ */
8
+ export declare const CORE_LEXICAL_TYPE_STRING = "/** @internal Core Lexical types \u2014 see @payloadcms/richtext-lexical. */\nexport type LexicalElementFormat = 'left' | 'start' | 'center' | 'right' | 'end' | 'justify' | '';\nexport type LexicalElementDirection = ('ltr' | 'rtl') | null;\n\nexport interface SerializedLexicalElementBase<TChildren> {\n children: TChildren[];\n direction: LexicalElementDirection;\n format: LexicalElementFormat;\n indent: number;\n textFormat?: number;\n textStyle?: string;\n version: number;\n}";
9
+ export declare const textNodeJSONSchema: JSONSchemaFn;
10
+ export declare const tabNodeJSONSchema: JSONSchemaFn;
11
+ export declare const lineBreakNodeJSONSchema: JSONSchemaFn;
12
+ export declare const paragraphNodeJSONSchema: JSONSchemaFn;
13
+ export declare const rootNodeJSONSchema: JSONSchemaFn;
14
+ //# sourceMappingURL=builtInNodes.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"builtInNodes.d.ts","sourceRoot":"","sources":["../../src/types/builtInNodes.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAA;AAI9D;;;;;GAKG;AACH,eAAO,MAAM,wBAAwB,6eAYnC,CAAA;AA4DF,eAAO,MAAM,kBAAkB,EAAE,YAkBhC,CAAA;AAED,eAAO,MAAM,iBAAiB,EAAE,YAoB/B,CAAA;AAED,eAAO,MAAM,uBAAuB,EAAE,YAYrC,CAAA;AAED,eAAO,MAAM,uBAAuB,EAAE,YAerC,CAAA;AAeD,eAAO,MAAM,kBAAkB,EAAE,YAoBhC,CAAA"}
@@ -0,0 +1,203 @@
1
+ import { withNullableJSONSchemaType } from 'payload';
2
+ import { versionSchema } from './jsonSchemaHelpers.js';
3
+ /**
4
+ * Cross-cutting Lexical types shared by every element node. Inlined into
5
+ * `payload-types.ts`. Must stay byte-for-byte in sync with the runtime twins
6
+ * in `types/nodeTypes.ts` (`LexicalElementFormat`, `LexicalElementDirection`,
7
+ * `SerializedLexicalElementBase`) — cross-module assignability depends on it.
8
+ */
9
+ export const CORE_LEXICAL_TYPE_STRING = `/** @internal Core Lexical types — see @payloadcms/richtext-lexical. */
10
+ export type LexicalElementFormat = 'left' | 'start' | 'center' | 'right' | 'end' | 'justify' | '';
11
+ export type LexicalElementDirection = ('ltr' | 'rtl') | null;
12
+
13
+ export interface SerializedLexicalElementBase<TChildren> {
14
+ children: TChildren[];
15
+ direction: LexicalElementDirection;
16
+ format: LexicalElementFormat;
17
+ indent: number;
18
+ textFormat?: number;
19
+ textStyle?: string;
20
+ version: number;
21
+ }`;
22
+ /**
23
+ * Built-in Lexical node schemas (always present regardless of feature config).
24
+ * Co-located with the TS source they reference — each `JSONSchemaFn` adds
25
+ * its helper interface(s) to `typeStringDefinitions` and returns the JSON
26
+ * schema for that node.
27
+ */ /** MUST stay byte-for-byte in sync with `LexicalTextMode` in `types/nodeTypes.ts`. */
28
+ const LEXICAL_TEXT_MODE_TS = `export type LexicalTextMode = 'normal' | 'token' | 'segmented';`;
29
+ /** MUST stay byte-for-byte in sync with `SerializedTextNode` in `types/nodeTypes.ts`. */
30
+ const SERIALIZED_TEXT_NODE_TS = `export interface SerializedTextNode {
31
+ type: 'text';
32
+ detail: number;
33
+ format: number;
34
+ mode: LexicalTextMode;
35
+ style: string;
36
+ text: string;
37
+ version: number;
38
+ }`;
39
+ /** MUST stay byte-for-byte in sync with `SerializedTabNode` in `types/nodeTypes.ts`. */
40
+ const SERIALIZED_TAB_NODE_TS = `export interface SerializedTabNode {
41
+ type: 'tab';
42
+ detail: number;
43
+ format: number;
44
+ mode: LexicalTextMode;
45
+ style: string;
46
+ text: string;
47
+ version: number;
48
+ }`;
49
+ /** MUST stay byte-for-byte in sync with `SerializedLineBreakNode` in `types/nodeTypes.ts`. */
50
+ const SERIALIZED_LINE_BREAK_NODE_TS = `export interface SerializedLineBreakNode {
51
+ type: 'linebreak';
52
+ version: number;
53
+ }`;
54
+ /** MUST stay byte-for-byte in sync with `SerializedParagraphNode` in `types/nodeTypes.ts`. */
55
+ const SERIALIZED_PARAGRAPH_NODE_TS = `export interface SerializedParagraphNode<TChildren> extends SerializedLexicalElementBase<TChildren> {
56
+ type: 'paragraph';
57
+ textFormat: number;
58
+ textStyle: string;
59
+ }`;
60
+ const textModeSchema = {
61
+ type: 'string',
62
+ enum: ['normal', 'token', 'segmented'],
63
+ tsType: 'LexicalTextMode'
64
+ };
65
+ /** Text-node `format` bitmask (Lexical text-format flags). */
66
+ const textFormatSchema = {
67
+ type: 'integer',
68
+ description: 'Active text formats as a bitmask, OR-ed together (0 = none): bold=1, italic=2, strikethrough=4, underline=8, code=16, subscript=32, superscript=64, highlight=128, lowercase=256, uppercase=512. e.g. bold + italic = 3.'
69
+ };
70
+ export const textNodeJSONSchema = ({
71
+ typeStringDefinitions
72
+ }) => {
73
+ typeStringDefinitions.add(LEXICAL_TEXT_MODE_TS);
74
+ typeStringDefinitions.add(SERIALIZED_TEXT_NODE_TS);
75
+ return {
76
+ type: 'object',
77
+ additionalProperties: false,
78
+ properties: {
79
+ type: {
80
+ type: 'string',
81
+ const: 'text'
82
+ },
83
+ detail: {
84
+ type: 'integer'
85
+ },
86
+ format: textFormatSchema,
87
+ mode: textModeSchema,
88
+ style: {
89
+ type: 'string'
90
+ },
91
+ text: {
92
+ type: 'string'
93
+ },
94
+ version: versionSchema
95
+ },
96
+ required: ['detail', 'format', 'mode', 'style', 'text', 'type', 'version'],
97
+ tsType: 'SerializedTextNode'
98
+ };
99
+ };
100
+ export const tabNodeJSONSchema = ({
101
+ typeStringDefinitions
102
+ }) => {
103
+ typeStringDefinitions.add(LEXICAL_TEXT_MODE_TS);
104
+ typeStringDefinitions.add(SERIALIZED_TAB_NODE_TS);
105
+ return {
106
+ type: 'object',
107
+ additionalProperties: false,
108
+ properties: {
109
+ type: {
110
+ type: 'string',
111
+ const: 'tab'
112
+ },
113
+ // A tab node is fully fixed: Lexical marks it unmergeable (`detail` = IS_UNMERGEABLE = 2) and
114
+ // its text is a single tab. Any other `detail` makes `TabNode.setDetail` throw on load.
115
+ detail: {
116
+ const: 2,
117
+ description: 'Always 2 (Lexical IS_UNMERGEABLE); other values throw.'
118
+ },
119
+ format: textFormatSchema,
120
+ mode: textModeSchema,
121
+ style: {
122
+ type: 'string'
123
+ },
124
+ text: {
125
+ const: '\t',
126
+ description: 'Always a single tab character.'
127
+ },
128
+ version: versionSchema
129
+ },
130
+ required: ['detail', 'format', 'mode', 'style', 'text', 'type', 'version'],
131
+ tsType: 'SerializedTabNode'
132
+ };
133
+ };
134
+ export const lineBreakNodeJSONSchema = ({
135
+ typeStringDefinitions
136
+ }) => {
137
+ typeStringDefinitions.add(SERIALIZED_LINE_BREAK_NODE_TS);
138
+ return {
139
+ type: 'object',
140
+ additionalProperties: false,
141
+ properties: {
142
+ type: {
143
+ type: 'string',
144
+ const: 'linebreak'
145
+ },
146
+ version: versionSchema
147
+ },
148
+ required: ['type', 'version'],
149
+ tsType: 'SerializedLineBreakNode'
150
+ };
151
+ };
152
+ export const paragraphNodeJSONSchema = ({
153
+ elementNodeSchema,
154
+ nodeUnionName,
155
+ typeStringDefinitions
156
+ }) => {
157
+ typeStringDefinitions.add(SERIALIZED_PARAGRAPH_NODE_TS);
158
+ return elementNodeSchema({
159
+ nodeType: 'paragraph',
160
+ properties: {
161
+ textFormat: {
162
+ type: 'integer'
163
+ },
164
+ textStyle: {
165
+ type: 'string'
166
+ }
167
+ },
168
+ required: ['textFormat', 'textStyle'],
169
+ tsType: `SerializedParagraphNode<${nodeUnionName}>`
170
+ });
171
+ };
172
+ /** MUST stay byte-for-byte in sync with `LexicalRichText` in `types/nodeTypes.ts`. */
173
+ const ROOT_NODE_TS = `/** Shape of a Lexical \`richText\` field. */
174
+ export interface LexicalRichText<TNode> {
175
+ root: {
176
+ children: TNode[];
177
+ direction: LexicalElementDirection;
178
+ format: LexicalElementFormat;
179
+ indent: number;
180
+ type: 'root';
181
+ version: number;
182
+ };
183
+ }`;
184
+ export const rootNodeJSONSchema = ({
185
+ elementNodeSchema,
186
+ field,
187
+ nodeUnionName,
188
+ typeStringDefinitions
189
+ }) => {
190
+ typeStringDefinitions.add(ROOT_NODE_TS);
191
+ return {
192
+ type: withNullableJSONSchemaType('object', !!field.required),
193
+ additionalProperties: false,
194
+ properties: {
195
+ root: elementNodeSchema({
196
+ nodeType: 'root'
197
+ })
198
+ },
199
+ required: ['root'],
200
+ tsType: field.required ? `LexicalRichText<${nodeUnionName}>` : `LexicalRichText<${nodeUnionName}> | null`
201
+ };
202
+ };
203
+ //# sourceMappingURL=builtInNodes.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"builtInNodes.js","names":["withNullableJSONSchemaType","versionSchema","CORE_LEXICAL_TYPE_STRING","LEXICAL_TEXT_MODE_TS","SERIALIZED_TEXT_NODE_TS","SERIALIZED_TAB_NODE_TS","SERIALIZED_LINE_BREAK_NODE_TS","SERIALIZED_PARAGRAPH_NODE_TS","textModeSchema","type","enum","tsType","textFormatSchema","description","textNodeJSONSchema","typeStringDefinitions","add","additionalProperties","properties","const","detail","format","mode","style","text","version","required","tabNodeJSONSchema","lineBreakNodeJSONSchema","paragraphNodeJSONSchema","elementNodeSchema","nodeUnionName","nodeType","textFormat","textStyle","ROOT_NODE_TS","rootNodeJSONSchema","field","root"],"sources":["../../src/types/builtInNodes.ts"],"sourcesContent":["import type { JSONSchema4 } from 'json-schema'\n\nimport { withNullableJSONSchemaType } from 'payload'\n\nimport type { JSONSchemaFn } from '../features/typesServer.js'\n\nimport { versionSchema } from './jsonSchemaHelpers.js'\n\n/**\n * Cross-cutting Lexical types shared by every element node. Inlined into\n * `payload-types.ts`. Must stay byte-for-byte in sync with the runtime twins\n * in `types/nodeTypes.ts` (`LexicalElementFormat`, `LexicalElementDirection`,\n * `SerializedLexicalElementBase`) — cross-module assignability depends on it.\n */\nexport const CORE_LEXICAL_TYPE_STRING = `/** @internal Core Lexical types — see @payloadcms/richtext-lexical. */\nexport type LexicalElementFormat = 'left' | 'start' | 'center' | 'right' | 'end' | 'justify' | '';\nexport type LexicalElementDirection = ('ltr' | 'rtl') | null;\n\nexport interface SerializedLexicalElementBase<TChildren> {\n children: TChildren[];\n direction: LexicalElementDirection;\n format: LexicalElementFormat;\n indent: number;\n textFormat?: number;\n textStyle?: string;\n version: number;\n}`\n\n/**\n * Built-in Lexical node schemas (always present regardless of feature config).\n * Co-located with the TS source they reference — each `JSONSchemaFn` adds\n * its helper interface(s) to `typeStringDefinitions` and returns the JSON\n * schema for that node.\n */\n\n/** MUST stay byte-for-byte in sync with `LexicalTextMode` in `types/nodeTypes.ts`. */\nconst LEXICAL_TEXT_MODE_TS = `export type LexicalTextMode = 'normal' | 'token' | 'segmented';`\n\n/** MUST stay byte-for-byte in sync with `SerializedTextNode` in `types/nodeTypes.ts`. */\nconst SERIALIZED_TEXT_NODE_TS = `export interface SerializedTextNode {\n type: 'text';\n detail: number;\n format: number;\n mode: LexicalTextMode;\n style: string;\n text: string;\n version: number;\n}`\n\n/** MUST stay byte-for-byte in sync with `SerializedTabNode` in `types/nodeTypes.ts`. */\nconst SERIALIZED_TAB_NODE_TS = `export interface SerializedTabNode {\n type: 'tab';\n detail: number;\n format: number;\n mode: LexicalTextMode;\n style: string;\n text: string;\n version: number;\n}`\n\n/** MUST stay byte-for-byte in sync with `SerializedLineBreakNode` in `types/nodeTypes.ts`. */\nconst SERIALIZED_LINE_BREAK_NODE_TS = `export interface SerializedLineBreakNode {\n type: 'linebreak';\n version: number;\n}`\n\n/** MUST stay byte-for-byte in sync with `SerializedParagraphNode` in `types/nodeTypes.ts`. */\nconst SERIALIZED_PARAGRAPH_NODE_TS = `export interface SerializedParagraphNode<TChildren> extends SerializedLexicalElementBase<TChildren> {\n type: 'paragraph';\n textFormat: number;\n textStyle: string;\n}`\n\nconst textModeSchema: JSONSchema4 = {\n type: 'string',\n enum: ['normal', 'token', 'segmented'],\n tsType: 'LexicalTextMode',\n}\n\n/** Text-node `format` bitmask (Lexical text-format flags). */\nconst textFormatSchema: JSONSchema4 = {\n type: 'integer',\n description:\n 'Active text formats as a bitmask, OR-ed together (0 = none): bold=1, italic=2, strikethrough=4, underline=8, code=16, subscript=32, superscript=64, highlight=128, lowercase=256, uppercase=512. e.g. bold + italic = 3.',\n}\n\nexport const textNodeJSONSchema: JSONSchemaFn = ({ typeStringDefinitions }) => {\n typeStringDefinitions.add(LEXICAL_TEXT_MODE_TS)\n typeStringDefinitions.add(SERIALIZED_TEXT_NODE_TS)\n return {\n type: 'object',\n additionalProperties: false,\n properties: {\n type: { type: 'string', const: 'text' },\n detail: { type: 'integer' },\n format: textFormatSchema,\n mode: textModeSchema,\n style: { type: 'string' },\n text: { type: 'string' },\n version: versionSchema,\n },\n required: ['detail', 'format', 'mode', 'style', 'text', 'type', 'version'],\n tsType: 'SerializedTextNode',\n }\n}\n\nexport const tabNodeJSONSchema: JSONSchemaFn = ({ typeStringDefinitions }) => {\n typeStringDefinitions.add(LEXICAL_TEXT_MODE_TS)\n typeStringDefinitions.add(SERIALIZED_TAB_NODE_TS)\n return {\n type: 'object',\n additionalProperties: false,\n properties: {\n type: { type: 'string', const: 'tab' },\n // A tab node is fully fixed: Lexical marks it unmergeable (`detail` = IS_UNMERGEABLE = 2) and\n // its text is a single tab. Any other `detail` makes `TabNode.setDetail` throw on load.\n detail: { const: 2, description: 'Always 2 (Lexical IS_UNMERGEABLE); other values throw.' },\n format: textFormatSchema,\n mode: textModeSchema,\n style: { type: 'string' },\n text: { const: '\\t', description: 'Always a single tab character.' },\n version: versionSchema,\n },\n required: ['detail', 'format', 'mode', 'style', 'text', 'type', 'version'],\n tsType: 'SerializedTabNode',\n }\n}\n\nexport const lineBreakNodeJSONSchema: JSONSchemaFn = ({ typeStringDefinitions }) => {\n typeStringDefinitions.add(SERIALIZED_LINE_BREAK_NODE_TS)\n return {\n type: 'object',\n additionalProperties: false,\n properties: {\n type: { type: 'string', const: 'linebreak' },\n version: versionSchema,\n },\n required: ['type', 'version'],\n tsType: 'SerializedLineBreakNode',\n }\n}\n\nexport const paragraphNodeJSONSchema: JSONSchemaFn = ({\n elementNodeSchema,\n nodeUnionName,\n typeStringDefinitions,\n}) => {\n typeStringDefinitions.add(SERIALIZED_PARAGRAPH_NODE_TS)\n return elementNodeSchema({\n nodeType: 'paragraph',\n properties: {\n textFormat: { type: 'integer' },\n textStyle: { type: 'string' },\n },\n required: ['textFormat', 'textStyle'],\n tsType: `SerializedParagraphNode<${nodeUnionName}>`,\n })\n}\n\n/** MUST stay byte-for-byte in sync with `LexicalRichText` in `types/nodeTypes.ts`. */\nconst ROOT_NODE_TS = `/** Shape of a Lexical \\`richText\\` field. */\nexport interface LexicalRichText<TNode> {\n root: {\n children: TNode[];\n direction: LexicalElementDirection;\n format: LexicalElementFormat;\n indent: number;\n type: 'root';\n version: number;\n };\n}`\n\nexport const rootNodeJSONSchema: JSONSchemaFn = ({\n elementNodeSchema,\n field,\n nodeUnionName,\n typeStringDefinitions,\n}) => {\n typeStringDefinitions.add(ROOT_NODE_TS)\n return {\n type: withNullableJSONSchemaType('object', !!field.required),\n additionalProperties: false,\n properties: {\n root: elementNodeSchema({\n nodeType: 'root',\n }),\n },\n required: ['root'],\n tsType: field.required\n ? `LexicalRichText<${nodeUnionName}>`\n : `LexicalRichText<${nodeUnionName}> | null`,\n }\n}\n"],"mappings":"AAEA,SAASA,0BAA0B,QAAQ;AAI3C,SAASC,aAAa,QAAQ;AAE9B;;;;;;AAMA,OAAO,MAAMC,wBAAA,GAA2B;;;;;;;;;;;;EAYtC;AAEF;;;;;GAAA,CAOA;AACA,MAAMC,oBAAA,GAAuB,iEAAiE;AAE9F;AACA,MAAMC,uBAAA,GAA0B;;;;;;;;EAQ9B;AAEF;AACA,MAAMC,sBAAA,GAAyB;;;;;;;;EAQ7B;AAEF;AACA,MAAMC,6BAAA,GAAgC;;;EAGpC;AAEF;AACA,MAAMC,4BAAA,GAA+B;;;;EAInC;AAEF,MAAMC,cAAA,GAA8B;EAClCC,IAAA,EAAM;EACNC,IAAA,EAAM,CAAC,UAAU,SAAS,YAAY;EACtCC,MAAA,EAAQ;AACV;AAEA;AACA,MAAMC,gBAAA,GAAgC;EACpCH,IAAA,EAAM;EACNI,WAAA,EACE;AACJ;AAEA,OAAO,MAAMC,kBAAA,GAAmCA,CAAC;E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