@webiny/lexical-editor 0.0.0-unstable.d65ec29d44 → 0.0.0-unstable.de38392959
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.
- package/commands/image.d.ts +6 -0
- package/commands/image.js +11 -0
- package/commands/image.js.map +1 -0
- package/commands/index.d.ts +3 -0
- package/commands/index.js +40 -0
- package/commands/index.js.map +1 -0
- package/commands/list.d.ts +7 -0
- package/commands/list.js +15 -0
- package/commands/list.js.map +1 -0
- package/commands/quote.d.ts +5 -0
- package/commands/quote.js +11 -0
- package/commands/quote.js.map +1 -0
- package/components/Editor/HeadingEditor.d.ts +2 -2
- package/components/Editor/HeadingEditor.js +13 -11
- package/components/Editor/HeadingEditor.js.map +1 -1
- package/components/Editor/ParagraphEditor.d.ts +2 -2
- package/components/Editor/ParagraphEditor.js +13 -13
- package/components/Editor/ParagraphEditor.js.map +1 -1
- package/components/Editor/RichTextEditor.d.ts +23 -12
- package/components/Editor/RichTextEditor.js +109 -40
- package/components/Editor/RichTextEditor.js.map +1 -1
- package/components/LexicalEditorConfig/LexicalEditorConfig.d.ts +20 -0
- package/components/LexicalEditorConfig/LexicalEditorConfig.js +75 -0
- package/components/LexicalEditorConfig/LexicalEditorConfig.js.map +1 -0
- package/components/LexicalEditorConfig/components/Node.d.ts +14 -0
- package/components/LexicalEditorConfig/components/Node.js +40 -0
- package/components/LexicalEditorConfig/components/Node.js.map +1 -0
- package/components/LexicalEditorConfig/components/Plugin.d.ts +13 -0
- package/components/LexicalEditorConfig/components/Plugin.js +40 -0
- package/components/LexicalEditorConfig/components/Plugin.js.map +1 -0
- package/components/LexicalEditorConfig/components/ToolbarElement.d.ts +13 -0
- package/components/LexicalEditorConfig/components/ToolbarElement.js +40 -0
- package/components/LexicalEditorConfig/components/ToolbarElement.js.map +1 -0
- package/components/LexicalHtmlRenderer.d.ts +12 -3
- package/components/LexicalHtmlRenderer.js +46 -17
- package/components/LexicalHtmlRenderer.js.map +1 -1
- package/components/Toolbar/StaticToolbar.css +260 -0
- package/components/Toolbar/StaticToolbar.d.ts +3 -0
- package/components/Toolbar/StaticToolbar.js +30 -0
- package/components/Toolbar/StaticToolbar.js.map +1 -0
- package/components/Toolbar/Toolbar.css +233 -1
- package/components/Toolbar/Toolbar.d.ts +2 -9
- package/components/Toolbar/Toolbar.js +75 -86
- package/components/Toolbar/Toolbar.js.map +1 -1
- package/components/ToolbarActions/BoldAction.d.ts +0 -3
- package/components/ToolbarActions/BoldAction.js +10 -15
- package/components/ToolbarActions/BoldAction.js.map +1 -1
- package/components/ToolbarActions/BulletListAction.d.ts +0 -3
- package/components/ToolbarActions/BulletListAction.js +22 -62
- package/components/ToolbarActions/BulletListAction.js.map +1 -1
- package/components/ToolbarActions/CodeHighlightAction.d.ts +0 -4
- package/components/ToolbarActions/CodeHighlightAction.js +10 -16
- package/components/ToolbarActions/CodeHighlightAction.js.map +1 -1
- package/components/ToolbarActions/FontColorAction.d.ts +14 -0
- package/components/ToolbarActions/FontColorAction.js +66 -0
- package/components/ToolbarActions/FontColorAction.js.map +1 -0
- package/components/ToolbarActions/FontSizeAction.js +11 -30
- package/components/ToolbarActions/FontSizeAction.js.map +1 -1
- package/components/ToolbarActions/ImageAction.d.ts +2 -0
- package/components/ToolbarActions/ImageAction.js +56 -0
- package/components/ToolbarActions/ImageAction.js.map +1 -0
- package/components/ToolbarActions/ItalicAction.d.ts +0 -3
- package/components/ToolbarActions/ItalicAction.js +10 -15
- package/components/ToolbarActions/ItalicAction.js.map +1 -1
- package/components/ToolbarActions/LinkAction.d.ts +0 -5
- package/components/ToolbarActions/LinkAction.js +18 -41
- package/components/ToolbarActions/LinkAction.js.map +1 -1
- package/components/ToolbarActions/NumberedListAction.d.ts +0 -3
- package/components/ToolbarActions/NumberedListAction.js +33 -62
- package/components/ToolbarActions/NumberedListAction.js.map +1 -1
- package/components/ToolbarActions/QuoteAction.d.ts +0 -2
- package/components/ToolbarActions/QuoteAction.js +20 -43
- package/components/ToolbarActions/QuoteAction.js.map +1 -1
- package/components/ToolbarActions/TextAlignmentAction.d.ts +14 -0
- package/components/ToolbarActions/TextAlignmentAction.js +75 -0
- package/components/ToolbarActions/TextAlignmentAction.js.map +1 -0
- package/components/ToolbarActions/TypographyAction.d.ts +14 -0
- package/components/ToolbarActions/TypographyAction.js +138 -0
- package/components/ToolbarActions/TypographyAction.js.map +1 -0
- package/components/ToolbarActions/UnderlineAction.d.ts +0 -3
- package/components/ToolbarActions/UnderlineAction.js +11 -16
- package/components/ToolbarActions/UnderlineAction.js.map +1 -1
- package/context/FontColorActionContext.d.ts +6 -0
- package/context/FontColorActionContext.js +12 -0
- package/context/FontColorActionContext.js.map +1 -0
- package/context/RichTextEditorContext.d.ts +16 -3
- package/context/RichTextEditorContext.js +38 -9
- package/context/RichTextEditorContext.js.map +1 -1
- package/context/SharedHistoryContext.d.ts +10 -0
- package/context/SharedHistoryContext.js +28 -0
- package/context/SharedHistoryContext.js.map +1 -0
- package/context/TextAlignmentActionContextProps.d.ts +9 -0
- package/context/TextAlignmentActionContextProps.js +12 -0
- package/context/TextAlignmentActionContextProps.js.map +1 -0
- package/context/TypographyActionContext.d.ts +7 -0
- package/context/TypographyActionContext.js +12 -0
- package/context/TypographyActionContext.js.map +1 -0
- package/hooks/index.d.ts +7 -0
- package/hooks/index.js +84 -0
- package/hooks/index.js.map +1 -0
- package/hooks/useCurrentElement.d.ts +7 -0
- package/hooks/useCurrentElement.js +33 -0
- package/hooks/useCurrentElement.js.map +1 -0
- package/hooks/useCurrentSelection.d.ts +12 -0
- package/hooks/useCurrentSelection.js +72 -0
- package/hooks/useCurrentSelection.js.map +1 -0
- package/hooks/useFontColorPicker.d.ts +2 -0
- package/hooks/useFontColorPicker.js +17 -0
- package/hooks/useFontColorPicker.js.map +1 -0
- package/hooks/useIsMounted.d.ts +1 -0
- package/hooks/useIsMounted.js +20 -0
- package/hooks/useIsMounted.js.map +1 -0
- package/hooks/useList.d.ts +2 -0
- package/hooks/useList.js +54 -0
- package/hooks/useList.js.map +1 -0
- package/hooks/useQuote.d.ts +2 -0
- package/hooks/useQuote.js +22 -0
- package/hooks/useQuote.js.map +1 -0
- package/hooks/useRichTextEditor.js +3 -1
- package/hooks/useRichTextEditor.js.map +1 -1
- package/hooks/useTextAlignmentAction.d.ts +1 -0
- package/hooks/useTextAlignmentAction.js +17 -0
- package/hooks/useTextAlignmentAction.js.map +1 -0
- package/hooks/useTypographyAction.d.ts +1 -0
- package/hooks/useTypographyAction.js +17 -0
- package/hooks/useTypographyAction.js.map +1 -0
- package/images/icons/font-color.svg +1 -0
- package/images/icons/indent.svg +3 -0
- package/images/icons/insert-image.svg +4 -0
- package/images/icons/justify.svg +3 -0
- package/images/icons/outdent.svg +3 -0
- package/index.d.ts +15 -11
- package/index.js +140 -55
- package/index.js.map +1 -1
- package/package.json +16 -16
- package/plugins/BlurEventPlugin/BlurEventPlugin.js +3 -1
- package/plugins/BlurEventPlugin/BlurEventPlugin.js.map +1 -1
- package/plugins/CodeHighlightPlugin/CodeHighlightPlugin.js +3 -1
- package/plugins/CodeHighlightPlugin/CodeHighlightPlugin.js.map +1 -1
- package/plugins/CodeHighlightPlugin/index.js +3 -1
- package/plugins/FloatingLinkEditorPlugin/FloatingLinkEditorPlugin.css +5 -1
- package/plugins/FloatingLinkEditorPlugin/FloatingLinkEditorPlugin.d.ts +0 -2
- package/plugins/FloatingLinkEditorPlugin/FloatingLinkEditorPlugin.js +64 -22
- package/plugins/FloatingLinkEditorPlugin/FloatingLinkEditorPlugin.js.map +1 -1
- package/plugins/FloatingLinkEditorPlugin/index.js +3 -1
- package/plugins/FontColorPlugin/FontColorPlugin.d.ts +1 -0
- package/plugins/FontColorPlugin/FontColorPlugin.js +40 -0
- package/plugins/FontColorPlugin/FontColorPlugin.js.map +1 -0
- package/plugins/ImagesPlugin/ImagesPlugin.d.ts +12 -0
- package/plugins/ImagesPlugin/ImagesPlugin.js +153 -0
- package/plugins/ImagesPlugin/ImagesPlugin.js.map +1 -0
- package/plugins/LexicalUpdateStatePlugin/UpdateStatePlugin.d.ts +9 -0
- package/plugins/LexicalUpdateStatePlugin/UpdateStatePlugin.js +49 -0
- package/plugins/LexicalUpdateStatePlugin/UpdateStatePlugin.js.map +1 -0
- package/plugins/LexicalUpdateStatePlugin/index.d.ts +1 -1
- package/plugins/LexicalUpdateStatePlugin/index.js +7 -5
- package/plugins/LexicalUpdateStatePlugin/index.js.map +1 -1
- package/plugins/LinkPlugin/LinkPlugin.d.ts +5 -0
- package/plugins/LinkPlugin/LinkPlugin.js +68 -0
- package/plugins/LinkPlugin/LinkPlugin.js.map +1 -0
- package/plugins/ListPLugin/ListPlugin.d.ts +1 -0
- package/plugins/ListPLugin/ListPlugin.js +26 -0
- package/plugins/ListPLugin/ListPlugin.js.map +1 -0
- package/plugins/TypographyPlugin/TypographyPlugin.d.ts +1 -0
- package/plugins/TypographyPlugin/TypographyPlugin.js +35 -0
- package/plugins/TypographyPlugin/TypographyPlugin.js.map +1 -0
- package/plugins/WebinyQuoteNodePlugin/WebinyQuoteNodePlugin.d.ts +1 -0
- package/plugins/WebinyQuoteNodePlugin/WebinyQuoteNodePlugin.js +26 -0
- package/plugins/WebinyQuoteNodePlugin/WebinyQuoteNodePlugin.js.map +1 -0
- package/types.d.ts +10 -0
- package/types.js +37 -1
- package/types.js.map +1 -1
- package/ui/ContentEditable.css +22 -0
- package/{plugins/AutoLinkPlugin/AutoLinkPlugin.d.ts → ui/ContentEditable.d.ts} +5 -4
- package/ui/ContentEditable.js +26 -0
- package/ui/ContentEditable.js.map +1 -0
- package/ui/Divider.js +3 -1
- package/ui/Divider.js.map +1 -1
- package/ui/DropDown.d.ts +2 -2
- package/ui/DropDown.js +62 -22
- package/ui/DropDown.js.map +1 -1
- package/ui/ImageResizer.d.ts +24 -0
- package/ui/ImageResizer.js +215 -0
- package/ui/ImageResizer.js.map +1 -0
- package/ui/LinkPreview.js +10 -8
- package/ui/LinkPreview.js.map +1 -1
- package/ui/Placeholder.css +2 -5
- package/ui/Placeholder.d.ts +3 -1
- package/ui/Placeholder.js +8 -2
- package/ui/Placeholder.js.map +1 -1
- package/ui/TextInput.js +3 -1
- package/ui/TextInput.js.map +1 -1
- package/ui/ToolbarActionDialog.d.ts +12 -0
- package/ui/ToolbarActionDialog.js +108 -0
- package/ui/ToolbarActionDialog.js.map +1 -0
- package/utils/canUseDOM.d.ts +1 -0
- package/utils/canUseDOM.js +10 -0
- package/utils/canUseDOM.js.map +1 -0
- package/utils/files.d.ts +12 -0
- package/utils/files.js +64 -0
- package/utils/files.js.map +1 -0
- package/utils/generateInitialLexicalValue.js +23 -18
- package/utils/generateInitialLexicalValue.js.map +1 -1
- package/utils/getDOMRangeRect.d.ts +0 -2
- package/utils/getDOMRangeRect.js +3 -1
- package/utils/getDOMRangeRect.js.map +1 -1
- package/utils/getSelectedNode.js +3 -1
- package/utils/getSelectedNode.js.map +1 -1
- package/utils/getTransparentImage.d.ts +1 -0
- package/utils/getTransparentImage.js +12 -0
- package/utils/getTransparentImage.js.map +1 -0
- package/utils/insertImage.d.ts +2 -0
- package/utils/insertImage.js +23 -0
- package/utils/insertImage.js.map +1 -0
- package/{themes/webinyLexicalTheme.d.ts → utils/isHTMLElement.d.ts} +1 -3
- package/utils/isHTMLElement.js +18 -0
- package/utils/isHTMLElement.js.map +1 -0
- package/utils/isUrlLinkReference.d.ts +1 -0
- package/utils/isUrlLinkReference.js +12 -0
- package/utils/isUrlLinkReference.js.map +1 -0
- package/utils/isValidJSON.js +3 -1
- package/utils/isValidLexicalData.d.ts +2 -0
- package/utils/isValidLexicalData.js +20 -12
- package/utils/isValidLexicalData.js.map +1 -1
- package/utils/point.js +3 -4
- package/utils/point.js.map +1 -1
- package/utils/rect.d.ts +0 -2
- package/utils/rect.js +3 -6
- package/utils/rect.js.map +1 -1
- package/utils/sanitizeUrl.d.ts +0 -7
- package/utils/sanitizeUrl.js +7 -1
- package/utils/sanitizeUrl.js.map +1 -1
- package/utils/setFloatingElemPosition.d.ts +0 -2
- package/utils/setFloatingElemPosition.js +3 -1
- package/utils/setFloatingElemPosition.js.map +1 -1
- package/components/AddRichTextEditorNodeType.d.ts +0 -6
- package/components/AddRichTextEditorNodeType.js +0 -28
- package/components/AddRichTextEditorNodeType.js.map +0 -1
- package/components/AddRichTextEditorPlugin.d.ts +0 -10
- package/components/AddRichTextEditorPlugin.js +0 -31
- package/components/AddRichTextEditorPlugin.js.map +0 -1
- package/components/AddToolbarAction.d.ts +0 -7
- package/components/AddToolbarAction.js +0 -33
- package/components/AddToolbarAction.js.map +0 -1
- package/components/Toolbar/HeadingToolbar.d.ts +0 -12
- package/components/Toolbar/HeadingToolbar.js +0 -23
- package/components/Toolbar/HeadingToolbar.js.map +0 -1
- package/components/Toolbar/ParagraphToolbar.d.ts +0 -12
- package/components/Toolbar/ParagraphToolbar.js +0 -23
- package/components/Toolbar/ParagraphToolbar.js.map +0 -1
- package/components/ToolbarPresets/HeadingToolbarPreset.d.ts +0 -2
- package/components/ToolbarPresets/HeadingToolbarPreset.js +0 -44
- package/components/ToolbarPresets/HeadingToolbarPreset.js.map +0 -1
- package/components/ToolbarPresets/ParagraphToolbarPreset.d.ts +0 -2
- package/components/ToolbarPresets/ParagraphToolbarPreset.js +0 -59
- package/components/ToolbarPresets/ParagraphToolbarPreset.js.map +0 -1
- package/nodes/webinyNodes.d.ts +0 -2
- package/nodes/webinyNodes.js +0 -15
- package/nodes/webinyNodes.js.map +0 -1
- package/plugins/AutoLinkPlugin/AutoLinkPlugin.js +0 -46
- package/plugins/AutoLinkPlugin/AutoLinkPlugin.js.map +0 -1
- package/plugins/AutoLinkPlugin/index.d.ts +0 -1
- package/plugins/AutoLinkPlugin/index.js +0 -16
- package/plugins/AutoLinkPlugin/index.js.map +0 -1
- package/plugins/ClickableLinkPlugin/ClickableLinkPlugin.d.ts +0 -17
- package/plugins/ClickableLinkPlugin/ClickableLinkPlugin.js +0 -88
- package/plugins/ClickableLinkPlugin/ClickableLinkPlugin.js.map +0 -1
- package/plugins/ClickableLinkPlugin/index.d.ts +0 -1
- package/plugins/ClickableLinkPlugin/index.js +0 -16
- package/plugins/ClickableLinkPlugin/index.js.map +0 -1
- package/plugins/LexicalUpdateStatePlugin/LexicalUpdateStatePlugin.d.ts +0 -8
- package/plugins/LexicalUpdateStatePlugin/LexicalUpdateStatePlugin.js +0 -34
- package/plugins/LexicalUpdateStatePlugin/LexicalUpdateStatePlugin.js.map +0 -1
- package/themes/webinyLexicalTheme.css +0 -422
- package/themes/webinyLexicalTheme.js +0 -107
- package/themes/webinyLexicalTheme.js.map +0 -1
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.INSERT_IMAGE_COMMAND = void 0;
|
|
7
|
+
var _lexical = require("lexical");
|
|
8
|
+
var INSERT_IMAGE_COMMAND = (0, _lexical.createCommand)("INSERT_IMAGE_COMMAND");
|
|
9
|
+
exports.INSERT_IMAGE_COMMAND = INSERT_IMAGE_COMMAND;
|
|
10
|
+
|
|
11
|
+
//# sourceMappingURL=image.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_lexical","require","INSERT_IMAGE_COMMAND","createCommand","exports"],"sources":["image.ts"],"sourcesContent":["import { createCommand, LexicalCommand, NodeKey } from \"lexical\";\nimport { ImageNodeProps } from \"@webiny/lexical-nodes\";\n\nexport interface ImagePayload extends ImageNodeProps {\n key?: NodeKey;\n}\n\nexport const INSERT_IMAGE_COMMAND: LexicalCommand<ImagePayload> =\n createCommand(\"INSERT_IMAGE_COMMAND\");\n"],"mappings":";;;;;;AAAA,IAAAA,QAAA,GAAAC,OAAA;AAOO,IAAMC,oBAAkD,GAC3D,IAAAC,sBAAa,EAAC,sBAAsB,CAAC;AAACC,OAAA,CAAAF,oBAAA,GAAAA,oBAAA"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
var _image = require("./image");
|
|
7
|
+
Object.keys(_image).forEach(function (key) {
|
|
8
|
+
if (key === "default" || key === "__esModule") return;
|
|
9
|
+
if (key in exports && exports[key] === _image[key]) return;
|
|
10
|
+
Object.defineProperty(exports, key, {
|
|
11
|
+
enumerable: true,
|
|
12
|
+
get: function get() {
|
|
13
|
+
return _image[key];
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
});
|
|
17
|
+
var _list = require("./list");
|
|
18
|
+
Object.keys(_list).forEach(function (key) {
|
|
19
|
+
if (key === "default" || key === "__esModule") return;
|
|
20
|
+
if (key in exports && exports[key] === _list[key]) return;
|
|
21
|
+
Object.defineProperty(exports, key, {
|
|
22
|
+
enumerable: true,
|
|
23
|
+
get: function get() {
|
|
24
|
+
return _list[key];
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
});
|
|
28
|
+
var _quote = require("./quote");
|
|
29
|
+
Object.keys(_quote).forEach(function (key) {
|
|
30
|
+
if (key === "default" || key === "__esModule") return;
|
|
31
|
+
if (key in exports && exports[key] === _quote[key]) return;
|
|
32
|
+
Object.defineProperty(exports, key, {
|
|
33
|
+
enumerable: true,
|
|
34
|
+
get: function get() {
|
|
35
|
+
return _quote[key];
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_image","require","Object","keys","forEach","key","exports","defineProperty","enumerable","get","_list","_quote"],"sources":["index.ts"],"sourcesContent":["export * from \"~/commands/image\";\nexport * from \"~/commands/list\";\nexport * from \"~/commands/quote\";\n"],"mappings":";;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAH,MAAA,EAAAI,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAL,MAAA,CAAAK,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,IAAA;MAAA,OAAAT,MAAA,CAAAK,GAAA;IAAA;EAAA;AAAA;AACA,IAAAK,KAAA,GAAAT,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAO,KAAA,EAAAN,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAK,KAAA,CAAAL,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,IAAA;MAAA,OAAAC,KAAA,CAAAL,GAAA;IAAA;EAAA;AAAA;AACA,IAAAM,MAAA,GAAAV,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAQ,MAAA,EAAAP,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAM,MAAA,CAAAN,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,IAAA;MAAA,OAAAE,MAAA,CAAAN,GAAA;IAAA;EAAA;AAAA"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { LexicalCommand } from "lexical";
|
|
2
|
+
export declare type ListCommandPayload = {
|
|
3
|
+
themeStyleId?: string;
|
|
4
|
+
};
|
|
5
|
+
export declare const INSERT_UNORDERED_LIST_COMMAND: LexicalCommand<ListCommandPayload>;
|
|
6
|
+
export declare const INSERT_ORDERED_LIST_COMMAND: LexicalCommand<ListCommandPayload>;
|
|
7
|
+
export declare const REMOVE_LIST_COMMAND: LexicalCommand<void>;
|
package/commands/list.js
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.REMOVE_LIST_COMMAND = exports.INSERT_UNORDERED_LIST_COMMAND = exports.INSERT_ORDERED_LIST_COMMAND = void 0;
|
|
7
|
+
var _lexical = require("lexical");
|
|
8
|
+
var INSERT_UNORDERED_LIST_COMMAND = (0, _lexical.createCommand)("INSERT_UNORDERED_LIST_COMMAND");
|
|
9
|
+
exports.INSERT_UNORDERED_LIST_COMMAND = INSERT_UNORDERED_LIST_COMMAND;
|
|
10
|
+
var INSERT_ORDERED_LIST_COMMAND = (0, _lexical.createCommand)("INSERT_ORDERED_LIST_COMMAND");
|
|
11
|
+
exports.INSERT_ORDERED_LIST_COMMAND = INSERT_ORDERED_LIST_COMMAND;
|
|
12
|
+
var REMOVE_LIST_COMMAND = (0, _lexical.createCommand)("REMOVE_LIST_COMMAND");
|
|
13
|
+
exports.REMOVE_LIST_COMMAND = REMOVE_LIST_COMMAND;
|
|
14
|
+
|
|
15
|
+
//# sourceMappingURL=list.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_lexical","require","INSERT_UNORDERED_LIST_COMMAND","createCommand","exports","INSERT_ORDERED_LIST_COMMAND","REMOVE_LIST_COMMAND"],"sources":["list.ts"],"sourcesContent":["import { createCommand, LexicalCommand } from \"lexical\";\n\nexport type ListCommandPayload = {\n themeStyleId?: string;\n};\n\nexport const INSERT_UNORDERED_LIST_COMMAND: LexicalCommand<ListCommandPayload> = createCommand(\n \"INSERT_UNORDERED_LIST_COMMAND\"\n);\n\nexport const INSERT_ORDERED_LIST_COMMAND: LexicalCommand<ListCommandPayload> = createCommand(\n \"INSERT_ORDERED_LIST_COMMAND\"\n);\n\nexport const REMOVE_LIST_COMMAND: LexicalCommand<void> = createCommand(\"REMOVE_LIST_COMMAND\");\n"],"mappings":";;;;;;AAAA,IAAAA,QAAA,GAAAC,OAAA;AAMO,IAAMC,6BAAiE,GAAG,IAAAC,sBAAa,EAC1F,+BACJ,CAAC;AAACC,OAAA,CAAAF,6BAAA,GAAAA,6BAAA;AAEK,IAAMG,2BAA+D,GAAG,IAAAF,sBAAa,EACxF,6BACJ,CAAC;AAACC,OAAA,CAAAC,2BAAA,GAAAA,2BAAA;AAEK,IAAMC,mBAAyC,GAAG,IAAAH,sBAAa,EAAC,qBAAqB,CAAC;AAACC,OAAA,CAAAE,mBAAA,GAAAA,mBAAA"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.INSERT_QUOTE_COMMAND = void 0;
|
|
7
|
+
var _lexical = require("lexical");
|
|
8
|
+
var INSERT_QUOTE_COMMAND = (0, _lexical.createCommand)("INSERT_QUOTE_COMMAND");
|
|
9
|
+
exports.INSERT_QUOTE_COMMAND = INSERT_QUOTE_COMMAND;
|
|
10
|
+
|
|
11
|
+
//# sourceMappingURL=quote.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_lexical","require","INSERT_QUOTE_COMMAND","createCommand","exports"],"sources":["quote.ts"],"sourcesContent":["import { createCommand, LexicalCommand } from \"lexical\";\n\nexport type QuoteCommandPayload = {\n themeStyleId: string;\n};\n\nexport const INSERT_QUOTE_COMMAND: LexicalCommand<QuoteCommandPayload> =\n createCommand(\"INSERT_QUOTE_COMMAND\");\n"],"mappings":";;;;;;AAAA,IAAAA,QAAA,GAAAC,OAAA;AAMO,IAAMC,oBAAyD,GAClE,IAAAC,sBAAa,EAAC,sBAAsB,CAAC;AAACC,OAAA,CAAAF,oBAAA,GAAAA,oBAAA"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
/// <reference types="react" />
|
|
2
2
|
import { RichTextEditorProps } from "./RichTextEditor";
|
|
3
3
|
interface HeadingEditorProps extends RichTextEditorProps {
|
|
4
4
|
tag?: "h1" | "h2" | "h3" | "h4" | "h5" | "h6";
|
|
5
5
|
}
|
|
6
|
-
export declare const HeadingEditor:
|
|
6
|
+
export declare const HeadingEditor: ({ tag, placeholder, ...rest }: HeadingEditorProps) => JSX.Element;
|
|
7
7
|
export {};
|
|
@@ -7,22 +7,24 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
exports.HeadingEditor = void 0;
|
|
8
8
|
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
9
9
|
var _react = _interopRequireDefault(require("react"));
|
|
10
|
-
var _LexicalLinkPlugin = require("@lexical/react/LexicalLinkPlugin");
|
|
11
|
-
var _ClickableLinkPlugin = require("../../plugins/ClickableLinkPlugin/ClickableLinkPlugin");
|
|
12
|
-
var _FloatingLinkEditorPlugin = require("../../plugins/FloatingLinkEditorPlugin/FloatingLinkEditorPlugin");
|
|
13
|
-
var _HeadingToolbar = require("../Toolbar/HeadingToolbar");
|
|
14
10
|
var _RichTextEditor = require("./RichTextEditor");
|
|
11
|
+
var _Toolbar = require("../Toolbar/Toolbar");
|
|
15
12
|
var _excluded = ["tag", "placeholder"];
|
|
13
|
+
var styles = {
|
|
14
|
+
padding: 5
|
|
15
|
+
};
|
|
16
16
|
var HeadingEditor = function HeadingEditor(_ref) {
|
|
17
17
|
var tag = _ref.tag,
|
|
18
18
|
placeholder = _ref.placeholder,
|
|
19
19
|
rest = (0, _objectWithoutProperties2.default)(_ref, _excluded);
|
|
20
20
|
return /*#__PURE__*/_react.default.createElement(_RichTextEditor.RichTextEditor, Object.assign({
|
|
21
|
-
toolbar: /*#__PURE__*/_react.default.createElement(
|
|
22
|
-
tag: tag
|
|
23
|
-
placeholder: placeholder
|
|
24
|
-
}, rest
|
|
25
|
-
|
|
26
|
-
}));
|
|
21
|
+
toolbar: /*#__PURE__*/_react.default.createElement(_Toolbar.Toolbar, null),
|
|
22
|
+
tag: tag ?? "h1",
|
|
23
|
+
placeholder: placeholder ?? "Enter your heading text here..."
|
|
24
|
+
}, rest, {
|
|
25
|
+
styles: styles
|
|
26
|
+
}), rest?.children);
|
|
27
27
|
};
|
|
28
|
-
exports.HeadingEditor = HeadingEditor;
|
|
28
|
+
exports.HeadingEditor = HeadingEditor;
|
|
29
|
+
|
|
30
|
+
//# sourceMappingURL=HeadingEditor.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_react","_interopRequireDefault","require","
|
|
1
|
+
{"version":3,"names":["_react","_interopRequireDefault","require","_RichTextEditor","_Toolbar","_excluded","styles","padding","HeadingEditor","_ref","tag","placeholder","rest","_objectWithoutProperties2","default","createElement","RichTextEditor","Object","assign","toolbar","Toolbar","children","exports"],"sources":["HeadingEditor.tsx"],"sourcesContent":["import React from \"react\";\nimport { RichTextEditor, RichTextEditorProps } from \"~/components/Editor/RichTextEditor\";\nimport { Toolbar } from \"~/components/Toolbar/Toolbar\";\n\ninterface HeadingEditorProps extends RichTextEditorProps {\n tag?: \"h1\" | \"h2\" | \"h3\" | \"h4\" | \"h5\" | \"h6\";\n}\n\nconst styles = { padding: 5 };\n\nexport const HeadingEditor = ({ tag, placeholder, ...rest }: HeadingEditorProps) => {\n return (\n <RichTextEditor\n toolbar={<Toolbar />}\n tag={tag ?? \"h1\"}\n placeholder={placeholder ?? \"Enter your heading text here...\"}\n {...rest}\n styles={styles}\n >\n {rest?.children}\n </RichTextEditor>\n );\n};\n"],"mappings":";;;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,eAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAF,OAAA;AAAuD,IAAAG,SAAA;AAMvD,IAAMC,MAAM,GAAG;EAAEC,OAAO,EAAE;AAAE,CAAC;AAEtB,IAAMC,aAAa,GAAG,SAAhBA,aAAaA,CAAAC,IAAA,EAA0D;EAAA,IAApDC,GAAG,GAAAD,IAAA,CAAHC,GAAG;IAAEC,WAAW,GAAAF,IAAA,CAAXE,WAAW;IAAKC,IAAI,OAAAC,yBAAA,CAAAC,OAAA,EAAAL,IAAA,EAAAJ,SAAA;EACrD,oBACIL,MAAA,CAAAc,OAAA,CAAAC,aAAA,CAACZ,eAAA,CAAAa,cAAc,EAAAC,MAAA,CAAAC,MAAA;IACXC,OAAO,eAAEnB,MAAA,CAAAc,OAAA,CAAAC,aAAA,CAACX,QAAA,CAAAgB,OAAO,MAAE,CAAE;IACrBV,GAAG,EAAEA,GAAG,IAAI,IAAK;IACjBC,WAAW,EAAEA,WAAW,IAAI;EAAkC,GAC1DC,IAAI;IACRN,MAAM,EAAEA;EAAO,IAEdM,IAAI,EAAES,QACK,CAAC;AAEzB,CAAC;AAACC,OAAA,CAAAd,aAAA,GAAAA,aAAA"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
/// <reference types="react" />
|
|
2
2
|
import { RichTextEditorProps } from "./RichTextEditor";
|
|
3
3
|
interface ParagraphLexicalEditorProps extends RichTextEditorProps {
|
|
4
4
|
tag?: "p";
|
|
5
5
|
}
|
|
6
|
-
declare const ParagraphEditor:
|
|
6
|
+
declare const ParagraphEditor: ({ placeholder, tag, ...rest }: ParagraphLexicalEditorProps) => JSX.Element;
|
|
7
7
|
export { ParagraphEditor };
|
|
@@ -7,24 +7,24 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
exports.ParagraphEditor = void 0;
|
|
8
8
|
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
9
9
|
var _react = _interopRequireDefault(require("react"));
|
|
10
|
-
var _LexicalListPlugin = require("@lexical/react/LexicalListPlugin");
|
|
11
|
-
var _CodeHighlightPlugin = require("../../plugins/CodeHighlightPlugin/CodeHighlightPlugin");
|
|
12
|
-
var _LexicalLinkPlugin = require("@lexical/react/LexicalLinkPlugin");
|
|
13
|
-
var _FloatingLinkEditorPlugin = require("../../plugins/FloatingLinkEditorPlugin/FloatingLinkEditorPlugin");
|
|
14
|
-
var _ClickableLinkPlugin = require("../../plugins/ClickableLinkPlugin/ClickableLinkPlugin");
|
|
15
|
-
var _ParagraphToolbar = require("../Toolbar/ParagraphToolbar");
|
|
16
10
|
var _RichTextEditor = require("./RichTextEditor");
|
|
11
|
+
var _Toolbar = require("../Toolbar/Toolbar");
|
|
17
12
|
var _excluded = ["placeholder", "tag"];
|
|
13
|
+
var styles = {
|
|
14
|
+
padding: 5
|
|
15
|
+
};
|
|
18
16
|
var ParagraphEditor = function ParagraphEditor(_ref) {
|
|
19
17
|
var placeholder = _ref.placeholder,
|
|
20
18
|
tag = _ref.tag,
|
|
21
19
|
rest = (0, _objectWithoutProperties2.default)(_ref, _excluded);
|
|
22
20
|
return /*#__PURE__*/_react.default.createElement(_RichTextEditor.RichTextEditor, Object.assign({
|
|
23
|
-
toolbar: /*#__PURE__*/_react.default.createElement(
|
|
24
|
-
tag: tag
|
|
25
|
-
placeholder: placeholder
|
|
26
|
-
}, rest
|
|
27
|
-
|
|
28
|
-
}),
|
|
21
|
+
toolbar: /*#__PURE__*/_react.default.createElement(_Toolbar.Toolbar, null),
|
|
22
|
+
tag: tag ?? "p",
|
|
23
|
+
placeholder: placeholder ?? "Enter your text here..."
|
|
24
|
+
}, rest, {
|
|
25
|
+
styles: styles
|
|
26
|
+
}), rest?.children);
|
|
29
27
|
};
|
|
30
|
-
exports.ParagraphEditor = ParagraphEditor;
|
|
28
|
+
exports.ParagraphEditor = ParagraphEditor;
|
|
29
|
+
|
|
30
|
+
//# sourceMappingURL=ParagraphEditor.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_react","_interopRequireDefault","require","
|
|
1
|
+
{"version":3,"names":["_react","_interopRequireDefault","require","_RichTextEditor","_Toolbar","_excluded","styles","padding","ParagraphEditor","_ref","placeholder","tag","rest","_objectWithoutProperties2","default","createElement","RichTextEditor","Object","assign","toolbar","Toolbar","children","exports"],"sources":["ParagraphEditor.tsx"],"sourcesContent":["import React from \"react\";\nimport { RichTextEditor, RichTextEditorProps } from \"~/components/Editor/RichTextEditor\";\nimport { Toolbar } from \"~/components/Toolbar/Toolbar\";\n\ninterface ParagraphLexicalEditorProps extends RichTextEditorProps {\n tag?: \"p\";\n}\n\nconst styles = { padding: 5 };\n\nconst ParagraphEditor = ({ placeholder, tag, ...rest }: ParagraphLexicalEditorProps) => {\n return (\n <RichTextEditor\n toolbar={<Toolbar />}\n tag={tag ?? \"p\"}\n placeholder={placeholder ?? \"Enter your text here...\"}\n {...rest}\n styles={styles}\n >\n {rest?.children}\n </RichTextEditor>\n );\n};\n\nexport { ParagraphEditor };\n"],"mappings":";;;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,eAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAF,OAAA;AAAuD,IAAAG,SAAA;AAMvD,IAAMC,MAAM,GAAG;EAAEC,OAAO,EAAE;AAAE,CAAC;AAE7B,IAAMC,eAAe,GAAG,SAAlBA,eAAeA,CAAAC,IAAA,EAAmE;EAAA,IAA7DC,WAAW,GAAAD,IAAA,CAAXC,WAAW;IAAEC,GAAG,GAAAF,IAAA,CAAHE,GAAG;IAAKC,IAAI,OAAAC,yBAAA,CAAAC,OAAA,EAAAL,IAAA,EAAAJ,SAAA;EAChD,oBACIL,MAAA,CAAAc,OAAA,CAAAC,aAAA,CAACZ,eAAA,CAAAa,cAAc,EAAAC,MAAA,CAAAC,MAAA;IACXC,OAAO,eAAEnB,MAAA,CAAAc,OAAA,CAAAC,aAAA,CAACX,QAAA,CAAAgB,OAAO,MAAE,CAAE;IACrBT,GAAG,EAAEA,GAAG,IAAI,GAAI;IAChBD,WAAW,EAAEA,WAAW,IAAI;EAA0B,GAClDE,IAAI;IACRN,MAAM,EAAEA;EAAO,IAEdM,IAAI,EAAES,QACK,CAAC;AAEzB,CAAC;AAACC,OAAA,CAAAd,eAAA,GAAAA,eAAA"}
|
|
@@ -1,23 +1,34 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import {
|
|
2
|
+
import { CSSObject } from "@emotion/react";
|
|
3
3
|
import { Klass, LexicalNode } from "lexical";
|
|
4
|
+
import { LexicalValue, ToolbarActionPlugin } from "../../types";
|
|
5
|
+
import { WebinyTheme, ThemeEmotionMap } from "@webiny/lexical-theme";
|
|
4
6
|
export interface RichTextEditorProps {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
value: LexicalValue | null;
|
|
7
|
+
children?: React.ReactNode | React.ReactNode[];
|
|
8
|
+
classes?: string;
|
|
9
|
+
contentEditableStyles?: React.CSSProperties;
|
|
9
10
|
focus?: boolean;
|
|
10
|
-
|
|
11
|
+
height?: number | string;
|
|
11
12
|
nodes?: Klass<LexicalNode>[];
|
|
12
|
-
/**
|
|
13
|
-
* @description Lexical plugins
|
|
14
|
-
*/
|
|
15
|
-
children?: React.ReactNode | React.ReactNode[];
|
|
16
13
|
onBlur?: (editorState: LexicalValue) => void;
|
|
17
|
-
|
|
14
|
+
onChange?: (json: LexicalValue) => void;
|
|
15
|
+
placeholder?: string;
|
|
16
|
+
placeholderStyles?: React.CSSProperties;
|
|
17
|
+
staticToolbar?: React.ReactNode;
|
|
18
|
+
styles?: React.CSSProperties;
|
|
19
|
+
tag?: string;
|
|
20
|
+
theme: WebinyTheme;
|
|
21
|
+
themeEmotionMap?: ThemeEmotionMap;
|
|
22
|
+
themeStylesTransformer?: (cssObject: Record<string, any>) => CSSObject;
|
|
23
|
+
toolbar?: React.ReactNode;
|
|
24
|
+
toolbarActionPlugins?: ToolbarActionPlugin[];
|
|
25
|
+
value: LexicalValue | null;
|
|
18
26
|
width?: number | string;
|
|
19
27
|
}
|
|
20
28
|
/**
|
|
21
29
|
* @description Main editor container
|
|
22
30
|
*/
|
|
23
|
-
export declare const RichTextEditor:
|
|
31
|
+
export declare const RichTextEditor: React.FunctionComponent<RichTextEditorProps> & {
|
|
32
|
+
original: React.ComponentType<RichTextEditorProps>;
|
|
33
|
+
originalName: string;
|
|
34
|
+
};
|
|
@@ -10,10 +10,7 @@ var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/obje
|
|
|
10
10
|
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
11
11
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
12
12
|
var _react = _interopRequireWildcard(require("react"));
|
|
13
|
-
var
|
|
14
|
-
var _generateInitialLexicalValue = require("../../utils/generateInitialLexicalValue");
|
|
15
|
-
var _webinyNodes = require("../../nodes/webinyNodes");
|
|
16
|
-
var _webinyLexicalTheme = require("../../themes/webinyLexicalTheme");
|
|
13
|
+
var _react2 = require("@emotion/react");
|
|
17
14
|
var _LexicalComposer = require("@lexical/react/LexicalComposer");
|
|
18
15
|
var _LexicalOnChangePlugin = require("@lexical/react/LexicalOnChangePlugin");
|
|
19
16
|
var _LexicalAutoFocusPlugin = require("@lexical/react/LexicalAutoFocusPlugin");
|
|
@@ -21,13 +18,22 @@ var _LexicalClearEditorPlugin = require("@lexical/react/LexicalClearEditorPlugin
|
|
|
21
18
|
var _LexicalRichTextPlugin = require("@lexical/react/LexicalRichTextPlugin");
|
|
22
19
|
var _LexicalErrorBoundary = _interopRequireDefault(require("@lexical/react/LexicalErrorBoundary"));
|
|
23
20
|
var _reactComposition = require("@webiny/react-composition");
|
|
21
|
+
var _LexicalHistoryPlugin = require("@lexical/react/LexicalHistoryPlugin");
|
|
24
22
|
var _LexicalContentEditable = require("@lexical/react/LexicalContentEditable");
|
|
25
23
|
var _RichTextEditorContext = require("../../context/RichTextEditorContext");
|
|
26
24
|
var _isValidLexicalData = require("../../utils/isValidLexicalData");
|
|
27
25
|
var _LexicalUpdateStatePlugin = require("../../plugins/LexicalUpdateStatePlugin");
|
|
28
26
|
var _BlurEventPlugin = require("../../plugins/BlurEventPlugin/BlurEventPlugin");
|
|
27
|
+
var _Placeholder = require("../../ui/Placeholder");
|
|
28
|
+
var _generateInitialLexicalValue = require("../../utils/generateInitialLexicalValue");
|
|
29
|
+
var _lexicalTheme = require("@webiny/lexical-theme");
|
|
30
|
+
var _lexicalNodes = require("@webiny/lexical-nodes");
|
|
31
|
+
var _SharedHistoryContext = require("../../context/SharedHistoryContext");
|
|
32
|
+
var _useRichTextEditor2 = require("../../hooks/useRichTextEditor");
|
|
33
|
+
var _LexicalEditorConfig = require("../LexicalEditorConfig/LexicalEditorConfig");
|
|
29
34
|
var BaseRichTextEditor = function BaseRichTextEditor(_ref) {
|
|
30
35
|
var toolbar = _ref.toolbar,
|
|
36
|
+
staticToolbar = _ref.staticToolbar,
|
|
31
37
|
onChange = _ref.onChange,
|
|
32
38
|
value = _ref.value,
|
|
33
39
|
nodes = _ref.nodes,
|
|
@@ -35,14 +41,39 @@ var BaseRichTextEditor = function BaseRichTextEditor(_ref) {
|
|
|
35
41
|
children = _ref.children,
|
|
36
42
|
onBlur = _ref.onBlur,
|
|
37
43
|
focus = _ref.focus,
|
|
44
|
+
styles = _ref.styles,
|
|
38
45
|
width = _ref.width,
|
|
39
|
-
height = _ref.height
|
|
40
|
-
|
|
46
|
+
height = _ref.height,
|
|
47
|
+
theme = _ref.theme,
|
|
48
|
+
themeEmotionMap = _ref.themeEmotionMap,
|
|
49
|
+
toolbarActionPlugins = _ref.toolbarActionPlugins,
|
|
50
|
+
contentEditableStyles = _ref.contentEditableStyles,
|
|
51
|
+
placeholderStyles = _ref.placeholderStyles;
|
|
52
|
+
var editorTheme = (0, _react.useRef)((0, _lexicalTheme.createTheme)());
|
|
53
|
+
var config = (0, _LexicalEditorConfig.useLexicalEditorConfig)();
|
|
54
|
+
var _useSharedHistoryCont = (0, _SharedHistoryContext.useSharedHistoryContext)(),
|
|
55
|
+
historyState = _useSharedHistoryCont.historyState;
|
|
56
|
+
var placeholderElem = /*#__PURE__*/_react.default.createElement(_Placeholder.Placeholder, {
|
|
57
|
+
styles: placeholderStyles
|
|
58
|
+
}, placeholder || "Enter text...");
|
|
41
59
|
var scrollRef = (0, _react.useRef)(null);
|
|
42
60
|
var _useState = (0, _react.useState)(undefined),
|
|
43
61
|
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
44
62
|
floatingAnchorElem = _useState2[0],
|
|
45
63
|
setFloatingAnchorElem = _useState2[1];
|
|
64
|
+
var _useRichTextEditor = (0, _useRichTextEditor2.useRichTextEditor)(),
|
|
65
|
+
setTheme = _useRichTextEditor.setTheme,
|
|
66
|
+
setThemeEmotionMap = _useRichTextEditor.setThemeEmotionMap,
|
|
67
|
+
setToolbarActionPlugins = _useRichTextEditor.setToolbarActionPlugins;
|
|
68
|
+
(0, _react.useEffect)(function () {
|
|
69
|
+
setTheme(theme);
|
|
70
|
+
setThemeEmotionMap(themeEmotionMap);
|
|
71
|
+
}, [themeEmotionMap, theme]);
|
|
72
|
+
(0, _react.useEffect)(function () {
|
|
73
|
+
if (toolbarActionPlugins) {
|
|
74
|
+
setToolbarActionPlugins(toolbarActionPlugins || []);
|
|
75
|
+
}
|
|
76
|
+
}, [toolbarActionPlugins]);
|
|
46
77
|
var onRef = function onRef(_floatingAnchorElem) {
|
|
47
78
|
if (_floatingAnchorElem !== null) {
|
|
48
79
|
setFloatingAnchorElem(_floatingAnchorElem);
|
|
@@ -52,14 +83,27 @@ var BaseRichTextEditor = function BaseRichTextEditor(_ref) {
|
|
|
52
83
|
height: height || "",
|
|
53
84
|
width: width || ""
|
|
54
85
|
};
|
|
86
|
+
var configNodes = config.nodes.map(function (node) {
|
|
87
|
+
return node.node;
|
|
88
|
+
});
|
|
89
|
+
var configPlugins = config.plugins.map(function (plugin) {
|
|
90
|
+
return /*#__PURE__*/_react.default.createElement(_react.Fragment, {
|
|
91
|
+
key: plugin.name
|
|
92
|
+
}, plugin.element);
|
|
93
|
+
});
|
|
94
|
+
var editorValue = (0, _isValidLexicalData.isValidLexicalData)(value) ? value : (0, _generateInitialLexicalValue.generateInitialLexicalValue)();
|
|
55
95
|
var initialConfig = {
|
|
56
|
-
|
|
96
|
+
// We update the state via the `<LexicalUpdateStatePlugin/>`.
|
|
97
|
+
editorState: null,
|
|
57
98
|
namespace: "webiny",
|
|
58
|
-
onError: function onError(
|
|
59
|
-
|
|
99
|
+
onError: function onError() {
|
|
100
|
+
// Ignore errors. We don't want to break the app because of errors caused by config/value updates.
|
|
101
|
+
// These are usually resolved in the next component render cycle.
|
|
60
102
|
},
|
|
61
|
-
nodes: [].concat((0, _toConsumableArray2.default)(
|
|
62
|
-
theme:
|
|
103
|
+
nodes: [].concat((0, _toConsumableArray2.default)(_lexicalNodes.allNodes), (0, _toConsumableArray2.default)(configNodes), (0, _toConsumableArray2.default)(nodes || [])),
|
|
104
|
+
theme: (0, _objectSpread2.default)((0, _objectSpread2.default)({}, editorTheme.current), {}, {
|
|
105
|
+
emotionMap: themeEmotionMap
|
|
106
|
+
})
|
|
63
107
|
};
|
|
64
108
|
function handleOnChange(editorState, editor) {
|
|
65
109
|
editorState.read(function () {
|
|
@@ -69,39 +113,64 @@ var BaseRichTextEditor = function BaseRichTextEditor(_ref) {
|
|
|
69
113
|
}
|
|
70
114
|
});
|
|
71
115
|
}
|
|
72
|
-
return
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
className
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
116
|
+
return (
|
|
117
|
+
/*#__PURE__*/
|
|
118
|
+
/**
|
|
119
|
+
* Once the LexicalComposer is mounted, it caches the `initialConfig` internally, and all future
|
|
120
|
+
* updates to the config will be ignored. This is a problem because we pull in Nodes from our config,
|
|
121
|
+
* and initially, there can be multiple re-renders, while the config object is settled.
|
|
122
|
+
*
|
|
123
|
+
* To bypass this issue, we generate a naive `key` based on the number of Nodes.
|
|
124
|
+
*/
|
|
125
|
+
_react.default.createElement(_LexicalComposer.LexicalComposer, {
|
|
126
|
+
initialConfig: initialConfig,
|
|
127
|
+
key: initialConfig.nodes.length
|
|
128
|
+
}, /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, staticToolbar && staticToolbar, /*#__PURE__*/_react.default.createElement("div", {
|
|
129
|
+
/* This className is necessary for targeting of editor container from CSS files. */
|
|
130
|
+
className: "editor-shell",
|
|
131
|
+
ref: scrollRef,
|
|
132
|
+
style: (0, _objectSpread2.default)((0, _objectSpread2.default)((0, _objectSpread2.default)({}, styles), sizeStyle), {}, {
|
|
133
|
+
overflow: "auto",
|
|
134
|
+
position: "relative"
|
|
135
|
+
})
|
|
136
|
+
}, /*#__PURE__*/_react.default.createElement(_LexicalOnChangePlugin.OnChangePlugin, {
|
|
137
|
+
onChange: handleOnChange
|
|
138
|
+
}), /*#__PURE__*/_react.default.createElement(_LexicalUpdateStatePlugin.UpdateStatePlugin, {
|
|
139
|
+
value: editorValue
|
|
140
|
+
}), /*#__PURE__*/_react.default.createElement(_LexicalClearEditorPlugin.ClearEditorPlugin, null), /*#__PURE__*/_react.default.createElement(_LexicalHistoryPlugin.HistoryPlugin, {
|
|
141
|
+
externalHistoryState: historyState
|
|
142
|
+
}), onBlur && /*#__PURE__*/_react.default.createElement(_BlurEventPlugin.BlurEventPlugin, {
|
|
143
|
+
onBlur: onBlur
|
|
144
|
+
}), focus && /*#__PURE__*/_react.default.createElement(_LexicalAutoFocusPlugin.AutoFocusPlugin, null), configPlugins, children, /*#__PURE__*/_react.default.createElement(_LexicalRichTextPlugin.RichTextPlugin, {
|
|
145
|
+
contentEditable: /*#__PURE__*/_react.default.createElement("div", {
|
|
146
|
+
className: "editor-scroller",
|
|
147
|
+
style: (0, _objectSpread2.default)({}, sizeStyle)
|
|
148
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
149
|
+
className: "editor",
|
|
150
|
+
ref: onRef
|
|
151
|
+
}, /*#__PURE__*/_react.default.createElement(_LexicalContentEditable.ContentEditable, {
|
|
152
|
+
style: (0, _objectSpread2.default)({
|
|
153
|
+
outline: 0
|
|
154
|
+
}, contentEditableStyles)
|
|
155
|
+
}))),
|
|
156
|
+
placeholder: placeholderElem,
|
|
157
|
+
ErrorBoundary: _LexicalErrorBoundary.default
|
|
158
|
+
}), floatingAnchorElem && toolbar)))
|
|
159
|
+
);
|
|
99
160
|
};
|
|
100
161
|
|
|
101
162
|
/**
|
|
102
163
|
* @description Main editor container
|
|
103
164
|
*/
|
|
104
165
|
var RichTextEditor = (0, _reactComposition.makeComposable)("RichTextEditor", function (props) {
|
|
105
|
-
return /*#__PURE__*/_react.default.createElement(_RichTextEditorContext.RichTextEditorProvider, null, /*#__PURE__*/_react.default.createElement(
|
|
166
|
+
return /*#__PURE__*/_react.default.createElement(_LexicalEditorConfig.LexicalEditorWithConfig, null, /*#__PURE__*/_react.default.createElement(_RichTextEditorContext.RichTextEditorProvider, null, /*#__PURE__*/_react.default.createElement(_react2.ClassNames, null, function (_ref2) {
|
|
167
|
+
var css = _ref2.css;
|
|
168
|
+
var themeEmotionMap = props?.themeEmotionMap ?? (0, _lexicalTheme.toTypographyEmotionMap)(css, props.theme, props.themeStylesTransformer);
|
|
169
|
+
return /*#__PURE__*/_react.default.createElement(_SharedHistoryContext.SharedHistoryContext, null, /*#__PURE__*/_react.default.createElement(BaseRichTextEditor, Object.assign({}, props, {
|
|
170
|
+
themeEmotionMap: themeEmotionMap
|
|
171
|
+
})));
|
|
172
|
+
})));
|
|
106
173
|
});
|
|
107
|
-
exports.RichTextEditor = RichTextEditor;
|
|
174
|
+
exports.RichTextEditor = RichTextEditor;
|
|
175
|
+
|
|
176
|
+
//# sourceMappingURL=RichTextEditor.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_react","_interopRequireWildcard","require","_Placeholder","_generateInitialLexicalValue","_webinyNodes","_webinyLexicalTheme","_LexicalComposer","_LexicalOnChangePlugin","_LexicalAutoFocusPlugin","_LexicalClearEditorPlugin","_LexicalRichTextPlugin","_LexicalErrorBoundary","_interopRequireDefault","_reactComposition","_LexicalContentEditable","_RichTextEditorContext","_isValidLexicalData","_LexicalUpdateStatePlugin","_BlurEventPlugin","BaseRichTextEditor","_ref","toolbar","onChange","value","nodes","placeholder","children","onBlur","focus","width","height","placeholderElem","default","createElement","Placeholder","scrollRef","useRef","_useState","useState","undefined","_useState2","_slicedToArray2","floatingAnchorElem","setFloatingAnchorElem","onRef","_floatingAnchorElem","sizeStyle","initialConfig","editorState","isValidLexicalData","generateInitialLexicalValue","namespace","onError","error","concat","_toConsumableArray2","WebinyNodes","theme","handleOnChange","editor","read","getEditorState","JSON","stringify","toJSON","LexicalComposer","ref","style","_objectSpread2","OnChangePlugin","LexicalUpdateStatePlugin","ClearEditorPlugin","BlurEventPlugin","AutoFocusPlugin","RichTextPlugin","contentEditable","className","ContentEditable","outline","ErrorBoundary","LexicalErrorBoundary","RichTextEditor","makeComposable","props","RichTextEditorProvider","exports"],"sources":["RichTextEditor.tsx"],"sourcesContent":["import React, { useRef, useState } from \"react\";\nimport { LexicalValue } from \"~/types\";\nimport { Placeholder } from \"~/ui/Placeholder\";\nimport { generateInitialLexicalValue } from \"~/utils/generateInitialLexicalValue\";\nimport { WebinyNodes } from \"~/nodes/webinyNodes\";\nimport { theme } from \"~/themes/webinyLexicalTheme\";\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\";\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\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}: RichTextEditorProps) => {\n const placeholderElem = <Placeholder>{placeholder || \"Enter text...\"}</Placeholder>;\n const scrollRef = useRef(null);\n const [floatingAnchorElem, setFloatingAnchorElem] = useState<HTMLElement | undefined>(\n undefined\n );\n\n const onRef = (_floatingAnchorElem: HTMLDivElement) => {\n if (_floatingAnchorElem !== null) {\n setFloatingAnchorElem(_floatingAnchorElem);\n }\n };\n\n const sizeStyle = {\n height: height || \"\",\n width: width || \"\"\n };\n\n const initialConfig = {\n editorState: isValidLexicalData(value) ? value : generateInitialLexicalValue(),\n namespace: \"webiny\",\n onError: (error: Error) => {\n throw error;\n },\n nodes: [...WebinyNodes, ...(nodes || [])],\n theme: theme\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 <div ref={scrollRef} style={{ ...sizeStyle }}>\n {/* data */}\n <OnChangePlugin onChange={handleOnChange} />\n {value && <LexicalUpdateStatePlugin value={value} />}\n <ClearEditorPlugin />\n {/* Events */}\n {onBlur && <BlurEventPlugin onBlur={onBlur} />}\n {focus && <AutoFocusPlugin />}\n {/* External plugins and components */}\n {children}\n <RichTextPlugin\n contentEditable={\n <div className=\"editor-scroller\" style={{ ...sizeStyle }}>\n <div className=\"editor\" ref={onRef} style={{ ...sizeStyle }}>\n <ContentEditable style={{ outline: 0, ...sizeStyle }} />\n </div>\n </div>\n }\n placeholder={placeholderElem}\n ErrorBoundary={LexicalErrorBoundary}\n />\n {/* Toolbar */}\n {floatingAnchorElem && toolbar}\n </div>\n </LexicalComposer>\n );\n};\n\n/**\n * @description Main editor container\n */\nexport const RichTextEditor = makeComposable<RichTextEditorProps>(\"RichTextEditor\", props => {\n return (\n <RichTextEditorProvider>\n <BaseRichTextEditor {...props} />\n </RichTextEditorProvider>\n );\n});\n"],"mappings":";;;;;;;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AAEA,IAAAC,YAAA,GAAAD,OAAA;AACA,IAAAE,4BAAA,GAAAF,OAAA;AACA,IAAAG,YAAA,GAAAH,OAAA;AACA,IAAAI,mBAAA,GAAAJ,OAAA;AAGA,IAAAK,gBAAA,GAAAL,OAAA;AACA,IAAAM,sBAAA,GAAAN,OAAA;AACA,IAAAO,uBAAA,GAAAP,OAAA;AACA,IAAAQ,yBAAA,GAAAR,OAAA;AACA,IAAAS,sBAAA,GAAAT,OAAA;AACA,IAAAU,qBAAA,GAAAC,sBAAA,CAAAX,OAAA;AACA,IAAAY,iBAAA,GAAA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,cAAA"}
|
|
1
|
+
{"version":3,"names":["_react","_interopRequireWildcard","require","_react2","_LexicalComposer","_LexicalOnChangePlugin","_LexicalAutoFocusPlugin","_LexicalClearEditorPlugin","_LexicalRichTextPlugin","_LexicalErrorBoundary","_interopRequireDefault","_reactComposition","_LexicalHistoryPlugin","_LexicalContentEditable","_RichTextEditorContext","_isValidLexicalData","_LexicalUpdateStatePlugin","_BlurEventPlugin","_Placeholder","_generateInitialLexicalValue","_lexicalTheme","_lexicalNodes","_SharedHistoryContext","_useRichTextEditor2","_LexicalEditorConfig","BaseRichTextEditor","_ref","toolbar","staticToolbar","onChange","value","nodes","placeholder","children","onBlur","focus","styles","width","height","theme","themeEmotionMap","toolbarActionPlugins","contentEditableStyles","placeholderStyles","editorTheme","useRef","createTheme","config","useLexicalEditorConfig","_useSharedHistoryCont","useSharedHistoryContext","historyState","placeholderElem","default","createElement","Placeholder","scrollRef","_useState","useState","undefined","_useState2","_slicedToArray2","floatingAnchorElem","setFloatingAnchorElem","_useRichTextEditor","useRichTextEditor","setTheme","setThemeEmotionMap","setToolbarActionPlugins","useEffect","onRef","_floatingAnchorElem","sizeStyle","configNodes","map","node","configPlugins","plugins","plugin","Fragment","key","name","element","editorValue","isValidLexicalData","generateInitialLexicalValue","initialConfig","editorState","namespace","onError","concat","_toConsumableArray2","allNodes","_objectSpread2","current","emotionMap","handleOnChange","editor","read","getEditorState","JSON","stringify","toJSON","LexicalComposer","length","className","ref","style","overflow","position","OnChangePlugin","UpdateStatePlugin","ClearEditorPlugin","HistoryPlugin","externalHistoryState","BlurEventPlugin","AutoFocusPlugin","RichTextPlugin","contentEditable","ContentEditable","outline","ErrorBoundary","LexicalErrorBoundary","RichTextEditor","makeComposable","props","LexicalEditorWithConfig","RichTextEditorProvider","ClassNames","_ref2","css","toTypographyEmotionMap","themeStylesTransformer","SharedHistoryContext","Object","assign","exports"],"sources":["RichTextEditor.tsx"],"sourcesContent":["import React, { Fragment, useEffect, useRef, useState } from \"react\";\nimport { ClassNames, CSSObject } from \"@emotion/react\";\nimport { Klass, LexicalEditor, LexicalNode } from \"lexical\";\nimport { EditorState } from \"lexical/LexicalEditorState\";\nimport { LexicalComposer } from \"@lexical/react/LexicalComposer\";\nimport { OnChangePlugin } from \"@lexical/react/LexicalOnChangePlugin\";\nimport { AutoFocusPlugin } from \"@lexical/react/LexicalAutoFocusPlugin\";\nimport { ClearEditorPlugin } from \"@lexical/react/LexicalClearEditorPlugin\";\nimport { RichTextPlugin } from \"@lexical/react/LexicalRichTextPlugin\";\nimport LexicalErrorBoundary from \"@lexical/react/LexicalErrorBoundary\";\nimport { makeComposable } from \"@webiny/react-composition\";\nimport { HistoryPlugin } from \"@lexical/react/LexicalHistoryPlugin\";\nimport { ContentEditable } from \"@lexical/react/LexicalContentEditable\";\nimport { RichTextEditorProvider } from \"~/context/RichTextEditorContext\";\nimport { isValidLexicalData } from \"~/utils/isValidLexicalData\";\nimport { UpdateStatePlugin } from \"~/plugins/LexicalUpdateStatePlugin\";\nimport { BlurEventPlugin } from \"~/plugins/BlurEventPlugin/BlurEventPlugin\";\nimport { LexicalValue, ToolbarActionPlugin } from \"~/types\";\nimport { Placeholder } from \"~/ui/Placeholder\";\nimport { generateInitialLexicalValue } from \"~/utils/generateInitialLexicalValue\";\nimport {\n createTheme,\n WebinyTheme,\n ThemeEmotionMap,\n toTypographyEmotionMap\n} from \"@webiny/lexical-theme\";\nimport { allNodes } from \"@webiny/lexical-nodes\";\nimport { SharedHistoryContext, useSharedHistoryContext } from \"~/context/SharedHistoryContext\";\nimport { useRichTextEditor } from \"~/hooks/useRichTextEditor\";\nimport {\n LexicalEditorWithConfig,\n useLexicalEditorConfig\n} from \"~/components/LexicalEditorConfig/LexicalEditorConfig\";\n\nexport interface RichTextEditorProps {\n children?: React.ReactNode | React.ReactNode[];\n classes?: string;\n contentEditableStyles?: React.CSSProperties;\n focus?: boolean;\n height?: number | string;\n nodes?: Klass<LexicalNode>[];\n onBlur?: (editorState: LexicalValue) => void;\n onChange?: (json: LexicalValue) => void;\n placeholder?: string;\n placeholderStyles?: React.CSSProperties;\n staticToolbar?: React.ReactNode;\n styles?: React.CSSProperties;\n tag?: string;\n theme: WebinyTheme;\n themeEmotionMap?: ThemeEmotionMap;\n themeStylesTransformer?: (cssObject: Record<string, any>) => CSSObject;\n toolbar?: React.ReactNode;\n toolbarActionPlugins?: ToolbarActionPlugin[];\n value: LexicalValue | null;\n width?: number | string;\n}\n\nconst BaseRichTextEditor = ({\n toolbar,\n staticToolbar,\n onChange,\n value,\n nodes,\n placeholder,\n children,\n onBlur,\n focus,\n styles,\n width,\n height,\n theme,\n themeEmotionMap,\n toolbarActionPlugins,\n contentEditableStyles,\n placeholderStyles\n}: RichTextEditorProps) => {\n const editorTheme = useRef(createTheme());\n const config = useLexicalEditorConfig();\n const { historyState } = useSharedHistoryContext();\n const placeholderElem = (\n <Placeholder styles={placeholderStyles}>{placeholder || \"Enter text...\"}</Placeholder>\n );\n const scrollRef = useRef(null);\n const [floatingAnchorElem, setFloatingAnchorElem] = useState<HTMLElement | undefined>(\n undefined\n );\n const { setTheme, setThemeEmotionMap, setToolbarActionPlugins } = useRichTextEditor();\n\n useEffect(() => {\n setTheme(theme);\n setThemeEmotionMap(themeEmotionMap);\n }, [themeEmotionMap, theme]);\n\n useEffect(() => {\n if (toolbarActionPlugins) {\n setToolbarActionPlugins(toolbarActionPlugins || []);\n }\n }, [toolbarActionPlugins]);\n\n const onRef = (_floatingAnchorElem: HTMLDivElement) => {\n if (_floatingAnchorElem !== null) {\n setFloatingAnchorElem(_floatingAnchorElem);\n }\n };\n\n const sizeStyle = {\n height: height || \"\",\n width: width || \"\"\n };\n\n const configNodes = config.nodes.map(node => node.node);\n const configPlugins = config.plugins.map(plugin => (\n <Fragment key={plugin.name}>{plugin.element}</Fragment>\n ));\n\n const editorValue = isValidLexicalData(value) ? value : generateInitialLexicalValue();\n\n const initialConfig = {\n // We update the state via the `<LexicalUpdateStatePlugin/>`.\n editorState: null,\n namespace: \"webiny\",\n onError: () => {\n // Ignore errors. We don't want to break the app because of errors caused by config/value updates.\n // These are usually resolved in the next component render cycle.\n },\n nodes: [...allNodes, ...configNodes, ...(nodes || [])],\n theme: { ...editorTheme.current, emotionMap: themeEmotionMap }\n };\n\n function handleOnChange(editorState: EditorState, editor: LexicalEditor) {\n editorState.read(() => {\n if (typeof onChange === \"function\") {\n const editorState = editor.getEditorState();\n onChange(JSON.stringify(editorState.toJSON()));\n }\n });\n }\n\n return (\n /**\n * Once the LexicalComposer is mounted, it caches the `initialConfig` internally, and all future\n * updates to the config will be ignored. This is a problem because we pull in Nodes from our config,\n * and initially, there can be multiple re-renders, while the config object is settled.\n *\n * To bypass this issue, we generate a naive `key` based on the number of Nodes.\n */\n <LexicalComposer initialConfig={initialConfig} key={initialConfig.nodes.length}>\n <>\n {staticToolbar && staticToolbar}\n <div\n /* This className is necessary for targeting of editor container from CSS files. */\n className={\"editor-shell\"}\n ref={scrollRef}\n style={{ ...styles, ...sizeStyle, overflow: \"auto\", position: \"relative\" }}\n >\n {/* data */}\n <OnChangePlugin onChange={handleOnChange} />\n <UpdateStatePlugin value={editorValue} />\n <ClearEditorPlugin />\n <HistoryPlugin externalHistoryState={historyState} />\n {/* Events */}\n {onBlur && <BlurEventPlugin onBlur={onBlur} />}\n {focus && <AutoFocusPlugin />}\n {/* External plugins and components */}\n {configPlugins}\n {children}\n <RichTextPlugin\n contentEditable={\n <div className=\"editor-scroller\" style={{ ...sizeStyle }}>\n <div className=\"editor\" ref={onRef}>\n <ContentEditable\n style={{ outline: 0, ...contentEditableStyles }}\n />\n </div>\n </div>\n }\n placeholder={placeholderElem}\n ErrorBoundary={LexicalErrorBoundary}\n />\n {/* Toolbar */}\n {floatingAnchorElem && toolbar}\n </div>\n </>\n </LexicalComposer>\n );\n};\n\n/**\n * @description Main editor container\n */\nexport const RichTextEditor = makeComposable<RichTextEditorProps>(\"RichTextEditor\", props => {\n return (\n <LexicalEditorWithConfig>\n <RichTextEditorProvider>\n <ClassNames>\n {({ css }) => {\n const themeEmotionMap =\n props?.themeEmotionMap ??\n toTypographyEmotionMap(css, props.theme, props.themeStylesTransformer);\n return (\n <SharedHistoryContext>\n <BaseRichTextEditor {...props} themeEmotionMap={themeEmotionMap} />\n </SharedHistoryContext>\n );\n }}\n </ClassNames>\n </RichTextEditorProvider>\n </LexicalEditorWithConfig>\n );\n});\n"],"mappings":";;;;;;;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AAGA,IAAAE,gBAAA,GAAAF,OAAA;AACA,IAAAG,sBAAA,GAAAH,OAAA;AACA,IAAAI,uBAAA,GAAAJ,OAAA;AACA,IAAAK,yBAAA,GAAAL,OAAA;AACA,IAAAM,sBAAA,GAAAN,OAAA;AACA,IAAAO,qBAAA,GAAAC,sBAAA,CAAAR,OAAA;AACA,IAAAS,iBAAA,GAAAT,OAAA;AACA,IAAAU,qBAAA,GAAAV,OAAA;AACA,IAAAW,uBAAA,GAAAX,OAAA;AACA,IAAAY,sBAAA,GAAAZ,OAAA;AACA,IAAAa,mBAAA,GAAAb,OAAA;AACA,IAAAc,yBAAA,GAAAd,OAAA;AACA,IAAAe,gBAAA,GAAAf,OAAA;AAEA,IAAAgB,YAAA,GAAAhB,OAAA;AACA,IAAAiB,4BAAA,GAAAjB,OAAA;AACA,IAAAkB,aAAA,GAAAlB,OAAA;AAMA,IAAAmB,aAAA,GAAAnB,OAAA;AACA,IAAAoB,qBAAA,GAAApB,OAAA;AACA,IAAAqB,mBAAA,GAAArB,OAAA;AACA,IAAAsB,oBAAA,GAAAtB,OAAA;AA4BA,IAAMuB,kBAAkB,GAAG,SAArBA,kBAAkBA,CAAAC,IAAA,EAkBG;EAAA,IAjBvBC,OAAO,GAAAD,IAAA,CAAPC,OAAO;IACPC,aAAa,GAAAF,IAAA,CAAbE,aAAa;IACbC,QAAQ,GAAAH,IAAA,CAARG,QAAQ;IACRC,KAAK,GAA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qB;MAAG,CACnD,CACA,CACJ,CACR;MACDV,WAAW,EAAEoB,eAAgB;MAC7BqE,aAAa,EAAEC;IAAqB,CACvC,CAAC,EAED5D,kBAAkB,IAAInC,OACtB,CACP,CACW;EAAC;AAE1B,CAAC;;AAED;AACA;AACA;AACO,IAAMgG,cAAc,GAAG,IAAAC,gCAAc,EAAsB,gBAAgB,EAAE,UAAAC,KAAK,EAAI;EACzF,oBACI7H,MAAA,CAAAqD,OAAA,CAAAC,aAAA,CAAC9B,oBAAA,CAAAsG,uBAAuB,qBACpB9H,MAAA,CAAAqD,OAAA,CAAAC,aAAA,CAACxC,sBAAA,CAAAiH,sBAAsB,qBACnB/H,MAAA,CAAAqD,OAAA,CAAAC,aAAA,CAACnD,OAAA,CAAA6H,UAAU,QACN,UAAAC,KAAA,EAAa;IAAA,IAAVC,GAAG,GAAAD,KAAA,CAAHC,GAAG;IACH,IAAM1F,eAAe,GACjBqF,KAAK,EAAErF,eAAe,IACtB,IAAA2F,oCAAsB,EAACD,GAAG,EAAEL,KAAK,CAACtF,KAAK,EAAEsF,KAAK,CAACO,sBAAsB,CAAC;IAC1E,oBACIpI,MAAA,CAAAqD,OAAA,CAAAC,aAAA,CAAChC,qBAAA,CAAA+G,oBAAoB,qBACjBrI,MAAA,CAAAqD,OAAA,CAAAC,aAAA,CAAC7B,kBAAkB,EAAA6G,MAAA,CAAAC,MAAA,KAAKV,KAAK;MAAErF,eAAe,EAAEA;IAAgB,EAAE,CAChD,CAAC;EAE/B,CACQ,CACQ,CACH,CAAC;AAElC,CAAC,CAAC;AAACgG,OAAA,CAAAb,cAAA,GAAAA,cAAA"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { ToolbarElementConfig } from "./components/ToolbarElement";
|
|
3
|
+
import { PluginConfig } from "./components/Plugin";
|
|
4
|
+
import { NodeConfig } from "./components/Node";
|
|
5
|
+
export declare const LexicalEditorConfig: {
|
|
6
|
+
({ children }: {
|
|
7
|
+
children: React.ReactNode;
|
|
8
|
+
}): JSX.Element;
|
|
9
|
+
ToolbarElement: ({ name, element, after, before, remove }: import("./components/ToolbarElement").ToolbarElementProps) => JSX.Element;
|
|
10
|
+
Plugin: ({ name, element, after, before, remove }: import("./components/Plugin").PluginProps) => JSX.Element;
|
|
11
|
+
Node: ({ name, node, after, before, remove }: import("./components/Node").NodeProps) => JSX.Element;
|
|
12
|
+
};
|
|
13
|
+
export declare const LexicalEditorWithConfig: ({ children }: {
|
|
14
|
+
children: React.ReactNode;
|
|
15
|
+
}) => JSX.Element;
|
|
16
|
+
export declare function useLexicalEditorConfig(): {
|
|
17
|
+
toolbarElements: ToolbarElementConfig[];
|
|
18
|
+
plugins: PluginConfig[];
|
|
19
|
+
nodes: NodeConfig[];
|
|
20
|
+
};
|