mirror of
https://github.com/lencx/ChatGPT.git
synced 2026-02-06 14:26:49 +00:00
fix: tray uses the Enter key to send a message (#533)
This commit is contained in:
parent
71b257c0cf
commit
5e5d6d268e
11
src-tauri/src/scripts/cmd.js
vendored
11
src-tauri/src/scripts/cmd.js
vendored
@ -166,8 +166,12 @@ async function cmdTip() {
|
||||
// Enter a command starting with `/` and press a space to automatically fill `chatgpt prompt`.
|
||||
// If more than one command appears in the search results, the first one will be used by default.
|
||||
function cmdKeydown(event) {
|
||||
|
||||
if (!window.__CHAT_MODEL_CMD_PROMPT__) {
|
||||
if (!event.shiftKey && event.keyCode === 13 && __TAURI_METADATA__.__currentWindow.label === 'tray') {
|
||||
const btn = document.querySelector('form button');
|
||||
if (btn) btn.click();
|
||||
event.preventDefault();
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
@ -249,11 +253,6 @@ async function cmdTip() {
|
||||
|
||||
event.preventDefault();
|
||||
}
|
||||
|
||||
if (event.keyCode === 13 && __TAURI_METADATA__.__currentWindow.label === 'tray') {
|
||||
const btn = document.querySelector('form button');
|
||||
if (btn) btn.click();
|
||||
}
|
||||
}
|
||||
searchInput.removeEventListener('keydown', cmdKeydown, { capture: true });
|
||||
searchInput.addEventListener('keydown', cmdKeydown, { capture: true });
|
||||
|
||||
Loading…
Reference in New Issue
Block a user