@payloadcms/richtext-lexical 4.0.0-internal.2fddfc0 → 4.0.0-internal.31ba7ee

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 (725) hide show
  1. package/LICENSE.md +1 -1
  2. package/dist/exports/client/Field-TCOK744G.js +2 -0
  3. package/dist/exports/client/Field-TCOK744G.js.map +7 -0
  4. package/dist/exports/client/bundled.css +1 -1
  5. package/dist/exports/client/chunk-3LRZDIIG.js +2 -0
  6. package/dist/exports/client/chunk-3LRZDIIG.js.map +7 -0
  7. package/dist/exports/client/chunk-43E5QYAA.js +2 -0
  8. package/dist/exports/client/chunk-43E5QYAA.js.map +7 -0
  9. package/dist/exports/client/{chunk-ESITTE3C.js → chunk-ZFGDYZDE.js} +2 -2
  10. package/dist/exports/client/{chunk-ESITTE3C.js.map → chunk-ZFGDYZDE.js.map} +2 -2
  11. package/dist/exports/client/component-D5QLYS7W.js +2 -0
  12. package/dist/exports/client/component-D5QLYS7W.js.map +7 -0
  13. package/dist/exports/client/componentInline-55HZXGUS.js +2 -0
  14. package/dist/exports/client/index.d.ts +1 -3
  15. package/dist/exports/client/index.d.ts.map +1 -1
  16. package/dist/exports/client/index.js +27 -28
  17. package/dist/exports/client/index.js.map +4 -4
  18. package/dist/features/align/client/toolbarAlignGroup.d.ts.map +1 -1
  19. package/dist/features/blockquote/client/index.js +2 -2
  20. package/dist/features/blockquote/client/index.js.map +1 -1
  21. package/dist/features/blockquote/server/index.js +2 -2
  22. package/dist/features/blockquote/server/index.js.map +1 -1
  23. package/dist/features/blocks/client/component/BlockReordering/index.d.ts +11 -0
  24. package/dist/features/blocks/client/component/BlockReordering/index.d.ts.map +1 -0
  25. package/dist/features/blocks/client/component/BlockReordering/index.js +18 -0
  26. package/dist/features/blocks/client/component/BlockReordering/index.js.map +1 -0
  27. package/dist/features/blocks/client/component/index.css +2 -2
  28. package/dist/features/blocks/client/component/index.d.ts +0 -6
  29. package/dist/features/blocks/client/component/index.d.ts.map +1 -1
  30. package/dist/features/blocks/client/component/index.js +133 -76
  31. package/dist/features/blocks/client/component/index.js.map +1 -1
  32. package/dist/features/blocks/client/component/useBlockReordering.d.ts +16 -0
  33. package/dist/features/blocks/client/component/useBlockReordering.d.ts.map +1 -0
  34. package/dist/features/blocks/client/component/useBlockReordering.js +178 -0
  35. package/dist/features/blocks/client/component/useBlockReordering.js.map +1 -0
  36. package/dist/features/blocks/client/componentInline/components/InlineBlockContainer.d.ts.map +1 -1
  37. package/dist/features/blocks/client/componentInline/index.css +8 -8
  38. package/dist/features/blocks/client/componentInline/index.d.ts.map +1 -1
  39. package/dist/features/blocks/client/componentInline/index.js +2 -2
  40. package/dist/features/blocks/client/componentInline/index.js.map +1 -1
  41. package/dist/features/blocks/client/getBlockImageComponent.d.ts +1 -1
  42. package/dist/features/blocks/client/markdown/getLexicalToMarkdown.d.ts +1 -1
  43. package/dist/features/blocks/client/markdown/getLexicalToMarkdown.d.ts.map +1 -1
  44. package/dist/features/blocks/client/markdown/getLexicalToMarkdown.js +1 -1
  45. package/dist/features/blocks/client/markdown/getLexicalToMarkdown.js.map +1 -1
  46. package/dist/features/blocks/client/markdown/getMarkdownToLexical.d.ts +1 -1
  47. package/dist/features/blocks/client/markdown/getMarkdownToLexical.d.ts.map +1 -1
  48. package/dist/features/blocks/client/markdown/getMarkdownToLexical.js +5 -2
  49. package/dist/features/blocks/client/markdown/getMarkdownToLexical.js.map +1 -1
  50. package/dist/features/blocks/client/markdown/markdownTransformer.d.ts +1 -2
  51. package/dist/features/blocks/client/markdown/markdownTransformer.d.ts.map +1 -1
  52. package/dist/features/blocks/client/markdown/markdownTransformer.js.map +1 -1
  53. package/dist/features/blocks/client/nodes/BlocksNode.d.ts.map +1 -1
  54. package/dist/features/blocks/client/nodes/InlineBlocksNode.d.ts.map +1 -1
  55. package/dist/features/blocks/premade/CodeBlock/Component/Collapse/index.css +1 -1
  56. package/dist/features/blocks/premade/CodeBlock/Component/FloatingCollapse/index.css +2 -4
  57. package/dist/features/blocks/premade/CodeBlock/Component/index.css +5 -5
  58. package/dist/features/blocks/server/graphQLPopulationPromise.d.ts.map +1 -1
  59. package/dist/features/blocks/server/index.js +2 -2
  60. package/dist/features/blocks/server/index.js.map +1 -1
  61. package/dist/features/blocks/server/markdown/markdownTransformer.d.ts +1 -1
  62. package/dist/features/blocks/server/markdown/markdownTransformer.d.ts.map +1 -1
  63. package/dist/features/blocks/server/markdown/markdownTransformer.js.map +1 -1
  64. package/dist/features/blocks/server/nodes/BlocksNode.d.ts.map +1 -1
  65. package/dist/features/blocks/server/nodes/InlineBlocksNode.d.ts.map +1 -1
  66. package/dist/features/blocks/server/schema.d.ts.map +1 -1
  67. package/dist/features/blocks/server/schema.js +3 -2
  68. package/dist/features/blocks/server/schema.js.map +1 -1
  69. package/dist/features/blocks/server/validate.d.ts.map +1 -1
  70. package/dist/features/converters/htmlToLexical/index.d.ts.map +1 -1
  71. package/dist/features/converters/lexicalToHtml/async/converters/heading.js +1 -1
  72. package/dist/features/converters/lexicalToHtml/async/converters/heading.js.map +1 -1
  73. package/dist/features/converters/lexicalToHtml/async/converters/list.d.ts.map +1 -1
  74. package/dist/features/converters/lexicalToHtml/async/converters/list.js +4 -3
  75. package/dist/features/converters/lexicalToHtml/async/converters/list.js.map +1 -1
  76. package/dist/features/converters/lexicalToHtml/shared/cssColors.d.ts.map +1 -1
  77. package/dist/features/converters/lexicalToHtml/shared/findConverterForNode.d.ts.map +1 -1
  78. package/dist/features/converters/lexicalToHtml/shared/findConverterForNode.js +3 -2
  79. package/dist/features/converters/lexicalToHtml/shared/findConverterForNode.js.map +1 -1
  80. package/dist/features/converters/lexicalToHtml/sync/converters/heading.js +1 -1
  81. package/dist/features/converters/lexicalToHtml/sync/converters/heading.js.map +1 -1
  82. package/dist/features/converters/lexicalToHtml/sync/converters/list.d.ts.map +1 -1
  83. package/dist/features/converters/lexicalToHtml/sync/converters/list.js +4 -3
  84. package/dist/features/converters/lexicalToHtml/sync/converters/list.js.map +1 -1
  85. package/dist/features/converters/lexicalToJSX/converter/converters/heading.d.ts.map +1 -1
  86. package/dist/features/converters/lexicalToJSX/converter/converters/heading.js +2 -1
  87. package/dist/features/converters/lexicalToJSX/converter/converters/heading.js.map +1 -1
  88. package/dist/features/converters/lexicalToJSX/converter/converters/list.d.ts.map +1 -1
  89. package/dist/features/converters/lexicalToJSX/converter/converters/list.js +2 -1
  90. package/dist/features/converters/lexicalToJSX/converter/converters/list.js.map +1 -1
  91. package/dist/features/converters/lexicalToMarkdown/index.d.ts.map +1 -1
  92. package/dist/features/converters/lexicalToMarkdown/index.js +1 -1
  93. package/dist/features/converters/lexicalToMarkdown/index.js.map +1 -1
  94. package/dist/features/converters/markdownToLexical/index.d.ts.map +1 -1
  95. package/dist/features/converters/markdownToLexical/index.js +5 -2
  96. package/dist/features/converters/markdownToLexical/index.js.map +1 -1
  97. package/dist/features/converters/utilities/payloadPopulateFn.d.ts.map +1 -1
  98. package/dist/features/converters/utilities/payloadPopulateFn.js +4 -2
  99. package/dist/features/converters/utilities/payloadPopulateFn.js.map +1 -1
  100. package/dist/features/debug/jsxConverter/client/plugin/style.css +2 -2
  101. package/dist/features/debug/testRecorder/client/plugin/index.css +0 -1
  102. package/dist/features/format/bold/feature.client.js +1 -1
  103. package/dist/features/format/bold/feature.client.js.map +1 -1
  104. package/dist/features/format/bold/feature.server.d.ts.map +1 -1
  105. package/dist/features/format/bold/feature.server.js +1 -1
  106. package/dist/features/format/bold/feature.server.js.map +1 -1
  107. package/dist/features/format/inlineCode/feature.client.js +1 -1
  108. package/dist/features/format/inlineCode/feature.client.js.map +1 -1
  109. package/dist/features/format/inlineCode/feature.server.d.ts.map +1 -1
  110. package/dist/features/format/inlineCode/feature.server.js +1 -1
  111. package/dist/features/format/inlineCode/feature.server.js.map +1 -1
  112. package/dist/features/format/italic/feature.client.js +1 -1
  113. package/dist/features/format/italic/feature.client.js.map +1 -1
  114. package/dist/features/format/italic/feature.server.d.ts.map +1 -1
  115. package/dist/features/format/italic/feature.server.js +1 -1
  116. package/dist/features/format/italic/feature.server.js.map +1 -1
  117. package/dist/features/format/shared/toolbarFormatGroup.d.ts.map +1 -1
  118. package/dist/features/format/strikethrough/feature.client.js +1 -1
  119. package/dist/features/format/strikethrough/feature.client.js.map +1 -1
  120. package/dist/features/format/strikethrough/feature.server.d.ts.map +1 -1
  121. package/dist/features/format/strikethrough/feature.server.js +1 -1
  122. package/dist/features/format/strikethrough/feature.server.js.map +1 -1
  123. package/dist/features/heading/client/index.js +2 -2
  124. package/dist/features/heading/client/index.js.map +1 -1
  125. package/dist/features/heading/constants.d.ts +2 -0
  126. package/dist/features/heading/constants.d.ts.map +1 -0
  127. package/dist/features/heading/constants.js +2 -0
  128. package/dist/features/heading/constants.js.map +1 -0
  129. package/dist/features/heading/markdownTransformer.d.ts +2 -2
  130. package/dist/features/heading/markdownTransformer.d.ts.map +1 -1
  131. package/dist/features/heading/markdownTransformer.js +6 -19
  132. package/dist/features/heading/markdownTransformer.js.map +1 -1
  133. package/dist/features/heading/server/index.d.ts.map +1 -1
  134. package/dist/features/heading/server/index.js +7 -3
  135. package/dist/features/heading/server/index.js.map +1 -1
  136. package/dist/features/heading/server/schema.d.ts.map +1 -1
  137. package/dist/features/heading/server/validate.d.ts +6 -0
  138. package/dist/features/heading/server/validate.d.ts.map +1 -0
  139. package/dist/features/heading/server/validate.js +15 -0
  140. package/dist/features/heading/server/validate.js.map +1 -0
  141. package/dist/features/horizontalRule/client/index.js +2 -2
  142. package/dist/features/horizontalRule/client/index.js.map +1 -1
  143. package/dist/features/horizontalRule/client/markdownTransformer.d.ts +2 -2
  144. package/dist/features/horizontalRule/client/markdownTransformer.d.ts.map +1 -1
  145. package/dist/features/horizontalRule/client/markdownTransformer.js +1 -1
  146. package/dist/features/horizontalRule/client/markdownTransformer.js.map +1 -1
  147. package/dist/features/horizontalRule/client/nodes/HorizontalRuleNode.d.ts +1 -1
  148. package/dist/features/horizontalRule/client/nodes/HorizontalRuleNode.d.ts.map +1 -1
  149. package/dist/features/horizontalRule/client/nodes/HorizontalRuleNode.js +1 -1
  150. package/dist/features/horizontalRule/client/nodes/HorizontalRuleNode.js.map +1 -1
  151. package/dist/features/horizontalRule/client/plugin/index.css +2 -2
  152. package/dist/features/horizontalRule/server/index.js +2 -2
  153. package/dist/features/horizontalRule/server/index.js.map +1 -1
  154. package/dist/features/horizontalRule/server/markdownTransformer.d.ts +2 -2
  155. package/dist/features/horizontalRule/server/markdownTransformer.d.ts.map +1 -1
  156. package/dist/features/horizontalRule/server/markdownTransformer.js +1 -1
  157. package/dist/features/horizontalRule/server/markdownTransformer.js.map +1 -1
  158. package/dist/features/horizontalRule/server/nodes/HorizontalRuleNode.d.ts +1 -1
  159. package/dist/features/horizontalRule/server/nodes/HorizontalRuleNode.d.ts.map +1 -1
  160. package/dist/features/horizontalRule/server/nodes/HorizontalRuleNode.js +1 -1
  161. package/dist/features/horizontalRule/server/nodes/HorizontalRuleNode.js.map +1 -1
  162. package/dist/features/indent/client/IndentPlugin.d.ts.map +1 -1
  163. package/dist/features/indent/client/IndentPlugin.js +122 -1
  164. package/dist/features/indent/client/IndentPlugin.js.map +1 -1
  165. package/dist/features/indent/client/toolbarIndentGroup.d.ts.map +1 -1
  166. package/dist/features/indent/server/i18n.d.ts.map +1 -1
  167. package/dist/features/indent/server/i18n.js +74 -37
  168. package/dist/features/indent/server/i18n.js.map +1 -1
  169. package/dist/features/link/client/index.js +2 -2
  170. package/dist/features/link/client/index.js.map +1 -1
  171. package/dist/features/link/client/plugins/autoLink/index.d.ts.map +1 -1
  172. package/dist/features/link/client/plugins/floatingLinkEditor/LinkEditor/index.d.ts.map +1 -1
  173. package/dist/features/link/client/plugins/floatingLinkEditor/LinkEditor/index.js +11 -8
  174. package/dist/features/link/client/plugins/floatingLinkEditor/LinkEditor/index.js.map +1 -1
  175. package/dist/features/link/client/plugins/floatingLinkEditor/index.css +7 -12
  176. package/dist/features/link/markdownTransformer.d.ts +4 -4
  177. package/dist/features/link/markdownTransformer.d.ts.map +1 -1
  178. package/dist/features/link/markdownTransformer.js +2 -2
  179. package/dist/features/link/markdownTransformer.js.map +1 -1
  180. package/dist/features/link/nodes/AutoLinkNode.d.ts +1 -1
  181. package/dist/features/link/nodes/AutoLinkNode.d.ts.map +1 -1
  182. package/dist/features/link/nodes/AutoLinkNode.js.map +1 -1
  183. package/dist/features/link/nodes/LinkNode.d.ts +1 -1
  184. package/dist/features/link/nodes/LinkNode.d.ts.map +1 -1
  185. package/dist/features/link/nodes/LinkNode.js.map +1 -1
  186. package/dist/features/link/server/baseFields.d.ts.map +1 -1
  187. package/dist/features/link/server/baseFields.js.map +1 -1
  188. package/dist/features/link/server/graphQLPopulationPromise.d.ts.map +1 -1
  189. package/dist/features/link/server/index.js +4 -4
  190. package/dist/features/link/server/index.js.map +1 -1
  191. package/dist/features/link/server/schema.d.ts.map +1 -1
  192. package/dist/features/link/server/schema.js +4 -2
  193. package/dist/features/link/server/schema.js.map +1 -1
  194. package/dist/features/link/server/validate.d.ts.map +1 -1
  195. package/dist/features/lists/checklist/client/index.js +1 -1
  196. package/dist/features/lists/checklist/client/index.js.map +1 -1
  197. package/dist/features/lists/checklist/server/index.d.ts.map +1 -1
  198. package/dist/features/lists/checklist/server/index.js +6 -3
  199. package/dist/features/lists/checklist/server/index.js.map +1 -1
  200. package/dist/features/lists/orderedList/client/index.js +1 -1
  201. package/dist/features/lists/orderedList/client/index.js.map +1 -1
  202. package/dist/features/lists/orderedList/server/index.d.ts.map +1 -1
  203. package/dist/features/lists/orderedList/server/index.js +6 -3
  204. package/dist/features/lists/orderedList/server/index.js.map +1 -1
  205. package/dist/features/lists/shared/constants.d.ts +2 -0
  206. package/dist/features/lists/shared/constants.d.ts.map +1 -0
  207. package/dist/features/lists/shared/constants.js +2 -0
  208. package/dist/features/lists/shared/constants.js.map +1 -0
  209. package/dist/features/lists/shared/validate.d.ts +5 -0
  210. package/dist/features/lists/shared/validate.d.ts.map +1 -0
  211. package/dist/features/lists/shared/validate.js +15 -0
  212. package/dist/features/lists/shared/validate.js.map +1 -0
  213. package/dist/features/lists/unorderedList/client/index.js +1 -1
  214. package/dist/features/lists/unorderedList/client/index.js.map +1 -1
  215. package/dist/features/lists/unorderedList/server/index.d.ts.map +1 -1
  216. package/dist/features/lists/unorderedList/server/index.js +6 -3
  217. package/dist/features/lists/unorderedList/server/index.js.map +1 -1
  218. package/dist/features/relationship/client/drawer/index.d.ts.map +1 -1
  219. package/dist/features/relationship/client/index.d.ts +2 -2
  220. package/dist/features/relationship/client/index.d.ts.map +1 -1
  221. package/dist/features/relationship/client/index.js.map +1 -1
  222. package/dist/features/relationship/client/nodes/RelationshipNode.d.ts.map +1 -1
  223. package/dist/features/relationship/client/plugins/index.d.ts +2 -2
  224. package/dist/features/relationship/client/plugins/index.d.ts.map +1 -1
  225. package/dist/features/relationship/client/plugins/index.js +27 -31
  226. package/dist/features/relationship/client/plugins/index.js.map +1 -1
  227. package/dist/features/relationship/client/utils/useEnabledRelationships.d.ts +2 -4
  228. package/dist/features/relationship/client/utils/useEnabledRelationships.d.ts.map +1 -1
  229. package/dist/features/relationship/client/utils/useEnabledRelationships.js +53 -20
  230. package/dist/features/relationship/client/utils/useEnabledRelationships.js.map +1 -1
  231. package/dist/features/relationship/server/graphQLPopulationPromise.d.ts +2 -2
  232. package/dist/features/relationship/server/graphQLPopulationPromise.d.ts.map +1 -1
  233. package/dist/features/relationship/server/graphQLPopulationPromise.js +2 -2
  234. package/dist/features/relationship/server/graphQLPopulationPromise.js.map +1 -1
  235. package/dist/features/relationship/server/index.d.ts +8 -1
  236. package/dist/features/relationship/server/index.d.ts.map +1 -1
  237. package/dist/features/relationship/server/index.js +28 -11
  238. package/dist/features/relationship/server/index.js.map +1 -1
  239. package/dist/features/relationship/server/nodes/RelationshipNode.d.ts.map +1 -1
  240. package/dist/features/relationship/server/schema.d.ts +5 -5
  241. package/dist/features/relationship/server/schema.d.ts.map +1 -1
  242. package/dist/features/relationship/server/schema.js +27 -15
  243. package/dist/features/relationship/server/schema.js.map +1 -1
  244. package/dist/features/relationship/shared/filterEnabledRelationshipCollections.d.ts +1 -6
  245. package/dist/features/relationship/shared/filterEnabledRelationshipCollections.d.ts.map +1 -1
  246. package/dist/features/relationship/shared/filterEnabledRelationshipCollections.js +1 -5
  247. package/dist/features/relationship/shared/filterEnabledRelationshipCollections.js.map +1 -1
  248. package/dist/features/shared/toolbar/addDropdownGroup.d.ts.map +1 -1
  249. package/dist/features/shared/toolbar/featureButtonsGroup.d.ts.map +1 -1
  250. package/dist/features/shared/toolbar/textDropdownGroup.d.ts.map +1 -1
  251. package/dist/features/table/client/index.d.ts.map +1 -0
  252. package/dist/features/{experimental_table → table}/client/index.js +2 -2
  253. package/dist/features/table/client/index.js.map +1 -0
  254. package/dist/features/table/client/plugins/TableActionMenuPlugin/computeSelectionCount.d.ts +8 -0
  255. package/dist/features/table/client/plugins/TableActionMenuPlugin/computeSelectionCount.d.ts.map +1 -0
  256. package/dist/features/table/client/plugins/TableActionMenuPlugin/computeSelectionCount.js +19 -0
  257. package/dist/features/table/client/plugins/TableActionMenuPlugin/computeSelectionCount.js.map +1 -0
  258. package/dist/features/table/client/plugins/TableActionMenuPlugin/index.d.ts.map +1 -0
  259. package/dist/features/{experimental_table → table}/client/plugins/TableActionMenuPlugin/index.js +17 -44
  260. package/dist/features/table/client/plugins/TableActionMenuPlugin/index.js.map +1 -0
  261. package/dist/features/table/client/plugins/TableCellResizerPlugin/index.d.ts.map +1 -0
  262. package/dist/features/{experimental_table → table}/client/plugins/TableCellResizerPlugin/index.js +41 -18
  263. package/dist/features/table/client/plugins/TableCellResizerPlugin/index.js.map +1 -0
  264. package/dist/features/table/client/plugins/TableHoverActionsPlugin/index.d.ts.map +1 -0
  265. package/dist/features/table/client/plugins/TableHoverActionsPlugin/index.js.map +1 -0
  266. package/dist/features/table/client/plugins/TablePlugin/TableGridPopup/index.d.ts.map +1 -0
  267. package/dist/features/table/client/plugins/TablePlugin/TableGridPopup/index.js.map +1 -0
  268. package/dist/features/table/client/plugins/TablePlugin/index.d.ts.map +1 -0
  269. package/dist/features/table/client/plugins/TablePlugin/index.js.map +1 -0
  270. package/dist/features/table/client/utils/debounce.d.ts.map +1 -0
  271. package/dist/features/table/client/utils/debounce.js.map +1 -0
  272. package/dist/features/table/client/utils/useDebounce.d.ts.map +1 -0
  273. package/dist/features/table/client/utils/useDebounce.js.map +1 -0
  274. package/dist/features/table/markdownTransformer.d.ts +5 -0
  275. package/dist/features/table/markdownTransformer.d.ts.map +1 -0
  276. package/dist/features/{experimental_table → table}/markdownTransformer.js +6 -3
  277. package/dist/features/table/markdownTransformer.js.map +1 -0
  278. package/dist/features/table/server/index.d.ts +3 -0
  279. package/dist/features/table/server/index.d.ts.map +1 -0
  280. package/dist/features/{experimental_table → table}/server/index.js +6 -6
  281. package/dist/features/table/server/index.js.map +1 -0
  282. package/dist/features/table/server/schema.d.ts.map +1 -0
  283. package/dist/features/table/server/schema.js.map +1 -0
  284. package/dist/features/textState/feature.client.js +1 -1
  285. package/dist/features/textState/feature.client.js.map +1 -1
  286. package/dist/features/toolbars/fixed/client/Toolbar/horizontalWheelScroll.d.ts +8 -0
  287. package/dist/features/toolbars/fixed/client/Toolbar/horizontalWheelScroll.d.ts.map +1 -0
  288. package/dist/features/toolbars/fixed/client/Toolbar/horizontalWheelScroll.js +80 -0
  289. package/dist/features/toolbars/fixed/client/Toolbar/horizontalWheelScroll.js.map +1 -0
  290. package/dist/features/toolbars/fixed/client/Toolbar/index.css +80 -8
  291. package/dist/features/toolbars/fixed/client/Toolbar/index.d.ts.map +1 -1
  292. package/dist/features/toolbars/fixed/client/Toolbar/index.js +4 -1
  293. package/dist/features/toolbars/fixed/client/Toolbar/index.js.map +1 -1
  294. package/dist/features/toolbars/inline/client/Toolbar/index.css +2 -14
  295. package/dist/features/toolbars/inline/client/Toolbar/index.d.ts.map +1 -1
  296. package/dist/features/toolbars/inline/client/Toolbar/index.js +2 -2
  297. package/dist/features/toolbars/inline/client/Toolbar/index.js.map +1 -1
  298. package/dist/features/toolbars/shared/ToolbarButton/index.d.ts.map +1 -1
  299. package/dist/features/toolbars/shared/ToolbarButton/index.js +1 -0
  300. package/dist/features/toolbars/shared/ToolbarButton/index.js.map +1 -1
  301. package/dist/features/toolbars/shared/ToolbarDropdown/DropDown.d.ts.map +1 -1
  302. package/dist/features/toolbars/shared/ToolbarDropdown/DropDown.js +85 -32
  303. package/dist/features/toolbars/shared/ToolbarDropdown/DropDown.js.map +1 -1
  304. package/dist/features/toolbars/shared/ToolbarDropdown/index.css +23 -24
  305. package/dist/features/toolbars/shared/ToolbarDropdown/index.d.ts.map +1 -1
  306. package/dist/features/toolbars/shared/useToolbarStates.d.ts.map +1 -1
  307. package/dist/features/toolbars/shared/useToolbarStates.js +3 -1
  308. package/dist/features/toolbars/shared/useToolbarStates.js.map +1 -1
  309. package/dist/features/typesClient.d.ts +1 -1
  310. package/dist/features/typesClient.d.ts.map +1 -1
  311. package/dist/features/typesClient.js.map +1 -1
  312. package/dist/features/typesServer.d.ts +16 -11
  313. package/dist/features/typesServer.d.ts.map +1 -1
  314. package/dist/features/typesServer.js.map +1 -1
  315. package/dist/features/upload/client/component/index.css +9 -9
  316. package/dist/features/upload/client/component/index.js +2 -1
  317. package/dist/features/upload/client/component/index.js.map +1 -1
  318. package/dist/features/upload/client/drawer/index.d.ts.map +1 -1
  319. package/dist/features/upload/client/index.d.ts +3 -2
  320. package/dist/features/upload/client/index.d.ts.map +1 -1
  321. package/dist/features/upload/client/index.js.map +1 -1
  322. package/dist/features/upload/client/nodes/UploadNode.d.ts.map +1 -1
  323. package/dist/features/upload/client/plugin/index.d.ts.map +1 -1
  324. package/dist/features/upload/client/plugin/index.js +53 -56
  325. package/dist/features/upload/client/plugin/index.js.map +1 -1
  326. package/dist/features/upload/server/graphQLPopulationPromise.d.ts +2 -2
  327. package/dist/features/upload/server/graphQLPopulationPromise.d.ts.map +1 -1
  328. package/dist/features/upload/server/graphQLPopulationPromise.js +1 -1
  329. package/dist/features/upload/server/graphQLPopulationPromise.js.map +1 -1
  330. package/dist/features/upload/server/index.d.ts +6 -2
  331. package/dist/features/upload/server/index.d.ts.map +1 -1
  332. package/dist/features/upload/server/index.js +22 -18
  333. package/dist/features/upload/server/index.js.map +1 -1
  334. package/dist/features/upload/server/markdownTransformer.d.ts +2 -2
  335. package/dist/features/upload/server/markdownTransformer.d.ts.map +1 -1
  336. package/dist/features/upload/server/markdownTransformer.js +1 -1
  337. package/dist/features/upload/server/markdownTransformer.js.map +1 -1
  338. package/dist/features/upload/server/nodes/UploadNode.d.ts.map +1 -1
  339. package/dist/features/upload/server/schema.d.ts +6 -6
  340. package/dist/features/upload/server/schema.d.ts.map +1 -1
  341. package/dist/features/upload/server/schema.js +30 -14
  342. package/dist/features/upload/server/schema.js.map +1 -1
  343. package/dist/features/upload/server/validate.d.ts +2 -2
  344. package/dist/features/upload/server/validate.d.ts.map +1 -1
  345. package/dist/features/upload/server/validate.js +3 -0
  346. package/dist/features/upload/server/validate.js.map +1 -1
  347. package/dist/field/Diff/converters/listitem/index.d.ts.map +1 -1
  348. package/dist/field/Diff/converters/listitem/index.js +2 -1
  349. package/dist/field/Diff/converters/listitem/index.js.map +1 -1
  350. package/dist/field/Diff/converters/unknown/index.css +1 -1
  351. package/dist/field/Diff/index.d.ts +3 -2
  352. package/dist/field/Diff/index.d.ts.map +1 -1
  353. package/dist/field/Diff/index.js +1 -0
  354. package/dist/field/Diff/index.js.map +1 -1
  355. package/dist/field/Field.d.ts.map +1 -1
  356. package/dist/field/Field.js +18 -15
  357. package/dist/field/Field.js.map +1 -1
  358. package/dist/field/RenderLexical/index.d.ts +3 -1
  359. package/dist/field/RenderLexical/index.d.ts.map +1 -1
  360. package/dist/field/RenderLexical/index.js +23 -23
  361. package/dist/field/RenderLexical/index.js.map +1 -1
  362. package/dist/field/ViewSelector.css +1 -1
  363. package/dist/field/ViewSelector.d.ts.map +1 -1
  364. package/dist/field/ViewSelector.js +1 -0
  365. package/dist/field/ViewSelector.js.map +1 -1
  366. package/dist/field/bundled.css +1 -1
  367. package/dist/field/index.css +4 -4
  368. package/dist/i18n.d.ts.map +1 -1
  369. package/dist/i18n.js +68 -0
  370. package/dist/i18n.js.map +1 -1
  371. package/dist/index.d.ts +3 -3
  372. package/dist/index.d.ts.map +1 -1
  373. package/dist/index.js +11 -54
  374. package/dist/index.js.map +1 -1
  375. package/dist/lexical/LexicalEditor.css +29 -18
  376. package/dist/lexical/LexicalEditor.d.ts.map +1 -1
  377. package/dist/lexical/LexicalEditor.js +62 -99
  378. package/dist/lexical/LexicalEditor.js.map +1 -1
  379. package/dist/lexical/LexicalProvider.d.ts.map +1 -1
  380. package/dist/lexical/LexicalProvider.js +7 -22
  381. package/dist/lexical/LexicalProvider.js.map +1 -1
  382. package/dist/lexical/config/client/EditorConfigProvider.d.ts.map +1 -1
  383. package/dist/lexical/config/client/sanitize.d.ts.map +1 -1
  384. package/dist/lexical/config/server/loader.d.ts +1 -1
  385. package/dist/lexical/config/server/loader.d.ts.map +1 -1
  386. package/dist/lexical/config/server/loader.js +2 -2
  387. package/dist/lexical/config/server/loader.js.map +1 -1
  388. package/dist/lexical/config/server/sanitize.d.ts +1 -1
  389. package/dist/lexical/config/server/sanitize.d.ts.map +1 -1
  390. package/dist/lexical/config/server/sanitize.js +2 -2
  391. package/dist/lexical/config/server/sanitize.js.map +1 -1
  392. package/dist/lexical/plugins/DecoratorPlugin/index.css +1 -1
  393. package/dist/lexical/plugins/DecoratorPlugin/index.d.ts.map +1 -1
  394. package/dist/lexical/plugins/DecoratorPlugin/index.js +24 -21
  395. package/dist/lexical/plugins/DecoratorPlugin/index.js.map +1 -1
  396. package/dist/lexical/plugins/InsertParagraphAtEnd/index.css +18 -25
  397. package/dist/lexical/plugins/InsertParagraphAtEnd/index.d.ts.map +1 -1
  398. package/dist/lexical/plugins/InsertParagraphAtEnd/index.js +27 -14
  399. package/dist/lexical/plugins/InsertParagraphAtEnd/index.js.map +1 -1
  400. package/dist/lexical/plugins/MarkdownShortcut/index.d.ts.map +1 -1
  401. package/dist/lexical/plugins/MarkdownShortcut/index.js +1 -1
  402. package/dist/lexical/plugins/MarkdownShortcut/index.js.map +1 -1
  403. package/dist/lexical/plugins/NodeViewOverridePlugin/index.d.ts.map +1 -1
  404. package/dist/lexical/plugins/NodeViewOverridePlugin/index.js +21 -0
  405. package/dist/lexical/plugins/NodeViewOverridePlugin/index.js.map +1 -1
  406. package/dist/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/LexicalMenu.d.ts +0 -1
  407. package/dist/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/LexicalMenu.d.ts.map +1 -1
  408. package/dist/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/LexicalMenu.js +2 -21
  409. package/dist/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/LexicalMenu.js.map +1 -1
  410. package/dist/lexical/plugins/SlashMenu/index.css +1 -6
  411. package/dist/lexical/plugins/handles/AddBlockHandlePlugin/index.css +2 -1
  412. package/dist/lexical/plugins/handles/AddBlockHandlePlugin/index.js +2 -2
  413. package/dist/lexical/plugins/handles/AddBlockHandlePlugin/index.js.map +1 -1
  414. package/dist/lexical/plugins/handles/DraggableBlockPlugin/debounce.d.ts.map +1 -1
  415. package/dist/lexical/plugins/handles/DraggableBlockPlugin/index.css +5 -3
  416. package/dist/lexical/plugins/handles/DraggableBlockPlugin/index.d.ts.map +1 -1
  417. package/dist/lexical/plugins/handles/DraggableBlockPlugin/index.js +17 -3
  418. package/dist/lexical/plugins/handles/DraggableBlockPlugin/index.js.map +1 -1
  419. package/dist/lexical/plugins/handles/DraggableBlockPlugin/useKeyboardReordering.d.ts +7 -0
  420. package/dist/lexical/plugins/handles/DraggableBlockPlugin/useKeyboardReordering.d.ts.map +1 -0
  421. package/dist/lexical/plugins/handles/DraggableBlockPlugin/useKeyboardReordering.js +65 -0
  422. package/dist/lexical/plugins/handles/DraggableBlockPlugin/useKeyboardReordering.js.map +1 -0
  423. package/dist/lexical/plugins/handles/utils/calculateDistanceFromScrollerElem.d.ts.map +1 -1
  424. package/dist/lexical/plugins/handles/utils/setHandlePosition.d.ts.map +1 -1
  425. package/dist/lexical/plugins/handles/utils/setHandlePosition.js +2 -0
  426. package/dist/lexical/plugins/handles/utils/setHandlePosition.js.map +1 -1
  427. package/dist/lexical/theme/EditorTheme.css +18 -19
  428. package/dist/lexical/ui/ContentEditable.css +22 -17
  429. package/dist/lexical/ui/ContentEditable.d.ts +2 -1
  430. package/dist/lexical/ui/ContentEditable.d.ts.map +1 -1
  431. package/dist/lexical/ui/ContentEditable.js +9 -6
  432. package/dist/lexical/ui/ContentEditable.js.map +1 -1
  433. package/dist/lexical/ui/icons/H3/index.d.ts.map +1 -1
  434. package/dist/lexical/ui/icons/H3/index.js +13 -6
  435. package/dist/lexical/ui/icons/H3/index.js.map +1 -1
  436. package/dist/lexical/ui/icons/H4/index.d.ts.map +1 -1
  437. package/dist/lexical/ui/icons/H4/index.js +13 -6
  438. package/dist/lexical/ui/icons/H4/index.js.map +1 -1
  439. package/dist/lexical/ui/icons/H5/index.d.ts.map +1 -1
  440. package/dist/lexical/ui/icons/H5/index.js +13 -6
  441. package/dist/lexical/ui/icons/H5/index.js.map +1 -1
  442. package/dist/lexical/ui/icons/H6/index.d.ts.map +1 -1
  443. package/dist/lexical/ui/icons/H6/index.js +13 -6
  444. package/dist/lexical/ui/icons/H6/index.js.map +1 -1
  445. package/dist/lexical/utils/markdown/convertFromMarkdownString.d.ts +17 -0
  446. package/dist/lexical/utils/markdown/convertFromMarkdownString.d.ts.map +1 -0
  447. package/dist/lexical/utils/markdown/convertFromMarkdownString.js +27 -0
  448. package/dist/lexical/utils/markdown/convertFromMarkdownString.js.map +1 -0
  449. package/dist/lexical/utils/markdown/createBlockNode.d.ts +2 -2
  450. package/dist/lexical/utils/markdown/createBlockNode.d.ts.map +1 -1
  451. package/dist/lexical/utils/markdown/createBlockNode.js.map +1 -1
  452. package/dist/lexical/utils/markdown/normalizeMarkdown.d.ts +25 -0
  453. package/dist/lexical/utils/markdown/normalizeMarkdown.d.ts.map +1 -0
  454. package/dist/lexical/utils/markdown/normalizeMarkdown.js +91 -0
  455. package/dist/lexical/utils/markdown/normalizeMarkdown.js.map +1 -0
  456. package/dist/lexical/utils/nodeFormat.d.ts.map +1 -1
  457. package/dist/lexical/utils/point.d.ts.map +1 -1
  458. package/dist/lexical/utils/rect.d.ts.map +1 -1
  459. package/dist/lexical-proxy/@lexical-markdown.d.ts +1 -1
  460. package/dist/lexical-proxy/@lexical-markdown.d.ts.map +1 -1
  461. package/dist/lexical-proxy/@lexical-markdown.js +1 -1
  462. package/dist/lexical-proxy/@lexical-markdown.js.map +1 -1
  463. package/dist/lexical-proxy/@lexical-react/ExtensionComponent.d.ts +2 -0
  464. package/dist/lexical-proxy/@lexical-react/ExtensionComponent.d.ts.map +1 -0
  465. package/dist/lexical-proxy/@lexical-react/ExtensionComponent.js +2 -0
  466. package/dist/lexical-proxy/@lexical-react/ExtensionComponent.js.map +1 -0
  467. package/dist/lexical-proxy/@lexical-react/LexicalExtensionComposer.d.ts +2 -0
  468. package/dist/lexical-proxy/@lexical-react/LexicalExtensionComposer.d.ts.map +1 -0
  469. package/dist/lexical-proxy/@lexical-react/LexicalExtensionComposer.js +2 -0
  470. package/dist/lexical-proxy/@lexical-react/LexicalExtensionComposer.js.map +1 -0
  471. package/dist/lexical-proxy/@lexical-react/LexicalExtensionEditorComposer.d.ts +2 -0
  472. package/dist/lexical-proxy/@lexical-react/LexicalExtensionEditorComposer.d.ts.map +1 -0
  473. package/dist/lexical-proxy/@lexical-react/LexicalExtensionEditorComposer.js +2 -0
  474. package/dist/lexical-proxy/@lexical-react/LexicalExtensionEditorComposer.js.map +1 -0
  475. package/dist/lexical-proxy/@lexical-react/LexicalSelectionAlwaysOnDisplay.d.ts +2 -0
  476. package/dist/lexical-proxy/@lexical-react/LexicalSelectionAlwaysOnDisplay.d.ts.map +1 -0
  477. package/dist/lexical-proxy/@lexical-react/LexicalSelectionAlwaysOnDisplay.js +2 -0
  478. package/dist/lexical-proxy/@lexical-react/LexicalSelectionAlwaysOnDisplay.js.map +1 -0
  479. package/dist/lexical-proxy/@lexical-react/ReactExtension.d.ts +2 -0
  480. package/dist/lexical-proxy/@lexical-react/ReactExtension.d.ts.map +1 -0
  481. package/dist/lexical-proxy/@lexical-react/ReactExtension.js +2 -0
  482. package/dist/lexical-proxy/@lexical-react/ReactExtension.js.map +1 -0
  483. package/dist/lexical-proxy/@lexical-react/ReactPluginHostExtension.d.ts +2 -0
  484. package/dist/lexical-proxy/@lexical-react/ReactPluginHostExtension.d.ts.map +1 -0
  485. package/dist/lexical-proxy/@lexical-react/ReactPluginHostExtension.js +2 -0
  486. package/dist/lexical-proxy/@lexical-react/ReactPluginHostExtension.js.map +1 -0
  487. package/dist/lexical-proxy/@lexical-react/ReactProviderExtension.d.ts +2 -0
  488. package/dist/lexical-proxy/@lexical-react/ReactProviderExtension.d.ts.map +1 -0
  489. package/dist/lexical-proxy/@lexical-react/ReactProviderExtension.js +2 -0
  490. package/dist/lexical-proxy/@lexical-react/ReactProviderExtension.js.map +1 -0
  491. package/dist/lexical-proxy/@lexical-react/TreeViewExtension.d.ts +2 -0
  492. package/dist/lexical-proxy/@lexical-react/TreeViewExtension.d.ts.map +1 -0
  493. package/dist/lexical-proxy/@lexical-react/TreeViewExtension.js +2 -0
  494. package/dist/lexical-proxy/@lexical-react/TreeViewExtension.js.map +1 -0
  495. package/dist/lexical-proxy/@lexical-react/useExtensionComponent.d.ts +2 -0
  496. package/dist/lexical-proxy/@lexical-react/useExtensionComponent.d.ts.map +1 -0
  497. package/dist/lexical-proxy/@lexical-react/useExtensionComponent.js +2 -0
  498. package/dist/lexical-proxy/@lexical-react/useExtensionComponent.js.map +1 -0
  499. package/dist/lexical-proxy/@lexical-react/useExtensionSignalValue.d.ts +2 -0
  500. package/dist/lexical-proxy/@lexical-react/useExtensionSignalValue.d.ts.map +1 -0
  501. package/dist/lexical-proxy/@lexical-react/useExtensionSignalValue.js +2 -0
  502. package/dist/lexical-proxy/@lexical-react/useExtensionSignalValue.js.map +1 -0
  503. package/dist/lexical-proxy/@lexical-react/useLexicalAriaLiveRegion.d.ts +2 -0
  504. package/dist/lexical-proxy/@lexical-react/useLexicalAriaLiveRegion.d.ts.map +1 -0
  505. package/dist/lexical-proxy/@lexical-react/useLexicalAriaLiveRegion.js +2 -0
  506. package/dist/lexical-proxy/@lexical-react/useLexicalAriaLiveRegion.js.map +1 -0
  507. package/dist/lexical-proxy/@lexical-react/useLexicalFocusManagerRef.d.ts +2 -0
  508. package/dist/lexical-proxy/@lexical-react/useLexicalFocusManagerRef.d.ts.map +1 -0
  509. package/dist/lexical-proxy/@lexical-react/useLexicalFocusManagerRef.js +2 -0
  510. package/dist/lexical-proxy/@lexical-react/useLexicalFocusManagerRef.js.map +1 -0
  511. package/dist/lexical-proxy/@lexical-react/useLexicalFocusTrapRef.d.ts +2 -0
  512. package/dist/lexical-proxy/@lexical-react/useLexicalFocusTrapRef.d.ts.map +1 -0
  513. package/dist/lexical-proxy/@lexical-react/useLexicalFocusTrapRef.js +2 -0
  514. package/dist/lexical-proxy/@lexical-react/useLexicalFocusTrapRef.js.map +1 -0
  515. package/dist/lexical-proxy/@lexical-react/useLexicalRovingTabIndexRef.d.ts +2 -0
  516. package/dist/lexical-proxy/@lexical-react/useLexicalRovingTabIndexRef.d.ts.map +1 -0
  517. package/dist/lexical-proxy/@lexical-react/useLexicalRovingTabIndexRef.js +2 -0
  518. package/dist/lexical-proxy/@lexical-react/useLexicalRovingTabIndexRef.js.map +1 -0
  519. package/dist/lexical-proxy/@lexical-react/useLexicalSlotRef.d.ts +2 -0
  520. package/dist/lexical-proxy/@lexical-react/useLexicalSlotRef.d.ts.map +1 -0
  521. package/dist/lexical-proxy/@lexical-react/useLexicalSlotRef.js +2 -0
  522. package/dist/lexical-proxy/@lexical-react/useLexicalSlotRef.js.map +1 -0
  523. package/dist/populateGraphQL/populateLexicalPopulationPromises.d.ts.map +1 -1
  524. package/dist/populateGraphQL/recursivelyPopulateFieldsForGraphQL.d.ts.map +1 -1
  525. package/dist/types/index.d.ts +1 -1
  526. package/dist/types/index.d.ts.map +1 -1
  527. package/dist/types/index.js.map +1 -1
  528. package/dist/types/jsonSchemaHelpers.d.ts.map +1 -1
  529. package/dist/types/nodeTypes.d.ts +1 -1
  530. package/dist/types/nodeTypes.d.ts.map +1 -1
  531. package/dist/types/nodeTypes.js.map +1 -1
  532. package/dist/types/schema.d.ts.map +1 -1
  533. package/dist/types/schema.js +12 -5
  534. package/dist/types/schema.js.map +1 -1
  535. package/dist/utilities/applyBaseFilterToFields.d.ts.map +1 -1
  536. package/dist/utilities/applyBaseFilterToFields.js.map +1 -1
  537. package/dist/utilities/createServerFeature.d.ts +1 -1
  538. package/dist/utilities/createServerFeature.d.ts.map +1 -1
  539. package/dist/utilities/createServerFeature.js +2 -2
  540. package/dist/utilities/createServerFeature.js.map +1 -1
  541. package/dist/utilities/editorConfigFactory.d.ts +6 -6
  542. package/dist/utilities/editorConfigFactory.d.ts.map +1 -1
  543. package/dist/utilities/editorConfigFactory.js +9 -9
  544. package/dist/utilities/editorConfigFactory.js.map +1 -1
  545. package/dist/utilities/fieldsDrawer/useDrawerSubmit.d.ts +1 -1
  546. package/dist/utilities/fieldsDrawer/useDrawerSubmit.d.ts.map +1 -1
  547. package/dist/utilities/fieldsDrawer/useLexicalDocumentDrawer.d.ts.map +1 -1
  548. package/dist/utilities/fieldsDrawer/useLexicalDrawer.d.ts.map +1 -1
  549. package/dist/utilities/fieldsDrawer/useLexicalListDrawer.d.ts.map +1 -1
  550. package/dist/utilities/generateImportMap.d.ts +1 -1
  551. package/dist/utilities/generateImportMap.d.ts.map +1 -1
  552. package/dist/utilities/generateImportMap.js +3 -7
  553. package/dist/utilities/generateImportMap.js.map +1 -1
  554. package/dist/utilities/generateSchemaMap.d.ts +1 -1
  555. package/dist/utilities/generateSchemaMap.d.ts.map +1 -1
  556. package/dist/utilities/getDefaultSanitizedEditorConfig.d.ts +2 -2
  557. package/dist/utilities/getDefaultSanitizedEditorConfig.d.ts.map +1 -1
  558. package/dist/utilities/getDefaultSanitizedEditorConfig.js +6 -17
  559. package/dist/utilities/getDefaultSanitizedEditorConfig.js.map +1 -1
  560. package/dist/utilities/recurseNodeTree.d.ts.map +1 -1
  561. package/dist/utilities/upgradeLexicalData/index.js +6 -3
  562. package/dist/utilities/upgradeLexicalData/index.js.map +1 -1
  563. package/dist/utilities/upgradeLexicalData/upgradeDocumentFieldsRecursively.d.ts.map +1 -1
  564. package/dist/utilities/useLexicalFeature.d.ts.map +1 -1
  565. package/dist/validate/hasText.d.ts +2 -2
  566. package/dist/validate/hasText.d.ts.map +1 -1
  567. package/dist/validate/hasText.js.map +1 -1
  568. package/dist/validate/index.d.ts +1 -1
  569. package/dist/validate/index.d.ts.map +1 -1
  570. package/package.json +96 -28
  571. package/dist/@types/assets.d.js +0 -2
  572. package/dist/@types/assets.d.js.map +0 -1
  573. package/dist/dependencyChecker.spec.js +0 -16
  574. package/dist/dependencyChecker.spec.js.map +0 -1
  575. package/dist/exports/client/Field-VW7ZGT6K.js +0 -2
  576. package/dist/exports/client/Field-VW7ZGT6K.js.map +0 -7
  577. package/dist/exports/client/chunk-4EIYXZ6H.js +0 -12
  578. package/dist/exports/client/chunk-4EIYXZ6H.js.map +0 -7
  579. package/dist/exports/client/chunk-UD4DQ4AK.js +0 -2
  580. package/dist/exports/client/chunk-UD4DQ4AK.js.map +0 -7
  581. package/dist/exports/client/component-PHZQBOJE.js +0 -2
  582. package/dist/exports/client/component-PHZQBOJE.js.map +0 -7
  583. package/dist/exports/client/componentInline-H24N7GUG.js +0 -2
  584. package/dist/exports/server/rsc.browser.d.ts +0 -11
  585. package/dist/exports/server/rsc.browser.d.ts.map +0 -1
  586. package/dist/exports/server/rsc.browser.js +0 -10
  587. package/dist/exports/server/rsc.browser.js.map +0 -1
  588. package/dist/features/blockquote/markdownTransformer.d.ts +0 -3
  589. package/dist/features/blockquote/markdownTransformer.d.ts.map +0 -1
  590. package/dist/features/blockquote/markdownTransformer.js +0 -33
  591. package/dist/features/blockquote/markdownTransformer.js.map +0 -1
  592. package/dist/features/converters/lexicalToPlaintext/convertLexicalToPlaintext.spec.js +0 -180
  593. package/dist/features/converters/lexicalToPlaintext/convertLexicalToPlaintext.spec.js.map +0 -1
  594. package/dist/features/experimental_table/client/index.d.ts.map +0 -1
  595. package/dist/features/experimental_table/client/index.js.map +0 -1
  596. package/dist/features/experimental_table/client/plugins/TableActionMenuPlugin/index.d.ts.map +0 -1
  597. package/dist/features/experimental_table/client/plugins/TableActionMenuPlugin/index.js.map +0 -1
  598. package/dist/features/experimental_table/client/plugins/TableCellResizerPlugin/index.d.ts.map +0 -1
  599. package/dist/features/experimental_table/client/plugins/TableCellResizerPlugin/index.js.map +0 -1
  600. package/dist/features/experimental_table/client/plugins/TableHoverActionsPlugin/index.d.ts.map +0 -1
  601. package/dist/features/experimental_table/client/plugins/TableHoverActionsPlugin/index.js.map +0 -1
  602. package/dist/features/experimental_table/client/plugins/TablePlugin/TableGridPopup/index.d.ts.map +0 -1
  603. package/dist/features/experimental_table/client/plugins/TablePlugin/TableGridPopup/index.js.map +0 -1
  604. package/dist/features/experimental_table/client/plugins/TablePlugin/index.d.ts.map +0 -1
  605. package/dist/features/experimental_table/client/plugins/TablePlugin/index.js.map +0 -1
  606. package/dist/features/experimental_table/client/utils/debounce.d.ts.map +0 -1
  607. package/dist/features/experimental_table/client/utils/debounce.js.map +0 -1
  608. package/dist/features/experimental_table/client/utils/useDebounce.d.ts.map +0 -1
  609. package/dist/features/experimental_table/client/utils/useDebounce.js.map +0 -1
  610. package/dist/features/experimental_table/markdownTransformer.d.ts +0 -5
  611. package/dist/features/experimental_table/markdownTransformer.d.ts.map +0 -1
  612. package/dist/features/experimental_table/markdownTransformer.js.map +0 -1
  613. package/dist/features/experimental_table/server/index.d.ts +0 -3
  614. package/dist/features/experimental_table/server/index.d.ts.map +0 -1
  615. package/dist/features/experimental_table/server/index.js.map +0 -1
  616. package/dist/features/experimental_table/server/schema.d.ts.map +0 -1
  617. package/dist/features/experimental_table/server/schema.js.map +0 -1
  618. package/dist/features/format/bold/markdownTransformers.d.ts +0 -6
  619. package/dist/features/format/bold/markdownTransformers.d.ts.map +0 -1
  620. package/dist/features/format/bold/markdownTransformers.js +0 -23
  621. package/dist/features/format/bold/markdownTransformers.js.map +0 -1
  622. package/dist/features/format/inlineCode/markdownTransformers.d.ts +0 -3
  623. package/dist/features/format/inlineCode/markdownTransformers.d.ts.map +0 -1
  624. package/dist/features/format/inlineCode/markdownTransformers.js +0 -6
  625. package/dist/features/format/inlineCode/markdownTransformers.js.map +0 -1
  626. package/dist/features/format/italic/markdownTransformers.d.ts +0 -4
  627. package/dist/features/format/italic/markdownTransformers.d.ts.map +0 -1
  628. package/dist/features/format/italic/markdownTransformers.js +0 -12
  629. package/dist/features/format/italic/markdownTransformers.js.map +0 -1
  630. package/dist/features/format/strikethrough/markdownTransformers.d.ts +0 -3
  631. package/dist/features/format/strikethrough/markdownTransformers.d.ts.map +0 -1
  632. package/dist/features/format/strikethrough/markdownTransformers.js +0 -6
  633. package/dist/features/format/strikethrough/markdownTransformers.js.map +0 -1
  634. package/dist/features/link/markdownTransformer.spec.js +0 -195
  635. package/dist/features/link/markdownTransformer.spec.js.map +0 -1
  636. package/dist/features/lists/checklist/markdownTransformers.d.ts +0 -3
  637. package/dist/features/lists/checklist/markdownTransformers.d.ts.map +0 -1
  638. package/dist/features/lists/checklist/markdownTransformers.js +0 -12
  639. package/dist/features/lists/checklist/markdownTransformers.js.map +0 -1
  640. package/dist/features/lists/orderedList/markdownTransformer.d.ts +0 -3
  641. package/dist/features/lists/orderedList/markdownTransformer.d.ts.map +0 -1
  642. package/dist/features/lists/orderedList/markdownTransformer.js +0 -12
  643. package/dist/features/lists/orderedList/markdownTransformer.js.map +0 -1
  644. package/dist/features/lists/shared/markdown.d.ts +0 -6
  645. package/dist/features/lists/shared/markdown.d.ts.map +0 -1
  646. package/dist/features/lists/shared/markdown.js +0 -57
  647. package/dist/features/lists/shared/markdown.js.map +0 -1
  648. package/dist/features/lists/unorderedList/markdownTransformer.d.ts +0 -3
  649. package/dist/features/lists/unorderedList/markdownTransformer.d.ts.map +0 -1
  650. package/dist/features/lists/unorderedList/markdownTransformer.js +0 -12
  651. package/dist/features/lists/unorderedList/markdownTransformer.js.map +0 -1
  652. package/dist/field/clientEntry.d.ts +0 -29
  653. package/dist/field/clientEntry.d.ts.map +0 -1
  654. package/dist/field/clientEntry.js +0 -86
  655. package/dist/field/clientEntry.js.map +0 -1
  656. package/dist/lexical/utils/guard.d.ts +0 -5
  657. package/dist/lexical/utils/guard.d.ts.map +0 -1
  658. package/dist/lexical/utils/guard.js +0 -9
  659. package/dist/lexical/utils/guard.js.map +0 -1
  660. package/dist/lexical/utils/url.spec.js +0 -114
  661. package/dist/lexical/utils/url.spec.js.map +0 -1
  662. package/dist/lexical-proxy/@lexical-react/LexicalContextMenuPlugin.d.ts +0 -2
  663. package/dist/lexical-proxy/@lexical-react/LexicalContextMenuPlugin.d.ts.map +0 -1
  664. package/dist/lexical-proxy/@lexical-react/LexicalContextMenuPlugin.js +0 -2
  665. package/dist/lexical-proxy/@lexical-react/LexicalContextMenuPlugin.js.map +0 -1
  666. package/dist/packages/@lexical/markdown/LexicalMarkdownHardLineBreak.spec.js +0 -160
  667. package/dist/packages/@lexical/markdown/LexicalMarkdownHardLineBreak.spec.js.map +0 -1
  668. package/dist/packages/@lexical/markdown/MarkdownExport.d.ts +0 -14
  669. package/dist/packages/@lexical/markdown/MarkdownExport.d.ts.map +0 -1
  670. package/dist/packages/@lexical/markdown/MarkdownExport.js +0 -220
  671. package/dist/packages/@lexical/markdown/MarkdownExport.js.map +0 -1
  672. package/dist/packages/@lexical/markdown/MarkdownImport.d.ts +0 -19
  673. package/dist/packages/@lexical/markdown/MarkdownImport.d.ts.map +0 -1
  674. package/dist/packages/@lexical/markdown/MarkdownImport.js +0 -199
  675. package/dist/packages/@lexical/markdown/MarkdownImport.js.map +0 -1
  676. package/dist/packages/@lexical/markdown/MarkdownShortcuts.d.ts +0 -11
  677. package/dist/packages/@lexical/markdown/MarkdownShortcuts.d.ts.map +0 -1
  678. package/dist/packages/@lexical/markdown/MarkdownShortcuts.js +0 -304
  679. package/dist/packages/@lexical/markdown/MarkdownShortcuts.js.map +0 -1
  680. package/dist/packages/@lexical/markdown/MarkdownTransformers.d.ts +0 -173
  681. package/dist/packages/@lexical/markdown/MarkdownTransformers.d.ts.map +0 -1
  682. package/dist/packages/@lexical/markdown/MarkdownTransformers.js +0 -352
  683. package/dist/packages/@lexical/markdown/MarkdownTransformers.js.map +0 -1
  684. package/dist/packages/@lexical/markdown/importTextFormatTransformer.d.ts +0 -22
  685. package/dist/packages/@lexical/markdown/importTextFormatTransformer.d.ts.map +0 -1
  686. package/dist/packages/@lexical/markdown/importTextFormatTransformer.js +0 -91
  687. package/dist/packages/@lexical/markdown/importTextFormatTransformer.js.map +0 -1
  688. package/dist/packages/@lexical/markdown/importTextMatchTransformer.d.ts +0 -21
  689. package/dist/packages/@lexical/markdown/importTextMatchTransformer.d.ts.map +0 -1
  690. package/dist/packages/@lexical/markdown/importTextMatchTransformer.js +0 -54
  691. package/dist/packages/@lexical/markdown/importTextMatchTransformer.js.map +0 -1
  692. package/dist/packages/@lexical/markdown/importTextTransformers.d.ts +0 -18
  693. package/dist/packages/@lexical/markdown/importTextTransformers.d.ts.map +0 -1
  694. package/dist/packages/@lexical/markdown/importTextTransformers.js +0 -54
  695. package/dist/packages/@lexical/markdown/importTextTransformers.js.map +0 -1
  696. package/dist/packages/@lexical/markdown/index.d.ts +0 -29
  697. package/dist/packages/@lexical/markdown/index.d.ts.map +0 -1
  698. package/dist/packages/@lexical/markdown/index.js +0 -39
  699. package/dist/packages/@lexical/markdown/index.js.map +0 -1
  700. package/dist/packages/@lexical/markdown/utils.d.ts +0 -34
  701. package/dist/packages/@lexical/markdown/utils.d.ts.map +0 -1
  702. package/dist/packages/@lexical/markdown/utils.js +0 -267
  703. package/dist/packages/@lexical/markdown/utils.js.map +0 -1
  704. package/dist/utilities/jsx/jsx.spec.js +0 -178
  705. package/dist/utilities/jsx/jsx.spec.js.map +0 -1
  706. /package/dist/exports/client/{componentInline-H24N7GUG.js.map → componentInline-55HZXGUS.js.map} +0 -0
  707. /package/dist/features/{experimental_table → table}/client/index.d.ts +0 -0
  708. /package/dist/features/{experimental_table → table}/client/plugins/TableActionMenuPlugin/index.css +0 -0
  709. /package/dist/features/{experimental_table → table}/client/plugins/TableActionMenuPlugin/index.d.ts +0 -0
  710. /package/dist/features/{experimental_table → table}/client/plugins/TableCellResizerPlugin/index.css +0 -0
  711. /package/dist/features/{experimental_table → table}/client/plugins/TableCellResizerPlugin/index.d.ts +0 -0
  712. /package/dist/features/{experimental_table → table}/client/plugins/TableHoverActionsPlugin/index.d.ts +0 -0
  713. /package/dist/features/{experimental_table → table}/client/plugins/TableHoverActionsPlugin/index.js +0 -0
  714. /package/dist/features/{experimental_table → table}/client/plugins/TablePlugin/TableGridPopup/index.css +0 -0
  715. /package/dist/features/{experimental_table → table}/client/plugins/TablePlugin/TableGridPopup/index.d.ts +0 -0
  716. /package/dist/features/{experimental_table → table}/client/plugins/TablePlugin/TableGridPopup/index.js +0 -0
  717. /package/dist/features/{experimental_table → table}/client/plugins/TablePlugin/index.css +0 -0
  718. /package/dist/features/{experimental_table → table}/client/plugins/TablePlugin/index.d.ts +0 -0
  719. /package/dist/features/{experimental_table → table}/client/plugins/TablePlugin/index.js +0 -0
  720. /package/dist/features/{experimental_table → table}/client/utils/debounce.d.ts +0 -0
  721. /package/dist/features/{experimental_table → table}/client/utils/debounce.js +0 -0
  722. /package/dist/features/{experimental_table → table}/client/utils/useDebounce.d.ts +0 -0
  723. /package/dist/features/{experimental_table → table}/client/utils/useDebounce.js +0 -0
  724. /package/dist/features/{experimental_table → table}/server/schema.d.ts +0 -0
  725. /package/dist/features/{experimental_table → table}/server/schema.js +0 -0
@@ -1 +1 @@
1
- {"version":3,"file":"sanitize.d.ts","sourceRoot":"","sources":["../../../../src/lexical/config/client/sanitize.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,IAAI,mBAAmB,EAAE,MAAM,SAAS,CAAA;AAKlE,OAAO,KAAK,EACV,wBAAwB,EACxB,uBAAuB,EACxB,MAAM,kCAAkC,CAAA;AACzC,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,yBAAyB,CAAA;AAC3E,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,aAAa,CAAA;AAE9D,eAAO,MAAM,sBAAsB,GACjC,UAAU,wBAAwB,KACjC,uBAiOF,CAAA;AAED,wBAAgB,0BAA0B,CACxC,wBAAwB,EAAE,wBAAwB,EAClD,OAAO,CAAC,EAAE,mBAAmB,EAC7B,KAAK,CAAC,EAAE,4BAA4B,EACpC,IAAI,CAAC,EAAE,MAAM,GACZ,2BAA2B,CAQ7B"}
1
+ {"version":3,"file":"sanitize.d.ts","sourceRoot":"","sources":["../../../../src/lexical/config/client/sanitize.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,IAAI,mBAAmB,EAAE,MAAM,SAAS,CAAA;AAKlE,OAAO,KAAK,EACV,wBAAwB,EACxB,uBAAuB,EACxB,MAAM,kCAAkC,CAAA;AACzC,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,yBAAyB,CAAA;AAC3E,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,aAAa,CAAA;AAE9D,eAAO,MAAM,sBAAsB,aACvB,wBAAwB,KACjC,uBAiOF,CAAA;AAED,wBAAgB,0BAA0B,CACxC,wBAAwB,EAAE,wBAAwB,EAClD,OAAO,CAAC,EAAE,mBAAmB,EAC7B,KAAK,CAAC,EAAE,4BAA4B,EACpC,IAAI,CAAC,EAAE,MAAM,GACZ,2BAA2B,CAQ7B"}
@@ -7,5 +7,5 @@ export declare function loadFeatures({ config, isRoot, parentIsLocalized, unSani
7
7
  isRoot?: boolean;
8
8
  parentIsLocalized: boolean;
9
9
  unSanitizedEditorConfig: ServerEditorConfig;
10
- }): Promise<ResolvedServerFeatureMap>;
10
+ }): ResolvedServerFeatureMap;
11
11
  //# sourceMappingURL=loader.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"loader.d.ts","sourceRoot":"","sources":["../../../../src/lexical/config/server/loader.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAA;AAE9C,OAAO,KAAK,EACV,qBAAqB,EAErB,wBAAwB,EAEzB,MAAM,kCAAkC,CAAA;AACzC,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAA;AA8FrD,wBAAgB,6BAA6B,CAC3C,gBAAgB,EAAE,qBAAqB,CAAC,OAAO,EAAE,OAAO,EAAE,OAAO,CAAC,EAAE,GACnE,qBAAqB,CAAC,OAAO,EAAE,OAAO,EAAE,OAAO,CAAC,EAAE,CAEpD;AAED,wBAAsB,YAAY,CAAC,EACjC,MAAM,EACN,MAAM,EACN,iBAAiB,EACjB,uBAAuB,GACxB,EAAE;IACD,MAAM,EAAE,eAAe,CAAA;IACvB,MAAM,CAAC,EAAE,OAAO,CAAA;IAChB,iBAAiB,EAAE,OAAO,CAAA;IAC1B,uBAAuB,EAAE,kBAAkB,CAAA;CAC5C,GAAG,OAAO,CAAC,wBAAwB,CAAC,CAyFpC"}
1
+ {"version":3,"file":"loader.d.ts","sourceRoot":"","sources":["../../../../src/lexical/config/server/loader.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAA;AAE9C,OAAO,KAAK,EACV,qBAAqB,EAErB,wBAAwB,EAEzB,MAAM,kCAAkC,CAAA;AACzC,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAA;AA8FrD,wBAAgB,6BAA6B,CAC3C,gBAAgB,EAAE,qBAAqB,CAAC,OAAO,EAAE,OAAO,EAAE,OAAO,CAAC,EAAE,GACnE,qBAAqB,CAAC,OAAO,EAAE,OAAO,EAAE,OAAO,CAAC,EAAE,CAEpD;AAED,wBAAgB,YAAY,CAAC,EAC3B,MAAM,EACN,MAAM,EACN,iBAAiB,EACjB,uBAAuB,GACxB,EAAE;IACD,MAAM,EAAE,eAAe,CAAA;IACvB,MAAM,CAAC,EAAE,OAAO,CAAA;IAChB,iBAAiB,EAAE,OAAO,CAAA;IAC1B,uBAAuB,EAAE,kBAAkB,CAAA;CAC5C,GAAG,wBAAwB,CAyF3B"}
@@ -57,7 +57,7 @@ function visit(graph, key, visited, stack, currentPath = []) {
57
57
  export function sortFeaturesForOptimalLoading(featureProviders) {
58
58
  return topologicallySortFeatures(featureProviders);
59
59
  }
60
- export async function loadFeatures({
60
+ export function loadFeatures({
61
61
  config,
62
62
  isRoot,
63
63
  parentIsLocalized,
@@ -102,7 +102,7 @@ export async function loadFeatures({
102
102
  }
103
103
  }
104
104
  }
105
- const feature = typeof featureProvider.feature === 'function' ? await featureProvider.feature({
105
+ const feature = typeof featureProvider.feature === 'function' ? featureProvider.feature({
106
106
  config,
107
107
  featureProviderMap,
108
108
  isRoot,
@@ -1 +1 @@
1
- {"version":3,"file":"loader.js","names":["createDependencyGraph","featureProviders","graph","fp","key","dependencies","dependenciesPriority","dependenciesSoft","featureProvider","topologicallySortFeatures","visited","stack","visit","reverse","currentPath","Error","includes","join","push","dep","pop","sortFeaturesForOptimalLoading","loadFeatures","config","isRoot","parentIsLocalized","unSanitizedEditorConfig","dedupedByKey","Map","f","features","has","delete","set","Array","from","values","featureProviderMap","map","resolvedFeatures","loaded","length","dependencyKey","priorityDependencyKey","found","get","feature","resolvedFeature","order"],"sources":["../../../../src/lexical/config/server/loader.ts"],"sourcesContent":["import type { SanitizedConfig } from 'payload'\n\nimport type {\n FeatureProviderServer,\n ResolvedServerFeature,\n ResolvedServerFeatureMap,\n ServerFeatureProviderMap,\n} from '../../../features/typesServer.js'\nimport type { ServerEditorConfig } from '../types.js'\n\ntype DependencyGraph = {\n [key: string]: {\n dependencies: string[]\n dependenciesPriority: string[]\n dependenciesSoft: string[]\n featureProvider: FeatureProviderServer<unknown, unknown, unknown>\n }\n}\n\nfunction createDependencyGraph(\n featureProviders: FeatureProviderServer<unknown, unknown, unknown>[],\n): DependencyGraph {\n const graph: DependencyGraph = {}\n for (const fp of featureProviders) {\n graph[fp.key] = {\n dependencies: fp.dependencies || [],\n dependenciesPriority: fp.dependenciesPriority || [],\n dependenciesSoft: fp.dependenciesSoft || [],\n featureProvider: fp,\n }\n }\n return graph\n}\n\nfunction topologicallySortFeatures(\n featureProviders: FeatureProviderServer<unknown, unknown, unknown>[],\n): FeatureProviderServer<unknown, unknown, unknown>[] {\n const graph = createDependencyGraph(featureProviders)\n const visited: { [key: string]: boolean } = {}\n const stack: FeatureProviderServer<unknown, unknown, unknown>[] = []\n\n for (const key in graph) {\n if (!visited[key]) {\n visit(graph, key, visited, stack)\n }\n }\n\n return stack.reverse()\n}\n\nfunction visit(\n graph: DependencyGraph,\n key: string,\n visited: { [key: string]: boolean },\n stack: FeatureProviderServer<unknown, unknown, unknown>[],\n currentPath: string[] = [],\n) {\n if (!graph[key]) {\n throw new Error(`Feature key ${key} is not present in the dependency graph.`)\n }\n\n if (currentPath.includes(key)) {\n throw new Error(`Circular dependency detected: ${currentPath.join(' -> ')} -> ${key}`)\n }\n\n if (visited[key]) {\n return\n }\n\n visited[key] = true\n currentPath.push(key)\n\n // First process the hard priority dependencies\n for (const dep of graph[key].dependenciesPriority) {\n if (!visited[dep]) {\n visit(graph, dep, visited, stack, currentPath)\n }\n }\n\n // Then process the normal dependencies, but make sure to not violate hard dependencies\n for (const dep of graph[key].dependencies) {\n if (!visited[dep] && !graph[key].dependenciesPriority.includes(dep)) {\n visit(graph, dep, visited, stack, currentPath)\n }\n }\n\n // Then process the soft dependencies. Make sure to not violate hard and normal dependencies.\n for (const dep of graph[key].dependenciesSoft) {\n if (\n graph[dep] &&\n !visited[dep] &&\n !graph[key].dependenciesPriority.includes(dep) &&\n !graph[key].dependencies.includes(dep)\n ) {\n visit(graph, dep, visited, stack, currentPath)\n }\n }\n\n stack.push(graph[key].featureProvider)\n currentPath.pop()\n}\n\nexport function sortFeaturesForOptimalLoading(\n featureProviders: FeatureProviderServer<unknown, unknown, unknown>[],\n): FeatureProviderServer<unknown, unknown, unknown>[] {\n return topologicallySortFeatures(featureProviders)\n}\n\nexport async function loadFeatures({\n config,\n isRoot,\n parentIsLocalized,\n unSanitizedEditorConfig,\n}: {\n config: SanitizedConfig\n isRoot?: boolean\n parentIsLocalized: boolean\n unSanitizedEditorConfig: ServerEditorConfig\n}): Promise<ResolvedServerFeatureMap> {\n // First remove all duplicate features. The LAST feature with a given key wins,\n // and keeps the position of its last occurrence (matching the prior reverse/filter/reverse semantics).\n const dedupedByKey = new Map<string, FeatureProviderServer<unknown, unknown, unknown>>()\n for (const f of unSanitizedEditorConfig.features) {\n if (dedupedByKey.has(f.key)) {\n dedupedByKey.delete(f.key)\n }\n dedupedByKey.set(f.key, f)\n }\n unSanitizedEditorConfig.features = Array.from(dedupedByKey.values())\n\n unSanitizedEditorConfig.features = sortFeaturesForOptimalLoading(unSanitizedEditorConfig.features)\n\n const featureProviderMap: ServerFeatureProviderMap = new Map(\n unSanitizedEditorConfig.features.map(\n (f) => [f.key, f] as [string, FeatureProviderServer<unknown, unknown, unknown>],\n ),\n )\n\n const resolvedFeatures: ResolvedServerFeatureMap = new Map()\n\n // Make sure all dependencies declared in the respective features exist\n let loaded = 0\n for (const featureProvider of unSanitizedEditorConfig.features) {\n if (!featureProvider.key) {\n throw new Error(\n `A Feature you've added does not have a key. Please add a key to the feature. This is used to uniquely identify the feature.`,\n )\n }\n if (featureProvider.dependencies?.length) {\n for (const dependencyKey of featureProvider.dependencies) {\n if (!featureProviderMap.has(dependencyKey)) {\n throw new Error(\n `Feature ${featureProvider.key} has a dependency ${dependencyKey} which does not exist.`,\n )\n }\n }\n }\n\n if (featureProvider.dependenciesPriority?.length) {\n for (const priorityDependencyKey of featureProvider.dependenciesPriority) {\n // look in the resolved features instead of the editorConfig.features, as a dependency requires the feature to be loaded before it, contrary to a soft-dependency\n const found = resolvedFeatures.get(priorityDependencyKey)\n if (!found) {\n if (!featureProviderMap.has(priorityDependencyKey)) {\n throw new Error(\n `Feature ${featureProvider.key} has a priority dependency ${priorityDependencyKey} which does not exist.`,\n )\n } else {\n throw new Error(\n `Feature ${featureProvider.key} has a priority dependency ${priorityDependencyKey} which is not loaded before it.`,\n )\n }\n }\n }\n }\n\n const feature =\n typeof featureProvider.feature === 'function'\n ? await featureProvider.feature({\n config,\n featureProviderMap,\n isRoot,\n parentIsLocalized,\n resolvedFeatures,\n unSanitizedEditorConfig,\n })\n : featureProvider.feature\n\n const resolvedFeature: ResolvedServerFeature<any, any> = feature as ResolvedServerFeature<\n any,\n any\n >\n\n // All these new properties would be added to the feature, as it's mutated. However, this does not cause any damage and allows\n // us to prevent an unnecessary spread operation.\n resolvedFeature.key = featureProvider.key\n resolvedFeature.order = loaded\n resolvedFeature.dependencies = featureProvider.dependencies!\n resolvedFeature.dependenciesPriority = featureProvider.dependenciesPriority!\n resolvedFeature.dependenciesSoft = featureProvider.dependenciesSoft!\n\n resolvedFeatures.set(featureProvider.key, resolvedFeature)\n\n loaded++\n }\n\n return resolvedFeatures\n}\n"],"mappings":"AAmBA,SAASA,sBACPC,gBAAoE;EAEpE,MAAMC,KAAA,GAAyB,CAAC;EAChC,KAAK,MAAMC,EAAA,IAAMF,gBAAA,EAAkB;IACjCC,KAAK,CAACC,EAAA,CAAGC,GAAG,CAAC,GAAG;MACdC,YAAA,EAAcF,EAAA,CAAGE,YAAY,IAAI,EAAE;MACnCC,oBAAA,EAAsBH,EAAA,CAAGG,oBAAoB,IAAI,EAAE;MACnDC,gBAAA,EAAkBJ,EAAA,CAAGI,gBAAgB,IAAI,EA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ACF;IAEA,MAAMG,OAAA,GACJ,OAAOtC,eAAA,CAAgBsC,OAAO,KAAK,aAC/B,MAAMtC,eAAA,CAAgBsC,OAAO,CAAC;MAC5BvB,MAAA;MACAc,kBAAA;MACAb,MAAA;MACAC,iBAAA;MACAc,gBAAA;MACAb;IACF,KACAlB,eAAA,CAAgBsC,OAAO;IAE7B,MAAMC,eAAA,GAAmDD,OAAA;IAKzD;IACA;IACAC,eAAA,CAAgB3C,GAAG,GAAGI,eAAA,CAAgBJ,GAAG;IACzC2C,eAAA,CAAgBC,KAAK,GAAGR,MAAA;IACxBO,eAAA,CAAgB1C,YAAY,GAAGG,eAAA,CAAgBH,YAAY;IAC3D0C,eAAA,CAAgBzC,oBAAoB,GAAGE,eAAA,CAAgBF,oBAAoB;IAC3EyC,eAAA,CAAgBxC,gBAAgB,GAAGC,eAAA,CAAgBD,gBAAgB;IAEnEgC,gBAAA,CAAiBN,GAAG,CAACzB,eAAA,CAAgBJ,GAAG,EAAE2C,eAAA;IAE1CP,MAAA;EACF;EAEA,OAAOD,gBAAA;AACT","ignoreList":[]}
1
+ {"version":3,"file":"loader.js","names":["createDependencyGraph","featureProviders","graph","fp","key","dependencies","dependenciesPriority","dependenciesSoft","featureProvider","topologicallySortFeatures","visited","stack","visit","reverse","currentPath","Error","includes","join","push","dep","pop","sortFeaturesForOptimalLoading","loadFeatures","config","isRoot","parentIsLocalized","unSanitizedEditorConfig","dedupedByKey","Map","f","features","has","delete","set","Array","from","values","featureProviderMap","map","resolvedFeatures","loaded","length","dependencyKey","priorityDependencyKey","found","get","feature","resolvedFeature","order"],"sources":["../../../../src/lexical/config/server/loader.ts"],"sourcesContent":["import type { SanitizedConfig } from 'payload'\n\nimport type {\n FeatureProviderServer,\n ResolvedServerFeature,\n ResolvedServerFeatureMap,\n ServerFeatureProviderMap,\n} from '../../../features/typesServer.js'\nimport type { ServerEditorConfig } from '../types.js'\n\ntype DependencyGraph = {\n [key: string]: {\n dependencies: string[]\n dependenciesPriority: string[]\n dependenciesSoft: string[]\n featureProvider: FeatureProviderServer<unknown, unknown, unknown>\n }\n}\n\nfunction createDependencyGraph(\n featureProviders: FeatureProviderServer<unknown, unknown, unknown>[],\n): DependencyGraph {\n const graph: DependencyGraph = {}\n for (const fp of featureProviders) {\n graph[fp.key] = {\n dependencies: fp.dependencies || [],\n dependenciesPriority: fp.dependenciesPriority || [],\n dependenciesSoft: fp.dependenciesSoft || [],\n featureProvider: fp,\n }\n }\n return graph\n}\n\nfunction topologicallySortFeatures(\n featureProviders: FeatureProviderServer<unknown, unknown, unknown>[],\n): FeatureProviderServer<unknown, unknown, unknown>[] {\n const graph = createDependencyGraph(featureProviders)\n const visited: { [key: string]: boolean } = {}\n const stack: FeatureProviderServer<unknown, unknown, unknown>[] = []\n\n for (const key in graph) {\n if (!visited[key]) {\n visit(graph, key, visited, stack)\n }\n }\n\n return stack.reverse()\n}\n\nfunction visit(\n graph: DependencyGraph,\n key: string,\n visited: { [key: string]: boolean },\n stack: FeatureProviderServer<unknown, unknown, unknown>[],\n currentPath: string[] = [],\n) {\n if (!graph[key]) {\n throw new Error(`Feature key ${key} is not present in the dependency graph.`)\n }\n\n if (currentPath.includes(key)) {\n throw new Error(`Circular dependency detected: ${currentPath.join(' -> ')} -> ${key}`)\n }\n\n if (visited[key]) {\n return\n }\n\n visited[key] = true\n currentPath.push(key)\n\n // First process the hard priority dependencies\n for (const dep of graph[key].dependenciesPriority) {\n if (!visited[dep]) {\n visit(graph, dep, visited, stack, currentPath)\n }\n }\n\n // Then process the normal dependencies, but make sure to not violate hard dependencies\n for (const dep of graph[key].dependencies) {\n if (!visited[dep] && !graph[key].dependenciesPriority.includes(dep)) {\n visit(graph, dep, visited, stack, currentPath)\n }\n }\n\n // Then process the soft dependencies. Make sure to not violate hard and normal dependencies.\n for (const dep of graph[key].dependenciesSoft) {\n if (\n graph[dep] &&\n !visited[dep] &&\n !graph[key].dependenciesPriority.includes(dep) &&\n !graph[key].dependencies.includes(dep)\n ) {\n visit(graph, dep, visited, stack, currentPath)\n }\n }\n\n stack.push(graph[key].featureProvider)\n currentPath.pop()\n}\n\nexport function sortFeaturesForOptimalLoading(\n featureProviders: FeatureProviderServer<unknown, unknown, unknown>[],\n): FeatureProviderServer<unknown, unknown, unknown>[] {\n return topologicallySortFeatures(featureProviders)\n}\n\nexport function loadFeatures({\n config,\n isRoot,\n parentIsLocalized,\n unSanitizedEditorConfig,\n}: {\n config: SanitizedConfig\n isRoot?: boolean\n parentIsLocalized: boolean\n unSanitizedEditorConfig: ServerEditorConfig\n}): ResolvedServerFeatureMap {\n // First remove all duplicate features. The LAST feature with a given key wins,\n // and keeps the position of its last occurrence (matching the prior reverse/filter/reverse semantics).\n const dedupedByKey = new Map<string, FeatureProviderServer<unknown, unknown, unknown>>()\n for (const f of unSanitizedEditorConfig.features) {\n if (dedupedByKey.has(f.key)) {\n dedupedByKey.delete(f.key)\n }\n dedupedByKey.set(f.key, f)\n }\n unSanitizedEditorConfig.features = Array.from(dedupedByKey.values())\n\n unSanitizedEditorConfig.features = sortFeaturesForOptimalLoading(unSanitizedEditorConfig.features)\n\n const featureProviderMap: ServerFeatureProviderMap = new Map(\n unSanitizedEditorConfig.features.map(\n (f) => [f.key, f] as [string, FeatureProviderServer<unknown, unknown, unknown>],\n ),\n )\n\n const resolvedFeatures: ResolvedServerFeatureMap = new Map()\n\n // Make sure all dependencies declared in the respective features exist\n let loaded = 0\n for (const featureProvider of unSanitizedEditorConfig.features) {\n if (!featureProvider.key) {\n throw new Error(\n `A Feature you've added does not have a key. Please add a key to the feature. This is used to uniquely identify the feature.`,\n )\n }\n if (featureProvider.dependencies?.length) {\n for (const dependencyKey of featureProvider.dependencies) {\n if (!featureProviderMap.has(dependencyKey)) {\n throw new Error(\n `Feature ${featureProvider.key} has a dependency ${dependencyKey} which does not exist.`,\n )\n }\n }\n }\n\n if (featureProvider.dependenciesPriority?.length) {\n for (const priorityDependencyKey of featureProvider.dependenciesPriority) {\n // look in the resolved features instead of the editorConfig.features, as a dependency requires the feature to be loaded before it, contrary to a soft-dependency\n const found = resolvedFeatures.get(priorityDependencyKey)\n if (!found) {\n if (!featureProviderMap.has(priorityDependencyKey)) {\n throw new Error(\n `Feature ${featureProvider.key} has a priority dependency ${priorityDependencyKey} which does not exist.`,\n )\n } else {\n throw new Error(\n `Feature ${featureProvider.key} has a priority dependency ${priorityDependencyKey} which is not loaded before it.`,\n )\n }\n }\n }\n }\n\n const feature =\n typeof featureProvider.feature === 'function'\n ? featureProvider.feature({\n config,\n featureProviderMap,\n isRoot,\n parentIsLocalized,\n resolvedFeatures,\n unSanitizedEditorConfig,\n })\n : featureProvider.feature\n\n const resolvedFeature: ResolvedServerFeature<any, any> = feature as ResolvedServerFeature<\n any,\n any\n >\n\n // All these new properties would be added to the feature, as it's mutated. However, this does not cause any damage and allows\n // us to prevent an unnecessary spread operation.\n resolvedFeature.key = featureProvider.key\n resolvedFeature.order = loaded\n resolvedFeature.dependencies = featureProvider.dependencies!\n resolvedFeature.dependenciesPriority = featureProvider.dependenciesPriority!\n resolvedFeature.dependenciesSoft = featureProvider.dependenciesSoft!\n\n resolvedFeatures.set(featureProvider.key, resolvedFeature)\n\n loaded++\n }\n\n return resolvedFeatures\n}\n"],"mappings":"AAmBA,SAASA,sBACPC,gBAAoE;EAEpE,MAAMC,KAAA,GAAyB,CAAC;EAChC,KAAK,MAAMC,EAAA,IAAMF,gBAAA,EAAkB;IACjCC,KAAK,CAACC,EAAA,CAAGC,GAAG,CAAC,GAAG;MACdC,YAAA,EAAcF,EAAA,CAAGE,YAAY,IAAI,EAAE;MACnCC,oBAAA,EAAsBH,EAAA,CAAGG,oBAAoB,IAAI,EAAE;MACnDC,gBAAA,EAAkBJ,EAAA,CAAGI,gBAAgB,IAAI,EAAE;MAC3CC,eAAA,EAAiBL;IACnB;EACF;EACA,OAAOD,KAAA;AACT;AAEA,SAASO,0BACPR,gBAAoE;EAEpE,MAAMC,KAAA,GAAQF,qBAAA,CAAsBC,gBAAA;EAC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;MACAC,iBAAA;MACAc,gBAAA;MACAb;IACF,KACAlB,eAAA,CAAgBsC,OAAO;IAE7B,MAAMC,eAAA,GAAmDD,OAAA;IAKzD;IACA;IACAC,eAAA,CAAgB3C,GAAG,GAAGI,eAAA,CAAgBJ,GAAG;IACzC2C,eAAA,CAAgBC,KAAK,GAAGR,MAAA;IACxBO,eAAA,CAAgB1C,YAAY,GAAGG,eAAA,CAAgBH,YAAY;IAC3D0C,eAAA,CAAgBzC,oBAAoB,GAAGE,eAAA,CAAgBF,oBAAoB;IAC3EyC,eAAA,CAAgBxC,gBAAgB,GAAGC,eAAA,CAAgBD,gBAAgB;IAEnEgC,gBAAA,CAAiBN,GAAG,CAACzB,eAAA,CAAgBJ,GAAG,EAAE2C,eAAA;IAE1CP,MAAA;EACF;EAEA,OAAOD,gBAAA;AACT","ignoreList":[]}
@@ -2,5 +2,5 @@ import type { SanitizedConfig } from 'payload';
2
2
  import type { ResolvedServerFeatureMap, SanitizedServerFeatures } from '../../../features/typesServer.js';
3
3
  import type { SanitizedServerEditorConfig, ServerEditorConfig } from '../types.js';
4
4
  export declare const sanitizeServerFeatures: (features: ResolvedServerFeatureMap) => SanitizedServerFeatures;
5
- export declare function sanitizeServerEditorConfig(editorConfig: ServerEditorConfig, config: SanitizedConfig, parentIsLocalized?: boolean): Promise<SanitizedServerEditorConfig>;
5
+ export declare function sanitizeServerEditorConfig(editorConfig: ServerEditorConfig, config: SanitizedConfig, parentIsLocalized?: boolean): SanitizedServerEditorConfig;
6
6
  //# sourceMappingURL=sanitize.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"sanitize.d.ts","sourceRoot":"","sources":["../../../../src/lexical/config/server/sanitize.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAA;AAE9C,OAAO,KAAK,EACV,wBAAwB,EACxB,uBAAuB,EACxB,MAAM,kCAAkC,CAAA;AACzC,OAAO,KAAK,EAAE,2BAA2B,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAA;AAIlF,eAAO,MAAM,sBAAsB,GACjC,UAAU,wBAAwB,KACjC,uBA0HF,CAAA;AAED,wBAAsB,0BAA0B,CAC9C,YAAY,EAAE,kBAAkB,EAChC,MAAM,EAAE,eAAe,EACvB,iBAAiB,CAAC,EAAE,OAAO,GAC1B,OAAO,CAAC,2BAA2B,CAAC,CAYtC"}
1
+ {"version":3,"file":"sanitize.d.ts","sourceRoot":"","sources":["../../../../src/lexical/config/server/sanitize.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAA;AAE9C,OAAO,KAAK,EACV,wBAAwB,EACxB,uBAAuB,EACxB,MAAM,kCAAkC,CAAA;AACzC,OAAO,KAAK,EAAE,2BAA2B,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAA;AAIlF,eAAO,MAAM,sBAAsB,aACvB,wBAAwB,KACjC,uBA0HF,CAAA;AAED,wBAAgB,0BAA0B,CACxC,YAAY,EAAE,kBAAkB,EAChC,MAAM,EAAE,eAAe,EACvB,iBAAiB,CAAC,EAAE,OAAO,GAC1B,2BAA2B,CAY7B"}
@@ -104,8 +104,8 @@ export const sanitizeServerFeatures = features => {
104
104
  });
105
105
  return sanitized;
106
106
  };
107
- export async function sanitizeServerEditorConfig(editorConfig, config, parentIsLocalized) {
108
- const resolvedFeatureMap = await loadFeatures({
107
+ export function sanitizeServerEditorConfig(editorConfig, config, parentIsLocalized) {
108
+ const resolvedFeatureMap = loadFeatures({
109
109
  config,
110
110
  parentIsLocalized: parentIsLocalized,
111
111
  unSanitizedEditorConfig: editorConfig
@@ -1 +1 @@
1
- {"version":3,"file":"sanitize.js","names":["loadFeatures","sanitizeServerFeatures","features","sanitized","enabledFeatures","getSubFields","Map","getSubFieldsData","graphQLPopulationPromises","hooks","afterChange","afterRead","beforeChange","beforeValidate","i18n","markdownTransformers","nodeHooks","nodes","validations","size","forEach","feature","length","concat","lang","lexical","key","node","nodeType","replace","getType","alreadyRegistered","some","existing","existingType","Error","push","set","transformer","allNodes","allTransformers","sanitizeServerEditorConfig","editorConfig","config","parentIsLocalized","resolvedFeatureMap","unSanitizedEditorConfig"],"sources":["../../../../src/lexical/config/server/sanitize.ts"],"sourcesContent":["import type { SanitizedConfig } from 'payload'\n\nimport type {\n ResolvedServerFeatureMap,\n SanitizedServerFeatures,\n} from '../../../features/typesServer.js'\nimport type { SanitizedServerEditorConfig, ServerEditorConfig } from '../types.js'\n\nimport { loadFeatures } from './loader.js'\n\nexport const sanitizeServerFeatures = (\n features: ResolvedServerFeatureMap,\n): SanitizedServerFeatures => {\n const sanitized: SanitizedServerFeatures = {\n enabledFeatures: [],\n getSubFields: new Map(),\n getSubFieldsData: new Map(),\n graphQLPopulationPromises: new Map(),\n hooks: {\n afterChange: [],\n afterRead: [],\n beforeChange: [],\n beforeValidate: [],\n },\n i18n: {},\n markdownTransformers: [],\n nodeHooks: {\n afterChange: new Map(),\n afterRead: new Map(),\n beforeChange: new Map(),\n beforeValidate: new Map(),\n },\n nodes: [],\n\n validations: new Map(),\n }\n\n if (!features?.size) {\n return sanitized\n }\n\n features.forEach((feature) => {\n if (feature?.hooks?.beforeValidate?.length) {\n sanitized.hooks.beforeValidate = sanitized.hooks.beforeValidate?.concat(\n feature.hooks.beforeValidate,\n )\n }\n if (feature?.hooks?.beforeChange?.length) {\n sanitized.hooks.beforeChange = sanitized.hooks.beforeChange?.concat(\n feature.hooks.beforeChange,\n )\n }\n if (feature?.hooks?.afterRead?.length) {\n sanitized.hooks.afterRead = sanitized.hooks.afterRead?.concat(feature.hooks.afterRead)\n }\n if (feature?.hooks?.afterChange?.length) {\n sanitized.hooks.afterChange = sanitized.hooks.afterChange?.concat(feature.hooks.afterChange)\n }\n\n if (feature?.i18n) {\n for (const lang in feature.i18n) {\n if (!sanitized.i18n[lang as keyof typeof sanitized.i18n]) {\n sanitized.i18n[lang as keyof typeof sanitized.i18n] = {\n lexical: {},\n }\n }\n // @ts-expect-error - vestiges of when tsconfig was not strict. Feel free to improve\n sanitized.i18n[lang].lexical[feature.key] = feature.i18n[lang]\n }\n }\n\n if (feature.nodes?.length) {\n // Do not concat here. We need to keep the object reference of sanitized.nodes so that function markdown transformers of features automatically get the updated nodes\n for (const node of feature.nodes) {\n const nodeType = 'with' in node.node ? node.node.replace.getType() : node.node.getType()\n const alreadyRegistered = sanitized.nodes.some((existing) => {\n const existingType =\n 'with' in existing.node ? existing.node.replace.getType() : existing.node.getType()\n return existingType === nodeType\n })\n if (alreadyRegistered) {\n throw new Error(\n `Lexical editor config: node type \"${nodeType}\" was registered more than once (feature \"${feature.key}\"). Each lexical node type may only be registered by a single feature.`,\n )\n }\n sanitized.nodes.push(node)\n if (node?.graphQLPopulationPromises?.length) {\n sanitized.graphQLPopulationPromises.set(nodeType, node.graphQLPopulationPromises)\n }\n if (node?.validations?.length) {\n sanitized.validations.set(nodeType, node.validations)\n }\n if (node?.hooks?.afterChange) {\n sanitized.nodeHooks?.afterChange?.set(nodeType, node.hooks.afterChange)\n }\n if (node?.hooks?.afterRead) {\n sanitized.nodeHooks?.afterRead?.set(nodeType, node.hooks.afterRead)\n }\n if (node?.hooks?.beforeChange) {\n sanitized.nodeHooks?.beforeChange?.set(nodeType, node.hooks.beforeChange)\n }\n if (node?.hooks?.beforeValidate) {\n sanitized.nodeHooks?.beforeValidate?.set(nodeType, node.hooks.beforeValidate)\n }\n if (node?.getSubFields) {\n sanitized.getSubFields?.set(nodeType, node.getSubFields)\n }\n if (node?.getSubFieldsData) {\n sanitized.getSubFieldsData?.set(nodeType, node.getSubFieldsData)\n }\n }\n }\n\n if (feature.markdownTransformers?.length) {\n // Do not concat here. We need to keep the object reference of feature.markdownTransformers\n\n for (const transformer of feature.markdownTransformers) {\n if (typeof transformer === 'function') {\n sanitized.markdownTransformers.push(\n transformer({\n allNodes: sanitized.nodes,\n allTransformers: sanitized.markdownTransformers,\n }),\n )\n } else {\n sanitized.markdownTransformers.push(transformer)\n }\n }\n }\n\n sanitized.enabledFeatures.push(feature.key)\n })\n\n return sanitized\n}\n\nexport async function sanitizeServerEditorConfig(\n editorConfig: ServerEditorConfig,\n config: SanitizedConfig,\n parentIsLocalized?: boolean,\n): Promise<SanitizedServerEditorConfig> {\n const resolvedFeatureMap = await loadFeatures({\n config,\n parentIsLocalized: parentIsLocalized!,\n unSanitizedEditorConfig: editorConfig,\n })\n\n return {\n features: sanitizeServerFeatures(resolvedFeatureMap),\n lexical: editorConfig.lexical!,\n resolvedFeatureMap,\n }\n}\n"],"mappings":"AAQA,SAASA,YAAY,QAAQ;AAE7B,OAAO,MAAMC,sBAAA,GACXC,QAAA;EAEA,MAAMC,SAAA,GAAqC;IACzCC,eAAA,EAAiB,EAAE;IACnBC,YAAA,EAAc,IAAIC,GAAA;IAClBC,gBAAA,EAAkB,IAAID,GAAA;IACtBE,yBAAA,EAA2B,IAAIF,GAAA;IAC/BG,KAAA,EAAO;MACLC,WAAA,EAAa,EAAE;MACfC,SAAA,EAAW,EAAE;MACbC,YAAA,EAAc,EAAE;MAChBC,cAAA,EAAgB;IAClB;IACAC,IAAA,EAAM,CAAC;IACPC,oBAAA,EAAsB,EAAE;IACxBC,SAAA,EAAW;MACTN,WAAA,EAAa,IAAIJ,GAAA;MACjBK,SAAA,EAAW,IAAIL,GAAA;MACfM,YAAA,EAAc,IAAIN,GAAA;MAClBO,cAAA,EAAgB,IAAIP,GAAA;IACtB;IACAW,KAAA,EAAO,EAAE;IAETC,WAAA,EAAa,IAAIZ,GAAA;EACnB;EAEA,IAAI,CAACJ,QAAA,EAAUiB,IAAA,EAAM;IACnB,OAAOhB,SAAA;EACT;EAEAD,QAAA,CAASkB,OAAO,CAAEC,OAAA;IAChB,IAAIA,OAAA,EAASZ,KAAA,EAAOI,cAAA,EAAgBS,MAAA,EAAQ;MAC1CnB,SAAA,CAAUM,KAAK,CAACI,cAAc,GAAGV,SAAA,CAAUM,KAAK,CAACI,cAAc,EAAEU,MAAA,CAC/DF,OAAA,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ACjCpB,OAAA,EAASiB,YAAA,CAAajB,OAAO;IAC7BoB;EACF;AACF","ignoreList":[]}
1
+ {"version":3,"file":"sanitize.js","names":["loadFeatures","sanitizeServerFeatures","features","sanitized","enabledFeatures","getSubFields","Map","getSubFieldsData","graphQLPopulationPromises","hooks","afterChange","afterRead","beforeChange","beforeValidate","i18n","markdownTransformers","nodeHooks","nodes","validations","size","forEach","feature","length","concat","lang","lexical","key","node","nodeType","replace","getType","alreadyRegistered","some","existing","existingType","Error","push","set","transformer","allNodes","allTransformers","sanitizeServerEditorConfig","editorConfig","config","parentIsLocalized","resolvedFeatureMap","unSanitizedEditorConfig"],"sources":["../../../../src/lexical/config/server/sanitize.ts"],"sourcesContent":["import type { SanitizedConfig } from 'payload'\n\nimport type {\n ResolvedServerFeatureMap,\n SanitizedServerFeatures,\n} from '../../../features/typesServer.js'\nimport type { SanitizedServerEditorConfig, ServerEditorConfig } from '../types.js'\n\nimport { loadFeatures } from './loader.js'\n\nexport const sanitizeServerFeatures = (\n features: ResolvedServerFeatureMap,\n): SanitizedServerFeatures => {\n const sanitized: SanitizedServerFeatures = {\n enabledFeatures: [],\n getSubFields: new Map(),\n getSubFieldsData: new Map(),\n graphQLPopulationPromises: new Map(),\n hooks: {\n afterChange: [],\n afterRead: [],\n beforeChange: [],\n beforeValidate: [],\n },\n i18n: {},\n markdownTransformers: [],\n nodeHooks: {\n afterChange: new Map(),\n afterRead: new Map(),\n beforeChange: new Map(),\n beforeValidate: new Map(),\n },\n nodes: [],\n\n validations: new Map(),\n }\n\n if (!features?.size) {\n return sanitized\n }\n\n features.forEach((feature) => {\n if (feature?.hooks?.beforeValidate?.length) {\n sanitized.hooks.beforeValidate = sanitized.hooks.beforeValidate?.concat(\n feature.hooks.beforeValidate,\n )\n }\n if (feature?.hooks?.beforeChange?.length) {\n sanitized.hooks.beforeChange = sanitized.hooks.beforeChange?.concat(\n feature.hooks.beforeChange,\n )\n }\n if (feature?.hooks?.afterRead?.length) {\n sanitized.hooks.afterRead = sanitized.hooks.afterRead?.concat(feature.hooks.afterRead)\n }\n if (feature?.hooks?.afterChange?.length) {\n sanitized.hooks.afterChange = sanitized.hooks.afterChange?.concat(feature.hooks.afterChange)\n }\n\n if (feature?.i18n) {\n for (const lang in feature.i18n) {\n if (!sanitized.i18n[lang as keyof typeof sanitized.i18n]) {\n sanitized.i18n[lang as keyof typeof sanitized.i18n] = {\n lexical: {},\n }\n }\n // @ts-expect-error - vestiges of when tsconfig was not strict. Feel free to improve\n sanitized.i18n[lang].lexical[feature.key] = feature.i18n[lang]\n }\n }\n\n if (feature.nodes?.length) {\n // Do not concat here. We need to keep the object reference of sanitized.nodes so that function markdown transformers of features automatically get the updated nodes\n for (const node of feature.nodes) {\n const nodeType = 'with' in node.node ? node.node.replace.getType() : node.node.getType()\n const alreadyRegistered = sanitized.nodes.some((existing) => {\n const existingType =\n 'with' in existing.node ? existing.node.replace.getType() : existing.node.getType()\n return existingType === nodeType\n })\n if (alreadyRegistered) {\n throw new Error(\n `Lexical editor config: node type \"${nodeType}\" was registered more than once (feature \"${feature.key}\"). Each lexical node type may only be registered by a single feature.`,\n )\n }\n sanitized.nodes.push(node)\n if (node?.graphQLPopulationPromises?.length) {\n sanitized.graphQLPopulationPromises.set(nodeType, node.graphQLPopulationPromises)\n }\n if (node?.validations?.length) {\n sanitized.validations.set(nodeType, node.validations)\n }\n if (node?.hooks?.afterChange) {\n sanitized.nodeHooks?.afterChange?.set(nodeType, node.hooks.afterChange)\n }\n if (node?.hooks?.afterRead) {\n sanitized.nodeHooks?.afterRead?.set(nodeType, node.hooks.afterRead)\n }\n if (node?.hooks?.beforeChange) {\n sanitized.nodeHooks?.beforeChange?.set(nodeType, node.hooks.beforeChange)\n }\n if (node?.hooks?.beforeValidate) {\n sanitized.nodeHooks?.beforeValidate?.set(nodeType, node.hooks.beforeValidate)\n }\n if (node?.getSubFields) {\n sanitized.getSubFields?.set(nodeType, node.getSubFields)\n }\n if (node?.getSubFieldsData) {\n sanitized.getSubFieldsData?.set(nodeType, node.getSubFieldsData)\n }\n }\n }\n\n if (feature.markdownTransformers?.length) {\n // Do not concat here. We need to keep the object reference of feature.markdownTransformers\n\n for (const transformer of feature.markdownTransformers) {\n if (typeof transformer === 'function') {\n sanitized.markdownTransformers.push(\n transformer({\n allNodes: sanitized.nodes,\n allTransformers: sanitized.markdownTransformers,\n }),\n )\n } else {\n sanitized.markdownTransformers.push(transformer)\n }\n }\n }\n\n sanitized.enabledFeatures.push(feature.key)\n })\n\n return sanitized\n}\n\nexport function sanitizeServerEditorConfig(\n editorConfig: ServerEditorConfig,\n config: SanitizedConfig,\n parentIsLocalized?: boolean,\n): SanitizedServerEditorConfig {\n const resolvedFeatureMap = loadFeatures({\n config,\n parentIsLocalized: parentIsLocalized!,\n unSanitizedEditorConfig: editorConfig,\n })\n\n return {\n features: sanitizeServerFeatures(resolvedFeatureMap),\n lexical: editorConfig.lexical!,\n resolvedFeatureMap,\n }\n}\n"],"mappings":"AAQA,SAASA,YAAY,QAAQ;AAE7B,OAAO,MAAMC,sBAAA,GACXC,QAAA;EAEA,MAAMC,SAAA,GAAqC;IACzCC,eAAA,EAAiB,EAAE;IACnBC,YAAA,EAAc,IAAIC,GAAA;IAClBC,gBAAA,EAAkB,IAAID,GAAA;IACtBE,yBAAA,EAA2B,IAAIF,GAAA;IAC/BG,KAAA,EAAO;MACLC,WAAA,EAAa,EAAE;MACfC,SAAA,EAAW,EAAE;MACbC,YAAA,EAAc,EAAE;MAChBC,cAAA,EAAgB;IAClB;IACAC,IAAA,EAAM,CAAC;IACPC,oBAAA,EAAsB,EAAE;IACxBC,SAAA,EAAW;MACTN,WAAA,EAAa,IAAIJ,GAAA;MACjBK,SAAA,EAAW,IAAIL,GAAA;MACfM,YAAA,EAAc,IAAIN,GAAA;MAClBO,cAAA,EAAgB,IAAIP,GAAA;IACtB;IACAW,KAAA,EAAO,EAAE;IAETC,WAAA,EAAa,IAAIZ,GAAA;EACnB;EAEA,IAAI,CAACJ,Q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AOvB,SAAA;AACT;AAEA,OAAO,SAASsC,2BACdC,YAAgC,EAChCC,MAAuB,EACvBC,iBAA2B;EAE3B,MAAMC,kBAAA,GAAqB7C,YAAA,CAAa;IACtC2C,MAAA;IACAC,iBAAA,EAAmBA,iBAAA;IACnBE,uBAAA,EAAyBJ;EAC3B;EAEA,OAAO;IACLxC,QAAA,EAAUD,sBAAA,CAAuB4C,kBAAA;IACjCpB,OAAA,EAASiB,YAAA,CAAajB,OAAO;IAC7BoB;EACF;AACF","ignoreList":[]}
@@ -5,7 +5,7 @@
5
5
  }
6
6
 
7
7
  .decorator-selected {
8
- box-shadow: 0 0 0 2px var(--color-border-selected) !important;
8
+ box-shadow: 0 0 0 var(--stroke-width-medium) var(--color-border-selected) !important;
9
9
  outline: none !important;
10
10
  }
11
11
  }
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/lexical/plugins/DecoratorPlugin/index.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,SAAS,CAAA;AA2BtE,OAAO,aAAa,CAAA;AAIpB,wBAAgB,eAAe,SA6K9B;AAiDD;;;;;;;;;GASG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,WAAW,GAAG,IAAI,IAAI,aAAa,CAAC,OAAO,CAAC,GAAG,WAAW,CAgBjG"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/lexical/plugins/DecoratorPlugin/index.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,SAAS,CAAA;AA4BtE,OAAO,aAAa,CAAA;AAIpB,wBAAgB,eAAe,SAuL9B;AA4CD;;;;;;;;;GASG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,WAAW,GAAG,IAAI,IAAI,aAAa,CAAC,OAAO,CAAC,GAAG,WAAW,CAgBjG"}
@@ -3,7 +3,7 @@
3
3
  import { c as _c } from "react/compiler-runtime";
4
4
  import { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext';
5
5
  import { $findMatchingParent, mergeRegister } from '@lexical/utils';
6
- import { $createNodeSelection, $getEditor, $getNearestNodeFromDOMNode, $getSelection, $isDecoratorNode, $isElementNode, $isLineBreakNode, $isNodeSelection, $isRangeSelection, $isRootOrShadowRoot, $isTextNode, $setSelection, CLICK_COMMAND, COMMAND_PRIORITY_LOW, KEY_ARROW_DOWN_COMMAND, KEY_ARROW_UP_COMMAND, KEY_BACKSPACE_COMMAND, KEY_DELETE_COMMAND, SELECTION_CHANGE_COMMAND } from 'lexical';
6
+ import { $createNodeSelection, $getEditor, $getNearestNodeFromDOMNode, $getSelection, $isDecoratorNode, $isElementNode, $isLineBreakNode, $isNodeSelection, $isRangeSelection, $isRootOrShadowRoot, $isTextNode, $onUpdate, $setSelection, CLICK_COMMAND, COMMAND_PRIORITY_LOW, KEY_ARROW_DOWN_COMMAND, KEY_ARROW_UP_COMMAND, KEY_BACKSPACE_COMMAND, KEY_DELETE_COMMAND, SELECTION_CHANGE_COMMAND } from 'lexical';
7
7
  import { useEffect } from 'react';
8
8
  import './index.css';
9
9
  // TODO: This should ideally be fixed in Lexical. See
@@ -15,7 +15,22 @@ export function DecoratorPlugin() {
15
15
  let t0;
16
16
  let t1;
17
17
  if ($[0] !== editor) {
18
- t0 = () => mergeRegister(editor.registerCommand(CLICK_COMMAND, _temp3, COMMAND_PRIORITY_LOW), editor.registerCommand(KEY_DELETE_COMMAND, $onDelete, COMMAND_PRIORITY_LOW), editor.registerCommand(KEY_BACKSPACE_COMMAND, $onDelete, COMMAND_PRIORITY_LOW), editor.registerCommand(SELECTION_CHANGE_COMMAND, _temp4, COMMAND_PRIORITY_LOW), editor.registerCommand(KEY_ARROW_UP_COMMAND, _temp6, COMMAND_PRIORITY_LOW), editor.registerCommand(KEY_ARROW_DOWN_COMMAND, _temp8, COMMAND_PRIORITY_LOW));
18
+ t0 = () => mergeRegister(editor.registerCommand(CLICK_COMMAND, _temp3, COMMAND_PRIORITY_LOW), editor.registerCommand(KEY_DELETE_COMMAND, $onDelete, COMMAND_PRIORITY_LOW), editor.registerCommand(KEY_BACKSPACE_COMMAND, $onDelete, COMMAND_PRIORITY_LOW), editor.registerCommand(SELECTION_CHANGE_COMMAND, (_, activeEditor) => {
19
+ if (activeEditor !== editor) {
20
+ return false;
21
+ }
22
+ const hasSelectedDecorator = Boolean($getSelectedDecorator());
23
+ $onUpdate(() => {
24
+ activeEditor.read("latest", () => {
25
+ const decorator_0 = $getSelectedDecorator();
26
+ document.querySelector(".decorator-selected")?.classList.remove("decorator-selected");
27
+ if (decorator_0) {
28
+ activeEditor.getElementByKey(decorator_0.getKey())?.classList.add("decorator-selected");
29
+ }
30
+ });
31
+ });
32
+ return hasSelectedDecorator;
33
+ }, COMMAND_PRIORITY_LOW), editor.registerCommand(KEY_ARROW_UP_COMMAND, _temp5, COMMAND_PRIORITY_LOW), editor.registerCommand(KEY_ARROW_DOWN_COMMAND, _temp7, COMMAND_PRIORITY_LOW));
19
34
  t1 = [editor];
20
35
  $[0] = editor;
21
36
  $[1] = t0;
@@ -27,7 +42,7 @@ export function DecoratorPlugin() {
27
42
  useEffect(t0, t1);
28
43
  return null;
29
44
  }
30
- function _temp8(event_2) {
45
+ function _temp7(event_2) {
31
46
  const selection_1 = $getSelection();
32
47
  if ($isNodeSelection(selection_1)) {
33
48
  event_2.preventDefault();
@@ -59,7 +74,7 @@ function _temp8(event_2) {
59
74
  }
60
75
  const lastPoint = selection_1.isBackward() ? selection_1.anchor : selection_1.focus;
61
76
  const lastNode = lastPoint.getNode();
62
- const lastSelectedBlock = $findMatchingParent(lastNode, _temp7);
77
+ const lastSelectedBlock = $findMatchingParent(lastNode, _temp6);
63
78
  const nextBlock = lastSelectedBlock?.getNextSibling();
64
79
  if (!lastSelectedBlock || nextBlock !== findLaterSiblingBlock(lastSelectedBlock)) {
65
80
  return false;
@@ -77,10 +92,10 @@ function _temp8(event_2) {
77
92
  }
78
93
  return false;
79
94
  }
80
- function _temp7(node_1) {
95
+ function _temp6(node_1) {
81
96
  return findLaterSiblingBlock(node_1) !== null;
82
97
  }
83
- function _temp6(event_1) {
98
+ function _temp5(event_1) {
84
99
  const selection_0 = $getSelection();
85
100
  if ($isNodeSelection(selection_0)) {
86
101
  const prevSibling = selection_0.getNodes()[0]?.getPreviousSibling();
@@ -113,7 +128,7 @@ function _temp6(event_1) {
113
128
  }
114
129
  const firstPoint = selection_0.isBackward() ? selection_0.anchor : selection_0.focus;
115
130
  const firstNode = firstPoint.getNode();
116
- const firstSelectedBlock = $findMatchingParent(firstNode, _temp5);
131
+ const firstSelectedBlock = $findMatchingParent(firstNode, _temp4);
117
132
  const prevBlock = firstSelectedBlock?.getPreviousSibling();
118
133
  if (!firstSelectedBlock || prevBlock !== findFirstSiblingBlock(firstSelectedBlock)) {
119
134
  return false;
@@ -131,18 +146,9 @@ function _temp6(event_1) {
131
146
  }
132
147
  return false;
133
148
  }
134
- function _temp5(node_0) {
149
+ function _temp4(node_0) {
135
150
  return findFirstSiblingBlock(node_0) !== null;
136
151
  }
137
- function _temp4() {
138
- const decorator_0 = $getSelectedDecorator();
139
- document.querySelector(".decorator-selected")?.classList.remove("decorator-selected");
140
- if (decorator_0) {
141
- decorator_0.element?.classList.add("decorator-selected");
142
- return true;
143
- }
144
- return false;
145
- }
146
152
  function _temp3(event_0) {
147
153
  document.querySelector(".decorator-selected")?.classList.remove("decorator-selected");
148
154
  const decorator = $getDecoratorByMouseEvent(event_0);
@@ -196,10 +202,7 @@ function $getSelectedDecorator() {
196
202
  return undefined;
197
203
  }
198
204
  const node = nodes[0];
199
- return $isDecoratorNode(node) ? {
200
- decorator: node,
201
- element: $getEditor().getElementByKey(node.getKey())
202
- } : undefined;
205
+ return $isDecoratorNode(node) ? node : undefined;
203
206
  }
204
207
  function $selectDecorator({
205
208
  element,
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["c","_c","useLexicalComposerContext","$findMatchingParent","mergeRegister","$createNodeSelection","$getEditor","$getNearestNodeFromDOMNode","$getSelection","$isDecoratorNode","$isElementNode","$isLineBreakNode","$isNodeSelection","$isRangeSelection","$isRootOrShadowRoot","$isTextNode","$setSelection","CLICK_COMMAND","COMMAND_PRIORITY_LOW","KEY_ARROW_DOWN_COMMAND","KEY_ARROW_UP_COMMAND","KEY_BACKSPACE_COMMAND","KEY_DELETE_COMMAND","SELECTION_CHANGE_COMMAND","useEffect","DecoratorPlugin","$","editor","$onDelete","_temp2","t0","t1","registerCommand","_temp3","_temp4","_temp6","_temp8","event_2","selection_1","selection","event","preventDefault","nextSibling","getNodes","getNextSibling","element_0","getElementByKey","getKey","element","$selectDecorator","firstDescendant","getFirstDescendant","block_0","INTERNAL_$isBlock","block","selectEnd","lastPoint","isBackward","anchor","focus","lastNode","getNode","lastSelectedBlock","_temp7","nextBlock","findLaterSiblingBlock","nextBlockElement","node","node_1","event_1","selection_0","prevSibling","getPreviousSibling","lastDescendant","getLastDescendant","selectStart","firstPoint","firstNode","firstSelectedBlock","_temp5","prevBlock","findFirstSiblingBlock","prevBlockElement","node_0","decorator_0","$getSelectedDecorator","document","querySelector","classList","remove","decorator","add","event_0","$getDecoratorByMouseEvent","target","isInteractive","HTMLElement","isContentEditable","closest","forEach","_temp","undefined","nodes","length","scrollIntoView","behavior","isInline","firstChild","getFirstChild","isLeafElement","canBeEmpty","current"],"sources":["../../../../src/lexical/plugins/DecoratorPlugin/index.tsx"],"sourcesContent":["'use client'\n\nimport type { DecoratorNode, ElementNode, LexicalNode } from 'lexical'\n\nimport { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext'\nimport { $findMatchingParent, mergeRegister } from '@lexical/utils'\nimport {\n $createNodeSelection,\n $getEditor,\n $getNearestNodeFromDOMNode,\n $getSelection,\n $isDecoratorNode,\n $isElementNode,\n $isLineBreakNode,\n $isNodeSelection,\n $isRangeSelection,\n $isRootOrShadowRoot,\n $isTextNode,\n $setSelection,\n CLICK_COMMAND,\n COMMAND_PRIORITY_LOW,\n KEY_ARROW_DOWN_COMMAND,\n KEY_ARROW_UP_COMMAND,\n KEY_BACKSPACE_COMMAND,\n KEY_DELETE_COMMAND,\n SELECTION_CHANGE_COMMAND,\n} from 'lexical'\nimport { useEffect } from 'react'\n\nimport './index.css'\n\n// TODO: This should ideally be fixed in Lexical. See\n// https://github.com/facebook/lexical/pull/7072\nexport function DecoratorPlugin() {\n const [editor] = useLexicalComposerContext()\n\n const $onDelete = (event: KeyboardEvent) => {\n const selection = $getSelection()\n if (!$isNodeSelection(selection)) {\n return false\n }\n event.preventDefault()\n selection.getNodes().forEach((node) => {\n node.remove()\n })\n return true\n }\n\n useEffect(() => {\n return mergeRegister(\n editor.registerCommand(\n CLICK_COMMAND,\n (event) => {\n document.querySelector('.decorator-selected')?.classList.remove('decorator-selected')\n const decorator = $getDecoratorByMouseEvent(event)\n if (!decorator) {\n return true\n }\n const { target } = event\n const isInteractive =\n !(target instanceof HTMLElement) ||\n target.isContentEditable ||\n target.closest(\n 'button, textarea, input, .react-select, .code-editor, .no-select-decorator, [role=\"button\"]',\n )\n if (isInteractive) {\n $setSelection(null)\n } else {\n $selectDecorator(decorator)\n }\n return true\n },\n COMMAND_PRIORITY_LOW,\n ),\n editor.registerCommand(KEY_DELETE_COMMAND, $onDelete, COMMAND_PRIORITY_LOW),\n editor.registerCommand(KEY_BACKSPACE_COMMAND, $onDelete, COMMAND_PRIORITY_LOW),\n editor.registerCommand(\n SELECTION_CHANGE_COMMAND,\n () => {\n const decorator = $getSelectedDecorator()\n document.querySelector('.decorator-selected')?.classList.remove('decorator-selected')\n if (decorator) {\n decorator.element?.classList.add('decorator-selected')\n return true\n }\n return false\n },\n COMMAND_PRIORITY_LOW,\n ),\n editor.registerCommand(\n KEY_ARROW_UP_COMMAND,\n (event) => {\n // CASE 1: Node selection\n const selection = $getSelection()\n if ($isNodeSelection(selection)) {\n const prevSibling = selection.getNodes()[0]?.getPreviousSibling()\n if ($isDecoratorNode(prevSibling)) {\n const element = $getEditor().getElementByKey(prevSibling.getKey())\n if (element) {\n $selectDecorator({ element, node: prevSibling })\n event.preventDefault()\n return true\n }\n return false\n }\n if (!$isElementNode(prevSibling)) {\n return false\n }\n const lastDescendant = prevSibling.getLastDescendant() ?? prevSibling\n if (!lastDescendant) {\n return false\n }\n const block = $findMatchingParent(lastDescendant, INTERNAL_$isBlock)\n block?.selectStart()\n event.preventDefault()\n return true\n }\n if (!$isRangeSelection(selection)) {\n return false\n }\n\n // CASE 2: Range selection\n // Get first selected block\n const firstPoint = selection.isBackward() ? selection.anchor : selection.focus\n const firstNode = firstPoint.getNode()\n const firstSelectedBlock = $findMatchingParent(firstNode, (node) => {\n return findFirstSiblingBlock(node) !== null\n })\n const prevBlock = firstSelectedBlock?.getPreviousSibling()\n if (!firstSelectedBlock || prevBlock !== findFirstSiblingBlock(firstSelectedBlock)) {\n return false\n }\n\n if ($isDecoratorNode(prevBlock)) {\n const prevBlockElement = $getEditor().getElementByKey(prevBlock.getKey())\n if (prevBlockElement) {\n $selectDecorator({ element: prevBlockElement, node: prevBlock })\n event.preventDefault()\n return true\n }\n }\n\n return false\n },\n COMMAND_PRIORITY_LOW,\n ),\n editor.registerCommand(\n KEY_ARROW_DOWN_COMMAND,\n (event) => {\n // CASE 1: Node selection\n const selection = $getSelection()\n if ($isNodeSelection(selection)) {\n event.preventDefault()\n const nextSibling = selection.getNodes()[0]?.getNextSibling()\n if ($isDecoratorNode(nextSibling)) {\n const element = $getEditor().getElementByKey(nextSibling.getKey())\n if (element) {\n $selectDecorator({ element, node: nextSibling })\n }\n return true\n }\n if (!$isElementNode(nextSibling)) {\n return true\n }\n const firstDescendant = nextSibling.getFirstDescendant() ?? nextSibling\n if (!firstDescendant) {\n return true\n }\n const block = $findMatchingParent(firstDescendant, INTERNAL_$isBlock)\n block?.selectEnd()\n event.preventDefault()\n return true\n }\n if (!$isRangeSelection(selection)) {\n return false\n }\n\n // CASE 2: Range selection\n // Get last selected block\n const lastPoint = selection.isBackward() ? selection.anchor : selection.focus\n const lastNode = lastPoint.getNode()\n const lastSelectedBlock = $findMatchingParent(lastNode, (node) => {\n return findLaterSiblingBlock(node) !== null\n })\n const nextBlock = lastSelectedBlock?.getNextSibling()\n if (!lastSelectedBlock || nextBlock !== findLaterSiblingBlock(lastSelectedBlock)) {\n return false\n }\n\n if ($isDecoratorNode(nextBlock)) {\n const nextBlockElement = $getEditor().getElementByKey(nextBlock.getKey())\n if (nextBlockElement) {\n $selectDecorator({ element: nextBlockElement, node: nextBlock })\n event.preventDefault()\n return true\n }\n }\n\n return false\n },\n COMMAND_PRIORITY_LOW,\n ),\n )\n }, [editor])\n\n return null\n}\n\nfunction $getDecoratorByMouseEvent(\n event: MouseEvent,\n): { element: HTMLElement; node: DecoratorNode<unknown> } | undefined {\n if (!(event.target instanceof HTMLElement)) {\n return undefined\n }\n const element = event.target.closest('[data-lexical-decorator=\"true\"]')\n if (!(element instanceof HTMLElement)) {\n return undefined\n }\n const node = $getNearestNodeFromDOMNode(element)\n return $isDecoratorNode(node) ? { element, node } : undefined\n}\n\nfunction $getSelectedDecorator() {\n const selection = $getSelection()\n if (!$isNodeSelection(selection)) {\n return undefined\n }\n const nodes = selection.getNodes()\n if (nodes.length !== 1) {\n return undefined\n }\n const node = nodes[0]\n return $isDecoratorNode(node)\n ? {\n decorator: node,\n element: $getEditor().getElementByKey(node.getKey()),\n }\n : undefined\n}\n\nfunction $selectDecorator({\n element,\n node,\n}: {\n element: HTMLElement\n node: DecoratorNode<unknown>\n}) {\n document.querySelector('.decorator-selected')?.classList.remove('decorator-selected')\n const selection = $createNodeSelection()\n selection.add(node.getKey())\n $setSelection(selection)\n element.scrollIntoView({ behavior: 'smooth', block: 'nearest' })\n element.classList.add('decorator-selected')\n}\n\n/**\n * Copied from https://github.com/facebook/lexical/blob/main/packages/lexical/src/LexicalUtils.ts\n *\n * This function returns true for a DecoratorNode that is not inline OR\n * an ElementNode that is:\n * - not a root or shadow root\n * - not inline\n * - can't be empty\n * - has no children or an inline first child\n */\nexport function INTERNAL_$isBlock(node: LexicalNode): node is DecoratorNode<unknown> | ElementNode {\n if ($isDecoratorNode(node) && !node.isInline()) {\n return true\n }\n if (!$isElementNode(node) || $isRootOrShadowRoot(node)) {\n return false\n }\n\n const firstChild = node.getFirstChild()\n const isLeafElement =\n firstChild === null ||\n $isLineBreakNode(firstChild) ||\n $isTextNode(firstChild) ||\n firstChild.isInline()\n\n return !node.isInline() && node.canBeEmpty() !== false && isLeafElement\n}\n\nfunction findLaterSiblingBlock(node: LexicalNode): LexicalNode | null {\n let current = node.getNextSibling()\n while (current !== null) {\n if (INTERNAL_$isBlock(current)) {\n return current\n }\n current = current.getNextSibling()\n }\n return null\n}\n\nfunction findFirstSiblingBlock(node: LexicalNode): LexicalNode | null {\n let current = node.getPreviousSibling()\n while (current !== null) {\n if (INTERNAL_$isBlock(current)) {\n return current\n }\n current = current.getPreviousSibling()\n }\n return null\n}\n"],"mappings":"AAAA;;AAAA,SAAAA,CAAA,IAAAC,EAAA;AAIA,SAASC,yBAAyB,QAAQ;AAC1C,SAASC,mBAAmB,EAAEC,aAAa,QAAQ;AACnD,SACEC,oBAAoB,EACpBC,UAAU,EACVC,0BAA0B,EAC1BC,aAAa,EACbC,gBAAgB,EAChBC,cAAc,EACdC,gBAAgB,EAChBC,gBAAgB,EAChBC,iBAAiB,EACjBC,mBAAmB,EACnBC,WAAW,EACXC,aAAa,EACbC,aAAa,EACbC,oBAAoB,EACpBC,sBAAsB,EACtBC,oBAAoB,EACpBC,qBAAqB,EACrBC,kBAAkB,EAClBC,wBAAwB,QACnB;AACP,SAASC,SAAS,QAAQ;AAE1B,OAAO;AAEP;AACA;AACA,OAAO,SAAAC,gBAAA;EAAA,MAAAC,CAAA,GAAAzB,EAAA;EACL,OAAA0B,MAAA,IAAiBzB,yBAAA;EAEjB,MAAA0B,SAAA,GAAAC,MAAA;EAUA,IAAAC,EAAA;EAA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AA,CAAoBqD,IAAA,GAAO;IACtD,OAAO;EACT;EAEA,MAAMwC,UAAA,GAAaxC,IAAA,CAAKyC,aAAa;EACrC,MAAMC,aAAA,GACJF,UAAA,KAAe,QACfhG,gBAAA,CAAiBgG,UAAA,KACjB5F,WAAA,CAAY4F,UAAA,KACZA,UAAA,CAAWD,QAAQ;EAErB,OAAO,CAACvC,IAAA,CAAKuC,QAAQ,MAAMvC,IAAA,CAAK2C,UAAU,OAAO,SAASD,aAAA;AAC5D;AAEA,SAAS5C,sBAAsBE,IAAiB;EAC9C,IAAI4C,OAAA,GAAU5C,IAAA,CAAKvB,cAAc;EACjC,OAAOmE,OAAA,KAAY,MAAM;IACvB,IAAI1D,iBAAA,CAAkB0D,OAAA,GAAU;MAC9B,OAAOA,OAAA;IACT;IACAA,OAAA,GAAUA,OAAA,CAAQnE,cAAc;EAClC;EACA,OAAO;AACT;AAEA,SAASqC,sBAAsBd,IAAiB;EAC9C,IAAI4C,OAAA,GAAU5C,IAAA,CAAKK,kBAAkB;EACrC,OAAOuC,OAAA,KAAY,MAAM;IACvB,IAAI1D,iBAAA,CAAkB0D,OAAA,GAAU;MAC9B,OAAOA,OAAA;IACT;IACAA,OAAA,GAAUA,OAAA,CAAQvC,kBAAkB;EACtC;EACA,OAAO;AACT","ignoreList":[]}
1
+ {"version":3,"file":"index.js","names":["c","_c","useLexicalComposerContext","$findMatchingParent","mergeRegister","$createNodeSelection","$getEditor","$getNearestNodeFromDOMNode","$getSelection","$isDecoratorNode","$isElementNode","$isLineBreakNode","$isNodeSelection","$isRangeSelection","$isRootOrShadowRoot","$isTextNode","$onUpdate","$setSelection","CLICK_COMMAND","COMMAND_PRIORITY_LOW","KEY_ARROW_DOWN_COMMAND","KEY_ARROW_UP_COMMAND","KEY_BACKSPACE_COMMAND","KEY_DELETE_COMMAND","SELECTION_CHANGE_COMMAND","useEffect","DecoratorPlugin","$","editor","$onDelete","_temp2","t0","t1","registerCommand","_temp3","_","activeEditor","hasSelectedDecorator","Boolean","$getSelectedDecorator","read","decorator_0","document","querySelector","classList","remove","decorator","getElementByKey","getKey","add","_temp5","_temp7","event_2","selection_1","selection","event","preventDefault","nextSibling","getNodes","getNextSibling","element_0","element","$selectDecorator","firstDescendant","getFirstDescendant","block_0","INTERNAL_$isBlock","block","selectEnd","lastPoint","isBackward","anchor","focus","lastNode","getNode","lastSelectedBlock","_temp6","nextBlock","findLaterSiblingBlock","nextBlockElement","node","node_1","event_1","selection_0","prevSibling","getPreviousSibling","lastDescendant","getLastDescendant","selectStart","firstPoint","firstNode","firstSelectedBlock","_temp4","prevBlock","findFirstSiblingBlock","prevBlockElement","node_0","event_0","$getDecoratorByMouseEvent","target","isInteractive","HTMLElement","isContentEditable","closest","forEach","_temp","undefined","nodes","length","scrollIntoView","behavior","isInline","firstChild","getFirstChild","isLeafElement","canBeEmpty","current"],"sources":["../../../../src/lexical/plugins/DecoratorPlugin/index.tsx"],"sourcesContent":["'use client'\n\nimport type { DecoratorNode, ElementNode, LexicalNode } from 'lexical'\n\nimport { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext'\nimport { $findMatchingParent, mergeRegister } from '@lexical/utils'\nimport {\n $createNodeSelection,\n $getEditor,\n $getNearestNodeFromDOMNode,\n $getSelection,\n $isDecoratorNode,\n $isElementNode,\n $isLineBreakNode,\n $isNodeSelection,\n $isRangeSelection,\n $isRootOrShadowRoot,\n $isTextNode,\n $onUpdate,\n $setSelection,\n CLICK_COMMAND,\n COMMAND_PRIORITY_LOW,\n KEY_ARROW_DOWN_COMMAND,\n KEY_ARROW_UP_COMMAND,\n KEY_BACKSPACE_COMMAND,\n KEY_DELETE_COMMAND,\n SELECTION_CHANGE_COMMAND,\n} from 'lexical'\nimport { useEffect } from 'react'\n\nimport './index.css'\n\n// TODO: This should ideally be fixed in Lexical. See\n// https://github.com/facebook/lexical/pull/7072\nexport function DecoratorPlugin() {\n const [editor] = useLexicalComposerContext()\n\n const $onDelete = (event: KeyboardEvent) => {\n const selection = $getSelection()\n if (!$isNodeSelection(selection)) {\n return false\n }\n event.preventDefault()\n selection.getNodes().forEach((node) => {\n node.remove()\n })\n return true\n }\n\n useEffect(() => {\n return mergeRegister(\n editor.registerCommand(\n CLICK_COMMAND,\n (event) => {\n document.querySelector('.decorator-selected')?.classList.remove('decorator-selected')\n const decorator = $getDecoratorByMouseEvent(event)\n if (!decorator) {\n return true\n }\n const { target } = event\n const isInteractive =\n !(target instanceof HTMLElement) ||\n target.isContentEditable ||\n target.closest(\n 'button, textarea, input, .react-select, .code-editor, .no-select-decorator, [role=\"button\"]',\n )\n if (isInteractive) {\n $setSelection(null)\n } else {\n $selectDecorator(decorator)\n }\n return true\n },\n COMMAND_PRIORITY_LOW,\n ),\n editor.registerCommand(KEY_DELETE_COMMAND, $onDelete, COMMAND_PRIORITY_LOW),\n editor.registerCommand(KEY_BACKSPACE_COMMAND, $onDelete, COMMAND_PRIORITY_LOW),\n editor.registerCommand(\n SELECTION_CHANGE_COMMAND,\n (_, activeEditor) => {\n // Nested editors reconcile independently and update their own highlight.\n if (activeEditor !== editor) {\n return false\n }\n const hasSelectedDecorator = Boolean($getSelectedDecorator())\n $onUpdate(() => {\n activeEditor.read('latest', () => {\n const decorator = $getSelectedDecorator()\n document.querySelector('.decorator-selected')?.classList.remove('decorator-selected')\n if (decorator) {\n activeEditor\n .getElementByKey(decorator.getKey())\n ?.classList.add('decorator-selected')\n }\n })\n })\n return hasSelectedDecorator\n },\n COMMAND_PRIORITY_LOW,\n ),\n editor.registerCommand(\n KEY_ARROW_UP_COMMAND,\n (event) => {\n // CASE 1: Node selection\n const selection = $getSelection()\n if ($isNodeSelection(selection)) {\n const prevSibling = selection.getNodes()[0]?.getPreviousSibling()\n if ($isDecoratorNode(prevSibling)) {\n const element = $getEditor().getElementByKey(prevSibling.getKey())\n if (element) {\n $selectDecorator({ element, node: prevSibling })\n event.preventDefault()\n return true\n }\n return false\n }\n if (!$isElementNode(prevSibling)) {\n return false\n }\n const lastDescendant = prevSibling.getLastDescendant() ?? prevSibling\n if (!lastDescendant) {\n return false\n }\n const block = $findMatchingParent(lastDescendant, INTERNAL_$isBlock)\n block?.selectStart()\n event.preventDefault()\n return true\n }\n if (!$isRangeSelection(selection)) {\n return false\n }\n\n // CASE 2: Range selection\n // Get first selected block\n const firstPoint = selection.isBackward() ? selection.anchor : selection.focus\n const firstNode = firstPoint.getNode()\n const firstSelectedBlock = $findMatchingParent(firstNode, (node) => {\n return findFirstSiblingBlock(node) !== null\n })\n const prevBlock = firstSelectedBlock?.getPreviousSibling()\n if (!firstSelectedBlock || prevBlock !== findFirstSiblingBlock(firstSelectedBlock)) {\n return false\n }\n\n if ($isDecoratorNode(prevBlock)) {\n const prevBlockElement = $getEditor().getElementByKey(prevBlock.getKey())\n if (prevBlockElement) {\n $selectDecorator({ element: prevBlockElement, node: prevBlock })\n event.preventDefault()\n return true\n }\n }\n\n return false\n },\n COMMAND_PRIORITY_LOW,\n ),\n editor.registerCommand(\n KEY_ARROW_DOWN_COMMAND,\n (event) => {\n // CASE 1: Node selection\n const selection = $getSelection()\n if ($isNodeSelection(selection)) {\n event.preventDefault()\n const nextSibling = selection.getNodes()[0]?.getNextSibling()\n if ($isDecoratorNode(nextSibling)) {\n const element = $getEditor().getElementByKey(nextSibling.getKey())\n if (element) {\n $selectDecorator({ element, node: nextSibling })\n }\n return true\n }\n if (!$isElementNode(nextSibling)) {\n return true\n }\n const firstDescendant = nextSibling.getFirstDescendant() ?? nextSibling\n if (!firstDescendant) {\n return true\n }\n const block = $findMatchingParent(firstDescendant, INTERNAL_$isBlock)\n block?.selectEnd()\n event.preventDefault()\n return true\n }\n if (!$isRangeSelection(selection)) {\n return false\n }\n\n // CASE 2: Range selection\n // Get last selected block\n const lastPoint = selection.isBackward() ? selection.anchor : selection.focus\n const lastNode = lastPoint.getNode()\n const lastSelectedBlock = $findMatchingParent(lastNode, (node) => {\n return findLaterSiblingBlock(node) !== null\n })\n const nextBlock = lastSelectedBlock?.getNextSibling()\n if (!lastSelectedBlock || nextBlock !== findLaterSiblingBlock(lastSelectedBlock)) {\n return false\n }\n\n if ($isDecoratorNode(nextBlock)) {\n const nextBlockElement = $getEditor().getElementByKey(nextBlock.getKey())\n if (nextBlockElement) {\n $selectDecorator({ element: nextBlockElement, node: nextBlock })\n event.preventDefault()\n return true\n }\n }\n\n return false\n },\n COMMAND_PRIORITY_LOW,\n ),\n )\n }, [editor])\n\n return null\n}\n\nfunction $getDecoratorByMouseEvent(\n event: MouseEvent,\n): { element: HTMLElement; node: DecoratorNode<unknown> } | undefined {\n if (!(event.target instanceof HTMLElement)) {\n return undefined\n }\n const element = event.target.closest('[data-lexical-decorator=\"true\"]')\n if (!(element instanceof HTMLElement)) {\n return undefined\n }\n const node = $getNearestNodeFromDOMNode(element)\n return $isDecoratorNode(node) ? { element, node } : undefined\n}\n\nfunction $getSelectedDecorator() {\n const selection = $getSelection()\n if (!$isNodeSelection(selection)) {\n return undefined\n }\n const nodes = selection.getNodes()\n if (nodes.length !== 1) {\n return undefined\n }\n const node = nodes[0]\n return $isDecoratorNode(node) ? node : undefined\n}\n\nfunction $selectDecorator({\n element,\n node,\n}: {\n element: HTMLElement\n node: DecoratorNode<unknown>\n}) {\n document.querySelector('.decorator-selected')?.classList.remove('decorator-selected')\n const selection = $createNodeSelection()\n selection.add(node.getKey())\n $setSelection(selection)\n element.scrollIntoView({ behavior: 'smooth', block: 'nearest' })\n element.classList.add('decorator-selected')\n}\n\n/**\n * Copied from https://github.com/facebook/lexical/blob/main/packages/lexical/src/LexicalUtils.ts\n *\n * This function returns true for a DecoratorNode that is not inline OR\n * an ElementNode that is:\n * - not a root or shadow root\n * - not inline\n * - can't be empty\n * - has no children or an inline first child\n */\nexport function INTERNAL_$isBlock(node: LexicalNode): node is DecoratorNode<unknown> | ElementNode {\n if ($isDecoratorNode(node) && !node.isInline()) {\n return true\n }\n if (!$isElementNode(node) || $isRootOrShadowRoot(node)) {\n return false\n }\n\n const firstChild = node.getFirstChild()\n const isLeafElement =\n firstChild === null ||\n $isLineBreakNode(firstChild) ||\n $isTextNode(firstChild) ||\n firstChild.isInline()\n\n return !node.isInline() && node.canBeEmpty() !== false && isLeafElement\n}\n\nfunction findLaterSiblingBlock(node: LexicalNode): LexicalNode | null {\n let current = node.getNextSibling()\n while (current !== null) {\n if (INTERNAL_$isBlock(current)) {\n return current\n }\n current = current.getNextSibling()\n }\n return null\n}\n\nfunction findFirstSiblingBlock(node: LexicalNode): LexicalNode | null {\n let current = node.getPreviousSibling()\n while (current !== null) {\n if (INTERNAL_$isBlock(current)) {\n return current\n }\n current = current.getPreviousSibling()\n }\n return null\n}\n"],"mappings":"AAAA;;AAAA,SAAAA,CAAA,IAAAC,EAAA;AAIA,SAASC,yBAAyB,QAAQ;AAC1C,SAASC,mBAAmB,EAAEC,aAAa,QAAQ;AACnD,SACEC,oBAAoB,EACpBC,UAAU,EACVC,0BAA0B,EAC1BC,aAAa,EACbC,gBAAgB,EAChBC,cAAc,EACdC,gBAAgB,EAChBC,gBAAgB,EAChBC,iBAAiB,EACjBC,mBAAmB,EACnBC,WAAW,EACXC,SAAS,EACTC,aAAa,EACbC,aAAa,EACbC,oBAAoB,EACpBC,sBAAsB,EACtBC,oBAAoB,EACpBC,qBAAqB,EACrBC,kBAAkB,EAClBC,wBAAwB,QACnB;AACP,SAASC,SAAS,QAAQ;AAE1B,OAAO;AAEP;AACA;AACA,OAAO,SAAAC,gBAAA;EAAA,MAAAC,CAAA,GAAA1B,EAAA;EACL,OAAA2B,MAAA,IAAiB1B,yBAAA;EAEjB,MAAA2B,SAAA,GAAAC,MAAA;EAUA,IAAAC,EAAA;EAAA,IAAAC,EAAA;EAAA,IAAAL,CAAA,QAAAC,MAAA;IAEUG,EAAA,GAAAA,CAAA,KACD3B,aAAA,CACLwB,MAAA,CAAAK,eAAA,CAAAf,aAAA,EAAAgB,MAAA,EAAAf,oBAsBE,GAEFS,MAAA,CAAAK,eAAA,CAAAV,kBAAA,EAA2CM,SAAA,EAAAV,oBA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,QACfrG,gBAAA,CAAiBqG,UAAA,KACjBjG,WAAA,CAAYiG,UAAA,KACZA,UAAA,CAAWD,QAAQ;EAErB,OAAO,CAAC/B,IAAA,CAAK+B,QAAQ,MAAM/B,IAAA,CAAKmC,UAAU,OAAO,SAASD,aAAA;AAC5D;AAEA,SAASpC,sBAAsBE,IAAiB;EAC9C,IAAIoC,OAAA,GAAUpC,IAAA,CAAKrB,cAAc;EACjC,OAAOyD,OAAA,KAAY,MAAM;IACvB,IAAIlD,iBAAA,CAAkBkD,OAAA,GAAU;MAC9B,OAAOA,OAAA;IACT;IACAA,OAAA,GAAUA,OAAA,CAAQzD,cAAc;EAClC;EACA,OAAO;AACT;AAEA,SAASmC,sBAAsBd,IAAiB;EAC9C,IAAIoC,OAAA,GAAUpC,IAAA,CAAKK,kBAAkB;EACrC,OAAO+B,OAAA,KAAY,MAAM;IACvB,IAAIlD,iBAAA,CAAkBkD,OAAA,GAAU;MAC9B,OAAOA,OAAA;IACT;IACAA,OAAA,GAAUA,OAAA,CAAQ/B,kBAAkB;EACtC;EACA,OAAO;AACT","ignoreList":[]}
@@ -1,52 +1,45 @@
1
1
  @layer payload-default {
2
2
  .rich-text-lexical--show-gutter {
3
3
  .insert-paragraph-at-end {
4
- padding: var(--spacer-1) 0 calc(var(--spacer-1) / 2) var(--spacer-6);
4
+ padding: var(--spacer-3) var(--spacer-5) var(--spacer-4) var(--spacer-5);
5
5
  }
6
6
  }
7
+
7
8
  .insert-paragraph-at-end {
8
9
  height: var(--spacer-4);
9
10
  margin-top: calc(var(--spacer-4) * -1);
10
11
  width: 100%;
11
12
  z-index: 0;
12
13
  position: relative;
13
- padding: var(--spacer-1) 0 calc(var(--spacer-1) / 2) 0;
14
+ padding: var(--spacer-1) var(--spacer-2) var(--spacer-1) 0;
14
15
 
15
- &:hover {
16
+ &:hover,
17
+ &:focus-visible {
16
18
  cursor: pointer;
17
19
 
18
20
  .insert-paragraph-at-end-inside {
19
- background-color: var(--color-bg-hover);
21
+ opacity: 1;
22
+ background-color: var(--color-bg-transparent-hover);
23
+ }
24
+ }
20
25
 
21
- span {
22
- display: flex;
23
- }
26
+ &:active {
27
+ .insert-paragraph-at-end-inside {
28
+ background-color: var(--color-bg-transparent-pressed);
24
29
  }
25
30
  }
26
31
  }
27
32
 
28
33
  .insert-paragraph-at-end-inside {
29
34
  width: 100%;
30
- height: 100%;
31
- background-color: transparent;
32
- transition: background-color 0.1s ease-in-out;
35
+ height: var(--spacer-3);
36
+ margin: 0 auto;
37
+ padding: 0 var(--spacer-2);
33
38
  display: flex;
39
+ align-items: center;
34
40
  justify-content: center;
35
41
  border-radius: var(--radius-medium);
36
- color: var(--color-text-secondary);
37
-
38
- span {
39
- display: none;
40
- justify-content: center;
41
- align-items: center;
42
- }
43
- }
44
-
45
- html[data-theme='dark'] {
46
- .insert-paragraph-at-end:hover {
47
- .insert-paragraph-at-end-inside {
48
- background-color: var(--color-bg-secondary);
49
- }
50
- }
42
+ color: var(--color-icon-secondary);
43
+ opacity: 0;
51
44
  }
52
45
  }
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/lexical/plugins/InsertParagraphAtEnd/index.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,OAAO,aAAa,CAAA;AAIpB,eAAO,MAAM,0BAA0B,EAAE,KAAK,CAAC,EA8B9C,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/lexical/plugins/InsertParagraphAtEnd/index.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,OAAO,aAAa,CAAA;AAKpB,eAAO,MAAM,0BAA0B,EAAE,KAAK,CAAC,EA6B9C,CAAA"}
@@ -1,46 +1,59 @@
1
- /* eslint-disable jsx-a11y/click-events-have-key-events */'use client';
1
+ 'use client';
2
2
 
3
3
  import { c as _c } from "react/compiler-runtime";
4
4
  import { jsx as _jsx } from "react/jsx-runtime";
5
5
  import { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext';
6
+ import { useTranslation } from '@payloadcms/ui';
6
7
  import { $createParagraphNode, $getRoot } from 'lexical';
7
8
  import React from 'react';
8
9
  import './index.css';
9
10
  import { useEditorConfigContext } from '../../config/client/EditorConfigProvider.js';
11
+ import { AddIcon } from '../../ui/icons/Add/index.js';
10
12
  const baseClass = 'insert-paragraph-at-end';
11
13
  export const InsertParagraphAtEndPlugin = () => {
12
- const $ = _c(2);
14
+ const $ = _c(5);
13
15
  const [editor] = useLexicalComposerContext();
14
16
  const {
15
17
  editorConfig
16
18
  } = useEditorConfigContext();
19
+ const {
20
+ t
21
+ } = useTranslation();
17
22
  if (editorConfig?.admin?.hideInsertParagraphAtEnd) {
18
23
  return null;
19
24
  }
20
25
  let t0;
21
26
  if ($[0] !== editor) {
22
- const onClick = () => {
27
+ t0 = () => {
23
28
  editor.update(_temp);
24
29
  };
25
- t0 = _jsx("div", {
26
- "aria-label": "Insert Paragraph",
30
+ $[0] = editor;
31
+ $[1] = t0;
32
+ } else {
33
+ t0 = $[1];
34
+ }
35
+ const onClick = t0;
36
+ let t1;
37
+ if ($[2] !== onClick || $[3] !== t) {
38
+ t1 = _jsx("button", {
39
+ "aria-label": t("lexical:general:insertParagraph"),
27
40
  className: baseClass,
28
41
  onClick,
29
- role: "button",
30
- tabIndex: 0,
31
- children: _jsx("div", {
42
+ type: "button",
43
+ children: _jsx("span", {
32
44
  className: `${baseClass}-inside`,
33
- children: _jsx("span", {
34
- children: "+"
45
+ children: _jsx(AddIcon, {
46
+ size: 16
35
47
  })
36
48
  })
37
49
  });
38
- $[0] = editor;
39
- $[1] = t0;
50
+ $[2] = onClick;
51
+ $[3] = t;
52
+ $[4] = t1;
40
53
  } else {
41
- t0 = $[1];
54
+ t1 = $[4];
42
55
  }
43
- return t0;
56
+ return t1;
44
57
  };
45
58
  function _temp() {
46
59
  const paragraphNode = $createParagraphNode();
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["c","_c","useLexicalComposerContext","$createParagraphNode","$getRoot","React","useEditorConfigContext","baseClass","InsertParagraphAtEndPlugin","$","editor","editorConfig","admin","hideInsertParagraphAtEnd","t0","onClick","update","_temp","_jsx","className","role","tabIndex","children","paragraphNode","append","select"],"sources":["../../../../src/lexical/plugins/InsertParagraphAtEnd/index.tsx"],"sourcesContent":["/* eslint-disable jsx-a11y/click-events-have-key-events */\n'use client'\n\nimport { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext'\nimport { $createParagraphNode, $getRoot } from 'lexical'\nimport React from 'react'\n\nimport './index.css'\nimport { useEditorConfigContext } from '../../config/client/EditorConfigProvider.js'\nconst baseClass = 'insert-paragraph-at-end'\n\nexport const InsertParagraphAtEndPlugin: React.FC = () => {\n const [editor] = useLexicalComposerContext()\n const { editorConfig } = useEditorConfigContext()\n\n if (editorConfig?.admin?.hideInsertParagraphAtEnd) {\n return null\n }\n\n const onClick = () => {\n editor.update(() => {\n const paragraphNode = $createParagraphNode()\n $getRoot().append(paragraphNode)\n paragraphNode.select()\n })\n }\n\n return (\n // TODO: convert to button\n <div\n aria-label=\"Insert Paragraph\"\n className={baseClass}\n onClick={onClick}\n role=\"button\"\n tabIndex={0}\n >\n <div className={`${baseClass}-inside`}>\n <span>+</span>\n </div>\n </div>\n )\n}\n"],"mappings":"AAAA,0DACA;;AAAA,SAAAA,CAAA,IAAAC,EAAA;;AAEA,SAASC,yBAAyB,QAAQ;AAC1C,SAASC,oBAAoB,EAAEC,QAAQ,QAAQ;AAC/C,OAAOC,KAAA,MAAW;AAElB,OAAO;AACP,SAASC,sBAAsB,QAAQ;AACvC,MAAMC,SAAA,GAAY;AAElB,OAAO,MAAMC,0BAAA,GAAuCA,CAAA;EAAA,MAAAC,CAAA,GAAAR,EAAA;EAClD,OAAAS,MAAA,IAAiBR,yBAAA;EACjB;IAAAS;EAAA,IAAyBL,sBAAA;EAAA,IAErBK,YAAA,EAAAC,KAAA,EAAAC,wBAAA;IAAA;EAAA;EAAA,IAAAC,EAAA;EAAA,IAAAL,CAAA,QAAAC,MAAA;IAIJ,MAAAK,OAAA,GAAAA,CAAA;MACEL,MAAA,CAAAM,MAAA,CAAAC,KAIA;IAAA;IAKAH,EAAA,GAAAI,IAAA,CAAC;MAAA,cACY;MAAAC,SAAA,EAAAZ,SAAA;MAAAQ,OAAA;MAAAK,IAAA,EAGN;MAAAC,QAAA;MAAAC,QAAA,EAGLJ,IAAA,CAAC;QAAAC,SAAA,EAAe,GAAAZ,SAAA,SAAqB;QAAAe,QAAA,EACnCJ,IAAA,CAAC;UAAAI,QAAA,EAAK;QAAA,C;;;;;;;;SARVR,E;CAYJ;AA9BoD,SAAAG,MAAA;EAU9C,MAAAM,aAAA,GAAsBpB,oBAAA;EACtBC,QAAA,GAAAoB,MAAA,CAAkBD,aAAA;EAClBA,aAAA,CAAAE,MAAA,CAAoB;AAAA","ignoreList":[]}
1
+ {"version":3,"file":"index.js","names":["c","_c","useLexicalComposerContext","useTranslation","$createParagraphNode","$getRoot","React","useEditorConfigContext","AddIcon","baseClass","InsertParagraphAtEndPlugin","$","editor","editorConfig","t","admin","hideInsertParagraphAtEnd","t0","update","_temp","onClick","t1","_jsx","className","type","children","size","paragraphNode","append","select"],"sources":["../../../../src/lexical/plugins/InsertParagraphAtEnd/index.tsx"],"sourcesContent":["'use client'\n\nimport { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext'\nimport { useTranslation } from '@payloadcms/ui'\nimport { $createParagraphNode, $getRoot } from 'lexical'\nimport React from 'react'\n\nimport './index.css'\nimport { useEditorConfigContext } from '../../config/client/EditorConfigProvider.js'\nimport { AddIcon } from '../../ui/icons/Add/index.js'\nconst baseClass = 'insert-paragraph-at-end'\n\nexport const InsertParagraphAtEndPlugin: React.FC = () => {\n const [editor] = useLexicalComposerContext()\n const { editorConfig } = useEditorConfigContext()\n const { t } = useTranslation<{}, string>()\n\n if (editorConfig?.admin?.hideInsertParagraphAtEnd) {\n return null\n }\n\n const onClick = () => {\n editor.update(() => {\n const paragraphNode = $createParagraphNode()\n $getRoot().append(paragraphNode)\n paragraphNode.select()\n })\n }\n\n return (\n <button\n aria-label={t('lexical:general:insertParagraph')}\n className={baseClass}\n onClick={onClick}\n type=\"button\"\n >\n <span className={`${baseClass}-inside`}>\n <AddIcon size={16} />\n </span>\n </button>\n )\n}\n"],"mappings":"AAAA;;AAAA,SAAAA,CAAA,IAAAC,EAAA;;AAEA,SAASC,yBAAyB,QAAQ;AAC1C,SAASC,cAAc,QAAQ;AAC/B,SAASC,oBAAoB,EAAEC,QAAQ,QAAQ;AAC/C,OAAOC,KAAA,MAAW;AAElB,OAAO;AACP,SAASC,sBAAsB,QAAQ;AACvC,SAASC,OAAO,QAAQ;AACxB,MAAMC,SAAA,GAAY;AAElB,OAAO,MAAMC,0BAAA,GAAuCA,CAAA;EAAA,MAAAC,CAAA,GAAAV,EAAA;EAClD,OAAAW,MAAA,IAAiBV,yBAAA;EACjB;IAAAW;EAAA,IAAyBN,sBAAA;EACzB;IAAAO;EAAA,IAAcX,cAAA;EAAA,IAEVU,YAAA,EAAAE,KAAA,EAAAC,wBAAA;IAAA;EAAA;EAAA,IAAAC,EAAA;EAAA,IAAAN,CAAA,QAAAC,MAAA;IAIYK,EAAA,GAAAA,CAAA;MACdL,MAAA,CAAAM,MAAA,CAAAC,KAIA;IAAA;IACFR,CAAA,MAAAC,MAAA;IAAAD,CAAA,MAAAM,EAAA;EAAA;IAAAA,EAAA,GAAAN,CAAA;EAAA;EANA,MAAAS,OAAA,GAAgBH,EAMhB;EAAA,IAAAI,EAAA;EAAA,IAAAV,CAAA,QAAAS,OAAA,IAAAT,CAAA,QAAAG,CAAA;IAGEO,EAAA,GAAAC,IAAA,CAAC;MAAA,cACaR,CAAA,CAAE;MAAAS,SAAA,EAAAd,SAAA;MAAAW,OAAA;MAAAI,IAAA,EAGT;MAAAC,QAAA,EAELH,IAAA,CAAC;QAAAC,SAAA,EAAgB,GAAAd,SAAA,SAAqB;QAAAgB,QAAA,EACpCH,IAAA,CAAAd,OAAA;UAAAkB,IAAA;QAAA,C;;;;;;;;;SAPJL,E;CAWJ;AA7BoD,SAAAF,MAAA;EAW9C,MAAAQ,aAAA,GAAsBvB,oBAAA;EACtBC,QAAA,GAAAuB,MAAA,CAAkBD,aAAA;EAClBA,aAAA,CAAAE,MAAA,CAAoB;AAAA","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/lexical/plugins/MarkdownShortcut/index.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAK9B,eAAO,MAAM,sBAAsB,EAAE,KAAK,CAAC,EAS1C,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/lexical/plugins/MarkdownShortcut/index.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAI9B,eAAO,MAAM,sBAAsB,EAAE,KAAK,CAAC,EAS1C,CAAA"}
@@ -1,9 +1,9 @@
1
1
  'use client';
2
2
 
3
3
  import { c as _c } from "react/compiler-runtime";
4
+ import { registerMarkdownShortcuts } from '@lexical/markdown';
4
5
  import { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext';
5
6
  import * as React from 'react';
6
- import { registerMarkdownShortcuts } from '../../../packages/@lexical/markdown/MarkdownShortcuts.js';
7
7
  import { useEditorConfigContext } from '../../config/client/EditorConfigProvider.js';
8
8
  export const MarkdownShortcutPlugin = () => {
9
9
  const $ = _c(4);
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["c","_c","useLexicalComposerContext","React","registerMarkdownShortcuts","useEditorConfigContext","MarkdownShortcutPlugin","$","editorConfig","editor","t0","t1","features","markdownTransformers","useEffect"],"sources":["../../../../src/lexical/plugins/MarkdownShortcut/index.tsx"],"sourcesContent":["'use client'\n\nimport { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext'\nimport * as React from 'react'\n\nimport { registerMarkdownShortcuts } from '../../../packages/@lexical/markdown/MarkdownShortcuts.js'\nimport { useEditorConfigContext } from '../../config/client/EditorConfigProvider.js'\n\nexport const MarkdownShortcutPlugin: React.FC = () => {\n const { editorConfig } = useEditorConfigContext()\n const [editor] = useLexicalComposerContext()\n\n React.useEffect(() => {\n return registerMarkdownShortcuts(editor, editorConfig.features.markdownTransformers ?? [])\n }, [editor, editorConfig.features.markdownTransformers])\n\n return null\n}\n"],"mappings":"AAAA;;AAAA,SAAAA,CAAA,IAAAC,EAAA;AAEA,SAASC,yBAAyB,QAAQ;AAC1C,YAAYC,KAAA,MAAW;AAEvB,SAASC,yBAAyB,QAAQ;AAC1C,SAASC,sBAAsB,QAAQ;AAEvC,OAAO,MAAMC,sBAAA,GAAmCA,CAAA;EAAA,MAAAC,CAAA,GAAAN,EAAA;EAC9C;IAAAO;EAAA,IAAyBH,sBAAA;EACzB,OAAAI,MAAA,IAAiBP,yBAAA;EAAA,IAAAQ,EAAA;EAAA,IAAAC,EAAA;EAAA,IAAAJ,CAAA,QAAAE,MAAA,IAAAF,CAAA,QAAAC,YAAA,CAAAI,QAAA,CAAAC,oBAAA;IAEDH,EAAA,GAAAA,CAAA,KACPN,yBAAA,CAA0BK,MAAA,EAAQD,YAAA,CAAAI,QAAA,CAAAC,oBAAA,MAAgD;IACxFF,EAAA,IAACF,MAAA,EAAQD,YAAA,CAAAI,QAAA,CAAAC,oBAAA;IAA2CN,CAAA,MAAAE,MAAA;IAAAF,CAAA,MAAAC,YAAA,CAAAI,QAAA,CAAAC,oBAAA;IAAAN,CAAA,MAAAG,EAAA;IAAAH,CAAA,MAAAI,EAAA;EAAA;IAAAD,EAAA,GAAAH,CAAA;IAAAI,EAAA,GAAAJ,CAAA;EAAA;EAFvDJ,KAAA,CAAAW,SAAA,CAAgBJ,EAEhB,EAAGC,EAAoD;EAAA;AAAA,CAGzD","ignoreList":[]}
1
+ {"version":3,"file":"index.js","names":["c","_c","registerMarkdownShortcuts","useLexicalComposerContext","React","useEditorConfigContext","MarkdownShortcutPlugin","$","editorConfig","editor","t0","t1","features","markdownTransformers","useEffect"],"sources":["../../../../src/lexical/plugins/MarkdownShortcut/index.tsx"],"sourcesContent":["'use client'\n\nimport { registerMarkdownShortcuts } from '@lexical/markdown'\nimport { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext'\nimport * as React from 'react'\n\nimport { useEditorConfigContext } from '../../config/client/EditorConfigProvider.js'\n\nexport const MarkdownShortcutPlugin: React.FC = () => {\n const { editorConfig } = useEditorConfigContext()\n const [editor] = useLexicalComposerContext()\n\n React.useEffect(() => {\n return registerMarkdownShortcuts(editor, editorConfig.features.markdownTransformers ?? [])\n }, [editor, editorConfig.features.markdownTransformers])\n\n return null\n}\n"],"mappings":"AAAA;;AAAA,SAAAA,CAAA,IAAAC,EAAA;AAEA,SAASC,yBAAyB,QAAQ;AAC1C,SAASC,yBAAyB,QAAQ;AAC1C,YAAYC,KAAA,MAAW;AAEvB,SAASC,sBAAsB,QAAQ;AAEvC,OAAO,MAAMC,sBAAA,GAAmCA,CAAA;EAAA,MAAAC,CAAA,GAAAN,EAAA;EAC9C;IAAAO;EAAA,IAAyBH,sBAAA;EACzB,OAAAI,MAAA,IAAiBN,yBAAA;EAAA,IAAAO,EAAA;EAAA,IAAAC,EAAA;EAAA,IAAAJ,CAAA,QAAAE,MAAA,IAAAF,CAAA,QAAAC,YAAA,CAAAI,QAAA,CAAAC,oBAAA;IAEDH,EAAA,GAAAA,CAAA,KACPR,yBAAA,CAA0BO,MAAA,EAAQD,YAAA,CAAAI,QAAA,CAAAC,oBAAA,MAAgD;IACxFF,EAAA,IAACF,MAAA,EAAQD,YAAA,CAAAI,QAAA,CAAAC,oBAAA;IAA2CN,CAAA,MAAAE,MAAA;IAAAF,CAAA,MAAAC,YAAA,CAAAI,QAAA,CAAAC,oBAAA;IAAAN,CAAA,MAAAG,EAAA;IAAAH,CAAA,MAAAI,EAAA;EAAA;IAAAD,EAAA,GAAAH,CAAA;IAAAI,EAAA,GAAAJ,CAAA;EAAA;EAFvDH,KAAA,CAAAU,SAAA,CAAgBJ,EAEhB,EAAGC,EAAoD;EAAA;AAAA,CAGzD","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/lexical/plugins/NodeViewOverridePlugin/index.tsx"],"names":[],"mappings":"AAOA,wBAAgB,sBAAsB,IAAI,IAAI,CAsB7C"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/lexical/plugins/NodeViewOverridePlugin/index.tsx"],"names":[],"mappings":"AA4BA,wBAAgB,sBAAsB,IAAI,IAAI,CAwB7C"}