Версия 1.2.19 Добавлен просмотр изображений путем нажатия кнопкой мыши при пред-просмотре данных статей для импорта.
This commit is contained in:
parent
ac328c1f23
commit
239a6287a6
@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "vite-react-typescript-starter",
|
"name": "vite-react-typescript-starter",
|
||||||
"private": true,
|
"private": true,
|
||||||
"version": "1.2.18",
|
"version": "1.2.19",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "vite",
|
"dev": "vite",
|
||||||
|
|||||||
@ -26,6 +26,8 @@ export function ImportArticlesPage() {
|
|||||||
const [editingArticle, setEditingArticle] = useState<Article | null>(null);
|
const [editingArticle, setEditingArticle] = useState<Article | null>(null);
|
||||||
const [isSaving, setIsSaving] = useState(false);
|
const [isSaving, setIsSaving] = useState(false);
|
||||||
const [showSuccessModal, setShowSuccessModal] = useState(false);
|
const [showSuccessModal, setShowSuccessModal] = useState(false);
|
||||||
|
const [previewImgUrl, setPreviewImgUrl] = useState<string | null>(null);
|
||||||
|
const [previewSize, setPreviewSize] = useState<{w: number; h: number} | null>(null);
|
||||||
const [error, setError] = useState<string | null>(null);
|
const [error, setError] = useState<string | null>(null);
|
||||||
const fileInputRef = useRef<HTMLInputElement>(null);
|
const fileInputRef = useRef<HTMLInputElement>(null);
|
||||||
|
|
||||||
@ -350,11 +352,17 @@ export function ImportArticlesPage() {
|
|||||||
<img
|
<img
|
||||||
src={imageUrl}
|
src={imageUrl}
|
||||||
alt={`image-${index + 1}`}
|
alt={`image-${index + 1}`}
|
||||||
className="w-full h-48 object-cover rounded-md mb-2"
|
className="w-full h-48 object-cover rounded-md mb-2 cursor-pointer hover:opacity-80 transition"
|
||||||
|
title="Показать изображение целиком"
|
||||||
|
onClick={(e) => {
|
||||||
|
const rect = e.currentTarget.getBoundingClientRect();
|
||||||
|
setPreviewSize({ w: rect.width, h: rect.height });
|
||||||
|
setPreviewImgUrl(imageUrl);
|
||||||
|
}}
|
||||||
onError={(e) => {
|
onError={(e) => {
|
||||||
const tgt = e.currentTarget;
|
const target = e.currentTarget;
|
||||||
tgt.onerror = null;
|
target.onerror = null;
|
||||||
tgt.src = fallbackImg;
|
target.src = fallbackImg;
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
@ -506,6 +514,31 @@ export function ImportArticlesPage() {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
|
{/* МОДАЛЬНОЕ ОКНО ПОЛНОГО ПРОСМОТРА ИЗОБРАЖЕНИЯ */}
|
||||||
|
{previewImgUrl && (
|
||||||
|
<div
|
||||||
|
className="fixed inset-0 bg-black bg-opacity-70 flex justify-center items-center z-50 p-4"
|
||||||
|
onClick={() => setPreviewImgUrl(null)} // закрытие по клику на фон
|
||||||
|
>
|
||||||
|
<div className="bg-white rounded-lg shadow-lg max-w-3xl w-full p-4 relative">
|
||||||
|
|
||||||
|
<img
|
||||||
|
src={previewImgUrl}
|
||||||
|
alt="full-preview"
|
||||||
|
style={{
|
||||||
|
width: previewSize ? previewSize.w * 2 : 'auto',
|
||||||
|
height: previewSize ? previewSize.h * 2 : 'auto',
|
||||||
|
maxWidth: '90vw',
|
||||||
|
maxHeight: '90vh',
|
||||||
|
}}
|
||||||
|
className="object-contain rounded cursor-pointer"
|
||||||
|
onClick={() => setPreviewImgUrl(null)}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
|
||||||
</main>
|
</main>
|
||||||
</div>
|
</div>
|
||||||
</AuthGuard>
|
</AuthGuard>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user