Sunday, November 7, 2010

WymEditor strips out <embed> tags

WymEditor seems to strip out <embed>/<object> tags so does not seem to have the ability to embed YouTube clips. The way to fix it is to patch the latest WymEditor release, or download the GitHub files. Here are two blog posts that talk about the issue:

http://simonwoodside.com/weblog/2009/2/8/how_to_make_wym_editor/
http://meridimus.com/post/167515648/wymeditor-flash

I took the diff of these changes and patched the 0.5rc2 release accordingly:

1757d1756
<       "param",
2124a2124,2150
>     "param":
>     {
>       "attributes":
>       [
>         "type",
>         "value",
>   "name"
>       ],
>       "required":[
>       "name"
>       ],
>       "inside":"object"
>     },
>  "embed":
>     {
>       "attributes":
>       [
>         "width",
>         "height",
>         "allowfullscreen",
>         "allowscriptaccess",
>         "wmode",
>         "type",
>         "src"
>       ],
>    "inside":"object"
>     },
2166,2178d2191
<     "param":
<     {
<       "attributes":
<       {
<         "0":"type",
<         "valuetype":/^(data|ref|object)$/,
<         "1":"valuetype",
<         "2":"value"
<       },
<       "required":[
<       "name"
<       ]
<     },
3381c3394
<     "object", "ol", "optgroup", "option", "p", "param", "pre", "q",
---
>     "ol", "optgroup", "option", "p", "pre", "q",
3384c3397
<     "thead", "title", "tr", "tt", "ul", "var", "extends"];
---
>     "thead", "title", "tr", "tt", "ul", "var", "extends", "object"];
3387c3400
<     this.inline_tags = ["br", "hr", "img", "input"];
---
>     this.inline_tags = ["br", "hr", "img", "input", "param", "embed"];

This issue has been filed as a ticket on the trac.wymeditor.org. If you want to create an account, you have to visit http://trac.wymeditor/trac/register. The link that's made available on the web site doesn't quite work. You can download the patched file here:

http://trac.wymeditor.org/trac/ticket/221

Update: There is already a plug-in that adds these tags into the code:

https://github.com/wymeditor/wymeditor/blob/master/src/wymeditor/plugins/embed/jquery.wymeditor.embed.js

No comments:

Post a Comment