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

Clipboard API support #109

Open
mweiss opened this issue Apr 9, 2020 · 0 comments
Open

Clipboard API support #109

mweiss opened this issue Apr 9, 2020 · 0 comments

Comments

@mweiss
Copy link

mweiss commented Apr 9, 2020

Some clipboard functions require synchronous access to methods, like on the copy event using clipboardData.setData or the paste event and clipboardData.getData. If I handle the copy event in Elm and use a port from Elm to JS, it won't be handled synchronously by js. If I handle the copy event in a custom element in js, I run into the same issue trying to get the data back to JS (e.g. there's no two way synchronization technique that I know of). I think one workaround to this would be to add clipboard API support to the Browser.Events module and/or add specialized onCopy and onPaste functions to Html.Events module.

Note that one workaround for getting clipboard data on the paste event was to use a custom element to listen to the event, then using a custom event with the types of data I wanted (e.g. clipboardData.getData('text/html')), dispatching that, and then handling the event in Elm. You can see it here: https://github.com/mweiss/elm-rte-toolkit/blob/1.0.1/js/elmEditor.js#L303

However, I do not know of a corresponding solution to clipboardData.setData.

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

No branches or pull requests

1 participant