diff --git a/apps/documenteditor/main/app/controller/Main.js b/apps/documenteditor/main/app/controller/Main.js index 19fef38899..98fb3461f3 100644 --- a/apps/documenteditor/main/app/controller/Main.js +++ b/apps/documenteditor/main/app/controller/Main.js @@ -1436,9 +1436,9 @@ define([ Common.NotificationCenter.trigger('api:disconnect'); me.appOptions.canStartFilling && Common.Gateway.on('startfilling', _.bind(me.onStartFilling, me)); - + window.document_content_ready = true; var timer_sl = setInterval(function(){ - if (window.styles_loaded) { + if (window.document_content_ready) { clearInterval(timer_sl); toolbarController.createDelayedElements(); @@ -2707,7 +2707,7 @@ define([ onSendThemeColors: function(colors, standart_colors) { Common.Utils.ThemeColor.setColors(colors, standart_colors); - if (window.styles_loaded) { + if (window.document_content_ready) { this.updateThemeColors(); var me = this; setTimeout(function(){ @@ -2742,7 +2742,7 @@ define([ }); this.languages = langs; - window.styles_loaded && this.setLanguages(); + window.document_content_ready && this.setLanguages(); }, setLanguages: function() { diff --git a/apps/documenteditor/main/app/controller/Toolbar.js b/apps/documenteditor/main/app/controller/Toolbar.js index 3387f2939c..2cb6bbd606 100644 --- a/apps/documenteditor/main/app/controller/Toolbar.js +++ b/apps/documenteditor/main/app/controller/Toolbar.js @@ -943,13 +943,13 @@ define([ var listStyle = this.toolbar.listStyles, listStylesVisible = (listStyle.rendered); + this._state.prstyle = name; + if (listStylesVisible) { listStyle.suspendEvents(); var styleRec = listStyle.menuPicker.store.findWhere({ title: name }); - this._state.prstyle = (listStyle.menuPicker.store.length>0 || window.styles_loaded) ? name : undefined; - listStyle.menuPicker.selectRecord(styleRec); listStyle.resumeEvents(); } @@ -2705,7 +2705,11 @@ define([ }, onSaveStyle: function (style) { + if (!window.styles_loaded) return; + window.styles_loaded = false; + this.toolbar.lockToolbar(Common.enumLock.noStyles, !window.styles_loaded, {array: [this.toolbar.listStyles]}); + var me = this, win; if (me.api) { @@ -3268,6 +3272,7 @@ define([ _onInitEditorStyles: function(styles) { window.styles_loaded = false; + this.toolbar.lockToolbar(Common.enumLock.noStyles, !window.styles_loaded, {array: [this.toolbar.listStyles]}); var self = this, listStyles = self.toolbar.listStyles; @@ -3298,6 +3303,7 @@ define([ } else if (listStyles.rendered) listStyles.clearComboView(); window.styles_loaded = true; + this.toolbar.lockToolbar(Common.enumLock.noStyles, !window.styles_loaded, {array: [this.toolbar.listStyles]}); }, onHomeOpen: function() { diff --git a/apps/documenteditor/main/app/view/DocumentHolderExt.js b/apps/documenteditor/main/app/view/DocumentHolderExt.js index 8eea041d13..438220debd 100644 --- a/apps/documenteditor/main/app/view/DocumentHolderExt.js +++ b/apps/documenteditor/main/app/view/DocumentHolderExt.js @@ -39,7 +39,7 @@ define([], function () { dh.createDelayedElements = function() { var me = this; - if (me.menuInsertCaption || !window.styles_loaded) return; // menu is already inited or editor styles are not loaded + if (me.menuInsertCaption || !window.document_content_ready) return; // menu is already inited or editor styles are not loaded me.menuInsertCaption = new Common.UI.MenuItem({ caption : me.txtInsertCaption }); @@ -1834,6 +1834,7 @@ define([], function () { menuStyle.setVisible(edit_style); if (edit_style) { me.menuStyleUpdate.setCaption(me.updateStyleText.replace('%1', DE.getController('Main').translationTable[window.currentStyleName] || window.currentStyleName)); + me.menuStyleSave.setDisabled(!window.styles_loaded); } var control_lock = (value.paraProps) ? (!value.paraProps.value.can_DeleteBlockContentControl() || !value.paraProps.value.can_EditBlockContentControl() || diff --git a/apps/documenteditor/main/app/view/Toolbar.js b/apps/documenteditor/main/app/view/Toolbar.js index 51856cfb6e..3f6afbdd4f 100644 --- a/apps/documenteditor/main/app/view/Toolbar.js +++ b/apps/documenteditor/main/app/view/Toolbar.js @@ -119,7 +119,8 @@ define([ formsNoRoles: 'no-roles', fixedForm: 'fixed-form', fileMenuOpened: 'file-menu-opened', - changeModeLock: 'change-mode-lock' + changeModeLock: 'change-mode-lock', + noStyles: 'no-styles' }; for (var key in enumLock) { if (enumLock.hasOwnProperty(key)) { @@ -1660,7 +1661,7 @@ define([ itemHeight = 40; this.listStyles = new Common.UI.ComboDataView({ cls: 'combo-styles', - lock: [_set.paragraphLock, _set.headerLock, _set.richEditLock, _set.plainEditLock, _set.inChart, _set.inSmartart, _set.inSmartartInternal, _set.previewReviewMode, + lock: [_set.noStyles, _set.paragraphLock, _set.headerLock, _set.richEditLock, _set.plainEditLock, _set.inChart, _set.inSmartart, _set.inSmartartInternal, _set.previewReviewMode, _set.viewFormMode, _set.lostConnect, _set.disableOnStart, _set.docLockView, _set.docLockForms, _set.docLockComments, _set.viewMode], itemWidth: itemWidth, itemHeight: itemHeight, @@ -1730,6 +1731,7 @@ define([ this.paragraphControls.push(this.listStyles); this.textOnlyControls.push(this.listStyles); + this.lockToolbar(Common.enumLock.noStyles, !window.styles_loaded, {array: [this.listStyles]}) // Disable all components before load document this.lockControls = me.toolbarControls.concat(me.paragraphControls);