views:

209

answers:

2

I've set up Textpattern's hak_tinymce plugin on a website I run, and it works great in Firefox, Chrome, Safari and Opera. However, in IE the content area is gray (e.g. it just isn't there), and the Javascript fails with this error:

Webpage error details

User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; WOW64; Trident/4.0; 
    SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; 
    Media Center PC 6.0)
Timestamp: Mon, 9 Feb 2009 11:35:09 UTC

Message: Invalid argument.
Line: 510
Char: 2
Code: 0
URI: http://www.example.com/textpattern/tinymce/tiny_mce.js

Firebug gives no errors.

I am using a non-obfuscated version of tiny_mce.js, revision 1.158:

// Must have a src element in MSIE HTTPs breaks aswell as absoute URLs
if (tinyMCE.isMSIE)
 iframe.setAttribute("src", this.settings['default_document']);

iframe.style.width = tinyMCE.settings['area_width'];
iframe.style.height = tinyMCE.settings['area_height']; // ** THIS LINE! **

// MSIE 5.0 issue
if (tinyMCE.isMSIE)
 replace_element.outerHTML = iframe.outerHTML;
else
 replace_element.parentNode.replaceChild(iframe, replace_element);

I have no idea what this is. The only explanation I could find online, indicates that this is related to not using the www-prefix in the URL used to access the editor, but it does not seem to matter.

How do I solve this?

+1  A: 

Well, you could try to enable MS script debugger

Ramuns Usovs
A: 

The answer turned out to be a bug in hak_tinymce, not in tinyMCE itself. hak_tinymce specifies the height of the text area in a Javascript array using quotes around the value, like this:

somesetting: "somevalue",
height:"420",

When tinyMCE tries to do arithmetic on the height value, it somehow turns into a string, when it should have been treated as an integer. The script debugger revealed the height being set to "420-42", I did not figure out how.

However, in hak_tinymce, adding the following between line 276 and 277 works:

EOF;
$js = preg_replace('/height:\"(\d+)\"/i', 'height:$1', $js); // added line
return $js;

This fixes the problem both for the body and excerpt textareas.

Vegard Larsen