add placeholder extension

This commit is contained in:
Philipp Kühn
2018-09-06 22:58:54 +02:00
parent 80ec395c3a
commit db61d67156
7 changed files with 89 additions and 1 deletions

View File

@@ -0,0 +1,36 @@
<template>
<div>
<editor class="editor" :extensions="extensions">
<div class="editor__content" slot="content" slot-scope="props"></div>
</editor>
</div>
</template>
<script>
import { Editor } from 'tiptap'
import { PlaceholderExtension } from 'tiptap-extensions'
export default {
components: {
Editor,
},
data() {
return {
extensions: [
new PlaceholderExtension(),
],
}
},
}
</script>
<style lang="scss">
.editor p.is-empty:first-child::before {
content: 'Start typing…';
float: left;
color: #aaa;
pointer-events: none;
height: 0;
font-style: italic;
}
</style>