Commit 1d789709 authored by Julia Radzhabova's avatar Julia Radzhabova

[DE] Use event asc_onSpellCheckInit instead of asc_getSpellCheckLanguages.

parent c3443c63
......@@ -405,6 +405,7 @@ define([
item.off('click').off('toggle');
item.remove();
});
this.rendered && this.cmpEl.find('.menu-scroll').off('click').remove();
me.items = [];
},
......
......@@ -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));
......@@ -868,7 +870,7 @@ define([
toolbarController.createDelayedElements();
documentHolderController.getView('DocumentHolder').createDelayedElements();
me.loadLanguages();
me.setLanguages();
var shapes = me.api.asc_getPropertyEditorShapes();
if (shapes)
......@@ -1655,15 +1657,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);
......@@ -1673,8 +1675,15 @@ define([
return 0;
});
this.getApplication().getController('DocumentHolder').getView('DocumentHolder').setLanguages(langs);
this.getApplication().getController('Statusbar').setLanguages(langs);
this.languages = langs;
window.styles_loaded && this.setLanguages();
},
setLanguages: function() {
if (this.languages && this.languages.length>0) {
this.getApplication().getController('DocumentHolder').getView('DocumentHolder').setLanguages(this.languages);
this.getApplication().getController('Statusbar').setLanguages(this.languages);
}
},
onInsertTable: function() {
......
......@@ -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,
......
......@@ -466,6 +466,7 @@ define([
/** coauthoring end **/
reloadLanguages: function(array) {
this.langMenu.removeAll();
_.each(array, function(item) {
this.langMenu.addItem({
iconCls : item['tip'],
......
......@@ -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",
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment