@@ -12,7 +12,7 @@ import {
12
12
} from "./interfaces" ;
13
13
14
14
const initialComponentState : ComponentInt = {
15
- id : null ,
15
+ id : 0 ,
16
16
stateful : false ,
17
17
title : "" ,
18
18
color : getColor ( ) ,
@@ -115,7 +115,7 @@ export const addChild = (
115
115
116
116
// view represents the curretn FOCUSED COMPONENT - this is the component where the child is being added to
117
117
// we only add childrent (or do any action) to the focused omconent
118
- const view = state . components . find (
118
+ const view : ComponentInt = state . components . find (
119
119
comp => comp . title === state . focusComponent . title
120
120
) ;
121
121
@@ -389,7 +389,7 @@ export const changeFocusComponent = (
389
389
// set the "focus child" to the focus child of this particular component .
390
390
// const newFocusChildId = newFocusComp.focusChildId;
391
391
392
- let newFocusChild ; // check if the components has a child saved as a Focus child
392
+ let newFocusChild : ChildInt | any ; // check if the components has a child saved as a Focus child
393
393
if ( newFocusComp . focusChildId > 0 ) {
394
394
newFocusChild = newFocusComp . childrenArray . find (
395
395
child => child . childId === newFocusComp . focusChildId
@@ -517,7 +517,7 @@ export const addProp = (
517
517
comp => comp . id === state . focusComponent . id
518
518
) ;
519
519
520
- const newProp = {
520
+ const newProp : PropInt = {
521
521
id : selectedComponent . nextPropId ,
522
522
key,
523
523
value : value || key ,
@@ -579,18 +579,19 @@ export const deleteProp = (state: ApplicationStateInt, propId: number) => {
579
579
} ;
580
580
} ;
581
581
582
- export const updateHtmlAttr = ( state , { attr, value } ) => {
582
+ export const updateHtmlAttr = ( state : ApplicationStateInt , { attr, value } : { attr : string , value : string } ) => {
583
583
if ( ! state . focusChild . childId ) {
584
584
console . log ( "Update HTML error. no focused child " ) ;
585
585
return state ;
586
586
}
587
587
588
- const modifiedChild = cloneDeep ( state . focusChild ) ;
588
+ const modifiedChild : any = cloneDeep ( state . focusChild ) ;
589
589
modifiedChild . HTMLInfo [ attr ] = value ;
590
590
591
- const modifiedComponent = cloneDeep (
592
- state . components . find ( comp => comp . id === state . focusComponent . id )
593
- ) ;
591
+ // let modifiedComponent = cloneDeep(
592
+ // state.components.find(comp => comp.id === state.focusComponent.id)
593
+ // );
594
+ let modifiedComponent : ComponentInt = JSON . parse ( JSON . stringify ( ( state . components . find ( comp => comp . id === state . focusComponent . id ) ) ) ) ;
594
595
595
596
modifiedComponent . childrenArray = modifiedComponent . childrenArray . filter (
596
597
child => child . childId !== modifiedChild . childId
0 commit comments