diff --git a/apps/presentationeditor/main/app/view/DocumentHolder.js b/apps/presentationeditor/main/app/view/DocumentHolder.js index c7da5d988..da1fd481c 100644 --- a/apps/presentationeditor/main/app/view/DocumentHolder.js +++ b/apps/presentationeditor/main/app/view/DocumentHolder.js @@ -1520,6 +1520,66 @@ define([ me._state.themeLock = false; }; + var onShowSpecialPasteOptions = function(specialPasteShowOptions) { + var coord = specialPasteShowOptions.asc_getCellCoord(), + pasteContainer = me.cmpEl.find('#special-paste-container'), + pasteItems = specialPasteShowOptions.asc_getOptions(); + + // Prepare menu container + if (pasteContainer.length < 1) { + me._arrSpecialPaste = []; + me._arrSpecialPaste[Asc.c_oSpecialPasteProps.sourceformatting] = me.txtPasteSourceFormat; + me._arrSpecialPaste[Asc.c_oSpecialPasteProps.picture] = me.txtPastePicture; + me._arrSpecialPaste[Asc.c_oSpecialPasteProps.keepTextOnly] = me.txtKeepTextOnly; + + pasteContainer = $('
'); + me.cmpEl.append(pasteContainer); + + me.btnSpecialPaste = new Common.UI.Button({ + cls : 'btn-toolbar', + iconCls : 'btn-paste', + menu : new Common.UI.Menu({items: []}) + }); + me.btnSpecialPaste.render($('#id-document-holder-btn-special-paste')) ; + } + + if (pasteItems.length>0) { + var menu = me.btnSpecialPaste.menu; + for (var i = 0; i < menu.items.length; i++) { + menu.removeItem(menu.items[i]); + i--; + } + + var group_prev = -1; + _.each(pasteItems, function(menuItem, index) { + var mnu = new Common.UI.MenuItem({ + caption: me._arrSpecialPaste[menuItem], + value: menuItem, + checkable: true, + toggleGroup : 'specialPasteGroup' + }).on('click', function(item, e) { + me.api.asc_SpecialPaste(item.value); + setTimeout(function(){menu.hide();}, 100); + }); + menu.addItem(mnu); + }); + (menu.items.length>0) && menu.items[0].setChecked(true, true); + } + if (coord.asc_getX()<0 || coord.asc_getY()<0) { + if (pasteContainer.is(':visible')) pasteContainer.hide(); + } else { + var showPoint = [coord.asc_getX() + coord.asc_getWidth() + 3, coord.asc_getY() + coord.asc_getHeight() + 3]; + pasteContainer.css({left: showPoint[0], top : showPoint[1]}); + pasteContainer.show(); + } + }; + + var onHideSpecialPasteOptions = function() { + var pasteContainer = me.cmpEl.find('#special-paste-container'); + if (pasteContainer.is(':visible')) + pasteContainer.hide(); + }; + this.setApi = function(o) { me.api = o; @@ -1541,6 +1601,9 @@ define([ me.api.asc_registerCallback('asc_onDialogAddHyperlink', _.bind(onDialogAddHyperlink, me)); me.api.asc_registerCallback('asc_doubleClickOnChart', onDoubleClickOnChart); me.api.asc_registerCallback('asc_onSpellCheckVariantsFound', _.bind(onSpellCheckVariantsFound, me)); + me.api.asc_registerCallback('asc_onShowSpecialPasteOptions', _.bind(onShowSpecialPasteOptions, me)); + me.api.asc_registerCallback('asc_onHideSpecialPasteOptions', _.bind(onHideSpecialPasteOptions, me)); + } me.api.asc_registerCallback('asc_onCoAuthoringDisconnect', _.bind(onCoAuthoringDisconnect, me)); Common.NotificationCenter.on('api:disconnect', _.bind(onCoAuthoringDisconnect, me)); @@ -3316,7 +3379,10 @@ define([ langText: 'Select Language', textUndo: 'Undo', txtSlideHide: 'Hide Slide', - txtChangeTheme: 'Change Theme' + txtChangeTheme: 'Change Theme', + txtKeepTextOnly: 'Keep text only', + txtPastePicture: 'Picture', + txtPasteSourceFormat: 'Keep Source formatting' }, PE.Views.DocumentHolder || {})); }); \ No newline at end of file diff --git a/apps/presentationeditor/main/locale/en.json b/apps/presentationeditor/main/locale/en.json index ad785e97a..06d676151 100644 --- a/apps/presentationeditor/main/locale/en.json +++ b/apps/presentationeditor/main/locale/en.json @@ -854,6 +854,9 @@ "PE.Views.DocumentHolder.txtUnderbar": "Bar under text", "PE.Views.DocumentHolder.txtUngroup": "Ungroup", "PE.Views.DocumentHolder.vertAlignText": "Vertical Alignment", + "PE.Views.DocumentHolder.txtKeepTextOnly": "Keep text only", + "PE.Views.DocumentHolder.txtPastePicture": "Picture", + "PE.Views.DocumentHolder.txtPasteSourceFormat": "Keep Source formatting", "PE.Views.DocumentPreview.goToSlideText": "Go to Slide", "PE.Views.DocumentPreview.slideIndexText": "Slide {0} of {1}", "PE.Views.DocumentPreview.txtClose": "Close slideshow", diff --git a/apps/presentationeditor/main/resources/less/toolbar.less b/apps/presentationeditor/main/resources/less/toolbar.less index 919a3305e..d0fdeb364 100644 --- a/apps/presentationeditor/main/resources/less/toolbar.less +++ b/apps/presentationeditor/main/resources/less/toolbar.less @@ -352,4 +352,11 @@ .separator:first-child { display: inline-block; } +} + +#special-paste-container { + position: absolute; + z-index: @zindex-dropdown - 20; + background-color: @gray-light; + border: 1px solid @gray; } \ No newline at end of file