Fix scrolling and wrapping in the markdown preview renderer (#7234)

Release Notes:

- N/A
This commit is contained in:
Mikayla Maki 2024-02-01 09:07:01 -08:00 committed by GitHub
parent 97be0a930c
commit d4264cbe4e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 5 additions and 2 deletions

View file

@ -114,13 +114,16 @@ impl Render for MarkdownPreviewView {
.key_context("MarkdownPreview") .key_context("MarkdownPreview")
.track_focus(&self.focus_handle) .track_focus(&self.focus_handle)
.id("MarkdownPreview") .id("MarkdownPreview")
.overflow_scroll() .overflow_y_scroll()
.overflow_x_hidden()
.size_full() .size_full()
.bg(cx.theme().colors().editor_background) .bg(cx.theme().colors().editor_background)
.p_4() .p_4()
.children(render_markdown(&self.contents, &self.languages, cx)); .children(render_markdown(&self.contents, &self.languages, cx));
div().flex_1().child( div().flex_1().child(
// FIXME: This shouldn't be necessary
// but the overflow_scroll above doesn't seem to work without it
canvas(move |bounds, cx| { canvas(move |bounds, cx| {
rendered_markdown.into_any().draw( rendered_markdown.into_any().draw(
bounds.origin, bounds.origin,

View file

@ -174,7 +174,7 @@ where
} }
let element = self.render_md_from_range(source_range.clone(), cx); let element = self.render_md_from_range(source_range.clone(), cx);
let paragraph = h_flex().mb_3().child(element); let paragraph = div().mb_3().child(element);
self.finished.push(paragraph); self.finished.push(paragraph);
} }