feat: automaticke alt texty s moznostou rucneho prepisu (uloha 14)
- produkt: nazov produktu, ostatne obrazky: nadpis okna / nazov modulu - z alt textu sa odstrania HTML znacky (napr. <br> v nadpisoch) - pri kazdom obrazku pole Alt text; ak je vyplnene, ma prednost Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
23ac4dc830
commit
d43a1dae40
5 files changed
+96
-12
No files matched your search
@@ -8,13 +8,20 @@ interface ImageUploadInputProps {
|
||||
value: string;
|
||||
onChange: (url: string) => void;
|
||||
placeholder?: string;
|
||||
// Voliteľný ručný alt text; prázdny = použije sa automatický (altPlaceholder)
|
||||
altValue?: string;
|
||||
onAltChange?: (alt: string) => void;
|
||||
altPlaceholder?: string;
|
||||
}
|
||||
|
||||
export const ImageUploadInput: React.FC<ImageUploadInputProps> = ({
|
||||
label = 'Obrázok',
|
||||
value,
|
||||
onChange,
|
||||
placeholder = 'https://... alebo nahrajte súbor'
|
||||
placeholder = 'https://... alebo nahrajte súbor',
|
||||
altValue,
|
||||
onAltChange,
|
||||
altPlaceholder
|
||||
}) => {
|
||||
const fileInputRef = useRef<HTMLInputElement>(null);
|
||||
const [isUploading, setIsUploading] = useState(false);
|
||||
@@ -107,6 +114,17 @@ export const ImageUploadInput: React.FC<ImageUploadInputProps> = ({
|
||||
)}
|
||||
</button>
|
||||
</div>
|
||||
|
||||
{onAltChange && (
|
||||
<input
|
||||
type="text"
|
||||
value={altValue || ''}
|
||||
onChange={(e) => onAltChange(e.target.value)}
|
||||
placeholder={altPlaceholder ? `Alt text (automaticky: ${altPlaceholder})` : 'Alt text'}
|
||||
title="Alt text obrázka. Ak ho nevyplníte, doplní sa automaticky."
|
||||
className="w-full text-[11px] border border-gray-200 rounded-lg px-2 py-1.5 bg-white placeholder:text-gray-400"
|
||||
/>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
};
|
||||
Reference in new issue
Block a user