1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-23 03:33:54 +00:00

use navigator.clipboard to copy text if available

This commit is contained in:
Kyle Spearrin
2018-08-13 09:44:59 -04:00
parent 2a9cd36a01
commit ada83aae8f
6 changed files with 23 additions and 15 deletions

View File

@@ -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);
}