Obtenga el texto seleccionado

const getSelectedText = () => window.getSelection().toString();
Tired Tortoise