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

Add a way to detect whether the clipboard can be used in HTML5 #5430

Open
bend-n opened this issue Sep 16, 2022 · 4 comments
Open

Add a way to detect whether the clipboard can be used in HTML5 #5430

bend-n opened this issue Sep 16, 2022 · 4 comments

Comments

@bend-n
Copy link

bend-n commented Sep 16, 2022

Describe the project you are working on

A multiplayer chess project in which you can copy PGNs to the clipboard.

Describe the problem or limitation you are having in your project

On chrome, if your project is embedded inside a iframe, it will not have access to the clipboard api by default[1].

I need to know if that is the case, so I can provide a better way to write down the pgn.

Describe the feature / enhancement and how it helps to overcome the problem or limitation

A feature tag if the clipboard is usable.

Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams

if OS.has_feature("clipboard"):
  OS.clipboard = "1. e4"
else:
  draw_text("1. e4")

If this enhancement will not be used often, can it be worked around with a few lines of script?

Yes, you can do a JavaScript.eval, but its not very easy, and isn't cross platform.

Is there a reason why this should be core and not an add-on in the asset library?

core.

@dalexeev
Copy link
Member

It seems to me that this should be an OS method (like OS.is_userfs_persistent) and not a feature tag, since this trait is unlikely to be used often for overriding settings and the like.

@bend-n
Copy link
Author

bend-n commented Sep 16, 2022

@YuriSizov Is it platform dependent? Are not there other platforms in which the clipboard is inaccessible?

@YuriSizov
Copy link
Contributor

As far as I know, this is only a major limitation on web due to web's security concerns. But more importantly, this is what your proposal tells us.

@Calinou Calinou changed the title Clipboard feature tag. Add a way to detect whether the clipboard can be used in HTML5 Sep 16, 2022
@Mickeon
Copy link

Mickeon commented Sep 16, 2022

I agree on the sentiment but not on the solution. The default tags included in the engine are based on what they're built for. "clipboard" doesn't fit. It would be better as a function, so that it may be properly described, as well.

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