KartikTalwar / gmail.js

Gmail JavaScript API
MIT License
3.74k stars 455 forks source link

compose.bcc() not working #712

Open markon1 opened 2 years ago

markon1 commented 2 years ago

I'm trying to read bcc from compose, but it gives this error:


TypeError: Cannot read properties of undefined (reading 'focus')
    at _0x5c1229.<computed>.<computed>.<computed> [as trigger_address] (gmailJsLoader.js:1:322215)
    at _0x5c1229.<computed>.<computed>.bcc (gmailJsLoader.js:1:325624)
josteink commented 2 years ago

This may be related to a change introduced in 1.0.15.

Can you take a look @huksley ?

markon1 commented 2 years ago

Any news? Some hotfix maybe? My app is broken with this..

josteink commented 2 years ago

Have you tried latest version from Git master?

I recently merged a PR which may have helped with this issue: https://github.com/KartikTalwar/gmail.js/pull/714

josteink commented 2 years ago

If that works for you, I can push a new release to npm.

markon1 commented 2 years ago

thanks @josteink but with this version when I try adding bcc, first bcc I add is fine, but it's not "clicked" (confirmed) automatically, so if I try adding next bcc, it doesn't work, it expects me to confirm first bcc I added, so it look like this if I click on bcc button in gmail: image

josteink commented 2 years ago

Could you look at this, @onestep ? It's "your code" after all :)

markon1 commented 2 years ago

Any updates on this? @onestep

onestep commented 1 year ago

Hello @josteink, we've worked this around with custom click triggers in own code. 🙂 Not sure if it is ready for general usage, as it's quite hacky (setTimeout() usage, mutation observers and so on). And i'm not sure if it covers bcc as well - I remember that we've fixed it for to. If I will have time, I'll try to include it in some clean way in gmail.js.

onestep commented 1 year ago

Looking at our code, we've changed this: e.to(params.to); To this: e.to(params.to)[0].dispatchEvent(new KeyboardEvent('keydown', { keyCode: 13, which: 13 })); Hope this helps.

The code with observers and setTimeout's was needed to wait for compose window to be completely loaded - in PackageKit recipient inputs are changed upon load. We have a case when we need to open compose window with prefilled recipients, and it did not work until we wait for the window to be ready.

josteink commented 1 year ago

Doesn't sound much worse than the code we have now.

If you can prepare a PR, I'll be happy to review it.