We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 6726
    • 7,075 Posts
    Quote from: zi at Nov 05, 2006, 09:31 AM
    IE problem confirmed in 095RC1! It does not hide the content area in IE 6.0 XPSP2. regards.

    Confirmed, also the case with MODx 0.9.5 RC2.

    Probably has to do with the js setting the element attribute to display:none...

    $output.= 'document.getElementById(\'ta\').parentNode.parentNode.previousSibling.setAttribute(\'style\',\'display:none !important;\');';
          $output.= 'document.getElementById(\'ta\').parentNode.parentNode.setAttribute(\'style\',\'display:none !important;\');';


    For whatever reason IE does not understand it.
      .: COO - Commerce Guys - Community Driven Innovation :.


      MODx est l'outil id
      • 22815
      • 1,097 Posts
      I’m not sure why !important is there; it is my understanding that setting an attribute directly would override anything it inherited anyway. And so I think that’s the most likely issue; IE is trying to set display to "none !important" because it isn’t expecting to have to parse !important.

      So ’display:none;’ would probably work in IE; if there is some reason for including !important, then I’d suggest the clumsy ’display:none;display:none !important;’.

      Or I may be completely wrong.
        No, I don't know what OpenGeek's saying half the time either.
        MODx Documentation: The Wiki | My Wiki contributions | Main MODx Documentation
        Forum: Where to post threads about add-ons | Forum Rules
        Like MODx? donate (and/or share your resources)
        Like me? See my Amazon wishlist
        MODx "Most Promising CMS" - so appropriate!
        • 6726
        • 7,075 Posts
        I’ll try that and report, Paul, thanks for the suggestion...
          .: COO - Commerce Guys - Community Driven Innovation :.


          MODx est l'outil id
          • 10828 ☆ A M B ☆
          • 174 Posts
          In IE setAttribute() does not work when used with the style attribute. The most compatible approach is to skip setAttribute() and directly set the cssText property. So you will find hereafter an IE/FF compatible version of the HideEditor Plugin :

          Edit : The last version is here : http://modxcms.com/forums/index.php/topic,2151.msg67083.html#msg67083
            Ackwa - Web Design & Development agency | Tours - France | Follow me on Twitter...
            • 6726
            • 7,075 Posts
            Very nice Gildas !

            :D
              .: COO - Commerce Guys - Community Driven Innovation :.


              MODx est l'outil id
              • 10828 ☆ A M B ☆
              • 174 Posts
              If like me you use an "Include" snippet for your templates during development, the new version of the HideEditor is for you wink :
              <?php
              /**
               * @name       Hide Editor
               * @author     Timon Reinhard <[email protected]>
               *             Gildas         <[email protected]>
               *
               * @license    GNU General Public License
               * @version    0.3.2 - 01/12/06
               *
               * @purpose    Hides editor if active template contains no content var
               *             Listens to event 'OnDocFormRender'
               *
               * @history    [Gildas      - 0.3.1 - 01/12/06] Replace setAttribute() by style.cssText for IE compatibility
               *             [Gildas      - 0.3.2 - 01/12/06] Add support for Template load via an "Include" snippet
               * 
               * @install    - Copy and paste the plugin code (without the begin/end PHP tags)
               *             - Select the "OnDocFormRender" event
               *             - If your templates are load via an "Include" snippet then add the folowing virtual parameter "content=true"
               *
               * @see        http://www.quirksmode.org/bugreports/archives/2005/03/setAttribute_does_not_work_in_IE_when_used_with_th.html
               */
              global $content;
              
              /*
               * Collect current MODx Event
               */
              $e     = &$modx->Event;
              
              /*
               * Check the Event and the document content
               */
              if (($e->name == 'OnDocFormRender') && ($content['template'] > 0)) {
                  /*
                   * Load the document template 
                   */
                  if (($template = $modx->db->getValue("SELECT content FROM {$modx->db->config['table_prefix']}site_templates WHERE id = {$content['template']}")) !== false) {
                      /*
                       * Check for a "content" tag in the template
                       */
                      if ((strpos($template, '[*content*]') === false) && (strpos($template, '[*#content*]') === false) && (strpos($template, 'content=true') === false)) {
                          /*
                           * Create the JS code to hide the "Document area"
                           */
                          $output = '<!-- HideEditor Plugin -->';
                          $output.= '<script type="text/javascript">';
                          $output.= 'document.getElementById(\'ta\').parentNode.parentNode.previousSibling.style.cssText = \'display:none\';';
                          $output.= 'document.getElementById(\'ta\').parentNode.parentNode.style.cssText = \'display:none\';';
                          $output.= '</script>';
                          
                          /*
                           * Output the JS code 
                           */
                          $e->output($output);
                      }
                  }
              }
              ?>
                Ackwa - Web Design & Development agency | Tours - France | Follow me on Twitter...
                • 33337
                • 3,975 Posts
                You the man Gildas! It worked like a charm, tested in IE6,7 FF2.0

                Thanks a ton for the fix.

                best regards,

                zi
                  Zaigham R - MODX Professional | Skype | Email | Twitter

                  Digging the interwebs for #MODX gems and bringing it to you. modx.link
                  • 6316
                  • 92 Posts
                  Thanks A LOT for the plugin! It wins! grin
                    • 24477
                    • 41 Posts
                    Hello,

                    Do you think it’s possible to disable WYSIWYG option when the editor is not use ?

                    thank’s
                      • 16311
                      • 28 Posts
                      I’ve installed this plugin on my 0.9.5 modx installation and although currently NONE of my templates contain a [*content*] or [*#content*] tag, the content text area still shows up whenever I edit any document. I’ve made sure that I’ve ticked ’OnDocFormRender’, so does anyone have any tips to get this plugin running?