use entity::note::NoteType;
use ui_rs::{ui_actions, UiModel};
use ui_rs::ui::*;
-
+use crate::window::NoteTypeTabView;
#[derive(UiModel, Default)]
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
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 {
nb.ctx.attach(&d);
}
- n.text.set(note.content.as_str());
+ n.init_from_model(¬e);
});
// Attach the new note
b.varname("note_type");
},
|tabview| {
- //tabview.tab("empty", |_obj| {});
+ tabview.tab("empty", |_obj| {});
tabview.tab("textnote", |obj| {
obj.textarea(|b|{
window.update_notebook_structure(&data.notebooks);
}
+pub enum NoteTypeTabView {
+ Empty = 0,
+ TextArea = 1
+}
\ No newline at end of file