lexical 0.32.2-nightly.20250630.0 → 0.32.2-nightly.20250701.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.
- package/Lexical.dev.js +30 -13
- package/Lexical.dev.mjs +30 -13
- package/Lexical.prod.js +1 -1
- package/Lexical.prod.mjs +1 -1
- package/LexicalUtils.d.ts +7 -5
- package/package.json +1 -1
package/Lexical.dev.js
CHANGED
|
@@ -10002,7 +10002,7 @@ function createEditor(editorConfig) {
|
|
|
10002
10002
|
{
|
|
10003
10003
|
// ArtificialNode__DO_NOT_USE can get renamed, so we use the type
|
|
10004
10004
|
const name = klass.name;
|
|
10005
|
-
const nodeType =
|
|
10005
|
+
const nodeType = hasOwnStaticMethod(klass, 'getType') && klass.getType();
|
|
10006
10006
|
if (replaceWithKlass) {
|
|
10007
10007
|
if (!(replaceWithKlass.prototype instanceof klass)) {
|
|
10008
10008
|
formatDevErrorMessage(`${replaceWithKlass.name} doesn't extend the ${name}`);
|
|
@@ -10013,19 +10013,19 @@ function createEditor(editorConfig) {
|
|
|
10013
10013
|
if (name !== 'RootNode' && nodeType !== 'root' && nodeType !== 'artificial') {
|
|
10014
10014
|
const proto = klass.prototype;
|
|
10015
10015
|
['getType', 'clone'].forEach(method => {
|
|
10016
|
-
if (!
|
|
10016
|
+
if (!hasOwnStaticMethod(klass, method)) {
|
|
10017
10017
|
console.warn(`${name} must implement static "${method}" method`);
|
|
10018
10018
|
}
|
|
10019
10019
|
});
|
|
10020
|
-
if (!
|
|
10020
|
+
if (!hasOwnStaticMethod(klass, 'importDOM') && hasOwnExportDOM(klass)) {
|
|
10021
10021
|
console.warn(`${name} should implement "importDOM" if using a custom "exportDOM" method to ensure HTML serialization (important for copy & paste) works as expected`);
|
|
10022
10022
|
}
|
|
10023
10023
|
if ($isDecoratorNode(proto)) {
|
|
10024
|
-
if (
|
|
10024
|
+
if (proto.decorate === DecoratorNode.prototype.decorate) {
|
|
10025
10025
|
console.warn(`${proto.constructor.name} must implement "decorate" method`);
|
|
10026
10026
|
}
|
|
10027
10027
|
}
|
|
10028
|
-
if (!
|
|
10028
|
+
if (!hasOwnStaticMethod(klass, 'importJSON')) {
|
|
10029
10029
|
console.warn(`${name} should implement "importJSON" method to ensure JSON and default HTML serialization works as expected`);
|
|
10030
10030
|
}
|
|
10031
10031
|
}
|
|
@@ -10733,7 +10733,7 @@ class LexicalEditor {
|
|
|
10733
10733
|
};
|
|
10734
10734
|
}
|
|
10735
10735
|
}
|
|
10736
|
-
LexicalEditor.version = "0.32.2-nightly.
|
|
10736
|
+
LexicalEditor.version = "0.32.2-nightly.20250701.0+dev.cjs";
|
|
10737
10737
|
|
|
10738
10738
|
let pendingNodeToClone = null;
|
|
10739
10739
|
function setPendingNodeToClone(pendingNode) {
|
|
@@ -12190,16 +12190,30 @@ function hasOwn(o, k) {
|
|
|
12190
12190
|
return Object.prototype.hasOwnProperty.call(o, k);
|
|
12191
12191
|
}
|
|
12192
12192
|
|
|
12193
|
+
/**
|
|
12194
|
+
* @internal
|
|
12195
|
+
*/
|
|
12196
|
+
function hasOwnStaticMethod(klass, k) {
|
|
12197
|
+
return hasOwn(klass, k) && klass[k] !== LexicalNode[k];
|
|
12198
|
+
}
|
|
12199
|
+
|
|
12200
|
+
/**
|
|
12201
|
+
* @internal
|
|
12202
|
+
*/
|
|
12203
|
+
function hasOwnExportDOM(klass) {
|
|
12204
|
+
return hasOwn(klass.prototype, 'exportDOM');
|
|
12205
|
+
}
|
|
12206
|
+
|
|
12193
12207
|
/** @internal */
|
|
12194
12208
|
function isAbstractNodeClass(klass) {
|
|
12195
|
-
return klass === DecoratorNode || klass === ElementNode || klass ===
|
|
12209
|
+
return klass === DecoratorNode || klass === ElementNode || klass === LexicalNode;
|
|
12196
12210
|
}
|
|
12197
12211
|
|
|
12198
12212
|
/** @internal */
|
|
12199
12213
|
function getStaticNodeConfig(klass) {
|
|
12200
12214
|
const nodeConfigRecord = PROTOTYPE_CONFIG_METHOD in klass.prototype ? klass.prototype[PROTOTYPE_CONFIG_METHOD]() : undefined;
|
|
12201
12215
|
const isAbstract = isAbstractNodeClass(klass);
|
|
12202
|
-
const nodeType = !isAbstract &&
|
|
12216
|
+
const nodeType = !isAbstract && hasOwnStaticMethod(klass, 'getType') ? klass.getType() : undefined;
|
|
12203
12217
|
let ownNodeConfig;
|
|
12204
12218
|
let ownNodeType = nodeType;
|
|
12205
12219
|
if (nodeConfigRecord) {
|
|
@@ -12213,11 +12227,14 @@ function getStaticNodeConfig(klass) {
|
|
|
12213
12227
|
}
|
|
12214
12228
|
}
|
|
12215
12229
|
if (!isAbstract && ownNodeType) {
|
|
12216
|
-
if (!
|
|
12230
|
+
if (!hasOwnStaticMethod(klass, 'getType')) {
|
|
12217
12231
|
klass.getType = () => ownNodeType;
|
|
12218
12232
|
}
|
|
12219
|
-
if (!
|
|
12220
|
-
|
|
12233
|
+
if (!hasOwnStaticMethod(klass, 'clone')) {
|
|
12234
|
+
// TextNode.length > 0 will only be true if the compiler output
|
|
12235
|
+
// is not ES6 compliant, in which case we can not provide this
|
|
12236
|
+
// warning
|
|
12237
|
+
if (TextNode.length === 0) {
|
|
12221
12238
|
if (!(klass.length === 0)) {
|
|
12222
12239
|
formatDevErrorMessage(`${klass.name} (type ${ownNodeType}) must implement a static clone method since its constructor has ${String(klass.length)} required arguments (expecting 0). Use an explicit default in the first argument of your constructor(prop: T=X, nodeKey?: NodeKey).`);
|
|
12223
12240
|
}
|
|
@@ -12227,7 +12244,7 @@ function getStaticNodeConfig(klass) {
|
|
|
12227
12244
|
return new klass();
|
|
12228
12245
|
};
|
|
12229
12246
|
}
|
|
12230
|
-
if (!
|
|
12247
|
+
if (!hasOwnStaticMethod(klass, 'importJSON')) {
|
|
12231
12248
|
{
|
|
12232
12249
|
if (!(klass.length === 0)) {
|
|
12233
12250
|
formatDevErrorMessage(`${klass.name} (type ${ownNodeType}) must implement a static importJSON method since its constructor has ${String(klass.length)} required arguments (expecting 0). Use an explicit default in the first argument of your constructor(prop: T=X, nodeKey?: NodeKey).`);
|
|
@@ -12235,7 +12252,7 @@ function getStaticNodeConfig(klass) {
|
|
|
12235
12252
|
}
|
|
12236
12253
|
klass.importJSON = ownNodeConfig && ownNodeConfig.$importJSON || (serializedNode => new klass().updateFromJSON(serializedNode));
|
|
12237
12254
|
}
|
|
12238
|
-
if (!
|
|
12255
|
+
if (!hasOwnStaticMethod(klass, 'importDOM') && ownNodeConfig) {
|
|
12239
12256
|
const {
|
|
12240
12257
|
importDOM
|
|
12241
12258
|
} = ownNodeConfig;
|
package/Lexical.dev.mjs
CHANGED
|
@@ -10000,7 +10000,7 @@ function createEditor(editorConfig) {
|
|
|
10000
10000
|
{
|
|
10001
10001
|
// ArtificialNode__DO_NOT_USE can get renamed, so we use the type
|
|
10002
10002
|
const name = klass.name;
|
|
10003
|
-
const nodeType =
|
|
10003
|
+
const nodeType = hasOwnStaticMethod(klass, 'getType') && klass.getType();
|
|
10004
10004
|
if (replaceWithKlass) {
|
|
10005
10005
|
if (!(replaceWithKlass.prototype instanceof klass)) {
|
|
10006
10006
|
formatDevErrorMessage(`${replaceWithKlass.name} doesn't extend the ${name}`);
|
|
@@ -10011,19 +10011,19 @@ function createEditor(editorConfig) {
|
|
|
10011
10011
|
if (name !== 'RootNode' && nodeType !== 'root' && nodeType !== 'artificial') {
|
|
10012
10012
|
const proto = klass.prototype;
|
|
10013
10013
|
['getType', 'clone'].forEach(method => {
|
|
10014
|
-
if (!
|
|
10014
|
+
if (!hasOwnStaticMethod(klass, method)) {
|
|
10015
10015
|
console.warn(`${name} must implement static "${method}" method`);
|
|
10016
10016
|
}
|
|
10017
10017
|
});
|
|
10018
|
-
if (!
|
|
10018
|
+
if (!hasOwnStaticMethod(klass, 'importDOM') && hasOwnExportDOM(klass)) {
|
|
10019
10019
|
console.warn(`${name} should implement "importDOM" if using a custom "exportDOM" method to ensure HTML serialization (important for copy & paste) works as expected`);
|
|
10020
10020
|
}
|
|
10021
10021
|
if ($isDecoratorNode(proto)) {
|
|
10022
|
-
if (
|
|
10022
|
+
if (proto.decorate === DecoratorNode.prototype.decorate) {
|
|
10023
10023
|
console.warn(`${proto.constructor.name} must implement "decorate" method`);
|
|
10024
10024
|
}
|
|
10025
10025
|
}
|
|
10026
|
-
if (!
|
|
10026
|
+
if (!hasOwnStaticMethod(klass, 'importJSON')) {
|
|
10027
10027
|
console.warn(`${name} should implement "importJSON" method to ensure JSON and default HTML serialization works as expected`);
|
|
10028
10028
|
}
|
|
10029
10029
|
}
|
|
@@ -10731,7 +10731,7 @@ class LexicalEditor {
|
|
|
10731
10731
|
};
|
|
10732
10732
|
}
|
|
10733
10733
|
}
|
|
10734
|
-
LexicalEditor.version = "0.32.2-nightly.
|
|
10734
|
+
LexicalEditor.version = "0.32.2-nightly.20250701.0+dev.esm";
|
|
10735
10735
|
|
|
10736
10736
|
let pendingNodeToClone = null;
|
|
10737
10737
|
function setPendingNodeToClone(pendingNode) {
|
|
@@ -12188,16 +12188,30 @@ function hasOwn(o, k) {
|
|
|
12188
12188
|
return Object.prototype.hasOwnProperty.call(o, k);
|
|
12189
12189
|
}
|
|
12190
12190
|
|
|
12191
|
+
/**
|
|
12192
|
+
* @internal
|
|
12193
|
+
*/
|
|
12194
|
+
function hasOwnStaticMethod(klass, k) {
|
|
12195
|
+
return hasOwn(klass, k) && klass[k] !== LexicalNode[k];
|
|
12196
|
+
}
|
|
12197
|
+
|
|
12198
|
+
/**
|
|
12199
|
+
* @internal
|
|
12200
|
+
*/
|
|
12201
|
+
function hasOwnExportDOM(klass) {
|
|
12202
|
+
return hasOwn(klass.prototype, 'exportDOM');
|
|
12203
|
+
}
|
|
12204
|
+
|
|
12191
12205
|
/** @internal */
|
|
12192
12206
|
function isAbstractNodeClass(klass) {
|
|
12193
|
-
return klass === DecoratorNode || klass === ElementNode || klass ===
|
|
12207
|
+
return klass === DecoratorNode || klass === ElementNode || klass === LexicalNode;
|
|
12194
12208
|
}
|
|
12195
12209
|
|
|
12196
12210
|
/** @internal */
|
|
12197
12211
|
function getStaticNodeConfig(klass) {
|
|
12198
12212
|
const nodeConfigRecord = PROTOTYPE_CONFIG_METHOD in klass.prototype ? klass.prototype[PROTOTYPE_CONFIG_METHOD]() : undefined;
|
|
12199
12213
|
const isAbstract = isAbstractNodeClass(klass);
|
|
12200
|
-
const nodeType = !isAbstract &&
|
|
12214
|
+
const nodeType = !isAbstract && hasOwnStaticMethod(klass, 'getType') ? klass.getType() : undefined;
|
|
12201
12215
|
let ownNodeConfig;
|
|
12202
12216
|
let ownNodeType = nodeType;
|
|
12203
12217
|
if (nodeConfigRecord) {
|
|
@@ -12211,11 +12225,14 @@ function getStaticNodeConfig(klass) {
|
|
|
12211
12225
|
}
|
|
12212
12226
|
}
|
|
12213
12227
|
if (!isAbstract && ownNodeType) {
|
|
12214
|
-
if (!
|
|
12228
|
+
if (!hasOwnStaticMethod(klass, 'getType')) {
|
|
12215
12229
|
klass.getType = () => ownNodeType;
|
|
12216
12230
|
}
|
|
12217
|
-
if (!
|
|
12218
|
-
|
|
12231
|
+
if (!hasOwnStaticMethod(klass, 'clone')) {
|
|
12232
|
+
// TextNode.length > 0 will only be true if the compiler output
|
|
12233
|
+
// is not ES6 compliant, in which case we can not provide this
|
|
12234
|
+
// warning
|
|
12235
|
+
if (TextNode.length === 0) {
|
|
12219
12236
|
if (!(klass.length === 0)) {
|
|
12220
12237
|
formatDevErrorMessage(`${klass.name} (type ${ownNodeType}) must implement a static clone method since its constructor has ${String(klass.length)} required arguments (expecting 0). Use an explicit default in the first argument of your constructor(prop: T=X, nodeKey?: NodeKey).`);
|
|
12221
12238
|
}
|
|
@@ -12225,7 +12242,7 @@ function getStaticNodeConfig(klass) {
|
|
|
12225
12242
|
return new klass();
|
|
12226
12243
|
};
|
|
12227
12244
|
}
|
|
12228
|
-
if (!
|
|
12245
|
+
if (!hasOwnStaticMethod(klass, 'importJSON')) {
|
|
12229
12246
|
{
|
|
12230
12247
|
if (!(klass.length === 0)) {
|
|
12231
12248
|
formatDevErrorMessage(`${klass.name} (type ${ownNodeType}) must implement a static importJSON method since its constructor has ${String(klass.length)} required arguments (expecting 0). Use an explicit default in the first argument of your constructor(prop: T=X, nodeKey?: NodeKey).`);
|
|
@@ -12233,7 +12250,7 @@ function getStaticNodeConfig(klass) {
|
|
|
12233
12250
|
}
|
|
12234
12251
|
klass.importJSON = ownNodeConfig && ownNodeConfig.$importJSON || (serializedNode => new klass().updateFromJSON(serializedNode));
|
|
12235
12252
|
}
|
|
12236
|
-
if (!
|
|
12253
|
+
if (!hasOwnStaticMethod(klass, 'importDOM') && ownNodeConfig) {
|
|
12237
12254
|
const {
|
|
12238
12255
|
importDOM
|
|
12239
12256
|
} = ownNodeConfig;
|