From 2d7b4ff03fc5a4ee4705698d96ad377b5f81a65c Mon Sep 17 00:00:00 2001
From: Aleksander Machniak <alec@alec.pl>
Date: Mon, 28 May 2012 02:36:28 -0400
Subject: [PATCH] Fix html2text conversion of strong|b|a|th|h tags when used in upper case

---
 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 604da8b..2dd4c69 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();

--
Gitblit v1.9.1