File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -754,7 +754,7 @@ export default class Editor {
754754 placeholder : "← Start by entering a title here\n===\nVisit /features if you don't know what to do.\nHappy hacking :)"
755755 } )
756756
757- this . spellchecker = new CodeMirrorSpellChecker ( CodeMirror , this . getExistingSpellcheckLang ( ) )
757+ this . spellchecker = new CodeMirrorSpellChecker ( CodeMirror , this . getExistingSpellcheckLang ( ) , this . editor )
758758 this . tableEditor = initTableEditor ( this . editor )
759759
760760 return this . editor
Original file line number Diff line number Diff line change @@ -145,7 +145,7 @@ class CodeMirrorSpellChecker {
145145 * @param {CodeMirror } cm
146146 * @param {string } lang
147147 */
148- constructor ( cm , lang ) {
148+ constructor ( cm , lang , editor ) {
149149 // Verify
150150 if ( typeof cm !== 'function' || typeof cm . defineMode !== 'function' ) {
151151 console . log (
@@ -156,17 +156,24 @@ class CodeMirrorSpellChecker {
156156
157157 this . typo = undefined
158158 this . defineSpellCheckerMode ( cm , lang )
159+ this . editor = editor
159160 }
160161
161162 setDictLang ( lang ) {
162- findOrCreateTypoInstance ( lang ) . then ( typo => { this . typo = typo } )
163+ findOrCreateTypoInstance ( lang ) . then ( typo => {
164+ this . typo = typo
165+
166+ // re-enable overlay mode to refresh spellcheck
167+ this . editor . setOption ( 'mode' , 'gfm' )
168+ this . editor . setOption ( 'mode' , 'spell-checker' )
169+ } )
163170 }
164171
165172 defineSpellCheckerMode ( cm , lang ) {
166- cm . defineMode ( 'spell-checker' , config => {
167- // Load AFF/DIC data async
168- this . setDictLang ( lang )
173+ // Load AFF/DIC data async ASAP
174+ this . setDictLang ( lang )
169175
176+ cm . defineMode ( 'spell-checker' , config => {
170177 // Define what separates a word
171178 const regexWord = '!"#$%&()*+,-./:;<=>?@[\\]^_`{|}~ '
172179
You can’t perform that action at this time.
0 commit comments