We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 4757
    • 64 Posts
    I'm using TinyMCE for WYSIWYG editing for my content areas.

    There are a couple areas on my site where I'm making a getResouces call that includes content but I want to strip out the WYSIWYG formatting and style it with CSS for those specific instances. This seems like something that would be simple to do but I can't seem to figure it out. Any ideas?
      • 31104
      • 108 Posts
      If I'm not getting the wrong idea of what you need and all you need is to display a portion of each resource, just have getResources display output with a template:

      &tpl=`myRowTpl`


      Then just use something like this in your myRowTpl chunk:

      <div class="list-item">
      
      <a href="[[~[[+id]]]]" title="[[+pagetitle]]"> 
      <h4>[[+pagetitle]]</h4>
      </a>   
      <p>[[+introtext]]</p> 
      
      </div>
      


      That way you use the introtext field in each resource (which is not RT formatted)


        • 4757
        • 64 Posts
        you are correct and that is a solution but I'm not using the "introtext" area anywhere else in the site, and it's just more instructions to give to the client.

        I have a template setup as you stated but it just wraps the RT formatted text inside it. I really want to use the "content" area for my clients sake. If it's not possible I'll use "introtext".
          • 3749
          • 24,544 Posts
          If the client is using TinyMCE to edit the content field, the richtext content is what's stored in the DB for that field. Your only options are:

          1. Write CSS that handles the richtext content (TinyMCE's output is standard HTML).
          2. Use the stripTags output modifier and have no formatting at all (i.e. raw text).
          3. Convince the client to give up TinyMCE.

          If you can teach the client not to use the enter key except at the end of a paragraph and leave a blank line between paragraphs, #3 might work for you.

          I've actually had some luck getting clients to write in raw HTML using only a handful of tags. You can also try getting the client to use an HTML (non-rich-text) editor that will check the code for them and have them paste the results into the content field. I think the FF add-on "It's All Text" will do that also -- it would let them edit the content in place in the Manager (sort of).

          You might also be able to customize TinyMCE to restrict them to a small number of possible tags.


          ------------------------------------------------------------------------------------------
          PLEASE, PLEASE specify the version of MODX you are using.
          MODX info for everyone: http://bobsguides.com/modx.html
            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
            • 1778
            • 659 Posts
            @Bob

            3. Convince the client to give up TinyMCE.

            It would be so great... but clients with no HTML skill want to have a kind of WYSIWYG editor.... Do you have a "magic formula" to convince them to give up RTE's ?
            Cheers
              • 19369
              • 1,098 Posts
              Use this:
              [[+content:striptags]]


              You can also use a combination of striptags + ellipsis to strip tags and make it shorter at the same time:
              [[+content:striptags:ellipsis=`250`]]


              Documentation: http://rtfm.modx.com/display/revolution20/Input+and+Output+Filters+(Output+Modifiers)#InputandOutputFilters%28OutputModifiers%29-Stringoutputmodifiers


              3. Convince the client to give up TinyMCE.
              I disagree. The customer shouldn't have to learn html, although it may be beneficial. The WYSIWYG Editor is supposed to help you editing the content. I think many people don't know how to use it and therefore they blame the script. I think TinyMCE is a really good script when you learn how to use it.
                • 4757
                • 64 Posts
                looks like striptags is exactly what I was looking for. Thanks!