From 26a4b6b37139ba76aa98ca48183ff227f9ba8419 Mon Sep 17 00:00:00 2001 From: ReFFaT <102167552+ReFFaT@users.noreply.github.com> Date: Mon, 13 Jan 2025 14:53:39 +0300 Subject: [PATCH] fix: fixed serialization of empty nodes (#545) --- src/utils/nodes.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/utils/nodes.ts b/src/utils/nodes.ts index cd9a42a9..766a7387 100644 --- a/src/utils/nodes.ts +++ b/src/utils/nodes.ts @@ -23,7 +23,9 @@ export function findFirstTextblockChild( export const isNodeEmpty = (node: Node) => { const emptyChildren = findChildren( node, - (n) => (!n.isText && !n.isAtom && n.content.size === 0) || (n.isText && !n.textContent), + (n) => + (!n.isText && !n.isAtom && n.content.size === 0 && n.type.name === 'paragraph') || + (n.isText && !n.textContent), true, );