add close shortkey

This commit is contained in:
sijinhui 2024-09-13 11:58:03 +08:00
parent 9142cd3303
commit 969558a126
2 changed files with 5 additions and 3 deletions

View File

@ -1563,7 +1563,7 @@ function _Chat() {
// 展示快捷键 command + /
else if ((event.metaKey || event.ctrlKey) && event.key === "/") {
event.preventDefault();
setShowShortcutKeyModal(true);
setShowShortcutKeyModal(!showShortcutKeyModal);
}
};
@ -1572,7 +1572,7 @@ function _Chat() {
return () => {
window.removeEventListener("keydown", handleKeyDown);
};
}, [messages, chatStore, navigate]);
}, [messages, chatStore, navigate, showShortcutKeyModal]);
return (
<div className={styles.chat} key={session.id}>

View File

@ -85,8 +85,10 @@ merge(fallbackLang, targetLang);
export default fallbackLang as LocaleType;
function getItem(key: string) {
if (typeof window !== "undefined") {
return localStorage.getItem(key);
}
}
function setItem(key: string, value: string) {
localStorage.setItem(key, value);