Spaces:
Paused
Paused
Update app.py
Browse files
app.py
CHANGED
|
@@ -542,10 +542,23 @@ def post(judul, kontent, endpoint,endpoint_media,username,password,tags,categori
|
|
| 542 |
# if __name__ == "__main__":
|
| 543 |
# article_generator.launch(share=False)
|
| 544 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 545 |
with gr.Blocks(theme="soft", title="Wordpress Article Generator") as article_generator:
|
|
|
|
|
|
|
|
|
|
| 546 |
gr.Markdown(
|
| 547 |
"""
|
| 548 |
-
# Wordpress Article Generator
|
| 549 |
Buat artikel yang anda inginkan dengan mudah, cukup dengan menuliskan link artikel sebagai referensi dan dalam sekejap artikel yang anda inginkan dapat menghiasi halaman wordpress anda.
|
| 550 |
"""
|
| 551 |
)
|
|
@@ -571,13 +584,15 @@ with gr.Blocks(theme="soft", title="Wordpress Article Generator") as article_gen
|
|
| 571 |
tinymce.init({
|
| 572 |
selector: '#wysiwyg-editor',
|
| 573 |
plugins: 'lists advlist autolink link image charmap print preview hr anchor pagebreak',
|
| 574 |
-
toolbar: '
|
| 575 |
menubar: false,
|
| 576 |
content_style: 'body { background-color: #333; color: #fff; }'
|
| 577 |
});
|
| 578 |
</script>
|
| 579 |
"""
|
| 580 |
)
|
|
|
|
|
|
|
| 581 |
button_scrap.click(fn=scrap, inputs=[link, backlink, keyword, versi, api_key, link_azure, replicate_token], outputs=[img, outputs, wysiwyg_editor])
|
| 582 |
with gr.Column():
|
| 583 |
endpoint= gr.Textbox(placeholder="Masukkan Endpoint Wordpress", label="Endpoint Wordpress")
|
|
|
|
| 542 |
# if __name__ == "__main__":
|
| 543 |
# article_generator.launch(share=False)
|
| 544 |
|
| 545 |
+
def edit_article(content, wysiwyg_editor):
|
| 546 |
+
# Fungsi untuk mengaktifkan mode pengeditan artikel di WYSIWYG
|
| 547 |
+
wysiwyg_editor.html(f"""
|
| 548 |
+
<label for="wysiwyg-editor">Article</label>
|
| 549 |
+
<textarea id="wysiwyg-editor" style="height: 300px; width: 100%;">{content}</textarea>
|
| 550 |
+
<script>
|
| 551 |
+
tinymce.get('wysiwyg-editor').setContent("{content}");
|
| 552 |
+
</script>
|
| 553 |
+
""")
|
| 554 |
+
|
| 555 |
with gr.Blocks(theme="soft", title="Wordpress Article Generator") as article_generator:
|
| 556 |
+
gr.HTML(
|
| 557 |
+
"""<img src="https://botika.online/assets/uploads/2019/04/logo-primary-1.png" alt="Logo" style="width:126px;height:38px;"> """
|
| 558 |
+
)
|
| 559 |
gr.Markdown(
|
| 560 |
"""
|
| 561 |
+
# Wordpress Article Generator
|
| 562 |
Buat artikel yang anda inginkan dengan mudah, cukup dengan menuliskan link artikel sebagai referensi dan dalam sekejap artikel yang anda inginkan dapat menghiasi halaman wordpress anda.
|
| 563 |
"""
|
| 564 |
)
|
|
|
|
| 584 |
tinymce.init({
|
| 585 |
selector: '#wysiwyg-editor',
|
| 586 |
plugins: 'lists advlist autolink link image charmap print preview hr anchor pagebreak',
|
| 587 |
+
toolbar: 'undo redo | bold italic underline | fontselect fontsizeselect | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | link image',
|
| 588 |
menubar: false,
|
| 589 |
content_style: 'body { background-color: #333; color: #fff; }'
|
| 590 |
});
|
| 591 |
</script>
|
| 592 |
"""
|
| 593 |
)
|
| 594 |
+
edit_button = gr.Button("Edit Article")
|
| 595 |
+
edit_button.click(fn=edit_article, inputs=[outputs, wysiwyg_editor])
|
| 596 |
button_scrap.click(fn=scrap, inputs=[link, backlink, keyword, versi, api_key, link_azure, replicate_token], outputs=[img, outputs, wysiwyg_editor])
|
| 597 |
with gr.Column():
|
| 598 |
endpoint= gr.Textbox(placeholder="Masukkan Endpoint Wordpress", label="Endpoint Wordpress")
|