Use VueEasyMDE initialized event instead of setTimeout as proposed by @juliushaertl
Signed-off-by: ben <ben@ro.tt>
This commit is contained in:
@@ -60,6 +60,7 @@
|
||||
ref="markdownEditor"
|
||||
v-model="description"
|
||||
:configs="mdeConfig"
|
||||
@initialized="addKeyListeners"
|
||||
@update:modelValue="updateDescription"
|
||||
@blur="saveDescription" />
|
||||
|
||||
@@ -175,15 +176,7 @@ export default {
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
showEditor() {
|
||||
if (!this.canEdit) {
|
||||
return
|
||||
}
|
||||
this.descriptionEditing = true
|
||||
this.description = this.card.description
|
||||
|
||||
// Has to start after the Editor is fully loaded. This shouldn't take longer than 1/4 second
|
||||
setTimeout(() => {
|
||||
addKeyListeners() {
|
||||
this.$refs.markdownEditor.easymde.codemirror.on('keydown', (a, b) => {
|
||||
|
||||
if (this.keyExitState === 0 && (b.key === 'Meta' || b.key === 'Alt')) {
|
||||
@@ -202,7 +195,13 @@ export default {
|
||||
}
|
||||
|
||||
})
|
||||
}, 250)
|
||||
},
|
||||
showEditor() {
|
||||
if (!this.canEdit) {
|
||||
return
|
||||
}
|
||||
this.descriptionEditing = true
|
||||
this.description = this.card.description
|
||||
|
||||
},
|
||||
hideEditor() {
|
||||
|
||||
Reference in New Issue
Block a user