百度ueditor修改默认编辑器字体与大小

2017-01-26 21:18 阅读 8,323 次 评论 0 条

在插件目录ueditor里面的找到editor_config.js根目录:修改默认字体。

  1. //fontfamily
  2. //字体
  3. //,'fontfamily':[
  4. //   ['宋体',['宋体', 'SimSun']],
  5. //   ['楷体',['楷体', '楷体_GB2312', 'SimKai']],
  6. //   ['黑体',['黑体', 'SimHei']],
  7. //   ['隶书',['隶书', 'SimLi']],
  8. //   ['andale mono',['andale mono']],
  9. //   ['arial',['arial', 'helvetica', 'sans-serif']],
  10.   //   ['arial black',['arial black', 'avant garde']],
  11.   //   ['comic sans ms',['comic sans ms']],
  12.   //   ['impact',['impact', 'chicago']],
  13.    //   ['times new roman',['times new roman']]
  14.   //  ]

只要把里面的注释“//”去掉。更改为你需要的就是了。在他下面还有一句

  1.  //fontsize
  2.         //字号
  3.         ,'fontsize':[10, 11, 12, 13, 14, 15, 16, 18, 20, 24, 36]

这一句是设置“编辑器里有更多字体大小选择”。

找到editor_all.js根目录:修改默认字体大小

  1. //这些默认属性不能够让用户改变
  2.                             //选中的td上的样式
  3.                                 '.selectTdClass{background-color:#3399FF !important;}' +
  4.                                 'table.noBorderTable td{border:1px dashed #ddd !important}' +
  5.                             //插入的表格的默认样式
  6.                                 'table{clear:both;margin-bottom:10px;border-collapse:collapse;word-break:break-all;}' +
  7.                             //分页符的样式
  8.                                 '.pagebreak{display:block;clear:both !important;cursor:default !important;width: 100% !important;margin:0;}' +
  9.                                 '.subtitle{display:block;clear:both !important;cursor:default !important;width: 100% !important;margin:0;}' +
  10.                             //锚点的样式,注意这里背景图的路径
  11.                                 '.anchorclass{background: url(\'' + me.options.UEDITOR_HOME_URL + 'themes/default/images/anchor.gif\') no-repeat scroll left center transparent;border: 1px dotted #0000FF;cursor: auto;display: inline-block;height: 16px;width: 15px;}' +
  12.                             //设置四周的留边
  13.                                 '.view{padding:0;word-wrap:break-word;cursor:text;height:100%;}\n' +
  14.                             //设置默认字体和字号
  15.                                 'body{margin:8px;font-family:\'宋体\';font-size:16px;}' +
  16.                             //针对li的处理
  17.                                 'li{clear:both}' +
  18.                             //设置段落间距
  19.                                 'p{margin:5px 0;}'
  20.                                 + ( options.initialStyle || '' ) +
  21.                                 '</style></head><body' + (useBodyAsViewport ? ' class=\'view\'' : '') + '></body>';

把:'body{margin:8px;font-family:\'宋体\';font-size:16px;}' 中16px改成自己需要的字体和字号。

版权声明:本文著作权归原作者所有,欢迎分享本文,谢谢支持!
转载请注明:百度ueditor修改默认编辑器字体与大小 | 雨晨博客

发表评论


表情