File tree Expand file tree Collapse file tree 1 file changed +15
-0
lines changed Expand file tree Collapse file tree 1 file changed +15
-0
lines changed Original file line number Diff line number Diff line change @@ -224,6 +224,8 @@ HTMLtoJSX.prototype = {
224
224
this . output += this . config . indent + this . config . indent + ');\n' ;
225
225
this . output += this . config . indent + '}\n' ;
226
226
this . output += '});' ;
227
+ } else {
228
+ this . output = this . _removeJSXClassIndention ( this . output , this . config . indent ) ;
227
229
}
228
230
return this . output ;
229
231
} ,
@@ -507,6 +509,19 @@ HTMLtoJSX.prototype = {
507
509
_getStyleAttribute : function ( styles ) {
508
510
var jsxStyles = new StyleParser ( styles ) . toJSXString ( ) ;
509
511
return 'style={{' + jsxStyles + '}}' ;
512
+ } ,
513
+
514
+ /**
515
+ * Removes class-level indention in the JSX output. To be used when the JSX
516
+ * output is configured to not contain a class deifinition.
517
+ *
518
+ * @param {string } output JSX output with class-level indention
519
+ * @param {string } indent Configured indention
520
+ * @return {string } JSX output wihtout class-level indention
521
+ */
522
+ _removeJSXClassIndention : function ( output , indent ) {
523
+ var classIndention = new RegExp ( '\\n' + indent + indent + indent , 'g' ) ;
524
+ return output . replace ( classIndention , '\n' ) ;
510
525
}
511
526
} ;
512
527
You can’t perform that action at this time.
0 commit comments