We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 36834
    • 25 Posts
    I have a small issue on more than one server. The TinyMCE Template plugin will not insert a template if the system setting ’template_selected_content_classes’ is empty. I was wondering if this is a bug and should I report it?

    Editing the following function on around line 95 of template/editor_plugin_src.js (which I swapped out for the minified version) to test for the presence of the ’template_selected_content_classes’ parameter first resolves the problem but I think the issue might be that MODx sets up the empty parameter to start with in the system settings.

    Any feedback would be appreciated. Thanks

    // Replace selection - original
    if (hasClass(n, ed.getParam(’template_selected_content_classes’, ’selcontent’).replace(/\s+/g, ’|’)))
    n.innerHTML = sel;

    // Replace selection - edited
    if (ed.getParam(’template_selected_content_classes’) && hasClass(n, ed.getParam(’template_selected_content_classes’, ’selcontent’).replace(/\s+/g, ’|’)))
    n.innerHTML = sel;


    Mac OSX 10.6.4
    Apache 2.2.15 (Unix)
    PHP 5.3.3
    MySql 5.1.47
    MODx 2.0.7-pl traditional
      • 12241
      • 80 Posts
      Just ran into this same problem, doesn’t look like there is any bug reported at github https://github.com/splittingred/TinyMCE/issues
        Environment:
        modx: rev 2.0.8-pl
        localhost: Apache/2.0.63 (Unix) PHP/5.2.11 DAV/2, MySQL client version: 5.1.37
        • 46367
        • 2 Posts
        Had the same issue using TinyMCE 4.3.3, Revo 2.2.10-pl. Found that template content is stripped when it contains HTML attribute class.

        For example, my template contained:
        <ol class="steps">
            <li>Step1</li>
            <li>Step2</li>
        </ol>
        


        As usual - it showed up in preview, but after clicking Insert button everything was gone. Nothing really was inserted.

        After removing class atribute, my template looked like this:
        <ol>
            <li>Step1</li>
            <li>Step2</li>
        </ol>
        


        This was working fine. But didn't satisfied my needs. I desperately needed a template with class attribute.

        Found a solution. You need to provide some class name for this setting: tiny.template_selected_content_classes
        It's empty by default and that's why template content is stripped. When you enter some CSS class name (I used fake one), everything works great again. So my setting looked like this:
        tiny.template_selected_content_classes  .fakeCssClass
        


        Important! Dot (.) before class name is the key. When using class name like this: fakeCssClass (without dot in front), nothing worked.

        Hope this helps!
          • 36604
          • 268 Posts
          Hi,

          Nothing works with html5 tags. Still inoperant, the template code is "still cleaned".
          I added :
          tiny.template_selected_content_classes
          	
          .figure .fig-caption
          as fake classes (and edited my 2 html5 tpl to add those class)


          for example:
          <figure  class="fig-caption">
          <img src="" alt="" width=" " height=" " />
          <figcaption>caption</figcaption>
          </figure>

          (or the same without the caption tag will
          gives asap a <p> coontaining the xhtml classic tags but figure and/or figcaption will vanish.
          Even with a tpl containing no html5 tag, only the first level of imbrication is kept
          (div into div will be be deleted).. is this a clue ?


          Of course I have all the stuff already told about this %!!$# issue:
          setting_tiny.extended_valid_elements
          	
          figure[id|class|title],figcaption,div[id|class|title],*[*]
          	
          Forced Root Block
          	
          tiny.forced_root_block  (none)
          


          Thnak you