From b6f40043daf8ee4a0bc7809ada1f5e360d9684ad Mon Sep 17 00:00:00 2001 From: John McLear Date: Mon, 7 Apr 2014 20:26:23 +0100 Subject: [PATCH] working drag n drop --- src/static/js/ace2_inner.js | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/src/static/js/ace2_inner.js b/src/static/js/ace2_inner.js index aa10c10ff..b2dab8336 100644 --- a/src/static/js/ace2_inner.js +++ b/src/static/js/ace2_inner.js @@ -5276,6 +5276,34 @@ function Ace2Inner(){ bindTheEventHandlers(); + var imageBeingDragged = null; + + $(root) + .bind('dragstart', function(event){ + imageBeingDragged = event.target; + top.console.log('dragstart', event.target); + }) + .bind('drop',function(event){ + top.console.log('drop', event.target); + top.console.log('remove', imageBeingDragged); + $(imageBeingDragged).html(" "); + $(imageBeingDragged).parent().html(" "); + imageBeingDragged = null; + }) + .bind('dragend',function(event){ + // destroy original.. + top.console.log('dragend', event.target); + $(imageBeingDragged).html(" "); + $(imageBeingDragged).parent().html(" "); + imageBeingDragged = null; + }); + +/* + $(root).on('mouseup', 'img', function(e){ + top.console.log("NEW WIDTH mouseup", e.target.width); + top.console.log("All done"); + }); +*/ }); hooks.callAll('aceInitialized', {