You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

18 lines
499 B

import "@hotwired/turbo-rails"
import "controllers"
import "lexxy"
// Bind ctrl + s to submit form
document.addEventListener("keydown", function (event) {
// Check if Ctrl key is pressed and the pressed key is 'S'
if ((event.ctrlKey || event.metaKey) && event.key === "s") {
// Prevent the browser's default save action
event.preventDefault();
// Submit the form
const form = document.querySelector(".has--key-ctrls");
if (form) {
form.requestSubmit();
}
}
});