mirror of
https://github.com/Kareadita/Kavita.git
synced 2025-07-09 03:04:19 -04:00
Fix for 3rd Party Clients copy button (#962)
* Fix for 3rd Party Clients copy button # Fixed - Fixed: Fixed an issue where the copy button wasn't working on the "3rd Party Clients" page. * Updating as per review request * Buttoning up to be inline with spec
This commit is contained in:
parent
39a7bd4dc3
commit
506061094d
@ -4,6 +4,7 @@ import { Subject } from 'rxjs';
|
|||||||
import { take, takeUntil } from 'rxjs/operators';
|
import { take, takeUntil } from 'rxjs/operators';
|
||||||
import { ConfirmService } from 'src/app/shared/confirm.service';
|
import { ConfirmService } from 'src/app/shared/confirm.service';
|
||||||
import { AccountService } from 'src/app/_services/account.service';
|
import { AccountService } from 'src/app/_services/account.service';
|
||||||
|
import { Clipboard } from '@angular/cdk/clipboard';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-api-key',
|
selector: 'app-api-key',
|
||||||
@ -21,7 +22,7 @@ export class ApiKeyComponent implements OnInit, OnDestroy {
|
|||||||
private readonly onDestroy = new Subject<void>();
|
private readonly onDestroy = new Subject<void>();
|
||||||
|
|
||||||
|
|
||||||
constructor(private confirmService: ConfirmService, private accountService: AccountService, private toastr: ToastrService) { }
|
constructor(private confirmService: ConfirmService, private accountService: AccountService, private toastr: ToastrService, private clipboard: Clipboard) { }
|
||||||
|
|
||||||
ngOnInit(): void {
|
ngOnInit(): void {
|
||||||
this.accountService.currentUser$.pipe(takeUntil(this.onDestroy)).subscribe(user => {
|
this.accountService.currentUser$.pipe(takeUntil(this.onDestroy)).subscribe(user => {
|
||||||
@ -44,7 +45,9 @@ export class ApiKeyComponent implements OnInit, OnDestroy {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async copy() {
|
async copy() {
|
||||||
await navigator.clipboard.writeText(this.key);
|
this.inputElem.nativeElement.select();
|
||||||
|
this.clipboard.copy(this.inputElem.nativeElement.value);
|
||||||
|
this.inputElem.nativeElement.setSelectionRange(0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
async refresh() {
|
async refresh() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user