Skip to content
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

Investigate integration with Clipboard API #1

Open
tim-evans opened this issue Apr 5, 2016 · 2 comments
Open

Investigate integration with Clipboard API #1

tim-evans opened this issue Apr 5, 2016 · 2 comments

Comments

@tim-evans
Copy link
Collaborator

Investigate hooking into paste events in browsers and allowing users to disable this feature if they would like to.

See https://developer.mozilla.org/en-US/docs/Web/API/ClipboardEvent

tim-evans pushed a commit that referenced this issue Oct 13, 2016
@jelhan
Copy link
Collaborator

jelhan commented Mar 14, 2020

I'm not sure how this is expected to work:

  • What would be the expected and supported ClipboardEvent.clipboardData? I think it must be a File or a Blob cause reading a file from disk by provided path is not supported in Browser due to security concerns as far as I know.
  • What element should listen for the paste event? The dropzone and file input? This would mean that the user must first focus them before pasting. Not sure if that's an intuitive user experience.
  • Is there any default behavior if a user pastes to a file input?

A proof of concept would be great before starting actual implementation. Just in case someone wants to pick this one up. 😄

@gilest
Copy link
Collaborator

gilest commented Mar 14, 2020

Had a look on MDN:

  • Can listen for a paste event on window, document, or element (for good UX I think window/document listening makes sense)
  • Paste event is a ClipboardEvent
  • ClipboardEvent has clipboardData property which is a DataTransfer object
  • DataTransfer has getAsFile which returns an HTML5 File object

What should the API for this be though?

Perhaps configurable on the helper/service and disabled by default

Would be worth bundling a feature like this in with major changes like in #316 to reduce API churn

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants