syntactor
v1.1.0
Published
[](https://travis-ci.org/Gregoor/syntactor)
Downloads
12
Readme
Syntactor
An editor with two basic goals:
- Only allow valid code to be entered (no syntax errors)
- Common code transformations in just as many or less keystrokes, compared to other editors
For now, it's only a JSON editor.
Usage
In your commandline:
yarn add syntactor
#or
npm install syntactor --saveIn your code:
const Syntactor = require('syntactor');
Syntactor.render(document.querySelector('#container'), {
initiallyShowKeymap: true,
defaultValue: {answer: 42}
});Or if you're using React (and ES2015):
import {Editor} from 'syntactor';
const SomeComponent = () => (
<div>
<Editor initiallyShowKeymap defaultValue={{answer: 42}}/>
</div>
);Props
These can be either passed as React props or as the 2nd argument into the Syntactor.render function.
Name | Type | Default Value
---|---|---|
initiallyShowKeymap | boolean | true
defaultValue | JSON | {}
Contributing/Running the demo page
First clone this repo, then:
yarnAnd start it with
yarn start