Merge pull request #2677 from SillyTavern/popups-suppress-default-hotkeys

Open popups should block all default hotkeys
This commit is contained in:
Cohee 2024-08-18 12:33:58 +03:00 committed by GitHub
commit 86af35afdd
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 5 additions and 4 deletions

View File

@ -954,6 +954,11 @@ export function initRossMods() {
* @param {KeyboardEvent} event
*/
async function processHotkeys(event) {
// Default hotkeys and shortcuts shouldn't work if any popup is currently open
if (Popup.util.isPopupOpen()) {
return;
}
//Enter to send when send_textarea in focus
if (document.activeElement == hotkeyTargets['send_textarea']) {
const sendOnEnter = shouldSendOnEnter();
@ -1107,10 +1112,6 @@ export function initRossMods() {
}
if (event.key == 'Escape') { //closes various panels
// Do not close panels if we are currently inside a popup
if (Popup.util.isPopupOpen())
return;
//dont override Escape hotkey functions from script.js
//"close edit box" and "cancel stream generation".
if ($('#curEditTextarea').is(':visible') || $('#mes_stop').is(':visible')) {