Factor view.js out of editor.js