mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2025-04-02 13:45:10 -05:00
42 lines
1.7 KiB
HTML
42 lines
1.7 KiB
HTML
@if (!previewOnly) {
|
|
<a [href]="link ?? previewUrl" class="{{linkClasses}}" [target]="linkTarget" [title]="linkTitle"
|
|
[ngbPopover]="previewContent" [popoverTitle]="document.title | documentTitle" container="body"
|
|
autoClose="true" [popoverClass]="popoverClass" (mouseenter)="mouseEnterPreview()" (mouseleave)="mouseLeavePreview()" #popover="ngbPopover">
|
|
<ng-content></ng-content>
|
|
</a>
|
|
} @else {
|
|
<ng-container [ngTemplateOutlet]="previewContent" [ngTemplateOutletContext]="{ $implicit: document }"></ng-container>
|
|
}
|
|
<ng-template #previewContent>
|
|
<div class="preview-popup-container" [class.full-size]="previewOnly" (mouseenter)="mouseEnterPreview()" (mouseleave)="mouseLeavePreview(); close()">
|
|
@if (error) {
|
|
<div class="w-100 h-100 position-relative">
|
|
<p class="fst-italic position-absolute top-50 start-50 translate-middle" i18n>Error loading preview</p>
|
|
</div>
|
|
} @else {
|
|
@if (renderAsObject) {
|
|
@if (previewText) {
|
|
<div class="bg-light p-3 overflow-auto whitespace-preserve" width="100%">{{previewText}}</div>
|
|
} @else {
|
|
<object [data]="previewURL | safeUrl" width="100%" class="bg-light" [class.p-2]="!isPdf"></object>
|
|
}
|
|
} @else {
|
|
@if (requiresPassword) {
|
|
<div class="w-100 h-100 position-relative">
|
|
<i-bs width="2em" height="2em" class="position-absolute top-50 start-50 translate-middle" name="file-earmark-lock"></i-bs>
|
|
</div>
|
|
}
|
|
@if (!requiresPassword) {
|
|
<pdf-viewer
|
|
[src]="previewURL"
|
|
[original-size]="false"
|
|
[show-borders]="false"
|
|
[show-all]="true"
|
|
(error)="onError($event)">
|
|
</pdf-viewer>
|
|
}
|
|
}
|
|
}
|
|
</div>
|
|
</ng-template>
|