diff --git a/wp-react-lib/src/embedded/EmbeddedGateway.jsx b/wp-react-lib/src/embedded/EmbeddedGateway.jsx
index 03a5032..4e5c956 100644
--- a/wp-react-lib/src/embedded/EmbeddedGateway.jsx
+++ b/wp-react-lib/src/embedded/EmbeddedGateway.jsx
@@ -45,12 +45,20 @@ class EmbeddedGateway extends React.Component {
container = div
}
- if (component) {
+ if (component != null && getComponent(component) === null) {
+ element.innerHTML = "
Data Viz Error
Component " + component + " not found
"
+ } else if (component && getComponent(component)) {
const props = {...this.props}
const attrs = element.attributes
for (let i = attrs.length - 1; i >= 0; i--) {
props[attrs[i].name] = attrs[i].value;
}
+
+ element.getAttributeNames().forEach((name) => {
+ if (name.startsWith('data-')) {
+ element.removeAttribute(name);
+ }
+ });
const C = injectIntl(getComponent(component));
if (C) {
ReactDOM.createRoot(container)
diff --git a/wp-react-lib/src/util/index.js b/wp-react-lib/src/util/index.js
index dedc552..c4a8a67 100644
--- a/wp-react-lib/src/util/index.js
+++ b/wp-react-lib/src/util/index.js
@@ -16,6 +16,10 @@ const localReplaceLink = (url, locale) => {
if (!pathname.startsWith("/wp/")) {
return url; // Not a WordPress path, leave unchanged
}
+ //ensuring access to media library files
+ if (pathname.startsWith("/wp/wp-content")){
+ return url
+ }
const afterWp = pathname.slice(3); // remove '/wp'
@@ -38,6 +42,7 @@ export const replaceLink = (url, locale) => {
}
export const replaceHTMLinks = (html, locale) => {
+ debugger;
//console.log("--------- replaceHTMLinks--------------")
// console.log(process.env.REACT_APP_WP_HOSTS)