From: Olaf Wintermann Date: Mon, 25 May 2026 15:12:33 +0000 (+0200) Subject: switch right-panel tabview when selecting notes X-Git-Url: https://uap-core.de/gitweb/?a=commitdiff_plain;h=75437ff6d152882dffe36a2dce0685383bf7608f;p=note.git switch right-panel tabview when selecting notes --- diff --git a/application/src/note.rs b/application/src/note.rs index 3b1ea08..ffc2e77 100644 --- a/application/src/note.rs +++ b/application/src/note.rs @@ -1,7 +1,7 @@ use entity::note::NoteType; use ui_rs::{ui_actions, UiModel}; use ui_rs::ui::*; - +use crate::window::NoteTypeTabView; #[derive(UiModel, Default)] pub struct Note { @@ -16,6 +16,14 @@ pub struct Note { #[ui_actions] impl Note { + pub fn init_from_model(&mut self, model: &entity::note::Model) { + self.text.set(model.content.as_str()); - + let tab = match(model.kind) { + NoteType::PlainTextNote => NoteTypeTabView::TextArea, + NoteType::MDTextNote => NoteTypeTabView::TextArea, + _ => NoteTypeTabView::Empty + }; + self.note_type.set(tab as i64); + } } \ No newline at end of file diff --git a/application/src/notebook.rs b/application/src/notebook.rs index 128acfe..40de6f4 100644 --- a/application/src/notebook.rs +++ b/application/src/notebook.rs @@ -1,7 +1,8 @@ use ui_rs::{action, ui_actions, UiModel}; use ui_rs::ui::*; -use entity::note::Model as Note; +use entity::note::{Model as Note, NoteType}; +use crate::window::NoteTypeTabView; #[derive(UiModel, Default)] pub struct Notebook { @@ -56,7 +57,7 @@ impl Notebook { nb.ctx.attach(&d); } - n.text.set(note.content.as_str()); + n.init_from_model(¬e); }); // Attach the new note diff --git a/application/src/window.rs b/application/src/window.rs index 8785995..b37b038 100644 --- a/application/src/window.rs +++ b/application/src/window.rs @@ -180,7 +180,7 @@ pub fn create_window(app: &App, ctx: &AppContext) -> UiObject