editor_config.js 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372
  1. /**
  2. * ueditor完整配置项
  3. * 可以在这里配置整个编辑器的特性
  4. */
  5. /**************************提示********************************
  6. * 所有被注释的配置项均为UEditor默认值。
  7. * 修改默认配置请首先确保已经完全明确该参数的真实用途。
  8. * 主要有两种修改方案,一种是取消此处注释,然后修改成对应参数;另一种是在实例化编辑器时传入对应参数。
  9. * 当升级编辑器时,可直接使用旧版配置文件替换新版配置文件,不用担心旧版配置文件中因缺少新功能所需的参数而导致脚本报错。
  10. **************************提示********************************/
  11. (function () {
  12. /**
  13. * 编辑器资源文件根路径。它所表示的含义是:以编辑器实例化页面为当前路径,指向编辑器资源文件(即dialog等文件夹)的路径。
  14. * 鉴于很多同学在使用编辑器的时候出现的种种路径问题,此处强烈建议大家使用"相对于网站根目录的相对路径"进行配置。
  15. * "相对于网站根目录的相对路径"也就是以斜杠开头的形如"/myProject/ueditor/"这样的路径。
  16. * 如果站点中有多个不在同一层级的页面需要实例化编辑器,且引用了同一UEditor的时候,此处的URL可能不适用于每个页面的编辑器。
  17. * 因此,UEditor提供了针对不同页面的编辑器可单独配置的根路径,具体来说,在需要实例化编辑器的页面最顶部写上如下代码即可。当然,需要令此处的URL等于对应的配置。
  18. * window.UEDITOR_HOME_URL = "/xxxx/xxxx/";
  19. */
  20. var URL;
  21. /**
  22. * 此处配置写法适用于UEditor小组成员开发使用,外部部署用户请按照上述说明方式配置即可,建议保留下面两行,以兼容可在具体每个页面配置window.UEDITOR_HOME_URL的功能。
  23. */
  24. var tmp = window.location.pathname;
  25. URL = window.UEDITOR_HOME_URL||tmp.substr(0,tmp.lastIndexOf("\/")+1).replace("_examples/","").replace("website/","");//这里你可以配置成ueditor目录在您网站的相对路径或者绝对路径(指以http开头的绝对路径)
  26. /**
  27. * 配置项主体。注意,此处所有涉及到路径的配置别遗漏URL变量。
  28. */
  29. window.UEDITOR_CONFIG = {
  30. //为编辑器实例添加一个路径,这个不能被注释
  31. UEDITOR_HOME_URL : URL
  32. //图片上传配置区
  33. ,imageUrl:URL+"php/imageUp.php" //图片上传提交地址
  34. ,imagePath:URL + "php/" //图片修正地址,引用了fixedImagePath,如有特殊需求,可自行配置
  35. //,imageFieldName:"upfile" //图片数据的key,若此处修改,需要在后台对应文件修改对应参数
  36. //,compressSide:0 //等比压缩的基准,确定maxImageSideLength参数的参照对象。0为按照最长边,1为按照宽度,2为按照高度
  37. //,maxImageSideLength:900 //上传图片最大允许的边长,超过会自动等比缩放,不缩放就设置一个比较大的值,更多设置在image.html中
  38. //附件上传配置区
  39. ,fileUrl:URL+"php/fileUp.php" //附件上传提交地址
  40. ,filePath:URL + "php/" //附件修正地址,同imagePath
  41. //,fileFieldName:"upfile" //附件提交的表单名,若此处修改,需要在后台对应文件修改对应参数
  42. //远程抓取配置区
  43. //,catchRemoteImageEnable:true //是否开启远程图片抓取,默认开启
  44. ,catcherUrl:URL +"php/getRemoteImage.php" //处理远程图片抓取的地址
  45. ,catcherPath:URL + "php/" //图片修正地址,同imagePath
  46. //,catchFieldName:"upfile" //提交到后台远程图片uri合集,若此处修改,需要在后台对应文件修改对应参数
  47. //,separater:'ue_separate_ue' //提交至后台的远程图片地址字符串分隔符
  48. //,localDomain:[] //本地顶级域名,当开启远程图片抓取时,除此之外的所有其它域名下的图片都将被抓取到本地
  49. //图片在线管理配置区
  50. ,imageManagerUrl:URL + "php/imageManager.php" //图片在线管理的处理地址
  51. ,imageManagerPath:URL + "php/" //图片修正地址,同imagePath
  52. //屏幕截图配置区
  53. ,snapscreenHost: '127.0.0.1' //屏幕截图的server端文件所在的网站地址或者ip,请不要加http://
  54. ,snapscreenServerUrl: URL +"php/imageUp.php" //屏幕截图的server端保存程序,UEditor的范例代码为“URL +"server/upload/php/snapImgUp.php"”
  55. ,snapscreenPath: URL + "php/"
  56. //,snapscreenServerPort: 80 //屏幕截图的server端端口
  57. //,snapscreenImgAlign: 'center' //截图的图片默认的排版方式
  58. //word转存配置区
  59. ,wordImageUrl:URL + "php/imageUp.php" //word转存提交地址
  60. ,wordImagePath:URL + "php/" //
  61. //,wordImageFieldName:"upfile" //word转存表单名若此处修改,需要在后台对应文件修改对应参数
  62. //获取视频数据的地址
  63. ,getMovieUrl:URL+"php/getMovie.php" //视频数据获取地址
  64. //工具栏上的所有的功能按钮和下拉框,可以在new编辑器的实例时选择自己需要的从新定义
  65. ,toolbars:[
  66. ['fullscreen', 'source', '|', 'undo', 'redo', '|',
  67. 'bold', 'italic', 'underline', 'strikethrough', 'superscript', 'subscript', 'removeformat', 'formatmatch','autotypeset', '|',
  68. 'blockquote', '|', 'pasteplain', '|', 'forecolor', 'backcolor', 'insertorderedlist', 'insertunorderedlist','selectall', 'cleardoc', '|', 'customstyle',
  69. 'paragraph', '|','rowspacingtop', 'rowspacingbottom','lineheight', '|','fontfamily', 'fontsize', '|',
  70. 'directionalityltr', 'directionalityrtl', '|', '', 'indent', '|',
  71. 'justifyleft', 'justifycenter', 'justifyright', 'justifyjustify', '|',
  72. 'link', 'unlink', 'anchor', '|', 'imagenone', 'imageleft', 'imageright',
  73. 'imagecenter', '|', 'insertimage', 'emotion', 'insertvideo', 'attachment', 'map', 'gmap', 'insertframe','highlightcode','webapp','pagebreak', '|',
  74. 'horizontal', 'date', 'time', 'spechars','snapscreen', 'wordimage', '|',
  75. 'inserttable', 'deletetable', 'insertparagraphbeforetable', 'insertrow', 'deleterow', 'insertcol', 'deletecol', 'mergecells', 'mergeright', 'mergedown', 'splittocells', 'splittorows', 'splittocols', '|',
  76. 'print', 'preview', 'searchreplace','help']
  77. ]
  78. //当鼠标放在工具栏上时显示的tooltip提示
  79. ,labelMap:{
  80. 'anchor':'锚点', 'undo':'撤销', 'redo':'重做', 'bold':'加粗', 'indent':'首行缩进','snapscreen': '截图',
  81. 'italic':'斜体', 'underline':'下划线', 'strikethrough':'删除线', 'subscript':'下标',
  82. 'superscript':'上标', 'formatmatch':'格式刷', 'source':'源代码', 'blockquote':'引用',
  83. 'pasteplain':'纯文本粘贴模式', 'selectall':'全选', 'print':'打印', 'preview':'预览',
  84. 'horizontal':'分隔线', 'removeformat':'清除格式', 'time':'时间', 'date':'日期',
  85. 'unlink':'取消链接', 'insertrow':'前插入行', 'insertcol':'前插入列', 'mergeright':'右合并单元格', 'mergedown':'下合并单元格',
  86. 'deleterow':'删除行', 'deletecol':'删除列', 'splittorows':'拆分成行', 'splittocols':'拆分成列', 'splittocells':'完全拆分单元格',
  87. 'mergecells':'合并多个单元格', 'deletetable':'删除表格', 'insertparagraphbeforetable':'表格前插行', 'cleardoc':'清空文档',
  88. 'fontfamily':'字体', 'fontsize':'字号', 'paragraph':'段落格式', 'insertimage':'图片', 'inserttable':'表格', 'link':'超链接',
  89. 'emotion':'表情', 'spechars':'特殊字符', 'searchreplace':'查询替换', 'map':'Baidu地图', 'gmap':'Google地图',
  90. 'insertvideo':'视频', 'help':'帮助', 'justifyleft':'居左对齐', 'justifyright':'居右对齐', 'justifycenter':'居中对齐',
  91. 'justifyjustify':'两端对齐', 'forecolor':'字体颜色', 'backcolor':'背景色', 'insertorderedlist':'有序列表',
  92. 'insertunorderedlist':'无序列表', 'fullscreen':'全屏', 'directionalityltr':'从左向右输入', 'directionalityrtl':'从右向左输入',
  93. 'RowSpacingTop':'段前距', 'RowSpacingBottom':'段后距','highlightcode':'插入代码', 'pagebreak':'分页', 'insertframe':'插入Iframe', 'imagenone':'默认',
  94. 'imageleft':'左浮动', 'imageright':'右浮动','attachment':'附件', 'imagecenter':'居中', 'wordimage':'图片转存',
  95. 'lineheight':'行间距', 'customstyle':'自定义标题','autotypeset': '自动排版','webapp':'百度应用'
  96. }
  97. //webAppKey
  98. //百度应用的APIkey,每个站长必须首先去百度官网注册一个key后方能正常使用app功能
  99. ,webAppKey:""
  100. //常用配置项目
  101. //,isShow : true //默认显示编辑器
  102. //,initialContent:'欢迎使用ueditor!' //初始化编辑器的内容,也可以通过textarea/script给值,看官网例子
  103. //,autoClearinitialContent:false //是否自动清除编辑器初始内容,注意:如果focus属性设置为true,这个也为真,那么编辑器一上来就会触发导致初始化的内容看不到了
  104. //,iframeCssUrl: URL + '/themes/default/iframe.css' //给编辑器内部引入一个css文件
  105. //,textarea:'editorValue' // 提交表单时,服务器获取编辑器提交内容的所用的参数,多实例时可以给容器name属性,会将name给定的值最为每个实例的键值,不用每次实例化的时候都设置这个值
  106. //,focus:false //初始化时,是否让编辑器获得焦点true或false
  107. ,minFrameHeight:80 // 最小高度,默认320
  108. //,autoClearEmptyNode : true //getContent时,是否删除空的inlineElement节点(包括嵌套的情况)
  109. //,fullscreen : false //是否开启初始化时即全屏,默认关闭
  110. //,readonly : false /编辑器初始化结束后,编辑区域是否是只读的,默认是false
  111. //,zIndex : 900 //编辑器层级的基数,默认是900
  112. //,imagePopup:true //图片操作的浮层开关,默认打开
  113. //,initialStyle:'body{font-size:18px}' //编辑器内部样式,可以用来改变字体等
  114. //,emotionLocalization:false //是否开启表情本地化,默认关闭。若要开启请确保emotion文件夹下包含官网提供的images表情文件夹
  115. //,enterTag:'p' //编辑器回车标签。p或br
  116. //,pasteplain:false //是否纯文本粘贴。false为不使用纯文本粘贴,true为使用纯文本粘贴
  117. //iframeUrlMap
  118. //dialog内容的路径 ~会被替换成URL,垓属性一旦打开,将覆盖所有的dialog的默认路径
  119. //,iframeUrlMap:{
  120. // 'anchor':'~/dialogs/anchor/anchor.html',
  121. // }
  122. //insertorderedlist
  123. //有序列表的下拉配置
  124. //,insertorderedlist : [
  125. //['1,2,3...','decimal'],
  126. //['a,b,c...','lower-alpha'],
  127. //['i,ii,iii...','lower-roman'],
  128. //['A,B,C','upper-alpha'],
  129. //['I,II,III...','upper-roman']
  130. // ]
  131. //insertunorderedlist
  132. //无序列表的下拉配置
  133. //,insertunorderedlist : [
  134. //['○ 小圆圈','circle'],
  135. //['● 小圆点','disc'],
  136. //['■ 小方块','square']
  137. //]
  138. //fontfamily
  139. //字体
  140. //,'fontfamily':[
  141. // ['宋体',['宋体', 'SimSun']],
  142. // ['楷体',['楷体', '楷体_GB2312', 'SimKai']],
  143. // ['黑体',['黑体', 'SimHei']],
  144. // ['隶书',['隶书', 'SimLi']],
  145. // ['andale mono',['andale mono']],
  146. // ['arial',['arial', 'helvetica', 'sans-serif']],
  147. // ['arial black',['arial black', 'avant garde']],
  148. // ['comic sans ms',['comic sans ms']],
  149. // ['impact',['impact', 'chicago']],
  150. // ['times new roman',['times new roman']]
  151. // ]
  152. //fontsize
  153. //字号
  154. //,'fontsize':[10, 11, 12, 14, 16, 18, 20, 24, 36]
  155. //paragraph
  156. //段落格式 值:显示的名字
  157. //,'paragraph':['p:段落', 'h1:标题 1', 'h2:标题 2', 'h3:标题 3', 'h4:标题 4', 'h5:标题 5', 'h6:标题 6']
  158. //rowspacingtop
  159. //段间距 值和显示的名字相同
  160. //,'rowspacingtop':['5', '10', '15', '20', '25']
  161. //rowspacingBottom
  162. //段间距 值和显示的名字相同
  163. //,'rowspacingtop':['5', '10', '15', '20', '25']
  164. //lineheight
  165. //行内间距 值和显示的名字相同
  166. //,'lineheight':['1', '1.5','1.75','2', '3', '4', '5']
  167. //customstyle
  168. //自定义样式
  169. //block的元素是依据设置段落的逻辑设置的,inline的元素依据BIU的逻辑设置
  170. //尽量使用一些常用的标签
  171. //参数说明
  172. //tag 使用的标签名字
  173. //label 显示的名字也是用来标识不同类型的标识符,注意这个值每个要不同,
  174. //style 添加的样式
  175. //每一个对象就是一个自定义的样式
  176. //,'customstyle':[
  177. // {tag:'h1', label:'居中标题', style:'border-bottom:#ccc 2px solid;padding:0 4px 0 0;text-align:center;margin:0 0 20px 0;'},
  178. // {tag:'h1', label:'居左标题', style:'border-bottom:#ccc 2px solid;padding:0 4px 0 0;margin:0 0 10px 0;'},
  179. // {tag:'span', label:'强调', style:'font-style:italic;font-weight:bold;color:#000'},
  180. // {tag:'span', label:'明显强调', style:'font-style:italic;font-weight:bold;color:rgb(51, 153, 204)'}
  181. // ]
  182. //contextMenu //定义了右键菜单的内容,可以参考plugins/contextmenu.js里边的默认菜单的例子
  183. //,contextMenu:[
  184. // {
  185. // label:'显示的名字',
  186. // cmdName:'执行的command命令,当点击这个右键菜单时',
  187. // //exec可选,有了exec就会在点击时执行这个function,
  188. // exec:function () {
  189. // //this是当前编辑器的实例
  190. // //this.ui._dialogs['inserttableDialog'].open();
  191. // }
  192. // }
  193. // ]
  194. //wordCount
  195. //,wordCount:true //是否开启字数统计
  196. //,maximumWords:10000 //允许的最大字符数
  197. //,wordCountMsg:'当前已输入 {#count} 个字符,您还可以输入{#leave} 个字符 ' //字数统计提示,{#count}代表当前字数,{#leave}代表还可以输入多少字符数
  198. //,wordOverFlowMsg:'<span style="color:red;">你输入的字符个数已经超出最大允许值,服务器可能会拒绝保存!</span>' //超出字数限制提示
  199. //highlightcode
  200. // 代码高亮时需要加载的第三方插件的路径
  201. // ,highlightJsUrl:URL + "third-party/SyntaxHighlighter/shCore.js"
  202. // ,highlightCssUrl:URL + "third-party/SyntaxHighlighter/shCoreDefault.css"
  203. //tab
  204. //点击tab键时移动的距离,tabSize倍数,tabNode什么字符做为单位
  205. //,tabSize:4
  206. //,tabNode:'&nbsp;'
  207. //elementPathEnabled
  208. //是否启用元素路径,默认是显示
  209. //,elementPathEnabled : true
  210. //removeFormat
  211. //清除格式时可以删除的标签和属性
  212. //removeForamtTags标签
  213. //,removeFormatTags:'b,big,code,del,dfn,em,font,i,ins,kbd,q,samp,small,span,strike,strong,sub,sup,tt,u,var'
  214. //removeFormatAttributes属性
  215. //,removeFormatAttributes:'class,style,lang,width,height,align,hspace,valign'
  216. //undo
  217. //可以最多回退的次数,默认20
  218. //,maxUndoCount:20
  219. //当输入的字符数超过该值时,保存一次现场
  220. //,maxInputCount:20
  221. //autoHeightEnabled
  222. // 是否自动长高,默认true
  223. ,autoHeightEnabled:false
  224. //autoFloatEnabled
  225. //是否保持toolbar的位置不动,默认true
  226. //,autoFloatEnabled:true
  227. //indentValue
  228. //首行缩进距离,默认是2em
  229. //,indentValue:'2em'
  230. //pageBreakTag
  231. //分页标识符,默认是_baidu_page_break_tag_
  232. //,pageBreakTag:'_baidu_page_break_tag_'
  233. //sourceEditor
  234. //源码的查看方式,codemirror 是代码高亮,textarea是文本框,默认是codemirror
  235. //,sourceEditor:"codemirror"
  236. //如果sourceEditor是codemirror,还用配置一下两个参数
  237. //codeMirrorJsUrl js加载的路径,默认是 URL + "third-party/codemirror2.15/codemirror.js"
  238. //,codeMirrorJsUrl:URL + "third-party/codemirror2.15/codemirror.js"
  239. //codeMirrorCssUrl css加载的路径,默认是 URL + "third-party/codemirror2.15/codemirror.css"
  240. //,codeMirrorCssUrl:URL + "third-party/codemirror2.15/codemirror.css"
  241. //serialize
  242. // 配置编辑器的过滤规则
  243. // serialize是个object,可以有属性blackList,whiteList属性,默认是{}
  244. // 例子:
  245. //, serialize : {
  246. // //黑名单,编辑器会过滤掉一下标签
  247. // blackList:{style:1, link:1,object:1, applet:1, input:1, meta:1, base:1, button:1, select:1, textarea:1, '#comment':1, 'map':1, 'area':1}
  248. // }
  249. //autotypeset
  250. // //自动排版参数
  251. // ,autotypeset:{
  252. // mergeEmptyline : true, //合并空行
  253. // removeClass : true, //去掉冗余的class
  254. // removeEmptyline : false, //去掉空行
  255. // textAlign : "left" , //段落的排版方式,可以是 left,right,center,justify 去掉这个属性表示不执行排版
  256. // imageBlockLine : 'center', //图片的浮动方式,独占一行剧中,左右浮动,默认: center,left,right,none 去掉这个属性表示不执行排版
  257. // pasteFilter : false, //根据规则过滤没事粘贴进来的内容
  258. // clearFontSize : false, //去掉所有的内嵌字号,使用编辑器默认的字号
  259. // clearFontFamily : false, //去掉所有的内嵌字体,使用编辑器默认的字体
  260. // removeEmptyNode : false , // 去掉空节点
  261. // //可以去掉的标签
  262. // removeTagNames : {标签名字:1},
  263. // indent : false, // 行首缩进
  264. // indentValue : '2em' //行首缩进的大小
  265. // }
  266. };
  267. })();