javascript-editor

codemirror + esprima powered html5 javascript editor component

javascript-editor

codemirror + esprima powered html5 javascript editor component

based originally on htmleditor by mrdoob

  • JS syntax highlighting
  • JS errors are detected and highlighted as you code
  • by default if you drop a .js file on the editor it will load the contents
  • modular and installable with NPM

use it with browserify

npm install javascript-editor
var editor = require('javascript-editor')
 
editor({ container: document.querySelector('#editor') })
 
editor.on('change', function() {
  var value = editor.getValue()
})
var defaults = {
    value: "// hello world\n",
    container: document.body,
    mode: "javascript",
    lineNumbers: true,
    matchBrackets: true,
    indentWithTabs: false,
    tabSize: 2,
    indentUnit: 2,
    updateInterval: 500,
    dragAndDrop: true
}

BSD