Check the cursor position when deciding whether to save an undo item.

This ensures that the cursor position will be saved prior to running a transaction.

Fixes https://github.com/guardian/scribe/issues/309.
Do not inject `br` elements into childless elements.

Such "invalid" child elements will be escaped by `innerHTML` when a history item is
restored. This will prevent the user from ever undoing past this point, because when the
user next goes to undo, Scribe will then determine that the editor's contents have
diverged from the previous history item and save the contents before undoing.
Don't unnecessarily record an undo item on every press of the delete key.