1
0
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:
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

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

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