2012-10-31 99 views
2

我遇到了TinyMCE的問題。tinyMce使用html標籤重新加載數據

保存編輯器的內容並重新顯示後,所有的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標籤)

回答

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" 
}); 

希望這有助於,乾杯!

+0

我不假設使用Html源代碼編輯器 –

+0

@ArunrajChandran我已更新答案...希望它對你有用:) – yb007

+0

感謝您的支持。但這不適合我。 –