From dc2396352538eb549f02f32f022708283ff2254d Mon Sep 17 00:00:00 2001 From: Tobias Beer Date: Tue, 10 Feb 2015 23:34:37 +0100 Subject: [PATCH] using $tw.dragging to prevent dnd in same window Anything missing? --- core/modules/widgets/dropzone.js | 4 ++++ core/modules/widgets/link.js | 2 ++ 2 files changed, 6 insertions(+) diff --git a/core/modules/widgets/dropzone.js b/core/modules/widgets/dropzone.js index b0f7510fe..34ae850d8 100644 --- a/core/modules/widgets/dropzone.js +++ b/core/modules/widgets/dropzone.js @@ -134,6 +134,10 @@ DropZoneWidget.prototype.importData = function(dataTransfer) { if(!tiddlerFields.title) { tiddlerFields.title = this.wiki.generateNewTitle("Untitled"); } + if($tw.dragging) { + $tw.dragging = false; + return false; + } this.dispatchEvent({type: "tm-import-tiddlers", param: JSON.stringify([tiddlerFields])}); return; } diff --git a/core/modules/widgets/link.js b/core/modules/widgets/link.js index eac53a050..c4439ecbb 100755 --- a/core/modules/widgets/link.js +++ b/core/modules/widgets/link.js @@ -126,6 +126,7 @@ LinkWidget.prototype.handleClickEvent = function(event) { LinkWidget.prototype.handleDragStartEvent = function(event) { if(event.target === this.domNodes[0]) { if(this.to) { + $tw.dragging = true; // Set the dragging class on the element being dragged $tw.utils.addClass(event.target,"tc-tiddlylink-dragging"); // Create the drag image elements @@ -173,6 +174,7 @@ LinkWidget.prototype.handleDragStartEvent = function(event) { LinkWidget.prototype.handleDragEndEvent = function(event) { if(event.target === this.domNodes[0]) { + $tw.dragging = false; // Remove the dragging class on the element being dragged $tw.utils.removeClass(event.target,"tc-tiddlylink-dragging"); // Delete the drag image element