mirror of
https://github.com/bitwarden/browser
synced 2025-12-15 15:53:27 +00:00
use navigator.clipboard to copy text if available
This commit is contained in:
@@ -52,7 +52,7 @@ export class ActionButtonsComponent {
|
||||
}
|
||||
|
||||
this.analytics.eventTrack.next({ action: 'Copied ' + aType });
|
||||
this.platformUtilsService.copyToClipboard(value, { doc: window.document });
|
||||
this.platformUtilsService.copyToClipboard(value, { window: window });
|
||||
this.toasterService.popAsync('info', null,
|
||||
this.i18nService.t('valueCopied', this.i18nService.t(typeI18nKey)));
|
||||
}
|
||||
|
||||
@@ -146,7 +146,7 @@ export class CurrentTabComponent implements OnInit, OnDestroy {
|
||||
this.totpCode = totpCode;
|
||||
this.analytics.eventTrack.next({ action: 'Autofilled' });
|
||||
if (totpCode != null && !this.platformUtilsService.isSafari()) {
|
||||
this.platformUtilsService.copyToClipboard(totpCode, { doc: window.document });
|
||||
this.platformUtilsService.copyToClipboard(totpCode, { window: window });
|
||||
}
|
||||
|
||||
if (this.popupUtilsService.inPopup(window)) {
|
||||
@@ -164,7 +164,7 @@ export class CurrentTabComponent implements OnInit, OnDestroy {
|
||||
if (cipher.type === CipherType.Login && this.platformUtilsService.isSafari()) {
|
||||
this.totpTimeout = window.setTimeout(() => {
|
||||
if (this.totpCode != null) {
|
||||
this.platformUtilsService.copyToClipboard(this.totpCode, { doc: window.document });
|
||||
this.platformUtilsService.copyToClipboard(this.totpCode, { window: window });
|
||||
}
|
||||
}, 500);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user