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

using the spell checker to replace a misspelled word crashes electronjs. #137

Closed
williamstein opened this issue Apr 25, 2021 · 2 comments · Fixed by #138
Closed

using the spell checker to replace a misspelled word crashes electronjs. #137

williamstein opened this issue Apr 25, 2021 · 2 comments · Fixed by #138

Comments

@williamstein
Copy link
Contributor

On MacOS, at least for my relatively simple electronjs application, any time I try to replace an incorrectly spelled word, the entire application crashes. I'm using the latest version of Electron.js as of this writing.

I made a simple one-line change in the index.js file and that completely fixed the problem, i.e., replace insertText by replaceMisspelling. Also the change of course makes a lot of sense:

		function word(suggestion) {
			return {
				id: 'dictionarySuggestions',
				label: suggestion,
				visible: Boolean(props.isEditable && hasText && props.misspelledWord),
				click(menuItem) {
					const target = webContents(win);
					//target.insertText(menuItem.label);
					target.replaceMisspelling(menuItem.label);
...

Using replaceMisspelling seems reasonable given it is what we're doing and is now part of the documented electron.js API: https://www.electronjs.org/docs/api/web-contents#contentsreplacemisspellingtext

williamstein added a commit to williamstein/electron-context-menu that referenced this issue Apr 25, 2021
@williamstein
Copy link
Contributor Author

I've made a PR: #138

@williamstein
Copy link
Contributor Author

I've also confirmed that this bug happens (for my application) on MS Windows, and that this bugfix also works there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant