tiptap 颜色
此扩展允许您在编辑器中设置字体颜色。它使用 TextStyle 标记,仅渲染 <span> 标签。然后,字体颜色作为内联样式应用,例如 <span style="color: #958DF1"> 。
安装
npm install @tiptap/extension-text-style @tiptap/extension-color
这个扩展需要 TextStyle 标记。
配置
类型
一个列表,指定应将颜色属性应用于哪些标记。
默认值: ['textStyle']
Color.configure({
types: ["textStyle"],
});
命令
setColor()
应用给定的字体颜色作为内联样式。
editor.commands.setColor("#ff0000");
unsetColor()
移除任何字体颜色。
editor.commands.unsetColor();
抠丁客
