Jen*_*ell 8 javascript wysiwyg tinymce contenteditable
我已经读过TinyMCE支持contenteditable而不是textarea/iframe版本
资源:
http://www.tinymce.com/forum/viewtopic.php?id=22164
它说:
我在TinyMCE v3.5.2的源代码中发现了一个名为'content_editable'的配置属性.此标志可防止iframe呈现.
使用Javascript
tinyMCE.init({
// General options
mode : "exact",
element : "my_id",
theme : "advanced",
plugins : "table,inlinepopups",
editor_selector : "tinymce",
// Theme options
theme_advanced_buttons1 : "bold,italic,underline,strikethrough,formatselect,code",
theme_advanced_buttons2 : "",
theme_advanced_buttons3 : "",
theme_advanced_buttons4 : "",
theme_advanced_toolbar_location : "external",
theme_advanced_toolbar_align : "left",
theme_advanced_resizing : true,
content_editable: true,
// Example content CSS (should be your site CSS)
content_css : "/js/tinymce/examples/css/content.css",
// Style formats
style_formats : [
{title : 'Bold text', inline : 'b'},
{title : 'Red text', inline : 'span', styles : {color : '#ff0000'}},
{title : 'Red header', block : 'h1', styles : {color : '#ff0000'}},
{title : 'Example 1', inline : 'span', classes : 'example1'},
{title : 'Example 2', inline : 'span', classes : 'example2'},
{title : 'Table styles'},
{title : 'Table row 1', selector : 'tr', classes : 'tablerow1'}
],
formats : {
alignleft : {selector : 'p,h1,h2,h3,h4,h5,h6,td,th,div,ul,ol,li,table,img', classes : 'left'},
aligncenter : {selector : 'p,h1,h2,h3,h4,h5,h6,td,th,div,ul,ol,li,table,img', classes : 'center'},
alignright : {selector : 'p,h1,h2,h3,h4,h5,h6,td,th,div,ul,ol,li,table,img', classes : 'right'},
alignfull : {selector : 'p,h1,h2,h3,h4,h5,h6,td,th,div,ul,ol,li,table,img', classes : 'full'},
bold : {inline : 'span', 'classes' : 'bold'},
italic : {inline : 'span', 'classes' : 'italic'},
underline : {inline : 'span', 'classes' : 'underline', exact : true},
strikethrough : {inline : 'del'},
customformat : {inline : 'span', styles : {color : '#00ff00', fontSize : '20px'}, attributes : {title : 'My custom format'}}
},
});
Run Code Online (Sandbox Code Playgroud)
HTML
<div class="tinymce" id="my_id" contenteditable="true">test</div>
Run Code Online (Sandbox Code Playgroud)
我改变了什么
这发生了
没有.脚本运行并且没有错误.任何提示?
| 归档时间: |
|
| 查看次数: |
8537 次 |
| 最近记录: |