Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

BUGFIX: SSF-38 making the entwine selector for the upload field more …

…specific, so it doesn't apply to every upload field in the CMS. Also, handling the case of uploading multiple files at once
  • Loading branch information...
commit 21109067152bda636d4217d565222c989e6a1350 1 parent 98e197a
@candidasa candidasa authored
Showing with 17 additions and 7 deletions.
  1. +17 −7 javascript/HtmlEditorField.js
View
24 javascript/HtmlEditorField.js
@@ -699,7 +699,7 @@ ss.editorWrappers['default'] = ss.editorWrappers.tinyMCE;
/**
* Show the second step after uploading an image
*/
- $('.ss-assetuploadfield').entwine({
+ $('form.htmleditorfield-form.htmleditorfield-mediaform div.ss-assetuploadfield').entwine({
onmatch: function() {
this._super();
@@ -708,13 +708,23 @@ ss.editorWrappers['default'] = ss.editorWrappers.tinyMCE;
},
onfileuploadstop: function(e) {
- //get the uploaded file ID when this event triggers, signaling the upload has compeleted successfully
- //always use the last one uploaded
- var uploadedFileID = $('ul.ss-uploadfield-files').children('li.ss-uploadfield-item').last().data('fileid');
-
- //trigger the detail view for filling out details about the file we are about to insert into TinyMCE
var form = this.closest('form');
- form.closest('form').showFileView(uploadedFileID);
+
+ //update the editFields to show those Files that are newly uploaded
+ var editFieldIDs = [];
+ form.find('div.content-edit').find('div.ss-htmleditorfield-file').each(function(){
+ //get the uploaded file ID when this event triggers, signaling the upload has compeleted successfully
+ editFieldIDs.push($(this).data('id'));
+ });
+ var uploadedFiles = $('ul.ss-uploadfield-files').children('li.ss-uploadfield-item');
+ uploadedFiles.each(function(){
+ var uploadedID = $(this).data('fileid');
+ if ($.inArray(uploadedID, editFieldIDs) == -1) {
+ //trigger the detail view for filling out details about the file we are about to insert into TinyMCE
+ form.showFileView(uploadedID);
+ }
+ });
+
form.redraw();
}
Please sign in to comment.
Something went wrong with that request. Please try again.