Undo/Redo—initial implementation

WYMeditor's undo is, in some cases, not accurate.
@kylegibson took your suggestion on it. Better readability/DRY balance.