-
Notifications
You must be signed in to change notification settings - Fork 3.9k
cut, copy, paste events handler issues #2738
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
👍 mdn defines getData for paste only i guess cut/copy falls under "ClipboardAPI: user safety restrictions" below |
i put a PR "Alternatively, the code below also prevents all such events and additionally shows what we are trying to cut/copy/paste:" I'd suggest the code comment being " // false prevents changes" both returns Your fix works, you may want to add a PR just suggestions, I'm nobody here :) |
Thank you for the suggestion, I will create a PR later. |
Thank you, a good catch! |
The cut, copy prevention demo failed to show anything for
event.clipboardData.getData('text/plain')
Change the code to the following and it will work
In addition, as mentioned above,
We can also use event.preventDefault() to abort the action
, soreturn false
code should be added with a description equivalent toevent.preventDefault()
.Related issue: javascript-tutorial/zh.javascript.info#956
The text was updated successfully, but these errors were encountered: