mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-06-30 18:15:11 +00:00
[ADF-4405] [ADF-4423] Fix clipboard directive on json cell (#4643)
* [ADF-4405] [ADF-4423] Fix clipboard directive on json cell * [ADF-4405] Fix unit tests * [ADF-4405] Fix e2e test
This commit is contained in:
parent
37f52a139e
commit
f94eb5872a
@ -31,7 +31,7 @@
|
|||||||
readonly="readonly">
|
readonly="readonly">
|
||||||
<mat-icon class="adf-input-action" matSuffix
|
<mat-icon class="adf-input-action" matSuffix
|
||||||
[clipboard-notification]="'SHARE.CLIPBOARD-MESSAGE' | translate"
|
[clipboard-notification]="'SHARE.CLIPBOARD-MESSAGE' | translate"
|
||||||
[adf-clipboard] target="sharedLinkInput">
|
[adf-clipboard] [target]="sharedLinkInput">
|
||||||
link
|
link
|
||||||
</mat-icon>
|
</mat-icon>
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
|
@ -72,11 +72,12 @@ describe('CopyClipboardDirective', () => {
|
|||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'adf-copy-conent-test-component',
|
selector: 'adf-copy-conent-test-component',
|
||||||
template: `<span adf-clipboard>{{ mockText }}</span>`
|
template: `<span adf-clipboard="placeholder">{{ mockText }}</span>`
|
||||||
})
|
})
|
||||||
class TestCopyClipboardComponent {
|
class TestCopyClipboardComponent {
|
||||||
|
|
||||||
mockText = 'text to copy';
|
mockText = 'text to copy';
|
||||||
|
placeholder = 'copy text';
|
||||||
|
|
||||||
@ViewChild(ClipboardDirective)
|
@ViewChild(ClipboardDirective)
|
||||||
clipboardDirective: ClipboardDirective;
|
clipboardDirective: ClipboardDirective;
|
||||||
|
@ -49,9 +49,11 @@ export class ClipboardDirective {
|
|||||||
|
|
||||||
@HostListener('mouseenter')
|
@HostListener('mouseenter')
|
||||||
showTooltip() {
|
showTooltip() {
|
||||||
const componentFactory = this.resolver.resolveComponentFactory(ClipboardComponent);
|
if (this.placeholder) {
|
||||||
const componentRef = this.viewContainerRef.createComponent(componentFactory).instance;
|
const componentFactory = this.resolver.resolveComponentFactory(ClipboardComponent);
|
||||||
componentRef.placeholder = this.placeholder;
|
const componentRef = this.viewContainerRef.createComponent(componentFactory).instance;
|
||||||
|
componentRef.placeholder = this.placeholder;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@HostListener('mouseleave')
|
@HostListener('mouseleave')
|
||||||
|
@ -36,7 +36,7 @@ import { Node } from '@alfresco/js-api';
|
|||||||
template: `
|
template: `
|
||||||
<ng-container>
|
<ng-container>
|
||||||
<span *ngIf="copyContent; else defaultCell"
|
<span *ngIf="copyContent; else defaultCell"
|
||||||
adf-clipboard
|
adf-clipboard="CLIPBOARD.CLICK_TO_COPY"
|
||||||
[clipboard-notification]="'CLIPBOARD.SUCCESS_COPY'"
|
[clipboard-notification]="'CLIPBOARD.SUCCESS_COPY'"
|
||||||
[attr.aria-label]="value$ | async"
|
[attr.aria-label]="value$ | async"
|
||||||
[title]="tooltip"
|
[title]="tooltip"
|
||||||
|
@ -27,9 +27,7 @@ import { DataTableCellComponent } from './datatable-cell.component';
|
|||||||
<pre
|
<pre
|
||||||
class="adf-datatable-json-cell"
|
class="adf-datatable-json-cell"
|
||||||
[adf-clipboard]="'CLIPBOARD.CLICK_TO_COPY'"
|
[adf-clipboard]="'CLIPBOARD.CLICK_TO_COPY'"
|
||||||
[clipboard-notification]="'CLIPBOARD.SUCCESS_COPY'">
|
[clipboard-notification]="'CLIPBOARD.SUCCESS_COPY'">{{ value$ | async | json }}</pre>
|
||||||
{{ value$ | async | json }}
|
|
||||||
</pre>
|
|
||||||
</span>
|
</span>
|
||||||
</ng-container>
|
</ng-container>
|
||||||
<ng-template #defaultJsonTemplate>
|
<ng-template #defaultJsonTemplate>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user