preventing esc and enter from interfering

This commit is contained in:
Giga Chubinidze 2023-12-08 16:20:02 +04:00
parent 18380402fc
commit 3dd3b00b06

View file

@ -14,7 +14,7 @@
v-model="newValue"
@keydown="handleKeypress"
@blur="handleBlur"
@keyup.escape="cancelEdit"
@keyup.escape="cancelEdit && this.atWhoOpened"
@focus="setCaretAtEnd"/>
<textarea v-else
ref="input"
@ -28,7 +28,7 @@
v-model="newValue"
@keydown="handleKeypress"
@blur="handleBlur"
@keyup.escape="cancelEdit"
@keyup.escape="cancelEdit && this.atWhoOpened"
@focus="setCaretAtEnd"/>
</template>
<div
@ -240,6 +240,9 @@
sel.collapse(sel.anchorNode, offset);
},
handleKeypress(e) {
this.atWhoOpened = $('.atwho-view:visible').length > 0
if (this.atWhoOpened) return;
if (e.key == 'Escape') {
this.cancelEdit();
} else if (e.key == 'Enter' && this.saveOnEnter && e.shiftKey == false) {