+ pub fn load_attachments(&mut self) {
+ let NoteId::Id(note_id) = self.id else {
+ return;
+ };
+
+ let Some(doc) = self.doc.get_doc() else {
+ return;
+ };
+
+ let proxy = doc.doc_proxy();
+ self.backend.get_note_attachments(note_id, move|result|{
+ proxy.call_mainthread(move |_doc, note|{
+ match result {
+ Ok(attachments) => {
+ note.attachments.data_mut().clear();
+ note.attachments.data_mut().extend(attachments);
+ note.attachments.update();
+ },
+ Err(e) => {
+ println!("Cannot get note attachments: {}", e);
+ }
+ }
+ });
+ });
+ }
+