mirror of
https://github.com/ueberdosis/tiptap.git
synced 2024-12-15 02:59:01 +08:00
50 lines
962 B
Vue
50 lines
962 B
Vue
<template>
|
|
<div class="editor">
|
|
<editor-content class="editor__content" :editor="editor" />
|
|
</div>
|
|
</template>
|
|
|
|
<script>
|
|
import { Editor, EditorContent } from 'tiptap'
|
|
import {
|
|
HardBreak,
|
|
Heading,
|
|
Bold,
|
|
Code,
|
|
Italic,
|
|
Link,
|
|
} from 'tiptap-extensions'
|
|
|
|
export default {
|
|
components: {
|
|
EditorContent,
|
|
},
|
|
data() {
|
|
return {
|
|
editor: new Editor({
|
|
editable: false,
|
|
extensions: [
|
|
new HardBreak(),
|
|
new Heading({ levels: [1, 2, 3] }),
|
|
new Bold(),
|
|
new Code(),
|
|
new Italic(),
|
|
new Link(),
|
|
],
|
|
content: `
|
|
<h2>
|
|
Read-Only
|
|
</h2>
|
|
<p>
|
|
This text is <strong>read-only</strong>. You are not able to edit something. <a href="https://scrumpy.io/">Links to fancy websites</a> are still working.
|
|
</p>
|
|
`,
|
|
}),
|
|
}
|
|
},
|
|
beforeDestroy() {
|
|
this.editor.destroy()
|
|
},
|
|
}
|
|
</script>
|