@@ -32,7 +32,9 @@ const breadthFirstSearchParent = (array,id) => {
32
32
let evaluated = queue . shift ( )
33
33
for ( let i = 0 ; i < evaluated . children . length ; i ++ ) {
34
34
if ( evaluated . children [ i ] . id === id ) {
35
- return evaluated
35
+ return {
36
+ evaluated :evaluated ,
37
+ index : i
36
38
}
37
39
}
38
40
if ( evaluated . children . length ) {
@@ -41,7 +43,7 @@ const breadthFirstSearchParent = (array,id) => {
41
43
}
42
44
console . log ( "We shouldn't be ever getting here, how did you even search an id that didn't exist?" )
43
45
}
44
-
46
+ }
45
47
const mutations = {
46
48
47
49
[ types . SET_ACTIVE_LAYER ] : ( state , payload ) => {
@@ -78,7 +80,7 @@ const mutations = {
78
80
let newID = breadthFirstSearchParent ( state . componentMap [ state . activeComponent ] . htmlList , payload )
79
81
//console.log("new ID here", newID)
80
82
let newLayer = { ...state . activeLayer }
81
- newLayer . id = newID . id
83
+ newLayer . id = newID . evaluated . id
82
84
newLayer . lineage . pop ( )
83
85
console . log ( "We should have gone up a level " , newLayer )
84
86
state . activeLayer = newLayer
@@ -215,11 +217,15 @@ const mutations = {
215
217
} )
216
218
} ,
217
219
218
- [ types . DELETE_FROM_COMPONENT_HTML_LIST ] : ( state , idx ) => {
220
+ [ types . DELETE_FROM_COMPONENT_HTML_LIST ] : ( state , id ) => {
219
221
const componentName = state . activeComponent
220
222
const htmlList = state . componentMap [ componentName ] . htmlList . slice ( 0 )
221
223
// splice out selected element and return resulting array
222
- htmlList . splice ( idx , 1 )
224
+ let element = breadthFirstSearchParent ( htmlList , id ) ;
225
+ console . log ( "This is element" , element )
226
+ element . evaluated . children . splice ( element . index , 1 ) ;
227
+ // htmlList.splice(idx, 1)
228
+
223
229
state . componentMap [ componentName ] . htmlList = htmlList
224
230
} ,
225
231
[ types . SET_CLICKED_ELEMENT_LIST ] : ( state , payload ) => {
0 commit comments