Files
tiptap/docs/src/demos/Marks/Underline/index.vue
2020-11-16 09:43:17 +01:00

51 lines
1.0 KiB
Vue

<template>
<div v-if="editor">
<button @click="editor.chain().focus().underline().run()" :class="{ 'is-active': editor.isActive('underline') }">
underline
</button>
<editor-content :editor="editor" />
</div>
</template>
<script>
import { Editor } from '@tiptap/core'
import { EditorContent } from '@tiptap/vue'
import Document from '@tiptap/extension-document'
import Paragraph from '@tiptap/extension-paragraph'
import Text from '@tiptap/extension-text'
import Underline from '@tiptap/extension-underline'
export default {
components: {
EditorContent,
},
data() {
return {
editor: null,
}
},
mounted() {
this.editor = new Editor({
extensions: [
Document,
Paragraph,
Text,
Underline,
],
content: `
<p>There is no underline here.</p>
<p><u>This is underlined though.</u></p>
<p style="text-decoration: underline">And this as well.</p>
`,
})
},
beforeDestroy() {
this.editor.destroy()
},
}
</script>