1
1
mirror of https://github.com/aelve/guide.git synced 2024-11-25 18:56:52 +03:00

Confirm discarding markdown editor unsaved changes shortcuts

This commit is contained in:
avele 2019-11-15 23:06:29 +04:00
parent 0dd1eae726
commit 1422b4392d
2 changed files with 12 additions and 2 deletions

View File

@ -1,4 +1,3 @@
<!-- Universal confirmation dialog, just pass text and function in Props -->
<template>
<v-dialog
:value="value"
@ -6,6 +5,8 @@
max-width="500px"
v-bind="$attrs"
@input="cancel"
@keydown.esc.stop="cancel"
@keydown.enter.stop=""
>
<template
@ -74,6 +75,13 @@ export default class ConfirmDialog extends Vue {
@Prop(Object) confirmBtnProps!: object
@Prop(Object) cancelBtnProps!: object
test (event: Event) {
event.stopPropagation()
event.stopImmediatePropagation()
event.preventDefault()
console.log('ENTER FOCKIN CAPTURED')
}
close () {
this.$emit('input', false)
}

View File

@ -7,7 +7,7 @@
'markdown-editor_has-bottom-toolbar': bottomToolbar,
'markdown-editor_has-top-toolbar': toolbar
}"
@keydown.exact.capture.enter="onEnterDown"
@keydown.exact.enter="onEnterDown"
@keydown.exact.ctrl.enter="onCtrlEnterDown"
@keydown.exact.meta.enter="onCtrlEnterDown"
@keydown.exact.esc="onEsc"
@ -240,7 +240,9 @@ export default class MarkdownEditor extends Vue {
}
if (isConfirmed) {
this.cancel()
return
}
this.focusInputArea()
}
cancel () {