Feat: spell check toggle for desktop (#626)
* feat: (desktop) add spellcheck toggle for text inputs * fix: show spellcheck toggle only on desktop * fix: apply the preference consistently to chat and commit inputs
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import React from 'react';
|
||||
import { Textarea } from '@/components/ui/textarea';
|
||||
import { cn } from '@/lib/utils';
|
||||
import { useUIStore } from '@/stores/useUIStore';
|
||||
|
||||
interface CommitInputProps {
|
||||
value: string;
|
||||
@@ -8,6 +9,7 @@ interface CommitInputProps {
|
||||
placeholder?: string;
|
||||
disabled?: boolean;
|
||||
hasTouchInput?: boolean;
|
||||
isMobile?: boolean;
|
||||
}
|
||||
|
||||
const MIN_HEIGHT = 38; // Single line height
|
||||
@@ -19,8 +21,10 @@ export const CommitInput: React.FC<CommitInputProps> = ({
|
||||
placeholder = 'Commit message',
|
||||
disabled = false,
|
||||
hasTouchInput = false,
|
||||
isMobile = false,
|
||||
}) => {
|
||||
const textareaRef = React.useRef<HTMLTextAreaElement>(null);
|
||||
const inputSpellcheckEnabled = useUIStore((state) => state.inputSpellcheckEnabled);
|
||||
|
||||
// Auto-resize based on content (layout phase to avoid mount flicker)
|
||||
React.useLayoutEffect(() => {
|
||||
@@ -45,7 +49,7 @@ export const CommitInput: React.FC<CommitInputProps> = ({
|
||||
disabled={disabled}
|
||||
autoCorrect={hasTouchInput ? 'on' : 'off'}
|
||||
autoCapitalize={hasTouchInput ? 'sentences' : 'off'}
|
||||
spellCheck={hasTouchInput ? true : false}
|
||||
spellCheck={isMobile || inputSpellcheckEnabled}
|
||||
scrollbarClassName="hidden"
|
||||
className={cn(
|
||||
'rounded-lg bg-transparent resize-none overflow-y-hidden',
|
||||
|
||||
@@ -105,6 +105,7 @@ export const CommitSection: React.FC<CommitSectionProps> = ({
|
||||
placeholder="Commit message"
|
||||
disabled={commitAction !== null}
|
||||
hasTouchInput={hasTouchInput}
|
||||
isMobile={isMobile}
|
||||
/>
|
||||
|
||||
{gitmojiEnabled && (
|
||||
|
||||
Reference in New Issue
Block a user