These are chat archives for GetmeUK/ContentTools

29th
Oct 2015
Luis Vegerano
@lvegerano
Oct 29 2015 03:47 UTC
So I have extended the Text class for some custom behavior I want. And on taint Im applying some formating and feeding into the element node. One thing that Im having a bit of issues is that this newly serialized html inserts some tags that have a contenteditable=false. For newline purposes Im adding ‌ in front of this tag. One this is all done and the element content has been set I run element.updateInnerHTML() but the caret is loosing its mind. I’ve tried to set the selection via set() but in still not doing a thing.
Any sugestions as to how to handle the cursor?
Benjamin Intal
@bfintal
Oct 29 2015 17:06 UTC
Can you explain how it's losing it's mind? :D
I'm actually refining the selections/dragging/focusing in the project I'm doing so I think you're looking for a way to manually set the cursor position
var index = 0;
var selection = new ContentSelect.Range( index, index );
selection.select( this._domElement );
that would move the caret to the start of the element