Editor: Refactor editor.js