简体   繁体   中英

TinyMCE editor replacing tags inside Joomla articles

I have a front page of my site optimized for SEO. I am using tags to mark important content. When I edit my article in admin section with TinyMCE editor, it replaces tags with tags, which I want to avoid.

Any ideas how to make this web editor (TinyMCE) not replace my <strong> tags?

Check your tinyMCE.init() call and look for the valid_elements option. If it's set to something like:

tinyMCE.init({
    ...
    valid_elements : "..., b/strong, ..."
});

That means it's set to replace strong tags with b tags. Just switch to allowing both ("b, strong", or even replacing b tags with strong tags like

tinyMCE.init({
    ...
    valid_elements : "..., strong/b, ..."
});

See also this page in the documentation.

While valid_elements should effect strong tag, in practice in doesn't. The solution is to comment out the following code in tiny_mce.js -

/*h=h.replace(/<strong([^>]*)>/gi,'<b$1>');h=h.replace(/<\/strong>/gi,'</b>');*/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM