toc auto-expand bug fix on description editor

This commit is contained in:
Sofia Papacharalampous 2024-05-22 16:58:06 +03:00
parent a5bc78f91d
commit 6a11832e2b
3 changed files with 8 additions and 5 deletions

View File

@ -9,7 +9,7 @@
<ng-container >
<span class="table-entry"
(click)="onScrollStarted(entry); toggleExpand(idx);navigateToFieldSet(entry, $event); onEntrySelected(entry);"
(click)="toggleExpand(idx);navigateToFieldSet(entry, $event); onEntrySelected(entry);"
[ngStyle]="calculateStyle(entry)"
[ngClass]="calculateClass(entry)"
>

View File

@ -153,6 +153,7 @@ export class TableOfContentsInternal implements OnInit, OnDestroy {
navigateToFieldSet(entry: ToCEntry, event) {
if (entry.type === ToCEntryType.FieldSet) {
this.onScrollStarted(entry);
const fieldSetId = entry.id;
const element = document.getElementById(fieldSetId);

View File

@ -210,7 +210,7 @@ export class TableOfContentsComponent extends BaseComponent implements OnInit, O
const options = {
root: null,
rootMargin: '-38% 0px -60% 0px',
rootMargin: '20% 0px -30% 0px',
threshold: 0
}
@ -220,8 +220,6 @@ export class TableOfContentsComponent extends BaseComponent implements OnInit, O
}
entries.forEach(ie => {
if (this.isScrolling) return;
if (ie.isIntersecting) {
try {
if(!this.isScrolling) {
@ -229,6 +227,8 @@ export class TableOfContentsComponent extends BaseComponent implements OnInit, O
if (this.visibilityRulesService.isVisibleMap[target_id] ?? true) {
this.onToCentrySelected(this._findTocEntryById(target_id, this.tocentries));
}
} else {
console.log('cannot scroll');
}
} catch {
}
@ -445,10 +445,12 @@ export class TableOfContentsComponent extends BaseComponent implements OnInit, O
}
onScrollStarted(entry: ToCEntry) {
this.console.log('started');
this.isScrolling = true;
}
onScrollFinished(entry: ToCEntry) {
this.console.log('finished');
this.isScrolling = false;
}