From fa655ea45e7e073e0b30b440ffb4cdef356de28e Mon Sep 17 00:00:00 2001 From: Elian Doran Date: Sat, 1 Feb 2025 17:34:36 +0200 Subject: [PATCH] feat(pdf): describe the attributes & fix conflict in name --- src/public/app/widgets/attribute_widgets/attribute_detail.ts | 4 +++- src/public/app/widgets/note_detail.js | 2 +- src/public/translations/en/translation.json | 4 +++- src/services/builtin_attributes.ts | 3 +++ 4 files changed, 10 insertions(+), 3 deletions(-) diff --git a/src/public/app/widgets/attribute_widgets/attribute_detail.ts b/src/public/app/widgets/attribute_widgets/attribute_detail.ts index 7ea7061a9..cccb70075 100644 --- a/src/public/app/widgets/attribute_widgets/attribute_detail.ts +++ b/src/public/app/widgets/attribute_widgets/attribute_detail.ts @@ -242,7 +242,9 @@ const ATTR_HELP: Record> = { executeDescription: t("attribute_detail.execute_description"), excludeFromNoteMap: t("attribute_detail.exclude_from_note_map"), newNotesOnTop: t("attribute_detail.new_notes_on_top"), - hideHighlightWidget: t("attribute_detail.hide_highlight_widget") + hideHighlightWidget: t("attribute_detail.hide_highlight_widget"), + printLandscape: t("attribute_detail.print_landscape"), + printPageSize: t("attribute_detail.print_page_size") }, relation: { runOnNoteCreation: t("attribute_detail.run_on_note_creation"), diff --git a/src/public/app/widgets/note_detail.js b/src/public/app/widgets/note_detail.js index 11cc6f71d..7c1e4f1d9 100644 --- a/src/public/app/widgets/note_detail.js +++ b/src/public/app/widgets/note_detail.js @@ -261,7 +261,7 @@ export default class NoteDetailWidget extends NoteContextAwareWidget { const { ipcRenderer } = utils.dynamicRequire("electron"); ipcRenderer.send("export-as-pdf", { title: this.note.title, - pageSize: this.note.getAttributeValue("label", "pageSize") ?? "Letter", + pageSize: this.note.getAttributeValue("label", "printPageSize") ?? "Letter", landscape: this.note.hasAttribute("label", "printLandscape") }); } diff --git a/src/public/translations/en/translation.json b/src/public/translations/en/translation.json index e29c258f0..958df556b 100644 --- a/src/public/translations/en/translation.json +++ b/src/public/translations/en/translation.json @@ -438,7 +438,9 @@ "share_favicon": "Favicon note to be set in the shared page. Typically you want to set it to share root and make it inheritable. Favicon note must be in the shared sub-tree as well. Consider using 'share_hidden_from_tree'.", "is_owned_by_note": "is owned by note", "other_notes_with_name": "Other notes with {{attributeType}} name \"{{attributeName}}\"", - "and_more": "... and {{count}} more." + "and_more": "... and {{count}} more.", + "print_landscape": "When exporting to PDF, changes the orientation of the page to landscape instead of portrait.", + "print_page_size": "When exporting to PDF, changes the size of the page. Supported values: A0, A1, A2, A3, A4, A5, A6, Legal, Letter, Tabloid, Ledger." }, "attribute_editor": { "help_text_body1": "To add label, just type e.g. #rock or if you want to add also value then e.g. #year = 2020", diff --git a/src/services/builtin_attributes.ts b/src/services/builtin_attributes.ts index 30c0b6ce5..1caaecd63 100644 --- a/src/services/builtin_attributes.ts +++ b/src/services/builtin_attributes.ts @@ -72,6 +72,9 @@ export default [ { type: "label", name: "webViewSrc", isDangerous: true }, { type: "label", name: "hideHighlightWidget" }, + { type: "label", name: "printLandscape" }, + { type: "label", name: "printPageSize" }, + // relation names { type: "relation", name: "internalLink" }, { type: "relation", name: "imageLink" },