Skip to content
codemirror + esprima powered html5 javascript editor component
JavaScript CSS HTML
Find file
Latest commit f8d66f9 @maxogden 1.0.0
Failed to load latest commit information.
css fix weird scroll bug
.gitignore 0.0.1
collaborators.md add raynos
demo.js Update docs and add getValue/setValue
esprima.js 0.0.1
index.html better demo
index.js 0.2.0 - valid event
javascript.js switch to style from mistakes
package.json 1.0.0
readme.md 0.2.0 - valid event

readme.md

javascript-editor

codemirror + esprima powered html5 javascript editor component

based originally on htmleditor by mrdoob

features

  • 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

usage

use it with browserify

npm install javascript-editor
var createEditor = require('javascript-editor')

var editor = createEditor({ container: document.querySelector('#editor') })

editor.on('change', function() {
  var value = editor.getValue()
})

editor.on('valid', function(noErrors) {
  // noErrors is a boolean
})

default options

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
}

license

BSD

Something went wrong with that request. Please try again.