ueditor.config.js 28 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653
  1. /**
  2. * ueditor plus 完整配置项
  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, CORS_URL;
  21. if (window.UEDITOR_HOME_URL) {
  22. URL = window.UEDITOR_HOME_URL;
  23. } else if (window.__msCDN) {
  24. URL = window.__msCDN + 'asset/vendor/ueditor/';
  25. } else if (window.__msRoot) {
  26. URL = window.__msRoot + 'asset/vendor/ueditor/';
  27. } else {
  28. URL = getUEBasePath();
  29. }
  30. if (window.UEDITOR_CORS_URL) {
  31. CORS_URL = window.UEDITOR_CORS_URL;
  32. } else if (window.__msRoot) {
  33. CORS_URL = window.__msRoot + 'asset/vendor/ueditor/';
  34. } else if (window.UEDITOR_HOME_URL) {
  35. CORS_URL = window.UEDITOR_HOME_URL;
  36. } else {
  37. CORS_URL = getUEBasePath();
  38. }
  39. /**
  40. * 配置项主体。注意,此处所有涉及到路径的配置别遗漏URL变量。
  41. */
  42. window.UEDITOR_CONFIG = {
  43. // 为编辑器实例添加一个路径,这个不能被注释
  44. UEDITOR_HOME_URL: URL,
  45. // 需要能跨域的静态资源请求,主要用户弹窗页面等静态资源
  46. UEDITOR_CORS_URL: CORS_URL,
  47. // 是否开启Debug模式
  48. debug: false,
  49. // 服务器统一请求接口路径
  50. serverUrl: "/ueditor-plus/_demo_server/handle.php",
  51. // 服务器统一请求头信息,会在所有请求中带上该信息
  52. serverHeaders: {
  53. // 'Authorization': 'Bearer xxx'
  54. },
  55. //工具栏上的所有的功能按钮和下拉框,可以在new编辑器的实例时选择自己需要的重新定义
  56. toolbars: [
  57. [
  58. "fullscreen", // 全屏
  59. "source", // 源代码
  60. "|",
  61. "undo", // 撤销
  62. "redo", // 重做
  63. "|",
  64. "bold", // 加粗
  65. "italic", // 斜体
  66. "underline", // 下划线
  67. "fontborder", // 字符边框
  68. "strikethrough",// 删除线
  69. "superscript", // 上标
  70. "subscript", // 下标
  71. "removeformat", // 清除格式
  72. "formatmatch", // 格式刷
  73. "autotypeset", // 自动排版
  74. "blockquote", // 引用
  75. "pasteplain", // 纯文本粘贴模式
  76. "|",
  77. "forecolor", // 字体颜色
  78. "backcolor", // 背景色
  79. "insertorderedlist", // 有序列表
  80. "insertunorderedlist", // 无序列表
  81. "selectall", // 全选
  82. "cleardoc", // 清空文档
  83. "|",
  84. "rowspacingtop",// 段前距
  85. "rowspacingbottom", // 段后距
  86. "lineheight", // 行间距
  87. "|",
  88. "customstyle", // 自定义标题
  89. "paragraph", // 段落格式
  90. "fontfamily", // 字体
  91. "fontsize", // 字号
  92. "|",
  93. "directionalityltr", // 从左向右输入
  94. "directionalityrtl", // 从右向左输入
  95. "indent", // 首行缩进
  96. "|",
  97. "justifyleft", // 居左对齐
  98. "justifycenter", // 居中对齐
  99. "justifyright",
  100. "justifyjustify", // 两端对齐
  101. "|",
  102. "touppercase", // 字母大写
  103. "tolowercase", // 字母小写
  104. "|",
  105. // "link", // 超链接
  106. // "unlink", // 取消链接
  107. // "anchor", // 锚点
  108. "|",
  109. "imagenone", // 图片默认
  110. "imageleft", // 图片左浮动
  111. "imagecenter", // 图片居中
  112. "imageright", // 图片右浮动
  113. "|",
  114. // "simpleupload", // 单图上传
  115. "insertimage", // 多图上传
  116. // "emotion", // 表情
  117. // "scrawl", // 涂鸦
  118. "insertvideo", // 视频
  119. // "insertaudio", // 音频
  120. // "attachment", // 附件
  121. // "insertframe", // 插入Iframe
  122. // "insertcode", // 插入代码
  123. // "pagebreak", // 分页
  124. // "template", // 模板
  125. // "background", // 背景
  126. // "formula", // 公式
  127. // "|",
  128. "horizontal", // 分隔线
  129. "date", // 日期
  130. "time", // 时间
  131. // "spechars", // 特殊字符
  132. // "wordimage", // Word图片转存
  133. // "|",
  134. // "inserttable", // 插入表格
  135. // "deletetable", // 删除表格
  136. // "insertparagraphbeforetable", // 表格前插入行
  137. // "insertrow", // 前插入行
  138. // "deleterow", // 删除行
  139. // "insertcol", // 前插入列
  140. // "deletecol", // 删除列
  141. // "mergecells", // 合并多个单元格
  142. // "mergeright", // 右合并单元格
  143. // "mergedown", // 下合并单元格
  144. // "splittocells", // 完全拆分单元格
  145. // "splittorows", // 拆分成行
  146. // "splittocols", // 拆分成列
  147. // "|",
  148. // "print", // 打印
  149. // "preview", // 预览
  150. // "searchreplace", // 查询替换
  151. // "|",
  152. // "contentimport",
  153. // "help", // 帮助
  154. ]
  155. ]
  156. // 自定义工具栏按钮点击,返回 true 表示已经处理点击,会阻止默认事件
  157. , toolbarCallback: function (cmd, editor) {
  158. // console.log('toolbarCallback',cmd, editor);
  159. // switch(cmd){
  160. // case 'insertimage':
  161. // editor.execCommand('insertHtml', '<p><img src="xxxxx" /></p>');
  162. // console.log('toolbarCallback',cmd, editor)
  163. // return true;
  164. // case 'insertvideo':
  165. // editor.execCommand('insertHtml', '<p><iframe src="xxxxx" /></p>');
  166. // console.log('toolbarCallback',cmd, editor)
  167. // return true;
  168. // case 'attachment':
  169. // console.log('toolbarCallback',cmd, editor)
  170. // editor.execCommand('insertHtml', '<p><a href="xxx.zip">下载文件</a></p>');
  171. // return true;
  172. // }
  173. }
  174. // 插入图片自定义配置
  175. , imageConfig: {
  176. // 禁止本地上传
  177. disableUpload: false,
  178. // 禁止在线管理
  179. disableOnline: false,
  180. // 自定义选择按钮
  181. selectCallback: null,
  182. // selectCallback: function(editor,cb){
  183. // console.log('selectCallback',cb);
  184. // setTimeout(function(){
  185. // cb({
  186. // path:'https://www.baidu.com/img/PCtm_d9c8750bed0b3c7d089fa7d55720d6cf.png',
  187. // name:'测试图片'
  188. // });
  189. // },1000);
  190. // }
  191. }
  192. // 插入视频配置
  193. , videoConfig: {
  194. // 禁止本地上传,
  195. disableUpload: false,
  196. // 自定义选择按钮
  197. selectCallback: null,
  198. // selectCallback: function(editor,cb){
  199. // console.log('selectCallback',cb);
  200. // setTimeout(function(){
  201. // cb({
  202. // path:'https://www.bilibili.com/video/BV1y44y1g7NR?spm_id_from=333.1007.tianma.1-1-1.click',
  203. // name:'测试视频'
  204. // });
  205. // },1000);
  206. // }
  207. }
  208. // 插入音频配置
  209. , audioConfig: {
  210. // 禁止本地上传,
  211. disableUpload: false,
  212. // 自定义选择按钮
  213. selectCallback: null,
  214. // selectCallback: function(editor,cb){
  215. // console.log('selectCallback',cb);
  216. // setTimeout(function(){
  217. // cb({
  218. // path:'https://example.com/test.mp3',
  219. // name:'测试音频'
  220. // });
  221. // },1000);
  222. // }
  223. }
  224. // 公式配置
  225. , formulaConfig: {
  226. // 公式渲染链接模板
  227. imageUrlTemplate: 'https://r.latexeasy.com/image.svg?{}',
  228. // 编辑器模式 plain live
  229. editorMode: 'live',
  230. // 编辑器地址
  231. editorLiveServer: 'https://latexeasy.com',
  232. }
  233. // 自动保存
  234. , autoSaveEnable: true
  235. // 浏览器初始化时自动恢复上一次的内容
  236. , autoSaveRestore: false
  237. // 自动保存Key,为空时根据网址自动计算
  238. , autoSaveKey: null
  239. //当鼠标放在工具栏上时显示的tooltip提示,留空支持自动多语言配置,否则以配置值为准
  240. //,labelMap:{
  241. // 'anchor':'', 'undo':''
  242. //}
  243. //语言配置项,默认是zh-cn。有需要的话也可以使用如下这样的方式来自动多语言切换,当然,前提条件是lang文件夹下存在对应的语言文件:
  244. //lang值也可以通过自动获取 (navigator.language||navigator.browserLanguage ||navigator.userLanguage).toLowerCase()
  245. //,lang:"zh-cn"
  246. //,langPath:URL +"lang/"
  247. //主题配置项,默认是default。有需要的话也可以使用如下这样的方式来自动多主题切换,当然,前提条件是themes文件夹下存在对应的主题文件:
  248. //现有如下皮肤:default
  249. //,theme:'default'
  250. //,themePath:URL +"themes/"
  251. //,zIndex : 900 //编辑器层级的基数,默认是900
  252. //针对getAllHtml方法,会在对应的head标签中增加该编码设置。
  253. //,charset:"utf-8"
  254. //若实例化编辑器的页面手动修改的domain,此处需要设置为true
  255. //,customDomain:false
  256. // 默认显示编辑器
  257. //,isShow : true
  258. // 提交表单时,服务器获取编辑器提交内容的所用的参数,多实例时可以给容器name属性,会将name给定的值最为每个实例的键值,不用每次实例化的时候都设置这个值
  259. //,textarea:'editorValue'
  260. // 初始化编辑器的内容,也可以通过 textarea/script 给值
  261. , initialContent: ''
  262. //,autoClearinitialContent:true //是否自动清除编辑器初始内容,注意:如果focus属性设置为true,这个也为真,那么编辑器一上来就会触发导致初始化的内容看不到了
  263. // 初始化时,是否让编辑器获得焦点
  264. , focus: false
  265. // 编辑区自定义样式,如果自定义,最好给 p 标签如下的行高,要不输入中文时,会有跳动感
  266. , initialStyle: '' // p{line-height:1em}
  267. //,iframeJsUrl: '' //给编辑区域的iframe引入一个js文件
  268. //,iframeCssUrl: URL + '/themes/iframe.css' //给编辑区域的iframe引入一个css文件
  269. // 给编辑器引入更多样式文件
  270. //,iframeCssUrlsAddition: []
  271. // 首行缩进距离,默认是 2em
  272. , indentValue: '2em'
  273. // 初始化编辑器宽度,默认 1000
  274. // ,initialFrameWidth:1000
  275. // 初始化编辑器高度,默认 320
  276. // ,initialFrameHeight:320
  277. // 编辑器初始化结束后,编辑区域是否是只读的,默认是false
  278. , readonly: false
  279. // getContent时,是否删除空的inlineElement节点(包括嵌套的情况)
  280. , autoClearEmptyNode: true
  281. // 启用拖放上传
  282. //,enableDragUpload: true
  283. // 启用粘贴上传
  284. //,enablePasteUpload: true
  285. // 启用图片拉伸缩放
  286. //,imageScaleEnabled: true
  287. // 是否开启初始化时即全屏,默认关闭
  288. , fullscreen: false
  289. // 图片操作的浮层开关,默认打开
  290. //,imagePopup:true
  291. // 自动同步编辑器要提交的数据
  292. //,autoSyncData:true
  293. // 是否开启表情本地化,默认关闭。若要开启请确保emotion文件夹下包含官网提供的images表情文件夹
  294. //,emotionLocalization:false
  295. // 粘贴只保留标签,去除标签所有属性
  296. //,retainOnlyLabelPasted: false
  297. // 是否默认为纯文本粘贴。false为不使用纯文本粘贴,true为使用纯文本粘贴
  298. //,pasteplain:false
  299. // 纯文本粘贴模式下的过滤规则
  300. //'filterTxtRules' : function(){
  301. // function transP(node){
  302. // node.tagName = 'p';
  303. // node.setStyle();
  304. // }
  305. // return {
  306. // //直接删除及其字节点内容
  307. // '-' : 'script style object iframe embed input select',
  308. // 'p': {$:{}},
  309. // 'br':{$:{}},
  310. // 'div':{'$':{}},
  311. // 'li':{'$':{}},
  312. // 'caption':transP,
  313. // 'th':transP,
  314. // 'tr':transP,
  315. // 'h1':transP,'h2':transP,'h3':transP,'h4':transP,'h5':transP,'h6':transP,
  316. // 'td':function(node){
  317. // //没有内容的td直接删掉
  318. // var txt = !!node.innerText();
  319. // if(txt){
  320. // node.parentNode.insertAfter(UE.uNode.createText(' &nbsp; &nbsp;'),node);
  321. // }
  322. // node.parentNode.removeChild(node,node.innerText())
  323. // }
  324. // }
  325. //}()
  326. // 提交到后台的数据是否包含整个html字符串
  327. , allHtmlEnabled: false
  328. //有序列表的下拉配置,值留空时支持多语言自动识别,若配置值,则以此值为准
  329. //,'insertorderedlist':{
  330. // 'decimal' : '' , //'1,2,3...'
  331. // 'lower-alpha' : '' , // 'a,b,c...'
  332. // 'lower-roman' : '' , //'i,ii,iii...'
  333. // 'upper-alpha' : '' , lang //'A,B,C'
  334. // 'upper-roman' : '' //'I,II,III...'
  335. //}
  336. //insertunorderedlist
  337. //无序列表的下拉配置,值留空时支持多语言自动识别,若配置值,则以此值为准
  338. //,insertunorderedlist : { //自定的样式
  339. // 'circle' : '', // '○ 小圆圈'
  340. // 'disc' : '', // '● 小圆点'
  341. // 'square' : '' //'■ 小方块'
  342. //}
  343. //,listDefaultPaddingLeft : '30'//默认的左边缩进的基数倍
  344. //,listiconpath : 'http://bs.baidu.com/listicon/'//自定义标号的路径
  345. //,maxListLevel : 3 //限制可以tab的级数, 设置-1为不限制
  346. //,autoTransWordToList:false //禁止word中粘贴进来的列表自动变成列表标签
  347. // 字体设置 label 留空支持多语言自动切换,若配置,则以配置值为准
  348. //,'fontfamily':[
  349. // { label:'',name:'songti',val:'宋体,SimSun'},
  350. // { label:'',name:'kaiti',val:'楷体,楷体_GB2312, SimKai'},
  351. // { label:'',name:'yahei',val:'微软雅黑,Microsoft YaHei'},
  352. // { label:'',name:'heiti',val:'黑体, SimHei'},
  353. // { label:'',name:'lishu',val:'隶书, SimLi'},
  354. // { label:'',name:'andaleMono',val:'andale mono'},
  355. // { label:'',name:'arial',val:'arial, helvetica,sans-serif'},
  356. // { label:'',name:'arialBlack',val:'arial black,avant garde'},
  357. // { label:'',name:'comicSansMs',val:'comic sans ms'},
  358. // { label:'',name:'impact',val:'impact,chicago'},
  359. // { label:'',name:'timesNewRoman',val:'times new roman'}
  360. //]
  361. // 字号
  362. //,'fontsize':[10, 11, 12, 14, 16, 18, 20, 24, 36]
  363. // 段落格式 值留空时支持多语言自动识别,若配置,则以配置值为准
  364. //,'paragraph':{'p':'', 'h1':'', 'h2':'', 'h3':'', 'h4':'', 'h5':'', 'h6':''}
  365. // 段间距 值和显示的名字相同
  366. //,'rowspacingtop':['5', '10', '15', '20', '25']
  367. // 段间距 值和显示的名字相同
  368. //,'rowspacingbottom':['5', '10', '15', '20', '25']
  369. //行内间距 值和显示的名字相同
  370. //,'lineheight':['1', '1.5','1.75','2', '3', '4', '5']
  371. // customstyle
  372. //自定义样式,不支持国际化,此处配置值即可最后显示值
  373. //block的元素是依据设置段落的逻辑设置的,inline的元素依据BIU的逻辑设置
  374. //尽量使用一些常用的标签
  375. //参数说明
  376. //tag 使用的标签名字
  377. //label 显示的名字也是用来标识不同类型的标识符,注意这个值每个要不同,
  378. //style 添加的样式
  379. //每一个对象就是一个自定义的样式
  380. //,'customstyle':[
  381. // {tag:'h1', name:'tc', label:'', style:'border-bottom:#ccc 2px solid;padding:0 4px 0 0;text-align:center;margin:0 0 20px 0;'},
  382. // {tag:'h1', name:'tl',label:'', style:'border-bottom:#ccc 2px solid;padding:0 4px 0 0;margin:0 0 10px 0;'},
  383. // {tag:'span',name:'im', label:'', style:'font-style:italic;font-weight:bold'},
  384. // {tag:'span',name:'hi', label:'', style:'font-style:italic;font-weight:bold;color:rgb(51, 153, 204)'}
  385. //]
  386. // 打开右键菜单功能
  387. , enableContextMenu: true
  388. //右键菜单的内容,可以参考plugins/contextmenu.js里边的默认菜单的例子,label留空支持国际化,否则以此配置为准
  389. //,contextMenu:[
  390. // {
  391. // label:'', //显示的名称
  392. // cmdName:'selectall',//执行的command命令,当点击这个右键菜单时
  393. // //exec可选,有了exec就会在点击时执行这个function,优先级高于cmdName
  394. // exec:function () {
  395. // //this是当前编辑器的实例
  396. // //this.ui._dialogs['inserttableDialog'].open();
  397. // }
  398. // }
  399. //]
  400. //快捷菜单
  401. , shortcutMenu: [
  402. // "fontfamily", // 字体
  403. // "fontsize", // 字号
  404. "bold", // 加粗
  405. "italic", // 斜体
  406. "underline", // 下划线
  407. "strikethrough",// 删除线
  408. "fontborder", // 字符边框
  409. "forecolor", // 字体颜色
  410. // "shadowcolor", // 字体阴影
  411. "backcolor", // 背景色
  412. "imagenone",
  413. "imageleft",
  414. "imagecenter",
  415. "imageright",
  416. "insertimage",
  417. "formula",
  418. // "justifyleft", // 居左对齐
  419. // "justifycenter", // 居中对齐
  420. // "justifyright", // 居右对齐
  421. // "justifyjustify", // 两端对齐
  422. // "textindent", // 首行缩进
  423. // "rowspacingtop", // 段前距
  424. // "rowspacingbottom", // 段后距
  425. // "outpadding", // 两侧距离
  426. // "lineheight", // 行间距
  427. // "letterspacing" , // 字间距
  428. // "insertorderedlist", // 有序列表
  429. // "insertunorderedlist", // 无序列表
  430. // "superscript", // 上标
  431. // "subscript", // 下标
  432. // "link", // 超链接
  433. // "unlink", // 取消链接
  434. // "touppercase", // 字母大写
  435. // "tolowercase" // 字母小写
  436. ]
  437. // 是否启用元素路径,默认是显示
  438. , elementPathEnabled: true
  439. // 是否开启字数统计
  440. , wordCount: true
  441. // 允许的最大字符数
  442. , maximumWords: 10000
  443. //字数统计提示,{#count} 代表当前字数,{#leave}代表还可以输入多少字符数,留空支持多语言自动切换,否则按此配置显示
  444. //,wordCountMsg:'' //当前已输入 {#count} 个字符,您还可以输入{#leave} 个字符
  445. //超出字数限制提示 留空支持多语言自动切换,否则按此配置显示
  446. //,wordOverFlowMsg:'' //<span style="color:red;">你输入的字符个数已经超出最大允许值,服务器可能会拒绝保存!</span>
  447. // 点击tab键时移动的距离,tabSize倍数,tabNode什么字符做为单位
  448. //,tabSize:4
  449. //,tabNode:'&nbsp;'
  450. // 清除格式时可以删除的标签
  451. //,removeFormatTags:'b,big,code,del,dfn,em,font,i,ins,kbd,q,samp,small,span,strike,strong,sub,sup,tt,u,var'
  452. // 清除格式时可以删除的属性
  453. //,removeFormatAttributes:'class,style,lang,width,height,align,hspace,valign'
  454. // 可以最多撤销退回的次数,默认20
  455. , maxUndoCount: 20
  456. // 当输入的字符数超过该值时,保存一次现场
  457. , maxInputCount: 1
  458. // 是否自动长高,默认true
  459. , autoHeightEnabled: true
  460. //scaleEnabled
  461. //是否可以拉伸长高,默认true(当开启时,自动长高失效)
  462. //,scaleEnabled:false
  463. //,minFrameWidth:800 //编辑器拖动时最小宽度,默认800
  464. //,minFrameHeight:220 //编辑器拖动时最小高度,默认220
  465. //autoFloatEnabled
  466. //是否保持toolbar的位置不动,默认true
  467. //,autoFloatEnabled:true
  468. //浮动时工具栏距离浏览器顶部的高度,用于某些具有固定头部的页面
  469. //,topOffset:30
  470. //编辑器底部距离工具栏高度(如果参数大于等于编辑器高度,则设置无效)
  471. //,toolbarTopOffset:400
  472. //设置远程图片是否抓取到本地保存
  473. , catchRemoteImageEnable: true //设置是否抓取远程图片
  474. //pageBreakTag
  475. //分页标识符,默认是_ueditor_page_break_tag_
  476. //,pageBreakTag:'_ueditor_page_break_tag_'
  477. // 自动排版参数
  478. , autotypeset: {
  479. // 合并空行
  480. mergeEmptyline: true,
  481. // 去掉冗余的class
  482. removeClass: true,
  483. // 去掉空行
  484. removeEmptyline: false,
  485. // 段落的排版方式,可以是 left,right,center,justify 去掉这个属性表示不执行排版
  486. textAlign: "left",
  487. // 图片的浮动方式,独占一行剧中,左右浮动,默认: center,left,right,none 去掉这个属性表示不执行排版
  488. imageBlockLine: "center",
  489. // 根据规则过滤没事粘贴进来的内容
  490. pasteFilter: false,
  491. // 去掉所有的内嵌字号,使用编辑器默认的字号
  492. clearFontSize: false,
  493. // 去掉所有的内嵌字体,使用编辑器默认的字体
  494. clearFontFamily: false,
  495. // 去掉空节点
  496. removeEmptyNode: false,
  497. // 可以去掉的标签
  498. removeTagNames: {div: 1},
  499. // 行首缩进
  500. indent: false,
  501. // 行首缩进的大小
  502. indentValue: "2em",
  503. // 全角转半角
  504. bdc2sb: false,
  505. // 半角转全角
  506. tobdc: false
  507. }
  508. //表格是否可以拖拽
  509. //,tableDragable: true
  510. //sourceEditor
  511. //源码的查看方式,codemirror 是代码高亮,textarea是文本框,默认是codemirror
  512. //注意默认codemirror只能在ie8+和非ie中使用
  513. //,sourceEditor:"codemirror"
  514. //如果sourceEditor是codemirror,还用配置一下两个参数
  515. //codeMirrorJsUrl js加载的路径,默认是 URL + "third-party/codemirror/codemirror.js"
  516. //,codeMirrorJsUrl:URL + "third-party/codemirror/codemirror.js"
  517. //codeMirrorCssUrl css加载的路径,默认是 URL + "third-party/codemirror/codemirror.css"
  518. //,codeMirrorCssUrl:URL + "third-party/codemirror/codemirror.css"
  519. //编辑器初始化完成后是否进入源码模式,默认为否。
  520. //,sourceEditorFirst:false
  521. //iframeUrlMap
  522. //dialog内容的路径 ~会被替换成URL,垓属性一旦打开,将覆盖所有的dialog的默认路径
  523. //,iframeUrlMap:{
  524. // 'anchor':'~/dialogs/anchor/anchor.html',
  525. //}
  526. //allowLinkProtocol 允许的链接地址,有这些前缀的链接地址不会自动添加http
  527. //, allowLinkProtocols: ['http:', 'https:', '#', '/', 'ftp:', 'mailto:', 'tel:', 'git:', 'svn:']
  528. //默认过滤规则相关配置项目
  529. //,disabledTableInTable:true //禁止表格嵌套
  530. // 允许进入编辑器的 div 标签自动变成 p 标签
  531. , allowDivTransToP: true
  532. // 默认产出的数据中的color自动从rgb格式变成16进制格式
  533. , rgb2Hex: true
  534. };
  535. function getUEBasePath(docUrl, confUrl) {
  536. return getBasePath(
  537. docUrl || self.document.URL || self.location.href,
  538. confUrl || getConfigFilePath()
  539. );
  540. }
  541. function getConfigFilePath() {
  542. var configPath = document.getElementsByTagName("script");
  543. return configPath[configPath.length - 1].src;
  544. }
  545. function getBasePath(docUrl, confUrl) {
  546. var basePath = confUrl;
  547. if (/^(\/|\\\\)/.test(confUrl)) {
  548. basePath =
  549. /^.+?\w(\/|\\\\)/.exec(docUrl)[0] + confUrl.replace(/^(\/|\\\\)/, "");
  550. } else if (!/^[a-z]+:/i.test(confUrl)) {
  551. docUrl = docUrl.split("#")[0].split("?")[0].replace(/[^\\\/]+$/, "");
  552. basePath = docUrl + "" + confUrl;
  553. }
  554. return optimizationPath(basePath);
  555. }
  556. function optimizationPath(path) {
  557. var protocol = /^[a-z]+:\/\//.exec(path)[0],
  558. tmp = null,
  559. res = [];
  560. path = path.replace(protocol, "").split("?")[0].split("#")[0];
  561. path = path.replace(/\\/g, "/").split(/\//);
  562. path[path.length - 1] = "";
  563. while (path.length) {
  564. if ((tmp = path.shift()) === "..") {
  565. res.pop();
  566. } else if (tmp !== ".") {
  567. res.push(tmp);
  568. }
  569. }
  570. return protocol + res.join("/");
  571. }
  572. window.UE = {
  573. getUEBasePath: getUEBasePath
  574. };
  575. })();