diff --git a/core/modules/widgets/dropzone.js b/core/modules/widgets/dropzone.js index 2702c0ec7..5ce9e9f3a 100644 --- a/core/modules/widgets/dropzone.js +++ b/core/modules/widgets/dropzone.js @@ -90,8 +90,8 @@ DropZoneWidget.prototype.handleDropEvent = function(event) { // Try to import the various data types we understand this.importData(dataTransfer); // Import any files in the drop - this.wiki.readFiles(dataTransfer.files,function(tiddlerFields) { - self.dispatchEvent({type: "tw-import-tiddlers", param: JSON.stringify([tiddlerFields])}); + this.wiki.readFiles(dataTransfer.files,function(tiddlerFieldsArray) { + self.dispatchEvent({type: "tw-import-tiddlers", param: JSON.stringify(tiddlerFieldsArray)}); }); // Tell the browser that we handled the drop event.preventDefault(); diff --git a/core/modules/wiki.js b/core/modules/wiki.js index 13edbfa83..cf9f74973 100755 --- a/core/modules/wiki.js +++ b/core/modules/wiki.js @@ -1024,16 +1024,23 @@ exports.getTiddlerText = function(title,defaultText) { }; /* -Read an array of browser File objects, invoking callback(tiddlerFields) for each loaded file +Read an array of browser File objects, invoking callback(tiddlerFieldsArray) once they're all read */ exports.readFiles = function(files,callback) { + var result = [], + outstanding = files.length; for(var f=0; f