tiptap/docs/api/nodes/hard-break.md

37 lines
1.8 KiB
Markdown
Raw Normal View History

2020-08-20 21:33:16 +08:00
# HardBreak
2021-01-25 17:35:52 +08:00
[![Version](https://img.shields.io/npm/v/@tiptap/extension-hard-break.svg?label=version)](https://www.npmjs.com/package/@tiptap/extension-hard-break)
[![Downloads](https://img.shields.io/npm/dm/@tiptap/extension-hard-break.svg)](https://npmcharts.com/compare/@tiptap/extension-hard-break?minimal=true)
The HardBreak extensions adds support for the `<br>` HTML tag, which forces a line break.
2020-08-20 21:33:16 +08:00
## Installation
```bash
2020-10-30 21:24:16 +08:00
# with npm
npm install @tiptap/extension-hard-break
2020-10-30 21:24:16 +08:00
# with Yarn
yarn add @tiptap/extension-hard-break
```
## Settings
| Option | Type | Default | Description |
| -------------- | --------- | ------- | ---------------------------------------------------------------------------------------------- |
| HTMLAttributes | `Object` | `{}` | Custom HTML attributes that should be added to the rendered HTML tag. |
| keepMarks | `Boolean` | `true` | Decides whether to keep marks after a line break. Based on the `keepOnSplit` option for marks. |
2020-09-10 17:52:20 +08:00
## Commands
| Command | Parameters | Description |
| ------------ | ---------- | ----------------- |
| setHardBreak | — | Add a line break. |
## Keyboard shortcuts
| Command | Windows/Linux | macOS |
| ------------ | ---------------------------------------------- | ------------------------------------------ |
| setHardBreak | `Shift`&nbsp;`Enter`<br>`Control`&nbsp;`Enter` | `Shift`&nbsp;`Enter`<br>`Cmd`&nbsp;`Enter` |
2020-09-21 22:59:28 +08:00
## Source code
2021-04-21 21:31:11 +08:00
[packages/extension-hard-break/](https://github.com/ueberdosis/tiptap/blob/main/packages/extension-hard-break/)
## Usage
<tiptap-demo name="Nodes/HardBreak"></tiptap-demo>