How to load ace editor

后端 未结 4 1776
半阙折子戏
半阙折子戏 2021-02-12 22:17

I am trying to use the Ace code editor library (http://ace.ajax.org/), but im having trouble. According to the embedding guide, this should load the required js files from Amazo

4条回答
  •  挽巷
    挽巷 (楼主)
    2021-02-12 22:35

    I faced trouble when trying to get this done. The code given in ACE homepage didn't work for me. I had all my files in local directory, but you can use a CDN instead if you want.

    I placed the ace directory from lib/ace into my static/ directory. Change that part to your own location.

    I had to use Require.js api to load ace. This is the code that worked for me :

    
    
    
    ACE in Action
    
    
    
    
    
    function foo(items) { var x = "All this is syntax highlighted"; return x; }

    Source: https://github.com/ajaxorg/ace/issues/1017

    Checkout this page if you get some crazy errors: http://requirejs.org/docs/errors.html

提交回复
热议问题