[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:
Andy Stark
2019-04-12 16:18:43 +01:00
committed by Eugenio Romano
parent 16aaa0f0b3
commit 921fdc00df
16 changed files with 256 additions and 153 deletions

View File

@@ -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) => {