2021-10-14 06:13:50 +08:00
|
|
|
|
---
|
|
|
|
|
description: Quoting other people lets you look clever.
|
|
|
|
|
---
|
|
|
|
|
|
2020-08-19 03:39:41 +08:00
|
|
|
|
# Blockquote
|
2021-01-25 17:35:52 +08:00
|
|
|
|
[![Version](https://img.shields.io/npm/v/@tiptap/extension-blockquote.svg?label=version)](https://www.npmjs.com/package/@tiptap/extension-blockquote)
|
|
|
|
|
[![Downloads](https://img.shields.io/npm/dm/@tiptap/extension-blockquote.svg)](https://npmcharts.com/compare/@tiptap/extension-blockquote?minimal=true)
|
2020-10-01 18:26:20 +08:00
|
|
|
|
|
2021-10-02 04:45:12 +08:00
|
|
|
|
The Blockquote extension enables you to use the `<blockquote>` HTML tag in the editor. This is great to … show quotes in the editor, you know?
|
2020-09-10 17:19:49 +08:00
|
|
|
|
|
2020-09-23 15:31:05 +08:00
|
|
|
|
Type <code>> </code> at the beginning of a new line and it will magically transform to a blockquote.
|
2020-09-21 22:59:28 +08:00
|
|
|
|
|
|
|
|
|
## Installation
|
|
|
|
|
```bash
|
2020-10-30 21:24:16 +08:00
|
|
|
|
# with npm
|
2020-09-21 22:59:28 +08:00
|
|
|
|
npm install @tiptap/extension-blockquote
|
|
|
|
|
|
2020-10-30 21:24:16 +08:00
|
|
|
|
# with Yarn
|
2020-09-21 22:59:28 +08:00
|
|
|
|
yarn add @tiptap/extension-blockquote
|
|
|
|
|
```
|
2020-08-19 03:39:41 +08:00
|
|
|
|
|
2020-09-23 18:03:03 +08:00
|
|
|
|
## Settings
|
2021-10-02 04:45:12 +08:00
|
|
|
|
|
|
|
|
|
### HTMLAttributes
|
|
|
|
|
Custom HTML attributes that should be added to the rendered HTML tag.
|
|
|
|
|
|
|
|
|
|
```js
|
|
|
|
|
Blockquote.configure({
|
|
|
|
|
HTMLAttributes: {
|
|
|
|
|
class: 'my-custom-class',
|
|
|
|
|
},
|
|
|
|
|
})
|
|
|
|
|
```
|
2020-08-19 03:39:41 +08:00
|
|
|
|
|
2020-08-20 21:33:16 +08:00
|
|
|
|
## Commands
|
2021-10-02 04:45:12 +08:00
|
|
|
|
### setBlockquote()
|
|
|
|
|
Wrap content in a blockquote.
|
|
|
|
|
|
|
|
|
|
```js
|
|
|
|
|
editor.commands.setBlockquote()
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
### toggleBlockquote()
|
|
|
|
|
Wrap or unwrap a blockquote.
|
|
|
|
|
|
|
|
|
|
```js
|
|
|
|
|
editor.commands.toggleBlockquote()
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
### unsetBlockquote()
|
|
|
|
|
Unwrap a blockquote.
|
|
|
|
|
|
|
|
|
|
```js
|
|
|
|
|
editor.commands.unsetBlockquote()
|
|
|
|
|
```
|
2020-08-19 03:39:41 +08:00
|
|
|
|
|
2020-09-10 17:24:33 +08:00
|
|
|
|
## Keyboard shortcuts
|
2021-10-02 04:57:27 +08:00
|
|
|
|
| Command | Windows/Linux | macOS |
|
2021-10-02 04:45:12 +08:00
|
|
|
|
| ----------------- | ------------------------------- | --------------------------- |
|
|
|
|
|
| Toggle Blockquote | `Control` `Shift` `B` | `Cmd` `Shift` `B` |
|
2020-08-19 03:39:41 +08:00
|
|
|
|
|
2020-09-21 22:59:28 +08:00
|
|
|
|
## Source code
|
2021-04-21 21:31:11 +08:00
|
|
|
|
[packages/extension-blockquote/](https://github.com/ueberdosis/tiptap/blob/main/packages/extension-blockquote/)
|
2020-08-19 03:39:41 +08:00
|
|
|
|
|
2020-09-10 17:19:49 +08:00
|
|
|
|
## Usage
|
2021-08-26 05:10:20 +08:00
|
|
|
|
<tiptap-demo name="Nodes/Blockquote"></tiptap-demo>
|