diff --git a/www/extras/htmlArea/editor.js b/www/extras/htmlArea/editor.js index 92af76ae3..efd152fed 100644 --- a/www/extras/htmlArea/editor.js +++ b/www/extras/htmlArea/editor.js @@ -564,6 +564,19 @@ oTags[i].outerHTML = oTags[i].innerHTML; var tar_attribute = ''; var linkText = ''; +// inserted by agraf + // a few tests. + var elmSelectedImage; + var htmlSelectionControl = "Control"; + var grngMaster = editdoc.selection.createRange(); + if (editdoc.selection.type == htmlSelectionControl) { + // alright! here we have an image. + elmSelectedImage = grngMaster.item(0); + highlightedText = elmSelectedImage.outerHTML; + } + + else { // else NOT an image +// end inserted by agraf if (editdoc.selection.createRange().parentElement().outerHTML.search(/^\<[A|a]/) != -1) { var fullElement = editdoc.selection.createRange().parentElement().outerHTML; @@ -590,6 +603,9 @@ oTags[i].outerHTML = oTags[i].innerHTML; linkText = lt[0]; } +// inserted by agraf + } +// end inserted by agraf var myValues = new Object(); myValues.highlightedText = highlightedText; @@ -606,7 +622,14 @@ oTags[i].outerHTML = oTags[i].innerHTML; } } else { - if (myText) { editor_insertHTML(objname, unescape(myText) ); } // this function ALWAYS puts in an absolute link +// modified by agraf + if (myText) { + if (editdoc.selection.type == htmlSelectionControl) { + grngMaster.execCommand('Delete'); + } + editor_insertHTML(objname, unescape(myText) ); // this function ALWAYS puts in an absolute link + } +// end modified by agraf } } @@ -1280,6 +1303,9 @@ function editor_filterOutput(objname) { var matchTag = /<\/?(\w+)((?:[^'">]*|'[^']*'|"[^"]*")*)>/g; // this will match tags, but still doesn't handle container tags (textarea, comments, etc) contents = contents.replace(matchTag, filterTag); +// inserted by agraf + contents = contents.replace(/http:\/\/www\.___relativelink___\.com\//g, ""); +// end inserted by agraf // remove nextlines from output (if requested) if (config.replaceNextlines) {