Dismiss Recent Projects & VCS modals on ESC (#3671)
Release Notes: - N/A
This commit is contained in:
parent
83b55de73e
commit
2b3d9deabe
2 changed files with 11 additions and 3 deletions
|
@ -76,7 +76,10 @@ impl RecentProjects {
|
||||||
let delegate =
|
let delegate =
|
||||||
RecentProjectsDelegate::new(weak_workspace, workspace_locations, true);
|
RecentProjectsDelegate::new(weak_workspace, workspace_locations, true);
|
||||||
|
|
||||||
RecentProjects::new(delegate, cx)
|
let modal = RecentProjects::new(delegate, cx);
|
||||||
|
cx.subscribe(&modal.picker, |_, _, _, cx| cx.emit(DismissEvent))
|
||||||
|
.detach();
|
||||||
|
modal
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
workspace.show_notification(0, cx, |cx| {
|
workspace.show_notification(0, cx, |cx| {
|
||||||
|
|
|
@ -65,8 +65,13 @@ impl ModalBranchList {
|
||||||
) -> Result<()> {
|
) -> Result<()> {
|
||||||
// Modal branch picker has a longer trailoff than a popover one.
|
// Modal branch picker has a longer trailoff than a popover one.
|
||||||
let delegate = BranchListDelegate::new(workspace, cx.view().clone(), 70, cx)?;
|
let delegate = BranchListDelegate::new(workspace, cx.view().clone(), 70, cx)?;
|
||||||
workspace.toggle_modal(cx, |cx| ModalBranchList {
|
workspace.toggle_modal(cx, |cx| {
|
||||||
picker: cx.build_view(|cx| Picker::new(delegate, cx)),
|
let modal = ModalBranchList {
|
||||||
|
picker: cx.build_view(|cx| Picker::new(delegate, cx)),
|
||||||
|
};
|
||||||
|
cx.subscribe(&modal.picker, |_, _, _, cx| cx.emit(DismissEvent))
|
||||||
|
.detach();
|
||||||
|
modal
|
||||||
});
|
});
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue