Search code examples
javascriptace-editor

How to embedded ACE editor in html?


I recently need to embed Ace in my project, So I download the pre-build code from https://github.com/ajaxorg/ace-builds/ and I copied the code into my site from https://github.com/ajaxorg/ace-builds/blob/master/editor.html where it lists how to embed Ace into a web page.

I copied that the src-min folder into my project. I changed the

<script src="src-noconflict/ace.js" type="text/javascript" charset="utf-8"></script>

into

<script src="js/src-min/ace.js" type="text/javascript" charset="utf-8"></script>

When I try to browse the web page in sandbox in codeanywhere.com (I also uploaded the src-min folder), I can only see the continent in and there is no area for me to enter something new. Also, the code is in black and white.

What could I be doing wrong and what can I do to get Ace working properly?


Solution

  • First thing in such cases is to look into browser console to see if something blocks loading the script.
    As you commented, you have "frame is sandboxed and the 'allow-scripts' permission is not set." That's likely a problem with codeanywhere, try running it locally or use another service.