mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2024-12-24 00:50:28 +00:00
parent
a44f6039bb
commit
78735cde96
@ -52,13 +52,26 @@ DropZoneWidget.prototype.render = function(parent,nextSibling) {
|
||||
this.domNodes.push(domNode);
|
||||
};
|
||||
|
||||
DropZoneWidget.prototype.handleDragEnterEvent = function(event) {
|
||||
DropZoneWidget.prototype.enterDrag = function() {
|
||||
// We count enter/leave events
|
||||
this.dragEnterCount = (this.dragEnterCount || 0) + 1;
|
||||
// If we're entering for the first time we need to apply highlighting
|
||||
if(this.dragEnterCount === 1) {
|
||||
$tw.utils.addClass(this.domNodes[0],"tc-dragover");
|
||||
}
|
||||
};
|
||||
|
||||
DropZoneWidget.prototype.leaveDrag = function() {
|
||||
// Reduce the enter count
|
||||
this.dragEnterCount = (this.dragEnterCount || 0) - 1;
|
||||
// Remove highlighting if we're leaving externally
|
||||
if(this.dragEnterCount <= 0) {
|
||||
$tw.utils.removeClass(this.domNodes[0],"tc-dragover");
|
||||
}
|
||||
};
|
||||
|
||||
DropZoneWidget.prototype.handleDragEnterEvent = function(event) {
|
||||
this.enterDrag();
|
||||
// Tell the browser that we're ready to handle the drop
|
||||
event.preventDefault();
|
||||
// Tell the browser not to ripple the drag up to any parent drop handlers
|
||||
@ -76,15 +89,11 @@ DropZoneWidget.prototype.handleDragOverEvent = function(event) {
|
||||
};
|
||||
|
||||
DropZoneWidget.prototype.handleDragLeaveEvent = function(event) {
|
||||
// Reduce the enter count
|
||||
this.dragEnterCount = (this.dragEnterCount || 0) - 1;
|
||||
// Remove highlighting if we're leaving externally
|
||||
if(this.dragEnterCount <= 0) {
|
||||
$tw.utils.removeClass(this.domNodes[0],"tc-dragover");
|
||||
}
|
||||
this.leaveDrag();
|
||||
};
|
||||
|
||||
DropZoneWidget.prototype.handleDropEvent = function(event) {
|
||||
this.leaveDrag();
|
||||
// Check for being over a TEXTAREA or INPUT
|
||||
if(["TEXTAREA","INPUT"].indexOf(event.target.tagName) !== -1) {
|
||||
return false;
|
||||
|
Loading…
Reference in New Issue
Block a user