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

Dashboard: Add optional hack to enable with copy/paste in NoVNC #198

Closed
ericfranz opened this issue May 9, 2019 · 2 comments · Fixed by #335
Closed

Dashboard: Add optional hack to enable with copy/paste in NoVNC #198

ericfranz opened this issue May 9, 2019 · 2 comments · Fixed by #335
Assignees

Comments

@ericfranz
Copy link
Contributor

ericfranz commented May 9, 2019

This PR novnc/noVNC#1301 works in Chrome but not Firefox. We did some extra work to make copy and paste work in Firefox in the shell app, and I think we can do the same here.

The idea would be to add this optional fix, and then give the user the option to include or exclude this hack when launching the noVNC client.

Original issue description:

This looks interesting: novnc/noVNC#509 (comment)

If we applied this, it would be interesting to see its benefits and limitations. We could provide this or something similar to a modified novnc.html and provide users with the option of which viewer they want to load (the one with the hack, the one without).

If the code as is works we should reach out to the author asking for a license (maybe make a gist with the MIT license, for example).

@ericfranz
Copy link
Contributor Author

Related work with clipboard api OSC/ood-shell#56

@MorganRodgers MorganRodgers changed the title Experiment with copy/paste hack in NoVNC Dashboard: Experiment with copy/paste hack in NoVNC Nov 12, 2019
@MorganRodgers MorganRodgers transferred this issue from OSC/ood-dashboard Nov 12, 2019
@ericfranz ericfranz changed the title Dashboard: Experiment with copy/paste hack in NoVNC Dashboard: Add optional hack to enable with copy/paste in NoVNC Dec 5, 2019
@ericfranz ericfranz assigned ericfranz and unassigned samirmansour Dec 5, 2019
@ericfranz
Copy link
Contributor Author

Adding support to Firefox will not work at this time. Using the legacy document.execCommand('copy') approach will not work because you get an error:

document.execCommand(‘cut’/‘copy’) was denied because it was not called from inside a short running user-generated event handler

This is because unlike the shell app, in NoVNC the user is interacting with the canvas, and it is a message receive event that triggers the copy to clipboard event. Since this stack is not recognized as user generated (since the stack doesn't include a user click event, for example), copy will not work without substantial work.

As for utilizing the new Async ClipboardAPI, Firefox does not yet support the 'clipboard-read' and 'clipboard-write' permissions of the Permissions API.

References:

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

Successfully merging a pull request may close this issue.

3 participants