mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2024-12-31 04:32:06 +08:00
preventing esc and enter from interfering
This commit is contained in:
parent
18380402fc
commit
3dd3b00b06
1 changed files with 5 additions and 2 deletions
|
@ -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) {
|
||||
|
|
Loading…
Reference in a new issue