Skip to content

Commit

Permalink
fix(pagebuilder): Html content type unescapes content when GraphQL do…
Browse files Browse the repository at this point in the history
…es not
  • Loading branch information
James Zetlen committed Mar 25, 2020
1 parent becd5e2 commit 1bee42d
Showing 1 changed file with 16 additions and 5 deletions.
21 changes: 16 additions & 5 deletions packages/pagebuilder/lib/ContentTypes/Html/configAggregator.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,23 @@
import { getAdvanced } from '../../utils';

export default node => {
const dom = new DOMParser().parseFromString(
'<!doctype html><body>' + node.textContent,
'text/html'
);
let html;
if (node.dataset.decoded) {
html = node.innerHTML;
if (process.env.NODE_ENV !== 'production') {
console.warn(
'PageBuilder HTML content was unescaped! This may be a Magento configuration error.'
);
}
} else {
const dom = new DOMParser().parseFromString(
'<!doctype html><body>' + node.textContent,
'text/html'
);
html = dom.body.innerHTML;
}
return {
html: dom.body.innerHTML,
html,
...getAdvanced(node)
};
};

0 comments on commit 1bee42d

Please sign in to comment.