Browse Source

Enable to handle real enter event, fix #638

pull/640/head
Hironsan 4 years ago
parent
commit
e862ab4f70
1 changed files with 16 additions and 1 deletions
  1. 17
      frontend/components/organisms/annotation/Seq2seqBox.vue

17
frontend/components/organisms/annotation/Seq2seqBox.vue

@ -14,6 +14,8 @@
<v-text-field
v-model="newText"
@keyup.enter="create"
@compositionstart="compositionStart"
@compositionend="compositionEnd"
prepend-inner-icon="mdi-pencil"
label="New text"
autofocus
@ -88,7 +90,9 @@ export default {
align: 'right',
value: 'action'
}
]
],
isComposing: false,
hasCompositionJustEnded: false
}
},
@ -101,10 +105,21 @@ export default {
}
},
create() {
if (this.isComposing || this.hasCompositionJustEnded) {
this.hasCompositionJustEnded = false
return
}
if (this.newText.length > 0) {
this.createAnnotation(this.newText)
this.newText = ''
}
},
compositionStart() {
this.isComposing = true
},
compositionEnd() {
this.isComposing = false
this.hasCompositionJustEnded = true
}
}
}

Loading…
Cancel
Save