Skip to content

Commit

Permalink
Fix undoing pasted text into the input (#266)
Browse files Browse the repository at this point in the history
  • Loading branch information
BartoszGrajdek authored Apr 8, 2024
1 parent c759557 commit d154993
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/MarkdownTextInput.web.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -546,6 +546,15 @@ const MarkdownTextInput = React.forwardRef<TextInput, MarkdownTextInputProps>(
updateSelection(null, {start: selection.start, end: selection.end || selection.start});
}, [selection, updateSelection]);

useEffect(() => {
if (history.current?.history.length !== 0) {
return;
}
const currentValue = value ?? '';
history.current.add(currentValue, currentValue.length);
// eslint-disable-next-line react-hooks/exhaustive-deps
}, []);

return (
// eslint-disable-next-line jsx-a11y/no-static-element-interactions
<div
Expand Down

0 comments on commit d154993

Please sign in to comment.