includes/clientside/tinymce/themes/advanced/js/link.js
changeset 1193 e3b94bd055dc
parent 543 dffcbfbc4e59
equal deleted inserted replaced
1192:5882f0eebb34 1193:e3b94bd055dc
    51 
    51 
    52 		tinyMCEPopup.execCommand("mceBeginUndoLevel");
    52 		tinyMCEPopup.execCommand("mceBeginUndoLevel");
    53 
    53 
    54 		// Create new anchor elements
    54 		// Create new anchor elements
    55 		if (e == null) {
    55 		if (e == null) {
       
    56 			ed.getDoc().execCommand("unlink", false, null);
    56 			tinyMCEPopup.execCommand("CreateLink", false, "#mce_temp_url#", {skip_undo : 1});
    57 			tinyMCEPopup.execCommand("CreateLink", false, "#mce_temp_url#", {skip_undo : 1});
    57 
    58 
    58 			tinymce.each(ed.dom.select("a"), function(n) {
    59 			tinymce.each(ed.dom.select("a"), function(n) {
    59 				if (ed.dom.getAttrib(n, 'href') == '#mce_temp_url#') {
    60 				if (ed.dom.getAttrib(n, 'href') == '#mce_temp_url#') {
    60 					e = n;
    61 					e = n;
    61 
    62 
    62 					ed.dom.setAttribs(e, {
    63 					ed.dom.setAttribs(e, {
    63 						href : f.href.value,
    64 						href : f.href.value,
    64 						title : f.linktitle.value,
    65 						title : f.linktitle.value,
    65 						target : f.target_list ? f.target_list.options[f.target_list.selectedIndex].value : null,
    66 						target : f.target_list ? getSelectValue(f, "target_list") : null,
    66 						'class' : f.class_list ? f.class_list.options[f.class_list.selectedIndex].value : null
    67 						'class' : f.class_list ? getSelectValue(f, "class_list") : null
    67 					});
    68 					});
    68 				}
    69 				}
    69 			});
    70 			});
    70 		} else {
    71 		} else {
    71 			ed.dom.setAttribs(e, {
    72 			ed.dom.setAttribs(e, {
    72 				href : f.href.value,
    73 				href : f.href.value,
    73 				title : f.linktitle.value,
    74 				title : f.linktitle.value,
    74 				target : f.target_list ? f.target_list.options[f.target_list.selectedIndex].value : null,
    75 				target : f.target_list ? getSelectValue(f, "target_list") : null,
    75 				'class' : f.class_list ? f.class_list.options[f.class_list.selectedIndex].value : null
    76 				'class' : f.class_list ? getSelectValue(f, "class_list") : null
    76 			});
    77 			});
    77 		}
    78 		}
    78 
    79 
    79 		// Don't move caret if selection was image
    80 		// Don't move caret if selection was image
    80 		if (e.childNodes.length != 1 || e.firstChild.nodeName != 'IMG') {
    81 		if (e.childNodes.length != 1 || e.firstChild.nodeName != 'IMG') {
    90 
    91 
    91 	checkPrefix : function(n) {
    92 	checkPrefix : function(n) {
    92 		if (n.value && Validator.isEmail(n) && !/^\s*mailto:/i.test(n.value) && confirm(tinyMCEPopup.getLang('advanced_dlg.link_is_email')))
    93 		if (n.value && Validator.isEmail(n) && !/^\s*mailto:/i.test(n.value) && confirm(tinyMCEPopup.getLang('advanced_dlg.link_is_email')))
    93 			n.value = 'mailto:' + n.value;
    94 			n.value = 'mailto:' + n.value;
    94 
    95 
    95 		if (/^\s*www./i.test(n.value) && confirm(tinyMCEPopup.getLang('advanced_dlg.link_is_external')))
    96 		if (/^\s*www\./i.test(n.value) && confirm(tinyMCEPopup.getLang('advanced_dlg.link_is_external')))
    96 			n.value = 'http://' + n.value;
    97 			n.value = 'http://' + n.value;
    97 	},
    98 	},
    98 
    99 
    99 	fillFileList : function(id, l) {
   100 	fillFileList : function(id, l) {
   100 		var dom = tinyMCEPopup.dom, lst = dom.get(id), v, cl;
   101 		var dom = tinyMCEPopup.dom, lst = dom.get(id), v, cl;