sakusaku3939 / DeepLAndroid

Unofficial Android App for DeepL Translator
MIT License
342 stars 19 forks source link

The text copy does not work #23

Closed KoumiCZ closed 2 years ago

KoumiCZ commented 3 years ago

Hello, the text copy function does not work in the app if I use the translation function from a third app, see the first screenshot. When I click on the copy text button, see the second screenshot, the translated text is not copied. The clipboard remains empty.

Screenshot_20210704-224018_Edge

Screenshot_20210704-223412_DeepL

sakusaku3939 commented 3 years ago

After a lot of testing, I found that the click event is not being called on the JavaScript until some additional text is entered when it is launched from the URL parameter. (Click events on other elements are detectable.) My guess is that the copy button is not enabled between the time it is launched and when the text is typed. 💭

However, if you use a browser and navigate to the site with the URL parameter included, the copy button works, so I think it is theoretically possible. I still need to verify the code on the DeepL server a bit more, so it may take some time to resolve this...

P.S. It turned out that the click listener was not working because I had set $('.lmt__translations_as_text__copy_button').on('click') before the copy button was displayed.

fm-sys commented 2 years ago

I'm also affected by this bug. For me it does never work, even when I type the text manually.

sakusaku3939 commented 2 years ago

Good news! After changing the code to reconfigure the click listener every time a copy button is generated, this bug no longer occurs.

This change will be incorporated into v7.1 in the near future. :tada:

sakusaku3939 commented 2 years ago

v7.1 has been released! If you are using F-Droid, it may take a few days for the update to arrive. https://github.com/sakusaku3939/DeepLAndroid/releases/tag/v7.1

If it occurs again, please reopen this issue.