diff --git a/apps/documenteditor/main/app/controller/Main.js b/apps/documenteditor/main/app/controller/Main.js index d1e1a5ac9..d60188454 100644 --- a/apps/documenteditor/main/app/controller/Main.js +++ b/apps/documenteditor/main/app/controller/Main.js @@ -723,12 +723,11 @@ define([ if (this._isDocReady) return; - Common.NotificationCenter.trigger('app:ready', this.appOptions); - var me = this, value; me._isDocReady = true; + Common.NotificationCenter.trigger('app:ready', this.appOptions); me.api.SetDrawingFreeze(false); me.hidePreloader(); diff --git a/apps/presentationeditor/main/app/controller/Toolbar.js b/apps/presentationeditor/main/app/controller/Toolbar.js index c56e72f43..d2c14f98b 100644 --- a/apps/presentationeditor/main/app/controller/Toolbar.js +++ b/apps/presentationeditor/main/app/controller/Toolbar.js @@ -2091,9 +2091,7 @@ define([ } } - (new Promise(function(accept) { - accept(); - })).then(function () { + Common.Utils.asyncCall(function () { if ( config.isEdit ) { me.toolbar.onAppReady(config); } diff --git a/apps/presentationeditor/main/app/view/Toolbar.js b/apps/presentationeditor/main/app/view/Toolbar.js index 4748b74c7..9134f15bb 100644 --- a/apps/presentationeditor/main/app/view/Toolbar.js +++ b/apps/presentationeditor/main/app/view/Toolbar.js @@ -1041,61 +1041,57 @@ define([ onAppReady: function (config) { var me = this; - (new Promise( function(resolve, reject) { - resolve(); - })).then(function () { - if ( !config.isEdit ) return; + if (!config.isEdit) return; - me.btnsInsertImage.forEach(function (btn) { - btn.updateHint(me.tipInsertImage); - btn.setMenu( - new Common.UI.Menu({ - items: [ - { caption: me.mniImageFromFile, value: 'file' }, - { caption: me.mniImageFromUrl, value: 'url' } - ] - }).on('item:click', function (menu, item, e) { - me.fireEvent('insert:image', [item.value]); - }) - ); - }); + me.btnsInsertImage.forEach(function (btn) { + btn.updateHint(me.tipInsertImage); + btn.setMenu( + new Common.UI.Menu({ + items: [ + {caption: me.mniImageFromFile, value: 'file'}, + {caption: me.mniImageFromUrl, value: 'url'} + ] + }).on('item:click', function (menu, item, e) { + me.fireEvent('insert:image', [item.value]); + }) + ); + }); - me.btnsInsertText.forEach(function (btn) { - btn.updateHint(me.tipInsertText); - btn.setMenu( - new Common.UI.Menu({ - items : [ - {caption: me.textInsText, value: 'text'}, - {caption: me.textInsTextArt, value: 'art', - menu: new Common.UI.Menu({ - menuAlign: 'tl-tr', - cls: 'menu-shapes', - items: [ - { template: _.template('
') } - ] - }) - } - ] - }).on('item:click', function (menu, item, e) { - if ( item.value == 'text' ) - me.fireEvent('insert:text', ['begin']); - }) - ); - btn.on('click', function (btn, e) { - me.fireEvent('insert:text', [btn.pressed?'begin':'end']); - }); + me.btnsInsertText.forEach(function (btn) { + btn.updateHint(me.tipInsertText); + btn.setMenu( + new Common.UI.Menu({ + items: [ + {caption: me.textInsText, value: 'text'}, + {caption: me.textInsTextArt, value: 'art', + menu: new Common.UI.Menu({ + menuAlign: 'tl-tr', + cls: 'menu-shapes', + items: [ + {template: _.template('')} + ] + }) + } + ] + }).on('item:click', function (menu, item, e) { + if (item.value == 'text') + me.fireEvent('insert:text', ['begin']); + }) + ); + btn.on('click', function (btn, e) { + me.fireEvent('insert:text', [btn.pressed ? 'begin' : 'end']); }); + }); - me.btnsInsertShape.forEach(function (btn) { - btn.updateHint(me.tipInsertShape); - btn.setMenu( - new Common.UI.Menu({ - cls: 'menu-shapes' - }).on('hide:after', function (e) { - me.fireEvent('insert:shape', ['menu:hide']); - }) - ); - }); + me.btnsInsertShape.forEach(function (btn) { + btn.updateHint(me.tipInsertShape); + btn.setMenu( + new Common.UI.Menu({ + cls: 'menu-shapes' + }).on('hide:after', function (e) { + me.fireEvent('insert:shape', ['menu:hide']); + }) + ); }); },