@webiny/lexical-editor 5.43.2 → 6.0.0-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (196) hide show
  1. package/commands/image.js +2 -8
  2. package/commands/image.js.map +1 -1
  3. package/commands/index.js +4 -49
  4. package/commands/index.js.map +1 -1
  5. package/commands/list.js +4 -10
  6. package/commands/list.js.map +1 -1
  7. package/commands/quote.js +2 -8
  8. package/commands/quote.js.map +1 -1
  9. package/commands/toolbar.js +2 -8
  10. package/commands/toolbar.js.map +1 -1
  11. package/components/Editor/EnsureHeadingTagPlugin.js +10 -16
  12. package/components/Editor/EnsureHeadingTagPlugin.js.map +1 -1
  13. package/components/Editor/HeadingEditor.js +13 -21
  14. package/components/Editor/HeadingEditor.js.map +1 -1
  15. package/components/Editor/ParagraphEditor.js +12 -19
  16. package/components/Editor/ParagraphEditor.js.map +1 -1
  17. package/components/Editor/RichTextEditor.js +92 -105
  18. package/components/Editor/RichTextEditor.js.map +1 -1
  19. package/components/Editor/normalizeInputValue.js +2 -8
  20. package/components/Editor/normalizeInputValue.js.map +1 -1
  21. package/components/LexicalEditorConfig/LexicalEditorConfig.js +39 -49
  22. package/components/LexicalEditorConfig/LexicalEditorConfig.js.map +1 -1
  23. package/components/LexicalEditorConfig/components/Node.js +17 -26
  24. package/components/LexicalEditorConfig/components/Node.js.map +1 -1
  25. package/components/LexicalEditorConfig/components/Plugin.js +17 -26
  26. package/components/LexicalEditorConfig/components/Plugin.js.map +1 -1
  27. package/components/LexicalEditorConfig/components/ToolbarElement.js +17 -26
  28. package/components/LexicalEditorConfig/components/ToolbarElement.js.map +1 -1
  29. package/components/LexicalHtmlRenderer.js +37 -46
  30. package/components/LexicalHtmlRenderer.js.map +1 -1
  31. package/components/Toolbar/StaticToolbar.d.ts +3 -1
  32. package/components/Toolbar/StaticToolbar.js +19 -23
  33. package/components/Toolbar/StaticToolbar.js.map +1 -1
  34. package/components/Toolbar/Toolbar.js +66 -75
  35. package/components/Toolbar/Toolbar.js.map +1 -1
  36. package/components/ToolbarActions/BoldAction.js +16 -21
  37. package/components/ToolbarActions/BoldAction.js.map +1 -1
  38. package/components/ToolbarActions/BulletListAction.js +26 -31
  39. package/components/ToolbarActions/BulletListAction.js.map +1 -1
  40. package/components/ToolbarActions/CodeHighlightAction.js +16 -21
  41. package/components/ToolbarActions/CodeHighlightAction.js.map +1 -1
  42. package/components/ToolbarActions/FontColorAction.js +32 -42
  43. package/components/ToolbarActions/FontColorAction.js.map +1 -1
  44. package/components/ToolbarActions/FontSizeAction.js +53 -71
  45. package/components/ToolbarActions/FontSizeAction.js.map +1 -1
  46. package/components/ToolbarActions/ImageAction.js +19 -34
  47. package/components/ToolbarActions/ImageAction.js.map +1 -1
  48. package/components/ToolbarActions/ItalicAction.js +16 -21
  49. package/components/ToolbarActions/ItalicAction.js.map +1 -1
  50. package/components/ToolbarActions/LinkAction.js +19 -24
  51. package/components/ToolbarActions/LinkAction.js.map +1 -1
  52. package/components/ToolbarActions/NumberedListAction.js +26 -33
  53. package/components/ToolbarActions/NumberedListAction.js.map +1 -1
  54. package/components/ToolbarActions/QuoteAction.js +20 -25
  55. package/components/ToolbarActions/QuoteAction.js.map +1 -1
  56. package/components/ToolbarActions/TextAlignmentAction.js +36 -45
  57. package/components/ToolbarActions/TextAlignmentAction.js.map +1 -1
  58. package/components/ToolbarActions/TypographyAction.js +43 -55
  59. package/components/ToolbarActions/TypographyAction.js.map +1 -1
  60. package/components/ToolbarActions/UnderlineAction.js +16 -21
  61. package/components/ToolbarActions/UnderlineAction.js.map +1 -1
  62. package/context/FontColorActionContext.js +2 -9
  63. package/context/FontColorActionContext.js.map +1 -1
  64. package/context/RichTextEditorContext.js +15 -26
  65. package/context/RichTextEditorContext.js.map +1 -1
  66. package/context/SharedHistoryContext.js +12 -20
  67. package/context/SharedHistoryContext.js.map +1 -1
  68. package/context/TextAlignmentActionContextProps.js +2 -9
  69. package/context/TextAlignmentActionContextProps.js.map +1 -1
  70. package/context/TypographyActionContext.js +2 -9
  71. package/context/TypographyActionContext.js.map +1 -1
  72. package/hooks/index.js +8 -93
  73. package/hooks/index.js.map +1 -1
  74. package/hooks/useCurrentElement.d.ts +2 -2
  75. package/hooks/useCurrentElement.js +12 -18
  76. package/hooks/useCurrentElement.js.map +1 -1
  77. package/hooks/useCurrentSelection.js +27 -40
  78. package/hooks/useCurrentSelection.js.map +1 -1
  79. package/hooks/useFontColorPicker.js +5 -11
  80. package/hooks/useFontColorPicker.js.map +1 -1
  81. package/hooks/useIsMounted.js +6 -14
  82. package/hooks/useIsMounted.js.map +1 -1
  83. package/hooks/useList.js +31 -35
  84. package/hooks/useList.js.map +1 -1
  85. package/hooks/useQuote.js +12 -17
  86. package/hooks/useQuote.js.map +1 -1
  87. package/hooks/useRichTextEditor.js +5 -11
  88. package/hooks/useRichTextEditor.js.map +1 -1
  89. package/hooks/useTextAlignmentAction.js +5 -11
  90. package/hooks/useTextAlignmentAction.js.map +1 -1
  91. package/hooks/useTypographyAction.js +5 -11
  92. package/hooks/useTypographyAction.js.map +1 -1
  93. package/index.js +49 -322
  94. package/index.js.map +1 -1
  95. package/package.json +8 -7
  96. package/plugins/BlurEventPlugin/BlurEventPlugin.js +16 -22
  97. package/plugins/BlurEventPlugin/BlurEventPlugin.js.map +1 -1
  98. package/plugins/CodeHighlightPlugin/CodeHighlightPlugin.js +9 -14
  99. package/plugins/CodeHighlightPlugin/CodeHighlightPlugin.js.map +1 -1
  100. package/plugins/CodeHighlightPlugin/index.js +1 -16
  101. package/plugins/CodeHighlightPlugin/index.js.map +1 -1
  102. package/plugins/FloatingLinkEditorPlugin/FloatingLinkEditor.d.ts +16 -0
  103. package/plugins/FloatingLinkEditorPlugin/FloatingLinkEditor.js +158 -0
  104. package/plugins/FloatingLinkEditorPlugin/FloatingLinkEditor.js.map +1 -0
  105. package/plugins/FloatingLinkEditorPlugin/FloatingLinkEditorController.d.ts +8 -0
  106. package/plugins/FloatingLinkEditorPlugin/FloatingLinkEditorController.js +62 -0
  107. package/plugins/FloatingLinkEditorPlugin/FloatingLinkEditorController.js.map +1 -0
  108. package/plugins/FloatingLinkEditorPlugin/FloatingLinkEditorPlugin.css +2 -1
  109. package/plugins/FloatingLinkEditorPlugin/FloatingLinkEditorPlugin.d.ts +5 -16
  110. package/plugins/FloatingLinkEditorPlugin/FloatingLinkEditorPlugin.js +11 -180
  111. package/plugins/FloatingLinkEditorPlugin/FloatingLinkEditorPlugin.js.map +1 -1
  112. package/plugins/FloatingLinkEditorPlugin/LinkEditForm.d.ts +2 -3
  113. package/plugins/FloatingLinkEditorPlugin/LinkEditForm.js +54 -68
  114. package/plugins/FloatingLinkEditorPlugin/LinkEditForm.js.map +1 -1
  115. package/plugins/FloatingLinkEditorPlugin/LinkPreviewForm.d.ts +1 -1
  116. package/plugins/FloatingLinkEditorPlugin/LinkPreviewForm.js +16 -26
  117. package/plugins/FloatingLinkEditorPlugin/LinkPreviewForm.js.map +1 -1
  118. package/plugins/FloatingLinkEditorPlugin/index.js +1 -16
  119. package/plugins/FloatingLinkEditorPlugin/index.js.map +1 -1
  120. package/plugins/FloatingLinkEditorPlugin/isChildOfLinkEditor.js +3 -9
  121. package/plugins/FloatingLinkEditorPlugin/isChildOfLinkEditor.js.map +1 -1
  122. package/plugins/FontColorPlugin/FontColorPlugin.js +19 -22
  123. package/plugins/FontColorPlugin/FontColorPlugin.js.map +1 -1
  124. package/plugins/FontColorPlugin/applyColorToNode.js +4 -10
  125. package/plugins/FontColorPlugin/applyColorToNode.js.map +1 -1
  126. package/plugins/FontColorPlugin/applyColorToSelection.js +28 -44
  127. package/plugins/FontColorPlugin/applyColorToSelection.js.map +1 -1
  128. package/plugins/ImagesPlugin/ImagesPlugin.js +59 -58
  129. package/plugins/ImagesPlugin/ImagesPlugin.js.map +1 -1
  130. package/plugins/LexicalUpdateStatePlugin/UpdateStatePlugin.js +23 -23
  131. package/plugins/LexicalUpdateStatePlugin/UpdateStatePlugin.js.map +1 -1
  132. package/plugins/LexicalUpdateStatePlugin/index.js +1 -16
  133. package/plugins/LexicalUpdateStatePlugin/index.js.map +1 -1
  134. package/plugins/LinkPlugin/LinkPlugin.js +30 -37
  135. package/plugins/LinkPlugin/LinkPlugin.js.map +1 -1
  136. package/plugins/ListPLugin/ListPlugin.js +10 -15
  137. package/plugins/ListPLugin/ListPlugin.js.map +1 -1
  138. package/plugins/QuoteNodePlugin/QuoteNodePlugin.js +11 -16
  139. package/plugins/QuoteNodePlugin/QuoteNodePlugin.js.map +1 -1
  140. package/plugins/TypographyPlugin/TypographyPlugin.js +16 -21
  141. package/plugins/TypographyPlugin/TypographyPlugin.js.map +1 -1
  142. package/types.d.ts +3 -3
  143. package/types.js +6 -38
  144. package/types.js.map +1 -1
  145. package/ui/ContentEditable.js +7 -14
  146. package/ui/ContentEditable.js.map +1 -1
  147. package/ui/Divider.js +3 -10
  148. package/ui/Divider.js.map +1 -1
  149. package/ui/DropDown.js +61 -88
  150. package/ui/DropDown.js.map +1 -1
  151. package/ui/ImageResizer.js +78 -83
  152. package/ui/ImageResizer.js.map +1 -1
  153. package/ui/LinkPreview.js +22 -29
  154. package/ui/LinkPreview.js.map +1 -1
  155. package/ui/Placeholder.js +10 -16
  156. package/ui/Placeholder.js.map +1 -1
  157. package/ui/TextInput.js +11 -18
  158. package/ui/TextInput.js.map +1 -1
  159. package/ui/ToolbarActionDialog.js +30 -42
  160. package/ui/ToolbarActionDialog.js.map +1 -1
  161. package/utils/canUseDOM.js +1 -7
  162. package/utils/canUseDOM.js.map +1 -1
  163. package/utils/files.js +9 -26
  164. package/utils/files.js.map +1 -1
  165. package/utils/generateInitialLexicalValue.js +2 -8
  166. package/utils/generateInitialLexicalValue.js.map +1 -1
  167. package/utils/getDOMRangeRect.js +4 -10
  168. package/utils/getDOMRangeRect.js.map +1 -1
  169. package/utils/getSelectedNode.js +9 -16
  170. package/utils/getSelectedNode.js.map +1 -1
  171. package/utils/getTransparentImage.js +1 -7
  172. package/utils/getTransparentImage.js.map +1 -1
  173. package/utils/insertImage.js +8 -14
  174. package/utils/insertImage.js.map +1 -1
  175. package/utils/isAnchorLink.js +1 -7
  176. package/utils/isAnchorLink.js.map +1 -1
  177. package/utils/isChildOfFloatingToolbar.js +3 -9
  178. package/utils/isChildOfFloatingToolbar.js.map +1 -1
  179. package/utils/isHTMLElement.js +1 -7
  180. package/utils/isHTMLElement.js.map +1 -1
  181. package/utils/isValidJSON.js +3 -9
  182. package/utils/isValidJSON.js.map +1 -1
  183. package/utils/isValidLexicalData.d.ts +1 -1
  184. package/utils/isValidLexicalData.js +6 -12
  185. package/utils/isValidLexicalData.js.map +1 -1
  186. package/utils/point.js +35 -60
  187. package/utils/point.js.map +1 -1
  188. package/utils/rect.js +114 -149
  189. package/utils/rect.js.map +1 -1
  190. package/utils/sanitizeUrl.js +6 -13
  191. package/utils/sanitizeUrl.js.map +1 -1
  192. package/utils/setFloatingElemPosition.js +11 -19
  193. package/utils/setFloatingElemPosition.js.map +1 -1
  194. package/plugins/FloatingLinkEditorPlugin/useFloatingLinkEditor.d.ts +0 -2
  195. package/plugins/FloatingLinkEditorPlugin/useFloatingLinkEditor.js +0 -96
  196. package/plugins/FloatingLinkEditorPlugin/useFloatingLinkEditor.js.map +0 -1
package/commands/image.js CHANGED
@@ -1,10 +1,4 @@
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 = exports.INSERT_IMAGE_COMMAND = (0, _lexical.createCommand)("INSERT_IMAGE_COMMAND");
1
+ import { createCommand } from "lexical";
2
+ export const INSERT_IMAGE_COMMAND = createCommand("INSERT_IMAGE_COMMAND");
9
3
 
10
4
  //# sourceMappingURL=image.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_lexical","require","INSERT_IMAGE_COMMAND","exports","createCommand"],"sources":["image.ts"],"sourcesContent":["import { createCommand, LexicalCommand, NodeKey } from \"lexical\";\nimport { ImageNodeProps } from \"@webiny/lexical-nodes\";\n\nexport interface ImagePayload extends ImageNodeProps {\n key?: NodeKey;\n}\n\nexport const INSERT_IMAGE_COMMAND: LexicalCommand<ImagePayload> =\n createCommand(\"INSERT_IMAGE_COMMAND\");\n"],"mappings":";;;;;;AAAA,IAAAA,QAAA,GAAAC,OAAA;AAOO,IAAMC,oBAAkD,GAAAC,OAAA,CAAAD,oBAAA,GAC3D,IAAAE,sBAAa,EAAC,sBAAsB,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["createCommand","INSERT_IMAGE_COMMAND"],"sources":["image.ts"],"sourcesContent":["import { createCommand, LexicalCommand, NodeKey } from \"lexical\";\nimport { ImageNodeProps } from \"@webiny/lexical-nodes\";\n\nexport interface ImagePayload extends ImageNodeProps {\n key?: NodeKey;\n}\n\nexport const INSERT_IMAGE_COMMAND: LexicalCommand<ImagePayload> =\n createCommand(\"INSERT_IMAGE_COMMAND\");\n"],"mappings":"AAAA,SAASA,aAAa,QAAiC,SAAS;AAOhE,OAAO,MAAMC,oBAAkD,GAC3DD,aAAa,CAAC,sBAAsB,CAAC","ignoreList":[]}
package/commands/index.js CHANGED
@@ -1,51 +1,6 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- var _image = require("./image");
7
- Object.keys(_image).forEach(function (key) {
8
- if (key === "default" || key === "__esModule") return;
9
- if (key in exports && exports[key] === _image[key]) return;
10
- Object.defineProperty(exports, key, {
11
- enumerable: true,
12
- get: function get() {
13
- return _image[key];
14
- }
15
- });
16
- });
17
- var _list = require("./list");
18
- Object.keys(_list).forEach(function (key) {
19
- if (key === "default" || key === "__esModule") return;
20
- if (key in exports && exports[key] === _list[key]) return;
21
- Object.defineProperty(exports, key, {
22
- enumerable: true,
23
- get: function get() {
24
- return _list[key];
25
- }
26
- });
27
- });
28
- var _quote = require("./quote");
29
- Object.keys(_quote).forEach(function (key) {
30
- if (key === "default" || key === "__esModule") return;
31
- if (key in exports && exports[key] === _quote[key]) return;
32
- Object.defineProperty(exports, key, {
33
- enumerable: true,
34
- get: function get() {
35
- return _quote[key];
36
- }
37
- });
38
- });
39
- var _toolbar = require("./toolbar");
40
- Object.keys(_toolbar).forEach(function (key) {
41
- if (key === "default" || key === "__esModule") return;
42
- if (key in exports && exports[key] === _toolbar[key]) return;
43
- Object.defineProperty(exports, key, {
44
- enumerable: true,
45
- get: function get() {
46
- return _toolbar[key];
47
- }
48
- });
49
- });
1
+ export * from "./image";
2
+ export * from "./list";
3
+ export * from "./quote";
4
+ export * from "./toolbar";
50
5
 
51
6
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_image","require","Object","keys","forEach","key","exports","defineProperty","enumerable","get","_list","_quote","_toolbar"],"sources":["index.ts"],"sourcesContent":["export * from \"~/commands/image\";\nexport * from \"~/commands/list\";\nexport * from \"~/commands/quote\";\nexport * from \"~/commands/toolbar\";\n"],"mappings":";;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAH,MAAA,EAAAI,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAL,MAAA,CAAAK,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,IAAA;MAAA,OAAAT,MAAA,CAAAK,GAAA;IAAA;EAAA;AAAA;AACA,IAAAK,KAAA,GAAAT,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAO,KAAA,EAAAN,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAK,KAAA,CAAAL,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,IAAA;MAAA,OAAAC,KAAA,CAAAL,GAAA;IAAA;EAAA;AAAA;AACA,IAAAM,MAAA,GAAAV,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAQ,MAAA,EAAAP,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAM,MAAA,CAAAN,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,IAAA;MAAA,OAAAE,MAAA,CAAAN,GAAA;IAAA;EAAA;AAAA;AACA,IAAAO,QAAA,GAAAX,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAS,QAAA,EAAAR,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAO,QAAA,CAAAP,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,IAAA;MAAA,OAAAG,QAAA,CAAAP,GAAA;IAAA;EAAA;AAAA","ignoreList":[]}
1
+ {"version":3,"names":[],"sources":["index.ts"],"sourcesContent":["export * from \"~/commands/image\";\nexport * from \"~/commands/list\";\nexport * from \"~/commands/quote\";\nexport * from \"~/commands/toolbar\";\n"],"mappings":"AAAA;AACA;AACA;AACA","ignoreList":[]}
package/commands/list.js CHANGED
@@ -1,12 +1,6 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.REMOVE_LIST_COMMAND = exports.INSERT_UNORDERED_LIST_COMMAND = exports.INSERT_ORDERED_LIST_COMMAND = void 0;
7
- var _lexical = require("lexical");
8
- var INSERT_UNORDERED_LIST_COMMAND = exports.INSERT_UNORDERED_LIST_COMMAND = (0, _lexical.createCommand)("INSERT_UNORDERED_LIST_COMMAND");
9
- var INSERT_ORDERED_LIST_COMMAND = exports.INSERT_ORDERED_LIST_COMMAND = (0, _lexical.createCommand)("INSERT_ORDERED_LIST_COMMAND");
10
- var REMOVE_LIST_COMMAND = exports.REMOVE_LIST_COMMAND = (0, _lexical.createCommand)("REMOVE_LIST_COMMAND");
1
+ import { createCommand } from "lexical";
2
+ export const INSERT_UNORDERED_LIST_COMMAND = createCommand("INSERT_UNORDERED_LIST_COMMAND");
3
+ export const INSERT_ORDERED_LIST_COMMAND = createCommand("INSERT_ORDERED_LIST_COMMAND");
4
+ export const REMOVE_LIST_COMMAND = createCommand("REMOVE_LIST_COMMAND");
11
5
 
12
6
  //# sourceMappingURL=list.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_lexical","require","INSERT_UNORDERED_LIST_COMMAND","exports","createCommand","INSERT_ORDERED_LIST_COMMAND","REMOVE_LIST_COMMAND"],"sources":["list.ts"],"sourcesContent":["import { createCommand, LexicalCommand } from \"lexical\";\n\nexport type ListCommandPayload = {\n themeStyleId?: string;\n};\n\nexport const INSERT_UNORDERED_LIST_COMMAND: LexicalCommand<ListCommandPayload> = createCommand(\n \"INSERT_UNORDERED_LIST_COMMAND\"\n);\n\nexport const INSERT_ORDERED_LIST_COMMAND: LexicalCommand<ListCommandPayload> = createCommand(\n \"INSERT_ORDERED_LIST_COMMAND\"\n);\n\nexport const REMOVE_LIST_COMMAND: LexicalCommand<void> = createCommand(\"REMOVE_LIST_COMMAND\");\n"],"mappings":";;;;;;AAAA,IAAAA,QAAA,GAAAC,OAAA;AAMO,IAAMC,6BAAiE,GAAAC,OAAA,CAAAD,6BAAA,GAAG,IAAAE,sBAAa,EAC1F,+BACJ,CAAC;AAEM,IAAMC,2BAA+D,GAAAF,OAAA,CAAAE,2BAAA,GAAG,IAAAD,sBAAa,EACxF,6BACJ,CAAC;AAEM,IAAME,mBAAyC,GAAAH,OAAA,CAAAG,mBAAA,GAAG,IAAAF,sBAAa,EAAC,qBAAqB,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["createCommand","INSERT_UNORDERED_LIST_COMMAND","INSERT_ORDERED_LIST_COMMAND","REMOVE_LIST_COMMAND"],"sources":["list.ts"],"sourcesContent":["import { createCommand, LexicalCommand } from \"lexical\";\n\nexport type ListCommandPayload = {\n themeStyleId?: string;\n};\n\nexport const INSERT_UNORDERED_LIST_COMMAND: LexicalCommand<ListCommandPayload> = createCommand(\n \"INSERT_UNORDERED_LIST_COMMAND\"\n);\n\nexport const INSERT_ORDERED_LIST_COMMAND: LexicalCommand<ListCommandPayload> = createCommand(\n \"INSERT_ORDERED_LIST_COMMAND\"\n);\n\nexport const REMOVE_LIST_COMMAND: LexicalCommand<void> = createCommand(\"REMOVE_LIST_COMMAND\");\n"],"mappings":"AAAA,SAASA,aAAa,QAAwB,SAAS;AAMvD,OAAO,MAAMC,6BAAiE,GAAGD,aAAa,CAC1F,+BACJ,CAAC;AAED,OAAO,MAAME,2BAA+D,GAAGF,aAAa,CACxF,6BACJ,CAAC;AAED,OAAO,MAAMG,mBAAyC,GAAGH,aAAa,CAAC,qBAAqB,CAAC","ignoreList":[]}
package/commands/quote.js CHANGED
@@ -1,10 +1,4 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.INSERT_QUOTE_COMMAND = void 0;
7
- var _lexical = require("lexical");
8
- var INSERT_QUOTE_COMMAND = exports.INSERT_QUOTE_COMMAND = (0, _lexical.createCommand)("INSERT_QUOTE_COMMAND");
1
+ import { createCommand } from "lexical";
2
+ export const INSERT_QUOTE_COMMAND = createCommand("INSERT_QUOTE_COMMAND");
9
3
 
10
4
  //# sourceMappingURL=quote.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_lexical","require","INSERT_QUOTE_COMMAND","exports","createCommand"],"sources":["quote.ts"],"sourcesContent":["import { createCommand, LexicalCommand } from \"lexical\";\n\nexport type QuoteCommandPayload = {\n themeStyleId: string;\n};\n\nexport const INSERT_QUOTE_COMMAND: LexicalCommand<QuoteCommandPayload> =\n createCommand(\"INSERT_QUOTE_COMMAND\");\n"],"mappings":";;;;;;AAAA,IAAAA,QAAA,GAAAC,OAAA;AAMO,IAAMC,oBAAyD,GAAAC,OAAA,CAAAD,oBAAA,GAClE,IAAAE,sBAAa,EAAC,sBAAsB,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["createCommand","INSERT_QUOTE_COMMAND"],"sources":["quote.ts"],"sourcesContent":["import { createCommand, LexicalCommand } from \"lexical\";\n\nexport type QuoteCommandPayload = {\n themeStyleId: string;\n};\n\nexport const INSERT_QUOTE_COMMAND: LexicalCommand<QuoteCommandPayload> =\n createCommand(\"INSERT_QUOTE_COMMAND\");\n"],"mappings":"AAAA,SAASA,aAAa,QAAwB,SAAS;AAMvD,OAAO,MAAMC,oBAAyD,GAClED,aAAa,CAAC,sBAAsB,CAAC","ignoreList":[]}
@@ -1,10 +1,4 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.HIDE_FLOATING_TOOLBAR = void 0;
7
- var _lexical = require("lexical");
8
- var HIDE_FLOATING_TOOLBAR = exports.HIDE_FLOATING_TOOLBAR = (0, _lexical.createCommand)("HIDE_FLOATING_TOOLBAR_COMMAND");
1
+ import { createCommand } from "lexical";
2
+ export const HIDE_FLOATING_TOOLBAR = createCommand("HIDE_FLOATING_TOOLBAR_COMMAND");
9
3
 
10
4
  //# sourceMappingURL=toolbar.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_lexical","require","HIDE_FLOATING_TOOLBAR","exports","createCommand"],"sources":["toolbar.ts"],"sourcesContent":["import { createCommand } from \"lexical\";\n\nexport const HIDE_FLOATING_TOOLBAR = createCommand(\"HIDE_FLOATING_TOOLBAR_COMMAND\");\n"],"mappings":";;;;;;AAAA,IAAAA,QAAA,GAAAC,OAAA;AAEO,IAAMC,qBAAqB,GAAAC,OAAA,CAAAD,qBAAA,GAAG,IAAAE,sBAAa,EAAC,+BAA+B,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["createCommand","HIDE_FLOATING_TOOLBAR"],"sources":["toolbar.ts"],"sourcesContent":["import { createCommand } from \"lexical\";\n\nexport const HIDE_FLOATING_TOOLBAR = createCommand(\"HIDE_FLOATING_TOOLBAR_COMMAND\");\n"],"mappings":"AAAA,SAASA,aAAa,QAAQ,SAAS;AAEvC,OAAO,MAAMC,qBAAqB,GAAGD,aAAa,CAAC,+BAA+B,CAAC","ignoreList":[]}
@@ -1,25 +1,19 @@
1
- "use strict";
1
+ import { useEffect } from "react";
2
+ import { ParagraphNode, $createHeadingNode } from "@webiny/lexical-nodes";
3
+ import { useRichTextEditor } from "../../hooks";
2
4
 
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.EnsureHeadingTagPlugin = void 0;
7
- var _react = require("react");
8
- var _lexicalNodes = require("@webiny/lexical-nodes");
9
- var _hooks = require("../../hooks");
10
5
  /**
11
6
  * In the "Heading" editor, we only want to support heading tags.
12
7
  * However, when the editor is empty, and you start typing, Lexical automatically creates an empty "paragraph" node.
13
8
  * This ensures that any paragraph node is automatically converted to a heading node.
14
9
  */
15
- var EnsureHeadingTagPlugin = exports.EnsureHeadingTagPlugin = function EnsureHeadingTagPlugin() {
16
- var _useRichTextEditor = (0, _hooks.useRichTextEditor)(),
17
- editor = _useRichTextEditor.editor;
18
- (0, _react.useEffect)(function () {
19
- return editor.registerNodeTransform(_lexicalNodes.ParagraphNode, function (node) {
20
- node.replace((0, _lexicalNodes.$createHeadingNode)("h1"), true);
21
- });
22
- }, []);
10
+ export const EnsureHeadingTagPlugin = () => {
11
+ const {
12
+ editor
13
+ } = useRichTextEditor();
14
+ useEffect(() => editor.registerNodeTransform(ParagraphNode, node => {
15
+ node.replace($createHeadingNode("h1"), true);
16
+ }), []);
23
17
  return null;
24
18
  };
25
19
 
@@ -1 +1 @@
1
- {"version":3,"names":["_react","require","_lexicalNodes","_hooks","EnsureHeadingTagPlugin","exports","_useRichTextEditor","useRichTextEditor","editor","useEffect","registerNodeTransform","ParagraphNode","node","replace","$createHeadingNode"],"sources":["EnsureHeadingTagPlugin.tsx"],"sourcesContent":["import { useEffect } from \"react\";\nimport { ParagraphNode, $createHeadingNode } from \"@webiny/lexical-nodes\";\nimport { useRichTextEditor } from \"~/hooks\";\n\n/**\n * In the \"Heading\" editor, we only want to support heading tags.\n * However, when the editor is empty, and you start typing, Lexical automatically creates an empty \"paragraph\" node.\n * This ensures that any paragraph node is automatically converted to a heading node.\n */\nexport const EnsureHeadingTagPlugin = () => {\n const { editor } = useRichTextEditor();\n\n useEffect(\n () =>\n editor.registerNodeTransform(ParagraphNode, node => {\n node.replace($createHeadingNode(\"h1\"), true);\n }),\n []\n );\n return null;\n};\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,aAAA,GAAAD,OAAA;AACA,IAAAE,MAAA,GAAAF,OAAA;AAEA;AACA;AACA;AACA;AACA;AACO,IAAMG,sBAAsB,GAAAC,OAAA,CAAAD,sBAAA,GAAG,SAAzBA,sBAAsBA,CAAA,EAAS;EACxC,IAAAE,kBAAA,GAAmB,IAAAC,wBAAiB,EAAC,CAAC;IAA9BC,MAAM,GAAAF,kBAAA,CAANE,MAAM;EAEd,IAAAC,gBAAS,EACL;IAAA,OACID,MAAM,CAACE,qBAAqB,CAACC,2BAAa,EAAE,UAAAC,IAAI,EAAI;MAChDA,IAAI,CAACC,OAAO,CAAC,IAAAC,gCAAkB,EAAC,IAAI,CAAC,EAAE,IAAI,CAAC;IAChD,CAAC,CAAC;EAAA,GACN,EACJ,CAAC;EACD,OAAO,IAAI;AACf,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["useEffect","ParagraphNode","$createHeadingNode","useRichTextEditor","EnsureHeadingTagPlugin","editor","registerNodeTransform","node","replace"],"sources":["EnsureHeadingTagPlugin.tsx"],"sourcesContent":["import { useEffect } from \"react\";\nimport { ParagraphNode, $createHeadingNode } from \"@webiny/lexical-nodes\";\nimport { useRichTextEditor } from \"~/hooks\";\n\n/**\n * In the \"Heading\" editor, we only want to support heading tags.\n * However, when the editor is empty, and you start typing, Lexical automatically creates an empty \"paragraph\" node.\n * This ensures that any paragraph node is automatically converted to a heading node.\n */\nexport const EnsureHeadingTagPlugin = () => {\n const { editor } = useRichTextEditor();\n\n useEffect(\n () =>\n editor.registerNodeTransform(ParagraphNode, node => {\n node.replace($createHeadingNode(\"h1\"), true);\n }),\n []\n );\n return null;\n};\n"],"mappings":"AAAA,SAASA,SAAS,QAAQ,OAAO;AACjC,SAASC,aAAa,EAAEC,kBAAkB,QAAQ,uBAAuB;AACzE,SAASC,iBAAiB;;AAE1B;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,sBAAsB,GAAGA,CAAA,KAAM;EACxC,MAAM;IAAEC;EAAO,CAAC,GAAGF,iBAAiB,CAAC,CAAC;EAEtCH,SAAS,CACL,MACIK,MAAM,CAACC,qBAAqB,CAACL,aAAa,EAAEM,IAAI,IAAI;IAChDA,IAAI,CAACC,OAAO,CAACN,kBAAkB,CAAC,IAAI,CAAC,EAAE,IAAI,CAAC;EAChD,CAAC,CAAC,EACN,EACJ,CAAC;EACD,OAAO,IAAI;AACf,CAAC","ignoreList":[]}
@@ -1,30 +1,22 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
6
- });
7
- exports.HeadingEditor = void 0;
8
- var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
9
- var _react = _interopRequireDefault(require("react"));
10
- var _RichTextEditor = require("./RichTextEditor");
11
- var _Toolbar = require("../Toolbar/Toolbar");
12
- var _EnsureHeadingTagPlugin = require("./EnsureHeadingTagPlugin");
13
- var _excluded = ["tag", "placeholder"];
14
- var styles = {
1
+ import React from "react";
2
+ import { RichTextEditor } from "./RichTextEditor";
3
+ import { Toolbar } from "../Toolbar/Toolbar";
4
+ import { EnsureHeadingTagPlugin } from "./EnsureHeadingTagPlugin";
5
+ const styles = {
15
6
  padding: 5
16
7
  };
17
- var HeadingEditor = exports.HeadingEditor = function HeadingEditor(_ref) {
18
- var tag = _ref.tag,
19
- placeholder = _ref.placeholder,
20
- rest = (0, _objectWithoutProperties2.default)(_ref, _excluded);
21
- return /*#__PURE__*/_react.default.createElement(_RichTextEditor.RichTextEditor, Object.assign({
22
- toolbar: /*#__PURE__*/_react.default.createElement(_Toolbar.Toolbar, null),
8
+ export const HeadingEditor = ({
9
+ tag,
10
+ placeholder,
11
+ ...rest
12
+ }) => {
13
+ return /*#__PURE__*/React.createElement(RichTextEditor, Object.assign({
14
+ toolbar: /*#__PURE__*/React.createElement(Toolbar, null),
23
15
  tag: tag ?? "h1",
24
16
  placeholder: placeholder ?? "Enter your heading text here..."
25
17
  }, rest, {
26
18
  styles: styles
27
- }), /*#__PURE__*/_react.default.createElement(_EnsureHeadingTagPlugin.EnsureHeadingTagPlugin, null), rest?.children);
19
+ }), /*#__PURE__*/React.createElement(EnsureHeadingTagPlugin, null), rest?.children);
28
20
  };
29
21
 
30
22
  //# sourceMappingURL=HeadingEditor.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_react","_interopRequireDefault","require","_RichTextEditor","_Toolbar","_EnsureHeadingTagPlugin","_excluded","styles","padding","HeadingEditor","exports","_ref","tag","placeholder","rest","_objectWithoutProperties2","default","createElement","RichTextEditor","Object","assign","toolbar","Toolbar","EnsureHeadingTagPlugin","children"],"sources":["HeadingEditor.tsx"],"sourcesContent":["import React from \"react\";\nimport { RichTextEditor, RichTextEditorProps } from \"~/components/Editor/RichTextEditor\";\nimport { Toolbar } from \"~/components/Toolbar/Toolbar\";\nimport { EnsureHeadingTagPlugin } from \"~/components/Editor/EnsureHeadingTagPlugin\";\n\ninterface HeadingEditorProps extends RichTextEditorProps {\n tag?: \"h1\" | \"h2\" | \"h3\" | \"h4\" | \"h5\" | \"h6\";\n}\n\nconst styles = { padding: 5 };\n\nexport const HeadingEditor = ({ tag, placeholder, ...rest }: HeadingEditorProps) => {\n return (\n <RichTextEditor\n toolbar={<Toolbar />}\n tag={tag ?? \"h1\"}\n placeholder={placeholder ?? \"Enter your heading text here...\"}\n {...rest}\n styles={styles}\n >\n <EnsureHeadingTagPlugin />\n {rest?.children}\n </RichTextEditor>\n );\n};\n"],"mappings":";;;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,eAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAF,OAAA;AACA,IAAAG,uBAAA,GAAAH,OAAA;AAAoF,IAAAI,SAAA;AAMpF,IAAMC,MAAM,GAAG;EAAEC,OAAO,EAAE;AAAE,CAAC;AAEtB,IAAMC,aAAa,GAAAC,OAAA,CAAAD,aAAA,GAAG,SAAhBA,aAAaA,CAAAE,IAAA,EAA0D;EAAA,IAApDC,GAAG,GAAAD,IAAA,CAAHC,GAAG;IAAEC,WAAW,GAAAF,IAAA,CAAXE,WAAW;IAAKC,IAAI,OAAAC,yBAAA,CAAAC,OAAA,EAAAL,IAAA,EAAAL,SAAA;EACrD,oBACIN,MAAA,CAAAgB,OAAA,CAAAC,aAAA,CAACd,eAAA,CAAAe,cAAc,EAAAC,MAAA,CAAAC,MAAA;IACXC,OAAO,eAAErB,MAAA,CAAAgB,OAAA,CAAAC,aAAA,CAACb,QAAA,CAAAkB,OAAO,MAAE,CAAE;IACrBV,GAAG,EAAEA,GAAG,IAAI,IAAK;IACjBC,WAAW,EAAEA,WAAW,IAAI;EAAkC,GAC1DC,IAAI;IACRP,MAAM,EAAEA;EAAO,iBAEfP,MAAA,CAAAgB,OAAA,CAAAC,aAAA,CAACZ,uBAAA,CAAAkB,sBAAsB,MAAE,CAAC,EACzBT,IAAI,EAAEU,QACK,CAAC;AAEzB,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["React","RichTextEditor","Toolbar","EnsureHeadingTagPlugin","styles","padding","HeadingEditor","tag","placeholder","rest","createElement","Object","assign","toolbar","children"],"sources":["HeadingEditor.tsx"],"sourcesContent":["import React from \"react\";\nimport { RichTextEditor, RichTextEditorProps } from \"~/components/Editor/RichTextEditor\";\nimport { Toolbar } from \"~/components/Toolbar/Toolbar\";\nimport { EnsureHeadingTagPlugin } from \"~/components/Editor/EnsureHeadingTagPlugin\";\n\ninterface HeadingEditorProps extends RichTextEditorProps {\n tag?: \"h1\" | \"h2\" | \"h3\" | \"h4\" | \"h5\" | \"h6\";\n}\n\nconst styles = { padding: 5 };\n\nexport const HeadingEditor = ({ tag, placeholder, ...rest }: HeadingEditorProps) => {\n return (\n <RichTextEditor\n toolbar={<Toolbar />}\n tag={tag ?? \"h1\"}\n placeholder={placeholder ?? \"Enter your heading text here...\"}\n {...rest}\n styles={styles}\n >\n <EnsureHeadingTagPlugin />\n {rest?.children}\n </RichTextEditor>\n );\n};\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,cAAc;AACvB,SAASC,OAAO;AAChB,SAASC,sBAAsB;AAM/B,MAAMC,MAAM,GAAG;EAAEC,OAAO,EAAE;AAAE,CAAC;AAE7B,OAAO,MAAMC,aAAa,GAAGA,CAAC;EAAEC,GAAG;EAAEC,WAAW;EAAE,GAAGC;AAAyB,CAAC,KAAK;EAChF,oBACIT,KAAA,CAAAU,aAAA,CAACT,cAAc,EAAAU,MAAA,CAAAC,MAAA;IACXC,OAAO,eAAEb,KAAA,CAAAU,aAAA,CAACR,OAAO,MAAE,CAAE;IACrBK,GAAG,EAAEA,GAAG,IAAI,IAAK;IACjBC,WAAW,EAAEA,WAAW,IAAI;EAAkC,GAC1DC,IAAI;IACRL,MAAM,EAAEA;EAAO,iBAEfJ,KAAA,CAAAU,aAAA,CAACP,sBAAsB,MAAE,CAAC,EACzBM,IAAI,EAAEK,QACK,CAAC;AAEzB,CAAC","ignoreList":[]}
@@ -1,29 +1,22 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
6
- });
7
- exports.ParagraphEditor = void 0;
8
- var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
9
- var _react = _interopRequireDefault(require("react"));
10
- var _RichTextEditor = require("./RichTextEditor");
11
- var _Toolbar = require("../Toolbar/Toolbar");
12
- var _excluded = ["placeholder", "tag"];
13
- var styles = {
1
+ import React from "react";
2
+ import { RichTextEditor } from "./RichTextEditor";
3
+ import { Toolbar } from "../Toolbar/Toolbar";
4
+ const styles = {
14
5
  padding: 5
15
6
  };
16
- var ParagraphEditor = exports.ParagraphEditor = function ParagraphEditor(_ref) {
17
- var placeholder = _ref.placeholder,
18
- tag = _ref.tag,
19
- rest = (0, _objectWithoutProperties2.default)(_ref, _excluded);
20
- return /*#__PURE__*/_react.default.createElement(_RichTextEditor.RichTextEditor, Object.assign({
21
- toolbar: /*#__PURE__*/_react.default.createElement(_Toolbar.Toolbar, null),
7
+ const ParagraphEditor = ({
8
+ placeholder,
9
+ tag,
10
+ ...rest
11
+ }) => {
12
+ return /*#__PURE__*/React.createElement(RichTextEditor, Object.assign({
13
+ toolbar: /*#__PURE__*/React.createElement(Toolbar, null),
22
14
  tag: tag ?? "p",
23
15
  placeholder: placeholder ?? "Enter your text here..."
24
16
  }, rest, {
25
17
  styles: styles
26
18
  }), rest?.children);
27
19
  };
20
+ export { ParagraphEditor };
28
21
 
29
22
  //# sourceMappingURL=ParagraphEditor.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_react","_interopRequireDefault","require","_RichTextEditor","_Toolbar","_excluded","styles","padding","ParagraphEditor","exports","_ref","placeholder","tag","rest","_objectWithoutProperties2","default","createElement","RichTextEditor","Object","assign","toolbar","Toolbar","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 styles = { padding: 5 };\n\nconst ParagraphEditor = ({ placeholder, tag, ...rest }: ParagraphLexicalEditorProps) => {\n return (\n <RichTextEditor\n toolbar={<Toolbar />}\n tag={tag ?? \"p\"}\n placeholder={placeholder ?? \"Enter your text here...\"}\n {...rest}\n styles={styles}\n >\n {rest?.children}\n </RichTextEditor>\n );\n};\n\nexport { ParagraphEditor };\n"],"mappings":";;;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,eAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAF,OAAA;AAAuD,IAAAG,SAAA;AAMvD,IAAMC,MAAM,GAAG;EAAEC,OAAO,EAAE;AAAE,CAAC;AAE7B,IAAMC,eAAe,GAAAC,OAAA,CAAAD,eAAA,GAAG,SAAlBA,eAAeA,CAAAE,IAAA,EAAmE;EAAA,IAA7DC,WAAW,GAAAD,IAAA,CAAXC,WAAW;IAAEC,GAAG,GAAAF,IAAA,CAAHE,GAAG;IAAKC,IAAI,OAAAC,yBAAA,CAAAC,OAAA,EAAAL,IAAA,EAAAL,SAAA;EAChD,oBACIL,MAAA,CAAAe,OAAA,CAAAC,aAAA,CAACb,eAAA,CAAAc,cAAc,EAAAC,MAAA,CAAAC,MAAA;IACXC,OAAO,eAAEpB,MAAA,CAAAe,OAAA,CAAAC,aAAA,CAACZ,QAAA,CAAAiB,OAAO,MAAE,CAAE;IACrBT,GAAG,EAAEA,GAAG,IAAI,GAAI;IAChBD,WAAW,EAAEA,WAAW,IAAI;EAA0B,GAClDE,IAAI;IACRP,MAAM,EAAEA;EAAO,IAEdO,IAAI,EAAES,QACK,CAAC;AAEzB,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["React","RichTextEditor","Toolbar","styles","padding","ParagraphEditor","placeholder","tag","rest","createElement","Object","assign","toolbar","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 styles = { padding: 5 };\n\nconst ParagraphEditor = ({ placeholder, tag, ...rest }: ParagraphLexicalEditorProps) => {\n return (\n <RichTextEditor\n toolbar={<Toolbar />}\n tag={tag ?? \"p\"}\n placeholder={placeholder ?? \"Enter your text here...\"}\n {...rest}\n styles={styles}\n >\n {rest?.children}\n </RichTextEditor>\n );\n};\n\nexport { ParagraphEditor };\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,cAAc;AACvB,SAASC,OAAO;AAMhB,MAAMC,MAAM,GAAG;EAAEC,OAAO,EAAE;AAAE,CAAC;AAE7B,MAAMC,eAAe,GAAGA,CAAC;EAAEC,WAAW;EAAEC,GAAG;EAAE,GAAGC;AAAkC,CAAC,KAAK;EACpF,oBACIR,KAAA,CAAAS,aAAA,CAACR,cAAc,EAAAS,MAAA,CAAAC,MAAA;IACXC,OAAO,eAAEZ,KAAA,CAAAS,aAAA,CAACP,OAAO,MAAE,CAAE;IACrBK,GAAG,EAAEA,GAAG,IAAI,GAAI;IAChBD,WAAW,EAAEA,WAAW,IAAI;EAA0B,GAClDE,IAAI;IACRL,MAAM,EAAEA;EAAO,IAEdK,IAAI,EAAEK,QACK,CAAC;AAEzB,CAAC;AAED,SAASR,eAAe","ignoreList":[]}
@@ -1,106 +1,88 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
- var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
5
- Object.defineProperty(exports, "__esModule", {
6
- value: true
7
- });
8
- exports.RichTextEditor = void 0;
9
- var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
10
- var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
11
- var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
12
- var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
13
- var _react = _interopRequireWildcard(require("react"));
14
- var _emotion = require("emotion");
15
- var _LexicalComposer = require("@lexical/react/LexicalComposer");
16
- var _text = require("@lexical/text");
17
- var _LexicalOnChangePlugin = require("@lexical/react/LexicalOnChangePlugin");
18
- var _LexicalAutoFocusPlugin = require("@lexical/react/LexicalAutoFocusPlugin");
19
- var _LexicalClearEditorPlugin = require("@lexical/react/LexicalClearEditorPlugin");
20
- var _LexicalRichTextPlugin = require("@lexical/react/LexicalRichTextPlugin");
21
- var _LexicalErrorBoundary = require("@lexical/react/LexicalErrorBoundary");
22
- var _reactComposition = require("@webiny/react-composition");
23
- var _LexicalHistoryPlugin = require("@lexical/react/LexicalHistoryPlugin");
24
- var _LexicalContentEditable = require("@lexical/react/LexicalContentEditable");
25
- var _lexicalTheme = require("@webiny/lexical-theme");
26
- var _lexicalNodes = require("@webiny/lexical-nodes");
27
- var _RichTextEditorContext = require("../../context/RichTextEditorContext");
28
- var _isValidLexicalData = require("../../utils/isValidLexicalData");
29
- var _LexicalUpdateStatePlugin = require("../../plugins/LexicalUpdateStatePlugin");
30
- var _BlurEventPlugin = require("../../plugins/BlurEventPlugin/BlurEventPlugin");
31
- var _Placeholder = require("../../ui/Placeholder");
32
- var _generateInitialLexicalValue = require("../../utils/generateInitialLexicalValue");
33
- var _SharedHistoryContext = require("../../context/SharedHistoryContext");
34
- var _LexicalEditorConfig = require("../LexicalEditorConfig/LexicalEditorConfig");
35
- var _normalizeInputValue = require("./normalizeInputValue");
36
- var _excluded = ["toolbar", "staticToolbar", "onChange", "nodes", "placeholder", "children", "onBlur", "focus", "styles", "width", "height", "contentEditableStyles", "placeholderStyles", "generateInitialValue"];
37
- var BaseRichTextEditor = function BaseRichTextEditor(_ref) {
38
- var toolbar = _ref.toolbar,
39
- staticToolbar = _ref.staticToolbar,
40
- onChange = _ref.onChange,
41
- nodes = _ref.nodes,
42
- placeholder = _ref.placeholder,
43
- children = _ref.children,
44
- onBlur = _ref.onBlur,
45
- focus = _ref.focus,
46
- styles = _ref.styles,
47
- width = _ref.width,
48
- height = _ref.height,
49
- contentEditableStyles = _ref.contentEditableStyles,
50
- placeholderStyles = _ref.placeholderStyles,
51
- _ref$generateInitialV = _ref.generateInitialValue,
52
- generateInitialValue = _ref$generateInitialV === void 0 ? _generateInitialLexicalValue.generateInitialLexicalValue : _ref$generateInitialV,
53
- props = (0, _objectWithoutProperties2.default)(_ref, _excluded);
54
- var themeEmotionMap = props.themeEmotionMap ?? (0, _lexicalTheme.toTypographyEmotionMap)(_emotion.css, props.theme, props.themeStylesTransformer);
55
- var editorTheme = (0, _react.useRef)((0, _lexicalTheme.createTheme)(props.theme));
56
- var config = (0, _LexicalEditorConfig.useLexicalEditorConfig)();
57
- var _useSharedHistoryCont = (0, _SharedHistoryContext.useSharedHistoryContext)(),
58
- historyState = _useSharedHistoryCont.historyState;
59
- var placeholderElem = /*#__PURE__*/_react.default.createElement(_Placeholder.Placeholder, {
1
+ import React, { Fragment, useRef, useState } from "react";
2
+ import { css } from "emotion";
3
+ import { LexicalComposer } from "@lexical/react/LexicalComposer";
4
+ import { $isRootTextContentEmpty } from "@lexical/text";
5
+ import { OnChangePlugin } from "@lexical/react/LexicalOnChangePlugin";
6
+ import { AutoFocusPlugin } from "@lexical/react/LexicalAutoFocusPlugin";
7
+ import { ClearEditorPlugin } from "@lexical/react/LexicalClearEditorPlugin";
8
+ import { RichTextPlugin } from "@lexical/react/LexicalRichTextPlugin";
9
+ import { LexicalErrorBoundary } from "@lexical/react/LexicalErrorBoundary";
10
+ import { makeDecoratable } from "@webiny/react-composition";
11
+ import { HistoryPlugin } from "@lexical/react/LexicalHistoryPlugin";
12
+ import { ContentEditable } from "@lexical/react/LexicalContentEditable";
13
+ import { createTheme, toTypographyEmotionMap } from "@webiny/lexical-theme";
14
+ import { allNodes } from "@webiny/lexical-nodes";
15
+ import { RichTextEditorProvider } from "../../context/RichTextEditorContext";
16
+ import { isValidLexicalData } from "../../utils/isValidLexicalData";
17
+ import { UpdateStatePlugin } from "../../plugins/LexicalUpdateStatePlugin";
18
+ import { BlurEventPlugin } from "../../plugins/BlurEventPlugin/BlurEventPlugin";
19
+ import { Placeholder } from "../../ui/Placeholder";
20
+ import { generateInitialLexicalValue } from "../../utils/generateInitialLexicalValue";
21
+ import { SharedHistoryContext, useSharedHistoryContext } from "../../context/SharedHistoryContext";
22
+ import { LexicalEditorWithConfig, useLexicalEditorConfig } from "../LexicalEditorConfig/LexicalEditorConfig";
23
+ import { normalizeInputValue } from "./normalizeInputValue";
24
+ const BaseRichTextEditor = ({
25
+ toolbar,
26
+ staticToolbar,
27
+ onChange,
28
+ nodes,
29
+ placeholder,
30
+ children,
31
+ onBlur,
32
+ focus,
33
+ styles,
34
+ width,
35
+ height,
36
+ contentEditableStyles,
37
+ placeholderStyles,
38
+ generateInitialValue = generateInitialLexicalValue,
39
+ ...props
40
+ }) => {
41
+ const themeEmotionMap = props.themeEmotionMap ?? toTypographyEmotionMap(css, props.theme, props.themeStylesTransformer);
42
+ const editorTheme = useRef(createTheme(props.theme));
43
+ const config = useLexicalEditorConfig();
44
+ const {
45
+ historyState
46
+ } = useSharedHistoryContext();
47
+ const placeholderElem = /*#__PURE__*/React.createElement(Placeholder, {
60
48
  styles: placeholderStyles
61
49
  }, placeholder || "Enter text...");
62
- var scrollRef = (0, _react.useRef)(null);
63
- var _useState = (0, _react.useState)(undefined),
64
- _useState2 = (0, _slicedToArray2.default)(_useState, 2),
65
- floatingAnchorElem = _useState2[0],
66
- setFloatingAnchorElem = _useState2[1];
67
- var onRef = function onRef(_floatingAnchorElem) {
50
+ const scrollRef = useRef(null);
51
+ const [floatingAnchorElem, setFloatingAnchorElem] = useState(undefined);
52
+ const onRef = _floatingAnchorElem => {
68
53
  if (_floatingAnchorElem !== null) {
69
54
  setFloatingAnchorElem(_floatingAnchorElem);
70
55
  }
71
56
  };
72
- var sizeStyle = {
57
+ const sizeStyle = {
73
58
  height: height || "",
74
59
  width: width || ""
75
60
  };
76
- var configNodes = config.nodes.map(function (node) {
77
- return node.node;
78
- });
79
- var configPlugins = config.plugins.map(function (plugin) {
80
- return /*#__PURE__*/_react.default.createElement(_react.Fragment, {
81
- key: plugin.name
82
- }, plugin.element);
83
- });
84
- var value = (0, _normalizeInputValue.normalizeInputValue)(props.value);
85
- var editorValue = (0, _isValidLexicalData.isValidLexicalData)(value) ? value : generateInitialValue();
86
- var initialConfig = {
61
+ const configNodes = config.nodes.map(node => node.node);
62
+ const configPlugins = config.plugins.map(plugin => /*#__PURE__*/React.createElement(Fragment, {
63
+ key: plugin.name
64
+ }, plugin.element));
65
+ const value = normalizeInputValue(props.value);
66
+ const editorValue = isValidLexicalData(value) ? value : generateInitialValue();
67
+ const initialConfig = {
87
68
  editorState: null,
88
69
  namespace: "webiny",
89
- onError: function onError() {
70
+ onError: () => {
90
71
  // Ignore errors. We don't want to break the app because of errors caused by config/value updates.
91
72
  // These are usually resolved in the next component render cycle.
92
73
  },
93
- nodes: [].concat((0, _toConsumableArray2.default)(_lexicalNodes.allNodes), (0, _toConsumableArray2.default)(configNodes), (0, _toConsumableArray2.default)(nodes || [])),
94
- theme: (0, _objectSpread2.default)((0, _objectSpread2.default)({}, editorTheme.current), {}, {
74
+ nodes: [...allNodes, ...configNodes, ...(nodes || [])],
75
+ theme: {
76
+ ...editorTheme.current,
95
77
  emotionMap: themeEmotionMap
96
- })
78
+ }
97
79
  };
98
80
  function handleOnChange(editorState, editor) {
99
- editorState.read(function () {
81
+ editorState.read(() => {
100
82
  if (typeof onChange === "function") {
101
- var _editorState = editor.getEditorState();
102
- var isEditorEmpty = (0, _text.$isRootTextContentEmpty)(editor.isComposing(), true);
103
- var newValue = JSON.stringify(_editorState.toJSON());
83
+ const editorState = editor.getEditorState();
84
+ const isEditorEmpty = $isRootTextContentEmpty(editor.isComposing(), true);
85
+ const newValue = JSON.stringify(editorState.toJSON());
104
86
 
105
87
  // We don't want to call "onChange" if editor text is empty, and original `value` is empty.
106
88
  if (!value && isEditorEmpty) {
@@ -121,43 +103,48 @@ var BaseRichTextEditor = function BaseRichTextEditor(_ref) {
121
103
  *
122
104
  * To bypass this issue, we generate a naive `key` based on the number of Nodes.
123
105
  */
124
- _react.default.createElement(_SharedHistoryContext.SharedHistoryContext, null, /*#__PURE__*/_react.default.createElement(_LexicalComposer.LexicalComposer, {
106
+ React.createElement(SharedHistoryContext, null, /*#__PURE__*/React.createElement(LexicalComposer, {
125
107
  initialConfig: initialConfig,
126
108
  key: initialConfig.nodes.length
127
- }, /*#__PURE__*/_react.default.createElement(_RichTextEditorContext.RichTextEditorProvider, {
109
+ }, /*#__PURE__*/React.createElement(RichTextEditorProvider, {
128
110
  theme: props.theme,
129
111
  themeEmotionMap: themeEmotionMap,
130
112
  toolbarActionPlugins: props.toolbarActionPlugins
131
- }, staticToolbar ? staticToolbar : null, /*#__PURE__*/_react.default.createElement("div", {
113
+ }, staticToolbar ? staticToolbar : null, /*#__PURE__*/React.createElement("div", {
132
114
  /* This className is necessary for targeting of editor container from CSS files. */
133
115
  className: "editor-shell",
134
116
  ref: scrollRef,
135
- style: (0, _objectSpread2.default)((0, _objectSpread2.default)((0, _objectSpread2.default)({}, styles), sizeStyle), {}, {
117
+ style: {
118
+ ...styles,
119
+ ...sizeStyle,
136
120
  overflow: "auto",
137
121
  position: "relative"
138
- })
139
- }, /*#__PURE__*/_react.default.createElement(_LexicalOnChangePlugin.OnChangePlugin, {
122
+ }
123
+ }, /*#__PURE__*/React.createElement(OnChangePlugin, {
140
124
  onChange: handleOnChange
141
- }), /*#__PURE__*/_react.default.createElement(_LexicalUpdateStatePlugin.UpdateStatePlugin, {
125
+ }), /*#__PURE__*/React.createElement(UpdateStatePlugin, {
142
126
  value: editorValue
143
- }), /*#__PURE__*/_react.default.createElement(_LexicalClearEditorPlugin.ClearEditorPlugin, null), /*#__PURE__*/_react.default.createElement(_LexicalHistoryPlugin.HistoryPlugin, {
127
+ }), /*#__PURE__*/React.createElement(ClearEditorPlugin, null), /*#__PURE__*/React.createElement(HistoryPlugin, {
144
128
  externalHistoryState: historyState
145
- }), onBlur && /*#__PURE__*/_react.default.createElement(_BlurEventPlugin.BlurEventPlugin, {
129
+ }), onBlur && /*#__PURE__*/React.createElement(BlurEventPlugin, {
146
130
  onBlur: onBlur
147
- }), focus && /*#__PURE__*/_react.default.createElement(_LexicalAutoFocusPlugin.AutoFocusPlugin, null), configPlugins, children, /*#__PURE__*/_react.default.createElement(_LexicalRichTextPlugin.RichTextPlugin, {
148
- contentEditable: /*#__PURE__*/_react.default.createElement("div", {
131
+ }), focus && /*#__PURE__*/React.createElement(AutoFocusPlugin, null), configPlugins, children, /*#__PURE__*/React.createElement(RichTextPlugin, {
132
+ contentEditable: /*#__PURE__*/React.createElement("div", {
149
133
  className: "editor-scroller",
150
- style: (0, _objectSpread2.default)({}, sizeStyle)
151
- }, /*#__PURE__*/_react.default.createElement("div", {
134
+ style: {
135
+ ...sizeStyle
136
+ }
137
+ }, /*#__PURE__*/React.createElement("div", {
152
138
  className: "editor",
153
139
  ref: onRef
154
- }, /*#__PURE__*/_react.default.createElement(_LexicalContentEditable.ContentEditable, {
155
- style: (0, _objectSpread2.default)({
156
- outline: 0
157
- }, contentEditableStyles)
140
+ }, /*#__PURE__*/React.createElement(ContentEditable, {
141
+ style: {
142
+ outline: 0,
143
+ ...contentEditableStyles
144
+ }
158
145
  }))),
159
146
  placeholder: placeholderElem,
160
- ErrorBoundary: _LexicalErrorBoundary.LexicalErrorBoundary
147
+ ErrorBoundary: LexicalErrorBoundary
161
148
  }), floatingAnchorElem && toolbar))))
162
149
  );
163
150
  };
@@ -165,8 +152,8 @@ var BaseRichTextEditor = function BaseRichTextEditor(_ref) {
165
152
  /**
166
153
  * @description Main editor container
167
154
  */
168
- var RichTextEditor = exports.RichTextEditor = (0, _reactComposition.makeDecoratable)("RichTextEditor", function (props) {
169
- return /*#__PURE__*/_react.default.createElement(_LexicalEditorConfig.LexicalEditorWithConfig, null, /*#__PURE__*/_react.default.createElement(BaseRichTextEditor, props));
155
+ export const RichTextEditor = makeDecoratable("RichTextEditor", props => {
156
+ return /*#__PURE__*/React.createElement(LexicalEditorWithConfig, null, /*#__PURE__*/React.createElement(BaseRichTextEditor, props));
170
157
  });
171
158
 
172
159
  //# sourceMappingURL=RichTextEditor.js.map