Skip to content

Commit

Permalink
fix: Force configuration for SafeMarkdown component in Handlebars (#2…
Browse files Browse the repository at this point in the history
  • Loading branch information
geido committed Dec 14, 2022
1 parent 90d79c7 commit ebaa949
Showing 1 changed file with 14 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,13 @@ export const HandlebarsViewer = ({
}: HandlebarsViewerProps) => {
const [renderedTemplate, setRenderedTemplate] = useState('');
const [error, setError] = useState('');
const appContainer = document.getElementById('app');
const { common } = JSON.parse(
appContainer?.getAttribute('data-bootstrap') || '{}',
);
const htmlSanitization = common?.conf?.HTML_SANITIZATION ?? true;
const htmlSchemaOverrides =
common?.conf?.HTML_SANITIZATION_SCHEMA_EXTENSIONS || {};

useMemo(() => {
try {
Expand All @@ -56,7 +63,13 @@ export const HandlebarsViewer = ({
}

if (renderedTemplate) {
return <SafeMarkdown source={renderedTemplate} />;
return (
<SafeMarkdown
source={renderedTemplate}
htmlSanitization={htmlSanitization}
htmlSchemaOverrides={htmlSchemaOverrides}
/>
);
}
return <p>Loading...</p>;
};
Expand Down

0 comments on commit ebaa949

Please sign in to comment.