add node demos

This commit is contained in:
Philipp Kühn
2021-08-25 18:15:10 +02:00
parent 502b533f60
commit 7dd4e38af5
51 changed files with 2925 additions and 0 deletions

View File

@@ -0,0 +1,15 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
</head>
<body>
<div id="app"></div>
<script type="module">
import setup from '../../../../setup/vue.ts'
import source from '@source'
setup('Nodes/Text', source)
</script>
</body>
</html>

View File

@@ -0,0 +1,18 @@
context('/demos/Nodes/Text', () => {
before(() => {
cy.visit('/demos/Nodes/Text')
})
beforeEach(() => {
cy.get('.ProseMirror').then(([{ editor }]) => {
editor.commands.clearContent()
})
})
it('text should be wrapped in a paragraph by default', () => {
cy.get('.ProseMirror')
.type('Example Text')
.find('p')
.should('contain', 'Example Text')
})
})

View File

@@ -0,0 +1,41 @@
<template>
<div v-if="editor">
<editor-content :editor="editor" />
</div>
</template>
<script>
import { Editor, EditorContent } from '@tiptap/vue-3'
import Document from '@tiptap/extension-document'
import Paragraph from '@tiptap/extension-paragraph'
import Text from '@tiptap/extension-text'
export default {
components: {
EditorContent,
},
data() {
return {
editor: null,
}
},
mounted() {
this.editor = new Editor({
extensions: [
Document,
Paragraph,
Text,
],
content: `
<p>The Text extension is required, at least if you want to have text in your text editor and thats very likely.</p>
`,
})
},
beforeDestroy() {
this.editor.destroy()
},
}
</script>