import StandardWidget from "./standard_widget.js"; const TPL = `
Note ID:
Created:
Modified:
Type: MIME:
`; class NoteInfoWidget extends StandardWidget { getWidgetTitle() { return "Note info"; } doRenderBody() { this.$body.html(TPL); } refreshWithNote(note) { const $noteId = this.$body.find(".note-info-note-id"); const $dateCreated = this.$body.find(".note-info-date-created"); const $dateModified = this.$body.find(".note-info-date-modified"); const $type = this.$body.find(".note-info-type"); const $mime = this.$body.find(".note-info-mime"); const {noteFull} = this.tabContext; $noteId.text(note.noteId); $dateCreated .text(noteFull.dateCreated) .attr("title", noteFull.dateCreated); $dateModified .text(noteFull.dateModified) .attr("title", noteFull.dateCreated); $type.text(note.type); $mime .text(note.mime) .attr("title", note.mime); } // this is interesting for this widget since dateModified had to change after update noteChangesSavedListener({noteId}) { if (this.isNote(noteId)) { this.refreshWithNote(this.note, this.notePath); } } syncDataListener({data}) { if (data.find(sd => sd.entityName === 'notes' && this.isNote(sd.entityId))) { this.refresh(); } } } export default NoteInfoWidget;