diff --git a/docs/src/demos/Examples/BubbleMenu/React/index.jsx b/docs/src/demos/Examples/BubbleMenu/React/index.jsx new file mode 100644 index 000000000..01787e1f5 --- /dev/null +++ b/docs/src/demos/Examples/BubbleMenu/React/index.jsx @@ -0,0 +1,43 @@ +import React from 'react' +import { useEditor, EditorContent, BubbleMenu } from '@tiptap/react' +import { defaultExtensions } from '@tiptap/starter-kit' +import './styles.scss' + +export default () => { + const editor = useEditor({ + extensions: [ + ...defaultExtensions(), + ], + content: ` +

+ 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. +

+ `, + }) + + return ( +
+ {editor && + + + + } + +
+ ) +} diff --git a/docs/src/demos/Examples/BubbleMenu/React/index.spec.js b/docs/src/demos/Examples/BubbleMenu/React/index.spec.js new file mode 100644 index 000000000..a5397b177 --- /dev/null +++ b/docs/src/demos/Examples/BubbleMenu/React/index.spec.js @@ -0,0 +1,7 @@ +context('/demos/Examples/BubbleMenu/React', () => { + before(() => { + cy.visit('/demos/Examples/BubbleMenu/React') + }) + + // TODO: Write tests +}) diff --git a/docs/src/demos/Examples/BubbleMenu/React/styles.scss b/docs/src/demos/Examples/BubbleMenu/React/styles.scss new file mode 100644 index 000000000..12c872982 --- /dev/null +++ b/docs/src/demos/Examples/BubbleMenu/React/styles.scss @@ -0,0 +1,5 @@ +.ProseMirror { + > * + * { + margin-top: 0.75em; + } +} diff --git a/docs/src/demos/Examples/BubbleMenu/Vue/index.spec.js b/docs/src/demos/Examples/BubbleMenu/Vue/index.spec.js new file mode 100644 index 000000000..67e04692d --- /dev/null +++ b/docs/src/demos/Examples/BubbleMenu/Vue/index.spec.js @@ -0,0 +1,7 @@ +context('/demos/Examples/BubbleMenu/Vue', () => { + before(() => { + cy.visit('/demos/Examples/BubbleMenu/Vue') + }) + + // TODO: Write tests +}) diff --git a/docs/src/demos/Examples/BubbleMenu/Vue/index.vue b/docs/src/demos/Examples/BubbleMenu/Vue/index.vue new file mode 100644 index 000000000..d803dc946 --- /dev/null +++ b/docs/src/demos/Examples/BubbleMenu/Vue/index.vue @@ -0,0 +1,60 @@ + + + + + diff --git a/docs/src/demos/Examples/Tasks/index.spec.js b/docs/src/demos/Examples/Tasks/index.spec.js new file mode 100644 index 000000000..87065b641 --- /dev/null +++ b/docs/src/demos/Examples/Tasks/index.spec.js @@ -0,0 +1,7 @@ +context('/demos/Examples/Tasks', () => { + before(() => { + cy.visit('/demos/Examples/Tasks') + }) + + // TODO: Write tests +}) diff --git a/docs/src/demos/Examples/TodoApp/index.vue b/docs/src/demos/Examples/Tasks/index.vue similarity index 100% rename from docs/src/demos/Examples/TodoApp/index.vue rename to docs/src/demos/Examples/Tasks/index.vue diff --git a/docs/src/demos/Examples/TodoApp/index.spec.js b/docs/src/demos/Examples/TodoApp/index.spec.js deleted file mode 100644 index 98f350e9b..000000000 --- a/docs/src/demos/Examples/TodoApp/index.spec.js +++ /dev/null @@ -1,7 +0,0 @@ -context('/demos/Examples/TodoApp', () => { - before(() => { - cy.visit('/demos/Examples/TodoApp') - }) - - // TODO: Write tests -}) diff --git a/docs/src/demos/Extensions/BubbleMenu/Vue/index.vue b/docs/src/demos/Extensions/BubbleMenu/Vue/index.vue index b58055881..d803dc946 100644 --- a/docs/src/demos/Extensions/BubbleMenu/Vue/index.vue +++ b/docs/src/demos/Extensions/BubbleMenu/Vue/index.vue @@ -38,7 +38,7 @@ export default { ], content: `

- 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. + Hey, try to select some text here. You’ll see a formatting menu pop up. And as always, you are in full control about content and styling of this menu.

`, }) diff --git a/docs/src/docPages/api/extensions/bubble-menu.md b/docs/src/docPages/api/extensions/bubble-menu.md index bda72d462..9c1d132d3 100644 --- a/docs/src/docPages/api/extensions/bubble-menu.md +++ b/docs/src/docPages/api/extensions/bubble-menu.md @@ -2,7 +2,9 @@ [![Version](https://img.shields.io/npm/v/@tiptap/extension-bubble-menu.svg?label=version)](https://www.npmjs.com/package/@tiptap/extension-bubble-menu) [![Downloads](https://img.shields.io/npm/dm/@tiptap/extension-bubble-menu.svg)](https://npmcharts.com/compare/@tiptap/extension-bubble-menu?minimal=true) -This extension will make a contextual menu appear near a selection of text. +This extension will make a contextual menu appear near a selection of text. Use it to let users apply [marks](/api/marks) to their text selection. + +As always, the markup and styling is totally up to you. The menu is positioned absolute and requires a wrapper with `position: relative`, that’s basically the only requirement though. ## Installation ```bash @@ -13,15 +15,17 @@ yarn add @tiptap/extension-bubble-menu ``` ## Settings -| Option | Type | Default | Description | -| ------------ | ------------- | --------- | --------------------------------------------------------- | -| element | `HTMLElement` | `null` | The DOM element of your menu. | -| keepInBounds | `Boolean` | `true` | Specifies that the element is not rendered across bounds. | +| Option | Type | Default | Description | +| ------------ | ------------- | ------- | -------------------------------------------------------------------- | +| element | `HTMLElement` | `null` | The DOM element that contains your menu. | +| keepInBounds | `Boolean` | `true` | When enabled, it’s rendered inside the bounding box of the document. | ## Source code [packages/extension-bubble-menu/](https://github.com/ueberdosis/tiptap-next/blob/main/packages/extension-bubble-menu/) -## Using Vanilla JavaScript +## Usage + +### JavaScript ```js import { Editor } from '@tiptap/core' import BubbleMenu from '@tiptap/extension-bubble-menu' @@ -35,7 +39,7 @@ new Editor({ }) ``` -## Using a framework +### Frameworks diff --git a/docs/src/docPages/examples/interactive.md b/docs/src/docPages/examples/interactivity.md similarity index 91% rename from docs/src/docPages/examples/interactive.md rename to docs/src/docPages/examples/interactivity.md index da30aa67b..9edeea16d 100644 --- a/docs/src/docPages/examples/interactive.md +++ b/docs/src/docPages/examples/interactivity.md @@ -1,4 +1,4 @@ -# Interactive node views +# Interactivity Thanks to [node views](/guide/node-views) you can add interactivity to your nodes. If you can write it in JavaScript, you can add it to the editor. diff --git a/docs/src/docPages/examples/minimal.md b/docs/src/docPages/examples/minimal.md index 773df4ea6..00feb801b 100644 --- a/docs/src/docPages/examples/minimal.md +++ b/docs/src/docPages/examples/minimal.md @@ -1,3 +1,3 @@ -# Minimal +# Minimal setup diff --git a/docs/src/docPages/examples/savvy.md b/docs/src/docPages/examples/savvy.md index 65450a8e4..71784533e 100644 --- a/docs/src/docPages/examples/savvy.md +++ b/docs/src/docPages/examples/savvy.md @@ -1,3 +1,3 @@ -# Savvy editor +# A clever editor diff --git a/docs/src/docPages/examples/community.md b/docs/src/docPages/examples/suggestions.md similarity index 87% rename from docs/src/docPages/examples/community.md rename to docs/src/docPages/examples/suggestions.md index fd34d2d55..65c298809 100644 --- a/docs/src/docPages/examples/community.md +++ b/docs/src/docPages/examples/suggestions.md @@ -1,4 +1,4 @@ -# Suggestions +# Mentions diff --git a/docs/src/docPages/examples/todo-app.md b/docs/src/docPages/examples/todo-app.md deleted file mode 100644 index b96614258..000000000 --- a/docs/src/docPages/examples/todo-app.md +++ /dev/null @@ -1,3 +0,0 @@ -# Todo App - - diff --git a/docs/src/links.yaml b/docs/src/links.yaml index 1bc8ef06c..8212593a6 100644 --- a/docs/src/links.yaml +++ b/docs/src/links.yaml @@ -53,6 +53,9 @@ # type: pro - title: Markdown shortcuts link: /examples/markdown-shortcuts + - title: Bubble menu + link: /examples/bubble-menu + type: new - title: Tables link: /examples/tables # type: pro @@ -61,19 +64,19 @@ - title: Formatting link: /examples/formatting - title: Tasks - link: /examples/todo-app + link: /examples/tasks - title: Long texts link: /examples/book - title: Drawing link: /examples/drawing - title: Mentions - link: /examples/community + link: /examples/suggestions - title: Minimal setup link: /examples/minimal - title: A clever editor link: /examples/savvy - title: Interactivity - link: /examples/interactive + link: /examples/interactivity - title: Guide items: @@ -197,6 +200,7 @@ # type: draft - title: BubbleMenu link: /api/extensions/bubble-menu + type: new - title: CharacterCount link: /api/extensions/character-count - title: Collaboration