diff --git a/app/javascript/template_builder/area.vue b/app/javascript/template_builder/area.vue index 4676cede..0b38e765 100644 --- a/app/javascript/template_builder/area.vue +++ b/app/javascript/template_builder/area.vue @@ -65,6 +65,7 @@ dir="auto" class="pr-1 cursor-text outline-none block" style="min-width: 2px" + @paste.prevent="onPaste" @keydown.enter.prevent="onNameEnter" @focus="onNameFocus" @blur="onNameBlur" @@ -191,6 +192,7 @@ :class="{ 'cursor-text': isContenteditable }" :placeholder="t('type_value')" @blur="onDefaultValueBlur" + @paste.prevent="onPaste" @keydown.enter.prevent="onDefaultValueEnter" >{{ field.default_value }} @@ -510,6 +512,9 @@ export default { this.save() }, + onPaste (e) { + e.target.innerText = (e.clipboardData || window.clipboardData).getData('text/plain') + }, onResizeCell (e) { if (e.target.id === 'mask') { const positionX = e.offsetX / (e.target.clientWidth - 1) diff --git a/app/javascript/template_builder/contenteditable.vue b/app/javascript/template_builder/contenteditable.vue index 28ada65f..00c2cad8 100644 --- a/app/javascript/template_builder/contenteditable.vue +++ b/app/javascript/template_builder/contenteditable.vue @@ -10,6 +10,7 @@ style="min-width: 2px" :class="iconInline ? 'inline' : 'block'" class="peer outline-none focus:block" + @paste.prevent="onPaste" @keydown.enter.prevent="blurContenteditable" @focus="$emit('focus', $event)" @blur="onBlur" @@ -97,6 +98,9 @@ export default { } }, methods: { + onPaste (e) { + e.target.innerText = (e.clipboardData || window.clipboardData).getData('text/plain') + }, selectContent () { const el = this.$refs.contenteditable