On March 26, 2019 we launched new MODX Forums. Please join us at the new MODX Community Forums.
Subscribe: RSS
  • Quote from: okneb at Apr 01, 2010, 08:58 AM

    TinyMCE removes empty divs by default, it can be fixed by adding:
    extended_valid_elements : "div[*]"

    to the configuration.

    In modx go to Manage Elements > Plugins > TinyMCE > Configution
    and add it to Custom Parameters.

    Worked for me. Thanks! I like the idea of the chunk as well—particularly for using a styled horizontal rule in a div. That way it can be typed in the client if they want to add a rule.
    • Hi,

      i’m having the same problem, all empty divs are removed when i click "Toggle Editor". I’m using Modx Rev 2.07 and TinyMCE 4.1.2. I added extended_valid_elements : "div[*]" to assets/components/tinymce/xconfig.js, didn’t change anything. Then i tried to edit TinyMCE plugin properties : plugins->TinyMCE->Properties but can’t find "valid_elements" property. Can anyone help with this problem?
      • add it to Custom Parameters
          Studying MODX in the desert - http://sottwell.com
          Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
          Join the Slack Community - http://modx.org
        • Thanks, sorry i missed that part. Now it works!

          What settings should i change to make sure TinyMCE doesn’t format my HTML at all, for example it always moves </div> (no matching starting tag because it’s placed outside [[*content]] area) to the bottom of the page. I thought changing "cleanup" property to False would disable formatting, but doesn’t seem to work.

          • could someone be more specific for the Revo 2.0.7 case.

            I can’t figure out what file to edit.
            • I know this post is old but I came a cropper today with exactly this problem.

              Quote from: modx_fan at Jan 25, 2011, 09:41 AM

              What settings should i change to make sure TinyMCE doesn't format my HTML at all

              Add the following to your Custom parameters

              apply_source_formatting:0


              Quote from: okneb at Apr 01, 2010, 08:58 AM

              TinyMCE removes empty divs by default, it can be fixed by adding:
              extended_valid_elements : "div[*]"

              to the configuration.

              This code doesnt work for me, but after researching the TinyMice forum I found my solution:

              extended_valid_elements:"div[id|class|title]"
              • an old post but still not solved yet for me:
                I tried the setting above
                extended_valid_elements : "div[*]"
                extended_valid_elements:"div[id|class|title]"

                My template looks like this:
                <div class="subcolumns">
                  <div class="c50l">
                    <div class="subcl">
                      <p>left content</p>
                    </div>
                  </div>
                  <div class="c50r">
                    <div class="subcr">
                      <p>right content</p>
                    </div>
                  </div>
                </div>

                The template shows up in tinymce, the preview looks ok, but after include and inspect the source code everything inside the .subcolumns div is removed. Any ideas?
                MODX 2.2.10
                tinymce 4.3.0-pl
                regards
                manu