Hi all, I''ve been trying for a while to make a droppable element (div) recieve any highlighted/selected html fragment, but I can''t get it to work. Is there something I''m missing or is this not possible with prototype etc. Just creating a Droppable doesn''t do anything. So far I have <div id="dropper" style="height:200px;width:200px;border:1px solid black"> </div> <script> Droppables.add(''dropper'', { onDrop: function(element){ alert("Hi There"); } } ); </script> and it does nothing :( Anyone have any ideas. Basically I want to highlight an area on my page and drop that, without explicitly setting it as a draggable. Cheers Daniel --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
Hey there, A Droppable is just an area where Draggables can be dropped. You''re only setting up one end of the Drag''n''drop paradigm here: your text selections do not become Draggable object by sheer force of will alone. Daniel N a écrit :> Just creating a Droppable doesn''t do anything.It does half the work. Now do the other half.> Anyone have any ideas. Basically I want to highlight an area on my > page and drop that, without explicitly setting it as a draggable.You need to react to mouse events on the text''s container, capture the text selection (a mighty feat, as it is widely inconsistent across browsers), synthetize a <span> for it, style it, make it Draggable, position it at mouse location, and initiate drag on it. In short, it''s no picnic. But then, your need is advanced here, believe it or not. -- Christophe Porteneuve aka TDD tdd-x+CfDp/qHev2eFz/2MeuCQ@public.gmane.org --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
On 2/15/07, Christophe Porteneuve <tdd-x+CfDp/qHev2eFz/2MeuCQ@public.gmane.org> wrote:> > > Hey there, > > A Droppable is just an area where Draggables can be dropped. You''re > only setting up one end of the Drag''n''drop paradigm here: your text > selections do not become Draggable object by sheer force of will alone.Daniel N a écrit :> > Just creating a Droppable doesn''t do anything. > > It does half the work. Now do the other half. > > > Anyone have any ideas. Basically I want to highlight an area on my > > page and drop that, without explicitly setting it as a draggable. > > You need to react to mouse events on the text''s container, capture the > text selection (a mighty feat, as it is widely inconsistent across > browsers), synthetize a <span> for it, style it, make it Draggable, > position it at mouse location, and initiate drag on it. > > In short, it''s no picnic. But then, your need is advanced here, believe > it or not. > > --I would certianly seem that this is advanced, even though it seems like a simple thing. I''ve been looking at this for the last few days, and I''ve managed to recognize the drop event from randomly highlighted text/things draged onto an element (div for safari and textarea for mozilla) but I can''t easily access this as it seems to be on the clip board. Text inputs, regardless of browser seem to allow this kind of dropping of random stuff on them. I''m wondering how they do it? Christophe Porteneuve aka TDD> tdd-x+CfDp/qHev2eFz/2MeuCQ@public.gmane.orgThanx for your help. Cheers Daniel --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
Daniel N a écrit :> Text inputs, regardless of browser seem to allow this kind of dropping > of random stuff on them. I''m wondering how they do it?*Natively* :-) -- Christophe Porteneuve a.k.a. TDD "[They] did not know it was impossible, so they did it." --Mark Twain Email: tdd-x+CfDp/qHev2eFz/2MeuCQ@public.gmane.org --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---