Skip to content

Commit

Permalink
Fixed list item type disambiguation
Browse files Browse the repository at this point in the history
  • Loading branch information
marekdedic committed Dec 25, 2023
1 parent f198dd1 commit 2d806c0
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
5 changes: 4 additions & 1 deletion src/syntax-extensions/ListItemExtension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,10 @@ export class ListItemExtension extends NodeExtension<ListItem> {
}

public unistToProseMirrorTest(node: UnistNode): boolean {
return node.type === this.unistNodeName() && !("checked" in node);
return (
node.type === this.unistNodeName() &&
(!("checked" in node) || typeof node.checked !== "boolean")
);
}

public proseMirrorKeymap(
Expand Down
6 changes: 5 additions & 1 deletion src/syntax-extensions/TaskListItemExtension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,11 @@ export class TaskListItemExtension extends NodeExtension<ListItem> {
}

public unistToProseMirrorTest(node: UnistNode): boolean {
return node.type === this.unistNodeName() && "checked" in node;
return (
node.type === this.unistNodeName() &&
"checked" in node &&
typeof node.checked === "boolean"
);
}

public unistNodeToProseMirrorNodes(
Expand Down

0 comments on commit 2d806c0

Please sign in to comment.