如何修改UEditor默认字体和字号?

如何修改UEditor默认字体和字号?

直接打开 UEditor 根目录下的 ueditor.all.js 文件,查找“设置默认字体和字号”,修改默认字体和字号:

.....

//设置默认字体和字号
//font-family不能呢随便改,在safari下fillchar会有解析问题

//注释掉原来的默认字体和字号
//'body{margin:8px;font-family:sans-serif;font-size:16px;}' +

//修改为自己需要的默认字体和字号
'body{margin:8px;font-family:微软雅黑,Microsoft YaHei;font-size:14px;}' +

....

选项里面的字体如果没有你想要的,你可以在根目录 ueditor.config.js 里面查找“字体设置”,取消注释添加你新增的字体或删除不需要的字体:

....

//字体设置 label留空支持多语言自动切换,若配置,则以配置值为准
,'fontfamily':[
 { label:'',name:'yahei',val:'微软雅黑,Microsoft YaHei'},
 { label:'',name:'songti',val:'宋体,SimSun'},
 { label:'',name:'kaiti',val:'楷体,楷体_GB2312, SimKai'},
 { label:'',name:'heiti',val:'黑体, SimHei'},
 { label:'',name:'lishu',val:'隶书, SimLi'},
 { label:'',name:'andaleMono',val:'andale mono'},
 { label:'',name:'arial',val:'arial, helvetica,sans-serif'},
 { label:'',name:'arialBlack',val:'arial black,avant garde'},
 { label:'',name:'comicSansMs',val:'comic sans ms'},
 { label:'',name:'impact',val:'impact,chicago'},
 { label:'',name:'timesNewRoman',val:'times new roman'}
]

....

修改完成后,打开编辑器默认即为自己设置的字体了!
压缩版请进行 Js 压缩 覆盖 ueditor.config.min.js 。