That sounds horrifyingly wonderfully hacky.  ^.^

Good idea to keep in mind for the future, though I think keeping with my 
port right now is good.  I have a growing PortHelper module that I am 
stuffing all my port helpers into with a single javascript file that I can 
call a function in passing an Elm app to setup.  It works well and is 
re-usable.  :-)

On Sunday, July 31, 2016 at 3:05:22 AM UTC-6, debois wrote:
>
> This is something of a hack and likely not preferable to your current 
> solution using a port, but if you're desperate to avoid ports (say, you are 
> building a package), here's an option:
>
> Write a Json decoder for the Buttons onClick event which "walks the DOM" 
> by decoding `offsetParent` etc.; find the textfield, decode 
> `selectionStart` and `selectionEnd` on it.
>
> More details in this post:
>
> https://medium.com/@debois/elm-the-dom-8c9883190d20#.kyhqu07pi
>
> You might find this library helpful:
>
> https://github.com/debois/elm-dom
>
> If you take this route, consider submitting a PR for the library with 
> decoders for selection properties.
>
> I believe proper support for accessing selection will come to core 
> eventually, but not in the short term:
>
>
> https://www.google.com/url?q=https%3A%2F%2Fgist.github.com%2Frtfeldman%2F5f015adbdfbba541c7e7e1409b6efeef&sa=D&sntz=1&usg=AFQjCNHad6MkGVczjUkktrV_ACgfhvIr-g
>
>

-- 
You received this message because you are subscribed to the Google Groups "Elm 
Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to elm-discuss+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to