mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2024-11-23 10:07:19 +00:00
Partially fix drag and drop on IE11
These changes allow drag and drop to work with one issue: <a> links are not draggable; draggable divs, spans, buttons etc. seem to work fine. There’s some issue with IE11 that I don’t understand. For testing, you can force links to become spans by changing line 64 of $:/core/modules/widgets/link.js to: var domNode = this.document.createElement("span");
This commit is contained in:
parent
0276b69244
commit
d3fe4f600a
@ -90,8 +90,6 @@ exports.makeDraggable = function(options) {
|
||||
dataTransfer.setData("URL","data:text/vnd.tiddler," + encodeURIComponent(jsonData));
|
||||
dataTransfer.setData("Text",titleString);
|
||||
event.stopPropagation();
|
||||
} else {
|
||||
event.preventDefault();
|
||||
}
|
||||
return false;
|
||||
}},
|
||||
@ -141,7 +139,7 @@ var importDataTypes = [
|
||||
if(match) {
|
||||
return parseJSONTiddlers(match[1],fallbackTitle);
|
||||
} else {
|
||||
return [{text: data}]; // As URL string
|
||||
return [{title: fallbackTitle, text: data}]; // As URL string
|
||||
}
|
||||
}},
|
||||
{type: "text/x-moz-url", IECompatible: false, toTiddlerFieldsArray: function(data,fallbackTitle) {
|
||||
@ -150,20 +148,20 @@ var importDataTypes = [
|
||||
if(match) {
|
||||
return parseJSONTiddlers(match[1],fallbackTitle);
|
||||
} else {
|
||||
return [{text: data}]; // As URL string
|
||||
return [{title: fallbackTitle, text: data}]; // As URL string
|
||||
}
|
||||
}},
|
||||
{type: "text/html", IECompatible: false, toTiddlerFieldsArray: function(data,fallbackTitle) {
|
||||
return [{text: data}];
|
||||
return [{title: fallbackTitle, text: data}];
|
||||
}},
|
||||
{type: "text/plain", IECompatible: false, toTiddlerFieldsArray: function(data,fallbackTitle) {
|
||||
return [{text: data}];
|
||||
return [{title: fallbackTitle, text: data}];
|
||||
}},
|
||||
{type: "Text", IECompatible: true, toTiddlerFieldsArray: function(data,fallbackTitle) {
|
||||
return [{text: data}];
|
||||
return [{title: fallbackTitle, text: data}];
|
||||
}},
|
||||
{type: "text/uri-list", IECompatible: false, toTiddlerFieldsArray: function(data,fallbackTitle) {
|
||||
return [{text: data}];
|
||||
return [{title: fallbackTitle, text: data}];
|
||||
}}
|
||||
];
|
||||
|
||||
|
@ -77,6 +77,7 @@ DroppableWidget.prototype.handleDragEnterEvent = function(event) {
|
||||
event.preventDefault();
|
||||
// Tell the browser not to ripple the drag up to any parent drop handlers
|
||||
event.stopPropagation();
|
||||
return false;
|
||||
};
|
||||
|
||||
DroppableWidget.prototype.handleDragOverEvent = function(event) {
|
||||
@ -87,10 +88,12 @@ DroppableWidget.prototype.handleDragOverEvent = function(event) {
|
||||
// Tell the browser that we're still interested in the drop
|
||||
event.preventDefault();
|
||||
event.dataTransfer.dropEffect = "copy"; // Explicitly show this is a copy
|
||||
return false;
|
||||
};
|
||||
|
||||
DroppableWidget.prototype.handleDragLeaveEvent = function(event) {
|
||||
this.leaveDrag(event);
|
||||
return false;
|
||||
};
|
||||
|
||||
DroppableWidget.prototype.handleDropEvent = function(event) {
|
||||
@ -106,15 +109,14 @@ DroppableWidget.prototype.handleDropEvent = function(event) {
|
||||
// Try to import the various data types we understand
|
||||
$tw.utils.importDataTransfer(dataTransfer,null,function(fieldsArray) {
|
||||
fieldsArray.forEach(function(fields) {
|
||||
if(fields.title) {
|
||||
self.performActions(fields.title,event);
|
||||
}
|
||||
self.performActions(fields.title || fields.text,event);
|
||||
});
|
||||
});
|
||||
// Tell the browser that we handled the drop
|
||||
event.preventDefault();
|
||||
// Stop the drop ripple up to any parent handlers
|
||||
event.stopPropagation();
|
||||
return false;
|
||||
};
|
||||
|
||||
DroppableWidget.prototype.performActions = function(title,event) {
|
||||
|
Loading…
Reference in New Issue
Block a user