feat: text editor for transient notes

This commit is contained in:
electria 2026-06-25 17:40:30 -07:00
commit 3cc6e65fa4
Signed by: electria
SSH key fingerprint: SHA256:8LlB3ucPbBHqozqkhsNbaV5oG3SlzzqUj8FZDL6IPQs

View file

@ -45,12 +45,15 @@ enum Message {
new_value: String, new_value: String,
}, },
EditNotes(widget::text_editor::Action),
Event(iced::Event), Event(iced::Event),
} }
#[derive(Clone, Debug, Default)] #[derive(Clone, Debug, Default)]
struct State { struct State {
table: data::Table, table: data::Table,
content: widget::text_editor::Content,
} }
impl State { impl State {
fn new() -> Self { fn new() -> Self {
@ -144,6 +147,7 @@ impl State {
.padding(15) .padding(15)
.into(), .into(),
]) ])
.push(widget::text_editor(&self.content).on_action(Message::EditNotes))
.align_x(Horizontal::Center) .align_x(Horizontal::Center)
.into() .into()
} }
@ -189,6 +193,10 @@ impl State {
self.table[i_category].elements[i_element] = new_value; self.table[i_category].elements[i_element] = new_value;
} }
Message::EditNotes(action) => {
self.content.perform(action);
}
Message::Event(iced::Event::Keyboard(keyboard::Event::KeyPressed { Message::Event(iced::Event::Keyboard(keyboard::Event::KeyPressed {
key, key,
modifiers, modifiers,