jhollingworth / bootstrap-wysihtml5

Simple, beautiful wysiwyg editor
http://jhollingworth.github.com/bootstrap-wysihtml5/
MIT License
4.14k stars 1.01k forks source link

Getting and resetting cursor position after inserting HTML into wysihtml5 text box #287

Open krawson opened 11 years ago

krawson commented 11 years ago

I am working with bootstrap-wysihtml5 to implement a real-time text editor that allows for multiple connections simultaneously. With the help of Pusher, I am able to trigger events that are seen and update the text box accordingly across multiple browsers and windows, however the text cursor gets reset to the start of the text after we set the html of the editor. Is there a way to capture the current cursor position by caret within the text box that is being edited in and then set the cursor after we call the wysihtml.composer.element.html() function?

JD-Robbs commented 11 years ago

I second this (using it with KnockOut JS). The issue only happens if there are HTML-tags in the value (thereby affecting the cursor position).

alisson04 commented 6 years ago

Did you find the solution?