Skip to content

Commit 03d893f

Browse files
fix: set iframe width and height via CSS to take precendence over sphinx theme in the documentation (#2462)
Previously, the iframe would not render correctly as its width was 0 due to the sphinx theme in the docs. This addition makes sure that the iframe is rendered. Co-authored-by: Dario Quintero (Flexcompute) <[email protected]>
1 parent ec903cb commit 03d893f

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

tidy3d/components/viz.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -398,6 +398,7 @@ class SimulationViewerInjector {
398398
var frame = document.createElement("iframe");
399399
frame.width = node.dataset.width || 800;
400400
frame.height = node.dataset.height || 800;
401+
frame.style.cssText = `width:${frame.width}px;height:${frame.height}px;max-width:none;border:0;display:block`
401402
frame.src = VIEWER_URL + "?uuid=" + uuid;
402403
403404
var postMessageToViewer;
@@ -426,7 +427,7 @@ class SimulationViewerInjector {
426427
})();
427428
"""
428429
html_code = f"""
429-
<div class="simulation-viewer" data-width="{escape(str(width))}" data-height="{escape(str(height))}" data-simulation="{escape(base64)}" />
430+
<div class="simulation-viewer" data-width="{escape(str(width))}" data-height="{escape(str(height))}" data-simulation="{escape(base64)}" ></div>
430431
<script>
431432
{js_code}
432433
</script>

0 commit comments

Comments
 (0)