Skip to content

Commit 0d8ca43

Browse files
committed
fix: scrolling in compare preview
1 parent d374cdc commit 0d8ca43

2 files changed

Lines changed: 17 additions & 4 deletions

File tree

src/library-authoring/LibraryBlock/LibraryBlock.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ interface LibraryBlockProps {
2121
minHeight?: string;
2222
scrollIntoView?: boolean;
2323
showTitle?: boolean,
24+
addHeight?: number;
2425
}
2526
/**
2627
* React component that displays an XBlock in a sandboxed IFrame.
@@ -40,6 +41,7 @@ export const LibraryBlock = ({
4041
scrolling = 'no',
4142
scrollIntoView = false,
4243
showTitle = false,
44+
addHeight = 0,
4345
}: LibraryBlockProps) => {
4446
const { iframeRef, setIframeRef } = useIframe();
4547
const xblockView = view ?? 'student_view';
@@ -96,7 +98,10 @@ export const LibraryBlock = ({
9698
loading="lazy"
9799
referrerPolicy="origin"
98100
style={{
99-
width: '100%', height: iframeHeight, pointerEvents: 'auto', minHeight,
101+
width: '100%',
102+
height: iframeHeight + addHeight,
103+
pointerEvents: 'auto',
104+
minHeight,
100105
}}
101106
allow={IFRAME_FEATURE_POLICY}
102107
allowFullScreen

src/library-authoring/component-comparison/CompareChangesWidget.tsx

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { useIntl } from '@edx/frontend-platform/i18n';
2-
import { Card, Stack, Tab, Tabs } from '@openedx/paragon';
2+
import { Card, Scrollable, Stack, Tab, Tabs } from '@openedx/paragon';
33
import classNames from 'classnames';
44
import { IframeProvider } from '@src/generic/hooks/context/iFrameContext';
55

@@ -49,7 +49,10 @@ const CompareChangesWidget = ({
4949

5050
const oldBlock = oldVersion !== 0 && (
5151
<Card className={classNames('flex-1 min-w-0', { 'border-0': !sideBySide })}>
52-
<Card.Body className="p-4 bg-white">
52+
<Card.Body
53+
className="p-4 bg-white overflow-auto"
54+
style={{ height: '70vh' }}
55+
>
5356
{sideBySide && (
5457
<h3 className="w-100 text-center mb-4">
5558
{oldTabMessage}
@@ -67,6 +70,7 @@ const CompareChangesWidget = ({
6770
version={oldVersion}
6871
minHeight="50vh"
6972
showTitle={showTitle}
73+
addHeight={40}
7074
/>
7175
</IframeProvider>
7276
</div>
@@ -76,7 +80,10 @@ const CompareChangesWidget = ({
7680

7781
const newBlock = (
7882
<Card className={classNames('flex-1 min-w-0', { 'border-0': !sideBySide })}>
79-
<Card.Body className="p-4 bg-white">
83+
<Card.Body
84+
className="p-4 bg-white overflow-auto"
85+
style={{ height: '70vh' }}
86+
>
8087
{sideBySide && (
8188
<h3 className="w-100 text-center mb-4">
8289
{newTabMessage}
@@ -88,6 +95,7 @@ const CompareChangesWidget = ({
8895
version={newVersion}
8996
showTitle={showNewTitle || showTitle}
9097
minHeight="50vh"
98+
addHeight={40}
9199
/>
92100
</IframeProvider>
93101
</Card.Body>

0 commit comments

Comments
 (0)