[SSE] Apply spellcheck

This commit is contained in:
Julia Radzhabova 2019-08-05 18:02:40 +03:00
parent f0f71285d4
commit 575a07131e

View file

@ -118,6 +118,10 @@ define([
}, },
loadLanguages: function () { loadLanguages: function () {
var value = Common.localStorage.getItem("sse-spellcheck-locale");
(!value) && (value = this.mode.lang ? parseInt(Common.util.LanguageInfo.getLocalLanguageCode(this.mode.lang)) : 0x0409);
var combo = this.panelSpellcheck.cmbDictionaryLanguage;
if (this.languages && this.languages.length>0) { if (this.languages && this.languages.length>0) {
var langs = [], info, var langs = [], info,
allLangs = Common.util.LanguageInfo.getLanguages(); allLangs = Common.util.LanguageInfo.getLanguages();
@ -126,60 +130,71 @@ define([
info = allLangs[parseInt(code)]; info = allLangs[parseInt(code)];
langs.push({ langs.push({
displayValue: info[1], displayValue: info[1],
value: info[0], value: parseInt(code)
code: parseInt(code)
}); });
} }
}); });
this.panelSpellcheck.cmbDictionaryLanguage.setData(langs); combo.setData(langs);
/*var codeCurLang = this.api.asc_getDefaultLanguage();*/ if (value) {
var codeCurLang = 1036; var item = combo.store.findWhere({value: value});
var curLang = allLangs[codeCurLang][0]; combo.setValue(item ? item.get('value') : 0x0409);
this.panelSpellcheck.cmbDictionaryLanguage.setValue(curLang); value = combo.getValue();
} else } else {
this.panelSpellcheck.cmbDictionaryLanguage.setDisabled(true); value = this.mode.lang ? parseInt(Common.util.LanguageInfo.getLocalLanguageCode(this.mode.lang)) : 0x0409;
combo.setValue(Common.util.LanguageInfo.getLocalLanguageName(value)[1]);
}
} else {
combo.setValue(Common.util.LanguageInfo.getLocalLanguageName(value)[1]);
combo.setDisabled(true);
}
this.api.asc_setDefaultLanguage(value);
}, },
onSelectLanguage: function (combo, record) { onSelectLanguage: function (combo, record) {
var lang = record.code; var lang = record.code;
if (this.api && lang) { if (this.api && lang) {
/*this.api.asc_setDefaultLanguage(lang);*/ this.api.asc_setDefaultLanguage(lang);
Common.localStorage.setItem("sse-spellcheck-locale", this.panelSpellcheck.cmbDictionaryLanguage.getValue());
} }
}, },
onClickChange: function (btn, e) { onClickChange: function (btn, e) {
if (this.api) { if (this.api) {
/*this.api.asc_change();*/ var rec = this.panelSpellcheck.suggestionList.getSelectedRec();
rec && this.api.asc_replaceMisspelledWord(rec.get('value'), this._currentSpellObj);
} }
}, },
onClickChangeMenu: function (menu, item) { onClickChangeMenu: function (menu, item) {
/*if (this.api) { if (this.api) {
var rec = this.panelSpellcheck.suggestionList.getSelectedRec();
if (item.value == 0) { if (item.value == 0) {
this.api.asc_change(); rec && this.api.asc_replaceMisspelledWord(rec.get('value'), this._currentSpellObj);
} else if (item.value == 1) { } else if (item.value == 1) {
this.api.asc_changeAll(); rec && this.api.asc_replaceMisspelledWord(rec.get('value'), this._currentSpellObj, true);
} }
}*/ }
}, },
onClickIgnore: function () { onClickIgnore: function () {
if (this.api) { if (this.api) {
/*this.api.asc_ignore();*/ this.api.asc_ignoreMisspelledWord(this._currentSpellObj, false)
} }
}, },
onClickIgnoreMenu: function () { onClickIgnoreMenu: function (menu, item) {
/*if (this.api) { if (this.api) {
if (item.value == 0) { if (item.value == 0) {
this.api.asc_ignore(); this.api.asc_ignoreMisspelledWord(this._currentSpellObj, false);
} else if (item.value == 1) { } else if (item.value == 1) {
this.api.asc_ignoreAll(); this.api.asc_ignoreMisspelledWord(this._currentSpellObj, true);
} }
}*/ }
}, },
onSpellCheckVariantsFound: function (property) { onSpellCheckVariantsFound: function (property) {
this._currentSpellObj = property;
var word = property.get_Word(); var word = property.get_Word();
this.panelSpellcheck.currentWord.setValue(word); this.panelSpellcheck.currentWord.setValue(word);