mirror of
https://github.com/go-shiori/shiori.git
synced 2025-09-06 13:05:30 +08:00
Make dialog closable using esc key
This commit is contained in:
parent
dcef9162e4
commit
690bda85f7
3 changed files with 17 additions and 7 deletions
|
@ -1,5 +1,5 @@
|
|||
var template = `
|
||||
<div v-if="visible" class="custom-dialog-overlay">
|
||||
<div v-if="visible" class="custom-dialog-overlay" @keyup.esc="handleEscPressed">
|
||||
<div class="custom-dialog">
|
||||
<p class="custom-dialog-header">{{title}}</p>
|
||||
<div class="custom-dialog-body">
|
||||
|
@ -89,6 +89,10 @@ export default {
|
|||
secondClick: {
|
||||
type: Function,
|
||||
default () { this.visible = false; }
|
||||
},
|
||||
escPressed: {
|
||||
type: Function,
|
||||
default () { this.visible = false; }
|
||||
}
|
||||
},
|
||||
data() {
|
||||
|
@ -156,6 +160,9 @@ export default {
|
|||
handleSecondClick() {
|
||||
this.secondClick();
|
||||
},
|
||||
handleEscPressed() {
|
||||
this.escPressed();
|
||||
},
|
||||
handleInput(index) {
|
||||
// Create initial variable
|
||||
var field = this.formFields[index],
|
||||
|
|
|
@ -33,6 +33,9 @@ export default {
|
|||
},
|
||||
secondClick: () => {
|
||||
this.dialog.visible = false;
|
||||
},
|
||||
escPressed: () => {
|
||||
if (!this.loading) this.dialog.visible = false;
|
||||
}
|
||||
}
|
||||
},
|
||||
|
|
File diff suppressed because one or more lines are too long
Loading…
Add table
Reference in a new issue