Re: [elm-discuss] textarea selection

2016-07-31 Thread OvermindDL1
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=D=1=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.


Re: [elm-discuss] textarea selection

2016-07-27 Thread OvermindDL1
Correction, does not seem to work, I cannot find a way to access the 
textarea element from the button callback...

On Wednesday, July 27, 2016 at 8:37:05 AM UTC-6, OvermindDL1 wrote:
>
> I already use custom 'on' things to override default propagation (more 
> interaction with the legacy javascript that I am stopping in this case), 
> but you just gave me a fantastic idea...  I might be able to get rid of my 
> `surroundSelectionWith` javascript port...
>
> On Wednesday, July 27, 2016 at 12:56:24 AM UTC-6, Atamert Ölçgen wrote:
>>
>> Have you tried this:
>>
>> http://package.elm-lang.org/packages/elm-lang/html/1.1.0/Html-Events#on
>>
>> On Tue, Jul 26, 2016 at 11:02 PM, OvermindDL1  wrote:
>>
>>> When a user clicks a button I am needing to take the text that is 
>>> currently *selected* in a textarea and surround it with other text while 
>>> retaining what is selected.  What is the method to do this in Elm.  Is 
>>> there an onSelectionChanged callback or something that I am missing?
>>>
>>> -- 
>>> 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...@googlegroups.com.
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>>
>>
>> -- 
>> Kind Regards,
>> Atamert Ölçgen
>>
>> ◻◼◻
>> ◻◻◼
>> ◼◼◼
>>
>> www.muhuk.com
>>
>

-- 
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.


Re: [elm-discuss] textarea selection

2016-07-27 Thread OvermindDL1
I already use custom 'on' things to override default propagation (more 
interaction with the legacy javascript that I am stopping in this case), 
but you just gave me a fantastic idea...  I might be able to get rid of my 
`surroundSelectionWith` javascript port...

On Wednesday, July 27, 2016 at 12:56:24 AM UTC-6, Atamert Ölçgen wrote:
>
> Have you tried this:
>
> http://package.elm-lang.org/packages/elm-lang/html/1.1.0/Html-Events#on
>
> On Tue, Jul 26, 2016 at 11:02 PM, OvermindDL1  > wrote:
>
>> When a user clicks a button I am needing to take the text that is 
>> currently *selected* in a textarea and surround it with other text while 
>> retaining what is selected.  What is the method to do this in Elm.  Is 
>> there an onSelectionChanged callback or something that I am missing?
>>
>> -- 
>> 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...@googlegroups.com .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
>
> -- 
> Kind Regards,
> Atamert Ölçgen
>
> ◻◼◻
> ◻◻◼
> ◼◼◼
>
> www.muhuk.com
>

-- 
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.


Re: [elm-discuss] textarea selection

2016-07-27 Thread Atamert Ölçgen
Have you tried this:

http://package.elm-lang.org/packages/elm-lang/html/1.1.0/Html-Events#on

On Tue, Jul 26, 2016 at 11:02 PM, OvermindDL1  wrote:

> When a user clicks a button I am needing to take the text that is
> currently *selected* in a textarea and surround it with other text while
> retaining what is selected.  What is the method to do this in Elm.  Is
> there an onSelectionChanged callback or something that I am missing?
>
> --
> 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.
>



-- 
Kind Regards,
Atamert Ölçgen

◻◼◻
◻◻◼
◼◼◼

www.muhuk.com

-- 
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.