diff --git a/basaran/static/playground.js b/basaran/static/playground.js index 562a985c..78c8021d 100644 --- a/basaran/static/playground.js +++ b/basaran/static/playground.js @@ -296,9 +296,7 @@ class Completion extends EventTarget { if (highlight) { span.setAttribute( "style", - `background-color: rgba(70, 120, 220, ${ - 0.5 * prob - })` + `background-color: rgba(70, 120, 220, ${0.5 * prob})` ); } } @@ -422,10 +420,11 @@ class Inspector { handles.set(presets[0]); + let submit = document.querySelector(".pg-submit"); let prompt = document.querySelector(".pg-prompt"); let outputs = document.querySelector(".pg-outputs"); - document.querySelector(".pg-submit").addEventListener("click", (e) => { + submit.addEventListener("click", (e) => { if (completion) { if (completion.running) { completion.stop(); @@ -452,6 +451,13 @@ class Inspector { }); }); + document.addEventListener("keydown", (e) => { + if ((e.ctrlKey || e.metaKey) && e.key == "Enter") { + e.preventDefault(); + submit.click(); + } + }); + let resizePrompt = () => { prompt.style.height = 0; prompt.style.height = prompt.scrollHeight + "px";