@webiny/lexical-editor 5.44.1-beta.1 → 5.45.0-beta.0

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 (252) hide show
  1. package/README.md +6 -12
  2. package/commands/image.d.ts +2 -2
  3. package/commands/image.js +2 -8
  4. package/commands/image.js.map +1 -1
  5. package/commands/index.d.ts +5 -4
  6. package/commands/index.js +5 -49
  7. package/commands/index.js.map +1 -1
  8. package/commands/list.d.ts +1 -1
  9. package/commands/list.js +4 -10
  10. package/commands/list.js.map +1 -1
  11. package/commands/quote.d.ts +1 -1
  12. package/commands/quote.js +2 -8
  13. package/commands/quote.js.map +1 -1
  14. package/commands/toolbar.js +2 -8
  15. package/commands/toolbar.js.map +1 -1
  16. package/commands/typography.d.ts +8 -0
  17. package/commands/typography.js +4 -0
  18. package/commands/typography.js.map +1 -0
  19. package/components/Editor/EnsureHeadingTagPlugin.js +10 -16
  20. package/components/Editor/EnsureHeadingTagPlugin.js.map +1 -1
  21. package/components/Editor/RichTextEditor.d.ts +12 -8
  22. package/components/Editor/RichTextEditor.js +89 -102
  23. package/components/Editor/RichTextEditor.js.map +1 -1
  24. package/components/Editor/normalizeInputValue.d.ts +1 -1
  25. package/components/Editor/normalizeInputValue.js +2 -8
  26. package/components/Editor/normalizeInputValue.js.map +1 -1
  27. package/components/LexicalEditorConfig/LexicalEditorConfig.d.ts +2 -3
  28. package/components/LexicalEditorConfig/LexicalEditorConfig.js +21 -32
  29. package/components/LexicalEditorConfig/LexicalEditorConfig.js.map +1 -1
  30. package/components/LexicalEditorConfig/components/Node.d.ts +1 -1
  31. package/components/LexicalEditorConfig/components/Node.js +17 -26
  32. package/components/LexicalEditorConfig/components/Node.js.map +1 -1
  33. package/components/LexicalEditorConfig/components/Plugin.js +17 -26
  34. package/components/LexicalEditorConfig/components/Plugin.js.map +1 -1
  35. package/components/LexicalEditorConfig/components/ToolbarElement.js +17 -26
  36. package/components/LexicalEditorConfig/components/ToolbarElement.js.map +1 -1
  37. package/components/LexicalHtmlRenderer.d.ts +4 -7
  38. package/components/LexicalHtmlRenderer.js +35 -53
  39. package/components/LexicalHtmlRenderer.js.map +1 -1
  40. package/components/Toolbar/StaticToolbar.css +416 -0
  41. package/components/Toolbar/StaticToolbar.d.ts +3 -1
  42. package/components/Toolbar/StaticToolbar.js +19 -23
  43. package/components/Toolbar/StaticToolbar.js.map +1 -1
  44. package/components/ToolbarActions/BoldAction.js +16 -21
  45. package/components/ToolbarActions/BoldAction.js.map +1 -1
  46. package/components/ToolbarActions/BulletListAction.js +25 -31
  47. package/components/ToolbarActions/BulletListAction.js.map +1 -1
  48. package/components/ToolbarActions/CodeHighlightAction.js +16 -21
  49. package/components/ToolbarActions/CodeHighlightAction.js.map +1 -1
  50. package/components/ToolbarActions/FontColorAction.js +32 -42
  51. package/components/ToolbarActions/FontColorAction.js.map +1 -1
  52. package/components/ToolbarActions/ImageAction.js +19 -34
  53. package/components/ToolbarActions/ImageAction.js.map +1 -1
  54. package/components/ToolbarActions/ItalicAction.js +16 -21
  55. package/components/ToolbarActions/ItalicAction.js.map +1 -1
  56. package/components/ToolbarActions/LinkAction.js +19 -24
  57. package/components/ToolbarActions/LinkAction.js.map +1 -1
  58. package/components/ToolbarActions/NumberedListAction.js +25 -36
  59. package/components/ToolbarActions/NumberedListAction.js.map +1 -1
  60. package/components/ToolbarActions/QuoteAction.js +20 -25
  61. package/components/ToolbarActions/QuoteAction.js.map +1 -1
  62. package/components/ToolbarActions/TextAlignmentAction.js +36 -45
  63. package/components/ToolbarActions/TextAlignmentAction.js.map +1 -1
  64. package/components/ToolbarActions/TypographyAction.js +57 -79
  65. package/components/ToolbarActions/TypographyAction.js.map +1 -1
  66. package/components/ToolbarActions/UnderlineAction.js +16 -21
  67. package/components/ToolbarActions/UnderlineAction.js.map +1 -1
  68. package/context/FontColorActionContext.js +2 -9
  69. package/context/FontColorActionContext.js.map +1 -1
  70. package/context/RichTextEditorContext.d.ts +6 -7
  71. package/context/RichTextEditorContext.js +28 -26
  72. package/context/RichTextEditorContext.js.map +1 -1
  73. package/context/SharedHistoryContext.d.ts +2 -2
  74. package/context/SharedHistoryContext.js +12 -20
  75. package/context/SharedHistoryContext.js.map +1 -1
  76. package/context/TextAlignmentActionContextProps.d.ts +1 -1
  77. package/context/TextAlignmentActionContextProps.js +2 -9
  78. package/context/TextAlignmentActionContextProps.js.map +1 -1
  79. package/context/TypographyActionContext.d.ts +3 -2
  80. package/context/TypographyActionContext.js +2 -9
  81. package/context/TypographyActionContext.js.map +1 -1
  82. package/exports/admin/lexical.d.ts +15 -0
  83. package/exports/admin/lexical.js +23 -0
  84. package/exports/admin/lexical.js.map +1 -0
  85. package/hooks/index.d.ts +7 -8
  86. package/hooks/index.js +7 -93
  87. package/hooks/index.js.map +1 -1
  88. package/hooks/useCurrentElement.d.ts +3 -3
  89. package/hooks/useCurrentElement.js +11 -18
  90. package/hooks/useCurrentElement.js.map +1 -1
  91. package/hooks/useCurrentSelection.d.ts +2 -1
  92. package/hooks/useCurrentSelection.js +27 -40
  93. package/hooks/useCurrentSelection.js.map +1 -1
  94. package/hooks/useFontColorPicker.d.ts +1 -1
  95. package/hooks/useFontColorPicker.js +5 -11
  96. package/hooks/useFontColorPicker.js.map +1 -1
  97. package/hooks/useIsMounted.js +6 -14
  98. package/hooks/useIsMounted.js.map +1 -1
  99. package/hooks/useRichTextEditor.d.ts +1 -1
  100. package/hooks/useRichTextEditor.js +5 -11
  101. package/hooks/useRichTextEditor.js.map +1 -1
  102. package/hooks/useTextAlignmentAction.d.ts +1 -1
  103. package/hooks/useTextAlignmentAction.js +5 -11
  104. package/hooks/useTextAlignmentAction.js.map +1 -1
  105. package/hooks/useTypographyAction.d.ts +1 -1
  106. package/hooks/useTypographyAction.js +5 -11
  107. package/hooks/useTypographyAction.js.map +1 -1
  108. package/index.d.ts +33 -38
  109. package/index.js +44 -322
  110. package/index.js.map +1 -1
  111. package/package.json +18 -22
  112. package/plugins/BlurEventPlugin/BlurEventPlugin.d.ts +2 -2
  113. package/plugins/BlurEventPlugin/BlurEventPlugin.js +16 -22
  114. package/plugins/BlurEventPlugin/BlurEventPlugin.js.map +1 -1
  115. package/plugins/CodeHighlightPlugin/CodeHighlightPlugin.js +9 -14
  116. package/plugins/CodeHighlightPlugin/CodeHighlightPlugin.js.map +1 -1
  117. package/plugins/CodeHighlightPlugin/index.d.ts +1 -1
  118. package/plugins/CodeHighlightPlugin/index.js +1 -16
  119. package/plugins/CodeHighlightPlugin/index.js.map +1 -1
  120. package/plugins/FloatingLinkEditorPlugin/FloatingLinkEditor.d.ts +10 -0
  121. package/plugins/FloatingLinkEditorPlugin/FloatingLinkEditor.js +28 -0
  122. package/plugins/FloatingLinkEditorPlugin/FloatingLinkEditor.js.map +1 -0
  123. package/plugins/FloatingLinkEditorPlugin/FloatingLinkEditorController.d.ts +7 -0
  124. package/plugins/FloatingLinkEditorPlugin/FloatingLinkEditorController.js +61 -0
  125. package/plugins/FloatingLinkEditorPlugin/FloatingLinkEditorController.js.map +1 -0
  126. package/plugins/FloatingLinkEditorPlugin/FloatingLinkEditorPlugin.css +2 -136
  127. package/plugins/FloatingLinkEditorPlugin/FloatingLinkEditorPlugin.d.ts +4 -16
  128. package/plugins/FloatingLinkEditorPlugin/FloatingLinkEditorPlugin.js +7 -180
  129. package/plugins/FloatingLinkEditorPlugin/FloatingLinkEditorPlugin.js.map +1 -1
  130. package/plugins/FloatingLinkEditorPlugin/index.d.ts +1 -1
  131. package/plugins/FloatingLinkEditorPlugin/index.js +1 -16
  132. package/plugins/FloatingLinkEditorPlugin/index.js.map +1 -1
  133. package/plugins/FloatingLinkEditorPlugin/isChildOfLinkEditor.js +3 -9
  134. package/plugins/FloatingLinkEditorPlugin/isChildOfLinkEditor.js.map +1 -1
  135. package/plugins/FloatingLinkEditorPlugin/types.d.ts +10 -0
  136. package/plugins/FloatingLinkEditorPlugin/types.js +3 -0
  137. package/plugins/FloatingLinkEditorPlugin/types.js.map +1 -0
  138. package/plugins/FloatingLinkEditorPlugin/useFloatingLinkEditor.d.ts +8 -2
  139. package/plugins/FloatingLinkEditorPlugin/useFloatingLinkEditor.js +120 -88
  140. package/plugins/FloatingLinkEditorPlugin/useFloatingLinkEditor.js.map +1 -1
  141. package/plugins/FontColorPlugin/FontColorPlugin.js +19 -22
  142. package/plugins/FontColorPlugin/FontColorPlugin.js.map +1 -1
  143. package/plugins/FontColorPlugin/applyColorToNode.d.ts +2 -2
  144. package/plugins/FontColorPlugin/applyColorToNode.js +4 -10
  145. package/plugins/FontColorPlugin/applyColorToNode.js.map +1 -1
  146. package/plugins/FontColorPlugin/applyColorToSelection.d.ts +2 -2
  147. package/plugins/FontColorPlugin/applyColorToSelection.js +28 -44
  148. package/plugins/FontColorPlugin/applyColorToSelection.js.map +1 -1
  149. package/plugins/ImagesPlugin/ImagesPlugin.d.ts +1 -2
  150. package/plugins/ImagesPlugin/ImagesPlugin.js +58 -60
  151. package/plugins/ImagesPlugin/ImagesPlugin.js.map +1 -1
  152. package/plugins/LinkPlugin/LinkPlugin.js +29 -37
  153. package/plugins/LinkPlugin/LinkPlugin.js.map +1 -1
  154. package/plugins/ListPLugin/ListPlugin.js +52 -15
  155. package/plugins/ListPLugin/ListPlugin.js.map +1 -1
  156. package/plugins/QuoteNodePlugin/QuoteNodePlugin.js +19 -16
  157. package/plugins/QuoteNodePlugin/QuoteNodePlugin.js.map +1 -1
  158. package/plugins/StateHandlingPlugin.d.ts +1 -1
  159. package/plugins/StateHandlingPlugin.js +32 -39
  160. package/plugins/StateHandlingPlugin.js.map +1 -1
  161. package/plugins/TypographyPlugin/TypographyPlugin.js +17 -21
  162. package/plugins/TypographyPlugin/TypographyPlugin.js.map +1 -1
  163. package/types.d.ts +4 -4
  164. package/types.js +6 -38
  165. package/types.js.map +1 -1
  166. package/ui/ContentEditable.d.ts +0 -1
  167. package/ui/ContentEditable.js +7 -14
  168. package/ui/ContentEditable.js.map +1 -1
  169. package/ui/Divider.d.ts +0 -1
  170. package/ui/Divider.js +3 -10
  171. package/ui/Divider.js.map +1 -1
  172. package/ui/DropDown.d.ts +1 -1
  173. package/ui/DropDown.js +64 -90
  174. package/ui/DropDown.js.map +1 -1
  175. package/ui/ImageResizer.d.ts +0 -1
  176. package/ui/ImageResizer.js +78 -83
  177. package/ui/ImageResizer.js.map +1 -1
  178. package/ui/LinkPreview.d.ts +0 -1
  179. package/ui/LinkPreview.js +22 -29
  180. package/ui/LinkPreview.js.map +1 -1
  181. package/ui/Placeholder.d.ts +1 -1
  182. package/ui/Placeholder.js +10 -16
  183. package/ui/Placeholder.js.map +1 -1
  184. package/ui/TextInput.d.ts +0 -1
  185. package/ui/TextInput.js +11 -18
  186. package/ui/TextInput.js.map +1 -1
  187. package/ui/ToolbarActionDialog.js +30 -42
  188. package/ui/ToolbarActionDialog.js.map +1 -1
  189. package/utils/canUseDOM.js +1 -7
  190. package/utils/canUseDOM.js.map +1 -1
  191. package/utils/files.d.ts +6 -6
  192. package/utils/files.js +5 -32
  193. package/utils/files.js.map +1 -1
  194. package/utils/getDOMRangeRect.js +4 -10
  195. package/utils/getDOMRangeRect.js.map +1 -1
  196. package/utils/getSelectedNode.d.ts +1 -1
  197. package/utils/getSelectedNode.js +9 -16
  198. package/utils/getSelectedNode.js.map +1 -1
  199. package/utils/getTransparentImage.js +1 -7
  200. package/utils/getTransparentImage.js.map +1 -1
  201. package/utils/insertImage.d.ts +1 -1
  202. package/utils/insertImage.js +8 -14
  203. package/utils/insertImage.js.map +1 -1
  204. package/utils/isAnchorLink.js +1 -7
  205. package/utils/isAnchorLink.js.map +1 -1
  206. package/utils/isChildOfFloatingToolbar.js +3 -12
  207. package/utils/isChildOfFloatingToolbar.js.map +1 -1
  208. package/utils/isHTMLElement.js +1 -7
  209. package/utils/isHTMLElement.js.map +1 -1
  210. package/utils/isValidJSON.js +3 -9
  211. package/utils/isValidJSON.js.map +1 -1
  212. package/utils/isValidLexicalData.d.ts +3 -3
  213. package/utils/isValidLexicalData.js +6 -12
  214. package/utils/isValidLexicalData.js.map +1 -1
  215. package/utils/point.js +35 -60
  216. package/utils/point.js.map +1 -1
  217. package/utils/rect.d.ts +1 -1
  218. package/utils/rect.js +115 -149
  219. package/utils/rect.js.map +1 -1
  220. package/utils/sanitizeUrl.js +6 -13
  221. package/utils/sanitizeUrl.js.map +1 -1
  222. package/utils/setFloatingElemPosition.d.ts +1 -1
  223. package/utils/setFloatingElemPosition.js +24 -30
  224. package/utils/setFloatingElemPosition.js.map +1 -1
  225. package/components/Editor/HeadingEditor.d.ts +0 -7
  226. package/components/Editor/HeadingEditor.js +0 -30
  227. package/components/Editor/HeadingEditor.js.map +0 -1
  228. package/components/Editor/ParagraphEditor.d.ts +0 -7
  229. package/components/Editor/ParagraphEditor.js +0 -29
  230. package/components/Editor/ParagraphEditor.js.map +0 -1
  231. package/components/Toolbar/Toolbar.css +0 -643
  232. package/components/Toolbar/Toolbar.d.ts +0 -11
  233. package/components/Toolbar/Toolbar.js +0 -165
  234. package/components/Toolbar/Toolbar.js.map +0 -1
  235. package/components/ToolbarActions/FontSizeAction.d.ts +0 -14
  236. package/components/ToolbarActions/FontSizeAction.js +0 -109
  237. package/components/ToolbarActions/FontSizeAction.js.map +0 -1
  238. package/hooks/useList.d.ts +0 -2
  239. package/hooks/useList.js +0 -54
  240. package/hooks/useList.js.map +0 -1
  241. package/hooks/useQuote.d.ts +0 -2
  242. package/hooks/useQuote.js +0 -22
  243. package/hooks/useQuote.js.map +0 -1
  244. package/plugins/FloatingLinkEditorPlugin/LinkEditForm.d.ts +0 -9
  245. package/plugins/FloatingLinkEditorPlugin/LinkEditForm.js +0 -118
  246. package/plugins/FloatingLinkEditorPlugin/LinkEditForm.js.map +0 -1
  247. package/plugins/FloatingLinkEditorPlugin/LinkPreviewForm.d.ts +0 -9
  248. package/plugins/FloatingLinkEditorPlugin/LinkPreviewForm.js +0 -44
  249. package/plugins/FloatingLinkEditorPlugin/LinkPreviewForm.js.map +0 -1
  250. package/utils/generateInitialLexicalValue.d.ts +0 -4
  251. package/utils/generateInitialLexicalValue.js +0 -33
  252. package/utils/generateInitialLexicalValue.js.map +0 -1
package/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"names":["_LexicalHtmlRenderer","require","_hooks","Object","keys","forEach","key","prototype","hasOwnProperty","call","_exportNames","exports","defineProperty","enumerable","get","_Divider","_DropDown","_BoldAction","_BulletListAction","_CodeHighlightAction","_FontSizeAction","_FontColorAction","_ItalicAction","_LinkAction","_NumberedListAction","_QuoteAction","_UnderlineAction","_TypographyAction","_TextAlignmentAction","_ImageAction","_Toolbar","_StaticToolbar","_RichTextEditor","_HeadingEditor","_ParagraphEditor","_StateHandlingPlugin","_LinkPlugin","_FloatingLinkEditorPlugin","_CodeHighlightPlugin","_BlurEventPlugin","_FontColorPlugin","_TypographyPlugin","_QuoteNodePlugin","_ListPlugin","_ImagesPlugin","_generateInitialLexicalValue","_isValidLexicalData","_commands","_types","_interopRequireWildcard","types","_LexicalEditorConfig"],"sources":["index.ts"],"sourcesContent":["// render\nexport { LexicalHtmlRenderer } from \"~/components/LexicalHtmlRenderer\";\n// hooks\nexport * from \"./hooks\";\n// UI elements\nexport { Divider } from \"~/ui/Divider\";\nexport { DropDownItem } from \"~/ui/DropDown\";\nexport { DropDown } from \"~/ui/DropDown\";\n// actions\nexport { BoldAction } from \"~/components/ToolbarActions/BoldAction\";\nexport { BulletListAction } from \"~/components/ToolbarActions/BulletListAction\";\nexport { CodeHighlightAction } from \"~/components/ToolbarActions/CodeHighlightAction\";\nexport { FontSizeAction } from \"~/components/ToolbarActions/FontSizeAction\";\nexport { FontColorAction } from \"~/components/ToolbarActions/FontColorAction\";\nexport { ItalicAction } from \"~/components/ToolbarActions/ItalicAction\";\nexport { LinkAction } from \"~/components/ToolbarActions/LinkAction\";\nexport { NumberedListAction } from \"~/components/ToolbarActions/NumberedListAction\";\nexport { QuoteAction } from \"~/components/ToolbarActions/QuoteAction\";\nexport { UnderlineAction } from \"~/components/ToolbarActions/UnderlineAction\";\nexport { TypographyAction } from \"~/components/ToolbarActions/TypographyAction\";\nexport { TextAlignmentAction } from \"~/components/ToolbarActions/TextAlignmentAction\";\nexport { ImageAction } from \"~/components/ToolbarActions/ImageAction\";\n// toolbars\nexport { Toolbar } from \"~/components/Toolbar/Toolbar\";\nexport { StaticToolbar } from \"~/components/Toolbar/StaticToolbar\";\n// editor\nexport { RichTextEditor } from \"~/components/Editor/RichTextEditor\";\nexport { HeadingEditor } from \"~/components/Editor/HeadingEditor\";\nexport { ParagraphEditor } from \"~/components/Editor/ParagraphEditor\";\n// plugins\nexport { StateHandlingPlugin } from \"~/plugins/StateHandlingPlugin\";\nexport { LinkPlugin } from \"~/plugins/LinkPlugin/LinkPlugin\";\nexport { FloatingLinkEditorPlugin } from \"~/plugins/FloatingLinkEditorPlugin/FloatingLinkEditorPlugin\";\nexport { CodeHighlightPlugin } from \"~/plugins/CodeHighlightPlugin/CodeHighlightPlugin\";\nexport { BlurEventPlugin } from \"~/plugins/BlurEventPlugin/BlurEventPlugin\";\nexport { FontColorPlugin } from \"~/plugins/FontColorPlugin/FontColorPlugin\";\nexport { TypographyPlugin } from \"~/plugins/TypographyPlugin/TypographyPlugin\";\nexport { QuotePlugin } from \"~/plugins/QuoteNodePlugin/QuoteNodePlugin\";\nexport { ListPlugin } from \"~/plugins/ListPLugin/ListPlugin\";\nexport { ImagesPlugin } from \"~/plugins/ImagesPlugin/ImagesPlugin\";\n// utils\nexport { generateInitialLexicalValue } from \"~/utils/generateInitialLexicalValue\";\nexport { isValidLexicalData } from \"~/utils/isValidLexicalData\";\n// Commands\nexport * from \"~/commands\";\n// types\nexport * as types from \"./types\";\n// config\nexport {\n LexicalEditorConfig,\n useLexicalEditorConfig\n} from \"~/components/LexicalEditorConfig/LexicalEditorConfig\";\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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","FontColorAction","ItalicAction","LinkAction","NumberedListAction","QuoteAction","UnderlineAction","TypographyAction","TextAlignmentAction","ImageAction","StaticToolbar","RichTextEditor","LinkPlugin","FloatingLinkEditorPlugin","CodeHighlightPlugin","BlurEventPlugin","FontColorPlugin","TypographyPlugin","QuotePlugin","ListPlugin","ImagesPlugin","StateHandlingPlugin","isValidLexicalData","types","LexicalEditorConfig","useLexicalEditorConfig"],"sources":["index.ts"],"sourcesContent":["// render\nexport { LexicalHtmlRenderer } from \"~/components/LexicalHtmlRenderer.js\";\n// hooks\nexport * from \"./hooks/index.js\";\n// UI elements\nexport { Divider } from \"~/ui/Divider.js\";\nexport { DropDownItem } from \"~/ui/DropDown.js\";\nexport { DropDown } from \"~/ui/DropDown.js\";\n// actions\nexport { BoldAction } from \"~/components/ToolbarActions/BoldAction.js\";\nexport { BulletListAction } from \"~/components/ToolbarActions/BulletListAction.js\";\nexport { CodeHighlightAction } from \"~/components/ToolbarActions/CodeHighlightAction.js\";\nexport { FontColorAction } from \"~/components/ToolbarActions/FontColorAction.js\";\nexport { ItalicAction } from \"~/components/ToolbarActions/ItalicAction.js\";\nexport { LinkAction } from \"~/components/ToolbarActions/LinkAction.js\";\nexport { NumberedListAction } from \"~/components/ToolbarActions/NumberedListAction.js\";\nexport { QuoteAction } from \"~/components/ToolbarActions/QuoteAction.js\";\nexport { UnderlineAction } from \"~/components/ToolbarActions/UnderlineAction.js\";\nexport { TypographyAction } from \"~/components/ToolbarActions/TypographyAction.js\";\nexport { TextAlignmentAction } from \"~/components/ToolbarActions/TextAlignmentAction.js\";\nexport { ImageAction } from \"~/components/ToolbarActions/ImageAction.js\";\n// toolbars\nexport { StaticToolbar } from \"~/components/Toolbar/StaticToolbar.js\";\n// editor\nexport { RichTextEditor } from \"~/components/Editor/RichTextEditor.js\";\n// plugins\nexport { LinkPlugin } from \"~/plugins/LinkPlugin/LinkPlugin.js\";\nexport { FloatingLinkEditorPlugin } from \"~/plugins/FloatingLinkEditorPlugin/FloatingLinkEditorPlugin.js\";\nexport { CodeHighlightPlugin } from \"~/plugins/CodeHighlightPlugin/CodeHighlightPlugin.js\";\nexport { BlurEventPlugin } from \"~/plugins/BlurEventPlugin/BlurEventPlugin.js\";\nexport { FontColorPlugin } from \"~/plugins/FontColorPlugin/FontColorPlugin.js\";\nexport { TypographyPlugin } from \"~/plugins/TypographyPlugin/TypographyPlugin.js\";\nexport { QuotePlugin } from \"~/plugins/QuoteNodePlugin/QuoteNodePlugin.js\";\nexport { ListPlugin } from \"~/plugins/ListPLugin/ListPlugin.js\";\nexport { ImagesPlugin } from \"~/plugins/ImagesPlugin/ImagesPlugin.js\";\nexport { StateHandlingPlugin } from \"~/plugins/StateHandlingPlugin.js\";\n// utils\nexport { isValidLexicalData } from \"~/utils/isValidLexicalData.js\";\n// Commands\nexport * from \"~/commands/index.js\";\n// types\nexport * as types from \"./types.js\";\n// config\nexport {\n LexicalEditorConfig,\n useLexicalEditorConfig\n} from \"~/components/LexicalEditorConfig/LexicalEditorConfig.js\";\n"],"mappings":"AAAA;AACA,SAASA,mBAAmB;AAC5B;AACA;AACA;AACA,SAASC,OAAO;AAChB,SAASC,YAAY;AACrB,SAASC,QAAQ;AACjB;AACA,SAASC,UAAU;AACnB,SAASC,gBAAgB;AACzB,SAASC,mBAAmB;AAC5B,SAASC,eAAe;AACxB,SAASC,YAAY;AACrB,SAASC,UAAU;AACnB,SAASC,kBAAkB;AAC3B,SAASC,WAAW;AACpB,SAASC,eAAe;AACxB,SAASC,gBAAgB;AACzB,SAASC,mBAAmB;AAC5B,SAASC,WAAW;AACpB;AACA,SAASC,aAAa;AACtB;AACA,SAASC,cAAc;AACvB;AACA,SAASC,UAAU;AACnB,SAASC,wBAAwB;AACjC,SAASC,mBAAmB;AAC5B,SAASC,eAAe;AACxB,SAASC,eAAe;AACxB,SAASC,gBAAgB;AACzB,SAASC,WAAW;AACpB,SAASC,UAAU;AACnB,SAASC,YAAY;AACrB,SAASC,mBAAmB;AAC5B;AACA,SAASC,kBAAkB;AAC3B;AACA;AACA;AACA,OAAO,KAAKC,KAAK;AACjB;AACA,SACIC,mBAAmB,EACnBC,sBAAsB","ignoreList":[]}
package/package.json CHANGED
@@ -1,40 +1,36 @@
1
1
  {
2
2
  "name": "@webiny/lexical-editor",
3
- "version": "5.44.1-beta.1",
3
+ "version": "5.45.0-beta.0",
4
+ "type": "module",
4
5
  "repository": {
5
6
  "type": "git",
6
7
  "url": "https://github.com/webiny/webiny-js.git"
7
8
  },
8
9
  "license": "MIT",
9
10
  "dependencies": {
10
- "@emotion/react": "11.10.8",
11
- "@lexical/code": "0.23.1",
12
- "@lexical/history": "0.23.1",
13
- "@lexical/react": "0.23.1",
14
- "@lexical/rich-text": "0.23.1",
15
- "@lexical/selection": "0.23.1",
16
- "@lexical/text": "0.23.1",
17
- "@lexical/utils": "0.23.1",
18
- "@webiny/lexical-nodes": "5.44.1-beta.1",
19
- "@webiny/lexical-theme": "5.44.1-beta.1",
20
- "@webiny/react-composition": "5.44.1-beta.1",
21
- "@webiny/react-properties": "5.44.1-beta.1",
22
- "emotion": "10.0.27",
23
- "lexical": "0.23.1",
24
- "lodash": "4.17.21",
11
+ "@floating-ui/dom": "1.7.5",
12
+ "@lexical/code": "0.40.0",
13
+ "@lexical/history": "0.40.0",
14
+ "@lexical/react": "0.40.0",
15
+ "@lexical/rich-text": "0.40.0",
16
+ "@lexical/selection": "0.40.0",
17
+ "@lexical/text": "0.40.0",
18
+ "@lexical/utils": "0.40.0",
19
+ "@webiny/lexical-nodes": "5.45.0-beta.0",
20
+ "@webiny/lexical-theme": "5.45.0-beta.0",
21
+ "@webiny/react-composition": "5.45.0-beta.0",
22
+ "@webiny/react-properties": "5.45.0-beta.0",
23
+ "lexical": "0.40.0",
24
+ "lodash": "4.17.23",
25
25
  "react": "18.2.0",
26
26
  "react-dom": "18.2.0"
27
27
  },
28
28
  "devDependencies": {
29
- "@webiny/project-utils": "5.44.1-beta.1"
29
+ "@webiny/build-tools": "5.45.0-beta.0"
30
30
  },
31
31
  "publishConfig": {
32
32
  "access": "public",
33
33
  "directory": "dist"
34
34
  },
35
- "scripts": {
36
- "build": "node ../cli/bin.js run build",
37
- "watch": "node ../cli/bin.js run watch"
38
- },
39
- "gitHead": "ff5f085c417040291d39fdbe5153067f3a23ed86"
35
+ "gitHead": "b85c33cfbe7c02c130445c918d913ef4b2c09cb2"
40
36
  }
@@ -1,5 +1,5 @@
1
- import { FC } from "react";
2
- import { LexicalValue } from "../../types";
1
+ import type { FC } from "react";
2
+ import type { LexicalValue } from "../../types.js";
3
3
  interface BlurEventPlugin {
4
4
  onBlur?: (editorState: LexicalValue) => void;
5
5
  }
@@ -1,25 +1,19 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.BlurEventPlugin = void 0;
7
- var _react = require("react");
8
- var _lexical = require("lexical");
9
- var _hooks = require("../../hooks");
10
- var BlurEventPlugin = exports.BlurEventPlugin = function BlurEventPlugin(_ref) {
11
- var onBlur = _ref.onBlur;
12
- var _useRichTextEditor = (0, _hooks.useRichTextEditor)(),
13
- editor = _useRichTextEditor.editor;
14
- (0, _react.useEffect)(function () {
15
- return editor.registerCommand(_lexical.BLUR_COMMAND, function () {
16
- if (typeof onBlur === "function") {
17
- var editorState = editor.getEditorState();
18
- onBlur(JSON.stringify(editorState.toJSON()));
19
- }
20
- return false;
21
- }, _lexical.COMMAND_PRIORITY_LOW);
22
- }, []);
1
+ import { useEffect } from "react";
2
+ import { BLUR_COMMAND, COMMAND_PRIORITY_LOW } from "lexical";
3
+ import { useRichTextEditor } from "../../hooks/index.js";
4
+ export const BlurEventPlugin = ({
5
+ onBlur
6
+ }) => {
7
+ const {
8
+ editor
9
+ } = useRichTextEditor();
10
+ useEffect(() => editor.registerCommand(BLUR_COMMAND, () => {
11
+ if (typeof onBlur === "function") {
12
+ const editorState = editor.getEditorState();
13
+ onBlur(JSON.stringify(editorState.toJSON()));
14
+ }
15
+ return false;
16
+ }, COMMAND_PRIORITY_LOW), []);
23
17
  return null;
24
18
  };
25
19
 
@@ -1 +1 @@
1
- {"version":3,"names":["_react","require","_lexical","_hooks","BlurEventPlugin","exports","_ref","onBlur","_useRichTextEditor","useRichTextEditor","editor","useEffect","registerCommand","BLUR_COMMAND","editorState","getEditorState","JSON","stringify","toJSON","COMMAND_PRIORITY_LOW"],"sources":["BlurEventPlugin.tsx"],"sourcesContent":["import { FC, useEffect } from \"react\";\nimport { BLUR_COMMAND, COMMAND_PRIORITY_LOW } from \"lexical\";\nimport { LexicalValue } from \"~/types\";\nimport { useRichTextEditor } from \"~/hooks\";\n\ninterface BlurEventPlugin {\n onBlur?: (editorState: LexicalValue) => void;\n}\n\nexport const BlurEventPlugin: FC<BlurEventPlugin> = ({ onBlur }) => {\n const { editor } = useRichTextEditor();\n\n useEffect(\n () =>\n editor.registerCommand(\n BLUR_COMMAND,\n () => {\n if (typeof onBlur === \"function\") {\n const editorState = editor.getEditorState();\n onBlur(JSON.stringify(editorState.toJSON()));\n }\n return false;\n },\n COMMAND_PRIORITY_LOW\n ),\n []\n );\n return null;\n};\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AAEA,IAAAE,MAAA,GAAAF,OAAA;AAMO,IAAMG,eAAoC,GAAAC,OAAA,CAAAD,eAAA,GAAG,SAAvCA,eAAoCA,CAAAE,IAAA,EAAmB;EAAA,IAAbC,MAAM,GAAAD,IAAA,CAANC,MAAM;EACzD,IAAAC,kBAAA,GAAmB,IAAAC,wBAAiB,EAAC,CAAC;IAA9BC,MAAM,GAAAF,kBAAA,CAANE,MAAM;EAEd,IAAAC,gBAAS,EACL;IAAA,OACID,MAAM,CAACE,eAAe,CAClBC,qBAAY,EACZ,YAAM;MACF,IAAI,OAAON,MAAM,KAAK,UAAU,EAAE;QAC9B,IAAMO,WAAW,GAAGJ,MAAM,CAACK,cAAc,CAAC,CAAC;QAC3CR,MAAM,CAACS,IAAI,CAACC,SAAS,CAACH,WAAW,CAACI,MAAM,CAAC,CAAC,CAAC,CAAC;MAChD;MACA,OAAO,KAAK;IAChB,CAAC,EACDC,6BACJ,CAAC;EAAA,GACL,EACJ,CAAC;EACD,OAAO,IAAI;AACf,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["useEffect","BLUR_COMMAND","COMMAND_PRIORITY_LOW","useRichTextEditor","BlurEventPlugin","onBlur","editor","registerCommand","editorState","getEditorState","JSON","stringify","toJSON"],"sources":["BlurEventPlugin.tsx"],"sourcesContent":["import type { FC } from \"react\";\nimport { useEffect } from \"react\";\nimport { BLUR_COMMAND, COMMAND_PRIORITY_LOW } from \"lexical\";\nimport type { LexicalValue } from \"~/types.js\";\nimport { useRichTextEditor } from \"~/hooks/index.js\";\n\ninterface BlurEventPlugin {\n onBlur?: (editorState: LexicalValue) => void;\n}\n\nexport const BlurEventPlugin: FC<BlurEventPlugin> = ({ onBlur }) => {\n const { editor } = useRichTextEditor();\n\n useEffect(\n () =>\n editor.registerCommand(\n BLUR_COMMAND,\n () => {\n if (typeof onBlur === \"function\") {\n const editorState = editor.getEditorState();\n onBlur(JSON.stringify(editorState.toJSON()));\n }\n return false;\n },\n COMMAND_PRIORITY_LOW\n ),\n []\n );\n return null;\n};\n"],"mappings":"AACA,SAASA,SAAS,QAAQ,OAAO;AACjC,SAASC,YAAY,EAAEC,oBAAoB,QAAQ,SAAS;AAE5D,SAASC,iBAAiB;AAM1B,OAAO,MAAMC,eAAoC,GAAGA,CAAC;EAAEC;AAAO,CAAC,KAAK;EAChE,MAAM;IAAEC;EAAO,CAAC,GAAGH,iBAAiB,CAAC,CAAC;EAEtCH,SAAS,CACL,MACIM,MAAM,CAACC,eAAe,CAClBN,YAAY,EACZ,MAAM;IACF,IAAI,OAAOI,MAAM,KAAK,UAAU,EAAE;MAC9B,MAAMG,WAAW,GAAGF,MAAM,CAACG,cAAc,CAAC,CAAC;MAC3CJ,MAAM,CAACK,IAAI,CAACC,SAAS,CAACH,WAAW,CAACI,MAAM,CAAC,CAAC,CAAC,CAAC;IAChD;IACA,OAAO,KAAK;EAChB,CAAC,EACDV,oBACJ,CAAC,EACL,EACJ,CAAC;EACD,OAAO,IAAI;AACf,CAAC","ignoreList":[]}
@@ -1,17 +1,12 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.CodeHighlightPlugin = CodeHighlightPlugin;
7
- var _react = require("react");
8
- var _code = require("@lexical/code");
9
- var _hooks = require("../../hooks");
10
- function CodeHighlightPlugin() {
11
- var _useRichTextEditor = (0, _hooks.useRichTextEditor)(),
12
- editor = _useRichTextEditor.editor;
13
- (0, _react.useEffect)(function () {
14
- return (0, _code.registerCodeHighlighting)(editor);
1
+ import { useEffect } from "react";
2
+ import { registerCodeHighlighting } from "@lexical/code";
3
+ import { useRichTextEditor } from "../../hooks/index.js";
4
+ export function CodeHighlightPlugin() {
5
+ const {
6
+ editor
7
+ } = useRichTextEditor();
8
+ useEffect(() => {
9
+ return registerCodeHighlighting(editor);
15
10
  }, [editor]);
16
11
  return null;
17
12
  }
@@ -1 +1 @@
1
- {"version":3,"names":["_react","require","_code","_hooks","CodeHighlightPlugin","_useRichTextEditor","useRichTextEditor","editor","useEffect","registerCodeHighlighting"],"sources":["CodeHighlightPlugin.tsx"],"sourcesContent":["import { useEffect } from \"react\";\nimport { registerCodeHighlighting } from \"@lexical/code\";\nimport { useRichTextEditor } from \"~/hooks\";\n\nexport function CodeHighlightPlugin() {\n const { editor } = useRichTextEditor();\n useEffect(() => {\n return registerCodeHighlighting(editor);\n }, [editor]);\n return null;\n}\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,MAAA,GAAAF,OAAA;AAEO,SAASG,mBAAmBA,CAAA,EAAG;EAClC,IAAAC,kBAAA,GAAmB,IAAAC,wBAAiB,EAAC,CAAC;IAA9BC,MAAM,GAAAF,kBAAA,CAANE,MAAM;EACd,IAAAC,gBAAS,EAAC,YAAM;IACZ,OAAO,IAAAC,8BAAwB,EAACF,MAAM,CAAC;EAC3C,CAAC,EAAE,CAACA,MAAM,CAAC,CAAC;EACZ,OAAO,IAAI;AACf","ignoreList":[]}
1
+ {"version":3,"names":["useEffect","registerCodeHighlighting","useRichTextEditor","CodeHighlightPlugin","editor"],"sources":["CodeHighlightPlugin.tsx"],"sourcesContent":["import { useEffect } from \"react\";\nimport { registerCodeHighlighting } from \"@lexical/code\";\nimport { useRichTextEditor } from \"~/hooks/index.js\";\n\nexport function CodeHighlightPlugin() {\n const { editor } = useRichTextEditor();\n useEffect(() => {\n return registerCodeHighlighting(editor);\n }, [editor]);\n return null;\n}\n"],"mappings":"AAAA,SAASA,SAAS,QAAQ,OAAO;AACjC,SAASC,wBAAwB,QAAQ,eAAe;AACxD,SAASC,iBAAiB;AAE1B,OAAO,SAASC,mBAAmBA,CAAA,EAAG;EAClC,MAAM;IAAEC;EAAO,CAAC,GAAGF,iBAAiB,CAAC,CAAC;EACtCF,SAAS,CAAC,MAAM;IACZ,OAAOC,wBAAwB,CAACG,MAAM,CAAC;EAC3C,CAAC,EAAE,CAACA,MAAM,CAAC,CAAC;EACZ,OAAO,IAAI;AACf","ignoreList":[]}
@@ -1 +1 @@
1
- export * from "./CodeHighlightPlugin";
1
+ export * from "./CodeHighlightPlugin.js";
@@ -1,18 +1,3 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- var _CodeHighlightPlugin = require("./CodeHighlightPlugin");
7
- Object.keys(_CodeHighlightPlugin).forEach(function (key) {
8
- if (key === "default" || key === "__esModule") return;
9
- if (key in exports && exports[key] === _CodeHighlightPlugin[key]) return;
10
- Object.defineProperty(exports, key, {
11
- enumerable: true,
12
- get: function get() {
13
- return _CodeHighlightPlugin[key];
14
- }
15
- });
16
- });
1
+ export * from "./CodeHighlightPlugin.js";
17
2
 
18
3
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_CodeHighlightPlugin","require","Object","keys","forEach","key","exports","defineProperty","enumerable","get"],"sources":["index.ts"],"sourcesContent":["export * from \"./CodeHighlightPlugin\";\n"],"mappings":";;;;;AAAA,IAAAA,oBAAA,GAAAC,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAH,oBAAA,EAAAI,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAL,oBAAA,CAAAK,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,IAAA;MAAA,OAAAT,oBAAA,CAAAK,GAAA;IAAA;EAAA;AAAA","ignoreList":[]}
1
+ {"version":3,"names":[],"sources":["index.ts"],"sourcesContent":["export * from \"./CodeHighlightPlugin.js\";\n"],"mappings":"AAAA","ignoreList":[]}
@@ -0,0 +1,10 @@
1
+ import React from "react";
2
+ import type { LexicalEditor } from "lexical";
3
+ import { LinkFormProps } from "./types.js";
4
+ interface FloatingLinkEditorProps {
5
+ editor: LexicalEditor;
6
+ isVisible: boolean;
7
+ LinkForm: React.FunctionComponent<LinkFormProps>;
8
+ }
9
+ export declare function FloatingLinkEditor({ editor, isVisible, LinkForm }: FloatingLinkEditorProps): React.JSX.Element;
10
+ export {};
@@ -0,0 +1,28 @@
1
+ import React from "react";
2
+ import { useFloatingLinkEditor } from "./useFloatingLinkEditor.js";
3
+ export function FloatingLinkEditor({
4
+ editor,
5
+ isVisible,
6
+ LinkForm
7
+ }) {
8
+ const {
9
+ editorRef,
10
+ linkData,
11
+ applyChanges,
12
+ removeLink
13
+ } = useFloatingLinkEditor(editor);
14
+ return /*#__PURE__*/React.createElement("div", {
15
+ ref: editorRef,
16
+ className: "z-dialog absolute link-editor",
17
+ style: {
18
+ opacity: isVisible ? 1 : 0,
19
+ pointerEvents: isVisible ? "auto" : "none"
20
+ }
21
+ }, isVisible ? /*#__PURE__*/React.createElement(LinkForm, {
22
+ linkData: linkData,
23
+ onSave: applyChanges,
24
+ removeLink: removeLink
25
+ }) : null);
26
+ }
27
+
28
+ //# sourceMappingURL=FloatingLinkEditor.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["React","useFloatingLinkEditor","FloatingLinkEditor","editor","isVisible","LinkForm","editorRef","linkData","applyChanges","removeLink","createElement","ref","className","style","opacity","pointerEvents","onSave"],"sources":["FloatingLinkEditor.tsx"],"sourcesContent":["import React from \"react\";\nimport type { LexicalEditor } from \"lexical\";\nimport { LinkFormProps } from \"./types.js\";\nimport { useFloatingLinkEditor } from \"./useFloatingLinkEditor.js\";\n\ninterface FloatingLinkEditorProps {\n editor: LexicalEditor;\n isVisible: boolean;\n LinkForm: React.FunctionComponent<LinkFormProps>;\n}\n\nexport function FloatingLinkEditor({ editor, isVisible, LinkForm }: FloatingLinkEditorProps) {\n const { editorRef, linkData, applyChanges, removeLink } = useFloatingLinkEditor(editor);\n\n return (\n <div\n ref={editorRef}\n className=\"z-dialog absolute link-editor\"\n style={{ opacity: isVisible ? 1 : 0, pointerEvents: isVisible ? \"auto\" : \"none\" }}\n >\n {isVisible ? (\n <LinkForm linkData={linkData} onSave={applyChanges} removeLink={removeLink} />\n ) : null}\n </div>\n );\n}\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AAGzB,SAASC,qBAAqB;AAQ9B,OAAO,SAASC,kBAAkBA,CAAC;EAAEC,MAAM;EAAEC,SAAS;EAAEC;AAAkC,CAAC,EAAE;EACzF,MAAM;IAAEC,SAAS;IAAEC,QAAQ;IAAEC,YAAY;IAAEC;EAAW,CAAC,GAAGR,qBAAqB,CAACE,MAAM,CAAC;EAEvF,oBACIH,KAAA,CAAAU,aAAA;IACIC,GAAG,EAAEL,SAAU;IACfM,SAAS,EAAC,+BAA+B;IACzCC,KAAK,EAAE;MAAEC,OAAO,EAAEV,SAAS,GAAG,CAAC,GAAG,CAAC;MAAEW,aAAa,EAAEX,SAAS,GAAG,MAAM,GAAG;IAAO;EAAE,GAEjFA,SAAS,gBACNJ,KAAA,CAAAU,aAAA,CAACL,QAAQ;IAACE,QAAQ,EAAEA,QAAS;IAACS,MAAM,EAAER,YAAa;IAACC,UAAU,EAAEA;EAAW,CAAE,CAAC,GAC9E,IACH,CAAC;AAEd","ignoreList":[]}
@@ -0,0 +1,7 @@
1
+ import React from "react";
2
+ import { LinkFormProps } from "./types.js";
3
+ interface FloatingLinkEditorProps {
4
+ LinkForm: React.FunctionComponent<LinkFormProps>;
5
+ }
6
+ export declare const FloatingLinkEditorController: (props: FloatingLinkEditorProps) => React.ReactPortal;
7
+ export {};
@@ -0,0 +1,61 @@
1
+ import React, { useCallback, useState, useEffect } from "react";
2
+ import { createPortal } from "react-dom";
3
+ import { useRichTextEditor } from "../../hooks/index.js";
4
+ import { getSelectedNode } from "../../utils/getSelectedNode.js";
5
+ import { $isAutoLinkNode, $isLinkNode, TOGGLE_LINK_COMMAND } from "@webiny/lexical-nodes";
6
+ import { isChildOfLinkEditor } from "./isChildOfLinkEditor.js";
7
+ import debounce from "lodash/debounce.js";
8
+ import { $getSelection, $isRangeSelection, BLUR_COMMAND, COMMAND_PRIORITY_CRITICAL, COMMAND_PRIORITY_LOW, SELECTION_CHANGE_COMMAND, mergeRegister, $findMatchingParent } from "lexical";
9
+ import { FloatingLinkEditor } from "./FloatingLinkEditor.js";
10
+ export const FloatingLinkEditorController = props => {
11
+ const {
12
+ editor,
13
+ getOverlaysElement
14
+ } = useRichTextEditor();
15
+ const [isLink, setIsLink] = useState(false);
16
+ const debounceSetIsLink = useCallback(debounce(setIsLink, 50), []);
17
+ const updateToolbar = useCallback(() => {
18
+ const selection = $getSelection();
19
+ if (!$isRangeSelection(selection)) {
20
+ return;
21
+ }
22
+ const node = getSelectedNode(selection);
23
+ const linkParent = $findMatchingParent(node, $isLinkNode);
24
+ const autoLinkParent = $findMatchingParent(node, $isAutoLinkNode);
25
+ const isLinkOrChildOfLink = Boolean($isLinkNode(node) || linkParent);
26
+ if (!isLinkOrChildOfLink) {
27
+ // When hiding the toolbar, we want to hide immediately.
28
+ setIsLink(false);
29
+ }
30
+ if (selection.dirty) {
31
+ // We don't want this menu to open for auto links.
32
+ if (linkParent != null && autoLinkParent == null) {
33
+ // When showing the toolbar, we want to debounce it, because sometimes selection gets updated
34
+ // multiple times, and the `selection.dirty` flag goes from true to false multiple times,
35
+ // eventually settling on `false`, which we want to set once it has settled.
36
+ debounceSetIsLink(true);
37
+ }
38
+ }
39
+ }, []);
40
+ useEffect(() => {
41
+ return mergeRegister(editor.registerCommand(SELECTION_CHANGE_COMMAND, () => {
42
+ updateToolbar();
43
+ return false;
44
+ }, COMMAND_PRIORITY_CRITICAL), editor.registerCommand(BLUR_COMMAND, payload => {
45
+ if (!isChildOfLinkEditor(payload.relatedTarget)) {
46
+ setIsLink(false);
47
+ }
48
+ return false;
49
+ }, COMMAND_PRIORITY_LOW), editor.registerCommand(TOGGLE_LINK_COMMAND, payload => {
50
+ setIsLink(!!payload);
51
+ return false;
52
+ }, COMMAND_PRIORITY_CRITICAL));
53
+ }, [editor, updateToolbar]);
54
+ return /*#__PURE__*/createPortal(/*#__PURE__*/React.createElement(FloatingLinkEditor, {
55
+ isVisible: isLink,
56
+ editor: editor,
57
+ LinkForm: props.LinkForm
58
+ }), getOverlaysElement());
59
+ };
60
+
61
+ //# sourceMappingURL=FloatingLinkEditorController.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["React","useCallback","useState","useEffect","createPortal","useRichTextEditor","getSelectedNode","$isAutoLinkNode","$isLinkNode","TOGGLE_LINK_COMMAND","isChildOfLinkEditor","debounce","$getSelection","$isRangeSelection","BLUR_COMMAND","COMMAND_PRIORITY_CRITICAL","COMMAND_PRIORITY_LOW","SELECTION_CHANGE_COMMAND","mergeRegister","$findMatchingParent","FloatingLinkEditor","FloatingLinkEditorController","props","editor","getOverlaysElement","isLink","setIsLink","debounceSetIsLink","updateToolbar","selection","node","linkParent","autoLinkParent","isLinkOrChildOfLink","Boolean","dirty","registerCommand","payload","relatedTarget","createElement","isVisible","LinkForm"],"sources":["FloatingLinkEditorController.tsx"],"sourcesContent":["import React, { useCallback, useState, useEffect } from \"react\";\nimport { createPortal } from \"react-dom\";\nimport { useRichTextEditor } from \"~/hooks/index.js\";\nimport { getSelectedNode } from \"~/utils/getSelectedNode.js\";\nimport { $isAutoLinkNode, $isLinkNode, TOGGLE_LINK_COMMAND } from \"@webiny/lexical-nodes\";\nimport { isChildOfLinkEditor } from \"~/plugins/FloatingLinkEditorPlugin/isChildOfLinkEditor.js\";\nimport debounce from \"lodash/debounce.js\";\nimport {\n $getSelection,\n $isRangeSelection,\n BLUR_COMMAND,\n COMMAND_PRIORITY_CRITICAL,\n COMMAND_PRIORITY_LOW,\n SELECTION_CHANGE_COMMAND,\n mergeRegister,\n $findMatchingParent\n} from \"lexical\";\nimport { FloatingLinkEditor } from \"./FloatingLinkEditor.js\";\nimport { LinkFormProps } from \"./types.js\";\n\ninterface FloatingLinkEditorProps {\n LinkForm: React.FunctionComponent<LinkFormProps>;\n}\n\nexport const FloatingLinkEditorController = (props: FloatingLinkEditorProps) => {\n const { editor, getOverlaysElement } = useRichTextEditor();\n const [isLink, setIsLink] = useState(false);\n\n const debounceSetIsLink = useCallback(debounce(setIsLink, 50), []);\n\n const updateToolbar = useCallback(() => {\n const selection = $getSelection();\n if (!$isRangeSelection(selection)) {\n return;\n }\n\n const node = getSelectedNode(selection);\n const linkParent = $findMatchingParent(node, $isLinkNode);\n const autoLinkParent = $findMatchingParent(node, $isAutoLinkNode);\n const isLinkOrChildOfLink = Boolean($isLinkNode(node) || linkParent);\n\n if (!isLinkOrChildOfLink) {\n // When hiding the toolbar, we want to hide immediately.\n setIsLink(false);\n }\n\n if (selection.dirty) {\n // We don't want this menu to open for auto links.\n if (linkParent != null && autoLinkParent == null) {\n // When showing the toolbar, we want to debounce it, because sometimes selection gets updated\n // multiple times, and the `selection.dirty` flag goes from true to false multiple times,\n // eventually settling on `false`, which we want to set once it has settled.\n debounceSetIsLink(true);\n }\n }\n }, []);\n\n useEffect(() => {\n return mergeRegister(\n editor.registerCommand(\n SELECTION_CHANGE_COMMAND,\n () => {\n updateToolbar();\n return false;\n },\n COMMAND_PRIORITY_CRITICAL\n ),\n editor.registerCommand(\n BLUR_COMMAND,\n payload => {\n if (!isChildOfLinkEditor(payload.relatedTarget as HTMLElement)) {\n setIsLink(false);\n }\n\n return false;\n },\n COMMAND_PRIORITY_LOW\n ),\n editor.registerCommand(\n TOGGLE_LINK_COMMAND,\n payload => {\n setIsLink(!!payload);\n return false;\n },\n COMMAND_PRIORITY_CRITICAL\n )\n );\n }, [editor, updateToolbar]);\n\n return createPortal(\n <FloatingLinkEditor isVisible={isLink} editor={editor} LinkForm={props.LinkForm} />,\n getOverlaysElement()\n );\n};\n"],"mappings":"AAAA,OAAOA,KAAK,IAAIC,WAAW,EAAEC,QAAQ,EAAEC,SAAS,QAAQ,OAAO;AAC/D,SAASC,YAAY,QAAQ,WAAW;AACxC,SAASC,iBAAiB;AAC1B,SAASC,eAAe;AACxB,SAASC,eAAe,EAAEC,WAAW,EAAEC,mBAAmB,QAAQ,uBAAuB;AACzF,SAASC,mBAAmB;AAC5B,OAAOC,QAAQ,MAAM,oBAAoB;AACzC,SACIC,aAAa,EACbC,iBAAiB,EACjBC,YAAY,EACZC,yBAAyB,EACzBC,oBAAoB,EACpBC,wBAAwB,EACxBC,aAAa,EACbC,mBAAmB,QAChB,SAAS;AAChB,SAASC,kBAAkB;AAO3B,OAAO,MAAMC,4BAA4B,GAAIC,KAA8B,IAAK;EAC5E,MAAM;IAAEC,MAAM;IAAEC;EAAmB,CAAC,GAAGnB,iBAAiB,CAAC,CAAC;EAC1D,MAAM,CAACoB,MAAM,EAAEC,SAAS,CAAC,GAAGxB,QAAQ,CAAC,KAAK,CAAC;EAE3C,MAAMyB,iBAA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AI;MACPX,SAAS,CAAC,CAAC,CAACW,OAAO,CAAC;MACpB,OAAO,KAAK;IAChB,CAAC,EACDtB,yBACJ,CACJ,CAAC;EACL,CAAC,EAAE,CAACQ,MAAM,EAAEK,aAAa,CAAC,CAAC;EAE3B,oBAAOxB,YAAY,cACfJ,KAAA,CAAAuC,aAAA,CAACnB,kBAAkB;IAACoB,SAAS,EAAEf,MAAO;IAACF,MAAM,EAAEA,MAAO;IAACkB,QAAQ,EAAEnB,KAAK,CAACmB;EAAS,CAAE,CAAC,EACnFjB,kBAAkB,CAAC,CACvB,CAAC;AACL,CAAC","ignoreList":[]}
@@ -1,23 +1,14 @@
1
1
  .link-editor {
2
- position: absolute;
3
2
  top: 0;
4
3
  left: 0;
5
- z-index: 31;
6
4
  max-width: 400px;
7
5
  width: 100%;
8
6
  opacity: 0;
9
7
  background-color: #fff;
10
- box-shadow: 0 5px 10px rgba(0, 0, 0, 0.3);
8
+ box-shadow: 0 3px 8px rgba(0, 0, 0, 0.3);
11
9
  border-radius: 8px;
12
- transition: opacity 0.5s;
13
- will-change: transform;
14
- padding: 10px 0;
10
+ pointer-events: all;
15
11
  }
16
-
17
- .link-editor .link-editor-target-checkbox {
18
- padding: 10px 10px 5px 10px;
19
- }
20
-
21
12
  .link-editor .button {
22
13
  width: 20px;
23
14
  height: 20px;
@@ -40,131 +31,6 @@
40
31
  background-color: rgb(223, 232, 250);
41
32
  }
42
33
 
43
- .link-editor .link-editor-section {
44
- margin: 0 15px;
45
- padding: 10px 0;
46
- width: calc(100% - 24px);
47
- }
48
-
49
- .link-editor .link-editor-popup-title {
50
- margin: 0 15px 10px;
51
- color: var(--mdc-theme-primary);
52
- }
53
-
54
- .link-editor .link-editor-section .header {
55
- width: auto;
56
- margin-bottom: 10px;
57
- }
58
-
59
- .link-editor .link-editor-section .header_icon {
60
- font-size: 16px;
61
- width: 16px;
62
- height: 16px;
63
- }
64
-
65
- .link-editor .link-editor-section .header_title {
66
- font-size: 16px;
67
- font-width: bold;
68
- color: var(--mdc-theme-primary);
69
- }
70
-
71
- .link-editor .link-editor-section .section-desc {
72
- color: #0a0a0a;
73
- }
74
-
75
- .link-editor .link-editor-section.edit-form-bottom-menu {
76
- display: flex;
77
- justify-content: right;
78
- margin-top: 5px;
79
- column-gap: 10px;
80
- }
81
-
82
- .link-editor .link-editor-section ul {
83
- list-style: initial;
84
- padding: 0 20px;
85
- }
86
-
87
- .link-editor .link-editor-section ul li {
88
- padding: 3px 0;
89
- }
90
-
91
- .link-editor .link-input {
92
- display: block;
93
- width: calc(100% - 24px);
94
- height: 42px;
95
- box-sizing: border-box;
96
- margin: 12px;
97
- padding: 12px;
98
- border-radius: 10px;
99
- background-color: #eee;
100
- font-size: 16px;
101
- color: rgb(5, 5, 5);
102
- border: 0;
103
- outline: 0;
104
- position: relative;
105
- font-family: inherit;
106
- }
107
-
108
- .link-editor .link-input.full-with {
109
- width: 100%;
110
- margin: 0;
111
- }
112
-
113
- .link-editor .link-input .link-unlink {
114
- background-image: url(../../images/icons/unlink_icon.svg);
115
- background-size: 18px;
116
- background-position: center;
117
- background-repeat: no-repeat;
118
- width: 35px;
119
- vertical-align: -0.25em;
120
- position: absolute;
121
- right: 5px;
122
- top: 0;
123
- bottom: 0;
124
- cursor: pointer;
125
- }
126
-
127
- .link-editor .link-input .link-edit {
128
- background-image: url(../../images/icons/pencil-fill.svg);
129
- background-size: 16px;
130
- background-position: center;
131
- background-repeat: no-repeat;
132
- width: 35px;
133
- vertical-align: -0.25em;
134
- position: absolute;
135
- right: 35px;
136
- top: 0;
137
- bottom: 0;
138
- cursor: pointer;
139
- }
140
-
141
- .link-editor .link-input a {
142
- color: rgb(33, 111, 219);
143
- text-decoration: none;
144
- display: block;
145
- white-space: nowrap;
146
- overflow: hidden;
147
- margin-right: 30px;
148
- text-overflow: ellipsis;
149
- }
150
-
151
- .link-editor .link-input a:hover {
152
- text-decoration: underline;
153
- }
154
-
155
- .link-editor .font-size-wrapper,
156
- .link-editor .font-family-wrapper {
157
- display: flex;
158
- margin: 0 4px;
159
- }
160
-
161
- .link-editor select {
162
- padding: 6px;
163
- border: none;
164
- background-color: rgba(0, 0, 0, 0.075);
165
- border-radius: 4px;
166
- }
167
-
168
34
  .link-editor .button i,
169
35
  .actions i {
170
36
  background-size: contain;
@@ -1,18 +1,6 @@
1
1
  import React from "react";
2
- import { LexicalEditor } from "lexical";
3
2
  import "./FloatingLinkEditorPlugin.css";
4
- export interface LinkData {
5
- url: string;
6
- target: string | null;
7
- alt: string | null;
8
- }
9
- interface FloatingLinkEditorProps {
10
- editor: LexicalEditor;
11
- isVisible: boolean;
12
- anchorElem: HTMLElement;
13
- }
14
- export declare function FloatingLinkEditor({ editor, isVisible, anchorElem }: FloatingLinkEditorProps): React.JSX.Element;
15
- export declare function FloatingLinkEditorPlugin({ anchorElem }: {
16
- anchorElem?: HTMLElement;
17
- }): JSX.Element | null;
18
- export {};
3
+ import { LinkFormProps } from "./types.js";
4
+ export declare function FloatingLinkEditorPlugin(props: {
5
+ LinkForm: React.FunctionComponent<LinkFormProps>;
6
+ }): React.JSX.Element;