From ebaa94974b2fca41d21f1c0972c288e086525687 Mon Sep 17 00:00:00 2001 From: Geido <60598000+geido@users.noreply.github.com> Date: Wed, 14 Dec 2022 22:23:34 +0100 Subject: [PATCH] fix: Force configuration for SafeMarkdown component in Handlebars (#22417) --- .../components/Handlebars/HandlebarsViewer.tsx | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/superset-frontend/plugins/plugin-chart-handlebars/src/components/Handlebars/HandlebarsViewer.tsx b/superset-frontend/plugins/plugin-chart-handlebars/src/components/Handlebars/HandlebarsViewer.tsx index 77ebe65a8043..479da8ac91b6 100644 --- a/superset-frontend/plugins/plugin-chart-handlebars/src/components/Handlebars/HandlebarsViewer.tsx +++ b/superset-frontend/plugins/plugin-chart-handlebars/src/components/Handlebars/HandlebarsViewer.tsx @@ -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 ; + return ( + + ); } return

Loading...

; };