mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2025-03-24 20:36:56 +00:00
Fixes problem with drag and drop in Safari
Fixes #1415 The problem was that encodeURI() doesn’t encode slashes, which are not legal in a data URI, although only Safari was failing. We switch to encodeURIComponent(), which does encode slashes
This commit is contained in:
parent
1534fed4f7
commit
c9ab873ba3
@ -159,7 +159,7 @@ DropZoneWidget.prototype.importDataTypes = [
|
||||
}},
|
||||
{type: "URL", IECompatible: true, convertToFields: function(data) {
|
||||
// Check for tiddler data URI
|
||||
var match = decodeURI(data).match(/^data\:text\/vnd\.tiddler,(.*)/i);
|
||||
var match = decodeURIComponent(data).match(/^data\:text\/vnd\.tiddler,(.*)/i);
|
||||
if(match) {
|
||||
return JSON.parse(match[1]);
|
||||
} else {
|
||||
@ -170,7 +170,7 @@ DropZoneWidget.prototype.importDataTypes = [
|
||||
}},
|
||||
{type: "text/x-moz-url", IECompatible: false, convertToFields: function(data) {
|
||||
// Check for tiddler data URI
|
||||
var match = decodeURI(data).match(/^data\:text\/vnd\.tiddler,(.*)/i);
|
||||
var match = decodeURIComponent(data).match(/^data\:text\/vnd\.tiddler,(.*)/i);
|
||||
if(match) {
|
||||
return JSON.parse(match[1]);
|
||||
} else {
|
||||
|
@ -161,9 +161,9 @@ LinkWidget.prototype.handleDragStartEvent = function(event) {
|
||||
if(!$tw.browser.isIE) {
|
||||
dataTransfer.setData("text/vnd.tiddler",jsonData);
|
||||
dataTransfer.setData("text/plain",title);
|
||||
dataTransfer.setData("text/x-moz-url","data:text/vnd.tiddler," + encodeURI(jsonData));
|
||||
dataTransfer.setData("text/x-moz-url","data:text/vnd.tiddler," + encodeURIComponent(jsonData));
|
||||
}
|
||||
dataTransfer.setData("URL","data:text/vnd.tiddler," + encodeURI(jsonData));
|
||||
dataTransfer.setData("URL","data:text/vnd.tiddler," + encodeURIComponent(jsonData));
|
||||
dataTransfer.setData("Text",title);
|
||||
event.stopPropagation();
|
||||
} else {
|
||||
|
Loading…
x
Reference in New Issue
Block a user