Browse Source

Merge pull request #640 from doccano/bugfix/handle-real-enter-event

Enable to handle real enter event, fix #638
pull/647/head
Hiroki Nakayama 4 years ago
committed by GitHub
parent
commit
301ac5156b
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
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