var isLoadEditor = false;
var ke4Editor = [];
var ue;
var editorStartMode = "";
if (typeof(US_editorMode) == "undefined"){
	try { console.log("[US_editorMode]未定义"); }catch(e){}
	editorMode = 'kindeditor4';	// 默认编辑器
}else{
	editorMode = US_editorMode;
}
try { console.log("editorMode："+ editorMode); }catch(e){}

LoadEditorFile();

// 编辑器加载
function LoadEditorFile(){
	if (isLoadEditor == false){
		if (editorMode=="tinymce"){
			// LoadJsFile("ckeditorJs",webPathPart +"wap/users/tools/tinymce/tinymce.min.js",0);
			document.write(""+
			"<script language='javascript' type='text/javascript' src='"+ webPathPart +"wap/users/tools/tinymce/tinymce.min.js'></script>"+
			"<style>.tinymce-ad { display: none !important; }</style>"+
			"");
		}else if (editorMode=="tinymce5"){
			// LoadJsFile("ckeditorJs",webPathPart +"wap/users/tools/tinymce5/tinymce.min.js",0);
			document.write(""+
			"<script language='javascript' type='text/javascript' src='"+ webPathPart +"wap/users/tools/tinymce5/tinymce.min.js'></script>"+
			"<style>.tinymce-ad { display: none !important; }</style>"+
			"");
		}else if (editorMode=="ckeditor4"){
			// LoadJsFile("ckeditorJs",webPathPart +"tools/ckeditor4/ckeditor.js",0);
			document.write(""+
			"<script language='javascript' type='text/javascript' src='"+ webPathPart +"tools/ckeditor4/ckeditor.js'></script>"+
			"<style>.cke_notifications_area { display: none; }</style>"+
			"");
		}else if (editorMode=="ckeditor3"){
			// LoadJsFile("ckeditorJs",webPathPart +"tools/ckeditor3/ckeditor.js",0);
			document.write("<script language='javascript' type='text/javascript' src='"+ webPathPart +"tools/ckeditor3/ckeditor.js'></script>");
		}else if (editorMode=="fckeditor"){
			// LoadJsFile("fckeditorJs",webPathPart +"tools/fckeditor/fckeditor.js",0);
			document.write("<script language='javascript' type='text/javascript' src='"+ webPathPart +"tools/fckeditor/fckeditor.js'></script>");
		}else if (editorMode=="kindeditor3"){
			// LoadJsFile("kindeditorJs",webPathPart +"tools/kindeditor3/kindeditor-min.js",0);
			document.write("<script language='javascript' type='text/javascript' src='"+ webPathPart +"tools/kindeditor3/kindeditor-min.js'></script>");
		}else if (editorMode=="ueditor"){
			// LoadJsFile("ueditorJs2",webPathPart +"wap/users/tools/ueditor/ueditor.config.js",0);
			// LoadJsFile("ueditorJs3",webPathPart +"wap/users/tools/ueditor/ueditor.all.min.js",0);
			// LoadJsFile("ueditorJs1",webPathPart +"wap/users/tools/ueditor/lang/zh-cn/zh-cn.js",0);
			document.write(""+
			"<script language='javascript' type='text/javascript' src='"+ webPathPart +"wap/users/tools/ueditor/ueditor.config.js' charset='gbk'></script>"+
			"<script language='javascript' type='text/javascript' src='"+ webPathPart +"wap/users/tools/ueditor/ueditor.all.min.js' charset='gbk'></script>"+
			"<script language='javascript' type='text/javascript' src='"+ webPathPart +"wap/users/tools/ueditor/lang/zh-cn/zh-cn.js' charset='gbk'></script>"+
			"");
		}else{
			editorMode = "kindeditor4";
			// LoadJsFile("kindeditorJs",webPathPart +"tools/kindeditor4/kindeditor-all-min.js",0);
			document.write("<script language='javascript' type='text/javascript' src='"+ webPathPart +"tools/kindeditor4/kindeditor-all-min.js'></script>");
		}
		isLoadEditor = true;
	}
}



// 加载编辑器
function LoadEditor(inputId,editorW,editorH,modeStr) {
	setTimeout("InitEditor('"+ inputId +"', '"+ editorW +"', "+ editorH +", '"+ modeStr +"');",500);
}

function InitEditor(inputId,editorW,editorH,modeStr){
	if (editorW == 0){ editorW = "100%"; }
	if (editorH == 0){ editorH = 600; }
	switch (editorMode){
		case 'tinymce':
			if (modeStr.indexOf('|miniMenu|') != -1){
				minHeight = 200;
				toolbarList = ['code forecolor backcolor bold italic underline strikethrough link | styles fontfamily fontsize'];
			}else{
				minHeight = 350;
				toolbarList = ['code undo redo | cut copy paste pastetext | forecolor backcolor bold italic underline strikethrough link | fullscreen wordcount | alignleft aligncenter alignright alignjustify | styles fontfamily fontsize | removeformat | table image media | hr lineheight searchreplace'];
			}
			tinymce.init({
				selector: '#'+ inputId,		// 选择器，指定哪个元素使用 TinyMCE
				language: 'zh_CN',			// 语言设置
				width: '100%',				// 编辑器宽度
				height: editorH,			// 编辑器高度
				min_height: minHeight,		// 编辑器最低高度
				menubar: true,				// 是否显示菜单栏
				statusbar: true,			// 是否显示状态栏
				branding: false,			// 去除底部的 TinyMCE 广告
				relative_urls: false,		// 3项，避免图片地址和链接地址转换成相对路径
				remove_script_host: false,
				convert_urls: false,
				setup: function(editor) {
					editor.on('keydown', function (event) {
						if (event.keyCode === 13) {
							// 回车键 和 回车键+shift 对调
							if (event.shiftKey){
								event.shiftKey = false;
							}else{
								event.shiftKey = true;
							}
						}
					});
				},
				skin: 'tinymce-5',		// 皮肤
				plugins: [
					'advlist', 'accordion', 'directionality', 'importcss', 'nonbreaking', 'save', 'visualchars', 'lists', 'link', 'image', 'charmap', 'preview', 'searchreplace', 'visualblocks', 'code', 'fullscreen', 'insertdatetime', 'media', 'table', 'help', 'wordcount', 'emoticons', 'autosave', 'quickbars', 'codesample'
					],					// 启用的插件列表 ,'autoresize', 'autolink', 'anchor'
				toolbar: toolbarList,					// 工具栏按钮列表 preview save codesample
				toolbar_sticky: true,	// 工具栏固定在顶部

				font_size_formats: '12px 14px 16px 18px 24px 36px 48px 56px 72px',
				font_family_formats: '微软雅黑=Microsoft YaHei,Helvetica Neue,PingFang SC,sans-serif;苹果苹方=PingFang SC,Microsoft YaHei,sans-serif;宋体=simsun,serif;仿宋体=FangSong,serif;黑体=SimHei,sans-serif;Arial=arial,helvetica,sans-serif;Arial Black=arial black,avant garde;Book Antiqua=book antiqua,palatino;',
				importcss_append: true,				// 将导入的样式附加到格式菜单末尾并替换默认格式
				autosave_ask_before_unload: false,	// 当关闭或跳转URL时，弹出提示框提醒用户仍未保存变更内容。默认开启提示。
				toolbar_mode: 'wrap',				// 工具栏的显示模式：浮动模式（floating）、‌滑动模式（sliding）、‌滚动模式（scrolling）、‌换行模式（wrap）
				entity_encoding: "named",			// 处理实体/字符的转换方式：named（如空格转换成&nbsp;）、numeric（如空格将编码为&#160;）、raw（除了XML默认实体<,>,&,"）
				remove_trailing_brs: false,			// 删除最尾的br
				valid_elements: '',					// 防止TinyMCE自动清理HTML
				image_uploadtab: false,				// 禁用上传图片功能
				automatic_uploads: false,			// 禁用自动上传，可选
				images_upload_url: '',				// 设置一个无效的上传 URL 或者不设置任何上传处理器
			});
			break;

		case 'tinymce5':
			if (modeStr.indexOf('|miniMenu|') != -1){
				minHeight = 200;
				toolbarList = ['code forecolor backcolor bold italic underline strikethrough link | styleselect fontselect fontsizeselect'];
			}else{
				minHeight = 350;
				toolbarList = ['code undo redo | cut copy paste pastetext | forecolor backcolor bold italic underline strikethrough link | fullscreen wordcount | alignleft aligncenter alignright alignjustify | styleselect fontselect fontsizeselect | removeformat | table image media | hr bdmap indent2em lineheight formatpainter importword kityformula-editor searchreplace'];
			}
			tinymce.init({
				selector: '#'+ inputId,		// 选择器，指定哪个元素使用 TinyMCE
				language: 'zh_CN',			// 语言设置
				width: '100%',				// 编辑器宽度
				height: editorH,			// 编辑器高度
				min_height: minHeight,		// 编辑器最低高度
				menubar: true,				// 是否显示菜单栏
				statusbar: true,			// 是否显示状态栏
				branding: false,			// 去除底部的 TinyMCE 广告
				relative_urls: false,		// 3项，避免图片地址和链接地址转换成相对路径
				remove_script_host: false,
				convert_urls: false,
				setup: function(editor) {
					editor.on('keydown', function (event) {
						if (event.keyCode === 13) {
							// 回车键 和 回车键+shift 对调
							if (event.shiftKey){
								event.shiftKey = false;
							}else{
								event.shiftKey = true;
							}
						}
					});
				},
				plugins: [
					'advlist', 'autosave', 'charmap', 'code', 'codesample', 'colorpicker', 'contextmenu', 'directionality', 'emoticons', 'fullscreen', 'help', 'hr', 'image', 'imagetools', 'importcss', 'insertdatetime', 'legacyoutput', 'link', 'lists', 'media', 'nonbreaking', 'noneditable', 'pagebreak', 'paste', 'preview', 'print', 'quickbars', 'save', 'searchreplace', 'spellchecker', 'tabfocus', 'table', 'template', 'textcolor', 'textpattern', 'toc', 'visualblocks', 'visualchars', 'wordcount'
					],					// 启用的插件列表, 'autoresize', 'autolink', 'anchor', 'bbcode', 'fullpage'
				toolbar: toolbarList,	// 工具栏按钮列表
				toolbar_sticky: true,	// 工具栏固定在顶部

				fontsize_formats: '12px 14px 16px 18px 24px 36px 48px 56px 72px',
				font_formats: '微软雅黑=Microsoft YaHei,Helvetica Neue,PingFang SC,sans-serif;苹果苹方=PingFang SC,Microsoft YaHei,sans-serif;宋体=simsun,serif;仿宋体=FangSong,serif;黑体=SimHei,sans-serif;Arial=arial,helvetica,sans-serif;Arial Black=arial black,avant garde;Book Antiqua=book antiqua,palatino;',
				importcss_append: true,				// 将导入的样式附加到格式菜单末尾并替换默认格式
				autosave_ask_before_unload: false,	// 当关闭或跳转URL时，弹出提示框提醒用户仍未保存变更内容。默认开启提示。
				toolbar_mode: 'wrap',				// 工具栏的显示模式：浮动模式（floating）、‌滑动模式（sliding）、‌滚动模式（scrolling）、‌换行模式（wrap）
				entity_encoding: "named",			// 处理实体/字符的转换方式：named（如空格转换成&nbsp;）、numeric（如空格将编码为&#160;）、raw（除了XML默认实体<,>,&,"）
				remove_trailing_brs: false,			// 删除最尾的br
				valid_elements: '',					// 防止TinyMCE自动清理HTML
				image_uploadtab: false,				// 禁用上传图片功能
				automatic_uploads: false,			// 禁用自动上传，可选
				images_upload_url: '',				// 设置一个无效的上传 URL 或者不设置任何上传处理器
			});
			break;

		case 'kindeditor3':
			if (modeStr.indexOf('|source|') != -1){ wyswygModeVal=false; }else{ wyswygModeVal=true; }
			if (modeStr.indexOf('|miniMenu|') != -1){
				itemsVal=[
					'source', '|','cut', 'copy', 'paste', '|', 'justifyleft', 'justifycenter', 'justifyright',
					'fontname', 'fontsize', '|', 'textcolor', 'bgcolor', 'bold',
					'italic', 'underline', 'strikethrough', 'removeformat', '|', 'link', 'unlink', 'image'
				];
			}else{
				itemsVal=[
					'source', '|', 'fullscreen', 'undo', 'redo', 'selectall', '|', 'cut', 'copy', 'paste',
					'plainpaste', 'wordpaste', '|', 'justifyleft', 'justifycenter', 'justifyright',
					'justifyfull', 'insertorderedlist', 'insertunorderedlist', 'indent', 'outdent', 'subscript',
					'superscript', '-',
					'title', 'fontname', 'fontsize', '|', 'textcolor', 'bgcolor', 'bold',
					'italic', 'underline', 'strikethrough', 'removeformat', '|', 'image',
					'flash', 'media', 'advtable', 'hr', 'link', 'unlink', '|', 'about'
				];
			}
			KE.init({
				id : inputId,
				allowUpload : false,
				minWidth : editorW,
				minHeight : editorH,
				newlineTag : 'p',
				items : itemsVal,
		//		resizeMode : 1,	// 2 或1 或0，2 时可以拖动改变宽度和高度，1 时只能改变高度，0 时不能拖动。默认值：2
				wyswygMode : wyswygModeVal,
				cssPath : ['tools/kindeditor.css'],
				afterCreate : function(id) {
					KE.util.focus(id);
				}
			});
		//	KE.create(inputId);
			setTimeout("KE.create('"+ inputId +"');",600);
			break;

		case 'kindeditor4':
			if (modeStr.indexOf('|source|') != -1){ designModeVal=false; }else{ designModeVal=true; }
			if (modeStr.indexOf('|miniMenu|') != -1){
				itemsVal=[
					'source', '|','cut', 'copy', 'paste', '|', 'justifyleft', 'justifycenter', 'justifyright',
					'fontname', 'fontsize', 'forecolor', '|', 'bold',
					'italic', 'underline', 'strikethrough', 'removeformat', '|', 'link', 'unlink', 'image'
				];
			}else{
				itemsVal=[
					'source', '|', 'undo', 'redo', '|', 'code', 'selectall','cut', 'copy', 'paste',
					'plainpaste', 'wordpaste', '|', 'justifyleft', 'justifycenter', 'justifyright',
					'justifyfull', 'insertorderedlist', 'insertunorderedlist', 'indent', 'outdent', 'subscript',
					'superscript', 'clearhtml', 'quickformat', '|', 'fullscreen', '/',
					'formatblock', 'fontname', 'fontsize', '|', 'forecolor', 'hilitecolor', 'bold',
					'italic', 'underline', 'strikethrough', 'lineheight', 'removeformat', '|', 'image',
					'flash', 'media', 'insertfile', 'table', 'hr', 'anchor', 'link', 'unlink'
				];
			}
			ke4Editor[inputId] = KindEditor.create("#"+ inputId,{
				allowImageUpload : false,
				allowFlashUpload : false,
				allowMediaUpload : false,
				allowFileUpload : false,
				allowFileManager : false,
				minWidth : editorW,
				minHeight : editorH,
				newlineTag : 'p',
				items : itemsVal,
				designMode : designModeVal,
/*
				colorTable : [	
					["#000000","#003300","#006600","#009900","#00cc00","#00ff00","#330000","#333300","#336600","#339900","#33cc00","#33ff00","#660000","#663300","#666600","#669900","#66cc00","#66ff00","#000000"],
					["#000033","#003333","#006633","#009933","#00cc33","#00ff33","#330033","#333333","#336633","#339933","#33cc33","#33ff33","#660033","#663333","#666633","#669933","#66cc33","#66ff33","#333333"],
					["#000066","#003366","#006666","#009966","#00cc66","#00ff66","#330066","#333366","#336666","#339966","#33cc66","#33ff66","#660066","#663366","#666666","#669966","#66cc66","#66ff66","#666666"],
					["#000099","#003399","#006699","#009999","#00cc99","#00ff99","#330099","#333399","#336699","#339999","#33cc99","#33ff99","#660099","#663399","#666699","#669999","#66cc99","#66ff99","#999999"],
					["#0000cc","#0033cc","#0066cc","#0099cc","#00cccc","#00ffcc","#3300cc","#3333cc","#3366cc","#3399cc","#33cccc","#33ffcc","#6600cc","#6633cc","#6666cc","#6699cc","#66cccc","#66ffcc","#cccccc"],
					["#0000ff","#0033ff","#0066ff","#0099ff","#00ccff","#00ffff","#3300ff","#3333ff","#3366ff","#3399ff","#33ccff","#33ffff","#6600ff","#6633ff","#6666ff","#6699ff","#66ccff","#66ffff","#ffffff"],
					["#990000","#993300","#996600","#999900","#99cc00","#99ff00","#cc0000","#cc3300","#cc6600","#cc9900","#cccc00","#ccff00","#ff0000","#ff3300","#ff6600","#ff9900","#ffcc00","#ffff00"],
					["#990033","#993333","#996633","#999933","#99cc33","#99ff33","#cc0033","#cc3333","#cc6633","#cc9933","#cccc33","#ccff33","#ff0033","#ff3333","#ff6633","#ff9933","#ffcc33","#ffff33"],
					["#990066","#993366","#996666","#999966","#99cc66","#99ff66","#cc0066","#cc3366","#cc6666","#cc9966","#cccc66","#ccff66","#ff0066","#ff3366","#ff6666","#ff9966","#ffcc66","#ffff66"],
					["#990099","#993399","#996699","#999999","#99cc99","#99ff99","#cc0099","#cc3399","#cc6699","#cc9999","#cccc99","#ccff99","#ff0099","#ff3399","#ff6699","#ff9999","#ffcc99","#ffff99"],
					["#9900cc","#9933cc","#9966cc","#9999cc","#99cccc","#99ffcc","#cc00cc","#cc33cc","#cc66cc","#cc99cc","#cccccc","#ccffcc","#ff00cc","#ff33cc","#ff66cc","#ff99cc","#ffcccc","#ffffcc"],
					["#9900ff","#9933ff","#9966ff","#9999ff","#99ccff","#99ffff","#cc00ff","#cc33ff","#cc66ff","#cc99ff","#ccccff","#ccffff","#ff00ff","#ff33ff","#ff66ff","#ff99ff","#ffccff","#ffffff"]
				],
*/
				cssPath : ['tools/kindeditor.css']
			});
			break;

		case 'ckeditor3': case 'ckeditor4':
				if (modeStr.indexOf('|source|') != -1){ editorStartMode="source"; }else{ editorStartMode="wysiwyg"; }
				if (modeStr.indexOf('|miniMenu|') != -1){ toolbarStr="Basic"; }else{ toolbarStr="SY"; }
				var editor = CKEDITOR.replace(inputId,
				{
					width : editorW,
					height : editorH,
//					removePlugins : 'elementspath', //去掉底部一行的元素路径显示
//					resize_enabled : true, //拖拽功能开关
					startupMode : editorStartMode,
					toolbar : toolbarStr
				});
			break;

		case 'fckeditor':
				if (modeStr.indexOf('|source|') != -1){ editorStartMode="source"; }else{ editorStartMode=""; }
				if (modeStr.indexOf('|miniMenu|') != -1){ toolbarStr="Basic"; }else{ toolbarStr="SY"; }
				var editor=new FCKeditor(inputId);
				editor.BasePath='tools/fckeditor/';	//fck根目录
				editor.Width = editorW;
				editor.Height = editorH;
				editor.EditMode = -1;
				editor.ToolbarSet = toolbarStr;
				editor.ReplaceTextarea() ; 
			break;

		case 'ueditor':
				if (modeStr.indexOf('|source|') != -1){ editorFirstMode=true; }else{ editorFirstMode=false; }
				if (modeStr.indexOf('|miniMenu|') != -1){
					toolbarsMenu = [
							['source', '|','forecolor', 'backcolor', 'bold', 'italic', 'underline', 'strikethrough', '|','fontfamily', 'fontsize', '|','link', 'unlink', '|', 'insertimage','spechars']
						];
					minFrameH = editorH-28;
				}else{
					/* V1.2.6.2
					toolbarsMenu = [
							['fullscreen', 'source', '|', 'undo', 'redo', '|','selectall','pasteplain', 'forecolor', 'backcolor','removeformat', 'formatmatch','autotypeset', '|',
								'bold', 'italic', 'underline', 'strikethrough',  '|', 'paragraph', '|','rowspacingtop', 'rowspacingbottom','lineheight', '|','fontfamily', 'fontsize', '|',
								'justifyleft', 'justifycenter','|','link', 'unlink', '|', 'insertimage', 'insertvideo','map', 'gmap', 'highlightcode','template', '|',
								'spechars', 'wordimage', '|', 'searchreplace','help', '|','inserttable', 'deletetable', 'insertparagraphbeforetable', 'insertrow', 'deleterow', 'insertcol', 'deletecol', 'mergecells', 'mergeright', 'mergedown', 'splittocells', 'splittorows', 'splittocols', '|','syupimg']
						];
					*/
					/*  */
					toolbarsMenu = [
							['fullscreen', 'source', '|', 'undo', 'redo', '|','selectall','pasteplain', 'forecolor', 'backcolor','removeformat', 'formatmatch','autotypeset', '|',
								'bold', 'italic', 'underline', 'strikethrough',  '|', 'paragraph', '|','rowspacingtop', 'rowspacingbottom','lineheight', '|','fontfamily', 'fontsize', '|',
								'justifyleft', 'justifycenter','|','link', 'unlink', '|', 'insertimage', 'insertvideo','map', 'gmap', 'highlightcode','template', '|',
								'spechars', 'wordimage', '|', 'searchreplace','help', '|','inserttable', 'deletetable', 'insertparagraphbeforetable', 'insertrow', 'deleterow', 'insertcol', 'deletecol', 'mergecells', 'mergeright', 'mergedown', 'splittocells', 'splittorows', 'splittocols', 'charts', 'drafts', '|','syupimg']
						];
					minFrameH = editorH-84;
				}
				ue = new UE.ui.Editor({
					// 这里可以选择自己需要的工具按钮名称,此处仅选择如下五个
					toolbars:toolbarsMenu,
					// 最小高度,默认320
					minFrameHeight:minFrameH,
					// 允许的最大字符数
					maximumWords:1000000,
					// 是否启用元素路径，默认是显示
					elementPathEnabled:false,
					// 可以最多回退的次数,默认20
					maxUndoCount:99,
					// 是否自动长高,默认true
					autoHeightEnabled:false,
					// 编辑器初始化完成后是否进入源码模式，默认为否。
					sourceEditorFirst:editorFirstMode,
					// 编辑器内部样式,可以用来改变字体等
					initialStyle:'body{font-size:14px;margin:3px;padding:0; line-height:1.4;} p{margin:0;padding:0;}',
					// 关闭字数统计
					wordCount:false
				});
				ue.render(inputId);
			break;
	}

}

// 获取编辑器中HTML内容
function GetEditorHTML(id) {
	switch (editorMode){
		case 'tinymce':
			return tinyMCE.get(id).getContent();
			break;

		case 'tinymce5':
			return tinyMCE.editors[id].getContent();
			break;

		case 'kindeditor3':
			return KE.html(id);
			break;

		case 'kindeditor4':
			return ke4Editor[id].html();
			break;

		case 'ckeditor3': case 'ckeditor4':
			var ckObj = CKEDITOR.instances[id];
			return ckObj.document.getBody().getHtml();
			break;

		case 'fckeditor':
			var fckObj = FCKeditorAPI.GetInstance(id);
			return fckObj.GetXHTML(true);
			break;

		case 'ueditor':
			var ueObj = UE.getEditor(id);
			return ueObj.getContent();
			break;
	}
}

// 获取编辑器中文字内容
function GetEditorText(id) {
	switch (editorMode){
		case 'tinymce':
			return tinyMCE.get(id).getContent({ format: 'text' });
			break;

		case 'tinymce5':
			return tinyMCE.editors[id].getContent({ format: 'text' });
			break;

		case 'kindeditor3':
			return KE.text(id);
			break;
	
		case 'kindeditor4':
			return ke4Editor[id].text();
			break;

		case 'ckeditor3': case 'ckeditor4':
			var ckObj = CKEDITOR.instances[id];
			return ckObj.document.getBody().getText();
			break;
	
		case 'fckeditor':
			var fckObj = FCKeditorAPI.GetInstance(id);
			return fckObj.EditorDocument.body.innerText;
			break;

		case 'ueditor':
			var ueObj = UE.getEditor(id);
			return ueObj.getContentTxt();
			break;
	}
}

// 设置编辑器中内容
function SetEditorHtml(id, str) {
	switch (editorMode){
		case 'tinymce':
			return tinyMCE.get(id).setContent(str);
			break;

		case 'tinymce5':
			return tinyMCE.editors[id].setContent(str);
			break;

		case 'kindeditor3':
			KE.html(id,str);
			break;
	
		case 'kindeditor4':
			ke4Editor[id].html(str);
			break;

		case 'ckeditor3': case 'ckeditor4':
			var ckObj = CKEDITOR.instances[id];
			ckObj.setData(str);
			break;
	
		case 'fckeditor':
			var fckObj = FCKeditorAPI.GetInstance(id) ;
			fckObj.SetHTML(str) ;
			break;

		case 'ueditor':
			var ueObj = UE.getEditor(id);
			ueObj.setContent(str);
			break;
	}
}

// 插入字符串到编辑器中
function InsertStrToEditor(id, str) {
	switch (editorMode){
		case 'tinymce':
			return tinyMCE.get(id).insertContent(str);
			break;

		case 'tinymce5':
			return tinyMCE.editors[id].insertContent(str);
			break;

		case 'kindeditor3':
			KE.insertHtml(id, str);
			break;
	
		case 'kindeditor4':
			ke4Editor[id].insertHtml(str);
			break;

		case 'ckeditor3': case 'ckeditor4':
			var ckObj = CKEDITOR.instances[id];
			ckObj.insertHtml(str);
			break;
	
		case 'fckeditor':
			var fckObj = FCKeditorAPI.GetInstance(id) ;
			fckObj.InsertHtml(str);
			break;

		case 'ueditor':
			var ueObj = UE.getEditor(id);
			ueObj.execCommand('insertHtml',str);
			break;
	}
}

// 插入【一键复制框】
function CopyStrToEditor(conId){
	var ret = prompt('一键复制框内容', '');
	if(ret !== null) {	//  && ret != '' 填入框 取消返回null，没填直接确定返回空字符
		InsertStrToEditor(conId,"[OT_copy]"+ ret +"[/OT_copy]");
	}
}