引用块
引用块扩展允许你在编辑器中使用 <blockquote>
HTML 标签。这对于...在编辑器中显示引用很有用,你知道的?
在新的一行开始时输入 <code> </code>
,它会神奇地变成一个引用。
安装
npm install @tiptap/extension-blockquote
配置
HTMLAttributes
自定义应添加到渲染 HTML 标签上的自定义 HTML 属性。
Blockquote.configure({
HTMLAttributes: {
class: "my-custom-class",
},
});
命令
setBlockquote()
将内容包裹在一个引用块中。
editor.commands.setBlockquote();
toggleBlockquote()
包裹或取消包裹一个引用块。
editor.commands.toggleBlockquote();
unsetBlockquote()
取消包裹引用块。
editor.commands.unsetBlockquote();
快捷键
命令 | Windows/Linux | macOS |
---|---|---|
切换引用块 | Ctrl Shift B |
Cmd Shift B |
源代码
packages/extension-blockquote/