add a command to playpen (#1066)

This commit is contained in:
rnitta 2019-10-11 21:16:06 +09:00 committed by Dylan DPC
parent 2b3304cb8b
commit 01e50303a2
1 changed files with 9 additions and 0 deletions

View File

@ -55,6 +55,15 @@ function playpen_text(playpen) {
editor.addEventListener("change", function (e) { editor.addEventListener("change", function (e) {
update_play_button(playpen_block, playground_crates); update_play_button(playpen_block, playground_crates);
}); });
// add Ctrl-Enter command to execute rust code
editor.commands.addCommand({
name: "run",
bindKey: {
win: "Ctrl-Enter",
mac: "Ctrl-Enter"
},
exec: _editor => run_rust_code(playpen_block)
});
} }
} }
} }