2019-08-16 03:18:33 +08:00
|
|
|
import StandardWidget from "./standard_widget.js";
|
|
|
|
|
2019-07-21 17:32:38 +08:00
|
|
|
const TPL = `
|
|
|
|
<table class="note-info-table">
|
|
|
|
<tr>
|
|
|
|
<th>Note ID</th>
|
|
|
|
<td class="note-info-note-id"></td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<th>Created</th>
|
|
|
|
<td class="note-info-date-created"></td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<th>Modified</th>
|
|
|
|
<td class="note-info-date-modified"></td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<th>Type</th>
|
|
|
|
<td class="note-info-type"></td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<th>MIME</th>
|
|
|
|
<td class="note-info-mime"></td>
|
|
|
|
</tr>
|
|
|
|
</table>
|
|
|
|
`;
|
|
|
|
|
2019-08-16 03:18:33 +08:00
|
|
|
class NoteInfoWidget extends StandardWidget {
|
2019-07-21 17:32:38 +08:00
|
|
|
/**
|
|
|
|
* @param {TabContext} ctx
|
2019-08-16 03:18:33 +08:00
|
|
|
* @param {object} state
|
2019-07-21 17:32:38 +08:00
|
|
|
*/
|
2019-08-16 03:18:33 +08:00
|
|
|
constructor(ctx, state) {
|
2019-08-17 03:29:44 +08:00
|
|
|
super(ctx, state);
|
2019-08-16 03:18:33 +08:00
|
|
|
|
2019-07-21 17:32:38 +08:00
|
|
|
this.$title.text("Note info");
|
|
|
|
}
|
|
|
|
|
2019-08-16 03:18:33 +08:00
|
|
|
async doRenderBody() {
|
|
|
|
this.$body.html(TPL);
|
2019-07-21 17:32:38 +08:00
|
|
|
|
2019-08-16 03:18:33 +08:00
|
|
|
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");
|
2019-07-21 17:32:38 +08:00
|
|
|
|
|
|
|
const note = this.ctx.note;
|
|
|
|
|
|
|
|
$noteId.text(note.noteId);
|
|
|
|
$dateCreated.text(note.dateCreated);
|
|
|
|
$dateModified.text(note.dateModified);
|
|
|
|
$type.text(note.type);
|
|
|
|
$mime.text(note.mime);
|
|
|
|
}
|
2019-08-07 04:39:27 +08:00
|
|
|
|
|
|
|
syncDataReceived(syncData) {
|
|
|
|
if (syncData.find(sd => sd.entityName === 'notes' && sd.entityId === this.ctx.note.noteId)) {
|
2019-08-16 03:18:33 +08:00
|
|
|
this.doRenderBody();
|
2019-08-07 04:39:27 +08:00
|
|
|
}
|
|
|
|
}
|
2019-07-21 17:32:38 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
export default NoteInfoWidget;
|