在网站开发中难免会用到富文本编辑器,本文将介绍一款富文本编辑器(在线HTML编辑器) Rich Text Editor ,简要说明一下其在MVC中的使用。

具体使用情况和下载地址请参考:http://www.richtexteditor.com/

一、准备工作

1.在上述网站中下载此编辑器的开发包,解压后会发现有几个文件夹,如图:

我使用的是Asp.Net MVC4 版本,开发是c#,请大家选择适合自己的开发包。

2.进入该文件(mvc4_cs_razor),把 richtexteditor 开发包文件夹复制到你的项目根目录下,并复制 bin 目录下的几个dll文件至你的项目bin文件夹下,如图:

复制后,项目下就有了这些文件,如图:

3. 添加对该编辑器DLL的引用(两个DLL:NetSpell.SpellChecker.dll 和 RichTextEditor.dll),如图:

4.修改配置文件:

IIS5,IIS6,IIS7 经典模式使用如下配置信息

<configuration>
<system.web>
<httpModules>
<add name="UploadModule" type="RTE.UploadModule,RichTextEditor"/>
</httpModules>
</system.web>
</configuration>

IIS7 集成模式使用如下配置信息

<configuration>
<system.webServer>
<modules>
<add name="UploadModule" type="RTE.UploadModule,RichTextEditor"/>
</modules>
</system.webServer>
</configuration>
二、在代码中如何使用

做完上述准备工作后,就开始在代码中使用了

1.发布新闻时

[CheckLoginAttributer]
public ActionResult Create()
{
Editor Editor1 = new Editor(System.Web.HttpContext.Current, "Content");
Editor1.MvcInit();
ViewBag.Editor = Editor1.MvcGetString(); return View();
}

图解:

2.编辑新闻时,新闻内容是怎么赋值的呢?

//
// GET: /News/Edit/5
[CheckLoginAttributer]
public ActionResult Edit(Guid id)
{
News news = db.News.Find(id);
if (news == null)
{
return HttpNotFound();
} Editor Editor1 = new Editor(System.Web.HttpContext.Current, "Content");
Editor1.Text = news.Content;
Editor1.MvcInit();
ViewBag.Editor = Editor1.MvcGetString(); return View(news);
}

图解:

Rich Text Editor for MVC的更多相关文章

  1. web & Rich Text Editor

    web & Rich Text Editor 富文本编辑器 http://www.wangeditor.com/ https://github.com/wangfupeng1988/wangE ...

  2. DevExpress ASP.NET Core v19.1版本亮点:Rich Text Editor

    行业领先的.NET界面控件DevExpress 发布了v19.1版本,本文将以系列文章的方式为大家介绍DevExpress ASP.NET Core Controls v19.1中新增的一些控件及增强 ...

  3. CKEditor 4 & markdown & rich text editor

    CKEditor 4 ckeditor 4 http://ckeditor.com

  4. NicEdit - WYSIWYG Content Editor, Inline Rich Text Application

    NicEdit - WYSIWYG Content Editor, Inline Rich Text Application By calling the nicEditors.allTextarea ...

  5. selenium处理rich text(富文本框)

    WordPress 的 rich  text 采用js,先让selenium切换到iframe中 driver.switchTo().frame("content_ifr"); 然 ...

  6. CHtmlEditCtrl (2): Add a Source Text Editor to Your HTML Editor

    In a previous article, I described how to create an HTML editor using the MFC CHtmlEditCtrl class in ...

  7. 【转】(八)unity4.6Ugui中文教程文档-------概要-UGUI Rich Text

    原创至上,移步请戳:(八)unity4.6Ugui中文教程文档-------概要-UGUI Rich Text 7.Rich Text UI元素和文本网格的文本可以合并多个字体样式和大小.对 UI系统 ...

  8. Selenium Webdriver——JS处理rich text(富文本框)

    126邮件正文邮件的rich text 先让selenium切换到iframe中 driver.switchTo().frame(driver.findElement(By.className(&qu ...

  9. (八)unity4.6Ugui中文教程文档-------概要-UGUI Rich Text

    大家好,我是孙广东. 转载请注明出处:http://write.blog.csdn.net/postedit/38922399 更全的内容请看我的游戏蛮牛地址:mod=guide&view ...

随机推荐

  1. HTTP协议的URI及各种方法

    每个Web服务器资源都有一个名字,这样客户端就可以说明他们感兴趣的资源是什么了,服务器资 源名被统称为:统一资源标识符(Uniform Resource Identifier, URI) Joe的五金 ...

  2. Sublime Text生成html标签快捷键

    Emmet Documentation Syntax   Child: > nav>ul>li <nav> <ul> <li></li> ...

  3. USB设备---URB请求快

    1.urb 结构体USB 请求块(USB request block,urb)是USB 设备驱动中用来描述与USB 设备通信所用的基本载体和核心数据结构,非常类似于网络设备驱动中的sk_buff 结构 ...

  4. hdu 4613 Points<计算几何>

    链接:http://acm.hdu.edu.cn/showproblem.php?pid=4613 题意: 判断一个集合中的点能不能由另一个集合中的点,通过平移,旋转,放缩得到~ 思路:先求出集合中的 ...

  5. 为了android sdk下载,必须修改hosts

    #Download 下载 203.208.46.146 dl.google.com 203.208.46.146 dl-ssl.google.com #Groups 203.208.46.146 gr ...

  6. Python input()

    在Python语言中,我们经常需要与用户实现交互,下面是一个小实例 # -*- coding:UTF-8 -*- #获取输入参数,并将输入的值存储到txt文件中 String1 = input(&qu ...

  7. umask设置导致的weblogic中的应用上传的文件没有权限打开

    去年,在公司的某一weblogic上部署的web应用上传文件后却没有读的权限.因为weblogic在Linux上部署,上传文件是mount到了一台安装了NFS的Windows Server上. 当时本 ...

  8. TextSwitcher,译为文字转换器控件

    ViewSwitcher仅仅包含子类型TextView.TextSwitcher被用来使屏幕上的label产生动画效果.每当setText(CharSequence)被调用时,TextSwitcher ...

  9. android几种定时器机制及区别

    在android中,经常用到的定时器主要有以下几种实现:一.采用Handler与线程的sleep(long )方法二.采用Handler的postDelayed(Runnable, long) 方法三 ...

  10. squid基础配置

    1 2 3 4 5 6 7 8 9 10 vim /etc/squid/squid.conf    http_port 192.168.1.12:3128 (可写多个) cache_mem 64MB  ...