editor_config_src.js 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285
  1. /**
  2. * ueditor完整配置项
  3. * 可以在这里配置整个编辑器的特性
  4. */
  5. var UEDITOR_CONFIG = {
  6. UEDITOR_HOME_URL: '../', //这里你可以配置成ueditor目录在您网站的绝对路径
  7. toolbars: [
  8. ['FullScreen','Source','|','Undo','Redo','|',
  9. 'Bold','Italic','Underline','StrikeThrough','Superscript','Subscript','RemoveFormat','FormatMatch','|',
  10. 'BlockQuote','|',
  11. 'PastePlain','|',
  12. 'ForeColor','BackColor','InsertOrderedList','InsertUnorderedList','|',
  13. 'Paragraph','RowSpacing','FontFamily','FontSize','|',
  14. 'DirectionalityLtr','DirectionalityRtl','|','','Indent','Outdent','|',
  15. 'JustifyLeft','JustifyCenter','JustifyRight','JustifyJustify','|',
  16. 'Link','Unlink','Anchor','Image','MultiMenu','Video','Map','GMap','Code', '|',
  17. 'Horizontal','Date','Time','Spechars','|',
  18. 'InsertTable','DeleteTable','InsertParagraphBeforeTable','InsertRow','DeleteRow','InsertCol','DeleteCol','MergeCells','MergeRight','MergeDown','SplittoCells','SplittoRows','SplittoCols','|',
  19. 'SelectAll','ClearDoc','SearchReplace','Print','Preview','PageBreak','Help','AutoSave','InsertFrame']
  20. ],
  21. labelMap: {
  22. 'anchor':'锚点',
  23. 'undo': '撤销',
  24. 'redo': '重做',
  25. 'bold': '加粗',
  26. 'indent':'首行缩进',
  27. 'outdent':'取消缩进',
  28. 'italic': '斜体',
  29. 'underline': '下划线',
  30. 'strikethrough': '删除线',
  31. 'subscript': '下标',
  32. 'superscript': '上标',
  33. 'formatmatch': '格式刷',
  34. 'source': '源代码',
  35. 'blockquote': '引用',
  36. 'pasteplain': '纯文本粘贴模式',
  37. 'selectall': '全选',
  38. 'print': '打印',
  39. 'preview': '预览',
  40. 'horizontal': '分隔线',
  41. 'removeformat': '清除格式',
  42. 'time': '时间',
  43. 'date': '日期',
  44. 'unlink': '取消链接',
  45. 'insertrow': '前插入行',
  46. 'insertcol': '前插入列',
  47. 'mergeright': '右合并单元格',
  48. 'mergedown': '下合并单元格',
  49. 'deleterow': '删除行',
  50. 'deletecol': '删除列',
  51. 'splittorows': '拆分成行',
  52. 'splittocols': '拆分成列',
  53. 'splittocells': '完全拆分单元格',
  54. 'mergecells': '合并多个单元格',
  55. 'deletetable': '删除表格',
  56. // 'tablesuper': '表格高级设置',
  57. 'insertparagraphbeforetable': '表格前插行',
  58. 'cleardoc': '清空文档',
  59. 'fontfamily': '字体',
  60. 'fontsize': '字号',
  61. 'paragraph': '格式',
  62. 'image': '图片',
  63. 'inserttable': '表格',
  64. 'link': '超链接',
  65. 'emoticon': '表情',
  66. 'spechars': '特殊字符',
  67. 'searchreplace': '查询替换',
  68. 'map': 'Baidu地图',
  69. 'gmap': 'Google地图',
  70. 'video': '视频',
  71. 'help': '帮助',
  72. 'justifyleft':'居左对齐',
  73. 'justifyright':'居右对齐',
  74. 'justifycenter':'居中对齐',
  75. 'justifyjustify':'两端对齐',
  76. 'forecolor' : '字体颜色',
  77. 'backcolor' : '背景色',
  78. 'insertorderedlist' : '有序列表',
  79. 'insertunorderedlist' : '无序列表',
  80. 'fullscreen' : '全屏',
  81. 'directionalityltr' : '从左向右输入',
  82. 'directionalityrtl' : '从右向左输入',
  83. 'rowspacing' : '行间距',
  84. 'code' : '插入代码',
  85. 'pagebreak':'分页',
  86. 'insertframe':'插入Iframe'
  87. },
  88. iframeUrlMap: {
  89. 'anchor': '../../../dialogs/anchor/anchor.html',
  90. 'image': '../../../dialogs/image/image.html',
  91. 'inserttable': '../../../dialogs/table/table.html',
  92. 'link': '../../../dialogs/link/link.html',
  93. 'emoticon': '../../../dialogs/emoticon/emoticon.html',
  94. 'spechars': '../../../dialogs/spechars/spechars.html',
  95. 'searchreplace': '../../../dialogs/searchreplace/searchreplace.html',
  96. 'map': '../../../dialogs/map/map.html',
  97. 'gmap': '../../../dialogs/gmap/gmap.html',
  98. 'video': '../../../dialogs/video/video.html',
  99. 'help': '../../../dialogs/help/help.html',
  100. 'code' : '../../../dialogs/code/code.html',
  101. 'multimenu': '../../../dialogs/menu-emoticon/emoticon.html',
  102. 'insertframe': '../../../dialogs/insertframe/insertframe.html'
  103. },
  104. listMap: {
  105. 'fontfamily': ['宋体', '楷体', '隶书', '黑体','andale mono','arial','arial black','comic sans ms','impact','times new roman'],
  106. 'fontsize': [10, 11, 12, 14, 16, 18, 20, 24, 36],
  107. 'underline':['none','overline','line-through','underline'],
  108. 'paragraph': ['p:Paragraph', 'h1:Heading 1', 'h2:Heading 2', 'h3:Heading 3', 'h4:Heading 4', 'h5:Heading 5', 'h6:Heading 6'],
  109. 'rowspacing' : ['1.0:0','1.5:15','2.0:20','2.5:25','3.0:30']
  110. },
  111. fontMap: {
  112. '宋体': ['宋体', 'SimSun'],
  113. '楷体': ['楷体', '楷体_GB2312', 'SimKai'],
  114. '黑体': ['黑体', 'SimHei'],
  115. '隶书': ['隶书', 'SimLi'],
  116. 'andale mono' : ['andale mono'],
  117. 'arial' : ['arial','helvetica','sans-serif'],
  118. 'arial black' : ['arial black','avant garde'],
  119. 'comic sans ms' : ['comic sans ms'],
  120. 'impact' : ['impact','chicago'],
  121. 'times new roman' : ['times new roman']
  122. },
  123. contextMenu: [
  124. {
  125. label : '删除',
  126. cmdName : 'delete'
  127. },
  128. {
  129. label : '全选',
  130. cmdName : 'selectall'
  131. },{
  132. label : '删除代码',
  133. cmdName : 'highlightcode'
  134. },{
  135. label : '清空文档',
  136. cmdName : 'cleardoc',
  137. exec : function(){
  138. if(confirm('确定清空文档吗?')){
  139. this.execCommand('cleardoc');
  140. }
  141. }
  142. },'-',{
  143. label : '取消链接',
  144. cmdName : 'unlink'
  145. },'-',{
  146. group : '段落格式',
  147. icon : 'justifyjustify',
  148. subMenu : [
  149. {
  150. label: '居左对齐',
  151. cmdName : 'justify',
  152. value : 'left'
  153. },
  154. {
  155. label: '居右对齐',
  156. cmdName : 'justify',
  157. value : 'right'
  158. },{
  159. label: '居中对齐',
  160. cmdName : 'justify',
  161. value : 'center'
  162. },{
  163. label: '两端对齐',
  164. cmdName : 'justify',
  165. value : 'justify'
  166. }
  167. ]
  168. },'-',{
  169. group : '表格',
  170. icon : 'table',
  171. subMenu : [
  172. {
  173. label: '删除表格',
  174. cmdName : 'deletetable'
  175. },
  176. {
  177. label: '表格前插行',
  178. cmdName : 'insertparagraphbeforetable'
  179. },
  180. '-',
  181. {
  182. label: '删除行',
  183. cmdName : 'deleterow'
  184. },
  185. {
  186. label: '删除列',
  187. cmdName : 'deletecol'
  188. },
  189. '-',
  190. {
  191. label: '前插入行',
  192. cmdName : 'insertrow'
  193. },
  194. {
  195. label: '前插入列',
  196. cmdName : 'insertcol'
  197. },
  198. '-',
  199. {
  200. label: '右合并单元格',
  201. cmdName : 'mergeright'
  202. },
  203. {
  204. label: '下合并单元格',
  205. cmdName : 'mergedown'
  206. },
  207. '-',
  208. {
  209. label: '拆分成行',
  210. cmdName : 'splittorows'
  211. },
  212. {
  213. label: '拆分成列',
  214. cmdName : 'splittocols'
  215. },
  216. {
  217. label: '合并多个单元格',
  218. cmdName : 'mergecells'
  219. },
  220. {
  221. label: '完全拆分单元格',
  222. cmdName : 'splittocells'
  223. }
  224. ]
  225. }
  226. ],
  227. initialStyle: '', //编辑器内部样式
  228. initialContent: 'hello', //初始化编辑器的内容
  229. autoClearinitialContent :true, //是否自动清除编辑器初始内容
  230. iframeCssUrl :'../../../themes/iframe.css', //要引入css的url
  231. removeFormatTags : 'b,big,code,del,dfn,em,font,i,ins,kbd,q,samp,small,span,strike,strong,sub,sup,tt,u,var', //配置格式刷删除的标签
  232. removeFormatAttributes : 'class,style,lang,width,height,align,hspace,valign', //配置格式刷删除的属性
  233. enterTag : 'p', //编辑器回车标签。p或br
  234. maxUndoCount : 20, //最多可以回退的次数
  235. maxInputCount : 20, //当输入的字符数超过该值时,保存一次现场
  236. selectedTdClass : 'selectTdClass', //设定选中td的样式名称
  237. pasteplain : 0, //是否纯文本粘贴。false为不使用纯文本粘贴,true为使用纯文本粘贴
  238. textarea : 'editorValue', //提交表单时,服务器端接收编辑器内容的名字
  239. focus : false, //初始化时,是否让编辑器获得焦点true或false
  240. indentValue : '2em', //初始化时,首行缩进距离
  241. pageBreakTag : '_baidu_page_break_tag_', //分页符
  242. autoSave:true, //是否开启自动保存
  243. autoSavePath:this.UEDITOR_HOME_URL+'auto-save.php', //自动保存的地址
  244. autoSaveFrequency:5, //自动保存频率
  245. minFrameHeight: 320, //最小高度
  246. autoHeightEnabled: true, //是否自动长高
  247. autoFloatEnabled: true, //是否保持toolbar的位置不动
  248. elementPathEnabled : true, //是否启用elementPath
  249. serialize : function(){ //配置过滤标签
  250. function X( t, s, b ) {
  251. var o = {};
  252. for(var i=0,ai;ai=arguments[i++];){
  253. for(var k in ai){
  254. o[k] = ai[k]
  255. }
  256. }
  257. return o;
  258. }
  259. var inline = {strong:1,em:1,b:1,i:1,u:1,span:1,a:1,img:1};
  260. var block = X(inline, {p:1,div:1,blockquote:1,$:{style:1,dir:1}});
  261. return {
  262. blackList: {style:1,script:1,form:1,input:1,textarea:1,"#comment":1}
  263. // ,
  264. // whiteList: {
  265. // br: {$:{}},
  266. // span: X(inline, {$:{style:1,id:1}}),
  267. // strong: inline,
  268. // em:inline,
  269. // b: inline,
  270. // a: X(inline,{$:{href:1,'target':1,title:1}}),
  271. // u: inline,
  272. // div: block,
  273. // p: block,
  274. // ul: {li:1,$:{style:1}},
  275. // ol: {li:1,$:{style:1}},
  276. // li: block,
  277. // img: {$:{style:1,width:1,height:1,src:1,alt:1,title:1}}
  278. // }
  279. };
  280. }()
  281. };