2018-09-07 04:58:54 +08:00
|
|
|
<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: [
|
2018-09-07 05:01:52 +08:00
|
|
|
new PlaceholderExtension({
|
|
|
|
emptyNodeClass: 'is-empty',
|
|
|
|
}),
|
2018-09-07 04:58:54 +08:00
|
|
|
],
|
|
|
|
}
|
|
|
|
},
|
|
|
|
}
|
|
|
|
</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>
|