mirror of
https://github.com/Yidadaa/ChatGPT-Next-Web.git
synced 2025-08-20 20:44:01 +08:00
chore: update
This commit is contained in:
@@ -876,7 +876,9 @@ export function ShortcutKeyModal(props: { onClose: () => void }) {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: Locale.Chat.ShortcutKey.clearContext,
|
title: Locale.Chat.ShortcutKey.clearContext,
|
||||||
keys: isMac ? ["⌘", "Shift", "k"] : ["Ctrl", "Shift", "k"],
|
keys: isMac
|
||||||
|
? ["⌘", "Shift", "Backspace"]
|
||||||
|
: ["Ctrl", "Shift", "Backspace"],
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
return (
|
return (
|
||||||
@@ -1513,7 +1515,7 @@ function _Chat() {
|
|||||||
const [showShortcutKeyModal, setShowShortcutKeyModal] = useState(false);
|
const [showShortcutKeyModal, setShowShortcutKeyModal] = useState(false);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const handleKeyDown = (event: any) => {
|
const handleKeyDown = (event: KeyboardEvent) => {
|
||||||
// 打开新聊天 command + shift + o
|
// 打开新聊天 command + shift + o
|
||||||
if (
|
if (
|
||||||
(event.metaKey || event.ctrlKey) &&
|
(event.metaKey || event.ctrlKey) &&
|
||||||
@@ -1564,11 +1566,11 @@ function _Chat() {
|
|||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
setShowShortcutKeyModal(true);
|
setShowShortcutKeyModal(true);
|
||||||
}
|
}
|
||||||
// 清除上下文 command + shift + delete
|
// 清除上下文 command + shift + Backspace
|
||||||
else if (
|
else if (
|
||||||
(event.metaKey || event.ctrlKey) &&
|
(event.metaKey || event.ctrlKey) &&
|
||||||
event.shiftKey &&
|
event.shiftKey &&
|
||||||
event.key.toLowerCase() === "k"
|
event.key.toLowerCase() === "backspace"
|
||||||
) {
|
) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
chatStore.updateCurrentSession((session) => {
|
chatStore.updateCurrentSession((session) => {
|
||||||
@@ -1582,10 +1584,10 @@ function _Chat() {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
window.addEventListener("keydown", handleKeyDown);
|
document.addEventListener("keydown", handleKeyDown);
|
||||||
|
|
||||||
return () => {
|
return () => {
|
||||||
window.removeEventListener("keydown", handleKeyDown);
|
document.removeEventListener("keydown", handleKeyDown);
|
||||||
};
|
};
|
||||||
}, [messages, chatStore, navigate]);
|
}, [messages, chatStore, navigate]);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user