Update app.py
Browse files
app.py
CHANGED
|
@@ -14,8 +14,8 @@ def insert_snippet(text, editor_content, cursor_position):
|
|
| 14 |
)
|
| 15 |
return new_content, new_content, cursor_position + len(text)
|
| 16 |
|
| 17 |
-
# Create the interface
|
| 18 |
-
with gr.Blocks() as app:
|
| 19 |
gr.Markdown("### Blog Editor with Live Preview")
|
| 20 |
with gr.Row():
|
| 21 |
with gr.Column():
|
|
@@ -24,7 +24,7 @@ with gr.Blocks() as app:
|
|
| 24 |
insert_button1 = gr.Button("Insert Snippet 1")
|
| 25 |
insert_button2 = gr.Button("Insert Snippet 2")
|
| 26 |
with gr.Column():
|
| 27 |
-
preview_box = gr.HTML(label="Live Preview", elem_id="preview", visible=True,
|
| 28 |
|
| 29 |
# Interactivity
|
| 30 |
text_editor.change(fn=update_preview, inputs=text_editor, outputs=preview_box)
|
|
|
|
| 14 |
)
|
| 15 |
return new_content, new_content, cursor_position + len(text)
|
| 16 |
|
| 17 |
+
# Create the interface with customized styles
|
| 18 |
+
with gr.Blocks(css=".preview-box {border: 1px solid black; padding: 10px;}") as app:
|
| 19 |
gr.Markdown("### Blog Editor with Live Preview")
|
| 20 |
with gr.Row():
|
| 21 |
with gr.Column():
|
|
|
|
| 24 |
insert_button1 = gr.Button("Insert Snippet 1")
|
| 25 |
insert_button2 = gr.Button("Insert Snippet 2")
|
| 26 |
with gr.Column():
|
| 27 |
+
preview_box = gr.HTML(label="Live Preview", elem_id="preview", visible=True, className="preview-box")
|
| 28 |
|
| 29 |
# Interactivity
|
| 30 |
text_editor.change(fn=update_preview, inputs=text_editor, outputs=preview_box)
|