[SSE] Spellcheck refactoring
This commit is contained in:
parent
5efad36585
commit
77aeb40577
|
@ -104,8 +104,8 @@ define([
|
||||||
|
|
||||||
onDictionary: function() {
|
onDictionary: function() {
|
||||||
if (this.api) {
|
if (this.api) {
|
||||||
var rec = this.panelSpellcheck.suggestionList.getSelectedRec();
|
var str = this.panelSpellcheck.currentWord.getValue();
|
||||||
rec && this.api.asc_AddToDictionary(rec.get('value'));
|
str && this.api.asc_AddToDictionary(str);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -119,7 +119,10 @@ define([
|
||||||
|
|
||||||
loadLanguages: function () {
|
loadLanguages: function () {
|
||||||
var value = Common.localStorage.getItem("sse-spellcheck-locale");
|
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;
|
var combo = this.panelSpellcheck.cmbDictionaryLanguage;
|
||||||
if (this.languages && this.languages.length>0) {
|
if (this.languages && this.languages.length>0) {
|
||||||
|
@ -208,7 +211,7 @@ define([
|
||||||
if (property) {
|
if (property) {
|
||||||
word = property.get_Word();
|
word = property.get_Word();
|
||||||
var variants = property.get_Variants();
|
var variants = property.get_Variants();
|
||||||
variants.forEach(function (item) {
|
variants && variants.forEach(function (item) {
|
||||||
var rec = new Common.UI.DataViewModel();
|
var rec = new Common.UI.DataViewModel();
|
||||||
rec.set({
|
rec.set({
|
||||||
value: item
|
value: item
|
||||||
|
@ -218,6 +221,7 @@ define([
|
||||||
}
|
}
|
||||||
this.panelSpellcheck.currentWord.setValue(word || '');
|
this.panelSpellcheck.currentWord.setValue(word || '');
|
||||||
this.panelSpellcheck.suggestionList.store.reset(arr);
|
this.panelSpellcheck.suggestionList.store.reset(arr);
|
||||||
|
(arr.length>0) && this.panelSpellcheck.suggestionList.selectByIndex(0);
|
||||||
this.panelSpellcheck.currentWord.setDisabled(!word);
|
this.panelSpellcheck.currentWord.setDisabled(!word);
|
||||||
this.panelSpellcheck.btnChange.setDisabled(arr.length<1);
|
this.panelSpellcheck.btnChange.setDisabled(arr.length<1);
|
||||||
this.panelSpellcheck.btnIgnore.setDisabled(!word);
|
this.panelSpellcheck.btnIgnore.setDisabled(!word);
|
||||||
|
|
|
@ -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 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-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>',
|
'<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>',
|
'<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 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>'
|
'</div>'
|
||||||
|
@ -75,7 +75,8 @@ define([
|
||||||
this.currentWord = new Common.UI.InputField({
|
this.currentWord = new Common.UI.InputField({
|
||||||
el : $('#spellcheck-current-word'),
|
el : $('#spellcheck-current-word'),
|
||||||
allowBlank : true,
|
allowBlank : true,
|
||||||
validateOnBlur: false
|
validateOnBlur: false,
|
||||||
|
disabled: true
|
||||||
});
|
});
|
||||||
|
|
||||||
this.buttonNext = new Common.UI.Button({
|
this.buttonNext = new Common.UI.Button({
|
||||||
|
@ -96,6 +97,7 @@ define([
|
||||||
caption: this.textChange,
|
caption: this.textChange,
|
||||||
split: true,
|
split: true,
|
||||||
width: 105,
|
width: 105,
|
||||||
|
disabled: true,
|
||||||
menu : new Common.UI.Menu({
|
menu : new Common.UI.Menu({
|
||||||
style : 'min-width: 105px;',
|
style : 'min-width: 105px;',
|
||||||
items: [
|
items: [
|
||||||
|
@ -117,6 +119,7 @@ define([
|
||||||
caption: this.textIgnore,
|
caption: this.textIgnore,
|
||||||
split: true,
|
split: true,
|
||||||
width: 105,
|
width: 105,
|
||||||
|
disabled: true,
|
||||||
menu : new Common.UI.Menu({
|
menu : new Common.UI.Menu({
|
||||||
style : 'min-width: 105px;',
|
style : 'min-width: 105px;',
|
||||||
items: [
|
items: [
|
||||||
|
|
Loading…
Reference in a new issue