开发者

How can i force that tinyMCE does not convert <b> tags to <strong> tags?

when i use the html editor tinyMCE and i paste code inside, it converts the html <b> tags into <开发者_Go百科;strong> tags.

Does andybody knows how can i force this editor to prevent such convertions?

Thanks.


Yes, use this piece of code in your tinymce init

    // Override internal formats  
    formats: {
        bold : {inline : 'b' },  
        //italic : {inline : 'i' },
        //underline : {inline : 'u'}
    },


You might try going to your plugin manager, finding the plugin "Editor - TinyMCE," and under Basic Options look for the "Extended Valid Elements" field and add your HTML5 tags in there. like in your case: <strong> and <br> Then it will not ignore your <strong> and <br>.

Thanks Hope you will like it ! :)


Here is what works for me tinyMCE.init({ valid_elements : "a[href|target=_blank],b,div[align],br" .......

Here you can set all elements that are ok for the tiny even if they are deprecated such as b (replaced to strong, or i replaced to em). With this tag tiny won't replace that what match inside valid_elements.

Tiny itself has a few rules when the editor is create : valid_elements : "@[id|class|style|title|dir

where we can see wich changes it makes in order to match it's criteria. In my case some html's had a 'b' tag with a class inside that i don't must touch 'b class='aClass'', so the valid_elements for such thing is valid_elements : "b[class|id],i" where we set valid tags inside the b such as class or id,. If we don't set any options inside [..] the 'b class='aClass'' will be replace with a simple 'b'.

Hope this helps to someone.

The link with some more explanation http://tinymce.moxiecode.com/wiki.php/Configuration:valid_elements

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜