import CollapsibleWidget from "../collapsible_widget.js"; const TPL = `
Note ID: Type:
Created: Modified:
`; export default class NoteInfoWidget extends CollapsibleWidget { isEnabled() { return super.isEnabled() && !this.note.hasLabel('noteInfoWidgetDisabled'); } get widgetTitle() { return "Note info"; } async doRenderBody() { this.$body.html(TPL); this.$noteId = this.$body.find(".note-info-note-id"); this.$dateCreated = this.$body.find(".note-info-date-created"); this.$dateModified = this.$body.find(".note-info-date-modified"); this.$type = this.$body.find(".note-info-type"); this.$mime = this.$body.find(".note-info-mime"); } async refreshWithNote(note) { const noteComplement = await this.tabContext.getNoteComplement(); this.$noteId.text(note.noteId); this.$dateCreated .text(noteComplement.dateCreated.substr(0, 16)) .attr("title", noteComplement.dateCreated); this.$dateModified .text(noteComplement.combinedDateModified.substr(0, 16)) .attr("title", noteComplement.combinedDateModified); this.$type.text(note.type); if (note.mime) { this.$mime.text('(' + note.mime + ')'); } else { this.$mime.empty(); } } entitiesReloadedEvent({loadResults}) { if (loadResults.isNoteReloaded(this.noteId) || loadResults.isNoteContentReloaded(this.noteId)) { this.refresh(); } } }