fix: resolved an issue where number keys were not working on the web (#616)

* fix: resolved an issue where number keys were not working on the web

* docs: update changelog
This commit is contained in:
ayangweb
2025-06-06 11:47:38 +08:00
committed by GitHub
parent db41e817c3
commit 1fbf5d6552
3 changed files with 11 additions and 1 deletions

View File

@@ -22,6 +22,7 @@ Information about release notes of Coco Server is provided here.
- fix: new chat assistant id not found #603
- fix: resolve regex error on older macOS versions #605
- fix: fix chat log update and sorting issues #612
- fix: resolved an issue where number keys were not working on the web #616
### ✈️ Improvements

1
scripts/devWeb.ts Normal file
View File

@@ -0,0 +1 @@
(() => {})();

View File

@@ -84,6 +84,8 @@ export function useKeyboardNavigation({
}
if (e.key >= "0" && e.key <= "9" && showIndex && isMetaOrCtrlKey(e)) {
e.preventDefault();
let index = parseInt(e.key, 10);
index = index === 0 ? 9 : index - 1;
@@ -91,7 +93,13 @@ export function useKeyboardNavigation({
const item = globalItemIndexMap[index];
if (item?.on_opened) {
platformAdapter.invokeBackend("open", { onOpened: item.on_opened });
return platformAdapter.invokeBackend("open", {
onOpened: item.on_opened,
});
}
if (item?.url) {
OpenURLWithBrowser(item.url);
}
}
},