копирование элемента по ctrl+c и ctrl+v

This commit is contained in:
2025-07-25 14:11:15 +03:00
parent d9b51014e9
commit 0d25446a7e
2 changed files with 55 additions and 7 deletions

View File

@@ -578,6 +578,15 @@ export const ElementConstructor: React.FC<ElementConstructorProps> = ({
resetForm()
}
const handleElementCopy = (element: Omit<TemplateElement, 'id'>) => {
const newElement: TemplateElement = {
...element,
id: Date.now().toString(),
order: elements.length,
}
onElementAdd(newElement)
}
return (
<div className="flex h-full w-full flex-col bg-background">
<ElementFormulaBar
@@ -611,6 +620,7 @@ export const ElementConstructor: React.FC<ElementConstructorProps> = ({
onElementDelete={handleDeleteAndSelect}
onLayoutSettingsChange={onLayoutSettingsChange || (() => {})}
onElementEdit={handleEditElement}
onElementAdd={handleElementCopy}
/>
</div>