Skip to content

Commit aa41e0b

Browse files
committed
Can now add classes to children's child
1 parent c4fbe91 commit aa41e0b

File tree

3 files changed

+22
-23
lines changed

3 files changed

+22
-23
lines changed

src/components/right-sidebar/CodeSnippet.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ export default {
124124
} else {
125125
nestedString += htmlElementMap[child.text][0];
126126
if (child.class !== "") {
127-
nestedString += " " + "class = " + `"${el.class}"`;
127+
nestedString += " " + "class = " + `"${child.class}"`;
128128
}
129129
if (child.text === "img" || child.text === "input" || child.text === "link") {
130130
nestedString += "/>";

src/components/right-sidebar/HTMLQueue.vue

Lines changed: 9 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -40,27 +40,6 @@ Description:
4040
</div>
4141
</div>
4242

43-
<!--START OF CHANGES-->
44-
<!-- &nbsp; &nbsp; Viewing Elements in {{ this.activeComponent }} '{{ depth }}'
45-
<hr>
46-
</span>
47-
<span class='list-title' v-else-if='!this.activeComponent'></span>
48-
<div group="people" class="list-group">
49-
<p v-if='!this.componentMap[this.activeComponent]?.htmlList.length'>No HTML elements in component</p>
50-
51-
<div id="tooltipCon" :class="activeHTML === element[2] ? 'list-group-item-selected' : 'list-group-item'"
52-
v-for="(element) in renderList" :key="element[1] + Date.now()">
53-
54-
<button class="attributeButton" @click="setActiveElement(element)">
55-
<div class="tooltip"> Edit {{ element[0] }} attributes </div>
56-
</button>
57-
<i v-if='activeComponent === "" || exceptions.includes(element[0])'></i>
58-
<i v-else class="fas fa fa-angle-double-down fa-md" @click="setLayer({ text: element[0], id: element[2] })"></i>
59-
{{ element[0] }}
60-
<i class="fas fa fa-trash fa-md" @click.self="deleteElement([element[1], element[2]])"></i>
61-
</div>
62-
</div> -->
63-
6443
<!-- attribute pop-up -->
6544
<q-dialog v-model="attributeModal">
6645
<!-- @update:model-value="setActiveElement" -->
@@ -71,6 +50,14 @@ Description:
7150
:key="element.id + Date.now()">
7251
<p v-if="element.id === this.activeHTML">Your class is - {{ element.class }}</p>
7352
</div>
53+
<!--attribute child's child-->
54+
<div class="AttributeContainer" v-for="element in this.componentMap[this.activeComponent].htmlList"
55+
:key="element.id + Date.now()">
56+
<ul v-for="element1 in element.children"
57+
:key="element1.id + Date.now()">
58+
<li v-if="element1.id === this.activeHTML">Your class is - {{ element1.class }}</li>
59+
</ul>
60+
</div>
7461

7562
<div class="formBox">
7663
<q-form autofocus v-on:submit.prevent="submitClass">
@@ -112,7 +99,7 @@ export default {
11299
}
113100
},
114101
computed: {
115-
...mapState(['selectedElementList', 'componentMap', 'activeComponent', 'activeHTML', 'activeLayer', 'attributeModalOpen']),
102+
...mapState(['activeComponentObj','selectedElementList', 'componentMap', 'activeComponent', 'activeHTML', 'activeLayer', 'attributeModalOpen']),
116103
renderList: {
117104
get() {
118105
if (this.activeComponent === '') return this.selectedElementList.map((el, index) => [el.text, index, el.id])

src/store/mutations.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -430,6 +430,7 @@ const mutations = {
430430

431431
[types.SET_ACTIVE_LAYER]: (state, payload) => {
432432
const newLayer = cloneDeep(state.activeLayer);
433+
433434
newLayer.lineage.push(payload.text);
434435
newLayer.id = payload.id;
435436
state.activeLayer = newLayer;
@@ -805,11 +806,22 @@ const mutations = {
805806
},
806807

807808
[types.ADD_ACTIVE_COMPONENT_CLASS]: (state, payload) => {
809+
if(state.activeComponentObj.htmlList)
810+
808811
state.componentMap[state.activeComponent].htmlList.forEach((el) => {
812+
//adding class into it's child 1st layer
813+
if(el.children.length !== 0) {
814+
el.children.forEach((element) => {
815+
if(payload.id === element.id) {
816+
element.class = payload.class
817+
}
818+
})
819+
}
809820
if (payload.id === el.id) {
810821
el.class = payload.class
811822
}
812823
})
824+
813825
},
814826
[types.DELETE_ACTIVE_COMPONENT_CLASS]: (state, payload) => {
815827
state.componentMap[state.activeComponent].classList.forEach((el, ind) => {

0 commit comments

Comments
 (0)