editor: Hide mouse context menu when modal is opened (#29127)
Closes #28787 The context menu appears before the modal because it is a Deferred element, which is always displayed above normal elements. Release Notes: Previously, the editor context menu appeared before the Command Palette. This commit ensures the editor context menu is hidden when a modal, including the Command Palette, is opened.
This commit is contained in:
parent
9a3434efb4
commit
6d2bdc3bac
4 changed files with 84 additions and 5 deletions
|
@ -928,9 +928,17 @@ impl Item for Editor {
|
|||
&mut self,
|
||||
workspace: &mut Workspace,
|
||||
_window: &mut Window,
|
||||
_: &mut Context<Self>,
|
||||
cx: &mut Context<Self>,
|
||||
) {
|
||||
self.workspace = Some((workspace.weak_handle(), workspace.database_id()));
|
||||
if let Some(workspace) = &workspace.weak_handle().upgrade() {
|
||||
cx.subscribe(&workspace, |editor, _, event: &workspace::Event, _cx| {
|
||||
if matches!(event, workspace::Event::ModalOpened) {
|
||||
editor.mouse_context_menu.take();
|
||||
}
|
||||
})
|
||||
.detach();
|
||||
}
|
||||
}
|
||||
|
||||
fn to_item_events(event: &EditorEvent, mut f: impl FnMut(ItemEvent)) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue