mirror of
https://github.com/zadam/trilium.git
synced 2025-03-01 14:22:32 +01:00
adding links to owning note and list to attachments
This commit is contained in:
parent
274505188b
commit
b05ce12e7b
@ -83,7 +83,7 @@ function calculateHash({notePath, ntxId, hoistedNoteId, viewScope = {}}) {
|
|||||||
const params = [
|
const params = [
|
||||||
ntxId ? { ntxId: ntxId } : null,
|
ntxId ? { ntxId: ntxId } : null,
|
||||||
(hoistedNoteId && hoistedNoteId !== 'root') ? { hoistedNoteId: hoistedNoteId } : null,
|
(hoistedNoteId && hoistedNoteId !== 'root') ? { hoistedNoteId: hoistedNoteId } : null,
|
||||||
viewScope.viewMode !== 'default' ? { viewMode: viewScope.viewMode } : null,
|
viewScope.viewMode && viewScope.viewMode !== 'default' ? { viewMode: viewScope.viewMode } : null,
|
||||||
viewScope.attachmentId ? { attachmentId: viewScope.attachmentId } : null
|
viewScope.attachmentId ? { attachmentId: viewScope.attachmentId } : null
|
||||||
].filter(p => !!p);
|
].filter(p => !!p);
|
||||||
|
|
||||||
|
@ -9,6 +9,11 @@ const TPL = `
|
|||||||
.attachment-detail {
|
.attachment-detail {
|
||||||
padding: 15px;
|
padding: 15px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.attachment-detail .links-wrapper {
|
||||||
|
padding: 16px;
|
||||||
|
font-size: larger;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<div class="links-wrapper"></div>
|
<div class="links-wrapper"></div>
|
||||||
@ -24,6 +29,7 @@ export default class AttachmentDetailTypeWidget extends TypeWidget {
|
|||||||
doRender() {
|
doRender() {
|
||||||
this.$widget = $(TPL);
|
this.$widget = $(TPL);
|
||||||
this.$wrapper = this.$widget.find('.attachment-wrapper');
|
this.$wrapper = this.$widget.find('.attachment-wrapper');
|
||||||
|
this.$linksWrapper = this.$widget.find('.links-wrapper');
|
||||||
|
|
||||||
super.doRender();
|
super.doRender();
|
||||||
}
|
}
|
||||||
@ -32,7 +38,17 @@ export default class AttachmentDetailTypeWidget extends TypeWidget {
|
|||||||
this.$wrapper.empty();
|
this.$wrapper.empty();
|
||||||
this.children = [];
|
this.children = [];
|
||||||
|
|
||||||
linkService.createNoteLink(this.noteId, {});
|
this.$linksWrapper.append(
|
||||||
|
"Owning note: ",
|
||||||
|
await linkService.createNoteLink(this.noteId),
|
||||||
|
", you can also open the ",
|
||||||
|
await linkService.createNoteLink(this.noteId, {
|
||||||
|
title: 'List of all attachments',
|
||||||
|
viewScope: {
|
||||||
|
viewMode: 'attachments'
|
||||||
|
}
|
||||||
|
})
|
||||||
|
);
|
||||||
|
|
||||||
const attachment = await server.get(`attachments/${this.attachmentId}/?includeContent=true`);
|
const attachment = await server.get(`attachments/${this.attachmentId}/?includeContent=true`);
|
||||||
|
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
import TypeWidget from "./type_widget.js";
|
import TypeWidget from "./type_widget.js";
|
||||||
import server from "../../services/server.js";
|
import server from "../../services/server.js";
|
||||||
import AttachmentDetailWidget from "../attachment_detail.js";
|
import AttachmentDetailWidget from "../attachment_detail.js";
|
||||||
|
import linkService from "../../services/link.js";
|
||||||
|
|
||||||
const TPL = `
|
const TPL = `
|
||||||
<div class="attachment-list note-detail-printable">
|
<div class="attachment-list note-detail-printable">
|
||||||
@ -8,8 +9,15 @@ const TPL = `
|
|||||||
.attachment-list {
|
.attachment-list {
|
||||||
padding: 15px;
|
padding: 15px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.attachment-list .links-wrapper {
|
||||||
|
font-size: larger;
|
||||||
|
margin-bottom: 15px;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
|
<div class="links-wrapper"></div>
|
||||||
|
|
||||||
<div class="attachment-list-wrapper"></div>
|
<div class="attachment-list-wrapper"></div>
|
||||||
</div>`;
|
</div>`;
|
||||||
|
|
||||||
@ -21,11 +29,17 @@ export default class AttachmentListTypeWidget extends TypeWidget {
|
|||||||
doRender() {
|
doRender() {
|
||||||
this.$widget = $(TPL);
|
this.$widget = $(TPL);
|
||||||
this.$list = this.$widget.find('.attachment-list-wrapper');
|
this.$list = this.$widget.find('.attachment-list-wrapper');
|
||||||
|
this.$linksWrapper = this.$widget.find('.links-wrapper');
|
||||||
|
|
||||||
super.doRender();
|
super.doRender();
|
||||||
}
|
}
|
||||||
|
|
||||||
async doRefresh(note) {
|
async doRefresh(note) {
|
||||||
|
this.$linksWrapper.append(
|
||||||
|
"Owning note: ",
|
||||||
|
await linkService.createNoteLink(this.noteId)
|
||||||
|
);
|
||||||
|
|
||||||
this.$list.empty();
|
this.$list.empty();
|
||||||
this.children = [];
|
this.children = [];
|
||||||
this.renderedAttachmentIds = new Set();
|
this.renderedAttachmentIds = new Set();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user