@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.
- package/commands/image.js +2 -8
- package/commands/image.js.map +1 -1
- package/commands/index.js +4 -49
- package/commands/index.js.map +1 -1
- package/commands/list.js +4 -10
- package/commands/list.js.map +1 -1
- package/commands/quote.js +2 -8
- package/commands/quote.js.map +1 -1
- package/commands/toolbar.js +2 -8
- package/commands/toolbar.js.map +1 -1
- package/components/Editor/EnsureHeadingTagPlugin.js +10 -16
- package/components/Editor/EnsureHeadingTagPlugin.js.map +1 -1
- package/components/Editor/HeadingEditor.js +13 -21
- package/components/Editor/HeadingEditor.js.map +1 -1
- package/components/Editor/ParagraphEditor.js +12 -19
- package/components/Editor/ParagraphEditor.js.map +1 -1
- package/components/Editor/RichTextEditor.js +92 -105
- package/components/Editor/RichTextEditor.js.map +1 -1
- package/components/Editor/normalizeInputValue.js +2 -8
- package/components/Editor/normalizeInputValue.js.map +1 -1
- package/components/LexicalEditorConfig/LexicalEditorConfig.js +39 -49
- package/components/LexicalEditorConfig/LexicalEditorConfig.js.map +1 -1
- package/components/LexicalEditorConfig/components/Node.js +17 -26
- package/components/LexicalEditorConfig/components/Node.js.map +1 -1
- package/components/LexicalEditorConfig/components/Plugin.js +17 -26
- package/components/LexicalEditorConfig/components/Plugin.js.map +1 -1
- package/components/LexicalEditorConfig/components/ToolbarElement.js +17 -26
- package/components/LexicalEditorConfig/components/ToolbarElement.js.map +1 -1
- package/components/LexicalHtmlRenderer.js +37 -46
- package/components/LexicalHtmlRenderer.js.map +1 -1
- package/components/Toolbar/StaticToolbar.d.ts +3 -1
- package/components/Toolbar/StaticToolbar.js +19 -23
- package/components/Toolbar/StaticToolbar.js.map +1 -1
- package/components/Toolbar/Toolbar.js +66 -75
- package/components/Toolbar/Toolbar.js.map +1 -1
- package/components/ToolbarActions/BoldAction.js +16 -21
- package/components/ToolbarActions/BoldAction.js.map +1 -1
- package/components/ToolbarActions/BulletListAction.js +26 -31
- package/components/ToolbarActions/BulletListAction.js.map +1 -1
- package/components/ToolbarActions/CodeHighlightAction.js +16 -21
- package/components/ToolbarActions/CodeHighlightAction.js.map +1 -1
- package/components/ToolbarActions/FontColorAction.js +32 -42
- package/components/ToolbarActions/FontColorAction.js.map +1 -1
- package/components/ToolbarActions/FontSizeAction.js +53 -71
- package/components/ToolbarActions/FontSizeAction.js.map +1 -1
- package/components/ToolbarActions/ImageAction.js +19 -34
- package/components/ToolbarActions/ImageAction.js.map +1 -1
- package/components/ToolbarActions/ItalicAction.js +16 -21
- package/components/ToolbarActions/ItalicAction.js.map +1 -1
- package/components/ToolbarActions/LinkAction.js +19 -24
- package/components/ToolbarActions/LinkAction.js.map +1 -1
- package/components/ToolbarActions/NumberedListAction.js +26 -33
- package/components/ToolbarActions/NumberedListAction.js.map +1 -1
- package/components/ToolbarActions/QuoteAction.js +20 -25
- package/components/ToolbarActions/QuoteAction.js.map +1 -1
- package/components/ToolbarActions/TextAlignmentAction.js +36 -45
- package/components/ToolbarActions/TextAlignmentAction.js.map +1 -1
- package/components/ToolbarActions/TypographyAction.js +43 -55
- package/components/ToolbarActions/TypographyAction.js.map +1 -1
- package/components/ToolbarActions/UnderlineAction.js +16 -21
- package/components/ToolbarActions/UnderlineAction.js.map +1 -1
- package/context/FontColorActionContext.js +2 -9
- package/context/FontColorActionContext.js.map +1 -1
- package/context/RichTextEditorContext.js +15 -26
- package/context/RichTextEditorContext.js.map +1 -1
- package/context/SharedHistoryContext.js +12 -20
- package/context/SharedHistoryContext.js.map +1 -1
- package/context/TextAlignmentActionContextProps.js +2 -9
- package/context/TextAlignmentActionContextProps.js.map +1 -1
- package/context/TypographyActionContext.js +2 -9
- package/context/TypographyActionContext.js.map +1 -1
- package/hooks/index.js +8 -93
- package/hooks/index.js.map +1 -1
- package/hooks/useCurrentElement.d.ts +2 -2
- package/hooks/useCurrentElement.js +12 -18
- package/hooks/useCurrentElement.js.map +1 -1
- package/hooks/useCurrentSelection.js +27 -40
- package/hooks/useCurrentSelection.js.map +1 -1
- package/hooks/useFontColorPicker.js +5 -11
- package/hooks/useFontColorPicker.js.map +1 -1
- package/hooks/useIsMounted.js +6 -14
- package/hooks/useIsMounted.js.map +1 -1
- package/hooks/useList.js +31 -35
- package/hooks/useList.js.map +1 -1
- package/hooks/useQuote.js +12 -17
- package/hooks/useQuote.js.map +1 -1
- package/hooks/useRichTextEditor.js +5 -11
- package/hooks/useRichTextEditor.js.map +1 -1
- package/hooks/useTextAlignmentAction.js +5 -11
- package/hooks/useTextAlignmentAction.js.map +1 -1
- package/hooks/useTypographyAction.js +5 -11
- package/hooks/useTypographyAction.js.map +1 -1
- package/index.js +49 -322
- package/index.js.map +1 -1
- package/package.json +8 -7
- package/plugins/BlurEventPlugin/BlurEventPlugin.js +16 -22
- package/plugins/BlurEventPlugin/BlurEventPlugin.js.map +1 -1
- package/plugins/CodeHighlightPlugin/CodeHighlightPlugin.js +9 -14
- package/plugins/CodeHighlightPlugin/CodeHighlightPlugin.js.map +1 -1
- package/plugins/CodeHighlightPlugin/index.js +1 -16
- package/plugins/CodeHighlightPlugin/index.js.map +1 -1
- package/plugins/FloatingLinkEditorPlugin/FloatingLinkEditor.d.ts +16 -0
- package/plugins/FloatingLinkEditorPlugin/FloatingLinkEditor.js +158 -0
- package/plugins/FloatingLinkEditorPlugin/FloatingLinkEditor.js.map +1 -0
- package/plugins/FloatingLinkEditorPlugin/FloatingLinkEditorController.d.ts +8 -0
- package/plugins/FloatingLinkEditorPlugin/FloatingLinkEditorController.js +62 -0
- package/plugins/FloatingLinkEditorPlugin/FloatingLinkEditorController.js.map +1 -0
- package/plugins/FloatingLinkEditorPlugin/FloatingLinkEditorPlugin.css +2 -1
- package/plugins/FloatingLinkEditorPlugin/FloatingLinkEditorPlugin.d.ts +5 -16
- package/plugins/FloatingLinkEditorPlugin/FloatingLinkEditorPlugin.js +11 -180
- package/plugins/FloatingLinkEditorPlugin/FloatingLinkEditorPlugin.js.map +1 -1
- package/plugins/FloatingLinkEditorPlugin/LinkEditForm.d.ts +2 -3
- package/plugins/FloatingLinkEditorPlugin/LinkEditForm.js +54 -68
- package/plugins/FloatingLinkEditorPlugin/LinkEditForm.js.map +1 -1
- package/plugins/FloatingLinkEditorPlugin/LinkPreviewForm.d.ts +1 -1
- package/plugins/FloatingLinkEditorPlugin/LinkPreviewForm.js +16 -26
- package/plugins/FloatingLinkEditorPlugin/LinkPreviewForm.js.map +1 -1
- package/plugins/FloatingLinkEditorPlugin/index.js +1 -16
- package/plugins/FloatingLinkEditorPlugin/index.js.map +1 -1
- package/plugins/FloatingLinkEditorPlugin/isChildOfLinkEditor.js +3 -9
- package/plugins/FloatingLinkEditorPlugin/isChildOfLinkEditor.js.map +1 -1
- package/plugins/FontColorPlugin/FontColorPlugin.js +19 -22
- package/plugins/FontColorPlugin/FontColorPlugin.js.map +1 -1
- package/plugins/FontColorPlugin/applyColorToNode.js +4 -10
- package/plugins/FontColorPlugin/applyColorToNode.js.map +1 -1
- package/plugins/FontColorPlugin/applyColorToSelection.js +28 -44
- package/plugins/FontColorPlugin/applyColorToSelection.js.map +1 -1
- package/plugins/ImagesPlugin/ImagesPlugin.js +59 -58
- package/plugins/ImagesPlugin/ImagesPlugin.js.map +1 -1
- package/plugins/LexicalUpdateStatePlugin/UpdateStatePlugin.js +23 -23
- package/plugins/LexicalUpdateStatePlugin/UpdateStatePlugin.js.map +1 -1
- package/plugins/LexicalUpdateStatePlugin/index.js +1 -16
- package/plugins/LexicalUpdateStatePlugin/index.js.map +1 -1
- package/plugins/LinkPlugin/LinkPlugin.js +30 -37
- package/plugins/LinkPlugin/LinkPlugin.js.map +1 -1
- package/plugins/ListPLugin/ListPlugin.js +10 -15
- package/plugins/ListPLugin/ListPlugin.js.map +1 -1
- package/plugins/QuoteNodePlugin/QuoteNodePlugin.js +11 -16
- package/plugins/QuoteNodePlugin/QuoteNodePlugin.js.map +1 -1
- package/plugins/TypographyPlugin/TypographyPlugin.js +16 -21
- package/plugins/TypographyPlugin/TypographyPlugin.js.map +1 -1
- package/types.d.ts +3 -3
- package/types.js +6 -38
- package/types.js.map +1 -1
- package/ui/ContentEditable.js +7 -14
- package/ui/ContentEditable.js.map +1 -1
- package/ui/Divider.js +3 -10
- package/ui/Divider.js.map +1 -1
- package/ui/DropDown.js +61 -88
- package/ui/DropDown.js.map +1 -1
- package/ui/ImageResizer.js +78 -83
- package/ui/ImageResizer.js.map +1 -1
- package/ui/LinkPreview.js +22 -29
- package/ui/LinkPreview.js.map +1 -1
- package/ui/Placeholder.js +10 -16
- package/ui/Placeholder.js.map +1 -1
- package/ui/TextInput.js +11 -18
- package/ui/TextInput.js.map +1 -1
- package/ui/ToolbarActionDialog.js +30 -42
- package/ui/ToolbarActionDialog.js.map +1 -1
- package/utils/canUseDOM.js +1 -7
- package/utils/canUseDOM.js.map +1 -1
- package/utils/files.js +9 -26
- package/utils/files.js.map +1 -1
- package/utils/generateInitialLexicalValue.js +2 -8
- package/utils/generateInitialLexicalValue.js.map +1 -1
- package/utils/getDOMRangeRect.js +4 -10
- package/utils/getDOMRangeRect.js.map +1 -1
- package/utils/getSelectedNode.js +9 -16
- package/utils/getSelectedNode.js.map +1 -1
- package/utils/getTransparentImage.js +1 -7
- package/utils/getTransparentImage.js.map +1 -1
- package/utils/insertImage.js +8 -14
- package/utils/insertImage.js.map +1 -1
- package/utils/isAnchorLink.js +1 -7
- package/utils/isAnchorLink.js.map +1 -1
- package/utils/isChildOfFloatingToolbar.js +3 -9
- package/utils/isChildOfFloatingToolbar.js.map +1 -1
- package/utils/isHTMLElement.js +1 -7
- package/utils/isHTMLElement.js.map +1 -1
- package/utils/isValidJSON.js +3 -9
- package/utils/isValidJSON.js.map +1 -1
- package/utils/isValidLexicalData.d.ts +1 -1
- package/utils/isValidLexicalData.js +6 -12
- package/utils/isValidLexicalData.js.map +1 -1
- package/utils/point.js +35 -60
- package/utils/point.js.map +1 -1
- package/utils/rect.js +114 -149
- package/utils/rect.js.map +1 -1
- package/utils/sanitizeUrl.js +6 -13
- package/utils/sanitizeUrl.js.map +1 -1
- package/utils/setFloatingElemPosition.js +11 -19
- package/utils/setFloatingElemPosition.js.map +1 -1
- package/plugins/FloatingLinkEditorPlugin/useFloatingLinkEditor.d.ts +0 -2
- package/plugins/FloatingLinkEditorPlugin/useFloatingLinkEditor.js +0 -96
- package/plugins/FloatingLinkEditorPlugin/useFloatingLinkEditor.js.map +0 -1
package/commands/image.js
CHANGED
|
@@ -1,10 +1,4 @@
|
|
|
1
|
-
|
|
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
|
package/commands/image.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
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
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
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
|
package/commands/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[
|
|
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
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
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
|
package/commands/list.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
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
|
-
|
|
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
|
package/commands/quote.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
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":[]}
|
package/commands/toolbar.js
CHANGED
|
@@ -1,10 +1,4 @@
|
|
|
1
|
-
|
|
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
|
package/commands/toolbar.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
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
|
-
|
|
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
|
-
|
|
16
|
-
|
|
17
|
-
editor
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
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":["
|
|
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
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
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
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
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__*/
|
|
19
|
+
}), /*#__PURE__*/React.createElement(EnsureHeadingTagPlugin, null), rest?.children);
|
|
28
20
|
};
|
|
29
21
|
|
|
30
22
|
//# sourceMappingURL=HeadingEditor.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
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
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
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
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
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":["
|
|
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
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
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
|
-
|
|
63
|
-
|
|
64
|
-
|
|
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
|
-
|
|
57
|
+
const sizeStyle = {
|
|
73
58
|
height: height || "",
|
|
74
59
|
width: width || ""
|
|
75
60
|
};
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
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:
|
|
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: [
|
|
94
|
-
theme:
|
|
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(
|
|
81
|
+
editorState.read(() => {
|
|
100
82
|
if (typeof onChange === "function") {
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
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
|
-
|
|
106
|
+
React.createElement(SharedHistoryContext, null, /*#__PURE__*/React.createElement(LexicalComposer, {
|
|
125
107
|
initialConfig: initialConfig,
|
|
126
108
|
key: initialConfig.nodes.length
|
|
127
|
-
}, /*#__PURE__*/
|
|
109
|
+
}, /*#__PURE__*/React.createElement(RichTextEditorProvider, {
|
|
128
110
|
theme: props.theme,
|
|
129
111
|
themeEmotionMap: themeEmotionMap,
|
|
130
112
|
toolbarActionPlugins: props.toolbarActionPlugins
|
|
131
|
-
}, staticToolbar ? staticToolbar : null, /*#__PURE__*/
|
|
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:
|
|
117
|
+
style: {
|
|
118
|
+
...styles,
|
|
119
|
+
...sizeStyle,
|
|
136
120
|
overflow: "auto",
|
|
137
121
|
position: "relative"
|
|
138
|
-
}
|
|
139
|
-
}, /*#__PURE__*/
|
|
122
|
+
}
|
|
123
|
+
}, /*#__PURE__*/React.createElement(OnChangePlugin, {
|
|
140
124
|
onChange: handleOnChange
|
|
141
|
-
}), /*#__PURE__*/
|
|
125
|
+
}), /*#__PURE__*/React.createElement(UpdateStatePlugin, {
|
|
142
126
|
value: editorValue
|
|
143
|
-
}), /*#__PURE__*/
|
|
127
|
+
}), /*#__PURE__*/React.createElement(ClearEditorPlugin, null), /*#__PURE__*/React.createElement(HistoryPlugin, {
|
|
144
128
|
externalHistoryState: historyState
|
|
145
|
-
}), onBlur && /*#__PURE__*/
|
|
129
|
+
}), onBlur && /*#__PURE__*/React.createElement(BlurEventPlugin, {
|
|
146
130
|
onBlur: onBlur
|
|
147
|
-
}), focus && /*#__PURE__*/
|
|
148
|
-
contentEditable: /*#__PURE__*/
|
|
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:
|
|
151
|
-
|
|
134
|
+
style: {
|
|
135
|
+
...sizeStyle
|
|
136
|
+
}
|
|
137
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
152
138
|
className: "editor",
|
|
153
139
|
ref: onRef
|
|
154
|
-
}, /*#__PURE__*/
|
|
155
|
-
style:
|
|
156
|
-
outline: 0
|
|
157
|
-
|
|
140
|
+
}, /*#__PURE__*/React.createElement(ContentEditable, {
|
|
141
|
+
style: {
|
|
142
|
+
outline: 0,
|
|
143
|
+
...contentEditableStyles
|
|
144
|
+
}
|
|
158
145
|
}))),
|
|
159
146
|
placeholder: placeholderElem,
|
|
160
|
-
ErrorBoundary:
|
|
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
|
-
|
|
169
|
-
return /*#__PURE__*/
|
|
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
|