Every extension
mention
A mention, as a node rather than styled text.
An atom: the caret steps over it, backspace removes the whole thing, and it cannot be half-deleted into `@Nahi`. That is the entire argument for making it a node — styled text looks identical until someone edits it, and then it quietly stops being a reference to anybody.
The id travels with it, so the document keeps a reference rather than a name that was true when it was typed.
Adding it
import { createEditor, document, paragraph, text, mention } from '@matrajs/core'
const editor = createEditor({
extensions: [document, paragraph, text, mention({ … })],
element: document.querySelector('#editor'),
})
There is no separate package · mention 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 | |
|---|---|---|
render | (attrs: { id: string | What appears in the document. Defaults to `@label`. |
label required | string | |
name | string | Node name, if you need two kinds of mention in one editor. |
Commands
-
editor.commands.insertMention()
Attributes
-
id -
label· defaults to""
HTML
-
Parses
span[data-mention-id] -
Renders
span