diff options
author | Aleksander Machniak <alec@alec.pl> | 2012-06-01 08:56:31 +0200 |
---|---|---|
committer | Aleksander Machniak <alec@alec.pl> | 2012-06-01 08:59:01 +0200 |
commit | 3a6ca5b68d090b3637cb925a4442f5990327a2b3 (patch) | |
tree | 554fd6d8ded99d36dd2201bf0ed3fdb775928f6a /program/js/tiny_mce/plugins/autolink/editor_plugin_src.js | |
parent | a15c0aa218fabd2de93e962dc7c697c4bf7ce72f (diff) |
Update to TinyMCE 3.5.2
Diffstat (limited to 'program/js/tiny_mce/plugins/autolink/editor_plugin_src.js')
-rw-r--r-- | program/js/tiny_mce/plugins/autolink/editor_plugin_src.js | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/program/js/tiny_mce/plugins/autolink/editor_plugin_src.js b/program/js/tiny_mce/plugins/autolink/editor_plugin_src.js index 2dd4c6960..8c1cd6881 100644 --- a/program/js/tiny_mce/plugins/autolink/editor_plugin_src.js +++ b/program/js/tiny_mce/plugins/autolink/editor_plugin_src.js @@ -61,7 +61,7 @@ // We need at least five characters to form a URL, // hence, at minimum, five characters from the beginning of the line. - r = ed.selection.getRng().cloneRange(); + r = ed.selection.getRng(true).cloneRange(); if (r.startOffset < 5) { // During testing, the caret is placed inbetween two text nodes. // The previous text node contains the URL. @@ -124,13 +124,19 @@ r.setEnd(endContainer, start); } + // Exclude last . from word like "www.site.com." + var text = r.toString(); + if (text.charAt(text.length - 1) == '.') { + r.setEnd(endContainer, start - 1); + } + text = r.toString(); - matches = text.match(/^(https?:\/\/|ssh:\/\/|ftp:\/\/|file:\/|www\.|[A-Z0-9._%+-]+@)(.+)$/i); + matches = text.match(/^(https?:\/\/|ssh:\/\/|ftp:\/\/|file:\/|www\.|(?:mailto:)?[A-Z0-9._%+-]+@)(.+)$/i); if (matches) { if (matches[1] == 'www.') { matches[1] = 'http://www.'; - } else if (/@$/.test(matches[1])) { + } else if (/@$/.test(matches[1]) && !/^mailto:/.test(matches[1])) { matches[1] = 'mailto:' + matches[1]; } @@ -139,6 +145,7 @@ ed.selection.setRng(r); tinyMCE.execCommand('createlink',false, matches[1] + matches[2]); ed.selection.moveToBookmark(bookmark); + ed.nodeChanged(); // TODO: Determine if this is still needed. if (tinyMCE.isWebKit) { |