2020-10-28 05:43:38 +08:00
|
|
|
# TextAlign
|
2020-11-06 22:44:23 +08:00
|
|
|
This extension adds a text align attribute to a specified list of nodes. The attribute is used to align the text.
|
2020-10-23 21:23:40 +08:00
|
|
|
|
|
|
|
## Installation
|
|
|
|
```bash
|
2020-10-30 21:24:16 +08:00
|
|
|
# with npm
|
2020-10-23 21:23:40 +08:00
|
|
|
npm install @tiptap/extension-text-align
|
|
|
|
|
2020-10-30 21:24:16 +08:00
|
|
|
# with Yarn
|
2020-10-23 21:23:40 +08:00
|
|
|
yarn add @tiptap/extension-text-align
|
|
|
|
```
|
|
|
|
|
2020-11-03 23:43:35 +08:00
|
|
|
## Settings
|
2020-11-06 22:44:23 +08:00
|
|
|
| Option | Type | Default | Description |
|
|
|
|
| ---------------- | ------ | -------------------------------------- | -------------------------------------------------------------------- |
|
|
|
|
| types | array | ['heading', 'paragraph'] | A list of nodes where the text align attribute should be applied to. |
|
|
|
|
| alignments | array | ['left', 'center', 'right', 'justify'] | A list of available options for the text align attribute. |
|
|
|
|
| defaultAlignment | string | left | The default text align. |
|
2020-11-03 23:43:35 +08:00
|
|
|
|
|
|
|
## Commands
|
2020-11-06 22:44:23 +08:00
|
|
|
| Command | Parameters | Description |
|
|
|
|
| --------- | ---------- | ------------------------------------------ |
|
|
|
|
| textAlign | alignment | Set the text align to the specified value. |
|
2020-11-03 23:43:35 +08:00
|
|
|
|
|
|
|
## Keyboard shortcuts
|
2020-11-06 22:44:23 +08:00
|
|
|
* `Ctrl` `Shift` `L` Left
|
|
|
|
* `Ctrl` `Shift` `E` Center
|
|
|
|
* `Ctrl` `Shift` `R` Right
|
|
|
|
* `Ctrl` `Shift` `J` Justify
|
2020-11-03 23:43:35 +08:00
|
|
|
|
2020-10-23 21:23:40 +08:00
|
|
|
## Source code
|
|
|
|
[packages/extension-text-align/](https://github.com/ueberdosis/tiptap-next/blob/main/packages/extension-text-align/)
|
|
|
|
|
|
|
|
## Usage
|
2020-11-06 22:44:23 +08:00
|
|
|
<demo name="Extensions/TextAlign" highlight="29" />
|