Merge pull request #27 from ONLYOFFICE/feature/pe-special-paste
[PE] Added special paste.
This commit is contained in:
commit
c2bee20782
|
@ -1520,6 +1520,66 @@ define([
|
||||||
me._state.themeLock = false;
|
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 = $('<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();
|
||||||
|
};
|
||||||
|
|
||||||
this.setApi = function(o) {
|
this.setApi = function(o) {
|
||||||
me.api = o;
|
me.api = o;
|
||||||
|
|
||||||
|
@ -1541,6 +1601,9 @@ define([
|
||||||
me.api.asc_registerCallback('asc_onDialogAddHyperlink', _.bind(onDialogAddHyperlink, me));
|
me.api.asc_registerCallback('asc_onDialogAddHyperlink', _.bind(onDialogAddHyperlink, me));
|
||||||
me.api.asc_registerCallback('asc_doubleClickOnChart', onDoubleClickOnChart);
|
me.api.asc_registerCallback('asc_doubleClickOnChart', onDoubleClickOnChart);
|
||||||
me.api.asc_registerCallback('asc_onSpellCheckVariantsFound', _.bind(onSpellCheckVariantsFound, me));
|
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));
|
me.api.asc_registerCallback('asc_onCoAuthoringDisconnect', _.bind(onCoAuthoringDisconnect, me));
|
||||||
Common.NotificationCenter.on('api:disconnect', _.bind(onCoAuthoringDisconnect, me));
|
Common.NotificationCenter.on('api:disconnect', _.bind(onCoAuthoringDisconnect, me));
|
||||||
|
@ -3316,7 +3379,10 @@ define([
|
||||||
langText: 'Select Language',
|
langText: 'Select Language',
|
||||||
textUndo: 'Undo',
|
textUndo: 'Undo',
|
||||||
txtSlideHide: 'Hide Slide',
|
txtSlideHide: 'Hide Slide',
|
||||||
txtChangeTheme: 'Change Theme'
|
txtChangeTheme: 'Change Theme',
|
||||||
|
txtKeepTextOnly: 'Keep text only',
|
||||||
|
txtPastePicture: 'Picture',
|
||||||
|
txtPasteSourceFormat: 'Keep Source formatting'
|
||||||
|
|
||||||
}, PE.Views.DocumentHolder || {}));
|
}, PE.Views.DocumentHolder || {}));
|
||||||
});
|
});
|
|
@ -854,6 +854,9 @@
|
||||||
"PE.Views.DocumentHolder.txtUnderbar": "Bar under text",
|
"PE.Views.DocumentHolder.txtUnderbar": "Bar under text",
|
||||||
"PE.Views.DocumentHolder.txtUngroup": "Ungroup",
|
"PE.Views.DocumentHolder.txtUngroup": "Ungroup",
|
||||||
"PE.Views.DocumentHolder.vertAlignText": "Vertical Alignment",
|
"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.goToSlideText": "Go to Slide",
|
||||||
"PE.Views.DocumentPreview.slideIndexText": "Slide {0} of {1}",
|
"PE.Views.DocumentPreview.slideIndexText": "Slide {0} of {1}",
|
||||||
"PE.Views.DocumentPreview.txtClose": "Close slideshow",
|
"PE.Views.DocumentPreview.txtClose": "Close slideshow",
|
||||||
|
|
|
@ -352,4 +352,11 @@
|
||||||
.separator:first-child {
|
.separator:first-child {
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#special-paste-container {
|
||||||
|
position: absolute;
|
||||||
|
z-index: @zindex-dropdown - 20;
|
||||||
|
background-color: @gray-light;
|
||||||
|
border: 1px solid @gray;
|
||||||
}
|
}
|
Loading…
Reference in a new issue