From 5d377c9e9136d6764a963b6b5382d251ee163197 Mon Sep 17 00:00:00 2001 From: Aman Harwara Date: Mon, 4 Nov 2024 18:28:55 +0530 Subject: [PATCH] [lexical-list] Handle appending inline element nodes in ListNode.append --- packages/lexical-list/src/LexicalListNode.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/packages/lexical-list/src/LexicalListNode.ts b/packages/lexical-list/src/LexicalListNode.ts index 45a87f30d2a..2af911c7a8e 100644 --- a/packages/lexical-list/src/LexicalListNode.ts +++ b/packages/lexical-list/src/LexicalListNode.ts @@ -200,8 +200,12 @@ export class ListNode extends ElementNode { if ($isListNode(currentNode)) { listItemNode.append(currentNode); } else if ($isElementNode(currentNode)) { - const textNode = $createTextNode(currentNode.getTextContent()); - listItemNode.append(textNode); + if (currentNode.isInline()) { + listItemNode.append(currentNode); + } else { + const textNode = $createTextNode(currentNode.getTextContent()); + listItemNode.append(textNode); + } } else { listItemNode.append(currentNode); }