tiptap/docs/src/docPages/api/extensions/blockquote.md

60 lines
1.5 KiB
Markdown
Raw Normal View History

2020-08-19 03:39:41 +08:00
# Blockquote
2020-08-20 21:33:16 +08:00
The Blockquote extension enables you to use the `<blockquote>` HTML tag in the editor.
2020-08-19 03:39:41 +08:00
2020-08-20 21:33:16 +08:00
## Options
2020-09-10 16:21:24 +08:00
| Option | Type | Default | Description |
| ------ | ------ | ------- | -------------------------------------------- |
| class | string | | Add a custom class to the rendered HTML tag. |
2020-08-19 03:39:41 +08:00
2020-08-20 21:33:16 +08:00
## Commands
2020-09-10 16:21:24 +08:00
| Command | Options | Description |
| ---------- | ------- | ----------------------------- |
| blockquote | — | Wrap content in a blockquote. |
2020-08-19 03:39:41 +08:00
2020-08-20 21:33:16 +08:00
## Keybindings
2020-08-19 03:39:41 +08:00
* `Control` + `→`
2020-08-20 21:33:16 +08:00
## Usage
2020-08-19 03:39:41 +08:00
```markup
<template>
<div>
<editor-menu-bar :editor="editor" v-slot="{ commands, isActive }">
<button type="button" :class="{ 'is-active': isActive.blockquote() }" @click="commands.blockquote">
Blockquote
</button>
</editor-menu-bar>
<editor-content :editor="editor" />
</div>
</template>
<script>
import { Editor, EditorContent, EditorMenuBar } from 'tiptap'
import { Blockquote } from 'tiptap-extensions'
export default {
components: {
EditorMenuBar,
EditorContent,
},
data() {
return {
editor: new Editor({
extensions: [
2020-09-09 16:58:10 +08:00
Blockquote(),
2020-08-19 03:39:41 +08:00
],
content: `
<blockquote>
Life is like riding a bycicle. To keep your balance, you must keep moving.
</blockquote>
<p>Albert Einstein</p>
`,
}),
}
},
beforeDestroy() {
this.editor.destroy()
}
}
</script>
```