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

Loading…
Cancel
Save