sadpandajoe commented on code in PR #43722:
URL: https://github.com/apache/superset/pull/43722#discussion_r3900831177
##########
superset-frontend/plugins/plugin-chart-handlebars/src/Handlebars.tsx:
##########
@@ -37,7 +37,16 @@ export default function Handlebars(props: HandlebarsProps) {
const handlebarTemplateSource = formData.handlebarsTemplate
? formData.handlebarsTemplate
: '{{data}}';
- const templateSource = `${handlebarTemplateSource}\n${styleTemplateSource} `;
+ // Markdown only treats `<style>` as a raw-text block that may contain blank
+ // lines when the tag starts a block of its own. Appending it to the template
+ // instead let a template opening with an HTML tag absorb the tag, so the
+ // first blank line in the CSS closed that block and every rule after it was
+ // parsed as a paragraph and rendered as visible text. Putting the style
+ // block first, separated by a blank line, keeps the CSS out of any block the
+ // template opens and leaves the template's own rendering untouched.
+ const templateSource = styleTemplateSource
Review Comment:
This also reverses stylesheet cascade order. When sanitization permits
styles, a saved template's `<style>td { color: blue }</style>` used to be
overridden by the style field's `td { color: red }`, but it now wins because it
follows the generated block; can we keep the existing cascade order as well?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]