From f4b27b33deb10772d0a7cd086edf4788bae069d9 Mon Sep 17 00:00:00 2001 From: Jermolene Date: Fri, 24 Jan 2014 14:09:06 +0000 Subject: [PATCH] Fixed problem with multiple tiddlers created from dragging a single file --- core/modules/widgets/dropzone.js | 8 +++++--- core/modules/wiki.js | 1 + 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/core/modules/widgets/dropzone.js b/core/modules/widgets/dropzone.js index 5ce9e9f3a..3d1ca304d 100644 --- a/core/modules/widgets/dropzone.js +++ b/core/modules/widgets/dropzone.js @@ -87,12 +87,14 @@ DropZoneWidget.prototype.handleDropEvent = function(event) { this.dragEnterCount = 0; // Remove highlighting $tw.utils.removeClass(this.domNodes[0],"tw-dragover"); - // Try to import the various data types we understand - this.importData(dataTransfer); // Import any files in the drop - this.wiki.readFiles(dataTransfer.files,function(tiddlerFieldsArray) { + var numFiles = this.wiki.readFiles(dataTransfer.files,function(tiddlerFieldsArray) { self.dispatchEvent({type: "tw-import-tiddlers", param: JSON.stringify(tiddlerFieldsArray)}); }); + // Try to import the various data types we understand + if(numFiles === 0) { + this.importData(dataTransfer); + } // Tell the browser that we handled the drop event.preventDefault(); // Stop the drop ripple up to any parent handlers diff --git a/core/modules/wiki.js b/core/modules/wiki.js index 5c21f01d9..2a9a892ae 100755 --- a/core/modules/wiki.js +++ b/core/modules/wiki.js @@ -1045,6 +1045,7 @@ exports.readFiles = function(files,callback) { } }); }; + return files.length; }; /*