diff --git a/packages/lexical/src/LexicalEditorState.ts b/packages/lexical/src/LexicalEditorState.ts index 1cc3015bac4..f31144fb978 100644 --- a/packages/lexical/src/LexicalEditorState.ts +++ b/packages/lexical/src/LexicalEditorState.ts @@ -57,7 +57,7 @@ function exportNodeToJSON( node: LexicalNode, ): SerializedNode { const serializedNode = node.exportJSON(); - if (Object.keys(node.__classes).length > 0) { + if (node.__classes && Object.keys(node.__classes).length > 0) { serializedNode.classes = node.__classes; } const nodeClass = node.constructor;