()
| 133 | } |
| 134 | |
| 135 | runCode() { |
| 136 | this.clearSandbox() |
| 137 | let val = this.editor.state.doc.toString(), type = this.editor.state.facet(language).name |
| 138 | let context = this.editor.state.facet(contextFacet) |
| 139 | Sandbox.create({ |
| 140 | loadFiles: hasIncludes(val, context.include) ? [] : context.include, |
| 141 | emptyPath: "../", |
| 142 | place: type == "html" && |
| 143 | function(node) { |
| 144 | let out = document.querySelector(".sandbox-output") |
| 145 | out.parentNode.insertBefore(node, out) |
| 146 | } |
| 147 | }).then(box => { |
| 148 | this.sandbox = box |
| 149 | this.output.clear() |
| 150 | if (type == "html") |
| 151 | box.setHTML(val, this.output) |
| 152 | else |
| 153 | box.run(val, this.output) |
| 154 | }) |
| 155 | } |
| 156 | |
| 157 | selectChapter(number, context) { |
| 158 | this.per.textContent = "" |
no test coverage detected