From a7839b72532a8e288032ca4baaa8907a807de763 Mon Sep 17 00:00:00 2001 From: Aman Harwara Date: Sat, 27 Apr 2024 17:54:28 +0530 Subject: [PATCH] set default `checked` boolean value when creating a check list --- packages/lexical-list/src/formatList.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/packages/lexical-list/src/formatList.ts b/packages/lexical-list/src/formatList.ts index 2263edfb757..ff9c098c267 100644 --- a/packages/lexical-list/src/formatList.ts +++ b/packages/lexical-list/src/formatList.ts @@ -83,7 +83,9 @@ export function insertList(editor: LexicalEditor, listType: ListType): void { if ($isRootOrShadowRoot(anchorNodeParent)) { anchorNode.replace(list); - const listItem = $createListItemNode(); + const listItem = $createListItemNode( + listType === 'check' ? false : undefined, + ); if ($isElementNode(anchorNode)) { listItem.setFormat(anchorNode.getFormatType()); listItem.setIndent(anchorNode.getIndent()); @@ -156,7 +158,9 @@ function createListOrMerge(node: ElementNode, listType: ListType): ListNode { const previousSibling = node.getPreviousSibling(); const nextSibling = node.getNextSibling(); - const listItem = $createListItemNode(); + const listItem = $createListItemNode( + listType === 'check' ? false : undefined, + ); listItem.setFormat(node.getFormatType()); listItem.setIndent(node.getIndent()); append(listItem, node.getChildren());