From 8048a9acdad355c6a80885aa7f59ddf88428b3d9 Mon Sep 17 00:00:00 2001 From: Omar Brikaa Date: Sun, 21 Jul 2024 19:52:49 +0300 Subject: [PATCH] Remove redundant selectionStart/End resetting that causes scroll-reset bug on firefox --- packages/excalidraw/element/textWysiwyg.tsx | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/packages/excalidraw/element/textWysiwyg.tsx b/packages/excalidraw/element/textWysiwyg.tsx index 5093a2624c..26e5c17f4f 100644 --- a/packages/excalidraw/element/textWysiwyg.tsx +++ b/packages/excalidraw/element/textWysiwyg.tsx @@ -212,22 +212,6 @@ export const textWysiwyg = ({ } } const [viewportX, viewportY] = getViewportCoords(coordX, coordY); - const initialSelectionStart = editable.selectionStart; - const initialSelectionEnd = editable.selectionEnd; - const initialLength = editable.value.length; - - // restore cursor position after value updated so it doesn't - // go to the end of text when container auto expanded - if ( - initialSelectionStart === initialSelectionEnd && - initialSelectionEnd !== initialLength - ) { - // get diff between length and selection end and shift - // the cursor by "diff" times to position correctly - const diff = initialLength - initialSelectionEnd; - editable.selectionStart = editable.value.length - diff; - editable.selectionEnd = editable.value.length - diff; - } if (!container) { maxWidth = (appState.width - 8 - viewportX) / appState.zoom.value;