Better fix for #432, setting contenteditable.

deleteText was deleting the wrong text, not because the focus was
on another element, but because previously selected text was still
selected. Now we clear the selection before adding the new text to
it.