@@ -54,6 +63,7 @@ export function AIChatInput(props: {
'pb-12',
'h-auto',
'bg-transparent',
+ 'peer',
'max-h-64',
'placeholder:text-tint/8',
'transition-colors',
@@ -69,6 +79,12 @@ export function AIChatInput(props: {
placeholder={tString(language, 'ai_chat_input_placeholder')}
onChange={handleInput}
onKeyDown={(event) => {
+ if (event.key === 'Escape') {
+ event.preventDefault();
+ event.currentTarget.blur();
+ return;
+ }
+
if (event.key === 'Enter' && !event.shiftKey && value.trim()) {
event.preventDefault();
event.currentTarget.style.height = 'auto';
@@ -76,6 +92,9 @@ export function AIChatInput(props: {
}
}}
/>
+
+
+
{children}
-
+
);
}
-
-function Shortcut() {
- const [operatingSystem, setOperatingSystem] = useState
(null);
-
- useEffect(() => {
- function getOperatingSystem() {
- const platform = navigator.platform.toLowerCase();
-
- if (platform.includes('mac')) return 'mac';
- if (platform.includes('win')) return 'win';
-
- return 'win';
- }
-
- setOperatingSystem(getOperatingSystem());
- }, []);
-
- return (
-
-
- {operatingSystem === 'mac' ? '⌘' : 'Ctrl'}
-
-
- K
-
-
- );
-}
diff --git a/packages/gitbook/src/components/primitives/Button.tsx b/packages/gitbook/src/components/primitives/Button.tsx
index 5069db59d..6c6f1789c 100644
--- a/packages/gitbook/src/components/primitives/Button.tsx
+++ b/packages/gitbook/src/components/primitives/Button.tsx
@@ -16,7 +16,7 @@ type ButtonProps = {
iconOnly?: boolean;
size?: 'default' | 'medium' | 'small';
className?: ClassValue;
- label?: string;
+ label?: string | React.ReactNode;
} & LinkInsightsProps &
HTMLAttributes;
@@ -94,7 +94,7 @@ export function Button({
className={domClassName}
classNames={['ButtonStyles']}
insights={insights}
- aria-label={label}
+ aria-label={label?.toString()}
target={target}
{...rest}
>
@@ -107,7 +107,7 @@ export function Button({