Skip to content

Commit ab50a75

Browse files
committed
Update return element
display: contents to keep the widget from partaking in the flow of content
1 parent 523afeb commit ab50a75

3 files changed

Lines changed: 6 additions & 6 deletions

File tree

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "javascriptsnippet",
33
"widgetName": "JavaScriptSnippet",
4-
"version": "2.1.1",
4+
"version": "2.1.2",
55
"description": "Insert custom JavaScript to your page.",
66
"copyright": "2022 Incentro",
77
"author": "Rob Duits",

src/JavaScriptSnippet.jsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ export function JavaScriptSnippet({ attributeList, jsCode, ...rest }) {
55
const [canRender, setCanRender] = useState(false);
66
const [javaScriptString, setJavaScriptString] = useState([]);
77
const widgetName = rest.name || "";
8-
const uid = useState((Date.now().toString(36) + Math.random().toString(36).substring(2)));
8+
const uid = useState(Date.now().toString(36) + Math.random().toString(36).substring(2));
99

1010
function escape(htmlStr) {
1111
return htmlStr
@@ -14,7 +14,7 @@ export function JavaScriptSnippet({ attributeList, jsCode, ...rest }) {
1414
.replace(/>/g, ">")
1515
.replace(/"/g, """)
1616
.replace(/'/g, "'");
17-
};
17+
}
1818

1919
// function unEscape(htmlStr) {
2020
// htmlStr = htmlStr.replace(/&lt;/g, "<");
@@ -55,7 +55,7 @@ export function JavaScriptSnippet({ attributeList, jsCode, ...rest }) {
5555
return null;
5656
});
5757
}
58-
58+
5959
JSArray = JSArray.split("this").join(`'${widgetName}_${uid[0]}'`);
6060
setJavaScriptString(JSArray);
6161

@@ -81,5 +81,5 @@ export function JavaScriptSnippet({ attributeList, jsCode, ...rest }) {
8181
console.warn(`${widgetName}: Error while evaluating javascript input. ${error}`);
8282
}
8383
}
84-
return <div className={`${widgetName}_${uid[0]}`}></div>;
84+
return <div className={`${widgetName}_${uid[0]}`} style={{ display: "contents" }}></div>;
8585
}

src/package.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="utf-8" ?>
22
<package xmlns="http://www.mendix.com/package/1.0/">
3-
<clientModule name="JavaScriptSnippet" version="2.1.1" xmlns="http://www.mendix.com/clientModule/1.0/">
3+
<clientModule name="JavaScriptSnippet" version="2.1.2" xmlns="http://www.mendix.com/clientModule/1.0/">
44
<widgetFiles>
55
<widgetFile path="JavaScriptSnippet.xml" />
66
</widgetFiles>

0 commit comments

Comments
 (0)