From d85e69961130422950de3bb8abc50ad626b2b7ab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Ska=C5=82ka?= Date: Thu, 10 Oct 2024 09:40:00 +0200 Subject: [PATCH] Remove unused code --- src/web/utils/cursorUtils.ts | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/src/web/utils/cursorUtils.ts b/src/web/utils/cursorUtils.ts index 5e45f2e4..adc0a1b9 100644 --- a/src/web/utils/cursorUtils.ts +++ b/src/web/utils/cursorUtils.ts @@ -58,16 +58,12 @@ function scrollIntoView(target: MarkdownTextInputElement, node: TreeNode) { const currentLine = target.tree.childNodes[orderIndex]?.element; const scrollTargetElement = currentLine || node.element; - const selection = window.getSelection(); - if (selection && selection.rangeCount > 0) { - const caretRect = scrollTargetElement.getBoundingClientRect(); - const targetRect = target.getBoundingClientRect(); - - // In case the caret is below the visible input area, scroll to the end of the node - if (caretRect.top + caretRect.height > targetRect.top + targetRect.height) { - targetElement.scrollTop = caretRect.top - targetRect.top + target.scrollTop - targetRect.height + caretRect.height + 4; - return; - } + const caretRect = scrollTargetElement.getBoundingClientRect(); + const targetRect = target.getBoundingClientRect(); + // In case the caret is below the visible input area, scroll to the end of the node + if (caretRect.top + caretRect.height > targetRect.top + targetRect.height) { + targetElement.scrollTop = caretRect.top - targetRect.top + target.scrollTop - targetRect.height + caretRect.height + 4; + return; } scrollTargetElement.scrollIntoView({