diff --git a/app/src/notebooks/file/mod.rs b/app/src/notebooks/file/mod.rs index 1b0f8218be..b75c8f2f09 100644 --- a/app/src/notebooks/file/mod.rs +++ b/app/src/notebooks/file/mod.rs @@ -135,6 +135,7 @@ pub enum FileNotebookAction { OpenAsCode, ContextMenu(ContextMenuAction), ToggleMarkdownDisplayMode(MarkdownDisplayMode), + ToggleMaximized, } impl From for FileNotebookAction { @@ -1051,6 +1052,12 @@ impl TypedActionView for FileNotebookView { } } } + FileNotebookAction::ToggleMaximized => { + ctx.emit(FileNotebookEvent::Pane(PaneEvent::ToggleMaximized)); + self.pane_configuration.update(ctx, |pane_config, ctx| { + pane_config.refresh_pane_header_overflow_menu_items(ctx); + }); + } } } } @@ -1070,10 +1077,20 @@ impl BackingView for FileNotebookView { fn pane_header_overflow_menu_items( &self, - _ctx: &AppContext, + ctx: &AppContext, ) -> Vec> { - let mut actions = vec![]; + // Mirror the toggle that `CodeView` (the Raw markdown mode) exposes, so the Rendered + // markdown pane's overflow menu offers the same "Maximize pane" / "Minimize pane" entry. + let is_maximized = self + .focus_handle + .as_ref() + .is_some_and(|h| h.is_maximized(ctx)); + let mut actions = vec![MenuItemFields::toggle_pane_action(is_maximized) + .with_on_select_action(FileNotebookAction::ToggleMaximized) + .into_item()]; + if let Some(SourceFile::FileBased { .. }) = self.file_state.source() { + actions.push(MenuItem::Separator); actions.push( MenuItemFields::new("Refresh file") .with_on_select_action(FileNotebookAction::ReloadFile)