The Wayback Machine - https://web.archive.org/web/20200706040134/https://github.com/electron/electron/issues/22216
Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Need Documentation on how use built-in Spellchecker for WebViews #22216

Open
Syed-Umair opened this issue Feb 16, 2020 · 4 comments
Open

Need Documentation on how use built-in Spellchecker for WebViews #22216

Syed-Umair opened this issue Feb 16, 2020 · 4 comments

Comments

@Syed-Umair
Copy link
Contributor

@Syed-Umair Syed-Umair commented Feb 16, 2020

Preflight Checklist

  • I have read the Contributing Guidelines for this project.
  • I agree to follow the Code of Conduct that this project adheres to.
  • I have searched the issue tracker for a feature request that matches the one I want to file, without success.

Problem Description

I am not able to use the built-in spellchecker feature in Electron 8.x for Webviews.

Proposed Solution

It would be great if additional documentation is provided on the Spellchecker functionality and how to use it in webviews.

@sofianguy sofianguy added this to Unsorted Issues in 8.2.x Feb 19, 2020
@Syed-Umair
Copy link
Contributor Author

@Syed-Umair Syed-Umair commented Mar 24, 2020

Hi Team,
Any updates on this one are appreciated

@zeevl
Copy link

@zeevl zeevl commented May 7, 2020

4323b6d helps.

In your main process, call setSpellCheckerLanguages with your default language(s):

session.defaultSession.setSpellCheckerLanguages(['en-US']);

Then watch for the context-menu event:

    browserWindow.webContents.on('context-menu', (event, props) => {
      // when triggered on a misspelled word:
      // props.misspelledWord will have the word
      // props.dictionarySuggestions will be an array of suggestions
    });

You can use this to build the context menu in your UI.

call session.defaultSession.addWordToSpellCheckerDictionary(word); to add a word to your dictionary.

@Syed-Umair
Copy link
Contributor Author

@Syed-Umair Syed-Umair commented May 8, 2020

@zeevl

4323b6d helps.

In your main process, call setSpellCheckerLanguages with your default language(s):

session.defaultSession.setSpellCheckerLanguages(['en-US']);

Then watch for the context-menu event:

    browserWindow.webContents.on('context-menu', (event, props) => {
      // when triggered on a misspelled word:
      // props.misspelledWord will have the word
      // props.dictionarySuggestions will be an array of suggestions
    });

You can use this to build the context menu in your UI.

call session.defaultSession.addWordToSpellCheckerDictionary(word); to add a word to your dictionary.

This works when you are trying to use the spellcheck for BrowserWindow. But I would like to integrate the spellcheck for the Webview inside the browserwindow.

@ahallicks
Copy link

@ahallicks ahallicks commented May 11, 2020

See #23363 (comment) for the apparent working example.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
4 participants
You can’t perform that action at this time.