🐛 (html-to-jsx) remove semicolon at start and keep empty prop values (#321)

* fixes #310

* 🐛 (html-to-jsx) remove semicolon at start and keep empty prop values

Closes #279, closes #319
This commit is contained in:
Ritesh Kumar authored and GitHub committed 2022-01-26 11:47:02 +05:30
1 parent 462e872047
commit 190cd96066
4 files changed
+17 -3

No files matched your search

+6 -1
View File
@@ -95,10 +95,15 @@ const ConversionPanel: React.FunctionComponent<ConversionPanelProps> = function(
splitEditorValue: splitTitle ? splitValue : undefined
});
const prettyResult = await prettierWorker.send({
let prettyResult = await prettierWorker.send({
value: result,
language: resultLanguage
});
// Fix for #319
if (prettyResult.startsWith(";<")) {
prettyResult = prettyResult.slice(1);
}
setResult(prettyResult);
setMessage("");
} catch (e) {
+1 -1
View File
@@ -15,7 +15,7 @@
"build:analyze": "ANALYZE=true yarn build"
},
"engines": {
"node": "12.x"
"node": "14.x"
},
"dependencies": {
"@babel/plugin-transform-flow-strip-types": "^7.16.0",
+10 -1
View File
@@ -1,5 +1,5 @@
diff --git a/node_modules/htmltojsx/src/htmltojsx.js b/node_modules/htmltojsx/src/htmltojsx.js
index afe4c85..b326beb 100644
index afe4c85..960e450 100644
--- a/node_modules/htmltojsx/src/htmltojsx.js
+++ b/node_modules/htmltojsx/src/htmltojsx.js
@@ -326,19 +326,9 @@ HTMLtoJSX.prototype = {
@@ -44,3 +44,12 @@ index afe4c85..b326beb 100644
return this.output;
},
@@ -627,6 +618,8 @@ HTMLtoJSX.prototype = {
result += '={' + attribute.value + '}';
} else if (attribute.value.length > 0) {
result += '="' + attribute.value.replace(/"/gm, '&quot;') + '"';
+ } else {
+ result += '=""';
}
return result;
}
File renamed without changes.