TinyMCE has been driving me insane. It's deleting <section> tags and adding <p> tags everywhere. How can I disable the feature for it to modify my code? I found a few forums but they are all out of date or don't work.
Please help. Thanks.
It's not a good idea to have markup present in the rich text editor, but use tinymcewrapper instead of tinymce as I don't think tinymce really detects HTML5 tags very well.
I've never really tested this because I never use TinyMCE, ever, but NewsPublisher might be an option. It uses the current version of Tiny downloaded from the web, which allows more customization, and I think TinyMCE does much of its damage when you save the resource (I know this is true in WordPress). In NewsPublisher, the save is done by NP, so Tiny doesn't get its grubby little hands on the code.
BTW, I feel your pain. I do a blog (not the one at Bob's Guides), where I'm forced to use WordPress. The WP version of TinyMCE will actually *remove* some of thecode in pre sections! Not just tags, but the stuff inside the tags as well. There have been a few cases where it was literally impossible to display what I wanted to show with proper syntax highlighting.
TinyMCE is like a furnace (up to 4000 degrees Celsius), you can melt just about any of your smithy wares, no issues!
But one needs to wear the right gloves when playing with this kind of fire.
The right gloves are the proper TinyMCE config and plugins, both of which crucials are lacking in the Wordpress' official version and MODX's.
Long story shortened, anything is possible with this RTE.
Enter TinymceWrapper!
TinymceWrapper: Complete back/frontend content solution.
Harden your MODX site by
passwording your three main folders:
core, manager, connectors and renaming your
assets (thank me later!)
5 ways to sniff / hack your own sites; even with renamed/hidden folders, burst them all up, to see how secure you are not.
maybe you should rethink your templating, if customers have to add <section> - tags into the content/rte
Depending on user's prerogative, an RTE maybe used in very complex instances.
TinyMCE is designed to and often used to build pages from scratch, starting from <html> and <form>
I guess some projects are not just pure content <p> and <b>
TinymceWrapper: Complete back/frontend content solution.
Harden your MODX site by
passwording your three main folders:
core, manager, connectors and renaming your
assets (thank me later!)
5 ways to sniff / hack your own sites; even with renamed/hidden folders, burst them all up, to see how secure you are not.
It won't affect the paragraph tags, but you should be able to get it to leave the section tags alone with the
extended_valid_elements option.
Thanks for the replies, I'm using TinyMCEWrapper now, it doesn't delete my <section> tags, but it still adds the <p> around [[$chunk]] calls
The reason I'm using <section> tags is because I have a template for the content pages, and section tags for certain page attributes/styling. I'm not sure how else to do it without creating a template for each page, so if anyone has any suggestions I'd be happy to hear them
Quote from: yankindeez at Jun 09, 2017, 10:10 PMThanks for the replies, I'm using TinyMCEWrapper now, it doesn't delete my <section> tags, but it still adds the <p> around [[$chunk]] calls
The reason I'm using </p><section> tags is because I have a template for the content pages, and section tags for certain page attributes/styling. I'm not sure how else to do it without creating a template for each page, so if anyone has any suggestions I'd be happy to hear them</section></section>
Create your templates and then try to place everything in chunks so all the client has to do is edit the content or template variables. Otherwise they'll inevitably screw it up if they delete hidden code.