diff --git a/apps/common/main/lib/component/Menu.js b/apps/common/main/lib/component/Menu.js index 5cbd8a087..cf6917e6a 100644 --- a/apps/common/main/lib/component/Menu.js +++ b/apps/common/main/lib/component/Menu.js @@ -405,6 +405,7 @@ define([ item.off('click').off('toggle'); item.remove(); }); + this.rendered && this.cmpEl.find('.menu-scroll').off('click').remove(); me.items = []; }, diff --git a/apps/documenteditor/main/app/controller/Main.js b/apps/documenteditor/main/app/controller/Main.js index 65013017b..604397264 100644 --- a/apps/documenteditor/main/app/controller/Main.js +++ b/apps/documenteditor/main/app/controller/Main.js @@ -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() { diff --git a/apps/documenteditor/main/app/view/DocumentHolder.js b/apps/documenteditor/main/app/view/DocumentHolder.js index 57dc75acd..b29869844 100644 --- a/apps/documenteditor/main/app/view/DocumentHolder.js +++ b/apps/documenteditor/main/app/view/DocumentHolder.js @@ -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, diff --git a/apps/documenteditor/main/app/view/Statusbar.js b/apps/documenteditor/main/app/view/Statusbar.js index c69c23406..3365e5993 100644 --- a/apps/documenteditor/main/app/view/Statusbar.js +++ b/apps/documenteditor/main/app/view/Statusbar.js @@ -345,6 +345,7 @@ define([ }, reloadLanguages: function(array) { + this.langMenu.removeAll(); _.each(array, function(item) { this.langMenu.addItem({ iconCls : item['tip'], diff --git a/apps/documenteditor/sdk_dev_scripts.js b/apps/documenteditor/sdk_dev_scripts.js index b306b7857..65821e8d7 100644 --- a/apps/documenteditor/sdk_dev_scripts.js +++ b/apps/documenteditor/sdk_dev_scripts.js @@ -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",