From b444abeb3e9939660756636e85a2630df597b51d Mon Sep 17 00:00:00 2001 From: Book Pauk Date: Thu, 21 May 2020 00:14:47 +0700 Subject: [PATCH] =?UTF-8?q?=D0=98=D1=81=D0=BF=D1=80=D0=B0=D0=B2=D0=BB?= =?UTF-8?q?=D0=B5=D0=BD=20=D0=B1=D0=B0=D0=B3=20=D0=BF=D0=B5=D1=80=D0=B5?= =?UTF-8?q?=D1=85=D0=B2=D0=B0=D1=82=D0=B0=20=D0=BA=D0=BB=D0=B0=D0=B2=D0=B8?= =?UTF-8?q?=D1=88=20=D0=B2=20=D0=B4=D0=B8=D0=B0=D0=BB=D0=BE=D0=B3=D0=B0?= =?UTF-8?q?=D1=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- client/components/share/StdDialog.vue | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/client/components/share/StdDialog.vue b/client/components/share/StdDialog.vue index 5bbb91ad..03ad16d8 100644 --- a/client/components/share/StdDialog.vue +++ b/client/components/share/StdDialog.vue @@ -131,7 +131,7 @@ class StdDialog extends Vue { created() { if (this.$root.addKeyHook) { - this.$root.addKeyHook(this.keyHook); + //this.$root.addKeyHook(this.keyHook); } } @@ -277,21 +277,30 @@ class StdDialog extends Vue { keyHook(event) { if (this.active) { + let handled = false; if (this.type == 'hotKey') { if (event.type == 'keydown') { this.hotKeyCode = utils.keyEventToCode(event); + handled = true; } } else { - if (event.code == 'Enter') + if (event.code == 'Enter') { this.okClick(); + handled = true; + } + if (event.code == 'Escape') { this.$nextTick(() => { this.$refs.dialog.hide(); }); + handled = true; } } - event.stopPropagation(); - event.preventDefault(); + + if (handled) { + event.stopPropagation(); + event.preventDefault(); + } } } }