fix tests

This commit is contained in:
Philipp Kühn
2020-03-11 10:00:19 +01:00
parent 1b10b20ec3
commit 5a45420a90
2 changed files with 20 additions and 39 deletions

View File

@@ -19,7 +19,7 @@ context('basic', () => {
const json = editor.json() const json = editor.json()
expect(json).to.deep.equal({ expect(json).to.deep.equal({
type: 'doc', type: 'document',
content: [ content: [
{ {
type: 'paragraph', type: 'paragraph',

View File

@@ -1,19 +1,29 @@
<template> <template>
<Layout> <Layout>
<div ref="editor"></div> <editor-content :editor="editor" />
</Layout> </Layout>
</template> </template>
<script> <script>
import Editor from '@tiptap/core' import { Editor, EditorContent } from '@tiptap/core'
import Document from '@tiptap/document-extension' import Document from '@tiptap/document-extension'
import Paragraph from '@tiptap/paragraph-extension' import Paragraph from '@tiptap/paragraph-extension'
import Text from '@tiptap/text-extension' import Text from '@tiptap/text-extension'
import History from '@tiptap/history-extension' import History from '@tiptap/history-extension'
export default { export default {
components: {
EditorContent,
},
data() {
return {
editor: null,
}
},
mounted() { mounted() {
window.editor = new Editor({ this.editor = new Editor({
element: this.$refs.editor, element: this.$refs.editor,
content: '<p>foo</p>', content: '<p>foo</p>',
extensions: [ extensions: [
@@ -23,41 +33,12 @@ export default {
new History(), new History(),
], ],
}) })
// .insertText('foo')
// .undo()
// .insertHTML('<p>hey</p>')
// .registerCommand('lol', (next) => {
// console.log('lol')
// next()
// })
// .focus('end')
// .insertText('mega ')
// .focus('start')
// .command('insertText', 'giga ')
// .lol()
// .registerCommand('insertHTML', (next, editor, html) => { window.editor = this.editor
// console.log(html) },
// next()
// }) beforeDestroy() {
// .registerCommand('insertHello', async (next, editor) => { this.editor.destroy()
// await editor.insertHTML('<strong>HELLO</strong>') },
// next()
// })
// .registerCommand('insertHello', (next, editor) => {
// editor
// .focus('start')
// .insertHTML('<strong>HELLO</strong>')
// next()
// })
// .focus('start')
// .insertHello()
// .insertText('eins')
// .insertText('zwei')
// .insertText('drei')
// .insertHello()
// .focus('end')
// .insertHTML('<p>end</p>')
}
} }
</script> </script>