≡
  • 网络编程
  • 数据库
  • CMS技巧
  • 软件编程
  • PHP笔记
  • JavaScript
  • MySQL
位置:首页 > 网络编程 > HTML

CKEditor 4.x 部署和配置示例

人气:1329 时间:2018-10-26

这篇文章主要为大家详细介绍了CKEditor 4.x 部署和配置示例,具有一定的参考价值,可以用来参考一下。

感兴趣的小伙伴,下面一起跟随四海网的小编两巴掌来看看吧!

把下载下来的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';
};

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

本文来自:http://www.q1010.com/175/2688-0.html

注:关于CKEditor 4.x 部署和配置示例的内容就先介绍到这里,更多相关文章的可以留意四海网的其他信息。

关键词:CKEditor

您可能感兴趣的文章

  • php fckeditor上传文件,并按日期存放及重命名
上一篇:HTML meta作用解析
下一篇:html 超链接通过post方式提交表单的简单示例
热门文章
  • HTML5 文本内容显示三行,多余部分显示...,点击全部展开
  • HTML,CSS,font-family:中文字体和英文名称对照表
  • html 回到顶部的完整代码
  • 百度编辑器ueditor自动排版首行缩进四个字符实现方法
  • HTML 为元素添加一些透明度的简单方法
  • HTML/CSS 实现div居中、div内部元素垂直居中的简单示例
  • HTML 在textarea中选择文本的实现方法
  • CSS分页符示例
  • 【推荐】DIV+CSS入门菜鸟教程
  • HTML 点击超链接在iframe框架显示的实现方法
  • 最新文章
    • css实现移动端禁止手机长按图片弹出保存图片
    • 鼠标拖动DIV元素的实现方法
    • html 标签随机变色大小的简单示例
    • HTML 在textarea中选择文本的实现方法
    • CSS分页符示例
    • HTML 为元素添加一些透明度的简单方法
    • html 回到顶部的完整代码
    • HTML5 文本内容显示三行,多余部分显示...,点击全部展开
    • HTML/CSS 实现div居中、div内部元素垂直居中的简单示例
    • HTML,CSS,font-family:中文字体和英文名称对照表

四海网收集整理一些常用的php代码,JS代码,数据库mysql等技术文章。