<!doctype html>
<html>
<head>
  <meta charset="utf-8" />
  <meta name="viewport" content="width=device-width" />
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  <meta name="renderer" content="webkit"> 
  <title>编辑html元素</title>
  <link type="text/css" rel="Stylesheet" href="/admin/drag/css/drag.base.css">
  <link type="text/css" rel="Stylesheet" href="/admin/drag/css/kesion.form.css">
  <link type="text/css" rel="Stylesheet" href="/admin/drag/fonts/iconfont.css">
  <script src="/KS_inc/jquery.js"></script>
  <style>
  	#edui1_toolbarboxouter{ background:#fafafa; box-shadow:0px 0px 0px;}
	.edui-editor{border:0px !important;}
	#edui1_bottombar{ display:none;}
	body{border-top:1px solid #ebebeb;}
  </style>    
  
</head>
<body>
   
    <div class="setContentBox">
         <textarea id="Content" name="content"></textarea>
        <%Kesion.APPCode.EditorAPI.EchoHead(); %>
        <%Kesion.APPCode.EditorAPI.EchoEditor("editor", "Content", "Drag" );%>
	</div>
    <div class="ks-btn-center" style="border-top:1px solid #ebebeb;padding:20px 0">
        
       <button class="ks-btn ks-btn-normal" onClick="Determine()" id="determine"></button>
       &nbsp;
       <button class="ks-btn" onClick="parent.closeWindow(window.name)">取消</button>
    </div>
   
	<script>
		
		var type = location.href.split('type=')[1];
		if(type=='edit'){
			$('#determine').html('保存');
		}else{
			$('#determine').html('确定');
		};

		contentHeight();
					
		$(window).resize(function(){
			contentHeight();
		});
		
		function contentHeight(){
			var heightResult = $(window).height()-$('.ks-btn-center').outerHeight()-56;
			$('#Content').height(heightResult)
			
		};
				
		//检测编辑器是否加载完成
		var texting = setInterval(e,100);
		function e(){
			if(editor){
				//编辑状态
				if(type=='edit'){
					$('#save').show();
					$('#add').hide();
					var htmlContent = parent.htmlContent;
					editor.setContent(htmlContent);
					
				};
				clearInterval(texting);
				
			};
		};
		
		//返回结果
		function Determine(){
			var result = editor.getContent();
			parent.closeWindow(window.name);
			parent.closeModuleBg();
			if(type=='edit'){
				parent.ModuleBack(result,'editHtml');
				parent.popup.tips({
					  title:'修改成功',
				});
			}else{
				parent.ModuleBack(result,'html');
				parent.popup.tips({
					  title:'添加成功',
				});
			}
		};
	

    </script>


</body>
</html>