@payloadcms/richtext-lexical 3.0.0-beta.2 → 3.0.0-beta.20

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 (389) hide show
  1. package/dist/cell/index.d.ts +1 -1
  2. package/dist/cell/index.d.ts.map +1 -1
  3. package/dist/cell/index.js +2 -4
  4. package/dist/cell/index.js.map +1 -1
  5. package/dist/field/features/align/feature.client.d.ts.map +1 -1
  6. package/dist/field/features/align/feature.client.js +1 -2
  7. package/dist/field/features/align/feature.client.js.map +1 -1
  8. package/dist/field/features/blockquote/feature.client.d.ts.map +1 -1
  9. package/dist/field/features/blockquote/feature.client.js +3 -6
  10. package/dist/field/features/blockquote/feature.client.js.map +1 -1
  11. package/dist/field/features/blockquote/feature.server.d.ts.map +1 -1
  12. package/dist/field/features/blockquote/feature.server.js +4 -4
  13. package/dist/field/features/blockquote/feature.server.js.map +1 -1
  14. package/dist/field/features/blockquote/markdownTransformer.d.ts.map +1 -1
  15. package/dist/field/features/blockquote/markdownTransformer.js +2 -4
  16. package/dist/field/features/blockquote/markdownTransformer.js.map +1 -1
  17. package/dist/field/features/blocks/component/BlockContent.d.ts.map +1 -1
  18. package/dist/field/features/blocks/component/BlockContent.js +3 -5
  19. package/dist/field/features/blocks/component/BlockContent.js.map +1 -1
  20. package/dist/field/features/blocks/component/index.d.ts.map +1 -1
  21. package/dist/field/features/blocks/component/index.js +36 -3
  22. package/dist/field/features/blocks/component/index.js.map +1 -1
  23. package/dist/field/features/blocks/drawer/index.d.ts.map +1 -1
  24. package/dist/field/features/blocks/drawer/index.js +2 -4
  25. package/dist/field/features/blocks/drawer/index.js.map +1 -1
  26. package/dist/field/features/blocks/feature.server.d.ts.map +1 -1
  27. package/dist/field/features/blocks/feature.server.js +105 -33
  28. package/dist/field/features/blocks/feature.server.js.map +1 -1
  29. package/dist/field/features/blocks/nodes/BlocksNode.d.ts +1 -3
  30. package/dist/field/features/blocks/nodes/BlocksNode.d.ts.map +1 -1
  31. package/dist/field/features/blocks/nodes/BlocksNode.js +1 -2
  32. package/dist/field/features/blocks/nodes/BlocksNode.js.map +1 -1
  33. package/dist/field/features/blocks/plugin/commands.d.ts.map +1 -1
  34. package/dist/field/features/blocks/plugin/commands.js +1 -2
  35. package/dist/field/features/blocks/plugin/commands.js.map +1 -1
  36. package/dist/field/features/blocks/plugin/index.d.ts.map +1 -1
  37. package/dist/field/features/blocks/plugin/index.js +3 -6
  38. package/dist/field/features/blocks/plugin/index.js.map +1 -1
  39. package/dist/field/features/blocks/populationPromise.d.ts.map +1 -1
  40. package/dist/field/features/blocks/populationPromise.js +3 -5
  41. package/dist/field/features/blocks/populationPromise.js.map +1 -1
  42. package/dist/field/features/blocks/validate.d.ts.map +1 -1
  43. package/dist/field/features/blocks/validate.js +21 -23
  44. package/dist/field/features/blocks/validate.js.map +1 -1
  45. package/dist/field/features/converters/html/field/index.d.ts +8 -2
  46. package/dist/field/features/converters/html/field/index.d.ts.map +1 -1
  47. package/dist/field/features/converters/html/field/index.js +6 -3
  48. package/dist/field/features/converters/html/field/index.js.map +1 -1
  49. package/dist/field/features/debug/testrecorder/plugin/index.d.ts.map +1 -1
  50. package/dist/field/features/debug/testrecorder/plugin/index.js +2 -4
  51. package/dist/field/features/debug/testrecorder/plugin/index.js.map +1 -1
  52. package/dist/field/features/debug/treeview/plugin/index.d.ts.map +1 -1
  53. package/dist/field/features/debug/treeview/plugin/index.js +2 -4
  54. package/dist/field/features/debug/treeview/plugin/index.js.map +1 -1
  55. package/dist/field/features/format/bold/feature.client.d.ts.map +1 -1
  56. package/dist/field/features/format/bold/feature.client.js +1 -2
  57. package/dist/field/features/format/bold/feature.client.js.map +1 -1
  58. package/dist/field/features/format/inlinecode/feature.client.d.ts.map +1 -1
  59. package/dist/field/features/format/inlinecode/feature.client.js +1 -2
  60. package/dist/field/features/format/inlinecode/feature.client.js.map +1 -1
  61. package/dist/field/features/format/italic/feature.client.d.ts.map +1 -1
  62. package/dist/field/features/format/italic/feature.client.js +1 -2
  63. package/dist/field/features/format/italic/feature.client.js.map +1 -1
  64. package/dist/field/features/format/strikethrough/feature.client.d.ts.map +1 -1
  65. package/dist/field/features/format/strikethrough/feature.client.js +1 -2
  66. package/dist/field/features/format/strikethrough/feature.client.js.map +1 -1
  67. package/dist/field/features/format/subscript/feature.client.d.ts.map +1 -1
  68. package/dist/field/features/format/subscript/feature.client.js +1 -2
  69. package/dist/field/features/format/subscript/feature.client.js.map +1 -1
  70. package/dist/field/features/format/superscript/feature.client.d.ts.map +1 -1
  71. package/dist/field/features/format/superscript/feature.client.js +1 -2
  72. package/dist/field/features/format/superscript/feature.client.js.map +1 -1
  73. package/dist/field/features/format/underline/feature.client.d.ts.map +1 -1
  74. package/dist/field/features/format/underline/feature.client.js +1 -2
  75. package/dist/field/features/format/underline/feature.client.js.map +1 -1
  76. package/dist/field/features/heading/feature.client.d.ts.map +1 -1
  77. package/dist/field/features/heading/feature.client.js +3 -6
  78. package/dist/field/features/heading/feature.client.js.map +1 -1
  79. package/dist/field/features/heading/feature.server.d.ts.map +1 -1
  80. package/dist/field/features/heading/feature.server.js +5 -5
  81. package/dist/field/features/heading/feature.server.js.map +1 -1
  82. package/dist/field/features/heading/markdownTransformer.d.ts.map +1 -1
  83. package/dist/field/features/heading/markdownTransformer.js +1 -2
  84. package/dist/field/features/heading/markdownTransformer.js.map +1 -1
  85. package/dist/field/features/horizontalrule/component/index.d.ts +10 -0
  86. package/dist/field/features/horizontalrule/component/index.d.ts.map +1 -0
  87. package/dist/field/features/horizontalrule/component/index.js +62 -0
  88. package/dist/field/features/horizontalrule/component/index.js.map +1 -0
  89. package/dist/field/features/horizontalrule/feature.client.d.ts +3 -0
  90. package/dist/field/features/horizontalrule/feature.client.d.ts.map +1 -0
  91. package/dist/field/features/horizontalrule/feature.client.js +53 -0
  92. package/dist/field/features/horizontalrule/feature.client.js.map +1 -0
  93. package/dist/field/features/horizontalrule/feature.server.d.ts +3 -0
  94. package/dist/field/features/horizontalrule/feature.server.d.ts.map +1 -0
  95. package/dist/field/features/horizontalrule/feature.server.js +37 -0
  96. package/dist/field/features/horizontalrule/feature.server.js.map +1 -0
  97. package/dist/field/features/horizontalrule/markdownTransformer.d.ts +3 -0
  98. package/dist/field/features/horizontalrule/markdownTransformer.d.ts.map +1 -0
  99. package/dist/field/features/horizontalrule/markdownTransformer.js +23 -0
  100. package/dist/field/features/horizontalrule/markdownTransformer.js.map +1 -0
  101. package/dist/field/features/horizontalrule/nodes/HorizontalRuleNode.d.ts +53 -0
  102. package/dist/field/features/horizontalrule/nodes/HorizontalRuleNode.d.ts.map +1 -0
  103. package/dist/field/features/horizontalrule/nodes/HorizontalRuleNode.js +88 -0
  104. package/dist/field/features/horizontalrule/nodes/HorizontalRuleNode.js.map +1 -0
  105. package/dist/field/features/horizontalrule/plugin/index.d.ts +6 -0
  106. package/dist/field/features/horizontalrule/plugin/index.d.ts.map +1 -0
  107. package/dist/field/features/horizontalrule/plugin/index.js +31 -0
  108. package/dist/field/features/horizontalrule/plugin/index.js.map +1 -0
  109. package/dist/field/features/horizontalrule/plugin/index.scss +20 -0
  110. package/dist/field/features/indent/feature.client.d.ts.map +1 -1
  111. package/dist/field/features/indent/feature.client.js +1 -2
  112. package/dist/field/features/indent/feature.client.js.map +1 -1
  113. package/dist/field/features/link/drawer/baseFields.js +1 -1
  114. package/dist/field/features/link/drawer/baseFields.js.map +1 -1
  115. package/dist/field/features/link/drawer/index.js +3 -2
  116. package/dist/field/features/link/drawer/index.js.map +1 -1
  117. package/dist/field/features/link/feature.client.d.ts.map +1 -1
  118. package/dist/field/features/link/feature.client.js +2 -4
  119. package/dist/field/features/link/feature.client.js.map +1 -1
  120. package/dist/field/features/link/feature.server.d.ts.map +1 -1
  121. package/dist/field/features/link/feature.server.js +30 -7
  122. package/dist/field/features/link/feature.server.js.map +1 -1
  123. package/dist/field/features/link/nodes/AutoLinkNode.d.ts.map +1 -1
  124. package/dist/field/features/link/nodes/AutoLinkNode.js +1 -2
  125. package/dist/field/features/link/nodes/AutoLinkNode.js.map +1 -1
  126. package/dist/field/features/link/nodes/LinkNode.d.ts +1 -3
  127. package/dist/field/features/link/nodes/LinkNode.d.ts.map +1 -1
  128. package/dist/field/features/link/nodes/LinkNode.js +2 -4
  129. package/dist/field/features/link/nodes/LinkNode.js.map +1 -1
  130. package/dist/field/features/link/plugins/autoLink/index.d.ts.map +1 -1
  131. package/dist/field/features/link/plugins/autoLink/index.js +3 -6
  132. package/dist/field/features/link/plugins/autoLink/index.js.map +1 -1
  133. package/dist/field/features/link/plugins/floatingLinkEditor/LinkEditor/commands.d.ts.map +1 -1
  134. package/dist/field/features/link/plugins/floatingLinkEditor/LinkEditor/commands.js +1 -2
  135. package/dist/field/features/link/plugins/floatingLinkEditor/LinkEditor/commands.js.map +1 -1
  136. package/dist/field/features/link/plugins/floatingLinkEditor/LinkEditor/index.d.ts.map +1 -1
  137. package/dist/field/features/link/plugins/floatingLinkEditor/LinkEditor/index.js +20 -17
  138. package/dist/field/features/link/plugins/floatingLinkEditor/LinkEditor/index.js.map +1 -1
  139. package/dist/field/features/link/plugins/link/index.js +3 -6
  140. package/dist/field/features/link/plugins/link/index.js.map +1 -1
  141. package/dist/field/features/link/populationPromise.d.ts.map +1 -1
  142. package/dist/field/features/link/populationPromise.js +28 -26
  143. package/dist/field/features/link/populationPromise.js.map +1 -1
  144. package/dist/field/features/lists/checklist/feature.client.d.ts.map +1 -1
  145. package/dist/field/features/lists/checklist/feature.client.js +1 -2
  146. package/dist/field/features/lists/checklist/feature.client.js.map +1 -1
  147. package/dist/field/features/lists/checklist/feature.server.d.ts.map +1 -1
  148. package/dist/field/features/lists/checklist/feature.server.js +6 -6
  149. package/dist/field/features/lists/checklist/feature.server.js.map +1 -1
  150. package/dist/field/features/lists/checklist/markdownTransformers.d.ts.map +1 -1
  151. package/dist/field/features/lists/checklist/markdownTransformers.js +1 -2
  152. package/dist/field/features/lists/checklist/markdownTransformers.js.map +1 -1
  153. package/dist/field/features/lists/checklist/plugin/index.d.ts.map +1 -1
  154. package/dist/field/features/lists/checklist/plugin/index.js +1 -2
  155. package/dist/field/features/lists/checklist/plugin/index.js.map +1 -1
  156. package/dist/field/features/lists/common/markdown.d.ts.map +1 -1
  157. package/dist/field/features/lists/common/markdown.js +1 -2
  158. package/dist/field/features/lists/common/markdown.js.map +1 -1
  159. package/dist/field/features/lists/htmlConverter.d.ts.map +1 -1
  160. package/dist/field/features/lists/htmlConverter.js +13 -6
  161. package/dist/field/features/lists/htmlConverter.js.map +1 -1
  162. package/dist/field/features/lists/orderedlist/feature.client.d.ts.map +1 -1
  163. package/dist/field/features/lists/orderedlist/feature.client.js +1 -2
  164. package/dist/field/features/lists/orderedlist/feature.client.js.map +1 -1
  165. package/dist/field/features/lists/orderedlist/feature.server.d.ts.map +1 -1
  166. package/dist/field/features/lists/orderedlist/feature.server.js +6 -6
  167. package/dist/field/features/lists/orderedlist/feature.server.js.map +1 -1
  168. package/dist/field/features/lists/orderedlist/markdownTransformer.d.ts.map +1 -1
  169. package/dist/field/features/lists/orderedlist/markdownTransformer.js +1 -2
  170. package/dist/field/features/lists/orderedlist/markdownTransformer.js.map +1 -1
  171. package/dist/field/features/lists/plugin/index.d.ts.map +1 -1
  172. package/dist/field/features/lists/plugin/index.js +1 -2
  173. package/dist/field/features/lists/plugin/index.js.map +1 -1
  174. package/dist/field/features/lists/unorderedlist/feature.client.d.ts.map +1 -1
  175. package/dist/field/features/lists/unorderedlist/feature.client.js +1 -2
  176. package/dist/field/features/lists/unorderedlist/feature.client.js.map +1 -1
  177. package/dist/field/features/lists/unorderedlist/feature.server.d.ts.map +1 -1
  178. package/dist/field/features/lists/unorderedlist/feature.server.js +6 -6
  179. package/dist/field/features/lists/unorderedlist/feature.server.js.map +1 -1
  180. package/dist/field/features/lists/unorderedlist/markdownTransformer.d.ts.map +1 -1
  181. package/dist/field/features/lists/unorderedlist/markdownTransformer.js +1 -2
  182. package/dist/field/features/lists/unorderedlist/markdownTransformer.js.map +1 -1
  183. package/dist/field/features/migrations/lexicalPluginToLexical/converter/converters/upload/converter.d.ts.map +1 -1
  184. package/dist/field/features/migrations/lexicalPluginToLexical/converter/converters/upload/converter.js +2 -4
  185. package/dist/field/features/migrations/lexicalPluginToLexical/converter/converters/upload/converter.js.map +1 -1
  186. package/dist/field/features/migrations/lexicalPluginToLexical/nodes/unknownConvertedNode/index.d.ts +1 -3
  187. package/dist/field/features/migrations/lexicalPluginToLexical/nodes/unknownConvertedNode/index.d.ts.map +1 -1
  188. package/dist/field/features/migrations/lexicalPluginToLexical/nodes/unknownConvertedNode/index.js +2 -4
  189. package/dist/field/features/migrations/lexicalPluginToLexical/nodes/unknownConvertedNode/index.js.map +1 -1
  190. package/dist/field/features/migrations/slateToLexical/converter/converters/relationship/converter.d.ts.map +1 -1
  191. package/dist/field/features/migrations/slateToLexical/converter/converters/relationship/converter.js +2 -4
  192. package/dist/field/features/migrations/slateToLexical/converter/converters/relationship/converter.js.map +1 -1
  193. package/dist/field/features/migrations/slateToLexical/converter/converters/upload/converter.d.ts.map +1 -1
  194. package/dist/field/features/migrations/slateToLexical/converter/converters/upload/converter.js +2 -4
  195. package/dist/field/features/migrations/slateToLexical/converter/converters/upload/converter.js.map +1 -1
  196. package/dist/field/features/migrations/slateToLexical/converter/index.d.ts.map +1 -1
  197. package/dist/field/features/migrations/slateToLexical/converter/index.js +2 -1
  198. package/dist/field/features/migrations/slateToLexical/converter/index.js.map +1 -1
  199. package/dist/field/features/migrations/slateToLexical/nodes/unknownConvertedNode/index.d.ts +1 -3
  200. package/dist/field/features/migrations/slateToLexical/nodes/unknownConvertedNode/index.d.ts.map +1 -1
  201. package/dist/field/features/migrations/slateToLexical/nodes/unknownConvertedNode/index.js +2 -4
  202. package/dist/field/features/migrations/slateToLexical/nodes/unknownConvertedNode/index.js.map +1 -1
  203. package/dist/field/features/paragraph/feature.client.d.ts.map +1 -1
  204. package/dist/field/features/paragraph/feature.client.js +2 -4
  205. package/dist/field/features/paragraph/feature.client.js.map +1 -1
  206. package/dist/field/features/relationship/drawer/commands.d.ts.map +1 -1
  207. package/dist/field/features/relationship/drawer/commands.js +1 -2
  208. package/dist/field/features/relationship/drawer/commands.js.map +1 -1
  209. package/dist/field/features/relationship/drawer/index.d.ts.map +1 -1
  210. package/dist/field/features/relationship/drawer/index.js +7 -13
  211. package/dist/field/features/relationship/drawer/index.js.map +1 -1
  212. package/dist/field/features/relationship/feature.server.d.ts.map +1 -1
  213. package/dist/field/features/relationship/feature.server.js +3 -2
  214. package/dist/field/features/relationship/feature.server.js.map +1 -1
  215. package/dist/field/features/relationship/nodes/RelationshipNode.d.ts +3 -8
  216. package/dist/field/features/relationship/nodes/RelationshipNode.d.ts.map +1 -1
  217. package/dist/field/features/relationship/nodes/RelationshipNode.js +8 -8
  218. package/dist/field/features/relationship/nodes/RelationshipNode.js.map +1 -1
  219. package/dist/field/features/relationship/nodes/components/RelationshipComponent.d.ts.map +1 -1
  220. package/dist/field/features/relationship/nodes/components/RelationshipComponent.js +3 -5
  221. package/dist/field/features/relationship/nodes/components/RelationshipComponent.js.map +1 -1
  222. package/dist/field/features/relationship/plugins/index.d.ts.map +1 -1
  223. package/dist/field/features/relationship/plugins/index.js +3 -6
  224. package/dist/field/features/relationship/plugins/index.js.map +1 -1
  225. package/dist/field/features/relationship/populationPromise.js +7 -6
  226. package/dist/field/features/relationship/populationPromise.js.map +1 -1
  227. package/dist/field/features/typeUtilities.d.ts +8 -0
  228. package/dist/field/features/typeUtilities.d.ts.map +1 -0
  229. package/dist/field/features/typeUtilities.js +8 -0
  230. package/dist/field/features/typeUtilities.js.map +1 -0
  231. package/dist/field/features/types.d.ts +52 -32
  232. package/dist/field/features/types.d.ts.map +1 -1
  233. package/dist/field/features/types.js.map +1 -1
  234. package/dist/field/features/upload/component/ExtraFieldsDrawer/index.d.ts.map +1 -1
  235. package/dist/field/features/upload/component/ExtraFieldsDrawer/index.js +5 -6
  236. package/dist/field/features/upload/component/ExtraFieldsDrawer/index.js.map +1 -1
  237. package/dist/field/features/upload/component/index.d.ts.map +1 -1
  238. package/dist/field/features/upload/component/index.js +55 -9
  239. package/dist/field/features/upload/component/index.js.map +1 -1
  240. package/dist/field/features/upload/drawer/commands.d.ts.map +1 -1
  241. package/dist/field/features/upload/drawer/commands.js +1 -2
  242. package/dist/field/features/upload/drawer/commands.js.map +1 -1
  243. package/dist/field/features/upload/drawer/index.d.ts.map +1 -1
  244. package/dist/field/features/upload/drawer/index.js +8 -12
  245. package/dist/field/features/upload/drawer/index.js.map +1 -1
  246. package/dist/field/features/upload/feature.server.d.ts.map +1 -1
  247. package/dist/field/features/upload/feature.server.js +25 -9
  248. package/dist/field/features/upload/feature.server.js.map +1 -1
  249. package/dist/field/features/upload/nodes/UploadNode.d.ts +2 -14
  250. package/dist/field/features/upload/nodes/UploadNode.d.ts.map +1 -1
  251. package/dist/field/features/upload/nodes/UploadNode.js +6 -9
  252. package/dist/field/features/upload/nodes/UploadNode.js.map +1 -1
  253. package/dist/field/features/upload/plugin/index.d.ts +2 -2
  254. package/dist/field/features/upload/plugin/index.d.ts.map +1 -1
  255. package/dist/field/features/upload/plugin/index.js +4 -9
  256. package/dist/field/features/upload/plugin/index.js.map +1 -1
  257. package/dist/field/features/upload/populationPromise.d.ts.map +1 -1
  258. package/dist/field/features/upload/populationPromise.js +22 -9
  259. package/dist/field/features/upload/populationPromise.js.map +1 -1
  260. package/dist/field/features/upload/validate.d.ts.map +1 -1
  261. package/dist/field/features/upload/validate.js +7 -7
  262. package/dist/field/features/upload/validate.js.map +1 -1
  263. package/dist/field/index.d.ts +1 -1
  264. package/dist/field/index.d.ts.map +1 -1
  265. package/dist/field/index.js.map +1 -1
  266. package/dist/field/lexical/LexicalEditor.d.ts.map +1 -1
  267. package/dist/field/lexical/LexicalEditor.js +5 -10
  268. package/dist/field/lexical/LexicalEditor.js.map +1 -1
  269. package/dist/field/lexical/LexicalProvider.d.ts +1 -1
  270. package/dist/field/lexical/LexicalProvider.d.ts.map +1 -1
  271. package/dist/field/lexical/LexicalProvider.js +1 -2
  272. package/dist/field/lexical/LexicalProvider.js.map +1 -1
  273. package/dist/field/lexical/config/client/default.d.ts +1 -1
  274. package/dist/field/lexical/config/client/default.d.ts.map +1 -1
  275. package/dist/field/lexical/config/client/default.js.map +1 -1
  276. package/dist/field/lexical/config/client/sanitize.d.ts +1 -1
  277. package/dist/field/lexical/config/client/sanitize.d.ts.map +1 -1
  278. package/dist/field/lexical/config/client/sanitize.js.map +1 -1
  279. package/dist/field/lexical/config/server/default.d.ts +1 -1
  280. package/dist/field/lexical/config/server/default.d.ts.map +1 -1
  281. package/dist/field/lexical/config/server/default.js +3 -1
  282. package/dist/field/lexical/config/server/default.js.map +1 -1
  283. package/dist/field/lexical/config/server/sanitize.d.ts.map +1 -1
  284. package/dist/field/lexical/config/server/sanitize.js +20 -6
  285. package/dist/field/lexical/config/server/sanitize.js.map +1 -1
  286. package/dist/field/lexical/config/types.d.ts +1 -1
  287. package/dist/field/lexical/config/types.d.ts.map +1 -1
  288. package/dist/field/lexical/config/types.js.map +1 -1
  289. package/dist/field/lexical/plugins/FloatingSelectToolbar/ToolbarButton/index.d.ts.map +1 -1
  290. package/dist/field/lexical/plugins/FloatingSelectToolbar/ToolbarButton/index.js +3 -6
  291. package/dist/field/lexical/plugins/FloatingSelectToolbar/ToolbarButton/index.js.map +1 -1
  292. package/dist/field/lexical/plugins/FloatingSelectToolbar/ToolbarDropdown/DropDown.d.ts.map +1 -1
  293. package/dist/field/lexical/plugins/FloatingSelectToolbar/ToolbarDropdown/DropDown.js +3 -6
  294. package/dist/field/lexical/plugins/FloatingSelectToolbar/ToolbarDropdown/DropDown.js.map +1 -1
  295. package/dist/field/lexical/plugins/FloatingSelectToolbar/index.d.ts.map +1 -1
  296. package/dist/field/lexical/plugins/FloatingSelectToolbar/index.js +3 -6
  297. package/dist/field/lexical/plugins/FloatingSelectToolbar/index.js.map +1 -1
  298. package/dist/field/lexical/plugins/MarkdownShortcut/index.d.ts.map +1 -1
  299. package/dist/field/lexical/plugins/MarkdownShortcut/index.js +1 -2
  300. package/dist/field/lexical/plugins/MarkdownShortcut/index.js.map +1 -1
  301. package/dist/field/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/LexicalMenu.d.ts.map +1 -1
  302. package/dist/field/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/LexicalMenu.js +3 -6
  303. package/dist/field/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/LexicalMenu.js.map +1 -1
  304. package/dist/field/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/index.d.ts.map +1 -1
  305. package/dist/field/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/index.js +3 -6
  306. package/dist/field/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/index.js.map +1 -1
  307. package/dist/field/lexical/plugins/SlashMenu/index.d.ts.map +1 -1
  308. package/dist/field/lexical/plugins/SlashMenu/index.js +1 -2
  309. package/dist/field/lexical/plugins/SlashMenu/index.js.map +1 -1
  310. package/dist/field/lexical/plugins/handles/AddBlockHandlePlugin/index.d.ts.map +1 -1
  311. package/dist/field/lexical/plugins/handles/AddBlockHandlePlugin/index.js +13 -10
  312. package/dist/field/lexical/plugins/handles/AddBlockHandlePlugin/index.js.map +1 -1
  313. package/dist/field/lexical/plugins/handles/DraggableBlockPlugin/getNodeCloseToPoint.d.ts.map +1 -1
  314. package/dist/field/lexical/plugins/handles/DraggableBlockPlugin/getNodeCloseToPoint.js +1 -2
  315. package/dist/field/lexical/plugins/handles/DraggableBlockPlugin/getNodeCloseToPoint.js.map +1 -1
  316. package/dist/field/lexical/plugins/handles/DraggableBlockPlugin/index.d.ts.map +1 -1
  317. package/dist/field/lexical/plugins/handles/DraggableBlockPlugin/index.js +10 -7
  318. package/dist/field/lexical/plugins/handles/DraggableBlockPlugin/index.js.map +1 -1
  319. package/dist/field/lexical/plugins/handles/utils/doesLineHeightAffectElement.d.ts +9 -0
  320. package/dist/field/lexical/plugins/handles/utils/doesLineHeightAffectElement.d.ts.map +1 -0
  321. package/dist/field/lexical/plugins/handles/utils/doesLineHeightAffectElement.js +35 -0
  322. package/dist/field/lexical/plugins/handles/utils/doesLineHeightAffectElement.js.map +1 -0
  323. package/dist/field/lexical/plugins/handles/utils/getTopLevelNodeKeys.d.ts.map +1 -1
  324. package/dist/field/lexical/plugins/handles/utils/getTopLevelNodeKeys.js +1 -2
  325. package/dist/field/lexical/plugins/handles/utils/getTopLevelNodeKeys.js.map +1 -1
  326. package/dist/field/lexical/plugins/handles/utils/setHandlePosition.d.ts +1 -1
  327. package/dist/field/lexical/plugins/handles/utils/setHandlePosition.d.ts.map +1 -1
  328. package/dist/field/lexical/plugins/handles/utils/setHandlePosition.js +17 -7
  329. package/dist/field/lexical/plugins/handles/utils/setHandlePosition.js.map +1 -1
  330. package/dist/field/lexical/theme/EditorTheme.scss +11 -8
  331. package/dist/field/lexical/ui/ContentEditable.d.ts.map +1 -1
  332. package/dist/field/lexical/ui/ContentEditable.js +1 -2
  333. package/dist/field/lexical/ui/ContentEditable.js.map +1 -1
  334. package/dist/field/lexical/ui/icons/HorizontalRule/index.d.ts +3 -0
  335. package/dist/field/lexical/ui/icons/HorizontalRule/index.d.ts.map +1 -0
  336. package/dist/field/lexical/ui/icons/HorizontalRule/index.js +19 -0
  337. package/dist/field/lexical/ui/icons/HorizontalRule/index.js.map +1 -0
  338. package/dist/field/lexical/utils/getSelectedNode.d.ts.map +1 -1
  339. package/dist/field/lexical/utils/getSelectedNode.js +1 -2
  340. package/dist/field/lexical/utils/getSelectedNode.js.map +1 -1
  341. package/dist/field/lexical/utils/nodeFormat.d.ts +2 -1
  342. package/dist/field/lexical/utils/nodeFormat.d.ts.map +1 -1
  343. package/dist/field/lexical/utils/nodeFormat.js.map +1 -1
  344. package/dist/field/lexical/utils/url.d.ts.map +1 -1
  345. package/dist/field/lexical/utils/url.js +1 -0
  346. package/dist/field/lexical/utils/url.js.map +1 -1
  347. package/dist/forEachNodeRecursively.d.ts +10 -0
  348. package/dist/forEachNodeRecursively.d.ts.map +1 -0
  349. package/dist/forEachNodeRecursively.js +24 -0
  350. package/dist/forEachNodeRecursively.js.map +1 -0
  351. package/dist/generateComponentMap.d.ts.map +1 -1
  352. package/dist/generateComponentMap.js +22 -19
  353. package/dist/generateComponentMap.js.map +1 -1
  354. package/dist/generateSchemaMap.js +10 -9
  355. package/dist/generateSchemaMap.js.map +1 -1
  356. package/dist/index.d.ts +3 -2
  357. package/dist/index.d.ts.map +1 -1
  358. package/dist/index.js +103 -23
  359. package/dist/index.js.map +1 -1
  360. package/dist/populate/defaultValue.d.ts.map +1 -1
  361. package/dist/populate/defaultValue.js +1 -0
  362. package/dist/populate/defaultValue.js.map +1 -1
  363. package/dist/populate/populate.d.ts +3 -3
  364. package/dist/populate/populate.d.ts.map +1 -1
  365. package/dist/populate/populate.js.map +1 -1
  366. package/dist/populate/populateLexicalPopulationPromises.d.ts +12 -0
  367. package/dist/populate/populateLexicalPopulationPromises.d.ts.map +1 -0
  368. package/dist/populate/populateLexicalPopulationPromises.js +35 -0
  369. package/dist/populate/populateLexicalPopulationPromises.js.map +1 -0
  370. package/dist/populate/recurseNestedFields.d.ts +7 -4
  371. package/dist/populate/recurseNestedFields.d.ts.map +1 -1
  372. package/dist/populate/recurseNestedFields.js +3 -5
  373. package/dist/populate/recurseNestedFields.js.map +1 -1
  374. package/dist/scss/app.scss +2 -3
  375. package/dist/scss/vars.scss +0 -7
  376. package/dist/types.d.ts +3 -4
  377. package/dist/types.d.ts.map +1 -1
  378. package/dist/types.js.map +1 -1
  379. package/dist/validate/index.d.ts +1 -1
  380. package/dist/validate/index.d.ts.map +1 -1
  381. package/package.json +47 -46
  382. package/components.d.ts +0 -6
  383. package/components.js +0 -7
  384. package/dist/populate/richTextRelationshipPromise.d.ts +0 -23
  385. package/dist/populate/richTextRelationshipPromise.d.ts.map +0 -1
  386. package/dist/populate/richTextRelationshipPromise.js +0 -68
  387. package/dist/populate/richTextRelationshipPromise.js.map +0 -1
  388. package/dist/scss/fonts.scss +0 -75
  389. package/src/index.ts +0 -423
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../../../../src/field/features/migrations/slateToLexical/converter/converters/upload/converter.ts"],"sourcesContent":["import type { SerializedUploadNode } from '../../../../../upload/nodes/UploadNode.js'\nimport type { SlateNodeConverter } from '../../types.js'\n\nexport const _SlateUploadConverter: SlateNodeConverter = {\n converter({ slateNode }) {\n return {\n type: 'upload',\n fields: {\n ...slateNode.fields,\n },\n format: '',\n relationTo: slateNode.relationTo,\n value: {\n id: slateNode.value?.id || '',\n },\n version: 1,\n } as const as SerializedUploadNode\n },\n nodeTypes: ['upload'],\n}\n"],"names":["_SlateUploadConverter","converter","slateNode","type","fields","format","relationTo","value","id","version","nodeTypes"],"rangeMappings":";;;;;;;;;;;;;;;;;;","mappings":"AAGA,OAAO,MAAMA,wBAA4C;IACvDC,WAAU,EAAEC,SAAS,EAAE;QACrB,OAAO;YACLC,MAAM;YACNC,QAAQ;gBACN,GAAGF,UAAUE,MAAM;YACrB;YACAC,QAAQ;YACRC,YAAYJ,UAAUI,UAAU;YAChCC,OAAO;gBACLC,IAAIN,UAAUK,KAAK,EAAEC,MAAM;YAC7B;YACAC,SAAS;QACX;IACF;IACAC,WAAW;QAAC;KAAS;AACvB,EAAC"}
1
+ {"version":3,"sources":["../../../../../../../../src/field/features/migrations/slateToLexical/converter/converters/upload/converter.ts"],"sourcesContent":["import type { SerializedUploadNode } from '../../../../../upload/nodes/UploadNode.js'\nimport type { SlateNodeConverter } from '../../types.js'\n\nexport const _SlateUploadConverter: SlateNodeConverter = {\n converter({ slateNode }) {\n return {\n type: 'upload',\n fields: {\n ...slateNode.fields,\n },\n format: '',\n relationTo: slateNode.relationTo,\n value: slateNode.value?.id || '',\n version: 2,\n } as const as SerializedUploadNode\n },\n nodeTypes: ['upload'],\n}\n"],"names":["_SlateUploadConverter","converter","slateNode","type","fields","format","relationTo","value","id","version","nodeTypes"],"rangeMappings":";;;;;;;;;;;;;;;;","mappings":"AAGA,OAAO,MAAMA,wBAA4C;IACvDC,WAAU,EAAEC,SAAS,EAAE;QACrB,OAAO;YACLC,MAAM;YACNC,QAAQ;gBACN,GAAGF,UAAUE,MAAM;YACrB;YACAC,QAAQ;YACRC,YAAYJ,UAAUI,UAAU;YAChCC,OAAOL,UAAUK,KAAK,EAAEC,MAAM;YAC9BC,SAAS;QACX;IACF;IACAC,WAAW;QAAC;KAAS;AACvB,EAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/field/features/migrations/slateToLexical/converter/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,qBAAqB,EACrB,qBAAqB,EACrB,uBAAuB,EACvB,kBAAkB,EACnB,MAAM,SAAS,CAAA;AAEhB,OAAO,KAAK,EAAE,SAAS,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAA;AAI/D,wBAAgB,qBAAqB,CAAC,EACpC,UAAU,EACV,SAAS,GACV,EAAE;IACD,UAAU,EAAE,kBAAkB,EAAE,CAAA;IAChC,SAAS,EAAE,SAAS,EAAE,CAAA;CACvB,GAAG,qBAAqB,CAgBxB;AAED,wBAAgB,0BAA0B,CAAC,EACzC,oBAAoB,EACpB,UAAU,EACV,cAAc,EACd,UAAU,GACX,EAAE;IACD,oBAAoB,EAAE,OAAO,CAAA;IAC7B,UAAU,EAAE,kBAAkB,EAAE,GAAG,SAAS,CAAA;IAC5C;;OAEG;IACH,cAAc,EAAE,MAAM,CAAA;IACtB,UAAU,EAAE,SAAS,EAAE,CAAA;CACxB,GAAG,qBAAqB,EAAE,CAmC1B;AAED,wBAAgB,oBAAoB,CAClC,UAAU,EAAE,kBAAkB,EAAE,EAChC,IAAI,EAAE,SAAS,GACd,uBAAuB,CAczB;AACD,wBAAgB,eAAe,CAAC,IAAI,EAAE,SAAS,GAAG,kBAAkB,CAUnE;AAED,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,SAAS,GAAG,MAAM,CAwB3D"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/field/features/migrations/slateToLexical/converter/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,qBAAqB,EACrB,qBAAqB,EACrB,uBAAuB,EACvB,kBAAkB,EACnB,MAAM,SAAS,CAAA;AAEhB,OAAO,KAAK,EAAE,SAAS,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAA;AAI/D,wBAAgB,qBAAqB,CAAC,EACpC,UAAU,EACV,SAAS,GACV,EAAE;IACD,UAAU,EAAE,kBAAkB,EAAE,CAAA;IAChC,SAAS,EAAE,SAAS,EAAE,CAAA;CACvB,GAAG,qBAAqB,CAgBxB;AAED,wBAAgB,0BAA0B,CAAC,EACzC,oBAAoB,EACpB,UAAU,EACV,cAAc,EACd,UAAU,GACX,EAAE;IACD,oBAAoB,EAAE,OAAO,CAAA;IAC7B,UAAU,EAAE,kBAAkB,EAAE,GAAG,SAAS,CAAA;IAC5C;;OAEG;IACH,cAAc,EAAE,MAAM,CAAA;IACtB,UAAU,EAAE,SAAS,EAAE,CAAA;CACxB,GAAG,qBAAqB,EAAE,CAmC1B;AAED,wBAAgB,oBAAoB,CAClC,UAAU,EAAE,kBAAkB,EAAE,EAChC,IAAI,EAAE,SAAS,GACd,uBAAuB,CAezB;AACD,wBAAgB,eAAe,CAAC,IAAI,EAAE,SAAS,GAAG,kBAAkB,CAUnE;AAED,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,SAAS,GAAG,MAAM,CAwB3D"}
@@ -27,7 +27,7 @@ export function convertSlateNodesToLexical({ canContainParagraphs, converters, p
27
27
  // This is a paragraph node. They do not have a type property in Slate
28
28
  return convertParagraphNode(converters, slateNode);
29
29
  } else {
30
- // This is a simple text node. canContainParagraphs may be false if this is nested inside of a paragraph already, since paragraphs cannot contain paragraphs
30
+ // This is a simple text node. canContainParagraphs may be false if this is nested inside a paragraph already, since paragraphs cannot contain paragraphs
31
31
  return convertTextNode(slateNode);
32
32
  }
33
33
  }
@@ -64,6 +64,7 @@ export function convertParagraphNode(converters, node) {
64
64
  direction: 'ltr',
65
65
  format: '',
66
66
  indent: 0,
67
+ textFormat: 0,
67
68
  version: 1
68
69
  };
69
70
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../../src/field/features/migrations/slateToLexical/converter/index.ts"],"sourcesContent":["import type {\n SerializedEditorState,\n SerializedLexicalNode,\n SerializedParagraphNode,\n SerializedTextNode,\n} from 'lexical'\n\nimport type { SlateNode, SlateNodeConverter } from './types.js'\n\nimport { NodeFormat } from '../../../../lexical/utils/nodeFormat.js'\n\nexport function convertSlateToLexical({\n converters,\n slateData,\n}: {\n converters: SlateNodeConverter[]\n slateData: SlateNode[]\n}): SerializedEditorState {\n return {\n root: {\n type: 'root',\n children: convertSlateNodesToLexical({\n canContainParagraphs: true,\n converters,\n parentNodeType: 'root',\n slateNodes: slateData,\n }),\n direction: 'ltr',\n format: '',\n indent: 0,\n version: 1,\n },\n }\n}\n\nexport function convertSlateNodesToLexical({\n canContainParagraphs,\n converters,\n parentNodeType,\n slateNodes,\n}: {\n canContainParagraphs: boolean\n converters: SlateNodeConverter[] | undefined\n /**\n * Type of the parent lexical node (not the type of the original, parent slate type)\n */\n parentNodeType: string\n slateNodes: SlateNode[]\n}): SerializedLexicalNode[] {\n if (!converters?.length) {\n return []\n }\n const unknownConverter = converters.find((converter) => converter.nodeTypes.includes('unknown'))\n return (\n slateNodes.map((slateNode, i) => {\n if (!('type' in slateNode)) {\n if (canContainParagraphs) {\n // This is a paragraph node. They do not have a type property in Slate\n return convertParagraphNode(converters, slateNode)\n } else {\n // This is a simple text node. canContainParagraphs may be false if this is nested inside of a paragraph already, since paragraphs cannot contain paragraphs\n return convertTextNode(slateNode)\n }\n }\n if (slateNode.type === 'p') {\n return convertParagraphNode(converters, slateNode)\n }\n\n const converter = converters.find((converter) => converter.nodeTypes.includes(slateNode.type))\n\n if (converter) {\n return converter.converter({ childIndex: i, converters, parentNodeType, slateNode })\n }\n\n console.warn('slateToLexical > No converter found for node type: ' + slateNode.type)\n return unknownConverter?.converter({\n childIndex: i,\n converters,\n parentNodeType,\n slateNode,\n })\n }) || []\n )\n}\n\nexport function convertParagraphNode(\n converters: SlateNodeConverter[],\n node: SlateNode,\n): SerializedParagraphNode {\n return {\n type: 'paragraph',\n children: convertSlateNodesToLexical({\n canContainParagraphs: false,\n converters,\n parentNodeType: 'paragraph',\n slateNodes: node.children || [],\n }),\n direction: 'ltr',\n format: '',\n indent: 0,\n version: 1,\n }\n}\nexport function convertTextNode(node: SlateNode): SerializedTextNode {\n return {\n type: 'text',\n detail: 0,\n format: convertNodeToFormat(node),\n mode: 'normal',\n style: '',\n text: node.text,\n version: 1,\n }\n}\n\nexport function convertNodeToFormat(node: SlateNode): number {\n let format = 0\n if (node.bold) {\n format = format | NodeFormat.IS_BOLD\n }\n if (node.italic) {\n format = format | NodeFormat.IS_ITALIC\n }\n if (node.strikethrough) {\n format = format | NodeFormat.IS_STRIKETHROUGH\n }\n if (node.underline) {\n format = format | NodeFormat.IS_UNDERLINE\n }\n if (node.subscript) {\n format = format | NodeFormat.IS_SUBSCRIPT\n }\n if (node.superscript) {\n format = format | NodeFormat.IS_SUPERSCRIPT\n }\n if (node.code) {\n format = format | NodeFormat.IS_CODE\n }\n return format\n}\n"],"names":["NodeFormat","convertSlateToLexical","converters","slateData","root","type","children","convertSlateNodesToLexical","canContainParagraphs","parentNodeType","slateNodes","direction","format","indent","version","length","unknownConverter","find","converter","nodeTypes","includes","map","slateNode","i","convertParagraphNode","convertTextNode","childIndex","console","warn","node","detail","convertNodeToFormat","mode","style","text","bold","IS_BOLD","italic","IS_ITALIC","strikethrough","IS_STRIKETHROUGH","underline","IS_UNDERLINE","subscript","IS_SUBSCRIPT","superscript","IS_SUPERSCRIPT","code","IS_CODE"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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Z;AAEA,OAAO,SAASE,qBACdtB,UAAgC,EAChC2B,IAAe;IAEf,OAAO;QACLxB,MAAM;QACNC,UAAUC,2BAA2B;YACnCC,sBAAsB;YACtBN;YACAO,gBAAgB;YAChBC,YAAYmB,KAAKvB,QAAQ,IAAI,EAAE;QACjC;QACAK,WAAW;QACXC,QAAQ;QACRC,QAAQ;QACRC,SAAS;IACX;AACF;AACA,OAAO,SAASW,gBAAgBI,IAAe;IAC7C,OAAO;QACLxB,MAAM;QACNyB,QAAQ;QACRlB,QAAQmB,oBAAoBF;QAC5BG,MAAM;QACNC,OAAO;QACPC,MAAML,KAAKK,IAAI;QACfpB,SAAS;IACX;AACF;AAEA,OAAO,SAASiB,oBAAoBF,IAAe;IACjD,IAAIjB,SAAS;IACb,IAAIiB,KAAKM,IAAI,EAAE;QACbvB,SAASA,SAASZ,WAAWoC,OAAO;IACtC;IACA,IAAIP,KAAKQ,MAAM,EAAE;QACfzB,SAASA,SAASZ,WAAWsC,SAAS;IACxC;IACA,IAAIT,KAAKU,aAAa,EAAE;QACtB3B,SAASA,SAASZ,WAAWwC,gBAAgB;IAC/C;IACA,IAAIX,KAAKY,SAAS,EAAE;QAClB7B,SAASA,SAASZ,WAAW0C,YAAY;IAC3C;IACA,IAAIb,KAAKc,SAAS,EAAE;QAClB/B,SAASA,SAASZ,WAAW4C,YAAY;IAC3C;IACA,IAAIf,KAAKgB,WAAW,EAAE;QACpBjC,SAASA,SAASZ,WAAW8C,cAAc;IAC7C;IACA,IAAIjB,KAAKkB,IAAI,EAAE;QACbnC,SAASA,SAASZ,WAAWgD,OAAO;IACtC;IACA,OAAOpC;AACT"}
1
+ {"version":3,"sources":["../../../../../../src/field/features/migrations/slateToLexical/converter/index.ts"],"sourcesContent":["import type {\n SerializedEditorState,\n SerializedLexicalNode,\n SerializedParagraphNode,\n SerializedTextNode,\n} from 'lexical'\n\nimport type { SlateNode, SlateNodeConverter } from './types.js'\n\nimport { NodeFormat } from '../../../../lexical/utils/nodeFormat.js'\n\nexport function convertSlateToLexical({\n converters,\n slateData,\n}: {\n converters: SlateNodeConverter[]\n slateData: SlateNode[]\n}): SerializedEditorState {\n return {\n root: {\n type: 'root',\n children: convertSlateNodesToLexical({\n canContainParagraphs: true,\n converters,\n parentNodeType: 'root',\n slateNodes: slateData,\n }),\n direction: 'ltr',\n format: '',\n indent: 0,\n version: 1,\n },\n }\n}\n\nexport function convertSlateNodesToLexical({\n canContainParagraphs,\n converters,\n parentNodeType,\n slateNodes,\n}: {\n canContainParagraphs: boolean\n converters: SlateNodeConverter[] | undefined\n /**\n * Type of the parent lexical node (not the type of the original, parent slate type)\n */\n parentNodeType: string\n slateNodes: SlateNode[]\n}): SerializedLexicalNode[] {\n if (!converters?.length) {\n return []\n }\n const unknownConverter = converters.find((converter) => converter.nodeTypes.includes('unknown'))\n return (\n slateNodes.map((slateNode, i) => {\n if (!('type' in slateNode)) {\n if (canContainParagraphs) {\n // This is a paragraph node. They do not have a type property in Slate\n return convertParagraphNode(converters, slateNode)\n } else {\n // This is a simple text node. canContainParagraphs may be false if this is nested inside a paragraph already, since paragraphs cannot contain paragraphs\n return convertTextNode(slateNode)\n }\n }\n if (slateNode.type === 'p') {\n return convertParagraphNode(converters, slateNode)\n }\n\n const converter = converters.find((converter) => converter.nodeTypes.includes(slateNode.type))\n\n if (converter) {\n return converter.converter({ childIndex: i, converters, parentNodeType, slateNode })\n }\n\n console.warn('slateToLexical > No converter found for node type: ' + slateNode.type)\n return unknownConverter?.converter({\n childIndex: i,\n converters,\n parentNodeType,\n slateNode,\n })\n }) || []\n )\n}\n\nexport function convertParagraphNode(\n converters: SlateNodeConverter[],\n node: SlateNode,\n): SerializedParagraphNode {\n return {\n type: 'paragraph',\n children: convertSlateNodesToLexical({\n canContainParagraphs: false,\n converters,\n parentNodeType: 'paragraph',\n slateNodes: node.children || [],\n }),\n direction: 'ltr',\n format: '',\n indent: 0,\n textFormat: 0,\n version: 1,\n }\n}\nexport function convertTextNode(node: SlateNode): SerializedTextNode {\n return {\n type: 'text',\n detail: 0,\n format: convertNodeToFormat(node),\n mode: 'normal',\n style: '',\n text: node.text,\n version: 1,\n }\n}\n\nexport function convertNodeToFormat(node: SlateNode): number {\n let format = 0\n if (node.bold) {\n format = format | NodeFormat.IS_BOLD\n }\n if (node.italic) {\n format = format | NodeFormat.IS_ITALIC\n }\n if (node.strikethrough) {\n format = format | NodeFormat.IS_STRIKETHROUGH\n }\n if (node.underline) {\n format = format | NodeFormat.IS_UNDERLINE\n }\n if (node.subscript) {\n format = format | NodeFormat.IS_SUBSCRIPT\n }\n if (node.superscript) {\n format = format | NodeFormat.IS_SUPERSCRIPT\n }\n if (node.code) {\n format = format | NodeFormat.IS_CODE\n }\n return format\n}\n"],"names":["NodeFormat","convertSlateToLexical","converters","slateData","root","type","children","convertSlateNodesToLexical","canContainParagraphs","parentNodeType","slateNodes","direction","format","indent","version","length","unknownConverter","find","converter","nodeTypes","includes","map","slateNode","i","convertParagraphNode","convertTextNode","childIndex","console","warn","node","textFormat","detail","convertNodeToFormat","mode","style","text","bold","IS_BOLD","italic","IS_ITALIC","strikethrough","IS_STRIKETHROUGH","underline","IS_UNDERLINE","subscript","IS_SUBSCRIPT","superscript","IS_SUPERSCRIPT","code","IS_CODE"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AASA,SAASA,UAAU,QAAQ,0CAAyC;AAEpE,OAAO,SAASC,sBAAsB,EACpCC,UAAU,EACVC,SAAS,EAIV;IACC,OAAO;QACLC,MAAM;YACJC,MAAM;YACNC,UAAUC,2BAA2B;gBACnCC,sBAAsB;gBACtBN;gBACAO,gBAAgB;gBAChBC,YAAYP;YACd;YACAQ,WAAW;YACXC,QAAQ;YACRC,QAAQ;YACRC,SAAS;QACX;IACF;AACF;AAEA,OAAO,SAASP,2BAA2B,EACzCC,o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QACPC,MAAMN,KAAKM,IAAI;QACfrB,SAAS;IACX;AACF;AAEA,OAAO,SAASkB,oBAAoBH,IAAe;IACjD,IAAIjB,SAAS;IACb,IAAIiB,KAAKO,IAAI,EAAE;QACbxB,SAASA,SAASZ,WAAWqC,OAAO;IACtC;IACA,IAAIR,KAAKS,MAAM,EAAE;QACf1B,SAASA,SAASZ,WAAWuC,SAAS;IACxC;IACA,IAAIV,KAAKW,aAAa,EAAE;QACtB5B,SAASA,SAASZ,WAAWyC,gBAAgB;IAC/C;IACA,IAAIZ,KAAKa,SAAS,EAAE;QAClB9B,SAASA,SAASZ,WAAW2C,YAAY;IAC3C;IACA,IAAId,KAAKe,SAAS,EAAE;QAClBhC,SAASA,SAASZ,WAAW6C,YAAY;IAC3C;IACA,IAAIhB,KAAKiB,WAAW,EAAE;QACpBlC,SAASA,SAASZ,WAAW+C,cAAc;IAC7C;IACA,IAAIlB,KAAKmB,IAAI,EAAE;QACbpC,SAASA,SAASZ,WAAWiD,OAAO;IACtC;IACA,OAAOrC;AACT"}
@@ -1,8 +1,7 @@
1
1
  /// <reference types="react" resolution-mode="require"/>
2
2
  import type { SerializedLexicalNode, Spread } from 'lexical';
3
- import lexicalImport from 'lexical';
4
- declare const DecoratorNode: typeof lexicalImport.DecoratorNode;
5
3
  import type { EditorConfig, LexicalNode, NodeKey } from 'lexical';
4
+ import { DecoratorNode } from 'lexical';
6
5
  export type UnknownConvertedNodeData = {
7
6
  nodeData: unknown;
8
7
  nodeType: string;
@@ -32,5 +31,4 @@ export declare function $createUnknownConvertedNode({ data, }: {
32
31
  data: UnknownConvertedNodeData;
33
32
  }): UnknownConvertedNode;
34
33
  export declare function $isUnknownConvertedNode(node: LexicalNode | null | undefined): node is UnknownConvertedNode;
35
- export {};
36
34
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../../src/field/features/migrations/slateToLexical/nodes/unknownConvertedNode/index.tsx"],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C/B,GAAG,oBAAoB,CAIvB;AAED,wBAAgB,uBAAuB,CACrC,IAAI,EAAE,WAAW,GAAG,IAAI,GAAG,SAAS,GACnC,IAAI,IAAI,oBAAoB,CAE9B"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../../src/field/features/migrations/slateToLexical/nodes/unknownConvertedNode/index.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,EAAE,MAAM,SAAS,CAAA;AAC5D,OAAO,KAAK,EAAE,YAAY,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,SAAS,CAAA;AAGjE,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAA;AAGvC,MAAM,MAAM,wBAAwB,GAAG;IACrC,QAAQ,EAAE,OAAO,CAAA;IACjB,QAAQ,EAAE,MAAM,CAAA;CACjB,CAAA;AAED,MAAM,MAAM,8BAA8B,GAAG,MAAM,CACjD;IACE,IAAI,EAAE,wBAAwB,CAAA;CAC/B,EACD,qBAAqB,CACtB,CAAA;AAQD,oBAAoB;AACpB,qBAAa,oBAAqB,SAAQ,aAAa,CAAC,GAAG,CAAC,OAAO,CAAC;IAClE,MAAM,EAAE,wBAAwB,CAAA;gBAEpB,EAAE,IAAI,EAAE,GAAG,EAAE,EAAE;QAAE,IAAI,EAAE,wBAAwB,CAAC;QAAC,GAAG,CAAC,EAAE,OAAO,CAAA;KAAE;IAK5E,MAAM,CAAC,KAAK,CAAC,IAAI,EAAE,oBAAoB,GAAG,oBAAoB;IAO9D,MAAM,CAAC,OAAO,IAAI,MAAM;IAIxB,MAAM,CAAC,UAAU,CAAC,cAAc,EAAE,8BAA8B,GAAG,oBAAoB;IAKvF,kBAAkB,IAAI,IAAI;IAI1B,mBAAmB,IAAI,IAAI;IAI3B,SAAS,CAAC,MAAM,EAAE,YAAY,GAAG,WAAW;IAM5C,QAAQ,IAAI,GAAG,CAAC,OAAO,GAAG,IAAI;IAI9B,UAAU,IAAI,8BAA8B;IAU5C,QAAQ,IAAI,OAAO;IAInB,SAAS,CAAC,QAAQ,EAAE,oBAAoB,EAAE,GAAG,EAAE,WAAW,GAAG,OAAO;CAGrE;AAED,wBAAgB,2BAA2B,CAAC,EAC1C,IAAI,GACL,EAAE;IACD,IAAI,EAAE,wBAAwB,CAAA;CAC/B,GAAG,oBAAoB,CAIvB;AAED,wBAAgB,uBAAuB,CACrC,IAAI,EAAE,WAAW,GAAG,IAAI,GAAG,SAAS,GACnC,IAAI,IAAI,oBAAoB,CAE9B"}
@@ -1,7 +1,5 @@
1
- import lexicalUtilsImport from '@lexical/utils';
2
- const { addClassNamesToElement } = lexicalUtilsImport;
3
- import lexicalImport from 'lexical';
4
- const { DecoratorNode } = lexicalImport;
1
+ import { addClassNamesToElement } from '@lexical/utils';
2
+ import { DecoratorNode } from 'lexical';
5
3
  import * as React from 'react';
6
4
  const Component = /*#__PURE__*/ React.lazy(()=>import('./Component.js').then((module)=>({
7
5
  default: module.UnknownConvertedNodeComponent
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../../../src/field/features/migrations/slateToLexical/nodes/unknownConvertedNode/index.tsx"],"sourcesContent":["import type { SerializedLexicalNode, Spread } from 'lexical'\n\nimport lexicalUtilsImport from '@lexical/utils'\nconst { addClassNamesToElement } = lexicalUtilsImport\nimport lexicalImport from 'lexical'\nconst { DecoratorNode } = lexicalImport\n\nimport type { EditorConfig, LexicalNode, NodeKey } from 'lexical'\n\nimport * as React from 'react'\n\nexport type UnknownConvertedNodeData = {\n nodeData: unknown\n nodeType: string\n}\n\nexport type SerializedUnknownConvertedNode = Spread<\n {\n data: UnknownConvertedNodeData\n },\n SerializedLexicalNode\n>\n\nconst Component = React.lazy(() =>\n import('./Component.js').then((module) => ({\n default: module.UnknownConvertedNodeComponent,\n })),\n)\n\n/** @noInheritDoc */\nexport class UnknownConvertedNode extends DecoratorNode<JSX.Element> {\n __data: UnknownConvertedNodeData\n\n constructor({ data, key }: { data: UnknownConvertedNodeData; key?: NodeKey }) {\n super(key)\n this.__data = data\n }\n\n static clone(node: UnknownConvertedNode): UnknownConvertedNode {\n return new UnknownConvertedNode({\n data: node.__data,\n key: node.__key,\n })\n }\n\n static getType(): string {\n return 'unknownConverted'\n }\n\n static importJSON(serializedNode: SerializedUnknownConvertedNode): UnknownConvertedNode {\n const node = $createUnknownConvertedNode({ data: serializedNode.data })\n return node\n }\n\n canInsertTextAfter(): true {\n return true\n }\n\n canInsertTextBefore(): true {\n return true\n }\n\n createDOM(config: EditorConfig): HTMLElement {\n const element = document.createElement('span')\n addClassNamesToElement(element, 'unknownConverted')\n return element\n }\n\n decorate(): JSX.Element | null {\n return <Component data={this.__data} />\n }\n\n exportJSON(): SerializedUnknownConvertedNode {\n return {\n type: this.getType(),\n data: this.__data,\n version: 1,\n }\n }\n\n // Mutation\n\n isInline(): boolean {\n return true\n }\n\n updateDOM(prevNode: UnknownConvertedNode, dom: HTMLElement): boolean {\n return false\n }\n}\n\nexport function $createUnknownConvertedNode({\n data,\n}: {\n data: UnknownConvertedNodeData\n}): UnknownConvertedNode {\n return new UnknownConvertedNode({\n data,\n })\n}\n\nexport function $isUnknownConvertedNode(\n node: LexicalNode | null | undefined,\n): node is UnknownConvertedNode {\n return node instanceof UnknownConvertedNode\n}\n"],"names":["lexicalUtilsImport","addClassNamesToElement","lexicalImport","DecoratorNode","React","Component","lazy","then","module","default","UnknownConvertedNodeComponent","UnknownConvertedNode","__data","constructor","data","key","clone","node","__key","getType","importJSON","serializedNode","$createUnknownConvertedNode","canInsertTextAfter","canInsertTextBefore","createDOM","config","element","document","createElement","decorate","exportJSON","type","version","isInline","updateDOM","prevNode","dom","$isUnknownConvertedNode"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAEA,OAAOA,wBAAwB,iBAAgB;AAC/C,MAAM,EAAEC,sBAAsB,EAAE,GAAGD;AACnC,OAAOE,mBAAmB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AEA,OAAO,SAASwB,wBACdrB,IAAoC;IAEpC,OAAOA,gBAAgBN;AACzB"}
1
+ {"version":3,"sources":["../../../../../../../src/field/features/migrations/slateToLexical/nodes/unknownConvertedNode/index.tsx"],"sourcesContent":["import type { SerializedLexicalNode, Spread } from 'lexical'\nimport type { EditorConfig, LexicalNode, NodeKey } from 'lexical'\n\nimport { addClassNamesToElement } from '@lexical/utils'\nimport { DecoratorNode } from 'lexical'\nimport * as React from 'react'\n\nexport type UnknownConvertedNodeData = {\n nodeData: unknown\n nodeType: string\n}\n\nexport type SerializedUnknownConvertedNode = Spread<\n {\n data: UnknownConvertedNodeData\n },\n SerializedLexicalNode\n>\n\nconst Component = React.lazy(() =>\n import('./Component.js').then((module) => ({\n default: module.UnknownConvertedNodeComponent,\n })),\n)\n\n/** @noInheritDoc */\nexport class UnknownConvertedNode extends DecoratorNode<JSX.Element> {\n __data: UnknownConvertedNodeData\n\n constructor({ data, key }: { data: UnknownConvertedNodeData; key?: NodeKey }) {\n super(key)\n this.__data = data\n }\n\n static clone(node: UnknownConvertedNode): UnknownConvertedNode {\n return new UnknownConvertedNode({\n data: node.__data,\n key: node.__key,\n })\n }\n\n static getType(): string {\n return 'unknownConverted'\n }\n\n static importJSON(serializedNode: SerializedUnknownConvertedNode): UnknownConvertedNode {\n const node = $createUnknownConvertedNode({ data: serializedNode.data })\n return node\n }\n\n canInsertTextAfter(): true {\n return true\n }\n\n canInsertTextBefore(): true {\n return true\n }\n\n createDOM(config: EditorConfig): HTMLElement {\n const element = document.createElement('span')\n addClassNamesToElement(element, 'unknownConverted')\n return element\n }\n\n decorate(): JSX.Element | null {\n return <Component data={this.__data} />\n }\n\n exportJSON(): SerializedUnknownConvertedNode {\n return {\n type: this.getType(),\n data: this.__data,\n version: 1,\n }\n }\n\n // Mutation\n\n isInline(): boolean {\n return true\n }\n\n updateDOM(prevNode: UnknownConvertedNode, dom: HTMLElement): boolean {\n return false\n }\n}\n\nexport function $createUnknownConvertedNode({\n data,\n}: {\n data: UnknownConvertedNodeData\n}): UnknownConvertedNode {\n return new UnknownConvertedNode({\n data,\n })\n}\n\nexport function $isUnknownConvertedNode(\n node: LexicalNode | null | undefined,\n): node is UnknownConvertedNode {\n return node instanceof UnknownConvertedNode\n}\n"],"names":["addClassNamesToElement","DecoratorNode","React","Component","lazy","then","module","default","UnknownConvertedNodeComponent","UnknownConvertedNode","__data","constructor","data","key","clone","node","__key","getType","importJSON","serializedNode","$createUnknownConvertedNode","canInsertTextAfter","canInsertTextBefore","createDOM","config","element","document","createElement","decorate","exportJSON","type","version","isInline","updateDOM","prevNode","dom","$isUnknownConvertedNode"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAGA,SAASA,sBAAsB,QAAQ,iBAAgB;AACvD,SAASC,aAAa,QAAQ,UAAS;AACvC,YAAYC,WAAW,QAAO;AAc9B,MAAMC,0BAAYD,MAAME,IAAI,CAAC,IAC3B,MAAM,CAAC,kBAAkBC,IAAI,CAAC,CAACC,SAAY,CAAA;YACzCC,SAASD,OAAOE,6BAA6B;QAC/C,CAAA;AAGF,kBAAkB,GAClB,OAAO,MAAMC,6BAA6BR;IACxCS,OAAgC;IAEhCC,YAAY,EAAEC,IAAI,EAAEC,GAAG,EAAqD,CAAE;QAC5E,KAAK,CAACA;QACN,IAAI,CAACH,MAAM,GAAGE;IAChB;IAEA,OAAOE,MAAMC,IAA0B,EAAwB;QAC7D,OAAO,IAAIN,qBAAqB;YAC9BG,MAAMG,KAAKL,MAAM;YACjBG,KAAKE,KAAKC,KAAK;QACjB;IACF;IAEA,OAAOC,UAAkB;QACvB,OAAO;IACT;IAEA,OAAOC,WAAWC,cAA8C,EAAwB;QACtF,MAAMJ,OAAOK,4BAA4B;YAAER,MAAMO,eAAeP,IAAI;QAAC;QACrE,OAAOG;IACT;IAEAM,qBAA2B;QACzB,OAAO;IACT;IAEAC,sBAA4B;QAC1B,OAAO;IACT;IAEAC,UAAUC,MAAoB,EAAe;QAC3C,MAAMC,UAAUC,SAASC,aAAa,CAAC;QACvC3B,uBAAuByB,SAAS;QAChC,OAAOA;IACT;IAEAG,WAA+B;QAC7B,qBAAO,oBAACzB;YAAUS,MAAM,IAAI,CAACF,MAAM;;IACrC;IAEAmB,aAA6C;QAC3C,OAAO;YACLC,MAAM,IAAI,CAACb,OAAO;YAClBL,MAAM,IAAI,CAACF,MAAM;YACjBqB,SAAS;QACX;IACF;IAEA,WAAW;IAEXC,WAAoB;QAClB,OAAO;IACT;IAEAC,UAAUC,QAA8B,EAAEC,GAAgB,EAAW;QACnE,OAAO;IACT;AACF;AAEA,OAAO,SAASf,4BAA4B,EAC1CR,IAAI,EAGL;IACC,OAAO,IAAIH,qBAAqB;QAC9BG;IACF;AACF;AAEA,OAAO,SAASwB,wBACdrB,IAAoC;IAEpC,OAAOA,gBAAgBN;AACzB"}
@@ -1 +1 @@
1
- {"version":3,"file":"feature.client.d.ts","sourceRoot":"","sources":["../../../../src/field/features/paragraph/feature.client.tsx"],"names":[],"mappings":";AAgEA,eAAO,MAAM,+BAA+B,+BAAgD,CAAA"}
1
+ {"version":3,"file":"feature.client.d.ts","sourceRoot":"","sources":["../../../../src/field/features/paragraph/feature.client.tsx"],"names":[],"mappings":";AA6DA,eAAO,MAAM,+BAA+B,+BAAgD,CAAA"}
@@ -1,8 +1,6 @@
1
1
  'use client';
2
- import lexicalSelectionImport from '@lexical/selection';
3
- const { $setBlocksType } = lexicalSelectionImport;
4
- import lexicalImport from 'lexical';
5
- const { $createParagraphNode, $getSelection } = lexicalImport;
2
+ import { $setBlocksType } from '@lexical/selection';
3
+ import { $createParagraphNode, $getSelection } from 'lexical';
6
4
  import { SlashMenuOption } from '../../lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/types.js';
7
5
  import { TextIcon } from '../../lexical/ui/icons/Text/index.js';
8
6
  import { TextDropdownSectionWithEntries } from '../common/floatingSelectToolbarTextDropdownSection/index.js';
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/field/features/paragraph/feature.client.tsx"],"sourcesContent":["'use client'\n\nimport lexicalSelectionImport from '@lexical/selection'\nconst { $setBlocksType } = lexicalSelectionImport\n\nimport lexicalImport from 'lexical'\nconst { $createParagraphNode, $getSelection } = lexicalImport\n\nimport type { FeatureProviderProviderClient } from '../types.js'\n\nimport { SlashMenuOption } from '../../lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/types.js'\nimport { TextIcon } from '../../lexical/ui/icons/Text/index.js'\nimport { TextDropdownSectionWithEntries } from '../common/floatingSelectToolbarTextDropdownSection/index.js'\nimport { createClientComponent } from '../createClientComponent.js'\n\nconst ParagraphFeatureClient: FeatureProviderProviderClient<undefined> = (props) => {\n return {\n clientFeatureProps: props,\n feature: () => ({\n clientFeatureProps: props,\n floatingSelectToolbar: {\n sections: [\n TextDropdownSectionWithEntries([\n {\n ChildComponent: TextIcon,\n isActive: () => false,\n key: 'normal-text',\n label: 'Normal Text',\n onClick: ({ editor }) => {\n editor.update(() => {\n const selection = $getSelection()\n $setBlocksType(selection, () => $createParagraphNode())\n })\n },\n order: 1,\n },\n ]),\n ],\n },\n slashMenu: {\n options: [\n {\n displayName: 'Basic',\n key: 'basic',\n options: [\n new SlashMenuOption('paragraph', {\n Icon: TextIcon,\n displayName: 'Paragraph',\n keywords: ['normal', 'paragraph', 'p', 'text'],\n onSelect: ({ editor }) => {\n editor.update(() => {\n const selection = $getSelection()\n $setBlocksType(selection, () => $createParagraphNode())\n })\n },\n }),\n ],\n },\n ],\n },\n }),\n }\n}\n\nexport const ParagraphFeatureClientComponent = createClientComponent(ParagraphFeatureClient)\n"],"names":["lexicalSelectionImport","$setBlocksType","lexicalImport","$createParagraphNode","$getSelection","SlashMenuOption","TextIcon","TextDropdownSectionWithEntries","createClientComponent","ParagraphFeatureClient","props","clientFeatureProps","feature","floatingSelectToolbar","sections","ChildComponent","isActive","key","label","onClick","editor","update","selection","order","slashMenu","options","displayName","Icon","keywords","onSelect","ParagraphFeatureClientComponent"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA;AAEA,OAAOA,4BAA4B,qBAAoB;AACvD,MAAM,EAAEC,cAAc,EAAE,GAAGD;AAE3B,OAAOE,mBAAmB,UAAS;AACnC,MAAM,EAAEC,oBAAoB,EAAEC,aAAa,EAAE,GAAGF;AAIhD,SAASG,eAAe,QAAQ,sEAAqE;AACrG,SAASC,QAAQ,QAAQ,uCAAsC;AAC/D,SAASC,8BAA8B,QAAQ,8DAA6D;AAC5G,SAASC,qBAAqB,QAAQ,8BAA6B;AAEnE,MAAMC,yBAAmE,CAACC;IACxE,OAAO;QACLC,oBAAoBD;QACpBE,SAAS,IAAO,CAAA;gBACdD,oBAAoBD;gBACpBG,uBAAuB;oBACrBC,UAAU;wBACRP,+BAA+B;4BAC7B;gCACEQ,gBAAgBT;gCAChBU,UAAU,IAAM;gCAChBC,KAAK;gCACLC,OAAO;gCACPC,SAAS,CAAC,EAAEC,MAAM,EAAE;oCAClBA,OAAOC,MAAM,CAAC;wCACZ,MAAMC,YAAYlB;wCAClBH,eAAeqB,WAAW,IAAMnB;oCAClC;gCACF;gCACAoB,OAAO;4BACT;yBACD;qBACF;gBACH;gBACAC,WAAW;oBACTC,SAAS;wBACP;4BACEC,aAAa;4BACbT,KAAK;4BACLQ,SAAS;gCACP,IAAIpB,gBAAgB,aAAa;oCAC/BsB,MAAMrB;oCACNoB,aAAa;oCACbE,UAAU;wCAAC;wCAAU;wCAAa;wCAAK;qCAAO;oCAC9CC,UAAU,CAAC,EAAET,MAAM,EAAE;wCACnBA,OAAOC,MAAM,CAAC;4CACZ,MAAMC,YAAYlB;4CAClBH,eAAeqB,WAAW,IAAMnB;wCAClC;oCACF;gCACF;6BACD;wBACH;qBACD;gBACH;YACF,CAAA;IACF;AACF;AAEA,OAAO,MAAM2B,kCAAkCtB,sBAAsBC,wBAAuB"}
1
+ {"version":3,"sources":["../../../../src/field/features/paragraph/feature.client.tsx"],"sourcesContent":["'use client'\n\nimport { $setBlocksType } from '@lexical/selection'\nimport { $createParagraphNode, $getSelection } from 'lexical'\n\nimport type { FeatureProviderProviderClient } from '../types.js'\n\nimport { SlashMenuOption } from '../../lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/types.js'\nimport { TextIcon } from '../../lexical/ui/icons/Text/index.js'\nimport { TextDropdownSectionWithEntries } from '../common/floatingSelectToolbarTextDropdownSection/index.js'\nimport { createClientComponent } from '../createClientComponent.js'\n\nconst ParagraphFeatureClient: FeatureProviderProviderClient<undefined> = (props) => {\n return {\n clientFeatureProps: props,\n feature: () => ({\n clientFeatureProps: props,\n floatingSelectToolbar: {\n sections: [\n TextDropdownSectionWithEntries([\n {\n ChildComponent: TextIcon,\n isActive: () => false,\n key: 'normal-text',\n label: 'Normal Text',\n onClick: ({ editor }) => {\n editor.update(() => {\n const selection = $getSelection()\n $setBlocksType(selection, () => $createParagraphNode())\n })\n },\n order: 1,\n },\n ]),\n ],\n },\n slashMenu: {\n options: [\n {\n displayName: 'Basic',\n key: 'basic',\n options: [\n new SlashMenuOption('paragraph', {\n Icon: TextIcon,\n displayName: 'Paragraph',\n keywords: ['normal', 'paragraph', 'p', 'text'],\n onSelect: ({ editor }) => {\n editor.update(() => {\n const selection = $getSelection()\n $setBlocksType(selection, () => $createParagraphNode())\n })\n },\n }),\n ],\n },\n ],\n },\n }),\n }\n}\n\nexport const ParagraphFeatureClientComponent = createClientComponent(ParagraphFeatureClient)\n"],"names":["$setBlocksType","$createParagraphNode","$getSelection","SlashMenuOption","TextIcon","TextDropdownSectionWithEntries","createClientComponent","ParagraphFeatureClient","props","clientFeatureProps","feature","floatingSelectToolbar","sections","ChildComponent","isActive","key","label","onClick","editor","update","selection","order","slashMenu","options","displayName","Icon","keywords","onSelect","ParagraphFeatureClientComponent"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA;AAEA,SAASA,cAAc,QAAQ,qBAAoB;AACnD,SAASC,oBAAoB,EAAEC,aAAa,QAAQ,UAAS;AAI7D,SAASC,eAAe,QAAQ,sEAAqE;AACrG,SAASC,QAAQ,QAAQ,uCAAsC;AAC/D,SAASC,8BAA8B,QAAQ,8DAA6D;AAC5G,SAASC,qBAAqB,QAAQ,8BAA6B;AAEnE,MAAMC,yBAAmE,CAACC;IACxE,OAAO;QACLC,oBAAoBD;QACpBE,SAAS,IAAO,CAAA;gBACdD,oBAAoBD;gBACpBG,uBAAuB;oBACrBC,UAAU;wBACRP,+BAA+B;4BAC7B;gCACEQ,gBAAgBT;gCAChBU,UAAU,IAAM;gCAChBC,KAAK;gCACLC,OAAO;gCACPC,SAAS,CAAC,EAAEC,MAAM,EAAE;oCAClBA,OAAOC,MAAM,CAAC;wCACZ,MAAMC,YAAYlB;wCAClBF,eAAeoB,WAAW,IAAMnB;oCAClC;gCACF;gCACAoB,OAAO;4BACT;yBACD;qBACF;gBACH;gBACAC,WAAW;oBACTC,SAAS;wBACP;4BACEC,aAAa;4BACbT,KAAK;4BACLQ,SAAS;gCACP,IAAIpB,gBAAgB,aAAa;oCAC/BsB,MAAMrB;oCACNoB,aAAa;oCACbE,UAAU;wCAAC;wCAAU;wCAAa;wCAAK;qCAAO;oCAC9CC,UAAU,CAAC,EAAET,MAAM,EAAE;wCACnBA,OAAOC,MAAM,CAAC;4CACZ,MAAMC,YAAYlB;4CAClBF,eAAeoB,WAAW,IAAMnB;wCAClC;oCACF;gCACF;6BACD;wBACH;qBACD;gBACH;YACF,CAAA;IACF;AACF;AAEA,OAAO,MAAM2B,kCAAkCtB,sBAAsBC,wBAAuB"}
@@ -1 +1 @@
1
- {"version":3,"file":"commands.d.ts","sourceRoot":"","sources":["../../../../../src/field/features/relationship/drawer/commands.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAA;AAK7C,eAAO,MAAM,uCAAuC,EAAE,cAAc,CAAC;IACnE,OAAO,EAAE;QAAE,OAAO,EAAE,MAAM,CAAA;KAAE,GAAG,KAAK,CAAA;CACrC,CAA4D,CAAA"}
1
+ {"version":3,"file":"commands.d.ts","sourceRoot":"","sources":["../../../../../src/field/features/relationship/drawer/commands.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAA;AAI7C,eAAO,MAAM,uCAAuC,EAAE,cAAc,CAAC;IACnE,OAAO,EAAE;QAAE,OAAO,EAAE,MAAM,CAAA;KAAE,GAAG,KAAK,CAAA;CACrC,CAA4D,CAAA"}
@@ -1,5 +1,4 @@
1
- import lexicalImport from 'lexical';
2
- const { createCommand } = lexicalImport;
1
+ import { createCommand } from 'lexical';
3
2
  export const INSERT_RELATIONSHIP_WITH_DRAWER_COMMAND = createCommand('INSERT_RELATIONSHIP_WITH_DRAWER_COMMAND');
4
3
 
5
4
  //# sourceMappingURL=commands.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../src/field/features/relationship/drawer/commands.ts"],"sourcesContent":["import type { LexicalCommand } from 'lexical'\n\nimport lexicalImport from 'lexical'\nconst { createCommand } = lexicalImport\n\nexport const INSERT_RELATIONSHIP_WITH_DRAWER_COMMAND: LexicalCommand<{\n replace: { nodeKey: string } | false\n}> = createCommand('INSERT_RELATIONSHIP_WITH_DRAWER_COMMAND')\n"],"names":["lexicalImport","createCommand","INSERT_RELATIONSHIP_WITH_DRAWER_COMMAND"],"rangeMappings":";;","mappings":"AAEA,OAAOA,mBAAmB,UAAS;AACnC,MAAM,EAAEC,aAAa,EAAE,GAAGD;AAE1B,OAAO,MAAME,0CAERD,cAAc,2CAA0C"}
1
+ {"version":3,"sources":["../../../../../src/field/features/relationship/drawer/commands.ts"],"sourcesContent":["import type { LexicalCommand } from 'lexical'\n\nimport { createCommand } from 'lexical'\n\nexport const INSERT_RELATIONSHIP_WITH_DRAWER_COMMAND: LexicalCommand<{\n replace: { nodeKey: string } | false\n}> = createCommand('INSERT_RELATIONSHIP_WITH_DRAWER_COMMAND')\n"],"names":["createCommand","INSERT_RELATIONSHIP_WITH_DRAWER_COMMAND"],"rangeMappings":";","mappings":"AAEA,SAASA,aAAa,QAAQ,UAAS;AAEvC,OAAO,MAAMC,0CAERD,cAAc,2CAA0C"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/field/features/relationship/drawer/index.tsx"],"names":[],"mappings":"AASA,OAAO,KAA2C,MAAM,OAAO,CAAA;AAmC/D,KAAK,KAAK,GAAG;IACX,sBAAsB,EAAE,IAAI,GAAG,MAAM,EAAE,CAAA;CACxC,CAAA;AAkDD,eAAO,MAAM,kBAAkB,UAAW,KAAK,KAAG,MAAM,SAQvD,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/field/features/relationship/drawer/index.tsx"],"names":[],"mappings":"AAMA,OAAO,KAA2C,MAAM,OAAO,CAAA;AAiC/D,KAAK,KAAK,GAAG;IACX,sBAAsB,EAAE,IAAI,GAAG,MAAM,EAAE,CAAA;CACxC,CAAA;AAkDD,eAAO,MAAM,kBAAkB,UAAW,KAAK,KAAG,MAAM,SAQvD,CAAA"}
@@ -1,21 +1,17 @@
1
1
  'use client';
2
- import lexicalComposerContextImport from '@lexical/react/LexicalComposerContext.js';
3
- const { useLexicalComposerContext } = lexicalComposerContextImport;
4
- import lexicalImport from 'lexical';
5
- const { $getNodeByKey, COMMAND_PRIORITY_EDITOR } = lexicalImport;
2
+ import { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext.js';
6
3
  import { useListDrawer } from '@payloadcms/ui/elements/ListDrawer';
4
+ import { $getNodeByKey, COMMAND_PRIORITY_EDITOR } from 'lexical';
7
5
  import React, { useCallback, useEffect, useState } from 'react';
8
6
  import { $createRelationshipNode } from '../nodes/RelationshipNode.js';
9
7
  import { INSERT_RELATIONSHIP_COMMAND } from '../plugins/index.js';
10
8
  import { EnabledRelationshipsCondition } from '../utils/EnabledRelationshipsCondition.js';
11
9
  import { INSERT_RELATIONSHIP_WITH_DRAWER_COMMAND } from './commands.js';
12
- const insertRelationship = ({ id, editor, relationTo, replaceNodeKey })=>{
10
+ const insertRelationship = ({ editor, relationTo, replaceNodeKey, value })=>{
13
11
  if (!replaceNodeKey) {
14
12
  editor.dispatchCommand(INSERT_RELATIONSHIP_COMMAND, {
15
13
  relationTo,
16
- value: {
17
- id
18
- }
14
+ value
19
15
  });
20
16
  } else {
21
17
  editor.update(()=>{
@@ -23,9 +19,7 @@ const insertRelationship = ({ id, editor, relationTo, replaceNodeKey })=>{
23
19
  if (node) {
24
20
  node.replace($createRelationshipNode({
25
21
  relationTo,
26
- value: {
27
- id
28
- }
22
+ value
29
23
  }));
30
24
  }
31
25
  });
@@ -51,10 +45,10 @@ const RelationshipDrawerComponent = ({ enabledCollectionSlugs })=>{
51
45
  ]);
52
46
  const onSelect = useCallback(({ collectionSlug, docID })=>{
53
47
  insertRelationship({
54
- id: docID,
55
48
  editor,
56
49
  relationTo: collectionSlug,
57
- replaceNodeKey
50
+ replaceNodeKey,
51
+ value: docID
58
52
  });
59
53
  closeDrawer();
60
54
  }, [
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../src/field/features/relationship/drawer/index.tsx"],"sourcesContent":["'use client'\nimport lexicalComposerContextImport from '@lexical/react/LexicalComposerContext.js'\nconst { useLexicalComposerContext } = lexicalComposerContextImport\nimport lexicalImport from 'lexical'\nconst { $getNodeByKey, COMMAND_PRIORITY_EDITOR } = lexicalImport\n\nimport type { LexicalEditor } from 'lexical'\n\nimport { useListDrawer } from '@payloadcms/ui/elements/ListDrawer'\nimport React, { useCallback, useEffect, useState } from 'react'\n\nimport { $createRelationshipNode } from '../nodes/RelationshipNode.js'\nimport { INSERT_RELATIONSHIP_COMMAND } from '../plugins/index.js'\nimport { EnabledRelationshipsCondition } from '../utils/EnabledRelationshipsCondition.js'\nimport { INSERT_RELATIONSHIP_WITH_DRAWER_COMMAND } from './commands.js'\n\nconst insertRelationship = ({\n id,\n editor,\n relationTo,\n replaceNodeKey,\n}: {\n editor: LexicalEditor\n id: string\n relationTo: string\n replaceNodeKey: null | string\n}) => {\n if (!replaceNodeKey) {\n editor.dispatchCommand(INSERT_RELATIONSHIP_COMMAND, {\n relationTo,\n value: {\n id,\n },\n })\n } else {\n editor.update(() => {\n const node = $getNodeByKey(replaceNodeKey)\n if (node) {\n node.replace($createRelationshipNode({ relationTo, value: { id } }))\n }\n })\n }\n}\n\ntype Props = {\n enabledCollectionSlugs: null | string[]\n}\n\nconst RelationshipDrawerComponent: React.FC<Props> = ({ enabledCollectionSlugs }) => {\n const [editor] = useLexicalComposerContext()\n const [selectedCollectionSlug, setSelectedCollectionSlug] = useState(\n () => enabledCollectionSlugs[0],\n )\n const [replaceNodeKey, setReplaceNodeKey] = useState<null | string>(null)\n\n const [ListDrawer, ListDrawerToggler, { closeDrawer, isDrawerOpen, openDrawer }] = useListDrawer({\n collectionSlugs: enabledCollectionSlugs,\n selectedCollection: selectedCollectionSlug,\n })\n\n useEffect(() => {\n return editor.registerCommand<{\n replace: { nodeKey: string } | false\n }>(\n INSERT_RELATIONSHIP_WITH_DRAWER_COMMAND,\n (payload) => {\n setReplaceNodeKey(payload?.replace ? payload?.replace.nodeKey : null)\n openDrawer()\n return true\n },\n COMMAND_PRIORITY_EDITOR,\n )\n }, [editor, openDrawer])\n\n const onSelect = useCallback(\n ({ collectionSlug, docID }) => {\n insertRelationship({\n id: docID,\n editor,\n relationTo: collectionSlug,\n replaceNodeKey,\n })\n closeDrawer()\n },\n [editor, closeDrawer, replaceNodeKey],\n )\n\n useEffect(() => {\n // always reset back to first option\n // TODO: this is not working, see the ListDrawer component\n setSelectedCollectionSlug(enabledCollectionSlugs[0])\n }, [isDrawerOpen, enabledCollectionSlugs])\n\n return <ListDrawer onSelect={onSelect} />\n}\n\nexport const RelationshipDrawer = (props: Props): React.ReactNode => {\n return props?.enabledCollectionSlugs?.length > 0 ? ( // If enabledCollectionSlugs it overrides what EnabledRelationshipsCondition is doing\n <RelationshipDrawerComponent {...props} />\n ) : (\n <EnabledRelationshipsCondition {...props}>\n <RelationshipDrawerComponent {...props} />\n </EnabledRelationshipsCondition>\n )\n}\n"],"names":["lexicalComposerContextImport","useLexicalComposerContext","lexicalImport","$getNodeByKey","COMMAND_PRIORITY_EDITOR","useListDrawer","React","useCallback","useEffect","useState","$createRelationshipNode","INSERT_RELATIONSHIP_COMMAND","EnabledRelationshipsCondition","INSERT_RELATIONSHIP_WITH_DRAWER_COMMAND","insertRelationship","id","editor","relationTo","replaceNodeKey","dispatchCommand","value","update","node","replace","RelationshipDrawerComponent","enabledCollectionSlugs","selectedCollectionSlug","setSelectedCollectionSlug","setReplaceNodeKey","ListDrawer","ListDrawerToggler","closeDrawer","isDrawerOpen","openDrawer","collectionSlugs","selectedCollection","registerCommand","payload","nodeKey","onSelect","collectionSlug","docID","RelationshipDrawer","props","length"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA;AACA,OAAOA,kCAAkC,2CAA0C;AACnF,MAAM,EAAEC,yBAAyB,EAAE,GAAGD;AACtC,OAAOE,mBAAmB,UAAS;AACnC,MAAM,EAAEC,aAAa,EAAEC,uBAAuB,EAAE,GAAGF;AAInD,SAASG,aAAa,QAAQ,qCAAoC;AAClE,OAAOC,SAASC,WAAW,EAAEC,SAAS,EAAEC,QAAQ,QAAQ,QAAO;AAE/D,SAASC,uBAAuB,QAAQ,+BAA8B;AACtE,SAASC,2BAA2B,QAAQ,sBAAqB;AACjE,SAASC,6BAA6B,QAAQ,4CAA2C;AACzF,SAASC,uCAAuC,QAAQ,gBAAe;AAEvE,MAAMC,qBAAqB,CAAC,EAC1BC,EAAE,EACFC,MAAM,EACNC,UAAU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BmB,SAAS,kBAC7C,oBAACpB,6BAAgCmB,uBAEjC,oBAAC/B,+BAAkC+B,qBACjC,oBAACnB,6BAAgCmB;AAGvC,EAAC"}
1
+ {"version":3,"sources":["../../../../../src/field/features/relationship/drawer/index.tsx"],"sourcesContent":["'use client'\nimport type { LexicalEditor } from 'lexical'\n\nimport { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext.js'\nimport { useListDrawer } from '@payloadcms/ui/elements/ListDrawer'\nimport { $getNodeByKey, COMMAND_PRIORITY_EDITOR } from 'lexical'\nimport React, { useCallback, useEffect, useState } from 'react'\n\nimport { $createRelationshipNode } from '../nodes/RelationshipNode.js'\nimport { INSERT_RELATIONSHIP_COMMAND } from '../plugins/index.js'\nimport { EnabledRelationshipsCondition } from '../utils/EnabledRelationshipsCondition.js'\nimport { INSERT_RELATIONSHIP_WITH_DRAWER_COMMAND } from './commands.js'\n\nconst insertRelationship = ({\n editor,\n relationTo,\n replaceNodeKey,\n value,\n}: {\n editor: LexicalEditor\n relationTo: string\n replaceNodeKey: null | string\n value: number | string\n}) => {\n if (!replaceNodeKey) {\n editor.dispatchCommand(INSERT_RELATIONSHIP_COMMAND, {\n relationTo,\n value,\n })\n } else {\n editor.update(() => {\n const node = $getNodeByKey(replaceNodeKey)\n if (node) {\n node.replace($createRelationshipNode({ relationTo, value }))\n }\n })\n }\n}\n\ntype Props = {\n enabledCollectionSlugs: null | string[]\n}\n\nconst RelationshipDrawerComponent: React.FC<Props> = ({ enabledCollectionSlugs }) => {\n const [editor] = useLexicalComposerContext()\n const [selectedCollectionSlug, setSelectedCollectionSlug] = useState(\n () => enabledCollectionSlugs[0],\n )\n const [replaceNodeKey, setReplaceNodeKey] = useState<null | string>(null)\n\n const [ListDrawer, ListDrawerToggler, { closeDrawer, isDrawerOpen, openDrawer }] = useListDrawer({\n collectionSlugs: enabledCollectionSlugs,\n selectedCollection: selectedCollectionSlug,\n })\n\n useEffect(() => {\n return editor.registerCommand<{\n replace: { nodeKey: string } | false\n }>(\n INSERT_RELATIONSHIP_WITH_DRAWER_COMMAND,\n (payload) => {\n setReplaceNodeKey(payload?.replace ? payload?.replace.nodeKey : null)\n openDrawer()\n return true\n },\n COMMAND_PRIORITY_EDITOR,\n )\n }, [editor, openDrawer])\n\n const onSelect = useCallback(\n ({ collectionSlug, docID }) => {\n insertRelationship({\n editor,\n relationTo: collectionSlug,\n replaceNodeKey,\n value: docID,\n })\n closeDrawer()\n },\n [editor, closeDrawer, replaceNodeKey],\n )\n\n useEffect(() => {\n // always reset back to first option\n // TODO: this is not working, see the ListDrawer component\n setSelectedCollectionSlug(enabledCollectionSlugs[0])\n }, [isDrawerOpen, enabledCollectionSlugs])\n\n return <ListDrawer onSelect={onSelect} />\n}\n\nexport const RelationshipDrawer = (props: Props): React.ReactNode => {\n return props?.enabledCollectionSlugs?.length > 0 ? ( // If enabledCollectionSlugs it overrides what EnabledRelationshipsCondition is doing\n <RelationshipDrawerComponent {...props} />\n ) : (\n <EnabledRelationshipsCondition {...props}>\n <RelationshipDrawerComponent {...props} />\n </EnabledRelationshipsCondition>\n )\n}\n"],"names":["useLexicalComposerContext","useListDrawer","$getNodeByKey","COMMAND_PRIORITY_EDITOR","React","useCallback","useEffect","useState","$createRelationshipNode","INSERT_RELATIONSHIP_COMMAND","EnabledRelationshipsCondition","INSERT_RELATIONSHIP_WITH_DRAWER_COMMAND","insertRelationship","editor","relationTo","replaceNodeKey","value","dispatchCommand","update","node","replace","RelationshipDrawerComponent","enabledCollectionSlugs","selectedCollectionSlug","setSelectedCollectionSlug","setReplaceNodeKey","ListDrawer","ListDrawerToggler","closeDrawer","isDrawerOpen","openDrawer","collectionSlugs","selectedCollection","registerCommand","payload","nodeKey","onSelect","collectionSlug","docID","RelationshipDrawer","props","length"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA;AAGA,SAASA,yBAAyB,QAAQ,2C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B1B,mBAAmB;YACjBC;YACAC,YAAYuB;YACZtB;YACAC,OAAOsB;QACT;QACAV;IACF,GACA;QAACf;QAAQe;QAAab;KAAe;IAGvCT,UAAU;QACR,oCAAoC;QACpC,0DAA0D;QAC1DkB,0BAA0BF,sBAAsB,CAAC,EAAE;IACrD,GAAG;QAACO;QAAcP;KAAuB;IAEzC,qBAAO,oBAACI;QAAWU,UAAUA;;AAC/B;AAEA,OAAO,MAAMG,qBAAqB,CAACC;IACjC,OAAOA,OAAOlB,wBAAwBmB,SAAS,kBAC7C,oBAACpB,6BAAgCmB,uBAEjC,oBAAC9B,+BAAkC8B,qBACjC,oBAACnB,6BAAgCmB;AAGvC,EAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"feature.server.d.ts","sourceRoot":"","sources":["../../../../src/field/features/relationship/feature.server.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,aAAa,CAAA;AAMhE,MAAM,MAAM,wBAAwB,GAChC;IACE;;;QAGI;IACJ,mBAAmB,CAAC,EAAE,MAAM,EAAE,CAAA;IAG9B,kBAAkB,CAAC,EAAE,KAAK,CAAA;CAC3B,GACD;IAEE,mBAAmB,CAAC,EAAE,KAAK,CAAA;IAE3B;;;QAGI;IACJ,kBAAkB,CAAC,EAAE,MAAM,EAAE,CAAA;CAC9B,CAAA;AAEL,eAAO,MAAM,mBAAmB,EAAE,6BAA6B,CAC7D,wBAAwB,EACxB,wBAAwB,CAoBzB,CAAA"}
1
+ {"version":3,"file":"feature.server.d.ts","sourceRoot":"","sources":["../../../../src/field/features/relationship/feature.server.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,aAAa,CAAA;AAOhE,MAAM,MAAM,wBAAwB,GAChC;IACE;;;QAGI;IACJ,mBAAmB,CAAC,EAAE,MAAM,EAAE,CAAA;IAG9B,kBAAkB,CAAC,EAAE,KAAK,CAAA;CAC3B,GACD;IAEE,mBAAmB,CAAC,EAAE,KAAK,CAAA;IAE3B;;;QAGI;IACJ,kBAAkB,CAAC,EAAE,MAAM,EAAE,CAAA;CAC9B,CAAA;AAEL,eAAO,MAAM,mBAAmB,EAAE,6BAA6B,CAC7D,wBAAwB,EACxB,wBAAwB,CAoBzB,CAAA"}
@@ -1,3 +1,4 @@
1
+ import { createNode } from '../typeUtilities.js';
1
2
  import { RelationshipFeatureClientComponent } from './feature.client.js';
2
3
  import { RelationshipNode } from './nodes/RelationshipNode.js';
3
4
  import { relationshipPopulationPromise } from './populationPromise.js';
@@ -8,12 +9,12 @@ export const RelationshipFeature = (props)=>{
8
9
  ClientComponent: RelationshipFeatureClientComponent,
9
10
  clientFeatureProps: props,
10
11
  nodes: [
11
- {
12
+ createNode({
12
13
  node: RelationshipNode,
13
14
  populationPromises: [
14
15
  relationshipPopulationPromise
15
16
  ]
16
- }
17
+ })
17
18
  ],
18
19
  serverFeatureProps: props
19
20
  };
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/field/features/relationship/feature.server.ts"],"sourcesContent":["import type { FeatureProviderProviderServer } from '../types.js'\n\nimport { RelationshipFeatureClientComponent } from './feature.client.js'\nimport { RelationshipNode } from './nodes/RelationshipNode.js'\nimport { relationshipPopulationPromise } from './populationPromise.js'\n\nexport type RelationshipFeatureProps =\n | {\n /**\n * The collections that should be disabled. Overrides the `enableRichTextRelationship` property in the collection config.\n * When this property is set, `enabledCollections` will not be available.\n **/\n disabledCollections?: string[]\n\n // Ensures that enabledCollections is not available when disabledCollections is set\n enabledCollections?: never\n }\n | {\n // Ensures that disabledCollections is not available when enabledCollections is set\n disabledCollections?: never\n\n /**\n * The collections that should be enabled. Overrides the `enableRichTextRelationship` property in the collection config\n * When this property is set, `disabledCollections` will not be available.\n **/\n enabledCollections?: string[]\n }\n\nexport const RelationshipFeature: FeatureProviderProviderServer<\n RelationshipFeatureProps,\n RelationshipFeatureProps\n> = (props) => {\n return {\n feature: () => {\n return {\n ClientComponent: RelationshipFeatureClientComponent,\n clientFeatureProps: props,\n nodes: [\n {\n node: RelationshipNode,\n populationPromises: [relationshipPopulationPromise],\n // TODO: Add validation similar to upload\n },\n ],\n serverFeatureProps: props,\n }\n },\n key: 'relationship',\n serverFeatureProps: props,\n }\n}\n"],"names":["RelationshipFeatureClientComponent","RelationshipNode","relationshipPopulationPromise","RelationshipFeature","props","feature","ClientComponent","clientFeatureProps","nodes","node","populationPromises","serverFeatureProps","key"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAEA,SAASA,kCAAkC,QAAQ,sBAAqB;AACxE,SAASC,gBAAgB,QAAQ,8BAA6B;AAC9D,SAASC,6BAA6B,QAAQ,yBAAwB;AAwBtE,OAAO,MAAMC,sBAGT,CAACC;IACH,OAAO;QACLC,SAAS;YACP,OAAO;gBACLC,iBAAiBN;gBACjBO,oBAAoBH;gBACpBI,OAAO;oBACL;wBACEC,MAAMR;wBACNS,oBAAoB;4BAACR;yBAA8B;oBAErD;iBACD;gBACDS,oBAAoBP;YACtB;QACF;QACAQ,KAAK;QACLD,oBAAoBP;IACtB;AACF,EAAC"}
1
+ {"version":3,"sources":["../../../../src/field/features/relationship/feature.server.ts"],"sourcesContent":["import type { FeatureProviderProviderServer } from '../types.js'\n\nimport { createNode } from '../typeUtilities.js'\nimport { RelationshipFeatureClientComponent } from './feature.client.js'\nimport { RelationshipNode } from './nodes/RelationshipNode.js'\nimport { relationshipPopulationPromise } from './populationPromise.js'\n\nexport type RelationshipFeatureProps =\n | {\n /**\n * The collections that should be disabled. Overrides the `enableRichTextRelationship` property in the collection config.\n * When this property is set, `enabledCollections` will not be available.\n **/\n disabledCollections?: string[]\n\n // Ensures that enabledCollections is not available when disabledCollections is set\n enabledCollections?: never\n }\n | {\n // Ensures that disabledCollections is not available when enabledCollections is set\n disabledCollections?: never\n\n /**\n * The collections that should be enabled. Overrides the `enableRichTextRelationship` property in the collection config\n * When this property is set, `disabledCollections` will not be available.\n **/\n enabledCollections?: string[]\n }\n\nexport const RelationshipFeature: FeatureProviderProviderServer<\n RelationshipFeatureProps,\n RelationshipFeatureProps\n> = (props) => {\n return {\n feature: () => {\n return {\n ClientComponent: RelationshipFeatureClientComponent,\n clientFeatureProps: props,\n nodes: [\n createNode({\n node: RelationshipNode,\n populationPromises: [relationshipPopulationPromise],\n // TODO: Add validation similar to upload\n }),\n ],\n serverFeatureProps: props,\n }\n },\n key: 'relationship',\n serverFeatureProps: props,\n }\n}\n"],"names":["createNode","RelationshipFeatureClientComponent","RelationshipNode","relationshipPopulationPromise","RelationshipFeature","props","feature","ClientComponent","clientFeatureProps","nodes","node","populationPromises","serverFeatureProps","key"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAEA,SAASA,UAAU,QAAQ,sBAAqB;AAChD,SAASC,kCAAkC,QAAQ,sBAAqB;AACxE,SAASC,gBAAgB,QAAQ,8BAA6B;AAC9D,SAASC,6BAA6B,QAAQ,yBAAwB;AAwBtE,OAAO,MAAMC,sBAGT,CAACC;IACH,OAAO;QACLC,SAAS;YACP,OAAO;gBACLC,iBAAiBN;gBACjBO,oBAAoBH;gBACpBI,OAAO;oBACLT,WAAW;wBACTU,MAAMR;wBACNS,oBAAoB;4BAACR;yBAA8B;oBAErD;iBACD;gBACDS,oBAAoBP;YACtB;QACF;QACAQ,KAAK;QACLD,oBAAoBP;IACtB;AACF,EAAC"}
@@ -1,14 +1,10 @@
1
1
  /// <reference types="react" resolution-mode="require"/>
2
- import type { DOMConversionMap, DOMExportOutput, EditorConfig, ElementFormatType, LexicalEditor, LexicalNode, NodeKey, Spread } from 'lexical';
3
- import lexicalDecoratorBlockNodeImport from '@lexical/react/LexicalDecoratorBlockNode.js';
4
- declare const DecoratorBlockNode: typeof lexicalDecoratorBlockNodeImport.DecoratorBlockNode;
5
2
  import type { SerializedDecoratorBlockNode } from '@lexical/react/LexicalDecoratorBlockNode.js';
3
+ import type { DOMConversionMap, DOMExportOutput, EditorConfig, ElementFormatType, LexicalEditor, LexicalNode, NodeKey, Spread } from 'lexical';
4
+ import { DecoratorBlockNode } from '@lexical/react/LexicalDecoratorBlockNode.js';
6
5
  export type RelationshipData = {
7
6
  relationTo: string;
8
- value: {
9
- [key: string]: unknown;
10
- id: string;
11
- };
7
+ value: number | string;
12
8
  };
13
9
  export type SerializedRelationshipNode = Spread<RelationshipData, SerializedDecoratorBlockNode>;
14
10
  export declare class RelationshipNode extends DecoratorBlockNode {
@@ -32,5 +28,4 @@ export declare class RelationshipNode extends DecoratorBlockNode {
32
28
  }
33
29
  export declare function $createRelationshipNode(data: RelationshipData): RelationshipNode;
34
30
  export declare function $isRelationshipNode(node: LexicalNode | RelationshipNode | null | undefined): node is RelationshipNode;
35
- export {};
36
31
  //# sourceMappingURL=RelationshipNode.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"RelationshipNode.d.ts","sourceRoot":"","sources":["../../../../../src/field/features/relationship/nodes/RelationshipNode.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,EACV,gBAAgB,EAEhB,eAAe,EACf,YAAY,EACZ,iBAAiB,EACjB,aAAa,EACb,WAAW,EACX,OAAO,EACP,MAAM,EACP,MAAM,SAAS,CAAA;AAEhB,OAAO,+BAA+B,MAAM,6CAA6C,CAAA;AACzF,QAAA,MAAQ,kBAAkB,2DAAoC,CAAA;AAE9D,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,6CAA6C,CAAA;AAU/F,MAAM,MAAM,gBAAgB,GAAG;IAC7B,UAAU,EAAE,MAAM,CAAA;IAClB,KAAK,EAAE;QAEL,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;QACtB,EAAE,EAAE,MAAM,CAAA;KACX,CAAA;CACF,CAAA;AAED,MAAM,MAAM,0BAA0B,GAAG,MAAM,CAAC,gBAAgB,EAAE,4BAA4B,CAAC,CAAA;AAkB/F,qBAAa,gBAAiB,SAAQ,kBAAkB;IACtD,MAAM,EAAE,gBAAgB,CAAA;gBAEZ,EACV,IAAI,EACJ,MAAM,EACN,GAAG,GACJ,EAAE;QACD,IAAI,EAAE,gBAAgB,CAAA;QACtB,MAAM,CAAC,EAAE,iBAAiB,CAAA;QAC1B,GAAG,CAAC,EAAE,OAAO,CAAA;KACd;IAKD,MAAM,CAAC,KAAK,CAAC,IAAI,EAAE,gBAAgB,GAAG,gBAAgB;IAQtD,MAAM,CAAC,OAAO,IAAI,MAAM;IAIxB,MAAM,CAAC,SAAS,IAAI,gBAAgB,CAAC,cAAc,CAAC,GAAG,IAAI;IAiB3D,MAAM,CAAC,UAAU,CAAC,cAAc,EAAE,0BAA0B,GAAG,gBAAgB;IAU/E,MAAM,CAAC,QAAQ,IAAI,KAAK;IAGxB,QAAQ,CAAC,MAAM,EAAE,aAAa,EAAE,MAAM,EAAE,YAAY,GAAG,GAAG,CAAC,OAAO;IAWlE,SAAS,IAAI,eAAe;IAU5B,UAAU,IAAI,0BAA0B;IASxC,OAAO,IAAI,gBAAgB;IAI3B,cAAc,IAAI,MAAM;IAIxB,OAAO,CAAC,IAAI,EAAE,gBAAgB,GAAG,IAAI;CAItC;AAED,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,gBAAgB,GAAG,gBAAgB,CAIhF;AAED,wBAAgB,mBAAmB,CACjC,IAAI,EAAE,WAAW,GAAG,gBAAgB,GAAG,IAAI,GAAG,SAAS,GACtD,IAAI,IAAI,gBAAgB,CAE1B"}
1
+ {"version":3,"file":"RelationshipNode.d.ts","sourceRoot":"","sources":["../../../../../src/field/features/relationship/nodes/RelationshipNode.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,6CAA6C,CAAA;AAC/F,OAAO,KAAK,EACV,gBAAgB,EAEhB,eAAe,EACf,YAAY,EACZ,iBAAiB,EACjB,aAAa,EACb,WAAW,EACX,OAAO,EACP,MAAM,EACP,MAAM,SAAS,CAAA;AAEhB,OAAO,EAAE,kBAAkB,EAAE,MAAM,6CAA6C,CAAA;AAShF,MAAM,MAAM,gBA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DecoratorBlockNodeImport;
1
+ import { DecoratorBlockNode } from '@lexical/react/LexicalDecoratorBlockNode.js';
3
2
  import * as React from 'react';
4
3
  const RelationshipComponent = /*#__PURE__*/ React.lazy(()=>import('./components/RelationshipComponent.js').then((module)=>({
5
4
  default: module.RelationshipComponent
@@ -10,9 +9,7 @@ function relationshipElementToNode(domNode) {
10
9
  if (id != null && relationTo != null) {
11
10
  const node = $createRelationshipNode({
12
11
  relationTo,
13
- value: {
14
- id
15
- }
12
+ value: id
16
13
  });
17
14
  return {
18
15
  node
@@ -50,6 +47,9 @@ export class RelationshipNode extends DecoratorBlockNode {
50
47
  };
51
48
  }
52
49
  static importJSON(serializedNode) {
50
+ if (serializedNode.version === 1 && serializedNode?.value?.id) {
51
+ serializedNode.value = serializedNode.value.id;
52
+ }
53
53
  const importedData = {
54
54
  relationTo: serializedNode.relationTo,
55
55
  value: serializedNode.value
@@ -71,7 +71,7 @@ export class RelationshipNode extends DecoratorBlockNode {
71
71
  }
72
72
  exportDOM() {
73
73
  const element = document.createElement('div');
74
- element.setAttribute('data-lexical-relationship-id', this.__data?.value?.id);
74
+ element.setAttribute('data-lexical-relationship-id', String(this.__data?.value));
75
75
  element.setAttribute('data-lexical-relationship-relationTo', this.__data?.relationTo);
76
76
  const text = document.createTextNode(this.getTextContent());
77
77
  element.append(text);
@@ -84,14 +84,14 @@ export class RelationshipNode extends DecoratorBlockNode {
84
84
  ...super.exportJSON(),
85
85
  ...this.getData(),
86
86
  type: this.getType(),
87
- version: 1
87
+ version: 2
88
88
  };
89
89
  }
90
90
  getData() {
91
91
  return this.getLatest().__data;
92
92
  }
93
93
  getTextContent() {
94
- return `${this.__data?.relationTo} relation to ${this.__data?.value?.id}`;
94
+ return `${this.__data?.relationTo} relation to ${this.__data?.value}`;
95
95
  }
96
96
  setData(data) {
97
97
  const writable = this.getWritable();
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../src/field/features/relationship/nodes/RelationshipNode.tsx"],"sourcesContent":["import type {\n DOMConversionMap,\n DOMConversionOutput,\n DOMExportOutput,\n EditorConfig,\n ElementFormatType,\n LexicalEditor,\n LexicalNode,\n NodeKey,\n Spread,\n} from 'lexical'\n\nimport lexicalDecoratorBlockNodeImport from '@lexical/react/LexicalDecoratorBlockNode.js'\nconst { DecoratorBlockNode } = lexicalDecoratorBlockNodeImport\n\nimport type { SerializedDecoratorBlockNode } from '@lexical/react/LexicalDecoratorBlockNode.js'\n\nimport * as React from 'react'\n\nconst RelationshipComponent = React.lazy(() =>\n import('./components/RelationshipComponent.js').then((module) => ({\n default: module.RelationshipComponent,\n })),\n)\n\nexport type RelationshipData = {\n relationTo: string\n value: {\n // Actual relationship, populated in afterRead hook\n [key: string]: unknown\n id: string\n }\n}\n\nexport type SerializedRelationshipNode = Spread<RelationshipData, SerializedDecoratorBlockNode>\n\nfunction relationshipElementToNode(domNode: HTMLDivElement): DOMConversionOutput | null {\n const id = domNode.getAttribute('data-lexical-relationship-id')\n const relationTo = domNode.getAttribute('data-lexical-relationship-relationTo')\n\n if (id != null && relationTo != null) {\n const node = $createRelationshipNode({\n relationTo,\n value: {\n id,\n },\n })\n return { node }\n }\n return null\n}\n\nexport class RelationshipNode extends DecoratorBlockNode {\n __data: RelationshipData\n\n constructor({\n data,\n format,\n key,\n }: {\n data: RelationshipData\n format?: ElementFormatType\n key?: NodeKey\n }) {\n super(format, key)\n this.__data = data\n }\n\n static clone(node: RelationshipNode): RelationshipNode {\n return new RelationshipNode({\n data: node.__data,\n format: node.__format,\n key: node.__key,\n })\n }\n\n static getType(): string {\n return 'relationship'\n }\n\n static importDOM(): DOMConversionMap<HTMLDivElement> | null {\n return {\n div: (domNode: HTMLDivElement) => {\n if (\n !domNode.hasAttribute('data-lexical-relationship-relationTo') ||\n !domNode.hasAttribute('data-lexical-relationship-id')\n ) {\n return null\n }\n return {\n conversion: relationshipElementToNode,\n priority: 2,\n }\n },\n }\n }\n\n static importJSON(serializedNode: SerializedRelationshipNode): RelationshipNode {\n const importedData: RelationshipData = {\n relationTo: serializedNode.relationTo,\n value: serializedNode.value,\n }\n const node = $createRelationshipNode(importedData)\n node.setFormat(serializedNode.format)\n return node\n }\n\n static isInline(): false {\n return false\n }\n decorate(editor: LexicalEditor, config: EditorConfig): JSX.Element {\n return (\n <RelationshipComponent\n className={config.theme.relationship ?? 'LexicalEditorTheme__relationship'}\n data={this.__data}\n format={this.__format}\n nodeKey={this.getKey()}\n />\n )\n }\n\n exportDOM(): DOMExportOutput {\n const element = document.createElement('div')\n element.setAttribute('data-lexical-relationship-id', this.__data?.value?.id)\n element.setAttribute('data-lexical-relationship-relationTo', this.__data?.relationTo)\n\n const text = document.createTextNode(this.getTextContent())\n element.append(text)\n return { element }\n }\n\n exportJSON(): SerializedRelationshipNode {\n return {\n ...super.exportJSON(),\n ...this.getData(),\n type: this.getType(),\n version: 1,\n }\n }\n\n getData(): RelationshipData {\n return this.getLatest().__data\n }\n\n getTextContent(): string {\n return `${this.__data?.relationTo} relation to ${this.__data?.value?.id}`\n }\n\n setData(data: RelationshipData): void {\n const writable = this.getWritable()\n writable.__data = data\n }\n}\n\nexport function $createRelationshipNode(data: RelationshipData): RelationshipNode {\n return new RelationshipNode({\n data,\n })\n}\n\nexport function $isRelationshipNode(\n node: LexicalNode | RelationshipNode | null | undefined,\n): node is RelationshipNode {\n return node instanceof RelationshipNode\n}\n"],"names":["lexicalDecoratorBlockNodeImport","DecoratorBlockNode","React","RelationshipComponent","lazy","then","module","default","relationshipElementToNode","domNode","id","getAttribute","relationTo","node","$createRelationshipNode","value","RelationshipNode","__data","constructor","data","format","key","clone","__format","__key","getType","importDOM","div","hasAttribute","conversion","priority","importJSON","serializedNode","importedData","setFormat","isInline","decorate","editor","config","className","theme","relationship","nodeKey","getKey","exportDOM","element","document","createElement","setAttribute","text","createTextNode","getTextContent","append","exportJSON","getData","type","version","getLatest","setData","writable","getWritable","$isRelationshipNode"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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C1BG;IACF;AACF;AAEA,OAAO,SAAS0C,oBACdhD,IAAuD;IAEvD,OAAOA,gBAAgBG;AACzB"}
1
+ {"version":3,"sources":["../../../../../src/field/features/relationship/nodes/RelationshipNode.tsx"],"sourcesContent":["import type { SerializedDecoratorBlockNode } from '@lexical/react/LexicalDecoratorBlockNode.js'\nimport type {\n DOMConversionMap,\n DOMConversionOutput,\n DOMExportOutput,\n EditorConfig,\n ElementFormatType,\n LexicalEditor,\n LexicalNode,\n NodeKey,\n Spread,\n} from 'lexical'\n\nimport { DecoratorBlockNode } from '@lexical/react/LexicalDecoratorBlockNode.js'\nimport * as React from 'react'\n\nconst RelationshipComponent = React.lazy(() =>\n import('./components/RelationshipComponent.js').then((module) => ({\n default: module.RelationshipComponent,\n })),\n)\n\nexport type RelationshipData = {\n relationTo: string\n value: number | string\n}\n\nexport type SerializedRelationshipNode = Spread<RelationshipData, SerializedDecoratorBlockNode>\n\nfunction relationshipElementToNode(domNode: HTMLDivElement): DOMConversionOutput | null {\n const id = domNode.getAttribute('data-lexical-relationship-id')\n const relationTo = domNode.getAttribute('data-lexical-relationship-relationTo')\n\n if (id != null && relationTo != null) {\n const node = $createRelationshipNode({\n relationTo,\n value: id,\n })\n return { node }\n }\n return null\n}\n\nexport class RelationshipNode extends DecoratorBlockNode {\n __data: RelationshipData\n\n constructor({\n data,\n format,\n key,\n }: {\n data: RelationshipData\n format?: ElementFormatType\n key?: NodeKey\n }) {\n super(format, key)\n this.__data = data\n }\n\n static clone(node: RelationshipNode): RelationshipNode {\n return new RelationshipNode({\n data: node.__data,\n format: node.__format,\n key: node.__key,\n })\n }\n\n static getType(): string {\n return 'relationship'\n }\n\n static importDOM(): DOMConversionMap<HTMLDivElement> | null {\n return {\n div: (domNode: HTMLDivElement) => {\n if (\n !domNode.hasAttribute('data-lexical-relationship-relationTo') ||\n !domNode.hasAttribute('data-lexical-relationship-id')\n ) {\n return null\n }\n return {\n conversion: relationshipElementToNode,\n priority: 2,\n }\n },\n }\n }\n\n static importJSON(serializedNode: SerializedRelationshipNode): RelationshipNode {\n if (serializedNode.version === 1 && (serializedNode?.value as unknown as { id: string })?.id) {\n serializedNode.value = (serializedNode.value as unknown as { id: string }).id\n }\n\n const importedData: RelationshipData = {\n relationTo: serializedNode.relationTo,\n value: serializedNode.value,\n }\n const node = $createRelationshipNode(importedData)\n node.setFormat(serializedNode.format)\n return node\n }\n\n static isInline(): false {\n return false\n }\n\n decorate(editor: LexicalEditor, config: EditorConfig): JSX.Element {\n return (\n <RelationshipComponent\n className={config.theme.relationship ?? 'LexicalEditorTheme__relationship'}\n data={this.__data}\n format={this.__format}\n nodeKey={this.getKey()}\n />\n )\n }\n exportDOM(): DOMExportOutput {\n const element = document.createElement('div')\n element.setAttribute('data-lexical-relationship-id', String(this.__data?.value))\n element.setAttribute('data-lexical-relationship-relationTo', this.__data?.relationTo)\n\n const text = document.createTextNode(this.getTextContent())\n element.append(text)\n return { element }\n }\n\n exportJSON(): SerializedRelationshipNode {\n return {\n ...super.exportJSON(),\n ...this.getData(),\n type: this.getType(),\n version: 2,\n }\n }\n\n getData(): RelationshipData {\n return this.getLatest().__data\n }\n\n getTextContent(): string {\n return `${this.__data?.relationTo} relation to ${this.__data?.value}`\n }\n\n setData(data: RelationshipData): void {\n const writable = this.getWritable()\n writable.__data = data\n }\n}\n\nexport function $createRelationshipNode(data: RelationshipData): RelationshipNode {\n return new RelationshipNode({\n data,\n })\n}\n\nexport function $isRelationshipNode(\n node: LexicalNode | RelationshipNode | null | undefined,\n): node is RelationshipNode {\n return node instanceof RelationshipNode\n}\n"],"names":["DecoratorBlockNode","React","RelationshipComponent","lazy","then","module","default","relationshipElementToNode","domNode","id","getAttribute","relationTo","node","$createRelationshipNode","value","RelationshipNode","__data","constructor","data","format","key","clone","__format","__key","getType","importDOM","div","hasAttribute","conversion","priority","importJSON","serializedNode","version","importedData","setFormat","isInline","decorate","editor","config","className","theme","relationship","nodeKey","getKey","exportDOM","element","document","createElement","setAttribute","String","text","createTextNode","getTextContent","append","exportJSON","getData","type","getLatest","setData","writable","getWritable","$isRelationshipNode"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAaA,SAASA,kBAAkB,QAAQ,8CAA6C;AAChF,YAAYC,WAAW,QAAO;AAE9B,MAAMC,sCAAwBD,MAAME,IAAI,CAAC,IACvC,MAAM,CAAC,yCAAyCC,IAAI,CAAC,CAACC,SAAY,CAAA;YAChEC,SAASD,OAAOH,qBAAqB;QACvC,CAAA;AAUF,SAASK,0BAA0BC,OAAuB;IACxD,MAAMC,KAAKD,QAAQE,YAAY,CAAC;IAChC,MAAMC,aAAaH,QAAQE,YAAY,CAAC;IAExC,IAAID,MAAM,QAAQE,cAAc,MAAM;QACpC,MAAMC,OAAOC,wBAAwB;YACnCF;YACAG,OAAOL;QACT;QACA,OAAO;YAAEG;QAAK;IAChB;IACA,OAAO;AACT;AAEA,OAAO,MAAMG,yBAAyBf;IACpCgB,OAAwB;IAExBC,YAAY,EACVC,IAAI,EACJC,MAAM,EACNC,GAAG,EAKJ,CAAE;QACD,KAAK,CAACD,QAAQC;QACd,IAAI,CAACJ,MAAM,GAAGE;IAChB;IAEA,OAAOG,MAAMT,IAAsB,EAAoB;QACrD,OAAO,IAAIG,iBAAiB;YAC1BG,MAAMN,KAAKI,MAAM;YACjBG,QAAQP,KAAKU,QAAQ;YACrBF,KAAKR,KAAKW,KAAK;QACjB;IACF;IAEA,OAAOC,UAAkB;QACvB,OAAO;IACT;IAEA,OAAOC,YAAqD;QAC1D,OAAO;YACLC,KAAK,CAAClB;gBACJ,IACE,CAACA,QAAQmB,YAAY,CAAC,2CACtB,CAACnB,QAAQmB,YAAY,CAAC,iCACtB;oBACA,OAAO;gBACT;gBACA,OAAO;oBACLC,YAAYrB;oBACZsB,UAAU;gBACZ;YACF;QACF;I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AEF,MAAM,CAAC;IACvE;IAEA4C,QAAQxC,IAAsB,EAAQ;QACpC,MAAMyC,WAAW,IAAI,CAACC,WAAW;QACjCD,SAAS3C,MAAM,GAAGE;IACpB;AACF;AAEA,OAAO,SAASL,wBAAwBK,IAAsB;IAC5D,OAAO,IAAIH,iBAAiB;QAC1BG;IACF;AACF;AAEA,OAAO,SAAS2C,oBACdjD,IAAuD;IAEvD,OAAOA,gBAAgBG;AACzB"}
@@ -1 +1 @@
1
- {"version":3,"file":"RelationshipComponent.d.ts","sourceRoot":"","sources":["../../../../../../src/field/features/relationship/nodes/components/RelationshipComponent.tsx"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAA;AAOhD,OAAO,KAA4C,MAAM,OAAO,CAAA;AAEhE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAA;AAI9D,OAAO,cAAc,CAAA;AAQrB,KAAK,KAAK,GAAG;IACX,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;IAC1B,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,IAAI,EAAE,gBAAgB,CAAA;IACtB,MAAM,CAAC,EAAE,iBAAiB,CAAA;IAC1B,OAAO,CAAC,EAAE,MAAM,CAAA;CACjB,CAAA;AA8GD,eAAO,MAAM,qBAAqB,UAAW,KAAK,KAAG,MAAM,SAE1D,CAAA"}
1
+ {"version":3,"file":"RelationshipComponent.d.ts","sourceRoot":"","sources":["../../../../../../src/field/features/relationship/nodes/components/RelationshipComponent.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAA;AAWhD,OAAO,KAA4C,MAAM,OAAO,CAAA;AAEhE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAA;AAI9D,OAAO,cAAc,CAAA;AAQrB,KAAK,KAAK,GAAG;IACX,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;IAC1B,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,IAAI,EAAE,gBAAgB,CAAA;IACtB,MAAM,CAAC,EAAE,iBAAiB,CAAA;IAC1B,OAAO,CAAC,EAAE,MAAM,CAAA;CACjB,CAAA;AA2GD,eAAO,MAAM,qBAAqB,UAAW,KAAK,KAAG,MAAM,SAE1D,CAAA"}
@@ -1,15 +1,13 @@
1
1
  'use client';
2
- import lexicalComposerContextImport from '@lexical/react/LexicalComposerContext.js';
3
- const { useLexicalComposerContext } = lexicalComposerContextImport;
2
+ import { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext.js';
4
3
  import { useLexicalNodeSelection } from '@lexical/react/useLexicalNodeSelection.js';
5
4
  import { getTranslation } from '@payloadcms/translations';
6
- import lexicalImport from 'lexical';
7
- const { $getNodeByKey } = lexicalImport;
8
5
  import { Button } from '@payloadcms/ui/elements/Button';
9
6
  import { useDocumentDrawer } from '@payloadcms/ui/elements/DocumentDrawer';
10
7
  import usePayloadAPI from '@payloadcms/ui/hooks/usePayloadAPI';
11
8
  import { useConfig } from '@payloadcms/ui/providers/Config';
12
9
  import { useTranslation } from '@payloadcms/ui/providers/Translation';
10
+ import { $getNodeByKey } from 'lexical';
13
11
  import React, { useCallback, useReducer, useState } from 'react';
14
12
  import { useEditorConfigContext } from '../../../../lexical/config/client/EditorConfigProvider.js';
15
13
  import { INSERT_RELATIONSHIP_WITH_DRAWER_COMMAND } from '../../drawer/commands.js';
@@ -19,7 +17,7 @@ const initialParams = {
19
17
  depth: 0
20
18
  };
21
19
  const Component = (props)=>{
22
- const { children, data: { relationTo, value: { id } }, nodeKey } = props;
20
+ const { children, data: { relationTo, value: id }, nodeKey } = props;
23
21
  const [editor] = useLexicalComposerContext();
24
22
  const [isSelected, setSelected, clearSelection] = useLexicalNodeSelection(nodeKey);
25
23
  const { field } = useEditorConfigContext();
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../../src/field/features/relationship/nodes/components/RelationshipComponent.tsx"],"sourcesContent":["'use client'\nimport lexicalComposerContextImport from '@lexical/react/LexicalComposerContext.js'\nconst { useLexicalComposerContext } = lexicalComposerContextImport\nimport { useLexicalNodeSelection } from '@lexical/react/useLexicalNodeSelection.js'\nimport { getTranslation } from '@payloadcms/translations'\nimport lexicalImport from 'lexical'\nconst { $getNodeByKey } = lexicalImport\n\nimport type { ElementFormatType } from 'lexical'\n\nimport { Button } from '@payloadcms/ui/elements/Button'\nimport { useDocumentDrawer } from '@payloadcms/ui/elements/DocumentDrawer'\nimport usePayloadAPI from '@payloadcms/ui/hooks/usePayloadAPI'\nimport { useConfig } from '@payloadcms/ui/providers/Config'\nimport { useTranslation } from '@payloadcms/ui/providers/Translation'\nimport React, { useCallback, useReducer, useState } from 'react'\n\nimport type { RelationshipData } from '../RelationshipNode.js'\n\nimport { useEditorConfigContext } from '../../../../lexical/config/client/EditorConfigProvider.js'\nimport { INSERT_RELATIONSHIP_WITH_DRAWER_COMMAND } from '../../drawer/commands.js'\nimport './index.scss'\n\nconst baseClass = 'lexical-relationship'\n\nconst initialParams = {\n depth: 0,\n}\n\ntype Props = {\n children?: React.ReactNode\n className?: string\n data: RelationshipData\n format?: ElementFormatType\n nodeKey?: string\n}\n\nconst Component: React.FC<Props> = (props) => {\n const {\n children,\n data: {\n relationTo,\n value: { id },\n },\n nodeKey,\n } = props\n\n const [editor] = useLexicalComposerContext()\n const [isSelected, setSelected, clearSelection] = useLexicalNodeSelection(nodeKey)\n const { field } = useEditorConfigContext()\n const {\n collections,\n routes: { api },\n serverURL,\n } = useConfig()\n\n const [relatedCollection, setRelatedCollection] = useState(() =>\n collections.find((coll) => coll.slug === relationTo),\n )\n\n const { i18n, t } = useTranslation()\n const [cacheBust, dispatchCacheBust] = useReducer((state) => state + 1, 0)\n const [{ data }, { setParams }] = usePayloadAPI(\n `${serverURL}${api}/${relatedCollection.slug}/${id}`,\n { initialParams },\n )\n\n const [DocumentDrawer, DocumentDrawerToggler, { closeDrawer }] = useDocumentDrawer({\n id,\n collectionSlug: relatedCollection.slug,\n })\n\n const removeRelationship = useCallback(() => {\n editor.update(() => {\n $getNodeByKey(nodeKey).remove()\n })\n }, [editor, nodeKey])\n\n const updateRelationship = React.useCallback(\n ({ doc }) => {\n setParams({\n ...initialParams,\n cacheBust, // do this to get the usePayloadAPI to re-fetch the data even though the URL string hasn't changed\n })\n\n closeDrawer()\n dispatchCacheBust()\n },\n [cacheBust, setParams, closeDrawer],\n )\n\n return (\n <div\n className={[baseClass, isSelected && `${baseClass}--selected`].filter(Boolean).join(' ')}\n contentEditable={false}\n >\n <div className={`${baseClass}__wrap`}>\n <p className={`${baseClass}__label`}>\n {t('fields:labelRelationship', {\n label: getTranslation(relatedCollection.labels.singular, i18n),\n })}\n </p>\n <DocumentDrawerToggler className={`${baseClass}__doc-drawer-toggler`}>\n <p className={`${baseClass}__title`}>\n {data ? data[relatedCollection?.admin?.useAsTitle || 'id'] : id}\n </p>\n </DocumentDrawerToggler>\n </div>\n {editor.isEditable() && (\n <div className={`${baseClass}__actions`}>\n <Button\n buttonStyle=\"icon-label\"\n className={`${baseClass}__swapButton`}\n disabled={field?.readOnly}\n el=\"div\"\n icon=\"swap\"\n onClick={() => {\n editor.dispatchCommand(INSERT_RELATIONSHIP_WITH_DRAWER_COMMAND, {\n replace: { nodeKey },\n })\n }}\n round\n tooltip={t('fields:swapRelationship')}\n />\n <Button\n buttonStyle=\"icon-label\"\n className={`${baseClass}__removeButton`}\n disabled={field?.readOnly}\n icon=\"x\"\n onClick={(e) => {\n e.preventDefault()\n removeRelationship()\n }}\n round\n tooltip={t('fields:removeRelationship')}\n />\n </div>\n )}\n\n {id && <DocumentDrawer onSave={updateRelationship} />}\n {children}\n </div>\n )\n}\n\nexport const RelationshipComponent = (props: Props): React.ReactNode => {\n return <Component {...props} />\n}\n"],"names":["lexicalComposerContextImport","useLexicalComposerContext","useLexicalNodeSelection","getTranslation","lexicalImport","$getNodeByKey","Button","useDocumentDrawer","usePayloadAPI","useConfig","useTranslation","React","useCallback","useReducer","useState","useEditorConfigContext","INSERT_RELATIONSHIP_WITH_DRAWER_COMMAND","baseClass","initialParams","depth","Component","props","children","data","relationTo","value","id","nodeKey","editor","isSelected","setSelected","clearSelection","field","collections","routes","api","serverURL","relatedCollection","setRelatedCollection","find","coll","slug","i18n","t","cacheBust","dispatchCacheBust","state","setParams","DocumentDrawer","DocumentDrawerToggler","closeDrawer","collectionSlug","removeRelationship","update","remove","updateRelationship","doc","div","className","filter","Boolean","join","contentEditable","p","label","labels","singular","admin","useAsTitle","isEditable","buttonStyle","disabled","readOnly","el","icon","onClick","dispatchCommand","replace","round","tooltip","e","preventDefault","onSave","RelationshipComponent"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA;AACA,OAAOA,kCAAkC,2CAA0C;AACnF,MAAM,EAAEC,yBAAyB,EAAE,GAAGD;AACtC,SAASE,uBAAuB,QAAQ,4CAA2C;AACnF,SAASC,cAAc,QAAQ,2BAA0B;AACzD,OAAOC,mBAAmB,UAAS;AACnC,MAAM,EAAEC,aAAa,EAAE,GAAGD;AAI1B,SAASE,MAAM,QAAQ,iCAAgC;AACvD,SAASC,iBAAiB,QAAQ,yCAAwC;AAC1E,OAAOC,mBAAmB,qCAAoC;AAC9D,SAASC,SAAS,QAAQ,kCAAiC;AAC3D,SAASC,cAAc,QAAQ,uCAAsC;AACrE,OAAOC,SAASC,WAAW,EAAEC,UAAU,EAAEC,QAAQ,QAAQ,QAAO;AAIhE,SAASC,sBAAsB,QAAQ,4DAA2D;AAClG,SAASC,uCAAuC,QAAQ,2BAA0B;AAClF,OAAO,eAAc;AAErB,MAAMC,YAAY;AAElB,MAAMC,gBAAgB;IACpBC,OAAO;AACT;AAUA,MAAMC,YAA6B,CAACC;IAClC,MAAM,EACJC,QAAQ,EACRC,MAAM,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UAAU,CAAC;SAAC,CAAC0C,MAAM,CAACC,SAASC,IAAI,CAAC;QACpFC,iBAAiB;qBAEjB,oBAACL;QAAIC,WAAW,CAAC,EAAEzC,UAAU,MAAM,CAAC;qBAClC,oBAAC8C;QAAEL,WAAW,CAAC,EAAEzC,UAAU,OAAO,CAAC;OAChC0B,EAAE,4BAA4B;QAC7BqB,OAAO7D,eAAekC,kBAAkB4B,MAAM,CAACC,QAAQ,EAAExB;IAC3D,mBAEF,oBAACO;QAAsBS,WAAW,CAAC,EAAEzC,UAAU,oBAAoB,CAAC;qBAClE,oBAAC8C;QAAEL,WAAW,CAAC,EAAEzC,UAAU,OAAO,CAAC;OAChCM,OAAOA,IAAI,CAACc,mBAAmB8B,OAAOC,cAAc,KAAK,GAAG1C,OAIlEE,OAAOyC,UAAU,oBAChB,oBAACZ;QAAIC,WAAW,CAAC,EAAEzC,UAAU,SAAS,CAAC;qBACrC,oBAACX;QACCgE,aAAY;QACZZ,WAAW,CAAC,EAAEzC,UAAU,YAAY,CAAC;QACrCsD,UAAUvC,OAAOwC;QACjBC,IAAG;QACHC,MAAK;QACLC,SAAS;YACP/C,OAAOgD,eAAe,CAAC5D,yCAAyC;gBAC9D6D,SAAS;oBAAElD;gBAAQ;YACrB;QACF;QACAmD,OAAAA;QACAC,SAASpC,EAAE;sBAEb,oBAACrC;QACCgE,aAAY;QACZZ,WAAW,CAAC,EAAEzC,UAAU,cAAc,CAAC;QACvCsD,UAAUvC,OAAOwC;QACjBE,MAAK;QACLC,SAAS,CAACK;YACRA,EAAEC,cAAc;YAChB7B;QACF;QACA0B,OAAAA;QACAC,SAASpC,EAAE;SAKhBjB,oBAAM,oBAACsB;QAAekC,QAAQ3B;QAC9BjC;AAGP;AAEA,OAAO,MAAM6D,wBAAwB,CAAC9D;IACpC,qBAAO,oBAACD,WAAcC;AACxB,EAAC"}
1
+ {"version":3,"sources":["../../../../../../src/field/features/relationship/nodes/components/RelationshipComponent.tsx"],"sourcesContent":["'use client'\nimport type { ElementFormatType } from 'lexical'\n\nimport { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext.js'\nimport { useLexicalNodeSelection } from '@lexical/react/useLexicalNodeSelection.js'\nimport { getTranslation } from '@payloadcms/translations'\nimport { Button } from '@payloadcms/ui/elements/Button'\nimport { useDocumentDrawer } from '@payloadcms/ui/elements/DocumentDrawer'\nimport usePayloadAPI from '@payloadcms/ui/hooks/usePayloadAPI'\nimport { useConfig } from '@payloadcms/ui/providers/Config'\nimport { useTranslation } from '@payloadcms/ui/providers/Translation'\nimport { $getNodeByKey } from 'lexical'\nimport React, { useCallback, useReducer, useState } from 'react'\n\nimport type { RelationshipData } from '../RelationshipNode.js'\n\nimport { useEditorConfigContext } from '../../../../lexical/config/client/EditorConfigProvider.js'\nimport { INSERT_RELATIONSHIP_WITH_DRAWER_COMMAND } from '../../drawer/commands.js'\nimport './index.scss'\n\nconst baseClass = 'lexical-relationship'\n\nconst initialParams = {\n depth: 0,\n}\n\ntype Props = {\n children?: React.ReactNode\n className?: string\n data: RelationshipData\n format?: ElementFormatType\n nodeKey?: string\n}\n\nconst Component: React.FC<Props> = (props) => {\n const {\n children,\n data: { relationTo, value: id },\n nodeKey,\n } = props\n\n const [editor] = useLexicalComposerContext()\n const [isSelected, setSelected, clearSelection] = useLexicalNodeSelection(nodeKey)\n const { field } = useEditorConfigContext()\n const {\n collections,\n routes: { api },\n serverURL,\n } = useConfig()\n\n const [relatedCollection, setRelatedCollection] = useState(() =>\n collections.find((coll) => coll.slug === relationTo),\n )\n\n const { i18n, t } = useTranslation()\n const [cacheBust, dispatchCacheBust] = useReducer((state) => state + 1, 0)\n const [{ data }, { setParams }] = usePayloadAPI(\n `${serverURL}${api}/${relatedCollection.slug}/${id}`,\n { initialParams },\n )\n\n const [DocumentDrawer, DocumentDrawerToggler, { closeDrawer }] = useDocumentDrawer({\n id,\n collectionSlug: relatedCollection.slug,\n })\n\n const removeRelationship = useCallback(() => {\n editor.update(() => {\n $getNodeByKey(nodeKey).remove()\n })\n }, [editor, nodeKey])\n\n const updateRelationship = React.useCallback(\n ({ doc }) => {\n setParams({\n ...initialParams,\n cacheBust, // do this to get the usePayloadAPI to re-fetch the data even though the URL string hasn't changed\n })\n\n closeDrawer()\n dispatchCacheBust()\n },\n [cacheBust, setParams, closeDrawer],\n )\n\n return (\n <div\n className={[baseClass, isSelected && `${baseClass}--selected`].filter(Boolean).join(' ')}\n contentEditable={false}\n >\n <div className={`${baseClass}__wrap`}>\n <p className={`${baseClass}__label`}>\n {t('fields:labelRelationship', {\n label: getTranslation(relatedCollection.labels.singular, i18n),\n })}\n </p>\n <DocumentDrawerToggler className={`${baseClass}__doc-drawer-toggler`}>\n <p className={`${baseClass}__title`}>\n {data ? data[relatedCollection?.admin?.useAsTitle || 'id'] : id}\n </p>\n </DocumentDrawerToggler>\n </div>\n {editor.isEditable() && (\n <div className={`${baseClass}__actions`}>\n <Button\n buttonStyle=\"icon-label\"\n className={`${baseClass}__swapButton`}\n disabled={field?.readOnly}\n el=\"div\"\n icon=\"swap\"\n onClick={() => {\n editor.dispatchCommand(INSERT_RELATIONSHIP_WITH_DRAWER_COMMAND, {\n replace: { nodeKey },\n })\n }}\n round\n tooltip={t('fields:swapRelationship')}\n />\n <Button\n buttonStyle=\"icon-label\"\n className={`${baseClass}__removeButton`}\n disabled={field?.readOnly}\n icon=\"x\"\n onClick={(e) => {\n e.preventDefault()\n removeRelationship()\n }}\n round\n tooltip={t('fields:removeRelationship')}\n />\n </div>\n )}\n\n {id && <DocumentDrawer onSave={updateRelationship} />}\n {children}\n </div>\n )\n}\n\nexport const RelationshipComponent = (props: Props): React.ReactNode => {\n return <Component {...props} />\n}\n"],"names":["useLexicalComposerContext","useLexicalNodeSelection","getTranslation","Button","useDocumentDrawer","usePayloadAPI","useConfig","useTranslation","$getNodeByKey","React","useCallback","useReducer","useState","useEditorConfigContext","INSERT_RELATIONSHIP_WITH_DRAWER_COMMAND","baseClass","initialParams","depth","Component","props","children","data","relationTo","value","id","nodeKey","editor","isSelected","setSelected","clearSelection","field","collections","routes","api","serverURL","relatedCollection","setRelatedCollection","find","coll","slug","i18n","t","cacheBust","dispatchCacheBust","state","setParams","DocumentDrawer","DocumentDrawerToggler","closeDrawer","collectionSlug","removeRelationship","update","remove","updateRelationship","doc","div","className","filter","Boolean","join","contentEditable","p","label","labels","singular","admin","useAsTitle","isEditable","buttonStyle","disabled","readOnly","el","icon","onClick","dispatchCommand","replace","round","tooltip","e","preventDefault","onSave","RelationshipComponent"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA;AAGA,SAASA,yBAAyB,QAAQ,2CAA0C;AACpF,SAASC,uBAAuB,QAAQ,4CAA2C;AACnF,SAASC,cAAc,QAAQ,2BAA0B;AACzD,SAASC,MAAM,QAAQ,iCAAgC;AACvD,SAASC,iBAAiB,QAAQ,yCAAwC;AAC1E,OAAOC,mBAAmB,qCAAoC;AAC9D,SAASC,SAAS,QAAQ,kCAAiC;AAC3D,SAASC,cAAc,QAAQ,uCAAsC;AACrE,SAASC,aAAa,QAAQ,UAAS;AACvC,OAAOC,SAASC,WAAW,EAAEC,UAAU,EAAEC,QAAQ,QAAQ,QAAO;AAIhE,SAASC,sBAAsB,QAAQ,4DAA2D;AAClG,SAASC,uCAAuC,QAAQ,2BAA0B;AAClF,OAAO,eAAc;AAErB,MAAMC,YAAY;AAElB,MAAMC,gBAAgB;IACpBC,OAAO;AACT;AAUA,MAAMC,YAA6B,CAACC;IAClC,MAAM,EACJC,QAAQ,EACRC,MAAM,EAAEC,UAAU,EAAEC,OAAOC,EAAE,EAAE,EAC/BC,OAAO,EACR,GAAGN;IAEJ,MAAM,CAACO,OAAO,GAAG1B;IACjB,MAAM,CAAC2B,YAAYC,aAAaC,eAAe,GAAG5B,wBAAwBwB;IAC1E,MAAM,EAAEK,KA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O,CAAC;OAChC0B,EAAE,4BAA4B;QAC7BqB,OAAO5D,eAAeiC,kBAAkB4B,MAAM,CAACC,QAAQ,EAAExB;IAC3D,mBAEF,oBAACO;QAAsBS,WAAW,CAAC,EAAEzC,UAAU,oBAAoB,CAAC;qBAClE,oBAAC8C;QAAEL,WAAW,CAAC,EAAEzC,UAAU,OAAO,CAAC;OAChCM,OAAOA,IAAI,CAACc,mBAAmB8B,OAAOC,cAAc,KAAK,GAAG1C,OAIlEE,OAAOyC,UAAU,oBAChB,oBAACZ;QAAIC,WAAW,CAAC,EAAEzC,UAAU,SAAS,CAAC;qBACrC,oBAACZ;QACCiE,aAAY;QACZZ,WAAW,CAAC,EAAEzC,UAAU,YAAY,CAAC;QACrCsD,UAAUvC,OAAOwC;QACjBC,IAAG;QACHC,MAAK;QACLC,SAAS;YACP/C,OAAOgD,eAAe,CAAC5D,yCAAyC;gBAC9D6D,SAAS;oBAAElD;gBAAQ;YACrB;QACF;QACAmD,OAAAA;QACAC,SAASpC,EAAE;sBAEb,oBAACtC;QACCiE,aAAY;QACZZ,WAAW,CAAC,EAAEzC,UAAU,cAAc,CAAC;QACvCsD,UAAUvC,OAAOwC;QACjBE,MAAK;QACLC,SAAS,CAACK;YACRA,EAAEC,cAAc;YAChB7B;QACF;QACA0B,OAAAA;QACAC,SAASpC,EAAE;SAKhBjB,oBAAM,oBAACsB;QAAekC,QAAQ3B;QAC9BjC;AAGP;AAEA,OAAO,MAAM6D,wBAAwB,CAAC9D;IACpC,qBAAO,oBAACD,WAAcC;AACxB,EAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/field/features/relationship/plugins/index.tsx"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAA;AAI7C,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,sBAAsB,CAAA;AACpE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAA;AAKpE,eAAO,MAAM,2BAA2B,EAAE,cAAc,CAAC,gBAAgB,CAExE,CAAA;AAED,wBAAgB,kBAAkB,CAAC,KAAK,CAAC,EAAE,wBAAwB,GAAG,KAAK,CAAC,SAAS,CAqDpF"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/field/features/relationship/plugins/index.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAA;AAc7C,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,sBAAsB,CAAA;AACpE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAA;AAKpE,eAAO,MAAM,2BAA2B,EAAE,cAAc,CAAC,gBAAgB,CAExE,CAAA;AAED,wBAAgB,kBAAkB,CAAC,KAAK,CAAC,EAAE,wBAAwB,GAAG,KAAK,CAAC,SAAS,CAqDpF"}
@@ -1,11 +1,8 @@
1
1
  'use client';
2
- import lexicalComposerContextImport from '@lexical/react/LexicalComposerContext.js';
3
- const { useLexicalComposerContext } = lexicalComposerContextImport;
4
- import lexicalUtilsImport from '@lexical/utils';
5
- const { $insertNodeToNearestRoot } = lexicalUtilsImport;
6
- import lexicalImport from 'lexical';
7
- const { $getPreviousSelection, $getSelection, $isParagraphNode, $isRangeSelection, COMMAND_PRIORITY_EDITOR, createCommand } = lexicalImport;
2
+ import { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext.js';
3
+ import { $insertNodeToNearestRoot } from '@lexical/utils';
8
4
  import { useConfig } from '@payloadcms/ui/providers/Config';
5
+ import { $getPreviousSelection, $getSelection, $isParagraphNode, $isRangeSelection, COMMAND_PRIORITY_EDITOR, createCommand } from 'lexical';
9
6
  import { useEffect } from 'react';
10
7
  import React from 'react';
11
8
  import { RelationshipDrawer } from '../drawer/index.js';