From 72a33b75401f892ace53230e92df613a1617a918 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philipp=20Ku=CC=88hn?= Date: Fri, 25 Jun 2021 14:58:22 +0200 Subject: [PATCH] add react demo for minimal setup --- .../demos/Examples/Minimal/React/index.jsx | 28 +++++++++++++++++++ .../demos/Examples/Minimal/React/styles.scss | 6 ++++ .../demos/Examples/Minimal/Vue/index.spec.js | 7 +++++ .../Examples/Minimal/{ => Vue}/index.vue | 0 docs/src/demos/Examples/Minimal/index.spec.js | 7 ----- docs/src/docPages/examples/minimal.md | 5 +++- 6 files changed, 45 insertions(+), 8 deletions(-) create mode 100644 docs/src/demos/Examples/Minimal/React/index.jsx create mode 100644 docs/src/demos/Examples/Minimal/React/styles.scss create mode 100644 docs/src/demos/Examples/Minimal/Vue/index.spec.js rename docs/src/demos/Examples/Minimal/{ => Vue}/index.vue (100%) delete mode 100644 docs/src/demos/Examples/Minimal/index.spec.js diff --git a/docs/src/demos/Examples/Minimal/React/index.jsx b/docs/src/demos/Examples/Minimal/React/index.jsx new file mode 100644 index 00000000..309c7b31 --- /dev/null +++ b/docs/src/demos/Examples/Minimal/React/index.jsx @@ -0,0 +1,28 @@ +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' +import './styles.scss' + +export default () => { + const editor = useEditor({ + extensions: [ + Document, + Paragraph, + Text, + ], + content: ` +

+ This is a radically reduced version of tiptap. It has support for a document, with paragraphs and text. That’s it. It’s probably too much for real minimalists though. +

+

+ The paragraph extension is not really required, but you need at least one node. Sure, that node can be something different. +

+ `, + }) + + return ( + + ) +} diff --git a/docs/src/demos/Examples/Minimal/React/styles.scss b/docs/src/demos/Examples/Minimal/React/styles.scss new file mode 100644 index 00000000..46b51a4e --- /dev/null +++ b/docs/src/demos/Examples/Minimal/React/styles.scss @@ -0,0 +1,6 @@ +/* Basic editor styles */ +.ProseMirror { + > * + * { + margin-top: 0.75em; + } +} diff --git a/docs/src/demos/Examples/Minimal/Vue/index.spec.js b/docs/src/demos/Examples/Minimal/Vue/index.spec.js new file mode 100644 index 00000000..30dc194a --- /dev/null +++ b/docs/src/demos/Examples/Minimal/Vue/index.spec.js @@ -0,0 +1,7 @@ +context('/demos/Examples/Minimal/Vue', () => { + before(() => { + cy.visit('/demos/Examples/Minimal/Vue') + }) + + // TODO: Write tests +}) diff --git a/docs/src/demos/Examples/Minimal/index.vue b/docs/src/demos/Examples/Minimal/Vue/index.vue similarity index 100% rename from docs/src/demos/Examples/Minimal/index.vue rename to docs/src/demos/Examples/Minimal/Vue/index.vue diff --git a/docs/src/demos/Examples/Minimal/index.spec.js b/docs/src/demos/Examples/Minimal/index.spec.js deleted file mode 100644 index 1de9bce0..00000000 --- a/docs/src/demos/Examples/Minimal/index.spec.js +++ /dev/null @@ -1,7 +0,0 @@ -context('/demos/Examples/Minimal', () => { - before(() => { - cy.visit('/demos/Examples/Minimal') - }) - - // TODO: Write tests -}) diff --git a/docs/src/docPages/examples/minimal.md b/docs/src/docPages/examples/minimal.md index 00feb801..f7578e57 100644 --- a/docs/src/docPages/examples/minimal.md +++ b/docs/src/docPages/examples/minimal.md @@ -1,3 +1,6 @@ # Minimal setup - +