add Ctrl + Enter keybind to upload paste
This commit is contained in:
parent
6cd275994e
commit
5b95ce2e33
@ -30,7 +30,20 @@
|
||||
|
||||
<!-- Paste 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 paste = pasteInput.value;
|
||||
|
||||
@ -45,6 +58,6 @@
|
||||
}).then(function(data) {
|
||||
window.location.href = '/' + data.id;
|
||||
});
|
||||
});
|
||||
};
|
||||
</script>
|
||||
</html>
|
Reference in New Issue
Block a user