diff --git a/demos/src/Examples/CSSModules/React/index.html b/demos/src/Examples/CSSModules/React/index.html
new file mode 100644
index 000000000..e69de29bb
diff --git a/demos/src/Examples/CSSModules/React/index.jsx b/demos/src/Examples/CSSModules/React/index.jsx
new file mode 100644
index 000000000..7a47a61a3
--- /dev/null
+++ b/demos/src/Examples/CSSModules/React/index.jsx
@@ -0,0 +1,172 @@
+import './styles.scss'
+
+import React from 'react'
+
+import { EditorContent, useEditor } from '@tiptap/react'
+import StarterKit from '@tiptap/starter-kit'
+
+import styles from './index.module.css'
+
+const MenuBar = ({ editor }) => {
+ if (!editor) {
+ return null
+ }
+
+ return (
+
+ editor.chain().focus().toggleBold().run()}
+ className={editor.isActive('bold') ? 'is-active' : ''}
+ >
+ bold
+
+ editor.chain().focus().toggleItalic().run()}
+ className={editor.isActive('italic') ? 'is-active' : ''}
+ >
+ italic
+
+ editor.chain().focus().toggleStrike().run()}
+ className={editor.isActive('strike') ? 'is-active' : ''}
+ >
+ strike
+
+ editor.chain().focus().toggleCode().run()}
+ className={editor.isActive('code') ? 'is-active' : ''}
+ >
+ code
+
+ editor.chain().focus().unsetAllMarks().run()}>
+ clear marks
+
+ editor.chain().focus().clearNodes().run()}>
+ clear nodes
+
+ editor.chain().focus().setParagraph().run()}
+ className={editor.isActive('paragraph') ? 'is-active' : ''}
+ >
+ paragraph
+
+ editor.chain().focus().toggleHeading({ level: 1 }).run()}
+ className={editor.isActive('heading', { level: 1 }) ? 'is-active' : ''}
+ >
+ h1
+
+ editor.chain().focus().toggleHeading({ level: 2 }).run()}
+ className={editor.isActive('heading', { level: 2 }) ? 'is-active' : ''}
+ >
+ h2
+
+ editor.chain().focus().toggleHeading({ level: 3 }).run()}
+ className={editor.isActive('heading', { level: 3 }) ? 'is-active' : ''}
+ >
+ h3
+
+ editor.chain().focus().toggleHeading({ level: 4 }).run()}
+ className={editor.isActive('heading', { level: 4 }) ? 'is-active' : ''}
+ >
+ h4
+
+ editor.chain().focus().toggleHeading({ level: 5 }).run()}
+ className={editor.isActive('heading', { level: 5 }) ? 'is-active' : ''}
+ >
+ h5
+
+ editor.chain().focus().toggleHeading({ level: 6 }).run()}
+ className={editor.isActive('heading', { level: 6 }) ? 'is-active' : ''}
+ >
+ h6
+
+ editor.chain().focus().toggleBulletList().run()}
+ className={editor.isActive('bulletList') ? 'is-active' : ''}
+ >
+ bullet list
+
+ editor.chain().focus().toggleOrderedList().run()}
+ className={editor.isActive('orderedList') ? 'is-active' : ''}
+ >
+ ordered list
+
+ editor.chain().focus().toggleCodeBlock().run()}
+ className={editor.isActive('codeBlock') ? 'is-active' : ''}
+ >
+ code block
+
+ editor.chain().focus().toggleBlockquote().run()}
+ className={editor.isActive('blockquote') ? 'is-active' : ''}
+ >
+ blockquote
+
+ editor.chain().focus().setHorizontalRule().run()}>
+ horizontal rule
+
+ editor.chain().focus().setHardBreak().run()}>
+ hard break
+
+ editor.chain().focus().undo().run()}>
+ undo
+
+ editor.chain().focus().redo().run()}>
+ redo
+
+
+ )
+}
+
+export default () => {
+ const editor = useEditor({
+ extensions: [
+ StarterKit,
+ ],
+ content: `
+
+ Hi there,
+
+
+ this is a basic example of tiptap . Sure, there are all kind of basic text styles you’d probably expect from a text editor. But wait until you see the lists:
+
+
+
+ That’s a bullet list with one …
+
+
+ … or two list items.
+
+
+
+ Isn’t that great? And all of that is editable. But wait, there’s more. Let’s try a code block:
+
+ body {
+ display: none;
+}
+
+ I know, I know, this is impressive. It’s only the tip of the iceberg though. Give it a try and click a little bit around. Don’t forget to check the other examples too.
+
+
+ Wow, that’s amazing. Good work, boy! 👏
+
+ — Mom
+
+ `,
+ })
+
+ return (
+
+
+
+
+ )
+}
diff --git a/demos/src/Examples/CSSModules/React/index.module.css b/demos/src/Examples/CSSModules/React/index.module.css
new file mode 100644
index 000000000..8936631bb
--- /dev/null
+++ b/demos/src/Examples/CSSModules/React/index.module.css
@@ -0,0 +1,4 @@
+.toolbar {
+ background-color: red;
+ padding: 16px;
+}
diff --git a/demos/src/Examples/CSSModules/React/index.spec.js b/demos/src/Examples/CSSModules/React/index.spec.js
new file mode 100644
index 000000000..b5f939fd5
--- /dev/null
+++ b/demos/src/Examples/CSSModules/React/index.spec.js
@@ -0,0 +1,11 @@
+context('/src/Examples/CSSModules/React/', () => {
+ before(() => {
+ cy.visit('/src/Examples/CSSModules/React/')
+ })
+
+ it('should apply a randomly generated class that adds padding and background color to the toolbar', () => {
+ cy.get('.toolbar').should('exist')
+ cy.get('.toolbar').should('have.css', 'background-color', 'rgb(255, 0, 0)')
+ cy.get('.toolbar').should('have.css', 'padding', '16px')
+ })
+})
diff --git a/demos/src/Examples/CSSModules/React/styles.scss b/demos/src/Examples/CSSModules/React/styles.scss
new file mode 100644
index 000000000..9ba5fc022
--- /dev/null
+++ b/demos/src/Examples/CSSModules/React/styles.scss
@@ -0,0 +1,56 @@
+/* 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;
+ }
+
+ blockquote {
+ padding-left: 1rem;
+ border-left: 2px solid rgba(#0D0D0D, 0.1);
+ }
+
+ hr {
+ border: none;
+ border-top: 2px solid rgba(#0D0D0D, 0.1);
+ margin: 2rem 0;
+ }
+}
diff --git a/demos/src/Examples/CSSModules/Vue/index.css b/demos/src/Examples/CSSModules/Vue/index.css
deleted file mode 100644
index adc68fa6a..000000000
--- a/demos/src/Examples/CSSModules/Vue/index.css
+++ /dev/null
@@ -1,3 +0,0 @@
-h1 {
- color: red;
-}
diff --git a/demos/src/Examples/CSSModules/Vue/index.module.css b/demos/src/Examples/CSSModules/Vue/index.module.css
new file mode 100644
index 000000000..8936631bb
--- /dev/null
+++ b/demos/src/Examples/CSSModules/Vue/index.module.css
@@ -0,0 +1,4 @@
+.toolbar {
+ background-color: red;
+ padding: 16px;
+}
diff --git a/demos/src/Examples/CSSModules/Vue/index.spec.js b/demos/src/Examples/CSSModules/Vue/index.spec.js
index 033d9e405..02b286b08 100644
--- a/demos/src/Examples/CSSModules/Vue/index.spec.js
+++ b/demos/src/Examples/CSSModules/Vue/index.spec.js
@@ -3,15 +3,9 @@ context('/src/Examples/CSSModules/Vue/', () => {
cy.visit('/src/Examples/CSSModules/Vue/')
})
- beforeEach(() => {
- cy.get('.ProseMirror').then(([{ editor }]) => {
- editor.commands.setContent('Example Text ')
- cy.get('.ProseMirror').type('{selectall}')
- })
- })
-
- it('should apply a red headline style to h1', () => {
- cy.get('.ProseMirror h1').should('exist')
- cy.get('.ProseMirror h1').should('have.css', 'color', 'rgb(255, 0, 0)')
+ it('should apply a randomly generated class that adds padding and background color to the toolbar', () => {
+ cy.get('.toolbar').should('exist')
+ cy.get('.toolbar').should('have.css', 'background-color', 'rgb(255, 0, 0)')
+ cy.get('.toolbar').should('have.css', 'padding', '16px')
})
})
diff --git a/demos/src/Examples/CSSModules/Vue/index.vue b/demos/src/Examples/CSSModules/Vue/index.vue
index 1912dcb3d..6651b02b7 100644
--- a/demos/src/Examples/CSSModules/Vue/index.vue
+++ b/demos/src/Examples/CSSModules/Vue/index.vue
@@ -1,5 +1,5 @@
-