Every extension
pageBreak
A page break.
A block atom with nothing inside, like a horizontal rule: the caret steps over it, Backspace removes the whole thing, and inserting one at a caret in the middle of a paragraph cuts the paragraph around it. On screen it is a labelled dashed line; in print it is where the page ends and nothing else.
The element is marked non-editable in its own DOM, as the YouTube embed is, so an empty `<div>` inside the editor never becomes a line the caret can sit on.
editor.commands.insertPageBreak()
Adding it
import { createEditor, document, paragraph, text, pageBreak } from '@matrajs/core'
const editor = createEditor({
extensions: [document, paragraph, text, pageBreak],
element: document.querySelector('#editor'),
})
There is no separate package · pageBreak 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.
Commands
-
editor.commands.insertPageBreak()
HTML
-
Parses
div[data-page-break] -
Renders
div
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 { pageBreakCSS } from '@matrajs/core'
const style = document.createElement('style')
style.textContent = pageBreakCSS
document.head.append(style)