XWIKI-9163: The WYSIWYG editor transforms the content into HTML code when reloading certain types of documents
* Make the Selection implementation fail safe when there is no native selection (e.g. when the rich text area is hidden).
(cherry picked from commit 9b97c6d3d8c033423bd369229e64d6abad68bb3e)