feat: text editor for transient notes
This commit is contained in:
parent
52b83efc2c
commit
3cc6e65fa4
1 changed files with 8 additions and 0 deletions
|
|
@ -45,12 +45,15 @@ enum Message {
|
|||
new_value: String,
|
||||
},
|
||||
|
||||
EditNotes(widget::text_editor::Action),
|
||||
|
||||
Event(iced::Event),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Default)]
|
||||
struct State {
|
||||
table: data::Table,
|
||||
content: widget::text_editor::Content,
|
||||
}
|
||||
impl State {
|
||||
fn new() -> Self {
|
||||
|
|
@ -144,6 +147,7 @@ impl State {
|
|||
.padding(15)
|
||||
.into(),
|
||||
])
|
||||
.push(widget::text_editor(&self.content).on_action(Message::EditNotes))
|
||||
.align_x(Horizontal::Center)
|
||||
.into()
|
||||
}
|
||||
|
|
@ -189,6 +193,10 @@ impl State {
|
|||
self.table[i_category].elements[i_element] = new_value;
|
||||
}
|
||||
|
||||
Message::EditNotes(action) => {
|
||||
self.content.perform(action);
|
||||
}
|
||||
|
||||
Message::Event(iced::Event::Keyboard(keyboard::Event::KeyPressed {
|
||||
key,
|
||||
modifiers,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue