We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 2901
    • 277 Posts
    There was a better solution posted in this forum, that works as a plugin.

    $e = &$modx->Event;
    switch ($e->name) {
    
    case 'OnParseDocument':
    
            $replace = array(
                             '<p>[!'    => '[!',
                             '!]</p>'   => '!]',
                             '<p>[['    => '[[',
                             ']]</p>'   => ']]',
                             '<p>{{'    => '{{',
                             '}}</p>'   => '}}'
                             );
            $this->documentOutput = str_replace(array_keys($replace), array_values($replace), $this->documentOutput);
    
    break;
    
    default: '';
    
      return;
    }


    set the system events to "onParseDocument" ! Works like a charme. To who ever wrote i t- Thanks a lot!
      • 1892
      • 82 Posts
      Quote from: bbeer at Jul 29, 2010, 08:10 AM

      There was a better solution posted in this forum, that works as a plugin.
      [snip]
      set the system events to "onParseDocument" ! Works like a charme. To who ever wrote i t- Thanks a lot!
      Spooky - I was just looking for a solution to this and it gets posted today! Thanks for that it works a treat.

      Now I just need to figure out if I can make a custom button for TinyMCE to insert my chunk {{div_split}} into the middle of my content.

      Adrian
        • 8790
        • 526 Posts
        the plugin was the only thing that solves this
        %$!! issue.

        Unbelievable no one saw it before (I use Tiny 3.3.5.1)
        no validity can be reach without this "must be plugin"

        Thanks to its creator, but should be fixed natively int the modx plugin isn’t it ?


          Schtroumpf Grognon - Grouchy Smurf
          ---------------------------------
          Faites pas attention.. - Don&#39;t pay attention
          http://www.dzi-neo.net
          • 27210
          • 158 Posts
          so does the above only work for <p> tags? (i tried the forced_root_block solution and the editor still trashes other tags.

          does the FCKeditor have the same problem? If so is there another editor that works?
            • 26163
            • 43 Posts
            Is this for revo or evo?

            Quote from: bbeer at Jul 29, 2010, 08:10 AM

            There was a better solution posted in this forum, that works as a plugin.

            $e = &$modx->Event;
            switch ($e->name) {
            
            case 'OnParseDocument':
            
                    $replace = array(
                                     '<p>[!'    => '[!',
                                     '!]</p>'   => '!]',
                                     '<p>[['    => '[[',
                                     ']]</p>'   => ']]',
                                     '<p>{{'    => '{{',
                                     '}}</p>'   => '}}'
                                     );
                    $this->documentOutput = str_replace(array_keys($replace), array_values($replace), $this->documentOutput);
            
            break;
            
            default: '';
            
              return;
            }


            set the system events to "onParseDocument" ! Works like a charme. To who ever wrote i t- Thanks a lot!

              • 2901
              • 277 Posts
              Well so far this is for evo. Not sure if it works in revo as well.
                • 2901
                • 277 Posts
                Just tested it under Revo - no luck, it creates a blank page. Any one any idea on how this could be solved in Revo? I think it is really a must to be able to enter chunks, snippets etc directly into TinyMCE. Turning off forced_root_block is not a good solution as the end user tends to make errors. I really think this should be on board in Revolution.

                Thanks a lot
                  • 2396
                  • 101 Posts
                  I have been having a similar problem - hopefully this might help:

                  http://modxcms.com/forums/index.php/topic,65686.0.html#msg379018
                    • 2901
                    • 277 Posts
                    Thanks atype

                    I already know this solution. It is a good solution if you don’t plan to let the end user edit the content himself. But if you want them to edit there content, then this is not a really good solution, you bet the create invalid content.

                    The plugin solution in eve was nice and hassle free. Maybe some one from the core team has a solution to this. I feel this should be part of the core!

                    Thanks again.
                      • 28042 ☆ A M B ☆
                      • 24,524 Posts
                      TinyMCE is an optional add-on. Core code is for core MODx functionality, not for modifying behavior of optional add-ons. This will require a plugin for removing unwanted <p> tags around <img /> tags at parse time. I’ve examined the code of TinyMCE, and it would be very tricky to try to exclude any specific non-block elements from the ForceBlock feature.
                        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