If you just want to use the ace editor as is, you can add it to your project with
meteor add dcsan:meteor-reactive-ace
If you want to update the version of the ace-editor used, do this:
- Clone this repo
git clone git://github.com/dcsan/meteor-reactive-ace.git; cd meteor-reactive-ace
- Update submodules
git submodule update --init ace-builds
- copy latest version of ace into vendor dir
cp -r ace-builds/src vendor/ace
Also there is an example app:
cd examples/helloAce
meteor
##Including in your project
###Setup
- Add reactive-ace to your smart.json file
- Create a div element with an id where you will attach the editor. Wrap it inside of a
{{constant}}
block so that it is not rerendered. - Create an editor object by calling
new ReactiveAce()
- Attach the editor to the div by calling
editorObject.attach(divElementId)
##Enabling syntax modes and themes
Assuming your editor is a variabled named editor
, try
editor.theme = "monokai"
editor.syntaxMode = "javascript"
##Turning on the javascript abstract syntax tree (powered by esprima)
- Turn on abstract syntax tree parsing with
editor.parseEnabled = true
- View it with
editor.parsedBody
- If you have an error in your javascript
editor.parsedError
will be populated.