fix some examples

This commit is contained in:
Philipp Kühn
2018-10-23 22:50:12 +02:00
parent aecf2284e9
commit b7e915015c
5 changed files with 201 additions and 188 deletions

View File

@@ -1,22 +1,11 @@
<template>
<div>
<editor :editable="false" :extensions="extensions" class="editor">
<div class="editor__content" slot="content" slot-scope="props">
<h2>
Read-Only
</h2>
<p>
This text is <strong>read-only</strong>. You are not able to edit something. <a href="https://scrumpy.io/">Links to fancy websites</a> are still working.
</p>
</div>
</editor>
<div class="editor">
<editor-content class="editor__content" :editor="editor" />
</div>
</template>
<script>
import { Editor } from 'tiptap'
import { Editor, EditorContent } from 'tiptap'
import {
HardBreakNode,
HeadingNode,
@@ -28,19 +17,33 @@ import {
export default {
components: {
Editor,
EditorContent,
},
data() {
return {
extensions: [
new HardBreakNode(),
new HeadingNode({ maxLevel: 3 }),
new BoldMark(),
new CodeMark(),
new ItalicMark(),
new LinkMark(),
],
editor: new Editor({
editable: false,
extensions: [
new HardBreakNode(),
new HeadingNode({ maxLevel: 3 }),
new BoldMark(),
new CodeMark(),
new ItalicMark(),
new LinkMark(),
],
content: `
<h2>
Read-Only
</h2>
<p>
This text is <strong>read-only</strong>. You are not able to edit something. <a href="https://scrumpy.io/">Links to fancy websites</a> are still working.
</p>
`,
}),
}
},
beforeDestroy() {
this.editor.destroy()
},
}
</script>