-
Notifications
You must be signed in to change notification settings - Fork 840
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
GH-1085 Replace simple-spellchecker with electron-spellchecker #1128
Conversation
@deanwhillier Next step will be to see if adding language switching via context menu is possible or not too much of a hack 😁 . If not would like to get input on whether or not the team would like to add language selection as a setting or to keep the current implementation with simple-spellchecker. It seems being able to switch languages automatically is best, via context menu next best, and via a setting as the least desirable option but that is a personal opinion and would like feedback on whether the benefits of electron-spellcheck outweigh the slight regression. |
@keithcruz +1 for only one package.json data structure. This has been discussed one year ago with yuya-oc who didn't have time to implement such a refactorisation. If you think this will help, please go for it =) |
This issue has been automatically labelled "stale" because it hasn't had recent activity. /cc @jasonblais @hanzei |
@deanwhillier @jasonblais apologies for the lack of activity, I will have an update on this soon. Thanks. |
@keithcruz, I'm open to automatic language switching, but wonder if a backup setting would be good in case someone really wants a different language than their OS. I don't think language selection from the context menu is necessary at all! Open to others thoughts on this! @devinbinnie, @Willyfrog, can you guys please take some time over the next bit to start reviewing this PR? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see the context menu has changed, I think it probably improved, but we might want to have a PM/UX review that.
Regarding language detection we should probably try and take advantage of provideHintText
if we can
I suggested to have a setting for the default language of the user (or revert to the original option of having the context menu on it), but I'm open to alternatives. while I like to have autodetection, we should also have a way for the user to select by themselves in case it fails (and maybe users might want to turn autodetect off)
@@ -154,18 +152,6 @@ export default class MattermostView extends React.Component { | |||
webview.blur(); | |||
webview.focus(); | |||
} | |||
if (!this.state.isContextMenuAdded) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
removing this would remove any menu associated?
window.spellCheckHandler = new SpellCheckHandler(); | ||
window.spellCheckHandler.attachToInput(); | ||
|
||
window.spellCheckHandler.switchLanguage('en-US'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm guessing this is not final, right?
window.spellCheckHandler.switchLanguage('en-US'); | ||
|
||
const contextMenuBuilder = new ContextMenuBuilder(window.spellCheckHandler); | ||
/* eslint-disable-next-line no-unused-vars */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is there a reason to create a listener and not attaching it somewhere?
"auto-launch": "^5.0.5", | ||
"bootstrap": "^3.3.7", | ||
"cld": "^2.5.1", | ||
"electron-context-menu": "^0.15.0", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if we are not using this anymore, it should be removed too.
@@ -45,6 +46,17 @@ window.addEventListener('load', () => { | |||
watchReactAppUntilInitialized(() => { | |||
ipcRenderer.sendToHost('onGuestInitialized', window.basename); | |||
}); | |||
|
|||
window.spellCheckHandler = new SpellCheckHandler(); | |||
window.spellCheckHandler.attachToInput(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we should consider if config.useSpellChecker
is set
|
||
const contextMenuBuilder = new ContextMenuBuilder(window.spellCheckHandler); | ||
/* eslint-disable-next-line no-unused-vars */ | ||
const contextMenuListener = new ContextMenuListener((info) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
are we going to use this? we shouldn't disable eslint warnings/errors unless we have a very good reason to do so.
window.spellCheckHandler = new SpellCheckHandler(); | ||
window.spellCheckHandler.attachToInput(); | ||
|
||
window.spellCheckHandler.switchLanguage('en-US'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we should add a configurable default on the settings page and use that as the base
This issue has been automatically labelled "stale" because it hasn't had recent activity. /cc @jasonblais @hanzei |
@keithcruz let me know if you need clarification or any help with this |
@Willyfrog, given we are looking into the new Spellchecker that comes with Electron v8 (or v7, can't remember exactly off hand), should we wait to determine if it will work as we need before abandoning this approach? |
definitely, my initial tests shows that it works as basic spellchecker, but I have yet to test the "add new spelling" feature, which requires using browserview, as it is difficult to add to a webview tag. |
Closing as we are moving towards using the integrated spell checker in Electron 8. |
Before submitting, please confirm you've
npm run lint:js
for proper code formattingPlease provide the following information:
Summary
This is a WIP that replaces simple-spellchecker with electron-spellchecker.
Issue link
GH-1085
Test Cases
Additional Notes
Some initial findings: