add useEditor to docs
This commit is contained in:
@@ -75,6 +75,34 @@ export default {
|
||||
</script>
|
||||
```
|
||||
|
||||
Alternatively, you can use the Composition API with the `useEditor` method.
|
||||
|
||||
```html
|
||||
<template>
|
||||
<editor-content :editor="editor" />
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { useEditor, EditorContent } from '@tiptap/vue-3'
|
||||
import { defaultExtensions } from '@tiptap/starter-kit'
|
||||
|
||||
export default {
|
||||
components: {
|
||||
EditorContent,
|
||||
},
|
||||
|
||||
setup() {
|
||||
const editor = useEditor({
|
||||
content: '<p>I’m running tiptap with Vue.js. 🎉</p>',
|
||||
extensions: defaultExtensions(),
|
||||
})
|
||||
|
||||
return { editor }
|
||||
},
|
||||
}
|
||||
</script>
|
||||
```
|
||||
|
||||
## 4. Add it to your app
|
||||
Now, let’s replace the content of `src/App.vue` with the following example code to use our new `Tiptap` component in our app.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user