We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 36666
    • 19 Posts
    Select a resource
    Turn off TinyMCE editor with "Toggle Editor" checkbox
    Add this content:

    [[formit? &hooks=`redirect` &redirectTo=`[[~[[*id]]]]` &submitVar=`EventSchdRptYear`]]
    
    <div>
      [[EventSchdRptPH? &type=`agenda` &year=`2011`]]
      <div id="ReportData">
        [[+EventSchdRpt.Agenda.ph]]
      </div>
    </div>
    
    [[$EventSchdRpt.paging.js.Tpl]]


    Save the resource

    Select another resource
    Turn on TinyMCE editor with "Toggle Editor" checkbox
    Add desired content
    Save the resource

    Select the first resource again
    The content has been changed to this:
    <p>[[formit? &hooks=`redirect` &redirectTo=`[[~[[*id]]]]` &submitVar=`EventSchdRptYear`]]</p>
    <div>[[EventSchdRptPH? &type=`agenda` &year=`2011`]]
    <div id="ReportData">[[+EventSchdRpt.Agenda.ph]]</div>
    </div>
    <p>[[$EventSchdRpt.paging.js.Tpl]]</p>


    TinyMCE is adding html tags to the content because TinyMCE was turned on while editing the prior resource. The result is unwanted <p></p> tags in the rendered page where the FormIt call is and unwanted <p> </p> tags surrounding the pagination chunk and the content is pushed down in the page.

    It seems to me that MODx Manager should remember the "Toggle Editor" setting for each individual resource.
    Is there something that I can do to prevent this behavior?

    This question has been answered by cp@pcs. See the first response.

    [ed. note: cp@pcs last edited this post 12 years, 7 months ago.]
    • It is possible to turn off the forced_root_block "feature" of TinyMCE by adding forced_root_block : false to its configuration, but I'm not sure how that can be configured in Revo.

      Besides that, I don't think it has to do with how any other resources were handled. TinyMCE will add the tags as soon as the javascript is loaded when you open a resource for editing. Since it's all Javascript in the browser anyway, MODx really can't do much about it except load it with a custom configuration. [ed. note: sottwell last edited this post 12 years, 7 months ago.]
        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
        • 36666
        • 19 Posts
        Thanks for the reply Susan.

        Deactivating the forced_root_block "feature" of TinyMCE will disable it entirely in the backend. This is not what really an option for me. Users editing resources in the backend depend (unknowingly...) on TinyMCE and its forced_root_block setting.

        What I would prefer is a way to make MODx remember the state of the "Toggle Editor" switch for each individual resource. This way, resources that are managed as raw html will not have tags added by TinyMCE when they are selected for editing. As the "Toggle Editor" switch actually loads/unloads TinyMCE I have to assume that it is a MODx feature.

        • Not really; it's Javascript. The button unloads/loads the editor in the browser. Loading the resource again loads it in its default state.

          You could put <div> tags around the MODx tags to satisfy the RTE.

          I don't see how the status could be stored in the cookie like the tabs are in some cases; that would really load up the cookie with resource/RTE status information, as it would have to be stored for every resource.

          In Evo there is a field in the user's User tab for which editor the user will use that can be set to "none". Of course, that means the editor won't be available to that user at all. Or, you could have the offending resource not use the RTE at all.

          The problem is, when the resource is loaded into the Manager for editing, if the RTE is enabled for it, it will "fix" the content as soon as the page loads and the javascript runs. If you're going to have the RTE running on the resource at any point by any user, it will immediately "fix" the content. There's nothing to be done about it, short of not using the RTE for that resource or disabling the forced-root-block feature altogether.

          I suppose it would be possible to create a plugin to selectively disable the RTE for a specific user on a specific resource, or perhaps even to modify the RTE configuration for a specified resource; I don't know how that would work for Revo though.

          Another option is to hack TinyMCE to not put the tags around MODx tags and image tags, but I know I sure would hate to try to tackle that job.
            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
            • 3749
            • 24,544 Posts
            You could also do it with a plugin connected to OnDocFormSave that calls str_replace() or preg_replace() to remove the unwanted tags.
              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
            • That's an even better idea!
                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
              • discuss.answer
                • 36666
                • 19 Posts
                I must apologize for not seeing this sooner. My issue is resolved.
                In the Page Settings for each individual resource there is a checkbox entitled Rich Text.
                Toggling this checkbox enables / disables TinyMCE for the resource.




                Thanks Susan and BobRay for taking your time to help.