Skip to content

Commit

Permalink
Remove ignore eslint comment
Browse files Browse the repository at this point in the history
  • Loading branch information
Skalakid committed Apr 19, 2024
1 parent e6c6fb0 commit 451302d
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/MarkdownTextInput.web.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -580,11 +580,12 @@ const MarkdownTextInput = React.forwardRef<TextInput, MarkdownTextInputProps>(
if (!divRef.current || !selection || (contentSelection.current && selection.start === contentSelection.current.start && selection.end === contentSelection.current.end)) {
return;
}
updateSelection(null, {start: selection.start, end: selection.end || selection.start});
CursorUtils.setCursorPosition(divRef.current, selection.start, selection.end);
// we need to update the selection only when the selection prop changes, so it won't interfere with updating cursor position when typing
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [selection]);

const newSelection: Selection = {start: selection.start, end: selection.end ?? selection.start};
contentSelection.current = newSelection;
updateRefSelectionVariables(newSelection);
CursorUtils.setCursorPosition(divRef.current, newSelection.start, newSelection.end);
}, [selection, updateRefSelectionVariables]);

useEffect(() => {
if (history.current?.history.length !== 0) {
Expand Down

0 comments on commit 451302d

Please sign in to comment.