add react demo (WIP) to bubble menu
This commit is contained in:
23
docs/src/demos/Extensions/BubbleMenu/React/index.jsx
Normal file
23
docs/src/demos/Extensions/BubbleMenu/React/index.jsx
Normal 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>
|
||||||
|
)
|
||||||
|
}
|
||||||
5
docs/src/demos/Extensions/BubbleMenu/React/styles.scss
Normal file
5
docs/src/demos/Extensions/BubbleMenu/React/styles.scss
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
.ProseMirror {
|
||||||
|
> * + * {
|
||||||
|
margin-top: 0.75em;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -35,5 +35,8 @@ new Editor({
|
|||||||
})
|
})
|
||||||
```
|
```
|
||||||
|
|
||||||
## Vue
|
## Using a framework
|
||||||
<demo name="Extensions/BubbleMenu" />
|
<demos :items="{
|
||||||
|
Vue: 'Extensions/BubbleMenu/Vue',
|
||||||
|
React: 'Extensions/BubbleMenu/React',
|
||||||
|
}" />
|
||||||
|
|||||||
@@ -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"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user