12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152 |
- <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,
- Bold,
- Code,
- Italic,
- Strike,
- Underline,
- History
- } 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]}),
- new Bold(),
- new Code(),
- new Italic(),
- new Strike(),
- new Underline(),
- new History()
- ]
- })
- },
- beforeDestroy(){
- // Always destroy your editor instance when it's no longer needed
- this.editor && this.editor.destroy()
- }
- }
- </script>
|