主题: easy ui中panel Ajax请求界面内的KindEditor无法被加载
作者: 可乐, 发布日期: 2014-10-06 12:29:10, 浏览数: 2131

在单独页面打开时能被渲染,但ajax请求过来就无法被渲染。不知道是ajax下路径问题,还是什么情况。求解

ajax请求过来的代码:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="http://localhost:8080/QMS/">
<link rel="stylesheet" href="kindeditor-4.1/themes/default/default.css" />
<script type="text/javascript" src="kindeditor-4.1/kindeditor.js"></script>
<script type="text/javascript" src="kindeditor-4.1/lang/zh_CN.js"></script>
<script type="text/javascript">
	KindEditor.ready(function(K) {
		var editor = K.create('textarea[id="context"]', {

			cssPath : '/QMS/kindeditor-4.1/plugins/code/prettify.css',
			
			uploadJson : '/QMS/servlet/UploadSerlet',
			
			fileManagerJson : '/QMS/servlet/FileManagerServlet',

			allowFileManager : true,

			resizeType : 0,

			width : "100%",

			height : "300px",

			items : [ 'source', '|', 'undo', 'redo', '|', 'preview', 'print',
					'template', 'code', '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', 'multiimage', 'flash', 'media', 'table',
					'hr', 'emoticons', 'baidumap', 'pagebreak', 'anchor',
					'link', 'unlink', '|', 'about' ],

			afterCreate : function() {

				var self = this;

				$("#example").on("submit", function() {
					self.sync();
				});

				K.ctrl(document, 13, function() {

					self.sync();

					document.forms['example'].submit();

				});

				K.ctrl(self.edit.doc, 13, function() {

					self.sync();

					document.forms['example'].submit();

				});

			}

		});
	});
</script>

源码:

<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">
<link rel="stylesheet" href="kindeditor-4.1/themes/default/default.css" />
<script type="text/javascript" src="kindeditor-4.1/kindeditor.js"></script>
<script type="text/javascript" src="kindeditor-4.1/lang/zh_CN.js"></script>
<script type="text/javascript">
	KindEditor.ready(function(K) {
		var editor = K.create('textarea[id="context"]', {

			cssPath : '<%=path%>/kindeditor-4.1/plugins/code/prettify.css',
			
			uploadJson : '<%=path%>/servlet/UploadSerlet',
			
			fileManagerJson : '<%=path%>/servlet/FileManagerServlet',

			allowFileManager : true,

			resizeType : 0,

			width : "100%",

			height : "300px",

			items : [ 'source', '|', 'undo', 'redo', '|', 'preview', 'print',
					'template', 'code', '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', 'multiimage', 'flash', 'media', 'table',
					'hr', 'emoticons', 'baidumap', 'pagebreak', 'anchor',
					'link', 'unlink', '|', 'about' ],

			afterCreate : function() {

				var self = this;

				$("#example").on("submit", function() {
					self.sync();
				});

				K.ctrl(document, 13, function() {

					self.sync();

					document.forms['example'].submit();

				});

				K.ctrl(self.edit.doc, 13, function() {

					self.sync();

					document.forms['example'].submit();

				});

			}

		});
	});
</script>

发表新帖 发表回复