Correct undo in markdown editor