Blur editor's input field before hiding the editor

For #5589, when switching to no editor or the image viewer, explicitly blur the old editor's hidden input field before hiding the editor to avoid a problem with CM's polling mechanism. See the rather lengthy comment in the code for an explanation.