@webiny/lexical-editor 0.0.0-unstable.085ff6572f
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 +11 -0
- package/components/LexicalEditorConfig/LexicalEditorConfig.js +19 -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 +435 -0
- package/components/Toolbar/Toolbar.d.ts +13 -0
- package/components/Toolbar/Toolbar.js +215 -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 +56 -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 +58 -0
- package/components/ToolbarActions/NumberedListAction.js.map +1 -0
- package/components/ToolbarActions/QuoteAction.d.ts +2 -0
- package/components/ToolbarActions/QuoteAction.js +52 -0
- package/components/ToolbarActions/QuoteAction.js.map +1 -0
- package/components/ToolbarActions/TextAlignmentAction.d.ts +11 -0
- package/components/ToolbarActions/TextAlignmentAction.js +70 -0
- package/components/ToolbarActions/TextAlignmentAction.js.map +1 -0
- package/components/ToolbarActions/TypographyAction.d.ts +11 -0
- package/components/ToolbarActions/TypographyAction.js +145 -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 +56 -0
- package/components/ToolbarPresets/HeadingToolbarPreset.js.map +1 -0
- package/components/ToolbarPresets/ParagraphToolbarPreset.d.ts +2 -0
- package/components/ToolbarPresets/ParagraphToolbarPreset.js +71 -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 +26 -0
- package/context/RichTextEditorContext.js +68 -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/TextAlignmentActionContextProps.d.ts +9 -0
- package/context/TextAlignmentActionContextProps.js +10 -0
- package/context/TextAlignmentActionContextProps.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/useList.d.ts +2 -0
- package/hooks/useList.js +39 -0
- package/hooks/useList.js.map +1 -0
- package/hooks/useQuote.d.ts +2 -0
- package/hooks/useQuote.js +20 -0
- package/hooks/useQuote.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/useTextAlignmentAction.d.ts +1 -0
- package/hooks/useTextAlignmentAction.js +15 -0
- package/hooks/useTextAlignmentAction.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/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/indent.svg +3 -0
- package/images/icons/justify.svg +3 -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/outdent.svg +3 -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 +42 -0
- package/index.js +295 -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/HeadingNode.d.ts +34 -0
- package/nodes/HeadingNode.js +192 -0
- package/nodes/HeadingNode.js.map +1 -0
- package/nodes/ListItemNode.d.ts +46 -0
- package/nodes/ListItemNode.js +441 -0
- package/nodes/ListItemNode.js.map +1 -0
- package/nodes/ListNode/formatList.d.ts +12 -0
- package/nodes/ListNode/formatList.js +424 -0
- package/nodes/ListNode/formatList.js.map +1 -0
- package/nodes/ListNode.d.ts +42 -0
- package/nodes/ListNode.js +294 -0
- package/nodes/ListNode.js.map +1 -0
- package/nodes/ParagraphNode.d.ts +32 -0
- package/nodes/ParagraphNode.js +218 -0
- package/nodes/ParagraphNode.js.map +1 -0
- package/nodes/QuoteNode.d.ts +34 -0
- package/nodes/QuoteNode.js +225 -0
- package/nodes/QuoteNode.js.map +1 -0
- package/nodes/TypographyElementNode.d.ts +42 -0
- package/nodes/TypographyElementNode.js +155 -0
- package/nodes/TypographyElementNode.js.map +1 -0
- package/nodes/types.d.ts +15 -0
- package/nodes/types.js +5 -0
- package/nodes/types.js.map +1 -0
- package/nodes/webinyNodes.d.ts +7 -0
- package/nodes/webinyNodes.js +45 -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 +39 -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 +35 -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 +429 -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 +63 -0
- package/types.js +25 -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 +206 -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/findTypographyStyleByHtmlTag.d.ts +8 -0
- package/utils/findTypographyStyleByHtmlTag.js +16 -0
- package/utils/findTypographyStyleByHtmlTag.js.map +1 -0
- package/utils/generateInitialLexicalValue.d.ts +5 -0
- package/utils/generateInitialLexicalValue.js +30 -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 +163 -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/formatToHeading.d.ts +3 -0
- package/utils/nodes/formatToHeading.js +25 -0
- package/utils/nodes/formatToHeading.js.map +1 -0
- package/utils/nodes/formatToParagraph.d.ts +2 -0
- package/utils/nodes/formatToParagraph.js +20 -0
- package/utils/nodes/formatToParagraph.js.map +1 -0
- package/utils/nodes/formatToQuote.d.ts +2 -0
- package/utils/nodes/formatToQuote.js +25 -0
- package/utils/nodes/formatToQuote.js.map +1 -0
- package/utils/nodes/listNode.d.ts +11 -0
- package/utils/nodes/listNode.js +107 -0
- package/utils/nodes/listNode.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
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.LexicalHtmlRenderer = exports.BaseLexicalHtmlRenderer = void 0;
|
|
8
|
+
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
|
|
9
|
+
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
10
|
+
var _react = _interopRequireDefault(require("react"));
|
|
11
|
+
var _isValidLexicalData = require("../utils/isValidLexicalData");
|
|
12
|
+
var _generateInitialLexicalValue = require("../utils/generateInitialLexicalValue");
|
|
13
|
+
var _LexicalComposer = require("@lexical/react/LexicalComposer");
|
|
14
|
+
var _LexicalRichTextPlugin = require("@lexical/react/LexicalRichTextPlugin");
|
|
15
|
+
var _LexicalContentEditable = require("@lexical/react/LexicalContentEditable");
|
|
16
|
+
var _LexicalErrorBoundary = _interopRequireDefault(require("@lexical/react/LexicalErrorBoundary"));
|
|
17
|
+
var _LexicalUpdateStatePlugin = require("../plugins/LexicalUpdateStatePlugin");
|
|
18
|
+
var _webinyNodes = require("../nodes/webinyNodes");
|
|
19
|
+
var _webinyLexicalTheme = require("../themes/webinyLexicalTheme");
|
|
20
|
+
var _react2 = require("@emotion/react");
|
|
21
|
+
var _toTypographyEmotionMap = require("../utils/toTypographyEmotionMap");
|
|
22
|
+
var BaseLexicalHtmlRenderer = function BaseLexicalHtmlRenderer(_ref) {
|
|
23
|
+
var nodes = _ref.nodes,
|
|
24
|
+
value = _ref.value,
|
|
25
|
+
theme = _ref.theme,
|
|
26
|
+
themeEmotionMap = _ref.themeEmotionMap;
|
|
27
|
+
var initialConfig = {
|
|
28
|
+
editorState: (0, _isValidLexicalData.isValidLexicalData)(value) ? value : (0, _generateInitialLexicalValue.generateInitialLexicalValue)(),
|
|
29
|
+
namespace: "webiny",
|
|
30
|
+
onError: function onError(error) {
|
|
31
|
+
throw error;
|
|
32
|
+
},
|
|
33
|
+
editable: false,
|
|
34
|
+
nodes: [].concat((0, _toConsumableArray2.default)(_webinyNodes.WebinyNodes), (0, _toConsumableArray2.default)(nodes || [])),
|
|
35
|
+
theme: (0, _objectSpread2.default)((0, _objectSpread2.default)({}, _webinyLexicalTheme.webinyEditorTheme), {}, {
|
|
36
|
+
emotionMap: themeEmotionMap,
|
|
37
|
+
styles: theme.styles
|
|
38
|
+
})
|
|
39
|
+
};
|
|
40
|
+
return /*#__PURE__*/_react.default.createElement(_LexicalComposer.LexicalComposer, {
|
|
41
|
+
initialConfig: initialConfig
|
|
42
|
+
}, /*#__PURE__*/_react.default.createElement(_LexicalRichTextPlugin.RichTextPlugin, {
|
|
43
|
+
contentEditable: /*#__PURE__*/_react.default.createElement("div", {
|
|
44
|
+
className: "editor"
|
|
45
|
+
}, /*#__PURE__*/_react.default.createElement(_LexicalContentEditable.ContentEditable, null)),
|
|
46
|
+
ErrorBoundary: _LexicalErrorBoundary.default,
|
|
47
|
+
placeholder: null
|
|
48
|
+
}), /*#__PURE__*/_react.default.createElement(_LexicalUpdateStatePlugin.LexicalUpdateStatePlugin, {
|
|
49
|
+
value: value
|
|
50
|
+
}));
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* @description Main editor container
|
|
55
|
+
*/
|
|
56
|
+
exports.BaseLexicalHtmlRenderer = BaseLexicalHtmlRenderer;
|
|
57
|
+
var LexicalHtmlRenderer = function LexicalHtmlRenderer(props) {
|
|
58
|
+
return /*#__PURE__*/_react.default.createElement(_react2.ClassNames, null, function (_ref2) {
|
|
59
|
+
var _props$themeEmotionMa;
|
|
60
|
+
var css = _ref2.css;
|
|
61
|
+
var themeEmotionMap = (_props$themeEmotionMa = props === null || props === void 0 ? void 0 : props.themeEmotionMap) !== null && _props$themeEmotionMa !== void 0 ? _props$themeEmotionMa : (0, _toTypographyEmotionMap.toTypographyEmotionMap)(css, props.theme);
|
|
62
|
+
return /*#__PURE__*/_react.default.createElement(BaseLexicalHtmlRenderer, Object.assign({}, props, {
|
|
63
|
+
themeEmotionMap: themeEmotionMap
|
|
64
|
+
}));
|
|
65
|
+
});
|
|
66
|
+
};
|
|
67
|
+
exports.LexicalHtmlRenderer = LexicalHtmlRenderer;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["BaseLexicalHtmlRenderer","nodes","value","theme","themeEmotionMap","initialConfig","editorState","isValidLexicalData","generateInitialLexicalValue","namespace","onError","error","editable","WebinyNodes","webinyEditorTheme","emotionMap","styles","LexicalErrorBoundary","LexicalHtmlRenderer","props","css","toTypographyEmotionMap"],"sources":["LexicalHtmlRenderer.tsx"],"sourcesContent":["import React from \"react\";\nimport { LexicalValue, ThemeEmotionMap } from \"~/types\";\nimport { isValidLexicalData } from \"~/utils/isValidLexicalData\";\nimport { generateInitialLexicalValue } from \"~/utils/generateInitialLexicalValue\";\nimport { LexicalComposer } from \"@lexical/react/LexicalComposer\";\nimport { RichTextPlugin } from \"@lexical/react/LexicalRichTextPlugin\";\nimport { ContentEditable } from \"@lexical/react/LexicalContentEditable\";\nimport LexicalErrorBoundary from \"@lexical/react/LexicalErrorBoundary\";\nimport { LexicalUpdateStatePlugin } from \"~/plugins/LexicalUpdateStatePlugin\";\nimport { Klass, LexicalNode } from \"lexical\";\nimport { WebinyNodes } from \"~/nodes/webinyNodes\";\nimport { webinyEditorTheme, WebinyTheme } from \"~/themes/webinyLexicalTheme\";\nimport { ClassNames } from \"@emotion/react\";\nimport { toTypographyEmotionMap } from \"~/utils/toTypographyEmotionMap\";\n\ninterface LexicalHtmlRendererProps {\n nodes?: Klass<LexicalNode>[];\n value: LexicalValue | null;\n /*\n * @description Theme to be injected into lexical editor\n */\n theme: WebinyTheme;\n themeEmotionMap?: ThemeEmotionMap;\n}\n\nexport const BaseLexicalHtmlRenderer: React.FC<LexicalHtmlRendererProps> = ({\n nodes,\n value,\n theme,\n themeEmotionMap\n}) => {\n const initialConfig = {\n editorState: isValidLexicalData(value) ? value : generateInitialLexicalValue(),\n namespace: \"webiny\",\n onError: (error: Error) => {\n throw error;\n },\n editable: false,\n nodes: [...WebinyNodes, ...(nodes || [])],\n theme: { ...webinyEditorTheme, emotionMap: themeEmotionMap, styles: theme.styles }\n };\n\n return (\n <LexicalComposer initialConfig={initialConfig}>\n <RichTextPlugin\n contentEditable={\n <div className=\"editor\">\n <ContentEditable />\n </div>\n }\n ErrorBoundary={LexicalErrorBoundary}\n placeholder={null}\n />\n <LexicalUpdateStatePlugin value={value} />\n </LexicalComposer>\n );\n};\n\n/**\n * @description Main editor container\n */\nexport const LexicalHtmlRenderer: React.FC<LexicalHtmlRendererProps> = props => {\n return (\n <ClassNames>\n {({ css }) => {\n const themeEmotionMap =\n props?.themeEmotionMap ?? toTypographyEmotionMap(css, props.theme);\n return <BaseLexicalHtmlRenderer {...props} themeEmotionMap={themeEmotionMap} />;\n }}\n </ClassNames>\n );\n};\n"],"mappings":";;;;;;;;;AAAA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AAYO,IAAMA,uBAA2D,GAAG,SAA9DA,uBAA2D,OAKlE;EAAA,IAJFC,KAAK,QAALA,KAAK;IACLC,KAAK,QAALA,KAAK;IACLC,KAAK,QAALA,KAAK;IACLC,eAAe,QAAfA,eAAe;EAEf,IAAMC,aAAa,GAAG;IAClBC,WAAW,EAAE,IAAAC,sCAAkB,EAACL,KAAK,CAAC,GAAGA,KAAK,GAAG,IAAAM,wDAA2B,GAAE;IAC9EC,SAAS,EAAE,QAAQ;IACnBC,OAAO,EAAE,iBAACC,KAAY,EAAK;MACvB,MAAMA,KAAK;IACf,CAAC;IACDC,QAAQ,EAAE,KAAK;IACfX,KAAK,6CAAMY,wBAAW,oCAAMZ,KAAK,IAAI,EAAE,EAAE;IACzCE,KAAK,8DAAOW,qCAAiB;MAAEC,UAAU,EAAEX,eAAe;MAAEY,MAAM,EAAEb,KAAK,CAACa;IAAM;EACpF,CAAC;EAED,oBACI,6BAAC,gCAAe;IAAC,aAAa,EAAEX;EAAc,gBAC1C,6BAAC,qCAAc;IACX,eAAe,eACX;MAAK,SAAS,EAAC;IAAQ,gBACnB,6BAAC,uCAAe,OAAG,CAE1B;IACD,aAAa,EAAEY,6BAAqB;IACpC,WAAW,EAAE;EAAK,EACpB,eACF,6BAAC,kDAAwB;IAAC,KAAK,EAAEf;EAAM,EAAG,CAC5B;AAE1B,CAAC;;AAED;AACA;AACA;AAFA;AAGO,IAAMgB,mBAAuD,GAAG,SAA1DA,mBAAuD,CAAGC,KAAK,EAAI;EAC5E,oBACI,6BAAC,kBAAU,QACN,iBAAa;IAAA;IAAA,IAAVC,GAAG,SAAHA,GAAG;IACH,IAAMhB,eAAe,4BACjBe,KAAK,aAALA,KAAK,uBAALA,KAAK,CAAEf,eAAe,yEAAI,IAAAiB,8CAAsB,EAACD,GAAG,EAAED,KAAK,CAAChB,KAAK,CAAC;IACtE,oBAAO,6BAAC,uBAAuB,oBAAKgB,KAAK;MAAE,eAAe,EAAEf;IAAgB,GAAG;EACnF,CAAC,CACQ;AAErB,CAAC;AAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/// <reference types="web" />
|
|
2
|
+
import { FC } from "react";
|
|
3
|
+
interface HeadingToolbarProps {
|
|
4
|
+
anchorElem?: HTMLElement;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* Toolbar with actions specific for the heading elements from H1-H6.
|
|
8
|
+
* @param anchorElem
|
|
9
|
+
* @constructor
|
|
10
|
+
*/
|
|
11
|
+
export declare const HeadingToolbar: FC<HeadingToolbarProps>;
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.HeadingToolbar = void 0;
|
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
|
9
|
+
var _Toolbar = require("./Toolbar");
|
|
10
|
+
/**
|
|
11
|
+
* Toolbar with actions specific for the heading elements from H1-H6.
|
|
12
|
+
* @param anchorElem
|
|
13
|
+
* @constructor
|
|
14
|
+
*/
|
|
15
|
+
var HeadingToolbar = function HeadingToolbar(_ref) {
|
|
16
|
+
var _ref$anchorElem = _ref.anchorElem,
|
|
17
|
+
anchorElem = _ref$anchorElem === void 0 ? document.body : _ref$anchorElem;
|
|
18
|
+
return /*#__PURE__*/_react.default.createElement(_Toolbar.Toolbar, {
|
|
19
|
+
type: "heading",
|
|
20
|
+
anchorElem: anchorElem
|
|
21
|
+
});
|
|
22
|
+
};
|
|
23
|
+
exports.HeadingToolbar = HeadingToolbar;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["HeadingToolbar","anchorElem","document","body"],"sources":["HeadingToolbar.tsx"],"sourcesContent":["import React, { FC } from \"react\";\nimport { Toolbar } from \"~/components/Toolbar/Toolbar\";\n\ninterface HeadingToolbarProps {\n anchorElem?: HTMLElement;\n}\n\n/**\n * Toolbar with actions specific for the heading elements from H1-H6.\n * @param anchorElem\n * @constructor\n */\nexport const HeadingToolbar: FC<HeadingToolbarProps> = ({ anchorElem = document.body }) => {\n return <Toolbar type={\"heading\"} anchorElem={anchorElem} />;\n};\n"],"mappings":";;;;;;;AAAA;AACA;AAMA;AACA;AACA;AACA;AACA;AACO,IAAMA,cAAuC,GAAG,SAA1CA,cAAuC,OAAuC;EAAA,2BAAjCC,UAAU;IAAVA,UAAU,gCAAGC,QAAQ,CAACC,IAAI;EAChF,oBAAO,6BAAC,gBAAO;IAAC,IAAI,EAAE,SAAU;IAAC,UAAU,EAAEF;EAAW,EAAG;AAC/D,CAAC;AAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/// <reference types="web" />
|
|
2
|
+
import { FC } from "react";
|
|
3
|
+
interface ParagraphToolbarProps {
|
|
4
|
+
anchorElem?: HTMLElement;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* Toolbar with actions for rich text editing specific for the paragraph element <p>.
|
|
8
|
+
* @param anchorElem
|
|
9
|
+
* @constructor
|
|
10
|
+
*/
|
|
11
|
+
export declare const ParagraphToolbar: FC<ParagraphToolbarProps>;
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.ParagraphToolbar = void 0;
|
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
|
9
|
+
var _Toolbar = require("./Toolbar");
|
|
10
|
+
/**
|
|
11
|
+
* Toolbar with actions for rich text editing specific for the paragraph element <p>.
|
|
12
|
+
* @param anchorElem
|
|
13
|
+
* @constructor
|
|
14
|
+
*/
|
|
15
|
+
var ParagraphToolbar = function ParagraphToolbar(_ref) {
|
|
16
|
+
var _ref$anchorElem = _ref.anchorElem,
|
|
17
|
+
anchorElem = _ref$anchorElem === void 0 ? document.body : _ref$anchorElem;
|
|
18
|
+
return /*#__PURE__*/_react.default.createElement(_Toolbar.Toolbar, {
|
|
19
|
+
type: "paragraph",
|
|
20
|
+
anchorElem: anchorElem
|
|
21
|
+
});
|
|
22
|
+
};
|
|
23
|
+
exports.ParagraphToolbar = ParagraphToolbar;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["ParagraphToolbar","anchorElem","document","body"],"sources":["ParagraphToolbar.tsx"],"sourcesContent":["import React, { FC } from \"react\";\nimport { Toolbar } from \"~/components/Toolbar/Toolbar\";\n\ninterface ParagraphToolbarProps {\n anchorElem?: HTMLElement;\n}\n\n/**\n * Toolbar with actions for rich text editing specific for the paragraph element <p>.\n * @param anchorElem\n * @constructor\n */\nexport const ParagraphToolbar: FC<ParagraphToolbarProps> = ({ anchorElem = document.body }) => {\n return <Toolbar type={\"paragraph\"} anchorElem={anchorElem} />;\n};\n"],"mappings":";;;;;;;AAAA;AACA;AAMA;AACA;AACA;AACA;AACA;AACO,IAAMA,gBAA2C,GAAG,SAA9CA,gBAA2C,OAAuC;EAAA,2BAAjCC,UAAU;IAAVA,UAAU,gCAAGC,QAAQ,CAACC,IAAI;EACpF,oBAAO,6BAAC,gBAAO;IAAC,IAAI,EAAE,WAAY;IAAC,UAAU,EAAEF;EAAW,EAAG;AACjE,CAAC;AAAC"}
|
|
@@ -0,0 +1,435 @@
|
|
|
1
|
+
.floating-text-format-popup {
|
|
2
|
+
display: flex;
|
|
3
|
+
padding: 4px;
|
|
4
|
+
vertical-align: middle;
|
|
5
|
+
position: absolute;
|
|
6
|
+
top: 0;
|
|
7
|
+
left: 0;
|
|
8
|
+
z-index: 30;
|
|
9
|
+
opacity: 0;
|
|
10
|
+
background-color: #fff;
|
|
11
|
+
box-shadow: 0px 5px 10px rgba(0, 0, 0, 0.3);
|
|
12
|
+
border-radius: 8px;
|
|
13
|
+
transition: opacity 0.5s;
|
|
14
|
+
height: 35px;
|
|
15
|
+
will-change: transform;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.floating-text-format-popup button.popup-item {
|
|
19
|
+
border: 0;
|
|
20
|
+
display: flex;
|
|
21
|
+
background: none;
|
|
22
|
+
border-radius: 10px;
|
|
23
|
+
padding: 8px;
|
|
24
|
+
cursor: pointer;
|
|
25
|
+
vertical-align: middle;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.floating-text-format-popup button.popup-item:disabled {
|
|
29
|
+
cursor: not-allowed;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
.floating-text-format-popup button.popup-item.spaced {
|
|
33
|
+
margin-right: 2px;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
.floating-text-format-popup button.popup-item i.format {
|
|
37
|
+
background-size: contain;
|
|
38
|
+
display: inline-block;
|
|
39
|
+
height: 18px;
|
|
40
|
+
width: 18px;
|
|
41
|
+
margin-top: 2px;
|
|
42
|
+
vertical-align: -0.25em;
|
|
43
|
+
display: flex;
|
|
44
|
+
opacity: 0.6;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
.floating-text-format-popup button.popup-item:disabled i.format {
|
|
48
|
+
opacity: 0.2;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
.floating-text-format-popup button.popup-item.active {
|
|
52
|
+
background-color: rgba(223, 232, 250, 0.3);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
.floating-text-format-popup button.popup-item.active i {
|
|
56
|
+
opacity: 1;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
.floating-text-format-popup .popup-item:hover:not([disabled]) {
|
|
60
|
+
background-color: #eee;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
.floating-text-format-popup select.popup-item {
|
|
64
|
+
border: 0;
|
|
65
|
+
display: flex;
|
|
66
|
+
background: none;
|
|
67
|
+
border-radius: 10px;
|
|
68
|
+
padding: 8px;
|
|
69
|
+
vertical-align: middle;
|
|
70
|
+
-webkit-appearance: none;
|
|
71
|
+
-moz-appearance: none;
|
|
72
|
+
width: 70px;
|
|
73
|
+
font-size: 14px;
|
|
74
|
+
color: #777;
|
|
75
|
+
text-overflow: ellipsis;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
.floating-text-format-popup select.code-language {
|
|
79
|
+
text-transform: capitalize;
|
|
80
|
+
width: 130px;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
.floating-text-format-popup .popup-item .text {
|
|
84
|
+
display: flex;
|
|
85
|
+
line-height: 20px;
|
|
86
|
+
width: 200px;
|
|
87
|
+
vertical-align: middle;
|
|
88
|
+
font-size: 14px;
|
|
89
|
+
color: #777;
|
|
90
|
+
text-overflow: ellipsis;
|
|
91
|
+
width: 70px;
|
|
92
|
+
overflow: hidden;
|
|
93
|
+
height: 20px;
|
|
94
|
+
text-align: left;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
.floating-text-format-popup .popup-item .icon {
|
|
98
|
+
display: flex;
|
|
99
|
+
width: 20px;
|
|
100
|
+
height: 20px;
|
|
101
|
+
user-select: none;
|
|
102
|
+
margin-right: 8px;
|
|
103
|
+
line-height: 16px;
|
|
104
|
+
background-size: contain;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
.floating-text-format-popup i.chevron-down {
|
|
108
|
+
margin-top: 3px;
|
|
109
|
+
width: 16px;
|
|
110
|
+
height: 16px;
|
|
111
|
+
display: flex;
|
|
112
|
+
user-select: none;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
.floating-text-format-popup i.chevron-down.inside {
|
|
116
|
+
width: 16px;
|
|
117
|
+
height: 16px;
|
|
118
|
+
display: flex;
|
|
119
|
+
margin-left: -25px;
|
|
120
|
+
margin-top: 11px;
|
|
121
|
+
margin-right: 10px;
|
|
122
|
+
pointer-events: none;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
.floating-text-format-popup .divider {
|
|
126
|
+
width: 1px;
|
|
127
|
+
background-color: #eee;
|
|
128
|
+
margin: 0 4px;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
i.bold {
|
|
132
|
+
background-image: url("../../images/icons/type-bold.svg");
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
i.italic {
|
|
136
|
+
background-image: url("../../images/icons/type-italic.svg");
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
i.code {
|
|
140
|
+
background-image: url("../../images/icons/code.svg");
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
i.underline {
|
|
144
|
+
background-image: url("../../images/icons/type-underline.svg");
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
i.strikethrough {
|
|
148
|
+
background-image: url("../../images/icons/type-strikethrough.svg");
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
i.link {
|
|
152
|
+
background-image: url("../../images/icons/link.svg");
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
i.quote {
|
|
156
|
+
background-image: url("../../images/icons/chat-square-quote.svg");
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
.icon.left-align,
|
|
160
|
+
i.left-align {
|
|
161
|
+
background-image: url("../../images/icons/text-left.svg");
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
i.center-align {
|
|
165
|
+
background-image: url("../../images/icons/text-center.svg");
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
i.right-align {
|
|
169
|
+
background-image: url("../../images/icons/text-right.svg");
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
i.indent {
|
|
173
|
+
background-image: url("../../images/icons/indent.svg");
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
i.outdent {
|
|
177
|
+
background-image: url("../../images/icons/outdent.svg");
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
i.justify-align {
|
|
181
|
+
background-image: url("../../images/icons/justify.svg");
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
i.chevron-down {
|
|
185
|
+
background-color: transparent;
|
|
186
|
+
background-size: contain;
|
|
187
|
+
display: inline-block;
|
|
188
|
+
height: 8px;
|
|
189
|
+
width: 8px;
|
|
190
|
+
background-image: url("../../images/icons/chevron-down.svg");
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
|
|
194
|
+
.icon.bullet-list,
|
|
195
|
+
.icon.bullet {
|
|
196
|
+
background-image: url("../../images/icons/list-ul.svg");
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
.icon.numbered-list,
|
|
200
|
+
.icon.number {
|
|
201
|
+
background-image: url("../../images/icons/list-ol.svg");
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
.link-editor .button.active,
|
|
205
|
+
.toolbar .button.active {
|
|
206
|
+
background-color: rgb(223, 232, 250);
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
i.font-color, .icon.font-color {
|
|
210
|
+
background-image: url("../../images/icons/font-color.svg");
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
.floating-text-format-popup button.toolbar-item {
|
|
214
|
+
border: 0;
|
|
215
|
+
display: flex;
|
|
216
|
+
background: none;
|
|
217
|
+
border-radius: 10px;
|
|
218
|
+
padding: 8px;
|
|
219
|
+
cursor: pointer;
|
|
220
|
+
vertical-align: middle;
|
|
221
|
+
flex-shrink: 0;
|
|
222
|
+
align-items: center;
|
|
223
|
+
justify-content: space-between;
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
.floating-text-format-popup button.toolbar-item:disabled {
|
|
227
|
+
cursor: not-allowed;
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
.floating-text-format-popup button.toolbar-item.spaced {
|
|
231
|
+
margin-right: 2px;
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
.floating-text-format-popup button.toolbar-item i.format {
|
|
235
|
+
background-size: contain;
|
|
236
|
+
display: inline-block;
|
|
237
|
+
height: 18px;
|
|
238
|
+
width: 18px;
|
|
239
|
+
vertical-align: -0.25em;
|
|
240
|
+
display: flex;
|
|
241
|
+
opacity: 0.6;
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
.floating-text-format-popup button.toolbar-item:disabled .icon,
|
|
245
|
+
.floating-text-format-popup button.toolbar-item:disabled .text,
|
|
246
|
+
.floating-text-format-popup button.toolbar-item:disabled i.format,
|
|
247
|
+
.floating-text-format-popup button.toolbar-item:disabled .chevron-down {
|
|
248
|
+
opacity: 0.2;
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
.floating-text-format-popup button.toolbar-item.active {
|
|
252
|
+
background-color: rgba(223, 232, 250, 0.3);
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
.floating-text-format-popup button.toolbar-item.active i {
|
|
256
|
+
opacity: 1;
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
.floating-text-format-popup .toolbar-item:hover:not([disabled]) {
|
|
260
|
+
background-color: #eee;
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
.floating-text-format-popup .toolbar-item.font-family .text {
|
|
264
|
+
display: block;
|
|
265
|
+
max-width: 40px;
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
.floating-text-format-popup .code-language {
|
|
269
|
+
width: 150px;
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
.floating-text-format-popup .toolbar-item .text {
|
|
273
|
+
display: flex;
|
|
274
|
+
line-height: 20px;
|
|
275
|
+
vertical-align: middle;
|
|
276
|
+
font-size: 14px;
|
|
277
|
+
color: #777;
|
|
278
|
+
text-overflow: ellipsis;
|
|
279
|
+
overflow: hidden;
|
|
280
|
+
height: 20px;
|
|
281
|
+
text-align: left;
|
|
282
|
+
padding-right: 10px;
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
.floating-text-format-popup .toolbar-item .icon {
|
|
286
|
+
display: flex;
|
|
287
|
+
width: 20px;
|
|
288
|
+
height: 20px;
|
|
289
|
+
user-select: none;
|
|
290
|
+
margin-right: 8px;
|
|
291
|
+
line-height: 16px;
|
|
292
|
+
background-size: contain;
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
.floating-text-format-popup i.chevron-down {
|
|
296
|
+
margin-top: 3px;
|
|
297
|
+
width: 16px;
|
|
298
|
+
height: 16px;
|
|
299
|
+
display: flex;
|
|
300
|
+
user-select: none;
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
.floating-text-format-popup i.chevron-down.inside {
|
|
304
|
+
width: 16px;
|
|
305
|
+
height: 16px;
|
|
306
|
+
display: flex;
|
|
307
|
+
margin-left: -25px;
|
|
308
|
+
margin-top: 11px;
|
|
309
|
+
margin-right: 10px;
|
|
310
|
+
pointer-events: none;
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
.toolbar .divider {
|
|
314
|
+
width: 1px;
|
|
315
|
+
background-color: #eee;
|
|
316
|
+
margin: 0 4px;
|
|
317
|
+
}
|
|
318
|
+
.lexical-dropdown-container {
|
|
319
|
+
position: absolute;
|
|
320
|
+
bottom: -5px;
|
|
321
|
+
left: 0;
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
.lexical-dropdown {
|
|
325
|
+
z-index: 10;
|
|
326
|
+
display: block;
|
|
327
|
+
position: fixed;
|
|
328
|
+
box-shadow: 0 12px 28px 0 rgba(0, 0, 0, 0.2), 0 2px 4px 0 rgba(0, 0, 0, 0.1),
|
|
329
|
+
inset 0 0 0 1px rgba(255, 255, 255, 0.5);
|
|
330
|
+
border-radius: 8px;
|
|
331
|
+
min-height: 40px;
|
|
332
|
+
background-color: #fff;
|
|
333
|
+
max-height: 250px;
|
|
334
|
+
overflow: hidden;
|
|
335
|
+
overflow-y: auto;
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
.lexical-dropdown.no-scroll {
|
|
339
|
+
max-height: inherit;
|
|
340
|
+
overflow: auto;
|
|
341
|
+
overflow-y: auto;
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
.lexical-dropdown .item {
|
|
345
|
+
margin: 0 8px 0 8px;
|
|
346
|
+
padding: 8px;
|
|
347
|
+
color: #050505;
|
|
348
|
+
cursor: pointer;
|
|
349
|
+
line-height: 16px;
|
|
350
|
+
font-size: 15px;
|
|
351
|
+
display: flex;
|
|
352
|
+
align-content: center;
|
|
353
|
+
flex-direction: row;
|
|
354
|
+
flex-shrink: 0;
|
|
355
|
+
justify-content: space-between;
|
|
356
|
+
background-color: #fff;
|
|
357
|
+
border-radius: 8px;
|
|
358
|
+
border: 0;
|
|
359
|
+
max-width: 250px;
|
|
360
|
+
min-width: 100px;
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
.lexical-dropdown .item.fontsize-item,
|
|
364
|
+
.lexical-dropdown .item.fontsize-item .text {
|
|
365
|
+
min-width: unset;
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
.lexical-dropdown .item .active {
|
|
369
|
+
display: flex;
|
|
370
|
+
width: 20px;
|
|
371
|
+
height: 20px;
|
|
372
|
+
background-size: contain;
|
|
373
|
+
}
|
|
374
|
+
|
|
375
|
+
.lexical-dropdown .item:first-child {
|
|
376
|
+
margin-top: 8px;
|
|
377
|
+
}
|
|
378
|
+
|
|
379
|
+
.lexical-dropdown .item:last-child {
|
|
380
|
+
margin-bottom: 8px;
|
|
381
|
+
}
|
|
382
|
+
|
|
383
|
+
.lexical-dropdown .item:hover {
|
|
384
|
+
background-color: #eee;
|
|
385
|
+
}
|
|
386
|
+
|
|
387
|
+
.lexical-dropdown .item .text {
|
|
388
|
+
display: flex;
|
|
389
|
+
line-height: 20px;
|
|
390
|
+
flex-grow: 1;
|
|
391
|
+
min-width: 150px;
|
|
392
|
+
}
|
|
393
|
+
|
|
394
|
+
.lexical-dropdown .item .icon {
|
|
395
|
+
display: flex;
|
|
396
|
+
width: 20px;
|
|
397
|
+
height: 20px;
|
|
398
|
+
user-select: none;
|
|
399
|
+
margin-right: 12px;
|
|
400
|
+
line-height: 16px;
|
|
401
|
+
background-size: contain;
|
|
402
|
+
background-position: center;
|
|
403
|
+
background-repeat: no-repeat;
|
|
404
|
+
}
|
|
405
|
+
|
|
406
|
+
.lexical-dropdown .divider {
|
|
407
|
+
width: auto;
|
|
408
|
+
background-color: #eee;
|
|
409
|
+
margin: 4px 8px;
|
|
410
|
+
height: 1px;
|
|
411
|
+
}
|
|
412
|
+
|
|
413
|
+
@media screen and (max-width: 1100px) {
|
|
414
|
+
.dropdown-button-text {
|
|
415
|
+
display: none !important;
|
|
416
|
+
}
|
|
417
|
+
.font-size .dropdown-button-text {
|
|
418
|
+
display: flex !important;
|
|
419
|
+
}
|
|
420
|
+
.code-language .dropdown-button-text {
|
|
421
|
+
display: flex !important;
|
|
422
|
+
}
|
|
423
|
+
}
|
|
424
|
+
|
|
425
|
+
button.item i {
|
|
426
|
+
opacity: 0.6;
|
|
427
|
+
}
|
|
428
|
+
|
|
429
|
+
button.item.dropdown-item-active {
|
|
430
|
+
background-color: rgba(223, 232, 250, 0.3);
|
|
431
|
+
}
|
|
432
|
+
|
|
433
|
+
button.item.dropdown-item-active i {
|
|
434
|
+
opacity: 1;
|
|
435
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/// <reference types="web" />
|
|
2
|
+
import React from "react";
|
|
3
|
+
import "./Toolbar.css";
|
|
4
|
+
import { ToolbarType } from "../../types";
|
|
5
|
+
export interface ToolbarProps {
|
|
6
|
+
type: ToolbarType;
|
|
7
|
+
anchorElem: HTMLElement;
|
|
8
|
+
children?: React.ReactNode;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* @description Main toolbar container
|
|
12
|
+
*/
|
|
13
|
+
export declare const Toolbar: import("@webiny/react-composition").ComposableFC<ToolbarProps>;
|