diff --git a/apps/documenteditor/main/app/view/DocumentHolder.js b/apps/documenteditor/main/app/view/DocumentHolder.js index b29869844..109e7d5a4 100644 --- a/apps/documenteditor/main/app/view/DocumentHolder.js +++ b/apps/documenteditor/main/app/view/DocumentHolder.js @@ -574,6 +574,65 @@ define([ /** coauthoring end **/ }; + 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.paste] = me.textPaste; + 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(); + }; + var onDialogAddHyperlink = function() { var win, props, text; if (me.api && me.mode.isEdit){ @@ -1438,6 +1497,9 @@ define([ this.api.asc_registerCallback('asc_onShowForeignCursorLabel', _.bind(onShowForeignCursorLabel, this)); this.api.asc_registerCallback('asc_onHideForeignCursorLabel', _.bind(onHideForeignCursorLabel, this)); this.api.asc_registerCallback('asc_onFocusObject', _.bind(onFocusObject, this)); + this.api.asc_registerCallback('asc_onShowSpecialPasteOptions', _.bind(onShowSpecialPasteOptions, this)); + this.api.asc_registerCallback('asc_onHideSpecialPasteOptions', _.bind(onHideSpecialPasteOptions, this)); + } return this; @@ -3338,7 +3400,8 @@ define([ txtAlignToChar: 'Align to character', txtDeleteRadical: 'Delete radical', txtDeleteChars: 'Delete enclosing characters', - txtDeleteCharsAndSeparators: 'Delete enclosing characters and separators' + txtDeleteCharsAndSeparators: 'Delete enclosing characters and separators', + txtKeepTextOnly: 'Keep text only' }, DE.Views.DocumentHolder || {})); }); \ No newline at end of file diff --git a/apps/documenteditor/main/locale/en.json b/apps/documenteditor/main/locale/en.json index 4ab3363d7..2edaf034b 100644 --- a/apps/documenteditor/main/locale/en.json +++ b/apps/documenteditor/main/locale/en.json @@ -835,6 +835,7 @@ "DE.Views.DocumentHolder.txtUngroup": "Ungroup", "DE.Views.DocumentHolder.updateStyleText": "Update %1 style", "DE.Views.DocumentHolder.vertAlignText": "Vertical Alignment", + "DE.Views.DocumentHolder.txtKeepTextOnly": "Keep text only", "DE.Views.DropcapSettingsAdvanced.cancelButtonText": "Cancel", "DE.Views.DropcapSettingsAdvanced.okButtonText": "Ok", "DE.Views.DropcapSettingsAdvanced.strBorders": "Borders & Fill", diff --git a/apps/documenteditor/main/resources/less/toolbar.less b/apps/documenteditor/main/resources/less/toolbar.less index f29f73763..98097e47a 100644 --- a/apps/documenteditor/main/resources/less/toolbar.less +++ b/apps/documenteditor/main/resources/less/toolbar.less @@ -438,3 +438,10 @@ background-position: @plus-offset-x @plus-offset-y - 16; } } + +#special-paste-container { + position: absolute; + z-index: @zindex-dropdown - 20; + background-color: @gray-light; + border: 1px solid @gray; +} \ No newline at end of file