Skip to content

Commit

Permalink
Add showLearnSpelling option (#157)
Browse files Browse the repository at this point in the history
  • Loading branch information
iongion committed Jun 10, 2022
1 parent ac00d0f commit 3bb622a
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 5 deletions.
14 changes: 12 additions & 2 deletions index.d.ts
Expand Up @@ -139,14 +139,23 @@ declare namespace contextMenu {
) => MenuItemConstructorOptions[];

/**
Show the `Look Up {selection}` menu item when right-clicking text on macOS.
Show the `Learn Spelling {selection}` menu item when right-clicking text.
Even if `true`, the `spellcheck` preference in browser window must still be enabled. It will also only show when right-clicking misspelled words.
@default true
*/
readonly showLearnSpelling?: boolean;

/**
Show the `Look Up {selection}` menu item when right-clicking text.
@default true
*/
readonly showLookUpSelection?: boolean;

/**
Show the `Search with Google` menu item when right-clicking text on macOS.
Show the `Search with Google` menu item when right-clicking text.
@default true
*/
Expand Down Expand Up @@ -254,6 +263,7 @@ declare namespace contextMenu {
The following options are ignored when `menu` is used:
- `showLearnSpelling`
- `showLookUpSelection`
- `showSearchWithGoogle`
- `showCopyImage`
Expand Down
2 changes: 1 addition & 1 deletion index.js
Expand Up @@ -231,7 +231,7 @@ const create = (win, options) => {
dictionarySuggestions.length > 0 && defaultActions.separator(),
...dictionarySuggestions,
defaultActions.separator(),
defaultActions.learnSpelling(),
options.showLearnSpelling !== false && defaultActions.learnSpelling(),
defaultActions.separator(),
options.showLookUpSelection !== false && defaultActions.lookUpSelection(),
defaultActions.separator(),
Expand Down
13 changes: 11 additions & 2 deletions readme.md
Expand Up @@ -120,19 +120,28 @@ The first argument is an array of default actions that can be used. The second a

`MenuItem` labels may contain the placeholder `{selection}` which will be replaced by the currently selected text as described in [`options.labels`](#labels).

#### showLearnSpelling

Type: `boolean`\
Default: `true`

Show the `Learn Spelling {selection}` menu item when right-clicking text.

Even if `true`, the `spellcheck` preference in browser window must still be enabled. It will also only show when right-clicking misspelled words.

#### showLookUpSelection

Type: `boolean`\
Default: `true`

Show the `Look Up {selection}` menu item when right-clicking text on macOS.
Show the `Look Up {selection}` menu item when right-clicking text.

#### showSearchWithGoogle

Type: `boolean`\
Default: `true`

Show the `Search with Google` menu item when right-clicking text on macOS.
Show the `Search with Google` menu item when right-clicking text.

#### showCopyImage

Expand Down

0 comments on commit 3bb622a

Please sign in to comment.