Исправлен баг перехвата клавиш в диалогах
This commit is contained in:
@@ -131,7 +131,7 @@ class StdDialog extends Vue {
|
|||||||
|
|
||||||
created() {
|
created() {
|
||||||
if (this.$root.addKeyHook) {
|
if (this.$root.addKeyHook) {
|
||||||
this.$root.addKeyHook(this.keyHook);
|
//this.$root.addKeyHook(this.keyHook);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -277,21 +277,30 @@ class StdDialog extends Vue {
|
|||||||
|
|
||||||
keyHook(event) {
|
keyHook(event) {
|
||||||
if (this.active) {
|
if (this.active) {
|
||||||
|
let handled = false;
|
||||||
if (this.type == 'hotKey') {
|
if (this.type == 'hotKey') {
|
||||||
if (event.type == 'keydown') {
|
if (event.type == 'keydown') {
|
||||||
this.hotKeyCode = utils.keyEventToCode(event);
|
this.hotKeyCode = utils.keyEventToCode(event);
|
||||||
|
handled = true;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (event.code == 'Enter')
|
if (event.code == 'Enter') {
|
||||||
this.okClick();
|
this.okClick();
|
||||||
|
handled = true;
|
||||||
|
}
|
||||||
|
|
||||||
if (event.code == 'Escape') {
|
if (event.code == 'Escape') {
|
||||||
this.$nextTick(() => {
|
this.$nextTick(() => {
|
||||||
this.$refs.dialog.hide();
|
this.$refs.dialog.hide();
|
||||||
});
|
});
|
||||||
|
handled = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
event.stopPropagation();
|
|
||||||
event.preventDefault();
|
if (handled) {
|
||||||
|
event.stopPropagation();
|
||||||
|
event.preventDefault();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user