egui/crates
Timo von Hartz ab0f0b7b64
Rename `should_propagate_event` & add `should_prevent_default` (#5779)
* [x] I have followed the instructions in the PR template

Currently eframe [calls
`prevent_default()`](962c7c7516/crates/eframe/src/web/events.rs (L307-L369))
for all copy / paste events on the
[*document*](962c7c7516/crates/eframe/src/web/events.rs (L88)),
making embedding an egui application in a page (e.g. an react
application) hard (as all copy & paste functionality for other elements
on the page is broken by this).

I'm not sure what the motivation for this is, if any.

This commit / PR adds a callback (`should_prevent_default`), similar to
`should_propgate_event`, that an egui application can use to overwrite
this behavior. It defaults to returning `true` for all events, to keep
the existing behavior.

I call `should_prevent_default` in every place that
`should_propagate_event` is called (which is not all places that
`prevent_default` is called!). I'm not sure for the motivation of not
calling `should_propagate_event` everywhere that `stop_propagation` is
called, but I kept that behavior for the `should_prevent_default`
callback too.

Please let me know if I'm missing some existing functionality that would
allow me to do this, or if there's a reason that we don't want
applications to be able to customize this (i.e. if there's a reason to
always `prevent_default` for all copy / paste events on the whole
document)
2025-03-30 14:00:46 +02:00
..
ecolor Add assert messages and print bad argument values in asserts (#5216) 2025-03-25 09:20:29 +01:00
eframe Rename `should_propagate_event` & add `should_prevent_default` (#5779) 2025-03-30 14:00:46 +02:00
egui Fix color picker button (#5847) 2025-03-25 14:38:51 +01:00
egui-wgpu Release 0.31.1 - text_edit and kittest fixes 2025-03-05 08:37:34 +01:00
egui-winit Fix text input on Android (#5759) 2025-03-21 14:35:46 +01:00
egui_demo_app Make text underline and strikethrough pixel perfect crisp (#5857) 2025-03-28 20:37:38 +01:00
egui_demo_lib Fix in `Scene`: make `scene_rect` full size on reset (#5801) 2025-03-25 10:26:07 +01:00
egui_extras Fix Lint for debug-assert (#5846) 2025-03-25 14:18:45 +01:00
egui_glow Add assert messages and print bad argument values in asserts (#5216) 2025-03-25 09:20:29 +01:00
egui_kittest Improve text sharpness (#5838) 2025-03-21 12:56:47 +01:00
egui_plot Move `egui_plot` to its own repo (#4828) 2024-07-15 18:45:19 +02:00
egui_web Fix typos (#2866) 2023-04-18 15:52:45 +02:00
emath Add assert messages and print bad argument values in asserts (#5216) 2025-03-25 09:20:29 +01:00
epaint Clean up strikethrough/underline code in epaint 2025-03-30 13:15:41 +02:00
epaint_default_fonts Release 0.31.1 - text_edit and kittest fixes 2025-03-05 08:37:34 +01:00