@webiny/lexical-editor 0.0.0-unstable.1145e7667f
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/LICENSE +21 -0
- package/README.md +17 -0
- package/commands/webiny-list.d.ts +7 -0
- package/commands/webiny-list.js +13 -0
- package/commands/webiny-list.js.map +1 -0
- package/commands/webiny-quote.d.ts +5 -0
- package/commands/webiny-quote.js +9 -0
- package/commands/webiny-quote.js.map +1 -0
- package/components/AddRichTextEditorNodeType.d.ts +6 -0
- package/components/AddRichTextEditorNodeType.js +28 -0
- package/components/AddRichTextEditorNodeType.js.map +1 -0
- package/components/AddRichTextEditorPlugin.d.ts +12 -0
- package/components/AddRichTextEditorPlugin.js +33 -0
- package/components/AddRichTextEditorPlugin.js.map +1 -0
- package/components/AddToolbarAction.d.ts +7 -0
- package/components/AddToolbarAction.js +33 -0
- package/components/AddToolbarAction.js.map +1 -0
- package/components/Editor/HeadingEditor.d.ts +7 -0
- package/components/Editor/HeadingEditor.js +29 -0
- package/components/Editor/HeadingEditor.js.map +1 -0
- package/components/Editor/ParagraphEditor.d.ts +7 -0
- package/components/Editor/ParagraphEditor.js +30 -0
- package/components/Editor/ParagraphEditor.js.map +1 -0
- package/components/Editor/RichTextEditor.d.ts +26 -0
- package/components/Editor/RichTextEditor.js +138 -0
- package/components/Editor/RichTextEditor.js.map +1 -0
- package/components/LexicalEditorConfig/LexicalEditorConfig.d.ts +9 -0
- package/components/LexicalEditorConfig/LexicalEditorConfig.js +17 -0
- package/components/LexicalEditorConfig/LexicalEditorConfig.js.map +1 -0
- package/components/LexicalHtmlRenderer.d.ts +16 -0
- package/components/LexicalHtmlRenderer.js +67 -0
- package/components/LexicalHtmlRenderer.js.map +1 -0
- package/components/Toolbar/HeadingToolbar.d.ts +12 -0
- package/components/Toolbar/HeadingToolbar.js +23 -0
- package/components/Toolbar/HeadingToolbar.js.map +1 -0
- package/components/Toolbar/ParagraphToolbar.d.ts +12 -0
- package/components/Toolbar/ParagraphToolbar.js +23 -0
- package/components/Toolbar/ParagraphToolbar.js.map +1 -0
- package/components/Toolbar/Toolbar.css +423 -0
- package/components/Toolbar/Toolbar.d.ts +13 -0
- package/components/Toolbar/Toolbar.js +181 -0
- package/components/Toolbar/Toolbar.js.map +1 -0
- package/components/ToolbarActions/BoldAction.d.ts +2 -0
- package/components/ToolbarActions/BoldAction.js +43 -0
- package/components/ToolbarActions/BoldAction.js.map +1 -0
- package/components/ToolbarActions/BulletListAction.d.ts +2 -0
- package/components/ToolbarActions/BulletListAction.js +51 -0
- package/components/ToolbarActions/BulletListAction.js.map +1 -0
- package/components/ToolbarActions/CodeHighlightAction.d.ts +2 -0
- package/components/ToolbarActions/CodeHighlightAction.js +43 -0
- package/components/ToolbarActions/CodeHighlightAction.js.map +1 -0
- package/components/ToolbarActions/FontColorAction.d.ts +11 -0
- package/components/ToolbarActions/FontColorAction.js +83 -0
- package/components/ToolbarActions/FontColorAction.js.map +1 -0
- package/components/ToolbarActions/FontSizeAction.d.ts +2 -0
- package/components/ToolbarActions/FontSizeAction.js +101 -0
- package/components/ToolbarActions/FontSizeAction.js.map +1 -0
- package/components/ToolbarActions/ItalicAction.d.ts +2 -0
- package/components/ToolbarActions/ItalicAction.js +43 -0
- package/components/ToolbarActions/ItalicAction.js.map +1 -0
- package/components/ToolbarActions/LinkAction.d.ts +2 -0
- package/components/ToolbarActions/LinkAction.js +64 -0
- package/components/ToolbarActions/LinkAction.js.map +1 -0
- package/components/ToolbarActions/NumberedListAction.d.ts +2 -0
- package/components/ToolbarActions/NumberedListAction.js +53 -0
- package/components/ToolbarActions/NumberedListAction.js.map +1 -0
- package/components/ToolbarActions/QuoteAction.d.ts +2 -0
- package/components/ToolbarActions/QuoteAction.js +53 -0
- package/components/ToolbarActions/QuoteAction.js.map +1 -0
- package/components/ToolbarActions/TypographyAction.d.ts +11 -0
- package/components/ToolbarActions/TypographyAction.js +118 -0
- package/components/ToolbarActions/TypographyAction.js.map +1 -0
- package/components/ToolbarActions/UnderlineAction.d.ts +2 -0
- package/components/ToolbarActions/UnderlineAction.js +43 -0
- package/components/ToolbarActions/UnderlineAction.js.map +1 -0
- package/components/ToolbarPresets/HeadingToolbarPreset.d.ts +2 -0
- package/components/ToolbarPresets/HeadingToolbarPreset.js +52 -0
- package/components/ToolbarPresets/HeadingToolbarPreset.js.map +1 -0
- package/components/ToolbarPresets/ParagraphToolbarPreset.d.ts +2 -0
- package/components/ToolbarPresets/ParagraphToolbarPreset.js +67 -0
- package/components/ToolbarPresets/ParagraphToolbarPreset.js.map +1 -0
- package/context/FontColorActionContext.d.ts +6 -0
- package/context/FontColorActionContext.js +10 -0
- package/context/FontColorActionContext.js.map +1 -0
- package/context/RichTextEditorContext.d.ts +21 -0
- package/context/RichTextEditorContext.js +56 -0
- package/context/RichTextEditorContext.js.map +1 -0
- package/context/SharedHistoryContext.d.ts +11 -0
- package/context/SharedHistoryContext.js +26 -0
- package/context/SharedHistoryContext.js.map +1 -0
- package/context/TypographyActionContext.d.ts +7 -0
- package/context/TypographyActionContext.js +10 -0
- package/context/TypographyActionContext.js.map +1 -0
- package/hooks/useFontColorPicker.d.ts +2 -0
- package/hooks/useFontColorPicker.js +15 -0
- package/hooks/useFontColorPicker.js.map +1 -0
- package/hooks/useRichTextEditor.d.ts +2 -0
- package/hooks/useRichTextEditor.js +15 -0
- package/hooks/useRichTextEditor.js.map +1 -0
- package/hooks/useTypographyAction.d.ts +1 -0
- package/hooks/useTypographyAction.js +15 -0
- package/hooks/useTypographyAction.js.map +1 -0
- package/hooks/useWebinyList.d.ts +2 -0
- package/hooks/useWebinyList.js +39 -0
- package/hooks/useWebinyList.js.map +1 -0
- package/hooks/useWebinyQuote.d.ts +2 -0
- package/hooks/useWebinyQuote.js +20 -0
- package/hooks/useWebinyQuote.js.map +1 -0
- package/images/icons/LICENSE.md +5 -0
- package/images/icons/chat-square-quote.svg +1 -0
- package/images/icons/chevron-down.svg +1 -0
- package/images/icons/code.svg +1 -0
- package/images/icons/font-color.svg +1 -0
- package/images/icons/link.svg +1 -0
- package/images/icons/list-ol.svg +1 -0
- package/images/icons/list-ul.svg +1 -0
- package/images/icons/pencil-fill.svg +1 -0
- package/images/icons/text-center.svg +1 -0
- package/images/icons/text-left.svg +1 -0
- package/images/icons/text-paragraph.svg +1 -0
- package/images/icons/text-right.svg +1 -0
- package/images/icons/type-bold.svg +1 -0
- package/images/icons/type-h1.svg +1 -0
- package/images/icons/type-h2.svg +1 -0
- package/images/icons/type-h3.svg +1 -0
- package/images/icons/type-h4.svg +1 -0
- package/images/icons/type-h5.svg +1 -0
- package/images/icons/type-h6.svg +1 -0
- package/images/icons/type-italic.svg +1 -0
- package/images/icons/type-strikethrough.svg +1 -0
- package/images/icons/type-underline.svg +1 -0
- package/images/icons/unlink_icon.svg +1 -0
- package/index.d.ts +40 -0
- package/index.js +281 -0
- package/index.js.map +1 -0
- package/nodes/FontColorNode.d.ts +43 -0
- package/nodes/FontColorNode.js +127 -0
- package/nodes/FontColorNode.js.map +1 -0
- package/nodes/TypographyElementNode.d.ts +42 -0
- package/nodes/TypographyElementNode.js +154 -0
- package/nodes/TypographyElementNode.js.map +1 -0
- package/nodes/WebinyQuoteNode.d.ts +29 -0
- package/nodes/WebinyQuoteNode.js +148 -0
- package/nodes/WebinyQuoteNode.js.map +1 -0
- package/nodes/list-node/WebinyListItemNode.d.ts +46 -0
- package/nodes/list-node/WebinyListItemNode.js +441 -0
- package/nodes/list-node/WebinyListItemNode.js.map +1 -0
- package/nodes/list-node/WebinyListNode.d.ts +38 -0
- package/nodes/list-node/WebinyListNode.js +253 -0
- package/nodes/list-node/WebinyListNode.js.map +1 -0
- package/nodes/list-node/formatList.d.ts +12 -0
- package/nodes/list-node/formatList.js +423 -0
- package/nodes/list-node/formatList.js.map +1 -0
- package/nodes/webinyNodes.d.ts +7 -0
- package/nodes/webinyNodes.js +21 -0
- package/nodes/webinyNodes.js.map +1 -0
- package/package.json +41 -0
- package/plugins/AutoLinkPlugin/AutoLinkPlugin.d.ts +11 -0
- package/plugins/AutoLinkPlugin/AutoLinkPlugin.js +46 -0
- package/plugins/AutoLinkPlugin/AutoLinkPlugin.js.map +1 -0
- package/plugins/AutoLinkPlugin/index.d.ts +1 -0
- package/plugins/AutoLinkPlugin/index.js +16 -0
- package/plugins/AutoLinkPlugin/index.js.map +1 -0
- package/plugins/BlurEventPlugin/BlurEventPlugin.d.ts +7 -0
- package/plugins/BlurEventPlugin/BlurEventPlugin.js +28 -0
- package/plugins/BlurEventPlugin/BlurEventPlugin.js.map +1 -0
- package/plugins/ClickableLinkPlugin/ClickableLinkPlugin.d.ts +17 -0
- package/plugins/ClickableLinkPlugin/ClickableLinkPlugin.js +88 -0
- package/plugins/ClickableLinkPlugin/ClickableLinkPlugin.js.map +1 -0
- package/plugins/ClickableLinkPlugin/index.d.ts +1 -0
- package/plugins/ClickableLinkPlugin/index.js +16 -0
- package/plugins/ClickableLinkPlugin/index.js.map +1 -0
- package/plugins/CodeHighlightPlugin/CodeHighlightPlugin.d.ts +1 -0
- package/plugins/CodeHighlightPlugin/CodeHighlightPlugin.js +20 -0
- package/plugins/CodeHighlightPlugin/CodeHighlightPlugin.js.map +1 -0
- package/plugins/CodeHighlightPlugin/index.d.ts +1 -0
- package/plugins/CodeHighlightPlugin/index.js +16 -0
- package/plugins/CodeHighlightPlugin/index.js.map +1 -0
- package/plugins/FloatingLinkEditorPlugin/FloatingLinkEditorPlugin.css +118 -0
- package/plugins/FloatingLinkEditorPlugin/FloatingLinkEditorPlugin.d.ts +7 -0
- package/plugins/FloatingLinkEditorPlugin/FloatingLinkEditorPlugin.js +222 -0
- package/plugins/FloatingLinkEditorPlugin/FloatingLinkEditorPlugin.js.map +1 -0
- package/plugins/FloatingLinkEditorPlugin/index.d.ts +1 -0
- package/plugins/FloatingLinkEditorPlugin/index.js +16 -0
- package/plugins/FloatingLinkEditorPlugin/index.js.map +1 -0
- package/plugins/FontColorPlugin/FontColorPlugin.d.ts +2 -0
- package/plugins/FontColorPlugin/FontColorPlugin.js +38 -0
- package/plugins/FontColorPlugin/FontColorPlugin.js.map +1 -0
- package/plugins/LexicalUpdateStatePlugin/LexicalUpdateStatePlugin.d.ts +8 -0
- package/plugins/LexicalUpdateStatePlugin/LexicalUpdateStatePlugin.js +34 -0
- package/plugins/LexicalUpdateStatePlugin/LexicalUpdateStatePlugin.js.map +1 -0
- package/plugins/LexicalUpdateStatePlugin/index.d.ts +1 -0
- package/plugins/LexicalUpdateStatePlugin/index.js +16 -0
- package/plugins/LexicalUpdateStatePlugin/index.js.map +1 -0
- package/plugins/TypographyPlugin/TypographyPlugin.d.ts +2 -0
- package/plugins/TypographyPlugin/TypographyPlugin.js +31 -0
- package/plugins/TypographyPlugin/TypographyPlugin.js.map +1 -0
- package/plugins/WebinyListPLugin/WebinyListPlugin.d.ts +1 -0
- package/plugins/WebinyListPLugin/WebinyListPlugin.js +25 -0
- package/plugins/WebinyListPLugin/WebinyListPlugin.js.map +1 -0
- package/plugins/WebinyQuoteNodePlugin/WebinyQuoteNodePlugin.d.ts +1 -0
- package/plugins/WebinyQuoteNodePlugin/WebinyQuoteNodePlugin.js +24 -0
- package/plugins/WebinyQuoteNodePlugin/WebinyQuoteNodePlugin.js.map +1 -0
- package/themes/webinyLexicalTheme.css +420 -0
- package/themes/webinyLexicalTheme.d.ts +9 -0
- package/themes/webinyLexicalTheme.js +87 -0
- package/themes/webinyLexicalTheme.js.map +1 -0
- package/types.d.ts +61 -0
- package/types.js +12 -0
- package/types.js.map +1 -0
- package/ui/Divider.d.ts +2 -0
- package/ui/Divider.js +13 -0
- package/ui/Divider.js.map +1 -0
- package/ui/DropDown.d.ts +26 -0
- package/ui/DropDown.js +173 -0
- package/ui/DropDown.js.map +1 -0
- package/ui/Input.css +32 -0
- package/ui/LinkPreview.css +69 -0
- package/ui/LinkPreview.d.ts +12 -0
- package/ui/LinkPreview.js +101 -0
- package/ui/LinkPreview.js.map +1 -0
- package/ui/Placeholder.css +23 -0
- package/ui/Placeholder.d.ts +13 -0
- package/ui/Placeholder.js +24 -0
- package/ui/Placeholder.js.map +1 -0
- package/ui/TextInput.d.ts +18 -0
- package/ui/TextInput.js +39 -0
- package/ui/TextInput.js.map +1 -0
- package/ui/ToolbarActionDialog.d.ts +12 -0
- package/ui/ToolbarActionDialog.js +106 -0
- package/ui/ToolbarActionDialog.js.map +1 -0
- package/utils/generateInitialLexicalValue.d.ts +5 -0
- package/utils/generateInitialLexicalValue.js +29 -0
- package/utils/generateInitialLexicalValue.js.map +1 -0
- package/utils/getDOMRangeRect.d.ts +10 -0
- package/utils/getDOMRangeRect.js +27 -0
- package/utils/getDOMRangeRect.js.map +1 -0
- package/utils/getLexicalTextSelectionState.d.ts +5 -0
- package/utils/getLexicalTextSelectionState.js +141 -0
- package/utils/getLexicalTextSelectionState.js.map +1 -0
- package/utils/getSelectedNode.d.ts +2 -0
- package/utils/getSelectedNode.js +30 -0
- package/utils/getSelectedNode.js.map +1 -0
- package/utils/isValidJSON.d.ts +1 -0
- package/utils/isValidJSON.js +18 -0
- package/utils/isValidJSON.js.map +1 -0
- package/utils/isValidLexicalData.d.ts +2 -0
- package/utils/isValidLexicalData.js +24 -0
- package/utils/isValidLexicalData.js.map +1 -0
- package/utils/nodes/clearNodeFormating.d.ts +2 -0
- package/utils/nodes/clearNodeFormating.js +28 -0
- package/utils/nodes/clearNodeFormating.js.map +1 -0
- package/utils/nodes/formatToParagraph.d.ts +2 -0
- package/utils/nodes/formatToParagraph.js +19 -0
- package/utils/nodes/formatToParagraph.js.map +1 -0
- package/utils/nodes/formatToQuote.d.ts +2 -0
- package/utils/nodes/formatToQuote.js +20 -0
- package/utils/nodes/formatToQuote.js.map +1 -0
- package/utils/nodes/list-node.d.ts +11 -0
- package/utils/nodes/list-node.js +107 -0
- package/utils/nodes/list-node.js.map +1 -0
- package/utils/point.d.ts +21 -0
- package/utils/point.js +77 -0
- package/utils/point.js.map +1 -0
- package/utils/rect.d.ts +47 -0
- package/utils/rect.js +169 -0
- package/utils/rect.js.map +1 -0
- package/utils/sanitizeUrl.d.ts +8 -0
- package/utils/sanitizeUrl.js +27 -0
- package/utils/sanitizeUrl.js.map +1 -0
- package/utils/setFloatingElemPosition.d.ts +3 -0
- package/utils/setFloatingElemPosition.js +40 -0
- package/utils/setFloatingElemPosition.js.map +1 -0
- package/utils/styleObjectToString.d.ts +2 -0
- package/utils/styleObjectToString.js +22 -0
- package/utils/styleObjectToString.js.map +1 -0
- package/utils/toTypographyEmotionMap.d.ts +3 -0
- package/utils/toTypographyEmotionMap.js +36 -0
- package/utils/toTypographyEmotionMap.js.map +1 -0
package/index.js
ADDED
|
@@ -0,0 +1,281 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
Object.defineProperty(exports, "AddRichTextEditorNodeType", {
|
|
8
|
+
enumerable: true,
|
|
9
|
+
get: function get() {
|
|
10
|
+
return _AddRichTextEditorNodeType.AddRichTextEditorNodeType;
|
|
11
|
+
}
|
|
12
|
+
});
|
|
13
|
+
Object.defineProperty(exports, "AddRichTextEditorPlugin", {
|
|
14
|
+
enumerable: true,
|
|
15
|
+
get: function get() {
|
|
16
|
+
return _AddRichTextEditorPlugin.AddRichTextEditorPlugin;
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
Object.defineProperty(exports, "AddToolbarAction", {
|
|
20
|
+
enumerable: true,
|
|
21
|
+
get: function get() {
|
|
22
|
+
return _AddToolbarAction.AddToolbarAction;
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
Object.defineProperty(exports, "BlurEventPlugin", {
|
|
26
|
+
enumerable: true,
|
|
27
|
+
get: function get() {
|
|
28
|
+
return _BlurEventPlugin.BlurEventPlugin;
|
|
29
|
+
}
|
|
30
|
+
});
|
|
31
|
+
Object.defineProperty(exports, "BoldAction", {
|
|
32
|
+
enumerable: true,
|
|
33
|
+
get: function get() {
|
|
34
|
+
return _BoldAction.BoldAction;
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
Object.defineProperty(exports, "BulletListAction", {
|
|
38
|
+
enumerable: true,
|
|
39
|
+
get: function get() {
|
|
40
|
+
return _BulletListAction.BulletListAction;
|
|
41
|
+
}
|
|
42
|
+
});
|
|
43
|
+
Object.defineProperty(exports, "ClickableLinkPlugin", {
|
|
44
|
+
enumerable: true,
|
|
45
|
+
get: function get() {
|
|
46
|
+
return _ClickableLinkPlugin.ClickableLinkPlugin;
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
Object.defineProperty(exports, "CodeHighlightAction", {
|
|
50
|
+
enumerable: true,
|
|
51
|
+
get: function get() {
|
|
52
|
+
return _CodeHighlightAction.CodeHighlightAction;
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
Object.defineProperty(exports, "CodeHighlightPlugin", {
|
|
56
|
+
enumerable: true,
|
|
57
|
+
get: function get() {
|
|
58
|
+
return _CodeHighlightPlugin.CodeHighlightPlugin;
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
Object.defineProperty(exports, "Divider", {
|
|
62
|
+
enumerable: true,
|
|
63
|
+
get: function get() {
|
|
64
|
+
return _Divider.Divider;
|
|
65
|
+
}
|
|
66
|
+
});
|
|
67
|
+
Object.defineProperty(exports, "DropDown", {
|
|
68
|
+
enumerable: true,
|
|
69
|
+
get: function get() {
|
|
70
|
+
return _DropDown.DropDown;
|
|
71
|
+
}
|
|
72
|
+
});
|
|
73
|
+
Object.defineProperty(exports, "DropDownItem", {
|
|
74
|
+
enumerable: true,
|
|
75
|
+
get: function get() {
|
|
76
|
+
return _DropDown.DropDownItem;
|
|
77
|
+
}
|
|
78
|
+
});
|
|
79
|
+
Object.defineProperty(exports, "FloatingLinkEditorPlugin", {
|
|
80
|
+
enumerable: true,
|
|
81
|
+
get: function get() {
|
|
82
|
+
return _FloatingLinkEditorPlugin.FloatingLinkEditorPlugin;
|
|
83
|
+
}
|
|
84
|
+
});
|
|
85
|
+
Object.defineProperty(exports, "FontColorAction", {
|
|
86
|
+
enumerable: true,
|
|
87
|
+
get: function get() {
|
|
88
|
+
return _FontColorAction.FontColorAction;
|
|
89
|
+
}
|
|
90
|
+
});
|
|
91
|
+
Object.defineProperty(exports, "FontSizeAction", {
|
|
92
|
+
enumerable: true,
|
|
93
|
+
get: function get() {
|
|
94
|
+
return _FontSizeAction.FontSizeAction;
|
|
95
|
+
}
|
|
96
|
+
});
|
|
97
|
+
Object.defineProperty(exports, "HeadingEditor", {
|
|
98
|
+
enumerable: true,
|
|
99
|
+
get: function get() {
|
|
100
|
+
return _HeadingEditor.HeadingEditor;
|
|
101
|
+
}
|
|
102
|
+
});
|
|
103
|
+
Object.defineProperty(exports, "HeadingToolbar", {
|
|
104
|
+
enumerable: true,
|
|
105
|
+
get: function get() {
|
|
106
|
+
return _HeadingToolbar.HeadingToolbar;
|
|
107
|
+
}
|
|
108
|
+
});
|
|
109
|
+
Object.defineProperty(exports, "HeadingToolbarPreset", {
|
|
110
|
+
enumerable: true,
|
|
111
|
+
get: function get() {
|
|
112
|
+
return _HeadingToolbarPreset.HeadingToolbarPreset;
|
|
113
|
+
}
|
|
114
|
+
});
|
|
115
|
+
Object.defineProperty(exports, "ItalicAction", {
|
|
116
|
+
enumerable: true,
|
|
117
|
+
get: function get() {
|
|
118
|
+
return _ItalicAction.ItalicAction;
|
|
119
|
+
}
|
|
120
|
+
});
|
|
121
|
+
Object.defineProperty(exports, "LexicalEditorConfig", {
|
|
122
|
+
enumerable: true,
|
|
123
|
+
get: function get() {
|
|
124
|
+
return _LexicalEditorConfig.LexicalEditorConfig;
|
|
125
|
+
}
|
|
126
|
+
});
|
|
127
|
+
Object.defineProperty(exports, "LexicalHtmlRenderer", {
|
|
128
|
+
enumerable: true,
|
|
129
|
+
get: function get() {
|
|
130
|
+
return _LexicalHtmlRenderer.LexicalHtmlRenderer;
|
|
131
|
+
}
|
|
132
|
+
});
|
|
133
|
+
Object.defineProperty(exports, "LexicalUpdateStatePlugin", {
|
|
134
|
+
enumerable: true,
|
|
135
|
+
get: function get() {
|
|
136
|
+
return _LexicalUpdateStatePlugin.LexicalUpdateStatePlugin;
|
|
137
|
+
}
|
|
138
|
+
});
|
|
139
|
+
Object.defineProperty(exports, "LinkAction", {
|
|
140
|
+
enumerable: true,
|
|
141
|
+
get: function get() {
|
|
142
|
+
return _LinkAction.LinkAction;
|
|
143
|
+
}
|
|
144
|
+
});
|
|
145
|
+
Object.defineProperty(exports, "LinkPlugin", {
|
|
146
|
+
enumerable: true,
|
|
147
|
+
get: function get() {
|
|
148
|
+
return _LexicalLinkPlugin.LinkPlugin;
|
|
149
|
+
}
|
|
150
|
+
});
|
|
151
|
+
Object.defineProperty(exports, "NumberedListAction", {
|
|
152
|
+
enumerable: true,
|
|
153
|
+
get: function get() {
|
|
154
|
+
return _NumberedListAction.NumberedListAction;
|
|
155
|
+
}
|
|
156
|
+
});
|
|
157
|
+
Object.defineProperty(exports, "ParagraphEditor", {
|
|
158
|
+
enumerable: true,
|
|
159
|
+
get: function get() {
|
|
160
|
+
return _ParagraphEditor.ParagraphEditor;
|
|
161
|
+
}
|
|
162
|
+
});
|
|
163
|
+
Object.defineProperty(exports, "ParagraphToolbar", {
|
|
164
|
+
enumerable: true,
|
|
165
|
+
get: function get() {
|
|
166
|
+
return _ParagraphToolbar.ParagraphToolbar;
|
|
167
|
+
}
|
|
168
|
+
});
|
|
169
|
+
Object.defineProperty(exports, "ParagraphToolbarPreset", {
|
|
170
|
+
enumerable: true,
|
|
171
|
+
get: function get() {
|
|
172
|
+
return _ParagraphToolbarPreset.ParagraphToolbarPreset;
|
|
173
|
+
}
|
|
174
|
+
});
|
|
175
|
+
Object.defineProperty(exports, "QuoteAction", {
|
|
176
|
+
enumerable: true,
|
|
177
|
+
get: function get() {
|
|
178
|
+
return _QuoteAction.QuoteAction;
|
|
179
|
+
}
|
|
180
|
+
});
|
|
181
|
+
Object.defineProperty(exports, "RichTextEditor", {
|
|
182
|
+
enumerable: true,
|
|
183
|
+
get: function get() {
|
|
184
|
+
return _RichTextEditor.RichTextEditor;
|
|
185
|
+
}
|
|
186
|
+
});
|
|
187
|
+
Object.defineProperty(exports, "Toolbar", {
|
|
188
|
+
enumerable: true,
|
|
189
|
+
get: function get() {
|
|
190
|
+
return _Toolbar.Toolbar;
|
|
191
|
+
}
|
|
192
|
+
});
|
|
193
|
+
Object.defineProperty(exports, "TypographyAction", {
|
|
194
|
+
enumerable: true,
|
|
195
|
+
get: function get() {
|
|
196
|
+
return _TypographyAction.TypographyAction;
|
|
197
|
+
}
|
|
198
|
+
});
|
|
199
|
+
Object.defineProperty(exports, "UnderlineAction", {
|
|
200
|
+
enumerable: true,
|
|
201
|
+
get: function get() {
|
|
202
|
+
return _UnderlineAction.UnderlineAction;
|
|
203
|
+
}
|
|
204
|
+
});
|
|
205
|
+
Object.defineProperty(exports, "clearNodeFormatting", {
|
|
206
|
+
enumerable: true,
|
|
207
|
+
get: function get() {
|
|
208
|
+
return _clearNodeFormating.clearNodeFormatting;
|
|
209
|
+
}
|
|
210
|
+
});
|
|
211
|
+
Object.defineProperty(exports, "generateInitialLexicalValue", {
|
|
212
|
+
enumerable: true,
|
|
213
|
+
get: function get() {
|
|
214
|
+
return _generateInitialLexicalValue.generateInitialLexicalValue;
|
|
215
|
+
}
|
|
216
|
+
});
|
|
217
|
+
Object.defineProperty(exports, "isValidLexicalData", {
|
|
218
|
+
enumerable: true,
|
|
219
|
+
get: function get() {
|
|
220
|
+
return _isValidLexicalData.isValidLexicalData;
|
|
221
|
+
}
|
|
222
|
+
});
|
|
223
|
+
exports.types = void 0;
|
|
224
|
+
Object.defineProperty(exports, "useFontColorPicker", {
|
|
225
|
+
enumerable: true,
|
|
226
|
+
get: function get() {
|
|
227
|
+
return _useFontColorPicker.useFontColorPicker;
|
|
228
|
+
}
|
|
229
|
+
});
|
|
230
|
+
Object.defineProperty(exports, "useRichTextEditor", {
|
|
231
|
+
enumerable: true,
|
|
232
|
+
get: function get() {
|
|
233
|
+
return _useRichTextEditor.useRichTextEditor;
|
|
234
|
+
}
|
|
235
|
+
});
|
|
236
|
+
Object.defineProperty(exports, "useTypographyAction", {
|
|
237
|
+
enumerable: true,
|
|
238
|
+
get: function get() {
|
|
239
|
+
return _useTypographyAction.useTypographyAction;
|
|
240
|
+
}
|
|
241
|
+
});
|
|
242
|
+
var _LexicalHtmlRenderer = require("./components/LexicalHtmlRenderer");
|
|
243
|
+
var _useRichTextEditor = require("./hooks/useRichTextEditor");
|
|
244
|
+
var _useFontColorPicker = require("./hooks/useFontColorPicker");
|
|
245
|
+
var _useTypographyAction = require("./hooks/useTypographyAction");
|
|
246
|
+
var _Divider = require("./ui/Divider");
|
|
247
|
+
var _DropDown = require("./ui/DropDown");
|
|
248
|
+
var _BoldAction = require("./components/ToolbarActions/BoldAction");
|
|
249
|
+
var _BulletListAction = require("./components/ToolbarActions/BulletListAction");
|
|
250
|
+
var _CodeHighlightAction = require("./components/ToolbarActions/CodeHighlightAction");
|
|
251
|
+
var _FontSizeAction = require("./components/ToolbarActions/FontSizeAction");
|
|
252
|
+
var _FontColorAction = require("./components/ToolbarActions/FontColorAction");
|
|
253
|
+
var _ItalicAction = require("./components/ToolbarActions/ItalicAction");
|
|
254
|
+
var _LinkAction = require("./components/ToolbarActions/LinkAction");
|
|
255
|
+
var _NumberedListAction = require("./components/ToolbarActions/NumberedListAction");
|
|
256
|
+
var _QuoteAction = require("./components/ToolbarActions/QuoteAction");
|
|
257
|
+
var _UnderlineAction = require("./components/ToolbarActions/UnderlineAction");
|
|
258
|
+
var _TypographyAction = require("./components/ToolbarActions/TypographyAction");
|
|
259
|
+
var _HeadingToolbar = require("./components/Toolbar/HeadingToolbar");
|
|
260
|
+
var _ParagraphToolbar = require("./components/Toolbar/ParagraphToolbar");
|
|
261
|
+
var _Toolbar = require("./components/Toolbar/Toolbar");
|
|
262
|
+
var _ParagraphToolbarPreset = require("./components/ToolbarPresets/ParagraphToolbarPreset");
|
|
263
|
+
var _HeadingToolbarPreset = require("./components/ToolbarPresets/HeadingToolbarPreset");
|
|
264
|
+
var _RichTextEditor = require("./components/Editor/RichTextEditor");
|
|
265
|
+
var _HeadingEditor = require("./components/Editor/HeadingEditor");
|
|
266
|
+
var _ParagraphEditor = require("./components/Editor/ParagraphEditor");
|
|
267
|
+
var _LexicalLinkPlugin = require("@lexical/react/LexicalLinkPlugin");
|
|
268
|
+
var _FloatingLinkEditorPlugin = require("./plugins/FloatingLinkEditorPlugin/FloatingLinkEditorPlugin");
|
|
269
|
+
var _CodeHighlightPlugin = require("./plugins/CodeHighlightPlugin/CodeHighlightPlugin");
|
|
270
|
+
var _ClickableLinkPlugin = require("./plugins/ClickableLinkPlugin/ClickableLinkPlugin");
|
|
271
|
+
var _BlurEventPlugin = require("./plugins/BlurEventPlugin/BlurEventPlugin");
|
|
272
|
+
var _LexicalUpdateStatePlugin = require("./plugins/LexicalUpdateStatePlugin/LexicalUpdateStatePlugin");
|
|
273
|
+
var _AddToolbarAction = require("./components/AddToolbarAction");
|
|
274
|
+
var _AddRichTextEditorPlugin = require("./components/AddRichTextEditorPlugin");
|
|
275
|
+
var _AddRichTextEditorNodeType = require("./components/AddRichTextEditorNodeType");
|
|
276
|
+
var _generateInitialLexicalValue = require("./utils/generateInitialLexicalValue");
|
|
277
|
+
var _isValidLexicalData = require("./utils/isValidLexicalData");
|
|
278
|
+
var _clearNodeFormating = require("./utils/nodes/clearNodeFormating");
|
|
279
|
+
var _types = _interopRequireWildcard(require("./types"));
|
|
280
|
+
exports.types = _types;
|
|
281
|
+
var _LexicalEditorConfig = require("./components/LexicalEditorConfig/LexicalEditorConfig");
|
package/index.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sources":["index.tsx"],"sourcesContent":["// render\nexport { LexicalHtmlRenderer } from \"~/components/LexicalHtmlRenderer\";\n// hooks\nexport { useRichTextEditor } from \"~/hooks/useRichTextEditor\";\nexport { useFontColorPicker } from \"~/hooks/useFontColorPicker\";\nexport { useTypographyAction } from \"~/hooks/useTypographyAction\";\n// UI elements\nexport { Divider } from \"~/ui/Divider\";\nexport { DropDownItem } from \"~/ui/DropDown\";\nexport { DropDown } from \"~/ui/DropDown\";\n// actions\nexport { BoldAction } from \"~/components/ToolbarActions/BoldAction\";\nexport { BulletListAction } from \"~/components/ToolbarActions/BulletListAction\";\nexport { CodeHighlightAction } from \"~/components/ToolbarActions/CodeHighlightAction\";\nexport { FontSizeAction } from \"~/components/ToolbarActions/FontSizeAction\";\nexport { FontColorAction } from \"~/components/ToolbarActions/FontColorAction\";\nexport { ItalicAction } from \"~/components/ToolbarActions/ItalicAction\";\nexport { LinkAction } from \"~/components/ToolbarActions/LinkAction\";\nexport { NumberedListAction } from \"~/components/ToolbarActions/NumberedListAction\";\nexport { QuoteAction } from \"~/components/ToolbarActions/QuoteAction\";\nexport { UnderlineAction } from \"~/components/ToolbarActions/UnderlineAction\";\nexport { TypographyAction } from \"~/components/ToolbarActions/TypographyAction\";\n// toolbars\nexport { HeadingToolbar } from \"~/components/Toolbar/HeadingToolbar\";\nexport { ParagraphToolbar } from \"~/components/Toolbar/ParagraphToolbar\";\nexport { Toolbar } from \"~/components/Toolbar/Toolbar\";\n// presets\nexport { ParagraphToolbarPreset } from \"~/components/ToolbarPresets/ParagraphToolbarPreset\";\nexport { HeadingToolbarPreset } from \"./components/ToolbarPresets/HeadingToolbarPreset\";\n// editor\nexport { RichTextEditor } from \"~/components/Editor/RichTextEditor\";\nexport { HeadingEditor } from \"~/components/Editor/HeadingEditor\";\nexport { ParagraphEditor } from \"~/components/Editor/ParagraphEditor\";\n// plugins\nexport { LinkPlugin } from \"@lexical/react/LexicalLinkPlugin\";\nexport { FloatingLinkEditorPlugin } from \"~/plugins/FloatingLinkEditorPlugin/FloatingLinkEditorPlugin\";\nexport { CodeHighlightPlugin } from \"~/plugins/CodeHighlightPlugin/CodeHighlightPlugin\";\nexport { ClickableLinkPlugin } from \"~/plugins/ClickableLinkPlugin/ClickableLinkPlugin\";\nexport { BlurEventPlugin } from \"~/plugins/BlurEventPlugin/BlurEventPlugin\";\nexport { LexicalUpdateStatePlugin } from \"~/plugins/LexicalUpdateStatePlugin/LexicalUpdateStatePlugin\";\n// composition\nexport { AddToolbarAction } from \"~/components/AddToolbarAction\";\nexport { AddRichTextEditorPlugin } from \"~/components/AddRichTextEditorPlugin\";\nexport { AddRichTextEditorNodeType } from \"~/components/AddRichTextEditorNodeType\";\n// utils\nexport { generateInitialLexicalValue } from \"~/utils/generateInitialLexicalValue\";\nexport { isValidLexicalData } from \"~/utils/isValidLexicalData\";\nexport { clearNodeFormatting } from \"~/utils/nodes/clearNodeFormating\";\n// types\nexport * as types from \"./types\";\n// config\nexport { LexicalEditorConfig } from \"~/components/LexicalEditorConfig/LexicalEditorConfig\";\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA;AAEA;AACA;AACA;AAEA;AACA;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AAEA;AACA;AAEA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AAEA;AACA;AACA;AAAuE;AAAA;AAIvE"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
/// <reference types="web" />
|
|
3
|
+
import { EditorConfig, LexicalCommand, LexicalEditor, LexicalNode, NodeKey, RangeSelection, SerializedTextNode, Spread, TextNode } from "lexical";
|
|
4
|
+
import { WebinyEditorTheme } from "../themes/webinyLexicalTheme";
|
|
5
|
+
export declare const ADD_FONT_COLOR_COMMAND: LexicalCommand<FontColorPayload>;
|
|
6
|
+
export interface FontColorPayload {
|
|
7
|
+
color: string;
|
|
8
|
+
themeColorName: string | undefined;
|
|
9
|
+
caption?: LexicalEditor;
|
|
10
|
+
key?: NodeKey;
|
|
11
|
+
}
|
|
12
|
+
declare type ThemeStyleColorName = string;
|
|
13
|
+
declare type ThemeColor = "custom" | ThemeStyleColorName;
|
|
14
|
+
export declare type SerializedFontColorNode = Spread<{
|
|
15
|
+
themeColor: ThemeColor;
|
|
16
|
+
color: string;
|
|
17
|
+
type: "font-color-node";
|
|
18
|
+
version: 1;
|
|
19
|
+
}, SerializedTextNode>;
|
|
20
|
+
/**
|
|
21
|
+
* Main responsibility of this node is to apply custom or Webiny theme color to selected text.
|
|
22
|
+
* Extends the original TextNode node to add additional transformation and support for webiny theme font color.
|
|
23
|
+
*/
|
|
24
|
+
export declare class FontColorNode extends TextNode {
|
|
25
|
+
__themeColor: ThemeColor;
|
|
26
|
+
__color: string;
|
|
27
|
+
constructor(text: string, color: string, themeColor?: ThemeColor, key?: NodeKey);
|
|
28
|
+
static getType(): string;
|
|
29
|
+
static clone(node: FontColorNode): FontColorNode;
|
|
30
|
+
static importJSON(serializedNode: SerializedFontColorNode): TextNode;
|
|
31
|
+
exportJSON(): SerializedFontColorNode;
|
|
32
|
+
addColorValueToHTMLElement(element: HTMLElement, theme: WebinyEditorTheme): HTMLElement;
|
|
33
|
+
updateDOM(prevNode: FontColorNode, dom: HTMLElement, config: EditorConfig): boolean;
|
|
34
|
+
getColorStyle(): {
|
|
35
|
+
color: string;
|
|
36
|
+
themeColor: ThemeColor;
|
|
37
|
+
};
|
|
38
|
+
createDOM(config: EditorConfig): HTMLElement;
|
|
39
|
+
}
|
|
40
|
+
export declare const $createFontColorNode: (text: string, color: string, themeColor?: ThemeColor, key?: NodeKey) => FontColorNode;
|
|
41
|
+
export declare const $isFontColorNode: (node: LexicalNode) => boolean;
|
|
42
|
+
export declare function $applyStylesToNode(node: FontColorNode, nodeStyleProvider: RangeSelection): void;
|
|
43
|
+
export {};
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.$applyStylesToNode = $applyStylesToNode;
|
|
8
|
+
exports.FontColorNode = exports.ADD_FONT_COLOR_COMMAND = exports.$isFontColorNode = exports.$createFontColorNode = void 0;
|
|
9
|
+
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
|
|
10
|
+
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
11
|
+
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
12
|
+
var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));
|
|
13
|
+
var _get2 = _interopRequireDefault(require("@babel/runtime/helpers/get"));
|
|
14
|
+
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
15
|
+
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
16
|
+
var _createSuper2 = _interopRequireDefault(require("@babel/runtime/helpers/createSuper"));
|
|
17
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
18
|
+
var _lexical = require("lexical");
|
|
19
|
+
var ADD_FONT_COLOR_COMMAND = (0, _lexical.createCommand)("ADD_FONT_COLOR_COMMAND");
|
|
20
|
+
exports.ADD_FONT_COLOR_COMMAND = ADD_FONT_COLOR_COMMAND;
|
|
21
|
+
var FontColorNodeAttrName = "data-theme-font-color-name";
|
|
22
|
+
/**
|
|
23
|
+
* Main responsibility of this node is to apply custom or Webiny theme color to selected text.
|
|
24
|
+
* Extends the original TextNode node to add additional transformation and support for webiny theme font color.
|
|
25
|
+
*/
|
|
26
|
+
var FontColorNode = /*#__PURE__*/function (_TextNode) {
|
|
27
|
+
(0, _inherits2.default)(FontColorNode, _TextNode);
|
|
28
|
+
var _super = (0, _createSuper2.default)(FontColorNode);
|
|
29
|
+
function FontColorNode(text, color, themeColor, key) {
|
|
30
|
+
var _this;
|
|
31
|
+
(0, _classCallCheck2.default)(this, FontColorNode);
|
|
32
|
+
_this = _super.call(this, text, key);
|
|
33
|
+
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "__themeColor", void 0);
|
|
34
|
+
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "__color", void 0);
|
|
35
|
+
_this.__themeColor = themeColor || "custom";
|
|
36
|
+
_this.__color = color;
|
|
37
|
+
return _this;
|
|
38
|
+
}
|
|
39
|
+
(0, _createClass2.default)(FontColorNode, [{
|
|
40
|
+
key: "exportJSON",
|
|
41
|
+
value: function exportJSON() {
|
|
42
|
+
return (0, _objectSpread2.default)((0, _objectSpread2.default)({}, (0, _get2.default)((0, _getPrototypeOf2.default)(FontColorNode.prototype), "exportJSON", this).call(this)), {}, {
|
|
43
|
+
themeColor: this.__themeColor,
|
|
44
|
+
color: this.__color,
|
|
45
|
+
type: "font-color-node",
|
|
46
|
+
version: 1
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
}, {
|
|
50
|
+
key: "addColorValueToHTMLElement",
|
|
51
|
+
value: function addColorValueToHTMLElement(element, theme) {
|
|
52
|
+
var _theme$styles;
|
|
53
|
+
var hasThemeColor = this.__themeColor !== "custom";
|
|
54
|
+
// get the updated color from webiny theme
|
|
55
|
+
if (hasThemeColor && theme !== null && theme !== void 0 && (_theme$styles = theme.styles) !== null && _theme$styles !== void 0 && _theme$styles.colors) {
|
|
56
|
+
this.__color = theme.styles.colors[this.__themeColor];
|
|
57
|
+
}
|
|
58
|
+
element.setAttribute(FontColorNodeAttrName, this.__themeColor);
|
|
59
|
+
element.style.color = this.__color;
|
|
60
|
+
return element;
|
|
61
|
+
}
|
|
62
|
+
}, {
|
|
63
|
+
key: "updateDOM",
|
|
64
|
+
value: function updateDOM(prevNode, dom, config) {
|
|
65
|
+
var _theme$styles2;
|
|
66
|
+
var theme = config.theme;
|
|
67
|
+
var isUpdated = (0, _get2.default)((0, _getPrototypeOf2.default)(FontColorNode.prototype), "updateDOM", this).call(this, prevNode, dom, config);
|
|
68
|
+
var hasThemeColor = this.__themeColor !== "custom";
|
|
69
|
+
// get the updated color from webiny theme
|
|
70
|
+
if (hasThemeColor && theme !== null && theme !== void 0 && (_theme$styles2 = theme.styles) !== null && _theme$styles2 !== void 0 && _theme$styles2.colors) {
|
|
71
|
+
this.__color = theme.styles.colors[this.__themeColor];
|
|
72
|
+
}
|
|
73
|
+
dom.setAttribute(FontColorNodeAttrName, this.__themeColor);
|
|
74
|
+
dom.style.color = this.__color;
|
|
75
|
+
return isUpdated;
|
|
76
|
+
}
|
|
77
|
+
}, {
|
|
78
|
+
key: "getColorStyle",
|
|
79
|
+
value: function getColorStyle() {
|
|
80
|
+
return {
|
|
81
|
+
color: this.__color,
|
|
82
|
+
themeColor: this.__themeColor
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
}, {
|
|
86
|
+
key: "createDOM",
|
|
87
|
+
value: function createDOM(config) {
|
|
88
|
+
var element = (0, _get2.default)((0, _getPrototypeOf2.default)(FontColorNode.prototype), "createDOM", this).call(this, config);
|
|
89
|
+
return this.addColorValueToHTMLElement(element, config.theme);
|
|
90
|
+
}
|
|
91
|
+
}], [{
|
|
92
|
+
key: "getType",
|
|
93
|
+
value: function getType() {
|
|
94
|
+
return "font-color-node";
|
|
95
|
+
}
|
|
96
|
+
}, {
|
|
97
|
+
key: "clone",
|
|
98
|
+
value: function clone(node) {
|
|
99
|
+
return new FontColorNode(node.__text, node.__color, node.__themeColor, node.__key);
|
|
100
|
+
}
|
|
101
|
+
}, {
|
|
102
|
+
key: "importJSON",
|
|
103
|
+
value: function importJSON(serializedNode) {
|
|
104
|
+
var node = new FontColorNode(serializedNode.text, serializedNode.color, serializedNode.themeColor);
|
|
105
|
+
node.setTextContent(serializedNode.text);
|
|
106
|
+
node.setFormat(serializedNode.format);
|
|
107
|
+
node.setDetail(serializedNode.detail);
|
|
108
|
+
node.setMode(serializedNode.mode);
|
|
109
|
+
node.setStyle(serializedNode.style);
|
|
110
|
+
return node;
|
|
111
|
+
}
|
|
112
|
+
}]);
|
|
113
|
+
return FontColorNode;
|
|
114
|
+
}(_lexical.TextNode);
|
|
115
|
+
exports.FontColorNode = FontColorNode;
|
|
116
|
+
var $createFontColorNode = function $createFontColorNode(text, color, themeColor, key) {
|
|
117
|
+
return new FontColorNode(text, color, themeColor, key);
|
|
118
|
+
};
|
|
119
|
+
exports.$createFontColorNode = $createFontColorNode;
|
|
120
|
+
var $isFontColorNode = function $isFontColorNode(node) {
|
|
121
|
+
return node instanceof FontColorNode;
|
|
122
|
+
};
|
|
123
|
+
exports.$isFontColorNode = $isFontColorNode;
|
|
124
|
+
function $applyStylesToNode(node, nodeStyleProvider) {
|
|
125
|
+
node.setFormat(nodeStyleProvider.format);
|
|
126
|
+
node.setStyle(nodeStyleProvider.style);
|
|
127
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["ADD_FONT_COLOR_COMMAND","createCommand","FontColorNodeAttrName","FontColorNode","text","color","themeColor","key","__themeColor","__color","type","version","element","theme","hasThemeColor","styles","colors","setAttribute","style","prevNode","dom","config","isUpdated","addColorValueToHTMLElement","node","__text","__key","serializedNode","setTextContent","setFormat","format","setDetail","detail","setMode","mode","setStyle","TextNode","$createFontColorNode","$isFontColorNode","$applyStylesToNode","nodeStyleProvider"],"sources":["FontColorNode.ts"],"sourcesContent":["import {\n createCommand,\n EditorConfig,\n LexicalCommand,\n LexicalEditor,\n LexicalNode,\n NodeKey,\n RangeSelection,\n SerializedTextNode,\n Spread,\n TextNode\n} from \"lexical\";\nimport { WebinyEditorTheme } from \"~/themes/webinyLexicalTheme\";\n\nexport const ADD_FONT_COLOR_COMMAND: LexicalCommand<FontColorPayload> =\n createCommand(\"ADD_FONT_COLOR_COMMAND\");\nconst FontColorNodeAttrName = \"data-theme-font-color-name\";\n\nexport interface FontColorPayload {\n // This color can be hex string\n color: string;\n // webiny theme color variable like color1, color2...\n themeColorName: string | undefined;\n caption?: LexicalEditor;\n key?: NodeKey;\n}\n\ntype ThemeStyleColorName = string;\ntype ThemeColor = \"custom\" | ThemeStyleColorName;\n\nexport type SerializedFontColorNode = Spread<\n {\n themeColor: ThemeColor;\n color: string;\n type: \"font-color-node\";\n version: 1;\n },\n SerializedTextNode\n>;\n\n/**\n * Main responsibility of this node is to apply custom or Webiny theme color to selected text.\n * Extends the original TextNode node to add additional transformation and support for webiny theme font color.\n */\nexport class FontColorNode extends TextNode {\n __themeColor: ThemeColor;\n __color: string;\n\n constructor(text: string, color: string, themeColor?: ThemeColor, key?: NodeKey) {\n super(text, key);\n this.__themeColor = themeColor || \"custom\";\n this.__color = color;\n }\n\n static override getType(): string {\n return \"font-color-node\";\n }\n\n static override clone(node: FontColorNode): FontColorNode {\n return new FontColorNode(node.__text, node.__color, node.__themeColor, node.__key);\n }\n\n static override importJSON(serializedNode: SerializedFontColorNode): TextNode {\n const node = new FontColorNode(\n serializedNode.text,\n serializedNode.color,\n serializedNode.themeColor\n );\n node.setTextContent(serializedNode.text);\n node.setFormat(serializedNode.format);\n node.setDetail(serializedNode.detail);\n node.setMode(serializedNode.mode);\n node.setStyle(serializedNode.style);\n return node;\n }\n\n override exportJSON(): SerializedFontColorNode {\n return {\n ...super.exportJSON(),\n themeColor: this.__themeColor,\n color: this.__color,\n type: \"font-color-node\",\n version: 1\n };\n }\n\n addColorValueToHTMLElement(element: HTMLElement, theme: WebinyEditorTheme): HTMLElement {\n const hasThemeColor = this.__themeColor !== \"custom\";\n // get the updated color from webiny theme\n if (hasThemeColor && theme?.styles?.colors) {\n this.__color = theme.styles.colors[this.__themeColor];\n }\n\n element.setAttribute(FontColorNodeAttrName, this.__themeColor);\n element.style.color = this.__color;\n return element;\n }\n\n override updateDOM(prevNode: FontColorNode, dom: HTMLElement, config: EditorConfig): boolean {\n const theme = config.theme;\n const isUpdated = super.updateDOM(prevNode, dom, config);\n const hasThemeColor = this.__themeColor !== \"custom\";\n // get the updated color from webiny theme\n if (hasThemeColor && theme?.styles?.colors) {\n this.__color = theme.styles.colors[this.__themeColor];\n }\n\n dom.setAttribute(FontColorNodeAttrName, this.__themeColor);\n dom.style.color = this.__color;\n return isUpdated;\n }\n\n getColorStyle(): { color: string; themeColor: ThemeColor } {\n return {\n color: this.__color,\n themeColor: this.__themeColor\n };\n }\n\n override createDOM(config: EditorConfig): HTMLElement {\n const element = super.createDOM(config);\n return this.addColorValueToHTMLElement(element, config.theme);\n }\n}\n\nexport const $createFontColorNode = (\n text: string,\n color: string,\n themeColor?: ThemeColor,\n key?: NodeKey\n): FontColorNode => {\n return new FontColorNode(text, color, themeColor, key);\n};\n\nexport const $isFontColorNode = (node: LexicalNode): boolean => {\n return node instanceof FontColorNode;\n};\n\nexport function $applyStylesToNode(node: FontColorNode, nodeStyleProvider: RangeSelection) {\n node.setFormat(nodeStyleProvider.format);\n node.setStyle(nodeStyleProvider.style);\n}\n"],"mappings":"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"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
/// <reference types="web" />
|
|
3
|
+
import { EditorConfig, ElementNode, LexicalCommand, LexicalEditor, LexicalNode, NodeKey, SerializedElementNode, Spread } from "lexical";
|
|
4
|
+
import { WebinyEditorTheme } from "../themes/webinyLexicalTheme";
|
|
5
|
+
import { TypographyHTMLTag, TypographyValue } from "../types";
|
|
6
|
+
export declare const ADD_TYPOGRAPHY_ELEMENT_COMMAND: LexicalCommand<TypographyPayload>;
|
|
7
|
+
export interface TypographyPayload {
|
|
8
|
+
value: TypographyValue;
|
|
9
|
+
caption?: LexicalEditor;
|
|
10
|
+
key?: NodeKey;
|
|
11
|
+
}
|
|
12
|
+
export declare type SerializedTypographyNode = Spread<{
|
|
13
|
+
tag: TypographyHTMLTag;
|
|
14
|
+
styleId: string;
|
|
15
|
+
name: string;
|
|
16
|
+
typographyStyles: Record<string, any>;
|
|
17
|
+
type: "typography-el-node";
|
|
18
|
+
version: 1;
|
|
19
|
+
}, SerializedElementNode>;
|
|
20
|
+
/**
|
|
21
|
+
* Main responsibility of this node is to apply custom or Webiny theme typography to selected text.
|
|
22
|
+
* Extends the original ElementNode node to add additional transformation and support for webiny theme typography.
|
|
23
|
+
*/
|
|
24
|
+
export declare class TypographyElementNode extends ElementNode {
|
|
25
|
+
__styleId: string;
|
|
26
|
+
__tag: TypographyHTMLTag;
|
|
27
|
+
__name: string;
|
|
28
|
+
__css: Record<string, any>;
|
|
29
|
+
constructor(value: TypographyValue, key?: NodeKey);
|
|
30
|
+
static getType(): string;
|
|
31
|
+
static clone(node: TypographyElementNode): TypographyElementNode;
|
|
32
|
+
getTypographyValue(): TypographyValue;
|
|
33
|
+
addStylesHTMLElement(element: HTMLElement, theme: WebinyEditorTheme): HTMLElement;
|
|
34
|
+
exportJSON(): SerializedTypographyNode;
|
|
35
|
+
static importJSON(serializedNode: SerializedTypographyNode): TypographyElementNode;
|
|
36
|
+
createDOM(config: EditorConfig): HTMLElement;
|
|
37
|
+
updateDOM(): boolean;
|
|
38
|
+
insertNewAfter(): TypographyElementNode;
|
|
39
|
+
collapseAtStart(): true;
|
|
40
|
+
}
|
|
41
|
+
export declare const $createTypographyNode: (value: TypographyValue, key?: NodeKey) => TypographyElementNode;
|
|
42
|
+
export declare const $isTypographyElementNode: (node: ElementNode | LexicalNode | null) => boolean;
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.TypographyElementNode = exports.ADD_TYPOGRAPHY_ELEMENT_COMMAND = exports.$isTypographyElementNode = exports.$createTypographyNode = void 0;
|
|
8
|
+
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
|
|
9
|
+
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
10
|
+
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
11
|
+
var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));
|
|
12
|
+
var _get2 = _interopRequireDefault(require("@babel/runtime/helpers/get"));
|
|
13
|
+
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
14
|
+
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
15
|
+
var _createSuper2 = _interopRequireDefault(require("@babel/runtime/helpers/createSuper"));
|
|
16
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
17
|
+
var _lexical = require("lexical");
|
|
18
|
+
var _utils = require("@lexical/utils");
|
|
19
|
+
// Command and payload
|
|
20
|
+
var ADD_TYPOGRAPHY_ELEMENT_COMMAND = (0, _lexical.createCommand)("ADD_TYPOGRAPHY_ELEMENT_COMMAND");
|
|
21
|
+
exports.ADD_TYPOGRAPHY_ELEMENT_COMMAND = ADD_TYPOGRAPHY_ELEMENT_COMMAND;
|
|
22
|
+
var TypographyNodeAttrName = "data-typography-style-id";
|
|
23
|
+
/**
|
|
24
|
+
* Main responsibility of this node is to apply custom or Webiny theme typography to selected text.
|
|
25
|
+
* Extends the original ElementNode node to add additional transformation and support for webiny theme typography.
|
|
26
|
+
*/
|
|
27
|
+
var TypographyElementNode = /*#__PURE__*/function (_ElementNode) {
|
|
28
|
+
(0, _inherits2.default)(TypographyElementNode, _ElementNode);
|
|
29
|
+
var _super = (0, _createSuper2.default)(TypographyElementNode);
|
|
30
|
+
function TypographyElementNode(value, key) {
|
|
31
|
+
var _this;
|
|
32
|
+
(0, _classCallCheck2.default)(this, TypographyElementNode);
|
|
33
|
+
_this = _super.call(this, key);
|
|
34
|
+
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "__styleId", void 0);
|
|
35
|
+
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "__tag", void 0);
|
|
36
|
+
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "__name", void 0);
|
|
37
|
+
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "__css", void 0);
|
|
38
|
+
_this.__tag = value.tag;
|
|
39
|
+
_this.__styleId = value.id;
|
|
40
|
+
_this.__name = value.name;
|
|
41
|
+
_this.__css = value.css;
|
|
42
|
+
return _this;
|
|
43
|
+
}
|
|
44
|
+
(0, _createClass2.default)(TypographyElementNode, [{
|
|
45
|
+
key: "getTypographyValue",
|
|
46
|
+
value: function getTypographyValue() {
|
|
47
|
+
return {
|
|
48
|
+
tag: this.__tag,
|
|
49
|
+
css: this.__css,
|
|
50
|
+
id: this.__styleId,
|
|
51
|
+
name: this.__name
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
}, {
|
|
55
|
+
key: "addStylesHTMLElement",
|
|
56
|
+
value: function addStylesHTMLElement(element, theme) {
|
|
57
|
+
var typographyStyleValue = theme !== null && theme !== void 0 && theme.emotionMap ? theme === null || theme === void 0 ? void 0 : theme.emotionMap[this.__styleId] : undefined;
|
|
58
|
+
if (typographyStyleValue) {
|
|
59
|
+
this.__css = typographyStyleValue.styles;
|
|
60
|
+
(0, _utils.addClassNamesToElement)(element, typographyStyleValue.className);
|
|
61
|
+
}
|
|
62
|
+
element.setAttribute(TypographyNodeAttrName, this.__styleId);
|
|
63
|
+
return element;
|
|
64
|
+
}
|
|
65
|
+
}, {
|
|
66
|
+
key: "exportJSON",
|
|
67
|
+
value: function exportJSON() {
|
|
68
|
+
return (0, _objectSpread2.default)((0, _objectSpread2.default)({}, (0, _get2.default)((0, _getPrototypeOf2.default)(TypographyElementNode.prototype), "exportJSON", this).call(this)), {}, {
|
|
69
|
+
tag: this.__tag,
|
|
70
|
+
typographyStyles: this.__css,
|
|
71
|
+
name: this.__name,
|
|
72
|
+
styleId: this.__styleId,
|
|
73
|
+
type: "typography-el-node",
|
|
74
|
+
version: 1
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
}, {
|
|
78
|
+
key: "createDOM",
|
|
79
|
+
value: function createDOM(config) {
|
|
80
|
+
var tag = this.__tag;
|
|
81
|
+
var element = document.createElement(tag);
|
|
82
|
+
return this.addStylesHTMLElement(element, config.theme);
|
|
83
|
+
}
|
|
84
|
+
}, {
|
|
85
|
+
key: "updateDOM",
|
|
86
|
+
value: function updateDOM() {
|
|
87
|
+
return false;
|
|
88
|
+
}
|
|
89
|
+
}, {
|
|
90
|
+
key: "insertNewAfter",
|
|
91
|
+
value: function insertNewAfter() {
|
|
92
|
+
var newElement = $createTypographyNode({
|
|
93
|
+
tag: this.__tag,
|
|
94
|
+
name: this.__name,
|
|
95
|
+
css: this.__css,
|
|
96
|
+
id: this.__styleId
|
|
97
|
+
});
|
|
98
|
+
var direction = this.getDirection();
|
|
99
|
+
newElement.setDirection(direction);
|
|
100
|
+
this.insertAfter(newElement);
|
|
101
|
+
return newElement;
|
|
102
|
+
}
|
|
103
|
+
}, {
|
|
104
|
+
key: "collapseAtStart",
|
|
105
|
+
value: function collapseAtStart() {
|
|
106
|
+
var paragraph = (0, _lexical.$createParagraphNode)();
|
|
107
|
+
var children = this.getChildren();
|
|
108
|
+
children.forEach(function (child) {
|
|
109
|
+
return paragraph.append(child);
|
|
110
|
+
});
|
|
111
|
+
this.replace(paragraph);
|
|
112
|
+
return true;
|
|
113
|
+
}
|
|
114
|
+
}], [{
|
|
115
|
+
key: "getType",
|
|
116
|
+
value: function getType() {
|
|
117
|
+
return "typography-el-node";
|
|
118
|
+
}
|
|
119
|
+
}, {
|
|
120
|
+
key: "clone",
|
|
121
|
+
value: function clone(node) {
|
|
122
|
+
return new TypographyElementNode({
|
|
123
|
+
css: node.__css,
|
|
124
|
+
id: node.__styleId,
|
|
125
|
+
name: node.__name,
|
|
126
|
+
tag: node.__tag
|
|
127
|
+
}, node.__key);
|
|
128
|
+
}
|
|
129
|
+
}, {
|
|
130
|
+
key: "importJSON",
|
|
131
|
+
value: function importJSON(serializedNode) {
|
|
132
|
+
var node = new TypographyElementNode({
|
|
133
|
+
id: serializedNode.styleId,
|
|
134
|
+
css: serializedNode.typographyStyles,
|
|
135
|
+
tag: serializedNode.tag,
|
|
136
|
+
name: serializedNode.name
|
|
137
|
+
});
|
|
138
|
+
node.setFormat(serializedNode.format);
|
|
139
|
+
node.setIndent(serializedNode.indent);
|
|
140
|
+
node.setDirection(serializedNode.direction);
|
|
141
|
+
return node;
|
|
142
|
+
}
|
|
143
|
+
}]);
|
|
144
|
+
return TypographyElementNode;
|
|
145
|
+
}(_lexical.ElementNode);
|
|
146
|
+
exports.TypographyElementNode = TypographyElementNode;
|
|
147
|
+
var $createTypographyNode = function $createTypographyNode(value, key) {
|
|
148
|
+
return new TypographyElementNode(value, key);
|
|
149
|
+
};
|
|
150
|
+
exports.$createTypographyNode = $createTypographyNode;
|
|
151
|
+
var $isTypographyElementNode = function $isTypographyElementNode(node) {
|
|
152
|
+
return node instanceof TypographyElementNode;
|
|
153
|
+
};
|
|
154
|
+
exports.$isTypographyElementNode = $isTypographyElementNode;
|