Fix markdown go blank issue

@samccone, I made some change on top of your change that seems to have address the scope/editor mismatching causing editor go blank or wrong focus issue. I am still seeing the whitespace growing though. Please review and see if it makes sense to merge into your branch.
I think this is another thing that worth pointing out. The directive function is called just once, making editor a variable local like this will make all the directive instances closure bind to the same editor variable. There should be an editor recorded for each scope instead.