diff --git a/DesignerSpace/Workspace/FunctionLibraries/UiObjectsFromNodes.js b/DesignerSpace/Workspace/FunctionLibraries/UiObjectsFromNodes.js index 7238889a3..4814a8993 100644 --- a/DesignerSpace/Workspace/FunctionLibraries/UiObjectsFromNodes.js +++ b/DesignerSpace/Workspace/FunctionLibraries/UiObjectsFromNodes.js @@ -149,7 +149,23 @@ function newUiObjectsFromNodes () { } function addMissingChildren (node) { + let nodeDefinition = APP_SCHEMA_MAP.get(node.type) + /* Connect to Parent */ + if (nodeDefinition.properties !== undefined) { + let previousPropertyName // Since there are cases where there are many properties with the same name,because they can hold nodes of different types but only one at the time, we have to avoind counting each property of those as individual children. + for (let i = 0; i < nodeDefinition.properties.length; i++) { + let property = nodeDefinition.properties[i] + if (property.type === 'node') { + if (property.name !== previousPropertyName) { + if (node[property.name] === undefined) { + addUIObject(node, property.childType) + previousPropertyName = property.name + } + } + } + } + } } function createUiObject (userAddingNew, uiObjectType, name, node, parentNode, chainParent, title, positionOffset) { diff --git a/DesignerSpace/Workspace/Workspace.js b/DesignerSpace/Workspace/Workspace.js index b2ed25415..c5e2afcfe 100644 --- a/DesignerSpace/Workspace/Workspace.js +++ b/DesignerSpace/Workspace/Workspace.js @@ -279,7 +279,7 @@ function newWorkspace () { break case 'Add Missing Children': { - functionLibraryUiObjectsFromNodes.addUIObject(payload.node, relatedUiObject) + functionLibraryUiObjectsFromNodes.addMissingChildren(payload.node) } break case 'Delete UI Object':