@payloadcms/richtext-lexical 4.0.0-internal.1f9ae9a → 4.0.0-internal.21664f3

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 (573) hide show
  1. package/LICENSE.md +1 -1
  2. package/dist/cell/rscEntry.d.ts.map +1 -1
  3. package/dist/cell/rscEntry.js +5 -5
  4. package/dist/cell/rscEntry.js.map +1 -1
  5. package/dist/exports/client/Field-QGSHF22S.js +2 -0
  6. package/dist/exports/client/Field-QGSHF22S.js.map +7 -0
  7. package/dist/exports/client/{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/align/client/toolbarAlignGroup.d.ts.map +1 -1
  26. package/dist/features/blockquote/client/index.js +2 -2
  27. package/dist/features/blockquote/client/index.js.map +1 -1
  28. package/dist/features/blockquote/server/index.d.ts +1 -4
  29. package/dist/features/blockquote/server/index.d.ts.map +1 -1
  30. package/dist/features/blockquote/server/index.js +4 -2
  31. package/dist/features/blockquote/server/index.js.map +1 -1
  32. package/dist/features/blockquote/server/schema.d.ts +8 -0
  33. package/dist/features/blockquote/server/schema.d.ts.map +1 -0
  34. package/dist/features/blockquote/server/schema.js +15 -0
  35. package/dist/features/blockquote/server/schema.js.map +1 -0
  36. package/dist/features/blocks/client/component/index.css +2 -2
  37. package/dist/features/blocks/client/component/index.d.ts +2 -1
  38. package/dist/features/blocks/client/component/index.d.ts.map +1 -1
  39. package/dist/features/blocks/client/component/index.js +16 -8
  40. package/dist/features/blocks/client/component/index.js.map +1 -1
  41. package/dist/features/blocks/client/componentInline/components/InlineBlockContainer.d.ts.map +1 -1
  42. package/dist/features/blocks/client/componentInline/index.css +8 -8
  43. package/dist/features/blocks/client/componentInline/index.d.ts +2 -1
  44. package/dist/features/blocks/client/componentInline/index.d.ts.map +1 -1
  45. package/dist/features/blocks/client/componentInline/index.js +15 -7
  46. package/dist/features/blocks/client/componentInline/index.js.map +1 -1
  47. package/dist/features/blocks/client/getBlockImageComponent.d.ts +1 -1
  48. package/dist/features/blocks/client/index.d.ts.map +1 -1
  49. package/dist/features/blocks/client/index.js +4 -2
  50. package/dist/features/blocks/client/index.js.map +1 -1
  51. package/dist/features/blocks/client/markdown/getLexicalToMarkdown.d.ts +1 -1
  52. package/dist/features/blocks/client/markdown/getLexicalToMarkdown.d.ts.map +1 -1
  53. package/dist/features/blocks/client/markdown/getLexicalToMarkdown.js +1 -1
  54. package/dist/features/blocks/client/markdown/getLexicalToMarkdown.js.map +1 -1
  55. package/dist/features/blocks/client/markdown/getMarkdownToLexical.d.ts +1 -1
  56. package/dist/features/blocks/client/markdown/getMarkdownToLexical.d.ts.map +1 -1
  57. package/dist/features/blocks/client/markdown/getMarkdownToLexical.js +5 -2
  58. package/dist/features/blocks/client/markdown/getMarkdownToLexical.js.map +1 -1
  59. package/dist/features/blocks/client/markdown/markdownTransformer.d.ts +1 -2
  60. package/dist/features/blocks/client/markdown/markdownTransformer.d.ts.map +1 -1
  61. package/dist/features/blocks/client/markdown/markdownTransformer.js +4 -4
  62. package/dist/features/blocks/client/markdown/markdownTransformer.js.map +1 -1
  63. package/dist/features/blocks/client/nodes/BlocksNode.d.ts +1 -1
  64. package/dist/features/blocks/client/nodes/BlocksNode.d.ts.map +1 -1
  65. package/dist/features/blocks/client/nodes/BlocksNode.js.map +1 -1
  66. package/dist/features/blocks/client/nodes/InlineBlocksNode.d.ts +1 -1
  67. package/dist/features/blocks/client/nodes/InlineBlocksNode.d.ts.map +1 -1
  68. package/dist/features/blocks/client/nodes/InlineBlocksNode.js.map +1 -1
  69. package/dist/features/blocks/client/plugin/index.d.ts +1 -1
  70. package/dist/features/blocks/client/plugin/index.d.ts.map +1 -1
  71. package/dist/features/blocks/client/plugin/index.js.map +1 -1
  72. package/dist/features/blocks/premade/CodeBlock/Component/Block.d.ts.map +1 -1
  73. package/dist/features/blocks/premade/CodeBlock/Component/Block.js +1 -0
  74. package/dist/features/blocks/premade/CodeBlock/Component/Block.js.map +1 -1
  75. package/dist/features/blocks/premade/CodeBlock/Component/Collapse/index.css +1 -1
  76. package/dist/features/blocks/premade/CodeBlock/Component/FloatingCollapse/index.css +2 -4
  77. package/dist/features/blocks/premade/CodeBlock/Component/index.css +5 -5
  78. package/dist/features/blocks/server/graphQLPopulationPromise.d.ts +1 -2
  79. package/dist/features/blocks/server/graphQLPopulationPromise.d.ts.map +1 -1
  80. package/dist/features/blocks/server/graphQLPopulationPromise.js.map +1 -1
  81. package/dist/features/blocks/server/index.d.ts +1 -0
  82. package/dist/features/blocks/server/index.d.ts.map +1 -1
  83. package/dist/features/blocks/server/index.js +24 -72
  84. package/dist/features/blocks/server/index.js.map +1 -1
  85. package/dist/features/blocks/server/markdown/markdownTransformer.d.ts +1 -1
  86. package/dist/features/blocks/server/markdown/markdownTransformer.d.ts.map +1 -1
  87. package/dist/features/blocks/server/markdown/markdownTransformer.js +4 -4
  88. package/dist/features/blocks/server/markdown/markdownTransformer.js.map +1 -1
  89. package/dist/features/blocks/server/nodes/BlocksNode.d.ts +1 -18
  90. package/dist/features/blocks/server/nodes/BlocksNode.d.ts.map +1 -1
  91. package/dist/features/blocks/server/nodes/BlocksNode.js.map +1 -1
  92. package/dist/features/blocks/server/nodes/InlineBlocksNode.d.ts +2 -10
  93. package/dist/features/blocks/server/nodes/InlineBlocksNode.d.ts.map +1 -1
  94. package/dist/features/blocks/server/nodes/InlineBlocksNode.js.map +1 -1
  95. package/dist/features/blocks/server/schema.d.ts +45 -0
  96. package/dist/features/blocks/server/schema.d.ts.map +1 -0
  97. package/dist/features/blocks/server/schema.js +140 -0
  98. package/dist/features/blocks/server/schema.js.map +1 -0
  99. package/dist/features/blocks/server/validate.d.ts +1 -2
  100. package/dist/features/blocks/server/validate.d.ts.map +1 -1
  101. package/dist/features/blocks/server/validate.js.map +1 -1
  102. package/dist/features/converters/htmlToLexical/index.d.ts.map +1 -1
  103. package/dist/features/converters/lexicalToHtml/async/converters/upload.js.map +1 -1
  104. package/dist/features/converters/lexicalToHtml/async/types.d.ts +14 -15
  105. package/dist/features/converters/lexicalToHtml/async/types.d.ts.map +1 -1
  106. package/dist/features/converters/lexicalToHtml/async/types.js.map +1 -1
  107. package/dist/features/converters/lexicalToHtml/shared/cssColors.d.ts.map +1 -1
  108. package/dist/features/converters/lexicalToHtml/sync/converters/upload.js.map +1 -1
  109. package/dist/features/converters/lexicalToHtml/sync/types.d.ts +14 -15
  110. package/dist/features/converters/lexicalToHtml/sync/types.d.ts.map +1 -1
  111. package/dist/features/converters/lexicalToHtml/sync/types.js.map +1 -1
  112. package/dist/features/converters/lexicalToJSX/Component/index.d.ts +4 -2
  113. package/dist/features/converters/lexicalToJSX/Component/index.d.ts.map +1 -1
  114. package/dist/features/converters/lexicalToJSX/Component/index.js +5 -4
  115. package/dist/features/converters/lexicalToJSX/Component/index.js.map +1 -1
  116. package/dist/features/converters/lexicalToJSX/converter/converters/upload.js.map +1 -1
  117. package/dist/features/converters/lexicalToJSX/converter/types.d.ts +12 -14
  118. package/dist/features/converters/lexicalToJSX/converter/types.d.ts.map +1 -1
  119. package/dist/features/converters/lexicalToJSX/converter/types.js.map +1 -1
  120. package/dist/features/converters/lexicalToMarkdown/index.d.ts.map +1 -1
  121. package/dist/features/converters/lexicalToMarkdown/index.js +1 -1
  122. package/dist/features/converters/lexicalToMarkdown/index.js.map +1 -1
  123. package/dist/features/converters/lexicalToPlaintext/sync/types.d.ts +12 -14
  124. package/dist/features/converters/lexicalToPlaintext/sync/types.d.ts.map +1 -1
  125. package/dist/features/converters/lexicalToPlaintext/sync/types.js.map +1 -1
  126. package/dist/features/converters/markdownToLexical/index.d.ts.map +1 -1
  127. package/dist/features/converters/markdownToLexical/index.js +5 -2
  128. package/dist/features/converters/markdownToLexical/index.js.map +1 -1
  129. package/dist/features/debug/jsxConverter/client/plugin/style.css +2 -2
  130. package/dist/features/experimental_table/client/index.js +2 -2
  131. package/dist/features/experimental_table/client/index.js.map +1 -1
  132. package/dist/features/experimental_table/client/utils/debounce.d.ts.map +1 -1
  133. package/dist/features/experimental_table/markdownTransformer.d.ts +2 -2
  134. package/dist/features/experimental_table/markdownTransformer.d.ts.map +1 -1
  135. package/dist/features/experimental_table/markdownTransformer.js +6 -3
  136. package/dist/features/experimental_table/markdownTransformer.js.map +1 -1
  137. package/dist/features/experimental_table/server/index.d.ts +1 -6
  138. package/dist/features/experimental_table/server/index.d.ts.map +1 -1
  139. package/dist/features/experimental_table/server/index.js +6 -2
  140. package/dist/features/experimental_table/server/index.js.map +1 -1
  141. package/dist/features/experimental_table/server/schema.d.ts +27 -0
  142. package/dist/features/experimental_table/server/schema.d.ts.map +1 -0
  143. package/dist/features/experimental_table/server/schema.js +107 -0
  144. package/dist/features/experimental_table/server/schema.js.map +1 -0
  145. package/dist/features/format/bold/feature.client.js +1 -1
  146. package/dist/features/format/bold/feature.client.js.map +1 -1
  147. package/dist/features/format/bold/feature.server.d.ts.map +1 -1
  148. package/dist/features/format/bold/feature.server.js +1 -1
  149. package/dist/features/format/bold/feature.server.js.map +1 -1
  150. package/dist/features/format/inlineCode/feature.client.js +1 -1
  151. package/dist/features/format/inlineCode/feature.client.js.map +1 -1
  152. package/dist/features/format/inlineCode/feature.server.d.ts.map +1 -1
  153. package/dist/features/format/inlineCode/feature.server.js +1 -1
  154. package/dist/features/format/inlineCode/feature.server.js.map +1 -1
  155. package/dist/features/format/italic/feature.client.js +1 -1
  156. package/dist/features/format/italic/feature.client.js.map +1 -1
  157. package/dist/features/format/italic/feature.server.d.ts.map +1 -1
  158. package/dist/features/format/italic/feature.server.js +1 -1
  159. package/dist/features/format/italic/feature.server.js.map +1 -1
  160. package/dist/features/format/shared/toolbarFormatGroup.d.ts.map +1 -1
  161. package/dist/features/format/strikethrough/feature.client.js +1 -1
  162. package/dist/features/format/strikethrough/feature.client.js.map +1 -1
  163. package/dist/features/format/strikethrough/feature.server.d.ts.map +1 -1
  164. package/dist/features/format/strikethrough/feature.server.js +1 -1
  165. package/dist/features/format/strikethrough/feature.server.js.map +1 -1
  166. package/dist/features/heading/client/index.js +2 -2
  167. package/dist/features/heading/client/index.js.map +1 -1
  168. package/dist/features/heading/markdownTransformer.d.ts +2 -2
  169. package/dist/features/heading/markdownTransformer.d.ts.map +1 -1
  170. package/dist/features/heading/markdownTransformer.js +6 -19
  171. package/dist/features/heading/markdownTransformer.js.map +1 -1
  172. package/dist/features/heading/server/index.d.ts +2 -4
  173. package/dist/features/heading/server/index.d.ts.map +1 -1
  174. package/dist/features/heading/server/index.js +4 -2
  175. package/dist/features/heading/server/index.js.map +1 -1
  176. package/dist/features/heading/server/schema.d.ts +10 -0
  177. package/dist/features/heading/server/schema.d.ts.map +1 -0
  178. package/dist/features/heading/server/schema.js +37 -0
  179. package/dist/features/heading/server/schema.js.map +1 -0
  180. package/dist/features/horizontalRule/client/index.js +2 -2
  181. package/dist/features/horizontalRule/client/index.js.map +1 -1
  182. package/dist/features/horizontalRule/client/markdownTransformer.d.ts +2 -2
  183. package/dist/features/horizontalRule/client/markdownTransformer.d.ts.map +1 -1
  184. package/dist/features/horizontalRule/client/markdownTransformer.js +1 -1
  185. package/dist/features/horizontalRule/client/markdownTransformer.js.map +1 -1
  186. package/dist/features/horizontalRule/client/nodes/HorizontalRuleNode.d.ts +1 -1
  187. package/dist/features/horizontalRule/client/nodes/HorizontalRuleNode.d.ts.map +1 -1
  188. package/dist/features/horizontalRule/client/nodes/HorizontalRuleNode.js.map +1 -1
  189. package/dist/features/horizontalRule/client/plugin/index.css +2 -2
  190. package/dist/features/horizontalRule/server/index.d.ts +1 -0
  191. package/dist/features/horizontalRule/server/index.d.ts.map +1 -1
  192. package/dist/features/horizontalRule/server/index.js +4 -2
  193. package/dist/features/horizontalRule/server/index.js.map +1 -1
  194. package/dist/features/horizontalRule/server/markdownTransformer.d.ts +2 -2
  195. package/dist/features/horizontalRule/server/markdownTransformer.d.ts.map +1 -1
  196. package/dist/features/horizontalRule/server/markdownTransformer.js +1 -1
  197. package/dist/features/horizontalRule/server/markdownTransformer.js.map +1 -1
  198. package/dist/features/horizontalRule/server/nodes/HorizontalRuleNode.d.ts +1 -5
  199. package/dist/features/horizontalRule/server/nodes/HorizontalRuleNode.d.ts.map +1 -1
  200. package/dist/features/horizontalRule/server/nodes/HorizontalRuleNode.js.map +1 -1
  201. package/dist/features/horizontalRule/server/schema.d.ts +7 -0
  202. package/dist/features/horizontalRule/server/schema.d.ts.map +1 -0
  203. package/dist/features/horizontalRule/server/schema.js +25 -0
  204. package/dist/features/horizontalRule/server/schema.js.map +1 -0
  205. package/dist/features/indent/client/toolbarIndentGroup.d.ts.map +1 -1
  206. package/dist/features/link/client/index.d.ts.map +1 -1
  207. package/dist/features/link/client/index.js +2 -2
  208. package/dist/features/link/client/index.js.map +1 -1
  209. package/dist/features/link/client/plugins/autoLink/index.d.ts +1 -1
  210. package/dist/features/link/client/plugins/autoLink/index.d.ts.map +1 -1
  211. package/dist/features/link/client/plugins/autoLink/index.js.map +1 -1
  212. package/dist/features/link/client/plugins/floatingLinkEditor/LinkEditor/index.js +3 -3
  213. package/dist/features/link/client/plugins/floatingLinkEditor/LinkEditor/index.js.map +1 -1
  214. package/dist/features/link/client/plugins/floatingLinkEditor/index.css +7 -11
  215. package/dist/features/link/client/plugins/floatingLinkEditor/types.d.ts +1 -1
  216. package/dist/features/link/client/plugins/floatingLinkEditor/types.d.ts.map +1 -1
  217. package/dist/features/link/client/plugins/floatingLinkEditor/types.js.map +1 -1
  218. package/dist/features/link/client/plugins/link/index.js.map +1 -1
  219. package/dist/features/link/markdownTransformer.d.ts +5 -5
  220. package/dist/features/link/markdownTransformer.d.ts.map +1 -1
  221. package/dist/features/link/markdownTransformer.js +2 -2
  222. package/dist/features/link/markdownTransformer.js.map +1 -1
  223. package/dist/features/link/markdownTransformer.spec.js +10 -10
  224. package/dist/features/link/markdownTransformer.spec.js.map +1 -1
  225. package/dist/features/link/nodes/AutoLinkNode.d.ts +3 -3
  226. package/dist/features/link/nodes/AutoLinkNode.d.ts.map +1 -1
  227. package/dist/features/link/nodes/AutoLinkNode.js +2 -1
  228. package/dist/features/link/nodes/AutoLinkNode.js.map +1 -1
  229. package/dist/features/link/nodes/LinkNode.d.ts +3 -3
  230. package/dist/features/link/nodes/LinkNode.d.ts.map +1 -1
  231. package/dist/features/link/nodes/LinkNode.js +2 -1
  232. package/dist/features/link/nodes/LinkNode.js.map +1 -1
  233. package/dist/features/link/server/baseFields.d.ts.map +1 -1
  234. package/dist/features/link/server/baseFields.js.map +1 -1
  235. package/dist/features/link/server/graphQLPopulationPromise.d.ts +1 -1
  236. package/dist/features/link/server/graphQLPopulationPromise.d.ts.map +1 -1
  237. package/dist/features/link/server/graphQLPopulationPromise.js.map +1 -1
  238. package/dist/features/link/server/index.d.ts +2 -1
  239. package/dist/features/link/server/index.d.ts.map +1 -1
  240. package/dist/features/link/server/index.js +5 -2
  241. package/dist/features/link/server/index.js.map +1 -1
  242. package/dist/features/link/server/schema.d.ts +32 -0
  243. package/dist/features/link/server/schema.d.ts.map +1 -0
  244. package/dist/features/link/server/schema.js +171 -0
  245. package/dist/features/link/server/schema.js.map +1 -0
  246. package/dist/features/link/server/validate.d.ts +1 -1
  247. package/dist/features/link/server/validate.d.ts.map +1 -1
  248. package/dist/features/link/server/validate.js.map +1 -1
  249. package/dist/features/lists/checklist/client/index.js +1 -1
  250. package/dist/features/lists/checklist/client/index.js.map +1 -1
  251. package/dist/features/lists/checklist/server/index.d.ts.map +1 -1
  252. package/dist/features/lists/checklist/server/index.js +4 -1
  253. package/dist/features/lists/checklist/server/index.js.map +1 -1
  254. package/dist/features/lists/orderedList/client/index.js +1 -1
  255. package/dist/features/lists/orderedList/client/index.js.map +1 -1
  256. package/dist/features/lists/orderedList/server/index.d.ts.map +1 -1
  257. package/dist/features/lists/orderedList/server/index.js +4 -1
  258. package/dist/features/lists/orderedList/server/index.js.map +1 -1
  259. package/dist/features/lists/plugin/index.d.ts +0 -9
  260. package/dist/features/lists/plugin/index.d.ts.map +1 -1
  261. package/dist/features/lists/plugin/index.js.map +1 -1
  262. package/dist/features/lists/shared/schema.d.ts +18 -0
  263. package/dist/features/lists/shared/schema.d.ts.map +1 -0
  264. package/dist/features/lists/shared/schema.js +62 -0
  265. package/dist/features/lists/shared/schema.js.map +1 -0
  266. package/dist/features/lists/unorderedList/client/index.js +1 -1
  267. package/dist/features/lists/unorderedList/client/index.js.map +1 -1
  268. package/dist/features/lists/unorderedList/server/index.d.ts.map +1 -1
  269. package/dist/features/lists/unorderedList/server/index.js +4 -1
  270. package/dist/features/lists/unorderedList/server/index.js.map +1 -1
  271. package/dist/features/relationship/client/components/RelationshipComponent.d.ts +1 -1
  272. package/dist/features/relationship/client/components/RelationshipComponent.d.ts.map +1 -1
  273. package/dist/features/relationship/client/components/RelationshipComponent.js.map +1 -1
  274. package/dist/features/relationship/client/drawer/index.d.ts.map +1 -1
  275. package/dist/features/relationship/client/nodes/RelationshipNode.d.ts +1 -1
  276. package/dist/features/relationship/client/nodes/RelationshipNode.d.ts.map +1 -1
  277. package/dist/features/relationship/client/nodes/RelationshipNode.js.map +1 -1
  278. package/dist/features/relationship/client/plugins/index.d.ts +1 -1
  279. package/dist/features/relationship/client/plugins/index.d.ts.map +1 -1
  280. package/dist/features/relationship/client/plugins/index.js.map +1 -1
  281. package/dist/features/relationship/client/utils/useEnabledRelationships.d.ts.map +1 -1
  282. package/dist/features/relationship/client/utils/useEnabledRelationships.js +9 -40
  283. package/dist/features/relationship/client/utils/useEnabledRelationships.js.map +1 -1
  284. package/dist/features/relationship/server/graphQLPopulationPromise.d.ts +1 -1
  285. package/dist/features/relationship/server/graphQLPopulationPromise.d.ts.map +1 -1
  286. package/dist/features/relationship/server/graphQLPopulationPromise.js.map +1 -1
  287. package/dist/features/relationship/server/index.d.ts +1 -0
  288. package/dist/features/relationship/server/index.d.ts.map +1 -1
  289. package/dist/features/relationship/server/index.js +2 -0
  290. package/dist/features/relationship/server/index.js.map +1 -1
  291. package/dist/features/relationship/server/nodes/RelationshipNode.d.ts +1 -10
  292. package/dist/features/relationship/server/nodes/RelationshipNode.d.ts.map +1 -1
  293. package/dist/features/relationship/server/nodes/RelationshipNode.js.map +1 -1
  294. package/dist/features/relationship/server/schema.d.ts +28 -0
  295. package/dist/features/relationship/server/schema.d.ts.map +1 -0
  296. package/dist/features/relationship/server/schema.js +97 -0
  297. package/dist/features/relationship/server/schema.js.map +1 -0
  298. package/dist/features/relationship/shared/filterEnabledRelationshipCollections.d.ts +23 -0
  299. package/dist/features/relationship/shared/filterEnabledRelationshipCollections.d.ts.map +1 -0
  300. package/dist/features/relationship/shared/filterEnabledRelationshipCollections.js +34 -0
  301. package/dist/features/relationship/shared/filterEnabledRelationshipCollections.js.map +1 -0
  302. package/dist/features/shared/toolbar/addDropdownGroup.d.ts.map +1 -1
  303. package/dist/features/shared/toolbar/featureButtonsGroup.d.ts.map +1 -1
  304. package/dist/features/shared/toolbar/textDropdownGroup.d.ts.map +1 -1
  305. package/dist/features/textState/feature.client.js +1 -1
  306. package/dist/features/textState/feature.client.js.map +1 -1
  307. package/dist/features/toolbars/fixed/client/Toolbar/index.css +2 -2
  308. package/dist/features/toolbars/inline/client/Toolbar/index.css +2 -13
  309. package/dist/features/toolbars/shared/ToolbarButton/index.d.ts.map +1 -1
  310. package/dist/features/toolbars/shared/ToolbarDropdown/index.css +8 -12
  311. package/dist/features/toolbars/shared/ToolbarDropdown/index.d.ts.map +1 -1
  312. package/dist/features/toolbars/shared/useToolbarStates.d.ts.map +1 -1
  313. package/dist/features/toolbars/shared/useToolbarStates.js +3 -1
  314. package/dist/features/toolbars/shared/useToolbarStates.js.map +1 -1
  315. package/dist/features/typesClient.d.ts +1 -1
  316. package/dist/features/typesClient.d.ts.map +1 -1
  317. package/dist/features/typesClient.js.map +1 -1
  318. package/dist/features/typesServer.d.ts +18 -41
  319. package/dist/features/typesServer.d.ts.map +1 -1
  320. package/dist/features/typesServer.js.map +1 -1
  321. package/dist/features/upload/client/component/index.css +11 -11
  322. package/dist/features/upload/client/component/index.d.ts +1 -1
  323. package/dist/features/upload/client/component/index.d.ts.map +1 -1
  324. package/dist/features/upload/client/component/index.js.map +1 -1
  325. package/dist/features/upload/client/drawer/index.d.ts.map +1 -1
  326. package/dist/features/upload/client/nodes/UploadNode.d.ts +1 -1
  327. package/dist/features/upload/client/nodes/UploadNode.d.ts.map +1 -1
  328. package/dist/features/upload/client/nodes/UploadNode.js.map +1 -1
  329. package/dist/features/upload/client/plugin/index.d.ts +1 -1
  330. package/dist/features/upload/client/plugin/index.d.ts.map +1 -1
  331. package/dist/features/upload/client/plugin/index.js +5 -5
  332. package/dist/features/upload/client/plugin/index.js.map +1 -1
  333. package/dist/features/upload/server/graphQLPopulationPromise.d.ts +1 -1
  334. package/dist/features/upload/server/graphQLPopulationPromise.d.ts.map +1 -1
  335. package/dist/features/upload/server/graphQLPopulationPromise.js.map +1 -1
  336. package/dist/features/upload/server/index.d.ts +1 -0
  337. package/dist/features/upload/server/index.d.ts.map +1 -1
  338. package/dist/features/upload/server/index.js +5 -4
  339. package/dist/features/upload/server/index.js.map +1 -1
  340. package/dist/features/upload/server/markdownTransformer.d.ts +2 -2
  341. package/dist/features/upload/server/markdownTransformer.d.ts.map +1 -1
  342. package/dist/features/upload/server/markdownTransformer.js +1 -1
  343. package/dist/features/upload/server/markdownTransformer.js.map +1 -1
  344. package/dist/features/upload/server/nodes/UploadNode.d.ts +1 -55
  345. package/dist/features/upload/server/nodes/UploadNode.d.ts.map +1 -1
  346. package/dist/features/upload/server/nodes/UploadNode.js.map +1 -1
  347. package/dist/features/upload/server/nodes/conversions.d.ts.map +1 -1
  348. package/dist/features/upload/server/nodes/conversions.js.map +1 -1
  349. package/dist/features/upload/server/schema.d.ts +52 -0
  350. package/dist/features/upload/server/schema.d.ts.map +1 -0
  351. package/dist/features/upload/server/schema.js +149 -0
  352. package/dist/features/upload/server/schema.js.map +1 -0
  353. package/dist/features/upload/server/validate.d.ts +1 -1
  354. package/dist/features/upload/server/validate.d.ts.map +1 -1
  355. package/dist/features/upload/server/validate.js.map +1 -1
  356. package/dist/field/Diff/converters/unknown/index.css +1 -1
  357. package/dist/field/Diff/converters/upload/index.js.map +1 -1
  358. package/dist/field/Field.d.ts.map +1 -1
  359. package/dist/field/Field.js +18 -15
  360. package/dist/field/Field.js.map +1 -1
  361. package/dist/field/ViewSelector.css +1 -1
  362. package/dist/field/bundled.css +1 -1
  363. package/dist/field/index.css +5 -5
  364. package/dist/field/index.js +1 -1
  365. package/dist/field/index.js.map +1 -1
  366. package/dist/field/rscEntry.d.ts.map +1 -1
  367. package/dist/field/rscEntry.js +2 -0
  368. package/dist/field/rscEntry.js.map +1 -1
  369. package/dist/index.d.ts +10 -7
  370. package/dist/index.d.ts.map +1 -1
  371. package/dist/index.js +3 -3
  372. package/dist/index.js.map +1 -1
  373. package/dist/lexical/LexicalEditor.css +4 -2
  374. package/dist/lexical/config/client/EditorConfigProvider.d.ts.map +1 -1
  375. package/dist/lexical/config/client/loader.d.ts.map +1 -1
  376. package/dist/lexical/config/client/loader.js +5 -1
  377. package/dist/lexical/config/client/loader.js.map +1 -1
  378. package/dist/lexical/config/client/sanitize.d.ts.map +1 -1
  379. package/dist/lexical/config/server/sanitize.d.ts.map +1 -1
  380. package/dist/lexical/config/server/sanitize.js +9 -11
  381. package/dist/lexical/config/server/sanitize.js.map +1 -1
  382. package/dist/lexical/plugins/DecoratorPlugin/index.css +1 -1
  383. package/dist/lexical/plugins/MarkdownShortcut/index.d.ts.map +1 -1
  384. package/dist/lexical/plugins/MarkdownShortcut/index.js +1 -1
  385. package/dist/lexical/plugins/MarkdownShortcut/index.js.map +1 -1
  386. package/dist/lexical/plugins/NodeViewOverridePlugin/index.d.ts.map +1 -1
  387. package/dist/lexical/plugins/NodeViewOverridePlugin/index.js +21 -0
  388. package/dist/lexical/plugins/NodeViewOverridePlugin/index.js.map +1 -1
  389. package/dist/lexical/plugins/SlashMenu/index.css +1 -5
  390. package/dist/lexical/plugins/handles/AddBlockHandlePlugin/index.css +1 -1
  391. package/dist/lexical/plugins/handles/DraggableBlockPlugin/debounce.d.ts.map +1 -1
  392. package/dist/lexical/plugins/handles/DraggableBlockPlugin/index.css +4 -3
  393. package/dist/lexical/plugins/handles/DraggableBlockPlugin/index.js +1 -1
  394. package/dist/lexical/plugins/handles/DraggableBlockPlugin/index.js.map +1 -1
  395. package/dist/lexical/plugins/handles/utils/calculateDistanceFromScrollerElem.d.ts.map +1 -1
  396. package/dist/lexical/theme/EditorTheme.css +18 -19
  397. package/dist/lexical/ui/ContentEditable.css +9 -5
  398. package/dist/lexical/utils/markdown/convertFromMarkdownString.d.ts +17 -0
  399. package/dist/lexical/utils/markdown/convertFromMarkdownString.d.ts.map +1 -0
  400. package/dist/lexical/utils/markdown/convertFromMarkdownString.js +27 -0
  401. package/dist/lexical/utils/markdown/convertFromMarkdownString.js.map +1 -0
  402. package/dist/lexical/utils/markdown/convertFromMarkdownString.spec.js +88 -0
  403. package/dist/lexical/utils/markdown/convertFromMarkdownString.spec.js.map +1 -0
  404. package/dist/lexical/utils/markdown/createBlockNode.d.ts +2 -2
  405. package/dist/lexical/utils/markdown/createBlockNode.d.ts.map +1 -1
  406. package/dist/lexical/utils/markdown/createBlockNode.js.map +1 -1
  407. package/dist/lexical/utils/markdown/normalizeMarkdown.d.ts +25 -0
  408. package/dist/lexical/utils/markdown/normalizeMarkdown.d.ts.map +1 -0
  409. package/dist/lexical/utils/markdown/normalizeMarkdown.js +91 -0
  410. package/dist/lexical/utils/markdown/normalizeMarkdown.js.map +1 -0
  411. package/dist/lexical/utils/nodeFormat.d.ts.map +1 -1
  412. package/dist/lexical/utils/point.d.ts.map +1 -1
  413. package/dist/lexical/utils/rect.d.ts.map +1 -1
  414. package/dist/lexical-proxy/@lexical-markdown.d.ts +1 -1
  415. package/dist/lexical-proxy/@lexical-markdown.d.ts.map +1 -1
  416. package/dist/lexical-proxy/@lexical-markdown.js +1 -1
  417. package/dist/lexical-proxy/@lexical-markdown.js.map +1 -1
  418. package/dist/populateGraphQL/populateLexicalPopulationPromises.d.ts.map +1 -1
  419. package/dist/populateGraphQL/recursivelyPopulateFieldsForGraphQL.d.ts.map +1 -1
  420. package/dist/types/builtInNodes.d.ts +14 -0
  421. package/dist/types/builtInNodes.d.ts.map +1 -0
  422. package/dist/types/builtInNodes.js +203 -0
  423. package/dist/types/builtInNodes.js.map +1 -0
  424. package/dist/types/index.d.ts +16 -17
  425. package/dist/types/index.d.ts.map +1 -1
  426. package/dist/types/index.js.map +1 -1
  427. package/dist/types/jsonSchemaHelpers.d.ts +30 -0
  428. package/dist/types/jsonSchemaHelpers.d.ts.map +1 -0
  429. package/dist/types/jsonSchemaHelpers.js +58 -0
  430. package/dist/types/jsonSchemaHelpers.js.map +1 -0
  431. package/dist/types/nodeTypes.d.ts +115 -61
  432. package/dist/types/nodeTypes.d.ts.map +1 -1
  433. package/dist/types/nodeTypes.js +3 -2
  434. package/dist/types/nodeTypes.js.map +1 -1
  435. package/dist/types/schema.d.ts.map +1 -1
  436. package/dist/types/schema.js +74 -65
  437. package/dist/types/schema.js.map +1 -1
  438. package/dist/utilities/applyBaseFilterToFields.d.ts.map +1 -1
  439. package/dist/utilities/applyBaseFilterToFields.js +1 -2
  440. package/dist/utilities/applyBaseFilterToFields.js.map +1 -1
  441. package/dist/utilities/buildEditorState.d.ts +17 -3
  442. package/dist/utilities/buildEditorState.d.ts.map +1 -1
  443. package/dist/utilities/buildEditorState.js +8 -0
  444. package/dist/utilities/buildEditorState.js.map +1 -1
  445. package/dist/utilities/buildInitialState.d.ts +2 -1
  446. package/dist/utilities/buildInitialState.d.ts.map +1 -1
  447. package/dist/utilities/buildInitialState.js.map +1 -1
  448. package/dist/utilities/editorConfigFactory.d.ts.map +1 -1
  449. package/dist/utilities/fieldsDrawer/Drawer.d.ts.map +1 -1
  450. package/dist/utilities/fieldsDrawer/Drawer.js +19 -10
  451. package/dist/utilities/fieldsDrawer/Drawer.js.map +1 -1
  452. package/dist/utilities/fieldsDrawer/DrawerContent.d.ts +4 -1
  453. package/dist/utilities/fieldsDrawer/DrawerContent.d.ts.map +1 -1
  454. package/dist/utilities/fieldsDrawer/DrawerContent.js +8 -7
  455. package/dist/utilities/fieldsDrawer/DrawerContent.js.map +1 -1
  456. package/dist/utilities/fieldsDrawer/index.css +12 -0
  457. package/dist/utilities/fieldsDrawer/useDrawerSubmit.d.ts +29 -0
  458. package/dist/utilities/fieldsDrawer/useDrawerSubmit.d.ts.map +1 -0
  459. package/dist/utilities/fieldsDrawer/useDrawerSubmit.js +97 -0
  460. package/dist/utilities/fieldsDrawer/useDrawerSubmit.js.map +1 -0
  461. package/dist/utilities/fieldsDrawer/useLexicalDocumentDrawer.d.ts.map +1 -1
  462. package/dist/utilities/fieldsDrawer/useLexicalDrawer.d.ts.map +1 -1
  463. package/dist/utilities/fieldsDrawer/useLexicalListDrawer.d.ts.map +1 -1
  464. package/dist/utilities/generateImportMap.d.ts +1 -1
  465. package/dist/utilities/generateImportMap.d.ts.map +1 -1
  466. package/dist/utilities/generateSchemaMap.d.ts +1 -1
  467. package/dist/utilities/generateSchemaMap.d.ts.map +1 -1
  468. package/dist/utilities/getDefaultSanitizedEditorConfig.d.ts.map +1 -1
  469. package/dist/utilities/recurseNodeTree.d.ts.map +1 -1
  470. package/dist/utilities/upgradeLexicalData/upgradeDocumentFieldsRecursively.d.ts.map +1 -1
  471. package/dist/utilities/upgradeLexicalData/upgradeDocumentFieldsRecursively.js +1 -1
  472. package/dist/utilities/upgradeLexicalData/upgradeDocumentFieldsRecursively.js.map +1 -1
  473. package/dist/utilities/useLexicalFeature.d.ts.map +1 -1
  474. package/dist/validate/index.d.ts.map +1 -1
  475. package/package.json +22 -26
  476. package/dist/exports/client/Field-G5Z2HM5Y.js +0 -2
  477. package/dist/exports/client/Field-G5Z2HM5Y.js.map +0 -7
  478. package/dist/exports/client/RelationshipComponent-RZL743CS.js.map +0 -7
  479. package/dist/exports/client/chunk-6QWQ7JV4.js +0 -2
  480. package/dist/exports/client/chunk-6QWQ7JV4.js.map +0 -7
  481. package/dist/exports/client/chunk-FEJXFRL7.js +0 -2
  482. package/dist/exports/client/chunk-FEJXFRL7.js.map +0 -7
  483. package/dist/exports/client/chunk-INBEEENE.js +0 -2
  484. package/dist/exports/client/chunk-INBEEENE.js.map +0 -7
  485. package/dist/exports/client/chunk-LH634DPU.js +0 -12
  486. package/dist/exports/client/chunk-LH634DPU.js.map +0 -7
  487. package/dist/exports/client/component-CVM4OESA.js.map +0 -7
  488. package/dist/exports/client/componentInline-JJZ2NKW2.js +0 -2
  489. package/dist/features/blockquote/markdownTransformer.d.ts +0 -3
  490. package/dist/features/blockquote/markdownTransformer.d.ts.map +0 -1
  491. package/dist/features/blockquote/markdownTransformer.js +0 -33
  492. package/dist/features/blockquote/markdownTransformer.js.map +0 -1
  493. package/dist/features/format/bold/markdownTransformers.d.ts +0 -6
  494. package/dist/features/format/bold/markdownTransformers.d.ts.map +0 -1
  495. package/dist/features/format/bold/markdownTransformers.js +0 -23
  496. package/dist/features/format/bold/markdownTransformers.js.map +0 -1
  497. package/dist/features/format/inlineCode/markdownTransformers.d.ts +0 -3
  498. package/dist/features/format/inlineCode/markdownTransformers.d.ts.map +0 -1
  499. package/dist/features/format/inlineCode/markdownTransformers.js +0 -6
  500. package/dist/features/format/inlineCode/markdownTransformers.js.map +0 -1
  501. package/dist/features/format/italic/markdownTransformers.d.ts +0 -4
  502. package/dist/features/format/italic/markdownTransformers.d.ts.map +0 -1
  503. package/dist/features/format/italic/markdownTransformers.js +0 -12
  504. package/dist/features/format/italic/markdownTransformers.js.map +0 -1
  505. package/dist/features/format/strikethrough/markdownTransformers.d.ts +0 -3
  506. package/dist/features/format/strikethrough/markdownTransformers.d.ts.map +0 -1
  507. package/dist/features/format/strikethrough/markdownTransformers.js +0 -6
  508. package/dist/features/format/strikethrough/markdownTransformers.js.map +0 -1
  509. package/dist/features/link/nodes/types.d.ts +0 -27
  510. package/dist/features/link/nodes/types.d.ts.map +0 -1
  511. package/dist/features/link/nodes/types.js +0 -2
  512. package/dist/features/link/nodes/types.js.map +0 -1
  513. package/dist/features/lists/checklist/markdownTransformers.d.ts +0 -3
  514. package/dist/features/lists/checklist/markdownTransformers.d.ts.map +0 -1
  515. package/dist/features/lists/checklist/markdownTransformers.js +0 -12
  516. package/dist/features/lists/checklist/markdownTransformers.js.map +0 -1
  517. package/dist/features/lists/orderedList/markdownTransformer.d.ts +0 -3
  518. package/dist/features/lists/orderedList/markdownTransformer.d.ts.map +0 -1
  519. package/dist/features/lists/orderedList/markdownTransformer.js +0 -12
  520. package/dist/features/lists/orderedList/markdownTransformer.js.map +0 -1
  521. package/dist/features/lists/shared/markdown.d.ts +0 -6
  522. package/dist/features/lists/shared/markdown.d.ts.map +0 -1
  523. package/dist/features/lists/shared/markdown.js +0 -57
  524. package/dist/features/lists/shared/markdown.js.map +0 -1
  525. package/dist/features/lists/unorderedList/markdownTransformer.d.ts +0 -3
  526. package/dist/features/lists/unorderedList/markdownTransformer.d.ts.map +0 -1
  527. package/dist/features/lists/unorderedList/markdownTransformer.js +0 -12
  528. package/dist/features/lists/unorderedList/markdownTransformer.js.map +0 -1
  529. package/dist/lexical/utils/guard.d.ts +0 -5
  530. package/dist/lexical/utils/guard.d.ts.map +0 -1
  531. package/dist/lexical/utils/guard.js +0 -9
  532. package/dist/lexical/utils/guard.js.map +0 -1
  533. package/dist/lexical-proxy/@lexical-react/LexicalContextMenuPlugin.d.ts +0 -2
  534. package/dist/lexical-proxy/@lexical-react/LexicalContextMenuPlugin.d.ts.map +0 -1
  535. package/dist/lexical-proxy/@lexical-react/LexicalContextMenuPlugin.js +0 -2
  536. package/dist/lexical-proxy/@lexical-react/LexicalContextMenuPlugin.js.map +0 -1
  537. package/dist/packages/@lexical/markdown/MarkdownExport.d.ts +0 -14
  538. package/dist/packages/@lexical/markdown/MarkdownExport.d.ts.map +0 -1
  539. package/dist/packages/@lexical/markdown/MarkdownExport.js +0 -213
  540. package/dist/packages/@lexical/markdown/MarkdownExport.js.map +0 -1
  541. package/dist/packages/@lexical/markdown/MarkdownImport.d.ts +0 -19
  542. package/dist/packages/@lexical/markdown/MarkdownImport.d.ts.map +0 -1
  543. package/dist/packages/@lexical/markdown/MarkdownImport.js +0 -198
  544. package/dist/packages/@lexical/markdown/MarkdownImport.js.map +0 -1
  545. package/dist/packages/@lexical/markdown/MarkdownShortcuts.d.ts +0 -11
  546. package/dist/packages/@lexical/markdown/MarkdownShortcuts.d.ts.map +0 -1
  547. package/dist/packages/@lexical/markdown/MarkdownShortcuts.js +0 -304
  548. package/dist/packages/@lexical/markdown/MarkdownShortcuts.js.map +0 -1
  549. package/dist/packages/@lexical/markdown/MarkdownTransformers.d.ts +0 -147
  550. package/dist/packages/@lexical/markdown/MarkdownTransformers.d.ts.map +0 -1
  551. package/dist/packages/@lexical/markdown/MarkdownTransformers.js +0 -268
  552. package/dist/packages/@lexical/markdown/MarkdownTransformers.js.map +0 -1
  553. package/dist/packages/@lexical/markdown/importTextFormatTransformer.d.ts +0 -22
  554. package/dist/packages/@lexical/markdown/importTextFormatTransformer.d.ts.map +0 -1
  555. package/dist/packages/@lexical/markdown/importTextFormatTransformer.js +0 -91
  556. package/dist/packages/@lexical/markdown/importTextFormatTransformer.js.map +0 -1
  557. package/dist/packages/@lexical/markdown/importTextMatchTransformer.d.ts +0 -21
  558. package/dist/packages/@lexical/markdown/importTextMatchTransformer.d.ts.map +0 -1
  559. package/dist/packages/@lexical/markdown/importTextMatchTransformer.js +0 -54
  560. package/dist/packages/@lexical/markdown/importTextMatchTransformer.js.map +0 -1
  561. package/dist/packages/@lexical/markdown/importTextTransformers.d.ts +0 -18
  562. package/dist/packages/@lexical/markdown/importTextTransformers.d.ts.map +0 -1
  563. package/dist/packages/@lexical/markdown/importTextTransformers.js +0 -54
  564. package/dist/packages/@lexical/markdown/importTextTransformers.js.map +0 -1
  565. package/dist/packages/@lexical/markdown/index.d.ts +0 -29
  566. package/dist/packages/@lexical/markdown/index.d.ts.map +0 -1
  567. package/dist/packages/@lexical/markdown/index.js +0 -39
  568. package/dist/packages/@lexical/markdown/index.js.map +0 -1
  569. package/dist/packages/@lexical/markdown/utils.d.ts +0 -34
  570. package/dist/packages/@lexical/markdown/utils.d.ts.map +0 -1
  571. package/dist/packages/@lexical/markdown/utils.js +0 -267
  572. package/dist/packages/@lexical/markdown/utils.js.map +0 -1
  573. /package/dist/exports/client/{componentInline-JJZ2NKW2.js.map → componentInline-H24N7GUG.js.map} +0 -0
@@ -0,0 +1,37 @@
1
+ const ALL_HEADING_TAGS = ['h1', 'h2', 'h3', 'h4', 'h5', 'h6'];
2
+ /** MUST stay byte-for-byte in sync with the runtime `SerializedHeadingNode` declared above. */
3
+ const SERIALIZED_HEADING_NODE_TS = `export interface SerializedHeadingNode<
4
+ TChildren,
5
+ TTag extends 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6' = 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6',
6
+ > extends SerializedLexicalElementBase<TChildren> {
7
+ type: 'heading';
8
+ tag: TTag;
9
+ }`;
10
+ export const createHeadingJSONSchema = enabledHeadingSizes => ({
11
+ elementNodeSchema,
12
+ nodeUnionName,
13
+ typeStringDefinitions
14
+ }) => {
15
+ typeStringDefinitions.add(SERIALIZED_HEADING_NODE_TS);
16
+ // Empty array means the user disabled every heading size. Treat the same
17
+ // as "no tag constraint" rather than emitting an invalid `<T, >` generic
18
+ // and an unsatisfiable `enum: []`.
19
+ const isAllTags = enabledHeadingSizes.length === 0 || enabledHeadingSizes.length === ALL_HEADING_TAGS.length && ALL_HEADING_TAGS.every(tag => enabledHeadingSizes.includes(tag));
20
+ const tagSchema = enabledHeadingSizes.length === 0 ? {
21
+ type: 'string'
22
+ } : {
23
+ type: 'string',
24
+ enum: enabledHeadingSizes
25
+ };
26
+ const tagUnion = enabledHeadingSizes.map(tag => `'${tag}'`).join(' | ');
27
+ const tsType = isAllTags ? `SerializedHeadingNode<${nodeUnionName}>` : `SerializedHeadingNode<${nodeUnionName}, ${tagUnion}>`;
28
+ return elementNodeSchema({
29
+ nodeType: 'heading',
30
+ properties: {
31
+ tag: tagSchema
32
+ },
33
+ required: ['tag'],
34
+ tsType
35
+ });
36
+ };
37
+ //# sourceMappingURL=schema.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schema.js","names":["ALL_HEADING_TAGS","SERIALIZED_HEADING_NODE_TS","createHeadingJSONSchema","enabledHeadingSizes","elementNodeSchema","nodeUnionName","typeStringDefinitions","add","isAllTags","length","every","tag","includes","tagSchema","type","enum","tagUnion","map","join","tsType","nodeType","properties","required"],"sources":["../../../../src/features/heading/server/schema.ts"],"sourcesContent":["import type { HeadingTagType } from '@lexical/rich-text'\nimport type { JSONSchema4 } from 'json-schema'\nimport type { SerializedLexicalNode } from 'lexical'\n\nimport type { SerializedLexicalElementBase } from '../../../types/nodeTypes.js'\nimport type { JSONSchemaFn } from '../../typesServer.js'\n\nexport interface SerializedHeadingNode<\n TChildren extends SerializedLexicalNode = SerializedLexicalNode,\n TTag extends HeadingTagType = HeadingTagType,\n> extends SerializedLexicalElementBase<TChildren> {\n tag: TTag\n type: 'heading'\n}\n\nconst ALL_HEADING_TAGS: HeadingTagType[] = ['h1', 'h2', 'h3', 'h4', 'h5', 'h6']\n\n/** MUST stay byte-for-byte in sync with the runtime `SerializedHeadingNode` declared above. */\nconst SERIALIZED_HEADING_NODE_TS = `export interface SerializedHeadingNode<\n TChildren,\n TTag extends 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6' = 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6',\n> extends SerializedLexicalElementBase<TChildren> {\n type: 'heading';\n tag: TTag;\n}`\n\nexport const createHeadingJSONSchema =\n (enabledHeadingSizes: HeadingTagType[]): JSONSchemaFn =>\n ({ elementNodeSchema, nodeUnionName, typeStringDefinitions }) => {\n typeStringDefinitions.add(SERIALIZED_HEADING_NODE_TS)\n // Empty array means the user disabled every heading size. Treat the same\n // as \"no tag constraint\" rather than emitting an invalid `<T, >` generic\n // and an unsatisfiable `enum: []`.\n const isAllTags =\n enabledHeadingSizes.length === 0 ||\n (enabledHeadingSizes.length === ALL_HEADING_TAGS.length &&\n ALL_HEADING_TAGS.every((tag) => enabledHeadingSizes.includes(tag)))\n const tagSchema: JSONSchema4 =\n enabledHeadingSizes.length === 0\n ? { type: 'string' }\n : { type: 'string', enum: enabledHeadingSizes }\n const tagUnion = enabledHeadingSizes.map((tag) => `'${tag}'`).join(' | ')\n const tsType = isAllTags\n ? `SerializedHeadingNode<${nodeUnionName}>`\n : `SerializedHeadingNode<${nodeUnionName}, ${tagUnion}>`\n\n return elementNodeSchema({\n nodeType: 'heading',\n properties: { tag: tagSchema },\n required: ['tag'],\n tsType,\n })\n }\n"],"mappings":"AAeA,MAAMA,gBAAA,GAAqC,CAAC,MAAM,MAAM,MAAM,MAAM,MAAM,KAAK;AAE/E;AACA,MAAMC,0BAAA,GAA6B;;;;;;EAMjC;AAEF,OAAO,MAAMC,uBAAA,GACVC,mBAAA,IACD,CAAC;EAAEC,iBAAiB;EAAEC,aAAa;EAAEC;AAAqB,CAAE;EAC1DA,qBAAA,CAAsBC,GAAG,CAACN,0BAAA;EAC1B;EACA;EACA;EACA,MAAMO,SAAA,GACJL,mBAAA,CAAoBM,MAAM,KAAK,KAC9BN,mBAAA,CAAoBM,MAAM,KAAKT,gBAAA,CAAiBS,MAAM,IACrDT,gBAAA,CAAiBU,KAAK,CAAEC,GAAA,IAAQR,mBAAA,CAAoBS,QAAQ,CAACD,GAAA;EACjE,MAAME,SAAA,GACJV,mBAAA,CAAoBM,MAAM,KAAK,IAC3B;IAAEK,IAAA,EAAM;EAAS,IACjB;IAAEA,IAAA,EAAM;IAAUC,IAAA,EAAMZ;EAAoB;EAClD,MAAMa,QAAA,GAAWb,mBAAA,CAAoBc,GAAG,CAAEN,GAAA,IAAQ,IAAIA,GAAA,GAAM,EAAEO,IAAI,CAAC;EACnE,MAAMC,MAAA,GAASX,SAAA,GACX,yBAAyBH,aAAA,GAAgB,GACzC,yBAAyBA,aAAA,KAAkBW,QAAA,GAAW;EAE1D,OAAOZ,iBAAA,CAAkB;IACvBgB,QAAA,EAAU;IACVC,UAAA,EAAY;MAAEV,GAAA,EAAKE;IAAU;IAC7BS,QAAA,EAAU,CAAC,MAAM;IACjBH;EACF;AACF","ignoreList":[]}
@@ -6,11 +6,11 @@ import { createClientFeature } from '../../../utilities/createClientFeature.js';
6
6
  import { slashMenuBasicGroupWithItems } from '../../shared/slashMenu/basicGroup.js';
7
7
  import { toolbarAddDropdownGroupWithItems } from '../../shared/toolbar/addDropdownGroup.js';
8
8
  import { INSERT_HORIZONTAL_RULE_COMMAND } from '../server/nodes/HorizontalRuleNode.js';
9
- import { MarkdownTransformer } from './markdownTransformer.js';
9
+ import { PAYLOAD_HORIZONTAL_RULE } from './markdownTransformer.js';
10
10
  import { $isHorizontalRuleNode, HorizontalRuleNode } from './nodes/HorizontalRuleNode.js';
11
11
  import { HorizontalRulePlugin } from './plugin/index.js';
12
12
  export const HorizontalRuleFeatureClient = createClientFeature({
13
- markdownTransformers: [MarkdownTransformer],
13
+ markdownTransformers: [PAYLOAD_HORIZONTAL_RULE],
14
14
  nodes: [HorizontalRuleNode],
15
15
  plugins: [{
16
16
  Component: HorizontalRulePlugin,
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["$isNodeSelection","HorizontalRuleIcon","createClientFeature","slashMenuBasicGroupWithItems","toolbarAddDropdownGroupWithItems","INSERT_HORIZONTAL_RULE_COMMAND","MarkdownTransformer","$isHorizontalRuleNode","HorizontalRuleNode","HorizontalRulePlugin","HorizontalRuleFeatureClient","markdownTransformers","nodes","plugins","Component","position","slashMenu","groups","Icon","key","keywords","label","i18n","t","onSelect","editor","dispatchCommand","undefined","toolbarFixed","ChildComponent","isActive","selection","getNodes","length","firstNode"],"sources":["../../../../src/features/horizontalRule/client/index.tsx"],"sourcesContent":["'use client'\n\nimport { $isNodeSelection } from 'lexical'\n\nimport { HorizontalRuleIcon } from '../../../lexical/ui/icons/HorizontalRule/index.js'\nimport { createClientFeature } from '../../../utilities/createClientFeature.js'\nimport { slashMenuBasicGroupWithItems } from '../../shared/slashMenu/basicGroup.js'\nimport { toolbarAddDropdownGroupWithItems } from '../../shared/toolbar/addDropdownGroup.js'\nimport { INSERT_HORIZONTAL_RULE_COMMAND } from '../server/nodes/HorizontalRuleNode.js'\nimport { MarkdownTransformer } from './markdownTransformer.js'\nimport { $isHorizontalRuleNode, HorizontalRuleNode } from './nodes/HorizontalRuleNode.js'\nimport { HorizontalRulePlugin } from './plugin/index.js'\n\nexport const HorizontalRuleFeatureClient = createClientFeature({\n markdownTransformers: [MarkdownTransformer],\n nodes: [HorizontalRuleNode],\n plugins: [\n {\n Component: HorizontalRulePlugin,\n position: 'normal',\n },\n ],\n slashMenu: {\n groups: [\n slashMenuBasicGroupWithItems([\n {\n Icon: HorizontalRuleIcon,\n key: 'horizontalRule',\n keywords: ['hr', 'horizontal rule', 'line', 'separator'],\n label: ({ i18n }) => {\n return i18n.t('lexical:horizontalRule:label')\n },\n\n onSelect: ({ editor }) => {\n editor.dispatchCommand(INSERT_HORIZONTAL_RULE_COMMAND, undefined)\n },\n },\n ]),\n ],\n },\n toolbarFixed: {\n groups: [\n toolbarAddDropdownGroupWithItems([\n {\n ChildComponent: HorizontalRuleIcon,\n isActive: ({ selection }) => {\n if (!$isNodeSelection(selection) || !selection.getNodes().length) {\n return false\n }\n\n const firstNode = selection.getNodes()[0]\n return $isHorizontalRuleNode(firstNode)\n },\n key: 'horizontalRule',\n label: ({ i18n }) => {\n return i18n.t('lexical:horizontalRule:label')\n },\n onSelect: ({ editor }) => {\n editor.dispatchCommand(INSERT_HORIZONTAL_RULE_COMMAND, undefined)\n },\n },\n ]),\n ],\n },\n})\n"],"mappings":"AAAA;;AAEA,SAASA,gBAAgB,QAAQ;AAEjC,SAASC,kBAAkB,QAAQ;AACnC,SAASC,mBAAmB,QAAQ;AACpC,SAASC,4BAA4B,QAAQ;AAC7C,SAASC,gCAAgC,QAAQ;AACjD,SAASC,8BAA8B,QAAQ;AAC/C,SAASC,mBAAmB,QAAQ;AACpC,SAASC,qBAAqB,EAAEC,kBAAkB,QAAQ;AAC1D,SAASC,oBAAoB,QAAQ;AAErC,OAAO,MAAMC,2BAAA,GAA8BR,mBAAA,CAAoB;EAC7DS,oBAAA,EAAsB,CAACL,mBAAA,CAAoB;EAC3CM,KAAA,EAAO,CAACJ,kBAAA,CAAmB;EAC3BK,OAAA,EAAS,CACP;IACEC,SAAA,EAAWL,oBAAA;IACXM,QAAA,EAAU;EACZ,EACD;EACDC,SAAA,EAAW;IACTC,MAAA,EAAQ,CACNd,4BAAA,CAA6B,CAC3B;MACEe,IAAA,EAAMjB,kBAAA;MACNkB,GAAA,EAAK;MACLC,QAAA,EAAU,CAAC,MAAM,mBAAmB,QAAQ,YAAY;MACxDC,KAAA,EAAOA,CAAC;QAAEC;MAAI,CAAE;QACd,OAAOA,IAAA,CAAKC,CAAC,CAAC;MAChB;MAEAC,QAAA,EAAUA,CAAC;QAAEC;MAAM,CAAE;QACnBA,MAAA,CAAOC,eAAe,CAACrB,8BAAA,EAAgCsB,SAAA;MACzD;IACF,EACD;EAEL;EACAC,YAAA,EAAc;IACZX,MAAA,EAAQ,CACNb,gCAAA,CAAiC,CAC/B;MACEyB,cAAA,EAAgB5B,kBAAA;MAChB6B,QAAA,EAAUA,CAAC;QAAEC;MAAS,CAAE;QACtB,IAAI,CAAC/B,gBAAA,CAAiB+B,SAAA,KAAc,CAACA,SAAA,CAAUC,QAAQ,GAAGC,MAAM,EAAE;UAChE,OAAO;QACT;QAEA,MAAMC,SAAA,GAAYH,SAAA,CAAUC,QAAQ,EAAE,CAAC,EAAE;QACzC,OAAOzB,qBAAA,CAAsB2B,SAAA;MAC/B;MACAf,GAAA,EAAK;MACLE,KAAA,EAAOA,CAAC;QAAEC;MAAI,CAAE;QACd,OAAOA,IAAA,CAAKC,CAAC,CAAC;MAChB;MACAC,QAAA,EAAUA,CAAC;QAAEC;MAAM,CAAE;QACnBA,MAAA,CAAOC,eAAe,CAACrB,8BAAA,EAAgCsB,SAAA;MACzD;IACF,EACD;EAEL;AACF","ignoreList":[]}
1
+ {"version":3,"file":"index.js","names":["$isNodeSelection","HorizontalRuleIcon","createClientFeature","slashMenuBasicGroupWithItems","toolbarAddDropdownGroupWithItems","INSERT_HORIZONTAL_RULE_COMMAND","PAYLOAD_HORIZONTAL_RULE","$isHorizontalRuleNode","HorizontalRuleNode","HorizontalRulePlugin","HorizontalRuleFeatureClient","markdownTransformers","nodes","plugins","Component","position","slashMenu","groups","Icon","key","keywords","label","i18n","t","onSelect","editor","dispatchCommand","undefined","toolbarFixed","ChildComponent","isActive","selection","getNodes","length","firstNode"],"sources":["../../../../src/features/horizontalRule/client/index.tsx"],"sourcesContent":["'use client'\n\nimport { $isNodeSelection } from 'lexical'\n\nimport { HorizontalRuleIcon } from '../../../lexical/ui/icons/HorizontalRule/index.js'\nimport { createClientFeature } from '../../../utilities/createClientFeature.js'\nimport { slashMenuBasicGroupWithItems } from '../../shared/slashMenu/basicGroup.js'\nimport { toolbarAddDropdownGroupWithItems } from '../../shared/toolbar/addDropdownGroup.js'\nimport { INSERT_HORIZONTAL_RULE_COMMAND } from '../server/nodes/HorizontalRuleNode.js'\nimport { PAYLOAD_HORIZONTAL_RULE } from './markdownTransformer.js'\nimport { $isHorizontalRuleNode, HorizontalRuleNode } from './nodes/HorizontalRuleNode.js'\nimport { HorizontalRulePlugin } from './plugin/index.js'\n\nexport const HorizontalRuleFeatureClient = createClientFeature({\n markdownTransformers: [PAYLOAD_HORIZONTAL_RULE],\n nodes: [HorizontalRuleNode],\n plugins: [\n {\n Component: HorizontalRulePlugin,\n position: 'normal',\n },\n ],\n slashMenu: {\n groups: [\n slashMenuBasicGroupWithItems([\n {\n Icon: HorizontalRuleIcon,\n key: 'horizontalRule',\n keywords: ['hr', 'horizontal rule', 'line', 'separator'],\n label: ({ i18n }) => {\n return i18n.t('lexical:horizontalRule:label')\n },\n\n onSelect: ({ editor }) => {\n editor.dispatchCommand(INSERT_HORIZONTAL_RULE_COMMAND, undefined)\n },\n },\n ]),\n ],\n },\n toolbarFixed: {\n groups: [\n toolbarAddDropdownGroupWithItems([\n {\n ChildComponent: HorizontalRuleIcon,\n isActive: ({ selection }) => {\n if (!$isNodeSelection(selection) || !selection.getNodes().length) {\n return false\n }\n\n const firstNode = selection.getNodes()[0]\n return $isHorizontalRuleNode(firstNode)\n },\n key: 'horizontalRule',\n label: ({ i18n }) => {\n return i18n.t('lexical:horizontalRule:label')\n },\n onSelect: ({ editor }) => {\n editor.dispatchCommand(INSERT_HORIZONTAL_RULE_COMMAND, undefined)\n },\n },\n ]),\n ],\n },\n})\n"],"mappings":"AAAA;;AAEA,SAASA,gBAAgB,QAAQ;AAEjC,SAASC,kBAAkB,QAAQ;AACnC,SAASC,mBAAmB,QAAQ;AACpC,SAASC,4BAA4B,QAAQ;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AAUA,CAAC;QAAEC;MAAM,CAAE;QACnBA,MAAA,CAAOC,eAAe,CAACrB,8BAAA,EAAgCsB,SAAA;MACzD;IACF,EACD;EAEL;AACF","ignoreList":[]}
@@ -1,3 +1,3 @@
1
- import type { ElementTransformer } from '../../../packages/@lexical/markdown/MarkdownTransformers.js';
2
- export declare const MarkdownTransformer: ElementTransformer;
1
+ import type { ElementTransformer } from '@lexical/markdown';
2
+ export declare const PAYLOAD_HORIZONTAL_RULE: ElementTransformer;
3
3
  //# sourceMappingURL=markdownTransformer.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"markdownTransformer.d.ts","sourceRoot":"","sources":["../../../../src/features/horizontalRule/client/markdownTransformer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,6DAA6D,CAAA;AAQrG,eAAO,MAAM,mBAAmB,EAAE,kBAiBjC,CAAA"}
1
+ {"version":3,"file":"markdownTransformer.d.ts","sourceRoot":"","sources":["../../../../src/features/horizontalRule/client/markdownTransformer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAA;AAQ3D,eAAO,MAAM,uBAAuB,EAAE,kBAiBrC,CAAA"}
@@ -1,5 +1,5 @@
1
1
  import { $createHorizontalRuleNode, $isHorizontalRuleNode, HorizontalRuleNode } from './nodes/HorizontalRuleNode.js';
2
- export const MarkdownTransformer = {
2
+ export const PAYLOAD_HORIZONTAL_RULE = {
3
3
  type: 'element',
4
4
  dependencies: [HorizontalRuleNode],
5
5
  export: (node, exportChildren) => {
@@ -1 +1 @@
1
- {"version":3,"file":"markdownTransformer.js","names":["$createHorizontalRuleNode","$isHorizontalRuleNode","HorizontalRuleNode","MarkdownTransformer","type","dependencies","export","node","exportChildren","regExp","replace","parentNode"],"sources":["../../../../src/features/horizontalRule/client/markdownTransformer.ts"],"sourcesContent":["import type { ElementTransformer } from '../../../packages/@lexical/markdown/MarkdownTransformers.js'\n\nimport {\n $createHorizontalRuleNode,\n $isHorizontalRuleNode,\n HorizontalRuleNode,\n} from './nodes/HorizontalRuleNode.js'\n\nexport const MarkdownTransformer: ElementTransformer = {\n type: 'element',\n dependencies: [HorizontalRuleNode],\n export: (node, exportChildren) => {\n if (!$isHorizontalRuleNode(node)) {\n return null\n }\n return '---'\n },\n // match ---\n regExp: /^---\\s*$/,\n replace: (parentNode) => {\n const node = $createHorizontalRuleNode()\n if (node) {\n parentNode.replace(node)\n }\n },\n}\n"],"mappings":"AAEA,SACEA,yBAAyB,EACzBC,qBAAqB,EACrBC,kBAAkB,QACb;AAEP,OAAO,MAAMC,mBAAA,GAA0C;EACrDC,IAAA,EAAM;EACNC,YAAA,EAAc,CAACH,kBAAA,CAAmB;EAClCI,MAAA,EAAQA,CAACC,IAAA,EAAMC,cAAA;IACb,IAAI,CAACP,qBAAA,CAAsBM,IAAA,GAAO;MAChC,OAAO;IACT;IACA,OAAO;EACT;EACA;EACAE,MAAA,EAAQ;EACRC,OAAA,EAAUC,UAAA;IACR,MAAMJ,IAAA,GAAOP,yBAAA;IACb,IAAIO,IAAA,EAAM;MACRI,UAAA,CAAWD,OAAO,CAACH,IAAA;IACrB;EACF;AACF","ignoreList":[]}
1
+ {"version":3,"file":"markdownTransformer.js","names":["$createHorizontalRuleNode","$isHorizontalRuleNode","HorizontalRuleNode","PAYLOAD_HORIZONTAL_RULE","type","dependencies","export","node","exportChildren","regExp","replace","parentNode"],"sources":["../../../../src/features/horizontalRule/client/markdownTransformer.ts"],"sourcesContent":["import type { ElementTransformer } from '@lexical/markdown'\n\nimport {\n $createHorizontalRuleNode,\n $isHorizontalRuleNode,\n HorizontalRuleNode,\n} from './nodes/HorizontalRuleNode.js'\n\nexport const PAYLOAD_HORIZONTAL_RULE: ElementTransformer = {\n type: 'element',\n dependencies: [HorizontalRuleNode],\n export: (node, exportChildren) => {\n if (!$isHorizontalRuleNode(node)) {\n return null\n }\n return '---'\n },\n // match ---\n regExp: /^---\\s*$/,\n replace: (parentNode) => {\n const node = $createHorizontalRuleNode()\n if (node) {\n parentNode.replace(node)\n }\n },\n}\n"],"mappings":"AAEA,SACEA,yBAAyB,EACzBC,qBAAqB,EACrBC,kBAAkB,QACb;AAEP,OAAO,MAAMC,uBAAA,GAA8C;EACzDC,IAAA,EAAM;EACNC,YAAA,EAAc,CAACH,kBAAA,CAAmB;EAClCI,MAAA,EAAQA,CAACC,IAAA,EAAMC,cAAA;IACb,IAAI,CAACP,qBAAA,CAAsBM,IAAA,GAAO;MAChC,OAAO;IACT;IACA,OAAO;EACT;EACA;EACAE,MAAA,EAAQ;EACRC,OAAA,EAAUC,UAAA;IACR,MAAMJ,IAAA,GAAOP,yBAAA;IACb,IAAIO,IAAA,EAAM;MACRI,UAAA,CAAWD,OAAO,CAACH,IAAA;IACrB;EACF;AACF","ignoreList":[]}
@@ -1,5 +1,5 @@
1
1
  import type { LexicalNode, SerializedLexicalNode } from 'lexical';
2
- import type { SerializedHorizontalRuleNode } from '../../server/nodes/HorizontalRuleNode.js';
2
+ import type { SerializedHorizontalRuleNode } from '../../server/schema.js';
3
3
  import { HorizontalRuleServerNode } from '../../server/nodes/HorizontalRuleNode.js';
4
4
  export declare class HorizontalRuleNode extends HorizontalRuleServerNode {
5
5
  static clone(node: HorizontalRuleServerNode): HorizontalRuleServerNode;
@@ -1 +1 @@
1
- {"version":3,"file":"HorizontalRuleNode.d.ts","sourceRoot":"","sources":["../../../../../src/features/horizontalRule/client/nodes/HorizontalRuleNode.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAuB,WAAW,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAA;AAKtF,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,0CAA0C,CAAA;AAE5F,OAAO,EAAE,wBAAwB,EAAE,MAAM,0CAA0C,CAAA;AAEnF,qBAAa,kBAAmB,SAAQ,wBAAwB;WAC9C,KAAK,CAAC,IAAI,EAAE,wBAAwB,GAAG,wBAAwB;WAI/D,OAAO,IAAI,MAAM;IAIjC;;OAEG;WACa,UAAU,CAAC,cAAc,EAAE,4BAA4B,GAAG,kBAAkB;IAI5F;;OAEG;IACM,QAAQ;IAIR,UAAU,IAAI,qBAAqB;CAG7C;AAMD,wBAAgB,yBAAyB,IAAI,kBAAkB,CAE9D;AAED,wBAAgB,qBAAqB,CACnC,IAAI,EAAE,WAAW,GAAG,IAAI,GAAG,SAAS,GACnC,IAAI,IAAI,kBAAkB,CAE5B"}
1
+ {"version":3,"file":"HorizontalRuleNode.d.ts","sourceRoot":"","sources":["../../../../../src/features/horizontalRule/client/nodes/HorizontalRuleNode.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAuB,WAAW,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAA;AAKtF,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,wBAAwB,CAAA;AAE1E,OAAO,EAAE,wBAAwB,EAAE,MAAM,0CAA0C,CAAA;AAEnF,qBAAa,kBAAmB,SAAQ,wBAAwB;IAC9D,OAAgB,KAAK,CAAC,IAAI,EAAE,wBAAwB,GAAG,wBAAwB,CAE9E;IAED,OAAgB,OAAO,IAAI,MAAM,CAEhC;IAED;;OAEG;IACH,OAAgB,UAAU,CAAC,cAAc,EAAE,4BAA4B,GAAG,kBAAkB,CAE3F;IAED;;OAEG;IACM,QAAQ,SAEhB;IAEQ,UAAU,IAAI,qBAAqB,CAE3C;CACF;AAMD,wBAAgB,yBAAyB,IAAI,kBAAkB,CAE9D;AAED,wBAAgB,qBAAqB,CACnC,IAAI,EAAE,WAAW,GAAG,IAAI,GAAG,SAAS,GACnC,IAAI,IAAI,kBAAkB,CAE5B"}
@@ -1 +1 @@
1
- {"version":3,"file":"HorizontalRuleNode.js","names":["$applyNodeReplacement","React","HorizontalRuleServerNode","HorizontalRuleNode","clone","node","getType","importJSON","serializedNode","$createHorizontalRuleNode","decorate","exportJSON","$convertHorizontalRuleElement","$isHorizontalRuleNode"],"sources":["../../../../../src/features/horizontalRule/client/nodes/HorizontalRuleNode.tsx"],"sourcesContent":["'use client'\nimport type { DOMConversionOutput, LexicalNode, SerializedLexicalNode } from 'lexical'\n\nimport { $applyNodeReplacement } from 'lexical'\nimport * as React from 'react'\n\nimport type { SerializedHorizontalRuleNode } from '../../server/nodes/HorizontalRuleNode.js'\n\nimport { HorizontalRuleServerNode } from '../../server/nodes/HorizontalRuleNode.js'\n\nexport class HorizontalRuleNode extends HorizontalRuleServerNode {\n static override clone(node: HorizontalRuleServerNode): HorizontalRuleServerNode {\n return super.clone(node)\n }\n\n static override getType(): string {\n return super.getType()\n }\n\n /**\n * The data for this node is stored serialized as JSON. This is the \"load function\" of that node: it takes the saved data and converts it into a node.\n */\n static override importJSON(serializedNode: SerializedHorizontalRuleNode): HorizontalRuleNode {\n return $createHorizontalRuleNode()\n }\n\n /**\n * Allows you to render a React component within whatever createDOM returns.\n */\n override decorate() {\n return null\n }\n\n override exportJSON(): SerializedLexicalNode {\n return super.exportJSON()\n }\n}\n\nfunction $convertHorizontalRuleElement(): DOMConversionOutput {\n return { node: $createHorizontalRuleNode() }\n}\n\nexport function $createHorizontalRuleNode(): HorizontalRuleNode {\n return $applyNodeReplacement(new HorizontalRuleNode())\n}\n\nexport function $isHorizontalRuleNode(\n node: LexicalNode | null | undefined,\n): node is HorizontalRuleNode {\n return node instanceof HorizontalRuleNode\n}\n"],"mappings":"AAAA;;AAGA,SAASA,qBAAqB,QAAQ;AACtC,YAAYC,KAAA,MAAW;AAIvB,SAASC,wBAAwB,QAAQ;AAEzC,OAAO,MAAMC,kBAAA,SAA2BD,wBAAA;EACtC,OAAgBE,MAAMC,IAA8B,EAA4B;IAC9E,OAAO,KAAK,CAACD,KAAA,CAAMC,IAAA;EACrB;EAEA,OAAgBC,QAAA,EAAkB;IAChC,OAAO,KAAK,CAACA,OAAA;EACf;EAEA;;;EAGA,OAAgBC,WAAWC,cAA4C,EAAsB;IAC3F,OAAOC,yBAAA;EACT;EAEA;;;EAGAC,QAASA,CAAA,EAAW;IAClB,OAAO;EACT;EAESC,WAAA,EAAoC;IAC3C,OAAO,KAAK,CAACA,UAAA;EACf;AACF;AAEA,SAASC,8BAAA;EACP,OAAO;IAAEP,IAAA,EAAMI,yBAAA;EAA4B;AAC7C;AAEA,OAAO,SAASA,0BAAA;EACd,OAAOT,qBAAA,CAAsB,IAAIG,kBAAA;AACnC;AAEA,OAAO,SAASU,sBACdR,IAAoC;EAEpC,OAAOA,IAAA,YAAgBF,kBAAA;AACzB","ignoreList":[]}
1
+ {"version":3,"file":"HorizontalRuleNode.js","names":["$applyNodeReplacement","React","HorizontalRuleServerNode","HorizontalRuleNode","clone","node","getType","importJSON","serializedNode","$createHorizontalRuleNode","decorate","exportJSON","$convertHorizontalRuleElement","$isHorizontalRuleNode"],"sources":["../../../../../src/features/horizontalRule/client/nodes/HorizontalRuleNode.tsx"],"sourcesContent":["'use client'\nimport type { DOMConversionOutput, LexicalNode, SerializedLexicalNode } from 'lexical'\n\nimport { $applyNodeReplacement } from 'lexical'\nimport * as React from 'react'\n\nimport type { SerializedHorizontalRuleNode } from '../../server/schema.js'\n\nimport { HorizontalRuleServerNode } from '../../server/nodes/HorizontalRuleNode.js'\n\nexport class HorizontalRuleNode extends HorizontalRuleServerNode {\n static override clone(node: HorizontalRuleServerNode): HorizontalRuleServerNode {\n return super.clone(node)\n }\n\n static override getType(): string {\n return super.getType()\n }\n\n /**\n * The data for this node is stored serialized as JSON. This is the \"load function\" of that node: it takes the saved data and converts it into a node.\n */\n static override importJSON(serializedNode: SerializedHorizontalRuleNode): HorizontalRuleNode {\n return $createHorizontalRuleNode()\n }\n\n /**\n * Allows you to render a React component within whatever createDOM returns.\n */\n override decorate() {\n return null\n }\n\n override exportJSON(): SerializedLexicalNode {\n return super.exportJSON()\n }\n}\n\nfunction $convertHorizontalRuleElement(): DOMConversionOutput {\n return { node: $createHorizontalRuleNode() }\n}\n\nexport function $createHorizontalRuleNode(): HorizontalRuleNode {\n return $applyNodeReplacement(new HorizontalRuleNode())\n}\n\nexport function $isHorizontalRuleNode(\n node: LexicalNode | null | undefined,\n): node is HorizontalRuleNode {\n return node instanceof HorizontalRuleNode\n}\n"],"mappings":"AAAA;;AAGA,SAASA,qBAAqB,QAAQ;AACtC,YAAYC,KAAA,MAAW;AAIvB,SAASC,wBAAwB,QAAQ;AAEzC,OAAO,MAAMC,kBAAA,SAA2BD,wBAAA;EACtC,OAAgBE,MAAMC,IAA8B,EAA4B;IAC9E,OAAO,KAAK,CAACD,KAAA,CAAMC,IAAA;EACrB;EAEA,OAAgBC,QAAA,EAAkB;IAChC,OAAO,KAAK,CAACA,OAAA;EACf;EAEA;;;EAGA,OAAgBC,WAAWC,cAA4C,EAAsB;IAC3F,OAAOC,yBAAA;EACT;EAEA;;;EAGAC,QAASA,CAAA,EAAW;IAClB,OAAO;EACT;EAESC,WAAA,EAAoC;IAC3C,OAAO,KAAK,CAACA,UAAA;EACf;AACF;AAEA,SAASC,8BAAA;EACP,OAAO;IAAEP,IAAA,EAAMI,yBAAA;EAA4B;AAC7C;AAEA,OAAO,SAASA,0BAAA;EACd,OAAOT,qBAAA,CAAsB,IAAIG,kBAAA;AACnC;AAEA,OAAO,SAASU,sBACdR,IAAoC;EAEpC,OAAOA,IAAA,YAAgBF,kBAAA;AACzB","ignoreList":[]}
@@ -19,7 +19,7 @@
19
19
  user-select: none;
20
20
  border-radius: var(--radius-small);
21
21
  box-shadow:
22
- 0px 0px 0px 1px var(--color-bg),
23
- 0px 0px 0px 2px var(--color-border-selected);
22
+ 0 0 0 var(--stroke-width-small) var(--color-bg),
23
+ 0 0 0 var(--stroke-width-medium) var(--color-border-selected);
24
24
  }
25
25
  }
@@ -1,2 +1,3 @@
1
+ export type { SerializedHorizontalRuleNode } from './schema.js';
1
2
  export declare const HorizontalRuleFeature: import("../../typesServer.js").FeatureProviderProviderServer<undefined, undefined, undefined>;
2
3
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/features/horizontalRule/server/index.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,qBAAqB,+FAYhC,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/features/horizontalRule/server/index.ts"],"names":[],"mappings":"AAOA,YAAY,EAAE,4BAA4B,EAAE,MAAM,aAAa,CAAA;AAE/D,eAAO,MAAM,qBAAqB,+FAahC,CAAA"}
@@ -1,14 +1,16 @@
1
1
  import { createServerFeature } from '../../../utilities/createServerFeature.js';
2
2
  import { createNode } from '../../typeUtilities.js';
3
3
  import { i18n } from './i18n.js';
4
- import { MarkdownTransformer } from './markdownTransformer.js';
4
+ import { PAYLOAD_HORIZONTAL_RULE } from './markdownTransformer.js';
5
5
  import { HorizontalRuleServerNode } from './nodes/HorizontalRuleNode.js';
6
+ import { horizontalRuleNodeJSONSchema } from './schema.js';
6
7
  export const HorizontalRuleFeature = createServerFeature({
7
8
  feature: {
8
9
  ClientFeature: '@payloadcms/richtext-lexical/client#HorizontalRuleFeatureClient',
9
10
  i18n,
10
- markdownTransformers: [MarkdownTransformer],
11
+ markdownTransformers: [PAYLOAD_HORIZONTAL_RULE],
11
12
  nodes: [createNode({
13
+ jsonSchema: horizontalRuleNodeJSONSchema,
12
14
  node: HorizontalRuleServerNode
13
15
  })]
14
16
  },
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["createServerFeature","createNode","i18n","MarkdownTransformer","HorizontalRuleServerNode","HorizontalRuleFeature","feature","ClientFeature","markdownTransformers","nodes","node","key"],"sources":["../../../../src/features/horizontalRule/server/index.ts"],"sourcesContent":["import { createServerFeature } from '../../../utilities/createServerFeature.js'\nimport { createNode } from '../../typeUtilities.js'\nimport { i18n } from './i18n.js'\nimport { MarkdownTransformer } from './markdownTransformer.js'\nimport { HorizontalRuleServerNode } from './nodes/HorizontalRuleNode.js'\n\nexport const HorizontalRuleFeature = createServerFeature({\n feature: {\n ClientFeature: '@payloadcms/richtext-lexical/client#HorizontalRuleFeatureClient',\n i18n,\n markdownTransformers: [MarkdownTransformer],\n nodes: [\n createNode({\n node: HorizontalRuleServerNode,\n }),\n ],\n },\n key: 'horizontalRule',\n})\n"],"mappings":"AAAA,SAASA,mBAAmB,QAAQ;AACpC,SAASC,UAAU,QAAQ;AAC3B,SAASC,IAAI,QAAQ;AACrB,SAASC,mBAAmB,QAAQ;AACpC,SAASC,wBAAwB,QAAQ;AAEzC,OAAO,MAAMC,qBAAA,GAAwBL,mBAAA,CAAoB;EACvDM,OAAA,EAAS;IACPC,aAAA,EAAe;IACfL,IAAA;IACAM,oBAAA,EAAsB,CAACL,mBAAA,CAAoB;IAC3CM,KAAA,EAAO,CACLR,UAAA,CAAW;MACTS,IAAA,EAAMN;IACR;EAEJ;EACAO,GAAA,EAAK;AACP","ignoreList":[]}
1
+ {"version":3,"file":"index.js","names":["createServerFeature","createNode","i18n","PAYLOAD_HORIZONTAL_RULE","HorizontalRuleServerNode","horizontalRuleNodeJSONSchema","HorizontalRuleFeature","feature","ClientFeature","markdownTransformers","nodes","jsonSchema","node","key"],"sources":["../../../../src/features/horizontalRule/server/index.ts"],"sourcesContent":["import { createServerFeature } from '../../../utilities/createServerFeature.js'\nimport { createNode } from '../../typeUtilities.js'\nimport { i18n } from './i18n.js'\nimport { PAYLOAD_HORIZONTAL_RULE } from './markdownTransformer.js'\nimport { HorizontalRuleServerNode } from './nodes/HorizontalRuleNode.js'\nimport { horizontalRuleNodeJSONSchema } from './schema.js'\n\nexport type { SerializedHorizontalRuleNode } from './schema.js'\n\nexport const HorizontalRuleFeature = createServerFeature({\n feature: {\n ClientFeature: '@payloadcms/richtext-lexical/client#HorizontalRuleFeatureClient',\n i18n,\n markdownTransformers: [PAYLOAD_HORIZONTAL_RULE],\n nodes: [\n createNode({\n jsonSchema: horizontalRuleNodeJSONSchema,\n node: HorizontalRuleServerNode,\n }),\n ],\n },\n key: 'horizontalRule',\n})\n"],"mappings":"AAAA,SAASA,mBAAmB,QAAQ;AACpC,SAASC,UAAU,QAAQ;AAC3B,SAASC,IAAI,QAAQ;AACrB,SAASC,uBAAuB,QAAQ;AACxC,SAASC,wBAAwB,QAAQ;AACzC,SAASC,4BAA4B,QAAQ;AAI7C,OAAO,MAAMC,qBAAA,GAAwBN,mBAAA,CAAoB;EACvDO,OAAA,EAAS;IACPC,aAAA,EAAe;IACfN,IAAA;IACAO,oBAAA,EAAsB,CAACN,uBAAA,CAAwB;IAC/CO,KAAA,EAAO,CACLT,UAAA,CAAW;MACTU,UAAA,EAAYN,4BAAA;MACZO,IAAA,EAAMR;IACR;EAEJ;EACAS,GAAA,EAAK;AACP","ignoreList":[]}
@@ -1,3 +1,3 @@
1
- import type { ElementTransformer } from '../../../packages/@lexical/markdown/MarkdownTransformers.js';
2
- export declare const MarkdownTransformer: ElementTransformer;
1
+ import type { ElementTransformer } from '@lexical/markdown';
2
+ export declare const PAYLOAD_HORIZONTAL_RULE: ElementTransformer;
3
3
  //# sourceMappingURL=markdownTransformer.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"markdownTransformer.d.ts","sourceRoot":"","sources":["../../../../src/features/horizontalRule/server/markdownTransformer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,6DAA6D,CAAA;AAQrG,eAAO,MAAM,mBAAmB,EAAE,kBAiBjC,CAAA"}
1
+ {"version":3,"file":"markdownTransformer.d.ts","sourceRoot":"","sources":["../../../../src/features/horizontalRule/server/markdownTransformer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAA;AAQ3D,eAAO,MAAM,uBAAuB,EAAE,kBAiBrC,CAAA"}
@@ -1,5 +1,5 @@
1
1
  import { $createHorizontalRuleServerNode, $isHorizontalRuleServerNode, HorizontalRuleServerNode } from './nodes/HorizontalRuleNode.js';
2
- export const MarkdownTransformer = {
2
+ export const PAYLOAD_HORIZONTAL_RULE = {
3
3
  type: 'element',
4
4
  dependencies: [HorizontalRuleServerNode],
5
5
  export: (node, exportChildren) => {
@@ -1 +1 @@
1
- {"version":3,"file":"markdownTransformer.js","names":["$createHorizontalRuleServerNode","$isHorizontalRuleServerNode","HorizontalRuleServerNode","MarkdownTransformer","type","dependencies","export","node","exportChildren","regExp","replace","parentNode"],"sources":["../../../../src/features/horizontalRule/server/markdownTransformer.ts"],"sourcesContent":["import type { ElementTransformer } from '../../../packages/@lexical/markdown/MarkdownTransformers.js'\n\nimport {\n $createHorizontalRuleServerNode,\n $isHorizontalRuleServerNode,\n HorizontalRuleServerNode,\n} from './nodes/HorizontalRuleNode.js'\n\nexport const MarkdownTransformer: ElementTransformer = {\n type: 'element',\n dependencies: [HorizontalRuleServerNode],\n export: (node, exportChildren) => {\n if (!$isHorizontalRuleServerNode(node)) {\n return null\n }\n return '---'\n },\n // match ---\n regExp: /^---\\s*$/,\n replace: (parentNode) => {\n const node = $createHorizontalRuleServerNode()\n if (node) {\n parentNode.replace(node)\n }\n },\n}\n"],"mappings":"AAEA,SACEA,+BAA+B,EAC/BC,2BAA2B,EAC3BC,wBAAwB,QACnB;AAEP,OAAO,MAAMC,mBAAA,GAA0C;EACrDC,IAAA,EAAM;EACNC,YAAA,EAAc,CAACH,wBAAA,CAAyB;EACxCI,MAAA,EAAQA,CAACC,IAAA,EAAMC,cAAA;IACb,IAAI,CAACP,2BAAA,CAA4BM,IAAA,GAAO;MACtC,OAAO;IACT;IACA,OAAO;EACT;EACA;EACAE,MAAA,EAAQ;EACRC,OAAA,EAAUC,UAAA;IACR,MAAMJ,IAAA,GAAOP,+BAAA;IACb,IAAIO,IAAA,EAAM;MACRI,UAAA,CAAWD,OAAO,CAACH,IAAA;IACrB;EACF;AACF","ignoreList":[]}
1
+ {"version":3,"file":"markdownTransformer.js","names":["$createHorizontalRuleServerNode","$isHorizontalRuleServerNode","HorizontalRuleServerNode","PAYLOAD_HORIZONTAL_RULE","type","dependencies","export","node","exportChildren","regExp","replace","parentNode"],"sources":["../../../../src/features/horizontalRule/server/markdownTransformer.ts"],"sourcesContent":["import type { ElementTransformer } from '@lexical/markdown'\n\nimport {\n $createHorizontalRuleServerNode,\n $isHorizontalRuleServerNode,\n HorizontalRuleServerNode,\n} from './nodes/HorizontalRuleNode.js'\n\nexport const PAYLOAD_HORIZONTAL_RULE: ElementTransformer = {\n type: 'element',\n dependencies: [HorizontalRuleServerNode],\n export: (node, exportChildren) => {\n if (!$isHorizontalRuleServerNode(node)) {\n return null\n }\n return '---'\n },\n // match ---\n regExp: /^---\\s*$/,\n replace: (parentNode) => {\n const node = $createHorizontalRuleServerNode()\n if (node) {\n parentNode.replace(node)\n }\n },\n}\n"],"mappings":"AAEA,SACEA,+BAA+B,EAC/BC,2BAA2B,EAC3BC,wBAAwB,QACnB;AAEP,OAAO,MAAMC,uBAAA,GAA8C;EACzDC,IAAA,EAAM;EACNC,YAAA,EAAc,CAACH,wBAAA,CAAyB;EACxCI,MAAA,EAAQA,CAACC,IAAA,EAAMC,cAAA;IACb,IAAI,CAACP,2BAAA,CAA4BM,IAAA,GAAO;MACtC,OAAO;IACT;IACA,OAAO;EACT;EACA;EACAE,MAAA,EAAQ;EACRC,OAAA,EAAUC,UAAA;IACR,MAAMJ,IAAA,GAAOP,+BAAA;IACb,IAAIO,IAAA,EAAM;MACRI,UAAA,CAAWD,OAAO,CAACH,IAAA;IACrB;EACF;AACF","ignoreList":[]}
@@ -1,11 +1,7 @@
1
1
  import type { DOMConversionMap, DOMExportOutput, EditorConfig, LexicalCommand, LexicalNode, SerializedLexicalNode } from 'lexical';
2
2
  import type * as React from 'react';
3
3
  import { DecoratorNode } from 'lexical';
4
- import type { StronglyTypedLeafNode } from '../../../../types/nodeTypes.js';
5
- /**
6
- * Serialized representation of a horizontal rule node. Serialized = converted to JSON. This is what is stored in the database / in the lexical editor state.
7
- */
8
- export type SerializedHorizontalRuleNode = StronglyTypedLeafNode<SerializedLexicalNode, 'horizontalrule'>;
4
+ import type { SerializedHorizontalRuleNode } from '../schema.js';
9
5
  export declare const INSERT_HORIZONTAL_RULE_COMMAND: LexicalCommand<void>;
10
6
  /**
11
7
  * This node is a DecoratorNode. DecoratorNodes allow you to render React components in the editor.
@@ -1 +1 @@
1
- {"version":3,"file":"HorizontalRuleNode.d.ts","sourceRoot":"","sources":["../../../../../src/features/horizontalRule/server/nodes/HorizontalRuleNode.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,gBAAgB,EAEhB,eAAe,EACf,YAAY,EACZ,cAAc,EACd,WAAW,EACX,qBAAqB,EACtB,MAAM,SAAS,CAAA;AAChB,OAAO,KAAK,KAAK,KAAK,MAAM,OAAO,CAAA;AAGnC,OAAO,EAAwC,aAAa,EAAE,MAAM,SAAS,CAAA;AAE7E,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,gCAAgC,CAAA;AAE3E;;GAEG;AACH,MAAM,MAAM,4BAA4B,GAAG,qBAAqB,CAC9D,qBAAqB,EACrB,gBAAgB,CACjB,CAAA;AAED,eAAO,MAAM,8BAA8B,EAAE,cAAc,CAAC,IAAI,CAE/D,CAAA;AAED;;;;;;GAMG;AACH,qBAAa,wBAAyB,SAAQ,aAAa,CAAC,IAAI,GAAG,KAAK,CAAC,YAAY,CAAC;WACpE,KAAK,CAAC,IAAI,EAAE,wBAAwB,GAAG,wBAAwB;WAI/D,OAAO,IAAI,MAAM;IAIjC;;;;OAIG;WACa,SAAS,IAAI,gBAAgB,GAAG,IAAI;IASpD;;OAEG;WACa,UAAU,CACxB,cAAc,EAAE,4BAA4B,GAC3C,wBAAwB;IAI3B;;OAEG;IACM,SAAS,CAAC,MAAM,EAAE,YAAY,GAAG,WAAW;IAM5C,QAAQ,IAAI,IAAI,GAAG,KAAK,CAAC,YAAY;IAI9C;;;;OAIG;IACM,SAAS,IAAI,eAAe;IAGrC;;OAEG;IACM,UAAU,IAAI,qBAAqB;IAOnC,cAAc,IAAI,MAAM;IAIxB,QAAQ,IAAI,KAAK;IAIjB,SAAS,IAAI,OAAO;CAG9B;AAMD,wBAAgB,+BAA+B,IAAI,wBAAwB,CAE1E;AAED,wBAAgB,2BAA2B,CACzC,IAAI,EAAE,WAAW,GAAG,IAAI,GAAG,SAAS,GACnC,IAAI,IAAI,wBAAwB,CAElC"}
1
+ {"version":3,"file":"HorizontalRuleNode.d.ts","sourceRoot":"","sources":["../../../../../src/features/horizontalRule/server/nodes/HorizontalRuleNode.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,gBAAgB,EAEhB,eAAe,EACf,YAAY,EACZ,cAAc,EACd,WAAW,EACX,qBAAqB,EACtB,MAAM,SAAS,CAAA;AAChB,OAAO,KAAK,KAAK,KAAK,MAAM,OAAO,CAAA;AAGnC,OAAO,EAAwC,aAAa,EAAE,MAAM,SAAS,CAAA;AAE7E,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,cAAc,CAAA;AAEhE,eAAO,MAAM,8BAA8B,EAAE,cAAc,CAAC,IAAI,CAE/D,CAAA;AAED;;;;;;GAMG;AACH,qBAAa,wBAAyB,SAAQ,aAAa,CAAC,IAAI,GAAG,KAAK,CAAC,YAAY,CAAC;IACpF,OAAgB,KAAK,CAAC,IAAI,EAAE,wBAAwB,GAAG,wBAAwB,CAE9E;IAED,OAAgB,OAAO,IAAI,MAAM,CAEhC;IAED;;;;OAIG;IACH,OAAgB,SAAS,IAAI,gBAAgB,GAAG,IAAI,CAOnD;IAED;;OAEG;IACH,OAAgB,UAAU,CACxB,cAAc,EAAE,4BAA4B,GAC3C,wBAAwB,CAE1B;IAED;;OAEG;IACM,SAAS,CAAC,MAAM,EAAE,YAAY,GAAG,WAAW,CAIpD;IAEQ,QAAQ,IAAI,IAAI,GAAG,KAAK,CAAC,YAAY,CAE7C;IAED;;;;OAIG;IACM,SAAS,IAAI,eAAe,CAEpC;IACD;;OAEG;IACM,UAAU,IAAI,qBAAqB,CAK3C;IAEQ,cAAc,IAAI,MAAM,CAEhC;IAEQ,QAAQ,IAAI,KAAK,CAEzB;IAEQ,SAAS,IAAI,OAAO,CAE5B;CACF;AAMD,wBAAgB,+BAA+B,IAAI,wBAAwB,CAE1E;AAED,wBAAgB,2BAA2B,CACzC,IAAI,EAAE,WAAW,GAAG,IAAI,GAAG,SAAS,GACnC,IAAI,IAAI,wBAAwB,CAElC"}
@@ -1 +1 @@
1
- {"version":3,"file":"HorizontalRuleNode.js","names":["addClassNamesToElement","$applyNodeReplacement","createCommand","DecoratorNode","INSERT_HORIZONTAL_RULE_COMMAND","HorizontalRuleServerNode","clone","node","__key","getType","importDOM","hr","conversion","$convertHorizontalRuleElement","priority","importJSON","serializedNode","$createHorizontalRuleServerNode","createDOM","config","element","document","createElement","theme","decorate","exportDOM","exportJSON","type","version","getTextContent","isInline","updateDOM","$isHorizontalRuleServerNode"],"sources":["../../../../../src/features/horizontalRule/server/nodes/HorizontalRuleNode.tsx"],"sourcesContent":["import type {\n DOMConversionMap,\n DOMConversionOutput,\n DOMExportOutput,\n EditorConfig,\n LexicalCommand,\n LexicalNode,\n SerializedLexicalNode,\n} from 'lexical'\nimport type * as React from 'react'\n\nimport { addClassNamesToElement } from '@lexical/utils'\nimport { $applyNodeReplacement, createCommand, DecoratorNode } from 'lexical'\n\nimport type { StronglyTypedLeafNode } from '../../../../types/nodeTypes.js'\n\n/**\n * Serialized representation of a horizontal rule node. Serialized = converted to JSON. This is what is stored in the database / in the lexical editor state.\n */\nexport type SerializedHorizontalRuleNode = StronglyTypedLeafNode<\n SerializedLexicalNode,\n 'horizontalrule'\n>\n\nexport const INSERT_HORIZONTAL_RULE_COMMAND: LexicalCommand<void> = createCommand(\n 'INSERT_HORIZONTAL_RULE_COMMAND',\n)\n\n/**\n * This node is a DecoratorNode. DecoratorNodes allow you to render React components in the editor.\n *\n * They need both createDom and decorate functions. createDom => outside of the html. decorate => React Component inside of the html.\n *\n * If we used DecoratorBlockNode instead, we would only need a decorate method\n */\nexport class HorizontalRuleServerNode extends DecoratorNode<null | React.ReactElement> {\n static override clone(node: HorizontalRuleServerNode): HorizontalRuleServerNode {\n return new this(node.__key)\n }\n\n static override getType(): string {\n return 'horizontalrule'\n }\n\n /**\n * Defines what happens if you copy an hr element from another page and paste it into the lexical editor\n *\n * This also determines the behavior of lexical's internal HTML -> Lexical converter\n */\n static override importDOM(): DOMConversionMap | null {\n return {\n hr: () => ({\n conversion: $convertHorizontalRuleElement,\n priority: 0,\n }),\n }\n }\n\n /**\n * The data for this node is stored serialized as JSON. This is the \"load function\" of that node: it takes the saved data and converts it into a node.\n */\n static override importJSON(\n serializedNode: SerializedHorizontalRuleNode,\n ): HorizontalRuleServerNode {\n return $createHorizontalRuleServerNode()\n }\n\n /**\n * Determines how the hr element is rendered in the lexical editor. This is only the \"initial\" / \"outer\" HTML element.\n */\n override createDOM(config: EditorConfig): HTMLElement {\n const element = document.createElement('hr')\n addClassNamesToElement(element, config.theme.hr)\n return element\n }\n\n override decorate(): null | React.ReactElement {\n return null\n }\n\n /**\n * Opposite of importDOM, this function defines what happens when you copy an hr element from the lexical editor and paste it into another page.\n *\n * This also determines the behavior of lexical's internal Lexical -> HTML converter\n */\n override exportDOM(): DOMExportOutput {\n return { element: document.createElement('hr') }\n }\n /**\n * Opposite of importJSON. This determines what data is saved in the database / in the lexical editor state.\n */\n override exportJSON(): SerializedLexicalNode {\n return {\n type: 'horizontalrule',\n version: 1,\n }\n }\n\n override getTextContent(): string {\n return '\\n'\n }\n\n override isInline(): false {\n return false\n }\n\n override updateDOM(): boolean {\n return false\n }\n}\n\nfunction $convertHorizontalRuleElement(): DOMConversionOutput {\n return { node: $createHorizontalRuleServerNode() }\n}\n\nexport function $createHorizontalRuleServerNode(): HorizontalRuleServerNode {\n return $applyNodeReplacement(new HorizontalRuleServerNode())\n}\n\nexport function $isHorizontalRuleServerNode(\n node: LexicalNode | null | undefined,\n): node is HorizontalRuleServerNode {\n return node instanceof HorizontalRuleServerNode\n}\n"],"mappings":"AAWA,SAASA,sBAAsB,QAAQ;AACvC,SAASC,qBAAqB,EAAEC,aAAa,EA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oreList":[]}
1
+ {"version":3,"file":"HorizontalRuleNode.js","names":["addClassNamesToElement","$applyNodeReplacement","createCommand","DecoratorNode","INSERT_HORIZONTAL_RULE_COMMAND","HorizontalRuleServerNode","clone","node","__key","getType","importDOM","hr","conversion","$convertHorizontalRuleElement","priority","importJSON","serializedNode","$createHorizontalRuleServerNode","createDOM","config","element","document","createElement","theme","decorate","exportDOM","exportJSON","type","version","getTextContent","isInline","updateDOM","$isHorizontalRuleServerNode"],"sources":["../../../../../src/features/horizontalRule/server/nodes/HorizontalRuleNode.tsx"],"sourcesContent":["import type {\n DOMConversionMap,\n DOMConversionOutput,\n DOMExportOutput,\n EditorConfig,\n LexicalCommand,\n LexicalNode,\n SerializedLexicalNode,\n} from 'lexical'\nimport type * as React from 'react'\n\nimport { addClassNamesToElement } from '@lexical/utils'\nimport { $applyNodeReplacement, createCommand, DecoratorNode } from 'lexical'\n\nimport type { SerializedHorizontalRuleNode } from '../schema.js'\n\nexport const INSERT_HORIZONTAL_RULE_COMMAND: LexicalCommand<void> = createCommand(\n 'INSERT_HORIZONTAL_RULE_COMMAND',\n)\n\n/**\n * This node is a DecoratorNode. DecoratorNodes allow you to render React components in the editor.\n *\n * They need both createDom and decorate functions. createDom => outside of the html. decorate => React Component inside of the html.\n *\n * If we used DecoratorBlockNode instead, we would only need a decorate method\n */\nexport class HorizontalRuleServerNode extends DecoratorNode<null | React.ReactElement> {\n static override clone(node: HorizontalRuleServerNode): HorizontalRuleServerNode {\n return new this(node.__key)\n }\n\n static override getType(): string {\n return 'horizontalrule'\n }\n\n /**\n * Defines what happens if you copy an hr element from another page and paste it into the lexical editor\n *\n * This also determines the behavior of lexical's internal HTML -> Lexical converter\n */\n static override importDOM(): DOMConversionMap | null {\n return {\n hr: () => ({\n conversion: $convertHorizontalRuleElement,\n priority: 0,\n }),\n }\n }\n\n /**\n * The data for this node is stored serialized as JSON. This is the \"load function\" of that node: it takes the saved data and converts it into a node.\n */\n static override importJSON(\n serializedNode: SerializedHorizontalRuleNode,\n ): HorizontalRuleServerNode {\n return $createHorizontalRuleServerNode()\n }\n\n /**\n * Determines how the hr element is rendered in the lexical editor. This is only the \"initial\" / \"outer\" HTML element.\n */\n override createDOM(config: EditorConfig): HTMLElement {\n const element = document.createElement('hr')\n addClassNamesToElement(element, config.theme.hr)\n return element\n }\n\n override decorate(): null | React.ReactElement {\n return null\n }\n\n /**\n * Opposite of importDOM, this function defines what happens when you copy an hr element from the lexical editor and paste it into another page.\n *\n * This also determines the behavior of lexical's internal Lexical -> HTML converter\n */\n override exportDOM(): DOMExportOutput {\n return { element: document.createElement('hr') }\n }\n /**\n * Opposite of importJSON. This determines what data is saved in the database / in the lexical editor state.\n */\n override exportJSON(): SerializedLexicalNode {\n return {\n type: 'horizontalrule',\n version: 1,\n }\n }\n\n override getTextContent(): string {\n return '\\n'\n }\n\n override isInline(): false {\n return false\n }\n\n override updateDOM(): boolean {\n return false\n }\n}\n\nfunction $convertHorizontalRuleElement(): DOMConversionOutput {\n return { node: $createHorizontalRuleServerNode() }\n}\n\nexport function $createHorizontalRuleServerNode(): HorizontalRuleServerNode {\n return $applyNodeReplacement(new HorizontalRuleServerNode())\n}\n\nexport function $isHorizontalRuleServerNode(\n node: LexicalNode | null | undefined,\n): node is HorizontalRuleServerNode {\n return node instanceof HorizontalRuleServerNode\n}\n"],"mappings":"AAWA,SAASA,sBAAsB,QAAQ;AACvC,SAASC,qBAAqB,EAAEC,aAAa,EAAEC,aAAa,QAAQ;AAIpE,OAAO,MAAMC,8BAAA,GAAuDF,aAAA,CAClE;AAGF;;;;;;;AAOA,OAAO,MAAMG,wBAAA,SAAiCF,aAAA;EAC5C,OAAgBG,MAAMC,IAA8B,EAA4B;IAC9E,OAAO,IAAI,IAAI,CAACA,IAAA,CAAKC,KAAK;EAC5B;EAEA,OAAgBC,QAAA,EAAkB;IAChC,OAAO;EACT;EAEA;;;;;EAKA,OAAgBC,UAAA,EAAqC;IACnD,OAAO;MACLC,EAAA,EAAIA,CAAA,MAAO;QACTC,UAAA,EAAYC,6BAAA;QACZC,QAAA,EAAU;MACZ;IACF;EACF;EAEA;;;EAGA,OAAgBC,WACdC,cAA4C,EAClB;IAC1B,OAAOC,+BAAA;EACT;EAEA;;;EAGAC,SAASA,CAAUC,MAAoB,EAAe;IACpD,MAAMC,OAAA,GAAUC,QAAA,CAASC,aAAa,CAAC;IACvCtB,sBAAA,CAAuBoB,OAAA,EAASD,MAAA,CAAOI,KAAK,CAACZ,EAAE;IAC/C,OAAOS,OAAA;EACT;EAESI,SAAA,EAAsC;IAC7C,OAAO;EACT;EAEA;;;;;EAKAC,SAASA,CAAA,EAA6B;IACpC,OAAO;MAAEL,OAAA,EAASC,QAAA,CAASC,aAAa,CAAC;IAAM;EACjD;EACA;;;EAGAI,UAASA,CAAA,EAAoC;IAC3C,OAAO;MACLC,IAAA,EAAM;MACNC,OAAA,EAAS;IACX;EACF;EAESC,eAAA,EAAyB;IAChC,OAAO;EACT;EAESC,SAAA,EAAkB;IACzB,OAAO;EACT;EAESC,UAAA,EAAqB;IAC5B,OAAO;EACT;AACF;AAEA,SAASlB,8BAAA;EACP,OAAO;IAAEN,IAAA,EAAMU,+BAAA;EAAkC;AACnD;AAEA,OAAO,SAASA,gCAAA;EACd,OAAOhB,qBAAA,CAAsB,IAAII,wBAAA;AACnC;AAEA,OAAO,SAAS2B,4BACdzB,IAAoC;EAEpC,OAAOA,IAAA,YAAgBF,wBAAA;AACzB","ignoreList":[]}
@@ -0,0 +1,7 @@
1
+ import type { JSONSchemaFn } from '../../typesServer.js';
2
+ export interface SerializedHorizontalRuleNode {
3
+ type: 'horizontalrule';
4
+ version: number;
5
+ }
6
+ export declare const horizontalRuleNodeJSONSchema: JSONSchemaFn;
7
+ //# sourceMappingURL=schema.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../../../src/features/horizontalRule/server/schema.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAA;AAExD,MAAM,WAAW,4BAA4B;IAC3C,IAAI,EAAE,gBAAgB,CAAA;IACtB,OAAO,EAAE,MAAM,CAAA;CAChB;AAQD,eAAO,MAAM,4BAA4B,EAAE,YAY1C,CAAA"}
@@ -0,0 +1,25 @@
1
+ /** MUST stay byte-for-byte in sync with the runtime `SerializedHorizontalRuleNode` declared above. */const SERIALIZED_HORIZONTAL_RULE_NODE_TS = `export interface SerializedHorizontalRuleNode {
2
+ type: 'horizontalrule';
3
+ version: number;
4
+ }`;
5
+ export const horizontalRuleNodeJSONSchema = ({
6
+ typeStringDefinitions
7
+ }) => {
8
+ typeStringDefinitions.add(SERIALIZED_HORIZONTAL_RULE_NODE_TS);
9
+ return {
10
+ type: 'object',
11
+ additionalProperties: false,
12
+ properties: {
13
+ type: {
14
+ type: 'string',
15
+ const: 'horizontalrule'
16
+ },
17
+ version: {
18
+ type: 'integer'
19
+ }
20
+ },
21
+ required: ['type', 'version'],
22
+ tsType: 'SerializedHorizontalRuleNode'
23
+ };
24
+ };
25
+ //# sourceMappingURL=schema.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schema.js","names":["SERIALIZED_HORIZONTAL_RULE_NODE_TS","horizontalRuleNodeJSONSchema","typeStringDefinitions","add","type","additionalProperties","properties","const","version","required","tsType"],"sources":["../../../../src/features/horizontalRule/server/schema.ts"],"sourcesContent":["import type { JSONSchemaFn } from '../../typesServer.js'\n\nexport interface SerializedHorizontalRuleNode {\n type: 'horizontalrule'\n version: number\n}\n\n/** MUST stay byte-for-byte in sync with the runtime `SerializedHorizontalRuleNode` declared above. */\nconst SERIALIZED_HORIZONTAL_RULE_NODE_TS = `export interface SerializedHorizontalRuleNode {\n type: 'horizontalrule';\n version: number;\n}`\n\nexport const horizontalRuleNodeJSONSchema: JSONSchemaFn = ({ typeStringDefinitions }) => {\n typeStringDefinitions.add(SERIALIZED_HORIZONTAL_RULE_NODE_TS)\n return {\n type: 'object',\n additionalProperties: false,\n properties: {\n type: { type: 'string', const: 'horizontalrule' },\n version: { type: 'integer' },\n },\n required: ['type', 'version'],\n tsType: 'SerializedHorizontalRuleNode',\n }\n}\n"],"mappings":"AAOA,sGACA,MAAMA,kCAAA,GAAqC;;;EAGzC;AAEF,OAAO,MAAMC,4BAAA,GAA6CA,CAAC;EAAEC;AAAqB,CAAE;EAClFA,qBAAA,CAAsBC,GAAG,CAACH,kCAAA;EAC1B,OAAO;IACLI,IAAA,EAAM;IACNC,oBAAA,EAAsB;IACtBC,UAAA,EAAY;MACVF,IAAA,EAAM;QAAEA,IAAA,EAAM;QAAUG,KAAA,EAAO;MAAiB;MAChDC,OAAA,EAAS;QAAEJ,IAAA,EAAM;MAAU;IAC7B;IACAK,QAAA,EAAU,CAAC,QAAQ,UAAU;IAC7BC,MAAA,EAAQ;EACV;AACF","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"toolbarIndentGroup.d.ts","sourceRoot":"","sources":["../../../../src/features/indent/client/toolbarIndentGroup.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAA;AAE7E,eAAO,MAAM,2BAA2B,GAAI,OAAO,gBAAgB,EAAE,KAAG,YAOvE,CAAA"}
1
+ {"version":3,"file":"toolbarIndentGroup.d.ts","sourceRoot":"","sources":["../../../../src/features/indent/client/toolbarIndentGroup.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAA;AAE7E,eAAO,MAAM,2BAA2B,UAAW,gBAAgB,EAAE,KAAG,YAOvE,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/features/link/client/index.tsx"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,oBAAoB,CAAA;AAevE,MAAM,MAAM,WAAW,GAAG;IACxB,eAAe,CAAC,EAAE,MAAM,CAAA;IACxB,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB,gBAAgB,CAAC,EAAE,cAAc,GAAG,IAAI,CAAA;CACzC,GAAG,6BAA6B,CAAA;AAsDjC,eAAO,MAAM,iBAAiB,wFAgC3B,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/features/link/client/index.tsx"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,oBAAoB,CAAA;AAgBvE,MAAM,MAAM,WAAW,GAAG;IACxB,eAAe,CAAC,EAAE,MAAM,CAAA;IACxB,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB,gBAAgB,CAAC,EAAE,cAAc,GAAG,IAAI,CAAA;CACzC,GAAG,6BAA6B,CAAA;AAsDjC,eAAO,MAAM,iBAAiB,wFAgC3B,CAAA"}
@@ -6,7 +6,7 @@ import { LinkIcon } from '../../../lexical/ui/icons/Link/index.js';
6
6
  import { getSelectedNode } from '../../../lexical/utils/getSelectedNode.js';
7
7
  import { createClientFeature } from '../../../utilities/createClientFeature.js';
8
8
  import { toolbarFeatureButtonsGroupWithItems } from '../../shared/toolbar/featureButtonsGroup.js';
9
- import { LinkMarkdownTransformer } from '../markdownTransformer.js';
9
+ import { PAYLOAD_LINK } from '../markdownTransformer.js';
10
10
  import { AutoLinkNode } from '../nodes/AutoLinkNode.js';
11
11
  import { $isLinkNode, LinkNode, TOGGLE_LINK_COMMAND } from '../nodes/LinkNode.js';
12
12
  import { AutoLinkPlugin } from './plugins/autoLink/index.js';
@@ -70,7 +70,7 @@ const toolbarGroups = [toolbarFeatureButtonsGroupWithItems([{
70
70
  export const LinkFeatureClient = createClientFeature(({
71
71
  props
72
72
  }) => ({
73
- markdownTransformers: [LinkMarkdownTransformer],
73
+ markdownTransformers: [PAYLOAD_LINK],
74
74
  nodes: [LinkNode, props?.disableAutoLinks === true ? null : AutoLinkNode].filter(Boolean),
75
75
  plugins: [{
76
76
  Component: LinkPlugin,
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["$findMatchingParent","$getSelection","$isRangeSelection","LinkIcon","getSelectedNode","createClientFeature","toolbarFeatureButtonsGroupWithItems","LinkMarkdownTransformer","AutoLinkNode","$isLinkNode","LinkNode","TOGGLE_LINK_COMMAND","AutoLinkPlugin","ClickableLinkPlugin","FloatingLinkEditorPlugin","TOGGLE_LINK_WITH_MODAL_COMMAND","LinkPlugin","toolbarGroups","ChildComponent","isActive","selection","selectedNode","linkParent","isEnabled","getTextContent","length","key","label","i18n","t","onSelect","editor","selectedText","selectedNodes","getEditorState","read","getNodes","linkFields","doc","dispatchCommand","fields","text","order","LinkFeatureClient","props","markdownTransformers","nodes","disableAutoLinks","filter","Boolean","plugins","Component","position","sanitizedClientFeatureProps","toolbarFixed","groups","toolbarInline"],"sources":["../../../../src/features/link/client/index.tsx"],"sourcesContent":["'use client'\n\nimport type { Klass, LexicalNode } from 'lexical'\n\nimport { $findMatchingParent } from '@lexical/utils'\nimport { $getSelection, $isRangeSelection } from 'lexical'\n\nimport type { ToolbarGroup } from '../../toolbars/types.js'\nimport type { ClientFeature } from '../../typesClient.js'\nimport type { LinkFields } from '../nodes/types.js'\nimport type { ExclusiveLinkCollectionsProps } from '../server/index.js'\n\nimport { LinkIcon } from '../../../lexical/ui/icons/Link/index.js'\nimport { getSelectedNode } from '../../../lexical/utils/getSelectedNode.js'\nimport { createClientFeature } from '../../../utilities/createClientFeature.js'\nimport { toolbarFeatureButtonsGroupWithItems } from '../../shared/toolbar/featureButtonsGroup.js'\nimport { LinkMarkdownTransformer } from '../markdownTransformer.js'\nimport { AutoLinkNode } from '../nodes/AutoLinkNode.js'\nimport { $isLinkNode, LinkNode, TOGGLE_LINK_COMMAND } from '../nodes/LinkNode.js'\nimport { AutoLinkPlugin } from './plugins/autoLink/index.js'\nimport { ClickableLinkPlugin } from './plugins/clickableLink/index.js'\nimport { FloatingLinkEditorPlugin } from './plugins/floatingLinkEditor/index.js'\nimport { TOGGLE_LINK_WITH_MODAL_COMMAND } from './plugins/floatingLinkEditor/LinkEditor/commands.js'\nimport { LinkPlugin } from './plugins/link/index.js'\n\nexport type ClientProps = {\n defaultLinkType?: string\n defaultLinkURL?: string\n disableAutoLinks?: 'creationOnly' | true\n} & ExclusiveLinkCollectionsProps\n\nconst toolbarGroups: ToolbarGroup[] = [\n toolbarFeatureButtonsGroupWithItems([\n {\n ChildComponent: LinkIcon,\n isActive: ({ selection }) => {\n if ($isRangeSelection(selection)) {\n const selectedNode = getSelectedNode(selection)\n const linkParent = $findMatchingParent(selectedNode, $isLinkNode)\n return linkParent != null\n }\n return false\n },\n isEnabled: ({ selection }) => {\n return !!($isRangeSelection(selection) && $getSelection()?.getTextContent()?.length)\n },\n key: 'link',\n label: ({ i18n }) => {\n return i18n.t('lexical:link:label')\n },\n onSelect: ({ editor, isActive }) => {\n if (!isActive) {\n let selectedText: string | undefined\n let selectedNodes: LexicalNode[] = []\n editor.getEditorState().read(() => {\n selectedText = $getSelection()?.getTextContent()\n // We need to selected nodes here before the drawer opens, as clicking around in the drawer may change the original selection\n selectedNodes = $getSelection()?.getNodes() ?? []\n })\n\n if (!selectedText?.length) {\n return\n }\n\n const linkFields: Partial<LinkFields> = {\n doc: null,\n }\n\n editor.dispatchCommand(TOGGLE_LINK_WITH_MODAL_COMMAND, {\n fields: linkFields,\n selectedNodes,\n text: selectedText,\n })\n } else {\n // remove link\n editor.dispatchCommand(TOGGLE_LINK_COMMAND, null)\n }\n },\n order: 1,\n },\n ]),\n]\n\nexport const LinkFeatureClient = createClientFeature<ClientProps>(({ props }) => ({\n markdownTransformers: [LinkMarkdownTransformer],\n nodes: [LinkNode, props?.disableAutoLinks === true ? null : AutoLinkNode].filter(\n Boolean,\n ) as Array<Klass<LexicalNode>>,\n plugins: [\n {\n Component: LinkPlugin,\n position: 'normal',\n },\n props?.disableAutoLinks === true || props?.disableAutoLinks === 'creationOnly'\n ? null\n : {\n Component: AutoLinkPlugin,\n position: 'normal',\n },\n {\n Component: ClickableLinkPlugin,\n position: 'normal',\n },\n {\n Component: FloatingLinkEditorPlugin,\n position: 'floatingAnchorElem',\n },\n ].filter(Boolean) as ClientFeature<ClientProps>['plugins'],\n sanitizedClientFeatureProps: props,\n toolbarFixed: {\n groups: toolbarGroups,\n },\n toolbarInline: {\n groups: toolbarGroups,\n },\n}))\n"],"mappings":"AAAA;;AAIA,SAASA,mBAAmB,QAAQ;AACpC,SAASC,aAAa,EAAEC,iBAAiB,QAAQ;AAOjD,SAASC,QAAQ,QAAQ;AACzB,SAASC,eAAe,QAAQ;AAChC,SAASC,mBAAmB,QAAQ;AACpC,SAASC,mCAAmC,QAAQ;AACpD,SAASC,uBAAuB,QAAQ;AACxC,SAASC,YAAY,QAAQ;AAC7B,SAASC,WAAW,EAAEC,QAAQ,EAAEC,mBAAmB,QAAQ;AAC3D,SAASC,cAAc,QAAQ;AAC/B,SAASC,mBAAmB,QAAQ;AACpC,SAASC,wBAAwB,QAAQ;AACzC,SAASC,8BAA8B,QAAQ;AAC/C,SAASC,UAAU,QAAQ;AAQ3B,MAAMC,aAAA,GAAgC,CACpCX,mCAAA,CAAoC,CAClC;EACEY,cAAA,EAAgBf,QAAA;EAChBgB,QAAA,EAAUA,CAAC;IAAEC;EAAS,CAAE;IACtB,IAAIlB,iBAAA,CAAkBkB,SAAA,GAAY;MAChC,MAAMC,YAAA,GAAejB,eAAA,CAAgBgB,SAAA;MACrC,MAAME,UAAA,GAAatB,mBAAA,CAAoBqB,YAAA,EAAcZ,WAAA;MACrD,OAAOa,UAAA,IAAc;IACvB;IACA,OAAO;EACT;EACAC,SAAA,EAAWA,CAAC;IAAEH;EAAS,CAAE;IACvB,OAAO,CAAC,EAAElB,iBAAA,CAAkBkB,SAAA,KAAcnB,aAAA,IAAiBuB,cAAA,IAAkBC,MAAK;EACpF;EACAC,GAAA,EAAK;EACLC,KAAA,EAAOA,CAAC;IAAEC;EAAI,CAAE;IACd,OAAOA,IAAA,CAAKC,CAAC,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AAM,CAACC,OAAA;EACTI,2BAAA,EAA6BT,KAAA;EAC7BU,YAAA,EAAc;IACZC,MAAA,EAAQtC;EACV;EACAuC,aAAA,EAAe;IACbD,MAAA,EAAQtC;EACV;AACF","ignoreList":[]}
1
+ {"version":3,"file":"index.js","names":["$findMatchingParent","$getSelection","$isRangeSelection","LinkIcon","getSelectedNode","createClientFeature","toolbarFeatureButtonsGroupWithItems","PAYLOAD_LINK","AutoLinkNode","$isLinkNode","LinkNode","TOGGLE_LINK_COMMAND","AutoLinkPlugin","ClickableLinkPlugin","FloatingLinkEditorPlugin","TOGGLE_LINK_WITH_MODAL_COMMAND","LinkPlugin","toolbarGroups","ChildComponent","isActive","selection","selectedNode","linkParent","isEnabled","getTextContent","length","key","label","i18n","t","onSelect","editor","selectedText","selectedNodes","getEditorState","read","getNodes","linkFields","doc","dispatchCommand","fields","text","order","LinkFeatureClient","props","markdownTransformers","nodes","disableAutoLinks","filter","Boolean","plugins","Component","position","sanitizedClientFeatureProps","toolbarFixed","groups","toolbarInline"],"sources":["../../../../src/features/link/client/index.tsx"],"sourcesContent":["'use client'\n\nimport type { Klass, LexicalNode } from 'lexical'\n\nimport { $findMatchingParent } from '@lexical/utils'\nimport { $getSelection, $isRangeSelection } from 'lexical'\n\nimport type { ToolbarGroup } from '../../toolbars/types.js'\nimport type { ClientFeature } from '../../typesClient.js'\nimport type { ExclusiveLinkCollectionsProps } from '../server/index.js'\nimport type { LinkFields } from '../server/schema.js'\n\nimport { LinkIcon } from '../../../lexical/ui/icons/Link/index.js'\nimport { getSelectedNode } from '../../../lexical/utils/getSelectedNode.js'\nimport { createClientFeature } from '../../../utilities/createClientFeature.js'\nimport { toolbarFeatureButtonsGroupWithItems } from '../../shared/toolbar/featureButtonsGroup.js'\nimport { PAYLOAD_LINK } from '../markdownTransformer.js'\nimport { AutoLinkNode } from '../nodes/AutoLinkNode.js'\nimport { $isLinkNode, LinkNode, TOGGLE_LINK_COMMAND } from '../nodes/LinkNode.js'\nimport { AutoLinkPlugin } from './plugins/autoLink/index.js'\nimport { ClickableLinkPlugin } from './plugins/clickableLink/index.js'\nimport { FloatingLinkEditorPlugin } from './plugins/floatingLinkEditor/index.js'\nimport { TOGGLE_LINK_WITH_MODAL_COMMAND } from './plugins/floatingLinkEditor/LinkEditor/commands.js'\nimport { LinkPlugin } from './plugins/link/index.js'\n\nexport type ClientProps = {\n defaultLinkType?: string\n defaultLinkURL?: string\n disableAutoLinks?: 'creationOnly' | true\n} & ExclusiveLinkCollectionsProps\n\nconst toolbarGroups: ToolbarGroup[] = [\n toolbarFeatureButtonsGroupWithItems([\n {\n ChildComponent: LinkIcon,\n isActive: ({ selection }) => {\n if ($isRangeSelection(selection)) {\n const selectedNode = getSelectedNode(selection)\n const linkParent = $findMatchingParent(selectedNode, $isLinkNode)\n return linkParent != null\n }\n return false\n },\n isEnabled: ({ selection }) => {\n return !!($isRangeSelection(selection) && $getSelection()?.getTextContent()?.length)\n },\n key: 'link',\n label: ({ i18n }) => {\n return i18n.t('lexical:link:label')\n },\n onSelect: ({ editor, isActive }) => {\n if (!isActive) {\n let selectedText: string | undefined\n let selectedNodes: LexicalNode[] = []\n editor.getEditorState().read(() => {\n selectedText = $getSelection()?.getTextContent()\n // We need to selected nodes here before the drawer opens, as clicking around in the drawer may change the original selection\n selectedNodes = $getSelection()?.getNodes() ?? []\n })\n\n if (!selectedText?.length) {\n return\n }\n\n const linkFields: Partial<LinkFields> = {\n doc: null,\n }\n\n editor.dispatchCommand(TOGGLE_LINK_WITH_MODAL_COMMAND, {\n fields: linkFields,\n selectedNodes,\n text: selectedText,\n })\n } else {\n // remove link\n editor.dispatchCommand(TOGGLE_LINK_COMMAND, null)\n }\n },\n order: 1,\n },\n ]),\n]\n\nexport const LinkFeatureClient = createClientFeature<ClientProps>(({ props }) => ({\n markdownTransformers: [PAYLOAD_LINK],\n nodes: [LinkNode, props?.disableAutoLinks === true ? null : AutoLinkNode].filter(\n Boolean,\n ) as Array<Klass<LexicalNode>>,\n plugins: [\n {\n Component: LinkPlugin,\n position: 'normal',\n },\n props?.disableAutoLinks === true || props?.disableAutoLinks === 'creationOnly'\n ? null\n : {\n Component: AutoLinkPlugin,\n position: 'normal',\n },\n {\n Component: ClickableLinkPlugin,\n position: 'normal',\n },\n {\n Component: FloatingLinkEditorPlugin,\n position: 'floatingAnchorElem',\n },\n ].filter(Boolean) as ClientFeature<ClientProps>['plugins'],\n sanitizedClientFeatureProps: props,\n toolbarFixed: {\n groups: toolbarGroups,\n },\n toolbarInline: {\n groups: toolbarGroups,\n },\n}))\n"],"mappings":"AAAA;;AAIA,SAASA,mBAAmB,QAAQ;AACpC,SAASC,aAAa,EAAEC,iBAAiB,QAAQ;AAOjD,SAASC,QAAQ,QAAQ;AACzB,SAASC,eAAe,QAAQ;AAChC,SAASC,mBAAmB,QAAQ;AACpC,SAASC,mCAAmC,QAAQ;AACpD,SAASC,YAAY,QAAQ;AAC7B,SAASC,YAAY,QAAQ;AAC7B,SAASC,WAAW,EAAEC,QAAQ,EAAEC,mBAAmB,QAAQ;AAC3D,SAASC,cAAc,QAAQ;AAC/B,SAASC,mBAAmB,QAAQ;AACpC,SAASC,wBAAwB,QAAQ;AACzC,SAASC,8BAA8B,QAAQ;AAC/C,SAASC,UAAU,QAAQ;AAQ3B,MAAMC,aAAA,GAAgC,CACpCX,mCAAA,CAAoC,CAClC;EACEY,cAAA,EAAgBf,QAAA;EAChBgB,QAAA,EAAUA,CAAC;IAAEC;EAAS,CAAE;IACtB,IAAIlB,iBAAA,CAAkBkB,SAAA,GAAY;MAChC,MAAMC,YAAA,GAAejB,eAAA,CAAgBgB,SAAA;MACrC,MAAME,UAAA,GAAatB,mBAAA,CAAoBqB,YAAA,EAAcZ,WAAA;MACrD,OAAOa,UAAA,IAAc;IACvB;IACA,OAAO;EACT;EACAC,SAAA,EAAWA,CAAC;IAAEH;EAAS,CAAE;IACvB,OAAO,CAAC,EAAElB,iBAAA,CAAkBkB,SAAA,KAAcnB,aAAA,IAAi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IACED,SAAA,EAAWtC,mBAAA;IACXuC,QAAA,EAAU;EACZ,GACA;IACED,SAAA,EAAWrC,wBAAA;IACXsC,QAAA,EAAU;EACZ,EACD,CAACJ,MAAM,CAACC,OAAA;EACTI,2BAAA,EAA6BT,KAAA;EAC7BU,YAAA,EAAc;IACZC,MAAA,EAAQtC;EACV;EACAuC,aAAA,EAAe;IACbD,MAAA,EAAQtC;EACV;AACF","ignoreList":[]}
@@ -1,5 +1,5 @@
1
1
  import type { PluginComponent } from '../../../../typesClient.js';
2
- import type { LinkFields } from '../../../nodes/types.js';
2
+ import type { LinkFields } from '../../../server/schema.js';
3
3
  import type { ClientProps } from '../../index.js';
4
4
  interface LinkMatcherResult {
5
5
  fields?: LinkFields;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/features/link/client/plugins/autoLink/index.tsx"],"names":[],"mappings":"AAiBA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAA;AACjE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAA;AACzD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAA;AAOjD,UAAU,iBAAiB;IACzB,MAAM,CAAC,EAAE,UAAU,CAAA;IACnB,KAAK,EAAE,MAAM,CAAA;IACb,MAAM,EAAE,MAAM,CAAA;IACd,IAAI,EAAE,MAAM,CAAA;IACZ,GAAG,EAAE,MAAM,CAAA;CACZ;AAED,MAAM,MAAM,WAAW,GAAG,CAAC,IAAI,EAAE,MAAM,KAAK,iBAAiB,GAAG,IAAI,CAAA;AAEpE,wBAAgB,2BAA2B,CACzC,MAAM,EAAE,MAAM,EACd,cAAc,GAAE,CAAC,IAAI,EAAE,MAAM,KAAK,MAAuB,IAEjD,MAAM,MAAM;;;;;SAYrB;AAwZD,eAAO,MAAM,cAAc,EAAE,eAAe,CAAC,WAAW,CAMvD,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/features/link/client/plugins/autoLink/index.tsx"],"names":[],"mappings":"AAiBA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAA;AACjE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAA;AAC3D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAA;AAOjD,UAAU,iBAAiB;IACzB,MAAM,CAAC,EAAE,UAAU,CAAA;IACnB,KAAK,EAAE,MAAM,CAAA;IACb,MAAM,EAAE,MAAM,CAAA;IACd,IAAI,EAAE,MAAM,CAAA;IACZ,GAAG,EAAE,MAAM,CAAA;CACZ;AAED,MAAM,MAAM,WAAW,GAAG,CAAC,IAAI,EAAE,MAAM,KAAK,iBAAiB,GAAG,IAAI,CAAA;AAEpE,wBAAgB,2BAA2B,CACzC,MAAM,EAAE,MAAM,EACd,cAAc,GAAE,CAAC,IAAI,EAAE,MAAM,KAAK,MAAuB,UAE3C,MAAM;;;;;SAYrB;AAwZD,eAAO,MAAM,cAAc,EAAE,eAAe,CAAC,WAAW,CAMvD,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["c","_c","useLexicalComposerContext","mergeRegister","$createTextNode","$getSelection","$isElementNode","$isLineBreakNode","$isNodeSelection","$isRangeSelection","$isTextNode","TextNode","TextNodeValue","useEffect","$createAutoLinkNode","$isAutoLinkNode","AutoLinkNode","$isLinkNode","createLinkMatcherWithRegExp","regExp","urlTransformer","text","match","exec","index","length","url","findFirstMatch","matchers","matcher","PUNCTUATION_OR_SPACE","isSeparator","char","undefined","test","endsWithSeparator","textContent","startsWithSeparator","startsWithTLD","isEmail","isPreviousNodeValid","node","previousNode","getPreviousSibling","getLastDescendant","getTextContent","isNextNodeValid","nextNode","getNextSibling","getFirstDescendant","isContentAroundIsValid","matchStart","matchEnd","nodes","contentBeforeIsValid","contentAfterIsValid","extractMatchingNodes","startIndex","endIndex","unmodifiedBeforeNodes","matchingNodes","unmodifiedAfterNodes","matchingOffset","currentOffset","currentNodes","currentNode","currentNodeText","currentNodeLength","currentNodeStart","currentNodeEnd","push","shift","$createAutoLinkNode_","fields","linkType","linkNode","remainingTextNode","linkTextNode","splitText","textNode","setFormat","getFormat","setDetail","getDetail","setStyle","getStyle","append","replace","firstTextNode","offset","firstLinkTextNode","linkNodes","forEach","endNode","selection","selectedTextNode","getNodes","find","select","anchor","focus","$handleLinkCreation","onChange","initialText","map","join","invalidMatchEnd","matchLength","isValid","actualMatchStart","actualMatchEnd","substring","handleLinkEdit","children","getChildren","childrenLength","i","child","isSimpleText","replaceWithChildren","getFields","flds","setFields","handleBadNeighbors","previousSibling","nextSibling","isEmailURI","startsWith","j","insertAfter","remove","getLatest","getTextNodesToMatch","textNodesToMatch","useAutoLink","editor","$","t0","t1","hasNodes","Error","onChangeWrapped","prevUrl","registerNodeTransform","parent","getParentOrThrow","previous","URL_REGEX","EMAIL_REGEX","MATCHERS","AutoLinkPlugin"],"sources":["../../../../../../src/features/link/client/plugins/autoLink/index.tsx"],"sourcesContent":["'use client'\nimport type { ElementNode, LexicalEditor, LexicalNode, TextNode } from 'lexical'\n\nimport { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext.js'\nimport { mergeRegister } from '@lexical/utils'\nimport {\n $createTextNode,\n $getSelection,\n $isElementNode,\n $isLineBreakNode,\n $isNodeSelection,\n $isRangeSelection,\n $isTextNode,\n TextNode as TextNodeValue,\n} from 'lexical'\nimport { useEffect } from 'react'\n\nimport type { PluginComponent } from '../../../../typesClient.js'\nimport type { LinkFields } from '../../../nodes/types.js'\nimport type { ClientProps } from '../../index.js'\n\nimport { $createAutoLinkNode, $isAutoLinkNode, AutoLinkNode } from '../../../nodes/AutoLinkNode.js'\nimport { $isLinkNode } from '../../../nodes/LinkNode.js'\n\ntype ChangeHandler = (url: null | string, prevUrl: null | string) => void\n\ninterface LinkMatcherResult {\n fields?: LinkFields\n index: number\n length: number\n text: string\n url: string\n}\n\nexport type LinkMatcher = (text: string) => LinkMatcherResult | null\n\nexport function createLinkMatcherWithRegExp(\n regExp: RegExp,\n urlTransformer: (text: string) => string = (text) => text,\n) {\n return (text: string) => {\n const match = regExp.exec(text)\n if (match === null) {\n return null\n }\n return {\n index: match.index,\n length: match[0].length,\n text: match[0],\n url: urlTransformer(match[0]),\n }\n }\n}\n\nfunction findFirstMatch(text: string, matchers: LinkMatcher[]): LinkMatcherResult | null {\n for (const matcher of matchers) {\n const match = matcher(text)\n\n if (match != null) {\n return match\n }\n }\n\n return null\n}\n\nconst PUNCTUATION_OR_SPACE = /[.,;\\s]/\n\nfunction isSeparator(char: string | undefined): boolean {\n return char !== undefined && PUNCTUATION_OR_SPACE.test(char)\n}\n\nfunction endsWithSeparator(textContent: string): boolean {\n return isSeparator(textContent[textContent.length - 1])\n}\n\nfunction startsWithSeparator(textContent: string): boolean {\n return isSeparator(textContent[0])\n}\n\n/**\n * Check if the text content starts with a fullstop followed by a top-level domain.\n * Meaning if the text content can be a beginning of a top level domain.\n * @param textContent\n * @param isEmail\n * @returns boolean\n */\nfunction startsWithTLD(textContent: string, isEmail: boolean): boolean {\n if (isEmail) {\n return /^\\.[a-z]{2,}/i.test(textContent)\n } else {\n return /^\\.[a-z0-9]+/i.test(textContent)\n }\n}\n\nfunction isPreviousNodeValid(node: LexicalNode): boolean {\n let previousNode = node.getPreviousSibling()\n if ($isElementNode(previousNode)) {\n previousNode = previousNode.getLastDescendant()\n }\n return (\n previousNode === null ||\n $isLineBreakNode(previousNode) ||\n ($isTextNode(previousNode) && endsWithSeparator(previousNode.getTextContent()))\n )\n}\n\nfunction isNextNodeValid(node: LexicalNode): boolean {\n let nextNode = node.getNextSibling()\n if ($isElementNode(nextNode)) {\n nextNode = nextNode.getFirstDescendant()\n }\n return (\n nextNode === null ||\n $isLineBreakNode(nextNode) ||\n ($isTextNode(nextNode) && startsWithSeparator(nextNode.getTextContent()))\n )\n}\n\nfunction isContentAroundIsValid(\n matchStart: number,\n matchEnd: number,\n text: string,\n nodes: TextNode[],\n): boolean {\n const contentBeforeIsValid =\n matchStart > 0 ? isSeparator(text[matchStart - 1]) : isPreviousNodeValid(nodes[0]!)\n if (!contentBeforeIsValid) {\n return false\n }\n\n const contentAfterIsValid =\n matchEnd < text.length ? isSeparator(text[matchEnd]) : isNextNodeValid(nodes[nodes.length - 1]!)\n return contentAfterIsValid\n}\n\nfunction extractMatchingNodes(\n nodes: TextNode[],\n startIndex: number,\n endIndex: number,\n): [\n matchingOffset: number,\n unmodifiedBeforeNodes: TextNode[],\n matchingNodes: TextNode[],\n unmodifiedAfterNodes: TextNode[],\n] {\n const unmodifiedBeforeNodes: TextNode[] = []\n const matchingNodes: TextNode[] = []\n const unmodifiedAfterNodes: TextNode[] = []\n let matchingOffset = 0\n\n let currentOffset = 0\n const currentNodes = [...nodes]\n\n while (currentNodes.length > 0) {\n const currentNode = currentNodes[0]!\n const currentNodeText = currentNode.getTextContent()\n const currentNodeLength = currentNodeText.length\n const currentNodeStart = currentOffset\n const currentNodeEnd = currentOffset + currentNodeLength\n\n if (currentNodeEnd <= startIndex) {\n unmodifiedBeforeNodes.push(currentNode)\n matchingOffset += currentNodeLength\n } else if (currentNodeStart >= endIndex) {\n unmodifiedAfterNodes.push(currentNode)\n } else {\n matchingNodes.push(currentNode)\n }\n currentOffset += currentNodeLength\n currentNodes.shift()\n }\n return [matchingOffset, unmodifiedBeforeNodes, matchingNodes, unmodifiedAfterNodes]\n}\n\nfunction $createAutoLinkNode_(\n nodes: TextNode[],\n startIndex: number,\n endIndex: number,\n match: LinkMatcherResult,\n): TextNode | undefined {\n const fields = {\n linkType: 'custom',\n url: match.url,\n ...match.fields,\n } as LinkFields\n\n const linkNode = $createAutoLinkNode({ fields })\n if (nodes.length === 1) {\n const remainingTextNode = nodes[0]!\n let linkTextNode: TextNode | undefined\n if (startIndex === 0) {\n ;[linkTextNode] = remainingTextNode.splitText(endIndex)\n } else {\n ;[, linkTextNode] = remainingTextNode.splitText(startIndex, endIndex)\n }\n if (linkTextNode) {\n const textNode = $createTextNode(match.text)\n textNode.setFormat(linkTextNode.getFormat())\n textNode.setDetail(linkTextNode.getDetail())\n textNode.setStyle(linkTextNode.getStyle())\n linkNode.append(textNode)\n linkTextNode.replace(linkNode)\n }\n return remainingTextNode\n } else if (nodes.length > 1) {\n const firstTextNode = nodes[0]!\n let offset = firstTextNode.getTextContent().length\n let firstLinkTextNode\n if (startIndex === 0) {\n firstLinkTextNode = firstTextNode\n } else {\n ;[, firstLinkTextNode] = firstTextNode.splitText(startIndex)\n }\n const linkNodes: LexicalNode[] = []\n let remainingTextNode\n nodes.forEach((currentNode) => {\n const currentNodeText = currentNode.getTextContent()\n const currentNodeLength = currentNodeText.length\n const currentNodeStart = offset\n const currentNodeEnd = offset + currentNodeLength\n if (currentNodeStart < endIndex) {\n if (currentNodeEnd <= endIndex) {\n linkNodes.push(currentNode)\n } else {\n const [linkTextNode, endNode] = currentNode.splitText(endIndex - currentNodeStart)\n if (linkTextNode) {\n linkNodes.push(linkTextNode)\n }\n remainingTextNode = endNode\n }\n }\n offset += currentNodeLength\n })\n\n if (firstLinkTextNode) {\n const selection = $getSelection()\n const selectedTextNode = selection ? selection.getNodes().find($isTextNode) : undefined\n const textNode = $createTextNode(firstLinkTextNode.getTextContent())\n textNode.setFormat(firstLinkTextNode.getFormat())\n textNode.setDetail(firstLinkTextNode.getDetail())\n textNode.setStyle(firstLinkTextNode.getStyle())\n linkNode.append(textNode, ...linkNodes)\n // it does not preserve caret position if caret was at the first text node\n // so we need to restore caret position\n if (selectedTextNode && selectedTextNode === firstLinkTextNode) {\n if ($isRangeSelection(selection)) {\n textNode.select(selection.anchor.offset, selection.focus.offset)\n } else if ($isNodeSelection(selection)) {\n textNode.select(0, textNode.getTextContent().length)\n }\n }\n firstLinkTextNode.replace(linkNode)\n return remainingTextNode\n }\n }\n return undefined\n}\n\nfunction $handleLinkCreation(\n nodes: TextNode[],\n matchers: LinkMatcher[],\n onChange: ChangeHandler,\n): void {\n let currentNodes = [...nodes]\n const initialText = currentNodes.map((node) => node.getTextContent()).join('')\n let text = initialText\n\n let match\n let invalidMatchEnd = 0\n\n while ((match = findFirstMatch(text, matchers)) != null && match !== null) {\n const matchStart: number = match.index\n const matchLength: number = match.length\n const matchEnd = matchStart + matchLength\n const isValid = isContentAroundIsValid(\n invalidMatchEnd + matchStart,\n invalidMatchEnd + matchEnd,\n initialText,\n currentNodes,\n )\n\n if (isValid) {\n const [matchingOffset, , matchingNodes, unmodifiedAfterNodes] = extractMatchingNodes(\n currentNodes,\n invalidMatchEnd + matchStart,\n invalidMatchEnd + matchEnd,\n )\n\n const actualMatchStart = invalidMatchEnd + matchStart - matchingOffset\n const actualMatchEnd = invalidMatchEnd + matchEnd - matchingOffset\n const remainingTextNode = $createAutoLinkNode_(\n matchingNodes,\n actualMatchStart,\n actualMatchEnd,\n match,\n )\n currentNodes = remainingTextNode\n ? [remainingTextNode, ...unmodifiedAfterNodes]\n : unmodifiedAfterNodes\n onChange(match.url, null)\n invalidMatchEnd = 0\n } else {\n invalidMatchEnd += matchEnd\n }\n\n text = text.substring(matchEnd)\n }\n}\n\nfunction handleLinkEdit(\n linkNode: AutoLinkNode,\n matchers: LinkMatcher[],\n onChange: ChangeHandler,\n): void {\n // Check children are simple text\n const children = linkNode.getChildren()\n const childrenLength = children.length\n for (let i = 0; i < childrenLength; i++) {\n const child = children[i]\n if (!$isTextNode(child) || !child.isSimpleText()) {\n replaceWithChildren(linkNode)\n onChange(null, linkNode.getFields()?.url ?? null)\n return\n }\n }\n\n // Check text content fully matches\n const text = linkNode.getTextContent()\n const match = findFirstMatch(text, matchers)\n if (match === null || match.text !== text) {\n replaceWithChildren(linkNode)\n onChange(null, linkNode.getFields()?.url ?? null)\n return\n }\n\n // Check neighbors\n if (!isPreviousNodeValid(linkNode) || !isNextNodeValid(linkNode)) {\n replaceWithChildren(linkNode)\n onChange(null, linkNode.getFields()?.url ?? null)\n return\n }\n\n const url = linkNode.getFields()?.url\n if (url !== match?.url) {\n const flds = linkNode.getFields()\n flds.url = match?.url\n linkNode.setFields(flds)\n onChange(match.url, url ?? null)\n }\n}\n\n// Bad neighbors are edits in neighbor nodes that make AutoLinks incompatible.\n// Given the creation preconditions, these can only be simple text nodes.\nfunction handleBadNeighbors(\n textNode: TextNode,\n matchers: LinkMatcher[],\n onChange: ChangeHandler,\n): void {\n const previousSibling = textNode.getPreviousSibling()\n const nextSibling = textNode.getNextSibling()\n const text = textNode.getTextContent()\n\n if ($isAutoLinkNode(previousSibling)) {\n const isEmailURI = previousSibling.getFields()?.url\n ? (previousSibling.getFields()?.url?.startsWith('mailto:') ?? false)\n : false\n if (!startsWithSeparator(text) || startsWithTLD(text, isEmailURI)) {\n previousSibling.append(textNode)\n handleLinkEdit(previousSibling, matchers, onChange)\n onChange(null, previousSibling.getFields()?.url ?? null)\n }\n }\n\n if ($isAutoLinkNode(nextSibling) && !endsWithSeparator(text)) {\n replaceWithChildren(nextSibling)\n handleLinkEdit(nextSibling, matchers, onChange)\n onChange(null, nextSibling.getFields()?.url ?? null)\n }\n}\n\nfunction replaceWithChildren(node: ElementNode): LexicalNode[] {\n const children = node.getChildren()\n const childrenLength = children.length\n\n for (let j = childrenLength - 1; j >= 0; j--) {\n node.insertAfter(children[j]!)\n }\n\n node.remove()\n return children.map((child) => child.getLatest())\n}\n\nfunction getTextNodesToMatch(textNode: TextNode): TextNode[] {\n // check if next siblings are simple text nodes till a node contains a space separator\n const textNodesToMatch = [textNode]\n let nextSibling = textNode.getNextSibling()\n while (nextSibling !== null && $isTextNode(nextSibling) && nextSibling.isSimpleText()) {\n textNodesToMatch.push(nextSibling)\n if (/\\s/.test(nextSibling.getTextContent())) {\n break\n }\n nextSibling = nextSibling.getNextSibling()\n }\n return textNodesToMatch\n}\n\nfunction useAutoLink(\n editor: LexicalEditor,\n matchers: LinkMatcher[],\n onChange?: ChangeHandler,\n): void {\n useEffect(() => {\n if (!editor.hasNodes([AutoLinkNode])) {\n throw new Error('LexicalAutoLinkPlugin: AutoLinkNode not registered on editor')\n }\n\n const onChangeWrapped = (url: null | string, prevUrl: null | string): void => {\n if (onChange != null) {\n onChange(url, prevUrl)\n }\n }\n\n return mergeRegister(\n editor.registerNodeTransform(TextNodeValue, (textNode: TextNode) => {\n const parent = textNode.getParentOrThrow()\n const previous = textNode.getPreviousSibling()\n if ($isAutoLinkNode(parent)) {\n handleLinkEdit(parent, matchers, onChangeWrapped)\n } else if (!$isLinkNode(parent)) {\n if (\n textNode.isSimpleText() &&\n (startsWithSeparator(textNode.getTextContent()) || !$isAutoLinkNode(previous))\n ) {\n const textNodesToMatch = getTextNodesToMatch(textNode)\n $handleLinkCreation(textNodesToMatch, matchers, onChangeWrapped)\n }\n\n handleBadNeighbors(textNode, matchers, onChangeWrapped)\n }\n }),\n )\n }, [editor, matchers, onChange])\n}\n\nconst URL_REGEX =\n /((https?:\\/\\/(www\\.)?)|(www\\.))[-\\w@:%.+~#=]{1,256}\\.[a-zA-Z\\d()]{1,6}\\b([-\\w()@:%+.~#?&/=]*)(?<![-.+():%])/\n\nconst EMAIL_REGEX =\n /(([^<>()[\\]\\\\.,;:\\s@\"]+(\\.[^<>()[\\]\\\\.,;:\\s@\"]+)*)|(\".+\"))@((\\[\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\])|(([a-z\\-\\d]+\\.)+[a-z]{2,}))/i\n\nconst MATCHERS = [\n createLinkMatcherWithRegExp(URL_REGEX, (text) => {\n return text.startsWith('http') ? text : `https://${text}`\n }),\n createLinkMatcherWithRegExp(EMAIL_REGEX, (text) => {\n return `mailto:${text}`\n }),\n]\n\nexport const AutoLinkPlugin: PluginComponent<ClientProps> = () => {\n const [editor] = useLexicalComposerContext()\n\n useAutoLink(editor, MATCHERS)\n\n return null\n}\n"],"mappings":"AAAA;;AAAA,SAAAA,CAAA,IAAAC,EAAA;AAGA,SAASC,yBAAyB,QAAQ;AAC1C,SAASC,aAAa,QAAQ;AAC9B,SACEC,eAAe,EACfC,aAAa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,yBAAA;EAEjBoI,WAAA,CAAYC,MAAA,EAAAc,QAAQ;EAAA;AAAA,CAGtB","ignoreList":[]}
1
+ {"version":3,"file":"index.js","names":["c","_c","useLexicalComposerContext","mergeRegister","$createTextNode","$getSelection","$isElementNode","$isLineBreakNode","$isNodeSelection","$isRangeSelection","$isTextNode","TextNode","TextNodeValue","useEffect","$createAutoLinkNode","$isAutoLinkNode","AutoLinkNode","$isLinkNode","createLinkMatcherWithRegExp","regExp","urlTransformer","text","match","exec","index","length","url","findFirstMatch","matchers","matcher","PUNCTUATION_OR_SPACE","isSeparator","char","undefined","test","endsWithSeparator","textContent","startsWithSeparator","startsWithTLD","isEmail","isPreviousNodeValid","node","previousNode","getPreviousSibling","getLastDescendant","getTextContent","isNextNodeValid","nextNode","getNextSibling","getFirstDescendant","isContentAroundIsValid","matchStart","matchEnd","nodes","contentBeforeIsValid","contentAfterIsValid","extractMatchingNodes","startIndex","endIndex","unmodifiedBeforeNodes","matchingNodes","unmodifiedAfterNodes","matchingOffset","currentOffset","currentNodes","currentNode","currentNodeText","currentNodeLength","currentNodeStart","currentNodeEnd","push","shift","$createAutoLinkNode_","fields","linkType","linkNode","remainingTextNode","linkTextNode","splitText","textNode","setFormat","getFormat","setDetail","getDetail","setStyle","getStyle","append","replace","firstTextNode","offset","firstLinkTextNode","linkNodes","forEach","endNode","selection","selectedTextNode","getNodes","find","select","anchor","focus","$handleLinkCreation","onChange","initialText","map","join","invalidMatchEnd","matchLength","isValid","actualMatchStart","actualMatchEnd","substring","handleLinkEdit","children","getChildren","childrenLength","i","child","isSimpleText","replaceWithChildren","getFields","flds","setFields","handleBadNeighbors","previousSibling","nextSibling","isEmailURI","startsWith","j","insertAfter","remove","getLatest","getTextNodesToMatch","textNodesToMatch","useAutoLink","editor","$","t0","t1","hasNodes","Error","onChangeWrapped","prevUrl","registerNodeTransform","parent","getParentOrThrow","previous","URL_REGEX","EMAIL_REGEX","MATCHERS","AutoLinkPlugin"],"sources":["../../../../../../src/features/link/client/plugins/autoLink/index.tsx"],"sourcesContent":["'use client'\nimport type { ElementNode, LexicalEditor, LexicalNode, TextNode } from 'lexical'\n\nimport { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext.js'\nimport { mergeRegister } from '@lexical/utils'\nimport {\n $createTextNode,\n $getSelection,\n $isElementNode,\n $isLineBreakNode,\n $isNodeSelection,\n $isRangeSelection,\n $isTextNode,\n TextNode as TextNodeValue,\n} from 'lexical'\nimport { useEffect } from 'react'\n\nimport type { PluginComponent } from '../../../../typesClient.js'\nimport type { LinkFields } from '../../../server/schema.js'\nimport type { ClientProps } from '../../index.js'\n\nimport { $createAutoLinkNode, $isAutoLinkNode, AutoLinkNode } from '../../../nodes/AutoLinkNode.js'\nimport { $isLinkNode } from '../../../nodes/LinkNode.js'\n\ntype ChangeHandler = (url: null | string, prevUrl: null | string) => void\n\ninterface LinkMatcherResult {\n fields?: LinkFields\n index: number\n length: number\n text: string\n url: string\n}\n\nexport type LinkMatcher = (text: string) => LinkMatcherResult | null\n\nexport function createLinkMatcherWithRegExp(\n regExp: RegExp,\n urlTransformer: (text: string) => string = (text) => text,\n) {\n return (text: string) => {\n const match = regExp.exec(text)\n if (match === null) {\n return null\n }\n return {\n index: match.index,\n length: match[0].length,\n text: match[0],\n url: urlTransformer(match[0]),\n }\n }\n}\n\nfunction findFirstMatch(text: string, matchers: LinkMatcher[]): LinkMatcherResult | null {\n for (const matcher of matchers) {\n const match = matcher(text)\n\n if (match != null) {\n return match\n }\n }\n\n return null\n}\n\nconst PUNCTUATION_OR_SPACE = /[.,;\\s]/\n\nfunction isSeparator(char: string | undefined): boolean {\n return char !== undefined && PUNCTUATION_OR_SPACE.test(char)\n}\n\nfunction endsWithSeparator(textContent: string): boolean {\n return isSeparator(textContent[textContent.length - 1])\n}\n\nfunction startsWithSeparator(textContent: string): boolean {\n return isSeparator(textContent[0])\n}\n\n/**\n * Check if the text content starts with a fullstop followed by a top-level domain.\n * Meaning if the text content can be a beginning of a top level domain.\n * @param textContent\n * @param isEmail\n * @returns boolean\n */\nfunction startsWithTLD(textContent: string, isEmail: boolean): boolean {\n if (isEmail) {\n return /^\\.[a-z]{2,}/i.test(textContent)\n } else {\n return /^\\.[a-z0-9]+/i.test(textContent)\n }\n}\n\nfunction isPreviousNodeValid(node: LexicalNode): boolean {\n let previousNode = node.getPreviousSibling()\n if ($isElementNode(previousNode)) {\n previousNode = previousNode.getLastDescendant()\n }\n return (\n previousNode === null ||\n $isLineBreakNode(previousNode) ||\n ($isTextNode(previousNode) && endsWithSeparator(previousNode.getTextContent()))\n )\n}\n\nfunction isNextNodeValid(node: LexicalNode): boolean {\n let nextNode = node.getNextSibling()\n if ($isElementNode(nextNode)) {\n nextNode = nextNode.getFirstDescendant()\n }\n return (\n nextNode === null ||\n $isLineBreakNode(nextNode) ||\n ($isTextNode(nextNode) && startsWithSeparator(nextNode.getTextContent()))\n )\n}\n\nfunction isContentAroundIsValid(\n matchStart: number,\n matchEnd: number,\n text: string,\n nodes: TextNode[],\n): boolean {\n const contentBeforeIsValid =\n matchStart > 0 ? isSeparator(text[matchStart - 1]) : isPreviousNodeValid(nodes[0]!)\n if (!contentBeforeIsValid) {\n return false\n }\n\n const contentAfterIsValid =\n matchEnd < text.length ? isSeparator(text[matchEnd]) : isNextNodeValid(nodes[nodes.length - 1]!)\n return contentAfterIsValid\n}\n\nfunction extractMatchingNodes(\n nodes: TextNode[],\n startIndex: number,\n endIndex: number,\n): [\n matchingOffset: number,\n unmodifiedBeforeNodes: TextNode[],\n matchingNodes: TextNode[],\n unmodifiedAfterNodes: TextNode[],\n] {\n const unmodifiedBeforeNodes: TextNode[] = []\n const matchingNodes: TextNode[] = []\n const unmodifiedAfterNodes: TextNode[] = []\n let matchingOffset = 0\n\n let currentOffset = 0\n const currentNodes = [...nodes]\n\n while (currentNodes.length > 0) {\n const currentNode = currentNodes[0]!\n const currentNodeText = currentNode.getTextContent()\n const currentNodeLength = currentNodeText.length\n const currentNodeStart = currentOffset\n const currentNodeEnd = currentOffset + currentNodeLength\n\n if (currentNodeEnd <= startIndex) {\n unmodifiedBeforeNodes.push(currentNode)\n matchingOffset += currentNodeLength\n } else if (currentNodeStart >= endIndex) {\n unmodifiedAfterNodes.push(currentNode)\n } else {\n matchingNodes.push(currentNode)\n }\n currentOffset += currentNodeLength\n currentNodes.shift()\n }\n return [matchingOffset, unmodifiedBeforeNodes, matchingNodes, unmodifiedAfterNodes]\n}\n\nfunction $createAutoLinkNode_(\n nodes: TextNode[],\n startIndex: number,\n endIndex: number,\n match: LinkMatcherResult,\n): TextNode | undefined {\n const fields = {\n linkType: 'custom',\n url: match.url,\n ...match.fields,\n } as LinkFields\n\n const linkNode = $createAutoLinkNode({ fields })\n if (nodes.length === 1) {\n const remainingTextNode = nodes[0]!\n let linkTextNode: TextNode | undefined\n if (startIndex === 0) {\n ;[linkTextNode] = remainingTextNode.splitText(endIndex)\n } else {\n ;[, linkTextNode] = remainingTextNode.splitText(startIndex, endIndex)\n }\n if (linkTextNode) {\n const textNode = $createTextNode(match.text)\n textNode.setFormat(linkTextNode.getFormat())\n textNode.setDetail(linkTextNode.getDetail())\n textNode.setStyle(linkTextNode.getStyle())\n linkNode.append(textNode)\n linkTextNode.replace(linkNode)\n }\n return remainingTextNode\n } else if (nodes.length > 1) {\n const firstTextNode = nodes[0]!\n let offset = firstTextNode.getTextContent().length\n let firstLinkTextNode\n if (startIndex === 0) {\n firstLinkTextNode = firstTextNode\n } else {\n ;[, firstLinkTextNode] = firstTextNode.splitText(startIndex)\n }\n const linkNodes: LexicalNode[] = []\n let remainingTextNode\n nodes.forEach((currentNode) => {\n const currentNodeText = currentNode.getTextContent()\n const currentNodeLength = currentNodeText.length\n const currentNodeStart = offset\n const currentNodeEnd = offset + currentNodeLength\n if (currentNodeStart < endIndex) {\n if (currentNodeEnd <= endIndex) {\n linkNodes.push(currentNode)\n } else {\n const [linkTextNode, endNode] = currentNode.splitText(endIndex - currentNodeStart)\n if (linkTextNode) {\n linkNodes.push(linkTextNode)\n }\n remainingTextNode = endNode\n }\n }\n offset += currentNodeLength\n })\n\n if (firstLinkTextNode) {\n const selection = $getSelection()\n const selectedTextNode = selection ? selection.getNodes().find($isTextNode) : undefined\n const textNode = $createTextNode(firstLinkTextNode.getTextContent())\n textNode.setFormat(firstLinkTextNode.getFormat())\n textNode.setDetail(firstLinkTextNode.getDetail())\n textNode.setStyle(firstLinkTextNode.getStyle())\n linkNode.append(textNode, ...linkNodes)\n // it does not preserve caret position if caret was at the first text node\n // so we need to restore caret position\n if (selectedTextNode && selectedTextNode === firstLinkTextNode) {\n if ($isRangeSelection(selection)) {\n textNode.select(selection.anchor.offset, selection.focus.offset)\n } else if ($isNodeSelection(selection)) {\n textNode.select(0, textNode.getTextContent().length)\n }\n }\n firstLinkTextNode.replace(linkNode)\n return remainingTextNode\n }\n }\n return undefined\n}\n\nfunction $handleLinkCreation(\n nodes: TextNode[],\n matchers: LinkMatcher[],\n onChange: ChangeHandler,\n): void {\n let currentNodes = [...nodes]\n const initialText = currentNodes.map((node) => node.getTextContent()).join('')\n let text = initialText\n\n let match\n let invalidMatchEnd = 0\n\n while ((match = findFirstMatch(text, matchers)) != null && match !== null) {\n const matchStart: number = match.index\n const matchLength: number = match.length\n const matchEnd = matchStart + matchLength\n const isValid = isContentAroundIsValid(\n invalidMatchEnd + matchStart,\n invalidMatchEnd + matchEnd,\n initialText,\n currentNodes,\n )\n\n if (isValid) {\n const [matchingOffset, , matchingNodes, unmodifiedAfterNodes] = extractMatchingNodes(\n currentNodes,\n invalidMatchEnd + matchStart,\n invalidMatchEnd + matchEnd,\n )\n\n const actualMatchStart = invalidMatchEnd + matchStart - matchingOffset\n const actualMatchEnd = invalidMatchEnd + matchEnd - matchingOffset\n const remainingTextNode = $createAutoLinkNode_(\n matchingNodes,\n actualMatchStart,\n actualMatchEnd,\n match,\n )\n currentNodes = remainingTextNode\n ? [remainingTextNode, ...unmodifiedAfterNodes]\n : unmodifiedAfterNodes\n onChange(match.url, null)\n invalidMatchEnd = 0\n } else {\n invalidMatchEnd += matchEnd\n }\n\n text = text.substring(matchEnd)\n }\n}\n\nfunction handleLinkEdit(\n linkNode: AutoLinkNode,\n matchers: LinkMatcher[],\n onChange: ChangeHandler,\n): void {\n // Check children are simple text\n const children = linkNode.getChildren()\n const childrenLength = children.length\n for (let i = 0; i < childrenLength; i++) {\n const child = children[i]\n if (!$isTextNode(child) || !child.isSimpleText()) {\n replaceWithChildren(linkNode)\n onChange(null, linkNode.getFields()?.url ?? null)\n return\n }\n }\n\n // Check text content fully matches\n const text = linkNode.getTextContent()\n const match = findFirstMatch(text, matchers)\n if (match === null || match.text !== text) {\n replaceWithChildren(linkNode)\n onChange(null, linkNode.getFields()?.url ?? null)\n return\n }\n\n // Check neighbors\n if (!isPreviousNodeValid(linkNode) || !isNextNodeValid(linkNode)) {\n replaceWithChildren(linkNode)\n onChange(null, linkNode.getFields()?.url ?? null)\n return\n }\n\n const url = linkNode.getFields()?.url\n if (url !== match?.url) {\n const flds = linkNode.getFields()\n flds.url = match?.url\n linkNode.setFields(flds)\n onChange(match.url, url ?? null)\n }\n}\n\n// Bad neighbors are edits in neighbor nodes that make AutoLinks incompatible.\n// Given the creation preconditions, these can only be simple text nodes.\nfunction handleBadNeighbors(\n textNode: TextNode,\n matchers: LinkMatcher[],\n onChange: ChangeHandler,\n): void {\n const previousSibling = textNode.getPreviousSibling()\n const nextSibling = textNode.getNextSibling()\n const text = textNode.getTextContent()\n\n if ($isAutoLinkNode(previousSibling)) {\n const isEmailURI = previousSibling.getFields()?.url\n ? (previousSibling.getFields()?.url?.startsWith('mailto:') ?? false)\n : false\n if (!startsWithSeparator(text) || startsWithTLD(text, isEmailURI)) {\n previousSibling.append(textNode)\n handleLinkEdit(previousSibling, matchers, onChange)\n onChange(null, previousSibling.getFields()?.url ?? null)\n }\n }\n\n if ($isAutoLinkNode(nextSibling) && !endsWithSeparator(text)) {\n replaceWithChildren(nextSibling)\n handleLinkEdit(nextSibling, matchers, onChange)\n onChange(null, nextSibling.getFields()?.url ?? null)\n }\n}\n\nfunction replaceWithChildren(node: ElementNode): LexicalNode[] {\n const children = node.getChildren()\n const childrenLength = children.length\n\n for (let j = childrenLength - 1; j >= 0; j--) {\n node.insertAfter(children[j]!)\n }\n\n node.remove()\n return children.map((child) => child.getLatest())\n}\n\nfunction getTextNodesToMatch(textNode: TextNode): TextNode[] {\n // check if next siblings are simple text nodes till a node contains a space separator\n const textNodesToMatch = [textNode]\n let nextSibling = textNode.getNextSibling()\n while (nextSibling !== null && $isTextNode(nextSibling) && nextSibling.isSimpleText()) {\n textNodesToMatch.push(nextSibling)\n if (/\\s/.test(nextSibling.getTextContent())) {\n break\n }\n nextSibling = nextSibling.getNextSibling()\n }\n return textNodesToMatch\n}\n\nfunction useAutoLink(\n editor: LexicalEditor,\n matchers: LinkMatcher[],\n onChange?: ChangeHandler,\n): void {\n useEffect(() => {\n if (!editor.hasNodes([AutoLinkNode])) {\n throw new Error('LexicalAutoLinkPlugin: AutoLinkNode not registered on editor')\n }\n\n const onChangeWrapped = (url: null | string, prevUrl: null | string): void => {\n if (onChange != null) {\n onChange(url, prevUrl)\n }\n }\n\n return mergeRegister(\n editor.registerNodeTransform(TextNodeValue, (textNode: TextNode) => {\n const parent = textNode.getParentOrThrow()\n const previous = textNode.getPreviousSibling()\n if ($isAutoLinkNode(parent)) {\n handleLinkEdit(parent, matchers, onChangeWrapped)\n } else if (!$isLinkNode(parent)) {\n if (\n textNode.isSimpleText() &&\n (startsWithSeparator(textNode.getTextContent()) || !$isAutoLinkNode(previous))\n ) {\n const textNodesToMatch = getTextNodesToMatch(textNode)\n $handleLinkCreation(textNodesToMatch, matchers, onChangeWrapped)\n }\n\n handleBadNeighbors(textNode, matchers, onChangeWrapped)\n }\n }),\n )\n }, [editor, matchers, onChange])\n}\n\nconst URL_REGEX =\n /((https?:\\/\\/(www\\.)?)|(www\\.))[-\\w@:%.+~#=]{1,256}\\.[a-zA-Z\\d()]{1,6}\\b([-\\w()@:%+.~#?&/=]*)(?<![-.+():%])/\n\nconst EMAIL_REGEX =\n /(([^<>()[\\]\\\\.,;:\\s@\"]+(\\.[^<>()[\\]\\\\.,;:\\s@\"]+)*)|(\".+\"))@((\\[\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\])|(([a-z\\-\\d]+\\.)+[a-z]{2,}))/i\n\nconst MATCHERS = [\n createLinkMatcherWithRegExp(URL_REGEX, (text) => {\n return text.startsWith('http') ? text : `https://${text}`\n }),\n createLinkMatcherWithRegExp(EMAIL_REGEX, (text) => {\n return `mailto:${text}`\n }),\n]\n\nexport const AutoLinkPlugin: PluginComponent<ClientProps> = () => {\n const [editor] = useLexicalComposerContext()\n\n useAutoLink(editor, MATCHERS)\n\n return null\n}\n"],"mappings":"AAAA;;AAAA,SAAAA,CAAA,IAAAC,EAAA;AAGA,SAASC,yBAAyB,QAAQ;AAC1C,SAASC,aAAa,QAAQ;AAC9B,SACEC,eAAe,EACfC,aAAa,EACbC,cAAc,EACdC,gBAAgB,EAChBC,gBAAgB,EAChBC,iBAAiB,EACjBC,WAAW,EACXC,QAAA,IAAYC,aAAa,QACpB;AACP,SAASC,SAAS,QAAQ;AAM1B,SAASC,mBAAmB,EAAEC,eAAe,EAAEC,YAAY,QAAQ;AACnE,SAASC,WAAW,QAAQ;AAc5B,OAAO,SAASC,4BACdC,MAAc,EACdC,cAAA,GAA4CC,IAAA,IAASA,IAAI;EAEzD,OAAQA,IAAA;IACN,MAAMC,KAAA,GAAQH,MAAA,CAAOI,IAAI,CAACF,IAAA;IAC1B,IAAIC,KAAA,KAAU,MAAM;MAClB,OAAO;IACT;IACA,OAAO;MACLE,KAAA,EAAOF,KAAA,CAAME,KAAK;MAClBC,MAAA,EAAQH,KAAK,CAAC,EAAE,CAACG,MAAM;MACvBJ,IAAA,EAAMC,KAAK,CAAC,EAAE;MACdI,GAAA,EAAKN,cAAA,CAAeE,KAAK,CAAC,EAAE;IAC9B;EACF;AACF;AAEA,SA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