Skip to content

Commit

Permalink
The content is copied after timeout - 100ms
Browse files Browse the repository at this point in the history
  • Loading branch information
milanmajchrak committed Oct 16, 2023
1 parent 1e4ea47 commit 585c1f3
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ <h4 class="modal-title" id="modal-basic-title">{{itemName}}</h4>
{{'item.refbox.modal.copy.instruction.2' | translate}}
</p>
<div class="textarea" ></div>
<textarea #copyCitationModal readonly class="clarin-ref-box-citation-textarea" (mouseover)="selectContent()">{{citationText}}</textarea>
<textarea #copyCitationModal readonly class="clarin-ref-box-citation-textarea">{{citationText}}</textarea>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-outline-dark" (click)="activeModal.close('Save click')">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Component, ElementRef, Input, ViewChild } from '@angular/core';
import { AfterViewInit, Component, ElementRef, Input, ViewChild } from '@angular/core';
import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap';

/**
Expand All @@ -9,7 +9,7 @@ import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap';
templateUrl: './clarin-ref-citation-modal.component.html',
styleUrls: ['./clarin-ref-citation-modal.component.scss']
})
export class ClarinRefCitationModalComponent {
export class ClarinRefCitationModalComponent implements AfterViewInit {

constructor(public activeModal: NgbActiveModal) {
}
Expand All @@ -31,6 +31,12 @@ export class ClarinRefCitationModalComponent {
@Input()
citationText = '';

ngAfterViewInit(): void {
setTimeout(() => {
this.selectContent();
}, 100);
}

selectContent() {
this.citationContentRef?.nativeElement?.select();
}
Expand Down

0 comments on commit 585c1f3

Please sign in to comment.