Skip to content

Commit

Permalink
Merge pull request #1489 from nextcloud/backport/1488/stable0.8
Browse files Browse the repository at this point in the history
[stable0.8] enh: use tiptap's editor to render HTML
  • Loading branch information
blizzz authored Dec 4, 2024
2 parents 95fdfe2 + 0d651c2 commit 4b01ae9
Showing 1 changed file with 35 additions and 2 deletions.
37 changes: 35 additions & 2 deletions src/shared/components/ncTable/partials/TableCellHtml.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,21 @@
-->
<template>
<div>
<!-- eslint-disable-next-line vue/no-v-html -->
<div v-if="value" class="tiptap-reader-cell" v-html="value" />
<EditorContent :editor="editor" />
</div>
</template>

<script>
import { Editor, EditorContent } from '@tiptap/vue-2'
import { StarterKit } from '@tiptap/starter-kit'

export default {
name: 'TableCellHtml',

components: {
EditorContent,
},

props: {
column: {
type: Object,
Expand All @@ -27,6 +33,33 @@ export default {
default: '',
},
},

data() {
return {
editor: null,
}
},

watch: {
value(value) {
this.editor.commands.setContent(value, false)
},
},

mounted() {
this.editor = new Editor({
extensions: [
StarterKit,
],
content: this.value,
editable: false,
})
},

beforeUnmount() {
this.editor.destroy()
},

}
</script>

Expand Down

0 comments on commit 4b01ae9

Please sign in to comment.