mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2025-05-03 11:29:28 -05:00
Tweak the preload stuff
This commit is contained in:
parent
d4c05ad46e
commit
432d81845e
@ -1,6 +1,6 @@
|
|||||||
<a [href]="previewUrl" target="_blank" class="{{btn_classes}}"
|
<a [href]="previewUrl" target="_blank" class="{{btn_classes}}"
|
||||||
[ngbPopover]="previewContent" [popoverTitle]="document.title | documentTitle"
|
[ngbPopover]="previewContent" [popoverTitle]="document.title | documentTitle"
|
||||||
autoClose="true" popoverClass="shadow popover-preview" (mouseenter)="mouseEnterPreview()" (mouseleave)="mouseLeavePreview()" #popover="ngbPopover">
|
autoClose="true" [popoverClass]="popoverClass" (mouseenter)="mouseEnterPreview()" (mouseleave)="mouseLeavePreview()" #popover="ngbPopover">
|
||||||
<ng-content></ng-content>
|
<ng-content></ng-content>
|
||||||
</a>
|
</a>
|
||||||
<ng-template #previewContent>
|
<ng-template #previewContent>
|
||||||
|
@ -131,9 +131,7 @@ describe('PreviewPopupComponent', () => {
|
|||||||
it('should show preview on mouseover after delay to preload content', fakeAsync(() => {
|
it('should show preview on mouseover after delay to preload content', fakeAsync(() => {
|
||||||
component.mouseEnterPreview()
|
component.mouseEnterPreview()
|
||||||
expect(component.popover.isOpen()).toBeTruthy()
|
expect(component.popover.isOpen()).toBeTruthy()
|
||||||
expect(component.popoverHidden).toBeTruthy()
|
|
||||||
tick(600)
|
tick(600)
|
||||||
expect(component.popoverHidden).toBeFalsy()
|
|
||||||
component.close()
|
component.close()
|
||||||
|
|
||||||
component.mouseEnterPreview()
|
component.mouseEnterPreview()
|
||||||
|
@ -38,7 +38,8 @@ export class PreviewPopupComponent implements OnDestroy {
|
|||||||
@ViewChild('popover') popover: NgbPopover
|
@ViewChild('popover') popover: NgbPopover
|
||||||
|
|
||||||
mouseOnPreview: boolean
|
mouseOnPreview: boolean
|
||||||
popoverHidden: boolean
|
|
||||||
|
popoverClass: string = 'shadow popover-preview'
|
||||||
|
|
||||||
get renderAsObject(): boolean {
|
get renderAsObject(): boolean {
|
||||||
return (this.isPdf && this.useNativePdfViewer) || !this.isPdf
|
return (this.isPdf && this.useNativePdfViewer) || !this.isPdf
|
||||||
@ -102,11 +103,11 @@ export class PreviewPopupComponent implements OnDestroy {
|
|||||||
if (!this.popover.isOpen()) {
|
if (!this.popover.isOpen()) {
|
||||||
// we're going to open but hide to pre-load content during hover delay
|
// we're going to open but hide to pre-load content during hover delay
|
||||||
this.popover.open()
|
this.popover.open()
|
||||||
this.popoverHidden = true
|
this.popoverClass = 'shadow popover-preview pe-none opacity-0'
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
if (this.mouseOnPreview) {
|
if (this.mouseOnPreview) {
|
||||||
// show popover
|
// show popover
|
||||||
this.popoverHidden = false
|
this.popoverClass = this.popoverClass.replace('pe-none opacity-0', '')
|
||||||
} else {
|
} else {
|
||||||
this.popover.close()
|
this.popover.close()
|
||||||
}
|
}
|
||||||
@ -119,6 +120,6 @@ export class PreviewPopupComponent implements OnDestroy {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public close() {
|
public close() {
|
||||||
this.popover.close()
|
this.popover.close(false)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user