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

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了dedecms织梦富文本编辑器更换为kindeditor相关的知识,希望对你有一定的参考价值。

本站所有附件均为UTF-8版本,GBK版本的童学请自行转码。

最终效果

技术分享

 

首先,当然是先在kindeditor官方下载最新版本的kindeditor编辑器

目前最新版本是 KindEditor 4.1.10,下载解压,只要下面几个文件就行了,在你的dedecms程序include文件夹下,建个kindeditor文件夹,然后把解压出来的这几个文件放进去,最终结果是:

 

技术分享

 

2、增加kindeitor图片上传处理文件到 include/dialog

 

百度盘 密码: v9a5

技术分享

 

3、打开include/inc/inc_fun_funAdmin.php 这个是dedecms创建编辑器文件

找到

 

 

    else if($GLOBALS[‘cfg_html_editor‘]==‘ckeditor‘)
    {
中间代码省略...
    }

  在它们的下面加入

 

 

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;
	}
}

最后,后台-系统-系统基本参数-核心设置-Html编辑器 ,填写kindeditor

 

ps

■修复了已知问题session

■dedediy kineditor增加QQ图标

dedediy kineditor增加百度地图动态

以上是关于dedecms织梦富文本编辑器更换为kindeditor的主要内容,如果未能解决你的问题,请参考以下文章

织梦dedecms关于禁用词语太多显示不全问题

DEDECMS去除后门隐患和漏洞以及冗余代码的方法

dedecms织梦添加ueditor百度编辑器(支持本地图片水印)

织梦dedecms的文章内容页面如何使文章分页

dedecms织梦修改文章后如何不改变时间文章排序?

织梦(dedecms)后台如何设置网站关键词描述