diff --git a/apps/presentationeditor/main/app/controller/Toolbar.js b/apps/presentationeditor/main/app/controller/Toolbar.js index c2e3935db..11219b260 100644 --- a/apps/presentationeditor/main/app/controller/Toolbar.js +++ b/apps/presentationeditor/main/app/controller/Toolbar.js @@ -129,6 +129,8 @@ define([ 'insert:textart' : this.onInsertTextart.bind(this), 'insert:shape' : this.onInsertShape.bind(this), 'add:slide' : this.onAddSlide.bind(this), + 'duplicate:slide' : this.onDuplicateSlide.bind(this), + 'duplicate:check' : this.onDuplicateCheck.bind(this), 'change:slide' : this.onChangeSlide.bind(this), 'change:compact' : this.onClickChangeCompact, 'add:chart' : this.onSelectChart @@ -889,6 +891,20 @@ define([ } }, + onDuplicateSlide: function() { + if ( this.api) { + this.api.DublicateSlide(); + + Common.NotificationCenter.trigger('edit:complete', this.toolbar); + Common.component.Analytics.trackEvent('ToolBar', 'Duplicate Slide'); + } + }, + + onDuplicateCheck: function(menu) { + if (this.api) + menu.items[2].setDisabled(this.api.getCountPages()<1); + }, + onChangeSlide: function(type) { if (this.api) { this.api.ChangeLayout(type); diff --git a/apps/presentationeditor/main/app/view/Toolbar.js b/apps/presentationeditor/main/app/view/Toolbar.js index e5c0ce2ae..b3caf9dd5 100644 --- a/apps/presentationeditor/main/app/view/Toolbar.js +++ b/apps/presentationeditor/main/app/view/Toolbar.js @@ -1261,13 +1261,21 @@ define([ btn.setMenu( new Common.UI.Menu({ items: [ - {template: _.template('
')} + {template: _.template('')}, + {caption: '--'}, + { + caption: me.txtDuplicateSlide, + value: 'duplicate' + } ] }) ); btn.on('click', function (btn, e) { me.fireEvent('add:slide'); }); + btn.menu.on('item:click', function (menu, item) { + (item.value === 'duplicate') && me.fireEvent('duplicate:slide'); + }); }); }, @@ -1743,6 +1751,7 @@ define([ if (menu) { menu.on('show:after', function () { me.onSlidePickerShowAfter(picker); + !change && me.fireEvent('duplicate:check', [menu]); picker.scroller.update({alwaysVisibleY: true}); if (change) { var record = picker.store.findLayoutByIndex(picker.options.layout_index); @@ -1919,7 +1928,8 @@ define([ tipHighlightColor: 'Highlight color', txtScheme22: 'New Office', textTabTransitions: 'Transitions', - textRecentlyUsed: 'Recently Used' + textRecentlyUsed: 'Recently Used', + txtDuplicateSlide: 'Duplicate Slide' } }()), PE.Views.Toolbar || {})); }); \ No newline at end of file diff --git a/apps/presentationeditor/main/locale/en.json b/apps/presentationeditor/main/locale/en.json index 255f49e3a..4d79b7288 100644 --- a/apps/presentationeditor/main/locale/en.json +++ b/apps/presentationeditor/main/locale/en.json @@ -1987,6 +1987,7 @@ "PE.Views.Toolbar.txtSlideAlign": "Align to Slide", "PE.Views.Toolbar.txtUngroup": "Ungroup", "PE.Views.Toolbar.textRecentlyUsed": "Recently Used", + "PE.Views.Toolbar.txtDuplicateSlide": "Duplicate Slide", "PE.Views.Transitions.strDelay": "Delay", "PE.Views.Transitions.strDuration": "Duration", "PE.Views.Transitions.strStartOnClick": "Start On Click",