[SSE] Disable spellcheck when cell is edited
This commit is contained in:
parent
0a0d852fa0
commit
b7277ca39c
|
@ -75,6 +75,7 @@ define([
|
|||
setApi: function(api) {
|
||||
this.api = api;
|
||||
this.api.asc_registerCallback('asc_onSpellCheckVariantsFound', _.bind(this.onSpellCheckVariantsFound, this));
|
||||
this.api.asc_registerCallback('asc_onEditCell', _.bind(this.onApiEditCell, this));
|
||||
return this;
|
||||
},
|
||||
|
||||
|
@ -105,7 +106,7 @@ define([
|
|||
onDictionary: function() {
|
||||
if (this.api) {
|
||||
var str = this.panelSpellcheck.currentWord.getValue();
|
||||
str && this.api.asc_AddToDictionary(str);
|
||||
str && this.api.asc_spellCheckAddToDictionary(str);
|
||||
}
|
||||
},
|
||||
|
||||
|
@ -219,14 +220,29 @@ define([
|
|||
arr.push(rec);
|
||||
});
|
||||
}
|
||||
var disabled = this.api.isCellEdited;
|
||||
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);
|
||||
this.panelSpellcheck.btnToDictionary.setDisabled(!word);
|
||||
this.panelSpellcheck.currentWord.setDisabled(!word || disabled);
|
||||
this.panelSpellcheck.btnChange.setDisabled(arr.length<1 || disabled);
|
||||
this.panelSpellcheck.btnIgnore.setDisabled(!word || disabled);
|
||||
this.panelSpellcheck.btnToDictionary.setDisabled(!word || disabled);
|
||||
this.panelSpellcheck.lblComplete.toggleClass('hidden', !property || !!word);
|
||||
},
|
||||
|
||||
onApiEditCell: function(state) {
|
||||
if (state == Asc.c_oAscCellEditorState.editEnd) {
|
||||
this.panelSpellcheck.buttonNext.setDisabled(false);
|
||||
this.panelSpellcheck.cmbDictionaryLanguage.setDisabled(false);
|
||||
} else {
|
||||
this.panelSpellcheck.buttonNext.setDisabled(true);
|
||||
this.panelSpellcheck.currentWord.setDisabled(true);
|
||||
this.panelSpellcheck.btnChange.setDisabled(true);
|
||||
this.panelSpellcheck.btnIgnore.setDisabled(true);
|
||||
this.panelSpellcheck.btnToDictionary.setDisabled(true);
|
||||
this.panelSpellcheck.cmbDictionaryLanguage.setDisabled(true);
|
||||
}
|
||||
}
|
||||
|
||||
}, SSE.Controllers.Spellcheck || {}));
|
||||
|
|
|
@ -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: 116px; background-color: #fff; margin-bottom: 8px;"></div>',
|
||||
'<div id="spellcheck-change" style="display: inline-block; padding-bottom: 16px;"></div><div id="spellcheck-ignore" class="padding-large" style="margin-left: 9px; display: inline-block;"></div>',
|
||||
'<button class="btn btn-text-default auto" id="spellcheck-add-to-dictionary" style="min-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: 110px; display: block; margin-bottom: 16px;"><%= scope.txtAddToDictionary %></button>',
|
||||
'<label class="header" style=" display: block;"><%= scope.txtDictionaryLanguage %></label><div id="spellcheck-dictionary-language" style="margin-top: 3px; padding-bottom: 16px;display: flex;"></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>'
|
||||
|
@ -149,7 +149,8 @@ define([
|
|||
});
|
||||
|
||||
this.btnToDictionary = new Common.UI.Button({
|
||||
el: $('#spellcheck-add-to-dictionary')
|
||||
el: $('#spellcheck-add-to-dictionary'),
|
||||
disabled : true
|
||||
});
|
||||
|
||||
this.lblComplete = this.$el.find('#spellcheck-complete');
|
||||
|
|
Loading…
Reference in a new issue