improve basic example
This commit is contained in:
@@ -3,16 +3,16 @@ title: Test
|
|||||||
slug: test
|
slug: test
|
||||||
---
|
---
|
||||||
|
|
||||||
# Super epic editor demo
|
<!-- # Super epic editor demo
|
||||||
|
|
||||||
- magic
|
- magic
|
||||||
- epic
|
- epic -->
|
||||||
|
|
||||||
<!-- <demo name="Basic" key="basic" /> -->
|
<demo name="Basic" key="basic" />
|
||||||
|
|
||||||
# Super epic time demo
|
<!-- # Super epic time demo
|
||||||
|
|
||||||
- nice numbers
|
- nice numbers
|
||||||
- nice time
|
- nice time
|
||||||
|
|
||||||
<demo name="Time" key="time" />
|
<demo name="Time" key="time" /> -->
|
||||||
@@ -1,18 +1,46 @@
|
|||||||
<template>
|
<template>
|
||||||
<Layout>
|
<div>
|
||||||
|
<div v-if="editor">
|
||||||
|
<button @click="editor.undo().focus()">
|
||||||
|
undo
|
||||||
|
</button>
|
||||||
|
<button @click="editor.redo().focus()">
|
||||||
|
redo
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
<div ref="editor"></div>
|
<div ref="editor"></div>
|
||||||
</Layout>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import Editor from '@tiptap/core'
|
import Editor from '@tiptap/core'
|
||||||
|
import Document from '@tiptap/document-extension'
|
||||||
|
import Paragraph from '@tiptap/paragraph-extension'
|
||||||
|
import Text from '@tiptap/text-extension'
|
||||||
|
import History from '@tiptap/history-extension'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
editor: null,
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
mounted() {
|
mounted() {
|
||||||
new Editor({
|
this.editor = new Editor({
|
||||||
element: this.$refs.editor,
|
element: this.$refs.editor,
|
||||||
content: '<p>foo</p>',
|
content: '<p>foo</p>',
|
||||||
|
extensions: [
|
||||||
|
new Document(),
|
||||||
|
new Paragraph(),
|
||||||
|
new Text(),
|
||||||
|
new History(),
|
||||||
|
],
|
||||||
})
|
})
|
||||||
}
|
},
|
||||||
|
|
||||||
|
beforeDestroy() {
|
||||||
|
this.editor.destroy()
|
||||||
|
},
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
Reference in New Issue
Block a user