Use horizontal scrollable for code blocks in markdown widget
This commit is contained in:
parent
65b525af7f
commit
dcdf130700
1 changed files with 16 additions and 6 deletions
|
|
@ -8,7 +8,7 @@ use crate::core::font::{self, Font};
|
||||||
use crate::core::padding;
|
use crate::core::padding;
|
||||||
use crate::core::theme::{self, Theme};
|
use crate::core::theme::{self, Theme};
|
||||||
use crate::core::{self, Element, Length, Pixels};
|
use crate::core::{self, Element, Length, Pixels};
|
||||||
use crate::{column, container, rich_text, row, span, text};
|
use crate::{column, container, rich_text, row, scrollable, span, text};
|
||||||
|
|
||||||
pub use pulldown_cmark::HeadingLevel;
|
pub use pulldown_cmark::HeadingLevel;
|
||||||
pub use url::Url;
|
pub use url::Url;
|
||||||
|
|
@ -397,13 +397,23 @@ where
|
||||||
.spacing(spacing)
|
.spacing(spacing)
|
||||||
.into(),
|
.into(),
|
||||||
Item::CodeBlock(code) => container(
|
Item::CodeBlock(code) => container(
|
||||||
rich_text(code)
|
scrollable(
|
||||||
.font(Font::MONOSPACE)
|
container(
|
||||||
.size(code_size)
|
rich_text(code)
|
||||||
.on_link(on_link),
|
.font(Font::MONOSPACE)
|
||||||
|
.size(code_size)
|
||||||
|
.on_link(on_link),
|
||||||
|
)
|
||||||
|
.padding(spacing.0 / 2.0),
|
||||||
|
)
|
||||||
|
.direction(scrollable::Direction::Horizontal(
|
||||||
|
scrollable::Scrollbar::default()
|
||||||
|
.width(spacing.0 / 2.0)
|
||||||
|
.scroller_width(spacing.0 / 2.0),
|
||||||
|
)),
|
||||||
)
|
)
|
||||||
.width(Length::Fill)
|
.width(Length::Fill)
|
||||||
.padding(spacing.0)
|
.padding(spacing.0 / 2.0)
|
||||||
.style(container::rounded_box)
|
.style(container::rounded_box)
|
||||||
.into(),
|
.into(),
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue