Fix multiple tooltip issue

If there are multiple tooltips, they all report the message "copied" because there is no element selection. This fix resolves the issue.
This commit is contained in:
MrM 2024-02-25 14:48:05 +01:00 committed by GitHub
parent b69364d5ff
commit 9475871edb
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -960,7 +960,13 @@
var clipboard = new ClipboardJS('.js-copy-link');
clipboard.on('success', function(e) {
$('.js-copy-link').tooltip('hide').attr('data-original-title', '{{ trans('general.copied') }}').tooltip('show');
// Get the clicked element
var clickedElement = $(e.trigger);
// Get the target element selector from data attribute
var targetSelector = clickedElement.data('data-clipboard-target');
// Find the target element
var targetEl = $(targetSelector);
clickedElement.tooltip('hide').attr('data-original-title', '{{ trans('general.copied') }}').tooltip('show');
});
// ignore: 'input[type=hidden]' is required here to validate the select2 lists