X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=program%2Fjs%2Ftiny_mce%2Fthemes%2Fadvanced%2Fjs%2Flink.js;h=53ff409e7962f0d4f2d686922e33eff2ae53714b;hb=511160353722ebec8c258ddd6fa963ec8851eede;hp=21aae6cbf88d18f497fe093e95422656365d7a15;hpb=685987db93fe029d5b7059a253b6dfcda976209c;p=roundcube.git diff --git a/program/js/tiny_mce/themes/advanced/js/link.js b/program/js/tiny_mce/themes/advanced/js/link.js index 21aae6c..53ff409 100644 --- a/program/js/tiny_mce/themes/advanced/js/link.js +++ b/program/js/tiny_mce/themes/advanced/js/link.js @@ -31,7 +31,7 @@ var LinkDialog = { }, update : function() { - var f = document.forms[0], ed = tinyMCEPopup.editor, e, b; + var f = document.forms[0], ed = tinyMCEPopup.editor, e, b, href = f.href.value.replace(/ /g, '%20'); tinyMCEPopup.restoreSelection(); e = ed.dom.getParent(ed.selection.getNode(), 'A'); @@ -39,7 +39,6 @@ var LinkDialog = { // Remove element if there is no href if (!f.href.value) { if (e) { - tinyMCEPopup.execCommand("mceBeginUndoLevel"); b = ed.selection.getBookmark(); ed.dom.remove(e, 1); ed.selection.moveToBookmark(b); @@ -49,31 +48,29 @@ var LinkDialog = { } } - tinyMCEPopup.execCommand("mceBeginUndoLevel"); - // Create new anchor elements if (e == null) { ed.getDoc().execCommand("unlink", false, null); - tinyMCEPopup.execCommand("CreateLink", false, "#mce_temp_url#", {skip_undo : 1}); + tinyMCEPopup.execCommand("mceInsertLink", false, "#mce_temp_url#", {skip_undo : 1}); tinymce.each(ed.dom.select("a"), function(n) { if (ed.dom.getAttrib(n, 'href') == '#mce_temp_url#') { e = n; ed.dom.setAttribs(e, { - href : f.href.value, + href : href, title : f.linktitle.value, - target : f.target_list ? f.target_list.options[f.target_list.selectedIndex].value : null, - 'class' : f.class_list ? f.class_list.options[f.class_list.selectedIndex].value : null + target : f.target_list ? getSelectValue(f, "target_list") : null, + 'class' : f.class_list ? getSelectValue(f, "class_list") : null }); } }); } else { ed.dom.setAttribs(e, { - href : f.href.value, + href : href, title : f.linktitle.value, - target : f.target_list ? f.target_list.options[f.target_list.selectedIndex].value : null, - 'class' : f.class_list ? f.class_list.options[f.class_list.selectedIndex].value : null + target : f.target_list ? getSelectValue(f, "target_list") : null, + 'class' : f.class_list ? getSelectValue(f, "class_list") : null }); }