We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 33997
    • 150 Posts
    As of yet I have been hesitant to use TinyMCE, as I know that most WYSIWYG editors spit out really bad code. I would like to start using TinyMCE more for the end user, but I haven’t taken that plunge yet. I would want to really learn how to fully customize it before including it - for instance, making it insert ’strong’ instead of ’b’ tags, and ’em’ instead of ’i’ tags. I’ve seen that it should allow me to customize it, add in stylesheets, allow end users to choose class styles and apply them to pieces of the page, but I haven’t started messing with it yet. Has anybody done this with any success? Do you know of any good resources I could use to get a jumpstart? Thanks in advance for your help!
      "Great spirits have always encountered violent opposition from mediocre minds." -Albert Einstein
      • 3749
      • 24,544 Posts
      It is possible to get TinyMCE to read and use your own CSS file. I did it once a long time ago, but can’t remember how it’s done.

      As for <b> and <i>, it may be possible, but I think it might be easier to just write a plugin attached to OnDocFormSave using str_replace() to convert them -- something like this:

      <?php
      $fields = array('<b>',  '</b>', '<i>' , '</i>');
      $values = array('<strong>', '</strong>', '<em>', '</em>');
      $output = $resource->getContent();
      $output = str_replace($fields, $values, $output);
      $resource->setContent($output);
      
        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
        • 33997
        • 150 Posts
        Well, that is good to begin with, thanks Bob! There are single quotes missing from there, to anyone using the code.
          "Great spirits have always encountered violent opposition from mediocre minds." -Albert Einstein
          • 3749
          • 24,544 Posts
          I think it’’s fixed now.
            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
            • 33997
            • 150 Posts
            Looks great! I only noticed cause of syntax highlighting wink. That should really help out....that will cause the string replace to happen as the doc is saving, and then when TinyMCE pulls it up again, it will leave the tags as strong/em, right?
              "Great spirits have always encountered violent opposition from mediocre minds." -Albert Einstein
              • 3749
              • 24,544 Posts
              Quote from: goonz at Mar 22, 2011, 11:58 PM

              Looks great! I only noticed cause of syntax highlighting wink. That should really help out....that will cause the string replace to happen as the doc is saving, and then when TinyMCE pulls it up again, it will leave the tags as strong/em, right?

              We can hope. wink

              Not to start a religious argument here, but personally I prefer using <b> and <i> since they stand for bold and italic and that’s what I actually want displayed when I use them.
                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
                • 33997
                • 150 Posts
                I hear. The original book I read to brush up when I was getting back into websites was adamantly against using any type of styling in html, according to them, it should all be done via CSS, but I’m on the fence as of now - if something should be bold, <b> makes more semantic sense than <strong> unless that passage needs to be strong as well....
                  "Great spirits have always encountered violent opposition from mediocre minds." -Albert Einstein