File tree Expand file tree Collapse file tree 2 files changed +16
-11
lines changed Expand file tree Collapse file tree 2 files changed +16
-11
lines changed Original file line number Diff line number Diff line change @@ -96,14 +96,8 @@ function Canvas() {
96
96
return ;
97
97
}
98
98
99
- const addingComponent = state . components . find ( elem => elem . id === item . instanceTypeId ) ;
100
-
101
- if ( checkChildren ( [ addingComponent ] , currentComponent ) ) {
102
- triedToNestIncorrectly ( ) ;
103
- } else {
104
- // if item dropped is going to be a new instance (i.e. it came from the left panel), then create a new child component
99
+ const runReducers = ( ) => {
105
100
if ( item . newInstance ) {
106
- console . log ( "still added" ) ;
107
101
dispatch ( {
108
102
type : 'ADD CHILD' ,
109
103
payload : {
@@ -124,6 +118,20 @@ function Canvas() {
124
118
} ) ;
125
119
}
126
120
}
121
+
122
+ const addingComponent = state . components . find ( elem => elem . id === item . instanceTypeId ) ;
123
+
124
+ if ( item . instanceType === "HTML Element" ) {
125
+ return runReducers ( ) ;
126
+ } else if ( item . instanceType === 'Route Link' ) {
127
+ return runReducers ( ) ;
128
+ } else if ( checkChildren ( [ addingComponent ] , currentComponent ) ) {
129
+ triedToNestIncorrectly ( ) ;
130
+ return ;
131
+ } else {
132
+ // if item dropped is going to be a new instance (i.e. it came from the left panel), then create a new child component
133
+ return runReducers ( ) ;
134
+ }
127
135
} ,
128
136
collect : monitor => ( {
129
137
isOver : ! ! monitor . isOver ( )
Original file line number Diff line number Diff line change @@ -605,14 +605,11 @@ const reducer = (state: State, action: Action) => {
605
605
state . HTMLTypes
606
606
) ;
607
607
} )
608
- let childId : null | number = ( ( state . canvasFocus . childId - 1 ) === 0 ) ? null : state . canvasFocus . childId - 1 ;
609
608
610
- const canvasFocus = { ...state . canvasFocus , childId } ;
611
609
return {
612
610
...state ,
613
611
HTMLTypes,
614
- components,
615
- canvasFocus
612
+ components
616
613
} ;
617
614
}
618
615
You can’t perform that action at this time.
0 commit comments