Skip to content

Text Align

Sets the horizontal alignment of the block nodes using the text-align CSS property.

Usage

ts
import { 
defineTextAlign
} from 'prosekit/extensions/text-align'
const
extension
=
defineTextAlign
({
// A list of nodes that will be applied.
types
: ['paragraph', 'heading'],
// An optional default alignment value. Defaults to `left`.
default
: 'center',
})

Commands

setTextAlign

Apply an alignment value to selected blocks.

ts
editor
.
commands
.
setTextAlign
('right')

Keyboard Shortcuts

Non-AppleAppleDescription
Ctrl-Shift-LCommand-Shift-LAlign selected blocks to the left
Ctrl-Shift-RCommand-Shift-RAlign selected blocks to the right
Ctrl-Shift-ECommand-Shift-ECenter selected blocks
Ctrl-Shift-JCommand-Shift-JJustify selected blocks

API Reference