Debian Codegraph @

crates/mdbook-html/front-end/playground_editor/editor.js

raw
1 "use strict";
2 window.editors = [];
3 (function(editors) {
4 if (typeof(ace) === 'undefined' || !ace) {
5 return;
6 }
7
8 Array.from(document.querySelectorAll('.editable')).forEach(function(editable) {
9 let display_line_numbers = window.playground_line_numbers || false;
10
11 let editor = ace.edit(editable);
12 editor.setOptions({
13 highlightActiveLine: false,
14 showPrintMargin: false,
15 showLineNumbers: display_line_numbers,
16 showGutter: display_line_numbers,
17 maxLines: Infinity,
18 fontSize: "0.875em" // please adjust the font size of the code in general.css
19 });
20
21 editor.$blockScrolling = Infinity;
22
23 editor.getSession().setMode("ace/mode/rust");
24
25 editor.originalCode = editor.getValue();
26
27 editors.push(editor);
28 });
29 })(window.editors);