tiptap/docs/api/nodes/hard-break.md
2021-11-09 11:56:27 +01:00

1.6 KiB
Raw Blame History

description icon
Sometimes we all need a break, even if its just a line break. text-wrap

HardBreak

Version Downloads

The HardBreak extensions adds support for the <br> HTML tag, which forces a line break.

Installation

npm install @tiptap/extension-hard-break

Settings

HTMLAttributes

Custom HTML attributes that should be added to the rendered HTML tag.

HardBreak.configure({
  HTMLAttributes: {
    class: 'my-custom-class',
  },
})

keepMarks

Decides whether to keep marks after a line break. Based on the keepOnSplit option for marks.

Default: true

HardBreak.configure({
  keepMarks: false,
})

Commands

setHardBreak()

Add a line break.

editor.commands.setHardBreak()

Keyboard shortcuts

Command Windows/Linux macOS
setHardBreak Shift Enter
Control Enter
Shift Enter
Cmd Enter

Source code

packages/extension-hard-break/

Usage

https://embed.tiptap.dev/preview/Nodes/HardBreak