I need to pasteHTML() instead of text that is not highlighted. I know that if do something like mySelectedText.createRange().pasteHTML() then i will get what i want but how to make range for not selected text? The only thing i have in this case is only cursor / caret, that stands in the line i want to highlight and replace. Thanks for any help.
Update:
This is one line.
|This is ano|ther line.|
| – possible caret positions. I need to highlight whole line, where caret is. No text is selected.
I’m not sure yet what you really need. The (IE-only) code below selects the line(s) where the caret/selection is, and returns the
textRangeobject containing the line(s).This function allows caret/character/cross-line selection, and works also with non-editable elements, if there is a selection available.