openfl / lime

A foundational Haxe framework for cross-platform development
https://lime.openfl.org/
MIT License
753 stars 365 forks source link

Clipboard does not return text in HTML5 #1703

Closed DigiEggz closed 1 year ago

DigiEggz commented 1 year ago

When running an HTML5 javascript app, no text is returned when accessing Clipboard.text. Desktop access works properly, however.

joshtynjala commented 1 year ago

In web browsers, JavaScript is not allowed to read from the clipboard unless the user explicitly uses the Ctrl+V keyboard shortcut or selects Paste from the edit menu. This is a security restriction that we have no control over.

DigiEggz commented 1 year ago

The code is partially working. I was tracing out the value in the set_text()function of Clipboard and I can see the correct text.

If I comment out the __update() within get_text, it correctly pastes the text when I use a keyboard shortcut. I'll keep testing things out.