mirror of
https://github.com/HeyPuter/puter.git
synced 2026-05-06 01:20:41 +00:00
Merge pull request #1039 from Agastya18/feat/add-Escape-key
Docker Image CI / build-and-push-image (push) Waiting to run
Maintain Release Merge PR / update-release-pr (push) Waiting to run
release-please / release-please (push) Waiting to run
test / test (18.x) (push) Waiting to run
test / test (20.x) (push) Waiting to run
test / test (22.x) (push) Waiting to run
Docker Image CI / build-and-push-image (push) Waiting to run
Maintain Release Merge PR / update-release-pr (push) Waiting to run
release-please / release-please (push) Waiting to run
test / test (18.x) (push) Waiting to run
test / test (20.x) (push) Waiting to run
test / test (22.x) (push) Waiting to run
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