Skip to content

Commit

Permalink
Fix: update contentSelection ref after text change (#370)
Browse files Browse the repository at this point in the history
Signed-off-by: dominictb <[email protected]>
  • Loading branch information
dominictb authored Jun 7, 2024
1 parent 29727d6 commit b857713
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 b857713

Please sign in to comment.