From d438edda8adec9715a3a4385f6ab6680941cc92d Mon Sep 17 00:00:00 2001 From: Sherry Wong Date: Wed, 29 May 2024 23:32:30 +0800 Subject: [PATCH] adress comments --- packages/lexical-list/src/LexicalListItemNode.ts | 11 +++++------ packages/lexical-playground/src/nodes/ImageNode.tsx | 2 +- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/packages/lexical-list/src/LexicalListItemNode.ts b/packages/lexical-list/src/LexicalListItemNode.ts index ae4c06fe0e4..dd38f8c590f 100644 --- a/packages/lexical-list/src/LexicalListItemNode.ts +++ b/packages/lexical-list/src/LexicalListItemNode.ts @@ -24,7 +24,6 @@ import type { import { addClassNamesToElement, - isHTMLElement, removeClassNamesFromElement, } from '@lexical/utils'; import { @@ -493,14 +492,14 @@ function updateListItemChecked( } } -function $convertListItemElement(domNode: Node): DOMConversionOutput { +function $convertListItemElement(domNode: HTMLElement): DOMConversionOutput { + const ariaCheckedAttr = domNode.getAttribute('aria-checked'); const checked = - isHTMLElement(domNode) && - (domNode.getAttribute('aria-checked') === 'true' + ariaCheckedAttr === 'true' ? true - : domNode.getAttribute('aria-checked') === 'false' + : ariaCheckedAttr === 'false' ? false - : undefined); + : undefined; return {node: $createListItemNode(checked)}; } diff --git a/packages/lexical-playground/src/nodes/ImageNode.tsx b/packages/lexical-playground/src/nodes/ImageNode.tsx index 31b3904ffd8..b2309c5553f 100644 --- a/packages/lexical-playground/src/nodes/ImageNode.tsx +++ b/packages/lexical-playground/src/nodes/ImageNode.tsx @@ -42,7 +42,7 @@ function isGoogleDocCheckboxImg(img: HTMLImageElement): boolean { img.parentElement != null && img.parentElement.tagName === 'LI' && img.previousSibling === null && - img.src.startsWith('data:image/png;base64,iVBOR') + img.getAttribute('aria-roledescription') === 'checkbox' ); }