tiptap/examples/Components/Routes/ReadOnly/index.vue

69 lines
1.1 KiB
Vue
Raw Normal View History

2018-08-23 01:28:57 +08:00
<template>
<div>
2018-08-24 04:08:19 +08:00
<editor :editable="false" :extensions="extensions" class="editor" @update="onUpdate">
2018-08-23 01:28:57 +08:00
<div class="editor__content" slot="content" slot-scope="props">
2018-08-23 14:36:10 +08:00
<h2>
2018-08-23 01:28:57 +08:00
Read-Only
2018-08-23 14:36:10 +08:00
</h2>
2018-08-23 01:28:57 +08:00
<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>
</div>
</editor>
</div>
</template>
<script>
import Icon from 'Components/Icon'
import { Editor } from 'tiptap'
2018-08-24 04:08:19 +08:00
import {
Blockquote,
BulletList,
CodeBlock,
HardBreak,
Heading,
ListItem,
OrderedList,
TodoItem,
TodoList,
Bold,
Code,
Italic,
Link,
History,
2018-08-24 04:08:19 +08:00
} from 'tiptap-extensions'
2018-08-23 01:28:57 +08:00
export default {
components: {
Editor,
Icon,
},
2018-08-24 04:08:19 +08:00
data() {
return {
extensions: [
new Blockquote(),
new BulletList(),
new CodeBlock(),
new HardBreak(),
2018-08-24 14:41:17 +08:00
new Heading({ maxLevel: 3 }),
2018-08-24 04:08:19 +08:00
new ListItem(),
new OrderedList(),
new TodoItem(),
new TodoList(),
new Bold(),
new Code(),
new Italic(),
new Link(),
new History(),
2018-08-24 04:08:19 +08:00
],
}
},
2018-08-23 01:28:57 +08:00
methods: {
onUpdate(state) {
// console.log(state.doc.toJSON())
},
},
}
</script>