Skip to content

Commit 526b5d0

Browse files
committed
Expose setDictLang method
Signed-off-by: Yukai Huang <[email protected]>
1 parent bc3fe7c commit 526b5d0

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

public/js/lib/editor/index.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -724,8 +724,7 @@ export default class Editor {
724724
placeholder: "← Start by entering a title here\n===\nVisit /features if you don't know what to do.\nHappy hacking :)"
725725
})
726726

727-
// eslint-disable-next-line
728-
new CodeMirrorSpellChecker(CodeMirror)
727+
this.spellchecker = new CodeMirrorSpellChecker(CodeMirror)
729728
this.tableEditor = initTableEditor(this.editor)
730729

731730
return this.editor

public/js/lib/editor/spellcheck.js

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,13 +77,17 @@ class CodeMirrorSpellChecker {
7777
}
7878

7979
this.typo = undefined
80-
this.setupCM(cm, lang)
80+
this.defineSpellCheckerMode(cm, lang)
8181
}
8282

83-
setupCM (cm, lang) {
83+
setDictLang (lang) {
84+
findOrCreateTypoInstance(lang).then(typo => { this.typo = typo })
85+
}
86+
87+
defineSpellCheckerMode (cm, lang) {
8488
cm.defineMode('spell-checker', config => {
8589
// Load AFF/DIC data async
86-
findOrCreateTypoInstance(lang).then(typo => { this.typo = typo })
90+
this.setDictLang(lang)
8791

8892
// Define what separates a word
8993
const regexWord = '!"#$%&()*+,-./:;<=>?@[\\]^_`{|}~ '

0 commit comments

Comments
 (0)