2

我对 TinyMCE 有疑问。

保存编辑器的内容并重新显示后,所有 HTML 标记都可见。

这就是我初始化编辑器的方式:

// Tinymce Config
tinyMCE.init({
    // General options
    mode : "specific_textareas",
    editor_selector : "mceEditor",
    language : "<?php echo $tinyMceLang?>",
    setup : function(ed) {
        ed.onActivate.add(tinyOnEdit);
    },
    theme : "advanced",
    plugins : "table",
    // Theme options
    theme_advanced_buttons1 : "bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,fontsizeselect,|,forecolor,backcolor,|,table,row_before,row_after,delete_row,col_before,col_after,delete_col,code",
    theme_advanced_buttons2 : "",
    theme_advanced_buttons3 : "",
    theme_advanced_buttons4 : "",
    theme_advanced_toolbar_location : "top",
    theme_advanced_toolbar_align : "left",
    theme_advanced_statusbar_location : "bottom",
    theme_advanced_path : false,
    theme_advanced_resizing : true,
    convert_fonts_to_spans : true,
    //font_size_style_values : "0.7em,0.8em,1em,1.2em,1.5em,2em,3em",
    //font_size_style_values : "8pt,10pt,12pt,14pt,18pt,24pt,36pt",

    // content CSS (should be your site CSS)
    content_css : "/css/tiny_content.css"
});

如果我粘贴这样的内容(使用 HTML 标签):

<p><span style="color: #ff0000;">testing tinymce contents</span></p>

重新显示为:

<p><span style="color: #ff0000;">testing tinymce contents</span></p>(带有html标签)

但例外的结果是:

测试tinymce内容(红色文本)(不允许html标签)

4

1 回答 1

0

打开 HTML 源代码编辑器。

将您的内容(带有 HTML 标记)粘贴到 html 源代码编辑器中的所需位置。点击更新。

而已。

回应您的评论在您的插件列表中添加粘贴,还包括此插件选项

plugins : "table,paste",
paste_remove_styles: true,

在你的 tinyMCE.init 中

// Tinymce Config
tinyMCE.init({
// General options
mode : "specific_textareas",
editor_selector : "mceEditor",
language : "<?php echo $tinyMceLang?>",
setup : function(ed) {
    ed.onActivate.add(tinyOnEdit);
},
theme : "advanced",

plugins : "table,paste",
paste_remove_styles: true,


// Theme options
theme_advanced_buttons1 : "bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,fontsizeselect,|,forecolor,backcolor,|,table,row_before,row_after,delete_row,col_before,col_after,delete_col,code",
theme_advanced_buttons2 : "",
theme_advanced_buttons3 : "",
theme_advanced_buttons4 : "",
theme_advanced_toolbar_location : "top",
theme_advanced_toolbar_align : "left",
theme_advanced_statusbar_location : "bottom",
theme_advanced_path : false,
theme_advanced_resizing : true,
convert_fonts_to_spans : true,
//font_size_style_values : "0.7em,0.8em,1em,1.2em,1.5em,2em,3em",
//font_size_style_values : "8pt,10pt,12pt,14pt,18pt,24pt,36pt",

// content CSS (should be your site CSS)
content_css : "/css/tiny_content.css"
});   

希望这会有所帮助,干杯!!

于 2012-11-03T08:12:16.397 回答