Merge pull request #3774 from Ben-Ro/CTRL/CMD_+_ENTER_to_Save_Changes_on_Card_Description
feat: #3268 CTRL/CMD + ENTER to Save Changes on Card Description
This commit is contained in:
@@ -60,6 +60,7 @@
|
|||||||
ref="markdownEditor"
|
ref="markdownEditor"
|
||||||
v-model="description"
|
v-model="description"
|
||||||
:configs="mdeConfig"
|
:configs="mdeConfig"
|
||||||
|
@initialized="addKeyListeners"
|
||||||
@update:modelValue="updateDescription"
|
@update:modelValue="updateDescription"
|
||||||
@blur="saveDescription" />
|
@blur="saveDescription" />
|
||||||
|
|
||||||
@@ -115,6 +116,7 @@ export default {
|
|||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
keyExitState: 0,
|
||||||
description: '',
|
description: '',
|
||||||
markdownIt: null,
|
markdownIt: null,
|
||||||
descriptionEditing: false,
|
descriptionEditing: false,
|
||||||
@@ -174,14 +176,37 @@ export default {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
addKeyListeners() {
|
||||||
|
this.$refs.markdownEditor.easymde.codemirror.on('keydown', (a, b) => {
|
||||||
|
|
||||||
|
if (this.keyExitState === 0 && (b.key === 'Meta' || b.key === 'Alt')) {
|
||||||
|
this.keyExitState = 1
|
||||||
|
}
|
||||||
|
if (this.keyExitState === 1 && b.key === 'Enter') {
|
||||||
|
this.keyExitState = 0
|
||||||
|
this.$refs.markdownEditor.easymde.codemirror.off('keydown', undefined)
|
||||||
|
this.$refs.markdownEditor.easymde.codemirror.off('keyup', undefined)
|
||||||
|
this.hideEditor()
|
||||||
|
}
|
||||||
|
})
|
||||||
|
this.$refs.markdownEditor.easymde.codemirror.on('keyup', (a, b) => {
|
||||||
|
if (b.key === 'Meta' || b.key === 'Control') {
|
||||||
|
this.keyExitState = 0
|
||||||
|
}
|
||||||
|
|
||||||
|
})
|
||||||
|
},
|
||||||
showEditor() {
|
showEditor() {
|
||||||
if (!this.canEdit) {
|
if (!this.canEdit) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
this.descriptionEditing = true
|
this.descriptionEditing = true
|
||||||
this.description = this.card.description
|
this.description = this.card.description
|
||||||
|
|
||||||
},
|
},
|
||||||
hideEditor() {
|
hideEditor() {
|
||||||
|
this.$refs.markdownEditor.easymde.codemirror.off('keydown', undefined)
|
||||||
|
this.$refs.markdownEditor.easymde.codemirror.off('keyup', undefined)
|
||||||
this.descriptionEditing = false
|
this.descriptionEditing = false
|
||||||
},
|
},
|
||||||
showAttachmentModal() {
|
showAttachmentModal() {
|
||||||
|
|||||||
Reference in New Issue
Block a user