@lexical/react 0.7.9 → 0.8.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.
@@ -9,7 +9,7 @@ import type { ElementFormatType, NodeKey } from 'lexical';
9
9
  import { ReactNode } from 'react';
10
10
  declare type Props = Readonly<{
11
11
  children: ReactNode;
12
- format: ElementFormatType | null | undefined;
12
+ format?: ElementFormatType | null;
13
13
  nodeKey: NodeKey;
14
14
  className: Readonly<{
15
15
  base: string;
@@ -13,6 +13,7 @@ var utils = require('@lexical/utils');
13
13
  var yjs = require('@lexical/yjs');
14
14
  var lexical = require('lexical');
15
15
  var reactDom = require('react-dom');
16
+ var yjs$1 = require('yjs');
16
17
 
17
18
  /**
18
19
  * Copyright (c) Meta Platforms, Inc. and affiliates.
@@ -57,8 +58,10 @@ function useYjsCollaboration(editor, id, provider, docMap, name, color, shouldBo
57
58
  yjs.syncCursorPositions(binding, provider);
58
59
  };
59
60
  const onYjsTreeChanges = (events, transaction) => {
60
- if (transaction.origin !== binding) {
61
- yjs.syncYjsChangesToLexical(binding, provider, events);
61
+ const origin = transaction.origin;
62
+ if (origin !== binding) {
63
+ const isFromUndoManger = origin instanceof yjs$1.UndoManager;
64
+ yjs.syncYjsChangesToLexical(binding, provider, events, isFromUndoManger);
62
65
  }
63
66
  };
64
67
  yjs.initLocalState(provider, name, color, document.activeElement === editor.getRootElement());
@@ -4,12 +4,12 @@
4
4
  * This source code is licensed under the MIT license found in the
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
- 'use strict';var e=require("@lexical/react/LexicalCollaborationContext"),f=require("@lexical/react/LexicalComposerContext"),h=require("react"),z=require("@lexical/utils"),H=require("@lexical/yjs"),I=require("lexical"),J=require("react-dom");
8
- function K(b,c,a,d,p,w,x,l,t){let q=h.useRef(!1),[u,r]=h.useState(d.get(c)),g=h.useMemo(()=>H.createBinding(b,a,c,u,d),[b,a,c,d,u]),n=h.useCallback(()=>{a.connect()},[a]),v=h.useCallback(()=>{try{a.disconnect()}catch(m){}},[a]);h.useEffect(()=>{let {root:m}=g,{awareness:A}=a,B=({status:k})=>{b.dispatchCommand(H.CONNECTED_COMMAND,"connected"===k)},C=k=>{x&&k&&m.isEmpty()&&0===m._xmlText._length&&!1===q.current&&L(b,t);q.current=!1},D=()=>{H.syncCursorPositions(g,a)},E=(k,y)=>{y.origin!==g&&H.syncYjsChangesToLexical(g,
9
- a,k)};H.initLocalState(a,p,w,document.activeElement===b.getRootElement());let F=k=>{M(b,g);r(k);d.set(c,k);q.current=!0};a.on("reload",F);a.on("status",B);a.on("sync",C);A.on("update",D);m.getSharedType().observeDeep(E);let Q=b.registerUpdateListener(({prevEditorState:k,editorState:y,dirtyLeaves:N,dirtyElements:O,normalizedNodes:P,tags:G})=>{!1===G.has("skip-collab")&&H.syncLexicalUpdateToYjs(g,a,k,y,O,N,P,G)});n();return()=>{!1===q.current&&v();a.off("sync",C);a.off("status",B);a.off("reload",F);
10
- A.off("update",D);m.getSharedType().unobserveDeep(E);d.delete(c);Q()}},[g,w,n,v,d,b,c,t,p,a,x]);let R=h.useMemo(()=>J.createPortal(h.createElement("div",{ref:m=>{g.cursorsContainer=m}}),l&&l.current||document.body),[g,l]);h.useEffect(()=>b.registerCommand(H.TOGGLE_CONNECT_COMMAND,m=>{void 0!==n&&void 0!==v&&(m?(console.log("Collaboration connected!"),n()):(console.log("Collaboration disconnected!"),v()));return!0},I.COMMAND_PRIORITY_EDITOR),[n,v,b]);return[R,g]}
11
- function S(b,c,a,d){h.useEffect(()=>z.mergeRegister(b.registerCommand(I.FOCUS_COMMAND,()=>{H.setLocalStateFocus(c,a,d,!0);return!1},I.COMMAND_PRIORITY_EDITOR),b.registerCommand(I.BLUR_COMMAND,()=>{H.setLocalStateFocus(c,a,d,!1);return!1},I.COMMAND_PRIORITY_EDITOR)),[d,b,a,c])}
12
- function T(b,c){let a=h.useMemo(()=>H.createUndoManager(c,c.root.getSharedType()),[c]);h.useEffect(()=>z.mergeRegister(b.registerCommand(I.UNDO_COMMAND,()=>{a.undo();return!0},I.COMMAND_PRIORITY_EDITOR),b.registerCommand(I.REDO_COMMAND,()=>{a.redo();return!0},I.COMMAND_PRIORITY_EDITOR)));return h.useCallback(()=>{a.clear()},[a])}
13
- function L(b,c){b.update(()=>{var a=I.$getRoot();if(a.isEmpty())if(c)switch(typeof c){case "string":var d=b.parseEditorState(c);b.setEditorState(d,{tag:"history-merge"});break;case "object":b.setEditorState(c,{tag:"history-merge"});break;case "function":b.update(()=>{I.$getRoot().isEmpty()&&c(b)},{tag:"history-merge"})}else d=I.$createParagraphNode(),a.append(d),{activeElement:a}=document,(null!==I.$getSelection()||null!==a&&a===b.getRootElement())&&d.select()},{tag:"history-merge"})}
14
- function M(b,c){b.update(()=>{let d=I.$getRoot();d.clear();d.select()},{tag:"skip-collab"});if(null!=c.cursors&&(b=c.cursors,null!=b&&(c=c.cursorsContainer,null!=c))){b=Array.from(b.values());for(let d=0;d<b.length;d++){var a=b[d].selection;if(a&&null!=a.selections){a=a.selections;for(let p=0;p<a.length;p++)c.removeChild(a[d])}}}}
15
- exports.CollaborationPlugin=function({id:b,providerFactory:c,shouldBootstrap:a,username:d,cursorColor:p,cursorsContainerRef:w,initialEditorState:x}){let l=e.useCollaborationContext(d,p),{yjsDocMap:t,name:q,color:u}=l,[r]=f.useLexicalComposerContext();h.useEffect(()=>{l.isCollabActive=!0;return()=>{null==r._parentEditor&&(l.isCollabActive=!1)}},[l,r]);d=h.useMemo(()=>c(b,t),[b,c,t]);let [g,n]=K(r,b,d,t,q,u,a,w,x);l.clientID=n.clientID;T(r,n);S(r,d,q,u);return g}
7
+ 'use strict';var e=require("@lexical/react/LexicalCollaborationContext"),f=require("@lexical/react/LexicalComposerContext"),h=require("react"),z=require("@lexical/utils"),H=require("@lexical/yjs"),I=require("lexical"),J=require("react-dom"),K=require("yjs");
8
+ function L(b,c,a,d,p,x,y,l,t){let q=h.useRef(!1),[v,r]=h.useState(d.get(c)),g=h.useMemo(()=>H.createBinding(b,a,c,v,d),[b,a,c,d,v]),n=h.useCallback(()=>{a.connect()},[a]),w=h.useCallback(()=>{try{a.disconnect()}catch(m){}},[a]);h.useEffect(()=>{let {root:m}=g,{awareness:A}=a,B=({status:k})=>{b.dispatchCommand(H.CONNECTED_COMMAND,"connected"===k)},C=k=>{y&&k&&m.isEmpty()&&0===m._xmlText._length&&!1===q.current&&M(b,t);q.current=!1},D=()=>{H.syncCursorPositions(g,a)},E=(k,u)=>{u=u.origin;u!==g&&H.syncYjsChangesToLexical(g,
9
+ a,k,u instanceof K.UndoManager)};H.initLocalState(a,p,x,document.activeElement===b.getRootElement());let F=k=>{N(b,g);r(k);d.set(c,k);q.current=!0};a.on("reload",F);a.on("status",B);a.on("sync",C);A.on("update",D);m.getSharedType().observeDeep(E);let R=b.registerUpdateListener(({prevEditorState:k,editorState:u,dirtyLeaves:O,dirtyElements:P,normalizedNodes:Q,tags:G})=>{!1===G.has("skip-collab")&&H.syncLexicalUpdateToYjs(g,a,k,u,P,O,Q,G)});n();return()=>{!1===q.current&&w();a.off("sync",C);a.off("status",
10
+ B);a.off("reload",F);A.off("update",D);m.getSharedType().unobserveDeep(E);d.delete(c);R()}},[g,x,n,w,d,b,c,t,p,a,y]);let S=h.useMemo(()=>J.createPortal(h.createElement("div",{ref:m=>{g.cursorsContainer=m}}),l&&l.current||document.body),[g,l]);h.useEffect(()=>b.registerCommand(H.TOGGLE_CONNECT_COMMAND,m=>{void 0!==n&&void 0!==w&&(m?(console.log("Collaboration connected!"),n()):(console.log("Collaboration disconnected!"),w()));return!0},I.COMMAND_PRIORITY_EDITOR),[n,w,b]);return[S,g]}
11
+ function T(b,c,a,d){h.useEffect(()=>z.mergeRegister(b.registerCommand(I.FOCUS_COMMAND,()=>{H.setLocalStateFocus(c,a,d,!0);return!1},I.COMMAND_PRIORITY_EDITOR),b.registerCommand(I.BLUR_COMMAND,()=>{H.setLocalStateFocus(c,a,d,!1);return!1},I.COMMAND_PRIORITY_EDITOR)),[d,b,a,c])}
12
+ function U(b,c){let a=h.useMemo(()=>H.createUndoManager(c,c.root.getSharedType()),[c]);h.useEffect(()=>z.mergeRegister(b.registerCommand(I.UNDO_COMMAND,()=>{a.undo();return!0},I.COMMAND_PRIORITY_EDITOR),b.registerCommand(I.REDO_COMMAND,()=>{a.redo();return!0},I.COMMAND_PRIORITY_EDITOR)));return h.useCallback(()=>{a.clear()},[a])}
13
+ function M(b,c){b.update(()=>{var a=I.$getRoot();if(a.isEmpty())if(c)switch(typeof c){case "string":var d=b.parseEditorState(c);b.setEditorState(d,{tag:"history-merge"});break;case "object":b.setEditorState(c,{tag:"history-merge"});break;case "function":b.update(()=>{I.$getRoot().isEmpty()&&c(b)},{tag:"history-merge"})}else d=I.$createParagraphNode(),a.append(d),{activeElement:a}=document,(null!==I.$getSelection()||null!==a&&a===b.getRootElement())&&d.select()},{tag:"history-merge"})}
14
+ function N(b,c){b.update(()=>{let d=I.$getRoot();d.clear();d.select()},{tag:"skip-collab"});if(null!=c.cursors&&(b=c.cursors,null!=b&&(c=c.cursorsContainer,null!=c))){b=Array.from(b.values());for(let d=0;d<b.length;d++){var a=b[d].selection;if(a&&null!=a.selections){a=a.selections;for(let p=0;p<a.length;p++)c.removeChild(a[d])}}}}
15
+ exports.CollaborationPlugin=function({id:b,providerFactory:c,shouldBootstrap:a,username:d,cursorColor:p,cursorsContainerRef:x,initialEditorState:y}){let l=e.useCollaborationContext(d,p),{yjsDocMap:t,name:q,color:v}=l,[r]=f.useLexicalComposerContext();h.useEffect(()=>{l.isCollabActive=!0;return()=>{null==r._parentEditor&&(l.isCollabActive=!1)}},[l,r]);d=h.useMemo(()=>c(b,t),[b,c,t]);let [g,n]=L(r,b,d,t,q,v,a,x,y);l.clientID=n.clientID;U(r,n);T(r,d,q,v);return g}
@@ -5,28 +5,19 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  *
7
7
  */
8
- import { CSSProperties } from 'react';
9
- export declare type Props = Readonly<{
10
- ariaActiveDescendantID?: string;
11
- ariaAutoComplete?: string;
12
- ariaControls?: string;
13
- ariaDescribedBy?: string;
14
- ariaExpanded?: boolean;
15
- ariaLabel?: string;
16
- ariaLabelledBy?: string;
17
- ariaMultiline?: boolean;
18
- ariaOwneeID?: string;
19
- ariaRequired?: string;
20
- autoCapitalize?: boolean;
21
- autoComplete?: boolean;
22
- autoCorrect?: boolean;
23
- className?: string;
24
- id?: string;
25
- readOnly?: boolean;
26
- role?: string;
27
- spellCheck?: boolean;
28
- style?: CSSProperties;
29
- tabIndex?: number;
30
- testid?: string;
31
- }>;
32
- export declare function ContentEditable({ ariaActiveDescendantID, ariaAutoComplete, ariaControls, ariaDescribedBy, ariaExpanded, ariaLabel, ariaLabelledBy, ariaMultiline, ariaOwneeID, ariaRequired, autoCapitalize, autoComplete, autoCorrect, className, id, role, spellCheck, style, tabIndex, testid, }: Props): JSX.Element;
8
+ import * as React from 'react';
9
+ export declare type Props = {
10
+ ariaActiveDescendant?: React.AriaAttributes['aria-activedescendant'];
11
+ ariaAutoComplete?: React.AriaAttributes['aria-autocomplete'];
12
+ ariaControls?: React.AriaAttributes['aria-controls'];
13
+ ariaDescribedBy?: React.AriaAttributes['aria-describedby'];
14
+ ariaExpanded?: React.AriaAttributes['aria-expanded'];
15
+ ariaLabel?: React.AriaAttributes['aria-label'];
16
+ ariaLabelledBy?: React.AriaAttributes['aria-labelledby'];
17
+ ariaMultiline?: React.AriaAttributes['aria-multiline'];
18
+ ariaOwns?: React.AriaAttributes['aria-owns'];
19
+ ariaRequired?: React.AriaAttributes['aria-required'];
20
+ autoCapitalize?: HTMLDivElement['autocapitalize'];
21
+ 'data-testid'?: string | null | undefined;
22
+ } & React.AllHTMLAttributes<HTMLDivElement>;
23
+ export declare function ContentEditable({ ariaActiveDescendant, ariaAutoComplete, ariaControls, ariaDescribedBy, ariaExpanded, ariaLabel, ariaLabelledBy, ariaMultiline, ariaOwns, ariaRequired, autoCapitalize, className, id, role, spellCheck, style, tabIndex, 'data-testid': testid, }: Props): JSX.Element;
@@ -37,7 +37,7 @@ var useLayoutEffect = useLayoutEffectImpl;
37
37
  *
38
38
  */
39
39
  function ContentEditable({
40
- ariaActiveDescendantID,
40
+ ariaActiveDescendant,
41
41
  ariaAutoComplete,
42
42
  ariaControls,
43
43
  ariaDescribedBy,
@@ -45,18 +45,16 @@ function ContentEditable({
45
45
  ariaLabel,
46
46
  ariaLabelledBy,
47
47
  ariaMultiline,
48
- ariaOwneeID,
48
+ ariaOwns,
49
49
  ariaRequired,
50
50
  autoCapitalize,
51
- autoComplete,
52
- autoCorrect,
53
51
  className,
54
52
  id,
55
53
  role = 'textbox',
56
54
  spellCheck = true,
57
55
  style,
58
56
  tabIndex,
59
- testid
57
+ 'data-testid': testid
60
58
  }) {
61
59
  const [editor] = LexicalComposerContext.useLexicalComposerContext();
62
60
  const [isEditable, setEditable] = React.useState(false);
@@ -70,21 +68,17 @@ function ContentEditable({
70
68
  });
71
69
  }, [editor]);
72
70
  return /*#__PURE__*/React.createElement("div", {
73
- "aria-activedescendant": !isEditable ? null : ariaActiveDescendantID,
74
- "aria-autocomplete": !isEditable ? null : ariaAutoComplete,
75
- "aria-controls": !isEditable ? null : ariaControls,
71
+ "aria-activedescendant": !isEditable ? undefined : ariaActiveDescendant,
72
+ "aria-autocomplete": !isEditable ? 'none' : ariaAutoComplete,
73
+ "aria-controls": !isEditable ? undefined : ariaControls,
76
74
  "aria-describedby": ariaDescribedBy,
77
- "aria-expanded": !isEditable ? null : role === 'combobox' ? !!ariaExpanded : null,
75
+ "aria-expanded": !isEditable ? undefined : role === 'combobox' ? !!ariaExpanded : undefined,
78
76
  "aria-label": ariaLabel,
79
77
  "aria-labelledby": ariaLabelledBy,
80
78
  "aria-multiline": ariaMultiline,
81
- "aria-owns": !isEditable ? null : ariaOwneeID,
79
+ "aria-owns": !isEditable ? undefined : ariaOwns,
82
80
  "aria-required": ariaRequired,
83
- autoCapitalize: autoCapitalize !== undefined ? String(autoCapitalize) : undefined
84
- // @ts-ignore This is a valid attribute
85
- ,
86
- autoComplete: autoComplete,
87
- autoCorrect: autoCorrect !== undefined ? String(autoCorrect) : undefined,
81
+ autoCapitalize: autoCapitalize,
88
82
  className: className,
89
83
  contentEditable: isEditable,
90
84
  "data-testid": testid,
@@ -7,27 +7,22 @@
7
7
  * @flow strict
8
8
  */
9
9
 
10
+ import * as React from 'react';
11
+
10
12
  export type Props = $ReadOnly<{
11
- ariaActiveDescendantID?: string,
12
- ariaAutoComplete?: string,
13
- ariaControls?: string,
14
- ariaDescribedBy?: string,
15
- ariaExpanded?: boolean,
16
- ariaLabel?: string,
17
- ariaLabelledBy?: string,
18
- ariaMultiline?: boolean,
19
- ariaOwneeID?: string,
20
- ariaRequired?: string,
21
- autoCapitalize?: boolean,
22
- autoComplete?: boolean,
23
- autoCorrect?: boolean,
24
- className?: string,
25
- readOnly?: boolean,
26
- role?: string,
27
- style?: $Shape<{[string]: string | number}>,
28
- spellCheck?: boolean,
29
- tabIndex?: number,
30
- testid?: string,
13
+ ...$Partial<HTMLDivElement>,
14
+ ariaActiveDescendant?: HTMLDivElement['aria-activedescendant'],
15
+ ariaAutoComplete?: HTMLDivElement['aria-autocomplete'],
16
+ ariaControls?: HTMLDivElement['aria-controls'],
17
+ ariaDescribedBy?: HTMLDivElement['aria-describedby'],
18
+ ariaExpanded?: HTMLDivElement['aria-expanded'],
19
+ ariaLabel?: HTMLDivElement['aria-label'],
20
+ ariaLabelledBy?: HTMLDivElement['aria-labelledby'],
21
+ ariaMultiline?: HTMLDivElement['aria-multiline'],
22
+ ariaOwns?: HTMLDivElement['aria-owns'],
23
+ ariaRequired?: HTMLDivElement['aria-required'],
24
+ autoCapitalize?: HTMLDivElement['autocapitalize'],
25
+ 'data-testid'?: string | null,
31
26
  }>;
32
27
 
33
28
  declare export function ContentEditable(props: Props): React$Node;
@@ -4,6 +4,6 @@
4
4
  * This source code is licensed under the MIT license found in the
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
- 'use strict';var b=require("@lexical/react/LexicalComposerContext"),k=require("react"),l="undefined"!==typeof window&&"undefined"!==typeof window.document&&"undefined"!==typeof window.document.createElement?k.useLayoutEffect:k.useEffect;
8
- exports.ContentEditable=function({ariaActiveDescendantID:m,ariaAutoComplete:n,ariaControls:p,ariaDescribedBy:q,ariaExpanded:r,ariaLabel:t,ariaLabelledBy:u,ariaMultiline:v,ariaOwneeID:w,ariaRequired:x,autoCapitalize:e,autoComplete:y,autoCorrect:f,className:z,id:A,role:g="textbox",spellCheck:B=!0,style:C,tabIndex:D,testid:E}){let [c]=b.useLexicalComposerContext(),[a,h]=k.useState(!1),F=k.useCallback(d=>{c.setRootElement(d)},[c]);l(()=>{h(c.isEditable());return c.registerEditableListener(d=>{h(d)})},
9
- [c]);return k.createElement("div",{"aria-activedescendant":a?m:null,"aria-autocomplete":a?n:null,"aria-controls":a?p:null,"aria-describedby":q,"aria-expanded":a?"combobox"===g?!!r:null:null,"aria-label":t,"aria-labelledby":u,"aria-multiline":v,"aria-owns":a?w:null,"aria-required":x,autoCapitalize:void 0!==e?String(e):void 0,autoComplete:y,autoCorrect:void 0!==f?String(f):void 0,className:z,contentEditable:a,"data-testid":E,id:A,ref:F,role:a?g:void 0,spellCheck:B,style:C,tabIndex:D})}
7
+ 'use strict';var b=require("@lexical/react/LexicalComposerContext"),g=require("react"),h="undefined"!==typeof window&&"undefined"!==typeof window.document&&"undefined"!==typeof window.document.createElement?g.useLayoutEffect:g.useEffect;
8
+ exports.ContentEditable=function({ariaActiveDescendant:k,ariaAutoComplete:l,ariaControls:m,ariaDescribedBy:n,ariaExpanded:p,ariaLabel:q,ariaLabelledBy:r,ariaMultiline:t,ariaOwns:u,ariaRequired:v,autoCapitalize:w,className:x,id:y,role:e="textbox",spellCheck:z=!0,style:A,tabIndex:B,"data-testid":C}){let [c]=b.useLexicalComposerContext(),[a,f]=g.useState(!1),D=g.useCallback(d=>{c.setRootElement(d)},[c]);h(()=>{f(c.isEditable());return c.registerEditableListener(d=>{f(d)})},[c]);return g.createElement("div",
9
+ {"aria-activedescendant":a?k:void 0,"aria-autocomplete":a?l:"none","aria-controls":a?m:void 0,"aria-describedby":n,"aria-expanded":a?"combobox"===e?!!p:void 0:void 0,"aria-label":q,"aria-labelledby":r,"aria-multiline":t,"aria-owns":a?u:void 0,"aria-required":v,autoCapitalize:w,className:x,contentEditable:a,"data-testid":C,id:y,ref:D,role:a?e:void 0,spellCheck:z,style:A,tabIndex:B})}
@@ -21,13 +21,7 @@ var lexical = require('lexical');
21
21
  */
22
22
  function useList(editor) {
23
23
  react.useEffect(() => {
24
- return utils.mergeRegister(editor.registerCommand(lexical.INDENT_CONTENT_COMMAND, () => {
25
- list.indentList();
26
- return false;
27
- }, lexical.COMMAND_PRIORITY_LOW), editor.registerCommand(lexical.OUTDENT_CONTENT_COMMAND, () => {
28
- list.outdentList();
29
- return false;
30
- }, lexical.COMMAND_PRIORITY_LOW), editor.registerCommand(list.INSERT_ORDERED_LIST_COMMAND, () => {
24
+ return utils.mergeRegister(editor.registerCommand(list.INSERT_ORDERED_LIST_COMMAND, () => {
31
25
  list.insertList(editor, 'number');
32
26
  return true;
33
27
  }, lexical.COMMAND_PRIORITY_LOW), editor.registerCommand(list.INSERT_UNORDERED_LIST_COMMAND, () => {
@@ -5,5 +5,5 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
7
  'use strict';var b=require("@lexical/list"),c=require("@lexical/react/LexicalComposerContext"),d=require("react"),e=require("@lexical/utils"),f=require("lexical");
8
- function g(a){d.useEffect(()=>e.mergeRegister(a.registerCommand(f.INDENT_CONTENT_COMMAND,()=>{b.indentList();return!1},f.COMMAND_PRIORITY_LOW),a.registerCommand(f.OUTDENT_CONTENT_COMMAND,()=>{b.outdentList();return!1},f.COMMAND_PRIORITY_LOW),a.registerCommand(b.INSERT_ORDERED_LIST_COMMAND,()=>{b.insertList(a,"number");return!0},f.COMMAND_PRIORITY_LOW),a.registerCommand(b.INSERT_UNORDERED_LIST_COMMAND,()=>{b.insertList(a,"bullet");return!0},f.COMMAND_PRIORITY_LOW),a.registerCommand(b.REMOVE_LIST_COMMAND,
9
- ()=>{b.removeList(a);return!0},f.COMMAND_PRIORITY_LOW),a.registerCommand(f.INSERT_PARAGRAPH_COMMAND,()=>b.$handleListInsertParagraph()?!0:!1,f.COMMAND_PRIORITY_LOW)),[a])}exports.ListPlugin=function(){let [a]=c.useLexicalComposerContext();d.useEffect(()=>{if(!a.hasNodes([b.ListNode,b.ListItemNode]))throw Error("ListPlugin: ListNode and/or ListItemNode not registered on editor");},[a]);g(a);return null}
8
+ function g(a){d.useEffect(()=>e.mergeRegister(a.registerCommand(b.INSERT_ORDERED_LIST_COMMAND,()=>{b.insertList(a,"number");return!0},f.COMMAND_PRIORITY_LOW),a.registerCommand(b.INSERT_UNORDERED_LIST_COMMAND,()=>{b.insertList(a,"bullet");return!0},f.COMMAND_PRIORITY_LOW),a.registerCommand(b.REMOVE_LIST_COMMAND,()=>{b.removeList(a);return!0},f.COMMAND_PRIORITY_LOW),a.registerCommand(f.INSERT_PARAGRAPH_COMMAND,()=>b.$handleListInsertParagraph()?!0:!1,f.COMMAND_PRIORITY_LOW)),[a])}
9
+ exports.ListPlugin=function(){let [a]=c.useLexicalComposerContext();d.useEffect(()=>{if(!a.hasNodes([b.ListNode,b.ListItemNode]))throw Error("ListPlugin: ListNode and/or ListItemNode not registered on editor");},[a]);g(a);return null}
@@ -47,6 +47,7 @@ function LexicalNestedComposer({
47
47
  initialEditor._nodes.set(type, {
48
48
  klass: entry.klass,
49
49
  replace: entry.replace,
50
+ replaceWithKlass: entry.replaceWithKlass,
50
51
  transforms: new Set()
51
52
  });
52
53
  }
@@ -56,6 +57,7 @@ function LexicalNestedComposer({
56
57
  initialEditor._nodes.set(type, {
57
58
  klass,
58
59
  replace: null,
60
+ replaceWithKlass: null,
59
61
  transforms: new Set()
60
62
  });
61
63
  }
@@ -5,6 +5,6 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
7
  'use strict';var c=require("@lexical/react/LexicalCollaborationContext"),f=require("@lexical/react/LexicalComposerContext"),n=require("react");
8
- exports.LexicalNestedComposer=function({initialEditor:a,children:p,initialNodes:k,initialTheme:q,skipCollabChecks:r}){let l=n.useRef(!1),g=n.useContext(f.LexicalComposerContext);if(null==g)throw Error("Minified Lexical error #9; visit https://lexical.dev/docs/error?code=9 for the full message or use the non-minified dev environment for full errors and additional helpful warnings.");let [d,{getTheme:t}]=g,w=n.useMemo(()=>{var b=q||t()||void 0;const u=f.createLexicalComposerContext(g,b);void 0!==b&&
9
- (a._config.theme=b);a._parentEditor=d;if(k)for(var e of k)b=e.getType(),a._nodes.set(b,{klass:e,replace:null,transforms:new Set});else{e=a._nodes=new Map(d._nodes);for(const [v,m]of e)a._nodes.set(v,{klass:m.klass,replace:m.replace,transforms:new Set})}a._config.namespace=d._config.namespace;return[a,u]},[]),{isCollabActive:x,yjsDocMap:y}=c.useCollaborationContext(),h=r||l.current||y.has(a.getKey());n.useEffect(()=>{h&&(l.current=!0)},[h]);n.useEffect(()=>d.registerEditableListener(b=>{a.setEditable(b)}),
10
- [a,d]);return n.createElement(f.LexicalComposerContext.Provider,{value:w},!x||h?p:null)}
8
+ exports.LexicalNestedComposer=function({initialEditor:a,children:p,initialNodes:l,initialTheme:q,skipCollabChecks:r}){let m=n.useRef(!1),g=n.useContext(f.LexicalComposerContext);if(null==g)throw Error("Minified Lexical error #9; visit https://lexical.dev/docs/error?code=9 for the full message or use the non-minified dev environment for full errors and additional helpful warnings.");let [d,{getTheme:t}]=g,w=n.useMemo(()=>{var b=q||t()||void 0;const u=f.createLexicalComposerContext(g,b);void 0!==b&&
9
+ (a._config.theme=b);a._parentEditor=d;if(l)for(var e of l)b=e.getType(),a._nodes.set(b,{klass:e,replace:null,replaceWithKlass:null,transforms:new Set});else{e=a._nodes=new Map(d._nodes);for(const [v,h]of e)a._nodes.set(v,{klass:h.klass,replace:h.replace,replaceWithKlass:h.replaceWithKlass,transforms:new Set})}a._config.namespace=d._config.namespace;return[a,u]},[]),{isCollabActive:x,yjsDocMap:y}=c.useCollaborationContext(),k=r||m.current||y.has(a.getKey());n.useEffect(()=>{k&&(m.current=!0)},[k]);
10
+ n.useEffect(()=>d.registerEditableListener(b=>{a.setEditable(b)}),[a,d]);return n.createElement(f.LexicalComposerContext.Provider,{value:w},!x||k?p:null)}
@@ -208,7 +208,7 @@ function TreeView({
208
208
  function printRangeSelection(selection) {
209
209
  let res = '';
210
210
  const formatText = printFormatProperties(selection);
211
- res += `: range ${formatText !== '' ? `{ ${formatText} }` : ''}`;
211
+ res += `: range ${formatText !== '' ? `{ ${formatText} }` : ''} ${selection.style !== '' ? `{ style: ${selection.style} } ` : ''}`;
212
212
  const anchor = selection.anchor;
213
213
  const focus = selection.focus;
214
214
  const anchorOffset = anchor.offset;
@@ -5,18 +5,18 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
7
  'use strict';var h=require("@lexical/link"),r=require("@lexical/mark"),v=require("@lexical/utils"),F=require("lexical"),I=require("react");let J=Object.freeze({"\t":"\\t","\n":"\\n"}),K=new RegExp(Object.keys(J).join("|"),"g"),L=Object.freeze({ancestorHasNextSibling:"|",ancestorIsLastChild:" ",hasNextSibling:"\u251c",isLastChild:"\u2514",selectedChar:"^",selectedLine:">"});
8
- function M(a){let c="",e=P(a),l=a.anchor;a=a.focus;let f=l.offset,b=a.offset;c=c+`: range ${""!==e?`{ ${e} }`:""}`+`\n \u251c anchor { key: ${l.key}, offset: ${null===f?"null":f}, type: ${l.type} }`;return c+=`\n \u2514 focus { key: ${a.key}, offset: ${null===b?"null":b}, type: ${a.type} }`}
9
- function Q(a,c,e,l){let f=" root\n";a=a.read(()=>{const b=F.$getSelection();R(F.$getRoot(),(d,n)=>{const y=`(${d.getKey()})`,t=d.getType()||"",q=d.isSelected(),z=r.$isMarkNode(d)?` id: [ ${d.getIDs().join(", ")} ] `:"";var m=f,w=q?L.selectedLine:" ",D=n.join(" ");if(F.$isTextNode(d)){var k=d.getTextContent();var p=0===k.length?"(empty)":`"${S(k)}"`;k=[P(d),T(d),U(d)].filter(Boolean).join(", ");k=[p,0!==k.length?`{ ${k} }`:null].filter(Boolean).join(" ").trim()}else if(h.$isLinkNode(d)){k=d.getURL();
10
- k=0===k.length?"(empty)":`"${S(k)}"`;p=d.getTarget();null!=p&&(p="target: "+p);var A=Boolean;let B=d.getRel();null!=B&&(B="rel: "+B);p=[p,B].filter(A).join(", ");k=[k,0!==p.length?`{ ${p} }`:null].filter(Boolean).join(" ").trim()}else k="";f=m+`${w} ${D} ${y} ${t} ${z} ${k}\n`;f+=V({indent:n,isSelected:q,node:d,nodeKeyDisplay:y,selection:b,typeDisplay:t})});return null===b?": null":F.$isRangeSelection(b)?M(b):F.DEPRECATED_$isGridSelection(b)?`: grid\n \u2514 { grid: ${b.gridKey}, anchorCell: ${b.anchor.key}, focusCell: ${b.focus.key} }`:
11
- `: node\n \u2514 [${Array.from(b._nodes).join(", ")}]`});f+="\n selection"+a;f+="\n\n editor:";f+=`\n \u2514 namespace ${c.namespace}`;null!==e&&(f+=`\n \u2514 compositionKey ${e}`);return f+=`\n \u2514 editable ${String(l)}`}function R(a,c,e=[]){a=a.getChildren();let l=a.length;a.forEach((f,b)=>{c(f,e.concat(b===l-1?L.isLastChild:L.hasNextSibling));F.$isElementNode(f)&&R(f,c,e.concat(b===l-1?L.ancestorIsLastChild:L.ancestorHasNextSibling))})}
12
- function S(a){return Object.entries(J).reduce((c,[e,l])=>c.replace(new RegExp(e,"g"),String(l)),a)}
8
+ function M(a){let c="";var d=P(a);c+=`: range ${""!==d?`{ ${d} }`:""} ${""!==a.style?`{ style: ${a.style} } `:""}`;d=a.anchor;a=a.focus;let l=d.offset,f=a.offset;c+=`\n \u251c anchor { key: ${d.key}, offset: ${null===l?"null":l}, type: ${d.type} }`;return c+=`\n \u2514 focus { key: ${a.key}, offset: ${null===f?"null":f}, type: ${a.type} }`}
9
+ function Q(a,c,d,l){let f=" root\n";a=a.read(()=>{const b=F.$getSelection();R(F.$getRoot(),(e,n)=>{const y=`(${e.getKey()})`,t=e.getType()||"",q=e.isSelected(),z=r.$isMarkNode(e)?` id: [ ${e.getIDs().join(", ")} ] `:"";var m=f,w=q?L.selectedLine:" ",D=n.join(" ");if(F.$isTextNode(e)){var k=e.getTextContent();var p=0===k.length?"(empty)":`"${S(k)}"`;k=[P(e),T(e),U(e)].filter(Boolean).join(", ");k=[p,0!==k.length?`{ ${k} }`:null].filter(Boolean).join(" ").trim()}else if(h.$isLinkNode(e)){k=e.getURL();
10
+ k=0===k.length?"(empty)":`"${S(k)}"`;p=e.getTarget();null!=p&&(p="target: "+p);var A=Boolean;let B=e.getRel();null!=B&&(B="rel: "+B);p=[p,B].filter(A).join(", ");k=[k,0!==p.length?`{ ${p} }`:null].filter(Boolean).join(" ").trim()}else k="";f=m+`${w} ${D} ${y} ${t} ${z} ${k}\n`;f+=V({indent:n,isSelected:q,node:e,nodeKeyDisplay:y,selection:b,typeDisplay:t})});return null===b?": null":F.$isRangeSelection(b)?M(b):F.DEPRECATED_$isGridSelection(b)?`: grid\n \u2514 { grid: ${b.gridKey}, anchorCell: ${b.anchor.key}, focusCell: ${b.focus.key} }`:
11
+ `: node\n \u2514 [${Array.from(b._nodes).join(", ")}]`});f+="\n selection"+a;f+="\n\n editor:";f+=`\n \u2514 namespace ${c.namespace}`;null!==d&&(f+=`\n \u2514 compositionKey ${d}`);return f+=`\n \u2514 editable ${String(l)}`}function R(a,c,d=[]){a=a.getChildren();let l=a.length;a.forEach((f,b)=>{c(f,d.concat(b===l-1?L.isLastChild:L.hasNextSibling));F.$isElementNode(f)&&R(f,c,d.concat(b===l-1?L.ancestorIsLastChild:L.ancestorHasNextSibling))})}
12
+ function S(a){return Object.entries(J).reduce((c,[d,l])=>c.replace(new RegExp(d,"g"),String(l)),a)}
13
13
  let W=[a=>a.hasFormat("bold")&&"Bold",a=>a.hasFormat("code")&&"Code",a=>a.hasFormat("italic")&&"Italic",a=>a.hasFormat("strikethrough")&&"Strikethrough",a=>a.hasFormat("subscript")&&"Subscript",a=>a.hasFormat("superscript")&&"Superscript",a=>a.hasFormat("underline")&&"Underline"],X=[a=>a.isDirectionless()&&"Directionless",a=>a.isUnmergeable()&&"Unmergeable"],Y=[a=>a.isToken()&&"Token",a=>a.isSegmented()&&"Segmented"];
14
- function T(a){let c=X.map(e=>e(a)).filter(Boolean).join(", ").toLocaleLowerCase();""!==c&&(c="detail: "+c);return c}function U(a){let c=Y.map(e=>e(a)).filter(Boolean).join(", ").toLocaleLowerCase();""!==c&&(c="mode: "+c);return c}function P(a){let c=W.map(e=>e(a)).filter(Boolean).join(", ").toLocaleLowerCase();""!==c&&(c="format: "+c);return c}
15
- function V({indent:a,isSelected:c,node:e,nodeKeyDisplay:l,selection:f,typeDisplay:b}){if(!F.$isTextNode(e)||!F.$isRangeSelection(f)||!c||F.$isElementNode(e))return"";c=f.anchor;var d=f.focus;if(""===e.getTextContent()||c.getNode()===f.focus.getNode()&&c.offset===d.offset)return"";d=f.anchor;let n=f.focus,y=e.getTextContent(),t=y.length;c=f=-1;if("text"===d.type&&"text"===n.type){let m=d.getNode(),w=n.getNode();m===w&&e===m&&d.offset!==n.offset?[f,c]=d.offset<n.offset?[d.offset,n.offset]:[n.offset,
16
- d.offset]:e===m?[f,c]=m.isBefore(w)?[d.offset,t]:[0,d.offset]:e===w?[f,c]=w.isBefore(m)?[n.offset,t]:[0,n.offset]:[f,c]=[0,t]}e=(y.slice(0,f).match(K)||[]).length;d=(y.slice(f,c).match(K)||[]).length;let [q,z]=[f+e,c+e+d];if(q===z)return"";e=a[a.length-1]===L.hasNextSibling?L.ancestorHasNextSibling:L.ancestorIsLastChild;a=[...a.slice(0,a.length-1),e];e=Array(q+1).fill(" ");f=Array(z-q).fill(L.selectedChar);l=Array(l.length+(b.length+3)).fill(" ");return[L.selectedLine,a.join(" "),[...l,...e,...f].join("")].join(" ")+
14
+ function T(a){let c=X.map(d=>d(a)).filter(Boolean).join(", ").toLocaleLowerCase();""!==c&&(c="detail: "+c);return c}function U(a){let c=Y.map(d=>d(a)).filter(Boolean).join(", ").toLocaleLowerCase();""!==c&&(c="mode: "+c);return c}function P(a){let c=W.map(d=>d(a)).filter(Boolean).join(", ").toLocaleLowerCase();""!==c&&(c="format: "+c);return c}
15
+ function V({indent:a,isSelected:c,node:d,nodeKeyDisplay:l,selection:f,typeDisplay:b}){if(!F.$isTextNode(d)||!F.$isRangeSelection(f)||!c||F.$isElementNode(d))return"";c=f.anchor;var e=f.focus;if(""===d.getTextContent()||c.getNode()===f.focus.getNode()&&c.offset===e.offset)return"";e=f.anchor;let n=f.focus,y=d.getTextContent(),t=y.length;c=f=-1;if("text"===e.type&&"text"===n.type){let m=e.getNode(),w=n.getNode();m===w&&d===m&&e.offset!==n.offset?[f,c]=e.offset<n.offset?[e.offset,n.offset]:[n.offset,
16
+ e.offset]:d===m?[f,c]=m.isBefore(w)?[e.offset,t]:[0,e.offset]:d===w?[f,c]=w.isBefore(m)?[n.offset,t]:[0,n.offset]:[f,c]=[0,t]}d=(y.slice(0,f).match(K)||[]).length;e=(y.slice(f,c).match(K)||[]).length;let [q,z]=[f+d,c+d+e];if(q===z)return"";d=a[a.length-1]===L.hasNextSibling?L.ancestorHasNextSibling:L.ancestorIsLastChild;a=[...a.slice(0,a.length-1),d];d=Array(q+1).fill(" ");f=Array(z-q).fill(L.selectedChar);l=Array(l.length+(b.length+3)).fill(" ");return[L.selectedLine,a.join(" "),[...l,...d,...f].join("")].join(" ")+
17
17
  "\n"}
18
- exports.TreeView=function({timeTravelButtonClassName:a,timeTravelPanelSliderClassName:c,timeTravelPanelButtonClassName:e,viewClassName:l,timeTravelPanelClassName:f,editor:b}){let [d,n]=I.useState([]),[y,t]=I.useState(""),[q,z]=I.useState(!1),m=I.useRef(0),w=I.useRef(null),D=I.useRef(null),[k,p]=I.useState(!1),[A,B]=I.useState(!1),[x,Z]=I.useState(!1),G=I.useRef(null),H=I.useCallback(g=>{const u=Q(b.getEditorState(),b._config,b._compositionKey,b._editable);t(u);q||n(E=>[...E,[Date.now(),g]])},[b,q]);
19
- I.useEffect(()=>{let g=b.getEditorState();!x&&1E3<g._nodeMap.size&&t(Q(g,b._config,b._compositionKey,b._editable))},[b,x]);I.useEffect(()=>v.mergeRegister(b.registerUpdateListener(({editorState:g})=>{if(!x&&1E3<g._nodeMap.size&&(G.current=g,B(!0),!x))return;H(g)}),b.registerEditableListener(()=>{let g=Q(b.getEditorState(),b._config,b._compositionKey,b._editable);t(g)})),[b,A,H,x]);let C=d.length;I.useEffect(()=>{if(k){let g,u=()=>{const E=m.current;E===C-1?p(!1):g=setTimeout(()=>{m.current++;const N=
20
- m.current,O=D.current;null!==O&&(O.value=String(N));b.setEditorState(d[N][1]);u()},d[E+1][0]-d[E][0])};u();return()=>{clearTimeout(g)}}},[d,k,b,C]);I.useEffect(()=>{let g=w.current;if(null!==g)return g.__lexicalEditor=b,()=>{g.__lexicalEditor=null}},[b]);return I.createElement("div",{className:l},!x&&A?I.createElement("div",{style:{padding:20}},I.createElement("span",{style:{marginRight:20}},"Detected large EditorState, this can impact debugging performance."),I.createElement("button",{onClick:()=>
21
- {Z(!0);let g=G.current;null!==g&&(G.current=null,H(g))},style:{background:"transparent",border:"1px solid white",color:"white",cursor:"pointer",padding:5}},"Show full tree")):null,!q&&(x||!A)&&2<C&&I.createElement("button",{onClick:()=>{let g=b.getRootElement();null!==g&&(g.contentEditable="false",m.current=C-1,z(!0))},className:a,type:"button"},"Time Travel"),(x||!A)&&I.createElement("pre",{ref:w},y),q&&(x||!A)&&I.createElement("div",{className:f},I.createElement("button",{className:e,onClick:()=>
22
- {m.current===C-1&&(m.current=1);p(!k)},type:"button"},k?"Pause":"Play"),I.createElement("input",{className:c,ref:D,onChange:g=>{g=Number(g.target.value);let u=d[g];u&&(m.current=g,b.setEditorState(u[1]))},type:"range",min:"1",max:C-1}),I.createElement("button",{className:e,onClick:()=>{var g=b.getRootElement();if(null!==g){g.contentEditable="true";g=d.length-1;b.setEditorState(d[g][1]);let u=D.current;null!==u&&(u.value=String(g));z(!1);p(!1)}},type:"button"},"Exit")))}
18
+ exports.TreeView=function({timeTravelButtonClassName:a,timeTravelPanelSliderClassName:c,timeTravelPanelButtonClassName:d,viewClassName:l,timeTravelPanelClassName:f,editor:b}){let [e,n]=I.useState([]),[y,t]=I.useState(""),[q,z]=I.useState(!1),m=I.useRef(0),w=I.useRef(null),D=I.useRef(null),[k,p]=I.useState(!1),[A,B]=I.useState(!1),[x,Z]=I.useState(!1),G=I.useRef(null),H=I.useCallback(g=>{const u=Q(b.getEditorState(),b._config,b._compositionKey,b._editable);t(u);q||n(E=>[...E,[Date.now(),g]])},[b,q]);
19
+ I.useEffect(()=>{let g=b.getEditorState();!x&&1E3<g._nodeMap.size&&t(Q(g,b._config,b._compositionKey,b._editable))},[b,x]);I.useEffect(()=>v.mergeRegister(b.registerUpdateListener(({editorState:g})=>{if(!x&&1E3<g._nodeMap.size&&(G.current=g,B(!0),!x))return;H(g)}),b.registerEditableListener(()=>{let g=Q(b.getEditorState(),b._config,b._compositionKey,b._editable);t(g)})),[b,A,H,x]);let C=e.length;I.useEffect(()=>{if(k){let g,u=()=>{const E=m.current;E===C-1?p(!1):g=setTimeout(()=>{m.current++;const N=
20
+ m.current,O=D.current;null!==O&&(O.value=String(N));b.setEditorState(e[N][1]);u()},e[E+1][0]-e[E][0])};u();return()=>{clearTimeout(g)}}},[e,k,b,C]);I.useEffect(()=>{let g=w.current;if(null!==g)return g.__lexicalEditor=b,()=>{g.__lexicalEditor=null}},[b]);return I.createElement("div",{className:l},!x&&A?I.createElement("div",{style:{padding:20}},I.createElement("span",{style:{marginRight:20}},"Detected large EditorState, this can impact debugging performance."),I.createElement("button",{onClick:()=>
21
+ {Z(!0);let g=G.current;null!==g&&(G.current=null,H(g))},style:{background:"transparent",border:"1px solid white",color:"white",cursor:"pointer",padding:5}},"Show full tree")):null,!q&&(x||!A)&&2<C&&I.createElement("button",{onClick:()=>{let g=b.getRootElement();null!==g&&(g.contentEditable="false",m.current=C-1,z(!0))},className:a,type:"button"},"Time Travel"),(x||!A)&&I.createElement("pre",{ref:w},y),q&&(x||!A)&&I.createElement("div",{className:f},I.createElement("button",{className:d,onClick:()=>
22
+ {m.current===C-1&&(m.current=1);p(!k)},type:"button"},k?"Pause":"Play"),I.createElement("input",{className:c,ref:D,onChange:g=>{g=Number(g.target.value);let u=e[g];u&&(m.current=g,b.setEditorState(u[1]))},type:"range",min:"1",max:C-1}),I.createElement("button",{className:d,onClick:()=>{var g=b.getRootElement();if(null!==g){g.contentEditable="true";g=e.length-1;b.setEditorState(e[g][1]);let u=D.current;null!==u&&(u.value=String(g));z(!1);p(!1)}},type:"button"},"Exit")))}
package/package.json CHANGED
@@ -8,29 +8,29 @@
8
8
  "rich-text"
9
9
  ],
10
10
  "license": "MIT",
11
- "version": "0.7.9",
11
+ "version": "0.8.0",
12
12
  "dependencies": {
13
- "@lexical/clipboard": "0.7.9",
14
- "@lexical/code": "0.7.9",
15
- "@lexical/dragon": "0.7.9",
16
- "@lexical/hashtag": "0.7.9",
17
- "@lexical/history": "0.7.9",
18
- "@lexical/link": "0.7.9",
19
- "@lexical/list": "0.7.9",
20
- "@lexical/mark": "0.7.9",
21
- "@lexical/markdown": "0.7.9",
22
- "@lexical/overflow": "0.7.9",
23
- "@lexical/plain-text": "0.7.9",
24
- "@lexical/rich-text": "0.7.9",
25
- "@lexical/selection": "0.7.9",
26
- "@lexical/table": "0.7.9",
27
- "@lexical/text": "0.7.9",
28
- "@lexical/utils": "0.7.9",
29
- "@lexical/yjs": "0.7.9",
13
+ "@lexical/clipboard": "0.8.0",
14
+ "@lexical/code": "0.8.0",
15
+ "@lexical/dragon": "0.8.0",
16
+ "@lexical/hashtag": "0.8.0",
17
+ "@lexical/history": "0.8.0",
18
+ "@lexical/link": "0.8.0",
19
+ "@lexical/list": "0.8.0",
20
+ "@lexical/mark": "0.8.0",
21
+ "@lexical/markdown": "0.8.0",
22
+ "@lexical/overflow": "0.8.0",
23
+ "@lexical/plain-text": "0.8.0",
24
+ "@lexical/rich-text": "0.8.0",
25
+ "@lexical/selection": "0.8.0",
26
+ "@lexical/table": "0.8.0",
27
+ "@lexical/text": "0.8.0",
28
+ "@lexical/utils": "0.8.0",
29
+ "@lexical/yjs": "0.8.0",
30
30
  "react-error-boundary": "^3.1.4"
31
31
  },
32
32
  "peerDependencies": {
33
- "lexical": "0.7.9",
33
+ "lexical": "0.8.0",
34
34
  "react": ">=17.x",
35
35
  "react-dom": ">=17.x"
36
36
  },
@@ -7,9 +7,9 @@
7
7
  */
8
8
  import type { Binding } from '@lexical/yjs';
9
9
  import type { LexicalEditor } from 'lexical';
10
- import type { Doc } from 'yjs';
11
10
  import * as React from 'react';
12
11
  import { WebsocketProvider } from 'y-websocket';
12
+ import { Doc } from 'yjs';
13
13
  import { InitialEditorStateType } from '../LexicalComposer';
14
14
  export declare type CursorsContainerRef = React.MutableRefObject<HTMLElement | null>;
15
15
  export declare function useYjsCollaboration(editor: LexicalEditor, id: string, provider: WebsocketProvider, docMap: Map<string, Doc>, name: string, color: string, shouldBootstrap: boolean, cursorsContainerRef?: CursorsContainerRef, initialEditorState?: InitialEditorStateType): [JSX.Element, Binding];