@payloadcms/richtext-lexical 4.0.0-internal.5f0cd13 → 4.0.0-internal.656159a

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 (450) hide show
  1. package/LICENSE.md +1 -1
  2. package/dist/cell/rscEntry.d.ts.map +1 -1
  3. package/dist/cell/rscEntry.js +5 -5
  4. package/dist/cell/rscEntry.js.map +1 -1
  5. package/dist/exports/client/Field-QGSHF22S.js +2 -0
  6. package/dist/exports/client/Field-QGSHF22S.js.map +7 -0
  7. package/dist/exports/client/bundled.css +1 -1
  8. package/dist/exports/client/chunk-5VIL27GI.js +2 -0
  9. package/dist/exports/client/chunk-5VIL27GI.js.map +7 -0
  10. package/dist/exports/client/chunk-ESITTE3C.js +2 -0
  11. package/dist/exports/client/chunk-ESITTE3C.js.map +7 -0
  12. package/dist/exports/client/chunk-UD4DQ4AK.js +2 -0
  13. package/dist/exports/client/chunk-UD4DQ4AK.js.map +7 -0
  14. package/dist/exports/client/chunk-X3D4LZS7.js +2 -0
  15. package/dist/exports/client/chunk-X3D4LZS7.js.map +7 -0
  16. package/dist/exports/client/{component-HKTAZ77E.js → component-PHZQBOJE.js} +2 -2
  17. package/dist/exports/client/componentInline-H24N7GUG.js +2 -0
  18. package/dist/exports/client/index.d.ts +0 -1
  19. package/dist/exports/client/index.d.ts.map +1 -1
  20. package/dist/exports/client/index.js +20 -21
  21. package/dist/exports/client/index.js.map +4 -4
  22. package/dist/features/align/client/toolbarAlignGroup.d.ts.map +1 -1
  23. package/dist/features/blockquote/client/index.js +2 -2
  24. package/dist/features/blockquote/client/index.js.map +1 -1
  25. package/dist/features/blockquote/server/index.js +2 -2
  26. package/dist/features/blockquote/server/index.js.map +1 -1
  27. package/dist/features/blocks/client/component/index.css +2 -2
  28. package/dist/features/blocks/client/component/index.d.ts +1 -0
  29. package/dist/features/blocks/client/component/index.d.ts.map +1 -1
  30. package/dist/features/blocks/client/component/index.js +16 -8
  31. package/dist/features/blocks/client/component/index.js.map +1 -1
  32. package/dist/features/blocks/client/componentInline/components/InlineBlockContainer.d.ts.map +1 -1
  33. package/dist/features/blocks/client/componentInline/index.css +8 -8
  34. package/dist/features/blocks/client/componentInline/index.d.ts +1 -0
  35. package/dist/features/blocks/client/componentInline/index.d.ts.map +1 -1
  36. package/dist/features/blocks/client/componentInline/index.js +15 -7
  37. package/dist/features/blocks/client/componentInline/index.js.map +1 -1
  38. package/dist/features/blocks/client/getBlockImageComponent.d.ts +1 -1
  39. package/dist/features/blocks/client/index.d.ts.map +1 -1
  40. package/dist/features/blocks/client/index.js +4 -2
  41. package/dist/features/blocks/client/index.js.map +1 -1
  42. package/dist/features/blocks/client/markdown/getLexicalToMarkdown.d.ts +1 -1
  43. package/dist/features/blocks/client/markdown/getLexicalToMarkdown.d.ts.map +1 -1
  44. package/dist/features/blocks/client/markdown/getLexicalToMarkdown.js +1 -1
  45. package/dist/features/blocks/client/markdown/getLexicalToMarkdown.js.map +1 -1
  46. package/dist/features/blocks/client/markdown/getMarkdownToLexical.d.ts +1 -1
  47. package/dist/features/blocks/client/markdown/getMarkdownToLexical.d.ts.map +1 -1
  48. package/dist/features/blocks/client/markdown/getMarkdownToLexical.js +5 -2
  49. package/dist/features/blocks/client/markdown/getMarkdownToLexical.js.map +1 -1
  50. package/dist/features/blocks/client/markdown/markdownTransformer.d.ts +1 -2
  51. package/dist/features/blocks/client/markdown/markdownTransformer.d.ts.map +1 -1
  52. package/dist/features/blocks/client/markdown/markdownTransformer.js.map +1 -1
  53. package/dist/features/blocks/client/nodes/BlocksNode.d.ts.map +1 -1
  54. package/dist/features/blocks/client/nodes/InlineBlocksNode.d.ts.map +1 -1
  55. package/dist/features/blocks/premade/CodeBlock/Component/Block.d.ts.map +1 -1
  56. package/dist/features/blocks/premade/CodeBlock/Component/Block.js +1 -0
  57. package/dist/features/blocks/premade/CodeBlock/Component/Block.js.map +1 -1
  58. package/dist/features/blocks/premade/CodeBlock/Component/Collapse/index.css +1 -1
  59. package/dist/features/blocks/premade/CodeBlock/Component/FloatingCollapse/index.css +2 -4
  60. package/dist/features/blocks/premade/CodeBlock/Component/index.css +5 -5
  61. package/dist/features/blocks/server/graphQLPopulationPromise.d.ts.map +1 -1
  62. package/dist/features/blocks/server/index.d.ts.map +1 -1
  63. package/dist/features/blocks/server/index.js +6 -8
  64. package/dist/features/blocks/server/index.js.map +1 -1
  65. package/dist/features/blocks/server/markdown/markdownTransformer.d.ts +1 -1
  66. package/dist/features/blocks/server/markdown/markdownTransformer.d.ts.map +1 -1
  67. package/dist/features/blocks/server/markdown/markdownTransformer.js.map +1 -1
  68. package/dist/features/blocks/server/nodes/BlocksNode.d.ts.map +1 -1
  69. package/dist/features/blocks/server/nodes/InlineBlocksNode.d.ts.map +1 -1
  70. package/dist/features/blocks/server/schema.d.ts +5 -5
  71. package/dist/features/blocks/server/schema.d.ts.map +1 -1
  72. package/dist/features/blocks/server/schema.js +28 -24
  73. package/dist/features/blocks/server/schema.js.map +1 -1
  74. package/dist/features/blocks/server/validate.d.ts.map +1 -1
  75. package/dist/features/converters/htmlToLexical/index.d.ts.map +1 -1
  76. package/dist/features/converters/lexicalToHtml/async/types.d.ts +13 -15
  77. package/dist/features/converters/lexicalToHtml/async/types.d.ts.map +1 -1
  78. package/dist/features/converters/lexicalToHtml/async/types.js.map +1 -1
  79. package/dist/features/converters/lexicalToHtml/shared/cssColors.d.ts.map +1 -1
  80. package/dist/features/converters/lexicalToHtml/sync/types.d.ts +13 -15
  81. package/dist/features/converters/lexicalToHtml/sync/types.d.ts.map +1 -1
  82. package/dist/features/converters/lexicalToHtml/sync/types.js.map +1 -1
  83. package/dist/features/converters/lexicalToJSX/Component/index.d.ts +2 -2
  84. package/dist/features/converters/lexicalToJSX/Component/index.d.ts.map +1 -1
  85. package/dist/features/converters/lexicalToJSX/Component/index.js +5 -4
  86. package/dist/features/converters/lexicalToJSX/Component/index.js.map +1 -1
  87. package/dist/features/converters/lexicalToJSX/converter/types.d.ts +12 -14
  88. package/dist/features/converters/lexicalToJSX/converter/types.d.ts.map +1 -1
  89. package/dist/features/converters/lexicalToJSX/converter/types.js.map +1 -1
  90. package/dist/features/converters/lexicalToMarkdown/index.d.ts.map +1 -1
  91. package/dist/features/converters/lexicalToMarkdown/index.js +1 -1
  92. package/dist/features/converters/lexicalToMarkdown/index.js.map +1 -1
  93. package/dist/features/converters/lexicalToPlaintext/sync/types.d.ts +12 -14
  94. package/dist/features/converters/lexicalToPlaintext/sync/types.d.ts.map +1 -1
  95. package/dist/features/converters/lexicalToPlaintext/sync/types.js.map +1 -1
  96. package/dist/features/converters/markdownToLexical/index.d.ts.map +1 -1
  97. package/dist/features/converters/markdownToLexical/index.js +5 -2
  98. package/dist/features/converters/markdownToLexical/index.js.map +1 -1
  99. package/dist/features/debug/jsxConverter/client/plugin/style.css +2 -2
  100. package/dist/features/experimental_table/client/index.js +2 -2
  101. package/dist/features/experimental_table/client/index.js.map +1 -1
  102. package/dist/features/experimental_table/client/utils/debounce.d.ts.map +1 -1
  103. package/dist/features/experimental_table/markdownTransformer.d.ts +2 -2
  104. package/dist/features/experimental_table/markdownTransformer.d.ts.map +1 -1
  105. package/dist/features/experimental_table/markdownTransformer.js +6 -3
  106. package/dist/features/experimental_table/markdownTransformer.js.map +1 -1
  107. package/dist/features/experimental_table/server/index.js +2 -2
  108. package/dist/features/experimental_table/server/index.js.map +1 -1
  109. package/dist/features/experimental_table/server/schema.d.ts.map +1 -1
  110. package/dist/features/experimental_table/server/schema.js +6 -3
  111. package/dist/features/experimental_table/server/schema.js.map +1 -1
  112. package/dist/features/format/bold/feature.client.js +1 -1
  113. package/dist/features/format/bold/feature.client.js.map +1 -1
  114. package/dist/features/format/bold/feature.server.d.ts.map +1 -1
  115. package/dist/features/format/bold/feature.server.js +1 -1
  116. package/dist/features/format/bold/feature.server.js.map +1 -1
  117. package/dist/features/format/inlineCode/feature.client.js +1 -1
  118. package/dist/features/format/inlineCode/feature.client.js.map +1 -1
  119. package/dist/features/format/inlineCode/feature.server.d.ts.map +1 -1
  120. package/dist/features/format/inlineCode/feature.server.js +1 -1
  121. package/dist/features/format/inlineCode/feature.server.js.map +1 -1
  122. package/dist/features/format/italic/feature.client.js +1 -1
  123. package/dist/features/format/italic/feature.client.js.map +1 -1
  124. package/dist/features/format/italic/feature.server.d.ts.map +1 -1
  125. package/dist/features/format/italic/feature.server.js +1 -1
  126. package/dist/features/format/italic/feature.server.js.map +1 -1
  127. package/dist/features/format/shared/toolbarFormatGroup.d.ts.map +1 -1
  128. package/dist/features/format/strikethrough/feature.client.js +1 -1
  129. package/dist/features/format/strikethrough/feature.client.js.map +1 -1
  130. package/dist/features/format/strikethrough/feature.server.d.ts.map +1 -1
  131. package/dist/features/format/strikethrough/feature.server.js +1 -1
  132. package/dist/features/format/strikethrough/feature.server.js.map +1 -1
  133. package/dist/features/heading/client/index.js +2 -2
  134. package/dist/features/heading/client/index.js.map +1 -1
  135. package/dist/features/heading/markdownTransformer.d.ts +2 -2
  136. package/dist/features/heading/markdownTransformer.d.ts.map +1 -1
  137. package/dist/features/heading/markdownTransformer.js +6 -19
  138. package/dist/features/heading/markdownTransformer.js.map +1 -1
  139. package/dist/features/heading/server/index.js +2 -2
  140. package/dist/features/heading/server/index.js.map +1 -1
  141. package/dist/features/heading/server/schema.d.ts.map +1 -1
  142. package/dist/features/horizontalRule/client/index.js +2 -2
  143. package/dist/features/horizontalRule/client/index.js.map +1 -1
  144. package/dist/features/horizontalRule/client/markdownTransformer.d.ts +2 -2
  145. package/dist/features/horizontalRule/client/markdownTransformer.d.ts.map +1 -1
  146. package/dist/features/horizontalRule/client/markdownTransformer.js +1 -1
  147. package/dist/features/horizontalRule/client/markdownTransformer.js.map +1 -1
  148. package/dist/features/horizontalRule/client/nodes/HorizontalRuleNode.d.ts.map +1 -1
  149. package/dist/features/horizontalRule/client/plugin/index.css +2 -2
  150. package/dist/features/horizontalRule/server/index.js +2 -2
  151. package/dist/features/horizontalRule/server/index.js.map +1 -1
  152. package/dist/features/horizontalRule/server/markdownTransformer.d.ts +2 -2
  153. package/dist/features/horizontalRule/server/markdownTransformer.d.ts.map +1 -1
  154. package/dist/features/horizontalRule/server/markdownTransformer.js +1 -1
  155. package/dist/features/horizontalRule/server/markdownTransformer.js.map +1 -1
  156. package/dist/features/horizontalRule/server/nodes/HorizontalRuleNode.d.ts.map +1 -1
  157. package/dist/features/indent/client/toolbarIndentGroup.d.ts.map +1 -1
  158. package/dist/features/link/client/index.js +2 -2
  159. package/dist/features/link/client/index.js.map +1 -1
  160. package/dist/features/link/client/plugins/autoLink/index.d.ts.map +1 -1
  161. package/dist/features/link/client/plugins/floatingLinkEditor/LinkEditor/index.js +3 -3
  162. package/dist/features/link/client/plugins/floatingLinkEditor/LinkEditor/index.js.map +1 -1
  163. package/dist/features/link/client/plugins/floatingLinkEditor/index.css +7 -11
  164. package/dist/features/link/markdownTransformer.d.ts +4 -4
  165. package/dist/features/link/markdownTransformer.d.ts.map +1 -1
  166. package/dist/features/link/markdownTransformer.js +2 -2
  167. package/dist/features/link/markdownTransformer.js.map +1 -1
  168. package/dist/features/link/markdownTransformer.spec.js +10 -10
  169. package/dist/features/link/markdownTransformer.spec.js.map +1 -1
  170. package/dist/features/link/nodes/AutoLinkNode.d.ts.map +1 -1
  171. package/dist/features/link/nodes/LinkNode.d.ts.map +1 -1
  172. package/dist/features/link/server/baseFields.d.ts.map +1 -1
  173. package/dist/features/link/server/baseFields.js.map +1 -1
  174. package/dist/features/link/server/graphQLPopulationPromise.d.ts.map +1 -1
  175. package/dist/features/link/server/index.js +2 -2
  176. package/dist/features/link/server/index.js.map +1 -1
  177. package/dist/features/link/server/schema.d.ts.map +1 -1
  178. package/dist/features/link/server/schema.js +14 -9
  179. package/dist/features/link/server/schema.js.map +1 -1
  180. package/dist/features/link/server/validate.d.ts.map +1 -1
  181. package/dist/features/lists/checklist/client/index.js +1 -1
  182. package/dist/features/lists/checklist/client/index.js.map +1 -1
  183. package/dist/features/lists/checklist/server/index.js +1 -1
  184. package/dist/features/lists/checklist/server/index.js.map +1 -1
  185. package/dist/features/lists/orderedList/client/index.js +1 -1
  186. package/dist/features/lists/orderedList/client/index.js.map +1 -1
  187. package/dist/features/lists/orderedList/server/index.js +1 -1
  188. package/dist/features/lists/orderedList/server/index.js.map +1 -1
  189. package/dist/features/lists/unorderedList/client/index.js +1 -1
  190. package/dist/features/lists/unorderedList/client/index.js.map +1 -1
  191. package/dist/features/lists/unorderedList/server/index.js +1 -1
  192. package/dist/features/lists/unorderedList/server/index.js.map +1 -1
  193. package/dist/features/relationship/client/drawer/index.d.ts.map +1 -1
  194. package/dist/features/relationship/client/nodes/RelationshipNode.d.ts.map +1 -1
  195. package/dist/features/relationship/client/utils/useEnabledRelationships.d.ts.map +1 -1
  196. package/dist/features/relationship/server/graphQLPopulationPromise.d.ts.map +1 -1
  197. package/dist/features/relationship/server/nodes/RelationshipNode.d.ts.map +1 -1
  198. package/dist/features/relationship/server/schema.d.ts +3 -3
  199. package/dist/features/relationship/server/schema.d.ts.map +1 -1
  200. package/dist/features/relationship/server/schema.js +27 -13
  201. package/dist/features/relationship/server/schema.js.map +1 -1
  202. package/dist/features/relationship/shared/filterEnabledRelationshipCollections.d.ts.map +1 -1
  203. package/dist/features/shared/toolbar/addDropdownGroup.d.ts.map +1 -1
  204. package/dist/features/shared/toolbar/featureButtonsGroup.d.ts.map +1 -1
  205. package/dist/features/shared/toolbar/textDropdownGroup.d.ts.map +1 -1
  206. package/dist/features/textState/feature.client.js +1 -1
  207. package/dist/features/textState/feature.client.js.map +1 -1
  208. package/dist/features/toolbars/fixed/client/Toolbar/index.css +2 -2
  209. package/dist/features/toolbars/inline/client/Toolbar/index.css +2 -13
  210. package/dist/features/toolbars/shared/ToolbarButton/index.d.ts.map +1 -1
  211. package/dist/features/toolbars/shared/ToolbarDropdown/index.css +8 -12
  212. package/dist/features/toolbars/shared/ToolbarDropdown/index.d.ts.map +1 -1
  213. package/dist/features/toolbars/shared/ToolbarDropdown/index.js.map +1 -1
  214. package/dist/features/toolbars/shared/useToolbarStates.d.ts.map +1 -1
  215. package/dist/features/toolbars/shared/useToolbarStates.js +3 -1
  216. package/dist/features/toolbars/shared/useToolbarStates.js.map +1 -1
  217. package/dist/features/typesClient.d.ts +1 -1
  218. package/dist/features/typesClient.d.ts.map +1 -1
  219. package/dist/features/typesClient.js.map +1 -1
  220. package/dist/features/typesServer.d.ts +2 -2
  221. package/dist/features/typesServer.d.ts.map +1 -1
  222. package/dist/features/typesServer.js.map +1 -1
  223. package/dist/features/upload/client/component/index.css +11 -11
  224. package/dist/features/upload/client/drawer/index.d.ts.map +1 -1
  225. package/dist/features/upload/client/nodes/UploadNode.d.ts.map +1 -1
  226. package/dist/features/upload/client/plugin/index.js +5 -5
  227. package/dist/features/upload/client/plugin/index.js.map +1 -1
  228. package/dist/features/upload/server/graphQLPopulationPromise.d.ts.map +1 -1
  229. package/dist/features/upload/server/index.js +2 -2
  230. package/dist/features/upload/server/index.js.map +1 -1
  231. package/dist/features/upload/server/markdownTransformer.d.ts +2 -2
  232. package/dist/features/upload/server/markdownTransformer.d.ts.map +1 -1
  233. package/dist/features/upload/server/markdownTransformer.js +1 -1
  234. package/dist/features/upload/server/markdownTransformer.js.map +1 -1
  235. package/dist/features/upload/server/nodes/UploadNode.d.ts.map +1 -1
  236. package/dist/features/upload/server/schema.d.ts +8 -8
  237. package/dist/features/upload/server/schema.d.ts.map +1 -1
  238. package/dist/features/upload/server/schema.js +59 -23
  239. package/dist/features/upload/server/schema.js.map +1 -1
  240. package/dist/features/upload/server/validate.d.ts.map +1 -1
  241. package/dist/field/Diff/converters/unknown/index.css +1 -1
  242. package/dist/field/Field.d.ts.map +1 -1
  243. package/dist/field/Field.js +18 -15
  244. package/dist/field/Field.js.map +1 -1
  245. package/dist/field/ViewSelector.css +1 -1
  246. package/dist/field/bundled.css +1 -1
  247. package/dist/field/index.css +5 -5
  248. package/dist/field/index.js +1 -1
  249. package/dist/field/index.js.map +1 -1
  250. package/dist/field/rscEntry.d.ts.map +1 -1
  251. package/dist/field/rscEntry.js +2 -0
  252. package/dist/field/rscEntry.js.map +1 -1
  253. package/dist/index.d.ts +2 -2
  254. package/dist/index.d.ts.map +1 -1
  255. package/dist/index.js +3 -3
  256. package/dist/index.js.map +1 -1
  257. package/dist/lexical/LexicalEditor.css +4 -2
  258. package/dist/lexical/config/client/EditorConfigProvider.d.ts.map +1 -1
  259. package/dist/lexical/config/client/loader.d.ts.map +1 -1
  260. package/dist/lexical/config/client/loader.js +5 -1
  261. package/dist/lexical/config/client/loader.js.map +1 -1
  262. package/dist/lexical/config/client/sanitize.d.ts.map +1 -1
  263. package/dist/lexical/config/server/sanitize.d.ts.map +1 -1
  264. package/dist/lexical/plugins/DecoratorPlugin/index.css +1 -1
  265. package/dist/lexical/plugins/DecoratorPlugin/index.js.map +1 -1
  266. package/dist/lexical/plugins/MarkdownShortcut/index.d.ts.map +1 -1
  267. package/dist/lexical/plugins/MarkdownShortcut/index.js +1 -1
  268. package/dist/lexical/plugins/MarkdownShortcut/index.js.map +1 -1
  269. package/dist/lexical/plugins/NodeViewOverridePlugin/index.d.ts.map +1 -1
  270. package/dist/lexical/plugins/NodeViewOverridePlugin/index.js +21 -0
  271. package/dist/lexical/plugins/NodeViewOverridePlugin/index.js.map +1 -1
  272. package/dist/lexical/plugins/SlashMenu/index.css +1 -5
  273. package/dist/lexical/plugins/handles/AddBlockHandlePlugin/index.css +1 -1
  274. package/dist/lexical/plugins/handles/DraggableBlockPlugin/debounce.d.ts.map +1 -1
  275. package/dist/lexical/plugins/handles/DraggableBlockPlugin/index.css +4 -3
  276. package/dist/lexical/plugins/handles/DraggableBlockPlugin/index.js +1 -1
  277. package/dist/lexical/plugins/handles/DraggableBlockPlugin/index.js.map +1 -1
  278. package/dist/lexical/plugins/handles/utils/calculateDistanceFromScrollerElem.d.ts.map +1 -1
  279. package/dist/lexical/theme/EditorTheme.css +18 -19
  280. package/dist/lexical/ui/ContentEditable.css +9 -5
  281. package/dist/lexical/utils/markdown/convertFromMarkdownString.d.ts +17 -0
  282. package/dist/lexical/utils/markdown/convertFromMarkdownString.d.ts.map +1 -0
  283. package/dist/lexical/utils/markdown/convertFromMarkdownString.js +27 -0
  284. package/dist/lexical/utils/markdown/convertFromMarkdownString.js.map +1 -0
  285. package/dist/lexical/utils/markdown/convertFromMarkdownString.spec.js +88 -0
  286. package/dist/lexical/utils/markdown/convertFromMarkdownString.spec.js.map +1 -0
  287. package/dist/lexical/utils/markdown/createBlockNode.d.ts +2 -2
  288. package/dist/lexical/utils/markdown/createBlockNode.d.ts.map +1 -1
  289. package/dist/lexical/utils/markdown/createBlockNode.js.map +1 -1
  290. package/dist/lexical/utils/markdown/normalizeMarkdown.d.ts +25 -0
  291. package/dist/lexical/utils/markdown/normalizeMarkdown.d.ts.map +1 -0
  292. package/dist/lexical/utils/markdown/normalizeMarkdown.js +91 -0
  293. package/dist/lexical/utils/markdown/normalizeMarkdown.js.map +1 -0
  294. package/dist/lexical/utils/nodeFormat.d.ts.map +1 -1
  295. package/dist/lexical/utils/point.d.ts.map +1 -1
  296. package/dist/lexical/utils/rect.d.ts.map +1 -1
  297. package/dist/lexical-proxy/@lexical-markdown.d.ts +1 -1
  298. package/dist/lexical-proxy/@lexical-markdown.d.ts.map +1 -1
  299. package/dist/lexical-proxy/@lexical-markdown.js +1 -1
  300. package/dist/lexical-proxy/@lexical-markdown.js.map +1 -1
  301. package/dist/populateGraphQL/populateLexicalPopulationPromises.d.ts.map +1 -1
  302. package/dist/populateGraphQL/recursivelyPopulateFieldsForGraphQL.d.ts.map +1 -1
  303. package/dist/types/builtInNodes.d.ts.map +1 -1
  304. package/dist/types/builtInNodes.js +17 -17
  305. package/dist/types/builtInNodes.js.map +1 -1
  306. package/dist/types/index.d.ts +16 -16
  307. package/dist/types/index.d.ts.map +1 -1
  308. package/dist/types/index.js.map +1 -1
  309. package/dist/types/jsonSchemaHelpers.d.ts +2 -0
  310. package/dist/types/jsonSchemaHelpers.d.ts.map +1 -1
  311. package/dist/types/jsonSchemaHelpers.js +7 -3
  312. package/dist/types/jsonSchemaHelpers.js.map +1 -1
  313. package/dist/types/nodeTypes.d.ts +51 -9
  314. package/dist/types/nodeTypes.d.ts.map +1 -1
  315. package/dist/types/nodeTypes.js +3 -3
  316. package/dist/types/nodeTypes.js.map +1 -1
  317. package/dist/types/schema.d.ts.map +1 -1
  318. package/dist/types/schema.js +24 -7
  319. package/dist/types/schema.js.map +1 -1
  320. package/dist/utilities/applyBaseFilterToFields.d.ts.map +1 -1
  321. package/dist/utilities/applyBaseFilterToFields.js +1 -2
  322. package/dist/utilities/applyBaseFilterToFields.js.map +1 -1
  323. package/dist/utilities/buildEditorState.d.ts +17 -3
  324. package/dist/utilities/buildEditorState.d.ts.map +1 -1
  325. package/dist/utilities/buildEditorState.js +8 -0
  326. package/dist/utilities/buildEditorState.js.map +1 -1
  327. package/dist/utilities/buildInitialState.d.ts +2 -1
  328. package/dist/utilities/buildInitialState.d.ts.map +1 -1
  329. package/dist/utilities/buildInitialState.js.map +1 -1
  330. package/dist/utilities/editorConfigFactory.d.ts.map +1 -1
  331. package/dist/utilities/fieldsDrawer/Drawer.d.ts.map +1 -1
  332. package/dist/utilities/fieldsDrawer/Drawer.js +19 -10
  333. package/dist/utilities/fieldsDrawer/Drawer.js.map +1 -1
  334. package/dist/utilities/fieldsDrawer/DrawerContent.d.ts +4 -1
  335. package/dist/utilities/fieldsDrawer/DrawerContent.d.ts.map +1 -1
  336. package/dist/utilities/fieldsDrawer/DrawerContent.js +8 -7
  337. package/dist/utilities/fieldsDrawer/DrawerContent.js.map +1 -1
  338. package/dist/utilities/fieldsDrawer/index.css +12 -0
  339. package/dist/utilities/fieldsDrawer/useDrawerSubmit.d.ts +29 -0
  340. package/dist/utilities/fieldsDrawer/useDrawerSubmit.d.ts.map +1 -0
  341. package/dist/utilities/fieldsDrawer/useDrawerSubmit.js +97 -0
  342. package/dist/utilities/fieldsDrawer/useDrawerSubmit.js.map +1 -0
  343. package/dist/utilities/fieldsDrawer/useLexicalDocumentDrawer.d.ts.map +1 -1
  344. package/dist/utilities/fieldsDrawer/useLexicalDrawer.d.ts.map +1 -1
  345. package/dist/utilities/fieldsDrawer/useLexicalListDrawer.d.ts.map +1 -1
  346. package/dist/utilities/generateImportMap.d.ts +1 -1
  347. package/dist/utilities/generateImportMap.d.ts.map +1 -1
  348. package/dist/utilities/generateSchemaMap.d.ts +1 -1
  349. package/dist/utilities/generateSchemaMap.d.ts.map +1 -1
  350. package/dist/utilities/getDefaultSanitizedEditorConfig.d.ts.map +1 -1
  351. package/dist/utilities/recurseNodeTree.d.ts.map +1 -1
  352. package/dist/utilities/upgradeLexicalData/upgradeDocumentFieldsRecursively.d.ts.map +1 -1
  353. package/dist/utilities/upgradeLexicalData/upgradeDocumentFieldsRecursively.js +1 -1
  354. package/dist/utilities/upgradeLexicalData/upgradeDocumentFieldsRecursively.js.map +1 -1
  355. package/dist/utilities/useLexicalFeature.d.ts.map +1 -1
  356. package/dist/validate/index.d.ts.map +1 -1
  357. package/package.json +22 -27
  358. package/dist/exports/client/Field-G5Z2HM5Y.js +0 -2
  359. package/dist/exports/client/Field-G5Z2HM5Y.js.map +0 -7
  360. package/dist/exports/client/chunk-6QWQ7JV4.js +0 -2
  361. package/dist/exports/client/chunk-6QWQ7JV4.js.map +0 -7
  362. package/dist/exports/client/chunk-INBEEENE.js +0 -2
  363. package/dist/exports/client/chunk-INBEEENE.js.map +0 -7
  364. package/dist/exports/client/chunk-LH634DPU.js +0 -12
  365. package/dist/exports/client/chunk-LH634DPU.js.map +0 -7
  366. package/dist/exports/client/chunk-UAKNDD6R.js +0 -2
  367. package/dist/exports/client/chunk-UAKNDD6R.js.map +0 -7
  368. package/dist/exports/client/componentInline-D3A6OW76.js +0 -2
  369. package/dist/features/blockquote/markdownTransformer.d.ts +0 -3
  370. package/dist/features/blockquote/markdownTransformer.d.ts.map +0 -1
  371. package/dist/features/blockquote/markdownTransformer.js +0 -33
  372. package/dist/features/blockquote/markdownTransformer.js.map +0 -1
  373. package/dist/features/format/bold/markdownTransformers.d.ts +0 -6
  374. package/dist/features/format/bold/markdownTransformers.d.ts.map +0 -1
  375. package/dist/features/format/bold/markdownTransformers.js +0 -23
  376. package/dist/features/format/bold/markdownTransformers.js.map +0 -1
  377. package/dist/features/format/inlineCode/markdownTransformers.d.ts +0 -3
  378. package/dist/features/format/inlineCode/markdownTransformers.d.ts.map +0 -1
  379. package/dist/features/format/inlineCode/markdownTransformers.js +0 -6
  380. package/dist/features/format/inlineCode/markdownTransformers.js.map +0 -1
  381. package/dist/features/format/italic/markdownTransformers.d.ts +0 -4
  382. package/dist/features/format/italic/markdownTransformers.d.ts.map +0 -1
  383. package/dist/features/format/italic/markdownTransformers.js +0 -12
  384. package/dist/features/format/italic/markdownTransformers.js.map +0 -1
  385. package/dist/features/format/strikethrough/markdownTransformers.d.ts +0 -3
  386. package/dist/features/format/strikethrough/markdownTransformers.d.ts.map +0 -1
  387. package/dist/features/format/strikethrough/markdownTransformers.js +0 -6
  388. package/dist/features/format/strikethrough/markdownTransformers.js.map +0 -1
  389. package/dist/features/lists/checklist/markdownTransformers.d.ts +0 -3
  390. package/dist/features/lists/checklist/markdownTransformers.d.ts.map +0 -1
  391. package/dist/features/lists/checklist/markdownTransformers.js +0 -12
  392. package/dist/features/lists/checklist/markdownTransformers.js.map +0 -1
  393. package/dist/features/lists/orderedList/markdownTransformer.d.ts +0 -3
  394. package/dist/features/lists/orderedList/markdownTransformer.d.ts.map +0 -1
  395. package/dist/features/lists/orderedList/markdownTransformer.js +0 -12
  396. package/dist/features/lists/orderedList/markdownTransformer.js.map +0 -1
  397. package/dist/features/lists/shared/markdown.d.ts +0 -6
  398. package/dist/features/lists/shared/markdown.d.ts.map +0 -1
  399. package/dist/features/lists/shared/markdown.js +0 -57
  400. package/dist/features/lists/shared/markdown.js.map +0 -1
  401. package/dist/features/lists/unorderedList/markdownTransformer.d.ts +0 -3
  402. package/dist/features/lists/unorderedList/markdownTransformer.d.ts.map +0 -1
  403. package/dist/features/lists/unorderedList/markdownTransformer.js +0 -12
  404. package/dist/features/lists/unorderedList/markdownTransformer.js.map +0 -1
  405. package/dist/lexical/utils/guard.d.ts +0 -5
  406. package/dist/lexical/utils/guard.d.ts.map +0 -1
  407. package/dist/lexical/utils/guard.js +0 -9
  408. package/dist/lexical/utils/guard.js.map +0 -1
  409. package/dist/lexical-proxy/@lexical-react/LexicalContextMenuPlugin.d.ts +0 -2
  410. package/dist/lexical-proxy/@lexical-react/LexicalContextMenuPlugin.d.ts.map +0 -1
  411. package/dist/lexical-proxy/@lexical-react/LexicalContextMenuPlugin.js +0 -2
  412. package/dist/lexical-proxy/@lexical-react/LexicalContextMenuPlugin.js.map +0 -1
  413. package/dist/packages/@lexical/markdown/MarkdownExport.d.ts +0 -14
  414. package/dist/packages/@lexical/markdown/MarkdownExport.d.ts.map +0 -1
  415. package/dist/packages/@lexical/markdown/MarkdownExport.js +0 -213
  416. package/dist/packages/@lexical/markdown/MarkdownExport.js.map +0 -1
  417. package/dist/packages/@lexical/markdown/MarkdownImport.d.ts +0 -19
  418. package/dist/packages/@lexical/markdown/MarkdownImport.d.ts.map +0 -1
  419. package/dist/packages/@lexical/markdown/MarkdownImport.js +0 -198
  420. package/dist/packages/@lexical/markdown/MarkdownImport.js.map +0 -1
  421. package/dist/packages/@lexical/markdown/MarkdownShortcuts.d.ts +0 -11
  422. package/dist/packages/@lexical/markdown/MarkdownShortcuts.d.ts.map +0 -1
  423. package/dist/packages/@lexical/markdown/MarkdownShortcuts.js +0 -304
  424. package/dist/packages/@lexical/markdown/MarkdownShortcuts.js.map +0 -1
  425. package/dist/packages/@lexical/markdown/MarkdownTransformers.d.ts +0 -147
  426. package/dist/packages/@lexical/markdown/MarkdownTransformers.d.ts.map +0 -1
  427. package/dist/packages/@lexical/markdown/MarkdownTransformers.js +0 -268
  428. package/dist/packages/@lexical/markdown/MarkdownTransformers.js.map +0 -1
  429. package/dist/packages/@lexical/markdown/importTextFormatTransformer.d.ts +0 -22
  430. package/dist/packages/@lexical/markdown/importTextFormatTransformer.d.ts.map +0 -1
  431. package/dist/packages/@lexical/markdown/importTextFormatTransformer.js +0 -91
  432. package/dist/packages/@lexical/markdown/importTextFormatTransformer.js.map +0 -1
  433. package/dist/packages/@lexical/markdown/importTextMatchTransformer.d.ts +0 -21
  434. package/dist/packages/@lexical/markdown/importTextMatchTransformer.d.ts.map +0 -1
  435. package/dist/packages/@lexical/markdown/importTextMatchTransformer.js +0 -54
  436. package/dist/packages/@lexical/markdown/importTextMatchTransformer.js.map +0 -1
  437. package/dist/packages/@lexical/markdown/importTextTransformers.d.ts +0 -18
  438. package/dist/packages/@lexical/markdown/importTextTransformers.d.ts.map +0 -1
  439. package/dist/packages/@lexical/markdown/importTextTransformers.js +0 -54
  440. package/dist/packages/@lexical/markdown/importTextTransformers.js.map +0 -1
  441. package/dist/packages/@lexical/markdown/index.d.ts +0 -29
  442. package/dist/packages/@lexical/markdown/index.d.ts.map +0 -1
  443. package/dist/packages/@lexical/markdown/index.js +0 -39
  444. package/dist/packages/@lexical/markdown/index.js.map +0 -1
  445. package/dist/packages/@lexical/markdown/utils.d.ts +0 -34
  446. package/dist/packages/@lexical/markdown/utils.d.ts.map +0 -1
  447. package/dist/packages/@lexical/markdown/utils.js +0 -267
  448. package/dist/packages/@lexical/markdown/utils.js.map +0 -1
  449. /package/dist/exports/client/{component-HKTAZ77E.js.map → component-PHZQBOJE.js.map} +0 -0
  450. /package/dist/exports/client/{componentInline-D3A6OW76.js.map → componentInline-H24N7GUG.js.map} +0 -0
@@ -1 +1 @@
1
- {"version":3,"file":"markdownTransformer.js","names":["$createTextNode","sanitizeUrl","$createLinkNode","$isLinkNode","LinkNode","replaceTransformer","textNode","match","linkText","linkUrl","linkNode","fields","doc","linkType","newTab","url","linkTextNode","setFormat","getFormat","append","replace","createLinkMarkdownTransformer","args","type","dependencies","export","_node","exportChildren","node","getFields","internalDocToHref","exportJSON","console","warn","textContent","importRegExp","regExp","trigger","LinkMarkdownTransformer"],"sources":["../../../src/features/link/markdownTransformer.ts"],"sourcesContent":["/**\n * Code taken from https://github.com/facebook/lexical/blob/main/packages/lexical-markdown/src/MarkdownTransformers.ts#L357\n */\n\n// Order of text transformers matters:\n//\n// - code should go first as it prevents any transformations inside\n\nimport { $createTextNode, $isTextNode } from 'lexical'\n\nimport type { TextMatchTransformer } from '../../packages/@lexical/markdown/MarkdownTransformers.js'\nimport type { SerializedLinkNode } from './server/schema.js'\n\nimport { sanitizeUrl } from '../../lexical/utils/url.js'\nimport { $createLinkNode, $isLinkNode, LinkNode } from './nodes/LinkNode.js'\n\n// - then longer tags match (e.g. ** or __ should go before * or _)\n\nexport type CreateLinkMarkdownTransformerArgs = {\n /**\n * A function that receives a serialized internal link node and returns the URL string.\n * Required for internal links (linkType === 'internal') to be exported correctly, since\n * internal links store a doc reference rather than a URL.\n *\n * Without this, internal links will export as `[text]()` with an empty href.\n */\n internalDocToHref?: (args: { linkNode: SerializedLinkNode }) => string\n}\n\nconst replaceTransformer: TextMatchTransformer['replace'] = (textNode, match) => {\n const [, linkText, linkUrl] = match\n const linkNode = $createLinkNode({\n fields: {\n doc: null,\n linkType: 'custom',\n newTab: false,\n url: linkUrl,\n },\n })\n const linkTextNode = $createTextNode(linkText)\n linkTextNode.setFormat(textNode.getFormat())\n linkNode.append(linkTextNode)\n textNode.replace(linkNode)\n\n return linkTextNode\n}\n\nexport const createLinkMarkdownTransformer = (\n args?: CreateLinkMarkdownTransformerArgs,\n): TextMatchTransformer => ({\n type: 'text-match',\n dependencies: [LinkNode],\n export: (_node, exportChildren) => {\n if (!$isLinkNode(_node)) {\n return null\n }\n const node: LinkNode = _node\n const fields = node.getFields()\n\n let url: string\n\n if (fields.linkType === 'internal') {\n if (args?.internalDocToHref) {\n url = sanitizeUrl(args.internalDocToHref({ linkNode: node.exportJSON() }))\n } else {\n // eslint-disable-next-line no-console\n console.warn(\n 'Lexical → Markdown converter: found internal link but internalDocToHref is not provided — link will have an empty href',\n )\n url = ''\n }\n } else {\n url = sanitizeUrl(fields.url ?? '')\n }\n\n const textContent = exportChildren(node)\n return `[${textContent}](${url})`\n },\n importRegExp: /(?<!!)\\[([^[]+)\\]\\(([^()\\s]+)(?:\\s\"((?:[^\"]*\\\\\")*[^\"]*)\"\\s*)?\\)/,\n regExp: /(?<!!)\\[([^[]+)\\]\\(([^()\\s]+)(?:\\s\"((?:[^\"]*\\\\\")*[^\"]*)\"\\s*)?\\)$/,\n replace: replaceTransformer,\n trigger: ')',\n})\n\nexport const LinkMarkdownTransformer: TextMatchTransformer = createLinkMarkdownTransformer()\n"],"mappings":"AAAA;;GAAA,CAIA;AACA;AACA;AAEA,SAASA,eAAe,QAAqB;AAK7C,SAASC,WAAW,QAAQ;AAC5B,SAASC,eAAe,EAAEC,WAAW,EAAEC,QAAQ,QAAQ;AAevD,MAAMC,kBAAA,GAAsDA,CAACC,QAAA,EAAUC,KAAA;EACrE,MAAM,GAAGC,QAAA,EAAUC,OAAA,CAAQ,GAAGF,KAAA;EAC9B,MAAMG,QAAA,GAAWR,eAAA,CAAgB;IAC/BS,MAAA,EAAQ;MACNC,GAAA,EAAK;MACLC,QAAA,EAAU;MACVC,MAAA,EAAQ;MACRC,GAAA,EAAKN;IACP;EACF;EACA,MAAMO,YAAA,GAAehB,eAAA,CAAgBQ,QAAA;EACrCQ,YAAA,CAAaC,SAAS,CAACX,QAAA,CAASY,SAAS;EACzCR,QAAA,CAASS,MAAM,CAACH,YAAA;EAChBV,QAAA,CAASc,OAAO,CAACV,QAAA;EAEjB,OAAOM,YAAA;AACT;AAEA,OAAO,MAAMK,6BAAA,GACXC,IAAA,KAC0B;EAC1BC,IAAA,EAAM;EACNC,YAAA,EAAc,CAACpB,QAAA,CAAS;EACxBqB,MAAA,EAAQA,CAACC,KAAA,EAAOC,cAAA;IACd,IAAI,CAACxB,WAAA,CAAYuB,KAAA,GAAQ;MACvB,OAAO;IACT;IACA,MAAME,IAAA,GAAiBF,KAAA;IACvB,MAAMf,MAAA,GAASiB,IAAA,CAAKC,SAAS;IAE7B,IAAId,GAAA;IAEJ,IAAIJ,MAAA,CAAOE,QAAQ,KAAK,YAAY;MAClC,IAAIS,IAAA,EAAMQ,iBAAA,EAAmB;QAC3Bf,GAAA,GAAMd,WAAA,CAAYqB,IAAA,CAAKQ,iBAAiB,CAAC;UAAEpB,QAAA,EAAUkB,IAAA,CAAKG,UAAU;QAAG;MACzE,OAAO;QACL;QACAC,OAAA,CAAQC,IAAI,CACV;QAEFlB,GAAA,GAAM;MACR;IACF,OAAO;MACLA,GAAA,GAAMd,WAAA,CAAYU,MAAA,CAAOI,GAAG,IAAI;IAClC;IAEA,MAAMmB,WAAA,GAAcP,cAAA,CAAeC,IAAA;IACnC,OAAO,IAAIM,WAAA,KAAgBnB,GAAA,GAAM;EACnC;EACAoB,YAAA,EAAc;EACdC,MAAA,EAAQ;EACRhB,OAAA,EAASf,kBAAA;EACTgC,OAAA,EAAS;AACX;AAEA,OAAO,MAAMC,uBAAA,GAAgDjB,6BAAA","ignoreList":[]}
1
+ {"version":3,"file":"markdownTransformer.js","names":["$createTextNode","sanitizeUrl","$createLinkNode","$isLinkNode","LinkNode","replaceTransformer","textNode","match","linkText","linkUrl","linkNode","fields","doc","linkType","newTab","url","linkTextNode","setFormat","getFormat","append","replace","createPayloadLinkTransformer","args","type","dependencies","export","_node","exportChildren","node","getFields","internalDocToHref","exportJSON","console","warn","textContent","importRegExp","regExp","trigger","PAYLOAD_LINK"],"sources":["../../../src/features/link/markdownTransformer.ts"],"sourcesContent":["/**\n * Code taken from https://github.com/facebook/lexical/blob/main/packages/lexical-markdown/src/MarkdownTransformers.ts#L357\n */\n\n// Order of text transformers matters:\n//\n// - code should go first as it prevents any transformations inside\n\nimport type { TextMatchTransformer } from '@lexical/markdown'\n\nimport { $createTextNode } from 'lexical'\n\nimport type { SerializedLinkNode } from './server/schema.js'\n\nimport { sanitizeUrl } from '../../lexical/utils/url.js'\nimport { $createLinkNode, $isLinkNode, LinkNode } from './nodes/LinkNode.js'\n\n// - then longer tags match (e.g. ** or __ should go before * or _)\n\nexport type CreatePayloadLinkTransformerArgs = {\n /**\n * A function that receives a serialized internal link node and returns the URL string.\n * Required for internal links (linkType === 'internal') to be exported correctly, since\n * internal links store a doc reference rather than a URL.\n *\n * Without this, internal links will export as `[text]()` with an empty href.\n */\n internalDocToHref?: (args: { linkNode: SerializedLinkNode }) => string\n}\n\nconst replaceTransformer: TextMatchTransformer['replace'] = (textNode, match) => {\n const [, linkText, linkUrl] = match\n const linkNode = $createLinkNode({\n fields: {\n doc: null,\n linkType: 'custom',\n newTab: false,\n url: linkUrl,\n },\n })\n const linkTextNode = $createTextNode(linkText)\n linkTextNode.setFormat(textNode.getFormat())\n linkNode.append(linkTextNode)\n textNode.replace(linkNode)\n\n return linkTextNode\n}\n\nexport const createPayloadLinkTransformer = (\n args?: CreatePayloadLinkTransformerArgs,\n): TextMatchTransformer => ({\n type: 'text-match',\n dependencies: [LinkNode],\n export: (_node, exportChildren) => {\n if (!$isLinkNode(_node)) {\n return null\n }\n const node: LinkNode = _node\n const fields = node.getFields()\n\n let url: string\n\n if (fields.linkType === 'internal') {\n if (args?.internalDocToHref) {\n url = sanitizeUrl(args.internalDocToHref({ linkNode: node.exportJSON() }))\n } else {\n // eslint-disable-next-line no-console\n console.warn(\n 'Lexical → Markdown converter: found internal link but internalDocToHref is not provided — link will have an empty href',\n )\n url = ''\n }\n } else {\n url = sanitizeUrl(fields.url ?? '')\n }\n\n const textContent = exportChildren(node)\n return `[${textContent}](${url})`\n },\n importRegExp: /(?<!!)\\[([^[]+)\\]\\(([^()\\s]+)(?:\\s\"((?:[^\"]*\\\\\")*[^\"]*)\"\\s*)?\\)/,\n regExp: /(?<!!)\\[([^[]+)\\]\\(([^()\\s]+)(?:\\s\"((?:[^\"]*\\\\\")*[^\"]*)\"\\s*)?\\)$/,\n replace: replaceTransformer,\n trigger: ')',\n})\n\nexport const PAYLOAD_LINK: Text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,GAAA,GAAMd,WAAA,CAAYU,MAAA,CAAOI,GAAG,IAAI;IAClC;IAEA,MAAMmB,WAAA,GAAcP,cAAA,CAAeC,IAAA;IACnC,OAAO,IAAIM,WAAA,KAAgBnB,GAAA,GAAM;EACnC;EACAoB,YAAA,EAAc;EACdC,MAAA,EAAQ;EACRhB,OAAA,EAASf,kBAAA;EACTgC,OAAA,EAAS;AACX;AAEA,OAAO,MAAMC,YAAA,GAAqCjB,4BAAA","ignoreList":[]}
@@ -1,16 +1,16 @@
1
1
  import { createHeadlessEditor } from '@lexical/headless';
2
2
  import { $createParagraphNode, $createTextNode, $getRoot } from 'lexical';
3
3
  import { describe, expect, it } from 'vitest';
4
- import { $convertToMarkdownString } from '../../packages/@lexical/markdown/index.js';
4
+ import { $convertToMarkdownString } from '@lexical/markdown';
5
5
  import { AutoLinkNode } from './nodes/AutoLinkNode.js';
6
6
  import { $createLinkNode, LinkNode } from './nodes/LinkNode.js';
7
- import { LinkMarkdownTransformer, createLinkMarkdownTransformer } from './markdownTransformer.js';
7
+ import { PAYLOAD_LINK, createPayloadLinkTransformer } from './markdownTransformer.js';
8
8
  function createEditor() {
9
9
  return createHeadlessEditor({
10
10
  nodes: [LinkNode, AutoLinkNode]
11
11
  });
12
12
  }
13
- function toMarkdown(setupFn, transformer = LinkMarkdownTransformer) {
13
+ function toMarkdown(setupFn, transformer = PAYLOAD_LINK) {
14
14
  const editor = createEditor();
15
15
  editor.update(setupFn, {
16
16
  discrete: true
@@ -21,7 +21,7 @@ function toMarkdown(setupFn, transformer = LinkMarkdownTransformer) {
21
21
  });
22
22
  return markdown;
23
23
  }
24
- describe('createLinkMarkdownTransformer', () => {
24
+ describe('createPayloadLinkTransformer', () => {
25
25
  describe('custom links', () => {
26
26
  it('should export a custom link with its url', () => {
27
27
  const markdown = toMarkdown(() => {
@@ -104,7 +104,7 @@ describe('createLinkMarkdownTransformer', () => {
104
104
  expect(markdown).toBe('[About]()');
105
105
  });
106
106
  it('should call internalDocToHref and use the returned url', () => {
107
- const transformer = createLinkMarkdownTransformer({
107
+ const transformer = createPayloadLinkTransformer({
108
108
  internalDocToHref: ({
109
109
  linkNode
110
110
  }) => {
@@ -136,7 +136,7 @@ describe('createLinkMarkdownTransformer', () => {
136
136
  });
137
137
  it('should pass the full serialized link node to internalDocToHref', () => {
138
138
  let capturedLinkNode = null;
139
- const transformer = createLinkMarkdownTransformer({
139
+ const transformer = createPayloadLinkTransformer({
140
140
  internalDocToHref: ({
141
141
  linkNode
142
142
  }) => {
@@ -171,8 +171,8 @@ describe('createLinkMarkdownTransformer', () => {
171
171
  expect(capturedLinkNode.fields.newTab).toBe(true);
172
172
  });
173
173
  });
174
- describe('LinkMarkdownTransformer (static export)', () => {
175
- it('should behave identically to createLinkMarkdownTransformer() with no args', () => {
174
+ describe('PAYLOAD_LINK (static export)', () => {
175
+ it('should behave identically to createPayloadLinkTransformer() with no args', () => {
176
176
  const setup = () => {
177
177
  const link = $createLinkNode({
178
178
  fields: {
@@ -185,8 +185,8 @@ describe('createLinkMarkdownTransformer', () => {
185
185
  link.append($createTextNode('Example'));
186
186
  $getRoot().append($createParagraphNode().append(link));
187
187
  };
188
- const fromStatic = toMarkdown(setup, LinkMarkdownTransformer);
189
- const fromFactory = toMarkdown(setup, createLinkMarkdownTransformer());
188
+ const fromStatic = toMarkdown(setup, PAYLOAD_LINK);
189
+ const fromFactory = toMarkdown(setup, createPayloadLinkTransformer());
190
190
  expect(fromStatic).toBe(fromFactory);
191
191
  expect(fromStatic).toBe('[Example](https://example.com)');
192
192
  });
@@ -1 +1 @@
1
- {"version":3,"file":"markdownTransformer.spec.js","names":["createHeadlessEditor","$createParagraphNode","$createTextNode","$getRoot","describe","expect","it","$convertToMarkdownString","AutoLinkNode","$createLinkNode","LinkNode","LinkMarkdownTransformer","createLinkMarkdownTransformer","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 '../../packages/@lexical/markdown/index.js'\nimport { AutoLinkNode } from './nodes/AutoLinkNode.js'\nimport { $createLinkNode, LinkNode } from './nodes/LinkNode.js'\nimport type { SerializedLinkNode } from './server/schema.js'\nimport { LinkMarkdownTransformer, createLinkMarkdownTransformer } from './markdownTransformer.js'\n\nfunction createEditor() {\n return createHeadlessEditor({ nodes: [LinkNode, AutoLinkNode] })\n}\n\nfunction toMarkdown(setupFn: () => void, transformer = LinkMarkdownTransformer): 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('createLinkMarkdownTransformer', () => {\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 = createLinkMarkdownTransformer({\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 = createLinkMarkdownTransformer({\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('LinkMarkdownTransformer (static export)', () => {\n it('should behave identically to createLinkMarkdownTransformer() 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, LinkMarkdownTransformer)\n const fromFactory = toMarkdown(setup, createLinkMarkdownTransformer())\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,uBAAuB,EAAEC,6BAA6B,QAAQ;AAEvE,SAASC,aAAA;EACP,OAAOb,oBAAA,CAAqB;IAAEc,KAAA,EAAO,CAACJ,QAAA,EAAUF,YAAA;EAAc;AAChE;AAEA,SAASO,WAAWC,OAAmB,EAAEC,WAAA,GAAcN,uBAAuB;EAC5E,MAAMO,MAAA,GAASL,YAAA;EACfK,MAAA,CAAOC,MAAM,CAACH,OAAA,EAAS;IAAEI,QAAA,EAAU;EAAK;EACxC,IAAIC,QAAA,GAAW;EACfH,MAAA,CAAOI,cAAc,GAAGC,IAAI,CAAC;IAC3BF,QAAA,GAAWd,wBAAA,CAAyB,CAACU,WAAA,CAAY;EACnD;EACA,OAAOI,QAAA;AACT;AAEAjB,QAAA,CAAS,iCAAiC;EACxCA,QAAA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AOmC,gBAAA,CAAkBf,MAAM,CAACI,GAAG,EAAEM,KAAA,EAAOS,aAAa,CAAC;QAAER,EAAA,EAAI;QAAMK,KAAA,EAAO;MAAO;MACpFpC,MAAA,CAAOmC,gBAAA,CAAkBf,MAAM,CAACG,MAAM,EAAEG,IAAI,CAAC;IAC/C;EACF;EAEA3B,QAAA,CAAS,2CAA2C;IAClDE,EAAA,CAAG,6EAA6E;MAC9E,MAAMuC,KAAA,GAAQA,CAAA;QACZ,MAAMrB,IAAA,GAAOf,eAAA,CAAgB;UAC3BgB,MAAA,EAAQ;YAAEC,QAAA,EAAU;YAAUC,GAAA,EAAK;YAAuBC,MAAA,EAAQ;YAAOC,GAAA,EAAK;UAAK;QACrF;QACAL,IAAA,CAAKM,MAAM,CAAC5B,eAAA,CAAgB;QAC5BC,QAAA,GAAW2B,MAAM,CAAC7B,oBAAA,GAAuB6B,MAAM,CAACN,IAAA;MAClD;MAEA,MAAMsB,UAAA,GAAa/B,UAAA,CAAW8B,KAAA,EAAOlC,uBAAA;MACrC,MAAMoC,WAAA,GAAchC,UAAA,CAAW8B,KAAA,EAAOjC,6BAAA;MAEtCP,MAAA,CAAOyC,UAAA,EAAYf,IAAI,CAACgB,WAAA;MACxB1C,MAAA,CAAOyC,UAAA,EAAYf,IAAI,CAAC;IAC1B;EACF;AACF","ignoreList":[]}
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,QAAQ;AAE3D,SAASC,aAAA;EACP,OAAOb,oBAAA,CAAqB;IAAEc,KAAA,EAAO,CAACJ,QAAA,EAAUF,YAAA;EAAc;AAChE;AAEA,SAASO,WAAWC,OAAmB,EAAEC,WAAA,GAAcN,YAAY;EACjE,MAAMO,MAAA,GAASL,YAAA;EACfK,MAAA,CAAOC,MAAM,CAACH,OAAA,EAAS;IAAEI,QAAA,EAAU;EAAK;EACxC,IAAIC,QAAA,GAAW;EACfH,MAAA,CAAOI,cAAc,GAAGC,IAAI,CAAC;IAC3BF,QAAA,GAAWd,wBAAA,CAAyB,CAACU,WAAA,CAAY;EACnD;EACA,OAAOI,QAAA;AACT;AAEAjB,QAAA,CAAS,gCAAgC;EACvCA,QAAA,CAAS,gBAAgB;IACvBE,EAAA,CAAG,4CAA4C;MAC7C,MAAMe,QAAA,GAAWN,UAAA,CAAW;QAC1B,MAAMS,IAAA,GAAOf,eAAA,CAAgB;UAC3BgB,MAAA,EAAQ;YAAEC,QAAA,EAAU;YAA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AAG,MAAM,CAW/B;IAED,SAAS,CAAC,MAAM,EAAE,UAAU,GAAG,IAAI,CAIlC;IAED,KAAK,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI,CAItB;IAEQ,SAAS,CAAC,QAAQ,EAAE,IAAI,EAAE,MAAM,EAAE,iBAAiB,EAAE,MAAM,EAAE,YAAY,GAAG,OAAO,CA6B3F;IAEQ,cAAc,CAAC,eAAe,EAAE,iBAAiB,CAAC,qBAAqB,CAAC,GAAG,IAAI,CAMvF;CACF;AAqBD,wBAAgB,eAAe,CAAC,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE;IAAE,MAAM,CAAC,EAAE,UAAU,CAAC;IAAC,EAAE,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,QAAQ,CAO9F;AAED,wBAAgB,WAAW,CAAC,IAAI,EAAE,WAAW,GAAG,IAAI,GAAG,SAAS,GAAG,IAAI,IAAI,QAAQ,CAElF;AAED,eAAO,MAAM,mBAAmB,EAAE,cAAc,CAAC,WAAW,GAAG,IAAI,CAC7B,CAAA;AAEtC,wBAAgB,WAAW,CAAC,OAAO,EAAE,CAAC;IAAE,MAAM,EAAE,UAAU,CAAA;CAAE,GAAG,WAAW,CAAC,GAAG,IAAI,GAAG,IAAI,CA+GxF"}
@@ -1 +1 @@
1
- {"version":3,"file":"baseFields.d.ts","sourceRoot":"","sources":["../../../../src/features/link/server/baseFields.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,cAAc,EACd,kBAAkB,EAElB,eAAe,EAIhB,MAAM,SAAS,CAAA;AAMhB,eAAO,MAAM,aAAa,GACxB,QAAQ,eAAe,EACvB,qBAAqB,cAAc,EAAE,EACrC,sBAAsB,cAAc,EAAE,EACtC,WAAW,MAAM,KAChB,kBAAkB,EAqIpB,CAAA"}
1
+ {"version":3,"file":"baseFields.d.ts","sourceRoot":"","sources":["../../../../src/features/link/server/baseFields.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,cAAc,EACd,kBAAkB,EAElB,eAAe,EAIhB,MAAM,SAAS,CAAA;AAMhB,eAAO,MAAM,aAAa,WAChB,eAAe,uBACF,cAAc,EAAE,wBACf,cAAc,EAAE,aAC3B,MAAM,KAChB,kBAAkB,EAqIpB,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"baseFields.js","names":["validateUrl","validateUrlMinimal","getBaseFields","config","enabledCollections","disabledCollections","maxDepth","enabledRelations","collections","filter","slug","includes","map","admin","enableRichTextLink","hidden","baseFields","name","type","label","t","required","description","defaultValue","options","value","hooks","beforeChange","encodeURIComponent","validate","siblingData","linkType","length","push","condition","_data","_siblingData","filterOptions","relationTo","req","user","find","baseFilter","baseListFilter","limit","page","sort"],"sources":["../../../../src/features/link/server/baseFields.ts"],"sourcesContent":["import type {\n CollectionSlug,\n FieldAffectingData,\n RadioField,\n SanitizedConfig,\n TextField,\n TextFieldSingleValidation,\n TypedUser,\n} from 'payload'\n\nimport type { LinkFields } from './schema.js'\n\nimport { validateUrl, validateUrlMinimal } from '../../../lexical/utils/url.js'\n\nexport const getBaseFields = (\n config: SanitizedConfig,\n enabledCollections?: CollectionSlug[],\n disabledCollections?: CollectionSlug[],\n maxDepth?: number,\n): FieldAffectingData[] => {\n let enabledRelations: CollectionSlug[]\n\n /**\n * Figure out which relations should be enabled (enabledRelations) based on a collection's admin.enableRichTextLink property,\n * or the Link Feature's enabledCollections and disabledCollections properties which override it.\n */\n if (enabledCollections) {\n enabledRelations = enabledCollections\n } else if (disabledCollections) {\n enabledRelations = config.collections\n .filter(({ slug }) => !disabledCollections.includes(slug))\n .map(({ slug }) => slug)\n } else {\n enabledRelations = config.collections\n .filter(({ admin: { enableRichTextLink, hidden } }) => {\n if (typeof hidden !== 'function' && hidden) {\n return false\n }\n return enableRichTextLink\n })\n .map(({ slug }) => slug)\n }\n\n const baseFields: FieldAffectingData[] = [\n {\n name: 'text',\n type: 'text',\n label: ({ t }) => t('fields:textToDisplay'),\n required: true,\n },\n {\n name: 'linkType',\n type: 'radio',\n admin: {\n description: ({ t }) => t('fields:chooseBetweenCustomTextOrDocument'),\n },\n defaultValue: 'custom',\n label: ({ t }) => t('fields:linkType'),\n options: [\n {\n label: ({ t }) => t('fields:customURL'),\n value: 'custom',\n },\n ],\n required: true,\n } as RadioField,\n {\n name: 'url',\n type: 'text',\n hooks: {\n beforeChange: [\n ({ value }) => {\n if (!value) {\n return\n }\n\n if (!validateUrl(value)) {\n return encodeURIComponent(value)\n }\n return value\n },\n ],\n },\n label: ({ t }) => t('fields:enterURL'),\n required: true,\n validate: ((value: string, options) => {\n if ((options?.siblingData as LinkFields)?.linkType === 'internal') {\n return // no validation needed, as no url should exist for internal links\n }\n if (!validateUrlMinimal(value)) {\n return 'Invalid URL'\n }\n }) as TextFieldSingleValidation,\n },\n ]\n\n // Only display internal link-specific fields / options / conditions if there are enabled relations\n if (enabledRelations?.length) {\n ;(baseFields[1] as RadioField).options.push({\n label: ({ t }) => t('fields:internalLink'),\n value: 'internal',\n })\n ;(baseFields[2] as TextField).admin = {\n condition: (_data, _siblingData) => {\n return _siblingData.linkType !== 'internal'\n },\n }\n\n baseFields.push({\n name: 'doc',\n admin: {\n condition: (_data, _siblingData) => {\n return _siblingData.linkType === 'internal'\n },\n },\n // when admin.hidden is a function we need to dynamically call hidden with the user to know if the collection should be shown\n type: 'relationship',\n filterOptions:\n !enabledCollections && !disabledCollections\n ? async ({ relationTo, req, user }) => {\n const admin = config.collections.find(({ slug }) => slug === relationTo)?.admin\n\n const hidden = admin?.hidden\n if (typeof hidden === 'function' && hidden({ user } as { user: TypedUser })) {\n return false\n }\n\n const baseFilter = admin?.baseFilter ?? admin?.baseListFilter\n return (\n (await baseFilter?.({\n limit: 0,\n page: 1,\n req,\n sort: 'id',\n })) ?? true\n )\n }\n : null,\n label: ({ t }) => t('fields:chooseDocumentToLink'),\n maxDepth,\n relationTo: enabledRelations,\n required: true,\n })\n }\n\n baseFields.push({\n name: 'newTab',\n type: 'checkbox',\n label: ({ t }) => t('fields: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C,GAAG;QAAEC;MAAI,CAAE;QAC9B,MAAM3B,KAAA,GAAQV,MAAA,CAAOK,WAAW,CAACiC,IAAI,CAAC,CAAC;UAAE/B;QAAI,CAAE,KAAKA,IAAA,KAAS4B,UAAA,GAAazB,KAAA;QAE1E,MAAME,MAAA,GAASF,KAAA,EAAOE,MAAA;QACtB,IAAI,OAAOA,MAAA,KAAW,cAAcA,MAAA,CAAO;UAAEyB;QAAK,IAA2B;UAC3E,OAAO;QACT;QAEA,MAAME,UAAA,GAAa7B,KAAA,EAAO6B,UAAA,IAAc7B,KAAA,EAAO8B,cAAA;QAC/C,OACE,OAAOD,UAAA,GAAa;UAClBE,KAAA,EAAO;UACPC,IAAA,EAAM;UACNN,GAAA;UACAO,IAAA,EAAM;QACR,OAAO;MAEX,IACA;MACN3B,KAAA,EAAOA,CAAC;QAAEC;MAAC,CAAE,KAAKA,CAAA,CAAE;MACpBd,QAAA;MACAgC,UAAA,EAAY/B,gBAAA;MACZc,QAAA,EAAU;IACZ;EACF;EAEAL,UAAA,CAAWiB,IAAI,CAAC;IACdhB,IAAA,EAAM;IACNC,IAAA,EAAM;IACNC,KAAA,EAAOA,CAAC;MAAEC;IAAC,CAAE,KAAKA,CAAA,CAAE;EACtB;EAEA,OAAOJ,UAAA;AACT","ignoreList":[]}
1
+ {"version":3,"file":"baseFields.js","names":["validateUrl","validateUrlMinimal","getBaseFields","config","enabledCollections","disabledCollections","maxDepth","enabledRelations","collections","filter","slug","includes","map","admin","enableRichTextLink","hidden","baseFields","name","type","label","t","required","description","defaultValue","options","value","hooks","beforeChange","encodeURIComponent","validate","siblingData","linkType","length","push","condition","_data","_siblingData","filterOptions","relationTo","req","user","find","baseFilter","baseListFilter","limit","page","sort"],"sources":["../../../../src/features/link/server/baseFields.ts"],"sourcesContent":["import type {\n CollectionSlug,\n FieldAffectingData,\n RadioField,\n SanitizedConfig,\n TextField,\n TextFieldSingleValidation,\n User,\n} from 'payload'\n\nimport type { LinkFields } from './schema.js'\n\nimport { validateUrl, validateUrlMinimal } from '../../../lexical/utils/url.js'\n\nexport const getBaseFields = (\n config: SanitizedConfig,\n enabledCollections?: CollectionSlug[],\n disabledCollections?: CollectionSlug[],\n maxDepth?: number,\n): FieldAffectingData[] => {\n let enabledRelations: CollectionSlug[]\n\n /**\n * Figure out which relations should be enabled (enabledRelations) based on a collection's admin.enableRichTextLink property,\n * or the Link Feature's enabledCollections and disabledCollections properties which override it.\n */\n if (enabledCollections) {\n enabledRelations = enabledCollections\n } else if (disabledCollections) {\n enabledRelations = config.collections\n .filter(({ slug }) => !disabledCollections.includes(slug))\n .map(({ slug }) => slug)\n } else {\n enabledRelations = config.collections\n .filter(({ admin: { enableRichTextLink, hidden } }) => {\n if (typeof hidden !== 'function' && hidden) {\n return false\n }\n return enableRichTextLink\n })\n .map(({ slug }) => slug)\n }\n\n const baseFields: FieldAffectingData[] = [\n {\n name: 'text',\n type: 'text',\n label: ({ t }) => t('fields:textToDisplay'),\n required: true,\n },\n {\n name: 'linkType',\n type: 'radio',\n admin: {\n description: ({ t }) => t('fields:chooseBetweenCustomTextOrDocument'),\n },\n defaultValue: 'custom',\n label: ({ t }) => t('fields:linkType'),\n options: [\n {\n label: ({ t }) => t('fields:customURL'),\n value: 'custom',\n },\n ],\n required: true,\n } as RadioField,\n {\n name: 'url',\n type: 'text',\n hooks: {\n beforeChange: [\n ({ value }) => {\n if (!value) {\n return\n }\n\n if (!validateUrl(value)) {\n return encodeURIComponent(value)\n }\n return value\n },\n ],\n },\n label: ({ t }) => t('fields:enterURL'),\n required: true,\n validate: ((value: string, options) => {\n if ((options?.siblingData as LinkFields)?.linkType === 'internal') {\n return // no validation needed, as no url should exist for internal links\n }\n if (!validateUrlMinimal(value)) {\n return 'Invalid URL'\n }\n }) as TextFieldSingleValidation,\n },\n ]\n\n // Only display internal link-specific fields / options / conditions if there are enabled relations\n if (enabledRelations?.length) {\n ;(baseFields[1] as RadioField).options.push({\n label: ({ t }) => t('fields:internalLink'),\n value: 'internal',\n })\n ;(baseFields[2] as TextField).admin = {\n condition: (_data, _siblingData) => {\n return _siblingData.linkType !== 'internal'\n },\n }\n\n baseFields.push({\n name: 'doc',\n admin: {\n condition: (_data, _siblingData) => {\n return _siblingData.linkType === 'internal'\n },\n },\n // when admin.hidden is a function we need to dynamically call hidden with the user to know if the collection should be shown\n type: 'relationship',\n filterOptions:\n !enabledCollections && !disabledCollections\n ? async ({ relationTo, req, user }) => {\n const admin = config.collections.find(({ slug }) => slug === relationTo)?.admin\n\n const hidden = admin?.hidden\n if (typeof hidden === 'function' && hidden({ user } as { user: User })) {\n return false\n }\n\n const baseFilter = admin?.baseFilter ?? admin?.baseListFilter\n return (\n (await baseFilter?.({\n limit: 0,\n page: 1,\n req,\n sort: 'id',\n })) ?? true\n )\n }\n : null,\n label: ({ t }) => t('fields:chooseDocumentToLink'),\n maxDepth,\n relationTo: enabledRelations,\n required: true,\n })\n }\n\n baseFields.push({\n name: 'newTab',\n type: 'checkbox',\n label: ({ t }) => t('fields:openInNewTab'),\n })\n\n return baseFields\n}\n"],"mappings":"AAYA,SAASA,WAAW,EAAEC,kBAAkB,QAAQ;AAEhD,OAAO,MAAMC,aAAA,GAAgBA,CAC3BC,MAAA,EACAC,kBAAA,EACAC,mBAAA,EACAC,QAAA;EAEA,IAAIC,gBAAA;EAEJ;;;;EAIA,IAAIH,kBAAA,EAAoB;IACtBG,gBAAA,GAAmBH,kBAAA;EACrB,OAAO,IAAIC,mBAAA,EAAqB;IAC9BE,gBAAA,GAAmBJ,MAAA,CAAOK,WAAW,CAClCC,MAAM,CAAC,CAAC;MAAEC;IAAI,CAAE,KAAK,CAACL,mBAAA,CAAoBM,QAAQ,CAACD,IAAA,GACnDE,GAAG,CAAC,CAAC;MAAEF;IAAI,CAAE,KAAKA,IAAA;EACvB,OAAO;IACLH,gBAAA,GAAmBJ,MAAA,CAAOK,WAAW,CAClCC,MAAM,CAAC,CAAC;MAAEI,KAAA,EAAO;QAAEC,kBAAkB;QAAEC;M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AA,EAAU;IACZ;EACF;EAEAL,UAAA,CAAWiB,IAAI,CAAC;IACdhB,IAAA,EAAM;IACNC,IAAA,EAAM;IACNC,KAAA,EAAOA,CAAC;MAAEC;IAAC,CAAE,KAAKA,CAAA,CAAE;EACtB;EAEA,OAAOJ,UAAA;AACT","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"graphQLPopulationPromise.d.ts","sourceRoot":"","sources":["../../../../src/features/link/server/graphQLPopulationPromise.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAA;AAC7D,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,YAAY,CAAA;AACxD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAA;AAIrD,eAAO,MAAM,wBAAwB,GACnC,OAAO,sBAAsB,KAC5B,iBAAiB,CAAC,kBAAkB,CA8CtC,CAAA"}
1
+ {"version":3,"file":"graphQLPopulationPromise.d.ts","sourceRoot":"","sources":["../../../../src/features/link/server/graphQLPopulationPromise.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAA;AAC7D,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,YAAY,CAAA;AACxD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAA;AAIrD,eAAO,MAAM,wBAAwB,UAC5B,sBAAsB,KAC5B,iBAAiB,CAAC,kBAAkB,CA8CtC,CAAA"}
@@ -1,7 +1,7 @@
1
1
  import { sanitizeFields } from 'payload';
2
2
  import { createServerFeature } from '../../../utilities/createServerFeature.js';
3
3
  import { createNode } from '../../typeUtilities.js';
4
- import { createLinkMarkdownTransformer } from '../markdownTransformer.js';
4
+ import { createPayloadLinkTransformer } from '../markdownTransformer.js';
5
5
  import { AutoLinkNode } from '../nodes/AutoLinkNode.js';
6
6
  import { LinkNode } from '../nodes/LinkNode.js';
7
7
  import { linkPopulationPromiseHOC } from './graphQLPopulationPromise.js';
@@ -65,7 +65,7 @@ export const LinkFeature = createServerFeature({
65
65
  return schemaMap;
66
66
  },
67
67
  i18n,
68
- markdownTransformers: [createLinkMarkdownTransformer({
68
+ markdownTransformers: [createPayloadLinkTransformer({
69
69
  internalDocToHref: props.internalDocToHref
70
70
  })],
71
71
  nodes: [props?.disableAutoLinks === true ? null : createNode({
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["sanitizeFields","createServerFeature","createNode","createLinkMarkdownTransformer","AutoLinkNode","LinkNode","linkPopulationPromiseHOC","i18n","createAutoLinkNodeJSONSchema","createLinkNodeJSONSchema","transformExtraFields","linkValidation","LinkFeature","feature","config","_config","isRoot","parentIsLocalized","props","validRelationships","collections","map","c","slug","_transformedFields","fields","enabledCollections","disabledCollections","maxDepth","sanitizedFields","requireFieldLevelRichTextEditor","sanitizedFieldsWithoutText","filter","field","name","linkTypeField","linkURLField","defaultLinkType","defaultValue","undefined","defaultLinkURL","ClientFeature","clientFeatureProps","disableAutoLinks","generateSchemaMap","Array","isArray","length","schemaMap","Map","set","markdownTransformers","internalDocToHref","nodes","jsonSchema","node","validations","getSubFields","getSubFieldsData","graphQLPopulationPromises","Boolean","sanitizedServerFeatureProps","key"],"sources":["../../../../src/features/link/server/index.ts"],"sourcesContent":["import type {\n CollectionSlug,\n Config,\n Field,\n FieldAffectingData,\n FieldSchemaMap,\n SanitizedConfig,\n} from 'payload'\n\nimport { sanitizeFields } from 'payload'\n\nimport type { NodeWithHooks } from '../../typesServer.js'\nimport type { ClientProps } from '../client/index.js'\n\nimport { createServerFeature } from '../../../utilities/createServerFeature.js'\nimport { createNode } from '../../typeUtilities.js'\nimport { createLinkMarkdownTransformer } from '../markdownTransformer.js'\nimport { AutoLinkNode } from '../nodes/AutoLinkNode.js'\nimport { LinkNode } from '../nodes/LinkNode.js'\nimport { linkPopulationPromiseHOC } from './graphQLPopulationPromise.js'\nimport { i18n } from './i18n.js'\nimport {\n createAutoLinkNodeJSONSchema,\n createLinkNodeJSONSchema,\n type SerializedLinkNode,\n} from './schema.js'\nimport { transformExtraFields } from './transformExtraFields.js'\nimport { linkValidation } from './validate.js'\n\nexport type { LinkFields, SerializedAutoLinkNode, SerializedLinkNode } from './schema.js'\n\nexport type ExclusiveLinkCollectionsProps =\n | {\n /**\n * The collections that should be disabled for internal linking. Overrides the `enableRichTextLink` property in the collection config.\n * When this property is set, `enabledCollections` will not be available.\n **/\n disabledCollections?: CollectionSlug[]\n\n // Ensures that enabledCollections is not available when disabledCollections is set\n enabledCollections?: never\n }\n | {\n // Ensures that disabledCollections is not available when enabledCollections is set\n disabledCollections?: never\n\n /**\n * The collections that should be enabled for internal linking. Overrides the `enableRichTextLink` property in the collection config\n * When this property is set, `disabledCollections` will not be available.\n **/\n enabledCollections?: CollectionSlug[]\n }\n\nexport type LinkFeatureServerProps = {\n /**\n * Disables the automatic creation of links from URLs pasted into the editor, as well\n * as auto link nodes.\n *\n * If set to 'creationOnly', only the creation of new auto link nodes will be disabled.\n * Existing auto link nodes will still be editable.\n *\n * @default false\n */\n disableAutoLinks?: 'creationOnly' | true\n /**\n * A function or array defining additional fields for the link feature. These will be\n * displayed in the link editor drawer.\n */\n fields?:\n | ((args: {\n config: SanitizedConfig\n defaultFields: FieldAffectingData[]\n }) => (Field | FieldAffectingData)[])\n | Field[]\n /**\n * Resolves an internal link node to a URL string for use in the markdown converter.\n * Internal links store a doc reference rather than a URL, so without this the markdown\n * output will have an empty href: `[link text]()`.\n */\n internalDocToHref?: (args: { linkNode: SerializedLinkNode }) => string\n /**\n * Sets a maximum population depth for the internal doc default field of link, regardless of the remaining depth when the field is reached.\n * This behaves exactly like the maxDepth properties of relationship and upload fields.\n *\n * {@link https://payloadcms.com/docs/getting-started/concepts#field-level-max-depth}\n */\n maxDepth?: number\n} & ExclusiveLinkCollectionsProps\n\nexport const LinkFeature = createServerFeature<\n LinkFeatureServerProps,\n LinkFeatureServerProps,\n ClientProps\n>({\n feature: async ({ config: _config, isRoot, parentIsLocalized, props }) => {\n if (!props) {\n props = {}\n }\n const validRelationships = _config.collections.map((c) => c.slug) || []\n\n const _transformedFields = transformExtraFields(\n props.fields ? props.fields : null,\n _config,\n props.enabledCollections,\n props.disabledCollections,\n props.maxDepth,\n )\n\n const sanitizedFields = await sanitizeFields({\n config: _config as unknown as Config,\n fields: _transformedFields,\n parentIsLocalized,\n requireFieldLevelRichTextEditor: isRoot,\n validRelationships,\n })\n props.fields = sanitizedFields\n\n // the text field is not included in the node data.\n // Thus, for tasks like validation, we do not want to pass it a text field in the schema which will never have data.\n // Otherwise, it will cause a validation error (field is required).\n const sanitizedFieldsWithoutText = sanitizedFields.filter(\n (field) => !('name' in field) || field.name !== 'text',\n )\n\n let linkTypeField: Field | null = null\n let linkURLField: Field | null = null\n\n for (const field of sanitizedFields) {\n if ('name' in field && field.name === 'linkType') {\n linkTypeField = field\n }\n\n if ('name' in field && field.name === 'url') {\n linkURLField = field\n }\n }\n\n const defaultLinkType = linkTypeField\n ? 'defaultValue' in linkTypeField && typeof linkTypeField.defaultValue === 'string'\n ? linkTypeField.defaultValue\n : 'custom'\n : undefined\n\n const defaultLinkURL = linkURLField\n ? 'defaultValue' in linkURLField && typeof linkURLField.defaultValue === 'string'\n ? linkURLField.defaultValue\n : 'https://'\n : undefined\n\n return {\n ClientFeature: '@payloadcms/richtext-lexical/client#LinkFeatureClient',\n clientFeatureProps: {\n defaultLinkType,\n defaultLinkURL,\n disableAutoLinks: props.disableAutoLinks,\n disabledCollections: props.disabledCollections,\n enabledCollections: props.enabledCollections,\n } as ClientProps,\n generateSchemaMap: () => {\n if (!sanitizedFields || !Array.isArray(sanitizedFields) || sanitizedFields.length === 0) {\n return null\n }\n\n const schemaMap: FieldSchemaMap = new Map()\n schemaMap.set('fields', {\n fields: sanitizedFields,\n })\n\n return schemaMap\n },\n i18n,\n markdownTransformers: [\n createLinkMarkdownTransformer({ internalDocToHref: props.internalDocToHref }),\n ],\n nodes: [\n props?.disableAutoLinks === true\n ? null\n : createNode({\n jsonSchema: createAutoLinkNodeJSONSchema(sanitizedFieldsWithoutText),\n node: AutoLinkNode,\n // Since AutoLinkNodes are just internal links, they need no hooks or graphQL population promises\n validations: [linkValidation(props, sanitizedFieldsWithoutText)],\n }),\n createNode({\n getSubFields: () => {\n return sanitizedFieldsWithoutText\n },\n getSubFieldsData: ({ node }) => {\n return node?.fields\n },\n graphQLPopulationPromises: [linkPopulationPromiseHOC(props)],\n jsonSchema: createLinkNodeJSONSchema(sanitizedFieldsWithoutText),\n node: LinkNode,\n validations: [linkValidation(props, sanitizedFieldsWithoutText)],\n }),\n ].filter(Boolean) as Array<NodeWithHooks>,\n sanitizedServerFeatureProps: props,\n }\n },\n key: 'link',\n})\n"],"mappings":"AASA,SAASA,cAAc,QAAQ;AAK/B,SAASC,mBAAmB,QAAQ;AACpC,SAASC,UAAU,QAAQ;AAC3B,SAASC,6BAA6B,QAAQ;AAC9C,SAASC,YAAY,QAAQ;AAC7B,SAASC,QAAQ,QAAQ;AACzB,SAASC,wBAAwB,QAAQ;AACzC,SAASC,IAAI,QAAQ;AACrB,SACEC,4BAA4B,EAC5BC,wBAAwB,QAEnB;AACP,SAASC,oBAAoB,QAAQ;AACrC,SAASC,cAAc,QAAQ;AA8D/B,OAAO,MAAMC,WAAA,GAAcX,mBAAA,CAIzB;EACAY,OAAA,EAAS,MAAAA,CAAO;IAAEC,MAAA,EAAQC,OAAO;IAAEC,MAAM;IAAEC,iBAAiB;IAAEC;EAAK,CAAE;IACnE,IAAI,CAACA,KAAA,EAAO;MACVA,KAAA,GAAQ,CAAC;IACX;IACA,MAAMC,kBAAA,GAAqBJ,OAAA,CAAQK,WAAW,CAACC,GAAG,CAAEC,CAAA,IAAMA,CAAA,CAAEC,IAAI,KAAK,EAAE;IAEvE,MAAMC,kBAAA,GAAqBd,oBAAA,CACzBQ,KAAA,CAAMO,MAAM,GAAGP,KAAA,CAAMO,MAAM,GAAG,MAC9BV,OAAA,EACAG,KAAA,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AAI,CAACf,eAAA,IAAmB,CAACgB,KAAA,CAAMC,OAAO,CAACjB,eAAA,KAAoBA,eAAA,CAAgBkB,MAAM,KAAK,GAAG;UACvF,OAAO;QACT;QAEA,MAAMC,SAAA,GAA4B,IAAIC,GAAA;QACtCD,SAAA,CAAUE,GAAG,CAAC,UAAU;UACtBzB,MAAA,EAAQI;QACV;QAEA,OAAOmB,SAAA;MACT;MACAzC,IAAA;MACA4C,oBAAA,EAAsB,CACpBhD,6BAAA,CAA8B;QAAEiD,iBAAA,EAAmBlC,KAAA,CAAMkC;MAAkB,GAC5E;MACDC,KAAA,EAAO,CACLnC,KAAA,EAAOyB,gBAAA,KAAqB,OACxB,OACAzC,UAAA,CAAW;QACToD,UAAA,EAAY9C,4BAAA,CAA6BuB,0BAAA;QACzCwB,IAAA,EAAMnD,YAAA;QACN;QACAoD,WAAA,EAAa,CAAC7C,cAAA,CAAeO,KAAA,EAAOa,0BAAA;MACtC,IACJ7B,UAAA,CAAW;QACTuD,YAAA,EAAcA,CAAA;UACZ,OAAO1B,0BAAA;QACT;QACA2B,gBAAA,EAAkBA,CAAC;UAAEH;QAAI,CAAE;UACzB,OAAOA,IAAA,EAAM9B,MAAA;QACf;QACAkC,yBAAA,EAA2B,CAACrD,wBAAA,CAAyBY,KAAA,EAAO;QAC5DoC,UAAA,EAAY7C,wBAAA,CAAyBsB,0BAAA;QACrCwB,IAAA,EAAMlD,QAAA;QACNmD,WAAA,EAAa,CAAC7C,cAAA,CAAeO,KAAA,EAAOa,0BAAA;MACtC,GACD,CAACC,MAAM,CAAC4B,OAAA;MACTC,2BAAA,EAA6B3C;IAC/B;EACF;EACA4C,GAAA,EAAK;AACP","ignoreList":[]}
1
+ {"version":3,"file":"index.js","names":["sanitizeFields","createServerFeature","createNode","createPayloadLinkTransformer","AutoLinkNode","LinkNode","linkPopulationPromiseHOC","i18n","createAutoLinkNodeJSONSchema","createLinkNodeJSONSchema","transformExtraFields","linkValidation","LinkFeature","feature","config","_config","isRoot","parentIsLocalized","props","validRelationships","collections","map","c","slug","_transformedFields","fields","enabledCollections","disabledCollections","maxDepth","sanitizedFields","requireFieldLevelRichTextEditor","sanitizedFieldsWithoutText","filter","field","name","linkTypeField","linkURLField","defaultLinkType","defaultValue","undefined","defaultLinkURL","ClientFeature","clientFeatureProps","disableAutoLinks","generateSchemaMap","Array","isArray","length","schemaMap","Map","set","markdownTransformers","internalDocToHref","nodes","jsonSchema","node","validations","getSubFields","getSubFieldsData","graphQLPopulationPromises","Boolean","sanitizedServerFeatureProps","key"],"sources":["../../../../src/features/link/server/index.ts"],"sourcesContent":["import type {\n CollectionSlug,\n Config,\n Field,\n FieldAffectingData,\n FieldSchemaMap,\n SanitizedConfig,\n} from 'payload'\n\nimport { sanitizeFields } from 'payload'\n\nimport type { NodeWithHooks } from '../../typesServer.js'\nimport type { ClientProps } from '../client/index.js'\n\nimport { createServerFeature } from '../../../utilities/createServerFeature.js'\nimport { createNode } from '../../typeUtilities.js'\nimport { createPayloadLinkTransformer } from '../markdownTransformer.js'\nimport { AutoLinkNode } from '../nodes/AutoLinkNode.js'\nimport { LinkNode } from '../nodes/LinkNode.js'\nimport { linkPopulationPromiseHOC } from './graphQLPopulationPromise.js'\nimport { i18n } from './i18n.js'\nimport {\n createAutoLinkNodeJSONSchema,\n createLinkNodeJSONSchema,\n type SerializedLinkNode,\n} from './schema.js'\nimport { transformExtraFields } from './transformExtraFields.js'\nimport { linkValidation } from './validate.js'\n\nexport type { LinkFields, SerializedAutoLinkNode, SerializedLinkNode } from './schema.js'\n\nexport type ExclusiveLinkCollectionsProps =\n | {\n /**\n * The collections that should be disabled for internal linking. Overrides the `enableRichTextLink` property in the collection config.\n * When this property is set, `enabledCollections` will not be available.\n **/\n disabledCollections?: CollectionSlug[]\n\n // Ensures that enabledCollections is not available when disabledCollections is set\n enabledCollections?: never\n }\n | {\n // Ensures that disabledCollections is not available when enabledCollections is set\n disabledCollections?: never\n\n /**\n * The collections that should be enabled for internal linking. Overrides the `enableRichTextLink` property in the collection config\n * When this property is set, `disabledCollections` will not be available.\n **/\n enabledCollections?: CollectionSlug[]\n }\n\nexport type LinkFeatureServerProps = {\n /**\n * Disables the automatic creation of links from URLs pasted into the editor, as well\n * as auto link nodes.\n *\n * If set to 'creationOnly', only the creation of new auto link nodes will be disabled.\n * Existing auto link nodes will still be editable.\n *\n * @default false\n */\n disableAutoLinks?: 'creationOnly' | true\n /**\n * A function or array defining additional fields for the link feature. These will be\n * displayed in the link editor drawer.\n */\n fields?:\n | ((args: {\n config: SanitizedConfig\n defaultFields: FieldAffectingData[]\n }) => (Field | FieldAffectingData)[])\n | Field[]\n /**\n * Resolves an internal link node to a URL string for use in the markdown converter.\n * Internal links store a doc reference rather than a URL, so without this the markdown\n * output will have an empty href: `[link text]()`.\n */\n internalDocToHref?: (args: { linkNode: SerializedLinkNode }) => string\n /**\n * Sets a maximum population depth for the internal doc default field of link, regardless of the remaining depth when the field is reached.\n * This behaves exactly like the maxDepth properties of relationship and upload fields.\n *\n * {@link https://payloadcms.com/docs/getting-started/concepts#field-level-max-depth}\n */\n maxDepth?: number\n} & ExclusiveLinkCollectionsProps\n\nexport const LinkFeature = createServerFeature<\n LinkFeatureServerProps,\n LinkFeatureServerProps,\n ClientProps\n>({\n feature: async ({ config: _config, isRoot, parentIsLocalized, props }) => {\n if (!props) {\n props = {}\n }\n const validRelationships = _config.collections.map((c) => c.slug) || []\n\n const _transformedFields = transformExtraFields(\n props.fields ? props.fields : null,\n _config,\n props.enabledCollections,\n props.disabledCollections,\n props.maxDepth,\n )\n\n const sanitizedFields = await sanitizeFields({\n config: _config as unknown as Config,\n fields: _transformedFields,\n parentIsLocalized,\n requireFieldLevelRichTextEditor: isRoot,\n validRelationships,\n })\n props.fields = sanitizedFields\n\n // the text field is not included in the node data.\n // Thus, for tasks like validation, we do not want to pass it a text field in the schema which will never have data.\n // Otherwise, it will cause a validation error (field is required).\n const sanitizedFieldsWithoutText = sanitizedFields.filter(\n (field) => !('name' in field) || field.name !== 'text',\n )\n\n let linkTypeField: Field | null = null\n let linkURLField: Field | null = null\n\n for (const field of sanitizedFields) {\n if ('name' in field && field.name === 'linkType') {\n linkTypeField = field\n }\n\n if ('name' in field && field.name === 'url') {\n linkURLField = field\n }\n }\n\n const defaultLinkType = linkTypeField\n ? 'defaultValue' in linkTypeField && typeof linkTypeField.defaultValue === 'string'\n ? linkTypeField.defaultValue\n : 'custom'\n : undefined\n\n const defaultLinkURL = linkURLField\n ? 'defaultValue' in linkURLField && typeof linkURLField.defaultValue === 'string'\n ? linkURLField.defaultValue\n : 'https://'\n : undefined\n\n return {\n ClientFeature: '@payloadcms/richtext-lexical/client#LinkFeatureClient',\n clientFeatureProps: {\n defaultLinkType,\n defaultLinkURL,\n disableAutoLinks: props.disableAutoLinks,\n disabledCollections: props.disabledCollections,\n enabledCollections: props.enabledCollections,\n } as ClientProps,\n generateSchemaMap: () => {\n if (!sanitizedFields || !Array.isArray(sanitizedFields) || sanitizedFields.length === 0) {\n return null\n }\n\n const schemaMap: FieldSchemaMap = new Map()\n schemaMap.set('fields', {\n fields: sanitizedFields,\n })\n\n return schemaMap\n },\n i18n,\n markdownTransformers: [\n createPayloadLinkTransformer({ internalDocToHref: props.internalDocToHref }),\n ],\n nodes: [\n props?.disableAutoLinks === true\n ? null\n : createNode({\n jsonSchema: createAutoLinkNodeJSONSchema(sanitizedFieldsWithoutText),\n node: AutoLinkNode,\n // Since AutoLinkNodes are just internal links, they need no hooks or graphQL population promises\n validations: [linkValidation(props, sanitizedFieldsWithoutText)],\n }),\n createNode({\n getSubFields: () => {\n return sanitizedFieldsWithoutText\n },\n getSubFieldsData: ({ node }) => {\n return node?.fields\n },\n graphQLPopulationPromises: [linkPopulationPromiseHOC(props)],\n jsonSchema: createLinkNodeJSONSchema(sanitizedFieldsWithoutText),\n node: LinkNode,\n validations: [linkValidation(props, sanitizedFieldsWithoutText)],\n }),\n ].filter(Boolean) as Array<NodeWithHooks>,\n sanitizedServerFeatureProps: props,\n }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W;QACToD,UAAA,EAAY9C,4BAAA,CAA6BuB,0BAAA;QACzCwB,IAAA,EAAMnD,YAAA;QACN;QACAoD,WAAA,EAAa,CAAC7C,cAAA,CAAeO,KAAA,EAAOa,0BAAA;MACtC,IACJ7B,UAAA,CAAW;QACTuD,YAAA,EAAcA,CAAA;UACZ,OAAO1B,0BAAA;QACT;QACA2B,gBAAA,EAAkBA,CAAC;UAAEH;QAAI,CAAE;UACzB,OAAOA,IAAA,EAAM9B,MAAA;QACf;QACAkC,yBAAA,EAA2B,CAACrD,wBAAA,CAAyBY,KAAA,EAAO;QAC5DoC,UAAA,EAAY7C,wBAAA,CAAyBsB,0BAAA;QACrCwB,IAAA,EAAMlD,QAAA;QACNmD,WAAA,EAAa,CAAC7C,cAAA,CAAeO,KAAA,EAAOa,0BAAA;MACtC,GACD,CAACC,MAAM,CAAC4B,OAAA;MACTC,2BAAA,EAA6B3C;IAC/B;EACF;EACA4C,GAAA,EAAK;AACP","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../../../src/features/link/server/schema.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAA;AACpD,OAAO,KAAK,EAAE,qBAAqB,EAAE,KAAK,EAAE,MAAM,SAAS,CAAA;AAI3D,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,6BAA6B,CAAA;AAC/E,OAAO,KAAK,EAAkB,YAAY,EAAE,MAAM,sBAAsB,CAAA;AAExE,MAAM,MAAM,UAAU,GAAG;IACvB,6DAA6D;IAC7D,CAAC,CAAC,EAAE,MAAM,GAAG,OAAO,CAAA;IACpB,GAAG,CAAC,EAAE;QACJ,UAAU,EAAE,MAAM,CAAA;QAClB,yEAAyE;QACzE,KAAK,EAAE;YAAE,CAAC,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;YAAC,EAAE,EAAE,qBAAqB,CAAA;SAAE,GAAG,qBAAqB,CAAA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E;YAAE,CAAC,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;YAAC,EAAE,EAAE,qBAAqB,CAAA;SAAE,GAAG,qBAAqB,CAAA;KACnF,GAAG,IAAI,CAAA;IACR,QAAQ,EAAE,QAAQ,GAAG,UAAU,CAAA;IAC/B,MAAM,EAAE,OAAO,CAAA;IACf,GAAG,CAAC,EAAE,MAAM,CAAA;CACb,CAAA;AAED,MAAM,WAAW,kBAAkB,CACjC,SAAS,SAAS,qBAAqB,GAAG,qBAAqB,EAC/D,OAAO,GAAG,UAAU,CACpB,SAAQ,4BAA4B,CAAC,SAAS,CAAC;IAC/C,MAAM,EAAE,OAAO,CAAA;IACf,mEAAmE;IACnE,EAAE,CAAC,EAAE,MAAM,CAAA;IACX,IAAI,EAAE,MAAM,CAAA;CACb;AAED,MAAM,WAAW,sBAAsB,CACrC,SAAS,SAAS,qBAAqB,GAAG,qBAAqB,EAC/D,OAAO,GAAG,UAAU,CACpB,SAAQ,4BAA4B,CAAC,SAAS,CAAC;IAC/C,MAAM,EAAE,OAAO,CAAA;IACf,IAAI,EAAE,UAAU,CAAA;CACjB;AAuHD,eAAO,MAAM,wBAAwB,+BACN,KAAK,EAAE,KAAG,YActC,CAAA;AAEH,eAAO,MAAM,4BAA4B,+BACV,KAAK,EAAE,KAAG,YAatC,CAAA"}
@@ -1,3 +1,4 @@
1
+ import { createHash } from 'crypto';
1
2
  import { fieldsToJSONSchema, flattenAllFields } from 'payload';
2
3
  /**
3
4
  * MUST stay byte-for-byte in sync with the runtime `LinkFields`, `SerializedLinkNode`,
@@ -27,7 +28,8 @@ const buildLinkFieldsJSONSchema = (sanitizedFieldsWithoutText, {
27
28
  config,
28
29
  i18n,
29
30
  interfaceNameDefinitions,
30
- typeStringDefinitions
31
+ typeStringDefinitions,
32
+ variant
31
33
  }) => {
32
34
  const flattenedExtraFields = flattenAllFields({
33
35
  fields: sanitizedFieldsWithoutText
@@ -38,7 +40,8 @@ const buildLinkFieldsJSONSchema = (sanitizedFieldsWithoutText, {
38
40
  fields: flattenedExtraFields,
39
41
  i18n,
40
42
  interfaceNameDefinitions,
41
- typeStringDefinitions
43
+ typeStringDefinitions,
44
+ variant
42
45
  }) : {
43
46
  properties: {},
44
47
  required: []
@@ -91,15 +94,18 @@ const buildLinkFieldsJSONSchema = (sanitizedFieldsWithoutText, {
91
94
  type: 'string'
92
95
  }
93
96
  },
94
- required: ['linkType', 'newTab', ...userFieldsSchema.required]
97
+ // `linkType`/`newTab` are already in `userFieldsSchema.required`; use Set to dedupe,
98
+ // so `required` stays unique (draft 2020-12 enforces `uniqueItems`).
99
+ required: [...new Set(['linkType', 'newTab', ...userFieldsSchema.required])]
95
100
  };
96
101
  };
97
102
  /** Fields auto-attached by `LinkFeature` (see `transformExtraFields`). */
98
103
  const STANDARD_LINK_FIELD_NAMES = new Set(['doc', 'linkType', 'newTab', 'url']);
104
+ const hashLinkFields = schema => createHash('sha256').update(JSON.stringify(schema)).digest('hex').slice(0, 8).toUpperCase();
99
105
  /**
100
- * With custom link fields, emit a per-editor `LexicalLinkFields_<hash>`
101
- * interface so the link node picks up their real shape. Without any,
102
- * reuse the default `LexicalLinkFields` for cross-alias assignability.
106
+ * With custom link fields, emit a `LexicalLinkFields_<hash>` interface (hashed by its own content)
107
+ * so the link node picks up their real shape. Without any, reuse the default `LexicalLinkFields` for
108
+ * cross-alias assignability.
103
109
  */
104
110
  const resolveLinkFieldsRef = (sanitizedFieldsWithoutText, args) => {
105
111
  const fieldsSchema = buildLinkFieldsJSONSchema(sanitizedFieldsWithoutText, args);
@@ -110,12 +116,11 @@ const resolveLinkFieldsRef = (sanitizedFieldsWithoutText, args) => {
110
116
  fieldsTypeName: 'LexicalLinkFields'
111
117
  };
112
118
  }
113
- const editorHash = args.nodeUnionName.replace(/^LexicalNodes_/, '');
114
- const fieldsTypeName = `LexicalLinkFields_${editorHash}`;
119
+ const fieldsTypeName = `LexicalLinkFields_${hashLinkFields(fieldsSchema)}`;
115
120
  args.interfaceNameDefinitions.set(fieldsTypeName, fieldsSchema);
116
121
  return {
117
122
  fieldsRef: {
118
- $ref: `#/definitions/${fieldsTypeName}`
123
+ $ref: `#/$defs/${fieldsTypeName}`
119
124
  },
120
125
  fieldsTypeName
121
126
  };
@@ -1 +1 @@
1
- {"version":3,"file":"schema.js","names":["fieldsToJSONSchema","flattenAllFields","LINK_NODES_TS","buildLinkFieldsJSONSchema","sanitizedFieldsWithoutText","collectionIDFieldTypes","config","i18n","interfaceNameDefinitions","typeStringDefinitions","flattenedExtraFields","fields","userFieldsSchema","length","properties","required","type","additionalProperties","doc","oneOf","relationTo","value","id","linkType","enum","newTab","url","STANDARD_LINK_FIELD_NAMES","Set","resolveLinkFieldsRef","args","fieldsSchema","hasUserExtras","some","field","has","name","fieldsRef","fieldsTypeName","editorHash","nodeUnionName","replace","set","$ref","createLinkNodeJSONSchema","elementNodeSchema","add","nodeType","tsType","createAutoLinkNodeJSONSchema"],"sources":["../../../../src/features/link/server/schema.ts"],"sourcesContent":["import type { JSONSchema4 } from 'json-schema'\nimport type { SerializedLexicalNode } from 'lexical'\nimport type { DefaultDocumentIDType, Field } from 'payload'\n\nimport { fieldsToJSONSchema, flattenAllFields } from 'payload'\n\nimport type { SerializedLexicalElementBase } from '../../../types/nodeTypes.js'\nimport type { JSONSchemaArgs, JSONSchemaFn } from '../../typesServer.js'\n\nexport type LinkFields = {\n /** Custom fields added via `LinkFeature`'s `fields` prop. */\n [k: string]: unknown\n doc?: {\n relationTo: string\n /** Document ID, or the full doc when populated by the afterRead hook. */\n value: { [k: string]: unknown; id: DefaultDocumentIDType } | DefaultDocumentIDType\n } | null\n linkType: 'custom' | 'internal'\n newTab: boolean\n url?: string\n}\n\nexport interface SerializedLinkNode<\n TChildren extends SerializedLexicalNode = SerializedLexicalNode,\n TFields = LinkFields,\n> extends SerializedLexicalElementBase<TChildren> {\n fields: TFields\n /** @todo make required in 4.0 and type AutoLinkNode differently */\n id?: string\n type: 'link'\n}\n\nexport interface SerializedAutoLinkNode<\n TChildren extends SerializedLexicalNode = SerializedLexicalNode,\n TFields = LinkFields,\n> extends SerializedLexicalElementBase<TChildren> {\n fields: TFields\n type: 'autolink'\n}\n\n/**\n * MUST stay byte-for-byte in sync with the runtime `LinkFields`, `SerializedLinkNode`,\n * and `SerializedAutoLinkNode` declared above.\n */\nconst LINK_NODES_TS = `export interface LexicalLinkFields {\n [k: string]: unknown;\n doc?: {\n relationTo: string;\n value: Config['db']['defaultIDType'] | { [k: string]: unknown; id: Config['db']['defaultIDType'] };\n } | null;\n linkType: 'custom' | 'internal';\n newTab: boolean;\n url?: string;\n}\nexport interface SerializedLinkNode<TChildren, TFields = LexicalLinkFields> extends SerializedLexicalElementBase<TChildren> {\n type: 'link';\n fields: TFields;\n id?: string;\n}\nexport interface SerializedAutoLinkNode<TChildren, TFields = LexicalLinkFields> extends SerializedLexicalElementBase<TChildren> {\n type: 'autolink';\n fields: TFields;\n}`\n\nconst buildLinkFieldsJSONSchema = (\n sanitizedFieldsWithoutText: Field[],\n {\n collectionIDFieldTypes,\n config,\n i18n,\n interfaceNameDefinitions,\n typeStringDefinitions,\n }: JSONSchemaArgs,\n): JSONSchema4 => {\n const flattenedExtraFields = flattenAllFields({ fields: sanitizedFieldsWithoutText })\n const userFieldsSchema =\n flattenedExtraFields.length > 0 && config\n ? fieldsToJSONSchema({\n collectionIDFieldTypes,\n config,\n fields: flattenedExtraFields,\n i18n,\n interfaceNameDefinitions,\n typeStringDefinitions,\n })\n : { properties: {}, required: [] }\n\n return {\n type: 'object',\n additionalProperties: false,\n properties: {\n ...userFieldsSchema.properties,\n doc: {\n oneOf: [\n {\n type: 'object',\n additionalProperties: false,\n properties: {\n relationTo: { type: 'string' },\n value: {\n oneOf: [\n { type: 'string' },\n { type: 'number' },\n // Populated form (afterRead inflates `value` into the doc).\n {\n type: 'object',\n additionalProperties: true,\n properties: { id: { type: ['string', 'number'] } },\n required: ['id'],\n },\n ],\n },\n },\n required: ['relationTo', 'value'],\n },\n { type: 'null' },\n ],\n },\n linkType: { type: 'string', enum: ['custom', 'internal'] },\n newTab: { type: 'boolean' },\n url: { type: 'string' },\n },\n required: ['linkType', 'newTab', ...userFieldsSchema.required],\n }\n}\n\n/** Fields auto-attached by `LinkFeature` (see `transformExtraFields`). */\nconst STANDARD_LINK_FIELD_NAMES = new Set(['doc', 'linkType', 'newTab', 'url'])\n\n/**\n * With custom link fields, emit a per-editor `LexicalLinkFields_<hash>`\n * interface so the link node picks up their real shape. Without any,\n * reuse the default `LexicalLinkFields` for cross-alias assignability.\n */\nconst resolveLinkFieldsRef = (\n sanitizedFieldsWithoutText: Field[],\n args: JSONSchemaArgs,\n): { fieldsRef: JSONSchema4; fieldsTypeName: string } => {\n const fieldsSchema = buildLinkFieldsJSONSchema(sanitizedFieldsWithoutText, args)\n const hasUserExtras = sanitizedFieldsWithoutText.some(\n (field) => 'name' in field && !STANDARD_LINK_FIELD_NAMES.has(field.name),\n )\n if (!hasUserExtras) {\n return { fieldsRef: fieldsSchema, fieldsTypeName: 'LexicalLinkFields' }\n }\n const editorHash = args.nodeUnionName.replace(/^LexicalNodes_/, '')\n const fieldsTypeName = `LexicalLinkFields_${editorHash}`\n args.interfaceNameDefinitions.set(fieldsTypeName, fieldsSchema)\n return { fieldsRef: { $ref: `#/definitions/${fieldsTypeName}` }, fieldsTypeName }\n}\n\nexport const createLinkNodeJSONSchema =\n (sanitizedFieldsWithoutText: Field[]): JSONSchemaFn =>\n (args) => {\n const { elementNodeSchema, nodeUnionName, typeStringDefinitions } = args\n typeStringDefinitions.add(LINK_NODES_TS)\n const { fieldsRef, fieldsTypeName } = resolveLinkFieldsRef(sanitizedFieldsWithoutText, args)\n return elementNodeSchema({\n nodeType: 'link',\n properties: {\n id: { type: 'string' },\n fields: fieldsRef,\n },\n required: ['fields'],\n tsType: `SerializedLinkNode<${nodeUnionName}, ${fieldsTypeName}>`,\n })\n }\n\nexport const createAutoLinkNodeJSONSchema =\n (sanitizedFieldsWithoutText: Field[]): JSONSchemaFn =>\n (args) => {\n const { elementNodeSchema, nodeUnionName, typeStringDefinitions } = args\n typeStringDefinitions.add(LINK_NODES_TS)\n const { fieldsRef, fieldsTypeName } = resolveLinkFieldsRef(sanitizedFieldsWithoutText, args)\n return elementNodeSchema({\n nodeType: 'autolink',\n properties: {\n fields: fieldsRef,\n },\n required: ['fields'],\n tsType: `SerializedAutoLinkNode<${nodeUnionName}, ${fieldsTypeName}>`,\n })\n }\n"],"mappings":"AAIA,SAASA,kBAAkB,EAAEC,gBAAgB,QAAQ;AAoCrD;;;;AAIA,MAAMC,aAAA,GAAgB;;;;;;;;;;;;;;;;;;EAkBpB;AAEF,MAAMC,yBAAA,GAA4BA,CAChCC,0BAAA,EACA;EACEC,sBAAsB;EACtBC,MAAM;EACNC,IAAI;EACJC,wBAAwB;EACxBC;AAAqB,CACN;EAEjB,MAAMC,oBAAA,GAAuBT,gBAAA,CAAiB;IAAEU,MAAA,EAAQP;EAA2B;EACnF,MAAMQ,gBAAA,GACJF,oBAAA,CAAqBG,MAAM,GAAG,KAAKP,MAAA,GAC/BN,kBAAA,CAAmB;IACjBK,sBAAA;IACAC,MAAA;IACAK,MAAA,EAAQD,oBAAA;IACRH,IAAA;IACAC,wBAAA;IACAC;EACF,KACA;IAAEK,UAAA,EAAY,CAAC;IAAGC,QAAA,EAAU;EAAG;EAErC,OAAO;IACLC,IAAA,EAAM;IACNC,oBAAA,EAAsB;IACtBH,UAAA,EAAY;MACV,GAAGF,gBAAA,CAAiBE,UAAU;MAC9BI,GAAA,EAAK;QACHC,KAAA,EAAO,CACL;UACEH,IAAA,EAAM;UACNC,oBAAA,EAAsB;UACtBH,UAAA,EAAY;YACVM,UAAA,EAAY;cAAEJ,IAAA,EAAM;YAAS;YAC7BK,KAAA,EAAO;cACLF,KAAA,EAAO,CACL;gBAAEH,IAAA,EAAM;cAAS,GACjB;gBAAEA,IAAA,EAAM;cAAS;cACjB;cACA;gBACEA,IAAA,EAAM;gBACNC,oBAAA,EAAsB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ACVxC,0BAAA,IACA0B,IAAA;EACC,MAAM;IAAEe,iBAAiB;IAAEL,aAAa;IAAE/B;EAAqB,CAAE,GAAGqB,IAAA;EACpErB,qBAAA,CAAsBqC,GAAG,CAAC5C,aAAA;EAC1B,MAAM;IAAEmC,SAAS;IAAEC;EAAc,CAAE,GAAGT,oBAAA,CAAqBzB,0BAAA,EAA4B0B,IAAA;EACvF,OAAOe,iBAAA,CAAkB;IACvBE,QAAA,EAAU;IACVjC,UAAA,EAAY;MACVQ,EAAA,EAAI;QAAEN,IAAA,EAAM;MAAS;MACrBL,MAAA,EAAQ0B;IACV;IACAtB,QAAA,EAAU,CAAC,SAAS;IACpBiC,MAAA,EAAQ,sBAAsBR,aAAA,KAAkBF,cAAA;EAClD;AACF;AAEF,OAAO,MAAMW,4BAAA,GACV7C,0BAAA,IACA0B,IAAA;EACC,MAAM;IAAEe,iBAAiB;IAAEL,aAAa;IAAE/B;EAAqB,CAAE,GAAGqB,IAAA;EACpErB,qBAAA,CAAsBqC,GAAG,CAAC5C,aAAA;EAC1B,MAAM;IAAEmC,SAAS;IAAEC;EAAc,CAAE,GAAGT,oBAAA,CAAqBzB,0BAAA,EAA4B0B,IAAA;EACvF,OAAOe,iBAAA,CAAkB;IACvBE,QAAA,EAAU;IACVjC,UAAA,EAAY;MACVH,MAAA,EAAQ0B;IACV;IACAtB,QAAA,EAAU,CAAC,SAAS;IACpBiC,MAAA,EAAQ,0BAA0BR,aAAA,KAAkBF,cAAA;EACtD;AACF","ignoreList":[]}
1
+ {"version":3,"file":"schema.js","names":["createHash","fieldsToJSONSchema","flattenAllFields","LINK_NODES_TS","buildLinkFieldsJSONSchema","sanitizedFieldsWithoutText","collectionIDFieldTypes","config","i18n","interfaceNameDefinitions","typeStringDefinitions","variant","flattenedExtraFields","fields","userFieldsSchema","length","properties","required","type","additionalProperties","doc","oneOf","relationTo","value","id","linkType","enum","newTab","url","Set","STANDARD_LINK_FIELD_NAMES","hashLinkFields","schema","update","JSON","stringify","digest","slice","toUpperCase","resolveLinkFieldsRef","args","fieldsSchema","hasUserExtras","some","field","has","name","fieldsRef","fieldsTypeName","set","$ref","createLinkNodeJSONSchema","elementNodeSchema","nodeUnionName","add","nodeType","tsType","createAutoLinkNodeJSONSchema"],"sources":["../../../../src/features/link/server/schema.ts"],"sourcesContent":["import type { JSONSchema4 } from 'json-schema'\nimport type { SerializedLexicalNode } from 'lexical'\nimport type { DefaultDocumentIDType, Field } from 'payload'\n\nimport { createHash } from 'crypto'\nimport { fieldsToJSONSchema, flattenAllFields } from 'payload'\n\nimport type { SerializedLexicalElementBase } from '../../../types/nodeTypes.js'\nimport type { JSONSchemaArgs, JSONSchemaFn } from '../../typesServer.js'\n\nexport type LinkFields = {\n /** Custom fields added via `LinkFeature`'s `fields` prop. */\n [k: string]: unknown\n doc?: {\n relationTo: string\n /** Document ID, or the full doc when populated by the afterRead hook. */\n value: { [k: string]: unknown; id: DefaultDocumentIDType } | DefaultDocumentIDType\n } | null\n linkType: 'custom' | 'internal'\n newTab: boolean\n url?: string\n}\n\nexport interface SerializedLinkNode<\n TChildren extends SerializedLexicalNode = SerializedLexicalNode,\n TFields = LinkFields,\n> extends SerializedLexicalElementBase<TChildren> {\n fields: TFields\n /** @todo make required in 4.0 and type AutoLinkNode differently */\n id?: string\n type: 'link'\n}\n\nexport interface SerializedAutoLinkNode<\n TChildren extends SerializedLexicalNode = SerializedLexicalNode,\n TFields = LinkFields,\n> extends SerializedLexicalElementBase<TChildren> {\n fields: TFields\n type: 'autolink'\n}\n\n/**\n * MUST stay byte-for-byte in sync with the runtime `LinkFields`, `SerializedLinkNode`,\n * and `SerializedAutoLinkNode` declared above.\n */\nconst LINK_NODES_TS = `export interface LexicalLinkFields {\n [k: string]: unknown;\n doc?: {\n relationTo: string;\n value: Config['db']['defaultIDType'] | { [k: string]: unknown; id: Config['db']['defaultIDType'] };\n } | null;\n linkType: 'custom' | 'internal';\n newTab: boolean;\n url?: string;\n}\nexport interface SerializedLinkNode<TChildren, TFields = LexicalLinkFields> extends SerializedLexicalElementBase<TChildren> {\n type: 'link';\n fields: TFields;\n id?: string;\n}\nexport interface SerializedAutoLinkNode<TChildren, TFields = LexicalLinkFields> extends SerializedLexicalElementBase<TChildren> {\n type: 'autolink';\n fields: TFields;\n}`\n\nconst buildLinkFieldsJSONSchema = (\n sanitizedFieldsWithoutText: Field[],\n {\n collectionIDFieldTypes,\n config,\n i18n,\n interfaceNameDefinitions,\n typeStringDefinitions,\n variant,\n }: JSONSchemaArgs,\n): JSONSchema4 => {\n const flattenedExtraFields = flattenAllFields({ fields: sanitizedFieldsWithoutText })\n const userFieldsSchema =\n flattenedExtraFields.length > 0 && config\n ? fieldsToJSONSchema({\n collectionIDFieldTypes,\n config,\n fields: flattenedExtraFields,\n i18n,\n interfaceNameDefinitions,\n typeStringDefinitions,\n variant,\n })\n : { properties: {}, required: [] }\n\n return {\n type: 'object',\n additionalProperties: false,\n properties: {\n ...userFieldsSchema.properties,\n doc: {\n oneOf: [\n {\n type: 'object',\n additionalProperties: false,\n properties: {\n relationTo: { type: 'string' },\n value: {\n oneOf: [\n { type: 'string' },\n { type: 'number' },\n // Populated form (afterRead inflates `value` into the doc).\n {\n type: 'object',\n additionalProperties: true,\n properties: { id: { type: ['string', 'number'] } },\n required: ['id'],\n },\n ],\n },\n },\n required: ['relationTo', 'value'],\n },\n { type: 'null' },\n ],\n },\n linkType: { type: 'string', enum: ['custom', 'internal'] },\n newTab: { type: 'boolean' },\n url: { type: 'string' },\n },\n // `linkType`/`newTab` are already in `userFieldsSchema.required`; use Set to dedupe,\n // so `required` stays unique (draft 2020-12 enforces `uniqueItems`).\n required: [...new Set(['linkType', 'newTab', ...userFieldsSchema.required])],\n }\n}\n\n/** Fields auto-attached by `LinkFeature` (see `transformExtraFields`). */\nconst STANDARD_LINK_FIELD_NAMES = new Set(['doc', 'linkType', 'newTab', 'url'])\n\nconst hashLinkFields = (schema: JSONSchema4): string =>\n createHash('sha256').update(JSON.stringify(schema)).digest('hex').slice(0, 8).toUpperCase()\n\n/**\n * With custom link fields, emit a `LexicalLinkFields_<hash>` interface (hashed by its own content)\n * so the link node picks up their real shape. Without any, reuse the default `LexicalLinkFields` for\n * cross-alias assignability.\n */\nconst resolveLinkFieldsRef = (\n sanitizedFieldsWithoutText: Field[],\n args: JSONSchemaArgs,\n): { fieldsRef: JSONSchema4; fieldsTypeName: string } => {\n const fieldsSchema = buildLinkFieldsJSONSchema(sanitizedFieldsWithoutText, args)\n const hasUserExtras = sanitizedFieldsWithoutText.some(\n (field) => 'name' in field && !STANDARD_LINK_FIELD_NAMES.has(field.name),\n )\n if (!hasUserExtras) {\n return { fieldsRef: fieldsSchema, fieldsTypeName: 'LexicalLinkFields' }\n }\n const fieldsTypeName = `LexicalLinkFields_${hashLinkFields(fieldsSchema)}`\n args.interfaceNameDefinitions.set(fieldsTypeName, fieldsSchema)\n return { fieldsRef: { $ref: `#/$defs/${fieldsTypeName}` }, fieldsTypeName }\n}\n\nexport const createLinkNodeJSONSchema =\n (sanitizedFieldsWithoutText: Field[]): JSONSchemaFn =>\n (args) => {\n const { elementNodeSchema, nodeUnionName, typeStringDefinitions } = args\n typeStringDefinitions.add(LINK_NODES_TS)\n const { fieldsRef, fieldsTypeName } = resolveLinkFieldsRef(sanitizedFieldsWithoutText, args)\n return elementNodeSchema({\n nodeType: 'link',\n properties: {\n id: { type: 'string' },\n fields: fieldsRef,\n },\n required: ['fields'],\n tsType: `SerializedLinkNode<${nodeUnionName}, ${fieldsTypeName}>`,\n })\n }\n\nexport const createAutoLinkNodeJSONSchema =\n (sanitizedFieldsWithoutText: Field[]): JSONSchemaFn =>\n (args) => {\n const { elementNodeSchema, nodeUnionName, typeStringDefinitions } = args\n typeStringDefinitions.add(LINK_NODES_TS)\n const { fieldsRef, fieldsTypeName } = resolveLinkFieldsRef(sanitizedFieldsWithoutText, args)\n return elementNodeSchema({\n nodeType: 'autolink',\n properties: {\n fields: fieldsRef,\n },\n required: ['fields'],\n tsType: `Serializ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MAAM;IAAEY,iBAAiB;IAAEC,aAAa;IAAE3C;EAAqB,CAAE,GAAG8B,IAAA;EACpE9B,qBAAA,CAAsB4C,GAAG,CAACnD,aAAA;EAC1B,MAAM;IAAE4C,SAAS;IAAEC;EAAc,CAAE,GAAGT,oBAAA,CAAqBlC,0BAAA,EAA4BmC,IAAA;EACvF,OAAOY,iBAAA,CAAkB;IACvBG,QAAA,EAAU;IACVvC,UAAA,EAAY;MACVQ,EAAA,EAAI;QAAEN,IAAA,EAAM;MAAS;MACrBL,MAAA,EAAQkC;IACV;IACA9B,QAAA,EAAU,CAAC,SAAS;IACpBuC,MAAA,EAAQ,sBAAsBH,aAAA,KAAkBL,cAAA;EAClD;AACF;AAEF,OAAO,MAAMS,4BAAA,GACVpD,0BAAA,IACAmC,IAAA;EACC,MAAM;IAAEY,iBAAiB;IAAEC,aAAa;IAAE3C;EAAqB,CAAE,GAAG8B,IAAA;EACpE9B,qBAAA,CAAsB4C,GAAG,CAACnD,aAAA;EAC1B,MAAM;IAAE4C,SAAS;IAAEC;EAAc,CAAE,GAAGT,oBAAA,CAAqBlC,0BAAA,EAA4BmC,IAAA;EACvF,OAAOY,iBAAA,CAAkB;IACvBG,QAAA,EAAU;IACVvC,UAAA,EAAY;MACVH,MAAA,EAAQkC;IACV;IACA9B,QAAA,EAAU,CAAC,SAAS;IACpBuC,MAAA,EAAQ,0BAA0BH,aAAA,KAAkBL,cAAA;EACtD;AACF","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"validate.d.ts","sourceRoot":"","sources":["../../../../src/features/link/server/validate.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,SAAS,CAAA;AAIpC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;AAC1D,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,YAAY,CAAA;AACxD,OAAO,KAAK,EAAE,sBAAsB,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAA;AAE7E,eAAO,MAAM,cAAc,GACzB,OAAO,sBAAsB,EAC7B,4BAA4B,KAAK,EAAE,KAClC,cAAc,CAAC,sBAAsB,GAAG,kBAAkB,CA4C5D,CAAA"}
1
+ {"version":3,"file":"validate.d.ts","sourceRoot":"","sources":["../../../../src/features/link/server/validate.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,SAAS,CAAA;AAIpC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;AAC1D,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,YAAY,CAAA;AACxD,OAAO,KAAK,EAAE,sBAAsB,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAA;AAE7E,eAAO,MAAM,cAAc,UAClB,sBAAsB,8BACD,KAAK,EAAE,KAClC,cAAc,CAAC,sBAAsB,GAAG,kBAAkB,CA4C5D,CAAA"}
@@ -1,6 +1,7 @@
1
1
  'use client';
2
2
 
3
3
  import { $isListNode, INSERT_CHECK_LIST_COMMAND, ListItemNode, ListNode } from '@lexical/list';
4
+ import { CHECK_LIST } from '@lexical/markdown';
4
5
  import { $isRangeSelection } from 'lexical';
5
6
  import { ChecklistIcon } from '../../../../lexical/ui/icons/Checklist/index.js';
6
7
  import { createClientFeature } from '../../../../utilities/createClientFeature.js';
@@ -8,7 +9,6 @@ import { toolbarTextDropdownGroupWithItems } from '../../../shared/toolbar/textD
8
9
  import { LexicalListPlugin } from '../../plugin/index.js';
9
10
  import { shouldRegisterListBaseNodes } from '../../shared/shouldRegisterListBaseNodes.js';
10
11
  import { slashMenuListGroupWithItems } from '../../shared/slashMenuListGroup.js';
11
- import { CHECK_LIST } from '../markdownTransformers.js';
12
12
  import { LexicalCheckListPlugin } from './plugin/index.js';
13
13
  const toolbarGroups = [toolbarTextDropdownGroupWithItems([{
14
14
  ChildComponent: ChecklistIcon,
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["$isListNode","INSERT_CHECK_LIST_COMMAND","ListItemNode","ListNode","$isRangeSelection","ChecklistIcon","createClientFeature","toolbarTextDropdownGroupWithItems","LexicalListPlugin","shouldRegisterListBaseNodes","slashMenuListGroupWithItems","CHECK_LIST","LexicalCheckListPlugin","toolbarGroups","ChildComponent","isActive","selection","node","getNodes","getListType","parent","getParent","parentParent","key","label","i18n","t","onSelect","editor","dispatchCommand","undefined","order","ChecklistFeatureClient","featureProviderMap","plugins","Component","position","shouldRegister","push","markdownTransformers","nodes","slashMenu","groups","Icon","keywords","toolbarFixed","toolbarInline"],"sources":["../../../../../src/features/lists/checklist/client/index.tsx"],"sourcesContent":["'use client'\nimport { $isListNode, INSERT_CHECK_LIST_COMMAND, ListItemNode, ListNode } from '@lexical/list'\nimport { $isRangeSelection } from 'lexical'\n\nimport type { ToolbarGroup } from '../../../toolbars/types.js'\nimport type { ClientFeature } from '../../../typesClient.js'\n\nimport { ChecklistIcon } from '../../../../lexical/ui/icons/Checklist/index.js'\nimport { createClientFeature } from '../../../../utilities/createClientFeature.js'\nimport { toolbarTextDropdownGroupWithItems } from '../../../shared/toolbar/textDropdownGroup.js'\nimport { LexicalListPlugin } from '../../plugin/index.js'\nimport { shouldRegisterListBaseNodes } from '../../shared/shouldRegisterListBaseNodes.js'\nimport { slashMenuListGroupWithItems } from '../../shared/slashMenuListGroup.js'\nimport { CHECK_LIST } from '../markdownTransformers.js'\nimport { LexicalCheckListPlugin } from './plugin/index.js'\n\nconst toolbarGroups: ToolbarGroup[] = [\n toolbarTextDropdownGroupWithItems([\n {\n ChildComponent: ChecklistIcon,\n isActive: ({ selection }) => {\n if (!$isRangeSelection(selection)) {\n return false\n }\n for (const node of selection.getNodes()) {\n if ($isListNode(node) && node.getListType() === 'check') {\n continue\n }\n\n const parent = node.getParent()\n\n if ($isListNode(parent) && parent.getListType() === 'check') {\n continue\n }\n\n const parentParent = parent?.getParent()\n // Example scenario: Node = textNode, parent = listItemNode, parentParent = listNode\n if ($isListNode(parentParent) && parentParent.getListType() === 'check') {\n continue\n }\n\n return false\n }\n return true\n },\n key: 'checklist',\n label: ({ i18n }) => {\n return i18n.t('lexical:checklist:label')\n },\n onSelect: ({ editor }) => {\n editor.dispatchCommand(INSERT_CHECK_LIST_COMMAND, undefined)\n },\n order: 12,\n },\n ]),\n]\n\nexport const ChecklistFeatureClient = createClientFeature(({ featureProviderMap }) => {\n const plugins: ClientFeature<undefined>['plugins'] = [\n {\n Component: LexicalCheckListPlugin,\n position: 'normal',\n },\n ]\n\n const shouldRegister = shouldRegisterListBaseNodes('checklist', featureProviderMap)\n if (shouldRegister) {\n plugins.push({\n Component: LexicalListPlugin,\n position: 'normal',\n })\n }\n\n return {\n markdownTransformers: [CHECK_LIST],\n nodes: shouldRegister ? [ListNode, ListItemNode] : [],\n plugins,\n slashMenu: {\n groups: [\n slashMenuListGroupWithItems([\n {\n Icon: ChecklistIcon,\n key: 'checklist',\n keywords: ['check list', 'check', 'checklist', 'cl'],\n label: ({ i18n }) => {\n return i18n.t('lexical:checklist:label')\n },\n onSelect: ({ editor }) => {\n editor.dispatchCommand(INSERT_CHECK_LIST_COMMAND, undefined)\n },\n },\n ]),\n ],\n },\n toolbarFixed: {\n groups: toolbarGroups,\n },\n toolbarInline: {\n groups: toolbarGroups,\n },\n }\n})\n"],"mappings":"AAAA;;AACA,SAASA,WAAW,EAAEC,yBAAyB,EAAEC,YAAY,EAAEC,QAAQ,QAAQ;AAC/E,SAASC,iBAAiB,QAAQ;AAKlC,SAASC,aAAa,QAAQ;AAC9B,SAASC,mBAAmB,QAAQ;AACpC,SAASC,iCAAiC,QAAQ;AAClD,SAASC,iBAAiB,QAAQ;AAClC,SAASC,2BAA2B,QAAQ;AAC5C,SAASC,2BAA2B,QAAQ;AAC5C,SAASC,UAAU,QAAQ;AAC3B,SAASC,sBAAsB,QAAQ;AAEvC,MAAMC,aAAA,GAAgC,CACpCN,iCAAA,CAAkC,CAChC;EACEO,cAAA,EAAgBT,aAAA;EAChBU,QAAA,EAAUA,CAAC;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GAAG,EAAE;IACrDgC,OAAA;IACAO,SAAA,EAAW;MACTC,MAAA,EAAQ,CACNhC,2BAAA,CAA4B,CAC1B;QACEiC,IAAA,EAAMtC,aAAA;QACNkB,GAAA,EAAK;QACLqB,QAAA,EAAU,CAAC,cAAc,SAAS,aAAa,KAAK;QACpDpB,KAAA,EAAOA,CAAC;UAAEC;QAAI,CAAE;UACd,OAAOA,IAAA,CAAKC,CAAC,CAAC;QAChB;QACAC,QAAA,EAAUA,CAAC;UAAEC;QAAM,CAAE;UACnBA,MAAA,CAAOC,eAAe,CAAC5B,yBAAA,EAA2B6B,SAAA;QACpD;MACF,EACD;IAEL;IACAe,YAAA,EAAc;MACZH,MAAA,EAAQ7B;IACV;IACAiC,aAAA,EAAe;MACbJ,MAAA,EAAQ7B;IACV;EACF;AACF","ignoreList":[]}
1
+ {"version":3,"file":"index.js","names":["$isListNode","INSERT_CHECK_LIST_COMMAND","ListItemNode","ListNode","CHECK_LIST","$isRangeSelection","ChecklistIcon","createClientFeature","toolbarTextDropdownGroupWithItems","LexicalListPlugin","shouldRegisterListBaseNodes","slashMenuListGroupWithItems","LexicalCheckListPlugin","toolbarGroups","ChildComponent","isActive","selection","node","getNodes","getListType","parent","getParent","parentParent","key","label","i18n","t","onSelect","editor","dispatchCommand","undefined","order","ChecklistFeatureClient","featureProviderMap","plugins","Component","position","shouldRegister","push","markdownTransformers","nodes","slashMenu","groups","Icon","keywords","toolbarFixed","toolbarInline"],"sources":["../../../../../src/features/lists/checklist/client/index.tsx"],"sourcesContent":["'use client'\nimport { $isListNode, INSERT_CHECK_LIST_COMMAND, ListItemNode, ListNode } from '@lexical/list'\nimport { CHECK_LIST } from '@lexical/markdown'\nimport { $isRangeSelection } from 'lexical'\n\nimport type { ToolbarGroup } from '../../../toolbars/types.js'\nimport type { ClientFeature } from '../../../typesClient.js'\n\nimport { ChecklistIcon } from '../../../../lexical/ui/icons/Checklist/index.js'\nimport { createClientFeature } from '../../../../utilities/createClientFeature.js'\nimport { toolbarTextDropdownGroupWithItems } from '../../../shared/toolbar/textDropdownGroup.js'\nimport { LexicalListPlugin } from '../../plugin/index.js'\nimport { shouldRegisterListBaseNodes } from '../../shared/shouldRegisterListBaseNodes.js'\nimport { slashMenuListGroupWithItems } from '../../shared/slashMenuListGroup.js'\nimport { LexicalCheckListPlugin } from './plugin/index.js'\n\nconst toolbarGroups: ToolbarGroup[] = [\n toolbarTextDropdownGroupWithItems([\n {\n ChildComponent: ChecklistIcon,\n isActive: ({ selection }) => {\n if (!$isRangeSelection(selection)) {\n return false\n }\n for (const node of selection.getNodes()) {\n if ($isListNode(node) && node.getListType() === 'check') {\n continue\n }\n\n const parent = node.getParent()\n\n if ($isListNode(parent) && parent.getListType() === 'check') {\n continue\n }\n\n const parentParent = parent?.getParent()\n // Example scenario: Node = textNode, parent = listItemNode, parentParent = listNode\n if ($isListNode(parentParent) && parentParent.getListType() === 'check') {\n continue\n }\n\n return false\n }\n return true\n },\n key: 'checklist',\n label: ({ i18n }) => {\n return i18n.t('lexical:checklist:label')\n },\n onSelect: ({ editor }) => {\n editor.dispatchCommand(INSERT_CHECK_LIST_COMMAND, undefined)\n },\n order: 12,\n },\n ]),\n]\n\nexport const ChecklistFeatureClient = createClientFeature(({ featureProviderMap }) => {\n const plugins: ClientFeature<undefined>['plugins'] = [\n {\n Component: LexicalCheckListPlugin,\n position: 'normal',\n },\n ]\n\n const shouldRegister = shouldRegisterListBaseNodes('checklist', featureProviderMap)\n if (shouldRegister) {\n plugins.push({\n Component: LexicalListPlugin,\n position: 'normal',\n })\n }\n\n return {\n markdownTransformers: [CHECK_LIST],\n nodes: shouldRegister ? [ListNode, ListItemNode] : [],\n plugins,\n slashMenu: {\n groups: [\n slashMenuListGroupWithItems([\n {\n Icon: ChecklistIcon,\n key: 'checklist',\n keywords: ['check list', 'check', 'checklist', 'cl'],\n label: ({ i18n }) => {\n return i18n.t('lexical:checklist:label')\n },\n onSelect: ({ editor }) => {\n editor.dispatchCommand(INSERT_CH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;IACnBA,MAAA,CAAOC,eAAe,CAAC5B,yBAAA,EAA2B6B,SAAA;EACpD;EACAC,KAAA,EAAO;AACT,EACD,EACF;AAED,OAAO,MAAMC,sBAAA,GAAyBzB,mBAAA,CAAoB,CAAC;EAAE0B;AAAkB,CAAE;EAC/E,MAAMC,OAAA,GAA+C,CACnD;IACEC,SAAA,EAAWvB,sBAAA;IACXwB,QAAA,EAAU;EACZ,EACD;EAED,MAAMC,cAAA,GAAiB3B,2BAAA,CAA4B,aAAauB,kBAAA;EAChE,IAAII,cAAA,EAAgB;IAClBH,OAAA,CAAQI,IAAI,CAAC;MACXH,SAAA,EAAW1B,iBAAA;MACX2B,QAAA,EAAU;IACZ;EACF;EAEA,OAAO;IACLG,oBAAA,EAAsB,CAACnC,UAAA,CAAW;IAClCoC,KAAA,EAAOH,cAAA,GAAiB,CAAClC,QAAA,EAAUD,YAAA,CAAa,GAAG,EAAE;IACrDgC,OAAA;IACAO,SAAA,EAAW;MACTC,MAAA,EAAQ,CACN/B,2BAAA,CAA4B,CAC1B;QACEgC,IAAA,EAAMrC,aAAA;QACNiB,GAAA,EAAK;QACLqB,QAAA,EAAU,CAAC,cAAc,SAAS,aAAa,KAAK;QACpDpB,KAAA,EAAOA,CAAC;UAAEC;QAAI,CAAE;UACd,OAAOA,IAAA,CAAKC,CAAC,CAAC;QAChB;QACAC,QAAA,EAAUA,CAAC;UAAEC;QAAM,CAAE;UACnBA,MAAA,CAAOC,eAAe,CAAC5B,yBAAA,EAA2B6B,SAAA;QACpD;MACF,EACD;IAEL;IACAe,YAAA,EAAc;MACZH,MAAA,EAAQ7B;IACV;IACAiC,aAAA,EAAe;MACbJ,MAAA,EAAQ7B;IACV;EACF;AACF","ignoreList":[]}
@@ -1,9 +1,9 @@
1
1
  import { ListItemNode, ListNode } from '@lexical/list';
2
+ import { CHECK_LIST } from '@lexical/markdown';
2
3
  import { createServerFeature } from '../../../../utilities/createServerFeature.js';
3
4
  import { createNode } from '../../../typeUtilities.js';
4
5
  import { listItemNodeJSONSchema, listNodeJSONSchema } from '../../shared/schema.js';
5
6
  import { shouldRegisterListBaseNodes } from '../../shared/shouldRegisterListBaseNodes.js';
6
- import { CHECK_LIST } from '../markdownTransformers.js';
7
7
  import { i18n } from './i18n.js';
8
8
  export const ChecklistFeature = createServerFeature({
9
9
  feature: ({
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["ListItemNode","ListNode","createServerFeature","createNode","listItemNodeJSONSchema","listNodeJSONSchema","shouldRegisterListBaseNodes","CHECK_LIST","i18n","ChecklistFeature","feature","featureProviderMap","ClientFeature","markdownTransformers","nodes","jsonSchema","node","key"],"sources":["../../../../../src/features/lists/checklist/server/index.ts"],"sourcesContent":["import { ListItemNode, ListNode } from '@lexical/list'\n\nimport { createServerFeature } from '../../../../utilities/createServerFeature.js'\nimport { createNode } from '../../../typeUtilities.js'\nimport { listItemNodeJSONSchema, listNodeJSONSchema } from '../../shared/schema.js'\nimport { shouldRegisterListBaseNodes } from '../../shared/shouldRegisterListBaseNodes.js'\nimport { CHECK_LIST } from '../markdownTransformers.js'\nimport { i18n } from './i18n.js'\n\nexport const ChecklistFeature = createServerFeature({\n feature: ({ featureProviderMap }) => {\n return {\n ClientFeature: '@payloadcms/richtext-lexical/client#ChecklistFeatureClient',\n i18n,\n markdownTransformers: [CHECK_LIST],\n nodes: shouldRegisterListBaseNodes('checklist', featureProviderMap)\n ? [\n createNode({\n jsonSchema: listNodeJSONSchema,\n node: ListNode,\n }),\n createNode({\n jsonSchema: listItemNodeJSONSchema,\n node: ListItemNode,\n }),\n ]\n : [],\n }\n },\n key: 'checklist',\n})\n"],"mappings":"AAAA,SAASA,YAAY,EAAEC,QAAQ,QAAQ;AAEvC,SAASC,mBAAmB,QAAQ;AACpC,SAASC,UAAU,QAAQ;AAC3B,SAASC,sBAAsB,EAAEC,kBAAkB,QAAQ;AAC3D,SAASC,2BAA2B,QAAQ;AAC5C,SAASC,UAAU,QAAQ;AAC3B,SAASC,IAAI,QAAQ;AAErB,OAAO,MAAMC,gBAAA,GAAmBP,mBAAA,CAAoB;EAClDQ,OAAA,EAASA,CAAC;IAAEC;EAAkB,CAAE;IAC9B,OAAO;MACLC,aAAA,EAAe;MACfJ,IAAA;MACAK,oBAAA,EAAsB,CAACN,UAAA,CAAW;MAClCO,KAAA,EAAOR,2BAAA,CAA4B,aAAaK,kBAAA,IAC5C,CACER,UAAA,CAAW;QACTY,UAAA,EAAYV,kBAAA;QACZW,IAAA,EAAMf;MACR,IACAE,UAAA,CAAW;QACTY,UAAA,EAAYX,sBAAA;QACZY,IAAA,EAAMhB;MACR,GACD,GACD;IACN;EACF;EACAiB,GAAA,EAAK;AACP","ignoreList":[]}
1
+ {"version":3,"file":"index.js","names":["ListItemNode","ListNode","CHECK_LIST","createServerFeature","createNode","listItemNodeJSONSchema","listNodeJSONSchema","shouldRegisterListBaseNodes","i18n","ChecklistFeature","feature","featureProviderMap","ClientFeature","markdownTransformers","nodes","jsonSchema","node","key"],"sources":["../../../../../src/features/lists/checklist/server/index.ts"],"sourcesContent":["import { ListItemNode, ListNode } from '@lexical/list'\nimport { CHECK_LIST } from '@lexical/markdown'\n\nimport { createServerFeature } from '../../../../utilities/createServerFeature.js'\nimport { createNode } from '../../../typeUtilities.js'\nimport { listItemNodeJSONSchema, listNodeJSONSchema } from '../../shared/schema.js'\nimport { shouldRegisterListBaseNodes } from '../../shared/shouldRegisterListBaseNodes.js'\nimport { i18n } from './i18n.js'\n\nexport const ChecklistFeature = createServerFeature({\n feature: ({ featureProviderMap }) => {\n return {\n ClientFeature: '@payloadcms/richtext-lexical/client#ChecklistFeatureClient',\n i18n,\n markdownTransformers: [CHECK_LIST],\n nodes: shouldRegisterListBaseNodes('checklist', featureProviderMap)\n ? [\n createNode({\n jsonSchema: listNodeJSONSchema,\n node: ListNode,\n }),\n createNode({\n jsonSchema: listItemNodeJSONSchema,\n node: ListItemNode,\n }),\n ]\n : [],\n }\n },\n key: 'checklist',\n})\n"],"mappings":"AAAA,SAASA,YAAY,EAAEC,QAAQ,QAAQ;AACvC,SAASC,UAAU,QAAQ;AAE3B,SAASC,mBAAmB,QAAQ;AACpC,SAASC,UAAU,QAAQ;AAC3B,SAASC,sBAAsB,EAAEC,kBAAkB,QAAQ;AAC3D,SAASC,2BAA2B,QAAQ;AAC5C,SAASC,IAAI,QAAQ;AAErB,OAAO,MAAMC,gBAAA,GAAmBN,mBAAA,CAAoB;EAClDO,OAAA,EAASA,CAAC;IAAEC;EAAkB,CAAE;IAC9B,OAAO;MACLC,aAAA,EAAe;MACfJ,IAAA;MACAK,oBAAA,EAAsB,CAACX,UAAA,CAAW;MAClCY,KAAA,EAAOP,2BAAA,CAA4B,aAAaI,kBAAA,IAC5C,CACEP,UAAA,CAAW;QACTW,UAAA,EAAYT,kBAAA;QACZU,IAAA,EAAMf;MACR,IACAG,UAAA,CAAW;QACTW,UAAA,EAAYV,sBAAA;QACZW,IAAA,EAAMhB;MACR,GACD,GACD;IACN;EACF;EACAiB,GAAA,EAAK;AACP","ignoreList":[]}
@@ -1,6 +1,7 @@
1
1
  'use client';
2
2
 
3
3
  import { $isListNode, INSERT_ORDERED_LIST_COMMAND, ListItemNode, ListNode } from '@lexical/list';
4
+ import { ORDERED_LIST } from '@lexical/markdown';
4
5
  import { $isRangeSelection } from 'lexical';
5
6
  import { OrderedListIcon } from '../../../../lexical/ui/icons/OrderedList/index.js';
6
7
  import { createClientFeature } from '../../../../utilities/createClientFeature.js';
@@ -8,7 +9,6 @@ import { toolbarTextDropdownGroupWithItems } from '../../../shared/toolbar/textD
8
9
  import { LexicalListPlugin } from '../../plugin/index.js';
9
10
  import { shouldRegisterListBaseNodes } from '../../shared/shouldRegisterListBaseNodes.js';
10
11
  import { slashMenuListGroupWithItems } from '../../shared/slashMenuListGroup.js';
11
- import { ORDERED_LIST } from '../markdownTransformer.js';
12
12
  const toolbarGroups = [toolbarTextDropdownGroupWithItems([{
13
13
  ChildComponent: OrderedListIcon,
14
14
  isActive: ({
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["$isListNode","INSERT_ORDERED_LIST_COMMAND","ListItemNode","ListNode","$isRangeSelection","OrderedListIcon","createClientFeature","toolbarTextDropdownGroupWithItems","LexicalListPlugin","shouldRegisterListBaseNodes","slashMenuListGroupWithItems","ORDERED_LIST","toolbarGroups","ChildComponent","isActive","selection","node","getNodes","getListType","parent","getParent","parentParent","key","label","i18n","t","onSelect","editor","dispatchCommand","undefined","order","OrderedListFeatureClient","featureProviderMap","shouldRegister","markdownTransformers","nodes","plugins","Component","position","slashMenu","groups","Icon","keywords","toolbarFixed","toolbarInline"],"sources":["../../../../../src/features/lists/orderedList/client/index.tsx"],"sourcesContent":["'use client'\nimport { $isListNode, INSERT_ORDERED_LIST_COMMAND, ListItemNode, ListNode } from '@lexical/list'\nimport { $isRangeSelection } from 'lexical'\n\nimport type { ToolbarGroup } from '../../../toolbars/types.js'\n\nimport { OrderedListIcon } from '../../../../lexical/ui/icons/OrderedList/index.js'\nimport { createClientFeature } from '../../../../utilities/createClientFeature.js'\nimport { toolbarTextDropdownGroupWithItems } from '../../../shared/toolbar/textDropdownGroup.js'\nimport { LexicalListPlugin } from '../../plugin/index.js'\nimport { shouldRegisterListBaseNodes } from '../../shared/shouldRegisterListBaseNodes.js'\nimport { slashMenuListGroupWithItems } from '../../shared/slashMenuListGroup.js'\nimport { ORDERED_LIST } from '../markdownTransformer.js'\n\nconst toolbarGroups: ToolbarGroup[] = [\n toolbarTextDropdownGroupWithItems([\n {\n ChildComponent: OrderedListIcon,\n isActive: ({ selection }) => {\n if (!$isRangeSelection(selection)) {\n return false\n }\n for (const node of selection.getNodes()) {\n if ($isListNode(node) && node.getListType() === 'number') {\n continue\n }\n\n const parent = node.getParent()\n\n if ($isListNode(parent) && parent.getListType() === 'number') {\n continue\n }\n\n const parentParent = parent?.getParent()\n // Example scenario: Node = textNode, parent = listItemNode, parentParent = listNode\n if ($isListNode(parentParent) && parentParent.getListType() === 'number') {\n continue\n }\n\n return false\n }\n return true\n },\n key: 'orderedList',\n label: ({ i18n }) => {\n return i18n.t('lexical:orderedList:label')\n },\n onSelect: ({ editor }) => {\n editor.dispatchCommand(INSERT_ORDERED_LIST_COMMAND, undefined)\n },\n order: 10,\n },\n ]),\n]\n\nexport const OrderedListFeatureClient = createClientFeature(({ featureProviderMap }) => {\n const shouldRegister = shouldRegisterListBaseNodes('ordered', featureProviderMap)\n return {\n markdownTransformers: [ORDERED_LIST],\n nodes: shouldRegister ? [ListNode, ListItemNode] : [],\n plugins: shouldRegister\n ? [\n {\n Component: LexicalListPlugin,\n position: 'normal',\n },\n ]\n : [],\n slashMenu: {\n groups: [\n slashMenuListGroupWithItems([\n {\n Icon: OrderedListIcon,\n key: 'orderedList',\n keywords: ['ordered list', 'ol'],\n label: ({ i18n }) => {\n return i18n.t('lexical:orderedList:label')\n },\n onSelect: ({ editor }) => {\n editor.dispatchCommand(INSERT_ORDERED_LIST_COMMAND, undefined)\n },\n },\n ]),\n ],\n },\n toolbarFixed: {\n groups: toolbarGroups,\n },\n toolbarInline: {\n groups: toolbarGroups,\n },\n }\n})\n"],"mappings":"AAAA;;AACA,SAASA,WAAW,EAAEC,2BAA2B,EAAEC,YAAY,EAAEC,QAAQ,QAAQ;AACjF,SAASC,iBAAiB,QAAQ;AAIlC,SAASC,eAAe,QAAQ;AAChC,SAASC,mBAAmB,QAAQ;AACpC,SAASC,iCAAiC,QAAQ;AAClD,SAASC,iBAAiB,QAAQ;AAClC,SAASC,2BAA2B,QAAQ;AAC5C,SAASC,2BAA2B,QAAQ;AAC5C,SAASC,YAAY,QAAQ;AAE7B,MAAMC,aAAA,GAAgC,CACpCL,iCAAA,CAAkC,CAChC;EACEM,cAAA,EAAgBR,eAAA;EAChBS,QAAA,EAAUA,CAAC;IAAEC;EAAS,CAAE;IACtB,IAAI,CAACX,iBAAA,CAAkBW,SAAA,GAAY;MACjC,OAAO;IACT;IACA,KAAK,MAAMC,IAAA,IAAQD,SAAA,CAAUE,QAAQ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AKC,CAAC,CAAC;QAChB;QACAC,QAAA,EAAUA,CAAC;UAAEC;QAAM,CAAE;UACnBA,MAAA,CAAOC,eAAe,CAAC3B,2BAAA,EAA6B4B,SAAA;QACtD;MACF,EACD;IAEL;IACAc,YAAA,EAAc;MACZH,MAAA,EAAQ5B;IACV;IACAgC,aAAA,EAAe;MACbJ,MAAA,EAAQ5B;IACV;EACF;AACF","ignoreList":[]}
1
+ {"version":3,"file":"index.js","names":["$isListNode","INSERT_ORDERED_LIST_COMMAND","ListItemNode","ListNode","ORDERED_LIST","$isRangeSelection","OrderedListIcon","createClientFeature","toolbarTextDropdownGroupWithItems","LexicalListPlugin","shouldRegisterListBaseNodes","slashMenuListGroupWithItems","toolbarGroups","ChildComponent","isActive","selection","node","getNodes","getListType","parent","getParent","parentParent","key","label","i18n","t","onSelect","editor","dispatchCommand","undefined","order","OrderedListFeatureClient","featureProviderMap","shouldRegister","markdownTransformers","nodes","plugins","Component","position","slashMenu","groups","Icon","keywords","toolbarFixed","toolbarInline"],"sources":["../../../../../src/features/lists/orderedList/client/index.tsx"],"sourcesContent":["'use client'\nimport { $isListNode, INSERT_ORDERED_LIST_COMMAND, ListItemNode, ListNode } from '@lexical/list'\nimport { ORDERED_LIST } from '@lexical/markdown'\nimport { $isRangeSelection } from 'lexical'\n\nimport type { ToolbarGroup } from '../../../toolbars/types.js'\n\nimport { OrderedListIcon } from '../../../../lexical/ui/icons/OrderedList/index.js'\nimport { createClientFeature } from '../../../../utilities/createClientFeature.js'\nimport { toolbarTextDropdownGroupWithItems } from '../../../shared/toolbar/textDropdownGroup.js'\nimport { LexicalListPlugin } from '../../plugin/index.js'\nimport { shouldRegisterListBaseNodes } from '../../shared/shouldRegisterListBaseNodes.js'\nimport { slashMenuListGroupWithItems } from '../../shared/slashMenuListGroup.js'\n\nconst toolbarGroups: ToolbarGroup[] = [\n toolbarTextDropdownGroupWithItems([\n {\n ChildComponent: OrderedListIcon,\n isActive: ({ selection }) => {\n if (!$isRangeSelection(selection)) {\n return false\n }\n for (const node of selection.getNodes()) {\n if ($isListNode(node) && node.getListType() === 'number') {\n continue\n }\n\n const parent = node.getParent()\n\n if ($isListNode(parent) && parent.getListType() === 'number') {\n continue\n }\n\n const parentParent = parent?.getParent()\n // Example scenario: Node = textNode, parent = listItemNode, parentParent = listNode\n if ($isListNode(parentParent) && parentParent.getListType() === 'number') {\n continue\n }\n\n return false\n }\n return true\n },\n key: 'orderedList',\n label: ({ i18n }) => {\n return i18n.t('lexical:orderedList:label')\n },\n onSelect: ({ editor }) => {\n editor.dispatchCommand(INSERT_ORDERED_LIST_COMMAND, undefined)\n },\n order: 10,\n },\n ]),\n]\n\nexport const OrderedListFeatureClient = createClientFeature(({ featureProviderMap }) => {\n const shouldRegister = shouldRegisterListBaseNodes('ordered', featureProviderMap)\n return {\n markdownTransformers: [ORDERED_LIST],\n nodes: shouldRegister ? [ListNode, ListItemNode] : [],\n plugins: shouldRegister\n ? [\n {\n Component: LexicalListPlugin,\n position: 'normal',\n },\n ]\n : [],\n slashMenu: {\n groups: [\n slashMenuListGroupWithItems([\n {\n Icon: OrderedListIcon,\n key: 'orderedList',\n keywords: ['ordered list', 'ol'],\n label: ({ i18n }) => {\n return i18n.t('lexical:orderedList:label')\n },\n onSelect: ({ editor }) => {\n editor.dispatchCommand(INSERT_ORDERED_LIST_COMMAND, undefined)\n },\n },\n ]),\n ],\n },\n toolbarFixed: {\n groups: toolbarGroups,\n },\n toolbarInline: {\n groups: toolbarGroups,\n },\n }\n})\n"],"mappings":"AAAA;;AACA,SAASA,WAAW,EAAEC,2BAA2B,EAAEC,YAAY,EAAEC,QAAQ,QAAQ;AACjF,SAASC,YAAY,QAAQ;AAC7B,SAASC,iBAAiB,QAAQ;AAIlC,SAASC,eAAe,QAAQ;AAChC,SAASC,mBAAmB,QAAQ;AACpC,SAASC,iCAAiC,QAAQ;AAClD,SAASC,iBAAiB,QAAQ;AAClC,SAASC,2BAA2B,QAAQ;AAC5C,SAASC,2BAA2B,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AA,EAAU;IACZ,EACD,GACD,EAAE;IACNC,SAAA,EAAW;MACTC,MAAA,EAAQ,CACN7B,2BAAA,CAA4B,CAC1B;QACE8B,IAAA,EAAMnC,eAAA;QACNgB,GAAA,EAAK;QACLoB,QAAA,EAAU,CAAC,gBAAgB,KAAK;QAChCnB,KAAA,EAAOA,CAAC;UAAEC;QAAI,CAAE;UACd,OAAOA,IAAA,CAAKC,CAAC,CAAC;QAChB;QACAC,QAAA,EAAUA,CAAC;UAAEC;QAAM,CAAE;UACnBA,MAAA,CAAOC,eAAe,CAAC3B,2BAAA,EAA6B4B,SAAA;QACtD;MACF,EACD;IAEL;IACAc,YAAA,EAAc;MACZH,MAAA,EAAQ5B;IACV;IACAgC,aAAA,EAAe;MACbJ,MAAA,EAAQ5B;IACV;EACF;AACF","ignoreList":[]}
@@ -1,9 +1,9 @@
1
1
  import { ListItemNode, ListNode } from '@lexical/list';
2
+ import { ORDERED_LIST } from '@lexical/markdown';
2
3
  import { createServerFeature } from '../../../../utilities/createServerFeature.js';
3
4
  import { createNode } from '../../../typeUtilities.js';
4
5
  import { listItemNodeJSONSchema, listNodeJSONSchema } from '../../shared/schema.js';
5
6
  import { shouldRegisterListBaseNodes } from '../../shared/shouldRegisterListBaseNodes.js';
6
- import { ORDERED_LIST } from '../markdownTransformer.js';
7
7
  import { i18n } from './i18n.js';
8
8
  export const OrderedListFeature = createServerFeature({
9
9
  feature: ({