Adding allowed strings to the tinyMCE

Topics: ASP.NET 2.0, Controls, Themes
Feb 16, 2012 at 1:25 PM

Hi guys, I added some code like so:

<a
    href="url"
    style="display:block;width:425px;height:300px;"
    id="player">
</a>
<script language="JavaScript">
    flowplayer("player", "url");
</script>

In HTML view, but when I go to the regular view the code is taken away. I had this problem before and it was because some of the tags where not allowed by tinyMCE.

 

I tried adding the following line to TinyMCE.ascx:

        theme_advanced_resize_horizontal : false,
		tab_focus : ":prev,:next",
		gecko_spellcheck: true,
		extended_valid_elements: "embed[flashvars|src|width|height|wmode|allowfullscreen|allowscriptaccess|name|pluginspage|type]", //This is to allow youtube embeds
        extended_valid_elements: "a[href|style|id]", //This is the one I added

But the code is still taken away.

 

Thanks.

Feb 16, 2012 at 2:12 PM
Edited Feb 16, 2012 at 2:21 PM

Put your addition at the end of the existing extended_valid_elements property, like so:

extended_valid_elements: "embed[flashvars|src|width|height|wmode|allowfullscreen|allowscriptaccess|name|pluginspage|type],a[href|style|id]",

Then make sure you have &nbsp; or text between the anchor or tiny will wipe it, this works for me.

Feb 16, 2012 at 5:38 PM
Andy_McKay wrote:

Put your addition at the end of the existing extended_valid_elements property, like so:

extended_valid_elements: "embed[flashvars|src|width|height|wmode|allowfullscreen|allowscriptaccess|name|pluginspage|type],a[href|style|id]",

Then make sure you have &nbsp; or text between the anchor or tiny will wipe it, this works for me.

Yep, it works.

 

Thanks.