-
-
Save robsonsobral/6210a20e573f1866c220f88c56909d79 to your computer and use it in GitHub Desktop.
Paste onto a [contenteditable] element as plain text
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
document.querySelector('[contenteditable]').addEventListener('paste', function (event) { | |
event.preventDefault(); | |
document.execCommand('inserttext', false, event.clipboardData.getData('text/plain')); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment