|
|
@ -1866,6 +1866,16 @@ function CodeMirrorSpellChecker(options) {
|
|
|
|
// Define the new mode
|
|
|
|
// Define the new mode
|
|
|
|
options.codeMirrorInstance.defineMode("spell-checker", function(config) {
|
|
|
|
options.codeMirrorInstance.defineMode("spell-checker", function(config) {
|
|
|
|
// Load AFF/DIC data
|
|
|
|
// Load AFF/DIC data
|
|
|
|
|
|
|
|
var aff_loaded, dic_loaded;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var loadSpellChecker = function() {
|
|
|
|
|
|
|
|
if(aff_loaded && dic_loaded) {
|
|
|
|
|
|
|
|
CodeMirrorSpellChecker.typo = new Typo("en_US", CodeMirrorSpellChecker.aff_data, CodeMirrorSpellChecker.dic_data, {
|
|
|
|
|
|
|
|
platform: "any"
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
if(!CodeMirrorSpellChecker.aff_loading) {
|
|
|
|
if(!CodeMirrorSpellChecker.aff_loading) {
|
|
|
|
CodeMirrorSpellChecker.aff_loading = true;
|
|
|
|
CodeMirrorSpellChecker.aff_loading = true;
|
|
|
|
var xhr_aff = new XMLHttpRequest();
|
|
|
|
var xhr_aff = new XMLHttpRequest();
|
|
|
@ -1873,13 +1883,8 @@ function CodeMirrorSpellChecker(options) {
|
|
|
|
xhr_aff.onload = function() {
|
|
|
|
xhr_aff.onload = function() {
|
|
|
|
if(xhr_aff.readyState === 4 && xhr_aff.status === 200) {
|
|
|
|
if(xhr_aff.readyState === 4 && xhr_aff.status === 200) {
|
|
|
|
CodeMirrorSpellChecker.aff_data = xhr_aff.responseText;
|
|
|
|
CodeMirrorSpellChecker.aff_data = xhr_aff.responseText;
|
|
|
|
CodeMirrorSpellChecker.num_loaded++;
|
|
|
|
aff_loaded = true;
|
|
|
|
|
|
|
|
loadSpellChecker();
|
|
|
|
if(CodeMirrorSpellChecker.num_loaded == 2) {
|
|
|
|
|
|
|
|
CodeMirrorSpellChecker.typo = new Typo("en_US", CodeMirrorSpellChecker.aff_data, CodeMirrorSpellChecker.dic_data, {
|
|
|
|
|
|
|
|
platform: "any"
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
};
|
|
|
|
xhr_aff.send(null);
|
|
|
|
xhr_aff.send(null);
|
|
|
@ -1892,13 +1897,8 @@ function CodeMirrorSpellChecker(options) {
|
|
|
|
xhr_dic.onload = function() {
|
|
|
|
xhr_dic.onload = function() {
|
|
|
|
if(xhr_dic.readyState === 4 && xhr_dic.status === 200) {
|
|
|
|
if(xhr_dic.readyState === 4 && xhr_dic.status === 200) {
|
|
|
|
CodeMirrorSpellChecker.dic_data = xhr_dic.responseText;
|
|
|
|
CodeMirrorSpellChecker.dic_data = xhr_dic.responseText;
|
|
|
|
CodeMirrorSpellChecker.num_loaded++;
|
|
|
|
aff_loaded = true;
|
|
|
|
|
|
|
|
loadSpellChecker();
|
|
|
|
if(CodeMirrorSpellChecker.num_loaded == 2) {
|
|
|
|
|
|
|
|
CodeMirrorSpellChecker.typo = new Typo("en_US", CodeMirrorSpellChecker.aff_data, CodeMirrorSpellChecker.dic_data, {
|
|
|
|
|
|
|
|
platform: "any"
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
};
|
|
|
|
xhr_dic.send(null);
|
|
|
|
xhr_dic.send(null);
|
|
|
|