Merge pull request #16843 from backstage/freben/transient
Make the "Copied!" message disappear automatically after some time
This commit is contained in:
@@ -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 && [
|
||||
|
||||
Reference in New Issue
Block a user