fix(app): close preview on single click

match on Preview (the type) to close preview context in single click.

matching on Preview type prevents the equality check failing b/w
ContextPage::Preview(Some,_) and ContextPage::Preview(None,_)
This commit is contained in:
Shehriyar Qureshi 2025-03-04 16:54:38 +05:00
parent 1c6c93c130
commit eaef410939

View file

@ -3097,7 +3097,9 @@ impl Application for App {
}
Message::ToggleContextPage(context_page) => {
//TODO: ensure context menus are closed
if self.context_page == context_page {
if self.context_page == context_page
|| matches!(self.context_page, ContextPage::Preview(_, _))
{
self.set_show_context(!self.core.window.show_context);
} else {
self.set_show_context(true);