Fixes the copy action.

This commit is contained in:
yanas 2016-09-22 18:17:37 -05:00
parent 644faca306
commit b54f92b2ae
2 changed files with 17 additions and 7 deletions

View File

@ -20,15 +20,24 @@ function openLinkDialog () {
inviteAttributes = "value=\"" + encodeURI(roomUrl) + "\"";
}
let inviteLinkId = "inviteLinkRef";
let focusInviteLink = function() {
$('#' + inviteLinkId).focus();
$('#' + inviteLinkId).select();
};
let title = APP.translation.generateTranslationHTML("dialog.shareLink");
APP.UI.messageHandler.openTwoButtonDialog(
null, title, null,
'<input id="inviteLinkRef" type="text" '
'<input id="' + inviteLinkId + '" type="text" '
+ inviteAttributes + ' readonly/>',
false, "dialog.copy",
function (e, v) {
if (v && roomUrl) {
JitsiMeetJS.analytics.sendEvent('toolbar.invite.button');
focusInviteLink();
document.execCommand('copy');
}
else {
@ -36,20 +45,21 @@ function openLinkDialog () {
}
},
function (event) {
if (roomUrl) {
$('#inviteLinkRef').focus();
$('#inviteLinkRef').select();
} else {
if (!roomUrl) {
if (event && event.target) {
$(event.target).find('button[value=true]')
.prop('disabled', true);
}
}
else {
focusInviteLink();
}
},
function (e, v, m, f) {
if(!v && !m && !f)
JitsiMeetJS.analytics.sendEvent('toolbar.invite.close');
}
},
'Copy' // Focus Copy button.
);
}

View File

@ -108,7 +108,7 @@ var messageHandler = {
persistent: false,
buttons: buttons,
defaultButton: defaultButton,
focus: (focus && focus >= 0) ? focus : -1,
focus: (focus) ? focus : '',
loaded: loadedFunction,
submit: function (e, v, m, f) {
twoButtonDialog = null;