feat: add APIs to enable/disable spell checker (#26276)

* feat: add APIs to enable/disable bulitin spell checker

* feat: add togglespellchecker menu item role
This commit is contained in:
Cheng Zhao 2020-11-12 00:29:18 +09:00 committed by GitHub
parent f77b56e926
commit bb3fb548d8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 97 additions and 5 deletions

View file

@ -88,6 +88,7 @@ The `role` property can have following values:
* `resetZoom` - Reset the focused page's zoom level to the original size.
* `zoomIn` - Zoom in the focused page by 10%.
* `zoomOut` - Zoom out the focused page by 10%.
* `toggleSpellChecker` - Enable/disable builtin spell checker.
* `fileMenu` - Whole default "File" menu (Close / Quit)
* `editMenu` - Whole default "Edit" menu (Undo, Copy, etc.).
* `viewMenu` - Whole default "View" menu (Reload, Toggle Developer Tools, etc.)

View file

@ -673,6 +673,16 @@ this session just before normal `preload` scripts run.
Returns `String[]` an array of paths to preload scripts that have been
registered.
#### `ses.setSpellCheckerEnabled(enable)`
* `enable` Boolean
Sets whether to enable the builtin spell checker.
#### `ses.isSpellCheckerEnabled()`
Returns `Boolean` - Whether the builtin spell checker is enabled.
#### `ses.setSpellCheckerLanguages(languages)`
* `languages` String[] - An array of language codes to enable the spellchecker for.
@ -803,6 +813,10 @@ The following properties are available on instances of `Session`:
A `String[]` array which consists of all the known available spell checker languages. Providing a language
code to the `setSpellCheckerLanguages` API that isn't in this array will result in an error.
#### `ses.spellCheckerEnabled`
A `Boolean` indicating whether builtin spell checker is enabled.
#### `ses.cookies` _Readonly_
A [`Cookies`](cookies.md) object for this session.