diff --git a/demos/src/Nodes/Text/React/index.html b/demos/src/Nodes/Text/React/index.html new file mode 100644 index 00000000..24a15eb5 --- /dev/null +++ b/demos/src/Nodes/Text/React/index.html @@ -0,0 +1,15 @@ + + + + + + + +
+ + + diff --git a/demos/src/Nodes/Text/React/index.jsx b/demos/src/Nodes/Text/React/index.jsx new file mode 100644 index 00000000..b7702abe --- /dev/null +++ b/demos/src/Nodes/Text/React/index.jsx @@ -0,0 +1,20 @@ +import React from 'react' +import { useEditor, EditorContent } from '@tiptap/react' +import Document from '@tiptap/extension-document' +import Paragraph from '@tiptap/extension-paragraph' +import Text from '@tiptap/extension-text' + +export default () => { + const editor = useEditor({ + extensions: [Document, Paragraph, Text], + content: ` +

The Text extension is required, at least if you want to have text in your text editor and that’s very likely.

+ `, + }) + + if (!editor) { + return null + } + + return +} diff --git a/demos/src/Nodes/Text/React/index.spec.js b/demos/src/Nodes/Text/React/index.spec.js new file mode 100644 index 00000000..28ae8618 --- /dev/null +++ b/demos/src/Nodes/Text/React/index.spec.js @@ -0,0 +1,15 @@ +context('/src/Nodes/Text/React/', () => { + before(() => { + cy.visit('/src/Nodes/Text/React/') + }) + + 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') + }) +})