@lexical/react 0.35.1-nightly.20250919.0 → 0.35.1-nightly.20250923.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.
Files changed (38) hide show
  1. package/LexicalCollaborationContext.d.ts +4 -1
  2. package/LexicalCollaborationContext.dev.js +35 -7
  3. package/LexicalCollaborationContext.dev.mjs +36 -9
  4. package/LexicalCollaborationContext.mjs +1 -0
  5. package/LexicalCollaborationContext.node.mjs +1 -0
  6. package/LexicalCollaborationContext.prod.js +1 -1
  7. package/LexicalCollaborationContext.prod.mjs +1 -1
  8. package/LexicalContextMenuPlugin.d.ts +2 -2
  9. package/LexicalContextMenuPlugin.dev.js +2 -1
  10. package/LexicalContextMenuPlugin.dev.mjs +2 -1
  11. package/LexicalContextMenuPlugin.prod.js +1 -1
  12. package/LexicalContextMenuPlugin.prod.mjs +1 -1
  13. package/LexicalEditorRefPlugin.d.ts +2 -2
  14. package/LexicalErrorBoundary.dev.js +2 -140
  15. package/LexicalErrorBoundary.dev.mjs +1 -126
  16. package/LexicalErrorBoundary.prod.js +1 -1
  17. package/LexicalErrorBoundary.prod.mjs +1 -1
  18. package/LexicalNestedComposer.dev.js +3 -2
  19. package/LexicalNestedComposer.dev.mjs +4 -3
  20. package/LexicalNestedComposer.prod.js +1 -1
  21. package/LexicalNestedComposer.prod.mjs +1 -1
  22. package/LexicalNodeContextMenuPlugin.d.ts +2 -2
  23. package/LexicalNodeContextMenuPlugin.dev.js +27 -5221
  24. package/LexicalNodeContextMenuPlugin.dev.mjs +3 -5184
  25. package/LexicalNodeContextMenuPlugin.prod.js +1 -5
  26. package/LexicalNodeContextMenuPlugin.prod.mjs +1 -5
  27. package/LexicalNodeMenuPlugin.dev.js +2 -1
  28. package/LexicalNodeMenuPlugin.dev.mjs +2 -1
  29. package/LexicalNodeMenuPlugin.prod.js +1 -1
  30. package/LexicalNodeMenuPlugin.prod.mjs +1 -1
  31. package/LexicalTypeaheadMenuPlugin.dev.js +2 -1
  32. package/LexicalTypeaheadMenuPlugin.dev.mjs +2 -1
  33. package/LexicalTypeaheadMenuPlugin.prod.js +1 -1
  34. package/LexicalTypeaheadMenuPlugin.prod.mjs +1 -1
  35. package/package.json +19 -19
  36. package/shared/LexicalMenu.d.ts +5 -5
  37. package/shared/mergeRefs.d.ts +1 -1
  38. package/shared/useYjsCollaboration.d.ts +1 -1
@@ -6,7 +6,7 @@
6
6
  *
7
7
  */
8
8
 
9
- import { useCollaborationContext } from '@lexical/react/LexicalCollaborationContext';
9
+ import { CollaborationContext } from '@lexical/react/LexicalCollaborationContext';
10
10
  import { LexicalComposerContext, createLexicalComposerContext } from '@lexical/react/LexicalComposerContext';
11
11
  import { createSharedNodeState, getRegisteredNode, getStaticNodeConfig } from 'lexical';
12
12
  import { useRef, useContext, useMemo, useEffect } from 'react';
@@ -147,11 +147,12 @@ function LexicalNestedComposer({
147
147
  []);
148
148
 
149
149
  // If collaboration is enabled, make sure we don't render the children until the collaboration subdocument is ready.
150
+ const collabContext = useContext(CollaborationContext);
150
151
  const {
151
152
  isCollabActive,
152
153
  yjsDocMap
153
- } = useCollaborationContext();
154
- const isCollabReady = skipCollabChecks || wasCollabPreviouslyReadyRef.current || yjsDocMap.has(initialEditor.getKey());
154
+ } = collabContext ?? {};
155
+ const isCollabReady = skipCollabChecks || wasCollabPreviouslyReadyRef.current || yjsDocMap && yjsDocMap.has(initialEditor.getKey());
155
156
  useEffect(() => {
156
157
  if (isCollabReady) {
157
158
  wasCollabPreviouslyReadyRef.current = true;
@@ -6,4 +6,4 @@
6
6
  *
7
7
  */
8
8
 
9
- "use strict";var e=require("@lexical/react/LexicalCollaborationContext"),t=require("@lexical/react/LexicalComposerContext"),o=require("lexical"),r=require("react"),n=require("react/jsx-runtime");function s(e){const t=new Set,{ownNodeConfig:r}=o.getStaticNodeConfig(e),n=e.transform();if(r){const e=r.$transform;e&&t.add(e)}return n&&t.add(n),t}const a=()=>{},i=()=>{};exports.LexicalNestedComposer=function({initialEditor:c,children:l,initialNodes:d,initialTheme:f,skipCollabChecks:p,skipEditableListener:u}){const m=r.useRef(!1),x=r.useContext(t.LexicalComposerContext);null==x&&function(e,...t){const o=new URL("https://lexical.dev/docs/error"),r=new URLSearchParams;r.append("code",e);for(const e of t)r.append("v",e);throw o.search=r.toString(),Error(`Minified Lexical error #${e}; visit ${o.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}(9);const[h,{getTheme:g}]=x,C=r.useMemo((()=>{const e=f||g()||void 0,r=t.createLexicalComposerContext(x,e);void 0!==e&&(c._config.theme=e),c._parentEditor=c._parentEditor||h;const n=c._createEditorArgs,l=n&&n.namespace;if(d){a(),l||(i(),c._config.namespace=h._config.namespace);for(let e of d){let t=null,r=null;if("function"!=typeof e){const o=e;e=o.replace,t=o.with,r=o.withKlass||null}const n=o.getRegisteredNode(c,e.getType());c._nodes.set(e.getType(),{exportDOM:n?n.exportDOM:void 0,klass:e,replace:t,replaceWithKlass:r,sharedNodeState:o.createSharedNodeState(e),transforms:s(e)})}}else if(n&&n.nodes)l||(i(),c._config.namespace=h._config.namespace);else{const e=c._nodes=new Map(h._nodes);l||(c._config.namespace=h._config.namespace);for(const[t,r]of e)c._nodes.set(t,{exportDOM:r.exportDOM,klass:r.klass,replace:r.replace,replaceWithKlass:r.replaceWithKlass,sharedNodeState:o.createSharedNodeState(r.klass),transforms:s(r.klass)})}return[c,r]}),[]),{isCollabActive:_,yjsDocMap:v}=e.useCollaborationContext(),E=p||m.current||v.has(c.getKey());return r.useEffect((()=>{E&&(m.current=!0)}),[E]),r.useEffect((()=>{if(!u){const e=e=>c.setEditable(e);return e(h.isEditable()),h.registerEditableListener(e)}}),[c,h,u]),n.jsx(t.LexicalComposerContext.Provider,{value:C,children:!_||E?l:null})};
9
+ "use strict";var e=require("@lexical/react/LexicalCollaborationContext"),t=require("@lexical/react/LexicalComposerContext"),o=require("lexical"),r=require("react"),n=require("react/jsx-runtime");function s(e){const t=new Set,{ownNodeConfig:r}=o.getStaticNodeConfig(e),n=e.transform();if(r){const e=r.$transform;e&&t.add(e)}return n&&t.add(n),t}const a=()=>{},i=()=>{};exports.LexicalNestedComposer=function({initialEditor:c,children:l,initialNodes:d,initialTheme:f,skipCollabChecks:p,skipEditableListener:u}){const x=r.useRef(!1),m=r.useContext(t.LexicalComposerContext);null==m&&function(e,...t){const o=new URL("https://lexical.dev/docs/error"),r=new URLSearchParams;r.append("code",e);for(const e of t)r.append("v",e);throw o.search=r.toString(),Error(`Minified Lexical error #${e}; visit ${o.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}(9);const[h,{getTheme:g}]=m,C=r.useMemo((()=>{const e=f||g()||void 0,r=t.createLexicalComposerContext(m,e);void 0!==e&&(c._config.theme=e),c._parentEditor=c._parentEditor||h;const n=c._createEditorArgs,l=n&&n.namespace;if(d){a(),l||(i(),c._config.namespace=h._config.namespace);for(let e of d){let t=null,r=null;if("function"!=typeof e){const o=e;e=o.replace,t=o.with,r=o.withKlass||null}const n=o.getRegisteredNode(c,e.getType());c._nodes.set(e.getType(),{exportDOM:n?n.exportDOM:void 0,klass:e,replace:t,replaceWithKlass:r,sharedNodeState:o.createSharedNodeState(e),transforms:s(e)})}}else if(n&&n.nodes)l||(i(),c._config.namespace=h._config.namespace);else{const e=c._nodes=new Map(h._nodes);l||(c._config.namespace=h._config.namespace);for(const[t,r]of e)c._nodes.set(t,{exportDOM:r.exportDOM,klass:r.klass,replace:r.replace,replaceWithKlass:r.replaceWithKlass,sharedNodeState:o.createSharedNodeState(r.klass),transforms:s(r.klass)})}return[c,r]}),[]),_=r.useContext(e.CollaborationContext),{isCollabActive:v,yjsDocMap:E}=_??{},L=p||x.current||E&&E.has(c.getKey());return r.useEffect((()=>{L&&(x.current=!0)}),[L]),r.useEffect((()=>{if(!u){const e=e=>c.setEditable(e);return e(h.isEditable()),h.registerEditableListener(e)}}),[c,h,u]),n.jsx(t.LexicalComposerContext.Provider,{value:C,children:!v||L?l:null})};
@@ -6,4 +6,4 @@
6
6
  *
7
7
  */
8
8
 
9
- import{useCollaborationContext as e}from"@lexical/react/LexicalCollaborationContext";import{LexicalComposerContext as t,createLexicalComposerContext as o}from"@lexical/react/LexicalComposerContext";import{createSharedNodeState as r,getRegisteredNode as n,getStaticNodeConfig as i}from"lexical";import{useRef as s,useContext as a,useMemo as l,useEffect as c}from"react";import{jsx as d}from"react/jsx-runtime";function f(e){const t=new Set,{ownNodeConfig:o}=i(e),r=e.transform();if(o){const e=o.$transform;e&&t.add(e)}return r&&t.add(r),t}const p=()=>{},m=()=>{};function h({initialEditor:i,children:h,initialNodes:u,initialTheme:g,skipCollabChecks:x,skipEditableListener:_}){const v=s(!1),w=a(t);null==w&&function(e,...t){const o=new URL("https://lexical.dev/docs/error"),r=new URLSearchParams;r.append("code",e);for(const e of t)r.append("v",e);throw o.search=r.toString(),Error(`Minified Lexical error #${e}; visit ${o.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}(9);const[E,{getTheme:k}]=w,C=l((()=>{const e=g||k()||void 0,t=o(w,e);void 0!==e&&(i._config.theme=e),i._parentEditor=i._parentEditor||E;const s=i._createEditorArgs,a=s&&s.namespace;if(u){p(),a||(m(),i._config.namespace=E._config.namespace);for(let e of u){let t=null,o=null;if("function"!=typeof e){const r=e;e=r.replace,t=r.with,o=r.withKlass||null}const s=n(i,e.getType());i._nodes.set(e.getType(),{exportDOM:s?s.exportDOM:void 0,klass:e,replace:t,replaceWithKlass:o,sharedNodeState:r(e),transforms:f(e)})}}else if(s&&s.nodes)a||(m(),i._config.namespace=E._config.namespace);else{const e=i._nodes=new Map(E._nodes);a||(i._config.namespace=E._config.namespace);for(const[t,o]of e)i._nodes.set(t,{exportDOM:o.exportDOM,klass:o.klass,replace:o.replace,replaceWithKlass:o.replaceWithKlass,sharedNodeState:r(o.klass),transforms:f(o.klass)})}return[i,t]}),[]),{isCollabActive:b,yjsDocMap:L}=e(),M=x||v.current||L.has(i.getKey());return c((()=>{M&&(v.current=!0)}),[M]),c((()=>{if(!_){const e=e=>i.setEditable(e);return e(E.isEditable()),E.registerEditableListener(e)}}),[i,E,_]),d(t.Provider,{value:C,children:!b||M?h:null})}export{h as LexicalNestedComposer};
9
+ import{CollaborationContext as e}from"@lexical/react/LexicalCollaborationContext";import{LexicalComposerContext as t,createLexicalComposerContext as o}from"@lexical/react/LexicalComposerContext";import{createSharedNodeState as r,getRegisteredNode as n,getStaticNodeConfig as i}from"lexical";import{useRef as s,useContext as a,useMemo as l,useEffect as c}from"react";import{jsx as d}from"react/jsx-runtime";function f(e){const t=new Set,{ownNodeConfig:o}=i(e),r=e.transform();if(o){const e=o.$transform;e&&t.add(e)}return r&&t.add(r),t}const p=()=>{},m=()=>{};function h({initialEditor:i,children:h,initialNodes:u,initialTheme:g,skipCollabChecks:x,skipEditableListener:_}){const v=s(!1),w=a(t);null==w&&function(e,...t){const o=new URL("https://lexical.dev/docs/error"),r=new URLSearchParams;r.append("code",e);for(const e of t)r.append("v",e);throw o.search=r.toString(),Error(`Minified Lexical error #${e}; visit ${o.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}(9);const[E,{getTheme:k}]=w,C=l((()=>{const e=g||k()||void 0,t=o(w,e);void 0!==e&&(i._config.theme=e),i._parentEditor=i._parentEditor||E;const s=i._createEditorArgs,a=s&&s.namespace;if(u){p(),a||(m(),i._config.namespace=E._config.namespace);for(let e of u){let t=null,o=null;if("function"!=typeof e){const r=e;e=r.replace,t=r.with,o=r.withKlass||null}const s=n(i,e.getType());i._nodes.set(e.getType(),{exportDOM:s?s.exportDOM:void 0,klass:e,replace:t,replaceWithKlass:o,sharedNodeState:r(e),transforms:f(e)})}}else if(s&&s.nodes)a||(m(),i._config.namespace=E._config.namespace);else{const e=i._nodes=new Map(E._nodes);a||(i._config.namespace=E._config.namespace);for(const[t,o]of e)i._nodes.set(t,{exportDOM:o.exportDOM,klass:o.klass,replace:o.replace,replaceWithKlass:o.replaceWithKlass,sharedNodeState:r(o.klass),transforms:f(o.klass)})}return[i,t]}),[]),b=a(e),{isCollabActive:L,yjsDocMap:M}=b??{},S=x||v.current||M&&M.has(i.getKey());return c((()=>{S&&(v.current=!0)}),[S]),c((()=>{if(!_){const e=e=>i.setEditable(e);return e(E.isEditable()),E.registerEditableListener(e)}}),[i,E,_]),d(t.Provider,{value:C,children:!L||S?h:null})}export{h as LexicalNestedComposer};
@@ -6,10 +6,10 @@
6
6
  *
7
7
  */
8
8
  import { LexicalNode } from 'lexical';
9
- import { MutableRefObject } from 'react';
9
+ import { JSX, RefObject } from 'react';
10
10
  declare class MenuOption {
11
11
  key: string;
12
- ref?: MutableRefObject<HTMLElement | null>;
12
+ ref?: RefObject<HTMLElement | null>;
13
13
  constructor(key: string);
14
14
  setRefElement(element: HTMLElement | null): void;
15
15
  }