@payloadcms/richtext-lexical 4.0.0-internal.1f9ae9a → 4.0.0-internal.203916b

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 (531) hide show
  1. package/LICENSE.md +1 -1
  2. package/dist/cell/rscEntry.d.ts.map +1 -1
  3. package/dist/cell/rscEntry.js +5 -5
  4. package/dist/cell/rscEntry.js.map +1 -1
  5. package/dist/exports/client/Field-XH5C4HFU.js +2 -0
  6. package/dist/exports/client/Field-XH5C4HFU.js.map +7 -0
  7. package/dist/exports/client/{RelationshipComponent-RZL743CS.js → RelationshipComponent-YCPAKOL7.js} +1 -1
  8. package/dist/exports/client/RelationshipComponent-YCPAKOL7.js.map +7 -0
  9. package/dist/exports/client/bundled.css +1 -1
  10. package/dist/exports/client/chunk-5VIL27GI.js +2 -0
  11. package/dist/exports/client/chunk-5VIL27GI.js.map +7 -0
  12. package/dist/exports/client/chunk-ESITTE3C.js +2 -0
  13. package/dist/exports/client/chunk-ESITTE3C.js.map +7 -0
  14. package/dist/exports/client/chunk-UD4DQ4AK.js +2 -0
  15. package/dist/exports/client/chunk-UD4DQ4AK.js.map +7 -0
  16. package/dist/exports/client/chunk-X3D4LZS7.js +2 -0
  17. package/dist/exports/client/chunk-X3D4LZS7.js.map +7 -0
  18. package/dist/exports/client/{component-CVM4OESA.js → component-PHZQBOJE.js} +2 -2
  19. package/dist/exports/client/component-PHZQBOJE.js.map +7 -0
  20. package/dist/exports/client/componentInline-H24N7GUG.js +2 -0
  21. package/dist/exports/client/index.d.ts +0 -1
  22. package/dist/exports/client/index.d.ts.map +1 -1
  23. package/dist/exports/client/index.js +20 -21
  24. package/dist/exports/client/index.js.map +4 -4
  25. package/dist/features/blockquote/client/index.js +2 -2
  26. package/dist/features/blockquote/client/index.js.map +1 -1
  27. package/dist/features/blockquote/server/index.d.ts +1 -4
  28. package/dist/features/blockquote/server/index.d.ts.map +1 -1
  29. package/dist/features/blockquote/server/index.js +4 -2
  30. package/dist/features/blockquote/server/index.js.map +1 -1
  31. package/dist/features/blockquote/server/schema.d.ts +8 -0
  32. package/dist/features/blockquote/server/schema.d.ts.map +1 -0
  33. package/dist/features/blockquote/server/schema.js +15 -0
  34. package/dist/features/blockquote/server/schema.js.map +1 -0
  35. package/dist/features/blocks/client/component/index.css +2 -2
  36. package/dist/features/blocks/client/component/index.d.ts +2 -1
  37. package/dist/features/blocks/client/component/index.d.ts.map +1 -1
  38. package/dist/features/blocks/client/component/index.js +16 -8
  39. package/dist/features/blocks/client/component/index.js.map +1 -1
  40. package/dist/features/blocks/client/componentInline/index.css +8 -8
  41. package/dist/features/blocks/client/componentInline/index.d.ts +2 -1
  42. package/dist/features/blocks/client/componentInline/index.d.ts.map +1 -1
  43. package/dist/features/blocks/client/componentInline/index.js +15 -7
  44. package/dist/features/blocks/client/componentInline/index.js.map +1 -1
  45. package/dist/features/blocks/client/index.d.ts.map +1 -1
  46. package/dist/features/blocks/client/index.js +4 -2
  47. package/dist/features/blocks/client/index.js.map +1 -1
  48. package/dist/features/blocks/client/markdown/getLexicalToMarkdown.d.ts +1 -1
  49. package/dist/features/blocks/client/markdown/getLexicalToMarkdown.d.ts.map +1 -1
  50. package/dist/features/blocks/client/markdown/getLexicalToMarkdown.js +1 -1
  51. package/dist/features/blocks/client/markdown/getLexicalToMarkdown.js.map +1 -1
  52. package/dist/features/blocks/client/markdown/getMarkdownToLexical.d.ts +1 -1
  53. package/dist/features/blocks/client/markdown/getMarkdownToLexical.d.ts.map +1 -1
  54. package/dist/features/blocks/client/markdown/getMarkdownToLexical.js +5 -2
  55. package/dist/features/blocks/client/markdown/getMarkdownToLexical.js.map +1 -1
  56. package/dist/features/blocks/client/markdown/markdownTransformer.d.ts +1 -2
  57. package/dist/features/blocks/client/markdown/markdownTransformer.d.ts.map +1 -1
  58. package/dist/features/blocks/client/markdown/markdownTransformer.js +4 -4
  59. package/dist/features/blocks/client/markdown/markdownTransformer.js.map +1 -1
  60. package/dist/features/blocks/client/nodes/BlocksNode.d.ts +1 -1
  61. package/dist/features/blocks/client/nodes/BlocksNode.d.ts.map +1 -1
  62. package/dist/features/blocks/client/nodes/BlocksNode.js.map +1 -1
  63. package/dist/features/blocks/client/nodes/InlineBlocksNode.d.ts +1 -1
  64. package/dist/features/blocks/client/nodes/InlineBlocksNode.d.ts.map +1 -1
  65. package/dist/features/blocks/client/nodes/InlineBlocksNode.js.map +1 -1
  66. package/dist/features/blocks/client/plugin/index.d.ts +1 -1
  67. package/dist/features/blocks/client/plugin/index.d.ts.map +1 -1
  68. package/dist/features/blocks/client/plugin/index.js.map +1 -1
  69. package/dist/features/blocks/premade/CodeBlock/Component/Block.d.ts.map +1 -1
  70. package/dist/features/blocks/premade/CodeBlock/Component/Block.js +1 -0
  71. package/dist/features/blocks/premade/CodeBlock/Component/Block.js.map +1 -1
  72. package/dist/features/blocks/premade/CodeBlock/Component/Collapse/index.css +1 -1
  73. package/dist/features/blocks/premade/CodeBlock/Component/FloatingCollapse/index.css +2 -4
  74. package/dist/features/blocks/premade/CodeBlock/Component/index.css +5 -5
  75. package/dist/features/blocks/server/graphQLPopulationPromise.d.ts +1 -2
  76. package/dist/features/blocks/server/graphQLPopulationPromise.d.ts.map +1 -1
  77. package/dist/features/blocks/server/graphQLPopulationPromise.js.map +1 -1
  78. package/dist/features/blocks/server/index.d.ts +1 -0
  79. package/dist/features/blocks/server/index.d.ts.map +1 -1
  80. package/dist/features/blocks/server/index.js +24 -72
  81. package/dist/features/blocks/server/index.js.map +1 -1
  82. package/dist/features/blocks/server/markdown/markdownTransformer.d.ts +1 -1
  83. package/dist/features/blocks/server/markdown/markdownTransformer.d.ts.map +1 -1
  84. package/dist/features/blocks/server/markdown/markdownTransformer.js +4 -4
  85. package/dist/features/blocks/server/markdown/markdownTransformer.js.map +1 -1
  86. package/dist/features/blocks/server/nodes/BlocksNode.d.ts +1 -18
  87. package/dist/features/blocks/server/nodes/BlocksNode.d.ts.map +1 -1
  88. package/dist/features/blocks/server/nodes/BlocksNode.js.map +1 -1
  89. package/dist/features/blocks/server/nodes/InlineBlocksNode.d.ts +2 -10
  90. package/dist/features/blocks/server/nodes/InlineBlocksNode.d.ts.map +1 -1
  91. package/dist/features/blocks/server/nodes/InlineBlocksNode.js.map +1 -1
  92. package/dist/features/blocks/server/schema.d.ts +45 -0
  93. package/dist/features/blocks/server/schema.d.ts.map +1 -0
  94. package/dist/features/blocks/server/schema.js +140 -0
  95. package/dist/features/blocks/server/schema.js.map +1 -0
  96. package/dist/features/blocks/server/validate.d.ts +1 -2
  97. package/dist/features/blocks/server/validate.d.ts.map +1 -1
  98. package/dist/features/blocks/server/validate.js.map +1 -1
  99. package/dist/features/converters/lexicalToHtml/async/converters/upload.js.map +1 -1
  100. package/dist/features/converters/lexicalToHtml/async/types.d.ts +14 -15
  101. package/dist/features/converters/lexicalToHtml/async/types.d.ts.map +1 -1
  102. package/dist/features/converters/lexicalToHtml/async/types.js.map +1 -1
  103. package/dist/features/converters/lexicalToHtml/sync/converters/upload.js.map +1 -1
  104. package/dist/features/converters/lexicalToHtml/sync/types.d.ts +14 -15
  105. package/dist/features/converters/lexicalToHtml/sync/types.d.ts.map +1 -1
  106. package/dist/features/converters/lexicalToHtml/sync/types.js.map +1 -1
  107. package/dist/features/converters/lexicalToJSX/Component/index.d.ts +4 -2
  108. package/dist/features/converters/lexicalToJSX/Component/index.d.ts.map +1 -1
  109. package/dist/features/converters/lexicalToJSX/Component/index.js +5 -4
  110. package/dist/features/converters/lexicalToJSX/Component/index.js.map +1 -1
  111. package/dist/features/converters/lexicalToJSX/converter/converters/upload.js.map +1 -1
  112. package/dist/features/converters/lexicalToJSX/converter/types.d.ts +12 -14
  113. package/dist/features/converters/lexicalToJSX/converter/types.d.ts.map +1 -1
  114. package/dist/features/converters/lexicalToJSX/converter/types.js.map +1 -1
  115. package/dist/features/converters/lexicalToMarkdown/index.d.ts.map +1 -1
  116. package/dist/features/converters/lexicalToMarkdown/index.js +1 -1
  117. package/dist/features/converters/lexicalToMarkdown/index.js.map +1 -1
  118. package/dist/features/converters/lexicalToPlaintext/sync/types.d.ts +12 -14
  119. package/dist/features/converters/lexicalToPlaintext/sync/types.d.ts.map +1 -1
  120. package/dist/features/converters/lexicalToPlaintext/sync/types.js.map +1 -1
  121. package/dist/features/converters/markdownToLexical/index.d.ts.map +1 -1
  122. package/dist/features/converters/markdownToLexical/index.js +5 -2
  123. package/dist/features/converters/markdownToLexical/index.js.map +1 -1
  124. package/dist/features/debug/jsxConverter/client/plugin/style.css +2 -2
  125. package/dist/features/experimental_table/client/index.js +2 -2
  126. package/dist/features/experimental_table/client/index.js.map +1 -1
  127. package/dist/features/experimental_table/markdownTransformer.d.ts +2 -2
  128. package/dist/features/experimental_table/markdownTransformer.d.ts.map +1 -1
  129. package/dist/features/experimental_table/markdownTransformer.js +6 -3
  130. package/dist/features/experimental_table/markdownTransformer.js.map +1 -1
  131. package/dist/features/experimental_table/server/index.d.ts +1 -6
  132. package/dist/features/experimental_table/server/index.d.ts.map +1 -1
  133. package/dist/features/experimental_table/server/index.js +6 -2
  134. package/dist/features/experimental_table/server/index.js.map +1 -1
  135. package/dist/features/experimental_table/server/schema.d.ts +27 -0
  136. package/dist/features/experimental_table/server/schema.d.ts.map +1 -0
  137. package/dist/features/experimental_table/server/schema.js +107 -0
  138. package/dist/features/experimental_table/server/schema.js.map +1 -0
  139. package/dist/features/format/bold/feature.client.js +1 -1
  140. package/dist/features/format/bold/feature.client.js.map +1 -1
  141. package/dist/features/format/bold/feature.server.d.ts.map +1 -1
  142. package/dist/features/format/bold/feature.server.js +1 -1
  143. package/dist/features/format/bold/feature.server.js.map +1 -1
  144. package/dist/features/format/inlineCode/feature.client.js +1 -1
  145. package/dist/features/format/inlineCode/feature.client.js.map +1 -1
  146. package/dist/features/format/inlineCode/feature.server.d.ts.map +1 -1
  147. package/dist/features/format/inlineCode/feature.server.js +1 -1
  148. package/dist/features/format/inlineCode/feature.server.js.map +1 -1
  149. package/dist/features/format/italic/feature.client.js +1 -1
  150. package/dist/features/format/italic/feature.client.js.map +1 -1
  151. package/dist/features/format/italic/feature.server.d.ts.map +1 -1
  152. package/dist/features/format/italic/feature.server.js +1 -1
  153. package/dist/features/format/italic/feature.server.js.map +1 -1
  154. package/dist/features/format/strikethrough/feature.client.js +1 -1
  155. package/dist/features/format/strikethrough/feature.client.js.map +1 -1
  156. package/dist/features/format/strikethrough/feature.server.d.ts.map +1 -1
  157. package/dist/features/format/strikethrough/feature.server.js +1 -1
  158. package/dist/features/format/strikethrough/feature.server.js.map +1 -1
  159. package/dist/features/heading/client/index.js +2 -2
  160. package/dist/features/heading/client/index.js.map +1 -1
  161. package/dist/features/heading/markdownTransformer.d.ts +2 -2
  162. package/dist/features/heading/markdownTransformer.d.ts.map +1 -1
  163. package/dist/features/heading/markdownTransformer.js +6 -19
  164. package/dist/features/heading/markdownTransformer.js.map +1 -1
  165. package/dist/features/heading/server/index.d.ts +2 -4
  166. package/dist/features/heading/server/index.d.ts.map +1 -1
  167. package/dist/features/heading/server/index.js +4 -2
  168. package/dist/features/heading/server/index.js.map +1 -1
  169. package/dist/features/heading/server/schema.d.ts +10 -0
  170. package/dist/features/heading/server/schema.d.ts.map +1 -0
  171. package/dist/features/heading/server/schema.js +37 -0
  172. package/dist/features/heading/server/schema.js.map +1 -0
  173. package/dist/features/horizontalRule/client/index.js +2 -2
  174. package/dist/features/horizontalRule/client/index.js.map +1 -1
  175. package/dist/features/horizontalRule/client/markdownTransformer.d.ts +2 -2
  176. package/dist/features/horizontalRule/client/markdownTransformer.d.ts.map +1 -1
  177. package/dist/features/horizontalRule/client/markdownTransformer.js +1 -1
  178. package/dist/features/horizontalRule/client/markdownTransformer.js.map +1 -1
  179. package/dist/features/horizontalRule/client/nodes/HorizontalRuleNode.d.ts +1 -1
  180. package/dist/features/horizontalRule/client/nodes/HorizontalRuleNode.d.ts.map +1 -1
  181. package/dist/features/horizontalRule/client/nodes/HorizontalRuleNode.js.map +1 -1
  182. package/dist/features/horizontalRule/client/plugin/index.css +2 -2
  183. package/dist/features/horizontalRule/server/index.d.ts +1 -0
  184. package/dist/features/horizontalRule/server/index.d.ts.map +1 -1
  185. package/dist/features/horizontalRule/server/index.js +4 -2
  186. package/dist/features/horizontalRule/server/index.js.map +1 -1
  187. package/dist/features/horizontalRule/server/markdownTransformer.d.ts +2 -2
  188. package/dist/features/horizontalRule/server/markdownTransformer.d.ts.map +1 -1
  189. package/dist/features/horizontalRule/server/markdownTransformer.js +1 -1
  190. package/dist/features/horizontalRule/server/markdownTransformer.js.map +1 -1
  191. package/dist/features/horizontalRule/server/nodes/HorizontalRuleNode.d.ts +1 -5
  192. package/dist/features/horizontalRule/server/nodes/HorizontalRuleNode.d.ts.map +1 -1
  193. package/dist/features/horizontalRule/server/nodes/HorizontalRuleNode.js.map +1 -1
  194. package/dist/features/horizontalRule/server/schema.d.ts +7 -0
  195. package/dist/features/horizontalRule/server/schema.d.ts.map +1 -0
  196. package/dist/features/horizontalRule/server/schema.js +25 -0
  197. package/dist/features/horizontalRule/server/schema.js.map +1 -0
  198. package/dist/features/link/client/index.d.ts.map +1 -1
  199. package/dist/features/link/client/index.js +2 -2
  200. package/dist/features/link/client/index.js.map +1 -1
  201. package/dist/features/link/client/plugins/autoLink/index.d.ts +1 -1
  202. package/dist/features/link/client/plugins/autoLink/index.d.ts.map +1 -1
  203. package/dist/features/link/client/plugins/autoLink/index.js.map +1 -1
  204. package/dist/features/link/client/plugins/floatingLinkEditor/LinkEditor/index.js +3 -3
  205. package/dist/features/link/client/plugins/floatingLinkEditor/LinkEditor/index.js.map +1 -1
  206. package/dist/features/link/client/plugins/floatingLinkEditor/index.css +7 -11
  207. package/dist/features/link/client/plugins/floatingLinkEditor/types.d.ts +1 -1
  208. package/dist/features/link/client/plugins/floatingLinkEditor/types.d.ts.map +1 -1
  209. package/dist/features/link/client/plugins/floatingLinkEditor/types.js.map +1 -1
  210. package/dist/features/link/client/plugins/link/index.js.map +1 -1
  211. package/dist/features/link/markdownTransformer.d.ts +5 -5
  212. package/dist/features/link/markdownTransformer.d.ts.map +1 -1
  213. package/dist/features/link/markdownTransformer.js +2 -2
  214. package/dist/features/link/markdownTransformer.js.map +1 -1
  215. package/dist/features/link/markdownTransformer.spec.js +10 -10
  216. package/dist/features/link/markdownTransformer.spec.js.map +1 -1
  217. package/dist/features/link/nodes/AutoLinkNode.d.ts +3 -3
  218. package/dist/features/link/nodes/AutoLinkNode.d.ts.map +1 -1
  219. package/dist/features/link/nodes/AutoLinkNode.js +2 -1
  220. package/dist/features/link/nodes/AutoLinkNode.js.map +1 -1
  221. package/dist/features/link/nodes/LinkNode.d.ts +3 -3
  222. package/dist/features/link/nodes/LinkNode.d.ts.map +1 -1
  223. package/dist/features/link/nodes/LinkNode.js +2 -1
  224. package/dist/features/link/nodes/LinkNode.js.map +1 -1
  225. package/dist/features/link/server/baseFields.js.map +1 -1
  226. package/dist/features/link/server/graphQLPopulationPromise.d.ts +1 -1
  227. package/dist/features/link/server/graphQLPopulationPromise.d.ts.map +1 -1
  228. package/dist/features/link/server/graphQLPopulationPromise.js.map +1 -1
  229. package/dist/features/link/server/index.d.ts +2 -1
  230. package/dist/features/link/server/index.d.ts.map +1 -1
  231. package/dist/features/link/server/index.js +5 -2
  232. package/dist/features/link/server/index.js.map +1 -1
  233. package/dist/features/link/server/schema.d.ts +32 -0
  234. package/dist/features/link/server/schema.d.ts.map +1 -0
  235. package/dist/features/link/server/schema.js +171 -0
  236. package/dist/features/link/server/schema.js.map +1 -0
  237. package/dist/features/link/server/validate.d.ts +1 -1
  238. package/dist/features/link/server/validate.d.ts.map +1 -1
  239. package/dist/features/link/server/validate.js.map +1 -1
  240. package/dist/features/lists/checklist/client/index.js +1 -1
  241. package/dist/features/lists/checklist/client/index.js.map +1 -1
  242. package/dist/features/lists/checklist/server/index.d.ts.map +1 -1
  243. package/dist/features/lists/checklist/server/index.js +4 -1
  244. package/dist/features/lists/checklist/server/index.js.map +1 -1
  245. package/dist/features/lists/orderedList/client/index.js +1 -1
  246. package/dist/features/lists/orderedList/client/index.js.map +1 -1
  247. package/dist/features/lists/orderedList/server/index.d.ts.map +1 -1
  248. package/dist/features/lists/orderedList/server/index.js +4 -1
  249. package/dist/features/lists/orderedList/server/index.js.map +1 -1
  250. package/dist/features/lists/plugin/index.d.ts +0 -9
  251. package/dist/features/lists/plugin/index.d.ts.map +1 -1
  252. package/dist/features/lists/plugin/index.js.map +1 -1
  253. package/dist/features/lists/shared/schema.d.ts +18 -0
  254. package/dist/features/lists/shared/schema.d.ts.map +1 -0
  255. package/dist/features/lists/shared/schema.js +62 -0
  256. package/dist/features/lists/shared/schema.js.map +1 -0
  257. package/dist/features/lists/unorderedList/client/index.js +1 -1
  258. package/dist/features/lists/unorderedList/client/index.js.map +1 -1
  259. package/dist/features/lists/unorderedList/server/index.d.ts.map +1 -1
  260. package/dist/features/lists/unorderedList/server/index.js +4 -1
  261. package/dist/features/lists/unorderedList/server/index.js.map +1 -1
  262. package/dist/features/relationship/client/components/RelationshipComponent.d.ts +1 -1
  263. package/dist/features/relationship/client/components/RelationshipComponent.d.ts.map +1 -1
  264. package/dist/features/relationship/client/components/RelationshipComponent.js.map +1 -1
  265. package/dist/features/relationship/client/nodes/RelationshipNode.d.ts +1 -1
  266. package/dist/features/relationship/client/nodes/RelationshipNode.d.ts.map +1 -1
  267. package/dist/features/relationship/client/nodes/RelationshipNode.js.map +1 -1
  268. package/dist/features/relationship/client/plugins/index.d.ts +1 -1
  269. package/dist/features/relationship/client/plugins/index.d.ts.map +1 -1
  270. package/dist/features/relationship/client/plugins/index.js.map +1 -1
  271. package/dist/features/relationship/client/utils/useEnabledRelationships.d.ts.map +1 -1
  272. package/dist/features/relationship/client/utils/useEnabledRelationships.js +9 -40
  273. package/dist/features/relationship/client/utils/useEnabledRelationships.js.map +1 -1
  274. package/dist/features/relationship/server/graphQLPopulationPromise.d.ts +1 -1
  275. package/dist/features/relationship/server/graphQLPopulationPromise.d.ts.map +1 -1
  276. package/dist/features/relationship/server/graphQLPopulationPromise.js.map +1 -1
  277. package/dist/features/relationship/server/index.d.ts +1 -0
  278. package/dist/features/relationship/server/index.d.ts.map +1 -1
  279. package/dist/features/relationship/server/index.js +2 -0
  280. package/dist/features/relationship/server/index.js.map +1 -1
  281. package/dist/features/relationship/server/nodes/RelationshipNode.d.ts +1 -10
  282. package/dist/features/relationship/server/nodes/RelationshipNode.d.ts.map +1 -1
  283. package/dist/features/relationship/server/nodes/RelationshipNode.js.map +1 -1
  284. package/dist/features/relationship/server/schema.d.ts +28 -0
  285. package/dist/features/relationship/server/schema.d.ts.map +1 -0
  286. package/dist/features/relationship/server/schema.js +97 -0
  287. package/dist/features/relationship/server/schema.js.map +1 -0
  288. package/dist/features/relationship/shared/filterEnabledRelationshipCollections.d.ts +23 -0
  289. package/dist/features/relationship/shared/filterEnabledRelationshipCollections.d.ts.map +1 -0
  290. package/dist/features/relationship/shared/filterEnabledRelationshipCollections.js +34 -0
  291. package/dist/features/relationship/shared/filterEnabledRelationshipCollections.js.map +1 -0
  292. package/dist/features/textState/feature.client.js +1 -1
  293. package/dist/features/textState/feature.client.js.map +1 -1
  294. package/dist/features/toolbars/fixed/client/Toolbar/index.css +2 -2
  295. package/dist/features/toolbars/inline/client/Toolbar/index.css +2 -13
  296. package/dist/features/toolbars/shared/ToolbarDropdown/index.css +8 -12
  297. package/dist/features/toolbars/shared/useToolbarStates.d.ts.map +1 -1
  298. package/dist/features/toolbars/shared/useToolbarStates.js +3 -1
  299. package/dist/features/toolbars/shared/useToolbarStates.js.map +1 -1
  300. package/dist/features/typesClient.d.ts +1 -1
  301. package/dist/features/typesClient.d.ts.map +1 -1
  302. package/dist/features/typesClient.js.map +1 -1
  303. package/dist/features/typesServer.d.ts +18 -41
  304. package/dist/features/typesServer.d.ts.map +1 -1
  305. package/dist/features/typesServer.js.map +1 -1
  306. package/dist/features/upload/client/component/index.css +11 -11
  307. package/dist/features/upload/client/component/index.d.ts +1 -1
  308. package/dist/features/upload/client/component/index.d.ts.map +1 -1
  309. package/dist/features/upload/client/component/index.js.map +1 -1
  310. package/dist/features/upload/client/nodes/UploadNode.d.ts +1 -1
  311. package/dist/features/upload/client/nodes/UploadNode.d.ts.map +1 -1
  312. package/dist/features/upload/client/nodes/UploadNode.js.map +1 -1
  313. package/dist/features/upload/client/plugin/index.d.ts +1 -1
  314. package/dist/features/upload/client/plugin/index.d.ts.map +1 -1
  315. package/dist/features/upload/client/plugin/index.js +5 -5
  316. package/dist/features/upload/client/plugin/index.js.map +1 -1
  317. package/dist/features/upload/server/graphQLPopulationPromise.d.ts +1 -1
  318. package/dist/features/upload/server/graphQLPopulationPromise.d.ts.map +1 -1
  319. package/dist/features/upload/server/graphQLPopulationPromise.js.map +1 -1
  320. package/dist/features/upload/server/index.d.ts +1 -0
  321. package/dist/features/upload/server/index.d.ts.map +1 -1
  322. package/dist/features/upload/server/index.js +5 -4
  323. package/dist/features/upload/server/index.js.map +1 -1
  324. package/dist/features/upload/server/markdownTransformer.d.ts +2 -2
  325. package/dist/features/upload/server/markdownTransformer.d.ts.map +1 -1
  326. package/dist/features/upload/server/markdownTransformer.js +1 -1
  327. package/dist/features/upload/server/markdownTransformer.js.map +1 -1
  328. package/dist/features/upload/server/nodes/UploadNode.d.ts +1 -55
  329. package/dist/features/upload/server/nodes/UploadNode.d.ts.map +1 -1
  330. package/dist/features/upload/server/nodes/UploadNode.js.map +1 -1
  331. package/dist/features/upload/server/nodes/conversions.d.ts.map +1 -1
  332. package/dist/features/upload/server/nodes/conversions.js.map +1 -1
  333. package/dist/features/upload/server/schema.d.ts +52 -0
  334. package/dist/features/upload/server/schema.d.ts.map +1 -0
  335. package/dist/features/upload/server/schema.js +149 -0
  336. package/dist/features/upload/server/schema.js.map +1 -0
  337. package/dist/features/upload/server/validate.d.ts +1 -1
  338. package/dist/features/upload/server/validate.d.ts.map +1 -1
  339. package/dist/features/upload/server/validate.js.map +1 -1
  340. package/dist/field/Diff/converters/unknown/index.css +1 -1
  341. package/dist/field/Diff/converters/upload/index.js.map +1 -1
  342. package/dist/field/Field.js +1 -1
  343. package/dist/field/Field.js.map +1 -1
  344. package/dist/field/ViewSelector.css +1 -1
  345. package/dist/field/bundled.css +1 -1
  346. package/dist/field/index.css +5 -5
  347. package/dist/field/index.js +1 -1
  348. package/dist/field/index.js.map +1 -1
  349. package/dist/field/rscEntry.d.ts.map +1 -1
  350. package/dist/field/rscEntry.js +2 -0
  351. package/dist/field/rscEntry.js.map +1 -1
  352. package/dist/index.d.ts +10 -7
  353. package/dist/index.d.ts.map +1 -1
  354. package/dist/index.js +3 -3
  355. package/dist/index.js.map +1 -1
  356. package/dist/lexical/LexicalEditor.css +2 -2
  357. package/dist/lexical/config/client/loader.d.ts.map +1 -1
  358. package/dist/lexical/config/client/loader.js +5 -1
  359. package/dist/lexical/config/client/loader.js.map +1 -1
  360. package/dist/lexical/config/server/sanitize.d.ts.map +1 -1
  361. package/dist/lexical/config/server/sanitize.js +9 -11
  362. package/dist/lexical/config/server/sanitize.js.map +1 -1
  363. package/dist/lexical/plugins/DecoratorPlugin/index.css +1 -1
  364. package/dist/lexical/plugins/MarkdownShortcut/index.d.ts.map +1 -1
  365. package/dist/lexical/plugins/MarkdownShortcut/index.js +1 -1
  366. package/dist/lexical/plugins/MarkdownShortcut/index.js.map +1 -1
  367. package/dist/lexical/plugins/SlashMenu/index.css +1 -5
  368. package/dist/lexical/plugins/handles/AddBlockHandlePlugin/index.css +1 -1
  369. package/dist/lexical/plugins/handles/DraggableBlockPlugin/index.css +3 -3
  370. package/dist/lexical/plugins/handles/DraggableBlockPlugin/index.js +1 -1
  371. package/dist/lexical/plugins/handles/DraggableBlockPlugin/index.js.map +1 -1
  372. package/dist/lexical/theme/EditorTheme.css +18 -19
  373. package/dist/lexical/ui/ContentEditable.css +5 -5
  374. package/dist/lexical/utils/markdown/convertFromMarkdownString.d.ts +17 -0
  375. package/dist/lexical/utils/markdown/convertFromMarkdownString.d.ts.map +1 -0
  376. package/dist/lexical/utils/markdown/convertFromMarkdownString.js +27 -0
  377. package/dist/lexical/utils/markdown/convertFromMarkdownString.js.map +1 -0
  378. package/dist/lexical/utils/markdown/convertFromMarkdownString.spec.js +88 -0
  379. package/dist/lexical/utils/markdown/convertFromMarkdownString.spec.js.map +1 -0
  380. package/dist/lexical/utils/markdown/createBlockNode.d.ts +1 -1
  381. package/dist/lexical/utils/markdown/createBlockNode.d.ts.map +1 -1
  382. package/dist/lexical/utils/markdown/createBlockNode.js.map +1 -1
  383. package/dist/lexical/utils/markdown/normalizeMarkdown.d.ts +25 -0
  384. package/dist/lexical/utils/markdown/normalizeMarkdown.d.ts.map +1 -0
  385. package/dist/lexical/utils/markdown/normalizeMarkdown.js +91 -0
  386. package/dist/lexical/utils/markdown/normalizeMarkdown.js.map +1 -0
  387. package/dist/lexical-proxy/@lexical-markdown.d.ts +1 -1
  388. package/dist/lexical-proxy/@lexical-markdown.d.ts.map +1 -1
  389. package/dist/lexical-proxy/@lexical-markdown.js +1 -1
  390. package/dist/lexical-proxy/@lexical-markdown.js.map +1 -1
  391. package/dist/types/builtInNodes.d.ts +14 -0
  392. package/dist/types/builtInNodes.d.ts.map +1 -0
  393. package/dist/types/builtInNodes.js +203 -0
  394. package/dist/types/builtInNodes.js.map +1 -0
  395. package/dist/types/index.d.ts +16 -17
  396. package/dist/types/index.d.ts.map +1 -1
  397. package/dist/types/index.js.map +1 -1
  398. package/dist/types/jsonSchemaHelpers.d.ts +30 -0
  399. package/dist/types/jsonSchemaHelpers.d.ts.map +1 -0
  400. package/dist/types/jsonSchemaHelpers.js +58 -0
  401. package/dist/types/jsonSchemaHelpers.js.map +1 -0
  402. package/dist/types/nodeTypes.d.ts +115 -61
  403. package/dist/types/nodeTypes.d.ts.map +1 -1
  404. package/dist/types/nodeTypes.js +3 -2
  405. package/dist/types/nodeTypes.js.map +1 -1
  406. package/dist/types/schema.d.ts.map +1 -1
  407. package/dist/types/schema.js +74 -65
  408. package/dist/types/schema.js.map +1 -1
  409. package/dist/utilities/applyBaseFilterToFields.d.ts.map +1 -1
  410. package/dist/utilities/applyBaseFilterToFields.js +1 -2
  411. package/dist/utilities/applyBaseFilterToFields.js.map +1 -1
  412. package/dist/utilities/buildEditorState.d.ts +17 -3
  413. package/dist/utilities/buildEditorState.d.ts.map +1 -1
  414. package/dist/utilities/buildEditorState.js +8 -0
  415. package/dist/utilities/buildEditorState.js.map +1 -1
  416. package/dist/utilities/buildInitialState.d.ts +2 -1
  417. package/dist/utilities/buildInitialState.d.ts.map +1 -1
  418. package/dist/utilities/buildInitialState.js.map +1 -1
  419. package/dist/utilities/fieldsDrawer/Drawer.d.ts.map +1 -1
  420. package/dist/utilities/fieldsDrawer/Drawer.js +19 -10
  421. package/dist/utilities/fieldsDrawer/Drawer.js.map +1 -1
  422. package/dist/utilities/fieldsDrawer/DrawerContent.d.ts +4 -1
  423. package/dist/utilities/fieldsDrawer/DrawerContent.d.ts.map +1 -1
  424. package/dist/utilities/fieldsDrawer/DrawerContent.js +8 -7
  425. package/dist/utilities/fieldsDrawer/DrawerContent.js.map +1 -1
  426. package/dist/utilities/fieldsDrawer/index.css +12 -0
  427. package/dist/utilities/fieldsDrawer/useDrawerSubmit.d.ts +29 -0
  428. package/dist/utilities/fieldsDrawer/useDrawerSubmit.d.ts.map +1 -0
  429. package/dist/utilities/fieldsDrawer/useDrawerSubmit.js +97 -0
  430. package/dist/utilities/fieldsDrawer/useDrawerSubmit.js.map +1 -0
  431. package/dist/utilities/upgradeLexicalData/upgradeDocumentFieldsRecursively.js +1 -1
  432. package/dist/utilities/upgradeLexicalData/upgradeDocumentFieldsRecursively.js.map +1 -1
  433. package/package.json +22 -26
  434. package/dist/exports/client/Field-G5Z2HM5Y.js +0 -2
  435. package/dist/exports/client/Field-G5Z2HM5Y.js.map +0 -7
  436. package/dist/exports/client/RelationshipComponent-RZL743CS.js.map +0 -7
  437. package/dist/exports/client/chunk-6QWQ7JV4.js +0 -2
  438. package/dist/exports/client/chunk-6QWQ7JV4.js.map +0 -7
  439. package/dist/exports/client/chunk-FEJXFRL7.js +0 -2
  440. package/dist/exports/client/chunk-FEJXFRL7.js.map +0 -7
  441. package/dist/exports/client/chunk-INBEEENE.js +0 -2
  442. package/dist/exports/client/chunk-INBEEENE.js.map +0 -7
  443. package/dist/exports/client/chunk-LH634DPU.js +0 -12
  444. package/dist/exports/client/chunk-LH634DPU.js.map +0 -7
  445. package/dist/exports/client/component-CVM4OESA.js.map +0 -7
  446. package/dist/exports/client/componentInline-JJZ2NKW2.js +0 -2
  447. package/dist/features/blockquote/markdownTransformer.d.ts +0 -3
  448. package/dist/features/blockquote/markdownTransformer.d.ts.map +0 -1
  449. package/dist/features/blockquote/markdownTransformer.js +0 -33
  450. package/dist/features/blockquote/markdownTransformer.js.map +0 -1
  451. package/dist/features/format/bold/markdownTransformers.d.ts +0 -6
  452. package/dist/features/format/bold/markdownTransformers.d.ts.map +0 -1
  453. package/dist/features/format/bold/markdownTransformers.js +0 -23
  454. package/dist/features/format/bold/markdownTransformers.js.map +0 -1
  455. package/dist/features/format/inlineCode/markdownTransformers.d.ts +0 -3
  456. package/dist/features/format/inlineCode/markdownTransformers.d.ts.map +0 -1
  457. package/dist/features/format/inlineCode/markdownTransformers.js +0 -6
  458. package/dist/features/format/inlineCode/markdownTransformers.js.map +0 -1
  459. package/dist/features/format/italic/markdownTransformers.d.ts +0 -4
  460. package/dist/features/format/italic/markdownTransformers.d.ts.map +0 -1
  461. package/dist/features/format/italic/markdownTransformers.js +0 -12
  462. package/dist/features/format/italic/markdownTransformers.js.map +0 -1
  463. package/dist/features/format/strikethrough/markdownTransformers.d.ts +0 -3
  464. package/dist/features/format/strikethrough/markdownTransformers.d.ts.map +0 -1
  465. package/dist/features/format/strikethrough/markdownTransformers.js +0 -6
  466. package/dist/features/format/strikethrough/markdownTransformers.js.map +0 -1
  467. package/dist/features/link/nodes/types.d.ts +0 -27
  468. package/dist/features/link/nodes/types.d.ts.map +0 -1
  469. package/dist/features/link/nodes/types.js +0 -2
  470. package/dist/features/link/nodes/types.js.map +0 -1
  471. package/dist/features/lists/checklist/markdownTransformers.d.ts +0 -3
  472. package/dist/features/lists/checklist/markdownTransformers.d.ts.map +0 -1
  473. package/dist/features/lists/checklist/markdownTransformers.js +0 -12
  474. package/dist/features/lists/checklist/markdownTransformers.js.map +0 -1
  475. package/dist/features/lists/orderedList/markdownTransformer.d.ts +0 -3
  476. package/dist/features/lists/orderedList/markdownTransformer.d.ts.map +0 -1
  477. package/dist/features/lists/orderedList/markdownTransformer.js +0 -12
  478. package/dist/features/lists/orderedList/markdownTransformer.js.map +0 -1
  479. package/dist/features/lists/shared/markdown.d.ts +0 -6
  480. package/dist/features/lists/shared/markdown.d.ts.map +0 -1
  481. package/dist/features/lists/shared/markdown.js +0 -57
  482. package/dist/features/lists/shared/markdown.js.map +0 -1
  483. package/dist/features/lists/unorderedList/markdownTransformer.d.ts +0 -3
  484. package/dist/features/lists/unorderedList/markdownTransformer.d.ts.map +0 -1
  485. package/dist/features/lists/unorderedList/markdownTransformer.js +0 -12
  486. package/dist/features/lists/unorderedList/markdownTransformer.js.map +0 -1
  487. package/dist/lexical/utils/guard.d.ts +0 -5
  488. package/dist/lexical/utils/guard.d.ts.map +0 -1
  489. package/dist/lexical/utils/guard.js +0 -9
  490. package/dist/lexical/utils/guard.js.map +0 -1
  491. package/dist/lexical-proxy/@lexical-react/LexicalContextMenuPlugin.d.ts +0 -2
  492. package/dist/lexical-proxy/@lexical-react/LexicalContextMenuPlugin.d.ts.map +0 -1
  493. package/dist/lexical-proxy/@lexical-react/LexicalContextMenuPlugin.js +0 -2
  494. package/dist/lexical-proxy/@lexical-react/LexicalContextMenuPlugin.js.map +0 -1
  495. package/dist/packages/@lexical/markdown/MarkdownExport.d.ts +0 -14
  496. package/dist/packages/@lexical/markdown/MarkdownExport.d.ts.map +0 -1
  497. package/dist/packages/@lexical/markdown/MarkdownExport.js +0 -213
  498. package/dist/packages/@lexical/markdown/MarkdownExport.js.map +0 -1
  499. package/dist/packages/@lexical/markdown/MarkdownImport.d.ts +0 -19
  500. package/dist/packages/@lexical/markdown/MarkdownImport.d.ts.map +0 -1
  501. package/dist/packages/@lexical/markdown/MarkdownImport.js +0 -198
  502. package/dist/packages/@lexical/markdown/MarkdownImport.js.map +0 -1
  503. package/dist/packages/@lexical/markdown/MarkdownShortcuts.d.ts +0 -11
  504. package/dist/packages/@lexical/markdown/MarkdownShortcuts.d.ts.map +0 -1
  505. package/dist/packages/@lexical/markdown/MarkdownShortcuts.js +0 -304
  506. package/dist/packages/@lexical/markdown/MarkdownShortcuts.js.map +0 -1
  507. package/dist/packages/@lexical/markdown/MarkdownTransformers.d.ts +0 -147
  508. package/dist/packages/@lexical/markdown/MarkdownTransformers.d.ts.map +0 -1
  509. package/dist/packages/@lexical/markdown/MarkdownTransformers.js +0 -268
  510. package/dist/packages/@lexical/markdown/MarkdownTransformers.js.map +0 -1
  511. package/dist/packages/@lexical/markdown/importTextFormatTransformer.d.ts +0 -22
  512. package/dist/packages/@lexical/markdown/importTextFormatTransformer.d.ts.map +0 -1
  513. package/dist/packages/@lexical/markdown/importTextFormatTransformer.js +0 -91
  514. package/dist/packages/@lexical/markdown/importTextFormatTransformer.js.map +0 -1
  515. package/dist/packages/@lexical/markdown/importTextMatchTransformer.d.ts +0 -21
  516. package/dist/packages/@lexical/markdown/importTextMatchTransformer.d.ts.map +0 -1
  517. package/dist/packages/@lexical/markdown/importTextMatchTransformer.js +0 -54
  518. package/dist/packages/@lexical/markdown/importTextMatchTransformer.js.map +0 -1
  519. package/dist/packages/@lexical/markdown/importTextTransformers.d.ts +0 -18
  520. package/dist/packages/@lexical/markdown/importTextTransformers.d.ts.map +0 -1
  521. package/dist/packages/@lexical/markdown/importTextTransformers.js +0 -54
  522. package/dist/packages/@lexical/markdown/importTextTransformers.js.map +0 -1
  523. package/dist/packages/@lexical/markdown/index.d.ts +0 -29
  524. package/dist/packages/@lexical/markdown/index.d.ts.map +0 -1
  525. package/dist/packages/@lexical/markdown/index.js +0 -39
  526. package/dist/packages/@lexical/markdown/index.js.map +0 -1
  527. package/dist/packages/@lexical/markdown/utils.d.ts +0 -34
  528. package/dist/packages/@lexical/markdown/utils.d.ts.map +0 -1
  529. package/dist/packages/@lexical/markdown/utils.js +0 -267
  530. package/dist/packages/@lexical/markdown/utils.js.map +0 -1
  531. /package/dist/exports/client/{componentInline-JJZ2NKW2.js.map → componentInline-H24N7GUG.js.map} +0 -0
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/features/relationship/client/components/RelationshipComponent.tsx"],
4
- "sourcesContent": ["'use client'\nimport type { ElementFormatType } from 'lexical'\n\nimport { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext.js'\nimport { useLexicalEditable } from '@lexical/react/useLexicalEditable'\nimport { getTranslation } from '@payloadcms/translations'\nimport { Button, useConfig, usePayloadAPI, useTranslation } from '@payloadcms/ui'\nimport { $getNodeByKey, $getSelection, $isNodeSelection, $isRangeSelection } from 'lexical'\nimport { formatAdminURL } from 'payload/shared'\nimport React, { useCallback, useEffect, useReducer, useRef, useState } from 'react'\n\nimport type { RelationshipData } from '../../server/nodes/RelationshipNode.js'\n\nimport './index.css'\nimport { useLexicalDocumentDrawer } from '../../../../utilities/fieldsDrawer/useLexicalDocumentDrawer.js'\nimport { INSERT_RELATIONSHIP_WITH_DRAWER_COMMAND } from '../drawer/commands.js'\n\nconst initialParams = {\n depth: 0,\n}\n\ntype Props = {\n className: string\n data: RelationshipData\n format?: ElementFormatType\n nodeKey?: string\n}\n\nexport const RelationshipComponent: React.FC<Props> = (props) => {\n const {\n className: baseClass,\n data: { relationTo, value },\n nodeKey,\n } = props\n\n if (typeof value === 'object') {\n throw new Error(\n 'Relationship value should be a string or number. The Lexical Relationship component should not receive the populated value object.',\n )\n }\n\n const relationshipElemRef = useRef<HTMLDivElement | null>(null)\n\n const [editor] = useLexicalComposerContext()\n const isEditable = useLexicalEditable()\n const [isSelected, setIsSelected] = useState(false)\n const {\n config: {\n routes: { api },\n serverURL,\n },\n getEntityConfig,\n } = useConfig()\n\n const [relatedCollection] = useState(() => getEntityConfig({ collectionSlug: relationTo }))\n\n const { i18n, t } = useTranslation()\n const [cacheBust, dispatchCacheBust] = useReducer((state) => state + 1, 0)\n const [{ data }, { setParams }] = usePayloadAPI(\n formatAdminURL({ apiRoute: api, path: `/${relatedCollection.slug}/${value}`, serverURL }),\n { initialParams },\n )\n\n const { closeDocumentDrawer, DocumentDrawer, DocumentDrawerToggler } = useLexicalDocumentDrawer({\n id: value,\n collectionSlug: relatedCollection.slug,\n })\n\n useEffect(() => {\n return editor.registerUpdateListener(({ editorState }) => {\n editorState.read(() => {\n const selection = $getSelection()\n\n if ($isNodeSelection(selection)) {\n setIsSelected(selection.has(nodeKey!))\n } else if ($isRangeSelection(selection)) {\n const nodes = selection.getNodes()\n setIsSelected(nodes.some((node) => node.getKey() === nodeKey))\n } else {\n setIsSelected(false)\n }\n })\n })\n }, [editor, nodeKey])\n\n useEffect(() => {\n const outerEl = relationshipElemRef.current?.closest(`.${baseClass}`)\n\n if (outerEl) {\n outerEl.classList.toggle(`${baseClass}--selected`, isSelected)\n }\n }, [isSelected, baseClass])\n\n const removeRelationship = useCallback(() => {\n editor.update(() => {\n $getNodeByKey(nodeKey!)?.remove()\n })\n }, [editor, nodeKey])\n\n const updateRelationship = React.useCallback(() => {\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 closeDocumentDrawer()\n dispatchCacheBust()\n }, [cacheBust, setParams, closeDocumentDrawer])\n\n return (\n <div className={`${baseClass}__contents`} contentEditable={false} ref={relationshipElemRef}>\n <div className={`${baseClass}__wrap`}>\n <p className={`${baseClass}__label`}>\n {t('fields:labelRelationship', {\n label: relatedCollection.labels?.singular\n ? getTranslation(relatedCollection.labels?.singular, i18n)\n : relatedCollection.slug,\n })}\n </p>\n <DocumentDrawerToggler className={`${baseClass}__doc-drawer-toggler`}>\n <p className={`${baseClass}__title`}>\n {data ? data[relatedCollection?.admin?.useAsTitle || 'id'] : value}\n </p>\n </DocumentDrawerToggler>\n </div>\n {isEditable && (\n <div className={`${baseClass}__actions`}>\n <Button\n buttonStyle=\"ghost\"\n className={`${baseClass}__swapButton`}\n disabled={!isEditable}\n el=\"button\"\n icon=\"swap\"\n onClick={() => {\n if (nodeKey) {\n editor.dispatchCommand(INSERT_RELATIONSHIP_WITH_DRAWER_COMMAND, {\n replace: { nodeKey },\n })\n }\n }}\n round\n tooltip={t('fields:swapRelationship')}\n />\n <Button\n buttonStyle=\"ghost\"\n className={`${baseClass}__removeButton`}\n disabled={!isEditable}\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 {!!value && <DocumentDrawer onSave={updateRelationship} />}\n </div>\n )\n}\n"],
5
- "mappings": "+IAGA,OAASA,6BAAAA,MAAiC,2CAC1C,OAASC,sBAAAA,MAA0B,oCACnC,OAASC,kBAAAA,MAAsB,2BAC/B,OAASC,UAAAA,EAAQC,aAAAA,EAAWC,iBAAAA,EAAeC,kBAAAA,MAAsB,iBACjE,OAASC,iBAAAA,EAAeC,iBAAAA,EAAeC,oBAAAA,EAAkBC,qBAAAA,MAAyB,UAClF,OAASC,kBAAAA,MAAsB,iBAC/B,OAAOC,GAASC,eAAAA,EAAaC,aAAAA,EAAWC,cAAAA,EAAYC,UAAAA,EAAQC,YAAAA,MAAgB,QAM5E,IAAAC,EAASC,CAET,MAAMD,GAENE,GAAAC,GAAA,CASA,GAAO,CACL,UAAMC,EACJC,KAAAA,CACAC,WAAAA,EAAQC,MAAAA,GAAiB,QAAAC,GACzBA,EAAO,GACLL,OAAAM,GAAA,SAEJ,MAAI,IAAOA,MAAA,oIAAoB,EAI/B,IAAAC,EAAAC,EAAA,IAAA,EAEMD,CAAAA,CAAAA,EAAAA,EAAoD,EAEpDE,EAAWC,EAAAA,EACXD,CAAAA,EAA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AAAiC,EAAAjC,CAAA,CAAA,EACEiC,EAAgBc,EAAA,YAAA,IAAA,CAEpBzB,EAAM0B,CACJ1B,GAAAA,EACE,UAAAD,IAEFM,EAAA,EAEAA,EAAAA,GACAT,CAAAA,EAAAA,EAAAS,CAAA,CAAA,EACF,OAAeL,EAAWK,MAAAA,CAE1B,UAAA,GAAA/B,CACE,aAAKC,gBAAcD,GAAuBqD,IAAAA,EAAwBC,SAAKhD,CAAAiD,EAAA,MAAA,eACrEA,SAAKtD,SAAA,CAAcuD,EAAA,IAAiB,eAClCA,UAAGvD,SAAAmB,EAAW,2BAAqB,SAC9B,QAAA,SAA4BqC,EAAAxC,EAAA,QAAA,SAAAE,CAAA,EAAAF,EAAA,SAI/BuC,EAAAvB,EAAA,eAEDA,uBAAsBhC,SAAcuD,EAAA,IAAA,WACnC,GAAAxD,CAAAwD,UAAGvD,SAAAC,EAAcF,EAAAA,GAAkB,OAAA,YAAA,IAAA,EAAAK,+BAKtCG,GAAAR,CAAA,YACMC,SAAA,CAAcuD,EAAAE,EAAoB,qBAEnCC,UAAA,GAAY3D,CAAA,eACZC,SAAA,CAAWO,EACXoD,GAAAA,SACAC,KAAG,OACHC,QAAK,IAAA,CACLC,GACE1B,EAAIjC,gBAASP,EAAA,CACXwC,QAAO2B,CACLC,QAAAA,MAGN,MAAA,GACAC,QAAK9C,EAAA,yBAAA,IACMoC,EAAAE,EAAA,qBAGXC,UAAA,GAAY3D,CAAA,iBACZC,SAAA,CAAWO,EACXoD,KAAAA,IACAE,QAAKK,GAAA,CACLJ,EAAAA,eAAU,EACRI,EAAgB,GAElB,MAAA,GACAD,QAAK9C,EAAA,2BAAA,GACLgD,qBAKH/D,GAAyBgE",
6
- "names": ["useLexicalComposerContext", "useLexicalEditable", "getTranslation", "Button", "useConfig", "usePayloadAPI", "useTranslation", "$getNodeByKey", "$getSelection", "$isNodeSelection", "$isRangeSelection", "formatAdminURL", "React", "useCallback", "useEffect", "useReducer", "useRef", "useState", "initialParams", "INSERT_RELATIONSHIP_WITH_DRAWER_COMMAND", "RelationshipComponent", "props", "baseClass", "className", "data", "relationTo", "nodeKey", "value", "relationshipElemRef", "useRef", "isEditable", "useLexicalComposerContext", "useLexicalEditable", "config", "routes", "serverURL", "getEntityConfig", "useConfig", "useState", "relatedCollection", "collectionSlug", "i18n", "t", "useTranslation", "dispatchCacheBust", "useReducer", "state", "cacheBust", "setParams", "usePayloadAPI", "apiRoute", "api", "path", "closeDocumentDrawer", "DocumentDrawer", "DocumentDrawerToggler", "useLexicalDocumentDrawer", "id", "useEffect", "editor", "editorState", "$getSelection", "$isNodeSelection", "setIsSelected", "selection", "nodes", "$isRangeSelection", "getNodes", "node", "outerEl", "isSelected", "useCallback", "removeRelationship", "React", "updateRelationship", "contentEditable", "ref", "_jsxs", "_jsx", "getTranslation", "Button", "buttonStyle", "disabled", "el", "icon", "onClick", "dispatchCommand", "replace", "round", "e", "tooltip", "onSave"]
7
- }
@@ -1,2 +0,0 @@
1
- import{b as R}from"./chunk-RJ5MAOKZ.js";import{c as q}from"react/compiler-runtime";import{jsx as x}from"react/jsx-runtime";import{Drawer as z,EditDepthProvider as G,useModal as J}from"@payloadcms/ui";import"react";import{jsx as O,jsxs as M}from"react/jsx-runtime";import{useLexicalEditable as j}from"@lexical/react/useLexicalEditable";import{Form as T,FormSubmit as v,RenderFields as N,useDocumentForm as W,useDocumentInfo as $,useServerFunctions as k,useTranslation as L}from"@payloadcms/ui";import{abortAndIgnore as _}from"@payloadcms/ui/shared";import{deepCopyObjectSimpleWithoutReactComponents as y}from"payload/shared";import{useCallback as B,useEffect as I,useRef as H,useState as U}from"react";import{v4 as V}from"uuid";var E=({data:f,featureKey:e,fieldMapOverride:p,handleDrawerSubmit:h,schemaFieldsPathOverride:o,schemaPath:g,schemaPathSuffix:m})=>{let{t:S}=L(),{id:a,collectionSlug:n,getDocPreferences:i,globalSlug:s}=$(),{fields:l}=W(),r=j(),t=H(new AbortController),[c,w]=U(!1),{fieldProps:{featureClientSchemaMap:P}}=R(),{getFormState:C}=k(),u=o??`${g}.lexical_internal_feature.${e}${m?`.${m}`:""}`,b=p??P[e]?.[u];I(()=>{let d=new AbortController;return(async()=>{let{state:D}=await C({id:a,collectionSlug:n,data:f??{},docPermissions:{fields:!0},docPreferences:await i(),documentFormState:y(l,{excludeFiles:!0}),globalSlug:s,initialBlockData:f,operation:"update",readOnly:!r,renderAllFields:!0,schemaPath:u,signal:d.signal});w(D)})(),()=>{_(d)}},[u,a,f,C,n,r,s,i,l]);let F=B(async({formState:d})=>{_(t.current);let A=new AbortController;t.current=A;let{state:D}=await C({id:a,collectionSlug:n,docPermissions:{fields:!0},docPreferences:await i(),documentFormState:y(l,{excludeFiles:!0}),formState:d,globalSlug:s,initialBlockFormState:d,operation:"update",readOnly:!r,schemaPath:u,signal:A.signal});return D||d},[C,a,r,n,i,l,s,u]);return I(()=>()=>{_(t.current)},[]),c===!1?null:M(T,{beforeSubmit:[F],disableValidationOnSubmit:!0,fields:Array.isArray(b)?b:[],initialState:c,onChange:[F],onSubmit:h,uuid:V(),children:[O(N,{fields:Array.isArray(b)?b:[],forceRender:!0,parentIndexPath:"",parentPath:"",parentSchemaPath:u,permissions:!0,readOnly:!r}),O(v,{children:S("fields:saveChanges")})]})};var de=f=>{let e=q(15),{className:p,data:h,drawerSlug:o,drawerTitle:g,featureKey:m,fieldMapOverride:S,handleDrawerSubmit:a,schemaFieldsPathOverride:n,schemaPath:i,schemaPathSuffix:s}=f,{closeModal:l}=J(),r=g??"",t;e[0]!==l||e[1]!==o||e[2]!==a?(t=(w,P)=>{l(o),setTimeout(()=>{a(w,P)},1)},e[0]=l,e[1]=o,e[2]=a,e[3]=t):t=e[3];let c;return e[4]!==p||e[5]!==h||e[6]!==o||e[7]!==m||e[8]!==S||e[9]!==n||e[10]!==i||e[11]!==s||e[12]!==r||e[13]!==t?(c=x(G,{children:x(z,{className:p,slug:o,title:r,children:x(E,{data:h,featureKey:m,fieldMapOverride:S,handleDrawerSubmit:t,schemaFieldsPathOverride:n,schemaPath:i,schemaPathSuffix:s})})}),e[4]=p,e[5]=h,e[6]=o,e[7]=m,e[8]=S,e[9]=n,e[10]=i,e[11]=s,e[12]=r,e[13]=t,e[14]=c):c=e[14],c};import{createCommand as K}from"lexical";var he=K("INSERT_UPLOAD_WITH_DRAWER_COMMAND");export{de as a,he as b};
2
- //# sourceMappingURL=chunk-6QWQ7JV4.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/utilities/fieldsDrawer/Drawer.tsx", "../../../src/utilities/fieldsDrawer/DrawerContent.tsx", "../../../src/features/upload/client/drawer/commands.ts"],
4
- "sourcesContent": ["'use client'\nimport type { ClientField, Data, FormState, JsonObject } from 'payload'\n\nimport { Drawer, EditDepthProvider, useModal } from '@payloadcms/ui'\nimport React from 'react'\n\nimport { DrawerContent } from './DrawerContent.js'\n\nexport type FieldsDrawerProps = {\n readonly className?: string\n readonly data?: Data\n readonly drawerSlug: string\n readonly drawerTitle?: string\n readonly featureKey: string\n readonly fieldMapOverride?: ClientField[]\n readonly handleDrawerSubmit: (fields: FormState, data: JsonObject) => void\n readonly schemaFieldsPathOverride?: string\n readonly schemaPath: string\n readonly schemaPathSuffix?: string\n}\n\n/**\n * This FieldsDrawer component can be used to easily create a Drawer that contains a form with fields within your feature.\n * The fields are taken directly from the schema map based on your `featureKey` and `schemaPathSuffix`. Thus, this can only\n * be used if you provide your field schema inside the `generateSchemaMap` prop of your feature.server.ts.\n */\nexport const FieldsDrawer: React.FC<FieldsDrawerProps> = ({\n className,\n data,\n drawerSlug,\n drawerTitle,\n featureKey,\n fieldMapOverride,\n handleDrawerSubmit,\n schemaFieldsPathOverride,\n schemaPath,\n schemaPathSuffix,\n}) => {\n const { closeModal } = useModal()\n // The Drawer only renders its children (and itself) if it's open. Thus, by extracting the main content\n // to DrawerContent, this should be faster\n return (\n <EditDepthProvider>\n <Drawer className={className} slug={drawerSlug} title={drawerTitle ?? ''}>\n <DrawerContent\n data={data}\n featureKey={featureKey}\n fieldMapOverride={fieldMapOverride}\n handleDrawerSubmit={(args, args2) => {\n // Simply close drawer - no need for useLexicalDrawer here as at this point,\n // we don't need to restore the cursor position. This is handled by the useEffect in useLexicalDrawer.\n closeModal(drawerSlug)\n\n // Actual drawer submit logic needs to be triggered after the drawer is closed.\n // That's because the lexical selection / cursor restore logic that is striggerer by\n // `useLexicalDrawer` neeeds to be triggered before any editor.update calls that may happen\n // in the `handleDrawerSubmit` function.\n setTimeout(() => {\n handleDrawerSubmit(args, args2)\n }, 1)\n }}\n schemaFieldsPathOverride={schemaFieldsPathOverride}\n schemaPath={schemaPath}\n schemaPathSuffix={schemaPathSuffix}\n />\n </Drawer>\n </EditDepthProvider>\n )\n}\n", "'use client'\nimport type { FormState } from 'payload'\n\nimport { useLexicalEditable } from '@lexical/react/useLexicalEditable'\nimport {\n Form,\n FormSubmit,\n RenderFields,\n useDocumentForm,\n useDocumentInfo,\n useServerFunctions,\n useTranslation,\n} from '@payloadcms/ui'\nimport { abortAndIgnore } from '@payloadcms/ui/shared'\nimport { deepCopyObjectSimpleWithoutReactComponents } from 'payload/shared'\nimport React, { useCallback, useEffect, useRef, useState } from 'react'\nimport { v4 as uuid } from 'uuid'\n\nimport type { FieldsDrawerProps } from './Drawer.js'\n\nimport { useEditorConfigContext } from '../../lexical/config/client/EditorConfigProvider.js'\n\nexport const DrawerContent: React.FC<Omit<FieldsDrawerProps, 'drawerSlug' | 'drawerTitle'>> = ({\n data,\n featureKey,\n fieldMapOverride,\n handleDrawerSubmit,\n schemaFieldsPathOverride,\n schemaPath,\n schemaPathSuffix,\n}) => {\n const { t } = useTranslation()\n const { id, collectionSlug, getDocPreferences, globalSlug } = useDocumentInfo()\n const { fields: parentDocumentFields } = useDocumentForm()\n const isEditable = useLexicalEditable()\n\n const onChangeAbortControllerRef = useRef(new AbortController())\n\n const [initialState, setInitialState] = useState<false | FormState | undefined>(false)\n\n const {\n fieldProps: { featureClientSchemaMap },\n } = useEditorConfigContext()\n\n const { getFormState } = useServerFunctions()\n\n const schemaFieldsPath =\n schemaFieldsPathOverride ??\n `${schemaPath}.lexical_internal_feature.${featureKey}${schemaPathSuffix ? `.${schemaPathSuffix}` : ''}`\n\n const fields: any = fieldMapOverride ?? featureClientSchemaMap[featureKey]?.[schemaFieldsPath] // Field Schema\n\n useEffect(() => {\n const controller = new AbortController()\n\n const awaitInitialState = async () => {\n const { state } = await getFormState({\n id,\n collectionSlug,\n data: data ?? {},\n docPermissions: {\n fields: true,\n },\n docPreferences: await getDocPreferences(),\n documentFormState: deepCopyObjectSimpleWithoutReactComponents(parentDocumentFields, {\n excludeFiles: true,\n }),\n globalSlug,\n initialBlockData: data,\n operation: 'update',\n readOnly: !isEditable,\n renderAllFields: true,\n schemaPath: schemaFieldsPath,\n signal: controller.signal,\n })\n\n setInitialState(state)\n }\n\n void awaitInitialState()\n\n return () => {\n abortAndIgnore(controller)\n }\n }, [\n schemaFieldsPath,\n id,\n data,\n getFormState,\n collectionSlug,\n isEditable,\n globalSlug,\n getDocPreferences,\n parentDocumentFields,\n ])\n\n const onChange = useCallback(\n async ({ formState: prevFormState }: { formState: FormState }) => {\n abortAndIgnore(onChangeAbortControllerRef.current)\n\n const controller = new AbortController()\n onChangeAbortControllerRef.current = controller\n\n const { state } = await getFormState({\n id,\n collectionSlug,\n docPermissions: {\n fields: true,\n },\n docPreferences: await getDocPreferences(),\n documentFormState: deepCopyObjectSimpleWithoutReactComponents(parentDocumentFields, {\n excludeFiles: true,\n }),\n formState: prevFormState,\n globalSlug,\n initialBlockFormState: prevFormState,\n operation: 'update',\n readOnly: !isEditable,\n schemaPath: schemaFieldsPath,\n signal: controller.signal,\n })\n\n if (!state) {\n return prevFormState\n }\n\n return state\n },\n [\n getFormState,\n id,\n isEditable,\n collectionSlug,\n getDocPreferences,\n parentDocumentFields,\n globalSlug,\n schemaFieldsPath,\n ],\n )\n\n // cleanup effect\n useEffect(() => {\n return () => {\n abortAndIgnore(onChangeAbortControllerRef.current)\n }\n }, [])\n\n if (initialState === false) {\n return null\n }\n\n return (\n <Form\n beforeSubmit={[onChange]}\n disableValidationOnSubmit\n fields={Array.isArray(fields) ? fields : []}\n initialState={initialState}\n onChange={[onChange]}\n onSubmit={handleDrawerSubmit}\n uuid={uuid()}\n >\n <RenderFields\n fields={Array.isArray(fields) ? fields : []}\n forceRender\n parentIndexPath=\"\"\n parentPath=\"\" // See Blocks feature path for details as for why this is empty\n parentSchemaPath={schemaFieldsPath}\n permissions={true}\n readOnly={!isEditable}\n />\n <FormSubmit>{t('fields:saveChanges')}</FormSubmit>\n </Form>\n )\n}\n", "'use client'\nimport type { LexicalCommand } from 'lexical'\n\nimport { createCommand } from 'lexical'\n\nexport const INSERT_UPLOAD_WITH_DRAWER_COMMAND: LexicalCommand<{\n replace: { nodeKey: string } | false\n}> = createCommand('INSERT_UPLOAD_WITH_DRAWER_COMMAND')\n"],
5
- "mappings": "wCAAA,OAAAA,KAAAC,MAAA,iEAGA,OAASC,UAAAA,EAAQC,qBAAAA,EAAmBC,YAAAA,MAAgB,iBACpD,MAAkB,0DCDlB,OAASC,sBAAAA,MAA0B,oCACnC,OACEC,QAAAA,EACAC,cAAAA,EACAC,gBAAAA,EACAC,mBAAAA,EACAC,mBAAAA,EACAC,sBAAAA,EACAC,kBAAAA,MACK,iBACP,OAASC,kBAAAA,MAAsB,wBAC/B,OAASC,8CAAAA,MAAkD,iBAC3D,OAAgBC,eAAAA,EAAaC,aAAAA,EAAWC,UAAAA,EAAQC,YAAAA,MAAgB,QAChE,OAASC,MAAMC,MAAY,OAMpB,IAAMC,EAAiFA,CAAC,CAC7FC,KAAAA,EACAC,WAAAA,EACAC,iBAAAA,EACAC,mBAAAA,EACAC,yBAAAA,EACAC,WAAAA,EACAC,iBAAAA,CAAgB,IACjB,CACC,GAAM,CAAEC,EAAAA,CAAC,EAAKC,EAAA,EACR,CAAEC,GAAAA,EAAIC,eAAAA,EAAgBC,kBAAAA,EAAmBC,WAAAA,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9CO,EAAAA,CAAAC,EAAAC,IAAA,CAGlBL,EAAWR,CAAA,EAMXc,WAAA,IAAA,CACEV,EAAmBQ,EAAMC,CAAA,CAAA,EAAA,CACxB,CAAA,EACLjB,EAAA,CAAA,EAAAY,EAAAZ,EAAA,CAAA,EAAAI,EAAAJ,EAAA,CAAA,EAAAQ,EAAAR,EAAA,CAAA,EAAAe,GAAAA,EAAAf,EAAA,CAAA,EAAA,IAAAmB,EAAA,OAAAnB,EAAA,CAAA,IAAAE,GAAAF,EAAA,CAAA,IAAAG,GAAAH,EAAA,CAAA,IAAAI,GAAAJ,EAAA,CAAA,IAAAM,GAAAN,EAAA,CAAA,IAAAO,GAAAP,EAAA,CAAA,IAAAS,GAAAT,EAAA,EAAA,IAAAU,GAAAV,EAAA,EAAA,IAAAW,GAAAX,EAAA,EAAA,IAAAc,GAAAd,EAAA,EAAA,IAAAe,GAlBNI,EAAAC,EAAAC,EAAA,CAAAC,SACEF,EAAAG,EAAA,CAAArB,UAAAA,EAAAsB,KAAoCpB,EAAAqB,MAAmBX,EAAeQ,SACpEF,EAAAM,EAAA,CAAAvB,KAAAA,EAAAG,WAAAA,EAAAC,iBAAAA,EAAAC,mBAIsBO,EAYpBN,yBAAAA,EAAAC,WAAAA,EAAAC,iBAAAA,CAAA,CAAA,iGAlBNQ,GEvCJ,OAASQ,iBAAAA,MAAqB,UAEvB,IAAMC,GAERD,EAAc,mCAAA",
6
- "names": ["c", "_c", "Drawer", "EditDepthProvider", "useModal", "useLexicalEditable", "Form", "FormSubmit", "RenderFields", "useDocumentForm", "useDocumentInfo", "useServerFunctions", "useTranslation", "abortAndIgnore", "deepCopyObjectSimpleWithoutReactComponents", "useCallback", "useEffect", "useRef", "useState", "v4", "uuid", "DrawerContent", "data", "featureKey", "fieldMapOverride", "handleDrawerSubmit", "schemaFieldsPathOverride", "schemaPath", "schemaPathSuffix", "t", "useTranslation", "id", "collectionSlug", "getDocPreferences", "globalSlug", "useDocumentInfo", "fields", "parentDocumentFields", "useDocumentForm", "isEditable", "useLexicalEditable", "onChangeAbortControllerRef", "useRef", "AbortController", "initialState", "setInitialState", "useState", "fieldProps", "featureClientSchemaMap", "useEditorConfigContext", "getFormState", "useServerFunctions", "schemaFieldsPath", "useEffect", "controller", "state", "docPermissions", "docPreferences", "documentFormState", "deepCopyObjectSimpleWithoutReactComponents", "excludeFiles", "initialBlockData", "operation", "readOnly", "renderAllFields", "signal", "abortAndIgnore", "onChange", "useCallback", "formState", "prevFormState", "current", "initialBlockFormState", "_jsxs", "Form", "beforeSubmit", "disableValidationOnSubmit", "Array", "isArray", "onSubmit", "uuid", "_jsx", "RenderFields", "forceRender", "parentIndexPath", "parentPath", "parentSchemaPath", "permissions", "FormSubmit", "FieldsDrawer", "t0", "$", "_c", "className", "data", "drawerSlug", "drawerTitle", "featureKey", "fieldMapOverride", "handleDrawerSubmit", "schemaFieldsPathOverride", "schemaPath", "schemaPathSuffix", "closeModal", "useModal", "t1", "t2", "args", "args2", "setTimeout", "t3", "_jsx", "EditDepthProvider", "children", "Drawer", "slug", "title", "DrawerContent", "createCommand", "INSERT_UPLOAD_WITH_DRAWER_COMMAND"]
7
- }
@@ -1,2 +0,0 @@
1
- import{a as ue}from"./chunk-INBEEENE.js";import{b as ae}from"./chunk-RJ5MAOKZ.js";import{jsx as l,jsxs as _,Fragment as Re}from"react/jsx-runtime";import{useLexicalComposerContext as je}from"@lexical/react/LexicalComposerContext";import{useLexicalEditable as Me}from"@lexical/react/useLexicalEditable";import{getTranslation as me}from"@payloadcms/translations";import{Button as de,Drawer as Ke,EditDepthProvider as Ae,Form as Je,formatDrawerSlug as ze,FormSubmit as Ve,RenderFields as He,ShimmerEffect as We,useConfig as Xe,useDocumentForm as Ge,useDocumentInfo as Ue,useEditDepth as qe,useServerFunctions as Qe,useTranslation as Ye}from"@payloadcms/ui";import{abortAndIgnore as J}from"@payloadcms/ui/shared";import{$getNodeByKey as z,SKIP_DOM_SELECTION_TAG as fe}from"lexical";import{deepCopyObjectSimpleWithoutReactComponents as V,reduceFieldsToValues as Ze}from"payload/shared";import F,{createContext as et,useCallback as H,useEffect as E,useMemo as B,useRef as y}from"react";import{v4 as tt}from"uuid";import{jsx as Oe}from"react/jsx-runtime";import Te from"bson-objectid";import{$applyNodeReplacement as Ee}from"lexical";import $e from"react";import{addClassNamesToElement as De}from"@lexical/utils";import Ie from"bson-objectid";import{$applyNodeReplacement as ve,DecoratorNode as we}from"lexical";var S=class extends we{__cacheBuster;__fields;constructor({cacheBuster:t,fields:e,key:i}){super(i),this.__fields=e,this.__cacheBuster=t||0}static clone(t){return new this({cacheBuster:t.__cacheBuster,fields:t.__fields,key:t.__key})}static getType(){return"inlineBlock"}static importDOM(){return{}}static importJSON(t){return Ne(t.fields)}static isInline(){return!1}canIndent(){return!0}createDOM(t){let e=document.createElement("span");return De(e,t?.theme?.inlineBlock),e}decorate(t,e){return null}exportDOM(){let t=document.createElement("span");t.classList.add("inline-block-container");let e=document.createTextNode(this.getTextContent());return t.append(e),{element:t}}exportJSON(){return{type:"inlineBlock",fields:this.getFields(),version:1}}getCacheBuster(){return this.getLatest().__cacheBuster}getFields(){return this.getLatest().__fields}getTextContent(){return"Block Field"}isInline(){return!0}setFields(t,e){let i=this.getWritable();i.__fields=t,e||i.__cacheBuster++}updateDOM(){return!1}};function Ne(c){return ve(new S({fields:{...c,id:c?.id||new Ie.default().toHexString()}}))}var Le=$e.lazy(()=>import("./componentInline-JJZ2NKW2.js").then(c=>({default:c.InlineBlockComponent}))),T=class extends S{static clone(t){return super.clone(t)}static getType(){return super.getType()}static importJSON(t){return Pe(t.fields)}decorate(...[t,e,i,f]){return Oe(Le,{cacheBuster:this.getCacheBuster(),className:e.theme.inlineBlock??"LexicalEditorTheme__inlineBlock",CustomBlock:i,CustomLabel:f,formData:this.getFields(),nodeKey:this.getKey()})}exportJSON(){return super.exportJSON()}};function Pe(c){return Ee(new T({fields:{...c,id:c?.id||new Te.default().toHexString()}}))}function A(c){return c instanceof T}var be=et({initialState:!1}),pe=()=>F.use(be),Dt=c=>{let{cacheBuster:t,className:e,CustomBlock:i,CustomLabel:f,formData:n,nodeKey:a}=c,[h]=je(),u=Me(),{i18n:$,t:k}=Ye(),{createdInlineBlock:W,fieldProps:{featureClientSchemaMap:ke,initialLexicalFormState:he,schemaPath:X},setCreatedInlineBlock:G,uuid:Be}=ae(),{fields:D}=Ge(),{getFormState:I}=Qe(),Ce=qe(),U=y(!1),[m,L]=F.useState(()=>{let r=he?.[n.id]?.formState;return r?Object.fromEntries(Object.entries(r).map(([s,o])=>[s,s in n?{...o,initialValue:n[s],value:n[s]}:o])):!1}),q=y(!1),Q=y(t);E(()=>{q.current?(Q.current!==t&&L(!1),Q.current=t):q.current=!0},[t]);let[ge]=F.useState(()=>tt()),[Y,Z]=F.useState(()=>{if(!f)return m?._components?.customComponents?.BlockLabel??void 0}),[ee,te]=F.useState(()=>{if(!i)return m?._components?.customComponents?.Block??void 0}),ne=B(()=>i?l(i,{className:e,formData:n,isEditor:!0,isJSXConverter:!1,nodeKey:a,useInlineBlockComponentContext:pe}):ee,[i,e,n,a,ee]),P=B(()=>f?l(f,{className:e,formData:n,isEditor:!0,isJSXConverter:!1,nodeKey:a,useInlineBlockComponentContext:pe}):Y,[f,e,n,a,Y]),oe=ze({slug:`lexical-inlineBlocks-create-${Be}-${n.id}`,depth:Ce}),{toggleDrawer:b}=ue(oe,!0),xe=y(null),{id:v,collectionSlug:w,getDocPreferences:N,globalSlug:O}=Ue(),{config:Se}=Xe(),_e=`${X}.lexical_internal_feature.blocks.lexical_inline_blocks.${n.blockType}`,C=ke.blocks?.[_e]?.[0],d=C.blockReferences?typeof C?.blockReferences?.[0]=="string"?Se.blocksMap[C?.blockReferences?.[0]]:C?.blockReferences?.[0]:C?.blocks?.[0],re=d?.fields??[];E(()=>{!U.current&&W?.getKey()===a&&(re.length>2&&b(),G?.(void 0),U.current=!0)},[re.length,W,a,G,b]);let se=H(()=>{h.update(()=>{z(a)?.remove()})},[h,a]),g=d?.labels?.singular?me(d?.labels.singular,$):d?.slug,R=y(new AbortController),x=`${X}.lexical_internal_feature.blocks.lexical_inline_blocks.${d?.slug}.fields`;E(()=>{let r=new AbortController;return n&&!m&&(async()=>{let{state:o}=await I({id:v,collectionSlug:w,data:n,docPermissions:{fields:!0},docPreferences:await N(),documentFormState:V(D,{excludeFiles:!0}),globalSlug:O,initialBlockData:n,initialBlockFormState:n,operation:"update",readOnly:!u,renderAllFields:!0,schemaPath:x,signal:r.signal});if(o){let p=Ze(V(o,{excludeFiles:!0}),!0);h.update(()=>{let K=z(a);if(K&&A(K)){let ce=p;ce.blockType=n.blockType,K.setFields(ce,!0)}},{tag:fe}),L(o),f||Z(o._components?.customComponents?.BlockLabel),i||te(o._components?.customComponents?.Block)}})(),()=>{J(r)}},[I,h,a,u,f,i,x,v,n,m,w,O,N,D]);let le=H(async({formState:r,submit:s})=>{J(R.current);let o=new AbortController;R.current=o;let{state:p}=await I({id:v,collectionSlug:w,docPermissions:{fields:!0},docPreferences:await N(),documentFormState:V(D,{excludeFiles:!0}),formState:r,globalSlug:O,initialBlockFormState:r,operation:"update",readOnly:!u,renderAllFields:!!s,schemaPath:x,signal:o.signal});return p?(s&&(f||Z(p._components?.customComponents?.BlockLabel),i||te(p._components?.customComponents?.Block)),p):r},[I,v,w,N,D,O,u,x,i,f]);E(()=>{let r=(s,o)=>Object.keys(o).some(p=>o[p]&&s[p]!==o[p].value);return()=>{m&&r(n,m)&&L(!1),J(R.current)}},[n,m]);let ye=H((r,s)=>{s.blockType=n.blockType,h.update(()=>{let o=z(a);o&&A(o)&&o.setFields(s,!0)},{tag:fe})},[h,a,n]),j=B(()=>()=>l(de,{buttonStyle:"ghost",className:`${e}__removeButton`,disabled:!u,icon:"x",onClick:r=>{r.preventDefault(),r.stopPropagation(),se()},round:!0,size:"medium",tooltip:k("lexical:blocks:inlineBlocks:remove",{label:g})}),[e,g,u,se,k]),Fe=B(()=>()=>l(de,{buttonStyle:"ghost",className:`${e}__editButton`,disabled:!u,el:"button",icon:"edit",onClick:()=>{b()},round:!0,size:"medium",tooltip:k("lexical:blocks:inlineBlocks:edit",{label:g})}),[e,g,u,k,b]),M=B(()=>({children:r,className:s})=>l("div",{className:[`${e}__container`,e+"-"+n.blockType,s].filter(Boolean).join(" "),...u?{onClick:()=>b(),onKeyDown:o=>{(o.key==="Enter"||o.key===" ")&&(o.preventDefault(),b())},role:"button",tabIndex:0}:{},ref:xe,children:r}),[e,n.blockType,u,b]),ie=B(()=>P?()=>P:()=>l("div",{children:d?.labels?me(d?.labels.singular,$):""}),[P,d?.labels,$]);return d?_(Je,{beforeSubmit:[async({formState:r})=>await le({formState:r,submit:!0})],disableValidationOnSubmit:!0,el:"div",fields:d?.fields,initialState:m||{},onChange:[le],onSubmit:(r,s)=>{ye(r,s),b()},uuid:ge,children:[l(Ae,{children:l(Ke,{className:"",slug:oe,title:k(`lexical:blocks:inlineBlocks:${n?.id?"edit":"create"}`,{label:g??k("lexical:blocks:inlineBlocks:label")}),children:m?_(Re,{children:[l(He,{fields:d?.fields,forceRender:!0,parentIndexPath:"",parentPath:"",parentSchemaPath:x,permissions:!0,readOnly:!u}),l(Ve,{programmaticSubmit:!0,children:k("fields:saveChanges")})]}):null})}),ne?l(be,{value:{EditButton:Fe,initialState:m,InlineBlockContainer:M,Label:ie,nodeKey:a,RemoveButton:j},children:ne}):_(M,{children:[m?l(ie,{}):l(We,{height:"15px",width:"40px"}),u?l("div",{className:`${e}__actions`,children:l(j,{})}):null]})]}):_(M,{className:`${e}-not-found`,children:[_("span",{children:["Error: Block '",n.blockType,"' not found"]}),u?l("div",{className:`${e}__actions`,children:l(j,{})}):null]})};export{pe as a,Dt as b,T as c,Pe as d,A as e};
2
- //# sourceMappingURL=chunk-FEJXFRL7.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/features/blocks/client/componentInline/index.tsx", "../../../src/features/blocks/client/nodes/InlineBlocksNode.tsx", "../../../src/features/blocks/server/nodes/InlineBlocksNode.tsx"],
4
- "sourcesContent": ["'use client'\n\nimport type { BlocksFieldClient, ClientBlock, Data, FormState } from 'payload'\n\nimport { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext'\nimport { useLexicalEditable } from '@lexical/react/useLexicalEditable'\nimport { getTranslation } from '@payloadcms/translations'\nimport {\n Button,\n Drawer,\n EditDepthProvider,\n Form,\n formatDrawerSlug,\n FormSubmit,\n RenderFields,\n ShimmerEffect,\n useConfig,\n useDocumentForm,\n useDocumentInfo,\n useEditDepth,\n useServerFunctions,\n useTranslation,\n} from '@payloadcms/ui'\nimport { abortAndIgnore } from '@payloadcms/ui/shared'\nimport { $getNodeByKey, SKIP_DOM_SELECTION_TAG } from 'lexical'\n\nimport './index.css'\n\nimport { deepCopyObjectSimpleWithoutReactComponents, reduceFieldsToValues } from 'payload/shared'\nimport React, { createContext, useCallback, useEffect, useMemo, useRef } from 'react'\nimport { v4 as uuid } from 'uuid'\n\nimport type { ViewMapInlineBlockComponentProps } from '../../../../types/index.js'\nimport type { InlineBlockFields } from '../../server/nodes/InlineBlocksNode.js'\nimport type { BlockComponentProps } from '../component/index.js'\n\nimport { useEditorConfigContext } from '../../../../lexical/config/client/EditorConfigProvider.js'\nimport { useLexicalDrawer } from '../../../../utilities/fieldsDrawer/useLexicalDrawer.js'\nimport { $isInlineBlockNode } from '../nodes/InlineBlocksNode.js'\n\nexport type InlineBlockComponentProps<\n TFormData extends Record<string, unknown> = InlineBlockFields,\n> = {\n readonly CustomBlock?: React.FC<ViewMapInlineBlockComponentProps>\n readonly CustomLabel?: React.FC<ViewMapInlineBlockComponentProps>\n} & Pick<BlockComponentProps<TFormData>, 'cacheBuster' | 'className' | 'formData' | 'nodeKey'>\n\nexport type InlineBlockComponentContextType = {\n EditButton?: React.FC\n initialState: false | FormState | undefined\n InlineBlockContainer?: React.FC<{ children: React.ReactNode }>\n Label?: React.FC\n nodeKey?: string\n RemoveButton?: React.FC\n}\n\nconst InlineBlockComponentContext = createContext<InlineBlockComponentContextType>({\n initialState: false,\n})\n\nexport const useInlineBlockComponentContext = () => React.use(InlineBlockComponentContext)\n\nexport const InlineBlockComponent: React.FC<InlineBlockComponentProps<InlineBlockFields>> = (\n props,\n) => {\n const {\n cacheBuster,\n className: baseClass,\n CustomBlock: CustomBlockFromProps,\n CustomLabel: CustomLabelFromProps,\n formData,\n nodeKey,\n } = props\n\n const [editor] = useLexicalComposerContext()\n const isEditable = useLexicalEditable()\n const { i18n, t } = useTranslation<object, string>()\n const {\n createdInlineBlock,\n fieldProps: { featureClientSchemaMap, initialLexicalFormState, schemaPath },\n setCreatedInlineBlock,\n uuid: uuidFromContext,\n } = useEditorConfigContext()\n const { fields: parentDocumentFields } = useDocumentForm()\n\n const { getFormState } = useServerFunctions()\n const editDepth = useEditDepth()\n const firstTimeDrawer = useRef(false)\n\n const [initialState, setInitialState] = React.useState<false | FormState | undefined>(() => {\n // Initial form state that was calculated server-side. May have stale values\n const cachedFormState = initialLexicalFormState?.[formData.id]?.formState\n if (!cachedFormState) {\n return false\n }\n\n // Merge current formData values into the cached form state\n // This ensures that when the component remounts (e.g., due to view changes), we don't lose user edits\n return Object.fromEntries(\n Object.entries(cachedFormState).map(([fieldName, fieldState]) => [\n fieldName,\n fieldName in formData\n ? {\n ...fieldState,\n initialValue: formData[fieldName],\n value: formData[fieldName],\n }\n : fieldState,\n ]),\n )\n })\n\n const hasMounted = useRef(false)\n const prevCacheBuster = useRef(cacheBuster)\n useEffect(() => {\n if (hasMounted.current) {\n if (prevCacheBuster.current !== cacheBuster) {\n setInitialState(false)\n }\n prevCacheBuster.current = cacheBuster\n } else {\n hasMounted.current = true\n }\n }, [cacheBuster])\n\n const [formUuid] = React.useState(() => uuid())\n\n // Server-rendered custom components (from admin.components, NOT viewMap).\n // When viewMap components exist, we render them directly with formData instead.\n const [CustomLabel, setCustomLabel] = React.useState<React.ReactNode | undefined>(() => {\n if (CustomLabelFromProps) {\n return undefined\n }\n // @ts-expect-error - vestiges of when tsconfig was not strict. Feel free to improve\n return initialState?.['_components']?.customComponents?.BlockLabel ?? undefined\n })\n\n const [CustomBlock, setCustomBlock] = React.useState<React.ReactNode | undefined>(() => {\n if (CustomBlockFromProps) {\n return undefined\n }\n // @ts-expect-error - vestiges of when tsconfig was not strict. Feel free to improve\n return initialState?.['_components']?.customComponents?.Block ?? undefined\n })\n\n const resolvedCustomBlock = useMemo(() => {\n if (CustomBlockFromProps) {\n return (\n <CustomBlockFromProps\n className={baseClass}\n formData={formData}\n isEditor={true}\n isJSXConverter={false}\n nodeKey={nodeKey}\n // eslint-disable-next-line react-compiler/react-compiler -- intentionally passed as a prop for custom block components to call\n useInlineBlockComponentContext={useInlineBlockComponentContext}\n />\n )\n }\n return CustomBlock\n }, [CustomBlockFromProps, baseClass, formData, nodeKey, CustomBlock])\n\n const resolvedCustomLabel = useMemo(() => {\n if (CustomLabelFromProps) {\n return (\n <CustomLabelFromProps\n className={baseClass}\n formData={formData}\n isEditor={true}\n isJSXConverter={false}\n nodeKey={nodeKey}\n // eslint-disable-next-line react-compiler/react-compiler -- intentionally passed as a prop for custom block components to call\n useInlineBlockComponentContext={useInlineBlockComponentContext}\n />\n )\n }\n return CustomLabel\n }, [CustomLabelFromProps, baseClass, formData, nodeKey, CustomLabel])\n\n const drawerSlug = formatDrawerSlug({\n slug: `lexical-inlineBlocks-create-${uuidFromContext}-${formData.id}`,\n depth: editDepth,\n })\n const { toggleDrawer } = useLexicalDrawer(drawerSlug, true)\n\n const inlineBlockElemElemRef = useRef<HTMLDivElement | null>(null)\n const { id, collectionSlug, getDocPreferences, globalSlug } = useDocumentInfo()\n const { config } = useConfig()\n\n const componentMapRenderedBlockPath = `${schemaPath}.lexical_internal_feature.blocks.lexical_inline_blocks.${formData.blockType}`\n\n const clientSchemaMap = featureClientSchemaMap['blocks']\n\n const blocksField: BlocksFieldClient = clientSchemaMap?.[\n componentMapRenderedBlockPath\n ]?.[0] as BlocksFieldClient\n\n const clientBlock: ClientBlock | undefined = blocksField.blockReferences\n ? typeof blocksField?.blockReferences?.[0] === 'string'\n ? config.blocksMap[blocksField?.blockReferences?.[0]]\n : blocksField?.blockReferences?.[0]\n : blocksField?.blocks?.[0]\n\n const clientBlockFields = clientBlock?.fields ?? []\n\n // Open drawer on \"mount\"\n useEffect(() => {\n if (!firstTimeDrawer.current && createdInlineBlock?.getKey() === nodeKey) {\n // > 2 because they always have \"id\" and \"blockName\" fields\n if (clientBlockFields.length > 2) {\n toggleDrawer()\n }\n setCreatedInlineBlock?.(undefined)\n firstTimeDrawer.current = true\n }\n }, [clientBlockFields.length, createdInlineBlock, nodeKey, setCreatedInlineBlock, toggleDrawer])\n\n const removeInlineBlock = useCallback(() => {\n editor.update(() => {\n $getNodeByKey(nodeKey)?.remove()\n })\n }, [editor, nodeKey])\n\n const blockDisplayName = clientBlock?.labels?.singular\n ? getTranslation(clientBlock?.labels.singular, i18n)\n : clientBlock?.slug\n\n const onChangeAbortControllerRef = useRef(new AbortController())\n const schemaFieldsPath = `${schemaPath}.lexical_internal_feature.blocks.lexical_inline_blocks.${clientBlock?.slug}.fields`\n\n // Initial state for newly created blocks\n useEffect(() => {\n const abortController = new AbortController()\n\n const awaitInitialState = async () => {\n /*\n * This will only run if a new block is created. For all existing blocks that are loaded when the document is loaded, or when the form is saved,\n * this is not run, as the lexical field RSC will fetch the state server-side and pass it to the client. That way, we avoid unnecessary client-side\n * requests. Though for newly created blocks, we need to fetch the state client-side, as the server doesn't know about the block yet.\n */\n const { state } = await getFormState({\n id,\n collectionSlug,\n data: formData,\n docPermissions: { fields: true },\n docPreferences: await getDocPreferences(),\n documentFormState: deepCopyObjectSimpleWithoutReactComponents(parentDocumentFields, {\n excludeFiles: true,\n }),\n globalSlug,\n initialBlockData: formData,\n initialBlockFormState: formData,\n operation: 'update',\n readOnly: !isEditable,\n renderAllFields: true,\n schemaPath: schemaFieldsPath,\n signal: abortController.signal,\n })\n\n if (state) {\n const newFormStateData: InlineBlockFields = reduceFieldsToValues(\n deepCopyObjectSimpleWithoutReactComponents(state, { excludeFiles: true }),\n true,\n ) as InlineBlockFields\n\n // Things like default values may come back from the server => update the node with the new data\n editor.update(\n () => {\n const node = $getNodeByKey(nodeKey)\n if (node && $isInlineBlockNode(node)) {\n const newData = newFormStateData\n newData.blockType = formData.blockType\n\n node.setFields(newData, true)\n }\n },\n // Without this, the outer editor's reconciler resets DOM selection\n // back into its own root, kicking focus out of any nested richText.\n { tag: SKIP_DOM_SELECTION_TAG },\n )\n\n setInitialState(state)\n if (!CustomLabelFromProps) {\n setCustomLabel(state['_components']?.customComponents?.BlockLabel)\n }\n if (!CustomBlockFromProps) {\n setCustomBlock(state['_components']?.customComponents?.Block)\n }\n }\n }\n\n if (formData && !initialState) {\n void awaitInitialState()\n }\n\n return () => {\n abortAndIgnore(abortController)\n }\n }, [\n getFormState,\n editor,\n nodeKey,\n isEditable,\n CustomLabelFromProps,\n CustomBlockFromProps,\n schemaFieldsPath,\n id,\n formData,\n initialState,\n collectionSlug,\n globalSlug,\n getDocPreferences,\n parentDocumentFields,\n ])\n\n /**\n * HANDLE ONCHANGE\n */\n const onChange = useCallback(\n async ({ formState: prevFormState, submit }: { formState: FormState; submit?: boolean }) => {\n abortAndIgnore(onChangeAbortControllerRef.current)\n\n const controller = new AbortController()\n onChangeAbortControllerRef.current = controller\n\n const { state } = await getFormState({\n id,\n collectionSlug,\n docPermissions: {\n fields: true,\n },\n docPreferences: await getDocPreferences(),\n documentFormState: deepCopyObjectSimpleWithoutReactComponents(parentDocumentFields, {\n excludeFiles: true,\n }),\n formState: prevFormState,\n globalSlug,\n initialBlockFormState: prevFormState,\n operation: 'update',\n readOnly: !isEditable,\n renderAllFields: submit ? true : false,\n schemaPath: schemaFieldsPath,\n signal: controller.signal,\n })\n\n if (!state) {\n return prevFormState\n }\n\n if (submit) {\n if (!CustomLabelFromProps) {\n setCustomLabel(state['_components']?.customComponents?.BlockLabel)\n }\n if (!CustomBlockFromProps) {\n setCustomBlock(state['_components']?.customComponents?.Block)\n }\n }\n\n return state\n },\n [\n getFormState,\n id,\n collectionSlug,\n getDocPreferences,\n parentDocumentFields,\n globalSlug,\n isEditable,\n schemaFieldsPath,\n CustomBlockFromProps,\n CustomLabelFromProps,\n ],\n )\n // cleanup effect\n useEffect(() => {\n const isStateOutOfSync = (formData: InlineBlockFields, initialState: FormState) => {\n return Object.keys(initialState).some(\n (key) => initialState[key] && formData[key] !== initialState[key].value,\n )\n }\n\n return () => {\n // If the component is unmounted (either via removeInlineBlock or via lexical itself) and the form state got changed before,\n // we need to reset the initial state to force a re-fetch of the initial state when it gets mounted again (e.g. via lexical history undo).\n // Otherwise it would use an outdated initial state.\n if (initialState && isStateOutOfSync(formData, initialState)) {\n setInitialState(false)\n }\n abortAndIgnore(onChangeAbortControllerRef.current)\n }\n }, [formData, initialState])\n\n /**\n * HANDLE FORM SUBMIT\n */\n const onFormSubmit = useCallback(\n (formState: FormState, newData: Data) => {\n newData.blockType = formData.blockType\n\n editor.update(\n () => {\n const node = $getNodeByKey(nodeKey)\n if (node && $isInlineBlockNode(node)) {\n node.setFields(newData as InlineBlockFields, true)\n }\n },\n // Without this, the outer editor's reconciler resets DOM selection\n // back into its own root, kicking focus out of any nested richText.\n { tag: SKIP_DOM_SELECTION_TAG },\n )\n },\n [editor, nodeKey, formData],\n )\n\n const RemoveButton = useMemo(\n () => () => (\n <Button\n buttonStyle=\"ghost\"\n className={`${baseClass}__removeButton`}\n disabled={!isEditable}\n icon=\"x\"\n onClick={(e) => {\n e.preventDefault()\n e.stopPropagation()\n removeInlineBlock()\n }}\n round\n size=\"medium\"\n tooltip={t('lexical:blocks:inlineBlocks:remove', { label: blockDisplayName })}\n />\n ),\n [baseClass, blockDisplayName, isEditable, removeInlineBlock, t],\n )\n\n const EditButton = useMemo(\n () => () => (\n <Button\n buttonStyle=\"ghost\"\n className={`${baseClass}__editButton`}\n disabled={!isEditable}\n el=\"button\"\n icon=\"edit\"\n onClick={() => {\n toggleDrawer()\n }}\n round\n size=\"medium\"\n tooltip={t('lexical:blocks:inlineBlocks:edit', { label: blockDisplayName })}\n />\n ),\n [baseClass, blockDisplayName, isEditable, t, toggleDrawer],\n )\n\n const InlineBlockContainer = useMemo(\n () =>\n ({ children, className }: { children: React.ReactNode; className?: string }) => (\n <div\n className={[`${baseClass}__container`, baseClass + '-' + formData.blockType, className]\n .filter(Boolean)\n .join(' ')}\n {...(isEditable\n ? {\n onClick: () => toggleDrawer(),\n onKeyDown: (e: React.KeyboardEvent) => {\n if (e.key === 'Enter' || e.key === ' ') {\n e.preventDefault()\n toggleDrawer()\n }\n },\n role: 'button',\n tabIndex: 0,\n }\n : {})}\n ref={inlineBlockElemElemRef}\n >\n {children}\n </div>\n ),\n [baseClass, formData.blockType, isEditable, toggleDrawer],\n )\n\n const Label = useMemo(() => {\n if (resolvedCustomLabel) {\n return () => resolvedCustomLabel\n } else {\n return () => (\n <div>{clientBlock?.labels ? getTranslation(clientBlock?.labels.singular, i18n) : ''}</div>\n )\n }\n }, [resolvedCustomLabel, clientBlock?.labels, i18n])\n\n if (!clientBlock) {\n return (\n <InlineBlockContainer className={`${baseClass}-not-found`}>\n <span>Error: Block '{formData.blockType}' not found</span>\n {isEditable ? (\n <div className={`${baseClass}__actions`}>\n <RemoveButton />\n </div>\n ) : null}\n </InlineBlockContainer>\n )\n }\n\n return (\n <Form\n beforeSubmit={[\n async ({ formState }) => {\n // This is only called when form is submitted from drawer\n return await onChange({ formState, submit: true })\n },\n ]}\n disableValidationOnSubmit\n el=\"div\"\n fields={clientBlock?.fields}\n initialState={initialState || {}}\n onChange={[onChange]}\n onSubmit={(formState, data) => {\n onFormSubmit(formState, data)\n toggleDrawer()\n }}\n uuid={formUuid}\n >\n <EditDepthProvider>\n <Drawer\n className={''}\n slug={drawerSlug}\n title={t(`lexical:blocks:inlineBlocks:${formData?.id ? 'edit' : 'create'}`, {\n label: blockDisplayName ?? t('lexical:blocks:inlineBlocks:label'),\n })}\n >\n {initialState ? (\n <>\n <RenderFields\n fields={clientBlock?.fields}\n forceRender\n parentIndexPath=\"\"\n parentPath=\"\" // See Blocks feature path for details as for why this is empty\n parentSchemaPath={schemaFieldsPath}\n permissions={true}\n readOnly={!isEditable}\n />\n <FormSubmit programmaticSubmit={true}>{t('fields:saveChanges')}</FormSubmit>\n </>\n ) : null}\n </Drawer>\n </EditDepthProvider>\n {resolvedCustomBlock ? (\n <InlineBlockComponentContext\n value={{\n EditButton,\n initialState,\n InlineBlockContainer,\n Label,\n nodeKey,\n RemoveButton,\n }}\n >\n {resolvedCustomBlock}\n </InlineBlockComponentContext>\n ) : (\n <InlineBlockContainer>\n {initialState ? <Label /> : <ShimmerEffect height=\"15px\" width=\"40px\" />}\n {isEditable ? (\n <div className={`${baseClass}__actions`}>\n <RemoveButton />\n </div>\n ) : null}\n </InlineBlockContainer>\n )}\n </Form>\n )\n}\n", "'use client'\nimport ObjectID from 'bson-objectid'\nimport {\n $applyNodeReplacement,\n type EditorConfig,\n type LexicalEditor,\n type LexicalNode,\n} from 'lexical'\nimport React, { type JSX } from 'react'\n\nimport type { ViewMapInlineBlockComponentProps } from '../../../../types/index.js'\nimport type {\n InlineBlockFields,\n SerializedInlineBlockNode,\n} from '../../server/nodes/InlineBlocksNode.js'\n\nimport { ServerInlineBlockNode } from '../../server/nodes/InlineBlocksNode.js'\n\nconst InlineBlockComponent = React.lazy(() =>\n import('../componentInline/index.js').then((module) => ({\n default: module.InlineBlockComponent,\n })),\n)\n\nexport type InlineBlockDecorateFunction = (\n editor: LexicalEditor,\n config: EditorConfig,\n CustomBlock?: React.FC<ViewMapInlineBlockComponentProps>,\n CustomLabel?: React.FC<ViewMapInlineBlockComponentProps>,\n) => JSX.Element\n\nexport class InlineBlockNode extends ServerInlineBlockNode {\n static override clone(node: ServerInlineBlockNode): ServerInlineBlockNode {\n return super.clone(node)\n }\n\n static override getType(): string {\n return super.getType()\n }\n\n static override importJSON(serializedNode: SerializedInlineBlockNode): InlineBlockNode {\n const node = $createInlineBlockNode(serializedNode.fields)\n return node\n }\n\n override decorate(\n ...[_editor, config, CustomBlock, CustomLabel]: Parameters<InlineBlockDecorateFunction>\n ): ReturnType<InlineBlockDecorateFunction> {\n return (\n <InlineBlockComponent\n cacheBuster={this.getCacheBuster()}\n className={config.theme.inlineBlock ?? 'LexicalEditorTheme__inlineBlock'}\n CustomBlock={CustomBlock}\n CustomLabel={CustomLabel}\n formData={this.getFields()}\n nodeKey={this.getKey()}\n />\n )\n }\n\n override exportJSON(): SerializedInlineBlockNode {\n return super.exportJSON()\n }\n}\n\nexport function $createInlineBlockNode(fields: Exclude<InlineBlockFields, 'id'>): InlineBlockNode {\n return $applyNodeReplacement(\n new InlineBlockNode({\n fields: {\n ...fields,\n id: fields?.id || new ObjectID.default().toHexString(),\n },\n }),\n )\n}\n\nexport function $isInlineBlockNode(\n node: InlineBlockNode | LexicalNode | null | undefined,\n): node is InlineBlockNode {\n return node instanceof InlineBlockNode\n}\n", "import type {\n DOMConversionMap,\n DOMExportOutput,\n EditorConfig,\n LexicalEditor,\n LexicalNode,\n NodeKey,\n SerializedLexicalNode,\n} from 'lexical'\nimport type { JsonObject } from 'payload'\nimport type React from 'react'\nimport type { JSX } from 'react'\n\nimport { addClassNamesToElement } from '@lexical/utils'\nimport ObjectID from 'bson-objectid'\nimport { $applyNodeReplacement, DecoratorNode } from 'lexical'\n\nimport type { StronglyTypedLeafNode } from '../../../../types/nodeTypes.js'\n\nexport type InlineBlockFields<TInlineBlockFields extends JsonObject = JsonObject> = {\n blockType: string\n id: string\n} & TInlineBlockFields\n\nexport type SerializedInlineBlockNode<TBlockFields extends JsonObject = JsonObject> = {\n fields: InlineBlockFields<TBlockFields>\n} & StronglyTypedLeafNode<SerializedLexicalNode, 'inlineBlock'>\n\nexport class ServerInlineBlockNode extends DecoratorNode<null | React.ReactElement> {\n __cacheBuster: number\n __fields: InlineBlockFields\n\n constructor({\n cacheBuster,\n fields,\n key,\n }: {\n cacheBuster?: number\n fields: InlineBlockFields\n key?: NodeKey\n }) {\n super(key)\n this.__fields = fields\n this.__cacheBuster = cacheBuster || 0\n }\n\n static override clone(node: ServerInlineBlockNode): ServerInlineBlockNode {\n return new this({\n cacheBuster: node.__cacheBuster,\n fields: node.__fields,\n key: node.__key,\n })\n }\n\n static override getType(): string {\n return 'inlineBlock'\n }\n\n static override importDOM(): DOMConversionMap<HTMLDivElement> | null {\n return {}\n }\n\n static override importJSON(serializedNode: SerializedInlineBlockNode): ServerInlineBlockNode {\n const node = $createServerInlineBlockNode(serializedNode.fields)\n return node\n }\n\n static isInline(): false {\n return false\n }\n\n canIndent() {\n return true\n }\n\n override createDOM(config?: EditorConfig): HTMLElement {\n const element = document.createElement('span')\n addClassNamesToElement(element, config?.theme?.inlineBlock)\n return element\n }\n\n override decorate(editor: LexicalEditor, config: EditorConfig): JSX.Element | null {\n return null\n }\n\n override exportDOM(): DOMExportOutput {\n const element = document.createElement('span')\n element.classList.add('inline-block-container')\n\n const text = document.createTextNode(this.getTextContent())\n element.append(text)\n return { element }\n }\n\n override exportJSON(): SerializedInlineBlockNode {\n return {\n type: 'inlineBlock',\n fields: this.getFields(),\n version: 1,\n }\n }\n\n getCacheBuster(): number {\n return this.getLatest().__cacheBuster\n }\n\n getFields(): InlineBlockFields {\n return this.getLatest().__fields\n }\n\n override getTextContent(): string {\n return `Block Field`\n }\n\n override isInline() {\n return true\n }\n\n setFields(fields: InlineBlockFields, preventFormStateUpdate?: boolean): void {\n const writable = this.getWritable()\n writable.__fields = fields\n if (!preventFormStateUpdate) {\n writable.__cacheBuster++\n }\n }\n\n override updateDOM(): boolean {\n return false\n }\n}\n\nexport function $createServerInlineBlockNode(\n fields: Exclude<InlineBlockFields, 'id'>,\n): ServerInlineBlockNode {\n return $applyNodeReplacement(\n new ServerInlineBlockNode({\n fields: {\n ...fields,\n id: fields?.id || new ObjectID.default().toHexString(),\n },\n }),\n )\n}\n\nexport function $isServerInlineBlockNode(\n node: LexicalNode | null | ServerInlineBlockNode | undefined,\n): node is ServerInl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AA3B,EAAA4B,GAAA,UAEN5B,EAAC4B,GAAAA,WACC,GACE9I,KAAAA,GACAiD,MAAMD,EAAAA,+BAAA5C,GAAA,GAAA,OAAA,QAAA,GAAA,CACN2I,MAASvE,GAAA9D,EAAA,mCAAuD,IAEhE,SAAA+B,EAAA8F,EAAAS,GAAA,UAECvG,CAAAyE,EAAA+B,GACCD,kBAEI3H,YAAQ2C,GACRkF,gBAAW,GACXC,WAAAA,GACAC,iBAAW5D,EACX6D,YAAAA,GACAC,SAAAA,CAAA9I,IACWA,EAAAA,GAAAA,oBAEZ+I,GAAWC,SAAAA,EAAAA,oBAAoB,+BAKvC7G,CAEGV,WAAAA,GACE6F,aAAAA,EACArF,qBAAAA,EACAgH,MAAAA,GACAnB,QAAAA,EACAjI,aAAAA,GAEF,SAAAsC,KAECA,EAAAA,EAAAA,aAGF8G,EAAAnB,GAAA,CAAA,CAAA,EAAApB,EAAAwC,GAAA,eAC4CC,MAAA,SAAcC,EAAM1C,EAAA,MAAA,WAC9D1G,GAAAT,CAAA,YACMC,SAAckH,EAAAE,EAAoB,CAAA,CAAA,eAzE/BmB,EAAAkB,EAAA,CAChB,UAAA,GAAA1J,CACE,aAAsBC,SAAA,CAAcuI,EAAA,OAAqB,4BACtDnI,EAAA,UAAA,aAAA,MAAK8G,EAAe9G,MAAS6F,WAC7BzF,GAAAT,CAAA,YACMC,SAAckH,EAAAE,EAAoB,CAAA,CAAA",
6
- "names": ["useLexicalComposerContext", "useLexicalEditable", "getTranslation", "Button", "Drawer", "EditDepthProvider", "Form", "formatDrawerSlug", "FormSubmit", "RenderFields", "ShimmerEffect", "useConfig", "useDocumentForm", "useDocumentInfo", "useEditDepth", "useServerFunctions", "useTranslation", "abortAndIgnore", "$getNodeByKey", "SKIP_DOM_SELECTION_TAG", "deepCopyObjectSimpleWithoutReactComponents", "reduceFieldsToValues", "React", "uuid", "createContext", "ObjectID", "$applyNodeReplacement", "React", "addClassNamesToElement", "ObjectID", "$applyNodeReplacement", "DecoratorNode", "ServerInlineBlockNode", "__cacheBuster", "__fields", "constructor", "cacheBuster", "fields", "key", "clone", "node", "__key", "getType", "importDOM", "importJSON", "serializedNode", "$createServerInlineBlockNode", "isInline", "canIndent", "createDOM", "config", "element", "document", "createElement", "theme", "inlineBlock", "decorate", "editor", "exportDOM", "classList", "add", "text", "createTextNode", "getTextContent", "append", "exportJSON", "type", "getFields", "version", "getCacheBuster", "getLatest", "setFields", "preventFormStateUpdate", "writable", "getWritable", "updateDOM", "id", "default", "toHexString", "InlineBlockComponent", "React", "lazy", "then", "module", "default", "InlineBlockNode", "ServerInlineBlockNode", "clone", "node", "getType", "importJSON", "serializedNode", "$createInlineBlockNode", "fields", "decorate", "_editor", "config", "CustomBlock", "CustomLabel", "_jsx", "cacheBuster", "getCacheBuster", "className", "theme", "inlineBlock", "formData", "getFields", "nodeKey", "getKey", "exportJSON", "$applyNodeReplacement", "id", "ObjectID", "toHexString", "$isInlineBlockNode", "InlineBlockComponentContext", "createContext", "useInlineBlockComponentContext", "React", "cacheBuster", "baseClass", "className", "CustomBlock", "CustomBlockFromProps", "CustomLabel", "formData", "nodeKey", "props", "useLexicalComposerContext", "isEditable", "i18n", "t", "useTranslation", "createdInlineBlock", "fieldProps", "featureClientSchemaMap", "initialLexicalFormState", "setCreatedInlineBlock", "uuid", "uuidFromContext", "useEditorConfigContext", "parentDocumentFields", "fields", "useDocumentForm", "getFormState", "useServerFunctions", "editDepth", "useEditDepth", "firstTimeDrawer", "setInitialState", "cachedFormState", "fieldName", "fieldState", "initialValue", "value", "hasMounted", "useRef", "useEffect", "prevCacheBuster", "current", "setCustomLabel", "CustomLabelFromProps", "initialState", "setCustomBlock", "resolvedCustomBlock", "useMemo", "isEditor", "isJSXConverter", "resolvedCustomLabel", "drawerSlug", "slug", "toggleDrawer", "useLexicalDrawer", "inlineBlockElemElemRef", "id", "collectionSlug", "getDocPreferences", "globalSlug", "useDocumentInfo", "config", "useConfig", "schemaPath", "clientSchemaMap", "componentMapRenderedBlockPath", "blocksField", "clientBlock", "blockReferences", "clientBlockFields", "undefined", "length", "editor", "removeInlineBlock", "getTranslation", "blockDisplayName", "labels", "singular", "onChangeAbortControllerRef", "AbortController", "state", "data", "docPermissions", "docPreferences", "deepCopyObjectSimpleWithoutReactComponents", "documentFormState", "initialBlockData", "initialBlockFormState", "operation", "readOnly", "renderAllFields", "schemaFieldsPath", "reduceFieldsToValues", "newFormStateData", "excludeFiles", "update", "$getNodeByKey", "node", "$isInlineBlockNode", "newData", "blockType", "SKIP_DOM_SELECTION_TAG", "abortAndIgnore", "abortController", "onChange", "formState", "submit", "state_0", "prevFormState", "formData_0", "initialState_0", "isStateOutOfSync", "key", "newData_0", "onFormSubmit", "useCallback", "node_0", "_jsx", "Button", "RemoveButton", "buttonStyle", "disabled", "icon", "e", "onClick", "preventDefault", "round", "size", "tooltip", "EditButton", "el", "children", "e_0", "onKeyDown", "role", "tabIndex", "ref", "Label", "_jsxs", "Form", "beforeSubmit", "formState_0", "disableValidationOnSubmit", "onSubmit", "formUuid", "EditDepthProvider", "title", "_Fragment", "RenderFields", "forceRender", "parentIndexPath", "parentPath", "parentSchemaPath", "permissions", "FormSubmit", "programmaticSubmit", "InlineBlockContainer", "ShimmerEffect", "height", "width"]
7
- }
@@ -1,2 +0,0 @@
1
- import{c as T}from"react/compiler-runtime";import{useLexicalComposerContext as b}from"@lexical/react/LexicalComposerContext";import{useModal as h}from"@payloadcms/ui";import{$getPreviousSelection as v,$getSelection as E,$setSelection as P}from"lexical";import{useEffect as W,useState as k}from"react";var F=(t,i)=>{let e=T(24),[s]=b(),[c,B]=k(null),[n,D]=k(!1),{closeModal:u,modalState:l,toggleModal:O}=h(),r;e[0]!==s?(r=()=>{s.read(()=>{let M=E()??v();B(M)})},e[0]=s,e[1]=r):r=e[1];let w=r,a;e[2]!==s||e[3]!==c?(a=()=>{c&&s.update(()=>{P(c.clone())},{discrete:!0,skipTransforms:!0})},e[2]=s,e[3]=c,e[4]=a):a=e[4];let o=a,f;e[5]!==u||e[6]!==t?(f=()=>{u(t)},e[5]=u,e[6]=t,e[7]=f):f=e[7];let x=f,$=l?.[t]?.isOpen,m;e[8]!==$||e[9]!==o||e[10]!==t||e[11]!==w||e[12]!==O?(m=()=>{$?o():w(),D(!0),O(t)},e[8]=$,e[9]=o,e[10]=t,e[11]=w,e[12]=O,e[13]=m):m=e[13];let C=m,p,d;e[14]!==l||e[15]!==i||e[16]!==o||e[17]!==t||e[18]!==n?(p=()=>{if(!n)return;let M=l[t];M&&!M?.isOpen&&(D(!1),i?setTimeout(()=>{o()},0):o())},d=[l,t,o,n,i],e[14]=l,e[15]=i,e[16]=o,e[17]=t,e[18]=n,e[19]=p,e[20]=d):(p=e[19],d=e[20]),W(p,d);let S;return e[21]!==x||e[22]!==C?(S={closeDrawer:x,toggleDrawer:C},e[21]=x,e[22]=C,e[23]=S):S=e[23],S};export{F as a};
2
- //# sourceMappingURL=chunk-INBEEENE.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/utilities/fieldsDrawer/useLexicalDrawer.tsx"],
4
- "sourcesContent": ["'use client'\nimport type { BaseSelection } from 'lexical'\n\nimport { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext'\nimport { useModal } from '@payloadcms/ui'\nimport { $getPreviousSelection, $getSelection, $setSelection } from 'lexical'\nimport { useCallback, useEffect, useState } from 'react'\n\n/**\n *\n * Wrapper around useModal that restores and saves selection state (cursor position) when opening and closing the drawer.\n * By default, the lexical cursor position may be lost when opening a drawer and clicking somewhere on that drawer.\n */\nexport const useLexicalDrawer = (slug: string, restoreLate?: boolean) => {\n const [editor] = useLexicalComposerContext()\n const [selectionState, setSelectionState] = useState<BaseSelection | null>(null)\n const [wasOpen, setWasOpen] = useState<boolean>(false)\n\n const { closeModal: closeBaseModal, modalState, toggleModal: toggleBaseModal } = useModal()\n\n const storeSelection = useCallback(() => {\n editor.read(() => {\n const selection = $getSelection() ?? $getPreviousSelection()\n setSelectionState(selection)\n })\n }, [editor])\n\n const restoreSelection = useCallback(() => {\n if (selectionState) {\n editor.update(\n () => {\n $setSelection(selectionState.clone())\n },\n { discrete: true, skipTransforms: true },\n )\n }\n }, [editor, selectionState])\n\n const closeDrawer = useCallback(() => {\n //restoreSelection() // Should already be stored by the useEffect below\n closeBaseModal(slug)\n }, [closeBaseModal, slug])\n const isModalOpen = modalState?.[slug]?.isOpen\n\n const toggleDrawer = useCallback(() => {\n if (!isModalOpen) {\n storeSelection()\n } else {\n restoreSelection()\n }\n setWasOpen(true)\n toggleBaseModal(slug)\n }, [slug, storeSelection, toggleBaseModal, restoreSelection, isModalOpen])\n\n // We need to handle drawer closing via a useEffect, as toggleDrawer / closeDrawer will not be triggered if the drawer\n // is closed by clicking outside of the drawer. This useEffect will handle everything.\n useEffect(() => {\n if (!wasOpen) {\n return\n }\n\n const thisModalState = modalState[slug]\n // Exists in modalState (thus has opened at least once before) and is closed\n if (thisModalState && !thisModalState?.isOpen) {\n setWasOpen(false)\n\n if (restoreLate) {\n // restoreLate is used for upload extra field drawers. For some reason, the selection is not restored if we call restoreSelection immediately.\n setTimeout(() => {\n restoreSelection()\n }, 0)\n } else {\n restoreSelection()\n }\n }\n }, [modalState, slug, restoreSelection, wasOpen, restoreLate])\n\n return {\n closeDrawer,\n toggleDrawer,\n }\n}\n"],
5
- "mappings": "AAAA,OAAAA,KAAAC,MAAA,yBAGA,OAASC,6BAAAA,MAAiC,wCAC1C,OAASC,YAAAA,MAAgB,iBACzB,OAASC,yBAAAA,EAAuBC,iBAAAA,EAAeC,iBAAAA,MAAqB,UACpE,OAAsBC,aAAAA,EAAWC,YAAAA,MAAgB,QAO1C,IAAMC,EAAmBA,CAAAC,EAAAC,IAAA,CAAA,IAAAC,EAAAX,EAAA,EAAA,EAC9B,CAAAY,CAAA,EAAiBX,EAAA,EACjB,CAAAY,EAAAC,CAAA,EAA4CP,EAAA,IAA+B,EAC3E,CAAAQ,EAAAC,CAAA,EAA8BT,EAAA,EAA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icalDrawer", "slug", "restoreLate", "$", "editor", "selectionState", "setSelectionState", "wasOpen", "setWasOpen", "closeModal", "closeBaseModal", "modalState", "toggleModal", "toggleBaseModal", "t0", "read", "selection", "storeSelection", "t1", "update", "clone", "discrete", "skipTransforms", "restoreSelection", "t2", "closeDrawer", "isModalOpen", "isOpen", "t3", "toggleDrawer", "t4", "t5", "thisModalState", "setTimeout", "t6"]
7
- }
@@ -1,12 +0,0 @@
1
- var st=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";import{c as he}from"react/compiler-runtime";import{useRef as xe}from"react";function ro(r){let t=he(2),e=r===void 0?500:r,o=xe(void 0),n;return t[0]!==e?(n=s=>new Promise(i=>{let l=()=>{s(),i()};"requestIdleCallback"in window?("cancelIdleCallback"in window&&o.current!==void 0&&cancelIdleCallback(o.current),o.current=requestIdleCallback(l,{timeout:e})):Ee().then(l)}),t[0]=e,t[1]=n):n=t[1],n}function Ee(){return new Promise(r=>{setTimeout(r,100),requestAnimationFrame(()=>{setTimeout(r,0)})})}import{jsx as _e}from"react/jsx-runtime";import{useControllableState as Te}from"@payloadcms/ui";import{createContext as we,use as Ce,useMemo as Se}from"react";var ct=we({currentView:"default",inheritable:!1,setCurrentView:()=>{}}),fo=r=>{let t=Re(),e=r.currentView!==void 0,o=t.inheritable&&(!!t.views||!!t.hasExplicitCurrentView),n=e||t.inheritable&&!!t.hasExplicitCurrentView,{children:c,currentView:s,inheritable:i,views:l}={children:r.children,currentView:o?t.currentView:r.currentView,inheritable:t.inheritable||r.inheritable,views:o&&t.views?t.views:r.views},[a,u]=Te(s,"default"),p=l&&a!=="default"&&!l[a]?"default":a,m=Se(()=>{let g=l?l[p]:void 0;return{currentView:p,currentViewMap:g,hasExplicitCurrentView:n,inheritable:i,isControlledByParent:o,setCurrentView:u,views:l}},[p,i,n,o,u,l]);return _e(ct,{value:m,children:c})};function Re(){return Ce(ct)}var G=class{_x;_y;constructor(t,e){this._x=t,this._y=e}calcDeltaXTo({x:t}){return this.x-t}calcDeltaYTo({y:t}){return this.y-t}calcDistanceTo(t){return Math.sqrt(Math.pow(this.calcDeltaXTo(t),2)+Math.pow(this.calcDeltaYTo(t),2))}calcHorizontalDistanceTo(t){return Math.abs(this.calcDeltaXTo(t))}calcVerticalDistance(t){return Math.abs(this.calcDeltaYTo(t))}equals({x:t,y:e}){return this.x===t&&this.y===e}get x(){return this._x}get y(){return this._y}};function lt(r){return r instanceof G}import{jsx as Ve}from"react/jsx-runtime";import{useLexicalComposerContext as Xe}from"@lexical/react/LexicalComposerContext.js";import{mergeRegister as Ge}from"@lexical/utils";import{$getSelection as j,$isRangeSelection as W,$isTextNode as ze,COMMAND_PRIORITY_LOW as Ye,createCommand as je,getDOMSelection as We}from"lexical";import{useCallback as _t,useEffect as Tt,useState as qe}from"react";import*as Y from"react";import{c as pt}from"react/compiler-runtime";import{useLexicalComposerContext as gt}from"@lexical/react/LexicalComposerContext.js";import{mergeRegister as at}from"@lexical/utils";import{$getSelection as ht,$isRangeSelection as ye,$setSelection as be,COMMAND_PRIORITY_LOW as ft,COMMAND_PRIORITY_NORMAL as $,createCommand as ke,KEY_ARROW_DOWN_COMMAND as Oe,KEY_ARROW_UP_COMMAND as Ne,KEY_ENTER_COMMAND as Fe,KEY_ESCAPE_COMMAND as Ie,KEY_TAB_COMMAND as Me}from"lexical";import{useCallback as z,useEffect as k,useLayoutEffect as Ae,useMemo as De,useRef as Le,useState as $e}from"react";var Be="slash-menu-popup",ut=r=>{let t=document.getElementById("slash-menu");if(!t)return;let e=t.getBoundingClientRect();e.top+e.height>window.innerHeight&&t.scrollIntoView({block:"center"}),e.top<0&&t.scrollIntoView({block:"center"}),r.scrollIntoView({block:"nearest"})};function ve(r,t,e){let o=e;for(let n=o;n<=t.length;n++)r.substring(r.length-n)===t.substring(0,n)&&(o=n);return o}function Pe(r){let t=ht();if(!ye(t)||!t.isCollapsed())return;let e=t.anchor;if(e.type!=="text")return;let o=e.getNode();if(!o.isSimpleText())return;let n=e.offset,c=o.getTextContent().slice(0,n),s=r.replaceableString.length,i=ve(c,r.matchingString,s),l=n-i;if(l<0)return;let a;return l===0?[a]=o.splitText(n):[,a]=o.splitText(l,n),a}function He(r,t){let e=getComputedStyle(r),o=e.position==="absolute",n=t?/(auto|scroll|hidden)/:/(auto|scroll)/;if(e.position==="fixed")return document.body;for(let c=r;c=c.parentElement;)if(e=getComputedStyle(c),!(o&&e.position==="static")&&n.test(e.overflow+e.overflowY+e.overflowX))return c;return document.body}function dt(r,t){let e=r.getBoundingClientRect(),o=t.getBoundingClientRect();return e.top>o.top&&e.top<o.bottom}function Ke(r,t,e,o){let n=pt(7),[c]=gt(),s,i;n[0]!==c||n[1]!==e||n[2]!==o||n[3]!==r||n[4]!==t?(s=()=>{let l=t.current;if(l!=null&&r!=null){let a=c.getRootElement(),u=a!=null?He(a,!1):document.body,p=!1,m=dt(l,u),g=function(){p||(window.requestAnimationFrame(function(){e(),p=!1}),p=!0);let d=dt(l,u);d!==m&&(m=d,o?.(d))},f=new ResizeObserver(e);return window.addEventListener("resize",e),document.addEventListener("scroll",g,{capture:!0,passive:!0}),f.observe(l),()=>{f.disconnect(),window.removeEventListener("resize",e),document.removeEventListener("scroll",g,!0)}}},i=[c,o,e,r,t],n[0]=c,n[1]=e,n[2]=o,n[3]=r,n[4]=t,n[5]=s,n[6]=i):(s=n[5],i=n[6]),k(s,i)}var mt=ke("SCROLL_TYPEAHEAD_OPTION_INTO_VIEW_COMMAND");function xt({anchorElementRef:r,close:t,editor:e,groups:o,menuRenderFn:n,resolution:c,shouldSplitNodeWithQuery:s=!1}){let[i,l]=$e(null),a=c.match&&c.match.matchingString||"",u=z(f=>{let d=e.getRootElement();d!==null&&(d.setAttribute("aria-activedescendant",`${Be}__item-${f.key}`),l(f.key))},[e]),p=z(()=>{if(o!==null&&a!=null){let f=o.flatMap(d=>d.items);if(f.length){let d=f[0];u(d)}}},[o,u,a]);k(()=>{p()},[a,p]);let m=z(f=>{t(),e.update(()=>{let d=c.match!=null&&s?Pe(c.match):null;d&&d.remove()}),setTimeout(()=>{let d;e.read(()=>{d=ht()?.clone()}),e.update(()=>{d&&be(d)}),f.onSelect({editor:e,queryString:c.match?c.match.matchingString:""})},0)},[e,s,c.match,t]);k(()=>()=>{let f=e.getRootElement();f!==null&&f.removeAttribute("aria-activedescendant")},[e]),Ae(()=>{o===null?l(null):i===null&&p()},[o,i,u,p]),k(()=>at(e.registerCommand(mt,({item:f})=>f.ref&&f.ref.current!=null?(ut(f.ref.current),!0):!1,ft)),[e,u]),k(()=>at(e.registerCommand(Oe,f=>{let d=f;if(o!==null&&o.length&&i!==null){let h=o.flatMap(T=>T.items),x=h.findIndex(T=>T.key===i),E=x!==h.length-1?x+1:0,_=h[E];if(!_)return!1;u(_),_.ref!=null&&_.ref.current&&e.dispatchCommand(mt,{index:E,item:_}),d.preventDefault(),d.stopImmediatePropagation()}return!0},$),e.registerCommand(Ne,f=>{let d=f;if(o!==null&&o.length&&i!==null){let h=o.flatMap(T=>T.items),x=h.findIndex(T=>T.key===i),E=x!==0?x-1:h.length-1,_=h[E];if(!_)return!1;u(_),_.ref!=null&&_.ref.current&&ut(_.ref.current),d.preventDefault(),d.stopImmediatePropagation()}return!0},$),e.registerCommand(Ie,f=>{let d=f;return d.preventDefault(),d.stopImmediatePropagation(),t(),!0},ft),e.registerCommand(Me,f=>{let d=f;if(o===null||i===null)return!1;let x=o.flatMap(E=>E.items).find(E=>E.key===i);return x?(d.preventDefault(),d.stopImmediatePropagation(),m(x),!0):!1},$),e.registerCommand(Fe,f=>{if(o===null||i===null)return!1;let h=o.flatMap(x=>x.items).find(x=>x.key===i);return h?(f!==null&&(f.preventDefault(),f.stopImmediatePropagation()),m(h),!0):!1},$)),[m,t,e,o,i,u]);let g=De(()=>({groups:o,selectedItemKey:i,selectItemAndCleanUp:m,setSelectedItemKey:l}),[m,i,o]);return n(r,g,c.match?c.match.matchingString:"")}function Ue(r,t){t!=null&&(r.className=t),r.setAttribute("aria-label","Slash menu"),r.setAttribute("role","listbox"),r.style.display="block",r.style.position="absolute"}function Et(r,t,e,o){let n=pt(14),[c]=gt(),s;n[0]===Symbol.for("react.memo_cache_sentinel")?(s=st?document.createElement("div"):null,n[0]=s):s=n[0];let i=Le(s),l;n[1]!==r||n[2]!==o||n[3]!==c||n[4]!==t?(l=()=>{if(i.current===null||parent===void 0)return;let f=c.getRootElement(),d=i.current,h=d.firstChild;if(f!==null&&t!==null){let{height:x,width:E}=t.getRect(),{left:_,top:T}=t.getRect(),b=T;if(T=T-(r.getBoundingClientRect().top+window.scrollY),_=_-(r.getBoundingClientRect().left+window.scrollX),d.style.left=`${_+window.scrollX}px`,d.style.height=`${x}px`,d.style.width=`${E}px`,h!==null){let w=h.getBoundingClientRect(),L=w.height,S=w.width,X=f.getBoundingClientRect(),rt=document.dir==="rtl"||document.documentElement.dir==="rtl",de=r.getBoundingClientRect(),it=Math.max(0,X.left);if(!rt&&_+S>X.right)d.style.left=`${X.right-S+window.scrollX}px`;else if(rt&&w.left<it){let ge=it+S-de.left;d.style.left=`${ge+window.scrollX}px`}let me=b+L+32>window.innerHeight,pe=b<0;me&&!pe?d.style.top=`${T+32-L+window.scrollY-(x+24)}px`:d.style.top=`${T+window.scrollY+32}px`}d.isConnected||(Ue(d,o),r.append(d)),d.setAttribute("id","slash-menu"),i.current=d,f.setAttribute("aria-controls","slash-menu")}},n[1]=r,n[2]=o,n[3]=c,n[4]=t,n[5]=l):l=n[5];let a=l,u,p;n[6]!==c||n[7]!==a||n[8]!==t?(u=()=>{let f=c.getRootElement();if(t!==null)return a(),()=>{f!==null&&f.removeAttribute("aria-controls");let d=i.current;d!==null&&d.isConnected&&(d.remove(),d.removeAttribute("id"))}},p=[c,a,t],n[6]=c,n[7]=a,n[8]=t,n[9]=u,n[10]=p):(u=n[9],p=n[10]),k(u,p);let m;return n[11]!==t||n[12]!==e?(m=f=>{t!==null&&(f||e(null))},n[11]=t,n[12]=e,n[13]=m):m=n[13],Ke(t,i,a,m),i}var ko=`\\.,\\+\\*\\?\\$\\@\\|#{}\\(\\)\\^\\-\\[\\]\\\\/!%'"~=<>_:;`;function Qe(r){let t=r.anchor;if(t.type!=="text")return null;let e=t.getNode();if(!e.isSimpleText())return null;let o=t.offset;return e.getTextContent().slice(0,o)}function wt(r,t,e){let o=We(e);if(o===null||!o.isCollapsed)return!1;let n=o.anchorNode,c=r,s=o.anchorOffset;if(n==null||s==null)return!1;try{t.setStart(n,c),t.setEnd(n,s>1?s:1)}catch{return!1}return!0}function Je(r){let t;return r.getEditorState().read(()=>{let e=j();W(e)&&(t=Qe(e))}),t}function Ct(r,t){return t!==0?!1:r.getEditorState().read(()=>{let e=j();if(W(e)){let c=e.anchor.getNode().getPreviousSibling();return ze(c)&&c.isTextEntity()}return!1})}function St(r){Y.startTransition?Y.startTransition(r):r()}var Ze=je("ENABLE_SLASH_MENU_COMMAND");function Oo({anchorClassName:r,anchorElem:t,groups:e,menuRenderFn:o,onClose:n,onOpen:c,onQueryChange:s,triggerFn:i}){let[l]=Xe(),[a,u]=qe(null),p=Et(t,a,u,r),m=_t(()=>{u(null),n!=null&&a!==null&&n()},[n,a]),g=_t(f=>{u(f),c!=null&&a===null&&c(f)},[c,a]);return Tt(()=>Ge(l.registerCommand(Ze,({node:f})=>(l.getEditorState().read(()=>{let d={leadOffset:0,matchingString:"",replaceableString:""};if(!Ct(l,d.leadOffset)&&f!==null){let h=l._window??window,x=h.document.createRange();wt(d.leadOffset,x,h)!==null&&St(()=>g({getRect:()=>x.getBoundingClientRect(),match:d}));return}}),!0),Ye)),[l,g]),Tt(()=>{let f=()=>{l.getEditorState().read(()=>{let h=l._window??window,x=h.document.createRange(),E=j(),_=Je(l);if(!W(E)||!E.isCollapsed()||_===void 0||x===null){m();return}let T=i({editor:l,query:_});if(s(T?T.matchingString:null),T!==null&&!Ct(l,T.leadOffset)&&wt(T.leadOffset,x,h)!==null){St(()=>g({getRect:()=>x.getBoundingClientRect(),match:T}));return}m()})},d=l.registerUpdateListener(f);return()=>{d()}},[l,i,s,a,m,g]),p.current===null||a===null||l===null?null:Ve(xt,{anchorElementRef:p,close:m,editor:l,groups:e,menuRenderFn:o,resolution:a,shouldSplitNodeWithQuery:!0})}var Rt=class r{_bottom;_left;_right;_top;constructor(t,e,o,n){let[c,s]=e<=n?[e,n]:[n,e],[i,l]=t<=o?[t,o]:[o,t];this._top=c,this._right=l,this._left=i,this._bottom=s}static fromDOM(t){let{height:e,left:o,top:n,width:c}=t.getBoundingClientRect();return r.fromLWTH(o,c,n,e)}static fromDOMRect(t){let{height:e,left:o,top:n,width:c}=t;return r.fromLWTH(o,c,n,e)}static fromLTRB(t,e,o,n){return new r(t,e,o,n)}static fromLWTH(t,e,o,n){return new r(t,o,t+e,o+n)}static fromPoints(t,e){let{x:o,y:n}=t,{x:c,y:s}=e;return r.fromLTRB(o,n,c,s)}contains(t){if(lt(t)){let{x:s,y:i}=t,l=i<this._top,a=i>this._bottom,u=s<this._left,p=s>this._right;return{reason:{isOnBottomSide:a,isOnLeftSide:u,isOnRightSide:p,isOnTopSide:l},result:!l&&!a&&!u&&!p}}let{bottom:e,left:o,right:n,top:c}=t;return c>=this._top&&c<=this._bottom&&e>=this._top&&e<=this._bottom&&o>=this._left&&o<=this._right&&n>=this._left&&n<=this._right}distanceFromPoint(t){let e=this.contains(t);if(e.result)return{distance:0,isOnBottomSide:e.reason.isOnBottomSide,isOnLeftSide:e.reason.isOnLeftSide,isOnRightSide:e.reason.isOnRightSide,isOnTopSide:e.reason.isOnTopSide};let o=0,n=0;return t.x<this._left?o=this._left-t.x:t.x>this._right&&(o=t.x-this._right),t.y<this._top?n=this._top-t.y:t.y>this._bottom&&(n=t.y-this._bottom),{distance:Math.sqrt(o*o+n*n),isOnBottomSide:t.y>this._bottom,isOnLeftSide:t.x<this._left,isOnRightSide:t.x>this._right,isOnTopSide:t.y<this._top}}equals({bottom:t,left:e,right:o,top:n}){return n===this._top&&t===this._bottom&&e===this._left&&o===this._right}generateNewRect({bottom:t=this.bottom,left:e=this.left,right:o=this.right,top:n=this.top}){return new r(e,n,o,t)}intersectsWith(t){let{height:e,left:o,top:n,width:c}=t,{height:s,left:i,top:l,width:a}=this,u=o+c>=i+a?o+c:i+a,p=n+e>=l+s?n+e:l+s,m=o<=i?o:i,g=n<=l?n:l;return u-m<=c+a&&p-g<=e+s}get bottom(){return this._bottom}get height(){return Math.abs(this._bottom-this._top)}get left(){return this._left}get right(){return this._right}get top(){return this._top}get width(){return Math.abs(this._left-this._right)}};import q from"react";var A=new WeakMap;function Ao(r,t){A.has(r)||A.set(r,new Map);let e=A.get(r);for(let[o,n]of Object.entries(t))if(!(!n||typeof n!="object")){if(o==="blocks"){for(let[c,s]of Object.entries(n))e.set(`block:${c}`,s);continue}if(o==="inlineBlocks"){for(let[c,s]of Object.entries(n))e.set(`inlineBlock:${c}`,s);continue}e.set(o,n)}}function Do(r){A.delete(r)}function yt(r,t,e){let o=A.get(r);if(t==="block"&&e?.__fields?.blockType){let n=e.__fields.blockType;return o?.get(`block:${n}`)}if(t==="inlineBlock"&&e?.__fields?.blockType){let n=e.__fields.blockType;return o?.get(`inlineBlock:${n}`)}return o?.get(t)}function tn({node:r,nodeType:t}){if(!("getType"in r)||r.getType()!==t)return;let e=r;if(e.prototype._originalDecorate||(e.prototype._originalDecorate=e.prototype.decorate),e.prototype._originalCreateDOM||(e.prototype._originalCreateDOM=e.prototype.createDOM),e.prototype.decorate&&!e.prototype._decorateOverridden){e.prototype._decorateOverridden=!0;let o=!!e.prototype.createDOM;e.prototype.decorate=function(n,c){let s=yt(n,t,this);if(s){if(s.Component)return s.Component({config:c,editor:n,isEditor:!0,isJSXConverter:!1,node:this});if(s.createDOM&&s.html){let l=typeof s.html=="function"?s.html({config:c,editor:n,isEditor:!0,isJSXConverter:!1,node:this}):s.html;return q.createElement("span",{dangerouslySetInnerHTML:{__html:l}})}if(s.html&&o&&!s.createDOM)return q.createElement(q.Fragment);if(t==="block"){let l=s;if(l.Block||l.Label)return e.prototype._originalDecorate.call(this,n,c,l.Block,l.Label)}else if(t==="inlineBlock"){let l=s;if(l.Block||l.Label)return e.prototype._originalDecorate.call(this,n,c,l.Block,l.Label)}}return e.prototype._originalDecorate.call(this,n,c)}}e.prototype.createDOM&&!e.prototype._createDOMOverridden&&(e.prototype._createDOMOverridden=!0,e.prototype.createDOM=function(o,n){let c=yt(n,t,this);if(c){if(c.createDOM)return c.createDOM({config:o,editor:n,node:this});if(c.html){let s=typeof c.html=="function"?c.html({config:o,editor:n,isEditor:!0,isJSXConverter:!1,node:this}):c.html,i=document.createElement("div");return i.innerHTML=s,i.firstElementChild||i}}return e.prototype._originalCreateDOM.call(this,o,n)})}function Lo({editorConfig:r,nodeViews:t}){let e=en({nodes:r.features.nodes});if(t){let o=new Set;for(let[n,c]of Object.entries(t))!c||typeof c!="object"||(n==="blocks"&&Object.keys(c).length>0?o.add("block"):n==="inlineBlocks"&&Object.keys(c).length>0?o.add("inlineBlock"):o.add(n));for(let n of e)if("getType"in n){let c=n.getType();o.has(c)&&tn({node:n,nodeType:c})}}return e}function en({nodes:r}){return r.map(t=>"node"in t?t.node:t)}import{$getRoot as un,$isDecoratorNode as Ft,$isElementNode as P,$isLineBreakNode as dn,$isTextNode as H}from"lexical";import{$isListItemNode as nn,$isListNode as bt}from"@lexical/list";import{$isHeadingNode as on,$isQuoteNode as rn}from"@lexical/rich-text";import{$isParagraphNode as sn,$isTextNode as cn}from"lexical";var C={markdownFormatKind:null,regEx:/(?:)/,regExForAutoFormatting:/(?:)/,requiresParagraphStart:!1},R={...C,requiresParagraphStart:!0},Ho={...R,export:O(1),markdownFormatKind:"paragraphH1",regEx:/^# /,regExForAutoFormatting:/^# /},Ko={...R,export:O(2),markdownFormatKind:"paragraphH2",regEx:/^## /,regExForAutoFormatting:/^## /},Uo={...R,export:O(3),markdownFormatKind:"paragraphH3",regEx:/^### /,regExForAutoFormatting:/^### /},Vo={...R,export:O(4),markdownFormatKind:"paragraphH4",regEx:/^#### /,regExForAutoFormatting:/^#### /},Xo={...R,export:O(5),markdownFormatKind:"paragraphH5",regEx:/^##### /,regExForAutoFormatting:/^##### /},Go={...R,export:O(6),markdownFormatKind:"paragraphH6",regEx:/^###### /,regExForAutoFormatting:/^###### /},zo={...R,export:an,markdownFormatKind:"paragraphBlockQuote",regEx:/^> /,regExForAutoFormatting:/^> /},Yo={...R,export:Q,markdownFormatKind:"paragraphUnorderedList",regEx:/^(\s{0,10})- /,regExForAutoFormatting:/^(\s{0,10})- /},jo={...R,export:Q,markdownFormatKind:"paragraphUnorderedList",regEx:/^(\s{0,10})\* /,regExForAutoFormatting:/^(\s{0,10})\* /},Wo={...R,export:Q,markdownFormatKind:"paragraphOrderedList",regEx:/^(\s{0,10})(\d+)\.\s/,regExForAutoFormatting:/^(\s{0,10})(\d+)\.\s/},qo={...R,markdownFormatKind:"horizontalRule",regEx:/^\*\*\*$/,regExForAutoFormatting:/^\*\*\* /},Qo={...R,markdownFormatKind:"horizontalRule",regEx:/^---$/,regExForAutoFormatting:/^--- /},Jo={...C,exportFormat:"code",exportTag:"`",markdownFormatKind:"code",regEx:/(`)(\s*)([^`]*)(\s*)(`)()/,regExForAutoFormatting:/(`)(\s*\b)([^`]*)(\b\s*)(`)(\s)$/},Zo={...C,exportFormat:"bold",exportTag:"**",markdownFormatKind:"bold",regEx:/(\*\*)(\s*)([^*]*)(\s*)(\*\*)()/,regExForAutoFormatting:/(\*\*)(\s*\b)([^*]*)(\b\s*)(\*\*)(\s)$/},tr={...C,exportFormat:"italic",exportTag:"*",markdownFormatKind:"italic",regEx:/(\*)(\s*)([^*]*)(\s*)(\*)()/,regExForAutoFormatting:/(\*)(\s*\b)([^*]*)(\b\s*)(\*)(\s)$/},er={...C,exportFormat:"bold",exportTag:"_",markdownFormatKind:"bold",regEx:/(__)(\s*)([^_]*)(\s*)(__)()/,regExForAutoFormatting:/(__)(\s*)([^_]*)(\s*)(__)(\s)$/},nr={...C,exportFormat:"italic",exportTag:"_",markdownFormatKind:"italic",regEx:/(_)()([^_]*)()(_)()/,regExForAutoFormatting:/(_)()([^_]*)()(_)(\s)$/},or={...C,exportFormat:"underline",exportTag:"<u>",exportTagClose:"</u>",markdownFormatKind:"underline",regEx:/(<u>)(\s*)([^<]*)(\s*)(<\/u>)()/,regExForAutoFormatting:/(<u>)(\s*\b)([^<]*)(\b\s*)(<\/u>)(\s)$/},rr={...C,exportFormat:"strikethrough",exportTag:"~~",markdownFormatKind:"strikethrough",regEx:/(~~)(\s*)([^~]*)(\s*)(~~)()/,regExForAutoFormatting:/(~~)(\s*\b)([^~]*)(\b\s*)(~~)(\s)$/},ir={...C,markdownFormatKind:"strikethrough_italic_bold",regEx:/(~~_\*\*)(\s*\b)([^*_~]+)(\b\s*)(\*\*_~~)()/,regExForAutoFormatting:/(~~_\*\*)(\s*\b)([^*_~]+)(\b\s*)(\*\*_~~)(\s)$/},sr={...C,markdownFormatKind:"italic_bold",regEx:/(_\*\*)(\s*\b)([^*_]+)(\b\s*)(\*\*_)/,regExForAutoFormatting:/(_\*\*)(\s*\b)([^*_]+)(\b\s*)(\*\*_)(\s)$/},cr={...C,markdownFormatKind:"strikethrough_italic",regEx:/(~~_)(\s*)([^_~]+)(\s*)(_~~)/,regExForAutoFormatting:/(~~_)(\s*)([^_~]+)(\s*)(_~~)(\s)$/},lr={...C,markdownFormatKind:"strikethrough_bold",regEx:/(~~\*\*)(\s*\b)([^*~]+)(\b\s*)(\*\*~~)/,regExForAutoFormatting:/(~~\*\*)(\s*\b)([^*~]+)(\b\s*)(\*\*~~)(\s)$/},ar={...C,markdownFormatKind:"link",regEx:/(\[)([^\]]*)(\]\()([^)]*)(\)*)()/,regExForAutoFormatting:/(\[)([^\]]*)(\]\()([^)]*)(\)*)(\s)$/};function O(r){return(t,e)=>on(t)&&t.getTag()==="h"+r?"#".repeat(r)+" "+e(t):null}function Q(r,t){return bt(r)?kt(r,t,0):null}var ln=4;function kt(r,t,e){let o=[],n=r.getChildren(),c=0;for(let s of n)if(nn(s)){if(s.getChildrenSize()===1){let a=s.getFirstChild();if(bt(a)){o.push(kt(a,t,e+1));continue}}let i=" ".repeat(e*ln),l=r.getListType()==="bullet"?"- ":`${r.getStart()+c}. `;o.push(i+l+t(s)),c++}return o.join(`
2
- `)}function an(r,t){return rn(r)?"> "+t(r):null}function B(r,t){let e={};for(let o of r){let n=t(o);n&&(e[n]?e[n].push(o):e[n]=[o])}return e}function N(r){let t=B(r,e=>e.type);return{element:t.element||[],multilineElement:t["multiline-element"]||[],textFormat:t["text-format"]||[],textMatch:t["text-match"]||[]}}var F=/[!-/:-@[-`{-~\s]/,fn=/^\s{0,3}$/;function D(r){if(!sn(r))return!1;let t=r.getFirstChild();return t==null||r.getChildrenSize()===1&&cn(t)&&fn.test(t.getTextContent())}function It(r,t=!1){let e=N(r),o=[...e.multilineElement,...e.element],n=!t,c=e.textFormat.filter(s=>s.format.length===1).sort((s,i)=>s.format.includes("code")&&!i.format.includes("code")?1:!s.format.includes("code")&&i.format.includes("code")?-1:0);return s=>{let i=[],l=(s||un()).getChildren();return l.forEach((a,u)=>{let p=mn(a,o,c,e.textMatch);p!=null&&i.push(n&&u>0&&!D(a)&&!D(l[u-1])?`
3
- `.concat(p):p)}),i.join(`
4
- `)}}function mn(r,t,e,o){for(let n of t){if(!n.export)continue;let c=n.export(r,s=>K(s,e,o));if(c!=null)return c}return P(r)?K(r,e,o):Ft(r)?r.getTextContent():null}function K(r,t,e,o,n){let c=[],s=r.getChildren();o||(o=[]),n||(n=[]);t:for(let i of s){for(let l of e){if(!l.export)continue;let a=l.export(i,u=>K(u,t,e,o,[...n,...o]),(u,p)=>Ot(u,p,t,o,n));if(a!=null){c.push(a);continue t}}dn(i)?c.push(`
5
- `):H(i)?c.push(Ot(i,i.getTextContent(),t,o,n)):P(i)?c.push(K(i,t,e,o,n)):Ft(i)&&c.push(i.getTextContent())}return c.join("")}function Ot(r,t,e,o,n){let c=t.trim(),s=c;r.hasFormat("code")||(s=s.replace(/([*_`~\\])/g,"\\$1"));let i="",l="",a="",u=Nt(r,!0),p=Nt(r,!1),m=new Set;for(let g of e){let f=g.format[0],d=g.tag;v(r,f)&&!m.has(f)&&(m.add(f),(!v(u,f)||!o.find(h=>h.tag===d))&&(o.push({format:f,tag:d}),i+=d))}for(let g=0;g<o.length;g++){let f=o[g],d=v(r,f.format),h=v(p,f.format);if(d&&h)continue;let x=[...o];for(;x.length>g;){let E=x.pop();n&&E&&n.find(_=>_.tag===E.tag)||(E&&typeof E.tag=="string"&&(d?h||(a+=E.tag):l+=E.tag),o.pop())}break}return s=i+s+a,l+t.replace(c,()=>s)}function Nt(r,t){let e=t?r.getPreviousSibling():r.getNextSibling();if(!e){let o=r.getParentOrThrow();o.isInline()&&(e=t?o.getPreviousSibling():o.getNextSibling())}for(;e;){if(P(e)){if(!e.isInline())break;let o=t?e.getLastDescendant():e.getFirstDescendant();if(H(o))return o;e=t?e.getPreviousSibling():e.getNextSibling()}if(H(e))return e;if(!P(e))return null}return null}function v(r,t){return H(r)&&r.hasFormat(t)}import{$isListItemNode as gn,$isListNode as $t}from"@lexical/list";import{$isQuoteNode as hn}from"@lexical/rich-text";import{$findMatchingParent as xn}from"@lexical/utils";import{$createLineBreakNode as En,$createParagraphNode as _n,$createTextNode as Tn,$getRoot as wn,$getSelection as Cn,$isParagraphNode as Sn}from"lexical";import{$isTextNode as I}from"lexical";function Mt(r,t){let e=r.getTextContent(),o=pn(e,t);if(!o)return null;let n=o.index||0,c=n+o[0].length,s=t.transformersByTag[o[1]];return{endIndex:c,match:o,startIndex:n,transformer:s}}function pn(r,t){let e=r.match(t.openTagsRegExp);if(e==null)return null;for(let o of e){let n=o.replace(/^\s/,""),c=t.fullMatchRegExpByTag[n];if(c==null)continue;let s=r.match(c),i=t.transformersByTag[n];if(s!=null&&i!=null){if(i.intraword!==!1)return s;let{index:l=0}=s,a=r[l-1],u=r[l+s[0].length];if((!a||F.test(a))&&(!u||F.test(u)))return s}}return null}function At(r,t,e,o,n){let c=r.getTextContent(),s,i,l;if(n[0]===c?l=r:t===0?[l,s]=r.splitText(e):[i,l,s]=r.splitText(t,e),l.setTextContent(n[2]),o)for(let a of o.format)l.hasFormat(a)||l.toggleFormat(a);return{nodeAfter:s,nodeBefore:i,transformedNode:l}}function Dt(r,t){let e=r,o,n,c,s;for(let i of t){if(!i.replace||!i.importRegExp)continue;let l=e.getTextContent().match(i.importRegExp);if(!l)continue;let a=l.index||0,u=i.getEndIndex?i.getEndIndex(e,l):a+l[0].length;u!==!1&&(o===void 0||n===void 0||a<o&&u>n)&&(o=a,n=u,c=i,s=l)}return o===void 0||n===void 0||c===void 0||s===void 0?null:{endIndex:n,match:s,startIndex:o,transformer:c}}function Lt(r,t,e,o,n){let c,s,i;if(t===0?[i,c]=r.splitText(e):[s,i,c]=r.splitText(t,e),!o.replace)return null;let l=i?o.replace(i,n):void 0;return{nodeAfter:c,nodeBefore:s,transformedNode:l||void 0}}function y(r,t,e){let o=Mt(r,t),n=Dt(r,e);if(o&&n&&(o.startIndex<=n.startIndex&&o.endIndex>=n.endIndex?n=null:o=null),o){let i=At(r,o.startIndex,o.endIndex,o.transformer,o.match);i.nodeAfter&&I(i.nodeAfter)&&!i.nodeAfter.hasFormat("code")&&y(i.nodeAfter,t,e),i.nodeBefore&&I(i.nodeBefore)&&!i.nodeBefore.hasFormat("code")&&y(i.nodeBefore,t,e),i.transformedNode&&I(i.transformedNode)&&!i.transformedNode.hasFormat("code")&&y(i.transformedNode,t,e)}else if(n){let i=Lt(r,n.startIndex,n.endIndex,n.transformer,n.match);if(!i)return;i.nodeAfter&&I(i.nodeAfter)&&!i.nodeAfter.hasFormat("code")&&y(i.nodeAfter,t,e),i.nodeBefore&&I(i.nodeBefore)&&!i.nodeBefore.hasFormat("code")&&y(i.nodeBefore,t,e),i.transformedNode&&I(i.transformedNode)&&!i.transformedNode.hasFormat("code")&&y(i.transformedNode,t,e)}let s=r.getTextContent().replace(/\\([*_`~])/g,"$1");r.setTextContent(s)}function Bt(r,t=!1){let e=N(r),o=bn(e.textFormat);return(n,c)=>{let s=n.split(`
6
- `),i=s.length,l=c||wn();l.clear();for(let u=0;u<i;u++){let p=s[u],[m,g]=Rn(s,u,e.multilineElement,l);if(m){u=g;continue}yn(p,l,e.element,o,e.textMatch)}let a=l.getChildren();for(let u of a)!t&&D(u)&&l.getChildrenSize()>1&&u.remove();Cn()!==null&&l.selectStart()}}function Rn(r,t,e,o){for(let n of e){let{handleImportAfterStartMatch:c,regExpEnd:s,regExpStart:i,replace:l}=n,a=r[t]?.match(i);if(!a)continue;if(c){let f=c({lines:r,rootNode:o,startLineIndex:t,startMatch:a,transformer:n});if(f===null)continue;if(f)return f}let u=typeof s=="object"&&"regExp"in s?s.regExp:s,p=s&&typeof s=="object"&&"optional"in s?s.optional:!s,m=t,g=r.length;for(;m<g;){let f=u?r[m]?.match(u):null;if(!f&&(!p||p&&m<g-1)){m++;continue}if(f&&t===m&&f.index===a.index){m++;continue}let d=[];if(f&&t===m)d.push(r[t].slice(a[0].length,-f[0].length));else for(let h=t;h<=m;h++){let x=r[h];if(h===t){let E=x.slice(a[0].length);d.push(E)}else if(h===m&&f){let E=x.slice(0,-f[0].length);d.push(E)}else d.push(x)}if(l(o,null,a,f,d,!0)!==!1)return[!0,m];break}}return[!1,t]}function yn(r,t,e,o,n){let c=Tn(r),s=_n();s.append(c),t.append(s);for(let{regExp:i,replace:l}of e){let a=r.match(i);if(a&&(c.setTextContent(r.slice(a[0].length)),l(s,[c],a,!0)!==!1))break}if(y(c,o,n),s.isAttached()&&r.length>0){let i=s.getPreviousSibling();if(Sn(i)||hn(i)||$t(i)){let l=i;if($t(i)){let a=i.getLastDescendant();a==null?l=null:l=xn(a,gn)}l!=null&&l.getTextContentSize()>0&&(l.splice(l.getChildrenSize(),0,[En(),...s.getChildren()]),s.remove())}}}function bn(r){let t={},e={},o=[],n="(?<![\\\\])";for(let c of r){let{tag:s}=c;t[s]=c;let i=s.replace(/([*^+])/g,"\\$1");o.push(i),s.length===1?e[s]=new RegExp(`(?<![\\\\${i}])(${i})((\\\\${i})?.*?[^${i}\\s](\\\\${i})?)((?<!\\\\)|(?<=\\\\\\\\))(${i})(?![\\\\${i}])`):e[s]=new RegExp(`(?<!\\\\)(${i})((\\\\${i})?.*?[^\\s](\\\\${i})?)((?<!\\\\)|(?<=\\\\\\\\))(${i})(?!\\\\)`)}return{fullMatchRegExpByTag:e,openTagsRegExp:new RegExp(`${n}(${o.join("|")})`,"g"),transformersByTag:t}}import{$createRangeSelection as kn,$getSelection as J,$isLineBreakNode as On,$isRangeSelection as Z,$isRootOrShadowRoot as Pt,$isTextNode as Ht,$setSelection as Nn}from"lexical";function Fn(r,t,e,o){let n=r.getParent();if(!Pt(n)||r.getFirstChild()!==t)return!1;let c=t.getTextContent();if(c[e-1]!==" ")return!1;for(let{regExp:s,replace:i}of o){let l=c.match(s);if(l&&l[0].length===(l[0].endsWith(" ")?e:e-1)){let a=t.getNextSiblings(),[u,p]=t.splitText(e);u?.remove();let m=p?[p,...a]:a;if(i(r,m,l,!1)!==!1)return!0}}return!1}function In(r,t,e,o){let n=r.getParent();if(!Pt(n)||r.getFirstChild()!==t)return!1;let c=t.getTextContent();if(c[e-1]!==" ")return!1;for(let{regExpEnd:s,regExpStart:i,replace:l}of o){if(s&&!("optional"in s)||s&&"optional"in s&&!s.optional)continue;let a=c.match(i);if(a&&a[0].length===(a[0].endsWith(" ")?e:e-1)){let u=t.getNextSiblings(),[p,m]=t.splitText(e);p?.remove();let g=m?[m,...u]:u;if(l(r,g,a,null,null,!1)!==!1)return!0}}return!1}function Mn(r,t,e){let o=r.getTextContent(),n=o[t-1],c=e[n];if(c==null)return!1;t<o.length&&(o=o.slice(0,t));for(let s of c){if(!s.replace||!s.regExp)continue;let i=o.match(s.regExp);if(i===null)continue;let l=i.index||0,a=l+i[0].length,u;return l===0?[u]=r.splitText(a):[,u]=r.splitText(l,a),u&&(u.selectNext(0,0),s.replace(u,i)),!0}return!1}function An(r,t,e){let o=r.getTextContent(),n=t-1,c=o[n],s=e[c];if(!s)return!1;for(let i of s){let{tag:l}=i,a=l.length,u=n-a+1;if(a>1&&!Kt(o,u,l,0,a)||o[u-1]===" ")continue;let p=o[n+1];if(i.intraword===!1&&p&&!F.test(p))continue;let m=r,g=m,f=vt(o,u,l),d=g;for(;f<0&&(d=d.getPreviousSibling())&&!On(d);)if(Ht(d)){let S=d.getTextContent();g=d,f=vt(S,S.length,l)}if(f<0||g===m&&f+a===u)continue;let h=g.getTextContent();if(f>0&&h[f-1]===c)continue;let x=h[f-1];if(i.intraword===!1&&x&&!F.test(x))continue;let E=m.getTextContent(),_=E.slice(0,u)+E.slice(n+1);m.setTextContent(_);let T=g===m?_:h;g.setTextContent(T.slice(0,f)+T.slice(f+a));let b=J(),w=kn();Nn(w);let L=n-a*(g===m?2:1)+1;w.anchor.set(g.__key,f,"text"),w.focus.set(m.__key,L,"text");for(let S of i.format)w.hasFormat(S)||w.formatText(S);w.anchor.set(w.focus.key,w.focus.offset,w.focus.type);for(let S of i.format)w.hasFormat(S)&&w.toggleFormat(S);return Z(b)&&(w.format=b.format),!0}return!1}function vt(r,t,e){let o=e.length;for(let n=t;n>=o;n--){let c=n-o;if(Kt(r,c,e,0,o)&&r[c+o]!==" ")return c}return-1}function Kt(r,t,e,o,n){for(let c=0;c<n;c++)if(r[t+c]!==e[o+c])return!1;return!0}function Ir(r,t=U){let e=N(t),o=B(e.textFormat,({tag:s})=>s[s.length-1]),n=B(e.textMatch,({trigger:s})=>s);for(let s of t){let i=s.type;if(i==="element"||i==="text-match"||i==="multiline-element"){let l=s.dependencies;for(let a of l)if(!r.hasNode(a))throw new Error("MarkdownShortcuts: missing dependency %s for transformer. Ensure node dependency is included in editor initial config."+a.getType())}}let c=(s,i,l)=>{Fn(s,i,l,e.element)||In(s,i,l,e.multilineElement)||Mn(i,l,n)||An(i,l,o)};return r.registerUpdateListener(({dirtyLeaves:s,editorState:i,prevEditorState:l,tags:a})=>{if(a.has("collaboration")||a.has("historic")||r.isComposing())return;let u=i.read(J),p=l.read(J);if(!Z(p)||!Z(u)||!u.isCollapsed()||u.is(p))return;let m=u.anchor.key,g=u.anchor.offset,f=i._nodeMap.get(m);!Ht(f)||!s.has(m)||g!==1&&g>p.anchor.offset+1||r.update(()=>{if(f.hasFormat("code"))return;let d=f.getParent();d!==null&&c(d,f,u.anchor.offset)})})}import{$createListItemNode as Dn,$createListNode as Ln,$isListItemNode as $n,$isListNode as M,ListItemNode as et,ListNode as nt}from"@lexical/list";import{$createHeadingNode as Bn,$createQuoteNode as vn,$isHeadingNode as Pn,$isQuoteNode as Ut,HeadingNode as Hn,QuoteNode as Kn}from"@lexical/rich-text";import{$createLineBreakNode as Un}from"lexical";var Vt=/^[\t ]*$/,Yt=/^(\s*)(\d+)\.\s/,jt=/^(\s*)[-*+]\s/,Wt=/^(\s*)(?:-\s)?\s?(\[(\s|x)?\])\s/i,tt=/^(#{1,6})\s/,qt=/^>\s/,Vn=/^[ \t]*(\\`\\`\\`|```)(\w+)?/,Xt=/[ \t]*(\\`\\`\\`|```)$/,Xn=/^[ \t]*```[^`]+(?:(?:`{1,2}|`{4,})[^`]+)*```(?:[^`]|$)/,Gn=/^\|(.+)\|\s?$/,zn=/^(\| ?:?-*:? ?)+\|\s?$/,Gt=/^[ \t]*<[a-z_][\w-]*(?:\s[^<>]*)?\/?>/i,zt=/^[ \t]*<\/[a-z_][\w-]*\s*>/i,Yn=r=>(t,e,o)=>{let n=r(o);n.append(...e),t.replace(n),n.select(0,0)},Qt=4;function jn(r){let t=r.match(/\t/g),e=r.match(/ /g),o=0;return t&&(o+=t.length),e&&(o+=Math.floor(e.length/Qt)),o}var ot=r=>(t,e,o)=>{let n=t.getPreviousSibling(),c=t.getNextSibling(),s=Dn(r==="check"?o[3]==="x":void 0);if(M(c)&&c.getListType()===r){let l=c.getFirstChild();l!==null?l.insertBefore(s):c.append(s),t.remove()}else if(M(n)&&n.getListType()===r)n.append(s),t.remove();else{let l=Ln(r,r==="number"?Number(o[2]):void 0);l.append(s),t.replace(l)}s.append(...e),s.select(0,0);let i=jn(o[1]);i&&s.setIndent(i)},V=(r,t,e)=>{let o=[],n=r.getChildren(),c=0;for(let s of n)if($n(s)){if(s.getChildrenSize()===1){let u=s.getFirstChild();if(M(u)){o.push(V(u,t,e+1));continue}}let i=" ".repeat(e*Qt),l=r.getListType(),a=l==="number"?`${r.getStart()+c}. `:l==="check"?`- [${s.getChecked()?"x":" "}] `:"- ";o.push(i+a+t(s)),c++}return o.join(`
7
- `)},Jt={type:"element",dependencies:[Hn],export:(r,t)=>{if(!Pn(r))return null;let e=Number(r.getTag().slice(1));return"#".repeat(e)+" "+t(r)},regExp:tt,replace:Yn(r=>{let t="h"+r[1].length;return Bn(t)})},Zt={type:"element",dependencies:[Kn],export:(r,t)=>{if(!Ut(r))return null;let e=t(r).split(`
8
- `),o=[];for(let n of e)o.push("> "+n);return o.join(`
9
- `)},regExp:qt,replace:(r,t,e,o)=>{if(o){let c=r.getPreviousSibling();if(Ut(c)){c.splice(c.getChildrenSize(),0,[Un(),...t]),c.select(0,0),r.remove();return}}let n=vn();n.append(...t),r.replace(n),n.select(0,0)}},te={type:"element",dependencies:[nt,et],export:(r,t)=>M(r)?V(r,t,0):null,regExp:jt,replace:ot("bullet")},Wn={type:"element",dependencies:[nt,et],export:(r,t)=>M(r)?V(r,t,0):null,regExp:Wt,replace:ot("check")},ee={type:"element",dependencies:[nt,et],export:(r,t)=>M(r)?V(r,t,0):null,regExp:Yt,replace:ot("number")},ne={type:"text-format",format:["code"],tag:"`"},oe={type:"text-format",format:["highlight"],tag:"=="},re={type:"text-format",format:["bold","italic"],tag:"***"},ie={type:"text-format",format:["bold","italic"],intraword:!1,tag:"___"},se={type:"text-format",format:["bold"],tag:"**"},ce={type:"text-format",format:["bold"],intraword:!1,tag:"__"},le={type:"text-format",format:["strikethrough"],tag:"~~"},ae={type:"text-format",format:["italic"],tag:"*"},fe={type:"text-format",format:["italic"],intraword:!1,tag:"_"};function ue(r,t){let e=r.split(`
10
- `),o=!1,n=[],c=0;for(let s=0;s<e.length;s++){let i=e[s],l=n[n.length-1];if(Xn.test(i)){n.push(i);continue}if(Xt.test(i)){c===0&&(o=!0),c===1&&(o=!1),c>0&&c--,n.push(i);continue}if(Vn.test(i)){o=!0,c++,n.push(i);continue}if(o){n.push(i);continue}Vt.test(i)||Vt.test(l)||!l||tt.test(l)||tt.test(i)||qt.test(i)||Yt.test(i)||jt.test(i)||Wt.test(i)||Gn.test(i)||zn.test(i)||!t||Gt.test(i)||zt.test(i)||Gt.test(l)||zt.test(l)||Xt.test(l)?n.push(i):n[n.length-1]=l+" "+i.trim()}return n.join(`
11
- `)}var qn=[Jt,Zt,te,ee],Qn=[],Jn=[ne,re,ie,se,ce,oe,ae,fe,le],Zn=[],U=[...qn,...Qn,...Jn,...Zn];function Hr(r,t=U,e,o=!1,n=!0){let c=o?r:ue(r,n);return Bt(t,o)(c,e)}function Kr(r=U,t,e=!1){return It(r,e)(t)}export{Ir as a,Hr as b,Kr as c,st as d,ro as e,fo as f,Re as g,G as h,lt as i,ko as j,Ze as k,Oo as l,Rt as m,Ao as n,Do as o,Lo as p};
12
- //# sourceMappingURL=chunk-LH634DPU.js.map