You've already forked joplin
mirror of
https://github.com/laurent22/joplin.git
synced 2025-07-16 00:14:34 +02:00
Desktop: New Embedded Pdf Viewer (#6681)
This commit is contained in:
@ -7,6 +7,8 @@ export interface Options {
|
||||
audioPlayerEnabled: boolean;
|
||||
videoPlayerEnabled: boolean;
|
||||
pdfViewerEnabled: boolean;
|
||||
useCustomPdfViewer: boolean;
|
||||
theme: any;
|
||||
}
|
||||
|
||||
function resourceUrl(resourceFullPath: string): string {
|
||||
@ -42,6 +44,16 @@ export default function(link: Link, options: Options) {
|
||||
}
|
||||
|
||||
if (options.pdfViewerEnabled && resource.mime === 'application/pdf') {
|
||||
if (options.useCustomPdfViewer) {
|
||||
let anchorPageNo = null;
|
||||
if (link.href.indexOf('#') > 0) {
|
||||
anchorPageNo = Number(link.href.split('#').pop());
|
||||
if (anchorPageNo < 1) anchorPageNo = null;
|
||||
}
|
||||
return `<iframe src="../../vendor/lib/@joplin/pdf-viewer/index.html" url="${escapedResourcePath}"
|
||||
appearance="${options.theme.appearance}" ${anchorPageNo ? `anchorPage="${anchorPageNo}"` : ''}
|
||||
class="media-player media-pdf"></iframe>`;
|
||||
}
|
||||
return `<object data="${escapedResourcePath}" class="media-player media-pdf" type="${escapedMime}"></object>`;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user