Commit
•
4f2747f
1
Parent(s):
466dfc4
Fixing issuex
Browse files
app.py
CHANGED
@@ -18,8 +18,7 @@ with gr.Blocks() as demo:
|
|
18 |
button2 = gr.Button("Insert Snippet 2")
|
19 |
with gr.Column():
|
20 |
gr.Markdown("**Live Preview**")
|
21 |
-
|
22 |
-
markdown_preview = gr.Markdown(label="Live Preview")
|
23 |
|
24 |
button1.click(lambda text, position: insert_snippet(text, snippet1, position), inputs=[text_input, gr.State(0)], outputs=text_input)
|
25 |
button2.click(lambda text, position: insert_snippet(text, snippet2, position), inputs=[text_input, gr.State(0)], outputs=text_input)
|
@@ -44,4 +43,17 @@ with gr.Blocks() as demo:
|
|
44 |
"""
|
45 |
gr.HTML(js_code)
|
46 |
|
47 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
18 |
button2 = gr.Button("Insert Snippet 2")
|
19 |
with gr.Column():
|
20 |
gr.Markdown("**Live Preview**")
|
21 |
+
markdown_preview = gr.Markdown(label="Live Preview", elem_id="preview-box")
|
|
|
22 |
|
23 |
button1.click(lambda text, position: insert_snippet(text, snippet1, position), inputs=[text_input, gr.State(0)], outputs=text_input)
|
24 |
button2.click(lambda text, position: insert_snippet(text, snippet2, position), inputs=[text_input, gr.State(0)], outputs=text_input)
|
|
|
43 |
"""
|
44 |
gr.HTML(js_code)
|
45 |
|
46 |
+
# Add custom CSS for the preview box
|
47 |
+
css = """
|
48 |
+
#preview-box {
|
49 |
+
border: 1px solid #ccc;
|
50 |
+
padding: 10px;
|
51 |
+
height: auto;
|
52 |
+
min-height: 200px;
|
53 |
+
max-height: 400px;
|
54 |
+
overflow: auto;
|
55 |
+
background-color: #f9f9f9;
|
56 |
+
}
|
57 |
+
"""
|
58 |
+
|
59 |
+
demo.launch(css=css)
|