-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
Add experimental spellchecker #1424
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
Conversation
11d8380
to
1f43da4
Compare
@Jocs Could you please test the PR on macOS? Above are some areas to test for and please run |
Great work, I'll test it this evening or tomorrow. |
* @param {string} replacement The replacement. | ||
* @param {boolean} setCursor Shoud we update the editor cursor? | ||
*/ | ||
replaceWordInline (line, wordCursor, replacement, setCursor = false) { |
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 prefer put this method on ContentState.prototype
, for example create a file name spellCheckerCtrl.js
.
ContentState.prototype. replaceWordInline = function () {}
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.
That's actually a good idea but for a high level API or Muya API to transform lines. Do you have any ideas where to add the API interface?
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.
The API interface need to put on the muya instance,
Muya {
replaceWordInline (...args) {return this.contentState. replaceWordInline(...args)}
}
is it ok?
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.
How about to add a core
contentState
class/file with all basic editor operations like replace, add line, remove line, etc? So we could easily integrate the operation with the interface.
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.
How about to add a core contentState class/file with all basic editor operations like replace, add line, remove line, etc? So we could easily integrate the operation with the interface.
Yeh, we need to abstract some operations, and then add them when optimizing muya.
@fxha I'll take a full detail code review tomorrow. |
BTW, I love this feature, because I always make typo. |
Use experience as new user
Development question?
|
Open questions:
I prefer disable this Should we also (try) to integrate CodeMirror spell checking? Does CodeMirror has spell checking? |
When |
👍
When you use the OS spell checker, right? That means you OS support two English dictionaries that we cannot assign to a nation (e.g. en-US, en-GB, en-AU, ...). I'll add the 4-letter ISO code behind the language when we cannot map it exactly.
👍
That's only for development for this PR because I changed/modified a lot of the original code. I'll move our version of electron-spellchecker to another repository and npm when all changes are done.
I just did a quick reseach but we could try to integrate it to our spellcheck wrapper. It should be possible, maybe improvement for later. |
@Jocs Could you please test again. If the exception still occurs, please post the stack trace from dev tools or log file. Could you also verify whether a |
👍
👍 |
I can not reproduce it now.
Yes, there is a dictionaries/en-US.bdic file is located in your application data directory. |
1aee166
to
733ec71
Compare
@Jocs I pushed |
0e579b7
to
e0f172c
Compare
Description
This PR should implement an experimental spell checker to correct misspelled words. An advanced checker like LanguageTool (grammar, spelling and punctuation checker) would have to be integrated with Muya.
yarn add file:packages/electron-spellchecker
between commits to update the package without increasing version numberChromium's version of Hunspell is used on Linux and Windows and on macOS the OS spell checker is used by default. Hunspell can be used on macOS but is completely untested.
NOTE:
node-spellcheker
uses Chromium's version of Hunspell that is licensed under GPL, LGPL or MPL (by choice). Chosen LGPL requires us to "dynamic link" the native library, so the user can replace the library.Checklist:
node-spellcheker
is dynamic linkednode-spellcheker
can be replaced by the user on disk and is not bundled inside.asar
vendor
folder with GPL/LGPL/MPL codeTodo:
-
Testing:
Invalid Test Value
as language via settings and test spell checker behavior. Is there a warning that the dict was not found? Can you still use the spell checker? AreSpelling... -> Debug
information right? @JocsFeature:
Improvements:
node-spellchecker
improvements/changes:node-spellchecker
asynchronous in threads: (rebase from atom upstream)Known issues:
General settings:
Hunspell only settings: