1234567891011121314151617181920212223242526272829303132333435363738 |
- <template>
- <div class="editor editor-squished">
- <bubble-menu :editor="editor" />
- <editor-content
- class="editor__content"
- :editor="editor"
- />
- </div>
- </template>
- <script>
- import { Editor, EditorContent } from "tiptap"
- import BubbleMenu from '~/components/editor/BubbleMenu'
- import { Heading } from 'tiptap-extensions'
- export default {
- components: {
- EditorContent,
- BubbleMenu
- },
- data(){
- return {
- editor: null
- }
- },
- // This is called only on client (in browser)
- mounted(){
- this.editor = new Editor({
- extensions: [
- new Heading({ levels: [1, 2, 3]})
- ]
- })
- },
- beforeDestroy(){
- // Always destroy your editor instance when it's no longer needed
- this.editor && this.editor.destroy()
- }
- }
- </script>
|