fix(core): improve the UX for edit collection (#4827)

Co-authored-by: Peng Xiao <pengxiao@outlook.com>
This commit is contained in:
3720
2023-11-07 18:18:56 +08:00
committed by GitHub
parent 7305530d97
commit 08e7fa3486
7 changed files with 121 additions and 93 deletions
+19 -2
View File
@@ -4,7 +4,9 @@ import * as RadixDialog from '@radix-ui/react-dialog';
import * as React from 'react';
import { commandScore } from './command-score';
type Children = { children?: React.ReactNode };
type Children = {
children?: React.ReactNode;
};
type DivProps = React.HTMLAttributes<HTMLDivElement>;
type LoadingProps = Children &
@@ -117,7 +119,11 @@ type Context = {
type State = {
search: string;
value: string;
filtered: { count: number; items: Map<string, number>; groups: Set<string> };
filtered: {
count: number;
items: Map<string, number>;
groups: Set<string>;
};
};
type Store = {
subscribe: (callback: () => void) => () => void;
@@ -827,6 +833,17 @@ const Input = React.forwardRef<HTMLInputElement, InputProps>(
ref={forwardedRef}
{...etc}
cmdk-input=""
onKeyDown={e => {
if (
e.key === 'Escape' ||
e.key === 'k' ||
e.key.startsWith('Arrow') ||
e.key === 'Enter'
) {
return;
}
e.stopPropagation();
}}
autoComplete="off"
autoCorrect="off"
spellCheck={false}