File tree Expand file tree Collapse file tree 2 files changed +9
-14
lines changed Expand file tree Collapse file tree 2 files changed +9
-14
lines changed Original file line number Diff line number Diff line change @@ -26,6 +26,13 @@ function AddLink({ id }: AddRoutes) {
26
26
const handlePageSelect = event => {
27
27
const selectedPageName = event . target . value ;
28
28
console . log ( 'selectedPages State: ' , selectedPageName ) ;
29
+ console . log ( 'page state' , state . components [ 0 ] . children ) ;
30
+ state . components [ 0 ] . children . forEach ( element => {
31
+ if ( element . childId === id ) {
32
+ element . attributes . compLink = event . target . value ;
33
+ }
34
+ } ) ;
35
+ // selectedPageName.compLink = event.target.value;
29
36
// dispatch({ type: 'HREF TO', payload: });
30
37
}
31
38
Original file line number Diff line number Diff line change @@ -78,24 +78,12 @@ const DemoRender = (): JSX.Element => {
78
78
} ;
79
79
80
80
let code = '' ;
81
- //compone
82
-
83
- componentBuilder ( state . components [ 0 ] . children ) . forEach ( ( element , index ) => {
84
- // if(element.props.component === 'Link') {
85
- // return;
86
- // // element.props.component = 'a';
87
- // // element.props.id = `rend${6}`;
88
- // } else if(typeof element.type === 'function') {
89
- // return;
90
- // }
91
- console . log ( 'element' + index , element ) ;
92
- console . log ( 'component' + index , state . components [ 0 ] . children [ index * 2 + 1 ] ) ;
81
+ const currComponent = state . components . filter ( element => element . id === state . canvasFocus . componentId ) ;
82
+ componentBuilder ( currComponent [ 0 ] . children ) . forEach ( element => {
93
83
try {
94
84
if ( element . props . component === 'Link' ) {
95
85
96
86
}
97
- // element.props.component = 'a';
98
- // element.props.id = `rend${6}`;
99
87
code += ReactDOMServer . renderToString ( element )
100
88
} catch {
101
89
return ;
You can’t perform that action at this time.
0 commit comments