mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-04-24 01:28:35 +02:00
Change hotkey handling to capture phase
This commit is contained in:
@@ -91,7 +91,6 @@ export function GrpcEditor({
|
|||||||
}, [alert, services, request.method, request.service]);
|
}, [alert, services, request.method, request.service]);
|
||||||
|
|
||||||
const reflectionUnavailable = reflectionError?.match(/unimplemented/i);
|
const reflectionUnavailable = reflectionError?.match(/unimplemented/i);
|
||||||
const reflectionSuccess = !reflectionError && services != null && request.protoFiles.length === 0;
|
|
||||||
reflectionError = reflectionUnavailable ? undefined : reflectionError;
|
reflectionError = reflectionUnavailable ? undefined : reflectionError;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@@ -105,7 +104,7 @@ export function GrpcEditor({
|
|||||||
placeholder="..."
|
placeholder="..."
|
||||||
ref={editorViewRef}
|
ref={editorViewRef}
|
||||||
actions={[
|
actions={[
|
||||||
<div key="reflection" className={classNames(!reflectionSuccess && '!opacity-100')}>
|
<div key="reflection" className={classNames(services == null && '!opacity-100')}>
|
||||||
<Button
|
<Button
|
||||||
size="xs"
|
size="xs"
|
||||||
color={
|
color={
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ export function GrpcProtoSelection({ requestId }: Props) {
|
|||||||
await grpc.reflect.refetch();
|
await grpc.reflect.refetch();
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
Add Files
|
Add File
|
||||||
</Button>
|
</Button>
|
||||||
<Button
|
<Button
|
||||||
isLoading={grpc.reflect.isFetching}
|
isLoading={grpc.reflect.isFetching}
|
||||||
@@ -139,7 +139,7 @@ export function GrpcProtoSelection({ requestId }: Props) {
|
|||||||
<Link href="https://github.com/grpc/grpc/blob/9aa3c5835a4ed6afae9455b63ed45c761d695bca/doc/server-reflection.md">
|
<Link href="https://github.com/grpc/grpc/blob/9aa3c5835a4ed6afae9455b63ed45c761d695bca/doc/server-reflection.md">
|
||||||
Server Reflection
|
Server Reflection
|
||||||
</Link>{' '}
|
</Link>{' '}
|
||||||
. Please manually add the <InlineCode>.proto</InlineCode> files to get started.
|
. Please manually add the <InlineCode>.proto</InlineCode> file to get started.
|
||||||
</Banner>
|
</Banner>
|
||||||
)}
|
)}
|
||||||
</VStack>
|
</VStack>
|
||||||
|
|||||||
@@ -112,11 +112,11 @@ export function useAnyHotkey(
|
|||||||
}
|
}
|
||||||
currentKeys.current.delete(normalizeKey(e.key, os));
|
currentKeys.current.delete(normalizeKey(e.key, os));
|
||||||
};
|
};
|
||||||
document.addEventListener('keydown', down);
|
document.addEventListener('keydown', down, { capture: true });
|
||||||
document.addEventListener('keyup', up);
|
document.addEventListener('keyup', up, { capture: true });
|
||||||
return () => {
|
return () => {
|
||||||
document.removeEventListener('keydown', down);
|
document.removeEventListener('keydown', down, { capture: true });
|
||||||
document.removeEventListener('keyup', up);
|
document.removeEventListener('keyup', up, { capture: true });
|
||||||
};
|
};
|
||||||
}, [options.enable, os]);
|
}, [options.enable, os]);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user