[Pkg-javascript-commits] [dojo] 02/11: Porting over the fix for #5266.
David Prévot
taffit at moszumanska.debian.org
Mon May 11 20:11:44 UTC 2015
This is an automated email from the git hooks/post-receive script.
taffit pushed a commit to annotated tag 1.0.2
in repository dojo.
commit dd5c63d897013684f4727ccaacae666897e54918
Author: Eugene Lazutkin <eugene at lazutkin.com>
Date: Sat Dec 1 04:14:27 2007 +0000
Porting over the fix for #5266.
git-svn-id: http://svn.dojotoolkit.org/src/branches/1.0/dojo/trunk@11665 560b804f-0ae3-0310-86f3-f6aa0a117693
---
dnd/Manager.js | 4 +++-
tests/dnd/test_dnd.html | 53 ++++++++++++++++++++++++++++++++++---------------
2 files changed, 40 insertions(+), 17 deletions(-)
diff --git a/dnd/Manager.js b/dnd/Manager.js
index 127cd3d..078da9d 100644
--- a/dnd/Manager.js
+++ b/dnd/Manager.js
@@ -110,7 +110,9 @@ dojo.extend(dojo.dnd.Manager, {
// e: Event: mouse event
if(this.avatar && this.source.mouseButton == e.button){
if(this.target && this.canDropFlag){
- dojo.publish("/dnd/drop", [this.source, this.nodes, Boolean(this.source.copyState(dojo.dnd.getCopyKeyState(e)))]);
+ var params = [this.source, this.nodes, Boolean(this.source.copyState(dojo.dnd.getCopyKeyState(e))), this.target];
+ dojo.publish("/dnd/drop/before", params);
+ dojo.publish("/dnd/drop", params);
}else{
dojo.publish("/dnd/cancel");
}
diff --git a/tests/dnd/test_dnd.html b/tests/dnd/test_dnd.html
index b7ce4f1..7e2a56a 100644
--- a/tests/dnd/test_dnd.html
+++ b/tests/dnd/test_dnd.html
@@ -7,10 +7,19 @@
@import "../../resources/dnd.css";
@import "dndDefault.css";
- body { padding: 1em; background: #ededed; }
+ body {
+ padding: 1em;
+ background: #ededed;
+ }
- .container { width: 100px; display: block; }
- .clear { clear: both; }
+ .container {
+ width: 100px;
+ display: block;
+ }
+
+ .clear {
+ clear: both;
+ }
</style>
<script type="text/javascript" src="../../dojo.js" djConfig="isDebug: true, parseOnLoad: true"></script>
@@ -24,25 +33,37 @@
<script type="text/javascript">
dojo.require("dojo.parser");
dojo.require("dojo.dnd.Source");
-
+
var c1;
-
+
function init(){
c1 = new dojo.dnd.Source("container1");
- c1.insertNodes(false, [1, "A", [1, 2, 3],
- function(x){ return x + x; },
- {toString: function(){ return "CUSTOM!"; }},
+ c1.insertNodes(false, [1, "A", [1, 2, 3],
+ function(x){ return x + x; },
+ {toString: function(){ return "CUSTOM!"; }},
null]);
// example subscribe to events
dojo.subscribe("/dnd/start", function(source){
console.debug("Starting the drop", source);
});
- dojo.connect(c4, "onDndDrop", function(source, nodes, copy){
- console.debug(copy ? "Copying from" : "Moving from", source);
+ dojo.subscribe("/dnd/drop/before", function(source, nodes, copy, target){
+ if(target == c1){
+ console.debug(copy ? "Copying from" : "Moving from", source, "to", target, "before", target.before);
+ }
+ });
+ dojo.subscribe("/dnd/drop", function(source, nodes, copy, target){
+ if(target == c1){
+ console.debug(copy ? "Copying from" : "Moving from", source, "to", target, "before", target.before);
+ }
+ });
+ dojo.connect(c4, "onDndDrop", function(source, nodes, copy, target){
+ if(target == c4){
+ console.debug(copy ? "Copying from" : "Moving from", source);
+ }
});
};
-
+
dojo.addOnLoad(init);
</script>
</head>
@@ -64,11 +85,11 @@
</ul>
<div id="dragLists">
- <div style="float:left; margin:5px; ">
+ <div style="float: left; margin: 5px;">
<h3>Source 1</h3>
<div id="container1" class="container"></div>
</div>
- <div style="float:left; margin:5px; ">
+ <div style="float: left; margin: 5px;">
<h3>Source 2</h3>
<div dojoType="dojo.dnd.Source" jsId="c2" class="container">
<div class="dojoDndItem">Item <strong>X</strong></div>
@@ -76,7 +97,7 @@
<div class="dojoDndItem">Item <strong>Z</strong></div>
</div>
</div>
- <div style="float:left; margin:5px; ">
+ <div style="float: left; margin: 5px;">
<h3>Source 3</h3>
<div dojoType="dojo.dnd.Source" jsId="c3" class="container">
<script type="dojo/method" event="creator" args="item, hint">
@@ -84,7 +105,7 @@
var node = dojo.doc.createElement("div"), s = String(item);
node.id = dojo.dnd.getUniqueId();
node.className = "dojoDndItem";
- node.innerHTML = (hint != "avatar" || s.indexOf("Item") < 0) ?
+ node.innerHTML = (hint != "avatar" || s.indexOf("Item") < 0) ?
s : "<strong style='color: darkred'>Special</strong> " + s;
return {node: node, data: item, type: ["text"]};
</script>
@@ -94,7 +115,7 @@
<div class="dojoDndItem">Item <strong>Delta</strong></div>
</div>
</div>
- <div style="float:left; margin:5px; ">
+ <div style="float: left; margin: 5px;">
<h3>Pure Target 4</h3>
<div dojoType="dojo.dnd.Target" jsId="c4" class="container">
<div class="dojoDndItem">One item</div>
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/dojo.git
More information about the Pkg-javascript-commits
mailing list