Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
dream
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
1
Issues
1
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
dream
Commits
0339c80e
Commit
0339c80e
authored
Feb 03, 2015
by
Jérome Perrin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixup! jsplumb: Internet Explorer only supports "text" as format for evt.dataTransfer.setData
parent
1e1d86f0
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
31 additions
and
17 deletions
+31
-17
dream/platform/src/jsplumb/jsplumb.js
dream/platform/src/jsplumb/jsplumb.js
+15
-9
dream/platform/src/jsplumb/test.js
dream/platform/src/jsplumb/test.js
+6
-6
dream/platform/src/toolbox/toolbox.js
dream/platform/src/toolbox/toolbox.js
+10
-2
No files found.
dream/platform/src/jsplumb/jsplumb.js
View file @
0339c80e
...
...
@@ -785,15 +785,21 @@
function
resolver
(
resolve
,
reject
)
{
callback
=
function
(
evt
)
{
try
{
var
class_name
=
JSON
.
parse
(
evt
.
dataTransfer
.
getData
(
'
text
'
)
),
var
class_name
,
offset
=
$
(
gadget
.
props
.
main
).
offset
(),
relative_position
=
convertToRelativePosition
(
gadget
,
evt
.
clientX
-
offset
.
left
+
"
px
"
,
evt
.
clientY
-
offset
.
top
+
"
px
"
);
try
{
// html5 compliant browser
class_name
=
JSON
.
parse
(
evt
.
dataTransfer
.
getData
(
'
application/json
'
));
}
catch
(
e
)
{
// internet explorer
class_name
=
JSON
.
parse
(
evt
.
dataTransfer
.
getData
(
'
text
'
));
}
addNode
(
gadget
,
generateNodeId
(
gadget
,
{
_class
:
class_name
}),
{
...
...
dream/platform/src/jsplumb/test.js
View file @
0339c80e
...
...
@@ -184,8 +184,8 @@
e
.
dataTransfer
=
{
getData
:
function
(
type
){
// make sure we are called properly
equal
(
'
text
'
,
type
,
"
The drag&dropped element must have data type
text
"
);
equal
(
'
application/json
'
,
type
,
"
The drag&dropped element must have data type
application/json
"
);
return
JSON
.
stringify
(
"
Example.Node
"
);
}
};
...
...
@@ -545,8 +545,8 @@
e
.
dataTransfer
=
{
getData
:
function
(
type
){
// make sure we are called properly
equal
(
'
text
'
,
type
,
"
The drag&dropped element must have data type
text
"
);
equal
(
'
application/json
'
,
type
,
"
The drag&dropped element must have data type
application/json
"
);
return
JSON
.
stringify
(
"
Example.Node
"
);
}
};
...
...
@@ -647,8 +647,8 @@
e
.
dataTransfer
=
{
getData
:
function
(
type
){
// make sure we are called properly
equal
(
'
text
'
,
type
,
"
The drag&dropped element must have data type
text
"
);
equal
(
'
application/json
'
,
type
,
"
The drag&dropped element must have data type
application/json
"
);
return
JSON
.
stringify
(
"
Example.Node
"
);
}
};
...
...
dream/platform/src/toolbox/toolbox.js
View file @
0339c80e
...
...
@@ -17,8 +17,16 @@
callback
=
function
(
evt
)
{
try
{
evt
.
dataTransfer
.
setData
(
'
text
'
,
tool
.
dataset
.
class_name
);
// Internet explorer only accepts text and URI as types for dataTranser
// but firefox will replace location.href with the data if type is set to
// text or URI. We try to use application/json as type, and if it fails
// fallback to text.
try
{
// IE will raise an error setting this.
evt
.
dataTransfer
.
setData
(
'
application/json
'
,
tool
.
dataset
.
class_name
);
}
catch
(
e
)
{
evt
.
dataTransfer
.
setData
(
'
text
'
,
tool
.
dataset
.
class_name
);
}
}
catch
(
e
)
{
reject
(
e
);
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment