From 0511f9268bd610f02715ef91967bcb36a7a95c2a Mon Sep 17 00:00:00 2001 From: Peter Tripp Date: Tue, 17 Dec 2024 19:46:38 +0000 Subject: [PATCH] Add tooltip for Markdown Preview copy code button (#22057) --- crates/markdown_preview/src/markdown_renderer.rs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/crates/markdown_preview/src/markdown_renderer.rs b/crates/markdown_preview/src/markdown_renderer.rs index eff109df07..b6b19fab91 100644 --- a/crates/markdown_preview/src/markdown_renderer.rs +++ b/crates/markdown_preview/src/markdown_renderer.rs @@ -18,10 +18,10 @@ use std::{ }; use theme::{ActiveTheme, SyntaxTheme, ThemeSettings}; use ui::{ - h_flex, relative, tooltip_container, v_flex, Checkbox, Clickable, Color, FluentBuilder, - IconButton, IconName, IconSize, InteractiveElement, Label, LabelCommon, LabelSize, LinkPreview, - StatefulInteractiveElement, StyledExt, StyledImage, ToggleState, ViewContext, VisibleOnHover, - VisualContext as _, + h_flex, relative, tooltip_container, v_flex, ButtonCommon, Checkbox, Clickable, Color, + FluentBuilder, IconButton, IconName, IconSize, InteractiveElement, Label, LabelCommon, + LabelSize, LinkPreview, StatefulInteractiveElement, StyledExt, StyledImage, ToggleState, + Tooltip, ViewContext, VisibleOnHover, VisualContext as _, }; use workspace::Workspace; @@ -385,6 +385,7 @@ fn render_markdown_code_block( cx.write_to_clipboard(ClipboardItem::new_string(contents.to_string())); } }) + .tooltip(|cx| Tooltip::text("Copy code block", cx)) .visible_on_hover("markdown-block"); cx.with_common_p(div())