editor_config.js 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276
  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. label: '删除表格',
  169. cmdName : 'deletetable'
  170. },
  171. {
  172. label: '表格前插行',
  173. cmdName : 'insertparagraphbeforetable'
  174. },
  175. '-',
  176. {
  177. label: '删除行',
  178. cmdName : 'deleterow'
  179. },
  180. {
  181. label: '删除列',
  182. cmdName : 'deletecol'
  183. },
  184. '-',
  185. {
  186. label: '前插入行',
  187. cmdName : 'insertrow'
  188. },
  189. {
  190. label: '前插入列',
  191. cmdName : 'insertcol'
  192. },
  193. '-',
  194. {
  195. label: '右合并单元格',
  196. cmdName : 'mergeright'
  197. },
  198. {
  199. label: '下合并单元格',
  200. cmdName : 'mergedown'
  201. },
  202. '-',
  203. {
  204. label: '拆分成行',
  205. cmdName : 'splittorows'
  206. },
  207. {
  208. label: '拆分成列',
  209. cmdName : 'splittocols'
  210. },
  211. {
  212. label: '合并多个单元格',
  213. cmdName : 'mergecells'
  214. },
  215. {
  216. label: '完全拆分单元格',
  217. cmdName : 'splittocells'
  218. }
  219. ]
  220. }
  221. ],
  222. theme:'default',
  223. initialStyle: '', //编辑器内部样式
  224. initialContent: '<span style="color:#ccc">欢迎光临编辑器</span>', //初始化编辑器的内容
  225. autoClearinitialContent :true, //是否自动清除编辑器初始内容
  226. iframeCssUrl :'../../../themes/iframe.css', //要引入css的url
  227. removeFormatTags : 'b,big,code,del,dfn,em,font,i,ins,kbd,q,samp,small,span,strike,strong,sub,sup,tt,u,var', //配置格式刷删除的标签
  228. removeFormatAttributes : 'class,style,lang,width,height,align,hspace,valign', //配置格式刷删除的属性
  229. enterTag : 'br', //编辑器回车标签。p或br
  230. maxUndoCount : 20, //最多可以回退的次数
  231. maxInputCount : 20, //当输入的字符数超过该值时,保存一次现场
  232. selectedTdClass : 'selectTdClass', //设定选中td的样式名称
  233. pasteplain : 0, //是否纯文本粘贴。false为不使用纯文本粘贴,true为使用纯文本粘贴
  234. textarea : 'editorValue', //提交表单时,服务器端接收编辑器内容的名字
  235. focus : false, //初始化时,是否让编辑器获得焦点true或false
  236. indentValue : '2em', //初始化时,首行缩进距离
  237. pageBreakTag : '_baidu_page_break_tag_', //分页符
  238. initialFrameHeight: 400, //最小高度
  239. autoHeightEnabled: true, //是否自动长高
  240. elementPathEnabled : false, //是否启用elementPath
  241. serialize : function(){ //配置过滤标签
  242. function X( t, s, b ) {
  243. var o = {};
  244. for(var i=0,ai;ai=arguments[i++];){
  245. for(var k in ai){
  246. o[k] = ai[k]
  247. }
  248. }
  249. return o;
  250. }
  251. var inline = {strong:1,em:1,b:1,i:1,u:1,span:1,a:1,img:1};
  252. var block = X(inline, {p:1,div:1,blockquote:1,$:{style:1,dir:1}});
  253. return {
  254. blackList: {style:1,script:1,form:1,input:1,textarea:1,iframe:1,"#comment":1}
  255. // ,
  256. // whiteList: {
  257. // br: {$:{}},
  258. // span: X(inline, {$:{style:1,id:1}}),
  259. // strong: inline,
  260. // em:inline,
  261. // b: inline,
  262. // a: X(inline,{$:{href:1,'target':1,title:1}}),
  263. // u: inline,
  264. // div: block,
  265. // p: block,
  266. // ul: {li:1,$:{style:1}},
  267. // ol: {li:1,$:{style:1}},
  268. // li: block,
  269. // img: {$:{style:1,width:1,height:1,src:1,alt:1,title:1}}
  270. // }
  271. };
  272. }()
  273. };