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

Spell check doesn't work on load #28

Open
kofifus opened this issue Jul 15, 2016 · 4 comments
Open

Spell check doesn't work on load #28

kofifus opened this issue Jul 15, 2016 · 4 comments
Labels

Comments

@kofifus
Copy link

kofifus commented Jul 15, 2016

when loading an initial text into CM with cm.setValue(), how can I run the spellchecker on it ?

thx!

@WesCossick
Copy link
Member

Due to the way CodeMirror works, you must begin typing to trigger the spell checker.

@kofifus
Copy link
Author

kofifus commented Jul 16, 2016

the issue is that you load the dictionaries asynchronously in definemode which results in the first iteration triggered by CM happening before they finished loading.

I reworked your code to wait for the dicts to load see - https://plnkr.co/edit/O412xuNyBMbUqX6U5qUH?p=preview

@WesCossick
Copy link
Member

If that's the case, I'd be open to a PR that fixes the bug.

@WesCossick WesCossick reopened this Jul 18, 2016
@WesCossick WesCossick added the bug label Jul 18, 2016
@WesCossick WesCossick changed the title spell check text after loading Spell check doesn't work on load Jul 18, 2016
@kofifus
Copy link
Author

kofifus commented Jul 19, 2016

I ended up with a better solution, there is no need to create an overlay mode, instead I use addOverlay and issue it only after the dictionaries loaded. This greatly simplifies the code and gets the initial text checked (no need for overlay.js)

see plunkr

Basically this is a complete rewrite so not sure if a PR is the right thing to do, but you can get the code from there.

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

No branches or pull requests

2 participants