Pre-load pdf contents

This commit is contained in:
Michael Shamoon
2021-02-06 14:28:26 -08:00
parent 4a471138b2
commit b0fed61a01
3 changed files with 18 additions and 4 deletions

View File

@@ -37,6 +37,9 @@ export class DocumentCardSmallComponent implements OnInit {
@ViewChild('popover') popover: NgbPopover
mouseOnPreview = false
popoverHidden = true
metadata: PaperlessDocumentMetadata
ngOnInit(): void {
@@ -81,10 +84,16 @@ export class DocumentCardSmallComponent implements OnInit {
mouseEnterPreview() {
this.mouseOnPreview = true
if (!this.popover.isOpen()) {
// we're going to open but hide to pre-load content during hover delay
this.popover.open()
this.popoverHidden = true
setTimeout(() => {
if (this.mouseOnPreview) {
// show popover
this.popoverHidden = false
this.showPreview.emit(this)
this.popover.open()
} else {
this.popover.close()
}
}, 600);
}