エディターを作成するには、次のようにします。
HTML:
<textarea id="code1"></textarea>
<textarea id="code2"></textarea>
JS:
var editor1 = ace.edit('code1');
var editor2 = ace.edit('code2');
editor1.getSession().setValue("this text will be in the first editor");
editor2.getSession().setValue("and this in the second");
CSS:
#code1, code2 {
position: absolute;
width: 400px;
height: 50px;
}
それらは、明示的に配置およびサイズ設定する必要があります。show() と hide() によって、jQuery 関数を参照していると思います。彼らがどのようにそれを行うのか正確にはわかりませんが、DOM で占有するスペースを変更することはできません。次を使用して非表示および表示します。
$('#code1').css('visibility', 'visible');
$('#code2').css('visibility', 'hidden');
css プロパティ 'display' を使用すると機能しません。
テーマやモードなどを追加する方法については、こちらの wiki をご覧ください... https://github.com/ajaxorg/ace/wiki/Embedding---API
注: テキストエリアである必要はありません。必要な要素であれば何でもかまいません。