Every extension
placeholder
Prompt text for an empty editor.
Implemented as a data attribute on the editable element plus a CSS rule, rather than a fake node in the document — a placeholder that lives in the document is one a user can select, copy and accidentally save.
Adding it
import { createEditor, document, paragraph, text, placeholder } from '@matrajs/core'
const editor = createEditor({
extensions: [document, paragraph, text, placeholder({ … })],
element: document.querySelector('#editor'),
})
There is no separate package · placeholder 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 | |
|---|---|---|
text required | string | |
everyBlock | boolean | Also prompt inside an empty block the caret is in, not just an empty document — the way a Notion-style page hints at every new line. |
Styles
This one needs a stylesheet to look right, and ships the minimum as a string rather than a file · nothing is loaded unless you load it.
import { placeholderCSS } from '@matrajs/core'
const style = document.createElement('style')
style.textContent = placeholderCSS
document.head.append(style)