moved editor code from main.js to editor.js