Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -34,6 +34,13 @@ with gr.Blocks() as iface:
|
|
34 |
shorten_button.click(fn=update_short_url, inputs=url_input, outputs=short_url_output)
|
35 |
clear_button.click(fn=clear_inputs, inputs=[], outputs=[url_input, short_url_output])
|
36 |
|
37 |
-
copy_button.click(fn=None, _js="
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
38 |
|
39 |
iface.launch()
|
|
|
34 |
shorten_button.click(fn=update_short_url, inputs=url_input, outputs=short_url_output)
|
35 |
clear_button.click(fn=clear_inputs, inputs=[], outputs=[url_input, short_url_output])
|
36 |
|
37 |
+
copy_button.click(fn=None, _js="""
|
38 |
+
const shortUrlInput = document.querySelector('input[aria-label="Shortened URL"]');
|
39 |
+
navigator.clipboard.writeText(shortUrlInput.value).then(() => {
|
40 |
+
alert('URL copied to clipboard');
|
41 |
+
}).catch(err => {
|
42 |
+
console.error('Error copying text: ', err);
|
43 |
+
});
|
44 |
+
""")
|
45 |
|
46 |
iface.launch()
|