Like I said, you could hack around it. The easiest way I can think of is adding an id to a node (or use the nodes reactid) in DidMount and store it in an atom mapping id to Om component. Then remove it again in DidUnmount. Then, similar to what Scott suggested, when you call getSelection() you can retrieve the id and look up the Om component in the map.
On 2 June 2014 15:54, Scott Thompson <[email protected]> wrote: > As a workaround you could try using event handlers on DOM nodes. > > In DidMount you have access to the DOM node that backs the component so > you can attach an event handler. Then when you call window.getSelection() > you have access to the anchor and focus nodes so you can trigger the event > from here which will be handled by the associated component. > > On Sunday, 1 June 2014 13:01:02 UTC-4, Paul Butcher wrote: > > Given an Om component, I can find the associated DOM node with > om/get-node. Is there a mechanism to go the other way (i.e. given a DOM > node, find the associated Om component)? > > > > > > Why do I need this? I’m working with selection ranges - > window.getSelection() returns the first and last DOM nodes contained within > the selection and I’d like to work out which components they correspond to. > > > > > > > > > > -- > > paul.butcher->msgCount++ > > > > Silverstone, Brands Hatch, Donington Park... > > Who says I have a one track mind? > > > > http://www.paulbutcher.com/ > > LinkedIn: http://www.linkedin.com/in/paulbutcher > > Skype: paulrabutcher > > > > > > Author of Seven Concurrency Models in Seven Weeks: When Threads Unravel > > http://pragprog.com/book/pb7con > > -- > Note that posts from new members are moderated - please be patient with > your first post. > --- > You received this message because you are subscribed to the Google Groups > "ClojureScript" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To post to this group, send email to [email protected]. > Visit this group at http://groups.google.com/group/clojurescript. > -- Note that posts from new members are moderated - please be patient with your first post. --- You received this message because you are subscribed to the Google Groups "ClojureScript" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/clojurescript.
