Last active
July 30, 2025 19:26
-
-
Save michaelwestphal/b081847a0c03601813b6ccec5e9c2486 to your computer and use it in GitHub Desktop.
Re-enable paste
This file contains hidden or 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
| // | |
| // For when those pesky sites decide that you shouldn't be allowed to paste into an input... | |
| // | |
| // https://developer.mozilla.org/en-US/docs/Web/API/Element/paste_event | |
| document.addEventListener('paste', (e) => { | |
| e.stopImmediatePropagation(); | |
| return true; | |
| }, true); | |
| // Ditto: copy | |
| // https://developer.mozilla.org/en-US/docs/Web/API/Element/copy_event | |
| document.addEventListener('copy', (e) => { | |
| e.stopImmediatePropagation(); | |
| return true; | |
| }, true); | |
| // Documentation: | |
| // https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/addEventListener | |
| // https://developer.mozilla.org/en-US/docs/Web/API/Event/stopImmediatePropagation |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment