Handle non-image uploads correctly
This commit is contained in:
@@ -217,7 +217,15 @@
|
||||
type: 'POST',
|
||||
success: function(){
|
||||
$editorBody.removeClass('uploading');
|
||||
var text = '[[/' + uploadDest + '/' + file.name + ']]';
|
||||
var ext = file.name.split('.').pop().toLowerCase()
|
||||
var image_ext = ['jpg', 'jpeg', 'tif', 'tiff', 'png', 'gif', 'svg', 'bmp']
|
||||
// Link directly to image files
|
||||
if ((image_ext.indexOf(ext) > -1)) {
|
||||
var text = '[[/' + uploadDest + '/' + file.name + ']]';
|
||||
} else {
|
||||
// Add file name to tag for non-image files, to avoid broken image thumbnail
|
||||
var text = '[[' + file.name + '|/' + uploadDest + '/' + file.name + ']]';
|
||||
}
|
||||
window.ace_editor.insert(text);
|
||||
},
|
||||
error: function(r, textStatus) {
|
||||
|
||||
Reference in New Issue
Block a user