equal
deleted
inserted
replaced
29 selectByValue(f, 'class_list', ed.dom.getAttrib(e, 'class')); |
29 selectByValue(f, 'class_list', ed.dom.getAttrib(e, 'class')); |
30 } |
30 } |
31 }, |
31 }, |
32 |
32 |
33 update : function() { |
33 update : function() { |
34 var f = document.forms[0], ed = tinyMCEPopup.editor, e; |
34 var f = document.forms[0], ed = tinyMCEPopup.editor, e, b; |
|
35 |
|
36 // Remove element if there is no href |
|
37 if (!f.href.value) { |
|
38 e = ed.dom.getParent(ed.selection.getNode(), 'A'); |
|
39 if (e) { |
|
40 tinyMCEPopup.execCommand("mceBeginUndoLevel"); |
|
41 b = ed.selection.getBookmark(); |
|
42 ed.dom.remove(e, 1); |
|
43 ed.selection.moveToBookmark(b); |
|
44 tinyMCEPopup.execCommand("mceEndUndoLevel"); |
|
45 tinyMCEPopup.close(); |
|
46 return; |
|
47 } |
|
48 } |
35 |
49 |
36 ed.execCommand('mceInsertLink', false, { |
50 ed.execCommand('mceInsertLink', false, { |
37 href : f.href.value, |
51 href : f.href.value, |
38 title : f.linktitle.value, |
52 title : f.linktitle.value, |
39 target : f.target_list ? f.target_list.options[f.target_list.selectedIndex].value : null, |
53 target : f.target_list ? f.target_list.options[f.target_list.selectedIndex].value : null, |
42 |
56 |
43 tinyMCEPopup.close(); |
57 tinyMCEPopup.close(); |
44 }, |
58 }, |
45 |
59 |
46 checkPrefix : function(n) { |
60 checkPrefix : function(n) { |
47 if (Validator.isEmail(n) && !/^\s*mailto:/i.test(n.value) && confirm(tinyMCEPopup.getLang('advanced_dlg.link_is_email'))) |
61 if (n.value && Validator.isEmail(n) && !/^\s*mailto:/i.test(n.value) && confirm(tinyMCEPopup.getLang('advanced_dlg.link_is_email'))) |
48 n.value = 'mailto:' + n.value; |
62 n.value = 'mailto:' + n.value; |
49 |
63 |
50 if (/^\s*www./i.test(n.value) && confirm(tinyMCEPopup.getLang('advanced_dlg.link_is_external'))) |
64 if (/^\s*www./i.test(n.value) && confirm(tinyMCEPopup.getLang('advanced_dlg.link_is_external'))) |
51 n.value = 'http://' + n.value; |
65 n.value = 'http://' + n.value; |
52 }, |
66 }, |