MyEditor.js
资源名称:bangong.rar [点击查看]
上传用户:dlqqsh
上传日期:2021-11-13
资源大小:7840k
文件大小:14k
源码类别:
OA系统
开发平台:
Java
- if(!iXuEr)
- {
- var iXuEr = new Object();
- }
- // 编辑器字体列表
- iXuEr.Font_Family = ''
- + '宋体='宋体', sans-serif;'
- + '黑体='黑体', sans-serif;'
- + '楷体='楷体_GB2312', sans-serif;'
- + '隶书='隶书', sans-serif;'
- + '幼圆='幼圆', sans-serif;'
- + '新宋体='新宋体', sans-serif;'
- + 'Arial=Arial, Helvetica, sans-serif;'
- + 'Courier New='Courier New', Courier, monospace, serif;;'
- + 'Geneva=Geneva, Arial, Helvetica, sans-serif;'
- + 'Georgia=Georgia, 'Times New Roman', Times, serif;'
- + 'Tahoma=Tahoma, '宋体', sans-serif;'
- + 'Times New Roman='Times New Roman', Times, serif;'
- + 'Verdana=Verdana, Arial, Helvetica, '宋体', sans-serif;';
- iXuEr.Public_Valid_Attributes = 'id|class|title|dir|onclick|ondblclick|onmousedown|onmouseup|onmouseover|onmousemove|onmouseout|onkeypress|onkeydown|onkeyup|style';;
- // 编辑器样式一 应用于站内短信、评论、留言、论坛等
- // 编辑器要过滤的标签和属性 以下标签属性根据xhtml1-strict.dtd整理,做了一些改动
- iXuEr.Valid_Elements_1 = ''
- // + 'html[id|xmlns=http://www.w3.org/1999/xhtml],'
- // + 'head[title|id|base|profile],'
- // + 'title[id],'
- // + 'base[id|href],'
- // + 'link[href|charset|hreflang|type|rel|rev|media<screen?handheld?tty?tv?print?projection?braille?speech?all],'
- // + 'meta[http-equiv|id|name|content|scheme],'
- // + 'style[id|type|media|title|media<screen?handheld?tty?tv?print?projection?braille?speech?all|xml:space],'
- // + 'script[type|src|charset|defer=defer],'
- // + 'noscript[],'
- // + 'base[href],'
- // + 'body[onload|onunload|' + iXuEr.Public_Valid_Attributes + '],'
- + 'div[' + iXuEr.Public_Valid_Attributes + '],'
- + 'p[' + iXuEr.Public_Valid_Attributes + '],'
- + 'h1[' + iXuEr.Public_Valid_Attributes + '],'
- + 'h2[' + iXuEr.Public_Valid_Attributes + '],'
- + 'h3[' + iXuEr.Public_Valid_Attributes + '],'
- + 'h4[' + iXuEr.Public_Valid_Attributes + '],'
- + 'h5[' + iXuEr.Public_Valid_Attributes + '],'
- + 'h6[' + iXuEr.Public_Valid_Attributes + '],'
- + 'ul[' + iXuEr.Public_Valid_Attributes + '],'
- + 'ol[' + iXuEr.Public_Valid_Attributes + '],'
- + 'li[' + iXuEr.Public_Valid_Attributes + '],'
- + 'dl[' + iXuEr.Public_Valid_Attributes + '],'
- + 'dt[' + iXuEr.Public_Valid_Attributes + '],'
- + 'dd[' + iXuEr.Public_Valid_Attributes + '],'
- + 'address[' + iXuEr.Public_Valid_Attributes + '],'
- + 'hr[' + iXuEr.Public_Valid_Attributes + '],'
- + 'pre[' + iXuEr.Public_Valid_Attributes + '],'
- + 'blockquote[cite|' + iXuEr.Public_Valid_Attributes + '],'
- + 'ins[cite|datetime|' + iXuEr.Public_Valid_Attributes + '],'
- + 'del[cite|datetime|' + iXuEr.Public_Valid_Attributes + '],'
- + 'a[href|charset|type|hreflang|name|rel|rev|shape|coords|' + iXuEr.Public_Valid_Attributes + '],'
- + 'span[' + iXuEr.Public_Valid_Attributes + '],'
- + 'bdo[dir|id|class|title|style],'
- + 'br[id|class|title|style],'
- + 'em[' + iXuEr.Public_Valid_Attributes + '],'
- + 'strong[' + iXuEr.Public_Valid_Attributes + '],'
- + 'dfn[' + iXuEr.Public_Valid_Attributes + '],'
- + 'code[' + iXuEr.Public_Valid_Attributes + '],'
- + 'samp[' + iXuEr.Public_Valid_Attributes + '],'
- + 'kbd[' + iXuEr.Public_Valid_Attributes + '],'
- + 'var[' + iXuEr.Public_Valid_Attributes + '],'
- + 'cite[' + iXuEr.Public_Valid_Attributes + '],'
- + 'abbr[' + iXuEr.Public_Valid_Attributes + '],'
- + 'acronym[' + iXuEr.Public_Valid_Attributes + '],'
- + 'q[cite|' + iXuEr.Public_Valid_Attributes + '],'
- + 'sub[' + iXuEr.Public_Valid_Attributes + '],'
- + 'sup[' + iXuEr.Public_Valid_Attributes + '],'
- + 'tt[' + iXuEr.Public_Valid_Attributes + '],'
- + 'i[' + iXuEr.Public_Valid_Attributes + '],'
- + 'b[' + iXuEr.Public_Valid_Attributes + '],'
- + 'big[' + iXuEr.Public_Valid_Attributes + '],'
- + 'small[' + iXuEr.Public_Valid_Attributes + '],'
- + 'object[declare|classid|codebase|data|type|codetype|archive|standby|height|width|usemap|name|tabindex|' + iXuEr.Public_Valid_Attributes + '],'
- + 'param[name|value|id|type|valuetype],'
- + 'img[src|alt|longdesc|usemap|ismap|' + iXuEr.Public_Valid_Attributes + ']'
- + 'map[' + iXuEr.Public_Valid_Attributes + '],'
- + 'area[alt|shape|coords|href|nohref|accesskey|tabindex|' + iXuEr.Public_Valid_Attributes + '],'
- + 'form[action|method|enctype|accept|accept-charset|' + iXuEr.Public_Valid_Attributes + '],'
- + 'label[for|accesskey|' + iXuEr.Public_Valid_Attributes + '],'
- + 'input[name|type<button?checkbox?file?hidden?image?password?radio?reset?submit?text|value|checked|maxlength|src|alt|accept|disabled<disabled|readonly<readonly|accesskey|tabindex|' + iXuEr.Public_Valid_Attributes + '],'
- + 'select[name|size|multiple<multiple]|disabled<disabled|tabindex|' + iXuEr.Public_Valid_Attributes + ']'
- + 'optgroup[label|disabled<disabled|' + iXuEr.Public_Valid_Attributes + '],'
- + 'option[value|selected<selected|' + iXuEr.Public_Valid_Attributes + '],'
- + 'textarea[name|rows|cols|disabled<disabled|readonly<readonly|accesskey|tabindex|' + iXuEr.Public_Valid_Attributes + '],'
- + 'fieldset[' + iXuEr.Public_Valid_Attributes + '],'
- + 'legend[accesskey|' + iXuEr.Public_Valid_Attributes + '],'
- + 'button[accesskey|tabindex|disabled<disabled|name|type<button?submit?reset|' + iXuEr.Public_Valid_Attributes + '],'
- + 'table[summary|border|cellpadding|cellspacing|frame|rules|width|' + iXuEr.Public_Valid_Attributes + '],'
- + 'caption[' + iXuEr.Public_Valid_Attributes + '],'
- + 'colgroup[span|align|valign|char|charoff|' + iXuEr.Public_Valid_Attributes + '],'
- + 'col[span|align|valign|char|charoff|' + iXuEr.Public_Valid_Attributes + '],'
- + 'thead[align|valign|char|charoff|' + iXuEr.Public_Valid_Attributes + '],'
- + 'tfoot[align|valign|char|charoff|' + iXuEr.Public_Valid_Attributes + '],'
- + 'tbody[align|valign|char|charoff|' + iXuEr.Public_Valid_Attributes + '],'
- + 'tr[align|valign|char|charoff|' + iXuEr.Public_Valid_Attributes + '],'
- + 'th[colspan|rowspan|abbr|axis|headers|scope|align|valign|char|charoff|' + iXuEr.Public_Valid_Attributes + '],'
- + 'td[colspan|rowspan|abbr|axis|headers|scope|align|valign|char|charoff|' + iXuEr.Public_Valid_Attributes + '],'
- // 为非IE浏览器增加的标签
- + 'embed[src|type|quality|name|autostart|controls|id|allowscriptaccess|pluginspage],';
- iXuEr.Editor_Ask = false;
- iXuEr.Editor_1 = function (p_Elems, p_RootPath, p_base_url, p_MyStyles) {
- tinyMCE.init({
- mode : 'exact',
- elements : p_Elems,
- theme : 'advanced',
- language : 'zh_cn_utf8',
- docs_language : 'zh_cn_utf8',
- //dialog_type : 'modal',
- //encoding : 'xml',
- relative_urls : true,
- remove_script_host : true,
- document_base_url : p_base_url,
- custom_undo_redo_levels : 100,
- valid_elements : iXuEr.Valid_Elements_1,
- //extended_valid_elements : iXuEr.Valid_Elements_1,
- doctype : '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">',
- plugins : 'advhr, advimage, advlink, contextmenu, emotions, layer, style, paste, searchreplace, media, insertdatetime, preview, table, zoom, fullscreen, xhtmlxtras',
- theme_advanced_buttons1 : 'cut,copy,paste,pastetext,pasteword,|,styleselect,formatselect,fontselect,fontsizeselect,help,preview,|,cleanup,code',
- theme_advanced_buttons2 : 'bold,italic,sub,sup,|,search,replace,|,forecolor,backcolor,|,styleprops,|,undo,redo,|,link,unlink,anchor,|,advhr,image,media,emotions,charmap,insertdate,inserttime,|,removeformat,visualaid,fullscreen',
- theme_advanced_buttons3 : 'justifyleft,justifycenter,justifyright,justifyfull,|,bullist,numlist,outdent,indent,|,cite,abbr,acronym,del,ins,|,tablecontrols',
- theme_advanced_toolbar_location : 'top',
- theme_advanced_toolbar_align : 'left',
- theme_advanced_path_location : 'bottom',
- theme_advanced_fonts : iXuEr.Font_Family,
- theme_advanced_source_editor_width : '550',
- theme_advanced_source_editor_height : '450',
- content_css : p_MyStyles,
- plugin_insertdate_dateFormat : '%Y-%m-%d',
- plugin_insertdate_timeFormat : '%H:%M:%S',
- external_link_list_url : p_RootPath + 'iXs_Editor/My_link_list.js',
- external_image_list_url : p_RootPath + 'iXs_Editor/My_image_list.js',
- flash_external_list_url : p_RootPath + 'iXs_Editor/My_flash_list.js',
- theme_advanced_resize_horizontal : true,
- theme_advanced_resizing : true,
- theme_advanced_resizing_use_cookie : false,
- apply_source_formatting : true,
- convert_fonts_to_spans : true,
- add_form_submit_trigger : false,
- fix_list_elements : true,
- fix_table_elements : true,
- verify_html : true,
- ask : iXuEr.Editor_Ask,
- font_size_style_values : 'xx-small,x-small,small,medium,large,x-large,xx-large',
- theme_advanced_blockformats : 'p,div,address,pre,h1,h2,h3,h4,h5,h6',
- inline_styles : true
- });
- }
- // 编辑器样式二 应用于概要内容编辑
- iXuEr.Valid_Elements_2 = ''
- + 'div[' + iXuEr.Public_Valid_Attributes + '],'
- + 'p[' + iXuEr.Public_Valid_Attributes + '],'
- + 'h1[' + iXuEr.Public_Valid_Attributes + '],'
- + 'h2[' + iXuEr.Public_Valid_Attributes + '],'
- + 'h3[' + iXuEr.Public_Valid_Attributes + '],'
- + 'h4[' + iXuEr.Public_Valid_Attributes + '],'
- + 'h5[' + iXuEr.Public_Valid_Attributes + '],'
- + 'h6[' + iXuEr.Public_Valid_Attributes + '],'
- + 'ul[' + iXuEr.Public_Valid_Attributes + '],'
- + 'ol[' + iXuEr.Public_Valid_Attributes + '],'
- + 'li[' + iXuEr.Public_Valid_Attributes + '],'
- + 'dl[' + iXuEr.Public_Valid_Attributes + '],'
- + 'dt[' + iXuEr.Public_Valid_Attributes + '],'
- + 'dd[' + iXuEr.Public_Valid_Attributes + '],'
- + 'address[' + iXuEr.Public_Valid_Attributes + '],'
- + 'hr[' + iXuEr.Public_Valid_Attributes + '],'
- + 'pre[' + iXuEr.Public_Valid_Attributes + '],'
- + 'blockquote[cite|' + iXuEr.Public_Valid_Attributes + '],'
- + 'ins[cite|datetime|' + iXuEr.Public_Valid_Attributes + '],'
- + 'del[cite|datetime|' + iXuEr.Public_Valid_Attributes + '],'
- + 'a[href|charset|type|hreflang|name|rel|rev|shape|coords|' + iXuEr.Public_Valid_Attributes + '],'
- + 'span[' + iXuEr.Public_Valid_Attributes + '],'
- + 'bdo[dir|id|class|title|style],'
- + 'br[id|class|title|style],'
- + 'em[' + iXuEr.Public_Valid_Attributes + '],'
- + 'strong[' + iXuEr.Public_Valid_Attributes + '],'
- + 'dfn[' + iXuEr.Public_Valid_Attributes + '],'
- + 'code[' + iXuEr.Public_Valid_Attributes + '],'
- + 'samp[' + iXuEr.Public_Valid_Attributes + '],'
- + 'kbd[' + iXuEr.Public_Valid_Attributes + '],'
- + 'var[' + iXuEr.Public_Valid_Attributes + '],'
- + 'cite[' + iXuEr.Public_Valid_Attributes + '],'
- + 'abbr[' + iXuEr.Public_Valid_Attributes + '],'
- + 'acronym[' + iXuEr.Public_Valid_Attributes + '],'
- + 'q[cite|' + iXuEr.Public_Valid_Attributes + '],'
- + 'sub[' + iXuEr.Public_Valid_Attributes + '],'
- + 'sup[' + iXuEr.Public_Valid_Attributes + '],'
- + 'tt[' + iXuEr.Public_Valid_Attributes + '],'
- + 'i[' + iXuEr.Public_Valid_Attributes + '],'
- + 'b[' + iXuEr.Public_Valid_Attributes + '],'
- + 'big[' + iXuEr.Public_Valid_Attributes + '],'
- + 'small[' + iXuEr.Public_Valid_Attributes + '],'
- + 'img[src|alt|longdesc|usemap|ismap|' + iXuEr.Public_Valid_Attributes + ']';
- iXuEr.Editor_2 = function (p_Elems, p_RootPath, p_base_url, p_MyStyles) {
- tinyMCE.init({
- mode : 'exact',
- elements : p_Elems,
- theme : 'advanced',
- language : 'zh_cn_utf8',
- docs_language : 'zh_cn_utf8',
- relative_urls : true,
- remove_script_host : true,
- document_base_url : p_base_url,
- custom_undo_redo_levels : 100,
- valid_elements : iXuEr.Valid_Elements_2,
- plugins : 'advimage, contextmenu, emotions, style, insertdatetime, preview',
- theme_advanced_buttons1 : 'fontselect,fontsizeselect,styleprops,|,bold,italic,sub,sup,|,forecolor,backcolor,|,emotions,charmap,insertdate,inserttime,|,undo,redo,|,removeformat,|,cleanup,code,preview,help',
- theme_advanced_buttons2 : '',
- theme_advanced_buttons3 : '',
- theme_advanced_toolbar_location : 'top',
- theme_advanced_toolbar_align : 'left',
- theme_advanced_path_location : 'bottom',
- theme_advanced_fonts : iXuEr.Font_Family,
- theme_advanced_source_editor_width : '550',
- theme_advanced_source_editor_height : '450',
- content_css : p_MyStyles,
- plugin_insertdate_dateFormat : '%Y-%m-%d',
- plugin_insertdate_timeFormat : '%H:%M:%S',
- theme_advanced_resize_horizontal : false,
- theme_advanced_resizing : true,
- theme_advanced_resizing_use_cookie : false,
- apply_source_formatting : true,
- convert_fonts_to_spans : true,
- add_form_submit_trigger : false,
- fix_list_elements : true,
- fix_table_elements : true,
- verify_html : true,
- ask : iXuEr.Editor_Ask,
- font_size_style_values : 'xx-small,x-small,small,medium,large,x-large,xx-large',
- theme_advanced_blockformats : 'p,div,address,pre,h1,h2,h3,h4,h5,h6',
- inline_styles : true
- });
- }
- // 编辑器样式三 应用于标题编辑
- iXuEr.Valid_Elements_3 = 'span[' + iXuEr.Public_Valid_Attributes + ']';
- iXuEr.Editor_3 = function (p_Elems, p_RootPath, p_base_url, p_MyStyles) {
- tinyMCE.init({
- mode : 'exact',
- elements : p_Elems,
- theme : 'advanced',
- language : 'zh_cn_utf8',
- docs_language : 'zh_cn_utf8',
- relative_urls : true,
- remove_script_host : true,
- document_base_url : p_base_url,
- custom_undo_redo_levels : 100,
- valid_elements : iXuEr.Valid_Elements_3,
- plugins : 'contextmenu, style, preview',
- theme_advanced_buttons1 : 'styleprops,|,cleanup,code,preview,help',
- theme_advanced_buttons2 : '',
- theme_advanced_buttons3 : '',
- theme_advanced_toolbar_location : 'top',
- theme_advanced_toolbar_align : 'left',
- theme_advanced_path_location : 'bottom',
- theme_advanced_fonts : iXuEr.Font_Family,
- theme_advanced_source_editor_width : '550',
- theme_advanced_source_editor_height : '450',
- content_css : p_MyStyles,
- plugin_insertdate_dateFormat : '%Y-%m-%d',
- plugin_insertdate_timeFormat : '%H:%M:%S',
- theme_advanced_resize_horizontal : false,
- theme_advanced_resizing : true,
- theme_advanced_resizing_use_cookie : false,
- apply_source_formatting : true,
- convert_fonts_to_spans : true,
- add_form_submit_trigger : false,
- fix_list_elements : true,
- fix_table_elements : true,
- verify_html : true,
- inline_styles : true,
- onchange_callback : 'myContentFixed'
- });
- }
- function myContentFixed(inst)
- {
- var html = tinyMCE.getContent();
- if(html.toString().match(/((<span>)|(<span style=".+?">)).+?(</span>)/gi))
- {
- var str = html.replace(/<.+?>/gi, '');
- html = html.replace(/((<span>)|(<span style=".+?">)).+?(</span>)/, '$1' + str + '$2');
- }
- else
- {
- html = html.replace(/<.+?>/gi, '');
- html = '<span>' + html + '</span>';
- }
- html = html.replace(/<span></span>/gi, '');
- html = html.replace(/<span> </span>/gi, ' ');
- tinyMCE.setContent(html);
- }