@webiny/lexical-editor 0.0.0-unstable.9e825fd5fb → 0.0.0-unstable.a9593f74dd

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 (280) hide show
  1. package/commands/image.d.ts +6 -0
  2. package/commands/image.js +11 -0
  3. package/commands/image.js.map +1 -0
  4. package/commands/index.d.ts +3 -0
  5. package/commands/index.js +40 -0
  6. package/commands/index.js.map +1 -0
  7. package/commands/list.d.ts +7 -0
  8. package/commands/list.js +15 -0
  9. package/commands/list.js.map +1 -0
  10. package/commands/quote.d.ts +5 -0
  11. package/commands/quote.js +11 -0
  12. package/commands/quote.js.map +1 -0
  13. package/components/Editor/HeadingEditor.d.ts +2 -2
  14. package/components/Editor/HeadingEditor.js +13 -11
  15. package/components/Editor/HeadingEditor.js.map +1 -1
  16. package/components/Editor/ParagraphEditor.d.ts +2 -2
  17. package/components/Editor/ParagraphEditor.js +13 -13
  18. package/components/Editor/ParagraphEditor.js.map +1 -1
  19. package/components/Editor/RichTextEditor.d.ts +23 -14
  20. package/components/Editor/RichTextEditor.js +107 -43
  21. package/components/Editor/RichTextEditor.js.map +1 -1
  22. package/components/LexicalEditorConfig/LexicalEditorConfig.d.ts +19 -6
  23. package/components/LexicalEditorConfig/LexicalEditorConfig.js +65 -5
  24. package/components/LexicalEditorConfig/LexicalEditorConfig.js.map +1 -1
  25. package/components/LexicalEditorConfig/components/Node.d.ts +14 -0
  26. package/components/LexicalEditorConfig/components/Node.js +40 -0
  27. package/components/LexicalEditorConfig/components/Node.js.map +1 -0
  28. package/components/LexicalEditorConfig/components/Plugin.d.ts +13 -0
  29. package/components/LexicalEditorConfig/components/Plugin.js +40 -0
  30. package/components/LexicalEditorConfig/components/Plugin.js.map +1 -0
  31. package/components/LexicalEditorConfig/components/ToolbarElement.d.ts +13 -0
  32. package/components/LexicalEditorConfig/components/ToolbarElement.js +40 -0
  33. package/components/LexicalEditorConfig/components/ToolbarElement.js.map +1 -0
  34. package/components/LexicalHtmlRenderer.d.ts +11 -4
  35. package/components/LexicalHtmlRenderer.js +42 -17
  36. package/components/LexicalHtmlRenderer.js.map +1 -1
  37. package/components/Toolbar/StaticToolbar.css +260 -0
  38. package/components/Toolbar/StaticToolbar.d.ts +3 -0
  39. package/components/Toolbar/StaticToolbar.js +30 -0
  40. package/components/Toolbar/StaticToolbar.js.map +1 -0
  41. package/components/Toolbar/Toolbar.css +227 -4
  42. package/components/Toolbar/Toolbar.d.ts +2 -9
  43. package/components/Toolbar/Toolbar.js +75 -86
  44. package/components/Toolbar/Toolbar.js.map +1 -1
  45. package/components/ToolbarActions/BoldAction.d.ts +0 -3
  46. package/components/ToolbarActions/BoldAction.js +10 -15
  47. package/components/ToolbarActions/BoldAction.js.map +1 -1
  48. package/components/ToolbarActions/BulletListAction.d.ts +0 -3
  49. package/components/ToolbarActions/BulletListAction.js +22 -62
  50. package/components/ToolbarActions/BulletListAction.js.map +1 -1
  51. package/components/ToolbarActions/CodeHighlightAction.d.ts +0 -4
  52. package/components/ToolbarActions/CodeHighlightAction.js +10 -16
  53. package/components/ToolbarActions/CodeHighlightAction.js.map +1 -1
  54. package/components/ToolbarActions/FontColorAction.d.ts +7 -4
  55. package/components/ToolbarActions/FontColorAction.js +20 -42
  56. package/components/ToolbarActions/FontColorAction.js.map +1 -1
  57. package/components/ToolbarActions/FontSizeAction.js +11 -30
  58. package/components/ToolbarActions/FontSizeAction.js.map +1 -1
  59. package/components/ToolbarActions/ImageAction.d.ts +2 -0
  60. package/components/ToolbarActions/ImageAction.js +56 -0
  61. package/components/ToolbarActions/ImageAction.js.map +1 -0
  62. package/components/ToolbarActions/ItalicAction.d.ts +0 -3
  63. package/components/ToolbarActions/ItalicAction.js +10 -15
  64. package/components/ToolbarActions/ItalicAction.js.map +1 -1
  65. package/components/ToolbarActions/LinkAction.d.ts +0 -5
  66. package/components/ToolbarActions/LinkAction.js +18 -41
  67. package/components/ToolbarActions/LinkAction.js.map +1 -1
  68. package/components/ToolbarActions/NumberedListAction.d.ts +0 -3
  69. package/components/ToolbarActions/NumberedListAction.js +33 -62
  70. package/components/ToolbarActions/NumberedListAction.js.map +1 -1
  71. package/components/ToolbarActions/QuoteAction.d.ts +0 -2
  72. package/components/ToolbarActions/QuoteAction.js +20 -43
  73. package/components/ToolbarActions/QuoteAction.js.map +1 -1
  74. package/components/ToolbarActions/TextAlignmentAction.d.ts +14 -0
  75. package/components/ToolbarActions/TextAlignmentAction.js +75 -0
  76. package/components/ToolbarActions/TextAlignmentAction.js.map +1 -0
  77. package/components/ToolbarActions/TypographyAction.d.ts +14 -0
  78. package/components/ToolbarActions/TypographyAction.js +138 -0
  79. package/components/ToolbarActions/TypographyAction.js.map +1 -0
  80. package/components/ToolbarActions/UnderlineAction.d.ts +0 -3
  81. package/components/ToolbarActions/UnderlineAction.js +11 -16
  82. package/components/ToolbarActions/UnderlineAction.js.map +1 -1
  83. package/context/FontColorActionContext.js +3 -1
  84. package/context/FontColorActionContext.js.map +1 -1
  85. package/context/RichTextEditorContext.d.ts +16 -3
  86. package/context/RichTextEditorContext.js +38 -9
  87. package/context/RichTextEditorContext.js.map +1 -1
  88. package/context/SharedHistoryContext.d.ts +10 -0
  89. package/context/SharedHistoryContext.js +28 -0
  90. package/context/SharedHistoryContext.js.map +1 -0
  91. package/context/TextAlignmentActionContextProps.d.ts +9 -0
  92. package/context/TextAlignmentActionContextProps.js +12 -0
  93. package/context/TextAlignmentActionContextProps.js.map +1 -0
  94. package/context/TypographyActionContext.d.ts +7 -0
  95. package/context/TypographyActionContext.js +12 -0
  96. package/context/TypographyActionContext.js.map +1 -0
  97. package/hooks/index.d.ts +7 -0
  98. package/hooks/index.js +84 -0
  99. package/hooks/index.js.map +1 -0
  100. package/hooks/useCurrentElement.d.ts +7 -0
  101. package/hooks/useCurrentElement.js +33 -0
  102. package/hooks/useCurrentElement.js.map +1 -0
  103. package/hooks/useCurrentSelection.d.ts +12 -0
  104. package/hooks/useCurrentSelection.js +72 -0
  105. package/hooks/useCurrentSelection.js.map +1 -0
  106. package/hooks/useFontColorPicker.js +3 -1
  107. package/hooks/useFontColorPicker.js.map +1 -1
  108. package/hooks/useIsMounted.d.ts +1 -0
  109. package/hooks/useIsMounted.js +20 -0
  110. package/hooks/useIsMounted.js.map +1 -0
  111. package/hooks/useList.d.ts +2 -0
  112. package/hooks/useList.js +54 -0
  113. package/hooks/useList.js.map +1 -0
  114. package/hooks/useQuote.d.ts +2 -0
  115. package/hooks/useQuote.js +22 -0
  116. package/hooks/useQuote.js.map +1 -0
  117. package/hooks/useRichTextEditor.js +3 -1
  118. package/hooks/useRichTextEditor.js.map +1 -1
  119. package/hooks/useTextAlignmentAction.d.ts +1 -0
  120. package/hooks/useTextAlignmentAction.js +17 -0
  121. package/hooks/useTextAlignmentAction.js.map +1 -0
  122. package/hooks/useTypographyAction.d.ts +1 -0
  123. package/hooks/useTypographyAction.js +17 -0
  124. package/hooks/useTypographyAction.js.map +1 -0
  125. package/images/icons/indent.svg +3 -0
  126. package/images/icons/insert-image.svg +4 -0
  127. package/images/icons/justify.svg +3 -0
  128. package/images/icons/outdent.svg +3 -0
  129. package/index.d.ts +14 -13
  130. package/index.js +127 -63
  131. package/index.js.map +1 -1
  132. package/package.json +16 -16
  133. package/plugins/BlurEventPlugin/BlurEventPlugin.js +3 -1
  134. package/plugins/BlurEventPlugin/BlurEventPlugin.js.map +1 -1
  135. package/plugins/CodeHighlightPlugin/CodeHighlightPlugin.js +3 -1
  136. package/plugins/CodeHighlightPlugin/CodeHighlightPlugin.js.map +1 -1
  137. package/plugins/CodeHighlightPlugin/index.js +3 -1
  138. package/plugins/CodeHighlightPlugin/index.js.map +1 -1
  139. package/plugins/FloatingLinkEditorPlugin/FloatingLinkEditorPlugin.css +5 -1
  140. package/plugins/FloatingLinkEditorPlugin/FloatingLinkEditorPlugin.d.ts +0 -2
  141. package/plugins/FloatingLinkEditorPlugin/FloatingLinkEditorPlugin.js +64 -22
  142. package/plugins/FloatingLinkEditorPlugin/FloatingLinkEditorPlugin.js.map +1 -1
  143. package/plugins/FloatingLinkEditorPlugin/index.js +3 -1
  144. package/plugins/FloatingLinkEditorPlugin/index.js.map +1 -1
  145. package/plugins/FontColorPlugin/FontColorPlugin.d.ts +1 -2
  146. package/plugins/FontColorPlugin/FontColorPlugin.js +8 -6
  147. package/plugins/FontColorPlugin/FontColorPlugin.js.map +1 -1
  148. package/plugins/ImagesPlugin/ImagesPlugin.d.ts +12 -0
  149. package/plugins/ImagesPlugin/ImagesPlugin.js +153 -0
  150. package/plugins/ImagesPlugin/ImagesPlugin.js.map +1 -0
  151. package/plugins/LexicalUpdateStatePlugin/UpdateStatePlugin.d.ts +9 -0
  152. package/plugins/LexicalUpdateStatePlugin/UpdateStatePlugin.js +49 -0
  153. package/plugins/LexicalUpdateStatePlugin/UpdateStatePlugin.js.map +1 -0
  154. package/plugins/LexicalUpdateStatePlugin/index.d.ts +1 -1
  155. package/plugins/LexicalUpdateStatePlugin/index.js +7 -5
  156. package/plugins/LexicalUpdateStatePlugin/index.js.map +1 -1
  157. package/plugins/LinkPlugin/LinkPlugin.d.ts +5 -0
  158. package/plugins/LinkPlugin/LinkPlugin.js +68 -0
  159. package/plugins/LinkPlugin/LinkPlugin.js.map +1 -0
  160. package/plugins/ListPLugin/ListPlugin.d.ts +1 -0
  161. package/plugins/ListPLugin/ListPlugin.js +26 -0
  162. package/plugins/ListPLugin/ListPlugin.js.map +1 -0
  163. package/plugins/TypographyPlugin/TypographyPlugin.d.ts +1 -0
  164. package/plugins/TypographyPlugin/TypographyPlugin.js +35 -0
  165. package/plugins/TypographyPlugin/TypographyPlugin.js.map +1 -0
  166. package/plugins/WebinyQuoteNodePlugin/WebinyQuoteNodePlugin.d.ts +1 -0
  167. package/plugins/WebinyQuoteNodePlugin/WebinyQuoteNodePlugin.js +26 -0
  168. package/plugins/WebinyQuoteNodePlugin/WebinyQuoteNodePlugin.js.map +1 -0
  169. package/types.d.ts +9 -0
  170. package/types.js +30 -1
  171. package/types.js.map +1 -1
  172. package/ui/ContentEditable.css +22 -0
  173. package/{plugins/AutoLinkPlugin/AutoLinkPlugin.d.ts → ui/ContentEditable.d.ts} +5 -4
  174. package/ui/ContentEditable.js +26 -0
  175. package/ui/ContentEditable.js.map +1 -0
  176. package/ui/Divider.js +3 -1
  177. package/ui/Divider.js.map +1 -1
  178. package/ui/DropDown.d.ts +0 -1
  179. package/ui/DropDown.js +55 -20
  180. package/ui/DropDown.js.map +1 -1
  181. package/ui/ImageResizer.d.ts +24 -0
  182. package/ui/ImageResizer.js +215 -0
  183. package/ui/ImageResizer.js.map +1 -0
  184. package/ui/LinkPreview.js +10 -8
  185. package/ui/LinkPreview.js.map +1 -1
  186. package/ui/Placeholder.css +2 -5
  187. package/ui/Placeholder.d.ts +3 -1
  188. package/ui/Placeholder.js +8 -2
  189. package/ui/Placeholder.js.map +1 -1
  190. package/ui/TextInput.js +3 -1
  191. package/ui/TextInput.js.map +1 -1
  192. package/ui/ToolbarActionDialog.d.ts +1 -1
  193. package/ui/ToolbarActionDialog.js +4 -3
  194. package/ui/ToolbarActionDialog.js.map +1 -1
  195. package/utils/canUseDOM.d.ts +1 -0
  196. package/utils/canUseDOM.js +10 -0
  197. package/utils/canUseDOM.js.map +1 -0
  198. package/utils/files.d.ts +12 -0
  199. package/utils/files.js +64 -0
  200. package/utils/files.js.map +1 -0
  201. package/utils/generateInitialLexicalValue.js +23 -18
  202. package/utils/generateInitialLexicalValue.js.map +1 -1
  203. package/utils/getDOMRangeRect.d.ts +0 -2
  204. package/utils/getDOMRangeRect.js +3 -1
  205. package/utils/getDOMRangeRect.js.map +1 -1
  206. package/utils/getSelectedNode.js +3 -1
  207. package/utils/getSelectedNode.js.map +1 -1
  208. package/utils/getTransparentImage.d.ts +1 -0
  209. package/utils/getTransparentImage.js +12 -0
  210. package/utils/getTransparentImage.js.map +1 -0
  211. package/utils/insertImage.d.ts +2 -0
  212. package/utils/insertImage.js +23 -0
  213. package/utils/insertImage.js.map +1 -0
  214. package/utils/isHTMLElement.d.ts +8 -0
  215. package/utils/isHTMLElement.js +18 -0
  216. package/utils/isHTMLElement.js.map +1 -0
  217. package/utils/isUrlLinkReference.d.ts +1 -0
  218. package/utils/isUrlLinkReference.js +12 -0
  219. package/utils/isUrlLinkReference.js.map +1 -0
  220. package/utils/isValidJSON.js +3 -1
  221. package/utils/isValidJSON.js.map +1 -1
  222. package/utils/isValidLexicalData.d.ts +2 -0
  223. package/utils/isValidLexicalData.js +20 -12
  224. package/utils/isValidLexicalData.js.map +1 -1
  225. package/utils/point.js +3 -4
  226. package/utils/point.js.map +1 -1
  227. package/utils/rect.d.ts +0 -2
  228. package/utils/rect.js +3 -6
  229. package/utils/rect.js.map +1 -1
  230. package/utils/sanitizeUrl.d.ts +0 -7
  231. package/utils/sanitizeUrl.js +7 -1
  232. package/utils/sanitizeUrl.js.map +1 -1
  233. package/utils/setFloatingElemPosition.d.ts +0 -2
  234. package/utils/setFloatingElemPosition.js +3 -1
  235. package/utils/setFloatingElemPosition.js.map +1 -1
  236. package/components/AddRichTextEditorNodeType.d.ts +0 -6
  237. package/components/AddRichTextEditorNodeType.js +0 -28
  238. package/components/AddRichTextEditorNodeType.js.map +0 -1
  239. package/components/AddRichTextEditorPlugin.d.ts +0 -12
  240. package/components/AddRichTextEditorPlugin.js +0 -33
  241. package/components/AddRichTextEditorPlugin.js.map +0 -1
  242. package/components/AddToolbarAction.d.ts +0 -7
  243. package/components/AddToolbarAction.js +0 -33
  244. package/components/AddToolbarAction.js.map +0 -1
  245. package/components/Toolbar/HeadingToolbar.d.ts +0 -12
  246. package/components/Toolbar/HeadingToolbar.js +0 -23
  247. package/components/Toolbar/HeadingToolbar.js.map +0 -1
  248. package/components/Toolbar/ParagraphToolbar.d.ts +0 -12
  249. package/components/Toolbar/ParagraphToolbar.js +0 -23
  250. package/components/Toolbar/ParagraphToolbar.js.map +0 -1
  251. package/components/ToolbarPresets/HeadingToolbarPreset.d.ts +0 -2
  252. package/components/ToolbarPresets/HeadingToolbarPreset.js +0 -48
  253. package/components/ToolbarPresets/HeadingToolbarPreset.js.map +0 -1
  254. package/components/ToolbarPresets/ParagraphToolbarPreset.d.ts +0 -2
  255. package/components/ToolbarPresets/ParagraphToolbarPreset.js +0 -63
  256. package/components/ToolbarPresets/ParagraphToolbarPreset.js.map +0 -1
  257. package/nodes/FontColorNode.d.ts +0 -43
  258. package/nodes/FontColorNode.js +0 -127
  259. package/nodes/FontColorNode.js.map +0 -1
  260. package/nodes/webinyNodes.d.ts +0 -2
  261. package/nodes/webinyNodes.js +0 -16
  262. package/nodes/webinyNodes.js.map +0 -1
  263. package/plugins/AutoLinkPlugin/AutoLinkPlugin.js +0 -46
  264. package/plugins/AutoLinkPlugin/AutoLinkPlugin.js.map +0 -1
  265. package/plugins/AutoLinkPlugin/index.d.ts +0 -1
  266. package/plugins/AutoLinkPlugin/index.js +0 -16
  267. package/plugins/AutoLinkPlugin/index.js.map +0 -1
  268. package/plugins/ClickableLinkPlugin/ClickableLinkPlugin.d.ts +0 -17
  269. package/plugins/ClickableLinkPlugin/ClickableLinkPlugin.js +0 -88
  270. package/plugins/ClickableLinkPlugin/ClickableLinkPlugin.js.map +0 -1
  271. package/plugins/ClickableLinkPlugin/index.d.ts +0 -1
  272. package/plugins/ClickableLinkPlugin/index.js +0 -16
  273. package/plugins/ClickableLinkPlugin/index.js.map +0 -1
  274. package/plugins/LexicalUpdateStatePlugin/LexicalUpdateStatePlugin.d.ts +0 -8
  275. package/plugins/LexicalUpdateStatePlugin/LexicalUpdateStatePlugin.js +0 -34
  276. package/plugins/LexicalUpdateStatePlugin/LexicalUpdateStatePlugin.js.map +0 -1
  277. package/themes/webinyLexicalTheme.css +0 -422
  278. package/themes/webinyLexicalTheme.d.ts +0 -7
  279. package/themes/webinyLexicalTheme.js +0 -86
  280. package/themes/webinyLexicalTheme.js.map +0 -1
@@ -0,0 +1,6 @@
1
+ import { LexicalCommand, NodeKey } from "lexical";
2
+ import { ImageNodeProps } from "@webiny/lexical-nodes";
3
+ export interface ImagePayload extends ImageNodeProps {
4
+ key?: NodeKey;
5
+ }
6
+ export declare const INSERT_IMAGE_COMMAND: LexicalCommand<ImagePayload>;
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.INSERT_IMAGE_COMMAND = void 0;
7
+ var _lexical = require("lexical");
8
+ var INSERT_IMAGE_COMMAND = (0, _lexical.createCommand)("INSERT_IMAGE_COMMAND");
9
+ exports.INSERT_IMAGE_COMMAND = INSERT_IMAGE_COMMAND;
10
+
11
+ //# sourceMappingURL=image.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_lexical","require","INSERT_IMAGE_COMMAND","createCommand","exports"],"sources":["image.ts"],"sourcesContent":["import { createCommand, LexicalCommand, NodeKey } from \"lexical\";\nimport { ImageNodeProps } from \"@webiny/lexical-nodes\";\n\nexport interface ImagePayload extends ImageNodeProps {\n key?: NodeKey;\n}\n\nexport const INSERT_IMAGE_COMMAND: LexicalCommand<ImagePayload> =\n createCommand(\"INSERT_IMAGE_COMMAND\");\n"],"mappings":";;;;;;AAAA,IAAAA,QAAA,GAAAC,OAAA;AAOO,IAAMC,oBAAkD,GAC3D,IAAAC,sBAAa,EAAC,sBAAsB,CAAC;AAACC,OAAA,CAAAF,oBAAA,GAAAA,oBAAA"}
@@ -0,0 +1,3 @@
1
+ export * from "./image";
2
+ export * from "./list";
3
+ export * from "./quote";
@@ -0,0 +1,40 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ var _image = require("./image");
7
+ Object.keys(_image).forEach(function (key) {
8
+ if (key === "default" || key === "__esModule") return;
9
+ if (key in exports && exports[key] === _image[key]) return;
10
+ Object.defineProperty(exports, key, {
11
+ enumerable: true,
12
+ get: function get() {
13
+ return _image[key];
14
+ }
15
+ });
16
+ });
17
+ var _list = require("./list");
18
+ Object.keys(_list).forEach(function (key) {
19
+ if (key === "default" || key === "__esModule") return;
20
+ if (key in exports && exports[key] === _list[key]) return;
21
+ Object.defineProperty(exports, key, {
22
+ enumerable: true,
23
+ get: function get() {
24
+ return _list[key];
25
+ }
26
+ });
27
+ });
28
+ var _quote = require("./quote");
29
+ Object.keys(_quote).forEach(function (key) {
30
+ if (key === "default" || key === "__esModule") return;
31
+ if (key in exports && exports[key] === _quote[key]) return;
32
+ Object.defineProperty(exports, key, {
33
+ enumerable: true,
34
+ get: function get() {
35
+ return _quote[key];
36
+ }
37
+ });
38
+ });
39
+
40
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_image","require","Object","keys","forEach","key","exports","defineProperty","enumerable","get","_list","_quote"],"sources":["index.ts"],"sourcesContent":["export * from \"~/commands/image\";\nexport * from \"~/commands/list\";\nexport * from \"~/commands/quote\";\n"],"mappings":";;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAH,MAAA,EAAAI,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAL,MAAA,CAAAK,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,IAAA;MAAA,OAAAT,MAAA,CAAAK,GAAA;IAAA;EAAA;AAAA;AACA,IAAAK,KAAA,GAAAT,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAO,KAAA,EAAAN,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAK,KAAA,CAAAL,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,IAAA;MAAA,OAAAC,KAAA,CAAAL,GAAA;IAAA;EAAA;AAAA;AACA,IAAAM,MAAA,GAAAV,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAQ,MAAA,EAAAP,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAM,MAAA,CAAAN,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,IAAA;MAAA,OAAAE,MAAA,CAAAN,GAAA;IAAA;EAAA;AAAA"}
@@ -0,0 +1,7 @@
1
+ import { LexicalCommand } from "lexical";
2
+ export declare type ListCommandPayload = {
3
+ themeStyleId?: string;
4
+ };
5
+ export declare const INSERT_UNORDERED_LIST_COMMAND: LexicalCommand<ListCommandPayload>;
6
+ export declare const INSERT_ORDERED_LIST_COMMAND: LexicalCommand<ListCommandPayload>;
7
+ export declare const REMOVE_LIST_COMMAND: LexicalCommand<void>;
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.REMOVE_LIST_COMMAND = exports.INSERT_UNORDERED_LIST_COMMAND = exports.INSERT_ORDERED_LIST_COMMAND = void 0;
7
+ var _lexical = require("lexical");
8
+ var INSERT_UNORDERED_LIST_COMMAND = (0, _lexical.createCommand)("INSERT_UNORDERED_LIST_COMMAND");
9
+ exports.INSERT_UNORDERED_LIST_COMMAND = INSERT_UNORDERED_LIST_COMMAND;
10
+ var INSERT_ORDERED_LIST_COMMAND = (0, _lexical.createCommand)("INSERT_ORDERED_LIST_COMMAND");
11
+ exports.INSERT_ORDERED_LIST_COMMAND = INSERT_ORDERED_LIST_COMMAND;
12
+ var REMOVE_LIST_COMMAND = (0, _lexical.createCommand)("REMOVE_LIST_COMMAND");
13
+ exports.REMOVE_LIST_COMMAND = REMOVE_LIST_COMMAND;
14
+
15
+ //# sourceMappingURL=list.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_lexical","require","INSERT_UNORDERED_LIST_COMMAND","createCommand","exports","INSERT_ORDERED_LIST_COMMAND","REMOVE_LIST_COMMAND"],"sources":["list.ts"],"sourcesContent":["import { createCommand, LexicalCommand } from \"lexical\";\n\nexport type ListCommandPayload = {\n themeStyleId?: string;\n};\n\nexport const INSERT_UNORDERED_LIST_COMMAND: LexicalCommand<ListCommandPayload> = createCommand(\n \"INSERT_UNORDERED_LIST_COMMAND\"\n);\n\nexport const INSERT_ORDERED_LIST_COMMAND: LexicalCommand<ListCommandPayload> = createCommand(\n \"INSERT_ORDERED_LIST_COMMAND\"\n);\n\nexport const REMOVE_LIST_COMMAND: LexicalCommand<void> = createCommand(\"REMOVE_LIST_COMMAND\");\n"],"mappings":";;;;;;AAAA,IAAAA,QAAA,GAAAC,OAAA;AAMO,IAAMC,6BAAiE,GAAG,IAAAC,sBAAa,EAC1F,+BACJ,CAAC;AAACC,OAAA,CAAAF,6BAAA,GAAAA,6BAAA;AAEK,IAAMG,2BAA+D,GAAG,IAAAF,sBAAa,EACxF,6BACJ,CAAC;AAACC,OAAA,CAAAC,2BAAA,GAAAA,2BAAA;AAEK,IAAMC,mBAAyC,GAAG,IAAAH,sBAAa,EAAC,qBAAqB,CAAC;AAACC,OAAA,CAAAE,mBAAA,GAAAA,mBAAA"}
@@ -0,0 +1,5 @@
1
+ import { LexicalCommand } from "lexical";
2
+ export declare type QuoteCommandPayload = {
3
+ themeStyleId: string;
4
+ };
5
+ export declare const INSERT_QUOTE_COMMAND: LexicalCommand<QuoteCommandPayload>;
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.INSERT_QUOTE_COMMAND = void 0;
7
+ var _lexical = require("lexical");
8
+ var INSERT_QUOTE_COMMAND = (0, _lexical.createCommand)("INSERT_QUOTE_COMMAND");
9
+ exports.INSERT_QUOTE_COMMAND = INSERT_QUOTE_COMMAND;
10
+
11
+ //# sourceMappingURL=quote.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_lexical","require","INSERT_QUOTE_COMMAND","createCommand","exports"],"sources":["quote.ts"],"sourcesContent":["import { createCommand, LexicalCommand } from \"lexical\";\n\nexport type QuoteCommandPayload = {\n themeStyleId: string;\n};\n\nexport const INSERT_QUOTE_COMMAND: LexicalCommand<QuoteCommandPayload> =\n createCommand(\"INSERT_QUOTE_COMMAND\");\n"],"mappings":";;;;;;AAAA,IAAAA,QAAA,GAAAC,OAAA;AAMO,IAAMC,oBAAyD,GAClE,IAAAC,sBAAa,EAAC,sBAAsB,CAAC;AAACC,OAAA,CAAAF,oBAAA,GAAAA,oBAAA"}
@@ -1,7 +1,7 @@
1
- import React from "react";
1
+ /// <reference types="react" />
2
2
  import { RichTextEditorProps } from "./RichTextEditor";
3
3
  interface HeadingEditorProps extends RichTextEditorProps {
4
4
  tag?: "h1" | "h2" | "h3" | "h4" | "h5" | "h6";
5
5
  }
6
- export declare const HeadingEditor: React.FC<HeadingEditorProps>;
6
+ export declare const HeadingEditor: ({ tag, placeholder, ...rest }: HeadingEditorProps) => JSX.Element;
7
7
  export {};
@@ -7,22 +7,24 @@ Object.defineProperty(exports, "__esModule", {
7
7
  exports.HeadingEditor = void 0;
8
8
  var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
9
9
  var _react = _interopRequireDefault(require("react"));
10
- var _LexicalLinkPlugin = require("@lexical/react/LexicalLinkPlugin");
11
- var _ClickableLinkPlugin = require("../../plugins/ClickableLinkPlugin/ClickableLinkPlugin");
12
- var _FloatingLinkEditorPlugin = require("../../plugins/FloatingLinkEditorPlugin/FloatingLinkEditorPlugin");
13
- var _HeadingToolbar = require("../Toolbar/HeadingToolbar");
14
10
  var _RichTextEditor = require("./RichTextEditor");
11
+ var _Toolbar = require("../Toolbar/Toolbar");
15
12
  var _excluded = ["tag", "placeholder"];
13
+ var styles = {
14
+ padding: 5
15
+ };
16
16
  var HeadingEditor = function HeadingEditor(_ref) {
17
17
  var tag = _ref.tag,
18
18
  placeholder = _ref.placeholder,
19
19
  rest = (0, _objectWithoutProperties2.default)(_ref, _excluded);
20
20
  return /*#__PURE__*/_react.default.createElement(_RichTextEditor.RichTextEditor, Object.assign({
21
- toolbar: /*#__PURE__*/_react.default.createElement(_HeadingToolbar.HeadingToolbar, null),
22
- tag: tag !== null && tag !== void 0 ? tag : "h1",
23
- placeholder: placeholder !== null && placeholder !== void 0 ? placeholder : "Enter your heading text here..."
24
- }, rest), /*#__PURE__*/_react.default.createElement(_LexicalLinkPlugin.LinkPlugin, null), /*#__PURE__*/_react.default.createElement(_ClickableLinkPlugin.ClickableLinkPlugin, null), /*#__PURE__*/_react.default.createElement(_FloatingLinkEditorPlugin.FloatingLinkEditorPlugin, {
25
- anchorElem: document.body
26
- }));
21
+ toolbar: /*#__PURE__*/_react.default.createElement(_Toolbar.Toolbar, null),
22
+ tag: tag ?? "h1",
23
+ placeholder: placeholder ?? "Enter your heading text here..."
24
+ }, rest, {
25
+ styles: styles
26
+ }), rest?.children);
27
27
  };
28
- exports.HeadingEditor = HeadingEditor;
28
+ exports.HeadingEditor = HeadingEditor;
29
+
30
+ //# sourceMappingURL=HeadingEditor.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["HeadingEditor","tag","placeholder","rest","document","body"],"sources":["HeadingEditor.tsx"],"sourcesContent":["import React from \"react\";\nimport { LinkPlugin } from \"@lexical/react/LexicalLinkPlugin\";\nimport { ClickableLinkPlugin } from \"~/plugins/ClickableLinkPlugin/ClickableLinkPlugin\";\nimport { FloatingLinkEditorPlugin } from \"~/plugins/FloatingLinkEditorPlugin/FloatingLinkEditorPlugin\";\nimport { HeadingToolbar } from \"~/components/Toolbar/HeadingToolbar\";\nimport { RichTextEditor, RichTextEditorProps } from \"~/components/Editor/RichTextEditor\";\n\ninterface HeadingEditorProps extends RichTextEditorProps {\n tag?: \"h1\" | \"h2\" | \"h3\" | \"h4\" | \"h5\" | \"h6\";\n}\n\nexport const HeadingEditor: React.FC<HeadingEditorProps> = ({ tag, placeholder, ...rest }) => {\n return (\n <RichTextEditor\n toolbar={<HeadingToolbar />}\n tag={tag ?? \"h1\"}\n placeholder={placeholder ?? \"Enter your heading text here...\"}\n {...rest}\n >\n <LinkPlugin />\n <ClickableLinkPlugin />\n <FloatingLinkEditorPlugin anchorElem={document.body} />\n </RichTextEditor>\n );\n};\n"],"mappings":";;;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AAAyF;AAMlF,IAAMA,aAA2C,GAAG,SAA9CA,aAA2C,OAAsC;EAAA,IAAhCC,GAAG,QAAHA,GAAG;IAAEC,WAAW,QAAXA,WAAW;IAAKC,IAAI;EACnF,oBACI,6BAAC,8BAAc;IACX,OAAO,eAAE,6BAAC,8BAAc,OAAI;IAC5B,GAAG,EAAEF,GAAG,aAAHA,GAAG,cAAHA,GAAG,GAAI,IAAK;IACjB,WAAW,EAAEC,WAAW,aAAXA,WAAW,cAAXA,WAAW,GAAI;EAAkC,GAC1DC,IAAI,gBAER,6BAAC,6BAAU,OAAG,eACd,6BAAC,wCAAmB,OAAG,eACvB,6BAAC,kDAAwB;IAAC,UAAU,EAAEC,QAAQ,CAACC;EAAK,EAAG,CAC1C;AAEzB,CAAC;AAAC"}
1
+ {"version":3,"names":["_react","_interopRequireDefault","require","_RichTextEditor","_Toolbar","_excluded","styles","padding","HeadingEditor","_ref","tag","placeholder","rest","_objectWithoutProperties2","default","createElement","RichTextEditor","Object","assign","toolbar","Toolbar","children","exports"],"sources":["HeadingEditor.tsx"],"sourcesContent":["import React from \"react\";\nimport { RichTextEditor, RichTextEditorProps } from \"~/components/Editor/RichTextEditor\";\nimport { Toolbar } from \"~/components/Toolbar/Toolbar\";\n\ninterface HeadingEditorProps extends RichTextEditorProps {\n tag?: \"h1\" | \"h2\" | \"h3\" | \"h4\" | \"h5\" | \"h6\";\n}\n\nconst styles = { padding: 5 };\n\nexport const HeadingEditor = ({ tag, placeholder, ...rest }: HeadingEditorProps) => {\n return (\n <RichTextEditor\n toolbar={<Toolbar />}\n tag={tag ?? \"h1\"}\n placeholder={placeholder ?? \"Enter your heading text here...\"}\n {...rest}\n styles={styles}\n >\n {rest?.children}\n </RichTextEditor>\n );\n};\n"],"mappings":";;;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,eAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAF,OAAA;AAAuD,IAAAG,SAAA;AAMvD,IAAMC,MAAM,GAAG;EAAEC,OAAO,EAAE;AAAE,CAAC;AAEtB,IAAMC,aAAa,GAAG,SAAhBA,aAAaA,CAAAC,IAAA,EAA0D;EAAA,IAApDC,GAAG,GAAAD,IAAA,CAAHC,GAAG;IAAEC,WAAW,GAAAF,IAAA,CAAXE,WAAW;IAAKC,IAAI,OAAAC,yBAAA,CAAAC,OAAA,EAAAL,IAAA,EAAAJ,SAAA;EACrD,oBACIL,MAAA,CAAAc,OAAA,CAAAC,aAAA,CAACZ,eAAA,CAAAa,cAAc,EAAAC,MAAA,CAAAC,MAAA;IACXC,OAAO,eAAEnB,MAAA,CAAAc,OAAA,CAAAC,aAAA,CAACX,QAAA,CAAAgB,OAAO,MAAE,CAAE;IACrBV,GAAG,EAAEA,GAAG,IAAI,IAAK;IACjBC,WAAW,EAAEA,WAAW,IAAI;EAAkC,GAC1DC,IAAI;IACRN,MAAM,EAAEA;EAAO,IAEdM,IAAI,EAAES,QACK,CAAC;AAEzB,CAAC;AAACC,OAAA,CAAAd,aAAA,GAAAA,aAAA"}
@@ -1,7 +1,7 @@
1
- import React from "react";
1
+ /// <reference types="react" />
2
2
  import { RichTextEditorProps } from "./RichTextEditor";
3
3
  interface ParagraphLexicalEditorProps extends RichTextEditorProps {
4
4
  tag?: "p";
5
5
  }
6
- declare const ParagraphEditor: React.FC<ParagraphLexicalEditorProps>;
6
+ declare const ParagraphEditor: ({ placeholder, tag, ...rest }: ParagraphLexicalEditorProps) => JSX.Element;
7
7
  export { ParagraphEditor };
@@ -7,24 +7,24 @@ Object.defineProperty(exports, "__esModule", {
7
7
  exports.ParagraphEditor = void 0;
8
8
  var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
9
9
  var _react = _interopRequireDefault(require("react"));
10
- var _LexicalListPlugin = require("@lexical/react/LexicalListPlugin");
11
- var _CodeHighlightPlugin = require("../../plugins/CodeHighlightPlugin/CodeHighlightPlugin");
12
- var _LexicalLinkPlugin = require("@lexical/react/LexicalLinkPlugin");
13
- var _FloatingLinkEditorPlugin = require("../../plugins/FloatingLinkEditorPlugin/FloatingLinkEditorPlugin");
14
- var _ClickableLinkPlugin = require("../../plugins/ClickableLinkPlugin/ClickableLinkPlugin");
15
- var _ParagraphToolbar = require("../Toolbar/ParagraphToolbar");
16
10
  var _RichTextEditor = require("./RichTextEditor");
11
+ var _Toolbar = require("../Toolbar/Toolbar");
17
12
  var _excluded = ["placeholder", "tag"];
13
+ var styles = {
14
+ padding: 5
15
+ };
18
16
  var ParagraphEditor = function ParagraphEditor(_ref) {
19
17
  var placeholder = _ref.placeholder,
20
18
  tag = _ref.tag,
21
19
  rest = (0, _objectWithoutProperties2.default)(_ref, _excluded);
22
20
  return /*#__PURE__*/_react.default.createElement(_RichTextEditor.RichTextEditor, Object.assign({
23
- toolbar: /*#__PURE__*/_react.default.createElement(_ParagraphToolbar.ParagraphToolbar, null),
24
- tag: tag !== null && tag !== void 0 ? tag : "p",
25
- placeholder: placeholder !== null && placeholder !== void 0 ? placeholder : "Enter your text here..."
26
- }, rest), /*#__PURE__*/_react.default.createElement(_LexicalLinkPlugin.LinkPlugin, null), /*#__PURE__*/_react.default.createElement(_CodeHighlightPlugin.CodeHighlightPlugin, null), /*#__PURE__*/_react.default.createElement(_ClickableLinkPlugin.ClickableLinkPlugin, null), /*#__PURE__*/_react.default.createElement(_FloatingLinkEditorPlugin.FloatingLinkEditorPlugin, {
27
- anchorElem: document.body
28
- }), /*#__PURE__*/_react.default.createElement(_LexicalListPlugin.ListPlugin, null));
21
+ toolbar: /*#__PURE__*/_react.default.createElement(_Toolbar.Toolbar, null),
22
+ tag: tag ?? "p",
23
+ placeholder: placeholder ?? "Enter your text here..."
24
+ }, rest, {
25
+ styles: styles
26
+ }), rest?.children);
29
27
  };
30
- exports.ParagraphEditor = ParagraphEditor;
28
+ exports.ParagraphEditor = ParagraphEditor;
29
+
30
+ //# sourceMappingURL=ParagraphEditor.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["ParagraphEditor","placeholder","tag","rest","document","body"],"sources":["ParagraphEditor.tsx"],"sourcesContent":["import React from \"react\";\nimport { ListPlugin } from \"@lexical/react/LexicalListPlugin\";\nimport { CodeHighlightPlugin } from \"~/plugins/CodeHighlightPlugin/CodeHighlightPlugin\";\nimport { LinkPlugin } from \"@lexical/react/LexicalLinkPlugin\";\nimport { FloatingLinkEditorPlugin } from \"~/plugins/FloatingLinkEditorPlugin/FloatingLinkEditorPlugin\";\nimport { ClickableLinkPlugin } from \"~/plugins/ClickableLinkPlugin/ClickableLinkPlugin\";\nimport { ParagraphToolbar } from \"~/components/Toolbar/ParagraphToolbar\";\nimport { RichTextEditor, RichTextEditorProps } from \"~/components/Editor/RichTextEditor\";\n\ninterface ParagraphLexicalEditorProps extends RichTextEditorProps {\n tag?: \"p\";\n}\n\nconst ParagraphEditor: React.FC<ParagraphLexicalEditorProps> = ({ placeholder, tag, ...rest }) => {\n return (\n <RichTextEditor\n toolbar={<ParagraphToolbar />}\n tag={tag ?? \"p\"}\n placeholder={placeholder ?? \"Enter your text here...\"}\n {...rest}\n >\n <LinkPlugin />\n <CodeHighlightPlugin />\n <ClickableLinkPlugin />\n <FloatingLinkEditorPlugin anchorElem={document.body} />\n <ListPlugin />\n </RichTextEditor>\n );\n};\n\nexport { ParagraphEditor };\n"],"mappings":";;;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAyF;AAMzF,IAAMA,eAAsD,GAAG,SAAzDA,eAAsD,OAAsC;EAAA,IAAhCC,WAAW,QAAXA,WAAW;IAAEC,GAAG,QAAHA,GAAG;IAAKC,IAAI;EACvF,oBACI,6BAAC,8BAAc;IACX,OAAO,eAAE,6BAAC,kCAAgB,OAAI;IAC9B,GAAG,EAAED,GAAG,aAAHA,GAAG,cAAHA,GAAG,GAAI,GAAI;IAChB,WAAW,EAAED,WAAW,aAAXA,WAAW,cAAXA,WAAW,GAAI;EAA0B,GAClDE,IAAI,gBAER,6BAAC,6BAAU,OAAG,eACd,6BAAC,wCAAmB,OAAG,eACvB,6BAAC,wCAAmB,OAAG,eACvB,6BAAC,kDAAwB;IAAC,UAAU,EAAEC,QAAQ,CAACC;EAAK,EAAG,eACvD,6BAAC,6BAAU,OAAG,CACD;AAEzB,CAAC;AAAC"}
1
+ {"version":3,"names":["_react","_interopRequireDefault","require","_RichTextEditor","_Toolbar","_excluded","styles","padding","ParagraphEditor","_ref","placeholder","tag","rest","_objectWithoutProperties2","default","createElement","RichTextEditor","Object","assign","toolbar","Toolbar","children","exports"],"sources":["ParagraphEditor.tsx"],"sourcesContent":["import React from \"react\";\nimport { RichTextEditor, RichTextEditorProps } from \"~/components/Editor/RichTextEditor\";\nimport { Toolbar } from \"~/components/Toolbar/Toolbar\";\n\ninterface ParagraphLexicalEditorProps extends RichTextEditorProps {\n tag?: \"p\";\n}\n\nconst styles = { padding: 5 };\n\nconst ParagraphEditor = ({ placeholder, tag, ...rest }: ParagraphLexicalEditorProps) => {\n return (\n <RichTextEditor\n toolbar={<Toolbar />}\n tag={tag ?? \"p\"}\n placeholder={placeholder ?? \"Enter your text here...\"}\n {...rest}\n styles={styles}\n >\n {rest?.children}\n </RichTextEditor>\n );\n};\n\nexport { ParagraphEditor };\n"],"mappings":";;;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,eAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAF,OAAA;AAAuD,IAAAG,SAAA;AAMvD,IAAMC,MAAM,GAAG;EAAEC,OAAO,EAAE;AAAE,CAAC;AAE7B,IAAMC,eAAe,GAAG,SAAlBA,eAAeA,CAAAC,IAAA,EAAmE;EAAA,IAA7DC,WAAW,GAAAD,IAAA,CAAXC,WAAW;IAAEC,GAAG,GAAAF,IAAA,CAAHE,GAAG;IAAKC,IAAI,OAAAC,yBAAA,CAAAC,OAAA,EAAAL,IAAA,EAAAJ,SAAA;EAChD,oBACIL,MAAA,CAAAc,OAAA,CAAAC,aAAA,CAACZ,eAAA,CAAAa,cAAc,EAAAC,MAAA,CAAAC,MAAA;IACXC,OAAO,eAAEnB,MAAA,CAAAc,OAAA,CAAAC,aAAA,CAACX,QAAA,CAAAgB,OAAO,MAAE,CAAE;IACrBT,GAAG,EAAEA,GAAG,IAAI,GAAI;IAChBD,WAAW,EAAEA,WAAW,IAAI;EAA0B,GAClDE,IAAI;IACRN,MAAM,EAAEA;EAAO,IAEdM,IAAI,EAAES,QACK,CAAC;AAEzB,CAAC;AAACC,OAAA,CAAAd,eAAA,GAAAA,eAAA"}
@@ -1,25 +1,34 @@
1
1
  import React from "react";
2
- import { LexicalValue } from "../../types";
2
+ import { CSSObject } from "@emotion/react";
3
3
  import { Klass, LexicalNode } from "lexical";
4
- import { WebinyTheme } from "../../themes/webinyLexicalTheme";
4
+ import { LexicalValue, ToolbarActionPlugin } from "../../types";
5
+ import { WebinyTheme, ThemeEmotionMap } from "@webiny/lexical-theme";
5
6
  export interface RichTextEditorProps {
6
- toolbar?: React.ReactNode;
7
- tag?: string;
8
- onChange?: (json: LexicalValue) => void;
9
- value: LexicalValue | null;
7
+ children?: React.ReactNode | React.ReactNode[];
8
+ classes?: string;
9
+ contentEditableStyles?: React.CSSProperties;
10
10
  focus?: boolean;
11
- placeholder?: string;
11
+ height?: number | string;
12
12
  nodes?: Klass<LexicalNode>[];
13
- /**
14
- * @description Lexical plugins
15
- */
16
- children?: React.ReactNode | React.ReactNode[];
17
13
  onBlur?: (editorState: LexicalValue) => void;
18
- height?: number | string;
19
- width?: number | string;
14
+ onChange?: (json: LexicalValue) => void;
15
+ placeholder?: string;
16
+ placeholderStyles?: React.CSSProperties;
17
+ staticToolbar?: React.ReactNode;
18
+ styles?: React.CSSProperties;
19
+ tag?: string;
20
20
  theme: WebinyTheme;
21
+ themeEmotionMap?: ThemeEmotionMap;
22
+ themeStylesTransformer?: (cssObject: Record<string, any>) => CSSObject;
23
+ toolbar?: React.ReactNode;
24
+ toolbarActionPlugins?: ToolbarActionPlugin[];
25
+ value: LexicalValue | null;
26
+ width?: number | string;
21
27
  }
22
28
  /**
23
29
  * @description Main editor container
24
30
  */
25
- export declare const RichTextEditor: import("@webiny/react-composition").ComposableFC<RichTextEditorProps>;
31
+ export declare const RichTextEditor: React.FunctionComponent<RichTextEditorProps> & {
32
+ original: React.ComponentType<RichTextEditorProps>;
33
+ originalName: string;
34
+ };
@@ -10,8 +10,7 @@ var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/obje
10
10
  var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
11
11
  var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
12
12
  var _react = _interopRequireWildcard(require("react"));
13
- var _Placeholder = require("../../ui/Placeholder");
14
- var _generateInitialLexicalValue = require("../../utils/generateInitialLexicalValue");
13
+ var _react2 = require("@emotion/react");
15
14
  var _LexicalComposer = require("@lexical/react/LexicalComposer");
16
15
  var _LexicalOnChangePlugin = require("@lexical/react/LexicalOnChangePlugin");
17
16
  var _LexicalAutoFocusPlugin = require("@lexical/react/LexicalAutoFocusPlugin");
@@ -19,16 +18,22 @@ var _LexicalClearEditorPlugin = require("@lexical/react/LexicalClearEditorPlugin
19
18
  var _LexicalRichTextPlugin = require("@lexical/react/LexicalRichTextPlugin");
20
19
  var _LexicalErrorBoundary = _interopRequireDefault(require("@lexical/react/LexicalErrorBoundary"));
21
20
  var _reactComposition = require("@webiny/react-composition");
21
+ var _LexicalHistoryPlugin = require("@lexical/react/LexicalHistoryPlugin");
22
22
  var _LexicalContentEditable = require("@lexical/react/LexicalContentEditable");
23
23
  var _RichTextEditorContext = require("../../context/RichTextEditorContext");
24
24
  var _isValidLexicalData = require("../../utils/isValidLexicalData");
25
25
  var _LexicalUpdateStatePlugin = require("../../plugins/LexicalUpdateStatePlugin");
26
26
  var _BlurEventPlugin = require("../../plugins/BlurEventPlugin/BlurEventPlugin");
27
- var _FontColorPlugin = require("../../plugins/FontColorPlugin/FontColorPlugin");
28
- var _webinyLexicalTheme = require("../../themes/webinyLexicalTheme");
29
- var _webinyNodes = require("../../nodes/webinyNodes");
27
+ var _Placeholder = require("../../ui/Placeholder");
28
+ var _generateInitialLexicalValue = require("../../utils/generateInitialLexicalValue");
29
+ var _lexicalTheme = require("@webiny/lexical-theme");
30
+ var _lexicalNodes = require("@webiny/lexical-nodes");
31
+ var _SharedHistoryContext = require("../../context/SharedHistoryContext");
32
+ var _useRichTextEditor2 = require("../../hooks/useRichTextEditor");
33
+ var _LexicalEditorConfig = require("../LexicalEditorConfig/LexicalEditorConfig");
30
34
  var BaseRichTextEditor = function BaseRichTextEditor(_ref) {
31
35
  var toolbar = _ref.toolbar,
36
+ staticToolbar = _ref.staticToolbar,
32
37
  onChange = _ref.onChange,
33
38
  value = _ref.value,
34
39
  nodes = _ref.nodes,
@@ -36,15 +41,39 @@ var BaseRichTextEditor = function BaseRichTextEditor(_ref) {
36
41
  children = _ref.children,
37
42
  onBlur = _ref.onBlur,
38
43
  focus = _ref.focus,
44
+ styles = _ref.styles,
39
45
  width = _ref.width,
40
46
  height = _ref.height,
41
- theme = _ref.theme;
42
- var placeholderElem = /*#__PURE__*/_react.default.createElement(_Placeholder.Placeholder, null, placeholder || "Enter text...");
47
+ theme = _ref.theme,
48
+ themeEmotionMap = _ref.themeEmotionMap,
49
+ toolbarActionPlugins = _ref.toolbarActionPlugins,
50
+ contentEditableStyles = _ref.contentEditableStyles,
51
+ placeholderStyles = _ref.placeholderStyles;
52
+ var editorTheme = (0, _react.useRef)((0, _lexicalTheme.createTheme)());
53
+ var config = (0, _LexicalEditorConfig.useLexicalEditorConfig)();
54
+ var _useSharedHistoryCont = (0, _SharedHistoryContext.useSharedHistoryContext)(),
55
+ historyState = _useSharedHistoryCont.historyState;
56
+ var placeholderElem = /*#__PURE__*/_react.default.createElement(_Placeholder.Placeholder, {
57
+ styles: placeholderStyles
58
+ }, placeholder || "Enter text...");
43
59
  var scrollRef = (0, _react.useRef)(null);
44
60
  var _useState = (0, _react.useState)(undefined),
45
61
  _useState2 = (0, _slicedToArray2.default)(_useState, 2),
46
62
  floatingAnchorElem = _useState2[0],
47
63
  setFloatingAnchorElem = _useState2[1];
64
+ var _useRichTextEditor = (0, _useRichTextEditor2.useRichTextEditor)(),
65
+ setTheme = _useRichTextEditor.setTheme,
66
+ setThemeEmotionMap = _useRichTextEditor.setThemeEmotionMap,
67
+ setToolbarActionPlugins = _useRichTextEditor.setToolbarActionPlugins;
68
+ (0, _react.useEffect)(function () {
69
+ setTheme(theme);
70
+ setThemeEmotionMap(themeEmotionMap);
71
+ }, [themeEmotionMap, theme]);
72
+ (0, _react.useEffect)(function () {
73
+ if (toolbarActionPlugins) {
74
+ setToolbarActionPlugins(toolbarActionPlugins || []);
75
+ }
76
+ }, [toolbarActionPlugins]);
48
77
  var onRef = function onRef(_floatingAnchorElem) {
49
78
  if (_floatingAnchorElem !== null) {
50
79
  setFloatingAnchorElem(_floatingAnchorElem);
@@ -54,59 +83,94 @@ var BaseRichTextEditor = function BaseRichTextEditor(_ref) {
54
83
  height: height || "",
55
84
  width: width || ""
56
85
  };
86
+ var configNodes = config.nodes.map(function (node) {
87
+ return node.node;
88
+ });
89
+ var configPlugins = config.plugins.map(function (plugin) {
90
+ return /*#__PURE__*/_react.default.createElement(_react.Fragment, {
91
+ key: plugin.name
92
+ }, plugin.element);
93
+ });
94
+ var editorValue = (0, _isValidLexicalData.isValidLexicalData)(value) ? value : (0, _generateInitialLexicalValue.generateInitialLexicalValue)();
57
95
  var initialConfig = {
58
- editorState: (0, _isValidLexicalData.isValidLexicalData)(value) ? value : (0, _generateInitialLexicalValue.generateInitialLexicalValue)(),
96
+ // We update the state via the `<LexicalUpdateStatePlugin/>`.
97
+ editorState: null,
59
98
  namespace: "webiny",
60
- onError: function onError(error) {
61
- throw error;
99
+ onError: function onError() {
100
+ // Ignore errors. We don't want to break the app because of errors caused by config/value updates.
101
+ // These are usually resolved in the next component render cycle.
62
102
  },
63
- nodes: [].concat((0, _toConsumableArray2.default)(_webinyNodes.WebinyNodes), (0, _toConsumableArray2.default)(nodes || [])),
64
- theme: (0, _objectSpread2.default)((0, _objectSpread2.default)({}, _webinyLexicalTheme.webinyEditorTheme), {}, {
65
- styles: theme === null || theme === void 0 ? void 0 : theme.styles
103
+ nodes: [].concat((0, _toConsumableArray2.default)(_lexicalNodes.allNodes), (0, _toConsumableArray2.default)(configNodes), (0, _toConsumableArray2.default)(nodes || [])),
104
+ theme: (0, _objectSpread2.default)((0, _objectSpread2.default)({}, editorTheme.current), {}, {
105
+ emotionMap: themeEmotionMap
66
106
  })
67
107
  };
68
108
  function handleOnChange(editorState, editor) {
69
109
  editorState.read(function () {
70
110
  if (typeof onChange === "function") {
71
111
  var _editorState = editor.getEditorState();
72
- //TODO: send plain JSON object
73
112
  onChange(JSON.stringify(_editorState.toJSON()));
74
113
  }
75
114
  });
76
115
  }
77
- return /*#__PURE__*/_react.default.createElement(_LexicalComposer.LexicalComposer, {
78
- initialConfig: initialConfig
79
- }, /*#__PURE__*/_react.default.createElement("div", {
80
- ref: scrollRef,
81
- style: (0, _objectSpread2.default)({}, sizeStyle)
82
- }, /*#__PURE__*/_react.default.createElement(_LexicalOnChangePlugin.OnChangePlugin, {
83
- onChange: handleOnChange
84
- }), value && /*#__PURE__*/_react.default.createElement(_LexicalUpdateStatePlugin.LexicalUpdateStatePlugin, {
85
- value: value
86
- }), /*#__PURE__*/_react.default.createElement(_LexicalClearEditorPlugin.ClearEditorPlugin, null), /*#__PURE__*/_react.default.createElement(_FontColorPlugin.FontColorPlugin, null), onBlur && /*#__PURE__*/_react.default.createElement(_BlurEventPlugin.BlurEventPlugin, {
87
- onBlur: onBlur
88
- }), focus && /*#__PURE__*/_react.default.createElement(_LexicalAutoFocusPlugin.AutoFocusPlugin, null), children, /*#__PURE__*/_react.default.createElement(_LexicalRichTextPlugin.RichTextPlugin, {
89
- contentEditable: /*#__PURE__*/_react.default.createElement("div", {
90
- className: "editor-scroller",
91
- style: (0, _objectSpread2.default)({}, sizeStyle)
92
- }, /*#__PURE__*/_react.default.createElement("div", {
93
- className: "editor",
94
- ref: onRef,
95
- style: (0, _objectSpread2.default)({}, sizeStyle)
96
- }, /*#__PURE__*/_react.default.createElement(_LexicalContentEditable.ContentEditable, {
97
- style: (0, _objectSpread2.default)({
98
- outline: 0
99
- }, sizeStyle)
100
- }))),
101
- placeholder: placeholderElem,
102
- ErrorBoundary: _LexicalErrorBoundary.default
103
- }), floatingAnchorElem && toolbar));
116
+ return (
117
+ /*#__PURE__*/
118
+ /**
119
+ * Once the LexicalComposer is mounted, it caches the `initialConfig` internally, and all future
120
+ * updates to the config will be ignored. This is a problem because we pull in Nodes from our config,
121
+ * and initially, there can be multiple re-renders, while the config object is settled.
122
+ *
123
+ * To bypass this issue, we generate a naive `key` based on the number of Nodes.
124
+ */
125
+ _react.default.createElement(_LexicalComposer.LexicalComposer, {
126
+ initialConfig: initialConfig,
127
+ key: initialConfig.nodes.length
128
+ }, /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, staticToolbar && staticToolbar, /*#__PURE__*/_react.default.createElement("div", {
129
+ /* This className is necessary for targeting of editor container from CSS files. */
130
+ className: "editor-shell",
131
+ ref: scrollRef,
132
+ style: (0, _objectSpread2.default)((0, _objectSpread2.default)((0, _objectSpread2.default)({}, styles), sizeStyle), {}, {
133
+ overflow: "auto",
134
+ position: "relative"
135
+ })
136
+ }, /*#__PURE__*/_react.default.createElement(_LexicalOnChangePlugin.OnChangePlugin, {
137
+ onChange: handleOnChange
138
+ }), /*#__PURE__*/_react.default.createElement(_LexicalUpdateStatePlugin.UpdateStatePlugin, {
139
+ value: editorValue
140
+ }), /*#__PURE__*/_react.default.createElement(_LexicalClearEditorPlugin.ClearEditorPlugin, null), /*#__PURE__*/_react.default.createElement(_LexicalHistoryPlugin.HistoryPlugin, {
141
+ externalHistoryState: historyState
142
+ }), onBlur && /*#__PURE__*/_react.default.createElement(_BlurEventPlugin.BlurEventPlugin, {
143
+ onBlur: onBlur
144
+ }), focus && /*#__PURE__*/_react.default.createElement(_LexicalAutoFocusPlugin.AutoFocusPlugin, null), configPlugins, children, /*#__PURE__*/_react.default.createElement(_LexicalRichTextPlugin.RichTextPlugin, {
145
+ contentEditable: /*#__PURE__*/_react.default.createElement("div", {
146
+ className: "editor-scroller",
147
+ style: (0, _objectSpread2.default)({}, sizeStyle)
148
+ }, /*#__PURE__*/_react.default.createElement("div", {
149
+ className: "editor",
150
+ ref: onRef
151
+ }, /*#__PURE__*/_react.default.createElement(_LexicalContentEditable.ContentEditable, {
152
+ style: (0, _objectSpread2.default)({
153
+ outline: 0
154
+ }, contentEditableStyles)
155
+ }))),
156
+ placeholder: placeholderElem,
157
+ ErrorBoundary: _LexicalErrorBoundary.default
158
+ }), floatingAnchorElem && toolbar)))
159
+ );
104
160
  };
105
161
 
106
162
  /**
107
163
  * @description Main editor container
108
164
  */
109
165
  var RichTextEditor = (0, _reactComposition.makeComposable)("RichTextEditor", function (props) {
110
- return /*#__PURE__*/_react.default.createElement(_RichTextEditorContext.RichTextEditorProvider, null, /*#__PURE__*/_react.default.createElement(BaseRichTextEditor, props));
166
+ return /*#__PURE__*/_react.default.createElement(_LexicalEditorConfig.LexicalEditorWithConfig, null, /*#__PURE__*/_react.default.createElement(_RichTextEditorContext.RichTextEditorProvider, null, /*#__PURE__*/_react.default.createElement(_react2.ClassNames, null, function (_ref2) {
167
+ var css = _ref2.css;
168
+ var themeEmotionMap = props?.themeEmotionMap ?? (0, _lexicalTheme.toTypographyEmotionMap)(css, props.theme, props.themeStylesTransformer);
169
+ return /*#__PURE__*/_react.default.createElement(_SharedHistoryContext.SharedHistoryContext, null, /*#__PURE__*/_react.default.createElement(BaseRichTextEditor, Object.assign({}, props, {
170
+ themeEmotionMap: themeEmotionMap
171
+ })));
172
+ })));
111
173
  });
112
- exports.RichTextEditor = RichTextEditor;
174
+ exports.RichTextEditor = RichTextEditor;
175
+
176
+ //# sourceMappingURL=RichTextEditor.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["BaseRichTextEditor","toolbar","onChange","value","nodes","placeholder","children","onBlur","focus","width","height","theme","placeholderElem","scrollRef","useRef","useState","undefined","floatingAnchorElem","setFloatingAnchorElem","onRef","_floatingAnchorElem","sizeStyle","initialConfig","editorState","isValidLexicalData","generateInitialLexicalValue","namespace","onError","error","WebinyNodes","webinyEditorTheme","styles","handleOnChange","editor","read","getEditorState","JSON","stringify","toJSON","outline","LexicalErrorBoundary","RichTextEditor","makeComposable","props"],"sources":["RichTextEditor.tsx"],"sourcesContent":["import React, { useRef, useState } from \"react\";\nimport { LexicalValue } from \"~/types\";\nimport { Placeholder } from \"~/ui/Placeholder\";\nimport { generateInitialLexicalValue } from \"~/utils/generateInitialLexicalValue\";\nimport { EditorState } from \"lexical/LexicalEditorState\";\nimport { Klass, LexicalEditor, LexicalNode } from \"lexical\";\nimport { LexicalComposer } from \"@lexical/react/LexicalComposer\";\nimport { OnChangePlugin } from \"@lexical/react/LexicalOnChangePlugin\";\nimport { AutoFocusPlugin } from \"@lexical/react/LexicalAutoFocusPlugin\";\nimport { ClearEditorPlugin } from \"@lexical/react/LexicalClearEditorPlugin\";\nimport { RichTextPlugin } from \"@lexical/react/LexicalRichTextPlugin\";\nimport LexicalErrorBoundary from \"@lexical/react/LexicalErrorBoundary\";\nimport { makeComposable } from \"@webiny/react-composition\";\nimport { ContentEditable } from \"@lexical/react/LexicalContentEditable\";\nimport { RichTextEditorProvider } from \"~/context/RichTextEditorContext\";\nimport { isValidLexicalData } from \"~/utils/isValidLexicalData\";\nimport { LexicalUpdateStatePlugin } from \"~/plugins/LexicalUpdateStatePlugin\";\nimport { BlurEventPlugin } from \"~/plugins/BlurEventPlugin/BlurEventPlugin\";\nimport { FontColorPlugin } from \"~/plugins/FontColorPlugin/FontColorPlugin\";\nimport { webinyEditorTheme, WebinyTheme } from \"~/themes/webinyLexicalTheme\";\nimport { WebinyNodes } from \"~/nodes/webinyNodes\";\n\nexport interface RichTextEditorProps {\n toolbar?: React.ReactNode;\n tag?: string;\n onChange?: (json: LexicalValue) => void;\n value: LexicalValue | null;\n focus?: boolean;\n placeholder?: string;\n nodes?: Klass<LexicalNode>[];\n /**\n * @description Lexical plugins\n */\n children?: React.ReactNode | React.ReactNode[];\n onBlur?: (editorState: LexicalValue) => void;\n height?: number | string;\n width?: number | string;\n /*\n * @description Theme to be injected into lexical editor\n */\n theme: WebinyTheme;\n}\n\nconst BaseRichTextEditor: React.FC<RichTextEditorProps> = ({\n toolbar,\n onChange,\n value,\n nodes,\n placeholder,\n children,\n onBlur,\n focus,\n width,\n height,\n theme\n}: RichTextEditorProps) => {\n const placeholderElem = <Placeholder>{placeholder || \"Enter text...\"}</Placeholder>;\n const scrollRef = useRef(null);\n const [floatingAnchorElem, setFloatingAnchorElem] = useState<HTMLElement | undefined>(\n undefined\n );\n\n const onRef = (_floatingAnchorElem: HTMLDivElement) => {\n if (_floatingAnchorElem !== null) {\n setFloatingAnchorElem(_floatingAnchorElem);\n }\n };\n\n const sizeStyle = {\n height: height || \"\",\n width: width || \"\"\n };\n\n const initialConfig = {\n editorState: isValidLexicalData(value) ? value : generateInitialLexicalValue(),\n namespace: \"webiny\",\n onError: (error: Error) => {\n throw error;\n },\n nodes: [...WebinyNodes, ...(nodes || [])],\n theme: { ...webinyEditorTheme, styles: theme?.styles }\n };\n\n function handleOnChange(editorState: EditorState, editor: LexicalEditor) {\n editorState.read(() => {\n if (typeof onChange === \"function\") {\n const editorState = editor.getEditorState();\n //TODO: send plain JSON object\n onChange(JSON.stringify(editorState.toJSON()));\n }\n });\n }\n\n return (\n <LexicalComposer initialConfig={initialConfig}>\n <div ref={scrollRef} style={{ ...sizeStyle }}>\n {/* data */}\n <OnChangePlugin onChange={handleOnChange} />\n {value && <LexicalUpdateStatePlugin value={value} />}\n <ClearEditorPlugin />\n <FontColorPlugin />\n {/* Events */}\n {onBlur && <BlurEventPlugin onBlur={onBlur} />}\n {focus && <AutoFocusPlugin />}\n {/* External plugins and components */}\n {children}\n <RichTextPlugin\n contentEditable={\n <div className=\"editor-scroller\" style={{ ...sizeStyle }}>\n <div className=\"editor\" ref={onRef} style={{ ...sizeStyle }}>\n <ContentEditable style={{ outline: 0, ...sizeStyle }} />\n </div>\n </div>\n }\n placeholder={placeholderElem}\n ErrorBoundary={LexicalErrorBoundary}\n />\n {/* Toolbar */}\n {floatingAnchorElem && toolbar}\n </div>\n </LexicalComposer>\n );\n};\n\n/**\n * @description Main editor container\n */\nexport const RichTextEditor = makeComposable<RichTextEditorProps>(\"RichTextEditor\", props => {\n return (\n <RichTextEditorProvider>\n <BaseRichTextEditor {...props} />\n </RichTextEditorProvider>\n );\n});\n"],"mappings":";;;;;;;;;;;AAAA;AAEA;AACA;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAuBA,IAAMA,kBAAiD,GAAG,SAApDA,kBAAiD,OAY5B;EAAA,IAXvBC,OAAO,QAAPA,OAAO;IACPC,QAAQ,QAARA,QAAQ;IACRC,KAAK,QAALA,KAAK;IACLC,KAAK,QAALA,KAAK;IACLC,WAAW,QAAXA,WAAW;IACXC,QAAQ,QAARA,QAAQ;IACRC,MAAM,QAANA,MAAM;IACNC,KAAK,QAALA,KAAK;IACLC,KAAK,QAALA,KAAK;IACLC,MAAM,QAANA,MAAM;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Aa,EAAEhB;EAAc,gBAC1C;IAAK,GAAG,EAAET,SAAU;IAAC,KAAK,kCAAOQ,SAAS;EAAG,gBAEzC,6BAAC,qCAAc;IAAC,QAAQ,EAAEW;EAAe,EAAG,EAC3C7B,KAAK,iBAAI,6BAAC,kDAAwB;IAAC,KAAK,EAAEA;EAAM,EAAG,eACpD,6BAAC,2CAAiB,OAAG,eACrB,6BAAC,gCAAe,OAAG,EAElBI,MAAM,iBAAI,6BAAC,gCAAe;IAAC,MAAM,EAAEA;EAAO,EAAG,EAC7CC,KAAK,iBAAI,6BAAC,uCAAe,OAAG,EAE5BF,QAAQ,eACT,6BAAC,qCAAc;IACX,eAAe,eACX;MAAK,SAAS,EAAC,iBAAiB;MAAC,KAAK,kCAAOe,SAAS;IAAG,gBACrD;MAAK,SAAS,EAAC,QAAQ;MAAC,GAAG,EAAEF,KAAM;MAAC,KAAK,kCAAOE,SAAS;IAAG,gBACxD,6BAAC,uCAAe;MAAC,KAAK;QAAIkB,OAAO,EAAE;MAAC,GAAKlB,SAAS;IAAG,EAAG,CACtD,CAEb;IACD,WAAW,EAAET,eAAgB;IAC7B,aAAa,EAAE4B;EAAqB,EACtC,EAEDvB,kBAAkB,IAAIhB,OAAO,CAC5B,CACQ;AAE1B,CAAC;;AAED;AACA;AACA;AACO,IAAMwC,cAAc,GAAG,IAAAC,gCAAc,EAAsB,gBAAgB,EAAE,UAAAC,KAAK,EAAI;EACzF,oBACI,6BAAC,6CAAsB,qBACnB,6BAAC,kBAAkB,EAAKA,KAAK,CAAI,CACZ;AAEjC,CAAC,CAAC;AAAC"}
1
+ {"version":3,"names":["_react","_interopRequireWildcard","require","_react2","_LexicalComposer","_LexicalOnChangePlugin","_LexicalAutoFocusPlugin","_LexicalClearEditorPlugin","_LexicalRichTextPlugin","_LexicalErrorBoundary","_interopRequireDefault","_reactComposition","_LexicalHistoryPlugin","_LexicalContentEditable","_RichTextEditorContext","_isValidLexicalData","_LexicalUpdateStatePlugin","_BlurEventPlugin","_Placeholder","_generateInitialLexicalValue","_lexicalTheme","_lexicalNodes","_SharedHistoryContext","_useRichTextEditor2","_LexicalEditorConfig","BaseRichTextEditor","_ref","toolbar","staticToolbar","onChange","value","nodes","placeholder","children","onBlur","focus","styles","width","height","theme","themeEmotionMap","toolbarActionPlugins","contentEditableStyles","placeholderStyles","editorTheme","useRef","createTheme","config","useLexicalEditorConfig","_useSharedHistoryCont","useSharedHistoryContext","historyState","placeholderElem","default","createElement","Placeholder","scrollRef","_useState","useState","undefined","_useState2","_slicedToArray2","floatingAnchorElem","setFloatingAnchorElem","_useRichTextEditor","useRichTextEditor","setTheme","setThemeEmotionMap","setToolbarActionPlugins","useEffect","onRef","_floatingAnchorElem","sizeStyle","configNodes","map","node","configPlugins","plugins","plugin","Fragment","key","name","element","editorValue","isValidLexicalData","generateInitialLexicalValue","initialConfig","editorState","namespace","onError","concat","_toConsumableArray2","allNodes","_objectSpread2","current","emotionMap","handleOnChange","editor","read","getEditorState","JSON","stringify","toJSON","LexicalComposer","length","className","ref","style","overflow","position","OnChangePlugin","UpdateStatePlugin","ClearEditorPlugin","HistoryPlugin","externalHistoryState","BlurEventPlugin","AutoFocusPlugin","RichTextPlugin","contentEditable","ContentEditable","outline","ErrorBoundary","LexicalErrorBoundary","RichTextEditor","makeComposable","props","LexicalEditorWithConfig","RichTextEditorProvider","ClassNames","_ref2","css","toTypographyEmotionMap","themeStylesTransformer","SharedHistoryContext","Object","assign","exports"],"sources":["RichTextEditor.tsx"],"sourcesContent":["import React, { Fragment, useEffect, useRef, useState } from \"react\";\nimport { ClassNames, CSSObject } from \"@emotion/react\";\nimport { Klass, LexicalEditor, LexicalNode } from \"lexical\";\nimport { EditorState } from \"lexical/LexicalEditorState\";\nimport { LexicalComposer } from \"@lexical/react/LexicalComposer\";\nimport { OnChangePlugin } from \"@lexical/react/LexicalOnChangePlugin\";\nimport { AutoFocusPlugin } from \"@lexical/react/LexicalAutoFocusPlugin\";\nimport { ClearEditorPlugin } from \"@lexical/react/LexicalClearEditorPlugin\";\nimport { RichTextPlugin } from \"@lexical/react/LexicalRichTextPlugin\";\nimport LexicalErrorBoundary from \"@lexical/react/LexicalErrorBoundary\";\nimport { makeComposable } from \"@webiny/react-composition\";\nimport { HistoryPlugin } from \"@lexical/react/LexicalHistoryPlugin\";\nimport { ContentEditable } from \"@lexical/react/LexicalContentEditable\";\nimport { RichTextEditorProvider } from \"~/context/RichTextEditorContext\";\nimport { isValidLexicalData } from \"~/utils/isValidLexicalData\";\nimport { UpdateStatePlugin } from \"~/plugins/LexicalUpdateStatePlugin\";\nimport { BlurEventPlugin } from \"~/plugins/BlurEventPlugin/BlurEventPlugin\";\nimport { LexicalValue, ToolbarActionPlugin } from \"~/types\";\nimport { Placeholder } from \"~/ui/Placeholder\";\nimport { generateInitialLexicalValue } from \"~/utils/generateInitialLexicalValue\";\nimport {\n createTheme,\n WebinyTheme,\n ThemeEmotionMap,\n toTypographyEmotionMap\n} from \"@webiny/lexical-theme\";\nimport { allNodes } from \"@webiny/lexical-nodes\";\nimport { SharedHistoryContext, useSharedHistoryContext } from \"~/context/SharedHistoryContext\";\nimport { useRichTextEditor } from \"~/hooks/useRichTextEditor\";\nimport {\n LexicalEditorWithConfig,\n useLexicalEditorConfig\n} from \"~/components/LexicalEditorConfig/LexicalEditorConfig\";\n\nexport interface RichTextEditorProps {\n children?: React.ReactNode | React.ReactNode[];\n classes?: string;\n contentEditableStyles?: React.CSSProperties;\n focus?: boolean;\n height?: number | string;\n nodes?: Klass<LexicalNode>[];\n onBlur?: (editorState: LexicalValue) => void;\n onChange?: (json: LexicalValue) => void;\n placeholder?: string;\n placeholderStyles?: React.CSSProperties;\n staticToolbar?: React.ReactNode;\n styles?: React.CSSProperties;\n tag?: string;\n theme: WebinyTheme;\n themeEmotionMap?: ThemeEmotionMap;\n themeStylesTransformer?: (cssObject: Record<string, any>) => CSSObject;\n toolbar?: React.ReactNode;\n toolbarActionPlugins?: ToolbarActionPlugin[];\n value: LexicalValue | null;\n width?: number | string;\n}\n\nconst BaseRichTextEditor = ({\n toolbar,\n staticToolbar,\n onChange,\n value,\n nodes,\n placeholder,\n children,\n onBlur,\n focus,\n styles,\n width,\n height,\n theme,\n themeEmotionMap,\n toolbarActionPlugins,\n contentEditableStyles,\n placeholderStyles\n}: RichTextEditorProps) => {\n const editorTheme = useRef(createTheme());\n const config = useLexicalEditorConfig();\n const { historyState } = useSharedHistoryContext();\n const placeholderElem = (\n <Placeholder styles={placeholderStyles}>{placeholder || \"Enter text...\"}</Placeholder>\n );\n const scrollRef = useRef(null);\n const [floatingAnchorElem, setFloatingAnchorElem] = useState<HTMLElement | undefined>(\n undefined\n );\n const { setTheme, setThemeEmotionMap, setToolbarActionPlugins } = useRichTextEditor();\n\n useEffect(() => {\n setTheme(theme);\n setThemeEmotionMap(themeEmotionMap);\n }, [themeEmotionMap, theme]);\n\n useEffect(() => {\n if (toolbarActionPlugins) {\n setToolbarActionPlugins(toolbarActionPlugins || []);\n }\n }, [toolbarActionPlugins]);\n\n const onRef = (_floatingAnchorElem: HTMLDivElement) => {\n if (_floatingAnchorElem !== null) {\n setFloatingAnchorElem(_floatingAnchorElem);\n }\n };\n\n const sizeStyle = {\n height: height || \"\",\n width: width || \"\"\n };\n\n const configNodes = config.nodes.map(node => node.node);\n const configPlugins = config.plugins.map(plugin => (\n <Fragment key={plugin.name}>{plugin.element}</Fragment>\n ));\n\n const editorValue = isValidLexicalData(value) ? value : generateInitialLexicalValue();\n\n const initialConfig = {\n // We update the state via the `<LexicalUpdateStatePlugin/>`.\n editorState: null,\n namespace: \"webiny\",\n onError: () => {\n // Ignore errors. We don't want to break the app because of errors caused by config/value updates.\n // These are usually resolved in the next component render cycle.\n },\n nodes: [...allNodes, ...configNodes, ...(nodes || [])],\n theme: { ...editorTheme.current, emotionMap: themeEmotionMap }\n };\n\n function handleOnChange(editorState: EditorState, editor: LexicalEditor) {\n editorState.read(() => {\n if (typeof onChange === \"function\") {\n const editorState = editor.getEditorState();\n onChange(JSON.stringify(editorState.toJSON()));\n }\n });\n }\n\n return (\n /**\n * Once the LexicalComposer is mounted, it caches the `initialConfig` internally, and all future\n * updates to the config will be ignored. This is a problem because we pull in Nodes from our config,\n * and initially, there can be multiple re-renders, while the config object is settled.\n *\n * To bypass this issue, we generate a naive `key` based on the number of Nodes.\n */\n <LexicalComposer initialConfig={initialConfig} key={initialConfig.nodes.length}>\n <>\n {staticToolbar && staticToolbar}\n <div\n /* This className is necessary for targeting of editor container from CSS files. */\n className={\"editor-shell\"}\n ref={scrollRef}\n style={{ ...styles, ...sizeStyle, overflow: \"auto\", position: \"relative\" }}\n >\n {/* data */}\n <OnChangePlugin onChange={handleOnChange} />\n <UpdateStatePlugin value={editorValue} />\n <ClearEditorPlugin />\n <HistoryPlugin externalHistoryState={historyState} />\n {/* Events */}\n {onBlur && <BlurEventPlugin onBlur={onBlur} />}\n {focus && <AutoFocusPlugin />}\n {/* External plugins and components */}\n {configPlugins}\n {children}\n <RichTextPlugin\n contentEditable={\n <div className=\"editor-scroller\" style={{ ...sizeStyle }}>\n <div className=\"editor\" ref={onRef}>\n <ContentEditable\n style={{ outline: 0, ...contentEditableStyles }}\n />\n </div>\n </div>\n }\n placeholder={placeholderElem}\n ErrorBoundary={LexicalErrorBoundary}\n />\n {/* Toolbar */}\n {floatingAnchorElem && toolbar}\n </div>\n </>\n </LexicalComposer>\n );\n};\n\n/**\n * @description Main editor container\n */\nexport const RichTextEditor = makeComposable<RichTextEditorProps>(\"RichTextEditor\", props => {\n return (\n <LexicalEditorWithConfig>\n <RichTextEditorProvider>\n <ClassNames>\n {({ css }) => {\n const themeEmotionMap =\n props?.themeEmotionMap ??\n toTypographyEmotionMap(css, props.theme, props.themeStylesTransformer);\n return (\n <SharedHistoryContext>\n <BaseRichTextEditor {...props} themeEmotionMap={themeEmotionMap} />\n </SharedHistoryContext>\n );\n }}\n </ClassNames>\n </RichTextEditorProvider>\n </LexicalEditorWithConfig>\n );\n});\n"],"mappings":";;;;;;;;;;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BACI7H,MAAA,CAAAqD,OAAA,CAAAC,aAAA,CAAC9B,oBAAA,CAAAsG,uBAAuB,qBACpB9H,MAAA,CAAAqD,OAAA,CAAAC,aAAA,CAACxC,sBAAA,CAAAiH,sBAAsB,qBACnB/H,MAAA,CAAAqD,OAAA,CAAAC,aAAA,CAACnD,OAAA,CAAA6H,UAAU,QACN,UAAAC,KAAA,EAAa;IAAA,IAAVC,GAAG,GAAAD,KAAA,CAAHC,GAAG;IACH,IAAM1F,eAAe,GACjBqF,KAAK,EAAErF,eAAe,IACtB,IAAA2F,oCAAsB,EAACD,GAAG,EAAEL,KAAK,CAACtF,KAAK,EAAEsF,KAAK,CAACO,sBAAsB,CAAC;IAC1E,oBACIpI,MAAA,CAAAqD,OAAA,CAAAC,aAAA,CAAChC,qBAAA,CAAA+G,oBAAoB,qBACjBrI,MAAA,CAAAqD,OAAA,CAAAC,aAAA,CAAC7B,kBAAkB,EAAA6G,MAAA,CAAAC,MAAA,KAAKV,KAAK;MAAErF,eAAe,EAAEA;IAAgB,EAAE,CAChD,CAAC;EAE/B,CACQ,CACQ,CACH,CAAC;AAElC,CAAC,CAAC;AAACgG,OAAA,CAAAb,cAAA,GAAAA,cAAA"}
@@ -1,7 +1,20 @@
1
1
  import React from "react";
2
- import { FontColorAction } from "../ToolbarActions/FontColorAction";
3
- interface LexicalEditorConfig extends React.FC<unknown> {
4
- FontColorAction: typeof FontColorAction;
5
- }
6
- export declare const LexicalEditorConfig: LexicalEditorConfig;
7
- export {};
2
+ import { ToolbarElementConfig } from "./components/ToolbarElement";
3
+ import { PluginConfig } from "./components/Plugin";
4
+ import { NodeConfig } from "./components/Node";
5
+ export declare const LexicalEditorConfig: {
6
+ ({ children }: {
7
+ children: React.ReactNode;
8
+ }): JSX.Element;
9
+ ToolbarElement: ({ name, element, after, before, remove }: import("./components/ToolbarElement").ToolbarElementProps) => JSX.Element;
10
+ Plugin: ({ name, element, after, before, remove }: import("./components/Plugin").PluginProps) => JSX.Element;
11
+ Node: ({ name, node, after, before, remove }: import("./components/Node").NodeProps) => JSX.Element;
12
+ };
13
+ export declare const LexicalEditorWithConfig: ({ children }: {
14
+ children: React.ReactNode;
15
+ }) => JSX.Element;
16
+ export declare function useLexicalEditorConfig(): {
17
+ toolbarElements: ToolbarElementConfig[];
18
+ plugins: PluginConfig[];
19
+ nodes: NodeConfig[];
20
+ };