Quote from: zi at Nov 05, 2006, 09:31 AMIE 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
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.
I’ll try that and report, Paul, thanks for the suggestion...
.: COO - Commerce Guys - Community Driven Innovation :.
MODx est l'outil id
-
☆ 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
.: COO - Commerce Guys - Community Driven Innovation :.
MODx est l'outil id
-
☆ 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

:
<?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);
}
}
}
?>
You the man Gildas! It worked like a charm, tested in IE6,7 FF2.0
Thanks a ton for the fix.
best regards,
zi
Hello,
Do you think it’s possible to disable WYSIWYG option when the editor is not use ?
thank’s
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?