
TinyMCE(亦称 Tiny Moxiecode Content Editor)是一款遵循LGPL授权协议,以网页接口为导向的HTML编辑器。
示例:
tinymce.init({
auto_focus: "content",//焦点ID
directionality : 'ltr',// ltr 文本流从左到右 rtl从右到左,默认ltr
browser_spellcheck : true, // 使用浏览器拼写检查 默认false
language_url : '/languages/fi.js', // 编辑器语言地址
nowrap : true, // 编辑器内容禁止换行,默认为false
object_resizing : false, // 允许图像,表格或媒体对象调整大小,默认为true
selector: '#content', // 选择器 指定哪些可以做为编辑器
theme: 'modern', // 主题 默认modern
skin: 'lightgray', // 皮肤,默认lightgray
language: 'zh_cn',// 语言
inline : true,编辑器悬浮,默认为false
plugins: [
'advlist autolink lists link image charmap print preview hr anchor pagebreak',
'searchreplace visualblocks visualchars code fullscreen',
'insertdatetime media nonbreaking save table contextmenu directionality',
'emoticons template paste'
],// 插件列表 逗号或空格分隔的字符串,或者字符串数组
external_plugins: {
"myplugin": "/myplugins/myplugin.js"
}, // 扩展插件 指TinyMCE的plugins目录以外的插件
convert_fonts_to_spans: 'false',// 转换字体元素为SPAN标签,默认为true
extended_valid_elements : "img[class|src|border=0|alt|title|hspace|vspace|width|height|align|onmouseover|onmouseout|name]",
// 不允许使用的元素类型
valid_elements : "a[href|target=_blank],strong/b,div[align],br", // 允许的元素类型
font_formats: "Arial=arial,helvetica,sans-serif;Courier New=courier new,courier,monospace;AkrutiKndPadmini=Akpdmi-n",
// 字体集
fontsize_formats: "8pt 10pt 12pt 14pt 18pt 24pt 36pt",// 字号
custom_undo_redo_levels: 10, // 允许撤消次数
document_base_url: "http://www.site.com/path1/", URL
image_advtab: true, // 高级图像编辑
autoresize_min_height:100,// 编辑器最小高度
autoresize_max_height:500,// 编辑器最大高度
toolbar1: 'insertfile undo redo | styleselect | bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | link image',// 工具条1
toolbar2: 'print preview media | forecolor backcolor emoticons',// 工具条2
templates: [
{title: 'Test template 1', content: 'Test 1'},
{title: 'Test template 2', content: 'Test 2'}
],// 模板设置
});详细说明:
- inline 演示: http://www.tinymce.com/tryit/inline.php
- valid_elements 说明:http://www.tinymce.com/wiki.php/Configuration:valid_elements
- dateformats 说明:http://www.tinymce.com/wiki.php/Configuration:dateformats
- TinyMCE4.x API:http://www.tinymce.com/wiki.php/api4:index
- 可扩展插件列表:http://sourceforge.net/p/tinymce/plugins/?limit=250 (似乎支持4.x的不是很多)
- 维基百科 TinyMCE http://zh.wikipedia.org/wiki/TinyMCE
- 10个免费的javascript富文本编辑器(jQuery and non-jQuery) http://www.cnblogs.com/ywqu/archive/2009/12/25/1631766.html
- TinyMCE 中文手册(翻译,非官方,早期版本) http://hauy.net/TinyMceManual/index.html