其他分享
首页 > 其他分享> > UEditor添加字体

UEditor添加字体

作者:互联网

UEditor添加字体

最近工作中遇到一个问题,百度富文本里的字体不够用,还想扩展其他的字体,今天来记录一下:

第一步,修改zh-cn.js 找到fontfamily,添加要添加的字体

'fontfamily':{
        'FangSong': '仿宋',
        'songti':'宋体',
        'heiti':'黑体',
        'kaiti':'楷体',
        'lishu':'隶书',
        'yahei':'微软雅黑',
        'arial':'arial',
        'arialBlack':'arial black',
        'bookAntiqua':'Book Antiqua',
        'Calibri':'Calibri',
        'comicSansMs':'comic sans ms',
        'Courier New':'Courier New',
        'Garamond':'Garamond',
        'Georgia':'Georgia',
        'Helvetica':'Helvetica',
        'impact':'impact,chicago',
        'Narrow':'Narrow',
        'Sans Serif':'Sans Serif',
        'Serif':'Serif',
        'Symbol':'Symbol',
        'Tahoma':'Tahoma',
        'timesNewRoman':'times new roman',
        'Trebuchet MS':'Trebuchet MS',
        'Verdana':'Verdana',
        'andaleMono':'andale mono'
    },

第二步,修改ueditor.config.js ,找到fontfamily(如果是注释掉的就把注释打开),添加字体信息即可

,'fontfamily':[
            { label:'',name:'FangSong',val:'仿宋,FangSong'},
            { label:'',name:'songti',val:'宋体,SimSun'},
            { label:'',name:'heiti',val:'黑体, SimHei'},
            { label:'',name:'kaiti',val:'楷体,楷体_GB2312, SimKai'},
            { label:'',name:'lishu',val:'隶书, SimLi'},
            { label:'',name:'yahei',val:'微软雅黑,Microsoft YaHei'},
            { label:'',name:'arial',val:'arial, helvetica,sans-serif'},
            { label:'',name:'arialBlack',val:'arial black,avant garde'},//Arial Black
            { label:'',name:'bookAntiqua',val:'Book Antiqua'},//
            { label:'',name:'Calibri',val:'Calibri'},//Calibri
            { label:'',name:'comicSansMs',val:'comic sans ms'},
            { label:'',name:'Courier New',val:'Courier New'},//Courier New
            { label:'',name:'Garamond',val:'Garamond'},//Garamond
            { label:'',name:'Georgia',val:'Georgia'},//Georgia
            { label:'',name:'Helvetica',val:'Helvetica'},//Helvetica
            { label:'',name:'impact',val:'impact,chicago'},
            { label:'',name:'Narrow',val:'Narrow'},//Narrow
            { label:'',name:'Sans Serif',val:'Sans Serif'},//Sans Serif
            { label:'',name:'Serif',val:'Serif'},//Serif
            { label:'',name:'Symbol',val:'Symbol'},//Symbol
            { label:'',name:'Tahoma',val:'Tahoma'},//Tahoma
            { label:'',name:'timesNewRoman',val:'times new roman'},//Times New Roman
            { label:'',name:'Trebuchet MS',val:'Trebuchet MS'},//Trebuchet MS
            { label:'',name:'Verdana',val:'Verdana'},//Verdana
            { label:'',name:'andaleMono',val:'andale mono'}
        ]

配置完以上两步重新启动项目刷新就可以啦~

标签:UEditor,arial,name,val,label,Serif,添加,字体,New
来源: https://blog.csdn.net/Ellis_li/article/details/101020645