braft-editor默认是没有样式的,而我们有时候需要添加样式
只需要添加两段代码就可以实现
const extendControls = [
{
key: "font-family",
},
];
const fontFamily = [
{
name: "宋体",
family: '"宋体",sans-serif',
},
{
name: "方正小标宋",
family: "FZXiaoBiaoSong-B05S",
},
{
name: "仿宋",
family: "FangSong",
},
{
name: "微软雅黑",
family: "Microsoft Yahei",
},
{
name: "黑体",
family: '"黑体",serif',
},
{
name: "楷体",
family: "楷体",
},
];
return (
<div className="My-editor">
<BraftEditor fontFamilies={fontFamily} extendControls={extendControls}/>
</div>
);
更多字体请参考
你学会了吗