@lexical/react 0.37.1-nightly.20251016.0 → 0.37.1-nightly.20251020.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.
@@ -49,23 +49,6 @@ function warnOnlyOnce(message) {
49
49
  }
50
50
  }
51
51
 
52
- function getTransformSetFromKlass(klass) {
53
- const transforms = new Set();
54
- const {
55
- ownNodeConfig
56
- } = lexical.getStaticNodeConfig(klass);
57
- const transform = klass.transform();
58
- if (ownNodeConfig) {
59
- const $transform = ownNodeConfig.$transform;
60
- if ($transform) {
61
- transforms.add($transform);
62
- }
63
- }
64
- if (transform) {
65
- transforms.add(transform);
66
- }
67
- return transforms;
68
- }
69
52
  const initialNodesWarning = warnOnlyOnce(`LexicalNestedComposer initialNodes is deprecated and will be removed in v0.32.0, it has never worked correctly.\nYou can configure your editor's nodes with createEditor({nodes: [], parentEditor: $getEditor()})`);
70
53
  const explicitNamespaceWarning = warnOnlyOnce(`LexicalNestedComposer initialEditor should explicitly initialize its namespace when the node configuration differs from the parentEditor. For backwards compatibility, the namespace will be initialized from parentEditor until v0.32.0, but this has always had incorrect copy/paste behavior when the configuration differed.\nYou can configure your editor's namespace with createEditor({namespace: 'nested-editor-namespace', nodes: [], parentEditor: $getEditor()}).`);
71
54
  function LexicalNestedComposer({
@@ -109,7 +92,7 @@ function LexicalNestedComposer({
109
92
  replace: entry.replace,
110
93
  replaceWithKlass: entry.replaceWithKlass,
111
94
  sharedNodeState: lexical.createSharedNodeState(entry.klass),
112
- transforms: getTransformSetFromKlass(entry.klass)
95
+ transforms: lexical.getTransformSetFromKlass(entry.klass)
113
96
  });
114
97
  }
115
98
  } else if (!explicitNamespace) {
@@ -138,7 +121,7 @@ function LexicalNestedComposer({
138
121
  replace,
139
122
  replaceWithKlass,
140
123
  sharedNodeState: lexical.createSharedNodeState(klass),
141
- transforms: getTransformSetFromKlass(klass)
124
+ transforms: lexical.getTransformSetFromKlass(klass)
142
125
  });
143
126
  }
144
127
  }
@@ -8,7 +8,7 @@
8
8
 
9
9
  import { CollaborationContext } from '@lexical/react/LexicalCollaborationContext';
10
10
  import { LexicalComposerContext, createLexicalComposerContext } from '@lexical/react/LexicalComposerContext';
11
- import { createSharedNodeState, getRegisteredNode, getStaticNodeConfig } from 'lexical';
11
+ import { getTransformSetFromKlass, createSharedNodeState, getRegisteredNode } from 'lexical';
12
12
  import { useRef, useContext, useMemo, useEffect } from 'react';
13
13
  import { jsx } from 'react/jsx-runtime';
14
14
 
@@ -47,23 +47,6 @@ function warnOnlyOnce(message) {
47
47
  }
48
48
  }
49
49
 
50
- function getTransformSetFromKlass(klass) {
51
- const transforms = new Set();
52
- const {
53
- ownNodeConfig
54
- } = getStaticNodeConfig(klass);
55
- const transform = klass.transform();
56
- if (ownNodeConfig) {
57
- const $transform = ownNodeConfig.$transform;
58
- if ($transform) {
59
- transforms.add($transform);
60
- }
61
- }
62
- if (transform) {
63
- transforms.add(transform);
64
- }
65
- return transforms;
66
- }
67
50
  const initialNodesWarning = warnOnlyOnce(`LexicalNestedComposer initialNodes is deprecated and will be removed in v0.32.0, it has never worked correctly.\nYou can configure your editor's nodes with createEditor({nodes: [], parentEditor: $getEditor()})`);
68
51
  const explicitNamespaceWarning = warnOnlyOnce(`LexicalNestedComposer initialEditor should explicitly initialize its namespace when the node configuration differs from the parentEditor. For backwards compatibility, the namespace will be initialized from parentEditor until v0.32.0, but this has always had incorrect copy/paste behavior when the configuration differed.\nYou can configure your editor's namespace with createEditor({namespace: 'nested-editor-namespace', nodes: [], parentEditor: $getEditor()}).`);
69
52
  function LexicalNestedComposer({
@@ -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 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})};
9
+ "use strict";var e=require("@lexical/react/LexicalCollaborationContext"),t=require("@lexical/react/LexicalComposerContext"),r=require("lexical"),o=require("react"),s=require("react/jsx-runtime");const a=()=>{},n=()=>{};exports.LexicalNestedComposer=function({initialEditor:i,children:l,initialNodes:c,initialTheme:d,skipCollabChecks:p,skipEditableListener:f}){const u=o.useRef(!1),m=o.useContext(t.LexicalComposerContext);null==m&&function(e,...t){const r=new URL("https://lexical.dev/docs/error"),o=new URLSearchParams;o.append("code",e);for(const e of t)o.append("v",e);throw r.search=o.toString(),Error(`Minified Lexical error #${e}; visit ${r.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}(9);const[x,{getTheme:h}]=m,g=o.useMemo(()=>{const e=d||h()||void 0,o=t.createLexicalComposerContext(m,e);void 0!==e&&(i._config.theme=e),i._parentEditor=i._parentEditor||x;const s=i._createEditorArgs,l=s&&s.namespace;if(c){a(),l||(n(),i._config.namespace=x._config.namespace);for(let e of c){let t=null,o=null;if("function"!=typeof e){const r=e;e=r.replace,t=r.with,o=r.withKlass||null}const s=r.getRegisteredNode(i,e.getType());i._nodes.set(e.getType(),{exportDOM:s?s.exportDOM:void 0,klass:e,replace:t,replaceWithKlass:o,sharedNodeState:r.createSharedNodeState(e),transforms:r.getTransformSetFromKlass(e)})}}else if(s&&s.nodes)l||(n(),i._config.namespace=x._config.namespace);else{const e=i._nodes=new Map(x._nodes);l||(i._config.namespace=x._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.createSharedNodeState(o.klass),transforms:r.getTransformSetFromKlass(o.klass)})}return[i,o]},[]),C=o.useContext(e.CollaborationContext),{isCollabActive:_,yjsDocMap:v}=C??{},E=p||u.current||v&&v.has(i.getKey());return o.useEffect(()=>{E&&(u.current=!0)},[E]),o.useEffect(()=>{if(!f){const e=e=>i.setEditable(e);return e(x.isEditable()),x.registerEditableListener(e)}},[i,x,f]),s.jsx(t.LexicalComposerContext.Provider,{value:g,children:!_||E?l:null})};
@@ -6,4 +6,4 @@
6
6
  *
7
7
  */
8
8
 
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};
9
+ import{CollaborationContext as e}from"@lexical/react/LexicalCollaborationContext";import{LexicalComposerContext as t,createLexicalComposerContext as o}from"@lexical/react/LexicalComposerContext";import{getTransformSetFromKlass as r,createSharedNodeState as n,getRegisteredNode as i}from"lexical";import{useRef as s,useContext as a,useMemo as l,useEffect as c}from"react";import{jsx as p}from"react/jsx-runtime";const d=()=>{},f=()=>{};function m({initialEditor:m,children:h,initialNodes:u,initialTheme:g,skipCollabChecks:x,skipEditableListener:_}){const v=s(!1),E=a(t);null==E&&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[k,{getTheme:b}]=E,w=l(()=>{const e=g||b()||void 0,t=o(E,e);void 0!==e&&(m._config.theme=e),m._parentEditor=m._parentEditor||k;const s=m._createEditorArgs,a=s&&s.namespace;if(u){d(),a||(f(),m._config.namespace=k._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=i(m,e.getType());m._nodes.set(e.getType(),{exportDOM:s?s.exportDOM:void 0,klass:e,replace:t,replaceWithKlass:o,sharedNodeState:n(e),transforms:r(e)})}}else if(s&&s.nodes)a||(f(),m._config.namespace=k._config.namespace);else{const e=m._nodes=new Map(k._nodes);a||(m._config.namespace=k._config.namespace);for(const[t,o]of e)m._nodes.set(t,{exportDOM:o.exportDOM,klass:o.klass,replace:o.replace,replaceWithKlass:o.replaceWithKlass,sharedNodeState:n(o.klass),transforms:r(o.klass)})}return[m,t]},[]),C=a(e),{isCollabActive:L,yjsDocMap:M}=C??{},y=x||v.current||M&&M.has(m.getKey());return c(()=>{y&&(v.current=!0)},[y]),c(()=>{if(!_){const e=e=>m.setEditable(e);return e(k.isEditable()),k.registerEditableListener(e)}},[m,k,_]),p(t.Provider,{value:w,children:!L||y?h:null})}export{m as LexicalNestedComposer};
package/package.json CHANGED
@@ -8,26 +8,26 @@
8
8
  "rich-text"
9
9
  ],
10
10
  "license": "MIT",
11
- "version": "0.37.1-nightly.20251016.0",
11
+ "version": "0.37.1-nightly.20251020.0",
12
12
  "dependencies": {
13
13
  "@floating-ui/react": "^0.27.16",
14
- "@lexical/devtools-core": "0.37.1-nightly.20251016.0",
15
- "@lexical/dragon": "0.37.1-nightly.20251016.0",
16
- "@lexical/extension": "0.37.1-nightly.20251016.0",
17
- "@lexical/hashtag": "0.37.1-nightly.20251016.0",
18
- "@lexical/history": "0.37.1-nightly.20251016.0",
19
- "@lexical/link": "0.37.1-nightly.20251016.0",
20
- "@lexical/list": "0.37.1-nightly.20251016.0",
21
- "@lexical/mark": "0.37.1-nightly.20251016.0",
22
- "@lexical/markdown": "0.37.1-nightly.20251016.0",
23
- "@lexical/overflow": "0.37.1-nightly.20251016.0",
24
- "@lexical/plain-text": "0.37.1-nightly.20251016.0",
25
- "@lexical/rich-text": "0.37.1-nightly.20251016.0",
26
- "@lexical/table": "0.37.1-nightly.20251016.0",
27
- "@lexical/text": "0.37.1-nightly.20251016.0",
28
- "@lexical/utils": "0.37.1-nightly.20251016.0",
29
- "@lexical/yjs": "0.37.1-nightly.20251016.0",
30
- "lexical": "0.37.1-nightly.20251016.0",
14
+ "@lexical/devtools-core": "0.37.1-nightly.20251020.0",
15
+ "@lexical/dragon": "0.37.1-nightly.20251020.0",
16
+ "@lexical/extension": "0.37.1-nightly.20251020.0",
17
+ "@lexical/hashtag": "0.37.1-nightly.20251020.0",
18
+ "@lexical/history": "0.37.1-nightly.20251020.0",
19
+ "@lexical/link": "0.37.1-nightly.20251020.0",
20
+ "@lexical/list": "0.37.1-nightly.20251020.0",
21
+ "@lexical/mark": "0.37.1-nightly.20251020.0",
22
+ "@lexical/markdown": "0.37.1-nightly.20251020.0",
23
+ "@lexical/overflow": "0.37.1-nightly.20251020.0",
24
+ "@lexical/plain-text": "0.37.1-nightly.20251020.0",
25
+ "@lexical/rich-text": "0.37.1-nightly.20251020.0",
26
+ "@lexical/table": "0.37.1-nightly.20251020.0",
27
+ "@lexical/text": "0.37.1-nightly.20251020.0",
28
+ "@lexical/utils": "0.37.1-nightly.20251020.0",
29
+ "@lexical/yjs": "0.37.1-nightly.20251020.0",
30
+ "lexical": "0.37.1-nightly.20251020.0",
31
31
  "react-error-boundary": "^6.0.0"
32
32
  },
33
33
  "peerDependencies": {