diff --git a/data/static/js/ui.js b/data/static/js/ui.js index d9c3791..0454e15 100644 --- a/data/static/js/ui.js +++ b/data/static/js/ui.js @@ -95,3 +95,18 @@ }); listsObs.observe(document.body, { childList: true, subtree: true }) } + +{ + // babycode editor: press ctrl+enter to submit + document.querySelectorAll('.babycode-editor').forEach(ta => { + if (ta.form instanceof HTMLFormElement) { + ta.addEventListener('keydown', e => { + if (e.ctrlKey && e.key === 'Enter') { + if (ta.form.reportValidity()) { + ta.form.submit(); + } + } + }) + } + }) +}