1.0.3 • Published 10 years ago

javascript-editor v1.0.3

Weekly downloads
38
License
-
Repository
github
Last release
10 years ago

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

1.0.3

10 years ago

1.0.2

10 years ago

1.0.1

10 years ago

1.0.0

10 years ago

0.2.1

12 years ago

0.2.0

12 years ago

0.1.0

12 years ago

0.0.2

13 years ago

0.0.1

13 years ago