Skip to content
This repository was archived by the owner on Apr 18, 2024. It is now read-only.

Commit ccf87de

Browse files
authored
fix: LSDV-5335: Account for hidden scroll-space in preview (#1496)
* account for hidden scrollspace on main content window in preview * if annotation is not available use first child for filled space calc * overflow hidden on x axis --------- Co-authored-by: Travis1282 <Travis1282@users.noreply.github.com>
1 parent 624dfac commit ccf87de

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/tags/object/Paragraphs/HtxParagraphs.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -456,15 +456,18 @@ class HtxParagraphsView extends Component {
456456
_handleScrollContainerHeight() {
457457
const container = this.myRef.current;
458458
const mainContentView = document.querySelector('.lsf-main-content');
459+
const mainRect = mainContentView.getBoundingClientRect();
460+
const visibleHeight = document.documentElement.clientHeight - mainRect.top;
459461
const annotationView = document.querySelector('.lsf-main-view__annotation');
460-
const totalSpace = mainContentView?.offsetHeight || 0;
461-
const filledSpace = annotationView?.offsetHeight || 0;
462+
const totalVisibleSpace = Math.floor(visibleHeight < mainRect.height ? visibleHeight : mainContentView?.offsetHeight || 0);
463+
const filledSpace = annotationView?.offsetHeight || mainContentView.firstChild?.offsetHeight || 0;
462464
const containerHeight = container?.offsetHeight || 0;
463465
const viewPadding = parseInt(window.getComputedStyle(mainContentView)?.getPropertyValue('padding-bottom')) || 0;
464-
const height = totalSpace - (filledSpace - containerHeight) - (viewPadding);
466+
const height = totalVisibleSpace - (filledSpace - containerHeight) - (viewPadding);
465467
const minHeight = 100;
466468

467469
if (container) this.myRef.current.style.maxHeight = `${height < minHeight ? minHeight : height}px`;
470+
468471
}
469472

470473
_handleScrollRoot() {

0 commit comments

Comments
 (0)