From 761cea4ccdbe98f5110be8f0efebc9cb52727bbf Mon Sep 17 00:00:00 2001 From: Ruben Fiszel Date: Thu, 20 Jul 2023 00:14:14 +0200 Subject: [PATCH] fix copying table with actions --- .../editor/component/ComponentNavigation.svelte | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/frontend/src/lib/components/apps/editor/component/ComponentNavigation.svelte b/frontend/src/lib/components/apps/editor/component/ComponentNavigation.svelte index bab7eb9d72..25a9efb65c 100644 --- a/frontend/src/lib/components/apps/editor/component/ComponentNavigation.svelte +++ b/frontend/src/lib/components/apps/editor/component/ComponentNavigation.svelte @@ -264,7 +264,21 @@ } const newItem = insertNewGridItem( $app, - (id) => ({ ...item.data, id }), + (id) => { + if (item.data.type === 'tablecomponent') { + return { + ...item.data, + id, + actionButtons: + item.data.actionButtons.map((x) => ({ + ...x, + id: x.id.replace(`${item.id}_`, `${id}_`) + })) ?? [] + } + } else { + return { ...item.data, id } + } + }, parentGrid, Object.fromEntries(gridColumns.map((column) => [column, item[column]])) )