@payloadcms/richtext-lexical 4.0.0-internal.c2b57ce → 4.0.0-internal.c6494b5

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 (1065) hide show
  1. package/LICENSE.md +1 -1
  2. package/dist/cell/rscEntry.d.ts +1 -1
  3. package/dist/cell/rscEntry.d.ts.map +1 -1
  4. package/dist/cell/rscEntry.js +5 -5
  5. package/dist/cell/rscEntry.js.map +1 -1
  6. package/dist/exports/client/Field-W2ABOM7M.js +2 -0
  7. package/dist/exports/client/Field-W2ABOM7M.js.map +7 -0
  8. package/dist/exports/client/{RelationshipComponent-RZL743CS.js → RelationshipComponent-YCPAKOL7.js} +1 -1
  9. package/dist/exports/client/RelationshipComponent-YCPAKOL7.js.map +7 -0
  10. package/dist/exports/client/chunk-3LRZDIIG.js +2 -0
  11. package/dist/exports/client/chunk-3LRZDIIG.js.map +7 -0
  12. package/dist/exports/client/chunk-5VIL27GI.js +2 -0
  13. package/dist/exports/client/chunk-5VIL27GI.js.map +7 -0
  14. package/dist/exports/client/chunk-E6LSRRP2.js +2 -0
  15. package/dist/exports/client/chunk-E6LSRRP2.js.map +7 -0
  16. package/dist/exports/client/{chunk-BZZVLW4U.js → chunk-RJ5MAOKZ.js} +1 -1
  17. package/dist/exports/client/chunk-RJ5MAOKZ.js.map +7 -0
  18. package/dist/exports/client/chunk-ZQX5HXUL.js +2 -0
  19. package/dist/exports/client/chunk-ZQX5HXUL.js.map +7 -0
  20. package/dist/exports/client/component-6DQLENIE.js +2 -0
  21. package/dist/exports/client/component-6DQLENIE.js.map +7 -0
  22. package/dist/exports/client/componentInline-HNE5G4TE.js +2 -0
  23. package/dist/exports/client/index.d.ts +1 -2
  24. package/dist/exports/client/index.d.ts.map +1 -1
  25. package/dist/exports/client/index.js +28 -29
  26. package/dist/exports/client/index.js.map +4 -4
  27. package/dist/exports/react/index.d.ts +1 -1
  28. package/dist/exports/react/index.d.ts.map +1 -1
  29. package/dist/exports/react/index.js.map +1 -1
  30. package/dist/features/align/client/toolbarAlignGroup.d.ts.map +1 -1
  31. package/dist/features/blockquote/client/index.js +2 -2
  32. package/dist/features/blockquote/client/index.js.map +1 -1
  33. package/dist/features/blockquote/server/index.d.ts +1 -4
  34. package/dist/features/blockquote/server/index.d.ts.map +1 -1
  35. package/dist/features/blockquote/server/index.js +4 -2
  36. package/dist/features/blockquote/server/index.js.map +1 -1
  37. package/dist/features/blockquote/server/schema.d.ts +8 -0
  38. package/dist/features/blockquote/server/schema.d.ts.map +1 -0
  39. package/dist/features/blockquote/server/schema.js +15 -0
  40. package/dist/features/blockquote/server/schema.js.map +1 -0
  41. package/dist/features/blocks/client/component/BlockReordering/index.d.ts +11 -0
  42. package/dist/features/blocks/client/component/BlockReordering/index.d.ts.map +1 -0
  43. package/dist/features/blocks/client/component/BlockReordering/index.js +18 -0
  44. package/dist/features/blocks/client/component/BlockReordering/index.js.map +1 -0
  45. package/dist/features/blocks/client/component/index.css +2 -2
  46. package/dist/features/blocks/client/component/index.d.ts +3 -8
  47. package/dist/features/blocks/client/component/index.d.ts.map +1 -1
  48. package/dist/features/blocks/client/component/index.js +181 -105
  49. package/dist/features/blocks/client/component/index.js.map +1 -1
  50. package/dist/features/blocks/client/component/useBlockReordering.d.ts +16 -0
  51. package/dist/features/blocks/client/component/useBlockReordering.d.ts.map +1 -0
  52. package/dist/features/blocks/client/component/useBlockReordering.js +178 -0
  53. package/dist/features/blocks/client/component/useBlockReordering.js.map +1 -0
  54. package/dist/features/blocks/client/componentInline/components/InlineBlockContainer.d.ts.map +1 -1
  55. package/dist/features/blocks/client/componentInline/index.css +8 -9
  56. package/dist/features/blocks/client/componentInline/index.d.ts +3 -2
  57. package/dist/features/blocks/client/componentInline/index.d.ts.map +1 -1
  58. package/dist/features/blocks/client/componentInline/index.js +45 -29
  59. package/dist/features/blocks/client/componentInline/index.js.map +1 -1
  60. package/dist/features/blocks/client/getBlockImageComponent.d.ts +1 -1
  61. package/dist/features/blocks/client/getCachedFormStateIfDataMatches.d.ts +9 -0
  62. package/dist/features/blocks/client/getCachedFormStateIfDataMatches.d.ts.map +1 -0
  63. package/dist/features/blocks/client/getCachedFormStateIfDataMatches.js +95 -0
  64. package/dist/features/blocks/client/getCachedFormStateIfDataMatches.js.map +1 -0
  65. package/dist/features/blocks/client/index.d.ts.map +1 -1
  66. package/dist/features/blocks/client/index.js +4 -2
  67. package/dist/features/blocks/client/index.js.map +1 -1
  68. package/dist/features/blocks/client/markdown/getLexicalToMarkdown.d.ts +1 -1
  69. package/dist/features/blocks/client/markdown/getLexicalToMarkdown.d.ts.map +1 -1
  70. package/dist/features/blocks/client/markdown/getLexicalToMarkdown.js +1 -1
  71. package/dist/features/blocks/client/markdown/getLexicalToMarkdown.js.map +1 -1
  72. package/dist/features/blocks/client/markdown/getMarkdownToLexical.d.ts +1 -1
  73. package/dist/features/blocks/client/markdown/getMarkdownToLexical.d.ts.map +1 -1
  74. package/dist/features/blocks/client/markdown/getMarkdownToLexical.js +5 -2
  75. package/dist/features/blocks/client/markdown/getMarkdownToLexical.js.map +1 -1
  76. package/dist/features/blocks/client/markdown/markdownTransformer.d.ts +1 -2
  77. package/dist/features/blocks/client/markdown/markdownTransformer.d.ts.map +1 -1
  78. package/dist/features/blocks/client/markdown/markdownTransformer.js +4 -4
  79. package/dist/features/blocks/client/markdown/markdownTransformer.js.map +1 -1
  80. package/dist/features/blocks/client/nodes/BlocksNode.d.ts +2 -2
  81. package/dist/features/blocks/client/nodes/BlocksNode.d.ts.map +1 -1
  82. package/dist/features/blocks/client/nodes/BlocksNode.js +0 -10
  83. package/dist/features/blocks/client/nodes/BlocksNode.js.map +1 -1
  84. package/dist/features/blocks/client/nodes/InlineBlocksNode.d.ts +2 -2
  85. package/dist/features/blocks/client/nodes/InlineBlocksNode.d.ts.map +1 -1
  86. package/dist/features/blocks/client/nodes/InlineBlocksNode.js.map +1 -1
  87. package/dist/features/blocks/client/plugin/index.d.ts +1 -1
  88. package/dist/features/blocks/client/plugin/index.d.ts.map +1 -1
  89. package/dist/features/blocks/client/plugin/index.js.map +1 -1
  90. package/dist/features/blocks/premade/CodeBlock/Component/Block.d.ts.map +1 -1
  91. package/dist/features/blocks/premade/CodeBlock/Component/Block.js +1 -0
  92. package/dist/features/blocks/premade/CodeBlock/Component/Block.js.map +1 -1
  93. package/dist/features/blocks/premade/CodeBlock/Component/Collapse/index.css +1 -1
  94. package/dist/features/blocks/premade/CodeBlock/Component/FloatingCollapse/index.css +2 -4
  95. package/dist/features/blocks/premade/CodeBlock/Component/index.css +5 -5
  96. package/dist/features/blocks/server/graphQLPopulationPromise.d.ts +1 -2
  97. package/dist/features/blocks/server/graphQLPopulationPromise.d.ts.map +1 -1
  98. package/dist/features/blocks/server/graphQLPopulationPromise.js.map +1 -1
  99. package/dist/features/blocks/server/index.d.ts +1 -0
  100. package/dist/features/blocks/server/index.d.ts.map +1 -1
  101. package/dist/features/blocks/server/index.js +26 -74
  102. package/dist/features/blocks/server/index.js.map +1 -1
  103. package/dist/features/blocks/server/markdown/markdownTransformer.d.ts +1 -1
  104. package/dist/features/blocks/server/markdown/markdownTransformer.d.ts.map +1 -1
  105. package/dist/features/blocks/server/markdown/markdownTransformer.js +4 -4
  106. package/dist/features/blocks/server/markdown/markdownTransformer.js.map +1 -1
  107. package/dist/features/blocks/server/nodes/BlocksNode.d.ts +1 -18
  108. package/dist/features/blocks/server/nodes/BlocksNode.d.ts.map +1 -1
  109. package/dist/features/blocks/server/nodes/BlocksNode.js +1 -12
  110. package/dist/features/blocks/server/nodes/BlocksNode.js.map +1 -1
  111. package/dist/features/blocks/server/nodes/InlineBlocksNode.d.ts +2 -10
  112. package/dist/features/blocks/server/nodes/InlineBlocksNode.d.ts.map +1 -1
  113. package/dist/features/blocks/server/nodes/InlineBlocksNode.js +2 -2
  114. package/dist/features/blocks/server/nodes/InlineBlocksNode.js.map +1 -1
  115. package/dist/features/blocks/server/schema.d.ts +47 -0
  116. package/dist/features/blocks/server/schema.d.ts.map +1 -0
  117. package/dist/features/blocks/server/schema.js +138 -0
  118. package/dist/features/blocks/server/schema.js.map +1 -0
  119. package/dist/features/blocks/server/validate.d.ts +1 -2
  120. package/dist/features/blocks/server/validate.d.ts.map +1 -1
  121. package/dist/features/blocks/server/validate.js +1 -1
  122. package/dist/features/blocks/server/validate.js.map +1 -1
  123. package/dist/features/converters/htmlToLexical/index.d.ts +1 -1
  124. package/dist/features/converters/htmlToLexical/index.d.ts.map +1 -1
  125. package/dist/features/converters/htmlToLexical/index.js.map +1 -1
  126. package/dist/features/converters/lexicalToHtml/async/converters/blockquote.d.ts +1 -1
  127. package/dist/features/converters/lexicalToHtml/async/converters/blockquote.d.ts.map +1 -1
  128. package/dist/features/converters/lexicalToHtml/async/converters/blockquote.js.map +1 -1
  129. package/dist/features/converters/lexicalToHtml/async/converters/heading.d.ts +1 -1
  130. package/dist/features/converters/lexicalToHtml/async/converters/heading.d.ts.map +1 -1
  131. package/dist/features/converters/lexicalToHtml/async/converters/heading.js +1 -1
  132. package/dist/features/converters/lexicalToHtml/async/converters/heading.js.map +1 -1
  133. package/dist/features/converters/lexicalToHtml/async/converters/horizontalRule.d.ts +1 -1
  134. package/dist/features/converters/lexicalToHtml/async/converters/horizontalRule.d.ts.map +1 -1
  135. package/dist/features/converters/lexicalToHtml/async/converters/horizontalRule.js.map +1 -1
  136. package/dist/features/converters/lexicalToHtml/async/converters/linebreak.d.ts +1 -1
  137. package/dist/features/converters/lexicalToHtml/async/converters/linebreak.d.ts.map +1 -1
  138. package/dist/features/converters/lexicalToHtml/async/converters/linebreak.js.map +1 -1
  139. package/dist/features/converters/lexicalToHtml/async/converters/link.d.ts +1 -1
  140. package/dist/features/converters/lexicalToHtml/async/converters/link.d.ts.map +1 -1
  141. package/dist/features/converters/lexicalToHtml/async/converters/link.js.map +1 -1
  142. package/dist/features/converters/lexicalToHtml/async/converters/list.d.ts +1 -1
  143. package/dist/features/converters/lexicalToHtml/async/converters/list.d.ts.map +1 -1
  144. package/dist/features/converters/lexicalToHtml/async/converters/list.js +4 -3
  145. package/dist/features/converters/lexicalToHtml/async/converters/list.js.map +1 -1
  146. package/dist/features/converters/lexicalToHtml/async/converters/paragraph.d.ts +1 -1
  147. package/dist/features/converters/lexicalToHtml/async/converters/paragraph.d.ts.map +1 -1
  148. package/dist/features/converters/lexicalToHtml/async/converters/paragraph.js.map +1 -1
  149. package/dist/features/converters/lexicalToHtml/async/converters/tab.d.ts +1 -1
  150. package/dist/features/converters/lexicalToHtml/async/converters/tab.d.ts.map +1 -1
  151. package/dist/features/converters/lexicalToHtml/async/converters/tab.js.map +1 -1
  152. package/dist/features/converters/lexicalToHtml/async/converters/table.d.ts +1 -1
  153. package/dist/features/converters/lexicalToHtml/async/converters/table.d.ts.map +1 -1
  154. package/dist/features/converters/lexicalToHtml/async/converters/table.js.map +1 -1
  155. package/dist/features/converters/lexicalToHtml/async/converters/text.d.ts +1 -1
  156. package/dist/features/converters/lexicalToHtml/async/converters/text.d.ts.map +1 -1
  157. package/dist/features/converters/lexicalToHtml/async/converters/text.js.map +1 -1
  158. package/dist/features/converters/lexicalToHtml/async/converters/upload.d.ts +1 -1
  159. package/dist/features/converters/lexicalToHtml/async/converters/upload.d.ts.map +1 -1
  160. package/dist/features/converters/lexicalToHtml/async/converters/upload.js +3 -3
  161. package/dist/features/converters/lexicalToHtml/async/converters/upload.js.map +1 -1
  162. package/dist/features/converters/lexicalToHtml/async/defaultConverters.d.ts +1 -1
  163. package/dist/features/converters/lexicalToHtml/async/defaultConverters.d.ts.map +1 -1
  164. package/dist/features/converters/lexicalToHtml/async/defaultConverters.js.map +1 -1
  165. package/dist/features/converters/lexicalToHtml/async/types.d.ts +15 -16
  166. package/dist/features/converters/lexicalToHtml/async/types.d.ts.map +1 -1
  167. package/dist/features/converters/lexicalToHtml/async/types.js.map +1 -1
  168. package/dist/features/converters/lexicalToHtml/shared/cssColors.d.ts.map +1 -1
  169. package/dist/features/converters/lexicalToHtml/shared/findConverterForNode.d.ts.map +1 -1
  170. package/dist/features/converters/lexicalToHtml/shared/findConverterForNode.js +3 -2
  171. package/dist/features/converters/lexicalToHtml/shared/findConverterForNode.js.map +1 -1
  172. package/dist/features/converters/lexicalToHtml/sync/converters/blockquote.d.ts +1 -1
  173. package/dist/features/converters/lexicalToHtml/sync/converters/blockquote.d.ts.map +1 -1
  174. package/dist/features/converters/lexicalToHtml/sync/converters/blockquote.js.map +1 -1
  175. package/dist/features/converters/lexicalToHtml/sync/converters/heading.d.ts +1 -1
  176. package/dist/features/converters/lexicalToHtml/sync/converters/heading.d.ts.map +1 -1
  177. package/dist/features/converters/lexicalToHtml/sync/converters/heading.js +1 -1
  178. package/dist/features/converters/lexicalToHtml/sync/converters/heading.js.map +1 -1
  179. package/dist/features/converters/lexicalToHtml/sync/converters/horizontalRule.d.ts +1 -1
  180. package/dist/features/converters/lexicalToHtml/sync/converters/horizontalRule.d.ts.map +1 -1
  181. package/dist/features/converters/lexicalToHtml/sync/converters/horizontalRule.js.map +1 -1
  182. package/dist/features/converters/lexicalToHtml/sync/converters/linebreak.d.ts +1 -1
  183. package/dist/features/converters/lexicalToHtml/sync/converters/linebreak.d.ts.map +1 -1
  184. package/dist/features/converters/lexicalToHtml/sync/converters/linebreak.js.map +1 -1
  185. package/dist/features/converters/lexicalToHtml/sync/converters/link.d.ts +1 -1
  186. package/dist/features/converters/lexicalToHtml/sync/converters/link.d.ts.map +1 -1
  187. package/dist/features/converters/lexicalToHtml/sync/converters/link.js.map +1 -1
  188. package/dist/features/converters/lexicalToHtml/sync/converters/list.d.ts +1 -1
  189. package/dist/features/converters/lexicalToHtml/sync/converters/list.d.ts.map +1 -1
  190. package/dist/features/converters/lexicalToHtml/sync/converters/list.js +4 -3
  191. package/dist/features/converters/lexicalToHtml/sync/converters/list.js.map +1 -1
  192. package/dist/features/converters/lexicalToHtml/sync/converters/paragraph.d.ts +1 -1
  193. package/dist/features/converters/lexicalToHtml/sync/converters/paragraph.d.ts.map +1 -1
  194. package/dist/features/converters/lexicalToHtml/sync/converters/paragraph.js.map +1 -1
  195. package/dist/features/converters/lexicalToHtml/sync/converters/tab.d.ts +1 -1
  196. package/dist/features/converters/lexicalToHtml/sync/converters/tab.d.ts.map +1 -1
  197. package/dist/features/converters/lexicalToHtml/sync/converters/tab.js.map +1 -1
  198. package/dist/features/converters/lexicalToHtml/sync/converters/table.d.ts +1 -1
  199. package/dist/features/converters/lexicalToHtml/sync/converters/table.d.ts.map +1 -1
  200. package/dist/features/converters/lexicalToHtml/sync/converters/table.js.map +1 -1
  201. package/dist/features/converters/lexicalToHtml/sync/converters/text.d.ts +1 -1
  202. package/dist/features/converters/lexicalToHtml/sync/converters/text.d.ts.map +1 -1
  203. package/dist/features/converters/lexicalToHtml/sync/converters/text.js.map +1 -1
  204. package/dist/features/converters/lexicalToHtml/sync/converters/upload.d.ts +1 -1
  205. package/dist/features/converters/lexicalToHtml/sync/converters/upload.d.ts.map +1 -1
  206. package/dist/features/converters/lexicalToHtml/sync/converters/upload.js +3 -3
  207. package/dist/features/converters/lexicalToHtml/sync/converters/upload.js.map +1 -1
  208. package/dist/features/converters/lexicalToHtml/sync/defaultConverters.d.ts +1 -1
  209. package/dist/features/converters/lexicalToHtml/sync/defaultConverters.d.ts.map +1 -1
  210. package/dist/features/converters/lexicalToHtml/sync/defaultConverters.js.map +1 -1
  211. package/dist/features/converters/lexicalToHtml/sync/types.d.ts +15 -16
  212. package/dist/features/converters/lexicalToHtml/sync/types.d.ts.map +1 -1
  213. package/dist/features/converters/lexicalToHtml/sync/types.js.map +1 -1
  214. package/dist/features/converters/lexicalToJSX/Component/index.d.ts +6 -4
  215. package/dist/features/converters/lexicalToJSX/Component/index.d.ts.map +1 -1
  216. package/dist/features/converters/lexicalToJSX/Component/index.js +5 -4
  217. package/dist/features/converters/lexicalToJSX/Component/index.js.map +1 -1
  218. package/dist/features/converters/lexicalToJSX/converter/converters/blockquote.d.ts +1 -1
  219. package/dist/features/converters/lexicalToJSX/converter/converters/blockquote.d.ts.map +1 -1
  220. package/dist/features/converters/lexicalToJSX/converter/converters/blockquote.js.map +1 -1
  221. package/dist/features/converters/lexicalToJSX/converter/converters/heading.d.ts +1 -1
  222. package/dist/features/converters/lexicalToJSX/converter/converters/heading.d.ts.map +1 -1
  223. package/dist/features/converters/lexicalToJSX/converter/converters/heading.js +2 -1
  224. package/dist/features/converters/lexicalToJSX/converter/converters/heading.js.map +1 -1
  225. package/dist/features/converters/lexicalToJSX/converter/converters/horizontalRule.d.ts +1 -1
  226. package/dist/features/converters/lexicalToJSX/converter/converters/horizontalRule.d.ts.map +1 -1
  227. package/dist/features/converters/lexicalToJSX/converter/converters/horizontalRule.js.map +1 -1
  228. package/dist/features/converters/lexicalToJSX/converter/converters/linebreak.d.ts +1 -1
  229. package/dist/features/converters/lexicalToJSX/converter/converters/linebreak.d.ts.map +1 -1
  230. package/dist/features/converters/lexicalToJSX/converter/converters/linebreak.js.map +1 -1
  231. package/dist/features/converters/lexicalToJSX/converter/converters/link.d.ts +1 -1
  232. package/dist/features/converters/lexicalToJSX/converter/converters/link.d.ts.map +1 -1
  233. package/dist/features/converters/lexicalToJSX/converter/converters/link.js.map +1 -1
  234. package/dist/features/converters/lexicalToJSX/converter/converters/list.d.ts +1 -1
  235. package/dist/features/converters/lexicalToJSX/converter/converters/list.d.ts.map +1 -1
  236. package/dist/features/converters/lexicalToJSX/converter/converters/list.js +2 -1
  237. package/dist/features/converters/lexicalToJSX/converter/converters/list.js.map +1 -1
  238. package/dist/features/converters/lexicalToJSX/converter/converters/paragraph.d.ts +1 -1
  239. package/dist/features/converters/lexicalToJSX/converter/converters/paragraph.d.ts.map +1 -1
  240. package/dist/features/converters/lexicalToJSX/converter/converters/paragraph.js.map +1 -1
  241. package/dist/features/converters/lexicalToJSX/converter/converters/tab.d.ts +1 -1
  242. package/dist/features/converters/lexicalToJSX/converter/converters/tab.d.ts.map +1 -1
  243. package/dist/features/converters/lexicalToJSX/converter/converters/tab.js.map +1 -1
  244. package/dist/features/converters/lexicalToJSX/converter/converters/table.d.ts +1 -1
  245. package/dist/features/converters/lexicalToJSX/converter/converters/table.d.ts.map +1 -1
  246. package/dist/features/converters/lexicalToJSX/converter/converters/table.js.map +1 -1
  247. package/dist/features/converters/lexicalToJSX/converter/converters/text.d.ts +1 -1
  248. package/dist/features/converters/lexicalToJSX/converter/converters/text.d.ts.map +1 -1
  249. package/dist/features/converters/lexicalToJSX/converter/converters/text.js.map +1 -1
  250. package/dist/features/converters/lexicalToJSX/converter/converters/upload.d.ts +1 -1
  251. package/dist/features/converters/lexicalToJSX/converter/converters/upload.d.ts.map +1 -1
  252. package/dist/features/converters/lexicalToJSX/converter/converters/upload.js +4 -5
  253. package/dist/features/converters/lexicalToJSX/converter/converters/upload.js.map +1 -1
  254. package/dist/features/converters/lexicalToJSX/converter/defaultConverters.d.ts +1 -1
  255. package/dist/features/converters/lexicalToJSX/converter/defaultConverters.d.ts.map +1 -1
  256. package/dist/features/converters/lexicalToJSX/converter/defaultConverters.js.map +1 -1
  257. package/dist/features/converters/lexicalToJSX/converter/index.d.ts +1 -1
  258. package/dist/features/converters/lexicalToJSX/converter/index.d.ts.map +1 -1
  259. package/dist/features/converters/lexicalToJSX/converter/index.js.map +1 -1
  260. package/dist/features/converters/lexicalToJSX/converter/types.d.ts +13 -15
  261. package/dist/features/converters/lexicalToJSX/converter/types.d.ts.map +1 -1
  262. package/dist/features/converters/lexicalToJSX/converter/types.js.map +1 -1
  263. package/dist/features/converters/lexicalToMarkdown/index.d.ts.map +1 -1
  264. package/dist/features/converters/lexicalToMarkdown/index.js +1 -1
  265. package/dist/features/converters/lexicalToMarkdown/index.js.map +1 -1
  266. package/dist/features/converters/lexicalToPlaintext/shared/findConverterForNode.js.map +1 -1
  267. package/dist/features/converters/lexicalToPlaintext/sync/types.d.ts +13 -15
  268. package/dist/features/converters/lexicalToPlaintext/sync/types.d.ts.map +1 -1
  269. package/dist/features/converters/lexicalToPlaintext/sync/types.js.map +1 -1
  270. package/dist/features/converters/markdownToLexical/index.d.ts +1 -1
  271. package/dist/features/converters/markdownToLexical/index.d.ts.map +1 -1
  272. package/dist/features/converters/markdownToLexical/index.js +5 -2
  273. package/dist/features/converters/markdownToLexical/index.js.map +1 -1
  274. package/dist/features/converters/utilities/payloadPopulateFn.d.ts.map +1 -1
  275. package/dist/features/converters/utilities/payloadPopulateFn.js +4 -2
  276. package/dist/features/converters/utilities/payloadPopulateFn.js.map +1 -1
  277. package/dist/features/debug/jsxConverter/client/plugin/style.css +2 -2
  278. package/dist/features/debug/testRecorder/client/plugin/index.css +0 -1
  279. package/dist/features/format/bold/feature.client.js +1 -1
  280. package/dist/features/format/bold/feature.client.js.map +1 -1
  281. package/dist/features/format/bold/feature.server.d.ts.map +1 -1
  282. package/dist/features/format/bold/feature.server.js +1 -1
  283. package/dist/features/format/bold/feature.server.js.map +1 -1
  284. package/dist/features/format/inlineCode/feature.client.js +1 -1
  285. package/dist/features/format/inlineCode/feature.client.js.map +1 -1
  286. package/dist/features/format/inlineCode/feature.server.d.ts.map +1 -1
  287. package/dist/features/format/inlineCode/feature.server.js +1 -1
  288. package/dist/features/format/inlineCode/feature.server.js.map +1 -1
  289. package/dist/features/format/italic/feature.client.js +1 -1
  290. package/dist/features/format/italic/feature.client.js.map +1 -1
  291. package/dist/features/format/italic/feature.server.d.ts.map +1 -1
  292. package/dist/features/format/italic/feature.server.js +1 -1
  293. package/dist/features/format/italic/feature.server.js.map +1 -1
  294. package/dist/features/format/shared/toolbarFormatGroup.d.ts.map +1 -1
  295. package/dist/features/format/strikethrough/feature.client.js +1 -1
  296. package/dist/features/format/strikethrough/feature.client.js.map +1 -1
  297. package/dist/features/format/strikethrough/feature.server.d.ts.map +1 -1
  298. package/dist/features/format/strikethrough/feature.server.js +1 -1
  299. package/dist/features/format/strikethrough/feature.server.js.map +1 -1
  300. package/dist/features/heading/client/index.js +2 -2
  301. package/dist/features/heading/client/index.js.map +1 -1
  302. package/dist/features/heading/constants.d.ts +2 -0
  303. package/dist/features/heading/constants.d.ts.map +1 -0
  304. package/dist/features/heading/constants.js +2 -0
  305. package/dist/features/heading/constants.js.map +1 -0
  306. package/dist/features/heading/markdownTransformer.d.ts +2 -2
  307. package/dist/features/heading/markdownTransformer.d.ts.map +1 -1
  308. package/dist/features/heading/markdownTransformer.js +6 -19
  309. package/dist/features/heading/markdownTransformer.js.map +1 -1
  310. package/dist/features/heading/server/index.d.ts +2 -4
  311. package/dist/features/heading/server/index.d.ts.map +1 -1
  312. package/dist/features/heading/server/index.js +9 -3
  313. package/dist/features/heading/server/index.js.map +1 -1
  314. package/dist/features/heading/server/schema.d.ts +10 -0
  315. package/dist/features/heading/server/schema.d.ts.map +1 -0
  316. package/dist/features/heading/server/schema.js +37 -0
  317. package/dist/features/heading/server/schema.js.map +1 -0
  318. package/dist/features/heading/server/validate.d.ts +6 -0
  319. package/dist/features/heading/server/validate.d.ts.map +1 -0
  320. package/dist/features/heading/server/validate.js +15 -0
  321. package/dist/features/heading/server/validate.js.map +1 -0
  322. package/dist/features/horizontalRule/client/index.js +2 -2
  323. package/dist/features/horizontalRule/client/index.js.map +1 -1
  324. package/dist/features/horizontalRule/client/markdownTransformer.d.ts +2 -2
  325. package/dist/features/horizontalRule/client/markdownTransformer.d.ts.map +1 -1
  326. package/dist/features/horizontalRule/client/markdownTransformer.js +1 -1
  327. package/dist/features/horizontalRule/client/markdownTransformer.js.map +1 -1
  328. package/dist/features/horizontalRule/client/nodes/HorizontalRuleNode.d.ts +13 -3
  329. package/dist/features/horizontalRule/client/nodes/HorizontalRuleNode.d.ts.map +1 -1
  330. package/dist/features/horizontalRule/client/nodes/HorizontalRuleNode.js +18 -1
  331. package/dist/features/horizontalRule/client/nodes/HorizontalRuleNode.js.map +1 -1
  332. package/dist/features/horizontalRule/client/plugin/index.css +2 -2
  333. package/dist/features/horizontalRule/server/index.d.ts +1 -0
  334. package/dist/features/horizontalRule/server/index.d.ts.map +1 -1
  335. package/dist/features/horizontalRule/server/index.js +4 -2
  336. package/dist/features/horizontalRule/server/index.js.map +1 -1
  337. package/dist/features/horizontalRule/server/markdownTransformer.d.ts +2 -2
  338. package/dist/features/horizontalRule/server/markdownTransformer.d.ts.map +1 -1
  339. package/dist/features/horizontalRule/server/markdownTransformer.js +1 -1
  340. package/dist/features/horizontalRule/server/markdownTransformer.js.map +1 -1
  341. package/dist/features/horizontalRule/server/nodes/HorizontalRuleNode.d.ts +2 -6
  342. package/dist/features/horizontalRule/server/nodes/HorizontalRuleNode.d.ts.map +1 -1
  343. package/dist/features/horizontalRule/server/nodes/HorizontalRuleNode.js +3 -3
  344. package/dist/features/horizontalRule/server/nodes/HorizontalRuleNode.js.map +1 -1
  345. package/dist/features/horizontalRule/server/schema.d.ts +8 -0
  346. package/dist/features/horizontalRule/server/schema.d.ts.map +1 -0
  347. package/dist/features/horizontalRule/server/schema.js +26 -0
  348. package/dist/features/horizontalRule/server/schema.js.map +1 -0
  349. package/dist/features/indent/client/IndentPlugin.d.ts.map +1 -1
  350. package/dist/features/indent/client/IndentPlugin.js +122 -1
  351. package/dist/features/indent/client/IndentPlugin.js.map +1 -1
  352. package/dist/features/indent/client/toolbarIndentGroup.d.ts.map +1 -1
  353. package/dist/features/indent/server/i18n.d.ts.map +1 -1
  354. package/dist/features/indent/server/i18n.js +74 -37
  355. package/dist/features/indent/server/i18n.js.map +1 -1
  356. package/dist/features/link/client/index.d.ts.map +1 -1
  357. package/dist/features/link/client/index.js +2 -2
  358. package/dist/features/link/client/index.js.map +1 -1
  359. package/dist/features/link/client/plugins/autoLink/index.d.ts +1 -1
  360. package/dist/features/link/client/plugins/autoLink/index.d.ts.map +1 -1
  361. package/dist/features/link/client/plugins/autoLink/index.js.map +1 -1
  362. package/dist/features/link/client/plugins/floatingLinkEditor/LinkEditor/index.d.ts.map +1 -1
  363. package/dist/features/link/client/plugins/floatingLinkEditor/LinkEditor/index.js +11 -8
  364. package/dist/features/link/client/plugins/floatingLinkEditor/LinkEditor/index.js.map +1 -1
  365. package/dist/features/link/client/plugins/floatingLinkEditor/index.css +7 -13
  366. package/dist/features/link/client/plugins/floatingLinkEditor/types.d.ts +1 -1
  367. package/dist/features/link/client/plugins/floatingLinkEditor/types.d.ts.map +1 -1
  368. package/dist/features/link/client/plugins/floatingLinkEditor/types.js.map +1 -1
  369. package/dist/features/link/client/plugins/link/index.js.map +1 -1
  370. package/dist/features/link/markdownTransformer.d.ts +5 -5
  371. package/dist/features/link/markdownTransformer.d.ts.map +1 -1
  372. package/dist/features/link/markdownTransformer.js +2 -2
  373. package/dist/features/link/markdownTransformer.js.map +1 -1
  374. package/dist/features/link/nodes/AutoLinkNode.d.ts +4 -4
  375. package/dist/features/link/nodes/AutoLinkNode.d.ts.map +1 -1
  376. package/dist/features/link/nodes/AutoLinkNode.js +4 -11
  377. package/dist/features/link/nodes/AutoLinkNode.js.map +1 -1
  378. package/dist/features/link/nodes/LinkNode.d.ts +4 -4
  379. package/dist/features/link/nodes/LinkNode.d.ts.map +1 -1
  380. package/dist/features/link/nodes/LinkNode.js +4 -16
  381. package/dist/features/link/nodes/LinkNode.js.map +1 -1
  382. package/dist/features/link/server/baseFields.d.ts.map +1 -1
  383. package/dist/features/link/server/baseFields.js.map +1 -1
  384. package/dist/features/link/server/graphQLPopulationPromise.d.ts +1 -1
  385. package/dist/features/link/server/graphQLPopulationPromise.d.ts.map +1 -1
  386. package/dist/features/link/server/graphQLPopulationPromise.js.map +1 -1
  387. package/dist/features/link/server/index.d.ts +2 -1
  388. package/dist/features/link/server/index.d.ts.map +1 -1
  389. package/dist/features/link/server/index.js +7 -4
  390. package/dist/features/link/server/index.js.map +1 -1
  391. package/dist/features/link/server/schema.d.ts +32 -0
  392. package/dist/features/link/server/schema.d.ts.map +1 -0
  393. package/dist/features/link/server/schema.js +171 -0
  394. package/dist/features/link/server/schema.js.map +1 -0
  395. package/dist/features/link/server/validate.d.ts +1 -1
  396. package/dist/features/link/server/validate.d.ts.map +1 -1
  397. package/dist/features/link/server/validate.js +1 -1
  398. package/dist/features/link/server/validate.js.map +1 -1
  399. package/dist/features/lists/checklist/client/index.js +1 -1
  400. package/dist/features/lists/checklist/client/index.js.map +1 -1
  401. package/dist/features/lists/checklist/server/index.d.ts.map +1 -1
  402. package/dist/features/lists/checklist/server/index.js +9 -3
  403. package/dist/features/lists/checklist/server/index.js.map +1 -1
  404. package/dist/features/lists/orderedList/client/index.js +1 -1
  405. package/dist/features/lists/orderedList/client/index.js.map +1 -1
  406. package/dist/features/lists/orderedList/server/index.d.ts.map +1 -1
  407. package/dist/features/lists/orderedList/server/index.js +9 -3
  408. package/dist/features/lists/orderedList/server/index.js.map +1 -1
  409. package/dist/features/lists/plugin/index.d.ts +0 -9
  410. package/dist/features/lists/plugin/index.d.ts.map +1 -1
  411. package/dist/features/lists/plugin/index.js.map +1 -1
  412. package/dist/features/lists/shared/constants.d.ts +2 -0
  413. package/dist/features/lists/shared/constants.d.ts.map +1 -0
  414. package/dist/features/lists/shared/constants.js +2 -0
  415. package/dist/features/lists/shared/constants.js.map +1 -0
  416. package/dist/features/lists/shared/schema.d.ts +18 -0
  417. package/dist/features/lists/shared/schema.d.ts.map +1 -0
  418. package/dist/features/lists/shared/schema.js +62 -0
  419. package/dist/features/lists/shared/schema.js.map +1 -0
  420. package/dist/features/lists/shared/validate.d.ts +5 -0
  421. package/dist/features/lists/shared/validate.d.ts.map +1 -0
  422. package/dist/features/lists/shared/validate.js +15 -0
  423. package/dist/features/lists/shared/validate.js.map +1 -0
  424. package/dist/features/lists/unorderedList/client/index.js +1 -1
  425. package/dist/features/lists/unorderedList/client/index.js.map +1 -1
  426. package/dist/features/lists/unorderedList/server/index.d.ts.map +1 -1
  427. package/dist/features/lists/unorderedList/server/index.js +9 -3
  428. package/dist/features/lists/unorderedList/server/index.js.map +1 -1
  429. package/dist/features/relationship/client/components/RelationshipComponent.d.ts +1 -1
  430. package/dist/features/relationship/client/components/RelationshipComponent.d.ts.map +1 -1
  431. package/dist/features/relationship/client/components/RelationshipComponent.js.map +1 -1
  432. package/dist/features/relationship/client/components/index.css +3 -6
  433. package/dist/features/relationship/client/drawer/index.d.ts.map +1 -1
  434. package/dist/features/relationship/client/index.d.ts +2 -2
  435. package/dist/features/relationship/client/index.d.ts.map +1 -1
  436. package/dist/features/relationship/client/index.js.map +1 -1
  437. package/dist/features/relationship/client/nodes/RelationshipNode.d.ts +1 -1
  438. package/dist/features/relationship/client/nodes/RelationshipNode.d.ts.map +1 -1
  439. package/dist/features/relationship/client/nodes/RelationshipNode.js +0 -3
  440. package/dist/features/relationship/client/nodes/RelationshipNode.js.map +1 -1
  441. package/dist/features/relationship/client/plugins/index.d.ts +3 -3
  442. package/dist/features/relationship/client/plugins/index.d.ts.map +1 -1
  443. package/dist/features/relationship/client/plugins/index.js +27 -31
  444. package/dist/features/relationship/client/plugins/index.js.map +1 -1
  445. package/dist/features/relationship/client/utils/useEnabledRelationships.d.ts +2 -4
  446. package/dist/features/relationship/client/utils/useEnabledRelationships.d.ts.map +1 -1
  447. package/dist/features/relationship/client/utils/useEnabledRelationships.js +52 -50
  448. package/dist/features/relationship/client/utils/useEnabledRelationships.js.map +1 -1
  449. package/dist/features/relationship/server/graphQLPopulationPromise.d.ts +3 -3
  450. package/dist/features/relationship/server/graphQLPopulationPromise.d.ts.map +1 -1
  451. package/dist/features/relationship/server/graphQLPopulationPromise.js +2 -2
  452. package/dist/features/relationship/server/graphQLPopulationPromise.js.map +1 -1
  453. package/dist/features/relationship/server/index.d.ts +9 -1
  454. package/dist/features/relationship/server/index.d.ts.map +1 -1
  455. package/dist/features/relationship/server/index.js +30 -11
  456. package/dist/features/relationship/server/index.js.map +1 -1
  457. package/dist/features/relationship/server/nodes/RelationshipNode.d.ts +1 -10
  458. package/dist/features/relationship/server/nodes/RelationshipNode.d.ts.map +1 -1
  459. package/dist/features/relationship/server/nodes/RelationshipNode.js +1 -5
  460. package/dist/features/relationship/server/nodes/RelationshipNode.js.map +1 -1
  461. package/dist/features/relationship/server/schema.d.ts +29 -0
  462. package/dist/features/relationship/server/schema.d.ts.map +1 -0
  463. package/dist/features/relationship/server/schema.js +94 -0
  464. package/dist/features/relationship/server/schema.js.map +1 -0
  465. package/dist/features/relationship/shared/filterEnabledRelationshipCollections.d.ts +18 -0
  466. package/dist/features/relationship/shared/filterEnabledRelationshipCollections.d.ts.map +1 -0
  467. package/dist/features/relationship/shared/filterEnabledRelationshipCollections.js +30 -0
  468. package/dist/features/relationship/shared/filterEnabledRelationshipCollections.js.map +1 -0
  469. package/dist/features/shared/toolbar/addDropdownGroup.d.ts.map +1 -1
  470. package/dist/features/shared/toolbar/featureButtonsGroup.d.ts.map +1 -1
  471. package/dist/features/shared/toolbar/textDropdownGroup.d.ts.map +1 -1
  472. package/dist/features/table/client/index.d.ts.map +1 -0
  473. package/dist/features/{experimental_table → table}/client/index.js +2 -2
  474. package/dist/features/table/client/index.js.map +1 -0
  475. package/dist/features/table/client/plugins/TableActionMenuPlugin/computeSelectionCount.d.ts +8 -0
  476. package/dist/features/table/client/plugins/TableActionMenuPlugin/computeSelectionCount.d.ts.map +1 -0
  477. package/dist/features/table/client/plugins/TableActionMenuPlugin/computeSelectionCount.js +19 -0
  478. package/dist/features/table/client/plugins/TableActionMenuPlugin/computeSelectionCount.js.map +1 -0
  479. package/dist/features/{experimental_table → table}/client/plugins/TableActionMenuPlugin/index.css +4 -5
  480. package/dist/features/table/client/plugins/TableActionMenuPlugin/index.d.ts.map +1 -0
  481. package/dist/features/{experimental_table → table}/client/plugins/TableActionMenuPlugin/index.js +17 -44
  482. package/dist/features/table/client/plugins/TableActionMenuPlugin/index.js.map +1 -0
  483. package/dist/features/table/client/plugins/TableCellResizerPlugin/index.d.ts.map +1 -0
  484. package/dist/features/{experimental_table → table}/client/plugins/TableCellResizerPlugin/index.js +41 -18
  485. package/dist/features/table/client/plugins/TableCellResizerPlugin/index.js.map +1 -0
  486. package/dist/features/table/client/plugins/TableHoverActionsPlugin/index.d.ts.map +1 -0
  487. package/dist/features/table/client/plugins/TableHoverActionsPlugin/index.js.map +1 -0
  488. package/dist/features/{experimental_table → table}/client/plugins/TablePlugin/TableGridPopup/index.css +1 -4
  489. package/dist/features/table/client/plugins/TablePlugin/TableGridPopup/index.d.ts.map +1 -0
  490. package/dist/features/table/client/plugins/TablePlugin/TableGridPopup/index.js.map +1 -0
  491. package/dist/features/table/client/plugins/TablePlugin/index.d.ts.map +1 -0
  492. package/dist/features/table/client/plugins/TablePlugin/index.js.map +1 -0
  493. package/dist/features/table/client/utils/debounce.d.ts.map +1 -0
  494. package/dist/features/table/client/utils/debounce.js.map +1 -0
  495. package/dist/features/table/client/utils/useDebounce.d.ts.map +1 -0
  496. package/dist/features/table/client/utils/useDebounce.js.map +1 -0
  497. package/dist/features/table/markdownTransformer.d.ts +5 -0
  498. package/dist/features/table/markdownTransformer.d.ts.map +1 -0
  499. package/dist/features/{experimental_table → table}/markdownTransformer.js +6 -3
  500. package/dist/features/table/markdownTransformer.js.map +1 -0
  501. package/dist/features/table/server/index.d.ts +3 -0
  502. package/dist/features/table/server/index.d.ts.map +1 -0
  503. package/dist/features/{experimental_table → table}/server/index.js +10 -6
  504. package/dist/features/table/server/index.js.map +1 -0
  505. package/dist/features/table/server/schema.d.ts +27 -0
  506. package/dist/features/table/server/schema.d.ts.map +1 -0
  507. package/dist/features/table/server/schema.js +107 -0
  508. package/dist/features/table/server/schema.js.map +1 -0
  509. package/dist/features/textState/feature.client.js +1 -1
  510. package/dist/features/textState/feature.client.js.map +1 -1
  511. package/dist/features/toolbars/fixed/client/Toolbar/horizontalWheelScroll.d.ts +8 -0
  512. package/dist/features/toolbars/fixed/client/Toolbar/horizontalWheelScroll.d.ts.map +1 -0
  513. package/dist/features/toolbars/fixed/client/Toolbar/horizontalWheelScroll.js +80 -0
  514. package/dist/features/toolbars/fixed/client/Toolbar/horizontalWheelScroll.js.map +1 -0
  515. package/dist/features/toolbars/fixed/client/Toolbar/index.css +80 -8
  516. package/dist/features/toolbars/fixed/client/Toolbar/index.d.ts.map +1 -1
  517. package/dist/features/toolbars/fixed/client/Toolbar/index.js +19 -1
  518. package/dist/features/toolbars/fixed/client/Toolbar/index.js.map +1 -1
  519. package/dist/features/toolbars/inline/client/Toolbar/index.css +2 -14
  520. package/dist/features/toolbars/inline/client/Toolbar/index.d.ts.map +1 -1
  521. package/dist/features/toolbars/inline/client/Toolbar/index.js +17 -2
  522. package/dist/features/toolbars/inline/client/Toolbar/index.js.map +1 -1
  523. package/dist/features/toolbars/shared/ToolbarButton/index.d.ts.map +1 -1
  524. package/dist/features/toolbars/shared/ToolbarButton/index.js +1 -0
  525. package/dist/features/toolbars/shared/ToolbarButton/index.js.map +1 -1
  526. package/dist/features/toolbars/shared/ToolbarDropdown/DropDown.d.ts.map +1 -1
  527. package/dist/features/toolbars/shared/ToolbarDropdown/DropDown.js +85 -32
  528. package/dist/features/toolbars/shared/ToolbarDropdown/DropDown.js.map +1 -1
  529. package/dist/features/toolbars/shared/ToolbarDropdown/index.css +23 -25
  530. package/dist/features/toolbars/shared/ToolbarDropdown/index.d.ts.map +1 -1
  531. package/dist/features/toolbars/shared/ToolbarDropdown/index.js.map +1 -1
  532. package/dist/features/toolbars/shared/useToolbarKeyboardNavigation.d.ts +5 -0
  533. package/dist/features/toolbars/shared/useToolbarKeyboardNavigation.d.ts.map +1 -0
  534. package/dist/features/toolbars/shared/useToolbarKeyboardNavigation.js +79 -0
  535. package/dist/features/toolbars/shared/useToolbarKeyboardNavigation.js.map +1 -0
  536. package/dist/features/toolbars/shared/useToolbarStates.d.ts.map +1 -1
  537. package/dist/features/toolbars/shared/useToolbarStates.js +3 -1
  538. package/dist/features/toolbars/shared/useToolbarStates.js.map +1 -1
  539. package/dist/features/toolbars/types.d.ts +1 -1
  540. package/dist/features/toolbars/types.d.ts.map +1 -1
  541. package/dist/features/toolbars/types.js.map +1 -1
  542. package/dist/features/typesClient.d.ts +2 -2
  543. package/dist/features/typesClient.d.ts.map +1 -1
  544. package/dist/features/typesClient.js.map +1 -1
  545. package/dist/features/typesServer.d.ts +35 -53
  546. package/dist/features/typesServer.d.ts.map +1 -1
  547. package/dist/features/typesServer.js.map +1 -1
  548. package/dist/features/upload/client/component/index.css +18 -26
  549. package/dist/features/upload/client/component/index.d.ts +1 -1
  550. package/dist/features/upload/client/component/index.d.ts.map +1 -1
  551. package/dist/features/upload/client/component/index.js +3 -2
  552. package/dist/features/upload/client/component/index.js.map +1 -1
  553. package/dist/features/upload/client/drawer/index.d.ts.map +1 -1
  554. package/dist/features/upload/client/index.d.ts +3 -2
  555. package/dist/features/upload/client/index.d.ts.map +1 -1
  556. package/dist/features/upload/client/index.js.map +1 -1
  557. package/dist/features/upload/client/nodes/UploadNode.d.ts +1 -1
  558. package/dist/features/upload/client/nodes/UploadNode.d.ts.map +1 -1
  559. package/dist/features/upload/client/nodes/UploadNode.js +0 -7
  560. package/dist/features/upload/client/nodes/UploadNode.js.map +1 -1
  561. package/dist/features/upload/client/plugin/index.d.ts +1 -1
  562. package/dist/features/upload/client/plugin/index.d.ts.map +1 -1
  563. package/dist/features/upload/client/plugin/index.js +53 -56
  564. package/dist/features/upload/client/plugin/index.js.map +1 -1
  565. package/dist/features/upload/server/graphQLPopulationPromise.d.ts +3 -3
  566. package/dist/features/upload/server/graphQLPopulationPromise.d.ts.map +1 -1
  567. package/dist/features/upload/server/graphQLPopulationPromise.js +1 -1
  568. package/dist/features/upload/server/graphQLPopulationPromise.js.map +1 -1
  569. package/dist/features/upload/server/index.d.ts +7 -2
  570. package/dist/features/upload/server/index.d.ts.map +1 -1
  571. package/dist/features/upload/server/index.js +25 -20
  572. package/dist/features/upload/server/index.js.map +1 -1
  573. package/dist/features/upload/server/markdownTransformer.d.ts +2 -2
  574. package/dist/features/upload/server/markdownTransformer.d.ts.map +1 -1
  575. package/dist/features/upload/server/markdownTransformer.js +1 -1
  576. package/dist/features/upload/server/markdownTransformer.js.map +1 -1
  577. package/dist/features/upload/server/nodes/UploadNode.d.ts +1 -55
  578. package/dist/features/upload/server/nodes/UploadNode.d.ts.map +1 -1
  579. package/dist/features/upload/server/nodes/UploadNode.js +1 -9
  580. package/dist/features/upload/server/nodes/UploadNode.js.map +1 -1
  581. package/dist/features/upload/server/nodes/conversions.d.ts.map +1 -1
  582. package/dist/features/upload/server/nodes/conversions.js.map +1 -1
  583. package/dist/features/upload/server/schema.d.ts +40 -0
  584. package/dist/features/upload/server/schema.d.ts.map +1 -0
  585. package/dist/features/upload/server/schema.js +147 -0
  586. package/dist/features/upload/server/schema.js.map +1 -0
  587. package/dist/features/upload/server/validate.d.ts +3 -3
  588. package/dist/features/upload/server/validate.d.ts.map +1 -1
  589. package/dist/features/upload/server/validate.js +4 -1
  590. package/dist/features/upload/server/validate.js.map +1 -1
  591. package/dist/field/Diff/converters/link.d.ts +1 -1
  592. package/dist/field/Diff/converters/link.d.ts.map +1 -1
  593. package/dist/field/Diff/converters/link.js.map +1 -1
  594. package/dist/field/Diff/converters/listitem/index.css +44 -8
  595. package/dist/field/Diff/converters/listitem/index.d.ts +1 -1
  596. package/dist/field/Diff/converters/listitem/index.d.ts.map +1 -1
  597. package/dist/field/Diff/converters/listitem/index.js +2 -1
  598. package/dist/field/Diff/converters/listitem/index.js.map +1 -1
  599. package/dist/field/Diff/converters/relationship/index.css +75 -36
  600. package/dist/field/Diff/converters/relationship/index.d.ts +1 -1
  601. package/dist/field/Diff/converters/relationship/index.d.ts.map +1 -1
  602. package/dist/field/Diff/converters/relationship/index.js +10 -28
  603. package/dist/field/Diff/converters/relationship/index.js.map +1 -1
  604. package/dist/field/Diff/converters/unknown/index.css +1 -2
  605. package/dist/field/Diff/converters/unknown/index.js.map +1 -1
  606. package/dist/field/Diff/converters/upload/index.css +105 -43
  607. package/dist/field/Diff/converters/upload/index.d.ts +1 -1
  608. package/dist/field/Diff/converters/upload/index.d.ts.map +1 -1
  609. package/dist/field/Diff/converters/upload/index.js +6 -2
  610. package/dist/field/Diff/converters/upload/index.js.map +1 -1
  611. package/dist/field/Diff/index.css +114 -61
  612. package/dist/field/Diff/index.d.ts +3 -2
  613. package/dist/field/Diff/index.d.ts.map +1 -1
  614. package/dist/field/Diff/index.js +3 -2
  615. package/dist/field/Diff/index.js.map +1 -1
  616. package/dist/field/Field.d.ts +1 -1
  617. package/dist/field/Field.d.ts.map +1 -1
  618. package/dist/field/Field.js +26 -16
  619. package/dist/field/Field.js.map +1 -1
  620. package/dist/field/RenderLexical/index.d.ts +5 -3
  621. package/dist/field/RenderLexical/index.d.ts.map +1 -1
  622. package/dist/field/RenderLexical/index.js +23 -23
  623. package/dist/field/RenderLexical/index.js.map +1 -1
  624. package/dist/field/RichTextViewProvider.d.ts +1 -1
  625. package/dist/field/RichTextViewProvider.d.ts.map +1 -1
  626. package/dist/field/RichTextViewProvider.js.map +1 -1
  627. package/dist/field/ViewSelector.css +1 -1
  628. package/dist/field/ViewSelector.d.ts.map +1 -1
  629. package/dist/field/ViewSelector.js +1 -0
  630. package/dist/field/ViewSelector.js.map +1 -1
  631. package/dist/field/bundled.css +1 -1
  632. package/dist/field/index.css +15 -16
  633. package/dist/field/index.d.ts +1 -1
  634. package/dist/field/index.d.ts.map +1 -1
  635. package/dist/field/index.js +1 -1
  636. package/dist/field/index.js.map +1 -1
  637. package/dist/field/rscEntry.d.ts +2 -2
  638. package/dist/field/rscEntry.d.ts.map +1 -1
  639. package/dist/field/rscEntry.js +2 -0
  640. package/dist/field/rscEntry.js.map +1 -1
  641. package/dist/hooks.d.ts +6 -0
  642. package/dist/hooks.d.ts.map +1 -0
  643. package/dist/hooks.js +548 -0
  644. package/dist/hooks.js.map +1 -0
  645. package/dist/i18n.d.ts.map +1 -1
  646. package/dist/i18n.js +68 -0
  647. package/dist/i18n.js.map +1 -1
  648. package/dist/index.d.ts +15 -12
  649. package/dist/index.d.ts.map +1 -1
  650. package/dist/index.js +37 -624
  651. package/dist/index.js.map +1 -1
  652. package/dist/lexical/LexicalEditor.css +30 -19
  653. package/dist/lexical/LexicalEditor.d.ts.map +1 -1
  654. package/dist/lexical/LexicalEditor.js +61 -64
  655. package/dist/lexical/LexicalEditor.js.map +1 -1
  656. package/dist/lexical/LexicalProvider.d.ts +1 -1
  657. package/dist/lexical/LexicalProvider.d.ts.map +1 -1
  658. package/dist/lexical/LexicalProvider.js.map +1 -1
  659. package/dist/lexical/config/client/EditorConfigProvider.d.ts +1 -1
  660. package/dist/lexical/config/client/EditorConfigProvider.d.ts.map +1 -1
  661. package/dist/lexical/config/client/EditorConfigProvider.js.map +1 -1
  662. package/dist/lexical/config/client/loader.d.ts +1 -1
  663. package/dist/lexical/config/client/loader.d.ts.map +1 -1
  664. package/dist/lexical/config/client/loader.js +5 -1
  665. package/dist/lexical/config/client/loader.js.map +1 -1
  666. package/dist/lexical/config/client/sanitize.d.ts +1 -1
  667. package/dist/lexical/config/client/sanitize.d.ts.map +1 -1
  668. package/dist/lexical/config/client/sanitize.js.map +1 -1
  669. package/dist/lexical/config/server/loader.d.ts +1 -1
  670. package/dist/lexical/config/server/loader.d.ts.map +1 -1
  671. package/dist/lexical/config/server/loader.js +2 -2
  672. package/dist/lexical/config/server/loader.js.map +1 -1
  673. package/dist/lexical/config/server/sanitize.d.ts +1 -1
  674. package/dist/lexical/config/server/sanitize.d.ts.map +1 -1
  675. package/dist/lexical/config/server/sanitize.js +11 -13
  676. package/dist/lexical/config/server/sanitize.js.map +1 -1
  677. package/dist/lexical/config/types.d.ts +1 -1
  678. package/dist/lexical/config/types.d.ts.map +1 -1
  679. package/dist/lexical/config/types.js.map +1 -1
  680. package/dist/lexical/nodes/index.d.ts +1 -1
  681. package/dist/lexical/nodes/index.d.ts.map +1 -1
  682. package/dist/lexical/nodes/index.js.map +1 -1
  683. package/dist/lexical/plugins/DecoratorPlugin/index.css +1 -1
  684. package/dist/lexical/plugins/DecoratorPlugin/index.d.ts.map +1 -1
  685. package/dist/lexical/plugins/DecoratorPlugin/index.js +24 -21
  686. package/dist/lexical/plugins/DecoratorPlugin/index.js.map +1 -1
  687. package/dist/lexical/plugins/InsertParagraphAtEnd/index.css +18 -25
  688. package/dist/lexical/plugins/InsertParagraphAtEnd/index.d.ts.map +1 -1
  689. package/dist/lexical/plugins/InsertParagraphAtEnd/index.js +27 -14
  690. package/dist/lexical/plugins/InsertParagraphAtEnd/index.js.map +1 -1
  691. package/dist/lexical/plugins/MarkdownShortcut/index.d.ts.map +1 -1
  692. package/dist/lexical/plugins/MarkdownShortcut/index.js +1 -1
  693. package/dist/lexical/plugins/MarkdownShortcut/index.js.map +1 -1
  694. package/dist/lexical/plugins/NodeViewOverridePlugin/index.d.ts.map +1 -1
  695. package/dist/lexical/plugins/NodeViewOverridePlugin/index.js +21 -0
  696. package/dist/lexical/plugins/NodeViewOverridePlugin/index.js.map +1 -1
  697. package/dist/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/LexicalMenu.d.ts +0 -1
  698. package/dist/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/LexicalMenu.d.ts.map +1 -1
  699. package/dist/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/LexicalMenu.js +2 -21
  700. package/dist/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/LexicalMenu.js.map +1 -1
  701. package/dist/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/types.d.ts +1 -1
  702. package/dist/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/types.d.ts.map +1 -1
  703. package/dist/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/types.js.map +1 -1
  704. package/dist/lexical/plugins/SlashMenu/index.css +1 -7
  705. package/dist/lexical/plugins/handles/AddBlockHandlePlugin/index.css +2 -1
  706. package/dist/lexical/plugins/handles/AddBlockHandlePlugin/index.js +2 -2
  707. package/dist/lexical/plugins/handles/AddBlockHandlePlugin/index.js.map +1 -1
  708. package/dist/lexical/plugins/handles/DraggableBlockPlugin/debounce.d.ts.map +1 -1
  709. package/dist/lexical/plugins/handles/DraggableBlockPlugin/index.css +5 -3
  710. package/dist/lexical/plugins/handles/DraggableBlockPlugin/index.d.ts.map +1 -1
  711. package/dist/lexical/plugins/handles/DraggableBlockPlugin/index.js +17 -3
  712. package/dist/lexical/plugins/handles/DraggableBlockPlugin/index.js.map +1 -1
  713. package/dist/lexical/plugins/handles/DraggableBlockPlugin/useKeyboardReordering.d.ts +7 -0
  714. package/dist/lexical/plugins/handles/DraggableBlockPlugin/useKeyboardReordering.d.ts.map +1 -0
  715. package/dist/lexical/plugins/handles/DraggableBlockPlugin/useKeyboardReordering.js +65 -0
  716. package/dist/lexical/plugins/handles/DraggableBlockPlugin/useKeyboardReordering.js.map +1 -0
  717. package/dist/lexical/plugins/handles/utils/calculateDistanceFromScrollerElem.d.ts.map +1 -1
  718. package/dist/lexical/plugins/handles/utils/setHandlePosition.d.ts.map +1 -1
  719. package/dist/lexical/plugins/handles/utils/setHandlePosition.js +2 -0
  720. package/dist/lexical/plugins/handles/utils/setHandlePosition.js.map +1 -1
  721. package/dist/lexical/theme/EditorTheme.css +18 -21
  722. package/dist/lexical/ui/ContentEditable.css +22 -17
  723. package/dist/lexical/ui/ContentEditable.d.ts +2 -1
  724. package/dist/lexical/ui/ContentEditable.d.ts.map +1 -1
  725. package/dist/lexical/ui/ContentEditable.js +32 -11
  726. package/dist/lexical/ui/ContentEditable.js.map +1 -1
  727. package/dist/lexical/ui/icons/H3/index.d.ts.map +1 -1
  728. package/dist/lexical/ui/icons/H3/index.js +13 -6
  729. package/dist/lexical/ui/icons/H3/index.js.map +1 -1
  730. package/dist/lexical/ui/icons/H4/index.d.ts.map +1 -1
  731. package/dist/lexical/ui/icons/H4/index.js +13 -6
  732. package/dist/lexical/ui/icons/H4/index.js.map +1 -1
  733. package/dist/lexical/ui/icons/H5/index.d.ts.map +1 -1
  734. package/dist/lexical/ui/icons/H5/index.js +13 -6
  735. package/dist/lexical/ui/icons/H5/index.js.map +1 -1
  736. package/dist/lexical/ui/icons/H6/index.d.ts.map +1 -1
  737. package/dist/lexical/ui/icons/H6/index.js +13 -6
  738. package/dist/lexical/ui/icons/H6/index.js.map +1 -1
  739. package/dist/lexical/utils/markdown/convertFromMarkdownString.d.ts +17 -0
  740. package/dist/lexical/utils/markdown/convertFromMarkdownString.d.ts.map +1 -0
  741. package/dist/lexical/utils/markdown/convertFromMarkdownString.js +27 -0
  742. package/dist/lexical/utils/markdown/convertFromMarkdownString.js.map +1 -0
  743. package/dist/lexical/utils/markdown/createBlockNode.d.ts +2 -2
  744. package/dist/lexical/utils/markdown/createBlockNode.d.ts.map +1 -1
  745. package/dist/lexical/utils/markdown/createBlockNode.js.map +1 -1
  746. package/dist/lexical/utils/markdown/normalizeMarkdown.d.ts +25 -0
  747. package/dist/lexical/utils/markdown/normalizeMarkdown.d.ts.map +1 -0
  748. package/dist/lexical/utils/markdown/normalizeMarkdown.js +91 -0
  749. package/dist/lexical/utils/markdown/normalizeMarkdown.js.map +1 -0
  750. package/dist/lexical/utils/nodeFormat.d.ts.map +1 -1
  751. package/dist/lexical/utils/point.d.ts.map +1 -1
  752. package/dist/lexical/utils/rect.d.ts.map +1 -1
  753. package/dist/lexical-proxy/@lexical-markdown.d.ts +1 -1
  754. package/dist/lexical-proxy/@lexical-markdown.d.ts.map +1 -1
  755. package/dist/lexical-proxy/@lexical-markdown.js +1 -1
  756. package/dist/lexical-proxy/@lexical-markdown.js.map +1 -1
  757. package/dist/lexical-proxy/@lexical-react/ExtensionComponent.d.ts +2 -0
  758. package/dist/lexical-proxy/@lexical-react/ExtensionComponent.d.ts.map +1 -0
  759. package/dist/lexical-proxy/@lexical-react/ExtensionComponent.js +2 -0
  760. package/dist/lexical-proxy/@lexical-react/ExtensionComponent.js.map +1 -0
  761. package/dist/lexical-proxy/@lexical-react/LexicalExtensionComposer.d.ts +2 -0
  762. package/dist/lexical-proxy/@lexical-react/LexicalExtensionComposer.d.ts.map +1 -0
  763. package/dist/lexical-proxy/@lexical-react/LexicalExtensionComposer.js +2 -0
  764. package/dist/lexical-proxy/@lexical-react/LexicalExtensionComposer.js.map +1 -0
  765. package/dist/lexical-proxy/@lexical-react/LexicalExtensionEditorComposer.d.ts +2 -0
  766. package/dist/lexical-proxy/@lexical-react/LexicalExtensionEditorComposer.d.ts.map +1 -0
  767. package/dist/lexical-proxy/@lexical-react/LexicalExtensionEditorComposer.js +2 -0
  768. package/dist/lexical-proxy/@lexical-react/LexicalExtensionEditorComposer.js.map +1 -0
  769. package/dist/lexical-proxy/@lexical-react/LexicalSelectionAlwaysOnDisplay.d.ts +2 -0
  770. package/dist/lexical-proxy/@lexical-react/LexicalSelectionAlwaysOnDisplay.d.ts.map +1 -0
  771. package/dist/lexical-proxy/@lexical-react/LexicalSelectionAlwaysOnDisplay.js +2 -0
  772. package/dist/lexical-proxy/@lexical-react/LexicalSelectionAlwaysOnDisplay.js.map +1 -0
  773. package/dist/lexical-proxy/@lexical-react/ReactExtension.d.ts +2 -0
  774. package/dist/lexical-proxy/@lexical-react/ReactExtension.d.ts.map +1 -0
  775. package/dist/lexical-proxy/@lexical-react/ReactExtension.js +2 -0
  776. package/dist/lexical-proxy/@lexical-react/ReactExtension.js.map +1 -0
  777. package/dist/lexical-proxy/@lexical-react/ReactPluginHostExtension.d.ts +2 -0
  778. package/dist/lexical-proxy/@lexical-react/ReactPluginHostExtension.d.ts.map +1 -0
  779. package/dist/lexical-proxy/@lexical-react/ReactPluginHostExtension.js +2 -0
  780. package/dist/lexical-proxy/@lexical-react/ReactPluginHostExtension.js.map +1 -0
  781. package/dist/lexical-proxy/@lexical-react/ReactProviderExtension.d.ts +2 -0
  782. package/dist/lexical-proxy/@lexical-react/ReactProviderExtension.d.ts.map +1 -0
  783. package/dist/lexical-proxy/@lexical-react/ReactProviderExtension.js +2 -0
  784. package/dist/lexical-proxy/@lexical-react/ReactProviderExtension.js.map +1 -0
  785. package/dist/lexical-proxy/@lexical-react/TreeViewExtension.d.ts +2 -0
  786. package/dist/lexical-proxy/@lexical-react/TreeViewExtension.d.ts.map +1 -0
  787. package/dist/lexical-proxy/@lexical-react/TreeViewExtension.js +2 -0
  788. package/dist/lexical-proxy/@lexical-react/TreeViewExtension.js.map +1 -0
  789. package/dist/lexical-proxy/@lexical-react/useExtensionComponent.d.ts +2 -0
  790. package/dist/lexical-proxy/@lexical-react/useExtensionComponent.d.ts.map +1 -0
  791. package/dist/lexical-proxy/@lexical-react/useExtensionComponent.js +2 -0
  792. package/dist/lexical-proxy/@lexical-react/useExtensionComponent.js.map +1 -0
  793. package/dist/lexical-proxy/@lexical-react/useExtensionSignalValue.d.ts +2 -0
  794. package/dist/lexical-proxy/@lexical-react/useExtensionSignalValue.d.ts.map +1 -0
  795. package/dist/lexical-proxy/@lexical-react/useExtensionSignalValue.js +2 -0
  796. package/dist/lexical-proxy/@lexical-react/useExtensionSignalValue.js.map +1 -0
  797. package/dist/lexical-proxy/@lexical-react/useLexicalAriaLiveRegion.d.ts +2 -0
  798. package/dist/lexical-proxy/@lexical-react/useLexicalAriaLiveRegion.d.ts.map +1 -0
  799. package/dist/lexical-proxy/@lexical-react/useLexicalAriaLiveRegion.js +2 -0
  800. package/dist/lexical-proxy/@lexical-react/useLexicalAriaLiveRegion.js.map +1 -0
  801. package/dist/lexical-proxy/@lexical-react/useLexicalFocusManagerRef.d.ts +2 -0
  802. package/dist/lexical-proxy/@lexical-react/useLexicalFocusManagerRef.d.ts.map +1 -0
  803. package/dist/lexical-proxy/@lexical-react/useLexicalFocusManagerRef.js +2 -0
  804. package/dist/lexical-proxy/@lexical-react/useLexicalFocusManagerRef.js.map +1 -0
  805. package/dist/lexical-proxy/@lexical-react/useLexicalFocusTrapRef.d.ts +2 -0
  806. package/dist/lexical-proxy/@lexical-react/useLexicalFocusTrapRef.d.ts.map +1 -0
  807. package/dist/lexical-proxy/@lexical-react/useLexicalFocusTrapRef.js +2 -0
  808. package/dist/lexical-proxy/@lexical-react/useLexicalFocusTrapRef.js.map +1 -0
  809. package/dist/lexical-proxy/@lexical-react/useLexicalRovingTabIndexRef.d.ts +2 -0
  810. package/dist/lexical-proxy/@lexical-react/useLexicalRovingTabIndexRef.d.ts.map +1 -0
  811. package/dist/lexical-proxy/@lexical-react/useLexicalRovingTabIndexRef.js +2 -0
  812. package/dist/lexical-proxy/@lexical-react/useLexicalRovingTabIndexRef.js.map +1 -0
  813. package/dist/lexical-proxy/@lexical-react/useLexicalSlotRef.d.ts +2 -0
  814. package/dist/lexical-proxy/@lexical-react/useLexicalSlotRef.d.ts.map +1 -0
  815. package/dist/lexical-proxy/@lexical-react/useLexicalSlotRef.js +2 -0
  816. package/dist/lexical-proxy/@lexical-react/useLexicalSlotRef.js.map +1 -0
  817. package/dist/populateGraphQL/populateLexicalPopulationPromises.d.ts +1 -1
  818. package/dist/populateGraphQL/populateLexicalPopulationPromises.d.ts.map +1 -1
  819. package/dist/populateGraphQL/populateLexicalPopulationPromises.js.map +1 -1
  820. package/dist/populateGraphQL/recursivelyPopulateFieldsForGraphQL.d.ts.map +1 -1
  821. package/dist/presets/llmInstructions.d.ts +2 -0
  822. package/dist/presets/llmInstructions.d.ts.map +1 -0
  823. package/dist/presets/llmInstructions.js +13 -0
  824. package/dist/presets/llmInstructions.js.map +1 -0
  825. package/dist/types/builtInNodes.d.ts +14 -0
  826. package/dist/types/builtInNodes.d.ts.map +1 -0
  827. package/dist/types/builtInNodes.js +208 -0
  828. package/dist/types/builtInNodes.js.map +1 -0
  829. package/dist/{types.d.ts → types/index.d.ts} +29 -33
  830. package/dist/types/index.d.ts.map +1 -0
  831. package/dist/types/index.js +2 -0
  832. package/dist/types/index.js.map +1 -0
  833. package/dist/types/jsonSchemaHelpers.d.ts +34 -0
  834. package/dist/types/jsonSchemaHelpers.d.ts.map +1 -0
  835. package/dist/types/jsonSchemaHelpers.js +63 -0
  836. package/dist/types/jsonSchemaHelpers.js.map +1 -0
  837. package/dist/types/nodeTypes.d.ts +133 -0
  838. package/dist/types/nodeTypes.d.ts.map +1 -0
  839. package/dist/types/nodeTypes.js +6 -0
  840. package/dist/types/nodeTypes.js.map +1 -0
  841. package/dist/types/schema.d.ts +6 -0
  842. package/dist/types/schema.d.ts.map +1 -0
  843. package/dist/types/schema.js +90 -0
  844. package/dist/types/schema.js.map +1 -0
  845. package/dist/utilities/applyBaseFilterToFields.d.ts.map +1 -1
  846. package/dist/utilities/applyBaseFilterToFields.js +1 -2
  847. package/dist/utilities/applyBaseFilterToFields.js.map +1 -1
  848. package/dist/utilities/buildEditorState.d.ts +18 -4
  849. package/dist/utilities/buildEditorState.d.ts.map +1 -1
  850. package/dist/utilities/buildEditorState.js +8 -0
  851. package/dist/utilities/buildEditorState.js.map +1 -1
  852. package/dist/utilities/buildInitialState.d.ts +4 -2
  853. package/dist/utilities/buildInitialState.d.ts.map +1 -1
  854. package/dist/utilities/buildInitialState.js +1 -0
  855. package/dist/utilities/buildInitialState.js.map +1 -1
  856. package/dist/utilities/createClientFeature.d.ts +1 -1
  857. package/dist/utilities/createClientFeature.d.ts.map +1 -1
  858. package/dist/utilities/createClientFeature.js.map +1 -1
  859. package/dist/utilities/createServerFeature.d.ts +1 -1
  860. package/dist/utilities/createServerFeature.d.ts.map +1 -1
  861. package/dist/utilities/createServerFeature.js +2 -2
  862. package/dist/utilities/createServerFeature.js.map +1 -1
  863. package/dist/utilities/editorConfigFactory.d.ts +7 -7
  864. package/dist/utilities/editorConfigFactory.d.ts.map +1 -1
  865. package/dist/utilities/editorConfigFactory.js +9 -9
  866. package/dist/utilities/editorConfigFactory.js.map +1 -1
  867. package/dist/utilities/fieldsDrawer/Drawer.d.ts.map +1 -1
  868. package/dist/utilities/fieldsDrawer/Drawer.js +19 -10
  869. package/dist/utilities/fieldsDrawer/Drawer.js.map +1 -1
  870. package/dist/utilities/fieldsDrawer/DrawerContent.d.ts +4 -1
  871. package/dist/utilities/fieldsDrawer/DrawerContent.d.ts.map +1 -1
  872. package/dist/utilities/fieldsDrawer/DrawerContent.js +8 -7
  873. package/dist/utilities/fieldsDrawer/DrawerContent.js.map +1 -1
  874. package/dist/utilities/fieldsDrawer/index.css +12 -0
  875. package/dist/utilities/fieldsDrawer/useDrawerSubmit.d.ts +29 -0
  876. package/dist/utilities/fieldsDrawer/useDrawerSubmit.d.ts.map +1 -0
  877. package/dist/utilities/fieldsDrawer/useDrawerSubmit.js +97 -0
  878. package/dist/utilities/fieldsDrawer/useDrawerSubmit.js.map +1 -0
  879. package/dist/utilities/fieldsDrawer/useLexicalDocumentDrawer.d.ts.map +1 -1
  880. package/dist/utilities/fieldsDrawer/useLexicalDrawer.d.ts.map +1 -1
  881. package/dist/utilities/fieldsDrawer/useLexicalListDrawer.d.ts.map +1 -1
  882. package/dist/utilities/generateImportMap.d.ts +3 -3
  883. package/dist/utilities/generateImportMap.d.ts.map +1 -1
  884. package/dist/utilities/generateImportMap.js.map +1 -1
  885. package/dist/utilities/generateSchemaMap.d.ts +1 -1
  886. package/dist/utilities/generateSchemaMap.d.ts.map +1 -1
  887. package/dist/utilities/getDefaultSanitizedEditorConfig.d.ts +2 -2
  888. package/dist/utilities/getDefaultSanitizedEditorConfig.d.ts.map +1 -1
  889. package/dist/utilities/getDefaultSanitizedEditorConfig.js +6 -17
  890. package/dist/utilities/getDefaultSanitizedEditorConfig.js.map +1 -1
  891. package/dist/utilities/initLexicalFeatures.d.ts +1 -1
  892. package/dist/utilities/initLexicalFeatures.d.ts.map +1 -1
  893. package/dist/utilities/initLexicalFeatures.js.map +1 -1
  894. package/dist/utilities/recurseNodeTree.d.ts.map +1 -1
  895. package/dist/utilities/upgradeLexicalData/index.js +6 -3
  896. package/dist/utilities/upgradeLexicalData/index.js.map +1 -1
  897. package/dist/utilities/upgradeLexicalData/upgradeDocumentFieldsRecursively.d.ts.map +1 -1
  898. package/dist/utilities/upgradeLexicalData/upgradeDocumentFieldsRecursively.js +1 -1
  899. package/dist/utilities/upgradeLexicalData/upgradeDocumentFieldsRecursively.js.map +1 -1
  900. package/dist/utilities/useLexicalFeature.d.ts.map +1 -1
  901. package/dist/validate/hasText.d.ts +2 -2
  902. package/dist/validate/hasText.d.ts.map +1 -1
  903. package/dist/validate/hasText.js.map +1 -1
  904. package/dist/validate/index.d.ts +1 -1
  905. package/dist/validate/index.d.ts.map +1 -1
  906. package/package.json +99 -30
  907. package/dist/dependencyChecker.spec.js +0 -16
  908. package/dist/dependencyChecker.spec.js.map +0 -1
  909. package/dist/exports/client/Field-VMNLDBRS.js +0 -2
  910. package/dist/exports/client/Field-VMNLDBRS.js.map +0 -7
  911. package/dist/exports/client/RelationshipComponent-RZL743CS.js.map +0 -7
  912. package/dist/exports/client/bundled.css +0 -1
  913. package/dist/exports/client/chunk-74RUDY7K.js +0 -2
  914. package/dist/exports/client/chunk-74RUDY7K.js.map +0 -7
  915. package/dist/exports/client/chunk-BZZVLW4U.js.map +0 -7
  916. package/dist/exports/client/chunk-FTT5KJ6W.js +0 -12
  917. package/dist/exports/client/chunk-FTT5KJ6W.js.map +0 -7
  918. package/dist/exports/client/chunk-INBEEENE.js +0 -2
  919. package/dist/exports/client/chunk-INBEEENE.js.map +0 -7
  920. package/dist/exports/client/chunk-QJ5EETIB.js +0 -2
  921. package/dist/exports/client/chunk-QJ5EETIB.js.map +0 -7
  922. package/dist/exports/client/component-2ZTDKRVK.js +0 -2
  923. package/dist/exports/client/component-2ZTDKRVK.js.map +0 -7
  924. package/dist/exports/client/componentInline-JYKBUUPZ.js +0 -2
  925. package/dist/features/blockquote/markdownTransformer.d.ts +0 -3
  926. package/dist/features/blockquote/markdownTransformer.d.ts.map +0 -1
  927. package/dist/features/blockquote/markdownTransformer.js +0 -33
  928. package/dist/features/blockquote/markdownTransformer.js.map +0 -1
  929. package/dist/features/blocks/client/component/removeEmptyArrayValues.d.ts +0 -11
  930. package/dist/features/blocks/client/component/removeEmptyArrayValues.d.ts.map +0 -1
  931. package/dist/features/blocks/client/component/removeEmptyArrayValues.js +0 -20
  932. package/dist/features/blocks/client/component/removeEmptyArrayValues.js.map +0 -1
  933. package/dist/features/converters/lexicalToPlaintext/convertLexicalToPlaintext.spec.js +0 -180
  934. package/dist/features/converters/lexicalToPlaintext/convertLexicalToPlaintext.spec.js.map +0 -1
  935. package/dist/features/experimental_table/client/index.d.ts.map +0 -1
  936. package/dist/features/experimental_table/client/index.js.map +0 -1
  937. package/dist/features/experimental_table/client/plugins/TableActionMenuPlugin/index.d.ts.map +0 -1
  938. package/dist/features/experimental_table/client/plugins/TableActionMenuPlugin/index.js.map +0 -1
  939. package/dist/features/experimental_table/client/plugins/TableCellResizerPlugin/index.d.ts.map +0 -1
  940. package/dist/features/experimental_table/client/plugins/TableCellResizerPlugin/index.js.map +0 -1
  941. package/dist/features/experimental_table/client/plugins/TableHoverActionsPlugin/index.d.ts.map +0 -1
  942. package/dist/features/experimental_table/client/plugins/TableHoverActionsPlugin/index.js.map +0 -1
  943. package/dist/features/experimental_table/client/plugins/TablePlugin/TableGridPopup/index.d.ts.map +0 -1
  944. package/dist/features/experimental_table/client/plugins/TablePlugin/TableGridPopup/index.js.map +0 -1
  945. package/dist/features/experimental_table/client/plugins/TablePlugin/index.d.ts.map +0 -1
  946. package/dist/features/experimental_table/client/plugins/TablePlugin/index.js.map +0 -1
  947. package/dist/features/experimental_table/client/utils/debounce.d.ts.map +0 -1
  948. package/dist/features/experimental_table/client/utils/debounce.js.map +0 -1
  949. package/dist/features/experimental_table/client/utils/useDebounce.d.ts.map +0 -1
  950. package/dist/features/experimental_table/client/utils/useDebounce.js.map +0 -1
  951. package/dist/features/experimental_table/markdownTransformer.d.ts +0 -5
  952. package/dist/features/experimental_table/markdownTransformer.d.ts.map +0 -1
  953. package/dist/features/experimental_table/markdownTransformer.js.map +0 -1
  954. package/dist/features/experimental_table/server/index.d.ts +0 -8
  955. package/dist/features/experimental_table/server/index.d.ts.map +0 -1
  956. package/dist/features/experimental_table/server/index.js.map +0 -1
  957. package/dist/features/format/bold/markdownTransformers.d.ts +0 -6
  958. package/dist/features/format/bold/markdownTransformers.d.ts.map +0 -1
  959. package/dist/features/format/bold/markdownTransformers.js +0 -23
  960. package/dist/features/format/bold/markdownTransformers.js.map +0 -1
  961. package/dist/features/format/inlineCode/markdownTransformers.d.ts +0 -3
  962. package/dist/features/format/inlineCode/markdownTransformers.d.ts.map +0 -1
  963. package/dist/features/format/inlineCode/markdownTransformers.js +0 -6
  964. package/dist/features/format/inlineCode/markdownTransformers.js.map +0 -1
  965. package/dist/features/format/italic/markdownTransformers.d.ts +0 -4
  966. package/dist/features/format/italic/markdownTransformers.d.ts.map +0 -1
  967. package/dist/features/format/italic/markdownTransformers.js +0 -12
  968. package/dist/features/format/italic/markdownTransformers.js.map +0 -1
  969. package/dist/features/format/strikethrough/markdownTransformers.d.ts +0 -3
  970. package/dist/features/format/strikethrough/markdownTransformers.d.ts.map +0 -1
  971. package/dist/features/format/strikethrough/markdownTransformers.js +0 -6
  972. package/dist/features/format/strikethrough/markdownTransformers.js.map +0 -1
  973. package/dist/features/link/markdownTransformer.spec.js +0 -195
  974. package/dist/features/link/markdownTransformer.spec.js.map +0 -1
  975. package/dist/features/link/nodes/types.d.ts +0 -27
  976. package/dist/features/link/nodes/types.d.ts.map +0 -1
  977. package/dist/features/link/nodes/types.js +0 -2
  978. package/dist/features/link/nodes/types.js.map +0 -1
  979. package/dist/features/lists/checklist/markdownTransformers.d.ts +0 -3
  980. package/dist/features/lists/checklist/markdownTransformers.d.ts.map +0 -1
  981. package/dist/features/lists/checklist/markdownTransformers.js +0 -12
  982. package/dist/features/lists/checklist/markdownTransformers.js.map +0 -1
  983. package/dist/features/lists/orderedList/markdownTransformer.d.ts +0 -3
  984. package/dist/features/lists/orderedList/markdownTransformer.d.ts.map +0 -1
  985. package/dist/features/lists/orderedList/markdownTransformer.js +0 -12
  986. package/dist/features/lists/orderedList/markdownTransformer.js.map +0 -1
  987. package/dist/features/lists/shared/markdown.d.ts +0 -6
  988. package/dist/features/lists/shared/markdown.d.ts.map +0 -1
  989. package/dist/features/lists/shared/markdown.js +0 -57
  990. package/dist/features/lists/shared/markdown.js.map +0 -1
  991. package/dist/features/lists/unorderedList/markdownTransformer.d.ts +0 -3
  992. package/dist/features/lists/unorderedList/markdownTransformer.d.ts.map +0 -1
  993. package/dist/features/lists/unorderedList/markdownTransformer.js +0 -12
  994. package/dist/features/lists/unorderedList/markdownTransformer.js.map +0 -1
  995. package/dist/lexical/utils/guard.d.ts +0 -5
  996. package/dist/lexical/utils/guard.d.ts.map +0 -1
  997. package/dist/lexical/utils/guard.js +0 -9
  998. package/dist/lexical/utils/guard.js.map +0 -1
  999. package/dist/lexical/utils/url.spec.js +0 -114
  1000. package/dist/lexical/utils/url.spec.js.map +0 -1
  1001. package/dist/lexical-proxy/@lexical-react/LexicalContextMenuPlugin.d.ts +0 -2
  1002. package/dist/lexical-proxy/@lexical-react/LexicalContextMenuPlugin.d.ts.map +0 -1
  1003. package/dist/lexical-proxy/@lexical-react/LexicalContextMenuPlugin.js +0 -2
  1004. package/dist/lexical-proxy/@lexical-react/LexicalContextMenuPlugin.js.map +0 -1
  1005. package/dist/nodeTypes.d.ts +0 -74
  1006. package/dist/nodeTypes.d.ts.map +0 -1
  1007. package/dist/nodeTypes.js +0 -5
  1008. package/dist/nodeTypes.js.map +0 -1
  1009. package/dist/packages/@lexical/markdown/MarkdownExport.d.ts +0 -14
  1010. package/dist/packages/@lexical/markdown/MarkdownExport.d.ts.map +0 -1
  1011. package/dist/packages/@lexical/markdown/MarkdownExport.js +0 -213
  1012. package/dist/packages/@lexical/markdown/MarkdownExport.js.map +0 -1
  1013. package/dist/packages/@lexical/markdown/MarkdownImport.d.ts +0 -19
  1014. package/dist/packages/@lexical/markdown/MarkdownImport.d.ts.map +0 -1
  1015. package/dist/packages/@lexical/markdown/MarkdownImport.js +0 -198
  1016. package/dist/packages/@lexical/markdown/MarkdownImport.js.map +0 -1
  1017. package/dist/packages/@lexical/markdown/MarkdownShortcuts.d.ts +0 -11
  1018. package/dist/packages/@lexical/markdown/MarkdownShortcuts.d.ts.map +0 -1
  1019. package/dist/packages/@lexical/markdown/MarkdownShortcuts.js +0 -304
  1020. package/dist/packages/@lexical/markdown/MarkdownShortcuts.js.map +0 -1
  1021. package/dist/packages/@lexical/markdown/MarkdownTransformers.d.ts +0 -147
  1022. package/dist/packages/@lexical/markdown/MarkdownTransformers.d.ts.map +0 -1
  1023. package/dist/packages/@lexical/markdown/MarkdownTransformers.js +0 -268
  1024. package/dist/packages/@lexical/markdown/MarkdownTransformers.js.map +0 -1
  1025. package/dist/packages/@lexical/markdown/importTextFormatTransformer.d.ts +0 -22
  1026. package/dist/packages/@lexical/markdown/importTextFormatTransformer.d.ts.map +0 -1
  1027. package/dist/packages/@lexical/markdown/importTextFormatTransformer.js +0 -91
  1028. package/dist/packages/@lexical/markdown/importTextFormatTransformer.js.map +0 -1
  1029. package/dist/packages/@lexical/markdown/importTextMatchTransformer.d.ts +0 -21
  1030. package/dist/packages/@lexical/markdown/importTextMatchTransformer.d.ts.map +0 -1
  1031. package/dist/packages/@lexical/markdown/importTextMatchTransformer.js +0 -54
  1032. package/dist/packages/@lexical/markdown/importTextMatchTransformer.js.map +0 -1
  1033. package/dist/packages/@lexical/markdown/importTextTransformers.d.ts +0 -18
  1034. package/dist/packages/@lexical/markdown/importTextTransformers.d.ts.map +0 -1
  1035. package/dist/packages/@lexical/markdown/importTextTransformers.js +0 -54
  1036. package/dist/packages/@lexical/markdown/importTextTransformers.js.map +0 -1
  1037. package/dist/packages/@lexical/markdown/index.d.ts +0 -29
  1038. package/dist/packages/@lexical/markdown/index.d.ts.map +0 -1
  1039. package/dist/packages/@lexical/markdown/index.js +0 -39
  1040. package/dist/packages/@lexical/markdown/index.js.map +0 -1
  1041. package/dist/packages/@lexical/markdown/utils.d.ts +0 -34
  1042. package/dist/packages/@lexical/markdown/utils.d.ts.map +0 -1
  1043. package/dist/packages/@lexical/markdown/utils.js +0 -267
  1044. package/dist/packages/@lexical/markdown/utils.js.map +0 -1
  1045. package/dist/types.d.ts.map +0 -1
  1046. package/dist/types.js +0 -2
  1047. package/dist/types.js.map +0 -1
  1048. package/dist/utilities/jsx/jsx.spec.js +0 -178
  1049. package/dist/utilities/jsx/jsx.spec.js.map +0 -1
  1050. /package/dist/exports/client/{componentInline-JYKBUUPZ.js.map → componentInline-HNE5G4TE.js.map} +0 -0
  1051. /package/dist/features/{experimental_table → table}/client/index.d.ts +0 -0
  1052. /package/dist/features/{experimental_table → table}/client/plugins/TableActionMenuPlugin/index.d.ts +0 -0
  1053. /package/dist/features/{experimental_table → table}/client/plugins/TableCellResizerPlugin/index.css +0 -0
  1054. /package/dist/features/{experimental_table → table}/client/plugins/TableCellResizerPlugin/index.d.ts +0 -0
  1055. /package/dist/features/{experimental_table → table}/client/plugins/TableHoverActionsPlugin/index.d.ts +0 -0
  1056. /package/dist/features/{experimental_table → table}/client/plugins/TableHoverActionsPlugin/index.js +0 -0
  1057. /package/dist/features/{experimental_table → table}/client/plugins/TablePlugin/TableGridPopup/index.d.ts +0 -0
  1058. /package/dist/features/{experimental_table → table}/client/plugins/TablePlugin/TableGridPopup/index.js +0 -0
  1059. /package/dist/features/{experimental_table → table}/client/plugins/TablePlugin/index.css +0 -0
  1060. /package/dist/features/{experimental_table → table}/client/plugins/TablePlugin/index.d.ts +0 -0
  1061. /package/dist/features/{experimental_table → table}/client/plugins/TablePlugin/index.js +0 -0
  1062. /package/dist/features/{experimental_table → table}/client/utils/debounce.d.ts +0 -0
  1063. /package/dist/features/{experimental_table → table}/client/utils/debounce.js +0 -0
  1064. /package/dist/features/{experimental_table → table}/client/utils/useDebounce.d.ts +0 -0
  1065. /package/dist/features/{experimental_table → table}/client/utils/useDebounce.js +0 -0
@@ -1 +1 @@
1
- {"version":3,"file":"LinkNode.js","names":["addClassNamesToElement","isHTMLAnchorElement","ObjectID","$applyNodeReplacement","$createTextNode","$getSelection","$isElementNode","$isRangeSelection","createCommand","ElementNode","SUPPORTED_URL_PROTOCOLS","Set","LinkNode","__fields","__id","constructor","id","fields","linkType","newTab","key","clone","node","__key","getType","importDOM","a","conversion","$convertAnchorElement","priority","importJSON","serializedNode","$createLinkNode","updateFromJSON","version","doc","value","default","toHexString","canBeEmpty","canInsertTextAfter","canInsertTextBefore","createDOM","config","element","document","createElement","href","sanitizeUrl","url","target","rel","manageRel","theme","link","exportJSON","getFields","returnObject","type","getID","extractWithChild","child","selection","destination","anchorNode","anchor","getNode","focusNode","focus","isParentOf","getTextContent","length","getLatest","insertNewAfter","restoreSelection","getParentOrThrow","linkNode","append","isInline","parsedUrl","URL","has","protocol","e","setFields","writable","getWritable","setID","updateDOM","prevNode","removeAttribute","domNode","content","textContent","getAttribute","$isLinkNode","TOGGLE_LINK_COMMAND","$toggleLink","payload","selectedNodes","nodes","extract","forEach","parent","getParent","children","getChildren","insertBefore","remove","firstNode","$getLinkAncestor","text","getLastChild","prevParent","is","getPreviousSibling","insertAfter","$getAncestor","ancestor","predicate","input","action","result","mutableInput","includes","re","RegExp","replace","trim"],"sources":["../../../../src/features/link/nodes/LinkNode.ts"],"sourcesContent":["import type {\n BaseSelection,\n DOMConversionMap,\n DOMConversionOutput,\n EditorConfig,\n ElementNode as ElementNodeType,\n LexicalCommand,\n LexicalNode,\n LexicalUpdateJSON,\n NodeKey,\n RangeSelection,\n} from 'lexical'\n\nimport { addClassNamesToElement, isHTMLAnchorElement } from '@lexical/utils'\nimport ObjectID from 'bson-objectid'\nimport {\n $applyNodeReplacement,\n $createTextNode,\n $getSelection,\n $isElementNode,\n $isRangeSelection,\n createCommand,\n ElementNode,\n} from 'lexical'\n\nimport type { LinkPayload } from '../client/plugins/floatingLinkEditor/types.js'\nimport type { LinkFields, SerializedLinkNode } from './types.js'\n\nconst SUPPORTED_URL_PROTOCOLS = new Set(['http:', 'https:', 'mailto:', 'sms:', 'tel:'])\n\n/** @noInheritDoc */\nexport class LinkNode extends ElementNode {\n __fields: LinkFields\n __id: string\n\n constructor({\n id,\n fields = {\n linkType: 'custom',\n newTab: false,\n },\n key,\n }: {\n fields?: LinkFields\n id: string\n key?: NodeKey\n }) {\n super(key)\n this.__fields = fields\n this.__id = id\n }\n\n static override clone(node: LinkNode): LinkNode {\n return new this({\n id: node.__id,\n fields: node.__fields,\n key: node.__key,\n })\n }\n\n static override getType(): string {\n return 'link'\n }\n\n static override importDOM(): DOMConversionMap | null {\n return {\n a: (node: Node) => ({\n conversion: $convertAnchorElement,\n priority: 1,\n }),\n }\n }\n\n static override importJSON(serializedNode: SerializedLinkNode): LinkNode {\n const node = $createLinkNode({}).updateFromJSON(serializedNode)\n\n /**\n * @todo remove this in 4.0\n */\n if (\n serializedNode.version === 1 &&\n typeof serializedNode.fields?.doc?.value === 'object' &&\n serializedNode.fields?.doc?.value?.id\n ) {\n serializedNode.fields.doc.value = serializedNode.fields.doc.value.id\n serializedNode.version = 2\n }\n\n if (serializedNode.version === 2 && !serializedNode.id) {\n serializedNode.id = new ObjectID.default().toHexString()\n serializedNode.version = 3\n }\n return node\n }\n\n override canBeEmpty(): false {\n return false\n }\n\n override canInsertTextAfter(): false {\n return false\n }\n\n override canInsertTextBefore(): false {\n return false\n }\n\n override createDOM(config: EditorConfig): HTMLAnchorElement {\n const element = document.createElement('a')\n if (this.__fields?.linkType === 'custom') {\n element.href = this.sanitizeUrl(this.__fields.url ?? '')\n }\n if (this.__fields?.newTab ?? false) {\n element.target = '_blank'\n }\n\n if (this.__fields?.newTab === true && this.__fields?.linkType === 'custom') {\n element.rel = manageRel(element.rel, 'add', 'noopener')\n }\n\n addClassNamesToElement(element, config.theme.link)\n return element\n }\n\n override exportJSON(): SerializedLinkNode {\n const fields = this.getFields()\n\n if (fields?.linkType === 'internal') {\n delete fields.url\n } else if (fields?.linkType === 'custom') {\n delete fields.doc\n }\n\n const returnObject: SerializedLinkNode = {\n ...super.exportJSON(),\n type: 'link',\n fields,\n version: 3,\n }\n const id = this.getID()\n if (id) {\n returnObject.id = id\n }\n return returnObject\n }\n\n override extractWithChild(\n child: LexicalNode,\n selection: BaseSelection,\n destination: 'clone' | 'html',\n ): boolean {\n if (!$isRangeSelection(selection)) {\n return false\n }\n\n const anchorNode = selection.anchor.getNode()\n const focusNode = selection.focus.getNode()\n\n return (\n this.isParentOf(anchorNode) &&\n this.isParentOf(focusNode) &&\n selection.getTextContent().length > 0\n )\n }\n\n getFields(): LinkFields {\n return this.getLatest().__fields\n }\n\n getID(): string {\n return this.getLatest().__id\n }\n\n override insertNewAfter(\n selection: RangeSelection,\n restoreSelection = true,\n ): ElementNodeType | null {\n const element = this.getParentOrThrow().insertNewAfter(selection, restoreSelection)\n if ($isElementNode(element)) {\n const linkNode = $createLinkNode({ fields: this.__fields })\n element.append(linkNode)\n return linkNode\n }\n return null\n }\n\n override isInline(): true {\n return true\n }\n\n sanitizeUrl(url: string): string {\n try {\n const parsedUrl = new URL(url)\n\n if (!SUPPORTED_URL_PROTOCOLS.has(parsedUrl.protocol)) {\n return 'about:blank'\n }\n } catch (e) {\n return 'https://'\n }\n return url\n }\n\n setFields(fields: LinkFields): this {\n const writable = this.getWritable()\n writable.__fields = fields\n return writable\n }\n\n setID(id: string): this {\n const writable = this.getWritable()\n writable.__id = id\n return writable\n }\n\n override updateDOM(prevNode: this, anchor: HTMLAnchorElement, config: EditorConfig): boolean {\n const url = this.__fields?.url\n const newTab = this.__fields?.newTab\n if (url != null && url !== prevNode.__fields?.url && this.__fields?.linkType === 'custom') {\n anchor.href = url\n }\n if (this.__fields?.linkType === 'internal' && prevNode.__fields?.linkType === 'custom') {\n anchor.removeAttribute('href')\n }\n\n // TODO: not 100% sure why we're settign rel to '' - revisit\n // Start rel config here, then check newTab below\n if (anchor.rel == null) {\n anchor.rel = ''\n }\n\n if (newTab !== prevNode.__fields?.newTab) {\n if (newTab ?? false) {\n anchor.target = '_blank'\n if (this.__fields?.linkType === 'custom') {\n anchor.rel = manageRel(anchor.rel, 'add', 'noopener')\n }\n } else {\n anchor.removeAttribute('target')\n anchor.rel = manageRel(anchor.rel, 'remove', 'noopener')\n }\n }\n\n return false\n }\n\n override updateFromJSON(serializedNode: LexicalUpdateJSON<SerializedLinkNode>): this {\n return super\n .updateFromJSON(serializedNode)\n .setFields(serializedNode.fields)\n .setID(serializedNode.id as string)\n }\n}\n\nfunction $convertAnchorElement(domNode: Node): DOMConversionOutput {\n let node: LinkNode | null = null\n if (isHTMLAnchorElement(domNode)) {\n const content = domNode.textContent\n if (content !== null && content !== '') {\n node = $createLinkNode({\n id: new ObjectID.default().toHexString(),\n fields: {\n doc: null,\n linkType: 'custom',\n newTab: domNode.getAttribute('target') === '_blank',\n url: domNode.getAttribute('href') ?? '',\n },\n })\n }\n }\n return { node }\n}\n\nexport function $createLinkNode({ id, fields }: { fields?: LinkFields; id?: string }): LinkNode {\n return $applyNodeReplacement(\n new LinkNode({\n id: id ?? new ObjectID.default().toHexString(),\n fields,\n }),\n )\n}\n\nexport function $isLinkNode(node: LexicalNode | null | undefined): node is LinkNode {\n return node instanceof LinkNode\n}\n\nexport const TOGGLE_LINK_COMMAND: LexicalCommand<LinkPayload | null> =\n createCommand('TOGGLE_LINK_COMMAND')\n\nexport function $toggleLink(payload: ({ fields: LinkFields } & LinkPayload) | null): void {\n const selection = $getSelection()\n\n if (!$isRangeSelection(selection) && (payload === null || !payload.selectedNodes?.length)) {\n return\n }\n const nodes = $isRangeSelection(selection)\n ? selection.extract()\n : payload === null\n ? []\n : payload.selectedNodes\n\n if (payload === null) {\n // Remove LinkNodes\n nodes?.forEach((node) => {\n const parent = node.getParent()\n\n if ($isLinkNode(parent)) {\n const children = parent.getChildren()\n\n children.forEach((child) => {\n parent.insertBefore(child)\n })\n\n parent.remove()\n }\n })\n\n return\n }\n // Add or merge LinkNodes\n if (nodes?.length === 1) {\n const firstNode = nodes[0]!\n // if the first node is a LinkNode or if its\n // parent is a LinkNode, we update the URL, target and rel.\n const linkNode: LinkNode | null = $isLinkNode(firstNode)\n ? firstNode\n : $getLinkAncestor(firstNode)\n if (linkNode !== null) {\n linkNode.setFields(payload.fields)\n\n if (payload.text != null && payload.text !== linkNode.getTextContent()) {\n // remove all children and add child with new textcontent:\n linkNode.append($createTextNode(payload.text))\n linkNode.getChildren().forEach((child) => {\n if (child !== linkNode.getLastChild()) {\n child.remove()\n }\n })\n }\n return\n }\n }\n\n let prevParent: ElementNodeType | LinkNode | null = null\n let linkNode: LinkNode | null = null\n\n nodes?.forEach((node) => {\n const parent = node.getParent()\n\n if (parent === linkNode || parent === null || ($isElementNode(node) && !node.isInline())) {\n return\n }\n\n if ($isLinkNode(parent)) {\n linkNode = parent\n parent.setFields(payload.fields)\n if (payload.text != null && payload.text !== parent.getTextContent()) {\n // remove all children and add child with new textcontent:\n parent.append($createTextNode(payload.text))\n parent.getChildren().forEach((child) => {\n if (child !== parent.getLastChild()) {\n child.remove()\n }\n })\n }\n return\n }\n\n if (!parent.is(prevParent)) {\n prevParent = parent\n linkNode = $createLinkNode({ fields: payload.fields })\n\n if ($isLinkNode(parent)) {\n if (node.getPreviousSibling() === null) {\n parent.insertBefore(linkNode)\n } else {\n parent.insertAfter(linkNode)\n }\n } else {\n node.insertBefore(linkNode)\n }\n }\n\n if ($isLinkNode(node)) {\n if (node.is(linkNode)) {\n return\n }\n if (linkNode !== null) {\n const children = node.getChildren()\n linkNode.append(...children)\n }\n\n node.remove()\n return\n }\n\n if (linkNode !== null) {\n linkNode.append(node)\n }\n })\n}\n\nfunction $getLinkAncestor(node: LexicalNode): LinkNode | null {\n return $getAncestor(node, (ancestor) => $isLinkNode(ancestor)) as LinkNode\n}\n\nfunction $getAncestor(\n node: LexicalNode,\n predicate: (ancestor: LexicalNode) => boolean,\n): LexicalNode | null {\n let parent: LexicalNode | null = node\n while (parent !== null) {\n parent = parent.getParent()\n if (parent === null || predicate(parent)) {\n break\n }\n }\n return parent\n}\n\nfunction manageRel(input: string, action: 'add' | 'remove', value: string): string {\n let result: string\n let mutableInput = `${input}`\n if (action === 'add') {\n // if we somehow got out of sync - clean up\n if (mutableInput.includes(value)) {\n const re = new RegExp(value, 'g')\n mutableInput = mutableInput.replace(re, '').trim()\n }\n mutableInput = mutableInput.trim()\n result = mutableInput.length === 0 ? `${value}` : `${mutableInput} ${value}`\n } else {\n const re = new RegExp(value, 'g')\n result = mutableInput.replace(re, '').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A,GAASC,YAAA,CAAapD,MAAM,KAAK,IAAI,GAAGnC,KAAA,EAAO,GAAG,GAAGuF,YAAA,IAAgBvF,KAAA,EAAO;EAC9E,OAAO;IACL,MAAMyF,EAAA,GAAK,IAAIC,MAAA,CAAO1F,KAAA,EAAO;IAC7BsF,MAAA,GAASC,YAAA,CAAaI,OAAO,CAACF,EAAA,EAAI,IAAIG,IAAI;EAC5C;EACA,OAAON,MAAA;AACT","ignoreList":[]}
1
+ {"version":3,"file":"LinkNode.js","names":["addClassNamesToElement","isHTMLAnchorElement","ObjectID","$applyNodeReplacement","$createTextNode","$getSelection","$isElementNode","$isRangeSelection","createCommand","ElementNode","SUPPORTED_URL_PROTOCOLS","Set","LinkNode","__fields","__id","constructor","id","fields","linkType","newTab","key","clone","node","__key","getType","importDOM","a","conversion","$convertAnchorElement","priority","importJSON","serializedNode","$createLinkNode","updateFromJSON","canBeEmpty","canInsertTextAfter","canInsertTextBefore","createDOM","config","element","document","createElement","href","sanitizeUrl","url","target","rel","manageRel","theme","link","exportJSON","getFields","doc","returnObject","type","getID","extractWithChild","child","selection","destination","anchorNode","anchor","getNode","focusNode","focus","isParentOf","getTextContent","length","getLatest","insertNewAfter","restoreSelection","getParentOrThrow","linkNode","append","isInline","parsedUrl","URL","has","protocol","e","setFields","writable","getWritable","setID","updateDOM","prevNode","removeAttribute","_serializedNode","domNode","content","textContent","default","toHexString","getAttribute","$isLinkNode","TOGGLE_LINK_COMMAND","$toggleLink","payload","selectedNodes","nodes","extract","forEach","parent","getParent","children","getChildren","insertBefore","remove","firstNode","$getLinkAncestor","text","getLastChild","prevParent","is","getPreviousSibling","insertAfter","$getAncestor","ancestor","predicate","input","action","value","result","mutableInput","includes","re","RegExp","replace","trim"],"sources":["../../../../src/features/link/nodes/LinkNode.ts"],"sourcesContent":["import type {\n BaseSelection,\n DOMConversionMap,\n DOMConversionOutput,\n EditorConfig,\n ElementNode as ElementNodeType,\n LexicalCommand,\n LexicalNode,\n LexicalUpdateJSON,\n NodeKey,\n RangeSelection,\n SerializedElementNode,\n} from 'lexical'\n\nimport { addClassNamesToElement, isHTMLAnchorElement } from '@lexical/utils'\nimport ObjectID from 'bson-objectid'\nimport {\n $applyNodeReplacement,\n $createTextNode,\n $getSelection,\n $isElementNode,\n $isRangeSelection,\n createCommand,\n ElementNode,\n} from 'lexical'\n\nimport type { LinkPayload } from '../client/plugins/floatingLinkEditor/types.js'\nimport type { LinkFields, SerializedLinkNode } from '../server/schema.js'\n\nconst SUPPORTED_URL_PROTOCOLS = new Set(['http:', 'https:', 'mailto:', 'sms:', 'tel:'])\n\n/** @noInheritDoc */\nexport class LinkNode extends ElementNode {\n __fields: LinkFields\n __id: string\n\n constructor({\n id,\n fields = {\n linkType: 'custom',\n newTab: false,\n },\n key,\n }: {\n fields?: LinkFields\n id: string\n key?: NodeKey\n }) {\n super(key)\n this.__fields = fields\n this.__id = id\n }\n\n static override clone(node: LinkNode): LinkNode {\n return new this({\n id: node.__id,\n fields: node.__fields,\n key: node.__key,\n })\n }\n\n static override getType(): string {\n return 'link'\n }\n\n static override importDOM(): DOMConversionMap | null {\n return {\n a: (node: Node) => ({\n conversion: $convertAnchorElement,\n priority: 1,\n }),\n }\n }\n\n static override importJSON(\n serializedNode: Record<string, unknown> & SerializedLinkNode,\n ): LinkNode {\n return $createLinkNode({}).updateFromJSON(serializedNode)\n }\n\n override canBeEmpty(): false {\n return false\n }\n\n override canInsertTextAfter(): false {\n return false\n }\n\n override canInsertTextBefore(): false {\n return false\n }\n\n override createDOM(config: EditorConfig): HTMLAnchorElement {\n const element = document.createElement('a')\n if (this.__fields?.linkType === 'custom') {\n element.href = this.sanitizeUrl(this.__fields.url ?? '')\n }\n if (this.__fields?.newTab ?? false) {\n element.target = '_blank'\n }\n\n if (this.__fields?.newTab === true && this.__fields?.linkType === 'custom') {\n element.rel = manageRel(element.rel, 'add', 'noopener')\n }\n\n addClassNamesToElement(element, config.theme.link)\n return element\n }\n\n override exportJSON(): SerializedLinkNode {\n const fields = this.getFields()\n\n if (fields?.linkType === 'internal') {\n delete fields.url\n } else if (fields?.linkType === 'custom') {\n delete fields.doc\n }\n\n const returnObject: SerializedLinkNode = {\n ...super.exportJSON(),\n type: 'link',\n fields,\n }\n const id = this.getID()\n if (id) {\n returnObject.id = id\n }\n return returnObject\n }\n\n override extractWithChild(\n child: LexicalNode,\n selection: BaseSelection,\n destination: 'clone' | 'html',\n ): boolean {\n if (!$isRangeSelection(selection)) {\n return false\n }\n\n const anchorNode = selection.anchor.getNode()\n const focusNode = selection.focus.getNode()\n\n return (\n this.isParentOf(anchorNode) &&\n this.isParentOf(focusNode) &&\n selection.getTextContent().length > 0\n )\n }\n\n getFields(): LinkFields {\n return this.getLatest().__fields\n }\n\n getID(): string {\n return this.getLatest().__id\n }\n\n override insertNewAfter(\n selection: RangeSelection,\n restoreSelection = true,\n ): ElementNodeType | null {\n const element = this.getParentOrThrow().insertNewAfter(selection, restoreSelection)\n if ($isElementNode(element)) {\n const linkNode = $createLinkNode({ fields: this.__fields })\n element.append(linkNode)\n return linkNode\n }\n return null\n }\n\n override isInline(): true {\n return true\n }\n\n sanitizeUrl(url: string): string {\n try {\n const parsedUrl = new URL(url)\n\n if (!SUPPORTED_URL_PROTOCOLS.has(parsedUrl.protocol)) {\n return 'about:blank'\n }\n } catch (e) {\n return 'https://'\n }\n return url\n }\n\n setFields(fields: LinkFields): this {\n const writable = this.getWritable()\n writable.__fields = fields\n return writable\n }\n\n setID(id: string): this {\n const writable = this.getWritable()\n writable.__id = id\n return writable\n }\n\n override updateDOM(prevNode: this, anchor: HTMLAnchorElement, config: EditorConfig): boolean {\n const url = this.__fields?.url\n const newTab = this.__fields?.newTab\n if (url != null && url !== prevNode.__fields?.url && this.__fields?.linkType === 'custom') {\n anchor.href = url\n }\n if (this.__fields?.linkType === 'internal' && prevNode.__fields?.linkType === 'custom') {\n anchor.removeAttribute('href')\n }\n\n // TODO: not 100% sure why we're settign rel to '' - revisit\n // Start rel config here, then check newTab below\n if (anchor.rel == null) {\n anchor.rel = ''\n }\n\n if (newTab !== prevNode.__fields?.newTab) {\n if (newTab ?? false) {\n anchor.target = '_blank'\n if (this.__fields?.linkType === 'custom') {\n anchor.rel = manageRel(anchor.rel, 'add', 'noopener')\n }\n } else {\n anchor.removeAttribute('target')\n anchor.rel = manageRel(anchor.rel, 'remove', 'noopener')\n }\n }\n\n return false\n }\n\n override updateFromJSON(_serializedNode: LexicalUpdateJSON<SerializedElementNode>): this {\n const serializedNode = _serializedNode as unknown as SerializedLinkNode\n return super\n .updateFromJSON(serializedNode)\n .setFields(serializedNode.fields)\n .setID(serializedNode.id as string)\n }\n}\n\nfunction $convertAnchorElement(domNode: Node): DOMConversionOutput {\n let node: LinkNode | null = null\n if (isHTMLAnchorElement(domNode)) {\n const content = domNode.textContent\n if (content !== null && content !== '') {\n node = $createLinkNode({\n id: new ObjectID.default().toHexString(),\n fields: {\n doc: null,\n linkType: 'custom',\n newTab: domNode.getAttribute('target') === '_blank',\n url: domNode.getAttribute('href') ?? '',\n },\n })\n }\n }\n return { node }\n}\n\nexport function $createLinkNode({ id, fields }: { fields?: LinkFields; id?: string }): LinkNode {\n return $applyNodeReplacement(\n new LinkNode({\n id: id ?? new ObjectID.default().toHexString(),\n fields,\n }),\n )\n}\n\nexport function $isLinkNode(node: LexicalNode | null | undefined): node is LinkNode {\n return node instanceof LinkNode\n}\n\nexport const TOGGLE_LINK_COMMAND: LexicalCommand<LinkPayload | null> =\n createCommand('TOGGLE_LINK_COMMAND')\n\nexport function $toggleLink(payload: ({ fields: LinkFields } & LinkPayload) | null): void {\n const selection = $getSelection()\n\n if (!$isRangeSelection(selection) && (payload === null || !payload.selectedNodes?.length)) {\n return\n }\n const nodes = $isRangeSelection(selection)\n ? selection.extract()\n : payload === null\n ? []\n : payload.selectedNodes\n\n if (payload === null) {\n // Remove LinkNodes\n nodes?.forEach((node) => {\n const parent = node.getParent()\n\n if ($isLinkNode(parent)) {\n const children = parent.getChildren()\n\n children.forEach((child) => {\n parent.insertBefore(child)\n })\n\n parent.remove()\n }\n })\n\n return\n }\n // Add or merge LinkNodes\n if (nodes?.length === 1) {\n const firstNode = nodes[0]!\n // if the first node is a LinkNode or if its\n // parent is a LinkNode, we update the URL, target and rel.\n const linkNode: LinkNode | null = $isLinkNode(firstNode)\n ? firstNode\n : $getLinkAncestor(firstNode)\n if (linkNode !== null) {\n linkNode.setFields(payload.fields)\n\n if (payload.text != null && payload.text !== linkNode.getTextContent()) {\n // remove all children and add child with new textcontent:\n linkNode.append($createTextNode(payload.text))\n linkNode.getChildren().forEach((child) => {\n if (child !== linkNode.getLastChild()) {\n child.remove()\n }\n })\n }\n return\n }\n }\n\n let prevParent: ElementNodeType | LinkNode | null = null\n let linkNode: LinkNode | null = null\n\n nodes?.forEach((node) => {\n const parent = node.getParent()\n\n if (parent === linkNode || parent === null || ($isElementNode(node) && !node.isInline())) {\n return\n }\n\n if ($isLinkNode(parent)) {\n linkNode = parent\n parent.setFields(payload.fields)\n if (payload.text != null && payload.text !== parent.getTextContent()) {\n // remove all children and add child with new textcontent:\n parent.append($createTextNode(payload.text))\n parent.getChildren().forEach((child) => {\n if (child !== parent.getLastChild()) {\n child.remove()\n }\n })\n }\n return\n }\n\n if (!parent.is(prevParent)) {\n prevParent = parent\n linkNode = $createLinkNode({ fields: payload.fields })\n\n if ($isLinkNode(parent)) {\n if (node.getPreviousSibling() === null) {\n parent.insertBefore(linkNode)\n } else {\n parent.insertAfter(linkNode)\n }\n } else {\n node.insertBefore(linkNode)\n }\n }\n\n if ($isLinkNode(node)) {\n if (node.is(linkNode)) {\n return\n }\n if (linkNode !== null) {\n const children = node.getChildren()\n linkNode.append(...children)\n }\n\n node.remove()\n return\n }\n\n if (linkNode !== null) {\n linkNode.append(node)\n }\n })\n}\n\nfunction $getLinkAncestor(node: LexicalNode): LinkNode | null {\n return $getAncestor(node, (ancestor) => $isLinkNode(ancestor)) as LinkNode\n}\n\nfunction $getAncestor(\n node: LexicalNode,\n predicate: (ancestor: LexicalNode) => boolean,\n): LexicalNode | null {\n let parent: LexicalNode | null = node\n while (parent !== null) {\n parent = parent.getParent()\n if (parent === null || predicate(parent)) {\n break\n }\n }\n return parent\n}\n\nfunction manageRel(input: string, action: 'add' | 'remove', value: string): string {\n let result: string\n let mutableInput = `${input}`\n if (action === 'add') {\n // if we somehow got out of sync - clean up\n if (mutableInput.includes(value)) {\n const re = new RegExp(value, 'g')\n mutableInput = mutableInput.replace(re, '').trim()\n }\n mutableInput = mutableInput.trim()\n result = mutableInput.length === 0 ? `${value}` : `${mutableInput} ${value}`\n } else {\n const re = new RegExp(value, 'g')\n result = mutableInput.replace(re, '').trim()\n }\n return result\n}\n"],"mappings":"AAcA,SAASA,sBAAsB,EAAEC,mBAAmB,QAAQ;AAC5D,OAAOC,QAAA,MAAc;AACrB,SACEC,qBAAqB,EACrBC,eAAe,EACfC,aAAa,EACbC,cAAc,EACdC,iBAAiB,EACjBC,aAAa,EACbC,WAAW,QACN;AAKP,MAAMC,uBAAA,GAA0B,IAAIC,GAAA,CAAI,CAAC,SAAS,UAAU,WAAW,QAAQ,OAAO;AAEtF;AACA,OAAO,MAAMC,QAAA,SAAiBH,WAAA;EAC5BI,QAAA;EACAC,IAAA;EAEAC,YAAY;IACVC,EAAE;IACFC,MAAA,GAAS;MACPC,QAAA,EAAU;MACVC,MAAA,EAAQ;IACV,CAAC;IACDC;EAAG,CAKJ,EAAE;IACD,KAAK,CAACA,GAAA;IACN,IAAI,CAACP,QAAQ,GAAGI,MAAA;IAChB,IAAI,CAACH,IAAI,GAAGE,EAAA;EACd;EAEA,OAAgBK,MAAMC,IAAc,EAAY;IAC9C,OAAO,IAAI,IAAI,CAAC;MACdN,EAAA,EAAIM,IAAA,CAAKR,IAAI;MACbG,MAAA,EAAQK,IAAA,CAAKT,QAAQ;MACrBO,GAAA,EAAKE,IAAA,CAAKC;IACZ;EACF;EAEA,OAAgBC,QAAA,EAAkB;IAChC,OAAO;EACT;EAEA,OAAgBC,UAA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AAIC,MAAA,CAAOL,KAAA,EAAO;IAC7BC,MAAA,GAASC,YAAA,CAAaI,OAAO,CAACF,EAAA,EAAI,IAAIG,IAAI;EAC5C;EACA,OAAON,MAAA;AACT","ignoreList":[]}
@@ -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 '../nodes/types.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: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;MAAM;IAAE,CAAE;MAChD,IAAI,OAAO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,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\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AAI,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,IAAsB;UACtE,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,5 +1,5 @@
1
1
  import type { PopulationPromise } from '../../typesServer.js';
2
- import type { SerializedLinkNode } from '../nodes/types.js';
3
2
  import type { LinkFeatureServerProps } from './index.js';
3
+ import type { SerializedLinkNode } from './schema.js';
4
4
  export declare const linkPopulationPromiseHOC: (props: LinkFeatureServerProps) => PopulationPromise<SerializedLinkNode>;
5
5
  //# sourceMappingURL=graphQLPopulationPromise.d.ts.map
@@ -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,kBAAkB,EAAE,MAAM,mBAAmB,CAAA;AAC3D,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,YAAY,CAAA;AAIxD,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 +1 @@
1
- {"version":3,"file":"graphQLPopulationPromise.js","names":["recursivelyPopulateFieldsForGraphQL","linkPopulationPromiseHOC","props","context","currentDepth","depth","draft","editorPopulationPromises","field","fieldPromises","findMany","flattenLocales","node","overrideAccess","parentIsLocalized","populationPromises","req","showHiddenFields","fields","length","Array","isArray","data","localized","siblingDoc"],"sources":["../../../../src/features/link/server/graphQLPopulationPromise.ts"],"sourcesContent":["import type { PopulationPromise } from '../../typesServer.js'\nimport type { SerializedLinkNode } from '../nodes/types.js'\nimport type { LinkFeatureServerProps } from './index.js'\n\nimport { recursivelyPopulateFieldsForGraphQL } from '../../../populateGraphQL/recursivelyPopulateFieldsForGraphQL.js'\n\nexport const linkPopulationPromiseHOC = (\n props: LinkFeatureServerProps,\n): PopulationPromise<SerializedLinkNode> => {\n return ({\n context,\n currentDepth,\n depth,\n draft,\n editorPopulationPromises,\n field,\n fieldPromises,\n findMany,\n flattenLocales,\n node,\n overrideAccess,\n parentIsLocalized,\n populationPromises,\n req,\n showHiddenFields,\n }) => {\n if (!props.fields?.length) {\n return\n }\n\n /**\n * Should populate all fields, including the doc field (for internal links), as it's treated like a normal field\n */\n if (Array.isArray(props.fields)) {\n recursivelyPopulateFieldsForGraphQL({\n context,\n currentDepth,\n data: node.fields,\n depth,\n draft,\n editorPopulationPromises,\n fieldPromises,\n fields: props.fields,\n findMany,\n flattenLocales,\n overrideAccess,\n parentIsLocalized: parentIsLocalized || field.localized || false,\n populationPromises,\n req,\n showHiddenFields,\n siblingDoc: node.fields,\n })\n }\n }\n}\n"],"mappings":"AAIA,SAASA,mCAAmC,QAAQ;AAEpD,OAAO,MAAMC,wBAAA,GACXC,KAAA;EAEA,OAAO,CAAC;IACNC,OAAO;IACPC,YAAY;IACZC,KAAK;IACLC,KAAK;IACLC,wBAAwB;IACxBC,KAAK;IACLC,aAAa;IACbC,QAAQ;IACRC,cAAc;IACdC,IAAI;IACJC,cAAc;IACdC,iBAAiB;IACjBC,kBAAkB;IAClBC,GAAG;IACHC;EAAgB,CACjB;IACC,IAAI,CAACf,KAAA,CAAMgB,MAAM,EAAEC,MAAA,EAAQ;MACzB;IACF;IAEA;;;IAGA,IAAIC,KAAA,CAAMC,OAAO,CAACnB,KAAA,CAAMgB,MAAM,GAAG;MAC/BlB,mCAAA,CAAoC;QAClCG,OAAA;QACAC,YAAA;QACAkB,IAAA,EAAMV,IAAA,CAAKM,MAAM;QACjBb,KAAA;QACAC,KAAA;QACAC,wBAAA;QACAE,aAAA;QACAS,MAAA,EAAQhB,KAAA,CAAMgB,MAAM;QACpBR,QAAA;QACAC,cAAA;QACAE,cAAA;QACAC,iBAAA,EAAmBA,iBAAA,IAAqBN,KAAA,CAAMe,SAAS,IAAI;QAC3DR,kBAAA;QACAC,GAAA;QACAC,gBAAA;QACAO,UAAA,EAAYZ,IAAA,CAAKM;MACnB;IACF;EACF;AACF","ignoreList":[]}
1
+ {"version":3,"file":"graphQLPopulationPromise.js","names":["recursivelyPopulateFieldsForGraphQL","linkPopulationPromiseHOC","props","context","currentDepth","depth","draft","editorPopulationPromises","field","fieldPromises","findMany","flattenLocales","node","overrideAccess","parentIsLocalized","populationPromises","req","showHiddenFields","fields","length","Array","isArray","data","localized","siblingDoc"],"sources":["../../../../src/features/link/server/graphQLPopulationPromise.ts"],"sourcesContent":["import type { PopulationPromise } from '../../typesServer.js'\nimport type { LinkFeatureServerProps } from './index.js'\nimport type { SerializedLinkNode } from './schema.js'\n\nimport { recursivelyPopulateFieldsForGraphQL } from '../../../populateGraphQL/recursivelyPopulateFieldsForGraphQL.js'\n\nexport const linkPopulationPromiseHOC = (\n props: LinkFeatureServerProps,\n): PopulationPromise<SerializedLinkNode> => {\n return ({\n context,\n currentDepth,\n depth,\n draft,\n editorPopulationPromises,\n field,\n fieldPromises,\n findMany,\n flattenLocales,\n node,\n overrideAccess,\n parentIsLocalized,\n populationPromises,\n req,\n showHiddenFields,\n }) => {\n if (!props.fields?.length) {\n return\n }\n\n /**\n * Should populate all fields, including the doc field (for internal links), as it's treated like a normal field\n */\n if (Array.isArray(props.fields)) {\n recursivelyPopulateFieldsForGraphQL({\n context,\n currentDepth,\n data: node.fields,\n depth,\n draft,\n editorPopulationPromises,\n fieldPromises,\n fields: props.fields,\n findMany,\n flattenLocales,\n overrideAccess,\n parentIsLocalized: parentIsLocalized || field.localized || false,\n populationPromises,\n req,\n showHiddenFields,\n siblingDoc: node.fields,\n })\n }\n }\n}\n"],"mappings":"AAIA,SAASA,mCAAmC,QAAQ;AAEpD,OAAO,MAAMC,wBAAA,GACXC,KAAA;EAEA,OAAO,CAAC;IACNC,OAAO;IACPC,YAAY;IACZC,KAAK;IACLC,KAAK;IACLC,wBAAwB;IACxBC,KAAK;IACLC,aAAa;IACbC,QAAQ;IACRC,cAAc;IACdC,IAAI;IACJC,cAAc;IACdC,iBAAiB;IACjBC,kBAAkB;IAClBC,GAAG;IACHC;EAAgB,CACjB;IACC,IAAI,CAACf,KAAA,CAAMgB,MAAM,EAAEC,MAAA,EAAQ;MACzB;IACF;IAEA;;;IAGA,IAAIC,KAAA,CAAMC,OAAO,CAACnB,KAAA,CAAMgB,MAAM,GAAG;MAC/BlB,mCAAA,CAAoC;QAClCG,OAAA;QACAC,YAAA;QACAkB,IAAA,EAAMV,IAAA,CAAKM,MAAM;QACjBb,KAAA;QACAC,KAAA;QACAC,wBAAA;QACAE,aAAA;QACAS,MAAA,EAAQhB,KAAA,CAAMgB,MAAM;QACpBR,QAAA;QACAC,cAAA;QACAE,cAAA;QACAC,iBAAA,EAAmBA,iBAAA,IAAqBN,KAAA,CAAMe,SAAS,IAAI;QAC3DR,kBAAA;QACAC,GAAA;QACAC,gBAAA;QACAO,UAAA,EAAYZ,IAAA,CAAKM;MACnB;IACF;EACF;AACF","ignoreList":[]}
@@ -1,6 +1,7 @@
1
1
  import type { CollectionSlug, Field, FieldAffectingData, SanitizedConfig } from 'payload';
2
2
  import type { ClientProps } from '../client/index.js';
3
- import type { SerializedLinkNode } from '../nodes/types.js';
3
+ import { type SerializedLinkNode } from './schema.js';
4
+ export type { LinkFields, SerializedAutoLinkNode, SerializedLinkNode } from './schema.js';
4
5
  export type ExclusiveLinkCollectionsProps = {
5
6
  /**
6
7
  * The collections that should be disabled for internal linking. Overrides the `enableRichTextLink` property in the collection config.
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/features/link/server/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,cAAc,EAEd,KAAK,EACL,kBAAkB,EAElB,eAAe,EAChB,MAAM,SAAS,CAAA;AAKhB,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAA;AACrD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAA;AAY3D,MAAM,MAAM,6BAA6B,GACrC;IACE;;;QAGI;IACJ,mBAAmB,CAAC,EAAE,cAAc,EAAE,CAAA;IAGtC,kBAAkB,CAAC,EAAE,KAAK,CAAA;CAC3B,GACD;IAEE,mBAAmB,CAAC,EAAE,KAAK,CAAA;IAE3B;;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AAM,MAAM,sBAAsB,GAAG;IACnC;;;;;;;;OAQG;IACH,gBAAgB,CAAC,EAAE,cAAc,GAAG,IAAI,CAAA;IACxC;;;OAGG;IACH,MAAM,CAAC,EACH,CAAC,CAAC,IAAI,EAAE;QACN,MAAM,EAAE,eAAe,CAAA;QACvB,aAAa,EAAE,kBAAkB,EAAE,CAAA;KACpC,KAAK,CAAC,KAAK,GAAG,kBAAkB,CAAC,EAAE,CAAC,GACrC,KAAK,EAAE,CAAA;IACX;;;;OAIG;IACH,iBAAiB,CAAC,EAAE,CAAC,IAAI,EAAE;QAAE,QAAQ,EAAE,kBAAkB,CAAA;KAAE,KAAK,MAAM,CAAA;IACtE;;;;;OAKG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAA;CAClB,GAAG,6BAA6B,CAAA;AAEjC,eAAO,MAAM,WAAW,2HA+GtB,CAAA"}
@@ -1,15 +1,16 @@
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';
8
8
  import { i18n } from './i18n.js';
9
+ import { createAutoLinkNodeJSONSchema, createLinkNodeJSONSchema } from './schema.js';
9
10
  import { transformExtraFields } from './transformExtraFields.js';
10
11
  import { linkValidation } from './validate.js';
11
12
  export const LinkFeature = createServerFeature({
12
- feature: async ({
13
+ feature: ({
13
14
  config: _config,
14
15
  isRoot,
15
16
  parentIsLocalized,
@@ -20,7 +21,7 @@ export const LinkFeature = createServerFeature({
20
21
  }
21
22
  const validRelationships = _config.collections.map(c => c.slug) || [];
22
23
  const _transformedFields = transformExtraFields(props.fields ? props.fields : null, _config, props.enabledCollections, props.disabledCollections, props.maxDepth);
23
- const sanitizedFields = await sanitizeFields({
24
+ const sanitizedFields = sanitizeFields({
24
25
  config: _config,
25
26
  fields: _transformedFields,
26
27
  parentIsLocalized,
@@ -64,10 +65,11 @@ export const LinkFeature = createServerFeature({
64
65
  return schemaMap;
65
66
  },
66
67
  i18n,
67
- markdownTransformers: [createLinkMarkdownTransformer({
68
+ markdownTransformers: [createPayloadLinkTransformer({
68
69
  internalDocToHref: props.internalDocToHref
69
70
  })],
70
71
  nodes: [props?.disableAutoLinks === true ? null : createNode({
72
+ jsonSchema: createAutoLinkNodeJSONSchema(sanitizedFieldsWithoutText),
71
73
  node: AutoLinkNode,
72
74
  // Since AutoLinkNodes are just internal links, they need no hooks or graphQL population promises
73
75
  validations: [linkValidation(props, sanitizedFieldsWithoutText)]
@@ -81,6 +83,7 @@ export const LinkFeature = createServerFeature({
81
83
  return node?.fields;
82
84
  },
83
85
  graphQLPopulationPromises: [linkPopulationPromiseHOC(props)],
86
+ jsonSchema: createLinkNodeJSONSchema(sanitizedFieldsWithoutText),
84
87
  node: LinkNode,
85
88
  validations: [linkValidation(props, sanitizedFieldsWithoutText)]
86
89
  })].filter(Boolean),
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["sanitizeFields","createServerFeature","createNode","createLinkMarkdownTransformer","AutoLinkNode","LinkNode","linkPopulationPromiseHOC","i18n","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","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'\nimport type { SerializedLinkNode } from '../nodes/types.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 { transformExtraFields } from './transformExtraFields.js'\nimport { linkValidation } from './validate.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 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 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;AAM/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,SAASC,oBAAoB,QAAQ;AACrC,SAASC,cAAc,QAAQ;AA4D/B,OAAO,MAAMC,WAAA,GAAcT,mBAAA,CAIzB;EACAU,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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AA,EAAoB;QAClBL,eAAA;QACAG,cAAA;QACAG,gBAAA,EAAkBzB,KAAA,CAAMyB,gBAAgB;QACxChB,mBAAA,EAAqBT,KAAA,CAAMS,mBAAmB;QAC9CD,kBAAA,EAAoBR,KAAA,CAAMQ;MAC5B;MACAkB,iBAAA,EAAmBA,CAAA;QACjB,IAAI,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;MACAvC,IAAA;MACA0C,oBAAA,EAAsB,CACpB9C,6BAAA,CAA8B;QAAE+C,iBAAA,EAAmBlC,KAAA,CAAMkC;MAAkB,GAC5E;MACDC,KAAA,EAAO,CACLnC,KAAA,EAAOyB,gBAAA,KAAqB,OACxB,OACAvC,UAAA,CAAW;QACTkD,IAAA,EAAMhD,YAAA;QACN;QACAiD,WAAA,EAAa,CAAC5C,cAAA,CAAeO,KAAA,EAAOa,0BAAA;MACtC,IACJ3B,UAAA,CAAW;QACToD,YAAA,EAAcA,CAAA;UACZ,OAAOzB,0BAAA;QACT;QACA0B,gBAAA,EAAkBA,CAAC;UAAEH;QAAI,CAAE;UACzB,OAAOA,IAAA,EAAM7B,MAAA;QACf;QACAiC,yBAAA,EAA2B,CAAClD,wBAAA,CAAyBU,KAAA,EAAO;QAC5DoC,IAAA,EAAM/C,QAAA;QACNgD,WAAA,EAAa,CAAC5C,cAAA,CAAeO,KAAA,EAAOa,0BAAA;MACtC,GACD,CAACC,MAAM,CAAC2B,OAAA;MACTC,2BAAA,EAA6B1C;IAC/B;EACF;EACA2C,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: ({ 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 = 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 }\n },\n key: 'link',\n})\n"],"mappings":"AASA,SAASA,cAAc,QAAQ;AAK/B,SAASC,mBAAmB,QAAQ;AACpC,SAASC,UAAU,QAAQ;AAC3B,SAASC,4BAA4B,QAAQ;AAC7C,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,EAASA,CAAC;IAAEC,MAAA,EAAQC,OAAO;IAAEC,MAAM;IAAEC,iBAAiB;IAAEC;EAAK,CAAE;IAC7D,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,CAAMQ,kBAAkB,EACxBR,KAAA,CAAMS,mBAAmB,EACzBT,KAAA,CAAMU,QAAQ;IAGhB,MAAMC,eAAA,GAAkB7B,cAAA,CAAe;MACrCc,MAAA,EAAQC,OAAA;MACRU,MAAA,EAAQD,kBAAA;MACRP,iBAAA;MACAa,+BAAA,EAAiCd,MAAA;MACjCG;IACF;IACAD,KAAA,CAAMO,MAAM,GAAGI,eAAA;IAEf;IACA;IACA;IACA,MAAME,0BAAA,GAA6BF,eAAA,CAAgBG,MAAM,CACtDC,KAAA,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AMkC;MAAkB,GAC3E;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":[]}
@@ -0,0 +1,32 @@
1
+ import type { SerializedLexicalNode } from 'lexical';
2
+ import type { DefaultDocumentIDType, Field } from 'payload';
3
+ import type { SerializedLexicalElementBase } from '../../../types/nodeTypes.js';
4
+ import type { JSONSchemaFn } from '../../typesServer.js';
5
+ export type LinkFields = {
6
+ /** Custom fields added via `LinkFeature`'s `fields` prop. */
7
+ [k: string]: unknown;
8
+ doc?: {
9
+ relationTo: string;
10
+ /** Document ID, or the full doc when populated by the afterRead hook. */
11
+ value: {
12
+ [k: string]: unknown;
13
+ id: DefaultDocumentIDType;
14
+ } | DefaultDocumentIDType;
15
+ } | null;
16
+ linkType: 'custom' | 'internal';
17
+ newTab: boolean;
18
+ url?: string;
19
+ };
20
+ export interface SerializedLinkNode<TChildren extends SerializedLexicalNode = SerializedLexicalNode, TFields = LinkFields> extends SerializedLexicalElementBase<TChildren> {
21
+ fields: TFields;
22
+ /** @todo make required in 4.0 and type AutoLinkNode differently */
23
+ id?: string;
24
+ type: 'link';
25
+ }
26
+ export interface SerializedAutoLinkNode<TChildren extends SerializedLexicalNode = SerializedLexicalNode, TFields = LinkFields> extends SerializedLexicalElementBase<TChildren> {
27
+ fields: TFields;
28
+ type: 'autolink';
29
+ }
30
+ export declare const createLinkNodeJSONSchema: (sanitizedFieldsWithoutText: Field[]) => JSONSchemaFn;
31
+ export declare const createAutoLinkNodeJSONSchema: (sanitizedFieldsWithoutText: Field[]) => JSONSchemaFn;
32
+ //# sourceMappingURL=schema.d.ts.map
@@ -0,0 +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;AAK3D,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;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"}
@@ -0,0 +1,171 @@
1
+ import { createHash } from 'crypto';
2
+ import { fieldsToJSONSchema, flattenAllFields } from 'payload';
3
+ /**
4
+ * MUST stay byte-for-byte in sync with the runtime `LinkFields`, `SerializedLinkNode`,
5
+ * and `SerializedAutoLinkNode` declared above.
6
+ */
7
+ const LINK_NODES_TS = `export interface LexicalLinkFields {
8
+ [k: string]: unknown;
9
+ doc?: {
10
+ relationTo: string;
11
+ value: Config['db']['defaultIDType'] | { [k: string]: unknown; id: Config['db']['defaultIDType'] };
12
+ } | null;
13
+ linkType: 'custom' | 'internal';
14
+ newTab: boolean;
15
+ url?: string;
16
+ }
17
+ export interface SerializedLinkNode<TChildren, TFields = LexicalLinkFields> extends SerializedLexicalElementBase<TChildren> {
18
+ type: 'link';
19
+ fields: TFields;
20
+ id?: string;
21
+ }
22
+ export interface SerializedAutoLinkNode<TChildren, TFields = LexicalLinkFields> extends SerializedLexicalElementBase<TChildren> {
23
+ type: 'autolink';
24
+ fields: TFields;
25
+ }`;
26
+ const buildLinkFieldsJSONSchema = (sanitizedFieldsWithoutText, {
27
+ collectionIDFieldTypes,
28
+ config,
29
+ i18n,
30
+ interfaceNameDefinitions,
31
+ typeStringDefinitions,
32
+ variant
33
+ }) => {
34
+ const flattenedExtraFields = flattenAllFields({
35
+ fields: sanitizedFieldsWithoutText
36
+ });
37
+ const userFieldsSchema = flattenedExtraFields.length > 0 && config ? fieldsToJSONSchema({
38
+ collectionIDFieldTypes,
39
+ config,
40
+ fields: flattenedExtraFields,
41
+ i18n,
42
+ interfaceNameDefinitions,
43
+ typeStringDefinitions,
44
+ variant
45
+ }) : {
46
+ properties: {},
47
+ required: []
48
+ };
49
+ return {
50
+ type: 'object',
51
+ additionalProperties: false,
52
+ properties: {
53
+ ...userFieldsSchema.properties,
54
+ doc: {
55
+ oneOf: [{
56
+ type: 'object',
57
+ additionalProperties: false,
58
+ properties: {
59
+ relationTo: {
60
+ type: 'string'
61
+ },
62
+ value: {
63
+ oneOf: [{
64
+ type: 'string'
65
+ }, {
66
+ type: 'number'
67
+ },
68
+ // Populated form (afterRead inflates `value` into the doc).
69
+ {
70
+ type: 'object',
71
+ additionalProperties: true,
72
+ properties: {
73
+ id: {
74
+ type: ['string', 'number']
75
+ }
76
+ },
77
+ required: ['id']
78
+ }]
79
+ }
80
+ },
81
+ required: ['relationTo', 'value']
82
+ }, {
83
+ type: 'null'
84
+ }]
85
+ },
86
+ linkType: {
87
+ type: 'string',
88
+ enum: ['custom', 'internal']
89
+ },
90
+ newTab: {
91
+ type: 'boolean'
92
+ },
93
+ url: {
94
+ type: 'string'
95
+ }
96
+ },
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])]
100
+ };
101
+ };
102
+ /** Fields auto-attached by `LinkFeature` (see `transformExtraFields`). */
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();
105
+ /**
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.
109
+ */
110
+ const resolveLinkFieldsRef = (sanitizedFieldsWithoutText, args) => {
111
+ const fieldsSchema = buildLinkFieldsJSONSchema(sanitizedFieldsWithoutText, args);
112
+ const hasUserExtras = sanitizedFieldsWithoutText.some(field => 'name' in field && !STANDARD_LINK_FIELD_NAMES.has(field.name));
113
+ if (!hasUserExtras) {
114
+ return {
115
+ fieldsRef: fieldsSchema,
116
+ fieldsTypeName: 'LexicalLinkFields'
117
+ };
118
+ }
119
+ const fieldsTypeName = `LexicalLinkFields_${hashLinkFields(fieldsSchema)}`;
120
+ args.interfaceNameDefinitions.set(fieldsTypeName, fieldsSchema);
121
+ return {
122
+ fieldsRef: {
123
+ $ref: `#/$defs/${fieldsTypeName}`
124
+ },
125
+ fieldsTypeName
126
+ };
127
+ };
128
+ export const createLinkNodeJSONSchema = sanitizedFieldsWithoutText => args => {
129
+ const {
130
+ elementNodeSchema,
131
+ nodeUnionName,
132
+ typeStringDefinitions
133
+ } = args;
134
+ typeStringDefinitions.add(LINK_NODES_TS);
135
+ const {
136
+ fieldsRef,
137
+ fieldsTypeName
138
+ } = resolveLinkFieldsRef(sanitizedFieldsWithoutText, args);
139
+ return elementNodeSchema({
140
+ nodeType: 'link',
141
+ properties: {
142
+ id: {
143
+ type: 'string'
144
+ },
145
+ fields: fieldsRef
146
+ },
147
+ required: ['fields'],
148
+ tsType: `SerializedLinkNode<${nodeUnionName}, ${fieldsTypeName}>`
149
+ });
150
+ };
151
+ export const createAutoLinkNodeJSONSchema = sanitizedFieldsWithoutText => args => {
152
+ const {
153
+ elementNodeSchema,
154
+ nodeUnionName,
155
+ typeStringDefinitions
156
+ } = args;
157
+ typeStringDefinitions.add(LINK_NODES_TS);
158
+ const {
159
+ fieldsRef,
160
+ fieldsTypeName
161
+ } = resolveLinkFieldsRef(sanitizedFieldsWithoutText, args);
162
+ return elementNodeSchema({
163
+ nodeType: 'autolink',
164
+ properties: {
165
+ fields: fieldsRef
166
+ },
167
+ required: ['fields'],
168
+ tsType: `SerializedAutoLinkNode<${nodeUnionName}, ${fieldsTypeName}>`
169
+ });
170
+ };
171
+ //# sourceMappingURL=schema.js.map
@@ -0,0 +1 @@
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: `SerializedAutoLinkNode<${nodeUnionName}, ${fieldsTypeName}>`,\n })\n }\n"],"mappings":"AAIA,SAASA,UAAU,QAAQ;AAC3B,SAASC,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,qBAAqB;EACrBC;AAAO,CACQ;EAEjB,MAAMC,oBAAA,GAAuBV,gBAAA,CAAiB;IAAEW,MAAA,EAAQR;EAA2B;EACnF,MAAMS,gBAAA,GACJF,oBAAA,CAAqBG,MAAM,GAAG,KAAKR,MAAA,GAC/BN,kBAAA,CAAmB;IACjBK,sBAAA;IACAC,MAAA;IACAM,MAAA,EAAQD,oBAAA;IACRJ,IAAA;IACAC,wBAAA;IACAC,qBAAA;IACAC;EACF,KACA;IAAEK,UAAA,EAAY,CAAC;IAAGC,QAAA,EAAU;EAAG;EAErC,OAAO;IACLC,IAAA,EAAM;IACNC,oBAAA,EAAsB;IACtBH,UAAA,EA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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,6 +1,6 @@
1
1
  import type { Field } from 'payload';
2
2
  import type { NodeValidation } from '../../typesServer.js';
3
- import type { SerializedAutoLinkNode, SerializedLinkNode } from '../nodes/types.js';
4
3
  import type { LinkFeatureServerProps } from './index.js';
4
+ import type { SerializedAutoLinkNode, SerializedLinkNode } from './schema.js';
5
5
  export declare const linkValidation: (props: LinkFeatureServerProps, sanitizedFieldsWithoutText: Field[]) => NodeValidation<SerializedAutoLinkNode | SerializedLinkNode>;
6
6
  //# sourceMappingURL=validate.d.ts.map
@@ -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,kBAAkB,EAAE,MAAM,mBAAmB,CAAA;AACnF,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,YAAY,CAAA;AAExD,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"}
@@ -24,7 +24,7 @@ export const linkValidation = (props, sanitizedFieldsWithoutText) => {
24
24
  fields: sanitizedFieldsWithoutText,
25
25
  fieldSchemaMap: undefined,
26
26
  initialBlockData: node.fields,
27
- operation: operation === 'create' || operation === 'update' ? operation : 'update',
27
+ operation,
28
28
  permissions: {},
29
29
  preferences,
30
30
  renderAllFields: false,
@@ -1 +1 @@
1
- {"version":3,"file":"validate.js","names":["fieldSchemasToFormState","linkValidation","props","sanitizedFieldsWithoutText","node","validation","options","id","collectionSlug","data","operation","preferences","req","result","fields","documentData","fieldSchemaMap","undefined","initialBlockData","permissions","renderAllFields","schemaPath","errorPathsSet","Set","fieldKey","fieldState","errorPaths","length","errorPath","add","Array","from","join"],"sources":["../../../../src/features/link/server/validate.ts"],"sourcesContent":["import type { Field } from 'payload'\n\nimport { fieldSchemasToFormState } from '@payloadcms/ui/forms/fieldSchemasToFormState'\n\nimport type { NodeValidation } from '../../typesServer.js'\nimport type { SerializedAutoLinkNode, SerializedLinkNode } from '../nodes/types.js'\nimport type { LinkFeatureServerProps } from './index.js'\n\nexport const linkValidation = (\n props: LinkFeatureServerProps,\n sanitizedFieldsWithoutText: Field[],\n): NodeValidation<SerializedAutoLinkNode | SerializedLinkNode> => {\n return async ({\n node,\n validation: {\n options: { id, collectionSlug, data, operation, preferences, req },\n },\n }) => {\n /**\n * Run fieldSchemasToFormState as that properly validates link fields and link sub-fields\n */\n\n const result = await fieldSchemasToFormState({\n id,\n collectionSlug,\n data: node.fields,\n documentData: data,\n fields: sanitizedFieldsWithoutText, // Sanitized in feature.server.ts\n fieldSchemaMap: undefined,\n initialBlockData: node.fields,\n operation: operation === 'create' || operation === 'update' ? operation : 'update',\n permissions: {},\n preferences,\n renderAllFields: false,\n req,\n schemaPath: '',\n })\n\n const errorPathsSet = new Set<string>()\n for (const fieldKey in result) {\n const fieldState = result[fieldKey]\n if (fieldState?.errorPaths?.length) {\n for (const errorPath of fieldState.errorPaths) {\n errorPathsSet.add(errorPath)\n }\n }\n }\n const errorPaths = Array.from(errorPathsSet)\n\n if (errorPaths.length) {\n return 'The following fields are invalid: ' + errorPaths.join(', ')\n }\n\n return true\n }\n}\n"],"mappings":"AAEA,SAASA,uBAAuB,QAAQ;AAMxC,OAAO,MAAMC,cAAA,GAAiBA,CAC5BC,KAAA,EACAC,0BAAA;EAEA,OAAO,OAAO;IACZC,IAAI;IACJC,UAAA,EAAY;MACVC,OAAA,EAAS;QAAEC,EAAE;QAAEC,cAAc;QAAEC,IAAI;QAAEC,SAAS;QAAEC,WAAW;QAAEC;MAAG;IAAE;EACnE,CACF;IACC;;;IAIA,MAAMC,MAAA,GAAS,MAAMb,uBAAA,CAAwB;MAC3CO,EAAA;MACAC,cAAA;MACAC,IAAA,EAAML,IAAA,CAAKU,MAAM;MACjBC,YAAA,EAAcN,IAAA;MACdK,MAAA,EAAQX,0BAAA;MACRa,cAAA,EAAgBC,SAAA;MAChBC,gBAAA,EAAkBd,IAAA,CAAKU,MAAM;MAC7BJ,SAAA,EAAWA,SAAA,KAAc,YAAYA,SAAA,KAAc,WAAWA,SAAA,GAAY;MAC1ES,WAAA,EAAa,CAAC;MACdR,WAAA;MACAS,eAAA,EAAiB;MACjBR,GAAA;MACAS,UAAA,EAAY;IACd;IAEA,MAAMC,aAAA,GAAgB,IAAIC,GAAA;IAC1B,KAAK,MAAMC,QAAA,IAAYX,MAAA,EAAQ;MAC7B,MAAMY,UAAA,GAAaZ,MAAM,CAACW,QAAA,CAAS;MACnC,IAAIC,UAAA,EAAYC,UAAA,EAAYC,MAAA,EAAQ;QAClC,KAAK,MAAMC,SAAA,IAAaH,UAAA,CAAWC,UAAU,EAAE;UAC7CJ,aAAA,CAAcO,GAAG,CAACD,SAAA;QACpB;MACF;IACF;IACA,MAAMF,UAAA,GAAaI,KAAA,CAAMC,IAAI,CAACT,aAAA;IAE9B,IAAII,UAAA,CAAWC,MAAM,EAAE;MACrB,OAAO,uCAAuCD,UAAA,CAAWM,IAAI,CAAC;IAChE;IAEA,OAAO;EACT;AACF","ignoreList":[]}
1
+ {"version":3,"file":"validate.js","names":["fieldSchemasToFormState","linkValidation","props","sanitizedFieldsWithoutText","node","validation","options","id","collectionSlug","data","operation","preferences","req","result","fields","documentData","fieldSchemaMap","undefined","initialBlockData","permissions","renderAllFields","schemaPath","errorPathsSet","Set","fieldKey","fieldState","errorPaths","length","errorPath","add","Array","from","join"],"sources":["../../../../src/features/link/server/validate.ts"],"sourcesContent":["import type { Field } from 'payload'\n\nimport { fieldSchemasToFormState } from '@payloadcms/ui/forms/fieldSchemasToFormState'\n\nimport type { NodeValidation } from '../../typesServer.js'\nimport type { LinkFeatureServerProps } from './index.js'\nimport type { SerializedAutoLinkNode, SerializedLinkNode } from './schema.js'\n\nexport const linkValidation = (\n props: LinkFeatureServerProps,\n sanitizedFieldsWithoutText: Field[],\n): NodeValidation<SerializedAutoLinkNode | SerializedLinkNode> => {\n return async ({\n node,\n validation: {\n options: { id, collectionSlug, data, operation, preferences, req },\n },\n }) => {\n /**\n * Run fieldSchemasToFormState as that properly validates link fields and link sub-fields\n */\n\n const result = await fieldSchemasToFormState({\n id,\n collectionSlug,\n data: node.fields,\n documentData: data,\n fields: sanitizedFieldsWithoutText, // Sanitized in feature.server.ts\n fieldSchemaMap: undefined,\n initialBlockData: node.fields,\n operation,\n permissions: {},\n preferences,\n renderAllFields: false,\n req,\n schemaPath: '',\n })\n\n const errorPathsSet = new Set<string>()\n for (const fieldKey in result) {\n const fieldState = result[fieldKey]\n if (fieldState?.errorPaths?.length) {\n for (const errorPath of fieldState.errorPaths) {\n errorPathsSet.add(errorPath)\n }\n }\n }\n const errorPaths = Array.from(errorPathsSet)\n\n if (errorPaths.length) {\n return 'The following fields are invalid: ' + errorPaths.join(', ')\n }\n\n return true\n }\n}\n"],"mappings":"AAEA,SAASA,uBAAuB,QAAQ;AAMxC,OAAO,MAAMC,cAAA,GAAiBA,CAC5BC,KAAA,EACAC,0BAAA;EAEA,OAAO,OAAO;IACZC,IAAI;IACJC,UAAA,EAAY;MACVC,OAAA,EAAS;QAAEC,EAAE;QAAEC,cAAc;QAAEC,IAAI;QAAEC,SAAS;QAAEC,WAAW;QAAEC;MAAG;IAAE;EACnE,CACF;IACC;;;IAIA,MAAMC,MAAA,GAAS,MAAMb,uBAAA,CAAwB;MAC3CO,EAAA;MACAC,cAAA;MACAC,IAAA,EAAML,IAAA,CAAKU,MAAM;MACjBC,YAAA,EAAcN,IAAA;MACdK,MAAA,EAAQX,0BAAA;MACRa,cAAA,EAAgBC,SAAA;MAChBC,gBAAA,EAAkBd,IAAA,CAAKU,MAAM;MAC7BJ,SAAA;MACAS,WAAA,EAAa,CAAC;MACdR,WAAA;MACAS,eAAA,EAAiB;MACjBR,GAAA;MACAS,UAAA,EAAY;IACd;IAEA,MAAMC,aAAA,GAAgB,IAAIC,GAAA;IAC1B,KAAK,MAAMC,QAAA,IAAYX,MAAA,EAAQ;MAC7B,MAAMY,UAAA,GAAaZ,MAAM,CAACW,QAAA,CAAS;MACnC,IAAIC,UAAA,EAAYC,UAAA,EAAYC,MAAA,EAAQ;QAClC,KAAK,MAAMC,SAAA,IAAaH,UAAA,CAAWC,UAAU,EAAE;UAC7CJ,aAAA,CAAcO,GAAG,CAACD,SAAA;QACpB;MACF;IACF;IACA,MAAMF,UAAA,GAAaI,KAAA,CAAMC,IAAI,CAACT,aAAA;IAE9B,IAAII,UAAA,CAAWC,MAAM,EAAE;MACrB,OAAO,uCAAuCD,UAAA,CAAWM,IAAI,CAAC;IAChE;IAEA,OAAO;EACT;AACF","ignoreList":[]}