Files
Tiago Bernardo dcb34524a8 feat: add copy buttons to log message context fields
Each context entry on the log message view gets a copy button that copies
the value and shows a Filament success notification. The global clipboard
success handler clears the text selection and only notifies when the
trigger opts in via data-copy-notify, so the share-store button keeps its
own inline feedback.
2026-10-08 20:24:37 +01:00

25 lines
664 B
JavaScript

import pbChart from "./pbChart.js";
window.pbChart = pbChart;
const clipboard = new ClipboardJS('.copy-to-clipboard');
clipboard.on('success', (event) => {
// ClipboardJS selects the target to run execCommand('copy'); clear the
// highlight once the copy has completed.
event.clearSelection?.();
if (! event.trigger?.hasAttribute('data-copy-notify') || ! window.FilamentNotification) {
return;
}
new window.FilamentNotification()
.title('Copied to clipboard')
.success()
.send();
});
window.copyToClipboard = function (id) {
document.getElementById(id).select();
document.execCommand('copy');
}