mirror of
https://github.com/zadam/trilium.git
synced 2025-06-06 18:08:33 +02:00
wip
This commit is contained in:
parent
579ed7e194
commit
8e913cb453
@ -170,8 +170,20 @@ export default class AttachmentDetailWidget extends BasicWidget {
|
||||
this.$wrapper.find('.attachment-content-wrapper').append((await contentRenderer.getRenderedContent(this.attachment)).$renderedContent);
|
||||
}
|
||||
|
||||
copyAttachmentReferenceToClipboard() {
|
||||
imageService.copyImageReferenceToClipboard(this.$wrapper.find('.attachment-content-wrapper'));
|
||||
async copyAttachmentLinkToClipboard() {
|
||||
if (this.attachment.role === 'image') {
|
||||
imageService.copyImageReferenceToClipboard(this.$wrapper.find('.attachment-content-wrapper'));
|
||||
} else if (this.attachment.role === 'file') {
|
||||
const $link = await linkService.createNoteLink(this.attachment.parentId, {
|
||||
referenceLink: true,
|
||||
viewScope: {
|
||||
viewMode: 'attachments',
|
||||
attachmentId: this.attachment.attachmentId
|
||||
}
|
||||
});
|
||||
} else {
|
||||
throw new Error(`Unrecognized attachment role '${this.attachment.role}'.`);
|
||||
}
|
||||
}
|
||||
|
||||
async entitiesReloadedEvent({loadResults}) {
|
||||
|
@ -33,7 +33,7 @@ const TPL = `
|
||||
title="File will be open in an external application and watched for changes. You'll then be able to upload the modified version back to Trilium.">Open externally</a>
|
||||
<a data-trigger-command="downloadAttachment" class="dropdown-item">Download</a>
|
||||
<a data-trigger-command="uploadNewAttachmentRevision" class="dropdown-item">Upload new revision</a>
|
||||
<a data-trigger-command="copyAttachmentReferenceToClipboard" class="dropdown-item">Copy reference to clipboard</a>
|
||||
<a data-trigger-command="copyAttachmentLinkToClipboard" class="dropdown-item">Copy link to clipboard</a>
|
||||
<a data-trigger-command="convertAttachmentIntoNote" class="dropdown-item">Convert attachment into note</a>
|
||||
<a data-trigger-command="deleteAttachment" class="dropdown-item">Delete attachment</a>
|
||||
</div>
|
||||
@ -56,7 +56,7 @@ export default class AttachmentActionsWidget extends BasicWidget {
|
||||
doRender() {
|
||||
this.$widget = $(TPL);
|
||||
this.$widget.on('click', '.dropdown-item', () => this.$widget.find("[data-toggle='dropdown']").dropdown('toggle'));
|
||||
this.$widget.find("[data-trigger-command='copyAttachmentReferenceToClipboard']").toggle(this.attachment.role === 'image');
|
||||
this.$widget.find("[data-trigger-command='copyAttachmentLinkToClipboard']").toggle(this.attachment.role === 'image');
|
||||
|
||||
this.$uploadNewRevisionInput = this.$widget.find(".attachment-upload-new-revision-input");
|
||||
this.$uploadNewRevisionInput.on('change', async () => {
|
||||
@ -107,8 +107,8 @@ export default class AttachmentActionsWidget extends BasicWidget {
|
||||
this.$uploadNewRevisionInput.trigger('click');
|
||||
}
|
||||
|
||||
async copyAttachmentReferenceToClipboardCommand() {
|
||||
this.parent.copyAttachmentReferenceToClipboard();
|
||||
async copyAttachmentLinkToClipboardCommand() {
|
||||
this.parent.copyAttachmentLinkToClipboard();
|
||||
}
|
||||
|
||||
async deleteAttachmentCommand() {
|
||||
|
Loading…
x
Reference in New Issue
Block a user