Skip to content

Commit

Permalink
Resolve conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
etrepum committed Dec 10, 2024
1 parent 73b8cc0 commit cac7527
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 10 deletions.
2 changes: 1 addition & 1 deletion packages/lexical-list/src/LexicalListItemNode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -382,7 +382,7 @@ export class ListItemNode extends ParagraphNode {
}

canMergeWith(node: LexicalNode): boolean {
return $isParagraphNode(node) || $isListItemNode(node);
return $isListItemNode(node) || $isParagraphNode(node);
}

extractWithChild(child: LexicalNode, selection: BaseSelection): boolean {
Expand Down
14 changes: 5 additions & 9 deletions packages/lexical-list/src/formatList.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import {
$getSelection,
$isElementNode,
$isLeafNode,
$isParagraphNode,
$isRangeSelection,
$isRootOrShadowRoot,
ElementNode,
Expand Down Expand Up @@ -494,7 +493,7 @@ export function $handleListInsertParagraph(): boolean {
);

const grandparent = parent.getParent();
let replacementNode: ElementNode;
let replacementNode: ParagraphNode | ListItemNode;

if ($isRootOrShadowRoot(grandparent)) {
replacementNode = $createParagraphNode();
Expand All @@ -513,17 +512,14 @@ export function $handleListInsertParagraph(): boolean {
const nextSiblings = anchor.getNextSiblings();
if (nextSiblings.length > 0) {
const newList = $createListNode(parent.getListType());
if ($isParagraphNode(replacementNode)) {
replacementNode.insertAfter(newList);
} else {
if ($isListItemNode(replacementNode)) {
const newListItem = $createListItemNode();
newListItem.append(newList);
replacementNode.insertAfter(newListItem);
} else {
replacementNode.insertAfter(newList);
}
nextSiblings.forEach((sibling) => {
sibling.remove();
newList.append(sibling);
});
newList.append(...nextSiblings);
}
// Don't leave hanging nested empty lists
$removeHighestEmptyListParent(anchor);
Expand Down

0 comments on commit cac7527

Please sign in to comment.