Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
575 views
in Technique[技术] by (71.8m points)

css - TinyMCE is removing <style> tags

I'm facing a problem with TinyMCE. When I enter a style tag in the HTML editor of TinyMCE, it removes the tags when I click update.

<style type="text/css"> 
     .newclasss { color:#c9c9c9; } 
</style>

My valid elements are follows:

<script type="text/javascript">

var valid_elms = "hr[class|width|size|noshade]";
valid_elms    += "span[class|align|style],";
valid_elms    += "font[face|size|color|style],";
valid_elms    += "img[href|src|name|title|onclick|align|alt|title|";
valid_elms    += "width|height|vspace|hspace],";
valid_elms    += "iframe[id|class|width|size|noshade|src|height|";
valid_elms    += "frameborder|border|marginwidth|marginheight|";
valid_elms    += "target|scrolling|allowtransparency],style";

extended_valid_elements: valid_elms
</script>

Can anyone help please??

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Since style tags are not valid XHTML, TinyMCE disabled the ability to add them outside of the tags.

You have to add style tags to the valid children configuration

valid_children : "+body[style]"

Edit: This solution applies to version 3.4.2

Source


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...