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,
|
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,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue