Skip to content

Commit

Permalink
Merge pull request #4254 from corentin-soriano/copy_item_link
Browse files Browse the repository at this point in the history
BUGFIX - Don't close item view when using copy item link.
  • Loading branch information
nilsteampassnet authored Aug 25, 2024
2 parents e46e15c + e281f1a commit f5aa54d
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 23 deletions.
36 changes: 14 additions & 22 deletions pages/items.js.php
Original file line number Diff line number Diff line change
Expand Up @@ -1019,6 +1019,20 @@ function(teampassItem) {
//
// > END <
//
} else if ($(this).data('item-action') === 'link') {
// Add link to clipboard.
navigator.clipboard.writeText("<?php echo $SETTINGS['cpassman_url'];?>/index.php?page=items&group="+store.get('teampassItem').folderId+"&id="+store.get('teampassItem').id);

// Display message.
toastr.remove();
toastr.info(
'<?php echo $lang->get('copy_to_clipboard'); ?>',
'', {
timeOut: 2000,
progressBar: true,
positionClass: 'toast-top-right'
}
);
}

return false;
Expand Down Expand Up @@ -5061,28 +5075,6 @@ function(teampassItem) {
// Waiting
$('#card-item-attachments').html("<?php echo $lang->get('please_wait'); ?>");

// Manage clipboard for link
if (clipboardForLink) clipboardForLink.destroy();
clipboardForLink = new ClipboardJS(
'#get_item_link',
{
text: function(e) {
return ("<?php echo $SETTINGS['cpassman_url'];?>/index.php?page=items&group="+store.get('teampassItem').folderId+"&id="+store.get('teampassItem').id);
}
})
.on('success', function(e) {
toastr.remove();
toastr.info(
'<?php echo $lang->get('copy_to_clipboard'); ?>',
'', {
timeOut: 2000,
progressBar: true,
positionClass: 'toast-top-right'
}
);
e.clearSelection();
});

// Manage clipboard button
if (itemClipboard) itemClipboard.destroy();
itemClipboard = new ClipboardJS('.btn-copy-clipboard-clear', {
Expand Down
2 changes: 1 addition & 1 deletion pages/items.php
Original file line number Diff line number Diff line change
Expand Up @@ -589,7 +589,7 @@
<a class="text-navy tp-action ml-3" href="#" data-item-action="copy"><i class="fa-regular fa-copy mr-1"></i><small><?php echo $lang->get('copy'); ?></small></a>
</li>
<li class="nav-item">
<a class="text-navy ml-3" href="#" data-item-action="link" id="get_item_link"><i class="fa-solid fa-link mr-1"></i><small><?php echo $lang->get('link'); ?></small></a>
<a class="text-navy tp-action ml-3" href="#" data-item-action="link" id="get_item_link"><i class="fa-solid fa-link mr-1"></i><small><?php echo $lang->get('link'); ?></small></a>
</li>
<li class="nav-item">
<a class="text-navy tp-action ml-3" href="#" data-item-action="share"><i class="fa-regular fa-share-square mr-1"></i><small><?php echo $lang->get('share'); ?></small></a>
Expand Down

0 comments on commit f5aa54d

Please sign in to comment.