From c6f48336fcfe12cd1aa6f9ad175fb3a7c72600d0 Mon Sep 17 00:00:00 2001 From: Alfonso Salces Date: Wed, 7 Dec 2022 09:54:53 +0100 Subject: [PATCH] MOBILE-4081 swipe-slides: Book chapter tags not always shown --- src/addons/mod/book/pages/contents/contents.ts | 2 ++ src/core/components/swipe-slides/swipe-slides.ts | 10 ---------- 2 files changed, 2 insertions(+), 10 deletions(-) diff --git a/src/addons/mod/book/pages/contents/contents.ts b/src/addons/mod/book/pages/contents/contents.ts index 55fc00732..2bd8a6cbe 100644 --- a/src/addons/mod/book/pages/contents/contents.ts +++ b/src/addons/mod/book/pages/contents/contents.ts @@ -64,6 +64,8 @@ export class AddonModBookContentsPage implements OnInit, OnDestroy { navigationItems: CoreNavigationBarItem[] = []; slidesOpts: CoreSwipeSlidesOptions = { autoHeight: true, + observer: true, + observeParents: true, scrollOnChange: 'top', }; diff --git a/src/core/components/swipe-slides/swipe-slides.ts b/src/core/components/swipe-slides/swipe-slides.ts index b5405ac46..e411d6748 100644 --- a/src/core/components/swipe-slides/swipe-slides.ts +++ b/src/core/components/swipe-slides/swipe-slides.ts @@ -46,7 +46,6 @@ export class CoreSwipeSlidesComponent implements OnChanges, OnDe protected resizeListener: CoreEventObserver; protected updateSlidesPromise?: Promise; protected activeSlideIndexes: number[] = []; - protected mutationObserver: MutationObserver; constructor( elementRef: ElementRef, @@ -57,14 +56,6 @@ export class CoreSwipeSlidesComponent 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 implements OnChanges, OnDe ngOnDestroy(): void { this.unsubscribe && this.unsubscribe(); this.resizeListener.off(); - this.mutationObserver.disconnect(); } }