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-Apple | Apple | Description |
---|---|---|
Ctrl-Shift-L | Command-Shift-L | Align selected blocks to the left |
Ctrl-Shift-R | Command-Shift-R | Align selected blocks to the right |
Ctrl-Shift-E | Command-Shift-E | Center selected blocks |
Ctrl-Shift-J | Command-Shift-J | Justify selected blocks |