From ed5e9c58a18658d73317f38a933f97063038ced6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Ska=C5=82ka?= Date: Mon, 2 Sep 2024 14:16:06 +0200 Subject: [PATCH] Fix cursor position on pasting inline image preview --- src/web/utils/treeUtils.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/web/utils/treeUtils.ts b/src/web/utils/treeUtils.ts index 0841ec37..190d75ec 100644 --- a/src/web/utils/treeUtils.ts +++ b/src/web/utils/treeUtils.ts @@ -21,7 +21,7 @@ function addNodeToTree(element: HTMLMarkdownElement, parentTreeNode: TreeNode, t const lastParentChild = parentTreeNode.childNodes[parentChildrenCount - 1]; if (lastParentChild) { startIndex = lastParentChild.start + lastParentChild.length; - startIndex += lastParentChild.isGeneratingNewline || element.style.display === 'block' ? 1 : 0; + startIndex += lastParentChild.isGeneratingNewline || (type !== 'block' && element.style.display === 'block') ? 1 : 0; } }