Handle html and text correctly in contenteditable