File tree Expand file tree Collapse file tree 1 file changed +6
-4
lines changed Expand file tree Collapse file tree 1 file changed +6
-4
lines changed Original file line number Diff line number Diff line change @@ -109,7 +109,9 @@ export default {
109
109
h5: [" <h5" , " </h5>" ],
110
110
h6: [" <h6" , " </h6>" ],
111
111
};
112
- this .componentMap [this .activeComponent ].children .forEach (child => {
112
+ // add childComponents of the activeCompnent to the htmlElementMap
113
+ const childComponents = this .componentMap [this .activeComponent ].children ;
114
+ childComponents .forEach (child => {
113
115
htmlElementMap[child]= [` <${ child} ` , " " ] // single
114
116
})
115
117
function writeNested (childrenArray , indent ) {
@@ -128,7 +130,7 @@ export default {
128
130
if (child .class !== " " ) {
129
131
nestedString += " " + " class = " + ` "${ child .class } "` ;
130
132
}
131
- if (child .text === " img" || child .text === " input" || child .text === " link" ) {
133
+ if (child .text === " img" || child .text === " input" || child .text === " link" || childComponents . includes ( child . text ) ) {
132
134
nestedString += " />" ;
133
135
} else { nestedString += " >" ; }
134
136
@@ -159,8 +161,8 @@ export default {
159
161
if (el .class !== " " ) {
160
162
outputStr += " " + " class = " + ` "${ el .class } "` ;
161
163
}
162
- // add an extra slash at the end for child Components
163
- if (this . componentMap [ this . activeComponent ]. children . includes (el .text )){
164
+ // add an extra slash at the end for child Components and single tags
165
+ if (childComponents . includes (el .text ) || el . text === " img " || el . text === " input " || el . text === " link " ){
164
166
outputStr += " /"
165
167
}
166
168
You can’t perform that action at this time.
0 commit comments