2020-02-03 03:02:08 +08:00
|
|
|
import CollapsibleWidget from "./collapsible_widget.js";
|
2019-08-16 03:18:33 +08:00
|
|
|
|
2019-07-21 17:32:38 +08:00
|
|
|
const TPL = `
|
2020-01-22 05:08:41 +08:00
|
|
|
<table class="note-info-widget-table">
|
|
|
|
<style>
|
|
|
|
.note-info-widget-table {
|
|
|
|
table-layout: fixed;
|
|
|
|
width: 100%;
|
|
|
|
}
|
|
|
|
|
|
|
|
.note-info-widget-table td, .note-info-widget-table th {
|
|
|
|
padding: 5px;
|
|
|
|
}
|
|
|
|
</style>
|
|
|
|
|
2019-07-21 17:32:38 +08:00
|
|
|
<tr>
|
2020-01-04 16:04:08 +08:00
|
|
|
<th nowrap>Note ID:</th>
|
|
|
|
<td nowrap colspan="3" class="note-info-note-id"></td>
|
2019-07-21 17:32:38 +08:00
|
|
|
</tr>
|
|
|
|
<tr>
|
2020-01-04 16:04:08 +08:00
|
|
|
<th nowrap>Created:</th>
|
|
|
|
<td nowrap colspan="3" style="overflow: hidden; text-overflow: ellipsis;" class="note-info-date-created"></td>
|
2019-07-21 17:32:38 +08:00
|
|
|
</tr>
|
|
|
|
<tr>
|
2020-01-04 16:04:08 +08:00
|
|
|
<th nowrap>Modified:</th>
|
|
|
|
<td nowrap colspan="3" style="overflow: hidden; text-overflow: ellipsis;" class="note-info-date-modified"></td>
|
2019-07-21 17:32:38 +08:00
|
|
|
</tr>
|
|
|
|
<tr>
|
2019-09-01 15:16:08 +08:00
|
|
|
<th>Type:</th>
|
2019-07-21 17:32:38 +08:00
|
|
|
<td class="note-info-type"></td>
|
2019-09-01 15:16:08 +08:00
|
|
|
|
|
|
|
<th>MIME:</th>
|
2019-07-21 17:32:38 +08:00
|
|
|
<td class="note-info-mime"></td>
|
|
|
|
</tr>
|
|
|
|
</table>
|
|
|
|
`;
|
|
|
|
|
2020-02-03 04:16:20 +08:00
|
|
|
export default class NoteInfoWidget extends CollapsibleWidget {
|
2019-08-17 16:45:20 +08:00
|
|
|
getWidgetTitle() { return "Note info"; }
|
2019-07-21 17:32:38 +08:00
|
|
|
|
2020-01-15 04:23:32 +08:00
|
|
|
doRenderBody() {
|
2019-08-16 03:18:33 +08:00
|
|
|
this.$body.html(TPL);
|
2020-02-03 01:46:50 +08:00
|
|
|
|
|
|
|
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");
|
2020-01-15 04:23:32 +08:00
|
|
|
}
|
2019-07-21 17:32:38 +08:00
|
|
|
|
2020-02-01 18:33:31 +08:00
|
|
|
async refreshWithNote(note) {
|
|
|
|
const noteComplement = await this.tabContext.getNoteComplement();
|
2020-01-25 21:37:12 +08:00
|
|
|
|
2020-02-03 01:46:50 +08:00
|
|
|
this.$noteId.text(note.noteId);
|
|
|
|
this.$dateCreated
|
2020-02-01 18:15:58 +08:00
|
|
|
.text(noteComplement.dateCreated)
|
|
|
|
.attr("title", noteComplement.dateCreated);
|
2020-01-04 16:04:08 +08:00
|
|
|
|
2020-02-03 01:46:50 +08:00
|
|
|
this.$dateModified
|
2020-02-01 18:15:58 +08:00
|
|
|
.text(noteComplement.dateModified)
|
|
|
|
.attr("title", noteComplement.dateCreated);
|
2020-01-04 16:04:08 +08:00
|
|
|
|
2020-02-03 01:46:50 +08:00
|
|
|
this.$type.text(note.type);
|
2020-01-04 16:04:08 +08:00
|
|
|
|
2020-02-03 01:46:50 +08:00
|
|
|
this.$mime
|
2020-01-04 16:04:08 +08:00
|
|
|
.text(note.mime)
|
|
|
|
.attr("title", note.mime);
|
2019-07-21 17:32:38 +08:00
|
|
|
}
|
2019-08-07 04:39:27 +08:00
|
|
|
|
2020-02-03 04:16:20 +08:00
|
|
|
entitiesReloadedListener({loadResults}) {
|
|
|
|
if (loadResults.isNoteReloaded(this.noteId)) {
|
2020-01-19 03:49:49 +08:00
|
|
|
this.refresh();
|
2019-08-07 04:39:27 +08:00
|
|
|
}
|
|
|
|
}
|
2020-02-03 04:16:20 +08:00
|
|
|
}
|