MCPcopy Index your code
hub / github.com/marijnh/Eloquent-JavaScript / showEditorControls

Function showEditorControls

src/client/ejs.mjs:249–275  ·  view source on GitHub ↗
(editor)

Source from the content-addressed store, hash-verified

247 }
248
249 function showEditorControls(editor) {
250 if (editor.dom.parentNode.querySelector(".editor-controls")) return
251 editor.dom.parentNode.appendChild(elt("div", {
252 class: "editor-controls"
253 }, elt("button", {
254 onmousedown: e => {
255 runCode(editor)
256 e.preventDefault()
257 },
258 title: `Run code (${modName}Enter)`,
259 "aria-label": "Run code"
260 }, "▸"), elt("button", {
261 onmousedown: e => {
262 revertCode(editor)
263 e.preventDefault()
264 },
265 title: `Revert code (${modName}j)`,
266 "aria-label": "Revert code"
267 }, "▫"), elt("button", {
268 onmousedown: e => {
269 resetSandbox(editor.state.facet(contextFacet).sandbox)
270 e.preventDefault()
271 },
272 title: `Reset sandbox (${modName}Escape)`,
273 "aria-label": "Reset sandbox"
274 }, "ø")))
275 }
276
277 function hideEditorControls(editor) {
278 let controls = editor.dom.parentNode.querySelector(".editor-controls")

Callers 1

activateCodeFunction · 0.85

Calls 4

eltFunction · 0.85
runCodeFunction · 0.85
revertCodeFunction · 0.85
resetSandboxFunction · 0.85

Tested by

no test coverage detected