commit 20a68a19f2fc5cbb888ad0d1a7315e59c64716ba
parent 3a68cb9a9969706ccbb6ba92b4cc7cbb67c368f6
Author: William Casarin <jb55@jb55.com>
Date: Sun, 11 Feb 2024 14:40:14 -0800
images: add copy link to image context menu
Signed-off-by: William Casarin <jb55@jb55.com>
Diffstat:
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/src/app.rs b/src/app.rs
@@ -9,7 +9,7 @@ use crate::Result;
use egui::containers::scroll_area::ScrollBarVisibility;
use egui::widgets::Spinner;
-use egui::{Color32, Context, Frame, Hyperlink, Margin, RichText, TextureHandle};
+use egui::{Color32, Context, Frame, Hyperlink, Image, Margin, RichText, TextureHandle};
use enostr::{ClientMessage, Filter, Pubkey, RelayEvent, RelayMessage};
use nostrdb::{
@@ -660,7 +660,13 @@ fn render_note_contents(
});
for image in images {
- ui.image(image);
+ let resp = ui.add(Image::new(image.clone()));
+ resp.context_menu(|ui| {
+ if ui.button("Copy Link").clicked() {
+ ui.ctx().copy_text(image);
+ ui.close_menu();
+ }
+ });
}
Ok(())