You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// parentComponent is the component this child is generated from (ex. instance of Box has comp of Box)
46
-
letparentComponent;
46
+
letparentComponent: ComponentInt;
47
47
48
48
// conditional if adding an HTML component
49
49
if(childType==='COMP'){
@@ -52,6 +52,23 @@ export const addChild = (
52
52
);
53
53
}
54
54
55
+
letcheck: boolean;
56
+
if(!state.codeReadOnly){
57
+
if(childType==='COMP'){
58
+
check=window.confirm(
59
+
`Are you sure you want to add ${strippedTitle} as a child to ${parentComponent.title} while the program is in "Edit Mode"? \n\nAll of the changes to the "Code Preview" for the ${parentComponent.title} component will be overridden!`
60
+
);
61
+
}else{
62
+
check=window.confirm(
63
+
`Are you sure you want to add an HTML element to ${view.title} component while the program is in "Edit Mode"? \n\nAll of the changes to the "Code Preview" for the ${view.title} component will be overridden!`
64
+
);
65
+
}
66
+
if(!check){
67
+
return{
68
+
...state
69
+
};
70
+
}
71
+
}
55
72
interfacehtmlElemPositionInt{
56
73
width: number;
57
74
height: number;
@@ -124,7 +141,8 @@ export const addChild = (
124
141
focusComponent: component,// refresh the focus component so we have the new child
`Are you sure you want to delete ${parentComponentCopy.childrenArray[indexToDelete].componentName} as a child to ${parentComponentCopy.title} while the program is in "Edit Mode"? \n\nAll of the changes to the "Code Preview" for the ${parentComponentCopy.title} component will be overridden!`
328
+
);
329
+
if(!check){
330
+
return{
331
+
...state
332
+
};
333
+
}
334
+
}
308
335
if(indexToDelete<0){
309
336
returnwindow.alert('No such child component found');
310
337
}
@@ -338,7 +365,8 @@ export const deleteChild = (
338
365
]||cloneDeep(state.initialApplicationFocusChild),// guard in case final child is deleted
//confimation window to see if user really wants to delete component
355
-
constresult=window.confirm(
356
-
`Are you sure you want to delete ${compName[0].title}?`
357
-
);
358
-
//if cancelled, return focus to current selected component
359
-
if(!result){
360
-
return{
361
-
...state,
362
-
focusComponent: compName[0]
363
-
};
382
+
383
+
//if the program is in the edit mode
384
+
if(!state.codeReadOnly){
385
+
constcheck=window.confirm(
386
+
`Are you sure you want to delete ${compName[0].title} while the program is in the "Edit Mode"? \n\nAll of the changes to the "Code Preview" for the related components will be overridden!`
387
+
);
388
+
if(!check){
389
+
return{
390
+
...state,
391
+
focusComponent: compName[0]
392
+
};
393
+
}
394
+
}else{
395
+
//confirmation window to see if user really wants to delete component
396
+
constresult=window.confirm(
397
+
`Are you sure you want to delete ${compName[0].title}?\n\nAll of the changes to the "Code Preview" for the related components will be overridden!`
398
+
);
399
+
if(!result){
400
+
return{
401
+
...state,
402
+
focusComponent: compName[0]
403
+
};
404
+
}
364
405
}
406
+
//if cancelled, return focus to current selected component
365
407
//if app is selected, return state
366
408
//is this really necessary if the App component is disabled from being deleted? -Tony
0 commit comments