editor_config.js 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275
  1. /**
  2. * ueditor完整配置项
  3. * 可以在这里配置整个编辑器的特性
  4. */
  5. var UEDITOR_CONFIG2 = {
  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']
  20. ],autoFloatEnabled:false,
  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. },
  87. iframeUrlMap: {
  88. 'anchor': '~/dialogs/anchor/anchor.html',
  89. 'image': '~/dialogs/image/image.html',
  90. 'inserttable': '~/dialogs/table/table.html',
  91. 'link': '~/dialogs/link/link.html',
  92. 'emoticon': '~/dialogs/emoticon/emoticon.html',
  93. 'spechars': '~/dialogs/spechars/spechars.html',
  94. 'searchreplace': '~/dialogs/searchreplace/searchreplace.html',
  95. 'map': '~/dialogs/map/map.html',
  96. 'gmap': '~/dialogs/gmap/gmap.html',
  97. 'video': '~/dialogs/video/video.html',
  98. 'help': '~/dialogs/help/help.html',
  99. 'code' : '~/dialogs/code/code.html',
  100. 'multimenu': '~/dialogs/menu-emoticon/emoticon.html'
  101. },
  102. listMap: {
  103. 'fontfamily': ['宋体', '楷体', '隶书', '黑体','andale mono','arial','arial black','comic sans ms','impact','times new roman'],
  104. 'fontsize': [10, 11, 12, 14, 16, 18, 20, 24, 36],
  105. 'underline':['none','overline','line-through','underline'],
  106. 'paragraph': ['p:Paragraph', 'h1:Heading 1', 'h2:Heading 2', 'h3:Heading 3', 'h4:Heading 4', 'h5:Heading 5', 'h6:Heading 6'],
  107. 'rowspacing' : ['1.0:0','1.5:15','2.0:20','2.5:25','3.0:30']
  108. },
  109. fontMap: {
  110. '宋体': ['宋体', 'SimSun'],
  111. '楷体': ['楷体', '楷体_GB2312', 'SimKai'],
  112. '黑体': ['黑体', 'SimHei'],
  113. '隶书': ['隶书', 'SimLi'],
  114. 'andale mono' : ['andale mono'],
  115. 'arial' : ['arial','helvetica','sans-serif'],
  116. 'arial black' : ['arial black','avant garde'],
  117. 'comic sans ms' : ['comic sans ms'],
  118. 'impact' : ['impact','chicago'],
  119. 'times new roman' : ['times new roman']
  120. },
  121. contextMenu: [
  122. {
  123. label : '删除',
  124. cmdName : 'delete'
  125. },
  126. {
  127. label : '全选',
  128. cmdName : 'selectall'
  129. },{
  130. label : '清空文档',
  131. cmdName : 'cleardoc',
  132. exec : function(){
  133. if(confirm('确定清空文档吗?')){
  134. this.execCommand('cleardoc');
  135. }
  136. }
  137. },'-',{
  138. label : '取消链接',
  139. cmdName : 'unlink'
  140. },'-',{
  141. group : '段落格式',
  142. icon : 'justifyjustify',
  143. subMenu : [
  144. {
  145. label: '居左对齐',
  146. cmdName : 'justify',
  147. value : 'left'
  148. },
  149. {
  150. label: '居右对齐',
  151. cmdName : 'justify',
  152. value : 'right'
  153. },{
  154. label: '居中对齐',
  155. cmdName : 'justify',
  156. value : 'center'
  157. },{
  158. label: '两端对齐',
  159. cmdName : 'justify',
  160. value : 'justify'
  161. }
  162. ]
  163. },'-',{
  164. group : '表格',
  165. icon : 'table',
  166. subMenu : [
  167. {
  168. },
  169. {
  170. label: '表格前插行',
  171. cmdName : 'insertparagraphbeforetable'
  172. },
  173. '-',
  174. {
  175. label: '删除行',
  176. cmdName : 'deleterow'
  177. },
  178. {
  179. label: '删除列',
  180. cmdName : 'deletecol'
  181. },
  182. '-',
  183. {
  184. label: '前插入行',
  185. cmdName : 'insertrow'
  186. },
  187. {
  188. label: '前插入列',
  189. cmdName : 'insertcol'
  190. },
  191. '-',
  192. {
  193. label: '右合并单元格',
  194. cmdName : 'mergeright'
  195. },
  196. {
  197. label: '下合并单元格',
  198. cmdName : 'mergedown'
  199. },
  200. '-',
  201. {
  202. label: '拆分成行',
  203. cmdName : 'splittorows'
  204. },
  205. {
  206. label: '拆分成列',
  207. cmdName : 'splittocols'
  208. },
  209. {
  210. label: '合并多个单元格',
  211. cmdName : 'mergecells'
  212. },
  213. {
  214. label: '完全拆分单元格',
  215. cmdName : 'splittocells'
  216. }
  217. ]
  218. }
  219. ],
  220. theme:'default',
  221. initialStyle: '', //编辑器内部样式
  222. initialContent: '<span style="color:#ccc">欢迎光临编辑器</span>', //初始化编辑器的内容
  223. autoClearinitialContent :true, //是否自动清除编辑器初始内容
  224. iframeCssUrl :'../../../themes/iframe.css', //要引入css的url
  225. removeFormatTags : 'b,big,code,del,dfn,em,font,i,ins,kbd,q,samp,small,span,strike,strong,sub,sup,tt,u,var', //配置格式刷删除的标签
  226. removeFormatAttributes : 'class,style,lang,width,height,align,hspace,valign', //配置格式刷删除的属性
  227. enterTag : 'br', //编辑器回车标签。p或br
  228. maxUndoCount : 20, //最多可以回退的次数
  229. maxInputCount : 20, //当输入的字符数超过该值时,保存一次现场
  230. selectedTdClass : 'selectTdClass', //设定选中td的样式名称
  231. pasteplain : 0, //是否纯文本粘贴。false为不使用纯文本粘贴,true为使用纯文本粘贴
  232. textarea : 'editorValue', //提交表单时,服务器端接收编辑器内容的名字
  233. focus : false, //初始化时,是否让编辑器获得焦点true或false
  234. indentValue : '2em', //初始化时,首行缩进距离
  235. pageBreakTag : '_baidu_page_break_tag_', //分页符
  236. initialFrameHeight: 400, //最小高度
  237. autoHeightEnabled: true, //是否自动长高
  238. elementPathEnabled : false, //是否启用elementPath
  239. serialize : function(){ //配置过滤标签
  240. function X( t, s, b ) {
  241. var o = {};
  242. for(var i=0,ai;ai=arguments[i++];){
  243. for(var k in ai){
  244. o[k] = ai[k]
  245. }
  246. }
  247. return o;
  248. }
  249. var inline = {strong:1,em:1,b:1,i:1,u:1,span:1,a:1,img:1};
  250. var block = X(inline, {p:1,div:1,blockquote:1,$:{style:1,dir:1}});
  251. return {
  252. blackList: {style:1,script:1,form:1,input:1,textarea:1,iframe:1,"#comment":1}
  253. // ,
  254. // whiteList: {
  255. // br: {$:{}},
  256. // span: X(inline, {$:{style:1,id:1}}),
  257. // strong: inline,
  258. // em:inline,
  259. // b: inline,
  260. // a: X(inline,{$:{href:1,'target':1,title:1}}),
  261. // u: inline,
  262. // div: block,
  263. // p: block,
  264. // ul: {li:1,$:{style:1}},
  265. // ol: {li:1,$:{style:1}},
  266. // li: block,
  267. // img: {$:{style:1,width:1,height:1,src:1,alt:1,title:1}}
  268. // }
  269. };
  270. }()
  271. };