Spaces:
Running
Running
File size: 811 Bytes
8e04495 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
import mesop as me
def load(e: me.LoadEvent):
me.set_theme_mode("system")
@me.page(
on_load=load,
security_policy=me.SecurityPolicy(
allowed_iframe_parents=["https://google.github.io", "https://huggingface.co."]
),
path="/html_demo",
)
def app():
with me.box(style=me.Style(margin=me.Margin.all(15))):
me.text("Sanitized HTML", type="headline-5")
me.html(
"""
Custom HTML
<a href="https://google.github.io/mesop/" target="_blank">mesop</a>
""",
mode="sanitized",
)
with me.box(style=me.Style(margin=me.Margin.symmetric(vertical=24))):
me.divider()
me.text("Sandboxed HTML", type="headline-5")
me.html(
"<style>body { color: #ff0000; }</style>hi<script>document.body.innerHTML = 'iamsandboxed'; </script>",
mode="sandboxed",
)
|