Find caret position in contenteditable