@webiny/lexical-editor 0.0.0-unstable.06b2ede40f
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/image.d.ts +6 -0
- package/commands/image.js +4 -0
- package/commands/image.js.map +1 -0
- package/commands/index.d.ts +5 -0
- package/commands/index.js +7 -0
- package/commands/index.js.map +1 -0
- package/commands/list.d.ts +7 -0
- package/commands/list.js +6 -0
- package/commands/list.js.map +1 -0
- package/commands/quote.d.ts +5 -0
- package/commands/quote.js +4 -0
- package/commands/quote.js.map +1 -0
- package/commands/toolbar.d.ts +1 -0
- package/commands/toolbar.js +4 -0
- package/commands/toolbar.js.map +1 -0
- package/commands/typography.d.ts +8 -0
- package/commands/typography.js +4 -0
- package/commands/typography.js.map +1 -0
- package/components/Editor/EnsureHeadingTagPlugin.d.ts +6 -0
- package/components/Editor/EnsureHeadingTagPlugin.js +20 -0
- package/components/Editor/EnsureHeadingTagPlugin.js.map +1 -0
- package/components/Editor/HeadingEditor.d.ts +7 -0
- package/components/Editor/HeadingEditor.js +22 -0
- package/components/Editor/HeadingEditor.js.map +1 -0
- package/components/Editor/ParagraphEditor.d.ts +7 -0
- package/components/Editor/ParagraphEditor.js +22 -0
- package/components/Editor/ParagraphEditor.js.map +1 -0
- package/components/Editor/RichTextEditor.d.ts +49 -0
- package/components/Editor/RichTextEditor.js +133 -0
- package/components/Editor/RichTextEditor.js.map +1 -0
- package/components/Editor/normalizeInputValue.d.ts +6 -0
- package/components/Editor/normalizeInputValue.js +16 -0
- package/components/Editor/normalizeInputValue.js.map +1 -0
- package/components/LexicalEditorConfig/LexicalEditorConfig.d.ts +20 -0
- package/components/LexicalEditorConfig/LexicalEditorConfig.js +63 -0
- package/components/LexicalEditorConfig/LexicalEditorConfig.js.map +1 -0
- package/components/LexicalEditorConfig/components/Node.d.ts +14 -0
- package/components/LexicalEditorConfig/components/Node.js +30 -0
- package/components/LexicalEditorConfig/components/Node.js.map +1 -0
- package/components/LexicalEditorConfig/components/Plugin.d.ts +13 -0
- package/components/LexicalEditorConfig/components/Plugin.js +30 -0
- package/components/LexicalEditorConfig/components/Plugin.js.map +1 -0
- package/components/LexicalEditorConfig/components/ToolbarElement.d.ts +13 -0
- package/components/LexicalEditorConfig/components/ToolbarElement.js +30 -0
- package/components/LexicalEditorConfig/components/ToolbarElement.js.map +1 -0
- package/components/LexicalHtmlRenderer.d.ts +14 -0
- package/components/LexicalHtmlRenderer.js +55 -0
- package/components/LexicalHtmlRenderer.js.map +1 -0
- package/components/Toolbar/StaticToolbar.css +260 -0
- package/components/Toolbar/StaticToolbar.d.ts +5 -0
- package/components/Toolbar/StaticToolbar.js +22 -0
- package/components/Toolbar/StaticToolbar.js.map +1 -0
- package/components/Toolbar/Toolbar.css +643 -0
- package/components/Toolbar/Toolbar.d.ts +6 -0
- package/components/Toolbar/Toolbar.js +148 -0
- package/components/Toolbar/Toolbar.js.map +1 -0
- package/components/ToolbarActions/BoldAction.d.ts +2 -0
- package/components/ToolbarActions/BoldAction.js +25 -0
- package/components/ToolbarActions/BoldAction.js.map +1 -0
- package/components/ToolbarActions/BulletListAction.d.ts +2 -0
- package/components/ToolbarActions/BulletListAction.js +40 -0
- package/components/ToolbarActions/BulletListAction.js.map +1 -0
- package/components/ToolbarActions/CodeHighlightAction.d.ts +2 -0
- package/components/ToolbarActions/CodeHighlightAction.js +25 -0
- package/components/ToolbarActions/CodeHighlightAction.js.map +1 -0
- package/components/ToolbarActions/FontColorAction.d.ts +29 -0
- package/components/ToolbarActions/FontColorAction.js +50 -0
- package/components/ToolbarActions/FontColorAction.js.map +1 -0
- package/components/ToolbarActions/FontSizeAction.d.ts +14 -0
- package/components/ToolbarActions/FontSizeAction.js +91 -0
- package/components/ToolbarActions/FontSizeAction.js.map +1 -0
- package/components/ToolbarActions/ImageAction.d.ts +2 -0
- package/components/ToolbarActions/ImageAction.js +37 -0
- package/components/ToolbarActions/ImageAction.js.map +1 -0
- package/components/ToolbarActions/ItalicAction.d.ts +2 -0
- package/components/ToolbarActions/ItalicAction.js +25 -0
- package/components/ToolbarActions/ItalicAction.js.map +1 -0
- package/components/ToolbarActions/LinkAction.d.ts +2 -0
- package/components/ToolbarActions/LinkAction.js +37 -0
- package/components/ToolbarActions/LinkAction.js.map +1 -0
- package/components/ToolbarActions/NumberedListAction.d.ts +2 -0
- package/components/ToolbarActions/NumberedListAction.js +48 -0
- package/components/ToolbarActions/NumberedListAction.js.map +1 -0
- package/components/ToolbarActions/QuoteAction.d.ts +2 -0
- package/components/ToolbarActions/QuoteAction.js +33 -0
- package/components/ToolbarActions/QuoteAction.js.map +1 -0
- package/components/ToolbarActions/TextAlignmentAction.d.ts +29 -0
- package/components/ToolbarActions/TextAlignmentAction.js +61 -0
- package/components/ToolbarActions/TextAlignmentAction.js.map +1 -0
- package/components/ToolbarActions/TypographyAction.d.ts +29 -0
- package/components/ToolbarActions/TypographyAction.js +108 -0
- package/components/ToolbarActions/TypographyAction.js.map +1 -0
- package/components/ToolbarActions/UnderlineAction.d.ts +2 -0
- package/components/ToolbarActions/UnderlineAction.js +24 -0
- package/components/ToolbarActions/UnderlineAction.js.map +1 -0
- package/context/FontColorActionContext.d.ts +6 -0
- package/context/FontColorActionContext.js +4 -0
- package/context/FontColorActionContext.js.map +1 -0
- package/context/RichTextEditorContext.d.ts +19 -0
- package/context/RichTextEditorContext.js +21 -0
- package/context/RichTextEditorContext.js.map +1 -0
- package/context/SharedHistoryContext.d.ts +10 -0
- package/context/SharedHistoryContext.js +19 -0
- package/context/SharedHistoryContext.js.map +1 -0
- package/context/TextAlignmentActionContextProps.d.ts +9 -0
- package/context/TextAlignmentActionContextProps.js +4 -0
- package/context/TextAlignmentActionContextProps.js.map +1 -0
- package/context/TypographyActionContext.d.ts +8 -0
- package/context/TypographyActionContext.js +4 -0
- package/context/TypographyActionContext.js.map +1 -0
- package/hooks/index.d.ts +8 -0
- package/hooks/index.js +10 -0
- package/hooks/index.js.map +1 -0
- package/hooks/useCurrentElement.d.ts +7 -0
- package/hooks/useCurrentElement.js +27 -0
- package/hooks/useCurrentElement.js.map +1 -0
- package/hooks/useCurrentSelection.d.ts +13 -0
- package/hooks/useCurrentSelection.js +57 -0
- package/hooks/useCurrentSelection.js.map +1 -0
- package/hooks/useFontColorPicker.d.ts +2 -0
- package/hooks/useFontColorPicker.js +11 -0
- package/hooks/useFontColorPicker.js.map +1 -0
- package/hooks/useIsMounted.d.ts +1 -0
- package/hooks/useIsMounted.js +12 -0
- package/hooks/useIsMounted.js.map +1 -0
- package/hooks/useList.d.ts +2 -0
- package/hooks/useList.js +50 -0
- package/hooks/useList.js.map +1 -0
- package/hooks/useQuote.d.ts +2 -0
- package/hooks/useQuote.js +17 -0
- package/hooks/useQuote.js.map +1 -0
- package/hooks/useRichTextEditor.d.ts +2 -0
- package/hooks/useRichTextEditor.js +11 -0
- package/hooks/useRichTextEditor.js.map +1 -0
- package/hooks/useTextAlignmentAction.d.ts +1 -0
- package/hooks/useTextAlignmentAction.js +11 -0
- package/hooks/useTextAlignmentAction.js.map +1 -0
- package/hooks/useTypographyAction.d.ts +1 -0
- package/hooks/useTypographyAction.js +11 -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/insert-image.svg +4 -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 +37 -0
- package/index.js +50 -0
- package/index.js.map +1 -0
- package/package.json +40 -0
- package/plugins/BlurEventPlugin/BlurEventPlugin.d.ts +7 -0
- package/plugins/BlurEventPlugin/BlurEventPlugin.js +20 -0
- package/plugins/BlurEventPlugin/BlurEventPlugin.js.map +1 -0
- package/plugins/CodeHighlightPlugin/CodeHighlightPlugin.d.ts +1 -0
- package/plugins/CodeHighlightPlugin/CodeHighlightPlugin.js +14 -0
- package/plugins/CodeHighlightPlugin/CodeHighlightPlugin.js.map +1 -0
- package/plugins/CodeHighlightPlugin/index.d.ts +1 -0
- package/plugins/CodeHighlightPlugin/index.js +3 -0
- package/plugins/CodeHighlightPlugin/index.js.map +1 -0
- package/plugins/FloatingLinkEditorPlugin/FloatingLinkEditor.d.ts +16 -0
- package/plugins/FloatingLinkEditorPlugin/FloatingLinkEditor.js +158 -0
- package/plugins/FloatingLinkEditorPlugin/FloatingLinkEditor.js.map +1 -0
- package/plugins/FloatingLinkEditorPlugin/FloatingLinkEditorController.d.ts +8 -0
- package/plugins/FloatingLinkEditorPlugin/FloatingLinkEditorController.js +62 -0
- package/plugins/FloatingLinkEditorPlugin/FloatingLinkEditorController.js.map +1 -0
- package/plugins/FloatingLinkEditorPlugin/FloatingLinkEditorPlugin.css +176 -0
- package/plugins/FloatingLinkEditorPlugin/FloatingLinkEditorPlugin.d.ts +7 -0
- package/plugins/FloatingLinkEditorPlugin/FloatingLinkEditorPlugin.js +14 -0
- package/plugins/FloatingLinkEditorPlugin/FloatingLinkEditorPlugin.js.map +1 -0
- package/plugins/FloatingLinkEditorPlugin/LinkEditForm.d.ts +8 -0
- package/plugins/FloatingLinkEditorPlugin/LinkEditForm.js +104 -0
- package/plugins/FloatingLinkEditorPlugin/LinkEditForm.js.map +1 -0
- package/plugins/FloatingLinkEditorPlugin/LinkPreviewForm.d.ts +9 -0
- package/plugins/FloatingLinkEditorPlugin/LinkPreviewForm.js +34 -0
- package/plugins/FloatingLinkEditorPlugin/LinkPreviewForm.js.map +1 -0
- package/plugins/FloatingLinkEditorPlugin/index.d.ts +1 -0
- package/plugins/FloatingLinkEditorPlugin/index.js +3 -0
- package/plugins/FloatingLinkEditorPlugin/index.js.map +1 -0
- package/plugins/FloatingLinkEditorPlugin/isChildOfLinkEditor.d.ts +1 -0
- package/plugins/FloatingLinkEditorPlugin/isChildOfLinkEditor.js +12 -0
- package/plugins/FloatingLinkEditorPlugin/isChildOfLinkEditor.js.map +1 -0
- package/plugins/FontColorPlugin/FontColorPlugin.d.ts +1 -0
- package/plugins/FontColorPlugin/FontColorPlugin.js +27 -0
- package/plugins/FontColorPlugin/FontColorPlugin.js.map +1 -0
- package/plugins/FontColorPlugin/applyColorToNode.d.ts +3 -0
- package/plugins/FontColorPlugin/applyColorToNode.js +8 -0
- package/plugins/FontColorPlugin/applyColorToNode.js.map +1 -0
- package/plugins/FontColorPlugin/applyColorToSelection.d.ts +3 -0
- package/plugins/FontColorPlugin/applyColorToSelection.js +66 -0
- package/plugins/FontColorPlugin/applyColorToSelection.js.map +1 -0
- package/plugins/ImagesPlugin/ImagesPlugin.d.ts +12 -0
- package/plugins/ImagesPlugin/ImagesPlugin.js +151 -0
- package/plugins/ImagesPlugin/ImagesPlugin.js.map +1 -0
- package/plugins/LinkPlugin/LinkPlugin.d.ts +5 -0
- package/plugins/LinkPlugin/LinkPlugin.js +59 -0
- package/plugins/LinkPlugin/LinkPlugin.js.map +1 -0
- package/plugins/ListPLugin/ListPlugin.d.ts +1 -0
- package/plugins/ListPLugin/ListPlugin.js +17 -0
- package/plugins/ListPLugin/ListPlugin.js.map +1 -0
- package/plugins/QuoteNodePlugin/QuoteNodePlugin.d.ts +1 -0
- package/plugins/QuoteNodePlugin/QuoteNodePlugin.js +18 -0
- package/plugins/QuoteNodePlugin/QuoteNodePlugin.js.map +1 -0
- package/plugins/StateHandlingPlugin.d.ts +8 -0
- package/plugins/StateHandlingPlugin.js +75 -0
- package/plugins/StateHandlingPlugin.js.map +1 -0
- package/plugins/TypographyPlugin/TypographyPlugin.d.ts +1 -0
- package/plugins/TypographyPlugin/TypographyPlugin.js +27 -0
- package/plugins/TypographyPlugin/TypographyPlugin.js.map +1 -0
- package/types.d.ts +12 -0
- package/types.js +9 -0
- package/types.js.map +1 -0
- package/ui/ContentEditable.css +22 -0
- package/ui/ContentEditable.d.ts +12 -0
- package/ui/ContentEditable.js +19 -0
- package/ui/ContentEditable.js.map +1 -0
- package/ui/Divider.d.ts +2 -0
- package/ui/Divider.js +8 -0
- package/ui/Divider.js.map +1 -0
- package/ui/DropDown.d.ts +25 -0
- package/ui/DropDown.js +182 -0
- package/ui/DropDown.js.map +1 -0
- package/ui/ImageResizer.d.ts +24 -0
- package/ui/ImageResizer.js +211 -0
- package/ui/ImageResizer.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 +97 -0
- package/ui/LinkPreview.js.map +1 -0
- package/ui/Placeholder.css +20 -0
- package/ui/Placeholder.d.ts +15 -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 +34 -0
- package/ui/TextInput.js.map +1 -0
- package/ui/ToolbarActionDialog.d.ts +11 -0
- package/ui/ToolbarActionDialog.js +77 -0
- package/ui/ToolbarActionDialog.js.map +1 -0
- package/utils/canUseDOM.d.ts +1 -0
- package/utils/canUseDOM.js +3 -0
- package/utils/canUseDOM.js.map +1 -0
- package/utils/files.d.ts +11 -0
- package/utils/files.js +21 -0
- package/utils/files.js.map +1 -0
- package/utils/getDOMRangeRect.d.ts +8 -0
- package/utils/getDOMRangeRect.js +23 -0
- package/utils/getDOMRangeRect.js.map +1 -0
- package/utils/getSelectedNode.d.ts +2 -0
- package/utils/getSelectedNode.js +25 -0
- package/utils/getSelectedNode.js.map +1 -0
- package/utils/getTransparentImage.d.ts +1 -0
- package/utils/getTransparentImage.js +5 -0
- package/utils/getTransparentImage.js.map +1 -0
- package/utils/insertImage.d.ts +2 -0
- package/utils/insertImage.js +16 -0
- package/utils/insertImage.js.map +1 -0
- package/utils/isAnchorLink.d.ts +1 -0
- package/utils/isAnchorLink.js +5 -0
- package/utils/isAnchorLink.js.map +1 -0
- package/utils/isChildOfFloatingToolbar.d.ts +1 -0
- package/utils/isChildOfFloatingToolbar.js +12 -0
- package/utils/isChildOfFloatingToolbar.js.map +1 -0
- package/utils/isHTMLElement.d.ts +8 -0
- package/utils/isHTMLElement.js +12 -0
- package/utils/isHTMLElement.js.map +1 -0
- package/utils/isValidJSON.d.ts +1 -0
- package/utils/isValidJSON.js +13 -0
- package/utils/isValidJSON.js.map +1 -0
- package/utils/isValidLexicalData.d.ts +4 -0
- package/utils/isValidLexicalData.js +24 -0
- package/utils/isValidLexicalData.js.map +1 -0
- package/utils/point.d.ts +21 -0
- package/utils/point.js +49 -0
- package/utils/point.js.map +1 -0
- package/utils/rect.d.ts +45 -0
- package/utils/rect.js +130 -0
- package/utils/rect.js.map +1 -0
- package/utils/sanitizeUrl.d.ts +1 -0
- package/utils/sanitizeUrl.js +25 -0
- package/utils/sanitizeUrl.js.map +1 -0
- package/utils/setFloatingElemPosition.d.ts +1 -0
- package/utils/setFloatingElemPosition.js +30 -0
- package/utils/setFloatingElemPosition.js.map +1 -0
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { Property } from "@webiny/react-properties";
|
|
3
|
+
export const Node = ({
|
|
4
|
+
name,
|
|
5
|
+
node,
|
|
6
|
+
after = undefined,
|
|
7
|
+
before = undefined,
|
|
8
|
+
remove = false
|
|
9
|
+
}) => {
|
|
10
|
+
const placeBefore = before !== undefined ? `node:${before}` : undefined;
|
|
11
|
+
const placeAfter = after !== undefined ? `node:${after}` : undefined;
|
|
12
|
+
return /*#__PURE__*/React.createElement(Property, {
|
|
13
|
+
id: `nodes:${name}`,
|
|
14
|
+
name: "nodes",
|
|
15
|
+
array: true,
|
|
16
|
+
before: placeBefore,
|
|
17
|
+
after: placeAfter,
|
|
18
|
+
remove: remove
|
|
19
|
+
}, /*#__PURE__*/React.createElement(Property, {
|
|
20
|
+
id: `node:${name}:name`,
|
|
21
|
+
name: "name",
|
|
22
|
+
value: name
|
|
23
|
+
}), node ? /*#__PURE__*/React.createElement(Property, {
|
|
24
|
+
id: `node:${name}:node`,
|
|
25
|
+
name: "node",
|
|
26
|
+
value: node
|
|
27
|
+
}) : null);
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
//# sourceMappingURL=Node.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["React","Property","Node","name","node","after","undefined","before","remove","placeBefore","placeAfter","createElement","id","array","value"],"sources":["Node.tsx"],"sourcesContent":["import React from \"react\";\nimport { Property } from \"@webiny/react-properties\";\nimport type { Klass, LexicalNode } from \"lexical\";\n\nexport interface NodeConfig {\n name: string;\n node: Klass<LexicalNode>;\n}\n\nexport interface NodeProps {\n name: string;\n node?: Klass<LexicalNode>;\n remove?: boolean;\n before?: string;\n after?: string;\n}\n\nexport const Node = ({\n name,\n node,\n after = undefined,\n before = undefined,\n remove = false\n}: NodeProps) => {\n const placeBefore = before !== undefined ? `node:${before}` : undefined;\n const placeAfter = after !== undefined ? `node:${after}` : undefined;\n\n return (\n <Property\n id={`nodes:${name}`}\n name={\"nodes\"}\n array={true}\n before={placeBefore}\n after={placeAfter}\n remove={remove}\n >\n <Property id={`node:${name}:name`} name={\"name\"} value={name} />\n {node ? <Property id={`node:${name}:node`} name={\"node\"} value={node} /> : null}\n </Property>\n );\n};\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,QAAQ,QAAQ,0BAA0B;AAgBnD,OAAO,MAAMC,IAAI,GAAGA,CAAC;EACjBC,IAAI;EACJC,IAAI;EACJC,KAAK,GAAGC,SAAS;EACjBC,MAAM,GAAGD,SAAS;EAClBE,MAAM,GAAG;AACF,CAAC,KAAK;EACb,MAAMC,WAAW,GAAGF,MAAM,KAAKD,SAAS,GAAG,QAAQC,MAAM,EAAE,GAAGD,SAAS;EACvE,MAAMI,UAAU,GAAGL,KAAK,KAAKC,SAAS,GAAG,QAAQD,KAAK,EAAE,GAAGC,SAAS;EAEpE,oBACIN,KAAA,CAAAW,aAAA,CAACV,QAAQ;IACLW,EAAE,EAAE,SAAST,IAAI,EAAG;IACpBA,IAAI,EAAE,OAAQ;IACdU,KAAK,EAAE,IAAK;IACZN,MAAM,EAAEE,WAAY;IACpBJ,KAAK,EAAEK,UAAW;IAClBF,MAAM,EAAEA;EAAO,gBAEfR,KAAA,CAAAW,aAAA,CAACV,QAAQ;IAACW,EAAE,EAAE,QAAQT,IAAI,OAAQ;IAACA,IAAI,EAAE,MAAO;IAACW,KAAK,EAAEX;EAAK,CAAE,CAAC,EAC/DC,IAAI,gBAAGJ,KAAA,CAAAW,aAAA,CAACV,QAAQ;IAACW,EAAE,EAAE,QAAQT,IAAI,OAAQ;IAACA,IAAI,EAAE,MAAO;IAACW,KAAK,EAAEV;EAAK,CAAE,CAAC,GAAG,IACrE,CAAC;AAEnB,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
export interface PluginConfig {
|
|
3
|
+
name: string;
|
|
4
|
+
element: React.ReactElement;
|
|
5
|
+
}
|
|
6
|
+
export interface PluginProps {
|
|
7
|
+
name: string;
|
|
8
|
+
element?: React.ReactElement<unknown>;
|
|
9
|
+
remove?: boolean;
|
|
10
|
+
before?: string;
|
|
11
|
+
after?: string;
|
|
12
|
+
}
|
|
13
|
+
export declare const Plugin: ({ name, element, after, before, remove }: PluginProps) => React.JSX.Element;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { Property } from "@webiny/react-properties";
|
|
3
|
+
export const Plugin = ({
|
|
4
|
+
name,
|
|
5
|
+
element,
|
|
6
|
+
after = undefined,
|
|
7
|
+
before = undefined,
|
|
8
|
+
remove = false
|
|
9
|
+
}) => {
|
|
10
|
+
const placeBefore = before !== undefined ? `plugin:${before}` : undefined;
|
|
11
|
+
const placeAfter = after !== undefined ? `plugin:${after}` : undefined;
|
|
12
|
+
return /*#__PURE__*/React.createElement(Property, {
|
|
13
|
+
id: `plugins:${name}`,
|
|
14
|
+
name: "plugins",
|
|
15
|
+
array: true,
|
|
16
|
+
before: placeBefore,
|
|
17
|
+
after: placeAfter,
|
|
18
|
+
remove: remove
|
|
19
|
+
}, /*#__PURE__*/React.createElement(Property, {
|
|
20
|
+
id: `plugin:${name}:name`,
|
|
21
|
+
name: "name",
|
|
22
|
+
value: name
|
|
23
|
+
}), element ? /*#__PURE__*/React.createElement(Property, {
|
|
24
|
+
id: `plugin:${name}:element`,
|
|
25
|
+
name: "element",
|
|
26
|
+
value: element
|
|
27
|
+
}) : null);
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
//# sourceMappingURL=Plugin.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["React","Property","Plugin","name","element","after","undefined","before","remove","placeBefore","placeAfter","createElement","id","array","value"],"sources":["Plugin.tsx"],"sourcesContent":["import React from \"react\";\nimport { Property } from \"@webiny/react-properties\";\n\nexport interface PluginConfig {\n name: string;\n element: React.ReactElement;\n}\n\nexport interface PluginProps {\n name: string;\n element?: React.ReactElement<unknown>;\n remove?: boolean;\n before?: string;\n after?: string;\n}\n\nexport const Plugin = ({\n name,\n element,\n after = undefined,\n before = undefined,\n remove = false\n}: PluginProps) => {\n const placeBefore = before !== undefined ? `plugin:${before}` : undefined;\n const placeAfter = after !== undefined ? `plugin:${after}` : undefined;\n\n return (\n <Property\n id={`plugins:${name}`}\n name={\"plugins\"}\n array={true}\n before={placeBefore}\n after={placeAfter}\n remove={remove}\n >\n <Property id={`plugin:${name}:name`} name={\"name\"} value={name} />\n {element ? (\n <Property id={`plugin:${name}:element`} name={\"element\"} value={element} />\n ) : null}\n </Property>\n );\n};\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,QAAQ,QAAQ,0BAA0B;AAenD,OAAO,MAAMC,MAAM,GAAGA,CAAC;EACnBC,IAAI;EACJC,OAAO;EACPC,KAAK,GAAGC,SAAS;EACjBC,MAAM,GAAGD,SAAS;EAClBE,MAAM,GAAG;AACA,CAAC,KAAK;EACf,MAAMC,WAAW,GAAGF,MAAM,KAAKD,SAAS,GAAG,UAAUC,MAAM,EAAE,GAAGD,SAAS;EACzE,MAAMI,UAAU,GAAGL,KAAK,KAAKC,SAAS,GAAG,UAAUD,KAAK,EAAE,GAAGC,SAAS;EAEtE,oBACIN,KAAA,CAAAW,aAAA,CAACV,QAAQ;IACLW,EAAE,EAAE,WAAWT,IAAI,EAAG;IACtBA,IAAI,EAAE,SAAU;IAChBU,KAAK,EAAE,IAAK;IACZN,MAAM,EAAEE,WAAY;IACpBJ,KAAK,EAAEK,UAAW;IAClBF,MAAM,EAAEA;EAAO,gBAEfR,KAAA,CAAAW,aAAA,CAACV,QAAQ;IAACW,EAAE,EAAE,UAAUT,IAAI,OAAQ;IAACA,IAAI,EAAE,MAAO;IAACW,KAAK,EAAEX;EAAK,CAAE,CAAC,EACjEC,OAAO,gBACJJ,KAAA,CAAAW,aAAA,CAACV,QAAQ;IAACW,EAAE,EAAE,UAAUT,IAAI,UAAW;IAACA,IAAI,EAAE,SAAU;IAACW,KAAK,EAAEV;EAAQ,CAAE,CAAC,GAC3E,IACE,CAAC;AAEnB,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
export interface ToolbarElementConfig {
|
|
3
|
+
name: string;
|
|
4
|
+
element: React.ReactElement;
|
|
5
|
+
}
|
|
6
|
+
export interface ToolbarElementProps {
|
|
7
|
+
name: string;
|
|
8
|
+
element?: React.ReactElement<unknown>;
|
|
9
|
+
remove?: boolean;
|
|
10
|
+
before?: string;
|
|
11
|
+
after?: string;
|
|
12
|
+
}
|
|
13
|
+
export declare const ToolbarElement: ({ name, element, after, before, remove }: ToolbarElementProps) => React.JSX.Element;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { Property } from "@webiny/react-properties";
|
|
3
|
+
export const ToolbarElement = ({
|
|
4
|
+
name,
|
|
5
|
+
element,
|
|
6
|
+
after = undefined,
|
|
7
|
+
before = undefined,
|
|
8
|
+
remove = false
|
|
9
|
+
}) => {
|
|
10
|
+
const placeBefore = before !== undefined ? `element:${before}` : undefined;
|
|
11
|
+
const placeAfter = after !== undefined ? `element:${after}` : undefined;
|
|
12
|
+
return /*#__PURE__*/React.createElement(Property, {
|
|
13
|
+
id: `element:${name}`,
|
|
14
|
+
name: "toolbarElements",
|
|
15
|
+
array: true,
|
|
16
|
+
before: placeBefore,
|
|
17
|
+
after: placeAfter,
|
|
18
|
+
remove: remove
|
|
19
|
+
}, /*#__PURE__*/React.createElement(Property, {
|
|
20
|
+
id: `element:${name}:name`,
|
|
21
|
+
name: "name",
|
|
22
|
+
value: name
|
|
23
|
+
}), element ? /*#__PURE__*/React.createElement(Property, {
|
|
24
|
+
id: `element:${name}:element`,
|
|
25
|
+
name: "element",
|
|
26
|
+
value: element
|
|
27
|
+
}) : null);
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
//# sourceMappingURL=ToolbarElement.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["React","Property","ToolbarElement","name","element","after","undefined","before","remove","placeBefore","placeAfter","createElement","id","array","value"],"sources":["ToolbarElement.tsx"],"sourcesContent":["import React from \"react\";\nimport { Property } from \"@webiny/react-properties\";\n\nexport interface ToolbarElementConfig {\n name: string;\n element: React.ReactElement;\n}\n\nexport interface ToolbarElementProps {\n name: string;\n element?: React.ReactElement<unknown>;\n remove?: boolean;\n before?: string;\n after?: string;\n}\n\nexport const ToolbarElement = ({\n name,\n element,\n after = undefined,\n before = undefined,\n remove = false\n}: ToolbarElementProps) => {\n const placeBefore = before !== undefined ? `element:${before}` : undefined;\n const placeAfter = after !== undefined ? `element:${after}` : undefined;\n\n return (\n <Property\n id={`element:${name}`}\n name={\"toolbarElements\"}\n array={true}\n before={placeBefore}\n after={placeAfter}\n remove={remove}\n >\n <Property id={`element:${name}:name`} name={\"name\"} value={name} />\n {element ? (\n <Property id={`element:${name}:element`} name={\"element\"} value={element} />\n ) : null}\n </Property>\n );\n};\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,QAAQ,QAAQ,0BAA0B;AAenD,OAAO,MAAMC,cAAc,GAAGA,CAAC;EAC3BC,IAAI;EACJC,OAAO;EACPC,KAAK,GAAGC,SAAS;EACjBC,MAAM,GAAGD,SAAS;EAClBE,MAAM,GAAG;AACQ,CAAC,KAAK;EACvB,MAAMC,WAAW,GAAGF,MAAM,KAAKD,SAAS,GAAG,WAAWC,MAAM,EAAE,GAAGD,SAAS;EAC1E,MAAMI,UAAU,GAAGL,KAAK,KAAKC,SAAS,GAAG,WAAWD,KAAK,EAAE,GAAGC,SAAS;EAEvE,oBACIN,KAAA,CAAAW,aAAA,CAACV,QAAQ;IACLW,EAAE,EAAE,WAAWT,IAAI,EAAG;IACtBA,IAAI,EAAE,iBAAkB;IACxBU,KAAK,EAAE,IAAK;IACZN,MAAM,EAAEE,WAAY;IACpBJ,KAAK,EAAEK,UAAW;IAClBF,MAAM,EAAEA;EAAO,gBAEfR,KAAA,CAAAW,aAAA,CAACV,QAAQ;IAACW,EAAE,EAAE,WAAWT,IAAI,OAAQ;IAACA,IAAI,EAAE,MAAO;IAACW,KAAK,EAAEX;EAAK,CAAE,CAAC,EAClEC,OAAO,gBACJJ,KAAA,CAAAW,aAAA,CAACV,QAAQ;IAACW,EAAE,EAAE,WAAWT,IAAI,UAAW;IAACA,IAAI,EAAE,SAAU;IAACW,KAAK,EAAEV;EAAQ,CAAE,CAAC,GAC5E,IACE,CAAC;AAEnB,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import type { Klass, LexicalNode } from "lexical";
|
|
3
|
+
import type { CSSObject } from "@emotion/react";
|
|
4
|
+
import type { EditorTheme, ThemeEmotionMap } from "@webiny/lexical-theme";
|
|
5
|
+
import type { LexicalValue } from "../types";
|
|
6
|
+
interface LexicalHtmlRendererProps {
|
|
7
|
+
nodes?: Klass<LexicalNode>[];
|
|
8
|
+
value: LexicalValue | null;
|
|
9
|
+
theme: Partial<EditorTheme>;
|
|
10
|
+
themeEmotionMap?: ThemeEmotionMap;
|
|
11
|
+
themeStylesTransformer?: (cssObject: Record<string, any>) => CSSObject;
|
|
12
|
+
}
|
|
13
|
+
export declare const LexicalHtmlRenderer: ({ nodes, value, ...props }: LexicalHtmlRendererProps) => React.JSX.Element;
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import React, { useRef } from "react";
|
|
2
|
+
import { css } from "emotion";
|
|
3
|
+
import { LexicalComposer } from "@lexical/react/LexicalComposer";
|
|
4
|
+
import { RichTextPlugin } from "@lexical/react/LexicalRichTextPlugin";
|
|
5
|
+
import { ContentEditable } from "@lexical/react/LexicalContentEditable";
|
|
6
|
+
import LexicalErrorBoundary from "@lexical/react/LexicalErrorBoundary";
|
|
7
|
+
import { allNodes } from "@webiny/lexical-nodes";
|
|
8
|
+
import { createTheme, toTypographyEmotionMap } from "@webiny/lexical-theme";
|
|
9
|
+
import { RichTextEditorProvider } from "../context/RichTextEditorContext";
|
|
10
|
+
import { StateHandlingPlugin } from "../plugins/StateHandlingPlugin";
|
|
11
|
+
export const LexicalHtmlRenderer = ({
|
|
12
|
+
nodes,
|
|
13
|
+
value,
|
|
14
|
+
...props
|
|
15
|
+
}) => {
|
|
16
|
+
const theme = {
|
|
17
|
+
styles: {},
|
|
18
|
+
emotionMap: {},
|
|
19
|
+
...props.theme
|
|
20
|
+
};
|
|
21
|
+
const themeEmotionMap = props?.themeEmotionMap ?? toTypographyEmotionMap(css, theme, props.themeStylesTransformer);
|
|
22
|
+
const editorTheme = useRef(createTheme(theme));
|
|
23
|
+
const initialConfig = {
|
|
24
|
+
editorState: null,
|
|
25
|
+
namespace: "webiny",
|
|
26
|
+
onError: () => {
|
|
27
|
+
// Ignore errors. We don't want to break the app because of errors caused by config/value updates.
|
|
28
|
+
// These are usually resolved in the next component render cycle.
|
|
29
|
+
},
|
|
30
|
+
editable: false,
|
|
31
|
+
nodes: [...allNodes, ...(nodes || [])],
|
|
32
|
+
theme: {
|
|
33
|
+
...editorTheme.current,
|
|
34
|
+
emotionMap: themeEmotionMap,
|
|
35
|
+
styles: theme.styles
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
return /*#__PURE__*/React.createElement(LexicalComposer, {
|
|
39
|
+
initialConfig: initialConfig,
|
|
40
|
+
key: initialConfig.nodes.length
|
|
41
|
+
}, /*#__PURE__*/React.createElement(RichTextEditorProvider, {
|
|
42
|
+
theme: theme,
|
|
43
|
+
themeEmotionMap: themeEmotionMap
|
|
44
|
+
}, /*#__PURE__*/React.createElement(RichTextPlugin, {
|
|
45
|
+
contentEditable: /*#__PURE__*/React.createElement("div", {
|
|
46
|
+
className: "editor"
|
|
47
|
+
}, /*#__PURE__*/React.createElement(ContentEditable, null)),
|
|
48
|
+
ErrorBoundary: LexicalErrorBoundary,
|
|
49
|
+
placeholder: null
|
|
50
|
+
}), /*#__PURE__*/React.createElement(StateHandlingPlugin, {
|
|
51
|
+
value: value
|
|
52
|
+
})));
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
//# sourceMappingURL=LexicalHtmlRenderer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["React","useRef","css","LexicalComposer","RichTextPlugin","ContentEditable","LexicalErrorBoundary","allNodes","createTheme","toTypographyEmotionMap","RichTextEditorProvider","StateHandlingPlugin","LexicalHtmlRenderer","nodes","value","props","theme","styles","emotionMap","themeEmotionMap","themeStylesTransformer","editorTheme","initialConfig","editorState","namespace","onError","editable","current","createElement","key","length","contentEditable","className","ErrorBoundary","placeholder"],"sources":["LexicalHtmlRenderer.tsx"],"sourcesContent":["import React, { useRef } from \"react\";\nimport type { Klass, LexicalNode } from \"lexical\";\nimport { css } from \"emotion\";\nimport type { CSSObject } from \"@emotion/react\";\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 { allNodes } from \"@webiny/lexical-nodes\";\nimport type { EditorTheme, ThemeEmotionMap } from \"@webiny/lexical-theme\";\nimport { createTheme, toTypographyEmotionMap } from \"@webiny/lexical-theme\";\nimport type { LexicalValue } from \"~/types\";\nimport { RichTextEditorProvider } from \"~/context/RichTextEditorContext\";\nimport { StateHandlingPlugin } from \"~/plugins/StateHandlingPlugin\";\n\ninterface LexicalHtmlRendererProps {\n nodes?: Klass<LexicalNode>[];\n value: LexicalValue | null;\n theme: Partial<EditorTheme>;\n themeEmotionMap?: ThemeEmotionMap;\n themeStylesTransformer?: (cssObject: Record<string, any>) => CSSObject;\n}\n\nexport const LexicalHtmlRenderer = ({ nodes, value, ...props }: LexicalHtmlRendererProps) => {\n const theme: EditorTheme = { styles: {}, emotionMap: {}, ...props.theme };\n const themeEmotionMap =\n props?.themeEmotionMap ?? toTypographyEmotionMap(css, theme, props.themeStylesTransformer);\n const editorTheme = useRef(createTheme(theme));\n\n const initialConfig = {\n editorState: null,\n namespace: \"webiny\",\n onError: () => {\n // Ignore errors. We don't want to break the app because of errors caused by config/value updates.\n // These are usually resolved in the next component render cycle.\n },\n editable: false,\n nodes: [...allNodes, ...(nodes || [])],\n theme: { ...editorTheme.current, emotionMap: themeEmotionMap, styles: theme.styles }\n };\n\n return (\n <LexicalComposer initialConfig={initialConfig} key={initialConfig.nodes.length}>\n <RichTextEditorProvider theme={theme} themeEmotionMap={themeEmotionMap}>\n <RichTextPlugin\n contentEditable={\n <div className=\"editor\">\n <ContentEditable />\n </div>\n }\n ErrorBoundary={LexicalErrorBoundary}\n placeholder={null}\n />\n <StateHandlingPlugin value={value} />\n </RichTextEditorProvider>\n </LexicalComposer>\n );\n};\n"],"mappings":"AAAA,OAAOA,KAAK,IAAIC,MAAM,QAAQ,OAAO;AAErC,SAASC,GAAG,QAAQ,SAAS;AAE7B,SAASC,eAAe,QAAQ,gCAAgC;AAChE,SAASC,cAAc,QAAQ,sCAAsC;AACrE,SAASC,eAAe,QAAQ,uCAAuC;AACvE,OAAOC,oBAAoB,MAAM,qCAAqC;AACtE,SAASC,QAAQ,QAAQ,uBAAuB;AAEhD,SAASC,WAAW,EAAEC,sBAAsB,QAAQ,uBAAuB;AAE3E,SAASC,sBAAsB;AAC/B,SAASC,mBAAmB;AAU5B,OAAO,MAAMC,mBAAmB,GAAGA,CAAC;EAAEC,KAAK;EAAEC,KAAK;EAAE,GAAGC;AAAgC,CAAC,KAAK;EACzF,MAAMC,KAAkB,GAAG;IAAEC,MAAM,EAAE,CAAC,CAAC;IAAEC,UAAU,EAAE,CAAC,CAAC;IAAE,GAAGH,KAAK,CAACC;EAAM,CAAC;EACzE,MAAMG,eAAe,GACjBJ,KAAK,EAAEI,eAAe,IAAIV,sBAAsB,CAACP,GAAG,EAAEc,KAAK,EAAED,KAAK,CAACK,sBAAsB,CAAC;EAC9F,MAAMC,WAAW,GAAGpB,MAAM,CAACO,WAAW,CAACQ,KAAK,CAAC,CAAC;EAE9C,MAAMM,aAAa,GAAG;IAClBC,WAAW,EAAE,IAAI;IACjBC,SAAS,EAAE,QAAQ;IACnBC,OAAO,EAAEA,CAAA,KAAM;MACX;MACA;IAAA,CACH;IACDC,QAAQ,EAAE,KAAK;IACfb,KAAK,EAAE,CAAC,GAAGN,QAAQ,EAAE,IAAIM,KAAK,IAAI,EAAE,CAAC,CAAC;IACtCG,KAAK,EAAE;MAAE,GAAGK,WAAW,CAACM,OAAO;MAAET,UAAU,EAAEC,eAAe;MAAEF,MAAM,EAAED,KAAK,CAACC;IAAO;EACvF,CAAC;EAED,oBACIjB,KAAA,CAAA4B,aAAA,CAACzB,eAAe;IAACmB,aAAa,EAAEA,aAAc;IAACO,GAAG,EAAEP,aAAa,CAACT,KAAK,CAACiB;EAAO,gBAC3E9B,KAAA,CAAA4B,aAAA,CAAClB,sBAAsB;IAACM,KAAK,EAAEA,KAAM;IAACG,eAAe,EAAEA;EAAgB,gBACnEnB,KAAA,CAAA4B,aAAA,CAACxB,cAAc;IACX2B,eAAe,eACX/B,KAAA,CAAA4B,aAAA;MAAKI,SAAS,EAAC;IAAQ,gBACnBhC,KAAA,CAAA4B,aAAA,CAACvB,eAAe,MAAE,CACjB,CACR;IACD4B,aAAa,EAAE3B,oBAAqB;IACpC4B,WAAW,EAAE;EAAK,CACrB,CAAC,eACFlC,KAAA,CAAA4B,aAAA,CAACjB,mBAAmB;IAACG,KAAK,EAAEA;EAAM,CAAE,CAChB,CACX,CAAC;AAE1B,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,260 @@
|
|
|
1
|
+
.static-toolbar {
|
|
2
|
+
display: flex;
|
|
3
|
+
position: relative;
|
|
4
|
+
padding: 4px;
|
|
5
|
+
vertical-align: middle;
|
|
6
|
+
border: 1px solid #eee;
|
|
7
|
+
will-change: transform;
|
|
8
|
+
background: #fff;
|
|
9
|
+
flex-wrap: wrap;
|
|
10
|
+
z-index: 1;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
.static-toolbar button.popup-item {
|
|
14
|
+
border: 0;
|
|
15
|
+
display: flex;
|
|
16
|
+
background: #fff;
|
|
17
|
+
border-radius: 10px;
|
|
18
|
+
padding: 8px;
|
|
19
|
+
cursor: pointer;
|
|
20
|
+
vertical-align: middle;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
.static-toolbar button.popup-item:disabled {
|
|
24
|
+
cursor: not-allowed;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.static-toolbar button.popup-item.spaced {
|
|
28
|
+
margin-right: 2px;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.static-toolbar button.popup-item i.format {
|
|
32
|
+
background-size: contain;
|
|
33
|
+
display: inline-block;
|
|
34
|
+
height: 18px;
|
|
35
|
+
width: 18px;
|
|
36
|
+
margin-top: 2px;
|
|
37
|
+
vertical-align: -0.25em;
|
|
38
|
+
display: flex;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
.static-toolbar button.popup-item:disabled i.format {
|
|
42
|
+
opacity: 0.2;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
.static-toolbar button.popup-item.active {
|
|
46
|
+
background-color: rgba(223, 232, 250, 0.3);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
.static-toolbar button.popup-item.active i {
|
|
50
|
+
opacity: 1;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
.static-toolbar .popup-item:hover:not([disabled]) {
|
|
54
|
+
background-color: #eee;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
.static-toolbar select.popup-item {
|
|
58
|
+
border: 0;
|
|
59
|
+
display: flex;
|
|
60
|
+
border-radius: 10px;
|
|
61
|
+
padding: 8px;
|
|
62
|
+
vertical-align: middle;
|
|
63
|
+
-webkit-appearance: none;
|
|
64
|
+
-moz-appearance: none;
|
|
65
|
+
width: 70px;
|
|
66
|
+
font-size: 14px;
|
|
67
|
+
color: #777;
|
|
68
|
+
text-overflow: ellipsis;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
.static-toolbar select.code-language {
|
|
72
|
+
text-transform: capitalize;
|
|
73
|
+
width: 130px;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
.static-toolbar .popup-item .text {
|
|
77
|
+
display: flex;
|
|
78
|
+
line-height: 20px;
|
|
79
|
+
width: 200px;
|
|
80
|
+
vertical-align: middle;
|
|
81
|
+
font-size: 14px;
|
|
82
|
+
color: #777;
|
|
83
|
+
text-overflow: ellipsis;
|
|
84
|
+
width: 70px;
|
|
85
|
+
overflow: hidden;
|
|
86
|
+
height: 20px;
|
|
87
|
+
text-align: left;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
.static-toolbar .popup-item .icon {
|
|
91
|
+
display: flex;
|
|
92
|
+
width: 20px;
|
|
93
|
+
height: 20px;
|
|
94
|
+
user-select: none;
|
|
95
|
+
line-height: 16px;
|
|
96
|
+
background-size: contain;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
.static-toolbar i.chevron-down {
|
|
100
|
+
margin-top: 3px;
|
|
101
|
+
width: 16px;
|
|
102
|
+
height: 16px;
|
|
103
|
+
display: flex;
|
|
104
|
+
user-select: none;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
.static-toolbar i.chevron-down.inside {
|
|
108
|
+
width: 16px;
|
|
109
|
+
height: 16px;
|
|
110
|
+
display: flex;
|
|
111
|
+
margin-left: -25px;
|
|
112
|
+
margin-top: 11px;
|
|
113
|
+
margin-right: 10px;
|
|
114
|
+
pointer-events: none;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
.static-toolbar .divider {
|
|
118
|
+
width: 1px;
|
|
119
|
+
background-color: #eee;
|
|
120
|
+
margin: 0 4px;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
.static-toolbar .icon.bullet-list,
|
|
124
|
+
.static-toolbar .icon.bullet {
|
|
125
|
+
background-image: url("../../images/icons/list-ul.svg");
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
.static-toolbar .icon.numbered-list,
|
|
129
|
+
.static-toolbar .icon.number {
|
|
130
|
+
background-image: url("../../images/icons/list-ol.svg");
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
.static-toolbar .link-editor .button.active,
|
|
134
|
+
.static-toolbar .button.active {
|
|
135
|
+
background-color: rgb(223, 232, 250);
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
.static-toolbar button.toolbar-item {
|
|
139
|
+
border: 0;
|
|
140
|
+
display: flex;
|
|
141
|
+
background: none;
|
|
142
|
+
border-radius: 10px;
|
|
143
|
+
padding: 8px;
|
|
144
|
+
cursor: pointer;
|
|
145
|
+
vertical-align: middle;
|
|
146
|
+
flex-shrink: 0;
|
|
147
|
+
align-items: center;
|
|
148
|
+
justify-content: space-between;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
.static-toolbar button.toolbar-item:disabled {
|
|
152
|
+
cursor: not-allowed;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
.static-toolbar button.toolbar-item.spaced {
|
|
156
|
+
margin-right: 2px;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
.static-toolbar button.toolbar-item i.format {
|
|
160
|
+
background-size: contain;
|
|
161
|
+
display: inline-block;
|
|
162
|
+
height: 18px;
|
|
163
|
+
width: 18px;
|
|
164
|
+
vertical-align: -0.25em;
|
|
165
|
+
display: flex;
|
|
166
|
+
opacity: 0.6;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
.static-toolbar button.toolbar-item:disabled .icon,
|
|
170
|
+
.static-toolbar button.toolbar-item:disabled .text,
|
|
171
|
+
.static-toolbar button.toolbar-item:disabled i.format,
|
|
172
|
+
.static-toolbar button.toolbar-item:disabled .chevron-down {
|
|
173
|
+
opacity: 0.2;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
.static-toolbar button.toolbar-item.active {
|
|
177
|
+
background-color: rgba(223, 232, 250, 0.3);
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
.static-toolbar button.toolbar-item.active i {
|
|
181
|
+
opacity: 1;
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
.static-toolbar .toolbar-item:hover:not([disabled]) {
|
|
185
|
+
background-color: #eee;
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
.static-toolbar .toolbar-item.font-family .text {
|
|
189
|
+
display: block;
|
|
190
|
+
max-width: 40px;
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
.static-toolbar .code-language {
|
|
194
|
+
width: 150px;
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
.static-toolbar .toolbar-item .text {
|
|
198
|
+
display: flex;
|
|
199
|
+
line-height: 20px;
|
|
200
|
+
vertical-align: middle;
|
|
201
|
+
font-size: 14px;
|
|
202
|
+
color: #777;
|
|
203
|
+
text-overflow: ellipsis;
|
|
204
|
+
overflow: hidden;
|
|
205
|
+
height: 20px;
|
|
206
|
+
text-align: left;
|
|
207
|
+
padding-right: 10px;
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
.static-toolbar .toolbar-item .icon {
|
|
211
|
+
display: flex;
|
|
212
|
+
width: 20px;
|
|
213
|
+
height: 20px;
|
|
214
|
+
user-select: none;
|
|
215
|
+
margin-right: 8px;
|
|
216
|
+
line-height: 16px;
|
|
217
|
+
background-size: contain;
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
.static-toolbar i.chevron-down {
|
|
221
|
+
margin-top: 3px;
|
|
222
|
+
width: 16px;
|
|
223
|
+
height: 16px;
|
|
224
|
+
display: flex;
|
|
225
|
+
user-select: none;
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
.static-toolbar i.chevron-down.inside {
|
|
229
|
+
width: 16px;
|
|
230
|
+
height: 16px;
|
|
231
|
+
display: flex;
|
|
232
|
+
margin-left: -25px;
|
|
233
|
+
margin-top: 11px;
|
|
234
|
+
margin-right: 10px;
|
|
235
|
+
pointer-events: none;
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
.static-toolbar .divider {
|
|
239
|
+
width: 1px;
|
|
240
|
+
background-color: #eee;
|
|
241
|
+
margin: 0 4px;
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
.lexical-dropdown-container {
|
|
245
|
+
position: absolute;
|
|
246
|
+
bottom: -5px;
|
|
247
|
+
left: 0;
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
.static-toolbar button.item i {
|
|
251
|
+
opacity: 0.6;
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
.static-toolbar button.item.dropdown-item-active {
|
|
255
|
+
background-color: rgba(223, 232, 250, 0.3);
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
.static-toolbar button.item.dropdown-item-active i {
|
|
259
|
+
opacity: 1;
|
|
260
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import React, { Fragment } from "react";
|
|
2
|
+
import "./StaticToolbar.css";
|
|
3
|
+
import { useLexicalEditorConfig } from "../LexicalEditorConfig/LexicalEditorConfig";
|
|
4
|
+
import { useRichTextEditor } from "../../hooks";
|
|
5
|
+
export const StaticToolbar = ({
|
|
6
|
+
className
|
|
7
|
+
}) => {
|
|
8
|
+
const {
|
|
9
|
+
toolbarElements
|
|
10
|
+
} = useLexicalEditorConfig();
|
|
11
|
+
const {
|
|
12
|
+
editor
|
|
13
|
+
} = useRichTextEditor();
|
|
14
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
15
|
+
className: className ?? "static-toolbar",
|
|
16
|
+
"data-role": "toolbar"
|
|
17
|
+
}, editor.isEditable() && /*#__PURE__*/React.createElement(React.Fragment, null, toolbarElements.map(action => /*#__PURE__*/React.createElement(Fragment, {
|
|
18
|
+
key: action.name
|
|
19
|
+
}, action.element))));
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
//# sourceMappingURL=StaticToolbar.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["React","Fragment","useLexicalEditorConfig","useRichTextEditor","StaticToolbar","className","toolbarElements","editor","createElement","isEditable","map","action","key","name","element"],"sources":["StaticToolbar.tsx"],"sourcesContent":["import React, { Fragment } from \"react\";\nimport \"./StaticToolbar.css\";\nimport { useLexicalEditorConfig } from \"~/components/LexicalEditorConfig/LexicalEditorConfig\";\nimport { useRichTextEditor } from \"~/hooks\";\n\nexport const StaticToolbar = ({ className }: { className?: string }) => {\n const { toolbarElements } = useLexicalEditorConfig();\n const { editor } = useRichTextEditor();\n\n return (\n <div className={className ?? \"static-toolbar\"} data-role={\"toolbar\"}>\n {editor.isEditable() && (\n <>\n {toolbarElements.map(action => (\n <Fragment key={action.name}>{action.element}</Fragment>\n ))}\n </>\n )}\n </div>\n );\n};\n"],"mappings":"AAAA,OAAOA,KAAK,IAAIC,QAAQ,QAAQ,OAAO;AACvC;AACA,SAASC,sBAAsB;AAC/B,SAASC,iBAAiB;AAE1B,OAAO,MAAMC,aAAa,GAAGA,CAAC;EAAEC;AAAkC,CAAC,KAAK;EACpE,MAAM;IAAEC;EAAgB,CAAC,GAAGJ,sBAAsB,CAAC,CAAC;EACpD,MAAM;IAAEK;EAAO,CAAC,GAAGJ,iBAAiB,CAAC,CAAC;EAEtC,oBACIH,KAAA,CAAAQ,aAAA;IAAKH,SAAS,EAAEA,SAAS,IAAI,gBAAiB;IAAC,aAAW;EAAU,GAC/DE,MAAM,CAACE,UAAU,CAAC,CAAC,iBAChBT,KAAA,CAAAQ,aAAA,CAAAR,KAAA,CAAAC,QAAA,QACKK,eAAe,CAACI,GAAG,CAACC,MAAM,iBACvBX,KAAA,CAAAQ,aAAA,CAACP,QAAQ;IAACW,GAAG,EAAED,MAAM,CAACE;EAAK,GAAEF,MAAM,CAACG,OAAkB,CACzD,CACH,CAEL,CAAC;AAEd,CAAC","ignoreList":[]}
|