Skip to content

Instantly share code, notes, and snippets.

@ShanonJackson
Last active May 9, 2020 01:57
Show Gist options
  • Save ShanonJackson/1eab9143eae9c59da5d5c9e7e57ac773 to your computer and use it in GitHub Desktop.
Save ShanonJackson/1eab9143eae9c59da5d5c9e7e57ac773 to your computer and use it in GitHub Desktop.
const onPaste: React.ClipboardEventHandler = (e) => {
e.preventDefault(); /* Prevent the DOM Paste */
// replace linebreaks
insertString(e.clipboardData.getData("text/plain").replace(/\r?\n|\r/g, ""));
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment