소스 검색

Исправлен баг перехвата клавиш в диалогах

Book Pauk 5 년 전
부모
커밋
b444abeb3e
1개의 변경된 파일13개의 추가작업 그리고 4개의 파일을 삭제
  1. 13 4
      client/components/share/StdDialog.vue

+ 13 - 4
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();
+            }
         }
     }
 }