mirror of
https://github.com/ritz078/transform.git
synced 2026-11-20 16:22:53 +03:00
🐛 (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:
1 parent
462e872047
commit
190cd96066
4 files changed
+17
-3
No files matched your search
@@ -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
@@ -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",
|
||||
|
||||
@@ -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, '"') + '"';
|
||||
+ } else {
|
||||
+ result += '=""';
|
||||
}
|
||||
return result;
|
||||
}
|
||||
File renamed without changes.
Reference in new issue
Block a user