Skip to content

armgit / zed

Public Imported from GitHub
0

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.

markdown_preview: Fix outline panel becoming empty when preview pane is focused (#54301)

Smit Barmase5a589c4b1d3e
diff --git a/crates/markdown_preview/src/markdown_preview_view.rs b/crates/markdown_preview/src/markdown_preview_view.rs
index b97a559edf8..c95d4480121 100644
--- a/crates/markdown_preview/src/markdown_preview_view.rs
+++ b/crates/markdown_preview/src/markdown_preview_view.rs
@@ -1,3 +1,4 @@
+use std::any::TypeId;
use std::cmp::min;
use std::ops::Range;
use std::path::{Path, PathBuf};
@@ -824,6 +825,23 @@ impl EventEmitter<SearchEvent> for MarkdownPreviewView {}
impl Item for MarkdownPreviewView {
type Event = ();
+ fn act_as_type<'a>(
+ &'a self,
+ type_id: TypeId,
+ self_handle: &'a Entity<Self>,
+ _: &'a App,
+ ) -> Option<gpui::AnyEntity> {
+ if type_id == TypeId::of::<Self>() {
+ Some(self_handle.clone().into())
+ } else if type_id == TypeId::of::<Editor>() {
+ self.active_editor
+ .as_ref()
+ .map(|state| state.editor.clone().into())
+ } else {
+ None
+ }
+ }
+
fn tab_icon(&self, _window: &Window, _cx: &App) -> Option<Icon> {
Some(Icon::new(IconName::FileDoc))
}