This is an automated email from the ASF dual-hosted git repository.
michaelsmolina pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/superset.git
The following commit(s) were added to refs/heads/master by this push:
new ebaa94974b fix: Force configuration for SafeMarkdown component in
Handlebars (#22417)
ebaa94974b is described below
commit ebaa94974b2fca41d21f1c0972c288e086525687
Author: Geido <[email protected]>
AuthorDate: Wed Dec 14 22:23:34 2022 +0100
fix: Force configuration for SafeMarkdown component in Handlebars (#22417)
---
.../src/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 77ebe65a80..479da8ac91 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 <SafeMarkdown source={renderedTemplate} />;
+ return (
+ <SafeMarkdown
+ source={renderedTemplate}
+ htmlSanitization={htmlSanitization}
+ htmlSchemaOverrides={htmlSchemaOverrides}
+ />
+ );
}
return <p>Loading...</p>;
};