[DE] Use event asc_onSpellCheckInit instead of asc_getSpellCheckLanguages.

This commit is contained in:
Julia Radzhabova 2017-04-19 11:28:40 +03:00
parent 21a9a48b44
commit e1d553049b
5 changed files with 24 additions and 13 deletions

View file

@ -405,6 +405,7 @@ define([
item.off('click').off('toggle');
item.remove();
});
this.rendered && this.cmpEl.find('.menu-scroll').off('click').remove();
me.items = [];
},

View file

@ -105,7 +105,7 @@ define([
});
this._state = {isDisconnected: false, usersCount: 1, fastCoauth: true, lostEditingRights: false, licenseWarning: false};
this.languages = null;
// Initialize viewport
if (!Common.Utils.isBrowserSupported()){
@ -141,6 +141,8 @@ define([
this.api.asc_registerCallback('asc_onDocumentName', _.bind(this.onDocumentName, this));
this.api.asc_registerCallback('asc_onPrintUrl', _.bind(this.onPrintUrl, this));
this.api.asc_registerCallback('asc_onMeta', _.bind(this.onMeta, this));
this.api.asc_registerCallback('asc_onSpellCheckInit', _.bind(this.loadLanguages, this));
Common.NotificationCenter.on('api:disconnect', _.bind(this.onCoAuthoringDisconnect, this));
Common.NotificationCenter.on('goback', _.bind(this.goBack, this));
@ -871,7 +873,7 @@ define([
toolbarController.createDelayedElements();
documentHolderController.getView().createDelayedElements();
me.loadLanguages();
me.setLanguages();
var shapes = me.api.asc_getPropertyEditorShapes();
if (shapes)
@ -1673,15 +1675,15 @@ define([
}
},
loadLanguages: function() {
var apiLangs = this.api.asc_getSpellCheckLanguages(),
langs = [], info;
loadLanguages: function(apiLangs) {
var langs = [], info;
_.each(apiLangs, function(lang, index, list){
info = Common.util.LanguageInfo.getLocalLanguageName(lang.asc_getId());
lang = parseInt(lang);
info = Common.util.LanguageInfo.getLocalLanguageName(lang);
langs.push({
title: info[1],
tip: info[0],
code: lang.asc_getId()
code: lang
});
}, this);
@ -1691,9 +1693,16 @@ define([
return 0;
});
this.getApplication().getController('DocumentHolder').getView().setLanguages(langs);
this.getApplication().getController('Statusbar').setLanguages(langs);
this.getApplication().getController('Common.Controllers.ReviewChanges').setLanguages(langs);
this.languages = langs;
window.styles_loaded && this.setLanguages();
},
setLanguages: function() {
if (this.languages && this.languages.length>0) {
this.getApplication().getController('DocumentHolder').getView().setLanguages(this.languages);
this.getApplication().getController('Statusbar').setLanguages(this.languages);
this.getApplication().getController('Common.Controllers.ReviewChanges').setLanguages(this.languages);
}
},
onInsertTable: function() {

View file

@ -3119,7 +3119,9 @@ define([
setLanguages: function(langs){
var me = this;
if (langs && langs.length > 0) {
if (langs && langs.length > 0 && me.langParaMenu && me.langTableMenu) {
me.langParaMenu.menu.removeAll();
me.langTableMenu.menu.removeAll();
_.each(langs, function(lang, index){
me.langParaMenu.menu.addItem(new Common.UI.MenuItem({
caption : lang.title,

View file

@ -345,6 +345,7 @@ define([
},
reloadLanguages: function(array) {
this.langMenu.removeAll();
_.each(array, function(item) {
this.langMenu.addItem({
iconCls : item['tip'],

View file

@ -6,8 +6,6 @@ var sdk_dev_scrpipts = [
"../../../../sdkjs/common/docscoapicommon.js",
"../../../../sdkjs/common/docscoapi.js",
"../../../../sdkjs/common/spellcheckapi.js",
"../../../../sdkjs/common/spellCheckLanguage.js",
"../../../../sdkjs/common/spellCheckLanguagesAll.js",
"../../../../sdkjs/common/apiCommon.js",
"../../../../sdkjs/common/SerializeCommonWordExcel.js",
"../../../../sdkjs/common/editorscommon.js",