@webiny/lexical-editor 6.0.0-alpha.5 → 6.0.0-rc.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/README.md +6 -12
- package/commands/index.d.ts +5 -5
- package/commands/index.js +5 -5
- package/commands/index.js.map +1 -1
- package/components/Editor/EnsureHeadingTagPlugin.js +1 -1
- package/components/Editor/EnsureHeadingTagPlugin.js.map +1 -1
- package/components/Editor/RichTextEditor.d.ts +11 -6
- package/components/Editor/RichTextEditor.js +22 -16
- package/components/Editor/RichTextEditor.js.map +1 -1
- package/components/Editor/normalizeInputValue.d.ts +1 -1
- package/components/Editor/normalizeInputValue.js.map +1 -1
- package/components/LexicalEditorConfig/LexicalEditorConfig.d.ts +14 -16
- package/components/LexicalEditorConfig/LexicalEditorConfig.js +20 -58
- package/components/LexicalEditorConfig/LexicalEditorConfig.js.map +1 -1
- package/components/LexicalHtmlRenderer.d.ts +3 -6
- package/components/LexicalHtmlRenderer.js +12 -17
- package/components/LexicalHtmlRenderer.js.map +1 -1
- package/components/Toolbar/StaticToolbar.css +416 -0
- package/components/Toolbar/StaticToolbar.d.ts +1 -1
- package/components/Toolbar/StaticToolbar.js +2 -2
- package/components/Toolbar/StaticToolbar.js.map +1 -1
- package/components/ToolbarActions/BoldAction.js +2 -2
- package/components/ToolbarActions/BoldAction.js.map +1 -1
- package/components/ToolbarActions/BulletListAction.js +5 -6
- package/components/ToolbarActions/BulletListAction.js.map +1 -1
- package/components/ToolbarActions/CodeHighlightAction.js +2 -2
- package/components/ToolbarActions/CodeHighlightAction.js.map +1 -1
- package/components/ToolbarActions/FontColorAction.js +4 -4
- package/components/ToolbarActions/FontColorAction.js.map +1 -1
- package/components/ToolbarActions/ImageAction.js +3 -3
- package/components/ToolbarActions/ImageAction.js.map +1 -1
- package/components/ToolbarActions/ItalicAction.js +2 -2
- package/components/ToolbarActions/ItalicAction.js.map +1 -1
- package/components/ToolbarActions/LinkAction.js +3 -3
- package/components/ToolbarActions/LinkAction.js.map +1 -1
- package/components/ToolbarActions/NumberedListAction.js +7 -11
- package/components/ToolbarActions/NumberedListAction.js.map +1 -1
- package/components/ToolbarActions/QuoteAction.js +6 -6
- package/components/ToolbarActions/QuoteAction.js.map +1 -1
- package/components/ToolbarActions/TextAlignmentAction.js +4 -4
- package/components/ToolbarActions/TextAlignmentAction.js.map +1 -1
- package/components/ToolbarActions/TypographyAction.js +14 -11
- package/components/ToolbarActions/TypographyAction.js.map +1 -1
- package/components/ToolbarActions/UnderlineAction.js +1 -1
- package/components/ToolbarActions/UnderlineAction.js.map +1 -1
- package/context/RichTextEditorContext.d.ts +5 -6
- package/context/RichTextEditorContext.js +17 -4
- package/context/RichTextEditorContext.js.map +1 -1
- package/context/TypographyActionContext.d.ts +1 -1
- package/context/TypographyActionContext.js.map +1 -1
- package/exports/admin/lexical.d.ts +15 -0
- package/exports/admin/lexical.js +23 -0
- package/exports/admin/lexical.js.map +1 -0
- package/hooks/index.d.ts +7 -8
- package/hooks/index.js +7 -8
- package/hooks/index.js.map +1 -1
- package/hooks/useCurrentElement.js +2 -3
- package/hooks/useCurrentElement.js.map +1 -1
- package/hooks/useCurrentSelection.js +4 -4
- package/hooks/useCurrentSelection.js.map +1 -1
- package/hooks/useFontColorPicker.d.ts +1 -1
- package/hooks/useFontColorPicker.js +1 -1
- package/hooks/useFontColorPicker.js.map +1 -1
- package/hooks/useRichTextEditor.d.ts +1 -1
- package/hooks/useRichTextEditor.js +1 -1
- package/hooks/useRichTextEditor.js.map +1 -1
- package/hooks/useTextAlignmentAction.d.ts +1 -1
- package/hooks/useTextAlignmentAction.js +1 -1
- package/hooks/useTextAlignmentAction.js.map +1 -1
- package/hooks/useTypographyAction.d.ts +1 -1
- package/hooks/useTypographyAction.js +1 -1
- package/hooks/useTypographyAction.js.map +1 -1
- package/index.d.ts +33 -37
- package/index.js +33 -37
- package/index.js.map +1 -1
- package/package.json +18 -22
- package/plugins/BlurEventPlugin/BlurEventPlugin.d.ts +1 -1
- package/plugins/BlurEventPlugin/BlurEventPlugin.js +1 -1
- package/plugins/BlurEventPlugin/BlurEventPlugin.js.map +1 -1
- package/plugins/CodeHighlightPlugin/CodeHighlightPlugin.js +1 -1
- package/plugins/CodeHighlightPlugin/CodeHighlightPlugin.js.map +1 -1
- package/plugins/CodeHighlightPlugin/index.d.ts +1 -1
- package/plugins/CodeHighlightPlugin/index.js +1 -1
- package/plugins/CodeHighlightPlugin/index.js.map +1 -1
- package/plugins/FloatingLinkEditorPlugin/FloatingLinkEditor.d.ts +4 -10
- package/plugins/FloatingLinkEditorPlugin/FloatingLinkEditor.js +15 -145
- package/plugins/FloatingLinkEditorPlugin/FloatingLinkEditor.js.map +1 -1
- package/plugins/FloatingLinkEditorPlugin/FloatingLinkEditorController.d.ts +2 -3
- package/plugins/FloatingLinkEditorPlugin/FloatingLinkEditorController.js +10 -11
- package/plugins/FloatingLinkEditorPlugin/FloatingLinkEditorController.js.map +1 -1
- package/plugins/FloatingLinkEditorPlugin/FloatingLinkEditorPlugin.css +1 -136
- package/plugins/FloatingLinkEditorPlugin/FloatingLinkEditorPlugin.d.ts +5 -6
- package/plugins/FloatingLinkEditorPlugin/FloatingLinkEditorPlugin.js +3 -7
- package/plugins/FloatingLinkEditorPlugin/FloatingLinkEditorPlugin.js.map +1 -1
- package/plugins/FloatingLinkEditorPlugin/index.d.ts +1 -1
- package/plugins/FloatingLinkEditorPlugin/index.js +1 -1
- package/plugins/FloatingLinkEditorPlugin/index.js.map +1 -1
- package/plugins/FloatingLinkEditorPlugin/types.d.ts +10 -0
- package/plugins/FloatingLinkEditorPlugin/types.js +3 -0
- package/plugins/FloatingLinkEditorPlugin/types.js.map +1 -0
- package/plugins/FloatingLinkEditorPlugin/useFloatingLinkEditor.d.ts +8 -0
- package/plugins/FloatingLinkEditorPlugin/useFloatingLinkEditor.js +128 -0
- package/plugins/FloatingLinkEditorPlugin/useFloatingLinkEditor.js.map +1 -0
- package/plugins/FontColorPlugin/FontColorPlugin.js +2 -2
- package/plugins/FontColorPlugin/FontColorPlugin.js.map +1 -1
- package/plugins/FontColorPlugin/applyColorToSelection.js +1 -1
- package/plugins/FontColorPlugin/applyColorToSelection.js.map +1 -1
- package/plugins/ImagesPlugin/ImagesPlugin.d.ts +1 -2
- package/plugins/ImagesPlugin/ImagesPlugin.js +5 -8
- package/plugins/ImagesPlugin/ImagesPlugin.js.map +1 -1
- package/plugins/LinkPlugin/LinkPlugin.js +2 -3
- package/plugins/LinkPlugin/LinkPlugin.js.map +1 -1
- package/plugins/ListPLugin/ListPlugin.js +45 -3
- package/plugins/ListPLugin/ListPlugin.js.map +1 -1
- package/plugins/QuoteNodePlugin/QuoteNodePlugin.js +12 -4
- package/plugins/QuoteNodePlugin/QuoteNodePlugin.js.map +1 -1
- package/plugins/StateHandlingPlugin.d.ts +1 -1
- package/plugins/StateHandlingPlugin.js +6 -6
- package/plugins/StateHandlingPlugin.js.map +1 -1
- package/plugins/TypographyPlugin/TypographyPlugin.js +2 -2
- package/plugins/TypographyPlugin/TypographyPlugin.js.map +1 -1
- package/types.d.ts +3 -3
- package/types.js +1 -1
- package/types.js.map +1 -1
- package/ui/ContentEditable.d.ts +0 -1
- package/ui/Divider.d.ts +0 -1
- package/ui/DropDown.js +4 -3
- package/ui/DropDown.js.map +1 -1
- package/ui/ImageResizer.d.ts +0 -1
- package/ui/ImageResizer.js.map +1 -1
- package/ui/LinkPreview.d.ts +0 -1
- package/ui/TextInput.d.ts +0 -1
- package/utils/files.d.ts +6 -6
- package/utils/files.js +3 -13
- package/utils/files.js.map +1 -1
- package/utils/insertImage.d.ts +1 -1
- package/utils/insertImage.js.map +1 -1
- package/utils/isValidLexicalData.d.ts +2 -2
- package/utils/isValidLexicalData.js.map +1 -1
- package/utils/rect.d.ts +1 -1
- package/utils/rect.js +1 -1
- package/utils/rect.js.map +1 -1
- package/utils/sanitizeUrl.js +1 -1
- package/utils/sanitizeUrl.js.map +1 -1
- package/utils/setFloatingElemPosition.d.ts +1 -1
- package/utils/setFloatingElemPosition.js +23 -21
- package/utils/setFloatingElemPosition.js.map +1 -1
- package/components/Editor/HeadingEditor.d.ts +0 -7
- package/components/Editor/HeadingEditor.js +0 -22
- package/components/Editor/HeadingEditor.js.map +0 -1
- package/components/Editor/ParagraphEditor.d.ts +0 -7
- package/components/Editor/ParagraphEditor.js +0 -22
- package/components/Editor/ParagraphEditor.js.map +0 -1
- package/components/Toolbar/Toolbar.css +0 -643
- package/components/Toolbar/Toolbar.d.ts +0 -6
- package/components/Toolbar/Toolbar.js +0 -148
- package/components/Toolbar/Toolbar.js.map +0 -1
- package/components/ToolbarActions/FontSizeAction.d.ts +0 -14
- package/components/ToolbarActions/FontSizeAction.js +0 -91
- package/components/ToolbarActions/FontSizeAction.js.map +0 -1
- package/hooks/useList.d.ts +0 -2
- package/hooks/useList.js +0 -50
- package/hooks/useList.js.map +0 -1
- package/hooks/useQuote.d.ts +0 -2
- package/hooks/useQuote.js +0 -17
- package/hooks/useQuote.js.map +0 -1
- package/plugins/FloatingLinkEditorPlugin/LinkEditForm.d.ts +0 -8
- package/plugins/FloatingLinkEditorPlugin/LinkEditForm.js +0 -104
- package/plugins/FloatingLinkEditorPlugin/LinkEditForm.js.map +0 -1
- package/plugins/FloatingLinkEditorPlugin/LinkPreviewForm.d.ts +0 -9
- package/plugins/FloatingLinkEditorPlugin/LinkPreviewForm.js +0 -34
- package/plugins/FloatingLinkEditorPlugin/LinkPreviewForm.js.map +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { useContext } from "react";
|
|
2
|
-
import { FontColorActionContext } from "../context/FontColorActionContext";
|
|
2
|
+
import { FontColorActionContext } from "../context/FontColorActionContext.js";
|
|
3
3
|
export function useFontColorPicker() {
|
|
4
4
|
const context = useContext(FontColorActionContext);
|
|
5
5
|
if (!context) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["useContext","FontColorActionContext","useFontColorPicker","context","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,SAASA,UAAU,QAAQ,OAAO;AAClC,SAASC,sBAAsB;AAE/B,OAAO,SAASC,kBAAkBA,CAAA,EAAG;EACjC,MAAMC,OAAO,GAAGH,UAAU,CAACC,sBAAsB,CAAC;EAClD,IAAI,CAACE,OAAO,EAAE;IACV,MAAMC,KAAK,CACP,qHACJ,CAAC;EACL;EAEA,OAAOD,OAAO;AAClB","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["useContext","FontColorActionContext","useFontColorPicker","context","Error"],"sources":["useFontColorPicker.ts"],"sourcesContent":["import { useContext } from \"react\";\nimport { FontColorActionContext } from \"~/context/FontColorActionContext.js\";\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,SAASA,UAAU,QAAQ,OAAO;AAClC,SAASC,sBAAsB;AAE/B,OAAO,SAASC,kBAAkBA,CAAA,EAAG;EACjC,MAAMC,OAAO,GAAGH,UAAU,CAACC,sBAAsB,CAAC;EAClD,IAAI,CAACE,OAAO,EAAE;IACV,MAAMC,KAAK,CACP,qHACJ,CAAC;EACL;EAEA,OAAOD,OAAO;AAClB","ignoreList":[]}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { RichTextEditorContext } from "../context/RichTextEditorContext";
|
|
1
|
+
import { RichTextEditorContext } from "../context/RichTextEditorContext.js";
|
|
2
2
|
export declare function useRichTextEditor(): RichTextEditorContext;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { useContext } from "react";
|
|
2
|
-
import { RichTextEditorContext } from "../context/RichTextEditorContext";
|
|
2
|
+
import { RichTextEditorContext } from "../context/RichTextEditorContext.js";
|
|
3
3
|
export function useRichTextEditor() {
|
|
4
4
|
const context = useContext(RichTextEditorContext);
|
|
5
5
|
if (!context) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["useContext","RichTextEditorContext","useRichTextEditor","context","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,SAASA,UAAU,QAAQ,OAAO;AAClC,SAASC,qBAAqB;AAE9B,OAAO,SAASC,iBAAiBA,CAAA,EAAG;EAChC,MAAMC,OAAO,GAAGH,UAAU,CAACC,qBAAqB,CAAC;EACjD,IAAI,CAACE,OAAO,EAAE;IACV,MAAMC,KAAK,CACP,mHACJ,CAAC;EACL;EAEA,OAAOD,OAAO;AAClB","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["useContext","RichTextEditorContext","useRichTextEditor","context","Error"],"sources":["useRichTextEditor.ts"],"sourcesContent":["import { useContext } from \"react\";\nimport { RichTextEditorContext } from \"~/context/RichTextEditorContext.js\";\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,SAASA,UAAU,QAAQ,OAAO;AAClC,SAASC,qBAAqB;AAE9B,OAAO,SAASC,iBAAiBA,CAAA,EAAG;EAChC,MAAMC,OAAO,GAAGH,UAAU,CAACC,qBAAqB,CAAC;EACjD,IAAI,CAACE,OAAO,EAAE;IACV,MAAMC,KAAK,CACP,mHACJ,CAAC;EACL;EAEA,OAAOD,OAAO;AAClB","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare function useTextAlignmentAction(): import("
|
|
1
|
+
export declare function useTextAlignmentAction(): import("~/context/TextAlignmentActionContextProps.js").TextAlignmentActionContextProps;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { useContext } from "react";
|
|
2
|
-
import { TextAlignmentActionContext } from "../context/TextAlignmentActionContextProps";
|
|
2
|
+
import { TextAlignmentActionContext } from "../context/TextAlignmentActionContextProps.js";
|
|
3
3
|
export function useTextAlignmentAction() {
|
|
4
4
|
const context = useContext(TextAlignmentActionContext);
|
|
5
5
|
if (!context) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["useContext","TextAlignmentActionContext","useTextAlignmentAction","context","Error"],"sources":["useTextAlignmentAction.ts"],"sourcesContent":["import { useContext } from \"react\";\nimport { TextAlignmentActionContext } from \"~/context/TextAlignmentActionContextProps\";\n\nexport function useTextAlignmentAction() {\n const context = useContext(TextAlignmentActionContext);\n if (!context) {\n throw Error(\n `Missing TextAlignmentActionContext in the component hierarchy. Are you using \"useTextAlignmentAction()\" in the right place?`\n );\n }\n\n return context;\n}\n"],"mappings":"AAAA,SAASA,UAAU,QAAQ,OAAO;AAClC,SAASC,0BAA0B;AAEnC,OAAO,SAASC,sBAAsBA,CAAA,EAAG;EACrC,MAAMC,OAAO,GAAGH,UAAU,CAACC,0BAA0B,CAAC;EACtD,IAAI,CAACE,OAAO,EAAE;IACV,MAAMC,KAAK,CACP,6HACJ,CAAC;EACL;EAEA,OAAOD,OAAO;AAClB","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["useContext","TextAlignmentActionContext","useTextAlignmentAction","context","Error"],"sources":["useTextAlignmentAction.ts"],"sourcesContent":["import { useContext } from \"react\";\nimport { TextAlignmentActionContext } from \"~/context/TextAlignmentActionContextProps.js\";\n\nexport function useTextAlignmentAction() {\n const context = useContext(TextAlignmentActionContext);\n if (!context) {\n throw Error(\n `Missing TextAlignmentActionContext in the component hierarchy. Are you using \"useTextAlignmentAction()\" in the right place?`\n );\n }\n\n return context;\n}\n"],"mappings":"AAAA,SAASA,UAAU,QAAQ,OAAO;AAClC,SAASC,0BAA0B;AAEnC,OAAO,SAASC,sBAAsBA,CAAA,EAAG;EACrC,MAAMC,OAAO,GAAGH,UAAU,CAACC,0BAA0B,CAAC;EACtD,IAAI,CAACE,OAAO,EAAE;IACV,MAAMC,KAAK,CACP,6HACJ,CAAC;EACL;EAEA,OAAOD,OAAO;AAClB","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare function useTypographyAction(): import("
|
|
1
|
+
export declare function useTypographyAction(): import("~/context/TypographyActionContext.js").TypographyActionContextProps;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { useContext } from "react";
|
|
2
|
-
import { TypographyActionContext } from "../context/TypographyActionContext";
|
|
2
|
+
import { TypographyActionContext } from "../context/TypographyActionContext.js";
|
|
3
3
|
export function useTypographyAction() {
|
|
4
4
|
const context = useContext(TypographyActionContext);
|
|
5
5
|
if (!context) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["useContext","TypographyActionContext","useTypographyAction","context","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,SAASA,UAAU,QAAQ,OAAO;AAClC,SAASC,uBAAuB;AAEhC,OAAO,SAASC,mBAAmBA,CAAA,EAAG;EAClC,MAAMC,OAAO,GAAGH,UAAU,CAACC,uBAAuB,CAAC;EACnD,IAAI,CAACE,OAAO,EAAE;IACV,MAAMC,KAAK,CACP,uHACJ,CAAC;EACL;EAEA,OAAOD,OAAO;AAClB","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["useContext","TypographyActionContext","useTypographyAction","context","Error"],"sources":["useTypographyAction.ts"],"sourcesContent":["import { useContext } from \"react\";\nimport { TypographyActionContext } from \"~/context/TypographyActionContext.js\";\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,SAASA,UAAU,QAAQ,OAAO;AAClC,SAASC,uBAAuB;AAEhC,OAAO,SAASC,mBAAmBA,CAAA,EAAG;EAClC,MAAMC,OAAO,GAAGH,UAAU,CAACC,uBAAuB,CAAC;EACnD,IAAI,CAACE,OAAO,EAAE;IACV,MAAMC,KAAK,CACP,uHACJ,CAAC;EACL;EAEA,OAAOD,OAAO;AAClB","ignoreList":[]}
|
package/index.d.ts
CHANGED
|
@@ -1,37 +1,33 @@
|
|
|
1
|
-
export { LexicalHtmlRenderer } from "./components/LexicalHtmlRenderer";
|
|
2
|
-
export * from "./hooks";
|
|
3
|
-
export { Divider } from "./ui/Divider";
|
|
4
|
-
export { DropDownItem } from "./ui/DropDown";
|
|
5
|
-
export { DropDown } from "./ui/DropDown";
|
|
6
|
-
export { BoldAction } from "./components/ToolbarActions/BoldAction";
|
|
7
|
-
export { BulletListAction } from "./components/ToolbarActions/BulletListAction";
|
|
8
|
-
export { CodeHighlightAction } from "./components/ToolbarActions/CodeHighlightAction";
|
|
9
|
-
export {
|
|
10
|
-
export {
|
|
11
|
-
export {
|
|
12
|
-
export {
|
|
13
|
-
export {
|
|
14
|
-
export {
|
|
15
|
-
export {
|
|
16
|
-
export {
|
|
17
|
-
export {
|
|
18
|
-
export {
|
|
19
|
-
export {
|
|
20
|
-
export {
|
|
21
|
-
export {
|
|
22
|
-
export {
|
|
23
|
-
export {
|
|
24
|
-
export {
|
|
25
|
-
export {
|
|
26
|
-
export {
|
|
27
|
-
export {
|
|
28
|
-
export {
|
|
29
|
-
export {
|
|
30
|
-
export {
|
|
31
|
-
export
|
|
32
|
-
export
|
|
33
|
-
export {
|
|
34
|
-
export { isValidLexicalData } from "./utils/isValidLexicalData";
|
|
35
|
-
export * from "./commands";
|
|
36
|
-
export * as types from "./types";
|
|
37
|
-
export { LexicalEditorConfig, useLexicalEditorConfig } from "./components/LexicalEditorConfig/LexicalEditorConfig";
|
|
1
|
+
export { LexicalHtmlRenderer } from "./components/LexicalHtmlRenderer.js";
|
|
2
|
+
export * from "./hooks/index.js";
|
|
3
|
+
export { Divider } from "./ui/Divider.js";
|
|
4
|
+
export { DropDownItem } from "./ui/DropDown.js";
|
|
5
|
+
export { DropDown } from "./ui/DropDown.js";
|
|
6
|
+
export { BoldAction } from "./components/ToolbarActions/BoldAction.js";
|
|
7
|
+
export { BulletListAction } from "./components/ToolbarActions/BulletListAction.js";
|
|
8
|
+
export { CodeHighlightAction } from "./components/ToolbarActions/CodeHighlightAction.js";
|
|
9
|
+
export { FontColorAction } from "./components/ToolbarActions/FontColorAction.js";
|
|
10
|
+
export { ItalicAction } from "./components/ToolbarActions/ItalicAction.js";
|
|
11
|
+
export { LinkAction } from "./components/ToolbarActions/LinkAction.js";
|
|
12
|
+
export { NumberedListAction } from "./components/ToolbarActions/NumberedListAction.js";
|
|
13
|
+
export { QuoteAction } from "./components/ToolbarActions/QuoteAction.js";
|
|
14
|
+
export { UnderlineAction } from "./components/ToolbarActions/UnderlineAction.js";
|
|
15
|
+
export { TypographyAction } from "./components/ToolbarActions/TypographyAction.js";
|
|
16
|
+
export { TextAlignmentAction } from "./components/ToolbarActions/TextAlignmentAction.js";
|
|
17
|
+
export { ImageAction } from "./components/ToolbarActions/ImageAction.js";
|
|
18
|
+
export { StaticToolbar } from "./components/Toolbar/StaticToolbar.js";
|
|
19
|
+
export { RichTextEditor } from "./components/Editor/RichTextEditor.js";
|
|
20
|
+
export { LinkPlugin } from "./plugins/LinkPlugin/LinkPlugin.js";
|
|
21
|
+
export { FloatingLinkEditorPlugin } from "./plugins/FloatingLinkEditorPlugin/FloatingLinkEditorPlugin.js";
|
|
22
|
+
export { CodeHighlightPlugin } from "./plugins/CodeHighlightPlugin/CodeHighlightPlugin.js";
|
|
23
|
+
export { BlurEventPlugin } from "./plugins/BlurEventPlugin/BlurEventPlugin.js";
|
|
24
|
+
export { FontColorPlugin } from "./plugins/FontColorPlugin/FontColorPlugin.js";
|
|
25
|
+
export { TypographyPlugin } from "./plugins/TypographyPlugin/TypographyPlugin.js";
|
|
26
|
+
export { QuotePlugin } from "./plugins/QuoteNodePlugin/QuoteNodePlugin.js";
|
|
27
|
+
export { ListPlugin } from "./plugins/ListPLugin/ListPlugin.js";
|
|
28
|
+
export { ImagesPlugin } from "./plugins/ImagesPlugin/ImagesPlugin.js";
|
|
29
|
+
export { StateHandlingPlugin } from "./plugins/StateHandlingPlugin.js";
|
|
30
|
+
export { isValidLexicalData } from "./utils/isValidLexicalData.js";
|
|
31
|
+
export * from "./commands/index.js";
|
|
32
|
+
export * as types from "./types.js";
|
|
33
|
+
export { LexicalEditorConfig, useLexicalEditorConfig } from "./components/LexicalEditorConfig/LexicalEditorConfig.js";
|
package/index.js
CHANGED
|
@@ -1,50 +1,46 @@
|
|
|
1
1
|
// render
|
|
2
|
-
export { LexicalHtmlRenderer } from "./components/LexicalHtmlRenderer";
|
|
2
|
+
export { LexicalHtmlRenderer } from "./components/LexicalHtmlRenderer.js";
|
|
3
3
|
// hooks
|
|
4
|
-
export * from "./hooks";
|
|
4
|
+
export * from "./hooks/index.js";
|
|
5
5
|
// UI elements
|
|
6
|
-
export { Divider } from "./ui/Divider";
|
|
7
|
-
export { DropDownItem } from "./ui/DropDown";
|
|
8
|
-
export { DropDown } from "./ui/DropDown";
|
|
6
|
+
export { Divider } from "./ui/Divider.js";
|
|
7
|
+
export { DropDownItem } from "./ui/DropDown.js";
|
|
8
|
+
export { DropDown } from "./ui/DropDown.js";
|
|
9
9
|
// actions
|
|
10
|
-
export { BoldAction } from "./components/ToolbarActions/BoldAction";
|
|
11
|
-
export { BulletListAction } from "./components/ToolbarActions/BulletListAction";
|
|
12
|
-
export { CodeHighlightAction } from "./components/ToolbarActions/CodeHighlightAction";
|
|
13
|
-
export {
|
|
14
|
-
export {
|
|
15
|
-
export {
|
|
16
|
-
export {
|
|
17
|
-
export {
|
|
18
|
-
export {
|
|
19
|
-
export {
|
|
20
|
-
export {
|
|
21
|
-
export {
|
|
22
|
-
export { ImageAction } from "./components/ToolbarActions/ImageAction";
|
|
10
|
+
export { BoldAction } from "./components/ToolbarActions/BoldAction.js";
|
|
11
|
+
export { BulletListAction } from "./components/ToolbarActions/BulletListAction.js";
|
|
12
|
+
export { CodeHighlightAction } from "./components/ToolbarActions/CodeHighlightAction.js";
|
|
13
|
+
export { FontColorAction } from "./components/ToolbarActions/FontColorAction.js";
|
|
14
|
+
export { ItalicAction } from "./components/ToolbarActions/ItalicAction.js";
|
|
15
|
+
export { LinkAction } from "./components/ToolbarActions/LinkAction.js";
|
|
16
|
+
export { NumberedListAction } from "./components/ToolbarActions/NumberedListAction.js";
|
|
17
|
+
export { QuoteAction } from "./components/ToolbarActions/QuoteAction.js";
|
|
18
|
+
export { UnderlineAction } from "./components/ToolbarActions/UnderlineAction.js";
|
|
19
|
+
export { TypographyAction } from "./components/ToolbarActions/TypographyAction.js";
|
|
20
|
+
export { TextAlignmentAction } from "./components/ToolbarActions/TextAlignmentAction.js";
|
|
21
|
+
export { ImageAction } from "./components/ToolbarActions/ImageAction.js";
|
|
23
22
|
// toolbars
|
|
24
|
-
export {
|
|
25
|
-
export { StaticToolbar } from "./components/Toolbar/StaticToolbar";
|
|
23
|
+
export { StaticToolbar } from "./components/Toolbar/StaticToolbar.js";
|
|
26
24
|
// editor
|
|
27
|
-
export { RichTextEditor } from "./components/Editor/RichTextEditor";
|
|
28
|
-
export { HeadingEditor } from "./components/Editor/HeadingEditor";
|
|
29
|
-
export { ParagraphEditor } from "./components/Editor/ParagraphEditor";
|
|
25
|
+
export { RichTextEditor } from "./components/Editor/RichTextEditor.js";
|
|
30
26
|
// plugins
|
|
31
|
-
export { LinkPlugin } from "./plugins/LinkPlugin/LinkPlugin";
|
|
32
|
-
export { FloatingLinkEditorPlugin } from "./plugins/FloatingLinkEditorPlugin/FloatingLinkEditorPlugin";
|
|
33
|
-
export { CodeHighlightPlugin } from "./plugins/CodeHighlightPlugin/CodeHighlightPlugin";
|
|
34
|
-
export { BlurEventPlugin } from "./plugins/BlurEventPlugin/BlurEventPlugin";
|
|
35
|
-
export { FontColorPlugin } from "./plugins/FontColorPlugin/FontColorPlugin";
|
|
36
|
-
export { TypographyPlugin } from "./plugins/TypographyPlugin/TypographyPlugin";
|
|
37
|
-
export { QuotePlugin } from "./plugins/QuoteNodePlugin/QuoteNodePlugin";
|
|
38
|
-
export { ListPlugin } from "./plugins/ListPLugin/ListPlugin";
|
|
39
|
-
export { ImagesPlugin } from "./plugins/ImagesPlugin/ImagesPlugin";
|
|
40
|
-
export { StateHandlingPlugin } from "./plugins/StateHandlingPlugin";
|
|
27
|
+
export { LinkPlugin } from "./plugins/LinkPlugin/LinkPlugin.js";
|
|
28
|
+
export { FloatingLinkEditorPlugin } from "./plugins/FloatingLinkEditorPlugin/FloatingLinkEditorPlugin.js";
|
|
29
|
+
export { CodeHighlightPlugin } from "./plugins/CodeHighlightPlugin/CodeHighlightPlugin.js";
|
|
30
|
+
export { BlurEventPlugin } from "./plugins/BlurEventPlugin/BlurEventPlugin.js";
|
|
31
|
+
export { FontColorPlugin } from "./plugins/FontColorPlugin/FontColorPlugin.js";
|
|
32
|
+
export { TypographyPlugin } from "./plugins/TypographyPlugin/TypographyPlugin.js";
|
|
33
|
+
export { QuotePlugin } from "./plugins/QuoteNodePlugin/QuoteNodePlugin.js";
|
|
34
|
+
export { ListPlugin } from "./plugins/ListPLugin/ListPlugin.js";
|
|
35
|
+
export { ImagesPlugin } from "./plugins/ImagesPlugin/ImagesPlugin.js";
|
|
36
|
+
export { StateHandlingPlugin } from "./plugins/StateHandlingPlugin.js";
|
|
41
37
|
// utils
|
|
42
|
-
export { isValidLexicalData } from "./utils/isValidLexicalData";
|
|
38
|
+
export { isValidLexicalData } from "./utils/isValidLexicalData.js";
|
|
43
39
|
// Commands
|
|
44
|
-
export * from "./commands";
|
|
40
|
+
export * from "./commands/index.js";
|
|
45
41
|
// types
|
|
46
|
-
export * as types from "./types";
|
|
42
|
+
export * as types from "./types.js";
|
|
47
43
|
// config
|
|
48
|
-
export { LexicalEditorConfig, useLexicalEditorConfig } from "./components/LexicalEditorConfig/LexicalEditorConfig";
|
|
44
|
+
export { LexicalEditorConfig, useLexicalEditorConfig } from "./components/LexicalEditorConfig/LexicalEditorConfig.js";
|
|
49
45
|
|
|
50
46
|
//# sourceMappingURL=index.js.map
|
package/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["LexicalHtmlRenderer","Divider","DropDownItem","DropDown","BoldAction","BulletListAction","CodeHighlightAction","
|
|
1
|
+
{"version":3,"names":["LexicalHtmlRenderer","Divider","DropDownItem","DropDown","BoldAction","BulletListAction","CodeHighlightAction","FontColorAction","ItalicAction","LinkAction","NumberedListAction","QuoteAction","UnderlineAction","TypographyAction","TextAlignmentAction","ImageAction","StaticToolbar","RichTextEditor","LinkPlugin","FloatingLinkEditorPlugin","CodeHighlightPlugin","BlurEventPlugin","FontColorPlugin","TypographyPlugin","QuotePlugin","ListPlugin","ImagesPlugin","StateHandlingPlugin","isValidLexicalData","types","LexicalEditorConfig","useLexicalEditorConfig"],"sources":["index.ts"],"sourcesContent":["// render\nexport { LexicalHtmlRenderer } from \"~/components/LexicalHtmlRenderer.js\";\n// hooks\nexport * from \"./hooks/index.js\";\n// UI elements\nexport { Divider } from \"~/ui/Divider.js\";\nexport { DropDownItem } from \"~/ui/DropDown.js\";\nexport { DropDown } from \"~/ui/DropDown.js\";\n// actions\nexport { BoldAction } from \"~/components/ToolbarActions/BoldAction.js\";\nexport { BulletListAction } from \"~/components/ToolbarActions/BulletListAction.js\";\nexport { CodeHighlightAction } from \"~/components/ToolbarActions/CodeHighlightAction.js\";\nexport { FontColorAction } from \"~/components/ToolbarActions/FontColorAction.js\";\nexport { ItalicAction } from \"~/components/ToolbarActions/ItalicAction.js\";\nexport { LinkAction } from \"~/components/ToolbarActions/LinkAction.js\";\nexport { NumberedListAction } from \"~/components/ToolbarActions/NumberedListAction.js\";\nexport { QuoteAction } from \"~/components/ToolbarActions/QuoteAction.js\";\nexport { UnderlineAction } from \"~/components/ToolbarActions/UnderlineAction.js\";\nexport { TypographyAction } from \"~/components/ToolbarActions/TypographyAction.js\";\nexport { TextAlignmentAction } from \"~/components/ToolbarActions/TextAlignmentAction.js\";\nexport { ImageAction } from \"~/components/ToolbarActions/ImageAction.js\";\n// toolbars\nexport { StaticToolbar } from \"~/components/Toolbar/StaticToolbar.js\";\n// editor\nexport { RichTextEditor } from \"~/components/Editor/RichTextEditor.js\";\n// plugins\nexport { LinkPlugin } from \"~/plugins/LinkPlugin/LinkPlugin.js\";\nexport { FloatingLinkEditorPlugin } from \"~/plugins/FloatingLinkEditorPlugin/FloatingLinkEditorPlugin.js\";\nexport { CodeHighlightPlugin } from \"~/plugins/CodeHighlightPlugin/CodeHighlightPlugin.js\";\nexport { BlurEventPlugin } from \"~/plugins/BlurEventPlugin/BlurEventPlugin.js\";\nexport { FontColorPlugin } from \"~/plugins/FontColorPlugin/FontColorPlugin.js\";\nexport { TypographyPlugin } from \"~/plugins/TypographyPlugin/TypographyPlugin.js\";\nexport { QuotePlugin } from \"~/plugins/QuoteNodePlugin/QuoteNodePlugin.js\";\nexport { ListPlugin } from \"~/plugins/ListPLugin/ListPlugin.js\";\nexport { ImagesPlugin } from \"~/plugins/ImagesPlugin/ImagesPlugin.js\";\nexport { StateHandlingPlugin } from \"~/plugins/StateHandlingPlugin.js\";\n// utils\nexport { isValidLexicalData } from \"~/utils/isValidLexicalData.js\";\n// Commands\nexport * from \"~/commands/index.js\";\n// types\nexport * as types from \"./types.js\";\n// config\nexport {\n LexicalEditorConfig,\n useLexicalEditorConfig\n} from \"~/components/LexicalEditorConfig/LexicalEditorConfig.js\";\n"],"mappings":"AAAA;AACA,SAASA,mBAAmB;AAC5B;AACA;AACA;AACA,SAASC,OAAO;AAChB,SAASC,YAAY;AACrB,SAASC,QAAQ;AACjB;AACA,SAASC,UAAU;AACnB,SAASC,gBAAgB;AACzB,SAASC,mBAAmB;AAC5B,SAASC,eAAe;AACxB,SAASC,YAAY;AACrB,SAASC,UAAU;AACnB,SAASC,kBAAkB;AAC3B,SAASC,WAAW;AACpB,SAASC,eAAe;AACxB,SAASC,gBAAgB;AACzB,SAASC,mBAAmB;AAC5B,SAASC,WAAW;AACpB;AACA,SAASC,aAAa;AACtB;AACA,SAASC,cAAc;AACvB;AACA,SAASC,UAAU;AACnB,SAASC,wBAAwB;AACjC,SAASC,mBAAmB;AAC5B,SAASC,eAAe;AACxB,SAASC,eAAe;AACxB,SAASC,gBAAgB;AACzB,SAASC,WAAW;AACpB,SAASC,UAAU;AACnB,SAASC,YAAY;AACrB,SAASC,mBAAmB;AAC5B;AACA,SAASC,kBAAkB;AAC3B;AACA;AACA;AACA,OAAO,KAAKC,KAAK;AACjB;AACA,SACIC,mBAAmB,EACnBC,sBAAsB","ignoreList":[]}
|
package/package.json
CHANGED
|
@@ -1,40 +1,36 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@webiny/lexical-editor",
|
|
3
|
-
"version": "6.0.0-
|
|
3
|
+
"version": "6.0.0-rc.0",
|
|
4
|
+
"type": "module",
|
|
4
5
|
"repository": {
|
|
5
6
|
"type": "git",
|
|
6
7
|
"url": "https://github.com/webiny/webiny-js.git"
|
|
7
8
|
},
|
|
8
9
|
"license": "MIT",
|
|
9
10
|
"dependencies": {
|
|
10
|
-
"@
|
|
11
|
-
"@lexical/code": "0.
|
|
12
|
-
"@lexical/history": "0.
|
|
13
|
-
"@lexical/react": "0.
|
|
14
|
-
"@lexical/rich-text": "0.
|
|
15
|
-
"@lexical/selection": "0.
|
|
16
|
-
"@lexical/text": "0.
|
|
17
|
-
"@lexical/utils": "0.
|
|
18
|
-
"@webiny/lexical-nodes": "6.0.0-
|
|
19
|
-
"@webiny/lexical-theme": "6.0.0-
|
|
20
|
-
"@webiny/react-composition": "6.0.0-
|
|
21
|
-
"@webiny/react-properties": "6.0.0-
|
|
22
|
-
"
|
|
23
|
-
"
|
|
24
|
-
"lodash": "4.17.21",
|
|
11
|
+
"@floating-ui/dom": "1.7.5",
|
|
12
|
+
"@lexical/code": "0.40.0",
|
|
13
|
+
"@lexical/history": "0.40.0",
|
|
14
|
+
"@lexical/react": "0.40.0",
|
|
15
|
+
"@lexical/rich-text": "0.40.0",
|
|
16
|
+
"@lexical/selection": "0.40.0",
|
|
17
|
+
"@lexical/text": "0.40.0",
|
|
18
|
+
"@lexical/utils": "0.40.0",
|
|
19
|
+
"@webiny/lexical-nodes": "6.0.0-rc.0",
|
|
20
|
+
"@webiny/lexical-theme": "6.0.0-rc.0",
|
|
21
|
+
"@webiny/react-composition": "6.0.0-rc.0",
|
|
22
|
+
"@webiny/react-properties": "6.0.0-rc.0",
|
|
23
|
+
"lexical": "0.40.0",
|
|
24
|
+
"lodash": "4.17.23",
|
|
25
25
|
"react": "18.2.0",
|
|
26
26
|
"react-dom": "18.2.0"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
29
|
-
"@webiny/
|
|
29
|
+
"@webiny/build-tools": "6.0.0-rc.0"
|
|
30
30
|
},
|
|
31
31
|
"publishConfig": {
|
|
32
32
|
"access": "public",
|
|
33
33
|
"directory": "dist"
|
|
34
34
|
},
|
|
35
|
-
"
|
|
36
|
-
"build": "node ../cli/bin.js run build",
|
|
37
|
-
"watch": "node ../cli/bin.js run watch"
|
|
38
|
-
},
|
|
39
|
-
"gitHead": "b7e120541b093e91f214904a9f13e4c2c4640978"
|
|
35
|
+
"gitHead": "0f2aa699f4642e550ab62c96fcd050e8d02345c9"
|
|
40
36
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["useEffect","BLUR_COMMAND","COMMAND_PRIORITY_LOW","useRichTextEditor","BlurEventPlugin","onBlur","editor","registerCommand","editorState","getEditorState","JSON","stringify","toJSON"],"sources":["BlurEventPlugin.tsx"],"sourcesContent":["import type { FC } from \"react\";\nimport { useEffect } from \"react\";\nimport { BLUR_COMMAND, COMMAND_PRIORITY_LOW } from \"lexical\";\nimport type { LexicalValue } from \"~/types\";\nimport { useRichTextEditor } from \"~/hooks\";\n\ninterface BlurEventPlugin {\n onBlur?: (editorState: LexicalValue) => void;\n}\n\nexport const BlurEventPlugin: FC<BlurEventPlugin> = ({ onBlur }) => {\n const { editor } = useRichTextEditor();\n\n useEffect(\n () =>\n editor.registerCommand(\n BLUR_COMMAND,\n () => {\n if (typeof onBlur === \"function\") {\n const editorState = editor.getEditorState();\n onBlur(JSON.stringify(editorState.toJSON()));\n }\n return false;\n },\n COMMAND_PRIORITY_LOW\n ),\n []\n );\n return null;\n};\n"],"mappings":"AACA,SAASA,SAAS,QAAQ,OAAO;AACjC,SAASC,YAAY,EAAEC,oBAAoB,QAAQ,SAAS;AAE5D,SAASC,iBAAiB;AAM1B,OAAO,MAAMC,eAAoC,GAAGA,CAAC;EAAEC;AAAO,CAAC,KAAK;EAChE,MAAM;IAAEC;EAAO,CAAC,GAAGH,iBAAiB,CAAC,CAAC;EAEtCH,SAAS,CACL,MACIM,MAAM,CAACC,eAAe,CAClBN,YAAY,EACZ,MAAM;IACF,IAAI,OAAOI,MAAM,KAAK,UAAU,EAAE;MAC9B,MAAMG,WAAW,GAAGF,MAAM,CAACG,cAAc,CAAC,CAAC;MAC3CJ,MAAM,CAACK,IAAI,CAACC,SAAS,CAACH,WAAW,CAACI,MAAM,CAAC,CAAC,CAAC,CAAC;IAChD;IACA,OAAO,KAAK;EAChB,CAAC,EACDV,oBACJ,CAAC,EACL,EACJ,CAAC;EACD,OAAO,IAAI;AACf,CAAC","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["useEffect","BLUR_COMMAND","COMMAND_PRIORITY_LOW","useRichTextEditor","BlurEventPlugin","onBlur","editor","registerCommand","editorState","getEditorState","JSON","stringify","toJSON"],"sources":["BlurEventPlugin.tsx"],"sourcesContent":["import type { FC } from \"react\";\nimport { useEffect } from \"react\";\nimport { BLUR_COMMAND, COMMAND_PRIORITY_LOW } from \"lexical\";\nimport type { LexicalValue } from \"~/types.js\";\nimport { useRichTextEditor } from \"~/hooks/index.js\";\n\ninterface BlurEventPlugin {\n onBlur?: (editorState: LexicalValue) => void;\n}\n\nexport const BlurEventPlugin: FC<BlurEventPlugin> = ({ onBlur }) => {\n const { editor } = useRichTextEditor();\n\n useEffect(\n () =>\n editor.registerCommand(\n BLUR_COMMAND,\n () => {\n if (typeof onBlur === \"function\") {\n const editorState = editor.getEditorState();\n onBlur(JSON.stringify(editorState.toJSON()));\n }\n return false;\n },\n COMMAND_PRIORITY_LOW\n ),\n []\n );\n return null;\n};\n"],"mappings":"AACA,SAASA,SAAS,QAAQ,OAAO;AACjC,SAASC,YAAY,EAAEC,oBAAoB,QAAQ,SAAS;AAE5D,SAASC,iBAAiB;AAM1B,OAAO,MAAMC,eAAoC,GAAGA,CAAC;EAAEC;AAAO,CAAC,KAAK;EAChE,MAAM;IAAEC;EAAO,CAAC,GAAGH,iBAAiB,CAAC,CAAC;EAEtCH,SAAS,CACL,MACIM,MAAM,CAACC,eAAe,CAClBN,YAAY,EACZ,MAAM;IACF,IAAI,OAAOI,MAAM,KAAK,UAAU,EAAE;MAC9B,MAAMG,WAAW,GAAGF,MAAM,CAACG,cAAc,CAAC,CAAC;MAC3CJ,MAAM,CAACK,IAAI,CAACC,SAAS,CAACH,WAAW,CAACI,MAAM,CAAC,CAAC,CAAC,CAAC;IAChD;IACA,OAAO,KAAK;EAChB,CAAC,EACDV,oBACJ,CAAC,EACL,EACJ,CAAC;EACD,OAAO,IAAI;AACf,CAAC","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["useEffect","registerCodeHighlighting","useRichTextEditor","CodeHighlightPlugin","editor"],"sources":["CodeHighlightPlugin.tsx"],"sourcesContent":["import { useEffect } from \"react\";\nimport { registerCodeHighlighting } from \"@lexical/code\";\nimport { useRichTextEditor } from \"~/hooks\";\n\nexport function CodeHighlightPlugin() {\n const { editor } = useRichTextEditor();\n useEffect(() => {\n return registerCodeHighlighting(editor);\n }, [editor]);\n return null;\n}\n"],"mappings":"AAAA,SAASA,SAAS,QAAQ,OAAO;AACjC,SAASC,wBAAwB,QAAQ,eAAe;AACxD,SAASC,iBAAiB;AAE1B,OAAO,SAASC,mBAAmBA,CAAA,EAAG;EAClC,MAAM;IAAEC;EAAO,CAAC,GAAGF,iBAAiB,CAAC,CAAC;EACtCF,SAAS,CAAC,MAAM;IACZ,OAAOC,wBAAwB,CAACG,MAAM,CAAC;EAC3C,CAAC,EAAE,CAACA,MAAM,CAAC,CAAC;EACZ,OAAO,IAAI;AACf","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["useEffect","registerCodeHighlighting","useRichTextEditor","CodeHighlightPlugin","editor"],"sources":["CodeHighlightPlugin.tsx"],"sourcesContent":["import { useEffect } from \"react\";\nimport { registerCodeHighlighting } from \"@lexical/code\";\nimport { useRichTextEditor } from \"~/hooks/index.js\";\n\nexport function CodeHighlightPlugin() {\n const { editor } = useRichTextEditor();\n useEffect(() => {\n return registerCodeHighlighting(editor);\n }, [editor]);\n return null;\n}\n"],"mappings":"AAAA,SAASA,SAAS,QAAQ,OAAO;AACjC,SAASC,wBAAwB,QAAQ,eAAe;AACxD,SAASC,iBAAiB;AAE1B,OAAO,SAASC,mBAAmBA,CAAA,EAAG;EAClC,MAAM;IAAEC;EAAO,CAAC,GAAGF,iBAAiB,CAAC,CAAC;EACtCF,SAAS,CAAC,MAAM;IACZ,OAAOC,wBAAwB,CAACG,MAAM,CAAC;EAC3C,CAAC,EAAE,CAACA,MAAM,CAAC,CAAC;EACZ,OAAO,IAAI;AACf","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from "./CodeHighlightPlugin";
|
|
1
|
+
export * from "./CodeHighlightPlugin.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["index.ts"],"sourcesContent":["export * from \"./CodeHighlightPlugin\";\n"],"mappings":"AAAA","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":[],"sources":["index.ts"],"sourcesContent":["export * from \"./CodeHighlightPlugin.js\";\n"],"mappings":"AAAA","ignoreList":[]}
|
|
@@ -1,16 +1,10 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
export interface LinkData {
|
|
5
|
-
url: string;
|
|
6
|
-
target: string | null;
|
|
7
|
-
alt: string | null;
|
|
8
|
-
}
|
|
2
|
+
import type { LexicalEditor } from "lexical";
|
|
3
|
+
import { LinkFormProps } from "./types.js";
|
|
9
4
|
interface FloatingLinkEditorProps {
|
|
10
5
|
editor: LexicalEditor;
|
|
11
6
|
isVisible: boolean;
|
|
12
|
-
|
|
13
|
-
LinkEditForm?: typeof DefaultLinkEditForm;
|
|
7
|
+
LinkForm: React.FunctionComponent<LinkFormProps>;
|
|
14
8
|
}
|
|
15
|
-
export declare function FloatingLinkEditor({ editor, isVisible,
|
|
9
|
+
export declare function FloatingLinkEditor({ editor, isVisible, LinkForm }: FloatingLinkEditorProps): React.JSX.Element;
|
|
16
10
|
export {};
|
|
@@ -1,158 +1,28 @@
|
|
|
1
|
-
import React
|
|
2
|
-
import {
|
|
3
|
-
import { $isLinkNode, TOGGLE_LINK_COMMAND } from "@webiny/lexical-nodes";
|
|
4
|
-
import { setFloatingElemPosition } from "../../utils/setFloatingElemPosition";
|
|
5
|
-
import { sanitizeUrl } from "../../utils/sanitizeUrl";
|
|
6
|
-
import { isChildOfLinkEditor } from "./isChildOfLinkEditor";
|
|
7
|
-
import { LinkEditForm as DefaultLinkEditForm } from "./LinkEditForm";
|
|
8
|
-
import { LinkPreviewForm } from "./LinkPreviewForm";
|
|
9
|
-
import { SELECTION_CHANGE_COMMAND, COMMAND_PRIORITY_LOW, BLUR_COMMAND, $getSelection, $isRangeSelection } from "lexical";
|
|
10
|
-
import { mergeRegister } from "@lexical/utils";
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { useFloatingLinkEditor } from "./useFloatingLinkEditor.js";
|
|
11
3
|
export function FloatingLinkEditor({
|
|
12
4
|
editor,
|
|
13
5
|
isVisible,
|
|
14
|
-
|
|
15
|
-
LinkEditForm = DefaultLinkEditForm
|
|
6
|
+
LinkForm
|
|
16
7
|
}) {
|
|
17
|
-
const
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
});
|
|
23
|
-
const [isEditMode, setEditMode] = useState(false);
|
|
24
|
-
const [lastSelection, setLastSelection] = useState(null);
|
|
25
|
-
const updateLinkEditor = useCallback(() => {
|
|
26
|
-
const selection = $getSelection();
|
|
27
|
-
const emptyLinkData = {
|
|
28
|
-
url: "",
|
|
29
|
-
target: null,
|
|
30
|
-
alt: null
|
|
31
|
-
};
|
|
32
|
-
if ($isRangeSelection(selection)) {
|
|
33
|
-
const node = getSelectedNode(selection);
|
|
34
|
-
const parent = node.getParent();
|
|
35
|
-
if ($isLinkNode(parent)) {
|
|
36
|
-
const linkData = {
|
|
37
|
-
url: parent.getURL(),
|
|
38
|
-
target: parent.getTarget(),
|
|
39
|
-
alt: $isLinkNode(parent) ? parent.getAlt() : null
|
|
40
|
-
};
|
|
41
|
-
setLinkData(linkData);
|
|
42
|
-
} else if ($isLinkNode(node)) {
|
|
43
|
-
const linkData = {
|
|
44
|
-
url: node.getURL(),
|
|
45
|
-
target: node.getTarget(),
|
|
46
|
-
alt: $isLinkNode(node) ? node.getAlt() : null
|
|
47
|
-
};
|
|
48
|
-
setLinkData(linkData);
|
|
49
|
-
} else {
|
|
50
|
-
setLinkData(emptyLinkData);
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
const editorElem = editorRef.current;
|
|
54
|
-
const nativeSelection = window.getSelection();
|
|
55
|
-
const activeElement = document.activeElement;
|
|
56
|
-
if (editorElem === null) {
|
|
57
|
-
return;
|
|
58
|
-
}
|
|
59
|
-
const rootElement = editor.getRootElement();
|
|
60
|
-
if (selection !== null && nativeSelection !== null && rootElement !== null && rootElement.contains(nativeSelection.anchorNode)) {
|
|
61
|
-
const domRange = nativeSelection.getRangeAt(0);
|
|
62
|
-
let rect;
|
|
63
|
-
if (nativeSelection.anchorNode === rootElement) {
|
|
64
|
-
let inner = rootElement;
|
|
65
|
-
while (inner.firstElementChild != null) {
|
|
66
|
-
inner = inner.firstElementChild;
|
|
67
|
-
}
|
|
68
|
-
rect = inner.getBoundingClientRect();
|
|
69
|
-
} else {
|
|
70
|
-
rect = domRange.getBoundingClientRect();
|
|
71
|
-
}
|
|
72
|
-
setFloatingElemPosition(rect, editorElem, anchorElem);
|
|
73
|
-
setLastSelection(selection);
|
|
74
|
-
} else if (!activeElement || activeElement.className !== "link-input") {
|
|
75
|
-
if (rootElement !== null) {
|
|
76
|
-
setFloatingElemPosition(null, editorElem, anchorElem);
|
|
77
|
-
}
|
|
78
|
-
setLastSelection(null);
|
|
79
|
-
setEditMode(false);
|
|
80
|
-
setLinkData(emptyLinkData);
|
|
81
|
-
}
|
|
82
|
-
return true;
|
|
83
|
-
}, [anchorElem, editor]);
|
|
84
|
-
const removeLink = () => {
|
|
85
|
-
editor.dispatchCommand(TOGGLE_LINK_COMMAND, null);
|
|
86
|
-
setEditMode(false);
|
|
87
|
-
};
|
|
88
|
-
const applyChanges = linkData => {
|
|
89
|
-
const confirmedLinkData = {
|
|
90
|
-
url: sanitizeUrl(linkData.url),
|
|
91
|
-
target: linkData.target,
|
|
92
|
-
alt: linkData.alt
|
|
93
|
-
};
|
|
94
|
-
if (lastSelection !== null) {
|
|
95
|
-
editor.dispatchCommand(TOGGLE_LINK_COMMAND, confirmedLinkData);
|
|
96
|
-
setEditMode(false);
|
|
97
|
-
}
|
|
98
|
-
};
|
|
99
|
-
useEffect(() => {
|
|
100
|
-
const scrollerElem = anchorElem.parentElement;
|
|
101
|
-
const update = () => {
|
|
102
|
-
editor.getEditorState().read(() => {
|
|
103
|
-
updateLinkEditor();
|
|
104
|
-
});
|
|
105
|
-
};
|
|
106
|
-
window.addEventListener("resize", update);
|
|
107
|
-
if (scrollerElem) {
|
|
108
|
-
scrollerElem.addEventListener("scroll", update);
|
|
109
|
-
}
|
|
110
|
-
return () => {
|
|
111
|
-
window.removeEventListener("resize", update);
|
|
112
|
-
if (scrollerElem) {
|
|
113
|
-
scrollerElem.removeEventListener("scroll", update);
|
|
114
|
-
}
|
|
115
|
-
};
|
|
116
|
-
}, [anchorElem.parentElement, editor, updateLinkEditor]);
|
|
117
|
-
useEffect(() => {
|
|
118
|
-
return mergeRegister(editor.registerUpdateListener(({
|
|
119
|
-
editorState
|
|
120
|
-
}) => {
|
|
121
|
-
editorState.read(() => {
|
|
122
|
-
updateLinkEditor();
|
|
123
|
-
});
|
|
124
|
-
}), editor.registerCommand(SELECTION_CHANGE_COMMAND, () => {
|
|
125
|
-
updateLinkEditor();
|
|
126
|
-
return false;
|
|
127
|
-
}, COMMAND_PRIORITY_LOW), editor.registerCommand(BLUR_COMMAND, payload => {
|
|
128
|
-
if (!isChildOfLinkEditor(payload.relatedTarget)) {
|
|
129
|
-
// setEditMode(false);
|
|
130
|
-
}
|
|
131
|
-
return false;
|
|
132
|
-
}, COMMAND_PRIORITY_LOW));
|
|
133
|
-
}, [editor, updateLinkEditor]);
|
|
134
|
-
useEffect(() => {
|
|
135
|
-
editor.getEditorState().read(() => {
|
|
136
|
-
updateLinkEditor();
|
|
137
|
-
});
|
|
138
|
-
}, [editor, updateLinkEditor]);
|
|
8
|
+
const {
|
|
9
|
+
editorRef,
|
|
10
|
+
linkData,
|
|
11
|
+
applyChanges,
|
|
12
|
+
removeLink
|
|
13
|
+
} = useFloatingLinkEditor(editor);
|
|
139
14
|
return /*#__PURE__*/React.createElement("div", {
|
|
140
15
|
ref: editorRef,
|
|
141
|
-
className: "link-editor",
|
|
16
|
+
className: "z-dialog absolute link-editor",
|
|
142
17
|
style: {
|
|
143
|
-
|
|
18
|
+
opacity: isVisible ? 1 : 0,
|
|
19
|
+
pointerEvents: isVisible ? "auto" : "none"
|
|
144
20
|
}
|
|
145
|
-
},
|
|
21
|
+
}, isVisible ? /*#__PURE__*/React.createElement(LinkForm, {
|
|
146
22
|
linkData: linkData,
|
|
147
23
|
onSave: applyChanges,
|
|
148
|
-
|
|
149
|
-
}) :
|
|
150
|
-
linkData: linkData,
|
|
151
|
-
removeLink: removeLink,
|
|
152
|
-
onEdit: () => {
|
|
153
|
-
setEditMode(true);
|
|
154
|
-
}
|
|
155
|
-
}));
|
|
24
|
+
removeLink: removeLink
|
|
25
|
+
}) : null);
|
|
156
26
|
}
|
|
157
27
|
|
|
158
28
|
//# sourceMappingURL=FloatingLinkEditor.js.map
|