mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
[ADF-4391] Doc review for 3.2 (#4601)
* [ADF-4391] Reviewed new clipboard class docs * [ADF-4391] Reviewed new proc cloud class docs * [ADF-4391] Reviewed new datatable doc additions
This commit is contained in:
committed by
Eugenio Romano
parent
16aaa0f0b3
commit
921fdc00df
@@ -28,6 +28,11 @@ export class ClipboardService {
|
||||
private logService: LogService,
|
||||
private notificationService: NotificationService) {}
|
||||
|
||||
/**
|
||||
* Checks if the target element can have its text copied.
|
||||
* @param target Target HTML element
|
||||
* @returns True if the text can be copied, false otherwise
|
||||
*/
|
||||
isTargetValid(target: HTMLInputElement | HTMLTextAreaElement) {
|
||||
if (target instanceof HTMLInputElement || target instanceof HTMLTextAreaElement) {
|
||||
return !target.hasAttribute('disabled');
|
||||
@@ -35,6 +40,11 @@ export class ClipboardService {
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Copies text from an HTML element to the clipboard.
|
||||
* @param target HTML element to be copied
|
||||
* @param message Snackbar message to alert when copying happens
|
||||
*/
|
||||
copyToClipboard(target: HTMLInputElement | HTMLTextAreaElement, message?: string) {
|
||||
if (this.isTargetValid(target)) {
|
||||
try {
|
||||
@@ -48,6 +58,11 @@ export class ClipboardService {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Copies a text string to the clipboard.
|
||||
* @param content Text to copy
|
||||
* @param message Snackbar message to alert when copying happens
|
||||
*/
|
||||
copyContentToClipboard(content: string, message: string) {
|
||||
try {
|
||||
document.addEventListener('copy', (e: ClipboardEvent) => {
|
||||
|
Reference in New Issue
Block a user