mirror of
https://github.com/HeyPuter/puter.git
synced 2026-05-04 08:30:39 +00:00
feat: add Escape key functionality to UIPrompt for closing the prompt
This commit is contained in:
@@ -81,6 +81,15 @@ function UIPrompt(options){
|
||||
setTimeout(function(){
|
||||
$(this_window).find('.prompt-input').get(0).focus({preventScroll:true});
|
||||
}, 30);
|
||||
|
||||
// Add event listener for Escape key
|
||||
$(document).on('keyup.uiprompt', function(e) {
|
||||
if (e.key === 'Escape') {
|
||||
resolve(false);
|
||||
$(el_window).close();
|
||||
$(document).off('keyup.uiprompt'); // Remove event listener
|
||||
}
|
||||
});
|
||||
},
|
||||
...options.window_options,
|
||||
window_css:{
|
||||
@@ -108,6 +117,7 @@ function UIPrompt(options){
|
||||
resolve(false);
|
||||
}
|
||||
$(el_window).close();
|
||||
$(document).off('keyup.uiprompt'); // Remove event listener
|
||||
return false;
|
||||
})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user