@webiny/lexical-editor 0.0.0-unstable.ecd8734205 → 5.35.0-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/commands/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.js.map +1 -1
- package/components/AddRichTextEditorPlugin.d.ts +2 -0
- package/components/AddRichTextEditorPlugin.js +4 -2
- package/components/AddRichTextEditorPlugin.js.map +1 -1
- package/components/AddToolbarAction.js.map +1 -1
- package/components/Editor/HeadingEditor.js +2 -1
- package/components/Editor/HeadingEditor.js.map +1 -1
- package/components/Editor/ParagraphEditor.js +3 -3
- package/components/Editor/ParagraphEditor.js.map +1 -1
- package/components/Editor/RichTextEditor.d.ts +4 -1
- package/components/Editor/RichTextEditor.js +37 -6
- package/components/Editor/RichTextEditor.js.map +1 -1
- 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 +8 -1
- package/components/LexicalHtmlRenderer.js +29 -6
- package/components/LexicalHtmlRenderer.js.map +1 -1
- package/components/Toolbar/HeadingToolbar.js.map +1 -1
- package/components/Toolbar/ParagraphToolbar.js.map +1 -1
- package/components/Toolbar/Toolbar.css +9 -0
- package/components/Toolbar/Toolbar.js +25 -5
- package/components/Toolbar/Toolbar.js.map +1 -1
- package/components/ToolbarActions/BoldAction.d.ts +0 -3
- package/components/ToolbarActions/BoldAction.js +8 -3
- package/components/ToolbarActions/BoldAction.js.map +1 -1
- package/components/ToolbarActions/BulletListAction.d.ts +0 -3
- package/components/ToolbarActions/BulletListAction.js +17 -55
- package/components/ToolbarActions/BulletListAction.js.map +1 -1
- package/components/ToolbarActions/CodeHighlightAction.d.ts +0 -4
- package/components/ToolbarActions/CodeHighlightAction.js +8 -4
- package/components/ToolbarActions/CodeHighlightAction.js.map +1 -1
- 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.js +0 -3
- package/components/ToolbarActions/FontSizeAction.js.map +1 -1
- package/components/ToolbarActions/ItalicAction.d.ts +0 -3
- package/components/ToolbarActions/ItalicAction.js +8 -3
- package/components/ToolbarActions/ItalicAction.js.map +1 -1
- package/components/ToolbarActions/LinkAction.d.ts +0 -5
- package/components/ToolbarActions/LinkAction.js +0 -5
- package/components/ToolbarActions/LinkAction.js.map +1 -1
- package/components/ToolbarActions/NumberedListAction.d.ts +0 -3
- package/components/ToolbarActions/NumberedListAction.js +17 -53
- package/components/ToolbarActions/NumberedListAction.js.map +1 -1
- package/components/ToolbarActions/QuoteAction.d.ts +0 -2
- package/components/ToolbarActions/QuoteAction.js +16 -29
- package/components/ToolbarActions/QuoteAction.js.map +1 -1
- 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 +0 -3
- package/components/ToolbarActions/UnderlineAction.js +8 -3
- package/components/ToolbarActions/UnderlineAction.js.map +1 -1
- package/components/ToolbarPresets/HeadingToolbarPreset.js +8 -0
- package/components/ToolbarPresets/HeadingToolbarPreset.js.map +1 -1
- package/components/ToolbarPresets/ParagraphToolbarPreset.js +8 -0
- package/components/ToolbarPresets/ParagraphToolbarPreset.js.map +1 -1
- 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 +10 -0
- package/context/RichTextEditorContext.js +28 -1
- package/context/RichTextEditorContext.js.map +1 -1
- 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.js.map +1 -1
- 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/font-color.svg +1 -0
- package/index.d.ts +7 -1
- package/index.js +44 -2
- package/index.js.map +1 -1
- 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 +6 -1
- package/nodes/webinyNodes.js +8 -2
- package/nodes/webinyNodes.js.map +1 -1
- package/package.json +9 -6
- package/plugins/AutoLinkPlugin/AutoLinkPlugin.js.map +1 -1
- package/plugins/AutoLinkPlugin/index.js.map +1 -1
- package/plugins/BlurEventPlugin/BlurEventPlugin.js.map +1 -1
- package/plugins/ClickableLinkPlugin/ClickableLinkPlugin.js.map +1 -1
- package/plugins/ClickableLinkPlugin/index.js.map +1 -1
- package/plugins/CodeHighlightPlugin/CodeHighlightPlugin.js.map +1 -1
- package/plugins/CodeHighlightPlugin/index.js.map +1 -1
- package/plugins/FloatingLinkEditorPlugin/FloatingLinkEditorPlugin.js.map +1 -1
- package/plugins/FloatingLinkEditorPlugin/index.js.map +1 -1
- 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.js.map +1 -1
- package/plugins/LexicalUpdateStatePlugin/index.js.map +1 -1
- 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 +0 -2
- package/themes/webinyLexicalTheme.d.ts +7 -8
- package/themes/webinyLexicalTheme.js +7 -27
- package/themes/webinyLexicalTheme.js.map +1 -1
- package/types.d.ts +59 -0
- package/types.js +8 -1
- package/types.js.map +1 -1
- package/ui/Divider.js.map +1 -1
- package/ui/DropDown.d.ts +2 -1
- package/ui/DropDown.js +7 -2
- package/ui/DropDown.js.map +1 -1
- package/ui/LinkPreview.js.map +1 -1
- package/ui/Placeholder.js.map +1 -1
- package/ui/TextInput.js.map +1 -1
- package/ui/ToolbarActionDialog.d.ts +12 -0
- package/ui/ToolbarActionDialog.js +106 -0
- package/ui/ToolbarActionDialog.js.map +1 -0
- package/utils/generateInitialLexicalValue.js.map +1 -1
- package/utils/getDOMRangeRect.js.map +1 -1
- package/utils/getLexicalTextSelectionState.d.ts +5 -0
- package/utils/getLexicalTextSelectionState.js +141 -0
- package/utils/getLexicalTextSelectionState.js.map +1 -0
- package/utils/getSelectedNode.js.map +1 -1
- package/utils/isValidJSON.js.map +1 -1
- package/utils/isValidLexicalData.js.map +1 -1
- 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.js.map +1 -1
- package/utils/rect.js.map +1 -1
- package/utils/sanitizeUrl.js.map +1 -1
- package/utils/setFloatingElemPosition.js.map +1 -1
- 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
|
@@ -1,7 +1,17 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
+
import { TextBlockSelection, ThemeEmotionMap, ToolbarType } from "../types";
|
|
3
|
+
import { WebinyTheme } from "../themes/webinyLexicalTheme";
|
|
2
4
|
export interface RichTextEditorContext {
|
|
3
5
|
nodeIsText: boolean;
|
|
4
6
|
setNodeIsText: (nodeIsText: boolean) => void;
|
|
7
|
+
toolbarType?: ToolbarType;
|
|
8
|
+
setToolbarType: (type: ToolbarType) => void;
|
|
9
|
+
textBlockSelection: TextBlockSelection | null;
|
|
10
|
+
setTextBlockSelection: (textBlockSelection: TextBlockSelection) => void;
|
|
11
|
+
theme?: WebinyTheme;
|
|
12
|
+
setTheme: (theme: WebinyTheme) => void;
|
|
13
|
+
themeEmotionMap?: ThemeEmotionMap;
|
|
14
|
+
setThemeEmotionMap: (themeEmotionMap?: ThemeEmotionMap) => void;
|
|
5
15
|
}
|
|
6
16
|
export declare const RichTextEditorContext: React.Context<RichTextEditorContext | undefined>;
|
|
7
17
|
interface RichTextEditorProviderProps {
|
|
@@ -16,13 +16,40 @@ var RichTextEditorProvider = function RichTextEditorProvider(_ref) {
|
|
|
16
16
|
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
17
17
|
nodeIsText = _useState2[0],
|
|
18
18
|
setIsText = _useState2[1];
|
|
19
|
+
var _useState3 = (0, _react.useState)(),
|
|
20
|
+
_useState4 = (0, _slicedToArray2.default)(_useState3, 2),
|
|
21
|
+
toolbarType = _useState4[0],
|
|
22
|
+
setToolbarType = _useState4[1];
|
|
23
|
+
var _useState5 = (0, _react.useState)(undefined),
|
|
24
|
+
_useState6 = (0, _slicedToArray2.default)(_useState5, 2),
|
|
25
|
+
theme = _useState6[0],
|
|
26
|
+
setTheme = _useState6[1];
|
|
27
|
+
var _useState7 = (0, _react.useState)(undefined),
|
|
28
|
+
_useState8 = (0, _slicedToArray2.default)(_useState7, 2),
|
|
29
|
+
themeEmotionMap = _useState8[0],
|
|
30
|
+
setThemeEmotionMap = _useState8[1];
|
|
31
|
+
/*
|
|
32
|
+
* @desc Keeps data from current user text selection like range selection, nodes, node key...
|
|
33
|
+
*/
|
|
34
|
+
var _useState9 = (0, _react.useState)(null),
|
|
35
|
+
_useState10 = (0, _slicedToArray2.default)(_useState9, 2),
|
|
36
|
+
textBlockSelection = _useState10[0],
|
|
37
|
+
setTextBlockSelection = _useState10[1];
|
|
19
38
|
var setNodeIsText = function setNodeIsText(nodeIsText) {
|
|
20
39
|
setIsText(nodeIsText);
|
|
21
40
|
};
|
|
22
41
|
return /*#__PURE__*/_react.default.createElement(RichTextEditorContext.Provider, {
|
|
23
42
|
value: {
|
|
24
43
|
nodeIsText: nodeIsText,
|
|
25
|
-
setNodeIsText: setNodeIsText
|
|
44
|
+
setNodeIsText: setNodeIsText,
|
|
45
|
+
toolbarType: toolbarType,
|
|
46
|
+
setToolbarType: setToolbarType,
|
|
47
|
+
textBlockSelection: textBlockSelection,
|
|
48
|
+
setTextBlockSelection: setTextBlockSelection,
|
|
49
|
+
theme: theme,
|
|
50
|
+
setTheme: setTheme,
|
|
51
|
+
themeEmotionMap: themeEmotionMap,
|
|
52
|
+
setThemeEmotionMap: setThemeEmotionMap
|
|
26
53
|
}
|
|
27
54
|
}, children);
|
|
28
55
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"names":["RichTextEditorContext","createContext","undefined","RichTextEditorProvider","children","useState","nodeIsText","setIsText","toolbarType","setToolbarType","theme","setTheme","themeEmotionMap","setThemeEmotionMap","textBlockSelection","setTextBlockSelection","setNodeIsText"],"sources":["RichTextEditorContext.tsx"],"sourcesContent":["import React, { createContext, useState } from \"react\";\nimport { TextBlockSelection, ThemeEmotionMap, ToolbarType } from \"~/types\";\nimport { WebinyTheme } from \"~/themes/webinyLexicalTheme\";\n\nexport interface RichTextEditorContext {\n nodeIsText: boolean;\n setNodeIsText: (nodeIsText: boolean) => void;\n toolbarType?: ToolbarType;\n setToolbarType: (type: ToolbarType) => void;\n textBlockSelection: TextBlockSelection | null;\n setTextBlockSelection: (textBlockSelection: TextBlockSelection) => void;\n theme?: WebinyTheme;\n setTheme: (theme: WebinyTheme) => void;\n themeEmotionMap?: ThemeEmotionMap;\n setThemeEmotionMap: (themeEmotionMap?: ThemeEmotionMap) => void;\n}\n\nexport const RichTextEditorContext = createContext<RichTextEditorContext | undefined>(undefined);\n\ninterface RichTextEditorProviderProps {\n children?: React.ReactNode | React.ReactNode[];\n}\n\nexport const RichTextEditorProvider: React.FC<RichTextEditorProviderProps> = ({ children }) => {\n const [nodeIsText, setIsText] = useState<boolean>(false);\n const [toolbarType, setToolbarType] = useState<ToolbarType | undefined>();\n const [theme, setTheme] = useState<WebinyTheme | undefined>(undefined);\n const [themeEmotionMap, setThemeEmotionMap] = useState<ThemeEmotionMap | undefined>(undefined);\n /*\n * @desc Keeps data from current user text selection like range selection, nodes, node key...\n */\n const [textBlockSelection, setTextBlockSelection] = useState<TextBlockSelection | null>(null);\n\n const setNodeIsText = (nodeIsText: boolean) => {\n setIsText(nodeIsText);\n };\n\n return (\n <RichTextEditorContext.Provider\n value={{\n nodeIsText,\n setNodeIsText,\n toolbarType,\n setToolbarType,\n textBlockSelection,\n setTextBlockSelection,\n theme,\n setTheme,\n themeEmotionMap,\n setThemeEmotionMap\n }}\n >\n {children}\n </RichTextEditorContext.Provider>\n );\n};\n"],"mappings":";;;;;;;;;AAAA;AAiBO,IAAMA,qBAAqB,gBAAG,IAAAC,oBAAa,EAAoCC,SAAS,CAAC;AAAC;AAM1F,IAAMC,sBAA6D,GAAG,SAAhEA,sBAA6D,OAAqB;EAAA,IAAfC,QAAQ,QAARA,QAAQ;EACpF,gBAAgC,IAAAC,eAAQ,EAAU,KAAK,CAAC;IAAA;IAAjDC,UAAU;IAAEC,SAAS;EAC5B,iBAAsC,IAAAF,eAAQ,GAA2B;IAAA;IAAlEG,WAAW;IAAEC,cAAc;EAClC,iBAA0B,IAAAJ,eAAQ,EAA0BH,SAAS,CAAC;IAAA;IAA/DQ,KAAK;IAAEC,QAAQ;EACtB,iBAA8C,IAAAN,eAAQ,EAA8BH,SAAS,CAAC;IAAA;IAAvFU,eAAe;IAAEC,kBAAkB;EAC1C;AACJ;AACA;EACI,iBAAoD,IAAAR,eAAQ,EAA4B,IAAI,CAAC;IAAA;IAAtFS,kBAAkB;IAAEC,qBAAqB;EAEhD,IAAMC,aAAa,GAAG,SAAhBA,aAAa,CAAIV,UAAmB,EAAK;IAC3CC,SAAS,CAACD,UAAU,CAAC;EACzB,CAAC;EAED,oBACI,6BAAC,qBAAqB,CAAC,QAAQ;IAC3B,KAAK,EAAE;MACHA,UAAU,EAAVA,UAAU;MACVU,aAAa,EAAbA,aAAa;MACbR,WAAW,EAAXA,WAAW;MACXC,cAAc,EAAdA,cAAc;MACdK,kBAAkB,EAAlBA,kBAAkB;MAClBC,qBAAqB,EAArBA,qBAAqB;MACrBL,KAAK,EAALA,KAAK;MACLC,QAAQ,EAARA,QAAQ;MACRC,eAAe,EAAfA,eAAe;MACfC,kBAAkB,EAAlBA;IACJ;EAAE,GAEDT,QAAQ,CACoB;AAEzC,CAAC;AAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/// <reference types="web" />
|
|
2
|
+
import { ReactNode } from "react";
|
|
3
|
+
import { HistoryState } from "@lexical/history";
|
|
4
|
+
declare type ContextShape = {
|
|
5
|
+
historyState?: HistoryState;
|
|
6
|
+
};
|
|
7
|
+
export declare const SharedHistoryContext: ({ children }: {
|
|
8
|
+
children: ReactNode;
|
|
9
|
+
}) => JSX.Element;
|
|
10
|
+
export declare const useSharedHistoryContext: () => ContextShape;
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.useSharedHistoryContext = exports.SharedHistoryContext = void 0;
|
|
8
|
+
var React = _interopRequireWildcard(require("react"));
|
|
9
|
+
var _history = require("@lexical/history");
|
|
10
|
+
var Context = /*#__PURE__*/(0, React.createContext)({});
|
|
11
|
+
var SharedHistoryContext = function SharedHistoryContext(_ref) {
|
|
12
|
+
var children = _ref.children;
|
|
13
|
+
var historyContext = (0, React.useMemo)(function () {
|
|
14
|
+
return {
|
|
15
|
+
historyState: (0, _history.createEmptyHistoryState)()
|
|
16
|
+
};
|
|
17
|
+
}, []);
|
|
18
|
+
return /*#__PURE__*/React.createElement(Context.Provider, {
|
|
19
|
+
value: historyContext
|
|
20
|
+
}, children);
|
|
21
|
+
};
|
|
22
|
+
exports.SharedHistoryContext = SharedHistoryContext;
|
|
23
|
+
var useSharedHistoryContext = function useSharedHistoryContext() {
|
|
24
|
+
return (0, React.useContext)(Context);
|
|
25
|
+
};
|
|
26
|
+
exports.useSharedHistoryContext = useSharedHistoryContext;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["Context","createContext","SharedHistoryContext","children","historyContext","useMemo","historyState","createEmptyHistoryState","useSharedHistoryContext","useContext"],"sources":["SharedHistoryContext.tsx"],"sourcesContent":["import * as React from \"react\";\nimport { createContext, ReactNode, useContext, useMemo } from \"react\";\nimport { createEmptyHistoryState, HistoryState } from \"@lexical/history\";\n\ntype ContextShape = {\n historyState?: HistoryState;\n};\n\nconst Context: React.Context<ContextShape> = createContext({});\n\nexport const SharedHistoryContext = ({ children }: { children: ReactNode }): JSX.Element => {\n const historyContext = useMemo(() => ({ historyState: createEmptyHistoryState() }), []);\n return <Context.Provider value={historyContext}>{children}</Context.Provider>;\n};\n\nexport const useSharedHistoryContext = (): ContextShape => {\n return useContext(Context);\n};\n"],"mappings":";;;;;;;AAAA;AAEA;AAMA,IAAMA,OAAoC,gBAAG,IAAAC,mBAAa,EAAC,CAAC,CAAC,CAAC;AAEvD,IAAMC,oBAAoB,GAAG,SAAvBA,oBAAoB,OAA2D;EAAA,IAArDC,QAAQ,QAARA,QAAQ;EAC3C,IAAMC,cAAc,GAAG,IAAAC,aAAO,EAAC;IAAA,OAAO;MAAEC,YAAY,EAAE,IAAAC,gCAAuB;IAAG,CAAC;EAAA,CAAC,EAAE,EAAE,CAAC;EACvF,oBAAO,oBAAC,OAAO,CAAC,QAAQ;IAAC,KAAK,EAAEH;EAAe,GAAED,QAAQ,CAAoB;AACjF,CAAC;AAAC;AAEK,IAAMK,uBAAuB,GAAG,SAA1BA,uBAAuB,GAAuB;EACvD,OAAO,IAAAC,gBAAU,EAACT,OAAO,CAAC;AAC9B,CAAC;AAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { TypographyValue } from "../types";
|
|
3
|
+
export interface TypographyActionContextProps {
|
|
4
|
+
value: TypographyValue | undefined;
|
|
5
|
+
applyTypography: (value: TypographyValue) => void;
|
|
6
|
+
}
|
|
7
|
+
export declare const TypographyActionContext: React.Context<TypographyActionContextProps | undefined>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.TypographyActionContext = void 0;
|
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
|
9
|
+
var TypographyActionContext = /*#__PURE__*/_react.default.createContext(undefined);
|
|
10
|
+
exports.TypographyActionContext = TypographyActionContext;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["TypographyActionContext","React","createContext","undefined"],"sources":["TypographyActionContext.tsx"],"sourcesContent":["import React from \"react\";\nimport { TypographyValue } from \"~/types\";\n\nexport interface TypographyActionContextProps {\n /*\n * @desc Current selected typography\n * */\n value: TypographyValue | undefined;\n\n /*\n * @desc Apply font family to selected text.\n * @params: value\n */\n applyTypography: (value: TypographyValue) => void;\n}\n\nexport const TypographyActionContext = React.createContext<\n TypographyActionContextProps | undefined\n>(undefined);\n"],"mappings":";;;;;;;AAAA;AAgBO,IAAMA,uBAAuB,gBAAGC,cAAK,CAACC,aAAa,CAExDC,SAAS,CAAC;AAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.useFontColorPicker = useFontColorPicker;
|
|
7
|
+
var _react = require("react");
|
|
8
|
+
var _FontColorActionContext = require("../context/FontColorActionContext");
|
|
9
|
+
function useFontColorPicker() {
|
|
10
|
+
var context = (0, _react.useContext)(_FontColorActionContext.FontColorActionContext);
|
|
11
|
+
if (!context) {
|
|
12
|
+
throw Error("Missing FontColorActionContext in the component hierarchy. Are you using \"useFontColorPicker()\" in the right place?");
|
|
13
|
+
}
|
|
14
|
+
return context;
|
|
15
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["useFontColorPicker","context","useContext","FontColorActionContext","Error"],"sources":["useFontColorPicker.ts"],"sourcesContent":["import { useContext } from \"react\";\nimport { FontColorActionContext } from \"~/context/FontColorActionContext\";\n\nexport function useFontColorPicker() {\n const context = useContext(FontColorActionContext);\n if (!context) {\n throw Error(\n `Missing FontColorActionContext in the component hierarchy. Are you using \"useFontColorPicker()\" in the right place?`\n );\n }\n\n return context;\n}\n"],"mappings":";;;;;;AAAA;AACA;AAEO,SAASA,kBAAkB,GAAG;EACjC,IAAMC,OAAO,GAAG,IAAAC,iBAAU,EAACC,8CAAsB,CAAC;EAClD,IAAI,CAACF,OAAO,EAAE;IACV,MAAMG,KAAK,yHAEV;EACL;EAEA,OAAOH,OAAO;AAClB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"names":["useRichTextEditor","context","useContext","RichTextEditorContext","Error"],"sources":["useRichTextEditor.ts"],"sourcesContent":["import { useContext } from \"react\";\nimport { RichTextEditorContext } from \"~/context/RichTextEditorContext\";\n\nexport function useRichTextEditor() {\n const context = useContext(RichTextEditorContext);\n if (!context) {\n throw Error(\n `Missing RichTextEditorContext in the component hierarchy. Are you using \"useRichTextEditor()\" in the right place?`\n );\n }\n\n return context;\n}\n"],"mappings":";;;;;;AAAA;AACA;AAEO,SAASA,iBAAiB,GAAG;EAChC,IAAMC,OAAO,GAAG,IAAAC,iBAAU,EAACC,4CAAqB,CAAC;EACjD,IAAI,CAACF,OAAO,EAAE;IACV,MAAMG,KAAK,uHAEV;EACL;EAEA,OAAOH,OAAO;AAClB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function useTypographyAction(): import("../context/TypographyActionContext").TypographyActionContextProps;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.useTypographyAction = useTypographyAction;
|
|
7
|
+
var _react = require("react");
|
|
8
|
+
var _TypographyActionContext = require("../context/TypographyActionContext");
|
|
9
|
+
function useTypographyAction() {
|
|
10
|
+
var context = (0, _react.useContext)(_TypographyActionContext.TypographyActionContext);
|
|
11
|
+
if (!context) {
|
|
12
|
+
throw Error("Missing TypographyActionContext in the component hierarchy. Are you using \"useTypographyAction()\" in the right place?");
|
|
13
|
+
}
|
|
14
|
+
return context;
|
|
15
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["useTypographyAction","context","useContext","TypographyActionContext","Error"],"sources":["useTypographyAction.ts"],"sourcesContent":["import { useContext } from \"react\";\nimport { TypographyActionContext } from \"~/context/TypographyActionContext\";\n\nexport function useTypographyAction() {\n const context = useContext(TypographyActionContext);\n if (!context) {\n throw Error(\n `Missing TypographyActionContext in the component hierarchy. Are you using \"useTypographyAction()\" in the right place?`\n );\n }\n\n return context;\n}\n"],"mappings":";;;;;;AAAA;AACA;AAEO,SAASA,mBAAmB,GAAG;EAClC,IAAMC,OAAO,GAAG,IAAAC,iBAAU,EAACC,gDAAuB,CAAC;EACnD,IAAI,CAACF,OAAO,EAAE;IACV,MAAMG,KAAK,2HAEV;EACL;EAEA,OAAOH,OAAO;AAClB"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.useWebinyList = useWebinyList;
|
|
7
|
+
var _utils = require("@lexical/utils");
|
|
8
|
+
var _lexical = require("lexical");
|
|
9
|
+
var _react = require("react");
|
|
10
|
+
var _formatList = require("../nodes/list-node/formatList");
|
|
11
|
+
var _webinyList = require("../commands/webiny-list");
|
|
12
|
+
function useWebinyList(editor) {
|
|
13
|
+
(0, _react.useEffect)(function () {
|
|
14
|
+
return (0, _utils.mergeRegister)(editor.registerCommand(_lexical.INDENT_CONTENT_COMMAND, function () {
|
|
15
|
+
(0, _formatList.indentList)();
|
|
16
|
+
return false;
|
|
17
|
+
}, _lexical.COMMAND_PRIORITY_LOW), editor.registerCommand(_lexical.OUTDENT_CONTENT_COMMAND, function () {
|
|
18
|
+
(0, _formatList.outdentList)();
|
|
19
|
+
return false;
|
|
20
|
+
}, _lexical.COMMAND_PRIORITY_LOW), editor.registerCommand(_webinyList.INSERT_ORDERED_WEBINY_LIST_COMMAND, function (_ref) {
|
|
21
|
+
var themeStyleId = _ref.themeStyleId;
|
|
22
|
+
(0, _formatList.insertList)(editor, "number", themeStyleId);
|
|
23
|
+
return true;
|
|
24
|
+
}, _lexical.COMMAND_PRIORITY_LOW), editor.registerCommand(_webinyList.INSERT_UNORDERED_WEBINY_LIST_COMMAND, function (_ref2) {
|
|
25
|
+
var themeStyleId = _ref2.themeStyleId;
|
|
26
|
+
(0, _formatList.insertList)(editor, "bullet", themeStyleId);
|
|
27
|
+
return true;
|
|
28
|
+
}, _lexical.COMMAND_PRIORITY_LOW), editor.registerCommand(_webinyList.REMOVE_WEBINY_LIST_COMMAND, function () {
|
|
29
|
+
(0, _formatList.removeList)(editor);
|
|
30
|
+
return true;
|
|
31
|
+
}, _lexical.COMMAND_PRIORITY_LOW), editor.registerCommand(_lexical.INSERT_PARAGRAPH_COMMAND, function () {
|
|
32
|
+
var hasHandledInsertParagraph = (0, _formatList.$handleListInsertParagraph)();
|
|
33
|
+
if (hasHandledInsertParagraph) {
|
|
34
|
+
return true;
|
|
35
|
+
}
|
|
36
|
+
return false;
|
|
37
|
+
}, _lexical.COMMAND_PRIORITY_LOW));
|
|
38
|
+
}, [editor]);
|
|
39
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["useWebinyList","editor","useEffect","mergeRegister","registerCommand","INDENT_CONTENT_COMMAND","indentList","COMMAND_PRIORITY_LOW","OUTDENT_CONTENT_COMMAND","outdentList","INSERT_ORDERED_WEBINY_LIST_COMMAND","themeStyleId","insertList","INSERT_UNORDERED_WEBINY_LIST_COMMAND","REMOVE_WEBINY_LIST_COMMAND","removeList","INSERT_PARAGRAPH_COMMAND","hasHandledInsertParagraph","$handleListInsertParagraph"],"sources":["useWebinyList.ts"],"sourcesContent":["import type { LexicalEditor } from \"lexical\";\nimport { mergeRegister } from \"@lexical/utils\";\nimport {\n COMMAND_PRIORITY_LOW,\n INDENT_CONTENT_COMMAND,\n INSERT_PARAGRAPH_COMMAND,\n OUTDENT_CONTENT_COMMAND\n} from \"lexical\";\nimport { useEffect } from \"react\";\nimport {\n $handleListInsertParagraph,\n indentList,\n insertList,\n outdentList,\n removeList\n} from \"~/nodes/list-node/formatList\";\nimport {\n INSERT_ORDERED_WEBINY_LIST_COMMAND,\n INSERT_UNORDERED_WEBINY_LIST_COMMAND,\n REMOVE_WEBINY_LIST_COMMAND\n} from \"~/commands/webiny-list\";\n\nexport function useWebinyList(editor: LexicalEditor): void {\n useEffect(() => {\n return mergeRegister(\n editor.registerCommand(\n INDENT_CONTENT_COMMAND,\n () => {\n indentList();\n return false;\n },\n COMMAND_PRIORITY_LOW\n ),\n editor.registerCommand(\n OUTDENT_CONTENT_COMMAND,\n () => {\n outdentList();\n return false;\n },\n COMMAND_PRIORITY_LOW\n ),\n editor.registerCommand(\n INSERT_ORDERED_WEBINY_LIST_COMMAND,\n ({ themeStyleId }) => {\n insertList(editor, \"number\", themeStyleId);\n return true;\n },\n COMMAND_PRIORITY_LOW\n ),\n editor.registerCommand(\n INSERT_UNORDERED_WEBINY_LIST_COMMAND,\n ({ themeStyleId }) => {\n insertList(editor, \"bullet\", themeStyleId);\n return true;\n },\n COMMAND_PRIORITY_LOW\n ),\n editor.registerCommand(\n REMOVE_WEBINY_LIST_COMMAND,\n () => {\n removeList(editor);\n return true;\n },\n COMMAND_PRIORITY_LOW\n ),\n editor.registerCommand(\n INSERT_PARAGRAPH_COMMAND,\n () => {\n const hasHandledInsertParagraph = $handleListInsertParagraph();\n\n if (hasHandledInsertParagraph) {\n return true;\n }\n\n return false;\n },\n COMMAND_PRIORITY_LOW\n )\n );\n }, [editor]);\n}\n"],"mappings":";;;;;;AACA;AACA;AAMA;AACA;AAOA;AAMO,SAASA,aAAa,CAACC,MAAqB,EAAQ;EACvD,IAAAC,gBAAS,EAAC,YAAM;IACZ,OAAO,IAAAC,oBAAa,EAChBF,MAAM,CAACG,eAAe,CAClBC,+BAAsB,EACtB,YAAM;MACF,IAAAC,sBAAU,GAAE;MACZ,OAAO,KAAK;IAChB,CAAC,EACDC,6BAAoB,CACvB,EACDN,MAAM,CAACG,eAAe,CAClBI,gCAAuB,EACvB,YAAM;MACF,IAAAC,uBAAW,GAAE;MACb,OAAO,KAAK;IAChB,CAAC,EACDF,6BAAoB,CACvB,EACDN,MAAM,CAACG,eAAe,CAClBM,8CAAkC,EAClC,gBAAsB;MAAA,IAAnBC,YAAY,QAAZA,YAAY;MACX,IAAAC,sBAAU,EAACX,MAAM,EAAE,QAAQ,EAAEU,YAAY,CAAC;MAC1C,OAAO,IAAI;IACf,CAAC,EACDJ,6BAAoB,CACvB,EACDN,MAAM,CAACG,eAAe,CAClBS,gDAAoC,EACpC,iBAAsB;MAAA,IAAnBF,YAAY,SAAZA,YAAY;MACX,IAAAC,sBAAU,EAACX,MAAM,EAAE,QAAQ,EAAEU,YAAY,CAAC;MAC1C,OAAO,IAAI;IACf,CAAC,EACDJ,6BAAoB,CACvB,EACDN,MAAM,CAACG,eAAe,CAClBU,sCAA0B,EAC1B,YAAM;MACF,IAAAC,sBAAU,EAACd,MAAM,CAAC;MAClB,OAAO,IAAI;IACf,CAAC,EACDM,6BAAoB,CACvB,EACDN,MAAM,CAACG,eAAe,CAClBY,iCAAwB,EACxB,YAAM;MACF,IAAMC,yBAAyB,GAAG,IAAAC,sCAA0B,GAAE;MAE9D,IAAID,yBAAyB,EAAE;QAC3B,OAAO,IAAI;MACf;MAEA,OAAO,KAAK;IAChB,CAAC,EACDV,6BAAoB,CACvB,CACJ;EACL,CAAC,EAAE,CAACN,MAAM,CAAC,CAAC;AAChB"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.useWebinyQuote = useWebinyQuote;
|
|
7
|
+
var _utils = require("@lexical/utils");
|
|
8
|
+
var _lexical = require("lexical");
|
|
9
|
+
var _react = require("react");
|
|
10
|
+
var _webinyQuote = require("../commands/webiny-quote");
|
|
11
|
+
var _formatToQuote = require("../utils/nodes/formatToQuote");
|
|
12
|
+
function useWebinyQuote(editor) {
|
|
13
|
+
(0, _react.useEffect)(function () {
|
|
14
|
+
return (0, _utils.mergeRegister)(editor.registerCommand(_webinyQuote.INSERT_WEBINY_QUOTE_COMMAND, function (_ref) {
|
|
15
|
+
var themeStyleId = _ref.themeStyleId;
|
|
16
|
+
(0, _formatToQuote.formatToQuote)(editor, themeStyleId);
|
|
17
|
+
return false;
|
|
18
|
+
}, _lexical.COMMAND_PRIORITY_LOW));
|
|
19
|
+
}, [editor]);
|
|
20
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["useWebinyQuote","editor","useEffect","mergeRegister","registerCommand","INSERT_WEBINY_QUOTE_COMMAND","themeStyleId","formatToQuote","COMMAND_PRIORITY_LOW"],"sources":["useWebinyQuote.ts"],"sourcesContent":["import type { LexicalEditor } from \"lexical\";\nimport { mergeRegister } from \"@lexical/utils\";\nimport { COMMAND_PRIORITY_LOW } from \"lexical\";\nimport { useEffect } from \"react\";\nimport { INSERT_WEBINY_QUOTE_COMMAND } from \"~/commands/webiny-quote\";\nimport { formatToQuote } from \"~/utils/nodes/formatToQuote\";\n\nexport function useWebinyQuote(editor: LexicalEditor): void {\n useEffect(() => {\n return mergeRegister(\n editor.registerCommand(\n INSERT_WEBINY_QUOTE_COMMAND,\n ({ themeStyleId }) => {\n formatToQuote(editor, themeStyleId);\n return false;\n },\n COMMAND_PRIORITY_LOW\n )\n );\n }, [editor]);\n}\n"],"mappings":";;;;;;AACA;AACA;AACA;AACA;AACA;AAEO,SAASA,cAAc,CAACC,MAAqB,EAAQ;EACxD,IAAAC,gBAAS,EAAC,YAAM;IACZ,OAAO,IAAAC,oBAAa,EAChBF,MAAM,CAACG,eAAe,CAClBC,wCAA2B,EAC3B,gBAAsB;MAAA,IAAnBC,YAAY,QAAZA,YAAY;MACX,IAAAC,4BAAa,EAACN,MAAM,EAAEK,YAAY,CAAC;MACnC,OAAO,KAAK;IAChB,CAAC,EACDE,6BAAoB,CACvB,CACJ;EACL,CAAC,EAAE,CAACP,MAAM,CAAC,CAAC;AAChB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 512 512"><path fill="#777" d="M221.631 109 109.92 392h58.055l24.079-61h127.892l24.079 61h58.055L290.369 109Zm-8.261 168L256 169l42.63 108Z"/></svg>
|
package/index.d.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
export { LexicalHtmlRenderer } from "./components/LexicalHtmlRenderer";
|
|
2
2
|
export { useRichTextEditor } from "./hooks/useRichTextEditor";
|
|
3
|
+
export { useFontColorPicker } from "./hooks/useFontColorPicker";
|
|
4
|
+
export { useTypographyAction } from "./hooks/useTypographyAction";
|
|
3
5
|
export { Divider } from "./ui/Divider";
|
|
4
6
|
export { DropDownItem } from "./ui/DropDown";
|
|
5
7
|
export { DropDown } from "./ui/DropDown";
|
|
@@ -7,11 +9,13 @@ export { BoldAction } from "./components/ToolbarActions/BoldAction";
|
|
|
7
9
|
export { BulletListAction } from "./components/ToolbarActions/BulletListAction";
|
|
8
10
|
export { CodeHighlightAction } from "./components/ToolbarActions/CodeHighlightAction";
|
|
9
11
|
export { FontSizeAction } from "./components/ToolbarActions/FontSizeAction";
|
|
12
|
+
export { FontColorAction } from "./components/ToolbarActions/FontColorAction";
|
|
10
13
|
export { ItalicAction } from "./components/ToolbarActions/ItalicAction";
|
|
11
14
|
export { LinkAction } from "./components/ToolbarActions/LinkAction";
|
|
12
15
|
export { NumberedListAction } from "./components/ToolbarActions/NumberedListAction";
|
|
13
16
|
export { QuoteAction } from "./components/ToolbarActions/QuoteAction";
|
|
14
17
|
export { UnderlineAction } from "./components/ToolbarActions/UnderlineAction";
|
|
18
|
+
export { TypographyAction } from "./components/ToolbarActions/TypographyAction";
|
|
15
19
|
export { HeadingToolbar } from "./components/Toolbar/HeadingToolbar";
|
|
16
20
|
export { ParagraphToolbar } from "./components/Toolbar/ParagraphToolbar";
|
|
17
21
|
export { Toolbar } from "./components/Toolbar/Toolbar";
|
|
@@ -25,10 +29,12 @@ export { FloatingLinkEditorPlugin } from "./plugins/FloatingLinkEditorPlugin/Flo
|
|
|
25
29
|
export { CodeHighlightPlugin } from "./plugins/CodeHighlightPlugin/CodeHighlightPlugin";
|
|
26
30
|
export { ClickableLinkPlugin } from "./plugins/ClickableLinkPlugin/ClickableLinkPlugin";
|
|
27
31
|
export { BlurEventPlugin } from "./plugins/BlurEventPlugin/BlurEventPlugin";
|
|
28
|
-
export { LexicalUpdateStatePlugin } from "./plugins/LexicalUpdateStatePlugin";
|
|
32
|
+
export { LexicalUpdateStatePlugin } from "./plugins/LexicalUpdateStatePlugin/LexicalUpdateStatePlugin";
|
|
29
33
|
export { AddToolbarAction } from "./components/AddToolbarAction";
|
|
30
34
|
export { AddRichTextEditorPlugin } from "./components/AddRichTextEditorPlugin";
|
|
31
35
|
export { AddRichTextEditorNodeType } from "./components/AddRichTextEditorNodeType";
|
|
32
36
|
export { generateInitialLexicalValue } from "./utils/generateInitialLexicalValue";
|
|
33
37
|
export { isValidLexicalData } from "./utils/isValidLexicalData";
|
|
38
|
+
export { clearNodeFormatting } from "./utils/nodes/clearNodeFormating";
|
|
34
39
|
export * as types from "./types";
|
|
40
|
+
export { LexicalEditorConfig } from "./components/LexicalEditorConfig/LexicalEditorConfig";
|
package/index.js
CHANGED
|
@@ -82,6 +82,12 @@ Object.defineProperty(exports, "FloatingLinkEditorPlugin", {
|
|
|
82
82
|
return _FloatingLinkEditorPlugin.FloatingLinkEditorPlugin;
|
|
83
83
|
}
|
|
84
84
|
});
|
|
85
|
+
Object.defineProperty(exports, "FontColorAction", {
|
|
86
|
+
enumerable: true,
|
|
87
|
+
get: function get() {
|
|
88
|
+
return _FontColorAction.FontColorAction;
|
|
89
|
+
}
|
|
90
|
+
});
|
|
85
91
|
Object.defineProperty(exports, "FontSizeAction", {
|
|
86
92
|
enumerable: true,
|
|
87
93
|
get: function get() {
|
|
@@ -112,6 +118,12 @@ Object.defineProperty(exports, "ItalicAction", {
|
|
|
112
118
|
return _ItalicAction.ItalicAction;
|
|
113
119
|
}
|
|
114
120
|
});
|
|
121
|
+
Object.defineProperty(exports, "LexicalEditorConfig", {
|
|
122
|
+
enumerable: true,
|
|
123
|
+
get: function get() {
|
|
124
|
+
return _LexicalEditorConfig.LexicalEditorConfig;
|
|
125
|
+
}
|
|
126
|
+
});
|
|
115
127
|
Object.defineProperty(exports, "LexicalHtmlRenderer", {
|
|
116
128
|
enumerable: true,
|
|
117
129
|
get: function get() {
|
|
@@ -178,12 +190,24 @@ Object.defineProperty(exports, "Toolbar", {
|
|
|
178
190
|
return _Toolbar.Toolbar;
|
|
179
191
|
}
|
|
180
192
|
});
|
|
193
|
+
Object.defineProperty(exports, "TypographyAction", {
|
|
194
|
+
enumerable: true,
|
|
195
|
+
get: function get() {
|
|
196
|
+
return _TypographyAction.TypographyAction;
|
|
197
|
+
}
|
|
198
|
+
});
|
|
181
199
|
Object.defineProperty(exports, "UnderlineAction", {
|
|
182
200
|
enumerable: true,
|
|
183
201
|
get: function get() {
|
|
184
202
|
return _UnderlineAction.UnderlineAction;
|
|
185
203
|
}
|
|
186
204
|
});
|
|
205
|
+
Object.defineProperty(exports, "clearNodeFormatting", {
|
|
206
|
+
enumerable: true,
|
|
207
|
+
get: function get() {
|
|
208
|
+
return _clearNodeFormating.clearNodeFormatting;
|
|
209
|
+
}
|
|
210
|
+
});
|
|
187
211
|
Object.defineProperty(exports, "generateInitialLexicalValue", {
|
|
188
212
|
enumerable: true,
|
|
189
213
|
get: function get() {
|
|
@@ -197,25 +221,41 @@ Object.defineProperty(exports, "isValidLexicalData", {
|
|
|
197
221
|
}
|
|
198
222
|
});
|
|
199
223
|
exports.types = void 0;
|
|
224
|
+
Object.defineProperty(exports, "useFontColorPicker", {
|
|
225
|
+
enumerable: true,
|
|
226
|
+
get: function get() {
|
|
227
|
+
return _useFontColorPicker.useFontColorPicker;
|
|
228
|
+
}
|
|
229
|
+
});
|
|
200
230
|
Object.defineProperty(exports, "useRichTextEditor", {
|
|
201
231
|
enumerable: true,
|
|
202
232
|
get: function get() {
|
|
203
233
|
return _useRichTextEditor.useRichTextEditor;
|
|
204
234
|
}
|
|
205
235
|
});
|
|
236
|
+
Object.defineProperty(exports, "useTypographyAction", {
|
|
237
|
+
enumerable: true,
|
|
238
|
+
get: function get() {
|
|
239
|
+
return _useTypographyAction.useTypographyAction;
|
|
240
|
+
}
|
|
241
|
+
});
|
|
206
242
|
var _LexicalHtmlRenderer = require("./components/LexicalHtmlRenderer");
|
|
207
243
|
var _useRichTextEditor = require("./hooks/useRichTextEditor");
|
|
244
|
+
var _useFontColorPicker = require("./hooks/useFontColorPicker");
|
|
245
|
+
var _useTypographyAction = require("./hooks/useTypographyAction");
|
|
208
246
|
var _Divider = require("./ui/Divider");
|
|
209
247
|
var _DropDown = require("./ui/DropDown");
|
|
210
248
|
var _BoldAction = require("./components/ToolbarActions/BoldAction");
|
|
211
249
|
var _BulletListAction = require("./components/ToolbarActions/BulletListAction");
|
|
212
250
|
var _CodeHighlightAction = require("./components/ToolbarActions/CodeHighlightAction");
|
|
213
251
|
var _FontSizeAction = require("./components/ToolbarActions/FontSizeAction");
|
|
252
|
+
var _FontColorAction = require("./components/ToolbarActions/FontColorAction");
|
|
214
253
|
var _ItalicAction = require("./components/ToolbarActions/ItalicAction");
|
|
215
254
|
var _LinkAction = require("./components/ToolbarActions/LinkAction");
|
|
216
255
|
var _NumberedListAction = require("./components/ToolbarActions/NumberedListAction");
|
|
217
256
|
var _QuoteAction = require("./components/ToolbarActions/QuoteAction");
|
|
218
257
|
var _UnderlineAction = require("./components/ToolbarActions/UnderlineAction");
|
|
258
|
+
var _TypographyAction = require("./components/ToolbarActions/TypographyAction");
|
|
219
259
|
var _HeadingToolbar = require("./components/Toolbar/HeadingToolbar");
|
|
220
260
|
var _ParagraphToolbar = require("./components/Toolbar/ParagraphToolbar");
|
|
221
261
|
var _Toolbar = require("./components/Toolbar/Toolbar");
|
|
@@ -229,11 +269,13 @@ var _FloatingLinkEditorPlugin = require("./plugins/FloatingLinkEditorPlugin/Floa
|
|
|
229
269
|
var _CodeHighlightPlugin = require("./plugins/CodeHighlightPlugin/CodeHighlightPlugin");
|
|
230
270
|
var _ClickableLinkPlugin = require("./plugins/ClickableLinkPlugin/ClickableLinkPlugin");
|
|
231
271
|
var _BlurEventPlugin = require("./plugins/BlurEventPlugin/BlurEventPlugin");
|
|
232
|
-
var _LexicalUpdateStatePlugin = require("./plugins/LexicalUpdateStatePlugin");
|
|
272
|
+
var _LexicalUpdateStatePlugin = require("./plugins/LexicalUpdateStatePlugin/LexicalUpdateStatePlugin");
|
|
233
273
|
var _AddToolbarAction = require("./components/AddToolbarAction");
|
|
234
274
|
var _AddRichTextEditorPlugin = require("./components/AddRichTextEditorPlugin");
|
|
235
275
|
var _AddRichTextEditorNodeType = require("./components/AddRichTextEditorNodeType");
|
|
236
276
|
var _generateInitialLexicalValue = require("./utils/generateInitialLexicalValue");
|
|
237
277
|
var _isValidLexicalData = require("./utils/isValidLexicalData");
|
|
278
|
+
var _clearNodeFormating = require("./utils/nodes/clearNodeFormating");
|
|
238
279
|
var _types = _interopRequireWildcard(require("./types"));
|
|
239
|
-
exports.types = _types;
|
|
280
|
+
exports.types = _types;
|
|
281
|
+
var _LexicalEditorConfig = require("./components/LexicalEditorConfig/LexicalEditorConfig");
|
package/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[
|
|
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 {};
|