fixed insert issue

This commit is contained in:
Andreas Stephanides
2014-03-16 14:15:06 +01:00
parent 286fb014d2
commit 0959cb067d

View File

@@ -30,10 +30,20 @@ function insertAttachment(url,name) {
var ext = url.split('.').pop().toLowerCase(); var ext = url.split('.').pop().toLowerCase();
var img_ext = [ "jpg", "png", "bmp" , "jpeg" ]; var img_ext = [ "jpg", "png", "bmp" , "jpeg" ];
// if ( img_ext.indexOf(ext) > -1) {
// tinymce.activeEditor.setContent(tinymce.activeEditor.getContent({format : 'raw'}) + "<img src=\"" + url + "\" title=\"" + name + "\">");
// }
// else {
// tinymce.activeEditor.setContent(tinymce.activeEditor.getContent({format : 'raw'}) + "<a href=\"" + url + "\">" + name +"</a>");
// }
if ( img_ext.indexOf(ext) > -1) { if ( img_ext.indexOf(ext) > -1) {
tinymce.activeEditor.setContent(tinymce.activeEditor.getContent({format : 'raw'}) + "<img src=\"" + url + "\" title=\"" + name + "\">"); tinymce.activeEditor.execCommand('mceInsertContent', false, "<img src=\"" + url + "\" title=\"" + name + "\">");
} }
else { else {
tinymce.activeEditor.setContent(tinymce.activeEditor.getContent({format : 'raw'}) + "<a href=\"" + url + "\">" + name +"</a>"); tinymce.activeEditor.execCommand('mceInsertContent', false, "<a href=\"" + url + "\">" + name +"</a>");
} }
} }