X-Git-Url: https://code.citadel.org/?p=citadel.git;a=blobdiff_plain;f=webcit%2Ftiny_mce%2Fplugins%2Fadvlink%2Fjs%2Fadvlink.js;h=837c937c6606f8476b66cfa21e6fd8e509fc0c7c;hp=b78e82f76bca113193546ea8bc142c4c62528a35;hb=b05f4eef4014db3885787ef15107cba93c932ac9;hpb=b347fec899815ec89b2738a0877880ee81e74b59 diff --git a/webcit/tiny_mce/plugins/advlink/js/advlink.js b/webcit/tiny_mce/plugins/advlink/js/advlink.js index b78e82f76..837c937c6 100644 --- a/webcit/tiny_mce/plugins/advlink/js/advlink.js +++ b/webcit/tiny_mce/plugins/advlink/js/advlink.js @@ -30,8 +30,6 @@ function init() { document.getElementById('hrefbrowsercontainer').innerHTML = getBrowserHTML('hrefbrowser','href','file','advlink'); document.getElementById('popupurlbrowsercontainer').innerHTML = getBrowserHTML('popupurlbrowser','popupurl','file','advlink'); - document.getElementById('linklisthrefcontainer').innerHTML = getLinkListHTML('linklisthref','href'); - document.getElementById('anchorlistcontainer').innerHTML = getAnchorListHTML('anchorlist','href'); document.getElementById('targetlistcontainer').innerHTML = getTargetListHTML('targetlist','target'); // Link list @@ -41,6 +39,13 @@ function init() { else document.getElementById("linklisthrefcontainer").innerHTML = html; + // Anchor list + html = getAnchorListHTML('anchorlist','href'); + if (html == "") + document.getElementById("anchorlistrow").style.display = 'none'; + else + document.getElementById("anchorlistcontainer").innerHTML = html; + // Resize some elements if (isVisible('hrefbrowser')) document.getElementById('href').style.width = '260px'; @@ -360,20 +365,22 @@ function setAttrib(elm, attrib, value) { } function getAnchorListHTML(id, target) { - var inst = tinyMCEPopup.editor; - var nodes = inst.dom.select('a.mceItemAnchor,img.mceItemAnchor'), name, i; - var html = ""; - - html += ''; + if (html == "") + return ""; + + html = ''; return html; } @@ -389,7 +396,6 @@ function insertAction() { // 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); @@ -398,12 +404,10 @@ function insertAction() { return; } - tinyMCEPopup.execCommand("mceBeginUndoLevel"); - // Create new anchor elements if (elm == null) { inst.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}); elementArray = tinymce.grep(inst.dom.select("a"), function(n) {return inst.dom.getAttrib(n, 'href') == '#mce_temp_url#';}); for (i=0; i