diff --git a/app/javascript/template_builder/contenteditable.vue b/app/javascript/template_builder/contenteditable.vue index 1ee20ddb..c17724fb 100644 --- a/app/javascript/template_builder/contenteditable.vue +++ b/app/javascript/template_builder/contenteditable.vue @@ -179,8 +179,11 @@ export default { }, onBlur (e) { setTimeout(() => { - this.value = this.$refs.contenteditable.innerText.trim() || this.modelValue - this.$emit('update:model-value', this.value) + if (this.$refs.contenteditable) { + this.value = this.$refs.contenteditable.innerText.trim() || this.modelValue + this.$emit('update:model-value', this.value) + } + this.$emit('blur', e) this.isEditable = false diff --git a/app/javascript/template_builder/document.vue b/app/javascript/template_builder/document.vue index 040f6edb..fea0ed05 100644 --- a/app/javascript/template_builder/document.vue +++ b/app/javascript/template_builder/document.vue @@ -180,7 +180,15 @@ export default { methods: { scrollToArea (area) { this.$nextTick(() => { - this.pageRefs[area.page].areaRefs.find((e) => e.area === area).$el.scrollIntoView({ behavior: 'smooth', block: 'center' }) + const pageRef = this.pageRefs[area.page] + + if (pageRef && pageRef.areaRefs) { + const areaRef = pageRef.areaRefs.find((e) => e.area === area) + + if (areaRef && areaRef.$el) { + areaRef.$el.scrollIntoView({ behavior: 'smooth', block: 'center' }) + } + } }) }, setPageRefs (el) { diff --git a/app/javascript/template_builder/upload.vue b/app/javascript/template_builder/upload.vue index 5f4faa57..813ce12e 100644 --- a/app/javascript/template_builder/upload.vue +++ b/app/javascript/template_builder/upload.vue @@ -290,7 +290,11 @@ export default { if (resp.ok) { resp.json().then((data) => { this.$emit('success', data) - this.$refs.input.value = '' + + if (this.$refs.input) { + this.$refs.input.value = '' + } + this.isLoading = false }) } else if (resp.status === 422) {