From 7e76badb7ea72d6533fad5178c7a520c70634565 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Ska=C5=82ka?= Date: Fri, 30 Aug 2024 13:17:49 +0200 Subject: [PATCH] Fix input value parser to not detect generated BRs --- src/web/utils/inputUtils.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/web/utils/inputUtils.ts b/src/web/utils/inputUtils.ts index 0e006990..91166b81 100644 --- a/src/web/utils/inputUtils.ts +++ b/src/web/utils/inputUtils.ts @@ -82,7 +82,7 @@ function parseInnerHTMLToText(target: MarkdownTextInputElement): string { text += node.textContent; } else if (node.nodeName === 'BR') { const parentNode = getTopParentNode(node); - if (parentNode && parentNode.parentElement?.contentEditable !== 'true') { + if (parentNode && parentNode.parentElement?.contentEditable !== 'true' && !!(node as HTMLElement).getAttribute('data-id')) { // Parse br elements into newlines only if their parent is not a child of the MarkdownTextInputElement (a paragraph when writing or a div when pasting). // It prevents adding extra newlines when entering text text += '\n';