mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2026-07-05 19:45:10 +00:00
Chore(deps): Bump pdfjs-dist from 5.7.284 to 6.0.227 in /src-ui (#13080)
Co-authored-by: shamoon <4887959+shamoon@users.noreply.github.com> Signed-off-by: dependabot[bot] <support@github.com>
This commit is contained in:
@@ -27,7 +27,6 @@ import {
|
||||
} from 'pdfjs-dist/web/pdf_viewer.mjs'
|
||||
import {
|
||||
PdfRenderMode,
|
||||
PdfSource,
|
||||
PdfZoomLevel,
|
||||
PdfZoomScale,
|
||||
PngxPdfDocumentProxy,
|
||||
@@ -43,7 +42,8 @@ export class PngxPdfViewerComponent
|
||||
{
|
||||
private readonly document = inject<Document>(DOCUMENT)
|
||||
|
||||
@Input() src!: PdfSource
|
||||
@Input() src!: string
|
||||
@Input() password?: string
|
||||
@Input() page?: number
|
||||
@Output() pageChange = new EventEmitter<number>()
|
||||
@Input() rotation?: number
|
||||
@@ -93,7 +93,7 @@ export class PngxPdfViewerComponent
|
||||
}
|
||||
|
||||
ngOnChanges(changes: SimpleChanges): void {
|
||||
if (changes['src']) {
|
||||
if (changes['src'] || changes['password']) {
|
||||
this.resetViewerState()
|
||||
if (this.src) {
|
||||
this.loadDocument()
|
||||
@@ -174,8 +174,12 @@ export class PngxPdfViewerComponent
|
||||
'assets/js/pdf.worker.min.mjs',
|
||||
this.document.baseURI
|
||||
).toString()
|
||||
this.loadingTask = getDocument(this.src)
|
||||
|
||||
let initOptions = {
|
||||
url: this.src,
|
||||
password: this.password,
|
||||
withCredentials: true,
|
||||
}
|
||||
this.loadingTask = getDocument(initOptions)
|
||||
try {
|
||||
const pdf = await this.loadingTask.promise
|
||||
this.pdf = pdf
|
||||
|
||||
@@ -2,8 +2,6 @@ export type PngxPdfDocumentProxy = {
|
||||
numPages: number
|
||||
}
|
||||
|
||||
export type PdfSource = string | { url: string; password?: string }
|
||||
|
||||
export enum PdfRenderMode {
|
||||
Single = 'single',
|
||||
All = 'all',
|
||||
|
||||
@@ -473,6 +473,7 @@
|
||||
<div class="preview-sticky pdf-viewer-container">
|
||||
<pngx-pdf-viewer
|
||||
[src]="pdfSource"
|
||||
[password]="pdfPassword"
|
||||
[renderMode]="PdfRenderMode.All"
|
||||
[(page)]="previewCurrentPage"
|
||||
[zoomScale]="previewZoomScale"
|
||||
|
||||
@@ -1530,11 +1530,13 @@ describe('DocumentDetailComponent', () => {
|
||||
})
|
||||
|
||||
it('should clear pdf source if preview URL is empty', () => {
|
||||
component.pdfSource = { url: '/preview', password: 'secret' } as any
|
||||
component.pdfSource = '/preview'
|
||||
component.pdfPassword = 'secret'
|
||||
component.previewUrl = null
|
||||
;(component as any).updatePdfSource()
|
||||
|
||||
expect(component.pdfSource).toEqual({ url: null, password: undefined })
|
||||
expect(component.pdfSource).toEqual(null)
|
||||
expect(component.pdfPassword).toBeUndefined()
|
||||
})
|
||||
|
||||
it('should close incoming update modal if one is open', () => {
|
||||
@@ -1871,9 +1873,8 @@ describe('DocumentDetailComponent', () => {
|
||||
expect(component.thumbUrl).toBe('thumb-version')
|
||||
expect(component.previewText).toBe('version text')
|
||||
expect(component.documentForm.get('content').value).toBe('version-content')
|
||||
const pdfSource = component.pdfSource as { url: string; password?: string }
|
||||
expect(pdfSource.url).toBe('preview-version')
|
||||
expect(pdfSource.password).toBeUndefined()
|
||||
expect(component.pdfSource).toBe('preview-version')
|
||||
expect(component.pdfPassword).toBeUndefined()
|
||||
|
||||
previewSpy.mockReturnValueOnce('preview-error')
|
||||
component.selectVersion(11)
|
||||
|
||||
@@ -115,7 +115,6 @@ import { PDFEditorComponent } from '../common/pdf-editor/pdf-editor.component'
|
||||
import { PngxPdfViewerComponent } from '../common/pdf-viewer/pdf-viewer.component'
|
||||
import {
|
||||
PdfRenderMode,
|
||||
PdfSource,
|
||||
PdfZoomLevel,
|
||||
PdfZoomScale,
|
||||
PngxPdfDocumentProxy,
|
||||
@@ -242,7 +241,8 @@ export class DocumentDetailComponent
|
||||
title: string
|
||||
titleSubject: Subject<string> = new Subject()
|
||||
previewUrl: string
|
||||
pdfSource?: PdfSource
|
||||
pdfSource?: string
|
||||
pdfPassword?: string
|
||||
thumbUrl: string
|
||||
previewText: string
|
||||
previewLoaded: boolean = false
|
||||
@@ -375,10 +375,8 @@ export class DocumentDetailComponent
|
||||
}
|
||||
|
||||
private updatePdfSource() {
|
||||
this.pdfSource = {
|
||||
url: this.previewUrl,
|
||||
password: this.password,
|
||||
}
|
||||
this.pdfSource = this.previewUrl
|
||||
this.pdfPassword = this.password
|
||||
}
|
||||
|
||||
private loadMetadataForSelectedVersion() {
|
||||
|
||||
Reference in New Issue
Block a user