mirror of
https://github.com/ueberdosis/tiptap.git
synced 2024-12-13 09:29:01 +08:00
2.7 KiB
2.7 KiB
TextAlign
This extension adds a text align attribute to a specified list of nodes. The attribute is used to align the text.
:::warning Firefox bug
text-align: justify
doesn't work together with white-space: pre-wrap
in Firefox, that’s a known issue.
:::
Installation
# with npm
npm install @tiptap/extension-text-align
# with Yarn
yarn add @tiptap/extension-text-align
Settings
Option | Type | Default | Description |
---|---|---|---|
types | Array |
[] |
A list of nodes where the text align attribute should be applied to. Usually something like ['heading', 'paragraph'] . |
alignments | Array |
['left', 'center', 'right', 'justify'] |
A list of available options for the text align attribute. |
defaultAlignment | String |
'left' |
The default text align. |
Commands
Command | Parameters | Description |
---|---|---|
textAlign | alignment | Set the text align to the specified value. |
Keyboard shortcuts
Command | Windows/Linux | macOS |
---|---|---|
setTextAlign('left') | Ctrl Shift L |
Cmd Shift L |
setTextAlign('center') | Ctrl Shift E |
Cmd Shift E |
setTextAlign('right') | Ctrl Shift R |
Cmd Shift R |
setTextAlign('justify') | Ctrl Shift J |
Cmd Shift J |
Source code
packages/extension-text-align/