diff --git a/docs/src/demos/Examples/Book/React/index.jsx b/docs/src/demos/Examples/Book/React/index.jsx new file mode 100644 index 00000000..fe6e83db --- /dev/null +++ b/docs/src/demos/Examples/Book/React/index.jsx @@ -0,0 +1,145 @@ +import React from 'react' +import { useEditor, EditorContent } from '@tiptap/react' +import StarterKit from '@tiptap/starter-kit' +import { content } from '../content.js' +import './styles.scss' + +const MenuBar = ({ editor }) => { + if (!editor) { + return null + } + + return ( + <> + + + + + + + + + + + + + + + + + + + + + + + ) +} + +export default () => { + const editor = useEditor({ + extensions: [ + StarterKit, + ], + content, + editorProps: { + attributes: { + spellcheck: 'false', + }, + }, + }) + + return ( +
+ + +
+ ) +} diff --git a/docs/src/demos/Examples/Book/React/styles.scss b/docs/src/demos/Examples/Book/React/styles.scss new file mode 100644 index 00000000..9a6d1a7c --- /dev/null +++ b/docs/src/demos/Examples/Book/React/styles.scss @@ -0,0 +1,54 @@ +/* Basic editor styles */ +.ProseMirror { + > * + * { + margin-top: 0.75em; + } + + ul, + ol { + padding: 0 1rem; + } + + h1, + h2, + h3, + h4, + h5, + h6 { + line-height: 1.1; + } + + code { + background-color: rgba(#616161, 0.1); + color: #616161; + } + + pre { + background: #0D0D0D; + color: #FFF; + font-family: 'JetBrainsMono', monospace; + padding: 0.75rem 1rem; + border-radius: 0.5rem; + + code { + color: inherit; + padding: 0; + background: none; + font-size: 0.8rem; + } + } + + img { + max-width: 100%; + height: auto; + } + + hr { + margin: 1rem 0; + } + + blockquote { + padding-left: 1rem; + border-left: 2px solid rgba(#0D0D0D, 0.1); + } +} diff --git a/docs/src/demos/Examples/Book/Vue/index.spec.js b/docs/src/demos/Examples/Book/Vue/index.spec.js new file mode 100644 index 00000000..a53927b4 --- /dev/null +++ b/docs/src/demos/Examples/Book/Vue/index.spec.js @@ -0,0 +1,7 @@ +context('/demos/Examples/Book/Vue', () => { + before(() => { + cy.visit('/demos/Examples/Book/Vue') + }) + + // TODO: Write tests +}) diff --git a/docs/src/demos/Examples/Book/index.vue b/docs/src/demos/Examples/Book/Vue/index.vue similarity index 99% rename from docs/src/demos/Examples/Book/index.vue rename to docs/src/demos/Examples/Book/Vue/index.vue index b8a4e5d8..aecd85db 100644 --- a/docs/src/demos/Examples/Book/index.vue +++ b/docs/src/demos/Examples/Book/Vue/index.vue @@ -72,7 +72,7 @@