re-add ctrl+enter to submit babycode
This commit is contained in:
@@ -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();
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user