@payloadcms/richtext-lexical 4.0.0-canary.0 → 4.0.0-canary.2

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 (276) hide show
  1. package/dist/exports/client/{RelationshipComponent-RZL743CS.js → RelationshipComponent-YCPAKOL7.js} +1 -1
  2. package/dist/exports/client/RelationshipComponent-YCPAKOL7.js.map +7 -0
  3. package/dist/exports/client/bundled.css +1 -1
  4. package/dist/exports/client/chunk-CUFJGFNW.js +2 -0
  5. package/dist/exports/client/chunk-CUFJGFNW.js.map +7 -0
  6. package/dist/exports/client/{component-KESPRYJR.js → component-PHZQBOJE.js} +1 -1
  7. package/dist/exports/client/component-PHZQBOJE.js.map +7 -0
  8. package/dist/exports/client/componentInline-DV4EGOWU.js +2 -0
  9. package/dist/exports/client/index.js +14 -14
  10. package/dist/exports/client/index.js.map +4 -4
  11. package/dist/features/blockquote/server/index.d.ts +1 -4
  12. package/dist/features/blockquote/server/index.d.ts.map +1 -1
  13. package/dist/features/blockquote/server/index.js +2 -0
  14. package/dist/features/blockquote/server/index.js.map +1 -1
  15. package/dist/features/blockquote/server/schema.d.ts +8 -0
  16. package/dist/features/blockquote/server/schema.d.ts.map +1 -0
  17. package/dist/features/blockquote/server/schema.js +15 -0
  18. package/dist/features/blockquote/server/schema.js.map +1 -0
  19. package/dist/features/blocks/client/component/index.d.ts +1 -1
  20. package/dist/features/blocks/client/component/index.d.ts.map +1 -1
  21. package/dist/features/blocks/client/component/index.js +2 -1
  22. package/dist/features/blocks/client/component/index.js.map +1 -1
  23. package/dist/features/blocks/client/componentInline/index.d.ts +1 -1
  24. package/dist/features/blocks/client/componentInline/index.d.ts.map +1 -1
  25. package/dist/features/blocks/client/componentInline/index.js +2 -1
  26. package/dist/features/blocks/client/componentInline/index.js.map +1 -1
  27. package/dist/features/blocks/client/index.d.ts.map +1 -1
  28. package/dist/features/blocks/client/index.js +4 -2
  29. package/dist/features/blocks/client/index.js.map +1 -1
  30. package/dist/features/blocks/client/markdown/markdownTransformer.js +4 -4
  31. package/dist/features/blocks/client/markdown/markdownTransformer.js.map +1 -1
  32. package/dist/features/blocks/client/nodes/BlocksNode.d.ts +1 -1
  33. package/dist/features/blocks/client/nodes/BlocksNode.d.ts.map +1 -1
  34. package/dist/features/blocks/client/nodes/BlocksNode.js.map +1 -1
  35. package/dist/features/blocks/client/nodes/InlineBlocksNode.d.ts +1 -1
  36. package/dist/features/blocks/client/nodes/InlineBlocksNode.d.ts.map +1 -1
  37. package/dist/features/blocks/client/nodes/InlineBlocksNode.js.map +1 -1
  38. package/dist/features/blocks/client/plugin/index.d.ts +1 -1
  39. package/dist/features/blocks/client/plugin/index.d.ts.map +1 -1
  40. package/dist/features/blocks/client/plugin/index.js.map +1 -1
  41. package/dist/features/blocks/premade/CodeBlock/Component/Block.d.ts.map +1 -1
  42. package/dist/features/blocks/premade/CodeBlock/Component/Block.js +1 -0
  43. package/dist/features/blocks/premade/CodeBlock/Component/Block.js.map +1 -1
  44. package/dist/features/blocks/server/graphQLPopulationPromise.d.ts +1 -2
  45. package/dist/features/blocks/server/graphQLPopulationPromise.d.ts.map +1 -1
  46. package/dist/features/blocks/server/graphQLPopulationPromise.js.map +1 -1
  47. package/dist/features/blocks/server/index.d.ts +1 -0
  48. package/dist/features/blocks/server/index.d.ts.map +1 -1
  49. package/dist/features/blocks/server/index.js +24 -72
  50. package/dist/features/blocks/server/index.js.map +1 -1
  51. package/dist/features/blocks/server/markdown/markdownTransformer.js +4 -4
  52. package/dist/features/blocks/server/markdown/markdownTransformer.js.map +1 -1
  53. package/dist/features/blocks/server/nodes/BlocksNode.d.ts +1 -18
  54. package/dist/features/blocks/server/nodes/BlocksNode.d.ts.map +1 -1
  55. package/dist/features/blocks/server/nodes/BlocksNode.js.map +1 -1
  56. package/dist/features/blocks/server/nodes/InlineBlocksNode.d.ts +2 -10
  57. package/dist/features/blocks/server/nodes/InlineBlocksNode.d.ts.map +1 -1
  58. package/dist/features/blocks/server/nodes/InlineBlocksNode.js.map +1 -1
  59. package/dist/features/blocks/server/schema.d.ts +45 -0
  60. package/dist/features/blocks/server/schema.d.ts.map +1 -0
  61. package/dist/features/blocks/server/schema.js +139 -0
  62. package/dist/features/blocks/server/schema.js.map +1 -0
  63. package/dist/features/blocks/server/validate.d.ts +1 -2
  64. package/dist/features/blocks/server/validate.d.ts.map +1 -1
  65. package/dist/features/blocks/server/validate.js.map +1 -1
  66. package/dist/features/converters/lexicalToHtml/async/converters/upload.js.map +1 -1
  67. package/dist/features/converters/lexicalToHtml/async/types.d.ts +14 -15
  68. package/dist/features/converters/lexicalToHtml/async/types.d.ts.map +1 -1
  69. package/dist/features/converters/lexicalToHtml/async/types.js.map +1 -1
  70. package/dist/features/converters/lexicalToHtml/sync/converters/upload.js.map +1 -1
  71. package/dist/features/converters/lexicalToHtml/sync/types.d.ts +14 -15
  72. package/dist/features/converters/lexicalToHtml/sync/types.d.ts.map +1 -1
  73. package/dist/features/converters/lexicalToHtml/sync/types.js.map +1 -1
  74. package/dist/features/converters/lexicalToJSX/Component/index.d.ts +4 -2
  75. package/dist/features/converters/lexicalToJSX/Component/index.d.ts.map +1 -1
  76. package/dist/features/converters/lexicalToJSX/Component/index.js +5 -4
  77. package/dist/features/converters/lexicalToJSX/Component/index.js.map +1 -1
  78. package/dist/features/converters/lexicalToJSX/converter/converters/upload.js.map +1 -1
  79. package/dist/features/converters/lexicalToJSX/converter/types.d.ts +12 -14
  80. package/dist/features/converters/lexicalToJSX/converter/types.d.ts.map +1 -1
  81. package/dist/features/converters/lexicalToJSX/converter/types.js.map +1 -1
  82. package/dist/features/converters/lexicalToPlaintext/sync/types.d.ts +12 -14
  83. package/dist/features/converters/lexicalToPlaintext/sync/types.d.ts.map +1 -1
  84. package/dist/features/converters/lexicalToPlaintext/sync/types.js.map +1 -1
  85. package/dist/features/experimental_table/server/index.d.ts +1 -6
  86. package/dist/features/experimental_table/server/index.d.ts.map +1 -1
  87. package/dist/features/experimental_table/server/index.js +4 -0
  88. package/dist/features/experimental_table/server/index.js.map +1 -1
  89. package/dist/features/experimental_table/server/schema.d.ts +27 -0
  90. package/dist/features/experimental_table/server/schema.d.ts.map +1 -0
  91. package/dist/features/experimental_table/server/schema.js +107 -0
  92. package/dist/features/experimental_table/server/schema.js.map +1 -0
  93. package/dist/features/heading/server/index.d.ts +2 -4
  94. package/dist/features/heading/server/index.d.ts.map +1 -1
  95. package/dist/features/heading/server/index.js +2 -0
  96. package/dist/features/heading/server/index.js.map +1 -1
  97. package/dist/features/heading/server/schema.d.ts +10 -0
  98. package/dist/features/heading/server/schema.d.ts.map +1 -0
  99. package/dist/features/heading/server/schema.js +37 -0
  100. package/dist/features/heading/server/schema.js.map +1 -0
  101. package/dist/features/horizontalRule/client/nodes/HorizontalRuleNode.d.ts +1 -1
  102. package/dist/features/horizontalRule/client/nodes/HorizontalRuleNode.d.ts.map +1 -1
  103. package/dist/features/horizontalRule/client/nodes/HorizontalRuleNode.js.map +1 -1
  104. package/dist/features/horizontalRule/server/index.d.ts +1 -0
  105. package/dist/features/horizontalRule/server/index.d.ts.map +1 -1
  106. package/dist/features/horizontalRule/server/index.js +2 -0
  107. package/dist/features/horizontalRule/server/index.js.map +1 -1
  108. package/dist/features/horizontalRule/server/nodes/HorizontalRuleNode.d.ts +1 -5
  109. package/dist/features/horizontalRule/server/nodes/HorizontalRuleNode.d.ts.map +1 -1
  110. package/dist/features/horizontalRule/server/nodes/HorizontalRuleNode.js.map +1 -1
  111. package/dist/features/horizontalRule/server/schema.d.ts +7 -0
  112. package/dist/features/horizontalRule/server/schema.d.ts.map +1 -0
  113. package/dist/features/horizontalRule/server/schema.js +25 -0
  114. package/dist/features/horizontalRule/server/schema.js.map +1 -0
  115. package/dist/features/link/client/index.d.ts.map +1 -1
  116. package/dist/features/link/client/index.js.map +1 -1
  117. package/dist/features/link/client/plugins/autoLink/index.d.ts +1 -1
  118. package/dist/features/link/client/plugins/autoLink/index.d.ts.map +1 -1
  119. package/dist/features/link/client/plugins/autoLink/index.js.map +1 -1
  120. package/dist/features/link/client/plugins/floatingLinkEditor/LinkEditor/index.js.map +1 -1
  121. package/dist/features/link/client/plugins/floatingLinkEditor/types.d.ts +1 -1
  122. package/dist/features/link/client/plugins/floatingLinkEditor/types.d.ts.map +1 -1
  123. package/dist/features/link/client/plugins/floatingLinkEditor/types.js.map +1 -1
  124. package/dist/features/link/client/plugins/link/index.js.map +1 -1
  125. package/dist/features/link/markdownTransformer.d.ts +1 -1
  126. package/dist/features/link/markdownTransformer.d.ts.map +1 -1
  127. package/dist/features/link/markdownTransformer.js.map +1 -1
  128. package/dist/features/link/markdownTransformer.spec.js.map +1 -1
  129. package/dist/features/link/nodes/AutoLinkNode.d.ts +3 -3
  130. package/dist/features/link/nodes/AutoLinkNode.d.ts.map +1 -1
  131. package/dist/features/link/nodes/AutoLinkNode.js +2 -1
  132. package/dist/features/link/nodes/AutoLinkNode.js.map +1 -1
  133. package/dist/features/link/nodes/LinkNode.d.ts +3 -3
  134. package/dist/features/link/nodes/LinkNode.d.ts.map +1 -1
  135. package/dist/features/link/nodes/LinkNode.js +2 -1
  136. package/dist/features/link/nodes/LinkNode.js.map +1 -1
  137. package/dist/features/link/server/baseFields.js.map +1 -1
  138. package/dist/features/link/server/graphQLPopulationPromise.d.ts +1 -1
  139. package/dist/features/link/server/graphQLPopulationPromise.d.ts.map +1 -1
  140. package/dist/features/link/server/graphQLPopulationPromise.js.map +1 -1
  141. package/dist/features/link/server/index.d.ts +2 -1
  142. package/dist/features/link/server/index.d.ts.map +1 -1
  143. package/dist/features/link/server/index.js +3 -0
  144. package/dist/features/link/server/index.js.map +1 -1
  145. package/dist/features/link/server/schema.d.ts +32 -0
  146. package/dist/features/link/server/schema.d.ts.map +1 -0
  147. package/dist/features/link/server/schema.js +169 -0
  148. package/dist/features/link/server/schema.js.map +1 -0
  149. package/dist/features/link/server/validate.d.ts +1 -1
  150. package/dist/features/link/server/validate.d.ts.map +1 -1
  151. package/dist/features/link/server/validate.js.map +1 -1
  152. package/dist/features/lists/checklist/server/index.d.ts.map +1 -1
  153. package/dist/features/lists/checklist/server/index.js +3 -0
  154. package/dist/features/lists/checklist/server/index.js.map +1 -1
  155. package/dist/features/lists/orderedList/server/index.d.ts.map +1 -1
  156. package/dist/features/lists/orderedList/server/index.js +3 -0
  157. package/dist/features/lists/orderedList/server/index.js.map +1 -1
  158. package/dist/features/lists/plugin/index.d.ts +0 -9
  159. package/dist/features/lists/plugin/index.d.ts.map +1 -1
  160. package/dist/features/lists/plugin/index.js.map +1 -1
  161. package/dist/features/lists/shared/schema.d.ts +18 -0
  162. package/dist/features/lists/shared/schema.d.ts.map +1 -0
  163. package/dist/features/lists/shared/schema.js +62 -0
  164. package/dist/features/lists/shared/schema.js.map +1 -0
  165. package/dist/features/lists/unorderedList/server/index.d.ts.map +1 -1
  166. package/dist/features/lists/unorderedList/server/index.js +3 -0
  167. package/dist/features/lists/unorderedList/server/index.js.map +1 -1
  168. package/dist/features/relationship/client/components/RelationshipComponent.d.ts +1 -1
  169. package/dist/features/relationship/client/components/RelationshipComponent.d.ts.map +1 -1
  170. package/dist/features/relationship/client/components/RelationshipComponent.js.map +1 -1
  171. package/dist/features/relationship/client/nodes/RelationshipNode.d.ts +1 -1
  172. package/dist/features/relationship/client/nodes/RelationshipNode.d.ts.map +1 -1
  173. package/dist/features/relationship/client/nodes/RelationshipNode.js.map +1 -1
  174. package/dist/features/relationship/client/plugins/index.d.ts +1 -1
  175. package/dist/features/relationship/client/plugins/index.d.ts.map +1 -1
  176. package/dist/features/relationship/client/plugins/index.js.map +1 -1
  177. package/dist/features/relationship/client/utils/useEnabledRelationships.d.ts.map +1 -1
  178. package/dist/features/relationship/client/utils/useEnabledRelationships.js +9 -40
  179. package/dist/features/relationship/client/utils/useEnabledRelationships.js.map +1 -1
  180. package/dist/features/relationship/server/graphQLPopulationPromise.d.ts +1 -1
  181. package/dist/features/relationship/server/graphQLPopulationPromise.d.ts.map +1 -1
  182. package/dist/features/relationship/server/graphQLPopulationPromise.js.map +1 -1
  183. package/dist/features/relationship/server/index.d.ts +1 -0
  184. package/dist/features/relationship/server/index.d.ts.map +1 -1
  185. package/dist/features/relationship/server/index.js +2 -0
  186. package/dist/features/relationship/server/index.js.map +1 -1
  187. package/dist/features/relationship/server/nodes/RelationshipNode.d.ts +1 -10
  188. package/dist/features/relationship/server/nodes/RelationshipNode.d.ts.map +1 -1
  189. package/dist/features/relationship/server/nodes/RelationshipNode.js.map +1 -1
  190. package/dist/features/relationship/server/schema.d.ts +28 -0
  191. package/dist/features/relationship/server/schema.d.ts.map +1 -0
  192. package/dist/features/relationship/server/schema.js +80 -0
  193. package/dist/features/relationship/server/schema.js.map +1 -0
  194. package/dist/features/relationship/shared/filterEnabledRelationshipCollections.d.ts +23 -0
  195. package/dist/features/relationship/shared/filterEnabledRelationshipCollections.d.ts.map +1 -0
  196. package/dist/features/relationship/shared/filterEnabledRelationshipCollections.js +34 -0
  197. package/dist/features/relationship/shared/filterEnabledRelationshipCollections.js.map +1 -0
  198. package/dist/features/typesServer.d.ts +17 -40
  199. package/dist/features/typesServer.d.ts.map +1 -1
  200. package/dist/features/typesServer.js.map +1 -1
  201. package/dist/features/upload/client/component/index.d.ts +1 -1
  202. package/dist/features/upload/client/component/index.d.ts.map +1 -1
  203. package/dist/features/upload/client/component/index.js.map +1 -1
  204. package/dist/features/upload/client/nodes/UploadNode.d.ts +1 -1
  205. package/dist/features/upload/client/nodes/UploadNode.d.ts.map +1 -1
  206. package/dist/features/upload/client/nodes/UploadNode.js.map +1 -1
  207. package/dist/features/upload/client/plugin/index.d.ts +1 -1
  208. package/dist/features/upload/client/plugin/index.d.ts.map +1 -1
  209. package/dist/features/upload/client/plugin/index.js.map +1 -1
  210. package/dist/features/upload/server/graphQLPopulationPromise.d.ts +1 -1
  211. package/dist/features/upload/server/graphQLPopulationPromise.d.ts.map +1 -1
  212. package/dist/features/upload/server/graphQLPopulationPromise.js.map +1 -1
  213. package/dist/features/upload/server/index.d.ts +1 -0
  214. package/dist/features/upload/server/index.d.ts.map +1 -1
  215. package/dist/features/upload/server/index.js +3 -2
  216. package/dist/features/upload/server/index.js.map +1 -1
  217. package/dist/features/upload/server/nodes/UploadNode.d.ts +1 -55
  218. package/dist/features/upload/server/nodes/UploadNode.d.ts.map +1 -1
  219. package/dist/features/upload/server/nodes/UploadNode.js.map +1 -1
  220. package/dist/features/upload/server/nodes/conversions.d.ts.map +1 -1
  221. package/dist/features/upload/server/nodes/conversions.js.map +1 -1
  222. package/dist/features/upload/server/schema.d.ts +52 -0
  223. package/dist/features/upload/server/schema.d.ts.map +1 -0
  224. package/dist/features/upload/server/schema.js +129 -0
  225. package/dist/features/upload/server/schema.js.map +1 -0
  226. package/dist/features/upload/server/validate.d.ts +1 -1
  227. package/dist/features/upload/server/validate.d.ts.map +1 -1
  228. package/dist/features/upload/server/validate.js.map +1 -1
  229. package/dist/field/Diff/converters/upload/index.js.map +1 -1
  230. package/dist/field/bundled.css +1 -1
  231. package/dist/field/index.css +4 -0
  232. package/dist/index.d.ts +8 -5
  233. package/dist/index.d.ts.map +1 -1
  234. package/dist/index.js.map +1 -1
  235. package/dist/lexical/config/server/sanitize.d.ts.map +1 -1
  236. package/dist/lexical/config/server/sanitize.js +9 -11
  237. package/dist/lexical/config/server/sanitize.js.map +1 -1
  238. package/dist/types/builtInNodes.d.ts +14 -0
  239. package/dist/types/builtInNodes.d.ts.map +1 -0
  240. package/dist/types/builtInNodes.js +203 -0
  241. package/dist/types/builtInNodes.js.map +1 -0
  242. package/dist/types/index.d.ts +14 -15
  243. package/dist/types/index.d.ts.map +1 -1
  244. package/dist/types/index.js.map +1 -1
  245. package/dist/types/jsonSchemaHelpers.d.ts +30 -0
  246. package/dist/types/jsonSchemaHelpers.d.ts.map +1 -0
  247. package/dist/types/jsonSchemaHelpers.js +58 -0
  248. package/dist/types/jsonSchemaHelpers.js.map +1 -0
  249. package/dist/types/nodeTypes.d.ts +115 -61
  250. package/dist/types/nodeTypes.d.ts.map +1 -1
  251. package/dist/types/nodeTypes.js +3 -2
  252. package/dist/types/nodeTypes.js.map +1 -1
  253. package/dist/types/schema.d.ts.map +1 -1
  254. package/dist/types/schema.js +67 -65
  255. package/dist/types/schema.js.map +1 -1
  256. package/dist/utilities/applyBaseFilterToFields.d.ts.map +1 -1
  257. package/dist/utilities/applyBaseFilterToFields.js +1 -2
  258. package/dist/utilities/applyBaseFilterToFields.js.map +1 -1
  259. package/dist/utilities/buildEditorState.d.ts +17 -3
  260. package/dist/utilities/buildEditorState.d.ts.map +1 -1
  261. package/dist/utilities/buildEditorState.js +8 -0
  262. package/dist/utilities/buildEditorState.js.map +1 -1
  263. package/dist/utilities/fieldsDrawer/index.css +5 -1
  264. package/dist/utilities/upgradeLexicalData/upgradeDocumentFieldsRecursively.js +1 -1
  265. package/dist/utilities/upgradeLexicalData/upgradeDocumentFieldsRecursively.js.map +1 -1
  266. package/package.json +6 -6
  267. package/dist/exports/client/RelationshipComponent-RZL743CS.js.map +0 -7
  268. package/dist/exports/client/chunk-XIJE2UCQ.js +0 -2
  269. package/dist/exports/client/chunk-XIJE2UCQ.js.map +0 -7
  270. package/dist/exports/client/component-KESPRYJR.js.map +0 -7
  271. package/dist/exports/client/componentInline-R2RSJX4K.js +0 -2
  272. package/dist/features/link/nodes/types.d.ts +0 -27
  273. package/dist/features/link/nodes/types.d.ts.map +0 -1
  274. package/dist/features/link/nodes/types.js +0 -2
  275. package/dist/features/link/nodes/types.js.map +0 -1
  276. /package/dist/exports/client/{componentInline-R2RSJX4K.js.map → componentInline-DV4EGOWU.js.map} +0 -0
@@ -35,6 +35,10 @@
35
35
  .rich-text-lexical__wrap {
36
36
  width: 100%;
37
37
  position: relative;
38
+
39
+ > .field-description {
40
+ margin-top: var(--spacer-2);
41
+ }
38
42
  }
39
43
 
40
44
  .rich-text-lexical--read-only {
package/dist/index.d.ts CHANGED
@@ -6,8 +6,9 @@ export { BlockquoteFeature } from './features/blockquote/server/index.js';
6
6
  export { CodeBlock } from './features/blocks/premade/CodeBlock/index.js';
7
7
  export { BlocksFeature } from './features/blocks/server/index.js';
8
8
  export type { BlocksFeatureProps, LexicalBlockClientProps, LexicalBlockLabelClientProps, LexicalBlockLabelServerProps, LexicalBlockServerProps, LexicalInlineBlockClientProps, LexicalInlineBlockLabelClientProps, LexicalInlineBlockLabelServerProps, LexicalInlineBlockServerProps, } from './features/blocks/server/index.js';
9
- export { $createServerBlockNode, $isServerBlockNode, type BlockFields, ServerBlockNode, } from './features/blocks/server/nodes/BlocksNode.js';
10
- export { $createServerInlineBlockNode, $isServerInlineBlockNode, type InlineBlockFields, ServerInlineBlockNode, } from './features/blocks/server/nodes/InlineBlocksNode.js';
9
+ export { $createServerBlockNode, $isServerBlockNode, ServerBlockNode, } from './features/blocks/server/nodes/BlocksNode.js';
10
+ export { $createServerInlineBlockNode, $isServerInlineBlockNode, ServerInlineBlockNode, } from './features/blocks/server/nodes/InlineBlocksNode.js';
11
+ export type { BlockFields, InlineBlockFields } from './features/blocks/server/schema.js';
11
12
  export { convertHTMLToLexical } from './features/converters/htmlToLexical/index.js';
12
13
  export { lexicalHTMLField } from './features/converters/lexicalToHtml/async/field/index.js';
13
14
  export { convertLexicalToMarkdown } from './features/converters/lexicalToMarkdown/index.js';
@@ -30,14 +31,15 @@ export { HorizontalRuleFeature } from './features/horizontalRule/server/index.js
30
31
  export { IndentFeature } from './features/indent/server/index.js';
31
32
  export { $createAutoLinkNode, $isAutoLinkNode, AutoLinkNode, } from './features/link/nodes/AutoLinkNode.js';
32
33
  export { $createLinkNode, $isLinkNode, LinkNode } from './features/link/nodes/LinkNode.js';
33
- export type { LinkFields } from './features/link/nodes/types.js';
34
34
  export { LinkFeature, type LinkFeatureServerProps } from './features/link/server/index.js';
35
+ export type { LinkFields } from './features/link/server/schema.js';
35
36
  export { ChecklistFeature } from './features/lists/checklist/server/index.js';
36
37
  export { OrderedListFeature } from './features/lists/orderedList/server/index.js';
37
38
  export { UnorderedListFeature } from './features/lists/unorderedList/server/index.js';
38
39
  export { ParagraphFeature } from './features/paragraph/server/index.js';
39
40
  export { RelationshipFeature, type RelationshipFeatureProps, } from './features/relationship/server/index.js';
40
- export { type RelationshipData, RelationshipServerNode, } from './features/relationship/server/nodes/RelationshipNode.js';
41
+ export { RelationshipServerNode } from './features/relationship/server/nodes/RelationshipNode.js';
42
+ export type { RelationshipData } from './features/relationship/server/schema.js';
41
43
  export { defaultColors } from './features/textState/defaultColors.js';
42
44
  export { TextStateFeature } from './features/textState/feature.server.js';
43
45
  export { FixedToolbarFeature } from './features/toolbars/fixed/server/index.js';
@@ -48,7 +50,8 @@ export type { AfterChangeNodeHook, AfterChangeNodeHookArgs, AfterReadNodeHook, A
48
50
  export { createNode } from './features/typeUtilities.js';
49
51
  export { UploadFeature } from './features/upload/server/index.js';
50
52
  export type { UploadFeatureProps } from './features/upload/server/index.js';
51
- export { type UploadData, UploadServerNode } from './features/upload/server/nodes/UploadNode.js';
53
+ export { UploadServerNode } from './features/upload/server/nodes/UploadNode.js';
54
+ export type { UploadData } from './features/upload/server/schema.js';
52
55
  export type { EditorConfigContextType } from './lexical/config/client/EditorConfigProvider.js';
53
56
  export { defaultEditorConfig, defaultEditorFeatures, defaultEditorLexicalConfig, } from './lexical/config/server/default.js';
54
57
  export { loadFeatures, sortFeaturesForOptimalLoading } from './lexical/config/server/loader.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EACV,YAAY,EACZ,kBAAkB,EAClB,8BAA8B,EAC/B,MAAM,kBAAkB,CAAA;AAezB,eAAO,MAAM,oBAAoB,WAAW,CAAA;AAE5C,wBAAgB,aAAa,CAAC,IAAI,CAAC,EAAE,kBAAkB,GAAG,8BAA8B,CA8IvF;AAED,OAAO,EAAE,YAAY,EAAE,MAAM,kCAAkC,CAAA;AAC/D,OAAO,EAAE,iBAAiB,EAAE,MAAM,uCAAuC,CAAA;A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EACL,kBAAkB,EAClB,mBAAmB,EACnB,mBAAmB,EACnB,gBAAgB,GACjB,MAAM,wBAAwB,CAAA;AAC/B,OAAO,EAAE,kBAAkB,EAAE,MAAM,yCAAyC,CAAA"}
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["checkDependencies","deepMergeSimple","getLexicalHooks","i18n","defaultEditorFeatures","populateLexicalPopulationPromises","getFieldToJSONSchema","featuresInputToEditorConfig","getGenerateImportMap","getGenerateSchemaMap","getDefaultSanitizedEditorConfig","richTextValidateHOC","checkedDependencies","lexicalTargetVersion","lexicalEditor","args","process","env","NODE_ENV","PAYLOAD_DISABLE_DEPENDENCY_CHECKER","dependencyGroups","name","dependencies","targetVersion","config","isRoot","parentIsLocalized","features","resolvedFeatureMap","finalSanitizedEditorConfig","lexical","result","sanitizedConfig","featureI18n","supportedLanguages","supportedLanguagesToMerge","_lang","lang","lexicalI18nForLang","general","translations","CellComponent","DiffComponent","editorConfig","FieldComponent","path","serverProps","admin","views","generateImportMap","lexicalEditorArgs","generateSchemaMap","graphQLPopulationPromises","context","currentDepth","depth","draft","field","fieldPromises","findMany","flattenLocales","overrideAccess","populationPromises","req","showHiddenFields","siblingDoc","size","editorPopulationPromises","hooks","jsonSchema","validate","AlignFeature","BlockquoteFeature","CodeBlock","BlocksFeature","$createServerBlockNode","$isServerBlockNode","ServerBlockNode","$createServerInlineBlockNode","$isServerInlineBlockNode","ServerInlineBlockNode","convertHTMLToLexical","lexicalHTMLField","convertLexicalToMarkdown","convertMarkdownToLexical","getPayloadPopulateFn","getRestPopulateFn","DebugJsxConverterFeature","TestRecorderFeature","TreeViewFeature","EXPERIMENTAL_TableFeature","BoldFeature","InlineCodeFeature","ItalicFeature","StrikethroughFeature","SubscriptFeature","SuperscriptFeature","UnderlineFeature","HeadingFeature","HorizontalRuleFeature","IndentFeature","$createAutoLinkNode","$isAutoLinkNode","AutoLinkNode","$createLinkNode","$isLinkNode","LinkNode","LinkFeature","ChecklistFeature","OrderedListFeature","UnorderedListFeature","ParagraphFeature","RelationshipFeature","RelationshipServerNode","defaultColors","TextStateFeature","FixedToolbarFeature","InlineToolbarFeature","createNode","UploadFeature","UploadServerNode","defaultEditorConfig","defaultEditorLexicalConfig","loadFeatures","sortFeaturesForOptimalLoading","sanitizeServerEditorConfig","sanitizeServerFeatures","getEnabledNodes","getEnabledNodesFromServerNodes","DETAIL_TYPE_TO_DETAIL","DOUBLE_LINE_BREAK","ELEMENT_FORMAT_TO_TYPE","ELEMENT_TYPE_TO_FORMAT","IS_ALL_FORMATTING","LTR_REGEX","NodeFormat","NON_BREAKING_SPACE","RTL_REGEX","TEXT_MODE_TO_TYPE","TEXT_TYPE_TO_FORMAT","TEXT_TYPE_TO_MODE","sanitizeUrl","validateUrl","$convertFromMarkdownString","defaultRichTextValue","populate","buildDefaultEditorState","buildEditorState","createServerFeature","editorConfigFactory","extractPropsFromJSXPropsString","extractFrontmatter","frontmatterToObject","objectToFrontmatter","propsToJSXString","upgradeLexicalData"],"sources":["../src/index.ts"],"sourcesContent":["import type { GenericLanguages, GenericTranslationsObject } from '@payloadcms/translations'\n\nimport { checkDependencies, deepMergeSimple } from 'payload'\n\nimport type { FeatureProviderServer, ResolvedServerFeatureMap } from './features/typesServer.js'\nimport type { SanitizedServerEditorConfig } from './lexical/config/types.js'\nimport type {\n AdapterProps,\n LexicalEditorProps,\n LexicalRichTextAdapterProvider,\n} from './types/index.js'\n\nimport { getLexicalHooks } from './hooks.js'\nimport { i18n } from './i18n.js'\nimport { defaultEditorFeatures } from './lexical/config/server/default.js'\nimport { populateLexicalPopulationPromises } from './populateGraphQL/populateLexicalPopulationPromises.js'\nimport { getFieldToJSONSchema } from './types/schema.js'\nimport { featuresInputToEditorConfig } from './utilities/editorConfigFactory.js'\nimport { getGenerateImportMap } from './utilities/generateImportMap.js'\nimport { getGenerateSchemaMap } from './utilities/generateSchemaMap.js'\nimport { getDefaultSanitizedEditorConfig } from './utilities/getDefaultSanitizedEditorConfig.js'\nimport { richTextValidateHOC } from './validate/index.js'\n\nlet checkedDependencies = false\n\nexport const lexicalTargetVersion = '0.41.0'\n\nexport function lexicalEditor(args?: LexicalEditorProps): LexicalRichTextAdapterProvider {\n if (\n process.env.NODE_ENV !== 'production' &&\n process.env.PAYLOAD_DISABLE_DEPENDENCY_CHECKER !== 'true' &&\n !checkedDependencies\n ) {\n checkedDependencies = true\n void checkDependencies({\n dependencyGroups: [\n {\n name: 'lexical',\n dependencies: [\n 'lexical',\n '@lexical/headless',\n '@lexical/link',\n '@lexical/list',\n '@lexical/mark',\n '@lexical/react',\n '@lexical/rich-text',\n '@lexical/selection',\n '@lexical/utils',\n ],\n targetVersion: lexicalTargetVersion,\n },\n ],\n })\n }\n return async ({ config, isRoot, parentIsLocalized }) => {\n let features: FeatureProviderServer<unknown, unknown, unknown>[] = []\n let resolvedFeatureMap: ResolvedServerFeatureMap\n\n let finalSanitizedEditorConfig: SanitizedServerEditorConfig // For server only\n if (!args || (!args.features && !args.lexical)) {\n finalSanitizedEditorConfig = await getDefaultSanitizedEditorConfig({\n config,\n parentIsLocalized,\n })\n\n features = defaultEditorFeatures\n\n resolvedFeatureMap = finalSanitizedEditorConfig.resolvedFeatureMap\n } else {\n const result = await featuresInputToEditorConfig({\n config,\n features: args?.features,\n isRoot,\n lexical: args?.lexical,\n parentIsLocalized,\n })\n finalSanitizedEditorConfig = result.sanitizedConfig\n features = result.features\n resolvedFeatureMap = result.resolvedFeatureMap\n }\n\n const featureI18n: Partial<GenericLanguages> = finalSanitizedEditorConfig.features.i18n\n const supportedLanguages = config.i18n?.supportedLanguages\n const supportedLanguagesToMerge: Partial<GenericLanguages> = {}\n for (const _lang in supportedLanguages) {\n if (!(_lang in i18n)) {\n if (featureI18n[_lang as keyof typeof i18n]) {\n supportedLanguagesToMerge[_lang as keyof typeof i18n] =\n featureI18n[_lang as keyof typeof i18n]\n }\n continue\n }\n const lang = _lang as keyof typeof i18n\n const lexicalI18nForLang = ((featureI18n[lang] ??= {}).lexical ??=\n {}) as GenericTranslationsObject\n\n lexicalI18nForLang.general = i18n[lang] ?? {}\n supportedLanguagesToMerge[lang] = featureI18n[lang]\n }\n\n config.i18n.translations = deepMergeSimple(config.i18n.translations, supportedLanguagesToMerge)\n\n return {\n CellComponent: '@payloadcms/richtext-lexical/rsc#RscEntryLexicalCell',\n DiffComponent: '@payloadcms/richtext-lexical/rsc#LexicalDiffComponent',\n editorConfig: finalSanitizedEditorConfig,\n features,\n FieldComponent: {\n path: '@payloadcms/richtext-lexical/rsc#RscEntryLexicalField',\n serverProps: {\n admin: args?.admin,\n views: args?.views,\n // SanitizedEditorConfig is manually passed by `renderField` in `fieldSchemasToFormState/renderField.tsx`\n // in order to reduce the size of the field schema\n },\n },\n generateImportMap: getGenerateImportMap({\n lexicalEditorArgs: args,\n resolvedFeatureMap,\n }),\n generateSchemaMap: getGenerateSchemaMap({\n resolvedFeatureMap,\n }),\n graphQLPopulationPromises({\n context,\n currentDepth,\n depth,\n draft,\n field,\n fieldPromises,\n findMany,\n flattenLocales,\n overrideAccess,\n parentIsLocalized,\n populationPromises,\n req,\n showHiddenFields,\n siblingDoc,\n }) {\n // check if there are any features with nodes which have populationPromises for this field\n if (finalSanitizedEditorConfig?.features?.graphQLPopulationPromises?.size) {\n populateLexicalPopulationPromises({\n context,\n currentDepth: currentDepth ?? 0,\n depth,\n draft,\n editorPopulationPromises: finalSanitizedEditorConfig.features.graphQLPopulationPromises,\n field,\n fieldPromises,\n findMany,\n flattenLocales,\n overrideAccess,\n parentIsLocalized,\n populationPromises,\n req,\n showHiddenFields,\n siblingDoc,\n })\n }\n },\n hooks: getLexicalHooks({\n editorConfig: finalSanitizedEditorConfig,\n }),\n jsonSchema: getFieldToJSONSchema({ editorConfig: finalSanitizedEditorConfig }),\n validate: richTextValidateHOC({\n editorConfig: finalSanitizedEditorConfig,\n }),\n }\n }\n}\n\nexport { AlignFeature } from './features/align/server/index.js'\nexport { BlockquoteFeature } from './features/blockquote/server/index.js'\nexport { CodeBlock } from './features/blocks/premade/CodeBlock/index.js'\nexport { BlocksFeature } from './features/blocks/server/index.js'\nexport type {\n BlocksFeatureProps,\n LexicalBlockClientProps,\n LexicalBlockLabelClientProps,\n LexicalBlockLabelServerProps,\n LexicalBlockServerProps,\n LexicalInlineBlockClientProps,\n LexicalInlineBlockLabelClientProps,\n LexicalInlineBlockLabelServerProps,\n LexicalInlineBlockServerProps,\n} from './features/blocks/server/index.js'\n\nexport {\n $createServerBlockNode,\n $isServerBlockNode,\n type BlockFields,\n ServerBlockNode,\n} from './features/blocks/server/nodes/BlocksNode.js'\n\nexport {\n $createServerInlineBlockNode,\n $isServerInlineBlockNode,\n type InlineBlockFields,\n ServerInlineBlockNode,\n} from './features/blocks/server/nodes/InlineBlocksNode.js'\n\nexport { convertHTMLToLexical } from './features/converters/htmlToLexical/index.js'\n\nexport { lexicalHTMLField } from './features/converters/lexicalToHtml/async/field/index.js'\n\nexport { convertLexicalToMarkdown } from './features/converters/lexicalToMarkdown/index.js'\nexport { convertMarkdownToLexical } from './features/converters/markdownToLexical/index.js'\nexport { getPayloadPopulateFn } from './features/converters/utilities/payloadPopulateFn.js'\n\nexport { getRestPopulateFn } from './features/converters/utilities/restPopulateFn.js'\nexport { DebugJsxConverterFeature } from './features/debug/jsxConverter/server/index.js'\nexport { TestRecorderFeature } from './features/debug/testRecorder/server/index.js'\nexport { TreeViewFeature } from './features/debug/treeView/server/index.js'\nexport { EXPERIMENTAL_TableFeature } from './features/experimental_table/server/index.js'\nexport { BoldFeature } from './features/format/bold/feature.server.js'\nexport { InlineCodeFeature } from './features/format/inlineCode/feature.server.js'\n\nexport { ItalicFeature } from './features/format/italic/feature.server.js'\nexport { StrikethroughFeature } from './features/format/strikethrough/feature.server.js'\nexport { SubscriptFeature } from './features/format/subscript/feature.server.js'\nexport { SuperscriptFeature } from './features/format/superscript/feature.server.js'\nexport { UnderlineFeature } from './features/format/underline/feature.server.js'\nexport { HeadingFeature, type HeadingFeatureProps } from './features/heading/server/index.js'\nexport { HorizontalRuleFeature } from './features/horizontalRule/server/index.js'\n\nexport { IndentFeature } from './features/indent/server/index.js'\nexport {\n $createAutoLinkNode,\n $isAutoLinkNode,\n AutoLinkNode,\n} from './features/link/nodes/AutoLinkNode.js'\nexport { $createLinkNode, $isLinkNode, LinkNode } from './features/link/nodes/LinkNode.js'\n\nexport type { LinkFields } from './features/link/nodes/types.js'\nexport { LinkFeature, type LinkFeatureServerProps } from './features/link/server/index.js'\n\nexport { ChecklistFeature } from './features/lists/checklist/server/index.js'\nexport { OrderedListFeature } from './features/lists/orderedList/server/index.js'\n\nexport { UnorderedListFeature } from './features/lists/unorderedList/server/index.js'\n\nexport { ParagraphFeature } from './features/paragraph/server/index.js'\n\nexport {\n RelationshipFeature,\n type RelationshipFeatureProps,\n} from './features/relationship/server/index.js'\n\nexport {\n type RelationshipData,\n RelationshipServerNode,\n} from './features/relationship/server/nodes/RelationshipNode.js'\nexport { defaultColors } from './features/textState/defaultColors.js'\nexport { TextStateFeature } from './features/textState/feature.server.js'\n\nexport { FixedToolbarFeature } from './features/toolbars/fixed/server/index.js'\n\nexport { InlineToolbarFeature } from './features/toolbars/inline/server/index.js'\nexport type { ToolbarGroup, ToolbarGroupItem } from './features/toolbars/types.js'\nexport type {\n BaseClientFeatureProps,\n ClientFeature,\n ClientFeatureProviderMap,\n FeatureProviderClient,\n FeatureProviderProviderClient,\n PluginComponent,\n PluginComponentWithAnchor,\n ResolvedClientFeature,\n ResolvedClientFeatureMap,\n SanitizedClientFeatures,\n SanitizedPlugin,\n} from './features/typesClient.js'\n\nexport type {\n AfterChangeNodeHook,\n AfterChangeNodeHookArgs,\n AfterReadNodeHook,\n AfterReadNodeHookArgs,\n BaseNodeHookArgs,\n BeforeChangeNodeHook,\n BeforeChangeNodeHookArgs,\n BeforeValidateNodeHook,\n BeforeValidateNodeHookArgs,\n FeatureProviderProviderServer,\n FeatureProviderServer,\n NodeValidation,\n NodeWithHooks,\n PopulationPromise,\n ResolvedServerFeature,\n ResolvedServerFeatureMap,\n SanitizedServerFeatures,\n ServerFeature,\n ServerFeatureProviderMap,\n} from './features/typesServer.js'\n\nexport { createNode } from './features/typeUtilities.js' // Only useful in feature.server.ts\n\nexport { UploadFeature } from './features/upload/server/index.js'\nexport type { UploadFeatureProps } from './features/upload/server/index.js'\n\nexport { type UploadData, UploadServerNode } from './features/upload/server/nodes/UploadNode.js'\nexport type { EditorConfigContextType } from './lexical/config/client/EditorConfigProvider.js'\n\nexport {\n defaultEditorConfig,\n defaultEditorFeatures,\n defaultEditorLexicalConfig,\n} from './lexical/config/server/default.js'\nexport { loadFeatures, sortFeaturesForOptimalLoading } from './lexical/config/server/loader.js'\n\nexport {\n sanitizeServerEditorConfig,\n sanitizeServerFeatures,\n} from './lexical/config/server/sanitize.js'\nexport type {\n ClientEditorConfig,\n SanitizedClientEditorConfig,\n SanitizedServerEditorConfig,\n ServerEditorConfig,\n} from './lexical/config/types.js'\nexport type { AdapterProps }\n\nexport { getEnabledNodes, getEnabledNodesFromServerNodes } from './lexical/nodes/index.js'\n\nexport type {\n SlashMenuGroup,\n SlashMenuItem,\n} from './lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/types.js'\nexport {\n DETAIL_TYPE_TO_DETAIL,\n DOUBLE_LINE_BREAK,\n ELEMENT_FORMAT_TO_TYPE,\n ELEMENT_TYPE_TO_FORMAT,\n IS_ALL_FORMATTING,\n LTR_REGEX,\n NodeFormat,\n NON_BREAKING_SPACE,\n RTL_REGEX,\n TEXT_MODE_TO_TYPE,\n TEXT_TYPE_TO_FORMAT,\n TEXT_TYPE_TO_MODE,\n} from './lexical/utils/nodeFormat.js'\n\nexport { sanitizeUrl, validateUrl } from './lexical/utils/url.js'\n\nexport { $convertFromMarkdownString } from './packages/@lexical/markdown/index.js'\n\nexport { defaultRichTextValue } from './populateGraphQL/defaultValue.js'\nexport { populate } from './populateGraphQL/populate.js'\nexport type {\n ClientFeaturesMap,\n LexicalEditorNodeMap,\n LexicalEditorProps,\n LexicalEditorViewMap,\n LexicalFieldAdminProps,\n LexicalRichTextAdapter,\n NodeMapValue,\n SerializedNodeBase,\n ViewMapBlockComponentProps,\n} from './types/index.js'\n\nexport type * from './types/nodeTypes.js'\n\nexport { buildDefaultEditorState, buildEditorState } from './utilities/buildEditorState.js'\nexport { createServerFeature } from './utilities/createServerFeature.js'\n\nexport { editorConfigFactory } from './utilities/editorConfigFactory.js'\nexport type { FieldsDrawerProps } from './utilities/fieldsDrawer/Drawer.js'\n\nexport { extractPropsFromJSXPropsString } from './utilities/jsx/extractPropsFromJSXPropsString.js'\n\nexport {\n extractFrontmatter,\n frontmatterToObject,\n objectToFrontmatter,\n propsToJSXString,\n} from './utilities/jsx/jsx.js'\nexport { upgradeLexicalData } from './utilities/upgradeLexicalData/index.js'\n"],"mappings":"AAEA,SAASA,iBAAiB,EAAEC,eAAe,QAAQ;AAUnD,SAASC,eAAe,QAAQ;AAChC,SAASC,IAAI,QAAQ;AACrB,SAASC,qBAAqB,QAAQ;AACtC,SAASC,iCAAiC,QAAQ;AAClD,SAASC,oBAAoB,QAAQ;AACrC,SAASC,2BAA2B,QAAQ;AAC5C,SAASC,oBAAoB,QAAQ;AACrC,SAASC,oBAAoB,QAAQ;AACrC,SAASC,+BAA+B,QAAQ;AAChD,SAASC,mBAAmB,QAAQ;AAEpC,IAAIC,mBAAA,GAAsB;AAE1B,OAAO,MAAMC,oBAAA,GAAuB;AAEpC,OAAO,SAASC,cAAcC,IAAyB;EACrD,IACEC,OAAA,CAAQC,GAAG,CAACC,QAAQ,KAAK,gBACzBF,OAAA,CAAQC,GAAG,CAACE,kCAAkC,KAAK,UACnD,CAACP,mBAAA,EACD;IACAA,mBAAA,GAAsB;IACtB,KAAKZ,iBAAA,CAAkB;MACrBoB,gBAAA,EAAkB,CAChB;QACEC,IAAA,EAAM;QACNC,YAAA,EAAc,CACZ,WACA,qBACA,iBACA,iBACA,iBACA,kBACA,sBACA,sBACA,iBACD;Q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AAEP,SAEEC,sBAAsB,QACjB;AACP,SAASC,aAAa,QAAQ;AAC9B,SAASC,gBAAgB,QAAQ;AAEjC,SAASC,mBAAmB,QAAQ;AAEpC,SAASC,oBAAoB,QAAQ;AAsCrC,SAASC,UAAU,QAAQ,8BAA6B,CAAC;AAEzD,SAASC,aAAa,QAAQ;AAG9B,SAA0BC,gBAAgB,QAAQ;AAGlD,SACEC,mBAAmB,EACnBrH,qBAAqB,EACrBsH,0BAA0B,QACrB;AACP,SAASC,YAAY,EAAEC,6BAA6B,QAAQ;AAE5D,SACEC,0BAA0B,EAC1BC,sBAAsB,QACjB;AASP,SAASC,eAAe,EAAEC,8BAA8B,QAAQ;AAMhE,SACEC,qBAAqB,EACrBC,iBAAiB,EACjBC,sBAAsB,EACtBC,sBAAsB,EACtBC,iBAAiB,EACjBC,SAAS,EACTC,UAAU,EACVC,kBAAkB,EAClBC,SAAS,EACTC,iBAAiB,EACjBC,mBAAmB,EACnBC,iBAAiB,QACZ;AAEP,SAASC,WAAW,EAAEC,WAAW,QAAQ;AAEzC,SAASC,0BAA0B,QAAQ;AAE3C,SAASC,oBAAoB,QAAQ;AACrC,SAASC,QAAQ,QAAQ;AAezB,SAASC,uBAAuB,EAAEC,gBAAgB,QAAQ;AAC1D,SAASC,mBAAmB,QAAQ;AAEpC,SAASC,mBAAmB,QAAQ;AAGpC,SAASC,8BAA8B,QAAQ;AAE/C,SACEC,kBAAkB,EAClBC,mBAAmB,EACnBC,mBAAmB,EACnBC,gBAAgB,QACX;AACP,SAASC,kBAAkB,QAAQ","ignoreList":[]}
1
+ {"version":3,"file":"index.js","names":["checkDependencies","deepMergeSimple","getLexicalHooks","i18n","defaultEditorFeatures","populateLexicalPopulationPromises","getFieldToJSONSchema","featuresInputToEditorConfig","getGenerateImportMap","getGenerateSchemaMap","getDefaultSanitizedEditorConfig","richTextValidateHOC","checkedDependencies","lexicalTargetVersion","lexicalEditor","args","process","env","NODE_ENV","PAYLOAD_DISABLE_DEPENDENCY_CHECKER","dependencyGroups","name","dependencies","targetVersion","config","isRoot","parentIsLocalized","features","resolvedFeatureMap","finalSanitizedEditorConfig","lexical","result","sanitizedConfig","featureI18n","supportedLanguages","supportedLanguagesToMerge","_lang","lang","lexicalI18nForLang","general","translations","CellComponent","DiffComponent","editorConfig","FieldComponent","path","serverProps","admin","views","generateImportMap","lexicalEditorArgs","generateSchemaMap","graphQLPopulationPromises","context","currentDepth","depth","draft","field","fieldPromises","findMany","flattenLocales","overrideAccess","populationPromises","req","showHiddenFields","siblingDoc","size","editorPopulationPromises","hooks","jsonSchema","validate","AlignFeature","BlockquoteFeature","CodeBlock","BlocksFeature","$createServerBlockNode","$isServerBlockNode","ServerBlockNode","$createServerInlineBlockNode","$isServerInlineBlockNode","ServerInlineBlockNode","convertHTMLToLexical","lexicalHTMLField","convertLexicalToMarkdown","convertMarkdownToLexical","getPayloadPopulateFn","getRestPopulateFn","DebugJsxConverterFeature","TestRecorderFeature","TreeViewFeature","EXPERIMENTAL_TableFeature","BoldFeature","InlineCodeFeature","ItalicFeature","StrikethroughFeature","SubscriptFeature","SuperscriptFeature","UnderlineFeature","HeadingFeature","HorizontalRuleFeature","IndentFeature","$createAutoLinkNode","$isAutoLinkNode","AutoLinkNode","$createLinkNode","$isLinkNode","LinkNode","LinkFeature","ChecklistFeature","OrderedListFeature","UnorderedListFeature","ParagraphFeature","RelationshipFeature","RelationshipServerNode","defaultColors","TextStateFeature","FixedToolbarFeature","InlineToolbarFeature","createNode","UploadFeature","UploadServerNode","defaultEditorConfig","defaultEditorLexicalConfig","loadFeatures","sortFeaturesForOptimalLoading","sanitizeServerEditorConfig","sanitizeServerFeatures","getEnabledNodes","getEnabledNodesFromServerNodes","DETAIL_TYPE_TO_DETAIL","DOUBLE_LINE_BREAK","ELEMENT_FORMAT_TO_TYPE","ELEMENT_TYPE_TO_FORMAT","IS_ALL_FORMATTING","LTR_REGEX","NodeFormat","NON_BREAKING_SPACE","RTL_REGEX","TEXT_MODE_TO_TYPE","TEXT_TYPE_TO_FORMAT","TEXT_TYPE_TO_MODE","sanitizeUrl","validateUrl","$convertFromMarkdownString","defaultRichTextValue","populate","buildDefaultEditorState","buildEditorState","createServerFeature","editorConfigFactory","extractPropsFromJSXPropsString","extractFrontmatter","frontmatterToObject","objectToFrontmatter","propsToJSXString","upgradeLexicalData"],"sources":["../src/index.ts"],"sourcesContent":["import type { GenericLanguages, GenericTranslationsObject } from '@payloadcms/translations'\n\nimport { checkDependencies, deepMergeSimple } from 'payload'\n\nimport type { FeatureProviderServer, ResolvedServerFeatureMap } from './features/typesServer.js'\nimport type { SanitizedServerEditorConfig } from './lexical/config/types.js'\nimport type {\n AdapterProps,\n LexicalEditorProps,\n LexicalRichTextAdapterProvider,\n} from './types/index.js'\n\nimport { getLexicalHooks } from './hooks.js'\nimport { i18n } from './i18n.js'\nimport { defaultEditorFeatures } from './lexical/config/server/default.js'\nimport { populateLexicalPopulationPromises } from './populateGraphQL/populateLexicalPopulationPromises.js'\nimport { getFieldToJSONSchema } from './types/schema.js'\nimport { featuresInputToEditorConfig } from './utilities/editorConfigFactory.js'\nimport { getGenerateImportMap } from './utilities/generateImportMap.js'\nimport { getGenerateSchemaMap } from './utilities/generateSchemaMap.js'\nimport { getDefaultSanitizedEditorConfig } from './utilities/getDefaultSanitizedEditorConfig.js'\nimport { richTextValidateHOC } from './validate/index.js'\n\nlet checkedDependencies = false\n\nexport const lexicalTargetVersion = '0.41.0'\n\nexport function lexicalEditor(args?: LexicalEditorProps): LexicalRichTextAdapterProvider {\n if (\n process.env.NODE_ENV !== 'production' &&\n process.env.PAYLOAD_DISABLE_DEPENDENCY_CHECKER !== 'true' &&\n !checkedDependencies\n ) {\n checkedDependencies = true\n void checkDependencies({\n dependencyGroups: [\n {\n name: 'lexical',\n dependencies: [\n 'lexical',\n '@lexical/headless',\n '@lexical/link',\n '@lexical/list',\n '@lexical/mark',\n '@lexical/react',\n '@lexical/rich-text',\n '@lexical/selection',\n '@lexical/utils',\n ],\n targetVersion: lexicalTargetVersion,\n },\n ],\n })\n }\n return async ({ config, isRoot, parentIsLocalized }) => {\n let features: FeatureProviderServer<unknown, unknown, unknown>[] = []\n let resolvedFeatureMap: ResolvedServerFeatureMap\n\n let finalSanitizedEditorConfig: SanitizedServerEditorConfig // For server only\n if (!args || (!args.features && !args.lexical)) {\n finalSanitizedEditorConfig = await getDefaultSanitizedEditorConfig({\n config,\n parentIsLocalized,\n })\n\n features = defaultEditorFeatures\n\n resolvedFeatureMap = finalSanitizedEditorConfig.resolvedFeatureMap\n } else {\n const result = await featuresInputToEditorConfig({\n config,\n features: args?.features,\n isRoot,\n lexical: args?.lexical,\n parentIsLocalized,\n })\n finalSanitizedEditorConfig = result.sanitizedConfig\n features = result.features\n resolvedFeatureMap = result.resolvedFeatureMap\n }\n\n const featureI18n: Partial<GenericLanguages> = finalSanitizedEditorConfig.features.i18n\n const supportedLanguages = config.i18n?.supportedLanguages\n const supportedLanguagesToMerge: Partial<GenericLanguages> = {}\n for (const _lang in supportedLanguages) {\n if (!(_lang in i18n)) {\n if (featureI18n[_lang as keyof typeof i18n]) {\n supportedLanguagesToMerge[_lang as keyof typeof i18n] =\n featureI18n[_lang as keyof typeof i18n]\n }\n continue\n }\n const lang = _lang as keyof typeof i18n\n const lexicalI18nForLang = ((featureI18n[lang] ??= {}).lexical ??=\n {}) as GenericTranslationsObject\n\n lexicalI18nForLang.general = i18n[lang] ?? {}\n supportedLanguagesToMerge[lang] = featureI18n[lang]\n }\n\n config.i18n.translations = deepMergeSimple(config.i18n.translations, supportedLanguagesToMerge)\n\n return {\n CellComponent: '@payloadcms/richtext-lexical/rsc#RscEntryLexicalCell',\n DiffComponent: '@payloadcms/richtext-lexical/rsc#LexicalDiffComponent',\n editorConfig: finalSanitizedEditorConfig,\n features,\n FieldComponent: {\n path: '@payloadcms/richtext-lexical/rsc#RscEntryLexicalField',\n serverProps: {\n admin: args?.admin,\n views: args?.views,\n // SanitizedEditorConfig is manually passed by `renderField` in `fieldSchemasToFormState/renderField.tsx`\n // in order to reduce the size of the field schema\n },\n },\n generateImportMap: getGenerateImportMap({\n lexicalEditorArgs: args,\n resolvedFeatureMap,\n }),\n generateSchemaMap: getGenerateSchemaMap({\n resolvedFeatureMap,\n }),\n graphQLPopulationPromises({\n context,\n currentDepth,\n depth,\n draft,\n field,\n fieldPromises,\n findMany,\n flattenLocales,\n overrideAccess,\n parentIsLocalized,\n populationPromises,\n req,\n showHiddenFields,\n siblingDoc,\n }) {\n // check if there are any features with nodes which have populationPromises for this field\n if (finalSanitizedEditorConfig?.features?.graphQLPopulationPromises?.size) {\n populateLexicalPopulationPromises({\n context,\n currentDepth: currentDepth ?? 0,\n depth,\n draft,\n editorPopulationPromises: finalSanitizedEditorConfig.features.graphQLPopulationPromises,\n field,\n fieldPromises,\n findMany,\n flattenLocales,\n overrideAccess,\n parentIsLocalized,\n populationPromises,\n req,\n showHiddenFields,\n siblingDoc,\n })\n }\n },\n hooks: getLexicalHooks({\n editorConfig: finalSanitizedEditorConfig,\n }),\n jsonSchema: getFieldToJSONSchema({ editorConfig: finalSanitizedEditorConfig }),\n validate: richTextValidateHOC({\n editorConfig: finalSanitizedEditorConfig,\n }),\n }\n }\n}\n\nexport { AlignFeature } from './features/align/server/index.js'\nexport { BlockquoteFeature } from './features/blockquote/server/index.js'\nexport { CodeBlock } from './features/blocks/premade/CodeBlock/index.js'\nexport { BlocksFeature } from './features/blocks/server/index.js'\nexport type {\n BlocksFeatureProps,\n LexicalBlockClientProps,\n LexicalBlockLabelClientProps,\n LexicalBlockLabelServerProps,\n LexicalBlockServerProps,\n LexicalInlineBlockClientProps,\n LexicalInlineBlockLabelClientProps,\n LexicalInlineBlockLabelServerProps,\n LexicalInlineBlockServerProps,\n} from './features/blocks/server/index.js'\n\nexport {\n $createServerBlockNode,\n $isServerBlockNode,\n ServerBlockNode,\n} from './features/blocks/server/nodes/BlocksNode.js'\nexport {\n $createServerInlineBlockNode,\n $isServerInlineBlockNode,\n ServerInlineBlockNode,\n} from './features/blocks/server/nodes/InlineBlocksNode.js'\n\nexport type { BlockFields, InlineBlockFields } from './features/blocks/server/schema.js'\n\nexport { convertHTMLToLexical } from './features/converters/htmlToLexical/index.js'\n\nexport { lexicalHTMLField } from './features/converters/lexicalToHtml/async/field/index.js'\n\nexport { convertLexicalToMarkdown } from './features/converters/lexicalToMarkdown/index.js'\nexport { convertMarkdownToLexical } from './features/converters/markdownToLexical/index.js'\nexport { getPayloadPopulateFn } from './features/converters/utilities/payloadPopulateFn.js'\n\nexport { getRestPopulateFn } from './features/converters/utilities/restPopulateFn.js'\nexport { DebugJsxConverterFeature } from './features/debug/jsxConverter/server/index.js'\nexport { TestRecorderFeature } from './features/debug/testRecorder/server/index.js'\nexport { TreeViewFeature } from './features/debug/treeView/server/index.js'\nexport { EXPERIMENTAL_TableFeature } from './features/experimental_table/server/index.js'\nexport { BoldFeature } from './features/format/bold/feature.server.js'\nexport { InlineCodeFeature } from './features/format/inlineCode/feature.server.js'\n\nexport { ItalicFeature } from './features/format/italic/feature.server.js'\nexport { StrikethroughFeature } from './features/format/strikethrough/feature.server.js'\nexport { SubscriptFeature } from './features/format/subscript/feature.server.js'\nexport { SuperscriptFeature } from './features/format/superscript/feature.server.js'\nexport { UnderlineFeature } from './features/format/underline/feature.server.js'\nexport { HeadingFeature, type HeadingFeatureProps } from './features/heading/server/index.js'\nexport { HorizontalRuleFeature } from './features/horizontalRule/server/index.js'\n\nexport { IndentFeature } from './features/indent/server/index.js'\nexport {\n $createAutoLinkNode,\n $isAutoLinkNode,\n AutoLinkNode,\n} from './features/link/nodes/AutoLinkNode.js'\nexport { $createLinkNode, $isLinkNode, LinkNode } from './features/link/nodes/LinkNode.js'\n\nexport { LinkFeature, type LinkFeatureServerProps } from './features/link/server/index.js'\nexport type { LinkFields } from './features/link/server/schema.js'\n\nexport { ChecklistFeature } from './features/lists/checklist/server/index.js'\nexport { OrderedListFeature } from './features/lists/orderedList/server/index.js'\n\nexport { UnorderedListFeature } from './features/lists/unorderedList/server/index.js'\n\nexport { ParagraphFeature } from './features/paragraph/server/index.js'\n\nexport {\n RelationshipFeature,\n type RelationshipFeatureProps,\n} from './features/relationship/server/index.js'\n\nexport { RelationshipServerNode } from './features/relationship/server/nodes/RelationshipNode.js'\nexport type { RelationshipData } from './features/relationship/server/schema.js'\nexport { defaultColors } from './features/textState/defaultColors.js'\nexport { TextStateFeature } from './features/textState/feature.server.js'\n\nexport { FixedToolbarFeature } from './features/toolbars/fixed/server/index.js'\n\nexport { InlineToolbarFeature } from './features/toolbars/inline/server/index.js'\nexport type { ToolbarGroup, ToolbarGroupItem } from './features/toolbars/types.js'\nexport type {\n BaseClientFeatureProps,\n ClientFeature,\n ClientFeatureProviderMap,\n FeatureProviderClient,\n FeatureProviderProviderClient,\n PluginComponent,\n PluginComponentWithAnchor,\n ResolvedClientFeature,\n ResolvedClientFeatureMap,\n SanitizedClientFeatures,\n SanitizedPlugin,\n} from './features/typesClient.js'\n\nexport type {\n AfterChangeNodeHook,\n AfterChangeNodeHookArgs,\n AfterReadNodeHook,\n AfterReadNodeHookArgs,\n BaseNodeHookArgs,\n BeforeChangeNodeHook,\n BeforeChangeNodeHookArgs,\n BeforeValidateNodeHook,\n BeforeValidateNodeHookArgs,\n FeatureProviderProviderServer,\n FeatureProviderServer,\n NodeValidation,\n NodeWithHooks,\n PopulationPromise,\n ResolvedServerFeature,\n ResolvedServerFeatureMap,\n SanitizedServerFeatures,\n ServerFeature,\n ServerFeatureProviderMap,\n} from './features/typesServer.js'\n\nexport { createNode } from './features/typeUtilities.js' // Only useful in feature.server.ts\n\nexport { UploadFeature } from './features/upload/server/index.js'\nexport type { UploadFeatureProps } from './features/upload/server/index.js'\n\nexport { UploadServerNode } from './features/upload/server/nodes/UploadNode.js'\nexport type { UploadData } from './features/upload/server/schema.js'\nexport type { EditorConfigContextType } from './lexical/config/client/EditorConfigProvider.js'\n\nexport {\n defaultEditorConfig,\n defaultEditorFeatures,\n defaultEditorLexicalConfig,\n} from './lexical/config/server/default.js'\nexport { loadFeatures, sortFeaturesForOptimalLoading } from './lexical/config/server/loader.js'\n\nexport {\n sanitizeServerEditorConfig,\n sanitizeServerFeatures,\n} from './lexical/config/server/sanitize.js'\nexport type {\n ClientEditorConfig,\n SanitizedClientEditorConfig,\n SanitizedServerEditorConfig,\n ServerEditorConfig,\n} from './lexical/config/types.js'\nexport type { AdapterProps }\n\nexport { getEnabledNodes, getEnabledNodesFromServerNodes } from './lexical/nodes/index.js'\n\nexport type {\n SlashMenuGroup,\n SlashMenuItem,\n} from './lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/types.js'\nexport {\n DETAIL_TYPE_TO_DETAIL,\n DOUBLE_LINE_BREAK,\n ELEMENT_FORMAT_TO_TYPE,\n ELEMENT_TYPE_TO_FORMAT,\n IS_ALL_FORMATTING,\n LTR_REGEX,\n NodeFormat,\n NON_BREAKING_SPACE,\n RTL_REGEX,\n TEXT_MODE_TO_TYPE,\n TEXT_TYPE_TO_FORMAT,\n TEXT_TYPE_TO_MODE,\n} from './lexical/utils/nodeFormat.js'\n\nexport { sanitizeUrl, validateUrl } from './lexical/utils/url.js'\n\nexport { $convertFromMarkdownString } from './packages/@lexical/markdown/index.js'\n\nexport { defaultRichTextValue } from './populateGraphQL/defaultValue.js'\nexport { populate } from './populateGraphQL/populate.js'\nexport type {\n ClientFeaturesMap,\n LexicalEditorNodeMap,\n LexicalEditorProps,\n LexicalEditorViewMap,\n LexicalFieldAdminProps,\n LexicalRichTextAdapter,\n NodeMapValue,\n SerializedNodeBase,\n ViewMapBlockComponentProps,\n} from './types/index.js'\n\nexport type * from './types/nodeTypes.js'\n\nexport { buildDefaultEditorState, buildEditorState } from './utilities/buildEditorState.js'\nexport { createServerFeature } from './utilities/createServerFeature.js'\n\nexport { editorConfigFactory } from './utilities/editorConfigFactory.js'\nexport type { FieldsDrawerProps } from './utilities/fieldsDrawer/Drawer.js'\n\nexport { extractPropsFromJSXPropsString } from './utilities/jsx/extractPropsFromJSXPropsString.js'\n\nexport {\n extractFrontmatter,\n frontmatterToObject,\n objectToFrontmatter,\n propsToJSXString,\n} from './utilities/jsx/jsx.js'\nexport { upgradeLexicalData } from './utilities/upgradeLexicalData/index.js'\n"],"mappings":"AAEA,SAASA,iBAAiB,EAAEC,eAAe,QAAQ;AAUnD,SAASC,eAAe,QAAQ;AAChC,SAASC,IAAI,QAAQ;AACrB,SAASC,qBAAqB,QAAQ;AACtC,SAASC,iCAAiC,QAAQ;AAClD,SAASC,oBAAoB,QAAQ;AACrC,SAASC,2BAA2B,QAAQ;AAC5C,SAASC,oBAAoB,QAAQ;AACrC,SAASC,oBAAoB,QAAQ;AACrC,SAASC,+BAA+B,QAAQ;AAChD,SAASC,mBAAmB,QAAQ;AAEpC,IAAIC,mBAAA,GAAsB;AAE1B,OAAO,MAAMC,oBAAA,GAAuB;AAEpC,OAAO,SAASC,cAAcC,IAAyB;EACrD,IACEC,OAAA,CAAQC,GAAG,CAACC,QAAQ,KAAK,gBACzBF,OAAA,CAAQC,GAAG,CAACE,kCAAkC,KAAK,UACnD,CAACP,mBAAA,EACD;IACAA,mBAAA,GAAsB;IACtB,KAAKZ,iBAAA,CAAkB;MACrBoB,gBAAA,EAAkB,CAChB;QACEC,IAAA,EAAM;QACNC,YAAA,EAAc,CACZ,WACA,qBACA,iBACA,iBACA,iBACA,kBACA,sBACA,sBACA,iBACD;QACDC,aAAA,EAAeV;MACjB;IAEJ;EACF;EACA,OAAO,OAAO;IAAEW,MAAM;IAAEC,MAAM;IAAEC;EAAiB,CAAE;IACjD,IAAIC,QAAA,GAA+D,EAAE;IACrE,IAAIC,kBAAA;IAEJ,IAAIC,0BAAwD;AAAA;IAC5D,IAAI,CAACd,IAAA,IAAS,CAACA,IAAA,CAAKY,QAAQ,IAAI,CAACZ,IAAA,CAAKe,OAAO,EAAG;MAC9CD,0BAAA,GAA6B,MAAMnB,+BAAA,CAAgC;QACjEc,MAAA;QACAE;MACF;MAEAC,QAAA,GAAWvB,qB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AsB,QACjB;AASP,SAASC,eAAe,EAAEC,8BAA8B,QAAQ;AAMhE,SACEC,qBAAqB,EACrBC,iBAAiB,EACjBC,sBAAsB,EACtBC,sBAAsB,EACtBC,iBAAiB,EACjBC,SAAS,EACTC,UAAU,EACVC,kBAAkB,EAClBC,SAAS,EACTC,iBAAiB,EACjBC,mBAAmB,EACnBC,iBAAiB,QACZ;AAEP,SAASC,WAAW,EAAEC,WAAW,QAAQ;AAEzC,SAASC,0BAA0B,QAAQ;AAE3C,SAASC,oBAAoB,QAAQ;AACrC,SAASC,QAAQ,QAAQ;AAezB,SAASC,uBAAuB,EAAEC,gBAAgB,QAAQ;AAC1D,SAASC,mBAAmB,QAAQ;AAEpC,SAASC,mBAAmB,QAAQ;AAGpC,SAASC,8BAA8B,QAAQ;AAE/C,SACEC,kBAAkB,EAClBC,mBAAmB,EACnBC,mBAAmB,EACnBC,gBAAgB,QACX;AACP,SAASC,kBAAkB,QAAQ","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"sanitize.d.ts","sourceRoot":"","sources":["../../../../src/lexical/config/server/sanitize.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAA;AAE9C,OAAO,KAAK,EACV,wBAAwB,EACxB,uBAAuB,EACxB,MAAM,kCAAkC,CAAA;AACzC,OAAO,KAAK,EAAE,2BAA2B,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAA;AAIlF,eAAO,MAAM,sBAAsB,GACjC,UAAU,wBAAwB,KACjC,uBAyHF,CAAA;AAED,wBAAsB,0BAA0B,CAC9C,YAAY,EAAE,kBAAkB,EAChC,MAAM,EAAE,eAAe,EACvB,iBAAiB,CAAC,EAAE,OAAO,GAC1B,OAAO,CAAC,2BAA2B,CAAC,CAYtC"}
1
+ {"version":3,"file":"sanitize.d.ts","sourceRoot":"","sources":["../../../../src/lexical/config/server/sanitize.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAA;AAE9C,OAAO,KAAK,EACV,wBAAwB,EACxB,uBAAuB,EACxB,MAAM,kCAAkC,CAAA;AACzC,OAAO,KAAK,EAAE,2BAA2B,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAA;AAIlF,eAAO,MAAM,sBAAsB,GACjC,UAAU,wBAAwB,KACjC,uBA0HF,CAAA;AAED,wBAAsB,0BAA0B,CAC9C,YAAY,EAAE,kBAAkB,EAChC,MAAM,EAAE,eAAe,EACvB,iBAAiB,CAAC,EAAE,OAAO,GAC1B,OAAO,CAAC,2BAA2B,CAAC,CAYtC"}
@@ -2,9 +2,6 @@ import { loadFeatures } from './loader.js';
2
2
  export const sanitizeServerFeatures = features => {
3
3
  const sanitized = {
4
4
  enabledFeatures: [],
5
- generatedTypes: {
6
- modifyJSONSchemas: []
7
- },
8
5
  getSubFields: new Map(),
9
6
  getSubFieldsData: new Map(),
10
7
  graphQLPopulationPromises: new Map(),
@@ -29,9 +26,6 @@ export const sanitizeServerFeatures = features => {
29
26
  return sanitized;
30
27
  }
31
28
  features.forEach(feature => {
32
- if (feature?.generatedTypes?.modifyJSONSchema) {
33
- sanitized.generatedTypes.modifyJSONSchemas.push(feature.generatedTypes.modifyJSONSchema);
34
- }
35
29
  if (feature?.hooks?.beforeValidate?.length) {
36
30
  sanitized.hooks.beforeValidate = sanitized.hooks.beforeValidate?.concat(feature.hooks.beforeValidate);
37
31
  }
@@ -58,11 +52,15 @@ export const sanitizeServerFeatures = features => {
58
52
  if (feature.nodes?.length) {
59
53
  // Do not concat here. We need to keep the object reference of sanitized.nodes so that function markdown transformers of features automatically get the updated nodes
60
54
  for (const node of feature.nodes) {
55
+ const nodeType = 'with' in node.node ? node.node.replace.getType() : node.node.getType();
56
+ const alreadyRegistered = sanitized.nodes.some(existing => {
57
+ const existingType = 'with' in existing.node ? existing.node.replace.getType() : existing.node.getType();
58
+ return existingType === nodeType;
59
+ });
60
+ if (alreadyRegistered) {
61
+ throw new Error(`Lexical editor config: node type "${nodeType}" was registered more than once (feature "${feature.key}"). Each lexical node type may only be registered by a single feature.`);
62
+ }
61
63
  sanitized.nodes.push(node);
62
- }
63
- feature.nodes.forEach(node => {
64
- const nodeType = 'with' in node.node ? node.node.replace.getType() : node.node.getType() // TODO: Idk if this works for node replacements
65
- ;
66
64
  if (node?.graphQLPopulationPromises?.length) {
67
65
  sanitized.graphQLPopulationPromises.set(nodeType, node.graphQLPopulationPromises);
68
66
  }
@@ -87,7 +85,7 @@ export const sanitizeServerFeatures = features => {
87
85
  if (node?.getSubFieldsData) {
88
86
  sanitized.getSubFieldsData?.set(nodeType, node.getSubFieldsData);
89
87
  }
90
- });
88
+ }
91
89
  }
92
90
  if (feature.markdownTransformers?.length) {
93
91
  // Do not concat here. We need to keep the object reference of feature.markdownTransformers
@@ -1 +1 @@
1
- {"version":3,"file":"sanitize.js","names":["loadFeatures","sanitizeServerFeatures","features","sanitized","enabledFeatures","generatedTypes","modifyJSONSchemas","getSubFields","Map","getSubFieldsData","graphQLPopulationPromises","hooks","afterChange","afterRead","beforeChange","beforeValidate","i18n","markdownTransformers","nodeHooks","nodes","validations","size","forEach","feature","modifyJSONSchema","push","length","concat","lang","lexical","key","node","nodeType","replace","getType","set","transformer","allNodes","allTransformers","sanitizeServerEditorConfig","editorConfig","config","parentIsLocalized","resolvedFeatureMap","unSanitizedEditorConfig"],"sources":["../../../../src/lexical/config/server/sanitize.ts"],"sourcesContent":["import type { SanitizedConfig } from 'payload'\n\nimport type {\n ResolvedServerFeatureMap,\n SanitizedServerFeatures,\n} from '../../../features/typesServer.js'\nimport type { SanitizedServerEditorConfig, ServerEditorConfig } from '../types.js'\n\nimport { loadFeatures } from './loader.js'\n\nexport const sanitizeServerFeatures = (\n features: ResolvedServerFeatureMap,\n): SanitizedServerFeatures => {\n const sanitized: SanitizedServerFeatures = {\n enabledFeatures: [],\n generatedTypes: {\n modifyJSONSchemas: [],\n },\n getSubFields: new Map(),\n getSubFieldsData: new Map(),\n graphQLPopulationPromises: new Map(),\n hooks: {\n afterChange: [],\n afterRead: [],\n beforeChange: [],\n beforeValidate: [],\n },\n i18n: {},\n markdownTransformers: [],\n nodeHooks: {\n afterChange: new Map(),\n afterRead: new Map(),\n beforeChange: new Map(),\n beforeValidate: new Map(),\n },\n nodes: [],\n\n validations: new Map(),\n }\n\n if (!features?.size) {\n return sanitized\n }\n\n features.forEach((feature) => {\n if (feature?.generatedTypes?.modifyJSONSchema) {\n sanitized.generatedTypes.modifyJSONSchemas.push(feature.generatedTypes.modifyJSONSchema)\n }\n\n if (feature?.hooks?.beforeValidate?.length) {\n sanitized.hooks.beforeValidate = sanitized.hooks.beforeValidate?.concat(\n feature.hooks.beforeValidate,\n )\n }\n if (feature?.hooks?.beforeChange?.length) {\n sanitized.hooks.beforeChange = sanitized.hooks.beforeChange?.concat(\n feature.hooks.beforeChange,\n )\n }\n if (feature?.hooks?.afterRead?.length) {\n sanitized.hooks.afterRead = sanitized.hooks.afterRead?.concat(feature.hooks.afterRead)\n }\n if (feature?.hooks?.afterChange?.length) {\n sanitized.hooks.afterChange = sanitized.hooks.afterChange?.concat(feature.hooks.afterChange)\n }\n\n if (feature?.i18n) {\n for (const lang in feature.i18n) {\n if (!sanitized.i18n[lang as keyof typeof sanitized.i18n]) {\n sanitized.i18n[lang as keyof typeof sanitized.i18n] = {\n lexical: {},\n }\n }\n // @ts-expect-error - vestiges of when tsconfig was not strict. Feel free to improve\n sanitized.i18n[lang].lexical[feature.key] = feature.i18n[lang]\n }\n }\n\n if (feature.nodes?.length) {\n // Do not concat here. We need to keep the object reference of sanitized.nodes so that function markdown transformers of features automatically get the updated nodes\n for (const node of feature.nodes) {\n sanitized.nodes.push(node)\n }\n feature.nodes.forEach((node) => {\n const nodeType = 'with' in node.node ? node.node.replace.getType() : node.node.getType() // TODO: Idk if this works for node replacements\n if (node?.graphQLPopulationPromises?.length) {\n sanitized.graphQLPopulationPromises.set(nodeType, node.graphQLPopulationPromises)\n }\n if (node?.validations?.length) {\n sanitized.validations.set(nodeType, node.validations)\n }\n if (node?.hooks?.afterChange) {\n sanitized.nodeHooks?.afterChange?.set(nodeType, node.hooks.afterChange)\n }\n if (node?.hooks?.afterRead) {\n sanitized.nodeHooks?.afterRead?.set(nodeType, node.hooks.afterRead)\n }\n if (node?.hooks?.beforeChange) {\n sanitized.nodeHooks?.beforeChange?.set(nodeType, node.hooks.beforeChange)\n }\n if (node?.hooks?.beforeValidate) {\n sanitized.nodeHooks?.beforeValidate?.set(nodeType, node.hooks.beforeValidate)\n }\n if (node?.getSubFields) {\n sanitized.getSubFields?.set(nodeType, node.getSubFields)\n }\n if (node?.getSubFieldsData) {\n sanitized.getSubFieldsData?.set(nodeType, node.getSubFieldsData)\n }\n })\n }\n\n if (feature.markdownTransformers?.length) {\n // Do not concat here. We need to keep the object reference of feature.markdownTransformers\n\n for (const transformer of feature.markdownTransformers) {\n if (typeof transformer === 'function') {\n sanitized.markdownTransformers.push(\n transformer({\n allNodes: sanitized.nodes,\n allTransformers: sanitized.markdownTransformers,\n }),\n )\n } else {\n sanitized.markdownTransformers.push(transformer)\n }\n }\n }\n\n sanitized.enabledFeatures.push(feature.key)\n })\n\n return sanitized\n}\n\nexport async function sanitizeServerEditorConfig(\n editorConfig: ServerEditorConfig,\n config: SanitizedConfig,\n parentIsLocalized?: boolean,\n): Promise<SanitizedServerEditorConfig> {\n const resolvedFeatureMap = await loadFeatures({\n config,\n parentIsLocalized: parentIsLocalized!,\n unSanitizedEditorConfig: editorConfig,\n })\n\n return {\n features: sanitizeServerFeatures(resolvedFeatureMap),\n lexical: editorConfig.lexical!,\n resolvedFeatureMap,\n }\n}\n"],"mappings":"AAQA,SAASA,YAAY,QAAQ;AAE7B,OAAO,MAAMC,sBAAA,GACXC,QAAA;EAEA,MAAMC,SAAA,GAAqC;IACzCC,eAAA,EAAiB,EAAE;IACnBC,cAAA,EAAgB;MACdC,iBAAA,EAAmB;IACrB;IACAC,YAAA,EAAc,IAAIC,GAAA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D,IAAI,OAAOmB,WAAA,KAAgB,YAAY;UACrCjC,SAAA,CAAUc,oBAAoB,CAACQ,IAAI,CACjCW,WAAA,CAAY;YACVC,QAAA,EAAUlC,SAAA,CAAUgB,KAAK;YACzBmB,eAAA,EAAiBnC,SAAA,CAAUc;UAC7B;QAEJ,OAAO;UACLd,SAAA,CAAUc,oBAAoB,CAACQ,IAAI,CAACW,WAAA;QACtC;MACF;IACF;IAEAjC,SAAA,CAAUC,eAAe,CAACqB,IAAI,CAACF,OAAA,CAAQO,GAAG;EAC5C;EAEA,OAAO3B,SAAA;AACT;AAEA,OAAO,eAAeoC,2BACpBC,YAAgC,EAChCC,MAAuB,EACvBC,iBAA2B;EAE3B,MAAMC,kBAAA,GAAqB,MAAM3C,YAAA,CAAa;IAC5CyC,MAAA;IACAC,iBAAA,EAAmBA,iBAAA;IACnBE,uBAAA,EAAyBJ;EAC3B;EAEA,OAAO;IACLtC,QAAA,EAAUD,sBAAA,CAAuB0C,kBAAA;IACjCd,OAAA,EAASW,YAAA,CAAaX,OAAO;IAC7Bc;EACF;AACF","ignoreList":[]}
1
+ {"version":3,"file":"sanitize.js","names":["loadFeatures","sanitizeServerFeatures","features","sanitized","enabledFeatures","getSubFields","Map","getSubFieldsData","graphQLPopulationPromises","hooks","afterChange","afterRead","beforeChange","beforeValidate","i18n","markdownTransformers","nodeHooks","nodes","validations","size","forEach","feature","length","concat","lang","lexical","key","node","nodeType","replace","getType","alreadyRegistered","some","existing","existingType","Error","push","set","transformer","allNodes","allTransformers","sanitizeServerEditorConfig","editorConfig","config","parentIsLocalized","resolvedFeatureMap","unSanitizedEditorConfig"],"sources":["../../../../src/lexical/config/server/sanitize.ts"],"sourcesContent":["import type { SanitizedConfig } from 'payload'\n\nimport type {\n ResolvedServerFeatureMap,\n SanitizedServerFeatures,\n} from '../../../features/typesServer.js'\nimport type { SanitizedServerEditorConfig, ServerEditorConfig } from '../types.js'\n\nimport { loadFeatures } from './loader.js'\n\nexport const sanitizeServerFeatures = (\n features: ResolvedServerFeatureMap,\n): SanitizedServerFeatures => {\n const sanitized: SanitizedServerFeatures = {\n enabledFeatures: [],\n getSubFields: new Map(),\n getSubFieldsData: new Map(),\n graphQLPopulationPromises: new Map(),\n hooks: {\n afterChange: [],\n afterRead: [],\n beforeChange: [],\n beforeValidate: [],\n },\n i18n: {},\n markdownTransformers: [],\n nodeHooks: {\n afterChange: new Map(),\n afterRead: new Map(),\n beforeChange: new Map(),\n beforeValidate: new Map(),\n },\n nodes: [],\n\n validations: new Map(),\n }\n\n if (!features?.size) {\n return sanitized\n }\n\n features.forEach((feature) => {\n if (feature?.hooks?.beforeValidate?.length) {\n sanitized.hooks.beforeValidate = sanitized.hooks.beforeValidate?.concat(\n feature.hooks.beforeValidate,\n )\n }\n if (feature?.hooks?.beforeChange?.length) {\n sanitized.hooks.beforeChange = sanitized.hooks.beforeChange?.concat(\n feature.hooks.beforeChange,\n )\n }\n if (feature?.hooks?.afterRead?.length) {\n sanitized.hooks.afterRead = sanitized.hooks.afterRead?.concat(feature.hooks.afterRead)\n }\n if (feature?.hooks?.afterChange?.length) {\n sanitized.hooks.afterChange = sanitized.hooks.afterChange?.concat(feature.hooks.afterChange)\n }\n\n if (feature?.i18n) {\n for (const lang in feature.i18n) {\n if (!sanitized.i18n[lang as keyof typeof sanitized.i18n]) {\n sanitized.i18n[lang as keyof typeof sanitized.i18n] = {\n lexical: {},\n }\n }\n // @ts-expect-error - vestiges of when tsconfig was not strict. Feel free to improve\n sanitized.i18n[lang].lexical[feature.key] = feature.i18n[lang]\n }\n }\n\n if (feature.nodes?.length) {\n // Do not concat here. We need to keep the object reference of sanitized.nodes so that function markdown transformers of features automatically get the updated nodes\n for (const node of feature.nodes) {\n const nodeType = 'with' in node.node ? node.node.replace.getType() : node.node.getType()\n const alreadyRegistered = sanitized.nodes.some((existing) => {\n const existingType =\n 'with' in existing.node ? existing.node.replace.getType() : existing.node.getType()\n return existingType === nodeType\n })\n if (alreadyRegistered) {\n throw new Error(\n `Lexical editor config: node type \"${nodeType}\" was registered more than once (feature \"${feature.key}\"). Each lexical node type may only be registered by a single feature.`,\n )\n }\n sanitized.nodes.push(node)\n if (node?.graphQLPopulationPromises?.length) {\n sanitized.graphQLPopulationPromises.set(nodeType, node.graphQLPopulationPromises)\n }\n if (node?.validations?.length) {\n sanitized.validations.set(nodeType, node.validations)\n }\n if (node?.hooks?.afterChange) {\n sanitized.nodeHooks?.afterChange?.set(nodeType, node.hooks.afterChange)\n }\n if (node?.hooks?.afterRead) {\n sanitized.nodeHooks?.afterRead?.set(nodeType, node.hooks.afterRead)\n }\n if (node?.hooks?.beforeChange) {\n sanitized.nodeHooks?.beforeChange?.set(nodeType, node.hooks.beforeChange)\n }\n if (node?.hooks?.beforeValidate) {\n sanitized.nodeHooks?.beforeValidate?.set(nodeType, node.hooks.beforeValidate)\n }\n if (node?.getSubFields) {\n sanitized.getSubFields?.set(nodeType, node.getSubFields)\n }\n if (node?.getSubFieldsData) {\n sanitized.getSubFieldsData?.set(nodeType, node.getSubFieldsData)\n }\n }\n }\n\n if (feature.markdownTransformers?.length) {\n // Do not concat here. We need to keep the object reference of feature.markdownTransformers\n\n for (const transformer of feature.markdownTransformers) {\n if (typeof transformer === 'function') {\n sanitized.markdownTransformers.push(\n transformer({\n allNodes: sanitized.nodes,\n allTransformers: sanitized.markdownTransformers,\n }),\n )\n } else {\n sanitized.markdownTransformers.push(transformer)\n }\n }\n }\n\n sanitized.enabledFeatures.push(feature.key)\n })\n\n return sanitized\n}\n\nexport async function sanitizeServerEditorConfig(\n editorConfig: ServerEditorConfig,\n config: SanitizedConfig,\n parentIsLocalized?: boolean,\n): Promise<SanitizedServerEditorConfig> {\n const resolvedFeatureMap = await loadFeatures({\n config,\n parentIsLocalized: parentIsLocalized!,\n unSanitizedEditorConfig: editorConfig,\n })\n\n return {\n features: sanitizeServerFeatures(resolvedFeatureMap),\n lexical: editorConfig.lexical!,\n resolvedFeatureMap,\n }\n}\n"],"mappings":"AAQA,S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ACA,IAAIsB,IAAA,EAAMpB,gBAAA,EAAkB;UAC1BJ,SAAA,CAAUI,gBAAgB,EAAE8B,GAAA,CAAIT,QAAA,EAAUD,IAAA,CAAKpB,gBAAgB;QACjE;MACF;IACF;IAEA,IAAIc,OAAA,CAAQN,oBAAoB,EAAEO,MAAA,EAAQ;MACxC;MAEA,KAAK,MAAMgB,WAAA,IAAejB,OAAA,CAAQN,oBAAoB,EAAE;QACtD,IAAI,OAAOuB,WAAA,KAAgB,YAAY;UACrCnC,SAAA,CAAUY,oBAAoB,CAACqB,IAAI,CACjCE,WAAA,CAAY;YACVC,QAAA,EAAUpC,SAAA,CAAUc,KAAK;YACzBuB,eAAA,EAAiBrC,SAAA,CAAUY;UAC7B;QAEJ,OAAO;UACLZ,SAAA,CAAUY,oBAAoB,CAACqB,IAAI,CAACE,WAAA;QACtC;MACF;IACF;IAEAnC,SAAA,CAAUC,eAAe,CAACgC,IAAI,CAACf,OAAA,CAAQK,GAAG;EAC5C;EAEA,OAAOvB,SAAA;AACT;AAEA,OAAO,eAAesC,2BACpBC,YAAgC,EAChCC,MAAuB,EACvBC,iBAA2B;EAE3B,MAAMC,kBAAA,GAAqB,MAAM7C,YAAA,CAAa;IAC5C2C,MAAA;IACAC,iBAAA,EAAmBA,iBAAA;IACnBE,uBAAA,EAAyBJ;EAC3B;EAEA,OAAO;IACLxC,QAAA,EAAUD,sBAAA,CAAuB4C,kBAAA;IACjCpB,OAAA,EAASiB,YAAA,CAAajB,OAAO;IAC7BoB;EACF;AACF","ignoreList":[]}
@@ -0,0 +1,14 @@
1
+ import type { JSONSchemaFn } from '../features/typesServer.js';
2
+ /**
3
+ * Cross-cutting Lexical types shared by every element node. Inlined into
4
+ * `payload-types.ts`. Must stay byte-for-byte in sync with the runtime twins
5
+ * in `types/nodeTypes.ts` (`LexicalElementFormat`, `LexicalElementDirection`,
6
+ * `SerializedLexicalElementBase`) — cross-module assignability depends on it.
7
+ */
8
+ export declare const CORE_LEXICAL_TYPE_STRING = "/** @internal Core Lexical types \u2014 see @payloadcms/richtext-lexical. */\nexport type LexicalElementFormat = 'left' | 'start' | 'center' | 'right' | 'end' | 'justify' | '';\nexport type LexicalElementDirection = ('ltr' | 'rtl') | null;\n\nexport interface SerializedLexicalElementBase<TChildren> {\n children: TChildren[];\n direction: LexicalElementDirection;\n format: LexicalElementFormat;\n indent: number;\n textFormat?: number;\n textStyle?: string;\n version: number;\n}";
9
+ export declare const textNodeJSONSchema: JSONSchemaFn;
10
+ export declare const tabNodeJSONSchema: JSONSchemaFn;
11
+ export declare const lineBreakNodeJSONSchema: JSONSchemaFn;
12
+ export declare const paragraphNodeJSONSchema: JSONSchemaFn;
13
+ export declare const rootNodeJSONSchema: JSONSchemaFn;
14
+ //# sourceMappingURL=builtInNodes.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"builtInNodes.d.ts","sourceRoot":"","sources":["../../src/types/builtInNodes.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAA;AAI9D;;;;;GAKG;AACH,eAAO,MAAM,wBAAwB,6eAYnC,CAAA;AA4DF,eAAO,MAAM,kBAAkB,EAAE,YAkBhC,CAAA;AAED,eAAO,MAAM,iBAAiB,EAAE,YAoB/B,CAAA;AAED,eAAO,MAAM,uBAAuB,EAAE,YAYrC,CAAA;AAED,eAAO,MAAM,uBAAuB,EAAE,YAerC,CAAA;AAeD,eAAO,MAAM,kBAAkB,EAAE,YAoBhC,CAAA"}
@@ -0,0 +1,203 @@
1
+ import { withNullableJSONSchemaType } from 'payload';
2
+ import { versionSchema } from './jsonSchemaHelpers.js';
3
+ /**
4
+ * Cross-cutting Lexical types shared by every element node. Inlined into
5
+ * `payload-types.ts`. Must stay byte-for-byte in sync with the runtime twins
6
+ * in `types/nodeTypes.ts` (`LexicalElementFormat`, `LexicalElementDirection`,
7
+ * `SerializedLexicalElementBase`) — cross-module assignability depends on it.
8
+ */
9
+ export const CORE_LEXICAL_TYPE_STRING = `/** @internal Core Lexical types — see @payloadcms/richtext-lexical. */
10
+ export type LexicalElementFormat = 'left' | 'start' | 'center' | 'right' | 'end' | 'justify' | '';
11
+ export type LexicalElementDirection = ('ltr' | 'rtl') | null;
12
+
13
+ export interface SerializedLexicalElementBase<TChildren> {
14
+ children: TChildren[];
15
+ direction: LexicalElementDirection;
16
+ format: LexicalElementFormat;
17
+ indent: number;
18
+ textFormat?: number;
19
+ textStyle?: string;
20
+ version: number;
21
+ }`;
22
+ /**
23
+ * Built-in Lexical node schemas (always present regardless of feature config).
24
+ * Co-located with the TS source they reference — each `JSONSchemaFn` adds
25
+ * its helper interface(s) to `typeStringDefinitions` and returns the JSON
26
+ * schema for that node.
27
+ */ /** MUST stay byte-for-byte in sync with `LexicalTextMode` in `types/nodeTypes.ts`. */
28
+ const LEXICAL_TEXT_MODE_TS = `export type LexicalTextMode = 'normal' | 'token' | 'segmented';`;
29
+ /** MUST stay byte-for-byte in sync with `SerializedTextNode` in `types/nodeTypes.ts`. */
30
+ const SERIALIZED_TEXT_NODE_TS = `export interface SerializedTextNode {
31
+ type: 'text';
32
+ detail: number;
33
+ format: number;
34
+ mode: LexicalTextMode;
35
+ style: string;
36
+ text: string;
37
+ version: number;
38
+ }`;
39
+ /** MUST stay byte-for-byte in sync with `SerializedTabNode` in `types/nodeTypes.ts`. */
40
+ const SERIALIZED_TAB_NODE_TS = `export interface SerializedTabNode {
41
+ type: 'tab';
42
+ detail: number;
43
+ format: number;
44
+ mode: LexicalTextMode;
45
+ style: string;
46
+ text: string;
47
+ version: number;
48
+ }`;
49
+ /** MUST stay byte-for-byte in sync with `SerializedLineBreakNode` in `types/nodeTypes.ts`. */
50
+ const SERIALIZED_LINE_BREAK_NODE_TS = `export interface SerializedLineBreakNode {
51
+ type: 'linebreak';
52
+ version: number;
53
+ }`;
54
+ /** MUST stay byte-for-byte in sync with `SerializedParagraphNode` in `types/nodeTypes.ts`. */
55
+ const SERIALIZED_PARAGRAPH_NODE_TS = `export interface SerializedParagraphNode<TChildren> extends SerializedLexicalElementBase<TChildren> {
56
+ type: 'paragraph';
57
+ textFormat: number;
58
+ textStyle: string;
59
+ }`;
60
+ const textModeSchema = {
61
+ type: 'string',
62
+ enum: ['normal', 'token', 'segmented'],
63
+ tsType: 'LexicalTextMode'
64
+ };
65
+ /** Text-node `format` bitmask (Lexical text-format flags). */
66
+ const textFormatSchema = {
67
+ type: 'integer',
68
+ description: 'Active text formats as a bitmask, OR-ed together (0 = none): bold=1, italic=2, strikethrough=4, underline=8, code=16, subscript=32, superscript=64, highlight=128, lowercase=256, uppercase=512. e.g. bold + italic = 3.'
69
+ };
70
+ export const textNodeJSONSchema = ({
71
+ typeStringDefinitions
72
+ }) => {
73
+ typeStringDefinitions.add(LEXICAL_TEXT_MODE_TS);
74
+ typeStringDefinitions.add(SERIALIZED_TEXT_NODE_TS);
75
+ return {
76
+ type: 'object',
77
+ additionalProperties: false,
78
+ properties: {
79
+ type: {
80
+ type: 'string',
81
+ const: 'text'
82
+ },
83
+ detail: {
84
+ type: 'integer'
85
+ },
86
+ format: textFormatSchema,
87
+ mode: textModeSchema,
88
+ style: {
89
+ type: 'string'
90
+ },
91
+ text: {
92
+ type: 'string'
93
+ },
94
+ version: versionSchema
95
+ },
96
+ required: ['detail', 'format', 'mode', 'style', 'text', 'type', 'version'],
97
+ tsType: 'SerializedTextNode'
98
+ };
99
+ };
100
+ export const tabNodeJSONSchema = ({
101
+ typeStringDefinitions
102
+ }) => {
103
+ typeStringDefinitions.add(LEXICAL_TEXT_MODE_TS);
104
+ typeStringDefinitions.add(SERIALIZED_TAB_NODE_TS);
105
+ return {
106
+ type: 'object',
107
+ additionalProperties: false,
108
+ properties: {
109
+ type: {
110
+ type: 'string',
111
+ const: 'tab'
112
+ },
113
+ // A tab node is fully fixed: Lexical marks it unmergeable (`detail` = IS_UNMERGEABLE = 2) and
114
+ // its text is a single tab. Any other `detail` makes `TabNode.setDetail` throw on load.
115
+ detail: {
116
+ const: 2,
117
+ description: 'Always 2 (Lexical IS_UNMERGEABLE); other values throw.'
118
+ },
119
+ format: textFormatSchema,
120
+ mode: textModeSchema,
121
+ style: {
122
+ type: 'string'
123
+ },
124
+ text: {
125
+ const: '\t',
126
+ description: 'Always a single tab character.'
127
+ },
128
+ version: versionSchema
129
+ },
130
+ required: ['detail', 'format', 'mode', 'style', 'text', 'type', 'version'],
131
+ tsType: 'SerializedTabNode'
132
+ };
133
+ };
134
+ export const lineBreakNodeJSONSchema = ({
135
+ typeStringDefinitions
136
+ }) => {
137
+ typeStringDefinitions.add(SERIALIZED_LINE_BREAK_NODE_TS);
138
+ return {
139
+ type: 'object',
140
+ additionalProperties: false,
141
+ properties: {
142
+ type: {
143
+ type: 'string',
144
+ const: 'linebreak'
145
+ },
146
+ version: versionSchema
147
+ },
148
+ required: ['type', 'version'],
149
+ tsType: 'SerializedLineBreakNode'
150
+ };
151
+ };
152
+ export const paragraphNodeJSONSchema = ({
153
+ elementNodeSchema,
154
+ nodeUnionName,
155
+ typeStringDefinitions
156
+ }) => {
157
+ typeStringDefinitions.add(SERIALIZED_PARAGRAPH_NODE_TS);
158
+ return elementNodeSchema({
159
+ nodeType: 'paragraph',
160
+ properties: {
161
+ textFormat: {
162
+ type: 'integer'
163
+ },
164
+ textStyle: {
165
+ type: 'string'
166
+ }
167
+ },
168
+ required: ['textFormat', 'textStyle'],
169
+ tsType: `SerializedParagraphNode<${nodeUnionName}>`
170
+ });
171
+ };
172
+ /** MUST stay byte-for-byte in sync with `LexicalRichText` in `types/nodeTypes.ts`. */
173
+ const ROOT_NODE_TS = `/** Shape of a Lexical \`richText\` field. */
174
+ export interface LexicalRichText<TNode> {
175
+ root: {
176
+ children: TNode[];
177
+ direction: LexicalElementDirection;
178
+ format: LexicalElementFormat;
179
+ indent: number;
180
+ type: 'root';
181
+ version: number;
182
+ };
183
+ }`;
184
+ export const rootNodeJSONSchema = ({
185
+ elementNodeSchema,
186
+ field,
187
+ nodeUnionName,
188
+ typeStringDefinitions
189
+ }) => {
190
+ typeStringDefinitions.add(ROOT_NODE_TS);
191
+ return {
192
+ type: withNullableJSONSchemaType('object', !!field.required),
193
+ additionalProperties: false,
194
+ properties: {
195
+ root: elementNodeSchema({
196
+ nodeType: 'root'
197
+ })
198
+ },
199
+ required: ['root'],
200
+ tsType: field.required ? `LexicalRichText<${nodeUnionName}>` : `LexicalRichText<${nodeUnionName}> | null`
201
+ };
202
+ };
203
+ //# sourceMappingURL=builtInNodes.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"builtInNodes.js","names":["withNullableJSONSchemaType","versionSchema","CORE_LEXICAL_TYPE_STRING","LEXICAL_TEXT_MODE_TS","SERIALIZED_TEXT_NODE_TS","SERIALIZED_TAB_NODE_TS","SERIALIZED_LINE_BREAK_NODE_TS","SERIALIZED_PARAGRAPH_NODE_TS","textModeSchema","type","enum","tsType","textFormatSchema","description","textNodeJSONSchema","typeStringDefinitions","add","additionalProperties","properties","const","detail","format","mode","style","text","version","required","tabNodeJSONSchema","lineBreakNodeJSONSchema","paragraphNodeJSONSchema","elementNodeSchema","nodeUnionName","nodeType","textFormat","textStyle","ROOT_NODE_TS","rootNodeJSONSchema","field","root"],"sources":["../../src/types/builtInNodes.ts"],"sourcesContent":["import type { JSONSchema4 } from 'json-schema'\n\nimport { withNullableJSONSchemaType } from 'payload'\n\nimport type { JSONSchemaFn } from '../features/typesServer.js'\n\nimport { versionSchema } from './jsonSchemaHelpers.js'\n\n/**\n * Cross-cutting Lexical types shared by every element node. Inlined into\n * `payload-types.ts`. Must stay byte-for-byte in sync with the runtime twins\n * in `types/nodeTypes.ts` (`LexicalElementFormat`, `LexicalElementDirection`,\n * `SerializedLexicalElementBase`) — cross-module assignability depends on it.\n */\nexport const CORE_LEXICAL_TYPE_STRING = `/** @internal Core Lexical types — see @payloadcms/richtext-lexical. */\nexport type LexicalElementFormat = 'left' | 'start' | 'center' | 'right' | 'end' | 'justify' | '';\nexport type LexicalElementDirection = ('ltr' | 'rtl') | null;\n\nexport interface SerializedLexicalElementBase<TChildren> {\n children: TChildren[];\n direction: LexicalElementDirection;\n format: LexicalElementFormat;\n indent: number;\n textFormat?: number;\n textStyle?: string;\n version: number;\n}`\n\n/**\n * Built-in Lexical node schemas (always present regardless of feature config).\n * Co-located with the TS source they reference — each `JSONSchemaFn` adds\n * its helper interface(s) to `typeStringDefinitions` and returns the JSON\n * schema for that node.\n */\n\n/** MUST stay byte-for-byte in sync with `LexicalTextMode` in `types/nodeTypes.ts`. */\nconst LEXICAL_TEXT_MODE_TS = `export type LexicalTextMode = 'normal' | 'token' | 'segmented';`\n\n/** MUST stay byte-for-byte in sync with `SerializedTextNode` in `types/nodeTypes.ts`. */\nconst SERIALIZED_TEXT_NODE_TS = `export interface SerializedTextNode {\n type: 'text';\n detail: number;\n format: number;\n mode: LexicalTextMode;\n style: string;\n text: string;\n version: number;\n}`\n\n/** MUST stay byte-for-byte in sync with `SerializedTabNode` in `types/nodeTypes.ts`. */\nconst SERIALIZED_TAB_NODE_TS = `export interface SerializedTabNode {\n type: 'tab';\n detail: number;\n format: number;\n mode: LexicalTextMode;\n style: string;\n text: string;\n version: number;\n}`\n\n/** MUST stay byte-for-byte in sync with `SerializedLineBreakNode` in `types/nodeTypes.ts`. */\nconst SERIALIZED_LINE_BREAK_NODE_TS = `export interface SerializedLineBreakNode {\n type: 'linebreak';\n version: number;\n}`\n\n/** MUST stay byte-for-byte in sync with `SerializedParagraphNode` in `types/nodeTypes.ts`. */\nconst SERIALIZED_PARAGRAPH_NODE_TS = `export interface SerializedParagraphNode<TChildren> extends SerializedLexicalElementBase<TChildren> {\n type: 'paragraph';\n textFormat: number;\n textStyle: string;\n}`\n\nconst textModeSchema: JSONSchema4 = {\n type: 'string',\n enum: ['normal', 'token', 'segmented'],\n tsType: 'LexicalTextMode',\n}\n\n/** Text-node `format` bitmask (Lexical text-format flags). */\nconst textFormatSchema: JSONSchema4 = {\n type: 'integer',\n description:\n 'Active text formats as a bitmask, OR-ed together (0 = none): bold=1, italic=2, strikethrough=4, underline=8, code=16, subscript=32, superscript=64, highlight=128, lowercase=256, uppercase=512. e.g. bold + italic = 3.',\n}\n\nexport const textNodeJSONSchema: JSONSchemaFn = ({ typeStringDefinitions }) => {\n typeStringDefinitions.add(LEXICAL_TEXT_MODE_TS)\n typeStringDefinitions.add(SERIALIZED_TEXT_NODE_TS)\n return {\n type: 'object',\n additionalProperties: false,\n properties: {\n type: { type: 'string', const: 'text' },\n detail: { type: 'integer' },\n format: textFormatSchema,\n mode: textModeSchema,\n style: { type: 'string' },\n text: { type: 'string' },\n version: versionSchema,\n },\n required: ['detail', 'format', 'mode', 'style', 'text', 'type', 'version'],\n tsType: 'SerializedTextNode',\n }\n}\n\nexport const tabNodeJSONSchema: JSONSchemaFn = ({ typeStringDefinitions }) => {\n typeStringDefinitions.add(LEXICAL_TEXT_MODE_TS)\n typeStringDefinitions.add(SERIALIZED_TAB_NODE_TS)\n return {\n type: 'object',\n additionalProperties: false,\n properties: {\n type: { type: 'string', const: 'tab' },\n // A tab node is fully fixed: Lexical marks it unmergeable (`detail` = IS_UNMERGEABLE = 2) and\n // its text is a single tab. Any other `detail` makes `TabNode.setDetail` throw on load.\n detail: { const: 2, description: 'Always 2 (Lexical IS_UNMERGEABLE); other values throw.' },\n format: textFormatSchema,\n mode: textModeSchema,\n style: { type: 'string' },\n text: { const: '\\t', description: 'Always a single tab character.' },\n version: versionSchema,\n },\n required: ['detail', 'format', 'mode', 'style', 'text', 'type', 'version'],\n tsType: 'SerializedTabNode',\n }\n}\n\nexport const lineBreakNodeJSONSchema: JSONSchemaFn = ({ typeStringDefinitions }) => {\n typeStringDefinitions.add(SERIALIZED_LINE_BREAK_NODE_TS)\n return {\n type: 'object',\n additionalProperties: false,\n properties: {\n type: { type: 'string', const: 'linebreak' },\n version: versionSchema,\n },\n required: ['type', 'version'],\n tsType: 'SerializedLineBreakNode',\n }\n}\n\nexport const paragraphNodeJSONSchema: JSONSchemaFn = ({\n elementNodeSchema,\n nodeUnionName,\n typeStringDefinitions,\n}) => {\n typeStringDefinitions.add(SERIALIZED_PARAGRAPH_NODE_TS)\n return elementNodeSchema({\n nodeType: 'paragraph',\n properties: {\n textFormat: { type: 'integer' },\n textStyle: { type: 'string' },\n },\n required: ['textFormat', 'textStyle'],\n tsType: `SerializedParagraphNode<${nodeUnionName}>`,\n })\n}\n\n/** MUST stay byte-for-byte in sync with `LexicalRichText` in `types/nodeTypes.ts`. */\nconst ROOT_NODE_TS = `/** Shape of a Lexical \\`richText\\` field. */\nexport interface LexicalRichText<TNode> {\n root: {\n children: TNode[];\n direction: LexicalElementDirection;\n format: LexicalElementFormat;\n indent: number;\n type: 'root';\n version: number;\n };\n}`\n\nexport const rootNodeJSONSchema: JSONSchemaFn = ({\n elementNodeSchema,\n field,\n nodeUnionName,\n typeStringDefinitions,\n}) => {\n typeStringDefinitions.add(ROOT_NODE_TS)\n return {\n type: withNullableJSONSchemaType('object', !!field.required),\n additionalProperties: false,\n properties: {\n root: elementNodeSchema({\n nodeType: 'root',\n }),\n },\n required: ['root'],\n tsType: field.required\n ? `LexicalRichText<${nodeUnionName}>`\n : `LexicalRichText<${nodeUnionName}> | null`,\n }\n}\n"],"mappings":"AAEA,SAASA,0BAA0B,QAAQ;AAI3C,SAASC,aAAa,QAAQ;AAE9B;;;;;;AAMA,OAAO,MAAMC,wBAAA,GAA2B;;;;;;;;;;;;EAYtC;AAEF;;;;;GAAA,CAOA;AACA,MAAMC,oBAAA,GAAuB,iEAAiE;AAE9F;AACA,MAAMC,uBAAA,GAA0B;;;;;;;;EAQ9B;AAEF;AACA,MAAMC,sBAAA,GAAyB;;;;;;;;EAQ7B;AAEF;AACA,MAAMC,6BAAA,GAAgC;;;EAGpC;AAEF;AACA,MAAMC,4BAAA,GAA+B;;;;EAInC;AAEF,MAAMC,cAAA,GAA8B;EAClCC,IAAA,EAAM;EACNC,IAAA,EAAM,CAAC,UAAU,SAAS,YAAY;EACtCC,MAAA,EAAQ;AACV;AAE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ClBf,MAAA,EAAQ0B,KAAA,CAAMX,QAAQ,GAClB,mBAAmBK,aAAA,GAAgB,GACnC,mBAAmBA,aAAA;EACzB;AACF","ignoreList":[]}
@@ -16,7 +16,6 @@ import type { DefaultNodeTypes, SerializedBlockNode, SerializedInlineBlockNode }
16
16
  * Extends the base SerializedLexicalNode with optional type for flexibility.
17
17
  */
18
18
  export type SerializedNodeBase = {
19
- [key: string]: unknown;
20
19
  type?: string;
21
20
  };
22
21
  export type LexicalFieldAdminProps = {
@@ -314,26 +313,26 @@ export type LexicalEditorNodeMap<TNodes extends SerializedNodeBase = DefaultNode
314
313
  }>>;
315
314
  } & {
316
315
  blocks?: {
317
- [K in Extract<Extract<TNodes, {
316
+ [K in (Extract<TNodes, {
318
317
  type: 'block';
319
- }> extends SerializedBlockNode<infer B> ? B extends {
320
- blockType: string;
321
- } ? B['blockType'] : never : never, string>]?: NodeMapBlockValue<Extract<TNodes, {
318
+ }> & SerializedBlockNode)['fields']['blockType']]?: NodeMapBlockValue<Extract<Extract<TNodes, {
322
319
  type: 'block';
323
- }> extends SerializedBlockNode<infer B> ? SerializedBlockNode<Extract<B, {
324
- blockType: K;
325
- }>> : SerializedBlockNode>;
320
+ }> & SerializedBlockNode, {
321
+ fields: {
322
+ blockType: K;
323
+ };
324
+ }>>;
326
325
  };
327
326
  inlineBlocks?: {
328
- [K in Extract<Extract<TNodes, {
327
+ [K in (Extract<TNodes, {
329
328
  type: 'inlineBlock';
330
- }> extends SerializedInlineBlockNode<infer B> ? B extends {
331
- blockType: string;
332
- } ? B['blockType'] : never : never, string>]?: NodeMapInlineBlockValue<Extract<TNodes, {
329
+ }> & SerializedInlineBlockNode)['fields']['blockType']]?: NodeMapInlineBlockValue<Extract<Extract<TNodes, {
333
330
  type: 'inlineBlock';
334
- }> extends SerializedInlineBlockNode<infer B> ? SerializedInlineBlockNode<Extract<B, {
335
- blockType: K;
336
- }>> : SerializedInlineBlockNode>;
331
+ }> & SerializedInlineBlockNode, {
332
+ fields: {
333
+ blockType: K;
334
+ };
335
+ }>>;
337
336
  };
338
337
  unknown?: NodeMapValue<SerializedLexicalNode>;
339
338
  };