Fix ResizeObserver condition in landings and fs-modal
This commit is contained in:
parent
0b79af31e0
commit
aa10b35f7a
|
@ -1,4 +1,4 @@
|
|||
import {ChangeDetectorRef, Component, ElementRef, HostListener, Input, ViewChild} from '@angular/core';
|
||||
import {ChangeDetectorRef, Component, ElementRef, Input, ViewChild} from '@angular/core';
|
||||
import {ActivatedRoute, Router} from '@angular/router';
|
||||
import {Meta, Title} from '@angular/platform-browser';
|
||||
|
||||
|
@ -26,7 +26,6 @@ import {ResultPreview} from "../../utils/result-preview/result-preview";
|
|||
import {IndexInfoService} from "../../utils/indexInfo.service";
|
||||
import {properties} from "../../../../environments/environment";
|
||||
import {Subscriber, Subscription, zip} from "rxjs";
|
||||
import {TabComponent} from "../../utils/tabs/tab.component";
|
||||
import {OpenaireEntities} from "../../utils/properties/searchFields";
|
||||
import {MetricsService} from '../../services/metrics.service';
|
||||
import {NumberUtils} from '../../utils/number-utils.class';
|
||||
|
@ -358,7 +357,8 @@ export class DataProviderComponent {
|
|||
this.subscriptions.forEach(subscription => {
|
||||
if (subscription instanceof Subscriber) {
|
||||
subscription.unsubscribe();
|
||||
} else if (subscription instanceof (ResizeObserver || IntersectionObserver)) {
|
||||
} else if ((typeof ResizeObserver != 'undefined' && subscription instanceof ResizeObserver) ||
|
||||
(typeof IntersectionObserver != 'undefined' && subscription instanceof IntersectionObserver)) {
|
||||
subscription.disconnect();
|
||||
}
|
||||
});
|
||||
|
|
|
@ -280,7 +280,8 @@ export class OrganizationComponent {
|
|||
this.subscriptions.forEach(subscription => {
|
||||
if (subscription instanceof Subscriber) {
|
||||
subscription.unsubscribe();
|
||||
} else if (subscription instanceof (ResizeObserver || IntersectionObserver)) {
|
||||
} else if ((typeof ResizeObserver != 'undefined' && subscription instanceof ResizeObserver) ||
|
||||
(typeof IntersectionObserver != 'undefined' && subscription instanceof IntersectionObserver)) {
|
||||
subscription.disconnect();
|
||||
}
|
||||
});
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import {ChangeDetectorRef, Component, ElementRef, HostListener, Input, ViewChild} from '@angular/core';
|
||||
import {ChangeDetectorRef, Component, ElementRef, Input, ViewChild} from '@angular/core';
|
||||
import {ActivatedRoute, Router} from '@angular/router';
|
||||
import {Meta, Title} from '@angular/platform-browser';
|
||||
|
||||
|
@ -25,7 +25,7 @@ import {StringUtils} from "../../utils/string-utils.class";
|
|||
import {ResultPreview} from "../../utils/result-preview/result-preview";
|
||||
import {SearchResult} from "../../utils/entities/searchResult";
|
||||
import {IndexInfoService} from "../../utils/indexInfo.service";
|
||||
import {Subscriber, zip, Subscription} from "rxjs";
|
||||
import {Subscriber, Subscription, zip} from "rxjs";
|
||||
import {properties} from "../../../../environments/environment";
|
||||
import {Option} from "../../sharedComponents/input/input.component";
|
||||
import {OpenaireEntities} from "../../utils/properties/searchFields";
|
||||
|
@ -380,7 +380,8 @@ export class ProjectComponent {
|
|||
this.subscriptions.forEach(subscription => {
|
||||
if (subscription instanceof Subscriber) {
|
||||
subscription.unsubscribe();
|
||||
} else if (subscription instanceof (ResizeObserver || IntersectionObserver)) {
|
||||
} else if ((typeof ResizeObserver != 'undefined' && subscription instanceof ResizeObserver) ||
|
||||
(typeof IntersectionObserver != 'undefined' && subscription instanceof IntersectionObserver)) {
|
||||
subscription.disconnect();
|
||||
}
|
||||
});
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import {ChangeDetectorRef, Component, ElementRef, EventEmitter, HostListener, Input, Output, ViewChild} from '@angular/core';
|
||||
import {ChangeDetectorRef, Component, ElementRef, Input, ViewChild} from '@angular/core';
|
||||
import {ActivatedRoute, Router} from '@angular/router';
|
||||
import {Meta, Title} from '@angular/platform-browser';
|
||||
|
||||
|
@ -18,8 +18,7 @@ import {IndexInfoService} from "../../utils/indexInfo.service";
|
|||
import {Identifier, StringUtils} from "../../utils/string-utils.class";
|
||||
import {properties} from "../../../../environments/environment";
|
||||
import {ISVocabulariesService} from "../../utils/staticAutoComplete/ISVocabularies.service";
|
||||
import {forkJoin, Observable, Subscription, zip} from "rxjs";
|
||||
import {AnnotationComponent} from "../annotation/annotation.component";
|
||||
import {Subscription} from "rxjs";
|
||||
import {ParsingFunctions} from "../landing-utils/parsingFunctions.class";
|
||||
import {ConnectHelper} from "../../connect/connectHelper";
|
||||
import {UserManagementService} from "../../services/user-management.service";
|
||||
|
@ -383,7 +382,8 @@ export class ResultLandingComponent {
|
|||
subscription.unsubscribe();
|
||||
} else if (subscription instanceof Function) {
|
||||
subscription();
|
||||
} else if (subscription instanceof (ResizeObserver || IntersectionObserver)) {
|
||||
} else if ((typeof ResizeObserver != 'undefined' && subscription instanceof ResizeObserver) ||
|
||||
(typeof IntersectionObserver != 'undefined' && subscription instanceof IntersectionObserver)) {
|
||||
subscription.disconnect();
|
||||
}
|
||||
});
|
||||
|
|
|
@ -76,8 +76,6 @@ export class FullScreenModalComponent implements AfterViewInit, OnDestroy {
|
|||
@ViewChild('modal') modal: ElementRef;
|
||||
@ViewChild('header') header: ElementRef;
|
||||
@ViewChild('body') body: ElementRef;
|
||||
observer: any;
|
||||
headerHeight: number;
|
||||
bodyHeight: number;
|
||||
private subscriptions: any[] = [];
|
||||
|
||||
|
@ -99,12 +97,13 @@ export class FullScreenModalComponent implements AfterViewInit, OnDestroy {
|
|||
|
||||
ngAfterViewInit() {
|
||||
if(typeof window !== "undefined") {
|
||||
this.observer = new ResizeObserver(entries => {
|
||||
let observer = new ResizeObserver(entries => {
|
||||
for (let entry of entries) {
|
||||
this.changeHeight();
|
||||
}
|
||||
});
|
||||
this.observer.observe(this.header.nativeElement);
|
||||
observer.observe(this.header.nativeElement);
|
||||
this.subscriptions.push(observer);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -117,9 +116,6 @@ export class FullScreenModalComponent implements AfterViewInit, OnDestroy {
|
|||
}
|
||||
|
||||
ngOnDestroy() {
|
||||
if(this.observer && this.observer instanceof ResizeObserver) {
|
||||
this.observer.disconnect();
|
||||
}
|
||||
if(typeof document !== "undefined") {
|
||||
const element = document.getElementById("modal-container");
|
||||
for (let i = element.childNodes.length - 1; i >= 0; --i) {
|
||||
|
@ -132,8 +128,10 @@ export class FullScreenModalComponent implements AfterViewInit, OnDestroy {
|
|||
this.subscriptions.forEach(subscription => {
|
||||
if(subscription instanceof Subscription) {
|
||||
subscription.unsubscribe();
|
||||
} else if(typeof ResizeObserver != 'undefined' && subscription instanceof ResizeObserver) {
|
||||
subscription.disconnect();
|
||||
}
|
||||
})
|
||||
});
|
||||
}
|
||||
|
||||
get isOpen() {
|
||||
|
|
Loading…
Reference in New Issue