From dbb081359c4c2f883f9e68ab9d81d69aa2f1c978 Mon Sep 17 00:00:00 2001 From: Nick J Moss Date: Fri, 27 Oct 2023 09:49:37 -0600 Subject: [PATCH] Add Optional Chaining to `isNodePre` Method (#5157) --- packages/lexical/src/nodes/LexicalTextNode.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/packages/lexical/src/nodes/LexicalTextNode.ts b/packages/lexical/src/nodes/LexicalTextNode.ts index 1fc4a6cdac4..de9585477aa 100644 --- a/packages/lexical/src/nodes/LexicalTextNode.ts +++ b/packages/lexical/src/nodes/LexicalTextNode.ts @@ -1138,6 +1138,8 @@ function isNodePre(node: Node): boolean { return ( node.nodeName === 'PRE' || (node.nodeType === DOM_ELEMENT_TYPE && + (node as HTMLElement).style !== undefined && + (node as HTMLElement).style.whiteSpace !== undefined && (node as HTMLElement).style.whiteSpace.startsWith('pre')) ); }