project_panel: Automatically open project panel when Rename or Duplicate is triggered from workspace (#34988)
In project panel, `rename` and `duplicate` action further needs user input for editing, so if panel is closed we should open it. Release Notes: - Fixed project panel not opening when `project panel: rename` and `project panel: duplicate` actions are triggered from workspace.
This commit is contained in:
@@ -322,6 +322,7 @@ pub fn init(cx: &mut App) {
|
||||
});
|
||||
|
||||
workspace.register_action(|workspace, action: &Rename, window, cx| {
|
||||
workspace.open_panel::<ProjectPanel>(window, cx);
|
||||
if let Some(panel) = workspace.panel::<ProjectPanel>(cx) {
|
||||
panel.update(cx, |panel, cx| {
|
||||
if let Some(first_marked) = panel.marked_entries.first() {
|
||||
@@ -335,6 +336,7 @@ pub fn init(cx: &mut App) {
|
||||
});
|
||||
|
||||
workspace.register_action(|workspace, action: &Duplicate, window, cx| {
|
||||
workspace.open_panel::<ProjectPanel>(window, cx);
|
||||
if let Some(panel) = workspace.panel::<ProjectPanel>(cx) {
|
||||
panel.update(cx, |panel, cx| {
|
||||
panel.duplicate(action, window, cx);
|
||||
|
||||
Reference in New Issue
Block a user