mirror of
https://github.com/bitwarden/browser
synced 2025-12-18 01:03:35 +00:00
[PM-17598] Long custom fields (#13668)
* add custom directive to use the angular CDK resize textarea directive * swap to textarea to allow for full content to be shown when view text or hidden custom fields * add text-field styling to web sass file * move angular import to CL scss file * add `textarea` to selector to enforce directive usage only on textareas
This commit is contained in:
@@ -23,6 +23,8 @@ import {
|
||||
CheckboxModule,
|
||||
} from "@bitwarden/components";
|
||||
|
||||
import { VaultAutosizeReadOnlyTextArea } from "../../directives/readonly-textarea.directive";
|
||||
|
||||
@Component({
|
||||
selector: "app-custom-fields-v2",
|
||||
templateUrl: "custom-fields-v2.component.html",
|
||||
@@ -38,6 +40,7 @@ import {
|
||||
SectionHeaderComponent,
|
||||
TypographyModule,
|
||||
CheckboxModule,
|
||||
VaultAutosizeReadOnlyTextArea,
|
||||
],
|
||||
})
|
||||
export class CustomFieldV2Component implements OnInit {
|
||||
@@ -45,6 +48,9 @@ export class CustomFieldV2Component implements OnInit {
|
||||
fieldType = FieldType;
|
||||
fieldOptions: any;
|
||||
|
||||
/** Indexes of hidden fields that are revealed */
|
||||
revealedHiddenFields: number[] = [];
|
||||
|
||||
constructor(
|
||||
private i18nService: I18nService,
|
||||
private eventCollectionService: EventCollectionService,
|
||||
@@ -63,7 +69,13 @@ export class CustomFieldV2Component implements OnInit {
|
||||
return this.cipher.viewPassword;
|
||||
}
|
||||
|
||||
async logHiddenEvent(hiddenFieldVisible: boolean) {
|
||||
async toggleHiddenField(hiddenFieldVisible: boolean, index: number) {
|
||||
if (hiddenFieldVisible) {
|
||||
this.revealedHiddenFields.push(index);
|
||||
} else {
|
||||
this.revealedHiddenFields = this.revealedHiddenFields.filter((i) => i !== index);
|
||||
}
|
||||
|
||||
if (hiddenFieldVisible) {
|
||||
await this.eventCollectionService.collect(
|
||||
EventType.Cipher_ClientToggledHiddenFieldVisible,
|
||||
|
||||
Reference in New Issue
Block a user