From 1c34f73f615d3283cd0b2bd83fd0abdcb70d5574 Mon Sep 17 00:00:00 2001 From: zadam Date: Fri, 14 Jan 2022 21:02:11 +0100 Subject: [PATCH] print should include promoted attributes, #2550 (cherry picked from commit a5444fd6ad8e7af62799146acb85bee9f43231a0) --- src/public/app/widgets/note_detail.js | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/src/public/app/widgets/note_detail.js b/src/public/app/widgets/note_detail.js index e951fbbdc..77fd1919f 100644 --- a/src/public/app/widgets/note_detail.js +++ b/src/public/app/widgets/note_detail.js @@ -21,6 +21,7 @@ import ReadOnlyCodeTypeWidget from "./type_widgets/read_only_code.js"; import NoneTypeWidget from "./type_widgets/none.js"; import attributeService from "../services/attributes.js"; import NoteMapTypeWidget from "./type_widgets/note_map.js"; +import attributeRenderer from "../services/attribute_renderer.js"; const TPL = `
@@ -136,6 +137,15 @@ export default class NoteDetailWidget extends NoteContextAwareWidget { this.child(typeWidget); } + + this.checkFullHeight(); + } + + checkFullHeight() { + // https://github.com/zadam/trilium/issues/2522 + this.$widget.toggleClass("full-height", + !this.noteContext.hasNoteList() + && ['editable-text', 'editable-code'].includes(this.type)); } getTypeWidget() { @@ -209,8 +219,17 @@ export default class NoteDetailWidget extends NoteContextAwareWidget { await libraryLoader.requireLibrary(libraryLoader.PRINT_THIS); + let $promotedAttributes = $(""); + + if (this.note.getPromotedDefinitionAttributes().length > 0) { + $promotedAttributes = (await attributeRenderer.renderNormalAttributes(this.note)).$renderedAttributes; + } + this.$widget.find('.note-detail-printable:visible').printThis({ - header: $("

").text(this.note && this.note.title).prop('outerHTML'), + header: $("
") + .append($("

").text(this.note.title)) + .append($promotedAttributes) + .prop('outerHTML'), footer: `