diff --git a/app/javascript/template_builder/builder.vue b/app/javascript/template_builder/builder.vue index b0185da4..a1d8951a 100644 --- a/app/javascript/template_builder/builder.vue +++ b/app/javascript/template_builder/builder.vue @@ -321,6 +321,7 @@ export default { backgroundColor: this.backgroundColor, withPhone: this.withPhone, withPayment: this.withPayment, + defaultDrawFieldType: this.defaultDrawFieldType, selectedAreaRef: computed(() => this.selectedAreaRef) } }, @@ -364,6 +365,11 @@ export default { required: false, default: () => [] }, + defaultDrawFieldType: { + type: String, + required: false, + default: 'text' + }, currencies: { type: Array, required: false, @@ -755,7 +761,9 @@ export default { let type = (pageMask.clientWidth * area.w) < 35 ? 'checkbox' : 'text' - if (this.fieldTypes.length !== 0 && !this.fieldTypes.includes(type)) { + if (this.defaultDrawFieldType && this.defaultDrawFieldType !== 'text') { + type = this.defaultDrawFieldType + } else if (this.fieldTypes.length !== 0 && !this.fieldTypes.includes(type)) { type = this.fieldTypes[0] } diff --git a/app/javascript/template_builder/page.vue b/app/javascript/template_builder/page.vue index 8a32539e..88bcc9be 100644 --- a/app/javascript/template_builder/page.vue +++ b/app/javascript/template_builder/page.vue @@ -61,7 +61,7 @@ export default { components: { FieldArea }, - inject: ['fieldTypes'], + inject: ['fieldTypes', 'defaultDrawFieldType'], props: { image: { type: Object, @@ -123,7 +123,9 @@ export default { }, computed: { defaultFieldType () { - if (this.fieldTypes.length !== 0 && !this.fieldTypes.includes('text')) { + if (this.defaultDrawFieldType && this.defaultDrawFieldType !== 'text') { + return this.defaultDrawFieldType + } else if (this.fieldTypes.length !== 0 && !this.fieldTypes.includes('text')) { return this.fieldTypes[0] } else { return 'text'