fixed auto-expand of table of contents on scroll

This commit is contained in:
Sofia Papacharalampous 2024-05-17 14:33:27 +03:00
parent 3323e40aea
commit 8f36b6bbe0
1 changed files with 4 additions and 2 deletions

View File

@ -222,7 +222,8 @@ export class TableOfContentsComponent extends BaseComponent implements OnInit, O
entries.forEach(ie => {
if (ie.isIntersecting) {
try {
const target_id = ie.target.id.replace(this.TOCENTRY_ID_PREFIX, '');
// const target_id = ie.target.id.replace(this.TOCENTRY_ID_PREFIX, '');
const target_id = ie.target.id;//.replace(this.TOCENTRY_ID_PREFIX, '');
if (this.visibilityRulesService.isVisibleMap[target_id] ?? true) {
this.onToCentrySelected(this._findTocEntryById(target_id, this.tocentries));
}
@ -238,7 +239,8 @@ export class TableOfContentsComponent extends BaseComponent implements OnInit, O
fieldsetsEtries.forEach(e => {
if (e.type === ToCEntryType.FieldSet) {
try {
const targetElement = document.getElementById(this.TOCENTRY_ID_PREFIX + e.id);
// const targetElement = document.getElementById(this.TOCENTRY_ID_PREFIX + e.id);
const targetElement = document.getElementById(e.id);
this._intersectionObserver.observe(targetElement);
} catch {
console.log('element not found');