Merge pull request #3688 from Erquint/staging No swiping hotkeys when modifiers are held.
Signed| @@ -1018,6 +1018,14 @@ export function initRossMods() { | |||
| 1018 | return false; | 1018 | return false; |
| 1019 | } | 1019 | } |
| 1020 | 1020 | ||
| 1021 | function isModifiedKeyboardEvent(event) { | ||
| 1022 | return (event instanceof KeyboardEvent && | ||
| 1023 | event.shiftKey || | ||
| 1024 | event.ctrlKey || | ||
| 1025 | event.altKey || | ||
| 1026 | event.metaKey); | ||
| 1027 | } | ||
| 1028 | |||
| 1021 | $(document).on('keydown', async function (event) { | 1029 | $(document).on('keydown', async function (event) { |
| 1022 | await processHotkeys(event.originalEvent); | 1030 | await processHotkeys(event.originalEvent); |
| 1023 | }); | 1031 | }); |
| @@ -1141,7 +1149,8 @@ export function initRossMods() { | |||
| 1141 | $('#send_textarea').val() === '' && | 1149 | $('#send_textarea').val() === '' && |
| 1142 | $('#character_popup').css('display') === 'none' && | 1150 | $('#character_popup').css('display') === 'none' && |
| 1143 | $('#shadow_select_chat_popup').css('display') === 'none' && | 1151 | $('#shadow_select_chat_popup').css('display') === 'none' && |
| 1144 | !isInputElementInFocus() | 1152 | !isInputElementInFocus() && |
| 1153 | !isModifiedKeyboardEvent(event) | ||
| 1145 | ) { | 1154 | ) { |
| 1146 | $('.swipe_left:last').trigger('click', { source: 'keyboard', repeated: event.repeat }); | 1155 | $('.swipe_left:last').trigger('click', { source: 'keyboard', repeated: event.repeat }); |
| 1147 | return; | 1156 | return; |
| @@ -1154,7 +1163,8 @@ export function initRossMods() { | |||
| 1154 | $('#send_textarea').val() === '' && | 1163 | $('#send_textarea').val() === '' && |
| 1155 | $('#character_popup').css('display') === 'none' && | 1164 | $('#character_popup').css('display') === 'none' && |
| 1156 | $('#shadow_select_chat_popup').css('display') === 'none' && | 1165 | $('#shadow_select_chat_popup').css('display') === 'none' && |
| 1157 | !isInputElementInFocus() | 1166 | !isInputElementInFocus() && |
| 1167 | !isModifiedKeyboardEvent(event) | ||
| 1158 | ) { | 1168 | ) { |
| 1159 | $('.swipe_right:last').trigger('click', { source: 'keyboard', repeated: event.repeat }); | 1169 | $('.swipe_right:last').trigger('click', { source: 'keyboard', repeated: event.repeat }); |
| 1160 | return; | 1170 | return; |
| @@ -5,7 +5,7 @@ | |||
| 5 | <li><kbd data-i18n="help_hotkeys_1">Up</kbd> = <span data-i18n="help_hotkeys_2">Edit last message in chat</span></li> | 5 | <li><kbd data-i18n="help_hotkeys_1">Up</kbd> = <span data-i18n="help_hotkeys_2">Edit last message in chat</span></li> |
| 6 | <li><kbd data-i18n="help_hotkeys_3">Ctrl+Up</kbd> = <span data-i18n="help_hotkeys_4">Edit last USER message in chat</span></li> | 6 | <li><kbd data-i18n="help_hotkeys_3">Ctrl+Up</kbd> = <span data-i18n="help_hotkeys_4">Edit last USER message in chat</span></li> |
| 7 | <li><kbd data-i18n="help_hotkeys_5">Left</kbd> = <span data-i18n="help_hotkeys_6">swipe left</span></li> | 7 | <li><kbd data-i18n="help_hotkeys_5">Left</kbd> = <span data-i18n="help_hotkeys_6">swipe left</span></li> |
| 8 | <li><kbd data-i18n="help_hotkeys_7">Right</kbd> = <span data-i18n="help_hotkeys_8">swipe right (NOTE: swipe hotkeys are disabled when chatbar has something typed into it)</span></li> | 8 | <li><kbd data-i18n="help_hotkeys_7">Right</kbd> = <span data-i18n="help_hotkeys_8">swipe right (NOTE: swipe hotkeys only apply without modifiers and are disabled when chatbar has something typed into it)</span></li> |
| 9 | <li><kbd data-i18n="help_hotkeys_9">Enter</kbd> <span data-i18n="help_hotkeys_10">(with chat bar selected)</span> = <span data-i18n="help_hotkeys_10_1">send your message to AI</span></li> | 9 | <li><kbd data-i18n="help_hotkeys_9">Enter</kbd> <span data-i18n="help_hotkeys_10">(with chat bar selected)</span> = <span data-i18n="help_hotkeys_10_1">send your message to AI</span></li> |
| 10 | <li><kbd data-i18n="help_hotkeys_11">Ctrl+Enter</kbd> = <span data-i18n="help_hotkeys_12">Regenerate the last AI response</span></li> | 10 | <li><kbd data-i18n="help_hotkeys_11">Ctrl+Enter</kbd> = <span data-i18n="help_hotkeys_12">Regenerate the last AI response</span></li> |
| 11 | <li><kbd data-i18n="help_hotkeys_13">Alt+Enter</kbd> = <span data-i18n="help_hotkeys_14">Continue the last AI response</span></li> | 11 | <li><kbd data-i18n="help_hotkeys_13">Alt+Enter</kbd> = <span data-i18n="help_hotkeys_14">Continue the last AI response</span></li> |