diff options
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 | 16 |
1 files changed, 9 insertions, 7 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 604da8b42..2dd4c6960 100644 --- a/program/js/tiny_mce/plugins/autolink/editor_plugin_src.js +++ b/program/js/tiny_mce/plugins/autolink/editor_plugin_src.js @@ -22,15 +22,15 @@ init : function(ed, url) { var t = this; - // Internet Explorer has built-in automatic linking - if (tinyMCE.isIE) - return; - // Add a key down handler - ed.onKeyDown.add(function(ed, e) { + ed.onKeyDown.addToTop(function(ed, e) { if (e.keyCode == 13) return t.handleEnter(ed); - }); + }); + + // Internet Explorer has built-in automatic linking for most cases + if (tinyMCE.isIE) + return; ed.onKeyPress.add(function(ed, e) { if (e.which == 41) @@ -125,11 +125,13 @@ } text = r.toString(); - matches = text.match(/^(https?:\/\/|ssh:\/\/|ftp:\/\/|file:\/|www\.)(.+)$/i); + matches = text.match(/^(https?:\/\/|ssh:\/\/|ftp:\/\/|file:\/|www\.|[A-Z0-9._%+-]+@)(.+)$/i); if (matches) { if (matches[1] == 'www.') { matches[1] = 'http://www.'; + } else if (/@$/.test(matches[1])) { + matches[1] = 'mailto:' + matches[1]; } bookmark = ed.selection.getBookmark(); |