-
Notifications
You must be signed in to change notification settings - Fork 290
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add html
component
#237
Add html
component
#237
Conversation
What do you mean by "inject the stylesheet"? When using the iframe with source doc, is the user able to reference assets (Javascript, CSS) from other domains or would they need to reference from same domain? Or is that not allowed for security reasons? I guess if linking to external resources is not allowed, then one could write the js/css in the html head. Probably not that user friendly, but since this is an advanced use case, probably ok. Although would be hard to manage.
I think the app developer should able to set the height. So if there is auto resize as a default and the user could resize as an override, that may be more convenient. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
docs/components/html.md
Outdated
|
||
## Examples | ||
|
||
<iframe class="component-demo" src="https://mesop-y677hytkra-uc.a.run.app/link"></iframe> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nit] Looks like these are pointing to "link" when it should be html?
will re-open once I've been able to address the comments. |
html
component and embed(html=...)
option
html
component and embed(html=...)
optionhtml
component
@richard-to could you take another look? I updated this PR quite a bit and switched to sanitizing the HTML instead of iframing the HTML (I'll try this approach in a separate #405). This is better for some use cases because it gets rendered in the same frame, but it doesn't support JS so it's not that flexible. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM - Just to make sure I understand. The HTML component here renders HTML directly without an iframe. But it is sanitized so no javascript and other malicious stuff can be added?
Yup, that's right. Right now we've been telling people to use me.markdown as a way to render sanitized HTML, which is 1) kind of confusing (since it's not obvious to most developers) and 2) kind of annoying since markdown adds a I think we still need JS for a bunch of use cases, so we'll need to handle that separately. |
This allows you to render sanitized HTML, however it doesn't allow potentially dangerous HTML like JavaScript.
In a separate PR, I'll update the
embed
component so you can essentially do an<iframe srcdoc="$htmlcontent">
, which will allow you to run arbitrary JS in a sandboxed way.Partially addresses #156.