Copies text to the clipboard.

Class members

Methods

  • copyContentToClipboard(content: string, message: string)
    Copies a text string to the clipboard.
    • content: string - Text to copy
    • message: string - Snackbar message to alert when copying happens
  • copyToClipboard(target: HTMLInputElement|HTMLTextAreaElement, message?: string)
    Copies text from an HTML element to the clipboard.
  • isTargetValid(target: HTMLInputElement|HTMLTextAreaElement): boolean
    Checks if the target element can have its text copied.

Details

Use copyContentToClipboard to copy a text string or isTargetValid and copyToClipboard to copy the content of an HTML element in the page. The message parameter specifies a snackbar message to alert the user when the copying operation takes place.

See also

© 2023 Alfresco Software, Inc. All Rights Reserved.