Merge pull request #1717 from ONLYOFFICE/feature/extend-share-btns

Feature/extend share btns
This commit is contained in:
maxkadushkin 2022-04-21 21:04:12 +03:00 committed by GitHub
commit e4de14e31b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 24 additions and 0 deletions

View file

@ -57,6 +57,16 @@
$dlgShare.find('#btn-copyshort').on('click', copytext.bind(this, $dlgShare.find('#id-short-url')));
$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;
switch ($(e.target).attr('data-name')) {
case 'facebook':

View file

@ -73,6 +73,20 @@ common.view.modals = new(function() {
var _$dlg;
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
.replace(/\{title}/, this.txtShare)
.replace(/\{body}/, _tplbody_share)