Browse Source

fix: remove redundant selectionStart/End resetting that causes scroll-reset bug on firefox (#8263)

Remove redundant selectionStart/End resetting that causes scroll-reset bug on firefox
pull/10104/merge
Omar Brikaa 2 months ago committed by GitHub
parent
commit
19b03b4ca9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 16
      packages/excalidraw/wysiwyg/textWysiwyg.tsx

16
packages/excalidraw/wysiwyg/textWysiwyg.tsx

@ -226,22 +226,6 @@ export const textWysiwyg = ({ @@ -226,22 +226,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;

Loading…
Cancel
Save