@@ -116,6 +122,8 @@ export default {
},
data() {
return {
+ textAppAvailable: !!window.OCA?.Text?.createEditor,
+ editor: null,
keyExitState: 0,
description: '',
markdownIt: null,
@@ -175,7 +183,29 @@ export default {
return this.card?.description?.trim?.() !== ''
},
},
+ mounted() {
+ this.setupEditor()
+ },
+ beforeDestroy() {
+ this?.editor?.destroy()
+ },
methods: {
+ setupEditor() {
+ this?.editor?.vm?.$destroy()
+ this.$refs.editor.innerHTML = ''
+ const element = document.createElement('div')
+ this.$refs.editor.appendChild(element)
+ this.editor = window.OCA.Text.createEditor({
+ el: element,
+ content: this.card.description,
+ readOnly: !this.canEdit,
+ onUpdate: ({ markdown }) => {
+ this.description = markdown
+ this.updateDescription()
+ },
+ })
+
+ },
addKeyListeners() {
this.$refs.markdownEditor.easymde.codemirror.on('keydown', (a, b) => {