@webiny/lexical-editor 5.44.1-beta.0 → 5.44.1-beta.1

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,20 +1,19 @@
1
- import React from "react";
2
- import { ToolbarElementConfig } from "./components/ToolbarElement";
3
- import { PluginConfig } from "./components/Plugin";
4
- import { NodeConfig } from "./components/Node";
5
- export declare const LexicalEditorConfig: {
6
- ({ children }: {
7
- children: React.ReactNode;
8
- }): React.JSX.Element;
9
- ToolbarElement: ({ name, element, after, before, remove }: import("./components/ToolbarElement").ToolbarElementProps) => React.JSX.Element;
10
- Plugin: ({ name, element, after, before, remove }: import("./components/Plugin").PluginProps) => React.JSX.Element;
11
- Node: ({ name, node, after, before, remove }: import("./components/Node").NodeProps) => React.JSX.Element;
1
+ /// <reference types="react" />
2
+ import type { ToolbarElementConfig } from "./components/ToolbarElement.js";
3
+ import type { PluginConfig } from "./components/Plugin.js";
4
+ import type { NodeConfig } from "./components/Node.js";
5
+ export type { ToolbarElementConfig } from "./components/ToolbarElement.js";
6
+ export type { PluginConfig } from "./components/Plugin.js";
7
+ export type { NodeConfig } from "./components/Node.js";
8
+ export declare const LexicalEditorConfig: (({ priority, children }: import("@webiny/react-properties").ConfigProps) => import("react").JSX.Element) & {
9
+ ToolbarElement: ({ name, element, after, before, remove }: import("./components/ToolbarElement.js").ToolbarElementProps) => import("react").JSX.Element;
10
+ Plugin: ({ name, element, after, before, remove }: import("./components/Plugin.js").PluginProps) => import("react").JSX.Element;
11
+ Node: ({ name, node, after, before, remove }: import("./components/Node.js").NodeProps) => import("react").JSX.Element;
12
12
  };
13
- export declare const LexicalEditorWithConfig: ({ children }: {
14
- children: React.ReactNode;
15
- }) => React.JSX.Element;
16
- export declare function useLexicalEditorConfig(): {
13
+ export declare const LexicalEditorWithConfig: ({ onProperties, children }: import("@webiny/react-properties").WithConfigProps) => import("react").JSX.Element;
14
+ interface LexicalEditorConfigData {
17
15
  toolbarElements: ToolbarElementConfig[];
18
16
  plugins: PluginConfig[];
19
17
  nodes: NodeConfig[];
20
- };
18
+ }
19
+ export declare function useLexicalEditorConfig(): LexicalEditorConfigData;
@@ -1,73 +1,36 @@
1
1
  "use strict";
2
2
 
3
- var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
4
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
5
4
  Object.defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
8
7
  exports.LexicalEditorWithConfig = exports.LexicalEditorConfig = void 0;
9
8
  exports.useLexicalEditorConfig = useLexicalEditorConfig;
10
- var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
11
- var _react = _interopRequireWildcard(require("react"));
12
- var _reactComposition = require("@webiny/react-composition");
9
+ var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
10
+ var _react = require("react");
13
11
  var _reactProperties = require("@webiny/react-properties");
14
- var _ToolbarElement = require("./components/ToolbarElement");
15
- var _Plugin = require("./components/Plugin");
16
- var _Node = require("./components/Node");
17
- var LexicalEditorConfigApply = (0, _reactComposition.makeDecoratable)("LexicalEditorConfigApply", function (_ref) {
18
- var children = _ref.children;
19
- return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, children);
12
+ var _ToolbarElement = require("./components/ToolbarElement.js");
13
+ var _Plugin = require("./components/Plugin.js");
14
+ var _Node = require("./components/Node.js");
15
+ var base = (0, _reactProperties.createConfigurableComponent)("LexicalEditor");
16
+ var LexicalEditorConfig = exports.LexicalEditorConfig = Object.assign(base.Config, {
17
+ ToolbarElement: _ToolbarElement.ToolbarElement,
18
+ Plugin: _Plugin.Plugin,
19
+ Node: _Node.Node
20
20
  });
21
- var createHOC = function createHOC(newChildren) {
22
- return function (BaseComponent) {
23
- return function ConfigHOC(_ref2) {
24
- var children = _ref2.children;
25
- return /*#__PURE__*/_react.default.createElement(BaseComponent, null, newChildren, children);
26
- };
27
- };
28
- };
29
- var LexicalEditorConfig = exports.LexicalEditorConfig = function LexicalEditorConfig(_ref3) {
30
- var children = _ref3.children;
31
- return /*#__PURE__*/_react.default.createElement(_reactComposition.Compose, {
32
- component: LexicalEditorConfigApply,
33
- with: createHOC(children)
34
- });
35
- };
36
- LexicalEditorConfig.ToolbarElement = _ToolbarElement.ToolbarElement;
37
- LexicalEditorConfig.Plugin = _Plugin.Plugin;
38
- LexicalEditorConfig.Node = _Node.Node;
39
- var ViewContext = /*#__PURE__*/_react.default.createContext({
40
- properties: []
41
- });
42
- var LexicalEditorWithConfig = exports.LexicalEditorWithConfig = function LexicalEditorWithConfig(_ref4) {
43
- var children = _ref4.children;
44
- var _useState = (0, _react.useState)([]),
45
- _useState2 = (0, _slicedToArray2.default)(_useState, 2),
46
- properties = _useState2[0],
47
- setProperties = _useState2[1];
48
- var context = {
49
- properties: properties
50
- };
51
- var stateUpdater = function stateUpdater(properties) {
52
- setProperties(properties);
53
- };
54
- return /*#__PURE__*/_react.default.createElement(ViewContext.Provider, {
55
- value: context
56
- }, /*#__PURE__*/_react.default.createElement(_reactProperties.Properties, {
57
- onChange: stateUpdater
58
- }, /*#__PURE__*/_react.default.createElement(LexicalEditorConfigApply, null), children));
59
- };
21
+ var LexicalEditorWithConfig = exports.LexicalEditorWithConfig = base.WithConfig;
60
22
  function useLexicalEditorConfig() {
61
- var _useContext = (0, _react.useContext)(ViewContext),
62
- properties = _useContext.properties;
63
- var config = (0, _react.useMemo)(function () {
64
- return (0, _reactProperties.toObject)(properties);
65
- }, [properties]);
66
- return {
67
- toolbarElements: config.toolbarElements || [],
68
- plugins: config.plugins || [],
69
- nodes: config.nodes || []
70
- };
23
+ var config = base.useConfig();
24
+ var toolbarElements = config.toolbarElements || [];
25
+ var plugins = config.plugins || [];
26
+ var nodes = config.nodes || [];
27
+ return (0, _react.useMemo)(function () {
28
+ return {
29
+ toolbarElements: (0, _toConsumableArray2.default)(toolbarElements),
30
+ plugins: (0, _toConsumableArray2.default)(plugins),
31
+ nodes: (0, _toConsumableArray2.default)(nodes)
32
+ };
33
+ }, [config]);
71
34
  }
72
35
 
73
36
  //# sourceMappingURL=LexicalEditorConfig.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_react","_interopRequireWildcard","require","_reactComposition","_reactProperties","_ToolbarElement","_Plugin","_Node","LexicalEditorConfigApply","makeDecoratable","_ref","children","default","createElement","Fragment","createHOC","newChildren","BaseComponent","ConfigHOC","_ref2","LexicalEditorConfig","exports","_ref3","Compose","component","with","ToolbarElement","Plugin","Node","ViewContext","React","createContext","properties","LexicalEditorWithConfig","_ref4","_useState","useState","_useState2","_slicedToArray2","setProperties","context","stateUpdater","Provider","value","Properties","onChange","useLexicalEditorConfig","_useContext","useContext","config","useMemo","toObject","toolbarElements","plugins","nodes"],"sources":["LexicalEditorConfig.tsx"],"sourcesContent":["import React, { useContext, useMemo, useState } from \"react\";\nimport { makeDecoratable, Compose, Decorator, GenericComponent } from \"@webiny/react-composition\";\nimport { Property, Properties, toObject } from \"@webiny/react-properties\";\nimport { ToolbarElement, ToolbarElementConfig } from \"./components/ToolbarElement\";\nimport { Plugin, PluginConfig } from \"./components/Plugin\";\nimport { Node, NodeConfig } from \"./components/Node\";\n\nconst LexicalEditorConfigApply = makeDecoratable(\"LexicalEditorConfigApply\", ({ children }) => {\n return <>{children}</>;\n});\n\nconst createHOC =\n (newChildren: React.ReactNode): Decorator<GenericComponent> =>\n BaseComponent => {\n return function ConfigHOC({ children }) {\n return (\n <BaseComponent>\n {newChildren}\n {children}\n </BaseComponent>\n );\n };\n };\n\nexport const LexicalEditorConfig = ({ children }: { children: React.ReactNode }) => {\n return <Compose component={LexicalEditorConfigApply} with={createHOC(children)} />;\n};\n\nLexicalEditorConfig.ToolbarElement = ToolbarElement;\nLexicalEditorConfig.Plugin = Plugin;\nLexicalEditorConfig.Node = Node;\n\ninterface ViewContext {\n properties: Property[];\n}\n\nconst ViewContext = React.createContext<ViewContext>({ properties: [] });\n\nexport const LexicalEditorWithConfig = ({ children }: { children: React.ReactNode }) => {\n const [properties, setProperties] = useState<Property[]>([]);\n const context = { properties };\n\n const stateUpdater = (properties: Property[]) => {\n setProperties(properties);\n };\n\n return (\n <ViewContext.Provider value={context}>\n <Properties onChange={stateUpdater}>\n <LexicalEditorConfigApply />\n {children}\n </Properties>\n </ViewContext.Provider>\n );\n};\n\ninterface LexicalEditorConfigData {\n toolbarElements: ToolbarElementConfig[];\n plugins: PluginConfig[];\n nodes: NodeConfig[];\n}\n\nexport function useLexicalEditorConfig() {\n const { properties } = useContext(ViewContext);\n\n const config = useMemo(() => {\n return toObject<LexicalEditorConfigData>(properties);\n }, [properties]);\n\n return {\n toolbarElements: config.toolbarElements || [],\n plugins: config.plugins || [],\n nodes: config.nodes || []\n };\n}\n"],"mappings":";;;;;;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,iBAAA,GAAAD,OAAA;AACA,IAAAE,gBAAA,GAAAF,OAAA;AACA,IAAAG,eAAA,GAAAH,OAAA;AACA,IAAAI,OAAA,GAAAJ,OAAA;AACA,IAAAK,KAAA,GAAAL,OAAA;AAEA,IAAMM,wBAAwB,GAAG,IAAAC,iCAAe,EAAC,0BAA0B,EAAE,UAAAC,IAAA,EAAkB;EAAA,IAAfC,QAAQ,GAAAD,IAAA,CAARC,QAAQ;EACpF,oBAAOX,MAAA,CAAAY,OAAA,CAAAC,aAAA,CAAAb,MAAA,CAAAY,OAAA,CAAAE,QAAA,QAAGH,QAAW,CAAC;AAC1B,CAAC,CAAC;AAEF,IAAMI,SAAS,GACX,SADEA,SAASA,CACVC,WAA4B;EAAA,OAC7B,UAAAC,aAAa,EAAI;IACb,OAAO,SAASC,SAASA,CAAAC,KAAA,EAAe;MAAA,IAAZR,QAAQ,GAAAQ,KAAA,CAARR,QAAQ;MAChC,oBACIX,MAAA,CAAAY,OAAA,CAAAC,aAAA,CAACI,aAAa,QACTD,WAAW,EACXL,QACU,CAAC;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;EAAa,gBAC/BzC,MAAA,CAAAY,OAAA,CAAAC,aAAA,CAACL,wBAAwB,MAAE,CAAC,EAC3BG,QACO,CACM,CAAC;AAE/B,CAAC;AAQM,SAASmC,sBAAsBA,CAAA,EAAG;EACrC,IAAAC,WAAA,GAAuB,IAAAC,iBAAU,EAACnB,WAAW,CAAC;IAAtCG,UAAU,GAAAe,WAAA,CAAVf,UAAU;EAElB,IAAMiB,MAAM,GAAG,IAAAC,cAAO,EAAC,YAAM;IACzB,OAAO,IAAAC,yBAAQ,EAA0BnB,UAAU,CAAC;EACxD,CAAC,EAAE,CAACA,UAAU,CAAC,CAAC;EAEhB,OAAO;IACHoB,eAAe,EAAEH,MAAM,CAACG,eAAe,IAAI,EAAE;IAC7CC,OAAO,EAAEJ,MAAM,CAACI,OAAO,IAAI,EAAE;IAC7BC,KAAK,EAAEL,MAAM,CAACK,KAAK,IAAI;EAC3B,CAAC;AACL","ignoreList":[]}
1
+ {"version":3,"names":["_react","require","_reactProperties","_ToolbarElement","_Plugin","_Node","base","createConfigurableComponent","LexicalEditorConfig","exports","Object","assign","Config","ToolbarElement","Plugin","Node","LexicalEditorWithConfig","WithConfig","useLexicalEditorConfig","config","useConfig","toolbarElements","plugins","nodes","useMemo","_toConsumableArray2","default"],"sources":["LexicalEditorConfig.tsx"],"sourcesContent":["import { useMemo } from \"react\";\nimport { createConfigurableComponent } from \"@webiny/react-properties\";\nimport type { ToolbarElementConfig } from \"./components/ToolbarElement.js\";\nimport { ToolbarElement } from \"./components/ToolbarElement.js\";\nimport type { PluginConfig } from \"./components/Plugin.js\";\nimport { Plugin } from \"./components/Plugin.js\";\nimport type { NodeConfig } from \"./components/Node.js\";\nimport { Node } from \"./components/Node.js\";\n\nexport type { ToolbarElementConfig } from \"./components/ToolbarElement.js\";\nexport type { PluginConfig } from \"./components/Plugin.js\";\nexport type { NodeConfig } from \"./components/Node.js\";\n\nconst base = createConfigurableComponent<LexicalEditorConfigData>(\"LexicalEditor\");\n\nexport const LexicalEditorConfig = Object.assign(base.Config, {\n ToolbarElement,\n Plugin,\n Node\n});\n\nexport const LexicalEditorWithConfig = base.WithConfig;\n\ninterface LexicalEditorConfigData {\n toolbarElements: ToolbarElementConfig[];\n plugins: PluginConfig[];\n nodes: NodeConfig[];\n}\n\nexport function useLexicalEditorConfig(): LexicalEditorConfigData {\n const config = base.useConfig();\n const toolbarElements = config.toolbarElements || [];\n const plugins = config.plugins || [];\n const nodes = config.nodes || [];\n\n return useMemo(\n () => ({\n toolbarElements: [...toolbarElements],\n plugins: [...plugins],\n nodes: [...nodes]\n }),\n [config]\n );\n}\n"],"mappings":";;;;;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,gBAAA,GAAAD,OAAA;AAEA,IAAAE,eAAA,GAAAF,OAAA;AAEA,IAAAG,OAAA,GAAAH,OAAA;AAEA,IAAAI,KAAA,GAAAJ,OAAA;AAMA,IAAMK,IAAI,GAAG,IAAAC,4CAA2B,EAA0B,eAAe,CAAC;AAE3E,IAAMC,mBAAmB,GAAAC,OAAA,CAAAD,mBAAA,GAAGE,MAAM,CAACC,MAAM,CAACL,IAAI,CAACM,MAAM,EAAE;EAC1DC,cAAc,EAAdA,8BAAc;EACdC,MAAM,EAANA,cAAM;EACNC,IAAI,EAAJA;AACJ,CAAC,CAAC;AAEK,IAAMC,uBAAuB,GAAAP,OAAA,CAAAO,uBAAA,GAAGV,IAAI,CAACW,UAAU;AAQ/C,SAASC,sBAAsBA,CAAA,EAA4B;EAC9D,IAAMC,MAAM,GAAGb,IAAI,CAACc,SAAS,CAAC,CAAC;EAC/B,IAAMC,eAAe,GAAGF,MAAM,CAACE,eAAe,IAAI,EAAE;EACpD,IAAMC,OAAO,GAAGH,MAAM,CAACG,OAAO,IAAI,EAAE;EACpC,IAAMC,KAAK,GAAGJ,MAAM,CAACI,KAAK,IAAI,EAAE;EAEhC,OAAO,IAAAC,cAAO,EACV;IAAA,OAAO;MACHH,eAAe,MAAAI,mBAAA,CAAAC,OAAA,EAAML,eAAe,CAAC;MACrCC,OAAO,MAAAG,mBAAA,CAAAC,OAAA,EAAMJ,OAAO,CAAC;MACrBC,KAAK,MAAAE,mBAAA,CAAAC,OAAA,EAAMH,KAAK;IACpB,CAAC;EAAA,CAAC,EACF,CAACJ,MAAM,CACX,CAAC;AACL","ignoreList":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webiny/lexical-editor",
3
- "version": "5.44.1-beta.0",
3
+ "version": "5.44.1-beta.1",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/webiny/webiny-js.git"
@@ -15,10 +15,10 @@
15
15
  "@lexical/selection": "0.23.1",
16
16
  "@lexical/text": "0.23.1",
17
17
  "@lexical/utils": "0.23.1",
18
- "@webiny/lexical-nodes": "5.44.1-beta.0",
19
- "@webiny/lexical-theme": "5.44.1-beta.0",
20
- "@webiny/react-composition": "5.44.1-beta.0",
21
- "@webiny/react-properties": "5.44.1-beta.0",
18
+ "@webiny/lexical-nodes": "5.44.1-beta.1",
19
+ "@webiny/lexical-theme": "5.44.1-beta.1",
20
+ "@webiny/react-composition": "5.44.1-beta.1",
21
+ "@webiny/react-properties": "5.44.1-beta.1",
22
22
  "emotion": "10.0.27",
23
23
  "lexical": "0.23.1",
24
24
  "lodash": "4.17.21",
@@ -26,7 +26,7 @@
26
26
  "react-dom": "18.2.0"
27
27
  },
28
28
  "devDependencies": {
29
- "@webiny/project-utils": "5.44.1-beta.0"
29
+ "@webiny/project-utils": "5.44.1-beta.1"
30
30
  },
31
31
  "publishConfig": {
32
32
  "access": "public",
@@ -36,5 +36,5 @@
36
36
  "build": "node ../cli/bin.js run build",
37
37
  "watch": "node ../cli/bin.js run watch"
38
38
  },
39
- "gitHead": "c80e6d88501ac84229f6577dee7b30163a906379"
39
+ "gitHead": "ff5f085c417040291d39fdbe5153067f3a23ed86"
40
40
  }