1
0
mirror of https://github.com/bitwarden/browser synced 2026-01-08 03:23:50 +00:00

[Linked fields] Add Linked Field as a custom field type (#1963)

* Proof of concept for Linked custom field type

* Linked Fields for all cipher types, use dropdown

* Fix linked icon alignment

* Tweak linked icon alignment and style

* Move add-edit custom fields to own component

* Disable copy for linked field

* Use Field.LinkedId to store linked field info
This commit is contained in:
Thomas Rittson
2021-11-04 07:40:42 +10:00
committed by GitHub
parent f20a1e7424
commit 2113c709a4
8 changed files with 50 additions and 10 deletions

View File

@@ -12,6 +12,7 @@ import { EventType } from 'jslib-common/enums/eventType';
import { FieldType } from 'jslib-common/enums/fieldType';
import { CipherView } from 'jslib-common/models/view/cipherView';
import { FieldView } from 'jslib-common/models/view/fieldView';
import AutofillField from '../models/autofillField';
import AutofillPageDetails from '../models/autofillPageDetails';
@@ -318,9 +319,16 @@ export default class AutofillService implements AutofillServiceInterface {
const matchingIndex = this.findMatchingFieldIndex(field, fieldNames);
if (matchingIndex > -1) {
let val = fields[matchingIndex].value;
if (val == null && fields[matchingIndex].type === FieldType.Boolean) {
val = 'false';
const matchingField: FieldView = fields[matchingIndex];
let val;
if (matchingField.type === FieldType.Linked) {
// Assumption: Linked Field is not being used to autofill a boolean value
val = options.cipher.linkedFieldValue(matchingField.linkedId);
} else {
val = matchingField.value;
if (val == null && matchingField.type === FieldType.Boolean) {
val = 'false';
}
}
filledFields[field.opid] = field;