On 2015-05-26 10:42 AM, Jesper Kristensen wrote:
It would be much faster if I could just present a "Paste data" or
"Upload from clipboard" button, which could load the data from the
clipboard directly into a JavaScript string without first trying to
render it. I feel that doing this by handling the paste event on a text
area would be a confusing user experience, since you would have a
visible text area that would not work when you type into it, and it
looks like you would see your text when you paste, but you won't. So I
believe I need to trigger the paste event when the user clicks a button
in order to do this.

Your use case is the intended use of the paste event and doesn't require a separate button.

The following, for example, pastes only the first letter of the text on the clipboard:

<input onpaste="this.value = event.clipboardData.getData('text/plain')[0]; event.preventDefault()">


What you can't do though is have two separate types of pastes, such as a normal Paste and a Paste Without Formatting type of option, although you could workaround this with a toggle that needs to be clicked first.


_______________________________________________
dev-platform mailing list
dev-platform@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-platform

Reply via email to