Using jQuery or straight javascript, how do you identify / select / choose a single line of text from a div with contentEditable on and add formatting to that line of text only?
I currently have a div with contentEditable set to true, which allows the user to edit the content of the div, adding/removing text as they see fit. However, I want the user to also be able to double-click any line of text within the div and mark that line with a different formatting style. (i.e. enclose the full line of text within spans and then style the span. Note that I can style the span easily. My problem lies with identifying the line of text the user clicked and enclosing it in span tags)
Note that since the user can add a lot of content, the div itself is scrollable, so any solution should be able to handle the scrolling.