-
Notifications
You must be signed in to change notification settings - Fork 393
Sandbox HTML output in an iframe #997
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
base: master
Are you sure you want to change the base?
Conversation
import {ArrayType, MapType, OptionalType, StructField, StructType} from "../../data/data_type"; | ||
import embed from "vega-embed"; | ||
|
||
const frames: Record<number, HTMLIFrameElement> = {}; |
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.
Maybe it would be better if this was scoped to each notebook?
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.
I'm not sure what the practical benefit would be, other than guilt about global state in JavaScript-land. This is a big stupid workaround to begin with; I figured there was no point in pretending it wasn't 😛
resizeTimeout = window.setTimeout(updateSizes, 250); | ||
}) | ||
|
||
function updateSizes() { |
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.
Does this still work if the frame is currently out of view (when another notebook tab is selected)?
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.
I think so? I mean the function will work, but I don't know what the frame will say about itself if its host iframe
isn't in the DOM. 😬
22e8ebf
to
c6d364a
Compare
670786d
to
a4df1a1
Compare
Sandbox HTML output in an iframe.
This is to prevent malicious HTML from accessing the notebook or communicating with the server.
An attempt is made to keep the iframe sized to its content so that it looks like it's reasonably inline. But this is tricky and will probably need some refinement as issues are discovered.