mirror of
https://github.com/apache/superset.git
synced 2026-04-22 01:24:43 +00:00
fix(plugin-chart-handlebars): improve CSS sanitization tooltip and hide when not needed (#39180)
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
committed by
GitHub
parent
a64609f4f3
commit
36de05fe36
@@ -30,10 +30,12 @@ import { debounceFunc } from '../../consts';
|
||||
|
||||
interface StyleCustomControlProps {
|
||||
value: string;
|
||||
htmlSanitization: boolean;
|
||||
}
|
||||
|
||||
const StyleControl = (props: CustomControlConfig<StyleCustomControlProps>) => {
|
||||
const theme = useTheme();
|
||||
const htmlSanitization = props.htmlSanitization ?? true;
|
||||
|
||||
const defaultValue = props?.value
|
||||
? undefined
|
||||
@@ -48,10 +50,16 @@ const StyleControl = (props: CustomControlConfig<StyleCustomControlProps>) => {
|
||||
<ControlHeader>
|
||||
<div>
|
||||
{props.label}
|
||||
<InfoTooltip
|
||||
iconStyle={{ marginLeft: theme.sizeUnit }}
|
||||
tooltip={t('You need to configure HTML sanitization to use CSS')}
|
||||
/>
|
||||
{htmlSanitization && (
|
||||
<InfoTooltip
|
||||
iconStyle={{ marginLeft: theme.sizeUnit }}
|
||||
tooltip={t(
|
||||
'CSS styles may be removed by server-side HTML sanitization. ' +
|
||||
'If styles are not applying, ask your Superset administrator ' +
|
||||
'to adjust the HTML sanitization configuration.',
|
||||
)}
|
||||
/>
|
||||
)}
|
||||
</div>
|
||||
</ControlHeader>
|
||||
<CodeEditor
|
||||
@@ -79,8 +87,9 @@ export const styleControlSetItem: ControlSetItem = {
|
||||
valueKey: null,
|
||||
|
||||
validators: [],
|
||||
mapStateToProps: ({ controls }) => ({
|
||||
mapStateToProps: ({ controls, common }) => ({
|
||||
value: controls?.handlebars_template?.value,
|
||||
htmlSanitization: common?.conf?.HTML_SANITIZATION ?? true,
|
||||
}),
|
||||
},
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user