DedeCms织梦二次开发网-Dede织梦工场-DedeCms教程-Dede二次开发-DedeCms二次开发-Dede模块开发-Dede插件开发-Dede标签开发DedeCms织梦二次开发网

DedeCms织梦富文本编辑器ckeditor更换为kindeditor富文本

摘要:DedeCms织梦富文本编辑器ckeditor更换为kindeditor,修复了已知session问题

最终效果

DedeCms织梦富文本编辑器ckeditor更换为kindeditor富文本

在kindeditor基础上添加了如下功能

1、qq客服快速添加

2、ckplayer播放器,支持本地flv,mp4

3、动态百度地图

kindeditor织梦版(gbk/utf8)打包下载

云盘下载   密码: p9zy

下载解压,选择对应的编码版本,把include文件夹上传到网站根目录

最后给dedecms添加kindeditor编辑器调用代码

dedecms utf8编码程序的

打开 include/inc/inc_fun_funAdmin.php 找到

 else { 
        /*
        // ------------------------------------------------------------------------
        // 当前版本,暂时取消dedehtml编辑器的支持
在它的上面加入
else if($GLOBALS['cfg_html_editor']=='kindeditor')
{
	$fvalue =htmlspecialchars($fvalue);
	$uploadJson = $GLOBALS['cfg_cmspath']."/include/dialog/kindeditor_post.php";
	$fileManagerJson = $GLOBALS['cfg_cmspath']."/include/dialog/kindeditor_manager.php";
	$allowFileManager = 'true';
	$extendconfig = '';
	if($etype == 'Member' || $etype == 'MemberLit' || $etype == 'Diy' || $etype == 'Feedback')
	{
		$uploadJson = "";
		$fileManagerJson = "";
		$allowFileManager = 'false';
		$extendconfig = 'allowImageUpload : false,';
		$extendconfig .= 'allowFlashUpload : false,';
		$extendconfig .= 'allowMediaUpload : false,';
		$extendconfig .= 'allowFileUpload : false,';
	}
	
	$items['Member'] = "[
	'source', '|', 'undo', 'redo', '|', 'preview', 'print', 'template', 'cut', 'copy', 'paste',
	'plainpaste', 'wordpaste', '|', 'justifyleft', 'justifycenter', 'justifyright',
	'justifyfull', 'insertorderedlist', 'insertunorderedlist', 'indent', 'outdent', 'subscript',
	'superscript', 'clearhtml', 'quickformat', 'selectall', '|', 'fullscreen', '/',
	'formatblock', 'fontname', 'fontsize', '|', 'forecolor', 'hilitecolor', 'bold',
	'italic', 'underline', 'strikethrough', 'lineheight', 'removeformat', '|', 'image',
	'flash', 'media', 'insertfile', 'table', 'hr', 'emoticons', 'map', 'pagebreak',
	'link', 'unlink', '|', 'about']";
	
	$items['Small'] = $items['MemberLit'] = $items['Diy'] = "[
	'fontname', 'fontsize', '|', 'forecolor', 'hilitecolor', 'bold', 'italic', 'underline',
	'removeformat', '|', 'justifyleft', 'justifycenter', 'justifyright', 'insertorderedlist',
	'insertunorderedlist', '|', 'emoticons', 'image', 'link']";
	
	$items['Feedback']= "[
	'fontname', 'fontsize', '|', 'forecolor', 'hilitecolor', 'bold', 'italic', 'underline',
	'removeformat', '|', 'justifyleft', 'justifycenter', 'justifyright', 'insertorderedlist',
	'insertunorderedlist', '|', 'emoticons']";
	
	$itemconfig = '';
	if(isset($items[$etype]))
	{
		$itemconfig = "items :{$items[$etype]},";
	}
$session_id = session_id();
$code = <<<HTML
<link rel="stylesheet" href="{$GLOBALS['cfg_cmspath']}/include/kindeditor/themes/default/default.css" />
<link rel="stylesheet" href="{$GLOBALS['cfg_cmspath']}/include/kindeditor/plugins/code/prettify.css" />
<script src="{$GLOBALS['cfg_cmspath']}/include/kindeditor/kindeditor-min.js"></script>
<script src="{$GLOBALS['cfg_cmspath']}/include/kindeditor/lang/zh_CN.js"></script>
<script src="{$GLOBALS['cfg_cmspath']}/include/kindeditor/plugins/code/prettify.js"></script>
<script type="text/javascript">
	KindEditor.ready(function(K) {
		var editor1 = K.create('textarea[name="{$fname}"]', {
			cssPath : '{$GLOBALS['cfg_cmspath']}/include/kindeditor/plugins/code/prettify.css',
			uploadJson : '$uploadJson',
			fileManagerJson : '$fileManagerJson',
			filterMode: false,//是否开启过滤模式
			extraFileUploadParams: {
				PHPSESSID : '{$session_id}'
			},
			$extendconfig
			$itemconfig
			allowFileManager : {$allowFileManager},
			afterBlur: function(){this.sync();} 
		});
		prettyPrint();
	});
</script>
<textarea name="{$fname}" style="height:{$nheight}px;visibility:hidden;width: 100%;">{$fvalue}</textarea>
HTML;
	if($gtype=="print")
	{
		echo $code;
	}
	else
	{
		return $code;
	}
}

dedecms gbk编码程序的

打开 include/inc/inc_fun_funAdmin.php 找到

 else { 
        /*
        // ------------------------------------------------------------------------
        // 当前版本,暂时取消dedehtml编辑器的支持
在它的上面加入
else if($GLOBALS['cfg_html_editor']=='kindeditor')
{
	$fvalue =htmlspecialchars($fvalue);
	$uploadJson = $GLOBALS['cfg_cmspath']."/include/dialog/kindeditor_post.php";
	$fileManagerJson = $GLOBALS['cfg_cmspath']."/include/dialog/kindeditor_manager.php";
	$allowFileManager = 'true';
	$extendconfig = '';
	if($etype == 'Member' || $etype == 'MemberLit' || $etype == 'Diy' || $etype == 'Feedback')
	{
		$uploadJson = "";
		$fileManagerJson = "";
		$allowFileManager = 'false';
		$extendconfig = 'allowImageUpload : false,';
		$extendconfig .= 'allowFlashUpload : false,';
		$extendconfig .= 'allowMediaUpload : false,';
		$extendconfig .= 'allowFileUpload : false,';
	}
	
	$items['Member'] = "[
	'source', '|', 'undo', 'redo', '|', 'preview', 'print', 'template', 'cut', 'copy', 'paste',
	'plainpaste', 'wordpaste', '|', 'justifyleft', 'justifycenter', 'justifyright',
	'justifyfull', 'insertorderedlist', 'insertunorderedlist', 'indent', 'outdent', 'subscript',
	'superscript', 'clearhtml', 'quickformat', 'selectall', '|', 'fullscreen', '/',
	'formatblock', 'fontname', 'fontsize', '|', 'forecolor', 'hilitecolor', 'bold',
	'italic', 'underline', 'strikethrough', 'lineheight', 'removeformat', '|', 'image',
	'flash', 'media', 'insertfile', 'table', 'hr', 'emoticons', 'map', 'pagebreak',
	'link', 'unlink', '|', 'about']";
	
	$items['Small'] = $items['MemberLit'] = $items['Diy'] = "[
	'fontname', 'fontsize', '|', 'forecolor', 'hilitecolor', 'bold', 'italic', 'underline',
	'removeformat', '|', 'justifyleft', 'justifycenter', 'justifyright', 'insertorderedlist',
	'insertunorderedlist', '|', 'emoticons', 'image', 'link']";
	
	$items['Feedback']= "[
	'fontname', 'fontsize', '|', 'forecolor', 'hilitecolor', 'bold', 'italic', 'underline',
	'removeformat', '|', 'justifyleft', 'justifycenter', 'justifyright', 'insertorderedlist',
	'insertunorderedlist', '|', 'emoticons']";
	
	$itemconfig = '';
	if(isset($items[$etype]))
	{
		$itemconfig = "items :{$items[$etype]},";
	}
$session_id = session_id();
$code = <<<HTML
<link rel="stylesheet" href="{$GLOBALS['cfg_cmspath']}/include/kindeditor/themes/default/default.css" />
<link rel="stylesheet" href="{$GLOBALS['cfg_cmspath']}/include/kindeditor/plugins/code/prettify.css" />
<script src="{$GLOBALS['cfg_cmspath']}/include/kindeditor/kindeditor-min.js" charset="gb2312"></script>
<script src="{$GLOBALS['cfg_cmspath']}/include/kindeditor/lang/zh_CN.js" charset="gb2312"></script>
<script src="{$GLOBALS['cfg_cmspath']}/include/kindeditor/plugins/code/prettify.js" charset="gb2312"></script>
<script type="text/javascript">
	KindEditor.ready(function(K) {
		var editor1 = K.create('textarea[name="{$fname}"]', {
			cssPath : '{$GLOBALS['cfg_cmspath']}/include/kindeditor/plugins/code/prettify.css',
			uploadJson : '$uploadJson',
			fileManagerJson : '$fileManagerJson',
			filterMode: false,//是否开启过滤模式
			extraFileUploadParams: {
				PHPSESSID : '{$session_id}'
			},
			$extendconfig
			$itemconfig
			allowFileManager : {$allowFileManager},
			afterBlur: function(){this.sync();} 
		});
		prettyPrint();
	});
</script>
<textarea name="{$fname}" style="height:{$nheight}px;visibility:hidden;width: 100%;">{$fvalue}</textarea>
HTML;
	if($gtype=="print")
	{
		echo $code;
	}
	else
	{
		return $code;
	}
}

最后

后台-系统-系统基本参数-核心设置-Html编辑器 ,填写kindeditor
更新缓存,刷新后台,完成。

DedeCMS织梦工场QQ群

群号(23871657) DedeCMS织梦工场
只适用于讨论dedecms二次开发相关话题,其他闲聊、广告、斗图、捣乱请自重自觉,谢谢合作!

不忘初心 、方得始终

DedeCMS织梦工场 - 致力于把最实用的DedeCms二次开发教程,DedeCms二次开发视频,DedeCms二次开发实例经验,分享给最需要的站长,希望每一位来访的站长都能有所收获!

如果您认为本网站的内容质量不错或者读后成功解决你心中的难题,觉得收获很大,那么不妨小额赞助一下,让我们有动力继续写出高质量的教程与更棒的程序教程。打赏记录

赞助方式

donate_zhifubao 支付宝手机客户端扫描上面的二维码进行赞助

donate_weixin 微信手机客户端扫描上面的二维码进行赞助

来源:DedeCms织梦工场 » DedeCms织梦富文本编辑器ckeditor更换为kindeditor富文本
据说喜欢分享的,后来都成了大神: 更多