@@ -810,52 +810,52 @@ const Hooks = {
810810 } ) ;
811811
812812 // Observe candidate elements to update current index based on scroll position
813- this . setupScrollObserver ( ) ;
813+ // this.setupScrollObserver();
814814 } ,
815815
816- setupScrollObserver ( ) {
817- if ( this . observer ) {
818- this . observer . disconnect ( ) ;
819- }
820-
821- this . observer = new IntersectionObserver (
822- ( entries ) => {
823- entries . forEach ( ( entry ) => {
824- if ( entry . isIntersecting && entry . intersectionRatio > 0.5 ) {
825- const candidateId = entry . target . id ;
826- const index = candidateId . split ( "-" ) [ 1 ] ;
827- if ( index !== undefined ) {
828- // Update the sidebar selection without triggering a scroll
829- this . pushEvent ( "update_current_index_silent" , {
830- index : parseInt ( index ) ,
831- } ) ;
832- }
833- }
834- } ) ;
835- } ,
836- {
837- root : null ,
838- rootMargin : "-20% 0px -20% 0px" ,
839- threshold : [ 0.5 ] ,
840- }
841- ) ;
842-
843- // Observe all candidate elements
844- document . querySelectorAll ( '[id^="candidate-"]' ) . forEach ( ( el ) => {
845- this . observer . observe ( el ) ;
846- } ) ;
847- } ,
848-
849- updated ( ) {
850- // Re-setup observer when candidates are updated
851- this . setupScrollObserver ( ) ;
852- } ,
853-
854- destroyed ( ) {
855- if ( this . observer ) {
856- this . observer . disconnect ( ) ;
857- }
858- } ,
816+ // setupScrollObserver() {
817+ // if (this.observer) {
818+ // this.observer.disconnect();
819+ // }
820+
821+ // this.observer = new IntersectionObserver(
822+ // (entries) => {
823+ // entries.forEach((entry) => {
824+ // if (entry.isIntersecting && entry.intersectionRatio > 0.5) {
825+ // const candidateId = entry.target.id;
826+ // const index = candidateId.split("-")[1];
827+ // if (index !== undefined) {
828+ // // Update the sidebar selection without triggering a scroll
829+ // this.pushEvent("update_current_index_silent", {
830+ // index: parseInt(index),
831+ // });
832+ // }
833+ // }
834+ // });
835+ // },
836+ // {
837+ // root: null,
838+ // rootMargin: "-20% 0px -20% 0px",
839+ // threshold: [0.5],
840+ // }
841+ // );
842+
843+ // // Observe all candidate elements
844+ // document.querySelectorAll('[id^="candidate-"]').forEach((el) => {
845+ // this.observer.observe(el);
846+ // });
847+ // },
848+
849+ // updated() {
850+ // // Re-setup observer when candidates are updated
851+ // this.setupScrollObserver();
852+ // },
853+
854+ // destroyed() {
855+ // if (this.observer) {
856+ // this.observer.disconnect();
857+ // }
858+ // },
859859 } ,
860860} satisfies Record < string , Partial < ViewHook > & Record < string , unknown > > ;
861861
0 commit comments