Every extension
textStyle
Colour, background, font family and font size, as one mark.
Tiptap ships these as four extensions layered on a `textStyle` mark; here they are one mark with four attributes, so a coloured, resized word is one `<span>` rather than a nest of them. Setting one attribute keeps the others: `setColor('red')` on text already in a different font leaves the font alone.
Adding it
import { createEditor, document, paragraph, text, textStyle } from '@matrajs/core'
const editor = createEditor({
extensions: [document, paragraph, text, textStyle],
element: document.querySelector('#editor'),
})
There is no separate package · textStyle 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.setColor() -
editor.commands.unsetColor() -
editor.commands.setBackgroundColor() -
editor.commands.unsetBackgroundColor() -
editor.commands.setFontFamily() -
editor.commands.unsetFontFamily() -
editor.commands.setFontSize() -
editor.commands.unsetFontSize() -
editor.commands.unsetTextStyle()
Attributes
-
color -
backgroundColor -
fontFamily -
fontSize
HTML
-
Parses
span -
Renders
span