activate PDF preview also in server build, fixes #1208

This commit is contained in:
zadam 2020-08-27 23:22:36 +02:00
parent e8d63b5647
commit 26dfa1ffdb
3 changed files with 4 additions and 5 deletions

View File

@ -92,7 +92,7 @@ async function getRenderedContent(note) {
function getRenderingType(note) { function getRenderingType(note) {
let type = note.type; let type = note.type;
if (type === 'file' && note.mime === 'application/pdf' && utils.isElectron()) { if (type === 'file' && note.mime === 'application/pdf') {
type = 'pdf'; type = 'pdf';
} }

View File

@ -303,13 +303,12 @@ export default class NoteTreeWidget extends TabAwareWidget {
this.$tree.fancytree({ this.$tree.fancytree({
titlesTabbable: true, titlesTabbable: true,
autoScroll: true,
keyboard: false, // we takover keyboard handling in the hotkeys plugin keyboard: false, // we takover keyboard handling in the hotkeys plugin
extensions: utils.isMobile() ? ["dnd5", "clones"] : ["hotkeys", "dnd5", "clones"], extensions: utils.isMobile() ? ["dnd5", "clones"] : ["hotkeys", "dnd5", "clones"],
source: treeData, source: treeData,
scrollOfs: { scrollOfs: {
top: 200, top: 100,
bottom: 200 bottom: 100
}, },
scrollParent: this.$tree, scrollParent: this.$tree,
minExpandLevel: 2, // root can't be collapsed minExpandLevel: 2, // root can't be collapsed

View File

@ -124,7 +124,7 @@ export default class FileTypeWidget extends TypeWidget {
this.$previewContent.show().scrollTop(0); this.$previewContent.show().scrollTop(0);
this.$previewContent.text(noteComplement.content); this.$previewContent.text(noteComplement.content);
} }
else if (note.mime === 'application/pdf' && utils.isElectron()) { else if (note.mime === 'application/pdf') {
this.$pdfPreview.show(); this.$pdfPreview.show();
this.$pdfPreview.attr("src", utils.getUrlForDownload("api/notes/" + this.noteId + "/open")); this.$pdfPreview.attr("src", utils.getUrlForDownload("api/notes/" + this.noteId + "/open"));
} }