1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-11-16 23:04:50 +00:00

Revised fix for IE drag/drop issue #252

Also improve browser drag/drop inter-op a tiny bit
This commit is contained in:
David Jade 2013-12-13 03:12:56 -08:00
parent 80e0714c0d
commit 0984e9322f
2 changed files with 9 additions and 7 deletions

View File

@ -117,6 +117,9 @@ DropZoneWidget.prototype.importData = function(dataTransfer) {
}; };
DropZoneWidget.prototype.importDataTypes = [ DropZoneWidget.prototype.importDataTypes = [
{type: "text/vnd.tiddler", convertToFields: function(data) {
return JSON.parse(data);
}},
{type: "URL", convertToFields: function(data) { {type: "URL", convertToFields: function(data) {
// check for tiddler data URI // check for tiddler data URI
var match = decodeURI(data).match(/^data\:text\/vnd\.tiddler,(.*)/i); var match = decodeURI(data).match(/^data\:text\/vnd\.tiddler,(.*)/i);
@ -128,15 +131,12 @@ DropZoneWidget.prototype.importDataTypes = [
}; };
} }
}}, }},
{type: "Text", convertToFields: function(data) { {type: "text/plain", convertToFields: function(data) {
return { return {
text: data text: data
}; };
}}, }},
{type: "text/vnd.tiddler", convertToFields: function(data) { {type: "Text", convertToFields: function(data) {
return JSON.parse(data);
}},
{type: "text/plain", convertToFields: function(data) {
return { return {
text: data text: data
}; };

View File

@ -129,8 +129,10 @@ LinkWidget.prototype.handleDragStartEvent = function(event) {
dataTransfer.setDragImage(this.dragImage.firstChild,-16,-16); dataTransfer.setDragImage(this.dragImage.firstChild,-16,-16);
} }
dataTransfer.clearData(); dataTransfer.clearData();
if(!(/msie|trident/i.test(navigator.userAgent))) {
dataTransfer.setData("text/vnd.tiddler",this.wiki.getTiddlerAsJson(this.to)); dataTransfer.setData("text/vnd.tiddler",this.wiki.getTiddlerAsJson(this.to));
dataTransfer.setData("text/plain",this.wiki.getTiddlerText(this.to,"")); dataTransfer.setData("text/plain",this.wiki.getTiddlerText(this.to,""));
}
dataTransfer.setData("URL","data:text/vnd.tiddler," + encodeURI(this.wiki.getTiddlerAsJson(this.to))); dataTransfer.setData("URL","data:text/vnd.tiddler," + encodeURI(this.wiki.getTiddlerAsJson(this.to)));
dataTransfer.setData("Text",this.wiki.getTiddlerText(this.to,"")); dataTransfer.setData("Text",this.wiki.getTiddlerText(this.to,""));
event.stopPropagation(); event.stopPropagation();