We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 45739
    • 64 Posts
    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.
      • 17301
      • 932 Posts
      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.
        ■ email: [email protected] | ■ website: https://alienbuild.uk

        The greatest compliment you can give back to us, is to spend a few seconds leaving a rating at our trustpilot: https://uk.trustpilot.com/review/alienbuild.uk about the service we provided. We always drop mention of services offered by businesses we've worked with in the past to those of interest.
        • 3749
        • 24,544 Posts
        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.
          Did I help you? Buy me a beer
          Get my Book: MODX:The Official Guide
          MODX info for everyone: http://bobsguides.com/modx.html
          My MODX Extras
          Bob's Guides is now hosted at A2 MODX Hosting
          • 42562
          • 1,145 Posts
          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.
            • 4172
            • 5,888 Posts
            maybe you should rethink your templating, if customers have to add <section> - tags into the content/rte
              -------------------------------

              you can buy me a beer, if you like MIGX

              http://webcmsolutions.de/migx.html

              Thanks!
              • 42562
              • 1,145 Posts
              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.
                • 3749
                • 24,544 Posts
                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.
                  Did I help you? Buy me a beer
                  Get my Book: MODX:The Official Guide
                  MODX info for everyone: http://bobsguides.com/modx.html
                  My MODX Extras
                  Bob's Guides is now hosted at A2 MODX Hosting
                  • 45739
                  • 64 Posts
                  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
                    • 3749
                    • 24,544 Posts
                    Some possible help here: https://stackoverflow.com/questions/13841986/tinymce-adding-p-tags-automatically

                    Also:

                    forced_root_block : ""
                      Did I help you? Buy me a beer
                      Get my Book: MODX:The Official Guide
                      MODX info for everyone: http://bobsguides.com/modx.html
                      My MODX Extras
                      Bob's Guides is now hosted at A2 MODX Hosting
                      • 17301
                      • 932 Posts
                      Quote from: yankindeez at Jun 09, 2017, 10:10 PM
                      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 </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.
                        ■ email: [email protected] | ■ website: https://alienbuild.uk

                        The greatest compliment you can give back to us, is to spend a few seconds leaving a rating at our trustpilot: https://uk.trustpilot.com/review/alienbuild.uk about the service we provided. We always drop mention of services offered by businesses we've worked with in the past to those of interest.