@@ -29,24 +29,24 @@ function Canvas(props): JSX.Element {
29
29
let id = ( parentId ) ? parentId : null ;
30
30
if ( child . typeId < 1000 ) {
31
31
masterArr . push ( {
32
- type : "HTML Element" ,
33
- typeId : child . typeId ,
32
+ type : "HTML Element" ,
33
+ typeId : child . typeId ,
34
34
childId : id
35
35
} )
36
36
if ( child . children . length ) {
37
37
deepChildCopy ( child . children , child . childId ) ;
38
- }
38
+ }
39
39
}
40
40
}
41
41
}
42
42
deepChildCopy ( children , null ) ;
43
43
setCopiedChildrenArr ( masterArr ) ;
44
44
}
45
-
45
+
46
46
const components = state . components
47
47
48
48
// find the ID of the newly created component
49
- const newId = components [ components . length - 1 ] [ 'id' ]
49
+ const newId = components [ components . length - 1 ] [ 'id' ]
50
50
dispatch ( {
51
51
type : 'ADD CHILD' ,
52
52
payload : {
@@ -56,8 +56,8 @@ function Canvas(props): JSX.Element {
56
56
}
57
57
} ) ;
58
58
}
59
- setNewComp ( false )
60
- } , [ newComp ] )
59
+ setNewComp ( false ) // initially set to false
60
+ } , [ newComp ] )
61
61
62
62
// Caret start
63
63
Arrow . deleteLines ( ) ;
@@ -73,7 +73,7 @@ function Canvas(props): JSX.Element {
73
73
// onClickHandler is responsible for changing the focused component and child component
74
74
function onClickHandler ( event ) {
75
75
event . stopPropagation ( ) ;
76
- // note: a null value for the child id means that we are focusing on the top-level component rather than any child
76
+ // note: a null value for the child id means that we are focusing on the top-level component rather than any child
77
77
changeFocus ( state . canvasFocus . componentId , null ) ;
78
78
} ;
79
79
@@ -150,7 +150,7 @@ function Canvas(props): JSX.Element {
150
150
151
151
// able to duplicate a component in dev only does not work for prod
152
152
// create a new component
153
-
153
+
154
154
// let name = prompt("Component already has a parent. \nDo you want to create a new component and import its elements?", "Enter component name here");
155
155
// while (components.some(comp => comp.name === name)) {
156
156
// name = prompt(`${name} component already exists. \nPlease pick a new name.`);
@@ -160,20 +160,20 @@ function Canvas(props): JSX.Element {
160
160
// type: 'ADD COMPONENT',
161
161
// payload: { componentName: name, root: false }
162
162
// });
163
-
163
+
164
164
// setNewComp(true);
165
165
// setNewComp(!newComp)
166
166
// }
167
-
167
+
168
168
}
169
-
169
+
170
170
}
171
171
} ,
172
172
collect : monitor => ( {
173
173
isOver : ! ! monitor . isOver ( )
174
174
} )
175
175
} ) ;
176
-
176
+
177
177
// Styling for Canvas
178
178
const defaultCanvasStyle = {
179
179
width : '100%' ,
@@ -198,7 +198,7 @@ function Canvas(props): JSX.Element {
198
198
// Combine the default styles of the canvas with the custom styles set by the user for that component
199
199
// The render children function renders all direct children of a given component
200
200
// Direct children are draggable/clickable
201
-
201
+
202
202
// const canvasStyle = combineStyles(defaultCanvasStyle, currentComponent.style);
203
203
const canvasStyle = combineStyles ( defaultCanvasStyle , currentComponent . style ) ;
204
204
const darkCombinedCanvasStyle = combineStyles ( darkCanvasStyle , currentComponent . style ) ;
0 commit comments