TomLii commited on
Commit
080fac5
·
1 Parent(s): c6143d7

Widen right column; lock CodeMirror to in-place horizontal scroll

Browse files
Files changed (1) hide show
  1. app.py +36 -16
app.py CHANGED
@@ -181,22 +181,47 @@ gradio-app > div {
181
  min-height: 220px !important;
182
  }
183
 
184
- /* Prevent Code / Markdown from pushing the page wider than the container. */
185
- [class*="gradio-container"] .codemirror-wrapper,
186
- [class*="gradio-container"] .cm-editor,
187
- [class*="gradio-container"] .cm-scroller {
188
- max-width: 100% !important;
189
- overflow-x: auto !important;
190
- }
191
- [class*="gradio-container"] .gradio-markdown,
192
  [class*="gradio-container"] .gradio-code,
 
193
  [class*="gradio-container"] .prose,
194
  [class*="gradio-container"] .markdown,
195
- [class*="gradio-container"] [data-testid="markdown"] {
 
 
 
196
  max-width: 100% !important;
 
 
197
  word-wrap: break-word !important;
198
  overflow-wrap: anywhere !important;
199
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
200
  [class*="gradio-container"] .prose pre,
201
  [class*="gradio-container"] .markdown pre {
202
  max-width: 100% !important;
@@ -556,11 +581,6 @@ gradio-app > div {
556
  color: #0f2744 !important;
557
  border: none !important;
558
  }
559
- [class*="gradio-container"] .codemirror-wrapper,
560
- [class*="gradio-container"] .cm-editor {
561
- border-radius: 14px !important;
562
- overflow: hidden !important;
563
- }
564
  [class*="gradio-container"] .cm-gutters {
565
  border-right: 1px solid #dbeafe !important;
566
  color: #6b86a6 !important;
@@ -921,7 +941,7 @@ with gr.Blocks(
921
  fill_width=True,
922
  ) as demo:
923
  with gr.Row(elem_classes="layout-gap"):
924
- with gr.Column(scale=7):
925
  with gr.Group(elem_classes="section-card"):
926
  gr.HTML('<div class="section-heading">Chat</div>')
927
  question = gr.Textbox(
@@ -948,7 +968,7 @@ with gr.Blocks(
948
  with gr.TabItem("Record"):
949
  trace = gr.Code(label="Execution Trace (JSON)", language="json")
950
 
951
- with gr.Column(scale=3, elem_classes="right-stack"):
952
  with gr.Group(elem_classes=["section-card", "no-frame"]):
953
  gr.Image(
954
  value=LOGO_PATH,
 
181
  min-height: 220px !important;
182
  }
183
 
184
+ /* Prevent Code / Markdown / Tabs from pushing the page wider than the container.
185
+ Every wrapper in the chain is locked to max-width: 100%; only the innermost
186
+ .cm-scroller scrolls horizontally. */
 
 
 
 
 
187
  [class*="gradio-container"] .gradio-code,
188
+ [class*="gradio-container"] .gradio-markdown,
189
  [class*="gradio-container"] .prose,
190
  [class*="gradio-container"] .markdown,
191
+ [class*="gradio-container"] [data-testid="markdown"],
192
+ [class*="gradio-container"] .tabs,
193
+ [class*="gradio-container"] .tabitem,
194
+ [class*="gradio-container"] .tab-content {
195
  max-width: 100% !important;
196
+ width: 100% !important;
197
+ min-width: 0 !important;
198
  word-wrap: break-word !important;
199
  overflow-wrap: anywhere !important;
200
  }
201
+ [class*="gradio-container"] .codemirror-wrapper {
202
+ max-width: 100% !important;
203
+ width: 100% !important;
204
+ min-width: 0 !important;
205
+ border-radius: 14px !important;
206
+ overflow: hidden !important;
207
+ }
208
+ [class*="gradio-container"] .cm-editor {
209
+ max-width: 100% !important;
210
+ width: 100% !important;
211
+ min-width: 0 !important;
212
+ overflow: hidden !important;
213
+ }
214
+ [class*="gradio-container"] .cm-scroller {
215
+ max-width: 100% !important;
216
+ width: 100% !important;
217
+ overflow-x: auto !important;
218
+ }
219
+ [class*="gradio-container"] .cm-content,
220
+ [class*="gradio-container"] .cm-line {
221
+ max-width: 100% !important;
222
+ white-space: pre-wrap !important;
223
+ word-break: break-word !important;
224
+ }
225
  [class*="gradio-container"] .prose pre,
226
  [class*="gradio-container"] .markdown pre {
227
  max-width: 100% !important;
 
581
  color: #0f2744 !important;
582
  border: none !important;
583
  }
 
 
 
 
 
584
  [class*="gradio-container"] .cm-gutters {
585
  border-right: 1px solid #dbeafe !important;
586
  color: #6b86a6 !important;
 
941
  fill_width=True,
942
  ) as demo:
943
  with gr.Row(elem_classes="layout-gap"):
944
+ with gr.Column(scale=6, min_width=420):
945
  with gr.Group(elem_classes="section-card"):
946
  gr.HTML('<div class="section-heading">Chat</div>')
947
  question = gr.Textbox(
 
968
  with gr.TabItem("Record"):
969
  trace = gr.Code(label="Execution Trace (JSON)", language="json")
970
 
971
+ with gr.Column(scale=4, min_width=360, elem_classes="right-stack"):
972
  with gr.Group(elem_classes=["section-card", "no-frame"]):
973
  gr.Image(
974
  value=LOGO_PATH,