Merge pull request #3504 from alfonso-salces/MOBILE-4081

MOBILE-4081 swipe-slides: Book chapter tags not always shown
main
Noel De Martin 2022-12-07 10:07:47 +01:00 committed by GitHub
commit 4fdb77a2a5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 10 deletions

View File

@ -64,6 +64,8 @@ export class AddonModBookContentsPage implements OnInit, OnDestroy {
navigationItems: CoreNavigationBarItem<AddonModBookTocChapter>[] = [];
slidesOpts: CoreSwipeSlidesOptions = {
autoHeight: true,
observer: true,
observeParents: true,
scrollOnChange: 'top',
};

View File

@ -46,7 +46,6 @@ export class CoreSwipeSlidesComponent<Item = unknown> implements OnChanges, OnDe
protected resizeListener: CoreEventObserver;
protected updateSlidesPromise?: Promise<void>;
protected activeSlideIndexes: number[] = [];
protected mutationObserver: MutationObserver;
constructor(
elementRef: ElementRef<HTMLElement>,
@ -57,14 +56,6 @@ export class CoreSwipeSlidesComponent<Item = unknown> implements OnChanges, OnDe
this.resizeListener = CoreDom.onWindowResize(async () => {
await this.updateSlidesComponent();
});
this.mutationObserver = new MutationObserver(() => {
setTimeout(async () => {
await this.updateSlidesComponent();
}, 100);
});
this.mutationObserver.observe(this.hostElement, { subtree: true, childList: true });
}
/**
@ -321,7 +312,6 @@ export class CoreSwipeSlidesComponent<Item = unknown> implements OnChanges, OnDe
ngOnDestroy(): void {
this.unsubscribe && this.unsubscribe();
this.resizeListener.off();
this.mutationObserver.disconnect();
}
}