X-Git-Url: http://git.roojs.org/?p=roojs1;a=blobdiff_plain;f=Roo%2Fform%2FHtmlEditor%2FToolbarStandard.js;h=b58a4cfc93f4222a86bf8c084afe07cb13629cd1;hp=d054fab06b265542b42f77e85efa5334657164e4;hb=e28295d9bf2622b5292557e0935b71b03f537647;hpb=f2689269a2a28287e338dbca978ed7bbeaf2c060 diff --git a/Roo/form/HtmlEditor/ToolbarStandard.js b/Roo/form/HtmlEditor/ToolbarStandard.js index d054fab06b..b58a4cfc93 100644 --- a/Roo/form/HtmlEditor/ToolbarStandard.js +++ b/Roo/form/HtmlEditor/ToolbarStandard.js @@ -526,15 +526,41 @@ Roo.form.HtmlEditor.ToolbarStandard.prototype = { createLink : function(){ //Roo.log("create link?"); var ec = this.editorcore; - (function() { - Roo.MessageBox.prompt("Add Link URL",this.createLinkText, function(btn, url) { - if (btn != 'ok') { - return; - } - if(url && url != 'http:/'+'/'){ - ec.relayCmd('createlink', url); - } + var ar = ec.getAllAncestors(); + var n = false; + for(var i = 0;i< ar.length;i++) { + if (ar[i] && ar[i].nodeName == 'A') { + n = ar[i]; + break; + } + } + + (function() { + + Roo.MessageBox.show({ + title : "Add / Edit Link URL", + msg : "Enter the url for the link", + buttons: Roo.MessageBox.OKCANCEL, + fn: function(btn, url){ + if (btn != 'ok') { + return; + } + if(url && url != 'http:/'+'/'){ + if (n) { + n.setAttribute('href', url); + } else { + ec.relayCmd('createlink', url); + } + } + }, + minWidth:250, + prompt:true, + //multiline: multiline, + modal : true, + value : n ? n.getAttribute('href') : '' }); + + }).defer(100, this); // we have to defer this , otherwise the mouse click gives focus to the main window. },