diff --git a/src/components/TemplateManager/VisualLayoutEditor.tsx b/src/components/TemplateManager/VisualLayoutEditor.tsx index 499887c..6e3a86b 100644 --- a/src/components/TemplateManager/VisualLayoutEditor.tsx +++ b/src/components/TemplateManager/VisualLayoutEditor.tsx @@ -15,6 +15,8 @@ import React, { useCallback, useMemo, useState } from 'react'; import { Rnd } from 'react-rnd'; import { ElementLayout, ElementType, FormLayoutSettings, TemplateElement } from '../../types/template'; import { Button } from '../ui/button'; +import { Input } from '../ui/input'; +import { Textarea } from '../ui/textarea'; interface VisualLayoutEditorProps { elements: TemplateElement[]; @@ -65,7 +67,6 @@ const DraggableElement: React.FC = React.memo(({ gridSize, }) => { const layout = element.layout || { x: 50, y: 50, width: 300, height: 80, zIndex: 1 }; - const elementColor = ELEMENT_COLORS[element.type]; const handleDragStop = useCallback((_e: any, d: { x: number; y: number }) => { // Вызываем onUpdate только если позиция действительно изменилась, @@ -95,6 +96,57 @@ const DraggableElement: React.FC = React.memo(({ onEdit?.(); }, [onEdit]); + /* + * Render a lightweight, disabled preview of the element so that the user can + * see how the real control looks directly on the canvas instead of a plain + * colored square. Keeping the elements disabled and wrapped with + * `pointer-events-none` guarantees that they do not interfere with the drag + * behaviour of Rnd and keeps rendering costs minimal. + */ + const previewControl = useMemo(() => { + switch (element.type) { + case 'text': + return ; + case 'textarea': + return