Skip to content

Commit

Permalink
fix: courseware-chromeless.html iframe height
Browse files Browse the repository at this point in the history
  • Loading branch information
kuipumu committed Oct 1, 2024
1 parent 4ae1637 commit 44d1c52
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions lms/templates/courseware/courseware-chromeless.html
Original file line number Diff line number Diff line change
Expand Up @@ -121,14 +121,15 @@
// document loads, window resizes, or DOM mutates.
if (window !== window.parent) {
document.body.className += ' view-in-mfe';
var lastHeight = window.offsetHeight;
const extraHeight = 250; // Set extra height value.
var lastHeight = window.offsetHeight + extraHeight; // Add extra height to avoid clipping.
var lastWidth = window.offsetWidth;
var contentElement = document.getElementById('content');

function dispatchResizeMessage(event) {
// Note: event is actually an Array of MutationRecord objects when fired from the MutationObserver
var isLoadEvent = event.type === 'load';
var newHeight = contentElement.offsetHeight;
var newHeight = contentElement.offsetHeight + extraHeight; // Add extra height to avoid clipping.
var newWidth = contentElement.offsetWidth;
if (!isLoadEvent && newWidth === lastWidth && newHeight === lastHeight) {
// Monitor when any anchor tag is clicked, it is checked to make sure
Expand Down

0 comments on commit 44d1c52

Please sign in to comment.