SyntaxHighlighter Build Test Page
Thoughts from a C# Developer
kennydust (gravatar)

Preventing TinyMCE from stripping embed tags from rich media code.

For those who have never used the TinyMCE WYSIWYG pluggin, it's one of the industry's best kept secret; add this pluggin to your website, and you've got an instant Microsoft Word-like interface that supports pretty much all the different browsers and it's variations. Some of the things I've taken advantage of include creating custom toolbar buttons and leveraging their compressor paradigm to keep the scripts lightweight. Pretty neat indeed.

Now with that said, I've come across one issue which wasn't very clear initially on how to solve, because it had long been a bug since it's predecessor versions; I was inject YouTube object/embed code into the body of the TinyMCE editor -- and coming back out, the <embed> tag would be stripped out entirely. It was a little odd, and I tried a number of things to no avail. The solution? Define media_strict = false in your init() call. But only if you're utilizing the media pluggin. The media plugin assumes media_strict is true by default. The media_strict is a new option as of version 3.2.1.


tinyMCE.init({
   mode: "textareas",
   theme : "advanced",
   plugins : "media",
   media_strict : false
});

Hope this saves someone a day or two.

Add to GlobalGrind!

0 Comments

Your Information
Mrs. Gravatar (gravatar)

<-- It's a gravatar

your comment