@webiny/lexical-editor 6.4.5 → 6.6.0-alpha.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.
@@ -1,13 +1,16 @@
1
1
  import type { ToolbarElementConfig } from "./components/ToolbarElement.js";
2
+ import { ToolbarElement } from "./components/ToolbarElement.js";
2
3
  import type { PluginConfig } from "./components/Plugin.js";
4
+ import { Plugin } from "./components/Plugin.js";
3
5
  import type { NodeConfig } from "./components/Node.js";
6
+ import { Node } from "./components/Node.js";
4
7
  export type { ToolbarElementConfig } from "./components/ToolbarElement.js";
5
8
  export type { PluginConfig } from "./components/Plugin.js";
6
9
  export type { NodeConfig } from "./components/Node.js";
7
10
  export declare const LexicalEditorConfig: (({ priority, children }: import("@webiny/react-properties").ConfigProps) => React.JSX.Element) & {
8
- ToolbarElement: ({ name, element, after, before, remove }: import("./components/ToolbarElement.js").ToolbarElementProps) => import("react").JSX.Element;
9
- Plugin: ({ name, element, after, before, remove }: import("./components/Plugin.js").PluginProps) => import("react").JSX.Element;
10
- Node: ({ name, node, after, before, remove }: import("./components/Node.js").NodeProps) => import("react").JSX.Element;
11
+ ToolbarElement: typeof ToolbarElement;
12
+ Plugin: typeof Plugin;
13
+ Node: typeof Node;
11
14
  };
12
15
  export declare const LexicalEditorWithConfig: ({ onProperties, children }: import("@webiny/react-properties").WithConfigProps) => React.JSX.Element;
13
16
  interface LexicalEditorConfigData {
@@ -20,8 +20,7 @@ const RichTextEditorProvider = ({ theme, toolbarActionPlugins = [], children })=
20
20
  colors: theme.colors,
21
21
  typography: theme.typography,
22
22
  fontSizes: theme.fontSizes,
23
- tokens: theme.tokens,
24
- allowCustomColors: theme.allowCustomColors
23
+ tokens: theme.tokens
25
24
  }), [
26
25
  theme
27
26
  ]);
@@ -1 +1 @@
1
- {"version":3,"file":"context/RichTextEditorContext.js","sources":["../../src/context/RichTextEditorContext.tsx"],"sourcesContent":["import React, { createContext, useCallback, useMemo } from \"react\";\nimport type { LexicalEditor } from \"lexical\";\nimport { useLexicalComposerContext } from \"@lexical/react/LexicalComposerContext\";\nimport { type EditorTheme, Theme } from \"@webiny/lexical-theme\";\nimport type { ToolbarActionPlugin } from \"~/types.js\";\n\nexport interface RichTextEditorContext {\n editor: LexicalEditor;\n getOverlaysElement: () => HTMLElement;\n toolbarActionPlugins: ToolbarActionPlugin[];\n theme: Theme;\n}\n\nexport const RichTextEditorContext = createContext<RichTextEditorContext | undefined>(undefined);\n\ninterface RichTextEditorProviderProps {\n theme: EditorTheme;\n toolbarActionPlugins?: ToolbarActionPlugin[];\n children?: React.ReactNode | React.ReactNode[];\n}\n\nexport const RichTextEditorProvider = ({\n theme,\n toolbarActionPlugins = [],\n children\n}: RichTextEditorProviderProps) => {\n const [editor] = useLexicalComposerContext();\n\n const getOverlaysElement = useCallback(() => {\n const rootElement = editor.getRootElement();\n if (!rootElement) {\n return document.body;\n }\n\n const dialogContent = rootElement.closest(\"[role='dialog']\");\n if (dialogContent) {\n return dialogContent as HTMLElement;\n }\n\n const shell = rootElement.closest(\".editor-shell\");\n if (!shell) {\n return document.body;\n }\n const overlays = shell.previousElementSibling;\n\n return (overlays ?? document.body) as HTMLElement;\n }, [editor]);\n\n const internalTheme = useMemo(\n () =>\n new Theme({\n colors: theme.colors,\n typography: theme.typography,\n fontSizes: theme.fontSizes,\n tokens: theme.tokens,\n allowCustomColors: theme.allowCustomColors\n }),\n [theme]\n );\n\n return (\n <RichTextEditorContext.Provider\n value={{\n editor,\n getOverlaysElement,\n theme: internalTheme,\n toolbarActionPlugins\n }}\n >\n {children}\n </RichTextEditorContext.Provider>\n );\n};\n"],"names":["RichTextEditorContext","createContext","undefined","RichTextEditorProvider","theme","toolbarActionPlugins","children","editor","useLexicalComposerContext","getOverlaysElement","useCallback","rootElement","document","dialogContent","shell","overlays","internalTheme","useMemo","Theme"],"mappings":";;;AAaO,MAAMA,wBAAwB,WAAHA,GAAGC,cAAiDC;AAQ/E,MAAMC,yBAAyB,CAAC,EACnCC,KAAK,EACLC,uBAAuB,EAAE,EACzBC,QAAQ,EACkB;IAC1B,MAAM,CAACC,OAAO,GAAGC;IAEjB,MAAMC,qBAAqBC,YAAY;QACnC,MAAMC,cAAcJ,OAAO,cAAc;QACzC,IAAI,CAACI,aACD,OAAOC,SAAS,IAAI;QAGxB,MAAMC,gBAAgBF,YAAY,OAAO,CAAC;QAC1C,IAAIE,eACA,OAAOA;QAGX,MAAMC,QAAQH,YAAY,OAAO,CAAC;QAClC,IAAI,CAACG,OACD,OAAOF,SAAS,IAAI;QAExB,MAAMG,WAAWD,MAAM,sBAAsB;QAE7C,OAAQC,YAAYH,SAAS,IAAI;IACrC,GAAG;QAACL;KAAO;IAEX,MAAMS,gBAAgBC,QAClB,IACI,IAAIC,MAAM;YACN,QAAQd,MAAM,MAAM;YACpB,YAAYA,MAAM,UAAU;YAC5B,WAAWA,MAAM,SAAS;YAC1B,QAAQA,MAAM,MAAM;YACpB,mBAAmBA,MAAM,iBAAiB;QAC9C,IACJ;QAACA;KAAM;IAGX,OAAO,WAAP,GACI,oBAACJ,sBAAsB,QAAQ;QAC3B,OAAO;YACHO;YACAE;YACA,OAAOO;YACPX;QACJ;OAECC;AAGb"}
1
+ {"version":3,"file":"context/RichTextEditorContext.js","sources":["../../src/context/RichTextEditorContext.tsx"],"sourcesContent":["import React, { createContext, useCallback, useMemo } from \"react\";\nimport type { LexicalEditor } from \"lexical\";\nimport { useLexicalComposerContext } from \"@lexical/react/LexicalComposerContext\";\nimport { type EditorTheme, Theme } from \"@webiny/lexical-theme\";\nimport type { ToolbarActionPlugin } from \"~/types.js\";\n\nexport interface RichTextEditorContext {\n editor: LexicalEditor;\n getOverlaysElement: () => HTMLElement;\n toolbarActionPlugins: ToolbarActionPlugin[];\n theme: Theme;\n}\n\nexport const RichTextEditorContext = createContext<RichTextEditorContext | undefined>(undefined);\n\ninterface RichTextEditorProviderProps {\n theme: EditorTheme;\n toolbarActionPlugins?: ToolbarActionPlugin[];\n children?: React.ReactNode | React.ReactNode[];\n}\n\nexport const RichTextEditorProvider = ({\n theme,\n toolbarActionPlugins = [],\n children\n}: RichTextEditorProviderProps) => {\n const [editor] = useLexicalComposerContext();\n\n const getOverlaysElement = useCallback(() => {\n const rootElement = editor.getRootElement();\n if (!rootElement) {\n return document.body;\n }\n\n const dialogContent = rootElement.closest(\"[role='dialog']\");\n if (dialogContent) {\n return dialogContent as HTMLElement;\n }\n\n const shell = rootElement.closest(\".editor-shell\");\n if (!shell) {\n return document.body;\n }\n const overlays = shell.previousElementSibling;\n\n return (overlays ?? document.body) as HTMLElement;\n }, [editor]);\n\n const internalTheme = useMemo(\n () =>\n new Theme({\n colors: theme.colors,\n typography: theme.typography,\n fontSizes: theme.fontSizes,\n tokens: theme.tokens\n }),\n [theme]\n );\n\n return (\n <RichTextEditorContext.Provider\n value={{\n editor,\n getOverlaysElement,\n theme: internalTheme,\n toolbarActionPlugins\n }}\n >\n {children}\n </RichTextEditorContext.Provider>\n );\n};\n"],"names":["RichTextEditorContext","createContext","undefined","RichTextEditorProvider","theme","toolbarActionPlugins","children","editor","useLexicalComposerContext","getOverlaysElement","useCallback","rootElement","document","dialogContent","shell","overlays","internalTheme","useMemo","Theme"],"mappings":";;;AAaO,MAAMA,wBAAwB,WAAHA,GAAGC,cAAiDC;AAQ/E,MAAMC,yBAAyB,CAAC,EACnCC,KAAK,EACLC,uBAAuB,EAAE,EACzBC,QAAQ,EACkB;IAC1B,MAAM,CAACC,OAAO,GAAGC;IAEjB,MAAMC,qBAAqBC,YAAY;QACnC,MAAMC,cAAcJ,OAAO,cAAc;QACzC,IAAI,CAACI,aACD,OAAOC,SAAS,IAAI;QAGxB,MAAMC,gBAAgBF,YAAY,OAAO,CAAC;QAC1C,IAAIE,eACA,OAAOA;QAGX,MAAMC,QAAQH,YAAY,OAAO,CAAC;QAClC,IAAI,CAACG,OACD,OAAOF,SAAS,IAAI;QAExB,MAAMG,WAAWD,MAAM,sBAAsB;QAE7C,OAAQC,YAAYH,SAAS,IAAI;IACrC,GAAG;QAACL;KAAO;IAEX,MAAMS,gBAAgBC,QAClB,IACI,IAAIC,MAAM;YACN,QAAQd,MAAM,MAAM;YACpB,YAAYA,MAAM,UAAU;YAC5B,WAAWA,MAAM,SAAS;YAC1B,QAAQA,MAAM,MAAM;QACxB,IACJ;QAACA;KAAM;IAGX,OAAO,WAAP,GACI,oBAACJ,sBAAsB,QAAQ;QAC3B,OAAO;YACHO;YACAE;YACA,OAAOO;YACPX;QACJ;OAECC;AAGb"}
@@ -2,6 +2,6 @@ import type { RangeSelection } from "lexical";
2
2
  export declare function useCurrentElement(): {
3
3
  element: null;
4
4
  } | {
5
- element: import("lexical").TextNode | import("lexical").LexicalNode;
5
+ element: import("lexical").LexicalNode | import("lexical").TextNode;
6
6
  };
7
- export declare function getNodeFromSelection(selection: RangeSelection): import("lexical").TextNode | import("lexical").LexicalNode;
7
+ export declare function getNodeFromSelection(selection: RangeSelection): import("lexical").LexicalNode | import("lexical").TextNode;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webiny/lexical-editor",
3
- "version": "6.4.5",
3
+ "version": "6.6.0-alpha.0",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": "./index.js",
@@ -12,25 +12,25 @@
12
12
  },
13
13
  "license": "MIT",
14
14
  "dependencies": {
15
- "@lexical/code": "0.46.0",
16
- "@lexical/history": "0.46.0",
17
- "@lexical/react": "0.46.0",
18
- "@lexical/rich-text": "0.46.0",
19
- "@lexical/selection": "0.46.0",
20
- "@lexical/text": "0.46.0",
21
- "@lexical/utils": "0.46.0",
22
- "@webiny/lexical-nodes": "6.4.5",
23
- "@webiny/lexical-theme": "6.4.5",
24
- "@webiny/react-composition": "6.4.5",
25
- "@webiny/react-properties": "6.4.5",
26
- "lexical": "0.46.0",
15
+ "@lexical/code": "0.48.0",
16
+ "@lexical/history": "0.48.0",
17
+ "@lexical/react": "0.48.0",
18
+ "@lexical/rich-text": "0.48.0",
19
+ "@lexical/selection": "0.48.0",
20
+ "@lexical/text": "0.48.0",
21
+ "@lexical/utils": "0.48.0",
22
+ "@webiny/lexical-nodes": "6.6.0-alpha.0",
23
+ "@webiny/lexical-theme": "6.6.0-alpha.0",
24
+ "@webiny/react-composition": "6.6.0-alpha.0",
25
+ "@webiny/react-properties": "6.6.0-alpha.0",
26
+ "lexical": "0.48.0",
27
27
  "lodash": "4.18.1",
28
- "radix-ui": "1.6.2",
28
+ "radix-ui": "1.6.7",
29
29
  "react": "18.3.1",
30
30
  "react-dom": "18.3.1"
31
31
  },
32
32
  "devDependencies": {
33
- "@webiny/build-tools": "6.4.5"
33
+ "@webiny/build-tools": "6.6.0-alpha.0"
34
34
  },
35
35
  "publishConfig": {
36
36
  "access": "public"
package/utils/rect.d.ts CHANGED
@@ -32,10 +32,10 @@ export declare class Rect {
32
32
  contains({ top, left, bottom, right }: Rect): boolean;
33
33
  intersectsWith(rect: Rect): boolean;
34
34
  generateNewRect({ left, top, right, bottom }: {
35
+ bottom?: number | undefined;
35
36
  left?: number | undefined;
36
- top?: number | undefined;
37
37
  right?: number | undefined;
38
- bottom?: number | undefined;
38
+ top?: number | undefined;
39
39
  }): Rect;
40
40
  static fromLTRB(left: number, top: number, right: number, bottom: number): Rect;
41
41
  static fromLWTH(left: number, width: number, top: number, height: number): Rect;