electron-userland / electron-spellchecker

Implement spellchecking, correctly
MIT License
238 stars 83 forks source link

Add support for Electron 5 and above #149

Closed mlalkaka closed 5 years ago

mlalkaka commented 5 years ago

Starting with Electron 5.0.0, the function webFrame.setSpellCheckProvider has a different signature, in order to support asynchronous spell checkers. For more information on this change in Electron, see electron/electron#14032.

This diff updates SpellCheckHandler to use the new interface if running on Electron 5.0.0 and above. However, it still checks the spelling synchronously like before.

If running on Electron versions below 5.0.0, the SpellCheckHandler still works.

Closes #144.

rickharris commented 5 years ago

Tested this branch on Abstract's electron app in electron 5, and it's confirmed working. Thanks @mlalkaka!

felixrieseberg commented 5 years ago

Thank you very much!

aabuhijleh commented 5 years ago

Thank you @mlalkaka.

Though, I found out that spell checking is not working on Windows because in the SpellCheckProvider function handleElectronSpellCheck(words, callback), the callback is never called on Windows and hence no squiggly red lines will appear.

It's only called on macOS. I simply added callback(misspelled); to the bottom of the function and it worked properly.