@payloadcms/richtext-lexical 3.0.0-beta.35 → 3.0.0-beta.36

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 (235) hide show
  1. package/dist/cell/index.d.ts +2 -0
  2. package/dist/cell/index.d.ts.map +1 -1
  3. package/dist/cell/index.js +24 -15
  4. package/dist/cell/index.js.map +1 -1
  5. package/dist/field/Field.d.ts.map +1 -1
  6. package/dist/field/Field.js +66 -47
  7. package/dist/field/Field.js.map +1 -1
  8. package/dist/field/features/blocks/component/BlockContent.js +62 -45
  9. package/dist/field/features/blocks/component/BlockContent.js.map +1 -1
  10. package/dist/field/features/blocks/component/index.js +38 -28
  11. package/dist/field/features/blocks/component/index.js.map +1 -1
  12. package/dist/field/features/blocks/drawer/index.js +2 -1
  13. package/dist/field/features/blocks/drawer/index.js.map +1 -1
  14. package/dist/field/features/blocks/nodes/BlocksNode.d.ts +1 -1
  15. package/dist/field/features/blocks/nodes/BlocksNode.d.ts.map +1 -1
  16. package/dist/field/features/blocks/nodes/BlocksNode.js +2 -1
  17. package/dist/field/features/blocks/nodes/BlocksNode.js.map +1 -1
  18. package/dist/field/features/blocks/plugin/index.js +2 -1
  19. package/dist/field/features/blocks/plugin/index.js.map +1 -1
  20. package/dist/field/features/debug/testRecorder/plugin/index.js +65 -39
  21. package/dist/field/features/debug/testRecorder/plugin/index.js.map +1 -1
  22. package/dist/field/features/debug/treeView/plugin/index.js +2 -1
  23. package/dist/field/features/debug/treeView/plugin/index.js.map +1 -1
  24. package/dist/field/features/horizontalRule/nodes/HorizontalRuleNode.js +2 -1
  25. package/dist/field/features/horizontalRule/nodes/HorizontalRuleNode.js.map +1 -1
  26. package/dist/field/features/link/drawer/index.js +30 -22
  27. package/dist/field/features/link/drawer/index.js.map +1 -1
  28. package/dist/field/features/link/plugins/clickableLink/index.js +2 -1
  29. package/dist/field/features/link/plugins/clickableLink/index.js.map +1 -1
  30. package/dist/field/features/link/plugins/floatingLinkEditor/LinkEditor/index.d.ts.map +1 -1
  31. package/dist/field/features/link/plugins/floatingLinkEditor/LinkEditor/index.js +88 -70
  32. package/dist/field/features/link/plugins/floatingLinkEditor/LinkEditor/index.js.map +1 -1
  33. package/dist/field/features/link/plugins/floatingLinkEditor/index.js +2 -1
  34. package/dist/field/features/link/plugins/floatingLinkEditor/index.js.map +1 -1
  35. package/dist/field/features/lists/checklist/plugin/index.js +2 -1
  36. package/dist/field/features/lists/checklist/plugin/index.js.map +1 -1
  37. package/dist/field/features/lists/plugin/index.js +2 -1
  38. package/dist/field/features/lists/plugin/index.js.map +1 -1
  39. package/dist/field/features/migrations/lexicalPluginToLexical/nodes/unknownConvertedNode/Component.js +9 -1
  40. package/dist/field/features/migrations/lexicalPluginToLexical/nodes/unknownConvertedNode/Component.js.map +1 -1
  41. package/dist/field/features/migrations/lexicalPluginToLexical/nodes/unknownConvertedNode/index.d.ts +1 -1
  42. package/dist/field/features/migrations/lexicalPluginToLexical/nodes/unknownConvertedNode/index.d.ts.map +1 -1
  43. package/dist/field/features/migrations/lexicalPluginToLexical/nodes/unknownConvertedNode/index.js +2 -1
  44. package/dist/field/features/migrations/lexicalPluginToLexical/nodes/unknownConvertedNode/index.js.map +1 -1
  45. package/dist/field/features/migrations/slateToLexical/nodes/unknownConvertedNode/Component.js +9 -1
  46. package/dist/field/features/migrations/slateToLexical/nodes/unknownConvertedNode/Component.js.map +1 -1
  47. package/dist/field/features/migrations/slateToLexical/nodes/unknownConvertedNode/index.d.ts +1 -1
  48. package/dist/field/features/migrations/slateToLexical/nodes/unknownConvertedNode/index.d.ts.map +1 -1
  49. package/dist/field/features/migrations/slateToLexical/nodes/unknownConvertedNode/index.js +2 -1
  50. package/dist/field/features/migrations/slateToLexical/nodes/unknownConvertedNode/index.js.map +1 -1
  51. package/dist/field/features/relationship/drawer/index.js +10 -2
  52. package/dist/field/features/relationship/drawer/index.js.map +1 -1
  53. package/dist/field/features/relationship/nodes/RelationshipNode.d.ts +1 -1
  54. package/dist/field/features/relationship/nodes/RelationshipNode.d.ts.map +1 -1
  55. package/dist/field/features/relationship/nodes/RelationshipNode.js +2 -1
  56. package/dist/field/features/relationship/nodes/RelationshipNode.js.map +1 -1
  57. package/dist/field/features/relationship/nodes/components/RelationshipComponent.js +64 -44
  58. package/dist/field/features/relationship/nodes/components/RelationshipComponent.js.map +1 -1
  59. package/dist/field/features/relationship/plugins/index.js +2 -1
  60. package/dist/field/features/relationship/plugins/index.js.map +1 -1
  61. package/dist/field/features/toolbars/fixed/Toolbar/index.js +60 -55
  62. package/dist/field/features/toolbars/fixed/Toolbar/index.js.map +1 -1
  63. package/dist/field/features/toolbars/fixed/Toolbar/index.scss +16 -2
  64. package/dist/field/features/toolbars/inline/Toolbar/index.js +57 -49
  65. package/dist/field/features/toolbars/inline/Toolbar/index.js.map +1 -1
  66. package/dist/field/features/toolbars/shared/ToolbarButton/index.d.ts +1 -1
  67. package/dist/field/features/toolbars/shared/ToolbarButton/index.d.ts.map +1 -1
  68. package/dist/field/features/toolbars/shared/ToolbarButton/index.js +5 -3
  69. package/dist/field/features/toolbars/shared/ToolbarButton/index.js.map +1 -1
  70. package/dist/field/features/toolbars/shared/ToolbarDropdown/DropDown.d.ts.map +1 -1
  71. package/dist/field/features/toolbars/shared/ToolbarDropdown/DropDown.js +54 -35
  72. package/dist/field/features/toolbars/shared/ToolbarDropdown/DropDown.js.map +1 -1
  73. package/dist/field/features/toolbars/shared/ToolbarDropdown/index.d.ts +1 -1
  74. package/dist/field/features/toolbars/shared/ToolbarDropdown/index.d.ts.map +1 -1
  75. package/dist/field/features/toolbars/shared/ToolbarDropdown/index.js +25 -22
  76. package/dist/field/features/toolbars/shared/ToolbarDropdown/index.js.map +1 -1
  77. package/dist/field/features/upload/component/ExtraFieldsDrawer/index.js +30 -22
  78. package/dist/field/features/upload/component/ExtraFieldsDrawer/index.js.map +1 -1
  79. package/dist/field/features/upload/component/index.js +104 -71
  80. package/dist/field/features/upload/component/index.js.map +1 -1
  81. package/dist/field/features/upload/drawer/index.js +8 -4
  82. package/dist/field/features/upload/drawer/index.js.map +1 -1
  83. package/dist/field/features/upload/nodes/UploadNode.d.ts +1 -1
  84. package/dist/field/features/upload/nodes/UploadNode.d.ts.map +1 -1
  85. package/dist/field/features/upload/nodes/UploadNode.js +2 -1
  86. package/dist/field/features/upload/nodes/UploadNode.js.map +1 -1
  87. package/dist/field/features/upload/plugin/index.js +2 -1
  88. package/dist/field/features/upload/plugin/index.js.map +1 -1
  89. package/dist/field/index.d.ts +2 -0
  90. package/dist/field/index.d.ts.map +1 -1
  91. package/dist/field/index.js +29 -21
  92. package/dist/field/index.js.map +1 -1
  93. package/dist/field/index.scss +0 -19
  94. package/dist/field/lexical/EditorFocusProvider.d.ts +1 -2
  95. package/dist/field/lexical/EditorFocusProvider.d.ts.map +1 -1
  96. package/dist/field/lexical/EditorFocusProvider.js +5 -3
  97. package/dist/field/lexical/EditorFocusProvider.js.map +1 -1
  98. package/dist/field/lexical/EditorPlugin.js +3 -2
  99. package/dist/field/lexical/EditorPlugin.js.map +1 -1
  100. package/dist/field/lexical/LexicalEditor.js +113 -81
  101. package/dist/field/lexical/LexicalEditor.js.map +1 -1
  102. package/dist/field/lexical/LexicalEditor.scss +10 -1
  103. package/dist/field/lexical/LexicalProvider.js +16 -10
  104. package/dist/field/lexical/LexicalProvider.js.map +1 -1
  105. package/dist/field/lexical/config/client/EditorConfigProvider.js +5 -3
  106. package/dist/field/lexical/config/client/EditorConfigProvider.js.map +1 -1
  107. package/dist/field/lexical/config/client/sanitize.d.ts +2 -1
  108. package/dist/field/lexical/config/client/sanitize.d.ts.map +1 -1
  109. package/dist/field/lexical/config/client/sanitize.js +2 -1
  110. package/dist/field/lexical/config/client/sanitize.js.map +1 -1
  111. package/dist/field/lexical/config/types.d.ts +2 -0
  112. package/dist/field/lexical/config/types.d.ts.map +1 -1
  113. package/dist/field/lexical/config/types.js.map +1 -1
  114. package/dist/field/lexical/plugins/MarkdownShortcut/index.js +2 -1
  115. package/dist/field/lexical/plugins/MarkdownShortcut/index.js.map +1 -1
  116. package/dist/field/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/LexicalMenu.d.ts +1 -1
  117. package/dist/field/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/LexicalMenu.d.ts.map +1 -1
  118. package/dist/field/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/LexicalMenu.js.map +1 -1
  119. package/dist/field/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/index.d.ts +1 -1
  120. package/dist/field/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/index.d.ts.map +1 -1
  121. package/dist/field/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/index.js +2 -1
  122. package/dist/field/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/index.js.map +1 -1
  123. package/dist/field/lexical/plugins/SlashMenu/index.js +51 -40
  124. package/dist/field/lexical/plugins/SlashMenu/index.js.map +1 -1
  125. package/dist/field/lexical/plugins/handles/AddBlockHandlePlugin/index.d.ts +2 -2
  126. package/dist/field/lexical/plugins/handles/AddBlockHandlePlugin/index.d.ts.map +1 -1
  127. package/dist/field/lexical/plugins/handles/AddBlockHandlePlugin/index.js +38 -119
  128. package/dist/field/lexical/plugins/handles/AddBlockHandlePlugin/index.js.map +1 -1
  129. package/dist/field/lexical/plugins/handles/AddBlockHandlePlugin/index.scss +2 -2
  130. package/dist/field/lexical/plugins/handles/DraggableBlockPlugin/highlightElemOriginalPosition.d.ts +1 -1
  131. package/dist/field/lexical/plugins/handles/DraggableBlockPlugin/highlightElemOriginalPosition.d.ts.map +1 -1
  132. package/dist/field/lexical/plugins/handles/DraggableBlockPlugin/highlightElemOriginalPosition.js.map +1 -1
  133. package/dist/field/lexical/plugins/handles/DraggableBlockPlugin/index.d.ts +2 -2
  134. package/dist/field/lexical/plugins/handles/DraggableBlockPlugin/index.d.ts.map +1 -1
  135. package/dist/field/lexical/plugins/handles/DraggableBlockPlugin/index.js +102 -58
  136. package/dist/field/lexical/plugins/handles/DraggableBlockPlugin/index.js.map +1 -1
  137. package/dist/field/lexical/plugins/handles/DraggableBlockPlugin/index.scss +12 -3
  138. package/dist/field/lexical/plugins/handles/DraggableBlockPlugin/setTargetLine.d.ts +8 -1
  139. package/dist/field/lexical/plugins/handles/DraggableBlockPlugin/setTargetLine.d.ts.map +1 -1
  140. package/dist/field/lexical/plugins/handles/DraggableBlockPlugin/setTargetLine.js +73 -25
  141. package/dist/field/lexical/plugins/handles/DraggableBlockPlugin/setTargetLine.js.map +1 -1
  142. package/dist/field/lexical/plugins/handles/utils/calculateDistanceFromScrollerElem.d.ts +5 -0
  143. package/dist/field/lexical/plugins/handles/utils/calculateDistanceFromScrollerElem.d.ts.map +1 -0
  144. package/dist/field/lexical/plugins/handles/utils/calculateDistanceFromScrollerElem.js +21 -0
  145. package/dist/field/lexical/plugins/handles/utils/calculateDistanceFromScrollerElem.js.map +1 -0
  146. package/dist/field/lexical/plugins/handles/{DraggableBlockPlugin → utils}/getNodeCloseToPoint.d.ts +4 -0
  147. package/dist/field/lexical/plugins/handles/utils/getNodeCloseToPoint.d.ts.map +1 -0
  148. package/dist/field/lexical/plugins/handles/{DraggableBlockPlugin → utils}/getNodeCloseToPoint.js +2 -14
  149. package/dist/field/lexical/plugins/handles/utils/getNodeCloseToPoint.js.map +1 -0
  150. package/dist/field/lexical/plugins/handles/utils/setHandlePosition.d.ts.map +1 -1
  151. package/dist/field/lexical/plugins/handles/utils/setHandlePosition.js +4 -2
  152. package/dist/field/lexical/plugins/handles/utils/setHandlePosition.js.map +1 -1
  153. package/dist/field/lexical/theme/EditorTheme.scss +5 -0
  154. package/dist/field/lexical/ui/ContentEditable.d.ts +1 -1
  155. package/dist/field/lexical/ui/ContentEditable.d.ts.map +1 -1
  156. package/dist/field/lexical/ui/ContentEditable.js +2 -1
  157. package/dist/field/lexical/ui/ContentEditable.js.map +1 -1
  158. package/dist/field/lexical/ui/ContentEditable.scss +50 -2
  159. package/dist/field/lexical/ui/icons/AI/index.js +26 -17
  160. package/dist/field/lexical/ui/icons/AI/index.js.map +1 -1
  161. package/dist/field/lexical/ui/icons/Add/index.js +14 -9
  162. package/dist/field/lexical/ui/icons/Add/index.js.map +1 -1
  163. package/dist/field/lexical/ui/icons/Add/light.svg +4 -0
  164. package/dist/field/lexical/ui/icons/AlignCenter/index.js +21 -15
  165. package/dist/field/lexical/ui/icons/AlignCenter/index.js.map +1 -1
  166. package/dist/field/lexical/ui/icons/AlignJustify/index.js +21 -15
  167. package/dist/field/lexical/ui/icons/AlignJustify/index.js.map +1 -1
  168. package/dist/field/lexical/ui/icons/AlignLeft/index.js +21 -15
  169. package/dist/field/lexical/ui/icons/AlignLeft/index.js.map +1 -1
  170. package/dist/field/lexical/ui/icons/AlignRight/index.js +21 -15
  171. package/dist/field/lexical/ui/icons/AlignRight/index.js.map +1 -1
  172. package/dist/field/lexical/ui/icons/Block/index.js +30 -24
  173. package/dist/field/lexical/ui/icons/Block/index.js.map +1 -1
  174. package/dist/field/lexical/ui/icons/Blockquote/index.js +8 -6
  175. package/dist/field/lexical/ui/icons/Blockquote/index.js.map +1 -1
  176. package/dist/field/lexical/ui/icons/Bold/index.js +8 -6
  177. package/dist/field/lexical/ui/icons/Bold/index.js.map +1 -1
  178. package/dist/field/lexical/ui/icons/Checklist/index.js +19 -14
  179. package/dist/field/lexical/ui/icons/Checklist/index.js.map +1 -1
  180. package/dist/field/lexical/ui/icons/Code/index.js +14 -9
  181. package/dist/field/lexical/ui/icons/Code/index.js.map +1 -1
  182. package/dist/field/lexical/ui/icons/CodeBlock/index.js +14 -9
  183. package/dist/field/lexical/ui/icons/CodeBlock/index.js.map +1 -1
  184. package/dist/field/lexical/ui/icons/DraggableBlock/light.svg +9 -0
  185. package/dist/field/lexical/ui/icons/H1/index.js +8 -6
  186. package/dist/field/lexical/ui/icons/H1/index.js.map +1 -1
  187. package/dist/field/lexical/ui/icons/H2/index.js +8 -6
  188. package/dist/field/lexical/ui/icons/H2/index.js.map +1 -1
  189. package/dist/field/lexical/ui/icons/H3/index.js +8 -6
  190. package/dist/field/lexical/ui/icons/H3/index.js.map +1 -1
  191. package/dist/field/lexical/ui/icons/H4/index.js +8 -6
  192. package/dist/field/lexical/ui/icons/H4/index.js.map +1 -1
  193. package/dist/field/lexical/ui/icons/H5/index.js +8 -6
  194. package/dist/field/lexical/ui/icons/H5/index.js.map +1 -1
  195. package/dist/field/lexical/ui/icons/H6/index.js +8 -6
  196. package/dist/field/lexical/ui/icons/H6/index.js.map +1 -1
  197. package/dist/field/lexical/ui/icons/HorizontalRule/index.js +11 -9
  198. package/dist/field/lexical/ui/icons/HorizontalRule/index.js.map +1 -1
  199. package/dist/field/lexical/ui/icons/IndentDecrease/index.js +25 -18
  200. package/dist/field/lexical/ui/icons/IndentDecrease/index.js.map +1 -1
  201. package/dist/field/lexical/ui/icons/IndentIncrease/index.js +25 -18
  202. package/dist/field/lexical/ui/icons/IndentIncrease/index.js.map +1 -1
  203. package/dist/field/lexical/ui/icons/Italic/index.js +8 -6
  204. package/dist/field/lexical/ui/icons/Italic/index.js.map +1 -1
  205. package/dist/field/lexical/ui/icons/Link/index.js +26 -17
  206. package/dist/field/lexical/ui/icons/Link/index.js.map +1 -1
  207. package/dist/field/lexical/ui/icons/OrderedList/index.js +29 -21
  208. package/dist/field/lexical/ui/icons/OrderedList/index.js.map +1 -1
  209. package/dist/field/lexical/ui/icons/Relationship/index.js +26 -17
  210. package/dist/field/lexical/ui/icons/Relationship/index.js.map +1 -1
  211. package/dist/field/lexical/ui/icons/Strikethrough/index.js +14 -9
  212. package/dist/field/lexical/ui/icons/Strikethrough/index.js.map +1 -1
  213. package/dist/field/lexical/ui/icons/Subscript/index.js +8 -6
  214. package/dist/field/lexical/ui/icons/Subscript/index.js.map +1 -1
  215. package/dist/field/lexical/ui/icons/Superscript/index.js +8 -6
  216. package/dist/field/lexical/ui/icons/Superscript/index.js.map +1 -1
  217. package/dist/field/lexical/ui/icons/Text/index.js +8 -6
  218. package/dist/field/lexical/ui/icons/Text/index.js.map +1 -1
  219. package/dist/field/lexical/ui/icons/Underline/index.js +14 -9
  220. package/dist/field/lexical/ui/icons/Underline/index.js.map +1 -1
  221. package/dist/field/lexical/ui/icons/UnorderedList/index.js +45 -36
  222. package/dist/field/lexical/ui/icons/UnorderedList/index.js.map +1 -1
  223. package/dist/field/lexical/ui/icons/Upload/index.js +24 -18
  224. package/dist/field/lexical/ui/icons/Upload/index.js.map +1 -1
  225. package/dist/generateComponentMap.js +8 -8
  226. package/dist/generateComponentMap.js.map +1 -1
  227. package/dist/index.d.ts.map +1 -1
  228. package/dist/index.js +2 -0
  229. package/dist/index.js.map +1 -1
  230. package/dist/types.d.ts +7 -0
  231. package/dist/types.d.ts.map +1 -1
  232. package/dist/types.js.map +1 -1
  233. package/package.json +17 -13
  234. package/dist/field/lexical/plugins/handles/DraggableBlockPlugin/getNodeCloseToPoint.d.ts.map +0 -1
  235. package/dist/field/lexical/plugins/handles/DraggableBlockPlugin/getNodeCloseToPoint.js.map +0 -1
package/dist/types.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/types.ts"],"sourcesContent":["import type { EditorConfig as LexicalEditorConfig, SerializedEditorState } from 'lexical'\nimport type { FieldPermissions } from 'payload/auth'\nimport type { FieldTypes, SanitizedConfig } from 'payload/config'\nimport type { RichTextAdapter, RichTextFieldProps } from 'payload/types'\nimport type React from 'react'\n\nimport type { FeatureProviderServer } from './field/features/types.js'\nimport type { SanitizedServerEditorConfig } from './field/lexical/config/types.js'\n\nexport type LexicalEditorProps = {\n features?:\n | (({\n defaultFeatures,\n rootFeatures,\n }: {\n /**\n * This opinionated array contains all \"recommended\" default features.\n *\n * @Example\n *\n * ```ts\n * editor: lexicalEditor({\n * features: ({ defaultFeatures }) => [...defaultFeatures, FixedToolbarFeature()],\n * })\n * ```\n */\n defaultFeatures: FeatureProviderServer<any, any>[]\n /**\n * This array contains all features that are enabled in the root richText editor (the one defined in the payload.config.ts).\n * If this field is the root richText editor, or if the root richText editor is not a lexical editor, this array will be empty\n *\n * @Example\n *\n * ```ts\n * editor: lexicalEditor({\n * features: ({ rootFeatures }) => [...rootFeatures, FixedToolbarFeature()],\n * })\n * ```\n */\n rootFeatures: FeatureProviderServer<any, any>[]\n }) => FeatureProviderServer<any, any>[])\n | FeatureProviderServer<any, any>[]\n lexical?: LexicalEditorConfig\n}\n\nexport type LexicalRichTextAdapter = RichTextAdapter<SerializedEditorState, AdapterProps, any> & {\n editorConfig: SanitizedServerEditorConfig\n features: FeatureProviderServer<any, any>[]\n}\n\nexport type LexicalRichTextAdapterProvider =\n /**\n * This is being called during the payload sanitization process\n */\n ({\n config,\n isRoot,\n }: {\n config: SanitizedConfig\n isRoot?: boolean\n }) => Promise<LexicalRichTextAdapter>\n\nexport type FieldProps = RichTextFieldProps<SerializedEditorState, AdapterProps, AdapterProps> & {\n fieldTypes: FieldTypes\n indexPath: string\n path?: string\n permissions: FieldPermissions\n}\n\nexport type AdapterProps = {\n editorConfig: SanitizedServerEditorConfig\n}\n\nexport type GeneratedFeatureProviderComponent = {\n ClientComponent: React.ReactNode\n key: string\n order: number\n}\n"],"names":[],"rangeMappings":"","mappings":"AAyEA,WAIC"}
1
+ {"version":3,"sources":["../src/types.ts"],"sourcesContent":["import type { EditorConfig as LexicalEditorConfig, SerializedEditorState } from 'lexical'\nimport type { FieldPermissions } from 'payload/auth'\nimport type { FieldTypes, SanitizedConfig } from 'payload/config'\nimport type { RichTextAdapter, RichTextFieldProps } from 'payload/types'\nimport type React from 'react'\n\nimport type { FeatureProviderServer } from './field/features/types.js'\nimport type { SanitizedServerEditorConfig } from './field/lexical/config/types.js'\n\nexport type LexicalFieldAdminProps = {\n /**\n * Controls if the gutter (padding to the left & gray vertical line) should be hidden. @default false\n */\n hideGutter?: boolean\n}\n\nexport type LexicalEditorProps = {\n admin?: LexicalFieldAdminProps\n features?:\n | (({\n defaultFeatures,\n rootFeatures,\n }: {\n /**\n * This opinionated array contains all \"recommended\" default features.\n *\n * @Example\n *\n * ```ts\n * editor: lexicalEditor({\n * features: ({ defaultFeatures }) => [...defaultFeatures, FixedToolbarFeature()],\n * })\n * ```\n */\n defaultFeatures: FeatureProviderServer<any, any>[]\n /**\n * This array contains all features that are enabled in the root richText editor (the one defined in the payload.config.ts).\n * If this field is the root richText editor, or if the root richText editor is not a lexical editor, this array will be empty\n *\n * @Example\n *\n * ```ts\n * editor: lexicalEditor({\n * features: ({ rootFeatures }) => [...rootFeatures, FixedToolbarFeature()],\n * })\n * ```\n */\n rootFeatures: FeatureProviderServer<any, any>[]\n }) => FeatureProviderServer<any, any>[])\n | FeatureProviderServer<any, any>[]\n lexical?: LexicalEditorConfig\n}\n\nexport type LexicalRichTextAdapter = RichTextAdapter<SerializedEditorState, AdapterProps, any> & {\n editorConfig: SanitizedServerEditorConfig\n features: FeatureProviderServer<any, any>[]\n}\n\nexport type LexicalRichTextAdapterProvider =\n /**\n * This is being called during the payload sanitization process\n */\n ({\n config,\n isRoot,\n }: {\n config: SanitizedConfig\n isRoot?: boolean\n }) => Promise<LexicalRichTextAdapter>\n\nexport type FieldProps = RichTextFieldProps<SerializedEditorState, AdapterProps, AdapterProps> & {\n fieldTypes: FieldTypes\n indexPath: string\n path?: string\n permissions: FieldPermissions\n}\n\nexport type AdapterProps = {\n editorConfig: SanitizedServerEditorConfig\n}\n\nexport type GeneratedFeatureProviderComponent = {\n ClientComponent: React.ReactNode\n key: string\n order: number\n}\n"],"names":[],"rangeMappings":"","mappings":"AAiFA,WAIC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@payloadcms/richtext-lexical",
3
- "version": "3.0.0-beta.35",
3
+ "version": "3.0.0-beta.36",
4
4
  "description": "The officially supported Lexical richtext adapter for Payload",
5
5
  "homepage": "https://payloadcms.com",
6
6
  "repository": {
@@ -55,12 +55,12 @@
55
55
  "@lexical/eslint-plugin": "0.15.0",
56
56
  "@types/json-schema": "7.0.15",
57
57
  "@types/node": "20.12.5",
58
- "@types/react": "18.3.2",
59
- "@types/react-dom": "18.3.0",
60
- "@payloadcms/ui": "3.0.0-beta.35",
61
- "payload": "3.0.0-beta.35",
62
- "@payloadcms/next": "3.0.0-beta.35",
63
- "@payloadcms/translations": "3.0.0-beta.35",
58
+ "@types/react": "npm:types-react@19.0.0-beta.2",
59
+ "@types/react-dom": "npm:types-react-dom@19.0.0-beta.2",
60
+ "@payloadcms/next": "3.0.0-beta.36",
61
+ "@payloadcms/translations": "3.0.0-beta.36",
62
+ "@payloadcms/ui": "3.0.0-beta.36",
63
+ "payload": "3.0.0-beta.36",
64
64
  "@payloadcms/eslint-config": "1.1.1"
65
65
  },
66
66
  "peerDependencies": {
@@ -75,12 +75,12 @@
75
75
  "@lexical/selection": "0.15.0",
76
76
  "@lexical/utils": "0.15.0",
77
77
  "lexical": "0.15.0",
78
- "react": "^18.2.0 || ^19.0.0",
79
- "react-dom": "^18.2.0 || ^19.0.0",
80
- "@payloadcms/next": "3.0.0-beta.35",
81
- "@payloadcms/translations": "3.0.0-beta.35",
82
- "@payloadcms/ui": "3.0.0-beta.35",
83
- "payload": "3.0.0-beta.35"
78
+ "react": "^19.0.0 || ^19.0.0-rc-f994737d14-20240522",
79
+ "react-dom": "^19.0.0 || ^19.0.0-rc-f994737d14-20240522",
80
+ "@payloadcms/next": "3.0.0-beta.36",
81
+ "@payloadcms/ui": "3.0.0-beta.36",
82
+ "@payloadcms/translations": "3.0.0-beta.36",
83
+ "payload": "3.0.0-beta.36"
84
84
  },
85
85
  "engines": {
86
86
  "node": ">=18.20.2"
@@ -88,6 +88,10 @@
88
88
  "publishConfig": {
89
89
  "registry": "https://registry.npmjs.org/"
90
90
  },
91
+ "overrides": {
92
+ "@types/react": "npm:types-react@19.0.0-beta.2",
93
+ "@types/react-dom": "npm:types-react-dom@19.0.0-beta.2"
94
+ },
91
95
  "scripts": {
92
96
  "build": "pnpm copyfiles && pnpm build:swc && pnpm build:types",
93
97
  "build:clean": "find . \\( -type d \\( -name build -o -name dist -o -name .cache \\) -o -type f -name tsconfig.tsbuildinfo \\) -exec rm -rf {} + && pnpm build",
@@ -1 +0,0 @@
1
- {"version":3,"file":"getNodeCloseToPoint.d.ts","sourceRoot":"","sources":["../../../../../../src/field/lexical/plugins/handles/DraggableBlockPlugin/getNodeCloseToPoint.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,SAAS,CAAA;AAIzD,OAAO,EAAE,KAAK,EAAE,MAAM,yBAAyB,CAAA;AAW/C,KAAK,KAAK,GAAG;IACX,UAAU,EAAE,WAAW,CAAA;IACvB,eAAe,CAAC,EAAE,MAAM,CAAA;IACxB,MAAM,EAAE,aAAa,CAAA;IACrB,gHAAgH;IAChH,KAAK,CAAC,EAAE,OAAO,CAAA;IACf,gBAAgB,CAAC,EAAE,MAAM,CAAA;IACzB,KAAK,EAAE,KAAK,CAAA;IACZ;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,gBAAgB,CAAC,EAAE,OAAO,CAAA;IAC1B,OAAO,CAAC,EAAE,OAAO,CAAA;CAClB,CAAA;AAED,KAAK,MAAM,GAAG;IACZ,SAAS,EAAE,WAAW,GAAG,IAAI,CAAA;IAC7B,SAAS,EAAE,WAAW,GAAG,IAAI,CAAA;IAC7B,YAAY,EAAE,MAAM,CAAA;IACpB,yBAAyB,EAAE,OAAO,CAAA;CACnC,CAAA;AAaD,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,KAAK,GAAG,MAAM,CAkLxD"}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../../../../src/field/lexical/plugins/handles/DraggableBlockPlugin/getNodeCloseToPoint.ts"],"sourcesContent":["import type { LexicalEditor, LexicalNode } from 'lexical'\n\nimport { $getNodeByKey } from 'lexical'\n\nimport { Point } from '../../../utils/point.js'\nimport { Rect } from '../../../utils/rect.js'\nimport { getCollapsedMargins } from '../utils/getCollapsedMargins.js'\nimport { getTopLevelNodeKeys } from '../utils/getTopLevelNodeKeys.js'\nimport { getBoundingClientRectWithoutTransform } from './getBoundingRectWithoutTransform.js'\n\n// Directions\nconst Downward = 1\nconst Upward = -1\nconst Indeterminate = 0\n\ntype Props = {\n anchorElem: HTMLElement\n cache_threshold?: number\n editor: LexicalEditor\n /** fuzzy makes the search not exact. If no exact match found, find the closes node instead of returning null */\n fuzzy?: boolean\n horizontalOffset?: number\n point: Point\n /**\n * The index to start searching from. It can be a considerable performance optimization to start searching from the index of the\n * previously found node, as the node is likely to be close to the next node.\n */\n startIndex?: number\n useEdgeAsDefault?: boolean\n verbose?: boolean\n}\n\ntype Output = {\n blockElem: HTMLElement | null\n blockNode: LexicalNode | null\n foundAtIndex: number\n isFoundNodeEmptyParagraph: boolean\n}\n\nconst cache = {\n props: null as Props | null,\n result: null as Output | null,\n}\n\nfunction isPointClose(previous: Point, current: Point, threshold: number = 20): boolean {\n const dx = previous.x - current.x\n const dy = previous.y - current.y\n return dx * dx + dy * dy <= threshold * threshold\n}\n\nexport function getNodeCloseToPoint(props: Props): Output {\n const {\n anchorElem,\n cache_threshold = 20,\n editor,\n fuzzy = false,\n horizontalOffset = 0,\n point: { x, y },\n startIndex = 0,\n useEdgeAsDefault = false,\n verbose = false,\n } = props\n\n // Use cache\n if (\n cache_threshold > 0 &&\n cache.props &&\n cache.result &&\n cache.props.fuzzy === props.fuzzy &&\n cache.props.horizontalOffset === props.horizontalOffset &&\n cache.props.useEdgeAsDefault === props.useEdgeAsDefault &&\n isPointClose(cache.props.point, props.point, cache_threshold)\n ) {\n if (verbose) {\n //console.log('Returning cached result')\n }\n return cache.result\n }\n\n const anchorElementRect = anchorElem.getBoundingClientRect()\n const topLevelNodeKeys = getTopLevelNodeKeys(editor)\n\n const closestBlockElem: {\n blockElem: HTMLElement | null\n blockNode: LexicalNode | null\n distance: number\n foundAtIndex: number\n isFoundNodeEmptyParagraph: boolean\n } = {\n blockElem: null,\n blockNode: null,\n distance: Infinity,\n foundAtIndex: -1,\n isFoundNodeEmptyParagraph: false,\n }\n\n // Return null if matching block element is the first or last node\n editor.getEditorState().read(() => {\n if (useEdgeAsDefault) {\n const [firstNode, lastNode] = [\n editor.getElementByKey(topLevelNodeKeys[0]),\n editor.getElementByKey(topLevelNodeKeys[topLevelNodeKeys.length - 1]),\n ]\n\n const [firstNodeRect, lastNodeRect] = [\n getBoundingClientRectWithoutTransform(firstNode),\n getBoundingClientRectWithoutTransform(lastNode),\n ]\n\n if (firstNodeRect && lastNodeRect) {\n if (y < firstNodeRect.top) {\n closestBlockElem.blockElem = firstNode\n closestBlockElem.distance = firstNodeRect.top - y\n closestBlockElem.blockNode = $getNodeByKey(topLevelNodeKeys[0])\n closestBlockElem.foundAtIndex = 0\n } else if (y > lastNodeRect.bottom) {\n closestBlockElem.distance = y - lastNodeRect.bottom\n closestBlockElem.blockNode = $getNodeByKey(topLevelNodeKeys[topLevelNodeKeys.length - 1])\n closestBlockElem.blockElem = lastNode\n closestBlockElem.foundAtIndex = topLevelNodeKeys.length - 1\n }\n\n if (closestBlockElem?.blockElem) {\n if (verbose) {\n //console.log('useEdgeAsDefault', useEdgeAsDefault)\n }\n\n return {\n blockElem: null,\n isFoundNodeEmptyParagraph: false,\n } as Output\n }\n }\n }\n\n // Find matching block element\n let index = startIndex\n let direction = Indeterminate\n\n if (verbose) {\n //console.log('start index', startIndex)\n }\n\n while (index >= 0 && index < topLevelNodeKeys.length) {\n const key = topLevelNodeKeys[index]\n const elem = editor.getElementByKey(key)\n if (elem === null) {\n break\n }\n const point = new Point(x + horizontalOffset, y)\n //const domRect = Rect.fromDOM(elem)\n // Do not consider transform of blocks when calculating distance\n const domRect = Rect.fromDOMRect(getBoundingClientRectWithoutTransform(elem))\n\n const { marginBottom, marginTop } = getCollapsedMargins(elem)\n\n const rect = domRect.generateNewRect({\n bottom: domRect.bottom + marginBottom,\n left: anchorElementRect.left,\n right: anchorElementRect.right,\n top: domRect.top - marginTop,\n })\n\n const { distance, isOnBottomSide, isOnTopSide } = rect.distanceFromPoint(point)\n\n if (verbose) {\n //console.log('distance', distance)\n }\n\n if (distance === 0) {\n closestBlockElem.blockElem = elem\n closestBlockElem.blockNode = $getNodeByKey(key)\n closestBlockElem.foundAtIndex = index\n closestBlockElem.distance = distance\n\n // Check if blockNode is an empty text node\n if (\n closestBlockElem.blockNode &&\n closestBlockElem.blockNode.getType() === 'paragraph' &&\n closestBlockElem.blockNode.getTextContent() === ''\n ) {\n if (!fuzzy) {\n closestBlockElem.blockElem = null\n closestBlockElem.blockNode = null\n }\n\n closestBlockElem.isFoundNodeEmptyParagraph = true\n }\n break\n } else if (fuzzy) {\n if (distance < closestBlockElem.distance) {\n closestBlockElem.blockElem = elem\n closestBlockElem.blockNode = $getNodeByKey(key)\n closestBlockElem.distance = distance\n closestBlockElem.foundAtIndex = index\n }\n }\n\n if (direction === Indeterminate) {\n if (isOnTopSide) {\n direction = Upward\n } else if (isOnBottomSide) {\n direction = Downward\n } else {\n // stop search block element\n direction = Infinity\n }\n }\n\n index += direction\n }\n })\n\n // Store in cache before returning\n cache.props = props\n cache.result = {\n blockElem: closestBlockElem.blockElem,\n blockNode: closestBlockElem.blockNode,\n foundAtIndex: closestBlockElem.foundAtIndex,\n isFoundNodeEmptyParagraph: closestBlockElem.isFoundNodeEmptyParagraph,\n }\n\n return {\n blockElem: closestBlockElem.blockElem,\n blockNode: closestBlockElem.blockNode,\n foundAtIndex: closestBlockElem.foundAtIndex,\n isFoundNodeEmptyParagraph: closestBlockElem.isFoundNodeEmptyParagraph,\n }\n}\n"],"names":["$getNodeByKey","Point","Rect","getCollapsedMargins","getTopLevelNodeKeys","getBoundingClientRectWithoutTransform","Downward","Upward","Indeterminate","cache","props","result","isPointClose","previous","current","threshold","dx","x","dy","y","getNodeCloseToPoint","anchorElem","cache_threshold","editor","fuzzy","horizontalOffset","point","startIndex","useEdgeAsDefault","verbose","anchorElementRect","getBoundingClientRect","topLevelNodeKeys","closestBlockElem","blockElem","blockNode","distance","Infinity","foundAtIndex","isFoundNodeEmptyParagraph","getEditorState","read","firstNode","lastNode","getElementByKey","length","firstNodeRect","lastNodeRect","top","bottom","index","direction","key","elem","domRect","fromDOMRect","marginBottom","marginTop","rect","generateNewRect","left","right","isOnBottomSide","isOnTopSide","distanceFromPoint","getType","getTextContent"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAEA,SAASA,aAAa,QAAQ,UAAS;AAEvC,SAASC,KAAK,QAAQ,0BAAyB;AAC/C,SAASC,IAAI,QAAQ,yBAAwB;AAC7C,SAASC,mBAAmB,QAAQ,kCAAiC;AACrE,SAASC,mBAAmB,QAAQ,kCAAiC;AACrE,SAASC,qCAAqC,QAAQ,uCAAsC;AAE5F,aAAa;AACb,MAAMC,WAAW;AACjB,MAAMC,SAAS,CAAC;AAChB,MAAMC,gBAAgB;AA0BtB,MAAMC,QAAQ;IACZC,OAAO;IACPC,QAAQ;AACV;AAEA,SAASC,aAAaC,QAAe,EAAEC,OAAc,EAAEC,YAAoB,EAAE;IAC3E,MAAMC,KAAKH,SAASI,CAAC,GAAGH,QAAQG,CAAC;IACjC,MAAMC,KAAKL,SAASM,CAAC,GAAGL,QAAQK,CAAC;IACjC,OAAOH,KAAKA,KAAKE,KAAKA,MAAMH,YAAYA;AAC1C;AAEA,OAAO,SAASK,oBAAoBV,KAAY;IAC9C,MAAM,EACJW,UAAU,EACVC,kBAAkB,EAAE,EACpBC,MAAM,EACNC,QAAQ,KAAK,EACbC,mBAAmB,CAAC,EACpBC,OAAO,EAAET,CAAC,EAAEE,CAAC,EAAE,EACfQ,aAAa,CAAC,EACdC,mBAAmB,KAAK,EACxBC,UAAU,KAAK,EAChB,GAAGnB;I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