We were talking about something similar in another thread. https://groups.google.com/forum/#!topic/elm-discuss/ALKjx3bsCgc
Wil On Sunday, December 11, 2016 at 2:09:30 AM UTC-8, Lars Jacobsson wrote: > > I've got a problem. We need to use contentEditable elements and while > editing them, the caret jumps to the beginning of the box everytime the > model updates. This derives from the fact that the browser holds some state > about the caret position outside the model (the horror), and we reset that > brower caret state everytime we update. > > There are ways to solve this by talking to js using textranges (eg. here > <http://stackoverflow.com/questions/6139107/programatically-select-text-in-a-contenteditable-html-element+and+other+similar+posts>), > > but I look at that as an implementational nightmare with possible > performance implications and shaky browser support. > > Since it is just a fact of life that the browser holds some state, I'd > like to handle it by intentionally putting the Dom and the model > temporarily out of sync. Meaning that when the model updates, virtual dom > won't update the element we are currently editing. > > However - and this is crucial - I still want to update the model onInput > (practically meaning on every new character entered). I just don't want > virutal dom to update the element then the new data hits the view. > > Is there any way of telling Elm to not update an element (ie essentially > do what shouldComponentUpdate does in React)? > -- 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 [email protected]. For more options, visit https://groups.google.com/d/optout.
