[SSE] Spellcheck settings

This commit is contained in:
Julia Svinareva 2019-08-05 17:08:16 +03:00
parent b73a916af4
commit 96e619fdc6
2 changed files with 54 additions and 26 deletions

View file

@ -54,9 +54,6 @@ define([
this.addListeners({
'Spellcheck': {
'show': function() {
if (me.api) {
me.api.asc_startSpellCheck();
}
},
'hide': function() {
}
@ -77,6 +74,7 @@ define([
setApi: function(api) {
this.api = api;
this.api.asc_registerCallback('asc_onSpellCheckInit',_.bind(this.loadLanguages, this));
this.api.asc_registerCallback('asc_onSpellCheckVariantsFound', _.bind(this.onSpellCheckVariantsFound, this));
return this;
},
@ -86,15 +84,12 @@ define([
},
onAfterRender: function(panelSpellcheck) {
panelSpellcheck.buttonPreview.on('click', _.bind(this.onClickPreview, this));
panelSpellcheck.buttonNext.on('click', _.bind(this.onClickNext, this));
panelSpellcheck.cmbDictionaryLanguage.on('selected', _.bind(this.onSelectLanguage, this));
},
onClickPreview: function() {
if (this.api) {
this.api.asc_previousWord();
}
panelSpellcheck.btnChange.on('click', _.bind(this.onClickChange, this));
panelSpellcheck.btnIgnore.on('click', _.bind(this.onClickIgnore, this));
panelSpellcheck.btnChange.menu.on('item:click', _.bind(this.onClickChangeMenu, this));
panelSpellcheck.btnIgnore.menu.on('item:click', _.bind(this.onClickIgnoreMenu, this));
},
onClickNext: function() {
@ -133,6 +128,54 @@ define([
if (this.api && lang) {
/*this.api.asc_setDefaultLanguage(lang);*/
}
},
onClickChange: function (btn, e) {
if (this.api) {
/*this.api.asc_change();*/
}
},
onClickChangeMenu: function (menu, item) {
/*if (this.api) {
if (item.value == 0) {
this.api.asc_change();
} else if (item.value == 1) {
this.api.asc_changeAll();
}
}*/
},
onClickIgnore: function () {
if (this.api) {
/*this.api.asc_ignore();*/
}
},
onClickIgnoreMenu: function () {
/*if (this.api) {
if (item.value == 0) {
this.api.asc_ignore();
} else if (item.value == 1) {
this.api.asc_ignoreAll();
}
}*/
},
onSpellCheckVariantsFound: function (property) {
var word = property.get_Word();
this.panelSpellcheck.currentWord.setValue(word);
var variants = property.get_Variants(),
arr = [];
variants.forEach(function (item) {
var rec = new Common.UI.DataViewModel();
rec.set({
value: item
});
arr.push(rec);
});
this.panelSpellcheck.suggestionList.store.reset(arr);
}
}, SSE.Controllers.Spellcheck || {}));

View file

@ -53,7 +53,7 @@ define([
template: _.template([
'<div id="spellcheck-box" class="layout-ct vbox active" style="padding-left: 15px; padding-right: 15px; padding-top: 20px; width: 100%; position: relative;">',
'<div id="spellcheck-header" style="font-size: 14px; padding-bottom: 16px;"><%= scope.txtSpelling %></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-preview" style="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-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-add-to-dictionary" style="padding-bottom: 16px;"><button class="btn btn-text-default" style="width: auto; padding: 0 15px;"><%= scope.txtAddToDictionary %></button></div>',
@ -78,13 +78,6 @@ define([
validateOnBlur: false
});
this.buttonPreview = new Common.UI.Button({
style: 'margin-left: 5px; width: 22px; height: 22px; border: 1px solid #cfcfcf;',
cls: 'btn-toolbar bg-white',
iconCls: 'btn-spellcheck-preview'
});
this.buttonPreview.render($('#spellcheck-preview'));
this.buttonNext = new Common.UI.Button({
style: 'margin-left: 5px; width: 22px; height: 22px; border: 1px solid #cfcfcf;',
cls: 'btn-toolbar bg-white',
@ -102,16 +95,12 @@ define([
cls: 'btn-text-split-default',
caption: this.textChange,
split: true,
enableToggle: true,
allowDepress: true,
width: 105,
menu : new Common.UI.Menu({
style : 'min-width: 105px;',
items: [
{
caption: this.textChange,
checkable: true,
allowDepress: true,
value: 0
},
{
@ -127,16 +116,12 @@ define([
cls: 'btn-text-split-default',
caption: this.textIgnore,
split: true,
enableToggle: true,
allowDepress: true,
width: 105,
menu : new Common.UI.Menu({
style : 'min-width: 105px;',
items: [
{
caption: this.textIgnore,
checkable: true,
allowDepress: true,
value: 0
},
{