MDL-44759 atto_undo: Buttons are only enabled when needed

Before the patch it was happening that the undo or redo buttons
were enabled even though clicking on them didn't produce anything.
This is partly because we were not storing the initial value, we
allowed for the stack to be empty, and we were using not clean
HTML.