欢迎来到资源库(www.zyku.net)

HTML/Xhtml

当前位置:首页 > 网页制作 > HTML/Xhtml > CKEditor4

CKEditor 4.x 部署和配置方法

时间:2015-12-16|栏目:HTML/Xhtml|点击:|我要投稿

把下载下来的CKEditor解压到自己设定的网站目录下,一定要注意调用的路径问题!

在html的head中引入以下文件:

<script type="text/javascript" src="ckeditor/ckeditor.js"></script>
<script type="text/javascript" src="ckeditor/config.js"></script>

有以下几种方法可实现CKEditor编辑器的调用:

一:通过设置class样式

<textarea class="ckeditor" name="editor1"></textarea>

二:使用JS代码

$(document).ready(function(){
CKEDITOR.replace('entity_content'); //entity_content为textarea元素ID
});

三:使用jquery

使用jquery之前一定要先引入jquery文件,另外还要引入ckeditor/adapters下的一个jquery.js(两者不一样,务必要引入)

$(document).ready(function(){
$('textarea#editor1').ckeditor();
});

另外配置config.js可以满足自己的项目需求。

CKEDITOR.editorConfig = function( config ) {
// Define changes to default configuration here.
// For the complete reference:
// http://docs.ckeditor.com/#!/api/CKEDITOR.config
// The toolbar groups arrangement, optimized for a single toolbar row.
config.toolbarGroups = [
{ name: 'document',groups: [ 'mode', 'document', 'doctools' ] },
{ name: 'clipboard',groups: [ 'clipboard', 'undo' ] },
{ name: 'editing',groups: [ 'find', 'selection', 'spellchecker' ] },
{ name: 'forms' },
{ name: 'basicstyles', groups: [ 'basicstyles', 'cleanup' ] },
{ name: 'paragraph',groups: [ 'list', 'indent', 'blocks', 'align', 'bidi' ] },
{ name: 'links' },
{ name: 'insert' },
{ name: 'styles' },
{ name: 'colors' },
{ name: 'tools' },
{ name: 'others' },
{ name: 'about' }
];
// The default plugins included in the basic setup define some buttons that
// we don't want too have in a basic editor. We remove them here.
config.removeButtons = 'Cut,Copy,Paste,Undo,Redo,Anchor,Underline,Strike,Subscript,Superscript';
// Let's have it basic on dialogs as well.
config.removeDialogTabs = 'link:advanced';
};

根据需要具体配置请查阅其他资料。

(资源库 www.zyku.net)

上一篇:pre 标签内容自动换行的方法

栏    目:HTML/Xhtml

下一篇:HTML网页特殊符号代码大全

本文标题:CKEditor 4.x 部署和配置方法

本文地址:https://www.zyku.net/xhtml/75.html

关于我们 | 版权申明 | 寻求合作 |

重要申明:本站所有的文章、图片、评论等内容,均由网友发表或上传并维护或收集自网络,仅供个人学习交流使用,版权归原作者所有。

如有侵犯您的版权,请与我们联系,我们将在24小时内进行处理、任何非本站因素导致的法律后果,本站均不负任何责任。

联系QQ:95148658 | 邮箱:mb8#qq.com(#换成@)

苏ICP备2020066115号-1

本网站由提供CDN加速/云存储服务