mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2026-09-09 18:03:21 +00:00
[ACS-8468] Add guard to copyToClipboard
This commit is contained in:
+5
-2
@@ -30,7 +30,6 @@
|
||||
class="adf-datepicker-span-button"
|
||||
[attr.data-automation-id]="'datepicker-label-toggle-' + property.key"
|
||||
(click)="showDatePicker()"
|
||||
(dblclick)="copyToClipboard(property.displayValue)"
|
||||
tabindex="0"
|
||||
role="button"
|
||||
(keyup.enter)="showDatePicker()"
|
||||
@@ -93,7 +92,10 @@
|
||||
}
|
||||
</mat-form-field>
|
||||
} @else {
|
||||
<mat-form-field class="adf-property-field adf-dateitem-editable" [floatLabel]="property.default ? 'always' : null">
|
||||
<mat-form-field
|
||||
class="adf-property-field adf-dateitem-editable"
|
||||
[floatLabel]="property.default ? 'always' : null"
|
||||
>
|
||||
<mat-label
|
||||
class="adf-property-label"
|
||||
[attr.data-automation-id]="'card-dateitem-label-' + property.key"
|
||||
@@ -121,6 +123,7 @@
|
||||
[attr.data-automation-id]="'datepicker-label-toggle-' + property.key"
|
||||
(click)="showDatePicker()"
|
||||
(dblclick)="copyToClipboard(property.displayValue)"
|
||||
[title]="'CORE.METADATA.ACTIONS.COPY_TO_CLIPBOARD' | translate"
|
||||
tabindex="0"
|
||||
role="button"
|
||||
(keyup.enter)="showDatePicker()"
|
||||
|
||||
+9
-7
@@ -195,14 +195,16 @@ export class CardViewSelectItemComponent extends BaseCardView<CardViewSelectItem
|
||||
}
|
||||
|
||||
copyToClipboard(valueToCopy: string | string[] | Observable<string>) {
|
||||
if (isObservable(valueToCopy)) {
|
||||
valueToCopy.pipe(take(1)).subscribe((value) => {
|
||||
if (this.copyToClipboardAction) {
|
||||
if (isObservable(valueToCopy)) {
|
||||
valueToCopy.pipe(take(1)).subscribe((value) => {
|
||||
const clipboardMessage = this.translateService.instant('CORE.METADATA.ACCESSIBILITY.COPY_TO_CLIPBOARD_MESSAGE');
|
||||
this.clipboardService.copyContentToClipboard(value, clipboardMessage);
|
||||
});
|
||||
} else if (typeof valueToCopy === 'string') {
|
||||
const clipboardMessage = this.translateService.instant('CORE.METADATA.ACCESSIBILITY.COPY_TO_CLIPBOARD_MESSAGE');
|
||||
this.clipboardService.copyContentToClipboard(value, clipboardMessage);
|
||||
});
|
||||
} else if (typeof valueToCopy === 'string') {
|
||||
const clipboardMessage = this.translateService.instant('CORE.METADATA.ACCESSIBILITY.COPY_TO_CLIPBOARD_MESSAGE');
|
||||
this.clipboardService.copyContentToClipboard(valueToCopy, clipboardMessage);
|
||||
this.clipboardService.copyContentToClipboard(valueToCopy, clipboardMessage);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user