Every extension
floatingMenu
A menu that appears on an empty line.
The "what goes here" affordance: a plus in the margin, or a row of block types beside the caret. Shown when the caret sits in an empty top-level paragraph in a focused editor, and nowhere else.
Adding it
import { createEditor, document, paragraph, text, floatingMenu } from '@matrajs/core'
const editor = createEditor({
extensions: [document, paragraph, text, floatingMenu({ … })],
element: document.querySelector('#editor'),
})
There is no separate package · floatingMenu is already in @matrajs/core, and an extension you do not import is not in your bundle. document, paragraph and text are the floor every document needs.
Options
| Field | Type | |
|---|---|---|
element required | HTMLElement | |
shouldShow | (editor: Editor) => boolean | When to show it. Default: the caret is in an empty top-level paragraph and the editor has focus. |
placement | 'start' | 'left' | At the start of the line, or in the margin to its left. Default `start`. |
offset | number |