Skip to content

Commit 6474408

Browse files
committed
Fix reset sandbox shortcut in code snippets
Closes #414
1 parent 23cb41f commit 6474408

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

html/js/ejs.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,8 @@ window.addEventListener("load", () => {
6969
"Ctrl-Enter"(cm) { runCode(cm.state.context) },
7070
"Cmd-Enter"(cm) { runCode(cm.state.context) },
7171
"Ctrl-`"(cm) { closeCode(cm.state.context) },
72-
"Ctrl-Q": resetSandbox
72+
"Ctrl-X"(cm) { resetSandbox(cm.state.context.sandbox) },
73+
"Cmd-X"(cm) { resetSandbox(cm.state.context.sandbox) }
7374
}
7475

7576
let nextID = 0
@@ -130,9 +131,9 @@ window.addEventListener("load", () => {
130131

131132
function openMenu(data, node) {
132133
let menu = elt("div", {"class": "sandbox-open-menu"})
133-
let items = [["Run code (ctrl-enter)", () => runCode(data)],
134+
let items = [["Run code (ctrl/cmd-enter)", () => runCode(data)],
134135
["Revert to original code", () => revertCode(data)],
135-
["Reset sandbox (ctrl-q)", () => resetSandbox(data.sandbox)]]
136+
["Reset sandbox (ctrl/cmd-x)", () => resetSandbox(data.sandbox)]]
136137
if (!data.isHTML || !data.sandbox)
137138
items.push(["Deactivate editor (ctrl-`)", () => { closeCode(data) }])
138139
items.forEach(choice => menu.appendChild(elt("div", choice[0])))
@@ -206,7 +207,6 @@ window.addEventListener("load", () => {
206207
}
207208

208209
function resetSandbox(name) {
209-
name = name || "null"
210210
if (!sandboxes.hasOwnProperty(name)) return
211211
let frame = sandboxes[name].frame
212212
frame.parentNode.removeChild(frame)

0 commit comments

Comments
 (0)