(editor)
| 212 | } |
| 213 | |
| 214 | function runCode(editor) { |
| 215 | let context = editor.state.facet(contextFacet) |
| 216 | context.output.clear() |
| 217 | let val = editor.state.doc.toString() |
| 218 | getSandbox(context.sandbox, context.isHTML).then(box => { |
| 219 | if (context.isHTML) |
| 220 | box.setHTML(val, context.output).then(() => { |
| 221 | if (context.orig.getAttribute("data-focus")) { |
| 222 | box.win.focus() |
| 223 | box.win.document.body.focus() |
| 224 | } |
| 225 | }) |
| 226 | else |
| 227 | box.run(val, context.output).then(value => { |
| 228 | if (value != null && context.meta && /\bexpr\b/.test(context.meta) && context.output.empty) |
| 229 | box.out("log", [value]) |
| 230 | }) |
| 231 | }) |
| 232 | } |
| 233 | |
| 234 | function closeCode(editor) { |
| 235 | let context = editor.state.facet(contextFacet) |
no test coverage detected