1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-06-16 10:29:54 +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:
Jermolene 2017-03-27 09:59:40 +01:00
parent 0276b69244
commit d3fe4f600a
2 changed files with 11 additions and 11 deletions

View File

@ -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}];
}}
];

View File

@ -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) {