From a5764c269f33ef32d159286f55cc7321346d1615 Mon Sep 17 00:00:00 2001 From: zadam Date: Sun, 15 Mar 2020 21:35:43 +0100 Subject: [PATCH] pdf preview is now also available in include note, book etc. --- .../javascripts/services/note_content_renderer.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/public/javascripts/services/note_content_renderer.js b/src/public/javascripts/services/note_content_renderer.js index 7a6ec1869..0a4840026 100644 --- a/src/public/javascripts/services/note_content_renderer.js +++ b/src/public/javascripts/services/note_content_renderer.js @@ -45,7 +45,16 @@ async function getRenderedContent(note) { // open doesn't work for protected notes since it works through browser which isn't in protected session $openButton.toggle(!note.isProtected); - $rendered = $('
') + $rendered = $('
'); + + if (note.mime === 'application/pdf' && utils.isElectron()) { + const $pdfPreview = $(''); + $pdfPreview.attr("src", utils.getUrlForDownload("api/notes/" + note.noteId + "/open")); + + $rendered.append($pdfPreview); + } + + $rendered .append($downloadButton) .append('   ') .append($openButton);