Can Ace Editor support multiple code editors in one page?

前端 未结 4 1107
一整个雨季
一整个雨季 2021-01-02 04:19

I\'m looking to implement a web app that features \"coding-competition\"-styled interface with 2 different code editors in a single screen. One will be read only and the oth

4条回答
  •  鱼传尺愫
    2021-01-02 04:38

    Yes it can support. Look at my example http://jsfiddle.net/igos/qLAvN/

    $(function() {
        var editor1 = ace.edit("editor1");
        editor1.getSession().setMode("ace/mode/java");
    
        var editor2 = ace.edit("editor2");
        var editor3 = ace.edit("editor3");
        $( "#accordion" ).accordion({
            fillSpace: true,
            change: function() {
                $(editor1).resize(); 
                $(editor2).resize(); 
                $(editor3).resize(); 
            }
            });
    });
    

提交回复
热议问题