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

[PM-10437][PM-10438] Copy toast message (#10366)

* add option to include a label for copy success message

* add label text to copy success messages for all cipher types
This commit is contained in:
Nick Krantz
2024-08-05 13:00:29 -05:00
committed by GitHub
parent cecfbaeaad
commit 8fcf717ec4
6 changed files with 50 additions and 2 deletions

View File

@@ -20,6 +20,12 @@ export class CopyClickDirective {
@Input("appCopyClick") valueToCopy = "";
/**
* When set, the toast displayed will show `<valueLabel> copied`
* instead of the default messaging.
*/
@Input() valueLabel: string;
/**
* When set without a value, a success toast will be shown when the value is copied
* @example
@@ -47,10 +53,14 @@ export class CopyClickDirective {
this.platformUtilsService.copyToClipboard(this.valueToCopy);
if (this._showToast) {
const message = this.valueLabel
? this.i18nService.t("valueCopied", this.valueLabel)
: this.i18nService.t("copySuccessful");
this.toastService.showToast({
variant: this.toastVariant,
title: null,
message: this.i18nService.t("copySuccessful"),
message,
});
}
}