In IE, TinyMCE is automatically creating hyperlinks in any text beginning with a recognized url indicator (such as http:// or www.). This causes problems with other modules such as googtube that are looking for URL addresses (not links) to process some conversions on them.

I have also made modifications to make sure that all links on my site go to new browser windows (target="_blank") but this problem with tinyMCE in IE overrides that.

Note that in Firefox, tinyMCE does not automatically make this change to links. Also, if I disable rich text in IE the links are not automatically created either, thus directing me to believe it is a problem with tinyMCE.

If anyone has an idea of how to code around this, please let me know.

Thanks.

Comments

fukamit’s picture

This is a feature of IE's contenteditable, which adds a link to a string like URL (http://..., file://..., etc.), mail address (aaa@xxx), or UNC path (\\server\path\to\file).

I don't know how to disable the feature, however I think the automatically added anchors could be removed before applying other filters by a custom input filter. The below code is an example, which also removes user-added links, though...

function remove_autolinks_filter($op, $delta = 0, $format = -1, $text = '') {
  switch ($delta) {
    case 0:
      switch ($op) {
        // remove unintended anchors before other filters tweak the text.
        case 'prepare':
          // Remove tags from links (<a href="xxx">xxx</a>) automatically added by IE.
          $text = preg_replace('`<a href="(http|https|ftp|file|mailto):([^"]+)">\1</a>`i', '\1', $text);
          return $text;
      }
      break;
  }
}
nicoloye’s picture

Issue summary: View changes
Status: Active » Closed (outdated)