文本编辑器 CKEditor 用法
最新文本编辑器,FCK升级版:CKEditor.NET
CKEditor.NET.dll 版本:3.6.4.0
官方网址:http://ckeditor.com/
效果图:

配置web.config:
<system.web>
<pages>
<controls>
<add tagPrefix="CKEditor" assembly="CKEditor.NET" namespace="CKEditor.NET"/>
</controls>
</pages><system.web>
页面上加入标签:
<%@ Register Assembly="CKEditor.NET" Namespace="CKEditor.NET" TagPrefix="CKEditor" %>
在aspx页面插入控件:
<CKEditor:CKEditorControl ID="txtRemark" runat="server" BasePath="~/UserControl/ckeditor/" Toolbar="Source|Preview|Templates|Cut|Copy|Paste|Undo|Redo|Bold|Italic|Underline|Font|FontSize|TextColor|BGColor|Maximize" Width="388px" Height="150px" >
工具栏设置,如在js中加载了此控件,那设置的工具栏则无效,需在js中重新设置工具栏:
3种方式设置:
1、在页面中设置:设置Toolbar属性 以"|"分隔每个菜单,"-"添加一个分割符,"/"添加一个换行
Toolbar="Source|Preview|Templates|Cut|Copy|Paste|Undo|Redo|Bold|Italic|Underline|Font|FontSize|TextColor|BGColor|Maximize"
2、cs代码:在代码中加入(默认全部工具栏显示)
"-" 分隔符,"/" 换行符,新的new object[] 为一个分组
txtRemark.config.toolbar = new object[]
{
new object[] { "Source", "-", "Preview", "-", "Templates" },
new object[] { "Cut", "Copy", "Paste", "PasteText", "PasteFromWord", "-", "Print", "SpellChecker", "Scayt" },
new object[] { "Undo", "Redo", "-", "Find", "Replace", "-", "SelectAll", "RemoveFormat" },
new object[] { "Form", "Checkbox", "Radio", "TextField", "Textarea", "Select", "Button", "ImageButton", "HiddenField" },
"/",
new object[] { "Bold", "Italic", "Underline", "-", "Subscript", "Superscript" },
new object[] { "NumberedList", "BulletedList", "-", "Outdent", "Indent"},
new object[] { "JustifyLeft", "JustifyCenter", "JustifyRight", "JustifyBlock" },
new object[] { "Link", "Unlink", "Anchor" },
new object[] { "Image", "Flash", "Table", "HorizontalRule", "Smiley", "SpecialChar", "PageBreak", "Iframe" },
"/",
new object[] { "Styles", "Format", "Font", "FontSize" },
new object[] { "TextColor", "BGColor" },
new object[] { "Maximize" }
}
3、JS中设置:调用加载编辑器控件 (若使用此方法,在页面或代码中设置的工具栏则无效,如不需js调用控件可采用第1种方法)
$(
function ()
{
CKEDITOR.replace('txtRemark', {
toolbar : //重设工具栏
[['Source', 'Preview',],
['Bold', 'Italic', 'Underline'],
['Outdent', 'Indent'],
['JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock'],
['Link', 'Unlink'],
'/',
['Font', 'FontSize'],
['TextColor', 'BGColor','-','Maximize']
]
}); //编辑器}
);
js取值和赋值:
赋值:CKEDITOR.instances.txtRemark.setData("值");
取值:var obj = CKEDITOR.instances.txtRemark.getData();
cs代码中获取值:
txtRemark.Text
文本编辑器 CKEditor 用法的更多相关文章
- MVC5富文本编辑器CKEditor配置CKFinder
富文本编辑器CKEditor的使用 *:first-child { margin-top: 0 !important; } body>*:last-child { margin-bottom: ...
- Django实现的博客系统中使用富文本编辑器ckeditor
操作系统为OS X 10.9.2,Django为1.6.5. 1.下载和安装 1.1 安装 ckeditor 下载地址 https://github.com/shaunsephton/django-c ...
- 富文本编辑器 CKeditor 配置使用+上传图片
参考文献: 富文本编辑器 CKeditor 配置使用 CKEditor与CKFinder的配置(ASP.NET环境),老版本可以参考 CKEditor+CKFinder ASP版在本地电脑中的配置 ...
- 富文本编辑器CKEDITOR的使用配置(问题注解)
CKEDITOR是一款非常轻便的富文本编辑器,如上图:参考网上的使用方法,我以.net为例,在aspx页面使用, 准备工作:首先要下载控件包,将解压后的整个文件夹添加到项目根目录. 第一步:引用js, ...
- 富文本编辑器ckeditor继承
新建一个web项目ckfinder,导入lib包 加入java包,编码格式UTF-8 在WebRoot下添加ckedtior以及ckfinder两个文件夹,将config.xml拷入WEB-INF中 ...
- 富文本编辑器CKEditor的使用
由于最近在架构一个pc端b/s结构的项目,项目中有个论坛模块,当用户发帖时,需要用到富文本编辑器,考虑了一下,决定使用CKEditor富文本编辑器,虽然现在问世的富文本编辑器很丰富,比如还有百度的UE ...
- 富文本编辑器 CKeditor 配置使用 (带附件)
Ckeditor下载地址:http://ckeditor.com/download 1.CKeditor的基本配置 var textval=CKEDITOR.instances.TextArea1.g ...
- 富文本编辑器 CKeditor 配置使用
作者:Tyler Ning出处:http://www.cnblogs.com/tylerdonet/本文版权归作者和博客园共有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连 ...
- Vim文本编辑器详细用法
1 Vi.Vim文本编辑器 1.Vi.Vim Vi是Visual interface的简称. Vim是Vi的增强版,即Vi Improved.在后面的实例中将介绍Vim的使用. 为什么学vi? 1)所 ...
随机推荐
- 浅谈break 、continue、return,goto四种语句的区别。
浅谈break .continue.return三种语句的区别: break,continue,return这三个具有跳转功能的语句在c语言中经常被用到,近期身边有些小伙伴总是把它们的用法搞乱,在这里 ...
- c语言数组不同初始化方式的结果
第一种初始化方式: #include <stdio.h> int main() { int numbers[5]={12,14}; for (int i=0; i<5; i++) { ...
- html-----010
22 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.o ...
- c# web页面乱码
1.在web.config中加入:<globalization requestEncoding="GB2312" responseEncoding="GB2312& ...
- time.h文件中包含的几个函数使用时须注意事项
time.h头文件中包含以下函数 char* asctime(const struct tm *tm); char* asctime_r(const struct tm *tm,char *buf); ...
- [翻译][MVC 5 + EF 6] 3:排序、过滤、分页
原文:Sorting, Filtering, and Paging with the Entity Framework in an ASP.NET MVC Application 1.添加排序: 1. ...
- NPOI2.0
今天在使用NPOI2.0读取上传excel文件(excel2010)时,报了一个很奇怪的错误:无效的 URI: 未能分析主机名. 在网上查找了下找到的出错情况跟这个完全不着边际,没有办法只有自己去测试 ...
- HTML5学习笔记----html5与传统html区别
一. HTML5语法的改变 该知识点所说变化指的是基于HTML4基础上所定义的改变,主要有如下: HTML5的文件扩展符(.html或.htm)与内容类型(text/html)保持不变. HTML5中 ...
- thinkphp给图片打水印不清晰
项目中打印条形码的函数,从thinkphp自带的water函数修改而来的. 贴上代码: /** * water2 * 改写thinkphp的water函数更强健的函数,增加了写入位置参数 去掉了alp ...
- 基于 Redis 数据累计的实现
需求:对上传文件进行统一编号,以 xxx-YYYYmmdd-000001为编码格式,其中YYYYmmdd为当天传的日期. 技术方案:redis,get,set,incr,expireAt即可实现. p ...