diff --git a/apps/ai-game-creator-shell/src/view/ui-editor/components/Inspector/InspectorSidebar.tsx b/apps/ai-game-creator-shell/src/view/ui-editor/components/Inspector/InspectorSidebar.tsx index 232c9ddbc..260942d41 100644 --- a/apps/ai-game-creator-shell/src/view/ui-editor/components/Inspector/InspectorSidebar.tsx +++ b/apps/ai-game-creator-shell/src/view/ui-editor/components/Inspector/InspectorSidebar.tsx @@ -105,6 +105,11 @@ export function InspectorSidebar({ onInsertComponent={controller.insertNodeComponent} onDeleteComponent={controller.deleteNodeComponent} onMoveComponent={controller.moveNodeComponent} + onDeleteNode={() => controller.deleteNode(view.node.id)} + deleteDisabled={ + controller.editor.isLocked || + view.node.id === controller.treeForActiveImage?.root.id + } /> ); break; @@ -271,6 +276,8 @@ function NodeInspector({ onInsertComponent, onDeleteComponent, onMoveComponent, + onDeleteNode, + deleteDisabled, }: { node: SelectedNode; parentSize: UiEditorPageController['selectedNodeParentSize']; @@ -291,6 +298,8 @@ function NodeInspector({ onInsertComponent: UiEditorPageController['insertNodeComponent']; onDeleteComponent: UiEditorPageController['deleteNodeComponent']; onMoveComponent: UiEditorPageController['moveNodeComponent']; + onDeleteNode: () => void; + deleteDisabled: boolean; }) { const inspectorReadOnly = useInspectorReadOnly(); const isReadOnly = readOnly || inspectorReadOnly; @@ -448,6 +457,13 @@ function NodeInspector({ onMoveComponent={onMoveComponent} /> + { + if (!deleteDisabled && !isReadOnly) onDeleteNode(); + }} + /> ); }