This is an automated email from the ASF dual-hosted git repository.
jli 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 8c125d2553 feat: use in deck.gl custom tooltip instead of
SafeMarkdown (#35665)
8c125d2553 is described below
commit 8c125d2553b63c0fa0c6aa7b83afdbc86e6d66e8
Author: Richard Fogaca Nienkotter
<[email protected]>
AuthorDate: Thu Oct 16 15:13:38 2025 -0300
feat: use in deck.gl custom tooltip instead of SafeMarkdown (#35665)
---
.../src/utilities/HandlebarsRenderer.tsx | 23 +++++++++++-----------
1 file changed, 11 insertions(+), 12 deletions(-)
diff --git
a/superset-frontend/plugins/legacy-preset-chart-deckgl/src/utilities/HandlebarsRenderer.tsx
b/superset-frontend/plugins/legacy-preset-chart-deckgl/src/utilities/HandlebarsRenderer.tsx
index 7c7d0e9567..3466107ed3 100644
---
a/superset-frontend/plugins/legacy-preset-chart-deckgl/src/utilities/HandlebarsRenderer.tsx
+++
b/superset-frontend/plugins/legacy-preset-chart-deckgl/src/utilities/HandlebarsRenderer.tsx
@@ -16,10 +16,9 @@
* specific language governing permissions and limitations
* under the License.
*/
-import { useEffect, useState, memo } from 'react';
-import { styled, t } from '@superset-ui/core';
+import { useEffect, useState, memo, useMemo } from 'react';
+import { styled, t, sanitizeHtml } from '@superset-ui/core';
import { extendedDayjs as dayjs } from '@superset-ui/core/utils/dates';
-import { SafeMarkdown } from '@superset-ui/core/components';
import Handlebars from 'handlebars';
import { isPlainObject } from 'lodash';
@@ -45,8 +44,6 @@ export const HandlebarsRenderer:
React.FC<HandlebarsRendererProps> = memo(
appContainer?.getAttribute('data-bootstrap') || '{}',
);
const htmlSanitization = common?.conf?.HTML_SANITIZATION ?? true;
- const htmlSchemaOverrides =
- common?.conf?.HTML_SANITIZATION_SCHEMA_EXTENSIONS || {};
useEffect(() => {
try {
@@ -60,6 +57,12 @@ export const HandlebarsRenderer:
React.FC<HandlebarsRendererProps> = memo(
}
}, [templateSource, data]);
+ const htmlContent = useMemo(
+ () =>
+ htmlSanitization ? sanitizeHtml(renderedTemplate) : renderedTemplate,
+ [renderedTemplate, htmlSanitization],
+ );
+
if (error) {
return <ErrorContainer>{error}</ErrorContainer>;
}
@@ -73,13 +76,9 @@ export const HandlebarsRenderer:
React.FC<HandlebarsRendererProps> = memo(
fontSize: '12px',
lineHeight: '1.4',
}}
- >
- <SafeMarkdown
- source={renderedTemplate || ''}
- htmlSanitization={htmlSanitization}
- htmlSchemaOverrides={htmlSchemaOverrides}
- />
- </div>
+ // eslint-disable-next-line react/no-danger
+ dangerouslySetInnerHTML={{ __html: htmlContent }}
+ />
);
}