forked from XiaoMo/ChatGPT-Next-Web
Merge pull request #1417 from yanCode/fix/hotkey-clashes
Fix bug #1413 hotkey clashes
This commit is contained in:
commit
c3676091ee
@ -230,7 +230,9 @@ export function PromptHints(props: {
|
|||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const onKeyDown = (e: KeyboardEvent) => {
|
const onKeyDown = (e: KeyboardEvent) => {
|
||||||
if (noPrompts) return;
|
if (noPrompts) return;
|
||||||
|
if (e.metaKey || e.altKey || e.ctrlKey) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
// arrow up / down to select prompt
|
// arrow up / down to select prompt
|
||||||
const changeIndex = (delta: number) => {
|
const changeIndex = (delta: number) => {
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
@ -491,7 +493,11 @@ export function Chat() {
|
|||||||
// check if should send message
|
// check if should send message
|
||||||
const onInputKeyDown = (e: React.KeyboardEvent<HTMLTextAreaElement>) => {
|
const onInputKeyDown = (e: React.KeyboardEvent<HTMLTextAreaElement>) => {
|
||||||
// if ArrowUp and no userInput, fill with last input
|
// if ArrowUp and no userInput, fill with last input
|
||||||
if (e.key === "ArrowUp" && userInput.length <= 0) {
|
if (
|
||||||
|
e.key === "ArrowUp" &&
|
||||||
|
userInput.length <= 0 &&
|
||||||
|
!(e.metaKey || e.altKey || e.ctrlKey)
|
||||||
|
) {
|
||||||
setUserInput(localStorage.getItem(LAST_INPUT_KEY) ?? "");
|
setUserInput(localStorage.getItem(LAST_INPUT_KEY) ?? "");
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
return;
|
return;
|
||||||
@ -790,6 +796,7 @@ export function Chat() {
|
|||||||
hitBottom={hitBottom}
|
hitBottom={hitBottom}
|
||||||
showPromptHints={() => {
|
showPromptHints={() => {
|
||||||
inputRef.current?.focus();
|
inputRef.current?.focus();
|
||||||
|
setUserInput("/");
|
||||||
onSearch("");
|
onSearch("");
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
|
Loading…
Reference in New Issue
Block a user