百度编辑器修改配置文件经验分享
工具栏按钮及下拉菜单配置
修改文件:ueditor.config.js
修改代码:
//工具栏上的所有的功能按钮和下拉框,可以在new编辑器的实例时选择自己需要的从新定义,toolbars:[["source",'undo','redo','pasteplain',"fontfamily","fontsize","paragraph","insertcode",'bold',"forecolor","backcolor","blockquote","link","unlink","simpleupload","insertimage","attachment","music","insertvideo","etranxx","justifyleft","justifycenter","justifyright","lineheight","inserttable","anchor","removeformat","autotypeset","pagebreak","drafts","fullscreen"]]
其他大部分按钮下拉菜单都在这个文件内,默认为注释的,想修改就把注释取消,删除不需要的下拉菜单就可以。
//paragraph//段落格式值留空时支持多语言自动识别,若配置,则以配置值为准,'paragraph':{'p':'','h2':'','h3':''}
插入代码高亮下拉配置
修改文件:ueditor.all.js
修改代码:
/***插入代码插件*@file*@since1.2.6.1*/UE.plugins['insertcode']=function(){varme=this;me.ready(function(){utils.cssRule('pre','pre{margin:.5em0;padding:.4em.6em;border-radius:8px;background:#f8f8f8;}',me.document)});me.setOpt('insertcode',{'php':'Php','html':'Html','js':'Javascript','css':'Css','python':'Python','xml':'Xml','java':'Java','sql':'Sql'});
后端上传文件大小和格式配置
修改文件:php/config.JSON
修改代码:
/*上传图片配置项*/"imageActionName":"uploadimage",/*执行上传图片的action名称*/"imageFieldName":"upfile",/*提交的图片表单名称*/"imageMaxSize":2048000,/*上传大小限制,单位B*/"imageAllowFiles":[".png",".jpg",".jpeg",".gif",".bmp"],/*上传图片格式显示*/"imageCompressEnable":true,/*是否压缩图片,默认是true*/"imageCompressBorder":1600,/*图片压缩最长边限制*/"imageInsertAlign":"none",/*插入的图片浮动方式*/"imageUrlPrefix":"",/*图片访问路径前缀*/"imagePathFormat":"/ueditor/php/upload/image/{yyyy}{mm}{dd}/{time}{rand:6}",
所有上传配置都在这个文件内,自行修改。