@webiny/lexical-editor 0.0.0-unstable.c2780f51fe → 0.0.0-unstable.c7dec08bb0

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 (261) hide show
  1. package/commands/insertFiles.d.ts +14 -0
  2. package/commands/insertFiles.js +9 -0
  3. package/commands/insertFiles.js.map +1 -0
  4. package/commands/webiny-list.d.ts +7 -0
  5. package/commands/webiny-list.js +13 -0
  6. package/commands/webiny-list.js.map +1 -0
  7. package/commands/webiny-quote.d.ts +5 -0
  8. package/commands/webiny-quote.js +9 -0
  9. package/commands/webiny-quote.js.map +1 -0
  10. package/components/Editor/HeadingEditor.js +7 -8
  11. package/components/Editor/HeadingEditor.js.map +1 -1
  12. package/components/Editor/ParagraphEditor.js +7 -10
  13. package/components/Editor/ParagraphEditor.js.map +1 -1
  14. package/components/Editor/RichTextEditor.d.ts +8 -1
  15. package/components/Editor/RichTextEditor.js +62 -15
  16. package/components/Editor/RichTextEditor.js.map +1 -1
  17. package/components/ImageComponent.d.ts +23 -0
  18. package/components/ImageComponent.js +252 -0
  19. package/components/ImageComponent.js.map +1 -0
  20. package/components/LexicalEditorConfig/LexicalEditorConfig.d.ts +19 -6
  21. package/components/LexicalEditorConfig/LexicalEditorConfig.js +63 -5
  22. package/components/LexicalEditorConfig/LexicalEditorConfig.js.map +1 -1
  23. package/components/LexicalEditorConfig/components/Node.d.ts +14 -0
  24. package/components/LexicalEditorConfig/components/Node.js +38 -0
  25. package/components/LexicalEditorConfig/components/Node.js.map +1 -0
  26. package/components/LexicalEditorConfig/components/Plugin.d.ts +13 -0
  27. package/components/LexicalEditorConfig/components/Plugin.js +38 -0
  28. package/components/LexicalEditorConfig/components/Plugin.js.map +1 -0
  29. package/components/LexicalEditorConfig/components/ToolbarElement.d.ts +13 -0
  30. package/components/LexicalEditorConfig/components/ToolbarElement.js +38 -0
  31. package/components/LexicalEditorConfig/components/ToolbarElement.js.map +1 -0
  32. package/components/LexicalHtmlRenderer.d.ts +6 -1
  33. package/components/LexicalHtmlRenderer.js +22 -3
  34. package/components/LexicalHtmlRenderer.js.map +1 -1
  35. package/components/Toolbar/StaticToolbar.css +260 -0
  36. package/components/Toolbar/StaticToolbar.d.ts +3 -0
  37. package/components/Toolbar/StaticToolbar.js +101 -0
  38. package/components/Toolbar/StaticToolbar.js.map +1 -0
  39. package/components/Toolbar/Toolbar.css +227 -4
  40. package/components/Toolbar/Toolbar.d.ts +2 -8
  41. package/components/Toolbar/Toolbar.js +95 -53
  42. package/components/Toolbar/Toolbar.js.map +1 -1
  43. package/components/ToolbarActions/BoldAction.d.ts +0 -3
  44. package/components/ToolbarActions/BoldAction.js +8 -3
  45. package/components/ToolbarActions/BoldAction.js.map +1 -1
  46. package/components/ToolbarActions/BulletListAction.d.ts +0 -3
  47. package/components/ToolbarActions/BulletListAction.js +22 -55
  48. package/components/ToolbarActions/BulletListAction.js.map +1 -1
  49. package/components/ToolbarActions/CodeHighlightAction.d.ts +0 -4
  50. package/components/ToolbarActions/CodeHighlightAction.js +8 -4
  51. package/components/ToolbarActions/CodeHighlightAction.js.map +1 -1
  52. package/components/ToolbarActions/FontColorAction.js +1 -6
  53. package/components/ToolbarActions/FontColorAction.js.map +1 -1
  54. package/components/ToolbarActions/FontSizeAction.js +1 -4
  55. package/components/ToolbarActions/FontSizeAction.js.map +1 -1
  56. package/components/ToolbarActions/ImageAction.d.ts +2 -0
  57. package/components/ToolbarActions/ImageAction.js +53 -0
  58. package/components/ToolbarActions/ImageAction.js.map +1 -0
  59. package/components/ToolbarActions/ItalicAction.d.ts +0 -3
  60. package/components/ToolbarActions/ItalicAction.js +8 -3
  61. package/components/ToolbarActions/ItalicAction.js.map +1 -1
  62. package/components/ToolbarActions/LinkAction.d.ts +0 -5
  63. package/components/ToolbarActions/LinkAction.js +0 -5
  64. package/components/ToolbarActions/LinkAction.js.map +1 -1
  65. package/components/ToolbarActions/NumberedListAction.d.ts +0 -3
  66. package/components/ToolbarActions/NumberedListAction.js +34 -53
  67. package/components/ToolbarActions/NumberedListAction.js.map +1 -1
  68. package/components/ToolbarActions/QuoteAction.d.ts +0 -2
  69. package/components/ToolbarActions/QuoteAction.js +17 -31
  70. package/components/ToolbarActions/QuoteAction.js.map +1 -1
  71. package/components/ToolbarActions/TextAlignmentAction.d.ts +11 -0
  72. package/components/ToolbarActions/TextAlignmentAction.js +70 -0
  73. package/components/ToolbarActions/TextAlignmentAction.js.map +1 -0
  74. package/components/ToolbarActions/TypographyAction.d.ts +11 -0
  75. package/components/ToolbarActions/TypographyAction.js +145 -0
  76. package/components/ToolbarActions/TypographyAction.js.map +1 -0
  77. package/components/ToolbarActions/UnderlineAction.d.ts +0 -3
  78. package/components/ToolbarActions/UnderlineAction.js +8 -3
  79. package/components/ToolbarActions/UnderlineAction.js.map +1 -1
  80. package/context/RichTextEditorContext.d.ts +17 -0
  81. package/context/RichTextEditorContext.js +46 -1
  82. package/context/RichTextEditorContext.js.map +1 -1
  83. package/context/SharedHistoryContext.d.ts +11 -0
  84. package/context/SharedHistoryContext.js +26 -0
  85. package/context/SharedHistoryContext.js.map +1 -0
  86. package/context/TextAlignmentActionContextProps.d.ts +9 -0
  87. package/context/TextAlignmentActionContextProps.js +10 -0
  88. package/context/TextAlignmentActionContextProps.js.map +1 -0
  89. package/context/TypographyActionContext.d.ts +7 -0
  90. package/context/TypographyActionContext.js +10 -0
  91. package/context/TypographyActionContext.js.map +1 -0
  92. package/hooks/useList.d.ts +2 -0
  93. package/hooks/useList.js +39 -0
  94. package/hooks/useList.js.map +1 -0
  95. package/hooks/useQuote.d.ts +2 -0
  96. package/hooks/useQuote.js +20 -0
  97. package/hooks/useQuote.js.map +1 -0
  98. package/hooks/useTextAlignmentAction.d.ts +1 -0
  99. package/hooks/useTextAlignmentAction.js +15 -0
  100. package/hooks/useTextAlignmentAction.js.map +1 -0
  101. package/hooks/useTypographyAction.d.ts +1 -0
  102. package/hooks/useTypographyAction.js +15 -0
  103. package/hooks/useTypographyAction.js.map +1 -0
  104. package/images/icons/indent.svg +3 -0
  105. package/images/icons/insert-image.svg +4 -0
  106. package/images/icons/justify.svg +3 -0
  107. package/images/icons/outdent.svg +3 -0
  108. package/index.d.ts +14 -9
  109. package/index.js +85 -44
  110. package/index.js.map +1 -1
  111. package/nodes/FontColorNode.js +1 -1
  112. package/nodes/FontColorNode.js.map +1 -1
  113. package/nodes/HeadingNode.d.ts +34 -0
  114. package/nodes/HeadingNode.js +192 -0
  115. package/nodes/HeadingNode.js.map +1 -0
  116. package/nodes/ImageNode.d.ts +50 -0
  117. package/nodes/ImageNode.js +217 -0
  118. package/nodes/ImageNode.js.map +1 -0
  119. package/nodes/ListItemNode.d.ts +46 -0
  120. package/nodes/ListItemNode.js +441 -0
  121. package/nodes/ListItemNode.js.map +1 -0
  122. package/nodes/ListNode/formatList.d.ts +12 -0
  123. package/nodes/ListNode/formatList.js +424 -0
  124. package/nodes/ListNode/formatList.js.map +1 -0
  125. package/nodes/ListNode.d.ts +42 -0
  126. package/nodes/ListNode.js +294 -0
  127. package/nodes/ListNode.js.map +1 -0
  128. package/nodes/ParagraphNode.d.ts +32 -0
  129. package/nodes/ParagraphNode.js +218 -0
  130. package/nodes/ParagraphNode.js.map +1 -0
  131. package/nodes/QuoteNode.d.ts +34 -0
  132. package/nodes/QuoteNode.js +225 -0
  133. package/nodes/QuoteNode.js.map +1 -0
  134. package/nodes/TypographyElementNode.d.ts +42 -0
  135. package/nodes/TypographyElementNode.js +155 -0
  136. package/nodes/TypographyElementNode.js.map +1 -0
  137. package/nodes/imageNode.css +43 -0
  138. package/nodes/types.d.ts +15 -0
  139. package/nodes/types.js +5 -0
  140. package/nodes/types.js.map +1 -0
  141. package/nodes/webinyNodes.d.ts +6 -1
  142. package/nodes/webinyNodes.js +33 -3
  143. package/nodes/webinyNodes.js.map +1 -1
  144. package/package.json +21 -17
  145. package/plugins/FloatingLinkEditorPlugin/FloatingLinkEditorPlugin.css +5 -1
  146. package/plugins/FloatingLinkEditorPlugin/FloatingLinkEditorPlugin.js +52 -14
  147. package/plugins/FloatingLinkEditorPlugin/FloatingLinkEditorPlugin.js.map +1 -1
  148. package/plugins/FontColorPlugin/FontColorPlugin.js +2 -1
  149. package/plugins/FontColorPlugin/FontColorPlugin.js.map +1 -1
  150. package/plugins/ImagesPlugin/ImagesPlugin.d.ts +13 -0
  151. package/plugins/ImagesPlugin/ImagesPlugin.js +152 -0
  152. package/plugins/ImagesPlugin/ImagesPlugin.js.map +1 -0
  153. package/plugins/ListPLugin/ListPlugin.d.ts +1 -0
  154. package/plugins/ListPLugin/ListPlugin.js +25 -0
  155. package/plugins/ListPLugin/ListPlugin.js.map +1 -0
  156. package/plugins/TypographyPlugin/TypographyPlugin.d.ts +2 -0
  157. package/plugins/TypographyPlugin/TypographyPlugin.js +35 -0
  158. package/plugins/TypographyPlugin/TypographyPlugin.js.map +1 -0
  159. package/plugins/WebinyQuoteNodePlugin/WebinyQuoteNodePlugin.d.ts +1 -0
  160. package/plugins/WebinyQuoteNodePlugin/WebinyQuoteNodePlugin.js +24 -0
  161. package/plugins/WebinyQuoteNodePlugin/WebinyQuoteNodePlugin.js.map +1 -0
  162. package/themes/webinyLexicalTheme.css +16 -15
  163. package/themes/webinyLexicalTheme.d.ts +2 -0
  164. package/themes/webinyLexicalTheme.js +5 -1
  165. package/themes/webinyLexicalTheme.js.map +1 -1
  166. package/types.d.ts +68 -0
  167. package/types.js +28 -1
  168. package/types.js.map +1 -1
  169. package/ui/ContentEditable.css +22 -0
  170. package/ui/ContentEditable.d.ts +12 -0
  171. package/ui/ContentEditable.js +24 -0
  172. package/ui/ContentEditable.js.map +1 -0
  173. package/ui/DropDown.js +52 -19
  174. package/ui/DropDown.js.map +1 -1
  175. package/ui/ImageResizer.d.ts +26 -0
  176. package/ui/ImageResizer.js +213 -0
  177. package/ui/ImageResizer.js.map +1 -0
  178. package/ui/LinkPreview.js +7 -7
  179. package/ui/LinkPreview.js.map +1 -1
  180. package/ui/Placeholder.css +2 -5
  181. package/ui/Placeholder.d.ts +3 -1
  182. package/ui/Placeholder.js +5 -1
  183. package/ui/Placeholder.js.map +1 -1
  184. package/ui/ToolbarActionDialog.js +0 -1
  185. package/ui/ToolbarActionDialog.js.map +1 -1
  186. package/utils/canUseDOM.d.ts +1 -0
  187. package/utils/canUseDOM.js +8 -0
  188. package/utils/canUseDOM.js.map +1 -0
  189. package/utils/files.d.ts +12 -0
  190. package/utils/files.js +62 -0
  191. package/utils/files.js.map +1 -0
  192. package/utils/findTypographyStyleByHtmlTag.d.ts +8 -0
  193. package/utils/findTypographyStyleByHtmlTag.js +16 -0
  194. package/utils/findTypographyStyleByHtmlTag.js.map +1 -0
  195. package/utils/generateInitialLexicalValue.js +2 -1
  196. package/utils/generateInitialLexicalValue.js.map +1 -1
  197. package/utils/getLexicalTextSelectionState.d.ts +5 -0
  198. package/utils/getLexicalTextSelectionState.js +163 -0
  199. package/utils/getLexicalTextSelectionState.js.map +1 -0
  200. package/utils/getTransparentImage.d.ts +1 -0
  201. package/utils/getTransparentImage.js +10 -0
  202. package/utils/getTransparentImage.js.map +1 -0
  203. package/{plugins/AutoLinkPlugin/AutoLinkPlugin.d.ts → utils/isHTMLElement.d.ts} +3 -4
  204. package/utils/isHTMLElement.js +16 -0
  205. package/utils/isHTMLElement.js.map +1 -0
  206. package/utils/nodes/clearNodeFormating.d.ts +2 -0
  207. package/utils/nodes/clearNodeFormating.js +28 -0
  208. package/utils/nodes/clearNodeFormating.js.map +1 -0
  209. package/utils/nodes/formatToHeading.d.ts +3 -0
  210. package/utils/nodes/formatToHeading.js +25 -0
  211. package/utils/nodes/formatToHeading.js.map +1 -0
  212. package/utils/nodes/formatToParagraph.d.ts +2 -0
  213. package/utils/nodes/formatToParagraph.js +20 -0
  214. package/utils/nodes/formatToParagraph.js.map +1 -0
  215. package/utils/nodes/formatToQuote.d.ts +2 -0
  216. package/utils/nodes/formatToQuote.js +25 -0
  217. package/utils/nodes/formatToQuote.js.map +1 -0
  218. package/utils/nodes/insertImage.d.ts +2 -0
  219. package/utils/nodes/insertImage.js +22 -0
  220. package/utils/nodes/insertImage.js.map +1 -0
  221. package/utils/nodes/listNode.d.ts +11 -0
  222. package/utils/nodes/listNode.js +107 -0
  223. package/utils/nodes/listNode.js.map +1 -0
  224. package/utils/styleObjectToString.d.ts +2 -0
  225. package/utils/styleObjectToString.js +22 -0
  226. package/utils/styleObjectToString.js.map +1 -0
  227. package/utils/toTypographyEmotionMap.d.ts +3 -0
  228. package/utils/toTypographyEmotionMap.js +36 -0
  229. package/utils/toTypographyEmotionMap.js.map +1 -0
  230. package/components/AddRichTextEditorNodeType.d.ts +0 -6
  231. package/components/AddRichTextEditorNodeType.js +0 -28
  232. package/components/AddRichTextEditorNodeType.js.map +0 -1
  233. package/components/AddRichTextEditorPlugin.d.ts +0 -12
  234. package/components/AddRichTextEditorPlugin.js +0 -33
  235. package/components/AddRichTextEditorPlugin.js.map +0 -1
  236. package/components/AddToolbarAction.d.ts +0 -7
  237. package/components/AddToolbarAction.js +0 -33
  238. package/components/AddToolbarAction.js.map +0 -1
  239. package/components/Toolbar/HeadingToolbar.d.ts +0 -12
  240. package/components/Toolbar/HeadingToolbar.js +0 -23
  241. package/components/Toolbar/HeadingToolbar.js.map +0 -1
  242. package/components/Toolbar/ParagraphToolbar.d.ts +0 -12
  243. package/components/Toolbar/ParagraphToolbar.js +0 -23
  244. package/components/Toolbar/ParagraphToolbar.js.map +0 -1
  245. package/components/ToolbarPresets/HeadingToolbarPreset.d.ts +0 -2
  246. package/components/ToolbarPresets/HeadingToolbarPreset.js +0 -48
  247. package/components/ToolbarPresets/HeadingToolbarPreset.js.map +0 -1
  248. package/components/ToolbarPresets/ParagraphToolbarPreset.d.ts +0 -2
  249. package/components/ToolbarPresets/ParagraphToolbarPreset.js +0 -63
  250. package/components/ToolbarPresets/ParagraphToolbarPreset.js.map +0 -1
  251. package/plugins/AutoLinkPlugin/AutoLinkPlugin.js +0 -46
  252. package/plugins/AutoLinkPlugin/AutoLinkPlugin.js.map +0 -1
  253. package/plugins/AutoLinkPlugin/index.d.ts +0 -1
  254. package/plugins/AutoLinkPlugin/index.js +0 -16
  255. package/plugins/AutoLinkPlugin/index.js.map +0 -1
  256. package/plugins/ClickableLinkPlugin/ClickableLinkPlugin.d.ts +0 -17
  257. package/plugins/ClickableLinkPlugin/ClickableLinkPlugin.js +0 -88
  258. package/plugins/ClickableLinkPlugin/ClickableLinkPlugin.js.map +0 -1
  259. package/plugins/ClickableLinkPlugin/index.d.ts +0 -1
  260. package/plugins/ClickableLinkPlugin/index.js +0 -16
  261. package/plugins/ClickableLinkPlugin/index.js.map +0 -1
@@ -0,0 +1,14 @@
1
+ import { LexicalCommand, LexicalEditor, NodeKey } from "lexical";
2
+ export interface ImagePayload {
3
+ id: string;
4
+ altText: string;
5
+ caption?: LexicalEditor;
6
+ height?: number;
7
+ key?: NodeKey;
8
+ maxWidth?: number;
9
+ showCaption?: boolean;
10
+ src: string;
11
+ width?: number;
12
+ captionsEnabled?: boolean;
13
+ }
14
+ export declare const INSERT_IMAGE_COMMAND: LexicalCommand<ImagePayload>;
@@ -0,0 +1,9 @@
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;
@@ -0,0 +1 @@
1
+ {"version":3,"names":["INSERT_IMAGE_COMMAND","createCommand"],"sources":["insertFiles.ts"],"sourcesContent":["import { createCommand, LexicalCommand, LexicalEditor, NodeKey } from \"lexical\";\n\nexport interface ImagePayload {\n id: string;\n altText: string;\n caption?: LexicalEditor;\n height?: number;\n key?: NodeKey;\n maxWidth?: number;\n showCaption?: boolean;\n src: string;\n width?: number;\n captionsEnabled?: boolean;\n}\n\nexport const INSERT_IMAGE_COMMAND: LexicalCommand<ImagePayload> =\n createCommand(\"INSERT_IMAGE_COMMAND\");\n"],"mappings":";;;;;;AAAA;AAeO,IAAMA,oBAAkD,GAC3D,IAAAC,sBAAa,EAAC,sBAAsB,CAAC;AAAC"}
@@ -0,0 +1,7 @@
1
+ import { LexicalCommand } from "lexical";
2
+ export declare type WebinyListCommandPayload = {
3
+ themeStyleId?: string;
4
+ };
5
+ export declare const INSERT_UNORDERED_WEBINY_LIST_COMMAND: LexicalCommand<WebinyListCommandPayload>;
6
+ export declare const INSERT_ORDERED_WEBINY_LIST_COMMAND: LexicalCommand<WebinyListCommandPayload>;
7
+ export declare const REMOVE_WEBINY_LIST_COMMAND: LexicalCommand<void>;
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.REMOVE_WEBINY_LIST_COMMAND = exports.INSERT_UNORDERED_WEBINY_LIST_COMMAND = exports.INSERT_ORDERED_WEBINY_LIST_COMMAND = void 0;
7
+ var _lexical = require("lexical");
8
+ var INSERT_UNORDERED_WEBINY_LIST_COMMAND = (0, _lexical.createCommand)("INSERT_UNORDERED_WEBINY_LIST_COMMAND");
9
+ exports.INSERT_UNORDERED_WEBINY_LIST_COMMAND = INSERT_UNORDERED_WEBINY_LIST_COMMAND;
10
+ var INSERT_ORDERED_WEBINY_LIST_COMMAND = (0, _lexical.createCommand)("INSERT_ORDERED_WEBINY_LIST_COMMAND");
11
+ exports.INSERT_ORDERED_WEBINY_LIST_COMMAND = INSERT_ORDERED_WEBINY_LIST_COMMAND;
12
+ var REMOVE_WEBINY_LIST_COMMAND = (0, _lexical.createCommand)("REMOVE_WEBINY_LIST_COMMAND");
13
+ exports.REMOVE_WEBINY_LIST_COMMAND = REMOVE_WEBINY_LIST_COMMAND;
@@ -0,0 +1 @@
1
+ {"version":3,"names":["INSERT_UNORDERED_WEBINY_LIST_COMMAND","createCommand","INSERT_ORDERED_WEBINY_LIST_COMMAND","REMOVE_WEBINY_LIST_COMMAND"],"sources":["webiny-list.ts"],"sourcesContent":["import { createCommand, LexicalCommand } from \"lexical\";\n\nexport type WebinyListCommandPayload = {\n themeStyleId?: string;\n};\n\nexport const INSERT_UNORDERED_WEBINY_LIST_COMMAND: LexicalCommand<WebinyListCommandPayload> =\n createCommand(\"INSERT_UNORDERED_WEBINY_LIST_COMMAND\");\nexport const INSERT_ORDERED_WEBINY_LIST_COMMAND: LexicalCommand<WebinyListCommandPayload> =\n createCommand(\"INSERT_ORDERED_WEBINY_LIST_COMMAND\");\n\nexport const REMOVE_WEBINY_LIST_COMMAND: LexicalCommand<void> = createCommand(\n \"REMOVE_WEBINY_LIST_COMMAND\"\n);\n"],"mappings":";;;;;;AAAA;AAMO,IAAMA,oCAA8E,GACvF,IAAAC,sBAAa,EAAC,sCAAsC,CAAC;AAAC;AACnD,IAAMC,kCAA4E,GACrF,IAAAD,sBAAa,EAAC,oCAAoC,CAAC;AAAC;AAEjD,IAAME,0BAAgD,GAAG,IAAAF,sBAAa,EACzE,4BAA4B,CAC/B;AAAC"}
@@ -0,0 +1,5 @@
1
+ import { LexicalCommand } from "lexical";
2
+ export declare type WebinyQuoteCommandPayload = {
3
+ themeStyleId: string;
4
+ };
5
+ export declare const INSERT_WEBINY_QUOTE_COMMAND: LexicalCommand<WebinyQuoteCommandPayload>;
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.INSERT_WEBINY_QUOTE_COMMAND = void 0;
7
+ var _lexical = require("lexical");
8
+ var INSERT_WEBINY_QUOTE_COMMAND = (0, _lexical.createCommand)("INSERT_WEBINY_QUOTE_COMMAND");
9
+ exports.INSERT_WEBINY_QUOTE_COMMAND = INSERT_WEBINY_QUOTE_COMMAND;
@@ -0,0 +1 @@
1
+ {"version":3,"names":["INSERT_WEBINY_QUOTE_COMMAND","createCommand"],"sources":["webiny-quote.ts"],"sourcesContent":["import { createCommand, LexicalCommand } from \"lexical\";\n\nexport type WebinyQuoteCommandPayload = {\n themeStyleId: string;\n};\n\nexport const INSERT_WEBINY_QUOTE_COMMAND: LexicalCommand<WebinyQuoteCommandPayload> = createCommand(\n \"INSERT_WEBINY_QUOTE_COMMAND\"\n);\n"],"mappings":";;;;;;AAAA;AAMO,IAAMA,2BAAsE,GAAG,IAAAC,sBAAa,EAC/F,6BAA6B,CAChC;AAAC"}
@@ -7,22 +7,21 @@ 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"];
16
13
  var HeadingEditor = function HeadingEditor(_ref) {
17
14
  var tag = _ref.tag,
18
15
  placeholder = _ref.placeholder,
19
16
  rest = (0, _objectWithoutProperties2.default)(_ref, _excluded);
20
17
  return /*#__PURE__*/_react.default.createElement(_RichTextEditor.RichTextEditor, Object.assign({
21
- toolbar: /*#__PURE__*/_react.default.createElement(_HeadingToolbar.HeadingToolbar, null),
18
+ toolbar: /*#__PURE__*/_react.default.createElement(_Toolbar.Toolbar, null),
22
19
  tag: tag !== null && tag !== void 0 ? tag : "h1",
23
20
  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
+ }, rest, {
22
+ styles: {
23
+ padding: 5
24
+ }
25
+ }), rest === null || rest === void 0 ? void 0 : rest.children);
27
26
  };
28
27
  exports.HeadingEditor = HeadingEditor;
@@ -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":["HeadingEditor","tag","placeholder","rest","padding","children"],"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\nexport const HeadingEditor: React.FC<HeadingEditorProps> = ({ tag, placeholder, ...rest }) => {\n return (\n <RichTextEditor\n toolbar={<Toolbar />}\n tag={tag ?? \"h1\"}\n placeholder={placeholder ?? \"Enter your heading text here...\"}\n {...rest}\n styles={{ padding: 5 }}\n >\n {rest?.children}\n </RichTextEditor>\n );\n};\n"],"mappings":";;;;;;;;AAAA;AACA;AACA;AAAuD;AAMhD,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,gBAAO,OAAI;IACrB,GAAG,EAAEF,GAAG,aAAHA,GAAG,cAAHA,GAAG,GAAI,IAAK;IACjB,WAAW,EAAEC,WAAW,aAAXA,WAAW,cAAXA,WAAW,GAAI;EAAkC,GAC1DC,IAAI;IACR,MAAM,EAAE;MAAEC,OAAO,EAAE;IAAE;EAAE,IAEtBD,IAAI,aAAJA,IAAI,uBAAJA,IAAI,CAAEE,QAAQ,CACF;AAEzB,CAAC;AAAC"}
@@ -7,24 +7,21 @@ 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"];
18
13
  var ParagraphEditor = function ParagraphEditor(_ref) {
19
14
  var placeholder = _ref.placeholder,
20
15
  tag = _ref.tag,
21
16
  rest = (0, _objectWithoutProperties2.default)(_ref, _excluded);
22
17
  return /*#__PURE__*/_react.default.createElement(_RichTextEditor.RichTextEditor, Object.assign({
23
- toolbar: /*#__PURE__*/_react.default.createElement(_ParagraphToolbar.ParagraphToolbar, null),
18
+ toolbar: /*#__PURE__*/_react.default.createElement(_Toolbar.Toolbar, null),
24
19
  tag: tag !== null && tag !== void 0 ? tag : "p",
25
20
  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
+ }, rest, {
22
+ styles: {
23
+ padding: 5
24
+ }
25
+ }), rest === null || rest === void 0 ? void 0 : rest.children);
29
26
  };
30
27
  exports.ParagraphEditor = ParagraphEditor;
@@ -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":["ParagraphEditor","placeholder","tag","rest","padding","children"],"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 ParagraphEditor: React.FC<ParagraphLexicalEditorProps> = ({ placeholder, tag, ...rest }) => {\n return (\n <RichTextEditor\n toolbar={<Toolbar />}\n tag={tag ?? \"p\"}\n placeholder={placeholder ?? \"Enter your text here...\"}\n {...rest}\n styles={{ padding: 5 }}\n >\n {rest?.children}\n </RichTextEditor>\n );\n};\n\nexport { ParagraphEditor };\n"],"mappings":";;;;;;;;AAAA;AACA;AACA;AAAuD;AAMvD,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,gBAAO,OAAI;IACrB,GAAG,EAAED,GAAG,aAAHA,GAAG,cAAHA,GAAG,GAAI,GAAI;IAChB,WAAW,EAAED,WAAW,aAAXA,WAAW,cAAXA,WAAW,GAAI;EAA0B,GAClDE,IAAI;IACR,MAAM,EAAE;MAAEC,OAAO,EAAE;IAAE;EAAE,IAEtBD,IAAI,aAAJA,IAAI,uBAAJA,IAAI,CAAEE,QAAQ,CACF;AAEzB,CAAC;AAAC"}
@@ -1,9 +1,11 @@
1
1
  import React from "react";
2
- import { LexicalValue } from "../../types";
2
+ import { LexicalValue, ThemeEmotionMap, ToolbarActionPlugin } from "../../types";
3
3
  import { Klass, LexicalNode } from "lexical";
4
4
  import { WebinyTheme } from "../../themes/webinyLexicalTheme";
5
5
  export interface RichTextEditorProps {
6
6
  toolbar?: React.ReactNode;
7
+ staticToolbar?: React.ReactNode;
8
+ toolbarActionPlugins?: ToolbarActionPlugin[];
7
9
  tag?: string;
8
10
  onChange?: (json: LexicalValue) => void;
9
11
  value: LexicalValue | null;
@@ -18,6 +20,11 @@ export interface RichTextEditorProps {
18
20
  height?: number | string;
19
21
  width?: number | string;
20
22
  theme: WebinyTheme;
23
+ themeEmotionMap?: ThemeEmotionMap;
24
+ placeholderStyles?: React.CSSProperties;
25
+ styles?: React.CSSProperties;
26
+ contentEditableStyles?: React.CSSProperties;
27
+ classes?: string;
21
28
  }
22
29
  /**
23
30
  * @description Main editor container
@@ -24,11 +24,17 @@ 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
27
  var _webinyLexicalTheme = require("../../themes/webinyLexicalTheme");
29
28
  var _webinyNodes = require("../../nodes/webinyNodes");
29
+ var _LexicalHistoryPlugin = require("@lexical/react/LexicalHistoryPlugin");
30
+ var _SharedHistoryContext = require("../../context/SharedHistoryContext");
31
+ var _useRichTextEditor2 = require("../../hooks/useRichTextEditor");
32
+ var _react2 = require("@emotion/react");
33
+ var _toTypographyEmotionMap = require("../../utils/toTypographyEmotionMap");
34
+ var _LexicalEditorConfig = require("../LexicalEditorConfig/LexicalEditorConfig");
30
35
  var BaseRichTextEditor = function BaseRichTextEditor(_ref) {
31
36
  var toolbar = _ref.toolbar,
37
+ staticToolbar = _ref.staticToolbar,
32
38
  onChange = _ref.onChange,
33
39
  value = _ref.value,
34
40
  nodes = _ref.nodes,
@@ -36,15 +42,38 @@ var BaseRichTextEditor = function BaseRichTextEditor(_ref) {
36
42
  children = _ref.children,
37
43
  onBlur = _ref.onBlur,
38
44
  focus = _ref.focus,
45
+ styles = _ref.styles,
39
46
  width = _ref.width,
40
47
  height = _ref.height,
41
- theme = _ref.theme;
42
- var placeholderElem = /*#__PURE__*/_react.default.createElement(_Placeholder.Placeholder, null, placeholder || "Enter text...");
48
+ theme = _ref.theme,
49
+ themeEmotionMap = _ref.themeEmotionMap,
50
+ toolbarActionPlugins = _ref.toolbarActionPlugins,
51
+ contentEditableStyles = _ref.contentEditableStyles,
52
+ placeholderStyles = _ref.placeholderStyles;
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,77 @@ 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
+ });
57
94
  var initialConfig = {
58
95
  editorState: (0, _isValidLexicalData.isValidLexicalData)(value) ? value : (0, _generateInitialLexicalValue.generateInitialLexicalValue)(),
59
96
  namespace: "webiny",
60
97
  onError: function onError(error) {
61
98
  throw error;
62
99
  },
63
- nodes: [].concat((0, _toConsumableArray2.default)(_webinyNodes.WebinyNodes), (0, _toConsumableArray2.default)(nodes || [])),
100
+ nodes: [].concat((0, _toConsumableArray2.default)(_webinyNodes.WebinyNodes), (0, _toConsumableArray2.default)(configNodes), (0, _toConsumableArray2.default)(nodes || [])),
64
101
  theme: (0, _objectSpread2.default)((0, _objectSpread2.default)({}, _webinyLexicalTheme.webinyEditorTheme), {}, {
65
- styles: theme === null || theme === void 0 ? void 0 : theme.styles
102
+ emotionMap: themeEmotionMap
66
103
  })
67
104
  };
68
105
  function handleOnChange(editorState, editor) {
69
106
  editorState.read(function () {
70
107
  if (typeof onChange === "function") {
71
108
  var _editorState = editor.getEditorState();
72
- //TODO: send plain JSON object
73
109
  onChange(JSON.stringify(_editorState.toJSON()));
74
110
  }
75
111
  });
76
112
  }
77
113
  return /*#__PURE__*/_react.default.createElement(_LexicalComposer.LexicalComposer, {
78
114
  initialConfig: initialConfig
79
- }, /*#__PURE__*/_react.default.createElement("div", {
115
+ }, /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, staticToolbar && staticToolbar, /*#__PURE__*/_react.default.createElement("div", {
116
+ className: "editor-shell",
80
117
  ref: scrollRef,
81
- style: (0, _objectSpread2.default)({}, sizeStyle)
118
+ style: (0, _objectSpread2.default)((0, _objectSpread2.default)((0, _objectSpread2.default)({}, styles), sizeStyle), {}, {
119
+ overflow: "auto"
120
+ })
82
121
  }, /*#__PURE__*/_react.default.createElement(_LexicalOnChangePlugin.OnChangePlugin, {
83
122
  onChange: handleOnChange
84
123
  }), value && /*#__PURE__*/_react.default.createElement(_LexicalUpdateStatePlugin.LexicalUpdateStatePlugin, {
85
124
  value: value
86
- }), /*#__PURE__*/_react.default.createElement(_LexicalClearEditorPlugin.ClearEditorPlugin, null), /*#__PURE__*/_react.default.createElement(_FontColorPlugin.FontColorPlugin, null), onBlur && /*#__PURE__*/_react.default.createElement(_BlurEventPlugin.BlurEventPlugin, {
125
+ }), /*#__PURE__*/_react.default.createElement(_LexicalClearEditorPlugin.ClearEditorPlugin, null), /*#__PURE__*/_react.default.createElement(_LexicalHistoryPlugin.HistoryPlugin, {
126
+ externalHistoryState: historyState
127
+ }), onBlur && /*#__PURE__*/_react.default.createElement(_BlurEventPlugin.BlurEventPlugin, {
87
128
  onBlur: onBlur
88
- }), focus && /*#__PURE__*/_react.default.createElement(_LexicalAutoFocusPlugin.AutoFocusPlugin, null), children, /*#__PURE__*/_react.default.createElement(_LexicalRichTextPlugin.RichTextPlugin, {
129
+ }), focus && /*#__PURE__*/_react.default.createElement(_LexicalAutoFocusPlugin.AutoFocusPlugin, null), configPlugins, children, /*#__PURE__*/_react.default.createElement(_LexicalRichTextPlugin.RichTextPlugin, {
89
130
  contentEditable: /*#__PURE__*/_react.default.createElement("div", {
90
131
  className: "editor-scroller",
91
132
  style: (0, _objectSpread2.default)({}, sizeStyle)
92
133
  }, /*#__PURE__*/_react.default.createElement("div", {
93
134
  className: "editor",
94
- ref: onRef,
95
- style: (0, _objectSpread2.default)({}, sizeStyle)
135
+ ref: onRef
96
136
  }, /*#__PURE__*/_react.default.createElement(_LexicalContentEditable.ContentEditable, {
97
137
  style: (0, _objectSpread2.default)({
98
138
  outline: 0
99
- }, sizeStyle)
139
+ }, contentEditableStyles)
100
140
  }))),
101
141
  placeholder: placeholderElem,
102
142
  ErrorBoundary: _LexicalErrorBoundary.default
103
- }), floatingAnchorElem && toolbar));
143
+ }), floatingAnchorElem && toolbar)));
104
144
  };
105
145
 
106
146
  /**
107
147
  * @description Main editor container
108
148
  */
109
149
  var RichTextEditor = (0, _reactComposition.makeComposable)("RichTextEditor", function (props) {
110
- return /*#__PURE__*/_react.default.createElement(_RichTextEditorContext.RichTextEditorProvider, null, /*#__PURE__*/_react.default.createElement(BaseRichTextEditor, props));
150
+ return /*#__PURE__*/_react.default.createElement(_LexicalEditorConfig.LexicalEditorWithConfig, null, /*#__PURE__*/_react.default.createElement(_RichTextEditorContext.RichTextEditorProvider, null, /*#__PURE__*/_react.default.createElement(_react2.ClassNames, null, function (_ref2) {
151
+ var _props$themeEmotionMa;
152
+ var css = _ref2.css;
153
+ var themeEmotionMap = (_props$themeEmotionMa = props === null || props === void 0 ? void 0 : props.themeEmotionMap) !== null && _props$themeEmotionMa !== void 0 ? _props$themeEmotionMa : (0, _toTypographyEmotionMap.toTypographyEmotionMap)(css, props.theme);
154
+ return /*#__PURE__*/_react.default.createElement(_SharedHistoryContext.SharedHistoryContext, null, /*#__PURE__*/_react.default.createElement(BaseRichTextEditor, Object.assign({}, props, {
155
+ themeEmotionMap: themeEmotionMap
156
+ })));
157
+ })));
111
158
  });
112
159
  exports.RichTextEditor = RichTextEditor;
@@ -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;IACNC,KAAK,QAALA,KAAK;EAEL,IAAMC,eAAe,gBAAG,6BAAC,wBAAW,QAAEP,WAAW,IAAI,eAAe,CAAe;EACnF,IAAMQ,SAAS,GAAG,IAAAC,aAAM,EAAC,IAAI,CAAC;EAC9B,gBAAoD,IAAAC,eAAQ,EACxDC,SAAS,CACZ;IAAA;IAFMC,kBAAkB;IAAEC,qBAAqB;EAIhD,IAAMC,KAAK,GAAG,SAARA,KAAK,CAAIC,mBAAmC,EAAK;IACnD,IAAIA,mBAAmB,KAAK,IAAI,EAAE;MAC9BF,qBAAqB,CAACE,mBAAmB,CAAC;IAC9C;EACJ,CAAC;EAED,IAAMC,SAAS,GAAG;IACdX,MAAM,EAAEA,MAAM,IAAI,EAAE;IACpBD,KAAK,EAAEA,KAAK,IAAI;EACpB,CAAC;EAED,IAAMa,aAAa,GAAG;I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AEF,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":["BaseRichTextEditor","toolbar","staticToolbar","onChange","value","nodes","placeholder","children","onBlur","focus","styles","width","height","theme","themeEmotionMap","toolbarActionPlugins","contentEditableStyles","placeholderStyles","config","useLexicalEditorConfig","useSharedHistoryContext","historyState","placeholderElem","scrollRef","useRef","useState","undefined","floatingAnchorElem","setFloatingAnchorElem","useRichTextEditor","setTheme","setThemeEmotionMap","setToolbarActionPlugins","useEffect","onRef","_floatingAnchorElem","sizeStyle","configNodes","map","node","configPlugins","plugins","plugin","name","element","initialConfig","editorState","isValidLexicalData","generateInitialLexicalValue","namespace","onError","error","WebinyNodes","webinyEditorTheme","emotionMap","handleOnChange","editor","read","getEditorState","JSON","stringify","toJSON","overflow","outline","LexicalErrorBoundary","RichTextEditor","makeComposable","props","css","toTypographyEmotionMap"],"sources":["RichTextEditor.tsx"],"sourcesContent":["import React, { Fragment, useEffect, useRef, useState } from \"react\";\nimport { LexicalValue, ThemeEmotionMap, ToolbarActionPlugin } 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 { webinyEditorTheme, WebinyTheme } from \"~/themes/webinyLexicalTheme\";\nimport { WebinyNodes } from \"~/nodes/webinyNodes\";\nimport { HistoryPlugin } from \"@lexical/react/LexicalHistoryPlugin\";\nimport { SharedHistoryContext, useSharedHistoryContext } from \"~/context/SharedHistoryContext\";\nimport { useRichTextEditor } from \"~/hooks/useRichTextEditor\";\nimport { ClassNames } from \"@emotion/react\";\nimport { toTypographyEmotionMap } from \"~/utils/toTypographyEmotionMap\";\nimport {\n LexicalEditorWithConfig,\n useLexicalEditorConfig\n} from \"~/components/LexicalEditorConfig/LexicalEditorConfig\";\n\nexport interface RichTextEditorProps {\n toolbar?: React.ReactNode;\n staticToolbar?: React.ReactNode;\n toolbarActionPlugins?: ToolbarActionPlugin[];\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 themeEmotionMap?: ThemeEmotionMap;\n\n placeholderStyles?: React.CSSProperties;\n /*\n * Set inline styles to lexical editor container\n * */\n styles?: React.CSSProperties;\n\n /*\n * Set inline styles to lexical editor editable content\n * */\n contentEditableStyles?: React.CSSProperties;\n\n /*\n * Set classes to lexical input container\n * */\n classes?: string;\n}\n\nconst BaseRichTextEditor: React.FC<RichTextEditorProps> = ({\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 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 initialConfig = {\n editorState: isValidLexicalData(value) ? value : generateInitialLexicalValue(),\n namespace: \"webiny\",\n onError: (error: Error) => {\n throw error;\n },\n nodes: [...WebinyNodes, ...configNodes, ...(nodes || [])],\n theme: { ...webinyEditorTheme, 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 <LexicalComposer initialConfig={initialConfig}>\n <>\n {staticToolbar && staticToolbar}\n <div\n className={\"editor-shell\"}\n ref={scrollRef}\n style={{ ...styles, ...sizeStyle, overflow: \"auto\" }}\n >\n {/* data */}\n <OnChangePlugin onChange={handleOnChange} />\n {value && <LexicalUpdateStatePlugin value={value} />}\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 ?? toTypographyEmotionMap(css, props.theme);\n return (\n <SharedHistoryContext>\n <BaseRichTextEditor {...props} themeEmotionMap={themeEmotionMap} />\n </SharedHistoryContext>\n );\n }}\n </ClassNames>\n </RichTextEditorProvider>\n </LexicalEditorWithConfig>\n );\n});\n"],"mappings":";;;;;;;;;;;AAAA;AAEA;AACA;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AA6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AAVC,GAAG,SAAHA,GAAG;IACH,IAAMtD,eAAe,4BACjBqD,KAAK,aAALA,KAAK,uBAALA,KAAK,CAAErD,eAAe,yEAAI,IAAAuD,8CAAsB,EAACD,GAAG,EAAED,KAAK,CAACtD,KAAK,CAAC;IACtE,oBACI,6BAAC,0CAAoB,qBACjB,6BAAC,kBAAkB,oBAAKsD,KAAK;MAAE,eAAe,EAAErD;IAAgB,GAAG,CAChD;EAE/B,CAAC,CACQ,CACQ,CACH;AAElC,CAAC,CAAC;AAAC"}
@@ -0,0 +1,23 @@
1
+ /**
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ *
7
+ */
8
+ /// <reference types="react" />
9
+ import type { LexicalEditor, NodeKey } from "lexical";
10
+ import "~/nodes/imageNode.css";
11
+ export default function ImageComponent({ id, src, altText, nodeKey, width, height, maxWidth, resizable, showCaption, caption, captionsEnabled }: {
12
+ id: string;
13
+ altText: string;
14
+ caption: LexicalEditor;
15
+ height: "inherit" | number;
16
+ maxWidth: number;
17
+ nodeKey: NodeKey;
18
+ resizable: boolean;
19
+ showCaption: boolean;
20
+ src: string;
21
+ width: "inherit" | number;
22
+ captionsEnabled: boolean;
23
+ }): JSX.Element;