我一直在閱讀官方文檔和博客文章,所以幾個小時,某些地方的答案將張貼已經..但沒有運氣。如何防止tinymce從輸入元素中剝離'style'屬性?
似乎沒有任何配置擺弄的數量。停止tinymce從我的輸入/提交<p>
元素中去除內聯「樣式」屬性。我需要所有輸入元素的'樣式'屬性..但我只是開始通過測試<p>
甚至讓它工作。
- TinyMCE的版本3.5b3
這裏是我的配置的最新迭代。 (超出許多變化/嘗試):
tinyMCE.init({
mode : "textareas",
theme : "advanced",
plugins : "emotions,spellchecker,advhr,insertdatetime,preview,paste,table,media,directionality,style,xhtmlxtras,nonbreaking,pagebreak",
theme_advanced_buttons1 : "save,newdocument,|,bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,formatselect,fontselect,fontsizeselect",
theme_advanced_buttons2 : "cut,copy,paste,pastetext,pasteword,|,bullist,numlist,|,outdent,indent,blockquote,|,undo,redo,|,link,unlink,anchor,image,cleanup,help,code,|,insertdate,inserttime,preview,|,forecolor,backcolor",
theme_advanced_buttons3 : "tablecontrols,|,hr,removeformat,visualaid,|,sub,sup,|,charmap,emotions,iespell,media,advhr,|,ltr,rtl",
theme_advanced_buttons4 : "styleprops,|,cite,abbr,acronym,del,ins,attribs,|,nonbreaking,pagebreak",
theme_advanced_toolbar_location : "top",
theme_advanced_toolbar_align : "left",
theme_advanced_statusbar_location : "bottom",
theme_advanced_resizing : true,
doctype : "<!DOCTYPE html>",
convert_urls : false,
//template_external_list_url : "gen4tinymce/lists/template_list.js",
external_link_list_url : "gen4tinymce/lists/link_list.js",
//media_external_list_url : "gen4tinymce/lists/media_list.js",
valid_elements : "@[id|class|style|title|dir<ltr?rtl|lang|xml::lang],"
+ "a[rel|rev|charset|hreflang|tabindex|accesskey|type|"
+ "name|href|target|title|class],strong/b,em/i,strike,u,"
+ "#p[style],-ol[type|compact],-ul[type|compact],-li,br,img[longdesc|usemap|"
+ "src|border|alt=|title|hspace|vspace|width|height|align],-sub,-sup,"
+ "-blockquote,-table[border=0|cellspacing|cellpadding|width|frame|rules|"
+ "height|align|summary|bgcolor|background|bordercolor],-tr[rowspan|width|"
+ "height|align|valign|bgcolor|background|bordercolor],tbody,thead,tfoot,"
+ "#td[colspan|rowspan|width|height|align|valign|bgcolor|background|bordercolor"
+ "|scope],#th[colspan|rowspan|width|height|align|valign|scope],caption,-div,"
+ "-span,-code,-pre,address,-h1,-h2,-h3,-h4,-h5,-h6,hr[size|noshade],-font[face"
+ "|size|color],dd,dl,dt,cite,abbr,acronym,del[datetime|cite],ins[datetime|cite],"
+ "object[classid|width|height|codebase|*],param[name|value|_value],embed[type|width"
+ "|height|src|*],map[name],area[shape|coords|href|alt|target],bdo,"
+ "button,col[align|char|charoff|span|valign|width],colgroup[align|char|charoff|span|"
+ "valign|width],dfn,fieldset,form[action|accept|accept-charset|enctype|method],"
+ "input[accept|alt|checked|disabled|maxlength|name|readonly|size|src|type|value],"
+ "kbd,label[for],legend,noscript,optgroup[label|disabled],option[disabled|label|selected|value],"
+ "q[cite],samp,select[disabled|multiple|name|size],small,"
+ "textarea[cols|rows|disabled|name|readonly],tt,var,big",
extended_valid_elements : "p[style]",
inline_styles : true,
verify_html : false
});
感謝您的任何建議!
是的,我剝了下來,整個事情作爲一個測試..隔離JUST TinyMCE的,它按預期工作,就像你說的,並顯示。所以我需要弄清楚什麼是剝離樣式屬性...我使用的PHP框架,CodeIgniter,或者什麼。我會回到這裏接受你的回答。我只是暫時將它開放,以防萬一任何人發佈一些東西,這可以讓我更多時間找出罪魁禍首。 ;-) – govinda 2012-04-24 15:35:18