From: Michael Shamoon <4887959+shamoon@users.noreply.github.com> Date: Tue, 29 Mar 2022 17:35:42 +0000 (-0700) Subject: Show prompt on password-protected pdfs X-Git-Tag: beta-1.7.0-rc1~31^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F564%2Fhead;p=thirdparty%2Fpaperless-ngx.git Show prompt on password-protected pdfs --- diff --git a/src-ui/src/app/components/document-detail/document-detail.component.html b/src-ui/src/app/components/document-detail/document-detail.component.html index d16acb164d..f9fecdf854 100644 --- a/src-ui/src/app/components/document-detail/document-detail.component.html +++ b/src-ui/src/app/components/document-detail/document-detail.component.html @@ -135,20 +135,27 @@
  • - Preview - - -
    - + Preview + +
    + +
    + +
    + + + +
    + + + +
    +
    + +
    +
    - - - - - - - -
    +
  • @@ -160,10 +167,10 @@ -
    +
    - +
    @@ -172,5 +179,11 @@ +
    +
    + +
    +
    +
    diff --git a/src-ui/src/app/components/document-detail/document-detail.component.scss b/src-ui/src/app/components/document-detail/document-detail.component.scss index 5512b6bb06..c5823fd080 100644 --- a/src-ui/src/app/components/document-detail/document-detail.component.scss +++ b/src-ui/src/app/components/document-detail/document-detail.component.scss @@ -17,3 +17,10 @@ --page-margin: 1px 0 -8px; width: 100% !important; } + +.password-prompt { + position: absolute; + top: 30%; + left: 30%; + right: 30%; +} diff --git a/src-ui/src/app/components/document-detail/document-detail.component.ts b/src-ui/src/app/components/document-detail/document-detail.component.ts index 52593ced51..4767a24957 100644 --- a/src-ui/src/app/components/document-detail/document-detail.component.ts +++ b/src-ui/src/app/components/document-detail/document-detail.component.ts @@ -1,10 +1,4 @@ -import { - Component, - OnInit, - OnDestroy, - ViewChild, - ElementRef, -} from '@angular/core' +import { Component, OnInit, OnDestroy, ViewChild } from '@angular/core' import { FormControl, FormGroup } from '@angular/forms' import { ActivatedRoute, Router } from '@angular/router' import { NgbModal, NgbNav } from '@ng-bootstrap/ng-bootstrap' @@ -90,6 +84,9 @@ export class DocumentDetailComponent isDirty$: Observable unsubscribeNotifier: Subject = new Subject() + requiresPassword: boolean = false + password: string + @ViewChild('nav') nav: NgbNav @ViewChild('pdfPreview') set pdfPreview(element) { // this gets called when compontent added or removed from DOM @@ -450,5 +447,18 @@ export class DocumentDetailComponent pdfPreviewLoaded(pdf: PDFDocumentProxy) { this.previewNumPages = pdf.numPages + if (this.password) this.requiresPassword = false + } + + onError(event) { + if (event.name == 'PasswordException') { + this.requiresPassword = true + } + } + + onPasswordKeyUp(event: KeyboardEvent) { + if ('Enter' == event.key) { + this.password = (event.target as HTMLInputElement).value + } } }