mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2024-12-25 01:20:30 +00:00
Merge pull request #1483 from tobibeer/592-no-drag-n-drop-to-same-location
prevents drag and drop import in same window
This commit is contained in:
commit
1b87d9134b
@ -134,6 +134,10 @@ DropZoneWidget.prototype.importData = function(dataTransfer) {
|
|||||||
if(!tiddlerFields.title) {
|
if(!tiddlerFields.title) {
|
||||||
tiddlerFields.title = this.wiki.generateNewTitle("Untitled");
|
tiddlerFields.title = this.wiki.generateNewTitle("Untitled");
|
||||||
}
|
}
|
||||||
|
if($tw.dragging) {
|
||||||
|
$tw.dragging = false;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
this.dispatchEvent({type: "tm-import-tiddlers", param: JSON.stringify([tiddlerFields])});
|
this.dispatchEvent({type: "tm-import-tiddlers", param: JSON.stringify([tiddlerFields])});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -126,6 +126,7 @@ LinkWidget.prototype.handleClickEvent = function(event) {
|
|||||||
LinkWidget.prototype.handleDragStartEvent = function(event) {
|
LinkWidget.prototype.handleDragStartEvent = function(event) {
|
||||||
if(event.target === this.domNodes[0]) {
|
if(event.target === this.domNodes[0]) {
|
||||||
if(this.to) {
|
if(this.to) {
|
||||||
|
$tw.dragging = true;
|
||||||
// Set the dragging class on the element being dragged
|
// Set the dragging class on the element being dragged
|
||||||
$tw.utils.addClass(event.target,"tc-tiddlylink-dragging");
|
$tw.utils.addClass(event.target,"tc-tiddlylink-dragging");
|
||||||
// Create the drag image elements
|
// Create the drag image elements
|
||||||
@ -173,6 +174,7 @@ LinkWidget.prototype.handleDragStartEvent = function(event) {
|
|||||||
|
|
||||||
LinkWidget.prototype.handleDragEndEvent = function(event) {
|
LinkWidget.prototype.handleDragEndEvent = function(event) {
|
||||||
if(event.target === this.domNodes[0]) {
|
if(event.target === this.domNodes[0]) {
|
||||||
|
$tw.dragging = false;
|
||||||
// Remove the dragging class on the element being dragged
|
// Remove the dragging class on the element being dragged
|
||||||
$tw.utils.removeClass(event.target,"tc-tiddlylink-dragging");
|
$tw.utils.removeClass(event.target,"tc-tiddlylink-dragging");
|
||||||
// Delete the drag image element
|
// Delete the drag image element
|
||||||
|
Loading…
Reference in New Issue
Block a user