mirror of
https://github.com/apache/superset.git
synced 2026-04-19 08:04:53 +00:00
fix: Force configuration for SafeMarkdown component in Handlebars (#22417)
This commit is contained in:
@@ -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 {
|
||||
@@ -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>;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user