import TypeWidget from "./type_widget.js"; import server from "../../services/server.js"; import utils from "../../services/utils.js"; import AttachmentActionsWidget from "../buttons/attachments_actions.js"; import BasicWidget from "./basic_widget.js"; const TPL = `
`; export default class AttachmentDetailWidget extends BasicWidget { constructor(attachment) { super(); this.attachment = attachment; } doRender() { this.$widget = $(TPL); this.$wrapper = this.$widget.find('.attachment-detail-wrapper'); super.doRender(); } async doRefresh(note) { this.$list.empty(); this.children = []; const attachments = await server.get(`notes/${this.noteId}/attachments?includeContent=true`); if (attachments.length === 0) { this.$list.html("This note has no attachments."); return; } for (const attachment of attachments) { const attachmentActionsWidget = new AttachmentActionsWidget(attachment); this.child(attachmentActionsWidget); this.$list.append( $('