lyt
14 Julio, 2022 21:48
1
Recientemente incrusté algunas visualizaciones en una publicación de foro (impulsada por Discourse) y se ven terribles en modo oscuro porque los iframes tienen fondos transparentes.
Así que intenté cambiar el color de fondo de los iframes. Descubrí cómo y lo probé en HackMD; funcionó bien. Pero cuando lo envío al foro de Discourse, ¡no funciona! Predomina el modo oscuro.
Aquí está la estructura del código que estoy usando:
<iframe width="100%" height="300" style="background-color: #FFFFFF" src="https://dune.com/embeds/1002945/1734962/fe28df65-99a3-4b98-8cb4-e97f132c8165" frameborder="0"></iframe>
1 me gusta
SaraDev
(Sara Devlaeminck)
14 Julio, 2022 23:03
2
Es probable que necesites usar CSS personalizado para establecer un color de fondo personalizado para tu iframe, ya que los estilos/clases se eliminan de todas las publicaciones en Discourse por defecto.
Is it possible to give a <div> inside a post some custom styling?
I’ve seen that any non-whitelisted classes are stripped out, and I’ve tried addingstyle= to my divs and spans to no avail , so does anyone know if there’s a way to do that?
Basically I have a bot that posts from an internal tool and I’d like to have it post with something that looks like the tool to make it obvious that it’s not a regular disourse post, something like this:
[image]
It’s got a couple of nested divs/spans to ma…
Por ejemplo, dentro de un tema podrías usar:
<div data-theme-1>
<iframe width="100%" height="300" src="https://dune.com/embeds/1002945/1734962/fe28df65-99a3-4b98-8cb4-e97f132c8165" frameborder="0"></iframe>
</div>
Y luego, en el CSS personalizado del tema que estés usando, añade:
div[data-theme-1] {
background-color: #FFFFFF;
}
Si estás interesado en poner en lista blanca estilos/clases en tu sitio, esto debe hacerse con un plugin.
It is possible to uses some HTML classes in Discourse, however, most HTML in a post is sanitized for security reasons, and only very strict whitelisted HTML is allowed in markdown. To add classes to the white-list you must use a plugin, the sanitization happens server side as well as client side. Check out
Whitelisting HTML tags / attributes for some details on where to add the whitelisted attributes, and I believe it would look similar to something like this: Discourse HTML Whitelist . and a…
4 Me gusta
lyt
15 Julio, 2022 18:30
3
¡Muchas gracias, funcionó!
2 Me gusta
system
(system)
Cerrado
14 Agosto, 2022 18:31
4
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.