tiptap 字体
这个扩展允许你在编辑器中设置字体。它使用了 TextStyle
标记,渲染一个 <span>
标签。字体家族作为内联样式应用,例如 <span style="font-family: Arial">
。
安装
npm install @tiptap/extension-text-style @tiptap/extension-font-family
这个扩展需要 TextStyle
标记。
配置
types
应用字体家族属性的标记列表。
默认值: ['textStyle']
FontFamily.configure({
types: ["textStyle"],
});
命令
setFontFamily()
将给定的字体家族作为内联样式应用。
editor.commands.setFontFamily("Inter");
unsetFontFamily()
移除任何字体家族。
editor.commands.unsetFontFamily();
源代码
packages/extension-font-family/