Skip to content

Commit

Permalink
Remove commands that are unsupported on web
Browse files Browse the repository at this point in the history
  • Loading branch information
emilk committed Dec 29, 2024
1 parent 528a0bf commit 249d37a
Showing 1 changed file with 16 additions and 13 deletions.
29 changes: 16 additions & 13 deletions crates/egui_demo_lib/src/demo/tests/clipboard_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,21 +38,24 @@ impl crate::View for ClipboardTest {
})
.inner;

ui.horizontal(|ui| {
for (name, cmd) in [
("Copy", egui::ViewportCommand::RequestCopy),
("Cut", egui::ViewportCommand::RequestCut),
("Paste", egui::ViewportCommand::RequestPaste),
] {
if ui.button(name).clicked() {
// Next frame we should get a copy/cut/paste-event…
ui.ctx().send_viewport_cmd(cmd);
if !cfg!(target_arch = "wasm32") {
// These commands are not yet implemented on web
ui.horizontal(|ui| {
for (name, cmd) in [
("Copy", egui::ViewportCommand::RequestCopy),
("Cut", egui::ViewportCommand::RequestCut),
("Paste", egui::ViewportCommand::RequestPaste),
] {
if ui.button(name).clicked() {
// Next frame we should get a copy/cut/paste-event…
ui.ctx().send_viewport_cmd(cmd);

// …that should en up here:
text_edit_response.request_focus();
// …that should en up here:
text_edit_response.request_focus();
}
}
}
});
});
}

ui.separator();

Expand Down

0 comments on commit 249d37a

Please sign in to comment.