add starter kit
This commit is contained in:
@@ -1,23 +1,10 @@
|
||||
<template>
|
||||
<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>
|
||||
<div ref="editor"></div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
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'
|
||||
import extensions from '@tiptap/starter-kit'
|
||||
|
||||
export default {
|
||||
data() {
|
||||
@@ -30,12 +17,7 @@ export default {
|
||||
this.editor = new Editor({
|
||||
element: this.$refs.editor,
|
||||
content: '<p>foo</p>',
|
||||
extensions: [
|
||||
new Document(),
|
||||
new Paragraph(),
|
||||
new Text(),
|
||||
new History(),
|
||||
],
|
||||
extensions: extensions(),
|
||||
})
|
||||
},
|
||||
|
||||
|
||||
46
src/demos/HandleExtensions/index.vue
Normal file
46
src/demos/HandleExtensions/index.vue
Normal file
@@ -0,0 +1,46 @@
|
||||
<template>
|
||||
<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>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
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 {
|
||||
data() {
|
||||
return {
|
||||
editor: null,
|
||||
}
|
||||
},
|
||||
|
||||
mounted() {
|
||||
this.editor = new Editor({
|
||||
element: this.$refs.editor,
|
||||
content: '<p>foo</p>',
|
||||
extensions: [
|
||||
new Document(),
|
||||
new Paragraph(),
|
||||
new Text(),
|
||||
new History(),
|
||||
],
|
||||
})
|
||||
},
|
||||
|
||||
beforeDestroy() {
|
||||
this.editor.destroy()
|
||||
},
|
||||
}
|
||||
</script>
|
||||
Reference in New Issue
Block a user