Skip to content

Commit 5d3cb20

Browse files
authored
Merge pull request #68 from devgateway/alive-dev
Changes from alive
2 parents 694cb1c + 7835209 commit 5d3cb20

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

wp-react-lib/src/embedded/EmbeddedGateway.jsx

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,12 +45,20 @@ class EmbeddedGateway extends React.Component {
4545
container = div
4646
}
4747

48-
if (component) {
48+
if (component != null && getComponent(component) === null) {
49+
element.innerHTML = "<h1>Data Viz Error </h1><h4>Component<i> " + component + "</i> not found</h4><br>"
50+
} else if (component && getComponent(component)) {
4951
const props = {...this.props}
5052
const attrs = element.attributes
5153
for (let i = attrs.length - 1; i >= 0; i--) {
5254
props[attrs[i].name] = attrs[i].value;
5355
}
56+
57+
element.getAttributeNames().forEach((name) => {
58+
if (name.startsWith('data-')) {
59+
element.removeAttribute(name);
60+
}
61+
});
5462
const C = injectIntl(getComponent(component));
5563
if (C) {
5664
ReactDOM.createRoot(container)

wp-react-lib/src/util/index.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@ const localReplaceLink = (url, locale) => {
1616
if (!pathname.startsWith("/wp/")) {
1717
return url; // Not a WordPress path, leave unchanged
1818
}
19+
//ensuring access to media library files
20+
if (pathname.startsWith("/wp/wp-content")){
21+
return url
22+
}
1923

2024
const afterWp = pathname.slice(3); // remove '/wp'
2125

0 commit comments

Comments
 (0)