Add copy to clipboard links to from/to/cc addresses

This commit is contained in:
2024-07-22 16:04:25 -07:00
parent 831466ddda
commit ad8fb77857
4 changed files with 85 additions and 31 deletions

View File

@@ -452,6 +452,17 @@ pub fn update(msg: Msg, model: &mut Model, orders: &mut impl Orders<Msg>) {
}
}
Msg::MultiMsg(msgs) => msgs.into_iter().for_each(|msg| update(msg, model, orders)),
Msg::CopyToClipboard(text) => {
let clipboard = seed::window()
.navigator()
.clipboard()
.expect("couldn't get clipboard");
orders.perform_cmd(async move {
wasm_bindgen_futures::JsFuture::from(clipboard.write_text(&text))
.await
.expect("failed to copy to clipboard");
});
}
}
}
// `Model` describes our app state.
@@ -551,4 +562,6 @@ pub enum Msg {
MessageCollapse(String),
MessageExpand(String),
MultiMsg(Vec<Msg>),
CopyToClipboard(String),
}