[SSE] Spellcheck settings
This commit is contained in:
parent
b73a916af4
commit
96e619fdc6
|
@ -54,9 +54,6 @@ define([
|
||||||
this.addListeners({
|
this.addListeners({
|
||||||
'Spellcheck': {
|
'Spellcheck': {
|
||||||
'show': function() {
|
'show': function() {
|
||||||
if (me.api) {
|
|
||||||
me.api.asc_startSpellCheck();
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
'hide': function() {
|
'hide': function() {
|
||||||
}
|
}
|
||||||
|
@ -77,6 +74,7 @@ define([
|
||||||
setApi: function(api) {
|
setApi: function(api) {
|
||||||
this.api = api;
|
this.api = api;
|
||||||
this.api.asc_registerCallback('asc_onSpellCheckInit',_.bind(this.loadLanguages, this));
|
this.api.asc_registerCallback('asc_onSpellCheckInit',_.bind(this.loadLanguages, this));
|
||||||
|
this.api.asc_registerCallback('asc_onSpellCheckVariantsFound', _.bind(this.onSpellCheckVariantsFound, this));
|
||||||
return this;
|
return this;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -86,15 +84,12 @@ define([
|
||||||
},
|
},
|
||||||
|
|
||||||
onAfterRender: function(panelSpellcheck) {
|
onAfterRender: function(panelSpellcheck) {
|
||||||
panelSpellcheck.buttonPreview.on('click', _.bind(this.onClickPreview, this));
|
|
||||||
panelSpellcheck.buttonNext.on('click', _.bind(this.onClickNext, this));
|
panelSpellcheck.buttonNext.on('click', _.bind(this.onClickNext, this));
|
||||||
panelSpellcheck.cmbDictionaryLanguage.on('selected', _.bind(this.onSelectLanguage, this));
|
panelSpellcheck.cmbDictionaryLanguage.on('selected', _.bind(this.onSelectLanguage, this));
|
||||||
},
|
panelSpellcheck.btnChange.on('click', _.bind(this.onClickChange, this));
|
||||||
|
panelSpellcheck.btnIgnore.on('click', _.bind(this.onClickIgnore, this));
|
||||||
onClickPreview: function() {
|
panelSpellcheck.btnChange.menu.on('item:click', _.bind(this.onClickChangeMenu, this));
|
||||||
if (this.api) {
|
panelSpellcheck.btnIgnore.menu.on('item:click', _.bind(this.onClickIgnoreMenu, this));
|
||||||
this.api.asc_previousWord();
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
|
|
||||||
onClickNext: function() {
|
onClickNext: function() {
|
||||||
|
@ -133,6 +128,54 @@ define([
|
||||||
if (this.api && lang) {
|
if (this.api && lang) {
|
||||||
/*this.api.asc_setDefaultLanguage(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 || {}));
|
}, SSE.Controllers.Spellcheck || {}));
|
||||||
|
|
|
@ -53,7 +53,7 @@ define([
|
||||||
template: _.template([
|
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-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 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-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>',
|
||||||
'<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>',
|
'<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
|
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({
|
this.buttonNext = new Common.UI.Button({
|
||||||
style: 'margin-left: 5px; width: 22px; height: 22px; border: 1px solid #cfcfcf;',
|
style: 'margin-left: 5px; width: 22px; height: 22px; border: 1px solid #cfcfcf;',
|
||||||
cls: 'btn-toolbar bg-white',
|
cls: 'btn-toolbar bg-white',
|
||||||
|
@ -102,16 +95,12 @@ define([
|
||||||
cls: 'btn-text-split-default',
|
cls: 'btn-text-split-default',
|
||||||
caption: this.textChange,
|
caption: this.textChange,
|
||||||
split: true,
|
split: true,
|
||||||
enableToggle: true,
|
|
||||||
allowDepress: true,
|
|
||||||
width: 105,
|
width: 105,
|
||||||
menu : new Common.UI.Menu({
|
menu : new Common.UI.Menu({
|
||||||
style : 'min-width: 105px;',
|
style : 'min-width: 105px;',
|
||||||
items: [
|
items: [
|
||||||
{
|
{
|
||||||
caption: this.textChange,
|
caption: this.textChange,
|
||||||
checkable: true,
|
|
||||||
allowDepress: true,
|
|
||||||
value: 0
|
value: 0
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -127,16 +116,12 @@ define([
|
||||||
cls: 'btn-text-split-default',
|
cls: 'btn-text-split-default',
|
||||||
caption: this.textIgnore,
|
caption: this.textIgnore,
|
||||||
split: true,
|
split: true,
|
||||||
enableToggle: true,
|
|
||||||
allowDepress: true,
|
|
||||||
width: 105,
|
width: 105,
|
||||||
menu : new Common.UI.Menu({
|
menu : new Common.UI.Menu({
|
||||||
style : 'min-width: 105px;',
|
style : 'min-width: 105px;',
|
||||||
items: [
|
items: [
|
||||||
{
|
{
|
||||||
caption: this.textIgnore,
|
caption: this.textIgnore,
|
||||||
checkable: true,
|
|
||||||
allowDepress: true,
|
|
||||||
value: 0
|
value: 0
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue