bugfix: add paste image functionality to main index page

This commit is contained in:
lemonknowsall committed 2025-12-12 17:54:18 -08:00
1 parent 2f50b2611c
commit 6e03767f62
3 files changed
+52 -29

No files matched your search

+7
View File
@@ -25,6 +25,7 @@ import { useSeoMeta } from '@unhead/react';
import { ShakespeareLogo } from '@/components/ShakespeareLogo';
import { AppShowcase } from '@/components/AppShowcase';
import { useToast } from '@/hooks/useToast';
import { createPasteHandler } from '@/lib/utils';
export default function Index() {
const { t } = useTranslation();
@@ -187,6 +188,11 @@ export default function Index() {
}
};
// Handle paste - extract images from clipboard
const handlePaste = createPasteHandler((file) => {
setAttachedFiles(prev => [...prev, file]);
});
// Handle textarea click - show onboarding if no providers configured
const handleTextareaClick = () => {
if (!hasProvidersConfigured) {
@@ -333,6 +339,7 @@ export default function Index() {
value={prompt}
onChange={handlePromptChange}
onKeyDown={handleKeyDown}
onPaste={handlePaste}
onClick={handleTextareaClick}
className="resize-none border-0 bg-transparent px-4 py-3 text-base focus-visible:ring-0 focus-visible:ring-offset-0 placeholder:text-muted-foreground"
disabled={isCreating || isGeneratingInfo || (hasProvidersConfigured && !providerModel.trim())}