use gpui::{App, actions};use workspace::Workspace;pub mod markdown_preview_settings;pub mod markdown_preview_view;pub use zed_actions::preview::markdown::{OpenPreview, OpenPreviewToTheSide};use crate::markdown_preview_view::MarkdownPreviewView;actions!( markdown, [ /// Scrolls up by one page in the markdown preview. #[action(deprecated_aliases = ["markdown::MovePageUp"])] ScrollPageUp, /// Scrolls down by one page in the markdown preview. #[action(deprecated_aliases = ["markdown::MovePageDown"])] ScrollPageDown, /// Scrolls up by approximately one visual line. ScrollUp, /// Scrolls down by approximately one visual line. ScrollDown, /// Scrolls up by one markdown element in the markdown preview ScrollUpByItem, /// Scrolls down by one markdown element in the markdown preview ScrollDownByItem, /// Scrolls to the top of the markdown preview. ScrollToTop, /// Scrolls to the bottom of the markdown preview. ScrollToBottom, /// Opens a following markdown preview that syncs with the editor. OpenFollowingPreview, /// Closes the markdown preview and returns focus to the source editor. CloseAndReturnToEditor ]);pub fn init(cx: &mut App) { workspace::register_serializable_item::<MarkdownPreviewView>(cx); cx.observe_new(|workspace: &mut Workspace, window, cx| { let Some(window) = window else { return; }; markdown_preview_view::MarkdownPreviewView::register(workspace, window, cx); }) .detach();}
use gpui::{App, actions};
use workspace::Workspace;
pub mod markdown_preview_settings;
pub mod markdown_preview_view;
pub use zed_actions::preview::markdown::{OpenPreview, OpenPreviewToTheSide};
use crate::markdown_preview_view::MarkdownPreviewView;
actions!(
markdown,
[
/// Scrolls up by one page in the markdown preview.
#[action(deprecated_aliases = ["markdown::MovePageUp"])]
ScrollPageUp,
/// Scrolls down by one page in the markdown preview.
#[action(deprecated_aliases = ["markdown::MovePageDown"])]
ScrollPageDown,
/// Scrolls up by approximately one visual line.
ScrollUp,
/// Scrolls down by approximately one visual line.
ScrollDown,
/// Scrolls up by one markdown element in the markdown preview
ScrollUpByItem,
/// Scrolls down by one markdown element in the markdown preview
ScrollDownByItem,
/// Scrolls to the top of the markdown preview.
ScrollToTop,
/// Scrolls to the bottom of the markdown preview.
ScrollToBottom,
/// Opens a following markdown preview that syncs with the editor.
OpenFollowingPreview,
/// Closes the markdown preview and returns focus to the source editor.
CloseAndReturnToEditor
]
);
pub fn init(cx: &mut App) {
workspace::register_serializable_item::<MarkdownPreviewView>(cx);
cx.observe_new(|workspace: &mut Workspace, window, cx| {
let Some(window) = window else {
return;
};
markdown_preview_view::MarkdownPreviewView::register(workspace, window, cx);
})
.detach();
}