Skip to content
This repository has been archived by the owner on Apr 8, 2021. It is now read-only.

Commit

Permalink
Add support for Electron 5 and above
Browse files Browse the repository at this point in the history
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 electron-userland#144.
  • Loading branch information
mlalkaka committed Jun 11, 2019
1 parent 82ad22c commit 276ae24
Showing 1 changed file with 0 additions and 4 deletions.
4 changes: 0 additions & 4 deletions src/spell-check-handler.js
Original file line number Diff line number Diff line change
Expand Up @@ -465,14 +465,10 @@ module.exports = class SpellCheckHandler {
*/
setSpellCheckProvider(webFrame) {
if (process.versions.electron >= '5.0.0') {
d('DEBUG: Setting provider for Electron 5');
// Electron 5 and above:
webFrame.setSpellCheckProvider(
this.currentSpellcheckerLanguage,
{ spellCheck: this.handleElectronSpellCheck.bind(this) });
} else {
d('DEBUG: Setting provider for Electron 4');
// Electron 4 and below:
webFrame.setSpellCheckProvider(
this.currentSpellcheckerLanguage,
this.shouldAutoCorrect,
Expand Down

0 comments on commit 276ae24

Please sign in to comment.