Merge pull request #1717 from ONLYOFFICE/feature/extend-share-btns
Feature/extend share btns
This commit is contained in:
commit
e4de14e31b
|
@ -57,6 +57,16 @@
|
||||||
|
|
||||||
$dlgShare.find('#btn-copyshort').on('click', copytext.bind(this, $dlgShare.find('#id-short-url')));
|
$dlgShare.find('#btn-copyshort').on('click', copytext.bind(this, $dlgShare.find('#id-short-url')));
|
||||||
$dlgShare.find('.share-buttons > span').on('click', function(e){
|
$dlgShare.find('.share-buttons > span').on('click', function(e){
|
||||||
|
if ( window.config ) {
|
||||||
|
const key = $(e.target).attr('data-name');
|
||||||
|
const btn = config.btnsShare[key];
|
||||||
|
if ( btn && btn.getUrl ) {
|
||||||
|
window.open(btn.getUrl(appConfig.shareUrl, appConfig.docTitle), btn.target || '',
|
||||||
|
btn.features || 'menubar=no,toolbar=no,resizable=yes,scrollbars=yes,height=300,width=600');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
var _url;
|
var _url;
|
||||||
switch ($(e.target).attr('data-name')) {
|
switch ($(e.target).attr('data-name')) {
|
||||||
case 'facebook':
|
case 'facebook':
|
||||||
|
|
|
@ -73,6 +73,20 @@ common.view.modals = new(function() {
|
||||||
|
|
||||||
var _$dlg;
|
var _$dlg;
|
||||||
if (name == 'share') {
|
if (name == 'share') {
|
||||||
|
if ( config && config.btnsShare ) {
|
||||||
|
let _btns = [];
|
||||||
|
for (const key of Object.keys(config.btnsShare))
|
||||||
|
_btns.push(`<span class="svg big-${key}" data-name="${key}"></span>`);
|
||||||
|
|
||||||
|
if ( _btns ) {
|
||||||
|
let $sharebox = $(_tplbody_share);
|
||||||
|
$sharebox.find('.autotest').prevAll().remove();
|
||||||
|
$sharebox.eq(1).prepend(_btns.join(''));
|
||||||
|
|
||||||
|
_tplbody_share = $("<div>").append($sharebox).html();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
_$dlg = $(tplDialog
|
_$dlg = $(tplDialog
|
||||||
.replace(/\{title}/, this.txtShare)
|
.replace(/\{title}/, this.txtShare)
|
||||||
.replace(/\{body}/, _tplbody_share)
|
.replace(/\{body}/, _tplbody_share)
|
||||||
|
|
Loading…
Reference in a new issue