feat: add context menu to text input and selectable text fields

chore: update libcosmic
This commit is contained in:
Hojjat 2026-06-29 18:18:30 -06:00
parent 5bdfffa494
commit 55c1b0afe0

View file

@ -2386,10 +2386,8 @@ impl Item {
widget::image(handle.clone()).into() widget::image(handle.clone()).into()
} }
ItemThumbnail::Svg(handle) => widget::svg(handle.clone()).into(), ItemThumbnail::Svg(handle) => widget::svg(handle.clone()).into(),
ItemThumbnail::Text(content) => widget::text_editor(content) ItemThumbnail::Text(content) => widget::text_editor::text_editor(content)
.class(cosmic::theme::iced::TextEditor::Custom(Box::new( .style(text_editor_class)
text_editor_class,
)))
.width(THUMBNAIL_SIZE as f32) .width(THUMBNAIL_SIZE as f32)
.height(Length::Fixed(THUMBNAIL_SIZE as f32)) .height(Length::Fixed(THUMBNAIL_SIZE as f32))
.padding(spacing.space_xxs) .padding(spacing.space_xxs)
@ -2440,7 +2438,7 @@ impl Item {
); );
let mut details = widget::column::with_capacity(8).spacing(space_xxxs); let mut details = widget::column::with_capacity(8).spacing(space_xxxs);
details = details.push(widget::text::heading(self.name.clone())); details = details.push(widget::selectable_text::heading(self.name.clone()));
details = details.push(widget::text::body(fl!( details = details.push(widget::text::body(fl!(
"type", "type",
mime = self.mime.to_string() mime = self.mime.to_string()
@ -2497,21 +2495,21 @@ impl Item {
let time_formatter = time_formatter(military_time); let time_formatter = time_formatter(military_time);
if let Ok(time) = metadata.created() { if let Ok(time) = metadata.created() {
details = details.push(widget::text::body(fl!( details = details.push(widget::selectable_text::body(fl!(
"item-created", "item-created",
created = format_time(time, &date_time_formatter, &time_formatter).to_string() created = format_time(time, &date_time_formatter, &time_formatter).to_string()
))); )));
} }
if let Ok(time) = metadata.modified() { if let Ok(time) = metadata.modified() {
details = details.push(widget::text::body(fl!( details = details.push(widget::selectable_text::body(fl!(
"item-modified", "item-modified",
modified = format_time(time, &date_time_formatter, &time_formatter).to_string() modified = format_time(time, &date_time_formatter, &time_formatter).to_string()
))); )));
} }
if let Ok(time) = metadata.accessed() { if let Ok(time) = metadata.accessed() {
details = details.push(widget::text::body(fl!( details = details.push(widget::selectable_text::body(fl!(
"item-accessed", "item-accessed",
accessed = format_time(time, &date_time_formatter, &time_formatter).to_string() accessed = format_time(time, &date_time_formatter, &time_formatter).to_string()
))); )));
@ -5178,9 +5176,11 @@ impl Tab {
} }
ItemThumbnail::Text(text) => { ItemThumbnail::Text(text) => {
element_opt = Some( element_opt = Some(
widget::container(widget::text_editor(text).padding(space_xxs).class( widget::container(
cosmic::theme::iced::TextEditor::Custom(Box::new(text_editor_class)), widget::text_editor::text_editor(text)
)) .padding(space_xxs)
.style(text_editor_class),
)
.center(Length::Fill) .center(Length::Fill)
.into(), .into(),
); );