From 26b7b5c76649760be025d9a72043a5bc9a62102a Mon Sep 17 00:00:00 2001 From: Sherry Wong Date: Thu, 30 May 2024 00:05:05 +0800 Subject: [PATCH 1/2] cleanup --- packages/lexical-code/src/CodeNode.ts | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/packages/lexical-code/src/CodeNode.ts b/packages/lexical-code/src/CodeNode.ts index 1fb5701a1c2..262a65a6e31 100644 --- a/packages/lexical-code/src/CodeNode.ts +++ b/packages/lexical-code/src/CodeNode.ts @@ -324,11 +324,8 @@ export function $isCodeNode( return node instanceof CodeNode; } -function $convertPreElement(domNode: Node): DOMConversionOutput { - let language; - if (isHTMLElement(domNode)) { - language = domNode.getAttribute(LANGUAGE_DATA_ATTRIBUTE); - } +function $convertPreElement(domNode: HTMLElement): DOMConversionOutput { + const language = domNode.getAttribute(LANGUAGE_DATA_ATTRIBUTE); return {node: $createCodeNode(language)}; } From 57f15a7597de235375a1c551898ffba67704132b Mon Sep 17 00:00:00 2001 From: Sherry Wong Date: Thu, 30 May 2024 00:19:05 +0800 Subject: [PATCH 2/2] remove unused var --- packages/lexical-code/src/CodeNode.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/lexical-code/src/CodeNode.ts b/packages/lexical-code/src/CodeNode.ts index 262a65a6e31..0578661d35d 100644 --- a/packages/lexical-code/src/CodeNode.ts +++ b/packages/lexical-code/src/CodeNode.ts @@ -144,11 +144,11 @@ export class CodeNode extends ElementNode { } : null; }, - div: (node: Node) => ({ + div: () => ({ conversion: $convertDivElement, priority: 1, }), - pre: (node: Node) => ({ + pre: () => ({ conversion: $convertPreElement, priority: 0, }),