diff options
author | Julia Kirschenheuter <6078378+JuliaKirschenheuter@users.noreply.github.com> | 2022-05-30 16:18:28 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-05-30 16:18:28 +0200 |
commit | 6ee9501ac0a7a1de7dc26f3b0ed519ebbec6867f (patch) | |
tree | 91f4c74eb331fc813559528e761c13f78b7f0bf1 /src | |
parent | 45d91895f9ce06672c0076a218bc5d8c11ed85fd (diff) | |
parent | 310c5c94a256dfdd534ae44b5d2c8c5a71e03a41 (diff) |
Merge pull request #2737 from MrPompom/reset-props-value
Make sure all the fiels are blank when a new contact is created
Diffstat (limited to 'src')
-rw-r--r-- | src/components/ContactDetails/ContactDetailsAddNewProp.vue | 6 | ||||
-rw-r--r-- | src/views/Contacts.vue | 6 |
2 files changed, 10 insertions, 2 deletions
diff --git a/src/components/ContactDetails/ContactDetailsAddNewProp.vue b/src/components/ContactDetails/ContactDetailsAddNewProp.vue index 7774b192..aafdfd7c 100644 --- a/src/components/ContactDetails/ContactDetailsAddNewProp.vue +++ b/src/components/ContactDetails/ContactDetailsAddNewProp.vue @@ -116,7 +116,11 @@ export default { this.contact.vCard.addProperty(property) } else { const defaultData = this.properties[id].defaultValue - const property = this.contact.vCard.addPropertyWithValue(id, defaultData ? defaultData.value : '') + let defaultValue = defaultData ? defaultData.value : '' + if (Array.isArray(defaultValue)) { + defaultValue = [...defaultValue] + } + const property = this.contact.vCard.addPropertyWithValue(id, defaultValue) if (defaultData && defaultData.type) { property.setParameter('type', defaultData.type) } diff --git a/src/views/Contacts.vue b/src/views/Contacts.vue index 78420b38..b323674c 100644 --- a/src/views/Contacts.vue +++ b/src/views/Contacts.vue @@ -275,8 +275,12 @@ export default { for (const name in properties) { if (properties[name].default) { const defaultData = properties[name].defaultValue + let defaultValue = defaultData.value + if (Array.isArray(defaultValue)) { + defaultValue = [...defaultValue] + } // add default field - const property = contact.vCard.addPropertyWithValue(name, defaultData.value) + const property = contact.vCard.addPropertyWithValue(name, defaultValue) // add default type if (defaultData.type) { property.setParameter('type', defaultData.type) |