import { NotificationType } from '@/typings/notifications' ; import { notify as notifyUser } from './message-utils' ; export function copyToClipboard ( value , container , notify , message = 'Copied to Clipboard' , detailMessage = '' ) { const textArea = document . createElement ( 'textarea' ) ; textArea . value = value ; container . appendChild ( textArea ) ; textArea . select ( ) ; try { document . execCommand ( 'copy' ) ; } catch ( err ) { } container . removeChild ( textArea ) ; if ( notify ) { notifyUser ( NotificationType . Success , message , detailMessage ) ; } }