64 lines
1.1 KiB
Vue
64 lines
1.1 KiB
Vue
<template>
|
|
<editor-content :editor="editor" />
|
|
</template>
|
|
|
|
<script>
|
|
import { Editor, EditorContent } from '@tiptap/vue-2'
|
|
import StarterKit from '@tiptap/starter-kit'
|
|
import Placeholder from '@tiptap/extension-placeholder'
|
|
|
|
export default {
|
|
components: {
|
|
EditorContent,
|
|
},
|
|
|
|
data() {
|
|
return {
|
|
editor: null,
|
|
}
|
|
},
|
|
|
|
mounted() {
|
|
this.editor = new Editor({
|
|
extensions: [
|
|
StarterKit,
|
|
Placeholder,
|
|
],
|
|
})
|
|
},
|
|
|
|
beforeDestroy() {
|
|
this.editor.destroy()
|
|
},
|
|
}
|
|
</script>
|
|
|
|
<style lang="scss" scoped>
|
|
::v-deep {
|
|
/* Basic editor styles */
|
|
.ProseMirror {
|
|
> * + * {
|
|
margin-top: 0.75em;
|
|
}
|
|
}
|
|
|
|
/* Placeholder (at the top) */
|
|
.ProseMirror p.is-editor-empty:first-child::before {
|
|
content: attr(data-placeholder);
|
|
float: left;
|
|
color: #ced4da;
|
|
pointer-events: none;
|
|
height: 0;
|
|
}
|
|
|
|
/* Placeholder (on every new line) */
|
|
/*.ProseMirror p.is-empty::before {
|
|
content: attr(data-placeholder);
|
|
float: left;
|
|
color: #ced4da;
|
|
pointer-events: none;
|
|
height: 0;
|
|
}*/
|
|
}
|
|
</style>
|