引用块扩展
引用块扩展允许你在编辑器中使用 <blockquote> HTML 标签。这对于……展示引用内容非常有用,对吧?
在新行开头输入 < 之后跟着 > ,就会神奇地变成引用块。
安装
npm install @tiptap/extension-blockquote配置
HTMLAttributes
自定义要添加到渲染HTML标签中的HTML属性。
Blockquote.configure({
HTMLAttributes: {
class: '我的自定义类',
},
})命令
setBlockquote()
将内容包裹在引用块中。
editor.commands.setBlockquote()toggleBlockquote()
切换引用块的显示与隐藏(包裹或解包引用块)。
editor.commands.toggleBlockquote()unsetBlockquote()
移除引用块包裹。
editor.commands.unsetBlockquote()键盘快捷键
| 命令 | Windows/Linux | macOS |
|---|---|---|
| 切换引用块 | Control + Shift + B | Cmd + Shift + B |