Gilks commented on issue #32357:
URL: https://github.com/apache/superset/issues/32357#issuecomment-2679435168
I agree that it's not an ideal to style through the iframe boundry. In a
perfect world, we would have the solution as you described. However, it's also
difficult to fully integrate and utilize embedded dashboards without the
ability to dynamically control themes. In theory we could manage the CSS themes
directly in superset but that would mean creating duplicate dashboards in
light/dark mode and creating the code required to manage context switching. It
also means reloading iframes when switching themes- not an ideal user
experience.
As a stop gap, I've created a custom `postMessage()` handler that is
initialized through `superset_config.py`. It is _very much_ a hack and I look
forward to being able to style as you described. The goal was to create
something self contained that can survive superset upgrades.
It allows something like this:
```
const embeddedFrame = document.querySelector('iframe');
embeddedFrame.contentWindow.postMessage({
switchboardAction: 'emit',
method: 'customCss',
args: {
css: '.dashboard { background: blue !important; }'
}
}, '*');
```
I can post the complete solution if you'd like. I just don't want to push
anyone down this path if a more robust solution is in the works. If you think
it would be beneficial in the meantime, let me know and I'll post the hack.
--
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]