diff --git a/scripts/ckeditor/plugins/dndfiles/plugin.js b/scripts/ckeditor/plugins/dndfiles/plugin.js
index c2a6335b..4cbd88d3 100755
--- a/scripts/ckeditor/plugins/dndfiles/plugin.js
+++ b/scripts/ckeditor/plugins/dndfiles/plugin.js
@@ -74,40 +74,24 @@ CKEDITOR.plugins.add( 'dndfiles', {
}
}
- // This function is called when the upload of files succedes. Displays uploaded images
- // into img tags and everything else as an tag
- function uploadSuccess(data) {
- // End the progress bar
- progressJs().end();
-
- var html = '';
- for(var idx = 0; idx < data.attachments.length; idx++) {
- var att = data.attachments[idx];
- var name = att.fullName;
-
- // this is an image and it has a thumbnail
- if(att.thumbName) {
- html += '
';
- } else { // this is not an image
- html += " tag
+ success: function(data) {
+ var html = '';
+
+ // Extract the last attachment section of the returned page
+ var attch = $(".attachment", $(data)).slice(-files.length);
+
+ // Create a new attachment section that will replace the current one
+ var attch_upload = $("#attachment_upload", $(data));
+
+ $("input", attch).each(function() {
+
+ // Extract the url of the file
+ var src = $(this)[0].defaultValue;
+
+ // Ignore inputs that have this value as it is not needed
+ if(src === "Delete")
+ return;
+
+ if(src.indexOf(".png") >= 0 || src.indexOf(".jpg") >= 0 || src.indexOf(".jpeg") >= 0) { // This is an image
+ html += '
';
+ } else { // this is not an image
+ // Server appends 14 characters in front of the name so we should remove them
+ var server_suffix = 14;
+ html += "