Merge pull request #16843 from backstage/freben/transient

Make the "Copied!" message disappear automatically after some time
This commit is contained in:
Fredrik Adelöw
2023-03-14 13:37:19 +01:00
committed by GitHub
2 changed files with 12 additions and 3 deletions
+5
View File
@@ -0,0 +1,5 @@
---
'@backstage/plugin-catalog': patch
---
Make the "Copied!" message disappear automatically after some time
@@ -90,9 +90,13 @@ export function EntityContextMenu(props: EntityContextMenuProps) {
const alertApi = useApi(alertApiRef);
const copyToClipboard = useCallback(() => {
window.navigator.clipboard
.writeText(window.location.toString())
.then(() => alertApi.post({ message: 'Copied!', severity: 'info' }));
window.navigator.clipboard.writeText(window.location.toString()).then(() =>
alertApi.post({
message: 'Copied!',
severity: 'info',
display: 'transient',
}),
);
}, [alertApi]);
const extraItems = UNSTABLE_extraContextMenuItems && [