[SSE] Add onClickNext, onClickPreview, show, loadLanguages in Spellcheck

This commit is contained in:
Julia Svinareva 2019-08-05 11:55:24 +03:00
parent 5d97f2a9ec
commit ba28157080
3 changed files with 40 additions and 5 deletions

View file

@ -683,7 +683,8 @@ define([
leftMenuView = leftmenuController.getView('LeftMenu'),
documentHolderView = documentHolderController.getView('DocumentHolder'),
chatController = application.getController('Common.Controllers.Chat'),
pluginsController = application.getController('Common.Controllers.Plugins');
pluginsController = application.getController('Common.Controllers.Plugins'),
spellcheckController = application.getController('Spellcheck');
leftMenuView.getMenu('file').loadDocument({doc:me.appOptions.spreadsheet});
leftmenuController.setMode(me.appOptions).createDelayedElements().setApi(me.api);
@ -700,6 +701,7 @@ define([
documentHolderController.setApi(me.api).loadConfig({config:me.editorConfig});
chatController.setApi(this.api).setMode(this.appOptions);
spellcheckController.setApi(this.api).setMode(this.appOptions);
statusbarController.createDelayedElements();
statusbarController.setApi(me.api);

View file

@ -54,6 +54,9 @@ define([
this.addListeners({
'Spellcheck': {
'show': function() {
if (me.api) {
me.api.asc_startSpellCheck();
}
},
'hide': function() {
}
@ -73,7 +76,7 @@ define([
setApi: function(api) {
this.api = api;
// this.api.asc_registerCallback('asc_onDocumentOutlineUpdate', _.bind(this.updateSpellcheck, this));
this.api.asc_registerCallback('asc_onSpellCheckInit',_.bind(this.loadLanguages, this));
return this;
},
@ -83,10 +86,41 @@ define([
},
onAfterRender: function(panelSpellcheck) {
panelSpellcheck.buttonPreview.on('click', _.bind(this.onClickPreview, this));
panelSpellcheck.buttonNext.on('click', _.bind(this.onClickNext, this));
},
onClickPreview: function() {
if (this.api) {
this.api.asc_previousWord();
}
},
onClickNext: function() {
if (this.api) {
this.api.asc_nextWord();
}
},
SetDisabled: function(state) {
this._isDisabled = state;
},
loadLanguages: function (apiLangs) {
var langs = [], info,
allLangs = Common.util.LanguageInfo.getLanguages();
apiLangs.forEach(function (code) {
if (allLangs.hasOwnProperty(parseInt(code))) {
info = allLangs[parseInt(code)];
langs.push({
displayValue: info[1],
value: info[0],
code: parseInt(code),
});
}
});
this.languages = langs;
this.panelSpellcheck.cmbDictionaryLanguage.setData(this.languages);
}
}, SSE.Controllers.Spellcheck || {}));

View file

@ -153,10 +153,9 @@ define([
this.cmbDictionaryLanguage = new Common.UI.ComboBox({
el : $('#spellcheck-dictionary-language'),
style : 'width: 230px',
menuStyle : 'min-width: 230px;',
menuStyle : 'width: 230px;',
editable : false,
cls : 'input-group-nr',
data : []
cls : 'input-group-nr'
});