Add Markdown Preview Toggle (#15215)
Add a "Preview Markdown" button to the quick action bar when in a markdown editor. While it isn't my favorite, I went with the basic eye icon to be a bit more generic so we can extend this control to allow opening other previews such as SVGs like @jansol mentioned.  https://github.com/user-attachments/assets/5980272c-eab9-4f69-86b6-0c593c25b525 --- Release Notes: - Added a button to preview Markdown files in the toolbar. `Option|Alt+Click` will open the preview to the side.
This commit is contained in:
parent
73d682c010
commit
05825e9804
9 changed files with 93 additions and 21 deletions
|
@ -99,7 +99,7 @@ impl MarkdownPreviewView {
|
|||
.and_then(|view| pane.index_for_item(&view))
|
||||
}
|
||||
|
||||
fn resolve_active_item_as_markdown_editor(
|
||||
pub fn resolve_active_item_as_markdown_editor(
|
||||
workspace: &Workspace,
|
||||
cx: &mut ViewContext<Workspace>,
|
||||
) -> Option<View<Editor>> {
|
||||
|
@ -278,7 +278,7 @@ impl MarkdownPreviewView {
|
|||
}
|
||||
}
|
||||
|
||||
fn is_markdown_file<V>(editor: &View<Editor>, cx: &mut ViewContext<V>) -> bool {
|
||||
pub fn is_markdown_file<V>(editor: &View<Editor>, cx: &mut ViewContext<V>) -> bool {
|
||||
let language = editor.read(cx).buffer().read(cx).language_at(0, cx);
|
||||
language
|
||||
.map(|l| l.name().as_ref() == "Markdown")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue