[DE] Feature/special paste word.

This commit is contained in:
Julia Radzhabova 2017-05-12 11:52:19 +03:00
parent fc3e317ded
commit d231ef15ac
3 changed files with 72 additions and 1 deletions

View file

@ -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 = $('<div id="special-paste-container" style="position: absolute;"><div id="id-document-holder-btn-special-paste"></div></div>');
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;
@ -3330,7 +3392,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 || {}));
});

View file

@ -856,6 +856,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",

View file

@ -423,3 +423,10 @@
width: 100%;
min-width: 160px;
}
#special-paste-container {
position: absolute;
z-index: @zindex-dropdown - 20;
background-color: @gray-light;
border: 1px solid @gray;
}