https://esgsw.it/html/answered-javascript-how-to-find-start-and-end-index-of-dom-text-selection/