[PE] Add diplicate slide function to add slide menu.

This commit is contained in:
Julia Radzhabova 2021-09-22 22:37:15 +03:00
parent 75aa2d143e
commit 14d1610f4c
3 changed files with 29 additions and 2 deletions

View file

@ -129,6 +129,8 @@ define([
'insert:textart' : this.onInsertTextart.bind(this), 'insert:textart' : this.onInsertTextart.bind(this),
'insert:shape' : this.onInsertShape.bind(this), 'insert:shape' : this.onInsertShape.bind(this),
'add:slide' : this.onAddSlide.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:slide' : this.onChangeSlide.bind(this),
'change:compact' : this.onClickChangeCompact, 'change:compact' : this.onClickChangeCompact,
'add:chart' : this.onSelectChart '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) { onChangeSlide: function(type) {
if (this.api) { if (this.api) {
this.api.ChangeLayout(type); this.api.ChangeLayout(type);

View file

@ -1261,13 +1261,21 @@ define([
btn.setMenu( btn.setMenu(
new Common.UI.Menu({ new Common.UI.Menu({
items: [ items: [
{template: _.template('<div id="id-toolbar-menu-addslide-' + index + '" class="menu-layouts" style="width: 302px; margin: 0 4px;"></div>')} {template: _.template('<div id="id-toolbar-menu-addslide-' + index + '" class="menu-layouts" style="width: 302px; margin: 0 4px;"></div>')},
{caption: '--'},
{
caption: me.txtDuplicateSlide,
value: 'duplicate'
}
] ]
}) })
); );
btn.on('click', function (btn, e) { btn.on('click', function (btn, e) {
me.fireEvent('add:slide'); 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) { if (menu) {
menu.on('show:after', function () { menu.on('show:after', function () {
me.onSlidePickerShowAfter(picker); me.onSlidePickerShowAfter(picker);
!change && me.fireEvent('duplicate:check', [menu]);
picker.scroller.update({alwaysVisibleY: true}); picker.scroller.update({alwaysVisibleY: true});
if (change) { if (change) {
var record = picker.store.findLayoutByIndex(picker.options.layout_index); var record = picker.store.findLayoutByIndex(picker.options.layout_index);
@ -1919,7 +1928,8 @@ define([
tipHighlightColor: 'Highlight color', tipHighlightColor: 'Highlight color',
txtScheme22: 'New Office', txtScheme22: 'New Office',
textTabTransitions: 'Transitions', textTabTransitions: 'Transitions',
textRecentlyUsed: 'Recently Used' textRecentlyUsed: 'Recently Used',
txtDuplicateSlide: 'Duplicate Slide'
} }
}()), PE.Views.Toolbar || {})); }()), PE.Views.Toolbar || {}));
}); });

View file

@ -1987,6 +1987,7 @@
"PE.Views.Toolbar.txtSlideAlign": "Align to Slide", "PE.Views.Toolbar.txtSlideAlign": "Align to Slide",
"PE.Views.Toolbar.txtUngroup": "Ungroup", "PE.Views.Toolbar.txtUngroup": "Ungroup",
"PE.Views.Toolbar.textRecentlyUsed": "Recently Used", "PE.Views.Toolbar.textRecentlyUsed": "Recently Used",
"PE.Views.Toolbar.txtDuplicateSlide": "Duplicate Slide",
"PE.Views.Transitions.strDelay": "Delay", "PE.Views.Transitions.strDelay": "Delay",
"PE.Views.Transitions.strDuration": "Duration", "PE.Views.Transitions.strDuration": "Duration",
"PE.Views.Transitions.strStartOnClick": "Start On Click", "PE.Views.Transitions.strStartOnClick": "Start On Click",