kindeditor配置syntaxhighlighter...


kindeditor默认是prettify,我行号没弄出来,换了syntaxhighlighter,下面是配置的代码。。。
<!DOCTYPE html>
<html>
	<head>
		<meta http-equiv="Content-type" content="text/html; charset=utf-8">
		<title>kindeditor test</title>
		<style>
			body{
				font-family:"Microsoft YaHei";
			}
			
			#editor{
				word-wrap:break-word;
			}
			#ContentSubmit{
				width:80px;
				height:30px;
				background:#336633;
				border:0 solid #000000;
				cursor:pointer;
				color:#ffffff;
				font-size:15px;
				margin:10px 0;
			}
			#ContentSubmit:hover{
				background:#336666;
			}
			#editor-box{
				margin-left:auto;
				margin-right:auto;
				width:900px;
				height:200px;
				word-wrap:break-word;
			}
		</style>
		<!--加载sh插件-->
		<script src="./kindeditor/plugins/code/scripts/shCore.js"></script>
		<script src="./kindeditor/plugins/code/scripts/shBrushJScript.js"></script>
		<link rel="stylesheet" href="./kindeditor/plugins/code/styles/shThemeDefault.css"/>
		<link rel="stylesheet" href="./kindeditor/plugins/code/styles/shCore.css"/>
		<!--加载kindeditor-->
		<link rel="stylesheet" href="./kindeditor/themes/default/default.css" />
		<script charset="utf-8" src="./kindeditor/kindeditor-min.js"></script>
		<script charset="utf-8" src="./kindeditor/lang/zh_CN.js"></script>
		<script>
			var editor;
			KindEditor.ready(function(K) {
				editor = K.create('textarea[name="content"]', {
					width:'900px',
					resizeType : 1,
					allowPreviewEmoticons : false,
					allowImageUpload : true,
					allowFileManager : true,
					items : [
						'source','|',
						'bold','italic','underline','|',
						'fontname','fontsize','|',
						'code','|',
						'image','|',
						'link','media','|',
						'about'
					]
				});
				editor.sync();
			});
		</script>
	</head>
	<body>
		<h1>Hello SyntaxHighlighter</h1>
		<pre class="brush: js;">
			function helloSyntaxHighlighter()
			{
				return "hi!";
			}
		</pre>
		<div id="editor-box">
			<div style="display:block;word-break: break-all;word-wrap: break-word;">
				<?php
					echo $_POST["content"];
				?>
			</div>
			<form action="test2.php" method="POST">
				<textarea id="editor" name="content" style="width:900px;height:200px;visibility:hidden;overflow:hidden;"></textarea>
				<input type="submit" id="ContentSubmit" value="提交评论" />
			</form>
		</div>
		<!--script type="text/javascript">var a = function(){document.getElementById("editor").getElementByTagName("pre")[0].className="brush:js";};</script-->
		<script>
			SyntaxHighlighter.config.clipboardSwf = './kindeditor/plugins/code/scripts/clipboard.swf';
			SyntaxHighlighter.all();
		</script>
	</body>
</html>
路径根据自己的来了,值得一提的是刚开始虽然有行号了,但是没有换行,尝试了很多,无果,直接在打印的东西外边加div强制换行,也不知道这样好不好,
<pre class="brush: js;">
			function helloSyntaxHighlighter()
			{
				return "hi!";
			}
		</pre>
还有在ie里边的好多问题,不能复制。。。
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值