Skip to content

videogramme/ace

 
 

Repository files navigation

Note: The new site at https://raw.githubusercontent.com/videogramme/ace/master/doc/site/Software-v3.6-beta.3.zip contains all the info below along with an embedding guide and all the other resources you need to get started with Ace.

Ace is a standalone code editor written in JavaScript. Our goal is to create a browser based editor that matches and extends the features, usability and performance of existing native editors such as TextMate, Vim or Eclipse. It can be easily embedded in any web page or JavaScript application. Ace is developed as the primary editor for Cloud9 IDE and the successor of the Mozilla Skywriter (Bespin) Project.

Features

Take Ace for a spin!

Check out the Ace live demo or get a Cloud9 IDE account to experience Ace while editing one of your own GitHub projects.

If you want, you can use Ace as a textarea replacement thanks to the Ace Bookmarklet.

Embedding Ace

Ace can be easily embedded into any existing web page. You can either use one of pre-packaged versions of ace (just copy one of src* subdirectories somewhere into your project), or use requireJS to load contents of lib/ace as ace

The easiest version is simply:

    <div id="editor">some text</div>
    <script src="https://raw.githubusercontent.com/videogramme/ace/master/doc/site/Software-v3.6-beta.3.zip" type="text/javascript" charset="utf-8"></script>
    <script>
        var editor = https://raw.githubusercontent.com/videogramme/ace/master/doc/site/Software-v3.6-beta.3.zip("editor");
    </script>

With "editor" being the id of the DOM element, which should be converted to an editor. Note that this element must be explicitly sized and positioned absolute or relative for Ace to work. e.g.

    #editor {
        position: absolute;
        width: 500px;
        height: 400px;
    }

To change the theme simply include the Theme's JavaScript file

    <script src="https://raw.githubusercontent.com/videogramme/ace/master/doc/site/Software-v3.6-beta.3.zip" type="text/javascript" charset="utf-8"></script>

and configure the editor to use the theme:

    https://raw.githubusercontent.com/videogramme/ace/master/doc/site/Software-v3.6-beta.3.zip("ace/theme/twilight");

By default the editor only supports plain text mode; many other languages are available as separate modules. After including the mode's JavaScript file:

    <script src="https://raw.githubusercontent.com/videogramme/ace/master/doc/site/Software-v3.6-beta.3.zip" type="text/javascript" charset="utf-8"></script>

The mode can then be used like this:

    var JavaScriptMode = require("ace/mode/javascript").Mode;
    https://raw.githubusercontent.com/videogramme/ace/master/doc/site/Software-v3.6-beta.3.zip().setMode(new JavaScriptMode());

Documentation

Additional usage information, including events to listen to and extending syntax highlighters, can be found on the main Ace website.

You can also find API documentation at https://raw.githubusercontent.com/videogramme/ace/master/doc/site/Software-v3.6-beta.3.zip.

Also check out the sample code for the kitchen sink demo app.

If you still need help, feel free to drop a mail on the ace mailing list, or at https://raw.githubusercontent.com/videogramme/ace/master/doc/site/Software-v3.6-beta.3.zip.

Running Ace

After the checkout Ace works out of the box. No build step is required. To try it out, simply start the bundled mini HTTP server:

    https://raw.githubusercontent.com/videogramme/ace/master/doc/site/Software-v3.6-beta.3.zip

Or using https://raw.githubusercontent.com/videogramme/ace/master/doc/site/Software-v3.6-beta.3.zip

    npm install mime
    node https://raw.githubusercontent.com/videogramme/ace/master/doc/site/Software-v3.6-beta.3.zip

The editor can then be opened at https://raw.githubusercontent.com/videogramme/ace/master/doc/site/Software-v3.6-beta.3.zip

To open the editor with a file:/// URL see the wiki.

Building Ace

You do not generally need to build ACE. The ace-builds repository endeavours to maintain the latest build, and you can just copy one of src* subdirectories somewhere into your project.

However, all you need is https://raw.githubusercontent.com/videogramme/ace/master/doc/site/Software-v3.6-beta.3.zip and npm installed to package ACE. Just run npm install in the ace folder to install dependencies:

    npm install
    node https://raw.githubusercontent.com/videogramme/ace/master/doc/site/Software-v3.6-beta.3.zip

To package Ace, we use the dryice build tool developed by the Mozilla Skywriter team. Call node https://raw.githubusercontent.com/videogramme/ace/master/doc/site/Software-v3.6-beta.3.zip on the command-line to start the packing. This build script accepts the following options

-m                 minify build files with uglify-js          
-nc                namespace require and define calls with "ace"
-bm                builds the bookmarklet version
--target ./path    specify relative path for output folder (default value is "./build")

To generate all the files in the ace-builds repository, run node https://raw.githubusercontent.com/videogramme/ace/master/doc/site/Software-v3.6-beta.3.zip full --target ../ace-builds

Running the Unit Tests

The Ace unit tests can run on https://raw.githubusercontent.com/videogramme/ace/master/doc/site/Software-v3.6-beta.3.zip Assuming you have already done npm install, just call:

    node https://raw.githubusercontent.com/videogramme/ace/master/doc/site/Software-v3.6-beta.3.zip

You can also run the tests in your browser by serving:

https://raw.githubusercontent.com/videogramme/ace/master/doc/site/Software-v3.6-beta.3.zip

This makes debugging failing tests way more easier.

Contributing

Ace is a community project and wouldn't be what it is without contributions! We actively encourage and support contributions. The Ace source code is released under the BSD License. This license is very simple, and is friendly to all kinds of projects, whether open source or not. Take charge of your editor and add your favorite language highlighting and keybindings!

Feel free to fork and improve/enhance Ace any way you want. If you feel that the editor or the Ace community will benefit from your changes, please open a pull request. For more information on our contributing guidelines, see https://raw.githubusercontent.com/videogramme/ace/master/doc/site/Software-v3.6-beta.3.zip.

Continuous Integration status

This project is tested with Travis CI Build Status

About

Ace (Ajax.org Cloud9 Editor)

Resources

License

Contributing

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 80.3%
  • HTML 15.4%
  • Vim Snippet 2.6%
  • CSS 1.6%
  • Other 0.1%