@lexical/react 0.3.4 → 0.3.5

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.
@@ -8,6 +8,8 @@
8
8
  */
9
9
 
10
10
  import type {EditorThemeClasses, LexicalEditor, LexicalNode} from 'lexical';
11
+ import type {InitialEditorStateType as InitialEditorStatePlainTextType} from '@lexical/plain-text';
12
+ import type {InitialEditorStateType as InitialEditorStateRichTextType} from '@lexical/rich-text';
11
13
 
12
14
  type Props = {
13
15
  initialConfig: $ReadOnly<{
@@ -16,6 +18,9 @@ type Props = {
16
18
  namespace: string,
17
19
  nodes?: $ReadOnlyArray<Class<LexicalNode>>,
18
20
  theme?: EditorThemeClasses,
21
+ editorState?:
22
+ | InitialEditorStateRichTextType
23
+ | InitialEditorStatePlainTextType,
19
24
  onError: (error: Error, editor: LexicalEditor) => void,
20
25
  }>,
21
26
  children: React$Node,
@@ -7,4 +7,4 @@
7
7
  'use strict';var e=require("@lexical/react/LexicalComposerContext"),h=require("react"),k=require("@lexical/text"),m=require("react-dom"),n=require("@lexical/dragon"),p=require("@lexical/plain-text"),q=require("@lexical/utils"),r="undefined"!==typeof window&&"undefined"!==typeof window.document&&"undefined"!==typeof window.document.createElement?h.useLayoutEffect:h.useEffect;
8
8
  function t(a){let [c,f]=h.useState(a.getEditorState().read(k.$canShowPlaceholderCurry(a.isComposing())));r(()=>{let b=a.getEditorState().read(k.$canShowPlaceholderCurry(a.isComposing()));f(b);return a.registerUpdateListener(({editorState:g})=>{let d=a.isComposing();b=g.read(k.$canShowPlaceholderCurry(d));f(b)})},[a]);return c}
9
9
  function u(a){let [c,f]=h.useState(()=>a.getDecorators());r(()=>a.registerDecoratorListener(b=>{m.flushSync(()=>{f(b)})}),[a]);h.useEffect(()=>{f(a.getDecorators())},[a]);return h.useMemo(()=>{let b=[],g=Object.keys(c);for(let l=0;l<g.length;l++){var d=g[l];let v=c[d];d=a.getElementByKey(d);null!==d&&b.push(m.createPortal(v,d))}return b},[c,a])}function w(a,c){r(()=>q.mergeRegister(p.registerPlainText(a,c),n.registerDragonSupport(a)),[a])}
10
- exports.PlainTextPlugin=function({contentEditable:a,placeholder:c,initialEditorState:f}){void 0!==f&&(void 0)();let [b]=e.useLexicalComposerContext(),g=t(b),d=u(b);w(b,f);return h.createElement(h.Fragment,null,a,g&&c,d)}
10
+ exports.PlainTextPlugin=function({contentEditable:a,placeholder:c,initialEditorState:f}){let [b]=e.useLexicalComposerContext(),g=t(b),d=u(b);w(b,f);return h.createElement(h.Fragment,null,a,g&&c,d)}
@@ -7,4 +7,4 @@
7
7
  'use strict';var e=require("@lexical/react/LexicalComposerContext"),h=require("react"),k=require("@lexical/text"),m=require("react-dom"),n=require("@lexical/dragon"),p=require("@lexical/rich-text"),q=require("@lexical/utils"),r="undefined"!==typeof window&&"undefined"!==typeof window.document&&"undefined"!==typeof window.document.createElement?h.useLayoutEffect:h.useEffect;
8
8
  function t(a){let [c,f]=h.useState(a.getEditorState().read(k.$canShowPlaceholderCurry(a.isComposing())));r(()=>{let b=a.getEditorState().read(k.$canShowPlaceholderCurry(a.isComposing()));f(b);return a.registerUpdateListener(({editorState:g})=>{let d=a.isComposing();b=g.read(k.$canShowPlaceholderCurry(d));f(b)})},[a]);return c}
9
9
  function u(a){let [c,f]=h.useState(()=>a.getDecorators());r(()=>a.registerDecoratorListener(b=>{m.flushSync(()=>{f(b)})}),[a]);h.useEffect(()=>{f(a.getDecorators())},[a]);return h.useMemo(()=>{let b=[],g=Object.keys(c);for(let l=0;l<g.length;l++){var d=g[l];let v=c[d];d=a.getElementByKey(d);null!==d&&b.push(m.createPortal(v,d))}return b},[c,a])}function w(a,c){r(()=>q.mergeRegister(p.registerRichText(a,c),n.registerDragonSupport(a)),[a])}
10
- exports.RichTextPlugin=function({contentEditable:a,placeholder:c,initialEditorState:f}){void 0!==f&&(void 0)();let [b]=e.useLexicalComposerContext(),g=t(b),d=u(b);w(b,f);return h.createElement(h.Fragment,null,a,g&&c,d)}
10
+ exports.RichTextPlugin=function({contentEditable:a,placeholder:c,initialEditorState:f}){let [b]=e.useLexicalComposerContext(),g=t(b),d=u(b);w(b,f);return h.createElement(h.Fragment,null,a,g&&c,d)}
package/package.json CHANGED
@@ -8,28 +8,28 @@
8
8
  "rich-text"
9
9
  ],
10
10
  "license": "MIT",
11
- "version": "0.3.4",
11
+ "version": "0.3.5",
12
12
  "dependencies": {
13
- "@lexical/clipboard": "0.3.4",
14
- "@lexical/code": "0.3.4",
15
- "@lexical/dragon": "0.3.4",
16
- "@lexical/hashtag": "0.3.4",
17
- "@lexical/history": "0.3.4",
18
- "@lexical/link": "0.3.4",
19
- "@lexical/list": "0.3.4",
20
- "@lexical/mark": "0.3.4",
21
- "@lexical/markdown": "0.3.4",
22
- "@lexical/overflow": "0.3.4",
23
- "@lexical/plain-text": "0.3.4",
24
- "@lexical/rich-text": "0.3.4",
25
- "@lexical/selection": "0.3.4",
26
- "@lexical/table": "0.3.4",
27
- "@lexical/text": "0.3.4",
28
- "@lexical/utils": "0.3.4",
29
- "@lexical/yjs": "0.3.4"
13
+ "@lexical/clipboard": "0.3.5",
14
+ "@lexical/code": "0.3.5",
15
+ "@lexical/dragon": "0.3.5",
16
+ "@lexical/hashtag": "0.3.5",
17
+ "@lexical/history": "0.3.5",
18
+ "@lexical/link": "0.3.5",
19
+ "@lexical/list": "0.3.5",
20
+ "@lexical/mark": "0.3.5",
21
+ "@lexical/markdown": "0.3.5",
22
+ "@lexical/overflow": "0.3.5",
23
+ "@lexical/plain-text": "0.3.5",
24
+ "@lexical/rich-text": "0.3.5",
25
+ "@lexical/selection": "0.3.5",
26
+ "@lexical/table": "0.3.5",
27
+ "@lexical/text": "0.3.5",
28
+ "@lexical/utils": "0.3.5",
29
+ "@lexical/yjs": "0.3.5"
30
30
  },
31
31
  "peerDependencies": {
32
- "lexical": "0.3.4",
32
+ "lexical": "0.3.5",
33
33
  "react": ">=17.x",
34
34
  "react-dom": ">=17.x"
35
35
  },