mirror of
https://github.com/ueberdosis/tiptap.git
synced 2025-01-18 22:36:14 +08:00
60 lines
1.5 KiB
Markdown
60 lines
1.5 KiB
Markdown
# Blockquote
|
||
The Blockquote extension enables you to use the `<blockquote>` HTML tag in the editor.
|
||
|
||
## Options
|
||
| Option | Type | Default | Description |
|
||
| ------ | ------ | ------- | -------------------------------------------- |
|
||
| class | string | – | Add a custom class to the rendered HTML tag. |
|
||
|
||
## Commands
|
||
| Command | Options | Description |
|
||
| ---------- | ------- | ----------------------------- |
|
||
| blockquote | — | Wrap content in a blockquote. |
|
||
|
||
## Keyboard shortcuts
|
||
* `Control` + `→`
|
||
|
||
## Usage
|
||
```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: [
|
||
Blockquote(),
|
||
],
|
||
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>
|
||
``` |