refactor(client): use workaround for TS error

This commit is contained in:
Elian Doran 2025-02-23 18:32:53 +02:00
parent 4883debd8d
commit 560b7ebe35
No known key found for this signature in database

View File

@ -10,6 +10,7 @@ import utils from "../../services/utils.js";
import { Dropdown } from "bootstrap"; import { Dropdown } from "bootstrap";
import type attachmentsApiRoute from "../../../../routes/api/attachments.js" import type attachmentsApiRoute from "../../../../routes/api/attachments.js"
import type FAttachment from "../../entities/fattachment.js"; import type FAttachment from "../../entities/fattachment.js";
import type AttachmentDetailWidget from "../attachment_detail.js";
const TPL = ` const TPL = `
<div class="dropdown attachment-actions"> <div class="dropdown attachment-actions">
@ -18,11 +19,11 @@ const TPL = `
width: 35px; width: 35px;
height: 35px; height: 35px;
} }
.attachment-actions .dropdown-menu { .attachment-actions .dropdown-menu {
width: 20em; width: 20em;
} }
.attachment-actions .dropdown-item .bx { .attachment-actions .dropdown-item .bx {
position: relative; position: relative;
top: 3px; top: 3px;
@ -37,7 +38,7 @@ const TPL = `
} }
</style> </style>
<button type="button" data-bs-toggle="dropdown" aria-haspopup="true" <button type="button" data-bs-toggle="dropdown" aria-haspopup="true"
aria-expanded="false" class="icon-action icon-action-always-border bx bx-dots-vertical-rounded" aria-expanded="false" class="icon-action icon-action-always-border bx bx-dots-vertical-rounded"
style="position: relative; top: 3px;"></button> style="position: relative; top: 3px;"></button>
@ -45,17 +46,17 @@ const TPL = `
<li data-trigger-command="openAttachment" class="dropdown-item" <li data-trigger-command="openAttachment" class="dropdown-item"
title="${t("attachments_actions.open_externally_title")}"><span class="bx bx-file-find"></span> ${t("attachments_actions.open_externally")}</li> title="${t("attachments_actions.open_externally_title")}"><span class="bx bx-file-find"></span> ${t("attachments_actions.open_externally")}</li>
<li data-trigger-command="openAttachmentCustom" class="dropdown-item" <li data-trigger-command="openAttachmentCustom" class="dropdown-item"
title="${t("attachments_actions.open_custom_title")}"><span class="bx bx-customize"></span> ${t("attachments_actions.open_custom")}</li> title="${t("attachments_actions.open_custom_title")}"><span class="bx bx-customize"></span> ${t("attachments_actions.open_custom")}</li>
<li data-trigger-command="downloadAttachment" class="dropdown-item"> <li data-trigger-command="downloadAttachment" class="dropdown-item">
<span class="bx bx-download"></span> ${t("attachments_actions.download")}</li> <span class="bx bx-download"></span> ${t("attachments_actions.download")}</li>
<li data-trigger-command="copyAttachmentLinkToClipboard" class="dropdown-item"><span class="bx bx-link"> <li data-trigger-command="copyAttachmentLinkToClipboard" class="dropdown-item"><span class="bx bx-link">
</span> ${t("attachments_actions.copy_link_to_clipboard")}</li> </span> ${t("attachments_actions.copy_link_to_clipboard")}</li>
<div class="dropdown-divider"></div> <div class="dropdown-divider"></div>
@ -70,13 +71,13 @@ const TPL = `
<div class="dropdown-divider"></div> <div class="dropdown-divider"></div>
<li data-trigger-command="convertAttachmentIntoNote" class="dropdown-item"><span class="bx bx-note"> <li data-trigger-command="convertAttachmentIntoNote" class="dropdown-item"><span class="bx bx-note">
</span> ${t("attachments_actions.convert_attachment_into_note")}</li> </span> ${t("attachments_actions.convert_attachment_into_note")}</li>
</div> </div>
<input type="file" class="attachment-upload-new-revision-input" style="display: none"> <input type="file" class="attachment-upload-new-revision-input" style="display: none">
</div>`; </div>`;
@ -150,10 +151,9 @@ export default class AttachmentActionsWidget extends BasicWidget {
} }
async copyAttachmentLinkToClipboardCommand() { async copyAttachmentLinkToClipboardCommand() {
//TriliumNextTODO: the parent here is AttachmentDetailWidget if (this.parent && "copyAttachmentLinkToClipboard" in this.parent) {
//how can we pass that to the generic TypedComponent<any>? (this.parent as AttachmentDetailWidget).copyAttachmentLinkToClipboard();
//@ts-ignore - TypedComponent<any> }
this.parent?.copyAttachmentLinkToClipboard();
} }
async deleteAttachmentCommand() { async deleteAttachmentCommand() {