mirror of
https://github.com/ueberdosis/tiptap.git
synced 2024-12-15 19:29:02 +08:00
45 lines
726 B
Vue
45 lines
726 B
Vue
<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 {
|
|
BulletListNode,
|
|
ListItemNode,
|
|
PlaceholderExtension,
|
|
} from 'tiptap-extensions'
|
|
|
|
export default {
|
|
components: {
|
|
Editor,
|
|
},
|
|
data() {
|
|
return {
|
|
extensions: [
|
|
new BulletListNode(),
|
|
new ListItemNode(),
|
|
new PlaceholderExtension({
|
|
emptyNodeClass: 'is-empty',
|
|
}),
|
|
],
|
|
}
|
|
},
|
|
}
|
|
</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>
|