@payloadcms/richtext-lexical 4.0.0-internal.c3ac604 → 4.0.0-internal.cb69780

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 (341) hide show
  1. package/dist/exports/client/Field-TS5CRYHE.js +2 -0
  2. package/dist/exports/client/Field-TS5CRYHE.js.map +7 -0
  3. package/dist/exports/client/bundled.css +1 -1
  4. package/dist/exports/client/chunk-3LRZDIIG.js +2 -0
  5. package/dist/exports/client/{chunk-SSMQFWCQ.js.map → chunk-3LRZDIIG.js.map} +4 -4
  6. package/dist/exports/client/{chunk-ESITTE3C.js → chunk-ZFGDYZDE.js} +2 -2
  7. package/dist/exports/client/{chunk-ESITTE3C.js.map → chunk-ZFGDYZDE.js.map} +2 -2
  8. package/dist/exports/client/componentInline-55HZXGUS.js +2 -0
  9. package/dist/exports/client/index.d.ts +1 -1
  10. package/dist/exports/client/index.d.ts.map +1 -1
  11. package/dist/exports/client/index.js +26 -26
  12. package/dist/exports/client/index.js.map +4 -4
  13. package/dist/features/blocks/client/component/BlockReordering/index.d.ts +11 -0
  14. package/dist/features/blocks/client/component/BlockReordering/index.d.ts.map +1 -0
  15. package/dist/features/blocks/client/component/BlockReordering/index.js +18 -0
  16. package/dist/features/blocks/client/component/BlockReordering/index.js.map +1 -0
  17. package/dist/features/blocks/client/component/index.d.ts +0 -6
  18. package/dist/features/blocks/client/component/index.d.ts.map +1 -1
  19. package/dist/features/blocks/client/component/index.js +133 -76
  20. package/dist/features/blocks/client/component/index.js.map +1 -1
  21. package/dist/features/blocks/client/component/useBlockReordering.d.ts +16 -0
  22. package/dist/features/blocks/client/component/useBlockReordering.d.ts.map +1 -0
  23. package/dist/features/blocks/client/component/useBlockReordering.js +178 -0
  24. package/dist/features/blocks/client/component/useBlockReordering.js.map +1 -0
  25. package/dist/features/blocks/client/componentInline/index.d.ts.map +1 -1
  26. package/dist/features/blocks/client/componentInline/index.js +2 -2
  27. package/dist/features/blocks/client/componentInline/index.js.map +1 -1
  28. package/dist/features/blocks/server/index.js +2 -2
  29. package/dist/features/blocks/server/index.js.map +1 -1
  30. package/dist/features/converters/lexicalToHtml/async/converters/heading.js +1 -1
  31. package/dist/features/converters/lexicalToHtml/async/converters/heading.js.map +1 -1
  32. package/dist/features/converters/lexicalToHtml/async/converters/list.d.ts.map +1 -1
  33. package/dist/features/converters/lexicalToHtml/async/converters/list.js +4 -3
  34. package/dist/features/converters/lexicalToHtml/async/converters/list.js.map +1 -1
  35. package/dist/features/converters/lexicalToHtml/shared/findConverterForNode.d.ts.map +1 -1
  36. package/dist/features/converters/lexicalToHtml/shared/findConverterForNode.js +3 -2
  37. package/dist/features/converters/lexicalToHtml/shared/findConverterForNode.js.map +1 -1
  38. package/dist/features/converters/lexicalToHtml/sync/converters/heading.js +1 -1
  39. package/dist/features/converters/lexicalToHtml/sync/converters/heading.js.map +1 -1
  40. package/dist/features/converters/lexicalToHtml/sync/converters/list.d.ts.map +1 -1
  41. package/dist/features/converters/lexicalToHtml/sync/converters/list.js +4 -3
  42. package/dist/features/converters/lexicalToHtml/sync/converters/list.js.map +1 -1
  43. package/dist/features/converters/lexicalToJSX/converter/converters/heading.d.ts.map +1 -1
  44. package/dist/features/converters/lexicalToJSX/converter/converters/heading.js +2 -1
  45. package/dist/features/converters/lexicalToJSX/converter/converters/heading.js.map +1 -1
  46. package/dist/features/converters/lexicalToJSX/converter/converters/list.d.ts.map +1 -1
  47. package/dist/features/converters/lexicalToJSX/converter/converters/list.js +2 -1
  48. package/dist/features/converters/lexicalToJSX/converter/converters/list.js.map +1 -1
  49. package/dist/features/converters/utilities/payloadPopulateFn.d.ts.map +1 -1
  50. package/dist/features/converters/utilities/payloadPopulateFn.js +4 -2
  51. package/dist/features/converters/utilities/payloadPopulateFn.js.map +1 -1
  52. package/dist/features/heading/constants.d.ts +2 -0
  53. package/dist/features/heading/constants.d.ts.map +1 -0
  54. package/dist/features/heading/constants.js +2 -0
  55. package/dist/features/heading/constants.js.map +1 -0
  56. package/dist/features/heading/server/index.d.ts.map +1 -1
  57. package/dist/features/heading/server/index.js +5 -1
  58. package/dist/features/heading/server/index.js.map +1 -1
  59. package/dist/features/heading/server/validate.d.ts +6 -0
  60. package/dist/features/heading/server/validate.d.ts.map +1 -0
  61. package/dist/features/heading/server/validate.js +15 -0
  62. package/dist/features/heading/server/validate.js.map +1 -0
  63. package/dist/features/indent/client/IndentPlugin.d.ts.map +1 -1
  64. package/dist/features/indent/client/IndentPlugin.js +122 -1
  65. package/dist/features/indent/client/IndentPlugin.js.map +1 -1
  66. package/dist/features/indent/server/i18n.d.ts.map +1 -1
  67. package/dist/features/indent/server/i18n.js +74 -37
  68. package/dist/features/indent/server/i18n.js.map +1 -1
  69. package/dist/features/link/client/plugins/floatingLinkEditor/LinkEditor/index.d.ts.map +1 -1
  70. package/dist/features/link/client/plugins/floatingLinkEditor/LinkEditor/index.js +6 -3
  71. package/dist/features/link/client/plugins/floatingLinkEditor/LinkEditor/index.js.map +1 -1
  72. package/dist/features/link/server/index.js +2 -2
  73. package/dist/features/link/server/index.js.map +1 -1
  74. package/dist/features/lists/checklist/server/index.d.ts.map +1 -1
  75. package/dist/features/lists/checklist/server/index.js +5 -2
  76. package/dist/features/lists/checklist/server/index.js.map +1 -1
  77. package/dist/features/lists/orderedList/server/index.d.ts.map +1 -1
  78. package/dist/features/lists/orderedList/server/index.js +5 -2
  79. package/dist/features/lists/orderedList/server/index.js.map +1 -1
  80. package/dist/features/lists/shared/constants.d.ts +2 -0
  81. package/dist/features/lists/shared/constants.d.ts.map +1 -0
  82. package/dist/features/lists/shared/constants.js +2 -0
  83. package/dist/features/lists/shared/constants.js.map +1 -0
  84. package/dist/features/lists/shared/validate.d.ts +5 -0
  85. package/dist/features/lists/shared/validate.d.ts.map +1 -0
  86. package/dist/features/lists/shared/validate.js +15 -0
  87. package/dist/features/lists/shared/validate.js.map +1 -0
  88. package/dist/features/lists/unorderedList/server/index.d.ts.map +1 -1
  89. package/dist/features/lists/unorderedList/server/index.js +5 -2
  90. package/dist/features/lists/unorderedList/server/index.js.map +1 -1
  91. package/dist/features/relationship/client/index.d.ts +2 -2
  92. package/dist/features/relationship/client/index.d.ts.map +1 -1
  93. package/dist/features/relationship/client/index.js.map +1 -1
  94. package/dist/features/relationship/client/plugins/index.d.ts +2 -2
  95. package/dist/features/relationship/client/plugins/index.d.ts.map +1 -1
  96. package/dist/features/relationship/client/plugins/index.js +27 -31
  97. package/dist/features/relationship/client/plugins/index.js.map +1 -1
  98. package/dist/features/relationship/client/utils/useEnabledRelationships.d.ts +2 -4
  99. package/dist/features/relationship/client/utils/useEnabledRelationships.d.ts.map +1 -1
  100. package/dist/features/relationship/client/utils/useEnabledRelationships.js +53 -20
  101. package/dist/features/relationship/client/utils/useEnabledRelationships.js.map +1 -1
  102. package/dist/features/relationship/server/graphQLPopulationPromise.d.ts +2 -2
  103. package/dist/features/relationship/server/graphQLPopulationPromise.d.ts.map +1 -1
  104. package/dist/features/relationship/server/graphQLPopulationPromise.js +2 -2
  105. package/dist/features/relationship/server/graphQLPopulationPromise.js.map +1 -1
  106. package/dist/features/relationship/server/index.d.ts +8 -1
  107. package/dist/features/relationship/server/index.d.ts.map +1 -1
  108. package/dist/features/relationship/server/index.js +28 -11
  109. package/dist/features/relationship/server/index.js.map +1 -1
  110. package/dist/features/relationship/server/schema.d.ts +2 -2
  111. package/dist/features/relationship/server/schema.d.ts.map +1 -1
  112. package/dist/features/relationship/server/schema.js +5 -10
  113. package/dist/features/relationship/server/schema.js.map +1 -1
  114. package/dist/features/relationship/shared/filterEnabledRelationshipCollections.d.ts +1 -6
  115. package/dist/features/relationship/shared/filterEnabledRelationshipCollections.d.ts.map +1 -1
  116. package/dist/features/relationship/shared/filterEnabledRelationshipCollections.js +1 -5
  117. package/dist/features/relationship/shared/filterEnabledRelationshipCollections.js.map +1 -1
  118. package/dist/features/table/client/index.d.ts.map +1 -0
  119. package/dist/features/table/client/index.js.map +1 -0
  120. package/dist/features/table/client/plugins/TableActionMenuPlugin/computeSelectionCount.d.ts +8 -0
  121. package/dist/features/table/client/plugins/TableActionMenuPlugin/computeSelectionCount.d.ts.map +1 -0
  122. package/dist/features/table/client/plugins/TableActionMenuPlugin/computeSelectionCount.js +19 -0
  123. package/dist/features/table/client/plugins/TableActionMenuPlugin/computeSelectionCount.js.map +1 -0
  124. package/dist/features/table/client/plugins/TableActionMenuPlugin/index.d.ts.map +1 -0
  125. package/dist/features/{experimental_table → table}/client/plugins/TableActionMenuPlugin/index.js +17 -44
  126. package/dist/features/table/client/plugins/TableActionMenuPlugin/index.js.map +1 -0
  127. package/dist/features/table/client/plugins/TableCellResizerPlugin/index.d.ts.map +1 -0
  128. package/dist/features/{experimental_table → table}/client/plugins/TableCellResizerPlugin/index.js +41 -18
  129. package/dist/features/table/client/plugins/TableCellResizerPlugin/index.js.map +1 -0
  130. package/dist/features/table/client/plugins/TableHoverActionsPlugin/index.d.ts.map +1 -0
  131. package/dist/features/table/client/plugins/TableHoverActionsPlugin/index.js.map +1 -0
  132. package/dist/features/table/client/plugins/TablePlugin/TableGridPopup/index.d.ts.map +1 -0
  133. package/dist/features/table/client/plugins/TablePlugin/TableGridPopup/index.js.map +1 -0
  134. package/dist/features/table/client/plugins/TablePlugin/index.d.ts.map +1 -0
  135. package/dist/features/table/client/plugins/TablePlugin/index.js.map +1 -0
  136. package/dist/features/table/client/utils/debounce.d.ts.map +1 -0
  137. package/dist/features/table/client/utils/debounce.js.map +1 -0
  138. package/dist/features/table/client/utils/useDebounce.d.ts.map +1 -0
  139. package/dist/features/table/client/utils/useDebounce.js.map +1 -0
  140. package/dist/features/table/markdownTransformer.d.ts.map +1 -0
  141. package/dist/features/table/markdownTransformer.js.map +1 -0
  142. package/dist/features/table/server/index.d.ts +3 -0
  143. package/dist/features/table/server/index.d.ts.map +1 -0
  144. package/dist/features/{experimental_table → table}/server/index.js +4 -4
  145. package/dist/features/table/server/index.js.map +1 -0
  146. package/dist/features/table/server/schema.d.ts.map +1 -0
  147. package/dist/features/table/server/schema.js.map +1 -0
  148. package/dist/features/toolbars/fixed/client/Toolbar/horizontalWheelScroll.d.ts +8 -0
  149. package/dist/features/toolbars/fixed/client/Toolbar/horizontalWheelScroll.d.ts.map +1 -0
  150. package/dist/features/toolbars/fixed/client/Toolbar/horizontalWheelScroll.js +80 -0
  151. package/dist/features/toolbars/fixed/client/Toolbar/horizontalWheelScroll.js.map +1 -0
  152. package/dist/features/toolbars/fixed/client/Toolbar/index.css +77 -3
  153. package/dist/features/toolbars/fixed/client/Toolbar/index.d.ts.map +1 -1
  154. package/dist/features/toolbars/fixed/client/Toolbar/index.js +4 -1
  155. package/dist/features/toolbars/fixed/client/Toolbar/index.js.map +1 -1
  156. package/dist/features/toolbars/shared/ToolbarButton/index.d.ts.map +1 -1
  157. package/dist/features/toolbars/shared/ToolbarButton/index.js +1 -0
  158. package/dist/features/toolbars/shared/ToolbarButton/index.js.map +1 -1
  159. package/dist/features/toolbars/shared/ToolbarDropdown/DropDown.d.ts.map +1 -1
  160. package/dist/features/toolbars/shared/ToolbarDropdown/DropDown.js +85 -32
  161. package/dist/features/toolbars/shared/ToolbarDropdown/DropDown.js.map +1 -1
  162. package/dist/features/toolbars/shared/ToolbarDropdown/index.css +16 -11
  163. package/dist/features/typesServer.d.ts +1 -1
  164. package/dist/features/typesServer.d.ts.map +1 -1
  165. package/dist/features/typesServer.js.map +1 -1
  166. package/dist/features/upload/client/index.d.ts +3 -2
  167. package/dist/features/upload/client/index.d.ts.map +1 -1
  168. package/dist/features/upload/client/index.js.map +1 -1
  169. package/dist/features/upload/client/plugin/index.d.ts.map +1 -1
  170. package/dist/features/upload/client/plugin/index.js +47 -52
  171. package/dist/features/upload/client/plugin/index.js.map +1 -1
  172. package/dist/features/upload/server/graphQLPopulationPromise.d.ts +2 -2
  173. package/dist/features/upload/server/graphQLPopulationPromise.d.ts.map +1 -1
  174. package/dist/features/upload/server/graphQLPopulationPromise.js +1 -1
  175. package/dist/features/upload/server/graphQLPopulationPromise.js.map +1 -1
  176. package/dist/features/upload/server/index.d.ts +6 -2
  177. package/dist/features/upload/server/index.d.ts.map +1 -1
  178. package/dist/features/upload/server/index.js +20 -16
  179. package/dist/features/upload/server/index.js.map +1 -1
  180. package/dist/features/upload/server/schema.d.ts +2 -2
  181. package/dist/features/upload/server/schema.d.ts.map +1 -1
  182. package/dist/features/upload/server/schema.js +4 -8
  183. package/dist/features/upload/server/schema.js.map +1 -1
  184. package/dist/features/upload/server/validate.d.ts +2 -2
  185. package/dist/features/upload/server/validate.d.ts.map +1 -1
  186. package/dist/features/upload/server/validate.js +3 -0
  187. package/dist/features/upload/server/validate.js.map +1 -1
  188. package/dist/field/Diff/converters/listitem/index.d.ts.map +1 -1
  189. package/dist/field/Diff/converters/listitem/index.js +2 -1
  190. package/dist/field/Diff/converters/listitem/index.js.map +1 -1
  191. package/dist/field/Diff/index.d.ts +3 -2
  192. package/dist/field/Diff/index.d.ts.map +1 -1
  193. package/dist/field/Diff/index.js +1 -0
  194. package/dist/field/Diff/index.js.map +1 -1
  195. package/dist/field/RenderLexical/index.d.ts +3 -1
  196. package/dist/field/RenderLexical/index.d.ts.map +1 -1
  197. package/dist/field/RenderLexical/index.js +23 -23
  198. package/dist/field/RenderLexical/index.js.map +1 -1
  199. package/dist/field/ViewSelector.d.ts.map +1 -1
  200. package/dist/field/ViewSelector.js +1 -0
  201. package/dist/field/ViewSelector.js.map +1 -1
  202. package/dist/field/bundled.css +1 -1
  203. package/dist/field/index.css +10 -10
  204. package/dist/i18n.d.ts.map +1 -1
  205. package/dist/i18n.js +68 -0
  206. package/dist/i18n.js.map +1 -1
  207. package/dist/index.d.ts +2 -2
  208. package/dist/index.d.ts.map +1 -1
  209. package/dist/index.js +5 -5
  210. package/dist/index.js.map +1 -1
  211. package/dist/lexical/LexicalEditor.css +20 -9
  212. package/dist/lexical/LexicalEditor.d.ts.map +1 -1
  213. package/dist/lexical/LexicalEditor.js +61 -64
  214. package/dist/lexical/LexicalEditor.js.map +1 -1
  215. package/dist/lexical/config/server/loader.d.ts +1 -1
  216. package/dist/lexical/config/server/loader.d.ts.map +1 -1
  217. package/dist/lexical/config/server/loader.js +2 -2
  218. package/dist/lexical/config/server/loader.js.map +1 -1
  219. package/dist/lexical/config/server/sanitize.d.ts +1 -1
  220. package/dist/lexical/config/server/sanitize.d.ts.map +1 -1
  221. package/dist/lexical/config/server/sanitize.js +2 -2
  222. package/dist/lexical/config/server/sanitize.js.map +1 -1
  223. package/dist/lexical/plugins/InsertParagraphAtEnd/index.css +18 -24
  224. package/dist/lexical/plugins/InsertParagraphAtEnd/index.d.ts.map +1 -1
  225. package/dist/lexical/plugins/InsertParagraphAtEnd/index.js +27 -14
  226. package/dist/lexical/plugins/InsertParagraphAtEnd/index.js.map +1 -1
  227. package/dist/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/LexicalMenu.js +1 -1
  228. package/dist/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/LexicalMenu.js.map +1 -1
  229. package/dist/lexical/plugins/handles/AddBlockHandlePlugin/index.css +1 -0
  230. package/dist/lexical/plugins/handles/AddBlockHandlePlugin/index.js +2 -2
  231. package/dist/lexical/plugins/handles/AddBlockHandlePlugin/index.js.map +1 -1
  232. package/dist/lexical/plugins/handles/DraggableBlockPlugin/index.css +1 -0
  233. package/dist/lexical/plugins/handles/DraggableBlockPlugin/index.d.ts.map +1 -1
  234. package/dist/lexical/plugins/handles/DraggableBlockPlugin/index.js +16 -2
  235. package/dist/lexical/plugins/handles/DraggableBlockPlugin/index.js.map +1 -1
  236. package/dist/lexical/plugins/handles/DraggableBlockPlugin/useKeyboardReordering.d.ts +7 -0
  237. package/dist/lexical/plugins/handles/DraggableBlockPlugin/useKeyboardReordering.d.ts.map +1 -0
  238. package/dist/lexical/plugins/handles/DraggableBlockPlugin/useKeyboardReordering.js +65 -0
  239. package/dist/lexical/plugins/handles/DraggableBlockPlugin/useKeyboardReordering.js.map +1 -0
  240. package/dist/lexical/plugins/handles/utils/setHandlePosition.d.ts.map +1 -1
  241. package/dist/lexical/plugins/handles/utils/setHandlePosition.js +2 -0
  242. package/dist/lexical/plugins/handles/utils/setHandlePosition.js.map +1 -1
  243. package/dist/lexical/ui/ContentEditable.d.ts +2 -1
  244. package/dist/lexical/ui/ContentEditable.d.ts.map +1 -1
  245. package/dist/lexical/ui/ContentEditable.js +9 -6
  246. package/dist/lexical/ui/ContentEditable.js.map +1 -1
  247. package/dist/lexical/ui/icons/H3/index.d.ts.map +1 -1
  248. package/dist/lexical/ui/icons/H3/index.js +13 -6
  249. package/dist/lexical/ui/icons/H3/index.js.map +1 -1
  250. package/dist/lexical/ui/icons/H4/index.d.ts.map +1 -1
  251. package/dist/lexical/ui/icons/H4/index.js +13 -6
  252. package/dist/lexical/ui/icons/H4/index.js.map +1 -1
  253. package/dist/lexical/ui/icons/H5/index.d.ts.map +1 -1
  254. package/dist/lexical/ui/icons/H5/index.js +13 -6
  255. package/dist/lexical/ui/icons/H5/index.js.map +1 -1
  256. package/dist/lexical/ui/icons/H6/index.d.ts.map +1 -1
  257. package/dist/lexical/ui/icons/H6/index.js +13 -6
  258. package/dist/lexical/ui/icons/H6/index.js.map +1 -1
  259. package/dist/types/index.d.ts +1 -1
  260. package/dist/types/index.d.ts.map +1 -1
  261. package/dist/types/index.js.map +1 -1
  262. package/dist/types/nodeTypes.d.ts +1 -1
  263. package/dist/types/nodeTypes.d.ts.map +1 -1
  264. package/dist/types/nodeTypes.js.map +1 -1
  265. package/dist/utilities/createServerFeature.d.ts +1 -1
  266. package/dist/utilities/createServerFeature.d.ts.map +1 -1
  267. package/dist/utilities/createServerFeature.js +2 -2
  268. package/dist/utilities/createServerFeature.js.map +1 -1
  269. package/dist/utilities/editorConfigFactory.d.ts +6 -6
  270. package/dist/utilities/editorConfigFactory.d.ts.map +1 -1
  271. package/dist/utilities/editorConfigFactory.js +9 -9
  272. package/dist/utilities/editorConfigFactory.js.map +1 -1
  273. package/dist/utilities/getDefaultSanitizedEditorConfig.d.ts +2 -2
  274. package/dist/utilities/getDefaultSanitizedEditorConfig.d.ts.map +1 -1
  275. package/dist/utilities/getDefaultSanitizedEditorConfig.js +6 -17
  276. package/dist/utilities/getDefaultSanitizedEditorConfig.js.map +1 -1
  277. package/dist/utilities/upgradeLexicalData/index.js +6 -3
  278. package/dist/utilities/upgradeLexicalData/index.js.map +1 -1
  279. package/package.json +22 -22
  280. package/dist/dependencyChecker.spec.js +0 -16
  281. package/dist/dependencyChecker.spec.js.map +0 -1
  282. package/dist/exports/client/Field-IZKDIUJY.js +0 -2
  283. package/dist/exports/client/Field-IZKDIUJY.js.map +0 -7
  284. package/dist/exports/client/chunk-SSMQFWCQ.js +0 -2
  285. package/dist/exports/client/componentInline-H24N7GUG.js +0 -2
  286. package/dist/features/converters/lexicalToPlaintext/convertLexicalToPlaintext.spec.js +0 -180
  287. package/dist/features/converters/lexicalToPlaintext/convertLexicalToPlaintext.spec.js.map +0 -1
  288. package/dist/features/experimental_table/client/index.d.ts.map +0 -1
  289. package/dist/features/experimental_table/client/index.js.map +0 -1
  290. package/dist/features/experimental_table/client/plugins/TableActionMenuPlugin/index.d.ts.map +0 -1
  291. package/dist/features/experimental_table/client/plugins/TableActionMenuPlugin/index.js.map +0 -1
  292. package/dist/features/experimental_table/client/plugins/TableCellResizerPlugin/index.d.ts.map +0 -1
  293. package/dist/features/experimental_table/client/plugins/TableCellResizerPlugin/index.js.map +0 -1
  294. package/dist/features/experimental_table/client/plugins/TableHoverActionsPlugin/index.d.ts.map +0 -1
  295. package/dist/features/experimental_table/client/plugins/TableHoverActionsPlugin/index.js.map +0 -1
  296. package/dist/features/experimental_table/client/plugins/TablePlugin/TableGridPopup/index.d.ts.map +0 -1
  297. package/dist/features/experimental_table/client/plugins/TablePlugin/TableGridPopup/index.js.map +0 -1
  298. package/dist/features/experimental_table/client/plugins/TablePlugin/index.d.ts.map +0 -1
  299. package/dist/features/experimental_table/client/plugins/TablePlugin/index.js.map +0 -1
  300. package/dist/features/experimental_table/client/utils/debounce.d.ts.map +0 -1
  301. package/dist/features/experimental_table/client/utils/debounce.js.map +0 -1
  302. package/dist/features/experimental_table/client/utils/useDebounce.d.ts.map +0 -1
  303. package/dist/features/experimental_table/client/utils/useDebounce.js.map +0 -1
  304. package/dist/features/experimental_table/markdownTransformer.d.ts.map +0 -1
  305. package/dist/features/experimental_table/markdownTransformer.js.map +0 -1
  306. package/dist/features/experimental_table/server/index.d.ts +0 -3
  307. package/dist/features/experimental_table/server/index.d.ts.map +0 -1
  308. package/dist/features/experimental_table/server/index.js.map +0 -1
  309. package/dist/features/experimental_table/server/schema.d.ts.map +0 -1
  310. package/dist/features/experimental_table/server/schema.js.map +0 -1
  311. package/dist/features/link/markdownTransformer.spec.js +0 -195
  312. package/dist/features/link/markdownTransformer.spec.js.map +0 -1
  313. package/dist/lexical/utils/markdown/convertFromMarkdownString.spec.js +0 -88
  314. package/dist/lexical/utils/markdown/convertFromMarkdownString.spec.js.map +0 -1
  315. package/dist/lexical/utils/url.spec.js +0 -114
  316. package/dist/lexical/utils/url.spec.js.map +0 -1
  317. package/dist/utilities/jsx/jsx.spec.js +0 -178
  318. package/dist/utilities/jsx/jsx.spec.js.map +0 -1
  319. /package/dist/exports/client/{componentInline-H24N7GUG.js.map → componentInline-55HZXGUS.js.map} +0 -0
  320. /package/dist/features/{experimental_table → table}/client/index.d.ts +0 -0
  321. /package/dist/features/{experimental_table → table}/client/index.js +0 -0
  322. /package/dist/features/{experimental_table → table}/client/plugins/TableActionMenuPlugin/index.css +0 -0
  323. /package/dist/features/{experimental_table → table}/client/plugins/TableActionMenuPlugin/index.d.ts +0 -0
  324. /package/dist/features/{experimental_table → table}/client/plugins/TableCellResizerPlugin/index.css +0 -0
  325. /package/dist/features/{experimental_table → table}/client/plugins/TableCellResizerPlugin/index.d.ts +0 -0
  326. /package/dist/features/{experimental_table → table}/client/plugins/TableHoverActionsPlugin/index.d.ts +0 -0
  327. /package/dist/features/{experimental_table → table}/client/plugins/TableHoverActionsPlugin/index.js +0 -0
  328. /package/dist/features/{experimental_table → table}/client/plugins/TablePlugin/TableGridPopup/index.css +0 -0
  329. /package/dist/features/{experimental_table → table}/client/plugins/TablePlugin/TableGridPopup/index.d.ts +0 -0
  330. /package/dist/features/{experimental_table → table}/client/plugins/TablePlugin/TableGridPopup/index.js +0 -0
  331. /package/dist/features/{experimental_table → table}/client/plugins/TablePlugin/index.css +0 -0
  332. /package/dist/features/{experimental_table → table}/client/plugins/TablePlugin/index.d.ts +0 -0
  333. /package/dist/features/{experimental_table → table}/client/plugins/TablePlugin/index.js +0 -0
  334. /package/dist/features/{experimental_table → table}/client/utils/debounce.d.ts +0 -0
  335. /package/dist/features/{experimental_table → table}/client/utils/debounce.js +0 -0
  336. /package/dist/features/{experimental_table → table}/client/utils/useDebounce.d.ts +0 -0
  337. /package/dist/features/{experimental_table → table}/client/utils/useDebounce.js +0 -0
  338. /package/dist/features/{experimental_table → table}/markdownTransformer.d.ts +0 -0
  339. /package/dist/features/{experimental_table → table}/markdownTransformer.js +0 -0
  340. /package/dist/features/{experimental_table → table}/server/schema.d.ts +0 -0
  341. /package/dist/features/{experimental_table → table}/server/schema.js +0 -0
@@ -1 +0,0 @@
1
- {"version":3,"file":"markdownTransformer.js","names":["$convertToMarkdownString","$createTableCellNode","$createTableNode","$createTableRowNode","$isTableCellNode","$isTableNode","$isTableRowNode","TableCellHeaderStates","TableCellNode","TableNode","TableRowNode","$isParagraphNode","$isTextNode","$convertFromMarkdownString","TABLE_ROW_REG_EXP","TABLE_ROW_DIVIDER_REG_EXP","PAYLOAD_TABLE","allTransformers","type","dependencies","export","node","output","row","getChildren","rowOutput","isHeaderRow","cell","push","replace","trim","__headerState","ROW","join","map","_","regExp","parentNode","_1","match","match0","test","table","getPreviousSibling","rows","lastRow","length","forEach","setHeaderStyles","remove","matchCells","mapToTableCells","sibling","maxCells","getChildrenSize","firstChild","getFirstChild","cells","getTextContent","Math","max","unshift","previousSibling","tableRow","append","i","$createTableCell","getTableColumnsSize","selectEnd","textContent","NO_STATUS","split","text"],"sources":["../../../src/features/experimental_table/markdownTransformer.ts"],"sourcesContent":["import type { LexicalNode } from 'lexical'\n\nimport {\n $convertToMarkdownString,\n type ElementTransformer,\n type Transformer,\n} from '@lexical/markdown'\nimport {\n $createTableCellNode,\n $createTableNode,\n $createTableRowNode,\n $isTableCellNode,\n $isTableNode,\n $isTableRowNode,\n TableCellHeaderStates,\n TableCellNode,\n TableNode,\n TableRowNode,\n} from '@lexical/table'\nimport { $isParagraphNode, $isTextNode } from 'lexical'\n\nimport { $convertFromMarkdownString } from '../../lexical/utils/markdown/convertFromMarkdownString.js'\n\n// Very primitive table setup\nconst TABLE_ROW_REG_EXP = /^\\|(.+)\\|\\s?$/\n// eslint-disable-next-line regexp/no-unused-capturing-group\nconst TABLE_ROW_DIVIDER_REG_EXP = /^(\\| ?:?-*:? ?)+\\|\\s?$/\n\nexport const PAYLOAD_TABLE: (props: { allTransformers: Transformer[] }) => ElementTransformer = ({\n allTransformers,\n}) => ({\n type: 'element',\n dependencies: [TableNode, TableRowNode, TableCellNode],\n export: (node: LexicalNode) => {\n if (!$isTableNode(node)) {\n return null\n }\n\n const output: string[] = []\n\n for (const row of node.getChildren()) {\n const rowOutput: string[] = []\n if (!$isTableRowNode(row)) {\n continue\n }\n\n let isHeaderRow = false\n for (const cell of row.getChildren()) {\n // It's TableCellNode, so it's just to make flow happy\n if ($isTableCellNode(cell)) {\n rowOutput.push(\n $convertToMarkdownString(allTransformers, cell).replace(/\\n/g, '\\\\n').trim(),\n )\n\n if (cell.__headerState === TableCellHeaderStates.ROW) {\n isHeaderRow = true\n }\n }\n }\n\n output.push(`| ${rowOutput.join(' | ')} |`)\n if (isHeaderRow) {\n output.push(`| ${rowOutput.map((_) => '---').join(' | ')} |`)\n }\n }\n\n return output.join('\\n')\n },\n regExp: TABLE_ROW_REG_EXP,\n replace: (parentNode, _1, match) => {\n const match0 = match[0]\n if (!match0) {\n return\n }\n // Header row\n if (TABLE_ROW_DIVIDER_REG_EXP.test(match0)) {\n const table = parentNode.getPreviousSibling()\n if (!table || !$isTableNode(table)) {\n return\n }\n\n const rows = table.getChildren()\n const lastRow = rows[rows.length - 1]\n if (!lastRow || !$isTableRowNode(lastRow)) {\n return\n }\n\n // Add header state to row cells\n lastRow.getChildren().forEach((cell) => {\n if (!$isTableCellNode(cell)) {\n return\n }\n cell.setHeaderStyles(TableCellHeaderStates.ROW, TableCellHeaderStates.ROW)\n })\n\n // Remove line\n parentNode.remove()\n return\n }\n\n const matchCells = mapToTableCells(match0, allTransformers)\n\n if (matchCells == null) {\n return\n }\n\n const rows = [matchCells]\n let sibling = parentNode.getPreviousSibling()\n let maxCells = matchCells.length\n\n while (sibling) {\n if (!$isParagraphNode(sibling)) {\n break\n }\n\n if (sibling.getChildrenSize() !== 1) {\n break\n }\n\n const firstChild = sibling.getFirstChild()\n\n if (!$isTextNode(firstChild)) {\n break\n }\n\n const cells = mapToTableCells(firstChild.getTextContent(), allTransformers)\n\n if (cells == null) {\n break\n }\n\n maxCells = Math.max(maxCells, cells.length)\n rows.unshift(cells)\n const previousSibling = sibling.getPreviousSibling()\n sibling.remove()\n sibling = previousSibling\n }\n\n const table = $createTableNode()\n\n for (const cells of rows) {\n const tableRow = $createTableRowNode()\n table.append(tableRow)\n\n for (let i = 0; i < maxCells; i++) {\n tableRow.append(i < cells.length ? cells[i]! : $createTableCell('', allTransformers))\n }\n }\n\n const previousSibling = parentNode.getPreviousSibling()\n if ($isTableNode(previousSibling) && getTableColumnsSize(previousSibling) === maxCells) {\n previousSibling.append(...table.getChildren())\n parentNode.remove()\n } else {\n parentNode.replace(table)\n }\n\n table.selectEnd()\n },\n})\n\nfunction getTableColumnsSize(table: TableNode) {\n const row = table.getFirstChild()\n return $isTableRowNode(row) ? row.getChildrenSize() : 0\n}\n\nconst $createTableCell = (textContent: string, allTransformers: Transformer[]): TableCellNode => {\n textContent = textContent.replace(/\\\\n/g, '\\n')\n const cell = $createTableCellNode(TableCellHeaderStates.NO_STATUS)\n // shouldMergeAdjacentLines is true to preserve how cell content was parsed\n // before the exported $convertFromMarkdownString default changed to false.\n $convertFromMarkdownString(textContent, allTransformers, cell, false, true)\n return cell\n}\n\nconst mapToTableCells = (\n textContent: string,\n allTransformers: Transformer[],\n): Array<TableCellNode> | null => {\n const match = textContent.match(TABLE_ROW_REG_EXP)\n if (!match || !match[1]) {\n return null\n }\n return match[1].split('|').map((text) => $createTableCell(text, allTransformers))\n}\n"],"mappings":"AAEA,SACEA,wBAAwB,QAGnB;AACP,SACEC,oBAAoB,EACpBC,gBAAgB,EAChBC,mBAAmB,EACnBC,gBAAgB,EAChBC,YAAY,EACZC,eAAe,EACfC,qBAAqB,EACrBC,aAAa,EACbC,SAAS,EACTC,YAAY,QACP;AACP,SAASC,gBAAgB,EAAEC,WAAW,QAAQ;AAE9C,SAASC,0BAA0B,QAAQ;AAE3C;AACA,MAAMC,iBAAA,GAAoB;AAC1B;AACA,MAAMC,yBAAA,GAA4B;AAElC,OAAO,MAAMC,aAAA,GAAmFA,CAAC;EAC/FC;AAAe,CAChB,MAAM;EACLC,IAAA,EAAM;EACNC,YAAA,EAAc,CAACV,SAAA,EAAWC,YAAA,EAAcF,aAAA,CAAc;EACtDY,MAAA,EAASC,IAAA;IACP,IAAI,CAAChB,YAAA,CAAagB,IAAA,GAAO;MACvB,OAAO;IACT;IAEA,MAAMC,MAAA,GAAmB,EAAE;IAE3B,KAAK,MAAMC,GAAA,IAAOF,IAAA,CAAKG,WAAW,IAAI;MACpC,MAAMC,SAAA,GAAsB,EAAE;MAC9B,IAAI,CAACnB,eAAA,CAAgBiB,GAAA,GAAM;QACzB;MACF;MAEA,IAAIG,WAAA,GAAc;MAClB,KAAK,MAAMC,IAAA,IAAQJ,GAAA,CAAIC,WAAW,IAAI;QACpC;QACA,IAAIpB,gBAAA,CAAiBuB,IAAA,GAAO;UAC1BF,SAAA,CAAUG,IAAI,CACZ5B,wBAAA,CAAyBiB,eA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BzB,UAAA,CAAWM,kBAAkB;IACrD,IAAItC,YAAA,CAAayD,eAAA,KAAoBK,mBAAA,CAAoBL,eAAA,MAAqBT,QAAA,EAAU;MACtFS,eAAA,CAAgBE,MAAM,IAAItB,KAAA,CAAMlB,WAAW;MAC3Ca,UAAA,CAAWY,MAAM;IACnB,OAAO;MACLZ,UAAA,CAAWR,OAAO,CAACa,KAAA;IACrB;IAEAA,KAAA,CAAM0B,SAAS;EACjB;AACF;AAEA,SAASD,oBAAoBzB,KAAgB;EAC3C,MAAMnB,GAAA,GAAMmB,KAAA,CAAMc,aAAa;EAC/B,OAAOlD,eAAA,CAAgBiB,GAAA,IAAOA,GAAA,CAAI+B,eAAe,KAAK;AACxD;AAEA,MAAMY,gBAAA,GAAmBA,CAACG,WAAA,EAAqBpD,eAAA;EAC7CoD,WAAA,GAAcA,WAAA,CAAYxC,OAAO,CAAC,QAAQ;EAC1C,MAAMF,IAAA,GAAO1B,oBAAA,CAAqBM,qBAAA,CAAsB+D,SAAS;EACjE;EACA;EACAzD,0BAAA,CAA2BwD,WAAA,EAAapD,eAAA,EAAiBU,IAAA,EAAM,OAAO;EACtE,OAAOA,IAAA;AACT;AAEA,MAAMwB,eAAA,GAAkBA,CACtBkB,WAAA,EACApD,eAAA;EAEA,MAAMsB,KAAA,GAAQ8B,WAAA,CAAY9B,KAAK,CAACzB,iBAAA;EAChC,IAAI,CAACyB,KAAA,IAAS,CAACA,KAAK,CAAC,EAAE,EAAE;IACvB,OAAO;EACT;EACA,OAAOA,KAAK,CAAC,EAAE,CAACgC,KAAK,CAAC,KAAKrC,GAAG,CAAEsC,IAAA,IAASN,gBAAA,CAAiBM,IAAA,EAAMvD,eAAA;AAClE","ignoreList":[]}
@@ -1,3 +0,0 @@
1
- export type { SerializedTableCellNode, SerializedTableNode, SerializedTableRowNode, } from './schema.js';
2
- export declare const EXPERIMENTAL_TableFeature: import("../../typesServer.js").FeatureProviderProviderServer<undefined, undefined, undefined>;
3
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/features/experimental_table/server/index.ts"],"names":[],"mappings":"AAUA,YAAY,EACV,uBAAuB,EACvB,mBAAmB,EACnB,sBAAsB,GACvB,MAAM,aAAa,CAAA;AAiBpB,eAAO,MAAM,yBAAyB,+FAwCpC,CAAA"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","names":["TableCellNode","TableNode","TableRowNode","sanitizeFields","createServerFeature","createNode","PAYLOAD_TABLE","tableCellNodeJSONSchema","tableNodeJSONSchema","tableRowNodeJSONSchema","fields","name","type","defaultValue","required","EXPERIMENTAL_TableFeature","feature","config","isRoot","parentIsLocalized","validRelationships","collections","map","c","slug","sanitizedFields","requireFieldLevelRichTextEditor","ClientFeature","generateSchemaMap","schemaMap","Map","set","markdownTransformers","nodes","jsonSchema","node","key"],"sources":["../../../../src/features/experimental_table/server/index.ts"],"sourcesContent":["import type { Config, Field, FieldSchemaMap } from 'payload'\n\nimport { TableCellNode, TableNode, TableRowNode } from '@lexical/table'\nimport { sanitizeFields } from 'payload'\n\nimport { createServerFeature } from '../../../utilities/createServerFeature.js'\nimport { createNode } from '../../typeUtilities.js'\nimport { PAYLOAD_TABLE } from '../markdownTransformer.js'\nimport { tableCellNodeJSONSchema, tableNodeJSONSchema, tableRowNodeJSONSchema } from './schema.js'\n\nexport type {\n SerializedTableCellNode,\n SerializedTableNode,\n SerializedTableRowNode,\n} from './schema.js'\n\nconst fields: Field[] = [\n {\n name: 'rows',\n type: 'number',\n defaultValue: 5,\n required: true,\n },\n {\n name: 'columns',\n type: 'number',\n defaultValue: 5,\n required: true,\n },\n]\n\nexport const EXPERIMENTAL_TableFeature = createServerFeature({\n feature: async ({ config, isRoot, parentIsLocalized }) => {\n const validRelationships = config.collections.map((c) => c.slug) || []\n\n const sanitizedFields = await sanitizeFields({\n config: config as unknown as Config,\n fields,\n parentIsLocalized,\n requireFieldLevelRichTextEditor: isRoot,\n validRelationships,\n })\n return {\n ClientFeature: '@payloadcms/richtext-lexical/client#TableFeatureClient',\n generateSchemaMap: () => {\n const schemaMap: FieldSchemaMap = new Map()\n\n schemaMap.set('fields', {\n fields: sanitizedFields,\n })\n\n return schemaMap\n },\n markdownTransformers: [PAYLOAD_TABLE],\n nodes: [\n createNode({\n jsonSchema: tableNodeJSONSchema,\n node: TableNode,\n }),\n createNode({\n jsonSchema: tableCellNodeJSONSchema,\n node: TableCellNode,\n }),\n createNode({\n jsonSchema: tableRowNodeJSONSchema,\n node: TableRowNode,\n }),\n ],\n }\n },\n key: 'experimental_table',\n})\n"],"mappings":"AAEA,SAASA,aAAa,EAAEC,SAAS,EAAEC,YAAY,QAAQ;AACvD,SAASC,cAAc,QAAQ;AAE/B,SAASC,mBAAmB,QAAQ;AACpC,SAASC,UAAU,QAAQ;AAC3B,SAASC,aAAa,QAAQ;AAC9B,SAASC,uBAAuB,EAAEC,mBAAmB,EAAEC,sBAAsB,QAAQ;AAQrF,MAAMC,MAAA,GAAkB,CACtB;EACEC,IAAA,EAAM;EACNC,IAAA,EAAM;EACNC,YAAA,EAAc;EACdC,QAAA,EAAU;AACZ,GACA;EACEH,IAAA,EAAM;EACNC,IAAA,EAAM;EACNC,YAAA,EAAc;EACdC,QAAA,EAAU;AACZ,EACD;AAED,OAAO,MAAMC,yBAAA,GAA4BX,mBAAA,CAAoB;EAC3DY,OAAA,EAAS,MAAAA,CAAO;IAAEC,MAAM;IAAEC,MAAM;IAAEC;EAAiB,CAAE;IACnD,MAAMC,kBAAA,GAAqBH,MAAA,CAAOI,WAAW,CAACC,GAAG,CAAEC,CAAA,IAAMA,CAAA,CAAEC,IAAI,KAAK,EAAE;IAEtE,MAAMC,eAAA,GAAkB,MAAMtB,cAAA,CAAe;MAC3Cc,MAAA,EAAQA,MAAA;MACRP,MAAA;MACAS,iBAAA;MACAO,+BAAA,EAAiCR,MAAA;MACjCE;IACF;IACA,OAAO;MACLO,aAAA,EAAe;MACfC,iBAAA,EAAmBA,CAAA;QACjB,MAAMC,SAAA,GAA4B,IAAIC,GAAA;QAEtCD,SAAA,CAAUE,GAAG,CAAC,UAAU;UACtBrB,MAAA,EAAQe;QACV;QAEA,OAAOI,SAAA;MACT;MACAG,oBAAA,EAAsB,CAAC1B,aAAA,CAAc;MACrC2B,KAAA,EAAO,CACL5B,UAAA,CAAW;QACT6B,UAAA,EAAY1B,mBAAA;QACZ2B,IAAA,EAAMlC;MACR,IACAI,UAAA,CAAW;QACT6B,UAAA,EAAY3B,uBAAA;QACZ4B,IAAA,EAAMnC;MACR,IACAK,UAAA,CAAW;QACT6B,UAAA,EAAYzB,sBAAA;QACZ0B,IAAA,EAAMjC;MACR;IAEJ;EACF;EACAkC,GAAA,EAAK;AACP","ignoreList":[]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../../../src/features/experimental_table/server/schema.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAA;AAEpD,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,6BAA6B,CAAA;AAC/E,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAA;AAExD,MAAM,WAAW,uBAAuB,CACtC,SAAS,SAAS,qBAAqB,GAAG,qBAAqB,CAC/D,SAAQ,4BAA4B,CAAC,SAAS,CAAC;IAC/C,eAAe,CAAC,EAAE,IAAI,GAAG,MAAM,CAAA;IAC/B,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,WAAW,EAAE,MAAM,CAAA;IACnB,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,IAAI,EAAE,WAAW,CAAA;IACjB,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,KAAK,CAAC,EAAE,MAAM,CAAA;CACf;AAED,MAAM,WAAW,mBAAmB,CAClC,SAAS,SAAS,qBAAqB,GAAG,qBAAqB,CAC/D,SAAQ,4BAA4B,CAAC,SAAS,CAAC;IAC/C,SAAS,CAAC,EAAE,MAAM,EAAE,CAAA;IACpB,iBAAiB,CAAC,EAAE,MAAM,CAAA;IAC1B,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB,WAAW,CAAC,EAAE,OAAO,CAAA;IACrB,IAAI,EAAE,OAAO,CAAA;CACd;AAED,MAAM,WAAW,sBAAsB,CACrC,SAAS,SAAS,qBAAqB,GAAG,qBAAqB,CAC/D,SAAQ,4BAA4B,CAAC,SAAS,CAAC;IAC/C,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,IAAI,EAAE,UAAU,CAAA;CACjB;AA2BD,eAAO,MAAM,mBAAmB,EAAE,YAgBjC,CAAA;AAED,eAAO,MAAM,uBAAuB,EAAE,YAuBrC,CAAA;AAED,eAAO,MAAM,sBAAsB,EAAE,YAWpC,CAAA"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"schema.js","names":["TABLE_NODES_TS","tableNodeJSONSchema","elementNodeSchema","nodeUnionName","typeStringDefinitions","add","nodeType","properties","colWidths","type","items","frozenColumnCount","frozenRowCount","rowStriping","tsType","tableCellNodeJSONSchema","backgroundColor","oneOf","colSpan","description","headerState","rowSpan","verticalAlign","width","required","tableRowNodeJSONSchema","height"],"sources":["../../../../src/features/experimental_table/server/schema.ts"],"sourcesContent":["import type { SerializedLexicalNode } from 'lexical'\n\nimport type { SerializedLexicalElementBase } from '../../../types/nodeTypes.js'\nimport type { JSONSchemaFn } from '../../typesServer.js'\n\nexport interface SerializedTableCellNode<\n TChildren extends SerializedLexicalNode = SerializedLexicalNode,\n> extends SerializedLexicalElementBase<TChildren> {\n backgroundColor?: null | string\n colSpan?: number\n headerState: number\n rowSpan?: number\n type: 'tablecell'\n verticalAlign?: string\n width?: number\n}\n\nexport interface SerializedTableNode<\n TChildren extends SerializedLexicalNode = SerializedLexicalNode,\n> extends SerializedLexicalElementBase<TChildren> {\n colWidths?: number[]\n frozenColumnCount?: number\n frozenRowCount?: number\n rowStriping?: boolean\n type: 'table'\n}\n\nexport interface SerializedTableRowNode<\n TChildren extends SerializedLexicalNode = SerializedLexicalNode,\n> extends SerializedLexicalElementBase<TChildren> {\n height?: number\n type: 'tablerow'\n}\n\n/**\n * MUST stay byte-for-byte in sync with the runtime `SerializedTableNode`,\n * `SerializedTableRowNode`, and `SerializedTableCellNode` declared above.\n */\nconst TABLE_NODES_TS = `export interface SerializedTableNode<TChildren> extends SerializedLexicalElementBase<TChildren> {\n type: 'table';\n colWidths?: number[];\n frozenColumnCount?: number;\n frozenRowCount?: number;\n rowStriping?: boolean;\n}\nexport interface SerializedTableRowNode<TChildren> extends SerializedLexicalElementBase<TChildren> {\n type: 'tablerow';\n height?: number;\n}\nexport interface SerializedTableCellNode<TChildren> extends SerializedLexicalElementBase<TChildren> {\n type: 'tablecell';\n backgroundColor?: string | null;\n colSpan?: number;\n headerState: number;\n rowSpan?: number;\n verticalAlign?: string;\n width?: number;\n}`\n\nexport const tableNodeJSONSchema: JSONSchemaFn = ({\n elementNodeSchema,\n nodeUnionName,\n typeStringDefinitions,\n}) => {\n typeStringDefinitions.add(TABLE_NODES_TS)\n return elementNodeSchema({\n nodeType: 'table',\n properties: {\n colWidths: { type: 'array', items: { type: 'number' } },\n frozenColumnCount: { type: 'integer' },\n frozenRowCount: { type: 'integer' },\n rowStriping: { type: 'boolean' },\n },\n tsType: `SerializedTableNode<${nodeUnionName}>`,\n })\n}\n\nexport const tableCellNodeJSONSchema: JSONSchemaFn = ({\n elementNodeSchema,\n nodeUnionName,\n typeStringDefinitions,\n}) => {\n typeStringDefinitions.add(TABLE_NODES_TS)\n return elementNodeSchema({\n nodeType: 'tablecell',\n properties: {\n backgroundColor: { oneOf: [{ type: 'string' }, { type: 'null' }] },\n colSpan: { type: 'integer', description: 'How many columns this cell spans (default 1).' },\n headerState: {\n type: 'integer',\n description:\n 'Header bitmask: 0 = normal cell, 1 = row header, 2 = column header, 3 = both.',\n },\n rowSpan: { type: 'integer', description: 'How many rows this cell spans (default 1).' },\n verticalAlign: { type: 'string' },\n width: { type: 'integer' },\n },\n required: ['headerState'],\n tsType: `SerializedTableCellNode<${nodeUnionName}>`,\n })\n}\n\nexport const tableRowNodeJSONSchema: JSONSchemaFn = ({\n elementNodeSchema,\n nodeUnionName,\n typeStringDefinitions,\n}) => {\n typeStringDefinitions.add(TABLE_NODES_TS)\n return elementNodeSchema({\n nodeType: 'tablerow',\n properties: { height: { type: 'integer' } },\n tsType: `SerializedTableRowNode<${nodeUnionName}>`,\n })\n}\n"],"mappings":"AAkCA;;;GAIA,MAAMA,cAAA,GAAiB;;;;;;;;;;;;;;;;;;;EAmBrB;AAEF,OAAO,MAAMC,mBAAA,GAAoCA,CAAC;EAChDC,iBAAiB;EACjBC,aAAa;EACbC;AAAqB,CACtB;EACCA,qBAAA,CAAsBC,GAAG,CAACL,cAAA;EAC1B,OAAOE,iBAAA,CAAkB;IACvBI,QAAA,EAAU;IACVC,UAAA,EAAY;MACVC,SAAA,EAAW;QAAEC,IAAA,EAAM;QAASC,KAAA,EAAO;UAAED,IAAA,EAAM;QAAS;MAAE;MACtDE,iBAAA,EAAmB;QAAEF,IAAA,EAAM;MAAU;MACrCG,cAAA,EAAgB;QAAEH,IAAA,EAAM;MAAU;MAClCI,WAAA,EAAa;QAAEJ,IAAA,EAAM;MAAU;IACjC;IACAK,MAAA,EAAQ,uBAAuBX,aAAA;EACjC;AACF;AAEA,OAAO,MAAMY,uBAAA,GAAwCA,CAAC;EACpDb,iBAAiB;EACjBC,aAAa;EACbC;AAAqB,CACtB;EACCA,qBAAA,CAAsBC,GAAG,CAACL,cAAA;EAC1B,OAAOE,iBAAA,CAAkB;IACvBI,QAAA,EAAU;IACVC,UAAA,EAAY;MACVS,eAAA,EAAiB;QAAEC,KAAA,EAAO,CAAC;UAAER,IAAA,EAAM;QAAS,GAAG;UAAEA,IAAA,EAAM;QAAO;MAAG;MACjES,OAAA,EAAS;QAAET,IAAA,EAAM;QAAWU,WAAA,EAAa;MAAgD;MACzFC,WAAA,EAAa;QACXX,IAAA,EAAM;QACNU,WAAA,EACE;MACJ;MACAE,OAAA,EAAS;QAAEZ,IAAA,EAAM;QAAWU,WAAA,EAAa;MAA6C;MACtFG,aAAA,EAAe;QAAEb,IAAA,EAAM;MAAS;MAChCc,KAAA,EAAO;QAAEd,IAAA,EAAM;MAAU;IAC3B;IACAe,QAAA,EAAU,CAAC,cAAc;IACzBV,MAAA,EAAQ,2BAA2BX,aAAA;EACrC;AACF;AAEA,OAAO,MAAMsB,sBAAA,GAAuCA,CAAC;EACnDvB,iBAAiB;EACjBC,aAAa;EACbC;AAAqB,CACtB;EACCA,qBAAA,CAAsBC,GAAG,CAACL,cAAA;EAC1B,OAAOE,iBAAA,CAAkB;IACvBI,QAAA,EAAU;IACVC,UAAA,EAAY;MAAEmB,MAAA,EAAQ;QAAEjB,IAAA,EAAM;MAAU;IAAE;IAC1CK,MAAA,EAAQ,0BAA0BX,aAAA;EACpC;AACF","ignoreList":[]}
@@ -1,195 +0,0 @@
1
- import { createHeadlessEditor } from '@lexical/headless';
2
- import { $createParagraphNode, $createTextNode, $getRoot } from 'lexical';
3
- import { describe, expect, it } from 'vitest';
4
- import { $convertToMarkdownString } from '@lexical/markdown';
5
- import { AutoLinkNode } from './nodes/AutoLinkNode.js';
6
- import { $createLinkNode, LinkNode } from './nodes/LinkNode.js';
7
- import { PAYLOAD_LINK, createPayloadLinkTransformer } from './markdownTransformer.js';
8
- function createEditor() {
9
- return createHeadlessEditor({
10
- nodes: [LinkNode, AutoLinkNode]
11
- });
12
- }
13
- function toMarkdown(setupFn, transformer = PAYLOAD_LINK) {
14
- const editor = createEditor();
15
- editor.update(setupFn, {
16
- discrete: true
17
- });
18
- let markdown = '';
19
- editor.getEditorState().read(() => {
20
- markdown = $convertToMarkdownString([transformer]);
21
- });
22
- return markdown;
23
- }
24
- describe('createPayloadLinkTransformer', () => {
25
- describe('custom links', () => {
26
- it('should export a custom link with its url', () => {
27
- const markdown = toMarkdown(() => {
28
- const link = $createLinkNode({
29
- fields: {
30
- linkType: 'custom',
31
- url: 'https://payloadcms.com',
32
- newTab: false,
33
- doc: null
34
- }
35
- });
36
- link.append($createTextNode('Payload'));
37
- $getRoot().append($createParagraphNode().append(link));
38
- });
39
- expect(markdown).toBe('[Payload](https://payloadcms.com)');
40
- });
41
- it('should export a custom link that opens in a new tab', () => {
42
- // newTab is a Payload field — markdown has no equivalent, so it is intentionally dropped
43
- const markdown = toMarkdown(() => {
44
- const link = $createLinkNode({
45
- fields: {
46
- linkType: 'custom',
47
- url: 'https://payloadcms.com',
48
- newTab: true,
49
- doc: null
50
- }
51
- });
52
- link.append($createTextNode('Payload'));
53
- $getRoot().append($createParagraphNode().append(link));
54
- });
55
- expect(markdown).toBe('[Payload](https://payloadcms.com)');
56
- });
57
- it('should produce an empty href when url is null or undefined', () => {
58
- const markdownNull = toMarkdown(() => {
59
- const link = $createLinkNode({
60
- fields: {
61
- linkType: 'custom',
62
- url: null,
63
- newTab: false,
64
- doc: null
65
- }
66
- });
67
- link.append($createTextNode('Broken'));
68
- $getRoot().append($createParagraphNode().append(link));
69
- });
70
- const markdownUndefined = toMarkdown(() => {
71
- const link = $createLinkNode({
72
- fields: {
73
- linkType: 'custom',
74
- newTab: false,
75
- doc: null
76
- }
77
- });
78
- link.append($createTextNode('Broken'));
79
- $getRoot().append($createParagraphNode().append(link));
80
- });
81
- expect(markdownNull).toBe('[Broken]()');
82
- expect(markdownUndefined).toBe('[Broken]()');
83
- });
84
- });
85
- describe('internal links', () => {
86
- it('should export an empty href when no internalDocToHref is provided', () => {
87
- const markdown = toMarkdown(() => {
88
- const link = $createLinkNode({
89
- fields: {
90
- linkType: 'internal',
91
- doc: {
92
- relationTo: 'pages',
93
- value: {
94
- id: '1',
95
- slug: 'about'
96
- }
97
- },
98
- newTab: false
99
- }
100
- });
101
- link.append($createTextNode('About'));
102
- $getRoot().append($createParagraphNode().append(link));
103
- });
104
- expect(markdown).toBe('[About]()');
105
- });
106
- it('should call internalDocToHref and use the returned url', () => {
107
- const transformer = createPayloadLinkTransformer({
108
- internalDocToHref: ({
109
- linkNode
110
- }) => {
111
- const value = linkNode.fields.doc?.value;
112
- if (value && typeof value === 'object' && 'slug' in value) {
113
- return `/${value.slug}`;
114
- }
115
- return '/';
116
- }
117
- });
118
- const markdown = toMarkdown(() => {
119
- const link = $createLinkNode({
120
- fields: {
121
- linkType: 'internal',
122
- doc: {
123
- relationTo: 'pages',
124
- value: {
125
- id: '1',
126
- slug: 'about'
127
- }
128
- },
129
- newTab: false
130
- }
131
- });
132
- link.append($createTextNode('About'));
133
- $getRoot().append($createParagraphNode().append(link));
134
- }, transformer);
135
- expect(markdown).toBe('[About](/about)');
136
- });
137
- it('should pass the full serialized link node to internalDocToHref', () => {
138
- let capturedLinkNode = null;
139
- const transformer = createPayloadLinkTransformer({
140
- internalDocToHref: ({
141
- linkNode
142
- }) => {
143
- capturedLinkNode = linkNode;
144
- return '/captured';
145
- }
146
- });
147
- toMarkdown(() => {
148
- const link = $createLinkNode({
149
- fields: {
150
- linkType: 'internal',
151
- doc: {
152
- relationTo: 'pages',
153
- value: {
154
- id: '42',
155
- title: 'Home'
156
- }
157
- },
158
- newTab: true
159
- }
160
- });
161
- link.append($createTextNode('Home'));
162
- $getRoot().append($createParagraphNode().append(link));
163
- }, transformer);
164
- expect(capturedLinkNode).not.toBeNull();
165
- expect(capturedLinkNode.fields.linkType).toBe('internal');
166
- expect(capturedLinkNode.fields.doc?.relationTo).toBe('pages');
167
- expect(capturedLinkNode.fields.doc?.value).toMatchObject({
168
- id: '42',
169
- title: 'Home'
170
- });
171
- expect(capturedLinkNode.fields.newTab).toBe(true);
172
- });
173
- });
174
- describe('PAYLOAD_LINK (static export)', () => {
175
- it('should behave identically to createPayloadLinkTransformer() with no args', () => {
176
- const setup = () => {
177
- const link = $createLinkNode({
178
- fields: {
179
- linkType: 'custom',
180
- url: 'https://example.com',
181
- newTab: false,
182
- doc: null
183
- }
184
- });
185
- link.append($createTextNode('Example'));
186
- $getRoot().append($createParagraphNode().append(link));
187
- };
188
- const fromStatic = toMarkdown(setup, PAYLOAD_LINK);
189
- const fromFactory = toMarkdown(setup, createPayloadLinkTransformer());
190
- expect(fromStatic).toBe(fromFactory);
191
- expect(fromStatic).toBe('[Example](https://example.com)');
192
- });
193
- });
194
- });
195
- //# sourceMappingURL=markdownTransformer.spec.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"markdownTransformer.spec.js","names":["createHeadlessEditor","$createParagraphNode","$createTextNode","$getRoot","describe","expect","it","$convertToMarkdownString","AutoLinkNode","$createLinkNode","LinkNode","PAYLOAD_LINK","createPayloadLinkTransformer","createEditor","nodes","toMarkdown","setupFn","transformer","editor","update","discrete","markdown","getEditorState","read","link","fields","linkType","url","newTab","doc","append","toBe","markdownNull","markdownUndefined","relationTo","value","id","slug","internalDocToHref","linkNode","capturedLinkNode","title","not","toBeNull","toMatchObject","setup","fromStatic","fromFactory"],"sources":["../../../src/features/link/markdownTransformer.spec.ts"],"sourcesContent":["import { createHeadlessEditor } from '@lexical/headless'\nimport { $createParagraphNode, $createTextNode, $getRoot } from 'lexical'\nimport { describe, expect, it } from 'vitest'\n\nimport { $convertToMarkdownString } from '@lexical/markdown'\nimport { AutoLinkNode } from './nodes/AutoLinkNode.js'\nimport { $createLinkNode, LinkNode } from './nodes/LinkNode.js'\nimport type { SerializedLinkNode } from './server/schema.js'\nimport { PAYLOAD_LINK, createPayloadLinkTransformer } from './markdownTransformer.js'\n\nfunction createEditor() {\n return createHeadlessEditor({ nodes: [LinkNode, AutoLinkNode] })\n}\n\nfunction toMarkdown(setupFn: () => void, transformer = PAYLOAD_LINK): string {\n const editor = createEditor()\n editor.update(setupFn, { discrete: true })\n let markdown = ''\n editor.getEditorState().read(() => {\n markdown = $convertToMarkdownString([transformer])\n })\n return markdown\n}\n\ndescribe('createPayloadLinkTransformer', () => {\n describe('custom links', () => {\n it('should export a custom link with its url', () => {\n const markdown = toMarkdown(() => {\n const link = $createLinkNode({\n fields: { linkType: 'custom', url: 'https://payloadcms.com', newTab: false, doc: null },\n })\n link.append($createTextNode('Payload'))\n $getRoot().append($createParagraphNode().append(link))\n })\n\n expect(markdown).toBe('[Payload](https://payloadcms.com)')\n })\n\n it('should export a custom link that opens in a new tab', () => {\n // newTab is a Payload field — markdown has no equivalent, so it is intentionally dropped\n const markdown = toMarkdown(() => {\n const link = $createLinkNode({\n fields: { linkType: 'custom', url: 'https://payloadcms.com', newTab: true, doc: null },\n })\n link.append($createTextNode('Payload'))\n $getRoot().append($createParagraphNode().append(link))\n })\n\n expect(markdown).toBe('[Payload](https://payloadcms.com)')\n })\n\n it('should produce an empty href when url is null or undefined', () => {\n const markdownNull = toMarkdown(() => {\n const link = $createLinkNode({\n fields: { linkType: 'custom', url: null as unknown as string, newTab: false, doc: null },\n })\n link.append($createTextNode('Broken'))\n $getRoot().append($createParagraphNode().append(link))\n })\n\n const markdownUndefined = toMarkdown(() => {\n const link = $createLinkNode({\n fields: { linkType: 'custom', newTab: false, doc: null },\n })\n link.append($createTextNode('Broken'))\n $getRoot().append($createParagraphNode().append(link))\n })\n\n expect(markdownNull).toBe('[Broken]()')\n expect(markdownUndefined).toBe('[Broken]()')\n })\n })\n\n describe('internal links', () => {\n it('should export an empty href when no internalDocToHref is provided', () => {\n const markdown = toMarkdown(() => {\n const link = $createLinkNode({\n fields: {\n linkType: 'internal',\n doc: { relationTo: 'pages', value: { id: '1', slug: 'about' } },\n newTab: false,\n },\n })\n link.append($createTextNode('About'))\n $getRoot().append($createParagraphNode().append(link))\n })\n\n expect(markdown).toBe('[About]()')\n })\n\n it('should call internalDocToHref and use the returned url', () => {\n const transformer = createPayloadLinkTransformer({\n internalDocToHref: ({ linkNode }) => {\n const value = linkNode.fields.doc?.value\n if (value && typeof value === 'object' && 'slug' in value) {\n return `/${value.slug}`\n }\n return '/'\n },\n })\n\n const markdown = toMarkdown(() => {\n const link = $createLinkNode({\n fields: {\n linkType: 'internal',\n doc: { relationTo: 'pages', value: { id: '1', slug: 'about' } },\n newTab: false,\n },\n })\n link.append($createTextNode('About'))\n $getRoot().append($createParagraphNode().append(link))\n }, transformer)\n\n expect(markdown).toBe('[About](/about)')\n })\n\n it('should pass the full serialized link node to internalDocToHref', () => {\n let capturedLinkNode: SerializedLinkNode | null = null\n\n const transformer = createPayloadLinkTransformer({\n internalDocToHref: ({ linkNode }) => {\n capturedLinkNode = linkNode\n return '/captured'\n },\n })\n\n toMarkdown(() => {\n const link = $createLinkNode({\n fields: {\n linkType: 'internal',\n doc: { relationTo: 'pages', value: { id: '42', title: 'Home' } },\n newTab: true,\n },\n })\n link.append($createTextNode('Home'))\n $getRoot().append($createParagraphNode().append(link))\n }, transformer)\n\n expect(capturedLinkNode).not.toBeNull()\n expect(capturedLinkNode!.fields.linkType).toBe('internal')\n expect(capturedLinkNode!.fields.doc?.relationTo).toBe('pages')\n expect(capturedLinkNode!.fields.doc?.value).toMatchObject({ id: '42', title: 'Home' })\n expect(capturedLinkNode!.fields.newTab).toBe(true)\n })\n })\n\n describe('PAYLOAD_LINK (static export)', () => {\n it('should behave identically to createPayloadLinkTransformer() with no args', () => {\n const setup = () => {\n const link = $createLinkNode({\n fields: { linkType: 'custom', url: 'https://example.com', newTab: false, doc: null },\n })\n link.append($createTextNode('Example'))\n $getRoot().append($createParagraphNode().append(link))\n }\n\n const fromStatic = toMarkdown(setup, PAYLOAD_LINK)\n const fromFactory = toMarkdown(setup, createPayloadLinkTransformer())\n\n expect(fromStatic).toBe(fromFactory)\n expect(fromStatic).toBe('[Example](https://example.com)')\n })\n })\n})\n"],"mappings":"AAAA,SAASA,oBAAoB,QAAQ;AACrC,SAASC,oBAAoB,EAAEC,eAAe,EAAEC,QAAQ,QAAQ;AAChE,SAASC,QAAQ,EAAEC,MAAM,EAAEC,EAAE,QAAQ;AAErC,SAASC,wBAAwB,QAAQ;AACzC,SAASC,YAAY,QAAQ;AAC7B,SAASC,eAAe,EAAEC,QAAQ,QAAQ;AAE1C,SAASC,YAAY,EAAEC,4BAA4B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,CAAOyC,UAAA,EAAYf,IAAI,CAAC;IAC1B;EACF;AACF","ignoreList":[]}
@@ -1,88 +0,0 @@
1
- import { createHeadlessEditor } from '@lexical/headless';
2
- import { LinkNode } from '@lexical/link';
3
- import { ListItemNode, ListNode } from '@lexical/list';
4
- import { $convertToMarkdownString } from '@lexical/markdown';
5
- import { HeadingNode, QuoteNode } from '@lexical/rich-text';
6
- import { $getRoot, $isElementNode, $isLineBreakNode } from 'lexical';
7
- import { describe, expect, it } from 'vitest';
8
- import { $convertFromMarkdownString } from './convertFromMarkdownString.js';
9
- function createEditor() {
10
- return createHeadlessEditor({
11
- nodes: [HeadingNode, QuoteNode, ListNode, ListItemNode, LinkNode]
12
- });
13
- }
14
- // Payload's editor imports markdown with shouldMergeAdjacentLines = true, so the
15
- // specs exercise that path: hard line breaks must survive even when adjacent lines
16
- // are merged, while soft wraps collapse to a single space.
17
- function importMarkdown(markdown) {
18
- const editor = createEditor();
19
- editor.update(() => $convertFromMarkdownString(markdown, undefined, undefined, false, true), {
20
- discrete: true
21
- });
22
- let result = {
23
- hasLineBreak: false,
24
- textContent: ''
25
- };
26
- editor.getEditorState().read(() => {
27
- const firstChild = $getRoot().getFirstChild();
28
- if (!$isElementNode(firstChild)) {
29
- throw new Error('Expected an element block');
30
- }
31
- result = {
32
- hasLineBreak: firstChild.getChildren().some(child => $isLineBreakNode(child)),
33
- textContent: firstChild.getTextContent()
34
- };
35
- });
36
- return result;
37
- }
38
- function roundTrip(markdown) {
39
- const editor = createEditor();
40
- editor.update(() => $convertFromMarkdownString(markdown, undefined, undefined, false, true), {
41
- discrete: true
42
- });
43
- let output = '';
44
- editor.getEditorState().read(() => {
45
- output = $convertToMarkdownString();
46
- });
47
- return output;
48
- }
49
- describe('markdown hard line break import', () => {
50
- it('should import a trailing-space hard break as a line break node with the marker stripped', () => {
51
- const {
52
- hasLineBreak,
53
- textContent
54
- } = importMarkdown(['foo ', 'bar'].join('\n'));
55
- expect(hasLineBreak).toBe(true);
56
- expect(textContent).toBe('foo\nbar');
57
- });
58
- it('should import a backslash hard break as a line break node with the marker stripped', () => {
59
- const {
60
- hasLineBreak,
61
- textContent
62
- } = importMarkdown('foo\\\nbar');
63
- expect(hasLineBreak).toBe(true);
64
- expect(textContent).toBe('foo\nbar');
65
- });
66
- });
67
- describe('markdown hard line break round trip', () => {
68
- it('should round trip a trailing-space hard break', () => {
69
- const md = ['foo ', 'bar'].join('\n');
70
- expect(roundTrip(md)).toBe(md);
71
- });
72
- it('should round trip a backslash hard break', () => {
73
- const md = 'foo\\\nbar';
74
- expect(roundTrip(md)).toBe(md);
75
- });
76
- it('should not introduce a hard break for a soft wrap', () => {
77
- expect(roundTrip(['foo', 'bar'].join('\n'))).toBe('foo bar');
78
- });
79
- it('should round trip a hard break after formatted text', () => {
80
- const md = '**foo** \nbar';
81
- expect(roundTrip(md)).toBe(md);
82
- });
83
- it('should round trip a hard break after a link', () => {
84
- const md = '[foo](https://payloadcms.com) \nbar';
85
- expect(roundTrip(md)).toBe(md);
86
- });
87
- });
88
- //# sourceMappingURL=convertFromMarkdownString.spec.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"convertFromMarkdownString.spec.js","names":["createHeadlessEditor","LinkNode","ListItemNode","ListNode","$convertToMarkdownString","HeadingNode","QuoteNode","$getRoot","$isElementNode","$isLineBreakNode","describe","expect","it","$convertFromMarkdownString","createEditor","nodes","importMarkdown","markdown","editor","update","undefined","discrete","result","hasLineBreak","textContent","getEditorState","read","firstChild","getFirstChild","Error","getChildren","some","child","getTextContent","roundTrip","output","join","toBe","md"],"sources":["../../../../src/lexical/utils/markdown/convertFromMarkdownString.spec.ts"],"sourcesContent":["import { createHeadlessEditor } from '@lexical/headless'\nimport { LinkNode } from '@lexical/link'\nimport { ListItemNode, ListNode } from '@lexical/list'\nimport { $convertToMarkdownString } from '@lexical/markdown'\nimport { HeadingNode, QuoteNode } from '@lexical/rich-text'\nimport { $getRoot, $isElementNode, $isLineBreakNode } from 'lexical'\nimport { describe, expect, it } from 'vitest'\n\nimport { $convertFromMarkdownString } from './convertFromMarkdownString.js'\n\nfunction createEditor() {\n return createHeadlessEditor({\n nodes: [HeadingNode, QuoteNode, ListNode, ListItemNode, LinkNode],\n })\n}\n\n// Payload's editor imports markdown with shouldMergeAdjacentLines = true, so the\n// specs exercise that path: hard line breaks must survive even when adjacent lines\n// are merged, while soft wraps collapse to a single space.\nfunction importMarkdown(markdown: string): { hasLineBreak: boolean; textContent: string } {\n const editor = createEditor()\n editor.update(() => $convertFromMarkdownString(markdown, undefined, undefined, false, true), {\n discrete: true,\n })\n let result = { hasLineBreak: false, textContent: '' }\n editor.getEditorState().read(() => {\n const firstChild = $getRoot().getFirstChild()\n if (!$isElementNode(firstChild)) {\n throw new Error('Expected an element block')\n }\n result = {\n hasLineBreak: firstChild.getChildren().some((child) => $isLineBreakNode(child)),\n textContent: firstChild.getTextContent(),\n }\n })\n return result\n}\n\nfunction roundTrip(markdown: string): string {\n const editor = createEditor()\n editor.update(() => $convertFromMarkdownString(markdown, undefined, undefined, false, true), {\n discrete: true,\n })\n let output = ''\n editor.getEditorState().read(() => {\n output = $convertToMarkdownString()\n })\n return output\n}\n\ndescribe('markdown hard line break import', () => {\n it('should import a trailing-space hard break as a line break node with the marker stripped', () => {\n const { hasLineBreak, textContent } = importMarkdown(['foo ', 'bar'].join('\\n'))\n\n expect(hasLineBreak).toBe(true)\n expect(textContent).toBe('foo\\nbar')\n })\n\n it('should import a backslash hard break as a line break node with the marker stripped', () => {\n const { hasLineBreak, textContent } = importMarkdown('foo\\\\\\nbar')\n\n expect(hasLineBreak).toBe(true)\n expect(textContent).toBe('foo\\nbar')\n })\n})\n\ndescribe('markdown hard line break round trip', () => {\n it('should round trip a trailing-space hard break', () => {\n const md = ['foo ', 'bar'].join('\\n')\n expect(roundTrip(md)).toBe(md)\n })\n\n it('should round trip a backslash hard break', () => {\n const md = 'foo\\\\\\nbar'\n expect(roundTrip(md)).toBe(md)\n })\n\n it('should not introduce a hard break for a soft wrap', () => {\n expect(roundTrip(['foo', 'bar'].join('\\n'))).toBe('foo bar')\n })\n\n it('should round trip a hard break after formatted text', () => {\n const md = '**foo** \\nbar'\n expect(roundTrip(md)).toBe(md)\n })\n\n it('should round trip a hard break after a link', () => {\n const md = '[foo](https://payloadcms.com) \\nbar'\n expect(roundTrip(md)).toBe(md)\n })\n})\n"],"mappings":"AAAA,SAASA,oBAAoB,QAAQ;AACrC,SAASC,QAAQ,QAAQ;AACzB,SAASC,YAAY,EAAEC,QAAQ,QAAQ;AACvC,SAASC,wBAAwB,QAAQ;AACzC,SAASC,WAAW,EAAEC,SAAS,QAAQ;AACvC,SAASC,QAAQ,EAAEC,cAAc,EAAEC,gBAAgB,QAAQ;AAC3D,SAASC,QAAQ,EAAEC,MAAM,EAAEC,EAAE,QAAQ;AAErC,SAASC,0BAA0B,QAAQ;AAE3C,SAASC,aAAA;EACP,OAAOd,oBAAA,CAAqB;IAC1Be,KAAA,EAAO,CAACV,WAAA,EAAaC,SAAA,EAAWH,QAAA,EAAUD,YAAA,EAAcD,QAAA;EAC1D;AACF;AAEA;AACA;AACA;AACA,SAASe,eAAeC,QAAgB;EACtC,MAAMC,MAAA,GAASJ,YAAA;EACfI,MAAA,CAAOC,MAAM,CAAC,MAAMN,0BAAA,CAA2BI,QAAA,EAAUG,SAAA,EAAWA,SAAA,EAAW,OAAO,OAAO;IAC3FC,QAAA,EAAU;EACZ;EACA,IAAIC,MAAA,GAAS;IAAEC,YAAA,EAAc;IAAOC,WAAA,EAAa;EAAG;EACpDN,MAAA,CAAOO,cAAc,GAAGC,IAAI,CAAC;IAC3B,MAAMC,UAAA,GAAapB,QAAA,GAAWqB,aAAa;IAC3C,IAAI,CAACpB,cAAA,CAAemB,UAAA,GAAa;MAC/B,MAAM,IAAIE,KAAA,CAAM;IAClB;IACAP,MAAA,GAAS;MACPC,YAAA,EAAcI,UAAA,CAAWG,WAAW,GAAGC,IAAI,CAAEC,KAAA,IAAUvB,gBAAA,CAA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,CAAOuB,SAAA,CAAU,CAAC,OAAO,MAAM,CAACE,IAAI,CAAC,QAAQC,IAAI,CAAC;EACpD;EAEAzB,EAAA,CAAG,uDAAuD;IACxD,MAAM0B,EAAA,GAAK;IACX3B,MAAA,CAAOuB,SAAA,CAAUI,EAAA,GAAKD,IAAI,CAACC,EAAA;EAC7B;EAEA1B,EAAA,CAAG,+CAA+C;IAChD,MAAM0B,EAAA,GAAK;IACX3B,MAAA,CAAOuB,SAAA,CAAUI,EAAA,GAAKD,IAAI,CAACC,EAAA;EAC7B;AACF","ignoreList":[]}
@@ -1,114 +0,0 @@
1
- import { describe, it, expect } from 'vitest';
2
- import { absoluteRegExp, relativeOrAnchorRegExp, validateUrl } from './url.js';
3
- describe('Lexical URL Regex Matchers', () => {
4
- describe('relativeOrAnchorRegExp', () => {
5
- it('validation for links it should match', async () => {
6
- const shouldMatch = ['/path/to/resource', '/file-name.html', '/', '/dir/', '/path.with.dots/', '#anchor', '#section-title', '/path#fragment', '/page?id=123', '/page?id=123#section', '/search?q=test', '/?global=true'];
7
- shouldMatch.forEach(testCase => {
8
- expect(relativeOrAnchorRegExp.test(testCase)).toBe(true);
9
- });
10
- });
11
- it('validation for links it should not match', async () => {
12
- const shouldNotMatch = ['match', 'http://example.com', 'relative/path', 'file.html', 'some#fragment', '#', '/#', '/path/with spaces', '', 'ftp://example.com'];
13
- shouldNotMatch.forEach(testCase => {
14
- expect(relativeOrAnchorRegExp.test(testCase)).not.toBe(true);
15
- });
16
- });
17
- });
18
- describe('absoluteRegExp', () => {
19
- it('validation for links it should match', async () => {
20
- const shouldMatch = ['http://example.com', 'https://example.com', 'ftp://files.example.com', 'http://example.com/resource', 'https://example.com/resource?key=value', 'http://example.com/resource#anchor', 'http://www.example.com', 'https://sub.example.com/path/file', 'mailto:email@example.com', 'tel:+1234567890', 'http://user:pass@example.com', 'www.example.com', 'www.example.com/resource', 'www.example.com/resource?query=1', 'www.example.com#fragment'];
21
- shouldMatch.forEach(testCase => {
22
- expect(absoluteRegExp.test(testCase)).toBe(true);
23
- });
24
- });
25
- it('validation for links it should not match', async () => {
26
- const shouldNotMatch = ['/relative/path', '#anchor', 'example.com', '://missing.scheme', 'http://', 'http:/example.com', 'ftp://example .com', 'http://example', 'not-a-url', 'http//example.com', 'https://example.com/ spaces'];
27
- shouldNotMatch.forEach(testCase => {
28
- expect(absoluteRegExp.test(testCase)).not.toBe(true);
29
- });
30
- });
31
- });
32
- describe('validateUrl', () => {
33
- describe('absolute URLs', () => {
34
- it('should validate http and https URLs', () => {
35
- const validUrls = ['http://example.com', 'https://example.com', 'http://www.example.com', 'https://sub.example.com/path/file', 'http://example.com/resource', 'https://example.com/resource?key=value', 'http://example.com/resource#anchor'];
36
- validUrls.forEach(url => {
37
- expect(validateUrl(url)).toBe(true);
38
- });
39
- });
40
- it('should validate other protocol URLs', () => {
41
- const validUrls = ['ftp://files.example.com', 'mailto:email@example.com', 'tel:+1234567890'];
42
- validUrls.forEach(url => {
43
- expect(validateUrl(url)).toBe(true);
44
- });
45
- });
46
- it('should validate www URLs without protocol', () => {
47
- const validUrls = ['www.example.com', 'www.example.com/resource', 'www.example.com/resource?query=1', 'www.example.com#fragment'];
48
- validUrls.forEach(url => {
49
- expect(validateUrl(url)).toBe(true);
50
- });
51
- });
52
- });
53
- describe('relative URLs', () => {
54
- it('should validate relative paths', () => {
55
- const validUrls = ['/path/to/resource', '/file-name.html', '/', '/dir/', '/path.with.dots/', '/path#fragment'];
56
- validUrls.forEach(url => {
57
- expect(validateUrl(url)).toBe(true);
58
- });
59
- });
60
- });
61
- describe('anchor links', () => {
62
- it('should validate anchor links', () => {
63
- const validUrls = ['#anchor', '#section-title'];
64
- validUrls.forEach(url => {
65
- expect(validateUrl(url)).toBe(true);
66
- });
67
- });
68
- });
69
- describe('with query params', () => {
70
- it('should validate relative URLs with query parameters', () => {
71
- const validUrls = ['/page?id=123', '/search?q=test', '/products?category=electronics&sort=price', '/path?key=value&another=param', '/page?id=123&filter=active', '/?global=true'];
72
- validUrls.forEach(url => {
73
- expect(validateUrl(url)).toBe(true);
74
- });
75
- });
76
- it('should validate absolute URLs with query parameters', () => {
77
- const validUrls = ['https://example.com?id=123', 'http://example.com/page?key=value', 'www.example.com?search=query', 'https://example.com/path?a=1&b=2&c=3'];
78
- validUrls.forEach(url => {
79
- expect(validateUrl(url)).toBe(true);
80
- });
81
- });
82
- it('should validate URLs with query parameters and anchors', () => {
83
- const validUrls = ['/page?id=123#section', 'https://example.com?key=value#anchor', '/search?q=test#results'];
84
- validUrls.forEach(url => {
85
- expect(validateUrl(url)).toBe(true);
86
- });
87
- });
88
- });
89
- describe('edge cases', () => {
90
- it('should handle the default https:// case', () => {
91
- expect(validateUrl('https://')).toBe(true);
92
- });
93
- it('should return false for empty or invalid URLs', () => {
94
- const invalidUrls = ['', 'not-a-url', 'example.com', 'relative/path', 'file.html', 'some#fragment', 'http://', 'http:/example.com', 'http//example.com'];
95
- invalidUrls.forEach(url => {
96
- expect(validateUrl(url)).toBe(false);
97
- });
98
- });
99
- it('should return false for URLs with spaces', () => {
100
- const invalidUrls = ['/path/with spaces', 'http://example.com/ spaces', 'https://example.com/path with spaces'];
101
- invalidUrls.forEach(url => {
102
- expect(validateUrl(url)).toBe(false);
103
- });
104
- });
105
- it('should return false for malformed URLs', () => {
106
- const invalidUrls = ['://missing.scheme', 'ftp://example .com', 'http://example', '#', '/#'];
107
- invalidUrls.forEach(url => {
108
- expect(validateUrl(url)).toBe(false);
109
- });
110
- });
111
- });
112
- });
113
- });
114
- //# sourceMappingURL=url.spec.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"url.spec.js","names":["describe","it","expect","absoluteRegExp","relativeOrAnchorRegExp","validateUrl","shouldMatch","forEach","testCase","test","toBe","shouldNotMatch","not","validUrls","url","invalidUrls"],"sources":["../../../src/lexical/utils/url.spec.ts"],"sourcesContent":["import { describe, it, expect } from 'vitest'\nimport { absoluteRegExp, relativeOrAnchorRegExp, validateUrl } from './url.js'\n\ndescribe('Lexical URL Regex Matchers', () => {\n describe('relativeOrAnchorRegExp', () => {\n it('validation for links it should match', async () => {\n const shouldMatch = [\n '/path/to/resource',\n '/file-name.html',\n '/',\n '/dir/',\n '/path.with.dots/',\n '#anchor',\n '#section-title',\n '/path#fragment',\n '/page?id=123',\n '/page?id=123#section',\n '/search?q=test',\n '/?global=true',\n ]\n\n shouldMatch.forEach((testCase) => {\n expect(relativeOrAnchorRegExp.test(testCase)).toBe(true)\n })\n })\n\n it('validation for links it should not match', async () => {\n const shouldNotMatch = [\n 'match',\n 'http://example.com',\n 'relative/path',\n 'file.html',\n 'some#fragment',\n '#',\n '/#',\n '/path/with spaces',\n '',\n 'ftp://example.com',\n ]\n\n shouldNotMatch.forEach((testCase) => {\n expect(relativeOrAnchorRegExp.test(testCase)).not.toBe(true)\n })\n })\n })\n\n describe('absoluteRegExp', () => {\n it('validation for links it should match', async () => {\n const shouldMatch = [\n 'http://example.com',\n 'https://example.com',\n 'ftp://files.example.com',\n 'http://example.com/resource',\n 'https://example.com/resource?key=value',\n 'http://example.com/resource#anchor',\n 'http://www.example.com',\n 'https://sub.example.com/path/file',\n 'mailto:email@example.com',\n 'tel:+1234567890',\n 'http://user:pass@example.com',\n 'www.example.com',\n 'www.example.com/resource',\n 'www.example.com/resource?query=1',\n 'www.example.com#fragment',\n ]\n\n shouldMatch.forEach((testCase) => {\n expect(absoluteRegExp.test(testCase)).toBe(true)\n })\n })\n\n it('validation for links it should not match', async () => {\n const shouldNotMatch = [\n '/relative/path',\n '#anchor',\n 'example.com',\n '://missing.scheme',\n 'http://',\n 'http:/example.com',\n 'ftp://example .com',\n 'http://example',\n 'not-a-url',\n 'http//example.com',\n 'https://example.com/ spaces',\n ]\n\n shouldNotMatch.forEach((testCase) => {\n expect(absoluteRegExp.test(testCase)).not.toBe(true)\n })\n })\n })\n\n describe('validateUrl', () => {\n describe('absolute URLs', () => {\n it('should validate http and https URLs', () => {\n const validUrls = [\n 'http://example.com',\n 'https://example.com',\n 'http://www.example.com',\n 'https://sub.example.com/path/file',\n 'http://example.com/resource',\n 'https://example.com/resource?key=value',\n 'http://example.com/resource#anchor',\n ]\n\n validUrls.forEach((url) => {\n expect(validateUrl(url)).toBe(true)\n })\n })\n\n it('should validate other protocol URLs', () => {\n const validUrls = ['ftp://files.example.com', 'mailto:email@example.com', 'tel:+1234567890']\n\n validUrls.forEach((url) => {\n expect(validateUrl(url)).toBe(true)\n })\n })\n\n it('should validate www URLs without protocol', () => {\n const validUrls = [\n 'www.example.com',\n 'www.example.com/resource',\n 'www.example.com/resource?query=1',\n 'www.example.com#fragment',\n ]\n\n validUrls.forEach((url) => {\n expect(validateUrl(url)).toBe(true)\n })\n })\n })\n\n describe('relative URLs', () => {\n it('should validate relative paths', () => {\n const validUrls = [\n '/path/to/resource',\n '/file-name.html',\n '/',\n '/dir/',\n '/path.with.dots/',\n '/path#fragment',\n ]\n\n validUrls.forEach((url) => {\n expect(validateUrl(url)).toBe(true)\n })\n })\n })\n\n describe('anchor links', () => {\n it('should validate anchor links', () => {\n const validUrls = ['#anchor', '#section-title']\n\n validUrls.forEach((url) => {\n expect(validateUrl(url)).toBe(true)\n })\n })\n })\n\n describe('with query params', () => {\n it('should validate relative URLs with query parameters', () => {\n const validUrls = [\n '/page?id=123',\n '/search?q=test',\n '/products?category=electronics&sort=price',\n '/path?key=value&another=param',\n '/page?id=123&filter=active',\n '/?global=true',\n ]\n\n validUrls.forEach((url) => {\n expect(validateUrl(url)).toBe(true)\n })\n })\n\n it('should validate absolute URLs with query parameters', () => {\n const validUrls = [\n 'https://example.com?id=123',\n 'http://example.com/page?key=value',\n 'www.example.com?search=query',\n 'https://example.com/path?a=1&b=2&c=3',\n ]\n\n validUrls.forEach((url) => {\n expect(validateUrl(url)).toBe(true)\n })\n })\n\n it('should validate URLs with query parameters and anchors', () => {\n const validUrls = [\n '/page?id=123#section',\n 'https://example.com?key=value#anchor',\n '/search?q=test#results',\n ]\n\n validUrls.forEach((url) => {\n expect(validateUrl(url)).toBe(true)\n })\n })\n })\n\n describe('edge cases', () => {\n it('should handle the default https:// case', () => {\n expect(validateUrl('https://')).toBe(true)\n })\n\n it('should return false for empty or invalid URLs', () => {\n const invalidUrls = [\n '',\n 'not-a-url',\n 'example.com',\n 'relative/path',\n 'file.html',\n 'some#fragment',\n 'http://',\n 'http:/example.com',\n 'http//example.com',\n ]\n\n invalidUrls.forEach((url) => {\n expect(validateUrl(url)).toBe(false)\n })\n })\n\n it('should return false for URLs with spaces', () => {\n const invalidUrls = [\n '/path/with spaces',\n 'http://example.com/ spaces',\n 'https://example.com/path with spaces',\n ]\n\n invalidUrls.forEach((url) => {\n expect(validateUrl(url)).toBe(false)\n })\n })\n\n it('should return false for malformed URLs', () => {\n const invalidUrls = ['://missing.scheme', 'ftp://example .com', 'http://example', '#', '/#']\n\n invalidUrls.forEach((url) => {\n expect(validateUrl(url)).toBe(false)\n })\n })\n })\n })\n})\n"],"mappings":"AAAA,SAASA,QAAQ,EAAEC,EAAE,EAAEC,MAAM,QAAQ;AACrC,SAASC,cAAc,EAAEC,sBAAsB,EAAEC,WAAW,QAAQ;AAEpEL,QAAA,CAAS,8BAA8B;EACrCA,QAAA,CAAS,0BAA0B;IACjCC,EAAA,CAAG,wCAAwC;MACzC,MAAMK,WAAA,GAAc,CAClB,qBACA,mBACA,KACA,SACA,oBACA,WACA,kBACA,kBACA,gBACA,wBACA,kBACA,gBACD;MAEDA,WAAA,CAAYC,OAAO,CAAEC,QAAA;QACnBN,MAAA,CAAOE,sBAAA,CAAuBK,IAAI,CAACD,QAAA,GAAWE,IAAI,CAAC;MACrD;IACF;IAEAT,EAAA,CAAG,4CAA4C;MAC7C,MAAMU,cAAA,GAAiB,CACrB,SACA,sBACA,iBACA,aACA,iBACA,KACA,MACA,qBACA,IACA,oBACD;MAEDA,cAAA,CAAeJ,OAAO,CAAEC,QAAA;QACtBN,MAAA,CAAOE,sBAAA,CAAuBK,IAAI,CAACD,QAAA,GAAWI,GAAG,CAACF,IAAI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