[SSE] Spellcheck refactoring

This commit is contained in:
Julia Radzhabova 2019-08-06 09:33:16 +03:00
parent 5efad36585
commit 77aeb40577
2 changed files with 13 additions and 6 deletions

View file

@ -104,8 +104,8 @@ define([
onDictionary: function() {
if (this.api) {
var rec = this.panelSpellcheck.suggestionList.getSelectedRec();
rec && this.api.asc_AddToDictionary(rec.get('value'));
var str = this.panelSpellcheck.currentWord.getValue();
str && this.api.asc_AddToDictionary(str);
}
},
@ -119,7 +119,10 @@ define([
loadLanguages: function () {
var value = Common.localStorage.getItem("sse-spellcheck-locale");
(!value) && (value = this.mode.lang ? parseInt(Common.util.LanguageInfo.getLocalLanguageCode(this.mode.lang)) : 0x0409);
if (value)
value = parseInt(value);
else
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) {
@ -208,7 +211,7 @@ define([
if (property) {
word = property.get_Word();
var variants = property.get_Variants();
variants.forEach(function (item) {
variants && variants.forEach(function (item) {
var rec = new Common.UI.DataViewModel();
rec.set({
value: item
@ -218,6 +221,7 @@ define([
}
this.panelSpellcheck.currentWord.setValue(word || '');
this.panelSpellcheck.suggestionList.store.reset(arr);
(arr.length>0) && this.panelSpellcheck.suggestionList.selectByIndex(0);
this.panelSpellcheck.currentWord.setDisabled(!word);
this.panelSpellcheck.btnChange.setDisabled(arr.length<1);
this.panelSpellcheck.btnIgnore.setDisabled(!word);

View file

@ -56,7 +56,7 @@ define([
'<div style="display: flex; width: 100%; padding-bottom: 8px;"><div id="spellcheck-current-word" style="vertical-align: top; width: 100%; display: inline-block;"></div><div id="spellcheck-next" style="display: inline-block;"></div></div>',
'<div id="spellcheck-suggestions-list" style="width: 100%; height: 100px; background-color: #fff; margin-bottom: 8px;"></div>',
'<div id="spellcheck-change" style="width: 105px; display: inline-block; padding-bottom: 16px;"></div><div id="spellcheck-ignore" class="padding-large" style="margin-left: 19px; width: 105px; display: inline-block;"></div>',
'<button class="btn btn-text-default" id="spellcheck-add-to-dictionary" style="width: 105px; display: block; margin-bottom: 16px;"><%= scope.txtAddToDictionary %></button>',
'<button class="btn btn-text-default auto" id="spellcheck-add-to-dictionary" style="min-width: 105px; display: block; margin-bottom: 16px;"><%= scope.txtAddToDictionary %></button>',
'<label class="header"><%= scope.txtDictionaryLanguage %></label><div id="spellcheck-dictionary-language" style="margin-top: 3px; padding-bottom: 16px;"></div>',
'<div id="spellcheck-complete" style="display: flex;" class="hidden"><i class="img-commonctrl img-complete" style="display: inline-block;margin-right: 10px;"></i><%= scope.txtComplete %></div>',
'</div>'
@ -75,7 +75,8 @@ define([
this.currentWord = new Common.UI.InputField({
el : $('#spellcheck-current-word'),
allowBlank : true,
validateOnBlur: false
validateOnBlur: false,
disabled: true
});
this.buttonNext = new Common.UI.Button({
@ -96,6 +97,7 @@ define([
caption: this.textChange,
split: true,
width: 105,
disabled: true,
menu : new Common.UI.Menu({
style : 'min-width: 105px;',
items: [
@ -117,6 +119,7 @@ define([
caption: this.textIgnore,
split: true,
width: 105,
disabled: true,
menu : new Common.UI.Menu({
style : 'min-width: 105px;',
items: [