2018-04-08 23:10:44 -05:00
|
|
|
"use strict";
|
2017-06-29 00:35:20 -04:00
|
|
|
window.editors = [];
|
|
|
|
|
(function(editors) {
|
|
|
|
|
if (typeof(ace) === 'undefined' || !ace) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2018-01-12 19:44:13 +01:00
|
|
|
Array.from(document.querySelectorAll('.editable')).forEach(function(editable) {
|
2020-06-22 07:34:25 -07:00
|
|
|
let display_line_numbers = window.playground_line_numbers || false;
|
2019-09-24 21:27:02 +08:00
|
|
|
|
2018-01-12 19:44:13 +01:00
|
|
|
let editor = ace.edit(editable);
|
2017-06-29 00:35:20 -04:00
|
|
|
editor.setOptions({
|
|
|
|
|
highlightActiveLine: false,
|
|
|
|
|
showPrintMargin: false,
|
2019-09-24 21:27:02 +08:00
|
|
|
showLineNumbers: display_line_numbers,
|
|
|
|
|
showGutter: display_line_numbers,
|
2018-06-19 22:28:23 +02:00
|
|
|
maxLines: Infinity,
|
2018-11-09 17:34:57 +01:00
|
|
|
fontSize: "0.875em" // please adjust the font size of the code in general.css
|
2017-06-29 00:35:20 -04:00
|
|
|
});
|
|
|
|
|
|
|
|
|
|
editor.$blockScrolling = Infinity;
|
|
|
|
|
|
|
|
|
|
editor.getSession().setMode("ace/mode/rust");
|
|
|
|
|
|
|
|
|
|
editor.originalCode = editor.getValue();
|
|
|
|
|
|
|
|
|
|
editors.push(editor);
|
|
|
|
|
});
|
|
|
|
|
})(window.editors);
|