diff --git a/crates/markdown_preview/src/markdown_preview_view.rs b/crates/markdown_preview/src/markdown_preview_view.rs index b97a559edf8760084586218a5b39e677c49727f5..c95d4480121b5aa74519e266b89105e416cc86c5 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 for MarkdownPreviewView {} impl Item for MarkdownPreviewView { type Event = (); + fn act_as_type<'a>( + &'a self, + type_id: TypeId, + self_handle: &'a Entity, + _: &'a App, + ) -> Option { + if type_id == TypeId::of::() { + Some(self_handle.clone().into()) + } else if type_id == TypeId::of::() { + self.active_editor + .as_ref() + .map(|state| state.editor.clone().into()) + } else { + None + } + } + fn tab_icon(&self, _window: &Window, _cx: &App) -> Option { Some(Icon::new(IconName::FileDoc)) }