Minor code cleanup of editor keyboard shortcut actions.

I noticed that markdown-actions.js repeats itself an awful lot. Seeing as just about every `case` in the `replace` function calls `this.elem.getCursor()`, and frequently `this.elem.getLine(cursor.line)`, at least once, it seems like it should be moved up outside of the switch structure.