Little refactor to make editors more pluggable. Also codemirror fixes.