includes/clientside/tinymce/plugins/advlink/js/advlink.js
changeset 395 fa4c5ecb7c9a
parent 335 67bd3121a12e
child 459 31c23016ab62
--- a/includes/clientside/tinymce/plugins/advlink/js/advlink.js	Thu Jan 31 22:29:07 2008 -0500
+++ b/includes/clientside/tinymce/plugins/advlink/js/advlink.js	Sat Feb 02 11:54:16 2008 -0500
@@ -114,7 +114,7 @@
 }
 
 function checkPrefix(n) {
-	if (Validator.isEmail(n) && !/^\s*mailto:/i.test(n.value) && confirm(tinyMCEPopup.getLang('advlink_dlg.is_email')))
+	if (n.value && Validator.isEmail(n) && !/^\s*mailto:/i.test(n.value) && confirm(tinyMCEPopup.getLang('advlink_dlg.is_email')))
 		n.value = 'mailto:' + n.value;
 
 	if (/^\s*www./i.test(n.value) && confirm(tinyMCEPopup.getLang('advlink_dlg.is_external')))
@@ -358,13 +358,13 @@
 		if (attrib == "style")
 			attrib = "style.cssText";
 
-		if (attrib.substring(0, 2) == 'on')
-			value = 'return true;' + value;
+//		if (attrib.substring(0, 2) == 'on')
+//			value = 'return true;' + value;
 
 		if (attrib == "class")
 			attrib = "className";
 
-		eval('elm.' + attrib + "=value;");
+		elm[attrib] = value;
 	} else
 		elm.removeAttribute(attrib);
 }
@@ -396,6 +396,18 @@
 	checkPrefix(document.forms[0].href);
 
 	elm = inst.dom.getParent(elm, "A");
+
+	// Remove element if there is no href
+	if (!document.forms[0].href.value) {
+		tinyMCEPopup.execCommand("mceBeginUndoLevel");
+		i = inst.selection.getBookmark();
+		inst.dom.remove(elm, 1);
+		inst.selection.moveToBookmark(i);
+		tinyMCEPopup.execCommand("mceEndUndoLevel");
+		tinyMCEPopup.close();
+		return;
+	}
+
 	tinyMCEPopup.execCommand("mceBeginUndoLevel");
 
 	// Create new anchor elements