Hello.
Is there a better way to keep the current selection when using execCommand().
The code below works, but im thinking there must be a better way.
document.getSelection().addRange(
document.getSelection().getRangeAt(0)
);
So what it does is to get the Range from the current selection and put that in the current selection, witch feels stupid. I could keep an up to date Range object as a variable and put that into the current selection rather then first getting it and then
adding it instantly, and I should also clear out any old range before I add the new, but it all feels wrong.
Do you know of a good way of doing it?