add Ctrl + Enter keybind to upload paste
All checks were successful
Deploy App / docker (ubuntu-latest, 2.44.0, 17, 3.8.5) (push) Successful in 1m3s
Publish Docker Image / docker (ubuntu-latest, 2.44.0, 17, 3.8.5) (push) Successful in 59s

This commit is contained in:
Lee 2024-06-01 22:04:55 +01:00
parent 6cd275994e
commit 5b95ce2e33

@ -30,7 +30,20 @@
<!-- Paste Script --> <!-- Paste Script -->
<script> <script>
document.getElementById('paste-button').addEventListener('click', function() { // Handle custom key binds behavior
document.addEventListener('keydown', function(event) {
// Upload the paste when Ctrl + Enter is pressed
if (event.ctrlKey && event.key === 'Enter') {
event.preventDefault();
upload();
}
});
// Upload the paste when the paste button is clicked
document.getElementById('paste-button').addEventListener('click', () => upload());
// Upload the paste to the server
const upload = () => {
var pasteInput = document.getElementById('paste-input'); var pasteInput = document.getElementById('paste-input');
var paste = pasteInput.value; var paste = pasteInput.value;
@ -45,6 +58,6 @@
}).then(function(data) { }).then(function(data) {
window.location.href = '/' + data.id; window.location.href = '/' + data.id;
}); });
}); };
</script> </script>
</html> </html>