refactored editor.js