Skip to content

Commit

Permalink
set default checked boolean value when creating a check list
Browse files Browse the repository at this point in the history
  • Loading branch information
amanharwara committed Apr 27, 2024
1 parent 9df0da1 commit a7839b7
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions packages/lexical-list/src/formatList.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand Down Expand Up @@ -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());
Expand Down

0 comments on commit a7839b7

Please sign in to comment.