开发中先用的是 FCKeditor 编辑器,感觉页面展示的东西太繁琐,所以换了 TinyMCE 编辑器。 为了方便理解,本文不采用穿插比对

    

    先看 FCKeditor :

    1、jsp :结束标签不能贴着开始标签

  <fck:editor id="content" basePath="${ctx}/scripts/fckeditor/" skinPath="skins/office2003/">
</fck:editor>

    

    2、js 取值、赋值

//取值 - id
var oEditor = FCKeditorAPI.GetInstance("content");
var content = $.trim(oEditor.GetXHTML(true)); //赋值 - id
var oEditor = FCKeditorAPI.GetInstance("content") ;
oEditor.SetHTML("值") ;

    

    3、页面

    再看 TinyMCE:

    1、tinyMCE 在页面需要初始化

      tinymce.init({
selector: "textarea",  //填充 textarea 标签
upload_image_url: '${ctx}/uploadTinyMcePic', //配置的上传图片的路由(servlet 配置)
height: 300,
language:'zh_CN',
plugins: [
'advlist autolink lists link charmap print preview hr anchor pagebreak',
'searchreplace wordcount visualblocks visualchars code fullscreen',
'insertdatetime media nonbreaking save table contextmenu directionality',
'emoticons template paste textcolor colorpicker textpattern imagetools codesample toc help uploadimage fontselect'
],
toolbar1: 'undo redo | insert | styleselect | bold italic underline strikethrough | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | link image',
toolbar2: 'print preview media uploadimage | removeformat fontselect forecolor backcolor fontsizeselect emoticons | codesample help',
image_advtab: true,
templates: [
{ title: 'Test template 1', content: 'Test 1' },
{ title: 'Test template 2', content: 'Test 2' }
],
menubar: false
});

    PS:当页面有多个textarea 标签是,需要填充指定标签则 将 selector: "textarea" 改为:

mode : "exact",//用特定的模式
elements : "textareaEdit",//容器的id值,将来要在页面中替换的 textarea

    2、TinyMCE 取值、赋值:

//取值
var content = tinyMCE.activeEditor.getContent(); //赋值 - id
tinyMCE.get("content").setContent("值");

    3、页面

由上可知:

  FCKeditor:配置简单,但界面繁杂,取值赋值相对复杂。

  TinyMCE: 每个页面都要初始化相对复杂,但界面简洁,取值赋值相对简单。

主流页面编辑器比对:TinyMCE VS FCKeditor的更多相关文章

  1. 最新主流 Markdown 编辑器推荐

    Markdown ,2004年由 John Gruberis 设计和开发,是一种可以使用普通文本编辑器编写的标记语言,通过简单的标记语法,它可以使普通文本内容具有一定的格式,以下将介绍目前比较流行的一 ...

  2. 移动端H5页面编辑器开发实战--原理结构篇

    很久前的写的文章了,转载下发到这里 原文地址: https://blog.csdn.net/tech_meizu/article/details/52288797

  3. 移动端H5页面编辑器开发实战--经验技巧篇

    很久前的写的文章了,转载下发到这里 原本地址: https://blog.csdn.net/tech_meizu/article/details/52484775

  4. 常用的富文本框插件FreeTextBox、CuteEditor、CKEditor、FCKEditor、TinyMCE、KindEditor ;和CKEditor实例

    http://www.cnblogs.com/cxd4321/archive/2013/01/30/2883078.html 目前市面上用的比较多的富文本编辑器有: FreeTextBox 一个有很多 ...

  5. FCKeditor文本编辑器的使用方法

    FCKeditor是一个功能强大支持所见即所得功能的文本编辑器,可以为用户提供微软office软件一样的在线文档编辑服务. 它不需要安装任何形式的客户端,兼容绝大多数主流浏览器,支持ASP.Net.A ...

  6. 在线富文本编辑器FckEditor配置(.Net Framework 3.5)

    进入FCKeditor文件夹,编辑 fckconfig.js 文件.1.上传设置  .  var _FileBrowserLanguage         = 'php' ;         // a ...

  7. Flask博客开发——Tinymce编辑器

    之前Flask博客的文本编辑器比较简陋,这里为博客添加个优雅易用的Tinymce文本编辑器. 1.项目中添加Tinymce 下载好Tinymce包以及语言包,并添加到项目中.添加到项目的方法,参考了这 ...

  8. FCKeditor编辑器第一次点击总是报错(上传图片) 之后就好了

    错误:   Failed to execute 'getRangeAt' on 'Selection': 0 is not a valid index. FCKeditor编辑器第一次点击总是报错(上 ...

  9. asp.net文本编辑器FCKeditor使用方法详解

    文本编辑器的使用: 1.FCKeditor的官方网站是:http://www.fckeditor.net/download  目前最新的FCKeditor.Net_2.6.9版本. 请在此页下载:ht ...

随机推荐

  1. maven项目转成web项目没有生成WebContent目录

    有时候建立maven项目转成web项目没有生成WebContent目录,此时把Dynamic web module 去掉勾选,然后ok,再点开项目的properties,再选中Dynamic web  ...

  2. 动态分配数组(new)和用随机数赋值(rand)

    #include <iostream>#include <ctime>#include <cstdlib>using namespace std; int main ...

  3. Ubutnu16.04安装pytorch

    1.下载Anaconda3 首先需要去Anaconda官网下载最新版本Anaconda3(https://www.continuum.io/downloads),我下载是是带有python3.6的An ...

  4. 正则表达式去除字符串左右空格函数 调用方法是,str.Trim();

    正则表达式去除字符串左右空格函数 调用方法是,str.Trim(); String.prototype.Trim = function() { return this.replace(/(^\s*)| ...

  5. 修改linux的系统时间

    可以使用date命令.date用于打印或设置系统日期和时间.设置系统时间需要root权限.用法示例:设置系统日期成2015年08月13日,这样会把具体时间设置清空成00:00:00$ sudo dat ...

  6. 【Android Developers Training】 51. 序言:打印内容

    注:本文翻译自Google官方的Android Developers Training文档,译者技术一般,由于喜爱安卓而产生了翻译的念头,纯属个人兴趣爱好. 原文链接:http://developer ...

  7. Kotlin入门第四课:简单工厂模式

    Kotlin基础知识的学习,请参考之前的文章: Kotlin入门第一课:从对比Java开始 Kotlin入门第二课:集合操作 Kotlin入门第三课:数据类型 初次尝试用Kotlin实现Android ...

  8. php测试题

    1. LAMP具体结构不包含下面哪种(A) A:Windows系统 B:Apache服务器 C:MySQL数据库 D:PHP语言 2. 以下哪个SQL语句是正确的(D) A:insert into u ...

  9. AngularJs + angular-ui-router + bootstrap 实现blog基础导航功能

    AngularJs + angular-ui-router + bootstrap 实现blog基础导航功能 核心代码如下 1.index.html <!DOCTYPE html> < ...

  10. Centos操作系统在虚拟机VMware上的安装

    1.下载centos操作系统,提供百度云盘链接:http://pan.baidu.com/s/1pLHOR03 2.打开上篇在VMware中新建好的空白虚拟机,将centos安装在此空白虚拟机上,步骤 ...