mirror of https://github.com/status-im/codimd.git
Expose setDictLang method
Signed-off-by: Yukai Huang <yukaihuangtw@gmail.com>
This commit is contained in:
parent
bc3fe7ca8d
commit
526b5d0aa7
|
@ -724,8 +724,7 @@ export default class Editor {
|
||||||
placeholder: "← Start by entering a title here\n===\nVisit /features if you don't know what to do.\nHappy hacking :)"
|
placeholder: "← Start by entering a title here\n===\nVisit /features if you don't know what to do.\nHappy hacking :)"
|
||||||
})
|
})
|
||||||
|
|
||||||
// eslint-disable-next-line
|
this.spellchecker = new CodeMirrorSpellChecker(CodeMirror)
|
||||||
new CodeMirrorSpellChecker(CodeMirror)
|
|
||||||
this.tableEditor = initTableEditor(this.editor)
|
this.tableEditor = initTableEditor(this.editor)
|
||||||
|
|
||||||
return this.editor
|
return this.editor
|
||||||
|
|
|
@ -77,13 +77,17 @@ class CodeMirrorSpellChecker {
|
||||||
}
|
}
|
||||||
|
|
||||||
this.typo = undefined
|
this.typo = undefined
|
||||||
this.setupCM(cm, lang)
|
this.defineSpellCheckerMode(cm, lang)
|
||||||
}
|
}
|
||||||
|
|
||||||
setupCM (cm, lang) {
|
setDictLang (lang) {
|
||||||
|
findOrCreateTypoInstance(lang).then(typo => { this.typo = typo })
|
||||||
|
}
|
||||||
|
|
||||||
|
defineSpellCheckerMode (cm, lang) {
|
||||||
cm.defineMode('spell-checker', config => {
|
cm.defineMode('spell-checker', config => {
|
||||||
// Load AFF/DIC data async
|
// Load AFF/DIC data async
|
||||||
findOrCreateTypoInstance(lang).then(typo => { this.typo = typo })
|
this.setDictLang(lang)
|
||||||
|
|
||||||
// Define what separates a word
|
// Define what separates a word
|
||||||
const regexWord = '!"#$%&()*+,-./:;<=>?@[\\]^_`{|}~ '
|
const regexWord = '!"#$%&()*+,-./:;<=>?@[\\]^_`{|}~ '
|
||||||
|
|
Loading…
Reference in New Issue