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)
|
|
|
|
|
2020-09-10 17:35:56 +08:00
|
|
|
The HardBreak extensions adds support for the `<br>` HTML tag, which forces a line break.
|
2020-08-20 21:33:16 +08:00
|
|
|
|
2020-09-23 15:52:04 +08:00
|
|
|
## Installation
|
|
|
|
```bash
|
2020-10-30 21:24:16 +08:00
|
|
|
# with npm
|
2020-09-23 15:52:04 +08:00
|
|
|
npm install @tiptap/extension-hard-break
|
|
|
|
|
2020-10-30 21:24:16 +08:00
|
|
|
# with Yarn
|
2020-09-23 15:52:04 +08:00
|
|
|
yarn add @tiptap/extension-hard-break
|
|
|
|
```
|
|
|
|
|
2021-09-23 15:34:47 +08:00
|
|
|
## 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
|
2021-09-23 15:34:47 +08:00
|
|
|
| Command | Parameters | Description |
|
|
|
|
| ------------ | ---------- | ----------------- |
|
|
|
|
| setHardBreak | — | Add a line break. |
|
2020-09-10 17:35:56 +08:00
|
|
|
|
2020-09-10 17:24:33 +08:00
|
|
|
## Keyboard shortcuts
|
2021-10-02 04:57:27 +08:00
|
|
|
| Command | Windows/Linux | macOS |
|
|
|
|
| ------------ | ---------------------------------------------- | ------------------------------------------ |
|
|
|
|
| setHardBreak | `Shift` `Enter`<br>`Control` `Enter` | `Shift` `Enter`<br>`Cmd` `Enter` |
|
2020-09-10 17:35:56 +08:00
|
|
|
|
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/)
|
2020-09-10 17:35:56 +08:00
|
|
|
|
|
|
|
## Usage
|
2021-08-26 05:10:20 +08:00
|
|
|
<tiptap-demo name="Nodes/HardBreak"></tiptap-demo>
|