mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2025-11-17 07:47:24 +00:00
Improvements for #1483
* Rename the global to $tw.dragInProgress for clarity. * Abort the dragenter so that we don’t get extraneous feedback during the drag
This commit is contained in:
@@ -53,6 +53,10 @@ DropZoneWidget.prototype.render = function(parent,nextSibling) {
|
||||
};
|
||||
|
||||
DropZoneWidget.prototype.enterDrag = function() {
|
||||
// Check for this window being the source of the drag
|
||||
if($tw.dragInProgress) {
|
||||
return false;
|
||||
}
|
||||
// We count enter/leave events
|
||||
this.dragEnterCount = (this.dragEnterCount || 0) + 1;
|
||||
// If we're entering for the first time we need to apply highlighting
|
||||
@@ -83,6 +87,10 @@ DropZoneWidget.prototype.handleDragOverEvent = function(event) {
|
||||
if(["TEXTAREA","INPUT"].indexOf(event.target.tagName) !== -1) {
|
||||
return false;
|
||||
}
|
||||
// Check for this window being the source of the drag
|
||||
if($tw.dragInProgress) {
|
||||
return false;
|
||||
}
|
||||
// Tell the browser that we're still interested in the drop
|
||||
event.preventDefault();
|
||||
event.dataTransfer.dropEffect = "copy"; // Explicitly show this is a copy
|
||||
@@ -98,6 +106,10 @@ DropZoneWidget.prototype.handleDropEvent = function(event) {
|
||||
if(["TEXTAREA","INPUT"].indexOf(event.target.tagName) !== -1) {
|
||||
return false;
|
||||
}
|
||||
// Check for this window being the source of the drag
|
||||
if($tw.dragInProgress) {
|
||||
return false;
|
||||
}
|
||||
var self = this,
|
||||
dataTransfer = event.dataTransfer;
|
||||
// Reset the enter count
|
||||
@@ -134,10 +146,6 @@ 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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user