From 1d7360bfdd36248f19aa048bd1012353e2c6f3b9 Mon Sep 17 00:00:00 2001 From: Dave Nicolson Date: Fri, 1 Sep 2023 12:06:49 +0200 Subject: [PATCH] [PS-1438] Prevent new line feed when selecting and copying passwords (#3460) * Prevent new line feed when selecting password * Prevent new line feed when copying password --- apps/desktop/src/scss/misc.scss | 1 - libs/angular/src/directives/copy-text.directive.ts | 6 +++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/apps/desktop/src/scss/misc.scss b/apps/desktop/src/scss/misc.scss index a72b7754c1..8ed6a9b54b 100644 --- a/apps/desktop/src/scss/misc.scss +++ b/apps/desktop/src/scss/misc.scss @@ -561,7 +561,6 @@ h2, h3, label, a, -button, p, img, .box-header, diff --git a/libs/angular/src/directives/copy-text.directive.ts b/libs/angular/src/directives/copy-text.directive.ts index e3298c214c..b595085e43 100644 --- a/libs/angular/src/directives/copy-text.directive.ts +++ b/libs/angular/src/directives/copy-text.directive.ts @@ -1,5 +1,6 @@ import { Directive, ElementRef, HostListener, Input } from "@angular/core"; +import { ClientType } from "@bitwarden/common/enums"; import { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/platform-utils.service"; @Directive({ @@ -15,6 +16,9 @@ export class CopyTextDirective { return; } - this.platformUtilsService.copyToClipboard(this.copyText, { window: window }); + const timeout = this.platformUtilsService.getClientType() === ClientType.Desktop ? 100 : 0; + setTimeout(() => { + this.platformUtilsService.copyToClipboard(this.copyText, { window: window }); + }, timeout); } }