From a7222360e5b53bfd21f639b140d4d975972fcae5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Ska=C5=82ka?= Date: Fri, 6 Sep 2024 13:03:28 +0200 Subject: [PATCH] Remove unnecessary code --- src/web/utils/parserUtils.ts | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/web/utils/parserUtils.ts b/src/web/utils/parserUtils.ts index d1a7c6e8..187e9eb3 100644 --- a/src/web/utils/parserUtils.ts +++ b/src/web/utils/parserUtils.ts @@ -247,10 +247,6 @@ function moveCursor(isFocused: boolean, alwaysMoveCursorToTheEnd: boolean, curso } } -function normalizeHTMLStructure(target: MarkdownTextInputElement) { - return target.innerHTML.split('z-index: 1;').join('').split(' style=""').join(''); -} - function updateInputStructure( target: MarkdownTextInputElement, text: string, @@ -278,14 +274,15 @@ function updateInputStructure( if (text) { const {dom, tree} = parseRangesToHTMLNodes(text, markdownRanges, markdownStyle); - if (shouldForceDOMUpdate || normalizeHTMLStructure(targetElement) !== dom.innerHTML) { + if (shouldForceDOMUpdate || targetElement.innerHTML !== dom.innerHTML) { targetElement.innerHTML = ''; targetElement.innerText = ''; targetElement.innerHTML = dom.innerHTML; } - targetElement.tree = tree; updateTreeElementRefs(tree, targetElement); + targetElement.tree = tree; + moveCursor(isFocused, alwaysMoveCursorToTheEnd, cursorPosition, targetElement); }