Milhaud commited on
Commit
6d7aae4
Β·
1 Parent(s): 75d396b

feat: adjust html preview height

Browse files
Files changed (1) hide show
  1. app.py +8 -12
app.py CHANGED
@@ -512,17 +512,13 @@ def update_preview_from_html(html_content: str) -> str:
512
  # Create iframe HTML - only escape quotes for srcdoc attribute
513
  safe_html_content = html_content.replace('"', """)
514
  preview_html = f"""
515
- <div style='padding: 20px; background: #fff; border: 1px solid #eee; border-radius: 8px; display: block;'>
516
- <div style='display: block; align-items: center; margin-bottom: 10px;'>
517
- <small style='color: #888;'>Preview (Live from HTML Output)</small>
518
- </div>
519
- <div id='animation-container' style='min-height: 300px; display: block; justify-content: center; align-items: center; background: #fafafa; border-radius: 4px; padding: 20px;'>
520
- <iframe srcdoc="{safe_html_content}"
521
- width="100%" height="600px"
522
- style="border:none; overflow:hidden;"
523
- sandbox="allow-scripts allow-same-origin">
524
- </iframe>
525
- </div>
526
  </div>
527
  """
528
  return preview_html
@@ -644,7 +640,7 @@ with demo:
644
  example_dropdown.change(
645
  fn=load_example, inputs=[example_dropdown], outputs=[svg_file, object_name]
646
  )
647
-
648
  process_btn = gr.Button("πŸ”„ Decompose Structure", variant="primary")
649
  groups_summary = gr.Textbox(
650
  label="Decomposition Results",
 
512
  # Create iframe HTML - only escape quotes for srcdoc attribute
513
  safe_html_content = html_content.replace('"', "&quot;")
514
  preview_html = f"""
515
+ <div style='padding: 20px; width:100%; height:520px; background: #fff; border: 1px solid #eee; border-radius: 8px; display: block;'>
516
+ <iframe srcdoc="{safe_html_content}"
517
+ width="100%"
518
+ height="100%"
519
+ style="border:none; border-radius:8px; overflow:hidden;"
520
+ sandbox="allow-scripts allow-same-origin">
521
+ </iframe>
 
 
 
 
522
  </div>
523
  """
524
  return preview_html
 
640
  example_dropdown.change(
641
  fn=load_example, inputs=[example_dropdown], outputs=[svg_file, object_name]
642
  )
643
+
644
  process_btn = gr.Button("πŸ”„ Decompose Structure", variant="primary")
645
  groups_summary = gr.Textbox(
646
  label="Decomposition Results",