diff --git a/apps/documenteditor/main/app/controller/Toolbar.js b/apps/documenteditor/main/app/controller/Toolbar.js index be8289b7a..b9beb9d00 100644 --- a/apps/documenteditor/main/app/controller/Toolbar.js +++ b/apps/documenteditor/main/app/controller/Toolbar.js @@ -178,7 +178,6 @@ define([ // Create toolbar view this.toolbar = this.createView('Toolbar'); - // this.toolbar.on('render:after', _.bind(this.onToolbarAfterRender, this)); me.toolbar.on('render:before', function (cmp) { }); @@ -186,7 +185,7 @@ define([ Common.NotificationCenter.on('app:face', me.onAppShowed.bind(me)); }, - onToolbarAfterRender: function(toolbar) { + attachUIEvents: function(toolbar) { /** * UI Events */ @@ -2749,7 +2748,7 @@ define([ createDelayedElements: function() { this.toolbar.createDelayedElements(); - this.onToolbarAfterRender(this.toolbar); + this.attachUIEvents(this.toolbar); }, onAppShowed: function (config) { diff --git a/apps/documenteditor/main/app/view/Toolbar.js b/apps/documenteditor/main/app/view/Toolbar.js index d1430a726..2282c0f28 100644 --- a/apps/documenteditor/main/app/view/Toolbar.js +++ b/apps/documenteditor/main/app/view/Toolbar.js @@ -1015,49 +1015,6 @@ define([ this.mnuPageSize = this.btnPageSize.menu; this.mnuColorSchema = this.btnColorSchemas.menu; - // - // DataView and pickers - // - - this.btnHighlightColor.on('render:after', function (btn) { - var colorVal = $('
'); - $('button:first-child', btn.cmpEl).append(colorVal); - btn.currentColor = 'FFFF00'; - colorVal.css('background-color', '#' + btn.currentColor); - - me.mnuHighlightColorPicker = new Common.UI.ColorPalette({ - el: $('#id-toolbar-menu-highlight'), - value: 'FFFF00', - colors: [ - 'FFFF00', '00FF00', '00FFFF', 'FF00FF', '0000FF', 'FF0000', '00008B', '008B8B', - '006400', '800080', '8B0000', '808000', 'FFFFFF', 'D3D3D3', 'A9A9A9', '000000' - ] - }); - - me.mnuHighlightColorPicker.select('FFFF00'); - }); - - this.btnFontColor.on('render:after', function (btn) { - var colorVal = $(''); - $('button:first-child', btn.cmpEl).append(colorVal); - colorVal.css('background-color', btn.currentColor || 'transparent'); - - me.mnuFontColorPicker = new Common.UI.ThemeColorPalette({ - el: $('#id-toolbar-menu-fontcolor') - }); - }); - - this.btnParagraphColor.on('render:after', function (btn) { - var colorVal = $(''); - $('button:first-child', btn.cmpEl).append(colorVal); - colorVal.css('background-color', btn.currentColor || 'transparent'); - - me.mnuParagraphColorPicker = new Common.UI.ThemeColorPalette({ - el: $('#id-toolbar-menu-paracolor'), - transparent: true - }); - }); - this.cmbFontSize = new Common.UI.ComboBox({ cls: 'input-group-nr', menuStyle: 'min-width: 55px;', @@ -1198,6 +1155,8 @@ define([ }); } + this.on('render:after', _.bind(this.onToolbarAfterRender, this)); + Common.NotificationCenter.on('app:ready', me.onAppReady.bind(this)); return this; @@ -2026,6 +1985,38 @@ define([ }); }, + onToolbarAfterRender: function(toolbar) { + // DataView and pickers + // + var colorVal = $(''); + $('button:first-child', this.btnHighlightColor.cmpEl).append(colorVal); + this.btnHighlightColor.currentColor = 'FFFF00'; + colorVal.css('background-color', '#' + this.btnHighlightColor.currentColor); + this.mnuHighlightColorPicker = new Common.UI.ColorPalette({ + el: $('#id-toolbar-menu-highlight'), + colors: [ + 'FFFF00', '00FF00', '00FFFF', 'FF00FF', '0000FF', 'FF0000', '00008B', '008B8B', + '006400', '800080', '8B0000', '808000', 'FFFFFF', 'D3D3D3', 'A9A9A9', '000000' + ] + }); + this.mnuHighlightColorPicker.select('FFFF00'); + + colorVal = $(''); + $('button:first-child', this.btnFontColor.cmpEl).append(colorVal); + colorVal.css('background-color', this.btnFontColor.currentColor || 'transparent'); + this.mnuFontColorPicker = new Common.UI.ThemeColorPalette({ + el: $('#id-toolbar-menu-fontcolor') + }); + + colorVal = $(''); + $('button:first-child', this.btnParagraphColor.cmpEl).append(colorVal); + colorVal.css('background-color', this.btnParagraphColor.currentColor || 'transparent'); + this.mnuParagraphColorPicker = new Common.UI.ThemeColorPalette({ + el: $('#id-toolbar-menu-paracolor'), + transparent: true + }); + }, + updateMetricUnit: function () { var items = this.btnPageMargins.menu.items; for (var i = 0; i < items.length; i++) { diff --git a/apps/presentationeditor/main/app/controller/Toolbar.js b/apps/presentationeditor/main/app/controller/Toolbar.js index 97ed38515..8cebc1e31 100644 --- a/apps/presentationeditor/main/app/controller/Toolbar.js +++ b/apps/presentationeditor/main/app/controller/Toolbar.js @@ -185,8 +185,6 @@ define([ // Create toolbar view this.toolbar = this.createView('Toolbar'); -// this.toolbar.on('render:after', _.bind(this.onToolbarAfterRender, this)); - var me = this; Common.NotificationCenter.on('app:ready', me.onAppReady.bind(me)); Common.NotificationCenter.on('app:face', me.onAppShowed.bind(me)); @@ -200,7 +198,7 @@ define([ }); }, - onToolbarAfterRender: function(toolbar) { + attachUIEvents: function(toolbar) { /** * UI Events */ @@ -2039,7 +2037,7 @@ define([ createDelayedElements: function() { this.toolbar.createDelayedElements(); - this.onToolbarAfterRender(this.toolbar); + this.attachUIEvents(this.toolbar); }, onAppShowed: function (config) { diff --git a/apps/presentationeditor/main/app/view/Toolbar.js b/apps/presentationeditor/main/app/view/Toolbar.js index cda76c556..4748b74c7 100644 --- a/apps/presentationeditor/main/app/view/Toolbar.js +++ b/apps/presentationeditor/main/app/view/Toolbar.js @@ -353,14 +353,6 @@ define([ { template: _.template('' + me.textNewColor + '') } ] }) - }).on('render:after', function(btn) { - var colorVal = $(''); - $('button:first-child', btn.cmpEl).append(colorVal); - colorVal.css('background-color', btn.currentColor || 'transparent'); - - me.mnuFontColorPicker = new Common.UI.ThemeColorPalette({ - el: $('#id-toolbar-menu-fontcolor') - }); }); me.paragraphControls.push(me.btnFontColor); @@ -850,6 +842,8 @@ define([ }); this.lockToolbar(PE.enumLock.disableOnStart, true, {array: me.slideOnlyControls.concat(me.shapeControls)}); + this.on('render:after', _.bind(this.onToolbarAfterRender, this)); + return this; }, @@ -1410,6 +1404,17 @@ define([ }, + onToolbarAfterRender: function(toolbar) { + // DataView and pickers + // + var colorVal = $(''); + $('button:first-child', this.btnFontColor.cmpEl).append(colorVal); + colorVal.css('background-color', this.btnFontColor.currentColor || 'transparent'); + this.mnuFontColorPicker = new Common.UI.ThemeColorPalette({ + el: $('#id-toolbar-menu-fontcolor') + }); + }, + setApi: function (api) { this.api = api;