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
135f6f88
Commit
135f6f88
authored
Jun 26, 2014
by
Thibaut Frain
Committed by
Jérome Perrin
Aug 11, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
drag and drop relative callbacks are linked with application promise tree
parent
7a141d97
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
50 additions
and
36 deletions
+50
-36
dream/platform/src2/jsplumb/jsplumb.js
dream/platform/src2/jsplumb/jsplumb.js
+32
-29
dream/platform/src2/toolbox/toolbox.js
dream/platform/src2/toolbox/toolbox.js
+18
-7
No files found.
dream/platform/src2/jsplumb/jsplumb.js
View file @
135f6f88
...
@@ -528,20 +528,19 @@
...
@@ -528,20 +528,19 @@
}
}
function
waitForDrop
(
gadget
,
config
)
{
function
waitForDrop
(
gadget
,
config
)
{
var
callback
;
var
target
=
gadget
.
props
.
element
.
querySelector
(
'
#main
'
),
callback
;
function
canceller
()
{
function
canceller
()
{
if
(
callback
!==
undefined
)
{
if
(
callback
!==
undefined
)
{
target
.
removeEventListener
(
'
drop
'
,
callback
,
false
);
gadget
.
props
.
main
.
removeEventListener
(
'
drop
'
,
callback
,
false
);
}
}
}
}
function
nonResolvableTrap
(
resolve
,
reject
)
{
/*jslint unparam: true*/
function
itsANonResolvableTrap
(
resolve
,
reject
)
{
callback
=
function
(
evt
)
{
callback
=
function
(
evt
)
{
try
{
var
element
=
domParser
.
parseFromString
(
var
element
=
domParser
.
parseFromString
(
evt
.
dataTransfer
.
getData
(
'
text/html
'
),
evt
.
dataTransfer
.
getData
(
'
text/html
'
),
'
text/html
'
'
text/html
'
...
@@ -564,12 +563,16 @@
...
@@ -564,12 +563,16 @@
"
name
"
:
element_class
"
name
"
:
element_class
},
},
config
);
config
);
}
catch
(
e
)
{
reject
(
e
);
}
};
};
target
.
addEventListener
(
'
drop
'
,
callback
,
false
);
gadget
.
props
.
main
.
addEventListener
(
'
drop
'
,
callback
,
false
);
}
}
return
new
RSVP
.
Promise
(
n
onResolvableTrap
,
canceller
);
return
new
RSVP
.
Promise
(
itsAN
onResolvableTrap
,
canceller
);
}
}
initGadgetMixin
(
gadget_klass
);
initGadgetMixin
(
gadget_klass
);
...
...
dream/platform/src2/toolbox/toolbox.js
View file @
135f6f88
...
@@ -8,16 +8,27 @@
...
@@ -8,16 +8,27 @@
tool_template
=
Handlebars
.
compile
(
tool_template_source
);
tool_template
=
Handlebars
.
compile
(
tool_template_source
);
function
waitForDragstart
(
tool
)
{
function
waitForDragstart
(
tool
)
{
var
callback
;
function
canceller
()
{
if
(
callback
!==
undefined
)
{
tool
.
removeEventListener
(
'
dragstart
'
,
callback
,
false
);
}
}
/*jslint unparam: true*/
/*jslint unparam: true*/
var
callback
=
function
(
evt
)
{
function
itsANonResolvableTrap
(
resolve
,
reject
)
{
callback
=
function
(
evt
)
{
try
{
evt
.
dataTransfer
.
setData
(
'
text/html
'
,
tool
.
outerHTML
);
evt
.
dataTransfer
.
setData
(
'
text/html
'
,
tool
.
outerHTML
);
}
catch
(
e
)
{
reject
(
e
);
}
};
};
return
new
RSVP
.
Promise
(
function
(
resolve
,
reject
)
{
tool
.
addEventListener
(
'
dragstart
'
,
callback
,
false
);
tool
.
addEventListener
(
'
dragstart
'
,
callback
,
false
);
},
function
()
{
}
tool
.
removeEventListener
(
'
dragstart
'
,
callback
,
false
);
return
new
RSVP
.
Promise
(
itsANonResolvableTrap
,
canceller
);
});
}
}
initGadgetMixin
(
gadget_klass
);
initGadgetMixin
(
gadget_klass
);
...
...
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