@webiny/lexical-editor 0.0.0-unstable.c59b9cc5b9 → 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 (185) 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 +1 -1
  5. package/commands/webiny-list.js.map +1 -1
  6. package/components/Editor/HeadingEditor.js +7 -9
  7. package/components/Editor/HeadingEditor.js.map +1 -1
  8. package/components/Editor/ParagraphEditor.js +7 -10
  9. package/components/Editor/ParagraphEditor.js.map +1 -1
  10. package/components/Editor/RichTextEditor.d.ts +7 -1
  11. package/components/Editor/RichTextEditor.js +40 -19
  12. package/components/Editor/RichTextEditor.js.map +1 -1
  13. package/components/ImageComponent.d.ts +23 -0
  14. package/components/ImageComponent.js +252 -0
  15. package/components/ImageComponent.js.map +1 -0
  16. package/components/LexicalEditorConfig/LexicalEditorConfig.d.ts +19 -8
  17. package/components/LexicalEditorConfig/LexicalEditorConfig.js +63 -7
  18. package/components/LexicalEditorConfig/LexicalEditorConfig.js.map +1 -1
  19. package/components/LexicalEditorConfig/components/Node.d.ts +14 -0
  20. package/components/LexicalEditorConfig/components/Node.js +38 -0
  21. package/components/LexicalEditorConfig/components/Node.js.map +1 -0
  22. package/components/LexicalEditorConfig/components/Plugin.d.ts +13 -0
  23. package/components/LexicalEditorConfig/components/Plugin.js +38 -0
  24. package/components/LexicalEditorConfig/components/Plugin.js.map +1 -0
  25. package/components/LexicalEditorConfig/components/ToolbarElement.d.ts +13 -0
  26. package/components/LexicalEditorConfig/components/ToolbarElement.js +38 -0
  27. package/components/LexicalEditorConfig/components/ToolbarElement.js.map +1 -0
  28. package/components/Toolbar/StaticToolbar.css +260 -0
  29. package/components/Toolbar/StaticToolbar.d.ts +3 -0
  30. package/components/Toolbar/StaticToolbar.js +101 -0
  31. package/components/Toolbar/StaticToolbar.js.map +1 -0
  32. package/components/Toolbar/Toolbar.css +227 -4
  33. package/components/Toolbar/Toolbar.d.ts +2 -8
  34. package/components/Toolbar/Toolbar.js +96 -74
  35. package/components/Toolbar/Toolbar.js.map +1 -1
  36. package/components/ToolbarActions/BulletListAction.js +9 -4
  37. package/components/ToolbarActions/BulletListAction.js.map +1 -1
  38. package/components/ToolbarActions/FontColorAction.js +1 -1
  39. package/components/ToolbarActions/FontColorAction.js.map +1 -1
  40. package/components/ToolbarActions/FontSizeAction.js +1 -1
  41. package/components/ToolbarActions/FontSizeAction.js.map +1 -1
  42. package/components/ToolbarActions/ImageAction.d.ts +2 -0
  43. package/components/ToolbarActions/ImageAction.js +53 -0
  44. package/components/ToolbarActions/ImageAction.js.map +1 -0
  45. package/components/ToolbarActions/NumberedListAction.js +21 -4
  46. package/components/ToolbarActions/NumberedListAction.js.map +1 -1
  47. package/components/ToolbarActions/QuoteAction.js +3 -2
  48. package/components/ToolbarActions/QuoteAction.js.map +1 -1
  49. package/components/ToolbarActions/TextAlignmentAction.d.ts +11 -0
  50. package/components/ToolbarActions/TextAlignmentAction.js +70 -0
  51. package/components/ToolbarActions/TextAlignmentAction.js.map +1 -0
  52. package/components/ToolbarActions/TypographyAction.js +1 -1
  53. package/components/ToolbarActions/TypographyAction.js.map +1 -1
  54. package/context/RichTextEditorContext.d.ts +8 -1
  55. package/context/RichTextEditorContext.js +23 -5
  56. package/context/RichTextEditorContext.js.map +1 -1
  57. package/context/TextAlignmentActionContextProps.d.ts +9 -0
  58. package/context/TextAlignmentActionContextProps.js +10 -0
  59. package/context/TextAlignmentActionContextProps.js.map +1 -0
  60. package/hooks/useList.d.ts +2 -0
  61. package/hooks/{useWebinyList.js → useList.js} +3 -3
  62. package/hooks/useList.js.map +1 -0
  63. package/hooks/useTextAlignmentAction.d.ts +1 -0
  64. package/hooks/useTextAlignmentAction.js +15 -0
  65. package/hooks/useTextAlignmentAction.js.map +1 -0
  66. package/images/icons/indent.svg +3 -0
  67. package/images/icons/insert-image.svg +4 -0
  68. package/images/icons/justify.svg +3 -0
  69. package/images/icons/outdent.svg +3 -0
  70. package/index.d.ts +11 -9
  71. package/index.js +64 -44
  72. package/index.js.map +1 -1
  73. package/nodes/ImageNode.d.ts +50 -0
  74. package/nodes/ImageNode.js +217 -0
  75. package/nodes/ImageNode.js.map +1 -0
  76. package/nodes/{list-node/WebinyListItemNode.d.ts → ListItemNode.d.ts} +7 -7
  77. package/nodes/{list-node/WebinyListItemNode.js → ListItemNode.js} +49 -50
  78. package/nodes/ListItemNode.js.map +1 -0
  79. package/nodes/{list-node → ListNode}/formatList.d.ts +6 -6
  80. package/nodes/{list-node → ListNode}/formatList.js +38 -38
  81. package/nodes/ListNode/formatList.js.map +1 -0
  82. package/nodes/{list-node/WebinyListNode.d.ts → ListNode.d.ts} +11 -7
  83. package/nodes/{list-node/WebinyListNode.js → ListNode.js} +70 -29
  84. package/nodes/ListNode.js.map +1 -0
  85. package/nodes/imageNode.css +43 -0
  86. package/nodes/webinyNodes.js +4 -3
  87. package/nodes/webinyNodes.js.map +1 -1
  88. package/package.json +6 -5
  89. package/plugins/FloatingLinkEditorPlugin/FloatingLinkEditorPlugin.css +5 -1
  90. package/plugins/FloatingLinkEditorPlugin/FloatingLinkEditorPlugin.js +52 -14
  91. package/plugins/FloatingLinkEditorPlugin/FloatingLinkEditorPlugin.js.map +1 -1
  92. package/plugins/ImagesPlugin/ImagesPlugin.d.ts +13 -0
  93. package/plugins/ImagesPlugin/ImagesPlugin.js +152 -0
  94. package/plugins/ImagesPlugin/ImagesPlugin.js.map +1 -0
  95. package/plugins/ListPLugin/ListPlugin.d.ts +1 -0
  96. package/plugins/{WebinyListPLugin/WebinyListPlugin.js → ListPLugin/ListPlugin.js} +8 -8
  97. package/plugins/ListPLugin/ListPlugin.js.map +1 -0
  98. package/themes/webinyLexicalTheme.css +0 -6
  99. package/themes/webinyLexicalTheme.js +4 -1
  100. package/themes/webinyLexicalTheme.js.map +1 -1
  101. package/types.d.ts +11 -0
  102. package/types.js +28 -1
  103. package/types.js.map +1 -1
  104. package/ui/ContentEditable.css +22 -0
  105. package/ui/ContentEditable.d.ts +12 -0
  106. package/ui/ContentEditable.js +24 -0
  107. package/ui/ContentEditable.js.map +1 -0
  108. package/ui/ImageResizer.d.ts +26 -0
  109. package/ui/ImageResizer.js +213 -0
  110. package/ui/ImageResizer.js.map +1 -0
  111. package/ui/LinkPreview.js +7 -7
  112. package/ui/LinkPreview.js.map +1 -1
  113. package/ui/Placeholder.css +2 -5
  114. package/ui/Placeholder.d.ts +3 -1
  115. package/ui/Placeholder.js +5 -1
  116. package/ui/Placeholder.js.map +1 -1
  117. package/utils/canUseDOM.d.ts +1 -0
  118. package/utils/canUseDOM.js +8 -0
  119. package/utils/canUseDOM.js.map +1 -0
  120. package/utils/files.d.ts +12 -0
  121. package/utils/files.js +62 -0
  122. package/utils/files.js.map +1 -0
  123. package/utils/generateInitialLexicalValue.js +1 -1
  124. package/utils/generateInitialLexicalValue.js.map +1 -1
  125. package/utils/getLexicalTextSelectionState.js +9 -3
  126. package/utils/getLexicalTextSelectionState.js.map +1 -1
  127. package/utils/getTransparentImage.d.ts +1 -0
  128. package/utils/getTransparentImage.js +10 -0
  129. package/utils/getTransparentImage.js.map +1 -0
  130. package/{plugins/AutoLinkPlugin/AutoLinkPlugin.d.ts → utils/isHTMLElement.d.ts} +3 -4
  131. package/utils/isHTMLElement.js +16 -0
  132. package/utils/isHTMLElement.js.map +1 -0
  133. package/utils/nodes/insertImage.d.ts +2 -0
  134. package/utils/nodes/insertImage.js +22 -0
  135. package/utils/nodes/insertImage.js.map +1 -0
  136. package/utils/nodes/listNode.d.ts +11 -0
  137. package/utils/nodes/{list-node.js → listNode.js} +13 -13
  138. package/utils/nodes/listNode.js.map +1 -0
  139. package/components/AddRichTextEditorNodeType.d.ts +0 -6
  140. package/components/AddRichTextEditorNodeType.js +0 -28
  141. package/components/AddRichTextEditorNodeType.js.map +0 -1
  142. package/components/AddRichTextEditorPlugin.d.ts +0 -12
  143. package/components/AddRichTextEditorPlugin.js +0 -33
  144. package/components/AddRichTextEditorPlugin.js.map +0 -1
  145. package/components/AddToolbarAction.d.ts +0 -7
  146. package/components/AddToolbarAction.js +0 -33
  147. package/components/AddToolbarAction.js.map +0 -1
  148. package/components/Toolbar/HeadingToolbar.d.ts +0 -12
  149. package/components/Toolbar/HeadingToolbar.js +0 -23
  150. package/components/Toolbar/HeadingToolbar.js.map +0 -1
  151. package/components/Toolbar/ParagraphToolbar.d.ts +0 -12
  152. package/components/Toolbar/ParagraphToolbar.js +0 -23
  153. package/components/Toolbar/ParagraphToolbar.js.map +0 -1
  154. package/components/ToolbarPresets/HeadingToolbarPreset.d.ts +0 -2
  155. package/components/ToolbarPresets/HeadingToolbarPreset.js +0 -52
  156. package/components/ToolbarPresets/HeadingToolbarPreset.js.map +0 -1
  157. package/components/ToolbarPresets/ParagraphToolbarPreset.d.ts +0 -2
  158. package/components/ToolbarPresets/ParagraphToolbarPreset.js +0 -67
  159. package/components/ToolbarPresets/ParagraphToolbarPreset.js.map +0 -1
  160. package/hooks/useWebinyList.d.ts +0 -2
  161. package/hooks/useWebinyList.js.map +0 -1
  162. package/hooks/useWebinyQuote.d.ts +0 -2
  163. package/hooks/useWebinyQuote.js +0 -20
  164. package/hooks/useWebinyQuote.js.map +0 -1
  165. package/nodes/WebinyQuoteNode.d.ts +0 -29
  166. package/nodes/WebinyQuoteNode.js +0 -149
  167. package/nodes/WebinyQuoteNode.js.map +0 -1
  168. package/nodes/list-node/WebinyListItemNode.js.map +0 -1
  169. package/nodes/list-node/WebinyListNode.js.map +0 -1
  170. package/nodes/list-node/formatList.js.map +0 -1
  171. package/plugins/AutoLinkPlugin/AutoLinkPlugin.js +0 -46
  172. package/plugins/AutoLinkPlugin/AutoLinkPlugin.js.map +0 -1
  173. package/plugins/AutoLinkPlugin/index.d.ts +0 -1
  174. package/plugins/AutoLinkPlugin/index.js +0 -16
  175. package/plugins/AutoLinkPlugin/index.js.map +0 -1
  176. package/plugins/ClickableLinkPlugin/ClickableLinkPlugin.d.ts +0 -17
  177. package/plugins/ClickableLinkPlugin/ClickableLinkPlugin.js +0 -88
  178. package/plugins/ClickableLinkPlugin/ClickableLinkPlugin.js.map +0 -1
  179. package/plugins/ClickableLinkPlugin/index.d.ts +0 -1
  180. package/plugins/ClickableLinkPlugin/index.js +0 -16
  181. package/plugins/ClickableLinkPlugin/index.js.map +0 -1
  182. package/plugins/WebinyListPLugin/WebinyListPlugin.d.ts +0 -1
  183. package/plugins/WebinyListPLugin/WebinyListPlugin.js.map +0 -1
  184. package/utils/nodes/list-node.d.ts +0 -11
  185. package/utils/nodes/list-node.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"}
@@ -1,6 +1,6 @@
1
1
  import { LexicalCommand } from "lexical";
2
2
  export declare type WebinyListCommandPayload = {
3
- themeStyleId: string;
3
+ themeStyleId?: string;
4
4
  };
5
5
  export declare const INSERT_UNORDERED_WEBINY_LIST_COMMAND: LexicalCommand<WebinyListCommandPayload>;
6
6
  export declare const INSERT_ORDERED_WEBINY_LIST_COMMAND: LexicalCommand<WebinyListCommandPayload>;
@@ -1 +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"}
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"}
@@ -7,23 +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");
15
- var _WebinyQuoteNodePlugin = require("../../plugins/WebinyQuoteNodePlugin/WebinyQuoteNodePlugin");
11
+ var _Toolbar = require("../Toolbar/Toolbar");
16
12
  var _excluded = ["tag", "placeholder"];
17
13
  var HeadingEditor = function HeadingEditor(_ref) {
18
14
  var tag = _ref.tag,
19
15
  placeholder = _ref.placeholder,
20
16
  rest = (0, _objectWithoutProperties2.default)(_ref, _excluded);
21
17
  return /*#__PURE__*/_react.default.createElement(_RichTextEditor.RichTextEditor, Object.assign({
22
- toolbar: /*#__PURE__*/_react.default.createElement(_HeadingToolbar.HeadingToolbar, null),
18
+ toolbar: /*#__PURE__*/_react.default.createElement(_Toolbar.Toolbar, null),
23
19
  tag: tag !== null && tag !== void 0 ? tag : "h1",
24
20
  placeholder: placeholder !== null && placeholder !== void 0 ? placeholder : "Enter your heading text here..."
25
- }, rest), /*#__PURE__*/_react.default.createElement(_LexicalLinkPlugin.LinkPlugin, null), /*#__PURE__*/_react.default.createElement(_WebinyQuoteNodePlugin.QuotePlugin, null), /*#__PURE__*/_react.default.createElement(_ClickableLinkPlugin.ClickableLinkPlugin, null), /*#__PURE__*/_react.default.createElement(_FloatingLinkEditorPlugin.FloatingLinkEditorPlugin, {
26
- anchorElem: document.body
27
- }));
21
+ }, rest, {
22
+ styles: {
23
+ padding: 5
24
+ }
25
+ }), rest === null || rest === void 0 ? void 0 : rest.children);
28
26
  };
29
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\";\nimport { QuotePlugin } from \"~/plugins/WebinyQuoteNodePlugin/WebinyQuoteNodePlugin\";\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 <QuotePlugin />\n <ClickableLinkPlugin />\n <FloatingLinkEditorPlugin anchorElem={document.body} />\n </RichTextEditor>\n );\n};\n"],"mappings":";;;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AAAoF;AAM7E,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,kCAAW,OAAG,eACf,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 _CodeHighlightPlugin = require("../../plugins/CodeHighlightPlugin/CodeHighlightPlugin");
11
- var _LexicalLinkPlugin = require("@lexical/react/LexicalLinkPlugin");
12
- var _FloatingLinkEditorPlugin = require("../../plugins/FloatingLinkEditorPlugin/FloatingLinkEditorPlugin");
13
- var _ClickableLinkPlugin = require("../../plugins/ClickableLinkPlugin/ClickableLinkPlugin");
14
- var _ParagraphToolbar = require("../Toolbar/ParagraphToolbar");
15
10
  var _RichTextEditor = require("./RichTextEditor");
16
- var _WebinyListPlugin = require("../../plugins/WebinyListPLugin/WebinyListPlugin");
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(_WebinyListPlugin.WebinyListPlugin, 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
- }));
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 { 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\";\nimport { WebinyListPlugin } from \"~/plugins/WebinyListPLugin/WebinyListPlugin\";\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 <WebinyListPlugin />\n <CodeHighlightPlugin />\n <ClickableLinkPlugin />\n <FloatingLinkEditorPlugin anchorElem={document.body} />\n </RichTextEditor>\n );\n};\n\nexport { ParagraphEditor };\n"],"mappings":";;;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAA+E;AAM/E,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,kCAAgB,OAAG,eACpB,6BAAC,wCAAmB,OAAG,eACvB,6BAAC,wCAAmB,OAAG,eACvB,6BAAC,kDAAwB;IAAC,UAAU,EAAEC,QAAQ,CAACC;EAAK,EAAG,CAC1C;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, ThemeEmotionMap } 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;
@@ -19,6 +21,10 @@ export interface RichTextEditorProps {
19
21
  width?: number | string;
20
22
  theme: WebinyTheme;
21
23
  themeEmotionMap?: ThemeEmotionMap;
24
+ placeholderStyles?: React.CSSProperties;
25
+ styles?: React.CSSProperties;
26
+ contentEditableStyles?: React.CSSProperties;
27
+ classes?: string;
22
28
  }
23
29
  /**
24
30
  * @description Main editor container
@@ -24,18 +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");
30
- var _TypographyPlugin = require("../../plugins/TypographyPlugin/TypographyPlugin");
31
- var _WebinyQuoteNodePlugin = require("../../plugins/WebinyQuoteNodePlugin/WebinyQuoteNodePlugin");
32
29
  var _LexicalHistoryPlugin = require("@lexical/react/LexicalHistoryPlugin");
33
30
  var _SharedHistoryContext = require("../../context/SharedHistoryContext");
34
31
  var _useRichTextEditor2 = require("../../hooks/useRichTextEditor");
35
32
  var _react2 = require("@emotion/react");
36
33
  var _toTypographyEmotionMap = require("../../utils/toTypographyEmotionMap");
34
+ var _LexicalEditorConfig = require("../LexicalEditorConfig/LexicalEditorConfig");
37
35
  var BaseRichTextEditor = function BaseRichTextEditor(_ref) {
38
36
  var toolbar = _ref.toolbar,
37
+ staticToolbar = _ref.staticToolbar,
39
38
  onChange = _ref.onChange,
40
39
  value = _ref.value,
41
40
  nodes = _ref.nodes,
@@ -43,13 +42,20 @@ var BaseRichTextEditor = function BaseRichTextEditor(_ref) {
43
42
  children = _ref.children,
44
43
  onBlur = _ref.onBlur,
45
44
  focus = _ref.focus,
45
+ styles = _ref.styles,
46
46
  width = _ref.width,
47
47
  height = _ref.height,
48
48
  theme = _ref.theme,
49
- themeEmotionMap = _ref.themeEmotionMap;
49
+ themeEmotionMap = _ref.themeEmotionMap,
50
+ toolbarActionPlugins = _ref.toolbarActionPlugins,
51
+ contentEditableStyles = _ref.contentEditableStyles,
52
+ placeholderStyles = _ref.placeholderStyles;
53
+ var config = (0, _LexicalEditorConfig.useLexicalEditorConfig)();
50
54
  var _useSharedHistoryCont = (0, _SharedHistoryContext.useSharedHistoryContext)(),
51
55
  historyState = _useSharedHistoryCont.historyState;
52
- var placeholderElem = /*#__PURE__*/_react.default.createElement(_Placeholder.Placeholder, null, placeholder || "Enter text...");
56
+ var placeholderElem = /*#__PURE__*/_react.default.createElement(_Placeholder.Placeholder, {
57
+ styles: placeholderStyles
58
+ }, placeholder || "Enter text...");
53
59
  var scrollRef = (0, _react.useRef)(null);
54
60
  var _useState = (0, _react.useState)(undefined),
55
61
  _useState2 = (0, _slicedToArray2.default)(_useState, 2),
@@ -57,11 +63,17 @@ var BaseRichTextEditor = function BaseRichTextEditor(_ref) {
57
63
  setFloatingAnchorElem = _useState2[1];
58
64
  var _useRichTextEditor = (0, _useRichTextEditor2.useRichTextEditor)(),
59
65
  setTheme = _useRichTextEditor.setTheme,
60
- setThemeEmotionMap = _useRichTextEditor.setThemeEmotionMap;
66
+ setThemeEmotionMap = _useRichTextEditor.setThemeEmotionMap,
67
+ setToolbarActionPlugins = _useRichTextEditor.setToolbarActionPlugins;
61
68
  (0, _react.useEffect)(function () {
62
69
  setTheme(theme);
63
70
  setThemeEmotionMap(themeEmotionMap);
64
- }, [themeEmotionMap]);
71
+ }, [themeEmotionMap, theme]);
72
+ (0, _react.useEffect)(function () {
73
+ if (toolbarActionPlugins) {
74
+ setToolbarActionPlugins(toolbarActionPlugins || []);
75
+ }
76
+ }, [toolbarActionPlugins]);
65
77
  var onRef = function onRef(_floatingAnchorElem) {
66
78
  if (_floatingAnchorElem !== null) {
67
79
  setFloatingAnchorElem(_floatingAnchorElem);
@@ -71,13 +83,21 @@ var BaseRichTextEditor = function BaseRichTextEditor(_ref) {
71
83
  height: height || "",
72
84
  width: width || ""
73
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
+ });
74
94
  var initialConfig = {
75
95
  editorState: (0, _isValidLexicalData.isValidLexicalData)(value) ? value : (0, _generateInitialLexicalValue.generateInitialLexicalValue)(),
76
96
  namespace: "webiny",
77
97
  onError: function onError(error) {
78
98
  throw error;
79
99
  },
80
- 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 || [])),
81
101
  theme: (0, _objectSpread2.default)((0, _objectSpread2.default)({}, _webinyLexicalTheme.webinyEditorTheme), {}, {
82
102
  emotionMap: themeEmotionMap
83
103
  })
@@ -86,53 +106,54 @@ var BaseRichTextEditor = function BaseRichTextEditor(_ref) {
86
106
  editorState.read(function () {
87
107
  if (typeof onChange === "function") {
88
108
  var _editorState = editor.getEditorState();
89
- //TODO: send plain JSON object
90
109
  onChange(JSON.stringify(_editorState.toJSON()));
91
110
  }
92
111
  });
93
112
  }
94
113
  return /*#__PURE__*/_react.default.createElement(_LexicalComposer.LexicalComposer, {
95
114
  initialConfig: initialConfig
96
- }, /*#__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",
97
117
  ref: scrollRef,
98
- style: (0, _objectSpread2.default)({}, sizeStyle)
118
+ style: (0, _objectSpread2.default)((0, _objectSpread2.default)((0, _objectSpread2.default)({}, styles), sizeStyle), {}, {
119
+ overflow: "auto"
120
+ })
99
121
  }, /*#__PURE__*/_react.default.createElement(_LexicalOnChangePlugin.OnChangePlugin, {
100
122
  onChange: handleOnChange
101
123
  }), value && /*#__PURE__*/_react.default.createElement(_LexicalUpdateStatePlugin.LexicalUpdateStatePlugin, {
102
124
  value: value
103
- }), /*#__PURE__*/_react.default.createElement(_LexicalClearEditorPlugin.ClearEditorPlugin, null), /*#__PURE__*/_react.default.createElement(_FontColorPlugin.FontColorPlugin, null), /*#__PURE__*/_react.default.createElement(_TypographyPlugin.TypographyPlugin, null), /*#__PURE__*/_react.default.createElement(_WebinyQuoteNodePlugin.QuotePlugin, null), /*#__PURE__*/_react.default.createElement(_LexicalHistoryPlugin.HistoryPlugin, {
125
+ }), /*#__PURE__*/_react.default.createElement(_LexicalClearEditorPlugin.ClearEditorPlugin, null), /*#__PURE__*/_react.default.createElement(_LexicalHistoryPlugin.HistoryPlugin, {
104
126
  externalHistoryState: historyState
105
127
  }), onBlur && /*#__PURE__*/_react.default.createElement(_BlurEventPlugin.BlurEventPlugin, {
106
128
  onBlur: onBlur
107
- }), 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, {
108
130
  contentEditable: /*#__PURE__*/_react.default.createElement("div", {
109
131
  className: "editor-scroller",
110
132
  style: (0, _objectSpread2.default)({}, sizeStyle)
111
133
  }, /*#__PURE__*/_react.default.createElement("div", {
112
134
  className: "editor",
113
- ref: onRef,
114
- style: (0, _objectSpread2.default)({}, sizeStyle)
135
+ ref: onRef
115
136
  }, /*#__PURE__*/_react.default.createElement(_LexicalContentEditable.ContentEditable, {
116
137
  style: (0, _objectSpread2.default)({
117
138
  outline: 0
118
- }, sizeStyle)
139
+ }, contentEditableStyles)
119
140
  }))),
120
141
  placeholder: placeholderElem,
121
142
  ErrorBoundary: _LexicalErrorBoundary.default
122
- }), floatingAnchorElem && toolbar));
143
+ }), floatingAnchorElem && toolbar)));
123
144
  };
124
145
 
125
146
  /**
126
147
  * @description Main editor container
127
148
  */
128
149
  var RichTextEditor = (0, _reactComposition.makeComposable)("RichTextEditor", function (props) {
129
- return /*#__PURE__*/_react.default.createElement(_RichTextEditorContext.RichTextEditorProvider, null, /*#__PURE__*/_react.default.createElement(_react2.ClassNames, null, function (_ref2) {
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) {
130
151
  var _props$themeEmotionMa;
131
152
  var css = _ref2.css;
132
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);
133
154
  return /*#__PURE__*/_react.default.createElement(_SharedHistoryContext.SharedHistoryContext, null, /*#__PURE__*/_react.default.createElement(BaseRichTextEditor, Object.assign({}, props, {
134
155
  themeEmotionMap: themeEmotionMap
135
156
  })));
136
- }));
157
+ })));
137
158
  });
138
159
  exports.RichTextEditor = RichTextEditor;
@@ -1 +1 @@
1
- {"version":3,"names":["BaseRichTextEditor","toolbar","onChange","value","nodes","placeholder","children","onBlur","focus","width","height","theme","themeEmotionMap","useSharedHistoryContext","historyState","placeholderElem","scrollRef","useRef","useState","undefined","floatingAnchorElem","setFloatingAnchorElem","useRichTextEditor","setTheme","setThemeEmotionMap","useEffect","onRef","_floatingAnchorElem","sizeStyle","initialConfig","editorState","isValidLexicalData","generateInitialLexicalValue","namespace","onError","error","WebinyNodes","webinyEditorTheme","emotionMap","handleOnChange","editor","read","getEditorState","JSON","stringify","toJSON","outline","LexicalErrorBoundary","RichTextEditor","makeComposable","props","css","toTypographyEmotionMap"],"sources":["RichTextEditor.tsx"],"sourcesContent":["import React, { useEffect, useRef, useState } from \"react\";\nimport { LexicalValue, ThemeEmotionMap } 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\";\nimport { TypographyPlugin } from \"~/plugins/TypographyPlugin/TypographyPlugin\";\nimport { QuotePlugin } from \"~/plugins/WebinyQuoteNodePlugin/WebinyQuoteNodePlugin\";\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\";\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 themeEmotionMap?: ThemeEmotionMap;\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 themeEmotionMap\n}: RichTextEditorProps) => {\n const { historyState } = useSharedHistoryContext();\n const placeholderElem = <Placeholder>{placeholder || \"Enter text...\"}</Placeholder>;\n const scrollRef = useRef(null);\n const [floatingAnchorElem, setFloatingAnchorElem] = useState<HTMLElement | undefined>(\n undefined\n );\n const { setTheme, setThemeEmotionMap } = useRichTextEditor();\n\n useEffect(() => {\n setTheme(theme);\n setThemeEmotionMap(themeEmotionMap);\n }, [themeEmotionMap]);\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, 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 //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 <TypographyPlugin />\n <QuotePlugin />\n <HistoryPlugin externalHistoryState={historyState} />\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 <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 );\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;AACA;AACA;AAwBA,IAAMA,kBAAiD,GAAG,SAApDA,kBAAiD,OAa5B;EAAA,IAZvBC,OAAO,QAAPA,OAAO;IACPC,QAAQ,QAARA,QAAQ;IACRC,K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lB,SAAS;IAAG,EAAG,CACtD,CAEb;IACD,WAAW,EAAEb,eAAgB;IAC7B,aAAa,EAAEgC;EAAqB,EACtC,EAED3B,kBAAkB,IAAInB,OAAO,CAC5B,CACQ;AAE1B,CAAC;;AAED;AACA;AACA;AACO,IAAM+C,cAAc,GAAG,IAAAC,gCAAc,EAAsB,gBAAgB,EAAE,UAAAC,KAAK,EAAI;EACzF,oBACI,6BAAC,6CAAsB,qBACnB,6BAAC,kBAAU,QACN,iBAAa;IAAA;IAAA,IAAVC,GAAG,SAAHA,GAAG;IACH,IAAMvC,eAAe,4BACjBsC,KAAK,aAALA,KAAK,uBAALA,KAAK,CAAEtC,eAAe,yEAAI,IAAAwC,8CAAsB,EAACD,GAAG,EAAED,KAAK,CAACvC,KAAK,CAAC;IACtE,oBACI,6BAAC,0CAAoB,qBACjB,6BAAC,kBAAkB,oBAAKuC,KAAK;MAAE,eAAe,EAAEtC;IAAgB,GAAG,CAChD;EAE/B,CAAC,CACQ,CACQ;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 </ClassN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AACA;AACA;AACO,IAAMgE,cAAc,GAAG,IAAAC,gCAAc,EAAsB,gBAAgB,EAAE,UAAAC,KAAK,EAAI;EACzF,oBACI,6BAAC,4CAAuB,qBACpB,6BAAC,6CAAsB,qBACnB,6BAAC,kBAAU,QACN,iBAAa;IAAA;IAAA,IAAVC,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;