Skip to content

Commit

Permalink
fix: update contentSelection ref after text change
Browse files Browse the repository at this point in the history
Signed-off-by: dominictb <[email protected]>
  • Loading branch information
dominictb committed Jun 7, 2024
1 parent ac5d508 commit 6f0b3fe
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/MarkdownTextInput.web.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -363,6 +363,12 @@ const MarkdownTextInput = React.forwardRef<TextInput, MarkdownTextInputProps>(
default:
text = parseText(divRef.current, changedText, processedMarkdownStyle).text;
}

const selectionAfterTextChange = CursorUtils.getCurrentCursorPosition(divRef.current);
if (selectionAfterTextChange) {
contentSelection.current = selectionAfterTextChange;
}

if (pasteRef?.current) {
pasteRef.current = false;
updateSelection(e);
Expand Down

0 comments on commit 6f0b3fe

Please sign in to comment.