views:

2397

answers:

1

I'm using TinyMCE to provide users the capability of simple text formatting (bold, italics, lists) on a textarea form field. Everthing is working properly except that in Internet Explorer (8 but I've read it happens on earlier versions), when users type a URL (e.g. www.google.com) it is automatically converted into an HTML link in the TinyMCE editor as they type. This does not happen in Firefox (3). How can I prevent IE from doing this?

I've initialized TinyMCE with the following:

tinyMCE.init({
    mode : "textareas",
    theme : "simple",
    convert_urls : false
 });

But I don't think convert_urls is intended to affect the behavior I'm describing: http://wiki.moxiecode.com/index.php/TinyMCE:Configuration/convert_urls

I tried:

function myCustomURLConverter(url, node, on_save) {
    return url;
}

tinyMCE.init({
    mode : "textareas",
    theme : "simple",
    urlconverter_callback : "myCustomURLConverter"
 });

But similarly I think this is just a way to affect how/whether URLs are converted upon load/save, not to prevent them from being converted to links as users type: http://wiki.moxiecode.com/index.php/TinyMCE:Configuration/urlconverter_callback

The issue I'm trying to fix is described in at least a couple of places: http://tinymce.moxiecode.com/punbb/viewtopic.php?id=2182&p=1 (third post, by tommya) http://drupal.org/node/149511

Has anyone seen this before or have any suggestions on how to fix it? The TinyMCE code-base is pretty big and difficult to trace so I was hoping someone could help me isolate the issue a bit.

+3  A: 

Doesn't seem to be a way to disable that in IE. It seems to be a 'feature' and it occurs on FCKEditor too. A couple alternatives, remove the element out of the valid elements. http://wiki.moxiecode.com/index.php/TinyMCE:Configuration/valid_elements

Or do a serverside tag parse to remove it.

I think this may be the 'feature' http://msdn.microsoft.com/en-us/library/aa769893(VS.85).aspx

And here maybe a hint in getting it to work, but it looked like ActiveX and VB so I got lost pretty quick in my experiment http://www.mindfrost82.com/showpost.php?p=1114381&postcount=2

joelpittet
I disabled anchor tags by allowing only simple formatting tags in the init: valid_elements : "strong/b,em/i,p,br,ul,ol,li,strike"This didn't prevent IE from doing the initial conversion but at least it prevents the link from being saved to the database. Thanks for the help Joel!
jlpp