add react demo (WIP) to bubble menu

This commit is contained in:
Philipp Kühn
2021-03-30 14:24:52 +02:00
parent daa8e72477
commit 5213069bb4
5 changed files with 34 additions and 3 deletions

View File

@@ -0,0 +1,23 @@
import React from 'react'
import { useEditor, EditorContent } from '@tiptap/react'
import { defaultExtensions } from '@tiptap/starter-kit'
import './styles.scss'
export default () => {
const editor = useEditor({
extensions: [
...defaultExtensions(),
],
content: `
<p>
Hey, try to select some text here. There will popup a menu for selecting some inline styles. Remember: you have full control about content and styling of this menu.
</p>
`,
})
return (
<div>
<EditorContent editor={editor} />
</div>
)
}

View File

@@ -0,0 +1,5 @@
.ProseMirror {
> * + * {
margin-top: 0.75em;
}
}

View File

@@ -35,5 +35,8 @@ new Editor({
}) })
``` ```
## Vue ## Using a framework
<demo name="Extensions/BubbleMenu" /> <demos :items="{
Vue: 'Extensions/BubbleMenu/Vue',
React: 'Extensions/BubbleMenu/React',
}" />

View File

@@ -26,7 +26,7 @@
"vue": "^2.6.12" "vue": "^2.6.12"
}, },
"dependencies": { "dependencies": {
"@tiptap/extension-bubble-menu": "^2.0.0-beta.1", "@tiptap/extension-bubble-menu": "^2.0.0-beta.0",
"prosemirror-view": "^1.18.2" "prosemirror-view": "^1.18.2"
} }
} }