7

Guys lately i have been using the cloud9 ide and i wanted to add the ace editor to me website. To view the ace editor, here is the link: http://ace.c9.io/#nav=about

Can someone please tell me how to embed it in my website. I cant understand the tutorial given on the homepage of the ace editor

All help is appreciated.

1 Answers1

4

Embedding to your website is clearly shown on the website: http://ace.c9.io/#nav=embedding

Example:

<!DOCTYPE html>
<html lang="en">
<head>
<title>ACE in Action</title>
<style type="text/css" media="screen">
    #editor { 
        position: absolute;
        top: 0;
        right: 0;
        bottom: 0;
        left: 0;
    }
</style>
</head>
<body>

<div id="editor">function foo(items) {
    var x = "All this is syntax highlighted";
    return x;
}</div>

<script src="/ace-builds/src-noconflict/ace.js" type="text/javascript" charset="utf-8"></script>
<script>
    var editor = ace.edit("editor");
    editor.setTheme("ace/theme/monokai");
    editor.getSession().setMode("ace/mode/javascript");
</script>
</body>
</html>

Cloud9 IDE

If your using the cloud9 IDE, you can download the editor via..

  • Github: git clone git://github.com/ajaxorg/ace.git
  • Bower: bower install --save git clone git://github.com/ajaxorg/ace.git

NOTE: you will need to build the project.

If you want to use the pre built ones use this instead: https://github.com/ajaxorg/ace-builds.git

Example Here's my setup for the ace-editor: https://ide.c9.io/anik786/cloud-9-sandbox

Yahya Uddin
  • 26,997
  • 35
  • 140
  • 231
  • Thanks a ton bro it worked –  Sep 02 '15 at 05:35
  • Unfortunately this wipes out everything else you might want to show. – JohnnyBizzle Oct 29 '16 at 19:59
  • 1
    @JohnnyBizzle: LoL, just change the css and remove the absolute. – Stefan Steiger Mar 08 '17 at 17:20
  • 1
    I would hardly call `ace-builds` as built. Each feature is a separate file (such as autocomplete, etc). For language files, this is fine, but for every feature ?? Would be nice if there was a true "pre-built" version somewhere or a builder, or even instructions on how to "build" the `pre-built` stuff into a single js. Their builder is rather lazy with lots of `**/*.js` so the output is directed to the same messy structure as the input. – Kraang Prime Oct 22 '18 at 13:32
  • Here's where the snippet above comes from: https://github.com/ajaxorg/ace-builds/blob/master/editor.html – Nic Scozzaro Apr 20 '19 at 01:48