Display PDF in shared notes (#2466)

* Add PDF rendering

* Cleanup
This commit is contained in:
Matt
2021-12-24 21:36:31 +00:00
committed by GitHub
parent a789025025
commit a08985e7a6
2 changed files with 27 additions and 2 deletions

View File

@@ -76,7 +76,12 @@ function getContent(note) {
content = `<img src="api/images/${note.noteId}/${note.title}?${note.utcDateModified}">`;
}
else if (note.type === 'file') {
content = `<button type="button" onclick="location.href='api/notes/${note.noteId}/download'">Download file</button>`;
if (note.mime === 'application/pdf') {
content = `<iframe height="800" width="800" src="api/notes/${note.noteId}/view"></iframe>`
}
else {
content = `<button type="button" onclick="location.href='api/notes/${note.noteId}/download'">Download file</button>`;
}
}
else if (note.type === 'book') {
content = getChildrenList(note);
@@ -84,7 +89,7 @@ function getContent(note) {
else {
content = '<p>This note type cannot be displayed.</p>' + getChildrenList(note);
}
return content;
}